]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Include/Chipset/AArch64.h
ARM: Remove NSACR from the common code
[mirror_edk2.git] / ArmPkg / Include / Chipset / AArch64.h
1 /** @file
2
3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
5
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #ifndef __AARCH64_H__
17 #define __AARCH64_H__
18
19 #include <Chipset/AArch64Mmu.h>
20 #include <Chipset/ArmArchTimer.h>
21
22 // ARM Interrupt ID in Exception Table
23 #define ARM_ARCH_EXCEPTION_IRQ EXCEPT_AARCH64_IRQ
24
25 // CPACR - Coprocessor Access Control Register definitions
26 #define CPACR_TTA_EN (1UL << 28)
27 #define CPACR_FPEN_EL1 (1UL << 20)
28 #define CPACR_FPEN_FULL (3UL << 20)
29 #define CPACR_CP_FULL_ACCESS 0x300000
30
31 // Coprocessor Trap Register (CPTR)
32 #define AARCH64_CPTR_TFP (1 << 10)
33
34 // ID_AA64PFR0 - AArch64 Processor Feature Register 0 definitions
35 #define AARCH64_PFR0_FP (0xF << 16)
36
37 // SCR - Secure Configuration Register definitions
38 #define SCR_NS (1 << 0)
39 #define SCR_IRQ (1 << 1)
40 #define SCR_FIQ (1 << 2)
41 #define SCR_EA (1 << 3)
42 #define SCR_FW (1 << 4)
43 #define SCR_AW (1 << 5)
44
45 // MIDR - Main ID Register definitions
46 #define ARM_CPU_TYPE_MASK 0xFFF
47 #define ARM_CPU_TYPE_AEMv8 0xD0F
48 #define ARM_CPU_TYPE_A15 0xC0F
49 #define ARM_CPU_TYPE_A9 0xC09
50 #define ARM_CPU_TYPE_A5 0xC05
51
52 // Hypervisor Configuration Register
53 #define ARM_HCR_FMO BIT3
54 #define ARM_HCR_IMO BIT4
55 #define ARM_HCR_AMO BIT5
56 #define ARM_HCR_TGE BIT27
57
58 // AArch64 Exception Level
59 #define AARCH64_EL3 0xC
60 #define AARCH64_EL2 0x8
61 #define AARCH64_EL1 0x4
62
63 #define ARM_VECTOR_TABLE_ALIGNMENT ((1 << 11)-1)
64
65 VOID
66 EFIAPI
67 ArmEnableSWPInstruction (
68 VOID
69 );
70
71 UINTN
72 EFIAPI
73 ArmReadCbar (
74 VOID
75 );
76
77 UINTN
78 EFIAPI
79 ArmReadTpidrurw (
80 VOID
81 );
82
83 VOID
84 EFIAPI
85 ArmWriteTpidrurw (
86 UINTN Value
87 );
88
89 UINTN
90 EFIAPI
91 ArmIsArchTimerImplemented (
92 VOID
93 );
94
95 UINTN
96 EFIAPI
97 ArmReadIdPfr0 (
98 VOID
99 );
100
101 UINTN
102 EFIAPI
103 ArmReadIdPfr1 (
104 VOID
105 );
106
107 UINTN
108 EFIAPI
109 ArmGetTCR (
110 VOID
111 );
112
113 VOID
114 EFIAPI
115 ArmSetTCR (
116 UINTN Value
117 );
118
119 UINTN
120 EFIAPI
121 ArmGetMAIR (
122 VOID
123 );
124
125 VOID
126 EFIAPI
127 ArmSetMAIR (
128 UINTN Value
129 );
130
131 VOID
132 EFIAPI
133 ArmDisableAlignmentCheck (
134 VOID
135 );
136
137
138 VOID
139 EFIAPI
140 ArmEnableAlignmentCheck (
141 VOID
142 );
143
144 VOID
145 EFIAPI
146 ArmDisableAllExceptions (
147 VOID
148 );
149
150 VOID
151 ArmWriteHcr (
152 IN UINTN Hcr
153 );
154
155 UINTN
156 ArmReadCurrentEL (
157 VOID
158 );
159
160 UINT64
161 PageAttributeToGcdAttribute (
162 IN UINT64 PageAttributes
163 );
164
165 UINT64
166 GcdAttributeToPageAttribute (
167 IN UINT64 GcdAttributes
168 );
169
170 UINTN
171 ArmWriteCptr (
172 IN UINT64 Cptr
173 );
174
175 #endif // __AARCH64_H__