]> git.proxmox.com Git - mirror_edk2.git/blob - CorebootModulePkg/Include/Library/CbParseLib.h
1312410cccd14a946bb5a8aaf95b8ba49bb43176
[mirror_edk2.git] / CorebootModulePkg / Include / Library / CbParseLib.h
1 /** @file
2 This library will parse the coreboot table in memory and extract those required
3 information.
4
5 Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9 #include <Guid/FrameBufferInfoGuid.h>
10
11 typedef RETURN_STATUS \
12 (*CB_MEM_INFO_CALLBACK) (UINT64 Base, UINT64 Size, UINT32 Type, VOID *Param);
13
14 /**
15 Find coreboot record with given Tag from the memory Start in 4096
16 bytes range.
17
18 @param Start The start memory to be searched in
19 @param Tag The tag id to be found
20
21 @retval NULL The Tag is not found.
22 @retval Others The pointer to the record found.
23
24 **/
25 VOID *
26 EFIAPI
27 FindCbTag (
28 IN VOID *Start,
29 IN UINT32 Tag
30 );
31
32 /**
33 Acquire the memory information from the coreboot table in memory.
34
35 @param MemInfoCallback The callback routine
36 @param pParam Pointer to the callback routine parameter
37
38 @retval RETURN_SUCCESS Successfully find out the memory information.
39 @retval RETURN_NOT_FOUND Failed to find the memory information.
40
41 **/
42 RETURN_STATUS
43 EFIAPI
44 CbParseMemoryInfo (
45 IN CB_MEM_INFO_CALLBACK MemInfoCallback,
46 IN VOID *pParam
47 );
48
49 /**
50 Acquire the coreboot memory table with the given table id
51
52 @param TableId Table id to be searched
53 @param pMemTable Pointer to the base address of the memory table
54 @param pMemTableSize Pointer to the size of the memory table
55
56 @retval RETURN_SUCCESS Successfully find out the memory table.
57 @retval RETURN_INVALID_PARAMETER Invalid input parameters.
58 @retval RETURN_NOT_FOUND Failed to find the memory table.
59
60 **/
61 RETURN_STATUS
62 EFIAPI
63 CbParseCbMemTable (
64 IN UINT32 TableId,
65 IN VOID** pMemTable,
66 IN UINT32* pMemTableSize
67 );
68
69 /**
70 Acquire the acpi table from coreboot
71
72 @param pMemTable Pointer to the base address of the memory table
73 @param pMemTableSize Pointer to the size of the memory table
74
75 @retval RETURN_SUCCESS Successfully find out the memory table.
76 @retval RETURN_INVALID_PARAMETER Invalid input parameters.
77 @retval RETURN_NOT_FOUND Failed to find the memory table.
78
79 **/
80 RETURN_STATUS
81 EFIAPI
82 CbParseAcpiTable (
83 IN VOID** pMemTable,
84 IN UINT32* pMemTableSize
85 );
86
87 /**
88 Acquire the smbios table from coreboot
89
90 @param pMemTable Pointer to the base address of the memory table
91 @param pMemTableSize Pointer to the size of the memory table
92
93 @retval RETURN_SUCCESS Successfully find out the memory table.
94 @retval RETURN_INVALID_PARAMETER Invalid input parameters.
95 @retval RETURN_NOT_FOUND Failed to find the memory table.
96
97 **/
98 RETURN_STATUS
99 EFIAPI
100 CbParseSmbiosTable (
101 IN VOID** pMemTable,
102 IN UINT32* pMemTableSize
103 );
104
105 /**
106 Find the required fadt information
107
108 @param pPmCtrlReg Pointer to the address of power management control register
109 @param pPmTimerReg Pointer to the address of power management timer register
110 @param pResetReg Pointer to the address of system reset register
111 @param pResetValue Pointer to the value to be written to the system reset register
112 @param pPmEvtReg Pointer to the address of power management event register
113 @param pPmGpeEnReg Pointer to the address of power management GPE enable register
114
115 @retval RETURN_SUCCESS Successfully find out all the required fadt information.
116 @retval RETURN_NOT_FOUND Failed to find the fadt table.
117
118 **/
119 RETURN_STATUS
120 EFIAPI
121 CbParseFadtInfo (
122 IN UINTN* pPmCtrlReg,
123 IN UINTN* pPmTimerReg,
124 IN UINTN* pResetReg,
125 IN UINTN* pResetValue,
126 IN UINTN* pPmEvtReg,
127 IN UINTN* pPmGpeEnReg
128 );
129
130 /**
131 Find the serial port information
132
133 @param pRegBase Pointer to the base address of serial port registers
134 @param pRegAccessType Pointer to the access type of serial port registers
135 @param pRegWidth Pointer to the register width in bytes
136 @param pBaudrate Pointer to the serial port baudrate
137 @param pInputHertz Pointer to the input clock frequency
138 @param pUartPciAddr Pointer to the UART PCI bus, dev and func address
139
140 @retval RETURN_SUCCESS Successfully find the serial port information.
141 @retval RETURN_NOT_FOUND Failed to find the serial port information .
142
143 **/
144 RETURN_STATUS
145 EFIAPI
146 CbParseSerialInfo (
147 OUT UINT32 *pRegBase,
148 OUT UINT32 *pRegAccessType,
149 OUT UINT32 *pRegWidth,
150 OUT UINT32 *pBaudrate,
151 OUT UINT32 *pInputHertz,
152 OUT UINT32 *pUartPciAddr
153 );
154
155 /**
156 Search for the coreboot table header
157
158 @param Level Level of the search depth
159 @param HeaderPtr Pointer to the pointer of coreboot table header
160
161 @retval RETURN_SUCCESS Successfully find the coreboot table header .
162 @retval RETURN_NOT_FOUND Failed to find the coreboot table header .
163
164 **/
165 RETURN_STATUS
166 EFIAPI
167 CbParseGetCbHeader (
168 IN UINTN Level,
169 IN VOID** HeaderPtr
170 );
171
172 /**
173 Find the video frame buffer information
174
175 @param pFbInfo Pointer to the FRAME_BUFFER_INFO structure
176
177 @retval RETURN_SUCCESS Successfully find the video frame buffer information.
178 @retval RETURN_NOT_FOUND Failed to find the video frame buffer information .
179
180 **/
181 RETURN_STATUS
182 EFIAPI
183 CbParseFbInfo (
184 IN FRAME_BUFFER_INFO* pFbInfo
185 );
186