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@rtfs.hu>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@487 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Stefan Reinauer 2007-09-05 01:41:52 +00:00
commit dde116bd69
2 changed files with 3 additions and 49 deletions

View file

@ -649,9 +649,9 @@ void pci_dev_set_subsystem(struct device *dev, unsigned int vendor,
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 @@ void pci_dev_init(struct device *dev)
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. */

View file

@ -307,13 +307,8 @@ void vga_enable_console(void)
);
}
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 @@ void do_vgabios(void)
*(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);
}