From d744b6f56f01ba8ac65fc11b95f63a49c1749061 Mon Sep 17 00:00:00 2001 From: Anes Hadziahmetagic Date: Fri, 27 Jan 2017 18:42:44 +0100 Subject: [PATCH] zynqmp: pm: Implement pm_get_node_status API function pm_get_node_status API function returns 3 values: -status: Current power state of the node -requirements: Current requirements for the node -usage: Current usage of the node The last two values only apply to slave nodes. Signed-off-by: Anes Hadziahmetagic Signed-off-by: Filip Drazic Acked-by: Will Wong --- plat/xilinx/zynqmp/pm_service/pm_api_sys.c | 14 +++++++++----- plat/xilinx/zynqmp/pm_service/pm_api_sys.h | 3 ++- plat/xilinx/zynqmp/pm_service/pm_svc_main.c | 9 +++++++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_sys.c b/plat/xilinx/zynqmp/pm_service/pm_api_sys.c index d75f7c0c..cad29bc6 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_sys.c +++ b/plat/xilinx/zynqmp/pm_service/pm_api_sys.c @@ -342,18 +342,22 @@ enum pm_ret_status pm_set_configuration(unsigned int phys_addr) } /** - * pm_get_node_status() - PM call to request a node's current power state - * @nid Node id of the slave + * pm_get_node_status() - PM call to request a node's current status + * @nid Node id + * @ret_buff Buffer for the return values: + * [0] - Current power state of the node + * [1] - Current requirements for the node (slave nodes only) + * [2] - Current usage status for the node (slave nodes only) * * @return Returns status, either success or error+reason */ -enum pm_ret_status pm_get_node_status(enum pm_node_id nid) +enum pm_ret_status pm_get_node_status(enum pm_node_id nid, + uint32_t *ret_buff) { - /* TODO: Add power state argument!! */ uint32_t payload[PAYLOAD_ARG_CNT]; PM_PACK_PAYLOAD2(payload, PM_GET_NODE_STATUS, nid); - return pm_ipi_send(primary_proc, payload); + return pm_ipi_send_sync(primary_proc, payload, ret_buff, 3); } /** diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_sys.h b/plat/xilinx/zynqmp/pm_service/pm_api_sys.h index c6de5602..8726eb76 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_sys.h +++ b/plat/xilinx/zynqmp/pm_service/pm_api_sys.h @@ -76,7 +76,8 @@ enum pm_ret_status pm_set_max_latency(enum pm_node_id nid, /* Miscellaneous API functions */ enum pm_ret_status pm_get_api_version(unsigned int *version); enum pm_ret_status pm_set_configuration(unsigned int phys_addr); -enum pm_ret_status pm_get_node_status(enum pm_node_id node); +enum pm_ret_status pm_get_node_status(enum pm_node_id node, + uint32_t *ret_buff); enum pm_ret_status pm_register_notifier(enum pm_node_id nid, unsigned int event, unsigned int wake, diff --git a/plat/xilinx/zynqmp/pm_service/pm_svc_main.c b/plat/xilinx/zynqmp/pm_service/pm_svc_main.c index 34b3ad45..ec9a93ec 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_svc_main.c +++ b/plat/xilinx/zynqmp/pm_service/pm_svc_main.c @@ -176,8 +176,13 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3, SMC_RET1(handle, (uint64_t)ret); case PM_GET_NODE_STATUS: - ret = pm_get_node_status(pm_arg[0]); - SMC_RET1(handle, (uint64_t)ret); + { + uint32_t buff[3]; + + ret = pm_get_node_status(pm_arg[0], buff); + SMC_RET2(handle, (uint64_t)ret | ((uint64_t)buff[0] << 32), + (uint64_t)buff[1] | ((uint64_t)buff[2] << 32)); + } case PM_GET_OP_CHARACTERISTIC: { -- 2.30.2