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