]> xenbits.xensource.com Git - seabios.git/log
seabios.git
9 years agoxhci: Minor - add USB port type comments to xhci_hub_reset()
Kevin O'Connor [Mon, 24 Aug 2015 13:50:30 +0000 (09:50 -0400)]
xhci: Minor - add USB port type comments to xhci_hub_reset()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Allow sdcard addresses to be specified in CBFS files
Kevin O'Connor [Mon, 10 Aug 2015 16:51:41 +0000 (12:51 -0400)]
sdcard: Allow sdcard addresses to be specified in CBFS files

Allow a hardcoded address to be specified in cbfs files with a prefix
of "etc/sdcard".  Some real-world devices have valid SDHCI controllers
that do not show up as PCI devices.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agops2: Eliminate "etc/ps2-poll-only"; use CONFIG_HARDWARE_IRQ instead
Kevin O'Connor [Mon, 10 Aug 2015 19:50:53 +0000 (15:50 -0400)]
ps2: Eliminate "etc/ps2-poll-only"; use CONFIG_HARDWARE_IRQ instead

The "etc/ps2-poll-only" runtime setting is directly tied to the new
CONFIG_HARDWARE_IRQ setting - use the compile time setting to control
both.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoAdd minimal support for machines without hardware interrupts
Kevin O'Connor [Mon, 10 Aug 2015 20:14:48 +0000 (16:14 -0400)]
Add minimal support for machines without hardware interrupts

Some Chromebooks (with Baytrail CPUs) apparently do not support
routing of legacy interrupts.  This patch adds minimal support for
running SeaBIOS in such an environment.  Even with this patch, it is
known that old operating systems and even some recent bootloaders will
not function without real hardware interrupts.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agortc: Support disabling the RTC timer irq support
Kevin O'Connor [Thu, 13 Aug 2015 15:43:27 +0000 (11:43 -0400)]
rtc: Support disabling the RTC timer irq support

Add a build time config option to remove support for RTC timer
interrupts along with the associated bios calls requiring that
support.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Allow the sdcard driver to run on real hardware
Kevin O'Connor [Mon, 10 Aug 2015 19:41:03 +0000 (15:41 -0400)]
sdcard: Allow the sdcard driver to run on real hardware

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Initial support for MMC cards
Kevin O'Connor [Tue, 11 Aug 2015 17:29:55 +0000 (13:29 -0400)]
sdcard: Initial support for MMC cards

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Check for error events during sdcard_pio()
Kevin O'Connor [Wed, 12 Aug 2015 16:07:17 +0000 (12:07 -0400)]
sdcard: Check for error events during sdcard_pio()

Check for command errors and clear the error status if an error is
found.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Perform a controller reset at start of init
Kevin O'Connor [Wed, 12 Aug 2015 16:02:16 +0000 (12:02 -0400)]
sdcard: Perform a controller reset at start of init

Ask the controller to reset itself during controller setup.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Rename waitw() to sdcard_waitw() and simplify
Kevin O'Connor [Tue, 11 Aug 2015 17:03:22 +0000 (13:03 -0400)]
sdcard: Rename waitw() to sdcard_waitw() and simplify

Calculate end timeout in code and return if any bit in the provided
mask is set.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Implement timeout on every block read in sdcard_pio_transfer()
Kevin O'Connor [Wed, 12 Aug 2015 16:58:23 +0000 (12:58 -0400)]
sdcard: Implement timeout on every block read in sdcard_pio_transfer()

The sdcard specs don't specify a maximum time for arbitrary transfers.
Instead, each block has a maximum timeout.  So, change the code to
check for a timeout on each block transferred.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: The card should never be in a busy state at start of sdcard_pio()
Kevin O'Connor [Tue, 11 Aug 2015 16:59:53 +0000 (12:59 -0400)]
sdcard: The card should never be in a busy state at start of sdcard_pio()

Return an error if the controller is busy at the start of a command
instead of waiting.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Power down controller on failure
Kevin O'Connor [Tue, 11 Aug 2015 15:59:34 +0000 (11:59 -0400)]
sdcard: Power down controller on failure

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Power controller up to maximum voltage supported
Kevin O'Connor [Tue, 11 Aug 2015 15:56:51 +0000 (11:56 -0400)]
sdcard: Power controller up to maximum voltage supported

Don't error out if the controller does not support 3.3V - instead
supply the most voltage the controller supports.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Move power setup to new function sdcard_set_power()
Kevin O'Connor [Tue, 11 Aug 2015 15:47:57 +0000 (11:47 -0400)]
sdcard: Move power setup to new function sdcard_set_power()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Support SDHCI v3.00 spec clock setting
Kevin O'Connor [Tue, 11 Aug 2015 13:34:19 +0000 (09:34 -0400)]
sdcard: Support SDHCI v3.00 spec clock setting

The SDHCI v3 spec supports higher frequency clocks and has a different
method to configure the clock divisor.

This also fixes an error in v1/v2 clock calculation (ffs was used
instead of fls).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Fill command bits according to spec
Kevin O'Connor [Tue, 11 Aug 2015 03:40:50 +0000 (23:40 -0400)]
sdcard: Fill command bits according to spec

Set the proper command bits for each command according to the SDHCI
specification.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Fix typo - use sdcard_pio() instead of sdcard_pio_app()
Kevin O'Connor [Mon, 10 Aug 2015 23:11:15 +0000 (19:11 -0400)]
sdcard: Fix typo - use sdcard_pio() instead of sdcard_pio_app()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoCall cpu_relax() if yielding prior to interrupts being enabled
Kevin O'Connor [Fri, 7 Aug 2015 20:13:18 +0000 (16:13 -0400)]
Call cpu_relax() if yielding prior to interrupts being enabled

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoMove CanInterrupt check to check_irqs()
Kevin O'Connor [Fri, 7 Aug 2015 20:12:02 +0000 (16:12 -0400)]
Move CanInterrupt check to check_irqs()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoedd: Reduce parameters to fill_generic_edd()
Kevin O'Connor [Wed, 5 Aug 2015 19:02:01 +0000 (15:02 -0400)]
edd: Reduce parameters to fill_generic_edd()

Have callers of fill_generic_edd() calculate the edd iface_path
field.  Have callers determine if the bus type is PCI vs ISA.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoedd: Pass the segment/offset from int 1348 calls using a 'struct segoff_s'
Kevin O'Connor [Mon, 27 Jul 2015 14:41:41 +0000 (10:41 -0400)]
edd: Pass the segment/offset from int 1348 calls using a 'struct segoff_s'

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agooptionroms: Don't run option rom on PCI bar if CBFS/fw_cfg version exists
Kevin O'Connor [Mon, 10 Aug 2015 19:37:13 +0000 (15:37 -0400)]
optionroms: Don't run option rom on PCI bar if CBFS/fw_cfg version exists

If there exists a "pci%04x,%04x.rom" file in CBFS/fw_cfg then the code
should not attempt to run a rom found on the PCI device itself - even
if the one in CBFS/fw_cfg is not a valid rom.  This makes the code
match the documentation.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoxhci: Count new Max Scratchpad Bufs bits from XHCI 1.1
Julius Werner [Sat, 8 Aug 2015 03:07:12 +0000 (20:07 -0700)]
xhci: Count new Max Scratchpad Bufs bits from XHCI 1.1

The 1.1 revision of the XHCI specification added an extra 5 bits to the
Max Scratchpad Bufs field of HCSPARAMS2 that newer controllers make use
of. Not honoring these bits means we're not allocating as many
scratchpad buffers as the controller expects, which means it will
interpret some uninitialized values from the end of the pointer array as
scratchpad buffer pointers.

We just fixed this in libpayload and it seems to apply the same way to
SeaBIOS (I only compile-tested this, though... sorry).

Signed-off-by: Julius Werner <jwerner@chromium.org>
9 years agomptable: Don't create mptable if it is very large
Kevin O'Connor [Mon, 3 Aug 2015 14:16:39 +0000 (10:16 -0400)]
mptable: Don't create mptable if it is very large

Very large mptable structures can fill up the space in the f-segment
and cause other important f-segment allocations to fail.  Limit the
maximum size of the mptable to prevent this.

On QEMU, with the current maximum size of 600 bytes, the mptable will
not be created in configurations of ~20 cpus or more.  The mptable is
rarely used in modern OSes so this should not be a problem.

Reported-by: Huaitong Han <huaitong.han@intel.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Add proper delays during card power up
Kevin O'Connor [Tue, 4 Aug 2015 14:01:02 +0000 (10:01 -0400)]
sdcard: Add proper delays during card power up

