]>
Commit | Line | Data |
---|---|---|
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 |
32 | typedef 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 | |
37 | typedef 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 | |
51 | VOID\r | |
52 | EFIAPI\r | |
53 | SecSwitchStack (\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 | |
74 | EFI_STATUS\r | |
75 | EFIAPI\r | |
76 | SecTemporaryRamSupport (\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 | |
92 | VOID\r | |
93 | EFIAPI\r | |
94 | InitializeFloatingPointUnits (\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 | |
115 | VOID\r | |
116 | EFIAPI\r | |
117 | SecStartup (\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 | |
132 | VOID\r | |
133 | EFIAPI\r | |
134 | ProcessLibraryConstructorList (\r | |
135 | VOID\r | |
136 | );\r | |
137 | \r | |
12a0a80b CC |
138 | /**\r |
139 | \r | |
140 | Return value of esp.\r | |
141 | \r | |
142 | @return value of esp.\r | |
143 | \r | |
144 | **/\r | |
145 | UINT32\r | |
146 | EFIAPI\r | |
147 | AsmReadEsp (\r | |
148 | VOID\r | |
149 | );\r | |
150 | \r | |
cf1d4549 | 151 | #endif\r |