seabios.git
13 years agoMake tools/transdump.py more resilient to unknown input.
Kevin O'Connor [Sat, 28 Aug 2010 16:54:23 +0000 (12:54 -0400)]
Make tools/transdump.py more resilient to unknown input.

13 years agoUpdate qemu_cfg_read to use "rep insb".
Kevin O'Connor [Thu, 26 Aug 2010 01:43:19 +0000 (21:43 -0400)]
Update qemu_cfg_read to use "rep insb".

Use rep insb instead of manual loop - the host may be able to optimize
the rep insb instruction.

13 years agoOnly show bootsplash during boot menu.
Kevin O'Connor [Thu, 26 Aug 2010 01:07:48 +0000 (21:07 -0400)]
Only show bootsplash during boot menu.

When the bootsplash picture is shown, it's not possible to see text.
So, only display the picture while prompting the user for the boot
menu.

13 years agoadd write support to virtio-blk
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.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
13 years agoDon't try to talk to APIC on 486
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.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
13 years agoAdd ACPI SSDT/DSDT support for CPU hotplug.
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.

13 years agoAdd additional debug status messages to bootsplash code.
Kevin O'Connor [Wed, 4 Aug 2010 00:58:43 +0000 (20:58 -0400)]
Add additional debug status messages to bootsplash code.

13 years agoAllow qemu to use bootsplash code via fwcfg interface.
Kevin O'Connor [Fri, 30 Jul 2010 22:53:10 +0000 (18:53 -0400)]
Allow qemu to use bootsplash code via fwcfg interface.

All the bootsplash code to pull the jpeg file from either cbfs (on
coreboot) or fwcfg (on qemu).

13 years agoAdd tools/trandump.py tool for converting hexdump() output.
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.

13 years agoDefault bootsplash on (for coreboot users).
Kevin O'Connor [Fri, 30 Jul 2010 18:09:31 +0000 (14:09 -0400)]
Default bootsplash on (for coreboot users).

13 years agoAutodetect video mode based on bootsplash jpeg dimensions.
Kevin O'Connor [Fri, 30 Jul 2010 18:07:03 +0000 (14:07 -0400)]
Autodetect video mode based on bootsplash jpeg dimensions.

Replace video mode settings in config.h with a system to auto-detect a
video mode for the given bootsplash.jpg file.

13 years agoRename "decdata" to "jpeg" in bootsplash - to be consistent with jpeg.c.
Kevin O'Connor [Fri, 30 Jul 2010 17:25:21 +0000 (13:25 -0400)]
Rename "decdata" to "jpeg" in bootsplash - to be consistent with jpeg.c.

Also rename "jpeg" to "filedata" to avoid a conflict.

13 years agoBreakup jpeg_decode into parsing and displaying phases.
Kevin O'Connor [Fri, 30 Jul 2010 17:07:08 +0000 (13:07 -0400)]
Breakup jpeg_decode into parsing and displaying phases.

Split the screen display code out of the jpeg parsing code.

Allow ability for caller to obtain jpeg dimensions.

13 years agoAvoid using BSS variables in jpeg.c.
Kevin O'Connor [Fri, 30 Jul 2010 16:27:14 +0000 (12:27 -0400)]
Avoid using BSS variables in jpeg.c.

Using BSS increases the rom size (and reduce space for option roms).
So, move BSS variables in the jpeg.c code to malloc'd memory.

Also, move struct and error declarations from jpeg.h to jpeg.c.

13 years agoAdd FUNC16() helper macro for converting a 16bit func to a segoff_s.
Kevin O'Connor [Thu, 29 Jul 2010 01:31:38 +0000 (21:31 -0400)]
Add FUNC16() helper macro for converting a 16bit func to a segoff_s.

13 years agoHandle unaligned sizes in iomemcpy().
Kevin O'Connor [Tue, 27 Jul 2010 05:14:11 +0000 (01:14 -0400)]
Handle unaligned sizes in iomemcpy().

This fixes a bug causing truncation of uncompressed files in
cbfs_copyfile().

13 years agoCleanup bootsplash vesa signature detection.
Kevin O'Connor [Tue, 27 Jul 2010 04:00:53 +0000 (00:00 -0400)]
Cleanup bootsplash vesa signature detection.

