Kevin O'Connor [Tue, 27 Jul 2010 03:16:12 +0000 (23:16 -0400)]
Don't do "double buffering" in bootsplash code.
Not all vgabios support off screen framebuffers. Instead, decompress
the picture into ram, and then copy it into the framebuffer. This
ensures a fast display time without requiring any special vga support.
When 64bit bar allocation failed, leave it untouched as 32bit bar case.
There is no point to set higher bit to all 1, it is just leftover from
debug code.
Alex Williamson [Mon, 21 Jun 2010 15:46:19 +0000 (09:46 -0600)]
smbios: Allow all fields to be set via qemu_cfg_smbios_load_field()
The protocol we use between qemu and seabios already allows any field
to be specified (via smbios_add_field() in qemu). This patch makes
seabios look for qemu specified values for nearly every field we set
in the types 0,1,3,4,16,17,32 smbios tables. No change in current
default values for any fields.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Kevin O'Connor [Sat, 10 Jul 2010 17:12:37 +0000 (13:12 -0400)]
seabios: pciinit: use pci device initializer helper function.
This patch makes use of pci device initialization helper function
to convert if/switch clause to table driven.
So this makes it easier to add q35 initialization code.
Stefan Hajnoczi [Wed, 7 Jul 2010 12:34:22 +0000 (13:34 +0100)]
virtio: Clear interrupt status register in virtio-blk
The VRING_AVAIL_F_NO_INTERRUPT flag is a hint that interrupts should be
suppressed. It does not guarantee that interrupts will not be raised.
Therefore, make sure to clear the interrupt after each virtio-blk read.
This avoids a stuck interrupt interfering with the OS loaded later in
the boot process.
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Isaku Yamahata [Tue, 22 Jun 2010 08:57:49 +0000 (17:57 +0900)]
seabios: pciinit: make pci bar assigner preferchable memory aware.
Make pci bar assigner preferchable memory aware.
This is needed for PCI bridge support because memory space and
prefetchable memory space is filtered independently based on
memory base/limit and prefetchable memory base/limit of pci bridge.
On bus 0, such a distinction isn't necessary so keep existing behavior
by checking bus=0.
With this patch, pci mem assignment area has been decreased.
To make seabios behave as before for compatible reason,
define CONFIG_OLD_PCIMEM_ASSIGNMENT.
This patch introduces foreachpci_in_bus() helper macro for
depth first recursion. foreachpci() is for width first recursion.
The macro will be used later to initialize pci bridge
that requires depth first recursion.
Isaku Yamahata [Mon, 7 Jun 2010 08:19:27 +0000 (17:19 +0900)]
seabios: remove iasl output file when error.
Surprisingly iasl creates output file even when compilation error.
So typing make after an error will succeed.
This patch prevents it by removing the output file when error.
And adds related dependencies to compile when .hex is missing.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Kevin O'Connor [Sun, 6 Jun 2010 15:10:24 +0000 (11:10 -0400)]
Rework malloc to use a "first fit" algorithm.
The existing malloc implementation effectively uses a stack - all new
allocations come from the top of the stack. When allocating memory
with a large alignment, the pad used to align the new memory is
unavailable to other users. Also, memory released by calling free()
is only available to other users when all memory allocated after it is
also freed.
This new malloc scheme uses a first fit approach to finding available
memory. It makes it possible to use alignment padding and freed space
for new allocations.
This helps reduce the required memory in the permanent memory zones
(ZoneHigh and ZoneLow) where users have the need to allocate
structures with high alignment (eg, virtio and usb).
cleanup memory barrier usage bringing it
in sync with what linux guest does.
The rules are simple:
- read barrier after index read
- write barrier before index write
Also, call macros smp_rmb/smp_wmb to stress
we are not syncing with a real io device here.
While I don't think compiler is crazy/powerful
enough to reorder these, anyway, the bogus
barriers we currently have in code will confuse
anyone who tries to copy/reuse it.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Cc: Gleb Natapov <gleb@redhat.com>
NO_NOTIFY is an optimization to reduce the number of exits,
but using it requires careful synchronization with host,
forcing read/write ordering for the CPU. Otherwise we
risk not kicking a host when it is waiting for more buffers,
resulting in a deadlock.
Let's just always kick, it's way simpler.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Cc: Gleb Natapov <gleb@redhat.com>
Kevin O'Connor [Sun, 23 May 2010 16:40:40 +0000 (12:40 -0400)]
Don't use RTC to time boot menu delay.
It appears real machines sometimes have a flaky RTC, so avoid using
the RTC irq during boot. Instead, use a delay based on the standard
timer irq.
This also optimizes CONFIG_THREAD_OPTIONROMS users as it is no longer
necessary to use preemption - the wait_irq() call handles task
switching natively.
Kevin O'Connor [Sat, 1 May 2010 13:50:13 +0000 (09:50 -0400)]
Simplify build by manually resolving external symbols in layoutrom.py.
Enhance tools/layoutrom.py to explicitly set those symbols that
resolve to a different code chunk (eg, 16, 32seg, 32flat). This
eliminates the need to link the code chunks multiple times.
This patch reduces the dependency on binutils behavior and makes the
build simpler to understand.
Kevin O'Connor [Fri, 2 Apr 2010 17:13:23 +0000 (13:13 -0400)]
Some improvements to optionrom preemption support.
Enable preemption during VGA mode switch call - this call can take
several milliseconds on real hardware.
Call yield() in finish_preempt() - when preemption is configured it
allows threads in wait_preempt() to run; when not configured it gives
an opportunity for threads to execute after the implicit delay from
optionrom execution.
Don't penalize priority in run_thread(). The run_thread() code would
implicitly yield because it created the new thread on the list after
the current thread and then jumped to it. When in a preemption event,
a yield effectively waits approximately one millisecond (to the next
rtc irq). The implicit yielding in run_thread thus limited the number
of threads one could launch during preemption to 1 per millisecond.
So, change the code so that the new thread is created prior to the
current thread - thus eliminating the effective yield from
run_thread().
Kevin O'Connor [Sun, 28 Mar 2010 19:11:19 +0000 (15:11 -0400)]
Refactor USB hub code.
All four implementations of hubs (and root hubs) were very similar.
Replace them with a single implementation that uses callbacks for the
three custom parts (detect, reset, disconnect) of each type of hub.
Kevin O'Connor [Sun, 21 Mar 2010 03:25:11 +0000 (23:25 -0400)]
Improve USB EHCI timing.
Add a small delay even in non-power-switching mode to ensure device
detect completes.
Start companion controllers as soon as all port detects are complete -
don't wait for ehci device config to complete. This ensure critical
high/low speed devices (eg, usb keyboards) are initialized quickly.
Kevin O'Connor [Sun, 21 Mar 2010 00:21:13 +0000 (20:21 -0400)]
Disable inlining on old compilers.
If the compiler can't restrict inlining by stack usage, then disable
inlining in 16bit mode. Otherwise, old compilers produce code that
uses too much stack space.
Kevin O'Connor [Sun, 21 Mar 2010 00:41:38 +0000 (20:41 -0400)]
Force use of indirect function calls in inline assembler.
For indirect calls, place function address in a register and call it.
This is less optimal when gcc can inline the code and the destination
address is known at compile time. However, older gcc compilers don't
do as well with inlining, and they then mess up the code generation.
There doesn't seem to be a way to tell gcc how to emit the code
correctly for both immediate addresses and register addresses, so fall
back to a safe way.
Also, reduce params to stack_hop to avoid register assignment issues.
Kevin O'Connor [Sun, 14 Mar 2010 04:04:41 +0000 (23:04 -0500)]
Extend time for rtc to be ready.
Increase the time waiting for rtc from 3ms to 15ms - only 3ms is
needed on real hardware, but scheduling delays on qemu can make this
longer. Extending the time prevents annoying debugging messages.
Kevin O'Connor [Sun, 14 Mar 2010 03:29:55 +0000 (22:29 -0500)]
Backup and restore registers when calling out to user funcs.
Make sure to fully backup and restore register state when calling out
to other interrupts and functions. Some old DOS programs don't fully
restore state.
Also, make sure to enable irqs in call16_simpint().
Kevin O'Connor [Sun, 14 Mar 2010 03:23:44 +0000 (22:23 -0500)]
Enable irqs in kbd/clock calls that caller might "spin" on.
Some old programs will spin on a clock/keyboard call with irqs
disabled. They assume the BIOS will enable irqs and allow key events
and clock events to occur.
So, enable irqs in those functions that a caller might "spin" on.
Kevin O'Connor [Sun, 14 Mar 2010 02:05:12 +0000 (21:05 -0500)]
Process event on ps2 keyboard irq even if event already read.
Some old DOS programs will hook the keyboard irq, read the keyboard
data on irq, and then call the BIOS handler expecting it to continue
process the event. So, the BIOS can't assume it is the first to read
the data from the ps2 port.
Also, reduce window where a ps2 command could conflict with incoming
data. Disable all data during interrupt flushing, and only re-enable
the desired port just prior to sending the command.
Also, discard data from any interrupts if init hasn't completed.
That patch introduced a regression by enabling mouse interrupts by
default. It also appears that disabling interrupts by software alone
will not work well with some old DOS programs that hook the keyboard
irq.
Kevin O'Connor [Thu, 11 Mar 2010 03:32:26 +0000 (22:32 -0500)]
Fix smp cpu detect on gcc 4.5.
Bruce Rogers <brogers@novell.com> observed new compiler optimizing
away memory assign in smp detect. Add barrier() to code to ensure gcc
knows the SIPI can read/write memory.
Kevin O'Connor [Wed, 10 Mar 2010 00:33:22 +0000 (19:33 -0500)]
Some USB UHCI and OHCI fixes and cleanups.
Don't send a data packet on OHCI if no data to be sent.
Add some barrier() calls where needed.
Move toggle definition from generic pipe struct to uhci pipe struct.
Check for malloc failure on ohci and uhci "tds" request.
Be sure to always allocate an even number of intr tds on uhci - toggle
setting depends on it.
Kevin O'Connor [Wed, 10 Mar 2010 00:58:23 +0000 (19:58 -0500)]
Further parallelize USB init by launching a thread per usb port.
Run a thread per usb port in addition to the existing thread per usb
controller. This can reduce total boot time by allowing multiple USB
devices on the same controller to initialize in parallel. It also
makes startup time for critical devices (eg, the keyboard) less
dependent on which port they are plugged into.
Kevin O'Connor [Sat, 27 Feb 2010 18:49:47 +0000 (13:49 -0500)]
Introduce simple "mutex" locking code.
Locks are not normally necessary because SeaBIOS uses a cooperative
multitasking system. However, occasionally it is necessary to be able
to lock a resource across yield calls. This patch introduces a simple
mechanism for doing that.