Hi

Except the DSDT most ACPI tables are generated at runtime in coreboot.
For some tables runtime generation is actually desirable like SSDT.
For other tables a lot of the data is known at buildtime, which makes it possible to create them at buildtime and simply load them into memory at runtime.
Having the tables generated at runtime makes them hard to debug and inspect or even validate.

A few examples:
- MCFG: everything is known at buildtime
- FADT: only pointers to DSDT and FACS need updating. The rest is typically known at buildtime.
- MADT: Currently all LAPICs are generated in SSDT and in MADT. Maybe this could be changed to swapping the enabled 'bits' at runtime but having the table there at buildtime? This could avoid the complicated code to deal with SMP threads sorting and Intels hybrid infrastructure that currently happens at runtime.
- TMP log tables: only the pointer to the table needs updating.

What do you think about creating a userspace program that takes most of the ramstage sources, mocks a few functions, creates some meaningful data input values to make it usable/executable in userspace and runs the ACPI generation code with it and outputs it into a file or even multiple files? Then the coreboot ramstage could just load those tables from cbfs instead of generating them.

Some thoughts:
- It could mean more maintenance as you likely want to keep both runtime and buildtime options available for most tables.
- code size is reduced (good) in favor of larger data. I am not sure what the overall impact is on the boot medium footprint.
- Having a way to generate tables at buildtime makes writing ACPI code easier. You don't need to run it on actual hardware to develop them, even if the end goal is to eventually generate things at runtime.

Let me know what you think.

Arthur