13 years agoBe sure to disable bootsplash on all BIOS boot cases.
Kevin O'Connor [Tue, 27 Jul 2010 03:47:26 +0000 (23:47 -0400)]
Be sure to disable bootsplash on all BIOS boot cases.

Disable the bootsplash on cbfs payload exec, and if something hooks
int19.

Also, be sure to only disable the bootsplash (revert to text mode)
once.

13 years agoAdd call16_int10 helper to bootsplash.c.
Kevin O'Connor [Tue, 27 Jul 2010 03:25:39 +0000 (23:25 -0400)]
Add call16_int10 helper to bootsplash.c.

13 years agoDon't do "double buffering" in bootsplash code.
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.

13 years agoCheck that malloc succeeds in bootsplash code.
Kevin O'Connor [Tue, 27 Jul 2010 03:02:26 +0000 (23:02 -0400)]
Check that malloc succeeds in bootsplash code.

Perform all the memory allocations up front and verify that all of
them succeed.

13 years agoBootsplash fixes and cleanups.
Kevin O'Connor [Tue, 27 Jul 2010 02:43:18 +0000 (22:43 -0400)]
Bootsplash fixes and cleanups.

VESA structs must be in first 1Meg - so use malloc_tmplow().

Use 'struct segoff_s' for segment/offset pairs in vesa structs.

Don't call start/finish_preempt() around jpeg_decode() - the preempt
only works when calling functions in 16bit mode.

Some indentation and debug output enhancements.

13 years agoMinor - clarify bit logic in mptable.c.
Kevin O'Connor [Tue, 27 Jul 2010 02:34:37 +0000 (22:34 -0400)]
Minor - clarify bit logic in mptable.c.

13 years agoFix integer truncating bug in calc_future_timer().
Kevin O'Connor [Tue, 27 Jul 2010 02:33:54 +0000 (22:33 -0400)]
Fix integer truncating bug in calc_future_timer().

Be sure to promote to u64 before multiplication.

13 years agoseabios: pciinit: fix 64bit bar initilization.
Isaku Yamahata [Mon, 26 Jul 2010 05:02:45 +0000 (14:02 +0900)]
seabios: pciinit: fix 64bit bar initilization.

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.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoMinor - introduce GDT_GRANLIMIT macro.
Kevin O'Connor [Sun, 25 Jul 2010 18:46:21 +0000 (14:46 -0400)]
Minor - introduce GDT_GRANLIMIT macro.

Add macro to improve readability of GDT limit definitions.

13 years agoAvoid code addresses >64K in big real mode.
Kevin O'Connor [Sun, 25 Jul 2010 18:04:01 +0000 (14:04 -0400)]
Avoid code addresses >64K in big real mode.

Kvm has some limitations with code addresses in big real mode, so
avoid doing that.

13 years agoseabios: smm: move out piix4 specific smram logic to dev-i440fx.c
Isaku Yamahata [Tue, 20 Jul 2010 07:50:46 +0000 (16:50 +0900)]
seabios: smm: move out piix4 specific smram logic to dev-i440fx.c

move out piix4 specific smram logic to dev-i440fx.c.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoseabios: shadow: make device finding more generic.
Isaku Yamahata [Tue, 20 Jul 2010 07:50:45 +0000 (16:50 +0900)]
seabios: shadow: make device finding more generic.

pam register offset is north bridge specific.
So determine the offset based on found north bridge.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoseabios: acpi: clean up of finding pm device.
Isaku Yamahata [Tue, 20 Jul 2010 07:37:19 +0000 (16:37 +0900)]
seabios: acpi: clean up of finding pm device.

Make it table driven to other chip set.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoseabios: acpi: split out piix4 pm logic.
Isaku Yamahata [Tue, 20 Jul 2010 07:37:18 +0000 (16:37 +0900)]
seabios: acpi: split out piix4 pm logic.

split out piix4 pm logic.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoseabios: acpi: move acpi definitions to acpi.h from acpi.c
Isaku Yamahata [Tue, 20 Jul 2010 07:37:17 +0000 (16:37 +0900)]
seabios: acpi: move acpi definitions to acpi.h from acpi.c

