SystemBoardPei.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /** @file
  2. Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
  3. SPDX-License-Identifier: BSD-2-Clause-Patent
  4. **/
  5. #ifndef _EFI_SYSTEM_BOARD_PPI_H_
  6. #define _EFI_SYSTEM_BOARD_PPI_H_
  7. #include <Platform.h>
  8. #include <Library/MmPciBaseLib.h>
  9. #include <Pi/PiHob.h>
  10. // GUID
  11. #include <Guid/SetupVariable.h>
  12. #include <Guid/SocketIioVariable.h>
  13. // PPI
  14. #include <Ppi/PchPolicy.h>
  15. #include <Ppi/SystemBoard.h>
  16. #include <Ppi/ReadOnlyVariable2.h>
  17. #include <Ppi/Smbus2.h>
  18. // Library
  19. #include <Library/BaseMemoryLib.h>
  20. #include <Library/DebugLib.h>
  21. #include <Library/PeiServicesLib.h>
  22. #include <Library/BaseLib.h>
  23. #include <Library/PciLib.h>
  24. #include <Library/IoLib.h>
  25. #include <Library/PcdLib.h>
  26. #include <Library/HobLib.h>
  27. #include <Library/PciExpressLib.h>
  28. #include <Library/GpioLib.h>
  29. #include <Library/PeiServicesTablePointerLib.h>
  30. #include <Library/PchInfoLib.h>
  31. #include <Platform.h>
  32. #include <GpioPinsSklH.h>
  33. #include <Library/GpioLib.h>
  34. #include <IioBifurcationSlotTable.h>
  35. // CMOS access Port address
  36. #define LAST_CMOS_BYTE 0x7F
  37. #define NMI_OFF 0x80
  38. #define B_PCH_RTC_REGB_SRBRST 0x02 // Value to be reset to during POST
  39. #define R_PCH_RTC_REGD 0x0D // CMOS Register D Status
  40. #define R_PCH_RTC_REGE 0x0E // CMOS Register E Status
  41. #define B_PCH_RTC_REGE_INVTIM 0x04 // CMOS invalid time found
  42. #define TIMER1_CONTROL_PORT 0x43
  43. #define TIMER1_COUNT_PORT 0x41
  44. #define LOAD_COUNTER1_LSB 0x54
  45. #define COUNTER1_COUNT 0x12
  46. //
  47. // Reset Generator I/O Port
  48. //
  49. #define RESET_GENERATOR_PORT 0xCF9
  50. //-----------------------------------------------------------------------;
  51. // PCH: Chipset Configuration Register Equates
  52. //-----------------------------------------------------------------------;
  53. #define ICH_RCRB_IRQ0 0
  54. #define ICH_RCRB_IRQA 1
  55. #define ICH_RCRB_IRQB 2
  56. #define ICH_RCRB_IRQC 3
  57. #define ICH_RCRB_IRQD 4
  58. #define ICH_RCRB_PIRQA 0
  59. #define ICH_RCRB_PIRQB 1
  60. #define ICH_RCRB_PIRQC 2
  61. #define ICH_RCRB_PIRQD 3
  62. #define ICH_RCRB_PIRQE 4
  63. #define ICH_RCRB_PIRQF 5
  64. #define ICH_RCRB_PIRQG 6
  65. #define ICH_RCRB_PIRQH 7
  66. //
  67. // From WBG Soft Straps WIP.xlsx
  68. //
  69. #define WBG_DOWNSKU_STRAP_DSKU 0x80046000
  70. #define WBG_DOWNSKU_STRAP_BSKU 0x8004E003
  71. #define WBG_DOWNSKU_STRAP_TSKU 0x00044000
  72. #define PCHSTRAP_9 9
  73. #define PCHSTRAP_10 10
  74. #define PCHSTRAP_16 16
  75. #define PCHSTRAP_17 17
  76. #define RESET_PORT 0x0CF9
  77. #define CLEAR_RESET_BITS 0x0F1
  78. #define COLD_RESET 0x02 // Set bit 1 for cold reset
  79. #define RST_CPU 0x04 // Setting this bit triggers a reset of the CPU
  80. #define FULL_RESET 0x08 // Set bit 4 with bit 1 for full reset
  81. //
  82. // PPI functions
  83. //
  84. VOID
  85. SetBifurcations(
  86. IN OUT IIO_GLOBALS *IioGlobalData,
  87. IN IIO_BIFURCATION_ENTRY *BifurcationTable,
  88. IN UINT8 BifurcationEntries
  89. );
  90. VOID
  91. EnableHotPlug (
  92. IN OUT IIO_GLOBALS *IioGlobalData,
  93. IN UINT8 Port,
  94. IN UINT8 VppPort,
  95. IN UINT8 VppAddress,
  96. IN UINT8 PortOwnership
  97. );
  98. VOID
  99. ConfigSlots (
  100. IN OUT IIO_GLOBALS *IioGlobalData,
  101. IN IIO_SLOT_CONFIG_ENTRY *Slot,
  102. IN UINT8 SlotEntries
  103. );
  104. VOID
  105. OverrideConfigSlots (
  106. IN OUT IIO_GLOBALS *IioGlobalData,
  107. IN IIO_SLOT_CONFIG_ENTRY *Slot,
  108. IN UINT8 SlotEntries
  109. );
  110. VOID
  111. CalculatePEXPHideFromIouBif (
  112. IN UINT8 Iou,
  113. IN UINT8 IioIndex,
  114. IN OUT IIO_GLOBALS *IioGlobalData
  115. );
  116. VOID
  117. DumpIioConfiguration(
  118. IN UINT8 iio,
  119. IN IIO_GLOBALS *IioGlobalData
  120. );
  121. VOID
  122. OverrideDefaultBifSlots(
  123. IN IIO_GLOBALS *IioGlobalData
  124. );
  125. UINT8
  126. GetUplinkPortInformationCommon (
  127. IN UINT8 IioIndex
  128. );
  129. VOID
  130. SystemIioPortBifurcationInitCommon (
  131. IIO_GLOBALS *IioGlobalData,
  132. IIO_BIFURCATION_ENTRY **BifurcationTable,
  133. UINT8 *BifurcationEntries,
  134. IIO_SLOT_CONFIG_ENTRY **SlotTable,
  135. UINT8 *SlotEntries
  136. );
  137. VOID
  138. SystemHideIioPortsCommon(
  139. IIO_GLOBALS *IioGlobalData,
  140. UINT8 IioIndex
  141. );
  142. UINT8
  143. GetUplinkPortInformation (
  144. IN UINT8 IioIndex
  145. );
  146. VOID
  147. SystemIioPortBifurcationInit (
  148. IN IIO_GLOBALS *IioGlobalData
  149. );
  150. #endif