]> xenbits.xensource.com Git - people/andrewcoop/seabios.git/log
people/andrewcoop/seabios.git
11 years agofix buildversion.sh 1.7.3-stable rel-1.7.3.2
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>
(cherry picked from commit 0b3607f89ac24f84f8b22ffaadb4f0fd111bda24)

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>
(cherry picked from commit ce12eaf2044d6aae08795403ecbb888d2b6527ff)

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>
(cherry picked from commit 5b63109242042372c1d6c3d23602e980f1c9637b)

Conflicts:
src/acpi.c
src/pciinit.c

11 years agoFix bug in CBFS file walking with compressed files. rel-1.7.3.1
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>
(cherry picked from commit 1a113e1144113348e04cbe39fa81a448049e82a0)

11 years agoacpi: sync FADT flags from PIIX4 to Q35
Michael S. Tsirkin [Wed, 17 Jul 2013 05:14:53 +0000 (08:14 +0300)]
acpi: sync FADT flags from PIIX4 to Q35

The following commits updated the FADT flags for PIIX4:
commit c7be281b3be0f2013aa4b5d5f400981a1adb6e63
    Drop FIX_RTC flag from FADT.
commit a4e2b9adbba95c2d783761e84444bbb3c8d6107b
    enable USE_PLATFORM_CLOCK bit in FADT flags

Q35 support was originally written before these commits in seabios, PIIX
got updated, Q35 didn't.  QEMU uses the same clock for both so there's
no reason for these bits to differ.  Sync them up.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit ed88f6515c18d9520efa4a41ccb70038dfbe43f9)

11 years agoFix USB EHCI detection that was broken in hlist conversion of PCIDevices.
Kevin O'Connor [Sun, 14 Jul 2013 17:55:52 +0000 (13:55 -0400)]
Fix USB EHCI detection that was broken in hlist conversion of PCIDevices.

Make sure the PCI device list is ordered in bus order.

Don't iterate past the end of the list when detecting EHCI devices.

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

11 years agoMinor - remove debugging dprintf added to pciinit.c. rel-1.7.3
Kevin O'Connor [Fri, 14 Jun 2013 01:35:51 +0000 (21:35 -0400)]
Minor - remove debugging dprintf added to pciinit.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoAnother fix for hlist_for_each_entry_safe.
Kevin O'Connor [Fri, 14 Jun 2013 01:24:14 +0000 (21:24 -0400)]
Another fix for hlist_for_each_entry_safe.

Although the previous patch does fix hlist_for_each_entry_safe for the
common case, it doesn't work correctly when deleting the current
node.  To fix this, introduce two macros - hlist_for_each_entry_safe
for iterating through a list that can be modified, and
hlist_for_each_entry_pprev for those users that only need access to
the "pprev" pointer.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agomake qemu_cfg_init depend on QEMU_HARDWARE instead of QEMU
Kevin O'Connor [Fri, 14 Jun 2013 00:04:31 +0000 (20:04 -0400)]
make qemu_cfg_init depend on QEMU_HARDWARE instead of QEMU

Gets qemu features like direct kernel boot and boot
ordering going when seabios runs on coreboot.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agotweak coreboot qemu detection
Gerd Hoffmann [Thu, 13 Jun 2013 05:42:58 +0000 (07:42 +0200)]
tweak coreboot qemu detection

I have patches for coreboot in the queue adding q35 support there,
which will change the mainboard names (adding the detected chipset).
Make SeaBIOS check the mainboard name starts with "QEMU" instead of
doing a full string match to handle this.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoConvert pciinit.c to use standard list manipulation code.
Kevin O'Connor [Sun, 9 Jun 2013 01:51:46 +0000 (21:51 -0400)]
Convert pciinit.c to use standard list manipulation code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoFix error in hlist_for_each_entry_safe macro.
Kevin O'Connor [Fri, 14 Jun 2013 00:44:09 +0000 (20:44 -0400)]
Fix error in hlist_for_each_entry_safe macro.

Fix broken macro - it did not work correctly at all.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoRevert "Convert pciinit.c to use standard list manipulation code."
Kevin O'Connor [Thu, 13 Jun 2013 12:42:29 +0000 (08:42 -0400)]
Revert "Convert pciinit.c to use standard list manipulation code."

This reverts commit aab42152881dc62b37f1833e79cbdb3dfa51603b.

11 years agocoreboot: add qemu detection
Gerd Hoffmann [Mon, 3 Jun 2013 06:06:27 +0000 (08:06 +0200)]
coreboot: add qemu detection

11 years agoconfig: allow DEBUG_IO for !QEMU
Gerd Hoffmann [Wed, 5 Jun 2013 07:37:24 +0000 (09:37 +0200)]
config: allow DEBUG_IO for !QEMU

Make DEBUG_IO depend on QEMU_HARDWARE instead of QEMU, so
it can be enabled for seabios builds running indirectly
(coreboot, csm) on qemu.

Add runtime check for PF_QEMU to debug port console to make
sure we don't poke on random ports on physical hardware.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoConvert PCIDevices list to use standard list manipultion code.
Kevin O'Connor [Sun, 9 Jun 2013 01:53:36 +0000 (21:53 -0400)]
Convert PCIDevices list to use standard list manipultion code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoConvert pciinit.c to use standard list manipulation code.
Kevin O'Connor [Sun, 9 Jun 2013 01:51:46 +0000 (21:51 -0400)]
Convert pciinit.c to use standard list manipulation code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoConvert boot.c to use standard list manipulation code.
Kevin O'Connor [Sun, 9 Jun 2013 01:50:53 +0000 (21:50 -0400)]
Convert boot.c to use standard list manipulation code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoConvert stacks.c to use standard list manipulation code.
Kevin O'Connor [Sun, 9 Jun 2013 01:50:15 +0000 (21:50 -0400)]
Convert stacks.c to use standard list manipulation code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoIntroduce helper function have_threads() in stacks.c.
Kevin O'Connor [Sun, 9 Jun 2013 02:11:07 +0000 (22:11 -0400)]
Introduce helper function have_threads() in stacks.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMinor - relocate code in stacks.c to keep low-level thread code together.
Kevin O'Connor [Sun, 9 Jun 2013 02:05:19 +0000 (22:05 -0400)]
Minor - relocate code in stacks.c to keep low-level thread code together.

Just code movement - no actual code changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoIntroduce and convert pmm code to use standard list helpers.
Kevin O'Connor [Sun, 9 Jun 2013 01:49:12 +0000 (21:49 -0400)]
Introduce and convert pmm code to use standard list helpers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMinor - move "tracked memory alloc" code in pmm.c.
Kevin O'Connor [Sun, 2 Jun 2013 17:09:30 +0000 (13:09 -0400)]
Minor - move "tracked memory alloc" code in pmm.c.

Move the "pmm_malloc" code closer to the low level alloc functions it
calls.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMinor - explicitly close files in buildrom.py.
Kevin O'Connor [Tue, 21 May 2013 01:39:56 +0000 (21:39 -0400)]
Minor - explicitly close files in buildrom.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoAdd pvpanic device driver
Hu Tao [Fri, 5 Apr 2013 07:17:51 +0000 (15:17 +0800)]
Add pvpanic device driver

pvpanic device is used to notify host(qemu) when guest panic happens.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
12 years agoacpi: Use cpu_to_leXX() consistently.
Kevin O'Connor [Sat, 30 Mar 2013 14:18:47 +0000 (10:18 -0400)]
acpi: Use cpu_to_leXX() consistently.

Audit the ACPI code and ensure that all multi-byte fields do proper
byte swabbing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoacpi: Remove dead code with descriptions of bit flags.
Kevin O'Connor [Sat, 30 Mar 2013 13:40:07 +0000 (09:40 -0400)]
acpi: Remove dead code with descriptions of bit flags.

Remove dead code from acpi table definitions - the ACPI specification
is the best place to get descriptions of the fields and tables anyway.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoacpi: Move ACPI table definitions from acpi.c to acpi.h.
Kevin O'Connor [Sat, 30 Mar 2013 13:34:10 +0000 (09:34 -0400)]
acpi: Move ACPI table definitions from acpi.c to acpi.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoUse container_of on romfile entries.
Kevin O'Connor [Sat, 30 Mar 2013 13:12:11 +0000 (09:12 -0400)]
Use container_of on romfile entries.

Create cbfs and fw_cfg specific romfile_s wrappers instead of using
private variables directly in romfile_s.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoCleanup QEMU_CFG_NUMA fw_cfg processing - split into two romfile entries.
Kevin O'Connor [Sat, 23 Mar 2013 15:38:45 +0000 (11:38 -0400)]
Cleanup QEMU_CFG_NUMA fw_cfg processing - split into two romfile entries.

The QEMU_CFG_NUMA fw_cfg entry is actually two separate tables in one
fw_cfg entry - a table for cpu affinity and a table for the memory
map.  Create two romfile entries to make that more clear.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoacpi: make default DSDT optional
Michael S. Tsirkin [Mon, 18 Mar 2013 13:18:25 +0000 (15:18 +0200)]
acpi: make default DSDT optional

Since commit f7e4dd6c18ccfbaf6cd2f5eaaed2b77cabc8a406 QEMU loads its
own copy of DSDT, so let's not build in PIIX.  This makes building in
the DSDT an option, default to on (built-in).  If no one complains for a
while, we'll be able to switch it off and then maybe remove altogether.

With CONFIG_ACPI_DSDT = y
Total size: 127348  Fixed: 58892  Free: 3724 (used 97.2% of 128KiB rom)
With CONFIG_ACPI_DSDT = n
Total size: 122844  Fixed: 58884  Free: 8228 (used 93.7% of 128KiB rom)

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
12 years agopciinit: Enable default VGA device
Alex Williamson [Wed, 20 Mar 2013 16:58:47 +0000 (10:58 -0600)]
pciinit: Enable default VGA device

As QEMU gains PCI bridge and PCIe root port support, we won't always
find the VGA device on the root bus.  We therefore need to add support
to find and enable a VGA device and the path to it through the VGA
Enable support in the PCI bridge control register.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
12 years agomptable: Use same PCI irqs as ACPI code.
Kevin O'Connor [Tue, 19 Mar 2013 00:26:54 +0000 (20:26 -0400)]
mptable: Use same PCI irqs as ACPI code.

The ACPI code has a hardcoded list of PCI interrupts.  Use that same
list in the mptable code generation.  This will ensure that both
tables are in synch - it may also make the mptable easier to generate
from QEMU.

Also, move the irq0_override lookup outside of the irq loop.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agomptable: Don't describe pci-to-pci bridges.
Kevin O'Connor [Tue, 19 Mar 2013 00:14:21 +0000 (20:14 -0400)]
mptable: Don't describe pci-to-pci bridges.

It should not be necessary to describe PCI-to-PCI bridges in the
mptable.  (The mptable was designed to fit in ROM, so it seems
unlikely that it would be used for bridges that could be dynamically
added.)  Describing only the root bus should make it easier to port
this content into QEMU.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoSet ZF prior to keyboard read call in check_for_keystroke().
Kevin O'Connor [Sun, 17 Mar 2013 14:32:05 +0000 (10:32 -0400)]
Set ZF prior to keyboard read call in check_for_keystroke().

Set the ZF flag to make sure the keyboard interrupt is actively
clearing it on a key event.  This fixes a hang when CONFIG_BOOTMENU is
on and CONFIG_KEYBOARD is off.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoAdd dependencies to vgafixup.py and buildversion.sh scripts.
Kevin O'Connor [Sun, 17 Mar 2013 14:30:51 +0000 (10:30 -0400)]
Add dependencies to vgafixup.py and buildversion.sh scripts.

Rebuild targets if these scripts change.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoUpdate README - copy *.aml files for QEMU.
Kevin O'Connor [Sun, 17 Mar 2013 14:29:06 +0000 (10:29 -0400)]
Update README - copy *.aml files for QEMU.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovirtio-scsi: Pack struct virtio_scsi_{req_cmd,resp_cmd}
Asias He [Fri, 15 Mar 2013 01:45:16 +0000 (09:45 +0800)]
virtio-scsi: Pack struct virtio_scsi_{req_cmd,resp_cmd}

Device needs the exact size of these data structure. Prevent padding.

This fixes guest hang when booting seabios + tcm_vhost.

Signed-off-by: Asias He <asias@redhat.com>
12 years agovirtio-scsi: Set _DRIVER_OK flag before scsi target scanning
Asias He [Fri, 15 Mar 2013 01:45:15 +0000 (09:45 +0800)]
virtio-scsi: Set _DRIVER_OK flag before scsi target scanning

Before we start scsi target scanning, we need to set the
VIRTIO_CONFIG_S_DRIVER_OK flag so the device can do setup properly.

This fix a bug when booting tcm_vhost with seabios.

Signed-off-by: Asias He <asias@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoFix bug in NUMA node setup - don't create SRAT if NUMA not present.
Kevin O'Connor [Sun, 10 Mar 2013 01:43:00 +0000 (20:43 -0500)]
Fix bug in NUMA node setup - don't create SRAT if NUMA not present.

