]> xenbits.xensource.com Git - seabios.git/log
seabios.git
10 years agoDon't enable thread preemption during S3 resume vga option rom execution.
Kevin O'Connor [Sat, 24 May 2014 13:37:57 +0000 (09:37 -0400)]
Don't enable thread preemption during S3 resume vga option rom execution.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
(cherry picked from commit dd7527c6f51fff199285f1e1cdb3e8e16bd1781b)

10 years agovgabios: Return from handle_1011() if handler found.
Kevin O'Connor [Wed, 28 May 2014 13:09:05 +0000 (09:09 -0400)]
vgabios: Return from handle_1011() if handler found.

Fix cut-and-paste error in handle_1011() causing spurious debug_stub()
calls when CONFIG_VGA_STDVGA_PORTS is enabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
(cherry picked from commit c58799cbee6a7a97ad8253494232da29b4a1b275)

10 years agoboot: Change ":rom%d" boot order rom instance to ":rom%x"
Kevin O'Connor [Fri, 15 Aug 2014 13:52:43 +0000 (09:52 -0400)]
boot: Change ":rom%d" boot order rom instance to ":rom%x"

Use hex numbers for the rom instance count in boot order open firmware
device naming.  The ":rom" suffix isn't part of a standard and it's
highly unlikely any rom would have 10 or more drives on it, but this
change makes the code more similar to the numbering of other boot
order devices.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
(cherry picked from commit e710447ef1d2bd4e61e12b210039c00fbeacf624)

10 years agoboot: Fix boot order for SCSI target, lun > 9
Markus Armbruster [Fri, 15 Aug 2014 06:58:17 +0000 (08:58 +0200)]
boot: Fix boot order for SCSI target, lun > 9

We identify devices by their Open Firmware device paths.  The path
component for the logical unit on a bus is incorrect:
bootprio_find_scsi_device() and bootprio_find_usb() format target
(a.k.a. SCSI ID) and lun in decimal, while QEMU uses hexadecimal.
Bootorder list entries with target, lun > 9 aren't found (lucky case),
or attributed to the wrong logical unit (unlucky case).

The relevant spec[*] agrees with QEMU (and OVMF, for that matter).
Change %d to %x.

No actual impact on USB, because QEMU only uses LUN 0 there.

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1096560

[*] Open Firmware Recommended Practice: SCSI-3 Parallel Interface,
Version 1, Section 3.1 Physical Address Formats and Representations
http://www.openfirmware.org/1275/practice/spi/spi1_0.ps
IEEE Standard for Boot (Initialization Configuration) Firmware: Core
Requirements and Practices, IEEE Std 1275-1994, Annex E SCSI host
adapter package class, section E.2.1 Physical address formats and
representations

Signed-off-by: Markus Armbruster <armbru@redhat.com>
(cherry picked from commit 275672eb70efdf81c51b997d41a4409b404aa8f6)

10 years agohw/pci: reserve IO and mem for pci express downstream ports with no devices attached
Marcel Apfelbaum [Mon, 23 Jun 2014 15:29:51 +0000 (18:29 +0300)]
hw/pci: reserve IO and mem for pci express downstream ports with no devices attached

Commit c6e298e1f12e0f4ca02b6da5e42919ae055f6830
    hw/pci: reserve IO and mem for pci-2-pci bridges with no devices attached

introduced support for hot-plugging devices behind pci-2-pci bridges.
Extend hotplug support also for pci express downstream ports.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 3aa31d7d6375303fc88438021aad485f50bb1e39)

10 years agopython3 fixes for vgabios and csm builds. rel-1.7.5
Kevin O'Connor [Thu, 22 May 2014 20:59:16 +0000 (16:59 -0400)]
python3 fixes for vgabios and csm builds.

Avoid using chr() as this produces unicode strings on python3.  Make
sure to only use ord() on slices as the python3 bytearray type returns
an integer on a non-slice array access.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoAllow using full io region on q35.
Gerd Hoffmann [Tue, 13 May 2014 12:09:00 +0000 (14:09 +0200)]
Allow using full io region on q35.

If qemu is new enough to support acpi table loading,
then go move pmbase out of the way.  This allows to
use the whole 0x1000 -> 0xffff io address space on q35.
piix has hotplug ports in the 0xa000 -> 0xafff area,
so we can't do the same there.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoacpi: remove PORT_ACPI_PM_BASE constant
Gerd Hoffmann [Tue, 13 May 2014 12:01:22 +0000 (14:01 +0200)]
acpi: remove PORT_ACPI_PM_BASE constant

Use the new acpi_pm_base variable instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agosmm: remove code to handle ACPI disable/enable
Paolo Bonzini [Thu, 15 May 2014 11:22:27 +0000 (13:22 +0200)]
smm: remove code to handle ACPI disable/enable

This is handled already in QEMU, no need to do it in SMM.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agovgabios: Add debug message if x86emu leal check triggers.
Kevin O'Connor [Mon, 12 May 2014 05:26:26 +0000 (01:26 -0400)]
vgabios: Add debug message if x86emu leal check triggers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoacpi: Fix acpi dsdt compile warning. rel-1.7.5-rc1
Kevin O'Connor [Fri, 9 May 2014 13:18:31 +0000 (09:18 -0400)]
acpi: Fix acpi dsdt compile warning.

The _EJ0 method should not return a value.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoFix int 1589 calls when CONFIG_ENTRY_EXTRASTACK is enabled.
Kevin O'Connor [Thu, 8 May 2014 22:32:32 +0000 (18:32 -0400)]
Fix int 1589 calls when CONFIG_ENTRY_EXTRASTACK is enabled.

The int 1589 call is entered in real mode and returns in protected
mode.  However, the code to use the "extra stack" does not support
that.  Fix this by never using the "extra stack" on int 1589 calls.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agobuild: Make sure romlayout.o is recompiled on Kconfig change.
Kevin O'Connor [Thu, 8 May 2014 22:24:17 +0000 (18:24 -0400)]
build: Make sure romlayout.o is recompiled on Kconfig change.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Use msleep() instead of mdelay() for port status delay.
Kevin O'Connor [Thu, 8 May 2014 21:59:55 +0000 (17:59 -0400)]
xhci: Use msleep() instead of mdelay() for port status delay.

Use msleep() so that interrupts and other threads can occur during the
delay.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agold: don't hardcode "-melf_i386"
Roger Pau Monne [Wed, 16 Apr 2014 07:14:16 +0000 (09:14 +0200)]
ld: don't hardcode "-melf_i386"

On FreeBSD, the name of the emulation is "-melf_i386_fbsd", so allow
SeaBIOS to fetch the emulation to use from the environment variables.

This allows SeaBIOS to compile on FreeBSD with gcc.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
11 years agoIf an int 1587 call is made from an option rom, stay in bigreal mode.
Kevin O'Connor [Sat, 19 Apr 2014 16:22:22 +0000 (12:22 -0400)]
If an int 1587 call is made from an option rom, stay in bigreal mode.

Modify the int 1587 handler to check if the POST phase is still
running.  If it is, use bigreal mode segment limits so that the caller
remains in bigreal mode when the 1587 handler completes.  This helps
with SeaVGABIOS' use of "direct" framebuffer accesses (an option rom
may attempt to display text during its option rom execution which can
cause SeaVGABIOS to make the int 1587 calls).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoSMBIOS: Check for aggregate tables & entry point in fw_cfg
Gabriel L. Somlo [Wed, 23 Apr 2014 19:04:49 +0000 (15:04 -0400)]
SMBIOS: Check for aggregate tables & entry point in fw_cfg

Check fw_cfg for the presence of an aggregate set of smbios
tables (etc/smbios/smbios-tables) and an entry point structure
(etc/smbios/smbios-anchor), and, if found, use them instead of
generating entries locally.

We ensure the presence of a type 0 (bios information) structure
by generating it locally if necessary, which is expected to be
the common case.

Signed-off-by: Gabriel L. Somlo <somlo@cmu.edu>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agohw/pci: check if pci2pci bridges implement optional limit registers
Marcel Apfelbaum [Thu, 10 Apr 2014 18:55:22 +0000 (21:55 +0300)]
hw/pci: check if pci2pci bridges implement optional limit registers

<I/O Base Register, I/O Limit Register> pair and
<Prefetchable Memory Base Register, Prefetchable Memory Limit Register> pair
are both optional.
Do not reserve ranges if the above registers are not implemented.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
11 years agohw/pci: reserve IO and mem for pci-2-pci bridges with no devices attached
Marcel Apfelbaum [Thu, 10 Apr 2014 18:55:21 +0000 (21:55 +0300)]
hw/pci: reserve IO and mem for pci-2-pci bridges with no devices attached

If a pci-2-pci bridge supports hot-plug functionality but there are no devices
connected to it, reserve IO/mem in order to be able to attach devices
later. Do not waste space, use minimum allowed.

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
11 years agovgabios: Define PlatformRunningOn to make compile happy.
Kevin O'Connor [Mon, 14 Apr 2014 14:46:34 +0000 (10:46 -0400)]
vgabios: Define PlatformRunningOn to make compile happy.

With CONFIG_COREBOOT=y, CONFIG_QEMU_HARDWARE=y, CONFIG_VGA_COREBOOT=y,
CONFIG_DEBUG_IO=y the compile would break because this variable was
missing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoFactor out smbios table walking from display_uuid to smbios_next().
Kevin O'Connor [Sat, 12 Apr 2014 15:56:21 +0000 (11:56 -0400)]
Factor out smbios table walking from display_uuid to smbios_next().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMinor - replace some tab characters that slipped into the code.
Kevin O'Connor [Fri, 11 Apr 2014 16:08:33 +0000 (12:08 -0400)]
Minor - replace some tab characters that slipped into the code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Initial support for coreboot native vga vgabios.
Kevin O'Connor [Tue, 11 Feb 2014 20:34:58 +0000 (15:34 -0500)]
vgabios: Initial support for coreboot native vga vgabios.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agocoreboot: Make coreboot table searching available to other code.
Kevin O'Connor [Tue, 11 Feb 2014 20:33:42 +0000 (15:33 -0500)]
coreboot: Make coreboot table searching available to other code.

Make the coreboot table searching code available to code outside
coreboot.c, and make it runnable from 16bit mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: PMM scan was incorrectly depending on a zero %ds segment.
Kevin O'Connor [Sun, 6 Apr 2014 22:48:39 +0000 (18:48 -0400)]
vgabios: PMM scan was incorrectly depending on a zero %ds segment.

Make sure the PMM scanning code uses the GET_FARVAR macro.  (The
existing code only worked because SeaBIOS happens to call the vgabios
in bigreal mode with %ds == %ss = 0.)  Also, the scan doesn't require
bigreal mode - use accesses relative to the SEG_BIOS segment so that
the scan can work in regular real mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoSet the color attribute when calling vgabios print character.
Kevin O'Connor [Sun, 6 Apr 2014 01:45:27 +0000 (21:45 -0400)]
Set the color attribute when calling vgabios print character.

Set the color attribute in case the SeaBIOS console code is used while
the vgabios is in a graphics mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Add support for manipulating framebuffers in high memory.
Kevin O'Connor [Sat, 5 Apr 2014 21:11:06 +0000 (17:11 -0400)]
vgabios: Add support for manipulating framebuffers in high memory.

Add code for manipulating "direct" style linear RGB framebuffers that
may be in high memory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Introduce text_address().
Kevin O'Connor [Sun, 6 Apr 2014 02:48:05 +0000 (22:48 -0400)]
vgabios: Introduce text_address().

Factor out code that calculates the text mode address of a given
character.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Rewrite vgafb.c graphics operations to set of 4 standard operators.
Kevin O'Connor [Mon, 24 Mar 2014 16:49:44 +0000 (12:49 -0400)]
vgabios: Rewrite vgafb.c graphics operations to set of 4 standard operators.

The vgabios graphics manipulations can all be implemented on top of 4
basic primitives: read 8 pixels, write 8 pixels, move pixels, and
clear pixels.  Implement these four operators for all the graphics
modes and rewrite the graphics functions in vgafb.c to use them.  This
simplifies the graphics code as the high level logic no longer needs
to be implemented for each graphical framebuffer type.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Split vgafb_scroll() into separate move and clear functions.
Kevin O'Connor [Fri, 21 Mar 2014 01:16:28 +0000 (21:16 -0400)]
vgabios: Split vgafb_scroll() into separate move and clear functions.

Rewrite the low-level scroll code so that it is implemented using two
basic operations: move text and clear text.  This simplifies the
low-level code as it no longer needs to handle up scrolling vs down
scrolling.  Determining the direction of the scroll is now done in the
higher level (vgabios.c) code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Add option to control use of standard VGA IO ports.
Kevin O'Connor [Sun, 9 Feb 2014 16:50:21 +0000 (11:50 -0500)]
vgabios: Add option to control use of standard VGA IO ports.

Add option CONFIG_VGA_STDVGA_PORTS.  When this option is disabled, the
main BIOS code will not attempt to access any of the legacy VGA IO
ports.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMinor - remove unused includes from pci.c.
Kevin O'Connor [Tue, 8 Apr 2014 00:36:02 +0000 (20:36 -0400)]
Minor - remove unused includes from pci.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoapm: Remove old Bochs mechanism for shutdown/suspend/standby.
Kevin O'Connor [Mon, 7 Apr 2014 21:31:43 +0000 (17:31 -0400)]
apm: Remove old Bochs mechanism for shutdown/suspend/standby.

Remove the old mechanism that used port 0x8900 to send apm signals.
Recent versions of QEMU no longer support this port.  Bochs and QEMU
only ever supported shutdown anyway, and shutdown is already available
via an ACPI mechanism.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoDocument no new changes to pirtable.c, mptable.c, acpi.c, and smbios.c.
Kevin O'Connor [Mon, 7 Apr 2014 20:02:22 +0000 (16:02 -0400)]
Document no new changes to pirtable.c, mptable.c, acpi.c, and smbios.c.

Add a note to the code that generates the pir, mptable, smbios, and
smbios tables that no new changes are expected.  Going forward, it is
expected that if any changes are needed to these bios tables that
SeaBIOS will get the tables passed in from upstream.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoUse biostables.c for copying bios tables even when generating them.
Kevin O'Connor [Mon, 7 Apr 2014 20:35:18 +0000 (16:35 -0400)]
Use biostables.c for copying bios tables even when generating them.

Use the biostables.c copy_pir(), copy_smbios(), copy_acpi_rsdp(), and
copy_mptable() code even when using the legacy bios table generation
code.  This unifies the final bios table deployment code between qemu,
coreboot, and csm.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove PirAddr definition from pirtable.c to biostables.c.
Kevin O'Connor [Mon, 7 Apr 2014 19:55:23 +0000 (15:55 -0400)]
Move PirAddr definition from pirtable.c to biostables.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agosmbios: Move smbios parsing logic from smbios.c to biostables.c.
Kevin O'Connor [Mon, 7 Apr 2014 19:48:12 +0000 (15:48 -0400)]
smbios: Move smbios parsing logic from smbios.c to biostables.c.

