UefiPayloadPkg: Enhance UEFI payload for coreboot and Slim Bootloader
[mirror_edk2.git] / UefiPayloadPkg / Include / Library / BlParseLib.h
CommitLineData
04af8bf2
DG
1/** @file\r
2 This library will parse the coreboot table in memory and extract those required\r
3 information.\r
4\r
5 Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>\r
6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
7\r
8**/\r
9#include <PiPei.h>\r
10#include <Guid/GraphicsInfoHob.h>\r
11#include <Guid/MemoryMapInfoGuid.h>\r
12#include <Guid/SerialPortInfoGuid.h>\r
13#include <Guid/SystemTableInfoGuid.h>\r
14#include <Guid/AcpiBoardInfoGuid.h>\r
15\r
16#ifndef __BOOTLOADER_PARSE_LIB__\r
17#define __BOOTLOADER_PARSE_LIB__\r
18\r
19#define GET_BOOTLOADER_PARAMETER() (*(UINT32 *)(UINTN)(PcdGet32(PcdPayloadStackTop) - sizeof(UINT32)))\r
20#define SET_BOOTLOADER_PARAMETER(Value) GET_BOOTLOADER_PARAMETER()=Value\r
21\r
22typedef RETURN_STATUS \\r
23 (*BL_MEM_INFO_CALLBACK) (MEMROY_MAP_ENTRY *MemoryMapEntry, VOID *Param);\r
24\r
25/**\r
26 This function retrieves the parameter base address from boot loader.\r
27\r
28 This function will get bootloader specific parameter address for UEFI payload.\r
29 e.g. HobList pointer for Slim Bootloader, and coreboot table header for Coreboot.\r
30\r
31 @retval NULL Failed to find the GUID HOB.\r
32 @retval others GUIDed HOB data pointer.\r
33\r
34**/\r
35VOID *\r
36EFIAPI\r
37GetParameterBase (\r
38 VOID\r
39 );\r
40\r
41/**\r
42 Acquire the memory map information.\r
43\r
44 @param MemInfoCallback The callback routine\r
45 @param Params Pointer to the callback routine parameter\r
46\r
47 @retval RETURN_SUCCESS Successfully find out the memory information.\r
48 @retval RETURN_NOT_FOUND Failed to find the memory information.\r
49\r
50**/\r
51RETURN_STATUS\r
52EFIAPI\r
53ParseMemoryInfo (\r
54 IN BL_MEM_INFO_CALLBACK MemInfoCallback,\r
55 IN VOID *Params\r
56 );\r
57\r
58/**\r
59 Acquire acpi table and smbios table from slim bootloader\r
60\r
61 @param SystemTableInfo Pointer to the system table info\r
62\r
63 @retval RETURN_SUCCESS Successfully find out the tables.\r
64 @retval RETURN_NOT_FOUND Failed to find the tables.\r
65\r
66**/\r
67RETURN_STATUS\r
68EFIAPI\r
69ParseSystemTable (\r
70 OUT SYSTEM_TABLE_INFO *SystemTableInfo\r
71 );\r
72\r
73\r
74/**\r
75 Find the serial port information\r
76\r
77 @param SERIAL_PORT_INFO Pointer to serial port info structure\r
78\r
79 @retval RETURN_SUCCESS Successfully find the serial port information.\r
80 @retval RETURN_NOT_FOUND Failed to find the serial port information .\r
81\r
82**/\r
83RETURN_STATUS\r
84EFIAPI\r
85ParseSerialInfo (\r
86 OUT SERIAL_PORT_INFO *SerialPortInfo\r
87 );\r
88\r
89\r
90/**\r
91 Find the video frame buffer information\r
92\r
93 @param GfxInfo Pointer to the EFI_PEI_GRAPHICS_INFO_HOB structure\r
94\r
95 @retval RETURN_SUCCESS Successfully find the video frame buffer information.\r
96 @retval RETURN_NOT_FOUND Failed to find the video frame buffer information .\r
97\r
98**/\r
99RETURN_STATUS\r
100EFIAPI\r
101ParseGfxInfo (\r
102 OUT EFI_PEI_GRAPHICS_INFO_HOB *GfxInfo\r
103 );\r
104\r
105/**\r
106 Find the video frame buffer device information\r
107\r
108 @param GfxDeviceInfo Pointer to the EFI_PEI_GRAPHICS_DEVICE_INFO_HOB structure\r
109\r
110 @retval RETURN_SUCCESS Successfully find the video frame buffer information.\r
111 @retval RETURN_NOT_FOUND Failed to find the video frame buffer information .\r
112\r
113**/\r
114RETURN_STATUS\r
115EFIAPI\r
116ParseGfxDeviceInfo (\r
117 OUT EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *GfxDeviceInfo\r
118 );\r
119\r
120#endif\r