Browse Source

Merge "feat(xilinx): remove PM_IOCTL and PM_QUERY_DATA APIs" into integration

pull/2000/merge
Joanna Farley 5 months ago
committed by TrustedFirmware Code Review
parent
commit
ab4e9c0b7f
  1. 5
      plat/xilinx/common/include/pm_api_sys.h
  2. 4
      plat/xilinx/common/include/pm_defs.h
  3. 212
      plat/xilinx/common/pm_service/pm_api_sys.c
  4. 26
      plat/xilinx/common/pm_service/pm_svc_main.c

5
plat/xilinx/common/include/pm_api_sys.h

@ -1,6 +1,6 @@
/*
* Copyright (c) 2019-2022, Xilinx, Inc. All rights reserved.
* Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2022-2024, Advanced Micro Devices, Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -53,9 +53,6 @@ enum pm_ret_status pm_force_powerdown(uint32_t target, uint8_t ack,
uint32_t flag);
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 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);
uint32_t pm_get_shutdown_scope(void);

4
plat/xilinx/common/include/pm_defs.h

@ -1,6 +1,6 @@
/*
* Copyright (c) 2019-2022, Xilinx, Inc. All rights reserved.
* Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2022-2024, Advanced Micro Devices, Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -95,8 +95,6 @@ enum {
IOCTL_GET_LAST_RESET_REASON = 23,
/* AI engine NPI ISR clear */
IOCTL_AIE_ISR_CLEAR = 24,
/* Register SGI to TF-A */
IOCTL_SET_SGI = 25,
};
/**

212
plat/xilinx/common/pm_service/pm_api_sys.c

@ -1,6 +1,6 @@
/*
* Copyright (c) 2019-2022, Xilinx, Inc. All rights reserved.
* Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2022-2024, Advanced Micro Devices, Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -286,112 +286,6 @@ enum pm_ret_status pm_get_callbackdata(uint32_t *data, size_t count, uint32_t fl
return ret;
}
/**
* pm_pll_set_param() - Set PLL parameter.
* @clk_id: PLL clock ID.
* @param: PLL parameter ID.
* @value: Value to set for PLL parameter.
* @flag: 0 - Call from secure source.
* 1 - Call from non-secure source.
*
* This API is deprecated and maintained here for backward compatibility.
* New use of this API should be avoided for versal platform.
* This API and its use cases will be removed for versal platform.
*
* Return: Returns status, either success or error+reason.
*
*/
enum pm_ret_status pm_pll_set_param(uint32_t clk_id, uint32_t param,
uint32_t value, uint32_t flag)
{
uint32_t payload[PAYLOAD_ARG_CNT];
/* Send request to the PMC */
PM_PACK_PAYLOAD4(payload, LIBPM_MODULE_ID, flag, PM_PLL_SET_PARAMETER,
clk_id, param, value);
return pm_ipi_send_sync(primary_proc, payload, NULL, 0);
}
/**
* pm_pll_get_param() - Get PLL parameter value.
* @clk_id: PLL clock ID.
* @param: PLL parameter ID.
* @value: Buffer to store PLL parameter value.
* @flag: 0 - Call from secure source.
* 1 - Call from non-secure source.
*
* This API is deprecated and maintained here for backward compatibility.
* New use of this API should be avoided for versal platform.
* This API and its use cases will be removed for versal platform.
*
* Return: Returns status, either success or error+reason.
*
*/
enum pm_ret_status pm_pll_get_param(uint32_t clk_id, uint32_t param,
uint32_t *value, uint32_t flag)
{
uint32_t payload[PAYLOAD_ARG_CNT];
/* Send request to the PMC */
PM_PACK_PAYLOAD3(payload, LIBPM_MODULE_ID, flag, PM_PLL_GET_PARAMETER,
clk_id, param);
return pm_ipi_send_sync(primary_proc, payload, value, 1);
}
/**
* pm_pll_set_mode() - Set PLL mode.
* @clk_id: PLL clock ID.
* @mode: PLL mode.
* @flag: 0 - Call from secure source.
* 1 - Call from non-secure source.
*
* This API is deprecated and maintained here for backward compatibility.
* New use of this API should be avoided for versal platform.
* This API and its use cases will be removed for versal platform.
*
* Return: Returns status, either success or error+reason.
*
*/
enum pm_ret_status pm_pll_set_mode(uint32_t clk_id, uint32_t mode,
uint32_t flag)
{
uint32_t payload[PAYLOAD_ARG_CNT];
/* Send request to the PMC */
PM_PACK_PAYLOAD3(payload, LIBPM_MODULE_ID, flag, PM_PLL_SET_MODE,
clk_id, mode);
return pm_ipi_send_sync(primary_proc, payload, NULL, 0);
}
/**
* pm_pll_get_mode() - Get PLL mode.
* @clk_id: PLL clock ID.
* @mode: Buffer to store PLL mode.
* @flag: 0 - Call from secure source.
* 1 - Call from non-secure source.
*
* This API is deprecated and maintained here for backward compatibility.
* New use of this API should be avoided for versal platform.
* This API and its use cases will be removed for versal platform.
*
* Return: Returns status, either success or error+reason.
*
*/
enum pm_ret_status pm_pll_get_mode(uint32_t clk_id, uint32_t *mode,
uint32_t flag)
{
uint32_t payload[PAYLOAD_ARG_CNT];
/* Send request to the PMC */
PM_PACK_PAYLOAD2(payload, LIBPM_MODULE_ID, flag, PM_PLL_GET_MODE,
clk_id);
return pm_ipi_send_sync(primary_proc, payload, mode, 1);
}
/**
* pm_force_powerdown() - PM call to request for another PU or subsystem to
* be powered down forcefully.
@ -447,110 +341,6 @@ enum pm_ret_status pm_system_shutdown(uint32_t type, uint32_t subtype,
return pm_ipi_send_non_blocking(primary_proc, payload);
}
/**
* pm_query_data() - PM API for querying firmware data.
* @qid: The type of data to query.
* @arg1: Argument 1 to requested query data call.
* @arg2: Argument 2 to requested query data call.
* @arg3: Argument 3 to requested query data call.
* @data: Returned output data.
* @flag: 0 - Call from secure source.
* 1 - Call from non-secure source.
*
* This API is deprecated and maintained here for backward compatibility.
* New use of this API should be avoided for versal platform.
* This API and its use cases will be removed for versal platform.
*
* Return: 0 if success else non-zero error code of type
* enum pm_ret_status.
*
*/
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)
{
uint32_t ret;
uint32_t version[PAYLOAD_ARG_CNT] = {0};
uint32_t payload[PAYLOAD_ARG_CNT];
uint32_t fw_api_version;
/* Send request to the PMC */
PM_PACK_PAYLOAD5(payload, LIBPM_MODULE_ID, flag, PM_QUERY_DATA, qid,
arg1, arg2, arg3);
ret = pm_feature_check((uint32_t)PM_QUERY_DATA, &version[0], flag);
if (ret == PM_RET_SUCCESS) {
fw_api_version = version[0] & 0xFFFFU;
if ((fw_api_version == 2U) &&
((qid == XPM_QID_CLOCK_GET_NAME) ||
(qid == XPM_QID_PINCTRL_GET_FUNCTION_NAME))) {
ret = pm_ipi_send_sync(primary_proc, payload, data, PAYLOAD_ARG_CNT);
if (ret == PM_RET_SUCCESS) {
ret = data[0];
data[0] = data[1];
data[1] = data[2];
data[2] = data[3];
}
} else {
ret = pm_ipi_send_sync(primary_proc, payload, data, PAYLOAD_ARG_CNT);
}
}
return ret;
}
/**
* pm_api_ioctl() - PM IOCTL API for device control and configs.
* @device_id: Device ID.
* @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.
*
* This API is deprecated and maintained here for backward compatibility.
* New use of this API should be avoided for versal platform.
* This API and its use cases will be removed for versal platform.
*
* This function calls IOCTL to firmware for device control and configuration.
*
* Return: Returns status, either 0 on success or non-zero error code
* 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 arg3,
uint32_t *value, uint32_t flag)
{
enum pm_ret_status ret;
switch (ioctl_id) {
case IOCTL_SET_PLL_FRAC_MODE:
ret = pm_pll_set_mode(arg1, arg2, flag);
break;
case IOCTL_GET_PLL_FRAC_MODE:
ret = pm_pll_get_mode(arg1, value, flag);
break;
case IOCTL_SET_PLL_FRAC_DATA:
ret = pm_pll_set_param(arg1, (uint32_t)PM_PLL_PARAM_DATA, arg2, flag);
break;
case IOCTL_GET_PLL_FRAC_DATA:
ret = pm_pll_get_param(arg1, (uint32_t)PM_PLL_PARAM_DATA, value, flag);
break;
case IOCTL_SET_SGI:
/* Get the sgi number */
ret = pm_register_sgi(arg1, arg2);
if (ret != 0) {
return PM_RET_ERROR_ARGS;
}
ret = PM_RET_SUCCESS;
break;
default:
return PM_RET_ERROR_NOTSUPPORTED;
}
return ret;
}
/**
* pm_set_wakeup_source() - PM call to specify the wakeup source while
* suspended.

26
plat/xilinx/common/pm_service/pm_svc_main.c

@ -1,6 +1,6 @@
/*
* Copyright (c) 2019-2022, Xilinx, Inc. All rights reserved.
* Copyright (c) 2022-2023, Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2022-2024, Advanced Micro Devices, Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -265,30 +265,6 @@ static uintptr_t eemi_for_compatibility(uint32_t api_id, uint32_t *pm_arg,
switch (api_id) {
case (uint32_t)PM_IOCTL:
{
uint32_t value = 0U;
ret = pm_api_ioctl(pm_arg[0], pm_arg[1], pm_arg[2],
pm_arg[3], pm_arg[4],
&value, security_flag);
if (ret == PM_RET_ERROR_NOTSUPPORTED)
return (uintptr_t)0;
SMC_RET1(handle, (uint64_t)ret | ((uint64_t)value) << 32U);
}
case (uint32_t)PM_QUERY_DATA:
{
uint32_t data[PAYLOAD_ARG_CNT] = { 0 };
ret = pm_query_data(pm_arg[0], pm_arg[1], pm_arg[2],
pm_arg[3], data, security_flag);
SMC_RET2(handle, (uint64_t)ret | ((uint64_t)data[0] << 32U),
(uint64_t)data[1] | ((uint64_t)data[2] << 32U));
}
case (uint32_t)PM_FEATURE_CHECK:
{
uint32_t result[PAYLOAD_ARG_CNT] = {0U};

Loading…
Cancel
Save