UsbOC.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /** @file
  2. @copyright
  3. Copyright 2018 - 2021 Intel Corporation. <BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #include "PeiBoardInit.h"
  7. #include <Library/PcdLib.h>
  8. #include <Library/UbaUsbOcUpdateLib.h>
  9. #include <PchLimits.h>
  10. #include <ConfigBlock/UsbConfig.h>
  11. #include <ConfigBlock/Usb2PhyConfig.h>
  12. USB_OVERCURRENT_PIN TypeBoardPortTemplateUsb20OverCurrentMappings[PCH_MAX_USB2_PORTS] = {
  13. UsbOverCurrentPin0,
  14. UsbOverCurrentPin1,
  15. UsbOverCurrentPin1,
  16. UsbOverCurrentPin2,
  17. UsbOverCurrentPin3,
  18. UsbOverCurrentPin3,
  19. UsbOverCurrentPin7,
  20. UsbOverCurrentPin7,
  21. UsbOverCurrentPin6,
  22. UsbOverCurrentPin4,
  23. UsbOverCurrentPin6,
  24. UsbOverCurrentPin4,
  25. UsbOverCurrentPin5,
  26. UsbOverCurrentPin4,
  27. UsbOverCurrentPinSkip,
  28. UsbOverCurrentPinSkip
  29. };
  30. USB_OVERCURRENT_PIN TypeBoardPortTemplateUsb30OverCurrentMappings[PCH_MAX_USB3_PORTS] = {
  31. UsbOverCurrentPin0,
  32. UsbOverCurrentPin1,
  33. UsbOverCurrentPin1,
  34. UsbOverCurrentPin2,
  35. UsbOverCurrentPin3,
  36. UsbOverCurrentPin3,
  37. UsbOverCurrentPinSkip,
  38. UsbOverCurrentPinSkip,
  39. UsbOverCurrentPinSkip,
  40. UsbOverCurrentPinSkip
  41. };
  42. USB2_PHY_PARAMETERS TypeBoardPortTemplateUsb20AfeParams[PCH_H_XHCI_MAX_USB2_PHYSICAL_PORTS] = {
  43. {3, 0, 3, 1}, // PP0
  44. {5, 0, 3, 1}, // PP1
  45. {3, 0, 3, 1}, // PP2
  46. {0, 5, 1, 1}, // PP3
  47. {3, 0, 3, 1}, // PP4
  48. {3, 0, 3, 1}, // PP5
  49. {3, 0, 3, 1}, // PP6
  50. {3, 0, 3, 1}, // PP7
  51. {2, 2, 1, 0}, // PP8
  52. {6, 0, 2, 1}, // PP9
  53. {2, 2, 1, 0}, // PP10
  54. {6, 0, 2, 1}, // PP11
  55. {0, 5, 1, 1}, // PP12
  56. {7, 0, 2, 1}, // PP13
  57. };
  58. EFI_STATUS
  59. TypeBoardPortTemplatePlatformUsbOcUpdateCallback (
  60. IN OUT USB_OVERCURRENT_PIN **Usb20OverCurrentMappings,
  61. IN OUT USB_OVERCURRENT_PIN **Usb30OverCurrentMappings,
  62. IN OUT USB2_PHY_PARAMETERS **Usb20AfeParams
  63. )
  64. {
  65. *Usb20OverCurrentMappings = &TypeBoardPortTemplateUsb20OverCurrentMappings[0];
  66. *Usb30OverCurrentMappings = &TypeBoardPortTemplateUsb30OverCurrentMappings[0];
  67. *Usb20AfeParams = TypeBoardPortTemplateUsb20AfeParams;
  68. return EFI_SUCCESS;
  69. }
  70. PLATFORM_USBOC_UPDATE_TABLE TypeBoardPortTemplateUsbOcUpdate =
  71. {
  72. PLATFORM_USBOC_UPDATE_SIGNATURE,
  73. PLATFORM_USBOC_UPDATE_VERSION,
  74. TypeBoardPortTemplatePlatformUsbOcUpdateCallback
  75. };
  76. EFI_STATUS
  77. TypeBoardPortTemplatePlatformUpdateUsbOcMappings (
  78. IN UBA_CONFIG_DATABASE_PPI *UbaConfigPpi
  79. )
  80. {
  81. //#
  82. //# USB, see PG 104 in GZP SCH
  83. //#
  84. // USB2 USB3 Port OC
  85. //
  86. //Port00: PORT5 Back Panel ,OC0#
  87. //Port01: PORT2 Back Panel ,OC0#
  88. //Port02: PORT3 Back Panel ,OC1#
  89. //Port03: PORT0 NOT USED ,NA
  90. //Port04: BMC1.0 ,NA
  91. //Port05: INTERNAL_2X5_A ,OC2#
  92. //Port06: INTERNAL_2X5_A ,OC2#
  93. //Port07: NOT USED ,NA
  94. //Port08: EUSB (AKA SSD) ,NA
  95. //Port09: INTERNAL_TYPEA ,OC6#
  96. //Port10: PORT1 Front Panel ,OC5#
  97. //Port11: NOT USED ,NA
  98. //Port12: BMC2.0 ,NA
  99. //Port13: PORT4 Front Panel ,OC5#
  100. EFI_STATUS Status;
  101. Status = UbaConfigPpi->AddData (
  102. UbaConfigPpi,
  103. &gPeiPlatformUbaOcConfigDataGuid,
  104. &TypeBoardPortTemplateUsbOcUpdate,
  105. sizeof(TypeBoardPortTemplateUsbOcUpdate)
  106. );
  107. return Status;
  108. }