]> xenbits.xensource.com Git - seabios.git/log
seabios.git
9 years agovirtio: make features 64bit, support version 1.0 features
Gerd Hoffmann [Thu, 25 Jun 2015 10:28:46 +0000 (12:28 +0200)]
virtio: make features 64bit, support version 1.0 features

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: add read/write functions and macros
Gerd Hoffmann [Thu, 25 Jun 2015 10:24:59 +0000 (12:24 +0200)]
virtio: add read/write functions and macros

Add macros to read/write virtio registers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: create vp_cap struct for legacy bar
Gerd Hoffmann [Tue, 30 Jun 2015 06:50:09 +0000 (08:50 +0200)]
virtio: create vp_cap struct for legacy bar

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: find version 1.0 virtio capabilities
Gerd Hoffmann [Thu, 25 Jun 2015 14:14:21 +0000 (16:14 +0200)]
virtio: find version 1.0 virtio capabilities

virtio 1.0 specifies the location of the various virtio regions
using pci capabilities.  Look them up and store the results.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: add version 0.9.5 struct
Gerd Hoffmann [Tue, 30 Jun 2015 06:42:50 +0000 (08:42 +0200)]
virtio: add version 0.9.5 struct

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: add version 1.0 structs and #defines
Gerd Hoffmann [Thu, 25 Jun 2015 14:13:51 +0000 (16:13 +0200)]
virtio: add version 1.0 structs and #defines

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: pass struct pci_device to vp_init_simple
Gerd Hoffmann [Thu, 25 Jun 2015 08:24:27 +0000 (10:24 +0200)]
virtio: pass struct pci_device to vp_init_simple

... instead of the bdf only.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: add struct vp_device
Gerd Hoffmann [Thu, 25 Jun 2015 07:36:16 +0000 (09:36 +0200)]
virtio: add struct vp_device

For virtio 1.0 support we will need more state than just the (legacy
mode) ioaddr for each virtio-pci device.  Prepare for that by adding
a new struct for it.  For now it carries the ioaddr only.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: run drivers in 32bit mode
Gerd Hoffmann [Fri, 26 Jun 2015 07:44:00 +0000 (09:44 +0200)]
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>
9 years agopci: allow to loop over capabilities
Gerd Hoffmann [Thu, 25 Jun 2015 08:49:10 +0000 (10:49 +0200)]
pci: allow to loop over capabilities

Add a parameter to pci_find_capability, to specify the start point.
This allows to find multiple capabilities of the same type, by calling
pci_find_capability again with the offset of the last capability found.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agobuild: CONFIG_VGA_FIXUP_ASM should depend on CONFIG_BUILD_VGABIOS
Kevin O'Connor [Wed, 10 Jun 2015 14:44:32 +0000 (10:44 -0400)]
build: CONFIG_VGA_FIXUP_ASM should depend on CONFIG_BUILD_VGABIOS

Add the dependency to CONFIG_VGA_FIXUP_ASM so the menu option only
appears when appropriate.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agotcg: Use seabios setup()/prepboot() calling convention for tcg
Kevin O'Connor [Wed, 10 Jun 2015 15:00:17 +0000 (11:00 -0400)]
tcg: Use seabios setup()/prepboot() calling convention for tcg

Rename tcg externally called functions to more closely match other
subsystems.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotpm: Move call to tpm_option_rom into init_optionrom
Stefan Berger [Tue, 9 Jun 2015 23:56:33 +0000 (19:56 -0400)]
tpm: Move call to tpm_option_rom into init_optionrom

Move the call to measure the option ROM 'tpm_option_rom' into
init_optionrom.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotpm: Clean up in tcgbios.h
Stefan Berger [Tue, 9 Jun 2015 23:56:32 +0000 (19:56 -0400)]
tpm: Clean up in tcgbios.h

Remove some unused #defines and remove comments pointing to
sections in specs.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotpm: clean up parameters to build_and_send_cmd
Stefan Berger [Tue, 9 Jun 2015 23:56:31 +0000 (19:56 -0400)]
tpm: clean up parameters to build_and_send_cmd

Clean up the parameters to the build_and_send_cmd function call.
Use the sizeof() on the preceding buffer parameter. If the buffer
is NULL, we pass 0.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotpm: Be consistent with array sizes in tcgbios.c
Stefan Berger [Tue, 9 Jun 2015 23:56:29 +0000 (19:56 -0400)]
tpm: Be consistent with array sizes in tcgbios.c

Remove the array size from all arrays.

