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