X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Foptionroms.c;h=27cfffd82a79e0e8e72b29f58949d4f8ed67c0a9;hb=1e15725c92858a0cb1dd5c76bd44af1fec09fee3;hp=6c4c9ff94ddcd8223f3b9907be74e9299943b94e;hpb=8b0c509e7cdb55b0ebd58cc105e49e75526ba620;p=seabios.git diff --git a/src/optionroms.c b/src/optionroms.c index 6c4c9ff..27cfffd 100644 --- a/src/optionroms.c +++ b/src/optionroms.c @@ -14,63 +14,12 @@ #include "pci_ids.h" // PCI_CLASS_DISPLAY_VGA #include "boot.h" // IPL #include "paravirt.h" // qemu_cfg_* - +#include "optionroms.h" // struct rom_header /**************************************************************** * Definitions ****************************************************************/ -struct rom_header { - u16 signature; - u8 size; - u8 initVector[4]; - u8 reserved[17]; - u16 pcioffset; - u16 pnpoffset; -} PACKED; - -struct pci_data { - u32 signature; - u16 vendor; - u16 device; - u16 vitaldata; - u16 dlen; - u8 drevision; - u8 class_lo; - u16 class_hi; - u16 ilen; - u16 irevision; - u8 type; - u8 indicator; - u16 reserved; -} PACKED; - -struct pnp_data { - u32 signature; - u8 revision; - u8 len; - u16 nextoffset; - u8 reserved_08; - u8 checksum; - u32 devid; - u16 manufacturer; - u16 productname; - u8 type_lo; - u16 type_hi; - u8 dev_flags; - u16 bcv; - u16 dv; - u16 bev; - u16 reserved_1c; - u16 staticresource; -} PACKED; - -#define OPTION_ROM_SIGNATURE 0xaa55 -#define OPTION_ROM_ALIGN 2048 -#define OPTION_ROM_INITVECTOR offsetof(struct rom_header, initVector[0]) -#define PCI_ROM_SIGNATURE 0x52494350 // PCIR -#define PCIROM_CODETYPE_X86 0 - // The end of the last deployed rom. u32 RomEnd = BUILD_ROM_START; @@ -230,7 +179,7 @@ getRomPriority(u64 *sources, struct rom_header *rom, int instance) if (!source) return -1; if (source & RS_PCIROM) - return bootprio_find_pci_rom(source, instance); + return bootprio_find_pci_rom((void*)(u32)source, instance); return bootprio_find_named_rom(romfile_name(source), instance); } @@ -379,7 +328,7 @@ init_pcirom(struct pci_device *pci, int isvga, u64 *sources) if (! rom) // No ROM present. return -1; - setRomSource(sources, rom, RS_PCIROM | bdf); + setRomSource(sources, rom, RS_PCIROM | (u32)pci); return init_optionrom(rom, bdf, isvga); } @@ -439,19 +388,18 @@ optionrom_setup(void) , getRomPriority(sources, rom, 0)); continue; } - // PnP rom. - if (pnp->bev) { - // Can boot system - add to IPL list. - boot_add_bev(FLATPTR_TO_SEG(rom), pnp->bev, pnp->productname - , getRomPriority(sources, rom, 0)); - } else { - // Check for BCV (there may be multiple). - int instance = 0; - while (pnp && pnp->bcv) { + // PnP rom - check for BEV and BCV boot capabilities. + int instance = 0; + while (pnp) { + if (pnp->bev) + boot_add_bev(FLATPTR_TO_SEG(rom), pnp->bev, pnp->productname + , getRomPriority(sources, rom, instance++)); + else if (pnp->bcv) boot_add_bcv(FLATPTR_TO_SEG(rom), pnp->bcv, pnp->productname , getRomPriority(sources, rom, instance++)); - pnp = get_pnp_next(rom, pnp); - } + else + break; + pnp = get_pnp_next(rom, pnp); } } } @@ -462,6 +410,7 @@ optionrom_setup(void) ****************************************************************/ static int S3ResumeVgaInit; +int ScreenAndDebug; // Call into vga code to turn on console. void @@ -472,15 +421,17 @@ vga_setup(void) dprintf(1, "Scan for VGA option rom\n"); + // Load some config settings that impact VGA. EnforceChecksum = romfile_loadint("etc/optionroms-checksum", 1); S3ResumeVgaInit = romfile_loadint("etc/s3-resume-vga-init", 0); + ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1); if (CONFIG_OPTIONROMS_DEPLOYED) { // Option roms are already deployed on the system. init_optionrom((void*)BUILD_ROM_START, 0, 1); } else { // Clear option rom memory - memset((void*)RomEnd, 0, _max_rom() - RomEnd); + memset((void*)RomEnd, 0, max_rom() - RomEnd); // Find and deploy PCI VGA rom. struct pci_device *pci;