Kevin O'Connor [Sat, 28 Aug 2010 18:55:32 +0000 (14:55 -0400)]
Enhance tools/readserial.py to support reading from a pipe.
Add option parsing support to tool.
Enable option (-f) to read from a pipe - which is useful when
redirecting qemu's debugging log to a pipe with:
-chardev pipe,id=seabios,path=seabioslog -device isa-debugcon,iobase=0x402,chardev=seabios
Gleb Natapov [Mon, 23 Aug 2010 07:23:45 +0000 (10:23 +0300)]
add write support to virtio-blk
Windows XP does write to sector 0 during installation and prints
mysterious error if write fails. Interestingly if write drops data,
but returns OK to Windows installer installation proceed without
complains and completes successfully.
Lubomir Rintel [Fri, 20 Aug 2010 11:37:54 +0000 (13:37 +0200)]
Don't try to talk to APIC on 486
It only has one cpuid level, therefore it can't report whether it
has an APIC. It probably hasn't; assume that. Without this,
SeaBIOS would get stuck on qemu -M isapc.
Kevin O'Connor [Wed, 4 Aug 2010 01:30:03 +0000 (21:30 -0400)]
Add ACPI SSDT/DSDT support for CPU hotplug.
Move the SSDT defined processors from _PR to _SB namespace.
Extend the dynamically generated SSDT to include per cpu hotplug
methods. These methods just call methods defined in the DSDT. Also
dynamically generate a NTFY method and a CPON array of the
online/available CPUs. Add file src/ssdt-proc.dsl with directions for
generating the per-cpu processor object AML code.
Extend the DSDT to include methods for handling cpu hotplug
notifications and methods for handling cpu status requests originating
from the SSDT methods.
Kevin O'Connor [Fri, 30 Jul 2010 22:51:29 +0000 (18:51 -0400)]
Add tools/trandump.py tool for converting hexdump() output.
Add tool for converting the output from hexdump() back into its
original binary form. This can be useful for use with tools such as
hexdump and objdump.
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().