seabios.git
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.

14 years agoProcess event on ps2 keyboard irq even if event already read.
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.

14 years agoRevert "Unify ps2 port data processing."
Kevin O'Connor [Sun, 14 Mar 2010 01:06:34 +0000 (20:06 -0500)]
Revert "Unify ps2 port data processing."

This reverts commit 84f7b801ba8c0806fac568e59e85af281c0df207.

It's not possible to unify ps2 port irq processing because old DOS
apps could hook one or both of the kbd/mouse ps2 irqs.

14 years agoHandle variable length return of ps2 port GETID command.
Kevin O'Connor [Sun, 14 Mar 2010 00:59:24 +0000 (19:59 -0500)]
Handle variable length return of ps2 port GETID command.

Sometimes GETID returns two bytes, and sometimes one byte.  Handle
that properly.

This fixes a failure with an msdos mouse driver.

14 years agoPrevent ps2 irqs from messing up ps2 init.
Kevin O'Connor [Sun, 14 Mar 2010 00:00:02 +0000 (19:00 -0500)]
Prevent ps2 irqs from messing up ps2 init.

This is an alternate to 6f702dd6987b22e9bce472fe61910392af17416a.

After disabling ps2 irqs, enable irqs to flush any queued irqs.  This
should prevent irqs from triggering in the middle of the init process.

14 years agoRevert "Rework disabling of ps2 port irqs."
Kevin O'Connor [Sat, 13 Mar 2010 23:51:46 +0000 (18:51 -0500)]
Revert "Rework disabling of ps2 port irqs."

This reverts commit 6f702dd6987b22e9bce472fe61910392af17416a.

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.

14 years agoFix smp cpu detect on gcc 4.5.
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.

14 years agoImprovements to tools/checkstack.py.
Kevin O'Connor [Wed, 10 Mar 2010 01:01:35 +0000 (20:01 -0500)]
Improvements to tools/checkstack.py.

Add explicit tracking of functions that switch stacks.

Add new tracking of "yield" points -- areas in the code that appear to
hand control to third-party code which may use arbitrary stack space.

Try to arrange the output so that functions that call each other are
near each other.

14 years agoAdd USB EHCI controller support.
Kevin O'Connor [Wed, 10 Mar 2010 00:43:52 +0000 (19:43 -0500)]
Add USB EHCI controller support.

Initial support for EHCI high-speed USB controllers.

14 years agoSome USB UHCI and OHCI fixes and cleanups.
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.

14 years agoMinor - USB OHCI interrupt queue should be one larger.
Kevin O'Connor [Sun, 28 Feb 2010 07:36:32 +0000 (02:36 -0500)]
Minor - USB OHCI interrupt queue should be one larger.

One of the entries in the queue can't be used, so the total queue size
needs to be one larger than it currently is.

14 years agoReduce size of USB 'struct uhci_td'.
Kevin O'Connor [Sun, 28 Feb 2010 04:50:48 +0000 (23:50 -0500)]
Reduce size of USB 'struct uhci_td'.

Reduce the size to make arrays of tds smaller.  For interrupt in
pipes, allocate the data space separately.

14 years agoDynamically allocate USB controller structures.
Kevin O'Connor [Sun, 28 Feb 2010 07:23:19 +0000 (02:23 -0500)]
Dynamically allocate USB controller structures.

Have each controller type allocate its own data structure.

Also, implement freeing of unused uhci controller structures.

14 years agoReplace USB encoded 'u32 endp' scheme with explicit struct fields.
Kevin O'Connor [Sun, 28 Feb 2010 07:17:28 +0000 (02:17 -0500)]
Replace USB encoded 'u32 endp' scheme with explicit struct fields.

Expand 'struct usb_pipe' with all the fields that are needed from the
encoded 'u32 endp' field.

14 years agoFurther parallelize USB init by launching a thread per usb port.
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.

14 years agoIntroduce simple "mutex" locking code.
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.

14 years agoOnly compile usb-hub.c and paravirt.c with 32bit code.
Kevin O'Connor [Sat, 27 Feb 2010 18:43:47 +0000 (13:43 -0500)]
Only compile usb-hub.c and paravirt.c with 32bit code.

Those files are only used by 32bit code, so don't bother including
them with the 16bit code.

14 years agoPrefer passing a USB "pipe" structure over a USB endp encoding.
Kevin O'Connor [Fri, 26 Feb 2010 13:57:13 +0000 (08:57 -0500)]
Prefer passing a USB "pipe" structure over a USB endp encoding.

Instead of passing the "u32 endp" encoding of the usb endpoint,
allocate a "struct usb_pipe" for each end point and pass that.
Allocate a control pipe for every device found.  Support freeing the
pipes after they are done.

Implement pipe allocation and freeing for both UHCI and OHCI
controllers.

Also, don't define every UHCI qh to include a pipe - create a separate
structure "struct uhci_pipe".  Also, be sure to clear the
USBControllers on reset.  Also, convert usb_hub_init to return 0 on
success.  Also, cleanup some of the USB debug messages to make them
more consistent.

14 years agoAdd a generic "internal error" warning function.
Kevin O'Connor [Fri, 26 Feb 2010 13:45:00 +0000 (08:45 -0500)]
Add a generic "internal error" warning function.

14 years agoDynamically allocate ata_channel info; introduce custom atadrive_s struct.
Kevin O'Connor [Sun, 28 Feb 2010 06:28:11 +0000 (01:28 -0500)]
Dynamically allocate ata_channel info; introduce custom atadrive_s struct.

Don't limit the number of ATA controllers supported - just dynamically
allocate the structs.

Create an atadrive_s struct that extends the standard 'struct drive_s'
and have the new struct store a pointer to the ata channel info.

Also, prefer storing drive_s pointers as 32bit "flat" pointers -
adjust them as needed in the 16bit code.

14 years agoCleanup - build drive description in temp memory during init.
Kevin O'Connor [Mon, 22 Feb 2010 04:20:10 +0000 (23:20 -0500)]
Cleanup - build drive description in temp memory during init.

Remove describe_drive() mechanism for calling printf with a drive
description.  Instead, have each drive build a description in
temporary ram during drive initialization.

Also, remove fields now unneeded from 'struct disk_s' - model and
cntl_info.

14 years agoSeabios e820 reservation portion v3
Jes Sorensen [Tue, 16 Feb 2010 08:46:08 +0000 (09:46 +0100)]
Seabios e820 reservation portion v3

On 02/16/10 01:43, Kevin O'Connor wrote:
> On Mon, Feb 15, 2010 at 06:33:59PM +0100, Jes Sorensen wrote:
>> Hi,
>>
>> This is the Seabios part to match my e820 reservation via fw_cfg patch.
>
> This still has 'struct e820_entry' which is too similar to 'struct
> e820entry' in memmap.h.  Otherwise, it looks good to me.

Hmmm didn't catch that one earlier, thanks for pointing it out. I have
renamed it to struct e820_reservation to make it different.

Hope this version does the trick then.

Cheers,
Jes

Read optional table of e820 entries from qemu_cfg

Read optional table of e820 entries through qemu_cfg, allowing QEMU to
provide the location of KVM's switch area etc. rather than rely on
hard coded values.

For now, fall back to the old hard coded values for the TSS and EPT
switch page for compatibility reasons. Compatibility code could
possibly be removed in the future.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
14 years agoInitial support for booting from USB drives.
Kevin O'Connor [Thu, 18 Feb 2010 04:24:42 +0000 (23:24 -0500)]
Initial support for booting from USB drives.

This patch adds initial support for USB Mass Storage Controllers.
This includes support for bulk transfers on UHCI controllers.
Code to detect a USB MSC device is added, and wrappers for sending
    "cdb" block commands over USB are added.
The scsi "inquiry" command is also added.

14 years agoIntroduce helper functions for finding USB end-points.
Kevin O'Connor [Thu, 18 Feb 2010 04:06:52 +0000 (23:06 -0500)]
Introduce helper functions for finding USB end-points.

Introduce findEndPointDesc() and mkendpFromDesc() and refactor usb-hid
code.

14 years agoUSB UHCI cleanups.
Kevin O'Connor [Thu, 18 Feb 2010 03:59:53 +0000 (22:59 -0500)]
USB UHCI cleanups.

Add barrier() calls before memory accesses that can be seen by controller.
Fix TD_CTRL_ANY_ERROR macro definition.
Other cleanups.

