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_info("\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);
91 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();
123 static void vga_fixup(void) {
124 // we do this right here because:
125 // - all the hardware is working, and some VGA bioses seem to need
127 // - we need page 0 below for linuxbios tables.
128 #if CONFIG_REALMODE_IDT == 1
129 printk_debug("INSTALL REAL-MODE IDT\n");
130 setup_realmode_idt();
132 #if CONFIG_VGABIOS == 1
133 printk_debug("DO THE VGA BIOS\n");
142 enable(struct chip *chip, enum chip_pass pass)
145 struct mainboard_tyan_s2882_config *conf =
146 (struct mainboard_tyan_s2882_config *)chip->chip_info;
150 // case CONF_PASS_PRE_CONSOLE:
151 // case CONF_PASS_PRE_PCI:
152 case CONF_PASS_POST_PCI:
153 case CONF_PASS_PRE_BOOT:
154 // if (conf->fixup_scsi)
155 // onboard_scsi_fixup();
156 // if (conf->fixup_vga)
158 // printk_debug("mainboard fixup pass %d done\r\n",pass);
163 void final_mainboard_fixup(void)
166 enable_ide_devices();
169 static struct device_operations mainboard_operations = {
170 .read_resources = root_dev_read_resources,
171 .set_resources = root_dev_set_resources,
172 .enable_resources = enable_childrens_resources,
174 .scan_bus = amdk8_scan_root_bus,
178 static void enumerate(struct chip *chip)
181 dev_root.ops = &mainboard_operations;
182 chip->dev = &dev_root;
184 for(child = chip->children; child; child = child->next) {
185 child->bus = &dev_root.link[0];
188 struct chip_control mainboard_tyan_s2882_control = {
190 .enumerate = enumerate,
191 .name = "Tyan s2882 mainboard ",