2 * (C) 2003 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>
13 static void pcix_init(device_t dev)
20 /* Enable memory write and invalidate ??? */
21 byte = pci_read_config8(dev, 0x04);
23 pci_write_config8(dev, 0x04, byte);
25 /* Set drive strength */
26 word = pci_read_config16(dev, 0xe0);
28 pci_write_config16(dev, 0xe0, word);
29 word = pci_read_config16(dev, 0xe4);
31 pci_write_config16(dev, 0xe4, word);
34 word = pci_read_config16(dev, 0xe8);
36 pci_write_config16(dev, 0xe8, word);
38 /* Set discard unrequested prefetch data */
39 word = pci_read_config16(dev, 0x4c);
41 pci_write_config16(dev, 0x4c, word);
43 /* Set split transaction limits */
44 word = pci_read_config16(dev, 0xa8);
45 pci_write_config16(dev, 0xaa, word);
46 word = pci_read_config16(dev, 0xac);
47 pci_write_config16(dev, 0xae, word);
49 /* Set up error reporting, enable all */
50 /* system error enable */
51 dword = pci_read_config32(dev, 0x04);
53 pci_write_config32(dev, 0x04, dword);
55 /* system and error parity enable */
56 dword = pci_read_config32(dev, 0x3c);
58 pci_write_config32(dev, 0x3c, dword);
62 get_option(&nmi_option, "nmi");
64 dword = pci_read_config32(dev, 0x44);
66 pci_write_config32(dev, 0x44, dword);
69 /* Set up CRC flood enable */
70 dword = pci_read_config32(dev, 0xc0);
71 if(dword) { /* do device A only */
72 dword = pci_read_config32(dev, 0xc4);
74 pci_write_config32(dev, 0xc4, dword);
75 dword = pci_read_config32(dev, 0xc8);
77 pci_write_config32(dev, 0xc8, dword);
83 static struct device_operations pcix_ops = {
84 .read_resources = pci_bus_read_resources,
85 .set_resources = pci_dev_set_resources,
86 .enable_resources = pci_bus_enable_resources,
88 .scan_bus = pci_scan_bridge,
91 static struct pci_driver pcix_driver __pci_driver = {
93 .vendor = PCI_VENDOR_ID_AMD,
98 static void ioapic_enable(device_t dev)
101 value = pci_read_config32(dev, 0x44);
103 value |= ((1 << 1) | (1 << 0));
105 value &= ~((1 << 1) | (1 << 0));
107 pci_write_config32(dev, 0x44, value);
110 static struct device_operations ioapic_ops = {
111 .read_resources = pci_dev_read_resources,
112 .set_resources = pci_dev_set_resources,
113 .enable_resources = pci_dev_enable_resources,
116 .enable = ioapic_enable,
119 static struct pci_driver ioapic_driver __pci_driver = {
121 .vendor = PCI_VENDOR_ID_AMD,