3 years agoSeaBIOS: Fix a bug in PCI ID mapping 23/2623/1 0.14.811.B 0.15.877.B 780.B factory-1020.B factory-980.B firmware-881-u-boot-v1 firmware-u-boot-v1 master release-1011.B test-982.B
Stefan Reinauer [Tue, 14 Jun 2011 18:27:16 +0000 (11:27 -0700)]
SeaBIOS: Fix a bug in PCI ID mapping

This apparently did not hit us before because the option rom
was packed into CBFS with the correct file name but with the
wrong ID.

TEST=boot coreboot/seabios on alex (needs another change in coreboot)

Change-Id: Ic6573fa07d13c617990e4a2a64bb28e6b45b01db

3 years agoMerge "Use ESC instead of F12 for the menu, because we don't have an F12 key."
Stefan Reinauer [Wed, 8 Jun 2011 00:10:11 +0000 (17:10 -0700)]
Merge "Use ESC instead of F12 for the menu, because we don't have an F12 key."

3 years agoUse ESC instead of F12 for the menu, because we don't have an F12 key. 68/2168/2
Stefan Reinauer [Mon, 6 Jun 2011 19:22:48 +0000 (12:22 -0700)]
Use ESC instead of F12 for the menu, because we don't have an F12 key.

TEST=boot on Alex, press ESC to see the list of boot devices.

Change-Id: I5d8732056094c667e90e9a35f21b98d30c03b174

3 years agoChange the firmware ID string shown in ChromeOS. 67/2167/1
Stefan Reinauer [Mon, 6 Jun 2011 19:14:01 +0000 (12:14 -0700)]
Change the firmware ID string shown in ChromeOS.

TEST=boot ChromeOS, check about screen.

Change-Id: Ie8a167e8f25d36f2fb9688c5d9d51a95684b4868

3 years agoAdd a coreboot enabled config file for SeaBIOS and use it in defconfig 92/1892/2
Stefan Reinauer [Wed, 1 Jun 2011 18:11:03 +0000 (11:11 -0700)]
Add a coreboot enabled config file for SeaBIOS and use it in defconfig

Right now SeaBIOS defaults to some wrong options during our build. This
adds a default config file that can hold our configuration.

TEST=check .config file after building, should contain CONFIG_COREBOOT=y

Change-Id: I2595346c9a887a0f5194f9ccf66eb7c9b2e4b008

3 years agoAdd support for OXPCIe PCIe serial port cards 84/1184/3 0.13.587.B
Stefan Reinauer [Thu, 19 May 2011 18:30:23 +0000 (11:30 -0700)]
Add support for OXPCIe PCIe serial port cards

SeaBIOS right now only supports IO mapped standard PC serial ports
for debugging. This patch adds support for using the Startech Mini PCIe
cards on systems without a functional onboard UART.

TEST=boot coreboot on Alex with Startech PCIe serial adapter and see output

Change-Id: Ic36029704c6c721ff69fce72934c1df36686cb78

4 years agoMerge "Fix seabios build problems." 0.13.558.B
Vadim Bendebury [Mon, 23 May 2011 21:39:11 +0000 (14:39 -0700)]
Merge "Fix seabios build problems."

4 years agoFix seabios build problems. 83/1383/1
Vadim Bendebury [Mon, 23 May 2011 20:39:40 +0000 (13:39 -0700)]
Fix seabios build problems.

When compiling seabios under ebuild control some compilation
warnings and util script problems are reported.

This CL fixes the problems. Emerging the package shows the is ran multiple times, this does not seem to be a
make concurrency problem, as it is ran twice even when -j 1 make
option is specified. chromium-os:15658 is opened to track this


While in chroot:

