]>
Commit | Line | Data |
---|---|---|
96226baa | 1 | /** @file\r |
fbc81c1e | 2 | Master header file for DxeIpl PEIM. All source files in this module should\r |
f45af90b | 3 | include this file for common defininitions.\r |
95276127 | 4 | \r |
96226baa | 5 | Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r |
95276127 | 6 | All rights reserved. This program and the accompanying materials\r |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
797a9d67 | 14 | **/\r |
95276127 | 15 | \r |
16 | #ifndef __PEI_DXEIPL_H__\r | |
17 | #define __PEI_DXEIPL_H__\r | |
18 | \r | |
859b72fa A |
19 | #include <PiPei.h>\r |
20 | #include <Ppi/DxeIpl.h>\r | |
859b72fa | 21 | #include <Ppi/EndOfPeiPhase.h>\r |
859b72fa | 22 | #include <Ppi/MemoryDiscovered.h>\r |
b74350e9 | 23 | #include <Ppi/ReadOnlyVariable2.h>\r |
24 | #include <Guid/MemoryTypeInformation.h>\r | |
b0d803fe | 25 | #include <Ppi/Decompress.h>\r |
26 | #include <Ppi/FirmwareVolumeInfo.h>\r | |
27 | \r | |
30c8f861 | 28 | #include <Guid/MemoryAllocationHob.h>\r |
b0d803fe | 29 | #include <Guid/FirmwareFileSystem2.h>\r |
30 | \r | |
859b72fa A |
31 | #include <Library/DebugLib.h>\r |
32 | #include <Library/PeimEntryPoint.h>\r | |
33 | #include <Library/BaseLib.h>\r | |
34 | #include <Library/HobLib.h>\r | |
35 | #include <Library/PeiServicesLib.h>\r | |
36 | #include <Library/ReportStatusCodeLib.h>\r | |
37 | #include <Library/CacheMaintenanceLib.h>\r | |
859b72fa | 38 | #include <Library/UefiDecompressLib.h>\r |
18fd8d65 | 39 | #include <Library/ExtractGuidedSectionLib.h>\r |
859b72fa A |
40 | #include <Library/PeiServicesTablePointerLib.h>\r |
41 | #include <Library/BaseMemoryLib.h>\r | |
42 | #include <Library/MemoryAllocationLib.h>\r | |
43 | #include <Library/PcdLib.h>\r | |
44 | #include <Library/PeCoffLib.h>\r | |
4fb31c2c | 45 | #include <Library/S3Lib.h>\r |
46 | #include <Library/RecoveryLib.h>\r | |
95276127 | 47 | \r |
48 | #define STACK_SIZE 0x20000\r | |
49 | #define BSP_STORE_SIZE 0x4000\r | |
50 | \r | |
51 | #define GET_OCCUPIED_SIZE(ActualSize, Alignment) ((ActualSize + (Alignment - 1)) & ~(Alignment - 1))\r | |
52 | \r | |
53 | extern BOOLEAN gInMemory;\r | |
54 | \r | |
91d92e25 | 55 | \r |
56 | \r | |
57 | \r | |
58 | /**\r | |
59 | Loads and relocates a PE/COFF image into memory.\r | |
60 | \r | |
61 | @param FileHandle The image file handle\r | |
62 | @param ImageAddress The base address of the relocated PE/COFF image\r | |
63 | @param ImageSize The size of the relocated PE/COFF image\r | |
64 | @param EntryPoint The entry point of the relocated PE/COFF image\r | |
65 | \r | |
66 | @return EFI_SUCCESS The file was loaded and relocated\r | |
67 | @return EFI_OUT_OF_RESOURCES There was not enough memory to load and relocate the PE/COFF file\r | |
68 | \r | |
69 | **/\r | |
95276127 | 70 | EFI_STATUS\r |
71 | PeiLoadFile (\r | |
b0d803fe | 72 | IN EFI_PEI_FILE_HANDLE FileHandle,\r |
95276127 | 73 | OUT EFI_PHYSICAL_ADDRESS *ImageAddress,\r |
74 | OUT UINT64 *ImageSize,\r | |
75 | OUT EFI_PHYSICAL_ADDRESS *EntryPoint\r | |
f45af90b | 76 | );\r |
95276127 | 77 | \r |
91d92e25 | 78 | \r |
79 | \r | |
80 | /**\r | |
81 | Find DxeCore driver from all First Volumes.\r | |
82 | \r | |
83 | @param FileHandle Pointer to FFS file to search.\r | |
84 | \r | |
85 | @return EFI_SUCESS Success to find the FFS in specificed FV\r | |
86 | @return others Fail to find the FFS in specificed FV\r | |
87 | \r | |
88 | **/\r | |
b0d803fe | 89 | EFI_STATUS\r |
288f9b38 | 90 | DxeIplFindDxeCore (\r |
b0d803fe | 91 | OUT EFI_PEI_FILE_HANDLE *FileHandle\r |
f45af90b | 92 | );\r |
95276127 | 93 | \r |
91d92e25 | 94 | \r |
95 | \r | |
96 | /**\r | |
97 | This function simply retrieves the function pointer of ImageRead in\r | |
98 | ImageContext structure.\r | |
99 | \r | |
100 | @param ImageContext A pointer to the structure of \r | |
101 | PE_COFF_LOADER_IMAGE_CONTEXT\r | |
102 | \r | |
103 | @retval EFI_SUCCESS This function always return EFI_SUCCESS.\r | |
104 | \r | |
105 | **/\r | |
95276127 | 106 | EFI_STATUS\r |
107 | GetImageReadFunction (\r | |
108 | IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext\r | |
f45af90b | 109 | );\r |
95276127 | 110 | \r |
91d92e25 | 111 | \r |
112 | \r | |
113 | /**\r | |
114 | Main entry point to last PEIM \r | |
115 | \r | |
116 | @param This Entry point for DXE IPL PPI\r | |
117 | @param PeiServices General purpose services available to every PEIM.\r | |
118 | @param HobList Address to the Pei HOB list\r | |
119 | \r | |
120 | @return EFI_SUCCESS DXE core was successfully loaded. \r | |
121 | @return EFI_OUT_OF_RESOURCES There are not enough resources to load DXE core.\r | |
122 | \r | |
123 | **/\r | |
95276127 | 124 | EFI_STATUS\r |
125 | EFIAPI\r | |
126 | DxeLoadCore (\r | |
127 | IN EFI_DXE_IPL_PPI *This,\r | |
128 | IN EFI_PEI_SERVICES **PeiServices,\r | |
129 | IN EFI_PEI_HOB_POINTERS HobList\r | |
130 | );\r | |
131 | \r | |
91d92e25 | 132 | \r |
133 | \r | |
134 | /**\r | |
135 | Transfers control to DxeCore.\r | |
136 | \r | |
137 | This function performs a CPU architecture specific operations to execute\r | |
138 | the entry point of DxeCore with the parameters of HobList.\r | |
139 | It also intalls EFI_END_OF_PEI_PPI to signal the end of PEI phase.\r | |
140 | \r | |
141 | @param DxeCoreEntryPoint The entrypoint of DxeCore.\r | |
142 | @param HobList The start of HobList passed to DxeCore.\r | |
143 | @param EndOfPeiSignal The PPI descriptor for EFI_END_OF_PEI_PPI.\r | |
144 | \r | |
145 | **/\r | |
95276127 | 146 | VOID\r |
147 | HandOffToDxeCore (\r | |
148 | IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,\r | |
149 | IN EFI_PEI_HOB_POINTERS HobList,\r | |
150 | IN EFI_PEI_PPI_DESCRIPTOR *EndOfPeiSignal\r | |
151 | );\r | |
152 | \r | |
91d92e25 | 153 | \r |
154 | \r | |
155 | /**\r | |
156 | Updates the Stack HOB passed to DXE phase.\r | |
157 | \r | |
158 | This function traverses the whole HOB list and update the stack HOB to\r | |
159 | reflect the real stack that is used by DXE core.\r | |
160 | \r | |
161 | @param BaseAddress The lower address of stack used by DxeCore.\r | |
162 | @param Length The length of stack used by DxeCore.\r | |
163 | \r | |
164 | **/\r | |
30c8f861 | 165 | VOID\r |
166 | UpdateStackHob (\r | |
167 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
168 | IN UINT64 Length\r | |
169 | );\r | |
170 | \r | |
91d92e25 | 171 | \r |
172 | \r | |
173 | /**\r | |
174 | Initializes the Dxe Ipl PPI\r | |
175 | \r | |
176 | @param FfsHandle The handle of FFS file.\r | |
177 | @param PeiServices General purpose services available to\r | |
178 | every PEIM.\r | |
179 | @return EFI_SUCESS\r | |
180 | \r | |
181 | **/\r | |
95276127 | 182 | EFI_STATUS\r |
183 | EFIAPI\r | |
184 | PeimInitializeDxeIpl (\r | |
b0d803fe | 185 | IN EFI_PEI_FILE_HANDLE FfsHandle,\r |
95276127 | 186 | IN EFI_PEI_SERVICES **PeiServices\r |
f45af90b | 187 | );\r |
95276127 | 188 | \r |
189 | \r | |
190 | #endif\r |