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