2 months agousb: fix wrong init of keyboard/mouse's if first interface is not boot protocol master
Qi Zhou [Mon, 14 Nov 2022 12:55:44 +0000 (20:55 +0800)] 
usb: fix wrong init of keyboard/mouse's if first interface is not boot protocol

There is always some endpoint descriptors after each interface descriptor, We
should only decrement num_iface if interface type is USB_DT_INTERFACE, see

Signed-off-by: Qi Zhou <>
2 months agovirtio: finalize features before using device rel-1.16.1
Xuan Zhuo [Mon, 14 Nov 2022 03:58:18 +0000 (11:58 +0800)] 
virtio: finalize features before using device

Under the standard of Virtio 1.0, the initialization process of the
device must first write sub-features back to device before
using device, such as finding vqs.

There are four places using vp_find_vq().

1. virtio-blk.pci:    put the code of finalizing features in front of using device
2. virtio-blk.mmio:   put the code of finalizing features in front of using device
3. virtio-scsi.pci:   is ok
4. virtio-scsi.mmio:  add the code of finalizing features before vp_find_vq()

Signed-off-by: Xuan Zhuo <>
Acked-by: Michael S. Tsirkin <>
Message-Id: <>
Signed-off-by: Gerd Hoffmann <>
2 months agovirtio-mmio: read/write the hi 32 features for mmio
Xuan Zhuo [Mon, 14 Nov 2022 03:58:17 +0000 (11:58 +0800)] 
virtio-mmio: read/write the hi 32 features for mmio

Under mmio, when we read the feature from the device, we should read the
high 32-bit part. Similarly, when writing the feature back, we should
also write back the high 32-bit feature.

Signed-off-by: Xuan Zhuo <>
Acked-by: Michael S. Tsirkin <>
Message-Id: <>
Signed-off-by: Gerd Hoffmann <>
2 months agoacpi: parse Alias object
Igor Mammedov [Fri, 18 Nov 2022 14:27:55 +0000 (15:27 +0100)] 
acpi: parse Alias object

Since QEMU commit
  47a373faa6 (acpi: pc/q35: drop ad-hoc PCI-ISA bridge AML routines and let bus ennumeration generate AML)
SeaBIOS fails to parse ISA bridge AML with:

   parse_termlist: parse error, skip from 92/517
   ACPI: no PS/2 keyboard present

due to Alias term in DSDT which isn't handled by SeaBIOS properly.
Add dumb Alias parsing which just skips over term,
so the rest of AML could be parsed successfully.

Signed-off-by: Igor Mammedov <>
Reported-by: Volker Rümelin <>
Message-Id: <>
Signed-off-by: Gerd Hoffmann <>
2 months agovirtio-blk: Fix incorrect type conversion in virtio_blk_op()
Xiaofei Lee [Mon, 21 Nov 2022 14:54:10 +0000 (22:54 +0800)] 
virtio-blk: Fix incorrect type conversion in virtio_blk_op()

When using spdk aio bdev driver, the qemu command line like this:

qemu-system-x86_64 \
    -chardev socket,id=char0,path=/tmp/vhost.0 \
    -device vhost-user-blk-pci,id=blk0,chardev=char0 \

Boot failure message as below:

e820 map has 7 items:
  0: 0000000000000000 - 000000000009fc00 = 1 RAM
  1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED
  2: 00000000000f0000 - 0000000000100000 = 2 RESERVED
  3: 0000000000100000 - 000000007ffdd000 = 1 RAM
  4: 000000007ffdd000 - 0000000080000000 = 2 RESERVED
  5: 00000000feffc000 - 00000000ff000000 = 2 RESERVED
  6: 00000000fffc0000 - 0000000100000000 = 2 RESERVED
enter handle_19:
Booting from Hard Disk...
Boot failed: could not read the boot disk

Fixes: a05af290bac5 ("virtio-blk: split large IO according to size_max")

Acked-by: Andy Pei <>
Acked-by: Gerd Hoffmann <>
Acked-by: Michael S. Tsirkin <>
Acked-by: Paul Menzel <>
Signed-off-by: Xiaofei Lee <>
6 months agovirtio-blk: use larger default request size
Gerd Hoffmann [Thu, 30 Jun 2022 15:28:40 +0000 (17:28 +0200)] 
virtio-blk: use larger default request size

Bump default from 8 to 64 blocks.  Using 8 by default leads
to requests being splitted on qemu, which slows down boot.

Some (temporary) debug logging added showed that almost all
requests on a standard fedora install are less than 64 blocks,
so that should bring us back to 1.15 performance levels.

Signed-off-by: Gerd Hoffmann <>
9 months agomalloc: use large ZoneHigh when there is enough memory
Gerd Hoffmann [Mon, 25 Apr 2022 07:25:31 +0000 (09:25 +0200)] 
malloc: use large ZoneHigh when there is enough memory

In case there is enough memory installed use a large ZoneHigh.

Signed-off-by: Gerd Hoffmann <>
9 months agomalloc: use variable for ZoneHigh size
Gerd Hoffmann [Mon, 25 Apr 2022 07:20:02 +0000 (09:20 +0200)] 
malloc: use variable for ZoneHigh size

Use the variable highram_size instead of the BUILD_MAX_HIGHTABLE #define
for the ZoneHigh size. Initialize the new variable with the old #define,
so behavior does not change.

This allows to easily adjust the ZoneHigh size at runtime in a followup

Signed-off-by: Gerd Hoffmann <>
9 months agoreset: force standard PCI configuration access
Volker Rümelin [Sat, 2 Apr 2022 18:28:39 +0000 (20:28 +0200)] 
reset: force standard PCI configuration access

After a reset of a QEMU -machine q35 guest, the PCI Express
Enhanced Configuration Mechanism is disabled and the variable
mmconfig no longer matches the configuration register PCIEXBAR
of the Q35 chipset. Until the variable mmconfig is reset to 0,
all pci_config_*() functions no longer work.

The variable mmconfig is located in one of the read-only C-F
segments. To reset it the pci_config_*() functions are needed,
but they do not work.

Replace all pci_config_*() calls with Standard PCI Configuration
Mechanism pci_ioconfig_*() calls until mmconfig is overwritten
with 0 by a fresh copy of the BIOS.

This fixes

In resume (status=0)
In 32bit resume
Attempting a hard reboot
Unable to unlock ram - bridge not found

and a reset loop with QEMU -accel tcg.

Signed-off-by: Volker Rümelin <>
9 months agopci: refactor the pci_config_*() functions
Volker Rümelin [Sat, 2 Apr 2022 18:28:38 +0000 (20:28 +0200)] 
pci: refactor the pci_config_*() functions

