507 lines
18 KiB
Plaintext
507 lines
18 KiB
Plaintext
AMLCode := DefBlockHdr TermList
|
|
DefBlockHdr := TableSig TableLen SpecCompliance CheckSum OemID OemTableID OemRev CreatorID CreatorRev
|
|
|
|
LeadNameChar := 'A'-'Z' | '_'
|
|
DigitChar := '0'-'9'
|
|
NameChar := DigitChar | LeadNameChar
|
|
RootChar := '\'
|
|
ParentPrefixChar := '^'
|
|
|
|
'A'-'Z' := 0x41-0x5a
|
|
'_' := 0x5f
|
|
'0'-'9' := 0x30-0x39
|
|
'\' := 0x5c
|
|
'^' := 0x5e
|
|
|
|
NameSeg := <LeadNameChar NameChar NameChar NameChar>
|
|
// Notice that NameSegs shorter than 4 characters are
|
|
// filled with trailing '_'s.
|
|
NameString := <RootChar NamePath> | <PrefixPath NamePath>
|
|
PrefixPath := Nothing | <'^' PrefixPath>
|
|
NamePath := NameSeg | DualNamePath | MultiNamePath | NullName
|
|
|
|
DualNamePath := DualNamePrefix NameSeg NameSeg
|
|
DualNamePrefix := 0x2e
|
|
MultiNamePath := MultiNamePrefix SegCount NameSeg(SegCount)
|
|
MultiNamePrefix := 0x2f
|
|
SegCount := ByteData
|
|
// SegCount can be from 1 to 255.
|
|
// MultiNamePrefix(35) => 0x2f 0x23
|
|
// and following by 35 NameSegs.
|
|
// So, the total encoding length
|
|
// will be 1 + 1 + 35*4 = 142.
|
|
// Notice that:
|
|
// DualNamePrefix NameSeg NameSeg
|
|
// has a smaller encoding than the
|
|
// equivalent encoding of:
|
|
// MultiNamePrefix(2) NameSeg NameSeg
|
|
SimpleName := NameString | ArgObj | LocalObj
|
|
SuperName := SimpleName | DebugObj | Type6Opcode
|
|
NullName := 0x00
|
|
Target := SuperName | NullName
|
|
|
|
ComputationalData := ByteConst | WordConst | DwordConst | QwordConst | String | ConstObj | RevisionOp | DefBuffer
|
|
DataObject := ComputationalData | DefPackage | DefVarPackage
|
|
DataRefObject := DataObject | ObjectReference | DDBHandleObject
|
|
|
|
ByteConst := BytePrefix ByteData
|
|
BytePrefix := 0x0a
|
|
WordConst := WordPrefix WordData
|
|
WordPrefix := 0x0b
|
|
DWordConst := DWordPrefix DWordData
|
|
DWordPrefix := 0x0c
|
|
QWordConst := QWordPrefix QWordData
|
|
QWordPrefix := 0x0e
|
|
|
|
String := StringPrefix AsciiCharList NullChar
|
|
StringPrefix := 0x0d
|
|
ConstObj := ZeroOp | OneOp | OnesOp
|
|
ByteList := Nothing | <ByteData ByteList>
|
|
ByteData := 0x00-0xff
|
|
WordData := ByteData[0:7] ByteData[8:15] // 0x0000-0xffff
|
|
DWordData := WordData[0:15] WordData[16:31] // 0x00000000-0xffffffff
|
|
QWordData := DwordData[0:31] DwordData[32:63] // 0x0000000000000000-0xffffffffffffffff
|
|
AsciiCharList := Nothing | <AsciiChar AsciiCharList>
|
|
AsciiChar := 0x01-0x7f
|
|
NullChar := 0x00
|
|
ZeroOp := 0x00
|
|
OneOp := 0x01
|
|
OnesOp := 0xff
|
|
RevisionOp := ExtOpPrefix 0x30
|
|
ExtOpPrefix := 0x5b
|
|
|
|
PkgLength := PkgLeadByte | <PkgLeadByte ByteData> | <PkgLeadByte ByteData ByteData> | <PkgLeadByte ByteData ByteData ByteData>
|
|
PkgLeadByte := <bit 7-6: follow ByteData count> <bit 5-4: reserved> <bit 3-0: least significant package length byte>
|
|
// Note: The high 2 bits of the first byte reveal how
|
|
// many follow bytes are in the PkgLength. If the
|
|
// PkgLength has only one byte, bit 0 through 5 are
|
|
// used to encode the package length (in other words,
|
|
// values 0-63).
|
|
// If the package length value is more than
|
|
// 63, more than one byte must be used for the
|
|
// encoding in which case bit 5 and 4 of the
|
|
// PkgLeadByte are reserved and must be zero. If
|
|
// multiple bytes encoding is used, bits 3-0 of the
|
|
// PkgLeadByte become the least significant 4 bits
|
|
// of the resulting package length value. The next
|
|
// ByteData will become the next least significant
|
|
// 8 bits of the resulting value and so on.
|
|
|
|
|
|
TermObj := NameSpaceModifierObj | NamedObj | Type1Opcode | Type2Opcode
|
|
TermList := Nothing | <TermObj TermList>
|
|
|
|
TermArg := Type2Opcode | DataObject | ArgObj | LocalObj
|
|
UserTermObj := NameString TermArgList
|
|
TermArgList := Nothing | <TermArg TermArgList>
|
|
|
|
ObjectList := Nothing | <Object ObjectList>
|
|
Object := NameSpaceModifierObj | NamedObj
|
|
|
|
NameSpaceModifierObj := DefAlias | DefName | DefScope
|
|
|
|
DefAlias := AliasOp NameString NameString
|
|
AliasOp := 0x06
|
|
|
|
DefName := NameOp NameString DataRefObject
|
|
NameOp := 0x08
|
|
|
|
DefScope := ScopeOp PkgLength NameString TermList
|
|
ScopeOp := 0x10
|
|
|
|
NamedObj := DefBankField | DefCreateBitField | DefCreateByteField | DefCreateDWordField | DefCreateField | DefCreateQWordField | DefCreateWordField | DefDataRegion | DefDevice | DefEvent | DefField | DefIndexField | DefMethod | DefMutex | DefOpRegion | DefPowerRes | DefProcessor | DefThermalZone
|
|
|
|
DefBankField := BankFieldOp PkgLength NameString NameString BankValue FieldFlags FieldList
|
|
BankFieldOp := ExtOpPrefix 0x87
|
|
BankValue := TermArg=>Integer
|
|
FieldFlags := ByteData
|
|
// bit 0-3: AccessType
|
|
// 0: AnyAcc
|
|
// 1: ByteAcc
|
|
// 2: WordAcc
|
|
// 3: DWordAcc
|
|
// 4: QWordAcc
|
|
// 5: BufferAcc
|
|
// 6: Reserved
|
|
// 7-15: Reserved
|
|
// bit 4: LockRule
|
|
// 0: NoLock
|
|
// 1: Lock
|
|
// bit 5-6: UpdateRule
|
|
// 0: Preserve
|
|
// 1: WriteAsOnes
|
|
// 2: WriteAsZeros
|
|
// bit 7: reserved (must be 0)
|
|
FieldList := Nothing | <FieldElement FieldList>
|
|
FieldElement := NamedField | ReservedField | AccessField
|
|
NamedField := NameSeg PkgLength
|
|
ReservedField := 0x00 PkgLength
|
|
AccessField := 0x01 AccessType AccessAttrib
|
|
AccessType := ByteData
|
|
// Same as AccessType bits of FieldFlags
|
|
|
|
AccessAttrib := ByteData
|
|
// If AccessType is BufferAcc for the SMB OpRegion,
|
|
// AccessAttrib can be one of the following values:
|
|
// 0x02 - SMBQuick
|
|
// 0x04 - SMBSendReceive
|
|
// 0x06 - SMBByte
|
|
// 0x08 - SMBWord
|
|
// 0x0a - SMBBlock
|
|
// 0x0c - SMBProcessCall
|
|
// 0x0d - SMBBlockProcessCall
|
|
|
|
DefCreateBitField := CreateBitFieldOp SourceBuff BitIndex NameString
|
|
CreateBitFieldOp := 0x8d
|
|
SourceBuff := TermArg=>Buffer
|
|
BitIndex := TermArg=>Integer
|
|
|
|
DefCreateByteField := CreateByteFieldOp SourceBuff ByteIndex NameString
|
|
CreateByteFieldOp := 0x8c
|
|
ByteIndex := TermArg=>Integer
|
|
|
|
DefCreateDWordField := CreateDWordFieldOp SourceBuff ByteIndex NameString
|
|
CreateDWordFieldOp := 0x8a
|
|
|
|
DefCreateField := CreateFieldOp SourceBuff BitIndex NumBits NameString
|
|
CreateFieldOp := ExtOpPrefix 0x13
|
|
NumBits := TermArg=>Integer
|
|
|
|
DefCreateQWordField := CreateQWordFieldOp SourceBuff ByteIndex NameString
|
|
CreateQWordFieldOp := 0x8f
|
|
|
|
DefCreateWordField := CreateWordFieldOp SourceBuff ByteIndex NameString
|
|
CreateWordFieldOp := 0x8b
|
|
|
|
DefDataRegion := DataRegionOp NameString TermArg TermArg TermArg
|
|
DataRegionOp := ExtOpPrefix 0x88
|
|
|
|
DefDevice := DeviceOp PkgLength NameString ObjectList
|
|
DeviceOp := ExtOpPrefix 0x82
|
|
|
|
DefEvent := EventOp NameString
|
|
EventOp := ExtOpPrefix 0x02
|
|
|
|
DefField := FieldOp PkgLength NameString FieldFlags FieldList
|
|
FieldOp := ExtOpPrefix 0x81
|
|
|
|
DefIndexField := IndexFieldOp PkgLength NameString NameString FieldFlags FieldList
|
|
IndexFieldOp := ExtOpPrefix 0x86
|
|
|
|
DefMethod := MethodOp PkgLength NameString MethodFlags TermList
|
|
MethodOp := 0x14
|
|
MethodFlags := ByteData
|
|
// bit 0-2: ArgCount (0-7)
|
|
// bit 3: SerializeFlag
|
|
// 0: NotSerialized
|
|
// 1: Serialized
|
|
// bit 4-7: SyncLevel (0x00-0x0f)
|
|
|
|
DefMutex := MutexOp NameString SyncFlags
|
|
MutexOp := ExtOpPrefix 0x01
|
|
SyncFlags := ByteData
|
|
// bit 0-3: SyncLevel (0x00-0x0f)
|
|
// bit 4-7: reserved (must be 0)
|
|
|
|
DefOpRegion := OpRegionOp NameString RegionSpace RegionOffset RegionLen
|
|
OpRegionOp := ExtOpPrefix 0x80
|
|
RegionSpace := ByteData
|
|
// 0x00: SystemMemory
|
|
// 0x01: SystemIO
|
|
// 0x02: PCI_Config
|
|
// 0x03: EmbeddedControl
|
|
// 0x04: SMBus
|
|
// 0x05: CMOS
|
|
// 0x06: PciBarTarget
|
|
// 0x80-0xff: user defined
|
|
RegionOffset := TermArg=>Integer
|
|
RegionLen := TermArg=>Integer
|
|
|
|
DefPowerRes := PowerResOp PkgLength NameString SystemLevel ResourceOrder ObjectList
|
|
PowerResOp := ExtOpPrefix 0x84
|
|
SystemLevel := ByteData
|
|
ResourceOrder := WordData
|
|
|
|
DefProcessor := ProcessorOp PkgLength NameString ProcID PblkAddr PblkLen ObjectList
|
|
ProcessorOp := ExtOpPrefix 0x83
|
|
ProcID := ByteData
|
|
PblkAddr := DwordData
|
|
PblkLen := ByteData
|
|
|
|
DefThermalZone := ThermalZoneOp PkgLength NameString ObjectList
|
|
ThermalZoneOp := ExtOpPrefix 0x85
|
|
|
|
Type1Opcode := DefBreak | DefBreakPoint | DefContinue | DefFatal | DefIfElse | DefLoad | DefNoop | DefNotify | DefRelease | DefReset | DefReturn | DefSignal | DefSleep | DefStall | DefUnload | DefWhile
|
|
|
|
DefBreak := BreakOp
|
|
BreakOp := 0xa5
|
|
|
|
DefBreakPoint := BreakPointOp
|
|
BreakPointOp := 0xcc
|
|
|
|
DefContinue := ContinueOp
|
|
ContinueOp := 0x9f
|
|
|
|
DefElse := Nothing | <ElseOp PkgLength TermList>
|
|
ElseOp := 0xa1
|
|
|
|
DefFatal := FatalOp FatalType FatalCode FatalArg
|
|
FatalOp := ExtOpPrefix 0x32
|
|
FatalType := ByteData
|
|
FatalCode := DwordData
|
|
FatalArg := TermArg=>Integer
|
|
|
|
DefIfElse := IfOp PkgLength Predicate TermList DefElse
|
|
IfOp := 0xa0
|
|
Predicate := TermArg=>Integer
|
|
|
|
DefLoad := LoadOp NameString DDBHandleObject
|
|
LoadOp := ExtOpPrefix 0x20
|
|
DDBHandleObject := SuperName
|
|
|
|
DefNoop := NoopOp
|
|
NoopOp := 0xa3
|
|
|
|
DefNotify := NotifyOp NotifyObject NotifyValue
|
|
NotifyOp := 0x86
|
|
NotifyObject := SuperName=>ThermalZone|Processor|Device
|
|
NotifyValue := TermArg=>Integer
|
|
|
|
DefRelease := ReleaseOp MutexObject
|
|
ReleaseOp := ExtOpPrefix 0x27
|
|
MutexObject := SuperName
|
|
|
|
DefReset := ResetOp EventObject
|
|
ResetOp := ExtOpPrefix 0x26
|
|
EventObject := SuperName
|
|
|
|
DefReturn := ReturnOp ArgObject
|
|
ReturnOp := 0xa4
|
|
ArgObject := TermArg=>DataRefObject
|
|
|
|
DefSignal := SignalOp EventObject
|
|
SignalOp := ExtOpPrefix 0x24
|
|
|
|
DefSleep := SleepOp MsecTime
|
|
SleepOp := ExtOpPrefix 0x22
|
|
MsecTime := TermArg=>Integer
|
|
|
|
DefStall := StallOp UsecTime
|
|
StallOp := ExtOpPrefix 0x21
|
|
UsecTime := TermArg=>ByteData
|
|
|
|
DefUnload := UnloadOp DDBHandleObject
|
|
UnloadOp := ExtOpPrefix 0x2a
|
|
|
|
DefWhile := WhileOp PkgLength Predicate TermList
|
|
WhileOp := 0xa2
|
|
|
|
Type2Opcode := DefAcquire | DefAdd | DefAnd | DefBuffer | DefConcat | DefConcatRes | DefCondRefOf | DefCopyObject | DefDecrement | DefDerefOf | DefDivide | DefFindSetLeftBit | DefFindSetRightBit | DefFromBCD | DefIncrement | DefIndex | DefLAnd | DefLEqual | DefLGreater | DefLGreaterEqual | DefLLess | DefLLessEqual | DefMid | DefLNot | DefLNotEqual | DefLoadTable | DefLOr | DefMatch | DefMod | DefMultiply | DefNAnd | DefNOr | DefNot | DefObjectType | DefOr | DefPackage | DefVarPackage | DefRefOf | DefShiftLeft | DefShiftRight | DefSizeOf | DefStore | DefSubtract | DefToBCD | DefToBuffer | DefToDecimalString | DefToHexString | DefToInteger | DefToString | DefWait | DefXOr | UserTermObj
|
|
Type6Opcode := DefRefOf | DefDerefOf | DefIndex | UserTermObj
|
|
|
|
DefAcquire := AcquireOp MutexObject Timeout
|
|
AcquireOp := ExtOpPrefix 0x23
|
|
Timeout := WordData
|
|
|
|
DefAdd := AddOp Operand Operand Target
|
|
AddOp := 0x72
|
|
Operand := TermArg=>Integer
|
|
|
|
DefAnd := AndOp Operand Operand Target
|
|
AndOp := 0x7b
|
|
|
|
DefBuffer := BufferOp PkgLength BufferSize ByteList
|
|
BufferOp := 0x11
|
|
BufferSize := TermArg=>Integer
|
|
|
|
DefConcat := ConcatOp Data Data Target
|
|
ConcatOp := 0x73
|
|
Data := TermArg=>ComputationalData
|
|
|
|
DefConcatRes := ConcatResOp BufData BufData Target
|
|
ConcatResOp := 0x84
|
|
BufData := TermArg=>Buffer
|
|
|
|
DefCondRefOf := CondRefOfOp SuperName Target
|
|
CondRefOfOp := ExtOpPrefix 0x12
|
|
|
|
DefCopyObject := CopyObjectOp TermArg SimpleName
|
|
CopyObjectOp := 0x9d
|
|
|
|
DefDecrement := DecrementOp SuperName
|
|
DecrementOp := 0x76
|
|
|
|
DefDerefOf := DerefOfOp ObjReference
|
|
DerefOfOp := 0x83
|
|
ObjReference := TermArg=>ObjectReference|String
|
|
//ObjectReference is an object produced by terms such as Index, RefOf or CondRefOf.
|
|
|
|
DefDivide := DivideOp Dividend Divisor Remainder Quotient
|
|
DivideOp := 0x78
|
|
Dividend := TermArg=>Integer
|
|
Divisor := TermArg=>Integer
|
|
Remainder := Target
|
|
Quotient := Target
|
|
|
|
DefFindSetLeftBit := FindSetLeftBitOp Operand Target
|
|
FindSetLeftBitOp := 0x81
|
|
|
|
|
|
DefFindSetRightBit := FindSetRightBitOp Operand Target
|
|
FindSetRightBitOp := 0x82
|
|
|
|
DefFromBCD := FromBCDOp BCDValue Target
|
|
FromBCDOp := ExtOpPrefix 0x28
|
|
BCDValue := TermArg=>Integer
|
|
|
|
DefIncrement := IncrementOp SuperName
|
|
IncrementOp := 0x75
|
|
|
|
DefIndex := IndexOp BuffPkgStrObj IndexValue Target
|
|
IndexOp := 0x88
|
|
BuffPkgStrObj := TermArg=>Buffer, Package or String
|
|
IndexValue := TermArg=>Integer
|
|
|
|
DefLAnd := LandOp Operand Operand
|
|
LandOp := 0x90
|
|
|
|
DefLEqual := LequalOp Operand Operand
|
|
LequalOp := 0x93
|
|
|
|
DefLGreater := LgreaterOp Operand Operand
|
|
LgreaterOp := 0x94
|
|
|
|
DefLGreaterEqual := LgreaterEqualOp Operand Operand
|
|
LgreaterEqualOp := LnotOp LlessOp
|
|
|
|
DefLLess := LlessOp Operand Operand
|
|
LlessOp := 0x95
|
|
|
|
DefLLessEqual := LlessEqualOp Operand Operand
|
|
LlessEqualOp := LnotOp LgreaterOp
|
|
|
|
DefLNot := LnotOp Operand
|
|
LnotOp := 0x92
|
|
|
|
DefLNotEqual := LnotEqualOp Operand Operand
|
|
LnotEqualOp := LnotOp LequalOp
|
|
|
|
DefLoadTable := LoadTableOp TermArg TermArg TermArg TermArg TermArg TermArg
|
|
LoadTableOp := ExtOpPrefix 0x1F
|
|
|
|
DefLOr := LorOp Operand Operand
|
|
LorOp := 0x91
|
|
|
|
DefMatch := MatchOp SearchPkg MatchOpcode Operand MatchOpcode Operand StartIndex
|
|
MatchOp := 0x89
|
|
SearchPkg := TermArg=>Package
|
|
MatchOpcode := ByteData
|
|
// 0: MTR
|
|
// 1: MEQ
|
|
// 2: MLE
|
|
// 3: MLT
|
|
// 4: MGE
|
|
// 5: MGT
|
|
|
|
StartIndex := TermArg=>Integer
|
|
|
|
DefMid := MidOp MidObj TermArg TermArg Target
|
|
MidOp := 0x9E
|
|
MidObj := TermArg=>Buffer|String
|
|
|
|
DefMod := ModOp Dividend Divisor Target
|
|
ModOp := 0x85
|
|
|
|
DefMultiply := MultiplyOp Operand Operand Target
|
|
MultiplyOp := 0x77
|
|
|
|
DefNAnd := NandOp Operand Operand Target
|
|
NandOp := 0x7c
|
|
|
|
DefNOr := NorOp Operand Operand Target
|
|
NorOp := 0x7e
|
|
|
|
DefNot := NotOp Operand Target
|
|
NotOp := 0x80
|
|
|
|
DefObjectType := ObjectTypeOp SuperName
|
|
ObjectTypeOp := 0x8e
|
|
|
|
DefOr := OrOp Operand Operand Target
|
|
OrOp := 0x7d
|
|
|
|
DefPackage := PackageOp PkgLength NumElements PackageElementList
|
|
PackageOp := 0x12
|
|
DefVarPackage := VarPackageOp PkgLength VarNumElements PackageElementList
|
|
VarPackageOp := 0x13
|
|
NumElements := ByteData
|
|
VarNumElements := TermArg=>Integer
|
|
PackageElementList := Nothing | <PackageElement PackageElementList>
|
|
PackageElement := DataRefObject | NameString
|
|
|
|
DefRefOf := RefOfOp SuperName
|
|
RefOfOp := 0x71
|
|
|
|
DefShiftLeft := ShiftLeftOp Operand ShiftCount Target
|
|
ShiftLeftOp := 0x79
|
|
ShiftCount := TermArg=>Integer
|
|
|
|
DefShiftRight := ShiftRightOp Operand ShiftCount Target
|
|
ShiftRightOp := 0x7a
|
|
|
|
DefSizeOf := SizeOfOp SuperName
|
|
SizeOfOp := 0x87
|
|
|
|
DefStore := StoreOp TermArg SuperName
|
|
StoreOp := 0x70
|
|
|
|
DefSubtract := SubtractOp Operand Operand Target
|
|
SubtractOp := 0x74
|
|
|
|
DefToBCD := ToBCDOp Operand Target
|
|
ToBCDOp := ExtOpPrefix 0x29
|
|
|
|
DefToBuffer := ToBufferOp Operand Target
|
|
ToBufferOp := 0x96
|
|
|
|
DefToDecimalString := ToDecimalStringOp Operand Target
|
|
ToDecimalStringOp := 0x97
|
|
|
|
DefToHexString := ToHexStringOp Operand Target
|
|
ToHexStringOp := 0x98
|
|
|
|
DefToInteger := ToIntegerOp Operand Target
|
|
ToIntegerOp := 0x99
|
|
|
|
DefToString := ToStringOp TermArg LengthArg Target
|
|
LengthArg := TermArg=>Integer
|
|
ToStringOp := 0x9c
|
|
|
|
DefWait := WaitOp EventObject Operand
|
|
WaitOp := ExtOpPrefix 0x25
|
|
|
|
DefXOr := XorOp Operand Operand Target
|
|
XorOp := 0x7f
|
|
|
|
ArgObj := Arg0Op | Arg1Op | Arg2Op | Arg3Op | Arg4Op | Arg5Op | Arg6Op
|
|
Arg0Op := 0x68
|
|
Arg1Op := 0x69
|
|
Arg2Op := 0x6a
|
|
Arg3Op := 0x6b
|
|
Arg4Op := 0x6c
|
|
Arg5Op := 0x6d
|
|
Arg6Op := 0x6e
|
|
|
|
LocalObj := Local0Op | Local1Op | Local2Op | Local3Op | Local4Op | Local5Op | Local6Op | Local7Op
|
|
Local0Op := 0x60
|
|
Local1Op := 0x61
|
|
Local2Op := 0x62
|
|
Local3Op := 0x63
|
|
Local4Op := 0x64
|
|
Local5Op := 0x65
|
|
Local6Op := 0x66
|
|
Local7Op := 0x67
|
|
|
|
DebugObj := DebugOp
|
|
DebugOp := ExtOpPrefix 0x31
|