aboutsummaryrefslogtreecommitdiffstats
path: root/src/optionroms.c
Commit message (Collapse)AuthorAgeFilesLines
* optionrom: disallow int19 redirect for pnp roms.Gerd Hoffmann2019-05-221-0/+24
| | | | | | | | | | | | | | | Check whenever pnp roms attempt to redirect int19, and in case it does log a message and undo the redirect. A pnp rom should not need this, we have BEVs and BCVs for that. Nevertheless there are roms in the wild which are redirecting int19. At least some BIOS implementations for physical hardware have a config option in the setup to allow/disallow int19 redirections, so just not allowing this seems to be the way to deal with this situation. Buglink: https://bugzilla.redhat.com//show_bug.cgi?id=1642135 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Tested-by: Matt DeVillier <matt.devillier@gmail.com>
* optionrom: enable non-vga display devicesGerd Hoffmann2018-06-221-1/+28
| | | | | | In case no VGA device was found look for other display devices. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* add serial console supportGerd Hoffmann2017-09-221-6/+3
| | | | | | | | | Redirect int10 calls to serial console output. Parse serial input and queue key events. The serial console can work both as primary display and in parallel to another vga display (splitmode). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* optionroms: Drop support for CONFIG_OPTIONROMS_DEPLOYEDKevin O'Connor2016-04-061-39/+22
| | | | | | No modern software uses this option and it complicates the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pci: Split low-level pci code from higher-level 'struct pci_device' codeKevin O'Connor2016-02-031-1/+2
| | | | | | | | | Split pci.c into pci.c and pcidevice.c. The low-level code that interacts directly with the PCI devices remains in pci.c, while functions dealing with the higher level pci_device cache move to pcidevice.c. Only pci.c is needed in 16bit mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pci: Implement '%pP' printf handler for 'struct pci_device' pointersKevin O'Connor2016-02-031-12/+7
| | | | | | | Handle '%pP' format descriptions as a pointer to a 'struct pci_device' and display it in bus:device.function (%02x:%02x.%x) format. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* optionroms: Don't run option rom on PCI bar if CBFS/fw_cfg version existsKevin O'Connor2015-08-121-18/+12
| | | | | | | | | If there exists a "pci%04x,%04x.rom" file in CBFS/fw_cfg then the code should not attempt to run a rom found on the PCI device itself - even if the one in CBFS/fw_cfg is not a valid rom. This makes the code match the documentation. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tpm: Move call to tpm_option_rom into init_optionromStefan Berger2015-06-111-1/+2
| | | | | | | Move the call to measure the option ROM 'tpm_option_rom' into init_optionrom. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* Add 'measurement' code to the BIOSStefan Berger2015-06-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds invocations of functions that measure various parts of the code and data through various parts of the BIOS code. It follows TCG specifications on what needs to be measured. It also adds the implementation of the called functions. Reference for what needs to be measured can be found in specs found here: http://www.trustedcomputinggroup.org/resources/pc_client_work_group_specific_implementation_specification_for_conventional_bios The first measurements are done once the ACPI tables have been initialized. Once booted into Linux, the current measurements produce the following logs which can be found in /sys/kernel/security/tpm0/ascii_bios_measurements. The below log also shows measurements from trusted grub. 1 3fb240d2a04085a4e84f81e4398e070ed5a18163 06 [SMBIOS] 2 cc812353fc277c1fab99e0b721752a1392984566 06 [Option ROM] 2 9dbd87163112e5670378abe4510491259a61f411 05 [Start Option ROM Scan] 2 6f74e357331b8dee11bbad85f27bc66cb873106c 06 [Option ROM] 2 5626eb7ac05c7231e46d7461e7d3839b03ae9fad 06 [Option ROM] 4 c1e25c3f6b0dc78d57296aa2870ca6f782ccf80f 05 [Calling INT 19h] 0 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 1 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 2 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 3 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 4 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 5 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 6 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 7 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 4 8cf2fe6c87d4d0b2998a43da630292e6d85ee8b6 05 [Booting BCV device 80h (HDD)] 4 5dff94459a3e2d13a433ef94afdc306144565bf7 0d [IPL] 5 d1b33afde65ad47502332af957c60f20c84c1edc 0e [IPL Partition Data] 4 487ce764b527ccad17f1d04243d0136fa981e6c4 0d [IPL] 4 91d285e4dead566324c8938a3cc75803f462d9a1 0d [IPL] 4 8ba79ac98bb491524fef29defc724daaf6263d35 0d [IPL] 4 c591c15b82e4ff30e7383a4ff1ef3b41b38521ac 06 [] 4 8cdc27ec545eda33fbba1e8b8dae4da5c7206972 04 [Grub Event Separator] 5 8cdc27ec545eda33fbba1e8b8dae4da5c7206972 04 [Grub Event Separator] 5 e8673b9e14b02dc12d8ccfd0176bca7a3de7fc3c 0e [IPL Partition Data] 5 0163e375a0af7525c5dac1a8e74b277359e40d1d 1105 [] 8 4be30f67c3d48ab7f04d9c0fd07f06d4c68379be 1205 [] 8 54c83965978de9708d026016ecb0e70660e04388 1305 [] 5 2431ed60130faeaf3a045f21963f71cacd46a029 04 [OS Event Separator] 8 2431ed60130faeaf3a045f21963f71cacd46a029 04 [OS Event Separator] 8 f3973cae05d6e2055062119d6e6e1e077b7df876 1005 [] Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* Add an option to only execute option ROMs contained in CBFStpearson@raptorengineeringinc.com2015-02-241-4/+4
| | | | | | | | | | | 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>
* debug: Only call serial_debug_preinit() at startup.Kevin O'Connor2014-01-221-2/+0
| | | | | | | | | The serial_debug_preinit() function disables serial interrupts so that the OS doesn't get confused by "transmit buffer empty" interrupts caused when seabios writes to the serial port. It's unnecessary paranoia to keep rechecking that interrupts are disabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move low-level hardware writing from output.c to new file hw/serialio.c.Kevin O'Connor2013-12-041-1/+1
| | | | | | | | | | Avoid hardware specific code in output.c. This will reduce the amount of change needed to output.c as support for more serial hardware is added. This patch also renames some functions to improve the naming scheme. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Merge bmp.h, boot.h, jpeg.h, and post.h into util.h.Kevin O'Connor2013-09-181-1/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move pnpbios definition to new file std/pnpbios.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move optionroms.h to std/optionrom.h and util.h.Kevin O'Connor2013-09-181-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move function definitions for output.c from util.h to new file output.h.Kevin O'Connor2013-09-181-4/+5
| | | | | | Also, sort the order of include files in the c files. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move malloc code from pmm.c to new files malloc.c and malloc.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move romfile definitions from util.h to new file romfile.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move stacks.c definitions from util.h to new file stacks.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Rename util.c to string.c and introduce string.h.Kevin O'Connor2013-09-181-0/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move code centered around specific hardware devices to src/hw/Kevin O'Connor2013-09-021-3/+3
| | | | | | Move many C files from the src/ directory to the new src/hw/ directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pciinit: Enable default VGA deviceAlex Williamson2013-03-221-1/+1
| | | | | | | | | As QEMU gains PCI bridge and PCIe root port support, we won't always find the VGA device on the root bus. We therefore need to add support to find and enable a VGA device and the path to it through the VGA Enable support in the PCI bridge control register. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
* Rename rom_get_top() to rom_get_max().Kevin O'Connor2013-02-171-2/+2
| | | | | | | Rename rom_get_top and try to make the difference between it and rom_get_last more clear. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Warn on unaligned PCI ROM structure in option roms.Kevin O'Connor2013-02-151-0/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Consistently use CONFIG_COREBOOT, CONFIG_QEMU, and runningOnXen().Kevin O'Connor2013-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | | CONFIG_QEMU means compile to start from QEMU (and possibly Xen/KVM/Bochs) and definitely running under QEMU (or Xen/KVM/Bochs). CONFIG_COREBOOT means compile for coreboot and definitely running under coreboot. Places that used CONFIG_COREBOOT to mean "running on real hardware" have been changed to use !CONFIG_QEMU. CONFIG_QEMU_HARDWARE enables support for some virtual hardware devices even if QEMU didn't start SeaBIOS. usingXen() is replaced by runningOnXen(). runningOnQEMU() is added to hardware devices that are only safe to access when we are sure we are running under QEMU (or Xen/KVM/Bochs). Neither the coreboot nor the csm code currently enable runningOnQEMU, but future patches may. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Export callrom() for CSM to useDavid Woodhouse2013-02-071-1/+1
| | | | Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* Normalize POST initialization function name suffixes.Kevin O'Connor2013-02-051-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The POST phase has to invoke many initialization functions, and these functions can have complex inter-dependencies. Try to categorize the functions into 4 classes: preinit - functions called very early in POST where function ordering is very important and the code has limited access to other interfaces. init - functions that initialize internal interfaces and standard external interfaces. This code is generally not dependent on particular hardware and typically does not communicate directly with any hardware devices. setup - functions which access hardware or are dependent on particular hardware or platform devices. prepboot - functions that finalize internal interfaces and that prepare for the boot phase. This patch attempts to normalize the suffixes - functions that used _init(), _setup(), _finalize(), or similar that did not follow the above pattern were renamed. Other than function name changes, there should be no code impact to this patch. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Cache romfile entries.Kevin O'Connor2012-06-021-8/+8
| | | | | | | | | | | Create a 'struct romfile_s' and populate a list of all romfiles at start of init. Caching the romfiles both simplifies the code and makes it more efficient. Also, convert the ramdisk code to use romfile helpers instead of directly accessing cbfs. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Rename call16 to farcall16.Kevin O'Connor2012-05-281-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Allow optionroms and "low mem" to share space.Kevin O'Connor2012-05-211-51/+60
| | | | | | | | | | Allow both optionroms and "low mem" allocations to use the e-segment. (Space is allocated on a "first come, first serve" basis). This allows more flexibility in resource assignment. Also, allow the "low mem" area to use a full 64K. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Use the e-segment instead of the 9-segment for bios "low mem".Kevin O'Connor2012-05-131-11/+3
| | | | | | | | | Use the e-segment for ZoneLow allocations. There is plenty of e-segment space (there has been since SeaBIOS supported code relocation), while using the 9-segment space can impact old real-mode applications. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Running vgabios during resume from S3 on QEMU by defaultGleb Natapov2012-02-181-1/+1
| | | | | | | | | | | Run vgabios during resume from S3 by default on QEMU. QEMU still able to modify SeaBIOS behavior if it wishes so by providing etc/s3-resume-vga-init file. With QEMU emulated vga cards this behaviour is desirable otherwise console becomes unusable with Linux guests after resume. Since we control vgabios source we can be sure that running it on resume from S3 is safe. Signed-off-by: Gleb Natapov <gleb@redhat.com>
* Permit multiple BEV and BEV/BCV combinations in a single option rom.Kevin O'Connor2012-01-141-11/+10
| | | | | | | | | The BBS spec is unclear on multiple BEV entry points for a rom. However, the LSI scsi rom has been seen to register a BEV followed by multiple BCV entry points. Add support for it, as there's no harm in it. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Move optionroms definitions into a separate headerJulian Pidancet2011-12-201-52/+1
| | | | | | Create optionroms.h so the VGA rom can reuse the definitions. Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
* Allow free space in f-segment to be used by malloc_fseg().Kevin O'Connor2011-08-031-1/+1
|
* Push use of 'struct pci_device' to bootprio_find_pci_rom().Kevin O'Connor2011-07-101-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Replace CONFIG_SCREEN_AND_DEBUG with "etc/screen-and-debug" file.Kevin O'Connor2011-07-051-0/+3
|
* Replace CONFIG_S3_RESUME_VGA_INIT with "etc/s3-resume-vga-init" file.Kevin O'Connor2011-07-051-1/+4
|
* Replace "CONFIG_OPTIONROMS_CHECKSUM" with "etc/optionroms-checksum" file.Kevin O'Connor2011-07-051-1/+5
|
* Calculate vgahook responses during setup instead of in 16bit code.Kevin O'Connor2011-07-021-1/+2
| | | | | | Do vga type and parameter detection during setup and store the necessary info in global variables for the 16bit code. This simplifies the "vgahook" 16bit code.
* Use 'struct pci_device' to note which devices have native drivers.Kevin O'Connor2011-06-211-3/+1
| | | | | | | | Remove the check in optionroms.c for CONFIG_ATA and PCI_CLASS_STORAGE_IDE with a flag in 'struct pci_device'. This ensures devices using the ATA driver that aren't in PCI_CLASS_STORAGE_IDE don't have their optionroms executed. It also allows other drivers to disable option rom execution in the future.
* Convert option rom scan to use struct pci_device.Kevin O'Connor2011-06-201-31/+55
|
* Remove support for compiling in OPTIONROM_VENDEV_1/2.Kevin O'Connor2011-06-201-8/+0
| | | | | | Passing in rom locations via absolute memory addresses hasn't been needed since coreboot adopted CBFS support (which as several years ago).
* Rename foreachpci macro to foreachbdf.Kevin O'Connor2011-06-191-2/+2
|
* Add config option to permit running option roms with bad checksums.Kevin O'Connor2011-03-061-1/+2
| | | | Based on a patch by: Stefan Reinauer <reinauer@google.com>
* Add stubs to permit devices to specify their boot priority.Kevin O'Connor2010-12-271-5/+20
| | | | | | Add support for passing in priorities to bootlist system. Based on patch by: Gleb Natapov <gleb@redhat.com>
* Simplify boot ordering by building an inclusive boot list.Kevin O'Connor2010-12-271-3/+3
| | | | | | | | | | | | | | | | | Replace the bcv list with a full list of all "bootable objects". All ordering can then be done on this list. The final boot menu, drive mapping, and BEV list generation is then driven from this authoritative list. Move "Floppy" and "DVD/CD" description prefixes into drive description generation code to simplify boot menu generation. Rework QEMU's CMOS defined bootorder to work with priority scheme in new boot list. Have every CBFS entry create it's own BEV entry (instead of one entry for all CBFS payloads). Move CBFS payload detection code into coreboot.c.
* Track the source of each optionrom deployed.Kevin O'Connor2010-12-241-10/+24
| | | | | | It's useful to track where each optionrom in the system originated from when initializing bev/bcvs. So, keep a map of the rom address to its source.
* Cleanup - it's no longer necessary to manually reset global variables.Kevin O'Connor2010-09-251-4/+1
| | | | | Now that a soft-reboot forces a hard-reboot, it is no longer necessary to manually reset global variables.
* Fix typo preventing relocated space from being used for option roms.Kevin O'Connor2010-09-251-1/+1
|