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