aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* usb.c: Fix devices using non-primary interface descriptorMatt DeVillier2020-09-251-8/+19
| | | | | | | | | | | | | 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 <matt.devillier@puri.sm>
* smbios: avoid integer overflow when adding SMBIOS type 0 tableDaniel P. Berrangé2020-09-081-4/+10
| | | | | | | | | 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é <berrange@redhat.com>
* docs: Note v1.14.0 releaseKevin O'Connor2020-08-101-0/+13
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* nvme: Increase `nvme_cmd_readwrite()` message log level from 3 to 5Paul Menzel2020-07-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | 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 buffer. So, increase the debug level to 5, so possible console buffer do not overflow. Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
* virtio-scsi: fix boot prio detection by using correct lunStefan Reiter2020-07-281-3/+3
| | | | | | | | | | | | | | Commits 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 <pmenzel@molgen.mpg.de> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
* ldnoexec: Add script to remove ET_EXEC flag from intermediate build objectsKevin O'Connor2020-07-242-4/+37
| | | | | | | | 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 <kevin@koconnor.net>
* vgabios: Fix preserve memory flag in handle_1000Kevin O'Connor2020-07-131-4/+3
| | | | | | | | | Commit 5108c69c made a change to the ordering of some code which broke the check for the MF_NOCLEARMEM flag. Reported by felix.von.s@posteo.de Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* timer: Handle decrements of PIT counterRoman Bolshakov2020-06-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | 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. 1. https://bugs.launchpad.net/seabios/+bug/1840719 2. https://lists.gnu.org/archive/html/qemu-devel/2019-08/msg03924.html Fixes: eac11944019 ("Unify pmtimer_read() and pittimer_read() code.") Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
* vga: fix cirrus biosGerd Hoffmann2020-06-251-1/+1
| | | | | | | | | 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 <kraxel@redhat.com>
* serialio: Preserve Xen DebugOutputPortJason Andryuk2020-06-241-0/+4
| | | | | | | | | | | | 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 output. Quick exit the function when running on Xen to preserve the modified DebugOutputPort. Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
* pci: fix mmconfig supportGerd Hoffmann2020-05-251-6/+6
| | | | | | | | | | | | | | 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 <kraxel@redhat.com>
* boot: Fixup check for only one item in boot listKevin O'Connor2020-05-241-8/+9
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* boot: Fix logic for boot menu displayMatt DeVillier2020-05-241-1/+1
| | | | | | | | | | | 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 <matt.devillier@gmail.com>
* Revert "ps2port: adjust init routine to fix PS/2 keyboard issues"Kevin O'Connor2020-05-211-13/+5
| | | | | | | | | 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 <kevin@koconnor.net>
* cdrom: Demote `scsi_is_ready` return print to debug levelPaul Menzel2020-05-211-1/+1
| | | | | | | | | | | | | 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>
* boot: Log, if boot menu is skippedPaul Menzel2020-05-211-0/+1
| | | | Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
* boot: Extend `etc/show-boot-menu` to configure skipping boot menu with only ↵Paul Menzel2020-05-212-3/+4
| | | | | | | | | | | | 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>
* rewrap Makefile lines.Gerd Hoffmann2020-05-181-15/+17
| | | | | | | 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>
* acpi: find and register virtio-mmio devicesGerd Hoffmann2020-05-153-0/+23
| | | | | | | Seach for virtio-mmio devices in the DSDT table, register the devices found. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* acpi: skip kbd init if not presentGerd Hoffmann2020-05-151-0/+4
| | | | | | | 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>
* acpi: add dsdt parserGerd Hoffmann2020-05-156-3/+691
| | | | | | | | 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>
* acpi: add xsdt supportGerd Hoffmann2020-05-152-10/+41
| | | | | | | In case a xsdt table is present (and located below 4G) prefer it over rsdt. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio-mmio: print device typeGerd Hoffmann2020-05-151-2/+19
|
* virtio-mmio: add support for block devices.Gerd Hoffmann2020-05-155-1/+84
| | | | | | | | | | 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>
* virtio-mmio: add support for scsi devices.Gerd Hoffmann2020-05-155-12/+76
| | | | | | | | | | | | | | | 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>
* virtio-mmio: add support to vp_*() functionsGerd Hoffmann2020-05-151-11/+57
| | | | | | | | | 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>
* virtio-mmio: device probing and initialization.Gerd Hoffmann2020-05-154-1/+136
| | | | | | | | | 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>
* qemu: check rtc presence before reading cpu count from cmosGerd Hoffmann2020-05-151-3/+10
| | | | | | | | | 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>
* qemu: rework e820 detectionGerd Hoffmann2020-05-151-51/+82
| | | | | | | | | 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>
* qemu: factor out qemu_cfg_detect()Gerd Hoffmann2020-05-151-4/+14
| | | | | | | Move qemu fw_cfg detection to separate function. No functional change. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* build: use -fcf-protection=none when availableChristian Ehrhardt2020-05-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* tcgbios: Add support for SHA3 type of algorithmsStefan Berger2020-04-192-3/+28
| | | | | | | | 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>
* tcgbios: Fix the vendorInfoSize to be of type u8Stefan Berger2020-04-191-2/+2
| | | | | | | 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>
* tcgbios: Only write logs for PCRs that are in active PCR banksStefan Berger2020-04-191-8/+22
| | | | | | | | | 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>
* pci: add mmconfig supportGerd Hoffmann2020-03-273-12/+54
| | | | | | | | | | 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
* pci: factor out ioconfig_cmd()Gerd Hoffmann2020-03-271-6/+11
| | | | | | | 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
* std/tcg: Replace zero-length array with flexible-array memberPaul Menzel2020-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* ps2port: adjust init routine to fix PS/2 keyboard issuesMatt DeVillier2020-03-171-5/+13
| | | | | | | | | | | 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>
* Skip boot menu and timeout with only one boot deviceMatt DeVillier2020-03-171-0/+6
| | | | | | | 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>
* sercon: vbe modeset is int 10h function 4f02 not 4f00Gerd Hoffmann2020-03-171-1/+1
| | | | | | | | | 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>
* kvm: add support for reading tsc frequency from kvmclockGerd Hoffmann2020-03-162-0/+56
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20200310102248.28412-4-kraxel@redhat.com
* kvm: add support for reading tsc frequency via cpuid.Gerd Hoffmann2020-03-161-0/+5
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20200310102248.28412-3-kraxel@redhat.com
* kvm: detect unconditionallyGerd Hoffmann2020-03-161-7/+1
| | | | | | | | 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
* timer: add tsctimer_setfreq()Gerd Hoffmann2020-03-162-1/+26
| | | | | | | | | | 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
* hw/usb-hid: Don't abort if setting key repeat rate failsMatt DeVillier2020-03-061-1/+1
| | | | | | | | | | | 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>
* usb-hid: Improve max packet size checkingKevin O'Connor2020-03-061-22/+33
| | | | | | | | | 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>
* nvme: skip initializing non-bootable devicesGerd Hoffmann2020-01-141-0/+7
| | | | | | | Check NVMe devices whenever they are bootable, skip initialization in case they are not. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* virtio-scsi: skip initializing non-bootable devicesGerd Hoffmann2020-01-141-1/+10
| | | | | | | 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>
* boot: cache HALT priorityGerd Hoffmann2020-01-141-1/+5
| | | | | | | 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>
* virtio: Do not init non-bootable devicesAlexey Kirillov2020-01-142-2/+20
| | | | | | | | | | | 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>