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

dsinit.c
Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * Module Name: dsinit - Object initialization namespace walk
00004  *
00005  *****************************************************************************/
00006 
00007 /******************************************************************************
00008  *
00009  * 1. Copyright Notice
00010  *
00011  * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
00012  * All rights reserved.
00013  *
00014  * 2. License
00015  *
00016  * 2.1. This is your license from Intel Corp. under its intellectual property
00017  * rights.  You may have additional license terms from the party that provided
00018  * you this software, covering your right to use that party's intellectual
00019  * property rights.
00020  *
00021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
00022  * copy of the source code appearing in this file ("Covered Code") an
00023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
00024  * base code distributed originally by Intel ("Original Intel Code") to copy,
00025  * make derivatives, distribute, use and display any portion of the Covered
00026  * Code in any form, with the right to sublicense such rights; and
00027  *
00028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
00029  * license (with the right to sublicense), under only those claims of Intel
00030  * patents that are infringed by the Original Intel Code, to make, use, sell,
00031  * offer to sell, and import the Covered Code and derivative works thereof
00032  * solely to the minimum extent necessary to exercise the above copyright
00033  * license, and in no event shall the patent license extend to any additions
00034  * to or modifications of the Original Intel Code.  No other license or right
00035  * is granted directly or by implication, estoppel or otherwise;
00036  *
00037  * The above copyright and patent license is granted only if the following
00038  * conditions are met:
00039  *
00040  * 3. Conditions
00041  *
00042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
00043  * Redistribution of source code of any substantial portion of the Covered
00044  * Code or modification with rights to further distribute source must include
00045  * the above Copyright Notice, the above License, this list of Conditions,
00046  * and the following Disclaimer and Export Compliance provision.  In addition,
00047  * Licensee must cause all Covered Code to which Licensee contributes to
00048  * contain a file documenting the changes Licensee made to create that Covered
00049  * Code and the date of any change.  Licensee must include in that file the
00050  * documentation of any changes made by any predecessor Licensee.  Licensee
00051  * must include a prominent statement that the modification is derived,
00052  * directly or indirectly, from Original Intel Code.
00053  *
00054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
00055  * Redistribution of source code of any substantial portion of the Covered
00056  * Code or modification without rights to further distribute source must
00057  * include the following Disclaimer and Export Compliance provision in the
00058  * documentation and/or other materials provided with distribution.  In
00059  * addition, Licensee may not authorize further sublicense of source of any
00060  * portion of the Covered Code, and must include terms to the effect that the
00061  * license from Licensee to its licensee is limited to the intellectual
00062  * property embodied in the software Licensee provides to its licensee, and
00063  * not to intellectual property embodied in modifications its licensee may
00064  * make.
00065  *
00066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
00067  * substantial portion of the Covered Code or modification must reproduce the
00068  * above Copyright Notice, and the following Disclaimer and Export Compliance
00069  * provision in the documentation and/or other materials provided with the
00070  * distribution.
00071  *
00072  * 3.4. Intel retains all right, title, and interest in and to the Original
00073  * Intel Code.
00074  *
00075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
00076  * Intel shall be used in advertising or otherwise to promote the sale, use or
00077  * other dealings in products derived from or relating to the Covered Code
00078  * without prior written authorization from Intel.
00079  *
00080  * 4. Disclaimer and Export Compliance
00081  *
00082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
00083  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
00084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
00085  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
00086  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
00087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
00088  * PARTICULAR PURPOSE.
00089  *
00090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
00091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
00092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
00093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
00094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
00095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
00096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
00097  * LIMITED REMEDY.
00098  *
00099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
00100  * software or system incorporating such software without first obtaining any
00101  * required license or other approval from the U. S. Department of Commerce or
00102  * any other agency or department of the United States Government.  In the
00103  * event Licensee exports any such software from the United States or
00104  * re-exports any such software from a foreign destination, Licensee shall
00105  * ensure that the distribution and export/re-export of the software is in
00106  * compliance with all laws, regulations, orders, or other restrictions of the
00107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
00108  * any of its subsidiaries will export/re-export any technical data, process,
00109  * software, or service, directly or indirectly, to any country for which the
00110  * United States government or any agency thereof requires an export license,
00111  * other governmental approval, or letter of assurance, without first obtaining
00112  * such license, approval or letter.
00113  *
00114  *****************************************************************************/
00115 
00116 #define __DSINIT_C__
00117 
00118 #include "acpi.h"
00119 #include "accommon.h"
00120 #include "acdispat.h"
00121 #include "acnamesp.h"
00122 #include "actables.h"
00123 
00124 #define _COMPONENT          ACPI_DISPATCHER
00125         ACPI_MODULE_NAME    ("dsinit")
00126 
00127 /* Local prototypes */
00128 
00129 static ACPI_STATUS
00130 AcpiDsInitOneObject (
00131     ACPI_HANDLE             ObjHandle,
00132     UINT32                  Level,
00133     void                    *Context,
00134     void                    **ReturnValue);
00135 
00136 
00137 /*******************************************************************************
00138  *
00139  * FUNCTION:    AcpiDsInitOneObject
00140  *
00141  * PARAMETERS:  ObjHandle       - Node for the object
00142  *              Level           - Current nesting level
00143  *              Context         - Points to a init info struct
00144  *              ReturnValue     - Not used
00145  *
00146  * RETURN:      Status
00147  *
00148  * DESCRIPTION: Callback from AcpiWalkNamespace.  Invoked for every object
00149  *              within the namespace.
00150  *
00151  *              Currently, the only objects that require initialization are:
00152  *              1) Methods
00153  *              2) Operation Regions
00154  *
00155  ******************************************************************************/
00156 
00157 static ACPI_STATUS
00158 AcpiDsInitOneObject (
00159     ACPI_HANDLE             ObjHandle,
00160     UINT32                  Level,
00161     void                    *Context,
00162     void                    **ReturnValue)
00163 {
00164     ACPI_INIT_WALK_INFO     *Info = (ACPI_INIT_WALK_INFO *) Context;
00165     ACPI_NAMESPACE_NODE     *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
00166     ACPI_OBJECT_TYPE        Type;
00167     ACPI_STATUS             Status;
00168 
00169 
00170     ACPI_FUNCTION_ENTRY ();
00171 
00172 
00173     /*
00174      * We are only interested in NS nodes owned by the table that
00175      * was just loaded
00176      */
00177     if (Node->OwnerId != Info->OwnerId)
00178     {
00179         return (AE_OK);
00180     }
00181 
00182     Info->ObjectCount++;
00183 
00184     /* And even then, we are only interested in a few object types */
00185 
00186     Type = AcpiNsGetType (ObjHandle);
00187 
00188     switch (Type)
00189     {
00190     case ACPI_TYPE_REGION:
00191 
00192         Status = AcpiDsInitializeRegion (ObjHandle);
00193         if (ACPI_FAILURE (Status))
00194         {
00195             ACPI_EXCEPTION ((AE_INFO, Status,
00196                 "During Region initialization %p [%4.4s]",
00197                 ObjHandle, AcpiUtGetNodeName (ObjHandle)));
00198         }
00199 
00200         Info->OpRegionCount++;
00201         break;
00202 
00203 
00204     case ACPI_TYPE_METHOD:
00205 
00206         Info->MethodCount++;
00207         break;
00208 
00209 
00210     case ACPI_TYPE_DEVICE:
00211 
00212         Info->DeviceCount++;
00213         break;
00214 
00215 
00216     default:
00217         break;
00218     }
00219 
00220     /*
00221      * We ignore errors from above, and always return OK, since
00222      * we don't want to abort the walk on a single error.
00223      */
00224     return (AE_OK);
00225 }
00226 
00227 
00228 /*******************************************************************************
00229  *
00230  * FUNCTION:    AcpiDsInitializeObjects
00231  *
00232  * PARAMETERS:  TableDesc       - Descriptor for parent ACPI table
00233  *              StartNode       - Root of subtree to be initialized.
00234  *
00235  * RETURN:      Status
00236  *
00237  * DESCRIPTION: Walk the namespace starting at "StartNode" and perform any
00238  *              necessary initialization on the objects found therein
00239  *
00240  ******************************************************************************/
00241 
00242 ACPI_STATUS
00243 AcpiDsInitializeObjects (
00244     UINT32                  TableIndex,
00245     ACPI_NAMESPACE_NODE     *StartNode)
00246 {
00247     ACPI_STATUS             Status;
00248     ACPI_INIT_WALK_INFO     Info;
00249     ACPI_TABLE_HEADER       *Table;
00250     ACPI_OWNER_ID           OwnerId;
00251 
00252 
00253     ACPI_FUNCTION_TRACE (DsInitializeObjects);
00254 
00255 
00256     Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
00257     if (ACPI_FAILURE (Status))
00258     {
00259         return_ACPI_STATUS (Status);
00260     }
00261 
00262     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
00263         "**** Starting initialization of namespace objects ****\n"));
00264     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:"));
00265 
00266     /* Set all init info to zero */
00267 
00268     ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
00269 
00270     Info.OwnerId = OwnerId;
00271     Info.TableIndex = TableIndex;
00272 
00273     /* Walk entire namespace from the supplied root */
00274 
00275     Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
00276     if (ACPI_FAILURE (Status))
00277     {
00278         return_ACPI_STATUS (Status);
00279     }
00280 
00281     /*
00282      * We don't use AcpiWalkNamespace since we do not want to acquire
00283      * the namespace reader lock.
00284      */
00285     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX,
00286                 ACPI_NS_WALK_UNLOCK, AcpiDsInitOneObject, NULL, &Info, NULL);
00287     if (ACPI_FAILURE (Status))
00288     {
00289         ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
00290     }
00291     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
00292 
00293     Status = AcpiGetTableByIndex (TableIndex, &Table);
00294     if (ACPI_FAILURE (Status))
00295     {
00296         return_ACPI_STATUS (Status);
00297     }
00298 
00299     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
00300         "\nTable [%4.4s](id %4.4X) - %u Objects with %u Devices %u Methods %u Regions\n",
00301         Table->Signature, OwnerId, Info.ObjectCount,
00302         Info.DeviceCount, Info.MethodCount, Info.OpRegionCount));
00303 
00304     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
00305         "%u Methods, %u Regions\n", Info.MethodCount, Info.OpRegionCount));
00306 
00307     return_ACPI_STATUS (AE_OK);
00308 }
00309 
00310 

Generated on Sun May 27 2012 04:27:14 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.