]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Drivers/CpuDxe/CpuDxe.h
ArmPkg: update RVCT assembly functions to use new RVCT_ASM_EXPORT macro
[mirror_edk2.git] / ArmPkg / Drivers / CpuDxe / CpuDxe.h
CommitLineData
2ef2b01e
A
1/** @file\r
2\r
d6ebcab7 3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
591fb378 4 Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>\r
2ef2b01e 5\r
d6ebcab7 6 This program and the accompanying materials\r
2ef2b01e
A
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 __CPU_DXE_ARM_EXCEPTION_H__\r
17#define __CPU_DXE_ARM_EXCEPTION_H__\r
18\r
19#include <Uefi.h>\r
20\r
21#include <Library/ArmLib.h>\r
22#include <Library/BaseMemoryLib.h>\r
2ef2b01e
A
23#include <Library/DebugLib.h>\r
24#include <Library/PcdLib.h>\r
25#include <Library/UefiBootServicesTableLib.h>\r
f659880b
A
26#include <Library/DxeServicesTableLib.h>\r
27#include <Library/CacheMaintenanceLib.h>\r
28#include <Library/PeCoffGetEntryPointLib.h>\r
29#include <Library/UefiLib.h>\r
30#include <Library/CpuLib.h>\r
6f72e28d 31#include <Library/DefaultExceptionHandlerLib.h>\r
eeb78924 32#include <Library/DebugLib.h>\r
2ef2b01e 33\r
f659880b 34#include <Guid/DebugImageInfoTable.h>\r
2ef2b01e
A
35#include <Protocol/Cpu.h>\r
36#include <Protocol/DebugSupport.h>\r
37#include <Protocol/DebugSupportPeriodicCallback.h>\r
f659880b
A
38#include <Protocol/VirtualUncachedPages.h>\r
39#include <Protocol/LoadedImage.h>\r
40\r
41\r
42#define EFI_MEMORY_CACHETYPE_MASK (EFI_MEMORY_UC | \\r
43 EFI_MEMORY_WC | \\r
44 EFI_MEMORY_WT | \\r
45 EFI_MEMORY_WB | \\r
46 EFI_MEMORY_UCE \\r
47 )\r
2ef2b01e
A
48\r
49\r
50/**\r
3402aac7
RC
51 This function registers and enables the handler specified by InterruptHandler for a processor\r
52 interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the\r
53 handler for the processor interrupt or exception type specified by InterruptType is uninstalled.\r
2ef2b01e
A
54 The installed handler is called once for each processor interrupt or exception.\r
55\r
56 @param InterruptType A pointer to the processor's current interrupt state. Set to TRUE if interrupts\r
57 are enabled and FALSE if interrupts are disabled.\r
58 @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called\r
59 when a processor interrupt occurs. If this parameter is NULL, then the handler\r
60 will be uninstalled.\r
61\r
62 @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.\r
63 @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was\r
64 previously installed.\r
65 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not\r
66 previously installed.\r
67 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.\r
68\r
69**/\r
70EFI_STATUS\r
71RegisterInterruptHandler (\r
72 IN EFI_EXCEPTION_TYPE InterruptType,\r
73 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler\r
74 );\r
75\r
76\r
77/**\r
3402aac7
RC
78 This function registers and enables the handler specified by InterruptHandler for a processor\r
79 interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the\r
80 handler for the processor interrupt or exception type specified by InterruptType is uninstalled.\r
2ef2b01e
A
81 The installed handler is called once for each processor interrupt or exception.\r
82\r
83 @param InterruptType A pointer to the processor's current interrupt state. Set to TRUE if interrupts\r
84 are enabled and FALSE if interrupts are disabled.\r
85 @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called\r
86 when a processor interrupt occurs. If this parameter is NULL, then the handler\r
87 will be uninstalled.\r
88\r
89 @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.\r
90 @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was\r
91 previously installed.\r
92 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not\r
93 previously installed.\r
94 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.\r
95\r
96**/\r
97EFI_STATUS\r
98RegisterDebuggerInterruptHandler (\r
99 IN EFI_EXCEPTION_TYPE InterruptType,\r
100 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler\r
101 );\r
102\r
103\r
f659880b
A
104EFI_STATUS\r
105EFIAPI\r
106CpuSetMemoryAttributes (\r
107 IN EFI_CPU_ARCH_PROTOCOL *This,\r
108 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
109 IN UINT64 Length,\r
110 IN UINT64 Attributes\r
111 );\r
112\r
2ef2b01e
A
113EFI_STATUS\r
114InitializeExceptions (\r
2ac288f9 115 IN EFI_CPU_ARCH_PROTOCOL *Cpu\r
116 );\r
2ef2b01e 117\r
f659880b
A
118EFI_STATUS\r
119SyncCacheConfig (\r
120 IN EFI_CPU_ARCH_PROTOCOL *CpuProtocol\r
121 );\r
122\r
3402aac7 123EFI_STATUS\r
f659880b
A
124ConvertSectionToPages (\r
125 IN EFI_PHYSICAL_ADDRESS BaseAddress\r
126 );\r
127\r
44788bae 128/**\r
129 * Publish ARM Processor Data table in UEFI SYSTEM Table.\r
130 * @param HobStart Pointer to the beginning of the HOB List from PEI.\r
131 *\r
132 * Description : This function iterates through HOB list and finds ARM processor Table Entry HOB.\r
133 * If the ARM processor Table Entry HOB is found, the HOB data is copied to run-time memory\r
134 * and a pointer is assigned to it in ARM processor table. Then the ARM processor table is\r
135 * installed in EFI configuration table.\r
136**/\r
137VOID\r
138EFIAPI\r
139PublishArmProcessorTable(\r
140 VOID\r
141 );\r
f659880b 142\r
591fb378
OM
143EFI_STATUS\r
144SetMemoryAttributes (\r
145 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
146 IN UINT64 Length,\r
147 IN UINT64 Attributes,\r
148 IN EFI_PHYSICAL_ADDRESS VirtualMask\r
149 );\r
150\r
2e969d2e
OM
151// The ARM Attributes might be defined on 64-bit (case of the long format description table)\r
152UINT64\r
153EfiAttributeToArmAttribute (\r
154 IN UINT64 EfiAttributes\r
155 );\r
156\r
157EFI_STATUS\r
158GetMemoryRegion (\r
159 IN OUT UINTN *BaseAddress,\r
160 OUT UINTN *RegionLength,\r
161 OUT UINTN *RegionAttributes\r
162 );\r
163\r
25402f5d
HL
164VOID\r
165GetRootTranslationTableInfo (\r
166 IN UINTN T0SZ,\r
167 OUT UINTN *TableLevel,\r
168 OUT UINTN *TableEntryCount\r
169 );\r
170\r
591fb378
OM
171EFI_STATUS\r
172SetGcdMemorySpaceAttributes (\r
25402f5d 173 IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap,\r
591fb378
OM
174 IN UINTN NumberOfDescriptors,\r
175 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
176 IN UINT64 Length,\r
177 IN UINT64 Attributes\r
178 );\r
179\r
f659880b
A
180extern VIRTUAL_UNCACHED_PAGES_PROTOCOL gVirtualUncachedPages;\r
181\r
2ef2b01e 182#endif // __CPU_DXE_ARM_EXCEPTION_H__\r