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