After this change, src/fw/smbios.c only contains the legacy code for
generating SMBIOS tables.  This change only contains code movement -
no logic is changed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoacpi: Move acpi parsing logic from acpi.c to biostables.c / paravirt.c.
Kevin O'Connor [Mon, 7 Apr 2014 19:42:04 +0000 (15:42 -0400)]
acpi: Move acpi parsing logic from acpi.c to biostables.c / paravirt.c.

After this change, src/fw/acpi.c only contains the legacy code for
generating ACPI tables.  This change only contains code movement - no
logic is changed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoReplace CONFIG_THREAD_OPTIONROMS with a runtime config setting.
Kevin O'Connor [Mon, 7 Apr 2014 16:15:34 +0000 (12:15 -0400)]
Replace CONFIG_THREAD_OPTIONROMS with a runtime config setting.

Replace the CONFIG_THREAD_OPTIONROMS option with the CBFS (or fw_cfg)
file "etc/threads".  This allows for the "threads during optionrom"
capability to be enabled/disabled without requiring SeaBIOS to be
recompiled.  A value of "2" in this file will enable threads to run
during option rom execution.

This change also allows for all threads to be disabled via the same
runtime config file.  Setting the file to a value of "0" will cause
SeaBIOS to perform all hardware initialization serially.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMinor - fix some typos in comments.
Kevin O'Connor [Sat, 5 Apr 2014 13:11:45 +0000 (09:11 -0400)]
Minor - fix some typos in comments.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agousb: Only disable HID devices if both USB_MOUSE and USB_KEYBOARD are off.
Kevin O'Connor [Tue, 1 Apr 2014 03:50:42 +0000 (23:50 -0400)]
usb: Only disable HID devices if both USB_MOUSE and USB_KEYBOARD are off.

Fix typo in code causing both CONFIG_USB_MOUSE and CONFIG_USB_KEYBOARD
to be effectively disabled if either is disabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovp_init_simple: enable PCI bus-mastering before relying on DMA.
Eric Northup [Wed, 12 Mar 2014 20:42:36 +0000 (13:42 -0700)]
vp_init_simple: enable PCI bus-mastering before relying on DMA.

An analogous change was made in the LSI scsi driver, commit
7d052575258ad2fc487ca3f9a6b62eff1b767900. Qemu works around guests that don't
correctly enable PCI bus mastering before using virtio queues' DMA (search for
VIRTIO_PCI_BUG_BUS_MASTER / VIRTIO_PCI_FLAG_BUS_MASTER_BUG ), but it'd be
better to be correct.

Signed-off-by: Eric Northup <digitaleric@google.com>
11 years agoinit_virtio_blk, init_virtio_scsi: reset HBA on error
Eric Northup [Wed, 12 Mar 2014 20:42:35 +0000 (13:42 -0700)]
init_virtio_blk, init_virtio_scsi: reset HBA on error

Extend commit 5f2d17d35b2339526f3b3d580b279ea78e406a25: reset on all error
paths, and also for virtio_blk not just virtio_scsi.

Signed-off-by: Eric Northup <digitaleric@google.com>
11 years agosmbios: Default all values to zero.
Kevin O'Connor [Tue, 11 Mar 2014 15:46:42 +0000 (11:46 -0400)]
smbios: Default all values to zero.

Make sure to initialize the entire smbios area to zero so that any
field not explicitly initialized does not have random values.  (It was
found that the memory_error_information_handle field in smbios_type_17
was not being set.)

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovga: rework bar detection, add virtio-vga
Gerd Hoffmann [Thu, 12 Dec 2013 13:55:14 +0000 (14:55 +0100)]
vga: rework bar detection, add virtio-vga

Replace the heuristic which checks the bar 0 attributes to
figure whenever bar 0 or bar 1 has the linear framebuffer
with a vendor id check.

Add support for virtio-vga which uses bar 2 for the linear
framebuffer.

Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agovgabios: Fix PMM allocation request size.
Kevin O'Connor [Tue, 18 Feb 2014 18:48:09 +0000 (13:48 -0500)]
vgabios: Fix PMM allocation request size.

The size of a PMM memory request is in "paragraphs" so the size needs
to be divided by 16.  Fix the request so only the desired 512 bytes is
allocated instead of 8K.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agocoreboot: Move links file processing to its own function.
Kevin O'Connor [Sun, 16 Feb 2014 20:25:38 +0000 (15:25 -0500)]
coreboot: Move links file processing to its own function.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoEnhance nullTrailingSpace() so that it can also skip leading spaces.
Kevin O'Connor [Sat, 1 Feb 2014 00:38:36 +0000 (19:38 -0500)]
Enhance nullTrailingSpace() so that it can also skip leading spaces.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agocoreboot: Add support for a "links" file to have aliases in CBFS.
Kevin O'Connor [Fri, 17 Jan 2014 17:11:49 +0000 (12:11 -0500)]
coreboot: Add support for a "links" file to have aliases in CBFS.

