2018-12-14 08:55:37 +00:00
|
|
|
/*
|
2021-08-05 11:14:17 +01:00
|
|
|
* Copyright (c) 2019-2021, Xilinx, Inc. All rights reserved.
|
2018-12-14 08:55:37 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Top-level SMC handler for Versal power management calls and
|
|
|
|
* IPI setup functions for communication with PMC.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
#include <plat_private.h>
|
2019-01-09 12:10:29 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <common/runtime_svc.h>
|
2021-03-17 17:31:17 +00:00
|
|
|
#include <plat/common/platform.h>
|
2019-01-09 12:10:29 +00:00
|
|
|
#include "pm_api_sys.h"
|
2018-12-14 08:55:37 +00:00
|
|
|
#include "pm_client.h"
|
|
|
|
#include "pm_ipi.h"
|
2021-03-31 10:07:40 +01:00
|
|
|
#include <drivers/arm/gicv3.h>
|
|
|
|
|
|
|
|
#define XSCUGIC_SGIR_EL1_INITID_SHIFT 24U
|
2021-08-05 07:58:46 +01:00
|
|
|
#define INVALID_SGI 0xFFU
|
2021-03-31 10:07:40 +01:00
|
|
|
DEFINE_RENAME_SYSREG_RW_FUNCS(icc_asgi1r_el1, S3_0_C12_C11_6)
|
2018-12-14 08:55:37 +00:00
|
|
|
|
2019-01-09 12:10:29 +00:00
|
|
|
/* pm_up = true - UP, pm_up = false - DOWN */
|
|
|
|
static bool pm_up;
|
2021-08-05 07:58:46 +01:00
|
|
|
static unsigned int sgi = (unsigned int)INVALID_SGI;
|
2019-01-09 12:10:29 +00:00
|
|
|
|
2021-03-17 17:31:17 +00:00
|
|
|
static uint64_t ipi_fiq_handler(uint32_t id, uint32_t flags, void *handle,
|
|
|
|
void *cookie)
|
|
|
|
{
|
2021-08-05 07:58:46 +01:00
|
|
|
unsigned int cpu;
|
2021-03-31 10:07:40 +01:00
|
|
|
unsigned int reg;
|
|
|
|
|
2021-03-17 17:31:17 +00:00
|
|
|
(void)plat_ic_acknowledge_interrupt();
|
2021-08-05 07:58:46 +01:00
|
|
|
cpu = plat_my_core_pos() + 1U;
|
2021-03-31 10:07:40 +01:00
|
|
|
|
2021-08-05 07:58:46 +01:00
|
|
|
if ((unsigned int)sgi != (unsigned int)INVALID_SGI) {
|
|
|
|
reg = (cpu | ((unsigned int)sgi << (unsigned int)XSCUGIC_SGIR_EL1_INITID_SHIFT));
|
2021-03-31 10:07:40 +01:00
|
|
|
write_icc_asgi1r_el1(reg);
|
|
|
|
}
|
2021-03-17 17:31:17 +00:00
|
|
|
|
|
|
|
/* Clear FIQ */
|
|
|
|
plat_ic_end_of_interrupt(id);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-03-31 10:07:40 +01:00
|
|
|
/**
|
|
|
|
* pm_register_sgi() - PM register the IPI interrupt
|
|
|
|
*
|
|
|
|
* @sgi - SGI number to be used for communication.
|
|
|
|
* @return On success, the initialization function must return 0.
|
|
|
|
* Any other return value will cause the framework to ignore
|
|
|
|
* the service
|
|
|
|
*
|
|
|
|
* Update the SGI number to be used.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
int pm_register_sgi(unsigned int sgi_num)
|
|
|
|
{
|
2021-08-05 07:58:46 +01:00
|
|
|
if ((unsigned int)sgi != (unsigned int)INVALID_SGI) {
|
2021-03-31 10:07:40 +01:00
|
|
|
return -EBUSY;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sgi_num >= GICV3_MAX_SGI_TARGETS) {
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2021-08-05 07:58:46 +01:00
|
|
|
sgi = (unsigned int)sgi_num;
|
2021-03-31 10:07:40 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-12-14 08:55:37 +00:00
|
|
|
/**
|
|
|
|
* pm_setup() - PM service setup
|
|
|
|
*
|
|
|
|
* @return On success, the initialization function must return 0.
|
|
|
|
* Any other return value will cause the framework to ignore
|
|
|
|
* the service
|
|
|
|
*
|
|
|
|
* Initialization functions for Versal power management for
|
|
|
|
* communicaton with PMC.
|
|
|
|
*
|
|
|
|
* Called from sip_svc_setup initialization function with the
|
|
|
|
* rt_svc_init signature.
|
|
|
|
*/
|
|
|
|
int pm_setup(void)
|
|
|
|
{
|
|
|
|
int status, ret = 0;
|
|
|
|
|
|
|
|
status = pm_ipi_init(primary_proc);
|
|
|
|
|
|
|
|
if (status < 0) {
|
|
|
|
INFO("BL31: PM Service Init Failed, Error Code %d!\n", status);
|
|
|
|
ret = status;
|
2019-01-09 12:10:29 +00:00
|
|
|
} else {
|
|
|
|
pm_up = true;
|
2018-12-14 08:55:37 +00:00
|
|
|
}
|
|
|
|
|
2021-03-17 17:31:17 +00:00
|
|
|
/*
|
|
|
|
* Enable IPI IRQ
|
|
|
|
* assume the rich OS is OK to handle callback IRQs now.
|
|
|
|
* Even if we were wrong, it would not enable the IRQ in
|
|
|
|
* the GIC.
|
|
|
|
*/
|
|
|
|
pm_ipi_irq_enable(primary_proc);
|
|
|
|
|
|
|
|
ret = request_intr_type_el3(PLAT_VERSAL_IPI_IRQ, ipi_fiq_handler);
|
2021-08-05 10:59:26 +01:00
|
|
|
if (ret != 0) {
|
2021-03-17 17:31:17 +00:00
|
|
|
WARN("BL31: registering IPI interrupt failed\n");
|
|
|
|
}
|
2018-12-14 08:55:37 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2019-01-09 12:10:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* pm_smc_handler() - SMC handler for PM-API calls coming from EL1/EL2.
|
|
|
|
* @smc_fid - Function Identifier
|
|
|
|
* @x1 - x4 - Arguments
|
|
|
|
* @cookie - Unused
|
|
|
|
* @handler - Pointer to caller's context structure
|
|
|
|
*
|
|
|
|
* @return - Unused
|
|
|
|
*
|
|
|
|
* Determines that smc_fid is valid and supported PM SMC Function ID from the
|
|
|
|
* list of pm_api_ids, otherwise completes the request with
|
|
|
|
* the unknown SMC Function ID
|
|
|
|
*
|
|
|
|
* The SMC calls for PM service are forwarded from SIP Service SMC handler
|
|
|
|
* function with rt_svc_handle signature
|
|
|
|
*/
|
|
|
|
uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
|
|
|
|
uint64_t x4, void *cookie, void *handle, uint64_t flags)
|
|
|
|
{
|
|
|
|
enum pm_ret_status ret;
|
|
|
|
|
|
|
|
uint32_t pm_arg[4];
|
2021-02-26 04:16:56 +00:00
|
|
|
uint32_t security_flag = SECURE_FLAG;
|
2019-01-09 12:10:29 +00:00
|
|
|
|
|
|
|
/* Handle case where PM wasn't initialized properly */
|
2021-08-05 10:59:26 +01:00
|
|
|
if (pm_up == false) {
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, SMC_UNK);
|
2021-08-05 11:14:17 +01:00
|
|
|
}
|
2019-01-09 12:10:29 +00:00
|
|
|
|
|
|
|
pm_arg[0] = (uint32_t)x1;
|
|
|
|
pm_arg[1] = (uint32_t)(x1 >> 32);
|
|
|
|
pm_arg[2] = (uint32_t)x2;
|
|
|
|
pm_arg[3] = (uint32_t)(x2 >> 32);
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
/*
|
|
|
|
* Mark BIT24 payload (i.e 1st bit of pm_arg[3] ) as non-secure (1)
|
|
|
|
* if smc called is non secure
|
|
|
|
*/
|
2021-08-05 10:59:26 +01:00
|
|
|
if (is_caller_non_secure(flags) != 0) {
|
2021-02-26 04:16:56 +00:00
|
|
|
security_flag = NON_SECURE_FLAG;
|
|
|
|
}
|
|
|
|
|
2019-01-09 12:10:29 +00:00
|
|
|
switch (smc_fid & FUNCID_NUM_MASK) {
|
|
|
|
/* PM API Functions */
|
|
|
|
case PM_SELF_SUSPEND:
|
|
|
|
ret = pm_self_suspend(pm_arg[0], pm_arg[1], pm_arg[2],
|
2021-02-26 04:16:56 +00:00
|
|
|
pm_arg[3], security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
2019-01-10 11:03:47 +00:00
|
|
|
case PM_FORCE_POWERDOWN:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_force_powerdown(pm_arg[0], pm_arg[1], security_flag);
|
2019-01-10 11:03:47 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
2019-01-09 12:10:29 +00:00
|
|
|
case PM_REQ_SUSPEND:
|
|
|
|
ret = pm_req_suspend(pm_arg[0], pm_arg[1], pm_arg[2],
|
2021-02-26 04:16:56 +00:00
|
|
|
pm_arg[3], security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
|
|
|
case PM_ABORT_SUSPEND:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_abort_suspend(pm_arg[0], security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
2019-01-10 11:03:47 +00:00
|
|
|
case PM_SYSTEM_SHUTDOWN:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_system_shutdown(pm_arg[0], pm_arg[1], security_flag);
|
2019-01-10 11:03:47 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
2019-01-23 08:48:51 +00:00
|
|
|
case PM_REQ_WAKEUP:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_req_wakeup(pm_arg[0], pm_arg[1], pm_arg[2], pm_arg[3],
|
|
|
|
security_flag);
|
2019-01-23 08:48:51 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
2019-01-23 08:48:53 +00:00
|
|
|
|
|
|
|
case PM_SET_WAKEUP_SOURCE:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_set_wakeup_source(pm_arg[0], pm_arg[1], pm_arg[2],
|
|
|
|
security_flag);
|
2019-01-23 08:48:53 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
2019-01-23 08:48:51 +00:00
|
|
|
|
2019-01-09 12:10:29 +00:00
|
|
|
case PM_REQUEST_DEVICE:
|
|
|
|
ret = pm_request_device(pm_arg[0], pm_arg[1], pm_arg[2],
|
2021-02-26 04:16:56 +00:00
|
|
|
pm_arg[3], security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
|
|
|
case PM_RELEASE_DEVICE:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_release_device(pm_arg[0], security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
|
|
|
case PM_SET_REQUIREMENT:
|
|
|
|
ret = pm_set_requirement(pm_arg[0], pm_arg[1], pm_arg[2],
|
2021-02-26 04:16:56 +00:00
|
|
|
pm_arg[3], security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
|
|
|
case PM_GET_API_VERSION:
|
|
|
|
{
|
|
|
|
uint32_t api_version;
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_get_api_version(&api_version, security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET1(handle, (u_register_t)PM_RET_SUCCESS |
|
|
|
|
((u_register_t)api_version << 32));
|
2019-01-09 12:10:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case PM_GET_DEVICE_STATUS:
|
|
|
|
{
|
|
|
|
uint32_t buff[3];
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_get_device_status(pm_arg[0], buff, security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET2(handle, (u_register_t)ret | ((u_register_t)buff[0] << 32),
|
|
|
|
(u_register_t)buff[1] | ((u_register_t)buff[2] << 32));
|
2019-01-09 12:10:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case PM_RESET_ASSERT:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_reset_assert(pm_arg[0], pm_arg[1], security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
|
|
|
case PM_RESET_GET_STATUS:
|
|
|
|
{
|
|
|
|
uint32_t reset_status;
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_reset_get_status(pm_arg[0], &reset_status,
|
|
|
|
security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET1(handle, (u_register_t)ret |
|
|
|
|
((u_register_t)reset_status << 32));
|
2019-01-09 12:10:29 +00:00
|
|
|
}
|
|
|
|
|
2019-01-21 12:26:49 +00:00
|
|
|
case PM_INIT_FINALIZE:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_init_finalize(security_flag);
|
2019-08-12 11:10:10 +01:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
2019-01-21 12:26:49 +00:00
|
|
|
|
2019-03-04 05:39:40 +00:00
|
|
|
case PM_GET_CALLBACK_DATA:
|
|
|
|
{
|
|
|
|
uint32_t result[4] = {0};
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
pm_get_callbackdata(result, ARRAY_SIZE(result), security_flag);
|
2019-03-04 05:39:40 +00:00
|
|
|
SMC_RET2(handle,
|
2021-08-05 07:58:46 +01:00
|
|
|
(u_register_t)result[0] | ((u_register_t)result[1] << 32),
|
|
|
|
(u_register_t)result[2] | ((u_register_t)result[3] << 32));
|
2019-03-04 05:39:40 +00:00
|
|
|
}
|
|
|
|
|
2019-01-09 12:10:29 +00:00
|
|
|
case PM_PINCTRL_REQUEST:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_pinctrl_request(pm_arg[0], security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
|
|
|
case PM_PINCTRL_RELEASE:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_pinctrl_release(pm_arg[0], security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
|
|
|
case PM_PINCTRL_GET_FUNCTION:
|
|
|
|
{
|
|
|
|
uint32_t value = 0;
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_pinctrl_get_function(pm_arg[0], &value, security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET1(handle, (u_register_t)ret | ((u_register_t)value) << 32);
|
2019-01-09 12:10:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case PM_PINCTRL_SET_FUNCTION:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_pinctrl_set_function(pm_arg[0], pm_arg[1],
|
|
|
|
security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
|
|
|
case PM_PINCTRL_CONFIG_PARAM_GET:
|
|
|
|
{
|
|
|
|
uint32_t value;
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_pinctrl_get_pin_param(pm_arg[0], pm_arg[1], &value,
|
|
|
|
security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET1(handle, (u_register_t)ret | ((u_register_t)value) << 32);
|
2019-01-09 12:10:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case PM_PINCTRL_CONFIG_PARAM_SET:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_pinctrl_set_pin_param(pm_arg[0], pm_arg[1], pm_arg[2],
|
|
|
|
security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
2019-01-10 11:03:48 +00:00
|
|
|
case PM_IOCTL:
|
|
|
|
{
|
|
|
|
uint32_t value;
|
|
|
|
|
|
|
|
ret = pm_api_ioctl(pm_arg[0], pm_arg[1], pm_arg[2],
|
2021-02-26 04:16:56 +00:00
|
|
|
pm_arg[3], &value, security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET1(handle, (u_register_t)ret | ((u_register_t)value) << 32);
|
2019-01-10 11:03:48 +00:00
|
|
|
}
|
|
|
|
|
2019-02-01 11:55:19 +00:00
|
|
|
case PM_QUERY_DATA:
|
|
|
|
{
|
2020-11-23 12:13:54 +00:00
|
|
|
uint32_t data[8] = { 0 };
|
2019-02-01 11:55:19 +00:00
|
|
|
|
|
|
|
ret = pm_query_data(pm_arg[0], pm_arg[1], pm_arg[2],
|
2021-02-26 04:16:56 +00:00
|
|
|
pm_arg[3], data, security_flag);
|
2020-11-23 12:13:54 +00:00
|
|
|
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET2(handle, (u_register_t)ret | ((u_register_t)data[0] << 32),
|
|
|
|
(u_register_t)data[1] | ((u_register_t)data[2] << 32));
|
2019-02-01 11:55:19 +00:00
|
|
|
|
2020-11-23 12:13:54 +00:00
|
|
|
}
|
2019-01-09 12:10:29 +00:00
|
|
|
case PM_CLOCK_ENABLE:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_clock_enable(pm_arg[0], security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
|
|
|
case PM_CLOCK_DISABLE:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_clock_disable(pm_arg[0], security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
|
|
|
case PM_CLOCK_GETSTATE:
|
|
|
|
{
|
|
|
|
uint32_t value;
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_clock_get_state(pm_arg[0], &value, security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET1(handle, (u_register_t)ret | ((u_register_t)value) << 32);
|
2019-01-09 12:10:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case PM_CLOCK_SETDIVIDER:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_clock_set_divider(pm_arg[0], pm_arg[1], security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
|
|
|
case PM_CLOCK_GETDIVIDER:
|
|
|
|
{
|
|
|
|
uint32_t value;
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_clock_get_divider(pm_arg[0], &value, security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET1(handle, (u_register_t)ret | ((u_register_t)value) << 32);
|
2019-01-09 12:10:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case PM_CLOCK_SETPARENT:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_clock_set_parent(pm_arg[0], pm_arg[1], security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
|
|
|
case PM_CLOCK_GETPARENT:
|
|
|
|
{
|
|
|
|
uint32_t value;
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_clock_get_parent(pm_arg[0], &value, security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET1(handle, (u_register_t)ret | ((u_register_t)value) << 32);
|
2019-01-09 12:10:29 +00:00
|
|
|
}
|
|
|
|
|
2020-09-01 12:43:53 +01:00
|
|
|
case PM_CLOCK_GETRATE:
|
|
|
|
{
|
|
|
|
uint32_t rate[2] = { 0 };
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_clock_get_rate(pm_arg[0], rate, security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET2(handle, (u_register_t)ret | ((u_register_t)rate[0] << 32),
|
|
|
|
(u_register_t)rate[1] | ((u_register_t)0U << 32));
|
2020-09-01 12:43:53 +01:00
|
|
|
}
|
|
|
|
|
2019-01-09 12:10:29 +00:00
|
|
|
case PM_PLL_SET_PARAMETER:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_pll_set_param(pm_arg[0], pm_arg[1], pm_arg[2],
|
|
|
|
security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
|
|
|
case PM_PLL_GET_PARAMETER:
|
|
|
|
{
|
|
|
|
uint32_t value;
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_pll_get_param(pm_arg[0], pm_arg[1], &value,
|
|
|
|
security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET1(handle, (u_register_t)ret | ((u_register_t)value << 32));
|
2019-01-09 12:10:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case PM_PLL_SET_MODE:
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_pll_set_mode(pm_arg[0], pm_arg[1], security_flag);
|
2019-01-09 12:10:29 +00:00
|
|
|
SMC_RET1(handle, (uint64_t)ret);
|
|
|
|
|
|
|
|
case PM_PLL_GET_MODE:
|
|
|
|
{
|
|
|
|
uint32_t mode;
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_pll_get_mode(pm_arg[0], &mode, security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET1(handle, (u_register_t)ret | ((u_register_t)mode << 32));
|
2019-01-09 12:10:29 +00:00
|
|
|
}
|
|
|
|
|
2019-01-21 12:26:48 +00:00
|
|
|
case PM_GET_TRUSTZONE_VERSION:
|
|
|
|
SMC_RET1(handle, (uint64_t)PM_RET_SUCCESS |
|
|
|
|
((uint64_t)VERSAL_TZ_VERSION << 32));
|
|
|
|
|
2019-08-12 11:17:54 +01:00
|
|
|
case PM_GET_CHIPID:
|
|
|
|
{
|
|
|
|
uint32_t result[2];
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_get_chipid(result, security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET2(handle, (u_register_t)ret | ((u_register_t)result[0] << 32),
|
|
|
|
(u_register_t)result[1] | ((u_register_t)0U << 32));
|
2019-08-12 11:17:54 +01:00
|
|
|
}
|
|
|
|
|
2019-03-06 07:04:46 +00:00
|
|
|
case PM_FEATURE_CHECK:
|
|
|
|
{
|
|
|
|
uint32_t version;
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_feature_check(pm_arg[0], &version, security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET1(handle, (u_register_t)ret | ((u_register_t)version << 32));
|
2019-03-06 07:04:46 +00:00
|
|
|
}
|
|
|
|
|
2019-03-22 00:03:39 +00:00
|
|
|
case PM_LOAD_PDI:
|
|
|
|
{
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_load_pdi(pm_arg[0], pm_arg[1], pm_arg[2],
|
|
|
|
security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET1(handle, (u_register_t)ret);
|
2019-03-22 00:03:39 +00:00
|
|
|
}
|
|
|
|
|
2019-06-03 18:22:35 +01:00
|
|
|
case PM_GET_OP_CHARACTERISTIC:
|
|
|
|
{
|
|
|
|
uint32_t result;
|
|
|
|
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_get_op_characteristic(pm_arg[0], pm_arg[1], &result,
|
|
|
|
security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET1(handle, (u_register_t)ret | ((u_register_t)result << 32));
|
2019-06-03 18:22:35 +01:00
|
|
|
}
|
|
|
|
|
2020-11-25 09:53:12 +00:00
|
|
|
case PM_SET_MAX_LATENCY:
|
|
|
|
{
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_set_max_latency(pm_arg[0], pm_arg[1], security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET1(handle, (u_register_t)ret);
|
2020-11-25 09:53:12 +00:00
|
|
|
}
|
|
|
|
|
2020-11-25 09:56:57 +00:00
|
|
|
case PM_REGISTER_NOTIFIER:
|
|
|
|
{
|
2021-02-26 04:16:56 +00:00
|
|
|
ret = pm_register_notifier(pm_arg[0], pm_arg[1], pm_arg[2],
|
|
|
|
pm_arg[3], security_flag);
|
2021-08-05 07:58:46 +01:00
|
|
|
SMC_RET1(handle, (u_register_t)ret);
|
2020-11-25 09:56:57 +00:00
|
|
|
}
|
|
|
|
|
2019-01-09 12:10:29 +00:00
|
|
|
default:
|
|
|
|
WARN("Unimplemented PM Service Call: 0x%x\n", smc_fid);
|
|
|
|
SMC_RET1(handle, SMC_UNK);
|
|
|
|
}
|
|
|
|
}
|