blob: bfa875b74d93de74ef1dcc1bd620790c44206284 [file] [log] [blame]
Patrick Georgie72a8a32012-11-06 11:05:09 +01001/*
2 * This file is part of the coreboot project.
3 *
Timothy Pearson58649b02015-04-05 18:03:15 -05004 * Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>, Raptor Engineering
Patrick Georgie72a8a32012-11-06 11:05:09 +01005 * Copyright (C) 2008-2009 coresystems GmbH
6 * 2012 secunet Security Networks AG
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
Patrick Georgie72a8a32012-11-06 11:05:09 +010016 */
17
18#ifndef SOUTHBRIDGE_INTEL_I82801GX_I82801IX_H
19#define SOUTHBRIDGE_INTEL_I82801GX_I82801IX_H
20
21#ifndef __ACPI__
22#ifndef __ASSEMBLER__
23#include "chip.h"
24#endif
25#endif
26
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080027#define DEFAULT_TBAR ((u8 *)0xfed1b000)
Arthur Heymans2e464cf2018-06-13 00:07:09 +020028
29#include <southbridge/intel/common/rcba.h>
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080030
Martin Rothc4e49f62015-07-11 13:42:54 -060031#if IS_ENABLED(CONFIG_BOARD_EMULATION_QEMU_X86_Q35)
Gerd Hoffmannb142a512013-09-17 09:49:02 +020032/*
33 * Qemu has the fw_cfg interface at 0x510. Move the pmbase to a
34 * non-conflicting address. No need to worry about speedstep, it
35 * is not supported by qemu and isn't enabled in the qemu config.
36 */
37# define DEFAULT_PMBASE 0x00000600
38#else
39# define DEFAULT_PMBASE 0x00000500 /* Speedstep code has this hardcoded, too. */
40#endif
Patrick Georgie72a8a32012-11-06 11:05:09 +010041#define DEFAULT_TCOBASE (DEFAULT_PMBASE + 0x60)
42#define DEFAULT_GPIOBASE 0x00000580
43
44
45#define APM_CNT 0xb2
46
47#define PM1_STS 0x00
48#define PWRBTN_STS (1 << 8)
49#define RTC_STS (1 << 10)
50#define PM1_EN 0x02
51#define PWRBTN_EN (1 << 8)
52#define GBL_EN (1 << 5)
53#define PM1_CNT 0x04
54#define SCI_EN (1 << 0)
55#define PM_LV2 0x14
56#define PM_LV3 0x15
57#define PM_LV4 0x16
58#define PM_LV5 0x17
59#define PM_LV6 0x18
60#define GPE0_STS 0x20
61#define SMI_EN 0x30
62#define PERIODIC_EN (1 << 14)
63#define TCO_EN (1 << 13)
64#define APMC_EN (1 << 5)
65#define BIOS_EN (1 << 2)
66#define EOS (1 << 1)
67#define GBL_SMI_EN (1 << 0)
68#define SMI_STS 0x34
69#define ALT_GP_SMI_EN 0x38
70#define ALT_GP_SMI_STS 0x3a
71
72
Timothy Pearson58649b02015-04-05 18:03:15 -050073#define GP_IO_USE_SEL 0x00
74#define GP_IO_SEL 0x04
75#define GP_LVL 0x0c
76#define GPO_BLINK 0x18
77#define GPI_INV 0x2c
78#define GP_IO_USE_SEL2 0x30
79#define GP_IO_SEL2 0x34
80#define GP_LVL2 0x38
81
Patrick Georgie72a8a32012-11-06 11:05:09 +010082#define DEBUG_PERIODIC_SMIS 0
83
84#define MAINBOARD_POWER_OFF 0
85#define MAINBOARD_POWER_ON 1
86#define MAINBOARD_POWER_KEEP 2
87
Patrick Georgie72a8a32012-11-06 11:05:09 +010088/* D31:F0 LPC bridge */
89#define D31F0_PMBASE 0x40
90#define D31F0_ACPI_CNTL 0x44
91#define D31F0_GPIO_BASE 0x48
92#define D31F0_GPIO_CNTL 0x4c
93#define D31F0_PIRQA_ROUT 0x60
94#define D31F0_PIRQB_ROUT 0x61
95#define D31F0_PIRQC_ROUT 0x62
96#define D31F0_PIRQD_ROUT 0x63
97#define D31F0_SERIRQ_CNTL 0x64
98#define D31F0_PIRQE_ROUT 0x68
99#define D31F0_PIRQF_ROUT 0x69
100#define D31F0_PIRQG_ROUT 0x6a
101#define D31F0_PIRQH_ROUT 0x6b
102#define D31F0_LPC_IODEC 0x80
103#define D31F0_LPC_EN 0x82
104#define D31F0_GEN1_DEC 0x84
Vladimir Serbinenko9d2cb7c2014-08-10 21:56:41 +0200105#define D31F0_GEN2_DEC 0x88
106#define D31F0_GEN3_DEC 0x8c
107#define D31F0_GEN4_DEC 0x90
Patrick Georgie72a8a32012-11-06 11:05:09 +0100108#define D31F0_GEN_PMCON_1 0xa0
109#define D31F0_GEN_PMCON_3 0xa4
110#define D31F0_C5_EXIT_TIMING 0xa8
111#define D31F0_CxSTATE_CNF 0xa9
112#define D31F0_C4TIMING_CNT 0xaa
113#define D31F0_GPIO_ROUT 0xb8
Patrick Georgie72a8a32012-11-06 11:05:09 +0100114
115/* GEN_PMCON_3 bits */
116#define RTC_BATTERY_DEAD (1 << 2)
117#define RTC_POWER_FAILED (1 << 1)
118#define SLEEP_AFTER_POWER_FAIL (1 << 0)
119
120
121/* D31:F2 SATA */
122#define D31F2_IDE_TIM_PRI 0x40
123#define D31F2_IDE_TIM_SEC 0x42
124#define D31F2_SIDX 0xa0
125#define D31F2_SDAT 0xa4
126
127
128/* D30:F0 PCI-to-PCI bridge */
129#define D30F0_SMLT 0x1b
130
131
132/* D28:F0-5 PCIe root ports */
133#define D28Fx_XCAP 0x42
134#define D28Fx_SLCAP 0x54
135
136
137#define SMBUS_IO_BASE 0x0400
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
Patrick Georgie72a8a32012-11-06 11:05:09 +0100148#define RCBA_V0CTL 0x0014
149#define RCBA_V1CAP 0x001c
150#define RCBA_V1CTL 0x0020
151#define RCBA_V1STS 0x0026
152#define RCBA_PAT 0x0030
Stefan Taunercea31ea2018-08-11 18:45:28 +0200153#define RCBA_CIR1 0x0088
Patrick Georgie72a8a32012-11-06 11:05:09 +0100154#define RCBA_ESD 0x0104
155#define RCBA_ULD 0x0110
156#define RCBA_ULBA 0x0118
157#define RCBA_LCAP 0x01a4
158#define RCBA_LCTL 0x01a8
159#define RCBA_LSTS 0x01aa
Stefan Taunercea31ea2018-08-11 18:45:28 +0200160#define RCBA_CIR2 0x01f4
161#define RCBA_CIR3 0x01fc
162#define RCBA_BCR 0x0220
Patrick Georgie72a8a32012-11-06 11:05:09 +0100163#define RCBA_DMIC 0x0234
164#define RCBA_RPFN 0x0238
Stefan Taunercea31ea2018-08-11 18:45:28 +0200165#define RCBA_CIR13 0x0f20
166#define RCBA_CIR5 0x1d40
Patrick Georgie72a8a32012-11-06 11:05:09 +0100167#define RCBA_DMC 0x2010
Stefan Taunercea31ea2018-08-11 18:45:28 +0200168#define RCBA_CIR6 0x2024
169#define RCBA_CIR7 0x2034
Patrick Georgie72a8a32012-11-06 11:05:09 +0100170#define RCBA_HPTC 0x3404
Stefan Taunercea31ea2018-08-11 18:45:28 +0200171#define GCS 0x3410
Patrick Georgie72a8a32012-11-06 11:05:09 +0100172#define RCBA_BUC 0x3414
173#define RCBA_FD 0x3418 /* Function Disable, see below. */
174#define RCBA_CG 0x341c
175#define RCBA_FDSW 0x3420
Stefan Taunercea31ea2018-08-11 18:45:28 +0200176#define RCBA_CIR8 0x3430
177#define RCBA_CIR9 0x350c
178#define RCBA_CIR10 0x352c
Martin Roth2ed0aa22016-01-05 20:58:58 -0700179#define RCBA_MAP 0x35f0 /* UHCI controller #6 remapping */
Patrick Georgie72a8a32012-11-06 11:05:09 +0100180
181#define BUC_LAND (1 << 5) /* LAN */
182#define FD_SAD2 (1 << 25) /* SATA #2 */
183#define FD_TTD (1 << 24) /* Thermal Throttle */
184#define FD_PE6D (1 << 21) /* PCIe root port 6 */
185#define FD_PE5D (1 << 20) /* PCIe root port 5 */
186#define FD_PE4D (1 << 19) /* PCIe root port 4 */
187#define FD_PE3D (1 << 18) /* PCIe root port 3 */
188#define FD_PE2D (1 << 17) /* PCIe root port 2 */
189#define FD_PE1D (1 << 16) /* PCIe root port 1 */
190#define FD_EHCI1D (1 << 15) /* EHCI #1 */
191#define FD_LBD (1 << 14) /* LPC bridge */
192#define FD_EHCI2D (1 << 13) /* EHCI #2 */
193#define FD_U5D (1 << 12) /* UHCI #5 */
194#define FD_U4D (1 << 11) /* UHCI #4 */
195#define FD_U3D (1 << 10) /* UHCI #3 */
196#define FD_U2D (1 << 9) /* UHCI #2 */
197#define FD_U1D (1 << 8) /* UHCI #1 */
198#define FD_U6D (1 << 7) /* UHCI #6 */
199#define FD_HDAD (1 << 4) /* HD audio */
200#define FD_SD (1 << 3) /* SMBus */
201#define FD_SAD1 (1 << 2) /* SATA #1 */
202
203
Patrick Georgie72a8a32012-11-06 11:05:09 +0100204#ifndef __ACPI__
205#ifndef __ASSEMBLER__
206
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +0200207#include <device/pci_ops.h>
208
Patrick Georgie72a8a32012-11-06 11:05:09 +0100209static inline int lpc_is_mobile(const u16 devid)
210{
211 return (devid == 0x2917) || (devid == 0x2919);
212}
213#define LPC_IS_MOBILE(dev) lpc_is_mobile(pci_read_config16(dev, PCI_DEVICE_ID))
214
215#if defined(__PRE_RAM__)
216void enable_smbus(void);
217int smbus_read_byte(unsigned device, unsigned address);
218void i82801ix_early_init(void);
219void i82801ix_dmi_setup(void);
220void i82801ix_dmi_poll_vc1(void);
221#endif
222
223#endif
224#endif
225
226#endif