]> xenbits.xensource.com Git - seabios.git/log
seabios.git
4 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é <philmd@redhat.com>
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
4 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 <pmenzel@molgen.mpg.de>
4 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 <pmenzel@molgen.mpg.de>
4 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 <kraxel@redhat.com>
4 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 <kraxel@redhat.com>
4 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 <kraxel@redhat.com>
4 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 <kraxel@redhat.com>
4 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 <kraxel@redhat.com>
4 years agovirtio-mmio: print device type
Gerd Hoffmann [Fri, 3 Apr 2020 07:33:34 +0000 (09:33 +0200)]
virtio-mmio: print device type

4 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 <kraxel@redhat.com>
4 years agovirtio-mmio: add support for scsi devices.
Gerd Hoffmann [Mon, 9 Mar 2020 06:43:50 +0000 (07:43 +0100)]
virtio-mmio: add support for scsi devices.

Add new fields to struct virtio_lun_s for mmio support,
add mmio parameter to virtio_scsi_init_lun(), so both
pci and mmio devices can be handled.

Add and use bootprio_find_scsi_mmio_device() to figure
boot priority of devices connected to a virtio-mmio
scsi controller.

Finally add init_virtio_scsi_mmio() to initialize one
virtio-mmio scsi controller.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4 years agovirtio-mmio: add support to vp_*() functions
Gerd Hoffmann [Fri, 6 Mar 2020 18:44:47 +0000 (19:44 +0100)]
virtio-mmio: add support to vp_*() functions

Add support for virtio-mmio to the vp_*() helper functions.
Both legacy and 1.0 virto-mmio versions are supported.  They
are very simliar anyway, only the virtqueue initialization
is slightly different.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4 years agovirtio-mmio: device probing and initialization.
Gerd Hoffmann [Fri, 6 Mar 2020 13:34:18 +0000 (14:34 +0100)]
virtio-mmio: device probing and initialization.

Add virtio_mmio_setup_one() to setup virtio mmio devices.  Add
vp_init_mmio() to initialize device struct.  Because virtio-pci and
virtio-mmio are quite simliar we reuse the infrastructure we already
have for virtio-pci and just setup struct vp_cap for virtio-mmio.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4 years agoqemu: check rtc presence before reading cpu count from cmos
Gerd Hoffmann [Thu, 7 May 2020 11:53:26 +0000 (13:53 +0200)]
qemu: check rtc presence before reading cpu count from cmos

Read month register which should never have a value larger than 12.
In case the read returns 0xff assume the rtc isn't there.
Don't try to read the cpu count from cmos without rtc.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agoqemu: rework e820 detection
Gerd Hoffmann [Fri, 8 May 2020 10:22:53 +0000 (12:22 +0200)]
qemu: rework e820 detection

Read e820 table from fw_cfg early.  This avoids reading the cmos for ram
detection on modern qemu.  It also simplifies the ram detection logic.
We stop doing ram detecion in two steps, so we don't have to worry about
the second step overwriting the setup done by the first step.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4 years agoqemu: factor out qemu_cfg_detect()
Gerd Hoffmann [Fri, 8 May 2020 11:06:20 +0000 (13:06 +0200)]
qemu: factor out qemu_cfg_detect()

Move qemu fw_cfg detection to separate function.
No functional change.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4 years agobuild: use -fcf-protection=none when available
Christian Ehrhardt [Fri, 20 Mar 2020 08:38:02 +0000 (09:38 +0100)]
build: use -fcf-protection=none when available

Some hardened gcc v9 compilers (such as the one in Ubuntu)
default this option which for seabios leads to emulation errors
when running in KVM (does not trigger in TCG) on older intel
chips of the Penryn generation (~2006-2008).

The symptom appears as endbr32/endbr64 interpretation failures
and in KVM it looks like:
  KVM internal error. Suberror: 1
  emulation failure
  EAX=00000000 EBX=00000000 ECX=000086d4 EDX=00000000
  ESI=00000000 EDI=00000000 EBP=000086d4 ESP=00006d7c
  EIP=00007acf EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0
  ES =0000 00000000 ffffffff 00809300
  CS =f000 000f0000 ffffffff 00809b00
  SS =0000 00000000 ffffffff 00809300
  DS =0000 00000000 ffffffff 00809300
  FS =0000 00000000 ffffffff 00809300
  GS =0000 00000000 ffffffff 00809300
  LDT=0000 00000000 0000ffff 00008200
  TR =0000 00000000 0000ffff 00008b00
  GDT=     000f6200 00000037
  IDT=     00000000 000003ff
  CR0=00000010 CR2=00000000 CR3=00000000 CR4=00000000
  DR0=0000000000000000 DR1=0000000000000000
  DR2=0000000000000000 DR3=0000000000000000
  DR6=00000000ffff0ff0 DR7=0000000000000400
  EFER=0000000000000000
  Code=b8 90 d9 00 00 66 e8 6b f7 ff ff 66 b8 0a 00 00
       00 e9 61 f2 <f3> 0f 1e fb 66 57 66 56 66 53 66 53
       66 89 c7 67 66 89 14 24 66 89 ce 66 e8 15 f8 ff ff 88

URL: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1866870
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
5 years agotcgbios: Add support for SHA3 type of algorithms
Stefan Berger [Mon, 30 Mar 2020 11:55:57 +0000 (07:55 -0400)]
tcgbios: Add support for SHA3 type of algorithms

