On Wed, Mar 25, 2020 at 10:35:50AM +0100, Gerd Hoffmann wrote:
Hi,
If you mean a DSDT parser then I suspect a full implementation in SeaBIOS would be too burdensome. However, it might be possible to introduce a minimal DSDT parser (eg, one that only supports extracting constants).
https://git.kraxel.org/cgit/seabios/commit/?h=dsdt&id=d7cdf49ec624f42fa6...
~500 lines of code.
Nice.
Could we just parse the static device tree into a local data structure though? Something like:
struct hlist_head DSDTTree;
struct dsdt_entry { struct hlist_node node; char *name; // eg, "_SB.PCI0.ISA.COM1._HID" int type; // eg: Device, Name, Integer, String, ResourceTemplate, other void *value; // points to integer, string, resource template, or NULL };
Once the tree is parsed, it should be simple to walk the in-memory linked-list to find desired values later.
If we have this _anyway_ we might use it to figure whenever specific (isa) hardware is present, keyboard for example. We need to fix qemu to not use _STA methods for no good reason, like this one ...
Device (KBD) { Name (_HID, EisaId ("PNP0303") Method (_STA, 0, NotSerialized) { Return (0x0F) }
... so it can be checked without a full-blown acpi interpreter.
FWIW, it should not be difficult to detect the simple case above and treat it as simple integer locally. As before, it does raise the question of how far one would want to go down that path though.
Cheers, -Kevin