Make sure to check for the case where there are no NUMA nodes passed
in from QEMU.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor - add missing newline to floppy debug statement.
Kevin O'Connor [Sun, 10 Mar 2013 01:07:38 +0000 (20:07 -0500)]
Minor - add missing newline to floppy debug statement.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Fix cirrus memory clear on mode switch.
Kevin O'Connor [Sat, 9 Mar 2013 18:04:47 +0000 (13:04 -0500)]
vgabios: Fix cirrus memory clear on mode switch.

The cirrus_clear_vram() code wasn't actually doing anything because of
a u8 overflow.  Fix that.

Fill with 0xff when performing a legacy cirrus mode switch (WinXP has
been observed to incorrectly render dialog boxes if the memory is
filled to 0).  This was the behavior of the original LGPL vgabios
code.  To support this, add mechanism (MF_LEGACY) to allow vga drivers
to detect if the mode switch is from vesa or int10.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agovgabios: Fix stdvga_perform_gray_scale_summing().
Kevin O'Connor [Sat, 9 Mar 2013 18:00:40 +0000 (13:00 -0500)]
vgabios: Fix stdvga_perform_gray_scale_summing().

Fix conversion error that resulted in
stdvga_perform_gray_scale_summing not actually writing the new results
back.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoUse VARVERIFY32INIT on global variables that point to "tmp" memory.
Kevin O'Connor [Sat, 9 Mar 2013 00:39:49 +0000 (19:39 -0500)]
Use VARVERIFY32INIT on global variables that point to "tmp" memory.

Enable the recently added build check on global variables that are (or
contain) pointers to memory allocated by malloc_tmp().  This helps
detect cases where temporary memory is accessed after POST.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoAdd VARVERIFY32INIT attribute for variables only available during "init".
Kevin O'Connor [Sat, 9 Mar 2013 00:36:28 +0000 (19:36 -0500)]
Add VARVERIFY32INIT attribute for variables only available during "init".

Add a build check to verify certain variables are only reachable via
the 32bit "init" code.  This can be used as a mechanism to enforce
certain data (and code that accesses that data) as only available
during POST.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agosmm: Don't use PCIDevices list in smm_setup().
Kevin O'Connor [Sat, 9 Mar 2013 00:33:39 +0000 (19:33 -0500)]
smm: Don't use PCIDevices list in smm_setup().

The smm_setup() call is invoked from resume.  The PCIDevices list is
only valid during POST.  Cache the necessary PCI BDF ids so that
PCIDevices isn't needed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoshadow: Don't use PCIDevices list in make_bios_readonly().
Kevin O'Connor [Sat, 9 Mar 2013 00:31:14 +0000 (19:31 -0500)]
shadow: Don't use PCIDevices list in make_bios_readonly().

The make_bios_readonly() call is invoked from resume.  The PCIDevices
list is only valid during POST.  Cache the necessary PCI BDF ids so
that PCIDevices isn't needed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoDon't use __FILE__ in virtio-ring.c.
Kevin O'Connor [Sat, 9 Mar 2013 00:28:06 +0000 (19:28 -0500)]
Don't use __FILE__ in virtio-ring.c.

Avoid referencing __FILE__ - that value changes depending on the
user's build setting of OUT.  The function and line number are
sufficient.

Also, use panic() instead of looping forever.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoAdd additional dependency checks to Makefile.
Kevin O'Connor [Sat, 9 Mar 2013 00:23:18 +0000 (19:23 -0500)]
Add additional dependency checks to Makefile.

Generate dependencies on pre-processed ASL files.  This ensures that a
change to an imported dsdt file will cause iasl to be called.

Make .config depend on Kconfig files.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoacpi: Eliminate BDAT parameter passing to DSDT code.
Kevin O'Connor [Thu, 7 Mar 2013 02:50:09 +0000 (21:50 -0500)]
acpi: Eliminate BDAT parameter passing to DSDT code.

The "BDAT" construct is the only ACPI mechanism that relies on SeaBIOS
reserved memory.  Replace it with the SSDT based template system.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRename src/ssdt-susp.dsl to src/ssdt-misc.dsl.
Kevin O'Connor [Thu, 28 Feb 2013 01:46:40 +0000 (20:46 -0500)]
Rename src/ssdt-susp.dsl to src/ssdt-misc.dsl.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoCache boot-fail-wait to avoid romfile access after POST.
Kevin O'Connor [Tue, 5 Mar 2013 09:52:21 +0000 (17:52 +0800)]
Cache boot-fail-wait to avoid romfile access after POST.

