\r
Copyright (c) 2018, Linaro Ltd. All rights reserved.<BR>\r
\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
return EFI_SUCCESS;\r
}\r
\r
+STATIC\r
+BOOLEAN\r
+IsOpteeSmcReturnRpc (\r
+ UINT32 Return\r
+ )\r
+{\r
+ return (Return != OPTEE_SMC_RETURN_UNKNOWN_FUNCTION) &&\r
+ ((Return & OPTEE_SMC_RETURN_RPC_PREFIX_MASK) ==\r
+ OPTEE_SMC_RETURN_RPC_PREFIX);\r
+}\r
+\r
/**\r
Does Standard SMC to OP-TEE in secure world.\r
\r
while (TRUE) {\r
ArmCallSmc (&ArmSmcArgs);\r
\r
- if (ArmSmcArgs.Arg0 == OPTEE_SMC_RETURN_RPC_FOREIGN_INTERRUPT) {\r
- //\r
- // A foreign interrupt was raised while secure world was\r
- // executing, since they are handled in UEFI a dummy RPC is\r
- // performed to let UEFI take the interrupt through the normal\r
- // vector.\r
- //\r
+ if (IsOpteeSmcReturnRpc (ArmSmcArgs.Arg0)) {\r
+ switch (ArmSmcArgs.Arg0) {\r
+ case OPTEE_SMC_RETURN_RPC_FOREIGN_INTERRUPT:\r
+ //\r
+ // A foreign interrupt was raised while secure world was\r
+ // executing, since they are handled in UEFI a dummy RPC is\r
+ // performed to let UEFI take the interrupt through the normal\r
+ // vector.\r
+ //\r
+ break;\r
+\r
+ default:\r
+ // Do nothing in case RPC is not implemented.\r
+ break;\r
+ }\r
+\r
ArmSmcArgs.Arg0 = OPTEE_SMC_RETURN_FROM_RPC;\r
} else {\r
break;\r