Move ACPI_TABLE_HEADER_DEF and struct fadt_descriptor_rev1
from acpi.h to acpi.c for later use.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoseabios: acpi: move out endian conversion helper function.
Isaku Yamahata [Tue, 20 Jul 2010 07:37:16 +0000 (16:37 +0900)]
seabios: acpi: move out endian conversion helper function.

move out cpu_to_le{32, 16} from acpi.c to util.h.
Those will be used by other files later.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoseabios: pci: introduce helper function to find device from table and initialize it.
Isaku Yamahata [Tue, 20 Jul 2010 07:37:15 +0000 (16:37 +0900)]
seabios: pci: introduce helper function to find device from table and initialize it.

introduce helper function to find device from table and initialize it.
pci_find_init_device(). This will be used later.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agosmbios: Allow all fields to be set via qemu_cfg_smbios_load_field()
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>
13 years agoseabios: pciinit: use pci device initializer helper function.
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.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoseabios: pci: introduce helper function to initialize a given device.
Isaku Yamahata [Wed, 7 Jul 2010 03:14:01 +0000 (12:14 +0900)]
seabios: pci: introduce helper function to initialize a given device.

introduce helper function to initialize a given device,
This will be used later.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agovirtio: Clear interrupt status register in virtio-blk
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>
13 years agoseabios: pciinit: initialize pci bridge filtering registers.
Isaku Yamahata [Tue, 22 Jun 2010 08:57:53 +0000 (17:57 +0900)]
seabios: pciinit: initialize pci bridge filtering registers.

initialize pci bridge filtering registers.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoseabios: pciinit: pci bridge bus initialization.
Isaku Yamahata [Tue, 22 Jun 2010 08:57:52 +0000 (17:57 +0900)]
seabios: pciinit: pci bridge bus initialization.

pci bridge bus initialization.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoseabios: pciinit: make bar offset calculation pci bridge aware.
Isaku Yamahata [Tue, 22 Jun 2010 08:57:51 +0000 (17:57 +0900)]
seabios: pciinit: make bar offset calculation pci bridge aware.

This patch makes pci bar offset calculation pci bridge aware.
The offset of pci bridge rom is different from normal device.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoseabios: pciinit: factor out bar offset calculation.
Isaku Yamahata [Tue, 22 Jun 2010 08:57:50 +0000 (17:57 +0900)]
seabios: pciinit: factor out bar offset calculation.

This patch factors out bar offset calculation.
Later the calculation logic will be enhanced.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoseabios: pciinit: make pci bar assigner preferchable memory aware.
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.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoseabios: pciinit: make pci memory space assignment 64bit aware.
Isaku Yamahata [Tue, 22 Jun 2010 08:57:48 +0000 (17:57 +0900)]
seabios: pciinit: make pci memory space assignment 64bit aware.

make pci memory space assignment 64bit aware.
If 64bit memory space is found while assigning pci memory space,
clear higher bit and skip to next bar.

This patch is preparation for q35 chipset initialization which
has 64bit bar.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoseabios: pciinit: factor out pci bar region allocation logic.
Isaku Yamahata [Tue, 22 Jun 2010 08:57:47 +0000 (17:57 +0900)]
seabios: pciinit: factor out pci bar region allocation logic.

factor out pci bar region allocation logic.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoseabios: pci: introduce foreachpci_in_bus() helper macro.
Isaku Yamahata [Tue, 22 Jun 2010 08:57:46 +0000 (17:57 +0900)]
seabios: pci: introduce foreachpci_in_bus() helper macro.

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.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
13 years agoAdd romfile_size() wrapper for accessing cbfs/qemu_cfg files.
Kevin O'Connor [Sun, 4 Jul 2010 12:32:38 +0000 (08:32 -0400)]
Add romfile_size() wrapper for accessing cbfs/qemu_cfg files.

13 years agoInitial bootsplash support.
Kevin O'Connor [Mon, 28 Jun 2010 11:34:53 +0000 (07:34 -0400)]
Initial bootsplash support.

Support displaying a jpeg file (stored in cbfs) during bootup.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
13 years agoUpdate TODO
Kevin O'Connor [Sat, 19 Jun 2010 16:07:57 +0000 (12:07 -0400)]
Update TODO

Remove already completed items.

13 years agoFix bvprintf() to respect padding for hex printing.
Kevin O'Connor [Sat, 19 Jun 2010 16:05:57 +0000 (12:05 -0400)]
Fix bvprintf() to respect padding for hex printing.

