hwgpe.c revision 1.1.1.2.2.2 1 1.1.1.2.2.2 bouyer
2 1.1.1.2.2.2 bouyer /******************************************************************************
3 1.1.1.2.2.2 bouyer *
4 1.1.1.2.2.2 bouyer * Module Name: hwgpe - Low level GPE enable/disable/clear functions
5 1.1.1.2.2.2 bouyer *
6 1.1.1.2.2.2 bouyer *****************************************************************************/
7 1.1.1.2.2.2 bouyer
8 1.1.1.2.2.2 bouyer /*
9 1.1.1.2.2.2 bouyer * Copyright (C) 2000 - 2011, Intel Corp.
10 1.1.1.2.2.2 bouyer * All rights reserved.
11 1.1.1.2.2.2 bouyer *
12 1.1.1.2.2.2 bouyer * Redistribution and use in source and binary forms, with or without
13 1.1.1.2.2.2 bouyer * modification, are permitted provided that the following conditions
14 1.1.1.2.2.2 bouyer * are met:
15 1.1.1.2.2.2 bouyer * 1. Redistributions of source code must retain the above copyright
16 1.1.1.2.2.2 bouyer * notice, this list of conditions, and the following disclaimer,
17 1.1.1.2.2.2 bouyer * without modification.
18 1.1.1.2.2.2 bouyer * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 1.1.1.2.2.2 bouyer * substantially similar to the "NO WARRANTY" disclaimer below
20 1.1.1.2.2.2 bouyer * ("Disclaimer") and any redistribution must be conditioned upon
21 1.1.1.2.2.2 bouyer * including a substantially similar Disclaimer requirement for further
22 1.1.1.2.2.2 bouyer * binary redistribution.
23 1.1.1.2.2.2 bouyer * 3. Neither the names of the above-listed copyright holders nor the names
24 1.1.1.2.2.2 bouyer * of any contributors may be used to endorse or promote products derived
25 1.1.1.2.2.2 bouyer * from this software without specific prior written permission.
26 1.1.1.2.2.2 bouyer *
27 1.1.1.2.2.2 bouyer * Alternatively, this software may be distributed under the terms of the
28 1.1.1.2.2.2 bouyer * GNU General Public License ("GPL") version 2 as published by the Free
29 1.1.1.2.2.2 bouyer * Software Foundation.
30 1.1.1.2.2.2 bouyer *
31 1.1.1.2.2.2 bouyer * NO WARRANTY
32 1.1.1.2.2.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 1.1.1.2.2.2 bouyer * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 1.1.1.2.2.2 bouyer * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 1.1.1.2.2.2 bouyer * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 1.1.1.2.2.2 bouyer * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 1.1.1.2.2.2 bouyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 1.1.1.2.2.2 bouyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 1.1.1.2.2.2 bouyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 1.1.1.2.2.2 bouyer * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 1.1.1.2.2.2 bouyer * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 1.1.1.2.2.2 bouyer * POSSIBILITY OF SUCH DAMAGES.
43 1.1.1.2.2.2 bouyer */
44 1.1.1.2.2.2 bouyer
45 1.1.1.2.2.2 bouyer #include "acpi.h"
46 1.1.1.2.2.2 bouyer #include "accommon.h"
47 1.1.1.2.2.2 bouyer #include "acevents.h"
48 1.1.1.2.2.2 bouyer
49 1.1.1.2.2.2 bouyer #define _COMPONENT ACPI_HARDWARE
50 1.1.1.2.2.2 bouyer ACPI_MODULE_NAME ("hwgpe")
51 1.1.1.2.2.2 bouyer
52 1.1.1.2.2.2 bouyer /* Local prototypes */
53 1.1.1.2.2.2 bouyer
54 1.1.1.2.2.2 bouyer static ACPI_STATUS
55 1.1.1.2.2.2 bouyer AcpiHwEnableWakeupGpeBlock (
56 1.1.1.2.2.2 bouyer ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
57 1.1.1.2.2.2 bouyer ACPI_GPE_BLOCK_INFO *GpeBlock,
58 1.1.1.2.2.2 bouyer void *Context);
59 1.1.1.2.2.2 bouyer
60 1.1.1.2.2.2 bouyer
61 1.1.1.2.2.2 bouyer /******************************************************************************
62 1.1.1.2.2.2 bouyer *
63 1.1.1.2.2.2 bouyer * FUNCTION: AcpiHwGetGpeRegisterBit
64 1.1.1.2.2.2 bouyer *
65 1.1.1.2.2.2 bouyer * PARAMETERS: GpeEventInfo - Info block for the GPE
66 1.1.1.2.2.2 bouyer * GpeRegisterInfo - Info block for the GPE register
67 1.1.1.2.2.2 bouyer *
68 1.1.1.2.2.2 bouyer * RETURN: Register mask with a one in the GPE bit position
69 1.1.1.2.2.2 bouyer *
70 1.1.1.2.2.2 bouyer * DESCRIPTION: Compute the register mask for this GPE. One bit is set in the
71 1.1.1.2.2.2 bouyer * correct position for the input GPE.
72 1.1.1.2.2.2 bouyer *
73 1.1.1.2.2.2 bouyer ******************************************************************************/
74 1.1.1.2.2.2 bouyer
75 1.1.1.2.2.2 bouyer UINT32
76 1.1.1.2.2.2 bouyer AcpiHwGetGpeRegisterBit (
77 1.1.1.2.2.2 bouyer ACPI_GPE_EVENT_INFO *GpeEventInfo,
78 1.1.1.2.2.2 bouyer ACPI_GPE_REGISTER_INFO *GpeRegisterInfo)
79 1.1.1.2.2.2 bouyer {
80 1.1.1.2.2.2 bouyer
81 1.1.1.2.2.2 bouyer return ((UINT32) 1 <<
82 1.1.1.2.2.2 bouyer (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber));
83 1.1.1.2.2.2 bouyer }
84 1.1.1.2.2.2 bouyer
85 1.1.1.2.2.2 bouyer
86 1.1.1.2.2.2 bouyer /******************************************************************************
87 1.1.1.2.2.2 bouyer *
88 1.1.1.2.2.2 bouyer * FUNCTION: AcpiHwLowSetGpe
89 1.1.1.2.2.2 bouyer *
90 1.1.1.2.2.2 bouyer * PARAMETERS: GpeEventInfo - Info block for the GPE to be disabled
91 1.1.1.2.2.2 bouyer * Action - Enable or disable
92 1.1.1.2.2.2 bouyer *
93 1.1.1.2.2.2 bouyer * RETURN: Status
94 1.1.1.2.2.2 bouyer *
95 1.1.1.2.2.2 bouyer * DESCRIPTION: Enable or disable a single GPE in the parent enable register.
96 1.1.1.2.2.2 bouyer *
97 1.1.1.2.2.2 bouyer ******************************************************************************/
98 1.1.1.2.2.2 bouyer
99 1.1.1.2.2.2 bouyer ACPI_STATUS
100 1.1.1.2.2.2 bouyer AcpiHwLowSetGpe (
101 1.1.1.2.2.2 bouyer ACPI_GPE_EVENT_INFO *GpeEventInfo,
102 1.1.1.2.2.2 bouyer UINT32 Action)
103 1.1.1.2.2.2 bouyer {
104 1.1.1.2.2.2 bouyer ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
105 1.1.1.2.2.2 bouyer ACPI_STATUS Status;
106 1.1.1.2.2.2 bouyer UINT32 EnableMask;
107 1.1.1.2.2.2 bouyer UINT32 RegisterBit;
108 1.1.1.2.2.2 bouyer
109 1.1.1.2.2.2 bouyer
110 1.1.1.2.2.2 bouyer ACPI_FUNCTION_ENTRY ();
111 1.1.1.2.2.2 bouyer
112 1.1.1.2.2.2 bouyer
113 1.1.1.2.2.2 bouyer /* Get the info block for the entire GPE register */
114 1.1.1.2.2.2 bouyer
115 1.1.1.2.2.2 bouyer GpeRegisterInfo = GpeEventInfo->RegisterInfo;
116 1.1.1.2.2.2 bouyer if (!GpeRegisterInfo)
117 1.1.1.2.2.2 bouyer {
118 1.1.1.2.2.2 bouyer return (AE_NOT_EXIST);
119 1.1.1.2.2.2 bouyer }
120 1.1.1.2.2.2 bouyer
121 1.1.1.2.2.2 bouyer /* Get current value of the enable register that contains this GPE */
122 1.1.1.2.2.2 bouyer
123 1.1.1.2.2.2 bouyer Status = AcpiHwRead (&EnableMask, &GpeRegisterInfo->EnableAddress);
124 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
125 1.1.1.2.2.2 bouyer {
126 1.1.1.2.2.2 bouyer return (Status);
127 1.1.1.2.2.2 bouyer }
128 1.1.1.2.2.2 bouyer
129 1.1.1.2.2.2 bouyer /* Set or clear just the bit that corresponds to this GPE */
130 1.1.1.2.2.2 bouyer
131 1.1.1.2.2.2 bouyer RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
132 1.1.1.2.2.2 bouyer switch (Action)
133 1.1.1.2.2.2 bouyer {
134 1.1.1.2.2.2 bouyer case ACPI_GPE_CONDITIONAL_ENABLE:
135 1.1.1.2.2.2 bouyer
136 1.1.1.2.2.2 bouyer /* Only enable if the EnableForRun bit is set */
137 1.1.1.2.2.2 bouyer
138 1.1.1.2.2.2 bouyer if (!(RegisterBit & GpeRegisterInfo->EnableForRun))
139 1.1.1.2.2.2 bouyer {
140 1.1.1.2.2.2 bouyer return (AE_BAD_PARAMETER);
141 1.1.1.2.2.2 bouyer }
142 1.1.1.2.2.2 bouyer
143 1.1.1.2.2.2 bouyer /*lint -fallthrough */
144 1.1.1.2.2.2 bouyer
145 1.1.1.2.2.2 bouyer case ACPI_GPE_ENABLE:
146 1.1.1.2.2.2 bouyer ACPI_SET_BIT (EnableMask, RegisterBit);
147 1.1.1.2.2.2 bouyer break;
148 1.1.1.2.2.2 bouyer
149 1.1.1.2.2.2 bouyer case ACPI_GPE_DISABLE:
150 1.1.1.2.2.2 bouyer ACPI_CLEAR_BIT (EnableMask, RegisterBit);
151 1.1.1.2.2.2 bouyer break;
152 1.1.1.2.2.2 bouyer
153 1.1.1.2.2.2 bouyer default:
154 1.1.1.2.2.2 bouyer ACPI_ERROR ((AE_INFO, "Invalid GPE Action, %u\n", Action));
155 1.1.1.2.2.2 bouyer return (AE_BAD_PARAMETER);
156 1.1.1.2.2.2 bouyer }
157 1.1.1.2.2.2 bouyer
158 1.1.1.2.2.2 bouyer /* Write the updated enable mask */
159 1.1.1.2.2.2 bouyer
160 1.1.1.2.2.2 bouyer Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
161 1.1.1.2.2.2 bouyer return (Status);
162 1.1.1.2.2.2 bouyer }
163 1.1.1.2.2.2 bouyer
164 1.1.1.2.2.2 bouyer
165 1.1.1.2.2.2 bouyer /******************************************************************************
166 1.1.1.2.2.2 bouyer *
167 1.1.1.2.2.2 bouyer * FUNCTION: AcpiHwClearGpe
168 1.1.1.2.2.2 bouyer *
169 1.1.1.2.2.2 bouyer * PARAMETERS: GpeEventInfo - Info block for the GPE to be cleared
170 1.1.1.2.2.2 bouyer *
171 1.1.1.2.2.2 bouyer * RETURN: Status
172 1.1.1.2.2.2 bouyer *
173 1.1.1.2.2.2 bouyer * DESCRIPTION: Clear the status bit for a single GPE.
174 1.1.1.2.2.2 bouyer *
175 1.1.1.2.2.2 bouyer ******************************************************************************/
176 1.1.1.2.2.2 bouyer
177 1.1.1.2.2.2 bouyer ACPI_STATUS
178 1.1.1.2.2.2 bouyer AcpiHwClearGpe (
179 1.1.1.2.2.2 bouyer ACPI_GPE_EVENT_INFO *GpeEventInfo)
180 1.1.1.2.2.2 bouyer {
181 1.1.1.2.2.2 bouyer ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
182 1.1.1.2.2.2 bouyer ACPI_STATUS Status;
183 1.1.1.2.2.2 bouyer UINT32 RegisterBit;
184 1.1.1.2.2.2 bouyer
185 1.1.1.2.2.2 bouyer
186 1.1.1.2.2.2 bouyer ACPI_FUNCTION_ENTRY ();
187 1.1.1.2.2.2 bouyer
188 1.1.1.2.2.2 bouyer /* Get the info block for the entire GPE register */
189 1.1.1.2.2.2 bouyer
190 1.1.1.2.2.2 bouyer GpeRegisterInfo = GpeEventInfo->RegisterInfo;
191 1.1.1.2.2.2 bouyer if (!GpeRegisterInfo)
192 1.1.1.2.2.2 bouyer {
193 1.1.1.2.2.2 bouyer return (AE_NOT_EXIST);
194 1.1.1.2.2.2 bouyer }
195 1.1.1.2.2.2 bouyer
196 1.1.1.2.2.2 bouyer /*
197 1.1.1.2.2.2 bouyer * Write a one to the appropriate bit in the status register to
198 1.1.1.2.2.2 bouyer * clear this GPE.
199 1.1.1.2.2.2 bouyer */
200 1.1.1.2.2.2 bouyer RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
201 1.1.1.2.2.2 bouyer
202 1.1.1.2.2.2 bouyer Status = AcpiHwWrite (RegisterBit,
203 1.1.1.2.2.2 bouyer &GpeRegisterInfo->StatusAddress);
204 1.1.1.2.2.2 bouyer
205 1.1.1.2.2.2 bouyer return (Status);
206 1.1.1.2.2.2 bouyer }
207 1.1.1.2.2.2 bouyer
208 1.1.1.2.2.2 bouyer
209 1.1.1.2.2.2 bouyer /******************************************************************************
210 1.1.1.2.2.2 bouyer *
211 1.1.1.2.2.2 bouyer * FUNCTION: AcpiHwGetGpeStatus
212 1.1.1.2.2.2 bouyer *
213 1.1.1.2.2.2 bouyer * PARAMETERS: GpeEventInfo - Info block for the GPE to queried
214 1.1.1.2.2.2 bouyer * EventStatus - Where the GPE status is returned
215 1.1.1.2.2.2 bouyer *
216 1.1.1.2.2.2 bouyer * RETURN: Status
217 1.1.1.2.2.2 bouyer *
218 1.1.1.2.2.2 bouyer * DESCRIPTION: Return the status of a single GPE.
219 1.1.1.2.2.2 bouyer *
220 1.1.1.2.2.2 bouyer ******************************************************************************/
221 1.1.1.2.2.2 bouyer
222 1.1.1.2.2.2 bouyer ACPI_STATUS
223 1.1.1.2.2.2 bouyer AcpiHwGetGpeStatus (
224 1.1.1.2.2.2 bouyer ACPI_GPE_EVENT_INFO *GpeEventInfo,
225 1.1.1.2.2.2 bouyer ACPI_EVENT_STATUS *EventStatus)
226 1.1.1.2.2.2 bouyer {
227 1.1.1.2.2.2 bouyer UINT32 InByte;
228 1.1.1.2.2.2 bouyer UINT32 RegisterBit;
229 1.1.1.2.2.2 bouyer ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
230 1.1.1.2.2.2 bouyer ACPI_EVENT_STATUS LocalEventStatus = 0;
231 1.1.1.2.2.2 bouyer ACPI_STATUS Status;
232 1.1.1.2.2.2 bouyer
233 1.1.1.2.2.2 bouyer
234 1.1.1.2.2.2 bouyer ACPI_FUNCTION_ENTRY ();
235 1.1.1.2.2.2 bouyer
236 1.1.1.2.2.2 bouyer
237 1.1.1.2.2.2 bouyer if (!EventStatus)
238 1.1.1.2.2.2 bouyer {
239 1.1.1.2.2.2 bouyer return (AE_BAD_PARAMETER);
240 1.1.1.2.2.2 bouyer }
241 1.1.1.2.2.2 bouyer
242 1.1.1.2.2.2 bouyer /* Get the info block for the entire GPE register */
243 1.1.1.2.2.2 bouyer
244 1.1.1.2.2.2 bouyer GpeRegisterInfo = GpeEventInfo->RegisterInfo;
245 1.1.1.2.2.2 bouyer
246 1.1.1.2.2.2 bouyer /* Get the register bitmask for this GPE */
247 1.1.1.2.2.2 bouyer
248 1.1.1.2.2.2 bouyer RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo, GpeRegisterInfo);
249 1.1.1.2.2.2 bouyer
250 1.1.1.2.2.2 bouyer /* GPE currently enabled? (enabled for runtime?) */
251 1.1.1.2.2.2 bouyer
252 1.1.1.2.2.2 bouyer if (RegisterBit & GpeRegisterInfo->EnableForRun)
253 1.1.1.2.2.2 bouyer {
254 1.1.1.2.2.2 bouyer LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED;
255 1.1.1.2.2.2 bouyer }
256 1.1.1.2.2.2 bouyer
257 1.1.1.2.2.2 bouyer /* GPE enabled for wake? */
258 1.1.1.2.2.2 bouyer
259 1.1.1.2.2.2 bouyer if (RegisterBit & GpeRegisterInfo->EnableForWake)
260 1.1.1.2.2.2 bouyer {
261 1.1.1.2.2.2 bouyer LocalEventStatus |= ACPI_EVENT_FLAG_WAKE_ENABLED;
262 1.1.1.2.2.2 bouyer }
263 1.1.1.2.2.2 bouyer
264 1.1.1.2.2.2 bouyer /* GPE currently active (status bit == 1)? */
265 1.1.1.2.2.2 bouyer
266 1.1.1.2.2.2 bouyer Status = AcpiHwRead (&InByte, &GpeRegisterInfo->StatusAddress);
267 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
268 1.1.1.2.2.2 bouyer {
269 1.1.1.2.2.2 bouyer return (Status);
270 1.1.1.2.2.2 bouyer }
271 1.1.1.2.2.2 bouyer
272 1.1.1.2.2.2 bouyer if (RegisterBit & InByte)
273 1.1.1.2.2.2 bouyer {
274 1.1.1.2.2.2 bouyer LocalEventStatus |= ACPI_EVENT_FLAG_SET;
275 1.1.1.2.2.2 bouyer }
276 1.1.1.2.2.2 bouyer
277 1.1.1.2.2.2 bouyer /* Set return value */
278 1.1.1.2.2.2 bouyer
279 1.1.1.2.2.2 bouyer (*EventStatus) = LocalEventStatus;
280 1.1.1.2.2.2 bouyer return (AE_OK);
281 1.1.1.2.2.2 bouyer }
282 1.1.1.2.2.2 bouyer
283 1.1.1.2.2.2 bouyer
284 1.1.1.2.2.2 bouyer /******************************************************************************
285 1.1.1.2.2.2 bouyer *
286 1.1.1.2.2.2 bouyer * FUNCTION: AcpiHwDisableGpeBlock
287 1.1.1.2.2.2 bouyer *
288 1.1.1.2.2.2 bouyer * PARAMETERS: GpeXruptInfo - GPE Interrupt info
289 1.1.1.2.2.2 bouyer * GpeBlock - Gpe Block info
290 1.1.1.2.2.2 bouyer *
291 1.1.1.2.2.2 bouyer * RETURN: Status
292 1.1.1.2.2.2 bouyer *
293 1.1.1.2.2.2 bouyer * DESCRIPTION: Disable all GPEs within a single GPE block
294 1.1.1.2.2.2 bouyer *
295 1.1.1.2.2.2 bouyer ******************************************************************************/
296 1.1.1.2.2.2 bouyer
297 1.1.1.2.2.2 bouyer ACPI_STATUS
298 1.1.1.2.2.2 bouyer AcpiHwDisableGpeBlock (
299 1.1.1.2.2.2 bouyer ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
300 1.1.1.2.2.2 bouyer ACPI_GPE_BLOCK_INFO *GpeBlock,
301 1.1.1.2.2.2 bouyer void *Context)
302 1.1.1.2.2.2 bouyer {
303 1.1.1.2.2.2 bouyer UINT32 i;
304 1.1.1.2.2.2 bouyer ACPI_STATUS Status;
305 1.1.1.2.2.2 bouyer
306 1.1.1.2.2.2 bouyer
307 1.1.1.2.2.2 bouyer /* Examine each GPE Register within the block */
308 1.1.1.2.2.2 bouyer
309 1.1.1.2.2.2 bouyer for (i = 0; i < GpeBlock->RegisterCount; i++)
310 1.1.1.2.2.2 bouyer {
311 1.1.1.2.2.2 bouyer /* Disable all GPEs in this register */
312 1.1.1.2.2.2 bouyer
313 1.1.1.2.2.2 bouyer Status = AcpiHwWrite (0x00, &GpeBlock->RegisterInfo[i].EnableAddress);
314 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
315 1.1.1.2.2.2 bouyer {
316 1.1.1.2.2.2 bouyer return (Status);
317 1.1.1.2.2.2 bouyer }
318 1.1.1.2.2.2 bouyer }
319 1.1.1.2.2.2 bouyer
320 1.1.1.2.2.2 bouyer return (AE_OK);
321 1.1.1.2.2.2 bouyer }
322 1.1.1.2.2.2 bouyer
323 1.1.1.2.2.2 bouyer
324 1.1.1.2.2.2 bouyer /******************************************************************************
325 1.1.1.2.2.2 bouyer *
326 1.1.1.2.2.2 bouyer * FUNCTION: AcpiHwClearGpeBlock
327 1.1.1.2.2.2 bouyer *
328 1.1.1.2.2.2 bouyer * PARAMETERS: GpeXruptInfo - GPE Interrupt info
329 1.1.1.2.2.2 bouyer * GpeBlock - Gpe Block info
330 1.1.1.2.2.2 bouyer *
331 1.1.1.2.2.2 bouyer * RETURN: Status
332 1.1.1.2.2.2 bouyer *
333 1.1.1.2.2.2 bouyer * DESCRIPTION: Clear status bits for all GPEs within a single GPE block
334 1.1.1.2.2.2 bouyer *
335 1.1.1.2.2.2 bouyer ******************************************************************************/
336 1.1.1.2.2.2 bouyer
337 1.1.1.2.2.2 bouyer ACPI_STATUS
338 1.1.1.2.2.2 bouyer AcpiHwClearGpeBlock (
339 1.1.1.2.2.2 bouyer ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
340 1.1.1.2.2.2 bouyer ACPI_GPE_BLOCK_INFO *GpeBlock,
341 1.1.1.2.2.2 bouyer void *Context)
342 1.1.1.2.2.2 bouyer {
343 1.1.1.2.2.2 bouyer UINT32 i;
344 1.1.1.2.2.2 bouyer ACPI_STATUS Status;
345 1.1.1.2.2.2 bouyer
346 1.1.1.2.2.2 bouyer
347 1.1.1.2.2.2 bouyer /* Examine each GPE Register within the block */
348 1.1.1.2.2.2 bouyer
349 1.1.1.2.2.2 bouyer for (i = 0; i < GpeBlock->RegisterCount; i++)
350 1.1.1.2.2.2 bouyer {
351 1.1.1.2.2.2 bouyer /* Clear status on all GPEs in this register */
352 1.1.1.2.2.2 bouyer
353 1.1.1.2.2.2 bouyer Status = AcpiHwWrite (0xFF, &GpeBlock->RegisterInfo[i].StatusAddress);
354 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
355 1.1.1.2.2.2 bouyer {
356 1.1.1.2.2.2 bouyer return (Status);
357 1.1.1.2.2.2 bouyer }
358 1.1.1.2.2.2 bouyer }
359 1.1.1.2.2.2 bouyer
360 1.1.1.2.2.2 bouyer return (AE_OK);
361 1.1.1.2.2.2 bouyer }
362 1.1.1.2.2.2 bouyer
363 1.1.1.2.2.2 bouyer
364 1.1.1.2.2.2 bouyer /******************************************************************************
365 1.1.1.2.2.2 bouyer *
366 1.1.1.2.2.2 bouyer * FUNCTION: AcpiHwEnableRuntimeGpeBlock
367 1.1.1.2.2.2 bouyer *
368 1.1.1.2.2.2 bouyer * PARAMETERS: GpeXruptInfo - GPE Interrupt info
369 1.1.1.2.2.2 bouyer * GpeBlock - Gpe Block info
370 1.1.1.2.2.2 bouyer *
371 1.1.1.2.2.2 bouyer * RETURN: Status
372 1.1.1.2.2.2 bouyer *
373 1.1.1.2.2.2 bouyer * DESCRIPTION: Enable all "runtime" GPEs within a single GPE block. Includes
374 1.1.1.2.2.2 bouyer * combination wake/run GPEs.
375 1.1.1.2.2.2 bouyer *
376 1.1.1.2.2.2 bouyer ******************************************************************************/
377 1.1.1.2.2.2 bouyer
378 1.1.1.2.2.2 bouyer ACPI_STATUS
379 1.1.1.2.2.2 bouyer AcpiHwEnableRuntimeGpeBlock (
380 1.1.1.2.2.2 bouyer ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
381 1.1.1.2.2.2 bouyer ACPI_GPE_BLOCK_INFO *GpeBlock,
382 1.1.1.2.2.2 bouyer void *Context)
383 1.1.1.2.2.2 bouyer {
384 1.1.1.2.2.2 bouyer UINT32 i;
385 1.1.1.2.2.2 bouyer ACPI_STATUS Status;
386 1.1.1.2.2.2 bouyer
387 1.1.1.2.2.2 bouyer
388 1.1.1.2.2.2 bouyer /* NOTE: assumes that all GPEs are currently disabled */
389 1.1.1.2.2.2 bouyer
390 1.1.1.2.2.2 bouyer /* Examine each GPE Register within the block */
391 1.1.1.2.2.2 bouyer
392 1.1.1.2.2.2 bouyer for (i = 0; i < GpeBlock->RegisterCount; i++)
393 1.1.1.2.2.2 bouyer {
394 1.1.1.2.2.2 bouyer if (!GpeBlock->RegisterInfo[i].EnableForRun)
395 1.1.1.2.2.2 bouyer {
396 1.1.1.2.2.2 bouyer continue;
397 1.1.1.2.2.2 bouyer }
398 1.1.1.2.2.2 bouyer
399 1.1.1.2.2.2 bouyer /* Enable all "runtime" GPEs in this register */
400 1.1.1.2.2.2 bouyer
401 1.1.1.2.2.2 bouyer Status = AcpiHwWrite (GpeBlock->RegisterInfo[i].EnableForRun,
402 1.1.1.2.2.2 bouyer &GpeBlock->RegisterInfo[i].EnableAddress);
403 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
404 1.1.1.2.2.2 bouyer {
405 1.1.1.2.2.2 bouyer return (Status);
406 1.1.1.2.2.2 bouyer }
407 1.1.1.2.2.2 bouyer }
408 1.1.1.2.2.2 bouyer
409 1.1.1.2.2.2 bouyer return (AE_OK);
410 1.1.1.2.2.2 bouyer }
411 1.1.1.2.2.2 bouyer
412 1.1.1.2.2.2 bouyer
413 1.1.1.2.2.2 bouyer /******************************************************************************
414 1.1.1.2.2.2 bouyer *
415 1.1.1.2.2.2 bouyer * FUNCTION: AcpiHwEnableWakeupGpeBlock
416 1.1.1.2.2.2 bouyer *
417 1.1.1.2.2.2 bouyer * PARAMETERS: GpeXruptInfo - GPE Interrupt info
418 1.1.1.2.2.2 bouyer * GpeBlock - Gpe Block info
419 1.1.1.2.2.2 bouyer *
420 1.1.1.2.2.2 bouyer * RETURN: Status
421 1.1.1.2.2.2 bouyer *
422 1.1.1.2.2.2 bouyer * DESCRIPTION: Enable all "wake" GPEs within a single GPE block. Includes
423 1.1.1.2.2.2 bouyer * combination wake/run GPEs.
424 1.1.1.2.2.2 bouyer *
425 1.1.1.2.2.2 bouyer ******************************************************************************/
426 1.1.1.2.2.2 bouyer
427 1.1.1.2.2.2 bouyer static ACPI_STATUS
428 1.1.1.2.2.2 bouyer AcpiHwEnableWakeupGpeBlock (
429 1.1.1.2.2.2 bouyer ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
430 1.1.1.2.2.2 bouyer ACPI_GPE_BLOCK_INFO *GpeBlock,
431 1.1.1.2.2.2 bouyer void *Context)
432 1.1.1.2.2.2 bouyer {
433 1.1.1.2.2.2 bouyer UINT32 i;
434 1.1.1.2.2.2 bouyer ACPI_STATUS Status;
435 1.1.1.2.2.2 bouyer
436 1.1.1.2.2.2 bouyer
437 1.1.1.2.2.2 bouyer /* Examine each GPE Register within the block */
438 1.1.1.2.2.2 bouyer
439 1.1.1.2.2.2 bouyer for (i = 0; i < GpeBlock->RegisterCount; i++)
440 1.1.1.2.2.2 bouyer {
441 1.1.1.2.2.2 bouyer if (!GpeBlock->RegisterInfo[i].EnableForWake)
442 1.1.1.2.2.2 bouyer {
443 1.1.1.2.2.2 bouyer continue;
444 1.1.1.2.2.2 bouyer }
445 1.1.1.2.2.2 bouyer
446 1.1.1.2.2.2 bouyer /* Enable all "wake" GPEs in this register */
447 1.1.1.2.2.2 bouyer
448 1.1.1.2.2.2 bouyer Status = AcpiHwWrite (GpeBlock->RegisterInfo[i].EnableForWake,
449 1.1.1.2.2.2 bouyer &GpeBlock->RegisterInfo[i].EnableAddress);
450 1.1.1.2.2.2 bouyer if (ACPI_FAILURE (Status))
451 1.1.1.2.2.2 bouyer {
452 1.1.1.2.2.2 bouyer return (Status);
453 1.1.1.2.2.2 bouyer }
454 1.1.1.2.2.2 bouyer }
455 1.1.1.2.2.2 bouyer
456 1.1.1.2.2.2 bouyer return (AE_OK);
457 1.1.1.2.2.2 bouyer }
458 1.1.1.2.2.2 bouyer
459 1.1.1.2.2.2 bouyer
460 1.1.1.2.2.2 bouyer /******************************************************************************
461 1.1.1.2.2.2 bouyer *
462 1.1.1.2.2.2 bouyer * FUNCTION: AcpiHwDisableAllGpes
463 1.1.1.2.2.2 bouyer *
464 1.1.1.2.2.2 bouyer * PARAMETERS: None
465 1.1.1.2.2.2 bouyer *
466 1.1.1.2.2.2 bouyer * RETURN: Status
467 1.1.1.2.2.2 bouyer *
468 1.1.1.2.2.2 bouyer * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
469 1.1.1.2.2.2 bouyer *
470 1.1.1.2.2.2 bouyer ******************************************************************************/
471 1.1.1.2.2.2 bouyer
472 1.1.1.2.2.2 bouyer ACPI_STATUS
473 1.1.1.2.2.2 bouyer AcpiHwDisableAllGpes (
474 1.1.1.2.2.2 bouyer void)
475 1.1.1.2.2.2 bouyer {
476 1.1.1.2.2.2 bouyer ACPI_STATUS Status;
477 1.1.1.2.2.2 bouyer
478 1.1.1.2.2.2 bouyer
479 1.1.1.2.2.2 bouyer ACPI_FUNCTION_TRACE (HwDisableAllGpes);
480 1.1.1.2.2.2 bouyer
481 1.1.1.2.2.2 bouyer
482 1.1.1.2.2.2 bouyer Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL);
483 1.1.1.2.2.2 bouyer Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL);
484 1.1.1.2.2.2 bouyer return_ACPI_STATUS (Status);
485 1.1.1.2.2.2 bouyer }
486 1.1.1.2.2.2 bouyer
487 1.1.1.2.2.2 bouyer
488 1.1.1.2.2.2 bouyer /******************************************************************************
489 1.1.1.2.2.2 bouyer *
490 1.1.1.2.2.2 bouyer * FUNCTION: AcpiHwEnableAllRuntimeGpes
491 1.1.1.2.2.2 bouyer *
492 1.1.1.2.2.2 bouyer * PARAMETERS: None
493 1.1.1.2.2.2 bouyer *
494 1.1.1.2.2.2 bouyer * RETURN: Status
495 1.1.1.2.2.2 bouyer *
496 1.1.1.2.2.2 bouyer * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
497 1.1.1.2.2.2 bouyer *
498 1.1.1.2.2.2 bouyer ******************************************************************************/
499 1.1.1.2.2.2 bouyer
500 1.1.1.2.2.2 bouyer ACPI_STATUS
501 1.1.1.2.2.2 bouyer AcpiHwEnableAllRuntimeGpes (
502 1.1.1.2.2.2 bouyer void)
503 1.1.1.2.2.2 bouyer {
504 1.1.1.2.2.2 bouyer ACPI_STATUS Status;
505 1.1.1.2.2.2 bouyer
506 1.1.1.2.2.2 bouyer
507 1.1.1.2.2.2 bouyer ACPI_FUNCTION_TRACE (HwEnableAllRuntimeGpes);
508 1.1.1.2.2.2 bouyer
509 1.1.1.2.2.2 bouyer
510 1.1.1.2.2.2 bouyer Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock, NULL);
511 1.1.1.2.2.2 bouyer return_ACPI_STATUS (Status);
512 1.1.1.2.2.2 bouyer }
513 1.1.1.2.2.2 bouyer
514 1.1.1.2.2.2 bouyer
515 1.1.1.2.2.2 bouyer /******************************************************************************
516 1.1.1.2.2.2 bouyer *
517 1.1.1.2.2.2 bouyer * FUNCTION: AcpiHwEnableAllWakeupGpes
518 1.1.1.2.2.2 bouyer *
519 1.1.1.2.2.2 bouyer * PARAMETERS: None
520 1.1.1.2.2.2 bouyer *
521 1.1.1.2.2.2 bouyer * RETURN: Status
522 1.1.1.2.2.2 bouyer *
523 1.1.1.2.2.2 bouyer * DESCRIPTION: Enable all "wakeup" GPEs, in all GPE blocks
524 1.1.1.2.2.2 bouyer *
525 1.1.1.2.2.2 bouyer ******************************************************************************/
526 1.1.1.2.2.2 bouyer
527 1.1.1.2.2.2 bouyer ACPI_STATUS
528 1.1.1.2.2.2 bouyer AcpiHwEnableAllWakeupGpes (
529 1.1.1.2.2.2 bouyer void)
530 1.1.1.2.2.2 bouyer {
531 1.1.1.2.2.2 bouyer ACPI_STATUS Status;
532 1.1.1.2.2.2 bouyer
533 1.1.1.2.2.2 bouyer
534 1.1.1.2.2.2 bouyer ACPI_FUNCTION_TRACE (HwEnableAllWakeupGpes);
535 1.1.1.2.2.2 bouyer
536 1.1.1.2.2.2 bouyer
537 1.1.1.2.2.2 bouyer Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock, NULL);
538 1.1.1.2.2.2 bouyer return_ACPI_STATUS (Status);
539 1.1.1.2.2.2 bouyer }
540 1.1.1.2.2.2 bouyer
541