We define IO_APIC_ADDR in <arch/ioapic.h>, let's use it.
[coreboot.git] / src / southbridge / intel / i82801dx / i82801dx.h
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2004 Ron G. Minnich
5  * Copyright (C) 2004 Eric Biederman
6  * Copyright (C) 2008-2009 coresystems GmbH
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; version 2 of
11  * the License.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
21  */
22
23 /* the problem: we have 82801dbm support in fb1, and 82801er in fb2.
24  * fb1 code is what we want, fb2 structure is needed however.
25  * so we need to get fb1 code for 82801dbm into fb2 structure.
26  */
27 /* What I did: took the 80801er stuff from fb2, verify it against the
28  * db stuff in fb1, and made sure it was right.
29  */
30
31 #ifndef I82801DX_H
32 #define I82801DX_H
33
34 #if !defined(__PRE_RAM__)
35 #include "chip.h"
36 extern void i82801dx_enable(device_t dev);
37 #endif
38
39 /*
40  * HPET Memory Address Range. Possible values:
41  * 0xfed00000 for FED0_0000h - FED0_03FFh
42  * 0xfed01000 for FED0_1000h - FED0_13FFh
43  * 0xfed02000 for FED0_2000h - FED0_23FFh
44  * 0xfed03000 for FED0_3000h - FED0_33FFh
45  */
46 #define HPET_ADDR               0xfed00000
47
48 #define DEBUG_PERIODIC_SMIS 0
49
50 #define MAINBOARD_POWER_OFF     0
51 #define MAINBOARD_POWER_ON      1
52 #define MAINBOARD_POWER_KEEP    2
53
54 #ifndef CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL
55 #define CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL MAINBOARD_POWER_ON
56 #endif
57
58 /*
59  * 000 = Non-combined. P0 is primary master. P1 is secondary master.
60  * 001 = Non-combined. P0 is secondary master. P1 is primary master.
61  * 100 = Combined. P0 is primary master. P1 is primary slave. IDE is secondary;
62  *       Primary IDE channel disabled.
63  * 101 = Combined. P0 is primary slave. P1 is primary master. IDE is secondary.
64  * 110 = Combined. IDE is primary. P0 is secondary master. P1 is secondary
65  *       slave; Secondary IDE channel disabled.
66  * 111 = Combined. IDE is primary. P0 is secondary slave. P1 is secondary master.
67  */
68 /* PCI Configuration Space (D31:F1) */
69 #define IDE_TIM_PRI             0x40    /* IDE timings, primary */
70 #define IDE_TIM_SEC             0x42    /* IDE timings, secondary */
71
72 /* IDE_TIM bits */
73 #define IDE_DECODE_ENABLE       (1 << 15)
74
75
76
77 #define PCI_DMA_CFG     0x90
78 #define SERIRQ_CNTL     0x64
79 #define GEN_CNTL        0xd0
80 #define GEN_STS         0xd4
81 #define RTC_CONF        0xd8
82 #define GEN_PMCON_3     0xa4
83
84 #define PCICMD          0x04
85 #define PMBASE          0x40
86 #define   PMBASE_ADDR   0x0400
87 #define   DEFAULT_PMBASE PMBASE_ADDR
88 #define ACPI_CNTL       0x44
89 #define BIOS_CNTL       0x4E
90 #define GPIO_BASE       0x58
91 #define GPIO_CNTL       0x5C
92 #define   GPIOBASE_ADDR 0x0500
93 #define PIRQA_ROUT      0x60
94 #define PIRQB_ROUT      0x61
95 #define PIRQC_ROUT      0x62
96 #define PIRQD_ROUT      0x63
97 #define PIRQE_ROUT      0x68
98 #define PIRQF_ROUT      0x69
99 #define PIRQG_ROUT      0x6A
100 #define PIRQH_ROUT      0x6B
101 #define COM_DEC         0xE0
102 #define LPC_EN          0xE6
103 #define FUNC_DIS        0xF2
104
105 /* 1e f0 244e */
106
107 #define CMD             0x04
108 #define SBUS_NUM        0x19
109 #define SUB_BUS_NUM     0x1A
110 #define SMLT            0x1B
111 #define IOBASE          0x1C
112 #define IOLIM           0x1D
113 #define MEMBASE         0x20
114 #define MEMLIM          0x22
115 #define CNF             0x50
116 #define MTT             0x70
117 #define PCI_MAST_STS    0x82
118
119 #define RTC_FAILED      (1 <<2)
120
121
122 #define SMBUS_IO_BASE 0x1000
123
124 #define SMBHSTSTAT 0x0
125 #define SMBHSTCTL  0x2
126 #define SMBHSTCMD  0x3
127 #define SMBXMITADD 0x4
128 #define SMBHSTDAT0 0x5
129 #define SMBHSTDAT1 0x6
130 #define SMBBLKDAT  0x7
131 #define SMBTRNSADD 0x9
132 #define SMBSLVDATA 0xa
133 #define SMLINK_PIN_CTL 0xe
134 #define SMBUS_PIN_CTL  0xf
135
136 /* Between 1-10 seconds, We should never timeout normally
137  * Longer than this is just painful when a timeout condition occurs.
138  */
139 #define SMBUS_TIMEOUT (100*1000)
140
141 #define PM1_STS         0x00
142 #define   WAK_STS       (1 << 15)
143 #define   PCIEXPWAK_STS (1 << 14)
144 #define   PRBTNOR_STS   (1 << 11)
145 #define   RTC_STS       (1 << 10)
146 #define   PWRBTN_STS    (1 << 8)
147 #define   GBL_STS       (1 << 5)
148 #define   BM_STS        (1 << 4)
149 #define   TMROF_STS     (1 << 0)
150 #define PM1_EN          0x02
151 #define   PCIEXPWAK_DIS (1 << 14)
152 #define   RTC_EN        (1 << 10)
153 #define   PWRBTN_EN     (1 << 8)
154 #define   GBL_EN        (1 << 5)
155 #define   TMROF_EN      (1 << 0)
156 #define PM1_CNT         0x04
157 #define   SLP_EN        (1 << 13)
158 #define   SLP_TYP       (7 << 10)
159 #define   GBL_RLS       (1 << 2)
160 #define   BM_RLD        (1 << 1)
161 #define   SCI_EN        (1 << 0)
162 #define PM1_TMR         0x08
163 #define PROC_CNT        0x10
164 #define LV2             0x14
165 #define LV3             0x15
166 #define LV4             0x16
167 #define PM2_CNT         0x20 // mobile only
168 #define GPE0_STS        0x28
169 #define   PME_B0_STS    (1 << 13)
170 #define   USB3_STS      (1 << 12)
171 #define   PME_STS       (1 << 11)
172 #define   BATLOW_STS    (1 << 10)
173 #define   GST_STS       (1 << 9)
174 #define   RI_STS        (1 << 8)
175 #define   SMB_WAK_STS   (1 << 7)
176 #define   TCOSCI_STS    (1 << 6)
177 #define   AC97_STS      (1 << 5)
178 #define   USB2_STS      (1 << 4)
179 #define   USB1_STS      (1 << 3)
180 #define   SWGPE_STS     (1 << 2)
181 #define   HOT_PLUG_STS  (1 << 1)
182 #define   THRM_STS      (1 << 0)
183 #define GPE0_EN         0x2c
184 #define   PME_B0_EN     (1 << 13)
185 #define   PME_EN        (1 << 11)
186 #define SMI_EN          0x30
187 #define   EL_SMI_EN      (1 << 25) // Intel Quick Resume Technology
188 #define   INTEL_USB2_EN  (1 << 18) // Intel-Specific USB2 SMI logic
189 #define   LEGACY_USB2_EN (1 << 17) // Legacy USB2 SMI logic
190 #define   PERIODIC_EN    (1 << 14) // SMI on PERIODIC_STS in SMI_STS
191 #define   TCO_EN         (1 << 13) // Enable TCO Logic (BIOSWE et al)
192 #define   MCSMI_EN       (1 << 11) // Trap microcontroller range access
193 #define   BIOS_RLS       (1 <<  7) // asserts SCI on bit set
194 #define   SWSMI_TMR_EN   (1 <<  6) // start software smi timer on bit set
195 #define   APMC_EN        (1 <<  5) // Writes to APM_CNT cause SMI#
196 #define   SLP_SMI_EN     (1 <<  4) // Write to SLP_EN in PM1_CNT asserts SMI#
197 #define   LEGACY_USB_EN  (1 <<  3) // Legacy USB circuit SMI logic
198 #define   BIOS_EN        (1 <<  2) // Assert SMI# on setting GBL_RLS bit
199 #define   EOS            (1 <<  1) // End of SMI (deassert SMI#)
200 #define   GBL_SMI_EN     (1 <<  0) // SMI# generation at all?
201 #define SMI_STS         0x34
202 #define ALT_GP_SMI_EN   0x38
203 #define ALT_GP_SMI_STS  0x3a
204 #define GPE_CNTL        0x42
205 #define DEVACT_STS      0x44
206 #define SS_CNT          0x50
207 #define C3_RES          0x54
208
209 #define TCOBASE         0x60 /* TCO Base Address Register */
210 #define TCO1_CNT        0x08 /* TCO1 Control Register */
211
212 #define GEN_PMCON_1             0xa0
213 #define GEN_PMCON_2             0xa2
214 #define GEN_PMCON_3             0xa4
215
216 /* GEN_PMCON_3 bits */
217 #define RTC_BATTERY_DEAD        (1 << 2)
218 #define RTC_POWER_FAILED        (1 << 1)
219 #define SLEEP_AFTER_POWER_FAIL  (1 << 0)
220
221 #endif /* I82801DX_H */