Commit Graph

267 Commits

Author SHA1 Message Date
Gerd Hoffmann be7e899350 disable array bounds warning
The segmented pointer casting magic confuses gcc, recent versions
throw array bound warnings.  Disable the warning.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2023-05-05 09:05:53 +02:00
Stefan Berger 4e57a54703 Add implementations for sha256, sha384, and sha512
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-06-30 16:58:48 -04:00
Kevin O'Connor 699a4e5d69 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 <kevin@koconnor.net>
2020-07-24 11:01:47 -04:00
Gerd Hoffmann b8eda13195 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>
2020-05-18 09:42:57 +02:00
Gerd Hoffmann 654ba383b6 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>
2020-05-15 13:55:29 +02:00
Gerd Hoffmann 69f65a4e89 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>
2020-05-15 13:34:29 +02:00
Christian Ehrhardt 8d25ca41c5 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>
2020-05-14 21:44:13 -04:00
Kevin O'Connor 43f5df79da 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>
2019-08-23 19:17:26 -04:00
Gerd Hoffmann 34b6ecc160 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>
2019-03-15 09:59:21 +01:00
Gerd Hoffmann 004f5b3ae5 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>
2019-03-14 13:07:17 +01:00
Gerd Hoffmann d9a8b867a3 qemu: add qemu ramfb support
Add support for qemu ramfb.  This is a simple boot framebuffer device,
with normal ram being used to back the framebuffer and fw_cfg being used
to configure the device.

Use case (on x86): boot display for vgpu devices (which neither emulate
vga nor have a vgabios).

Sharing fw_cfg code with seabios turned out to be difficuilt due to
various dependencies the code has on infrastructure which only seabios
has.  So include a copy of the code here, with those dependencies
removed and also stripped down because we don't need a non-dma fallback
here.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-06-22 07:44:07 +02:00
Gerd Hoffmann 77404b450d qemu: add bochs-display support
Use coreboot text mode emulation to also support the qemu bochs-display
device.  This is a new display device supporting simple linear
framebuffers, using the bochs register interface.  No support for legacy
vga (text modes, planar modes, cga modes, 8bpp palette modes all
dropped).  The bochs interface is compatible with the qemu stdvga.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2018-06-22 07:44:07 +02:00
Gerd Hoffmann d6728f301d add serial console support
Redirect int10 calls to serial console output.
Parse serial input and queue key events.
The serial console can work both as primary display
and in parallel to another vga display (splitmode).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-09-22 11:13:22 -04:00
Gerd Hoffmann 44270bc1d2 std: add cp437 to unicode map
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-09-22 11:13:22 -04:00
Julian Stecklina c83e15b60b block: add NVMe boot support
This patch enables SeaBIOS to boot from NVMe. Finding namespaces and
basic I/O works. Testing has been done in qemu and so far it works with
Grub, syslinux, and the FreeBSD loader. You need a recent Qemu (>=
2.7.0), because older versions have buggy NVMe support.

The NVMe code is currently only enabled on Qemu due to lack of testing
on real hardware.

Signed-off-by: Julian Stecklina <jsteckli@amazon.de>
2017-02-20 10:47:53 -05:00
Kevin O'Connor 99e3316d59 build: Add -fno-pie to the gcc flags when available
Reported-by: Paul Menzel <paulepanter@users.sourceforge.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-10-26 10:11:46 -04:00
Kevin O'Connor 75411cec11 build: Be sure to also include out/*.d in Makefile
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-10-21 12:05:23 -04:00
Kevin O'Connor 27129d003f swcursor: Move swcursor code from vgafb.c to new file swcursor.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-08-04 16:27:03 -04:00
Don Slutz f2645a8cd6 Support for booting from LSI Logic LSI53C1030, SAS1068, SAS1068e
Also known as Fusion MPT disk; this controller model is supported
by VirtualBox and VMware, and QEMU support patches have been
posted.

Signed-off-by: Don Slutz <Don.Slutz@Gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-03-29 09:16:48 -04:00
Kevin O'Connor 4d8510cdcc pci: Split low-level pci code from higher-level 'struct pci_device' code
Split pci.c into pci.c and pcidevice.c.  The low-level code that
interacts directly with the PCI devices remains in pci.c, while
functions dealing with the higher level pci_device cache move to
pcidevice.c.  Only pci.c is needed in 16bit mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-02-03 10:38:42 -05:00
Kevin O'Connor 4373afaef3 acpi: Don't build SSDT files on every build; store them in git
The SSDT files are rarely modified - recent QEMU versions don't use
them at all and adding features to them in SeaBIOS has been
deprecated.  It no longer makes sense to generate them on every build.
The content will remain (for use on old machine types in QEMU) in
static files committed to the SeaBIOS git repo.  If the contents do
need to be generated a new build target (make iasl) is available.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-11-19 08:48:34 -05:00
Kevin O'Connor b0d3cc3666 acpi_extract: Don't generate unused (and empty) q35-acpi-dsdt.hex file
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-11-19 08:48:34 -05:00
Kevin O'Connor efd70a5006 build: Report gcc and binutils versions in debug log
Attempt to extract the gcc and binutils versions.  Report that
information in the debug log.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-15 10:55:10 -04:00
Kevin O'Connor a6c877401b build: Rework version generation; don't allow make version override
Convert the script to generate the build version from a shell script
to a python script.

