Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygennsinit.c
Go to the documentation of this file.
00001 /****************************************************************************** 00002 * 00003 * Module Name: nsinit - namespace initialization 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 00117 #define __NSXFINIT_C__ 00118 00119 #include "acpi.h" 00120 #include "accommon.h" 00121 #include "acnamesp.h" 00122 #include "acdispat.h" 00123 #include "acinterp.h" 00124 00125 #define _COMPONENT ACPI_NAMESPACE 00126 ACPI_MODULE_NAME ("nsinit") 00127 00128 /* Local prototypes */ 00129 00130 static ACPI_STATUS 00131 AcpiNsInitOneObject ( 00132 ACPI_HANDLE ObjHandle, 00133 UINT32 Level, 00134 void *Context, 00135 void **ReturnValue); 00136 00137 static ACPI_STATUS 00138 AcpiNsInitOneDevice ( 00139 ACPI_HANDLE ObjHandle, 00140 UINT32 NestingLevel, 00141 void *Context, 00142 void **ReturnValue); 00143 00144 static ACPI_STATUS 00145 AcpiNsFindIniMethods ( 00146 ACPI_HANDLE ObjHandle, 00147 UINT32 NestingLevel, 00148 void *Context, 00149 void **ReturnValue); 00150 00151 00152 /******************************************************************************* 00153 * 00154 * FUNCTION: AcpiNsInitializeObjects 00155 * 00156 * PARAMETERS: None 00157 * 00158 * RETURN: Status 00159 * 00160 * DESCRIPTION: Walk the entire namespace and perform any necessary 00161 * initialization on the objects found therein 00162 * 00163 ******************************************************************************/ 00164 00165 ACPI_STATUS 00166 AcpiNsInitializeObjects ( 00167 void) 00168 { 00169 ACPI_STATUS Status; 00170 ACPI_INIT_WALK_INFO Info; 00171 00172 00173 ACPI_FUNCTION_TRACE (NsInitializeObjects); 00174 00175 00176 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 00177 "**** Starting initialization of namespace objects ****\n")); 00178 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, 00179 "Completing Region/Field/Buffer/Package initialization:")); 00180 00181 /* Set all init info to zero */ 00182 00183 ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); 00184 00185 /* Walk entire namespace from the supplied root */ 00186 00187 Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, 00188 ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, 00189 &Info, NULL); 00190 if (ACPI_FAILURE (Status)) 00191 { 00192 ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace")); 00193 } 00194 00195 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, 00196 "\nInitialized %u/%u Regions %u/%u Fields %u/%u " 00197 "Buffers %u/%u Packages (%u nodes)\n", 00198 Info.OpRegionInit, Info.OpRegionCount, 00199 Info.FieldInit, Info.FieldCount, 00200 Info.BufferInit, Info.BufferCount, 00201 Info.PackageInit, Info.PackageCount, Info.ObjectCount)); 00202 00203 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 00204 "%u Control Methods found\n", Info.MethodCount)); 00205 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 00206 "%u Op Regions found\n", Info.OpRegionCount)); 00207 00208 return_ACPI_STATUS (AE_OK); 00209 } 00210 00211 00212 /******************************************************************************* 00213 * 00214 * FUNCTION: AcpiNsInitializeDevices 00215 * 00216 * PARAMETERS: None 00217 * 00218 * RETURN: ACPI_STATUS 00219 * 00220 * DESCRIPTION: Walk the entire namespace and initialize all ACPI devices. 00221 * This means running _INI on all present devices. 00222 * 00223 * Note: We install PCI config space handler on region access, 00224 * not here. 00225 * 00226 ******************************************************************************/ 00227 00228 ACPI_STATUS 00229 AcpiNsInitializeDevices ( 00230 void) 00231 { 00232 ACPI_STATUS Status; 00233 ACPI_DEVICE_WALK_INFO Info; 00234 00235 00236 ACPI_FUNCTION_TRACE (NsInitializeDevices); 00237 00238 00239 /* Init counters */ 00240 00241 Info.DeviceCount = 0; 00242 Info.Num_STA = 0; 00243 Info.Num_INI = 0; 00244 00245 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, 00246 "Initializing Device/Processor/Thermal objects " 00247 "by executing _INI methods:")); 00248 00249 /* Tree analysis: find all subtrees that contain _INI methods */ 00250 00251 Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, 00252 ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, NULL, &Info, NULL); 00253 if (ACPI_FAILURE (Status)) 00254 { 00255 goto ErrorExit; 00256 } 00257 00258 /* Allocate the evaluation information block */ 00259 00260 Info.EvaluateInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); 00261 if (!Info.EvaluateInfo) 00262 { 00263 Status = AE_NO_MEMORY; 00264 goto ErrorExit; 00265 } 00266 00267 /* 00268 * Execute the "global" _INI method that may appear at the root. This 00269 * support is provided for Windows compatibility (Vista+) and is not 00270 * part of the ACPI specification. 00271 */ 00272 Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode; 00273 Info.EvaluateInfo->Pathname = METHOD_NAME__INI; 00274 Info.EvaluateInfo->Parameters = NULL; 00275 Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE; 00276 00277 Status = AcpiNsEvaluate (Info.EvaluateInfo); 00278 if (ACPI_SUCCESS (Status)) 00279 { 00280 Info.Num_INI++; 00281 } 00282 00283 /* Walk namespace to execute all _INIs on present devices */ 00284 00285 Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, 00286 ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL); 00287 00288 /* 00289 * Any _OSI requests should be completed by now. If the BIOS has 00290 * requested any Windows OSI strings, we will always truncate 00291 * I/O addresses to 16 bits -- for Windows compatibility. 00292 */ 00293 if (AcpiGbl_OsiData >= ACPI_OSI_WIN_2000) 00294 { 00295 AcpiGbl_TruncateIoAddresses = TRUE; 00296 } 00297 00298 ACPI_FREE (Info.EvaluateInfo); 00299 if (ACPI_FAILURE (Status)) 00300 { 00301 goto ErrorExit; 00302 } 00303 00304 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, 00305 "\nExecuted %u _INI methods requiring %u _STA executions " 00306 "(examined %u objects)\n", 00307 Info.Num_INI, Info.Num_STA, Info.DeviceCount)); 00308 00309 return_ACPI_STATUS (Status); 00310 00311 00312 ErrorExit: 00313 ACPI_EXCEPTION ((AE_INFO, Status, "During device initialization")); 00314 return_ACPI_STATUS (Status); 00315 } 00316 00317 00318 /******************************************************************************* 00319 * 00320 * FUNCTION: AcpiNsInitOneObject 00321 * 00322 * PARAMETERS: ObjHandle - Node 00323 * Level - Current nesting level 00324 * Context - Points to a init info struct 00325 * ReturnValue - Not used 00326 * 00327 * RETURN: Status 00328 * 00329 * DESCRIPTION: Callback from AcpiWalkNamespace. Invoked for every object 00330 * within the namespace. 00331 * 00332 * Currently, the only objects that require initialization are: 00333 * 1) Methods 00334 * 2) Op Regions 00335 * 00336 ******************************************************************************/ 00337 00338 static ACPI_STATUS 00339 AcpiNsInitOneObject ( 00340 ACPI_HANDLE ObjHandle, 00341 UINT32 Level, 00342 void *Context, 00343 void **ReturnValue) 00344 { 00345 ACPI_OBJECT_TYPE Type; 00346 ACPI_STATUS Status = AE_OK; 00347 ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context; 00348 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; 00349 ACPI_OPERAND_OBJECT *ObjDesc; 00350 00351 00352 ACPI_FUNCTION_NAME (NsInitOneObject); 00353 00354 00355 Info->ObjectCount++; 00356 00357 /* And even then, we are only interested in a few object types */ 00358 00359 Type = AcpiNsGetType (ObjHandle); 00360 ObjDesc = AcpiNsGetAttachedObject (Node); 00361 if (!ObjDesc) 00362 { 00363 return (AE_OK); 00364 } 00365 00366 /* Increment counters for object types we are looking for */ 00367 00368 switch (Type) 00369 { 00370 case ACPI_TYPE_REGION: 00371 Info->OpRegionCount++; 00372 break; 00373 00374 case ACPI_TYPE_BUFFER_FIELD: 00375 Info->FieldCount++; 00376 break; 00377 00378 case ACPI_TYPE_LOCAL_BANK_FIELD: 00379 Info->FieldCount++; 00380 break; 00381 00382 case ACPI_TYPE_BUFFER: 00383 Info->BufferCount++; 00384 break; 00385 00386 case ACPI_TYPE_PACKAGE: 00387 Info->PackageCount++; 00388 break; 00389 00390 default: 00391 00392 /* No init required, just exit now */ 00393 return (AE_OK); 00394 } 00395 00396 /* If the object is already initialized, nothing else to do */ 00397 00398 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) 00399 { 00400 return (AE_OK); 00401 } 00402 00403 /* Must lock the interpreter before executing AML code */ 00404 00405 AcpiExEnterInterpreter (); 00406 00407 /* 00408 * Each of these types can contain executable AML code within the 00409 * declaration. 00410 */ 00411 switch (Type) 00412 { 00413 case ACPI_TYPE_REGION: 00414 00415 Info->OpRegionInit++; 00416 Status = AcpiDsGetRegionArguments (ObjDesc); 00417 break; 00418 00419 case ACPI_TYPE_BUFFER_FIELD: 00420 00421 Info->FieldInit++; 00422 Status = AcpiDsGetBufferFieldArguments (ObjDesc); 00423 break; 00424 00425 case ACPI_TYPE_LOCAL_BANK_FIELD: 00426 00427 Info->FieldInit++; 00428 Status = AcpiDsGetBankFieldArguments (ObjDesc); 00429 break; 00430 00431 case ACPI_TYPE_BUFFER: 00432 00433 Info->BufferInit++; 00434 Status = AcpiDsGetBufferArguments (ObjDesc); 00435 break; 00436 00437 case ACPI_TYPE_PACKAGE: 00438 00439 Info->PackageInit++; 00440 Status = AcpiDsGetPackageArguments (ObjDesc); 00441 break; 00442 00443 default: 00444 /* No other types can get here */ 00445 break; 00446 } 00447 00448 if (ACPI_FAILURE (Status)) 00449 { 00450 ACPI_EXCEPTION ((AE_INFO, Status, 00451 "Could not execute arguments for [%4.4s] (%s)", 00452 AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type))); 00453 } 00454 00455 /* 00456 * Print a dot for each object unless we are going to print the entire 00457 * pathname 00458 */ 00459 if (!(AcpiDbgLevel & ACPI_LV_INIT_NAMES)) 00460 { 00461 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); 00462 } 00463 00464 /* 00465 * We ignore errors from above, and always return OK, since we don't want 00466 * to abort the walk on any single error. 00467 */ 00468 AcpiExExitInterpreter (); 00469 return (AE_OK); 00470 } 00471 00472 00473 /******************************************************************************* 00474 * 00475 * FUNCTION: AcpiNsFindIniMethods 00476 * 00477 * PARAMETERS: ACPI_WALK_CALLBACK 00478 * 00479 * RETURN: ACPI_STATUS 00480 * 00481 * DESCRIPTION: Called during namespace walk. Finds objects named _INI under 00482 * device/processor/thermal objects, and marks the entire subtree 00483 * with a SUBTREE_HAS_INI flag. This flag is used during the 00484 * subsequent device initialization walk to avoid entire subtrees 00485 * that do not contain an _INI. 00486 * 00487 ******************************************************************************/ 00488 00489 static ACPI_STATUS 00490 AcpiNsFindIniMethods ( 00491 ACPI_HANDLE ObjHandle, 00492 UINT32 NestingLevel, 00493 void *Context, 00494 void **ReturnValue) 00495 { 00496 ACPI_DEVICE_WALK_INFO *Info = ACPI_CAST_PTR (ACPI_DEVICE_WALK_INFO, Context); 00497 ACPI_NAMESPACE_NODE *Node; 00498 ACPI_NAMESPACE_NODE *ParentNode; 00499 00500 00501 /* Keep count of device/processor/thermal objects */ 00502 00503 Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); 00504 if ((Node->Type == ACPI_TYPE_DEVICE) || 00505 (Node->Type == ACPI_TYPE_PROCESSOR) || 00506 (Node->Type == ACPI_TYPE_THERMAL)) 00507 { 00508 Info->DeviceCount++; 00509 return (AE_OK); 00510 } 00511 00512 /* We are only looking for methods named _INI */ 00513 00514 if (!ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__INI)) 00515 { 00516 return (AE_OK); 00517 } 00518 00519 /* 00520 * The only _INI methods that we care about are those that are 00521 * present under Device, Processor, and Thermal objects. 00522 */ 00523 ParentNode = Node->Parent; 00524 switch (ParentNode->Type) 00525 { 00526 case ACPI_TYPE_DEVICE: 00527 case ACPI_TYPE_PROCESSOR: 00528 case ACPI_TYPE_THERMAL: 00529 00530 /* Mark parent and bubble up the INI present flag to the root */ 00531 00532 while (ParentNode) 00533 { 00534 ParentNode->Flags |= ANOBJ_SUBTREE_HAS_INI; 00535 ParentNode = ParentNode->Parent; 00536 } 00537 break; 00538 00539 default: 00540 break; 00541 } 00542 00543 return (AE_OK); 00544 } 00545 00546 00547 /******************************************************************************* 00548 * 00549 * FUNCTION: AcpiNsInitOneDevice 00550 * 00551 * PARAMETERS: ACPI_WALK_CALLBACK 00552 * 00553 * RETURN: ACPI_STATUS 00554 * 00555 * DESCRIPTION: This is called once per device soon after ACPI is enabled 00556 * to initialize each device. It determines if the device is 00557 * present, and if so, calls _INI. 00558 * 00559 ******************************************************************************/ 00560 00561 static ACPI_STATUS 00562 AcpiNsInitOneDevice ( 00563 ACPI_HANDLE ObjHandle, 00564 UINT32 NestingLevel, 00565 void *Context, 00566 void **ReturnValue) 00567 { 00568 ACPI_DEVICE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_DEVICE_WALK_INFO, Context); 00569 ACPI_EVALUATE_INFO *Info = WalkInfo->EvaluateInfo; 00570 UINT32 Flags; 00571 ACPI_STATUS Status; 00572 ACPI_NAMESPACE_NODE *DeviceNode; 00573 00574 00575 ACPI_FUNCTION_TRACE (NsInitOneDevice); 00576 00577 00578 /* We are interested in Devices, Processors and ThermalZones only */ 00579 00580 DeviceNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); 00581 if ((DeviceNode->Type != ACPI_TYPE_DEVICE) && 00582 (DeviceNode->Type != ACPI_TYPE_PROCESSOR) && 00583 (DeviceNode->Type != ACPI_TYPE_THERMAL)) 00584 { 00585 return_ACPI_STATUS (AE_OK); 00586 } 00587 00588 /* 00589 * Because of an earlier namespace analysis, all subtrees that contain an 00590 * _INI method are tagged. 00591 * 00592 * If this device subtree does not contain any _INI methods, we 00593 * can exit now and stop traversing this entire subtree. 00594 */ 00595 if (!(DeviceNode->Flags & ANOBJ_SUBTREE_HAS_INI)) 00596 { 00597 return_ACPI_STATUS (AE_CTRL_DEPTH); 00598 } 00599 00600 /* 00601 * Run _STA to determine if this device is present and functioning. We 00602 * must know this information for two important reasons (from ACPI spec): 00603 * 00604 * 1) We can only run _INI if the device is present. 00605 * 2) We must abort the device tree walk on this subtree if the device is 00606 * not present and is not functional (we will not examine the children) 00607 * 00608 * The _STA method is not required to be present under the device, we 00609 * assume the device is present if _STA does not exist. 00610 */ 00611 ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( 00612 ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__STA)); 00613 00614 Status = AcpiUtExecute_STA (DeviceNode, &Flags); 00615 if (ACPI_FAILURE (Status)) 00616 { 00617 /* Ignore error and move on to next device */ 00618 00619 return_ACPI_STATUS (AE_OK); 00620 } 00621 00622 /* 00623 * Flags == -1 means that _STA was not found. In this case, we assume that 00624 * the device is both present and functional. 00625 * 00626 * From the ACPI spec, description of _STA: 00627 * 00628 * "If a device object (including the processor object) does not have an 00629 * _STA object, then OSPM assumes that all of the above bits are set (in 00630 * other words, the device is present, ..., and functioning)" 00631 */ 00632 if (Flags != ACPI_UINT32_MAX) 00633 { 00634 WalkInfo->Num_STA++; 00635 } 00636 00637 /* 00638 * Examine the PRESENT and FUNCTIONING status bits 00639 * 00640 * Note: ACPI spec does not seem to specify behavior for the present but 00641 * not functioning case, so we assume functioning if present. 00642 */ 00643 if (!(Flags & ACPI_STA_DEVICE_PRESENT)) 00644 { 00645 /* Device is not present, we must examine the Functioning bit */ 00646 00647 if (Flags & ACPI_STA_DEVICE_FUNCTIONING) 00648 { 00649 /* 00650 * Device is not present but is "functioning". In this case, 00651 * we will not run _INI, but we continue to examine the children 00652 * of this device. 00653 * 00654 * From the ACPI spec, description of _STA: (Note - no mention 00655 * of whether to run _INI or not on the device in question) 00656 * 00657 * "_STA may return bit 0 clear (not present) with bit 3 set 00658 * (device is functional). This case is used to indicate a valid 00659 * device for which no device driver should be loaded (for example, 00660 * a bridge device.) Children of this device may be present and 00661 * valid. OSPM should continue enumeration below a device whose 00662 * _STA returns this bit combination" 00663 */ 00664 return_ACPI_STATUS (AE_OK); 00665 } 00666 else 00667 { 00668 /* 00669 * Device is not present and is not functioning. We must abort the 00670 * walk of this subtree immediately -- don't look at the children 00671 * of such a device. 00672 * 00673 * From the ACPI spec, description of _INI: 00674 * 00675 * "If the _STA method indicates that the device is not present, 00676 * OSPM will not run the _INI and will not examine the children 00677 * of the device for _INI methods" 00678 */ 00679 return_ACPI_STATUS (AE_CTRL_DEPTH); 00680 } 00681 } 00682 00683 /* 00684 * The device is present or is assumed present if no _STA exists. 00685 * Run the _INI if it exists (not required to exist) 00686 * 00687 * Note: We know there is an _INI within this subtree, but it may not be 00688 * under this particular device, it may be lower in the branch. 00689 */ 00690 ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname ( 00691 ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__INI)); 00692 00693 Info->PrefixNode = DeviceNode; 00694 Info->Pathname = METHOD_NAME__INI; 00695 Info->Parameters = NULL; 00696 Info->Flags = ACPI_IGNORE_RETURN_VALUE; 00697 00698 Status = AcpiNsEvaluate (Info); 00699 if (ACPI_SUCCESS (Status)) 00700 { 00701 WalkInfo->Num_INI++; 00702 00703 if ((AcpiDbgLevel <= ACPI_LV_ALL_EXCEPTIONS) && 00704 (!(AcpiDbgLevel & ACPI_LV_INFO))) 00705 { 00706 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); 00707 } 00708 } 00709 00710 #ifdef ACPI_DEBUG_OUTPUT 00711 else if (Status != AE_NOT_FOUND) 00712 { 00713 /* Ignore error and move on to next device */ 00714 00715 char *ScopeName = AcpiNsGetExternalPathname (Info->ResolvedNode); 00716 00717 ACPI_EXCEPTION ((AE_INFO, Status, "during %s._INI execution", 00718 ScopeName)); 00719 ACPI_FREE (ScopeName); 00720 } 00721 #endif 00722 00723 /* Ignore errors from above */ 00724 00725 Status = AE_OK; 00726 00727 /* 00728 * The _INI method has been run if present; call the Global Initialization 00729 * Handler for this device. 00730 */ 00731 if (AcpiGbl_InitHandler) 00732 { 00733 Status = AcpiGbl_InitHandler (DeviceNode, ACPI_INIT_DEVICE_INI); 00734 } 00735 00736 return_ACPI_STATUS (Status); 00737 } Generated on Thu May 24 2012 04:27:52 for ReactOS by
1.7.6.1
|