]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Include/Chipset/AArch64.h
ArmPlatformPkg/ArmJunoDxe: Set the platform dependent FDT device path
[mirror_edk2.git] / ArmPkg / Include / Chipset / AArch64.h
CommitLineData
25402f5d
HL
1/** @file\r
2\r
3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
7aec2926 4 Copyright (c) 2011 - 2015, ARM Ltd. All rights reserved.<BR>\r
25402f5d
HL
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef __AARCH64_H__\r
17#define __AARCH64_H__\r
18\r
19#include <Chipset/AArch64Mmu.h>\r
20#include <Chipset/ArmArchTimer.h>\r
21\r
22// ARM Interrupt ID in Exception Table\r
23#define ARM_ARCH_EXCEPTION_IRQ EXCEPT_AARCH64_IRQ\r
24\r
25// CPACR - Coprocessor Access Control Register definitions\r
26#define CPACR_TTA_EN (1UL << 28)\r
27#define CPACR_FPEN_EL1 (1UL << 20)\r
28#define CPACR_FPEN_FULL (3UL << 20)\r
29#define CPACR_CP_FULL_ACCESS 0x300000\r
30\r
31// Coprocessor Trap Register (CPTR)\r
32#define AARCH64_CPTR_TFP (1 << 10)\r
33\r
34// ID_AA64PFR0 - AArch64 Processor Feature Register 0 definitions\r
35#define AARCH64_PFR0_FP (0xF << 16)\r
27331bff 36#define AARCH64_PFR0_GIC (0xF << 24)\r
25402f5d 37\r
25402f5d
HL
38// SCR - Secure Configuration Register definitions\r
39#define SCR_NS (1 << 0)\r
40#define SCR_IRQ (1 << 1)\r
41#define SCR_FIQ (1 << 2)\r
42#define SCR_EA (1 << 3)\r
43#define SCR_FW (1 << 4)\r
44#define SCR_AW (1 << 5)\r
45\r
46// MIDR - Main ID Register definitions\r
7aec2926 47#define ARM_CPU_TYPE_SHIFT 4\r
25402f5d
HL
48#define ARM_CPU_TYPE_MASK 0xFFF\r
49#define ARM_CPU_TYPE_AEMv8 0xD0F\r
b7dd4dbd
OM
50#define ARM_CPU_TYPE_A53 0xD03\r
51#define ARM_CPU_TYPE_A57 0xD07\r
25402f5d
HL
52#define ARM_CPU_TYPE_A15 0xC0F\r
53#define ARM_CPU_TYPE_A9 0xC09\r
7aec2926 54#define ARM_CPU_TYPE_A7 0xC07\r
25402f5d
HL
55#define ARM_CPU_TYPE_A5 0xC05\r
56\r
b7dd4dbd
OM
57#define ARM_CPU_REV_MASK ((0xF << 20) | (0xF) )\r
58#define ARM_CPU_REV(rn, pn) ((((rn) & 0xF) << 20) | ((pn) & 0xF))\r
59\r
25402f5d 60// Hypervisor Configuration Register\r
6a44c227
OM
61#define ARM_HCR_FMO BIT3\r
62#define ARM_HCR_IMO BIT4\r
63#define ARM_HCR_AMO BIT5\r
64#define ARM_HCR_TSC BIT19\r
65#define ARM_HCR_TGE BIT27\r
25402f5d 66\r
f3c5066f
OM
67// Exception Syndrome Register\r
68#define AARCH64_ESR_EC(Ecr) ((0x3F << 26) & (Ecr))\r
69#define AARCH64_ESR_ISS(Ecr) ((0x1FFFFFF) & (Ecr))\r
70\r
71#define AARCH64_ESR_EC_SMC32 (0x13 << 26)\r
72#define AARCH64_ESR_EC_SMC64 (0x17 << 26)\r
73\r
25402f5d
HL
74// AArch64 Exception Level\r
75#define AARCH64_EL3 0xC\r
76#define AARCH64_EL2 0x8\r
77#define AARCH64_EL1 0x4\r
78\r
7e119c67
OM
79// Saved Program Status Register definitions\r
80#define SPSR_A BIT8\r
81#define SPSR_I BIT7\r
82#define SPSR_F BIT6\r
83\r
84#define SPSR_AARCH32 BIT4\r
85\r
86#define SPSR_AARCH32_MODE_USER 0x0\r
87#define SPSR_AARCH32_MODE_FIQ 0x1\r
88#define SPSR_AARCH32_MODE_IRQ 0x2\r
89#define SPSR_AARCH32_MODE_SVC 0x3\r
90#define SPSR_AARCH32_MODE_ABORT 0x7\r
91#define SPSR_AARCH32_MODE_UNDEF 0xB\r
92#define SPSR_AARCH32_MODE_SYS 0xF\r
93\r
94// Counter-timer Hypervisor Control register definitions\r
95#define CNTHCTL_EL2_EL1PCTEN BIT0\r
96#define CNTHCTL_EL2_EL1PCEN BIT1\r
97\r
25402f5d
HL
98#define ARM_VECTOR_TABLE_ALIGNMENT ((1 << 11)-1)\r
99\r
100VOID\r
101EFIAPI\r
102ArmEnableSWPInstruction (\r
103 VOID\r
104 );\r
105\r
106UINTN\r
107EFIAPI\r
108ArmReadCbar (\r
109 VOID\r
110 );\r
111\r
112UINTN\r
113EFIAPI\r
114ArmReadTpidrurw (\r
115 VOID\r
116 );\r
117\r
118VOID\r
119EFIAPI\r
120ArmWriteTpidrurw (\r
121 UINTN Value\r
122 );\r
123\r
25402f5d
HL
124UINTN\r
125EFIAPI\r
126ArmGetTCR (\r
127 VOID\r
128 );\r
129\r
130VOID\r
131EFIAPI\r
132ArmSetTCR (\r
133 UINTN Value\r
134 );\r
135\r
136UINTN\r
137EFIAPI\r
138ArmGetMAIR (\r
139 VOID\r
140 );\r
141\r
142VOID\r
143EFIAPI\r
144ArmSetMAIR (\r
145 UINTN Value\r
146 );\r
147\r
148VOID\r
149EFIAPI\r
150ArmDisableAlignmentCheck (\r
151 VOID\r
152 );\r
153\r
25402f5d
HL
154VOID\r
155EFIAPI\r
156ArmEnableAlignmentCheck (\r
157 VOID\r
158 );\r
159\r
160VOID\r
161EFIAPI\r
162ArmDisableAllExceptions (\r
163 VOID\r
164 );\r
165\r
166VOID\r
167ArmWriteHcr (\r
168 IN UINTN Hcr\r
169 );\r
170\r
171UINTN\r
172ArmReadCurrentEL (\r
173 VOID\r
174 );\r
175\r
176UINT64\r
177PageAttributeToGcdAttribute (\r
178 IN UINT64 PageAttributes\r
179 );\r
180\r
181UINT64\r
182GcdAttributeToPageAttribute (\r
183 IN UINT64 GcdAttributes\r
184 );\r
185\r
d6dc67ba
OM
186UINTN\r
187ArmWriteCptr (\r
188 IN UINT64 Cptr\r
189 );\r
190\r
25402f5d 191#endif // __AARCH64_H__\r