Add support for SHA3 type of algorithms that a TPM2 may support
some time in the future.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5 years agotcgbios: Fix the vendorInfoSize to be of type u8
Stefan Berger [Mon, 30 Mar 2020 11:55:56 +0000 (07:55 -0400)]
tcgbios: Fix the vendorInfoSize to be of type u8

The vendorInfoSize is a u8 rather than a u32.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5 years agotcgbios: Only write logs for PCRs that are in active PCR banks
Stefan Berger [Mon, 30 Mar 2020 11:55:55 +0000 (07:55 -0400)]
tcgbios: Only write logs for PCRs that are in active PCR banks

Only write the logs for those PCRs that are in active PCR banks.
A PCR banks is assumed to be active if any of the BIOS relevant
PCRs 0 -  7 is enabled, thus pcrSelect[0] != 0.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5 years agopci: add mmconfig support
Gerd Hoffmann [Mon, 23 Mar 2020 14:59:11 +0000 (15:59 +0100)]
pci: add mmconfig support

Add support for pci config space access via mmconfig bar.  Enable for
qemu q35 chipset.  Main advantage is that we need only one instead of
two io operations per config space access, which translates to one
instead of two vmexits for virtualization.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200323145911.22319-3-kraxel@redhat.com

5 years agopci: factor out ioconfig_cmd()
Gerd Hoffmann [Mon, 23 Mar 2020 14:59:10 +0000 (15:59 +0100)]
pci: factor out ioconfig_cmd()

Add helper function to calculate PORT_PCI_CMD value from bdf + addr.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200323145911.22319-2-kraxel@redhat.com

5 years agostd/tcg: Replace zero-length array with flexible-array member
Paul Menzel [Wed, 4 Mar 2020 13:51:27 +0000 (14:51 +0100)]
std/tcg: Replace zero-length array with flexible-array member

GCC 10 gives the warnings below:

    In file included from out/ccode32flat.o.tmp.c:54:
    ./src/tcgbios.c: In function 'tpm20_write_EfiSpecIdEventStruct':
    ./src/tcgbios.c:290:30: warning: array subscript '(<unknown>) + 4294967295' is outside the bounds of an interior zero-length array 'struct TCG_EfiSpecIdEventAlgorithmSize[0]' [-Wzero-length-bounds]
      290 |         event.hdr.digestSizes[count].algorithmId = be16_to_cpu(sel->hashAlg);
          |         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    In file included from ./src/tcgbios.c:22,
                     from out/ccode32flat.o.tmp.c:54:
    ./src/std/tcg.h:527:7: note: while referencing 'digestSizes'
      527 |     } digestSizes[0];
          |       ^~~~~~~~~~~
    In file included from out/ccode32flat.o.tmp.c:54:
    ./src/tcgbios.c:291:30: warning: array subscript '(<unknown>) + 4294967295' is outside the bounds of an interior zero-length array 'struct TCG_EfiSpecIdEventAlgorithmSize[0]' [-Wzero-length-bounds]
      291 |         event.hdr.digestSizes[count].digestSize = hsize;
          |         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    In file included from ./src/tcgbios.c:22,
                     from out/ccode32flat.o.tmp.c:54:
    ./src/std/tcg.h:527:7: note: while referencing 'digestSizes'
      527 |     } digestSizes[0];
          |       ^~~~~~~~~~~

[Description copied from Gustavo A. R. Silva <gustavo@embeddedor.com>
from his Linux kernel commits.]

The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array
member [1][2], introduced in C99:

    struct foo {
            int stuff;
            struct boo array[];
    };

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=76497732932f15e7323dc805e8ea8dc11bb587cf

Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agops2port: adjust init routine to fix PS/2 keyboard issues
Matt DeVillier [Fri, 12 Aug 2016 19:21:58 +0000 (14:21 -0500)]
ps2port: adjust init routine to fix PS/2 keyboard issues

PS/2 keyboards on Chromebooks with upstream coreboot + SeaBIOS often
fail to init properly / register keystrokes.  Modify ps2port init
to match that of TianoCore, which doesn't have said issues.

Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Message-Id: <248435f9-c169-e1db-fc3e-62185b74899c@molgen.mpg.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoSkip boot menu and timeout with only one boot device
Matt DeVillier [Fri, 13 Jun 2014 22:20:23 +0000 (17:20 -0500)]
Skip boot menu and timeout with only one boot device

Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Message-Id: <45aa3ebe-b97c-f1af-2901-ec4e9bcd1084@molgen.mpg.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agosercon: vbe modeset is int 10h function 4f02 not 4f00
Gerd Hoffmann [Fri, 6 Mar 2020 09:03:21 +0000 (10:03 +0100)]
sercon: vbe modeset is int 10h function 4f02 not 4f00

Fixes console redirection for NetBSD primary bootloader.

https://bugs.launchpad.net/bugs/1743191
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Kevin O'Connor <kevin@koconnor.net>
Message-Id: <20200306090321.24811-1-kraxel@redhat.com>

5 years agokvm: add support for reading tsc frequency from kvmclock
Gerd Hoffmann [Tue, 10 Mar 2020 10:22:48 +0000 (11:22 +0100)]
kvm: add support for reading tsc frequency from kvmclock

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200310102248.28412-4-kraxel@redhat.com

5 years agokvm: add support for reading tsc frequency via cpuid.
Gerd Hoffmann [Tue, 10 Mar 2020 10:22:47 +0000 (11:22 +0100)]
kvm: add support for reading tsc frequency via cpuid.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200310102248.28412-3-kraxel@redhat.com