- run `emerge-x86-generic chromeos-seabios --board=x86-generic'
- observe the contents of /build/x86-generic/u-boot:
  ~/trunk/src/scripts $ ls /build/x86-generic/u-boot/
  ~/trunk/src/scripts $

Change-Id: I42ed15230e2bc9aaac6bc9f87b795b9a975fede8
Signed-off-by: Vadim Bendebury <>
4 years agoMerge "Add option rom PCI ID mapping to SeaBIOS"
Stefan Reinauer [Fri, 20 May 2011 17:47:04 +0000 (10:47 -0700)]
Merge "Add option rom PCI ID mapping to SeaBIOS"

4 years agoAdd option rom PCI ID mapping to SeaBIOS 97/1197/2
Stefan Reinauer [Thu, 19 May 2011 20:11:37 +0000 (13:11 -0700)]
Add option rom PCI ID mapping to SeaBIOS

Some PCI option roms don't contain the correct PCI ID for the device used in a
given system. In order to use those PCI option roms without manipulating them,
do an internal mapping of known good ID combinations.

TEST=boot coreboot with SeaBIOS CSM on Alex (requires more CLs)

Change-Id: I5908aa66e0cba5d76d8255b2bb70c34348738e7b

4 years agoAdd int15 vga callback hooks for Google devices 03/1203/2
Stefan Reinauer [Thu, 19 May 2011 20:21:13 +0000 (13:21 -0700)]
Add int15 vga callback hooks for Google devices

VGA option roms call back into the main BIOS in order to find out some
mainboard specific settings like the display resolution of an LCD or the
CMOS configuration of which output to use. On our devices, we don't need
to fully implement those call backs, however they need to be there in order
to pass VGA option rom execution or we will end up without VGA output.

TEST=boot coreboot on Alex

Change-Id: Id98dcb7ebb9d5bd3fd2fe89a637f42f5a52988cc

4 years agoPrint E820 type names as well as numbers, as a debug aid
Ian Campbell [Fri, 13 May 2011 15:30:55 +0000 (16:30 +0100)]
Print E820 type names as well as numbers, as a debug aid

Signed-off-by: Ian Campbell <>
4 years agoAdd Kconfig option to specify which serial port when serial debugging.
Kevin O'Connor [Wed, 11 May 2011 03:36:11 +0000 (23:36 -0400)]
Add Kconfig option to specify which serial port when serial debugging.

4 years agoAdd config option (CONFIG_BOOTORDER) to disable bootorder support.
Kevin O'Connor [Wed, 11 May 2011 02:08:30 +0000 (22:08 -0400)]
Add config option (CONFIG_BOOTORDER) to disable bootorder support.

4 years agoMove ps2ctr manipulation from mouse.c to ps2port.c.
Kevin O'Connor [Sat, 7 May 2011 18:19:29 +0000 (14:19 -0400)]
Move ps2ctr manipulation from mouse.c to ps2port.c.

This simplifies the mouse.c code.  It also prevents USB mouse
interaction from changing the ps2 port setup.

4 years agoMinor Kconfig help update.
Kevin O'Connor [Sat, 7 May 2011 17:57:42 +0000 (13:57 -0400)]
Minor Kconfig help update.

4 years agoFix struct bregs - it shouldn't have multiple members with the same name.
Kevin O'Connor [Sat, 7 May 2011 17:56:48 +0000 (13:56 -0400)]
Fix struct bregs - it shouldn't have multiple members with the same name.

This fixes a compile error on gcc 4.6.

4 years agoAdd config option to permit running option roms with bad checksums.
Kevin O'Connor [Mon, 7 Mar 2011 00:22:46 +0000 (19:22 -0500)]
Add config option to permit running option roms with bad checksums.

Based on a patch by: Stefan Reinauer <>

4 years agoAdd config option to disable MTRR initialization.
Kevin O'Connor [Mon, 7 Mar 2011 00:06:48 +0000 (19:06 -0500)]
Add config option to disable MTRR initialization.

Some versions of Bochs don't like the MTRR initialization, so add
CONFIG_MTRR_INIT to control whether SeaBIOS will touch the MTRRs.

4 years agoPrep version for next release.
Kevin O'Connor [Sun, 6 Mar 2011 23:26:13 +0000 (18:26 -0500)]
Prep version for next release.

4 years agoUpdate version to 0.6.2
Kevin O'Connor [Tue, 1 Mar 2011 02:09:34 +0000 (21:09 -0500)]
Update version to 0.6.2

4 years agolets pretend that RTC can be used to wakeup from S4
Gleb Natapov [Sun, 30 Jan 2011 12:17:11 +0000 (14:17 +0200)]
lets pretend that RTC can be used to wakeup from S4

WHQL complains otherwise.

Signed-off-by: Gleb Natapov <>
4 years agoExpand user configurable parameters in Kconfig.
Kevin O'Connor [Sat, 29 Jan 2011 15:57:20 +0000 (10:57 -0500)]
Expand user configurable parameters in Kconfig.

Move most of the config settings in config.h to the Kconfig file.  The
remaining settings in config.h, are mostly build related.

4 years agoSupport non-local build directory - allow "make OUT=abc/" to work.
Kevin O'Connor [Sat, 29 Jan 2011 16:26:54 +0000 (11:26 -0500)]
Support non-local build directory - allow "make OUT=abc/" to work.

Don't require the build directory to be the "out/" directory of the
SeaBIOS source.

4 years agoThe vgabios build must depend on autoconf.h.
Kevin O'Connor [Sat, 29 Jan 2011 16:24:58 +0000 (11:24 -0500)]
The vgabios build must depend on autoconf.h.

4 years agofix parallel compilation of SeaBIOS
Stefan Reinauer [Fri, 28 Jan 2011 02:39:01 +0000 (18:39 -0800)]
fix parallel compilation of SeaBIOS

See patch.

Signed-off-by: Stefan Reinauer <>
4 years agoStart using Kconfig to configure SeaBIOS settings.
Kevin O'Connor [Thu, 27 Jan 2011 02:19:25 +0000 (21:19 -0500)]
Start using Kconfig to configure SeaBIOS settings.

Create autoconf.h during the build.

Move a couple of config settings from config.h to Kconfig.

4 years agoChange kconfig to emit disabled symbols in autoconf.h.
Kevin O'Connor [Thu, 27 Jan 2011 01:09:39 +0000 (20:09 -0500)]
Change kconfig to emit disabled symbols in autoconf.h.

Always emit CONFIG_X definitions in autoconf.h - set them to 0 when
they are disabled.

4 years agoBuild changes for Linux kconfig code to work in seabios dir structure.
Kevin O'Connor [Thu, 27 Jan 2011 02:14:59 +0000 (21:14 -0500)]
Build changes for Linux kconfig code to work in seabios dir structure.

4 years agoInitial commit of Kconfig build tool.
Kevin O'Connor [Tue, 25 Jan 2011 03:13:58 +0000 (22:13 -0500)]
Initial commit of Kconfig build tool.

This is a pure copy of the tool from the Linux v2.6.38-rc2
scripts/kconfig/ directory.

4 years agoMinor boot fixes.
Kevin O'Connor [Thu, 27 Jan 2011 02:04:01 +0000 (21:04 -0500)]
Minor boot fixes.

4 years agoMinor comment / code layout improvement to romlayout.S.
Kevin O'Connor [Sat, 22 Jan 2011 15:53:48 +0000 (10:53 -0500)]
Minor comment / code layout improvement to romlayout.S.

4 years agoFix to prevent infinite loop in build_pci_path().
Kevin O'Connor [Sat, 22 Jan 2011 15:53:08 +0000 (10:53 -0500)]
Fix to prevent infinite loop in build_pci_path().

Make sure the PCI path doesn't point to itself.

4 years agosupport T13 EDD3.0 spec
Gleb Natapov [Mon, 10 Jan 2011 08:50:27 +0000 (10:50 +0200)]
support T13 EDD3.0 spec

Some guests (such as Linux) expect BIOS to behave according to T13
EDD3.0 spec. T13 spec is much better then Phoenix since it provides
more information about interface and device paths. This patch adds
support for the spec. If guest provides buffer with enough space for
T13 EDD info return EDD according to T13 spec otherwise use Phoenix

Signed-off-by: Gleb Natapov <>
4 years agoAdd ability to track PCI paths and add to build_pci_path().
Kevin O'Connor [Mon, 10 Jan 2011 05:48:45 +0000 (00:48 -0500)]
Add ability to track PCI paths and add to build_pci_path().

Improve device path descriptions of devices on PCI buses.

4 years agoMove the CBFS payload setup to later in the boot.
Kevin O'Connor [Sat, 8 Jan 2011 17:24:39 +0000 (12:24 -0500)]
Move the CBFS payload setup to later in the boot.

Don't try to register payloads until after malloc has been setup.

4 years agoExtract space trimming code from ATA and use in USB and bootorder code.
Kevin O'Connor [Sat, 8 Jan 2011 17:06:54 +0000 (12:06 -0500)]
Extract space trimming code from ATA and use in USB and bootorder code.

Introduce function nullTrailingSpace() that nulls blank characters
from the end of a string.  Use this function in the ATA, USB MSC, and
bootorder code.

4 years agoseabios: acpi: add _RMV control method for PCI devices
Kevin O'Connor [Thu, 6 Jan 2011 02:25:18 +0000 (21:25 -0500)]
seabios: acpi: add _RMV control method for PCI devices

Use _RMV method to indicate whether device can be removed.

Data is retrieved from QEMU via I/O port 0xae0c.

Signed-off-by: Marcelo Tosatti <>
Acked-by: Gleb Natapov <>
4 years agoAdd support for finding the boot priority of USB drives.
Kevin O'Connor [Fri, 31 Dec 2010 19:38:10 +0000 (14:38 -0500)]
Add support for finding the boot priority of USB drives.

Use the device path of the USB device to find a bootorder entry.

4 years agoExtend 'usb_pipe' to track the controller and ports of each device.
Kevin O'Connor [Fri, 31 Dec 2010 19:35:26 +0000 (14:35 -0500)]
Extend 'usb_pipe' to track the controller and ports of each device.

Track the path of ports and controller of each usb device.  This is
useful for reporting the exact device path.

4 years agoAdd functions for boot device path parsing.
Kevin O'Connor [Sat, 1 Jan 2011 16:00:42 +0000 (11:00 -0500)]
Add functions for boot device path parsing.

Add functions that find boot device path for pci/ata/floppy/rom devices.

4 years agoUse bootprio_find_named_rom() for ramdisk and cbfs payload priorities.
Kevin O'Connor [Thu, 30 Dec 2010 02:59:44 +0000 (21:59 -0500)]
Use bootprio_find_named_rom() for ramdisk and cbfs payload priorities.

4 years agoRemove drive->desc field.
Kevin O'Connor [Thu, 30 Dec 2010 02:41:19 +0000 (21:41 -0500)]
Remove drive->desc field.

The description field is only available during the POST phase - it is
confusing to have it live in a structure available through all phases.

The description was only used by the boot menu code - pass each drive
description directly to the bootlist code.

Add a helper (znprintf) to automatically malloc_tmp the required

Also, fixup ramdisk handling - it was using an incorrect floppy

4 years agoMinor reorganization of some of the boot_xxx code in boot.c.
Kevin O'Connor [Wed, 29 Dec 2010 16:52:33 +0000 (11:52 -0500)]
Minor reorganization of some of the boot_xxx code in boot.c.

4 years agoMove IPL.fw_bootorder to static variables in boot.c.
Kevin O'Connor [Wed, 29 Dec 2010 16:37:41 +0000 (11:37 -0500)]
Move IPL.fw_bootorder to static variables in boot.c.

4 years agoMove IPL.bev to static variables in boot.c
Kevin O'Connor [Wed, 29 Dec 2010 16:25:14 +0000 (11:25 -0500)]
Move IPL.bev to static variables in boot.c

Move the BEV storage to static variables in boot.c.

Also, increase the maximum number of BEV entries from 8 to 20.

4 years agoMove IPL.checkfloppysig to a global (CheckFloppySig) in boot.c.
Kevin O'Connor [Wed, 29 Dec 2010 16:18:04 +0000 (11:18 -0500)]
Move IPL.checkfloppysig to a global (CheckFloppySig) in boot.c.

4 years agoRemove Drives global struct in favor of independent global variables.
Kevin O'Connor [Wed, 29 Dec 2010 16:05:46 +0000 (11:05 -0500)]
Remove Drives global struct in favor of independent global variables.

The "Drives" struct just held three global variables - declare the
three global variables independently.

4 years agoDon't access drive_g->desc from boot_cdrom().
Kevin O'Connor [Wed, 29 Dec 2010 18:26:01 +0000 (13:26 -0500)]
Don't access drive_g->desc from boot_cdrom().

The drive description is allocated with malloc_tmp() and is thus only
available during the POST phase - boot_cdrom() is called during the
boot phase.

4 years agoSimplify keyboard reading code in the interactive boot menu.
Kevin O'Connor [Wed, 29 Dec 2010 18:25:18 +0000 (13:25 -0500)]
Simplify keyboard reading code in the interactive boot menu.

4 years agoCall setup_translation() from map_hd_drive().
Kevin O'Connor [Tue, 28 Dec 2010 02:08:53 +0000 (21:08 -0500)]
Call setup_translation() from map_hd_drive().

Unify the calling of setup_translation().

4 years agoRename add_ordered_drive() to add_drive() and use in map_hd_drive().
Kevin O'Connor [Mon, 27 Dec 2010 13:37:38 +0000 (08:37 -0500)]
Rename add_ordered_drive() to add_drive() and use in map_hd_drive().

4 years agoAdd stubs to permit devices to specify their boot priority.
Kevin O'Connor [Tue, 28 Dec 2010 00:26:57 +0000 (19:26 -0500)]
Add stubs to permit devices to specify their boot priority.

Add support for passing in priorities to bootlist system.

Based on patch by: Gleb Natapov <>

4 years agoSimplify boot ordering by building an inclusive boot list.
Kevin O'Connor [Tue, 28 Dec 2010 00:07:49 +0000 (19:07 -0500)]
Simplify boot ordering by building an inclusive boot list.

Replace the bcv list with a full list of all "bootable objects".  All
ordering can then be done on this list.  The final boot menu, drive
mapping, and BEV list generation is then driven from this
authoritative list.

Move "Floppy" and "DVD/CD" description prefixes into drive description
generation code to simplify boot menu generation.

Rework QEMU's CMOS defined bootorder to work with priority scheme in
new boot list.

Have every CBFS entry create it's own BEV entry (instead of one entry
for all CBFS payloads).  Move CBFS payload detection code into

4 years agoPopulate drive_g->desc prior to calling add_bcv_internal().
Kevin O'Connor [Sun, 26 Dec 2010 22:22:28 +0000 (17:22 -0500)]
Populate drive_g->desc prior to calling add_bcv_internal().

Make sure the description is populated before registering a drive.

4 years agopciinit: fix off-by-one
Isaku Yamahata [Fri, 24 Dec 2010 01:51:08 +0000 (10:51 +0900)]
pciinit: fix off-by-one

IO port ends at 64K - 1. not 64K.

Signed-off-by: Isaku Yamahata <>
4 years agoMinor build fixes.
Kevin O'Connor [Sun, 26 Dec 2010 19:16:22 +0000 (14:16 -0500)]
Minor build fixes.

I made these two tiny changes to SeaBIOS when I was playing with the
HEAD version.

The Makefile change prevents the test command from failing if CC
contains a space.

The coreboot change prevents a warning on our gcc 4.5.2 in certain
circumstances when sizeof seems to be unsigned long int instead of
unsigned int.

They're both unintrusive, shouldn't have potential for breaking

Signed-off-by: Stefan Reinauer <>
4 years agoTrack the source of each optionrom deployed.
Kevin O'Connor [Fri, 24 Dec 2010 19:42:42 +0000 (14:42 -0500)]
Track the source of each optionrom deployed.

It's useful to track where each optionrom in the system originated
from when initializing bev/bcvs.  So, keep a map of the rom address to
its source.

4 years agoSupport qemu based romfile wrappers called out of order.
Kevin O'Connor [Fri, 24 Dec 2010 18:53:32 +0000 (13:53 -0500)]
Support qemu based romfile wrappers called out of order.

If the file requested isn't the last file read, then reread the index
to find the given file.

4 years agoBreakup boot_setup() bootorder code into its own function.
Kevin O'Connor [Fri, 24 Dec 2010 16:17:03 +0000 (11:17 -0500)]
Breakup boot_setup() bootorder code into its own function.

4 years agoAdd romfile_loadfile() helper function.
Kevin O'Connor [Fri, 24 Dec 2010 16:15:26 +0000 (11:15 -0500)]
Add romfile_loadfile() helper function.

Add function to find, malloc, and copy a romfile.  Use it in the
bootsplash and bootorder code.

4 years agoRead bootorder file into memory.
Gleb Natapov [Thu, 23 Dec 2010 09:29:38 +0000 (11:29 +0200)]
Read bootorder file into memory.

Read bootorder file, parse it and put it into array for easy

Signed-off-by: Gleb Natapov <>
4 years agoAdd strchr() function.
Kevin O'Connor [Fri, 24 Dec 2010 15:39:32 +0000 (10:39 -0500)]
Add strchr() function.

4 years agoAdd romfile_name() function.
Gleb Natapov [Thu, 23 Dec 2010 09:29:39 +0000 (11:29 +0200)]
Add romfile_name() function.

romfile_name() return file name given file handler. Works for qemu and

Signed-off-by: Gleb Natapov <>
4 years agoAdd BAID for ahci cdrom.
Gleb Natapov [Thu, 23 Dec 2010 09:29:36 +0000 (11:29 +0200)]
Add BAID for ahci cdrom.

Signed-off-by: Gleb Natapov <>
4 years agoProvide full EDD 3.0 info for virtio disk
Gleb Natapov [Thu, 23 Dec 2010 09:29:35 +0000 (11:29 +0200)]
Provide full EDD 3.0 info for virtio disk

Fill out entire EDD 3.0 structure for virtio disk. Currently only EDD 1.0
part is filled which is missing such important info as device path. Use
SCSI device type since virtio is not defined by EDD spec and virtio disk pci
device uses SCSI class.

Signed-off-by: Gleb Natapov <>
4 years agoEnhance to work around a binutils quirk.
Kevin O'Connor [Fri, 24 Dec 2010 15:23:10 +0000 (10:23 -0500)]
Enhance to work around a binutils quirk.

Some binutils (report of 2.20.1) don't create dummy symbols for each
section - work around that.

4 years agoCreate separate IPL entry for each CD/DVD
Gleb Natapov [Tue, 7 Dec 2010 11:50:54 +0000 (13:50 +0200)]
Create separate IPL entry for each CD/DVD

Current code creates only one IPL entry of type IPL_TYPE_CDROM even if
there are more then one CDROM drive present. If CDROM that the entry
refers to is not bootable there is no way to retry boot from another
CDROM. Fix this by creating IPL entry for each CDROM drive found. First
CDROM will always be placed in IPL entry 3 for backwards compatibility.

Signed-off-by: Gleb Natapov <>
4 years agoahci: set controller id
Gerd Hoffmann [Thu, 9 Dec 2010 07:39:48 +0000 (08:39 +0100)]
ahci: set controller id

Fill the controller id in the drive struct with the port number so we
get a sane boot menu ordering with multiple hard disks attached.

Signed-off-by: Gerd Hoffmann <>
4 years agoahci: fix off-by-one in port count
Gerd Hoffmann [Thu, 9 Dec 2010 07:39:47 +0000 (08:39 +0100)]
ahci: fix off-by-one in port count

Signed-off-by: Gerd Hoffmann <>
4 years agoahci: enable io/mem/dma
Kevin O'Connor [Sun, 12 Dec 2010 19:01:47 +0000 (14:01 -0500)]
ahci: enable io/mem/dma

Make sure IO, MMIO and DMA are enabled in pci config space
before using the device.

Signed-off-by: Gerd Hoffmann <>
4 years agoahci: set dma feature flag
Gerd Hoffmann [Thu, 9 Dec 2010 07:39:45 +0000 (08:39 +0100)]
ahci: set dma feature flag

Signed-off-by: Gerd Hoffmann <>
4 years agoCheck if capability enabled in XXX_cmd_data functions.
Kevin O'Connor [Sun, 5 Dec 2010 17:52:02 +0000 (12:52 -0500)]
Check if capability enabled in XXX_cmd_data functions.

Make sure to check if CONFIG_AHCI, CONFIG_ATA, CONFIG_USB_MSC is
enabled in their respective cmd_data functions.  This reduces the
compile size when they are not enabled.

4 years agoRequire a "_cfuncXX_" symbol prefix for inter-mode c function references.
Kevin O'Connor [Sun, 5 Dec 2010 17:38:33 +0000 (12:38 -0500)]
Require a "_cfuncXX_" symbol prefix for inter-mode c function references.

The compiler can get confused when referencing a C function in a
different mode.  (It reasonably assumes that the C function in the
current mode is desired.)  To avoid this compiler confusion, introduce
symbol prefixes (_cfunc16_, _cfunc32flat_, _cfunc32seg_) that must be
used on C function symbols that are referenced from other compilation

This makes it less likely compiler confusion will occur.  It will also
makes it easier to implement and use vtable like operation structures.

4 years agoadd ahci support
Gerd Hoffmann [Mon, 29 Nov 2010 08:42:13 +0000 (09:42 +0100)]
add ahci support

This patch adds AHCI support to seabios.  Tested with virtual hardware
only (upcoming ahci support in qemu).  Coded by looking at the
recommandations in the intel ahci specs, so I don't expect much trouble
on real hardware.  Tested booting fedora install from hard disk and a
opensuse live iso from cdrom.

[ v2: disable by default           ]
[ v2: add check for malloc failure ]
[ v2: wind up disk write support   ]

Signed-off-by: Gerd Hoffmann <>
4 years agoata: make helpers available
Gerd Hoffmann [Mon, 29 Nov 2010 08:42:12 +0000 (09:42 +0100)]
ata: make helpers available

Make ata helper functions available outside ata.c, so others (i.e.
upcoming ahci support) can use them.  Prefix them with ata_ to avoid
name clashes.  Also don't hard-code buffer size for the model name.

Signed-off-by: Gerd Hoffmann <>
4 years agoutil: add memset_fl()
Gerd Hoffmann [Mon, 29 Nov 2010 08:42:11 +0000 (09:42 +0100)]
util: add memset_fl()

4 years agopci: add helper functions for mmio bar access from real mode.
Gerd Hoffmann [Mon, 29 Nov 2010 08:42:10 +0000 (09:42 +0100)]
pci: add helper functions for mmio bar access from real mode.

This patch adds helper pci_readl and pci_writel which can be used
to access pci mmio bars from real mode.  They work in 32bit mode
too.  ahci support needs this, also ohci for bulk transfers, and
probably more devices in the future.

Signed-off-by: Gerd Hoffmann <>
4 years agoEnhance call32() to pass a parameter to called function.
Kevin O'Connor [Thu, 25 Nov 2010 14:17:31 +0000 (09:17 -0500)]
Enhance call32() to pass a parameter to called function.

Support passing a parameter to the 32bit function, as well as
returning the result of the function back to the 16bit code.

Also, make call32 available outside of stacks.c.

4 years agoDon't pass return address to transition(32,16,16big) on stack.
Kevin O'Connor [Thu, 25 Nov 2010 13:52:50 +0000 (08:52 -0500)]
Don't pass return address to transition(32,16,16big) on stack.

It's difficult to have a uniform view of the stack when transition
modes, so pass the return address in a register.  As a result, the
transition functions only access memory via the %cs selector now.

4 years agopciinit: use pci_region functions.
Isaku Yamahata [Thu, 28 Oct 2010 06:54:36 +0000 (15:54 +0900)]
pciinit: use pci_region functions.

This patch cleans up pci region allocation with pci_region.
Now it is aware of overflow.

Signed-off-by: Isaku Yamahata <>
4 years agopci: introduce pci_region to manage pci io/memory/prefmemory regions.
Isaku Yamahata [Thu, 28 Oct 2010 06:54:35 +0000 (15:54 +0900)]
pci: introduce pci_region to manage pci io/memory/prefmemory regions.

This patch adds helper functions to manage pci area.

Signed-off-by: Isaku Yamahata <>
4 years agomark irq9 active high in DSDT
Kevin O'Connor [Thu, 21 Oct 2010 01:59:11 +0000 (21:59 -0400)]
mark irq9 active high in DSDT

In PIIX4 SCI (irq9) is active high. Seabios marks it so in interrupt
override table, but some OSes (FreeBSD) require the same information to
be present in DSDT too. Make it so.

Signed-off-by: Gleb Natapov <>
4 years agoReport meaningful error if pyserial not present in tools/
Kevin O'Connor [Mon, 18 Oct 2010 01:38:38 +0000 (21:38 -0400)]
Report meaningful error if pyserial not present in tools/

4 years agoShow size of non-relocatable runtime code during build.
Kevin O'Connor [Sun, 26 Sep 2010 22:32:13 +0000 (18:32 -0400)]
Show size of non-relocatable runtime code during build.

4 years agoCleanup - it's no longer necessary to manually reset global variables.
Kevin O'Connor [Sat, 25 Sep 2010 18:53:15 +0000 (14:53 -0400)]
Cleanup - it's no longer necessary to manually reset global variables.

Now that a soft-reboot forces a hard-reboot, it is no longer necessary
to manually reset global variables.

4 years agoAllow rom to grow to 256K.
Kevin O'Connor [Sat, 25 Sep 2010 16:48:43 +0000 (12:48 -0400)]
Allow rom to grow to 256K.

Enable rom size to be over 128K.

Apparently, only the first 128K of the rom are mirrored to the
0xc0000-0xfffff area under qemu, so make sure to copy the rom (via
make_bios_writable) in the non-init part of the startup code.  This
ensure the copy code is itself available.

4 years agoFix typo preventing relocated space from being used for option roms.
Kevin O'Connor [Sat, 25 Sep 2010 16:46:38 +0000 (12:46 -0400)]
Fix typo preventing relocated space from being used for option roms.

4 years agofix virtio-blk failure after reboot
Gleb Natapov [Wed, 15 Sep 2010 16:31:44 +0000 (18:31 +0200)]
fix virtio-blk failure after reboot

vring_virtqueue should be zeroed otherwise old values will be reused
after reboot.

Signed-off-by: Gleb Natapov <>
4 years agoAdd a debug method to AML code.
Kevin O'Connor [Mon, 20 Sep 2010 02:13:18 +0000 (22:13 -0400)]
Add a debug method to AML code.

Add DBUG() method to AML - it can write output to the standard qemu
bios debug port (port 0x402).

4 years agoWarn that ohci bulk is not supported.
Kevin O'Connor [Mon, 20 Sep 2010 02:10:08 +0000 (22:10 -0400)]
Warn that ohci bulk is not supported.

Print a meaningful warning message when trying to use OHCI bulk.

4 years agoEnable optionroms to use freed space due to CONFIG_RELOCATE_INIT.
Kevin O'Connor [Thu, 16 Sep 2010 02:06:19 +0000 (22:06 -0400)]
Enable optionroms to use freed space due to CONFIG_RELOCATE_INIT.

The space in the e-segment is available for option roms after
relocating the init code.

Also, zero all of the option rom space when !CONFIG_OPTIONROMS_DEPLOYED.

4 years agoMove the 32bit init code to high memory at runtime.
Kevin O'Connor [Sat, 25 Sep 2010 15:34:06 +0000 (11:34 -0400)]
Move the 32bit init code to high memory at runtime.

Add support for moving the 32bit init code out of the e/f-segments and
into temporary ram.  Update the relocations in the code so that it can
live at its new address.

This frees up memory for other uses in the e/f segments.

4 years agoMove init code from _start() to post().
Kevin O'Connor [Thu, 16 Sep 2010 01:59:11 +0000 (21:59 -0400)]
Move init code from _start() to post().

Move the shadow calls from _start() to post() - this ensures all the
one time init code is in post().

Also, reorg post so that malloc setup is done before ivt/bda/ebda

This is in preparation for relocating the 32bit flat init code.

4 years agoAdd memalign_tmp() helper function.
Kevin O'Connor [Wed, 15 Sep 2010 04:25:32 +0000 (00:25 -0400)]
Add memalign_tmp() helper function.

4 years agoTry to hard-reboot on rerun of post even on emulators.
Kevin O'Connor [Thu, 16 Sep 2010 01:48:16 +0000 (21:48 -0400)]
Try to hard-reboot on rerun of post even on emulators.

Extend the hard-reboot logic to qemu and kvm.  On qemu, a reboot will
not reset the memory settings for 0xc0000-0xfffff, so copy that memory
area manually before rebooting.  Unfortunately, kvm does not keep a
pristine copy of the BIOS at 0xffff0000, so detect that case and
shutdown the machine.

4 years agoDon't do shadow copying of optionroms when CONFIG_OPTIONROMS_DEPLOYED.
Kevin O'Connor [Tue, 14 Sep 2010 01:19:27 +0000 (21:19 -0400)]
Don't do shadow copying of optionroms when CONFIG_OPTIONROMS_DEPLOYED.

When CONFIG_OPTIONROMS_DEPLOYED is set, there is no need to copy the
0xc0000-0xf0000 space around - SeaBIOS ignores what's there when it
that mode.

4 years agoTry to hard-reboot processor on rerun of post under coreboot.
Kevin O'Connor [Tue, 14 Sep 2010 00:22:07 +0000 (20:22 -0400)]
Try to hard-reboot processor on rerun of post under coreboot.

Add several methods for rebooting a processor.

Detect a rerun of POST under coreboot and attempt to reboot the

4 years agoEnhance build to emit relocation information.
Kevin O'Connor [Wed, 15 Sep 2010 04:26:19 +0000 (00:26 -0400)]
Enhance build to emit relocation information.

Add support for determining which relocations need to be adjusted to
relocate the "32bit flat init" code.  Place those relocations in the
output object.

4 years agoSeparate out init code from the rest of the 32bit flat code.
Kevin O'Connor [Thu, 16 Sep 2010 01:38:16 +0000 (21:38 -0400)]
Separate out init code from the rest of the 32bit flat code.

Enhance tools/ code so that it can detect which sections
are used from the "32bit flat" runtime code.  All other "32bit flat"
sections can then be assured to be initialization code only.

This is in preparation for relocating the 32bit initialization code.