[coreboot] FYI: ACPI ASL 2.0

Rudolf Marek r.marek at assembler.cz
Mon Sep 19 22:48:39 CEST 2016


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




More information about the coreboot mailing list