coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
i82801gx.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef SOUTHBRIDGE_INTEL_I82801GX_I82801GX_H
4 #define SOUTHBRIDGE_INTEL_I82801GX_I82801GX_H
5 
6 /* TODO Make sure these don't get changed by stage2 */
7 #define DEFAULT_GPIOBASE 0x0480
8 #define DEFAULT_PMBASE 0x0500
9 
11 
12 #ifndef __ACPI__
13 #define DEBUG_PERIODIC_SMIS 0
14 
15 #include <device/device.h>
16 void i82801gx_enable(struct device *dev);
17 
18 void i82801gx_lpc_setup(void);
19 void i82801gx_setup_bars(void);
21 
22 void ich7_setup_cir(void);
23 
24 #define MAINBOARD_POWER_OFF 0
25 #define MAINBOARD_POWER_ON 1
26 #define MAINBOARD_POWER_KEEP 2
27 
28 /* PCI Configuration Space (D30:F0): PCI2PCI */
29 #define PSTS 0x06
30 #define SMLT 0x1b
31 #define SECSTS 0x1e
32 #define INTR 0x3c
33 
34 #define ICH_PCIE_DEV_SLOT 28
35 
36 /* PCI Configuration Space (D31:F0): LPC */
37 
38 #define SERIRQ_CNTL 0x64
39 
40 #define GEN_PMCON_1 0xa0
41 #define GEN_PMCON_2 0xa2
42 #define GEN_PMCON_3 0xa4
43 
44 #define GPIO_ROUT 0xb8
45 #define GPI_DISABLE 0x00
46 #define GPI_IS_SMI 0x01
47 #define GPI_IS_SCI 0x02
48 #define GPI_IS_NMI 0x03
49 
50 #define FDVCT 0xe4
51 #define PCIE_4_PORTS_MAX (1 << 7)
52 #define AHCI_UNSUPPORTED (1 << 3)
53 
54 /* GEN_PMCON_3 bits */
55 #define RTC_BATTERY_DEAD (1 << 2)
56 #define RTC_POWER_FAILED (1 << 1)
57 #define SLEEP_AFTER_POWER_FAIL (1 << 0)
58 
59 #define ACPI_CNTL 0x44
60 #define ACPI_EN (1 << 7)
61 #define BIOS_CNTL 0xDC
62 #define GPIO_BASE 0x48 /* LPC GPIO Base Address Register */
63 #define GPIO_CNTL 0x4C /* LPC GPIO Control Register */
64 #define GPIO_EN (1 << 4)
65 
66 #define PIRQA_ROUT 0x60
67 #define PIRQB_ROUT 0x61
68 #define PIRQC_ROUT 0x62
69 #define PIRQD_ROUT 0x63
70 #define PIRQE_ROUT 0x68
71 #define PIRQF_ROUT 0x69
72 #define PIRQG_ROUT 0x6A
73 #define PIRQH_ROUT 0x6B
74 
75 #define LPC_IO_DEC 0x80 /* IO Decode Ranges Register */
76 #define LPC_EN 0x82 /* LPC IF Enables Register */
77 #define CNF2_LPC_EN (1 << 13) /* 0x4e/0x4f */
78 #define CNF1_LPC_EN (1 << 12) /* 0x2e/0x2f */
79 #define MC_LPC_EN (1 << 11) /* 0x62/0x66 */
80 #define KBC_LPC_EN (1 << 10) /* 0x60/0x64 */
81 #define GAMEH_LPC_EN (1 << 9) /* 0x208/0x20f */
82 #define GAMEL_LPC_EN (1 << 8) /* 0x200/0x207 */
83 #define FDD_LPC_EN (1 << 3) /* LPC_IO_DEC[12] */
84 #define LPT_LPC_EN (1 << 2) /* LPC_IO_DEC[9:8] */
85 #define COMB_LPC_EN (1 << 1) /* LPC_IO_DEC[6:4] */
86 #define COMA_LPC_EN (1 << 0) /* LPC_IO_DEC[2:0] */
87 
88 #define GEN1_DEC 0x84
89 #define GEN2_DEC 0x88
90 #define GEN3_DEC 0x8c
91 #define GEN4_DEC 0x90
92 
93 /* PCI Configuration Space (D31:F1): IDE */
94 #define INTR_LN 0x3c
95 #define IDE_TIM_PRI 0x40 /* IDE timings, primary */
96 #define IDE_DECODE_ENABLE (1 << 15)
97 #define IDE_SITRE (1 << 14)
98 #define IDE_ISP_5_CLOCKS (0 << 12)
99 #define IDE_ISP_4_CLOCKS (1 << 12)
100 #define IDE_ISP_3_CLOCKS (2 << 12)
101 #define IDE_RCT_4_CLOCKS (0 << 8)
102 #define IDE_RCT_3_CLOCKS (1 << 8)
103 #define IDE_RCT_2_CLOCKS (2 << 8)
104 #define IDE_RCT_1_CLOCKS (3 << 8)
105 #define IDE_DTE1 (1 << 7)
106 #define IDE_PPE1 (1 << 6)
107 #define IDE_IE1 (1 << 5)
108 #define IDE_TIME1 (1 << 4)
109 #define IDE_DTE0 (1 << 3)
110 #define IDE_PPE0 (1 << 2)
111 #define IDE_IE0 (1 << 1)
112 #define IDE_TIME0 (1 << 0)
113 #define IDE_TIM_SEC 0x42 /* IDE timings, secondary */
114 
115 #define IDE_SDMA_CNT 0x48 /* Synchronous DMA control */
116 #define IDE_SSDE1 (1 << 3)
117 #define IDE_SSDE0 (1 << 2)
118 #define IDE_PSDE1 (1 << 1)
119 #define IDE_PSDE0 (1 << 0)
120 
121 #define IDE_SDMA_TIM 0x4a
122 
123 #define IDE_CONFIG 0x54 /* IDE I/O Configuration Register */
124 #define SIG_MODE_SEC_NORMAL (0 << 18)
125 #define SIG_MODE_SEC_TRISTATE (1 << 18)
126 #define SIG_MODE_SEC_DRIVELOW (2 << 18)
127 #define SIG_MODE_PRI_NORMAL (0 << 16)
128 #define SIG_MODE_PRI_TRISTATE (1 << 16)
129 #define SIG_MODE_PRI_DRIVELOW (2 << 16)
130 #define FAST_SCB1 (1 << 15)
131 #define FAST_SCB0 (1 << 14)
132 #define FAST_PCB1 (1 << 13)
133 #define FAST_PCB0 (1 << 12)
134 #define SCB1 (1 << 3)
135 #define SCB0 (1 << 2)
136 #define PCB1 (1 << 1)
137 #define PCB0 (1 << 0)
138 
139 /* PCI Configuration Space (D31:F3): SMBus */
140 #define SMB_BASE 0x20
141 #define HOSTC 0x40
142 
143 /* HOSTC bits */
144 #define I2C_EN (1 << 2)
145 #define SMB_SMI_EN (1 << 1)
146 #define HST_EN (1 << 0)
147 
148 /* Southbridge IO BARs */
149 
150 #define GPIOBASE 0x48
151 
152 #define PMBASE 0x40
153 
154 #define VCH 0x0000 /* 32bit */
155 #define VCAP1 0x0004 /* 32bit */
156 #define VCAP2 0x0008 /* 32bit */
157 #define PVC 0x000c /* 16bit */
158 #define PVS 0x000e /* 16bit */
159 
160 #define V0CAP 0x0010 /* 32bit */
161 #define V0CTL 0x0014 /* 32bit */
162 #define V0STS 0x001a /* 16bit */
163 
164 #define V1CAP 0x001c /* 32bit */
165 #define V1CTL 0x0020 /* 32bit */
166 #define V1STS 0x0026 /* 16bit */
167 
168 #define RCTCL 0x0100 /* 32bit */
169 #define ESD 0x0104 /* 32bit */
170 #define ULD 0x0110 /* 32bit */
171 #define ULBA 0x0118 /* 64bit */
172 
173 #define RP1D 0x0120 /* 32bit */
174 #define RP1BA 0x0128 /* 64bit */
175 #define RP2D 0x0130 /* 32bit */
176 #define RP2BA 0x0138 /* 64bit */
177 #define RP3D 0x0140 /* 32bit */
178 #define RP3BA 0x0148 /* 64bit */
179 #define RP4D 0x0150 /* 32bit */
180 #define RP4BA 0x0158 /* 64bit */
181 #define HDD 0x0160 /* 32bit */
182 #define HDBA 0x0168 /* 64bit */
183 #define RP5D 0x0170 /* 32bit */
184 #define RP5BA 0x0178 /* 64bit */
185 #define RP6D 0x0180 /* 32bit */
186 #define RP6BA 0x0188 /* 64bit */
187 
188 #define ILCL 0x01a0 /* 32bit */
189 #define LCAP 0x01a4 /* 32bit */
190 #define LCTL 0x01a8 /* 16bit */
191 #define LSTS 0x01aa /* 16bit */
192 
193 #define RPC 0x0224 /* 32bit */
194 #define RPFN 0x0238 /* 32bit */
195 
196 /* Get the function number assigned to a Root Port */
197 #define RPFN_FNGET(reg, port) (((reg) >> ((port) * 4)) & 7)
198 /* Set the function number for a Root Port */
199 #define RPFN_FNSET(port, func) (((func) & 7) << ((port) * 4))
200 /* Root Port function number mask */
201 #define RPFN_FNMASK(port) (7 << ((port) * 4))
202 
203 #define TRSR 0x1e00 /* 8bit */
204 #define TRCR 0x1e10 /* 64bit */
205 #define TWDR 0x1e18 /* 64bit */
206 
207 #define IOTR0 0x1e80 /* 64bit */
208 #define IOTR1 0x1e88 /* 64bit */
209 #define IOTR2 0x1e90 /* 64bit */
210 #define IOTR3 0x1e98 /* 64bit */
211 
212 #define TCTL 0x3000 /* 8bit */
213 
214 #define D31IP 0x3100 /* 32bit */
215 #define D30IP 0x3104 /* 32bit */
216 #define D29IP 0x3108 /* 32bit */
217 #define D28IP 0x310c /* 32bit */
218 #define D27IP 0x3110 /* 32bit */
219 #define D31IR 0x3140 /* 16bit */
220 #define D30IR 0x3142 /* 16bit */
221 #define D29IR 0x3144 /* 16bit */
222 #define D28IR 0x3146 /* 16bit */
223 #define D27IR 0x3148 /* 16bit */
224 #define OIC 0x31ff /* 8bit */
225 
226 #define RC 0x3400 /* 32bit */
227 #define HPTC 0x3404 /* 32bit */
228 #define GCS 0x3410 /* 32bit */
229 #define BUC 0x3414 /* 32bit */
230 #define FD 0x3418 /* 32bit */
231 #define CG 0x341c /* 32bit */
232 
233 /* Function Disable (FD) register values.
234  * Setting a bit disables the corresponding
235  * feature.
236  * Not all features might be disabled on
237  * all chipsets. Esp. ICH-7U is picky.
238  */
239 #define ICH_DISABLE_PCIE(x) (1 << (16 + (x)))
240 #define FD_EHCI (1 << 15)
241 #define FD_LPCB (1 << 14)
242 
243 /* UHCI must be disabled from 4 downwards.
244  * If UHCI controllers get disabled, EHCI
245  * must know about it, too! */
246 #define ICH_DISABLE_UHCI(x) (1 << (8 + (x)))
247 
248 #define FD_INTLAN (1 << 7)
249 #define FD_ACMOD (1 << 6)
250 #define FD_ACAUD (1 << 5)
251 #define FD_HDAUD (1 << 4)
252 #define FD_SMBUS (1 << 3)
253 #define FD_SATA (1 << 2)
254 #define FD_PATA (1 << 1)
255 
256 /* ICH7 PMBASE */
257 #define PM1_STS 0x00
258 #define WAK_STS (1 << 15)
259 #define PCIEXPWAK_STS (1 << 14)
260 #define PRBTNOR_STS (1 << 11)
261 #define RTC_STS (1 << 10)
262 #define PWRBTN_STS (1 << 8)
263 #define GBL_STS (1 << 5)
264 #define BM_STS (1 << 4)
265 #define TMROF_STS (1 << 0)
266 #define PM1_EN 0x02
267 #define PCIEXPWAK_DIS (1 << 14)
268 #define RTC_EN (1 << 10)
269 #define PWRBTN_EN (1 << 8)
270 #define GBL_EN (1 << 5)
271 #define TMROF_EN (1 << 0)
272 #define PM1_CNT 0x04
273 #define GBL_RLS (1 << 2)
274 #define BM_RLD (1 << 1)
275 #define SCI_EN (1 << 0)
276 #define PM1_TMR 0x08
277 #define PROC_CNT 0x10
278 #define LV2 0x14
279 #define LV3 0x15
280 #define LV4 0x16
281 #define PM2_CNT 0x20 // mobile only
282 #define GPE0_STS 0x28
283 #define USB4_STS (1 << 14)
284 #define PME_B0_STS (1 << 13)
285 #define USB3_STS (1 << 12)
286 #define PME_STS (1 << 11)
287 #define BATLOW_STS (1 << 10)
288 #define PCI_EXP_STS (1 << 9)
289 #define RI_STS (1 << 8)
290 #define SMB_WAK_STS (1 << 7)
291 #define TCOSCI_STS (1 << 6)
292 #define AC97_STS (1 << 5)
293 #define USB2_STS (1 << 4)
294 #define USB1_STS (1 << 3)
295 #define SWGPE_STS (1 << 2)
296 #define HOT_PLUG_STS (1 << 1)
297 #define THRM_STS (1 << 0)
298 #define GPE0_EN 0x2c
299 #define PME_B0_EN (1 << 13)
300 #define PME_EN (1 << 11)
301 #define SMI_EN 0x30
302 #define EL_SMI_EN (1 << 25) // Intel Quick Resume Technology
303 #define INTEL_USB2_EN (1 << 18) // Intel-Specific USB2 SMI logic
304 #define LEGACY_USB2_EN (1 << 17) // Legacy USB2 SMI logic
305 #define PERIODIC_EN (1 << 14) // SMI on PERIODIC_STS in SMI_STS
306 #define TCO_EN (1 << 13) // Enable TCO Logic (BIOSWE et al)
307 #define MCSMI_EN (1 << 11) // Trap microcontroller range access
308 #define BIOS_RLS (1 << 7) // asserts SCI on bit set
309 #define SWSMI_TMR_EN (1 << 6) // start software smi timer on bit set
310 #define APMC_EN (1 << 5) // Writes to APM_CNT cause SMI#
311 #define SLP_SMI_EN (1 << 4) // Write to SLP_EN in PM1_CNT asserts SMI#
312 #define LEGACY_USB_EN (1 << 3) // Legacy USB circuit SMI logic
313 #define BIOS_EN (1 << 2) // Assert SMI# on setting GBL_RLS bit
314 #define EOS (1 << 1) // End of SMI (deassert SMI#)
315 #define GBL_SMI_EN (1 << 0) // SMI# generation at all?
316 #define SMI_STS 0x34
317 #define ALT_GP_SMI_EN 0x38
318 #define ALT_GP_SMI_STS 0x3a
319 #define GPE_CNTL 0x42
320 #define DEVACT_STS 0x44
321 #define SS_CNT 0x50
322 #define C3_RES 0x54
323 #define TCO1_CNT 0x68
324 
325 #endif /* __ACPI__ */
326 #endif /* SOUTHBRIDGE_INTEL_I82801GX_I82801GX_H */
void i82801gx_early_init(void)
void i82801gx_setup_bars(void)
Definition: early_init.c:47
void i82801gx_lpc_setup(void)
Definition: early_init.c:11
void ich7_setup_cir(void)
Definition: early_cir.c:8
void i82801gx_enable(struct device *dev)
Definition: i82801gx.c:54
Definition: device.h:107