Split out the Standard PCI Configuration Access Mechanism
pci_ioconfig_*() functions from the pci_config_*() functions.
The standard PCI CAM functions will be used in the next patch.

Reviewed-by: Gerd Hoffmann <>
Signed-off-by: Volker Rümelin <>
11 months agodocs: Note v1.16.0 release rel-1.16.0
Kevin O'Connor [Wed, 2 Mar 2022 01:29:02 +0000 (20:29 -0500)] 
docs: Note v1.16.0 release

Signed-off-by: Kevin O'Connor <>
11 months agonvme: fix LBA format data structure
Florian Larysch [Sun, 23 Jan 2022 16:43:57 +0000 (17:43 +0100)] 
nvme: fix LBA format data structure

The LBA Format Data structure is dword-sized, but struct nvme_lba_format
erroneously contains an additional member, misaligning all LBAF
descriptors after the first and causing them to be misinterpreted.
Remove it.

Signed-off-by: Florian Larysch <>
Reviewed-by: Alexander Graf <>
12 months agonvme: avoid use-after-free in nvme_controller_enable()
Jan Beulich via SeaBIOS [Mon, 24 Jan 2022 09:20:53 +0000 (10:20 +0100)] 
nvme: avoid use-after-free in nvme_controller_enable()

Commit b68f313c9139 ("nvme: Record maximum allowed request size")
introduced a use of "identify" past it being passed to free(). Latch the
value of interest into a local variable.

Reported-by: Coverity (ID 1497613)
Signed-off-by: Jan Beulich <>
12 months agosercon: Fix missing GET_LOW() to access rx_bytes
Kevin O'Connor [Thu, 20 Jan 2022 00:07:47 +0000 (19:07 -0500)] 
sercon: Fix missing GET_LOW() to access rx_bytes

The variable rx_bytes is marked VARLOW, but there was a missing
GET_LOW() to access rx_bytes.  Fix by copying rx_bytes to a local
variable and avoid the repetitive segment memory accesses.

Reported-by: Gabe Black <>
Signed-off-by: Volker Rümelin <>
Signed-off-by: Kevin O'Connor <>
12 months agonvme: Only allocate one dma bounce buffer for all nvme drives
Kevin O'Connor [Wed, 19 Jan 2022 19:08:05 +0000 (14:08 -0500)] 
nvme: Only allocate one dma bounce buffer for all nvme drives

There is no need to create multiple dma bounce buffers as the BIOS
disk code isn't reentrant capable.

Also, verify that the allocation succeeds.

Signed-off-by: Kevin O'Connor <>
Reviewed-by: Alexander Graf <>
12 months agonvme: Build the page list in the existing dma buffer
Kevin O'Connor [Wed, 19 Jan 2022 18:20:21 +0000 (13:20 -0500)] 
nvme: Build the page list in the existing dma buffer

Commit 01f2736cc905d ("nvme: Pass large I/O requests as PRP lists")
introduced multi-page requests using the NVMe PRP mechanism. To store the
list and "first page to write to" hints, it added fields to the NVMe
namespace struct.

Unfortunately, that struct resides in fseg which is read-only at runtime.
While KVM ignores the read-only part and allows writes, real hardware and
TCG adhere to the semantics and ignore writes to the fseg region. The net
effect of that is that reads and writes were always happening on address 0,
unless they went through the bounce buffer logic.

This patch builds the PRP maintenance data in the existing "dma bounce
buffer" and only builds it when needed.

Fixes: 01f2736cc905d ("nvme: Pass large I/O requests as PRP lists")
Reported-by: Matt DeVillier <>
Signed-off-by: Alexander Graf <>
Signed-off-by: Kevin O'Connor <>
Reviewed-by: Alexander Graf <>
12 months agonvme: Pass prp1 and prp2 directly to nvme_io_xfer()
Kevin O'Connor [Wed, 19 Jan 2022 18:01:19 +0000 (13:01 -0500)] 
nvme: Pass prp1 and prp2 directly to nvme_io_xfer()

When using a prp2 parameter, build it in nvme_prpl_xfer() and pass it
directly to nvme_io_xfer().

Signed-off-by: Kevin O'Connor <>
Reviewed-by: Alexander Graf <>
12 months agonvme: Convert nvme_build_prpl() to nvme_prpl_xfer()
Kevin O'Connor [Wed, 19 Jan 2022 17:51:55 +0000 (12:51 -0500)] 
nvme: Convert nvme_build_prpl() to nvme_prpl_xfer()

Rename nvme_build_prpl() to nvme_prpl_xfer() and directly invoke
nvme_io_xfer() or nvme_bounce_xfer() from that function.

Signed-off-by: Kevin O'Connor <>
Reviewed-by: Alexander Graf <>
12 months agonvme: Add nvme_bounce_xfer() helper function
Kevin O'Connor [Wed, 19 Jan 2022 16:54:55 +0000 (11:54 -0500)] 
nvme: Add nvme_bounce_xfer() helper function

Move bounce buffer processing to a new helper function.

Signed-off-by: Kevin O'Connor <>
Reviewed-by: Alexander Graf <>
12 months agonvme: Rework nvme_io_readwrite() to return -1 on error
Kevin O'Connor [Wed, 19 Jan 2022 16:45:31 +0000 (11:45 -0500)] 
nvme: Rework nvme_io_readwrite() to return -1 on error

Rename nvme_io_readwrite() to nvme_io_xfer() and change it so it
implements the debugging dprintf() and it returns -1 on an error.

Signed-off-by: Kevin O'Connor <>
Reviewed-by: Alexander Graf <>
12 months agosmm: Suppress gcc array-bounds warnings
Kevin O'Connor [Thu, 13 Jan 2022 16:12:35 +0000 (11:12 -0500)] 
smm: Suppress gcc array-bounds warnings

Add a hack to suppress spurious gcc array-bounds warning (on at least
gcc v11).

Signed-off-by: Kevin O'Connor <>
Tested-by: Paul Menzel <>
13 months agoscripts: Remove
Kevin O'Connor [Sun, 19 Dec 2021 06:31:09 +0000 (01:31 -0500)] 
scripts: Remove

It's simpler to use b"" designations around binary strings than to use
the as_bytes() function.

Signed-off-by: Kevin O'Connor <>
13 months agoreadserial: Improve Python3 compatibility
Kevin O'Connor [Sun, 19 Dec 2021 14:44:13 +0000 (09:44 -0500)] 
readserial: Improve Python3 compatibility

Signed-off-by: Kevin O'Connor <>
13 months agomemmap: Fix gcc out-of-bounds warning
Kevin O'Connor [Sat, 18 Dec 2021 17:08:53 +0000 (12:08 -0500)] 
memmap: Fix gcc out-of-bounds warning

Use a different definition for the linker script symbol to avoid a gcc

