summaryrefslogtreecommitdiff
path: root/plat
diff options
context:
space:
mode:
authorJoanna Farley <joanna.farley@arm.com>2023-02-18 17:35:44 +0100
committerTrustedFirmware Code Review <review@review.trustedfirmware.org>2023-02-18 17:35:44 +0100
commite6af3c715463f10303a5f1f6bd3117feed269b9a (patch)
treeabc9cb95be886a84e299ee3c5f9485872df9eafa /plat
parentfda255c36d3752f8213b58983dbacc514740dd2b (diff)
parent09b342a9d3aa030bde6d52e39203b9b8c8e6b106 (diff)
downloadarm-trusted-firmware-e6af3c715463f10303a5f1f6bd3117feed269b9a.tar.gz
Merge changes from topic "zynqmp-smc" into integration
* changes: fix(zynqmp): check smc_fid 23:16 bits fix(zynqmp): separate EM from PM SMCs
Diffstat (limited to 'plat')
-rw-r--r--plat/xilinx/zynqmp/sip_svc_setup.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/plat/xilinx/zynqmp/sip_svc_setup.c b/plat/xilinx/zynqmp/sip_svc_setup.c
index 997cb1e1b..8b0adc696 100644
--- a/plat/xilinx/zynqmp/sip_svc_setup.c
+++ b/plat/xilinx/zynqmp/sip_svc_setup.c
@@ -6,6 +6,8 @@
/* Top level SMC handler for SiP calls. Dispatch PM calls to PM SMC handler. */
+#include <inttypes.h>
+
#include <common/runtime_svc.h>
#include <tools_share/uuid.h>
@@ -23,14 +25,14 @@
#define SIP_SVC_VERSION_MINOR 1
/* These macros are used to identify PM, IPI calls from the SMC function ID */
-#define PM_FID_MASK 0xf000u
+#define SIP_FID_MASK GENMASK(23, 16)
+#define XLNX_FID_MASK GENMASK(23, 12)
#define PM_FID_VALUE 0u
#define IPI_FID_VALUE 0x1000u
-#define EM_FID_MASK 0xf0000u
#define EM_FID_VALUE 0xE0000u
-#define is_em_fid(_fid) (((_fid) & EM_FID_MASK) == EM_FID_VALUE)
-#define is_pm_fid(_fid) (((_fid) & PM_FID_MASK) == PM_FID_VALUE)
-#define is_ipi_fid(_fid) (((_fid) & PM_FID_MASK) == IPI_FID_VALUE)
+#define is_em_fid(_fid) (((_fid) & XLNX_FID_MASK) == EM_FID_VALUE)
+#define is_pm_fid(_fid) (((_fid) & XLNX_FID_MASK) == PM_FID_VALUE)
+#define is_ipi_fid(_fid) (((_fid) & XLNX_FID_MASK) == IPI_FID_VALUE)
/* SiP Service UUID */
DEFINE_SVC_UUID2(zynqmp_sip_uuid,
@@ -63,12 +65,22 @@ static uintptr_t sip_svc_smc_handler(uint32_t smc_fid,
void *handle,
u_register_t flags)
{
+ VERBOSE("SMCID: 0x%08x, x1: 0x%016" PRIx64 ", x2: 0x%016" PRIx64 ", x3: 0x%016" PRIx64 ", x4: 0x%016" PRIx64 "\n",
+ smc_fid, x1, x2, x3, x4);
+
/* Let EM SMC handler deal with EM-related requests */
if (is_em_fid(smc_fid)) {
return em_smc_handler(smc_fid, x1, x2, x3, x4, cookie, handle,
flags);
- } else if (is_pm_fid(smc_fid)) {
+ }
+
+ if (smc_fid & SIP_FID_MASK) {
+ WARN("SMC out of SiP assinged range: 0x%x\n", smc_fid);
+ SMC_RET1(handle, SMC_UNK);
+ }
+
/* Let PM SMC handler deal with PM-related requests */
+ if (is_pm_fid(smc_fid)) {
return pm_smc_handler(smc_fid, x1, x2, x3, x4, cookie, handle,
flags);
}