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

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Don't enable thread preemption during S3 resume vga option rom execution.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
Move most of the VAR16FIXED() defs to misc.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Run all hard drive ops in 32 bit.

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