]> xenbits.xensource.com Git - seabios.git/log
seabios.git
10 years agoDo full BREGS backup/restore for pmm, pnp, and irqentry_extrastack
Kevin O'Connor [Tue, 21 Oct 2014 18:34:06 +0000 (14:34 -0400)]
Do full BREGS backup/restore for pmm, pnp, and irqentry_extrastack

Although these entry points only require backup and restore of the
registers that the C code clobbers, there is no harm in backing up
some additional registers.  This allows the BREGS macros to be used
which makes the code a little more readable.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoCreate assembler macros for saving and restoring 'struct bregs'
Kevin O'Connor [Tue, 21 Oct 2014 06:23:02 +0000 (02:23 -0400)]
Create assembler macros for saving and restoring 'struct bregs'

Create macros SAVEBREGS_POP_DSEAX and RESTOREBREGS_DSEAX for saving
and restoring the cpu state.  These are similar to the existing
PUSHBREGS and POPBREGS macros.

This also fixes a bug in __farcall16 which inadvertently restored %ds
in %es and vice-versa.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoDon't clobber %ax on ENTRY_INTO32 macro
Kevin O'Connor [Tue, 21 Oct 2014 07:19:55 +0000 (03:19 -0400)]
Don't clobber %ax on ENTRY_INTO32 macro

There's no need to clobber %ax in ENTRY_INTO32.  Now that %eax isn't
clobbered, use ENTRY_INTO32 in entry_csm.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoUse 32bit memcpy in int1587 when applicable
Kevin O'Connor [Tue, 21 Oct 2014 03:06:04 +0000 (23:06 -0400)]
Use 32bit memcpy in int1587 when applicable

If the amount of data to be copied is an even number of four, then
copy the data in four byte chunks.  This 32bit copy is more efficient,
in particular when copying to/from memory mapped io.  This should
improve the performance of framebuffer draws in cbvga SeaVGABIOS.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agousb: Use usb_realloc_pipe for pipe alloc, update, and free.
Kevin O'Connor [Thu, 16 Oct 2014 18:03:39 +0000 (14:03 -0400)]
usb: Use usb_realloc_pipe for pipe alloc, update, and free.

Now that the usb controller drivers all support the realloc method,
use that for all pipe allocations, reallocations, and freeing.  This
gives the driver more control over the pipe life cycle.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoehci: Export ehci_realloc_pipe() instead of ehci_alloc_pipe()
Kevin O'Connor [Thu, 16 Oct 2014 17:40:42 +0000 (13:40 -0400)]
ehci: Export ehci_realloc_pipe() instead of ehci_alloc_pipe()

Support alloc, update, and free from the single exported function.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoohci: Export ohci_realloc_pipe() instead of ohci_alloc_pipe()
Kevin O'Connor [Thu, 16 Oct 2014 17:36:41 +0000 (13:36 -0400)]
ohci: Export ohci_realloc_pipe() instead of ohci_alloc_pipe()

Support alloc, update, and free from the single exported function.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agouhci: Export uhci_realloc_pipe() instead of uhci_alloc_pipe()
Kevin O'Connor [Thu, 16 Oct 2014 17:33:35 +0000 (13:33 -0400)]
uhci: Export uhci_realloc_pipe() instead of uhci_alloc_pipe()

Support alloc, update, and free from the single exported function.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoxhci: Change xhci_update_pipe() to xhci_realloc_pipe() and use for alloc too
Kevin O'Connor [Thu, 16 Oct 2014 17:23:08 +0000 (13:23 -0400)]
xhci: Change xhci_update_pipe() to xhci_realloc_pipe() and use for alloc too

Instead of exporting both xhci_alloc_pipe() and xhci_update_pipe(),
export only xhci_realloc_pipe() and support alloc, update, and free
from it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agousb: Clarify usb freelist manipulations
Kevin O'Connor [Thu, 16 Oct 2014 16:31:42 +0000 (12:31 -0400)]
usb: Clarify usb freelist manipulations

Rename usb_getFreePipe() to usb_get_freelist().  Add usb_is_freelist()
and usb_add_freelist() functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agousb: Rename free_pipe() to usb_free_pipe()
Kevin O'Connor [Thu, 16 Oct 2014 15:59:45 +0000 (11:59 -0400)]
usb: Rename free_pipe() to usb_free_pipe()

Also, pass in usbdev to usb_free_pipe().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agousb: Rename send_default_control() to usb_send_default_control()
Kevin O'Connor [Thu, 16 Oct 2014 16:11:12 +0000 (12:11 -0400)]
usb: Rename send_default_control() to usb_send_default_control()

This is just function renaming - no code implementation changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agousb: Rename findEndPointDesc() to usb_find_desc()
Kevin O'Connor [Thu, 16 Oct 2014 16:08:00 +0000 (12:08 -0400)]
usb: Rename findEndPointDesc() to usb_find_desc()

