YhLu's changes to resolve several memory and other problems.
[coreboot.git] / src / southbridge / amd / amd8131 / amd8131_bridge.c
1 /*
2  * (C) 2003 Linux Networx
3  */
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
10 static void pcix_init(device_t dev)
11 {
12         uint16_t word;
13         uint8_t byte;
14
15         /* Enable memory write and invalidate ??? */
16         byte = pci_read_config8(dev, 0x04);
17         byte |= 0x10;
18         pci_write_config8(dev, 0x04, byte);
19         
20         /* Set drive strength */
21         word = pci_read_config16(dev, 0xe0);
22         word = 0x0404;
23         pci_write_config16(dev, 0xe0, word);
24         word = pci_read_config16(dev, 0xe4);
25         word = 0x0404;
26         pci_write_config16(dev, 0xe4, word);
27         
28         /* Set impedance */
29         word = pci_read_config16(dev, 0xe8);
30         word = 0x0404;
31         pci_write_config16(dev, 0xe8, word);
32         
33         return;
34 }
35
36 static struct device_operations pcix_ops  = {
37         .read_resources = pci_bus_read_resources,
38         .set_resources = pci_dev_set_resources,
39         .init = pcix_init,
40         .scan_bus = pci_scan_bridge,
41 };
42
43 static struct pci_driver pcix_driver __pci_driver = {
44         .ops    = &pcix_ops,
45         .vendor = PCI_VENDOR_ID_AMD,
46         .device = 0x7450,
47 };
48
49
50 static void ioapic_enable(device_t dev)
51 {
52         uint32_t value;
53         value = pci_read_config32(dev, 0x44);
54         if (dev->enable) {
55                 value |= ((1 << 1) | (1 << 0));
56         } else {
57                 value &= ~((1 << 1) | (1 << 0));
58         }
59         pci_write_config32(dev, 0x44, value);
60
61 //BY LYH
62         value = pci_read_config32(dev, 0x4);
63         value |= 6;
64         pci_write_config32(dev, 0x4, value);
65 //BY LYH END
66  
67
68 }
69
70 static struct device_operations ioapic_ops = {
71         .read_resources = pci_dev_read_resources,
72         .set_resources  = pci_dev_set_resources,
73         .init     = 0,
74         .scan_bus = 0,
75         .enable   = ioapic_enable,
76 };
77
78 static struct pci_driver ioapic_driver __pci_driver = {
79         .ops    = &ioapic_ops,
80         .vendor = PCI_VENDOR_ID_AMD,
81         .device = 0x7451,
82         
83 };