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