IgfxI2c.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /** @file
  2. Intel Graphics I2C Bus I/O
  3. Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. <b>Conventions</b>:
  6. - Prefixes:
  7. - Definitions beginning with "R_" are registers
  8. - Definitions beginning with "B_" are bits within registers
  9. - Definitions beginning with "V_" are meaningful values of bits within the registers
  10. - Definitions beginning with "S_" are register sizes
  11. - Definitions beginning with "N_" are the bit position
  12. **/
  13. #include <Uefi/UefiBaseType.h>
  14. #include <Library/HdmiDebugPchDetectionLib.h>
  15. //
  16. // HDMI DDC Pin Pairs
  17. //
  18. #define V_CNL_PCH_HDMI_DDC_B_PIN_PAIR 0x01
  19. #define V_CNL_PCH_HDMI_DDC_C_PIN_PAIR 0x02
  20. #define V_CNL_PCH_HDMI_DDC_D_PIN_PAIR 0x04
  21. #define V_CNL_PCH_HDMI_DDC_F_PIN_PAIR 0x03
  22. #define V_KBL_PCH_HDMI_DDC_B_PIN_PAIR 0x05
  23. #define V_KBL_PCH_HDMI_DDC_C_PIN_PAIR 0x04
  24. #define V_KBL_PCH_HDMI_DDC_D_PIN_PAIR 0x06
  25. typedef enum {
  26. EnumDdcUnknown = 0,
  27. EnumDdcA,
  28. EnumDdcB,
  29. EnumDdcC,
  30. EnumDdcD,
  31. EnumDdcE,
  32. EnumDdcF,
  33. EnumI2cChannelMax
  34. } IGFX_I2C_CHANNEL;
  35. /**
  36. Returns the type of PCH on the system
  37. @retval The PCH type.
  38. **/
  39. PCH_TYPE
  40. GetPchType (
  41. VOID
  42. );
  43. /**
  44. Returns the GPIO pin pair to use for the given DDC channel
  45. @param[in] Channel - The DDC I2C channel.
  46. @param[out] DdcBusPinPair - The GPIO pin pair for the given DDC channel.
  47. @retval EFI_SUCCESS - The GPIO pin pair was successfully determined
  48. @retval EFI_INVALID_PARAMETER - The given DDC I2C channel does not exist.
  49. @retval EFI_UNSUPPORTED - The platform is using a PCH that is not supported yet.
  50. **/
  51. EFI_STATUS
  52. GetGmbusBusPinPair (
  53. IN IGFX_I2C_CHANNEL Channel,
  54. OUT UINT8 *DdcBusPinPair
  55. );
  56. /**
  57. Returns the GPIO pin pair to use for the I2C HDMI debug port
  58. @param[out] DdcBusPinPair - The GPIO pin pair for the I2C HDMI debug port.
  59. @retval EFI_SUCCESS - The GPIO pin pair was successfully determined
  60. @retval EFI_INVALID_PARAMETER - The given DDC I2C channel does not exist.
  61. @retval EFI_UNSUPPORTED - The platform is using a PCH that is not supported yet.
  62. **/
  63. EFI_STATUS
  64. GetGmbusBusPinPairForI2cDebugPort (
  65. OUT UINT8 *DdcBusPinPair
  66. );
  67. /**
  68. For boot phases that utilize task priority levels (TPLs), this function raises
  69. the TPL to the appriopriate level needed to execute I/O to the I2C Debug Port
  70. **/
  71. VOID
  72. RaiseTplForI2cDebugPortAccess (
  73. VOID
  74. );
  75. /**
  76. For boot phases that utilize task priority levels (TPLs), this function
  77. restores the TPL to the previous level after I/O to the I2C Debug Port is
  78. complete
  79. **/
  80. VOID
  81. RestoreTplAfterI2cDebugPortAccess (
  82. VOID
  83. );