Fix bvprintf to respect space padding when printing hex numbers
and the caller specifies alignment without zero padding, eg. %2x
as opposed to %02x

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
13 years agoUnify optionrom cbfs/qemu_cfg rom pulling code.
Kevin O'Connor [Sun, 13 Jun 2010 20:05:17 +0000 (16:05 -0400)]
Unify optionrom cbfs/qemu_cfg rom pulling code.

Make the qemu_cfg optionrom extraction code use an interface more
similar to the cbfs file interface.

Introduce a set of "romfile_" wrappers that select between cbfs and
qemu cfg interface.  Use these new wrappers in the optionrom code.

13 years agoSeaBIOS VGA hooks
Stefan Reinauer [Wed, 9 Jun 2010 07:45:28 +0000 (09:45 +0200)]
SeaBIOS VGA hooks

Add VGA hooks to operate the following mainboards with coreboot + SeaBIOS:
- Kontron 986LCD-M
- Getac P470 (Laptop)
- Roda RK886EX (Laptop)

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
13 years agoSeaBIOS CD/DVD abbreviations
Stefan Reinauer [Wed, 9 Jun 2010 19:10:13 +0000 (21:10 +0200)]
SeaBIOS CD/DVD abbreviations

- Use the same description text for CD and DVD drives all over the tree.
- Mention DVD first as it's more likely these days

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
13 years agoseabios: remove iasl output file when error.
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>
13 years agoAllocate cdemu buffer in low mem instead of ebda.
Kevin O'Connor [Sun, 6 Jun 2010 20:18:03 +0000 (16:18 -0400)]
Allocate cdemu buffer in low mem instead of ebda.

Using the low memory buffer gives more flexibility with the final
location of the buffer.

Don't allocate the buffer at all if no cdrom drives are present.

13 years agoIntroduce memcpy_fl - a memcpy on "flat" pointers.
Kevin O'Connor [Sun, 6 Jun 2010 20:11:45 +0000 (16:11 -0400)]
Introduce memcpy_fl - a memcpy on "flat" pointers.

13 years agoRework malloc to use a "first fit" algorithm.
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).

13 years agoMinor mptable changes.
Kevin O'Connor [Sun, 6 Jun 2010 15:07:08 +0000 (11:07 -0400)]
Minor mptable changes.

Simplify entrycount tracking.

Allow mptable generation to work even if there is no high mem available.

13 years agovirtio: clean up memory barrier usage
Michael S. Tsirkin [Thu, 20 May 2010 13:36:32 +0000 (16:36 +0300)]
virtio: clean up memory barrier usage

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>
13 years agovirtio: remove NO_NOTIFY optimization
Michael S. Tsirkin [Thu, 20 May 2010 13:24:48 +0000 (16:24 +0300)]
virtio: remove NO_NOTIFY optimization

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>
13 years agoDon't use RTC to time boot menu delay.
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.

13 years agoGeneralize timer based delay code.
Kevin O'Connor [Sun, 23 May 2010 15:38:53 +0000 (11:38 -0400)]
Generalize timer based delay code.

Move the timer based counting code in serial.c to clock.c.

Rework the interface to make it similar to the tsc based timers.

13 years agoRename check_time() to check_tsc().
Kevin O'Connor [Sun, 23 May 2010 14:46:49 +0000 (10:46 -0400)]
Rename check_time() to check_tsc().

13 years agoAllow wait_irq to be called in 32bit code.
Kevin O'Connor [Sun, 23 May 2010 14:24:22 +0000 (10:24 -0400)]
Allow wait_irq to be called in 32bit code.

If wait_irq() is called from 32bit code, then jump to 16bit mode for
the wait.

Have wait_irq check for threads, and have it use yield if threads are
pending.  This ensures threads aren't delayed if anything calls
wait_irq.

Use wait_irq() in 32bit mode during a failed boot.

13 years agoImprove optionrom debugging statements.
Kevin O'Connor [Sun, 23 May 2010 14:22:23 +0000 (10:22 -0400)]
Improve optionrom debugging statements.

Display device/vendor ids in traditional format.

