Kevin O'Connor [Thu, 31 May 2012 04:20:55 +0000 (00:20 -0400)]
Cache romfile entries.
Create a 'struct romfile_s' and populate a list of all romfiles at
start of init. Caching the romfiles both simplifies the code and
makes it more efficient.
Also, convert the ramdisk code to use romfile helpers instead of
directly accessing cbfs.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Thu, 31 May 2012 01:31:42 +0000 (21:31 -0400)]
remove iasl-generated hex files from git repo
Almost every linux distro has iasl packaged these days.
Lets make it a build dependency and stop the hassle we
have with updating the *.hex files in the git repo.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Mon, 28 May 2012 22:31:39 +0000 (18:31 -0400)]
Set noinline on kbd.c interface functions that take stack variable pointers.
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>
Kevin O'Connor [Mon, 28 May 2012 18:42:16 +0000 (14:42 -0400)]
Remove "noinline" declarations from keyboard/mouse driver code.
Now that the extra stack is used for keyboard and mouse driver code,
there is no reason to set noinline (which was done to try and conserve
stack space).
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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.