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