ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

dsargs.c
Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * Module Name: dsargs - Support for execution of dynamic arguments for static
00004  *                       objects (regions, fields, buffer fields, etc.)
00005  *
00006  *****************************************************************************/
00007 
00008 /******************************************************************************
00009  *
00010  * 1. Copyright Notice
00011  *
00012  * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
00013  * All rights reserved.
00014  *
00015  * 2. License
00016  *
00017  * 2.1. This is your license from Intel Corp. under its intellectual property
00018  * rights.  You may have additional license terms from the party that provided
00019  * you this software, covering your right to use that party's intellectual
00020  * property rights.
00021  *
00022  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
00023  * copy of the source code appearing in this file ("Covered Code") an
00024  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
00025  * base code distributed originally by Intel ("Original Intel Code") to copy,
00026  * make derivatives, distribute, use and display any portion of the Covered
00027  * Code in any form, with the right to sublicense such rights; and
00028  *
00029  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
00030  * license (with the right to sublicense), under only those claims of Intel
00031  * patents that are infringed by the Original Intel Code, to make, use, sell,
00032  * offer to sell, and import the Covered Code and derivative works thereof
00033  * solely to the minimum extent necessary to exercise the above copyright
00034  * license, and in no event shall the patent license extend to any additions
00035  * to or modifications of the Original Intel Code.  No other license or right
00036  * is granted directly or by implication, estoppel or otherwise;
00037  *
00038  * The above copyright and patent license is granted only if the following
00039  * conditions are met:
00040  *
00041  * 3. Conditions
00042  *
00043  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
00044  * Redistribution of source code of any substantial portion of the Covered
00045  * Code or modification with rights to further distribute source must include
00046  * the above Copyright Notice, the above License, this list of Conditions,
00047  * and the following Disclaimer and Export Compliance provision.  In addition,
00048  * Licensee must cause all Covered Code to which Licensee contributes to
00049  * contain a file documenting the changes Licensee made to create that Covered
00050  * Code and the date of any change.  Licensee must include in that file the
00051  * documentation of any changes made by any predecessor Licensee.  Licensee
00052  * must include a prominent statement that the modification is derived,
00053  * directly or indirectly, from Original Intel Code.
00054  *
00055  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
00056  * Redistribution of source code of any substantial portion of the Covered
00057  * Code or modification without rights to further distribute source must
00058  * include the following Disclaimer and Export Compliance provision in the
00059  * documentation and/or other materials provided with distribution.  In
00060  * addition, Licensee may not authorize further sublicense of source of any
00061  * portion of the Covered Code, and must include terms to the effect that the
00062  * license from Licensee to its licensee is limited to the intellectual
00063  * property embodied in the software Licensee provides to its licensee, and
00064  * not to intellectual property embodied in modifications its licensee may
00065  * make.
00066  *
00067  * 3.3. Redistribution of Executable. Redistribution in executable form of any
00068  * substantial portion of the Covered Code or modification must reproduce the
00069  * above Copyright Notice, and the following Disclaimer and Export Compliance
00070  * provision in the documentation and/or other materials provided with the
00071  * distribution.
00072  *
00073  * 3.4. Intel retains all right, title, and interest in and to the Original
00074  * Intel Code.
00075  *
00076  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
00077  * Intel shall be used in advertising or otherwise to promote the sale, use or
00078  * other dealings in products derived from or relating to the Covered Code
00079  * without prior written authorization from Intel.
00080  *
00081  * 4. Disclaimer and Export Compliance
00082  *
00083  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
00084  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
00085  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
00086  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
00087  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
00088  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
00089  * PARTICULAR PURPOSE.
00090  *
00091  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
00092  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
00093  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
00094  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
00095  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
00096  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
00097  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
00098  * LIMITED REMEDY.
00099  *
00100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
00101  * software or system incorporating such software without first obtaining any
00102  * required license or other approval from the U. S. Department of Commerce or
00103  * any other agency or department of the United States Government.  In the
00104  * event Licensee exports any such software from the United States or
00105  * re-exports any such software from a foreign destination, Licensee shall
00106  * ensure that the distribution and export/re-export of the software is in
00107  * compliance with all laws, regulations, orders, or other restrictions of the
00108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
00109  * any of its subsidiaries will export/re-export any technical data, process,
00110  * software, or service, directly or indirectly, to any country for which the
00111  * United States government or any agency thereof requires an export license,
00112  * other governmental approval, or letter of assurance, without first obtaining
00113  * such license, approval or letter.
00114  *
00115  *****************************************************************************/
00116 
00117 #define __DSARGS_C__
00118 
00119 #include "acpi.h"
00120 #include "accommon.h"
00121 #include "acparser.h"
00122 #include "amlcode.h"
00123 #include "acdispat.h"
00124 #include "acnamesp.h"
00125 
00126 #define _COMPONENT          ACPI_DISPATCHER
00127         ACPI_MODULE_NAME    ("dsargs")
00128 
00129 /* Local prototypes */
00130 
00131 static ACPI_STATUS
00132 AcpiDsExecuteArguments (
00133     ACPI_NAMESPACE_NODE     *Node,
00134     ACPI_NAMESPACE_NODE     *ScopeNode,
00135     UINT32                  AmlLength,
00136     UINT8                   *AmlStart);
00137 
00138 
00139 /*******************************************************************************
00140  *
00141  * FUNCTION:    AcpiDsExecuteArguments
00142  *
00143  * PARAMETERS:  Node                - Object NS node
00144  *              ScopeNode           - Parent NS node
00145  *              AmlLength           - Length of executable AML
00146  *              AmlStart            - Pointer to the AML
00147  *
00148  * RETURN:      Status.
00149  *
00150  * DESCRIPTION: Late (deferred) execution of region or field arguments
00151  *
00152  ******************************************************************************/
00153 
00154 static ACPI_STATUS
00155 AcpiDsExecuteArguments (
00156     ACPI_NAMESPACE_NODE     *Node,
00157     ACPI_NAMESPACE_NODE     *ScopeNode,
00158     UINT32                  AmlLength,
00159     UINT8                   *AmlStart)
00160 {
00161     ACPI_STATUS             Status;
00162     ACPI_PARSE_OBJECT       *Op;
00163     ACPI_WALK_STATE         *WalkState;
00164 
00165 
00166     ACPI_FUNCTION_TRACE (DsExecuteArguments);
00167 
00168 
00169     /* Allocate a new parser op to be the root of the parsed tree */
00170 
00171     Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
00172     if (!Op)
00173     {
00174         return_ACPI_STATUS (AE_NO_MEMORY);
00175     }
00176 
00177     /* Save the Node for use in AcpiPsParseAml */
00178 
00179     Op->Common.Node = ScopeNode;
00180 
00181     /* Create and initialize a new parser state */
00182 
00183     WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
00184     if (!WalkState)
00185     {
00186         Status = AE_NO_MEMORY;
00187         goto Cleanup;
00188     }
00189 
00190     Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
00191                     AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
00192     if (ACPI_FAILURE (Status))
00193     {
00194         AcpiDsDeleteWalkState (WalkState);
00195         goto Cleanup;
00196     }
00197 
00198     /* Mark this parse as a deferred opcode */
00199 
00200     WalkState->ParseFlags = ACPI_PARSE_DEFERRED_OP;
00201     WalkState->DeferredNode = Node;
00202 
00203     /* Pass1: Parse the entire declaration */
00204 
00205     Status = AcpiPsParseAml (WalkState);
00206     if (ACPI_FAILURE (Status))
00207     {
00208         goto Cleanup;
00209     }
00210 
00211     /* Get and init the Op created above */
00212 
00213     Op->Common.Node = Node;
00214     AcpiPsDeleteParseTree (Op);
00215 
00216     /* Evaluate the deferred arguments */
00217 
00218     Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
00219     if (!Op)
00220     {
00221         return_ACPI_STATUS (AE_NO_MEMORY);
00222     }
00223 
00224     Op->Common.Node = ScopeNode;
00225 
00226     /* Create and initialize a new parser state */
00227 
00228     WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
00229     if (!WalkState)
00230     {
00231         Status = AE_NO_MEMORY;
00232         goto Cleanup;
00233     }
00234 
00235     /* Execute the opcode and arguments */
00236 
00237     Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
00238                     AmlLength, NULL, ACPI_IMODE_EXECUTE);
00239     if (ACPI_FAILURE (Status))
00240     {
00241         AcpiDsDeleteWalkState (WalkState);
00242         goto Cleanup;
00243     }
00244 
00245     /* Mark this execution as a deferred opcode */
00246 
00247     WalkState->DeferredNode = Node;
00248     Status = AcpiPsParseAml (WalkState);
00249 
00250 Cleanup:
00251     AcpiPsDeleteParseTree (Op);
00252     return_ACPI_STATUS (Status);
00253 }
00254 
00255 
00256 /*******************************************************************************
00257  *
00258  * FUNCTION:    AcpiDsGetBufferFieldArguments
00259  *
00260  * PARAMETERS:  ObjDesc         - A valid BufferField object
00261  *
00262  * RETURN:      Status.
00263  *
00264  * DESCRIPTION: Get BufferField Buffer and Index. This implements the late
00265  *              evaluation of these field attributes.
00266  *
00267  ******************************************************************************/
00268 
00269 ACPI_STATUS
00270 AcpiDsGetBufferFieldArguments (
00271     ACPI_OPERAND_OBJECT     *ObjDesc)
00272 {
00273     ACPI_OPERAND_OBJECT     *ExtraDesc;
00274     ACPI_NAMESPACE_NODE     *Node;
00275     ACPI_STATUS             Status;
00276 
00277 
00278     ACPI_FUNCTION_TRACE_PTR (DsGetBufferFieldArguments, ObjDesc);
00279 
00280 
00281     if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
00282     {
00283         return_ACPI_STATUS (AE_OK);
00284     }
00285 
00286     /* Get the AML pointer (method object) and BufferField node */
00287 
00288     ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
00289     Node = ObjDesc->BufferField.Node;
00290 
00291     ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD,
00292         Node, NULL));
00293 
00294     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n",
00295         AcpiUtGetNodeName (Node)));
00296 
00297     /* Execute the AML code for the TermArg arguments */
00298 
00299     Status = AcpiDsExecuteArguments (Node, Node->Parent,
00300                 ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
00301     return_ACPI_STATUS (Status);
00302 }
00303 
00304 
00305 /*******************************************************************************
00306  *
00307  * FUNCTION:    AcpiDsGetBankFieldArguments
00308  *
00309  * PARAMETERS:  ObjDesc         - A valid BankField object
00310  *
00311  * RETURN:      Status.
00312  *
00313  * DESCRIPTION: Get BankField BankValue. This implements the late
00314  *              evaluation of these field attributes.
00315  *
00316  ******************************************************************************/
00317 
00318 ACPI_STATUS
00319 AcpiDsGetBankFieldArguments (
00320     ACPI_OPERAND_OBJECT     *ObjDesc)
00321 {
00322     ACPI_OPERAND_OBJECT     *ExtraDesc;
00323     ACPI_NAMESPACE_NODE     *Node;
00324     ACPI_STATUS             Status;
00325 
00326 
00327     ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc);
00328 
00329 
00330     if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
00331     {
00332         return_ACPI_STATUS (AE_OK);
00333     }
00334 
00335     /* Get the AML pointer (method object) and BankField node */
00336 
00337     ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
00338     Node = ObjDesc->BankField.Node;
00339 
00340     ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_LOCAL_BANK_FIELD,
00341         Node, NULL));
00342 
00343     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n",
00344         AcpiUtGetNodeName (Node)));
00345 
00346     /* Execute the AML code for the TermArg arguments */
00347 
00348     Status = AcpiDsExecuteArguments (Node, Node->Parent,
00349                 ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
00350     return_ACPI_STATUS (Status);
00351 }
00352 
00353 
00354 /*******************************************************************************
00355  *
00356  * FUNCTION:    AcpiDsGetBufferArguments
00357  *
00358  * PARAMETERS:  ObjDesc         - A valid Buffer object
00359  *
00360  * RETURN:      Status.
00361  *
00362  * DESCRIPTION: Get Buffer length and initializer byte list. This implements
00363  *              the late evaluation of these attributes.
00364  *
00365  ******************************************************************************/
00366 
00367 ACPI_STATUS
00368 AcpiDsGetBufferArguments (
00369     ACPI_OPERAND_OBJECT     *ObjDesc)
00370 {
00371     ACPI_NAMESPACE_NODE     *Node;
00372     ACPI_STATUS             Status;
00373 
00374 
00375     ACPI_FUNCTION_TRACE_PTR (DsGetBufferArguments, ObjDesc);
00376 
00377 
00378     if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
00379     {
00380         return_ACPI_STATUS (AE_OK);
00381     }
00382 
00383     /* Get the Buffer node */
00384 
00385     Node = ObjDesc->Buffer.Node;
00386     if (!Node)
00387     {
00388         ACPI_ERROR ((AE_INFO,
00389             "No pointer back to namespace node in buffer object %p", ObjDesc));
00390         return_ACPI_STATUS (AE_AML_INTERNAL);
00391     }
00392 
00393     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n"));
00394 
00395     /* Execute the AML code for the TermArg arguments */
00396 
00397     Status = AcpiDsExecuteArguments (Node, Node,
00398                 ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart);
00399     return_ACPI_STATUS (Status);
00400 }
00401 
00402 
00403 /*******************************************************************************
00404  *
00405  * FUNCTION:    AcpiDsGetPackageArguments
00406  *
00407  * PARAMETERS:  ObjDesc         - A valid Package object
00408  *
00409  * RETURN:      Status.
00410  *
00411  * DESCRIPTION: Get Package length and initializer byte list. This implements
00412  *              the late evaluation of these attributes.
00413  *
00414  ******************************************************************************/
00415 
00416 ACPI_STATUS
00417 AcpiDsGetPackageArguments (
00418     ACPI_OPERAND_OBJECT     *ObjDesc)
00419 {
00420     ACPI_NAMESPACE_NODE     *Node;
00421     ACPI_STATUS             Status;
00422 
00423 
00424     ACPI_FUNCTION_TRACE_PTR (DsGetPackageArguments, ObjDesc);
00425 
00426 
00427     if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
00428     {
00429         return_ACPI_STATUS (AE_OK);
00430     }
00431 
00432     /* Get the Package node */
00433 
00434     Node = ObjDesc->Package.Node;
00435     if (!Node)
00436     {
00437         ACPI_ERROR ((AE_INFO,
00438             "No pointer back to namespace node in package %p", ObjDesc));
00439         return_ACPI_STATUS (AE_AML_INTERNAL);
00440     }
00441 
00442     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n"));
00443 
00444     /* Execute the AML code for the TermArg arguments */
00445 
00446     Status = AcpiDsExecuteArguments (Node, Node,
00447                 ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart);
00448     return_ACPI_STATUS (Status);
00449 }
00450 
00451 
00452 /*******************************************************************************
00453  *
00454  * FUNCTION:    AcpiDsGetRegionArguments
00455  *
00456  * PARAMETERS:  ObjDesc         - A valid region object
00457  *
00458  * RETURN:      Status.
00459  *
00460  * DESCRIPTION: Get region address and length. This implements the late
00461  *              evaluation of these region attributes.
00462  *
00463  ******************************************************************************/
00464 
00465 ACPI_STATUS
00466 AcpiDsGetRegionArguments (
00467     ACPI_OPERAND_OBJECT     *ObjDesc)
00468 {
00469     ACPI_NAMESPACE_NODE     *Node;
00470     ACPI_STATUS             Status;
00471     ACPI_OPERAND_OBJECT     *ExtraDesc;
00472 
00473 
00474     ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc);
00475 
00476 
00477     if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
00478     {
00479         return_ACPI_STATUS (AE_OK);
00480     }
00481 
00482     ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
00483     if (!ExtraDesc)
00484     {
00485         return_ACPI_STATUS (AE_NOT_EXIST);
00486     }
00487 
00488     /* Get the Region node */
00489 
00490     Node = ObjDesc->Region.Node;
00491 
00492     ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL));
00493 
00494     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n",
00495         AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart));
00496 
00497     /* Execute the argument AML */
00498 
00499     Status = AcpiDsExecuteArguments (Node, Node->Parent,
00500                 ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
00501     return_ACPI_STATUS (Status);
00502 }

Generated on Sat May 26 2012 04:25:44 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.