Showing with 3,605 additions and 488 deletions.
  1. +12 −1 CHANGELOG.md
  2. +25 −20 Makefile
  3. +5 −0 docs/Contributing.md
  4. +29 −0 docs/Releases.md
  5. +1 −1 docs/Runtime_config.md
  6. +37 −0 docs/developer-certificate-of-origin
  7. +32 −0 scripts/ldnoexec.py
  8. +14 −0 src/Kconfig
  9. +17 −1 src/block.c
  10. +1 −0 src/block.h
  11. +383 −118 src/boot.c
  12. +1 −1 src/cdrom.c
  13. +2 −0 src/cp437.c
  14. +95 −0 src/fmap.c
  15. +51 −0 src/fmap.h
  16. +41 −14 src/fw/biostables.c
  17. +47 −0 src/fw/coreboot.c
  18. +45 −0 src/fw/coreboot.h
  19. +32 −5 src/fw/csm.c
  20. +673 −0 src/fw/dsdt_parser.c
  21. +110 −0 src/fw/lib_vpd.c
  22. +199 −0 src/fw/lib_vpd.h
  23. +160 −66 src/fw/paravirt.c
  24. +12 −0 src/fw/paravirt.h
  25. +10 −12 src/fw/pciinit.c
  26. +4 −0 src/fw/smbios.c
  27. +158 −0 src/fw/vpd.c
  28. +42 −0 src/fw/vpd.h
  29. +114 −0 src/fw/vpd_tables.h
  30. +2 −0 src/hw/ahci.c
  31. +8 −0 src/hw/ata.c
  32. +7 −3 src/hw/blockcmd.c
  33. +2 −0 src/hw/esp-scsi.c
  34. +2 −0 src/hw/lsi-scsi.c
  35. +1 −0 src/hw/megasas.c
  36. +2 −0 src/hw/mpt-scsi.c
  37. +15 −1 src/hw/nvme-int.h
  38. +114 −28 src/hw/nvme.c
  39. +57 −12 src/hw/pci.c
  40. +1 −0 src/hw/pci.h
  41. +4 −0 src/hw/ps2port.c
  42. +1 −0 src/hw/pvscsi.c
  43. +4 −0 src/hw/serialio.c
  44. +26 −2 src/hw/timer.c
  45. +2 −1 src/hw/tpm_drivers.c
  46. +34 −23 src/hw/usb-hid.c
  47. +60 −13 src/hw/usb-xhci.c
  48. +19 −8 src/hw/usb.c
  49. +1 −0 src/hw/usb.h
  50. +83 −1 src/hw/virtio-blk.c
  51. +1 −0 src/hw/virtio-blk.h
  52. +97 −0 src/hw/virtio-mmio.c
  53. +77 −0 src/hw/virtio-mmio.h
  54. +61 −17 src/hw/virtio-pci.c
  55. +1 −0 src/hw/virtio-pci.h
  56. +1 −1 src/hw/virtio-ring.h
  57. +79 −8 src/hw/virtio-scsi.c
  58. +1 −0 src/hw/virtio-scsi.h
  59. +32 −0 src/optionroms.c
  60. +27 −22 src/output.c
  61. +2 −0 src/post.c
  62. +44 −3 src/romfile.c
  63. +1 −1 src/sercon.c
  64. +11 −0 src/std/acpi.h
  65. +10 −1 src/std/tcg.h
  66. +57 −15 src/tcgbios.c
  67. +26 −0 src/util.h
  68. +169 −1 vgasrc/atiext.c
  69. +29 −9 vgasrc/bochsdisplay.c
  70. +16 −3 vgasrc/bochsvga.c
  71. +9 −71 vgasrc/cbvga.c
  72. +6 −0 vgasrc/ramfb.c
  73. +16 −0 vgasrc/svgamodes.c
  74. +30 −0 vgasrc/vbe.c
  75. +3 −4 vgasrc/vgabios.c
  76. +1 −1 vgasrc/vgahw.h
  77. +1 −0 vgasrc/vgautil.h
13 changes: 12 additions & 1 deletion CHANGELOG.md
Expand Up @@ -4,6 +4,16 @@ Change log for PC Engines fork of SeaBIOS
Fourth digit in release number means PC Engines patch.

## [Unreleased]
## [rel-1.14.0.1] - 2021-05-27
### Changed
- rebased on SeaBIOS official repository commit b0d61ec

### Added
- coreboot flashmap (FMAP) driver
- coreboot VPD driver for runtime configuration
- support for persistent bootorder in FMAP region
- TPM success status reporting after TPM Clear operation

## [rel-1.12.1.3] - 2019-07-05
### Fixed
- some corner cases for boot fallback functionality:
Expand Down Expand Up @@ -113,7 +123,8 @@ Fourth digit in release number means PC Engines patch.
### Fixed
- prevented from printing character multiple times