This is just function renaming - no code implementation changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agousb: Rename usb_getFrameExp() to usb_get_period()
Kevin O'Connor [Thu, 16 Oct 2014 16:05:09 +0000 (12:05 -0400)]
usb: Rename usb_getFrameExp() to usb_get_period()

This is just function renaming - no code implementation changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agousb: Rename ?hci_control() to ?hci_send_control()
Kevin O'Connor [Thu, 16 Oct 2014 15:55:16 +0000 (11:55 -0400)]
usb: Rename ?hci_control() to ?hci_send_control()

This is just function renaming - no code implementation changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoBackup and restore a20 on call32_sloppy()
Kevin O'Connor [Sat, 11 Oct 2014 17:27:16 +0000 (13:27 -0400)]
Backup and restore a20 on call32_sloppy()

Previously, the a20 line would always be enabled and left on after
call32_sloppy().  The setting should really be backed up and restored
on each call.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoMove a20 code from system.c and ps2port.h to x86.h
Kevin O'Connor [Sat, 11 Oct 2014 17:16:12 +0000 (13:16 -0400)]
Move a20 code from system.c and ps2port.h to x86.h

Although the a20 functionality was originally implemented in the ps2
controller, that is just a historical artifact.  It's a core feature
of modern x86 cpus and the code is better located in the x86.h header.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoImplement call32 mechanism using SMIs.
Kevin O'Connor [Fri, 11 Apr 2014 15:20:41 +0000 (11:20 -0400)]
Implement call32 mechanism using SMIs.

Add support for jumping into 32bit mode using a System Management Mode
(SMM) handler.  When available, this allows SeaBIOS to transition to
32bit mode even when called in vm86 mode.  It will also prevent the
clobbering of the segment registers.

Currently, the SMM mode is only supported in QEMU when running in TCG
mode.  Also, QEMU v2.1 (or later) is needed for it to work when in
vm86 mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoFully restore 16bit state during call16_sloppy()
Kevin O'Connor [Tue, 30 Sep 2014 16:55:54 +0000 (12:55 -0400)]
Fully restore 16bit state during call16_sloppy()

When transitioning back to 16bit mode from within call32(), restore
the full state (cmos index, gdt, fs/gs) in addition to restoring the
original stack.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoBreak up call32() into call32() and call32_sloppy()
Kevin O'Connor [Tue, 30 Sep 2014 16:13:44 +0000 (12:13 -0400)]
Break up call32() into call32() and call32_sloppy()

This separates call32() into two functions.  It also moves the
call16_sloppy() code next to the call32_sloppy() code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoMove call16() functions from romlayout.S to inline assembler in stacks.c
Kevin O'Connor [Wed, 24 Sep 2014 21:48:28 +0000 (17:48 -0400)]
Move call16() functions from romlayout.S to inline assembler in stacks.c

Use inline assembler in call16 type functions instead of using
__call16() in romlayout.S.

Since call16() and call16big() are now only called with %ss==0 they do
not need to update the stack pointer.  Only call16_sloppy() requires
the stack manipulation code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agobuild: Support declaring 32bit C functions that must reside in the f-segment
Kevin O'Connor [Wed, 24 Sep 2014 19:58:12 +0000 (15:58 -0400)]
build: Support declaring 32bit C functions that must reside in the f-segment

Add support for a FUNCFSEG macro that will force a "32bit flat" C
function to be located in the f-segment.  This is useful for 32bit
code with inline assembler that thunks to 16bit mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoUpdate reset() to use call16_back()
Kevin O'Connor [Tue, 30 Sep 2014 04:17:44 +0000 (00:17 -0400)]
Update reset() to use call16_back()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoSimplify farcall16 code
Kevin O'Connor [Tue, 30 Sep 2014 04:11:38 +0000 (00:11 -0400)]
Simplify farcall16 code

With this change, farcall16() is only used for external API calls and
is only invoked from a 32bit mode entered directly via transition32.
farcall16big() is also only used for external API calls and is only
invoked from a 32bit mode entered directly via transition32.

call16_int() now calls _farcall16() directly, and it will use normal
16bit mode or big real mode as required.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoTrack when entering via call32() and use the same mode for stack_hop_back()
Kevin O'Connor [Tue, 30 Sep 2014 03:59:47 +0000 (23:59 -0400)]
Track when entering via call32() and use the same mode for stack_hop_back()

If 32bit mode is entered directly via transition32, then use a simple
call16() when hopping back to 16bit mode.  Use only call16big() during
post and when entering 32bit mode via call32().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoUpdate stack_hop_back() to jump to 16bit mode if called in 32bit mode.
Kevin O'Connor [Mon, 29 Sep 2014 23:39:31 +0000 (19:39 -0400)]
Update stack_hop_back() to jump to 16bit mode if called in 32bit mode.

