Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/events/evevent.c
+++ new/usr/src/common/acpica/components/events/evevent.c
1 1 /******************************************************************************
2 2 *
3 3 * Module Name: evevent - Fixed Event handling and dispatch
4 4 *
5 5 *****************************************************************************/
6 6
7 7 /*
8 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2014, Intel Corp.
9 9 * All rights reserved.
10 10 *
11 11 * Redistribution and use in source and binary forms, with or without
12 12 * modification, are permitted provided that the following conditions
13 13 * are met:
14 14 * 1. Redistributions of source code must retain the above copyright
15 15 * notice, this list of conditions, and the following disclaimer,
16 16 * without modification.
17 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 18 * substantially similar to the "NO WARRANTY" disclaimer below
19 19 * ("Disclaimer") and any redistribution must be conditioned upon
20 20 * including a substantially similar Disclaimer requirement for further
21 21 * binary redistribution.
22 22 * 3. Neither the names of the above-listed copyright holders nor the names
23 23 * of any contributors may be used to endorse or promote products derived
24 24 * from this software without specific prior written permission.
25 25 *
26 26 * Alternatively, this software may be distributed under the terms of the
27 27 * GNU General Public License ("GPL") version 2 as published by the Free
28 28 * Software Foundation.
29 29 *
30 30 * NO WARRANTY
31 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
↓ open down ↓ |
22 lines elided |
↑ open up ↑ |
41 41 * POSSIBILITY OF SUCH DAMAGES.
42 42 */
43 43
44 44 #include "acpi.h"
45 45 #include "accommon.h"
46 46 #include "acevents.h"
47 47
48 48 #define _COMPONENT ACPI_EVENTS
49 49 ACPI_MODULE_NAME ("evevent")
50 50
51 +#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
52 +
51 53 /* Local prototypes */
52 54
53 55 static ACPI_STATUS
54 56 AcpiEvFixedEventInitialize (
55 57 void);
56 58
57 59 static UINT32
58 60 AcpiEvFixedEventDispatch (
59 61 UINT32 Event);
60 62
61 63
62 64 /*******************************************************************************
63 65 *
64 66 * FUNCTION: AcpiEvInitializeEvents
65 67 *
66 68 * PARAMETERS: None
67 69 *
68 70 * RETURN: Status
69 71 *
70 72 * DESCRIPTION: Initialize global data structures for ACPI events (Fixed, GPE)
71 73 *
72 74 ******************************************************************************/
73 75
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
74 76 ACPI_STATUS
75 77 AcpiEvInitializeEvents (
76 78 void)
77 79 {
78 80 ACPI_STATUS Status;
79 81
80 82
81 83 ACPI_FUNCTION_TRACE (EvInitializeEvents);
82 84
83 85
86 + /* If Hardware Reduced flag is set, there are no fixed events */
87 +
88 + if (AcpiGbl_ReducedHardware)
89 + {
90 + return_ACPI_STATUS (AE_OK);
91 + }
92 +
84 93 /*
85 94 * Initialize the Fixed and General Purpose Events. This is done prior to
86 95 * enabling SCIs to prevent interrupts from occurring before the handlers
87 96 * are installed.
88 97 */
89 98 Status = AcpiEvFixedEventInitialize ();
90 99 if (ACPI_FAILURE (Status))
91 100 {
92 101 ACPI_EXCEPTION ((AE_INFO, Status,
93 102 "Unable to initialize fixed events"));
94 103 return_ACPI_STATUS (Status);
95 104 }
96 105
97 106 Status = AcpiEvGpeInitialize ();
98 107 if (ACPI_FAILURE (Status))
99 108 {
100 109 ACPI_EXCEPTION ((AE_INFO, Status,
101 110 "Unable to initialize general purpose events"));
102 111 return_ACPI_STATUS (Status);
103 112 }
104 113
105 114 return_ACPI_STATUS (Status);
106 115 }
107 116
108 117
109 118 /*******************************************************************************
110 119 *
111 120 * FUNCTION: AcpiEvInstallXruptHandlers
112 121 *
113 122 * PARAMETERS: None
114 123 *
115 124 * RETURN: Status
116 125 *
117 126 * DESCRIPTION: Install interrupt handlers for the SCI and Global Lock
118 127 *
119 128 ******************************************************************************/
120 129
↓ open down ↓ |
27 lines elided |
↑ open up ↑ |
121 130 ACPI_STATUS
122 131 AcpiEvInstallXruptHandlers (
123 132 void)
124 133 {
125 134 ACPI_STATUS Status;
126 135
127 136
128 137 ACPI_FUNCTION_TRACE (EvInstallXruptHandlers);
129 138
130 139
140 + /* If Hardware Reduced flag is set, there is no ACPI h/w */
141 +
142 + if (AcpiGbl_ReducedHardware)
143 + {
144 + return_ACPI_STATUS (AE_OK);
145 + }
146 +
131 147 /* Install the SCI handler */
132 148
133 149 Status = AcpiEvInstallSciHandler ();
134 150 if (ACPI_FAILURE (Status))
135 151 {
136 152 ACPI_EXCEPTION ((AE_INFO, Status,
137 153 "Unable to install System Control Interrupt handler"));
138 154 return_ACPI_STATUS (Status);
139 155 }
140 156
141 157 /* Install the handler for the Global Lock */
142 158
143 159 Status = AcpiEvInitGlobalLockHandler ();
144 160 if (ACPI_FAILURE (Status))
145 161 {
146 162 ACPI_EXCEPTION ((AE_INFO, Status,
147 163 "Unable to initialize Global Lock handler"));
148 164 return_ACPI_STATUS (Status);
149 165 }
150 166
151 167 AcpiGbl_EventsInitialized = TRUE;
152 168 return_ACPI_STATUS (Status);
153 169 }
154 170
155 171
156 172 /*******************************************************************************
157 173 *
158 174 * FUNCTION: AcpiEvFixedEventInitialize
159 175 *
160 176 * PARAMETERS: None
161 177 *
162 178 * RETURN: Status
163 179 *
164 180 * DESCRIPTION: Install the fixed event handlers and disable all fixed events.
165 181 *
166 182 ******************************************************************************/
167 183
168 184 static ACPI_STATUS
169 185 AcpiEvFixedEventInitialize (
170 186 void)
171 187 {
172 188 UINT32 i;
173 189 ACPI_STATUS Status;
174 190
175 191
176 192 /*
177 193 * Initialize the structure that keeps track of fixed event handlers and
178 194 * enable the fixed events.
179 195 */
180 196 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
181 197 {
182 198 AcpiGbl_FixedEventHandlers[i].Handler = NULL;
183 199 AcpiGbl_FixedEventHandlers[i].Context = NULL;
184 200
185 201 /* Disable the fixed event */
186 202
187 203 if (AcpiGbl_FixedEventInfo[i].EnableRegisterId != 0xFF)
188 204 {
189 205 Status = AcpiWriteBitRegister (
190 206 AcpiGbl_FixedEventInfo[i].EnableRegisterId,
191 207 ACPI_DISABLE_EVENT);
192 208 if (ACPI_FAILURE (Status))
193 209 {
194 210 return (Status);
195 211 }
196 212 }
197 213 }
198 214
199 215 return (AE_OK);
200 216 }
201 217
202 218
203 219 /*******************************************************************************
204 220 *
205 221 * FUNCTION: AcpiEvFixedEventDetect
206 222 *
207 223 * PARAMETERS: None
208 224 *
209 225 * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
210 226 *
211 227 * DESCRIPTION: Checks the PM status register for active fixed events
212 228 *
213 229 ******************************************************************************/
214 230
215 231 UINT32
216 232 AcpiEvFixedEventDetect (
217 233 void)
218 234 {
219 235 UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
220 236 UINT32 FixedStatus;
221 237 UINT32 FixedEnable;
222 238 UINT32 i;
223 239
224 240
225 241 ACPI_FUNCTION_NAME (EvFixedEventDetect);
226 242
227 243
228 244 /*
229 245 * Read the fixed feature status and enable registers, as all the cases
230 246 * depend on their values. Ignore errors here.
231 247 */
232 248 (void) AcpiHwRegisterRead (ACPI_REGISTER_PM1_STATUS, &FixedStatus);
233 249 (void) AcpiHwRegisterRead (ACPI_REGISTER_PM1_ENABLE, &FixedEnable);
234 250
235 251 ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
236 252 "Fixed Event Block: Enable %08X Status %08X\n",
237 253 FixedEnable, FixedStatus));
238 254
239 255 /*
240 256 * Check for all possible Fixed Events and dispatch those that are active
241 257 */
242 258 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
243 259 {
244 260 /* Both the status and enable bits must be on for this event */
245 261
246 262 if ((FixedStatus & AcpiGbl_FixedEventInfo[i].StatusBitMask) &&
247 263 (FixedEnable & AcpiGbl_FixedEventInfo[i].EnableBitMask))
248 264 {
249 265 /*
250 266 * Found an active (signalled) event. Invoke global event
251 267 * handler if present.
252 268 */
253 269 AcpiFixedEventCount[i]++;
254 270 if (AcpiGbl_GlobalEventHandler)
255 271 {
256 272 AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_FIXED, NULL,
257 273 i, AcpiGbl_GlobalEventHandlerContext);
258 274 }
259 275
260 276 IntStatus |= AcpiEvFixedEventDispatch (i);
261 277 }
262 278 }
263 279
264 280 return (IntStatus);
265 281 }
266 282
267 283
↓ open down ↓ |
127 lines elided |
↑ open up ↑ |
268 284 /*******************************************************************************
269 285 *
270 286 * FUNCTION: AcpiEvFixedEventDispatch
271 287 *
272 288 * PARAMETERS: Event - Event type
273 289 *
274 290 * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
275 291 *
276 292 * DESCRIPTION: Clears the status bit for the requested event, calls the
277 293 * handler that previously registered for the event.
294 + * NOTE: If there is no handler for the event, the event is
295 + * disabled to prevent further interrupts.
278 296 *
279 297 ******************************************************************************/
280 298
281 299 static UINT32
282 300 AcpiEvFixedEventDispatch (
283 301 UINT32 Event)
284 302 {
285 303
286 304 ACPI_FUNCTION_ENTRY ();
287 305
288 306
289 307 /* Clear the status bit */
290 308
291 309 (void) AcpiWriteBitRegister (
292 310 AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
293 311 ACPI_CLEAR_STATUS);
294 312
295 313 /*
296 - * Make sure we've got a handler. If not, report an error. The event is
297 - * disabled to prevent further interrupts.
314 + * Make sure that a handler exists. If not, report an error
315 + * and disable the event to prevent further interrupts.
298 316 */
299 - if (NULL == AcpiGbl_FixedEventHandlers[Event].Handler)
317 + if (!AcpiGbl_FixedEventHandlers[Event].Handler)
300 318 {
301 319 (void) AcpiWriteBitRegister (
302 320 AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
303 321 ACPI_DISABLE_EVENT);
304 322
305 323 ACPI_ERROR ((AE_INFO,
306 - "No installed handler for fixed event [0x%08X]",
307 - Event));
324 + "No installed handler for fixed event - %s (%u), disabling",
325 + AcpiUtGetEventName (Event), Event));
308 326
309 327 return (ACPI_INTERRUPT_NOT_HANDLED);
310 328 }
311 329
312 330 /* Invoke the Fixed Event handler */
313 331
314 332 return ((AcpiGbl_FixedEventHandlers[Event].Handler)(
315 333 AcpiGbl_FixedEventHandlers[Event].Context));
316 334 }
317 335
318 -
336 +#endif /* !ACPI_REDUCED_HARDWARE */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX