xref: /titanic_50/usr/src/uts/intel/sys/acpi/acnamesp.h (revision 385cc6b4ad1792caef3f84eb61eed3f27085801f)
1 /******************************************************************************
2  *
3  * Name: acnamesp.h - Namespace subcomponent prototypes and defines
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2016, 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 #define ACPI_NS_OVERRIDE_IF_FOUND   0x80
71 
72 /* Flags for AcpiNsWalkNamespace */
73 
74 #define ACPI_NS_WALK_NO_UNLOCK      0
75 #define ACPI_NS_WALK_UNLOCK         0x01
76 #define ACPI_NS_WALK_TEMP_NODES     0x02
77 
78 /* Object is not a package element */
79 
80 #define ACPI_NOT_PACKAGE_ELEMENT    ACPI_UINT32_MAX
81 #define ACPI_ALL_PACKAGE_ELEMENTS   (ACPI_UINT32_MAX-1)
82 
83 /* Always emit warning message, not dependent on node flags */
84 
85 #define ACPI_WARN_ALWAYS            0
86 
87 
88 /*
89  * nsinit - Namespace initialization
90  */
91 ACPI_STATUS
92 AcpiNsInitializeObjects (
93     void);
94 
95 ACPI_STATUS
96 AcpiNsInitializeDevices (
97     UINT32                  Flags);
98 
99 
100 /*
101  * nsload -  Namespace loading
102  */
103 ACPI_STATUS
104 AcpiNsLoadNamespace (
105     void);
106 
107 ACPI_STATUS
108 AcpiNsLoadTable (
109     UINT32                  TableIndex,
110     ACPI_NAMESPACE_NODE     *Node);
111 
112 
113 /*
114  * nswalk - walk the namespace
115  */
116 ACPI_STATUS
117 AcpiNsWalkNamespace (
118     ACPI_OBJECT_TYPE        Type,
119     ACPI_HANDLE             StartObject,
120     UINT32                  MaxDepth,
121     UINT32                  Flags,
122     ACPI_WALK_CALLBACK      DescendingCallback,
123     ACPI_WALK_CALLBACK      AscendingCallback,
124     void                    *Context,
125     void                    **ReturnValue);
126 
127 ACPI_NAMESPACE_NODE *
128 AcpiNsGetNextNode (
129     ACPI_NAMESPACE_NODE     *Parent,
130     ACPI_NAMESPACE_NODE     *Child);
131 
132 ACPI_NAMESPACE_NODE *
133 AcpiNsGetNextNodeTyped (
134     ACPI_OBJECT_TYPE        Type,
135     ACPI_NAMESPACE_NODE     *Parent,
136     ACPI_NAMESPACE_NODE     *Child);
137 
138 /*
139  * nsparse - table parsing
140  */
141 ACPI_STATUS
142 AcpiNsParseTable (
143     UINT32                  TableIndex,
144     ACPI_NAMESPACE_NODE     *StartNode);
145 
146 ACPI_STATUS
147 AcpiNsOneCompleteParse (
148     UINT32                  PassNumber,
149     UINT32                  TableIndex,
150     ACPI_NAMESPACE_NODE     *StartNode);
151 
152 
153 /*
154  * nsaccess - Top-level namespace access
155  */
156 ACPI_STATUS
157 AcpiNsRootInitialize (
158     void);
159 
160 ACPI_STATUS
161 AcpiNsLookup (
162     ACPI_GENERIC_STATE      *ScopeInfo,
163     char                    *Name,
164     ACPI_OBJECT_TYPE        Type,
165     ACPI_INTERPRETER_MODE   InterpreterMode,
166     UINT32                  Flags,
167     ACPI_WALK_STATE         *WalkState,
168     ACPI_NAMESPACE_NODE     **RetNode);
169 
170 
171 /*
172  * nsalloc - Named object allocation/deallocation
173  */
174 ACPI_NAMESPACE_NODE *
175 AcpiNsCreateNode (
176     UINT32                  Name);
177 
178 void
179 AcpiNsDeleteNode (
180     ACPI_NAMESPACE_NODE     *Node);
181 
182 void
183 AcpiNsRemoveNode (
184     ACPI_NAMESPACE_NODE     *Node);
185 
186 void
187 AcpiNsDeleteNamespaceSubtree (
188     ACPI_NAMESPACE_NODE     *ParentHandle);
189 
190 void
191 AcpiNsDeleteNamespaceByOwner (
192     ACPI_OWNER_ID           OwnerId);
193 
194 void
195 AcpiNsDetachObject (
196     ACPI_NAMESPACE_NODE     *Node);
197 
198 void
199 AcpiNsDeleteChildren (
200     ACPI_NAMESPACE_NODE     *Parent);
201 
202 int
203 AcpiNsCompareNames (
204     char                    *Name1,
205     char                    *Name2);
206 
207 
208 /*
209  * nsconvert - Dynamic object conversion routines
210  */
211 ACPI_STATUS
212 AcpiNsConvertToInteger (
213     ACPI_OPERAND_OBJECT     *OriginalObject,
214     ACPI_OPERAND_OBJECT     **ReturnObject);
215 
216 ACPI_STATUS
217 AcpiNsConvertToString (
218     ACPI_OPERAND_OBJECT     *OriginalObject,
219     ACPI_OPERAND_OBJECT     **ReturnObject);
220 
221 ACPI_STATUS
222 AcpiNsConvertToBuffer (
223     ACPI_OPERAND_OBJECT     *OriginalObject,
224     ACPI_OPERAND_OBJECT     **ReturnObject);
225 
226 ACPI_STATUS
227 AcpiNsConvertToUnicode (
228     ACPI_NAMESPACE_NODE     *Scope,
229     ACPI_OPERAND_OBJECT     *OriginalObject,
230     ACPI_OPERAND_OBJECT     **ReturnObject);
231 
232 ACPI_STATUS
233 AcpiNsConvertToResource (
234     ACPI_NAMESPACE_NODE     *Scope,
235     ACPI_OPERAND_OBJECT     *OriginalObject,
236     ACPI_OPERAND_OBJECT     **ReturnObject);
237 
238 ACPI_STATUS
239 AcpiNsConvertToReference (
240     ACPI_NAMESPACE_NODE     *Scope,
241     ACPI_OPERAND_OBJECT     *OriginalObject,
242     ACPI_OPERAND_OBJECT     **ReturnObject);
243 
244 
245 /*
246  * nsdump - Namespace dump/print utilities
247  */
248 void
249 AcpiNsDumpTables (
250     ACPI_HANDLE             SearchBase,
251     UINT32                  MaxDepth);
252 
253 void
254 AcpiNsDumpEntry (
255     ACPI_HANDLE             Handle,
256     UINT32                  DebugLevel);
257 
258 void
259 AcpiNsDumpPathname (
260     ACPI_HANDLE             Handle,
261     const char              *Msg,
262     UINT32                  Level,
263     UINT32                  Component);
264 
265 void
266 AcpiNsPrintPathname (
267     UINT32                  NumSegments,
268     const char              *Pathname);
269 
270 ACPI_STATUS
271 AcpiNsDumpOneObject (
272     ACPI_HANDLE             ObjHandle,
273     UINT32                  Level,
274     void                    *Context,
275     void                    **ReturnValue);
276 
277 void
278 AcpiNsDumpObjects (
279     ACPI_OBJECT_TYPE        Type,
280     UINT8                   DisplayType,
281     UINT32                  MaxDepth,
282     ACPI_OWNER_ID           OwnerId,
283     ACPI_HANDLE             StartHandle);
284 
285 void
286 AcpiNsDumpObjectPaths (
287     ACPI_OBJECT_TYPE        Type,
288     UINT8                   DisplayType,
289     UINT32                  MaxDepth,
290     ACPI_OWNER_ID           OwnerId,
291     ACPI_HANDLE             StartHandle);
292 
293 
294 /*
295  * nseval - Namespace evaluation functions
296  */
297 ACPI_STATUS
298 AcpiNsEvaluate (
299     ACPI_EVALUATE_INFO      *Info);
300 
301 void
302 AcpiNsExecModuleCodeList (
303     void);
304 
305 
306 /*
307  * nsarguments - Argument count/type checking for predefined/reserved names
308  */
309 void
310 AcpiNsCheckArgumentCount (
311     char                        *Pathname,
312     ACPI_NAMESPACE_NODE         *Node,
313     UINT32                      UserParamCount,
314     const ACPI_PREDEFINED_INFO  *Info);
315 
316 void
317 AcpiNsCheckAcpiCompliance (
318     char                        *Pathname,
319     ACPI_NAMESPACE_NODE         *Node,
320     const ACPI_PREDEFINED_INFO  *Predefined);
321 
322 void
323 AcpiNsCheckArgumentTypes (
324     ACPI_EVALUATE_INFO          *Info);
325 
326 
327 /*
328  * nspredef - Return value checking for predefined/reserved names
329  */
330 ACPI_STATUS
331 AcpiNsCheckReturnValue (
332     ACPI_NAMESPACE_NODE         *Node,
333     ACPI_EVALUATE_INFO          *Info,
334     UINT32                      UserParamCount,
335     ACPI_STATUS                 ReturnStatus,
336     ACPI_OPERAND_OBJECT         **ReturnObject);
337 
338 ACPI_STATUS
339 AcpiNsCheckObjectType (
340     ACPI_EVALUATE_INFO          *Info,
341     ACPI_OPERAND_OBJECT         **ReturnObjectPtr,
342     UINT32                      ExpectedBtypes,
343     UINT32                      PackageIndex);
344 
345 
346 /*
347  * nsprepkg - Validation of predefined name packages
348  */
349 ACPI_STATUS
350 AcpiNsCheckPackage (
351     ACPI_EVALUATE_INFO          *Info,
352     ACPI_OPERAND_OBJECT         **ReturnObjectPtr);
353 
354 
355 /*
356  * nsnames - Name and Scope manipulation
357  */
358 UINT32
359 AcpiNsOpensScope (
360     ACPI_OBJECT_TYPE        Type);
361 
362 char *
363 AcpiNsGetExternalPathname (
364     ACPI_NAMESPACE_NODE     *Node);
365 
366 UINT32
367 AcpiNsBuildNormalizedPath (
368     ACPI_NAMESPACE_NODE     *Node,
369     char                    *FullPath,
370     UINT32                  PathSize,
371     BOOLEAN                 NoTrailing);
372 
373 char *
374 AcpiNsGetNormalizedPathname (
375     ACPI_NAMESPACE_NODE     *Node,
376     BOOLEAN                 NoTrailing);
377 
378 char *
379 AcpiNsNameOfCurrentScope (
380     ACPI_WALK_STATE         *WalkState);
381 
382 ACPI_STATUS
383 AcpiNsHandleToPathname (
384     ACPI_HANDLE             TargetHandle,
385     ACPI_BUFFER             *Buffer,
386     BOOLEAN                 NoTrailing);
387 
388 BOOLEAN
389 AcpiNsPatternMatch (
390     ACPI_NAMESPACE_NODE     *ObjNode,
391     char                    *SearchFor);
392 
393 ACPI_STATUS
394 AcpiNsGetNode (
395     ACPI_NAMESPACE_NODE     *PrefixNode,
396     const char              *ExternalPathname,
397     UINT32                  Flags,
398     ACPI_NAMESPACE_NODE     **OutNode);
399 
400 ACPI_SIZE
401 AcpiNsGetPathnameLength (
402     ACPI_NAMESPACE_NODE     *Node);
403 
404 
405 /*
406  * nsobject - Object management for namespace nodes
407  */
408 ACPI_STATUS
409 AcpiNsAttachObject (
410     ACPI_NAMESPACE_NODE     *Node,
411     ACPI_OPERAND_OBJECT     *Object,
412     ACPI_OBJECT_TYPE        Type);
413 
414 ACPI_OPERAND_OBJECT *
415 AcpiNsGetAttachedObject (
416     ACPI_NAMESPACE_NODE     *Node);
417 
418 ACPI_OPERAND_OBJECT *
419 AcpiNsGetSecondaryObject (
420     ACPI_OPERAND_OBJECT     *ObjDesc);
421 
422 ACPI_STATUS
423 AcpiNsAttachData (
424     ACPI_NAMESPACE_NODE     *Node,
425     ACPI_OBJECT_HANDLER     Handler,
426     void                    *Data);
427 
428 ACPI_STATUS
429 AcpiNsDetachData (
430     ACPI_NAMESPACE_NODE     *Node,
431     ACPI_OBJECT_HANDLER     Handler);
432 
433 ACPI_STATUS
434 AcpiNsGetAttachedData (
435     ACPI_NAMESPACE_NODE     *Node,
436     ACPI_OBJECT_HANDLER     Handler,
437     void                    **Data);
438 
439 
440 /*
441  * nsrepair - General return object repair for all
442  * predefined methods/objects
443  */
444 ACPI_STATUS
445 AcpiNsSimpleRepair (
446     ACPI_EVALUATE_INFO      *Info,
447     UINT32                  ExpectedBtypes,
448     UINT32                  PackageIndex,
449     ACPI_OPERAND_OBJECT     **ReturnObjectPtr);
450 
451 ACPI_STATUS
452 AcpiNsWrapWithPackage (
453     ACPI_EVALUATE_INFO      *Info,
454     ACPI_OPERAND_OBJECT     *OriginalObject,
455     ACPI_OPERAND_OBJECT     **ObjDescPtr);
456 
457 ACPI_STATUS
458 AcpiNsRepairNullElement (
459     ACPI_EVALUATE_INFO      *Info,
460     UINT32                  ExpectedBtypes,
461     UINT32                  PackageIndex,
462     ACPI_OPERAND_OBJECT     **ReturnObjectPtr);
463 
464 void
465 AcpiNsRemoveNullElements (
466     ACPI_EVALUATE_INFO      *Info,
467     UINT8                   PackageType,
468     ACPI_OPERAND_OBJECT     *ObjDesc);
469 
470 
471 /*
472  * nsrepair2 - Return object repair for specific
473  * predefined methods/objects
474  */
475 ACPI_STATUS
476 AcpiNsComplexRepairs (
477     ACPI_EVALUATE_INFO      *Info,
478     ACPI_NAMESPACE_NODE     *Node,
479     ACPI_STATUS             ValidateStatus,
480     ACPI_OPERAND_OBJECT     **ReturnObjectPtr);
481 
482 
483 /*
484  * nssearch - Namespace searching and entry
485  */
486 ACPI_STATUS
487 AcpiNsSearchAndEnter (
488     UINT32                  EntryName,
489     ACPI_WALK_STATE         *WalkState,
490     ACPI_NAMESPACE_NODE     *Node,
491     ACPI_INTERPRETER_MODE   InterpreterMode,
492     ACPI_OBJECT_TYPE        Type,
493     UINT32                  Flags,
494     ACPI_NAMESPACE_NODE     **RetNode);
495 
496 ACPI_STATUS
497 AcpiNsSearchOneScope (
498     UINT32                  EntryName,
499     ACPI_NAMESPACE_NODE     *Node,
500     ACPI_OBJECT_TYPE        Type,
501     ACPI_NAMESPACE_NODE     **RetNode);
502 
503 void
504 AcpiNsInstallNode (
505     ACPI_WALK_STATE         *WalkState,
506     ACPI_NAMESPACE_NODE     *ParentNode,
507     ACPI_NAMESPACE_NODE     *Node,
508     ACPI_OBJECT_TYPE        Type);
509 
510 
511 /*
512  * nsutils - Utility functions
513  */
514 ACPI_OBJECT_TYPE
515 AcpiNsGetType (
516     ACPI_NAMESPACE_NODE     *Node);
517 
518 UINT32
519 AcpiNsLocal (
520     ACPI_OBJECT_TYPE        Type);
521 
522 void
523 AcpiNsPrintNodePathname (
524     ACPI_NAMESPACE_NODE     *Node,
525     const char              *Msg);
526 
527 ACPI_STATUS
528 AcpiNsBuildInternalName (
529     ACPI_NAMESTRING_INFO    *Info);
530 
531 void
532 AcpiNsGetInternalNameLength (
533     ACPI_NAMESTRING_INFO    *Info);
534 
535 ACPI_STATUS
536 AcpiNsInternalizeName (
537     const char              *DottedName,
538     char                    **ConvertedName);
539 
540 ACPI_STATUS
541 AcpiNsExternalizeName (
542     UINT32                  InternalNameLength,
543     const char              *InternalName,
544     UINT32                  *ConvertedNameLength,
545     char                    **ConvertedName);
546 
547 ACPI_NAMESPACE_NODE *
548 AcpiNsValidateHandle (
549     ACPI_HANDLE             Handle);
550 
551 void
552 AcpiNsTerminate (
553     void);
554 
555 #endif /* __ACNAMESP_H__ */
556