Deleted Added
sdiff udiff text old ( 80062 ) new ( 82367 )
full compact
1/*******************************************************************************
2 *
3 * Module Name: dsutils - Dispatcher utilities
4 * $Revision: 62 $
5 *
6 ******************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.

--- 139 unchanged lines hidden (view full) ---

152
153 FUNCTION_TRACE_PTR ("DsIsResultUsed", Op);
154
155
156 /* Must have both an Op and a Result Object */
157
158 if (!Op)
159 {
160 DEBUG_PRINTP (ACPI_ERROR, ("Null Op\n"));
161 return_VALUE (TRUE);
162 }
163
164
165 /*
166 * If there is no parent, the result can't possibly be used!
167 * (An executing method typically has no parent, since each
168 * method is parsed separately) However, a method that is

--- 7 unchanged lines hidden (view full) ---

176
177 /*
178 * Get info on the parent. The root Op is AML_SCOPE
179 */
180
181 ParentInfo = AcpiPsGetOpcodeInfo (Op->Parent->Opcode);
182 if (ACPI_GET_OP_TYPE (ParentInfo) != ACPI_OP_TYPE_OPCODE)
183 {
184 DEBUG_PRINTP (ACPI_ERROR, ("Unknown parent opcode. Op=%X\n", Op));
185 return_VALUE (FALSE);
186 }
187
188
189 /*
190 * Decide what to do with the result based on the parent. If
191 * the parent opcode will not use the result, delete the object.
192 * Otherwise leave it as is, it will be deleted when it is used

--- 8 unchanged lines hidden (view full) ---

201 case OPTYPE_CONTROL: /* IF, ELSE, WHILE only */
202
203 switch (Op->Parent->Opcode)
204 {
205 case AML_RETURN_OP:
206
207 /* Never delete the return value associated with a return opcode */
208
209 DEBUG_PRINTP (TRACE_DISPATCH,
210 ("Result used, [RETURN] opcode=%X Op=%X\n", Op->Opcode, Op));
211 return_VALUE (TRUE);
212 break;
213
214 case AML_IF_OP:
215 case AML_WHILE_OP:
216
217 /*
218 * If we are executing the predicate AND this is the predicate op,
219 * we will use the return value!
220 */
221
222 if ((WalkState->ControlState->Common.State == CONTROL_PREDICATE_EXECUTING) &&
223 (WalkState->ControlState->Control.PredicateOp == Op))
224 {
225 DEBUG_PRINTP (TRACE_DISPATCH,
226 ("Result used as a predicate, [IF/WHILE] opcode=%X Op=%X\n",
227 Op->Opcode, Op));
228 return_VALUE (TRUE);
229 }
230
231 break;
232 }
233
234

--- 9 unchanged lines hidden (view full) ---

244 if ((Op->Parent->Opcode == AML_REGION_OP) ||
245 (Op->Parent->Opcode == AML_CREATE_FIELD_OP) ||
246 (Op->Parent->Opcode == AML_CREATE_BIT_FIELD_OP) ||
247 (Op->Parent->Opcode == AML_CREATE_BYTE_FIELD_OP) ||
248 (Op->Parent->Opcode == AML_CREATE_WORD_FIELD_OP) ||
249 (Op->Parent->Opcode == AML_CREATE_DWORD_FIELD_OP) ||
250 (Op->Parent->Opcode == AML_CREATE_QWORD_FIELD_OP))
251 {
252 DEBUG_PRINTP (TRACE_DISPATCH,
253 ("Result used, [Region or CreateField] opcode=%X Op=%X\n",
254 Op->Opcode, Op));
255 return_VALUE (TRUE);
256 }
257
258 DEBUG_PRINTP (TRACE_DISPATCH,
259 ("Result not used, Parent opcode=%X Op=%X\n", Op->Opcode, Op));
260
261 return_VALUE (FALSE);
262 break;
263
264 /*
265 * In all other cases. the parent will actually use the return
266 * object, so keep it.
267 */

--- 32 unchanged lines hidden (view full) ---

300 ACPI_STATUS Status;
301
302
303 FUNCTION_TRACE_PTR ("DsDeleteResultIfNotUsed", ResultObj);
304
305
306 if (!Op)
307 {
308 DEBUG_PRINTP (ACPI_ERROR, ("Null Op\n"));
309 return_VOID;
310 }
311
312 if (!ResultObj)
313 {
314 return_VOID;
315 }
316
317
318 if (!AcpiDsIsResultUsed (Op, WalkState))
319 {
320 /*
321 * Must pop the result stack (ObjDesc should be equal
322 * to ResultObj)
323 */
324
325 Status = AcpiDsResultPop (&ObjDesc, WalkState);
326 if (ACPI_SUCCESS (Status))
327 {
328 AcpiUtRemoveReference (ResultObj);
329 }
330 }
331
332 return_VOID;

--- 36 unchanged lines hidden (view full) ---

