3 * Copyright (c) 2011-2012, ARM Limited. All rights reserved.
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
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.
15 #ifndef __ARM_TRUSTZONE_H__
16 #define __ARM_TRUSTZONE_H__
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
27 FIXME: Need documentation
37 FIXME: Need documentation
40 TZPCClearDecProtBits (
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)
74 /* Some useful masks */
75 #define TZASC_REGION_SETUP_LO_ADDR_MASK 0xFFFF8000
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
82 #define TZASC_REGION_SETUP_LO_ADDR(x) ((x) & TZASC_REGION_SETUP_LO_ADDR_MASK)
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)
91 FIXME: Need documentation
102 IN UINTN SubregionDisableMask