5 years agokvm: detect unconditionally
Gerd Hoffmann [Tue, 10 Mar 2020 10:22:46 +0000 (11:22 +0100)]
kvm: detect unconditionally

So we detect kvm even in case there is no qemu pci hostbridge present,
for example when using the new, pci-less microvm machine type.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200310102248.28412-2-kraxel@redhat.com

5 years agotimer: add tsctimer_setfreq()
Gerd Hoffmann [Tue, 10 Mar 2020 10:22:45 +0000 (11:22 +0100)]
timer: add tsctimer_setfreq()

Add function to set tsc frequency directly, without calibration.
Also tweak timer setup functions a bit: skip setup in case TimerPort
has not the default value any more, i.e. another timer has been setup
already.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200310102248.28412-1-kraxel@redhat.com

5 years agohw/usb-hid: Don't abort if setting key repeat rate fails
Matt DeVillier [Fri, 13 Dec 2019 03:51:19 +0000 (21:51 -0600)]
hw/usb-hid: Don't abort if setting key repeat rate fails

Since the USB stack doesn't handle stalled pipes,
don't abort keyboard setup if the set_idle command fails,
since it's a non-critical feature. Instead, log a warning.

Test: build/boot Google Pixel Slate, observe keyboard functional

Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
5 years agousb-hid: Improve max packet size checking
Kevin O'Connor [Fri, 6 Mar 2020 13:21:37 +0000 (08:21 -0500)]
usb-hid: Improve max packet size checking

Some USB keyboards report 9 or 10-byte max packet sizes instead of the
8-byte max specified by the USB HID spec.  Increase the available size
and simplify the boundary checks.

Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
5 years agonvme: skip initializing non-bootable devices
Gerd Hoffmann [Tue, 14 Jan 2020 09:12:01 +0000 (10:12 +0100)]
nvme: skip initializing non-bootable devices

Check NVMe devices whenever they are bootable,
skip initialization in case they are not.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agovirtio-scsi: skip initializing non-bootable devices
Gerd Hoffmann [Tue, 14 Jan 2020 09:04:06 +0000 (10:04 +0100)]
virtio-scsi: skip initializing non-bootable devices

Check each disk attached to a virtio-scsi device whenever
it is bootable and skip initialization in case it isn't.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoboot: cache HALT priority
Gerd Hoffmann [Tue, 14 Jan 2020 08:56:31 +0000 (09:56 +0100)]
boot: cache HALT priority

Call find_prio("HALT") only once, on first is_bootprio_strict() call.
Store the result in a variable and reuse it on subsequent calls.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agovirtio: Do not init non-bootable devices
Alexey Kirillov [Tue, 7 Jan 2020 17:19:17 +0000 (20:19 +0300)]
virtio: Do not init non-bootable devices

Because initializing a virtio-blk or virtio-scsi device requires a large
amount of memory, you cannot create more than about 10 virtio devices.
Since initialization is required for booting from media, we will not
initialize those devices that are not in the boot order list.

Signed-off-by: Alexey Kirillov <lekiravi@yandex-team.ru>
Message-id: 20200107171917.7535-3-lekiravi@yandex-team.ru
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoboot: Detect strict boot order (HALT record) in function
Alexey Kirillov [Tue, 7 Jan 2020 17:19:16 +0000 (20:19 +0300)]
boot: Detect strict boot order (HALT record) in function

Introduce is_bootprio_strict().
We will reuse this function in the next commit.

Signed-off-by: Alexey Kirillov <lekiravi@yandex-team.ru>
Message-id: 20200107171917.7535-2-lekiravi@yandex-team.ru
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agodocs: Note v1.13.0 release rel-1.13.0
Kevin O'Connor [Mon, 9 Dec 2019 20:08:17 +0000 (15:08 -0500)]
docs: Note v1.13.0 release

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
5 years agogeometry: Apply LCHS values for boot devices
Sam Eiderman [Wed, 26 Jun 2019 12:38:16 +0000 (15:38 +0300)]
geometry: Apply LCHS values for boot devices

Boot devices which use overriden LCHS values are:

    * ata
    * ahci
    * scsi
        * esp
        * lsi
        * megasas
        * mpt
        * pvscsi
        * virtio
    * virtio-blk

We use these values in get_translation() and setup_translation() by
introducing a new translation type: "TRANSLATION_HOST".

We treat this translation as TRANSLATION_NONE in fill_ata_edd(),
although this does not really matter since now the translation between
physical and logical geometry does not exist.

Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com>
Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com>
Message-Id: <20190626123816.8907-6-shmuel.eiderman@oracle.com>

5 years agogeometry: Add boot_lchs_find_*() utility functions
Sam Eiderman [Wed, 26 Jun 2019 12:38:15 +0000 (15:38 +0300)]
geometry: Add boot_lchs_find_*() utility functions

Adding the following utility functions:

    * boot_lchs_find_pci_device
    * boot_lchs_find_scsi_device
    * boot_lchs_find_ata_device

These will be used to apply LCHS values received through fw_cfg.

Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com>
Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com>
Message-Id: <20190626123816.8907-5-shmuel.eiderman@oracle.com>

5 years agoboot: Build ata and scsi paths in function
Sam Eiderman [Wed, 26 Jun 2019 12:38:14 +0000 (15:38 +0300)]
boot: Build ata and scsi paths in function

