2 This library will parse the Slim Bootloader to get required information.
4 Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Library/BaseLib.h>
11 #include <Library/BaseMemoryLib.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>
17 #include <IndustryStandard/Acpi.h>
21 This function retrieves the parameter base address from boot loader.
23 This function will get bootloader specific parameter address for UEFI payload.
24 e.g. HobList pointer for Slim Bootloader, and coreboot table header for Coreboot.
26 @retval NULL Failed to find the GUID HOB.
27 @retval others GUIDed HOB data pointer.
36 EFI_HOB_HANDOFF_INFO_TABLE
*HandoffTable
;
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 return (VOID
*)HandoffTable
;
50 This function retrieves a GUIDed HOB data from Slim Bootloader.
52 This function will search SBL HOB list to find the first GUIDed HOB that
53 its GUID matches Guid.
55 @param[in] Guid A pointer to HOB GUID to search.
57 @retval NULL Failed to find the GUID HOB.
58 @retval others GUIDed HOB data pointer.
62 GetGuidHobDataFromSbl (
69 HobList
= GetParameterBase ();
70 ASSERT (HobList
!= NULL
);
71 GuidHob
= GetNextGuidHob (Guid
, HobList
);
72 if (GuidHob
!= NULL
) {
73 return GET_GUID_HOB_DATA (GuidHob
);
80 Acquire the memory map information.
82 @param MemInfoCallback The callback routine
83 @param Params Pointer to the callback routine parameter
85 @retval RETURN_SUCCESS Successfully find out the memory information.
86 @retval RETURN_NOT_FOUND Failed to find the memory information.
92 IN BL_MEM_INFO_CALLBACK MemInfoCallback
,
96 MEMROY_MAP_INFO
*MemoryMapInfo
;
99 MemoryMapInfo
= (MEMROY_MAP_INFO
*) GetGuidHobDataFromSbl (&gLoaderMemoryMapInfoGuid
);
100 if (MemoryMapInfo
== NULL
) {
102 return RETURN_NOT_FOUND
;
105 for (Idx
= 0; Idx
< MemoryMapInfo
->Count
; Idx
++) {
106 MemInfoCallback (&MemoryMapInfo
->Entry
[Idx
], Params
);
109 return RETURN_SUCCESS
;
113 Acquire acpi table and smbios table from slim bootloader
115 @param SystemTableInfo Pointer to the system table info
117 @retval RETURN_SUCCESS Successfully find out the tables.
118 @retval RETURN_NOT_FOUND Failed to find the tables.
124 OUT SYSTEM_TABLE_INFO
*SystemTableInfo
127 SYSTEM_TABLE_INFO
*TableInfo
;
129 TableInfo
= (SYSTEM_TABLE_INFO
*)GetGuidHobDataFromSbl (&gUefiSystemTableInfoGuid
);
130 if (TableInfo
== NULL
) {
132 return RETURN_NOT_FOUND
;
135 CopyMem (SystemTableInfo
, TableInfo
, sizeof (SYSTEM_TABLE_INFO
));
137 return RETURN_SUCCESS
;
142 Find the serial port information
144 @param SERIAL_PORT_INFO Pointer to serial port info structure
146 @retval RETURN_SUCCESS Successfully find the serial port information.
147 @retval RETURN_NOT_FOUND Failed to find the serial port information .
153 OUT SERIAL_PORT_INFO
*SerialPortInfo
156 SERIAL_PORT_INFO
*BlSerialInfo
;
158 BlSerialInfo
= (SERIAL_PORT_INFO
*) GetGuidHobDataFromSbl (&gUefiSerialPortInfoGuid
);
159 if (BlSerialInfo
== NULL
) {
161 return RETURN_NOT_FOUND
;
164 CopyMem (SerialPortInfo
, BlSerialInfo
, sizeof (SERIAL_PORT_INFO
));
166 return RETURN_SUCCESS
;
171 Find the video frame buffer information
173 @param GfxInfo Pointer to the EFI_PEI_GRAPHICS_INFO_HOB structure
175 @retval RETURN_SUCCESS Successfully find the video frame buffer information.
176 @retval RETURN_NOT_FOUND Failed to find the video frame buffer information .
182 OUT EFI_PEI_GRAPHICS_INFO_HOB
*GfxInfo
185 EFI_PEI_GRAPHICS_INFO_HOB
*BlGfxInfo
;
187 BlGfxInfo
= (EFI_PEI_GRAPHICS_INFO_HOB
*) GetGuidHobDataFromSbl (&gEfiGraphicsInfoHobGuid
);
188 if (BlGfxInfo
== NULL
) {
189 return RETURN_NOT_FOUND
;
192 CopyMem (GfxInfo
, BlGfxInfo
, sizeof (EFI_PEI_GRAPHICS_INFO_HOB
));
194 return RETURN_SUCCESS
;
198 Find the video frame buffer device information
200 @param GfxDeviceInfo Pointer to the EFI_PEI_GRAPHICS_DEVICE_INFO_HOB structure
202 @retval RETURN_SUCCESS Successfully find the video frame buffer information.
203 @retval RETURN_NOT_FOUND Failed to find the video frame buffer information.
209 OUT EFI_PEI_GRAPHICS_DEVICE_INFO_HOB
*GfxDeviceInfo
212 EFI_PEI_GRAPHICS_DEVICE_INFO_HOB
*BlGfxDeviceInfo
;
214 BlGfxDeviceInfo
= (EFI_PEI_GRAPHICS_DEVICE_INFO_HOB
*) GetGuidHobDataFromSbl (&gEfiGraphicsDeviceInfoHobGuid
);
215 if (BlGfxDeviceInfo
== NULL
) {
216 return RETURN_NOT_FOUND
;
219 CopyMem (GfxDeviceInfo
, BlGfxDeviceInfo
, sizeof (EFI_PEI_GRAPHICS_DEVICE_INFO_HOB
));
221 return RETURN_SUCCESS
;