14 years agoMinor - arrange struct drive_s to clarify field roles.
Kevin O'Connor [Thu, 18 Feb 2010 03:55:36 +0000 (22:55 -0500)]
Minor - arrange struct drive_s to clarify field roles.

14 years agoFix off by one error in strtcpy.
Kevin O'Connor [Thu, 18 Feb 2010 03:49:01 +0000 (22:49 -0500)]
Fix off by one error in strtcpy.

The strtcpy function could overrun its output buffer.

14 years agoDon't require a valid physical cylinders/heads/spt for logical mapping.
Kevin O'Connor [Wed, 17 Feb 2010 06:07:36 +0000 (01:07 -0500)]
Don't require a valid physical cylinders/heads/spt for logical mapping.

Modern drives don't provide a "physical" chs report - try to detect
that and force an LBA mapping in that case.

Also, don't require setup_translation be called only on ATA drives.

14 years agoMove common "command data block" functions to new file blockcmd.c.
Kevin O'Connor [Wed, 17 Feb 2010 06:01:32 +0000 (01:01 -0500)]
Move common "command data block" functions to new file blockcmd.c.

Move common "cdb" request functions to a new file.

14 years agoDynamically allocate each drive_g with malloc_fseg().
Kevin O'Connor [Tue, 16 Feb 2010 03:48:28 +0000 (22:48 -0500)]
Dynamically allocate each drive_g with malloc_fseg().

This eliminates the limit on the number of available drives.  It also
allows for each driver to allocate additional custom fields.

14 years agoAdd *.pyc to .gitignore.
Kevin O'Connor [Tue, 16 Feb 2010 00:31:23 +0000 (19:31 -0500)]
Add *.pyc to .gitignore.

14 years agoAdd common "block command" definitions and update cdrom code.
Kevin O'Connor [Mon, 15 Feb 2010 16:56:07 +0000 (11:56 -0500)]
Add common "block command" definitions and update cdrom code.

Introduce standard definitions and names for the "command data block"
commands used in the cdrom code.

14 years agoOptimize ntohl() code.
Kevin O'Connor [Mon, 15 Feb 2010 15:46:37 +0000 (10:46 -0500)]
Optimize ntohl() code.

Use the assembler bswapl instruction if the value is not constant.

14 years agoMinor - sort ATA CMD definitions.
Kevin O'Connor [Mon, 15 Feb 2010 07:21:10 +0000 (02:21 -0500)]
Minor - sort ATA CMD definitions.

14 years agoInitial support for USB hubs.
Kevin O'Connor [Mon, 15 Feb 2010 23:58:12 +0000 (18:58 -0500)]
Initial support for USB hubs.

Add support for detecting, initializing, and enumerating USB hubs.

14 years agoMinor - increase debug level of some USB debug statements.
Kevin O'Connor [Mon, 15 Feb 2010 00:07:43 +0000 (19:07 -0500)]
Minor - increase debug level of some USB debug statements.

14 years agoDon't leave USB UHCI ports disabled for extended time during reset.
Kevin O'Connor [Mon, 15 Feb 2010 00:05:35 +0000 (19:05 -0500)]
Don't leave USB UHCI ports disabled for extended time during reset.

Disabling the port will cause device to go into suspend - so don't do
that during the reset sequence.

14 years agoDon't parallelize USB OHCI root port reset.
Kevin O'Connor [Sun, 14 Feb 2010 23:59:48 +0000 (18:59 -0500)]
Don't parallelize USB OHCI root port reset.

If multiple ports are reset simultaneously, they could both respond to
the default address.  So, only reset one at a time.

14 years agoIntroduce standard warnings for allocation failures and timeouts.
Kevin O'Connor [Sun, 14 Feb 2010 18:07:54 +0000 (13:07 -0500)]
Introduce standard warnings for allocation failures and timeouts.

There is no need for custom warnings for many common failures.
Introduce a common warning which is consistent and more visible.

14 years agoAdd symbolic definitions for USB delays.
Kevin O'Connor [Sun, 14 Feb 2010 17:16:32 +0000 (12:16 -0500)]
Add symbolic definitions for USB delays.

14 years agoSupport USB interrupt schedules on OHCI and UHCI.
Kevin O'Connor [Sun, 14 Feb 2010 02:51:47 +0000 (21:51 -0500)]
Support USB interrupt schedules on OHCI and UHCI.

