Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
   1 /******************************************************************************
   2  *
   3  * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2011, 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.


 146     ACPI_OPERAND_OBJECT     *MutexDesc;
 147     ACPI_STATUS             Status;
 148 
 149 
 150     ACPI_FUNCTION_TRACE (DsCreateMethodMutex);
 151 
 152 
 153     /* Create the new mutex object */
 154 
 155     MutexDesc = AcpiUtCreateInternalObject (ACPI_TYPE_MUTEX);
 156     if (!MutexDesc)
 157     {
 158         return_ACPI_STATUS (AE_NO_MEMORY);
 159     }
 160 
 161     /* Create the actual OS Mutex */
 162 
 163     Status = AcpiOsCreateMutex (&MutexDesc->Mutex.OsMutex);
 164     if (ACPI_FAILURE (Status))
 165     {

 166         return_ACPI_STATUS (Status);
 167     }
 168 
 169     MutexDesc->Mutex.SyncLevel = MethodDesc->Method.SyncLevel;
 170     MethodDesc->Method.Mutex = MutexDesc;
 171     return_ACPI_STATUS (AE_OK);
 172 }
 173 
 174 
 175 /*******************************************************************************
 176  *
 177  * FUNCTION:    AcpiDsBeginMethodExecution
 178  *
 179  * PARAMETERS:  MethodNode          - Node of the method
 180  *              ObjDesc             - The method object
 181  *              WalkState           - current state, NULL if not yet executing
 182  *                                    a method.
 183  *
 184  * RETURN:      Status
 185  *


 392     {
 393         Status = AE_NO_MEMORY;
 394         goto Cleanup;
 395     }
 396 
 397     /*
 398      * The resolved arguments were put on the previous walk state's operand
 399      * stack. Operands on the previous walk state stack always
 400      * start at index 0. Also, null terminate the list of arguments
 401      */
 402     ThisWalkState->Operands [ThisWalkState->NumOperands] = NULL;
 403 
 404     /*
 405      * Allocate and initialize the evaluation information block
 406      * TBD: this is somewhat inefficient, should change interface to
 407      * DsInitAmlWalk. For now, keeps this struct off the CPU stack
 408      */
 409     Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
 410     if (!Info)
 411     {
 412         return_ACPI_STATUS (AE_NO_MEMORY);

 413     }
 414 
 415     Info->Parameters = &ThisWalkState->Operands[0];
 416 
 417     Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode,
 418                 ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
 419                 Info, ACPI_IMODE_EXECUTE);
 420 
 421     ACPI_FREE (Info);
 422     if (ACPI_FAILURE (Status))
 423     {
 424         goto Cleanup;
 425     }
 426 
 427     /*
 428      * Delete the operands on the previous walkstate operand stack
 429      * (they were copied to new objects)
 430      */
 431     for (i = 0; i < ObjDesc->Method.ParamCount; i++)
 432     {


 705              * a named object and then blocked, causing the second thread
 706              * entrance to begin and then fail. Workaround this problem by
 707              * marking the method permanently as Serialized when the last
 708              * thread exits here.
 709              */
 710             MethodDesc->Method.InfoFlags &= ~ACPI_METHOD_SERIALIZED_PENDING;
 711             MethodDesc->Method.InfoFlags |= ACPI_METHOD_SERIALIZED;
 712             MethodDesc->Method.SyncLevel = 0;
 713         }
 714 
 715         /* No more threads, we can free the OwnerId */
 716 
 717         if (!(MethodDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL))
 718         {
 719             AcpiUtReleaseOwnerId (&MethodDesc->Method.OwnerId);
 720         }
 721     }
 722 
 723     return_VOID;
 724 }
 725 
 726 
   1 /******************************************************************************
   2  *
   3  * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2014, 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.


 146     ACPI_OPERAND_OBJECT     *MutexDesc;
 147     ACPI_STATUS             Status;
 148 
 149 
 150     ACPI_FUNCTION_TRACE (DsCreateMethodMutex);
 151 
 152 
 153     /* Create the new mutex object */
 154 
 155     MutexDesc = AcpiUtCreateInternalObject (ACPI_TYPE_MUTEX);
 156     if (!MutexDesc)
 157     {
 158         return_ACPI_STATUS (AE_NO_MEMORY);
 159     }
 160 
 161     /* Create the actual OS Mutex */
 162 
 163     Status = AcpiOsCreateMutex (&MutexDesc->Mutex.OsMutex);
 164     if (ACPI_FAILURE (Status))
 165     {
 166         AcpiUtDeleteObjectDesc (MutexDesc);
 167         return_ACPI_STATUS (Status);
 168     }
 169 
 170     MutexDesc->Mutex.SyncLevel = MethodDesc->Method.SyncLevel;
 171     MethodDesc->Method.Mutex = MutexDesc;
 172     return_ACPI_STATUS (AE_OK);
 173 }
 174 
 175 
 176 /*******************************************************************************
 177  *
 178  * FUNCTION:    AcpiDsBeginMethodExecution
 179  *
 180  * PARAMETERS:  MethodNode          - Node of the method
 181  *              ObjDesc             - The method object
 182  *              WalkState           - current state, NULL if not yet executing
 183  *                                    a method.
 184  *
 185  * RETURN:      Status
 186  *


 393     {
 394         Status = AE_NO_MEMORY;
 395         goto Cleanup;
 396     }
 397 
 398     /*
 399      * The resolved arguments were put on the previous walk state's operand
 400      * stack. Operands on the previous walk state stack always
 401      * start at index 0. Also, null terminate the list of arguments
 402      */
 403     ThisWalkState->Operands [ThisWalkState->NumOperands] = NULL;
 404 
 405     /*
 406      * Allocate and initialize the evaluation information block
 407      * TBD: this is somewhat inefficient, should change interface to
 408      * DsInitAmlWalk. For now, keeps this struct off the CPU stack
 409      */
 410     Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
 411     if (!Info)
 412     {
 413         Status = AE_NO_MEMORY;
 414         goto Cleanup;
 415     }
 416 
 417     Info->Parameters = &ThisWalkState->Operands[0];
 418 
 419     Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode,
 420                 ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
 421                 Info, ACPI_IMODE_EXECUTE);
 422 
 423     ACPI_FREE (Info);
 424     if (ACPI_FAILURE (Status))
 425     {
 426         goto Cleanup;
 427     }
 428 
 429     /*
 430      * Delete the operands on the previous walkstate operand stack
 431      * (they were copied to new objects)
 432      */
 433     for (i = 0; i < ObjDesc->Method.ParamCount; i++)
 434     {


 707              * a named object and then blocked, causing the second thread
 708              * entrance to begin and then fail. Workaround this problem by
 709              * marking the method permanently as Serialized when the last
 710              * thread exits here.
 711              */
 712             MethodDesc->Method.InfoFlags &= ~ACPI_METHOD_SERIALIZED_PENDING;
 713             MethodDesc->Method.InfoFlags |= ACPI_METHOD_SERIALIZED;
 714             MethodDesc->Method.SyncLevel = 0;
 715         }
 716 
 717         /* No more threads, we can free the OwnerId */
 718 
 719         if (!(MethodDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL))
 720         {
 721             AcpiUtReleaseOwnerId (&MethodDesc->Method.OwnerId);
 722         }
 723     }
 724 
 725     return_VOID;
 726 }