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