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 _SOC_PM_H_
4 #define _SOC_PM_H_
5 
6 #define PM1_STS 0x00
7 #define WAK_STS (1 << 15)
8 #define PCIEXPWAK_STS (1 << 14)
9 #define PRBTNOR_STS (1 << 11)
10 #define RTC_STS (1 << 10)
11 #define PWRBTN_STS (1 << 8)
12 #define GBL_STS (1 << 5)
13 #define BM_STS (1 << 4)
14 #define TMROF_STS (1 << 0)
15 #define PM1_EN 0x02
16 #define PCIEXPWAK_DIS (1 << 14)
17 #define RTC_EN (1 << 10)
18 #define PWRBTN_EN (1 << 8)
19 #define GBL_EN (1 << 5)
20 #define TMROF_EN (1 << 0)
21 #define PM1_CNT 0x04
22 #define GBL_RLS (1 << 2)
23 #define BM_RLD (1 << 1)
24 #define SCI_EN (1 << 0)
25 #define PM1_TMR 0x08
26 #define SMI_EN 0x30
27 #define XHCI_SMI_EN (1 << 31)
28 #define ME_SMI_EN (1 << 30)
29 #define ESPI_SMI_EN (1 << 28)
30 #define GPIO_UNLOCK_SMI_EN (1 << 27)
31 #define INTEL_USB2_EN (1 << 18)
32 #define LEGACY_USB2_EN (1 << 17)
33 #define PERIODIC_EN (1 << 14)
34 #define TCO_SMI_EN (1 << 13)
35 #define MCSMI_EN (1 << 11)
36 #define BIOS_RLS (1 << 7)
37 #define SWSMI_TMR_EN (1 << 6)
38 #define APMC_EN (1 << 5)
39 #define SLP_SMI_EN (1 << 4)
40 #define LEGACY_USB_EN (1 << 3)
41 #define BIOS_EN (1 << 2)
42 #define EOS (1 << 1)
43 #define GBL_SMI_EN (1 << 0)
44 #define SMI_STS 0x34
45 #define SMI_STS_BITS 32
46 #define XHCI_SMI_STS_BIT 31
47 #define ME_SMI_STS_BIT 30
48 #define ESPI_SMI_STS_BIT 28
49 #define GPIO_UNLOCK_SMI_STS_BIT 27
50 #define SPI_SMI_STS_BIT 26
51 #define SCC_SMI_STS_BIT 25
52 #define MONITOR_STS_BIT 21
53 #define PCI_EXP_SMI_STS_BIT 20
54 #define SMBUS_SMI_STS_BIT 16
55 #define SERIRQ_SMI_STS_BIT 15
56 #define PERIODIC_STS_BIT 14
57 #define TCO_STS_BIT 13
58 #define DEVMON_STS_BIT 12
59 #define MCSMI_STS_BIT 11
60 #define GPIO_STS_BIT 10
61 #define GPE0_STS_BIT 9
62 #define PM1_STS_BIT 8
63 #define SWSMI_TMR_STS_BIT 6
64 #define APM_STS_BIT 5
65 #define SMI_ON_SLP_EN_STS_BIT 4
66 #define LEGACY_USB_STS_BIT 3
67 #define BIOS_STS_BIT 2
68 #define GPE_CNTL 0x42
69 #define SWGPE_CTRL (1 << 1)
70 #define DEVACT_STS 0x44
71 #define PM2_CNT 0x50
72 
73 #define GPE0_REG_MAX 4
74 #define GPE0_REG_SIZE 32
75 #define GPE0_STS(x) (0x60 + ((x) * 4))
76 #define GPE_31_0 0 /* 0x60/0x70 = GPE[31:0] */
77 #define GPE_63_32 1 /* 0x64/0x74 = GPE[63:32] */
78 #define GPE_95_64 2 /* 0x68/0x78 = GPE[95:64] */
79 #define GPE_STD 3 /* 0x6c/0x7c = Standard GPE */
80 #define GPE_STS_RSVD GPE_STD
81 #define WADT_STS (1 << 18)
82 #define GPIO_T2_STS (1 << 15)
83 #define ESPI_STS (1 << 14)
84 #define PME_B0_STS (1 << 13)
85 #define ME_SCI_STS (1 << 12)
86 #define PME_STS (1 << 11)
87 #define BATLOW_STS (1 << 10)
88 #define PCI_EXP_STS (1 << 9)
89 #define SMB_WAK_STS (1 << 7)
90 #define TCOSCI_STS (1 << 6)
91 #define SWGPE_STS (1 << 2)
92 #define HOT_PLUG_STS (1 << 1)
93 #define GPE0_EN(x) (0x70 + ((x) * 4))
94 #define WADT_EN (1 << 18)
95 #define GPIO_T2_EN (1 << 15)
96 #define ESPI_EN (1 << 14)
97 #define PME_B0_EN_BIT 13
98 #define PME_B0_EN (1 << PME_B0_EN_BIT)
99 #define ME_SCI_EN (1 << 12)
100 #define PME_EN (1 << 11)
101 #define BATLOW_EN (1 << 10)
102 #define PCI_EXP_EN (1 << 9)
103 #define TCOSCI_EN (1 << 6)
104 #define SWGPE_EN (1 << 2)
105 #define HOT_PLUG_EN (1 << 1)
106 
107 #define EN_BLOCK 3
108 
109 /*
110  * Enable SMI generation:
111  * - on APMC writes (io 0xb2)
112  * - on writes to SLP_EN (sleep states)
113  * - on writes to GBL_RLS (bios commands)
114  * - on eSPI events (does nothing on LPC systems)
115  * No SMIs:
116  * - on microcontroller writes (io 0x62/0x66)
117  * - on TCO events, unless enabled in common code
118  */
119 #define ENABLE_SMI_PARAMS \
120  (APMC_EN | SLP_SMI_EN | GBL_SMI_EN | ESPI_SMI_EN | EOS)
121 
122 #define PSS_RATIO_STEP 2
123 #define PSS_MAX_ENTRIES 8
124 #define PSS_LATENCY_TRANSITION 10
125 #define PSS_LATENCY_BUSMASTER 10
126 
127 #if !defined(__ACPI__)
128 
129 #include <acpi/acpi.h>
130 #include <soc/gpe.h>
131 #include <soc/iomap.h>
132 #include <soc/smbus.h>
133 #include <soc/pmc.h>
134 
135 struct chipset_power_state {
141  uint32_t gpe0_sts[4];
142  uint32_t gpe0_en[4];
148 
149 /* Get base address PMC memory mapped registers. */
150 uint8_t *pmc_mmio_regs(void);
151 
152 /* Get base address of TCO I/O registers. */
154 
155 /* Set the DISB after DRAM init */
156 void pmc_set_disb(void);
157 
158 /* STM Support */
159 uint16_t get_pmbase(void);
160 
161 #endif /* !defined(__ACPI__) */
162 #endif
void pmc_set_disb(void)
Definition: pmutil.c:121
uint16_t get_pmbase(void)
Definition: pmutil.c:254
struct chipset_power_state __packed
uint8_t * pmc_mmio_regs(void)
Definition: pmutil.c:142
uint16_t smbus_tco_regs(void)
unsigned short uint16_t
Definition: stdint.h:11
unsigned int uint32_t
Definition: stdint.h:14
unsigned char uint8_t
Definition: stdint.h:8
uint16_t tco2_sts
Definition: pm.h:146
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
uint32_t gen_pmcon_b
Definition: pm.h:150
uint16_t pm1_en
Definition: pm.h:143
uint16_t pm1_sts
Definition: pm.h:142
uint32_t gblrst_cause[2]
Definition: pm.h:151
uint32_t gen_pmcon_a
Definition: pm.h:149
uint32_t pm1_cnt
Definition: pm.h:144