]> xenbits.xensource.com Git - seabios.git/log
seabios.git
12 years agoUse the extra stack for 16bit USB and PS2 keyboard/mouse commands.
Kevin O'Connor [Mon, 28 May 2012 18:34:49 +0000 (14:34 -0400)]
Use the extra stack for 16bit USB and PS2 keyboard/mouse commands.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRun all hardware irq handlers on the extra stack.
Kevin O'Connor [Mon, 28 May 2012 18:25:15 +0000 (14:25 -0400)]
Run all hardware irq handlers on the extra stack.

Jump into the extra stack for all hardware irq handlers.  This reduces
the overall stack requirements of SeaBIOS.

Replace all users of call16_simpint with call16_int.  Only the
hardware irq handlers used the old call, and they need to use the new
call to ensure the extra stack is properly re-entrant.

Also, pass in a 'struct bregs' to the hardware irq handlers now.  It
was not done previously to save stack space.  Now that the extra stack
is used, that is no longer an issue.

Note that should an old OS invoke a hardware irq in 16bit protected
mode, then this patch could break that OS.  However, the chances of
this causing a regression seem small as several existing hardware irq
handlers already do not work in 16bit protected mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoAutomatically hop off the extra stack when far calling 16bit code.
Kevin O'Connor [Mon, 28 May 2012 17:59:07 +0000 (13:59 -0400)]
Automatically hop off the extra stack when far calling 16bit code.

Update the low level __farcall16 code to support a 'struct bregs' in a
segment other than the stack segment.

Automatically hop back from the extra stack on any farcall16() calls.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMake the extra stack re-entrant and "hop back" to check for irqs.
Kevin O'Connor [Mon, 28 May 2012 16:59:58 +0000 (12:59 -0400)]
Make the extra stack re-entrant and "hop back" to check for irqs.

When on the extra stack and it's necessary to check for irqs, switch
back to the original caller's stack to check for irqs.  Make the extra
stack re-entrant, so that a new user of the extra stack wont collide
with an existing user.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoReplace 32bit->16bit farcall system with regular calls.
Kevin O'Connor [Mon, 28 May 2012 14:56:20 +0000 (10:56 -0400)]
Replace 32bit->16bit farcall system with regular calls.

Instead of always "far calling" to 16bit mode, use a regular call.
When actually needing to "far call", transition to the 16bit C code
that does far calling.  This reduces the overhead to the check_irqs
and wait_irq code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMove farcall16 code from util.c to stacks.c and reorg stacks.c.
Kevin O'Connor [Tue, 29 May 2012 02:06:42 +0000 (22:06 -0400)]
Move farcall16 code from util.c to stacks.c and reorg stacks.c.

No code changes - just code movement.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRename call16 to farcall16.
Kevin O'Connor [Sun, 25 Mar 2012 15:04:10 +0000 (11:04 -0400)]
Rename call16 to farcall16.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoDon't restrict VISIBLEx C functions to only x mode.
Kevin O'Connor [Mon, 28 May 2012 15:37:53 +0000 (11:37 -0400)]
Don't restrict VISIBLEx C functions to only x mode.

Since SeaBIOS has been updated to use "_cfuncx_" prefixes when calling
cross-mode C functions, there is no reason to restrict an exported C
function to only the given mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRename wait_irq to yield_toirq.
Kevin O'Connor [Mon, 28 May 2012 15:44:02 +0000 (11:44 -0400)]
Rename wait_irq to yield_toirq.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMisc conversions to GET/SET_LOWFLAT().
Kevin O'Connor [Fri, 25 May 2012 03:56:19 +0000 (23:56 -0400)]
Misc conversions to GET/SET_LOWFLAT().

Convert from GET/SET_FLATPTR() to GET/SET_LOWFLAT() - the latter
produces better code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert virtio code to use GET/SET_LOWFLAT().
Kevin O'Connor [Fri, 25 May 2012 03:56:03 +0000 (23:56 -0400)]
Convert virtio code to use GET/SET_LOWFLAT().

Convert from GET/SET_FLATPTR() to GET/SET_LOWFLAT() - the latter
produces better code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert AHCI code to use GET/SET_LOWFLAT().
Kevin O'Connor [Fri, 25 May 2012 03:55:00 +0000 (23:55 -0400)]
Convert AHCI code to use GET/SET_LOWFLAT().

