xref: /titanic_50/usr/src/uts/intel/sys/acpi/acpixf.h (revision 24fe0b3bf671e123467ce1df0b67cadd3614c8e4)
1 
2 /******************************************************************************
3  *
4  * Name: acpixf.h - External interfaces to the ACPI subsystem
5  *
6  *****************************************************************************/
7 
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
13  * All rights reserved.
14  *
15  * 2. License
16  *
17  * 2.1. This is your license from Intel Corp. under its intellectual property
18  * rights.  You may have additional license terms from the party that provided
19  * you this software, covering your right to use that party's intellectual
20  * property rights.
21  *
22  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23  * copy of the source code appearing in this file ("Covered Code") an
24  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25  * base code distributed originally by Intel ("Original Intel Code") to copy,
26  * make derivatives, distribute, use and display any portion of the Covered
27  * Code in any form, with the right to sublicense such rights; and
28  *
29  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30  * license (with the right to sublicense), under only those claims of Intel
31  * patents that are infringed by the Original Intel Code, to make, use, sell,
32  * offer to sell, and import the Covered Code and derivative works thereof
33  * solely to the minimum extent necessary to exercise the above copyright
34  * license, and in no event shall the patent license extend to any additions
35  * to or modifications of the Original Intel Code.  No other license or right
36  * is granted directly or by implication, estoppel or otherwise;
37  *
38  * The above copyright and patent license is granted only if the following
39  * conditions are met:
40  *
41  * 3. Conditions
42  *
43  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44  * Redistribution of source code of any substantial portion of the Covered
45  * Code or modification with rights to further distribute source must include
46  * the above Copyright Notice, the above License, this list of Conditions,
47  * and the following Disclaimer and Export Compliance provision.  In addition,
48  * Licensee must cause all Covered Code to which Licensee contributes to
49  * contain a file documenting the changes Licensee made to create that Covered
50  * Code and the date of any change.  Licensee must include in that file the
51  * documentation of any changes made by any predecessor Licensee.  Licensee
52  * must include a prominent statement that the modification is derived,
53  * directly or indirectly, from Original Intel Code.
54  *
55  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56  * Redistribution of source code of any substantial portion of the Covered
57  * Code or modification without rights to further distribute source must
58  * include the following Disclaimer and Export Compliance provision in the
59  * documentation and/or other materials provided with distribution.  In
60  * addition, Licensee may not authorize further sublicense of source of any
61  * portion of the Covered Code, and must include terms to the effect that the
62  * license from Licensee to its licensee is limited to the intellectual
63  * property embodied in the software Licensee provides to its licensee, and
64  * not to intellectual property embodied in modifications its licensee may
65  * make.
66  *
67  * 3.3. Redistribution of Executable. Redistribution in executable form of any
68  * substantial portion of the Covered Code or modification must reproduce the
69  * above Copyright Notice, and the following Disclaimer and Export Compliance
70  * provision in the documentation and/or other materials provided with the
71  * distribution.
72  *
73  * 3.4. Intel retains all right, title, and interest in and to the Original
74  * Intel Code.
75  *
76  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77  * Intel shall be used in advertising or otherwise to promote the sale, use or
78  * other dealings in products derived from or relating to the Covered Code
79  * without prior written authorization from Intel.
80  *
81  * 4. Disclaimer and Export Compliance
82  *
83  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89  * PARTICULAR PURPOSE.
90  *
91  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98  * LIMITED REMEDY.
99  *
100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
101  * software or system incorporating such software without first obtaining any
102  * required license or other approval from the U. S. Department of Commerce or
103  * any other agency or department of the United States Government.  In the
104  * event Licensee exports any such software from the United States or
105  * re-exports any such software from a foreign destination, Licensee shall
106  * ensure that the distribution and export/re-export of the software is in
107  * compliance with all laws, regulations, orders, or other restrictions of the
108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109  * any of its subsidiaries will export/re-export any technical data, process,
110  * software, or service, directly or indirectly, to any country for which the
111  * United States government or any agency thereof requires an export license,
112  * other governmental approval, or letter of assurance, without first obtaining
113  * such license, approval or letter.
114  *
115  *****************************************************************************/
116 
117 
118 #ifndef __ACXFACE_H__
119 #define __ACXFACE_H__
120 
121 /* Current ACPICA subsystem version in YYYYMMDD format */
122 
123 #define ACPI_CA_VERSION                 0x20090521
124 
125 #include "actypes.h"
126 #include "actbl.h"
127 
128 /*
129  * Globals that are publically available
130  */
131 extern UINT32               AcpiCurrentGpeCount;
132 extern ACPI_TABLE_FADT      AcpiGbl_FADT;
133 
134 /* Run-time configuration */
135 
136 extern UINT32               AcpiDbgLevel;
137 extern UINT32               AcpiDbgLayer;
138 extern UINT8                AcpiGbl_EnableInterpreterSlack;
139 extern UINT8                AcpiGbl_AllMethodsSerialized;
140 extern UINT8                AcpiGbl_CreateOsiMethod;
141 extern UINT8                AcpiGbl_LeaveWakeGpesDisabled;
142 extern ACPI_NAME            AcpiGbl_TraceMethodName;
143 extern UINT32               AcpiGbl_TraceFlags;
144 
145 
146 /*
147  * Global interfaces
148  */
149 ACPI_STATUS
150 AcpiInitializeTables (
151     ACPI_TABLE_DESC         *InitialStorage,
152     UINT32                  InitialTableCount,
153     BOOLEAN                 AllowResize);
154 
155 ACPI_STATUS
156 AcpiInitializeSubsystem (
157     void);
158 
159 ACPI_STATUS
160 AcpiEnableSubsystem (
161     UINT32                  Flags);
162 
163 ACPI_STATUS
164 AcpiInitializeObjects (
165     UINT32                  Flags);
166 
167 ACPI_STATUS
168 AcpiTerminate (
169     void);
170 
171 ACPI_STATUS
172 AcpiSubsystemStatus (
173     void);
174 
175 ACPI_STATUS
176 AcpiEnable (
177     void);
178 
179 ACPI_STATUS
180 AcpiDisable (
181     void);
182 
183 ACPI_STATUS
184 AcpiGetSystemInfo (
185     ACPI_BUFFER             *RetBuffer);
186 
187 ACPI_STATUS
188 AcpiGetStatistics (
189     ACPI_STATISTICS         *Stats);
190 
191 const char *
192 AcpiFormatException (
193     ACPI_STATUS             Exception);
194 
195 ACPI_STATUS
196 AcpiPurgeCachedObjects (
197     void);
198 
199 
200 /*
201  * ACPI Memory managment
202  */
203 void *
204 AcpiAllocate (
205     UINT32                  Size);
206 
207 void *
208 AcpiCallocate (
209     UINT32                  Size);
210 
211 void
212 AcpiFree (
213     void                    *Address);
214 
215 
216 /*
217  * ACPI table manipulation interfaces
218  */
219 ACPI_STATUS
220 AcpiReallocateRootTable (
221     void);
222 
223 ACPI_STATUS
224 AcpiFindRootPointer (
225     ACPI_SIZE               *RsdpAddress);
226 
227 ACPI_STATUS
228 AcpiLoadTables (
229     void);
230 
231 ACPI_STATUS
232 AcpiGetTableHeader (
233     ACPI_STRING             Signature,
234     UINT32                  Instance,
235     ACPI_TABLE_HEADER       *OutTableHeader);
236 
237 ACPI_STATUS
238 AcpiGetTable (
239     ACPI_STRING             Signature,
240     UINT32                  Instance,
241     ACPI_TABLE_HEADER       **OutTable);
242 
243 ACPI_STATUS
244 AcpiGetTableByIndex (
245     UINT32                  TableIndex,
246     ACPI_TABLE_HEADER       **OutTable);
247 
248 ACPI_STATUS
249 AcpiInstallTableHandler (
250     ACPI_TABLE_HANDLER      Handler,
251     void                    *Context);
252 
253 ACPI_STATUS
254 AcpiRemoveTableHandler (
255     ACPI_TABLE_HANDLER      Handler);
256 
257 
258 /*
259  * Namespace and name interfaces
260  */
261 ACPI_STATUS
262 AcpiWalkNamespace (
263     ACPI_OBJECT_TYPE        Type,
264     ACPI_HANDLE             StartObject,
265     UINT32                  MaxDepth,
266     ACPI_WALK_CALLBACK      UserFunction,
267     void                    *Context,
268     void                    **ReturnValue);
269 
270 ACPI_STATUS
271 AcpiGetDevices (
272     char                    *HID,
273     ACPI_WALK_CALLBACK      UserFunction,
274     void                    *Context,
275     void                    **ReturnValue);
276 
277 ACPI_STATUS
278 AcpiGetName (
279     ACPI_HANDLE             Handle,
280     UINT32                  NameType,
281     ACPI_BUFFER             *RetPathPtr);
282 
283 ACPI_STATUS
284 AcpiGetHandle (
285     ACPI_HANDLE             Parent,
286     ACPI_STRING             Pathname,
287     ACPI_HANDLE             *RetHandle);
288 
289 ACPI_STATUS
290 AcpiAttachData (
291     ACPI_HANDLE             ObjHandle,
292     ACPI_OBJECT_HANDLER     Handler,
293     void                    *Data);
294 
295 ACPI_STATUS
296 AcpiDetachData (
297     ACPI_HANDLE             ObjHandle,
298     ACPI_OBJECT_HANDLER     Handler);
299 
300 ACPI_STATUS
301 AcpiGetData (
302     ACPI_HANDLE             ObjHandle,
303     ACPI_OBJECT_HANDLER     Handler,
304     void                    **Data);
305 
306 ACPI_STATUS
307 AcpiDebugTrace (
308     char                    *Name,
309     UINT32                  DebugLevel,
310     UINT32                  DebugLayer,
311     UINT32                  Flags);
312 
313 
314 /*
315  * Object manipulation and enumeration
316  */
317 ACPI_STATUS
318 AcpiEvaluateObject (
319     ACPI_HANDLE             Object,
320     ACPI_STRING             Pathname,
321     ACPI_OBJECT_LIST        *ParameterObjects,
322     ACPI_BUFFER             *ReturnObjectBuffer);
323 
324 ACPI_STATUS
325 AcpiEvaluateObjectTyped (
326     ACPI_HANDLE             Object,
327     ACPI_STRING             Pathname,
328     ACPI_OBJECT_LIST        *ExternalParams,
329     ACPI_BUFFER             *ReturnBuffer,
330     ACPI_OBJECT_TYPE        ReturnType);
331 
332 ACPI_STATUS
333 AcpiGetObjectInfo (
334     ACPI_HANDLE             Handle,
335     ACPI_BUFFER             *ReturnBuffer);
336 
337 ACPI_STATUS
338 AcpiInstallMethod (
339     UINT8                   *Buffer);
340 
341 ACPI_STATUS
342 AcpiGetNextObject (
343     ACPI_OBJECT_TYPE        Type,
344     ACPI_HANDLE             Parent,
345     ACPI_HANDLE             Child,
346     ACPI_HANDLE             *OutHandle);
347 
348 ACPI_STATUS
349 AcpiGetType (
350     ACPI_HANDLE             Object,
351     ACPI_OBJECT_TYPE        *OutType);
352 
353 ACPI_STATUS
354 AcpiGetParent (
355     ACPI_HANDLE             Object,
356     ACPI_HANDLE             *OutHandle);
357 
358 
359 /*
360  * Handler interfaces
361  */
362 ACPI_STATUS
363 AcpiInstallInitializationHandler (
364     ACPI_INIT_HANDLER       Handler,
365     UINT32                  Function);
366 
367 ACPI_STATUS
368 AcpiInstallFixedEventHandler (
369     UINT32                  AcpiEvent,
370     ACPI_EVENT_HANDLER      Handler,
371     void                    *Context);
372 
373 ACPI_STATUS
374 AcpiRemoveFixedEventHandler (
375     UINT32                  AcpiEvent,
376     ACPI_EVENT_HANDLER      Handler);
377 
378 ACPI_STATUS
379 AcpiInstallNotifyHandler (
380     ACPI_HANDLE             Device,
381     UINT32                  HandlerType,
382     ACPI_NOTIFY_HANDLER     Handler,
383     void                    *Context);
384 
385 ACPI_STATUS
386 AcpiRemoveNotifyHandler (
387     ACPI_HANDLE             Device,
388     UINT32                  HandlerType,
389     ACPI_NOTIFY_HANDLER     Handler);
390 
391 ACPI_STATUS
392 AcpiInstallAddressSpaceHandler (
393     ACPI_HANDLE             Device,
394     ACPI_ADR_SPACE_TYPE     SpaceId,
395     ACPI_ADR_SPACE_HANDLER  Handler,
396     ACPI_ADR_SPACE_SETUP    Setup,
397     void                    *Context);
398 
399 ACPI_STATUS
400 AcpiRemoveAddressSpaceHandler (
401     ACPI_HANDLE             Device,
402     ACPI_ADR_SPACE_TYPE     SpaceId,
403     ACPI_ADR_SPACE_HANDLER  Handler);
404 
405 ACPI_STATUS
406 AcpiInstallGpeHandler (
407     ACPI_HANDLE             GpeDevice,
408     UINT32                  GpeNumber,
409     UINT32                  Type,
410     ACPI_EVENT_HANDLER      Address,
411     void                    *Context);
412 
413 ACPI_STATUS
414 AcpiRemoveGpeHandler (
415     ACPI_HANDLE             GpeDevice,
416     UINT32                  GpeNumber,
417     ACPI_EVENT_HANDLER      Address);
418 
419 ACPI_STATUS
420 AcpiInstallExceptionHandler (
421     ACPI_EXCEPTION_HANDLER  Handler);
422 
423 
424 /*
425  * Event interfaces
426  */
427 ACPI_STATUS
428 AcpiAcquireGlobalLock (
429     UINT16                  Timeout,
430     UINT32                  *Handle);
431 
432 ACPI_STATUS
433 AcpiReleaseGlobalLock (
434     UINT32                  Handle);
435 
436 ACPI_STATUS
437 AcpiEnableEvent (
438     UINT32                  Event,
439     UINT32                  Flags);
440 
441 ACPI_STATUS
442 AcpiDisableEvent (
443     UINT32                  Event,
444     UINT32                  Flags);
445 
446 ACPI_STATUS
447 AcpiClearEvent (
448     UINT32                  Event);
449 
450 ACPI_STATUS
451 AcpiGetEventStatus (
452     UINT32                  Event,
453     ACPI_EVENT_STATUS       *EventStatus);
454 
455 
456 /*
457  * GPE Interfaces
458  */
459 ACPI_STATUS
460 AcpiSetGpeType (
461     ACPI_HANDLE             GpeDevice,
462     UINT32                  GpeNumber,
463     UINT8                   Type);
464 
465 ACPI_STATUS
466 AcpiEnableGpe (
467     ACPI_HANDLE             GpeDevice,
468     UINT32                  GpeNumber,
469     UINT32                  Flags);
470 
471 ACPI_STATUS
472 AcpiDisableGpe (
473     ACPI_HANDLE             GpeDevice,
474     UINT32                  GpeNumber,
475     UINT32                  Flags);
476 
477 ACPI_STATUS
478 AcpiClearGpe (
479     ACPI_HANDLE             GpeDevice,
480     UINT32                  GpeNumber,
481     UINT32                  Flags);
482 
483 ACPI_STATUS
484 AcpiGetGpeStatus (
485     ACPI_HANDLE             GpeDevice,
486     UINT32                  GpeNumber,
487     UINT32                  Flags,
488     ACPI_EVENT_STATUS       *EventStatus);
489 
490 ACPI_STATUS
491 AcpiDisableAllGpes (
492     void);
493 
494 ACPI_STATUS
495 AcpiEnableAllRuntimeGpes (
496     void);
497 
498 ACPI_STATUS
499 AcpiGetGpeDevice (
500     UINT32                  GpeIndex,
501     ACPI_HANDLE             *GpeDevice);
502 
503 ACPI_STATUS
504 AcpiInstallGpeBlock (
505     ACPI_HANDLE             GpeDevice,
506     ACPI_GENERIC_ADDRESS    *GpeBlockAddress,
507     UINT32                  RegisterCount,
508     UINT32                  InterruptNumber);
509 
510 ACPI_STATUS
511 AcpiRemoveGpeBlock (
512     ACPI_HANDLE             GpeDevice);
513 
514 
515 /*
516  * Resource interfaces
517  */
518 typedef
519 ACPI_STATUS (*ACPI_WALK_RESOURCE_CALLBACK) (
520     ACPI_RESOURCE           *Resource,
521     void                    *Context);
522 
523 ACPI_STATUS
524 AcpiGetVendorResource (
525     ACPI_HANDLE             DeviceHandle,
526     char                    *Name,
527     ACPI_VENDOR_UUID        *Uuid,
528     ACPI_BUFFER             *RetBuffer);
529 
530 ACPI_STATUS
531 AcpiGetCurrentResources(
532     ACPI_HANDLE             DeviceHandle,
533     ACPI_BUFFER             *RetBuffer);
534 
535 ACPI_STATUS
536 AcpiGetPossibleResources(
537     ACPI_HANDLE             DeviceHandle,
538     ACPI_BUFFER             *RetBuffer);
539 
540 ACPI_STATUS
541 AcpiWalkResources (
542     ACPI_HANDLE                 DeviceHandle,
543     char                        *Name,
544     ACPI_WALK_RESOURCE_CALLBACK UserFunction,
545     void                        *Context);
546 
547 ACPI_STATUS
548 AcpiSetCurrentResources (
549     ACPI_HANDLE             DeviceHandle,
550     ACPI_BUFFER             *InBuffer);
551 
552 ACPI_STATUS
553 AcpiGetIrqRoutingTable  (
554     ACPI_HANDLE             BusDeviceHandle,
555     ACPI_BUFFER             *RetBuffer);
556 
557 ACPI_STATUS
558 AcpiResourceToAddress64 (
559     ACPI_RESOURCE           *Resource,
560     ACPI_RESOURCE_ADDRESS64 *Out);
561 
562 
563 /*
564  * Hardware (ACPI device) interfaces
565  */
566 ACPI_STATUS
567 AcpiReset (
568     void);
569 
570 ACPI_STATUS
571 AcpiRead (
572     UINT32                  *Value,
573     ACPI_GENERIC_ADDRESS    *Reg);
574 
575 ACPI_STATUS
576 AcpiWrite (
577     UINT32                  Value,
578     ACPI_GENERIC_ADDRESS    *Reg);
579 
580 ACPI_STATUS
581 AcpiReadBitRegister (
582     UINT32                  RegisterId,
583     UINT32                  *ReturnValue);
584 
585 ACPI_STATUS
586 AcpiWriteBitRegister (
587     UINT32                  RegisterId,
588     UINT32                  Value);
589 
590 ACPI_STATUS
591 AcpiGetSleepTypeData (
592     UINT8                   SleepState,
593     UINT8                   *Slp_TypA,
594     UINT8                   *Slp_TypB);
595 
596 ACPI_STATUS
597 AcpiEnterSleepStatePrep (
598     UINT8                   SleepState);
599 
600 ACPI_STATUS
601 AcpiEnterSleepState (
602     UINT8                   SleepState);
603 
604 ACPI_STATUS
605 AcpiEnterSleepStateS4bios (
606     void);
607 
608 ACPI_STATUS
609 AcpiLeaveSleepState (
610     UINT8                   SleepState)
611     ;
612 ACPI_STATUS
613 AcpiSetFirmwareWakingVector (
614     UINT32                  PhysicalAddress);
615 
616 #if ACPI_MACHINE_WIDTH == 64
617 ACPI_STATUS
618 AcpiSetFirmwareWakingVector64 (
619     UINT64                  PhysicalAddress);
620 #endif
621 
622 
623 /*
624  * Error/Warning output
625  */
626 void ACPI_INTERNAL_VAR_XFACE
627 AcpiError (
628     const char              *ModuleName,
629     UINT32                  LineNumber,
630     const char              *Format,
631     ...) ACPI_PRINTF_LIKE(3);
632 
633 void  ACPI_INTERNAL_VAR_XFACE
634 AcpiException (
635     const char              *ModuleName,
636     UINT32                  LineNumber,
637     ACPI_STATUS             Status,
638     const char              *Format,
639     ...) ACPI_PRINTF_LIKE(4);
640 
641 void ACPI_INTERNAL_VAR_XFACE
642 AcpiWarning (
643     const char              *ModuleName,
644     UINT32                  LineNumber,
645     const char              *Format,
646     ...) ACPI_PRINTF_LIKE(3);
647 
648 void ACPI_INTERNAL_VAR_XFACE
649 AcpiInfo (
650     const char              *ModuleName,
651     UINT32                  LineNumber,
652     const char              *Format,
653     ...) ACPI_PRINTF_LIKE(3);
654 
655 
656 /*
657  * Debug output
658  */
659 #ifdef ACPI_DEBUG_OUTPUT
660 
661 void ACPI_INTERNAL_VAR_XFACE
662 AcpiDebugPrint (
663     UINT32                  RequestedDebugLevel,
664     UINT32                  LineNumber,
665     const char              *FunctionName,
666     const char              *ModuleName,
667     UINT32                  ComponentId,
668     const char              *Format,
669     ...) ACPI_PRINTF_LIKE(6);
670 
671 void ACPI_INTERNAL_VAR_XFACE
672 AcpiDebugPrintRaw (
673     UINT32                  RequestedDebugLevel,
674     UINT32                  LineNumber,
675     const char              *FunctionName,
676     const char              *ModuleName,
677     UINT32                  ComponentId,
678     const char              *Format,
679     ...) ACPI_PRINTF_LIKE(6);
680 #endif
681 
682 #endif /* __ACXFACE_H__ */
683