Add card power up timing delays as specified by the sd card "Physical
Layer Simplified Specification Version 4.10".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Improve SD card initialization command sequence
Kevin O'Connor [Thu, 30 Jul 2015 14:56:00 +0000 (10:56 -0400)]
sdcard: Improve SD card initialization command sequence

Send the initialization commands that are specified for SD cards by
the "SD Host Controller Simplified Specification Version 2.00" spec.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Set timeout control register during init (to max allowed timeout)
Kevin O'Connor [Tue, 28 Jul 2015 18:15:37 +0000 (14:15 -0400)]
sdcard: Set timeout control register during init (to max allowed timeout)

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Make sure controller support 3.3V before enabling it
Kevin O'Connor [Tue, 4 Aug 2015 13:48:30 +0000 (09:48 -0400)]
sdcard: Make sure controller support 3.3V before enabling it

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Implement controller frequency setting according to sdhci spec
Kevin O'Connor [Tue, 28 Jul 2015 17:40:04 +0000 (13:40 -0400)]
sdcard: Implement controller frequency setting according to sdhci spec

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosdcard: Check if card is present before sending commands to card
Kevin O'Connor [Tue, 28 Jul 2015 17:06:41 +0000 (13:06 -0400)]
sdcard: Check if card is present before sending commands to card

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agovgafb: Minor - move gfx_common() variables outside of switch statement
Kevin O'Connor [Thu, 30 Jul 2015 16:42:47 +0000 (12:42 -0400)]
vgafb: Minor - move gfx_common() variables outside of switch statement

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosmm: ignore bits 16,18-31 of SMM revision ID at runtime too
Kevin O'Connor [Thu, 30 Jul 2015 16:39:12 +0000 (12:39 -0400)]
smm: ignore bits 16,18-31 of SMM revision ID at runtime too

Check only the relevant bits of the SMM revision ID for both the init
check and during runtime checks.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agosmm: fix outl argument order
Paolo Bonzini [Mon, 27 Jul 2015 10:23:58 +0000 (12:23 +0200)]
smm: fix outl argument order

The value is the first argument and the port is the second, but the code
was using the opposite order.

Reported-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 years agoMinor - move declaration of CDRom_locks to code that uses it
Kevin O'Connor [Fri, 24 Jul 2015 17:17:38 +0000 (13:17 -0400)]
Minor - move declaration of CDRom_locks to code that uses it

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoramdisk: Allow ramdisk support (CONFIG_FLASH_FLOPPY) under QEMU
Kevin O'Connor [Thu, 23 Jul 2015 13:19:23 +0000 (09:19 -0400)]
ramdisk: Allow ramdisk support (CONFIG_FLASH_FLOPPY) under QEMU

Don't require coreboot to use CONFIG_FLASH_FLOPPY - with the latest
QEMU, it's possible to place a floppy image into fw_cfg using the qemu
command line (eg, "-fw_cfg name=floppyimg/MyFloppy,file=file.img").

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agotimer: Add CONFIG_TSC_TIMER build option to disable the CPU TSC timer
Kevin O'Connor [Thu, 23 Jul 2015 12:36:01 +0000 (08:36 -0400)]
timer: Add CONFIG_TSC_TIMER build option to disable the CPU TSC timer

Allow users to remove the CPU timestamp counter support at compile
time.  The PMTIMER is frequently used instead of the TSC and this
compile time option allows one to strip a few bytes from the final
binary.  This change also defaults the internal timer to use the PIT
based timer until the PMTIMER or TSC is detected.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agotimer: Delay timestamp counter init until after pmtimer is probed
Kevin O'Connor [Wed, 22 Jul 2015 20:06:27 +0000 (16:06 -0400)]
timer: Delay timestamp counter init until after pmtimer is probed

Delay call to timer_setup() until after the xxx_platform_setup() calls
so that the pmtimer can be detected first.  Most modern machines will
have a pmtimer and calibrating the timestamp counter is frequently
unnecessary.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agops2: Don't wait 100ms to discard possible extra reset receive byte
Kevin O'Connor [Wed, 22 Jul 2015 18:32:28 +0000 (14:32 -0400)]
ps2: Don't wait 100ms to discard possible extra reset receive byte