The existing code always checks for USB "interrupt in" events every
millisecond.  Although that's okay, it consumes extra bandwidth.  This
change interrupt checks to be scheduled according to their requested
interval time.

14 years agoAdd some ASSERT32FLAT() to help compiler eliminate dead code.
Kevin O'Connor [Sat, 13 Feb 2010 23:49:24 +0000 (18:49 -0500)]
Add some ASSERT32FLAT() to help compiler eliminate dead code.

The function pointer passed to run_thread() can confuse the compiler
into thinking the function needs to be emitted.  Add ASSERT32FLAT() to
help the compiler eliminate this code.

14 years agoseabios: acpi: fix memory leak in build_srat().
Isaku Yamahata [Fri, 12 Feb 2010 02:36:20 +0000 (11:36 +0900)]
seabios: acpi: fix memory leak in build_srat().

numadata() is allocated for temporal use, but not freed.
free it.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
14 years agoSupport USB keyboard auto-repeat.
Kevin O'Connor [Fri, 12 Feb 2010 03:32:12 +0000 (22:32 -0500)]
Support USB keyboard auto-repeat.

Support handling of multiple keys pressed simultanously.
Support auto-repeat via USB HID Set_Idle command.
Also, add "noinline" directives to reduce stack usage of timer irq.

14 years agomptable: Pull cpuid_signature/features setting out of loop.
Kevin O'Connor [Fri, 12 Feb 2010 03:19:14 +0000 (22:19 -0500)]
mptable: Pull cpuid_signature/features setting out of loop.

14 years agoRework disabling of ps2 port irqs.
Kevin O'Connor [Fri, 29 Jan 2010 01:35:21 +0000 (20:35 -0500)]
Rework disabling of ps2 port irqs.

Disable the ps2 port irqs in software instead of hardware.  This
prevents a race where an irq could get queued and later called when
not desired.

14 years agoGo back to using 0xf0000000 for PCI memory start.
Kevin O'Connor [Fri, 29 Jan 2010 01:33:20 +0000 (20:33 -0500)]
Go back to using 0xf0000000 for PCI memory start.

Qemu/Kvm still has some dependencies on 0xe0000000, so go back until
they are ready.

14 years agoRead APIC version from APIC instead of using a hard-coded value.
Magnus Christensson [Mon, 23 Nov 2009 13:01:19 +0000 (14:01 +0100)]
Read APIC version from APIC instead of using a hard-coded value.

Signed-off-by: Magnus Christensson <mch@virtutech.com>
14 years agoWork around bochs floppy issue with wait_irq().
Kevin O'Connor [Sun, 17 Jan 2010 18:00:49 +0000 (13:00 -0500)]
Work around bochs floppy issue with wait_irq().

Bochs turns off floppy dma when cpu is halted, so work around problem.

14 years agoAdd CONFIG_ATA_DMA option; default to off for now.
Kevin O'Connor [Sun, 17 Jan 2010 17:58:47 +0000 (12:58 -0500)]
Add CONFIG_ATA_DMA option; default to off for now.

Allow compile option to disable ATA DMA support.
Turn it off by default for now - some coreboot users are seeing issues
    with it.

14 years agoFix PkgLength calculation for the SSDT.
Magnus Christensson [Wed, 25 Nov 2009 15:26:58 +0000 (16:26 +0100)]
Fix PkgLength calculation for the SSDT.

Signed-off-by: Magnus Christensson <mch@virtutech.com>
14 years agoAdd explicit Program Headers to linker scripts.
Kevin O'Connor [Sun, 10 Jan 2010 05:38:53 +0000 (00:38 -0500)]
Add explicit Program Headers to linker scripts.

Looks like some versions of binutils are aligning the LOAD program
header to a large size.  This is causing an issue for coreboot users,
so add an explicit LOAD program header with a reasonable value.

14 years agoPrep version for next release.
Kevin O'Connor [Sun, 10 Jan 2010 05:38:24 +0000 (00:38 -0500)]
Prep version for next release.

14 years agoUpdate version to 0.5.1
Kevin O'Connor [Sat, 9 Jan 2010 04:49:31 +0000 (23:49 -0500)]
Update version to 0.5.1

14 years agoFix sign error preventing incorrect memory over 4gig calculation.
Kevin O'Connor [Wed, 6 Jan 2010 00:50:04 +0000 (19:50 -0500)]
Fix sign error preventing incorrect memory over 4gig calculation.