Memory allocated with malloc_tmp() can't be used after the POST phase.
So, access boot-fail-wait in post phase and store it for the boot
phase to use.  This fixes the regression introduced by commit
59d6ca52.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Amos Kong <akong@redhat.com>
12 years agoMinor - note that passing QEMU config via cmos is deprecated.
Kevin O'Connor [Sun, 3 Mar 2013 20:46:00 +0000 (15:46 -0500)]
Minor - note that passing QEMU config via cmos is deprecated.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agofloppy: Actually do controller reset in floppy_reset().
Kevin O'Connor [Sun, 3 Mar 2013 20:32:31 +0000 (15:32 -0500)]
floppy: Actually do controller reset in floppy_reset().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agofloppy: Implement media format sensing.
Kevin O'Connor [Sun, 3 Mar 2013 18:59:58 +0000 (13:59 -0500)]
floppy: Implement media format sensing.

Check for lower capacity media in the floppy drive and set the
corresponding controller data rate for it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agofloppy: Improve floppy_pio() error checking.
Kevin O'Connor [Sun, 3 Mar 2013 16:05:19 +0000 (11:05 -0500)]
floppy: Improve floppy_pio() error checking.

The controller can be busy on a response without it being an error.
Don't spin infinitely if status isn't what is expected.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agofloppy: Move recalibration and results parsing to floppy_cmd().
Kevin O'Connor [Sun, 3 Mar 2013 15:27:30 +0000 (10:27 -0500)]
floppy: Move recalibration and results parsing to floppy_cmd().

Move some prep and error checking into floppy_cmd() from its callers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agofloppy: Clean up Check Interrupt Status code.
Kevin O'Connor [Sun, 3 Mar 2013 02:26:54 +0000 (21:26 -0500)]
floppy: Clean up Check Interrupt Status code.

Don't run the Check Interrupt Status command from the floppy hardware
interrupt handler.  Instead, run it where it is needed - after
controller startup and after a recalibration command.  Also, use
floppy_pio() to issue the command instead of open coding it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agofloppy: Cleanup floppy irq wait handling.
Kevin O'Connor [Sun, 3 Mar 2013 01:30:50 +0000 (20:30 -0500)]
floppy: Cleanup floppy irq wait handling.

Rename FRS_TIMEOUT to FRS_IRQ - the flag indicates that an irq has
been received - it isn't directly related to timeouts.

On a timeout event, disable the floppy controller instead of doing a
full reset.  Also, perform the disable directly in floppy_wait_irq().

Always wait for the floppy irq after enabling the controller and after
a recalibrate command.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agofloppy: Introduce 'struct floppy_pio_s' for floppy PIO ops.
Kevin O'Connor [Sat, 2 Mar 2013 23:37:04 +0000 (18:37 -0500)]
floppy: Introduce 'struct floppy_pio_s' for floppy PIO ops.

Populate a struct for the PIO operations and move the PIO manipulation
done in floppy_cmd() to floppy_pio().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor - improve comments and grouping of handle_08().
Kevin O'Connor [Sat, 2 Mar 2013 23:19:31 +0000 (18:19 -0500)]
Minor - improve comments and grouping of handle_08().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoSupport using the "extra stack" for all 16bit irq entry points.
Kevin O'Connor [Sat, 2 Mar 2013 23:14:35 +0000 (18:14 -0500)]
Support using the "extra stack" for all 16bit irq entry points.

Using the internal stack reduces the amount of space that SeaBIOS uses
on the caller's stack.  This is known to help some very old operating
systems (like DOS 1.0).  However, there is a possibility that this
will break any operating systems that calls a legacy 16bit irq in
16bit protected mode (no OSes have yet to be identified as doing
this), so make the ability config dependent.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoSeparate out 16bit PCI-BIOS entry point from regular int 0x1a entry point.
Kevin O'Connor [Sat, 2 Mar 2013 09:02:11 +0000 (04:02 -0500)]
Separate out 16bit PCI-BIOS entry point from regular int 0x1a entry point.

The PCI-BIOS entry point can be called in 16bit protected mode, so
separate its entry code from the legacy 0x1a code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor - introduce numeric defines for the IVT offset of hw irqs.
Kevin O'Connor [Sun, 24 Feb 2013 02:33:36 +0000 (21:33 -0500)]
Minor - introduce numeric defines for the IVT offset of hw irqs.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor - fix confusing final_sec32low_start name in layoutrom.py.
Kevin O'Connor [Sat, 23 Feb 2013 21:07:00 +0000 (16:07 -0500)]
Minor - fix confusing final_sec32low_start name in layoutrom.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoTry to detect an unsuccessful hard-reboot to prevent soft-reboot loops.
Kevin O'Connor [Sat, 23 Feb 2013 15:37:58 +0000 (10:37 -0500)]
Try to detect an unsuccessful hard-reboot to prevent soft-reboot loops.

