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 "../../../northbridge/amd/amdk8/northbridge.h"
9 //#include <part/mainboard.h>
10 //#include "lsi_scsi.c"
11 unsigned long initial_apicid[CONFIG_MAX_CPUS] =
16 static void fixup_lsi_53c1030(struct device *pdev)
22 pci_write_config8(pdev, 0xff, byte);
24 // pci_write_config_word(pdev, PCI_DEVICE_ID, PCI_DEVICE_ID_LSILOGIC_53C1030);
25 // Set the subsytem vendor id
26 // pci_write_config16(pdev, PCI_SUBSYSTEM_VENDOR_ID, PCI_VENDOR_ID_TYAN);
28 pci_write_config16(pdev, PCI_SUBSYSTEM_VENDOR_ID, word);
29 // Set the subsytem id
31 pci_write_config16(pdev, PCI_SUBSYSTEM_ID, word);
32 // Disable writes to the device id
34 pci_write_config8(pdev, 0xff, byte);
36 // lsi_scsi_init(pdev);
40 //extern static void lsi_scsi_init(struct device *dev);
42 static void print_pci_regs(struct device *dev)
48 byte = pci_read_config8(dev, i);
50 if((i%16)==0) printk_debug("\n%02x:",i);
51 printk_debug(" %02x",byte);
55 // pci_write_config8(dev, 0x4, byte);
60 static void print_mem(void)
64 for(i=low_1MB;i<low_1MB+1024*4;i++) {
65 if((i%16)==0) printk_debug("\n %08x:",i);
66 printk_debug(" %02x ",(unsigned char)*((unsigned char *)i));
69 for(i=low_1MB;i<low_1MB+1024*4;i++) {
70 if((i%16)==0) printk_debug("\n %08x:",i);
71 printk_debug(" %c ",(unsigned char)*((unsigned char *)i));
76 static void amd8111_enable_rom(void)
81 /* Enable 4MB rom access at 0xFFC00000 - 0xFFFFFFFF */
82 /* Locate the amd8111 */
83 dev = dev_find_device(0x1022, 0x7468, 0);
85 /* Set the 4MB enable bit bit */
86 byte = pci_read_config8(dev, 0x43);
88 pci_write_config8(dev, 0x43, byte);
92 static void onboard_scsi_fixup(void)
99 for(j=0;j<=0x1f;j++) {
101 dev = dev_find_slot(i, PCI_DEVFN(j, k));
103 printk_debug("%02x:%02x:%02x",i,j,k);
113 dev = dev_find_device(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_53C1030,0);
115 printk_info("LSI_SCSI_FW_FIXUP: No Device Found!");
122 // amd8111_enable_rom();
126 static void vga_fixup(void) {
127 // we do this right here because:
128 // - all the hardware is working, and some VGA bioses seem to need
130 // - we need page 0 below for linuxbios tables.
131 #if CONFIG_REALMODE_IDT == 1
132 printk_debug("INSTALL REAL-MODE IDT\n");
133 setup_realmode_idt();
135 #if CONFIG_VGABIOS == 1
136 printk_debug("DO THE VGA BIOS\n");
145 enable(struct chip *chip, enum chip_pass pass)
148 struct mainboard_tyan_s4880_config *conf =
149 (struct mainboard_tyan_s4880_config *)chip->chip_info;
153 // case CONF_PASS_PRE_CONSOLE:
154 // case CONF_PASS_PRE_PCI:
155 // case CONF_PASS_POST_PCI:
156 case CONF_PASS_PRE_BOOT:
157 // if (conf->fixup_scsi)
158 // onboard_scsi_fixup();
159 // if (conf->fixup_vga)
161 printk_debug("mainboard fixup pass %d done\r\n",
167 static struct device_operations mainboard_operations = {
168 .read_resources = root_dev_read_resources,
169 .set_resources = root_dev_set_resources,
170 .enable_resources = enable_childrens_resources,
172 .scan_bus = amdk8_scan_root_bus,
176 static void enumerate(struct chip *chip)
179 dev_root.ops = &mainboard_operations;
180 chip->dev = &dev_root;
182 for(child = chip->children; child; child = child->next) {
183 child->bus = &dev_root.link[0];
186 struct chip_control mainboard_tyan_s4880_control = {
188 .enumerate = enumerate,
189 .name = "Tyan s4880 mainboard ",