Print this page
update to acpica-unix2-20140114
update to acpica-unix2-20130927
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/events/evxfevnt.c
+++ new/usr/src/common/acpica/components/events/evxfevnt.c
1 1 /******************************************************************************
2 2 *
3 3 * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
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
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
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
41 41 * POSSIBILITY OF SUCH DAMAGES.
42 42 */
43 43
44 44
45 45 #define __EVXFEVNT_C__
46 +#define EXPORT_ACPI_INTERFACES
46 47
47 48 #include "acpi.h"
48 49 #include "accommon.h"
49 50 #include "actables.h"
50 51
51 52 #define _COMPONENT ACPI_EVENTS
52 53 ACPI_MODULE_NAME ("evxfevnt")
53 54
54 55
56 +#if (!ACPI_REDUCED_HARDWARE) /* Entire module */
55 57 /*******************************************************************************
56 58 *
57 59 * FUNCTION: AcpiEnable
58 60 *
59 61 * PARAMETERS: None
60 62 *
61 63 * RETURN: Status
62 64 *
63 65 * DESCRIPTION: Transfers the system into ACPI mode.
64 66 *
65 67 ******************************************************************************/
66 68
67 69 ACPI_STATUS
68 70 AcpiEnable (
69 71 void)
70 72 {
71 73 ACPI_STATUS Status = AE_OK;
72 74
73 75
↓ open down ↓ |
9 lines elided |
↑ open up ↑ |
74 76 ACPI_FUNCTION_TRACE (AcpiEnable);
75 77
76 78
77 79 /* ACPI tables must be present */
78 80
79 81 if (!AcpiTbTablesLoaded ())
80 82 {
81 83 return_ACPI_STATUS (AE_NO_ACPI_TABLES);
82 84 }
83 85
86 + /* If the Hardware Reduced flag is set, machine is always in acpi mode */
87 +
88 + if (AcpiGbl_ReducedHardware)
89 + {
90 + return_ACPI_STATUS (AE_OK);
91 + }
92 +
84 93 /* Check current mode */
85 94
86 95 if (AcpiHwGetMode() == ACPI_SYS_MODE_ACPI)
87 96 {
88 97 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n"));
89 98 }
90 99 else
91 100 {
92 101 /* Transition to ACPI mode */
93 102
94 103 Status = AcpiHwSetMode (ACPI_SYS_MODE_ACPI);
95 104 if (ACPI_FAILURE (Status))
96 105 {
97 106 ACPI_ERROR ((AE_INFO, "Could not transition to ACPI mode"));
98 107 return_ACPI_STATUS (Status);
99 108 }
100 109
101 110 ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
102 111 "Transition to ACPI mode successful\n"));
103 112 }
104 113
105 114 return_ACPI_STATUS (Status);
106 115 }
107 116
108 117 ACPI_EXPORT_SYMBOL (AcpiEnable)
109 118
110 119
111 120 /*******************************************************************************
112 121 *
113 122 * FUNCTION: AcpiDisable
114 123 *
115 124 * PARAMETERS: None
116 125 *
117 126 * RETURN: Status
118 127 *
119 128 * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode.
120 129 *
121 130 ******************************************************************************/
122 131
↓ open down ↓ |
29 lines elided |
↑ open up ↑ |
123 132 ACPI_STATUS
124 133 AcpiDisable (
125 134 void)
126 135 {
127 136 ACPI_STATUS Status = AE_OK;
128 137
129 138
130 139 ACPI_FUNCTION_TRACE (AcpiDisable);
131 140
132 141
142 + /* If the Hardware Reduced flag is set, machine is always in acpi mode */
143 +
144 + if (AcpiGbl_ReducedHardware)
145 + {
146 + return_ACPI_STATUS (AE_OK);
147 + }
148 +
133 149 if (AcpiHwGetMode() == ACPI_SYS_MODE_LEGACY)
134 150 {
135 151 ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
136 152 "System is already in legacy (non-ACPI) mode\n"));
137 153 }
138 154 else
139 155 {
140 156 /* Transition to LEGACY mode */
141 157
142 158 Status = AcpiHwSetMode (ACPI_SYS_MODE_LEGACY);
143 159
144 160 if (ACPI_FAILURE (Status))
145 161 {
146 162 ACPI_ERROR ((AE_INFO,
147 163 "Could not exit ACPI mode to legacy mode"));
148 164 return_ACPI_STATUS (Status);
149 165 }
150 166
151 167 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI mode disabled\n"));
152 168 }
153 169
154 170 return_ACPI_STATUS (Status);
155 171 }
156 172
157 173 ACPI_EXPORT_SYMBOL (AcpiDisable)
158 174
159 175
160 176 /*******************************************************************************
161 177 *
162 178 * FUNCTION: AcpiEnableEvent
163 179 *
164 180 * PARAMETERS: Event - The fixed eventto be enabled
165 181 * Flags - Reserved
166 182 *
167 183 * RETURN: Status
168 184 *
169 185 * DESCRIPTION: Enable an ACPI event (fixed)
170 186 *
171 187 ******************************************************************************/
172 188
173 189 ACPI_STATUS
174 190 AcpiEnableEvent (
175 191 UINT32 Event,
176 192 UINT32 Flags)
177 193 {
178 194 ACPI_STATUS Status = AE_OK;
179 195 UINT32 Value;
180 196
181 197
182 198 ACPI_FUNCTION_TRACE (AcpiEnableEvent);
183 199
184 200
185 201 /* Decode the Fixed Event */
186 202
187 203 if (Event > ACPI_EVENT_MAX)
188 204 {
189 205 return_ACPI_STATUS (AE_BAD_PARAMETER);
190 206 }
191 207
192 208 /*
193 209 * Enable the requested fixed event (by writing a one to the enable
194 210 * register bit)
195 211 */
196 212 Status = AcpiWriteBitRegister (
197 213 AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
198 214 ACPI_ENABLE_EVENT);
199 215 if (ACPI_FAILURE (Status))
200 216 {
201 217 return_ACPI_STATUS (Status);
202 218 }
203 219
204 220 /* Make sure that the hardware responded */
205 221
206 222 Status = AcpiReadBitRegister (
207 223 AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value);
208 224 if (ACPI_FAILURE (Status))
209 225 {
210 226 return_ACPI_STATUS (Status);
211 227 }
212 228
213 229 if (Value != 1)
214 230 {
215 231 ACPI_ERROR ((AE_INFO,
216 232 "Could not enable %s event", AcpiUtGetEventName (Event)));
217 233 return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
218 234 }
219 235
220 236 return_ACPI_STATUS (Status);
221 237 }
222 238
223 239 ACPI_EXPORT_SYMBOL (AcpiEnableEvent)
224 240
225 241
226 242 /*******************************************************************************
227 243 *
228 244 * FUNCTION: AcpiDisableEvent
229 245 *
230 246 * PARAMETERS: Event - The fixed event to be disabled
231 247 * Flags - Reserved
232 248 *
233 249 * RETURN: Status
234 250 *
235 251 * DESCRIPTION: Disable an ACPI event (fixed)
236 252 *
237 253 ******************************************************************************/
238 254
239 255 ACPI_STATUS
240 256 AcpiDisableEvent (
241 257 UINT32 Event,
242 258 UINT32 Flags)
243 259 {
244 260 ACPI_STATUS Status = AE_OK;
245 261 UINT32 Value;
246 262
247 263
248 264 ACPI_FUNCTION_TRACE (AcpiDisableEvent);
249 265
250 266
251 267 /* Decode the Fixed Event */
252 268
253 269 if (Event > ACPI_EVENT_MAX)
254 270 {
255 271 return_ACPI_STATUS (AE_BAD_PARAMETER);
256 272 }
257 273
258 274 /*
259 275 * Disable the requested fixed event (by writing a zero to the enable
260 276 * register bit)
261 277 */
262 278 Status = AcpiWriteBitRegister (
263 279 AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
264 280 ACPI_DISABLE_EVENT);
265 281 if (ACPI_FAILURE (Status))
266 282 {
267 283 return_ACPI_STATUS (Status);
268 284 }
269 285
270 286 Status = AcpiReadBitRegister (
271 287 AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value);
272 288 if (ACPI_FAILURE (Status))
273 289 {
274 290 return_ACPI_STATUS (Status);
275 291 }
276 292
277 293 if (Value != 0)
278 294 {
279 295 ACPI_ERROR ((AE_INFO,
280 296 "Could not disable %s events", AcpiUtGetEventName (Event)));
281 297 return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
282 298 }
283 299
284 300 return_ACPI_STATUS (Status);
285 301 }
286 302
287 303 ACPI_EXPORT_SYMBOL (AcpiDisableEvent)
288 304
289 305
290 306 /*******************************************************************************
291 307 *
292 308 * FUNCTION: AcpiClearEvent
293 309 *
294 310 * PARAMETERS: Event - The fixed event to be cleared
295 311 *
296 312 * RETURN: Status
297 313 *
298 314 * DESCRIPTION: Clear an ACPI event (fixed)
299 315 *
300 316 ******************************************************************************/
301 317
302 318 ACPI_STATUS
303 319 AcpiClearEvent (
304 320 UINT32 Event)
305 321 {
306 322 ACPI_STATUS Status = AE_OK;
307 323
308 324
309 325 ACPI_FUNCTION_TRACE (AcpiClearEvent);
310 326
311 327
312 328 /* Decode the Fixed Event */
313 329
314 330 if (Event > ACPI_EVENT_MAX)
315 331 {
316 332 return_ACPI_STATUS (AE_BAD_PARAMETER);
317 333 }
318 334
319 335 /*
320 336 * Clear the requested fixed event (By writing a one to the status
321 337 * register bit)
322 338 */
323 339 Status = AcpiWriteBitRegister (
324 340 AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
325 341 ACPI_CLEAR_STATUS);
326 342
327 343 return_ACPI_STATUS (Status);
328 344 }
329 345
330 346 ACPI_EXPORT_SYMBOL (AcpiClearEvent)
331 347
332 348
333 349 /*******************************************************************************
334 350 *
335 351 * FUNCTION: AcpiGetEventStatus
336 352 *
337 353 * PARAMETERS: Event - The fixed event
338 354 * EventStatus - Where the current status of the event will
339 355 * be returned
340 356 *
341 357 * RETURN: Status
342 358 *
343 359 * DESCRIPTION: Obtains and returns the current status of the event
344 360 *
345 361 ******************************************************************************/
346 362
347 363 ACPI_STATUS
348 364 AcpiGetEventStatus (
349 365 UINT32 Event,
350 366 ACPI_EVENT_STATUS *EventStatus)
351 367 {
352 368 ACPI_STATUS Status = AE_OK;
353 369
354 370
355 371 ACPI_FUNCTION_TRACE (AcpiGetEventStatus);
356 372
357 373
358 374 if (!EventStatus)
359 375 {
360 376 return_ACPI_STATUS (AE_BAD_PARAMETER);
361 377 }
362 378
363 379 /* Decode the Fixed Event */
364 380
365 381 if (Event > ACPI_EVENT_MAX)
366 382 {
367 383 return_ACPI_STATUS (AE_BAD_PARAMETER);
368 384 }
369 385
↓ open down ↓ |
227 lines elided |
↑ open up ↑ |
370 386 /* Get the status of the requested fixed event */
371 387
372 388 Status = AcpiReadBitRegister (
373 389 AcpiGbl_FixedEventInfo[Event].StatusRegisterId, EventStatus);
374 390
375 391 return_ACPI_STATUS (Status);
376 392 }
377 393
378 394 ACPI_EXPORT_SYMBOL (AcpiGetEventStatus)
379 395
380 -
396 +#endif /* !ACPI_REDUCED_HARDWARE */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX