1 /****************************************************************************** 2 * 3 * Name: acdispat.h - dispatcher (parser to interpreter interface) 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2022, Intel Corp. 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 * substantially similar to the "NO WARRANTY" disclaimer below 19 * ("Disclaimer") and any redistribution must be conditioned upon 20 * including a substantially similar Disclaimer requirement for further 21 * binary redistribution. 22 * 3. Neither the names of the above-listed copyright holders nor the names 23 * of any contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * Alternatively, this software may be distributed under the terms of the 27 * GNU General Public License ("GPL") version 2 as published by the Free 28 * Software Foundation. 29 * 30 * NO WARRANTY 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44 #ifndef _ACDISPAT_H_ 45 #define _ACDISPAT_H_ 46 47 48 #define NAMEOF_LOCAL_NTE "__L0" 49 #define NAMEOF_ARG_NTE "__A0" 50 51 52 /* 53 * dsargs - execution of dynamic arguments for static objects 54 */ 55 ACPI_STATUS 56 AcpiDsGetBufferFieldArguments ( 57 ACPI_OPERAND_OBJECT *ObjDesc); 58 59 ACPI_STATUS 60 AcpiDsGetBankFieldArguments ( 61 ACPI_OPERAND_OBJECT *ObjDesc); 62 63 ACPI_STATUS 64 AcpiDsGetRegionArguments ( 65 ACPI_OPERAND_OBJECT *RgnDesc); 66 67 ACPI_STATUS 68 AcpiDsGetBufferArguments ( 69 ACPI_OPERAND_OBJECT *ObjDesc); 70 71 ACPI_STATUS 72 AcpiDsGetPackageArguments ( 73 ACPI_OPERAND_OBJECT *ObjDesc); 74 75 76 /* 77 * dscontrol - support for execution control opcodes 78 */ 79 ACPI_STATUS 80 AcpiDsExecBeginControlOp ( 81 ACPI_WALK_STATE *WalkState, 82 ACPI_PARSE_OBJECT *Op); 83 84 ACPI_STATUS 85 AcpiDsExecEndControlOp ( 86 ACPI_WALK_STATE *WalkState, 87 ACPI_PARSE_OBJECT *Op); 88 89 90 /* 91 * dsopcode - support for late operand evaluation 92 */ 93 ACPI_STATUS 94 AcpiDsEvalBufferFieldOperands ( 95 ACPI_WALK_STATE *WalkState, 96 ACPI_PARSE_OBJECT *Op); 97 98 ACPI_STATUS 99 AcpiDsEvalRegionOperands ( 100 ACPI_WALK_STATE *WalkState, 101 ACPI_PARSE_OBJECT *Op); 102 103 ACPI_STATUS 104 AcpiDsEvalTableRegionOperands ( 105 ACPI_WALK_STATE *WalkState, 106 ACPI_PARSE_OBJECT *Op); 107 108 ACPI_STATUS 109 AcpiDsEvalDataObjectOperands ( 110 ACPI_WALK_STATE *WalkState, 111 ACPI_PARSE_OBJECT *Op, 112 ACPI_OPERAND_OBJECT *ObjDesc); 113 114 ACPI_STATUS 115 AcpiDsEvalBankFieldOperands ( 116 ACPI_WALK_STATE *WalkState, 117 ACPI_PARSE_OBJECT *Op); 118 119 ACPI_STATUS 120 AcpiDsInitializeRegion ( 121 ACPI_HANDLE ObjHandle); 122 123 124 /* 125 * dsexec - Parser/Interpreter interface, method execution callbacks 126 */ 127 ACPI_STATUS 128 AcpiDsGetPredicateValue ( 129 ACPI_WALK_STATE *WalkState, 130 ACPI_OPERAND_OBJECT *ResultObj); 131 132 ACPI_STATUS 133 AcpiDsExecBeginOp ( 134 ACPI_WALK_STATE *WalkState, 135 ACPI_PARSE_OBJECT **OutOp); 136 137 ACPI_STATUS 138 AcpiDsExecEndOp ( 139 ACPI_WALK_STATE *State); 140 141 142 /* 143 * dsfield - Parser/Interpreter interface for AML fields 144 */ 145 ACPI_STATUS 146 AcpiDsCreateField ( 147 ACPI_PARSE_OBJECT *Op, 148 ACPI_NAMESPACE_NODE *RegionNode, 149 ACPI_WALK_STATE *WalkState); 150 151 ACPI_STATUS 152 AcpiDsCreateBankField ( 153 ACPI_PARSE_OBJECT *Op, 154 ACPI_NAMESPACE_NODE *RegionNode, 155 ACPI_WALK_STATE *WalkState); 156 157 ACPI_STATUS 158 AcpiDsCreateIndexField ( 159 ACPI_PARSE_OBJECT *Op, 160 ACPI_NAMESPACE_NODE *RegionNode, 161 ACPI_WALK_STATE *WalkState); 162 163 ACPI_STATUS 164 AcpiDsCreateBufferField ( 165 ACPI_PARSE_OBJECT *Op, 166 ACPI_WALK_STATE *WalkState); 167 168 ACPI_STATUS 169 AcpiDsInitFieldObjects ( 170 ACPI_PARSE_OBJECT *Op, 171 ACPI_WALK_STATE *WalkState); 172 173 174 /* 175 * dsload - Parser/Interpreter interface 176 */ 177 ACPI_STATUS 178 AcpiDsInitCallbacks ( 179 ACPI_WALK_STATE *WalkState, 180 UINT32 PassNumber); 181 182 /* dsload - pass 1 namespace load callbacks */ 183 184 ACPI_STATUS 185 AcpiDsLoad1BeginOp ( 186 ACPI_WALK_STATE *WalkState, 187 ACPI_PARSE_OBJECT **OutOp); 188 189 ACPI_STATUS 190 AcpiDsLoad1EndOp ( 191 ACPI_WALK_STATE *WalkState); 192 193 194 /* dsload - pass 2 namespace load callbacks */ 195 196 ACPI_STATUS 197 AcpiDsLoad2BeginOp ( 198 ACPI_WALK_STATE *WalkState, 199 ACPI_PARSE_OBJECT **OutOp); 200 201 ACPI_STATUS 202 AcpiDsLoad2EndOp ( 203 ACPI_WALK_STATE *WalkState); 204 205 206 /* 207 * dsmthdat - method data (locals/args) 208 */ 209 ACPI_STATUS 210 AcpiDsStoreObjectToLocal ( 211 UINT8 Type, 212 UINT32 Index, 213 ACPI_OPERAND_OBJECT *SrcDesc, 214 ACPI_WALK_STATE *WalkState); 215 216 ACPI_STATUS 217 AcpiDsMethodDataGetEntry ( 218 UINT16 Opcode, 219 UINT32 Index, 220 ACPI_WALK_STATE *WalkState, 221 ACPI_OPERAND_OBJECT ***Node); 222 223 void 224 AcpiDsMethodDataDeleteAll ( 225 ACPI_WALK_STATE *WalkState); 226 227 BOOLEAN 228 AcpiDsIsMethodValue ( 229 ACPI_OPERAND_OBJECT *ObjDesc); 230 231 ACPI_STATUS 232 AcpiDsMethodDataGetValue ( 233 UINT8 Type, 234 UINT32 Index, 235 ACPI_WALK_STATE *WalkState, 236 ACPI_OPERAND_OBJECT **DestDesc); 237 238 ACPI_STATUS 239 AcpiDsMethodDataInitArgs ( 240 ACPI_OPERAND_OBJECT **Params, 241 UINT32 MaxParamCount, 242 ACPI_WALK_STATE *WalkState); 243 244 ACPI_STATUS 245 AcpiDsMethodDataGetNode ( 246 UINT8 Type, 247 UINT32 Index, 248 ACPI_WALK_STATE *WalkState, 249 ACPI_NAMESPACE_NODE **Node); 250 251 void 252 AcpiDsMethodDataInit ( 253 ACPI_WALK_STATE *WalkState); 254 255 256 /* 257 * dsmethod - Parser/Interpreter interface - control method parsing 258 */ 259 ACPI_STATUS 260 AcpiDsAutoSerializeMethod ( 261 ACPI_NAMESPACE_NODE *Node, 262 ACPI_OPERAND_OBJECT *ObjDesc); 263 264 ACPI_STATUS 265 AcpiDsCallControlMethod ( 266 ACPI_THREAD_STATE *Thread, 267 ACPI_WALK_STATE *WalkState, 268 ACPI_PARSE_OBJECT *Op); 269 270 ACPI_STATUS 271 AcpiDsRestartControlMethod ( 272 ACPI_WALK_STATE *WalkState, 273 ACPI_OPERAND_OBJECT *ReturnDesc); 274 275 void 276 AcpiDsTerminateControlMethod ( 277 ACPI_OPERAND_OBJECT *MethodDesc, 278 ACPI_WALK_STATE *WalkState); 279 280 ACPI_STATUS 281 AcpiDsBeginMethodExecution ( 282 ACPI_NAMESPACE_NODE *MethodNode, 283 ACPI_OPERAND_OBJECT *ObjDesc, 284 ACPI_WALK_STATE *WalkState); 285 286 ACPI_STATUS 287 AcpiDsMethodError ( 288 ACPI_STATUS Status, 289 ACPI_WALK_STATE *WalkState); 290 291 /* 292 * dsinit 293 */ 294 ACPI_STATUS 295 AcpiDsInitializeObjects ( 296 UINT32 TableIndex, 297 ACPI_NAMESPACE_NODE *StartNode); 298 299 300 /* 301 * dsobject - Parser/Interpreter interface - object initialization and conversion 302 */ 303 ACPI_STATUS 304 AcpiDsBuildInternalObject ( 305 ACPI_WALK_STATE *WalkState, 306 ACPI_PARSE_OBJECT *Op, 307 ACPI_OPERAND_OBJECT **ObjDescPtr); 308 309 ACPI_STATUS 310 AcpiDsBuildInternalBufferObj ( 311 ACPI_WALK_STATE *WalkState, 312 ACPI_PARSE_OBJECT *Op, 313 UINT32 BufferLength, 314 ACPI_OPERAND_OBJECT **ObjDescPtr); 315 316 ACPI_STATUS 317 AcpiDsBuildInternalPackageObj ( 318 ACPI_WALK_STATE *WalkState, 319 ACPI_PARSE_OBJECT *op, 320 UINT32 PackageLength, 321 ACPI_OPERAND_OBJECT **ObjDesc); 322 323 ACPI_STATUS 324 AcpiDsInitObjectFromOp ( 325 ACPI_WALK_STATE *WalkState, 326 ACPI_PARSE_OBJECT *Op, 327 UINT16 Opcode, 328 ACPI_OPERAND_OBJECT **ObjDesc); 329 330 ACPI_STATUS 331 AcpiDsCreateNode ( 332 ACPI_WALK_STATE *WalkState, 333 ACPI_NAMESPACE_NODE *Node, 334 ACPI_PARSE_OBJECT *Op); 335 336 337 /* 338 * dspkginit - Package object initialization 339 */ 340 ACPI_STATUS 341 AcpiDsInitPackageElement ( 342 UINT8 ObjectType, 343 ACPI_OPERAND_OBJECT *SourceObject, 344 ACPI_GENERIC_STATE *State, 345 void *Context); 346 347 348 /* 349 * dsutils - Parser/Interpreter interface utility routines 350 */ 351 void 352 AcpiDsClearImplicitReturn ( 353 ACPI_WALK_STATE *WalkState); 354 355 BOOLEAN 356 AcpiDsDoImplicitReturn ( 357 ACPI_OPERAND_OBJECT *ReturnDesc, 358 ACPI_WALK_STATE *WalkState, 359 BOOLEAN AddReference); 360 361 BOOLEAN 362 AcpiDsIsResultUsed ( 363 ACPI_PARSE_OBJECT *Op, 364 ACPI_WALK_STATE *WalkState); 365 366 void 367 AcpiDsDeleteResultIfNotUsed ( 368 ACPI_PARSE_OBJECT *Op, 369 ACPI_OPERAND_OBJECT *ResultObj, 370 ACPI_WALK_STATE *WalkState); 371 372 ACPI_STATUS 373 AcpiDsCreateOperand ( 374 ACPI_WALK_STATE *WalkState, 375 ACPI_PARSE_OBJECT *Arg, 376 UINT32 ArgsRemaining); 377 378 ACPI_STATUS 379 AcpiDsCreateOperands ( 380 ACPI_WALK_STATE *WalkState, 381 ACPI_PARSE_OBJECT *FirstArg); 382 383 ACPI_STATUS 384 AcpiDsResolveOperands ( 385 ACPI_WALK_STATE *WalkState); 386 387 void 388 AcpiDsClearOperands ( 389 ACPI_WALK_STATE *WalkState); 390 391 ACPI_STATUS 392 AcpiDsEvaluateNamePath ( 393 ACPI_WALK_STATE *WalkState); 394 395 396 /* 397 * dswscope - Scope Stack manipulation 398 */ 399 ACPI_STATUS 400 AcpiDsScopeStackPush ( 401 ACPI_NAMESPACE_NODE *Node, 402 ACPI_OBJECT_TYPE Type, 403 ACPI_WALK_STATE *WalkState); 404 405 406 ACPI_STATUS 407 AcpiDsScopeStackPop ( 408 ACPI_WALK_STATE *WalkState); 409 410 void 411 AcpiDsScopeStackClear ( 412 ACPI_WALK_STATE *WalkState); 413 414 415 /* 416 * dswstate - parser WALK_STATE management routines 417 */ 418 ACPI_STATUS 419 AcpiDsObjStackPush ( 420 void *Object, 421 ACPI_WALK_STATE *WalkState); 422 423 ACPI_STATUS 424 AcpiDsObjStackPop ( 425 UINT32 PopCount, 426 ACPI_WALK_STATE *WalkState); 427 428 ACPI_WALK_STATE * 429 AcpiDsCreateWalkState ( 430 ACPI_OWNER_ID OwnerId, 431 ACPI_PARSE_OBJECT *Origin, 432 ACPI_OPERAND_OBJECT *MthDesc, 433 ACPI_THREAD_STATE *Thread); 434 435 ACPI_STATUS 436 AcpiDsInitAmlWalk ( 437 ACPI_WALK_STATE *WalkState, 438 ACPI_PARSE_OBJECT *Op, 439 ACPI_NAMESPACE_NODE *MethodNode, 440 UINT8 *AmlStart, 441 UINT32 AmlLength, 442 ACPI_EVALUATE_INFO *Info, 443 UINT8 PassNumber); 444 445 void 446 AcpiDsObjStackPopAndDelete ( 447 UINT32 PopCount, 448 ACPI_WALK_STATE *WalkState); 449 450 void 451 AcpiDsDeleteWalkState ( 452 ACPI_WALK_STATE *WalkState); 453 454 ACPI_WALK_STATE * 455 AcpiDsPopWalkState ( 456 ACPI_THREAD_STATE *Thread); 457 458 void 459 AcpiDsPushWalkState ( 460 ACPI_WALK_STATE *WalkState, 461 ACPI_THREAD_STATE *Thread); 462 463 ACPI_STATUS 464 AcpiDsResultStackClear ( 465 ACPI_WALK_STATE *WalkState); 466 467 ACPI_WALK_STATE * 468 AcpiDsGetCurrentWalkState ( 469 ACPI_THREAD_STATE *Thread); 470 471 ACPI_STATUS 472 AcpiDsResultPop ( 473 ACPI_OPERAND_OBJECT **Object, 474 ACPI_WALK_STATE *WalkState); 475 476 ACPI_STATUS 477 AcpiDsResultPush ( 478 ACPI_OPERAND_OBJECT *Object, 479 ACPI_WALK_STATE *WalkState); 480 481 482 /* 483 * dsdebug - parser debugging routines 484 */ 485 void 486 AcpiDsDumpMethodStack ( 487 ACPI_STATUS Status, 488 ACPI_WALK_STATE *WalkState, 489 ACPI_PARSE_OBJECT *Op); 490 491 #endif /* _ACDISPAT_H_ */ 492