CbParseLib.h 5.5 KB

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