The "links" file is a newline separated list where each line is a
"link name" followed by a "destination name" separated by a space
character.  For each line, SeaBIOS will consider each "link name" to
be a CBFS file that has the contents found in the CBFS file with
"destination name".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Make sure stdvga_list_modes() doesn't overrun the buffer.
Kevin O'Connor [Tue, 11 Feb 2014 22:36:56 +0000 (17:36 -0500)]
vgabios: Make sure stdvga_list_modes() doesn't overrun the buffer.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Refactor write_teletype and write_chars.
Kevin O'Connor [Sat, 8 Feb 2014 21:43:30 +0000 (16:43 -0500)]
vgabios: Refactor write_teletype and write_chars.

Factor out the common code of writing to the screen and advancing the
cursor position to a new function write_char().  Eliminate
write_chars() and then simplify write_teletype().  Also, eliminate the
separate scroll_one() function as it no longer reduces stack space.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Don't interpret TAB character.
Kevin O'Connor [Sat, 8 Feb 2014 17:29:20 +0000 (12:29 -0500)]
vgabios: Don't interpret TAB character.

Several sources document that the Bell, Backspace, newline, and
carriage return characters are interpreted by int 10/0e.  There does
not seem to be any references to that function interpreting tab.  The
original "lgpl vgabios" has code for interpreting tab, but the code is
incorrect.  Finally, tests on an ATI vgabios indicate that tab is not
interpreted.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Attempt to detect old x86emu and force a fault.
Kevin O'Connor [Thu, 6 Feb 2014 03:47:29 +0000 (22:47 -0500)]
vgabios: Attempt to detect old x86emu and force a fault.

Check for cases where the leal instruction does not work.  This
instruction is known to not be emulated properly on old versions of
x86emu.  If a broken version of x86emu is found, force a fault that
x86emu will easily detect.  This should help prevent soft failures
when running old software.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Simplify save/restore mechanism.
Kevin O'Connor [Thu, 6 Feb 2014 01:52:25 +0000 (20:52 -0500)]
vgabios: Simplify save/restore mechanism.

Reorganize the save/restore functions to eliminate some boilerplate
code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Simplify the bios save state area.
Kevin O'Connor [Thu, 6 Feb 2014 00:29:08 +0000 (19:29 -0500)]
vgabios: Simplify the bios save state area.

The structure of the "bios save state area" as returned by
handle_101c() and vbe_104f04() does not follow any particular order.
(And there does not appear to be any documentation that would require
it to follow a particular order.)

So, rearrange the layout of the struct to make save and restore
simpler.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Make sure exported structs use PACKED.
Kevin O'Connor [Wed, 5 Feb 2014 23:49:44 +0000 (18:49 -0500)]
vgabios: Make sure exported structs use PACKED.

Commit ca668640 introduced structs for data returned from the
handle_101b and handle_101c calls.  However, the structs were not
declared as packed and that caused incorrect behavior for
handle_101b.  This was seen to break some old DOS programs (Win3 setup
and DISPLAY.SYS).  This patch adds in the necessary PACKED declaration
to the structs.

The 'struct saveBDAstate' remains un-packed, as it does not appear
that its contents are documented.  (And, its format already differs
from what was in the previous "lgpl vgabios".)

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Add copyright notice to usb-xhci.c
Kevin O'Connor [Mon, 27 Jan 2014 17:25:35 +0000 (12:25 -0500)]
xhci: Add copyright notice to usb-xhci.c

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Use the same endpoint initialization code in xhci_alloc_pipe()
Kevin O'Connor [Mon, 27 Jan 2014 16:49:51 +0000 (11:49 -0500)]
xhci: Use the same endpoint initialization code in xhci_alloc_pipe()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agousb: Move default pipe max packet size code from xhci to main code.
Kevin O'Connor [Sun, 26 Jan 2014 22:28:04 +0000 (17:28 -0500)]
usb: Move default pipe max packet size code from xhci to main code.

Also, the max packet size for super speed devices is 512 bytes (not
256 bytes).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agousb: USB 3 devices encode bMaxPacketSize0 field.
Kevin O'Connor [Fri, 24 Jan 2014 19:34:00 +0000 (14:34 -0500)]
usb: USB 3 devices encode bMaxPacketSize0 field.

A USB 3 device uses an exponential encoding of the max packet size for
the default end point.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoIncrease maximum size of permanent high memory area.
Kevin O'Connor [Mon, 20 Jan 2014 16:47:43 +0000 (11:47 -0500)]
Increase maximum size of permanent high memory area.