369 FUNCTION_TRACE_PTR ("DsCreateOperand", Arg);
370
371
372 /* A valid name must be looked up in the namespace */
373
374 if ((Arg->Opcode == AML_INT_NAMEPATH_OP) &&
375 (Arg->Value.String))
376 {
377 DEBUG_PRINTP (TRACE_DISPATCH, ("Getting a name: Arg=%p\n", Arg));
378
379 /* Get the entire name string from the AML stream */
380
381 Status = AcpiExGetNameString (ACPI_TYPE_ANY, Arg->Value.Buffer,
382 &NameString, &NameLength);
383
384 if (ACPI_FAILURE (Status))
385 {

--- 6 unchanged lines hidden (view full) ---

392 */
393
394 /*
395 * Differentiate between a namespace "create" operation
396 * versus a "lookup" operation (IMODE_LOAD_PASS2 vs.
397 * IMODE_EXECUTE) in order to support the creation of
398 * namespace objects during the execution of control methods.
399 */
400
401 ParentOp = Arg->Parent;
402 if ((AcpiPsIsNodeOp (ParentOp->Opcode)) &&
403 (ParentOp->Opcode != AML_INT_METHODCALL_OP) &&
404 (ParentOp->Opcode != AML_REGION_OP) &&
405 (ParentOp->Opcode != AML_INT_NAMEPATH_OP))
406 {
407 /* Enter name into namespace if not found */
408

--- 73 unchanged lines hidden (view full) ---

482 /*
483 * If the name is null, this means that this is an
484 * optional result parameter that was not specified
485 * in the original ASL. Create an Reference for a
486 * placeholder
487 */
488 Opcode = AML_ZERO_OP; /* Has no arguments! */
489
490 DEBUG_PRINTP (TRACE_DISPATCH, ("Null namepath: Arg=%p\n", Arg));
491
492 /*
493 * TBD: [Investigate] anything else needed for the
494 * zero op lvalue?
495 */
496 }
497
498 else

--- 7 unchanged lines hidden (view full) ---

506 DataType = AcpiDsMapOpcodeToDataType (Opcode, &Flags);
507 if (DataType == INTERNAL_TYPE_INVALID)
508 {
509 return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
510 }
511
512 if (Flags & OP_HAS_RETURN_VALUE)
513 {
514 DEBUG_PRINTP (TRACE_DISPATCH,
515 ("Argument previously created, already stacked \n"));
516
517 DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (WalkState->Operands [WalkState->NumOperands - 1], WalkState));
518
519 /*
520 * Use value that was already previously returned
521 * by the evaluation of this argument
522 */
523 Status = AcpiDsResultPopFromBottom (&ObjDesc, WalkState);
524 if (ACPI_FAILURE (Status))
525 {
526 /*
527 * Only error is underflow, and this indicates
528 * a missing or null operand!
529 */
530 DEBUG_PRINTP (ACPI_ERROR, ("Missing or null operand, %s\n",
531 AcpiFormatException (Status)));
532 return_ACPI_STATUS (Status);
533 }
534
535 }
536
537 else
538 {

--- 63 unchanged lines hidden (view full) ---

602 while (Arg)
603 {
604 Status = AcpiDsCreateOperand (WalkState, Arg, ArgCount);
605 if (ACPI_FAILURE (Status))
606 {
607 goto Cleanup;
608 }
609
610 DEBUG_PRINTP (TRACE_DISPATCH, ("Arg #%d (%p) done, Arg1=%p\n",
611 ArgCount, Arg, FirstArg));
612
613 /* Move on to next argument, if any */
614
615 Arg = Arg->Next;
616 ArgCount++;
617 }
618

--- 4 unchanged lines hidden (view full) ---

623 /*
624 * We must undo everything done above; meaning that we must
625 * pop everything off of the operand stack and delete those
626 * objects
627 */
628
629 AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
630
631 DEBUG_PRINTP (ACPI_ERROR, ("While creating Arg %d - %s\n",
632 (ArgCount + 1), AcpiFormatException (Status)));
633 return_ACPI_STATUS (Status);
634}
635
636
637/*******************************************************************************
638 *
639 * FUNCTION: AcpiDsResolveOperands

--- 70 unchanged lines hidden (view full) ---

710 PROC_NAME ("DsMapOpcodeToDataType");
711
712
713 OpInfo = AcpiPsGetOpcodeInfo (Opcode);
714 if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE)
715 {
716 /* Unknown opcode */
717
718 DEBUG_PRINTP (ACPI_ERROR, ("Unknown AML opcode: %x\n", Opcode));
719 return (DataType);
720 }
721
722 switch (ACPI_GET_OP_CLASS (OpInfo))
723 {
724
725 case OPTYPE_LITERAL:
726
727 switch (Opcode)
728 {
729 case AML_BYTE_OP:
730 case AML_WORD_OP:
731 case AML_DWORD_OP:
732
733 DataType = ACPI_TYPE_INTEGER;
734 break;
735
736
737 case AML_STRING_OP:
738
739 DataType = ACPI_TYPE_STRING;
740 break;
741
742 case AML_INT_NAMEPATH_OP:
743 DataType = INTERNAL_TYPE_REFERENCE;
744 break;
745
746 default:
747 DEBUG_PRINTP (ACPI_ERROR,
748 ("Unknown (type LITERAL) AML opcode: %x\n", Opcode));
749 break;
750 }
751 break;
752
753
754 case OPTYPE_DATA_TERM:
755
756 switch (Opcode)

--- 5 unchanged lines hidden (view full) ---

762
763 case AML_PACKAGE_OP:
764 case AML_VAR_PACKAGE_OP:
765
766 DataType = ACPI_TYPE_PACKAGE;
767 break;
768
769 default:
770 DEBUG_PRINTP (ACPI_ERROR,
771 ("Unknown (type DATA_TERM) AML opcode: %x\n", Opcode));
772 break;
773 }
774 break;
775
776
777 case OPTYPE_CONSTANT:
778 case OPTYPE_METHOD_ARGUMENT:
779 case OPTYPE_LOCAL_VARIABLE:

--- 35 unchanged lines hidden (view full) ---

815
816 /* No mapping needed at this time */
817
818 break;
819
820
821 default:
822
823 DEBUG_PRINTP (ACPI_ERROR,
824 ("Unimplemented data type opcode: %x\n", Opcode));
825 break;
826 }
827
828 /* Return flags to caller if requested */
829
830 if (OutFlags)
831 {
832 *OutFlags = Flags;

--- 102 unchanged lines hidden ---