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