Convert from GET/SET_FLATPTR() to GET/SET_LOWFLAT() - the latter
produces better code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoRemove disk GET/SET_INT13DPT and GET/SET_INT13EXT macros.
Kevin O'Connor [Fri, 25 May 2012 02:52:39 +0000 (22:52 -0400)]
Remove disk GET/SET_INT13DPT and GET/SET_INT13EXT macros.

The code generation is better if explicit 'struct int13ext_s' and
'struct int13dpt_s' pointers are used instead.  The code is a little
easier to understand as well.

This patch also forces disk_1348 to not be inlined.  If it gets
inlined into its caller it can increase the stack usage for all disk
calls.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoUse inline functions instead of macros for GET/SET_SEG segment manipulation.
Kevin O'Connor [Fri, 25 May 2012 02:06:39 +0000 (22:06 -0400)]
Use inline functions instead of macros for GET/SET_SEG segment manipulation.

It appears that gcc does a better job of optimization when the
SET_SEG() segment assignment assembler code is contained in an inline
function.  With the code in a function gcc appears to be able to
optimize out many redundant segment register loads.  Removing some of
these unnecessarily loads makes the code both smaller and faster.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoMinor - verify UMB dummy optionrom header size doesn't overflow.
Kevin O'Connor [Thu, 24 May 2012 03:58:11 +0000 (23:58 -0400)]
Minor - verify UMB dummy optionrom header size doesn't overflow.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agopci: init all devices
Gerd Hoffmann [Tue, 15 May 2012 10:46:22 +0000 (12:46 +0200)]
pci: init all devices

seabios used to initialize root bus devices only, with this patch
devices behind pci bridges are initialized too.  This allows to boot
from virtio devices behind pci bridges.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoAllow optionroms and "low mem" to share space.
Kevin O'Connor [Mon, 21 May 2012 01:11:43 +0000 (21:11 -0400)]
Allow optionroms and "low mem" to share space.

Allow both optionroms and "low mem" allocations to use the e-segment.
(Space is allocated on a "first come, first serve" basis).  This
allows more flexibility in resource assignment.

Also, allow the "low mem" area to use a full 64K.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert GET/SET_FLATPTR() accesses to "low mem" to GET/SET_LOWFLAT().
Kevin O'Connor [Sun, 20 May 2012 02:42:51 +0000 (22:42 -0400)]
Convert GET/SET_FLATPTR() accesses to "low mem" to GET/SET_LOWFLAT().

Add new GET/SET_LOWFLAT() macros and convert appropriate users to
them.  The new macros make for slightly better code generation.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoEBDA cleanups.
Kevin O'Connor [Mon, 14 May 2012 02:58:08 +0000 (22:58 -0400)]
EBDA cleanups.

Clean up includes of biosvar.h.

Rename GET/SET_EBDA2 to GET/SET_EBDA - nearly all users use the
extended form now anyway.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert disk code EBDA variables to VARLOW variables.
Kevin O'Connor [Mon, 14 May 2012 02:46:12 +0000 (22:46 -0400)]
Convert disk code EBDA variables to VARLOW variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert USB keyboard code EBDA variables to VARLOW variables.
Kevin O'Connor [Sun, 13 May 2012 16:39:16 +0000 (12:39 -0400)]
Convert USB keyboard code EBDA variables to VARLOW variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert ps2 code EBDA variables to VARLOW variables.
Kevin O'Connor [Sun, 13 May 2012 16:28:55 +0000 (12:28 -0400)]
Convert ps2 code EBDA variables to VARLOW variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert boot code EBDA variables to VARLOW variables.
Kevin O'Connor [Sun, 13 May 2012 16:23:58 +0000 (12:23 -0400)]
Convert boot code EBDA variables to VARLOW variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoConvert timer code EBDA variables to VARLOW variables.
Kevin O'Connor [Sun, 13 May 2012 16:18:36 +0000 (12:18 -0400)]
Convert timer code EBDA variables to VARLOW variables.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoAdd mechanism to declare variables as "low mem" and use for extra stack.
Kevin O'Connor [Sun, 13 May 2012 16:10:30 +0000 (12:10 -0400)]
Add mechanism to declare variables as "low mem" and use for extra stack.

Add a mechanism (VARLOW declaration) to make a variable reside in the
low memory (e-segment) area.  This is useful for runtime variables
that need to be accessed from 16bit code and need to be modifiable
during runtime.

Move the 16bit "extra stack" from the EBDA to the low memory area
using this declaration mechanism.  Also increase the size of this
stack from 512 bytes to 2048 bytes.