There have been various kvm bugs that prevent reboots from working
properly.  Generalize the existing test for a failed reboot to better
catch these cases.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoAdd acpi_reboot() reset method using RESET_REG
David Woodhouse [Sat, 23 Feb 2013 00:24:49 +0000 (00:24 +0000)]
Add acpi_reboot() reset method using RESET_REG

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoRename find_pmtimer() to find_acpi_features()
David Woodhouse [Sat, 23 Feb 2013 00:24:48 +0000 (00:24 +0000)]
Rename find_pmtimer() to find_acpi_features()

I'm about to make it do more than just the pmtimer...

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoFix return type of le64_to_cpu() and be64_to_cpu()
David Woodhouse [Sat, 23 Feb 2013 00:24:47 +0000 (00:24 +0000)]
Fix return type of le64_to_cpu() and be64_to_cpu()

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoseabios: Add a dummy PCI slot to irq mapping function
Alex Williamson [Thu, 21 Feb 2013 16:12:23 +0000 (09:12 -0700)]
seabios: Add a dummy PCI slot to irq mapping function

This should never get called, but if we somehow get a new chipset
that fails to implement their own pci_slot_get_irq function, fail
gracefully and add a debug log message.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
12 years agoseabios q35: Add new PCI slot to irq routing function
Alex Williamson [Fri, 15 Feb 2013 21:11:41 +0000 (14:11 -0700)]
seabios q35: Add new PCI slot to irq routing function

q35/ich9 doesn't use the same interrupt mapping function as
i440fx/piix.  PIRQA:D and PIRQE:H are programmed identically, but we
start at index 0, not index -1.  Slots 25 through 31 are also
programmed independently.

When running qemu w/o this patch, a device at address 0:6.0 will have
its PCI interrupt line register programmed with irq 10 (as seen by
info pci), but it actually uses irq 11 (as reported the guest).  Half
of the interrupt lines are misprogrammedi like this.  Functionally, a
fully emulated qemu guest doesn't care much, but when we try to use
device assignment, we really need to know the correct irqs.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
12 years agoUse CONFIG_ prefix for Kconfig variables; use BUILD_ for others.
Kevin O'Connor [Thu, 21 Feb 2013 04:48:22 +0000 (23:48 -0500)]
Use CONFIG_ prefix for Kconfig variables; use BUILD_ for others.

Rename remaining "build" settings in config.h that used the CONFIG_
prefix to use a BUILD_ prefix.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoEliminate separate BiosTableSpace[] space for f-segment allocations.
Kevin O'Connor [Wed, 20 Feb 2013 02:35:20 +0000 (21:35 -0500)]
Eliminate separate BiosTableSpace[] space for f-segment allocations.

The BiosTableSpace variable was used to ensure there was sufficient
space in the f-segment for malloc_fseg() calls.  However, it added 2K
to the final image size to reserve that space.

Update the build to determine where to put the f-segment allocations.
In most cases (when code relocation is enabled) allocations can be
done in the space free'd from the "init" sections and no additional
space needs to be reserved in the final image.  This also has the
benefit of not fragmenting the f-segment allocation space.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoCalculate "RamSize" needed by 16bit interface dynamically.
Kevin O'Connor [Tue, 19 Feb 2013 06:33:45 +0000 (01:33 -0500)]
Calculate "RamSize" needed by 16bit interface dynamically.

Calculate a LegacyRamSize directly from the e820 map for use by
handle_1588() and handle_15e801() (the only two external interfaces
that require "RamSize").  All other users of the existing RamSize (and
RamSizeOver4G) variables are specific to QEMU, so move the
declarations to paravirt.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMove malloc's ZoneFSeg and ZoneLow setup to malloc_init.
Kevin O'Connor [Tue, 19 Feb 2013 06:15:36 +0000 (01:15 -0500)]
Move malloc's ZoneFSeg and ZoneLow setup to malloc_init.

This reduces some duplicate code between malloc_preinit() and
csm_malloc_preinit().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoDon't relocate "varlow" variable references at runtime.
Kevin O'Connor [Tue, 19 Feb 2013 06:02:50 +0000 (01:02 -0500)]
Don't relocate "varlow" variable references at runtime.

