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