Replace the magic 12 with sizeof(GetCapability_Timeouts),
which represents the maximum number of bytes that need to be
reserved.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agotpm: Introduce a #define for command tag
Stefan Berger [Tue, 9 Jun 2015 23:56:28 +0000 (19:56 -0400)]
tpm: Introduce a #define for command tag

Introduce a #define for the TPM command tag 0x00c1.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agovga: add virtio-vga to kconfig
Gerd Hoffmann [Fri, 10 Apr 2015 08:43:45 +0000 (10:43 +0200)]
vga: add virtio-vga to kconfig

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovga: rework virtio-vga support
Gerd Hoffmann [Wed, 8 Apr 2015 08:36:22 +0000 (10:36 +0200)]
vga: rework virtio-vga support

Unlike planned earlier virtio-vga will be compatible with
the qemu stdvga, with the framebuffer in bar 0.  Drop the
virtio-vga chunk, update comment accordingly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovga: simplify vga builds
Gerd Hoffmann [Wed, 8 Apr 2015 08:49:25 +0000 (10:49 +0200)]
vga: simplify vga builds

Add a kconfig menu to pick the vga variant, stick the vendorr
and device ids as defaults into Kconfig.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agobuild: Support "make VERSION=xyz" to override the default build version
Kevin O'Connor [Wed, 3 Jun 2015 23:17:12 +0000 (19:17 -0400)]
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>
9 years agoDon't forward declare functions with "inline" in headers
Kevin O'Connor [Mon, 1 Jun 2015 22:32:06 +0000 (18:32 -0400)]
Don't forward declare functions with "inline" in headers

Don't mark function definitions in headers with "inline" - it causes
compile warnings on gcc v5.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Acked-by: Paul Menzel <paulepanter@sourceforge.net>
9 years agoAdd 'measurement' code to the BIOS
Stefan Berger [Tue, 26 May 2015 19:48:33 +0000 (15:48 -0400)]
Add 'measurement' code to the BIOS

This patch adds invocations of functions that measure various parts of the
code and data through various parts of the BIOS code. It follows TCG
specifications on what needs to be measured. It also adds the implementation
of the called functions.

Reference for what needs to be measured can be found in specs found here:

http://www.trustedcomputinggroup.org/resources/pc_client_work_group_specific_implementation_specification_for_conventional_bios

The first measurements are done once the ACPI tables have been initialized.

Once booted into Linux, the current measurements produce the following logs
which can be found in /sys/kernel/security/tpm0/ascii_bios_measurements.
The below log also shows measurements from trusted grub.

 1 3fb240d2a04085a4e84f81e4398e070ed5a18163 06 [SMBIOS]
 2 cc812353fc277c1fab99e0b721752a1392984566 06 [Option ROM]
 2 9dbd87163112e5670378abe4510491259a61f411 05 [Start Option ROM Scan]
 2 6f74e357331b8dee11bbad85f27bc66cb873106c 06 [Option ROM]
 2 5626eb7ac05c7231e46d7461e7d3839b03ae9fad 06 [Option ROM]
 4 c1e25c3f6b0dc78d57296aa2870ca6f782ccf80f 05 [Calling INT 19h]
 0 d9be6524a5f5047db5866813acf3277892a7a30a 04 []
 1 d9be6524a5f5047db5866813acf3277892a7a30a 04 []
 2 d9be6524a5f5047db5866813acf3277892a7a30a 04 []
 3 d9be6524a5f5047db5866813acf3277892a7a30a 04 []
 4 d9be6524a5f5047db5866813acf3277892a7a30a 04 []
 5 d9be6524a5f5047db5866813acf3277892a7a30a 04 []
 6 d9be6524a5f5047db5866813acf3277892a7a30a 04 []
 7 d9be6524a5f5047db5866813acf3277892a7a30a 04 []
 4 8cf2fe6c87d4d0b2998a43da630292e6d85ee8b6 05 [Booting BCV device 80h (HDD)]
 4 5dff94459a3e2d13a433ef94afdc306144565bf7 0d [IPL]
 5 d1b33afde65ad47502332af957c60f20c84c1edc 0e [IPL Partition Data]
 4 487ce764b527ccad17f1d04243d0136fa981e6c4 0d [IPL]
 4 91d285e4dead566324c8938a3cc75803f462d9a1 0d [IPL]
 4 8ba79ac98bb491524fef29defc724daaf6263d35 0d [IPL]
 4 c591c15b82e4ff30e7383a4ff1ef3b41b38521ac 06 []
 4 8cdc27ec545eda33fbba1e8b8dae4da5c7206972 04 [Grub Event Separator]
 5 8cdc27ec545eda33fbba1e8b8dae4da5c7206972 04 [Grub Event Separator]
 5 e8673b9e14b02dc12d8ccfd0176bca7a3de7fc3c 0e [IPL Partition Data]
 5 0163e375a0af7525c5dac1a8e74b277359e40d1d 1105 []
 8 4be30f67c3d48ab7f04d9c0fd07f06d4c68379be 1205 []
 8 54c83965978de9708d026016ecb0e70660e04388 1305 []
 5 2431ed60130faeaf3a045f21963f71cacd46a029 04 [OS Event Separator]
 8 2431ed60130faeaf3a045f21963f71cacd46a029 04 [OS Event Separator]
 8 f3973cae05d6e2055062119d6e6e1e077b7df876 1005 []

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoAdd multiboot support.
Vladimir Serbinenko [Mon, 18 May 2015 17:07:16 +0000 (19:07 +0200)]
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>
9 years agomake SeaBios compatible with Xen vTPM.
Quan Xu [Thu, 30 Apr 2015 23:43:04 +0000 (19:43 -0400)]
make SeaBios compatible with Xen vTPM.

