xref: /illumos-gate/usr/src/uts/intel/sys/acpi/acpixf.h (revision 4870e0a7381ec2ec57437062574e6ddc3dd48d7f)
1 
2 /******************************************************************************
3  *
4  * Name: acpixf.h - External interfaces to the ACPI subsystem
5  *
6  *****************************************************************************/
7 
8 /*
9  * Copyright (C) 2000 - 2011, Intel Corp.
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions, and the following disclaimer,
17  *    without modification.
18  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19  *    substantially similar to the "NO WARRANTY" disclaimer below
20  *    ("Disclaimer") and any redistribution must be conditioned upon
21  *    including a substantially similar Disclaimer requirement for further
22  *    binary redistribution.
23  * 3. Neither the names of the above-listed copyright holders nor the names
24  *    of any contributors may be used to endorse or promote products derived
25  *    from this software without specific prior written permission.
26  *
27  * Alternatively, this software may be distributed under the terms of the
28  * GNU General Public License ("GPL") version 2 as published by the Free
29  * Software Foundation.
30  *
31  * NO WARRANTY
32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42  * POSSIBILITY OF SUCH DAMAGES.
43  */
44 
45 
46 #ifndef __ACXFACE_H__
47 #define __ACXFACE_H__
48 
49 /* Current ACPICA subsystem version in YYYYMMDD format */
50 
51 #define ACPI_CA_VERSION                 0x20110527
52 
53 #include "actypes.h"
54 #include "actbl.h"
55 
56 /*
57  * Globals that are publically available
58  */
59 extern UINT32               AcpiCurrentGpeCount;
60 extern ACPI_TABLE_FADT      AcpiGbl_FADT;
61 extern BOOLEAN              AcpiGbl_SystemAwakeAndRunning;
62 
63 /* Runtime configuration of debug print levels */
64 
65 extern UINT32               AcpiDbgLevel;
66 extern UINT32               AcpiDbgLayer;
67 
68 /* ACPICA runtime options */
69 
70 extern UINT8                AcpiGbl_EnableInterpreterSlack;
71 extern UINT8                AcpiGbl_AllMethodsSerialized;
72 extern UINT8                AcpiGbl_CreateOsiMethod;
73 extern UINT8                AcpiGbl_UseDefaultRegisterWidths;
74 extern ACPI_NAME            AcpiGbl_TraceMethodName;
75 extern UINT32               AcpiGbl_TraceFlags;
76 extern UINT8                AcpiGbl_EnableAmlDebugObject;
77 extern UINT8                AcpiGbl_CopyDsdtLocally;
78 extern UINT8                AcpiGbl_TruncateIoAddresses;
79 
80 
81 /*
82  * Initialization
83  */
84 ACPI_STATUS
85 AcpiInitializeTables (
86     ACPI_TABLE_DESC         *InitialStorage,
87     UINT32                  InitialTableCount,
88     BOOLEAN                 AllowResize);
89 
90 ACPI_STATUS
91 AcpiInitializeSubsystem (
92     void);
93 
94 ACPI_STATUS
95 AcpiEnableSubsystem (
96     UINT32                  Flags);
97 
98 ACPI_STATUS
99 AcpiInitializeObjects (
100     UINT32                  Flags);
101 
102 ACPI_STATUS
103 AcpiTerminate (
104     void);
105 
106 
107 /*
108  * Miscellaneous global interfaces
109  */
110 ACPI_STATUS
111 AcpiEnable (
112     void);
113 
114 ACPI_STATUS
115 AcpiDisable (
116     void);
117 
118 ACPI_STATUS
119 AcpiSubsystemStatus (
120     void);
121 
122 ACPI_STATUS
123 AcpiGetSystemInfo (
124     ACPI_BUFFER             *RetBuffer);
125 
126 ACPI_STATUS
127 AcpiGetStatistics (
128     ACPI_STATISTICS         *Stats);
129 
130 const char *
131 AcpiFormatException (
132     ACPI_STATUS             Exception);
133 
134 ACPI_STATUS
135 AcpiPurgeCachedObjects (
136     void);
137 
138 ACPI_STATUS
139 AcpiInstallInterface (
140     ACPI_STRING             InterfaceName);
141 
142 ACPI_STATUS
143 AcpiRemoveInterface (
144     ACPI_STRING             InterfaceName);
145 
146 
147 /*
148  * ACPI Memory management
149  */
150 void *
151 AcpiAllocate (
152     UINT32                  Size);
153 
154 void *
155 AcpiCallocate (
156     UINT32                  Size);
157 
158 void
159 AcpiFree (
160     void                    *Address);
161 
162 
163 /*
164  * ACPI table manipulation interfaces
165  */
166 ACPI_STATUS
167 AcpiReallocateRootTable (
168     void);
169 
170 ACPI_STATUS
171 AcpiFindRootPointer (
172     ACPI_SIZE               *RsdpAddress);
173 
174 ACPI_STATUS
175 AcpiLoadTables (
176     void);
177 
178 ACPI_STATUS
179 AcpiGetTableHeader (
180     ACPI_STRING             Signature,
181     UINT32                  Instance,
182     ACPI_TABLE_HEADER       *OutTableHeader);
183 
184 ACPI_STATUS
185 AcpiGetTable (
186     ACPI_STRING             Signature,
187     UINT32                  Instance,
188     ACPI_TABLE_HEADER       **OutTable);
189 
190 ACPI_STATUS
191 AcpiGetTableByIndex (
192     UINT32                  TableIndex,
193     ACPI_TABLE_HEADER       **OutTable);
194 
195 ACPI_STATUS
196 AcpiInstallTableHandler (
197     ACPI_TABLE_HANDLER      Handler,
198     void                    *Context);
199 
200 ACPI_STATUS
201 AcpiRemoveTableHandler (
202     ACPI_TABLE_HANDLER      Handler);
203 
204 
205 /*
206  * Namespace and name interfaces
207  */
208 ACPI_STATUS
209 AcpiWalkNamespace (
210     ACPI_OBJECT_TYPE        Type,
211     ACPI_HANDLE             StartObject,
212     UINT32                  MaxDepth,
213     ACPI_WALK_CALLBACK      PreOrderVisit,
214     ACPI_WALK_CALLBACK      PostOrderVisit,
215     void                    *Context,
216     void                    **ReturnValue);
217 
218 ACPI_STATUS
219 AcpiGetDevices (
220     char                    *HID,
221     ACPI_WALK_CALLBACK      UserFunction,
222     void                    *Context,
223     void                    **ReturnValue);
224 
225 ACPI_STATUS
226 AcpiGetName (
227     ACPI_HANDLE             Object,
228     UINT32                  NameType,
229     ACPI_BUFFER             *RetPathPtr);
230 
231 ACPI_STATUS
232 AcpiGetHandle (
233     ACPI_HANDLE             Parent,
234     ACPI_STRING             Pathname,
235     ACPI_HANDLE             *RetHandle);
236 
237 ACPI_STATUS
238 AcpiAttachData (
239     ACPI_HANDLE             Object,
240     ACPI_OBJECT_HANDLER     Handler,
241     void                    *Data);
242 
243 ACPI_STATUS
244 AcpiDetachData (
245     ACPI_HANDLE             Object,
246     ACPI_OBJECT_HANDLER     Handler);
247 
248 ACPI_STATUS
249 AcpiGetData (
250     ACPI_HANDLE             Object,
251     ACPI_OBJECT_HANDLER     Handler,
252     void                    **Data);
253 
254 ACPI_STATUS
255 AcpiDebugTrace (
256     char                    *Name,
257     UINT32                  DebugLevel,
258     UINT32                  DebugLayer,
259     UINT32                  Flags);
260 
261 
262 /*
263  * Object manipulation and enumeration
264  */
265 ACPI_STATUS
266 AcpiEvaluateObject (
267     ACPI_HANDLE             Object,
268     ACPI_STRING             Pathname,
269     ACPI_OBJECT_LIST        *ParameterObjects,
270     ACPI_BUFFER             *ReturnObjectBuffer);
271 
272 ACPI_STATUS
273 AcpiEvaluateObjectTyped (
274     ACPI_HANDLE             Object,
275     ACPI_STRING             Pathname,
276     ACPI_OBJECT_LIST        *ExternalParams,
277     ACPI_BUFFER             *ReturnBuffer,
278     ACPI_OBJECT_TYPE        ReturnType);
279 
280 ACPI_STATUS
281 AcpiGetObjectInfo (
282     ACPI_HANDLE             Object,
283     ACPI_DEVICE_INFO        **ReturnBuffer);
284 
285 ACPI_STATUS
286 AcpiInstallMethod (
287     UINT8                   *Buffer);
288 
289 ACPI_STATUS
290 AcpiGetNextObject (
291     ACPI_OBJECT_TYPE        Type,
292     ACPI_HANDLE             Parent,
293     ACPI_HANDLE             Child,
294     ACPI_HANDLE             *OutHandle);
295 
296 ACPI_STATUS
297 AcpiGetType (
298     ACPI_HANDLE             Object,
299     ACPI_OBJECT_TYPE        *OutType);
300 
301 ACPI_STATUS
302 AcpiGetParent (
303     ACPI_HANDLE             Object,
304     ACPI_HANDLE             *OutHandle);
305 
306 
307 /*
308  * Handler interfaces
309  */
310 ACPI_STATUS
311 AcpiInstallInitializationHandler (
312     ACPI_INIT_HANDLER       Handler,
313     UINT32                  Function);
314 
315 ACPI_STATUS
316 AcpiInstallGlobalEventHandler (
317     ACPI_GBL_EVENT_HANDLER  Handler,
318     void                    *Context);
319 
320 ACPI_STATUS
321 AcpiInstallFixedEventHandler (
322     UINT32                  AcpiEvent,
323     ACPI_EVENT_HANDLER      Handler,
324     void                    *Context);
325 
326 ACPI_STATUS
327 AcpiRemoveFixedEventHandler (
328     UINT32                  AcpiEvent,
329     ACPI_EVENT_HANDLER      Handler);
330 
331 ACPI_STATUS
332 AcpiInstallGpeHandler (
333     ACPI_HANDLE             GpeDevice,
334     UINT32                  GpeNumber,
335     UINT32                  Type,
336     ACPI_GPE_HANDLER        Address,
337     void                    *Context);
338 
339 ACPI_STATUS
340 AcpiRemoveGpeHandler (
341     ACPI_HANDLE             GpeDevice,
342     UINT32                  GpeNumber,
343     ACPI_GPE_HANDLER        Address);
344 
345 ACPI_STATUS
346 AcpiInstallNotifyHandler (
347     ACPI_HANDLE             Device,
348     UINT32                  HandlerType,
349     ACPI_NOTIFY_HANDLER     Handler,
350     void                    *Context);
351 
352 ACPI_STATUS
353 AcpiRemoveNotifyHandler (
354     ACPI_HANDLE             Device,
355     UINT32                  HandlerType,
356     ACPI_NOTIFY_HANDLER     Handler);
357 
358 ACPI_STATUS
359 AcpiInstallAddressSpaceHandler (
360     ACPI_HANDLE             Device,
361     ACPI_ADR_SPACE_TYPE     SpaceId,
362     ACPI_ADR_SPACE_HANDLER  Handler,
363     ACPI_ADR_SPACE_SETUP    Setup,
364     void                    *Context);
365 
366 ACPI_STATUS
367 AcpiRemoveAddressSpaceHandler (
368     ACPI_HANDLE             Device,
369     ACPI_ADR_SPACE_TYPE     SpaceId,
370     ACPI_ADR_SPACE_HANDLER  Handler);
371 
372 ACPI_STATUS
373 AcpiInstallExceptionHandler (
374     ACPI_EXCEPTION_HANDLER  Handler);
375 
376 ACPI_STATUS
377 AcpiInstallInterfaceHandler (
378     ACPI_INTERFACE_HANDLER  Handler);
379 
380 
381 /*
382  * Global Lock interfaces
383  */
384 ACPI_STATUS
385 AcpiAcquireGlobalLock (
386     UINT16                  Timeout,
387     UINT32                  *Handle);
388 
389 ACPI_STATUS
390 AcpiReleaseGlobalLock (
391     UINT32                  Handle);
392 
393 
394 /*
395  * Fixed Event interfaces
396  */
397 ACPI_STATUS
398 AcpiEnableEvent (
399     UINT32                  Event,
400     UINT32                  Flags);
401 
402 ACPI_STATUS
403 AcpiDisableEvent (
404     UINT32                  Event,
405     UINT32                  Flags);
406 
407 ACPI_STATUS
408 AcpiClearEvent (
409     UINT32                  Event);
410 
411 ACPI_STATUS
412 AcpiGetEventStatus (
413     UINT32                  Event,
414     ACPI_EVENT_STATUS       *EventStatus);
415 
416 
417 /*
418  * General Purpose Event (GPE) Interfaces
419  */
420 ACPI_STATUS
421 AcpiUpdateAllGpes (
422     void);
423 
424 ACPI_STATUS
425 AcpiEnableGpe (
426     ACPI_HANDLE             GpeDevice,
427     UINT32                  GpeNumber);
428 
429 ACPI_STATUS
430 AcpiDisableGpe (
431     ACPI_HANDLE             GpeDevice,
432     UINT32                  GpeNumber);
433 
434 ACPI_STATUS
435 AcpiClearGpe (
436     ACPI_HANDLE             GpeDevice,
437     UINT32                  GpeNumber);
438 
439 ACPI_STATUS
440 AcpiSetGpe (
441     ACPI_HANDLE             GpeDevice,
442     UINT32                  GpeNumber,
443     UINT8                   Action);
444 
445 ACPI_STATUS
446 AcpiFinishGpe (
447     ACPI_HANDLE             GpeDevice,
448     UINT32                  GpeNumber);
449 
450 ACPI_STATUS
451 AcpiSetupGpeForWake (
452     ACPI_HANDLE             ParentDevice,
453     ACPI_HANDLE             GpeDevice,
454     UINT32                  GpeNumber);
455 
456 ACPI_STATUS
457 AcpiSetGpeWakeMask (
458     ACPI_HANDLE             GpeDevice,
459     UINT32                  GpeNumber,
460     UINT8                   Action);
461 
462 ACPI_STATUS
463 AcpiGetGpeStatus (
464     ACPI_HANDLE             GpeDevice,
465     UINT32                  GpeNumber,
466     ACPI_EVENT_STATUS       *EventStatus);
467 
468 ACPI_STATUS
469 AcpiDisableAllGpes (
470     void);
471 
472 ACPI_STATUS
473 AcpiEnableAllRuntimeGpes (
474     void);
475 
476 ACPI_STATUS
477 AcpiGetGpeDevice (
478     UINT32                  GpeIndex,
479     ACPI_HANDLE             *GpeDevice);
480 
481 ACPI_STATUS
482 AcpiInstallGpeBlock (
483     ACPI_HANDLE             GpeDevice,
484     ACPI_GENERIC_ADDRESS    *GpeBlockAddress,
485     UINT32                  RegisterCount,
486     UINT32                  InterruptNumber);
487 
488 ACPI_STATUS
489 AcpiRemoveGpeBlock (
490     ACPI_HANDLE             GpeDevice);
491 
492 
493 /*
494  * Resource interfaces
495  */
496 typedef
497 ACPI_STATUS (*ACPI_WALK_RESOURCE_CALLBACK) (
498     ACPI_RESOURCE           *Resource,
499     void                    *Context);
500 
501 ACPI_STATUS
502 AcpiGetVendorResource (
503     ACPI_HANDLE             Device,
504     char                    *Name,
505     ACPI_VENDOR_UUID        *Uuid,
506     ACPI_BUFFER             *RetBuffer);
507 
508 ACPI_STATUS
509 AcpiGetCurrentResources (
510     ACPI_HANDLE             Device,
511     ACPI_BUFFER             *RetBuffer);
512 
513 ACPI_STATUS
514 AcpiGetPossibleResources (
515     ACPI_HANDLE             Device,
516     ACPI_BUFFER             *RetBuffer);
517 
518 ACPI_STATUS
519 AcpiWalkResources (
520     ACPI_HANDLE                 Device,
521     char                        *Name,
522     ACPI_WALK_RESOURCE_CALLBACK UserFunction,
523     void                        *Context);
524 
525 ACPI_STATUS
526 AcpiSetCurrentResources (
527     ACPI_HANDLE             Device,
528     ACPI_BUFFER             *InBuffer);
529 
530 ACPI_STATUS
531 AcpiGetIrqRoutingTable (
532     ACPI_HANDLE             Device,
533     ACPI_BUFFER             *RetBuffer);
534 
535 ACPI_STATUS
536 AcpiResourceToAddress64 (
537     ACPI_RESOURCE           *Resource,
538     ACPI_RESOURCE_ADDRESS64 *Out);
539 
540 
541 /*
542  * Hardware (ACPI device) interfaces
543  */
544 ACPI_STATUS
545 AcpiReset (
546     void);
547 
548 ACPI_STATUS
549 AcpiRead (
550     UINT64                  *Value,
551     ACPI_GENERIC_ADDRESS    *Reg);
552 
553 ACPI_STATUS
554 AcpiWrite (
555     UINT64                  Value,
556     ACPI_GENERIC_ADDRESS    *Reg);
557 
558 ACPI_STATUS
559 AcpiReadBitRegister (
560     UINT32                  RegisterId,
561     UINT32                  *ReturnValue);
562 
563 ACPI_STATUS
564 AcpiWriteBitRegister (
565     UINT32                  RegisterId,
566     UINT32                  Value);
567 
568 ACPI_STATUS
569 AcpiGetSleepTypeData (
570     UINT8                   SleepState,
571     UINT8                   *Slp_TypA,
572     UINT8                   *Slp_TypB);
573 
574 ACPI_STATUS
575 AcpiEnterSleepStatePrep (
576     UINT8                   SleepState);
577 
578 ACPI_STATUS
579 AcpiEnterSleepState (
580     UINT8                   SleepState);
581 
582 ACPI_STATUS
583 AcpiEnterSleepStateS4bios (
584     void);
585 
586 ACPI_STATUS
587 AcpiLeaveSleepState (
588     UINT8                   SleepState)
589     ;
590 ACPI_STATUS
591 AcpiSetFirmwareWakingVector (
592     UINT32                  PhysicalAddress);
593 
594 #if ACPI_MACHINE_WIDTH == 64
595 ACPI_STATUS
596 AcpiSetFirmwareWakingVector64 (
597     UINT64                  PhysicalAddress);
598 #endif
599 
600 
601 /*
602  * Error/Warning output
603  */
604 void ACPI_INTERNAL_VAR_XFACE
605 AcpiError (
606     const char              *ModuleName,
607     UINT32                  LineNumber,
608     const char              *Format,
609     ...) ACPI_PRINTF_LIKE(3);
610 
611 void  ACPI_INTERNAL_VAR_XFACE
612 AcpiException (
613     const char              *ModuleName,
614     UINT32                  LineNumber,
615     ACPI_STATUS             Status,
616     const char              *Format,
617     ...) ACPI_PRINTF_LIKE(4);
618 
619 void ACPI_INTERNAL_VAR_XFACE
620 AcpiWarning (
621     const char              *ModuleName,
622     UINT32                  LineNumber,
623     const char              *Format,
624     ...) ACPI_PRINTF_LIKE(3);
625 
626 void ACPI_INTERNAL_VAR_XFACE
627 AcpiInfo (
628     const char              *ModuleName,
629     UINT32                  LineNumber,
630     const char              *Format,
631     ...) ACPI_PRINTF_LIKE(3);
632 
633 
634 /*
635  * Debug output
636  */
637 #ifdef ACPI_DEBUG_OUTPUT
638 
639 void ACPI_INTERNAL_VAR_XFACE
640 AcpiDebugPrint (
641     UINT32                  RequestedDebugLevel,
642     UINT32                  LineNumber,
643     const char              *FunctionName,
644     const char              *ModuleName,
645     UINT32                  ComponentId,
646     const char              *Format,
647     ...) ACPI_PRINTF_LIKE(6);
648 
649 void ACPI_INTERNAL_VAR_XFACE
650 AcpiDebugPrintRaw (
651     UINT32                  RequestedDebugLevel,
652     UINT32                  LineNumber,
653     const char              *FunctionName,
654     const char              *ModuleName,
655     UINT32                  ComponentId,
656     const char              *Format,
657     ...) ACPI_PRINTF_LIKE(6);
658 #endif
659 
660 #endif /* __ACXFACE_H__ */
661