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