]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
xilinx: versal: Updated Response of QueryData API call
authorRajan Vaja <rajan.vaja@xilinx.com>
Mon, 23 Nov 2020 12:13:54 +0000 (04:13 -0800)
committerManish Pandey <manish.pandey2@arm.com>
Mon, 7 Dec 2020 11:09:56 +0000 (11:09 +0000)
For the current XilPM calls, The handler of IPI returns information
with 16 Bytes data.
So during QueryData API call for the ClockName and PinFunctionName,
response data(name of clock or function) response[0..3] are used to
return name. And status is not being returned for such API.

Updated XilPM calls reply in a consistent way and The handler of IPI
return information with 32Bytes data. Where response[0] always set
to status.
For the version-2 of QueryData API, during call for the ClockName
and PinFunctionName, response data(name of clock or function) get as
response[1...4].

To support both the version of QueryData API, added version based
compatibility by the use of feature check.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@xilinx.com>
Signed-off-by: Amit Sunil Dhamne <amit.sunil.dhamne@xilinx.com>
Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
Change-Id: I336128bff7bbe659903b0f8ce20ae6da7e3b51b4

plat/xilinx/versal/pm_service/pm_api_sys.c
plat/xilinx/versal/pm_service/pm_defs.h
plat/xilinx/versal/pm_service/pm_svc_main.c

index 75cc3d12e1cabec4ffa6db85958881939a3f3370..dd9ff6445c6f8723c33600fc55a9d01d16aa71f5 100644 (file)
@@ -14,6 +14,7 @@
 #include <plat/common/platform.h>
 #include "pm_api_sys.h"
 #include "pm_client.h"
+#include "pm_defs.h"
 
 /*********************************************************************
  * Target module IDs macros
@@ -689,12 +690,31 @@ enum pm_ret_status pm_system_shutdown(uint32_t type, uint32_t subtype)
 enum pm_ret_status pm_query_data(uint32_t qid, uint32_t arg1, uint32_t arg2,
                                 uint32_t arg3, uint32_t *data)
 {
+       uint32_t ret;
+       uint32_t version;
        uint32_t payload[PAYLOAD_ARG_CNT];
+       uint32_t fw_api_version;
 
        /* Send request to the PMC */
        PM_PACK_PAYLOAD5(payload, LIBPM_MODULE_ID, PM_QUERY_DATA, qid, arg1,
                         arg2, arg3);
-       return pm_ipi_send_sync(primary_proc, payload, data, 4);
+
+       ret = pm_feature_check(PM_QUERY_DATA, &version);
+       if (PM_RET_SUCCESS == ret){
+               fw_api_version = version & 0xFFFF ;
+               if ((2U == fw_api_version) &&
+                   ((XPM_QID_CLOCK_GET_NAME == qid) ||
+                    (XPM_QID_PINCTRL_GET_FUNCTION_NAME == qid))) {
+                       ret = pm_ipi_send_sync(primary_proc, payload, data, 8);
+                       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, 4);
+               }
+       }
+       return ret;
 }
 /**
  * pm_api_ioctl() -  PM IOCTL API for device control and configs
@@ -806,7 +826,11 @@ enum pm_ret_status pm_feature_check(uint32_t api_id, unsigned int *version)
        case PM_PINCTRL_CONFIG_PARAM_GET:
        case PM_PINCTRL_CONFIG_PARAM_SET:
        case PM_IOCTL:
+               *version = (PM_API_BASE_VERSION << 16);
+               break;
        case PM_QUERY_DATA:
+               *version = (PM_API_QUERY_DATA_VERSION << 16);
+               break;
        case PM_CLOCK_ENABLE:
        case PM_CLOCK_DISABLE:
        case PM_CLOCK_GETSTATE:
index 966b00bb506861564f2ac9adf0bce3219b432129..b8c017c3e2416b9e876b70a4fba185c1e011f686 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, Xilinx, Inc. All rights reserved.
+ * Copyright (c) 2019-2020, Xilinx, Inc. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -39,6 +39,8 @@
 /* PM API Versions */
 #define PM_API_BASE_VERSION            1U
 
+#define PM_API_QUERY_DATA_VERSION      2U
+
 /* PM API ids */
 #define PM_GET_API_VERSION             1U
 #define PM_GET_DEVICE_STATUS           3U
@@ -163,4 +165,25 @@ enum pm_ret_status {
        PM_RET_ERROR_TIMEOUT = 2006,
        PM_RET_ERROR_NODE_USED = 2007
 };
+
+/**
+ * Qids
+ */
+enum pm_query_id {
+       XPM_QID_INVALID,
+       XPM_QID_CLOCK_GET_NAME,
+       XPM_QID_CLOCK_GET_TOPOLOGY,
+       XPM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS,
+       XPM_QID_CLOCK_GET_MUXSOURCES,
+       XPM_QID_CLOCK_GET_ATTRIBUTES,
+       XPM_QID_PINCTRL_GET_NUM_PINS,
+       XPM_QID_PINCTRL_GET_NUM_FUNCTIONS,
+       XPM_QID_PINCTRL_GET_NUM_FUNCTION_GROUPS,
+       XPM_QID_PINCTRL_GET_FUNCTION_NAME,
+       XPM_QID_PINCTRL_GET_FUNCTION_GROUPS,
+       XPM_QID_PINCTRL_GET_PIN_GROUPS,
+       XPM_QID_CLOCK_GET_NUM_CLOCKS,
+       XPM_QID_CLOCK_GET_MAX_DIVISOR,
+       XPM_QID_PLD_GET_PARENT,
+};
 #endif /* PM_DEFS_H */
index 45b280370489b0ae5d62db6b6221722f6580ecca..f0e42d6514af2fca412338d7e7f0002eb39c3f64 100644 (file)
@@ -214,14 +214,15 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
 
        case PM_QUERY_DATA:
        {
-               uint32_t data[4] = { 0 };
+               uint32_t data[8] = { 0 };
 
                ret = pm_query_data(pm_arg[0], pm_arg[1], pm_arg[2],
-                             pm_arg[3], data);
+                                     pm_arg[3], data);
+
                SMC_RET2(handle, (uint64_t)ret  | ((uint64_t)data[0] << 32),
-                        (uint64_t)data[1] | ((uint64_t)data[2] << 32));
-       }
+                                (uint64_t)data[1] | ((uint64_t)data[2] << 32));
 
+       }
        case PM_CLOCK_ENABLE:
                ret = pm_clock_enable(pm_arg[0]);
                SMC_RET1(handle, (uint64_t)ret);