The existing PS2 port code waits 100ms to see if the device attached
to the keyboard port responds to a reset command with two bytes
(instead of the normal one byte).  If an extra byte is received, it is
discarded.

Receiving two bytes would be unusual and waiting to check for that
event is unnecessary because the next command in the keyboard init
sequence already seamlessly discards any extra bytes in the command
queue.

This patch eliminates the 100ms wait, which notably reduces the
SeaBIOS boot time on QEMU.  This patch also forces PS2 mice to always
respond with two bytes during a reset sequence (instead of just one
byte), which is a good sanity check.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoDon't enable interrupts prior to IVT and PIC setup
Kevin O'Connor [Tue, 14 Jul 2015 19:44:26 +0000 (15:44 -0400)]
Don't enable interrupts prior to IVT and PIC setup

The machine may crash if an interrupt occurs prior to the setup of the
interrupt vector table (IVT) and programmable interrupt controller
(PIC).  This patch makes sure that interrupts remain disabled until
these components are setup.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoata: Make sure "chanid" is relative to PCI device for bootorder file
Kevin O'Connor [Tue, 14 Jul 2015 19:12:25 +0000 (15:12 -0400)]
ata: Make sure "chanid" is relative to PCI device for bootorder file

When specifying drives in the bootorder file, the "drive@x" parameter
should be relative to the given PCI device and not relative to the
total number of ATA controllers in the machine.  This patch separates
the tracking of "chanid" (channel number relative to a given PCI
devices) from the "ataid" (channel number relative to the total number
of ATA channels).

Reported-by: Jonathan A. Kollasch <jakllsch@kollasch.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agops2: Support mode for polling the PS2 port instead of using irqs
Kevin O'Connor [Wed, 12 Nov 2014 17:15:34 +0000 (12:15 -0500)]
ps2: Support mode for polling the PS2 port instead of using irqs

Some recent hardware has trouble with routing PS2 port interrupts
while the interrupt controller is in legacy routing mode.  This patch
adds a config mechanism (via "etc/ps2-poll-only") to force the PS2
code into a polling only mode so that interrupts are not required.

It is not recommended to use this polling mode on hardware that does
properly support PS2 irqs, because some very old (DOS-era) programs
depend on the BIOS PS2 irq behavior.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agocoreboot: Try to auto-detect if the CBFS anchor pointer is a relative pointer
Kevin O'Connor [Wed, 8 Jul 2015 23:05:54 +0000 (19:05 -0400)]
coreboot: Try to auto-detect if the CBFS anchor pointer is a relative pointer

If CONFIG_CBFS_LOCATION is set to a non-zero value then it means the
CBFS flash is not at the very end of memory.  In this case, it's
unclear if the anchor pointer is an absolute pointer or if it is
relative to CONFIG_CBFS_LOCATION.  Some devices have been using
absolute pointers, but it appears some devices are now using relative
pointers there.  Since the anchor pointer almost always points to a
structure in the last 64K of the rom, it should be possible to
auto-detect if the pointer is relative or not.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoblock: Rename process_XXX_op() functions to XXX_process_op()
Kevin O'Connor [Tue, 7 Jul 2015 18:56:20 +0000 (14:56 -0400)]
block: Rename process_XXX_op() functions to XXX_process_op()

Rename disk driver dispatch functions to a consistent naming style.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoblockcmd: Convert cdb_is_read() to scsi_is_read()
Kevin O'Connor [Tue, 7 Jul 2015 18:43:01 +0000 (14:43 -0400)]
blockcmd: Convert cdb_is_read() to scsi_is_read()

