Uwe Hermann | 9da69f8 | 2007-11-30 02:08:26 +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. |
Uwe Hermann | 9da69f8 | 2007-11-30 02:08:26 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | |
| 21 | #include <stdint.h> |
| 22 | #include <console/console.h> |
| 23 | #include <device/device.h> |
| 24 | #include <device/pci.h> |
| 25 | #include <device/pci_ids.h> |
| 26 | #include <pc80/isa-dma.h> |
| 27 | #include <pc80/mc146818rtc.h> |
| 28 | #include "i82371eb.h" |
| 29 | |
| 30 | static void isa_init(struct device *dev) |
| 31 | { |
| 32 | u16 reg16; |
| 33 | u32 reg32; |
| 34 | |
| 35 | /* Initialize the real time clock (RTC). */ |
| 36 | rtc_init(0); |
| 37 | |
Uwe Hermann | 9da69f8 | 2007-11-30 02:08:26 +0000 | [diff] [blame] | 38 | /* |
| 39 | * The PIIX4 can support the full ISA bus, or the Extended I/O (EIO) |
| 40 | * bus, which is a subset of ISA. We select the full ISA bus here. |
| 41 | */ |
| 42 | reg32 = pci_read_config32(dev, GENCFG); |
| 43 | reg32 |= ISA; /* Select ISA, not EIO. */ |
| 44 | pci_write_config16(dev, GENCFG, reg32); |
| 45 | |
| 46 | /* Initialize ISA DMA. */ |
| 47 | isa_dma_init(); |
| 48 | } |
| 49 | |
Myles Watson | 29cc9ed | 2009-07-02 18:56:24 +0000 | [diff] [blame] | 50 | static void sb_read_resources(struct device *dev) |
| 51 | { |
| 52 | struct resource *res; |
| 53 | |
| 54 | pci_dev_read_resources(dev); |
| 55 | |
| 56 | res = new_resource(dev, 1); |
| 57 | res->base = 0x0UL; |
| 58 | res->size = 0x1000UL; |
| 59 | res->limit = 0xffffUL; |
| 60 | res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; |
| 61 | |
| 62 | res = new_resource(dev, 2); |
| 63 | res->base = 0xff800000UL; |
| 64 | res->size = 0x00800000UL; /* 8 MB for flash */ |
| 65 | res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; |
| 66 | |
| 67 | res = new_resource(dev, 3); /* IOAPIC */ |
| 68 | res->base = 0xfec00000; |
| 69 | res->size = 0x00001000; |
| 70 | res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; |
| 71 | } |
| 72 | |
| 73 | const struct device_operations isa_ops = { |
| 74 | .read_resources = sb_read_resources, |
Uwe Hermann | 9da69f8 | 2007-11-30 02:08:26 +0000 | [diff] [blame] | 75 | .set_resources = pci_dev_set_resources, |
| 76 | .enable_resources = pci_dev_enable_resources, |
| 77 | .init = isa_init, |
| 78 | .scan_bus = scan_static_bus, /* TODO: Needed? */ |
| 79 | .enable = 0, |
| 80 | .ops_pci = 0, /* No subsystem IDs on 82371EB! */ |
| 81 | }; |
| 82 | |
| 83 | static const struct pci_driver isa_driver __pci_driver = { |
| 84 | .ops = &isa_ops, |
| 85 | .vendor = PCI_VENDOR_ID_INTEL, |
| 86 | .device = PCI_DEVICE_ID_INTEL_82371AB_ISA, |
| 87 | }; |
Myles Watson | 0520d55 | 2009-05-11 22:44:14 +0000 | [diff] [blame] | 88 | |
| 89 | static const struct pci_driver isa_SB_driver __pci_driver = { |
| 90 | .ops = &isa_ops, |
| 91 | .vendor = PCI_VENDOR_ID_INTEL, |
| 92 | .device = PCI_DEVICE_ID_INTEL_82371SB_ISA, |
| 93 | }; |