diff options
author | Paul Beesley <paul.beesley@arm.com> | 2019-10-15 12:51:55 +0000 |
---|---|---|
committer | Manish Pandey <manish.pandey2@arm.com> | 2019-12-20 16:03:51 +0000 |
commit | 0bf9f567a79033ff6db8c38111fc37fe07714896 (patch) | |
tree | e064bbdc2ff2713fb17686dba421ac77222c6718 /include/services | |
parent | aeaa225cbe24d63539261210e5aa901454de2a5b (diff) | |
download | trusted-firmware-a-0bf9f567a79033ff6db8c38111fc37fe07714896.tar.gz |
spm-mm: Refactor spm_svc.h and its contents
Change-Id: I91c192924433226b54d33e57d56d146c1c6df81b
Signed-off-by: Paul Beesley <paul.beesley@arm.com>
Diffstat (limited to 'include/services')
-rw-r--r-- | include/services/spm_mm_svc.h | 88 | ||||
-rw-r--r-- | include/services/spm_svc.h | 82 |
2 files changed, 88 insertions, 82 deletions
diff --git a/include/services/spm_mm_svc.h b/include/services/spm_mm_svc.h new file mode 100644 index 0000000000..89fb2b45d1 --- /dev/null +++ b/include/services/spm_mm_svc.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef SPM_MM_SVC_H +#define SPM_MM_SVC_H + +#include <lib/utils_def.h> + +#define SPM_MM_VERSION_MAJOR U(0) +#define SPM_MM_VERSION_MAJOR_SHIFT 16 +#define SPM_MM_VERSION_MAJOR_MASK U(0x7FFF) +#define SPM_MM_VERSION_MINOR U(1) +#define SPM_MM_VERSION_MINOR_SHIFT 0 +#define SPM_MM_VERSION_MINOR_MASK U(0xFFFF) +#define SPM_MM_VERSION_FORM(major, minor) ((major << \ + SPM_MM_VERSION_MAJOR_SHIFT) | \ + (minor)) +#define SPM_MM_VERSION_COMPILED SPM_MM_VERSION_FORM(SPM_MM_VERSION_MAJOR, \ + SPM_MM_VERSION_MINOR) + +/* These macros are used to identify SPM-MM calls using the SMC function ID */ +#define SPM_MM_FID_MASK U(0xffff) +#define SPM_MM_FID_MIN_VALUE U(0x40) +#define SPM_MM_FID_MAX_VALUE U(0x7f) +#define is_spm_mm_fid(_fid) \ + ((((_fid) & SPM_MM_FID_MASK) >= SPM_MM_FID_MIN_VALUE) && \ + (((_fid) & SPM_MM_FID_MASK) <= SPM_MM_FID_MAX_VALUE)) + +/* + * SMC IDs defined for accessing services implemented by the Secure Partition + * Manager from the Secure Partition(s). These services enable a partition to + * handle delegated events and request privileged operations from the manager. + * They occupy the range 0x60-0x7f. + */ +#define SPM_MM_VERSION_AARCH32 U(0x84000060) +#define MM_SP_EVENT_COMPLETE_AARCH64 U(0xC4000061) +#define MM_SP_MEMORY_ATTRIBUTES_GET_AARCH64 U(0xC4000064) +#define MM_SP_MEMORY_ATTRIBUTES_SET_AARCH64 U(0xC4000065) + +/* + * Macros used by MM_SP_MEMORY_ATTRIBUTES_SET_AARCH64. + */ + +#define MM_SP_MEMORY_ATTRIBUTES_ACCESS_NOACCESS U(0) +#define MM_SP_MEMORY_ATTRIBUTES_ACCESS_RW U(1) +/* Value U(2) is reserved. */ +#define MM_SP_MEMORY_ATTRIBUTES_ACCESS_RO U(3) +#define MM_SP_MEMORY_ATTRIBUTES_ACCESS_MASK U(3) +#define MM_SP_MEMORY_ATTRIBUTES_ACCESS_SHIFT 0 + +#define MM_SP_MEMORY_ATTRIBUTES_EXEC (U(0) << 2) +#define MM_SP_MEMORY_ATTRIBUTES_NON_EXEC (U(1) << 2) + + +/* SPM error codes. */ +#define SPM_MM_SUCCESS 0 +#define SPM_MM_NOT_SUPPORTED -1 +#define SPM_MM_INVALID_PARAMETER -2 +#define SPM_MM_DENIED -3 +#define SPM_MM_NO_MEMORY -5 + +#ifndef __ASSEMBLER__ + +#include <stdint.h> + +int32_t spm_mm_setup(void); + +uint64_t spm_mm_smc_handler(uint32_t smc_fid, + uint64_t x1, + uint64_t x2, + uint64_t x3, + uint64_t x4, + void *cookie, + void *handle, + uint64_t flags); + +/* Helper to enter a secure partition */ +uint64_t spm_mm_sp_call(uint32_t smc_fid, + uint64_t x1, + uint64_t x2, + uint64_t x3); + +#endif /* __ASSEMBLER__ */ + +#endif /* SPM_MM_SVC_H */ diff --git a/include/services/spm_svc.h b/include/services/spm_svc.h deleted file mode 100644 index c8dbe5d552..0000000000 --- a/include/services/spm_svc.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef SPM_SVC_H -#define SPM_SVC_H - -#include <lib/utils_def.h> - -#define SPM_VERSION_MAJOR U(0) -#define SPM_VERSION_MAJOR_SHIFT 16 -#define SPM_VERSION_MAJOR_MASK U(0x7FFF) -#define SPM_VERSION_MINOR U(1) -#define SPM_VERSION_MINOR_SHIFT 0 -#define SPM_VERSION_MINOR_MASK U(0xFFFF) -#define SPM_VERSION_FORM(major, minor) ((major << SPM_VERSION_MAJOR_SHIFT) | (minor)) -#define SPM_VERSION_COMPILED SPM_VERSION_FORM(SPM_VERSION_MAJOR, SPM_VERSION_MINOR) - -/* The macros below are used to identify SPM calls from the SMC function ID */ -#define SPM_FID_MASK U(0xffff) -#define SPM_FID_MIN_VALUE U(0x40) -#define SPM_FID_MAX_VALUE U(0x7f) -#define is_spm_fid(_fid) \ - ((((_fid) & SPM_FID_MASK) >= SPM_FID_MIN_VALUE) && \ - (((_fid) & SPM_FID_MASK) <= SPM_FID_MAX_VALUE)) - -/* - * SMC IDs defined for accessing services implemented by the Secure Partition - * Manager from the Secure Partition(s). These services enable a partition to - * handle delegated events and request privileged operations from the manager. - * They occupy the range 0x60-0x7f. - */ -#define SPM_VERSION_AARCH32 U(0x84000060) -#define SP_EVENT_COMPLETE_AARCH64 U(0xC4000061) -#define SP_MEMORY_ATTRIBUTES_GET_AARCH64 U(0xC4000064) -#define SP_MEMORY_ATTRIBUTES_SET_AARCH64 U(0xC4000065) - -/* - * Macros used by SP_MEMORY_ATTRIBUTES_SET_AARCH64. - */ - -#define SP_MEMORY_ATTRIBUTES_ACCESS_NOACCESS U(0) -#define SP_MEMORY_ATTRIBUTES_ACCESS_RW U(1) -/* Value U(2) is reserved. */ -#define SP_MEMORY_ATTRIBUTES_ACCESS_RO U(3) -#define SP_MEMORY_ATTRIBUTES_ACCESS_MASK U(3) -#define SP_MEMORY_ATTRIBUTES_ACCESS_SHIFT 0 - -#define SP_MEMORY_ATTRIBUTES_EXEC (U(0) << 2) -#define SP_MEMORY_ATTRIBUTES_NON_EXEC (U(1) << 2) - - -/* SPM error codes. */ -#define SPM_SUCCESS 0 -#define SPM_NOT_SUPPORTED -1 -#define SPM_INVALID_PARAMETER -2 -#define SPM_DENIED -3 -#define SPM_NO_MEMORY -5 - -#ifndef __ASSEMBLER__ - -#include <stdint.h> - -int32_t spm_setup(void); - -uint64_t spm_smc_handler(uint32_t smc_fid, - uint64_t x1, - uint64_t x2, - uint64_t x3, - uint64_t x4, - void *cookie, - void *handle, - uint64_t flags); - -/* Helper to enter a Secure Partition */ -uint64_t spm_sp_call(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3); - -#endif /* __ASSEMBLER__ */ - -#endif /* SPM_SVC_H */ |