Since the final location of the "varlow" variables are known at build
time, link the final locations into the binary during the build.  The
16bit code was already done at link time - update the build so the
32bit code is also done at link time.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert VAR16VISIBLE, VAR16EXPORT, and VAR32VISIBLE to VARFSEG.
Kevin O'Connor [Tue, 19 Feb 2013 04:36:03 +0000 (23:36 -0500)]
Convert VAR16VISIBLE, VAR16EXPORT, and VAR32VISIBLE to VARFSEG.

Convert all users of the alternative variable exports to VARFSEG.
There isn't a significant distinction between the existing types of
exports, so it's simpler to just use one type going forward.

The new VARFSEG declaration is only emitting when in 32bit mode, so
update and move some variables as needed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoIntroduce VARFSEG for variables that will reside in the f-segment.
Kevin O'Connor [Tue, 19 Feb 2013 04:09:01 +0000 (23:09 -0500)]
Introduce VARFSEG for variables that will reside in the f-segment.

Introduce a variable declaration that will force variables (that are
compiled in 32bit mode) to be emitted into the f-segment.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor assembler enhancements to __csm_return.
Kevin O'Connor [Tue, 19 Feb 2013 02:57:26 +0000 (21:57 -0500)]
Minor assembler enhancements to __csm_return.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRemove unnecessary "export" declarations from assembler functions.
Kevin O'Connor [Tue, 19 Feb 2013 02:50:57 +0000 (21:50 -0500)]
Remove unnecessary "export" declarations from assembler functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoseabios q35: Enable all PIRQn IRQs at startup
Alex Williamson [Fri, 15 Feb 2013 21:11:35 +0000 (14:11 -0700)]
seabios q35: Enable all PIRQn IRQs at startup

We seem to use the IRQEN bit of the PIRQn registers interchangeably
to select APIC mode or to disable an IRQ.  I can't decide if we're
intending to disable the IRQ or select APIC mode here, but in either
case it prevents PIC mode assigned devices from working.  When seabios
writes IRQEN to these registers, qemu interprets that as APIC mode,
so while the boot ROM driver is waiting for an interrupt on ISA
compatible IRQ 10 or 11, KVM is injecting interrupts to APIC pins
16 - 23.  Devices on the root bus use PIRQE:H while the root ports
use PIRQA:D.  Enable them all so we don't limit where we support boot
ROMs.  The guest will later disable unused IRQs with the ACPI _DIS
method.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
12 years agoDisable handle_post() on CSM builds.
Kevin O'Connor [Mon, 18 Feb 2013 16:49:53 +0000 (11:49 -0500)]
Disable handle_post() on CSM builds.

This reduces the size of the CSM binary by a few bytes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoDisable CONFIG_THREAD_OPTIONROMS for CSM build
David Woodhouse [Thu, 14 Feb 2013 08:55:52 +0000 (08:55 +0000)]
Disable CONFIG_THREAD_OPTIONROMS for CSM build

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoVerify CC is valid during build tests.
Kevin O'Connor [Mon, 18 Feb 2013 15:28:55 +0000 (10:28 -0500)]
Verify CC is valid during build tests.

Update test-build.sh to report if it can't run the c compiler at all.
Without this test, a totally non-working build environment will yield
an "invalid LD" message which can be confusing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoClarify build generated "zone low" values.
Kevin O'Connor [Sun, 17 Feb 2013 18:58:28 +0000 (13:58 -0500)]
Clarify build generated "zone low" values.

Rename datalow_base (and similar) to zonelow_base, and datalow_start
(and similar) to varlow_start.  This helps distinguish between the
bounds for the runtime dynamic memory pool and the compile time global
variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoReport on f-segment UMB ram also.
Kevin O'Connor [Sun, 17 Feb 2013 17:46:53 +0000 (12:46 -0500)]
Report on f-segment UMB ram also.

Some old DOS programs can also use f-segment space as Upper Memory
Blocks (UMB), so also report on what space is available in debug
messages.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRename rom_get_top() to rom_get_max().
Kevin O'Connor [Sun, 17 Feb 2013 17:44:23 +0000 (12:44 -0500)]
Rename rom_get_top() to rom_get_max().

Rename rom_get_top and try to make the difference between it and
rom_get_last more clear.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agobuild: Don't require $(OUT) to be a sub-directory of the main directory.
Kevin O'Connor [Sun, 17 Feb 2013 15:56:10 +0000 (10:56 -0500)]
build: Don't require $(OUT) to be a sub-directory of the main directory.

