[coreboot] FYI: ACPI ASL 2.0

ron minnich rminnich at gmail.com
Tue Sep 20 23:00:27 CEST 2016


I've even seen this done, or maybe I did it, I forget, but it's a one time
pass through something like cpp:
#define Store(src, dst) dst = src

to produce the final output.

repeat for all ops of interest. Then, if there is a switch to ASL to not
accept pre-asl-2.0 code you do a clean up stage as needed.
You only need the cpp hack once as you want to switch to the transformed
output.

Not pretty, but maybe ACPI is so simple that it  would work.

ron

On Tue, Sep 20, 2016 at 12:11 PM ron minnich <rminnich at gmail.com> wrote:

> It would be nice if there were a source to source transformation tool out
> there but failing that RPN to infix is pretty simple to automate.
>
> ron
>
> On Tue, Sep 20, 2016 at 12:03 PM Duncan Laurie <dlaurie at chromium.org>
> wrote:
>
>> So far I've been asking people in ACPI patches to not introduce ASL 2.0
>> syntax into existing ASL code as it can be confusing if the two are mixed.
>> So we should either convert everything or at least only use ASL 2.0 syntax
>> in new files.
>>
>> The problem with auto-converting sources with the disassembly/assembly
>> trick is you lose all the comments.
>>
>> The problem with doing it by hand is it very easy to mess something up.
>>
>> -duncan
>>
>>
>> On Tue, Sep 20, 2016 at 11:39 AM, Marc Jones <marcj303 at gmail.com> wrote:
>>
>>> Hi Rudolf,
>>>
>>> I'm for this change. I don't think it would be too invasive and should
>>> be easy to test with the compiler.
>>>
>>> Marc
>>>
>>>
>>> On Mon, Sep 19, 2016 at 2:49 PM Rudolf Marek <r.marek at assembler.cz>
>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> Just FYI [1], maybe you already know.
>>>>
>>>> There is an alternate syntax available for ACPI ASL sources.
>>>> It just converts Polish notation  of ASL to something less geeky like C
>>>> operators. It says that the tool to convert the sources is in
>>>> development (to
>>>> ratain comments). I think it would make ACPI more readable if coreboot
>>>> would
>>>> switch to ASL 2.0. Note that the change is only on syntax side! Latest
>>>> ACPICA
>>>> iasl already decompiles to this syntax by default!
>>>>
>>>> Example before:
>>>>
>>>>       Method (SRDY, 0, Serialized)
>>>>         {
>>>>                 Store (200, Local0)     // Timeout 200ms
>>>>                 While (Local0) {
>>>>                         If (And(HSTS, 0x40)) {          // IN_USE?
>>>>                                 Sleep(1)                // Wait 1ms
>>>>                                 Decrement(Local0)       // timeout--
>>>>                                 If (LEqual(Local0, 0)) {
>>>>                                         Return (1)
>>>>                                 }
>>>>                         } Else {
>>>>                                 Store (0, Local0)       // We're ready
>>>>                         }
>>>>                 }
>>>>
>>>>                 Store (4000, Local0)    // Timeout 200ms (50us * 4000)
>>>>                 While (Local0) {
>>>>                         If (And (HSTS, 0x01)) {         // Host Busy?
>>>>                                 Stall(50)               // Wait 50us
>>>>                                 Decrement(Local0)       // timeout--
>>>>                                 If (LEqual(Local0, 0)) {
>>>>                                         KILL()
>>>>                                 }
>>>>                         } Else {
>>>>                                 Return (0)              // Success
>>>>                         }
>>>>                 }
>>>>
>>>>                 Return (1)              // Failure
>>>>         }
>>>>
>>>>
>>>> After:
>>>>
>>>>         Method (SRDY, 0, Serialized)
>>>>         {
>>>>             Local0 = 0xC8
>>>>             While (Local0)
>>>>             {
>>>>                 If (HSTS & 0x40)
>>>>                 {
>>>>                     Sleep (0x01)
>>>>                     Local0--
>>>>                     If (Local0 == 0x00)
>>>>                     {
>>>>                         Return (0x01)
>>>>                     }
>>>>                 }
>>>>                 Else
>>>>                 {
>>>>                     Local0 = 0x00
>>>>                 }
>>>>             }
>>>>
>>>>             Local0 = 0x0FA0
>>>>             While (Local0)
>>>>             {
>>>>                 If (HSTS & 0x01)
>>>>                 {
>>>>                     Stall (0x32)
>>>>                     Local0--
>>>>                     If (Local0 == 0x00)
>>>>                     {
>>>>                         KILL ()
>>>>                     }
>>>>                 }
>>>>                 Else
>>>>                 {
>>>>                     Return (0x00)
>>>>                 }
>>>>             }
>>>>
>>>>             Return (0x01)
>>>>         }
>>>>
>>>>
>>>> Thanks
>>>> Rudolf
>>>>
>>>>
>>>> [1] https://acpica.org/sites/acpica/files/ASL2.0Overview.pdf
>>>>
>>>>
>>>> --
>>>> coreboot mailing list: coreboot at coreboot.org
>>>> https://www.coreboot.org/mailman/listinfo/coreboot
>>>>
>>> --
>>> http://marcjonesconsulting.com
>>>
>>> --
>>> coreboot mailing list: coreboot at coreboot.org
>>> https://www.coreboot.org/mailman/listinfo/coreboot
>>>
>>
>> --
>> coreboot mailing list: coreboot at coreboot.org
>> https://www.coreboot.org/mailman/listinfo/coreboot
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20160920/2a8616e4/attachment.html>


More information about the coreboot mailing list