TianoCore EDK2 master
Loading...
Searching...
No Matches
SblParseLib.c
Go to the documentation of this file.
1
9#include <PiDxe.h>
10#include <Library/BaseLib.h>
12#include <Library/DebugLib.h>
13#include <Library/PcdLib.h>
14#include <Library/IoLib.h>
15#include <Library/HobLib.h>
16#include <Library/BlParseLib.h>
19
30VOID *
31EFIAPI
33 VOID
34 )
35{
36 EFI_HOB_HANDOFF_INFO_TABLE *HandoffTable;
37
38 HandoffTable = (EFI_HOB_HANDOFF_INFO_TABLE *)(UINTN)GET_BOOTLOADER_PARAMETER ();
39 if ((HandoffTable->Header.HobType == EFI_HOB_TYPE_HANDOFF) &&
40 (HandoffTable->Header.HobLength == sizeof (EFI_HOB_HANDOFF_INFO_TABLE)) &&
41 (HandoffTable->Header.Reserved == 0))
42 {
43 return (VOID *)HandoffTable;
44 }
45
46 return NULL;
47}
48
61VOID *
63 IN EFI_GUID *Guid
64 )
65{
66 UINT8 *GuidHob;
67 CONST VOID *HobList;
68
69 HobList = GetParameterBase ();
70 ASSERT (HobList != NULL);
71 GuidHob = GetNextGuidHob (Guid, HobList);
72 if (GuidHob != NULL) {
73 return GET_GUID_HOB_DATA (GuidHob);
74 }
75
76 return NULL;
77}
78
89RETURN_STATUS
90EFIAPI
92 IN BL_MEM_INFO_CALLBACK MemInfoCallback,
93 IN VOID *Params
94 )
95{
96 MEMORY_MAP_INFO *MemoryMapInfo;
97 UINTN Idx;
98
100 if (MemoryMapInfo == NULL) {
101 ASSERT (FALSE);
102 return RETURN_NOT_FOUND;
103 }
104
105 for (Idx = 0; Idx < MemoryMapInfo->Count; Idx++) {
106 MemInfoCallback (&MemoryMapInfo->Entry[Idx], Params);
107 }
108
109 return RETURN_SUCCESS;
110}
111
121RETURN_STATUS
122EFIAPI
125 )
126{
128
129 TableInfo = (UNIVERSAL_PAYLOAD_SMBIOS_TABLE *)GetGuidHobDataFromSbl (&gUniversalPayloadSmbiosTableGuid);
130 if (TableInfo == NULL) {
131 ASSERT (FALSE);
132 return RETURN_NOT_FOUND;
133 }
134
135 SmbiosTable->SmBiosEntryPoint = TableInfo->SmBiosEntryPoint;
136
137 return RETURN_SUCCESS;
138}
139
149RETURN_STATUS
150EFIAPI
153 )
154{
156
157 TableInfo = (UNIVERSAL_PAYLOAD_ACPI_TABLE *)GetGuidHobDataFromSbl (&gUniversalPayloadAcpiTableGuid);
158 if (TableInfo == NULL) {
159 ASSERT (FALSE);
160 return RETURN_NOT_FOUND;
161 }
162
163 AcpiTableHob->Rsdp = TableInfo->Rsdp;
164
165 return RETURN_SUCCESS;
166}
167
177RETURN_STATUS
178EFIAPI
180 OUT SERIAL_PORT_INFO *SerialPortInfo
181 )
182{
183 SERIAL_PORT_INFO *BlSerialInfo;
184
186 if (BlSerialInfo == NULL) {
187 ASSERT (FALSE);
188 return RETURN_NOT_FOUND;
189 }
190
191 CopyMem (SerialPortInfo, BlSerialInfo, sizeof (SERIAL_PORT_INFO));
192
193 return RETURN_SUCCESS;
194}
195
205RETURN_STATUS
206EFIAPI
209 )
210{
211 EFI_PEI_GRAPHICS_INFO_HOB *BlGfxInfo;
212
213 BlGfxInfo = (EFI_PEI_GRAPHICS_INFO_HOB *)GetGuidHobDataFromSbl (&gEfiGraphicsInfoHobGuid);
214 if (BlGfxInfo == NULL) {
215 return RETURN_NOT_FOUND;
216 }
217
218 CopyMem (GfxInfo, BlGfxInfo, sizeof (EFI_PEI_GRAPHICS_INFO_HOB));
219
220 return RETURN_SUCCESS;
221}
222
232RETURN_STATUS
233EFIAPI
236 )
237{
238 EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *BlGfxDeviceInfo;
239
240 BlGfxDeviceInfo = (EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *)GetGuidHobDataFromSbl (&gEfiGraphicsDeviceInfoHobGuid);
241 if (BlGfxDeviceInfo == NULL) {
242 return RETURN_NOT_FOUND;
243 }
244
245 CopyMem (GfxDeviceInfo, BlGfxDeviceInfo, sizeof (EFI_PEI_GRAPHICS_DEVICE_INFO_HOB));
246
247 return RETURN_SUCCESS;
248}
249
258RETURN_STATUS
259EFIAPI
261 VOID
262 )
263{
264 RETURN_STATUS Status;
265 UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *BlRootBridgesHob;
266 UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *PldRootBridgesHob;
267
268 Status = RETURN_NOT_FOUND;
270 &gUniversalPayloadPciRootBridgeInfoGuid
271 );
272 if (BlRootBridgesHob != NULL) {
273 //
274 // Migrate bootloader root bridge info hob from bootloader to payload.
275 //
276 PldRootBridgesHob = BuildGuidHob (
277 &gUniversalPayloadPciRootBridgeInfoGuid,
278 BlRootBridgesHob->Header.Length
279 );
280 ASSERT (PldRootBridgesHob != NULL);
281 if (PldRootBridgesHob != NULL) {
282 CopyMem (PldRootBridgesHob, BlRootBridgesHob, BlRootBridgesHob->Header.Length);
283 DEBUG ((DEBUG_INFO, "Create PCI root bridge info guid hob\n"));
284 Status = RETURN_SUCCESS;
285 } else {
287 }
288 }
289
290 return Status;
291}
UINT64 UINTN
VOID *EFIAPI BuildGuidHob(IN CONST EFI_GUID *Guid, IN UINTN DataLength)
Definition: HobLib.c:336
VOID *EFIAPI GetNextGuidHob(IN CONST EFI_GUID *Guid, IN CONST VOID *HobStart)
Definition: HobLib.c:176
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define RETURN_NOT_FOUND
Definition: Base.h:1142
#define RETURN_OUT_OF_RESOURCES
Definition: Base.h:1114
#define RETURN_SUCCESS
Definition: Base.h:1066
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define DEBUG(Expression)
Definition: DebugLib.h:434
EFI_GUID gLoaderMemoryMapInfoGuid
RETURN_STATUS EFIAPI ParseSmbiosTable(OUT UNIVERSAL_PAYLOAD_SMBIOS_TABLE *SmbiosTable)
Definition: SblParseLib.c:123
RETURN_STATUS EFIAPI ParseMemoryInfo(IN BL_MEM_INFO_CALLBACK MemInfoCallback, IN VOID *Params)
Definition: SblParseLib.c:91
RETURN_STATUS EFIAPI ParseGfxDeviceInfo(OUT EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *GfxDeviceInfo)
Definition: SblParseLib.c:234
RETURN_STATUS EFIAPI ParseGfxInfo(OUT EFI_PEI_GRAPHICS_INFO_HOB *GfxInfo)
Definition: SblParseLib.c:207
RETURN_STATUS EFIAPI ParseAcpiTableInfo(OUT UNIVERSAL_PAYLOAD_ACPI_TABLE *AcpiTableHob)
Definition: SblParseLib.c:151
RETURN_STATUS EFIAPI ParseSerialInfo(OUT SERIAL_PORT_INFO *SerialPortInfo)
Definition: SblParseLib.c:179
VOID *EFIAPI GetParameterBase(VOID)
Definition: SblParseLib.c:32
RETURN_STATUS EFIAPI ParseMiscInfo(VOID)
Definition: SblParseLib.c:260
VOID * GetGuidHobDataFromSbl(IN EFI_GUID *Guid)
Definition: SblParseLib.c:62
EFI_GUID gUefiSerialPortInfoGuid
EFI_STATUS MemInfoCallback(IN MEMORY_MAP_ENTRY *MemoryMapEntry, IN VOID *Params)
EFI_HOB_GENERIC_HEADER Header
Definition: PiHob.h:64
Definition: Base.h:213