Remove references to "../" and "out/" from the build so that "make
OUT=/a/b/c/" will work.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoFix Makefile - don't reference "out/" directly, instead use "$(OUT)".
Kevin O'Connor [Sun, 17 Feb 2013 15:18:15 +0000 (10:18 -0500)]
Fix Makefile - don't reference "out/" directly, instead use "$(OUT)".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoEnable VGA output when setting Cirrus-specific mode
Laszlo Ersek [Thu, 14 Feb 2013 04:43:32 +0000 (05:43 +0100)]
Enable VGA output when setting Cirrus-specific mode

This patch does the same for Cirrus as David's following patch for bochs,
originally posted under
<http://www.seabios.org/pipermail/seabios/2013-February/005434.html>:

  Enable VGA output when settings bochs-specific mode

  When used from OVMF+CSM, we got no video output. It appears that we were
  never enabling the display output except when configuring a text mode.
  Which never happens, in the OVMF+CSM case.

In my testing on RHEL-6.3 with OVMF -D CSM_ENABLE / CONFIG_CSM bios.bin /
CONFIG_QEMU vgabios.bin, using Cirrus, VESA mode 0x115 is selected (Direct
Color, 800x600x24).

According to <http://www.osdever.net/FreeVGA/vga/attrreg.htm>,

  cirrus_switch_mode()
    stdvga_attr_mask()

currently keeps/sets the "Attribute Controller Graphics Enable" bit set in
the "Attribute Mode Control Register". When invoked from OVMF+CSM, that is
not enough however, so let's do the same as for Bochs:

  stdvga_attrindex_write(0x20);

which corresponds to setting the "Palette Address Source" bit in the
"Attribute Address Register":

  "This bit is set to 0 to load color values to the registers in the
  internal palette. It is set to 1 for normal operation of the attribute
  controller. [...]"

clext_set_mode()
  stdvga_set_mode() -- for regular modes
    stdvga_attrindex_write() -- existing call
  cirrus_switch_mode() -- for Cirrus modes
    stdvga_attrindex_write() -- call added by this patch

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoEnable VGA output when settings bochs-specific mode
David Woodhouse [Fri, 8 Feb 2013 15:50:54 +0000 (15:50 +0000)]
Enable VGA output when settings bochs-specific mode

When used from OVMF+CSM, we got no video output. It appears that we were
never enabling the display output except when configuring a text mode.
Which never happens, in the OVMF+CSM case.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agogeodevga: fix wrong define name
Christian Gmeiner [Thu, 14 Feb 2013 09:34:37 +0000 (10:34 +0100)]
geodevga: fix wrong define name

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agogeodevga: add debug to msr functions
Christian Gmeiner [Thu, 14 Feb 2013 09:34:36 +0000 (10:34 +0100)]
geodevga: add debug to msr functions

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agogeodevga: move output setup to own function
Christian Gmeiner [Thu, 14 Feb 2013 09:34:35 +0000 (10:34 +0100)]
geodevga: move output setup to own function

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agogeodevga: move framebuffer setup
Christian Gmeiner [Thu, 14 Feb 2013 09:34:34 +0000 (10:34 +0100)]
geodevga: move framebuffer setup

Framebuffer setup has nothing to do with dc_setup(..) so
move it to  geodevga_init(..).

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agogeodevga: fix errors in geode_fp_* functions
Christian Gmeiner [Thu, 14 Feb 2013 09:34:32 +0000 (10:34 +0100)]
geodevga: fix errors in geode_fp_* functions

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 years agoImplement !CONFIG_BOOT for CSM
David Woodhouse [Thu, 14 Feb 2013 09:17:17 +0000 (09:17 +0000)]
Implement !CONFIG_BOOT for CSM

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoImplement !CONFIG_OPTIONROMS support for CSM
David Woodhouse [Thu, 14 Feb 2013 09:07:35 +0000 (09:07 +0000)]
Implement !CONFIG_OPTIONROMS support for CSM

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoMake CONFIG_OPTIONROMS_DEPLOYED depend on CONFIG_QEMU
David Woodhouse [Thu, 14 Feb 2013 08:56:20 +0000 (08:56 +0000)]
Make CONFIG_OPTIONROMS_DEPLOYED depend on CONFIG_QEMU

Potentially we could even kill it off completely, since it only works
with old versions of Qemu. But it can stay for now as long as it doesn't
offend me in the CSM build...

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
12 years agoWarn on unaligned PCI ROM structure in option roms.
Kevin O'Connor [Sat, 16 Feb 2013 03:46:09 +0000 (22:46 -0500)]
Warn on unaligned PCI ROM structure in option roms.

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