biostables: support looking up RSDP

Will be used when it's loaded from QEMU.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
romfile_loader: utility to patch in-memory ROM files

Add ability for a ROM file to point to
it's image in memory. When file is in memory,
add utility that can patch it, storing
pointers to one file within another file.

This is not a lot of code: together with the follow-up patch to load
ACPI tables from ROM, it's about 1K extra.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
acpi: load and link tables through romfile loader

Load files through romfile loader and use for acpi tables.
We need the RSDP pointer to hang the rest of the tables off it,
to detect that we simply scan all memory in FSEG.

Add an option to disable this feature (useful for old QEMU versions).
This saves about 1Kbytes.

enabled:
Total size: 134932  Fixed: 61571  Free: 127212 (used 51.5% of 256KiB rom)

disabled:
Total size: 133836  Fixed: 61563  Free: 128308 (used 51.1% of 256KiB rom)

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Add qemu_cfg_e820 function.

Move all ram detection and e820 setup to the new function, except for
lowmem detection which must remain in preinit so we can initialize our
memory allocator properly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Add support for etc/e820 fw_cfg file

The new fw_cfg is simliar to the QEMU_CFG_E820_TABLE entry,
but carries both reservations and RAM regions, so we can use
it instead of the cmos for RAM detection.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
acpi: strip compiler info in built-in DSDT if any

IASL stores it's revision in each table header it generates.
That's a problem since guests see a change each time
they move between hypervisors.
We generally fill our own info for tables,
but we forgot to do this for the built-in DSDT.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Move low-level hardware writing from output.c to new file hw/serialio.c.

Avoid hardware specific code in output.c.  This will reduce the amount
of change needed to output.c as support for more serial hardware is
added.

This patch also renames some functions to improve the naming scheme.

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