Some XHCI controllers can request a significant chunk of reserved
memory for scratch pad buffers.  (At least one controller Intel
Haswell based controller has been seen to request 64KiB.)  Unused
memory is returned after POST completes, so it should be okay to
increase the maximum permanent high memory zone from 64K to 256K.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Check if scratch pad allocation fails.
Kevin O'Connor [Mon, 20 Jan 2014 16:46:16 +0000 (11:46 -0500)]
xhci: Check if scratch pad allocation fails.

Some boards ask for a large amount of ram for scratch pad usage, and
it is possible the allocation will fail.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoRemove pci_writel() and pci_readl() functions.
Kevin O'Connor [Tue, 31 Dec 2013 03:15:47 +0000 (22:15 -0500)]
Remove pci_writel() and pci_readl() functions.

These functions are no longer used.  Going forward it's better to move
a driver to full 32bit mode then to use these functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Run the XHCI driver entirely in 32bit mode.
Kevin O'Connor [Tue, 31 Dec 2013 03:09:04 +0000 (22:09 -0500)]
xhci: Run the XHCI driver entirely in 32bit mode.

Since the XHCI driver needs to jump into 32bit mode anyway, it is
simpler to just run all of the code in 32bit mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoAdd space between DTYPE_* definitions.
Kevin O'Connor [Tue, 31 Dec 2013 03:06:47 +0000 (22:06 -0500)]
Add space between DTYPE_* definitions.

Avoid consective numbering on the DTYPE_* definitions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoAdd call32_params() helper function.
Kevin O'Connor [Tue, 31 Dec 2013 03:04:28 +0000 (22:04 -0500)]
Add call32_params() helper function.

Add helper function for calling 32bit functions with more than just
one parameter.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Support USB hubs on xhci controllers.
Kevin O'Connor [Mon, 30 Dec 2013 01:18:37 +0000 (20:18 -0500)]
xhci: Support USB hubs on xhci controllers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Report the "protocol defined" and PSIC bits of extended capabilities.
Kevin O'Connor [Sun, 29 Dec 2013 18:13:42 +0000 (13:13 -0500)]
xhci: Report the "protocol defined" and PSIC bits of extended capabilities.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Don't use a dummy endpoint count in configure command.
Kevin O'Connor [Sun, 29 Dec 2013 23:17:57 +0000 (18:17 -0500)]
xhci: Don't use a dummy endpoint count in configure command.

At least some real-world controllers expect the endpoint count in the
inctx to be accurate, so set it to the pipe currently being activated.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Allow the XHCI USB controller to be enabled for coreboot.
Kevin O'Connor [Sat, 28 Dec 2013 02:57:14 +0000 (21:57 -0500)]
xhci: Allow the XHCI USB controller to be enabled for coreboot.

Initial tests look promising and at least two different real-world
chipsets show limited functionality with the support enabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Support xhci controllers with 64 byte contexts.
Kevin O'Connor [Sat, 28 Dec 2013 02:46:35 +0000 (21:46 -0500)]
xhci: Support xhci controllers with 64 byte contexts.

At least some real-world controllers require 64 byte contexts.  Detect
this case and handle it appropriately.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Eliminate 'struct xhci_device'.
Kevin O'Connor [Sat, 28 Dec 2013 02:09:53 +0000 (21:09 -0500)]
xhci: Eliminate 'struct xhci_device'.

Eliminate the xhci_device struct by storing the slotid in usbdevice_s
and in xhci_pipe.  The remaining storage in that struct (xhci_devctx)
is available from xhci->devs.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Move set_address code from xhci_control to xhci_alloc_pipe.
Kevin O'Connor [Sat, 28 Dec 2013 00:25:46 +0000 (19:25 -0500)]
xhci: Move set_address code from xhci_control to xhci_alloc_pipe.

It's easier to run the set_address from xhci_alloc_pipe as there is
more information available there.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Allocate and free the xhci inctx structure on each use.
Kevin O'Connor [Fri, 27 Dec 2013 23:09:16 +0000 (18:09 -0500)]
xhci: Allocate and free the xhci inctx structure on each use.

The inctx struct isn't long lived, so it doesn't need to be allocated
in permanent memory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Verify PAGESIZE register before initializing driver.
Kevin O'Connor [Fri, 27 Dec 2013 23:30:02 +0000 (18:30 -0500)]
xhci: Verify PAGESIZE register before initializing driver.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Set the interval parameter on interrupt pipes.
Kevin O'Connor [Fri, 27 Dec 2013 18:37:11 +0000 (13:37 -0500)]
xhci: Set the interval parameter on interrupt pipes.

Be sure to set the interval parameter when creating an interrupt based
pipe.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Fix incorrect direction setting on status transmissions.
Kevin O'Connor [Fri, 27 Dec 2013 18:41:28 +0000 (13:41 -0500)]
xhci: Fix incorrect direction setting on status transmissions.

The status part of a control message was likely to have an incorrect
direction set.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Use 64bit writes to ERDP register.
Kevin O'Connor [Fri, 27 Dec 2013 18:34:55 +0000 (13:34 -0500)]
xhci: Use 64bit writes to ERDP register.

