2 * (C) 2004 Linux Networx
4 #include <console/console.h>
5 #include <device/device.h>
6 #include <device/pci.h>
7 #include <device/pci_ids.h>
8 #include <device/pci_ops.h>
9 #include <arch/ioapic.h>
12 static void pic_init(struct device *dev)
17 /* Clear system errors */
18 word = pci_read_config16(dev, 0x06);
19 word |= 0xf900; /* Clear possible errors */
20 pci_write_config16(dev, 0x06, word);
22 /* enable interrupt lines */
23 pci_write_config8(dev, 0x3c, 0xff);
25 /* Setup the ioapic */
26 clear_ioapic(0xfec10000);
29 static void pic_read_resources(device_t dev)
33 /* Get the normal pci resources of this device */
34 pci_dev_read_resources(dev);
36 /* Report the pic1 mbar resource */
37 res = new_resource(dev, 0x44);
38 res->base = 0xfec10000;
40 res->limit = res->base + res->size -1;
43 res->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
44 IORESOURCE_STORED | IORESOURCE_ASSIGNED;
45 dev->command |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
48 static struct pci_operations lops_pci = {
49 /* Can we set the pci subsystem and device id? */
53 static struct device_operations pci_ops = {
54 .read_resources = pic_read_resources,
55 .set_resources = pci_dev_set_resources,
56 .enable_resources = pci_dev_enable_resources,
59 .enable = esb6300_enable,
63 static const struct pci_driver pci_driver __pci_driver = {
65 .vendor = PCI_VENDOR_ID_INTEL,
66 .device = PCI_DEVICE_ID_INTEL_6300ESB_APIC1,