]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFsp2Pkg/FspSecCore/SecMain.h
IntelFsp2Pkg: FSP should not override IDT
[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
cf1d4549
JY
4 This program and the accompanying materials\r
5 are licensed and made available under the terms and conditions of the BSD License\r
6 which accompanies this distribution. The full text of the license may be found at\r
7 http://opensource.org/licenses/bsd-license.php.\r
8\r
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12**/\r
13\r
14#ifndef _SEC_CORE_H_\r
15#define _SEC_CORE_H_\r
16\r
17\r
18#include <PiPei.h>\r
19#include <Ppi/TemporaryRamSupport.h>\r
20\r
21#include <Library/BaseLib.h>\r
22#include <Library/IoLib.h>\r
23#include <Library/DebugLib.h>\r
24#include <Library/PcdLib.h>\r
25#include <Library/BaseMemoryLib.h>\r
26#include <Library/PciCf8Lib.h>\r
27#include <Library/SerialPortLib.h>\r
28#include <Library/FspSwitchStackLib.h>\r
29#include <Library/FspCommonLib.h>\r
30#include <FspEas.h>\r
31\r
cf1d4549
JY
32typedef VOID (*PEI_CORE_ENTRY) ( \\r
33 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, \\r
34 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList \\r
35);\r
36\r
37typedef struct _SEC_IDT_TABLE {\r
38 EFI_PEI_SERVICES *PeiService;\r
b1cc6f67 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
54 IN UINT32 TemporaryMemoryBase,\r
55 IN UINT32 PermenentMemoryBase\r
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
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
81 );\r
82\r
83/**\r
84 Initializes floating point units for requirement of UEFI specification.\r
85\r
86 This function initializes floating-point control word to 0x027F (all exceptions\r
87 masked,double-precision, round-to-nearest) and multimedia-extensions control word\r
88 (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to zero\r
89 for masked underflow).\r
90\r
91**/\r
92VOID\r
93EFIAPI\r
94InitializeFloatingPointUnits (\r
95 VOID\r
96 );\r
97\r
98/**\r
99\r
100 Entry point to the C language phase of SEC. After the SEC assembly\r
101 code has initialized some temporary memory and set up the stack,\r
102 the control is transferred to this function.\r
103\r
104\r
105 @param[in] SizeOfRam Size of the temporary memory available for use.\r
058dcbf2 106 @param[in] TempRamBase Base address of temporary ram\r
cf1d4549
JY
107 @param[in] BootFirmwareVolume Base address of the Boot Firmware Volume.\r
108 @param[in] PeiCore PeiCore entry point.\r
109 @param[in] BootLoaderStack BootLoader stack.\r
110 @param[in] ApiIdx the index of API.\r
111\r
112 @return This function never returns.\r
113\r
114**/\r
115VOID\r
116EFIAPI\r
117SecStartup (\r
118 IN UINT32 SizeOfRam,\r
119 IN UINT32 TempRamBase,\r
120 IN VOID *BootFirmwareVolume,\r
121 IN PEI_CORE_ENTRY PeiCore,\r
122 IN UINT32 BootLoaderStack,\r
123 IN UINT32 ApiIdx\r
124 );\r
125\r
126/**\r
127 Autogenerated function that calls the library constructors for all of the module's\r
128 dependent libraries. This function must be called by the SEC Core once a stack has\r
129 been established.\r
130\r
131**/\r
132VOID\r
133EFIAPI\r
134ProcessLibraryConstructorList (\r
135 VOID\r
136 );\r
137\r
138#endif\r