xref: /freebsd/sys/contrib/dev/acpica/include/achware.h (revision a88e22b7ad0a8400875be9c3d02d09d0a8010b9c)
1a9f12690SJung-uk Kim /******************************************************************************
2a9f12690SJung-uk Kim  *
3a9f12690SJung-uk Kim  * Name: achware.h -- hardware specific interfaces
4a9f12690SJung-uk Kim  *
5a9f12690SJung-uk Kim  *****************************************************************************/
6a9f12690SJung-uk Kim 
7a9f12690SJung-uk Kim /******************************************************************************
8a9f12690SJung-uk Kim  *
9a9f12690SJung-uk Kim  * 1. Copyright Notice
10a9f12690SJung-uk Kim  *
119a179dd8SJung-uk Kim  * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
12a9f12690SJung-uk Kim  * All rights reserved.
13a9f12690SJung-uk Kim  *
14a9f12690SJung-uk Kim  * 2. License
15a9f12690SJung-uk Kim  *
16a9f12690SJung-uk Kim  * 2.1. This is your license from Intel Corp. under its intellectual property
17a9f12690SJung-uk Kim  * rights.  You may have additional license terms from the party that provided
18a9f12690SJung-uk Kim  * you this software, covering your right to use that party's intellectual
19a9f12690SJung-uk Kim  * property rights.
20a9f12690SJung-uk Kim  *
21a9f12690SJung-uk Kim  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22a9f12690SJung-uk Kim  * copy of the source code appearing in this file ("Covered Code") an
23a9f12690SJung-uk Kim  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24a9f12690SJung-uk Kim  * base code distributed originally by Intel ("Original Intel Code") to copy,
25a9f12690SJung-uk Kim  * make derivatives, distribute, use and display any portion of the Covered
26a9f12690SJung-uk Kim  * Code in any form, with the right to sublicense such rights; and
27a9f12690SJung-uk Kim  *
28a9f12690SJung-uk Kim  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29a9f12690SJung-uk Kim  * license (with the right to sublicense), under only those claims of Intel
30a9f12690SJung-uk Kim  * patents that are infringed by the Original Intel Code, to make, use, sell,
31a9f12690SJung-uk Kim  * offer to sell, and import the Covered Code and derivative works thereof
32a9f12690SJung-uk Kim  * solely to the minimum extent necessary to exercise the above copyright
33a9f12690SJung-uk Kim  * license, and in no event shall the patent license extend to any additions
34a9f12690SJung-uk Kim  * to or modifications of the Original Intel Code.  No other license or right
35a9f12690SJung-uk Kim  * is granted directly or by implication, estoppel or otherwise;
36a9f12690SJung-uk Kim  *
37a9f12690SJung-uk Kim  * The above copyright and patent license is granted only if the following
38a9f12690SJung-uk Kim  * conditions are met:
39a9f12690SJung-uk Kim  *
40a9f12690SJung-uk Kim  * 3. Conditions
41a9f12690SJung-uk Kim  *
42a9f12690SJung-uk Kim  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43a9f12690SJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
44a9f12690SJung-uk Kim  * Code or modification with rights to further distribute source must include
45a9f12690SJung-uk Kim  * the above Copyright Notice, the above License, this list of Conditions,
46a9f12690SJung-uk Kim  * and the following Disclaimer and Export Compliance provision.  In addition,
47a9f12690SJung-uk Kim  * Licensee must cause all Covered Code to which Licensee contributes to
48a9f12690SJung-uk Kim  * contain a file documenting the changes Licensee made to create that Covered
49a9f12690SJung-uk Kim  * Code and the date of any change.  Licensee must include in that file the
50a9f12690SJung-uk Kim  * documentation of any changes made by any predecessor Licensee.  Licensee
51a9f12690SJung-uk Kim  * must include a prominent statement that the modification is derived,
52a9f12690SJung-uk Kim  * directly or indirectly, from Original Intel Code.
53a9f12690SJung-uk Kim  *
54a9f12690SJung-uk Kim  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55a9f12690SJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
56a9f12690SJung-uk Kim  * Code or modification without rights to further distribute source must
57a9f12690SJung-uk Kim  * include the following Disclaimer and Export Compliance provision in the
58a9f12690SJung-uk Kim  * documentation and/or other materials provided with distribution.  In
59a9f12690SJung-uk Kim  * addition, Licensee may not authorize further sublicense of source of any
60a9f12690SJung-uk Kim  * portion of the Covered Code, and must include terms to the effect that the
61a9f12690SJung-uk Kim  * license from Licensee to its licensee is limited to the intellectual
62a9f12690SJung-uk Kim  * property embodied in the software Licensee provides to its licensee, and
63a9f12690SJung-uk Kim  * not to intellectual property embodied in modifications its licensee may
64a9f12690SJung-uk Kim  * make.
65a9f12690SJung-uk Kim  *
66a9f12690SJung-uk Kim  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67a9f12690SJung-uk Kim  * substantial portion of the Covered Code or modification must reproduce the
68a9f12690SJung-uk Kim  * above Copyright Notice, and the following Disclaimer and Export Compliance
69a9f12690SJung-uk Kim  * provision in the documentation and/or other materials provided with the
70a9f12690SJung-uk Kim  * distribution.
71a9f12690SJung-uk Kim  *
72a9f12690SJung-uk Kim  * 3.4. Intel retains all right, title, and interest in and to the Original
73a9f12690SJung-uk Kim  * Intel Code.
74a9f12690SJung-uk Kim  *
75a9f12690SJung-uk Kim  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76a9f12690SJung-uk Kim  * Intel shall be used in advertising or otherwise to promote the sale, use or
77a9f12690SJung-uk Kim  * other dealings in products derived from or relating to the Covered Code
78a9f12690SJung-uk Kim  * without prior written authorization from Intel.
79a9f12690SJung-uk Kim  *
80a9f12690SJung-uk Kim  * 4. Disclaimer and Export Compliance
81a9f12690SJung-uk Kim  *
82a9f12690SJung-uk Kim  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83a9f12690SJung-uk Kim  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84a9f12690SJung-uk Kim  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
85a9f12690SJung-uk Kim  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
86a9f12690SJung-uk Kim  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
87a9f12690SJung-uk Kim  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88a9f12690SJung-uk Kim  * PARTICULAR PURPOSE.
89a9f12690SJung-uk Kim  *
90a9f12690SJung-uk Kim  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91a9f12690SJung-uk Kim  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92a9f12690SJung-uk Kim  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93a9f12690SJung-uk Kim  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94a9f12690SJung-uk Kim  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95a9f12690SJung-uk Kim  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
96a9f12690SJung-uk Kim  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97a9f12690SJung-uk Kim  * LIMITED REMEDY.
98a9f12690SJung-uk Kim  *
99a9f12690SJung-uk Kim  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100a9f12690SJung-uk Kim  * software or system incorporating such software without first obtaining any
101a9f12690SJung-uk Kim  * required license or other approval from the U. S. Department of Commerce or
102a9f12690SJung-uk Kim  * any other agency or department of the United States Government.  In the
103a9f12690SJung-uk Kim  * event Licensee exports any such software from the United States or
104a9f12690SJung-uk Kim  * re-exports any such software from a foreign destination, Licensee shall
105a9f12690SJung-uk Kim  * ensure that the distribution and export/re-export of the software is in
106a9f12690SJung-uk Kim  * compliance with all laws, regulations, orders, or other restrictions of the
107a9f12690SJung-uk Kim  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108a9f12690SJung-uk Kim  * any of its subsidiaries will export/re-export any technical data, process,
109a9f12690SJung-uk Kim  * software, or service, directly or indirectly, to any country for which the
110a9f12690SJung-uk Kim  * United States government or any agency thereof requires an export license,
111a9f12690SJung-uk Kim  * other governmental approval, or letter of assurance, without first obtaining
112a9f12690SJung-uk Kim  * such license, approval or letter.
113a9f12690SJung-uk Kim  *
114a9f12690SJung-uk Kim  *****************************************************************************/
115a9f12690SJung-uk Kim 
116a9f12690SJung-uk Kim #ifndef __ACHWARE_H__
117a9f12690SJung-uk Kim #define __ACHWARE_H__
118a9f12690SJung-uk Kim 
119a9f12690SJung-uk Kim 
120a9f12690SJung-uk Kim /* Values for the _SST predefined method */
121a9f12690SJung-uk Kim 
122a9f12690SJung-uk Kim #define ACPI_SST_INDICATOR_OFF  0
123a9f12690SJung-uk Kim #define ACPI_SST_WORKING        1
124a9f12690SJung-uk Kim #define ACPI_SST_WAKING         2
125a9f12690SJung-uk Kim #define ACPI_SST_SLEEPING       3
126a9f12690SJung-uk Kim #define ACPI_SST_SLEEP_CONTEXT  4
127a9f12690SJung-uk Kim 
128a9f12690SJung-uk Kim 
129a9f12690SJung-uk Kim /*
130a9f12690SJung-uk Kim  * hwacpi - high level functions
131a9f12690SJung-uk Kim  */
132a9f12690SJung-uk Kim ACPI_STATUS
133a9f12690SJung-uk Kim AcpiHwSetMode (
134a9f12690SJung-uk Kim     UINT32                  Mode);
135a9f12690SJung-uk Kim 
136a9f12690SJung-uk Kim UINT32
137a9f12690SJung-uk Kim AcpiHwGetMode (
138a9f12690SJung-uk Kim     void);
139a9f12690SJung-uk Kim 
140a9f12690SJung-uk Kim 
141a9f12690SJung-uk Kim /*
142a9f12690SJung-uk Kim  * hwregs - ACPI Register I/O
143a9f12690SJung-uk Kim  */
144d6dd1baeSJung-uk Kim ACPI_STATUS
145d6dd1baeSJung-uk Kim AcpiHwValidateRegister (
146d6dd1baeSJung-uk Kim     ACPI_GENERIC_ADDRESS    *Reg,
147d6dd1baeSJung-uk Kim     UINT8                   MaxBitWidth,
148d6dd1baeSJung-uk Kim     UINT64                  *Address);
149d6dd1baeSJung-uk Kim 
150d6dd1baeSJung-uk Kim ACPI_STATUS
151d6dd1baeSJung-uk Kim AcpiHwRead (
152d6dd1baeSJung-uk Kim     UINT32                  *Value,
153d6dd1baeSJung-uk Kim     ACPI_GENERIC_ADDRESS    *Reg);
154d6dd1baeSJung-uk Kim 
155d6dd1baeSJung-uk Kim ACPI_STATUS
156d6dd1baeSJung-uk Kim AcpiHwWrite (
157d6dd1baeSJung-uk Kim     UINT32                  Value,
158d6dd1baeSJung-uk Kim     ACPI_GENERIC_ADDRESS    *Reg);
159d6dd1baeSJung-uk Kim 
160a9f12690SJung-uk Kim ACPI_BIT_REGISTER_INFO *
161a9f12690SJung-uk Kim AcpiHwGetBitRegisterInfo (
162a9f12690SJung-uk Kim     UINT32                  RegisterId);
163a9f12690SJung-uk Kim 
164a9f12690SJung-uk Kim ACPI_STATUS
165a9f12690SJung-uk Kim AcpiHwWritePm1Control (
166a9f12690SJung-uk Kim     UINT32                  Pm1aControl,
167a9f12690SJung-uk Kim     UINT32                  Pm1bControl);
168a9f12690SJung-uk Kim 
169a9f12690SJung-uk Kim ACPI_STATUS
170a9f12690SJung-uk Kim AcpiHwRegisterRead (
171a9f12690SJung-uk Kim     UINT32                  RegisterId,
172a9f12690SJung-uk Kim     UINT32                  *ReturnValue);
173a9f12690SJung-uk Kim 
174a9f12690SJung-uk Kim ACPI_STATUS
175a9f12690SJung-uk Kim AcpiHwRegisterWrite (
176a9f12690SJung-uk Kim     UINT32                  RegisterId,
177a9f12690SJung-uk Kim     UINT32                  Value);
178a9f12690SJung-uk Kim 
179a9f12690SJung-uk Kim ACPI_STATUS
180a9f12690SJung-uk Kim AcpiHwClearAcpiStatus (
181a9f12690SJung-uk Kim     void);
182a9f12690SJung-uk Kim 
183a9f12690SJung-uk Kim 
184a9f12690SJung-uk Kim /*
185a9f12690SJung-uk Kim  * hwvalid - Port I/O with validation
186a9f12690SJung-uk Kim  */
187a9f12690SJung-uk Kim ACPI_STATUS
188a9f12690SJung-uk Kim AcpiHwReadPort (
189a9f12690SJung-uk Kim     ACPI_IO_ADDRESS         Address,
190a9f12690SJung-uk Kim     UINT32                  *Value,
191a9f12690SJung-uk Kim     UINT32                  Width);
192a9f12690SJung-uk Kim 
193a9f12690SJung-uk Kim ACPI_STATUS
194a9f12690SJung-uk Kim AcpiHwWritePort (
195a9f12690SJung-uk Kim     ACPI_IO_ADDRESS         Address,
196a9f12690SJung-uk Kim     UINT32                  Value,
197a9f12690SJung-uk Kim     UINT32                  Width);
198a9f12690SJung-uk Kim 
199a9f12690SJung-uk Kim 
200a9f12690SJung-uk Kim /*
201a9f12690SJung-uk Kim  * hwgpe - GPE support
202a9f12690SJung-uk Kim  */
203*a88e22b7SJung-uk Kim UINT32
204*a88e22b7SJung-uk Kim AcpiHwGetGpeRegisterBit (
205*a88e22b7SJung-uk Kim     ACPI_GPE_EVENT_INFO     *GpeEventInfo,
206*a88e22b7SJung-uk Kim     ACPI_GPE_REGISTER_INFO  *GpeRegisterInfo);
207a9f12690SJung-uk Kim 
208a9f12690SJung-uk Kim ACPI_STATUS
209*a88e22b7SJung-uk Kim AcpiHwLowSetGpe (
210*a88e22b7SJung-uk Kim     ACPI_GPE_EVENT_INFO     *GpeEventInfo,
211*a88e22b7SJung-uk Kim     UINT32                  Action);
212a9f12690SJung-uk Kim 
213a9f12690SJung-uk Kim ACPI_STATUS
214a9f12690SJung-uk Kim AcpiHwDisableGpeBlock (
215a9f12690SJung-uk Kim     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
216a9f12690SJung-uk Kim     ACPI_GPE_BLOCK_INFO     *GpeBlock,
217a9f12690SJung-uk Kim     void                    *Context);
218a9f12690SJung-uk Kim 
219a9f12690SJung-uk Kim ACPI_STATUS
220a9f12690SJung-uk Kim AcpiHwClearGpe (
221a9f12690SJung-uk Kim     ACPI_GPE_EVENT_INFO     *GpeEventInfo);
222a9f12690SJung-uk Kim 
223a9f12690SJung-uk Kim ACPI_STATUS
224a9f12690SJung-uk Kim AcpiHwClearGpeBlock (
225a9f12690SJung-uk Kim     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
226a9f12690SJung-uk Kim     ACPI_GPE_BLOCK_INFO     *GpeBlock,
227a9f12690SJung-uk Kim     void                    *Context);
228a9f12690SJung-uk Kim 
229a9f12690SJung-uk Kim ACPI_STATUS
230a9f12690SJung-uk Kim AcpiHwGetGpeStatus (
231a9f12690SJung-uk Kim     ACPI_GPE_EVENT_INFO     *GpeEventInfo,
232a9f12690SJung-uk Kim     ACPI_EVENT_STATUS       *EventStatus);
233a9f12690SJung-uk Kim 
234a9f12690SJung-uk Kim ACPI_STATUS
235a9f12690SJung-uk Kim AcpiHwDisableAllGpes (
236a9f12690SJung-uk Kim     void);
237a9f12690SJung-uk Kim 
238a9f12690SJung-uk Kim ACPI_STATUS
239a9f12690SJung-uk Kim AcpiHwEnableAllRuntimeGpes (
240a9f12690SJung-uk Kim     void);
241a9f12690SJung-uk Kim 
242a9f12690SJung-uk Kim ACPI_STATUS
243a9f12690SJung-uk Kim AcpiHwEnableAllWakeupGpes (
244a9f12690SJung-uk Kim     void);
245a9f12690SJung-uk Kim 
246a9f12690SJung-uk Kim ACPI_STATUS
247a9f12690SJung-uk Kim AcpiHwEnableRuntimeGpeBlock (
248a9f12690SJung-uk Kim     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
249a9f12690SJung-uk Kim     ACPI_GPE_BLOCK_INFO     *GpeBlock,
250a9f12690SJung-uk Kim     void                    *Context);
251a9f12690SJung-uk Kim 
252a9f12690SJung-uk Kim 
253a9f12690SJung-uk Kim /*
254a9f12690SJung-uk Kim  * hwtimer - ACPI Timer prototypes
255a9f12690SJung-uk Kim  */
256a9f12690SJung-uk Kim ACPI_STATUS
257a9f12690SJung-uk Kim AcpiGetTimerResolution (
258a9f12690SJung-uk Kim     UINT32                  *Resolution);
259a9f12690SJung-uk Kim 
260a9f12690SJung-uk Kim ACPI_STATUS
261a9f12690SJung-uk Kim AcpiGetTimer (
262a9f12690SJung-uk Kim     UINT32                  *Ticks);
263a9f12690SJung-uk Kim 
264a9f12690SJung-uk Kim ACPI_STATUS
265a9f12690SJung-uk Kim AcpiGetTimerDuration (
266a9f12690SJung-uk Kim     UINT32                  StartTicks,
267a9f12690SJung-uk Kim     UINT32                  EndTicks,
268a9f12690SJung-uk Kim     UINT32                  *TimeElapsed);
269a9f12690SJung-uk Kim 
270a9f12690SJung-uk Kim 
271a9f12690SJung-uk Kim #endif /* __ACHWARE_H__ */
272