]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Drivers/CpuDxe/CpuDxe.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[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_H_
11 #define CPU_DXE_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 This function registers and enables the handler specified by InterruptHandler for a processor
64 interrupt or exception type specified by InterruptType. If InterruptHandler is NULL, then the
65 handler for the processor interrupt or exception type specified by InterruptType is uninstalled.
66 The installed handler is called once for each processor interrupt or exception.
67
68 @param InterruptType A pointer to the processor's current interrupt state. Set to TRUE if interrupts
69 are enabled and FALSE if interrupts are disabled.
70 @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER that is called
71 when a processor interrupt occurs. If this parameter is NULL, then the handler
72 will be uninstalled.
73
74 @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.
75 @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was
76 previously installed.
77 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not
78 previously installed.
79 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.
80
81 **/
82 EFI_STATUS
83 RegisterDebuggerInterruptHandler (
84 IN EFI_EXCEPTION_TYPE InterruptType,
85 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
86 );
87
88 EFI_STATUS
89 EFIAPI
90 CpuSetMemoryAttributes (
91 IN EFI_CPU_ARCH_PROTOCOL *This,
92 IN EFI_PHYSICAL_ADDRESS BaseAddress,
93 IN UINT64 Length,
94 IN UINT64 Attributes
95 );
96
97 EFI_STATUS
98 InitializeExceptions (
99 IN EFI_CPU_ARCH_PROTOCOL *Cpu
100 );
101
102 EFI_STATUS
103 SyncCacheConfig (
104 IN EFI_CPU_ARCH_PROTOCOL *CpuProtocol
105 );
106
107 // The ARM Attributes might be defined on 64-bit (case of the long format description table)
108 UINT64
109 EfiAttributeToArmAttribute (
110 IN UINT64 EfiAttributes
111 );
112
113 EFI_STATUS
114 GetMemoryRegion (
115 IN OUT UINTN *BaseAddress,
116 OUT UINTN *RegionLength,
117 OUT UINTN *RegionAttributes
118 );
119
120 EFI_STATUS
121 SetGcdMemorySpaceAttributes (
122 IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap,
123 IN UINTN NumberOfDescriptors,
124 IN EFI_PHYSICAL_ADDRESS BaseAddress,
125 IN UINT64 Length,
126 IN UINT64 Attributes
127 );
128
129 #endif // CPU_DXE_H_