3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
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>
29 #include <Guid/DebugImageInfoTable.h>
30 #include <Protocol/Cpu.h>
31 #include <Protocol/DebugSupport.h>
32 #include <Protocol/LoadedImage.h>
34 extern BOOLEAN mIsFlushingGCD
;
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.
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
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
51 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not
53 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.
57 RegisterInterruptHandler (
58 IN EFI_EXCEPTION_TYPE InterruptType
,
59 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
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.
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
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
78 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not
80 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.
84 RegisterDebuggerInterruptHandler (
85 IN EFI_EXCEPTION_TYPE InterruptType
,
86 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
92 CpuSetMemoryAttributes (
93 IN EFI_CPU_ARCH_PROTOCOL
*This
,
94 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
100 InitializeExceptions (
101 IN EFI_CPU_ARCH_PROTOCOL
*Cpu
106 IN EFI_CPU_ARCH_PROTOCOL
*CpuProtocol
110 * Publish ARM Processor Data table in UEFI SYSTEM Table.
111 * @param HobStart Pointer to the beginning of the HOB List from PEI.
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.
120 PublishArmProcessorTable(
124 // The ARM Attributes might be defined on 64-bit (case of the long format description table)
126 EfiAttributeToArmAttribute (
127 IN UINT64 EfiAttributes
132 IN OUT UINTN
*BaseAddress
,
133 OUT UINTN
*RegionLength
,
134 OUT UINTN
*RegionAttributes
138 SetGcdMemorySpaceAttributes (
139 IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*MemorySpaceMap
,
140 IN UINTN NumberOfDescriptors
,
141 IN EFI_PHYSICAL_ADDRESS BaseAddress
,