Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2003 Linux Networx |
| 5 | * Copyright (C) 2003 SuSE Linux AG |
| 6 | * Copyright (C) 2005 Tyan Computer |
| 7 | * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer) |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 22 | */ |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 23 | |
| 24 | /* From 82801DBM, needs to be fixed to support everything the 82801ER does. */ |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 25 | |
| 26 | #include <console/console.h> |
| 27 | #include <device/device.h> |
| 28 | #include <device/pci.h> |
| 29 | #include <device/pci_ids.h> |
| 30 | #include <pc80/mc146818rtc.h> |
| 31 | #include <pc80/isa-dma.h> |
| 32 | #include <arch/io.h> |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 33 | #include "i82801bx.h" |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 34 | |
| 35 | #define NMI_OFF 0 |
| 36 | |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 37 | typedef struct southbridge_intel_i82801bx_config config_t; |
Joseph Smith | 4f0154c | 2009-05-02 21:30:57 +0000 | [diff] [blame] | 38 | |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 39 | /* PIRQ[n]_ROUT[3:0] - PIRQ Routing Control |
| 40 | * 0x00 - 0000 = Reserved |
| 41 | * 0x01 - 0001 = Reserved |
| 42 | * 0x02 - 0010 = Reserved |
| 43 | * 0x03 - 0011 = IRQ3 |
| 44 | * 0x04 - 0100 = IRQ4 |
| 45 | * 0x05 - 0101 = IRQ5 |
| 46 | * 0x06 - 0110 = IRQ6 |
| 47 | * 0x07 - 0111 = IRQ7 |
| 48 | * 0x08 - 1000 = Reserved |
| 49 | * 0x09 - 1001 = IRQ9 |
| 50 | * 0x0A - 1010 = IRQ10 |
| 51 | * 0x0B - 1011 = IRQ11 |
| 52 | * 0x0C - 1100 = IRQ12 |
| 53 | * 0x0D - 1101 = Reserved |
| 54 | * 0x0E - 1110 = IRQ14 |
| 55 | * 0x0F - 1111 = IRQ15 |
| 56 | * PIRQ[n]_ROUT[7] - PIRQ Routing Control |
| 57 | * 0x80 - The PIRQ is not routed. |
| 58 | */ |
| 59 | |
| 60 | #define PIRQA 0x03 |
Joseph Smith | 03c65ef | 2009-05-01 04:53:58 +0000 | [diff] [blame] | 61 | #define PIRQB 0x04 |
| 62 | #define PIRQC 0x05 |
| 63 | #define PIRQD 0x06 |
| 64 | #define PIRQE 0x07 |
| 65 | #define PIRQF 0x09 |
| 66 | #define PIRQG 0x0A |
| 67 | #define PIRQH 0x0B |
| 68 | |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 69 | /* |
| 70 | * Use 0x0ef8 for a bitmap to cover all these IRQ's. |
Joseph Smith | 4f0154c | 2009-05-02 21:30:57 +0000 | [diff] [blame] | 71 | * Use the defined IRQ values above or set mainboard |
| 72 | * specific IRQ values in your mainboards Config.lb. |
| 73 | */ |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 74 | |
Myles Watson | e32d399 | 2010-07-07 15:09:09 +0000 | [diff] [blame^] | 75 | static void i82801bx_enable_apic(struct device *dev) |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 76 | { |
| 77 | uint32_t reg32; |
| 78 | volatile uint32_t *ioapic_index = (volatile uint32_t *)0xfec00000; |
| 79 | volatile uint32_t *ioapic_data = (volatile uint32_t *)0xfec00010; |
| 80 | |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 81 | /* Set ACPI base address (I/O space). */ |
| 82 | pci_write_config32(dev, PMBASE, (PMBASE_ADDR | 1)); |
| 83 | |
| 84 | /* Enable ACPI I/O and power management. */ |
| 85 | pci_write_config8(dev, ACPI_CNTL, 0x10); |
| 86 | |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 87 | reg32 = pci_read_config32(dev, GEN_CNTL); |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 88 | reg32 |= (3 << 7); /* Enable IOAPIC */ |
| 89 | reg32 |= (1 << 13); /* Coprocessor error enable */ |
| 90 | reg32 |= (1 << 1); /* Delayed transaction enable */ |
| 91 | reg32 |= (1 << 2); /* DMA collection buffer enable */ |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 92 | pci_write_config32(dev, GEN_CNTL, reg32); |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 93 | printk(BIOS_DEBUG, "IOAPIC Southbridge enabled %x\n", reg32); |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 94 | |
| 95 | *ioapic_index = 0; |
| 96 | *ioapic_data = (1 << 25); |
| 97 | |
| 98 | *ioapic_index = 0; |
| 99 | reg32 = *ioapic_data; |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 100 | printk(BIOS_DEBUG, "Southbridge APIC ID = %x\n", reg32); |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 101 | if (reg32 != (1 << 25)) |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 102 | die("APIC Error\n"); |
| 103 | |
| 104 | /* TODO: From i82801ca, needed/useful on other ICH? */ |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 105 | *ioapic_index = 3; /* Select Boot Configuration register. */ |
| 106 | *ioapic_data = 1; /* Use Processor System Bus to deliver interrupts. */ |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 107 | } |
| 108 | |
Myles Watson | e32d399 | 2010-07-07 15:09:09 +0000 | [diff] [blame^] | 109 | static void i82801bx_enable_serial_irqs(struct device *dev) |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 110 | { |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 111 | /* Set packet length and toggle silent mode bit. */ |
| 112 | pci_write_config8(dev, SERIRQ_CNTL, |
| 113 | (1 << 7) | (1 << 6) | ((21 - 17) << 2) | (0 << 0)); |
| 114 | pci_write_config8(dev, SERIRQ_CNTL, |
| 115 | (1 << 7) | (0 << 6) | ((21 - 17) << 2) | (0 << 0)); |
| 116 | /* TODO: Explain/#define the real meaning of these magic numbers. */ |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 117 | } |
| 118 | |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 119 | static void i82801bx_pirq_init(device_t dev, uint16_t ich_model) |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 120 | { |
Joseph Smith | 4f0154c | 2009-05-02 21:30:57 +0000 | [diff] [blame] | 121 | /* Get the chip configuration */ |
| 122 | config_t *config = dev->chip_info; |
| 123 | |
| 124 | if (config->pirqa_routing) { |
| 125 | pci_write_config8(dev, PIRQA_ROUT, config->pirqa_routing); |
| 126 | } else { |
| 127 | pci_write_config8(dev, PIRQA_ROUT, PIRQA); |
| 128 | } |
| 129 | |
| 130 | if (config->pirqb_routing) { |
| 131 | pci_write_config8(dev, PIRQB_ROUT, config->pirqb_routing); |
| 132 | } else { |
| 133 | pci_write_config8(dev, PIRQB_ROUT, PIRQB); |
| 134 | } |
| 135 | |
| 136 | if (config->pirqc_routing) { |
| 137 | pci_write_config8(dev, PIRQC_ROUT, config->pirqc_routing); |
| 138 | } else { |
| 139 | pci_write_config8(dev, PIRQC_ROUT, PIRQC); |
| 140 | } |
| 141 | |
| 142 | if (config->pirqd_routing) { |
| 143 | pci_write_config8(dev, PIRQD_ROUT, config->pirqd_routing); |
| 144 | } else { |
| 145 | pci_write_config8(dev, PIRQD_ROUT, PIRQD); |
| 146 | } |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 147 | |
| 148 | /* Route PIRQE - PIRQH (for ICH2-ICH9). */ |
| 149 | if (ich_model >= 0x2440) { |
Joseph Smith | 4f0154c | 2009-05-02 21:30:57 +0000 | [diff] [blame] | 150 | |
| 151 | if (config->pirqe_routing) { |
| 152 | pci_write_config8(dev, PIRQE_ROUT, config->pirqe_routing); |
| 153 | } else { |
| 154 | pci_write_config8(dev, PIRQE_ROUT, PIRQE); |
| 155 | } |
| 156 | |
| 157 | if (config->pirqf_routing) { |
| 158 | pci_write_config8(dev, PIRQF_ROUT, config->pirqf_routing); |
| 159 | } else { |
| 160 | pci_write_config8(dev, PIRQF_ROUT, PIRQF); |
| 161 | } |
| 162 | |
| 163 | if (config->pirqg_routing) { |
| 164 | pci_write_config8(dev, PIRQG_ROUT, config->pirqg_routing); |
| 165 | } else { |
| 166 | pci_write_config8(dev, PIRQG_ROUT, PIRQG); |
| 167 | } |
| 168 | |
| 169 | if (config->pirqh_routing) { |
| 170 | pci_write_config8(dev, PIRQH_ROUT, config->pirqh_routing); |
| 171 | } else { |
| 172 | pci_write_config8(dev, PIRQH_ROUT, PIRQH); |
| 173 | } |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 174 | } |
| 175 | } |
| 176 | |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 177 | static void i82801bx_power_options(device_t dev) |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 178 | { |
| 179 | uint8_t byte; |
| 180 | int pwr_on = -1; |
Luc Verhaegen | a9c5ea0 | 2009-06-03 14:19:33 +0000 | [diff] [blame] | 181 | int nmi_option; |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 182 | |
| 183 | /* power after power fail */ |
| 184 | /* FIXME this doesn't work! */ |
| 185 | /* Which state do we want to goto after g3 (power restored)? |
| 186 | * 0 == S0 Full On |
| 187 | * 1 == S5 Soft Off |
| 188 | */ |
| 189 | pci_write_config8(dev, GEN_PMCON_3, pwr_on ? 0 : 1); |
Stefan Reinauer | c02b4fc | 2010-03-22 11:42:32 +0000 | [diff] [blame] | 190 | printk(BIOS_INFO, "Set power %s if power fails\n", pwr_on ? "on" : "off"); |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 191 | |
| 192 | /* Set up NMI on errors. */ |
| 193 | byte = inb(0x61); |
| 194 | byte &= ~(1 << 3); /* IOCHK# NMI Enable */ |
| 195 | byte &= ~(1 << 2); /* PCI SERR# Enable */ |
| 196 | outb(byte, 0x61); |
| 197 | byte = inb(0x70); |
| 198 | |
| 199 | nmi_option = NMI_OFF; |
Luc Verhaegen | a9c5ea0 | 2009-06-03 14:19:33 +0000 | [diff] [blame] | 200 | get_option(&nmi_option, "nmi"); |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 201 | if (nmi_option) { |
| 202 | byte &= ~(1 << 7); /* Set NMI. */ |
| 203 | outb(byte, 0x70); |
| 204 | } |
| 205 | } |
| 206 | |
Joseph Smith | b94a79f | 2010-06-21 23:25:06 +0000 | [diff] [blame] | 207 | static void gpio_init(device_t dev) |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 208 | { |
Joseph Smith | b94a79f | 2010-06-21 23:25:06 +0000 | [diff] [blame] | 209 | /* Set the value for GPIO base address register and enable GPIO. */ |
| 210 | pci_write_config32(dev, GPIO_BASE, (GPIO_BASE_ADDR | 1)); |
| 211 | pci_write_config8(dev, GPIO_CNTL, 0x10); |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 212 | } |
| 213 | |
Myles Watson | e32d399 | 2010-07-07 15:09:09 +0000 | [diff] [blame^] | 214 | static void i82801bx_rtc_init(struct device *dev) |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 215 | { |
| 216 | uint8_t reg8; |
| 217 | uint32_t reg32; |
| 218 | int rtc_failed; |
| 219 | |
| 220 | reg8 = pci_read_config8(dev, GEN_PMCON_3); |
| 221 | rtc_failed = reg8 & RTC_BATTERY_DEAD; |
| 222 | if (rtc_failed) { |
| 223 | reg8 &= ~(1 << 1); /* Preserve the power fail state. */ |
| 224 | pci_write_config8(dev, GEN_PMCON_3, reg8); |
| 225 | } |
| 226 | reg32 = pci_read_config32(dev, GEN_STS); |
| 227 | rtc_failed |= reg32 & (1 << 2); |
| 228 | rtc_init(rtc_failed); |
| 229 | |
| 230 | /* Enable access to the upper 128 byte bank of CMOS RAM. */ |
| 231 | pci_write_config8(dev, RTC_CONF, 0x04); |
| 232 | } |
| 233 | |
Myles Watson | e32d399 | 2010-07-07 15:09:09 +0000 | [diff] [blame^] | 234 | static void i82801bx_lpc_route_dma(struct device *dev, uint8_t mask) |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 235 | { |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 236 | uint16_t reg16; |
| 237 | int i; |
| 238 | |
| 239 | reg16 = pci_read_config16(dev, PCI_DMA_CFG); |
| 240 | reg16 &= 0x300; |
| 241 | for (i = 0; i < 8; i++) { |
| 242 | if (i == 4) |
| 243 | continue; |
| 244 | reg16 |= ((mask & (1 << i)) ? 3 : 1) << (i * 2); |
| 245 | } |
| 246 | pci_write_config16(dev, PCI_DMA_CFG, reg16); |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 247 | } |
| 248 | |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 249 | static void i82801bx_lpc_decode_en(device_t dev, uint16_t ich_model) |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 250 | { |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 251 | /* Decode 0x3F8-0x3FF (COM1) for COMA port, 0x2F8-0x2FF (COM2) for COMB. |
| 252 | * LPT decode defaults to 0x378-0x37F and 0x778-0x77F. |
| 253 | * Floppy decode defaults to 0x3F0-0x3F5, 0x3F7. |
| 254 | * We also need to set the value for LPC I/F Enables Register. |
| 255 | * Note: ICH-ICH5 registers differ from ICH6-ICH9. |
| 256 | */ |
| 257 | if (ich_model <= 0x24D0) { |
| 258 | pci_write_config8(dev, COM_DEC, 0x10); |
| 259 | pci_write_config16(dev, LPC_EN_ICH0_5, 0x300F); |
| 260 | } else if (ich_model >= 0x2640) { |
| 261 | pci_write_config8(dev, LPC_IO_DEC, 0x10); |
| 262 | pci_write_config16(dev, LPC_EN_ICH6_9, 0x300F); |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 263 | } |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 264 | } |
| 265 | |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 266 | static void lpc_init(struct device *dev) |
| 267 | { |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 268 | uint16_t ich_model = pci_read_config16(dev, PCI_DEVICE_ID); |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 269 | |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 270 | /* Set the value for PCI command register. */ |
| 271 | pci_write_config16(dev, PCI_COMMAND, 0x000f); |
| 272 | |
| 273 | /* IO APIC initialization. */ |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 274 | i82801bx_enable_apic(dev); |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 275 | |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 276 | i82801bx_enable_serial_irqs(dev); |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 277 | |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 278 | /* Setup the PIRQ. */ |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 279 | i82801bx_pirq_init(dev, ich_model); |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 280 | |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 281 | /* Setup power options. */ |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 282 | i82801bx_power_options(dev); |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 283 | |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 284 | /* Set the state of the GPIO lines. */ |
Joseph Smith | b94a79f | 2010-06-21 23:25:06 +0000 | [diff] [blame] | 285 | gpio_init(dev); |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 286 | |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 287 | /* Initialize the real time clock. */ |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 288 | i82801bx_rtc_init(dev); |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 289 | |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 290 | /* Route DMA. */ |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 291 | i82801bx_lpc_route_dma(dev, 0xff); |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 292 | |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 293 | /* Initialize ISA DMA. */ |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 294 | isa_dma_init(); |
| 295 | |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 296 | /* Setup decode ports and LPC I/F enables. */ |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 297 | i82801bx_lpc_decode_en(dev, ich_model); |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 298 | } |
| 299 | |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 300 | static void i82801bx_lpc_read_resources(device_t dev) |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 301 | { |
| 302 | struct resource *res; |
| 303 | |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 304 | /* Get the normal PCI resources of this device. */ |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 305 | pci_dev_read_resources(dev); |
| 306 | |
Joseph Smith | 68d8a56 | 2007-10-30 21:55:11 +0000 | [diff] [blame] | 307 | /* Add an extra subtractive resource for both memory and I/O. */ |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 308 | res = new_resource(dev, IOINDEX_SUBTRACTIVE(0, 0)); |
Myles Watson | 29cc9ed | 2009-07-02 18:56:24 +0000 | [diff] [blame] | 309 | res->base = 0; |
| 310 | res->size = 0x1000; |
| 311 | res->flags = IORESOURCE_IO | IORESOURCE_SUBTRACTIVE | |
| 312 | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 313 | |
| 314 | res = new_resource(dev, IOINDEX_SUBTRACTIVE(1, 0)); |
Myles Watson | 29cc9ed | 2009-07-02 18:56:24 +0000 | [diff] [blame] | 315 | res->base = 0xff800000; |
| 316 | res->size = 0x00800000; /* 8 MB for flash */ |
| 317 | res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE | |
| 318 | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; |
| 319 | |
| 320 | res = new_resource(dev, 3); /* IOAPIC */ |
| 321 | res->base = 0xfec00000; |
| 322 | res->size = 0x00001000; |
| 323 | res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 324 | } |
| 325 | |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 326 | static struct device_operations lpc_ops = { |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 327 | .read_resources = i82801bx_lpc_read_resources, |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 328 | .set_resources = pci_dev_set_resources, |
Myles Watson | 7eac445 | 2010-06-17 16:16:56 +0000 | [diff] [blame] | 329 | .enable_resources = pci_dev_enable_resources, |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 330 | .init = lpc_init, |
| 331 | .scan_bus = scan_static_bus, |
Stefan Reinauer | 138be83 | 2010-02-27 01:50:21 +0000 | [diff] [blame] | 332 | .enable = i82801bx_enable, |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 333 | }; |
| 334 | |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 335 | static const struct pci_driver i82801aa_lpc __pci_driver = { |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 336 | .ops = &lpc_ops, |
| 337 | .vendor = PCI_VENDOR_ID_INTEL, |
| 338 | .device = 0x2410, |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 339 | }; |
| 340 | |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 341 | static const struct pci_driver i82801ab_lpc __pci_driver = { |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 342 | .ops = &lpc_ops, |
| 343 | .vendor = PCI_VENDOR_ID_INTEL, |
| 344 | .device = 0x2420, |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 345 | }; |
| 346 | |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 347 | static const struct pci_driver i82801ba_lpc __pci_driver = { |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 348 | .ops = &lpc_ops, |
| 349 | .vendor = PCI_VENDOR_ID_INTEL, |
| 350 | .device = 0x2440, |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 351 | }; |
| 352 | |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 353 | static const struct pci_driver i82801ca_lpc __pci_driver = { |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 354 | .ops = &lpc_ops, |
| 355 | .vendor = PCI_VENDOR_ID_INTEL, |
| 356 | .device = 0x2480, |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 357 | }; |
| 358 | |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 359 | static const struct pci_driver i82801db_lpc __pci_driver = { |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 360 | .ops = &lpc_ops, |
| 361 | .vendor = PCI_VENDOR_ID_INTEL, |
| 362 | .device = 0x24c0, |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 363 | }; |
| 364 | |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 365 | static const struct pci_driver i82801dbm_lpc __pci_driver = { |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 366 | .ops = &lpc_ops, |
| 367 | .vendor = PCI_VENDOR_ID_INTEL, |
| 368 | .device = 0x24cc, |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 369 | }; |
| 370 | |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 371 | /* 82801EB and 82801ER */ |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 372 | static const struct pci_driver i82801ex_lpc __pci_driver = { |
Uwe Hermann | dfb3c13 | 2007-06-19 22:47:11 +0000 | [diff] [blame] | 373 | .ops = &lpc_ops, |
| 374 | .vendor = PCI_VENDOR_ID_INTEL, |
| 375 | .device = 0x24d0, |
Corey Osgood | e99bd10 | 2007-06-14 06:10:57 +0000 | [diff] [blame] | 376 | }; |