]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/Include/Drivers/ArmTrustzone.h
827b5cd568c1f66a1f42b258c8c27311591dbd32
[mirror_edk2.git] / ArmPlatformPkg / Include / Drivers / ArmTrustzone.h
1 /** @file
2 *
3 * Copyright (c) 2011-2012, ARM Limited. All rights reserved.
4 *
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
9 *
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 *
13 **/
14
15 #ifndef __ARM_TRUSTZONE_H__
16 #define __ARM_TRUSTZONE_H__
17
18 #include <Uefi.h>
19
20 // Setup TZ Protection Controller
21 #define TZPC_DECPROT_0 0
22 #define TZPC_DECPROT_1 1
23 #define TZPC_DECPROT_2 2
24 #define TZPC_DECPROT_MAX 2
25
26 /**
27 FIXME: Need documentation
28 **/
29 EFI_STATUS
30 TZPCSetDecProtBits (
31 IN UINTN TzpcBase,
32 IN UINTN TzpcId,
33 IN UINTN Bits
34 );
35
36 /**
37 FIXME: Need documentation
38 **/
39 EFI_STATUS
40 TZPCClearDecProtBits (
41 IN UINTN TzpcBase,
42 IN UINTN TzpcId,
43 IN UINTN Bits
44 );
45
46 // Setup TZ Address Space Controller
47 #define TZASC_REGION_ENABLED 1
48 #define TZASC_REGION_DISABLED 0
49 #define TZASC_REGION_SIZE_32KB 0xE
50 #define TZASC_REGION_SIZE_64KB 0xF
51 #define TZASC_REGION_SIZE_128KB 0x10
52 #define TZASC_REGION_SIZE_256KB 0x11
53 #define TZASC_REGION_SIZE_512KB 0x12
54 #define TZASC_REGION_SIZE_1MB 0x13
55 #define TZASC_REGION_SIZE_2MB 0x14
56 #define TZASC_REGION_SIZE_4MB 0x15
57 #define TZASC_REGION_SIZE_8MB 0x16
58 #define TZASC_REGION_SIZE_16MB 0x17
59 #define TZASC_REGION_SIZE_32MB 0x18
60 #define TZASC_REGION_SIZE_64MB 0x19
61 #define TZASC_REGION_SIZE_128MB 0x1A
62 #define TZASC_REGION_SIZE_256MB 0x1B
63 #define TZASC_REGION_SIZE_512MB 0x1C
64 #define TZASC_REGION_SIZE_1GB 0x1D
65 #define TZASC_REGION_SIZE_2GB 0x1E
66 #define TZASC_REGION_SIZE_4GB 0x1F
67 #define TZASC_REGION_SECURITY_SR (1 << 3)
68 #define TZASC_REGION_SECURITY_SW (1 << 2)
69 #define TZASC_REGION_SECURITY_SRW (TZASC_REGION_SECURITY_SR|TZASC_REGION_SECURITY_SW)
70 #define TZASC_REGION_SECURITY_NSR (1 << 1)
71 #define TZASC_REGION_SECURITY_NSW 1
72 #define TZASC_REGION_SECURITY_NSRW (TZASC_REGION_SECURITY_NSR|TZASC_REGION_SECURITY_NSW)
73
74 /* Some useful masks */
75 #define TZASC_REGION_SETUP_LO_ADDR_MASK 0xFFFF8000
76
77 #define TZASC_REGION_ATTR_SECURITY_MASK 0xF
78 #define TZASC_REGION_ATTR_SUBREG_DIS_MASK 0xFF
79 #define TZASC_REGION_ATTR_SIZE_MASK 0x3F
80 #define TZASC_REGION_ATTR_EN_MASK 0x1
81
82 #define TZASC_REGION_SETUP_LO_ADDR(x) ((x) & TZASC_REGION_SETUP_LO_ADDR_MASK)
83
84 #define TZASC_REGION_ATTR_SECURITY(x) (((x) & TZASC_REGION_ATTR_SECURITY_MASK) << 28)
85 #define TZASC_REGION_ATTR_SUBREG_DISABLE(x) \
86 (((x) & TZASC_REGION_ATTR_SUBREG_DIS_MASK) << 8)
87 #define TZASC_REGION_ATTR_SIZE(x) (((x) & TZASC_REGION_ATTR_SIZE_MASK) << 1)
88 #define TZASC_REGION_ATTR_ENABLE(x) ((x) & TZASC_REGION_ATTR_EN_MASK)
89
90 /**
91 FIXME: Need documentation
92 **/
93 EFI_STATUS
94 TZASCSetRegion (
95 IN INTN TzascBase,
96 IN UINTN RegionId,
97 IN UINTN Enabled,
98 IN UINTN LowAddress,
99 IN UINTN HighAddress,
100 IN UINTN Size,
101 IN UINTN Security,
102 IN UINTN SubregionDisableMask
103 );
104
105 #endif