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