]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CorebootModulePkg/Include/Library/CbParseLib.h
Pkg-Module: CorebootModulePkg
[mirror_edk2.git] / CorebootModulePkg / Include / Library / CbParseLib.h
diff --git a/CorebootModulePkg/Include/Library/CbParseLib.h b/CorebootModulePkg/Include/Library/CbParseLib.h
new file mode 100644 (file)
index 0000000..36727d3
--- /dev/null
@@ -0,0 +1,154 @@
+/** @file\r
+  This library will parse the coreboot table in memory and extract those required\r
+  information.\r
+\r
+  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+#include <Guid/FrameBufferInfoGuid.h>\r
+\r
+/**\r
+  Acquire the memory information from the coreboot table in memory.\r
+\r
+  @param  pLowMemorySize     Pointer to the variable of low memory size\r
+  @param  pHighMemorySize    Pointer to the variable of high memory size\r
+\r
+  @retval RETURN_SUCCESS     Successfully find out the memory information.\r
+  @retval RETURN_INVALID_PARAMETER    Invalid input parameters.\r
+  @retval RETURN_NOT_FOUND   Failed to find the memory information.\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseMemoryInfo (\r
+  IN UINT64*    pLowMemorySize,\r
+  IN UINT64*    pHighMemorySize\r
+  );\r
+  \r
+/**\r
+  Acquire the coreboot memory table with the given table id\r
+\r
+  @param  TableId            Table id to be searched\r
+  @param  pMemTable          Pointer to the base address of the memory table\r
+  @param  pMemTableSize      Pointer to the size of the memory table\r
+\r
+  @retval RETURN_SUCCESS     Successfully find out the memory table.\r
+  @retval RETURN_INVALID_PARAMETER  Invalid input parameters.\r
+  @retval RETURN_NOT_FOUND   Failed to find the memory table.\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseCbMemTable (\r
+  IN UINT32     TableId, \r
+  IN VOID**     pMemTable,\r
+  IN UINT32*    pMemTableSize\r
+  );\r
+  \r
+/**\r
+  Acquire the acpi table from coreboot\r
+\r
+  @param  pMemTable          Pointer to the base address of the memory table\r
+  @param  pMemTableSize      Pointer to the size of the memory table\r
+\r
+  @retval RETURN_SUCCESS     Successfully find out the memory table.\r
+  @retval RETURN_INVALID_PARAMETER  Invalid input parameters.\r
+  @retval RETURN_NOT_FOUND   Failed to find the memory table.\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseAcpiTable (\r
+  IN VOID**     pMemTable,\r
+  IN UINT32*    pMemTableSize\r
+  );\r
+  \r
+/**\r
+  Acquire the smbios table from coreboot\r
+\r
+  @param  pMemTable          Pointer to the base address of the memory table\r
+  @param  pMemTableSize      Pointer to the size of the memory table\r
+\r
+  @retval RETURN_SUCCESS     Successfully find out the memory table.\r
+  @retval RETURN_INVALID_PARAMETER  Invalid input parameters.\r
+  @retval RETURN_NOT_FOUND   Failed to find the memory table.\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseSmbiosTable (\r
+  IN VOID**     pMemTable,\r
+  IN UINT32*    pMemTableSize\r
+  );\r
+  \r
+/**\r
+  Find the required fadt information\r
+\r
+  @param  pPmCtrlReg         Pointer to the address of power management control register\r
+  @param  pPmTimerReg        Pointer to the address of power management timer register\r
+  @param  pResetReg          Pointer to the address of system reset register\r
+  @param  pResetValue        Pointer to the value to be writen to the system reset register\r
+\r
+  @retval RETURN_SUCCESS     Successfully find out all the required fadt information.\r
+  @retval RETURN_NOT_FOUND   Failed to find the fadt table.\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseFadtInfo (\r
+  IN UINTN*     pPmCtrlReg,\r
+  IN UINTN*     pPmTimerReg,\r
+  IN UINTN*     pResetReg,\r
+  IN UINTN*     pResetValue\r
+  );\r
+  \r
+/**\r
+  Find the serial port information\r
+\r
+  @param  pRegBase           Pointer to the base address of serial port registers\r
+  @param  pRegAccessType     Pointer to the access type of serial port registers\r
+  @param  pBaudrate          Pointer to the serial port baudrate\r
+\r
+  @retval RETURN_SUCCESS     Successfully find the serial port information.\r
+  @retval RETURN_NOT_FOUND   Failed to find the serial port information .\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseSerialInfo (\r
+  IN UINT32*     pRegBase,\r
+  IN UINT32*     pRegAccessType,\r
+  IN UINT32*     pBaudrate\r
+  );\r
+\r
+/**\r
+  Search for the coreboot table header\r
+\r
+  @param  Level              Level of the search depth\r
+  @param  HeaderPtr          Pointer to the pointer of coreboot table header\r
+\r
+  @retval RETURN_SUCCESS     Successfully find the coreboot table header .\r
+  @retval RETURN_NOT_FOUND   Failed to find the coreboot table header .\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseGetCbHeader (\r
+  IN UINTN  Level,\r
+  IN VOID** HeaderPtr\r
+  );\r
+  \r
+/**\r
+  Find the video frame buffer information\r
+\r
+  @param  pFbInfo            Pointer to the FRAME_BUFFER_INFO structure\r
+\r
+  @retval RETURN_SUCCESS     Successfully find the video frame buffer information.\r
+  @retval RETURN_NOT_FOUND   Failed to find the video frame buffer information .\r
+\r
+**/\r
+RETURN_STATUS\r
+CbParseFbInfo (\r
+  IN FRAME_BUFFER_INFO*     pFbInfo\r
+  );\r
+\r