From 76ff8c459e9e6d105e614d68648bd6680806f93e Mon Sep 17 00:00:00 2001 From: Rajan Vaja Date: Tue, 12 Oct 2021 03:30:09 -0700 Subject: [PATCH] feat(zynqmp): pass ioctl calls to firmware Firmware supports new IOCTL for different purposes. To avoid maintaining new IOCTL IDs in ATF, pass IOCTL call to firmware for IOCTL IDs implemented in firmware. Signed-off-by: Rajan Vaja Signed-off-by: Ronak Jain Change-Id: Ie14697c8da9581b0f695f4d33f05161ece558385 --- plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c | 10 +-- plat/xilinx/zynqmp/pm_service/pm_api_ioctl.h | 3 - plat/xilinx/zynqmp/pm_service/pm_api_sys.c | 65 -------------------- plat/xilinx/zynqmp/pm_service/pm_api_sys.h | 32 ++++++++++ 4 files changed, 37 insertions(+), 73 deletions(-) diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c b/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c index 9c5af88bb..11068696f 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c +++ b/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.c @@ -618,6 +618,7 @@ enum pm_ret_status pm_api_ioctl(enum pm_node_id nid, unsigned int *value) { enum pm_ret_status ret; + uint32_t payload[PAYLOAD_ARG_CNT]; switch (ioctl_id) { case IOCTL_GET_RPU_OPER_MODE: @@ -677,12 +678,11 @@ enum pm_ret_status pm_api_ioctl(enum pm_node_id nid, case IOCTL_AFI: ret = pm_ioctl_afi(arg1, arg2); break; - case IOCTL_SET_FEATURE_CONFIG: - case IOCTL_GET_FEATURE_CONFIG: - ret = pm_feature_config(ioctl_id, arg1, arg2, value); - break; default: - ret = PM_RET_ERROR_NOTSUPPORTED; + /* Send request to the PMU */ + PM_PACK_PAYLOAD5(payload, PM_IOCTL, nid, ioctl_id, arg1, arg2); + + ret = pm_ipi_send_sync(primary_proc, payload, value, 1); break; } diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.h b/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.h index f18dc00a2..7f9686184 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.h +++ b/plat/xilinx/zynqmp/pm_service/pm_api_ioctl.h @@ -49,9 +49,6 @@ enum { IOCTL_AIE_ISR_CLEAR = 24, /* Register SGI to ATF */ IOCTL_REGISTER_SGI = 25, - /* Runtime feature configuration */ - IOCTL_SET_FEATURE_CONFIG = 26, - IOCTL_GET_FEATURE_CONFIG = 27, }; //RPU operation mode diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_sys.c b/plat/xilinx/zynqmp/pm_service/pm_api_sys.c index 5d9408cd5..2aaebac8b 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_sys.c +++ b/plat/xilinx/zynqmp/pm_service/pm_api_sys.c @@ -33,38 +33,6 @@ unsigned int pm_get_shutdown_scope(void) return pm_shutdown_scope; } -/** - * Assigning of argument values into array elements. - */ -#define PM_PACK_PAYLOAD1(pl, arg0) { \ - pl[0] = (uint32_t)(arg0); \ -} - -#define PM_PACK_PAYLOAD2(pl, arg0, arg1) { \ - pl[1] = (uint32_t)(arg1); \ - PM_PACK_PAYLOAD1(pl, arg0); \ -} - -#define PM_PACK_PAYLOAD3(pl, arg0, arg1, arg2) { \ - pl[2] = (uint32_t)(arg2); \ - PM_PACK_PAYLOAD2(pl, arg0, arg1); \ -} - -#define PM_PACK_PAYLOAD4(pl, arg0, arg1, arg2, arg3) { \ - pl[3] = (uint32_t)(arg3); \ - PM_PACK_PAYLOAD3(pl, arg0, arg1, arg2); \ -} - -#define PM_PACK_PAYLOAD5(pl, arg0, arg1, arg2, arg3, arg4) { \ - pl[4] = (uint32_t)(arg4); \ - PM_PACK_PAYLOAD4(pl, arg0, arg1, arg2, arg3); \ -} - -#define PM_PACK_PAYLOAD6(pl, arg0, arg1, arg2, arg3, arg4, arg5) { \ - pl[5] = (uint32_t)(arg5); \ - PM_PACK_PAYLOAD5(pl, arg0, arg1, arg2, arg3, arg4); \ -} - #define EM_PACK_PAYLOAD1(pl, arg0) { \ pl[0] = (uint16_t)(0xE) << 16 | (uint16_t)arg0; \ } @@ -1648,36 +1616,3 @@ enum pm_ret_status em_send_errors(unsigned int *value) EM_PACK_PAYLOAD1(payload, EM_SEND_ERRORS); return pm_ipi_send_sync(primary_proc, payload, value, 1); } - -/** - * pm_feature_config() - feature configuration at runtime - * - * This function is used to send IPI request to PMUFW to configure feature - * at runtime. The feature can be enable or disable as well as the feature - * can be configure at runtime using an IOCTL call. - * - * @ioctl_id The ioctl id for the feature configuration - * @config_id The config id of the feature to be configured - * @value The value to be configured - * @response Return to reference pointer - * - * @return Returns 0 on success or error value on failure - */ -enum pm_ret_status pm_feature_config(unsigned int ioctl_id, - unsigned int config_id, - unsigned int value, - unsigned int *response) -{ - uint32_t payload[PAYLOAD_ARG_CNT]; - - /* Send request to the PMU */ - PM_PACK_PAYLOAD5(payload, PM_IOCTL, 0, ioctl_id, config_id, value); - - if (ioctl_id == IOCTL_GET_FEATURE_CONFIG) { - return pm_ipi_send_sync(primary_proc, payload, response, 1); - } else if (ioctl_id == IOCTL_SET_FEATURE_CONFIG) { - return pm_ipi_send_sync(primary_proc, payload, NULL, 0); - } else { - return PM_RET_ERROR_ARGS; - } -} diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_sys.h b/plat/xilinx/zynqmp/pm_service/pm_api_sys.h index ca07cef75..d6ad84fb6 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_sys.h +++ b/plat/xilinx/zynqmp/pm_service/pm_api_sys.h @@ -33,6 +33,38 @@ enum pm_register_access_id { CONFIG_REG_READ, }; +/** + * Assigning of argument values into array elements. + */ +#define PM_PACK_PAYLOAD1(pl, arg0) { \ + pl[0] = (uint32_t)(arg0); \ +} + +#define PM_PACK_PAYLOAD2(pl, arg0, arg1) { \ + pl[1] = (uint32_t)(arg1); \ + PM_PACK_PAYLOAD1(pl, arg0); \ +} + +#define PM_PACK_PAYLOAD3(pl, arg0, arg1, arg2) { \ + pl[2] = (uint32_t)(arg2); \ + PM_PACK_PAYLOAD2(pl, arg0, arg1); \ +} + +#define PM_PACK_PAYLOAD4(pl, arg0, arg1, arg2, arg3) { \ + pl[3] = (uint32_t)(arg3); \ + PM_PACK_PAYLOAD3(pl, arg0, arg1, arg2); \ +} + +#define PM_PACK_PAYLOAD5(pl, arg0, arg1, arg2, arg3, arg4) { \ + pl[4] = (uint32_t)(arg4); \ + PM_PACK_PAYLOAD4(pl, arg0, arg1, arg2, arg3); \ +} + +#define PM_PACK_PAYLOAD6(pl, arg0, arg1, arg2, arg3, arg4, arg5) { \ + pl[5] = (uint32_t)(arg5); \ + PM_PACK_PAYLOAD5(pl, arg0, arg1, arg2, arg3, arg4); \ +} + /********************************************************** * System-level API function declarations **********************************************************/