mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-31 01:24:12 +02:00
ArmPkg/OpteeLib: Add dummy RPC handler
Add dummy RPC handler for RPCs that are not implemented as control should be returned back to OP-TEE in case any RPC is invoked. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
This commit is contained in:
parent
bc39c5cbea
commit
088a533480
@ -123,6 +123,17 @@ OpteeInit (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
BOOLEAN
|
||||||
|
IsOpteeSmcReturnRpc (
|
||||||
|
UINT32 Return
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return (Return != OPTEE_SMC_RETURN_UNKNOWN_FUNCTION) &&
|
||||||
|
((Return & OPTEE_SMC_RETURN_RPC_PREFIX_MASK) ==
|
||||||
|
OPTEE_SMC_RETURN_RPC_PREFIX);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Does Standard SMC to OP-TEE in secure world.
|
Does Standard SMC to OP-TEE in secure world.
|
||||||
|
|
||||||
@ -147,13 +158,22 @@ OpteeCallWithArg (
|
|||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
ArmCallSmc (&ArmSmcArgs);
|
ArmCallSmc (&ArmSmcArgs);
|
||||||
|
|
||||||
if (ArmSmcArgs.Arg0 == OPTEE_SMC_RETURN_RPC_FOREIGN_INTERRUPT) {
|
if (IsOpteeSmcReturnRpc (ArmSmcArgs.Arg0)) {
|
||||||
//
|
switch (ArmSmcArgs.Arg0) {
|
||||||
// A foreign interrupt was raised while secure world was
|
case OPTEE_SMC_RETURN_RPC_FOREIGN_INTERRUPT:
|
||||||
// executing, since they are handled in UEFI a dummy RPC is
|
//
|
||||||
// performed to let UEFI take the interrupt through the normal
|
// A foreign interrupt was raised while secure world was
|
||||||
// vector.
|
// executing, since they are handled in UEFI a dummy RPC is
|
||||||
//
|
// performed to let UEFI take the interrupt through the normal
|
||||||
|
// vector.
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Do nothing in case RPC is not implemented.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ArmSmcArgs.Arg0 = OPTEE_SMC_RETURN_FROM_RPC;
|
ArmSmcArgs.Arg0 = OPTEE_SMC_RETURN_FROM_RPC;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
|
|
||||||
#define OPTEE_SMC_SHARED_MEMORY_CACHED 1
|
#define OPTEE_SMC_SHARED_MEMORY_CACHED 1
|
||||||
|
|
||||||
|
#define OPTEE_SMC_RETURN_UNKNOWN_FUNCTION 0xffffffff
|
||||||
|
#define OPTEE_SMC_RETURN_RPC_PREFIX_MASK 0xffff0000
|
||||||
|
#define OPTEE_SMC_RETURN_RPC_PREFIX 0xffff0000
|
||||||
#define OPTEE_SMC_RETURN_RPC_FOREIGN_INTERRUPT 0xffff0004
|
#define OPTEE_SMC_RETURN_RPC_FOREIGN_INTERRUPT 0xffff0004
|
||||||
|
|
||||||
#define OPTEE_MESSAGE_COMMAND_OPEN_SESSION 0
|
#define OPTEE_MESSAGE_COMMAND_OPEN_SESSION 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user