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 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 http://opensource.org/licenses/bsd-license.php 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 14 **/ 15 #include <Guid/FrameBufferInfoGuid.h> 16 17 typedef RETURN_STATUS \ 18 (*CB_MEM_INFO_CALLBACK) (UINT64 Base, UINT64 Size, UINT32 Type, VOID *Param); 19 20 /** 21 Find coreboot record with given Tag from the memory Start in 4096 22 bytes range. 23 24 @param Start The start memory to be searched in 25 @param Tag The tag id to be found 26 27 @retval NULL The Tag is not found. 28 @retval Others The poiter to the record found. 29 30 **/ 31 VOID * 32 EFIAPI 33 FindCbTag ( 34 IN VOID *Start, 35 IN UINT32 Tag 36 ); 37 38 /** 39 Acquire the memory information from the coreboot table in memory. 40 41 @param MemInfoCallback The callback routine 42 @param pParam Pointer to the callback routine parameter 43 44 @retval RETURN_SUCCESS Successfully find out the memory information. 45 @retval RETURN_NOT_FOUND Failed to find the memory information. 46 47 **/ 48 RETURN_STATUS 49 EFIAPI 50 CbParseMemoryInfo ( 51 IN CB_MEM_INFO_CALLBACK MemInfoCallback, 52 IN VOID *pParam 53 ); 54 55 /** 56 Acquire the coreboot memory table with the given table id 57 58 @param TableId Table id to be searched 59 @param pMemTable Pointer to the base address of the memory table 60 @param pMemTableSize Pointer to the size of the memory table 61 62 @retval RETURN_SUCCESS Successfully find out the memory table. 63 @retval RETURN_INVALID_PARAMETER Invalid input parameters. 64 @retval RETURN_NOT_FOUND Failed to find the memory table. 65 66 **/ 67 RETURN_STATUS 68 EFIAPI 69 CbParseCbMemTable ( 70 IN UINT32 TableId, 71 IN VOID** pMemTable, 72 IN UINT32* pMemTableSize 73 ); 74 75 /** 76 Acquire the acpi table from coreboot 77 78 @param pMemTable Pointer to the base address of the memory table 79 @param pMemTableSize Pointer to the size of the memory table 80 81 @retval RETURN_SUCCESS Successfully find out the memory table. 82 @retval RETURN_INVALID_PARAMETER Invalid input parameters. 83 @retval RETURN_NOT_FOUND Failed to find the memory table. 84 85 **/ 86 RETURN_STATUS 87 EFIAPI 88 CbParseAcpiTable ( 89 IN VOID** pMemTable, 90 IN UINT32* pMemTableSize 91 ); 92 93 /** 94 Acquire the smbios table from coreboot 95 96 @param pMemTable Pointer to the base address of the memory table 97 @param pMemTableSize Pointer to the size of the memory table 98 99 @retval RETURN_SUCCESS Successfully find out the memory table. 100 @retval RETURN_INVALID_PARAMETER Invalid input parameters. 101 @retval RETURN_NOT_FOUND Failed to find the memory table. 102 103 **/ 104 RETURN_STATUS 105 EFIAPI 106 CbParseSmbiosTable ( 107 IN VOID** pMemTable, 108 IN UINT32* pMemTableSize 109 ); 110 111 /** 112 Find the required fadt information 113 114 @param pPmCtrlReg Pointer to the address of power management control register 115 @param pPmTimerReg Pointer to the address of power management timer register 116 @param pResetReg Pointer to the address of system reset register 117 @param pResetValue Pointer to the value to be writen to the system reset register 118 @param pPmEvtReg Pointer to the address of power management event register 119 @param pPmGpeEnReg Pointer to the address of power management GPE enable register 120 121 @retval RETURN_SUCCESS Successfully find out all the required fadt information. 122 @retval RETURN_NOT_FOUND Failed to find the fadt table. 123 124 **/ 125 RETURN_STATUS 126 EFIAPI 127 CbParseFadtInfo ( 128 IN UINTN* pPmCtrlReg, 129 IN UINTN* pPmTimerReg, 130 IN UINTN* pResetReg, 131 IN UINTN* pResetValue, 132 IN UINTN* pPmEvtReg, 133 IN UINTN* pPmGpeEnReg 134 ); 135 136 /** 137 Find the serial port information 138 139 @param pRegBase Pointer to the base address of serial port registers 140 @param pRegAccessType Pointer to the access type of serial port registers 141 @param pRegWidth Pointer to the register width in bytes 142 @param pBaudrate Pointer to the serial port baudrate 143 @param pInputHertz Pointer to the input clock frequency 144 @param pUartPciAddr Pointer to the UART PCI bus, dev and func address 145 146 @retval RETURN_SUCCESS Successfully find the serial port information. 147 @retval RETURN_NOT_FOUND Failed to find the serial port information . 148 149 **/ 150 RETURN_STATUS 151 EFIAPI 152 CbParseSerialInfo ( 153 OUT UINT32 *pRegBase, 154 OUT UINT32 *pRegAccessType, 155 OUT UINT32 *pRegWidth, 156 OUT UINT32 *pBaudrate, 157 OUT UINT32 *pInputHertz, 158 OUT UINT32 *pUartPciAddr 159 ); 160 161 /** 162 Search for the coreboot table header 163 164 @param Level Level of the search depth 165 @param HeaderPtr Pointer to the pointer of coreboot table header 166 167 @retval RETURN_SUCCESS Successfully find the coreboot table header . 168 @retval RETURN_NOT_FOUND Failed to find the coreboot table header . 169 170 **/ 171 RETURN_STATUS 172 EFIAPI 173 CbParseGetCbHeader ( 174 IN UINTN Level, 175 IN VOID** HeaderPtr 176 ); 177 178 /** 179 Find the video frame buffer information 180 181 @param pFbInfo Pointer to the FRAME_BUFFER_INFO structure 182 183 @retval RETURN_SUCCESS Successfully find the video frame buffer information. 184 @retval RETURN_NOT_FOUND Failed to find the video frame buffer information . 185 186 **/ 187 RETURN_STATUS 188 EFIAPI 189 CbParseFbInfo ( 190 IN FRAME_BUFFER_INFO* pFbInfo 191 ); 192 193