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

exresnte.c
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003  *
00004  * Module Name: exresnte - AML Interpreter object resolution
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 __EXRESNTE_C__
00118 
00119 #include "acpi.h"
00120 #include "accommon.h"
00121 #include "acdispat.h"
00122 #include "acinterp.h"
00123 #include "acnamesp.h"
00124 
00125 
00126 #define _COMPONENT          ACPI_EXECUTER
00127         ACPI_MODULE_NAME    ("exresnte")
00128 
00129 
00130 /*******************************************************************************
00131  *
00132  * FUNCTION:    AcpiExResolveNodeToValue
00133  *
00134  * PARAMETERS:  ObjectPtr       - Pointer to a location that contains
00135  *                                a pointer to a NS node, and will receive a
00136  *                                pointer to the resolved object.
00137  *              WalkState       - Current state.  Valid only if executing AML
00138  *                                code.  NULL if simply resolving an object
00139  *
00140  * RETURN:      Status
00141  *
00142  * DESCRIPTION: Resolve a Namespace node to a valued object
00143  *
00144  * Note: for some of the data types, the pointer attached to the Node
00145  * can be either a pointer to an actual internal object or a pointer into the
00146  * AML stream itself.  These types are currently:
00147  *
00148  *      ACPI_TYPE_INTEGER
00149  *      ACPI_TYPE_STRING
00150  *      ACPI_TYPE_BUFFER
00151  *      ACPI_TYPE_MUTEX
00152  *      ACPI_TYPE_PACKAGE
00153  *
00154  ******************************************************************************/
00155 
00156 ACPI_STATUS
00157 AcpiExResolveNodeToValue (
00158     ACPI_NAMESPACE_NODE     **ObjectPtr,
00159     ACPI_WALK_STATE         *WalkState)
00160 
00161 {
00162     ACPI_STATUS             Status = AE_OK;
00163     ACPI_OPERAND_OBJECT     *SourceDesc;
00164     ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
00165     ACPI_NAMESPACE_NODE     *Node;
00166     ACPI_OBJECT_TYPE        EntryType;
00167 
00168 
00169     ACPI_FUNCTION_TRACE (ExResolveNodeToValue);
00170 
00171 
00172     /*
00173      * The stack pointer points to a ACPI_NAMESPACE_NODE (Node).  Get the
00174      * object that is attached to the Node.
00175      */
00176     Node       = *ObjectPtr;
00177     SourceDesc = AcpiNsGetAttachedObject (Node);
00178     EntryType  = AcpiNsGetType ((ACPI_HANDLE) Node);
00179 
00180     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n",
00181          Node, SourceDesc, AcpiUtGetTypeName (EntryType)));
00182 
00183     if ((EntryType == ACPI_TYPE_LOCAL_ALIAS) ||
00184         (EntryType == ACPI_TYPE_LOCAL_METHOD_ALIAS))
00185     {
00186         /* There is always exactly one level of indirection */
00187 
00188         Node       = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Node->Object);
00189         SourceDesc = AcpiNsGetAttachedObject (Node);
00190         EntryType  = AcpiNsGetType ((ACPI_HANDLE) Node);
00191         *ObjectPtr = Node;
00192     }
00193 
00194     /*
00195      * Several object types require no further processing:
00196      * 1) Device/Thermal objects don't have a "real" subobject, return the Node
00197      * 2) Method locals and arguments have a pseudo-Node
00198      * 3) 10/2007: Added method type to assist with Package construction.
00199      */
00200     if ((EntryType == ACPI_TYPE_DEVICE)  ||
00201         (EntryType == ACPI_TYPE_THERMAL) ||
00202         (EntryType == ACPI_TYPE_METHOD)  ||
00203         (Node->Flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL)))
00204     {
00205         return_ACPI_STATUS (AE_OK);
00206     }
00207 
00208     if (!SourceDesc)
00209     {
00210         ACPI_ERROR ((AE_INFO, "No object attached to node %p",
00211             Node));
00212         return_ACPI_STATUS (AE_AML_NO_OPERAND);
00213     }
00214 
00215     /*
00216      * Action is based on the type of the Node, which indicates the type
00217      * of the attached object or pointer
00218      */
00219     switch (EntryType)
00220     {
00221     case ACPI_TYPE_PACKAGE:
00222 
00223         if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE)
00224         {
00225             ACPI_ERROR ((AE_INFO, "Object not a Package, type %s",
00226                 AcpiUtGetObjectTypeName (SourceDesc)));
00227             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00228         }
00229 
00230         Status = AcpiDsGetPackageArguments (SourceDesc);
00231         if (ACPI_SUCCESS (Status))
00232         {
00233             /* Return an additional reference to the object */
00234 
00235             ObjDesc = SourceDesc;
00236             AcpiUtAddReference (ObjDesc);
00237         }
00238         break;
00239 
00240 
00241     case ACPI_TYPE_BUFFER:
00242 
00243         if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)
00244         {
00245             ACPI_ERROR ((AE_INFO, "Object not a Buffer, type %s",
00246                 AcpiUtGetObjectTypeName (SourceDesc)));
00247             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00248         }
00249 
00250         Status = AcpiDsGetBufferArguments (SourceDesc);
00251         if (ACPI_SUCCESS (Status))
00252         {
00253             /* Return an additional reference to the object */
00254 
00255             ObjDesc = SourceDesc;
00256             AcpiUtAddReference (ObjDesc);
00257         }
00258         break;
00259 
00260 
00261     case ACPI_TYPE_STRING:
00262 
00263         if (SourceDesc->Common.Type != ACPI_TYPE_STRING)
00264         {
00265             ACPI_ERROR ((AE_INFO, "Object not a String, type %s",
00266                 AcpiUtGetObjectTypeName (SourceDesc)));
00267             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00268         }
00269 
00270         /* Return an additional reference to the object */
00271 
00272         ObjDesc = SourceDesc;
00273         AcpiUtAddReference (ObjDesc);
00274         break;
00275 
00276 
00277     case ACPI_TYPE_INTEGER:
00278 
00279         if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER)
00280         {
00281             ACPI_ERROR ((AE_INFO, "Object not a Integer, type %s",
00282                 AcpiUtGetObjectTypeName (SourceDesc)));
00283             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00284         }
00285 
00286         /* Return an additional reference to the object */
00287 
00288         ObjDesc = SourceDesc;
00289         AcpiUtAddReference (ObjDesc);
00290         break;
00291 
00292 
00293     case ACPI_TYPE_BUFFER_FIELD:
00294     case ACPI_TYPE_LOCAL_REGION_FIELD:
00295     case ACPI_TYPE_LOCAL_BANK_FIELD:
00296     case ACPI_TYPE_LOCAL_INDEX_FIELD:
00297 
00298         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
00299             "FieldRead Node=%p SourceDesc=%p Type=%X\n",
00300             Node, SourceDesc, EntryType));
00301 
00302         Status = AcpiExReadDataFromField (WalkState, SourceDesc, &ObjDesc);
00303         break;
00304 
00305     /* For these objects, just return the object attached to the Node */
00306 
00307     case ACPI_TYPE_MUTEX:
00308     case ACPI_TYPE_POWER:
00309     case ACPI_TYPE_PROCESSOR:
00310     case ACPI_TYPE_EVENT:
00311     case ACPI_TYPE_REGION:
00312 
00313         /* Return an additional reference to the object */
00314 
00315         ObjDesc = SourceDesc;
00316         AcpiUtAddReference (ObjDesc);
00317         break;
00318 
00319     /* TYPE_ANY is untyped, and thus there is no object associated with it */
00320 
00321     case ACPI_TYPE_ANY:
00322 
00323         ACPI_ERROR ((AE_INFO,
00324             "Untyped entry %p, no attached object!", Node));
00325 
00326         return_ACPI_STATUS (AE_AML_OPERAND_TYPE);  /* Cannot be AE_TYPE */
00327 
00328 
00329     case ACPI_TYPE_LOCAL_REFERENCE:
00330 
00331         switch (SourceDesc->Reference.Class)
00332         {
00333         case ACPI_REFCLASS_TABLE:   /* This is a DdbHandle */
00334         case ACPI_REFCLASS_REFOF:
00335         case ACPI_REFCLASS_INDEX:
00336 
00337             /* Return an additional reference to the object */
00338 
00339             ObjDesc = SourceDesc;
00340             AcpiUtAddReference (ObjDesc);
00341             break;
00342 
00343         default:
00344             /* No named references are allowed here */
00345 
00346             ACPI_ERROR ((AE_INFO,
00347                 "Unsupported Reference type 0x%X",
00348                 SourceDesc->Reference.Class));
00349 
00350             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00351         }
00352         break;
00353 
00354 
00355     default:
00356 
00357         /* Default case is for unknown types */
00358 
00359         ACPI_ERROR ((AE_INFO,
00360             "Node %p - Unknown object type 0x%X",
00361             Node, EntryType));
00362 
00363         return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
00364 
00365     } /* switch (EntryType) */
00366 
00367 
00368     /* Return the object descriptor */
00369 
00370     *ObjectPtr = (void *) ObjDesc;
00371     return_ACPI_STATUS (Status);
00372 }
00373 
00374 

Generated on Fri May 25 2012 04:25:31 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.