Convert the cdb_is_read() function to a new function scsi_is_read()
which takes a 'struct disk_op_s' as a paramter.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoblockcmd: Remove unused scsi_process_op() and cdb_cmd_data()
Kevin O'Connor [Tue, 7 Jul 2015 16:46:20 +0000 (12:46 -0400)]
blockcmd: Remove unused scsi_process_op() and cdb_cmd_data()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agopvscsi: Handle pvscsi drives directly via 'struct disk_op_s' requests
Kevin O'Connor [Tue, 7 Jul 2015 16:35:34 +0000 (12:35 -0400)]
pvscsi: Handle pvscsi drives directly via 'struct disk_op_s' requests

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agopvscsi: Move pvscsi_fill_req() code into pvscsi_cmd()
Kevin O'Connor [Tue, 7 Jul 2015 16:24:50 +0000 (12:24 -0400)]
pvscsi: Move pvscsi_fill_req() code into pvscsi_cmd()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agovirtio-scsi: Handle virtio drives directly via 'struct disk_op_s' requests
Kevin O'Connor [Tue, 7 Jul 2015 16:19:53 +0000 (12:19 -0400)]
virtio-scsi: Handle virtio drives directly via 'struct disk_op_s' requests

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agomegasas: Handle Megasas drives directly via 'struct disk_op_s' requests
Kevin O'Connor [Tue, 7 Jul 2015 16:06:01 +0000 (12:06 -0400)]
megasas: Handle Megasas drives directly via 'struct disk_op_s' requests

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoesp-scsi: Handle ESP drives directly via 'struct disk_op_s' requests
Kevin O'Connor [Tue, 7 Jul 2015 15:57:50 +0000 (11:57 -0400)]
esp-scsi: Handle ESP drives directly via 'struct disk_op_s' requests

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agolsi-scsi: Handle LSI drives directly via 'struct disk_op_s' requests
Kevin O'Connor [Tue, 7 Jul 2015 15:51:08 +0000 (11:51 -0400)]
lsi-scsi: Handle LSI drives directly via 'struct disk_op_s' requests

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agousb-uas: Handle USB drives directly via 'struct disk_op_s' requests
Kevin O'Connor [Tue, 7 Jul 2015 15:43:34 +0000 (11:43 -0400)]
usb-uas: Handle USB drives directly via 'struct disk_op_s' requests

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agousb-msc: Handle USB drives directly via 'struct disk_op_s' requests
Kevin O'Connor [Tue, 7 Jul 2015 15:35:25 +0000 (11:35 -0400)]
usb-msc: Handle USB drives directly via 'struct disk_op_s' requests

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoahci: Handle AHCI ATAPI drives directly via 'struct disk_op_s' requests
Kevin O'Connor [Tue, 7 Jul 2015 15:24:27 +0000 (11:24 -0400)]
ahci: Handle AHCI ATAPI drives directly via 'struct disk_op_s' requests

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoata: Handle ATA ATAPI drives directly via 'struct disk_op_s' requests
Kevin O'Connor [Tue, 7 Jul 2015 15:11:46 +0000 (11:11 -0400)]
ata: Handle ATA ATAPI drives directly via 'struct disk_op_s' requests

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoblockcmd: Introduce scsi_fill_cmd()
Kevin O'Connor [Tue, 7 Jul 2015 14:53:12 +0000 (10:53 -0400)]
blockcmd: Introduce scsi_fill_cmd()

Introduce scsi_fill_cmd() which creates a scsi style "command data
block" from a "struct disk_op_s" disk request.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoblock: Route scsi style commands through 'struct disk_op_s'
Kevin O'Connor [Tue, 7 Jul 2015 13:53:54 +0000 (09:53 -0400)]
block: Route scsi style commands through 'struct disk_op_s'

Support sending scsi style "command data block" commands (cdbcmd)
through the 'struct disk_op_s' command request structure.  And change
the blockcmd.c and cdrom.c code to route these commands through the
process_op() code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoblock: Introduce default_process_op() with common command handling codes
Kevin O'Connor [Tue, 7 Jul 2015 13:01:52 +0000 (09:01 -0400)]
block: Introduce default_process_op() with common command handling codes

Most disk drivers only implement a couple of the available bios
commands.  Unify the common fallback handling code into a new function
default_process_op() to reduce boiler-plate code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoblock: Split process_op() command dispatch up into multiple functions
Kevin O'Connor [Tue, 7 Jul 2015 12:35:51 +0000 (08:35 -0400)]
block: Split process_op() command dispatch up into multiple functions

Introduce process_op_32(), process_op_16(), and process_op_both() and
split the disk driver command dispatch by its runtime mode
requirements.  This makes it more clear which modes each driver runs
in.  It also reduces the call32() boiler-plate code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoich9: initialise RCBA register through LPC interface
Paulo Alcantara [Fri, 10 Jul 2015 00:04:01 +0000 (21:04 -0300)]
ich9: initialise RCBA register through LPC interface

This patch initialises root complex register block BAR in order to
support TCO watchdog emulation features on QEMU.

