1 /* Turn off machine check triggers when reading
2 * pci space where there are no devices.
3 * This is necessary when scaning the bus for
4 * devices which is done by the kernel
6 * written in 2003 by Eric Biederman
8 * - Athlon64 workarounds by Stefan Reinauer
9 * - "reset once" logic by Yinghai Lu
12 #include <console/console.h>
13 #include <device/device.h>
14 #include <device/pci.h>
15 #include <device/pci_ids.h>
16 #include <device/pci_ops.h>
17 #include "./cpu_rev.c"
19 static cpu_reset_count = 0;
20 static void misc_control_init(struct device *dev)
24 printk_debug("NB: Function 3 Misc Control.. ");
26 /* disable error reporting */
27 cmd = pci_read_config32(dev, 0x44);
28 cmd |= (1<<6) | (1<<25);
29 pci_write_config32(dev, 0x44, cmd );
30 if (is_cpu_pre_c0()) {
32 cmd = pci_read_config32(dev, 0x80);
34 pci_write_config32(dev, 0x80, cmd );
35 cmd = pci_read_config32(dev, 0x84);
38 pci_write_config32(dev, 0x84, cmd );
40 cmd = pci_read_config32(dev, 0x70);
43 pci_write_config32(dev, 0x70, cmd );
44 cmd = pci_read_config32(dev, 0x7c);
46 pci_write_config32(dev, 0x7c, cmd );
51 cmd = pci_read_config32(dev, 0xd4);
52 if(cmd != 0x04e20707) {
54 pci_write_config32(dev, 0xd4, cmd );
60 pci_write_config32(dev, 0xd4, cmd );
64 * FIXME: This preprocessor check is a mere workaround.
65 * The right fix is to walk over all links on all nodes
66 * and set the FIFO read pointer optimization value to
67 * 0x25 for each link connected to an AMD HT device.
69 * The reason this is only enabled for machines with more
70 * than one CPU is that Athlon64 machines don't have the
71 * link at all that is optimized in the code.
74 #if CONFIG_MAX_CPUS > 1
75 #if HAVE_HARD_RESET==1
77 cmd = pci_read_config32(dev, 0xdc);
78 if((cmd & 0x0000ff00) != 0x02500) {
81 pci_write_config32(dev, 0xdc, cmd );
82 if(cpu_reset_count==CONFIG_MAX_CPUS) {
83 printk_debug("resetting cpu\n");
89 printk_debug("done.\n");
92 static struct device_operations mcf3_ops = {
93 .read_resources = pci_dev_read_resources,
94 .set_resources = pci_dev_set_resources,
95 .enable_resources = pci_dev_enable_resources,
96 .init = misc_control_init,
100 static struct pci_driver mcf3_driver __pci_driver = {
102 .vendor = PCI_VENDOR_ID_AMD,