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