Skip to content

AML: Allow Field in ToInteger (rebased) #213

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

Merged
merged 1 commit into from
Apr 13, 2024

Conversation

rw-vanc
Copy link
Contributor

@rw-vanc rw-vanc commented Apr 7, 2024

This PR replaces #209 - it is just a rebase, but I wanted to do it cleanly.

On my HP Laptop, Field is used as argument to ToInteger, even though the spec says it is not an option.

This is the declaration of VDID.

            OperationRegion (RPXX, SystemMemory, GMIO (^_ADR, _ADR), 0x10)

   1737E: 5B 80 52 50 58 58 00 47 4D 49 4F 5E 5F 41 44 52  // [.RPXX.GMIO^_ADR
   1738E: 5F 41 44 52 0A 10                                // _ADR..

            Field (RPXX, AnyAcc, NoLock, Preserve)
            {
                VDID,   32
            }


   17394: 5B 81 0B 52 50 58 58 00 56 44 49 44 20           // [..RPXX.VDID 

Here is where VDID is used in a Switch statement, causing the parser error.

            Method (WIST, 0, Serialized)
            {

   173CD: 14 4A 14 57 49 53 54 08                          // .J.WIST.


   173D5: 08 5F 54 5F 30 00                                // ._T_0.

                If (CondRefOf (VDID))
                {

   173DB: A0 48 13 5B 12 56 44 49 44 00                    // .H.[.VDID.

                    Switch (ToInteger (VDID))
                    {

   173E5: A2 4E 12 01 70 99 56 44 49 44 00 5F 54 5F 30     // .N..p.VDID._T_0

                        Case (0x095A8086)
                        {

   173F4: A0 0D 93 5F 54 5F 30 0C 86 80 5A 09              // ..._T_0...Z.

                            Return (One)
                        }

@rw-vanc
Copy link
Contributor Author

rw-vanc commented Apr 7, 2024

I closed #209 - please refer to the comments there.

@IsaacWoods
Copy link
Member

Apologies for the delay in getting back to you.

I'm still wondering a little if this is just weird AML on their part or if we're missing some kind of implicit field conversion that I haven't come across yet, but since this is needed for parsing real tables I'm happy to merge.

Thanks!

@IsaacWoods IsaacWoods merged commit 4390f04 into rust-osdev:main Apr 13, 2024
4 checks passed
fslongjin added a commit to DragonOS-Community/acpi-rs that referenced this pull request Sep 3, 2024
* fix: increment `processor_count` if LocalX2Apic is found

Signed-off-by: Yuuki Takano <ytakanoster@gmail.com>

* fix: increment `local_nmi_line_count` if X1ApicNmi is found

Signed-off-by: Yuuki Takano <ytakanoster@gmail.com>

* Add `Debug` impl for `PhysicalMapping` even when `T` is not `Debug`

* Make `read_field` and friends take a mutable context

This is necessary because these methods will need to invoke methods in
the future.

Co-authored-by: Ron Williams <ron.williams.redox@gmail.com>

* Invoke `_SEG`, `_BBN`, and `_ADR` as methods for PCI region accesses

Co-authored-by: Ron Williams <ron.williams.redox@gmail.com>

* Move the `aml` crate to the 2021 Edition

Easy change while we're here

* Create `OpRegion` type to abstract away field manipulation

Lots of the field reading/writing behaviour isn't quite correct yet, but
this was getting unwieldly and spread about multiple places. Creating this
abstraction will hopefully help in future.

* Simplify `DefIncrement` and `DefDecrement` borrow checking

For some reason, this *definitely* required an extra scope before, but
doesn't seem to now...

* Add test for `DefIncrement` and `DefDecrement`

* Fix test utils

* Add `SdtHeaderIterator` to get all headers.

* fix comments

* aml: add extra debug info on parsing error

* AML: implement boolean field (rust-osdev#211)

* AML: Allow Field in ToInteger (rebased) (rust-osdev#213)

* acpi: add support for SPCR table (rust-osdev#216)

Add support for the Serial Port Console Redirection (SPCR). The table
provides information about the configuration and use of the serial
port or non-legacy UART interface.

* Add a function to find and maps the entire table. (#2)

---------

Signed-off-by: Yuuki Takano <ytakanoster@gmail.com>
Co-authored-by: Yuuki Takano <ytakanoster@gmail.com>
Co-authored-by: Caleb Robson <94545082+Spartan2909@users.noreply.github.com>
Co-authored-by: Isaac Woods <isaacwoods.home@gmail.com>
Co-authored-by: Ron Williams <ron.williams.redox@gmail.com>
Co-authored-by: rw-vanc <123669882+rw-vanc@users.noreply.github.com>
Co-authored-by: Carlos López <00xc@protonmail.com>
IsaacWoods pushed a commit to IsaacWoods/acpi that referenced this pull request Jan 30, 2025
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

Successfully merging this pull request may close these issues.

2 participants