1 #include <console/console.h>
2 #include <device/device.h>
3 #include <device/pci.h>
4 #include <device/pci_ids.h>
5 #include <device/pci_ops.h>
6 #include "../../../northbridge/amd/amdk8/northbridge.h"
8 //#include <part/mainboard.h>
9 unsigned long initial_apicid[CONFIG_MAX_CPUS] =
14 static void fixup_lsi_53c1030(struct device *pdev)
20 pci_write_config8(pdev, 0xff, byte);
22 // pci_write_config_word(pdev, PCI_DEVICE_ID, PCI_DEVICE_ID_LSILOGIC_53C1030);
23 // Set the subsytem vendor id
24 // pci_write_config16(pdev, PCI_SUBSYSTEM_VENDOR_ID, PCI_VENDOR_ID_TYAN);
26 pci_write_config16(pdev, PCI_SUBSYSTEM_VENDOR_ID, word);
27 // Set the subsytem id
29 pci_write_config16(pdev, PCI_SUBSYSTEM_ID, word);
30 // Disable writes to the device id
32 pci_write_config8(pdev, 0xff, byte);
34 // lsi_scsi_init(pdev);
38 //extern static void lsi_scsi_init(struct device *dev);
40 static void print_pci_regs(struct device *dev)
46 byte = pci_read_config8(dev, i);
48 if((i%16)==0) printk_debug("\n%02x:",i);
49 printk_debug(" %02x",byte);
53 // pci_write_config8(dev, 0x4, byte);
58 static void print_mem(void)
62 for(i=low_1MB;i<low_1MB+1024*4;i++) {
63 if((i%16)==0) printk_debug("\n %08x:",i);
64 printk_debug(" %02x ",(unsigned char)*((unsigned char *)i));
67 for(i=low_1MB;i<low_1MB+1024*4;i++) {
68 if((i%16)==0) printk_debug("\n %08x:",i);
69 printk_debug(" %c ",(unsigned char)*((unsigned char *)i));
74 static void amd8111_enable_rom(void)
79 /* Enable 4MB rom access at 0xFFC00000 - 0xFFFFFFFF */
80 /* Locate the amd8111 */
81 dev = dev_find_device(0x1022, 0x7468, 0);
83 /* Set the 4MB enable bit bit */
84 byte = pci_read_config8(dev, 0x43);
86 pci_write_config8(dev, 0x43, byte);
90 static void onboard_scsi_fixup(void)
97 for(j=0;j<=0x1f;j++) {
99 dev = dev_find_slot(i, PCI_DEVFN(j, k));
101 printk_debug("%02x:%02x:%02x",i,j,k);
111 dev = dev_find_device(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_53C1030,0);
113 printk_info("LSI_SCSI_FW_FIXUP: No Device Found!");
120 // amd8111_enable_rom();
124 static void vga_fixup(void) {
125 // we do this right here because:
126 // - all the hardware is working, and some VGA bioses seem to need
128 // - we need page 0 below for linuxbios tables.
129 #if CONFIG_REALMODE_IDT == 1
130 printk_debug("INSTALL REAL-MODE IDT\n");
131 setup_realmode_idt();
133 #if CONFIG_VGABIOS == 1
134 printk_debug("DO THE VGA BIOS\n");
145 enable(struct chip *chip, enum chip_pass pass)
148 struct mainboard_tyan_s2875_config *conf =
149 (struct mainboard_tyan_s2875_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 void final_mainboard_fixup(void)
170 enable_ide_devices();
173 static struct device_operations mainboard_operations = {
174 .read_resources = root_dev_read_resources,
175 .set_resources = root_dev_set_resources,
176 .enable_resources = enable_childrens_resources,
178 .scan_bus = amdk8_scan_root_bus,
182 static void enumerate(struct chip *chip)
185 dev_root.ops = &mainboard_operations;
186 chip->dev = &dev_root;
188 for(child = chip->children; child; child = child->next) {
189 child->bus = &dev_root.link[0];
192 struct chip_control mainboard_tyan_s2875_control = {
194 .enumerate = enumerate,
195 .name = "Tyan s2875 mainboard ",