52 if ((SvcArgs ==
NULL) || (RetVal ==
NULL)) {
53 return EFI_INVALID_PARAMETER;
66 if (SvcArgs->Arg0 == ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP) {
71 *RetVal = SvcArgs->Arg3;
77 *RetVal = SvcArgs->Arg2;
79 case ARM_FFA_SPM_RET_INVALID_PARAMETERS:
80 return EFI_INVALID_PARAMETER;
82 case ARM_FFA_SPM_RET_DENIED:
83 return EFI_ACCESS_DENIED;
85 case ARM_FFA_SPM_RET_NOT_SUPPORTED:
86 return EFI_UNSUPPORTED;
88 case ARM_FFA_SPM_RET_BUSY:
91 case ARM_FFA_SPM_RET_ABORTED:
97 return EFI_INVALID_PARAMETER;
101 *RetVal = SvcArgs->Arg0;
105 if ((*RetVal & BIT31) != 0) {
110 case ARM_SVC_SPM_RET_NOT_SUPPORTED:
111 return EFI_UNSUPPORTED;
113 case ARM_SVC_SPM_RET_INVALID_PARAMS:
114 return EFI_INVALID_PARAMETER;
116 case ARM_SVC_SPM_RET_DENIED:
117 return EFI_ACCESS_DENIED;
119 case ARM_SVC_SPM_RET_NO_MEMORY:
120 return EFI_OUT_OF_RESOURCES;
125 return EFI_INVALID_PARAMETER;
152 OUT UINT32 *MemoryAttributes
159 if (MemoryAttributes ==
NULL) {
160 return EFI_INVALID_PARAMETER;
168 SvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ;
169 SvcArgs.Arg1 = ARM_FFA_DESTINATION_ENDPOINT_ID;
171 SvcArgs.Arg3 = ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES;
172 SvcArgs.Arg4 = BaseAddress;
174 SvcArgs.Arg0 = ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES;
175 SvcArgs.Arg1 = BaseAddress;
181 if (EFI_ERROR (Status)) {
182 *MemoryAttributes = 0;
186 *MemoryAttributes = Ret;
212 IN UINT32 Permissions
223 SvcArgs.Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ;
224 SvcArgs.Arg1 = ARM_FFA_DESTINATION_ENDPOINT_ID;
226 SvcArgs.Arg3 = ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES;
227 SvcArgs.Arg4 = BaseAddress;
229 SvcArgs.Arg6 = Permissions;
231 SvcArgs.Arg0 = ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES;
232 SvcArgs.Arg1 = BaseAddress;
234 SvcArgs.Arg3 = Permissions;
241ArmSetMemoryRegionNoExec (
247 UINT32 MemoryAttributes;
248 UINT32 CodePermission;
251 if (!EFI_ERROR (Status)) {
252 CodePermission = SET_MEM_ATTR_CODE_PERM_XN << SET_MEM_ATTR_CODE_PERM_SHIFT;
256 MemoryAttributes | CodePermission
264ArmClearMemoryRegionNoExec (
270 UINT32 MemoryAttributes;
271 UINT32 CodePermission;
274 if (!EFI_ERROR (Status)) {
275 CodePermission = SET_MEM_ATTR_CODE_PERM_XN << SET_MEM_ATTR_CODE_PERM_SHIFT;
279 MemoryAttributes & ~CodePermission
287ArmSetMemoryRegionReadOnly (
293 UINT32 MemoryAttributes;
294 UINT32 DataPermission;
297 if (!EFI_ERROR (Status)) {
298 DataPermission = SET_MEM_ATTR_DATA_PERM_RO << SET_MEM_ATTR_DATA_PERM_SHIFT;
302 MemoryAttributes | DataPermission
310ArmClearMemoryRegionReadOnly (
316 UINT32 MemoryAttributes;
317 UINT32 PermissionRequest;
320 if (!EFI_ERROR (Status)) {
321 PermissionRequest = SET_MEM_ATTR_MAKE_PERM_REQUEST (
322 SET_MEM_ATTR_DATA_PERM_RW,
STATIC EFI_STATUS GetMemoryPermissions(IN EFI_PHYSICAL_ADDRESS BaseAddress, OUT UINT32 *MemoryAttributes)
STATIC EFI_STATUS RequestMemoryPermissionChange(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT32 Permissions)
STATIC EFI_STATUS SendMemoryPermissionRequest(IN OUT ARM_SVC_ARGS *SvcArgs, OUT INT32 *RetVal)
VOID ArmCallSvc(IN OUT ARM_SVC_ARGS *Args)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define FeaturePcdGet(TokenName)
UINT64 EFI_PHYSICAL_ADDRESS
#define EFI_SIZE_TO_PAGES(Size)