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 <pc80/mc146818rtc.h>
11 static void amd8131_bus_read_resources(device_t dev)
16 static void amd8131_bus_set_resources(device_t dev)
19 pci_bus_read_resources(dev);
24 static void amd8131_bus_enable_resources(device_t dev)
27 pci_dev_set_resources(dev);
32 static void amd8131_bus_init(device_t dev)
40 static unsigned int amd8131_scan_bus(device_t bus, unsigned int max)
43 max = pcix_scan_bridge(bus, max);
48 static void amd8131_enable(device_t dev)
53 /* Clear all status bits and turn off memory, I/O and master enables. */
54 pci_write_config16(dev, PCI_COMMAND, 0x0000);
55 pci_write_config16(dev, PCI_STATUS, 0xffff);
58 * Read the existing primary/secondary/subordinate bus
59 * number configuration.
61 buses = pci_read_config32(dev, PCI_PRIMARY_BUS);
63 /* Configure the bus numbers for this bridge: the configuration
64 * transactions will not be propagated by the bridge if it is not
65 * correctly configured.
68 buses |= (((unsigned int) (dev->bus->secondary) << 0) |
69 ((unsigned int) (dev->bus->secondary) << 8) |
70 ((unsigned int) (dev->bus->secondary) << 16));
71 pci_write_config32(dev, PCI_PRIMARY_BUS, buses);
74 static struct device_operations pcix_ops = {
75 .read_resources = amd8131_bus_read_resources,
76 .set_resources = amd8131_bus_set_resources,
77 .enable_resources = amd8131_bus_enable_resources,
78 .init = amd8131_bus_init,
80 .enable = amd8131_enable,
83 static const struct pci_driver pcix_driver __pci_driver = {
85 .vendor = PCI_VENDOR_ID_AMD,
90 static void ioapic_enable(device_t dev)
93 value = pci_read_config32(dev, 0x44);
95 value |= ((1 << 1) | (1 << 0));
97 value &= ~((1 << 1) | (1 << 0));
99 pci_write_config32(dev, 0x44, value);
102 static struct device_operations ioapic_ops = {
103 .read_resources = pci_dev_read_resources,
104 .set_resources = pci_dev_set_resources,
105 .enable_resources = pci_dev_enable_resources,
108 .enable = ioapic_enable,
111 static const struct pci_driver ioapic_driver __pci_driver = {
113 .vendor = PCI_VENDOR_ID_AMD,