coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
pm.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef _BROADWELL_PM_H_
4 #define _BROADWELL_PM_H_
5 
6 #include <acpi/acpi.h>
7 
8 /* ACPI_BASE_ADDRESS / PMBASE */
9 
10 #define PM1_STS 0x00
11 #define WAK_STS (1 << 15)
12 #define PCIEXPWAK_STS (1 << 14)
13 #define PRBTNOR_STS (1 << 11)
14 #define RTC_STS (1 << 10)
15 #define PWRBTN_STS (1 << 8)
16 #define GBL_STS (1 << 5)
17 #define BM_STS (1 << 4)
18 #define TMROF_STS (1 << 0)
19 #define PM1_EN 0x02
20 #define PCIEXPWAK_DIS (1 << 14)
21 #define RTC_EN (1 << 10)
22 #define PWRBTN_EN (1 << 8)
23 #define GBL_EN (1 << 5)
24 #define TMROF_EN (1 << 0)
25 #define PM1_CNT 0x04
26 #define GBL_RLS (1 << 2)
27 #define BM_RLD (1 << 1)
28 #define SCI_EN (1 << 0)
29 #define PM1_TMR 0x08
30 #define SMI_EN 0x30
31 #define XHCI_SMI_EN (1 << 31)
32 #define ME_SMI_EN (1 << 30)
33 #define GPIO_UNLOCK_SMI_EN (1 << 27)
34 #define INTEL_USB2_EN (1 << 18)
35 #define LEGACY_USB2_EN (1 << 17)
36 #define PERIODIC_EN (1 << 14)
37 #define TCO_EN (1 << 13)
38 #define MCSMI_EN (1 << 11)
39 #define BIOS_RLS (1 << 7)
40 #define SWSMI_TMR_EN (1 << 6)
41 #define APMC_EN (1 << 5)
42 #define SLP_SMI_EN (1 << 4)
43 #define LEGACY_USB_EN (1 << 3)
44 #define BIOS_EN (1 << 2)
45 #define EOS (1 << 1)
46 #define GBL_SMI_EN (1 << 0)
47 #define SMI_STS 0x34
48 #define UPWRC 0x3c
49 #define UPWRC_WS (1 << 8)
50 #define UPWRC_WE (1 << 1)
51 #define UPWRC_SMI (1 << 0)
52 #define GPE_CNTL 0x42
53 #define SWGPE_CTRL (1 << 1)
54 #define DEVACT_STS 0x44
55 #define PM2_CNT 0x50
56 #define TCO1_CNT 0x60
57 #define TCO_TMR_HLT (1 << 11)
58 #define TCO1_STS 0x64
59 #define DMISCI_STS (1 << 9)
60 #define TCO2_STS 0x66
61 #define TCO2_STS_SECOND_TO (1 << 1)
62 
63 #define GPE0_REG_MAX 4
64 #define GPE0_REG_SIZE 32
65 #define GPE0_STS(x) (0x80 + ((x) * 4))
66 #define GPE_31_0 0 /* 0x80/0x90 = GPE[31:0] */
67 #define GPE_63_32 1 /* 0x84/0x94 = GPE[63:32] */
68 #define GPE_94_64 2 /* 0x88/0x98 = GPE[94:64] */
69 #define GPE_STD 3 /* 0x8c/0x9c = Standard GPE */
70 #define WADT_STS (1 << 18)
71 #define GP27_STS (1 << 16)
72 #define PME_B0_STS (1 << 13)
73 #define ME_SCI_STS (1 << 12)
74 #define PME_STS (1 << 11)
75 #define BATLOW_STS (1 << 10)
76 #define PCI_EXP_STS (1 << 9)
77 #define SMB_WAK_STS (1 << 7)
78 #define TCOSCI_STS (1 << 6)
79 #define SWGPE_STS (1 << 2)
80 #define HOT_PLUG_STS (1 << 1)
81 #define GPE0_EN(x) (0x90 + ((x) * 4))
82 #define WADT_en (1 << 18)
83 #define GP27_EN (1 << 16)
84 #define PME_B0_EN (1 << 13)
85 #define ME_SCI_EN (1 << 12)
86 #define PME_EN (1 << 11)
87 #define BATLOW_EN (1 << 10)
88 #define PCI_EXP_EN (1 << 9)
89 #define TCOSCI_EN (1 << 6)
90 #define SWGPE_EN (1 << 2)
91 #define HOT_PLUG_EN (1 << 1)
92 
93 #define MAINBOARD_POWER_OFF 0
94 #define MAINBOARD_POWER_ON 1
95 #define MAINBOARD_POWER_KEEP 2
96 
97 struct chipset_power_state {
103  uint32_t gpe0_sts[4];
104  uint32_t gpe0_en[4];
108  int prev_sleep_state;
111 };
112 
113 /* PM1_CNT */
116 
117 /* PM1 */
119 void enable_pm1(uint16_t events);
121 
122 /* SMI */
123 void enable_smi(uint32_t mask);
125 
126 /* ALT_GP_SMI */
129 
130 /* TCO */
132 void enable_tco_sci(void);
133 
134 /* GPE0 */
136 void clear_gpe_enable(void);
137 void enable_all_gpe(uint32_t set1, uint32_t set2, uint32_t set3, uint32_t set4);
138 void disable_all_gpe(void);
139 void enable_gpe(uint32_t mask);
141 
142 /* STM Support */
143 uint16_t get_pmbase(void);
144 
145 #endif
uint16_t get_pmbase(void)
Definition: pmutil.c:254
void enable_pm1(uint16_t events)
Definition: pmutil.c:157
uint16_t clear_pm1_status(void)
Definition: pmutil.c:152
void enable_pm1_control(uint32_t mask)
Definition: pmutil.c:105
void disable_smi(uint32_t mask)
Definition: pmutil.c:97
void enable_smi(uint32_t mask)
Definition: pmutil.c:89
void enable_gpe(uint32_t mask)
Definition: pmutil.c:194
uint32_t clear_gpe_status(void)
Definition: pmutil.c:265
void disable_pm1_control(uint32_t mask)
Definition: pmutil.c:113
void disable_all_gpe(void)
Definition: pmutil.c:210
uint32_t clear_tco_status(void)
Definition: pmutil.c:189
uint32_t clear_smi_status(void)
Definition: pmutil.c:84
void disable_gpe(uint32_t mask)
Definition: pmutil.c:202
void enable_alt_smi(uint32_t mask)
Definition: pmutil.c:242
void clear_gpe_enable(void)
uint32_t clear_alt_smi_status(void)
Definition: pmutil.c:236
void enable_tco_sci(void)
Definition: pmutil.c:309
void enable_all_gpe(uint32_t set1, uint32_t set2, uint32_t set3, uint32_t set4)
Definition: pmutil.c:385
static const int mask[4]
Definition: gpio.c:308
unsigned short uint16_t
Definition: stdint.h:11
unsigned int uint32_t
Definition: stdint.h:14
uint16_t tco2_sts
Definition: pm.h:146
uint16_t hsio_version
Definition: pm.h:109
uint16_t tco1_sts
Definition: pm.h:145
uint32_t gpe0_en[4]
Definition: pm.h:148
uint32_t prev_sleep_state
Definition: pm.h:153
uint32_t gpe0_sts[4]
Definition: pm.h:147
uint16_t hsio_checksum
Definition: pm.h:110
uint16_t pm1_en
Definition: pm.h:143
uint16_t gen_pmcon1
Definition: pm.h:105
uint16_t gen_pmcon3
Definition: pm.h:107
uint16_t pm1_sts
Definition: pm.h:142
uint16_t gen_pmcon2
Definition: pm.h:106
uint32_t pm1_cnt
Definition: pm.h:144