xref: /titanic_41/usr/src/uts/intel/sys/acpi/acnamesp.h (revision 7535ae1914017b0e648abd7a139aca709fa82be3)
1 /******************************************************************************
2  *
3  * Name: acnamesp.h - Namespace subcomponent prototypes and defines
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2011, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43 
44 #ifndef __ACNAMESP_H__
45 #define __ACNAMESP_H__
46 
47 
48 /* To search the entire name space, pass this as SearchBase */
49 
50 #define ACPI_NS_ALL                 ((ACPI_HANDLE)0)
51 
52 /*
53  * Elements of AcpiNsProperties are bit significant
54  * and should be one-to-one with values of ACPI_OBJECT_TYPE
55  */
56 #define ACPI_NS_NORMAL              0
57 #define ACPI_NS_NEWSCOPE            1   /* a definition of this type opens a name scope */
58 #define ACPI_NS_LOCAL               2   /* suppress search of enclosing scopes */
59 
60 /* Flags for AcpiNsLookup, AcpiNsSearchAndEnter */
61 
62 #define ACPI_NS_NO_UPSEARCH         0
63 #define ACPI_NS_SEARCH_PARENT       0x01
64 #define ACPI_NS_DONT_OPEN_SCOPE     0x02
65 #define ACPI_NS_NO_PEER_SEARCH      0x04
66 #define ACPI_NS_ERROR_IF_FOUND      0x08
67 #define ACPI_NS_PREFIX_IS_SCOPE     0x10
68 #define ACPI_NS_EXTERNAL            0x20
69 #define ACPI_NS_TEMPORARY           0x40
70 
71 /* Flags for AcpiNsWalkNamespace */
72 
73 #define ACPI_NS_WALK_NO_UNLOCK      0
74 #define ACPI_NS_WALK_UNLOCK         0x01
75 #define ACPI_NS_WALK_TEMP_NODES     0x02
76 
77 /* Object is not a package element */
78 
79 #define ACPI_NOT_PACKAGE_ELEMENT    ACPI_UINT32_MAX
80 
81 /* Always emit warning message, not dependent on node flags */
82 
83 #define ACPI_WARN_ALWAYS            0
84 
85 
86 /*
87  * nsinit - Namespace initialization
88  */
89 ACPI_STATUS
90 AcpiNsInitializeObjects (
91     void);
92 
93 ACPI_STATUS
94 AcpiNsInitializeDevices (
95     void);
96 
97 
98 /*
99  * nsload -  Namespace loading
100  */
101 ACPI_STATUS
102 AcpiNsLoadNamespace (
103     void);
104 
105 ACPI_STATUS
106 AcpiNsLoadTable (
107     UINT32                  TableIndex,
108     ACPI_NAMESPACE_NODE     *Node);
109 
110 
111 /*
112  * nswalk - walk the namespace
113  */
114 ACPI_STATUS
115 AcpiNsWalkNamespace (
116     ACPI_OBJECT_TYPE        Type,
117     ACPI_HANDLE             StartObject,
118     UINT32                  MaxDepth,
119     UINT32                  Flags,
120     ACPI_WALK_CALLBACK      PreOrderVisit,
121     ACPI_WALK_CALLBACK      PostOrderVisit,
122     void                    *Context,
123     void                    **ReturnValue);
124 
125 ACPI_NAMESPACE_NODE *
126 AcpiNsGetNextNode (
127     ACPI_NAMESPACE_NODE     *Parent,
128     ACPI_NAMESPACE_NODE     *Child);
129 
130 ACPI_NAMESPACE_NODE *
131 AcpiNsGetNextNodeTyped (
132     ACPI_OBJECT_TYPE        Type,
133     ACPI_NAMESPACE_NODE     *Parent,
134     ACPI_NAMESPACE_NODE     *Child);
135 
136 /*
137  * nsparse - table parsing
138  */
139 ACPI_STATUS
140 AcpiNsParseTable (
141     UINT32                  TableIndex,
142     ACPI_NAMESPACE_NODE     *StartNode);
143 
144 ACPI_STATUS
145 AcpiNsOneCompleteParse (
146     UINT32                  PassNumber,
147     UINT32                  TableIndex,
148     ACPI_NAMESPACE_NODE     *StartNode);
149 
150 
151 /*
152  * nsaccess - Top-level namespace access
153  */
154 ACPI_STATUS
155 AcpiNsRootInitialize (
156     void);
157 
158 ACPI_STATUS
159 AcpiNsLookup (
160     ACPI_GENERIC_STATE      *ScopeInfo,
161     char                    *Name,
162     ACPI_OBJECT_TYPE        Type,
163     ACPI_INTERPRETER_MODE   InterpreterMode,
164     UINT32                  Flags,
165     ACPI_WALK_STATE         *WalkState,
166     ACPI_NAMESPACE_NODE     **RetNode);
167 
168 
169 /*
170  * nsalloc - Named object allocation/deallocation
171  */
172 ACPI_NAMESPACE_NODE *
173 AcpiNsCreateNode (
174     UINT32                  Name);
175 
176 void
177 AcpiNsDeleteNode (
178     ACPI_NAMESPACE_NODE     *Node);
179 
180 void
181 AcpiNsRemoveNode (
182     ACPI_NAMESPACE_NODE     *Node);
183 
184 void
185 AcpiNsDeleteNamespaceSubtree (
186     ACPI_NAMESPACE_NODE     *ParentHandle);
187 
188 void
189 AcpiNsDeleteNamespaceByOwner (
190     ACPI_OWNER_ID           OwnerId);
191 
192 void
193 AcpiNsDetachObject (
194     ACPI_NAMESPACE_NODE     *Node);
195 
196 void
197 AcpiNsDeleteChildren (
198     ACPI_NAMESPACE_NODE     *Parent);
199 
200 int
201 AcpiNsCompareNames (
202     char                    *Name1,
203     char                    *Name2);
204 
205 
206 /*
207  * nsdump - Namespace dump/print utilities
208  */
209 void
210 AcpiNsDumpTables (
211     ACPI_HANDLE             SearchBase,
212     UINT32                  MaxDepth);
213 
214 void
215 AcpiNsDumpEntry (
216     ACPI_HANDLE             Handle,
217     UINT32                  DebugLevel);
218 
219 void
220 AcpiNsDumpPathname (
221     ACPI_HANDLE             Handle,
222     char                    *Msg,
223     UINT32                  Level,
224     UINT32                  Component);
225 
226 void
227 AcpiNsPrintPathname (
228     UINT32                  NumSegments,
229     char                    *Pathname);
230 
231 ACPI_STATUS
232 AcpiNsDumpOneObject (
233     ACPI_HANDLE             ObjHandle,
234     UINT32                  Level,
235     void                    *Context,
236     void                    **ReturnValue);
237 
238 void
239 AcpiNsDumpObjects (
240     ACPI_OBJECT_TYPE        Type,
241     UINT8                   DisplayType,
242     UINT32                  MaxDepth,
243     ACPI_OWNER_ID           OwnerId,
244     ACPI_HANDLE             StartHandle);
245 
246 
247 /*
248  * nseval - Namespace evaluation functions
249  */
250 ACPI_STATUS
251 AcpiNsEvaluate (
252     ACPI_EVALUATE_INFO      *Info);
253 
254 void
255 AcpiNsExecModuleCodeList (
256     void);
257 
258 
259 /*
260  * nspredef - Support for predefined/reserved names
261  */
262 ACPI_STATUS
263 AcpiNsCheckPredefinedNames (
264     ACPI_NAMESPACE_NODE     *Node,
265     UINT32                  UserParamCount,
266     ACPI_STATUS             ReturnStatus,
267     ACPI_OPERAND_OBJECT     **ReturnObject);
268 
269 const ACPI_PREDEFINED_INFO *
270 AcpiNsCheckForPredefinedName (
271     ACPI_NAMESPACE_NODE     *Node);
272 
273 void
274 AcpiNsCheckParameterCount (
275     char                        *Pathname,
276     ACPI_NAMESPACE_NODE         *Node,
277     UINT32                      UserParamCount,
278     const ACPI_PREDEFINED_INFO  *Info);
279 
280 
281 /*
282  * nsnames - Name and Scope manipulation
283  */
284 UINT32
285 AcpiNsOpensScope (
286     ACPI_OBJECT_TYPE        Type);
287 
288 ACPI_STATUS
289 AcpiNsBuildExternalPath (
290     ACPI_NAMESPACE_NODE     *Node,
291     ACPI_SIZE               Size,
292     char                    *NameBuffer);
293 
294 char *
295 AcpiNsGetExternalPathname (
296     ACPI_NAMESPACE_NODE     *Node);
297 
298 char *
299 AcpiNsNameOfCurrentScope (
300     ACPI_WALK_STATE         *WalkState);
301 
302 ACPI_STATUS
303 AcpiNsHandleToPathname (
304     ACPI_HANDLE             TargetHandle,
305     ACPI_BUFFER             *Buffer);
306 
307 BOOLEAN
308 AcpiNsPatternMatch (
309     ACPI_NAMESPACE_NODE     *ObjNode,
310     char                    *SearchFor);
311 
312 ACPI_STATUS
313 AcpiNsGetNode (
314     ACPI_NAMESPACE_NODE     *PrefixNode,
315     const char              *ExternalPathname,
316     UINT32                  Flags,
317     ACPI_NAMESPACE_NODE     **OutNode);
318 
319 ACPI_SIZE
320 AcpiNsGetPathnameLength (
321     ACPI_NAMESPACE_NODE     *Node);
322 
323 
324 /*
325  * nsobject - Object management for namespace nodes
326  */
327 ACPI_STATUS
328 AcpiNsAttachObject (
329     ACPI_NAMESPACE_NODE     *Node,
330     ACPI_OPERAND_OBJECT     *Object,
331     ACPI_OBJECT_TYPE        Type);
332 
333 ACPI_OPERAND_OBJECT *
334 AcpiNsGetAttachedObject (
335     ACPI_NAMESPACE_NODE     *Node);
336 
337 ACPI_OPERAND_OBJECT *
338 AcpiNsGetSecondaryObject (
339     ACPI_OPERAND_OBJECT     *ObjDesc);
340 
341 ACPI_STATUS
342 AcpiNsAttachData (
343     ACPI_NAMESPACE_NODE     *Node,
344     ACPI_OBJECT_HANDLER     Handler,
345     void                    *Data);
346 
347 ACPI_STATUS
348 AcpiNsDetachData (
349     ACPI_NAMESPACE_NODE     *Node,
350     ACPI_OBJECT_HANDLER     Handler);
351 
352 ACPI_STATUS
353 AcpiNsGetAttachedData (
354     ACPI_NAMESPACE_NODE     *Node,
355     ACPI_OBJECT_HANDLER     Handler,
356     void                    **Data);
357 
358 
359 /*
360  * nsrepair - General return object repair for all
361  * predefined methods/objects
362  */
363 ACPI_STATUS
364 AcpiNsRepairObject (
365     ACPI_PREDEFINED_DATA    *Data,
366     UINT32                  ExpectedBtypes,
367     UINT32                  PackageIndex,
368     ACPI_OPERAND_OBJECT     **ReturnObjectPtr);
369 
370 ACPI_STATUS
371 AcpiNsRepairPackageList (
372     ACPI_PREDEFINED_DATA    *Data,
373     ACPI_OPERAND_OBJECT     **ObjDescPtr);
374 
375 ACPI_STATUS
376 AcpiNsRepairNullElement (
377     ACPI_PREDEFINED_DATA    *Data,
378     UINT32                  ExpectedBtypes,
379     UINT32                  PackageIndex,
380     ACPI_OPERAND_OBJECT     **ReturnObjectPtr);
381 
382 void
383 AcpiNsRemoveNullElements (
384     ACPI_PREDEFINED_DATA    *Data,
385     UINT8                   PackageType,
386     ACPI_OPERAND_OBJECT     *ObjDesc);
387 
388 
389 /*
390  * nsrepair2 - Return object repair for specific
391  * predefined methods/objects
392  */
393 ACPI_STATUS
394 AcpiNsComplexRepairs (
395     ACPI_PREDEFINED_DATA    *Data,
396     ACPI_NAMESPACE_NODE     *Node,
397     ACPI_STATUS             ValidateStatus,
398     ACPI_OPERAND_OBJECT     **ReturnObjectPtr);
399 
400 
401 /*
402  * nssearch - Namespace searching and entry
403  */
404 ACPI_STATUS
405 AcpiNsSearchAndEnter (
406     UINT32                  EntryName,
407     ACPI_WALK_STATE         *WalkState,
408     ACPI_NAMESPACE_NODE     *Node,
409     ACPI_INTERPRETER_MODE   InterpreterMode,
410     ACPI_OBJECT_TYPE        Type,
411     UINT32                  Flags,
412     ACPI_NAMESPACE_NODE     **RetNode);
413 
414 ACPI_STATUS
415 AcpiNsSearchOneScope (
416     UINT32                  EntryName,
417     ACPI_NAMESPACE_NODE     *Node,
418     ACPI_OBJECT_TYPE        Type,
419     ACPI_NAMESPACE_NODE     **RetNode);
420 
421 void
422 AcpiNsInstallNode (
423     ACPI_WALK_STATE         *WalkState,
424     ACPI_NAMESPACE_NODE     *ParentNode,
425     ACPI_NAMESPACE_NODE     *Node,
426     ACPI_OBJECT_TYPE        Type);
427 
428 
429 /*
430  * nsutils - Utility functions
431  */
432 BOOLEAN
433 AcpiNsValidRootPrefix (
434     char                    Prefix);
435 
436 ACPI_OBJECT_TYPE
437 AcpiNsGetType (
438     ACPI_NAMESPACE_NODE     *Node);
439 
440 UINT32
441 AcpiNsLocal (
442     ACPI_OBJECT_TYPE        Type);
443 
444 void
445 AcpiNsPrintNodePathname (
446     ACPI_NAMESPACE_NODE     *Node,
447     const char              *Msg);
448 
449 ACPI_STATUS
450 AcpiNsBuildInternalName (
451     ACPI_NAMESTRING_INFO    *Info);
452 
453 void
454 AcpiNsGetInternalNameLength (
455     ACPI_NAMESTRING_INFO    *Info);
456 
457 ACPI_STATUS
458 AcpiNsInternalizeName (
459     const char              *DottedName,
460     char                    **ConvertedName);
461 
462 ACPI_STATUS
463 AcpiNsExternalizeName (
464     UINT32                  InternalNameLength,
465     const char              *InternalName,
466     UINT32                  *ConvertedNameLength,
467     char                    **ConvertedName);
468 
469 ACPI_NAMESPACE_NODE *
470 AcpiNsValidateHandle (
471     ACPI_HANDLE             Handle);
472 
473 void
474 AcpiNsTerminate (
475     void);
476 
477 #endif /* __ACNAMESP_H__ */
478