diff --git a/plat/xilinx/versal/pm_service/pm_api_sys.c b/plat/xilinx/versal/pm_service/pm_api_sys.c index ead255fe9..c7b60476f 100644 --- a/plat/xilinx/versal/pm_service/pm_api_sys.c +++ b/plat/xilinx/versal/pm_service/pm_api_sys.c @@ -533,56 +533,46 @@ enum pm_ret_status pm_set_wakeup_source(uint32_t target, uint32_t wkup_device, /** * pm_feature_check() - Returns the supported API version if supported * @api_id API ID to check - * @value Returned supported API version * @flag 0 - Call from secure source * 1 - Call from non-secure source + * @ret_payload pointer to array of PAYLOAD_ARG_CNT number of + * words Returned supported API version and bitmasks + * for IOCTL and QUERY ID * * @return Returns status, either success or error+reason */ -enum pm_ret_status pm_feature_check(uint32_t api_id, unsigned int *version, +enum pm_ret_status pm_feature_check(uint32_t api_id, uint32_t *ret_payload, uint32_t flag) { - uint32_t payload[PAYLOAD_ARG_CNT], fw_api_version; - enum pm_ret_status status; + uint32_t payload[PAYLOAD_ARG_CNT]; uint32_t module_id; - module_id = (api_id & MODULE_ID_MASK) >> 8; - - /* feature check should be done only for LIBPM module - * If module_id is 0, then we consider it LIBPM module as default id - */ - if ((module_id > 0) && (module_id != LIBPM_MODULE_ID)) { - return PM_RET_SUCCESS; - } - + /* Return version of API which are implemented in ATF only */ switch (api_id) { case PM_GET_CALLBACK_DATA: case PM_GET_TRUSTZONE_VERSION: + ret_payload[0] = PM_API_VERSION_2; + return PM_RET_SUCCESS; case PM_LOAD_PDI: - *version = (PM_API_BASE_VERSION << 16); + ret_payload[0] = PM_API_BASE_VERSION; return PM_RET_SUCCESS; - case PM_QUERY_DATA: - *version = (PM_API_QUERY_DATA_VERSION << 16); - break; default: - *version = (PM_API_BASE_VERSION << 16); break; } - PM_PACK_PAYLOAD2(payload, LIBPM_MODULE_ID, flag, - PM_FEATURE_CHECK, api_id); + module_id = (api_id & MODULE_ID_MASK) >> 8; - status = pm_ipi_send_sync(primary_proc, payload, &fw_api_version, 1); - if (status != PM_RET_SUCCESS) { - goto done; + /* + * feature check should be done only for LIBPM module + * If module_id is 0, then we consider it LIBPM module as default id + */ + if ((module_id > 0) && (module_id != LIBPM_MODULE_ID)) { + return PM_RET_SUCCESS; } - *version |= fw_api_version; - - status = PM_RET_SUCCESS; - -done: - return status; + PM_PACK_PAYLOAD2(payload, LIBPM_MODULE_ID, flag, + PM_FEATURE_CHECK, api_id); + return pm_ipi_send_sync(primary_proc, payload, ret_payload, PAYLOAD_ARG_CNT); } /** diff --git a/plat/xilinx/versal/pm_service/pm_api_sys.h b/plat/xilinx/versal/pm_service/pm_api_sys.h index d3f5060e7..86a46d01e 100644 --- a/plat/xilinx/versal/pm_service/pm_api_sys.h +++ b/plat/xilinx/versal/pm_service/pm_api_sys.h @@ -49,7 +49,7 @@ enum pm_ret_status pm_api_ioctl(uint32_t device_id, uint32_t ioctl_id, 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); -enum pm_ret_status pm_feature_check(uint32_t api_id, unsigned int *version, +enum pm_ret_status pm_feature_check(uint32_t api_id, uint32_t *ret_payload, uint32_t flag); enum pm_ret_status pm_load_pdi(uint32_t src, uint32_t address_low, uint32_t address_high, uint32_t flag); diff --git a/plat/xilinx/versal/pm_service/pm_defs.h b/plat/xilinx/versal/pm_service/pm_defs.h index 8b6286995..378565049 100644 --- a/plat/xilinx/versal/pm_service/pm_defs.h +++ b/plat/xilinx/versal/pm_service/pm_defs.h @@ -38,6 +38,7 @@ /* PM API Versions */ #define PM_API_BASE_VERSION 1U +#define PM_API_VERSION_2 2U #define PM_API_QUERY_DATA_VERSION 2U diff --git a/plat/xilinx/versal/pm_service/pm_svc_main.c b/plat/xilinx/versal/pm_service/pm_svc_main.c index c698aa724..75c12684a 100644 --- a/plat/xilinx/versal/pm_service/pm_svc_main.c +++ b/plat/xilinx/versal/pm_service/pm_svc_main.c @@ -156,10 +156,11 @@ static uintptr_t eemi_for_compatibility(uint32_t api_id, uint32_t *pm_arg, case PM_FEATURE_CHECK: { - uint32_t version; + uint32_t result[PAYLOAD_ARG_CNT] = {0U}; - ret = pm_feature_check(pm_arg[0], &version, security_flag); - SMC_RET1(handle, (uint64_t)ret | ((uint64_t)version << 32)); + ret = pm_feature_check(pm_arg[0], result, security_flag); + SMC_RET2(handle, (uint64_t)ret | ((uint64_t)result[0] << 32), + (uint64_t)result[1] | ((uint64_t)result[2] << 32)); } case PM_LOAD_PDI: