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