]> xenbits.xensource.com Git - seabios.git/log
seabios.git
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>
11 years agoRename check_tsc() (and similar) to timer_check() and use u32.
Kevin O'Connor [Sat, 20 Jul 2013 22:22:57 +0000 (18:22 -0400)]
Rename check_tsc() (and similar) to timer_check() and use u32.

Rename the check_tsc() function to timer_check().  The CPU TSC is
often not the basis of the timer, so use a more appropriate name.

Convert all callers that were using u64 for the timers to use u32.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoRename check_timer() function (and similar) to irqtimer_check().
Kevin O'Connor [Sat, 20 Jul 2013 22:07:50 +0000 (18:07 -0400)]
Rename check_timer() function (and similar) to irqtimer_check().

Rename functions to be more consistent and so they are not confused
with the normal timer functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoShift CPU TSC down to reduce need for 64bit variables.
Kevin O'Connor [Sat, 20 Jul 2013 21:06:51 +0000 (17:06 -0400)]
Shift CPU TSC down to reduce need for 64bit variables.

The time-stamp-counter has a higher accuracy than is needed in
SeaBIOS.  Down shift it to ensure it safely fits in a 32bit variable.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoRename cpu_khz to TimerKHz.
Kevin O'Connor [Sat, 20 Jul 2013 21:05:24 +0000 (17:05 -0400)]
Rename cpu_khz to TimerKHz.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoImprove accuracy of internal timers.
Kevin O'Connor [Sat, 20 Jul 2013 17:06:35 +0000 (13:06 -0400)]
Improve accuracy of internal timers.

The TICKS_PER_DAY setting is a bios standard and needs to be 1573040
for compatibility.  However, there are actually ~1573042.24 ticks in a
day.  So, only use TICKS_PER_DAY when working with the BDA
timer_counter - not when calculating any internal times.

The PIT hz is actually 143181800 / 12 (~1193181.667).  This can be
accurately encoded as PMTIMER hz / 3.  Because the PIT hz is usually
multiplied and divided by other numbers, we can use the PMTIMER hz and
defer the division by 3 to improve accuracy.

When doing division for delay time calculations, always round up the
division so the delay is never less than the requested time.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoAdd helper functions to convert timer irqs to milliseconds.
Kevin O'Connor [Sat, 20 Jul 2013 16:08:48 +0000 (12:08 -0400)]
Add helper functions to convert timer irqs to milliseconds.

Add ticks_to_ms() and ticks_from_ms() helpers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoDon't pass khz to pmtimer_setup - it's always PM_TIMER_FREQUENCY.
Kevin O'Connor [Sat, 20 Jul 2013 15:06:51 +0000 (11:06 -0400)]
Don't pass khz to pmtimer_setup - it's always PM_TIMER_FREQUENCY.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoMove internal timer code from clock.c to a new file timer.c.
Kevin O'Connor [Sat, 20 Jul 2013 14:51:58 +0000 (10:51 -0400)]
Move internal timer code from clock.c to a new file timer.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
11 years agoPIC code cleanups.
Kevin O'Connor [Sun, 14 Jul 2013 19:07:21 +0000 (15:07 -0400)]
PIC code cleanups.

Preface PIC functions with a pic_ to provide a more consistent
naming.

Convert the irqmask code to a more consistent
pic_irqmask_read/write/mask form.

Move code from pic.h to pic.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoUpdate README to include info on VARLOW variables.
Kevin O'Connor [Sun, 14 Jul 2013 18:40:19 +0000 (14:40 -0400)]
Update README to include info on VARLOW variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoAdd CONFIG_DEBUG_COREBOOT config option
Gerd Hoffmann [Tue, 25 Jun 2013 13:45:30 +0000 (15:45 +0200)]
Add CONFIG_DEBUG_COREBOOT config option

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agocoreboot: add cbmem console support
Gerd Hoffmann [Mon, 24 Jun 2013 09:24:57 +0000 (11:24 +0200)]
coreboot: add cbmem console support

Add support for logging to the coreboot cbmem console.
Limitation: only supported in 32bit mode.  Use 'cbmem -c'
to see the logs (coreboot and seabios) after bootup.

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