Remove the ability to override the version at build time via "make
VERSION=xyz".  Replace it with ability to add extra version
information at build time via "make EXTRAVERSION=xyz".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-15 10:55:03 -04:00
Kevin O'Connor c167e54533 e820: Rename memmap.c to e820map.c and use consistent "e820_" prefix
Rename memmap.c to e820map.c as the code in that file only deals with
maintaining the e820 map.  Move all the e820 definitions to new file
e820map.h and use a consistent "e820_" prefix on all exported
functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-10-15 10:52:13 -04:00
Magnus Granberg e4d2b8ce5d build: use -fstack-check=no when available
Some compilers (such as the one in hardened/Gentoo) default this
option to on which leads to build failures:
src/stacks.c: In function 'call16_back':
src/stacks.c:139:5: error: 'asm' operand has impossible constraints
     asm volatile(
     ^

URL: https://bugs.gentoo.org/559980
Reported-by: Alon Bar-Lev <alonbl@gentoo.org>
Signed-off-by: Magnus Granberg <zorry@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2015-09-13 09:57:24 -04:00
Gerd Hoffmann 1d9e87b937 virtio: run drivers in 32bit mode
virtio version 1.0 registers can (and actually do in the qemu
implementation) live in mmio space.  So we must run the blk and
scsi virtio drivers in 32bit mode, otherwise we can't access them.

This also allows to drop a bunch of GET_LOWFLAT calls from the virtio
code in the following patches.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-07-01 09:37:28 +02:00
Kevin O'Connor 624e812764 build: Support "make VERSION=xyz" to override the default build version
Add a build option to explicitly set the version information compiled
into the seabios and seavgabios binaries.  This may assist in
reproducible builds or to better link builds to distribution packages.
If the new "VERSION=" parameter is not provided then the default build
version remains unchanged.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-06-03 19:22:38 -04:00
Vladimir Serbinenko 1b911d7aed Add multiboot support.
I've been successfully using SeaBIOS as secondary bootloader. In more details
I have GRUB2-as-payload in flash together with coreboot. SeaBIOS binary is on
the HDD and loaded by GRUB when needed. This has an unfortunate consequence
that I have to keep vga oprom in flash even if usually I boot without it. This
patches makes bios.bin.elf multiboot executable with files passed as modules.
Example:

menuentry "SeaBIOS (mb)" --unrestricted {
   root=ahci0,2
   multiboot /bios.bin.elf
   module /vgabios_x230.rom name=pci8086,0166.rom
}

the parameter name= specifies under which name SeaBIOS will see it.

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-06-01 12:11:36 -04:00
Stefan Berger 5aa2a75463 Support for BIOS interrupt handler
This patch implements the TCG BIOS interrupt handler 1ah. It is for
example used by trusted grub.

This patch adds an implementation of SHA1 (following NIST specs., IETF RFC 3147
and Wikipedia) for speeding up measurements of code. Trusted Grub for example
makes use of this interface and measures (calculates SHA1) of the Linux kernel
and initrd. Those files can be rather large and hunting their bytes through
the TIS interface as part of the int handler commands invoked by trusted grub
does take quite some time due to the many vmexits the interface is creating
(one per byte).

There is also a threshold for the size of data to hash (100k) below which
the TPM is used and above the internal faster SHA1 algorithm is used.

This patch for example enables trusted grub to interact with the TPM
and take additional measurements.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-05-21 13:16:06 -04:00
Stefan Berger b310dfa599 Implementation of the TCG BIOS extensions
This patch implements the main part of the TCG BIOS extensions. It provides
the following functionality:

- initialization of the TCPA ACPI table used for logging of measurements
- initialization of the TPM by sending a sequence of commands to it
- proper setup of the TPM before the BIOS hands over control to the bootloader
- support for S3 resume; BIOS sends TPM_Startup(ST_STATE) to TPM
- enable configuration of SeaBIOS to be built with TCGBIOS extensions
  All TCG BIOS extensions are activated with CONFIG_TCGBIOS.

Structures that are needed in subsequent patches are also included in
tcgbios.h at this point.

The effect of this patch is that it initialized the TPM upon VM start
and S3 resume.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-05-21 13:15:56 -04:00
Vladimir Serbinenko 3752bf44be Link rom.o with -N option.
This option tells linker not to align sections in a way optimied for OS.

ls -lh out/bios.bin.elf
-rwxr-xr-x 1 phcoder phcoder 90K Mai 19 20:38 out/bios.bin.elf

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
2015-05-21 11:31:59 -04:00
Kevin O'Connor 799b20b0db vgabios: Add config option for assembler fixups
Add a kconfig build option (CONFIG_VGA_FIXUP_ASM) to allow users to
build the vgabios without the complex assembler fixups that work
around emulator bugs.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2015-04-10 00:38:17 -04:00
Kevin O'Connor 72691a5299 sdcard: Initial support for SD cards on PCI SDHCI controllers on QEMU
This adds basic read/write support for SD cards emulated by QEMU.
This code is not expected to work on real hardware, because the
current controller and card initialization is not robust.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-12-29 09:17:06 -05:00
Gerd Hoffmann e5f43384be build: set LC_ALL=C
Avoids tools such as layoutrom stumble over localized messages.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-By: Patrick Georgi <pgeorgi@google.com>
2014-12-03 15:15:02 +01:00
Kevin O'Connor ab482e0d6c build: Get fixed address variables from 32bit compile pass (not 16bit)
Update the layoutrom.py build script so that fixed address sections
can come from the 32bit compiled C code.  Update the C code so that
all VAR16FIXED variables instead use the new VARFSEGFIXED which is
defined in 32bit mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-06-11 16:22:51 -04:00
Kevin O'Connor e574997809 build: Keep segmented sections separate until final link step.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-06-11 14:55:57 -04:00
David Woodhouse 04b531ab15 build: use -m16 where available instead of asm(".code16gcc")
GCC 4.9 and clang 3.5 support the -m16 option on the command line which
supersedes the hackish ".code16gcc" assembler directive. Use it where
possible.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2014-06-05 10:58:29 -04:00
Kevin O'Connor ec44fac1f6 build: Avoid absolute paths during "whole-program" compiling.
The build currently does a textual include of all files in order to
use the -fwhole-compile optimization.  Update it to use relative file
paths instead of absolute file paths.  This makes the section names in
the resulting binary more readable.  It also makes the build easier on
some Windows hosts.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-06-05 10:58:29 -04:00
Kevin O'Connor 0673b78700 smp: Replace QEMU SMP init assembler code with C; run only in 32bit mode.
Change the multi-processor init code to trampoline into 32bit mode on
each of the additional processors.  Implement an atomic lock so that
each processor performs its initialization serially.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-06-04 11:06:58 -04:00
Kevin O'Connor 9d0d08c8de build: Make sure romlayout.o is recompiled on Kconfig change.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-05-08 18:44:35 -04:00
Roger Pau Monne 6ad7b5b977 ld: don't hardcode "-melf_i386"
On FreeBSD, the name of the emulation is "-melf_i386_fbsd", so allow
SeaBIOS to fetch the emulation to use from the environment variables.

This allows SeaBIOS to compile on FreeBSD with gcc.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
2014-05-08 18:44:35 -04:00
Kevin O'Connor 7c79029e43 vgabios: Initial support for coreboot native vga vgabios.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-04-11 11:26:23 -04:00
Kevin O'Connor de30dadb55 xhci: Run the XHCI driver entirely in 32bit mode.
Since the XHCI driver needs to jump into 32bit mode anyway, it is
simpler to just run all of the code in 32bit mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2014-01-29 12:57:01 -05:00
Sander Eikelenboom 2a5338540f Prevent build failure by not splitting line in the middle of arguments to checkrom.py script
File "./scripts/checkrom.py", line 24, in main
    objinfo, finalsize, rawfile, outfile = sys.argv[1:]
ValueError: need more than 3 values to unpack

Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
2014-01-10 13:07:52 -05:00
Kevin O'Connor 4b400a127a pvscsi: Always run entirely in 32bit mode.
Instead of jumping into 32bit mode to access the PCI config space, run
the entire driver in 32bit mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-27 12:41:12 -05:00
Kevin O'Connor 95b3d3286f build: Don't trash the .config file when src/Kconfig changes.
Revision 5325e91e introduced a change to force the rebuild of the
.config file when the src/Kconfig (or vgasrc/Kconfig) file changes.
However, this was causing a complete rebuild of the user's .config
file which would throw away the user's current settings.

On a rebuild, use the kbuild olddefconfig rule instead of defconfig to
attempt to keep the user's current settings.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-23 13:44:59 -05:00
Gerd Hoffmann 31b8b4eea9 add hw/serialio.c to SRC32SEG
Fixes build failure for CONFIG_COREBOOT=y.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-12-05 13:31:04 +01:00
Kevin O'Connor dab0a7407c vgabios: Move initialization code to new file vgainit.c.
Move the initialization code out of vgabios.c to a new file to reduce
the size of the vgabios.c file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-04 10:34:18 -05:00
Kevin O'Connor 4a8b58cb6c vgabios: Support allocating an extra stack for vgabios calls and default on.
Add code to allocate an extra stack for the main vgabios int 0x10
entry point.  The allocation is done via the PMM spec and uses a PCI
v3 permanent low memory region request.  This request will work with
SeaBIOS - it is unknown how many other main BIOS implementations
support this PMM call.

The extra stack is useful for old DOS programs that call the VGABIOS
and expect it to work with very small amounts of stack space.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2013-12-04 10:34:18 -05:00