Introduce build_scsi_path() and build_ata_path().
We will reuse these functions in the next commit.

Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com>
Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com>
Message-Id: <20190626123816.8907-4-shmuel.eiderman@oracle.com>

5 years agogeometry: Read LCHS from fw_cfg
Sam Eiderman [Wed, 26 Jun 2019 12:38:12 +0000 (15:38 +0300)]
geometry: Read LCHS from fw_cfg

Read bios geometry for boot devices from fw_cfg.

By receiving LCHS values directly from QEMU through fw_cfg we will be
able to support logical geometries which can not be inferred by SeaBIOS
itself.
(For instance: A 8GB virtio-blk hard drive which was originally created
as an IDE and must report LCHS of */32/63 for its operating system to
function will always break under SeaBIOS since a LARGE/LBA translation
will be used, causing the number of reported logical heads to be > 32.)

The only LCHS paravirtual interface available at the moment is for IDE
disks (rtc_read() in get_translation()) and it's limited to a maximum
of 4 disks (this code existed in SeaBIOS's translation function before
SCSI and VirtIO were even introduced).
This is why we create a new interface which allows passing LCHS
information per hdd.

Boot device information is serialized in the following way:
    * device_path lcyls lheads lsecs\n
    ...
    * device_path lcyls lheads lsecs\0

Device path is a null terminated string in the "Open Firmware" device
path format, the same path as used in bootorder.

Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com>
Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com>
Message-Id: <20190626123816.8907-2-shmuel.eiderman@oracle.com>

5 years agoRevert "geometry: Read LCHS from fw_cfg"
Gerd Hoffmann [Fri, 15 Nov 2019 11:19:42 +0000 (12:19 +0100)]
Revert "geometry: Read LCHS from fw_cfg"

This reverts commit 7c66a439c07536b525ff9d5ce230775975e9c072.

5 years agoRevert "geometry: Add boot_lchs_find_*() utility functions"
Gerd Hoffmann [Fri, 15 Nov 2019 11:18:18 +0000 (12:18 +0100)]
Revert "geometry: Add boot_lchs_find_*() utility functions"

This reverts commit ad2910949b1886deba24f574cee76cdc75e7cabe.

5 years agoRevert "config: Add toggle for bootdevice information"
Gerd Hoffmann [Fri, 15 Nov 2019 11:18:05 +0000 (12:18 +0100)]
Revert "config: Add toggle for bootdevice information"

This reverts commit cb56f61c109985ad71078b1fb2e65bd4d6ed1a59.

5 years agoRevert "geometry: Apply LCHS values for boot devices"
Gerd Hoffmann [Fri, 15 Nov 2019 11:17:50 +0000 (12:17 +0100)]
Revert "geometry: Apply LCHS values for boot devices"

This reverts commit 9caa19be0e534c687081fbdfcd301406e728c98c.

5 years agotcgbios: Check for enough bytes returned from TPM2_GetCapability
Stefan Berger [Wed, 6 Nov 2019 21:36:00 +0000 (16:36 -0500)]
tcgbios: Check for enough bytes returned from TPM2_GetCapability

When querying a TPM 2.0 for its PCRs, make sure that we get enough bytes
from it in a response that did not indicate a failure. Basically we are
defending against a TPM 2.0 sending responses that are not compliant to
the specs.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
5 years agotpm: Require a response to have minimum size of a valid response header
Stefan Berger [Wed, 6 Nov 2019 21:35:59 +0000 (16:35 -0500)]
tpm: Require a response to have minimum size of a valid response header

Defend against a broken TPM 1.2 or TPM 2.0 that doesn't send at least
a full response header in the response but less than 10 bytes.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
5 years agoahci: zero-initialize port struct
Gerd Hoffmann [Wed, 13 Nov 2019 09:13:02 +0000 (10:13 +0100)]
ahci: zero-initialize port struct

Specifically port->drive.lchs needs clearing, otherwise seabios will
try interpret whatever random crap happens to be there as disk geometry,
which may or may not break boot depending on how lucky you are.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
5 years agogeometry: Apply LCHS values for boot devices
Sam Eiderman [Wed, 12 Jun 2019 09:37:04 +0000 (12:37 +0300)]
geometry: Apply LCHS values for boot devices

Boot devices which use overriden LCHS values are:

    * ata
    * ahci
    * scsi
        * esp
        * lsi
        * megasas
        * mpt
        * pvscsi
        * virtio
    * virtio-blk

We use these values in get_translation() and setup_translation() by
introducing a new translation type: "TRANSLATION_MACHINE".

We treat this translation as TRANSLATION_NONE in fill_ata_edd(),
although this does not really matter since now the translation between
physical and logical geometry does not exist.

Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com>
Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com>
Message-Id: <20190612093704.47175-6-shmuel.eiderman@oracle.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoconfig: Add toggle for bootdevice information
Sam Eiderman [Wed, 12 Jun 2019 09:37:03 +0000 (12:37 +0300)]
config: Add toggle for bootdevice information

Add the "BOOTDEVICES" toggle to remove boot device information received
through fw_cfg.

We will use this toggle in QEMU to reduce the size of the 128k SeaBIOS
rom, which is only used in old compat versions, where this boot device
information does not exist.

Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com>
Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com>
Message-Id: <20190612093704.47175-5-shmuel.eiderman@oracle.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agogeometry: Add boot_lchs_find_*() utility functions
Sam Eiderman [Wed, 12 Jun 2019 09:37:02 +0000 (12:37 +0300)]
geometry: Add boot_lchs_find_*() utility functions

Adding the following utility functions:

    * boot_lchs_find_pci_device
    * boot_lchs_find_scsi_device
    * boot_lchs_find_ata_device

These will be used to apply LCHS values received through fw_cfg.

Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com>
Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com>
Message-Id: <20190612093704.47175-4-shmuel.eiderman@oracle.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoboot: Reorder functions in boot.c
Sam Eiderman [Wed, 12 Jun 2019 09:37:01 +0000 (12:37 +0300)]
boot: Reorder functions in boot.c

Currently glob_prefix() and build_pci_path() are under the "Boot
priority ordering" section.
Move them to a new "Helper search functions" section since we will reuse
them in the next commit.

Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com>
Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com>
Message-Id: <20190612093704.47175-3-shmuel.eiderman@oracle.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agogeometry: Read LCHS from fw_cfg
Sam Eiderman [Wed, 12 Jun 2019 09:37:00 +0000 (12:37 +0300)]
geometry: Read LCHS from fw_cfg

Read boot device information from fw_cfg.

Boot device information will contain logical geometry (LCHS) values,
but it is implemented in a manner which allows extension.

By receiving LCHS values directly from QEMU through fw_cfg we will be
able to support logical geometries which can not be inferred by SeaBIOS
itself.
(For instance: A 8GB virtio-blk hard drive which was originally created
as an IDE and must report LCHS of */32/63 for its operating system to
function will always break under SeaBIOS since a LARGE/LBA translation
will be used, causing the number of reported logical heads to be > 32.)

The only LCHS paravirtual interface available at the moment is for IDE
disks (rtc_read() in get_translation()) and it's limited to a maximum
of 4 disks (this code existed in SeaBIOS's translation function before
SCSI and VirtIO were even introduced).
This is why we create a new interface which allows passing LCHS
information per hdd. As mentioned, this interface may be easily extended
to support more information per hdd.

Boot device information is serialized in the following way:
    * struct_size (u32)
    * device path (sz string)
    * device information (struct_size)
    ...
    * device path (sz string)
    * device information (struct_size)

Device path is a null terminated string in the "Open Firmware" device
path format, the same path as used in bootorder.

Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
Reviewed-by: Arbel Moshe <arbel.moshe@oracle.com>
Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com>
Message-Id: <20190612093704.47175-2-shmuel.eiderman@oracle.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agodocs: Note release date for v1.12.1
Kevin O'Connor [Mon, 28 Oct 2019 15:18:32 +0000 (11:18 -0400)]
docs: Note release date for v1.12.1

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
5 years agodocs: Add developer-certificate-of-origin
Kevin O'Connor [Mon, 21 Oct 2019 15:27:39 +0000 (11:27 -0400)]
docs: Add developer-certificate-of-origin

Update the documentation to be explicit about the signed-off-by
convention.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
5 years agocp437: add license to cp437.c
Gerd Hoffmann [Wed, 23 Oct 2019 05:50:39 +0000 (07:50 +0200)]
cp437: add license to cp437.c

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoramfb: add copyright and license to ramfb.c
Gerd Hoffmann [Wed, 23 Oct 2019 05:50:38 +0000 (07:50 +0200)]
ramfb: add copyright and license to ramfb.c

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agobochsdisplay: add copyright and license to bochsdisplay.c
Gerd Hoffmann [Wed, 23 Oct 2019 05:50:37 +0000 (07:50 +0200)]
bochsdisplay: add copyright and license to bochsdisplay.c

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agosvgamodes: Add copyright notice to vgasrc/svgamodes.c
Kevin O'Connor [Mon, 21 Oct 2019 22:57:40 +0000 (18:57 -0400)]
svgamodes: Add copyright notice to vgasrc/svgamodes.c

Commit 004f5b3a moved part of vgasrc/bochsvga.c to vgasrc/svgamodes.c
- copy over the copyright statements as well.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
5 years agoRemove dos line endings introduced in the last two commits
Uwe Kleine-König [Sun, 20 Oct 2019 20:07:26 +0000 (22:07 +0200)]
Remove dos line endings introduced in the last two commits

These were added somewhere between the mailing list server and Gerd's
working copy (as the patch I got via the mailing list is fine). These
don't disturb the compiler, but they look ugly so remove them.

Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Message-Id: <20191020200726.20116-1-uwe@kleine-koenig.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoAdd additional resolutions for 16:9 displays: 1600x900 and 2560x1440
Uwe Kleine-König [Thu, 17 Oct 2019 20:33:53 +0000 (22:33 +0200)]
Add additional resolutions for 16:9 displays: 1600x900 and 2560x1440

This allows to have qemu run at the native screen resolution of my
(physical) monitor.

This is inspired by a patch created by Andreas Dangel that I found on
https://adangel.org/2015/09/11/qemu-kvm-custom-resolutions/ .

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Message-Id: <20191017203353.18898-2-uwe@kleine-koenig.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agocbvga: reuse svga modes definitions from svgamodes.c
Uwe Kleine-König [Thu, 17 Oct 2019 20:33:52 +0000 (22:33 +0200)]
cbvga: reuse svga modes definitions from svgamodes.c

