]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/OpteeLib/Optee.c
ArmPkg: Add initial OpteeLib implementation
[mirror_edk2.git] / ArmPkg / Library / OpteeLib / Optee.c
CommitLineData
d65b78f1
SG
1/** @file\r
2 Api's to communicate with OP-TEE OS (Trusted OS based on ARM TrustZone) via\r
3 secure monitor calls.\r
4\r
5 Copyright (c) 2018, Linaro Ltd. All rights reserved.<BR>\r
6\r
7 This program and the accompanying materials\r
8 are licensed and made available under the terms and conditions of the BSD License\r
9 which accompanies this distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17#include <Library/ArmSmcLib.h>\r
18#include <Library/BaseLib.h>\r
19#include <Library/OpteeLib.h>\r
20\r
21#include <IndustryStandard/ArmStdSmc.h>\r
22\r
23/**\r
24 Check for OP-TEE presence.\r
25**/\r
26BOOLEAN\r
27EFIAPI\r
28IsOpteePresent (\r
29 VOID\r
30 )\r
31{\r
32 ARM_SMC_ARGS ArmSmcArgs;\r
33\r
34 // Send a Trusted OS Calls UID command\r
35 ArmSmcArgs.Arg0 = ARM_SMC_ID_TOS_UID;\r
36 ArmCallSmc (&ArmSmcArgs);\r
37\r
38 if ((ArmSmcArgs.Arg0 == OPTEE_OS_UID0) &&\r
39 (ArmSmcArgs.Arg1 == OPTEE_OS_UID1) &&\r
40 (ArmSmcArgs.Arg2 == OPTEE_OS_UID2) &&\r
41 (ArmSmcArgs.Arg3 == OPTEE_OS_UID3)) {\r
42 return TRUE;\r
43 } else {\r
44 return FALSE;\r
45 }\r
46}\r