This also reworks tools/layoutrom.py a bit.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoUse the e-segment instead of the 9-segment for bios "low mem".
Kevin O'Connor [Sun, 13 May 2012 03:49:33 +0000 (23:49 -0400)]
Use the e-segment instead of the 9-segment for bios "low mem".

Use the e-segment for ZoneLow allocations.  There is plenty of
e-segment space (there has been since SeaBIOS supported code
relocation), while using the 9-segment space can impact old real-mode
applications.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agoAutomatically reboot after 60 second delay on failed boot.
Kevin O'Connor [Sun, 13 May 2012 02:12:22 +0000 (22:12 -0400)]
Automatically reboot after 60 second delay on failed boot.

If no valid boot devices are found, display the error for 60 seconds
(by default) and then reboot.  This enables a periodic retry in case
one of the boot devices is still coming online.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
12 years agopci: handle bridge irq mapping
Gerd Hoffmann [Fri, 4 May 2012 15:33:36 +0000 (17:33 +0200)]
pci: handle bridge irq mapping

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoRevert "Fix 64bit PCI issues on Windows"
Kevin O'Connor [Sat, 12 May 2012 18:14:05 +0000 (14:14 -0400)]
Revert "Fix 64bit PCI issues on Windows"

This reverts commit 482a020ec25f4cec655ddcb16b67c6f38b0844c0.

The commit causes WinXP guests to BSOD.

13 years agoAdd IASL definition to the Makefile.
Marc Jones [Sun, 29 Apr 2012 17:20:53 +0000 (11:20 -0600)]
Add IASL definition to the Makefile.

Add IASL definition to Makefile so it can be passed by the user.

Signed-off-by: Marc Jones <marc.jones@se-eng.com>
13 years agopciinit: Simplify list manipulation in pci_region_migrate_64bit_entries.
Kevin O'Connor [Fri, 27 Apr 2012 02:20:56 +0000 (22:20 -0400)]
pciinit: Simplify list manipulation in pci_region_migrate_64bit_entries.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agopciinit: Minor white space changes.
Kevin O'Connor [Fri, 27 Apr 2012 02:04:34 +0000 (22:04 -0400)]
pciinit: Minor white space changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoFix 64bit PCI issues on Windows
Alexey Korolev [Thu, 19 Apr 2012 05:52:41 +0000 (17:52 +1200)]
Fix 64bit PCI issues on Windows

 This patch solves issues on Windows guests, when 64bit
 BAR's are present. It is also helpful on Linux guests
 when use_crs kernel boot option is set.

Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopciinit: Migrate 64bit entries to 64bit pci regions
Alexey Korolev [Thu, 26 Apr 2012 05:01:59 +0000 (17:01 +1200)]
pciinit: Migrate 64bit entries to 64bit pci regions

Migrate 64bit entries to 64bit pci regions if they do
not fit in 32bit range.

Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
13 years agopciinit: Calculate pci region stats on demand
Alexey Korolev [Thu, 26 Apr 2012 04:51:05 +0000 (16:51 +1200)]
pciinit: Calculate pci region stats on demand

Do not store pci region stats - instead calulate the
sum and alignment on demand.

Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
13 years agopciinit: 64bit capability discovery for pci bridges
Alexey Korolev [Thu, 19 Apr 2012 05:48:54 +0000 (17:48 +1200)]
pciinit: 64bit capability discovery for pci bridges

Add discovery if bridge region is 64bit is capable.

Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
13 years agopciinit: Add pci_region structure.
Alexey Korolev [Thu, 19 Apr 2012 05:47:19 +0000 (17:47 +1200)]
pciinit: Add pci_region structure.

 The pci_region structure is added.
 Move setting of bus base address to pci_region_map_entries.

Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
13 years agopciinit: Switch to 64bit variable types.
Alexey Korolev [Thu, 19 Apr 2012 05:44:55 +0000 (17:44 +1200)]
pciinit: Switch to 64bit variable types.

 Switch to 64bit variable types.
 Add parsing  64bit bars.

Original patch by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agopciinit: bridges can have two regions too
Alexey Korolev [Thu, 19 Apr 2012 05:40:13 +0000 (17:40 +1200)]
pciinit: bridges can have two regions too

 Patch takes into account PCI bar and ROM regions of PCI bridges

Original patch by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
13 years agopciinit: Track region alignment explicitly.
Kevin O'Connor [Sun, 1 Apr 2012 16:30:32 +0000 (12:30 -0400)]
pciinit: Track region alignment explicitly.