For cbvga only modes with MM_DIRECT are usable, so skip the other ones.
This effectively adds the following modes:

    { 0x10D, { MM_DIRECT, 320,  200,  15, 8, 16, SEG_GRAPH } },
    { 0x10E, { MM_DIRECT, 320,  200,  16, 8, 16, SEG_GRAPH } },
    { 0x10F, { MM_DIRECT, 320,  200,  24, 8, 16, SEG_GRAPH } },
    { 0x140, { MM_DIRECT, 320,  200,  32, 8, 16, SEG_GRAPH } },

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Message-Id: <20191017203353.18898-1-uwe@kleine-koenig.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agovirtio: extend virtio queue size to 256
Denis Plotnikov [Thu, 17 Oct 2019 14:01:00 +0000 (17:01 +0300)]
virtio: extend virtio queue size to 256

The goal of the patch is to work around a performance bug in guest
linux kernels.

Old linux kernels has a performance flaw in virtio block device access:
on some frequent disk access patterns, e.g. 1M read, the kernel produces
more block requests than needed. This happens because of virtio seg_max
parameter set to 126 (virtqueue_size - 2) which limits the maximum block
request to 516096 (126 * 4096_PAGE_SIZE) bytes.

Setting seg_max > 126 fixes the issue, however, not all linux kernels
allow that without increasing virtio virtqueue size. The old kernels have
a restriction: virtqueue_size >= seg_max. In case of the restriction
violation the old kernels crash.

The restriction is relaxed in the recent linux kernels (ver >= 4.13) with:

    commit 44ed8089e991a60d614abe0ee4b9057a28b364e4
    Author: Richard W.M. Jones
    Date:   Thu Aug 10 17:56:51 2017 +0100

        scsi: virtio: Reduce BUG if total_sg > virtqueue size to WARN.

and the recent linux kernels don't crash if total_sg > virtqueue size
allowing to set seg_max to the needed value without virtqueue size
increasing.

To fix the performance flaw in the old linux kernels, it's needed to
increse seg_max to 254, and comply the restriction by setting
virtqueue_size to 256.
This is achievable if seabios can support virtqueue size > 128
which this patch actually does.

Windows kernels don't have virtqueue_size >= seg_max restriction and
isn't affected with this kind of the performance bug.

Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoMakefile: Build with -Wno-address-of-packed-member
Kevin O'Connor [Wed, 21 Aug 2019 13:18:25 +0000 (09:18 -0400)]
Makefile: Build with -Wno-address-of-packed-member

Building with gcc v9 causes lots of warnings about pointers to packed
variables.  However, SeaBIOS is limited to x86 where unaligned
reads/writes are supported by the cpu.  So, disable that warning.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5 years agocsm: Fix boot priority translation
David Woodhouse [Fri, 28 Jun 2019 13:57:47 +0000 (14:57 +0100)]
csm: Fix boot priority translation

Explicitly handle the BBS_DO_NOT_BOOT_FROM and BBS_IGNORE_ENTRY values.

Also add one to the other priority values, as find_prio() does for
entries from bootorder. SeaBIOS uses zero for an item explicitly
selected in interactive_bootmenu().

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoati-vga: add rage128 edid support
Gerd Hoffmann [Mon, 24 Jun 2019 11:35:46 +0000 (13:35 +0200)]
ati-vga: add rage128 edid support

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoati-vga: try vga ddc first
Gerd Hoffmann [Mon, 24 Jun 2019 10:17:28 +0000 (12:17 +0200)]
ati-vga: try vga ddc first

Try vga ddc bus before dvi ddc bus.
Return early in case we got valid data.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoati-vga: make i2c register and bits configurable
Gerd Hoffmann [Mon, 24 Jun 2019 10:08:32 +0000 (12:08 +0200)]
ati-vga: make i2c register and bits configurable

Prepare to support other ati cards.  Also log access mode and whenever
we got a valid edid block.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoati-vga: fix ati_read()
Gerd Hoffmann [Mon, 24 Jun 2019 10:09:31 +0000 (12:09 +0200)]
ati-vga: fix ati_read()

Cut & paste bug probably.  Had no bad effect so far because the code
doesn't read registers larger than 0x100.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoati-vga: make less verbose
Gerd Hoffmann [Mon, 24 Jun 2019 10:09:52 +0000 (12:09 +0200)]
ati-vga: make less verbose

Reduce loglevel for mode line removals from 1 to 3.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agocsm: Sanitise alignment constraint in Legacy16GetTableAddress
David Woodhouse [Thu, 13 Jun 2019 15:25:13 +0000 (16:25 +0100)]
csm: Sanitise alignment constraint in Legacy16GetTableAddress

The alignment constraint is defined in the CSM specifications as
"Bit mapped.  First non-zero bit from the right is the alignment."

Use __fls() to sanitise the alignment given that definition, since
passing a non-power-of-two alignment to _malloc() isn't going to work
well. And cope with being passed zero, which was happening for the
E820 table allocation from EDK2.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agovirtio-pci: Use %pP format in dprintf() calls
Kevin O'Connor [Thu, 23 May 2019 15:36:51 +0000 (11:36 -0400)]
virtio-pci: Use %pP format in dprintf() calls

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
5 years agopciinit: Use %pP shorthand for printing device ids in intel_igd_setup()
Kevin O'Connor [Thu, 23 May 2019 15:27:09 +0000 (11:27 -0400)]
pciinit: Use %pP shorthand for printing device ids in intel_igd_setup()

The hardcoded device names can cause false-positives on Windows bios
version checks.  Use the %pP format to avoid that.

Reported-by: Sam Eiderman <shmuel.eiderman@oracle.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
5 years agooptionrom: disallow int19 redirect for pnp roms.
Gerd Hoffmann [Tue, 20 Nov 2018 07:06:55 +0000 (08:06 +0100)]
optionrom: disallow int19 redirect for pnp roms.

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>
5 years agobootmenu: add support for more than 9 entries
Gerd Hoffmann [Thu, 11 Apr 2019 19:46:33 +0000 (21:46 +0200)]
bootmenu: add support for more than 9 entries

10th and following entries can be selected using letters.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoadd get_keystroke_full() helper
Gerd Hoffmann [Wed, 15 May 2019 07:53:25 +0000 (09:53 +0200)]
add get_keystroke_full() helper

Switch get_raw_keystroke() to return ax instead of ah, so it returns
both scan code and ascii code of the key pressed.

Add get_keystroke_full() function which passes up ax to the caller.

The get_keystroke() function continues to return the scancode only like
it did before.  It is a thin wrapper around get_keystroke_full() now
though.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agobochsdisplay: parse resolution from edid.
Gerd Hoffmann [Tue, 19 Mar 2019 11:20:52 +0000 (12:20 +0100)]
bochsdisplay: parse resolution from edid.

Then use the resolution for the framebuffer.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agobochsdisplay: add edid support.
Gerd Hoffmann [Tue, 19 Mar 2019 10:48:04 +0000 (11:48 +0100)]
bochsdisplay: add edid support.

Read EDID blob from mmio bar, store in VBE_edid.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agobochsvga: add edid support.
Gerd Hoffmann [Tue, 19 Mar 2019 10:48:13 +0000 (11:48 +0100)]
bochsvga: add edid support.

Read EDID blob from mmio bar, store in VBE_edid.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agoati: add edid support.
Gerd Hoffmann [Mon, 18 Mar 2019 14:43:53 +0000 (15:43 +0100)]
ati: add edid support.

Read EDID blob via i2c, store in VBE_edid.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5 years agovbe: add edid support.
Gerd Hoffmann [Tue, 19 Mar 2019 10:09:33 +0000 (11:09 +0100)]
vbe: add edid support.

VBE subfunction 0x15, read ddc data.

Add VBE_edid where drivers can fill in a EDID data blob.
If we find valid data there (checking the first two header
bytes), then report the function as supported and hand out
the data.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agosmbios: Add missing zero byte to Type 0
Sam Eiderman [Wed, 24 Apr 2019 14:04:09 +0000 (17:04 +0300)]
smbios: Add missing zero byte to Type 0

According to SMBIOS Specification, section 6.1.3 Text Strings:
"Text strings associated with a given SMBIOS structure are returned in
the dmiStructBuffer, appended directly after the formatted portion of the
structure. This method of returning string information eliminates the
need for application software to deal with pointers embedded in the
SMBIOS structure. Each string is terminated with a null (00h) BYTE and
the set of strings is terminated with an additional null (00h) BYTE”

Furthermore:
"If the formatted portion of the structure contains string-reference
fields and all the string fields are set to 0 (no string references),
the formatted section of the structure is followed by two null (00h)
BYTES"

From the above it can be seen that any SMBIOS type which contains string
references should end with an additional zero byte.

This is currently handled in all SMBIOS types which use
load_str_field_with_default() besides type0.
Therefore, add the missing zero byte to SMBIOS Type 0.

Running QEMU with:
    -machine pc-i440fx-2.0 (for legacy smbios)
    -smbios type=0,vendor=,version=,date= (for zero str_index)
Will cause SMBIOS type0 entry to overrun type1 entry.

Reviewed-by: Mark Kanda <mark.kanda@oracle.com>
Reviewed-by: Ross Philipson <ross.philipson@oracle.com>
Reviewed-By: Liran Alon <liran.alon@oracle.com>
Signed-off-by: Sam Eiderman <shmuel.eiderman@oracle.com>
6 years agovga: add ati bios tables
Gerd Hoffmann [Fri, 8 Mar 2019 10:42:25 +0000 (11:42 +0100)]
vga: add ati bios tables

Needed to make drivers happy which try to gather
informations from these tables.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agovga: add atiext driver
Gerd Hoffmann [Mon, 25 Feb 2019 09:51:37 +0000 (10:51 +0100)]
vga: add atiext driver

Supports qemu emulated ati cards.  They have been added in qemu 4.0.
Acceleration support (in qemu) is pretty rough still.  A simple
framebuffer works fine though.

Available models:
 * ati rage 128 pro
 * ati rv100

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agovga: make memcpy_high() public
Gerd Hoffmann [Fri, 8 Mar 2019 11:34:38 +0000 (12:34 +0100)]
vga: make memcpy_high() public

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agovga: move modelist from bochsvga.c to new svgamodes.c
Gerd Hoffmann [Fri, 8 Mar 2019 10:10:59 +0000 (11:10 +0100)]
vga: move modelist from bochsvga.c to new svgamodes.c

So other drivers can simply use the same list too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
6 years agotcgbios: Implement TPM 2.0 menu item to activate and deactivate PCR banks
Stefan Berger [Wed, 30 Jan 2019 19:06:07 +0000 (14:06 -0500)]
tcgbios: Implement TPM 2.0 menu item to activate and deactivate PCR banks

Implement a TPM 2.0 menu item that allows a user to toggle the activation
of PCR banks of the TPM 2.0. After successful activation we shut down the
TPM 2.0 and reset the machine.

Background:

