ArmadaBoardDescLib.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /**
  2. *
  3. * Copyright (C) 2018, Marvell International Ltd. and its affiliates
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause-Patent
  6. *
  7. **/
  8. #ifndef __ARMADA_BOARD_DESC_LIB_H__
  9. #define __ARMADA_BOARD_DESC_LIB_H__
  10. #include <Library/ArmadaSoCDescLib.h>
  11. #include <Library/MvGpioLib.h>
  12. //
  13. // General purpose routine for per-board initalization
  14. //
  15. EFI_STATUS
  16. EFIAPI
  17. ArmadaBoardInit (
  18. VOID
  19. );
  20. //
  21. // COMPHY controllers per-board description
  22. //
  23. typedef struct {
  24. MV_SOC_COMPHY_DESC *SoC;
  25. UINTN ComPhyDevCount;
  26. } MV_BOARD_COMPHY_DESC;
  27. //
  28. // GPIO devices per-board description
  29. //
  30. typedef struct {
  31. UINTN ChipId;
  32. UINTN I2cAddress;
  33. UINTN I2cBus;
  34. } MV_GPIO_EXPANDER;
  35. typedef struct {
  36. GPIO_CONTROLLER *SoCGpio;
  37. UINTN GpioDeviceCount;
  38. MV_GPIO_EXPANDER *GpioExpanders;
  39. UINTN GpioExpanderCount;
  40. } MV_BOARD_GPIO_DESCRIPTION;
  41. EFI_STATUS
  42. EFIAPI
  43. ArmadaBoardGpioExpanderGet (
  44. IN OUT MV_GPIO_EXPANDER **GpioExpanders,
  45. IN OUT UINTN *GpioExpanderCount
  46. );
  47. //
  48. // I2C devices per-board description
  49. //
  50. typedef struct {
  51. MV_SOC_I2C_DESC *SoC;
  52. UINTN I2cDevCount;
  53. } MV_BOARD_I2C_DESC;
  54. //
  55. // MDIO devices per-board description
  56. //
  57. typedef struct {
  58. MV_SOC_MDIO_DESC *SoC;
  59. UINTN MdioDevCount;
  60. } MV_BOARD_MDIO_DESC;
  61. //
  62. // NonDiscoverableDevices per-board description
  63. //
  64. //
  65. // AHCI devices per-board description
  66. //
  67. typedef struct {
  68. MV_SOC_AHCI_DESC *SoC;
  69. UINTN AhciDevCount;
  70. } MV_BOARD_AHCI_DESC;
  71. //
  72. // SDMMC devices per-board description
  73. //
  74. typedef enum {
  75. RemovableSlot,
  76. EmbeddedSlot,
  77. SharedBusSlot,
  78. UnknownSlot
  79. } MV_SDMMC_SLOT_TYPE;
  80. typedef struct {
  81. MV_SOC_SDMMC_DESC *SoC;
  82. UINTN SdMmcDevCount;
  83. BOOLEAN Xenon1v8Enabled;
  84. BOOLEAN Xenon8BitBusEnabled;
  85. BOOLEAN XenonSlowModeEnabled;
  86. UINT8 XenonTuningStepDivisor;
  87. MV_SDMMC_SLOT_TYPE SlotType;
  88. } MV_BOARD_SDMMC_DESC;
  89. EFI_STATUS
  90. EFIAPI
  91. ArmadaBoardDescSdMmcGet (
  92. OUT UINTN *SdMmcDevCount,
  93. OUT MV_BOARD_SDMMC_DESC **SdMmcDesc
  94. );
  95. //
  96. // XHCI devices per-board description
  97. //
  98. typedef struct {
  99. MV_SOC_XHCI_DESC *SoC;
  100. UINTN XhciDevCount;
  101. } MV_BOARD_XHCI_DESC;
  102. //
  103. // PCIE controllers description
  104. //
  105. typedef struct {
  106. EFI_PHYSICAL_ADDRESS PcieDbiAddress;
  107. EFI_PHYSICAL_ADDRESS ConfigSpaceAddress;
  108. UINT64 ConfigSpaceSize;
  109. BOOLEAN HaveResetGpio;
  110. MV_GPIO_PIN PcieResetGpio;
  111. UINT64 PcieBusMin;
  112. UINT64 PcieBusMax;
  113. UINT64 PcieIoTranslation;
  114. UINT64 PcieIoWinBase;
  115. UINT64 PcieIoWinSize;
  116. UINT64 PcieMmio32Translation;
  117. UINT64 PcieMmio32WinBase;
  118. UINT64 PcieMmio32WinSize;
  119. UINT64 PcieMmio64Translation;
  120. UINT64 PcieMmio64WinBase;
  121. UINT64 PcieMmio64WinSize;
  122. } MV_PCIE_CONTROLLER;
  123. typedef struct {
  124. MV_PCIE_CONTROLLER CONST *PcieControllers;
  125. UINTN PcieControllerCount;
  126. } MV_BOARD_PCIE_DESCRIPTION;
  127. /**
  128. Return the number and description of PCIE controllers used on the platform.
  129. @param[in out] **PcieControllers Array containing PCIE controllers'
  130. description.
  131. @param[in out] *PcieControllerCount Amount of used PCIE controllers.
  132. @retval EFI_SUCCESS The data were obtained successfully.
  133. @retval EFI_NOT_FOUND None of the controllers is used.
  134. @retval other Return error status.
  135. **/
  136. EFI_STATUS
  137. EFIAPI
  138. ArmadaBoardPcieControllerGet (
  139. IN OUT MV_PCIE_CONTROLLER CONST **PcieControllers,
  140. IN OUT UINTN *PcieControllerCount
  141. );
  142. //
  143. // PP2 NIC devices per-board description
  144. //
  145. typedef struct {
  146. MV_SOC_PP2_DESC *SoC;
  147. UINT8 Pp2DevCount;
  148. } MV_BOARD_PP2_DESC;
  149. //
  150. // UTMI PHY devices per-board description
  151. //
  152. typedef struct {
  153. MV_SOC_UTMI_DESC *SoC;
  154. UINTN UtmiDevCount;
  155. UINTN UtmiPortType;
  156. } MV_BOARD_UTMI_DESC;
  157. #endif /* __ARMADA_SOC_DESC_LIB_H__ */