]> xenbits.xensource.com Git - seabios.git/log
seabios.git
11 years agovgabios: Support allocating an extra stack for vgabios calls and default on.
Kevin O'Connor [Sun, 1 Dec 2013 00:16:15 +0000 (19:16 -0500)]
vgabios: Support allocating an extra stack for vgabios calls and default on.

Add code to allocate an extra stack for the main vgabios int 0x10
entry point.  The allocation is done via the PMM spec and uses a PCI
v3 permanent low memory region request.  This request will work with
SeaBIOS - it is unknown how many other main BIOS implementations
support this PMM call.

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

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMinor - update file comment on bootsplash.c.
Kevin O'Connor [Sat, 30 Nov 2013 18:04:45 +0000 (13:04 -0500)]
Minor - update file comment on bootsplash.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Work around lack of support for "calll" in x86emu emulation.
Kevin O'Connor [Sat, 30 Nov 2013 17:52:44 +0000 (12:52 -0500)]
vgabios: Work around lack of support for "calll" in x86emu emulation.

Replace 32 bit call instructions with 16 bit call instructions in the
vgabios to workaround problems in old versions of x86emu.  This change
allows fc13 and fc14 to boot.  (Other x86emu emulation bugs still
prevent fc11 and fc12 from booting.)

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Avoid possible divide by zero in bochsvga_set_displaystart.
Kevin O'Connor [Sat, 30 Nov 2013 16:45:46 +0000 (11:45 -0500)]
vgabios: Avoid possible divide by zero in bochsvga_set_displaystart.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Add bochsvga "HDTV" resolutions.
Kevin O'Connor [Sat, 30 Nov 2013 16:04:09 +0000 (11:04 -0500)]
vgabios: Add bochsvga "HDTV" resolutions.

The same set of video modes were added to the "lgpl vgabios" in
release 0.7a.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Support custom fonts in vga framebuffer text writing.
Kevin O'Connor [Sat, 30 Nov 2013 15:52:45 +0000 (10:52 -0500)]
vgabios: Support custom fonts in vga framebuffer text writing.

Obtain the font data from int 0x43 and int 0x1f, and obtain the font
height from the BDA.  This enables application overrides for the font
data.

This patch also unifies the variable naming between the
planar/CGA/linear character writing functions and uses the same names
that the screen scrolling functions use.

This patch also optimizes the inner loop of the CGA font writing to
reduce overall stack usage.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Load the DAC palette in "packed" modes on Cirrus and BochsVGA.
Kevin O'Connor [Fri, 29 Nov 2013 23:43:35 +0000 (18:43 -0500)]
vgabios: Load the DAC palette in "packed" modes on Cirrus and BochsVGA.

This is a port of a patch applied to the "lgpl vgabios" tree (that was
released in its v0.7a release).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove low-level hardware writing from output.c to new file hw/serialio.c.
Kevin O'Connor [Fri, 29 Nov 2013 17:14:34 +0000 (12:14 -0500)]
Move low-level hardware writing from output.c to new file hw/serialio.c.

Avoid hardware specific code in output.c.  This will reduce the amount
of change needed to output.c as support for more serial hardware is
added.

This patch also renames some functions to improve the naming scheme.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoahci: alloc structs in high memory
Gerd Hoffmann [Tue, 26 Nov 2013 13:10:25 +0000 (14:10 +0100)]
ahci: alloc structs in high memory

With ahci running in 32bit mode we can also allocate the
(ahci private) data structures in high memory.  This
reduces the real mode memory footprint as we only need
to move struct ahci_port_s (which contains struct drive_s)
to fseg in case the port probe was successful.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoahci: remote some parentheses
Gerd Hoffmann [Tue, 26 Nov 2013 13:02:54 +0000 (14:02 +0100)]
ahci: remote some parentheses

Minor cleanups.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoahci: zap real mode macros
Gerd Hoffmann [Tue, 26 Nov 2013 13:01:20 +0000 (14:01 +0100)]
ahci: zap real mode macros

Not needed any more now that ahci runs in 32bit mode
all the time.  Script-based search & replace.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopci: map 64-bit BARs at location provided by emulator
Gerd Hoffmann [Tue, 26 Nov 2013 11:48:20 +0000 (12:48 +0100)]
pci: map 64-bit BARs at location provided by emulator

Currently 64-bit PCI BARs are unconditionally mapped by BIOS right
over 4G + RamSizeOver4G location, which doesn't allow to reserve
extra space before 64-bit PCI window. For memory hotplug an extra
RAM space might be reserved after present 64-bit RAM end and BIOS
should map 64-bit PCI BARs after it.

Introduce "etc/reserved-memory-end" romfile to provide BIOS a hint
where it should start mapping of 64-bit PCI BARs. If romfile is
missing, BIOS reverts to legacy behavior and starts mapping after
high memory.

Based-on-patch-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-By: Igor Mammedov <imammedo@redhat.com>
11 years agopci: log pci windows
Gerd Hoffmann [Tue, 26 Nov 2013 11:51:30 +0000 (12:51 +0100)]
pci: log pci windows

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopci: tweak + comment minimum allocations
Gerd Hoffmann [Tue, 26 Nov 2013 12:12:04 +0000 (13:12 +0100)]
pci: tweak + comment minimum allocations

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopci: align 64bit pci regions to 1G
Gerd Hoffmann [Tue, 26 Nov 2013 10:08:17 +0000 (11:08 +0100)]
pci: align 64bit pci regions to 1G

So they are hugepage aligned.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopci: don't map usb host adapters above 4G
Gerd Hoffmann [Tue, 26 Nov 2013 11:57:19 +0000 (12:57 +0100)]
pci: don't map usb host adapters above 4G

Otherwise our xhci driver has trouble accessing the mmio registers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agopci: don't reorder entries when moving to 64bit list
Gerd Hoffmann [Tue, 26 Nov 2013 10:21:23 +0000 (11:21 +0100)]
pci: don't reorder entries when moving to 64bit list

Otherwise the 64bit bars are not mapped in largest
first order, thereby messing up the alignment.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoacpi: strip compiler info in built-in DSDT if any
Michael S. Tsirkin [Thu, 3 Oct 2013 13:06:24 +0000 (16:06 +0300)]
acpi: strip compiler info in built-in DSDT if any

IASL stores it's revision in each table header it generates.
That's a problem since guests see a change each time
they move between hypervisors.
We generally fill our own info for tables,
but we forgot to do this for the built-in DSDT.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agoAdd support for etc/e820 fw_cfg file
Gerd Hoffmann [Fri, 18 Oct 2013 10:22:36 +0000 (12:22 +0200)]
Add support for etc/e820 fw_cfg file

The new fw_cfg is simliar to the QEMU_CFG_E820_TABLE entry,
but carries both reservations and RAM regions, so we can use
it instead of the cmos for RAM detection.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoAdd qemu_cfg_e820 function.
Gerd Hoffmann [Fri, 18 Oct 2013 10:18:19 +0000 (12:18 +0200)]
Add qemu_cfg_e820 function.

Move all ram detection and e820 setup to the new function, except for
lowmem detection which must remain in preinit so we can initialize our
memory allocator properly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoacpi: load and link tables through romfile loader
Michael S. Tsirkin [Thu, 3 Oct 2013 13:30:41 +0000 (16:30 +0300)]
acpi: load and link tables through romfile loader

Load files through romfile loader and use for acpi tables.
We need the RSDP pointer to hang the rest of the tables off it,
to detect that we simply scan all memory in FSEG.

Add an option to disable this feature (useful for old QEMU versions).
This saves about 1Kbytes.

enabled:
Total size: 134932  Fixed: 61571  Free: 127212 (used 51.5% of 256KiB rom)

disabled:
Total size: 133836  Fixed: 61563  Free: 128308 (used 51.1% of 256KiB rom)

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoromfile_loader: utility to patch in-memory ROM files
Michael S. Tsirkin [Thu, 3 Oct 2013 13:30:37 +0000 (16:30 +0300)]
romfile_loader: utility to patch in-memory ROM files

Add ability for a ROM file to point to
it's image in memory. When file is in memory,
add utility that can patch it, storing
pointers to one file within another file.

This is not a lot of code: together with the follow-up patch to load
ACPI tables from ROM, it's about 1K extra.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agobiostables: support looking up RSDP
Michael S. Tsirkin [Thu, 3 Oct 2013 13:30:35 +0000 (16:30 +0300)]
biostables: support looking up RSDP

Will be used when it's loaded from QEMU.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoMinor - eliminate the SET_GLOBAL macro.
Kevin O'Connor [Sat, 26 Oct 2013 15:56:24 +0000 (11:56 -0400)]
Minor - eliminate the SET_GLOBAL macro.

Remove the SET_GLOBAL macro - it is no longer used and since it was
only available in "32bit flat" mode it does not have much use.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agomegasas: Don't attempt to access 'struct pci_device' at runtime.
Kevin O'Connor [Sat, 26 Oct 2013 15:53:38 +0000 (11:53 -0400)]
megasas: Don't attempt to access 'struct pci_device' at runtime.

The PCI device structures are only available during the POST phase.
Don't attempt to access them from the runtime disk driver code.

This patch has not been tested, but the old code is definitely
incorrect.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoConvert op->drive_g from a 16bit pointer to a 32 bit "GLOBALFLAT" pointer.
Kevin O'Connor [Sat, 26 Oct 2013 15:48:06 +0000 (11:48 -0400)]
Convert op->drive_g from a 16bit pointer to a 32 bit "GLOBALFLAT" pointer.

The "drive" structure is always malloc'ed and therefore always starts
off described as a 32-bit "flat" pointer.  Instead of switching
to/from 16bit pointers, make all the code use the 32bit pointer.  This
eliminates the confusing 16/32 bit pointer switches.

This patch also removes the "_g" suffixes on local variables in
functions that are always called in 32bit mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agohw/usb-xhci.c: Code refactoring to not override initializers in `speed_from_xhci...
Paul Menzel [Thu, 3 Oct 2013 09:55:48 +0000 (11:55 +0200)]
hw/usb-xhci.c: Code refactoring to not override initializers in `speed_from_xhci[16]`

Using Debian clang version 3.4-1 (trunk) (based on LLVM 3.4) to build
SeaBIOS, the switch `-Winitializer-overrides` results in the following
warnings.

        $ CC=clang make
        […]
          Compile checking out/src/hw/usb-xhci.o
        clang: warning: argument unused during compilation: '-mpreferred-stack-boundary=2'
        clang: warning: argument unused during compilation: '-minline-all-stringops'
        clang: warning: argument unused during compilation: '-fno-delete-null-pointer-checks'
        src/hw/usb-xhci.c:281:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
            [ 1 ] = USB_FULLSPEED,
                    ^~~~~~~~~~~~~
        src/hw/usb.h:68:24: note: expanded from macro 'USB_FULLSPEED'
                               ^
        src/hw/usb-xhci.c:280:20: note: previous initialization is here
            [ 0 ... 15 ] = -1,
                           ^~
        src/hw/usb-xhci.c:282:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
            [ 2 ] = USB_LOWSPEED,
                    ^~~~~~~~~~~~
        src/hw/usb.h:69:24: note: expanded from macro 'USB_LOWSPEED'
                               ^
        src/hw/usb-xhci.c:280:20: note: previous initialization is here
            [ 0 ... 15 ] = -1,
                           ^~
        src/hw/usb-xhci.c:283:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
            [ 3 ] = USB_HIGHSPEED,
                    ^~~~~~~~~~~~~
        src/hw/usb.h:70:24: note: expanded from macro 'USB_HIGHSPEED'
                               ^
        src/hw/usb-xhci.c:280:20: note: previous initialization is here
            [ 0 ... 15 ] = -1,
                           ^~
        src/hw/usb-xhci.c:284:13: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
            [ 4 ] = USB_SUPERSPEED,
                    ^~~~~~~~~~~~~~
        src/hw/usb.h:71:24: note: expanded from macro 'USB_SUPERSPEED'
                               ^
        src/hw/usb-xhci.c:280:20: note: previous initialization is here
            [ 0 ... 15 ] = -1,
                           ^~

Refactor the code a little to get rid of the warnings.

Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
11 years agoACPI DSDT: Make control method `IQCR` serialized
Paul Menzel [Thu, 3 Oct 2013 09:30:52 +0000 (11:30 +0200)]
ACPI DSDT: Make control method `IQCR` serialized

The ASL Optimizing Compiler version 20130823-32 [Sep 11 2013] issues the
following warning.

        $ make
        […]
          Compiling IASL out/src/fw/acpi-dsdt.hex
        out/src/fw/acpi-dsdt.dsl.i    360:         Method(IQCR, 1, NotSerialized) {
        Remark   2120 -                                     ^ Control Method should be made Serialized (due to creation of named objects within)
        […]
        ASL Input:     out/src/fw/acpi-dsdt.dsl.i - 475 lines, 19181 bytes, 316 keywords
        AML Output:    out/src/fw/acpi-dsdt.aml - 4407 bytes, 159 named objects, 157 executable opcodes
        Listing File:  out/src/fw/acpi-dsdt.lst - 143715 bytes
        Hex Dump:      out/src/fw/acpi-dsdt.hex - 41661 bytes

        Compilation complete. 0 Errors, 0 Warnings, 1 Remarks, 246 Optimizations
        […]

After changing the parameter from `NotSerialized` to `Serialized`, the
remark is indeed gone and there is no size change.

The remark was added in ACPICA version 20130517 [1] and gives the
following explanation.

        If a thread blocks within the method for any reason, and another thread
        enters the method, the method will fail because an attempt will be
        made to create the same (named) object twice.

        In this case, issue a remark that the method should be marked
        serialized. ACPICA BZ 909.

[1] https://github.com/acpica/acpica/commit/ba84d0fc18ba910a47a3f71c68a43543c06e6831

Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
11 years agovgahooks: add SM720 VGA BIOS hooks for WIN Enterprises MB-60470
Jonathan A. Kollasch [Sun, 20 Oct 2013 17:48:56 +0000 (12:48 -0500)]
vgahooks: add SM720 VGA BIOS hooks for WIN Enterprises MB-60470

Add vgahooks to support the SMI SM720 VGA BIOS used on the
WIN Enterprises MB-60470.  The response from smi_157f14() is necessary
for the CRT output to turn on.  The response from smi_157f02() is used
to configure which connector(s) output is routed to.

As I lack hardware to test LCD panel output, I've selected CRT-only
output on the MB-60470 as this prevents the CRT output from being scaled
to the resolution of the LCD panel.

Signed-off-by: Jonathan A. Kollasch <jakllsch@kollasch.net>
11 years agoAdd pvscsi boot support
Evgeny Budilovsky [Mon, 14 Oct 2013 15:03:36 +0000 (18:03 +0300)]
Add pvscsi boot support

Testing was done on windows images (win 2008/2012) taken from esx with vmware
tools installed and boot disk configured to use pvscsi.
Also I've used linux (ubuntu 12.04) where pvscsi drivers are installed by
default and booted it using qemu cmd similar to this:

./x86_64-softmmu/qemu-system-x86_64 -snapshot -device pvscsi,id=pvscsi0 \
-device scsi-disk,bus=pvscsi0.0,drive=drive0 \
-drive id=drive0,if=none,file=ubuntu-12.04.qcow2 \
-bios roms/seabios/out/bios.bin

Signed-off-by: Evgeny Budilovsky <evgeny.budilovsky@ravellosystems.com>
11 years agoBuild different final files for QEMU, coreboot, and CSM.
Kevin O'Connor [Tue, 15 Oct 2013 01:52:28 +0000 (21:52 -0400)]
Build different final files for QEMU, coreboot, and CSM.

Build out/bios.bin on QEMU, out/bios.bin.elf on coreboot, and
out/Csm16.bin for CSM.  This reduces the chance that one accidentally
builds for an incorrect target.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoRun ahci code entirely in 32bit mode.
Kevin O'Connor [Thu, 3 Oct 2013 01:28:08 +0000 (21:28 -0400)]
Run ahci code entirely in 32bit mode.

The ahci driver needs to jump into 32bit mode in order to access
portions of the ahci controllers PCI config space.  Instead of jumping
into 32bit mode just to toggle the ahci registers, jump into 32bit
mode for all of the driver interactions.  This shrinks the size of the
overall code and can lead to further cleanups.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoSupport call16() calls after entering 32bit mode from call32().
Kevin O'Connor [Thu, 3 Oct 2013 00:20:03 +0000 (20:20 -0400)]
Support call16() calls after entering 32bit mode from call32().

When transitioning to 32bit via call32() track the stack segment
register and support restoring it on call16() requests.  This permits
call16() to work properly.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoUpdate _farcall16() to pass segment of callregs explicitly.
Kevin O'Connor [Mon, 30 Sep 2013 00:21:40 +0000 (20:21 -0400)]
Update _farcall16() to pass segment of callregs explicitly.

Don't use implicit passing of %es for the segment of the callregs pointer.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMake __call16 use C calling convention and support two passed parameters.
Kevin O'Connor [Sun, 29 Sep 2013 23:58:09 +0000 (19:58 -0400)]
Make __call16 use C calling convention and support two passed parameters.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMinor - move call16 assembler in romlayout.S.
Kevin O'Connor [Sun, 29 Sep 2013 23:25:44 +0000 (19:25 -0400)]
Minor - move call16 assembler in romlayout.S.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoRearrange stack_hop_back() call in wait_irq, check_irqs, and _farcall16.
Kevin O'Connor [Sun, 29 Sep 2013 14:48:24 +0000 (10:48 -0400)]
Rearrange stack_hop_back() call in wait_irq, check_irqs, and _farcall16.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoRename fields of 'struct chs_s' and use in floppy lba2chs().
Kevin O'Connor [Sun, 29 Sep 2013 03:34:49 +0000 (23:34 -0400)]
Rename fields of 'struct chs_s' and use in floppy lba2chs().

Rename the fields of 'struct chs_s' so that it can be used both to
describe a drive and to describe a particular sector on a drive.

Update floppy.c:lba2chs() to return a 'struct chs_s' instead of
passing the results via pointers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agobuild: explicitly set ROM size
Gerd Hoffmann [Tue, 24 Sep 2013 08:06:16 +0000 (10:06 +0200)]
build: explicitly set ROM size

Add a config option to specify the rom size wanted.  Default is zero,
which will automatically figure the needed size.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agobuild: create output dirs in do-kconfig
Gerd Hoffmann [Wed, 25 Sep 2013 07:40:50 +0000 (09:40 +0200)]
build: create output dirs in do-kconfig

Unbreaks parallel builds.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoMinor - update file comments in src/malloc.c.
Kevin O'Connor [Sun, 29 Sep 2013 02:00:49 +0000 (22:00 -0400)]
Minor - update file comments in src/malloc.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoRemove ioport.h; disperse its contents to other header files.
Kevin O'Connor [Thu, 19 Sep 2013 01:41:48 +0000 (21:41 -0400)]
Remove ioport.h; disperse its contents to other header files.

Move the inb(), insb(), etc. code from ioport.h to x86.h.  Move the
PORT_* definitions to their appropriate hardware files.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove dma code to new file hw/dma.c.
Kevin O'Connor [Thu, 19 Sep 2013 01:04:03 +0000 (21:04 -0400)]
Move dma code to new file hw/dma.c.

Move the DMA controller code in resume.c and hw/floppy.c to a new file
hw/dma.c.  This centralizes the DMA controller code into one place.

Also, don't unmask the floppy DRQ during floppy setup - there is no
reason to unmask the DRQ prior to a command being programmed into the
DMA controller.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoRename hw/cmos.h to hw/rtc.h and copy RTC code from clock.c to hw/rtc.c.
Kevin O'Connor [Sun, 15 Sep 2013 06:29:06 +0000 (02:29 -0400)]
Rename hw/cmos.h to hw/rtc.h and copy RTC code from clock.c to hw/rtc.c.

Group the Real Time Clock code into hw/rtc.[ch].

Also, use rtc_read/write/mask function naming (instead of
inb/outb_cmos) to be more consistent with other register accessors.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove PIT setup from clock.c to hw/timer.c.
Kevin O'Connor [Sun, 15 Sep 2013 05:50:00 +0000 (01:50 -0400)]
Move PIT setup from clock.c to hw/timer.c.

Move the hardware setup to the hw/timer.c code.  This eliminates the
need for a separate hw/pit.h file with definitions.

Also, move the IRQ counting code (which is dependent on the BDA) from
hw/timer.c to clock.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agobuild: simplify cross builds
Gerd Hoffmann [Fri, 20 Sep 2013 11:29:01 +0000 (13:29 +0200)]
build: simplify cross builds

This patch simplifies seabios cross-builds on !x86 platforms.
It adds a CROSS_PREFIX variable which is used to set CC, LD &
friends to the cross build binaries.  It also moves the common
command definitions up in the Makefile to make sure CC is set
correctly when probing compiler flags using $(call cc-option ...)

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agofix buildversion.sh
Gerd Hoffmann [Fri, 13 Sep 2013 12:12:23 +0000 (14:12 +0200)]
fix buildversion.sh

Recent git versions place the submodule git repos into the
.git/modules directory of the toplevel repo.  In that case
.git of the seabios tree isn't a directory, but a regular
file, saying where the gitdir is.

Extent the git check to also allow .git being a regular file,
so buildversion.sh works correctly when called within the qemu
submodule.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb: add xhci support
Gerd Hoffmann [Mon, 3 Jun 2013 14:30:18 +0000 (16:30 +0200)]
usb: add xhci support

$subject says all.  Support for usb3 streams is not implemented yet,
otherwise it is fully functional.  Tested all usb devices supported
by qemu (keyboard, storage, usb hubs), except for usb attached scsi
in usb3 mode (which needs streams).

Tested on qemu only, tagged with QEMU_HARDWARE because of that.
Testing with physical hardware to be done.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agousb: add usb_update_pipe()
Gerd Hoffmann [Wed, 21 Aug 2013 11:59:21 +0000 (13:59 +0200)]
usb: add usb_update_pipe()

Preparation for better xhci support: allows to notify host controllers
instead of going through a free+alloc cycle.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agouas: add (temporary) superspeed stopgap
Gerd Hoffmann [Thu, 13 Jun 2013 12:23:08 +0000 (14:23 +0200)]
uas: add (temporary) superspeed stopgap

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoAdd qemu detection to csm
Gerd Hoffmann [Tue, 3 Sep 2013 09:52:13 +0000 (11:52 +0200)]
Add qemu detection to csm

Add a qemu_preinit() call to csm initialization,
so PF_QEMU gets set when running on qemu.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoDrop coreboot qemu detection
Gerd Hoffmann [Tue, 3 Sep 2013 09:41:56 +0000 (11:41 +0200)]
Drop coreboot qemu detection

Not needed any more, the new qemu_detect() function
does the job instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoAdd generic qemu detection
Gerd Hoffmann [Tue, 3 Sep 2013 09:41:01 +0000 (11:41 +0200)]
Add generic qemu detection

This patch adds support for detecting whenever SeaBIOS runs on qemu
or not.  This is done by looking at the northbridge (pci device 00:00.0)
and check the subsystem id.  Most pci devices emulated by qemu -- the
two northbridges i440fx and q35 included -- have a subsystem id of
"1af4:1100".

In case the subsystem ID matches set PF_QEMU, log a message (including
the northbridge found while being at it) and also check for kvm.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoSort the sections of util.h.
Kevin O'Connor [Sun, 15 Sep 2013 04:43:51 +0000 (00:43 -0400)]
Sort the sections of util.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMerge bmp.h, boot.h, jpeg.h, and post.h into util.h.
Kevin O'Connor [Sun, 15 Sep 2013 04:31:17 +0000 (00:31 -0400)]
Merge bmp.h, boot.h, jpeg.h, and post.h into util.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove standard bda type info from biosvar.h to std/bda.h.
Kevin O'Connor [Sun, 15 Sep 2013 04:14:28 +0000 (00:14 -0400)]
Move standard bda type info from biosvar.h to std/bda.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoSplit disk.h into block.h and std/disk.h.
Kevin O'Connor [Sun, 15 Sep 2013 03:57:26 +0000 (23:57 -0400)]
Split disk.h into block.h and std/disk.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove pmm definitions to new file std/pmm.h.
Kevin O'Connor [Sun, 15 Sep 2013 03:09:06 +0000 (23:09 -0400)]
Move pmm definitions to new file std/pmm.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove pnpbios definition to new file std/pnpbios.h.
Kevin O'Connor [Sun, 15 Sep 2013 03:04:08 +0000 (23:04 -0400)]
Move pnpbios definition to new file std/pnpbios.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove fw/acpi.h to std/acpi.h.
Kevin O'Connor [Sun, 15 Sep 2013 02:54:44 +0000 (22:54 -0400)]
Move fw/acpi.h to std/acpi.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove fw/mptable.h to std/mptable.h.
Kevin O'Connor [Sun, 15 Sep 2013 02:48:04 +0000 (22:48 -0400)]
Move fw/mptable.h to std/mptable.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove fw/smbios.h to std/smbios.h.
Kevin O'Connor [Sun, 15 Sep 2013 02:45:05 +0000 (22:45 -0400)]
Move fw/smbios.h to std/smbios.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove fw/LegacyBios.h to std/LegacyBios.h and remove csm.h.
Kevin O'Connor [Sun, 15 Sep 2013 02:38:00 +0000 (22:38 -0400)]
Move fw/LegacyBios.h to std/LegacyBios.h and remove csm.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove vbe.h to std/vbe.h.
Kevin O'Connor [Sun, 15 Sep 2013 02:29:32 +0000 (22:29 -0400)]
Move vbe.h to std/vbe.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove optionroms.h to std/optionrom.h and util.h.
Kevin O'Connor [Sun, 15 Sep 2013 02:27:14 +0000 (22:27 -0400)]
Move optionroms.h to std/optionrom.h and util.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove pirtable definitions from hw/pci.h to std/pirtable.h and util.h.
Kevin O'Connor [Sun, 15 Sep 2013 02:22:28 +0000 (22:22 -0400)]
Move pirtable definitions from hw/pci.h to std/pirtable.h and util.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agobuild: Fix import of gcc dependency files.
Kevin O'Connor [Sun, 15 Sep 2013 02:05:58 +0000 (22:05 -0400)]
build: Fix import of gcc dependency files.

Make sure dependency file import works with new hw/ and fw/
sub-directories.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove definition of struct segoff_s from farptr.h to types.h.
Kevin O'Connor [Sun, 15 Sep 2013 02:03:57 +0000 (22:03 -0400)]
Move definition of struct segoff_s from farptr.h to types.h.

The segoff_s definition is used by a number of header files that would
not otherwise need farptr.h, so move it to a more central location.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove function definitions for output.c from util.h to new file output.h.
Kevin O'Connor [Sun, 15 Sep 2013 01:55:26 +0000 (21:55 -0400)]
Move function definitions for output.c from util.h to new file output.h.

Also, sort the order of include files in the c files.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove malloc code from pmm.c to new files malloc.c and malloc.h.
Kevin O'Connor [Sun, 15 Sep 2013 00:23:54 +0000 (20:23 -0400)]
Move malloc code from pmm.c to new files malloc.c and malloc.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove romfile definitions from util.h to new file romfile.h.
Kevin O'Connor [Sat, 14 Sep 2013 23:37:36 +0000 (19:37 -0400)]
Move romfile definitions from util.h to new file romfile.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove stacks.c definitions from util.h to new file stacks.h.
Kevin O'Connor [Sat, 14 Sep 2013 23:28:55 +0000 (19:28 -0400)]
Move stacks.c definitions from util.h to new file stacks.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agobuild: Perform compile checking on vgasrc code.
Kevin O'Connor [Sun, 15 Sep 2013 05:17:06 +0000 (01:17 -0400)]
build: Perform compile checking on vgasrc code.

Perform a compile check on each individual C file of the vgabios code
similar to the way that the main bios code does individual C compile
tests.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoRename util.c to string.c and introduce string.h.
Kevin O'Connor [Sat, 14 Sep 2013 23:10:40 +0000 (19:10 -0400)]
Rename util.c to string.c and introduce string.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove keyboard calling code from util.c to boot.c.
Kevin O'Connor [Sat, 14 Sep 2013 17:09:27 +0000 (13:09 -0400)]
Move keyboard calling code from util.c to boot.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoSplit x86 specific functions out of util.c/h to new files x86.c/h.
Kevin O'Connor [Sat, 14 Sep 2013 17:01:30 +0000 (13:01 -0400)]
Split x86 specific functions out of util.c/h to new files x86.c/h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoreadme: Minor - fix typo in readme.
Kevin O'Connor [Sat, 14 Sep 2013 16:38:56 +0000 (12:38 -0400)]
readme: Minor - fix typo in readme.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Limit the range of the VBE number of "pages" parameter.
Kevin O'Connor [Fri, 13 Sep 2013 20:21:10 +0000 (16:21 -0400)]
vgabios: Limit the range of the VBE number of "pages" parameter.

Looking at the output of other VGA BIOS implementations, it appears
that the number of available video pages reported is always between 1
and 127.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agovgabios: Rename stdvga_bpp_factor to stdvga_vram_ratio.
Kevin O'Connor [Tue, 10 Sep 2013 14:41:33 +0000 (10:41 -0400)]
vgabios: Rename stdvga_bpp_factor to stdvga_vram_ratio.

Invert the values returned by stdvga_bpp_factor and rename it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agobochsvga: fallback to stdvga if dispi interface isn't present
Gerd Hoffmann [Thu, 5 Sep 2013 08:16:18 +0000 (10:16 +0200)]
bochsvga: fallback to stdvga if dispi interface isn't present

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoahci: add missing check for allocation failure
Gerd Hoffmann [Mon, 9 Sep 2013 14:33:06 +0000 (16:33 +0200)]
ahci: add missing check for allocation failure

Triggerable by creating a virtual machine with
*lots* of ahci controllers and disks.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoREADME: Update readme to note scripts/ directory rename and vgasrc/ directory.
Kevin O'Connor [Fri, 13 Sep 2013 20:29:11 +0000 (16:29 -0400)]
README: Update readme to note scripts/ directory rename and vgasrc/ directory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agobuild: Reorder makefile source list to group like files together.
Kevin O'Connor [Tue, 3 Sep 2013 01:38:57 +0000 (21:38 -0400)]
build: Reorder makefile source list to group like files together.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove code cenetered around firmware initialization to src/fw/
Kevin O'Connor [Tue, 3 Sep 2013 01:25:21 +0000 (21:25 -0400)]
Move code cenetered around firmware initialization to src/fw/

Move many C files from the src/ directory to the new src/fw/ directory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove code centered around specific hardware devices to src/hw/
Kevin O'Connor [Tue, 3 Sep 2013 00:48:46 +0000 (20:48 -0400)]
Move code centered around specific hardware devices to src/hw/

Move many C files from the src/ directory to the new src/hw/ directory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agobuild: Don't use vpath makefile directive.
Kevin O'Connor [Mon, 2 Sep 2013 23:58:48 +0000 (19:58 -0400)]
build: Don't use vpath makefile directive.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoUpdate kconfig to latest version.
Kevin O'Connor [Sat, 24 Aug 2013 17:43:09 +0000 (13:43 -0400)]
Update kconfig to latest version.

Update kconfig (from Linux v2.6.38-rc2) to the latest version (from
Linux v3.11-rc6).

This is a copy of 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 agoRename tools/ directory to scripts/ directory.
Kevin O'Connor [Sat, 17 Aug 2013 14:13:14 +0000 (10:13 -0400)]
Rename tools/ directory to scripts/ directory.

It's common for other projects (eg, QEMU, Linux) to put build scripts
into a "scripts/" directory.  There's no reason for SeaBIOS to be
different, so rename the "tools/" directory to "scripts/".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMinor - simplify rom_reserve().
Kevin O'Connor [Thu, 15 Aug 2013 03:37:56 +0000 (23:37 -0400)]
Minor - simplify rom_reserve().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMinor - no need to declare MaxCountCPUs as VARFSEG.
Kevin O'Connor [Sat, 10 Aug 2013 14:37:50 +0000 (10:37 -0400)]
Minor - no need to declare MaxCountCPUs as VARFSEG.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoAdd config option to support memory allocations in 9-segment.
Kevin O'Connor [Thu, 8 Aug 2013 03:03:47 +0000 (23:03 -0400)]
Add config option to support memory allocations in 9-segment.

Internal "low memory" allocations are currently placed in the UMB
region (0xc0000-0xf0000).  However, there have been reports of some
real machines that do not support DMA to this area of memory.  So, add
a compile time config option (off by default) to support placing all
internal low-memory allocations at the end of the 640K real-memory
area (0x90000-0xa0000).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMinor cleanups to smm assembler.
Kevin O'Connor [Sat, 10 Aug 2013 15:39:14 +0000 (11:39 -0400)]
Minor cleanups to smm assembler.

Use size prefixes on assembler instructions.

Split the relocation smm handler into a separate section from the main
runtime smm handler.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoapm: fix shutdown
Gerd Hoffmann [Thu, 25 Jul 2013 07:47:18 +0000 (09:47 +0200)]
apm: fix shutdown

Qemu commit 9ee59f3 removed the bochs bios apm interface emulation at
port 0x8900.  That broke poweroff via APM.  Fix it by powering off the
machine using the acpi pm control register.

Old code is left in, so seabios wil try both poweroff methods.  Cleaning
that eventually up is left for another patch, after checking it isn't
needed.  Qemu never implemented "Standby" and "Suspend", only
"Shutdown", so it looks like there might be non-qemu use cases (bochs
probably).

Easiest way to test this is the syslinux poweroff module; modern linux
distros usually have CONFIG_APM turned off.

Reported-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoacpi_extract.py: document DEVICE directives
Michael S. Tsirkin [Thu, 1 Aug 2013 16:05:09 +0000 (19:05 +0300)]
acpi_extract.py: document DEVICE directives

commit 2b568ebb20b08c7881d976b5bc9f59a425bae5e6
    acpi_extract: detect DeviceOp
added new directives to acpi_extract.py, but didn't
document them.
Add documentation at top of file.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agoSupport custom boot menu prompt and custom boot menu key.
Kevin O'Connor [Fri, 2 Aug 2013 18:13:50 +0000 (14:13 -0400)]
Support custom boot menu prompt and custom boot menu key.

Allow configuration of the boot menu prompt and boot menu key (via the
romfile interface).  Some machines don't have an F12 key, so make this
configurable.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoFix bug in CBFS file walking with compressed files.
Kevin O'Connor [Fri, 2 Aug 2013 18:12:09 +0000 (14:12 -0400)]
Fix bug in CBFS file walking with compressed files.

The file walking code was incorrectly using the uncompressed file size
when searching for the next file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoAdd missing mathcp_setup() call to CSM code.
Kevin O'Connor [Mon, 22 Jul 2013 00:01:07 +0000 (20:01 -0400)]
Add missing mathcp_setup() call to CSM code.

It looks like when mathcp_setup() got moved from interface_init() to
platform_hardware_setup() in 3a735baa the corresponding change was not
made to the CSM code.  Update it now.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoDefault unused UMB areas to be read-only.
Kevin O'Connor [Sun, 21 Jul 2013 20:38:18 +0000 (16:38 -0400)]
Default unused UMB areas to be read-only.

It looks like MSDOS 6 wants the UMB area to be read-only in order for
it to use it.  FreeDOS doesn't care, but it always maps a page from
high mem when it does use the area.  So, add an option to control
whether unused UMB ram is marked read-only and default it to read-only
as that seems to be more compatible.

This also fixes an off-by-one bug in the shadow range checking code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoUnify pmtimer_read() and pittimer_read() code.
Kevin O'Connor [Sat, 20 Jul 2013 23:09:07 +0000 (19:09 -0400)]
Unify pmtimer_read() and pittimer_read() code.

These two functions both need to add in extra high bits to their
timers, and this code is the bulk of these functions.  Factor out the
duplicate code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoSeparate out timer setup code.
Kevin O'Connor [Sat, 20 Jul 2013 22:39:37 +0000 (18:39 -0400)]
Separate out timer setup code.

Split timer_setup() - put the tsc calibration code in its own
function.

Group all the timer setup functions together.

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