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