3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
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
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.
16 #ifndef __CPU_DXE_ARM_EXCEPTION_H__
17 #define __CPU_DXE_ARM_EXCEPTION_H__
21 #include <Library/ArmLib.h>
22 #include <Library/ArmMmuLib.h>
23 #include <Library/BaseMemoryLib.h>
24 #include <Library/DebugLib.h>
25 #include <Library/PcdLib.h>
26 #include <Library/UefiBootServicesTableLib.h>
27 #include <Library/DxeServicesTableLib.h>
28 #include <Library/CacheMaintenanceLib.h>
29 #include <Library/PeCoffGetEntryPointLib.h>
30 #include <Library/UefiLib.h>
31 #include <Library/CpuLib.h>
32 #include <Library/DefaultExceptionHandlerLib.h>
33 #include <Library/DebugLib.h>
35 #include <Guid/DebugImageInfoTable.h>
36 #include <Protocol/Cpu.h>
37 #include <Protocol/DebugSupport.h>
38 #include <Protocol/LoadedImage.h>
40 extern BOOLEAN mIsFlushingGCD
;
43 This function registers and enables the handler specified by InterruptHandler for a processor
44 interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the
45 handler for the processor interrupt or exception type specified by InterruptType is uninstalled.
46 The installed handler is called once for each processor interrupt or exception.
48 @param InterruptType A pointer to the processor's current interrupt state. Set to TRUE if interrupts
49 are enabled and FALSE if interrupts are disabled.
50 @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called
51 when a processor interrupt occurs. If this parameter is NULL, then the handler
54 @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.
55 @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was
57 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not
59 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.
63 RegisterInterruptHandler (
64 IN EFI_EXCEPTION_TYPE InterruptType
,
65 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
70 This function registers and enables the handler specified by InterruptHandler for a processor
71 interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the
72 handler for the processor interrupt or exception type specified by InterruptType is uninstalled.
73 The installed handler is called once for each processor interrupt or exception.
75 @param InterruptType A pointer to the processor's current interrupt state. Set to TRUE if interrupts
76 are enabled and FALSE if interrupts are disabled.
77 @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called
78 when a processor interrupt occurs. If this parameter is NULL, then the handler
81 @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.
82 @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was
84 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not
86 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.
90 RegisterDebuggerInterruptHandler (
91 IN EFI_EXCEPTION_TYPE InterruptType
,
92 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
98 CpuSetMemoryAttributes (
99 IN EFI_CPU_ARCH_PROTOCOL
*This
,
100 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
106 InitializeExceptions (
107 IN EFI_CPU_ARCH_PROTOCOL
*Cpu
112 IN EFI_CPU_ARCH_PROTOCOL
*CpuProtocol
116 * Publish ARM Processor Data table in UEFI SYSTEM Table.
117 * @param HobStart Pointer to the beginning of the HOB List from PEI.
119 * Description : This function iterates through HOB list and finds ARM processor Table Entry HOB.
120 * If the ARM processor Table Entry HOB is found, the HOB data is copied to run-time memory
121 * and a pointer is assigned to it in ARM processor table. Then the ARM processor table is
122 * installed in EFI configuration table.
126 PublishArmProcessorTable(
130 // The ARM Attributes might be defined on 64-bit (case of the long format description table)
132 EfiAttributeToArmAttribute (
133 IN UINT64 EfiAttributes
138 IN OUT UINTN
*BaseAddress
,
139 OUT UINTN
*RegionLength
,
140 OUT UINTN
*RegionAttributes
144 GetRootTranslationTableInfo (
146 OUT UINTN
*TableLevel
,
147 OUT UINTN
*TableEntryCount
151 SetGcdMemorySpaceAttributes (
152 IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*MemorySpaceMap
,
153 IN UINTN NumberOfDescriptors
,
154 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
159 #endif // __CPU_DXE_ARM_EXCEPTION_H__