14 years agoMinor - better indent assembler in int1587.
Kevin O'Connor [Tue, 5 Jan 2010 02:04:04 +0000 (21:04 -0500)]
Minor - better indent assembler in int1587.

14 years agoAdd comment explaining why mptable is in low memory.
Kevin O'Connor [Tue, 5 Jan 2010 01:49:45 +0000 (20:49 -0500)]
Add comment explaining why mptable is in low memory.

14 years agoAdd int1589 support.
Kevin O'Connor [Tue, 5 Jan 2010 01:48:20 +0000 (20:48 -0500)]
Add int1589 support.

Int1589 switches into protected mode for the caller.
Also, consistently use BUILD_BIOS_ADDR/SIZE in GDT macros.

14 years agoSet FDPT in irq table even for small drives.
Kevin O'Connor [Mon, 4 Jan 2010 03:24:18 +0000 (22:24 -0500)]
Set FDPT in irq table even for small drives.

Fix bug due to fill_fdpt exiting early in non-logical drive case.

14 years agoReduce #ifs by weeding out some cross-chunk function definitions.
Kevin O'Connor [Sun, 3 Jan 2010 23:33:00 +0000 (18:33 -0500)]
Reduce #ifs by weeding out some cross-chunk function definitions.

Reduce the need for placing #if guards around functions that are
marked as VISIBLE in another code chunk by declaring the functions as
"weak" when they are not needed.

It's still necessary to ensure that no C code references the data from
a different chunk (or an -fwhole-program compile might try to keep a
local reference).

14 years agoFix vgahook sign issue; add warning to build to catch future cases.
Kevin O'Connor [Sun, 3 Jan 2010 23:09:08 +0000 (18:09 -0500)]
Fix vgahook sign issue; add warning to build to catch future cases.

14 years agovgabios: Fix compile error due to fixed prototypes.
Kevin O'Connor [Sun, 3 Jan 2010 22:53:58 +0000 (17:53 -0500)]
vgabios: Fix compile error due to fixed prototypes.

14 years agoBe sure to add "void" to all function prototypes that take no args.
Kevin O'Connor [Sun, 3 Jan 2010 22:43:37 +0000 (17:43 -0500)]
Be sure to add "void" to all function prototypes that take no args.

Omitting "void" leads to a K&R style declaration which was not intended.

14 years agomptable: Reset pinmask on new bus or device.
Kevin O'Connor [Sun, 3 Jan 2010 20:14:11 +0000 (15:14 -0500)]
mptable: Reset pinmask on new bus or device.

Fix small possibility of bus changing without device changing.

14 years agoDetect latest FC12 gcc -combine breakage.
Kevin O'Connor [Sun, 3 Jan 2010 20:12:00 +0000 (15:12 -0500)]
Detect latest FC12 gcc -combine breakage.

Now, assigning a value to a global is needed to triger ICE.

14 years agoMinor vga binary cleanups.
Kevin O'Connor [Fri, 1 Jan 2010 17:53:32 +0000 (12:53 -0500)]
Minor vga binary cleanups.

14 years agoMake MTRR region 0xc0000-0x100000 be cached.
Kevin O'Connor [Fri, 1 Jan 2010 17:50:04 +0000 (12:50 -0500)]
Make MTRR region 0xc0000-0x100000 be cached.

Use the "write protect" setting instead of "uncached" for that region.
Also, make sure to clear all variable MTRRs before enabling them.

14 years agoForce a link error if a function is used from the wrong code chunk.
Kevin O'Connor [Fri, 1 Jan 2010 17:46:54 +0000 (12:46 -0500)]
Force a link error if a function is used from the wrong code chunk.

Force functions intended for other code segments to be discarded
    during link - this will cause a link error if it used.
Clean up rom layout code to ensure discarded sections are not used.

14 years agoAdd __noreturn define for __attribute__((noreturn)).
Kevin O'Connor [Fri, 1 Jan 2010 08:04:19 +0000 (03:04 -0500)]
Add __noreturn define for __attribute__((noreturn)).

14 years agoImplement native 32bit APM support.
Kevin O'Connor [Fri, 1 Jan 2010 18:03:17 +0000 (13:03 -0500)]
Implement native 32bit APM support.