Also, update callers to rely on this feature.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoUpdate invoke_mouse_handler() to use need_hop_back()
Kevin O'Connor [Mon, 29 Sep 2014 23:23:45 +0000 (19:23 -0400)]
Update invoke_mouse_handler() to use need_hop_back()

Make the mouse handler stack_hop_back() code similar to the other
users that use need_stack_hop().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoAdd need_hop_back() call that determines if stack_hop_back is needed
Kevin O'Connor [Mon, 29 Sep 2014 23:18:25 +0000 (19:18 -0400)]
Add need_hop_back() call that determines if stack_hop_back is needed

Also, use need_hop_back() instead of on_extra_stack() in code that
determines whether or not to call stack_hop_back().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoMove stack hop code below call32/call16 code in stacks.c
Kevin O'Connor [Mon, 29 Sep 2014 23:08:57 +0000 (19:08 -0400)]
Move stack hop code below call32/call16 code in stacks.c

This change is a just code movement.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agopmm: Fix entry point to support non-zero %ss
Kevin O'Connor [Tue, 30 Sep 2014 13:37:26 +0000 (09:37 -0400)]
pmm: Fix entry point to support non-zero %ss

If the pmm entry point was called with a non-zero stack segment, the
pointer to the arguments on the stack would not be valid once the
code transitioned to 32bit mode.  Fix by adding the stack segment
offset into the args pointer.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoRevert "Use the extra stack for 16bit USB and PS2 keyboard/mouse commands."
Kevin O'Connor [Tue, 30 Sep 2014 13:17:14 +0000 (09:17 -0400)]
Revert "Use the extra stack for 16bit USB and PS2 keyboard/mouse commands."

It's not valid to pass a pointer to a stack variable through the
stack_hop() call (because the call changes the stack segment).  This
bug was probably not noticed before because by default
(CONFIG_ENTRY_EXTRASTACK) SeaBIOS uses the extra stack on all 16bit
entry points, and the internal stack_hop() with that config option is
effectively a no-op.

This reverts commit d488a7683d90bf8fae7ceb8c3ad9e95fbbd92079.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoehci: Fix bug in hub port assignment
Kevin O'Connor [Fri, 12 Sep 2014 15:59:23 +0000 (11:59 -0400)]
ehci: Fix bug in hub port assignment

The usbdev->port field is zero indexed, while the USB spec expects the
port values to start at one.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agousb: Perform device detect polling on all usb controllers.
Kevin O'Connor [Wed, 10 Sep 2014 15:33:01 +0000 (11:33 -0400)]
usb: Perform device detect polling on all usb controllers.

Move the 100ms (USB_TIME_SIGATT) device detect polling from the
ohci/uhci/usb-hub code to the generic usb_hub_port_setup() code.  This
extends the 100ms polling to ehci and xhci controllers.  The code in
usb_hub_port_setup() now compares USB_TIME_SIGATT to the start of
usb_enumerate(), which may make boots faster when threads are
disabled.

This patch also changes the meaning of the return code for
hub->op->detect() calls.  Now 1 indicates device found, 0 indicates
device not found, and -1 indicates permanent failure.

Also, the xhci controller generic delay of 100ms is replaced with a
20ms root hub power stabilize time.  This in combination with the
100ms for USB_TIME_SIGATT should be closer to the USB2 spec (the USB3
spec does not seem to declare an equivalent of USB_TIME_SIGATT).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoehci: Stall uhci/ohci init only until default port routing is done.
Kevin O'Connor [Wed, 10 Sep 2014 15:04:26 +0000 (11:04 -0400)]
ehci: Stall uhci/ohci init only until default port routing is done.

Now that uhci and ohci will continually poll for a device connect, the
ehci controller only needs to ensure that the default routing is setup
properly before allowing uhci and ohci to be initialized.

This also fixes two error paths in configure_ehci() that were not
properly updating PendingEHCIPorts.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoohci: Repeatedly poll for device detect for 100ms.
Kevin O'Connor [Wed, 10 Sep 2014 14:37:52 +0000 (10:37 -0400)]
ohci: Repeatedly poll for device detect for 100ms.

According to the USB2 specification, a device may take up to 100ms
(USB_TIME_SIGATT) after port power stabilizes to be detected.  So,
continually recheck for a device connection event.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agouhci: Repeatedly poll for device detect for 100ms.
Kevin O'Connor [Wed, 10 Sep 2014 14:33:36 +0000 (10:33 -0400)]
uhci: Repeatedly poll for device detect for 100ms.

According to the USB2 specification, a device may take up to 100ms
(USB_TIME_SIGATT) after port power stabilizes to be detected.  So,
continually recheck for a device connection event.

