pm.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * From coreboot src/soc/intel/broadwell/include/soc/pm.h
  4. *
  5. * Copyright (C) 2016 Google, Inc.
  6. */
  7. #ifndef __ASM_ARCH_PM_H
  8. #define __ASM_ARCH_PM_H
  9. #define PM1_STS 0x00
  10. #define WAK_STS (1 << 15)
  11. #define PCIEXPWAK_STS (1 << 14)
  12. #define PRBTNOR_STS (1 << 11)
  13. #define RTC_STS (1 << 10)
  14. #define PWRBTN_STS (1 << 8)
  15. #define GBL_STS (1 << 5)
  16. #define BM_STS (1 << 4)
  17. #define TMROF_STS (1 << 0)
  18. #define PM1_EN 0x02
  19. #define PCIEXPWAK_DIS (1 << 14)
  20. #define RTC_EN (1 << 10)
  21. #define PWRBTN_EN (1 << 8)
  22. #define GBL_EN (1 << 5)
  23. #define TMROF_EN (1 << 0)
  24. #define PM1_CNT 0x04
  25. #define SLP_EN (1 << 13)
  26. #define SLP_TYP (7 << 10)
  27. #define SLP_TYP_SHIFT 10
  28. #define SLP_TYP_S0 0
  29. #define SLP_TYP_S1 1
  30. #define SLP_TYP_S3 5
  31. #define SLP_TYP_S4 6
  32. #define SLP_TYP_S5 7
  33. #define GBL_RLS (1 << 2)
  34. #define BM_RLD (1 << 1)
  35. #define SCI_EN (1 << 0)
  36. #define PM1_TMR 0x08
  37. #define SMI_EN 0x30
  38. #define XHCI_SMI_EN (1 << 31)
  39. #define ME_SMI_EN (1 << 30)
  40. #define GPIO_UNLOCK_SMI_EN (1 << 27)
  41. #define INTEL_USB2_EN (1 << 18)
  42. #define LEGACY_USB2_EN (1 << 17)
  43. #define PERIODIC_EN (1 << 14)
  44. #define TCO_EN (1 << 13)
  45. #define MCSMI_EN (1 << 11)
  46. #define BIOS_RLS (1 << 7)
  47. #define SWSMI_TMR_EN (1 << 6)
  48. #define APMC_EN (1 << 5)
  49. #define SLP_SMI_EN (1 << 4)
  50. #define LEGACY_USB_EN (1 << 3)
  51. #define BIOS_EN (1 << 2)
  52. #define EOS (1 << 1)
  53. #define GBL_SMI_EN (1 << 0)
  54. #define SMI_STS 0x34
  55. #define UPWRC 0x3c
  56. #define UPWRC_WS (1 << 8)
  57. #define UPWRC_WE (1 << 1)
  58. #define UPWRC_SMI (1 << 0)
  59. #define GPE_CNTL 0x42
  60. #define SWGPE_CTRL (1 << 1)
  61. #define DEVACT_STS 0x44
  62. #define PM2_CNT 0x50
  63. #define TCO1_CNT 0x60
  64. #define TCO_TMR_HLT (1 << 11)
  65. #define TCO1_STS 0x64
  66. #define DMISCI_STS (1 << 9)
  67. #define TCO2_STS 0x66
  68. #define TCO2_STS_SECOND_TO (1 << 1)
  69. #define GPE0_REG_MAX 4
  70. #define GPE0_REG_SIZE 32
  71. #define GPE0_STS(x) (0x80 + (x * 4))
  72. #define GPE_31_0 0 /* 0x80/0x90 = GPE[31:0] */
  73. #define GPE_63_32 1 /* 0x84/0x94 = GPE[63:32] */
  74. #define GPE_94_64 2 /* 0x88/0x98 = GPE[94:64] */
  75. #define GPE_STD 3 /* 0x8c/0x9c = Standard GPE */
  76. #define WADT_STS (1 << 18)
  77. #define GP27_STS (1 << 16)
  78. #define PME_B0_STS (1 << 13)
  79. #define ME_SCI_STS (1 << 12)
  80. #define PME_STS (1 << 11)
  81. #define BATLOW_STS (1 << 10)
  82. #define PCI_EXP_STS (1 << 9)
  83. #define SMB_WAK_STS (1 << 7)
  84. #define TCOSCI_STS (1 << 6)
  85. #define SWGPE_STS (1 << 2)
  86. #define HOT_PLUG_STS (1 << 1)
  87. #define GPE0_EN(x) (0x90 + (x * 4))
  88. #define WADT_en (1 << 18)
  89. #define GP27_EN (1 << 16)
  90. #define PME_B0_EN (1 << 13)
  91. #define ME_SCI_EN (1 << 12)
  92. #define PME_EN (1 << 11)
  93. #define BATLOW_EN (1 << 10)
  94. #define PCI_EXP_EN (1 << 9)
  95. #define TCOSCI_EN (1 << 6)
  96. #define SWGPE_EN (1 << 2)
  97. #define HOT_PLUG_EN (1 << 1)
  98. #define MAINBOARD_POWER_OFF 0
  99. #define MAINBOARD_POWER_ON 1
  100. #define MAINBOARD_POWER_KEEP 2
  101. #define SLEEP_STATE_S0 0
  102. #define SLEEP_STATE_S3 3
  103. #define SLEEP_STATE_S5 5
  104. struct chipset_power_state {
  105. uint16_t pm1_sts;
  106. uint16_t pm1_en;
  107. uint32_t pm1_cnt;
  108. uint16_t tco1_sts;
  109. uint16_t tco2_sts;
  110. uint32_t gpe0_sts[4];
  111. uint32_t gpe0_en[4];
  112. uint16_t gen_pmcon1;
  113. uint16_t gen_pmcon2;
  114. uint16_t gen_pmcon3;
  115. int prev_sleep_state;
  116. uint16_t hsio_version;
  117. uint16_t hsio_checksum;
  118. };
  119. void power_state_get(struct udevice *pch_dev, struct chipset_power_state *ps);
  120. #endif