Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/dispatcher/dswload2.c
+++ new/usr/src/common/acpica/components/dispatcher/dswload2.c
1 1 /******************************************************************************
2 2 *
3 3 * Module Name: dswload2 - Dispatcher second pass namespace load callbacks
4 4 *
5 5 *****************************************************************************/
6 6
7 7 /*
8 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2014, Intel Corp.
9 9 * All rights reserved.
10 10 *
11 11 * Redistribution and use in source and binary forms, with or without
12 12 * modification, are permitted provided that the following conditions
13 13 * are met:
14 14 * 1. Redistributions of source code must retain the above copyright
15 15 * notice, this list of conditions, and the following disclaimer,
16 16 * without modification.
17 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 18 * substantially similar to the "NO WARRANTY" disclaimer below
19 19 * ("Disclaimer") and any redistribution must be conditioned upon
20 20 * including a substantially similar Disclaimer requirement for further
21 21 * binary redistribution.
22 22 * 3. Neither the names of the above-listed copyright holders nor the names
23 23 * of any contributors may be used to endorse or promote products derived
24 24 * from this software without specific prior written permission.
25 25 *
26 26 * Alternatively, this software may be distributed under the terms of the
27 27 * GNU General Public License ("GPL") version 2 as published by the Free
28 28 * Software Foundation.
29 29 *
30 30 * NO WARRANTY
31 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 41 * POSSIBILITY OF SUCH DAMAGES.
42 42 */
43 43
44 44 #define __DSWLOAD2_C__
45 45
46 46 #include "acpi.h"
47 47 #include "accommon.h"
48 48 #include "acparser.h"
49 49 #include "amlcode.h"
50 50 #include "acdispat.h"
51 51 #include "acinterp.h"
52 52 #include "acnamesp.h"
53 53 #include "acevents.h"
54 54
55 55 #define _COMPONENT ACPI_DISPATCHER
56 56 ACPI_MODULE_NAME ("dswload2")
57 57
58 58
59 59 /*******************************************************************************
60 60 *
61 61 * FUNCTION: AcpiDsLoad2BeginOp
62 62 *
63 63 * PARAMETERS: WalkState - Current state of the parse tree walk
64 64 * OutOp - Wher to return op if a new one is created
65 65 *
66 66 * RETURN: Status
67 67 *
68 68 * DESCRIPTION: Descending callback used during the loading of ACPI tables.
69 69 *
70 70 ******************************************************************************/
71 71
72 72 ACPI_STATUS
73 73 AcpiDsLoad2BeginOp (
74 74 ACPI_WALK_STATE *WalkState,
75 75 ACPI_PARSE_OBJECT **OutOp)
76 76 {
77 77 ACPI_PARSE_OBJECT *Op;
78 78 ACPI_NAMESPACE_NODE *Node;
79 79 ACPI_STATUS Status;
80 80 ACPI_OBJECT_TYPE ObjectType;
81 81 char *BufferPtr;
82 82 UINT32 Flags;
83 83
84 84
85 85 ACPI_FUNCTION_TRACE (DsLoad2BeginOp);
86 86
87 87
88 88 Op = WalkState->Op;
89 89 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
90 90
91 91 if (Op)
92 92 {
93 93 if ((WalkState->ControlState) &&
94 94 (WalkState->ControlState->Common.State ==
95 95 ACPI_CONTROL_CONDITIONAL_EXECUTING))
96 96 {
97 97 /* We are executing a while loop outside of a method */
98 98
99 99 Status = AcpiDsExecBeginOp (WalkState, OutOp);
100 100 return_ACPI_STATUS (Status);
101 101 }
102 102
103 103 /* We only care about Namespace opcodes here */
104 104
105 105 if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) &&
106 106 (WalkState->Opcode != AML_INT_NAMEPATH_OP)) ||
107 107 (!(WalkState->OpInfo->Flags & AML_NAMED)))
108 108 {
109 109 return_ACPI_STATUS (AE_OK);
110 110 }
111 111
112 112 /* Get the name we are going to enter or lookup in the namespace */
113 113
114 114 if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
115 115 {
116 116 /* For Namepath op, get the path string */
117 117
118 118 BufferPtr = Op->Common.Value.String;
119 119 if (!BufferPtr)
120 120 {
121 121 /* No name, just exit */
122 122
123 123 return_ACPI_STATUS (AE_OK);
124 124 }
125 125 }
126 126 else
127 127 {
128 128 /* Get name from the op */
129 129
130 130 BufferPtr = ACPI_CAST_PTR (char, &Op->Named.Name);
131 131 }
132 132 }
133 133 else
134 134 {
135 135 /* Get the namestring from the raw AML */
136 136
137 137 BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState);
138 138 }
139 139
140 140 /* Map the opcode into an internal object type */
141 141
142 142 ObjectType = WalkState->OpInfo->ObjectType;
143 143
144 144 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
145 145 "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType));
146 146
147 147 switch (WalkState->Opcode)
148 148 {
149 149 case AML_FIELD_OP:
150 150 case AML_BANK_FIELD_OP:
151 151 case AML_INDEX_FIELD_OP:
152 152
153 153 Node = NULL;
154 154 Status = AE_OK;
155 155 break;
156 156
157 157 case AML_INT_NAMEPATH_OP:
158 158 /*
159 159 * The NamePath is an object reference to an existing object.
160 160 * Don't enter the name into the namespace, but look it up
161 161 * for use later.
162 162 */
163 163 Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
164 164 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
165 165 WalkState, &(Node));
166 166 break;
167 167
168 168 case AML_SCOPE_OP:
169 169
170 170 /* Special case for Scope(\) -> refers to the Root node */
171 171
172 172 if (Op && (Op->Named.Node == AcpiGbl_RootNode))
173 173 {
174 174 Node = Op->Named.Node;
175 175
176 176 Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
177 177 if (ACPI_FAILURE (Status))
178 178 {
179 179 return_ACPI_STATUS (Status);
180 180 }
181 181 }
182 182 else
183 183 {
184 184 /*
185 185 * The Path is an object reference to an existing object.
186 186 * Don't enter the name into the namespace, but look it up
187 187 * for use later.
188 188 */
189 189 Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
190 190 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
191 191 WalkState, &(Node));
192 192 if (ACPI_FAILURE (Status))
193 193 {
194 194 #ifdef ACPI_ASL_COMPILER
195 195 if (Status == AE_NOT_FOUND)
196 196 {
197 197 Status = AE_OK;
198 198 }
199 199 else
200 200 {
201 201 ACPI_ERROR_NAMESPACE (BufferPtr, Status);
202 202 }
203 203 #else
204 204 ACPI_ERROR_NAMESPACE (BufferPtr, Status);
205 205 #endif
206 206 return_ACPI_STATUS (Status);
207 207 }
208 208 }
209 209
210 210 /*
211 211 * We must check to make sure that the target is
212 212 * one of the opcodes that actually opens a scope
213 213 */
214 214 switch (Node->Type)
215 215 {
216 216 case ACPI_TYPE_ANY:
217 217 case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
218 218 case ACPI_TYPE_DEVICE:
219 219 case ACPI_TYPE_POWER:
220 220 case ACPI_TYPE_PROCESSOR:
221 221 case ACPI_TYPE_THERMAL:
222 222
223 223 /* These are acceptable types */
224 224 break;
225 225
226 226 case ACPI_TYPE_INTEGER:
227 227 case ACPI_TYPE_STRING:
228 228 case ACPI_TYPE_BUFFER:
↓ open down ↓ |
210 lines elided |
↑ open up ↑ |
229 229
230 230 /*
231 231 * These types we will allow, but we will change the type.
232 232 * This enables some existing code of the form:
233 233 *
234 234 * Name (DEB, 0)
235 235 * Scope (DEB) { ... }
236 236 */
237 237 ACPI_WARNING ((AE_INFO,
238 238 "Type override - [%4.4s] had invalid type (%s) "
239 - "for Scope operator, changed to type ANY\n",
239 + "for Scope operator, changed to type ANY",
240 240 AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type)));
241 241
242 242 Node->Type = ACPI_TYPE_ANY;
243 243 WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
244 244 break;
245 245
246 + case ACPI_TYPE_METHOD:
247 +
248 + /*
249 + * Allow scope change to root during execution of module-level
250 + * code. Root is typed METHOD during this time.
251 + */
252 + if ((Node == AcpiGbl_RootNode) &&
253 + (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
254 + {
255 + break;
256 + }
257 +
258 + /*lint -fallthrough */
259 +
246 260 default:
247 261
248 262 /* All other types are an error */
249 263
250 264 ACPI_ERROR ((AE_INFO,
251 265 "Invalid type (%s) for target of "
252 266 "Scope operator [%4.4s] (Cannot override)",
253 267 AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node)));
254 268
255 - return (AE_AML_OPERAND_TYPE);
269 + return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
256 270 }
257 271 break;
258 272
259 273 default:
260 274
261 275 /* All other opcodes */
262 276
263 277 if (Op && Op->Common.Node)
264 278 {
265 279 /* This op/node was previously entered into the namespace */
266 280
267 281 Node = Op->Common.Node;
268 282
269 283 if (AcpiNsOpensScope (ObjectType))
270 284 {
271 285 Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
272 286 if (ACPI_FAILURE (Status))
273 287 {
274 288 return_ACPI_STATUS (Status);
275 289 }
276 290 }
277 291
278 292 return_ACPI_STATUS (AE_OK);
279 293 }
280 294
281 295 /*
282 296 * Enter the named type into the internal namespace. We enter the name
283 297 * as we go downward in the parse tree. Any necessary subobjects that
284 298 * involve arguments to the opcode must be created as we go back up the
285 299 * parse tree later.
286 300 *
287 301 * Note: Name may already exist if we are executing a deferred opcode.
288 302 */
289 303 if (WalkState->DeferredNode)
290 304 {
291 305 /* This name is already in the namespace, get the node */
292 306
293 307 Node = WalkState->DeferredNode;
294 308 Status = AE_OK;
295 309 break;
296 310 }
297 311
298 312 Flags = ACPI_NS_NO_UPSEARCH;
299 313 if (WalkState->PassNumber == ACPI_IMODE_EXECUTE)
300 314 {
301 315 /* Execution mode, node cannot already exist, node is temporary */
302 316
303 317 Flags |= ACPI_NS_ERROR_IF_FOUND;
304 318
305 319 if (!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
306 320 {
307 321 Flags |= ACPI_NS_TEMPORARY;
308 322 }
309 323 }
310 324
311 325 /* Add new entry or lookup existing entry */
312 326
313 327 Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
314 328 ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node);
315 329
316 330 if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY))
317 331 {
318 332 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
319 333 "***New Node [%4.4s] %p is temporary\n",
320 334 AcpiUtGetNodeName (Node), Node));
321 335 }
322 336 break;
323 337 }
324 338
325 339 if (ACPI_FAILURE (Status))
326 340 {
327 341 ACPI_ERROR_NAMESPACE (BufferPtr, Status);
328 342 return_ACPI_STATUS (Status);
329 343 }
330 344
331 345 if (!Op)
332 346 {
333 347 /* Create a new op */
334 348
335 349 Op = AcpiPsAllocOp (WalkState->Opcode);
336 350 if (!Op)
337 351 {
338 352 return_ACPI_STATUS (AE_NO_MEMORY);
339 353 }
340 354
341 355 /* Initialize the new op */
342 356
343 357 if (Node)
344 358 {
345 359 Op->Named.Name = Node->Name.Integer;
346 360 }
347 361 *OutOp = Op;
348 362 }
349 363
350 364 /*
351 365 * Put the Node in the "op" object that the parser uses, so we
352 366 * can get it again quickly when this scope is closed
353 367 */
354 368 Op->Common.Node = Node;
355 369 return_ACPI_STATUS (Status);
356 370 }
357 371
358 372
359 373 /*******************************************************************************
360 374 *
361 375 * FUNCTION: AcpiDsLoad2EndOp
362 376 *
363 377 * PARAMETERS: WalkState - Current state of the parse tree walk
364 378 *
365 379 * RETURN: Status
366 380 *
367 381 * DESCRIPTION: Ascending callback used during the loading of the namespace,
368 382 * both control methods and everything else.
369 383 *
370 384 ******************************************************************************/
371 385
372 386 ACPI_STATUS
373 387 AcpiDsLoad2EndOp (
374 388 ACPI_WALK_STATE *WalkState)
375 389 {
376 390 ACPI_PARSE_OBJECT *Op;
377 391 ACPI_STATUS Status = AE_OK;
378 392 ACPI_OBJECT_TYPE ObjectType;
379 393 ACPI_NAMESPACE_NODE *Node;
380 394 ACPI_PARSE_OBJECT *Arg;
381 395 ACPI_NAMESPACE_NODE *NewNode;
382 396 #ifndef ACPI_NO_METHOD_EXECUTION
383 397 UINT32 i;
384 398 UINT8 RegionSpace;
385 399 #endif
386 400
387 401
388 402 ACPI_FUNCTION_TRACE (DsLoad2EndOp);
389 403
390 404 Op = WalkState->Op;
391 405 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
392 406 WalkState->OpInfo->Name, Op, WalkState));
393 407
394 408 /* Check if opcode had an associated namespace object */
395 409
396 410 if (!(WalkState->OpInfo->Flags & AML_NSOBJECT))
397 411 {
398 412 return_ACPI_STATUS (AE_OK);
399 413 }
400 414
401 415 if (Op->Common.AmlOpcode == AML_SCOPE_OP)
402 416 {
403 417 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
404 418 "Ending scope Op=%p State=%p\n", Op, WalkState));
405 419 }
406 420
407 421 ObjectType = WalkState->OpInfo->ObjectType;
408 422
409 423 /*
410 424 * Get the Node/name from the earlier lookup
411 425 * (It was saved in the *op structure)
412 426 */
413 427 Node = Op->Common.Node;
414 428
415 429 /*
416 430 * Put the Node on the object stack (Contains the ACPI Name of
417 431 * this object)
418 432 */
419 433 WalkState->Operands[0] = (void *) Node;
420 434 WalkState->NumOperands = 1;
421 435
422 436 /* Pop the scope stack */
423 437
424 438 if (AcpiNsOpensScope (ObjectType) &&
425 439 (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP))
426 440 {
427 441 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
428 442 AcpiUtGetTypeName (ObjectType), Op));
429 443
430 444 Status = AcpiDsScopeStackPop (WalkState);
431 445 if (ACPI_FAILURE (Status))
432 446 {
433 447 goto Cleanup;
434 448 }
435 449 }
436 450
437 451 /*
438 452 * Named operations are as follows:
439 453 *
440 454 * AML_ALIAS
441 455 * AML_BANKFIELD
442 456 * AML_CREATEBITFIELD
443 457 * AML_CREATEBYTEFIELD
444 458 * AML_CREATEDWORDFIELD
445 459 * AML_CREATEFIELD
446 460 * AML_CREATEQWORDFIELD
447 461 * AML_CREATEWORDFIELD
448 462 * AML_DATA_REGION
449 463 * AML_DEVICE
450 464 * AML_EVENT
451 465 * AML_FIELD
452 466 * AML_INDEXFIELD
453 467 * AML_METHOD
454 468 * AML_METHODCALL
455 469 * AML_MUTEX
456 470 * AML_NAME
457 471 * AML_NAMEDFIELD
458 472 * AML_OPREGION
459 473 * AML_POWERRES
460 474 * AML_PROCESSOR
461 475 * AML_SCOPE
462 476 * AML_THERMALZONE
463 477 */
464 478
465 479 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
466 480 "Create-Load [%s] State=%p Op=%p NamedObj=%p\n",
467 481 AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node));
468 482
469 483 /* Decode the opcode */
470 484
471 485 Arg = Op->Common.Value.Arg;
472 486
473 487 switch (WalkState->OpInfo->Type)
474 488 {
↓ open down ↓ |
209 lines elided |
↑ open up ↑ |
475 489 #ifndef ACPI_NO_METHOD_EXECUTION
476 490
477 491 case AML_TYPE_CREATE_FIELD:
478 492 /*
479 493 * Create the field object, but the field buffer and index must
480 494 * be evaluated later during the execution phase
481 495 */
482 496 Status = AcpiDsCreateBufferField (Op, WalkState);
483 497 break;
484 498
485 -
486 499 case AML_TYPE_NAMED_FIELD:
487 500 /*
488 501 * If we are executing a method, initialize the field
489 502 */
490 503 if (WalkState->MethodNode)
491 504 {
492 505 Status = AcpiDsInitFieldObjects (Op, WalkState);
493 506 }
494 507
495 508 switch (Op->Common.AmlOpcode)
496 509 {
497 510 case AML_INDEX_FIELD_OP:
498 511
499 512 Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node,
500 513 WalkState);
501 514 break;
502 515
503 516 case AML_BANK_FIELD_OP:
↓ open down ↓ |
8 lines elided |
↑ open up ↑ |
504 517
505 518 Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState);
506 519 break;
507 520
508 521 case AML_FIELD_OP:
509 522
510 523 Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState);
511 524 break;
512 525
513 526 default:
527 +
514 528 /* All NAMED_FIELD opcodes must be handled above */
515 529 break;
516 530 }
517 531 break;
518 532
519 -
520 533 case AML_TYPE_NAMED_SIMPLE:
521 534
522 535 Status = AcpiDsCreateOperands (WalkState, Arg);
523 536 if (ACPI_FAILURE (Status))
524 537 {
525 538 goto Cleanup;
526 539 }
527 540
528 541 switch (Op->Common.AmlOpcode)
529 542 {
530 543 case AML_PROCESSOR_OP:
531 544
532 545 Status = AcpiExCreateProcessor (WalkState);
533 546 break;
534 547
535 548 case AML_POWER_RES_OP:
536 549
537 550 Status = AcpiExCreatePowerResource (WalkState);
538 551 break;
539 552
↓ open down ↓ |
10 lines elided |
↑ open up ↑ |
540 553 case AML_MUTEX_OP:
541 554
542 555 Status = AcpiExCreateMutex (WalkState);
543 556 break;
544 557
545 558 case AML_EVENT_OP:
546 559
547 560 Status = AcpiExCreateEvent (WalkState);
548 561 break;
549 562
550 -
551 563 case AML_ALIAS_OP:
552 564
553 565 Status = AcpiExCreateAlias (WalkState);
554 566 break;
555 567
556 568 default:
569 +
557 570 /* Unknown opcode */
558 571
559 572 Status = AE_OK;
560 573 goto Cleanup;
561 574 }
562 575
563 576 /* Delete operands */
564 577
565 578 for (i = 1; i < WalkState->NumOperands; i++)
566 579 {
567 580 AcpiUtRemoveReference (WalkState->Operands[i]);
568 581 WalkState->Operands[i] = NULL;
569 582 }
570 583
571 584 break;
572 585 #endif /* ACPI_NO_METHOD_EXECUTION */
573 586
574 587 case AML_TYPE_NAMED_COMPLEX:
575 588
576 589 switch (Op->Common.AmlOpcode)
577 590 {
578 591 #ifndef ACPI_NO_METHOD_EXECUTION
579 592 case AML_REGION_OP:
580 593 case AML_DATA_REGION_OP:
581 594
582 595 if (Op->Common.AmlOpcode == AML_REGION_OP)
583 596 {
584 597 RegionSpace = (ACPI_ADR_SPACE_TYPE)
585 598 ((Op->Common.Value.Arg)->Common.Value.Integer);
586 599 }
587 600 else
588 601 {
589 602 RegionSpace = ACPI_ADR_SPACE_DATA_TABLE;
590 603 }
591 604
592 605 /*
593 606 * The OpRegion is not fully parsed at this time. The only valid
594 607 * argument is the SpaceId. (We must save the address of the
595 608 * AML of the address and length operands)
596 609 *
597 610 * If we have a valid region, initialize it. The namespace is
598 611 * unlocked at this point.
599 612 *
600 613 * Need to unlock interpreter if it is locked (if we are running
601 614 * a control method), in order to allow _REG methods to be run
602 615 * during AcpiEvInitializeRegion.
603 616 */
↓ open down ↓ |
37 lines elided |
↑ open up ↑ |
604 617 if (WalkState->MethodNode)
605 618 {
606 619 /*
607 620 * Executing a method: initialize the region and unlock
608 621 * the interpreter
609 622 */
610 623 Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
611 624 RegionSpace, WalkState);
612 625 if (ACPI_FAILURE (Status))
613 626 {
614 - return (Status);
627 + return_ACPI_STATUS (Status);
615 628 }
616 629
617 630 AcpiExExitInterpreter ();
618 631 }
619 632
620 633 Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node),
621 634 FALSE);
622 635 if (WalkState->MethodNode)
623 636 {
624 637 AcpiExEnterInterpreter ();
625 638 }
626 639
627 640 if (ACPI_FAILURE (Status))
628 641 {
629 642 /*
630 643 * If AE_NOT_EXIST is returned, it is not fatal
↓ open down ↓ |
6 lines elided |
↑ open up ↑ |
631 644 * because many regions get created before a handler
632 645 * is installed for said region.
633 646 */
634 647 if (AE_NOT_EXIST == Status)
635 648 {
636 649 Status = AE_OK;
637 650 }
638 651 }
639 652 break;
640 653
641 -
642 654 case AML_NAME_OP:
643 655
644 656 Status = AcpiDsCreateNode (WalkState, Node, Op);
645 657 break;
646 658
647 -
648 659 case AML_METHOD_OP:
649 660 /*
650 661 * MethodOp PkgLength NameString MethodFlags TermList
651 662 *
652 663 * Note: We must create the method node/object pair as soon as we
653 664 * see the method declaration. This allows later pass1 parsing
654 665 * of invocations of the method (need to know the number of
655 666 * arguments.)
656 667 */
657 668 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
658 669 "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
659 670 WalkState, Op, Op->Named.Node));
660 671
661 672 if (!AcpiNsGetAttachedObject (Op->Named.Node))
662 673 {
663 674 WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node);
664 675 WalkState->NumOperands = 1;
665 676
666 677 Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
667 678 if (ACPI_SUCCESS (Status))
668 679 {
669 680 Status = AcpiExCreateMethod (Op->Named.Data,
670 681 Op->Named.Length, WalkState);
671 682 }
672 683 WalkState->Operands[0] = NULL;
673 684 WalkState->NumOperands = 0;
674 685
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
675 686 if (ACPI_FAILURE (Status))
676 687 {
677 688 return_ACPI_STATUS (Status);
678 689 }
679 690 }
680 691 break;
681 692
682 693 #endif /* ACPI_NO_METHOD_EXECUTION */
683 694
684 695 default:
696 +
685 697 /* All NAMED_COMPLEX opcodes must be handled above */
686 698 break;
687 699 }
688 700 break;
689 701
690 -
691 702 case AML_CLASS_INTERNAL:
692 703
693 704 /* case AML_INT_NAMEPATH_OP: */
694 705 break;
695 706
696 -
697 707 case AML_CLASS_METHOD_CALL:
698 708
699 709 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
700 710 "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
701 711 WalkState, Op, Node));
702 712
703 713 /*
704 714 * Lookup the method name and save the Node
705 715 */
706 716 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
707 717 ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
708 718 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
709 719 WalkState, &(NewNode));
710 720 if (ACPI_SUCCESS (Status))
711 721 {
712 722 /*
713 723 * Make sure that what we found is indeed a method
714 724 * We didn't search for a method on purpose, to see if the name
715 725 * would resolve
716 726 */
717 727 if (NewNode->Type != ACPI_TYPE_METHOD)
718 728 {
719 729 Status = AE_AML_OPERAND_TYPE;
720 730 }
721 731
722 732 /* We could put the returned object (Node) on the object stack for
723 733 * later, but for now, we will put it in the "op" object that the
724 734 * parser uses, so we can get it again at the end of this scope
725 735 */
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
726 736 Op->Common.Node = NewNode;
727 737 }
728 738 else
729 739 {
730 740 ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
731 741 }
732 742 break;
733 743
734 744
735 745 default:
746 +
736 747 break;
737 748 }
738 749
739 750 Cleanup:
740 751
741 752 /* Remove the Node pushed at the very beginning */
742 753
743 754 WalkState->Operands[0] = NULL;
744 755 WalkState->NumOperands = 0;
745 756 return_ACPI_STATUS (Status);
746 757 }
747 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX