1# Copyright (C) 2021-2022 Intel Corporation. 2# 3# SPDX-License-Identifier: BSD-3-Clause 4# 5 6# Primary opcodes 7AML_ZERO_OP = 0x00 8AML_RESERVED_FIELD_PREFIX = 0x00 9AML_NULL_NAME = 0x00 10AML_ONE_OP = 0x01 11AML_ACCESS_FIELD_PREFIX = 0x01 12AML_CONNECT_FIELD_PREFIX = 0x02 13AML_EXTENDED_ACCESS_FIELD_PREFIX = 0x03 14AML_ALIAS_OP = 0x06 15AML_NAME_OP = 0x08 16AML_BYTE_PREFIX = 0x0A 17AML_WORD_PREFIX = 0x0B 18AML_DWORD_PREFIX = 0x0C 19AML_STRING_PREFIX = 0x0D 20AML_QWORD_PREFIX = 0x0E 21AML_SCOPE_OP = 0x10 22AML_BUFFER_OP = 0x11 23AML_PACKAGE_OP = 0x12 24AML_VAR_PACKAGE_OP = 0x13 25AML_METHOD_OP = 0x14 26AML_EXTERNAL_OP = 0x15 27AML_DUAL_NAME_PREFIX = 0x2E 28AML_MULTI_NAME_PREFIX = 0x2F 29AML_EXT_OP_PREFIX = 0x5B 30AML_FIRST_LOCAL_OP = 0x60 31AML_LOCAL0_OP = 0x60 32AML_LOCAL1_OP = 0x61 33AML_LOCAL2_OP = 0x62 34AML_LOCAL3_OP = 0x63 35AML_LOCAL4_OP = 0x64 36AML_LOCAL5_OP = 0x65 37AML_LOCAL6_OP = 0x66 38AML_LOCAL7_OP = 0x67 39AML_ARG0_OP = 0x68 40AML_ARG1_OP = 0x69 41AML_ARG2_OP = 0x6A 42AML_ARG3_OP = 0x6B 43AML_ARG4_OP = 0x6C 44AML_ARG5_OP = 0x6D 45AML_ARG6_OP = 0x6E 46AML_STORE_OP = 0x70 47AML_REF_OF_OP = 0x71 48AML_ADD_OP = 0x72 49AML_CONCAT_OP = 0x73 50AML_SUBTRACT_OP = 0x74 51AML_INCREMENT_OP = 0x75 52AML_DECREMENT_OP = 0x76 53AML_MULTIPLY_OP = 0x77 54AML_DIVIDE_OP = 0x78 55AML_SHIFT_LEFT_OP = 0x79 56AML_SHIFT_RIGHT_OP = 0x7A 57AML_AND_OP = 0x7B 58AML_NAND_OP = 0x7C 59AML_OR_OP = 0x7D 60AML_NOR_OP = 0x7E 61AML_XOR_OP = 0x7F 62AML_NOT_OP = 0x80 63AML_FIND_SET_LEFT_BIT_OP = 0x81 64AML_FIND_SET_RIGHT_BIT_OP = 0x82 65AML_DEREF_OF_OP = 0x83 66AML_CONCAT_RES_OP = 0x84 67AML_MOD_OP = 0x85 68AML_NOTIFY_OP = 0x86 69AML_SIZE_OF_OP = 0x87 70AML_INDEX_OP = 0x88 71AML_MATCH_OP = 0x89 72AML_CREATE_DWORD_FIELD_OP = 0x8A 73AML_CREATE_WORD_FIELD_OP = 0x8B 74AML_CREATE_BYTE_FIELD_OP = 0x8C 75AML_CREATE_BIT_FIELD_OP = 0x8D 76AML_OBJECT_TYPE_OP = 0x8E 77AML_CREATE_QWORD_FIELD_OP = 0x8F 78AML_LAND_OP = 0x90 79AML_LOR_OP = 0x91 80AML_LNOT_OP = 0x92 81AML_LEQUAL_OP = 0x93 82AML_LGREATER_OP = 0x94 83AML_LLESS_OP = 0x95 84AML_TO_BUFFER_OP = 0x96 85AML_TO_DECIMAL_STRING_OP = 0x97 86AML_TO_HEX_STRING_OP = 0x98 87AML_TO_INTEGER_OP = 0x99 88AML_TO_STRING_OP = 0x9C 89AML_COPY_OBJECT_OP = 0x9D 90AML_MID_OP = 0x9E 91AML_CONTINUE_OP = 0x9F 92AML_IF_OP = 0xA0 93AML_ELSE_OP = 0xA1 94AML_WHILE_OP = 0xA2 95AML_NOOP_OP = 0xA3 96AML_RETURN_OP = 0xA4 97AML_BREAK_OP = 0xA5 98AML_BREAKPOINT_OP = 0xCC 99AML_ONES_OP = 0xFF 100 101# Prefixed opcodes, with the least byte being AML_EXT_OP_PREFIX 102AML_MUTEX_OP = 0x015b 103AML_EVENT_OP = 0x025b 104AML_CONDITIONAL_REF_OF_OP = 0x125b 105AML_CREATE_FIELD_OP = 0x135b 106AML_LOAD_TABLE_OP = 0x1f5b 107AML_LOAD_OP = 0x205b 108AML_STALL_OP = 0x215b 109AML_SLEEP_OP = 0x225b 110AML_ACQUIRE_OP = 0x235b 111AML_SIGNAL_OP = 0x245b 112AML_WAIT_OP = 0x255b 113AML_RESET_OP = 0x265b 114AML_RELEASE_OP = 0x275b 115AML_FROM_BCD_OP = 0x285b 116AML_TO_BCD_OP = 0x295b 117AML_UNLOAD_OP = 0x2a5b 118AML_REVISION_OP = 0x305b 119AML_DEBUG_OP = 0x315b 120AML_FATAL_OP = 0x325b 121AML_TIMER_OP = 0x335b 122AML_REGION_OP = 0x805b 123AML_FIELD_OP = 0x815b 124AML_DEVICE_OP = 0x825b 125AML_PROCESSOR_OP = 0x835b 126AML_POWER_RESOURCE_OP = 0x845b 127AML_THERMAL_ZONE_OP = 0x855b 128AML_INDEX_FIELD_OP = 0x865b 129AML_BANK_FIELD_OP = 0x875b 130AML_DATA_REGION_OP = 0x885b 131 132 133################################################################################ 134# 20.2.1 Table and Table Header Encoding 135################################################################################ 136 137AMLCode = ("DefBlockHeader", "TermObj*") 138DefBlockHeader = ("TableSignature", "TableLength", "SpecCompliance", "CheckSum", "OemID", "OemTableID", "OemRevision", "CreatorID", "CreatorRevision") 139TableSignature = ["DWordData"] 140TableLength = ["DWordData"] 141SpecCompliance = ["ByteData"] 142CheckSum = ["ByteData"] 143OemID = ["TWordData"] 144OemTableID = ["QWordData"] 145OemRevision = ["DWordData"] 146CreatorID = ["DWordData"] 147CreatorRevision = ["DWordData"] 148 149################################################################################ 150# 20.2.2 Name Objects Encoding 151################################################################################ 152 153# NameSeg is defined in parser.py 154# NameString is defined in parser.py 155 156SimpleName = ["NameString", "ArgObj", "LocalObj"] 157SuperName = ["SimpleName", "DebugObj", "ReferenceTypeOpcode"] 158NullName = (AML_NULL_NAME,) 159Target = ["SuperName", "NullName"] 160 161################################################################################ 162# 20.2.3 Data Objects Encoding 163################################################################################ 164 165ComputationalData = ["ByteConst", "WordConst", "DWordConst", "QWordConst", "String", "ConstObj", "RevisionOp", "DefBuffer"] 166DataObject = ["ComputationalData", "DefPackage", "DefVarPackage"] 167DataRefObject = ["DataObject"] 168 169ByteConst = (AML_BYTE_PREFIX, "ByteData") 170WordConst = (AML_WORD_PREFIX, "WordData") 171DWordConst = (AML_DWORD_PREFIX, "DWordData") 172QWordConst = (AML_QWORD_PREFIX, "QWordData") 173# String is defined in parser.py 174 175ConstObj = ["ZeroOp", "OneOp", "OnesOp"] 176# ByteList is defined in parser.py 177# ByteData, WordData, DWordData and QWordData are defined in parser.py 178 179ZeroOp = (AML_ZERO_OP,) 180OneOp = (AML_ONE_OP,) 181OnesOp = (AML_ONES_OP,) 182RevisionOp = (AML_REVISION_OP,) 183 184################################################################################ 185# 20.2.4 Package Length Encoding 186################################################################################ 187 188# PkgLength is defined in parser.py 189 190################################################################################ 191# 20.2.5 Term Objects Encoding 192################################################################################ 193 194Object = ["NameSpaceModifierObj", "NamedObj"] 195TermObj = ["Object", "StatementOpcode", "ExpressionOpcode", "ConstObj"] 196TermList = ("TermObj*",) 197TermArg = ["ExpressionOpcode", "DataObject", "ArgObj", "LocalObj"] 198# MethodInvocation is defined in parser.py 199 200# 20.2.5.1 Namespace Modifier Objects Encoding 201################################################################################ 202 203NameSpaceModifierObj = ["DefAlias", "DefName", "DefScope"] 204 205DefAlias = (AML_ALIAS_OP, "NameString:SourceObject", "NameString:AliasObject") 206DefName = (AML_NAME_OP, "NameString", "DataRefObject") 207DefScope = (AML_SCOPE_OP, "PkgLength", "NameString", "TermList") 208 209# 20.2.5.2 Named Objects Encoding 210################################################################################ 211 212NamedObj = ["DefBankField", "DefCreateBitField", "DefCreateByteField", "DefCreateDWordField", "DefCreateField", 213 "DefCreateQWordField", "DefCreateWordField", "DefDataRegion", "DefDevice", "DefEvent", "DefExternal", 214 "DefField", "DefIndexField", "DefMethod", "DefMutex", "DefOpRegion", "DefPowerRes", "DefProcessor", 215 "DefThermalZone"] 216 217DefBankField = (AML_BANK_FIELD_OP, "PkgLength", "NameString:RegionName", "NameString:BankName", "BankValue", "FieldFlags", "FieldList") 218BankValue = ["TermArg"] 219FieldFlags = ["ByteData"] 220FieldList = ("FieldElement*",) 221NamedField = ("NameSeg", "FieldLength") 222ReservedField = (AML_RESERVED_FIELD_PREFIX, "FieldLength") 223AccessField = (AML_ACCESS_FIELD_PREFIX, "AccessType", "AccessAttrib") 224AccessType = ["ByteData"] 225AccessAttrib = ["ByteData"] 226ConnectFieldDef = ["NameString"] # FIXME: ACPI spec allows "BufferData" here but does not define what "BufferData" is 227ConnectField = (AML_CONNECT_FIELD_PREFIX, "ConnectFieldDef") 228 229DefCreateBitField = (AML_CREATE_BIT_FIELD_OP, "SourceBuff", "BitIndex", "NameString") 230SourceBuff = ["TermArg"] 231BitIndex = ["TermArg"] 232DefCreateByteField = (AML_CREATE_BYTE_FIELD_OP, "SourceBuff", "ByteIndex", "NameString") 233ByteIndex = ["TermArg"] 234DefCreateDWordField = (AML_CREATE_DWORD_FIELD_OP, "SourceBuff", "ByteIndex", "NameString") 235DefCreateField = (AML_CREATE_FIELD_OP, "SourceBuff", "BitIndex", "NumBits", "NameString") 236NumBits = ["TermArg"] 237DefCreateQWordField = (AML_CREATE_QWORD_FIELD_OP, "SourceBuff", "ByteIndex", "NameString") 238DefCreateWordField = (AML_CREATE_WORD_FIELD_OP, "SourceBuff", "ByteIndex", "NameString") 239 240DefDataRegion = (AML_DATA_REGION_OP, "NameString", "TermArg:Signature", "TermArg:OEMID", "TermArg:OEMTableID") 241 242DefDevice = (AML_DEVICE_OP, "PkgLength", "NameString", "TermList") 243 244DefEvent = (AML_EVENT_OP, "NameString") 245 246DefExternal = (AML_EXTERNAL_OP, "NameString", "ObjectType", "ArgumentCount") 247ObjectType = ["ByteData"] 248ArgumentCount = ["ByteData"] 249 250DefField = (AML_FIELD_OP, "PkgLength", "NameString", "FieldFlags", "FieldList") 251 252DefIndexField = (AML_INDEX_FIELD_OP, "PkgLength", "NameString:IndexName", "NameString:DataName", "FieldFlags", "FieldList") 253 254DefMethod = (AML_METHOD_OP, "PkgLength", "NameString", "MethodFlags", "TermList") 255MethodFlags = ["ByteData"] 256 257DefMutex = (AML_MUTEX_OP, "NameString", "SyncFlags") 258SyncFlags = ["ByteData"] 259 260DefOpRegion = (AML_REGION_OP, "NameString", "RegionSpace", "RegionOffset", "RegionLen") 261RegionSpace = ["ByteData"] 262RegionOffset = ["TermArg"] 263RegionLen = ["TermArg"] 264 265DefPowerRes = (AML_POWER_RESOURCE_OP, "PkgLength", "NameString", "SystemLevel", "ResourceOrder", "TermList") 266SystemLevel = ["ByteData"] 267ResourceOrder = ["WordData"] 268 269DefProcessor = (AML_PROCESSOR_OP, "PkgLength", "NameString", "ProcID", "PblkAddr", "PblkLen", "TermList") 270ProcID = ["ByteData"] 271PblkAddr = ["DWordData"] 272PblkLen = ["ByteData"] 273 274DefThermalZone = (AML_THERMAL_ZONE_OP, "PkgLength", "NameString", "TermList") 275 276ExtendedAccessField = (AML_EXTENDED_ACCESS_FIELD_PREFIX, "AccessType", "ExtendedAccessAttrib", "AccessLength") 277ExtendedAccessAttrib = ["ByteData"] 278AccessLength = ["ByteData"] 279FieldElement = ["NamedField", "ReservedField", "AccessField", "ExtendedAccessField", "ConnectField"] 280 281# 20.2.5.3 Statement Opcodes Encoding 282################################################################################ 283 284StatementOpcode = ["DefBreak", "DefBreakPoint", "DefContinue", "DefFatal", "DefIfElse", "DefNoop", "DefNotify", 285 "DefRelease", "DefReset", "DefReturn", "DefSignal", "DefSleep", "DefStall", "DefUnload", "DefWhile"] 286 287DefBreak = (AML_BREAK_OP,) 288 289DefBreakPoint = (AML_BREAKPOINT_OP,) 290 291DefContinue = (AML_CONTINUE_OP,) 292 293DefElse = (AML_ELSE_OP, "PkgLength", "TermList") 294 295DefFatal = (AML_FATAL_OP, "FatalType", "FatalCode", "FataArg") 296FatalType = ["ByteData"] 297FatalCode = ["DWordData"] 298FatalArg = ["TermArg"] 299 300DefIfElse = (AML_IF_OP, "PkgLength", "Predicate", "TermList", "DefElse?") 301Predicate = ["TermArg"] 302 303DefNoop = (AML_NOOP_OP,) 304 305DefNotify = (AML_NOTIFY_OP, "NotifyObject", "NotifyValue") 306NotifyObject = ["SuperName"] 307NotifyValue = ["TermArg"] 308 309DefRelease = (AML_RELEASE_OP, "MutexObject") 310MutexObject = ["SuperName"] 311 312DefReset = (AML_RESET_OP, "EventObject") 313EventObject = ["SuperName"] 314 315DefReturn = (AML_RETURN_OP, "ArgObject") 316ArgObject = ["TermArg"] 317 318DefSignal = (AML_SIGNAL_OP, "EventObject") 319 320DefSleep = (AML_SLEEP_OP, "MsecTime") 321MsecTime = ["TermArg"] 322 323DefStall = (AML_STALL_OP, "UsecTime") 324UsecTime = ["TermArg"] 325 326DefUnload = (AML_UNLOAD_OP, "Target") 327 328DefWhile = (AML_WHILE_OP, "PkgLength", "Predicate", "TermList") 329 330# 20.2.5.4 Expression Opcodes Encoding 331################################################################################ 332 333ExpressionOpcode = ["DefAcquire", "DefAdd", "DefAnd", "DefBuffer", "DefConcat", "DefConcatRes", "DefCondRefOf", 334 "DefCopyObject", "DefDecrement", "DefDerefOf", "DefDivide", "DefFindSetLeftBit", 335 "DefFindSetRightBit", "DefFromBCD", "DefIncrement", "DefIndex", "DefLAnd", "DefLEqual", 336 "DefLGreater", "DefLLess", "DefMid", "DefLNot", "DefLoad", "DefLoadTable", "DefLOr", "DefMatch", 337 "DefMod", "DefMultiply", "DefNAnd", "DefNOr", "DefNot", "DefObjectType", "DefOr", "DefPackage", 338 "DefVarPackage", "DefRefOf", "DefShiftLeft", "DefShiftRight", "DefSizeOf", "DefStore", 339 "DefSubtract", "DefTimer", "DefToBCD", "DefToBuffer", "DefToDecimalString", "DefToHexString", 340 "DefToInteger", "DefToString", "DefWait", "DefXOr", "MethodInvocation" ] 341 342ReferenceTypeOpcode = ["DefRefOf", "DefDerefOf", "DefIndex"] 343 344DefAcquire = (AML_ACQUIRE_OP, "MutexObject", "Timeout") 345Timeout = ["WordData"] 346 347DefAdd = (AML_ADD_OP, "Operand:LeftOperand", "Operand:RightOperand", "Target") 348Operand = ["TermArg"] 349 350DefAnd = (AML_AND_OP, "Operand:LeftOperand", "Operand:RightOperand", "Target") 351 352DefBuffer = (AML_BUFFER_OP, "PkgLength", "BufferSize", "ByteList") 353BufferSize = ["TermArg"] 354 355DefConcat = (AML_CONCAT_OP, "Data:Data1", "Data:Data2", "Target") 356Data = ["TermArg"] 357 358DefConcatRes = (AML_CONCAT_RES_OP, "BufData:BufData1", "BufData:BufData2", "Target") 359BufData = ["TermArg"] 360 361DefCondRefOf = (AML_CONDITIONAL_REF_OF_OP, "SuperName", "Target") 362 363DefCopyObject = (AML_COPY_OBJECT_OP, "TermArg", "SimpleName") 364 365DefDecrement = (AML_DECREMENT_OP, "SuperName") 366 367DefDerefOf = (AML_DEREF_OF_OP, "ObjReference") 368ObjReference = ["TermArg"] 369 370DefDivide = (AML_DIVIDE_OP, "Dividend", "Divisor", "Remainder", "Quotient") 371Dividend = ["TermArg"] 372Divisor = ["TermArg"] 373Remainder = ["Target"] 374Quotient = ["Target"] 375 376DefFindSetLeftBit = (AML_FIND_SET_LEFT_BIT_OP, "Operand", "Target") 377DefFindSetRightBit = (AML_FIND_SET_RIGHT_BIT_OP, "Operand", "Target") 378 379DefFromBCD = (AML_FROM_BCD_OP, "BCDValue", "Target") 380BCDValue = ["TermArg"] 381 382DefIncrement = (AML_INCREMENT_OP, "SuperName") 383 384DefIndex = (AML_INDEX_OP, "BuffPkgStrObj", "IndexValue", "Target") 385BuffPkgStrObj = ["TermArg"] 386IndexValue = ["TermArg"] 387 388DefLAnd = (AML_LAND_OP, "Operand:LeftOperand", "Operand:RightOperand") 389DefLEqual = (AML_LEQUAL_OP, "Operand:LeftOperand", "Operand:RightOperand") 390DefLGreater = (AML_LGREATER_OP, "Operand:LeftOperand", "Operand:RightOperand") 391# DefLGreaterEqual is equivalent to (AML_LNOT_OP, DefLLess) 392DefLLess = (AML_LLESS_OP, "Operand:LeftOperand", "Operand:RightOperand") 393# DefLLessEqual is equivalent to (AML_LNOT_OP, DefLGreater) 394DefLNot = (AML_LNOT_OP, "Operand") 395# DefLNotEqual is equivalent to (AML_LNOT_OP, DefLEqual) 396 397DefLoad = (AML_LOAD_OP, "NameString", "Target") 398 399DefLoadTable = (AML_LOAD_TABLE_OP, "TermArg:Signature", "TermArg:OEMID", "TermArg:TableID", "TermArg:RootPath", "TermArg:ParameterPath", "TermArg:ParameterData") 400 401DefLOr = (AML_LOR_OP, "Operand:LeftOperand", "Operand:RightOperand") 402 403DefMatch = (AML_MATCH_OP, "SearchPkg", "MatchOpcode:MatchOpcode1", "Operand:Operand1", "MatchOpcode:MatchOpcode2", "Operand:Operand2", "StartIndex") 404SearchPkg = ["TermArg"] 405MatchOpcode = ["ByteData"] 406StartIndex = ["TermArg"] 407 408DefMid = (AML_MID_OP, "MidObj", "TermArg:Source", "TermArg:Index", "Target") 409MidObj = ["TermArg"] 410 411DefMod = (AML_MOD_OP, "Dividend", "Divisor", "Target") 412 413DefMultiply = (AML_MULTIPLY_OP, "Operand:LeftOperand", "Operand:RightOperand", "Target") 414 415DefNAnd = (AML_NAND_OP, "Operand:LeftOperand", "Operand:RightOperand", "Target") 416DefNOr = (AML_NOR_OP, "Operand:LeftOperand", "Operand:RightOperand", "Target") 417DefNot = (AML_NOT_OP, "Operand", "Target") 418 419DefObjectType = (AML_OBJECT_TYPE_OP, "ObjectTypeContent") 420ObjectTypeContent = ["SimpleName", "DebugObj", "DefRefof", "DefDerefof", "DefIndex"] 421 422DefOr = (AML_OR_OP, "Operand:LeftOperand", "Operand:RightOperand", "Target") 423 424DefPackage = (AML_PACKAGE_OP, "PkgLength", "NumElements", "PackageElementList") 425DefVarPackage = (AML_VAR_PACKAGE_OP, "PkgLength", "VarNumElements", "PackageElementList") 426NumElements = ["ByteData"] 427VarNumElements = ["TermArg"] 428PackageElementList = ("PackageElement*",) 429PackageElement = ["DataRefObject", "NameString"] 430 431DefRefOf = (AML_REF_OF_OP, "SuperName") 432 433DefShiftLeft = (AML_SHIFT_LEFT_OP, "Operand", "ShiftCount", "Target") 434ShiftCount = ["TermArg"] 435DefShiftRight = (AML_SHIFT_RIGHT_OP, "Operand", "ShiftCount", "Target") 436 437DefSizeOf = (AML_SIZE_OF_OP, "SuperName") 438 439DefStore = (AML_STORE_OP, "TermArg", "SuperName") 440 441DefSubtract = (AML_SUBTRACT_OP, "Operand:LeftOperand", "Operand:RightOperand", "Target") 442 443DefTimer = (AML_TIMER_OP,) 444 445DefToBCD = (AML_TO_BCD_OP, "Operand", "Target") 446 447DefToBuffer = (AML_TO_BUFFER_OP, "Operand", "Target") 448 449DefToDecimalString = (AML_TO_DECIMAL_STRING_OP, "Operand", "Target") 450 451DefToHexString = (AML_TO_HEX_STRING_OP, "Operand", "Target") 452 453DefToInteger = (AML_TO_INTEGER_OP, "Operand", "Target") 454 455DefToString = (AML_TO_STRING_OP, "TermArg", "LengthArg", "Target") 456LengthArg = ["TermArg"] 457 458DefWait = (AML_WAIT_OP, "EventObject", "Operand") 459 460DefXOr = (AML_XOR_OP, "Operand:LeftOperand", "Operand:RightOperand", "Target") 461 462################################################################################ 463# 20.2.6 Miscellaneous Objects Encoding 464################################################################################ 465 466# 20.2.6.1 Arg Objects Encoding 467################################################################################ 468 469ArgObj = ["Arg0Op", "Arg1Op", "Arg2Op", "Arg3Op", "Arg4Op", "Arg5Op", "Arg6Op"] 470Arg0Op = (AML_ARG0_OP,) 471Arg1Op = (AML_ARG1_OP,) 472Arg2Op = (AML_ARG2_OP,) 473Arg3Op = (AML_ARG3_OP,) 474Arg4Op = (AML_ARG4_OP,) 475Arg5Op = (AML_ARG5_OP,) 476Arg6Op = (AML_ARG6_OP,) 477 478# 20.2.6.2 Local Objects Encoding 479################################################################################ 480 481LocalObj = ["Local0Op", "Local1Op", "Local2Op", "Local3Op", "Local4Op", "Local5Op", "Local6Op", "Local7Op"] 482Local0Op = (AML_LOCAL0_OP,) 483Local1Op = (AML_LOCAL1_OP,) 484Local2Op = (AML_LOCAL2_OP,) 485Local3Op = (AML_LOCAL3_OP,) 486Local4Op = (AML_LOCAL4_OP,) 487Local5Op = (AML_LOCAL5_OP,) 488Local6Op = (AML_LOCAL6_OP,) 489Local7Op = (AML_LOCAL7_OP,) 490 491# 20.2.6.3 Debug Objects Encoding 492################################################################################ 493 494DebugObj = (AML_DEBUG_OP,) 495 496################################################################################ 497# Helper methods 498################################################################################ 499 500def __get_spec(sym, fn): 501 spec = globals()[sym] 502 if isinstance(spec, tuple): 503 return tuple(map(fn, spec)) 504 else: 505 return spec 506 507def get_definition(sym): 508 def __get_definition(elem): 509 return elem.split(":")[0] if isinstance(elem, str) else elem 510 return __get_spec(sym, __get_definition) 511 512def get_names(sym): 513 def __get_names(elem): 514 return elem.split(":")[-1] if isinstance(elem, str) else elem 515 return __get_spec(sym, __get_names) 516