Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygennsload.c
Go to the documentation of this file.
00001 /****************************************************************************** 00002 * 00003 * Module Name: nsload - namespace loading/expanding/contracting procedures 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 __NSLOAD_C__ 00117 00118 #include "acpi.h" 00119 #include "accommon.h" 00120 #include "acnamesp.h" 00121 #include "acdispat.h" 00122 #include "actables.h" 00123 00124 00125 #define _COMPONENT ACPI_NAMESPACE 00126 ACPI_MODULE_NAME ("nsload") 00127 00128 /* Local prototypes */ 00129 00130 #ifdef ACPI_FUTURE_IMPLEMENTATION 00131 ACPI_STATUS 00132 AcpiNsUnloadNamespace ( 00133 ACPI_HANDLE Handle); 00134 00135 static ACPI_STATUS 00136 AcpiNsDeleteSubtree ( 00137 ACPI_HANDLE StartHandle); 00138 #endif 00139 00140 00141 #ifndef ACPI_NO_METHOD_EXECUTION 00142 /******************************************************************************* 00143 * 00144 * FUNCTION: AcpiNsLoadTable 00145 * 00146 * PARAMETERS: TableIndex - Index for table to be loaded 00147 * Node - Owning NS node 00148 * 00149 * RETURN: Status 00150 * 00151 * DESCRIPTION: Load one ACPI table into the namespace 00152 * 00153 ******************************************************************************/ 00154 00155 ACPI_STATUS 00156 AcpiNsLoadTable ( 00157 UINT32 TableIndex, 00158 ACPI_NAMESPACE_NODE *Node) 00159 { 00160 ACPI_STATUS Status; 00161 00162 00163 ACPI_FUNCTION_TRACE (NsLoadTable); 00164 00165 00166 /* 00167 * Parse the table and load the namespace with all named 00168 * objects found within. Control methods are NOT parsed 00169 * at this time. In fact, the control methods cannot be 00170 * parsed until the entire namespace is loaded, because 00171 * if a control method makes a forward reference (call) 00172 * to another control method, we can't continue parsing 00173 * because we don't know how many arguments to parse next! 00174 */ 00175 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); 00176 if (ACPI_FAILURE (Status)) 00177 { 00178 return_ACPI_STATUS (Status); 00179 } 00180 00181 /* If table already loaded into namespace, just return */ 00182 00183 if (AcpiTbIsTableLoaded (TableIndex)) 00184 { 00185 Status = AE_ALREADY_EXISTS; 00186 goto Unlock; 00187 } 00188 00189 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 00190 "**** Loading table into namespace ****\n")); 00191 00192 Status = AcpiTbAllocateOwnerId (TableIndex); 00193 if (ACPI_FAILURE (Status)) 00194 { 00195 goto Unlock; 00196 } 00197 00198 Status = AcpiNsParseTable (TableIndex, Node); 00199 if (ACPI_SUCCESS (Status)) 00200 { 00201 AcpiTbSetTableLoadedFlag (TableIndex, TRUE); 00202 } 00203 else 00204 { 00205 (void) AcpiTbReleaseOwnerId (TableIndex); 00206 } 00207 00208 Unlock: 00209 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); 00210 00211 if (ACPI_FAILURE (Status)) 00212 { 00213 return_ACPI_STATUS (Status); 00214 } 00215 00216 /* 00217 * Now we can parse the control methods. We always parse 00218 * them here for a sanity check, and if configured for 00219 * just-in-time parsing, we delete the control method 00220 * parse trees. 00221 */ 00222 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 00223 "**** Begin Table Method Parsing and Object Initialization\n")); 00224 00225 Status = AcpiDsInitializeObjects (TableIndex, Node); 00226 00227 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 00228 "**** Completed Table Method Parsing and Object Initialization\n")); 00229 00230 return_ACPI_STATUS (Status); 00231 } 00232 00233 00234 #ifdef ACPI_OBSOLETE_FUNCTIONS 00235 /******************************************************************************* 00236 * 00237 * FUNCTION: AcpiLoadNamespace 00238 * 00239 * PARAMETERS: None 00240 * 00241 * RETURN: Status 00242 * 00243 * DESCRIPTION: Load the name space from what ever is pointed to by DSDT. 00244 * (DSDT points to either the BIOS or a buffer.) 00245 * 00246 ******************************************************************************/ 00247 00248 ACPI_STATUS 00249 AcpiNsLoadNamespace ( 00250 void) 00251 { 00252 ACPI_STATUS Status; 00253 00254 00255 ACPI_FUNCTION_TRACE (AcpiLoadNameSpace); 00256 00257 00258 /* There must be at least a DSDT installed */ 00259 00260 if (AcpiGbl_DSDT == NULL) 00261 { 00262 ACPI_ERROR ((AE_INFO, "DSDT is not in memory")); 00263 return_ACPI_STATUS (AE_NO_ACPI_TABLES); 00264 } 00265 00266 /* 00267 * Load the namespace. The DSDT is required, 00268 * but the SSDT and PSDT tables are optional. 00269 */ 00270 Status = AcpiNsLoadTableByType (ACPI_TABLE_ID_DSDT); 00271 if (ACPI_FAILURE (Status)) 00272 { 00273 return_ACPI_STATUS (Status); 00274 } 00275 00276 /* Ignore exceptions from these */ 00277 00278 (void) AcpiNsLoadTableByType (ACPI_TABLE_ID_SSDT); 00279 (void) AcpiNsLoadTableByType (ACPI_TABLE_ID_PSDT); 00280 00281 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, 00282 "ACPI Namespace successfully loaded at root %p\n", 00283 AcpiGbl_RootNode)); 00284 00285 return_ACPI_STATUS (Status); 00286 } 00287 #endif 00288 00289 #ifdef ACPI_FUTURE_IMPLEMENTATION 00290 /******************************************************************************* 00291 * 00292 * FUNCTION: AcpiNsDeleteSubtree 00293 * 00294 * PARAMETERS: StartHandle - Handle in namespace where search begins 00295 * 00296 * RETURNS Status 00297 * 00298 * DESCRIPTION: Walks the namespace starting at the given handle and deletes 00299 * all objects, entries, and scopes in the entire subtree. 00300 * 00301 * Namespace/Interpreter should be locked or the subsystem should 00302 * be in shutdown before this routine is called. 00303 * 00304 ******************************************************************************/ 00305 00306 static ACPI_STATUS 00307 AcpiNsDeleteSubtree ( 00308 ACPI_HANDLE StartHandle) 00309 { 00310 ACPI_STATUS Status; 00311 ACPI_HANDLE ChildHandle; 00312 ACPI_HANDLE ParentHandle; 00313 ACPI_HANDLE NextChildHandle; 00314 ACPI_HANDLE Dummy; 00315 UINT32 Level; 00316 00317 00318 ACPI_FUNCTION_TRACE (NsDeleteSubtree); 00319 00320 00321 ParentHandle = StartHandle; 00322 ChildHandle = NULL; 00323 Level = 1; 00324 00325 /* 00326 * Traverse the tree of objects until we bubble back up 00327 * to where we started. 00328 */ 00329 while (Level > 0) 00330 { 00331 /* Attempt to get the next object in this scope */ 00332 00333 Status = AcpiGetNextObject (ACPI_TYPE_ANY, ParentHandle, 00334 ChildHandle, &NextChildHandle); 00335 00336 ChildHandle = NextChildHandle; 00337 00338 /* Did we get a new object? */ 00339 00340 if (ACPI_SUCCESS (Status)) 00341 { 00342 /* Check if this object has any children */ 00343 00344 if (ACPI_SUCCESS (AcpiGetNextObject (ACPI_TYPE_ANY, ChildHandle, 00345 NULL, &Dummy))) 00346 { 00347 /* 00348 * There is at least one child of this object, 00349 * visit the object 00350 */ 00351 Level++; 00352 ParentHandle = ChildHandle; 00353 ChildHandle = NULL; 00354 } 00355 } 00356 else 00357 { 00358 /* 00359 * No more children in this object, go back up to 00360 * the object's parent 00361 */ 00362 Level--; 00363 00364 /* Delete all children now */ 00365 00366 AcpiNsDeleteChildren (ChildHandle); 00367 00368 ChildHandle = ParentHandle; 00369 Status = AcpiGetParent (ParentHandle, &ParentHandle); 00370 if (ACPI_FAILURE (Status)) 00371 { 00372 return_ACPI_STATUS (Status); 00373 } 00374 } 00375 } 00376 00377 /* Now delete the starting object, and we are done */ 00378 00379 AcpiNsRemoveNode (ChildHandle); 00380 return_ACPI_STATUS (AE_OK); 00381 } 00382 00383 00384 /******************************************************************************* 00385 * 00386 * FUNCTION: AcpiNsUnloadNameSpace 00387 * 00388 * PARAMETERS: Handle - Root of namespace subtree to be deleted 00389 * 00390 * RETURN: Status 00391 * 00392 * DESCRIPTION: Shrinks the namespace, typically in response to an undocking 00393 * event. Deletes an entire subtree starting from (and 00394 * including) the given handle. 00395 * 00396 ******************************************************************************/ 00397 00398 ACPI_STATUS 00399 AcpiNsUnloadNamespace ( 00400 ACPI_HANDLE Handle) 00401 { 00402 ACPI_STATUS Status; 00403 00404 00405 ACPI_FUNCTION_TRACE (NsUnloadNameSpace); 00406 00407 00408 /* Parameter validation */ 00409 00410 if (!AcpiGbl_RootNode) 00411 { 00412 return_ACPI_STATUS (AE_NO_NAMESPACE); 00413 } 00414 00415 if (!Handle) 00416 { 00417 return_ACPI_STATUS (AE_BAD_PARAMETER); 00418 } 00419 00420 /* This function does the real work */ 00421 00422 Status = AcpiNsDeleteSubtree (Handle); 00423 00424 return_ACPI_STATUS (Status); 00425 } 00426 #endif 00427 #endif 00428 Generated on Sat May 26 2012 04:25:53 for ReactOS by
1.7.6.1
|