[Unreleased]: https://github.com/pcengines/seabios/compare/rel-1.12.1.3...apu_support
[Unreleased]: https://github.com/pcengines/seabios/compare/rel-1.14.0.1...apu_support
[rel-1.14.0.1]: https://github.com/pcengines/seabios/compare/rel-1.12.1.2...rel-1.14.0.1
[rel-1.12.1.3]: https://github.com/pcengines/seabios/compare/rel-1.12.1.2...rel-1.12.1.3
[rel-1.12.1.2]: https://github.com/pcengines/seabios/compare/rel-1.12.1.1...rel-1.12.1.2
[rel-1.12.1.1]: https://github.com/pcengines/seabios/compare/rel-1.12.0.1...rel-1.12.1.1
Expand Down
45 changes: 25 additions & 20 deletions Makefile
Expand Up @@ -28,23 +28,25 @@ IASL:=iasl
LD32BIT_FLAG:=-melf_i386

# Source files
SRCBOTH=misc.c stacks.c output.c string.c block.c cdrom.c disk.c mouse.c kbd.c \
system.c serial.c sercon.c clock.c resume.c pnpbios.c vgahooks.c pcibios.c \
apm.c cp437.c \
hw/pci.c hw/timer.c hw/rtc.c hw/dma.c hw/pic.c hw/ps2port.c hw/serialio.c \
hw/usb.c hw/usb-uhci.c hw/usb-ohci.c hw/usb-ehci.c \
hw/usb-hid.c hw/usb-msc.c hw/usb-uas.c \
hw/blockcmd.c hw/floppy.c hw/ata.c hw/ramdisk.c \
hw/lsi-scsi.c hw/esp-scsi.c hw/megasas.c hw/mpt-scsi.c
SRCBOTH=misc.c stacks.c output.c string.c block.c cdrom.c disk.c \
mouse.c kbd.c system.c serial.c sercon.c clock.c resume.c \
pnpbios.c vgahooks.c pcibios.c apm.c cp437.c hw/pci.c hw/timer.c \
hw/rtc.c hw/dma.c hw/pic.c hw/ps2port.c hw/serialio.c hw/usb.c \
hw/usb-uhci.c hw/usb-ohci.c hw/usb-ehci.c hw/usb-hid.c \
hw/usb-msc.c hw/usb-uas.c hw/blockcmd.c hw/floppy.c hw/ata.c \
hw/ramdisk.c hw/lsi-scsi.c hw/esp-scsi.c hw/megasas.c \
hw/mpt-scsi.c
SRC16=$(SRCBOTH)
SRC32FLAT=$(SRCBOTH) post.c e820map.c malloc.c romfile.c x86.c optionroms.c \
pmm.c font.c boot.c bootsplash.c jpeg.c bmp.c tcgbios.c sha1.c \
hw/pcidevice.c hw/ahci.c hw/pvscsi.c hw/usb-xhci.c hw/usb-hub.c hw/sdcard.c \
fw/coreboot.c fw/lzmadecode.c fw/multiboot.c fw/csm.c fw/biostables.c \
fw/paravirt.c fw/shadow.c fw/pciinit.c fw/smm.c fw/smp.c fw/mtrr.c fw/xen.c \
fw/acpi.c fw/mptable.c fw/pirtable.c fw/smbios.c fw/romfile_loader.c \
hw/virtio-ring.c hw/virtio-pci.c hw/virtio-blk.c hw/virtio-scsi.c \
hw/tpm_drivers.c hw/nvme.c
SRC32FLAT=$(SRCBOTH) post.c e820map.c malloc.c romfile.c x86.c \
optionroms.c pmm.c font.c fmap.c boot.c bootsplash.c jpeg.c bmp.c \
tcgbios.c sha1.c hw/pcidevice.c hw/ahci.c hw/pvscsi.c \
hw/usb-xhci.c hw/usb-hub.c hw/sdcard.c fw/coreboot.c \
fw/lzmadecode.c fw/multiboot.c fw/csm.c fw/biostables.c \
fw/paravirt.c fw/shadow.c fw/pciinit.c fw/smm.c fw/smp.c \
fw/mtrr.c fw/xen.c fw/acpi.c fw/mptable.c fw/pirtable.c \
fw/smbios.c fw/romfile_loader.c fw/dsdt_parser.c fw/vpd.c \
fw/lib_vpd.c hw/virtio-ring.c hw/virtio-pci.c hw/virtio-mmio.c \
hw/virtio-blk.c hw/virtio-scsi.c hw/tpm_drivers.c hw/nvme.c
SRC32SEG=string.c output.c pcibios.c apm.c stacks.c hw/pci.c hw/serialio.c
DIRS=src src/hw src/fw vgasrc

