From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH 2/4] acpi: add aml/asl parsing script Date: Wed, 21 Sep 2011 18:46:49 +0300 Message-ID: <20110921154649.GA20940@redhat.com> References: <408bb38ea26e509cbabc83df910e8fc804b2b7ec.1316608551.git.mst@redhat.com> <20110921142732.GU21417@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Amos Kong , "Kevin O'Connor" , seabios@seabios.org, kvm@vger.kernel.org, jasowang@redhat.com, alex williamson , Marcelo Tosatti To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:47912 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751267Ab1IUPpx (ORCPT ); Wed, 21 Sep 2011 11:45:53 -0400 Content-Disposition: inline In-Reply-To: <20110921142732.GU21417@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 > recompiled). 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.