Technically, the uhci root hub ports are always powered up, but it's
not possible to know how long the machine has been on, so it's better
to be safe here.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoxhci: Change xhci_hub_detect() to use connect status instead of link state.
Kevin O'Connor [Wed, 10 Sep 2014 14:24:04 +0000 (10:24 -0400)]
xhci: Change xhci_hub_detect() to use connect status instead of link state.

Use the connect status bit to determine if a device is connected
instead of the port link state state machine status.  This makes the
driver more similar to the other drivers and may help diagnose devices
that take longer to boot up.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agousb-hub: Enable power to all ports prior to calling usb_enumerate().
Kevin O'Connor [Wed, 10 Sep 2014 14:18:02 +0000 (10:18 -0400)]
usb-hub: Enable power to all ports prior to calling usb_enumerate().

Don't perform port power up in the detect code.  Instead do it prior
to calling usb_enumerate().  This makes the code more similar to the
usb root hub drivers.  It can also reduce the total boot time when
threads are disabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoehci: Move port power up from ehci_hub_detect() to check_ehci_ports().
Kevin O'Connor [Wed, 10 Sep 2014 14:02:20 +0000 (10:02 -0400)]
ehci: Move port power up from ehci_hub_detect() to check_ehci_ports().

Don't perform port power up in the detect code.  Instead do it prior
to calling usb_enumerate().  This makes the code more similar to the
ohci and xhci drivers.  It can also reduce the total boot time when
threads are disabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoxhci: Add xhci_check_ports() and xhci_free_pipes() functions.
Kevin O'Connor [Wed, 10 Sep 2014 13:10:42 +0000 (09:10 -0400)]
xhci: Add xhci_check_ports() and xhci_free_pipes() functions.

Add these two functions so that the xhci code is more similar to the
other USB controllers.  Also, store the temporary hub structure on the
stack instead of in struct usb_xhci_s.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoxhci: Move root hub and setup code to top of file.
Kevin O'Connor [Wed, 10 Sep 2014 12:51:50 +0000 (08:51 -0400)]
xhci: Move root hub and setup code to top of file.

Move the setup code to the top of the file so that like code is
together and to make the code layout more similar to the other usb
controllers.

This change is purely code movement.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoxhci: Use high memory instead of low memory for internal storage.
Kevin O'Connor [Wed, 10 Sep 2014 13:31:43 +0000 (09:31 -0400)]
xhci: Use high memory instead of low memory for internal storage.

Now that the driver runs exclusively in 32bit mode, avoid using the
scarce low memory resource.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoxhci: Remove 16bit code wrappers.
Kevin O'Connor [Wed, 10 Sep 2014 12:31:28 +0000 (08:31 -0400)]
xhci: Remove 16bit code wrappers.

The usb-xhci.c file is only compiled in 32bit mode now, so remove all
the 16bit macros.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoxhci: Call usb_desc2pipe() on xhci_update_pipe().
Kevin O'Connor [Tue, 9 Sep 2014 23:31:45 +0000 (19:31 -0400)]
xhci: Call usb_desc2pipe() on xhci_update_pipe().

Make sure to call usb_desc2pipe() when updating a pipe settings.  This
ensures that pipe->devaddr is properly updated.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agousb: Fix usb_xfer_time() to work when called in 16bit mode.
Kevin O'Connor [Tue, 9 Sep 2014 22:24:00 +0000 (18:24 -0400)]
usb: Fix usb_xfer_time() to work when called in 16bit mode.

Make sure to wrap accesses to the usb_pipe struct with GET_LOWFLAT so
that it works in 16bit mode.  This bug impacts both ehci and uhci usb
controllers (it should not impact ohci and xhci as those never call
the function in 16bit mode).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agobuild: Update kconfig to version in Linux 3.16.
Kevin O'Connor [Sun, 24 Aug 2014 02:06:21 +0000 (22:06 -0400)]
build: Update kconfig to version in Linux 3.16.

Update kconfig (from Linux v3.13) to the latest version (Linux v3.16).

This copies kconfig from Linux with only the changes necessary to work
with the SeaBIOS build (the equivalent of the earlier SeaBIOS 0da7bfdf
commit) and the changes necessary to always emit symbols (SeaBIOS
b623e7c5 commit).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoMinor - remove stray tab from src/fw/smm.c.
Kevin O'Connor [Sat, 23 Aug 2014 16:10:29 +0000 (12:10 -0400)]
Minor - remove stray tab from src/fw/smm.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoacpi: use specified macro instead of magic-number
zhanghailiang [Thu, 21 Aug 2014 09:23:40 +0000 (17:23 +0800)]
acpi: use specified macro instead of magic-number

Instead of magic numbers, use specified macros for FADT Fixed Feature Flags.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
10 years agoboot: Change ":rom%d" boot order rom instance to ":rom%x"
Kevin O'Connor [Fri, 15 Aug 2014 13:52:43 +0000 (09:52 -0400)]
boot: Change ":rom%d" boot order rom instance to ":rom%x"