Expand All @@ -68,6 +70,8 @@ COMMONCFLAGS += $(call cc-option,$(CC),-fno-pie,)
COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
COMMONCFLAGS += $(call cc-option,$(CC),-fstack-check=no,)
COMMONCFLAGS += $(call cc-option,$(CC),-Wno-address-of-packed-member,)
COMMONCFLAGS += $(call cc-option,$(CC),-fcf-protection=none,)
COMMA := ,

CFLAGS32FLAT := $(COMMONCFLAGS) -DMODE16=0 -DMODESEGMENT=0
Expand Down Expand Up @@ -123,9 +127,10 @@ $(Q)printf '$(foreach i,$2,#include "$i"\n)' > $3.tmp.c
$(Q)$(CC) -I. $1 $(CFLAGSWHOLE) -c $3.tmp.c -o $3
endef

%.strip.o: %.o
%.noexec.o: %.o
@echo " Stripping $@"
$(Q)$(STRIP) $< -o $@
$(Q)$(STRIP) $< -o $<.strip.o
$(Q)$(PYTHON) ./scripts/ldnoexec.py $<.strip.o $@

$(OUT)%.s: %.c
@echo " Compiling to assembler $@"
Expand Down Expand Up @@ -181,9 +186,9 @@ $(OUT)rom32seg.o: $(OUT)code32seg.o $(OUT)romlayout32seg.lds
@echo " Linking $@"
$(Q)$(LD) -T $(OUT)romlayout32seg.lds $< -o $@

$(OUT)rom.o: $(OUT)rom16.strip.o $(OUT)rom32seg.strip.o $(OUT)code32flat.o $(OUT)romlayout32flat.lds
$(OUT)rom.o: $(OUT)rom16.noexec.o $(OUT)rom32seg.noexec.o $(OUT)code32flat.o $(OUT)romlayout32flat.lds
@echo " Linking $@"
$(Q)$(LD) -N -T $(OUT)romlayout32flat.lds $(OUT)rom16.strip.o $(OUT)rom32seg.strip.o $(OUT)code32flat.o -o $@
$(Q)$(LD) -N -T $(OUT)romlayout32flat.lds $(OUT)rom16.noexec.o $(OUT)rom32seg.noexec.o $(OUT)code32flat.o -o $@

$(OUT)bios.bin.prep: $(OUT)rom.o scripts/checkrom.py
@echo " Prepping $@"
Expand Down
5 changes: 5 additions & 0 deletions docs/Contributing.md
Expand Up @@ -18,3 +18,8 @@ submit patches. The SeaBIOS C code does follow a slightly different
coding style from QEMU (eg, mixed code and C99 style variable
declarations are encouraged, braces are not required around single
statement blocks), however patches in the QEMU style are acceptable.

As with QEMU, commits must contain a "Signed-off-by" line using your
real name (sorry, no pseudonyms or anonymous contributions) and a
current email address. It indicates agreement with the terms of the
[developer certificate of origin](developer-certificate-of-origin).
29 changes: 29 additions & 0 deletions docs/Releases.md
@@ -1,6 +1,30 @@
History of SeaBIOS releases. Please see [download](Download) for
information on obtaining these releases.

SeaBIOS 1.14.0
==============

Available on 20200810. Major changes in this release:

* New virtio MMIO support. Support for finding virtio MMIO devices via
an ACPI DSDT parser. Support for handling a large number of virtio
devices.
* Improved handling of USB keyboards with non-standard packet size.
* Improved KVM CPU frequency detection.
* Support for PCI mmconfig support on QEMU.
* Several bug fixes and code cleanups.

SeaBIOS 1.13.0
==============

Available on 20191209. Major changes in this release:

* Support for reading logical CHS drive information from QEMU
* Workaround added for misbehaving optionroms that grab "int19"
* The TPM 2 "PCR bank" option can now be set from the TPM menu
* SeaVGABIOS support for QEMU "atiext" display
* Several bug fixes and code cleanups

SeaBIOS 1.12.0
==============

Expand All @@ -12,6 +36,11 @@ Available on 20181117. Major changes in this release:
* SeaVGABIOS support for QEMU "bochs-display" and QEMU "ramfb" displays
* Several bug fixes and code cleanups

SeaBIOS 1.12.1
--------------

Available on 20190314. Stable release containing only bug fixes.

SeaBIOS 1.11.0
==============

Expand Down
2 changes: 1 addition & 1 deletion docs/Runtime_config.md
Expand Up @@ -173,7 +173,7 @@ There are several additional configuration options available in the