Signed-off-by: Quan Xu <quan.xu@intel.com>
9 years agoSupport for BIOS interrupt handler
Stefan Berger [Mon, 23 Mar 2015 18:22:17 +0000 (14:22 -0400)]
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>
9 years agoImplementation of the TCG BIOS extensions
Stefan Berger [Mon, 23 Mar 2015 18:22:16 +0000 (14:22 -0400)]
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>
9 years agoAdd an implementation of a TPM TIS driver
Stefan Berger [Mon, 23 Mar 2015 18:22:15 +0000 (14:22 -0400)]
Add an implementation of a TPM TIS driver

This patch adds an implementation of a TPM TIS driver for the TPM TIS
emulation supported by QEMU. The driver is broken up into several
small functions that have to be called in proper sequence. The driver is
cleanly separated from the rest of the code through an interface holding
pointers to the driver's functions.
A client using this driver first probes whether the TPM TIS
interface is available (probe function) and then invokes the interface
function to initialze the interface and send requests and receive responses.

Possible future extensions *could* include a virtio interface for the TPM
with a corresponding driver here.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
9 years agoLink rom.o with -N option.
Vladimir Serbinenko [Tue, 19 May 2015 16:21:19 +0000 (18:21 +0200)]
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>
9 years agoahci: Ignore max_ports.
Vladimir Serbinenko [Mon, 18 May 2015 13:00:31 +0000 (15:00 +0200)]
ahci: Ignore max_ports.

At least AHCI on Intel on some machines claim to support only 6 ports
while in fact higher port numbers are present and work.
This is needed to access CD-ROM on PackardBell MS2290.
Both GRUB and Linux have a similar workaround.

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
9 years agosmm: ignore bits 16,18-31 of SMM revision ID
Paolo Bonzini [Wed, 6 May 2015 10:38:29 +0000 (12:38 +0200)]
smm: ignore bits 16,18-31 of SMM revision ID

Bits 16-31 of the SMM revision ID are feature bits.  We only need to
check that SMBASE relocation is supported, but do not care about other
features.  In particular, this allows the SMM I/O instruction restart
feature to be present.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agocheckstack: Minor - continue if not a regular asm line
Kevin O'Connor [Fri, 17 Apr 2015 16:33:58 +0000 (12:33 -0400)]
checkstack: Minor - continue if not a regular asm line

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agovgabios: Emulate "leal" instruction
Kevin O'Connor [Thu, 9 Apr 2015 21:20:16 +0000 (17:20 -0400)]
vgabios: Emulate "leal" instruction

Emulate the "leal" instruction so that the vgabios can run on older
versions of x86emu.  (This removes the previous "leal" trap.)

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agovgabios: Add config option for assembler fixups
Kevin O'Connor [Thu, 9 Apr 2015 21:15:23 +0000 (17:15 -0400)]
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>
10 years agovgabios: Don't use "smsww" instruction - it confuses x86emu
Kevin O'Connor [Thu, 9 Apr 2015 16:24:18 +0000 (12:24 -0400)]
vgabios: Don't use "smsww" instruction - it confuses x86emu

Commit 251e2638 introduced the "smsww" instruction to the vgabios.
Unfortunately, it appears at least some versions of x86emu crash when
executing that instruction (eg, FC13 installer crashes).  That
instruction wasn't required to work around the problem fixed in
251e2638, so just avoid it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agosmbios: Use integer signature instead of string signature
Kevin O'Connor [Thu, 9 Apr 2015 15:57:44 +0000 (11:57 -0400)]
smbios: Use integer signature instead of string signature

