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