| Filename | Description
|---------------------|---------------------------------------------------
| show-boot-menu | Controls the display of the boot menu. Set to 0 to disable the boot menu.
| show-boot-menu | Controls the display of the boot menu. Valid values are 0: Disable the boot menu, 1: Display boot menu unconditionally, 2: Skip boot menu if only one device is present. The default is 1.
| boot-menu-message | Customize the text boot menu message. Normally, when in text mode SeaBIOS will report the string "\\nPress ESC for boot menu.\\n\\n". This field allows the string to be changed. (This is a string field, and is added as a file containing the raw string.)
| boot-menu-key | Controls which key activates the boot menu. The value stored is the DOS scan code (eg, 0x86 for F12, 0x01 for Esc). If this field is set, be sure to also customize the **boot-menu-message** field above.
| boot-menu-wait | Amount of time (in milliseconds) to wait at the boot menu prompt before selecting the default boot.
Expand Down
37 changes: 37 additions & 0 deletions docs/developer-certificate-of-origin
@@ -0,0 +1,37 @@
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
32 changes: 32 additions & 0 deletions scripts/ldnoexec.py
@@ -0,0 +1,32 @@
#!/usr/bin/env python
# Script to remove EXEC flag from an ELF file
#
# Copyright (C) 2020 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import optparse

FLAG_OFFSET = 16

def main():
# Parse command-line arguments
usage = "%prog <input_file> <output_file>"
opts = optparse.OptionParser(usage)
options, args = opts.parse_args()
if len(args) != 2:
opts.error("Incorrect number of arguments")
infilename, outfilename = args
# Read input
f = open(infilename, "rb")
srcdata = f.read()
f.close()
# Update
outdata = bytearray(srcdata)
outdata[FLAG_OFFSET] = 0x01 # change ET_EXEC to ET_REL
# Write output
f = open(outfilename, "wb")
f.write(outdata)
f.close()

if __name__ == '__main__':
main()
14 changes: 14 additions & 0 deletions src/Kconfig
Expand Up @@ -72,6 +72,13 @@ endchoice
help
Support controlling of the boot order via the fw_cfg/CBFS
"bootorder" file.
config HOST_BIOS_GEOMETRY
depends on BOOT
bool "Boot device bios geometry override"
default y
help
Support overriding bios (logical) geometry of boot devices via the
fw_cfg/CBFS "bios-geometry" file.

config COREBOOT_FLASH
depends on COREBOOT
Expand Down Expand Up @@ -517,6 +524,13 @@ menu "BIOS Tables"
This option can be disabled for QEMU 1.6 and older
to save some space in the ROM file.
If unsure, say Y.
config ACPI_PARSE
bool "Include ACPI DSDT parser."
default y
help
Support parsing ACPI DSDT for device probing.
Needed to find virtio-mmio devices.
If unsure, say Y.
endmenu

source vgasrc/Kconfig
Expand Down
18 changes: 17 additions & 1 deletion src/block.c
Expand Up @@ -69,9 +69,18 @@ int create_bounce_buf(void)
* Disk geometry translation
****************************************************************/

static int
host_lchs_supplied(struct drive_s *drive)
{
return (drive->lchs.head <= 255 &&
drive->lchs.sector > 0 && drive->lchs.sector <= 63);
}

static u8
get_translation(struct drive_s *drive)
{
if (host_lchs_supplied(drive))
return TRANSLATION_HOST;
u8 type = drive->type;
if (CONFIG_QEMU && type == DTYPE_ATA) {
// Emulators pass in the translation info via nvram.
Expand Down Expand Up @@ -159,6 +168,12 @@ setup_translation(struct drive_s *drive)
break;
}
break;
case TRANSLATION_HOST:
desc = "host-supplied";
cylinders = drive->lchs.cylinder;
heads = drive->lchs.head;
spt = drive->lchs.sector;
break;
}
// clip to 1024 cylinders in lchs
if (cylinders > 1024)
Expand Down Expand Up @@ -423,7 +438,8 @@ fill_ata_edd(struct segoff_s edd, struct drive_s *drive_gf)
u16 options = 0;
if (GET_GLOBALFLAT(drive_gf->type) == DTYPE_ATA) {
u8 translation = GET_GLOBALFLAT(drive_gf->translation);
if (translation != TRANSLATION_NONE) {
if ((translation != TRANSLATION_NONE) &&
(translation != TRANSLATION_HOST)) {
options |= 1<<3; // CHS translation
if (translation == TRANSLATION_LBA)
options |= 1<<9;
Expand Down
1 change: 1 addition & 0 deletions src/block.h
Expand Up @@ -90,6 +90,7 @@ struct drive_s {
#define TRANSLATION_LBA 1
#define TRANSLATION_LARGE 2
#define TRANSLATION_RECHS 3
#define TRANSLATION_HOST 4

#define EXTTYPE_FLOPPY 0
#define EXTTYPE_HD 1
Expand Down