Signed-off-by: Kevin O'Connor <>
13 months agovgasrc: Don't use VAR16 in header files to fix gcc warning
Kevin O'Connor [Sat, 18 Dec 2021 17:00:16 +0000 (12:00 -0500)] 
vgasrc: Don't use VAR16 in header files to fix gcc warning

Some versions of gcc complain when VAR16 is used in both the header
and C files - use only in the C file to fix the warning.

Signed-off-by: Kevin O'Connor <>
13 months agosvgamodes: add standard 4k modes
Gerd Hoffmann [Thu, 16 Dec 2021 07:20:58 +0000 (08:20 +0100)] 
svgamodes: add standard 4k modes

Add all three 4k modes.  Computer monitors typically use
the first one (3840x2160).

Add 16 and 32 bpp variants.  24bpp is dead these days, and
software which is so old that still uses those modes most
likely doesn't even know what 4k is.

Signed-off-by: Gerd Hoffmann <>
13 months agovirtio-blk: split large IO according to size_max
Andy Pei [Tue, 7 Dec 2021 01:31:08 +0000 (09:31 +0800)] 
virtio-blk: split large IO according to size_max

if driver reads data larger than VIRTIO_BLK_F_SIZE_MAX,
it will cause some issue to the DMA engine.

So when upper software wants to read data larger than
VIRTIO_BLK_F_SIZE_MAX, virtio-blk driver split one large
request into multiple smaller ones.

Signed-off-by: Andy Pei <>
Signed-off-by: Ding Limin <>
Reviewed-by: Gerd Hoffmann <>
13 months agovirtio-blk: abstract a function named virtio_blk_op_one_segment to handle r/w request
Andy Pei [Tue, 7 Dec 2021 01:31:07 +0000 (09:31 +0800)] 
virtio-blk: abstract a function named virtio_blk_op_one_segment to handle r/w request

abstract virtio-blk queue operation to form a function named virtio_blk_op_one_segment

Signed-off-by: Andy Pei <>
Signed-off-by: Ding Limin <>
Reviewed-by: Gerd Hoffmann <>
13 months agovirtio-blk: add feature VIRTIO_BLK_F_SIZE_MAX and VIRTIO_BLK_F_SEG_MAX
Andy Pei [Tue, 7 Dec 2021 01:31:06 +0000 (09:31 +0800)] 
virtio-blk: add feature VIRTIO_BLK_F_SIZE_MAX and VIRTIO_BLK_F_SEG_MAX

according to virtio spec, add feature VIRTIO_BLK_F_SIZE_MAX
and VIRTIO_BLK_F_SEG_MAX parse to virtio blk driver.

Signed-off-by: Andy Pei <>
Signed-off-by: Ding Limin <>
Reviewed-by: Gerd Hoffmann <>
13 months agopci: let firmware reserve IO for pcie-pci-bridge
Igor Mammedov [Mon, 29 Nov 2021 11:48:12 +0000 (06:48 -0500)] 
pci: let firmware reserve IO for pcie-pci-bridge

With [1] patch hotplug of rtl8139 succeeds, with caveat that it
fails to initialize IO bar, which is caused by [2] that makes
firmware skip IO reservation for any PCIe device, which isn't
correct in case of pcie-pci-bridge.
Fix it by exposing hotplug type and making IO resource optional
only if PCIe hotplug is in use.

 "pci: reserve resources for pcie-pci-bridge to fix regressed hotplug on q35"
Fixes: 76327b9f32a ("fw/pci: do not automatically allocate IO region for PCIe bridges")
Signed-off-by: Igor Mammedov
Tested-by: Laurent Vivier <>
Acked-by: Michael S. Tsirkin <>
13 months agopci: reserve resources for pcie-pci-bridge to fix regressed hotplug on q35
Igor Mammedov [Mon, 29 Nov 2021 11:48:11 +0000 (06:48 -0500)] 
pci: reserve resources for pcie-pci-bridge to fix regressed hotplug on q35

If QEMU is started with unpopulated pcie-pci-bridge with ACPI PCI
hotplug enabled (default since QEMU-6.1), hotplugging a PCI device
into one of the bridge slots fails due to lack of resources.

once linux guest is booted (test used Fedora 34), hotplug NIC from
QEMU monitor:
  (qemu) device_add rtl8139,bus=pcie-pci-bridge-0,addr=0x2

guest fails hotplug with:
  pci 0000:01:02.0: [10ec:8139] type 00 class 0x020000
  pci 0000:01:02.0: reg 0x10: [io  0x0000-0x00ff]
  pci 0000:01:02.0: reg 0x14: [mem 0x00000000-0x000000ff]
  pci 0000:01:02.0: reg 0x30: [mem 0x00000000-0x0003ffff pref]
  pci 0000:01:02.0: BAR 6: no space for [mem size 0x00040000 pref]
  pci 0000:01:02.0: BAR 6: failed to assign [mem size 0x00040000 pref]
  pci 0000:01:02.0: BAR 0: no space for [io  size 0x0100]
  pci 0000:01:02.0: BAR 0: failed to assign [io  size 0x0100]
  pci 0000:01:02.0: BAR 1: no space for [mem size 0x00000100]
  pci 0000:01:02.0: BAR 1: failed to assign [mem size 0x00000100]
  8139cp: 8139cp: 10/100 PCI Ethernet driver v1.3 (Mar 22, 2004)
  PCI Interrupt Link [GSIG] enabled at IRQ 22
  8139cp 0000:01:02.0: no MMIO resource
  8139cp: probe of 0000:01:02.0 failed with error -5

Reason for this is that commit [1] didn't take into account
pcie-pci-bridge, marking bridge as non hotpluggable instead of
handling it as possibly SHPC capable bridge.
Fix issue by checking if pcie-pci-bridge is SHPC capable and
if it is mark it as hotpluggable.

Fixes regression in QEMU-6.1 and later, since it was switched
to ACPI based PCI hotplug on Q35 by default at that time.

Fixes: 3aa31d7d637 ("hw/pci: reserve IO and mem for pci express downstream ports with no devices attached")
Signed-off-by: Igor Mammedov
Acked-by: Michael S. Tsirkin <>
Tested-by: Laurent Vivier <>
13 months agosmbios: Support SMBIOS 3.0 entry point at smbios_romfile_setup()
Eduardo Habkost [Thu, 10 Dec 2020 19:11:34 +0000 (14:11 -0500)] 
smbios: Support SMBIOS 3.0 entry point at smbios_romfile_setup()

Support SMBIOS 3.0 entry points if exposed by QEMU in fw_cfg.

Signed-off-by: Eduardo Habkost <>
13 months agosmbios: Support SMBIOS 3.0 entry point at copy_table()
Eduardo Habkost [Thu, 10 Dec 2020 20:19:30 +0000 (15:19 -0500)] 
smbios: Support SMBIOS 3.0 entry point at copy_table()

