Minor - explicitly close files in buildrom.py.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Minor - move "tracked memory alloc" code in pmm.c.

Move the "pmm_malloc" code closer to the low level alloc functions it
calls.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Introduce and convert pmm code to use standard list helpers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Minor - relocate code in stacks.c to keep low-level thread code together.

Just code movement - no actual code changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Introduce helper function have_threads() in stacks.c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Convert stacks.c to use standard list manipulation code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Convert boot.c to use standard list manipulation code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Convert pciinit.c to use standard list manipulation code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Convert PCIDevices list to use standard list manipultion code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
config: allow DEBUG_IO for !QEMU

Make DEBUG_IO depend on QEMU_HARDWARE instead of QEMU, so
it can be enabled for seabios builds running indirectly
(coreboot, csm) on qemu.

Add runtime check for PF_QEMU to debug port console to make
sure we don't poke on random ports on physical hardware.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
coreboot: add qemu detection
Revert "Convert pciinit.c to use standard list manipulation code."

This reverts commit aab42152881dc62b37f1833e79cbdb3dfa51603b.
Fix error in hlist_for_each_entry_safe macro.

Fix broken macro - it did not work correctly at all.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Convert pciinit.c to use standard list manipulation code.

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

I have patches for coreboot in the queue adding q35 support there,
which will change the mainboard names (adding the detected chipset).
Make SeaBIOS check the mainboard name starts with "QEMU" instead of
doing a full string match to handle this.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
make qemu_cfg_init depend on QEMU_HARDWARE instead of QEMU

Gets qemu features like direct kernel boot and boot
ordering going when seabios runs on coreboot.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Another fix for hlist_for_each_entry_safe.

Although the previous patch does fix hlist_for_each_entry_safe for the
common case, it doesn't work correctly when deleting the current
node.  To fix this, introduce two macros - hlist_for_each_entry_safe
for iterating through a list that can be modified, and
hlist_for_each_entry_pprev for those users that only need access to
the "pprev" pointer.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Minor - remove debugging dprintf added to pciinit.c.

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

This allows to extract the beginning, end and name of a Device object.

Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>
Add SSDT memory device support

Define SSDT hotplug-able memory devices in _SB namespace. The dynamically
generated SSDT includes per memory device hotplug methods. These methods
just call methods defined in the DSDT. Also dynamically generate a MTFY
method and a MEON array of the online/available memory devices.  ACPI
extraction macros are used to place the AML code in variables later used by
src/acpi. The design is taken from SSDT cpu generation.

Signed-off-by: Vasilis Liaskovitis <vasilis.liaskovitis@profitbricks.com>