Since some people disapprove of white space cleanups mixed in regular commits
[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 #define IO_APIC_ADDR            0xfec00000
40
41 /*
42  * HPET Memory Address Range. Possible values:
43  * 0xfed00000 for FED0_0000h - FED0_03FFh
44  * 0xfed01000 for FED0_1000h - FED0_13FFh
45  * 0xfed02000 for FED0_2000h - FED0_23FFh
46  * 0xfed03000 for FED0_3000h - FED0_33FFh
47  */
48 #define HPET_ADDR               0xfed00000
49
50 #define DEBUG_PERIODIC_SMIS 0
51
52 #define MAINBOARD_POWER_OFF     0
53 #define MAINBOARD_POWER_ON      1
54 #define MAINBOARD_POWER_KEEP    2
55
56 #ifndef CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL
57 #define CONFIG_MAINBOARD_POWER_ON_AFTER_POWER_FAIL MAINBOARD_POWER_ON
58 #endif
59
60 /*
61  * 000 = Non-combined. P0 is primary master. P1 is secondary master.
62  * 001 = Non-combined. P0 is secondary master. P1 is primary master.
63  * 100 = Combined. P0 is primary master. P1 is primary slave. IDE is secondary;
64  *       Primary IDE channel disabled.
65  * 101 = Combined. P0 is primary slave. P1 is primary master. IDE is secondary.
66  * 110 = Combined. IDE is primary. P0 is secondary master. P1 is secondary
67  *       slave; Secondary IDE channel disabled.
68  * 111 = Combined. IDE is primary. P0 is secondary slave. P1 is secondary master.
69  */
70 /* PCI Configuration Space (D31:F1) */
71 #define IDE_TIM_PRI             0x40    /* IDE timings, primary */
72 #define IDE_TIM_SEC             0x42    /* IDE timings, secondary */
73
74 /* IDE_TIM bits */
75 #define IDE_DECODE_ENABLE       (1 << 15)
76
77
78
79 #define PCI_DMA_CFG     0x90
80 #define SERIRQ_CNTL     0x64
81 #define GEN_CNTL        0xd0
82 #define GEN_STS         0xd4
83 #define RTC_CONF        0xd8
84 #define GEN_PMCON_3     0xa4
85
86 #define PCICMD          0x04
87 #define PMBASE          0x40
88 #define   PMBASE_ADDR   0x0400
89 #define ACPI_CNTL       0x44
90 #define BIOS_CNTL       0x4E
91 #define GPIO_BASE       0x58
92 #define GPIO_CNTL       0x5C
93 #define   GPIOBASE_ADDR 0x0500
94 #define PIRQA_ROUT      0x60
95 #define PIRQB_ROUT      0x61
96 #define PIRQC_ROUT      0x62
97 #define PIRQD_ROUT      0x63
98 #define PIRQE_ROUT      0x68
99 #define PIRQF_ROUT      0x69
100 #define PIRQG_ROUT      0x6A
101 #define PIRQH_ROUT      0x6B
102 #define COM_DEC         0xE0
103 #define LPC_EN          0xE6
104 #define FUNC_DIS        0xF2
105
106 /* 1e f0 244e */
107
108 #define CMD             0x04
109 #define SBUS_NUM        0x19
110 #define SUB_BUS_NUM     0x1A
111 #define SMLT            0x1B
112 #define IOBASE          0x1C
113 #define IOLIM           0x1D
114 #define MEMBASE         0x20
115 #define MEMLIM          0x22
116 #define CNF             0x50
117 #define MTT             0x70
118 #define PCI_MAST_STS    0x82
119
120 #define RTC_FAILED      (1 <<2)
121
122
123 #define SMBUS_IO_BASE 0x1000
124
125 #define SMBHSTSTAT 0x0
126 #define SMBHSTCTL  0x2
127 #define SMBHSTCMD  0x3
128 #define SMBXMITADD 0x4
129 #define SMBHSTDAT0 0x5
130 #define SMBHSTDAT1 0x6
131 #define SMBBLKDAT  0x7
132 #define SMBTRNSADD 0x9
133 #define SMBSLVDATA 0xa
134 #define SMLINK_PIN_CTL 0xe
135 #define SMBUS_PIN_CTL  0xf
136
137 /* Between 1-10 seconds, We should never timeout normally
138  * Longer than this is just painful when a timeout condition occurs.
139  */
140 #define SMBUS_TIMEOUT (100*1000)
141
142 #define PM1_STS         0x00
143 #define   WAK_STS       (1 << 15)
144 #define   PCIEXPWAK_STS (1 << 14)
145 #define   PRBTNOR_STS   (1 << 11)
146 #define   RTC_STS       (1 << 10)
147 #define   PWRBTN_STS    (1 << 8)
148 #define   GBL_STS       (1 << 5)
149 #define   BM_STS        (1 << 4)
150 #define   TMROF_STS     (1 << 0)
151 #define PM1_EN          0x02
152 #define   PCIEXPWAK_DIS (1 << 14)
153 #define   RTC_EN        (1 << 10)
154 #define   PWRBTN_EN     (1 << 8)
155 #define   GBL_EN        (1 << 5)
156 #define   TMROF_EN      (1 << 0)
157 #define PM1_CNT         0x04
158 #define   SLP_EN        (1 << 13)
159 #define   SLP_TYP       (7 << 10)
160 #define   GBL_RLS       (1 << 2)
161 #define   BM_RLD        (1 << 1)
162 #define   SCI_EN        (1 << 0)
163 #define PM1_TMR         0x08
164 #define PROC_CNT        0x10
165 #define LV2             0x14
166 #define LV3             0x15
167 #define LV4             0x16
168 #define PM2_CNT         0x20 // mobile only
169 #define GPE0_STS        0x28
170 #define   PME_B0_STS    (1 << 13)
171 #define   USB3_STS      (1 << 12)
172 #define   PME_STS       (1 << 11)
173 #define   BATLOW_STS    (1 << 10)
174 #define   GST_STS       (1 << 9)
175 #define   RI_STS        (1 << 8)
176 #define   SMB_WAK_STS   (1 << 7)
177 #define   TCOSCI_STS    (1 << 6)
178 #define   AC97_STS      (1 << 5)
179 #define   USB2_STS      (1 << 4)
180 #define   USB1_STS      (1 << 3)
181 #define   SWGPE_STS     (1 << 2)
182 #define   HOT_PLUG_STS  (1 << 1)
183 #define   THRM_STS      (1 << 0)
184 #define GPE0_EN         0x2c
185 #define   PME_B0_EN     (1 << 13)
186 #define   PME_EN        (1 << 11)
187 #define SMI_EN          0x30
188 #define   EL_SMI_EN      (1 << 25) // Intel Quick Resume Technology
189 #define   INTEL_USB2_EN  (1 << 18) // Intel-Specific USB2 SMI logic
190 #define   LEGACY_USB2_EN (1 << 17) // Legacy USB2 SMI logic
191 #define   PERIODIC_EN    (1 << 14) // SMI on PERIODIC_STS in SMI_STS
192 #define   TCO_EN         (1 << 13) // Enable TCO Logic (BIOSWE et al)
193 #define   MCSMI_EN       (1 << 11) // Trap microcontroller range access
194 #define   BIOS_RLS       (1 <<  7) // asserts SCI on bit set
195 #define   SWSMI_TMR_EN   (1 <<  6) // start software smi timer on bit set
196 #define   APMC_EN        (1 <<  5) // Writes to APM_CNT cause SMI#
197 #define   SLP_SMI_EN     (1 <<  4) // Write to SLP_EN in PM1_CNT asserts SMI#
198 #define   LEGACY_USB_EN  (1 <<  3) // Legacy USB circuit SMI logic
199 #define   BIOS_EN        (1 <<  2) // Assert SMI# on setting GBL_RLS bit
200 #define   EOS            (1 <<  1) // End of SMI (deassert SMI#)
201 #define   GBL_SMI_EN     (1 <<  0) // SMI# generation at all?
202 #define SMI_STS         0x34
203 #define ALT_GP_SMI_EN   0x38
204 #define ALT_GP_SMI_STS  0x3a
205 #define GPE_CNTL        0x42
206 #define DEVACT_STS      0x44
207 #define SS_CNT          0x50
208 #define C3_RES          0x54
209
210 #define TCOBASE         0x60 /* TCO Base Address Register */
211 #define TCO1_CNT        0x08 /* TCO1 Control Register */
212
213 #define GEN_PMCON_1             0xa0
214 #define GEN_PMCON_2             0xa2
215 #define GEN_PMCON_3             0xa4
216
217 /* GEN_PMCON_3 bits */
218 #define RTC_BATTERY_DEAD        (1 << 2)
219 #define RTC_POWER_FAILED        (1 << 1)
220 #define SLEEP_AFTER_POWER_FAIL  (1 << 0)
221
222 #endif /* I82801DX_H */