Don't round up bridge regions to the next highest size - instead track
alignment explicitly.  This should improve the memory layout for
bridge regions.

Also, unused bridge regions will no longer be allocated any space.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agopciinit: Use sorted order allocation
Alexey Korolev [Wed, 18 Apr 2012 05:31:58 +0000 (17:31 +1200)]
pciinit: Use sorted order allocation

 Use sorted order allocation scheme instead of
 array based count scheme.

Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agopciinit: Remove size element from pci_bus->r structure
Alexey Korolev [Wed, 18 Apr 2012 05:26:43 +0000 (17:26 +1200)]
pciinit: Remove size element from pci_bus->r structure

 The 'size' element of pci_bus->r structure is no
 longer need as the information about bridge region
 size is already stored in pci_region_entry structure.

Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agopciinit: Move bus bar asignment
Alexey Korolev [Wed, 18 Apr 2012 05:22:29 +0000 (17:22 +1200)]
pciinit: Move bus bar asignment

 Perform bus bar assignment at same time as normal bar assignment

Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agopciinit: Introduction of pci_region_entry structure
Alexey Korolev [Wed, 18 Apr 2012 05:21:19 +0000 (17:21 +1200)]
pciinit: Introduction of pci_region_entry structure

 The pci_region_entry structure is introduced.
 The pci_device->bars are removed. The  information from
 pci_region_entry is used to program  pci bars.

Signed-off-by: Alexey Korolev <alexey.korolev@endace.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agovgabios: Improve Kconfig descriptions for the vga card types.
Kevin O'Connor [Mon, 16 Apr 2012 02:02:58 +0000 (22:02 -0400)]
vgabios: Improve Kconfig descriptions for the vga card types.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agobuildversion: Don't rely on bash syntax.
Kevin O'Connor [Mon, 16 Apr 2012 02:02:15 +0000 (22:02 -0400)]
buildversion: Don't rely on bash syntax.

Use '=' instead of '=='.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoMisc compile fixes for gcc v3.4. rel-1.7.0
Kevin O'Connor [Sun, 15 Apr 2012 00:22:18 +0000 (20:22 -0400)]
Misc compile fixes for gcc v3.4.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoReplace level gpe event with edge gpe event for hot-plug handlers
Igor Mammedov [Tue, 3 Apr 2012 21:48:44 +0000 (23:48 +0200)]
Replace level gpe event with edge gpe event for hot-plug handlers

in current code, pci hot-plug gpe event handler is defined as
a level one "_L01"

1. hw adds device, sets GPE.1 bit and sends SCI
2. OSPM gets SCI, reads GPE00.sts and masks GPE.1 bit in GPE00.en
3. OSPM executes _L01
4. hw adds second device and sets GPE.1 bit but SCI is not asserted
    since GPE00.en masks event
5. OSPM resets GPE.1 bit in GPE00.sts and umasks it in GPE00.en

as result event for step 4 is lost because step 5 clears it and OS
will not see added second device.

ACPI 50 spec: 5.6.4 General-Purpose Event Handling
defines GPE event handling as following:

1. Disables the interrupt source (GPEx_BLK EN bit).
2. If an edge event, clears the status bit.
3. Performs one of the following:
* Dispatches to an ACPI-aware device driver.
* Queues the matching control method for execution.
* Manages a wake event using device _PRW objects.
4. If a level event, clears the status bit.
5. Enables the interrupt source.

Switching from level to edge event handler reduces chances to
hit race window.

Same applies to cpu-hotplug, so switch it to edge handler as well.

Tested with RHEL6, 3.3.+ kernel, winxp, and w2008r2, and I wasn't
able to trigger race after using edge event handler.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
13 years agoseabios: readd Makefile rule for ACPI
Michael S. Tsirkin [Wed, 28 Mar 2012 12:14:45 +0000 (14:14 +0200)]
seabios: readd Makefile rule for ACPI

Commit 36feea9317b45abf3a540e9d82ad1723bebe3ebd
removed the dependency of output file on
acpi output. This means it's not rebuilt on
acpi source or hex file updates. Re-introduce this
dependency.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agoMark disk.c functions that take an address of a stack variable as noinline.
Kevin O'Connor [Sun, 25 Mar 2012 14:21:27 +0000 (10:21 -0400)]
Mark disk.c functions that take an address of a stack variable as noinline.