This will make coreboot code (scan_tables()) and xen code
(xen_biostable_setup()) copy SMBIOS 3.0 entry points if

Signed-off-by: Eduardo Habkost <>
13 months agosmbios: copy_smbios_30() function
Eduardo Habkost [Thu, 10 Dec 2020 15:32:44 +0000 (10:32 -0500)] 
smbios: copy_smbios_30() function

Add new copy_smbios_30() function, that will be used to support
SMBIOS 3.0 entry points.

The SMBIOS 3.0 entry point will be tracked in a separate
SMBios30Addr variable, because both 2.1 and 3.0 entry points may
exist at the same time.

Adjust the smbios_get_tables(), smbios_major_version(), and
smbios_minor_version() helpers to use the SMBIOS 3.0 entry point
if available.

Signed-off-by: Eduardo Habkost <>
13 months agosmbios: Make smbios_build_tables() ready for 64-bit tables
Eduardo Habkost [Thu, 10 Dec 2020 19:07:16 +0000 (14:07 -0500)] 
smbios: Make smbios_build_tables() ready for 64-bit tables

Make smbios_build_tables() get u64 address and u32 length
arguments, making it usable for SMBIOS 3.0.  Adapt
smbios_21_setup_entry_point() to use intermediate variables when
calling smbios_build_tables().

Signed-off-by: Eduardo Habkost <>
13 months agosmbios: Make some smbios_build_tables() arguments optional
Eduardo Habkost [Thu, 10 Dec 2020 18:29:29 +0000 (13:29 -0500)] 
smbios: Make some smbios_build_tables() arguments optional

Make max_structure_size and number_of_structures optional,
as we don't have those fields in SMBIOS 3.0 entry points.

Signed-off-by: Eduardo Habkost <>
13 months agosmbios: smbios_21_setup_entry_point() function
Eduardo Habkost [Thu, 10 Dec 2020 18:52:14 +0000 (13:52 -0500)] 
smbios: smbios_21_setup_entry_point() function

Extract the code specific for building the SMBIOS 2.1 entry point
from smbios_romfile_setup() to a new
smbios_21_setup_entry_point() function.

Signed-off-by: Eduardo Habkost <>
13 months agosmbios: Make smbios_build_tables() more generic
Eduardo Habkost [Thu, 10 Dec 2020 18:10:15 +0000 (13:10 -0500)] 
smbios: Make smbios_build_tables() more generic

Instead of taking a SMBIOS 2.1 entry point as argument, make
smbios_build_tables() take pointers to the fields it actually
changes.  This will allow us to reuse the function for SMBIOS 3.0

Signed-off-by: Eduardo Habkost <>
13 months agosmbios: Extract SMBIOS table building code to separate function
Eduardo Habkost [Thu, 10 Dec 2020 18:05:17 +0000 (13:05 -0500)] 
smbios: Extract SMBIOS table building code to separate function

Move the code that builds the SMBIOS tables to a separate
smbios_build_tables() function, to keep it isolated from the code
that initializes the SMBIOS entry point.

Thew new function will still take a smbios_21_entry_point
argument to make code review easier, but this will be changed by
the next commits.

Signed-off-by: Eduardo Habkost <>
13 months agosmbios: Use smbios_next() at smbios_romfile_setup()
Eduardo Habkost [Thu, 10 Dec 2020 17:32:37 +0000 (12:32 -0500)] 
smbios: Use smbios_next() at smbios_romfile_setup()

Use smbios_next() instead of smbios_21_next(), to make the code
more generic and reusable for SMBIOS 3.0 support.

Note that `qtables_len` is initialized to `ftables->size` instead
of `ep.structure_table_length` now, but both fields are
guaranteed to have exactly the same value.

Signed-off-by: Eduardo Habkost <>
13 months agosmbios: Make SMBios21Addr variable static
Eduardo Habkost [Thu, 10 Dec 2020 20:48:19 +0000 (15:48 -0500)] 
smbios: Make SMBios21Addr variable static

The variable is now only used inside biostables.c, there's no
need to make it global.

Signed-off-by: Eduardo Habkost <>
13 months agocsm: Don't check SMBios21Addr before calling copy_smbios_21()
Eduardo Habkost [Thu, 10 Dec 2020 20:47:12 +0000 (15:47 -0500)] 
csm: Don't check SMBios21Addr before calling copy_smbios_21()

copy_smbios_21() already checks if SMBios21Addr is NULL, there's
no need to check it before calling the function.

Signed-off-by: Eduardo Habkost <>
13 months agotpm: Use smbios_get_tables()
Eduardo Habkost [Thu, 10 Dec 2020 20:18:28 +0000 (15:18 -0500)] 
tpm: Use smbios_get_tables()

Instead of using the SMBios21Addr global variable, use the
smbios_get_tables() helper.  This doesn't change any behavior
yet, but it will be useful when we start supporting SMBIOS 3.0
entry points.

Signed-off-by: Eduardo Habkost <>
13 months agosmbios: smbios_major_version()/smbios_minor_version() helpers
Eduardo Habkost [Thu, 10 Dec 2020 20:17:16 +0000 (15:17 -0500)] 
smbios: smbios_major_version()/smbios_minor_version() helpers

They new helpers will be useful when we start supporting SMBIOS
3.0 entry points.  Use the new helpers at display_uuid().

Signed-off-by: Eduardo Habkost <>
13 months agosmbios: Use smbios_get_tables()/smbios_next() at display_uuid()
Eduardo Habkost [Thu, 10 Dec 2020 20:08:34 +0000 (15:08 -0500)] 
smbios: Use smbios_get_tables()/smbios_next() at display_uuid()

Make the code more generic, and not specific for SMBIOS 2.1 entry

Signed-off-by: Eduardo Habkost <>
13 months agosmbios: smbios_get_tables() function
Eduardo Habkost [Thu, 10 Dec 2020 20:06:27 +0000 (15:06 -0500)] 
smbios: smbios_get_tables() function

The new function will be useful for code that just needs the
address and length of SMBIOS tables.

Signed-off-by: Eduardo Habkost <>
13 months agosmbios: Generic smbios_next() function
Eduardo Habkost [Thu, 10 Dec 2020 15:57:55 +0000 (10:57 -0500)] 
smbios: Generic smbios_next() function

Extract generic code from smbios_21_next(), so it can be reused
for SMBIOS 3.0 support.

Signed-off-by: Eduardo Habkost <>
13 months agosmbios: Rename code specific for SMBIOS 2.1 entry points
Eduardo Habkost [Thu, 10 Dec 2020 15:10:42 +0000 (10:10 -0500)] 
smbios: Rename code specific for SMBIOS 2.1 entry points

