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