mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 15:44:04 +02:00
ArmPkg/StandaloneMmMmuLib: Introduce a SPM_MM status helper fucntion
Introduce a new helper function SpmMmStatusToEfiStatus() to convert the SPM_MM status values to EFI_STATUS values. Signed-off-by: Levi yun <yeoreum.yun@arm.com>
This commit is contained in:
parent
c56856f068
commit
54e394b4a2
@ -25,6 +25,33 @@
|
|||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
Convert FFA return code to EFI_STATUS.
|
||||||
|
|
||||||
|
@param [in] SpmMmStatus SPM_MM return code
|
||||||
|
|
||||||
|
@retval EFI_STATUS correspond EFI_STATUS to SpmMmStatus
|
||||||
|
**/
|
||||||
|
STATIC
|
||||||
|
EFI_STATUS
|
||||||
|
SpmMmStatusToEfiStatus (
|
||||||
|
IN UINTN SpmMmStatus
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (SpmMmStatus) {
|
||||||
|
case ARM_SPM_MM_RET_SUCCESS:
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
case ARM_SPM_MM_RET_INVALID_PARAMS:
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
case ARM_SPM_MM_RET_DENIED:
|
||||||
|
return EFI_ACCESS_DENIED;
|
||||||
|
case ARM_SPM_MM_RET_NO_MEMORY:
|
||||||
|
return EFI_OUT_OF_RESOURCES;
|
||||||
|
default:
|
||||||
|
return EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Send memory permission request to target.
|
/** Send memory permission request to target.
|
||||||
|
|
||||||
@param [in, out] SvcArgs Pointer to SVC arguments to send. On
|
@param [in, out] SvcArgs Pointer to SVC arguments to send. On
|
||||||
@ -106,24 +133,7 @@ SendMemoryPermissionRequest (
|
|||||||
// Bit 31 set means there is an error returned
|
// Bit 31 set means there is an error returned
|
||||||
// See [1], Section 13.5.5.1 MM_SP_MEMORY_ATTRIBUTES_GET_AARCH64 and
|
// See [1], Section 13.5.5.1 MM_SP_MEMORY_ATTRIBUTES_GET_AARCH64 and
|
||||||
// Section 13.5.5.2 MM_SP_MEMORY_ATTRIBUTES_SET_AARCH64.
|
// Section 13.5.5.2 MM_SP_MEMORY_ATTRIBUTES_SET_AARCH64.
|
||||||
switch (*RetVal) {
|
SpmMmStatusToEfiStatus (*RetVal);
|
||||||
case ARM_SPM_MM_RET_NOT_SUPPORTED:
|
|
||||||
return EFI_UNSUPPORTED;
|
|
||||||
|
|
||||||
case ARM_SPM_MM_RET_INVALID_PARAMS:
|
|
||||||
return EFI_INVALID_PARAMETER;
|
|
||||||
|
|
||||||
case ARM_SPM_MM_RET_DENIED:
|
|
||||||
return EFI_ACCESS_DENIED;
|
|
||||||
|
|
||||||
case ARM_SPM_MM_RET_NO_MEMORY:
|
|
||||||
return EFI_OUT_OF_RESOURCES;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// Undefined error code received.
|
|
||||||
ASSERT (0);
|
|
||||||
return EFI_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user