Change the smbios structure to use a 4 byte u32 signature field
instead of a 4 byte character string field.  In practice, this allows
the compiler to place the signature in the initialize code segment and
thus makes it less likely the signature would be found in the
f-segment.  (If the smbios signature is found in the f-segment it can
confuse some table scans.)

Reviewed-by: Bruce Rogers <brogers@suse.com>
Tested-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agocheckrom: Fix typo in error message
Andreas Färber [Thu, 19 Mar 2015 16:23:19 +0000 (17:23 +0100)]
checkrom: Fix typo in error message

increate -> increase

Signed-off-by: Andreas Färber <afaerber@suse.de>
10 years agocheckstack: Prefer passing "function" class instead of function address
Kevin O'Connor [Thu, 19 Mar 2015 16:43:29 +0000 (12:43 -0400)]
checkstack: Prefer passing "function" class instead of function address

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agocheckstack: Simplify yield calculations
Kevin O'Connor [Thu, 19 Mar 2015 16:10:28 +0000 (12:10 -0400)]
checkstack: Simplify yield calculations

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agocheckstack: Replace function information tuple with class
Kevin O'Connor [Thu, 19 Mar 2015 03:31:43 +0000 (23:31 -0400)]
checkstack: Replace function information tuple with class

Replace the six-tuple storing information on each parsed function with
a class.  This makes the code more readable.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agodocs: Clarify that pci-optionrom-exec doesn't apply to roms in cbfs
Kevin O'Connor [Wed, 18 Mar 2015 16:16:59 +0000 (12:16 -0400)]
docs: Clarify that pci-optionrom-exec doesn't apply to roms in cbfs

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agovgabios: Don't use extra stack if it appears a modern OS is in use
Kevin O'Connor [Tue, 17 Mar 2015 15:37:25 +0000 (11:37 -0400)]
vgabios: Don't use extra stack if it appears a modern OS is in use

If the last mode set (while not in vm86 mode) was done from a VBE mode
set call then disable the extra stack.  This works under the premise
that only a modern OS would invoke the VBE mode changing facilities
and a modern OS would always call the vgabios with sufficient stack
space.

This is an ugly hack to work around a problem Windows Vista (and
possibly later Windows releases) has with the VGA BIOS using a stack
in the e-segment.

Reported-by: Richard Laager <rlaager@wiktel.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agovgabios: On bda_save_restore() the saved vbe_mode also has flags in it
Kevin O'Connor [Tue, 17 Mar 2015 14:52:16 +0000 (10:52 -0400)]
vgabios: On bda_save_restore() the saved vbe_mode also has flags in it

When restoring a saved state, make sure to remove any flags from the
video mode prior to searching for that mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agodocs: Note release date of 1.8.1
Kevin O'Connor [Mon, 16 Mar 2015 14:43:26 +0000 (10:43 -0400)]
docs: Note release date of 1.8.1

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoboot: switch default menu key to ESC
Paolo Bonzini [Thu, 12 Mar 2015 17:12:24 +0000 (18:12 +0100)]
boot: switch default menu key to ESC

On some platforms, F12 may be hard to access; for example, on OS X
machines F9-F12 have been intercepted by the OS for a long time, and
on newer OS X releases function keys are basically gone for good.

Which keys are and are not available depends on the client, not on
the server, but only function keys are usually trapped by terminals.
Hence, using ESC for the boot menu avoids the problems associated
with F12.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoboot.c: delay exiting boot if menu key is ESC
Paolo Bonzini [Thu, 12 Mar 2015 17:12:23 +0000 (18:12 +0100)]
boot.c: delay exiting boot if menu key is ESC

If the menu key is ESC, do not restart boot unless
1.5 seconds have passed.  Otherwise users (trained by years of
repeatedly hitting keys to enter the BIOS) will end up hitting ESC
multiple times and immediately booting the primary boot device.

Suggested-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agosmp: Fix smp race introduced in 0673b787
Kevin O'Connor [Wed, 11 Mar 2015 21:45:47 +0000 (17:45 -0400)]
smp: Fix smp race introduced in 0673b787

In 0673b787 the QEMU SMP init code was changed to run in 32bit mode.
Unfortunately, the transition32 assembler function is not
multi-processor safe, because it modifies the global RTC index
register.  This race condition led to sporadic failures when emulating
machines with a large number of processors.

This patch changes the entry_smp code to use a variant of transition32
that does not touch the RTC registers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agofw/pci: map memory and IO regions for multiple pci root buses
Marcel Apfelbaum [Mon, 16 Feb 2015 17:29:20 +0000 (19:29 +0200)]
fw/pci: map memory and IO regions for multiple pci root buses