Cc: Kevin O'Connor <kevin@koconnor.net>
Cc: Gerd Hofmann <kraxel@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agodocs: Note release date of 1.8.2
Kevin O'Connor [Mon, 6 Jul 2015 17:45:42 +0000 (13:45 -0400)]
docs: Note release date of 1.8.2

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agoMake sure all code checks for malloc failures
Kevin O'Connor [Tue, 30 Jun 2015 15:10:41 +0000 (11:10 -0400)]
Make sure all code checks for malloc failures

This is the result of an audit of callers of the malloc_XXX() and
memalign_XXX() calls.  All callers need to check if these functions
return NULL.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agobootorder: Update "extra pci root" buses bootorder format to match qemu
Kevin O'Connor [Tue, 30 Jun 2015 15:07:58 +0000 (11:07 -0400)]
bootorder: Update "extra pci root" buses bootorder format to match qemu

The QEMU code will use the prefix "/pci@i0cf8,%x/" for devices on
extra pci root buses, so change the SeaBIOS code to match that.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
9 years agovirtio-pci: use high memory for rings
Gerd Hoffmann [Wed, 1 Jul 2015 12:39:30 +0000 (14:39 +0200)]
virtio-pci: use high memory for rings

That way we should be able to manage *alot* more devices.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio-ring: 32bit cleanup
Gerd Hoffmann [Wed, 1 Jul 2015 12:45:58 +0000 (14:45 +0200)]
virtio-ring: 32bit cleanup

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio-scsi: 32bit cleanup
Gerd Hoffmann [Wed, 1 Jul 2015 12:38:59 +0000 (14:38 +0200)]
virtio-scsi: 32bit cleanup

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio-blk: 32bit cleanup
Gerd Hoffmann [Wed, 1 Jul 2015 12:35:27 +0000 (14:35 +0200)]
virtio-blk: 32bit cleanup

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: legacy cleanup
Gerd Hoffmann [Tue, 30 Jun 2015 07:53:03 +0000 (09:53 +0200)]
virtio: legacy cleanup

Now that all code is switched over to use vp_read/write we can
drop the ioaddr field from vp_device and the offset #defines.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: also probe version 1.0 pci ids
Gerd Hoffmann [Fri, 26 Jun 2015 07:50:22 +0000 (09:50 +0200)]
virtio: also probe version 1.0 pci ids

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: use version 1.0 if available (flip the big switch)
Gerd Hoffmann [Fri, 26 Jun 2015 06:45:11 +0000 (08:45 +0200)]
virtio: use version 1.0 if available (flip the big switch)

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio-blk: fix initialization for version 1.0
Gerd Hoffmann [Fri, 26 Jun 2015 09:55:41 +0000 (11:55 +0200)]
virtio-blk: fix initialization for version 1.0

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio-scsi: fix initialization for version 1.0
Gerd Hoffmann [Fri, 26 Jun 2015 08:22:55 +0000 (10:22 +0200)]
virtio-scsi: fix initialization for version 1.0

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: add version 1.0 support to vp_find_vq
Gerd Hoffmann [Fri, 26 Jun 2015 07:07:59 +0000 (09:07 +0200)]
virtio: add version 1.0 support to vp_find_vq

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: remove unused vp_del_vq
Gerd Hoffmann [Fri, 26 Jun 2015 06:40:30 +0000 (08:40 +0200)]
virtio: remove unused vp_del_vq

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: add version 1.0 support to vp_notify
Gerd Hoffmann [Fri, 26 Jun 2015 06:19:28 +0000 (08:19 +0200)]
virtio: add version 1.0 support to vp_notify

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: add version 1.0 support to vp_reset
Gerd Hoffmann [Thu, 25 Jun 2015 14:44:06 +0000 (16:44 +0200)]
virtio: add version 1.0 support to vp_reset

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: add version 1.0 support to vp_get_isr
Gerd Hoffmann [Thu, 25 Jun 2015 14:43:17 +0000 (16:43 +0200)]
virtio: add version 1.0 support to vp_get_isr

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9 years agovirtio: add version 1.0 support to vp_{get,set}_status
Gerd Hoffmann [Thu, 25 Jun 2015 14:37:41 +0000 (16:37 +0200)]
virtio: add version 1.0 support to vp_{get,set}_status

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
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>