Author: stepan
Date: 2007-09-05 03:41:52 +0200 (Wed, 05 Sep 2007)
New Revision: 487
Modified:
LinuxBIOSv3/device/pci_device.c
LinuxBIOSv3/util/x86emu/vm86.c
Log:
this patch changes vm86.c:do_bios to run_bios(dev, addr).
While doing this, we can remove lot of code duplication about searching
the device, which is already done in the parent pci_device.c.
Signed-off-by: Alex Beregszaszi <alex(a)rtfs.hu>
Acked-by: Stefan Reinauer <stepan(a)coresystems.de>
Modified: LinuxBIOSv3/device/pci_device.c
===================================================================
--- LinuxBIOSv3/device/pci_device.c 2007-08-30 10:25:43 UTC (rev 486)
+++ LinuxBIOSv3/device/pci_device.c 2007-09-05 01:41:52 UTC (rev 487)
@@ -649,9 +649,9 @@
void pci_dev_init(struct device *dev)
{
+ printk(BIOS_SPEW, "PCI: pci_dev_init\n");
#if defined(CONFIG_PCI_OPTION_ROM_RUN) && CONFIG_PCI_OPTION_ROM_RUN == 1
void run_bios(struct device *dev, unsigned long addr);
- void do_vgabios(void);
struct rom_header *rom, *ram;
printk(BIOS_INFO, "Probing for option ROM\n");
@@ -661,15 +661,8 @@
ram = pci_rom_load(dev, rom);
if (ram == NULL)
return;
-#if defined(CONFIG_PCI_OPTION_ROM_RUN_X86EMU) && \
- CONFIG_PCI_OPTION_ROM_RUN_X86EMU == 1
run_bios(dev, ram);
#endif
-#if defined(CONFIG_PCI_OPTION_ROM_RUN_VM86) && \
- CONFIG_PCI_OPTION_ROM_RUN_VM86 == 1
- do_vgabios();
-#endif
-#endif
}
/** Default device operation for PCI devices. */
Modified: LinuxBIOSv3/util/x86emu/vm86.c
===================================================================
--- LinuxBIOSv3/util/x86emu/vm86.c 2007-08-30 10:25:43 UTC (rev 486)
+++ LinuxBIOSv3/util/x86emu/vm86.c 2007-09-05 01:41:52 UTC (rev 487)
@@ -307,13 +307,8 @@
);
}
-void do_vgabios(void)
+void run_bios(struct device *dev, unsigned long addr)
{
- struct device *dev;
- unsigned int busdevfn;
- unsigned long rom = 0;
- unsigned char *buf;
- unsigned int size = 64*1024;
int i;
/* clear vga bios data area */
@@ -321,41 +316,7 @@
*(unsigned char *) i = 0;
}
- dev = dev_find_class(PCI_CLASS_DISPLAY_VGA<<8 , 0);
-
- if (!dev) {
- printk(BIOS_DEBUG, "NO VGA FOUND\n");
- return;
- }
- printk(BIOS_DEBUG,"found VGA: vid=%x, did=%x\n", dev->vendor, dev->device);
-
- /* declare rom address here - keep any config data out of the way
- * of core LXB stuff */
-#warning fix rom address
- rom = 0xc0000;
- pci_write_config32(dev, PCI_ROM_ADDRESS, rom|1);
- printk(BIOS_DEBUG, "rom base, size: %p\n", (void *)rom);
-
- buf = (unsigned char *) rom;
- if ((buf[0] == 0x55) && (buf[1] == 0xaa)) {
- memcpy((void *) 0xc0000, buf, size);
-
-#warning Implement write_protect_vgabios()
- //write_protect_vgabios(); // in northbridge
-
- // check signature again
- buf = (unsigned char *) 0xc0000;
- if (buf[0]==0x55 && buf[1]==0xAA) {
- busdevfn = (dev->bus->secondary << 8) | dev->path.u.pci.devfn;
- printk(BIOS_DEBUG, "bus/devfn = %#x\n", busdevfn);
-
- real_mode_switch_call_vga(busdevfn);
- } else
- printk(BIOS_DEBUG, "Failed to copy VGA BIOS to 0xc0000\n");
- } else
- printk(BIOS_DEBUG, "BAD SIGNATURE 0x%x 0x%x\n", buf[0], buf[1]);
-
- pci_write_config32(dev, PCI_ROM_ADDRESS, 0);
+ real_mode_switch_call_vga((dev->bus->secondary << 8) | dev->path.u.pci.devfn);
}