For resource sizing and mapping purposes treat devices on extra root
buses as if they are on the default root bus (bus 0).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agofw/pci: scan all buses if extraroots romfile is present
Marcel Apfelbaum [Mon, 16 Feb 2015 17:29:19 +0000 (19:29 +0200)]
fw/pci: scan all buses if extraroots romfile is present

If there are extra primary root buses, scanning the bus's 0
subtree is not enough. Scan all the range.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoAdd an option to only execute option ROMs contained in CBFS
tpearson@raptorengineeringinc.com [Tue, 17 Feb 2015 21:04:17 +0000 (15:04 -0600)]
Add an option to only execute option ROMs contained in CBFS

TEST: Booted ASUS KFSN4-DRE with iPXE ROMs built in to CBFS;
with etc/pci-optionrom-exec set to 0 the on-board network ROMs
were ignored while the iPXE ROMs executed normally.  When set
to 2 or greater all option ROMs executed normally.  Tests of
VGA only were not possible due to a lack of supported hardware.

Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agopci: enable SERR# for error forwarding in bridge control register
Chen Fan [Wed, 28 Jan 2015 08:05:13 +0000 (16:05 +0800)]
pci: enable SERR# for error forwarding in bridge control register

For PCIe device support AER(Advanced Error Reporting), from the
pcie spec 3.0 chapter 6.2.5, ERR_COR, ERR_NONFATAL, and ERR_FATAL
can be forwarded from the secondary interface to the primary interface,
only require the SERR# Enable bit in the Bridge Control register is set.

and at the kernel side, we found only _HPP() method can enable
SERR#, So here we want to turn on this bit.

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agodocs: Prefer triple backticks to multiple lines with single backticks
Kevin O'Connor [Thu, 19 Feb 2015 19:47:39 +0000 (14:47 -0500)]
docs: Prefer triple backticks to multiple lines with single backticks

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agodocs: Add page on available CBFS/fw_cfg runtime config files
Kevin O'Connor [Thu, 19 Feb 2015 19:30:10 +0000 (14:30 -0500)]
docs: Add page on available CBFS/fw_cfg runtime config files

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agodocs: Add page describing the patch contribution process
Kevin O'Connor [Thu, 19 Feb 2015 00:02:56 +0000 (19:02 -0500)]
docs: Add page describing the patch contribution process

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agodocs: add page for SeaVGABIOS
Kevin O'Connor [Wed, 18 Feb 2015 23:20:30 +0000 (18:20 -0500)]
docs: add page for SeaVGABIOS

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agox86: add barrier to read{b,w,l} and write{b,w,l} functions
Ameya Palande [Tue, 17 Feb 2015 22:00:49 +0000 (14:00 -0800)]
x86: add barrier to read{b,w,l} and write{b,w,l} functions

Use barrier() for memory mapped IO functions.

This fixes pvscsi driver to boot on QEMU's pvscsi controller.
Test command:
qemu -m 512 --enable-kvm -device pvscsi,id=pvscsi0
-device scsi-disk,bus=pvscsi0.0,drive=drive0
-drive id=drive0,if=none,file=ubuntu1410.img,if=none
-bios seabios/out/bios.bin

Signed-off-by: Ameya Palande <2ameya@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agodocs: Note v1.8.0 release rel-1.8.0
Kevin O'Connor [Wed, 18 Feb 2015 17:49:59 +0000 (12:49 -0500)]
docs: Note v1.8.0 release

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agodocs: There is only one VAR16 flag now
Kevin O'Connor [Wed, 18 Feb 2015 17:51:18 +0000 (12:51 -0500)]
docs: There is only one VAR16 flag now

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agodocs: Update release history with dates of stable releases
Kevin O'Connor [Wed, 18 Feb 2015 17:19:53 +0000 (12:19 -0500)]
docs: Update release history with dates of stable releases

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agodocs: Document why v1.6.3 release came after v0.6.2
Kevin O'Connor [Wed, 18 Feb 2015 16:59:19 +0000 (11:59 -0500)]
docs: Document why v1.6.3 release came after v0.6.2

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agocheckstack: Handle callw instruction
Kevin O'Connor [Mon, 19 Jan 2015 17:41:33 +0000 (12:41 -0500)]
checkstack: Handle callw instruction

