SMBIOS: Check for aggregate tables & entry point in fw_cfg

Check fw_cfg for the presence of an aggregate set of smbios
tables (etc/smbios/smbios-tables) and an entry point structure
(etc/smbios/smbios-anchor), and, if found, use them instead of
generating entries locally.

We ensure the presence of a type 0 (bios information) structure
by generating it locally if necessary, which is expected to be
the common case.

Signed-off-by: Gabriel L. Somlo <somlo@cmu.edu>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
If an int 1587 call is made from an option rom, stay in bigreal mode.

Modify the int 1587 handler to check if the POST phase is still
running.  If it is, use bigreal mode segment limits so that the caller
remains in bigreal mode when the 1587 handler completes.  This helps
with SeaVGABIOS' use of "direct" framebuffer accesses (an option rom
may attempt to display text during its option rom execution which can
cause SeaVGABIOS to make the int 1587 calls).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
ld: don't hardcode "-melf_i386"

On FreeBSD, the name of the emulation is "-melf_i386_fbsd", so allow
SeaBIOS to fetch the emulation to use from the environment variables.

This allows SeaBIOS to compile on FreeBSD with gcc.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
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>
build: Make sure romlayout.o is recompiled on Kconfig change.

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

The _EJ0 method should not return a value.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
vgabios: Add debug message if x86emu leal check triggers.

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

Use the new acpi_pm_base variable instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
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>
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>
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>
edd: Move EDD get drive parameters (int 1348) logic from disk.c to block.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
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>
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>
Move cdemu call interface and disk_ret helper code to disk.c.

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