]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/SecCore/SecMain.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / UefiCpuPkg / SecCore / SecMain.h
1 /** @file
2 Master header file for SecCore.
3
4 Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef _SEC_CORE_H_
10 #define _SEC_CORE_H_
11
12 #include <PiPei.h>
13
14 #include <Ppi/SecPlatformInformation2.h>
15 #include <Ppi/TemporaryRamDone.h>
16 #include <Ppi/SecPerformance.h>
17 #include <Ppi/PeiCoreFvLocation.h>
18 #include <Ppi/RepublishSecPpi.h>
19
20 #include <Guid/FirmwarePerformance.h>
21
22 #include <Library/DebugLib.h>
23 #include <Library/PcdLib.h>
24 #include <Library/BaseMemoryLib.h>
25 #include <Library/PlatformSecLib.h>
26 #include <Library/CpuLib.h>
27 #include <Library/UefiCpuLib.h>
28 #include <Library/PeCoffGetEntryPointLib.h>
29 #include <Library/PeCoffExtraActionLib.h>
30 #include <Library/DebugAgentLib.h>
31 #include <Library/CpuExceptionHandlerLib.h>
32 #include <Library/ReportStatusCodeLib.h>
33 #include <Library/PeiServicesTablePointerLib.h>
34 #include <Library/HobLib.h>
35 #include <Library/PeiServicesLib.h>
36
37 #define SEC_IDT_ENTRY_COUNT 34
38
39 typedef struct _SEC_IDT_TABLE {
40 //
41 // Reserved 8 bytes preceding IDT to store EFI_PEI_SERVICES**, since IDT base
42 // address should be 8-byte alignment.
43 // Note: For IA32, only the 4 bytes immediately preceding IDT is used to store
44 // EFI_PEI_SERVICES**
45 //
46 UINT64 PeiService;
47 IA32_IDT_GATE_DESCRIPTOR IdtTable[SEC_IDT_ENTRY_COUNT];
48 } SEC_IDT_TABLE;
49
50 /**
51 TemporaryRamDone() disables the use of Temporary RAM. If present, this service is invoked
52 by the PEI Foundation after the EFI_PEI_PERMANANT_MEMORY_INSTALLED_PPI is installed.
53
54 @retval EFI_SUCCESS Use of Temporary RAM was disabled.
55 @retval EFI_INVALID_PARAMETER Temporary RAM could not be disabled.
56
57 **/
58 EFI_STATUS
59 EFIAPI
60 SecTemporaryRamDone (
61 VOID
62 );
63
64 /**
65 Entry point to the C language phase of SEC. After the SEC assembly
66 code has initialized some temporary memory and set up the stack,
67 the control is transferred to this function.
68
69 @param SizeOfRam Size of the temporary memory available for use.
70 @param TempRamBase Base address of temporary ram
71 @param BootFirmwareVolume Base address of the Boot Firmware Volume.
72 **/
73 VOID
74 NORETURN
75 EFIAPI
76 SecStartup (
77 IN UINT32 SizeOfRam,
78 IN UINT32 TempRamBase,
79 IN VOID *BootFirmwareVolume
80 );
81
82 /**
83 Find and return Pei Core entry point.
84
85 It also find SEC and PEI Core file debug information. It will report them if
86 remote debug is enabled.
87
88 @param SecCoreFirmwareVolumePtr Point to the firmware volume for finding SecCore.
89 @param PeiCoreFirmwareVolumePtr Point to the firmware volume for finding PeiCore.
90 @param PeiCoreEntryPoint The entry point of the PEI core.
91
92 **/
93 VOID
94 EFIAPI
95 FindAndReportEntryPoints (
96 IN EFI_FIRMWARE_VOLUME_HEADER *SecCoreFirmwareVolumePtr,
97 IN EFI_FIRMWARE_VOLUME_HEADER *PeiCoreFirmwareVolumePtr,
98 OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint
99 );
100
101 /**
102 Auto-generated function that calls the library constructors for all of the module's
103 dependent libraries. This function must be called by the SEC Core once a stack has
104 been established.
105
106 **/
107 VOID
108 EFIAPI
109 ProcessLibraryConstructorList (
110 VOID
111 );
112
113 /**
114 Implementation of the PlatformInformation service in EFI_SEC_PLATFORM_INFORMATION_PPI.
115
116 @param PeiServices Pointer to the PEI Services Table.
117 @param StructureSize Pointer to the variable describing size of the input buffer.
118 @param PlatformInformationRecord Pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD.
119
120 @retval EFI_SUCCESS The data was successfully returned.
121 @retval EFI_BUFFER_TOO_SMALL The buffer was too small.
122
123 **/
124 EFI_STATUS
125 EFIAPI
126 SecPlatformInformationBist (
127 IN CONST EFI_PEI_SERVICES **PeiServices,
128 IN OUT UINT64 *StructureSize,
129 OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
130 );
131
132 /**
133 Implementation of the PlatformInformation2 service in EFI_SEC_PLATFORM_INFORMATION2_PPI.
134
135 @param PeiServices The pointer to the PEI Services Table.
136 @param StructureSize The pointer to the variable describing size of the input buffer.
137 @param PlatformInformationRecord2 The pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD2.
138
139 @retval EFI_SUCCESS The data was successfully returned.
140 @retval EFI_BUFFER_TOO_SMALL The buffer was too small. The current buffer size needed to
141 hold the record is returned in StructureSize.
142
143 **/
144 EFI_STATUS
145 EFIAPI
146 SecPlatformInformation2Bist (
147 IN CONST EFI_PEI_SERVICES **PeiServices,
148 IN OUT UINT64 *StructureSize,
149 OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2
150 );
151
152 /**
153 Republish SecPlatformInformationPpi/SecPlatformInformation2Ppi.
154
155 **/
156 VOID
157 RepublishSecPlatformInformationPpi (
158 VOID
159 );
160
161 /**
162 Entry point of the notification callback function itself within the PEIM.
163 It is to get SEC performance data and build HOB to convey the SEC performance
164 data to DXE phase.
165
166 @param PeiServices Indirect reference to the PEI Services Table.
167 @param NotifyDescriptor Address of the notification descriptor data structure.
168 @param Ppi Address of the PPI that was installed.
169
170 @return Status of the notification.
171 The status code returned from this function is ignored.
172 **/
173 EFI_STATUS
174 EFIAPI
175 SecPerformancePpiCallBack (
176 IN EFI_PEI_SERVICES **PeiServices,
177 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
178 IN VOID *Ppi
179 );
180
181 #endif