]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFsp2Pkg/FspSecCore/SecMain.h
MdeModulePkg: Fix constructor invocation ordering
[mirror_edk2.git] / IntelFsp2Pkg / FspSecCore / SecMain.h
CommitLineData
cf1d4549
JY
1/** @file\r
2\r
520a1e60 3 Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>\r
9672cd30 4 SPDX-License-Identifier: BSD-2-Clause-Patent\r
cf1d4549
JY
5\r
6**/\r
7\r
8#ifndef _SEC_CORE_H_\r
9#define _SEC_CORE_H_\r
10\r
11\r
12#include <PiPei.h>\r
13#include <Ppi/TemporaryRamSupport.h>\r
14\r
15#include <Library/BaseLib.h>\r
16#include <Library/IoLib.h>\r
17#include <Library/DebugLib.h>\r
18#include <Library/PcdLib.h>\r
19#include <Library/BaseMemoryLib.h>\r
20#include <Library/PciCf8Lib.h>\r
21#include <Library/SerialPortLib.h>\r
22#include <Library/FspSwitchStackLib.h>\r
23#include <Library/FspCommonLib.h>\r
0060e0a6 24#include <Library/UefiCpuLib.h>\r
cf1d4549
JY
25#include <FspEas.h>\r
26\r
cf1d4549
JY
27typedef VOID (*PEI_CORE_ENTRY) ( \\r
28 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, \\r
29 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList \\r
30);\r
31\r
32typedef struct _SEC_IDT_TABLE {\r
520a1e60
CC
33 //\r
34 // Reserved 8 bytes preceding IDT to store EFI_PEI_SERVICES**, since IDT base\r
35 // address should be 8-byte alignment.\r
36 // Note: For IA32, only the 4 bytes immediately preceding IDT is used to store\r
37 // EFI_PEI_SERVICES**\r
38 //\r
39 UINT64 PeiService;\r
b1cc6f67 40 UINT64 IdtTable[FixedPcdGet8 (PcdFspMaxInterruptSupported)];\r
cf1d4549
JY
41} SEC_IDT_TABLE;\r
42\r
43/**\r
44 Switch the stack in the temporary memory to the one in the permanent memory.\r
45\r
46 This function must be invoked after the memory migration immediately. The relative\r
47 position of the stack in the temporary and permanent memory is same.\r
48\r
49 @param[in] TemporaryMemoryBase Base address of the temporary memory.\r
50 @param[in] PermenentMemoryBase Base address of the permanent memory.\r
51**/\r
52VOID\r
53EFIAPI\r
54SecSwitchStack (\r
55 IN UINT32 TemporaryMemoryBase,\r
56 IN UINT32 PermenentMemoryBase\r
57 );\r
58\r
59/**\r
60 This service of the TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into\r
61 permanent memory.\r
62\r
63 @param[in] PeiServices Pointer to the PEI Services Table.\r
64 @param[in] TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the\r
65 Temporary RAM contents.\r
66 @param[in] PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the\r
67 Temporary RAM contents.\r
68 @param[in] CopySize Amount of memory to migrate from temporary to permanent memory.\r
69\r
70 @retval EFI_SUCCESS The data was successfully returned.\r
71 @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when\r
72 TemporaryMemoryBase > PermanentMemoryBase.\r
73\r
74**/\r
75EFI_STATUS\r
76EFIAPI\r
77SecTemporaryRamSupport (\r
78 IN CONST EFI_PEI_SERVICES **PeiServices,\r
79 IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,\r
80 IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,\r
81 IN UINTN CopySize\r
82 );\r
83\r
cf1d4549
JY
84\r
85/**\r
86\r
87 Entry point to the C language phase of SEC. After the SEC assembly\r
88 code has initialized some temporary memory and set up the stack,\r
89 the control is transferred to this function.\r
90\r
91\r
92 @param[in] SizeOfRam Size of the temporary memory available for use.\r
058dcbf2 93 @param[in] TempRamBase Base address of temporary ram\r
cf1d4549
JY
94 @param[in] BootFirmwareVolume Base address of the Boot Firmware Volume.\r
95 @param[in] PeiCore PeiCore entry point.\r
96 @param[in] BootLoaderStack BootLoader stack.\r
97 @param[in] ApiIdx the index of API.\r
98\r
99 @return This function never returns.\r
100\r
101**/\r
102VOID\r
103EFIAPI\r
104SecStartup (\r
105 IN UINT32 SizeOfRam,\r
106 IN UINT32 TempRamBase,\r
107 IN VOID *BootFirmwareVolume,\r
108 IN PEI_CORE_ENTRY PeiCore,\r
109 IN UINT32 BootLoaderStack,\r
110 IN UINT32 ApiIdx\r
111 );\r
112\r
113/**\r
114 Autogenerated function that calls the library constructors for all of the module's\r
115 dependent libraries. This function must be called by the SEC Core once a stack has\r
116 been established.\r
117\r
118**/\r
119VOID\r
120EFIAPI\r
121ProcessLibraryConstructorList (\r
122 VOID\r
123 );\r
124\r
12a0a80b
CC
125/**\r
126\r
127 Return value of esp.\r
128\r
129 @return value of esp.\r
130\r
131**/\r
132UINT32\r
133EFIAPI\r
134AsmReadEsp (\r
135 VOID\r
136 );\r
137\r
cf1d4549 138#endif\r