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 <anes.hadziahmetagic@aggios.com>
Signed-off-by: Filip Drazic <filip.drazic@aggios.com>
Acked-by: Will Wong <willw@xilinx.com>
This commit is contained in:
Anes Hadziahmetagic 2017-01-27 18:42:44 +01:00 committed by Siva Durga Prasad Paladugu
parent b6ceca4303
commit d744b6f56f
3 changed files with 18 additions and 8 deletions

View File

@ -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);
}
/**

View File

@ -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,

View File

@ -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:
{