1 /******************************************************************************
2  *
3  * Name: achware.h -- hardware specific interfaces
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2014, 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 __ACHWARE_H__
45 #define __ACHWARE_H__
46 
47 
48 #pragma pack(push) /* Set default struct packing */
49 
50 /* Values for the _SST predefined method */
51 
52 #define ACPI_SST_INDICATOR_OFF  0
53 #define ACPI_SST_WORKING        1
54 #define ACPI_SST_WAKING         2
55 #define ACPI_SST_SLEEPING       3
56 #define ACPI_SST_SLEEP_CONTEXT  4
57 
58 
59 /*
60  * hwacpi - high level functions
61  */
62 ACPI_STATUS
63 AcpiHwSetMode (
64     UINT32                  Mode);
65 
66 UINT32
67 AcpiHwGetMode (
68     void);
69 
70 
71 /*
72  * hwregs - ACPI Register I/O
73  */
74 ACPI_STATUS
75 AcpiHwValidateRegister (
76     ACPI_GENERIC_ADDRESS    *Reg,
77     UINT8                   MaxBitWidth,
78     UINT64                  *Address);
79 
80 ACPI_STATUS
81 AcpiHwRead (
82     UINT32                  *Value,
83     ACPI_GENERIC_ADDRESS    *Reg);
84 
85 ACPI_STATUS
86 AcpiHwWrite (
87     UINT32                  Value,
88     ACPI_GENERIC_ADDRESS    *Reg);
89 
90 ACPI_BIT_REGISTER_INFO *
91 AcpiHwGetBitRegisterInfo (
92     UINT32                  RegisterId);
93 
94 ACPI_STATUS
95 AcpiHwWritePm1Control (
96     UINT32                  Pm1aControl,
97     UINT32                  Pm1bControl);
98 
99 ACPI_STATUS
100 AcpiHwRegisterRead (
101     UINT32                  RegisterId,
102     UINT32                  *ReturnValue);
103 
104 ACPI_STATUS
105 AcpiHwRegisterWrite (
106     UINT32                  RegisterId,
107     UINT32                  Value);
108 
109 ACPI_STATUS
110 AcpiHwClearAcpiStatus (
111     void);
112 
113 
114 /*
115  * hwsleep - sleep/wake support (Legacy sleep registers)
116  */
117 ACPI_STATUS
118 AcpiHwLegacySleep (
119     UINT8                   SleepState);
120 
121 ACPI_STATUS
122 AcpiHwLegacyWakePrep (
123     UINT8                   SleepState);
124 
125 ACPI_STATUS
126 AcpiHwLegacyWake (
127     UINT8                   SleepState);
128 
129 
130 /*
131  * hwesleep - sleep/wake support (Extended FADT-V5 sleep registers)
132  */
133 void
134 AcpiHwExecuteSleepMethod (
135     char                    *MethodName,
136     UINT32                  IntegerArgument);
137 
138 ACPI_STATUS
139 AcpiHwExtendedSleep (
140     UINT8                   SleepState);
141 
142 ACPI_STATUS
143 AcpiHwExtendedWakePrep (
144     UINT8                   SleepState);
145 
146 ACPI_STATUS
147 AcpiHwExtendedWake (
148     UINT8                   SleepState);
149 
150 
151 /*
152  * hwvalid - Port I/O with validation
153  */
154 ACPI_STATUS
155 AcpiHwReadPort (
156     ACPI_IO_ADDRESS         Address,
157     UINT32                  *Value,
158     UINT32                  Width);
159 
160 ACPI_STATUS
161 AcpiHwWritePort (
162     ACPI_IO_ADDRESS         Address,
163     UINT32                  Value,
164     UINT32                  Width);
165 
166 
167 /*
168  * hwgpe - GPE support
169  */
170 UINT32
171 AcpiHwGetGpeRegisterBit (
172     ACPI_GPE_EVENT_INFO     *GpeEventInfo);
173 
174 ACPI_STATUS
175 AcpiHwLowSetGpe (
176     ACPI_GPE_EVENT_INFO     *GpeEventInfo,
177     UINT32                  Action);
178 
179 ACPI_STATUS
180 AcpiHwDisableGpeBlock (
181     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
182     ACPI_GPE_BLOCK_INFO     *GpeBlock,
183     void                    *Context);
184 
185 ACPI_STATUS
186 AcpiHwClearGpe (
187     ACPI_GPE_EVENT_INFO     *GpeEventInfo);
188 
189 ACPI_STATUS
190 AcpiHwClearGpeBlock (
191     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
192     ACPI_GPE_BLOCK_INFO     *GpeBlock,
193     void                    *Context);
194 
195 ACPI_STATUS
196 AcpiHwGetGpeStatus (
197     ACPI_GPE_EVENT_INFO     *GpeEventInfo,
198     ACPI_EVENT_STATUS       *EventStatus);
199 
200 ACPI_STATUS
201 AcpiHwDisableAllGpes (
202     void);
203 
204 ACPI_STATUS
205 AcpiHwEnableAllRuntimeGpes (
206     void);
207 
208 ACPI_STATUS
209 AcpiHwEnableAllWakeupGpes (
210     void);
211 
212 ACPI_STATUS
213 AcpiHwEnableRuntimeGpeBlock (
214     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
215     ACPI_GPE_BLOCK_INFO     *GpeBlock,
216     void                    *Context);
217 
218 
219 /*
220  * hwpci - PCI configuration support
221  */
222 ACPI_STATUS
223 AcpiHwDerivePciId (
224     ACPI_PCI_ID             *PciId,
225     ACPI_HANDLE             RootPciDevice,
226     ACPI_HANDLE             PciRegion);
227 
228 
229 #pragma pack(pop) /* Restore original struct packing */
230 
231 #endif /* __ACHWARE_H__ */
232