blob: 58a49f15310a65b8d3c05f3e31135c412c19ad7a [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Patrick Georgie72a8a32012-11-06 11:05:09 +01002
3#ifndef SOUTHBRIDGE_INTEL_I82801GX_I82801IX_H
4#define SOUTHBRIDGE_INTEL_I82801GX_I82801IX_H
5
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -08006#define DEFAULT_TBAR ((u8 *)0xfed1b000)
Arthur Heymans2e464cf2018-06-13 00:07:09 +02007
8#include <southbridge/intel/common/rcba.h>
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -08009
Julius Wernercd49cce2019-03-05 16:53:33 -080010#if CONFIG(BOARD_EMULATION_QEMU_X86_Q35)
Gerd Hoffmannb142a512013-09-17 09:49:02 +020011/*
12 * Qemu has the fw_cfg interface at 0x510. Move the pmbase to a
13 * non-conflicting address. No need to worry about speedstep, it
14 * is not supported by qemu and isn't enabled in the qemu config.
15 */
16# define DEFAULT_PMBASE 0x00000600
17#else
18# define DEFAULT_PMBASE 0x00000500 /* Speedstep code has this hardcoded, too. */
19#endif
Patrick Georgie72a8a32012-11-06 11:05:09 +010020#define DEFAULT_TCOBASE (DEFAULT_PMBASE + 0x60)
21#define DEFAULT_GPIOBASE 0x00000580
22
23
24#define APM_CNT 0xb2
25
26#define PM1_STS 0x00
27#define PWRBTN_STS (1 << 8)
28#define RTC_STS (1 << 10)
29#define PM1_EN 0x02
30#define PWRBTN_EN (1 << 8)
31#define GBL_EN (1 << 5)
32#define PM1_CNT 0x04
33#define SCI_EN (1 << 0)
34#define PM_LV2 0x14
35#define PM_LV3 0x15
36#define PM_LV4 0x16
37#define PM_LV5 0x17
38#define PM_LV6 0x18
39#define GPE0_STS 0x20
40#define SMI_EN 0x30
41#define PERIODIC_EN (1 << 14)
42#define TCO_EN (1 << 13)
43#define APMC_EN (1 << 5)
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 ALT_GP_SMI_EN 0x38
49#define ALT_GP_SMI_STS 0x3a
50
51
Timothy Pearson58649b02015-04-05 18:03:15 -050052#define GP_IO_USE_SEL 0x00
53#define GP_IO_SEL 0x04
54#define GP_LVL 0x0c
55#define GPO_BLINK 0x18
56#define GPI_INV 0x2c
57#define GP_IO_USE_SEL2 0x30
58#define GP_IO_SEL2 0x34
59#define GP_LVL2 0x38
60
Patrick Georgie72a8a32012-11-06 11:05:09 +010061#define DEBUG_PERIODIC_SMIS 0
62
63#define MAINBOARD_POWER_OFF 0
64#define MAINBOARD_POWER_ON 1
65#define MAINBOARD_POWER_KEEP 2
66
Patrick Georgie72a8a32012-11-06 11:05:09 +010067/* D31:F0 LPC bridge */
68#define D31F0_PMBASE 0x40
69#define D31F0_ACPI_CNTL 0x44
70#define D31F0_GPIO_BASE 0x48
71#define D31F0_GPIO_CNTL 0x4c
72#define D31F0_PIRQA_ROUT 0x60
73#define D31F0_PIRQB_ROUT 0x61
74#define D31F0_PIRQC_ROUT 0x62
75#define D31F0_PIRQD_ROUT 0x63
76#define D31F0_SERIRQ_CNTL 0x64
77#define D31F0_PIRQE_ROUT 0x68
78#define D31F0_PIRQF_ROUT 0x69
79#define D31F0_PIRQG_ROUT 0x6a
80#define D31F0_PIRQH_ROUT 0x6b
81#define D31F0_LPC_IODEC 0x80
82#define D31F0_LPC_EN 0x82
83#define D31F0_GEN1_DEC 0x84
Vladimir Serbinenko9d2cb7c2014-08-10 21:56:41 +020084#define D31F0_GEN2_DEC 0x88
85#define D31F0_GEN3_DEC 0x8c
86#define D31F0_GEN4_DEC 0x90
Patrick Georgie72a8a32012-11-06 11:05:09 +010087#define D31F0_GEN_PMCON_1 0xa0
88#define D31F0_GEN_PMCON_3 0xa4
89#define D31F0_C5_EXIT_TIMING 0xa8
90#define D31F0_CxSTATE_CNF 0xa9
91#define D31F0_C4TIMING_CNT 0xaa
92#define D31F0_GPIO_ROUT 0xb8
Patrick Georgie72a8a32012-11-06 11:05:09 +010093
94/* GEN_PMCON_3 bits */
95#define RTC_BATTERY_DEAD (1 << 2)
96#define RTC_POWER_FAILED (1 << 1)
97#define SLEEP_AFTER_POWER_FAIL (1 << 0)
98
99
100/* D31:F2 SATA */
101#define D31F2_IDE_TIM_PRI 0x40
102#define D31F2_IDE_TIM_SEC 0x42
103#define D31F2_SIDX 0xa0
104#define D31F2_SDAT 0xa4
105
106
107/* D30:F0 PCI-to-PCI bridge */
108#define D30F0_SMLT 0x1b
109
110
111/* D28:F0-5 PCIe root ports */
112#define D28Fx_XCAP 0x42
113#define D28Fx_SLCAP 0x54
114
115
116#define SMBUS_IO_BASE 0x0400
117
118/* PCI Configuration Space (D31:F3): SMBus */
119#define SMB_BASE 0x20
120#define HOSTC 0x40
121
122/* HOSTC bits */
123#define I2C_EN (1 << 2)
124#define SMB_SMI_EN (1 << 1)
125#define HST_EN (1 << 0)
126
Patrick Georgie72a8a32012-11-06 11:05:09 +0100127#define RCBA_V0CTL 0x0014
128#define RCBA_V1CAP 0x001c
129#define RCBA_V1CTL 0x0020
130#define RCBA_V1STS 0x0026
131#define RCBA_PAT 0x0030
Stefan Taunercea31ea2018-08-11 18:45:28 +0200132#define RCBA_CIR1 0x0088
Patrick Georgie72a8a32012-11-06 11:05:09 +0100133#define RCBA_ESD 0x0104
134#define RCBA_ULD 0x0110
135#define RCBA_ULBA 0x0118
136#define RCBA_LCAP 0x01a4
137#define RCBA_LCTL 0x01a8
138#define RCBA_LSTS 0x01aa
Stefan Taunercea31ea2018-08-11 18:45:28 +0200139#define RCBA_CIR2 0x01f4
140#define RCBA_CIR3 0x01fc
141#define RCBA_BCR 0x0220
Patrick Georgie72a8a32012-11-06 11:05:09 +0100142#define RCBA_DMIC 0x0234
143#define RCBA_RPFN 0x0238
Stefan Taunercea31ea2018-08-11 18:45:28 +0200144#define RCBA_CIR13 0x0f20
145#define RCBA_CIR5 0x1d40
Patrick Georgie72a8a32012-11-06 11:05:09 +0100146#define RCBA_DMC 0x2010
Stefan Taunercea31ea2018-08-11 18:45:28 +0200147#define RCBA_CIR6 0x2024
148#define RCBA_CIR7 0x2034
Patrick Georgie72a8a32012-11-06 11:05:09 +0100149#define RCBA_HPTC 0x3404
Stefan Taunercea31ea2018-08-11 18:45:28 +0200150#define GCS 0x3410
Patrick Georgie72a8a32012-11-06 11:05:09 +0100151#define RCBA_BUC 0x3414
152#define RCBA_FD 0x3418 /* Function Disable, see below. */
153#define RCBA_CG 0x341c
154#define RCBA_FDSW 0x3420
Stefan Taunercea31ea2018-08-11 18:45:28 +0200155#define RCBA_CIR8 0x3430
156#define RCBA_CIR9 0x350c
157#define RCBA_CIR10 0x352c
Martin Roth2ed0aa22016-01-05 20:58:58 -0700158#define RCBA_MAP 0x35f0 /* UHCI controller #6 remapping */
Patrick Georgie72a8a32012-11-06 11:05:09 +0100159
160#define BUC_LAND (1 << 5) /* LAN */
161#define FD_SAD2 (1 << 25) /* SATA #2 */
162#define FD_TTD (1 << 24) /* Thermal Throttle */
163#define FD_PE6D (1 << 21) /* PCIe root port 6 */
164#define FD_PE5D (1 << 20) /* PCIe root port 5 */
165#define FD_PE4D (1 << 19) /* PCIe root port 4 */
166#define FD_PE3D (1 << 18) /* PCIe root port 3 */
167#define FD_PE2D (1 << 17) /* PCIe root port 2 */
168#define FD_PE1D (1 << 16) /* PCIe root port 1 */
169#define FD_EHCI1D (1 << 15) /* EHCI #1 */
170#define FD_LBD (1 << 14) /* LPC bridge */
171#define FD_EHCI2D (1 << 13) /* EHCI #2 */
172#define FD_U5D (1 << 12) /* UHCI #5 */
173#define FD_U4D (1 << 11) /* UHCI #4 */
174#define FD_U3D (1 << 10) /* UHCI #3 */
175#define FD_U2D (1 << 9) /* UHCI #2 */
176#define FD_U1D (1 << 8) /* UHCI #1 */
177#define FD_U6D (1 << 7) /* UHCI #6 */
178#define FD_HDAD (1 << 4) /* HD audio */
179#define FD_SD (1 << 3) /* SMBus */
180#define FD_SAD1 (1 << 2) /* SATA #1 */
181
182
Patrick Georgie72a8a32012-11-06 11:05:09 +0100183#ifndef __ACPI__
184#ifndef __ASSEMBLER__
185
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +0200186#include <device/pci_ops.h>
187
Patrick Georgie72a8a32012-11-06 11:05:09 +0100188static inline int lpc_is_mobile(const u16 devid)
189{
190 return (devid == 0x2917) || (devid == 0x2919);
191}
192#define LPC_IS_MOBILE(dev) lpc_is_mobile(pci_read_config16(dev, PCI_DEVICE_ID))
193
Kyösti Mälkki571b7b22019-07-08 23:25:05 +0300194void aseg_smm_lock(void);
195
Patrick Georgie72a8a32012-11-06 11:05:09 +0100196void i82801ix_early_init(void);
Arthur Heymans9ed0df42019-10-12 14:18:18 +0200197void i82801ix_lpc_decode(void);
Patrick Georgie72a8a32012-11-06 11:05:09 +0100198void i82801ix_dmi_setup(void);
199void i82801ix_dmi_poll_vc1(void);
Kyösti Mälkki12b121c2019-08-18 16:33:39 +0300200
Patrick Georgie72a8a32012-11-06 11:05:09 +0100201#endif
202#endif
203
204#endif