summaryrefslogtreecommitdiff
path: root/plat/xilinx
diff options
context:
space:
mode:
authorTejas Patel <tejas.patel@xilinx.com>2019-01-08 01:46:35 -0800
committerJolly Shah <jolly.shah@xilinx.com>2020-01-15 11:01:42 -0800
commit95794c732367ff2bc595f9226d70bb8d6eaaa1d8 (patch)
treeac45bbe73eb0c655fa0e99561c09e2b43e70b431 /plat/xilinx
parentc73a90e571e763e3afc1d9cbef09e7d134b25af8 (diff)
xilinx: versal: Add get_api_version support
Add support for EEMI API get_api_verion. Signed-off-by: Tejas Patel <tejas.patel@xilinx.com> Signed-off-by: Jolly Shah <jolly.shah@xilinx.com> Change-Id: Ic1ef90a194ae6164994a7fc5d8ff0b7b192636fe
Diffstat (limited to 'plat/xilinx')
-rw-r--r--plat/xilinx/versal/platform.mk1
-rw-r--r--plat/xilinx/versal/pm_service/pm_api_sys.c45
-rw-r--r--plat/xilinx/versal/pm_service/pm_api_sys.h18
-rw-r--r--plat/xilinx/versal/pm_service/pm_defs.h3
4 files changed, 67 insertions, 0 deletions
diff --git a/plat/xilinx/versal/platform.mk b/plat/xilinx/versal/platform.mk
index 190be328b..eb1f0bb61 100644
--- a/plat/xilinx/versal/platform.mk
+++ b/plat/xilinx/versal/platform.mk
@@ -67,4 +67,5 @@ BL31_SOURCES += lib/cpus/aarch64/cortex_a53.S \
plat/xilinx/versal/versal_gicv3.c \
plat/xilinx/versal/versal_ipi.c \
plat/xilinx/versal/pm_service/pm_svc_main.c \
+ plat/xilinx/versal/pm_service/pm_api_sys.c \
plat/xilinx/versal/pm_service/pm_client.c
diff --git a/plat/xilinx/versal/pm_service/pm_api_sys.c b/plat/xilinx/versal/pm_service/pm_api_sys.c
new file mode 100644
index 000000000..618624e88
--- /dev/null
+++ b/plat/xilinx/versal/pm_service/pm_api_sys.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2019, Xilinx, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * Versal system level PM-API functions and communication with PMC via
+ * IPI interrupts
+ */
+
+#include <pm_common.h>
+#include <pm_ipi.h>
+#include "pm_api_sys.h"
+#include "pm_client.h"
+
+/*********************************************************************
+ * Target module IDs macros
+ ********************************************************************/
+#define LIBPM_MODULE_ID 0x2
+#define LOADER_MODULE_ID 0x7
+
+/**
+ * Assigning of argument values into array elements.
+ */
+#define PM_PACK_PAYLOAD1(pl, mid, arg0) { \
+ pl[0] = (uint32_t)((uint32_t)((arg0) & 0xFF) | (mid << 8)); \
+}
+
+/* PM API functions */
+
+/**
+ * pm_get_api_version() - Get version number of PMC PM firmware
+ * @version Returns 32-bit version number of PMC Power Management Firmware
+ *
+ * @return Returns status, either success or error+reason
+ */
+enum pm_ret_status pm_get_api_version(unsigned int *version)
+{
+ uint32_t payload[PAYLOAD_ARG_CNT];
+
+ /* Send request to the PMC */
+ PM_PACK_PAYLOAD1(payload, LIBPM_MODULE_ID, PM_GET_API_VERSION);
+ return pm_ipi_send_sync(primary_proc, payload, version, 1);
+}
diff --git a/plat/xilinx/versal/pm_service/pm_api_sys.h b/plat/xilinx/versal/pm_service/pm_api_sys.h
new file mode 100644
index 000000000..59f39524d
--- /dev/null
+++ b/plat/xilinx/versal/pm_service/pm_api_sys.h
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2019, Xilinx, Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef PM_API_SYS_H
+#define PM_API_SYS_H
+
+#include <stdint.h>
+
+/**********************************************************
+ * PM API function declarations
+ **********************************************************/
+
+enum pm_ret_status pm_get_api_version(unsigned int *version);
+
+#endif /* PM_API_SYS_H */
diff --git a/plat/xilinx/versal/pm_service/pm_defs.h b/plat/xilinx/versal/pm_service/pm_defs.h
index c435b7ada..ff3d26603 100644
--- a/plat/xilinx/versal/pm_service/pm_defs.h
+++ b/plat/xilinx/versal/pm_service/pm_defs.h
@@ -22,6 +22,9 @@
#define XPM_DEVID_ACPU_0 APU_DEVID(XPM_NODEIDX_DEV_ACPU_0)
#define XPM_DEVID_ACPU_1 APU_DEVID(XPM_NODEIDX_DEV_ACPU_1)
+/* PM API ids */
+#define PM_GET_API_VERSION 1U
+
/*********************************************************************
* Enum definitions
********************************************************************/