-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iASL and ACPICA aren't able to share the same grammar rules #122
Comments
Unfortunately, this error is caught by the main parser, which is generated by Bison/Yacc -- and this means that such errors are not (easily) recoverable. Also, it isn't clear how AML interpreters would handle this code. That being said, we will take another look at the issue. |
"module-level code" is in fact allowed as long as the code is in fact at module level. This was put back into the ACPI spec at some point. Lots of DSDTs use this construct to selectively add things to the namespace based upon BIOS configuration data. |
Soo...
Because I mean, in the first case my request would still stand and all.. I posted the full dsdt here anyway, if knowing the aforementioned code block is under Device (PCI0) which is "inside" Scope (_SB) can help. |
We've been making this working for interpreter and succeeded in this series: But for compiler, we don't support it, currently we can use Include to generate such kind of table with iasl. |
With iasl, I now generate the table in this way: You can try it and test the generated table with Windows. Thanks and best regards |
The module-level execution is supported in the way mentioned by you: Thanks and best regards |
So I don't think the issue is an ACPICA only issue, ACPICA only plays a part of the ACPI functionality in an operating system. IMO, Both the host (the user) and ACPICA have the responsibility to have this solved by sitting together and dicussing constructively. If the hosts side issues are not solved in the correct way, ACPICA may have to work in a wrong way. |
IMO, it is a real bug. Thanks and best regards |
Let me clarify things a bit.
|
Wait.. I guess you guys should first agree on the whether this code is legal or not.. :s One's link basically mimics that, then another claims it's wrong. I decompiled the code with -e switch and its two ssdt tables for the records, there shouldn't have been anything "to guess". |
The key to the workaround is this: "move this code out from under the Device() definition and up to the top level of the definition block:" i.e., move the code all the way up to the top level. Then, the code will always be executed, at table load time. Even -e doesn't always work because of dynamic declarations of objects and dynamic loading of tables (SSDTs). But it often does work. Yes, the legality of the code is a large issue because it involves the ACPI spec and the grammar of the ASL language. |
Yes, but wouldn't this result in a lot more stuff depending on the conditional statement?
What about this then? |
I don't have time to read through this today, but:
That being said, we will address your concerns, but it may take a bit of time. |
Ook, got it. |
First, non named object definition opcodes directly put at the table level are legal by the spec.
The grammar in spec (since 2.0) is:
While this is not supported by ACPICA - this is the TermList bug I'm fixing. For the following ASL, it is illegal by spec because spec uses ObjectList instead of TermList:
And
The grammar in spec is:
For ObjectList -> TermList grammar change, this is just a natural consequence of the changed behavior of the table parsing. And in fact, the changed behavior doesn't only affect table parsing, but affect method parsing. So IMO, this is a different topic. And since the grammar definition in spec is ObjectList, I think this probably is a spec bug. Because:
We have filed an ECR for ASWG to correct the spec bug as Windows doesn't parse these terms (DeviceTerm/ScopeTerm and etc.,) using ObjectList, instead it parses them using TermList. So IMO, we are talking about 2 different things:
Please don't confuse them. Thanks and best regards |
Cool!
(Then I'd hope the Of course, again, I used |
Please send the original binary DSDT, thanks. From: mirh [mailto:notifications@github.com] Cool!
Error 6126 - syntax error, unexpected '}' ^
Error 6126 - syntax error, unexpected '}' ^ (Then I'd hope the unexpected $end and premature End-Of-File error has something to do with this other ones messing up with parenthesis) Of course, again, I used -e switch (otherwise the resulting dsl table has way more errors with -tc). — |
I can't get to this link, please email it to me directly |
Sent. |
Thanks, I've been able to reproduce the problem. There are two of these (invalid) statements that are causing the problem:
It is a disassembly problem, I think -- we need to investigate further. |
It is in fact a problem with the disassembly of the _PLD statements, there is a rather odd case in the AML where the _PLD buffer is defined to be 16 bytes in the AML, but the actual number of bytes in the buffer is only 4. On another subject, this DSDT has a whole bunch of problems, as below: c:\0acpi-bugs\pld-disasm>iasl -f -ve dsdt.dsl Intel ACPI Component Architecture Ignoring all errors, forcing AML file generation dsdt.dsl 1532: 0xFDFC0000, // Length dsdt.dsl 5675: (CTRL & 0x1E) dsdt.dsl 8565: Name (_HID, "PnP0C14") // _HID: Hardware ID dsdt.dsl 9132: ((QDEV (0x02) << 0x02) + Local0) dsdt.dsl 9133: ((QDEV (0x04) << 0x04) + Local0) dsdt.dsl 9134: ((QDEV (0x08) << 0x06) + Local0) dsdt.dsl 10045: (0x02 | Local1) dsdt.dsl 10050: (One | Local1) dsdt.dsl 10055: (0x04 | Local1) dsdt.dsl 10060: (0x08 | Local1) dsdt.dsl 10065: (0x10 | Local1) dsdt.dsl 10077: (0x02 | Local1) dsdt.dsl 10082: (One | Local1) dsdt.dsl 10087: (0x04 | Local1) dsdt.dsl 10092: (0x08 | Local1) dsdt.dsl 10097: (0x10 | Local1) dsdt.dsl 10959: (0x0F & ODDM) dsdt.dsl 11579: Name (_PLD, Buffer (0x10) // _PLD: Physical Location of Device dsdt.dsl 11602: Name (_PLD, Buffer (0x10) // _PLD: Physical Location of Device ASL Input: dsdt.dsl - 11878 lines, 376850 bytes, 5634 keywords Compilation complete. 19 Errors, 25 Warnings, 141 Remarks, 86 Optimizations, 6 Constants Folded |
I got no such errors with the dsl table decompiled with |
What version of the compiler? |
If you got the 2 syntax errors as above, the compiler has aborted before performing a full analysis. |
Last one ofc.
Oh.. Then all the previous errors were just hiding these ones? |
Yes, the 2 previous syntax errors were hiding the other 19 semantic errors. |
You can comment out the 2 copies of this line in the .dsl file, and see what happens when you compile:
|
Nah, I have no hurry. |
At least forward references for ML code have yet to land in linux (where I can test them - though they should in a month) |
Ok, forward references didn't make my day. |
Can you describe the issue in more detail? |
Well, the whole thing started with me noticing (when trying to recompile my DSDT) that some errors were really too strange, for even a blindfolded monkey to have written them. Now, my original example has been patched with the landing of MLC (and _PLD fix), but after discussing here I was getting the impression a tide of changes was coming (very likely to influence the issue) p.s. 4e78ce6 changed RESULT_NOT_USED in errors but grammar.asl still reports old behavior (possibly of more functions too) |
I'm still not entirely sure what you mean by "iASL and ACPICA aren't able to share the same grammar rules", but I'll take another shot at it. Yes, the behavior of iASL versus ACPICA core is in fact different. Many, if not most, of these differences can be directly traced back to the fact that the ACPICA runtime (interpreter, etc.) must be compatible with "other ACPI implementations". However, the iASL compiler has no such restrictions, and we try to have iASL be as tight as possible in catching things that are actually incorrect. The fact is that ACPICA runtime allows AML code to execute that the iASL compiler would flag as an error. |
Yes, I know about the iASL and ACPICA different "purposes" My assumption was that even #189 might have had something to do with this, but I guess you shouldn't/won't need this bug to remember that. |
Yes, the ACPI spec has been updated for the new grammar that supports module-level code underneath things like Devices, etc. I don't know what the exact status of this whole issue is, so I'll have to let Lv respond. What is the exact issue you are seeing with "grammar.asl"? |
This has been completed and released. No changes to the test suite were required. |
I'm not even sure what those files are meant to represent, but I wanted to report information under
I see no trace in current master of this. |
The changes for forward references from package objects has been completed and released. |
Here's the info from our release notes: 28 July 2017. Summary of changes for version 20170728: AML interpreter: Implemented a new feature that allows forward references
*/ |
|
How does windows evaluate this? |
Ehrm.. I fear acpi debugging in windows (given acpica tools are to no avail and I have to use microsoft ones, right?) is a mess that will require me a day to gather the right OS debug builds. |
We tried invoking the following on windows and it returned an error status.
CondRefOf stores a reference to Local4 and the |= expression results in an error because or operations on references are not allowed. It is likely that this is a mistake and the CondRefOf needs to be fixed to something like this:
|
Oh.. I see. Without further ado then, I guess thanks and see you next time. |
It's a firmware issue that is revealed by the Linux driver |
iasl version 20200110 still has issue with:
|
You want to encapsulate the ToPLD macro in a package like so:
|
Thanks already did it, but I thought it was fixed. |
Oh, sorry about the previous message. I wasn't reading enough. Are you using the same acpidump/acpi firmware? |
Sorry same as what? |
As mine. |
No I was referring to this:
I don't think the bug was resolved that is why I replied |
I see. Do you have firmware that exhibits this behavior? or is @mirh's the only one that we know of? |
Yes I do.
|
Archive.zip |
This indeed fixes the issue: |
I utterly see iasl is meant to be an high quality aml compiler fully complaint with latest ACPI spec, but this would help immensely when it comes to fixing bad DSDT tables.
In particular the code I had my hands on at the moment was:
Fairly, I'm alerted there's an unexpected PARSEOP_IF.. It's an opcode outside of a method after all.
But for as much as I racked my brain I couldn't come up with a rationale of what ever this had been supposed to serve (nor why none of my storage devices hadn't already mishbehaved). I mean, I can't see a way any person, even drunk, could have put something that blatantly amiss there.
Then I found 80d7951, 66e20c8 and so on (btw, thanks for fixing that pesky AE_NOT_FOUND problem).
For as much that code was now illegal, it may still have had its sense once upon a time (and in Windows..)
And I (with no damn docs or datasheet) wouldn't really be able to imagine a consistent substitute, if even possible at all.
So I hoped some kind of "unwarranted within ACPI specs but valid within ACPI Component Architecture" swtich could be added to the project own compiler.
Thanks for your time.
EDIT: Wtf? Is module-level executable code now legitly allowed?
The text was updated successfully, but these errors were encountered: