Re: [coreboot] FYI: ACPI ASL 2.0
On Tue, Sep 20, 2016 at 1:02 PM Duncan Laurie 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. > > I agree. We don't want mixed. Maybe a comment at the top of the file if it is an ACPI2.0 format. > The problem with auto-converting sources with the disassembly/assembly > trick is you lose all the comments. > > I don't know how many changes there are and how much could be partial automated. We need to understand the scale of the work involved and have a plan to integrate the changes. > The problem with doing it by hand is it very easy to mess something up. > > But that *should* be easy to check. The disassembly should match before and after. Marc > -duncan > > > On Tue, Sep 20, 2016 at 11:39 AM, Marc Jones 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 >> 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@coreboot.org >>> https://www.coreboot.org/mailman/listinfo/coreboot >>> >> -- >> http://marcjonesconsulting.com >> >> -- >> coreboot mailing list: coreboot@coreboot.org >> https://www.coreboot.org/mailman/listinfo/coreboot >> > > -- http://marcjonesconsulting.com -- coreboot mailing list: coreboot@coreboot.org https://www.coreboot.org/mailman/listinfo/coreboot
Re: [coreboot] FYI: ACPI ASL 2.0
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 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 > 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 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 >>> 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@coreboot.org https://www.coreboot.org/mailman/listinfo/coreboot >>> -- >>> http://marcjonesconsulting.com >>> >>> -- >>> coreboot mailing list: coreboot@coreboot.org >>> https://www.coreboot.org/mailman/listinfo/
Re: [coreboot] FYI: ACPI ASL 2.0
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 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 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 >> 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@coreboot.org >>> https://www.coreboot.org/mailman/listinfo/coreboot >>> >> -- >> http://marcjonesconsulting.com >> >> -- >> coreboot mailing list: coreboot@coreboot.org >> https://www.coreboot.org/mailman/listinfo/coreboot >> > > -- > coreboot mailing list: coreboot@coreboot.org > https://www.coreboot.org/mailman/listinfo/coreboot -- coreboot mailing list: coreboot@coreboot.org https://www.coreboot.org/mailman/listinfo/coreboot
Re: [coreboot] FYI: ACPI ASL 2.0
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 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 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@coreboot.org >> https://www.coreboot.org/mailman/listinfo/coreboot >> > -- > http://marcjonesconsulting.com > > -- > coreboot mailing list: coreboot@coreboot.org > https://www.coreboot.org/mailman/listinfo/coreboot > -- coreboot mailing list: coreboot@coreboot.org https://www.coreboot.org/mailman/listinfo/coreboot
Re: [coreboot] FYI: ACPI ASL 2.0
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 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@coreboot.org > https://www.coreboot.org/mailman/listinfo/coreboot > -- http://marcjonesconsulting.com -- coreboot mailing list: coreboot@coreboot.org https://www.coreboot.org/mailman/listinfo/coreboot