Use hex numbers for the rom instance count in boot order open firmware
device naming.  The ":rom" suffix isn't part of a standard and it's
highly unlikely any rom would have 10 or more drives on it, but this
change makes the code more similar to the numbering of other boot
order devices.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
10 years agoboot: Fix boot order for SCSI target, lun > 9
Markus Armbruster [Fri, 15 Aug 2014 06:58:17 +0000 (08:58 +0200)]
boot: Fix boot order for SCSI target, lun > 9

We identify devices by their Open Firmware device paths.  The path
component for the logical unit on a bus is incorrect:
bootprio_find_scsi_device() and bootprio_find_usb() format target
(a.k.a. SCSI ID) and lun in decimal, while QEMU uses hexadecimal.
Bootorder list entries with target, lun > 9 aren't found (lucky case),
or attributed to the wrong logical unit (unlucky case).

The relevant spec[*] agrees with QEMU (and OVMF, for that matter).
Change %d to %x.

No actual impact on USB, because QEMU only uses LUN 0 there.

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1096560

[*] Open Firmware Recommended Practice: SCSI-3 Parallel Interface,
Version 1, Section 3.1 Physical Address Formats and Representations
http://www.openfirmware.org/1275/practice/spi/spi1_0.ps
IEEE Standard for Boot (Initialization Configuration) Firmware: Core
Requirements and Practices, IEEE Std 1275-1994, Annex E SCSI host
adapter package class, section E.2.1 Physical address formats and
representations

Signed-off-by: Markus Armbruster <armbru@redhat.com>
10 years agohw/pci: reserve IO and mem for pci express downstream ports with no devices attached
Marcel Apfelbaum [Mon, 23 Jun 2014 15:29:51 +0000 (18:29 +0300)]
hw/pci: reserve IO and mem for pci express downstream ports with no devices attached

Commit c6e298e1f12e0f4ca02b6da5e42919ae055f6830
    hw/pci: reserve IO and mem for pci-2-pci bridges with no devices attached

introduced support for hot-plugging devices behind pci-2-pci bridges.
Extend hotplug support also for pci express downstream ports.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agovgabios: Fix broken build resulting from e5749978.
Kevin O'Connor [Tue, 1 Jul 2014 13:50:04 +0000 (09:50 -0400)]
vgabios: Fix broken build resulting from e5749978.

The e5749978 commit added -fno-merge-constants to the compile flag.
That option changes the names of ".rodata" sections.  Update
vgalayout.lds.S so that the vgabios can continue to build.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoromlayout: Use "rep ; nop" not "rep nop".
Ian Campbell [Mon, 30 Jun 2014 13:10:02 +0000 (14:10 +0100)]
romlayout: Use "rep ; nop" not "rep nop".

Fixes:
  Compiling (16bit) out/romlayout.o
