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/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>
34 #include <Guid/DebugImageInfoTable.h>
35 #include <Protocol/Cpu.h>
36 #include <Protocol/DebugSupport.h>
37 #include <Protocol/DebugSupportPeriodicCallback.h>
38 #include <Protocol/VirtualUncachedPages.h>
39 #include <Protocol/LoadedImage.h>
42 #define EFI_MEMORY_CACHETYPE_MASK (EFI_MEMORY_UC | \
51 This function registers and enables the handler specified by InterruptHandler for a processor
52 interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the
53 handler for the processor interrupt or exception type specified by InterruptType is uninstalled.
54 The installed handler is called once for each processor interrupt or exception.
56 @param InterruptType A pointer to the processor's current interrupt state. Set to TRUE if interrupts
57 are enabled and FALSE if interrupts are disabled.
58 @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called
59 when a processor interrupt occurs. If this parameter is NULL, then the handler
62 @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.
63 @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was
65 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not
67 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.
71 RegisterInterruptHandler (
72 IN EFI_EXCEPTION_TYPE InterruptType
,
73 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
78 This function registers and enables the handler specified by InterruptHandler for a processor
79 interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the
80 handler for the processor interrupt or exception type specified by InterruptType is uninstalled.
81 The installed handler is called once for each processor interrupt or exception.
83 @param InterruptType A pointer to the processor's current interrupt state. Set to TRUE if interrupts
84 are enabled and FALSE if interrupts are disabled.
85 @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called
86 when a processor interrupt occurs. If this parameter is NULL, then the handler
89 @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.
90 @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was
92 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not
94 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.
98 RegisterDebuggerInterruptHandler (
99 IN EFI_EXCEPTION_TYPE InterruptType
,
100 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
106 CpuSetMemoryAttributes (
107 IN EFI_CPU_ARCH_PROTOCOL
*This
,
108 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
114 InitializeExceptions (
115 IN EFI_CPU_ARCH_PROTOCOL
*Cpu
120 IN EFI_CPU_ARCH_PROTOCOL
*CpuProtocol
124 ConvertSectionToPages (
125 IN EFI_PHYSICAL_ADDRESS BaseAddress
129 * Publish ARM Processor Data table in UEFI SYSTEM Table.
130 * @param HobStart Pointer to the beginning of the HOB List from PEI.
132 * Description : This function iterates through HOB list and finds ARM processor Table Entry HOB.
133 * If the ARM processor Table Entry HOB is found, the HOB data is copied to run-time memory
134 * and a pointer is assigned to it in ARM processor table. Then the ARM processor table is
135 * installed in EFI configuration table.
139 PublishArmProcessorTable(
144 SetMemoryAttributes (
145 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
147 IN UINT64 Attributes
,
148 IN EFI_PHYSICAL_ADDRESS VirtualMask
151 // The ARM Attributes might be defined on 64-bit (case of the long format description table)
153 EfiAttributeToArmAttribute (
154 IN UINT64 EfiAttributes
159 IN OUT UINTN
*BaseAddress
,
160 OUT UINTN
*RegionLength
,
161 OUT UINTN
*RegionAttributes
165 GetRootTranslationTableInfo (
167 OUT UINTN
*TableLevel
,
168 OUT UINTN
*TableEntryCount
172 SetGcdMemorySpaceAttributes (
173 IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*MemorySpaceMap
,
174 IN UINTN NumberOfDescriptors
,
175 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
180 extern VIRTUAL_UNCACHED_PAGES_PROTOCOL gVirtualUncachedPages
;
182 #endif // __CPU_DXE_ARM_EXCEPTION_H__