1 | /** @file
|
---|
2 |
|
---|
3 | Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
|
---|
4 | This program and the accompanying materials
|
---|
5 | are licensed and made available under the terms and conditions of the BSD License
|
---|
6 | which accompanies this distribution. The full text of the license may be found at
|
---|
7 | http://opensource.org/licenses/bsd-license.php.
|
---|
8 |
|
---|
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
---|
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
---|
11 |
|
---|
12 | **/
|
---|
13 |
|
---|
14 | #ifndef __PEI_DXEIPL_H__
|
---|
15 | #define __PEI_DXEIPL_H__
|
---|
16 |
|
---|
17 | #include <PiPei.h>
|
---|
18 | #include <Ppi/DxeIpl.h>
|
---|
19 | #include <Ppi/EndOfPeiPhase.h>
|
---|
20 | #include <Ppi/MemoryDiscovered.h>
|
---|
21 | #include <Ppi/Decompress.h>
|
---|
22 | #include <Ppi/FirmwareVolumeInfo.h>
|
---|
23 | #include <Ppi/GuidedSectionExtraction.h>
|
---|
24 |
|
---|
25 | #include <Library/DebugLib.h>
|
---|
26 | #include <Library/PeimEntryPoint.h>
|
---|
27 | #include <Library/BaseLib.h>
|
---|
28 | #include <Library/HobLib.h>
|
---|
29 | #include <Library/PeiServicesLib.h>
|
---|
30 | #include <Library/ReportStatusCodeLib.h>
|
---|
31 | #include <Library/UefiDecompressLib.h>
|
---|
32 | #include <Library/ExtractGuidedSectionLib.h>
|
---|
33 | #include <Library/BaseMemoryLib.h>
|
---|
34 | #include <Library/MemoryAllocationLib.h>
|
---|
35 | #include <Library/PcdLib.h>
|
---|
36 | #include <Library/FspSwitchStackLib.h>
|
---|
37 | #include <Library/FspCommonLib.h>
|
---|
38 | #include <Library/FspPlatformLib.h>
|
---|
39 |
|
---|
40 | /**
|
---|
41 | Main entry point to last PEIM.
|
---|
42 |
|
---|
43 | This function finds DXE Core in the firmware volume and transfer the control to
|
---|
44 | DXE core.
|
---|
45 |
|
---|
46 | @param[in] This Entry point for DXE IPL PPI.
|
---|
47 | @param[in] PeiServices General purpose services available to every PEIM.
|
---|
48 | @param[in] HobList Address to the Pei HOB list.
|
---|
49 |
|
---|
50 | @return EFI_SUCCESS DXE core was successfully loaded.
|
---|
51 | @return EFI_OUT_OF_RESOURCES There are not enough resources to load DXE core.
|
---|
52 |
|
---|
53 | **/
|
---|
54 | EFI_STATUS
|
---|
55 | EFIAPI
|
---|
56 | DxeLoadCore (
|
---|
57 | IN CONST EFI_DXE_IPL_PPI *This,
|
---|
58 | IN EFI_PEI_SERVICES **PeiServices,
|
---|
59 | IN EFI_PEI_HOB_POINTERS HobList
|
---|
60 | );
|
---|
61 |
|
---|
62 |
|
---|
63 |
|
---|
64 | /**
|
---|
65 | Transfers control to DxeCore.
|
---|
66 |
|
---|
67 | This function performs a CPU architecture specific operations to execute
|
---|
68 | the entry point of DxeCore with the parameters of HobList.
|
---|
69 | It also installs EFI_END_OF_PEI_PPI to signal the end of PEI phase.
|
---|
70 |
|
---|
71 | @param[in] DxeCoreEntryPoint The entry point of DxeCore.
|
---|
72 | @param[in] HobList The start of HobList passed to DxeCore.
|
---|
73 |
|
---|
74 | **/
|
---|
75 | VOID
|
---|
76 | HandOffToDxeCore (
|
---|
77 | IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
|
---|
78 | IN EFI_PEI_HOB_POINTERS HobList
|
---|
79 | );
|
---|
80 |
|
---|
81 |
|
---|
82 |
|
---|
83 | /**
|
---|
84 | Updates the Stack HOB passed to DXE phase.
|
---|
85 |
|
---|
86 | This function traverses the whole HOB list and update the stack HOB to
|
---|
87 | reflect the real stack that is used by DXE core.
|
---|
88 |
|
---|
89 | @param[in] BaseAddress The lower address of stack used by DxeCore.
|
---|
90 | @param[in] Length The length of stack used by DxeCore.
|
---|
91 |
|
---|
92 | **/
|
---|
93 | VOID
|
---|
94 | UpdateStackHob (
|
---|
95 | IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
---|
96 | IN UINT64 Length
|
---|
97 | );
|
---|
98 |
|
---|
99 | /**
|
---|
100 | The ExtractSection() function processes the input section and
|
---|
101 | returns a pointer to the section contents. If the section being
|
---|
102 | extracted does not require processing (if the section
|
---|
103 | GuidedSectionHeader.Attributes has the
|
---|
104 | EFI_GUIDED_SECTION_PROCESSING_REQUIRED field cleared), then
|
---|
105 | OutputBuffer is just updated to point to the start of the
|
---|
106 | section's contents. Otherwise, *Buffer must be allocated
|
---|
107 | from PEI permanent memory.
|
---|
108 |
|
---|
109 | @param[in] This Indicates the
|
---|
110 | EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI instance.
|
---|
111 | Buffer containing the input GUIDed section to be
|
---|
112 | processed. OutputBuffer OutputBuffer is
|
---|
113 | allocated from PEI permanent memory and contains
|
---|
114 | the new section stream.
|
---|
115 | @param[in] InputSection A pointer to the input buffer, which contains
|
---|
116 | the input section to be processed.
|
---|
117 | @param[out] OutputBuffer A pointer to a caller-allocated buffer, whose
|
---|
118 | size is specified by the contents of OutputSize.
|
---|
119 | @param[out] OutputSize A pointer to a caller-allocated
|
---|
120 | UINTN in which the size of *OutputBuffer
|
---|
121 | allocation is stored. If the function
|
---|
122 | returns anything other than EFI_SUCCESS,
|
---|
123 | the value of OutputSize is undefined.
|
---|
124 | @param[out] AuthenticationStatus A pointer to a caller-allocated
|
---|
125 | UINT32 that indicates the
|
---|
126 | authentication status of the
|
---|
127 | output buffer. If the input
|
---|
128 | section's GuidedSectionHeader.
|
---|
129 | Attributes field has the
|
---|
130 | EFI_GUIDED_SECTION_AUTH_STATUS_VALID
|
---|
131 | bit as clear,
|
---|
132 | AuthenticationStatus must return
|
---|
133 | zero. These bits reflect the
|
---|
134 | status of the extraction
|
---|
135 | operation. If the function
|
---|
136 | returns anything other than
|
---|
137 | EFI_SUCCESS, the value of
|
---|
138 | AuthenticationStatus is
|
---|
139 | undefined.
|
---|
140 |
|
---|
141 | @retval EFI_SUCCESS The InputSection was
|
---|
142 | successfully processed and the
|
---|
143 | section contents were returned.
|
---|
144 |
|
---|
145 | @retval EFI_OUT_OF_RESOURCES The system has insufficient
|
---|
146 | resources to process the request.
|
---|
147 |
|
---|
148 | @retval EFI_INVALID_PARAMETER The GUID in InputSection does
|
---|
149 | not match this instance of the
|
---|
150 | GUIDed Section Extraction PPI.
|
---|
151 |
|
---|
152 | **/
|
---|
153 | EFI_STATUS
|
---|
154 | EFIAPI
|
---|
155 | CustomGuidedSectionExtract (
|
---|
156 | IN CONST EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI *This,
|
---|
157 | IN CONST VOID *InputSection,
|
---|
158 | OUT VOID **OutputBuffer,
|
---|
159 | OUT UINTN *OutputSize,
|
---|
160 | OUT UINT32 *AuthenticationStatus
|
---|
161 | );
|
---|
162 |
|
---|
163 | /**
|
---|
164 | Decompresses a section to the output buffer.
|
---|
165 |
|
---|
166 | This function looks up the compression type field in the input section and
|
---|
167 | applies the appropriate compression algorithm to compress the section to a
|
---|
168 | callee allocated buffer.
|
---|
169 |
|
---|
170 | @param[in] This Points to this instance of the
|
---|
171 | EFI_PEI_DECOMPRESS_PEI PPI.
|
---|
172 | @param[in] CompressionSection Points to the compressed section.
|
---|
173 | @param[out] OutputBuffer Holds the returned pointer to the decompressed
|
---|
174 | sections.
|
---|
175 | @param[out] OutputSize Holds the returned size of the decompress
|
---|
176 | section streams.
|
---|
177 |
|
---|
178 | @retval EFI_SUCCESS The section was decompressed successfully.
|
---|
179 | OutputBuffer contains the resulting data and
|
---|
180 | OutputSize contains the resulting size.
|
---|
181 |
|
---|
182 | **/
|
---|
183 | EFI_STATUS
|
---|
184 | EFIAPI
|
---|
185 | Decompress (
|
---|
186 | IN CONST EFI_PEI_DECOMPRESS_PPI *This,
|
---|
187 | IN CONST EFI_COMPRESSION_SECTION *CompressionSection,
|
---|
188 | OUT VOID **OutputBuffer,
|
---|
189 | OUT UINTN *OutputSize
|
---|
190 | );
|
---|
191 |
|
---|
192 | #endif
|
---|