Rename copy_smbios(), smbios_next(), SMBIOS_SIGNATURE,
smbios_entry_point, and SMBiosAddr, to indicate they refer to
SMBIOS 2.1 entry points.

Signed-off-by: Eduardo Habkost <>
13 months agoutil.h: Delete unused get_smbios_entry_point() prototype
Eduardo Habkost [Thu, 10 Dec 2020 15:13:58 +0000 (10:13 -0500)] 
util.h: Delete unused get_smbios_entry_point() prototype

The get_smbios_entry_point() function doesn't exist, delete
unused prototype.

Signed-off-by: Eduardo Habkost <>
13 months agobiostables: copy_fseg_table() function
Eduardo Habkost [Thu, 10 Dec 2020 15:26:43 +0000 (10:26 -0500)] 
biostables: copy_fseg_table() function

Replace the common malloc_fseg() + memcpy() code pattern
with a helper function.

Signed-off-by: Eduardo Habkost <>
13 months agodocs: Note v1.15.0 release rel-1.15.0
Kevin O'Connor [Fri, 3 Dec 2021 01:43:20 +0000 (20:43 -0500)] 
docs: Note v1.15.0 release

Signed-off-by: Kevin O'Connor <>
16 months agotcgbios: Disable platform hierarchy in case of failure
Stefan Berger [Tue, 7 Sep 2021 21:05:52 +0000 (17:05 -0400)] 
tcgbios: Disable platform hierarchy in case of failure

In the rare case of a TPM 2 failure, disable the platform hierarchy after
disabling the endorsement and owner hierarchies.

Signed-off-by: Stefan Berger <>
19 months agonvme: fix missing newline on sq full print
Alex Martens via SeaBIOS [Sat, 26 Jun 2021 22:13:40 +0000 (22:13 +0000)] 
nvme: fix missing newline on sq full print

Signed-off-by: Alex Martens <>
19 months agotcgbios: Use The proper sha function for each PCR bank
Stefan Berger [Mon, 14 Jun 2021 17:35:49 +0000 (13:35 -0400)] 
tcgbios: Use The proper sha function for each PCR bank

Instead of just using sha1 for all PCR banks (and truncating
the value or zero-padding it) use the proper hash function for
each one of the banks. For unimplemented hashes, fill the buffer
with 0xff.

Signed-off-by: Stefan Berger <>
19 months agoAdd implementations for sha256, sha384, and sha512
Stefan Berger [Mon, 14 Jun 2021 17:35:48 +0000 (13:35 -0400)] 
Add implementations for sha256, sha384, and sha512

Signed-off-by: Stefan Berger <>
19 months agotcgbios: Fix details in log entries
Stefan Berger [Wed, 9 Jun 2021 17:31:59 +0000 (13:31 -0400)] 
tcgbios: Fix details in log entries

Fix two details of the logs:

- Set the field 'SpecErrata' to 2 as required by specs.
- Write the separator into the log entry's event field.

Signed-off-by: Stefan Berger <>
19 months agostacks: call check_irqs() after switch_next()
Volker Rümelin [Fri, 4 Jun 2021 18:01:20 +0000 (20:01 +0200)] 
stacks: call check_irqs() after switch_next()

In function run_thread() the function check_irqs() gets called
after the thread switch for atomic handoff reasons. In yield()
it's the other way round.

If check_irqs() is called after run_thread() and check_irqs()
is called before switch_next() in yield(), it can happen in a
constructed case that a background thread runs twice without
a check_irqs() call in between. Call check_irqs() after
switch_next() in yield() to prevent this.

Signed-off-by: Volker Rümelin <>
19 months agostacks: call check_irqs() in run_thread()
Volker Rümelin [Fri, 4 Jun 2021 18:01:19 +0000 (20:01 +0200)] 
stacks: call check_irqs() in run_thread()

The comment above the yield() function suggests that yield()
allows interrupts for a short time. But yield() only briefly
enables interrupts if seabios was built without CONFIG_THREADS
or if yield() is called from the main thread. In order to
guarantee that the interrupts were enabled once before yield()
returns in a background thread, the main thread must call
check_irqs() before or after every thread switch. The function
run_thread() also switches threads, but the call to check_irqs()
was forgotten. Add the missing check_irqs() call.

This fixes PS/2 keyboard initialization failures.

The code in src/hw/ps2port.c relies on yield() to briefly enable
interrupts. There is a comment above the yield() function in
__ps2_command(), where the author left a remark why the call to
yield() is actually needed.

