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 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | **/
|
---|
9 |
|
---|
10 | #ifndef CPU_DXE_H_
|
---|
11 | #define CPU_DXE_H_
|
---|
12 |
|
---|
13 | #include <Uefi.h>
|
---|
14 |
|
---|
15 | #include <Library/ArmLib.h>
|
---|
16 | #include <Library/ArmMmuLib.h>
|
---|
17 | #include <Library/BaseMemoryLib.h>
|
---|
18 | #include <Library/DebugLib.h>
|
---|
19 | #include <Library/PcdLib.h>
|
---|
20 | #include <Library/UefiBootServicesTableLib.h>
|
---|
21 | #include <Library/DxeServicesTableLib.h>
|
---|
22 | #include <Library/CacheMaintenanceLib.h>
|
---|
23 | #include <Library/PeCoffGetEntryPointLib.h>
|
---|
24 | #include <Library/UefiLib.h>
|
---|
25 | #include <Library/CpuLib.h>
|
---|
26 | #include <Library/DefaultExceptionHandlerLib.h>
|
---|
27 | #include <Library/DebugLib.h>
|
---|
28 |
|
---|
29 | #include <Guid/DebugImageInfoTable.h>
|
---|
30 | #include <Protocol/Cpu.h>
|
---|
31 | #include <Protocol/DebugSupport.h>
|
---|
32 | #include <Protocol/LoadedImage.h>
|
---|
33 | #include <Protocol/MemoryAttribute.h>
|
---|
34 |
|
---|
35 | extern BOOLEAN mIsFlushingGCD;
|
---|
36 |
|
---|
37 | extern EFI_MEMORY_ATTRIBUTE_PROTOCOL mMemoryAttribute;
|
---|
38 |
|
---|
39 | /**
|
---|
40 | This function registers and enables the handler specified by InterruptHandler for a processor
|
---|
41 | interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the
|
---|
42 | handler for the processor interrupt or exception type specified by InterruptType is uninstalled.
|
---|
43 | The installed handler is called once for each processor interrupt or exception.
|
---|
44 |
|
---|
45 | @param InterruptType A pointer to the processor's current interrupt state. Set to TRUE if interrupts
|
---|
46 | are enabled and FALSE if interrupts are disabled.
|
---|
47 | @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called
|
---|
48 | when a processor interrupt occurs. If this parameter is NULL, then the handler
|
---|
49 | will be uninstalled.
|
---|
50 |
|
---|
51 | @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.
|
---|
52 | @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was
|
---|
53 | previously installed.
|
---|
54 | @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not
|
---|
55 | previously installed.
|
---|
56 | @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.
|
---|
57 |
|
---|
58 | **/
|
---|
59 | EFI_STATUS
|
---|
60 | RegisterInterruptHandler (
|
---|
61 | IN EFI_EXCEPTION_TYPE InterruptType,
|
---|
62 | IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
|
---|
63 | );
|
---|
64 |
|
---|
65 | /**
|
---|
66 | This function registers and enables the handler specified by InterruptHandler for a processor
|
---|
67 | interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the
|
---|
68 | handler for the processor interrupt or exception type specified by InterruptType is uninstalled.
|
---|
69 | The installed handler is called once for each processor interrupt or exception.
|
---|
70 |
|
---|
71 | @param InterruptType A pointer to the processor's current interrupt state. Set to TRUE if interrupts
|
---|
72 | are enabled and FALSE if interrupts are disabled.
|
---|
73 | @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called
|
---|
74 | when a processor interrupt occurs. If this parameter is NULL, then the handler
|
---|
75 | will be uninstalled.
|
---|
76 |
|
---|
77 | @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.
|
---|
78 | @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was
|
---|
79 | previously installed.
|
---|
80 | @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not
|
---|
81 | previously installed.
|
---|
82 | @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.
|
---|
83 |
|
---|
84 | **/
|
---|
85 | EFI_STATUS
|
---|
86 | RegisterDebuggerInterruptHandler (
|
---|
87 | IN EFI_EXCEPTION_TYPE InterruptType,
|
---|
88 | IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
|
---|
89 | );
|
---|
90 |
|
---|
91 | EFI_STATUS
|
---|
92 | EFIAPI
|
---|
93 | CpuSetMemoryAttributes (
|
---|
94 | IN EFI_CPU_ARCH_PROTOCOL *This,
|
---|
95 | IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
---|
96 | IN UINT64 Length,
|
---|
97 | IN UINT64 Attributes
|
---|
98 | );
|
---|
99 |
|
---|
100 | EFI_STATUS
|
---|
101 | InitializeExceptions (
|
---|
102 | IN EFI_CPU_ARCH_PROTOCOL *Cpu
|
---|
103 | );
|
---|
104 |
|
---|
105 | EFI_STATUS
|
---|
106 | SyncCacheConfig (
|
---|
107 | IN EFI_CPU_ARCH_PROTOCOL *CpuProtocol
|
---|
108 | );
|
---|
109 |
|
---|
110 | // The ARM Attributes might be defined on 64-bit (case of the long format description table)
|
---|
111 | UINT64
|
---|
112 | EfiAttributeToArmAttribute (
|
---|
113 | IN UINT64 EfiAttributes
|
---|
114 | );
|
---|
115 |
|
---|
116 | EFI_STATUS
|
---|
117 | GetMemoryRegion (
|
---|
118 | IN OUT UINTN *BaseAddress,
|
---|
119 | OUT UINTN *RegionLength,
|
---|
120 | OUT UINTN *RegionAttributes
|
---|
121 | );
|
---|
122 |
|
---|
123 | EFI_STATUS
|
---|
124 | SetGcdMemorySpaceAttributes (
|
---|
125 | IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap,
|
---|
126 | IN UINTN NumberOfDescriptors,
|
---|
127 | IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
---|
128 | IN UINT64 Length,
|
---|
129 | IN UINT64 Attributes
|
---|
130 | );
|
---|
131 |
|
---|
132 | /**
|
---|
133 | Convert an arch specific set of page attributes into a mask
|
---|
134 | of EFI_MEMORY_xx constants.
|
---|
135 |
|
---|
136 | @param PageAttributes The set of page attributes.
|
---|
137 |
|
---|
138 | @retval The mask of EFI_MEMORY_xx constants.
|
---|
139 |
|
---|
140 | **/
|
---|
141 | UINT64
|
---|
142 | RegionAttributeToGcdAttribute (
|
---|
143 | IN UINTN PageAttributes
|
---|
144 | );
|
---|
145 |
|
---|
146 | #endif // CPU_DXE_H_
|
---|