]> CyberLeo.Net >> Repos - FreeBSD/releng/8.0.git/blob - sys/contrib/dev/acpica/namespace/nsinit.c
Adjust to reflect 8.0-RELEASE.
[FreeBSD/releng/8.0.git] / sys / contrib / dev / acpica / namespace / nsinit.c
1 /******************************************************************************
2  *
3  * Module Name: nsinit - namespace initialization
4  *
5  *****************************************************************************/
6
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights.  You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code.  No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision.  In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change.  Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee.  Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution.  In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government.  In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************/
115
116
117 #define __NSXFINIT_C__
118
119 #include <contrib/dev/acpica/include/acpi.h>
120 #include <contrib/dev/acpica/include/accommon.h>
121 #include <contrib/dev/acpica/include/acnamesp.h>
122 #include <contrib/dev/acpica/include/acdispat.h>
123 #include <contrib/dev/acpica/include/acinterp.h>
124
125 #define _COMPONENT          ACPI_NAMESPACE
126         ACPI_MODULE_NAME    ("nsinit")
127
128 /* Local prototypes */
129
130 static ACPI_STATUS
131 AcpiNsInitOneObject (
132     ACPI_HANDLE             ObjHandle,
133     UINT32                  Level,
134     void                    *Context,
135     void                    **ReturnValue);
136
137 static ACPI_STATUS
138 AcpiNsInitOneDevice (
139     ACPI_HANDLE             ObjHandle,
140     UINT32                  NestingLevel,
141     void                    *Context,
142     void                    **ReturnValue);
143
144 static ACPI_STATUS
145 AcpiNsFindIniMethods (
146     ACPI_HANDLE             ObjHandle,
147     UINT32                  NestingLevel,
148     void                    *Context,
149     void                    **ReturnValue);
150
151
152 /*******************************************************************************
153  *
154  * FUNCTION:    AcpiNsInitializeObjects
155  *
156  * PARAMETERS:  None
157  *
158  * RETURN:      Status
159  *
160  * DESCRIPTION: Walk the entire namespace and perform any necessary
161  *              initialization on the objects found therein
162  *
163  ******************************************************************************/
164
165 ACPI_STATUS
166 AcpiNsInitializeObjects (
167     void)
168 {
169     ACPI_STATUS             Status;
170     ACPI_INIT_WALK_INFO     Info;
171
172
173     ACPI_FUNCTION_TRACE (NsInitializeObjects);
174
175
176     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
177         "**** Starting initialization of namespace objects ****\n"));
178     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
179         "Completing Region/Field/Buffer/Package initialization:"));
180
181     /* Set all init info to zero */
182
183     ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
184
185     /* Walk entire namespace from the supplied root */
186
187     Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
188                                 ACPI_UINT32_MAX, AcpiNsInitOneObject,
189                                 &Info, NULL);
190     if (ACPI_FAILURE (Status))
191     {
192         ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
193     }
194
195     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
196         "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd "
197         "Buffers %hd/%hd Packages (%hd nodes)\n",
198         Info.OpRegionInit,  Info.OpRegionCount,
199         Info.FieldInit,     Info.FieldCount,
200         Info.BufferInit,    Info.BufferCount,
201         Info.PackageInit,   Info.PackageCount, Info.ObjectCount));
202
203     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
204         "%hd Control Methods found\n", Info.MethodCount));
205     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
206         "%hd Op Regions found\n", Info.OpRegionCount));
207
208     return_ACPI_STATUS (AE_OK);
209 }
210
211
212 /*******************************************************************************
213  *
214  * FUNCTION:    AcpiNsInitializeDevices
215  *
216  * PARAMETERS:  None
217  *
218  * RETURN:      ACPI_STATUS
219  *
220  * DESCRIPTION: Walk the entire namespace and initialize all ACPI devices.
221  *              This means running _INI on all present devices.
222  *
223  *              Note: We install PCI config space handler on region access,
224  *              not here.
225  *
226  ******************************************************************************/
227
228 ACPI_STATUS
229 AcpiNsInitializeDevices (
230     void)
231 {
232     ACPI_STATUS             Status;
233     ACPI_DEVICE_WALK_INFO   Info;
234
235
236     ACPI_FUNCTION_TRACE (NsInitializeDevices);
237
238
239     /* Init counters */
240
241     Info.DeviceCount = 0;
242     Info.Num_STA = 0;
243     Info.Num_INI = 0;
244
245     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
246         "Initializing Device/Processor/Thermal objects "
247         "by executing _INI methods:"));
248
249     /* Tree analysis: find all subtrees that contain _INI methods */
250
251     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
252                 ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, &Info, NULL);
253     if (ACPI_FAILURE (Status))
254     {
255         goto ErrorExit;
256     }
257
258     /* Allocate the evaluation information block */
259
260     Info.EvaluateInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
261     if (!Info.EvaluateInfo)
262     {
263         Status = AE_NO_MEMORY;
264         goto ErrorExit;
265     }
266
267     /* Walk namespace to execute all _INIs on present devices */
268
269     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
270                 ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, &Info, NULL);
271
272     ACPI_FREE (Info.EvaluateInfo);
273     if (ACPI_FAILURE (Status))
274     {
275         goto ErrorExit;
276     }
277
278     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
279         "\nExecuted %hd _INI methods requiring %hd _STA executions "
280         "(examined %hd objects)\n",
281         Info.Num_INI, Info.Num_STA, Info.DeviceCount));
282
283     return_ACPI_STATUS (Status);
284
285
286 ErrorExit:
287     ACPI_EXCEPTION ((AE_INFO, Status, "During device initialization"));
288     return_ACPI_STATUS (Status);
289 }
290
291
292 /*******************************************************************************
293  *
294  * FUNCTION:    AcpiNsInitOneObject
295  *
296  * PARAMETERS:  ObjHandle       - Node
297  *              Level           - Current nesting level
298  *              Context         - Points to a init info struct
299  *              ReturnValue     - Not used
300  *
301  * RETURN:      Status
302  *
303  * DESCRIPTION: Callback from AcpiWalkNamespace.  Invoked for every object
304  *              within the  namespace.
305  *
306  *              Currently, the only objects that require initialization are:
307  *              1) Methods
308  *              2) Op Regions
309  *
310  ******************************************************************************/
311
312 static ACPI_STATUS
313 AcpiNsInitOneObject (
314     ACPI_HANDLE             ObjHandle,
315     UINT32                  Level,
316     void                    *Context,
317     void                    **ReturnValue)
318 {
319     ACPI_OBJECT_TYPE        Type;
320     ACPI_STATUS             Status = AE_OK;
321     ACPI_INIT_WALK_INFO     *Info = (ACPI_INIT_WALK_INFO *) Context;
322     ACPI_NAMESPACE_NODE     *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
323     ACPI_OPERAND_OBJECT     *ObjDesc;
324
325
326     ACPI_FUNCTION_NAME (NsInitOneObject);
327
328
329     Info->ObjectCount++;
330
331     /* And even then, we are only interested in a few object types */
332
333     Type = AcpiNsGetType (ObjHandle);
334     ObjDesc = AcpiNsGetAttachedObject (Node);
335     if (!ObjDesc)
336     {
337         return (AE_OK);
338     }
339
340     /* Increment counters for object types we are looking for */
341
342     switch (Type)
343     {
344     case ACPI_TYPE_REGION:
345         Info->OpRegionCount++;
346         break;
347
348     case ACPI_TYPE_BUFFER_FIELD:
349         Info->FieldCount++;
350         break;
351
352     case ACPI_TYPE_LOCAL_BANK_FIELD:
353         Info->FieldCount++;
354         break;
355
356     case ACPI_TYPE_BUFFER:
357         Info->BufferCount++;
358         break;
359
360     case ACPI_TYPE_PACKAGE:
361         Info->PackageCount++;
362         break;
363
364     default:
365
366         /* No init required, just exit now */
367         return (AE_OK);
368     }
369
370     /* If the object is already initialized, nothing else to do */
371
372     if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
373     {
374         return (AE_OK);
375     }
376
377     /* Must lock the interpreter before executing AML code */
378
379     AcpiExEnterInterpreter ();
380
381     /*
382      * Each of these types can contain executable AML code within the
383      * declaration.
384      */
385     switch (Type)
386     {
387     case ACPI_TYPE_REGION:
388
389         Info->OpRegionInit++;
390         Status = AcpiDsGetRegionArguments (ObjDesc);
391         break;
392
393     case ACPI_TYPE_BUFFER_FIELD:
394
395         Info->FieldInit++;
396         Status = AcpiDsGetBufferFieldArguments (ObjDesc);
397         break;
398
399     case ACPI_TYPE_LOCAL_BANK_FIELD:
400
401         Info->FieldInit++;
402         Status = AcpiDsGetBankFieldArguments (ObjDesc);
403         break;
404
405     case ACPI_TYPE_BUFFER:
406
407         Info->BufferInit++;
408         Status = AcpiDsGetBufferArguments (ObjDesc);
409         break;
410
411     case ACPI_TYPE_PACKAGE:
412
413         Info->PackageInit++;
414         Status = AcpiDsGetPackageArguments (ObjDesc);
415         break;
416
417     default:
418         /* No other types can get here */
419         break;
420     }
421
422     if (ACPI_FAILURE (Status))
423     {
424         ACPI_EXCEPTION ((AE_INFO, Status,
425             "Could not execute arguments for [%4.4s] (%s)",
426             AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type)));
427     }
428
429     /*
430      * Print a dot for each object unless we are going to print the entire
431      * pathname
432      */
433     if (!(AcpiDbgLevel & ACPI_LV_INIT_NAMES))
434     {
435         ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
436     }
437
438     /*
439      * We ignore errors from above, and always return OK, since we don't want
440      * to abort the walk on any single error.
441      */
442     AcpiExExitInterpreter ();
443     return (AE_OK);
444 }
445
446
447 /*******************************************************************************
448  *
449  * FUNCTION:    AcpiNsFindIniMethods
450  *
451  * PARAMETERS:  ACPI_WALK_CALLBACK
452  *
453  * RETURN:      ACPI_STATUS
454  *
455  * DESCRIPTION: Called during namespace walk. Finds objects named _INI under
456  *              device/processor/thermal objects, and marks the entire subtree
457  *              with a SUBTREE_HAS_INI flag. This flag is used during the
458  *              subsequent device initialization walk to avoid entire subtrees
459  *              that do not contain an _INI.
460  *
461  ******************************************************************************/
462
463 static ACPI_STATUS
464 AcpiNsFindIniMethods (
465     ACPI_HANDLE             ObjHandle,
466     UINT32                  NestingLevel,
467     void                    *Context,
468     void                    **ReturnValue)
469 {
470     ACPI_DEVICE_WALK_INFO   *Info = ACPI_CAST_PTR (ACPI_DEVICE_WALK_INFO, Context);
471     ACPI_NAMESPACE_NODE     *Node;
472     ACPI_NAMESPACE_NODE     *ParentNode;
473
474
475     /* Keep count of device/processor/thermal objects */
476
477     Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
478     if ((Node->Type == ACPI_TYPE_DEVICE)    ||
479         (Node->Type == ACPI_TYPE_PROCESSOR) ||
480         (Node->Type == ACPI_TYPE_THERMAL))
481     {
482         Info->DeviceCount++;
483         return (AE_OK);
484     }
485
486     /* We are only looking for methods named _INI */
487
488     if (!ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__INI))
489     {
490         return (AE_OK);
491     }
492
493     /*
494      * The only _INI methods that we care about are those that are
495      * present under Device, Processor, and Thermal objects.
496      */
497     ParentNode = AcpiNsGetParentNode (Node);
498     switch (ParentNode->Type)
499     {
500     case ACPI_TYPE_DEVICE:
501     case ACPI_TYPE_PROCESSOR:
502     case ACPI_TYPE_THERMAL:
503
504         /* Mark parent and bubble up the INI present flag to the root */
505
506         while (ParentNode)
507         {
508             ParentNode->Flags |= ANOBJ_SUBTREE_HAS_INI;
509             ParentNode = AcpiNsGetParentNode (ParentNode);
510         }
511         break;
512
513     default:
514         break;
515     }
516
517     return (AE_OK);
518 }
519
520
521 /*******************************************************************************
522  *
523  * FUNCTION:    AcpiNsInitOneDevice
524  *
525  * PARAMETERS:  ACPI_WALK_CALLBACK
526  *
527  * RETURN:      ACPI_STATUS
528  *
529  * DESCRIPTION: This is called once per device soon after ACPI is enabled
530  *              to initialize each device. It determines if the device is
531  *              present, and if so, calls _INI.
532  *
533  ******************************************************************************/
534
535 static ACPI_STATUS
536 AcpiNsInitOneDevice (
537     ACPI_HANDLE             ObjHandle,
538     UINT32                  NestingLevel,
539     void                    *Context,
540     void                    **ReturnValue)
541 {
542     ACPI_DEVICE_WALK_INFO   *WalkInfo = ACPI_CAST_PTR (ACPI_DEVICE_WALK_INFO, Context);
543     ACPI_EVALUATE_INFO      *Info = WalkInfo->EvaluateInfo;
544     UINT32                  Flags;
545     ACPI_STATUS             Status;
546     ACPI_NAMESPACE_NODE     *DeviceNode;
547
548
549     ACPI_FUNCTION_TRACE (NsInitOneDevice);
550
551
552     /* We are interested in Devices, Processors and ThermalZones only */
553
554     DeviceNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
555     if ((DeviceNode->Type != ACPI_TYPE_DEVICE)    &&
556         (DeviceNode->Type != ACPI_TYPE_PROCESSOR) &&
557         (DeviceNode->Type != ACPI_TYPE_THERMAL))
558     {
559         return_ACPI_STATUS (AE_OK);
560     }
561
562     /*
563      * Because of an earlier namespace analysis, all subtrees that contain an
564      * _INI method are tagged.
565      *
566      * If this device subtree does not contain any _INI methods, we
567      * can exit now and stop traversing this entire subtree.
568      */
569     if (!(DeviceNode->Flags & ANOBJ_SUBTREE_HAS_INI))
570     {
571         return_ACPI_STATUS (AE_CTRL_DEPTH);
572     }
573
574     /*
575      * Run _STA to determine if this device is present and functioning. We
576      * must know this information for two important reasons (from ACPI spec):
577      *
578      * 1) We can only run _INI if the device is present.
579      * 2) We must abort the device tree walk on this subtree if the device is
580      *    not present and is not functional (we will not examine the children)
581      *
582      * The _STA method is not required to be present under the device, we
583      * assume the device is present if _STA does not exist.
584      */
585     ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
586         ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__STA));
587
588     Status = AcpiUtExecute_STA (DeviceNode, &Flags);
589     if (ACPI_FAILURE (Status))
590     {
591         /* Ignore error and move on to next device */
592
593         return_ACPI_STATUS (AE_OK);
594     }
595
596     /*
597      * Flags == -1 means that _STA was not found. In this case, we assume that
598      * the device is both present and functional.
599      *
600      * From the ACPI spec, description of _STA:
601      *
602      * "If a device object (including the processor object) does not have an
603      * _STA object, then OSPM assumes that all of the above bits are set (in
604      * other words, the device is present, ..., and functioning)"
605      */
606     if (Flags != ACPI_UINT32_MAX)
607     {
608         WalkInfo->Num_STA++;
609     }
610
611     /*
612      * Examine the PRESENT and FUNCTIONING status bits
613      *
614      * Note: ACPI spec does not seem to specify behavior for the present but
615      * not functioning case, so we assume functioning if present.
616      */
617     if (!(Flags & ACPI_STA_DEVICE_PRESENT))
618     {
619         /* Device is not present, we must examine the Functioning bit */
620
621         if (Flags & ACPI_STA_DEVICE_FUNCTIONING)
622         {
623             /*
624              * Device is not present but is "functioning". In this case,
625              * we will not run _INI, but we continue to examine the children
626              * of this device.
627              *
628              * From the ACPI spec, description of _STA: (Note - no mention
629              * of whether to run _INI or not on the device in question)
630              *
631              * "_STA may return bit 0 clear (not present) with bit 3 set
632              * (device is functional). This case is used to indicate a valid
633              * device for which no device driver should be loaded (for example,
634              * a bridge device.) Children of this device may be present and
635              * valid. OSPM should continue enumeration below a device whose
636              * _STA returns this bit combination"
637              */
638             return_ACPI_STATUS (AE_OK);
639         }
640         else
641         {
642             /*
643              * Device is not present and is not functioning. We must abort the
644              * walk of this subtree immediately -- don't look at the children
645              * of such a device.
646              *
647              * From the ACPI spec, description of _INI:
648              *
649              * "If the _STA method indicates that the device is not present,
650              * OSPM will not run the _INI and will not examine the children
651              * of the device for _INI methods"
652              */
653             return_ACPI_STATUS (AE_CTRL_DEPTH);
654         }
655     }
656
657     /*
658      * The device is present or is assumed present if no _STA exists.
659      * Run the _INI if it exists (not required to exist)
660      *
661      * Note: We know there is an _INI within this subtree, but it may not be
662      * under this particular device, it may be lower in the branch.
663      */
664     ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
665         ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__INI));
666
667     Info->PrefixNode = DeviceNode;
668     Info->Pathname = METHOD_NAME__INI;
669     Info->Parameters = NULL;
670     Info->Flags = ACPI_IGNORE_RETURN_VALUE;
671
672     Status = AcpiNsEvaluate (Info);
673     if (ACPI_SUCCESS (Status))
674     {
675         WalkInfo->Num_INI++;
676
677         if ((AcpiDbgLevel <= ACPI_LV_ALL_EXCEPTIONS) &&
678             (!(AcpiDbgLevel & ACPI_LV_INFO)))
679         {
680             ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
681         }
682     }
683
684 #ifdef ACPI_DEBUG_OUTPUT
685     else if (Status != AE_NOT_FOUND)
686     {
687         /* Ignore error and move on to next device */
688
689         char *ScopeName = AcpiNsGetExternalPathname (Info->ResolvedNode);
690
691         ACPI_EXCEPTION ((AE_INFO, Status, "during %s._INI execution",
692             ScopeName));
693         ACPI_FREE (ScopeName);
694     }
695 #endif
696
697     /* Ignore errors from above */
698
699     Status = AE_OK;
700
701     /*
702      * The _INI method has been run if present; call the Global Initialization
703      * Handler for this device.
704      */
705     if (AcpiGbl_InitHandler)
706     {
707         Status = AcpiGbl_InitHandler (DeviceNode, ACPI_INIT_DEVICE_INI);
708     }
709
710     return_ACPI_STATUS (Status);
711 }