feat(versal): enhance PM_IOCTL EEMI API to support additional arg

Currently, SMC handler is limited to parsing 5 arguments (1 API ID + 4
32-bit command args). Extend this handling to support one more 32-bit
command argument which is necessary to support new IOCTL IDs for
secure read/write interface.

Note that, this change is completely transparent and does not affect
existing functionality of any of the EEMI APIs.

Change-Id: I72016620eeeaf598f14853512120bfb30bb9a3e9
Signed-off-by: Izhar Ameer Shaikh <izhar.ameer.shaikh@xilinx.com>
Signed-off-by: Tanmay Shah <tanmay.shah@xilinx.com>
This commit is contained in:
Venkatesh Yadav Abbarapu 2021-10-20 22:11:53 -06:00 committed by Tanmay Shah
parent 1397967490
commit d34a5db8a7
3 changed files with 9 additions and 7 deletions

View File

@ -465,6 +465,7 @@ enum pm_ret_status pm_query_data(uint32_t qid, uint32_t arg1, uint32_t arg2,
* @ioctl_id ID of the requested IOCTL
* @arg1 Argument 1 to requested IOCTL call
* @arg2 Argument 2 to requested IOCTL call
* @arg3 Argument 3 to requested IOCTL call
* @value Returned output value
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
@ -475,8 +476,8 @@ enum pm_ret_status pm_query_data(uint32_t qid, uint32_t arg1, uint32_t arg2,
* of type enum pm_ret_status
*/
enum pm_ret_status pm_api_ioctl(uint32_t device_id, uint32_t ioctl_id,
uint32_t arg1, uint32_t arg2, uint32_t *value,
uint32_t flag)
uint32_t arg1, uint32_t arg2, uint32_t arg3,
uint32_t *value, uint32_t flag)
{
enum pm_ret_status ret;

View File

@ -44,8 +44,8 @@ enum pm_ret_status pm_force_powerdown(uint32_t target, uint8_t ack,
enum pm_ret_status pm_system_shutdown(uint32_t type, uint32_t subtype,
uint32_t flag);
enum pm_ret_status pm_api_ioctl(uint32_t device_id, uint32_t ioctl_id,
uint32_t arg1, uint32_t arg2, uint32_t *value,
uint32_t flag);
uint32_t arg1, uint32_t arg2, uint32_t arg3,
uint32_t *value, uint32_t flag);
enum pm_ret_status pm_query_data(uint32_t qid, uint32_t arg1, uint32_t arg2,
uint32_t arg3, uint32_t *data, uint32_t flag);
unsigned int pm_get_shutdown_scope(void);

View File

@ -135,7 +135,8 @@ static uintptr_t eemi_for_compatibility(uint32_t api_id, uint32_t *pm_arg,
uint32_t value;
ret = pm_api_ioctl(pm_arg[0], pm_arg[1], pm_arg[2],
pm_arg[3], &value, security_flag);
pm_arg[3], pm_arg[4],
&value, security_flag);
if (ret == PM_RET_ERROR_NOTSUPPORTED)
return (uintptr_t)0;
@ -290,7 +291,7 @@ static uintptr_t eemi_handler(uint32_t api_id, uint32_t *pm_arg,
* pm_smc_handler() - SMC handler for PM-API calls coming from EL1/EL2.
* @smc_fid - Function Identifier
* @x1 - x4 - SMC64 Arguments from kernel
* x3 and x4 are Unused
* x3 (upper 32-bits) and x4 are Unused
* @cookie - Unused
* @handler - Pointer to caller's context structure
*
@ -327,7 +328,7 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
pm_arg[1] = (uint32_t)(x1 >> 32);
pm_arg[2] = (uint32_t)x2;
pm_arg[3] = (uint32_t)(x2 >> 32);
(void)(x3);
pm_arg[4] = (uint32_t)x3;
(void)(x4);
api_id = smc_fid & FUNCID_NUM_MASK;