Some versions of gcc have been found to inline these funcions and then
cause the calling functions to use very large stack usage.  Since
these functions are called from 16bit mode, their stack space usage is
very sensitive.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agotest-gcc: do not truncate stderr
Ian Campbell [Thu, 22 Mar 2012 15:25:24 +0000 (15:25 +0000)]
test-gcc: do not truncate stderr

Using "> /dev/fd/2" causes stderr to get truncated, which is mangles the log
file if the user happens to have redirected it there.

Use ">&2" instead which redirects to the already open stderr and doesn't
truncate it.

Reported-by: Tim Deegan <tim@xen.org>
Tested-by: Tim Deegan <tim@xen.org>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
13 years agoUse "git describe" in the build generated version description.
Kevin O'Connor [Sat, 24 Mar 2012 15:42:53 +0000 (11:42 -0400)]
Use "git describe" in the build generated version description.

Move the build version generation to a script in tools/ and enhance
the system to call "git describe" when it appears the user has a git
repo.  Also, allow the version to be extracted from a ".version" file
for use in official tar releases.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoDrop FIX_RTC flag from FADT.
Gleb Natapov [Tue, 20 Mar 2012 08:02:17 +0000 (10:02 +0200)]
Drop FIX_RTC flag from FADT.

FIX_RTC flag should be set if RTC wake status is _not_ reported in fixed
register space, but this is not the case for QEMU. So drop it from FADT.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
13 years agoata: send TEST UNIT READY correctly
Paolo Bonzini [Mon, 19 Mar 2012 10:41:09 +0000 (11:41 +0100)]
ata: send TEST UNIT READY correctly

The ATAPI driver does not need to support writes, but it does needs to
avoid the PIO transfer and DRQ check when TEST UNIT READY is sent.
Since TEST UNIT READY has no payload, checking for not busy is enough.

This fixes a timeout when booting from CD/DVD, which fellaw@gmx.net
reported to cause boot failures.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
13 years agovirtio-scsi: Fix virtio-scsi after cdb_is_read changes.
Paolo Bonzini [Fri, 16 Mar 2012 17:54:46 +0000 (18:54 +0100)]
virtio-scsi: Fix virtio-scsi after cdb_is_read changes.

The previous patch changes the way TEST_UNIT_READY is composed in the
buffers and breaks virtio-scsi.

13 years agoif HPET is not present do not report it in DSDT
Gleb Natapov [Sun, 11 Mar 2012 08:08:38 +0000 (10:08 +0200)]
if HPET is not present do not report it in DSDT

Replicate the check that detects if HPET table should be created
in AML too.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
13 years agoUse OUT mode for all zero byte "scsi" transfers.
Kevin O'Connor [Thu, 15 Mar 2012 01:27:45 +0000 (21:27 -0400)]
Use OUT mode for all zero byte "scsi" transfers.

Some devices can get confused if asked to "read" data during a zero
byte transfer, so consider these transfers as "writes".  (Reported by
Steve Goodrich.)

Also, extract out the code to determine the transfer direction into
cdb_is_read().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoWhitespace changes - replace handful of tabs in core code with spaces.
Kevin O'Connor [Thu, 15 Mar 2012 01:11:39 +0000 (21:11 -0400)]
Whitespace changes - replace handful of tabs in core code with spaces.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agops2: Enable keyboard at end of PS2 port irq.
Kevin O'Connor [Mon, 12 Mar 2012 00:45:56 +0000 (20:45 -0400)]
ps2: Enable keyboard at end of PS2 port irq.

Looks like some old programs expect the keyboard irq to enable the
keyboard port at the end of the irq.  This behavior was seen on an
image of "Concurrent DOS".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoIncrease the debug level of several frequent dprintf() statements.
Kevin O'Connor [Sun, 11 Mar 2012 15:19:52 +0000 (11:19 -0400)]
Increase the debug level of several frequent dprintf() statements.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoUpdate drive type default boot order.
Kevin O'Connor [Sun, 11 Mar 2012 15:22:07 +0000 (11:22 -0400)]
Update drive type default boot order.