Minor update to the checkstack.py tool.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agousb: Minor - properly free memory on get_device_config() error path
Kevin O'Connor [Thu, 1 Jan 2015 18:47:28 +0000 (13:47 -0500)]
usb: Minor - properly free memory on get_device_config() error path

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agousb: Control transfers always have an 8 byte command size
Kevin O'Connor [Wed, 31 Dec 2014 22:41:14 +0000 (17:41 -0500)]
usb: Control transfers always have an 8 byte command size

There is no need to pass 'cmdsize' to the usb drivers as the cmdsize
is always 8 bytes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoxhci: Merge some xhci_xfer_x() functions into xhci_send_pipe()
Kevin O'Connor [Wed, 31 Dec 2014 16:05:39 +0000 (11:05 -0500)]
xhci: Merge some xhci_xfer_x() functions into xhci_send_pipe()

The xhci_xfer_setup, xhci_xfer_data, xhci_xfer_status, and
xhci_xfer_normal functions are very similar - enhance xhci_xfer_queue
to reduce the boiler plate in the above functions.  Merge the
resulting setup, data, and status code into the only function that
uses them - xhci_send_pipe().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoxhci: Move xhci_xfer_x() functions together
Kevin O'Connor [Wed, 31 Dec 2014 07:25:58 +0000 (02:25 -0500)]
xhci: Move xhci_xfer_x() functions together

This is purely code movement - no code changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agousb: Use usb_send_pipe() now that all drivers have x_send_pipe()
Kevin O'Connor [Wed, 31 Dec 2014 07:11:36 +0000 (02:11 -0500)]
usb: Use usb_send_pipe() now that all drivers have x_send_pipe()

Now that all drivers have unified control and bulk transmit functions,
unify the driver calling code in usb.c as well.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoxhci: Merge xhci_send_control with xhci_send_bulk
Kevin O'Connor [Wed, 31 Dec 2014 07:07:37 +0000 (02:07 -0500)]
xhci: Merge xhci_send_control with xhci_send_bulk

Merge both the control and bulk pipe sending functions into one new
function: xhci_send_pipe().  This makes the xhci interface similar to
the other usb drivers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agouhci: Merge uhci_send_control with uhci_send_bulk
Kevin O'Connor [Wed, 31 Dec 2014 06:56:53 +0000 (01:56 -0500)]
uhci: Merge uhci_send_control with uhci_send_bulk

Merge both the control and bulk pipe sending functions into one new
function: uhci_send_pipe().  The two existing functions were similar,
and by merging them the resulting code supports more flexible control
transfers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoohci: Merge ohci_send_control with ohci_send_bulk
Kevin O'Connor [Wed, 31 Dec 2014 06:55:48 +0000 (01:55 -0500)]
ohci: Merge ohci_send_control with ohci_send_bulk

Merge both the control and bulk pipe sending functions into one new
function: ohci_send_pipe().  The two existing functions were similar,
and by merging them the resulting code supports more flexible control
transfers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoehci: Merge ehci_send_control with ehci_send_bulk
Kevin O'Connor [Wed, 31 Dec 2014 02:16:04 +0000 (21:16 -0500)]
ehci: Merge ehci_send_control with ehci_send_bulk

Merge both the control and bulk pipe sending functions into one new
function: ehci_send_pipe().  The two existing functions were similar,
and by merging them the resulting code supports more flexible control
transfers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoehci: Simplify fillTDbuffer() and rename
Kevin O'Connor [Thu, 1 Jan 2015 17:51:04 +0000 (12:51 -0500)]
ehci: Simplify fillTDbuffer() and rename

Simplify the calculation of the maximum transfer size per qtd,
simplify the fillTDbuffer() function so that it only fills the buffer
pointers, and rename fillTDbuffer() to ehci_fill_tdbuf().

Also, don't modify 'data' or 'datasize' so that usb_xfer_time() can
use 'datasize' at the end of the function.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoehci: No need to support td array wrapping
Kevin O'Connor [Wed, 31 Dec 2014 01:50:44 +0000 (20:50 -0500)]
ehci: No need to support td array wrapping

The maximum bulk transfer is 64K and 4 QTDs can always transfer 64K.
So, there is no need to support a transfer with more than 4 QTDs.
Build the entire transaction and then submit it in one operation to
simplify the code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agovgabios: Support emulated text in gfx_read_char()
Kevin O'Connor [Tue, 6 Jan 2015 14:36:41 +0000 (09:36 -0500)]
vgabios: Support emulated text in gfx_read_char()

When emulating text mode on "coreboot framebuffer" SeaVGABIOS, return
a foreground and background attribute from gfx_read_char() and prefer
returning a space character (instead of null) on blank cells.