Add APM code to 32bit segmented code.
Use 32bit APM code instead of jumping into 16bit mode.

14 years agoCommit compiled dsdt file; misc comment updates.
Kevin O'Connor [Wed, 30 Dec 2009 17:36:22 +0000 (12:36 -0500)]
Commit compiled dsdt file; misc comment updates.

Commit new dsdt with recent changes.
Add some misc comments.
Also, fix uninitialized warning in mptable code.

14 years agoprevent acpi from rerouting SCI interrupt
Gleb Natapov [Thu, 24 Dec 2009 12:37:16 +0000 (14:37 +0200)]
prevent acpi from rerouting SCI interrupt

SCI interrupt in piix4 chipset is hardwired to gsi 9, but we allow it
to be reconfigured by acpi. Fix this by providing fixed gsi for
PCI device 1 pin 0.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
14 years agoenumerate all PCI buses in mptable
Gleb Natapov [Mon, 28 Dec 2009 09:04:46 +0000 (11:04 +0200)]
enumerate all PCI buses in mptable

Signed-off-by: Gleb Natapov <gleb@redhat.com>
14 years agoAdd support for 32bit PCI BIOS entry.
Kevin O'Connor [Wed, 30 Dec 2009 17:14:53 +0000 (12:14 -0500)]
Add support for 32bit PCI BIOS entry.

Create a new code blob (code32seg) with support for 32bit functions
    that need to utilize explicit segment accesses.
This code blob uses global variables relative to %gs and with a
    dynamic code offset (determined by get_global_offset()).
Add BIOS32 structure and code.
Add code for 32bit PCI BIOS code.

14 years agoOnly add "addr32" to memory accesses that require them.
Kevin O'Connor [Sun, 27 Dec 2009 05:14:26 +0000 (00:14 -0500)]
Only add "addr32" to memory accesses that require them.

Extract out addr32 to a parameter to the READx/WRITEx_SEG macros.

14 years agoIntroduce MODESEGMENT define; rename VISIBLE32 to VISIBLE32FLAT.
Kevin O'Connor [Sun, 27 Dec 2009 04:32:57 +0000 (23:32 -0500)]
Introduce MODESEGMENT define; rename VISIBLE32 to VISIBLE32FLAT.

Prepare for support of segmented 32bit code.
Add new MODESEGMENT definition, and clarify existing 32bit mode defs.

14 years agoAllocate smbios in temp space and copy into final location.
Kevin O'Connor [Sun, 27 Dec 2009 04:26:44 +0000 (23:26 -0500)]
Allocate smbios in temp space and copy into final location.

This reduces memory needed in the reserved high memory area.

14 years agoClear user reserved interrupts (0x60-0x66).
Kevin O'Connor [Sun, 27 Dec 2009 04:24:52 +0000 (23:24 -0500)]
Clear user reserved interrupts (0x60-0x66).

This patch is equivalent to a patch recently committed to Bochs bios
(d8b4b998).

14 years agoRemove pci_bios_bigmem_addr; set pci_bios_mem_addr=0xe0000000
Kevin O'Connor [Sun, 27 Dec 2009 04:23:15 +0000 (23:23 -0500)]
Remove pci_bios_bigmem_addr; set pci_bios_mem_addr=0xe0000000

This patch removes pci_bios_bigmem_addr, and it changes
pci_bios_mem_addr to start at 0xe0000000.

The pci_bios_bigmem_addr was removed from bochs.  Also, the current
code looks wrong as nothing stops an address given from
pci_bios_bigmem_addr from overlapping an address given from
pci_bios_mem_addr.

The change also moves pci_bios_mem_addr back to 0xe0000000 - both the
acpi and mtrr code use 0xe0000000.

14 years agoAdd initial support for ATA DMA.
Kevin O'Connor [Sun, 27 Dec 2009 04:21:38 +0000 (23:21 -0500)]
Add initial support for ATA DMA.

Add support for detecting and using SFF 8038 compatible PCI devices.
Currently, only ATA transfers (not ATAPI) will use DMA.

14 years agoAllocate mptable in temp space and copy into final location.
Kevin O'Connor [Sat, 26 Dec 2009 16:15:31 +0000 (11:15 -0500)]
Allocate mptable in temp space and copy into final location.

Copying into the f-segment ensures no extra space is needed.