The default boot order among different drive types is determined by
the driver id (DTYPE_X).  Reorder them to make more sense (USB drives
shouldn't have a higher default priority than AHCI/virtio drives).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Remove QH_MULT_SHIFT flag from qh.info1.
Kevin O'Connor [Sun, 11 Mar 2012 02:07:26 +0000 (21:07 -0500)]
usb: Remove QH_MULT_SHIFT flag from qh.info1.

That flag is for qh.info2 - it being set in qh.info1 appears to be a
typo.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Fix barrier() placement in OHCI interrupt schedule add.
Kevin O'Connor [Sat, 10 Mar 2012 17:30:27 +0000 (12:30 -0500)]
usb: Fix barrier() placement in OHCI interrupt schedule add.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Populate OHCI endpoint descriptor info at pipe allocation.
Kevin O'Connor [Sat, 10 Mar 2012 17:12:27 +0000 (12:12 -0500)]
usb: Populate OHCI endpoint descriptor info at pipe allocation.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Move EHCI tt_* fields to EHCI controller code.
Kevin O'Connor [Sat, 10 Mar 2012 15:09:56 +0000 (10:09 -0500)]
usb: Move EHCI tt_* fields to EHCI controller code.

Move the code to setup the ehci specific queue head fields to the ehci
code.  Also, setup the ehci queue head fields once during pipe
allocation instead of on each transfer.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Move code around in usb.c.
Kevin O'Connor [Sat, 10 Mar 2012 14:13:58 +0000 (09:13 -0500)]
usb: Move code around in usb.c.

Move code around to put like functions near each other.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Generalize controller alloc_async_pipe / alloc_intr_pipe code.
Kevin O'Connor [Sat, 10 Mar 2012 14:03:25 +0000 (09:03 -0500)]
usb: Generalize controller alloc_async_pipe / alloc_intr_pipe code.

Use one function (X_alloc_pipe) as the main entry point for usb pipe
allocation in the controller code.  The determination of
interrupt/bulk/control can be done within the controller.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Move code around in usb controller code.
Kevin O'Connor [Sat, 10 Mar 2012 13:53:58 +0000 (08:53 -0500)]
usb: Move code around in usb controller code.

No code changes - just movement of code to place pipe allocater
functions next to each other.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Pass 'struct usbdevice_s' to controller alloc_intr_pipe functions.
Kevin O'Connor [Sat, 10 Mar 2012 13:48:31 +0000 (08:48 -0500)]
usb: Pass 'struct usbdevice_s' to controller alloc_intr_pipe functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Pass 'struct usbdevice_s' into controller alloc_async functions.
Kevin O'Connor [Fri, 9 Mar 2012 12:52:33 +0000 (07:52 -0500)]
usb: Pass 'struct usbdevice_s' into controller alloc_async functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Pass usbdevice_s to alloc_async_pipe.
Kevin O'Connor [Thu, 8 Mar 2012 13:44:32 +0000 (08:44 -0500)]
usb: Pass usbdevice_s to alloc_async_pipe.

Build the control pipe information in alloc_async_pipe directly from
the usbdevice and usb_endpoint_descriptor information.  This
simplifies the callers as they now only need to allocate/free the
devices, and do not need to peek into the pipe structure.

Replace alloc_bulk_pipe with alloc_async_pipe as they both perform the
same action now.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Build path via chain of usbdevice_s.
Kevin O'Connor [Thu, 8 Mar 2012 12:49:09 +0000 (07:49 -0500)]
usb: Build path via chain of usbdevice_s.

Instead of building a dummy u64 with the path, construct the path via
the 'struct usbdevice_s' links.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Push 'struct usbdevice_s' usage through to pipe allocation.
Kevin O'Connor [Thu, 8 Mar 2012 12:20:30 +0000 (07:20 -0500)]
usb: Push 'struct usbdevice_s' usage through to pipe allocation.

Pass the usbdevice_s info to device configuration and allocation
code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Introduce 'struct usbdevice_s' to describe info for a given device.
Kevin O'Connor [Tue, 6 Mar 2012 13:20:40 +0000 (08:20 -0500)]
usb: Introduce 'struct usbdevice_s' to describe info for a given device.

Create the usbdevice_s struct and use it during the enumeration
processes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Obtain free list items in main code.
Kevin O'Connor [Tue, 6 Mar 2012 03:41:21 +0000 (22:41 -0500)]
usb: Obtain free list items in main code.

Each controller freelist finding code is the same - move it to the
common code.  This also merges the alloc_control and alloc_bulk code
paths.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Remove cntl->defaultpipe cache.
Kevin O'Connor [Tue, 6 Mar 2012 03:03:03 +0000 (22:03 -0500)]
usb: Remove cntl->defaultpipe cache.

Now that all pipes use a free list, there is no need to cache the
controller's default pipe.  The regular free list provides the same
capability.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agousb: Centralize pipe free list code.
Kevin O'Connor [Tue, 6 Mar 2012 02:48:34 +0000 (21:48 -0500)]
usb: Centralize pipe free list code.

Now that all controllers use a free list, maintain the free list in
the common code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoBatch free USB pipes on EHCI controllers.
Kevin O'Connor [Mon, 20 Feb 2012 17:54:49 +0000 (12:54 -0500)]
Batch free USB pipes on EHCI controllers.

Instead of unregistering each control "endpoint descriptor" after it
is used, keep them around for later users.  Free all unused
descriptors in one batch at the end of initialization.  This should
slightly optimize boot time, and it requires less overall interaction
with the controller.

This also merges the code that allocates the control and bulk pipes,
as they were quite similar before.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoBatch free USB pipes on UHCI controllers.
Kevin O'Connor [Mon, 20 Feb 2012 17:54:49 +0000 (12:54 -0500)]
Batch free USB pipes on UHCI controllers.

Instead of unregistering each control "endpoint descriptor" after it
is used, keep them around for later users.  Free all unused
descriptors in one batch at the end of initialization.  This should
slightly optimize boot time, and it requires less overall interaction
with the controller.

This also merges the code that allocates the control and bulk pipes,
as they were quite similar before.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoBatch free USB pipes on OHCI controllers.
Kevin O'Connor [Mon, 20 Feb 2012 17:54:49 +0000 (12:54 -0500)]
Batch free USB pipes on OHCI controllers.

Instead of unregistering each control "endpoint descriptor" after it
is used, keep them around for later users.  Free all unused
descriptors in one batch at the end of initialization.  This should
slightly optimize boot time, and it requires less overall interaction
with the controller.

This also makes the descriptor free code more compliant with the spec.
The descriptor lists will only be modified after the list processing
has been disabled on the controller.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoadd virtio-scsi driver
Paolo Bonzini [Mon, 27 Feb 2012 16:22:23 +0000 (17:22 +0100)]
add virtio-scsi driver

virtio-scsi is a simple HBA that talks to the host via a single
vring.  The implementation looks like a hybrid of usb-msc and
virtio-blk.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
13 years agoscsi: do not send MODE SENSE except to QEMU disks
Paolo Bonzini [Mon, 5 Mar 2012 11:29:12 +0000 (12:29 +0100)]
scsi: do not send MODE SENSE except to QEMU disks

This is the simplest way to avoid breaking boot on USB sticks that
stall when asked for the MODE SENSE page 4.  Some old sticks do
not support the MODE SENSE command at all and just return a
"medium may have changed" unit attention condition when SeaBIOS
sends it!

Reported-by: Dave Frodin <dave@camp.se-eng.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
13 years agovgabios: Fetch _rom_header_size from the global segment when computing the ROM's...
Julian Pidancet [Mon, 5 Mar 2012 14:20:45 +0000 (14:20 +0000)]
vgabios: Fetch _rom_header_size from the global segment when computing the ROM's checksum

Otherwise, checksum_far is getting called with zero as the length
parameter, and the ROM checksum in the header end up beeing zero
after vga_post() is called.

Signed-off-by: Julian Pidancet <julian.pidancet@gmail.com>
13 years agovgabios: Initial support for fixing up assembler to workaround x86emu.
Kevin O'Connor [Mon, 5 Mar 2012 22:45:55 +0000 (17:45 -0500)]
vgabios: Initial support for fixing up assembler to workaround x86emu.

Perform post-processing of the vgabios assembler to remove certain
instructions that gcc generates and x86emu can't handle.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoDon't compile with -mrtd.
Kevin O'Connor [Mon, 5 Mar 2012 22:39:32 +0000 (17:39 -0500)]
Don't compile with -mrtd.

The "mrtd" mode is a bit funky - the gain from it isn't worth the
complexity.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agovgabios: int1009 handler bug limits count to 256 characters.
Kevin O'Connor [Mon, 5 Mar 2012 22:11:50 +0000 (17:11 -0500)]
vgabios: int1009 handler bug limits count to 256 characters.

Fix bug (u8 overflow) causing large screen fills to fail.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agovgabios: Fixup clext far return instruction.
Kevin O'Connor [Mon, 5 Mar 2012 22:10:13 +0000 (17:10 -0500)]
vgabios: Fixup clext far return instruction.

Fix typo causing incorrect far return instruction - use explicit ATT
syntax - "lretw".

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agooutput: Add 64bit hex print support.
Kevin O'Connor [Mon, 5 Mar 2012 15:14:07 +0000 (10:14 -0500)]
output: Add 64bit hex print support.

Based on patch by Gerd Hoffmann <kraxel@redhat.com>.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoFixup missing includes.
Kevin O'Connor [Tue, 6 Mar 2012 12:18:07 +0000 (07:18 -0500)]
Fixup missing includes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoUse "#!/bin/sh" instead of ":" in tools/gen-offsets.sh.
Kevin O'Connor [Mon, 20 Feb 2012 14:33:23 +0000 (09:33 -0500)]
Use "#!/bin/sh" instead of ":" in tools/gen-offsets.sh.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoFree USB MSC pipes on error.
Kevin O'Connor [Mon, 20 Feb 2012 07:59:36 +0000 (02:59 -0500)]
Free USB MSC pipes on error.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoRegister drives directly in scsi_init_drive().
Kevin O'Connor [Sat, 18 Feb 2012 16:02:27 +0000 (11:02 -0500)]
Register drives directly in scsi_init_drive().

The scsi_init_drive() function has enough information to directly
register the drive there, so do the registration there.  This
simplifies the calling code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoRunning vgabios during resume from S3 on QEMU by default
Gleb Natapov [Mon, 13 Feb 2012 11:01:07 +0000 (13:01 +0200)]
Running vgabios during resume from S3 on QEMU by default

Run vgabios during resume from S3 by default on QEMU. QEMU
still able to modify SeaBIOS behavior if it wishes so by providing
etc/s3-resume-vga-init file. With QEMU emulated vga cards this behaviour
is desirable otherwise console becomes unusable with Linux guests after
resume. Since we control vgabios source we can be sure that running it
on resume from S3 is safe.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
13 years agoFix missing NULL pointer checks causing boot failure on 1meg machines.
Kevin O'Connor [Thu, 16 Feb 2012 01:13:05 +0000 (20:13 -0500)]
Fix missing NULL pointer checks causing boot failure on 1meg machines.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agovgabios: Some tweaks to optimize stack space.
Kevin O'Connor [Tue, 14 Feb 2012 01:09:02 +0000 (20:09 -0500)]
vgabios: Some tweaks to optimize stack space.

Gcc seems to handle passing structs by value if they are 4 bytes in
size instead of 3 bytes.  So, add a pad byte to struct carattr and
struct cursorpos.

Reorganize set_cursor_pos(), verify_scroll(), and handle_1013() so
there are less live variables.

Don't inline the VBE functions into the main handler code.  Code
calling VBE functions are newer and are more likely to provide
adequate stack space - inlining can cause more stack usage for older
functions (which may be stack constrained).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agovgabios: Minor vgabios fixes.
Kevin O'Connor [Sun, 12 Feb 2012 16:50:52 +0000 (11:50 -0500)]
vgabios: Minor vgabios fixes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agovgabios: Claim VBE 3 support; minor VBE cleanups.
Kevin O'Connor [Sun, 12 Feb 2012 16:49:25 +0000 (11:49 -0500)]
vgabios: Claim VBE 3 support; minor VBE cleanups.

Claim support for VBE3 - that spec is actually more lenient for
required minimum support.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agovgabios: Add version string to debug output.
Kevin O'Connor [Sat, 11 Feb 2012 16:02:03 +0000 (11:02 -0500)]
vgabios: Add version string to debug output.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agoDirect compile 16bit C code instead of including via .S files.
Kevin O'Connor [Sat, 11 Feb 2012 15:49:45 +0000 (10:49 -0500)]
Direct compile 16bit C code instead of including via .S files.

Create a ".code16gcc" directive in src/code16gcc.s and use
-Wa,src/code16gcc.s to tell gcc to compile directly to 16bit code.
This eliminates the need to compile the C code to assembler and
include in romlayout.S and vgaentry.S.  This also allows those two
assembler files to be compiled with debugging (-g) enabled.

Also, includes some Makefile cleanups.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
13 years agodisk: handle LBA I/O with zero sector count
Kevin O'Connor [Sat, 11 Feb 2012 14:38:44 +0000 (09:38 -0500)]
disk: handle LBA I/O with zero sector count

Unlike basic_access, extended_access does not check for a zero
sector count.  However, this is a problem because for example
it would be interpreted as 256 when processing an ATA request.

Based on patch from: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>