1/******************************************************************************
2 *
3 * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
4 * $Revision: 93 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
--- 164 unchanged lines hidden (view full) ---
177 ObjDesc = AcpiNsGetAttachedObject (Node);
178 if (!ObjDesc)
179 {
180 return_ACPI_STATUS (AE_NULL_OBJECT);
181 }
182
183 /* Create a mutex for the method if there is a concurrency limit */
184
185 if ((ObjDesc->Method.Concurrency != INFINITE_CONCURRENCY) &&
186 (!ObjDesc->Method.Semaphore))
187 {
188 Status = AcpiOsCreateSemaphore (ObjDesc->Method.Concurrency,
189 ObjDesc->Method.Concurrency,
190 &ObjDesc->Method.Semaphore);
191 if (ACPI_FAILURE (Status))
192 {
193 return_ACPI_STATUS (Status);
--- 190 unchanged lines hidden (view full) ---
384
385 Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc,
386 ThisWalkState->MethodNode);
387 if (ACPI_FAILURE (Status))
388 {
389 return_ACPI_STATUS (Status);
390 }
391
392 /* 1) Parse: Create a new walk state for the preempting walk */
393
394 NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
395 Op, ObjDesc, NULL);
396 if (!NextWalkState)
397 {
398 return_ACPI_STATUS (AE_NO_MEMORY);
399 }
400
401 /* Create and init a Root Node */
402
403 Op = AcpiPsCreateScopeOp ();
404 if (!Op)
405 {
406 Status = AE_NO_MEMORY;
407 goto Cleanup;
408 }
409
410 Status = AcpiDsInitAmlWalk (NextWalkState, Op, MethodNode,
411 ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
412 NULL, NULL, 1);
413 if (ACPI_FAILURE (Status))
414 {
415 AcpiDsDeleteWalkState (NextWalkState);
416 goto Cleanup;
417 }
418
419 /* Begin AML parse */
420
421 Status = AcpiPsParseAml (NextWalkState);
422 AcpiPsDeleteParseTree (Op);
423
424 /* 2) Execute: Create a new state for the preempting walk */
425
426 NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
427 NULL, ObjDesc, Thread);
428 if (!NextWalkState)
429 {
430 Status = AE_NO_MEMORY;
431 goto Cleanup;
432 }
433
434 /*
435 * The resolved arguments were put on the previous walk state's operand
436 * stack. Operands on the previous walk state stack always
437 * start at index 0.
438 * Null terminate the list of arguments
439 */
440 ThisWalkState->Operands [ThisWalkState->NumOperands] = NULL;
441
--- 17 unchanged lines hidden (view full) ---
459
460 /* Clear the operand stack */
461
462 ThisWalkState->NumOperands = 0;
463
464 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
465 "Starting nested execution, newstate=%p\n", NextWalkState));
466
467 return_ACPI_STATUS (AE_OK);
468
469
470 /* On error, we must delete the new walk state */
471
472Cleanup:
473 (void) AcpiDsTerminateControlMethod (NextWalkState);
474 AcpiDsDeleteWalkState (NextWalkState);
475 return_ACPI_STATUS (Status);
476
477}
478
479
480/*******************************************************************************
481 *
482 * FUNCTION: AcpiDsRestartControlMethod
483 *
484 * PARAMETERS: WalkState - State of the method when it was preempted
--- 114 unchanged lines hidden (view full) ---
599 {
600 ACPI_REPORT_ERROR (("Could not signal method semaphore\n"));
601 Status = AE_OK;
602
603 /* Ignore error and continue cleanup */
604 }
605 }
606
607 /* Decrement the thread count on the method parse tree */
608
609 WalkState->MethodDesc->Method.ThreadCount--;
610 if (!WalkState->MethodDesc->Method.ThreadCount)
611 {
612 /*
613 * There are no more threads executing this method. Perform
614 * additional cleanup.
615 *
616 * The method Node is stored in the walk state
617 */
618 MethodNode = WalkState->MethodNode;
619
620 /*
--- 31 unchanged lines hidden ---
2 *
3 * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
4 * $Revision: 93 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
--- 164 unchanged lines hidden (view full) ---
177 ObjDesc = AcpiNsGetAttachedObject (Node);
178 if (!ObjDesc)
179 {
180 return_ACPI_STATUS (AE_NULL_OBJECT);
181 }
182
183 /* Create a mutex for the method if there is a concurrency limit */
184
185 if ((ObjDesc->Method.Concurrency != INFINITE_CONCURRENCY) &&
186 (!ObjDesc->Method.Semaphore))
187 {
188 Status = AcpiOsCreateSemaphore (ObjDesc->Method.Concurrency,
189 ObjDesc->Method.Concurrency,
190 &ObjDesc->Method.Semaphore);
191 if (ACPI_FAILURE (Status))
192 {
193 return_ACPI_STATUS (Status);
--- 190 unchanged lines hidden (view full) ---
384
385 Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc,
386 ThisWalkState->MethodNode);
387 if (ACPI_FAILURE (Status))
388 {
389 return_ACPI_STATUS (Status);
390 }
391
392 /* 1) Parse: Create a new walk state for the preempting walk */
393
394 NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
395 Op, ObjDesc, NULL);
396 if (!NextWalkState)
397 {
398 return_ACPI_STATUS (AE_NO_MEMORY);
399 }
400
401 /* Create and init a Root Node */
402
403 Op = AcpiPsCreateScopeOp ();
404 if (!Op)
405 {
406 Status = AE_NO_MEMORY;
407 goto Cleanup;
408 }
409
410 Status = AcpiDsInitAmlWalk (NextWalkState, Op, MethodNode,
411 ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
412 NULL, NULL, 1);
413 if (ACPI_FAILURE (Status))
414 {
415 AcpiDsDeleteWalkState (NextWalkState);
416 goto Cleanup;
417 }
418
419 /* Begin AML parse */
420
421 Status = AcpiPsParseAml (NextWalkState);
422 AcpiPsDeleteParseTree (Op);
423
424 /* 2) Execute: Create a new state for the preempting walk */
425
426 NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
427 NULL, ObjDesc, Thread);
428 if (!NextWalkState)
429 {
430 Status = AE_NO_MEMORY;
431 goto Cleanup;
432 }
433
434 /*
435 * The resolved arguments were put on the previous walk state's operand
436 * stack. Operands on the previous walk state stack always
437 * start at index 0.
438 * Null terminate the list of arguments
439 */
440 ThisWalkState->Operands [ThisWalkState->NumOperands] = NULL;
441
--- 17 unchanged lines hidden (view full) ---
459
460 /* Clear the operand stack */
461
462 ThisWalkState->NumOperands = 0;
463
464 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
465 "Starting nested execution, newstate=%p\n", NextWalkState));
466
467 return_ACPI_STATUS (AE_OK);
468
469
470 /* On error, we must delete the new walk state */
471
472Cleanup:
473 (void) AcpiDsTerminateControlMethod (NextWalkState);
474 AcpiDsDeleteWalkState (NextWalkState);
475 return_ACPI_STATUS (Status);
476
477}
478
479
480/*******************************************************************************
481 *
482 * FUNCTION: AcpiDsRestartControlMethod
483 *
484 * PARAMETERS: WalkState - State of the method when it was preempted
--- 114 unchanged lines hidden (view full) ---
599 {
600 ACPI_REPORT_ERROR (("Could not signal method semaphore\n"));
601 Status = AE_OK;
602
603 /* Ignore error and continue cleanup */
604 }
605 }
606
607 /* Decrement the thread count on the method parse tree */
608
609 WalkState->MethodDesc->Method.ThreadCount--;
610 if (!WalkState->MethodDesc->Method.ThreadCount)
611 {
612 /*
613 * There are no more threads executing this method. Perform
614 * additional cleanup.
615 *
616 * The method Node is stored in the walk state
617 */
618 MethodNode = WalkState->MethodNode;
619
620 /*
--- 31 unchanged lines hidden ---