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 #include <console/console.h>
7 #include <device/device.h>
8 #include <device/pci.h>
9 #include <device/pci_ids.h>
10 #include <device/pci_ops.h>
11 #include "./cpu_rev.c"
13 static cpu_reset_count = 0; //By LYH
14 static void misc_control_init(struct device *dev)
18 printk_debug("NB: Function 3 Misc Control.. ");
20 /* disable error reporting */
21 cmd = pci_read_config32(dev, 0x44);
22 cmd |= (1<<6) | (1<<25);
23 pci_write_config32(dev, 0x44, cmd );
24 if (is_cpu_pre_c0()) {
26 cmd = pci_read_config32(dev, 0x80);
28 pci_write_config32(dev, 0x80, cmd );
29 cmd = pci_read_config32(dev, 0x84);
32 pci_write_config32(dev, 0x84, cmd );
34 cmd = pci_read_config32(dev, 0x70);
37 pci_write_config32(dev, 0x70, cmd );
38 cmd = pci_read_config32(dev, 0x7c);
40 pci_write_config32(dev, 0x7c, cmd );
45 cmd = pci_read_config32(dev, 0xd4);
46 if(cmd != 0x04e20707) {
48 pci_write_config32(dev, 0xd4, cmd );
54 pci_write_config32(dev, 0xd4, cmd );
57 #if HAVE_HARD_RESET==1
58 cpu_reset_count++; //by LYH
59 cmd = pci_read_config32(dev, 0xdc);
60 if((cmd & 0x0000ff00) != 0x02500) {
63 pci_write_config32(dev, 0xdc, cmd );
64 if(cpu_reset_count==CONFIG_MAX_CPUS) { //By LYH
65 printk_debug("resetting cpu\n");
71 printk_debug("done.\n");
74 static struct device_operations mcf3_ops = {
75 .read_resources = pci_dev_read_resources,
76 .set_resources = pci_dev_set_resources,
77 .enable_resources = pci_dev_enable_resources,
78 .init = misc_control_init,
82 static struct pci_driver mcf3_driver __pci_driver = {
84 .vendor = PCI_VENDOR_ID_AMD,