[SeaBIOS] [PATCH 2/4] acpi: add aml/asl parsing script
Michael S. Tsirkin
mst at redhat.com
Wed Sep 21 17:46:49 CEST 2011
On Wed, Sep 21, 2011 at 05:27:32PM +0300, Gleb Natapov wrote:
> On Wed, Sep 21, 2011 at 03:44:29PM +0300, Michael S. Tsirkin wrote:
> > script ./src/find_ej0.pl finds all instances of
> > method named EJ0_ and the matching _ADR information,
> > and outputs the AML offset and slot mask of each.
> There is tools/ directory for such kind of scripts. Most (if not all) of
> scripts there are in python though.
OK, rewriting that in python should be easy.
I'll wait a bit for more comments on the design though.
> Perl should die painful death.
> This approach delivers nice result, but since the script does not really
> decodes AML, but tries to match ASL source code with regular expressions,
> it introduces some assumptions to the code that make DSDT code less
> hackable. I'll hate to be the one who will have to change PCI device
> definitions in DSDT next time.
There are three requirements now:
1. don't use the name EJ0_ anywhere if you don't want it patches
2. _ADR must be an integer constant
3. put _ADR name immediately before EJ0_ method
I tried to make it easy to obey these rules
by adding comments in source code.
I don't believe a generic mechanism that does not place
any restrictions on language use is possible without adding an
AML interpreter in bios.
> Generally speaking finding an offset of some scope in AML is useful not
> only for PCI hotplug. For instance we want to make S3/S4 capability
> configurable by a command line switch, but this also requires DSDT
> patching and having automatic way to find _S3_/_S4_ offset is required
> for that too (we do not what to find it by hand each time DSDT is
Right. So that would be an easy extension.
We could also add some directives for the tool
(e.g. in C comments) so that you can e.g. find more names
just by adding such a directive in dsl.
I'll be happy to work on that preferably
after we merge a simple version of the tool first.
More information about the SeaBIOS