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