At least some real-world XHCI controllers expect a 64bit write to the
ERDP register.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: allocate scratch pad buffers
Gerd Hoffmann [Fri, 6 Dec 2013 15:08:01 +0000 (16:08 +0100)]
xhci: allocate scratch pad buffers

Untested.  Anyone who tried to get xhci run on real hardware
is welcome to test whenever this patch improves things.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopci: improve io address space allocation
Gerd Hoffmann [Thu, 23 Jan 2014 14:48:19 +0000 (15:48 +0100)]
pci: improve io address space allocation

This patch improves the io address space allocation.  It adds a check
that the region above 0xc000 which is traditionally used for pci io
is actually big enougth.  If it isn't it tries the larger window at
0x1000.  If that is to small too it errors out.

When creating guests with multiple pci-pci bridges (and devices with
io regions behind them) the 0xc000 -> 0xffff region quickly becomes
too small.

While being at it document the io address space layout used by
qemu/seabios.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agodebug: Unify the SeaBIOS debug version banner.
Kevin O'Connor [Wed, 15 Jan 2014 18:52:14 +0000 (13:52 -0500)]
debug: Unify the SeaBIOS debug version banner.

Introduce debug_banner() and use it in all the places SeaBIOS version
is displayed for debugging purposes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agodebug: Only call serial_debug_preinit() at startup.
Kevin O'Connor [Wed, 15 Jan 2014 18:42:50 +0000 (13:42 -0500)]
debug: Only call serial_debug_preinit() at startup.

The serial_debug_preinit() function disables serial interrupts so that
the OS doesn't get confused by "transmit buffer empty" interrupts
caused when seabios writes to the serial port.  It's unnecessary
paranoia to keep rechecking that interrupts are disabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agodebug: Add runtime option to not report the debug serial port to the OS.
Kevin O'Connor [Wed, 15 Jan 2014 18:34:19 +0000 (13:34 -0500)]
debug: Add runtime option to not report the debug serial port to the OS.

DOS resets the serial ports reported by the BIOS.  This can mess up
debugging and timing when the serial baud rate changes on the debug
port.  The new "etc/advertise-serial-debug-port" option allows one to
suppress the debug serial port from the normal list of serial ports
the BIOS reports to DOS.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agocoreboot: Support alternative locations for CBFS.
Kevin O'Connor [Sat, 18 Jan 2014 01:21:20 +0000 (20:21 -0500)]
coreboot: Support alternative locations for CBFS.

The Google builds of SeaBIOS place the CBFS data in a non-standard
location.  Add a config parameter to support non-standard locations.
This is based on a patch from Stefan Reinauer <reinauer@chromium.org>
in the Chromium seabios repo (commit 60534ec785).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoscripts: Allow encodeint.py to take integers in hex notation.
Kevin O'Connor [Sat, 18 Jan 2014 06:42:07 +0000 (01:42 -0500)]
scripts: Allow encodeint.py to take integers in hex notation.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agobuild: Update kconfig to version in Linux 3.13.
Kevin O'Connor [Mon, 20 Jan 2014 16:53:12 +0000 (11:53 -0500)]
build: Update kconfig to version in Linux 3.13.

Update kconfig (from Linux v3.11-rc6) to the latest version (Linux
v3.13).

This copyies kconfig from Linux with only the changes necessary to
work with the SeaBIOS build (the equivalent of the earlier SeaBIOS
0da7bfdf commit) and the changes necessary to always emit symbols
(SeaBIOS b623e7c5 commit).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agosmbios: catch zero-length strings
Gerd Hoffmann [Mon, 20 Jan 2014 13:32:54 +0000 (14:32 +0100)]
smbios: catch zero-length strings

qemu may pass us zero-length strings for smbios fields, when starting
qemu this way  ...

qemu -smbios type=1,version=,serial=test

... for example.

Today we don't specifically handle them and simply append them to the
string list.  Therefore we get two string-terminating zeros in a row.
Result is that we by accident create a end-of-entry marker in the middle
of the entry.

Fix this by handling zero-length strings like non-present strings.

Cc: armbru@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agobuild: Be careful with unicode and byte strings for python3 compatibility.
Johannes Krampf [Sun, 19 Jan 2014 15:03:49 +0000 (16:03 +0100)]
build: Be careful with unicode and byte strings for python3 compatibility.

Signed-off-by: Johannes Krampf <johannes.krampf@googlemail.com>
11 years agobuild: Avoid sort() on unordered classes for python3 compatibility.
Johannes Krampf [Sun, 12 Jan 2014 16:39:57 +0000 (11:39 -0500)]
build: Avoid sort() on unordered classes for python3 compatibility.

Signed-off-by: Johannes Krampf <johannes.krampf@googlemail.com>
11 years agobuild: Be explicit that we want integers when dividing for python3 compat.
Johannes Krampf [Sun, 12 Jan 2014 16:19:22 +0000 (11:19 -0500)]
build: Be explicit that we want integers when dividing for python3 compat.

Signed-off-by: Johannes Krampf <johannes.krampf@googlemail.com>
11 years agobuild: Make print statements in scripts python3 compatible.
Johannes Krampf [Sun, 12 Jan 2014 16:14:54 +0000 (11:14 -0500)]
build: Make print statements in scripts python3 compatible.