This also returns the foreground color (instead of always returning
zero) for regular graphics mode gfx_read_char() calls.  This seems
fine as tests show other vgabios implementations also return various
values here.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agovgabios: implement read char in graphics mode
Paolo Bonzini [Fri, 2 Jan 2015 17:32:25 +0000 (12:32 -0500)]
vgabios: implement read char in graphics mode

GWBasic relies on this, so implement it to enable some serious retrocomputing.
There is no better way to do it than trying to match all characters one by one
against the current font.

This makes it possible to actually do something in SCREEN 1 and SCREEN 2
(without it, you can use graphics in the programs but not in direct mode).

I couldn't find documentation for what to return as the attribute, but
experimenting with DOSBox suggests 0 (and GWBasic accepts it).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agovgabios: fix graphics operation with Bochs VGA in non-DISPI modes
Paolo Bonzini [Thu, 1 Jan 2015 20:27:46 +0000 (21:27 +0100)]
vgabios: fix graphics operation with Bochs VGA in non-DISPI modes

For legacy VGA modes that do not set the VBE_DISPI_ENABLED bit,
bochsvga_get_linelength returns 0.  Thus all characters are squashed
into the first scanline.  Fix this by falling back to stdvga for
the legacy modes.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agouhci: Increase bulk transfer STACKTDS to 16
Kevin O'Connor [Wed, 31 Dec 2014 06:42:38 +0000 (01:42 -0500)]
uhci: Increase bulk transfer STACKTDS to 16

Increase the number of simultaneous transfer descriptors that the
driver will build for uhci.  The old value of 4 was a leftover from
when SeaBIOS had a tiny 512 byte extra stack - now that there is a 2K
extra stack there is plenty of space for additional descriptors.
Using a value of 16 should allow for an entire 1ms frame of bulk
transfer content to be setup in advance (assuming the max packet size
is 64 bytes).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agouhci: Enable "depth" tree traversal for bulk transfers
Kevin O'Connor [Wed, 31 Dec 2014 06:40:07 +0000 (01:40 -0500)]
uhci: Enable "depth" tree traversal for bulk transfers

Set the "depth" flag on bulk transactions.  Since SeaBIOS doesn't use
bandwidth reclamation, without the depth flag the uhci controller will
only transfer one bulk packet per 1 ms frame.  This results in a
maximum of 64 bytes per millisecond, which severely limits the
transfer rate.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agodocs: Add documentation on using readserial.py script
Kevin O'Connor [Wed, 31 Dec 2014 17:02:56 +0000 (12:02 -0500)]
docs: Add documentation on using readserial.py script

Update the debugging documentation with info on timing debug output
with readserial.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoreadserial: Enhance pipe support
Kevin O'Connor [Wed, 31 Dec 2014 05:18:05 +0000 (00:18 -0500)]
readserial: Enhance pipe support

Automatically close and open the pipe if it closes.  Also, better
document that the -f option is for pipes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agousb: Add support for OHCI bulk transfers
Kevin O'Connor [Mon, 29 Dec 2014 18:06:23 +0000 (13:06 -0500)]
usb: Add support for OHCI bulk transfers

Support bulk transfers (usb drives) on OHCI USB controllers.  Now that
there is support for 32bit only drive controllers, it is not that hard
to support disks on OHCI controllers, and it may be useful for some
old hardware.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoblock: Check for read/write requests over 64K
Kevin O'Connor [Mon, 29 Dec 2014 15:29:34 +0000 (10:29 -0500)]
block: Check for read/write requests over 64K

The standard BIOS disk read/write request interface should never get a
request for more than 64K of data.  Explicitly check for overly large
requests and reject them.  This way, the low-level drivers do not need
to check for or attempt to handle very large requests.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agocdrom: Break up very large read requests into smaller requests
Kevin O'Connor [Mon, 29 Dec 2014 15:15:57 +0000 (10:15 -0500)]
cdrom: Break up very large read requests into smaller requests

A cdrom boot image could be over 64K in size, but the low level
drivers may not support very large reads.  If a large cdrom image is
found, issue multiple reads so that a read request over 64K is never
issued.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoscsi: Don't export cdb_* functions
Kevin O'Connor [Mon, 29 Dec 2014 14:58:48 +0000 (09:58 -0500)]
scsi: Don't export cdb_* functions

The low-level cdb_* functions are now only used from within
cmdblock.c, so don't export them.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agocdrom: call scsi_process_op() instead of cdb_read()
Kevin O'Connor [Mon, 29 Dec 2014 14:48:24 +0000 (09:48 -0500)]
cdrom: call scsi_process_op() instead of cdb_read()

