SPM: Convert SVC number to uint8_t
SVC number encoded in SVC instruction is 8-bit long.
Currently it relies on the short-enum compiler option to have a
8-bit long SVC number type.
This patch converts the enum to uint8_t for SVC number and divids
the SVC numbers to two parts for IPC model:
- 0x0 ~ 0x7F for SVC calls only allowed from Thread Mode
- 0x80 ~ 0xFF for SVC calls only allowed from interrupt handling
Note: For library model, the SVC numbers have no restrictions.
Since the requirements for SVC number assignment are different,
this patch also split the SVC number header for IPC and Library models.
Change-Id: I0fb4dd110be6bab05e1c4b9a8fc55e1b8bfbc0eb
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/secure_fw/spm/include/interface/svc_num.h b/secure_fw/spm/include/interface/svc_num.h
new file mode 100644
index 0000000..1ffa32e
--- /dev/null
+++ b/secure_fw/spm/include/interface/svc_num.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __SVC_NUM_H__
+#define __SVC_NUM_H__
+
+#include "tfm_spm_log.h"
+
+/*
+ * SVC numbers for FF-M compliant implementations.
+ * 0x0 ~ 0x7F can be only called from Thread Mode, the rest from ISR only.
+ */
+
+/********************* SVC for Thread Mode ************************************/
+/* PSA Client APIs */
+#define TFM_SVC_PSA_FRAMEWORK_VERSION (0x0)
+#define TFM_SVC_PSA_VERSION (0x1)
+#define TFM_SVC_PSA_CONNECT (0x2)
+#define TFM_SVC_PSA_CALL (0x3)
+#define TFM_SVC_PSA_CLOSE (0x4)
+/* PSA Secure Partition APIs */
+#define TFM_SVC_PSA_WAIT (0x5)
+#define TFM_SVC_PSA_GET (0x6)
+#define TFM_SVC_PSA_SET_RHANDLE (0x7)
+#define TFM_SVC_PSA_READ (0x8)
+#define TFM_SVC_PSA_SKIP (0x9)
+#define TFM_SVC_PSA_WRITE (0xA)
+#define TFM_SVC_PSA_REPLY (0xB)
+#define TFM_SVC_PSA_NOTIFY (0xC)
+#define TFM_SVC_PSA_CLEAR (0xD)
+#define TFM_SVC_PSA_EOI (0xE)
+#define TFM_SVC_PSA_PANIC (0xF)
+#define TFM_SVC_PSA_LIFECYCLE (0x10)
+#define TFM_SVC_PSA_IRQ_ENABLE (0x11)
+#define TFM_SVC_PSA_IRQ_DISABLE (0x12)
+/* TF-M specific, starts from 0x40 */
+#define TFM_SVC_SPM_REQUEST (0x40)
+#define TFM_SVC_GET_BOOT_DATA (0x41)
+#define TFM_SVC_HANDLER_MODE (0x42)
+#if (TFM_SPM_LOG_LEVEL > TFM_SPM_LOG_LEVEL_SILENCE)
+#define TFM_SVC_OUTPUT_UNPRIV_STRING (0x7F)
+#endif
+#define TFM_SVC_NUMBER_DIVIDER (0x7F)
+/********************* SVC for interrupt handling *****************************/
+
+#endif /* __SVC_NUM_H__ */