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