A TPM 2.0 may have multiple PCR banks, such as for SHA1, SHA256, SHA384,
SHA512, and SM3-256. One or multiple of those banks may be active (by
factory for example) and modifying the set of active PCR banks is only
possible while in the firmware since it requires platform authorization.
Platform authorization is not possible for a user when in the OS since
the firmware generates a random password for the platform authorization
before booting the system and it throws that password away.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
6 years agotcgbios: Use table to convert hash to buffer size
Stefan Berger [Wed, 30 Jan 2019 19:06:06 +0000 (14:06 -0500)]
tcgbios: Use table to convert hash to buffer size

Use a table to convert the hash to the buffer size it needs.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
6 years agousb-ehci: Clear pipe token on pipe reallocate
Kevin O'Connor [Tue, 5 Feb 2019 02:22:15 +0000 (21:22 -0500)]
usb-ehci: Clear pipe token on pipe reallocate

Make sure to clear the token before reuse as it may otherwise have an
incorrect toggle setting.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
6 years agobootsplash: Added support for 16/24/32bpp in one function
Joseph Pacheco-Corwin [Tue, 29 Jan 2019 23:00:00 +0000 (23:00 +0000)]
bootsplash: Added support for 16/24/32bpp in one function

Specifically added support for 16 and 32bpp files, in addition to
24bpp.  The function bmp_show() in bmp.c has had the hardcoded check
for 24bpp replaced with a general bpp check that uses a % to check for
remainder, and returns 1 if the remainder is >0.  The previous method
for adjusting the BMP data (raw_data_format_adjust_24bpp) relied on a
preset 3*bytes_per_line_src, this has been changed and the
multiplication is now performed in the function's arguments. This
change still allows someone else to reuse the same function for
1/2/4bpp support if necessary. The file util.h has been modified to
reflect this decision.

The changes to raw_data_format_adjust() is based on an abandoned patch
by Gert Menke (submitted March 14, 2017), credit to them for that
change and the addition of *bpp to bmp_get_info().

Signed-off-by: Joseph S. Pacheco-Corwin <hammersamatom@gmail.com>
6 years agodocs: Fix cut-and-paste error in Mailinglist.md archive link
Kevin O'Connor [Mon, 21 Jan 2019 18:17:11 +0000 (13:17 -0500)]
docs: Fix cut-and-paste error in Mailinglist.md archive link

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
6 years agodocs: Update mailing list archive links
Kevin O'Connor [Sun, 20 Jan 2019 16:55:10 +0000 (11:55 -0500)]
docs: Update mailing list archive links

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
6 years agooutput: Avoid thunking to 16bit mode in printf() if no vgabios
Kevin O'Connor [Mon, 17 Dec 2018 15:23:49 +0000 (10:23 -0500)]
output: Avoid thunking to 16bit mode in printf() if no vgabios

It is not necessary to call the vgabios if no vgabios has been
installed.  This reduces the amount of hardware accesses on qemu when
the bios is not initializing the display hardware, and it can reduce
the boot time by a couple of milliseconds.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
6 years agoqemu: avoid debug prints if debugcon is not enabled
Stefano Garzarella [Sun, 2 Dec 2018 13:10:13 +0000 (14:10 +0100)]
qemu: avoid debug prints if debugcon is not enabled

In order to speed up the boot phase, we can check the QEMU
debugcon device, and disable the writes if it is not recognized.

This patch allow us to save around 10 msec (time measured
between SeaBIOS entry point and "linuxboot" entry point)
when CONFIG_DEBUG_LEVEL=1 and debugcon is not enabled.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
6 years agopvscsi: ring_desc do not have to be page aligned
Liran Alon [Tue, 13 Nov 2018 15:53:40 +0000 (17:53 +0200)]
pvscsi: ring_desc do not have to be page aligned

In contrast to other allocations made by pvscsi_init_rings(),
ring_desc is only used internally by SeaBIOS (not passed to
device-controller) and there is not restriction which force
it to be page aligned.

Reviewed-by: Mark Kanda <mark.kanda@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
6 years agotpm: Check for TPM related ACPI tables before attempting hw probe
Stephen Douthit [Wed, 7 Mar 2018 18:17:36 +0000 (13:17 -0500)]
tpm: Check for TPM related ACPI tables before attempting hw probe

Signed-off-by: Stephen Douthit <stephend@silicom-usa.com>
6 years agodocs: Note v1.12.0 release rel-1.12.0
Kevin O'Connor [Sat, 17 Nov 2018 16:05:59 +0000 (11:05 -0500)]
docs: Note v1.12.0 release

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
6 years agoshadow: Rework bios copy code to prevent gcc array-bounds warning
Kevin O'Connor [Sat, 10 Nov 2018 18:47:56 +0000 (13:47 -0500)]
shadow: Rework bios copy code to prevent gcc array-bounds warning

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
6 years agopvscsi: Scan all 64 possible targets
Shmuel Eiderman [Thu, 1 Nov 2018 15:14:42 +0000 (17:14 +0200)]
pvscsi: Scan all 64 possible targets

The max number of targets per PVSCSI controller is 64, not 7.
This can easily be seen in QEMU PVSCSI emulation code
(hw/scsi/vmw_pvscsi.c) as PVSCSI_MAX_DEVS, which defines the
number of targets, have value of 64.

Fixes: 83d60b3c474b ("Add pvscsi boot support")
Reviewed-by: Liran Alon <liran.alon@oracle.com>
Reviewed-by: Mark Kanda <mark.kanda@oracle.com>
Signed-off-by: Shmuel Eiderman <shmuel.eiderman@oracle.com>