OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Nov 21, 2018 9:51 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Inconsistency between AML and specification:Unexpected types
PostPosted: Sat Sep 15, 2018 4:26 pm 
Offline

Joined: Thu Jun 16, 2016 6:03 am
Posts: 10
One of my computers, an Ideapad 15IKB-80TV, has a DSDT that seems to contain ACPI object types in structures that should contain other types.

Small excerpt from it's DSDT (disassembled with official iasl):
Code:
Device(PCI0)
{
    Name(...)
    Name(...)
    Method(...)
    ....
}
...
If ((ECR1 == One))
// Encoded as: A0 40 07 93 45 43 52 31 01
// Which translates to: If PkgLen(0x70) LEqual "ECR1" 1

So here we have a Method where I was expecting an Object.
Also, what looks like a NameSeg in a NamePath in a NameString, where I was expecting a TermArg.
From the ACPI specification 5.0A section 20 :
Code:
// 20.2.3 Data Objects Encoding
DataRefObject := DataObject | ObjectReference | DDBHandle
// 20.2.5 Term Objects Encoding
ObjectList           := Nothing | <Object ObjectList>
Object               := NameSpaceModifierObj | NamedObj
// 20.2.5.1 Namespace Modifier Objects Encoding
NameSpaceModifierObj := DefAlias | DefName | DefScope
// 20.2.5.2 Named Objects Encoding
NamedObj        := DefBankField | DefCreateBitField | DefCreateByteField | DefCreateDWordField |
                   DefCreateField | DefCreateQWordField |DefCreateWordField | DefDataRegion |
                   DefOpRegion | DefPowerRes | DefProcessor | DefThermalZone
DefDevice := DeviceOp PkgLength NameString ObjectList
// 20.2.5.3 Type 1 Opcodes Encoding
DDBHandleObject := SuperName

Nowhere there is a possibility for a DefMethod. In fact DefMethod is not part of any rule other than it's definition in section 20.2.5.2 (there are others structures that are defined but never used).
Since DefMethod is defined in a section entitled "Named Object", I assumed that it was a possible variant of NamedObj.
However, as I found more and more unexpected structs, I started to wonder if either Lenovo made a really weird DSDT or if I was completely wrong and not understanding the ACPI specification.
I tend to think I'm always the one in cause, but the specification seems rather inconsistent (DDBHandle used in DataRefObject but never defined, while there is a DDBHandleObject. There are a handful of things like this).

Did anybody face the same problem ?


Top
 Profile  
 
 Post subject: Re: Inconsistency between AML and specification:Unexpected t
PostPosted: Mon Sep 17, 2018 7:26 am 
Offline
Member
Member

Joined: Wed Oct 26, 2011 12:00 pm
Posts: 178
Could it help examining ACPICA to see how they handle these inconsistensies?

_________________
MollenOS Progress: Userspace Programming
Github
Website


Top
 Profile  
 
 Post subject: Re: Inconsistency between AML and specification:Unexpected t
PostPosted: Wed Sep 19, 2018 4:25 am 
Offline
Member
Member

Joined: Mon Apr 09, 2007 12:10 pm
Posts: 775
Location: London, UK
The examples you have provided are consistent with the spec.

Methods can be defined within Device. Indeed, the ASL example for Device in the spec does just this. I think, however, there is a problem with the spec you are quoting as the AML reference that I have (spec ver 4.0a) has the following for NamedObj:
Code:
NamedObj   := DefBankField | DefCreateBitField | DefCreateByteField |
        DefCreateDWordField | DefCreateField | DefCreateQWordField |
        DefCreateWordField | DefDataRegion | DefDevice | DefEvent |
        DefField | DefIndexField | DefMethod | DefMutex | DefOpRegion |
        DefPowerRes | DefProcessor | DefThermalZone
which includes DefDevice.

For your second example, what you see is a NameSeg, which is also a NamePath, a NameString, a UserTermObj, a Type2Opcode and therefore a TermArg.

If that does not appear obvious from the specification you have, perhaps try a different version as yours may have errors. I have managed to make a resonably complete AML interpreter from the 4.0a version.

Thanks,
John.

_________________
Tysos | rpi-boot


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], ndke and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group