patches from Yh Lu. Tested and working on HDAMA
[coreboot.git] / src / mainboard / tyan / s2880 / mainboard.c
1 #include <console/console.h>
2 #include <device/device.h>
3 #include <device/chip.h>
4 #include <device/pci.h>
5 #include <device/pci_ids.h>
6 #include <device/pci_ops.h>
7 #include "chip.h"
8 //#include <part/mainboard.h>
9 //#include "lsi_scsi.c"
10 unsigned long initial_apicid[MAX_CPUS] =
11 {
12         0,1
13 };
14 /*
15 static void fixup_lsi_53c1030(struct device *pdev)
16 {
17 //      uint8_t byte;
18         uint16_t word;
19
20         byte = 1;
21         pci_write_config8(pdev, 0xff, byte);
22            // Set the device id 
23 //      pci_write_config_word(pdev, PCI_DEVICE_ID, PCI_DEVICE_ID_LSILOGIC_53C1030);
24            // Set the subsytem vendor id 
25 //      pci_write_config16(pdev, PCI_SUBSYSTEM_VENDOR_ID, PCI_VENDOR_ID_TYAN);  
26         word = 0x10f1;
27         pci_write_config16(pdev, PCI_SUBSYSTEM_VENDOR_ID, word);
28             // Set the subsytem id 
29         word = 0x2880;
30         pci_write_config16(pdev, PCI_SUBSYSTEM_ID, word);
31             // Disable writes to the device id 
32         byte = 0;
33         pci_write_config8(pdev, 0xff, byte);
34
35 //      lsi_scsi_init(pdev);
36         
37 }
38 */
39 //extern static void lsi_scsi_init(struct device *dev);
40 /*static void print_pci_regs(struct device *dev)
41 {
42       uint8_t byte;
43       int i;
44
45       for(i=0;i<256;i++) {
46              byte = pci_read_config8(dev, i);
47    
48              if((i%16)==0) printk_info("\n %02x:",i);
49              printk_debug(" %02x ",byte);
50       }
51       printk_debug("\r\n");
52         
53 //        pci_write_config8(dev, 0x4, byte);
54
55 }
56 */
57 static void onboard_scsi_fixup(void)
58 {
59 //       struct device *dev;
60
61 /*       // Set the scsi device id's 
62        printk_debug("%2d:%2d:%2d\n",0,1,0);
63         dev = dev_find_slot(0, PCI_DEVFN(0x1, 0));
64        if (dev) {
65                 print_pci_regs(dev);
66         }
67         // Set the scsi device id's 
68        printk_debug("%2d:%2d:%2d\n",0,2,0);
69         dev = dev_find_slot(0, PCI_DEVFN(0x2, 0));
70         if (dev) {
71                 print_pci_regs(dev);
72         }
73
74         // Set the scsi device id's
75        printk_debug("%2d:%2d:%2d\n",0,3,0);
76         dev = dev_find_slot(0, PCI_DEVFN(0x3, 0));
77         if (dev) {
78                 print_pci_regs(dev);
79         }
80
81       // Set the scsi device id's
82        printk_debug("%2d:%2d:%2d\n",1,0x7,0);
83        dev = dev_find_slot(1, PCI_DEVFN(0x7, 0));
84        if (dev) {
85                 print_pci_regs(dev);
86         }
87         // Set the scsi device id's
88        printk_debug("%2d:%2d:%2d\n",1,0x8,0);
89         dev = dev_find_slot(1, PCI_DEVFN(0x8, 0));
90         if (dev) {
91                 print_pci_regs(dev);
92         }
93        printk_debug("%2d:%2d:%2d\n",2,3,0);
94        dev = dev_find_slot(2, PCI_DEVFN(0x3, 0));
95        if (dev) {
96                 print_pci_regs(dev);
97         }
98         // Set the scsi device id's
99        printk_debug("%2d:%2d:%2d\n",2,6,0);
100         dev = dev_find_slot(2, PCI_DEVFN(0x6, 0));
101         if (dev) {
102                 print_pci_regs(dev);
103         }
104         // Set the scsi device id's
105        printk_debug("%2d:%2d:%2d\n",3,4,0);
106         dev = dev_find_slot(3, PCI_DEVFN(0x4, 0));
107         if (dev) {
108                 print_pci_regs(dev);
109         }
110 */
111
112
113 /*
114         dev = dev_find_device(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_53C1030,0);
115         if(!dev) {
116                 printk_info("LSI_SCSI_FW_FIXUP: No Device Found!");
117                 return;
118         }
119
120         lsi_scsi_init(dev); 
121 */
122 }
123  
124
125 static void
126 enable(struct chip *chip, enum chip_pass pass)
127 {
128
129         struct mainboard_tyan_s2880_config *conf = 
130                 (struct mainboard_tyan_s2880_config *)chip->chip_info;
131
132         switch (pass) {
133                 default: break;
134                 case CONF_PASS_PRE_BOOT:
135                         if (conf->fixup_scsi)
136                                 onboard_scsi_fixup();
137                         printk_debug("mainboard fixup pass %d done\r\n",
138                                         pass);
139                         break;
140         }
141
142 }
143 void final_mainboard_fixup(void)
144 {
145 #if 0
146         enable_ide_devices();
147 #endif
148 }
149
150 struct chip_control mainboard_tyan_s2880_control = {
151                 .enable= enable,
152                 .name=   "Tyan s2880 mainboard "
153 };
154