]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFsp2Pkg/FspSecCore/SecMain.h
IntelFsp2Pkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / IntelFsp2Pkg / FspSecCore / SecMain.h
CommitLineData
cf1d4549
JY
1/** @file\r
2\r
b1cc6f67 3 Copyright (c) 2014 - 2018, 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
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
29);\r
30\r
31typedef struct _SEC_IDT_TABLE {\r
32 EFI_PEI_SERVICES *PeiService;\r
b1cc6f67 33 UINT64 IdtTable[FixedPcdGet8 (PcdFspMaxInterruptSupported)];\r
cf1d4549
JY
34} SEC_IDT_TABLE;\r
35\r
36/**\r
37 Switch the stack in the temporary memory to the one in the permanent memory.\r
38\r
39 This function must be invoked after the memory migration immediately. The relative\r
40 position of the stack in the temporary and permanent memory is same.\r
41\r
42 @param[in] TemporaryMemoryBase Base address of the temporary memory.\r
43 @param[in] PermenentMemoryBase Base address of the permanent memory.\r
44**/\r
45VOID\r
46EFIAPI\r
47SecSwitchStack (\r
48 IN UINT32 TemporaryMemoryBase,\r
49 IN UINT32 PermenentMemoryBase\r
50 );\r
51\r
52/**\r
53 This service of the TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into\r
54 permanent memory.\r
55\r
56 @param[in] PeiServices Pointer to the PEI Services Table.\r
57 @param[in] TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the\r
58 Temporary RAM contents.\r
59 @param[in] PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the\r
60 Temporary RAM contents.\r
61 @param[in] CopySize Amount of memory to migrate from temporary to permanent memory.\r
62\r
63 @retval EFI_SUCCESS The data was successfully returned.\r
64 @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when\r
65 TemporaryMemoryBase > PermanentMemoryBase.\r
66\r
67**/\r
68EFI_STATUS\r
69EFIAPI\r
70SecTemporaryRamSupport (\r
71 IN CONST EFI_PEI_SERVICES **PeiServices,\r
72 IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,\r
73 IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,\r
74 IN UINTN CopySize\r
75 );\r
76\r
77/**\r
78 Initializes floating point units for requirement of UEFI specification.\r
79\r
80 This function initializes floating-point control word to 0x027F (all exceptions\r
81 masked,double-precision, round-to-nearest) and multimedia-extensions control word\r
82 (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to zero\r
83 for masked underflow).\r
84\r
85**/\r
86VOID\r
87EFIAPI\r
88InitializeFloatingPointUnits (\r
89 VOID\r
90 );\r
91\r
92/**\r
93\r
94 Entry point to the C language phase of SEC. After the SEC assembly\r
95 code has initialized some temporary memory and set up the stack,\r
96 the control is transferred to this function.\r
97\r
98\r
99 @param[in] SizeOfRam Size of the temporary memory available for use.\r
058dcbf2 100 @param[in] TempRamBase Base address of temporary ram\r
cf1d4549
JY
101 @param[in] BootFirmwareVolume Base address of the Boot Firmware Volume.\r
102 @param[in] PeiCore PeiCore entry point.\r
103 @param[in] BootLoaderStack BootLoader stack.\r
104 @param[in] ApiIdx the index of API.\r
105\r
106 @return This function never returns.\r
107\r
108**/\r
109VOID\r
110EFIAPI\r
111SecStartup (\r
112 IN UINT32 SizeOfRam,\r
113 IN UINT32 TempRamBase,\r
114 IN VOID *BootFirmwareVolume,\r
115 IN PEI_CORE_ENTRY PeiCore,\r
116 IN UINT32 BootLoaderStack,\r
117 IN UINT32 ApiIdx\r
118 );\r
119\r
120/**\r
121 Autogenerated function that calls the library constructors for all of the module's\r
122 dependent libraries. This function must be called by the SEC Core once a stack has\r
123 been established.\r
124\r
125**/\r
126VOID\r
127EFIAPI\r
128ProcessLibraryConstructorList (\r
129 VOID\r
130 );\r
131\r
12a0a80b
CC
132/**\r
133\r
134 Return value of esp.\r
135\r
136 @return value of esp.\r
137\r
138**/\r
139UINT32\r
140EFIAPI\r
141AsmReadEsp (\r
142 VOID\r
143 );\r
144\r
cf1d4549 145#endif\r