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