Here is one of the call sequences leading to a PS/2 keyboard
initialization failure.

  ret = i8042_command(I8042_CMD_CTL_TEST, param);
  # This command will register an interrupt if the PS/2 device
  # controller raises interrupts for replies to a controller
  # command.
  ret = ps2_kbd_command(ATKBD_CMD_RESET_BAT, param);
    ps2_command(0, command, param);
      ret = __ps2_command(aux, command, param);
        // Flush any interrupts already pending.
        # yield() doesn't flush interrupts if the main thread
        # hasn't reached wait_threads().
        ret = ps2_sendbyte(aux, command, 1000);
        # Reset the PS/2 keyboard controller and wait for
        # PS2_RET_ACK.
        ret = ps2_recvbyte(aux, 0, 4000);
          for (;;) {
            status = inb(PORT_PS2_STATUS);
            # I8042_STR_OBF isn't set because the keyboard self
            # test reply is still on wire.
            # After a few yield()s the keyboard interrupt fires
            # and clears the I8042_STR_OBF status bit. If the
            # keyboard self test reply arrives before the
            # interrupt fires the keyboard reply is lost and
            # ps2_recvbyte() returns after the timeout.

Signed-off-by: Volker Rümelin <>
19 months agoIncrease BUILD_MIN_BIOSTABLE for large roms
Gerd Hoffmann [Fri, 16 Apr 2021 06:57:02 +0000 (08:57 +0200)] 
Increase BUILD_MIN_BIOSTABLE for large roms

BUILD_MIN_BIOSTABLE reserves space in the f-segment.  Some data
structures -- for example disk drives known to seabios -- must be
stored there, so the space available here limits the number of
devices seabios is able to manage.

This patch sets BUILD_MIN_BIOSTABLE to 8k for bios images being 256k or
larger in size.  32bit code is moved off in that case, so we have more
room in the f-segment then.

Signed-off-by: Gerd Hoffmann <>
20 months agonvme: drive desc should not include the newline
Gerd Hoffmann [Wed, 26 May 2021 07:34:40 +0000 (09:34 +0200)] 
nvme: drive desc should not include the newline

Signed-off-by: Gerd Hoffmann <>
20 months agonvme: improve namespace allocation
Gerd Hoffmann [Wed, 26 May 2021 07:32:10 +0000 (09:32 +0200)] 
nvme: improve namespace allocation

Instead of allocating a big array upfront go probe the namespaces and
only allocate an nvme_namespace struct for those namespaces which are
actually active.

Signed-off-by: Gerd Hoffmann <>
20 months agovgasrc: ignore (binutils-2.36 support)
Sergei Trofimovich [Thu, 20 May 2021 22:18:48 +0000 (23:18 +0100)] 
vgasrc: ignore (binutils-2.36 support)

Modern binutils unconditionally tracks x86_64 ISA levels in intermediate
files in Custom liker script does not handle the
section and complains about it:

    ld --gc-sections -T out/vgasrc/ out/vgaccode16.o \
        out/vgaentry.o out/vgaversion.o -o out/vgarom.o
    ld: section LMA [0000000000000000,0000000000000027] \
        overlaps section .text LMA [0000000000000000,00000000000098af]

The change ignores .note* sections.

Signed-off-by: Sergei Trofimovich <>
22 months agousb-hid: Increase MAX_KBD_EVENT
Stefan Ott via SeaBIOS [Tue, 9 Mar 2021 02:14:05 +0000 (03:14 +0100)] 
usb-hid: Increase MAX_KBD_EVENT

Some USB keyboards use max packet sizes beyond the current maximum
supported by SeaBIOS.

This increases the available size to support keyboards such as the
Matias Ergo Pro.

Signed-off-by: Stefan Ott <>
2 years agoSupport booting USB drives with a write protect switch enabled
Mike Banon [Thu, 3 Dec 2020 04:06:59 +0000 (07:06 +0300)] 
Support booting USB drives with a write protect switch enabled

At least some USB drives with a write protect switch (e.g. Netac U335)
could report "MEDIUM NOT PRESENT" for a while if a write protection is
enabled. Instead of stopping the initialization attempts immediately,
stop only after getting this report for 3 times, to ensure the
successful initialization of such a "broken hardware".

Signed-off-by: Mike Banon <>
2 years agonvme: Clean up nvme_cmd_readwrite()
David Woodhouse [Thu, 5 Nov 2020 16:09:32 +0000 (16:09 +0000)] 
nvme: Clean up nvme_cmd_readwrite()

This ended up with an odd mix of recursion (albeit *mostly*
tail-recursion) and interation that could have been prettier. In
addition, while recursing it potentially adjusted op->count which is
used by callers to see the amount of I/O actually performed.

Fix it by bringing nvme_build_prpl() into the normal loop using 'i'
as the offset in the op.

Fixes: 94f0510dc ("nvme: Split requests by maximum allowed size")
Reviewed-by: Alexander Graf <>
Signed-off-by: David Woodhouse <>
2 years agonvme: Split requests by maximum allowed size
Alexander Graf [Wed, 30 Sep 2020 21:10:56 +0000 (23:10 +0200)] 
nvme: Split requests by maximum allowed size

Some NVMe controllers only support small maximum request sizes, such as
the AWS EBS NVMe implementation which only supports NVMe requests of up
to 32 pages (256kb) at once.

BIOS callers can exceed those request sizes by defining sector counts
above this threshold. Currently we fall back to the bounce buffer
implementation for those. This is slow.

This patch introduces splitting logic to the NVMe I/O request code so
that every NVMe I/O request gets handled in a chunk size that is
consumable by the NVMe adapter, while maintaining the fast path PRPL
logic we just introduced.

Signed-off-by: Alexander Graf <>
2 years agonvme: Pass large I/O requests as PRP lists
Alexander Graf [Wed, 30 Sep 2020 21:10:55 +0000 (23:10 +0200)] 
nvme: Pass large I/O requests as PRP lists

Today, we split every I/O request into at most 4kb chunks and wait for these
requests to finish. We encountered issues where the backing storage is network
based, so every I/O request needs to go over the network with associated
latency cost. A few ms of latency when loading 100MB initrd in 4kb chunks
does add up.

NVMe implements a feature to allow I/O requests spanning multiple pages,
called PRP lists. This patch takes larger I/O operations and checks if
they can be directly passed to the NVMe backing device as PRP list.
At least for grub, read operations can always be mapped directly into
PRP list items.

This reduces the number of I/O operations required during a typical boot
path by roughly a factor of 5.

Signed-off-by: Alexander Graf <>
2 years agonvme: Allow to set PRP2
Alexander Graf [Wed, 30 Sep 2020 21:10:54 +0000 (23:10 +0200)] 
nvme: Allow to set PRP2

When creating a PRP based I/O request, we pass in the pointer to operate
on. Going forward, we will want to be able to pass additional pointers
though for mappings above 4k.

This patch adds a parameter to nvme_get_next_sqe() to pass in the PRP2
value of an NVMe I/O request, paving the way for a future patch to
implement PRP lists.

Signed-off-by: Alexander Graf <>
Reviewed-by: Filippo Sironi <>
2 years agonvme: Record maximum allowed request size
Alexander Graf [Wed, 30 Sep 2020 21:10:53 +0000 (23:10 +0200)] 
nvme: Record maximum allowed request size

NVMe has a limit on how many sectors it can handle at most within a single
request. Remember that number, so that in a follow-up patch, we can verify
that we don't exceed it.

Signed-off-by: Alexander Graf <>
2 years agousb boot: add xhci mmio example github/master
Gerd Hoffmann [Tue, 13 Oct 2020 09:10:19 +0000 (11:10 +0200)] 
usb boot: add xhci mmio example

Signed-off-by: Gerd Hoffmann <>

2 years agousb/xhci: add support for mmio host adapters (via acpi).
Gerd Hoffmann [Wed, 30 Sep 2020 11:14:33 +0000 (13:14 +0200)] 
usb/xhci: add support for mmio host adapters (via acpi).

Add xhci_controller_setup_acpi() function to initialize usb host
adapters declared in the DSDT table.  Search the acpi devices list
for xhci controllers.

Signed-off-by: Gerd Hoffmann <>

2 years agousb/xhci: split xhci setup into generic and pci parts
Gerd Hoffmann [Wed, 30 Sep 2020 11:14:32 +0000 (13:14 +0200)] 
usb/xhci: split xhci setup into generic and pci parts

Split the pci-specific code into a separate xhci_controller_setup_pci()
function, turn xhci_controller_setup() to a generic xhci setup function
which only needs the mmio address if the control registers.

Signed-off-by: Gerd Hoffmann <>

2 years agousb: add boot prio support for mmio host adapters
Gerd Hoffmann [Wed, 30 Sep 2020 11:14:31 +0000 (13:14 +0200)] 
usb: add boot prio support for mmio host adapters

Add mmio field to usb controller struct, add support for mmio-mapped
usb host adapters to boot order handling.

Signed-off-by: Gerd Hoffmann <>

2 years agodsdt: add support for pnp ids as strings
Gerd Hoffmann [Wed, 30 Sep 2020 11:12:22 +0000 (13:12 +0200)] 
dsdt: add support for pnp ids as strings

PNP devices can be declared using eisaid encoding ...

Name (_HID, EisaId ("PNP0103"))

... or as string ...

Name (_HID, "PNP0A06")

.. so lets support both variants.

Signed-off-by: Gerd Hoffmann <>
Reviewed-by: Philippe Mathieu-Daudé <>

2 years agooutput: add support for uppercase hex numbers
Gerd Hoffmann [Wed, 30 Sep 2020 11:12:21 +0000 (13:12 +0200)] 
output: add support for uppercase hex numbers

... via "%X" format string.

Signed-off-by: Gerd Hoffmann <>
Reviewed-by: Philippe Mathieu-Daudé <>

2 years agoUSB:Fix xHCI initail fail by using longer reset and CNR clear timeout value [Sun, 9 Aug 2020 14:22:23 +0000 (14:22 +0000)] 
USB:Fix xHCI initail fail by using longer reset and CNR clear timeout value

Some xHCI controller's reset time than 100ms,such as 120ms.
On the on hand, xHCI spec has not specified a timeout value.
Maybe setting xHCI HCRST and CNR bit clear timeout value larger
is a nice thing.As a compromise between compatibility and
latency,we can take 1000ms as a timeout value.

Signed-off-by: WeitaoWangoc <>
Message-Id: <159698294308.14.13067234241650533818@b63950293ec5>

2 years agousb.c: Fix devices using non-primary interface descriptor
Matt DeVillier [Fri, 11 Sep 2020 17:54:21 +0000 (12:54 -0500)] 
usb.c: Fix devices using non-primary interface descriptor

A fair number of USB devices (keyboards in particular) use an
interface descriptor
other than the first available, making them non-functional currently.
To correct this, iterate through all available interface descriptors
until one with the correct class/subclass is found, then proceed to set the
configuration and setup the driver.

Tested on an ultimate hacking keyboard (UHK 60)

Signed-off-by: Matt DeVillier <>
2 years agosmbios: avoid integer overflow when adding SMBIOS type 0 table
Daniel P. Berrangé [Tue, 8 Sep 2020 15:16:53 +0000 (16:16 +0100)] 
smbios: avoid integer overflow when adding SMBIOS type 0 table

SeaBIOS implements the SMBIOS 2.1 entry point which is limited to a
maximum length of 0xffff. If the SMBIOS data received from QEMU is large
enough, then adding the type 0 table will cause integer overflow. This
results in fun behaviour such as KVM crash, or hangs in SeaBIOS.

Signed-off-by: Daniel P. Berrangé <>
2 years agodocs: Note v1.14.0 release rel-1.14.0
Kevin O'Connor [Mon, 10 Aug 2020 14:52:28 +0000 (10:52 -0400)] 
docs: Note v1.14.0 release

Signed-off-by: Kevin O'Connor <>
2 years agonvme: Increase `nvme_cmd_readwrite()` message log level from 3 to 5
Paul Menzel [Mon, 27 Jul 2020 12:59:42 +0000 (14:59 +0200)] 
nvme: Increase `nvme_cmd_readwrite()` message log level from 3 to 5

Currently, setting SeaBIOS debug level to 3, the log is filled with
messages like below.

    ns 1 read lba 11346288+8: 0
    ns 1 read lba 11346296+4: 0
    ns 1 read lba 11346300+4: 0
    ns 1 read lba 11346304+8: 0
    ns 1 read lba 11346312+8: 0
    ns 1 read lba 11346320+8: 0
    ns 1 read lba 11346328+8: 0
    ns 1 read lba 11346336+8: 0

With SeaBIOS as coreboot payload, this fills up the CBMEM console

So, increase the debug level to 5, so possible console buffer do not

Reviewed-by: Philippe Mathieu-Daudé <>
Signed-off-by: Paul Menzel <>
2 years agovirtio-scsi: fix boot prio detection by using correct lun
Stefan Reiter [Mon, 27 Jul 2020 13:14:15 +0000 (15:14 +0200)] 
virtio-scsi: fix boot prio detection by using correct lun


  d6bdb85eb0 virtio-scsi: skip initializing non-bootable devices
  f82e82a5ab2 virtio-mmio: add support for scsi devices.

both use the lun value from tmpl_drv, which is always 0, instead of the
correct one passed as a separate parameter. This causes systems where
LUNs other than 0 are set as bootable, but 0 is not, to not boot.

Reviewed-by: Paul Menzel <>
Signed-off-by: Stefan Reiter <>
2 years agoldnoexec: Add script to remove ET_EXEC flag from intermediate build objects
Kevin O'Connor [Wed, 22 Jul 2020 15:31:40 +0000 (11:31 -0400)] 
ldnoexec: Add script to remove ET_EXEC flag from intermediate build objects

Add a script to remove the ET_EXEC flag from the 16bit and "32bit
segmented" intermediate objects.  This avoids build failures with some
linkers that will not allow linking these objects again.

Signed-off-by: Kevin O'Connor <>
2 years agovgabios: Fix preserve memory flag in handle_1000
Kevin O'Connor [Mon, 13 Jul 2020 22:50:52 +0000 (18:50 -0400)] 
vgabios: Fix preserve memory flag in handle_1000

Commit 5108c69c made a change to the ordering of some code which broke
the check for the MF_NOCLEARMEM flag.

Reported by

Signed-off-by: Kevin O'Connor <>
2 years agotimer: Handle decrements of PIT counter
Roman Bolshakov [Fri, 26 Jun 2020 18:06:58 +0000 (21:06 +0300)] 
timer: Handle decrements of PIT counter

There's a fallback to PIT if TSC is not present but it doesn't work
properly. It prevents boot from floppy on isapc and 486 cpu [1][2].

SeaBIOS configures PIT in Mode 2. PIT counter is decremented in the mode
but timer_adjust_bits() thinks that the counter overflows and increases
32-bit tick counter on each detected "overflow". Invalid overflow
detection results in 55ms time advance (1 / 18.2Hz) on each read from
PIT counter. So all timers expire much faster and 5-second floppy
timeout expires in 83 real microseconds (or just a bit longer).

It can be fixed by making the counter recieved from PIT an increasing
value so it can be passed to timer_adjust_bits():
0, 1, 2 and up to 65535 and then the counter is re-loaded with 0.


Fixes: eac11944019 ("Unify pmtimer_read() and pittimer_read() code.")
Reported-by: Philippe Mathieu-Daudé <>
Signed-off-by: Roman Bolshakov <>
2 years agovga: fix cirrus bios
Gerd Hoffmann [Thu, 25 Jun 2020 09:17:09 +0000 (11:17 +0200)] 
vga: fix cirrus bios

Little mistake, big effect.  The patch adding the ati driver broke
cirrus due to a missing "else", which effectively downgrades cirrus
to standard vga.

Fixes: 34b6ecc16074 ("vga: add atiext driver")
Signed-off-by: Gerd Hoffmann <>
2 years agoserialio: Preserve Xen DebugOutputPort
Jason Andryuk [Wed, 24 Jun 2020 14:25:13 +0000 (10:25 -0400)] 
serialio: Preserve Xen DebugOutputPort

xen_preinit() runs early and changes DebugOutputPort.  qemu_preinit() runs
soon after.  inb on DebugOutputPort doesn't work on Xen, so the check
will always fail and DebugOutputPort will be cleared to 0 disabling

Quick exit the function when running on Xen to preserve the modified

Signed-off-by: Jason Andryuk <>
2 years agopci: fix mmconfig support
Gerd Hoffmann [Mon, 25 May 2020 09:06:27 +0000 (11:06 +0200)] 
pci: fix mmconfig support

The MODESEGMENT condition is backwards, with the effect that
mmconfig mode is not used to configure pci bars during POST.

Oops.  Fix it.

The only real mode pci config space access seems to come from the
ipxe option rom initialiation.  Which happens to work via mmconfig
because it runs in big real mode so this went unnoticed ...

Fixes: 6a3b59ab9c7d ("pci: add mmconfig support")
Signed-off-by: Gerd Hoffmann <>
2 years agoboot: Fixup check for only one item in boot list
Kevin O'Connor [Mon, 25 May 2020 01:57:19 +0000 (21:57 -0400)] 
boot: Fixup check for only one item in boot list

Signed-off-by: Kevin O'Connor <>
2 years agoboot: Fix logic for boot menu display
Matt DeVillier [Sun, 24 May 2020 22:45:34 +0000 (17:45 -0500)] 
boot: Fix logic for boot menu display

Commit c61193d3 [boot: Extend `etc/show-boot-menu`...] changed the
logic surrounding the use of show_boot_menu incorrectly, leading the
boot menu to be skipped by default with no way to override. Correct
the logic error so that show_boot_menu works as documented.

Test: build/boot SeaBIOS, verify boot menu option shown by default.

Signed-off-by: Matt DeVillier <>
2 years agoRevert "ps2port: adjust init routine to fix PS/2 keyboard issues"
Kevin O'Connor [Thu, 21 May 2020 17:32:22 +0000 (13:32 -0400)] 
Revert "ps2port: adjust init routine to fix PS/2 keyboard issues"

It is believed that the underlying problem was fixed in commit
dbf9dd27f and therefore this commit is not necessary.

This reverts commit bfdb3f86e9116fc79ce63c231373b084aad11218.

Signed-off-by: Kevin O'Connor <>
2 years agocdrom: Demote `scsi_is_ready` return print to debug level
Paul Menzel [Mon, 18 May 2020 16:58:04 +0000 (18:58 +0200)] 
cdrom: Demote `scsi_is_ready` return print to debug level

Printing the return value of `scsi_is_ready()` is a debug message, so
change the log level from 1 to 5.

    Booting from DVD/CD...
    Device reports MEDIUM NOT PRESENT
    scsi_is_ready returned -1
    Boot failed: Could not read from CDROM (code 0003)

Reviewed-by: Philippe Mathieu-Daudé <>
Signed-off-by: Paul Menzel <>
2 years agoboot: Log, if boot menu is skipped
Paul Menzel [Tue, 19 May 2020 21:39:43 +0000 (23:39 +0200)] 
boot: Log, if boot menu is skipped

Signed-off-by: Paul Menzel <>
2 years agoboot: Extend `etc/show-boot-menu` to configure skipping boot menu with only one device
Paul Menzel [Tue, 19 May 2020 21:39:42 +0000 (23:39 +0200)] 
boot: Extend `etc/show-boot-menu` to configure skipping boot menu with only one device

Concerns were raised, that skipping the boot menu, if only one device is
present, might make debugging issues more difficult. So, extend the
current runtime configuration option `etc/show-boot-menu` to enable this
feature by setting it to 2.

Fixes: 29ee1fb8 ("Skip boot menu and timeout with only one boot device")
Signed-off-by: Paul Menzel <>
2 years agorewrap Makefile lines.
Gerd Hoffmann [Fri, 15 May 2020 11:44:16 +0000 (13:44 +0200)] 
rewrap Makefile lines.

Rewrap SRCBOTH and SRC32FLAT variables in Makefile to keep line length
below 80 chars.  No functional change.

Signed-off-by: Gerd Hoffmann <>
2 years agoacpi: find and register virtio-mmio devices
Gerd Hoffmann [Tue, 31 Mar 2020 13:11:46 +0000 (15:11 +0200)] 
acpi: find and register virtio-mmio devices

Seach for virtio-mmio devices in the DSDT table,
register the devices found.

Signed-off-by: Gerd Hoffmann <>
2 years agoacpi: skip kbd init if not present
Gerd Hoffmann [Tue, 31 Mar 2020 12:51:52 +0000 (14:51 +0200)] 
acpi: skip kbd init if not present

Don't initialize the ps/2 keyboard in case the device is not
listed in the ACPi DSDT table.

Signed-off-by: Gerd Hoffmann <>
2 years agoacpi: add dsdt parser
Gerd Hoffmann [Tue, 24 Mar 2020 11:13:32 +0000 (12:13 +0100)] 
acpi: add dsdt parser

Create a list of devices found in the DSDT table.  Add helper functions
to find devices, walk the list and figure device informations like mmio
ranges and irqs.

Signed-off-by: Gerd Hoffmann <>
2 years agoacpi: add xsdt support
Gerd Hoffmann [Wed, 25 Mar 2020 07:55:21 +0000 (08:55 +0100)] 
acpi: add xsdt support

In case a xsdt table is present (and located below 4G)
prefer it over rsdt.

Signed-off-by: Gerd Hoffmann <>
2 years agovirtio-mmio: print device type
Gerd Hoffmann [Fri, 3 Apr 2020 07:33:34 +0000 (09:33 +0200)] 
virtio-mmio: print device type

2 years agovirtio-mmio: add support for block devices.
Gerd Hoffmann [Mon, 9 Mar 2020 07:05:21 +0000 (08:05 +0100)] 
virtio-mmio: add support for block devices.

Add and use bootprio_find_mmio_device() to figure
the boot priority of virtio-mmio block devices.

Add init_virtio_blk_mmio to initialize one
virtio-mmio block device.

Signed-off-by: Gerd Hoffmann <>