Skip to content

Commit

Permalink
Add an option to only execute option ROMs contained in CBFS
Browse files Browse the repository at this point in the history
TEST: Booted ASUS KFSN4-DRE with iPXE ROMs built in to CBFS;
with etc/pci-optionrom-exec set to 0 the on-board network ROMs
were ignored while the iPXE ROMs executed normally.  When set
to 2 or greater all option ROMs executed normally.  Tests of
VGA only were not possible due to a lack of supported hardware.

Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
  • Loading branch information
madscientist159 authored and KevinOConnor committed Feb 24, 2015
1 parent 32ec3ee commit d23eba6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/Runtime_config.md
Expand Up @@ -181,6 +181,7 @@ There are several additional configuration options available in the
| extra-pci-roots | If the target machine has multiple independent root buses set this to a positive value. The SeaBIOS PCI probe will then search for the given number of extra root buses.
| ps2-keyboard-spinup | Some laptops that emulate PS2 keyboards don't respond to keyboard commands immediately after powering on. One may specify the amount of time (in milliseconds) here to allow as additional time for the keyboard to become responsive. When this field is set, SeaBIOS will repeatedly attempt to detect the keyboard until the keyboard is found or the specified timeout is reached.
| optionroms-checksum | Option ROMs are required to have correct checksums. However, some option ROMs in the wild don't correctly follow the specifications and have bad checksums. Set this to a zero value to allow SeaBIOS to execute them anyways.
| pci-optionrom-exec | Controls option ROM execution for roms found on PCI devices. Valid values are 0: Execute no ROMs, 1: Execute only VGA ROMs, 2: Execute all ROMs. The default is 2 (execute all ROMs).
| s3-resume-vga-init | Set this to a non-zero value to instruct SeaBIOS to run the vga rom on an S3 resume.
| screen-and-debug | Set this to a zero value to instruct SeaBIOS to not write characters it sends to the screen to the debug ports. This can be useful when using sgabios.
| advertise-serial-debug-port | If using a serial debug port, one can set this file to a zero value to prevent SeaBIOS from listing that serial port as available for operating system use. This can be useful when running old DOS programs that are known to reset the baud rate of all advertised serial ports.
Expand Down
8 changes: 4 additions & 4 deletions src/optionroms.c
Expand Up @@ -20,6 +20,8 @@
#include "string.h" // memset
#include "util.h" // get_pnp_offset

static int EnforceChecksum, S3ResumeVga, RunPCIroms;


/****************************************************************
* Helper functions
Expand Down Expand Up @@ -60,8 +62,6 @@ call_bcv(u16 seg, u16 ip)
__callrom(MAKE_FLATPTR(seg, 0), ip, 0);
}

static int EnforceChecksum;

// Verify that an option rom looks valid
static int
is_valid_rom(struct rom_header *rom)
Expand Down Expand Up @@ -329,7 +329,7 @@ init_pcirom(struct pci_device *pci, int isvga, u64 *sources)
, pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf), pci_bdf_to_fn(bdf)
, pci->vendor, pci->device);
struct rom_header *rom = lookup_hardcode(pci);
if (! rom)
if (!rom && ((RunPCIroms > 1) || ((RunPCIroms == 1) && isvga)))
rom = map_pcirom(pci);
if (! rom)
// No ROM present.
Expand Down Expand Up @@ -416,7 +416,6 @@ optionrom_setup(void)
* VGA init
****************************************************************/

static int S3ResumeVga;
int ScreenAndDebug;
struct rom_header *VgaROM;

Expand All @@ -432,6 +431,7 @@ vgarom_setup(void)
// Load some config settings that impact VGA.
EnforceChecksum = romfile_loadint("etc/optionroms-checksum", 1);
S3ResumeVga = romfile_loadint("etc/s3-resume-vga-init", CONFIG_QEMU);
RunPCIroms = romfile_loadint("etc/pci-optionrom-exec", 2);
ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1);

if (CONFIG_OPTIONROMS_DEPLOYED) {
Expand Down

0 comments on commit d23eba6

Please sign in to comment.