Signed-off-by: Johannes Krampf <johannes.krampf@googlemail.com>
11 years agobuild: Remove unneccesary semicolons from acpi_extract scripts.
Johannes Krampf [Sun, 12 Jan 2014 15:54:22 +0000 (10:54 -0500)]
build: Remove unneccesary semicolons from acpi_extract scripts.

Signed-off-by: Johannes Krampf <johannes.krampf@googlemail.com>
11 years agoehci: memset the qTD structures in ehci_alloc_intr_pipe
Kevin O'Connor [Fri, 17 Jan 2014 23:43:10 +0000 (18:43 -0500)]
ehci: memset the qTD structures in ehci_alloc_intr_pipe

The qTD structures were not being cleared in ehci_alloc_intr_pipe()
and it was possible that garbage could have been in some of the
fields.  Also, memset the data array for sanity purposes.

A similar fix is in the Chromium seabios repo (3e711dc261).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoinit_virtio_scsi(): reset the HBA before freeing its virtio ring
Laszlo Ersek [Wed, 15 Jan 2014 01:48:40 +0000 (02:48 +0100)]
init_virtio_scsi(): reset the HBA before freeing its virtio ring

When init_virtio_scsi() finds no SCSI targets connected to the HBA, it
frees the virtio ring. Other code in SeaBIOS proceeds to overwrite the
area. However, the ring is in use by qemu at that point -- not only did we
report the (ACK|DRIVER|DRIVER_OK) status earlier, we even communicated
over the ring.

Of course SeaBIOS doesn't "kick" the HBA ever again, hence qemu has no
reason to look at the ring. However, when qemu uses KVM acceleration, and
ioeventfd is enabled for the HBA, then a vmstate change to "running"
(including stop->cont monitor commands and incoming migration) "forces" a
kick (see qemu commit 25db9ebe). Qemu then tries to interpret whatever
unrelated guest data is in the HBA's original ring area, as virtio
protocol. Qemu exits upon seeing the garbage.

init_virtio_scsi() should reset the HBA before allowing the virtio ring
memory to be reused. Device reset causes the hypervisor to drop its
references.

This change is justified / underpinned by pure virtio-spec compliance as
well.

Related RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1013418

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
11 years agoMinor - fix misspelling in romfile.c comment.
Kevin O'Connor [Wed, 15 Jan 2014 18:33:48 +0000 (13:33 -0500)]
Minor - fix misspelling in romfile.c comment.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMinor - pciinit.c - order header files and use static on local functions.
Kevin O'Connor [Wed, 15 Jan 2014 16:08:22 +0000 (11:08 -0500)]
Minor - pciinit.c - order header files and use static on local functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoresume: restore piix pm config registers after resume
Marcel Apfelbaum [Wed, 15 Jan 2014 12:20:06 +0000 (14:20 +0200)]
resume: restore piix pm config registers after resume

On resume, the OS queries the power management event that
caused it. In order to complete this task, it executes some
reads to the piix pm io space. This all happens before the
OS has a chance to restore the PCI config space for devices,
so it is bios's responsibility to make sure the pm IO space
is configured correctly. (During suspend, the piix pm
configuration space is lost).

Note: For 'ordinary' pci devices the config space is
saved by the OS on sleep and restored on resume.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
11 years agoPrevent build failure by not splitting line in the middle of arguments to checkrom...
Sander Eikelenboom [Thu, 9 Jan 2014 19:18:43 +0000 (20:18 +0100)]
Prevent build failure by not splitting line in the middle of arguments to checkrom.py script

File "./scripts/checkrom.py", line 24, in main
    objinfo, finalsize, rawfile, outfile = sys.argv[1:]
ValueError: need more than 3 values to unpack

Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
11 years agousb: Replace EHCI to UHCI/OHCI synchronization with new scheme.
Kevin O'Connor [Thu, 5 Dec 2013 23:43:20 +0000 (18:43 -0500)]
usb: Replace EHCI to UHCI/OHCI synchronization with new scheme.

The previous code attempts to correlate which UHCI and OHCI
controllers correlate with which EHCI controllers so that it can
ensure high speed devices are handled by the EHCI code while low/full
speed devices are handled by the UHCI/OHCI code.  Replace this logic
by initializing all EHCI controllers first, and then initializing all
UHCI and OHCI controllers.  This simplifies the code and improves
support for some hardware devices that don't follow the OHCI/UHCI to
EHCI correlation standard.

Also, remove the unused usb->busid field.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agopvscsi: Remove use of LOWFLAT and GLOBALFLAT macros.
Kevin O'Connor [Fri, 27 Dec 2013 17:08:50 +0000 (12:08 -0500)]
pvscsi: Remove use of LOWFLAT and GLOBALFLAT macros.

Now that pvscsi runs entirely in 32bit mode, there is no need to use
the memory segment access macros.

This also fixes up an incorrect memcpy and memset call.

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