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