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