13 years agoMinor - compile out usb-msc code if CONFIG_USB_MSC not set.
Kevin O'Connor [Sun, 23 May 2010 14:21:00 +0000 (10:21 -0400)]
Minor - compile out usb-msc code if CONFIG_USB_MSC not set.

13 years agoMinor ata cleanups.
Kevin O'Connor [Sun, 23 May 2010 14:20:04 +0000 (10:20 -0400)]
Minor ata cleanups.

Eliminate process_atapi_op() code if CONFIG_ATA not set.
Use PCI_BASE_ADDRESS_IO_MASK instead of hardcoding it.

13 years agoMake sure virtio-blk is fully compiled out if not wanted.
Kevin O'Connor [Sun, 23 May 2010 14:19:03 +0000 (10:19 -0400)]
Make sure virtio-blk is fully compiled out if not wanted.

Add check for CONFIG_VIRTIO_BLK in process_virtio_op.
Don't enable virtio when coreboot enabled.

14 years agoMinor - split up virtio_blk_setup().
Kevin O'Connor [Thu, 20 May 2010 04:22:02 +0000 (00:22 -0400)]
Minor - split up virtio_blk_setup().

Split function to make it more readable.

Also, report all found virtio devices at debug level 1.

14 years agofix two issues with virtio-blk
Gleb Natapov [Mon, 17 May 2010 13:27:27 +0000 (16:27 +0300)]
fix two issues with virtio-blk

1. Check if blk_size is valid in virtio_blk config.
2. Disable interrupt otherwise interrupt may stuck
   with some guests.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
ChangeLog:
 v1->v2:
  - Treat sector size not equal to 512 bytes as error.

14 years agoMinor improvements to virtio (allow irqs, allocate page aligned).
Kevin O'Connor [Sun, 16 May 2010 15:34:38 +0000 (11:34 -0400)]
Minor improvements to virtio (allow irqs, allocate page aligned).

Allow irqs to be handled while waiting for virtio reads to complete.

Use native page aligned allocations instead of manually aligning the
data.  This reduces the amount of low memory virtio requires.

Also, some minor white space cleanups.

14 years agoFix virtio compile errors on various gcc versions.
Kevin O'Connor [Tue, 11 May 2010 01:51:38 +0000 (21:51 -0400)]
Fix virtio compile errors on various gcc versions.

Gcc 3.4 doesn't like __FUNCTION__ for some reason - use __func__
instead.

Gcc 4.5 compiles each .c file independently, so make sure includes are
correct for each .c file.

14 years agoSupport for booting from virtio disks
Gleb Natapov [Mon, 10 May 2010 08:36:37 +0000 (11:36 +0300)]
Support for booting from virtio disks

This patch adds native support for booting from virtio disks to Seabios.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
14 years agosmbios: avoid counting io hole as ram
Alex Williamson [Fri, 7 May 2010 19:38:55 +0000 (13:38 -0600)]
smbios: avoid counting io hole as ram

Avoid counting the io hole as part of ram, a vm started with 4G
should report 4G in smbios, not 4.5G.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
14 years agoFix error causing USB HID "boot" protocol to not be enabled.
Kevin O'Connor [Sun, 2 May 2010 02:45:56 +0000 (22:45 -0400)]
Fix error causing USB HID "boot" protocol to not be enabled.

To enable the "boot" protocol wValue must be 0, not 1.

14 years agoAdd support for USB mice.
Kevin O'Connor [Sun, 2 May 2010 02:14:40 +0000 (22:14 -0400)]
Add support for USB mice.

Initial support for USB mice that follow the "boot" protocol.

14 years agoWhen USB keyboard active, don't send keyboard commands to ps2 port.
Kevin O'Connor [Sat, 1 May 2010 23:59:34 +0000 (19:59 -0400)]
When USB keyboard active, don't send keyboard commands to ps2 port.

Route keyboard commands to a USB handler when USB keyboard is active.

Add a GETID handler for USB keyboards.

14 years agoDocument usb-hid.c functions.
Kevin O'Connor [Sat, 1 May 2010 23:25:41 +0000 (19:25 -0400)]
Document usb-hid.c functions.

14 years agoFurther parallelize init when using CONFIG_THREAD_OPTIONROMS.
Kevin O'Connor [Sat, 1 May 2010 16:20:33 +0000 (12:20 -0400)]
Further parallelize init when using CONFIG_THREAD_OPTIONROMS.

