Kevin O'Connor [Wed, 13 Jun 2012 12:47:03 +0000 (08:47 -0400)]
Support USB MSC devices with multiples LUNs
There are USB Mass storage devices which have more than one device.
Examples are CD Changers, or USB sticks which are partitioned in a
CDROM and Harddisk device.
Signed-off-by: Sven Schnelle <svens@stackframe.org> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Gerd Hoffmann [Tue, 12 Jun 2012 07:27:15 +0000 (09:27 +0200)]
pci: runtime i/o window sizing
Update the pci i/o windows at runtime, depending on the amount memory
the machine has. The 32bit window starts above low memory and ends at
the ioapic map address, the 64bit window is placed above high memory.
Kevin O'Connor [Sat, 9 Jun 2012 17:46:11 +0000 (13:46 -0400)]
Remove SMBIOS generation on coreboot hack.
Early versions of coreboot did not create an SMBIOS table (which Linux
needs in order to use the ACPI tables), so SeaBIOS had a hack to
generate an SMBIOS table. However, recent versions of coreboot can
generate an SMBIOS table, so there is no longer a reason to support
this hack.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 9 Jun 2012 17:36:45 +0000 (13:36 -0400)]
Minor - Replace PirOffset with PirAddr.
Technically, the PIR table could be placed at 0xf0000, which would
result in a PirOffset=0, which would confuse the code. So, use an
absolute address (PirAddr) instead. This also matches what the ACPI
and SMBIOS code does.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Kevin O'Connor [Sat, 9 Jun 2012 01:14:19 +0000 (21:14 -0400)]
Avoid runtime relocation of 16bit "low" mem - calculate at build instead.
Some 16bit accesses to "low" mem variables use 16bit relocations
instead of the normal 32bit relocations. This causes build problems
if the "low" mem sections move more than 64K during relocation.
The final location of the "low" memory can be determined during the
build, so link the 16bit code with the final post-reloc location of
the "low" mem variables instead. This eliminates the need to do these
runtime relocations on the 16bit code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Gerd Hoffmann [Thu, 7 Jun 2012 08:34:33 +0000 (10:34 +0200)]
update dsdt ressources at runtime
Write the pci window location to memory and add a pointer to the SSDT
(BDAT region). Turn \\SB.PCI0._CRS into a method which looks up the
information there and updates the ressources accordingly.
Gerd Hoffmann [Thu, 7 Jun 2012 08:34:31 +0000 (10:34 +0200)]
update bios date
Linux ignores some information from acpi in case the bios is old
as acpi support used to be buggy in the early days. This affects
ressources for example (unless forced with pci=use_crs). So lets
go for something more recent. With this patch applied the
ressources for \\SB.PCI0 will show up in /proc/{iomem,ioports},
tagged as "PCI Bus 0000:00".
The winxp boot loader does something curious - it sets an int 0x1c
handler, records the stack location, and then spins in place with irqs
enabled. The 0x1c handler alters the memory just past the stack
pointer so that when the timer irq returns the code jumps to a new
location and stop spinning. The winxp code relies on the fact that a
hw irq will always place 6 bytes at a specific location and that it
can alter those bytes.
The ecdc655a patch does a full backup/restore of the register state.
Unfortunately, the restore overwrites the changes made by the winxp
0x1c handler.
This patch reverts much of ecdc655a. Hardware irqs are still handled
on the extra stack, but only the essential register state is backed up
and restored.
Also, stack_hop_back is changed to only use %sp when changing states -
this enables the entry code to store just %esp instead of both %esp
and %sp.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>