src/romlayout.S: Assembler messages:
src/romlayout.S:285: Error: expecting string instruction after `rep'
make: *** [out/romlayout.o] Error 1

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
10 years agoohci: Update usb command timeouts to use usb_xfer_time()
Kevin O'Connor [Sat, 14 Jun 2014 16:50:38 +0000 (12:50 -0400)]
ohci: Update usb command timeouts to use usb_xfer_time()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agouhci: Update usb command timeouts to use usb_xfer_time()
Kevin O'Connor [Sat, 14 Jun 2014 16:50:20 +0000 (12:50 -0400)]
uhci: Update usb command timeouts to use usb_xfer_time()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoehci: Update usb command timeouts to use usb_xfer_time()
Kevin O'Connor [Sat, 14 Jun 2014 16:48:35 +0000 (12:48 -0400)]
ehci: Update usb command timeouts to use usb_xfer_time()

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoxhci: Update the times for usb command timeouts.
Kevin O'Connor [Sat, 14 Jun 2014 16:25:17 +0000 (12:25 -0400)]
xhci: Update the times for usb command timeouts.

The xhci controller had a hardcoded 1 second timeout for both bulk and
control transfers.  The 1 second bulk timeout is too small for some
real devices.

Increase both times to 5.1 seconds - according to the USB spec, the
maximum time a command should take is 5 seconds.  However, have the
set_address command only wait for 150ms (spec says set_address should
take no more than 50ms).

Introduce usb_xfer_time() to calculate maximum command time.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agobuild: Minor - fix comments referring to old tools/ directory.
Kevin O'Connor [Wed, 11 Jun 2014 19:40:04 +0000 (15:40 -0400)]
build: Minor - fix comments referring to old tools/ directory.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agobuild: Get fixed address variables from 32bit compile pass (not 16bit)
Kevin O'Connor [Wed, 11 Jun 2014 18:00:21 +0000 (14:00 -0400)]
build: Get fixed address variables from 32bit compile pass (not 16bit)

Update the layoutrom.py build script so that fixed address sections
can come from the 32bit compiled C code.  Update the C code so that
all VAR16FIXED variables instead use the new VARFSEGFIXED which is
defined in 32bit mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agobuild: Only export needed fields in LayoutInfo in layoutrom.py.
Kevin O'Connor [Wed, 11 Jun 2014 17:39:02 +0000 (13:39 -0400)]
build: Only export needed fields in LayoutInfo in layoutrom.py.

A number of fields were exported from the layout info that weren't
used.  Don't bother exporting them.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agobuild: Use fileid instead of category to write sections in layoutrom.py.
Kevin O'Connor [Tue, 10 Jun 2014 21:59:53 +0000 (17:59 -0400)]
build: Use fileid instead of category to write sections in layoutrom.py.

The 'category' really determines the memory location while the
'fileid' determines which link stage the section is in.  So, use
'fileid' when writing the linker scripts.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agobuild: Keep segmented sections separate until final link step.
Kevin O'Connor [Sat, 7 Jun 2014 19:55:00 +0000 (15:55 -0400)]
build: Keep segmented sections separate until final link step.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agobuild: Rework getRelocs() to use a hash instead of categories in layoutrom.py
Kevin O'Connor [Wed, 11 Jun 2014 18:40:45 +0000 (14:40 -0400)]
build: Rework getRelocs() to use a hash instead of categories in layoutrom.py

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agobuild: Refactor findInit() function.
Kevin O'Connor [Tue, 10 Jun 2014 04:00:20 +0000 (00:00 -0400)]
build: Refactor findInit() function.

Push findInit() into main() and unify the category setting code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agobuild: Use customized entry point for each type of build.
Kevin O'Connor [Mon, 9 Jun 2014 18:37:23 +0000 (14:37 -0400)]
build: Use customized entry point for each type of build.

Set an appropriate elf entry point (entry_elf, entry_csm,
reset_vector) for each type of build (coreboot, csm, qemu).  Use that
entry point when determining which sections to keep.

Also, remove the '.export.' mechanism to keep a section in the final
binary - it is no longer used.

This allows the build to slightly reduce the overall size as entry_elf
is no longer needed on non-coreboot builds and entry_csm is no longer
needed on non-csm builds.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agobuild: Refactor layoutrom.py gc() function.
Kevin O'Connor [Mon, 9 Jun 2014 18:59:25 +0000 (14:59 -0400)]
build: Refactor layoutrom.py gc() function.

Eliminate the per-section 'keep' variable - the list of sections that
will be emitted is sufficient to track that state.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agobuild: Extract section visiting logic in layoutrom.py.
Kevin O'Connor [Mon, 9 Jun 2014 16:48:13 +0000 (12:48 -0400)]
build: Extract section visiting logic in layoutrom.py.

Extract out the logic that visits all reachable sections into new
function findReachable().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agobuild: Remove unused function getSectionsStart() from layoutrom.py.
Kevin O'Connor [Tue, 10 Jun 2014 06:01:56 +0000 (02:01 -0400)]
build: Remove unused function getSectionsStart() from layoutrom.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoAbstract reset call (and possible 16bit mode switch) into reset() function.
Kevin O'Connor [Fri, 6 Jun 2014 17:49:33 +0000 (13:49 -0400)]
Abstract reset call (and possible 16bit mode switch) into reset() function.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoRemove the TODO file.
Kevin O'Connor [Thu, 5 Jun 2014 17:51:49 +0000 (13:51 -0400)]
Remove the TODO file.

The TODO file hasn't been updated in years and the info in it is stale.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoMake sure handle_smi() and handle_smp() are compiled out if not enabled.
Kevin O'Connor [Thu, 5 Jun 2014 15:08:44 +0000 (11:08 -0400)]
Make sure handle_smi() and handle_smp() are compiled out if not enabled.

Add CONFIG_ checks around the handle_smi/handle_smp functions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agovgabios: Use .code16 not .code16gcc
David Woodhouse [Tue, 3 Jun 2014 16:28:58 +0000 (17:28 +0100)]
vgabios: Use .code16 not .code16gcc

There's no need to use .code16gcc where we are writing assembler code
explicitly. It only affects word-size-ambiguous instructions, and we
should just be explicit. And we are.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
10 years agoromlayout: Use .code16 not .code16gcc
David Woodhouse [Tue, 3 Jun 2014 16:28:49 +0000 (17:28 +0100)]
romlayout: Use .code16 not .code16gcc

There's no need to use .code16gcc where we are writing assembler code
explicitly. It only affects word-size-ambiguous instructions, and we
should just be explicit. And we are.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
10 years agobuild: use -m16 where available instead of asm(".code16gcc")
David Woodhouse [Tue, 3 Jun 2014 16:28:22 +0000 (17:28 +0100)]
build: use -m16 where available instead of asm(".code16gcc")

GCC 4.9 and clang 3.5 support the -m16 option on the command line which
supersedes the hackish ".code16gcc" assembler directive. Use it where
possible.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
10 years agobuild: Avoid absolute paths during "whole-program" compiling.
Kevin O'Connor [Tue, 3 Jun 2014 19:22:31 +0000 (15:22 -0400)]
build: Avoid absolute paths during "whole-program" compiling.

The build currently does a textual include of all files in order to
use the -fwhole-compile optimization.  Update it to use relative file
paths instead of absolute file paths.  This makes the section names in
the resulting binary more readable.  It also makes the build easier on
some Windows hosts.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoMove most of the VAR16FIXED() defs to misc.c.
Kevin O'Connor [Sat, 24 May 2014 14:40:35 +0000 (10:40 -0400)]
Move most of the VAR16FIXED() defs to misc.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoRemove old Bochs bios fixed address string at 0xfff00.
Kevin O'Connor [Sat, 24 May 2014 14:36:42 +0000 (10:36 -0400)]
Remove old Bochs bios fixed address string at 0xfff00.

There is no indication that the address 0xff00 is a BIOS standard, so
don't emit the old Bochs copyright string at that fixed address.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoDon't enable thread preemption during S3 resume vga option rom execution.
Kevin O'Connor [Sat, 24 May 2014 13:37:57 +0000 (09:37 -0400)]
Don't enable thread preemption during S3 resume vga option rom execution.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agosmp: Replace QEMU SMP init assembler code with C; run only in 32bit mode.
Kevin O'Connor [Sat, 24 May 2014 14:49:50 +0000 (10:49 -0400)]
smp: Replace QEMU SMP init assembler code with C; run only in 32bit mode.

Change the multi-processor init code to trampoline into 32bit mode on
each of the additional processors.  Implement an atomic lock so that
each processor performs its initialization serially.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agosmm: Use a C struct to define the layout of the SMM area.
Kevin O'Connor [Wed, 28 May 2014 17:33:50 +0000 (13:33 -0400)]
smm: Use a C struct to define the layout of the SMM area.

Describe the memory layout using a struct instead of hard coded
offsets.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agosmm: Replace SMI assembler code with C code.
Kevin O'Connor [Mon, 7 Apr 2014 23:49:12 +0000 (19:49 -0400)]
smm: Replace SMI assembler code with C code.

Convert the SMI handler from assembly to C.  This makes the handler
easier to understand and enhance.

The new handler will use references to the reserved memory at
0xf0000-0x100000.  If the physical memory in that range is modified at
runtime, then the SMI handler will cease to function properly (and may
allow unintended code to run in SMM mode).  However, that area is
marked as reserved and is normally made read-only at runtime, so there
is little risk in relying on it.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agosmm: unify SMM handlers
Paolo Bonzini [Thu, 15 May 2014 11:22:29 +0000 (13:22 +0200)]
smm: unify SMM handlers

The next patch will add shared code between the initial handler for
SMBASE relocation and the actual SMI handler.  Combine the code of
the two handlers for simplicity.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agosmm: complete SMM setup
Paolo Bonzini [Thu, 15 May 2014 11:22:28 +0000 (13:22 +0200)]
smm: complete SMM setup

SMI generation requires two bits to be set in PIIX4, one for APMC
interrupts specifically and a general one.

For Q35 it is the same, plus it is a good thing to lock SMIs after
enabling them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agopiix: add and use dev-piix.h
Paolo Bonzini [Thu, 15 May 2014 11:22:26 +0000 (13:22 +0200)]
piix: add and use dev-piix.h

Move all definitions for PIIX registers to a single header file,
like there is one already for Q35, and make the naming more
consistent.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoMove cdemu call interface and disk_ret helper code to disk.c.
Kevin O'Connor [Sat, 10 May 2014 19:51:40 +0000 (15:51 -0400)]
Move cdemu call interface and disk_ret helper code to disk.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agocdemu: store internal cdemu fields in standard "el-torito" spec format.
Kevin O'Connor [Sat, 10 May 2014 05:20:46 +0000 (01:20 -0400)]
cdemu: store internal cdemu fields in standard "el-torito" spec format.

Store the fields necessary to export the "el-torito" spec information
directly in an internal copy of the "el-torito" struct.  This
simplifies the interface and obviates the need for an internal home
grown struct with the same info.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoedd: Separate out ATA and virtio specific parts of fill_edd().
Kevin O'Connor [Sat, 10 May 2014 16:46:57 +0000 (12:46 -0400)]
edd: Separate out ATA and virtio specific parts of fill_edd().

This also changes DTYPE_VIRTIO_SCSI drives to report that they are
using a "SCSI" bus instead of an "ATA" bus - it was obviously
incorrect before.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoedd: Use sectors==-1 to detect removable media.
Kevin O'Connor [Sat, 10 May 2014 15:54:48 +0000 (11:54 -0400)]
edd: Use sectors==-1 to detect removable media.

Don't look for DTYPE_ATA_ATAPI to determine if a removable media (such
as a cdrom) is present, instead look for a -1 in the sector count.
This improves the results for cdroms on controllers other than ATA
ATAPI.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoedd: Move EDD get drive parameters (int 1348) logic from disk.c to block.c.
Kevin O'Connor [Sat, 10 May 2014 15:42:22 +0000 (11:42 -0400)]
edd: Move EDD get drive parameters (int 1348) logic from disk.c to block.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoUpdate EFI_COMPATIBILITY16_TABLE to match 0.98 spec update
David Woodhouse [Mon, 2 Jun 2014 13:00:14 +0000 (14:00 +0100)]
Update EFI_COMPATIBILITY16_TABLE to match 0.98 spec update

Unless CONFIG_MALLOC_UPPERMEMORY is turned off, we expect to use the
space between the top of option ROMs and the bottom of our own BIOS code
as a stack. OVMF was previously marking the whole region from 0xC0000 to
0xFFFFF read-only before invoking our Legacy16Boot method. Read-only
stack considered harmful.

Version 0.98 of the CSM spec adds the UmaAddress and UmaSize fields which
allow the CSM to specify a memory region that needs to be writeable, so
provide that information.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
10 years agovgabios: Return from handle_1011() if handler found.
Kevin O'Connor [Wed, 28 May 2014 13:09:05 +0000 (09:09 -0400)]
vgabios: Return from handle_1011() if handler found.

Fix cut-and-paste error in handle_1011() causing spurious debug_stub()
calls when CONFIG_VGA_STDVGA_PORTS is enabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agopython3 fixes for vgabios and csm builds. rel-1.7.5
Kevin O'Connor [Thu, 22 May 2014 20:59:16 +0000 (16:59 -0400)]
python3 fixes for vgabios and csm builds.

Avoid using chr() as this produces unicode strings on python3.  Make
sure to only use ord() on slices as the python3 bytearray type returns
an integer on a non-slice array access.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
10 years agoAllow using full io region on q35.
Gerd Hoffmann [Tue, 13 May 2014 12:09:00 +0000 (14:09 +0200)]
Allow using full io region on q35.

If qemu is new enough to support acpi table loading,
then go move pmbase out of the way.  This allows to
use the whole 0x1000 -> 0xffff io address space on q35.
piix has hotplug ports in the 0xa000 -> 0xafff area,
so we can't do the same there.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoacpi: remove PORT_ACPI_PM_BASE constant
Gerd Hoffmann [Tue, 13 May 2014 12:01:22 +0000 (14:01 +0200)]
acpi: remove PORT_ACPI_PM_BASE constant

Use the new acpi_pm_base variable instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agosmm: remove code to handle ACPI disable/enable
Paolo Bonzini [Thu, 15 May 2014 11:22:27 +0000 (13:22 +0200)]
smm: remove code to handle ACPI disable/enable

This is handled already in QEMU, no need to do it in SMM.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agovgabios: Add debug message if x86emu leal check triggers.
Kevin O'Connor [Mon, 12 May 2014 05:26:26 +0000 (01:26 -0400)]
vgabios: Add debug message if x86emu leal check triggers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoacpi: Fix acpi dsdt compile warning. rel-1.7.5-rc1
Kevin O'Connor [Fri, 9 May 2014 13:18:31 +0000 (09:18 -0400)]
acpi: Fix acpi dsdt compile warning.

The _EJ0 method should not return a value.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoFix int 1589 calls when CONFIG_ENTRY_EXTRASTACK is enabled.
Kevin O'Connor [Thu, 8 May 2014 22:32:32 +0000 (18:32 -0400)]
Fix int 1589 calls when CONFIG_ENTRY_EXTRASTACK is enabled.

The int 1589 call is entered in real mode and returns in protected
mode.  However, the code to use the "extra stack" does not support
that.  Fix this by never using the "extra stack" on int 1589 calls.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agobuild: Make sure romlayout.o is recompiled on Kconfig change.
Kevin O'Connor [Thu, 8 May 2014 22:24:17 +0000 (18:24 -0400)]
build: Make sure romlayout.o is recompiled on Kconfig change.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
11 years agoxhci: Use msleep() instead of mdelay() for port status delay.
Kevin O'Connor [Thu, 8 May 2014 21:59:55 +0000 (17:59 -0400)]
xhci: Use msleep() instead of mdelay() for port status delay.

Use msleep() so that interrupts and other threads can occur during the
delay.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>