Skip to content
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

AML: Handle NullName in NameString #196

Open
alnyan opened this issue Sep 2, 2023 · 4 comments
Open

AML: Handle NullName in NameString #196

alnyan opened this issue Sep 2, 2023 · 4 comments

Comments

@alnyan
Copy link
Contributor

alnyan commented Sep 2, 2023

ACPI 6.2, section 20.2.2 defines NameString as follows:

NameString := <RootChar NamePath> | <PrefixPath NamePath>
PrefixPath := Nothing | <'^' PrefixPath>
NamePath := NameSeg | DualNamePath | MultiNamePath | NullName 

In the name_string() parser, there currently is a check for an empty NamePath throwing an error if the length of the path parsed by name_path() is zero, which prevents the parser from handling NullNames properly.

@alnyan
Copy link
Contributor Author

alnyan commented Sep 2, 2023

I'm not fully sure, but it seems that null names just represent the root scope path

@alnyan
Copy link
Contributor Author

alnyan commented Sep 2, 2023

The problem seems to be caused by a quirk in an real device (Thinkpad E14 Gen2 SSDT3) AML and is not a part of any actual SuperName, decompiled AML shows the following:

DefinitionBlock ("", "SSDT", 1, "LENOVO", "STD3", 0x00000001)
{
    // ...

    Scope (\_SB)
    {
        Name (D0S0, 0x01)
        Name (D3S0, 0x01)
        Name (D0S1, 0x01)
        Name (D3S1, 0x01)
        Name (STDS, Zero)
        Zero

        PowerResource (P0S0, 0x00, 0x0000) 
        {
            // ...
        }

        // ...
    }

    // ...
}

As it turned out, there was a weird ZeroOp inside the _SB scope, which the parser tried to interpret as some kind of name. Adding a ZeroOp handler at the start of named_obj()'s choice! macro resolves the issue, though I'm not quite sure this is the correct fix to that, as the ACPI specification doesn't say anything about ZeroOps appearing as NamedObjs.

UPD: The same weird op is also present in the decompiled AML of the same thinkpad's SSDT11 (this time it's a OneOp):

DefinitionBlock ("", "SSDT", 1, "LENOVO", "TP-R1A  ", 0x00000001)
{
    // ...
    Name (M278, 0x01)
    Name (M279, 0x01)
    Name (M27A, 0x01)
    Name (APGE, Zero)
    One
    Name (ACGE, 0x01)
    // ...
}

@konradybcio
Copy link

FWIW it looks like such weird ZeroOps are present in all Qualcomm ACPI tables.. See https://github.com/aarch64-laptops/build/blob/master/misc/microsoft-devkit-2023/DSDT.dsl for an example (there's a .dat (.aml) in that directory too)

@konradybcio
Copy link

iasl unceremoniously errors out when trying to parse these, I was told ms asl consumes them fine.. which is supposedly what the aforementioned tables are compiled with

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants