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>
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>
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>
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>
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>
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>
Minor - remove stray tab from src/fw/smm.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>