Use the scsi_process_op() function instead of the lower level
cdb_read() function.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoscsi: Move process_scsi_op() to hw/blockcmd.c and rename
Kevin O'Connor [Mon, 29 Dec 2014 14:45:15 +0000 (09:45 -0500)]
scsi: Move process_scsi_op() to hw/blockcmd.c and rename

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoscsi: Move cdb_* functions above scsi_* functions
Kevin O'Connor [Mon, 29 Dec 2014 14:40:46 +0000 (09:40 -0500)]
scsi: Move cdb_* functions above scsi_* functions

This is just code movement - no code changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agodocs: Add page describing SeaBIOS final object linking
Kevin O'Connor [Sun, 28 Dec 2014 19:18:03 +0000 (14:18 -0500)]
docs: Add page describing SeaBIOS final object linking

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agodocs: Add info on MODE16/MODESEGMENT compile time flags
Kevin O'Connor [Sun, 28 Dec 2014 19:17:37 +0000 (14:17 -0500)]
docs: Add info on MODE16/MODESEGMENT compile time flags

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agodocs: Don't point to repo README files
Kevin O'Connor [Thu, 18 Dec 2014 22:36:12 +0000 (17:36 -0500)]
docs: Don't point to repo README files

Now that the README files have been simplified, don't point the wiki
pages to them.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoAdd wiki documentation to repository
Kevin O'Connor [Tue, 16 Dec 2014 13:53:24 +0000 (08:53 -0500)]
Add wiki documentation to repository

Add a docs/ directory that contains the contents of the SeaBIOS wiki
in markdown format.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agosdcard: Initial support for SD cards on PCI SDHCI controllers on QEMU
Kevin O'Connor [Tue, 16 Dec 2014 14:55:16 +0000 (09:55 -0500)]
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>
10 years agoSimplify README files - point to online documentation instead
Kevin O'Connor [Tue, 16 Dec 2014 02:44:13 +0000 (21:44 -0500)]
Simplify README files - point to online documentation instead

The README file and README.CSM file have gotten a bit out of date.
Instead of maintaining technical information in the README file, point
new users to the SeaBIOS wiki.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agousb: Update USB hub code to support super speed hubs
Kevin O'Connor [Fri, 12 Dec 2014 19:16:43 +0000 (14:16 -0500)]
usb: Update USB hub code to support super speed hubs

Super speed hubs (usb3 spec) have specific initialization
requirements.  Add the code necessary to detect and initialize these
hubs.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoEliminate FUNCFSEG - only force portions of inline asm to f-segment
Kevin O'Connor [Wed, 3 Dec 2014 17:53:01 +0000 (12:53 -0500)]
Eliminate FUNCFSEG - only force portions of inline asm to f-segment

The FUNCFSEG macro was introduced to force a C function into the
f-segment.  This was needed for some C functions that used inline
assembler that contained some 16bit code.  Instead of forcing the
entire C function into the f-segment, just force the small subset of
inline assembler into the f-segment.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoUse macros for .code16/32 mode switches in inline asm in stacks.c
Kevin O'Connor [Wed, 3 Dec 2014 17:39:28 +0000 (12:39 -0500)]
Use macros for .code16/32 mode switches in inline asm in stacks.c

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoMinor - be consistent in placement of .code16/32 in romlayout.S
Kevin O'Connor [Wed, 3 Dec 2014 17:22:14 +0000 (12:22 -0500)]
Minor - be consistent in placement of .code16/32 in romlayout.S

Place .code32 in those functions that need it, and make sure every
function ends in .code16 mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agofloppy: Make sure to yield() during floppy PIO
Kevin O'Connor [Sat, 29 Nov 2014 18:04:46 +0000 (13:04 -0500)]
floppy: Make sure to yield() during floppy PIO

The floppy Programmed IO code really should yield while the controller
is busy.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agobuild: set LC_ALL=C
Gerd Hoffmann [Wed, 3 Dec 2014 14:14:57 +0000 (15:14 +0100)]
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>
10 years agoadd scripts/tarball.sh
Gerd Hoffmann [Mon, 17 Nov 2014 07:32:00 +0000 (08:32 +0100)]
add scripts/tarball.sh

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agopciinit: Fix build warning in mch_pci_slot_get_irq()
Kevin O'Connor [Wed, 12 Nov 2014 23:00:30 +0000 (18:00 -0500)]
pciinit: Fix build warning in mch_pci_slot_get_irq()

Some old versions of gcc warn that 'irq might be used uninitialized'.
Replace the switch statement with an if statement to suppress the
warning.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>