When optionrom threading is enabled, allow hardware init to run in
parallel with boot menu key press delay and with the smp detection.

Also, run qemu_cfg_port_probe() before ram_probe().

14 years agoHandle unknown function addresses in tools/checkstack.py.
Kevin O'Connor [Sat, 1 May 2010 15:03:10 +0000 (11:03 -0400)]
Handle unknown function addresses in tools/checkstack.py.

Handle cases where objdump shows an call to an unknown address.

Also, simplify implemention of orderfuncs() - use funcion addreses
instead of function names as keys.

14 years agoSimplify build by manually resolving external symbols in layoutrom.py.
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.

14 years agoUSB EHCI should yield() whil waiting for controller to ack reset.
Kevin O'Connor [Sat, 17 Apr 2010 20:59:12 +0000 (16:59 -0400)]
USB EHCI should yield() whil waiting for controller to ack reset.

14 years agoAdd __attribute__((__malloc__)) declaration to internal malloc funcs.
Kevin O'Connor [Sat, 17 Apr 2010 20:58:32 +0000 (16:58 -0400)]
Add __attribute__((__malloc__)) declaration to internal malloc funcs.

14 years agoMinor - remove redundant check from ata_try_dma.
Kevin O'Connor [Sat, 17 Apr 2010 20:57:57 +0000 (16:57 -0400)]
Minor - remove redundant check from ata_try_dma.

14 years agoFix possible unitialized variable issue in usb msc.
Kevin O'Connor [Fri, 9 Apr 2010 00:40:47 +0000 (20:40 -0400)]
Fix possible unitialized variable issue in usb msc.

On an error path, desc and udrive_g may not be initialized.

14 years agoSome improvements to optionrom preemption support.
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().

14 years agoRefactor USB hub code.
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.

14 years agoPrep version for next release.
Kevin O'Connor [Sun, 28 Mar 2010 17:53:40 +0000 (13:53 -0400)]
Prep version for next release.

14 years agoUpdate version to 0.6.0.
Kevin O'Connor [Sat, 27 Mar 2010 01:32:15 +0000 (21:32 -0400)]
Update version to 0.6.0.

14 years agoImprove USB EHCI timing.
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.

Also, be sure to disable port on a failed reset.

14 years agoDisable inlining on old compilers.
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.

14 years agoForce use of indirect function calls in inline assembler.
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.

14 years agoDon't move EBDA while an optionrom is running (CONFIG_THREAD_OPTIONROMS).
Kevin O'Connor [Sat, 20 Mar 2010 22:17:19 +0000 (18:17 -0400)]
Don't move EBDA while an optionrom is running (CONFIG_THREAD_OPTIONROMS).

Moving the ebda while an optionrom is running could confuse it.  So,
avoid doing that.

14 years agoCall to int1552 (from int1346) should set regs->dl.
Kevin O'Connor [Sat, 20 Mar 2010 21:53:40 +0000 (17:53 -0400)]
Call to int1552 (from int1346) should set regs->dl.

14 years agoAdjust debug levels of device discovery.
Kevin O'Connor [Sat, 20 Mar 2010 21:53:03 +0000 (17:53 -0400)]
Adjust debug levels of device discovery.

Be sure to print at debug level 1 all devices found.

14 years agoDefault CONFIG_COREBOOT_FLASH on; make depend on CONFIG_COREBOOT.
Kevin O'Connor [Sat, 20 Mar 2010 15:00:45 +0000 (11:00 -0400)]
Default CONFIG_COREBOOT_FLASH on; make depend on CONFIG_COREBOOT.

Coreboot users will almost certainly want CBFS support, and
non-coreboot users have no use for it.  So, make that the default
behaviour.

14 years agoRestore segment limits in handle_1589 code.
Kevin O'Connor [Mon, 15 Mar 2010 23:58:55 +0000 (19:58 -0400)]
Restore segment limits in handle_1589 code.

Before transitioning back to real mode, the segment registers should
be reloaded so that the hidden register limits are updated.

14 years agoExtend time for rtc to be ready.
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.

14 years agoBackup and restore registers when calling out to user funcs.
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().

14 years agoEnable irqs in kbd/clock calls that caller might "spin" on.
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.