aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utxface.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities/utxface.c')
-rw-r--r--drivers/acpi/utilities/utxface.c278
1 files changed, 119 insertions, 159 deletions
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c
index e8803d810656..f06bd5e5e9d1 100644
--- a/drivers/acpi/utilities/utxface.c
+++ b/drivers/acpi/utilities/utxface.c
@@ -46,13 +46,10 @@
46#include <acpi/acpi.h> 46#include <acpi/acpi.h>
47#include <acpi/acevents.h> 47#include <acpi/acevents.h>
48#include <acpi/acnamesp.h> 48#include <acpi/acnamesp.h>
49#include <acpi/acparser.h>
50#include <acpi/acdispat.h>
51#include <acpi/acdebug.h> 49#include <acpi/acdebug.h>
52 50
53#define _COMPONENT ACPI_UTILITIES 51#define _COMPONENT ACPI_UTILITIES
54 ACPI_MODULE_NAME ("utxface") 52ACPI_MODULE_NAME("utxface")
55
56 53
57/******************************************************************************* 54/*******************************************************************************
58 * 55 *
@@ -66,61 +63,54 @@
66 * called, so any early initialization belongs here. 63 * called, so any early initialization belongs here.
67 * 64 *
68 ******************************************************************************/ 65 ******************************************************************************/
69 66acpi_status acpi_initialize_subsystem(void)
70acpi_status
71acpi_initialize_subsystem (
72 void)
73{ 67{
74 acpi_status status; 68 acpi_status status;
75 69
70 ACPI_FUNCTION_TRACE("acpi_initialize_subsystem");
76 71
77 ACPI_FUNCTION_TRACE ("acpi_initialize_subsystem"); 72 ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace());
78 73
74 /* Initialize the OS-Dependent layer */
79 75
80 ACPI_DEBUG_EXEC (acpi_ut_init_stack_ptr_trace ()); 76 status = acpi_os_initialize();
81 77 if (ACPI_FAILURE(status)) {
78 ACPI_REPORT_ERROR(("OSD failed to initialize, %s\n",
79 acpi_format_exception(status)));
80 return_ACPI_STATUS(status);
81 }
82 82
83 /* Initialize all globals used by the subsystem */ 83 /* Initialize all globals used by the subsystem */
84 84
85 acpi_ut_init_globals (); 85 acpi_ut_init_globals();
86
87 /* Initialize the OS-Dependent layer */
88
89 status = acpi_os_initialize ();
90 if (ACPI_FAILURE (status)) {
91 ACPI_REPORT_ERROR (("OSD failed to initialize, %s\n",
92 acpi_format_exception (status)));
93 return_ACPI_STATUS (status);
94 }
95 86
96 /* Create the default mutex objects */ 87 /* Create the default mutex objects */
97 88
98 status = acpi_ut_mutex_initialize (); 89 status = acpi_ut_mutex_initialize();
99 if (ACPI_FAILURE (status)) { 90 if (ACPI_FAILURE(status)) {
100 ACPI_REPORT_ERROR (("Global mutex creation failure, %s\n", 91 ACPI_REPORT_ERROR(("Global mutex creation failure, %s\n",
101 acpi_format_exception (status))); 92 acpi_format_exception(status)));
102 return_ACPI_STATUS (status); 93 return_ACPI_STATUS(status);
103 } 94 }
104 95
105 /* 96 /*
106 * Initialize the namespace manager and 97 * Initialize the namespace manager and
107 * the root of the namespace tree 98 * the root of the namespace tree
108 */ 99 */
109 status = acpi_ns_root_initialize (); 100 status = acpi_ns_root_initialize();
110 if (ACPI_FAILURE (status)) { 101 if (ACPI_FAILURE(status)) {
111 ACPI_REPORT_ERROR (("Namespace initialization failure, %s\n", 102 ACPI_REPORT_ERROR(("Namespace initialization failure, %s\n",
112 acpi_format_exception (status))); 103 acpi_format_exception(status)));
113 return_ACPI_STATUS (status); 104 return_ACPI_STATUS(status);
114 } 105 }
115 106
116 /* If configured, initialize the AML debugger */ 107 /* If configured, initialize the AML debugger */
117 108
118 ACPI_DEBUGGER_EXEC (status = acpi_db_initialize ()); 109 ACPI_DEBUGGER_EXEC(status = acpi_db_initialize());
119 110
120 return_ACPI_STATUS (status); 111 return_ACPI_STATUS(status);
121} 112}
122 113
123
124/******************************************************************************* 114/*******************************************************************************
125 * 115 *
126 * FUNCTION: acpi_enable_subsystem 116 * FUNCTION: acpi_enable_subsystem
@@ -134,41 +124,39 @@ acpi_initialize_subsystem (
134 * 124 *
135 ******************************************************************************/ 125 ******************************************************************************/
136 126
137acpi_status 127acpi_status acpi_enable_subsystem(u32 flags)
138acpi_enable_subsystem (
139 u32 flags)
140{ 128{
141 acpi_status status = AE_OK; 129 acpi_status status = AE_OK;
142
143
144 ACPI_FUNCTION_TRACE ("acpi_enable_subsystem");
145 130
131 ACPI_FUNCTION_TRACE("acpi_enable_subsystem");
146 132
147 /* 133 /*
148 * We must initialize the hardware before we can enable ACPI. 134 * We must initialize the hardware before we can enable ACPI.
149 * The values from the FADT are validated here. 135 * The values from the FADT are validated here.
150 */ 136 */
151 if (!(flags & ACPI_NO_HARDWARE_INIT)) { 137 if (!(flags & ACPI_NO_HARDWARE_INIT)) {
152 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 138 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
153 "[Init] Initializing ACPI hardware\n")); 139 "[Init] Initializing ACPI hardware\n"));
154 140
155 status = acpi_hw_initialize (); 141 status = acpi_hw_initialize();
156 if (ACPI_FAILURE (status)) { 142 if (ACPI_FAILURE(status)) {
157 return_ACPI_STATUS (status); 143 return_ACPI_STATUS(status);
158 } 144 }
159 } 145 }
160 146
161 /* Enable ACPI mode */ 147 /* Enable ACPI mode */
162 148
163 if (!(flags & ACPI_NO_ACPI_ENABLE)) { 149 if (!(flags & ACPI_NO_ACPI_ENABLE)) {
164 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n")); 150 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
151 "[Init] Going into ACPI mode\n"));
165 152
166 acpi_gbl_original_mode = acpi_hw_get_mode(); 153 acpi_gbl_original_mode = acpi_hw_get_mode();
167 154
168 status = acpi_enable (); 155 status = acpi_enable();
169 if (ACPI_FAILURE (status)) { 156 if (ACPI_FAILURE(status)) {
170 ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "acpi_enable failed.\n")); 157 ACPI_DEBUG_PRINT((ACPI_DB_WARN,
171 return_ACPI_STATUS (status); 158 "acpi_enable failed.\n"));
159 return_ACPI_STATUS(status);
172 } 160 }
173 } 161 }
174 162
@@ -178,12 +166,12 @@ acpi_enable_subsystem (
178 * install_address_space_handler interface. 166 * install_address_space_handler interface.
179 */ 167 */
180 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { 168 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
181 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 169 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
182 "[Init] Installing default address space handlers\n")); 170 "[Init] Installing default address space handlers\n"));
183 171
184 status = acpi_ev_install_region_handlers (); 172 status = acpi_ev_install_region_handlers();
185 if (ACPI_FAILURE (status)) { 173 if (ACPI_FAILURE(status)) {
186 return_ACPI_STATUS (status); 174 return_ACPI_STATUS(status);
187 } 175 }
188 } 176 }
189 177
@@ -196,28 +184,28 @@ acpi_enable_subsystem (
196 * execution! 184 * execution!
197 */ 185 */
198 if (!(flags & ACPI_NO_EVENT_INIT)) { 186 if (!(flags & ACPI_NO_EVENT_INIT)) {
199 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 187 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
200 "[Init] Initializing ACPI events\n")); 188 "[Init] Initializing ACPI events\n"));
201 189
202 status = acpi_ev_initialize_events (); 190 status = acpi_ev_initialize_events();
203 if (ACPI_FAILURE (status)) { 191 if (ACPI_FAILURE(status)) {
204 return_ACPI_STATUS (status); 192 return_ACPI_STATUS(status);
205 } 193 }
206 } 194 }
207 195
208 /* Install the SCI handler and Global Lock handler */ 196 /* Install the SCI handler and Global Lock handler */
209 197
210 if (!(flags & ACPI_NO_HANDLER_INIT)) { 198 if (!(flags & ACPI_NO_HANDLER_INIT)) {
211 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 199 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
212 "[Init] Installing SCI/GL handlers\n")); 200 "[Init] Installing SCI/GL handlers\n"));
213 201
214 status = acpi_ev_install_xrupt_handlers (); 202 status = acpi_ev_install_xrupt_handlers();
215 if (ACPI_FAILURE (status)) { 203 if (ACPI_FAILURE(status)) {
216 return_ACPI_STATUS (status); 204 return_ACPI_STATUS(status);
217 } 205 }
218 } 206 }
219 207
220 return_ACPI_STATUS (status); 208 return_ACPI_STATUS(status);
221} 209}
222 210
223/******************************************************************************* 211/*******************************************************************************
@@ -233,15 +221,11 @@ acpi_enable_subsystem (
233 * 221 *
234 ******************************************************************************/ 222 ******************************************************************************/
235 223
236acpi_status 224acpi_status acpi_initialize_objects(u32 flags)
237acpi_initialize_objects (
238 u32 flags)
239{ 225{
240 acpi_status status = AE_OK; 226 acpi_status status = AE_OK;
241
242
243 ACPI_FUNCTION_TRACE ("acpi_initialize_objects");
244 227
228 ACPI_FUNCTION_TRACE("acpi_initialize_objects");
245 229
246 /* 230 /*
247 * Run all _REG methods 231 * Run all _REG methods
@@ -251,12 +235,12 @@ acpi_initialize_objects (
251 * contain executable AML (see call to acpi_ns_initialize_objects below). 235 * contain executable AML (see call to acpi_ns_initialize_objects below).
252 */ 236 */
253 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { 237 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
254 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 238 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
255 "[Init] Executing _REG op_region methods\n")); 239 "[Init] Executing _REG op_region methods\n"));
256 240
257 status = acpi_ev_initialize_op_regions (); 241 status = acpi_ev_initialize_op_regions();
258 if (ACPI_FAILURE (status)) { 242 if (ACPI_FAILURE(status)) {
259 return_ACPI_STATUS (status); 243 return_ACPI_STATUS(status);
260 } 244 }
261 } 245 }
262 246
@@ -266,12 +250,12 @@ acpi_initialize_objects (
266 * objects: operation_regions, buffer_fields, Buffers, and Packages. 250 * objects: operation_regions, buffer_fields, Buffers, and Packages.
267 */ 251 */
268 if (!(flags & ACPI_NO_OBJECT_INIT)) { 252 if (!(flags & ACPI_NO_OBJECT_INIT)) {
269 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 253 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
270 "[Init] Completing Initialization of ACPI Objects\n")); 254 "[Init] Completing Initialization of ACPI Objects\n"));
271 255
272 status = acpi_ns_initialize_objects (); 256 status = acpi_ns_initialize_objects();
273 if (ACPI_FAILURE (status)) { 257 if (ACPI_FAILURE(status)) {
274 return_ACPI_STATUS (status); 258 return_ACPI_STATUS(status);
275 } 259 }
276 } 260 }
277 261
@@ -280,12 +264,12 @@ acpi_initialize_objects (
280 * This runs the _STA and _INI methods. 264 * This runs the _STA and _INI methods.
281 */ 265 */
282 if (!(flags & ACPI_NO_DEVICE_INIT)) { 266 if (!(flags & ACPI_NO_DEVICE_INIT)) {
283 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 267 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
284 "[Init] Initializing ACPI Devices\n")); 268 "[Init] Initializing ACPI Devices\n"));
285 269
286 status = acpi_ns_initialize_devices (); 270 status = acpi_ns_initialize_devices();
287 if (ACPI_FAILURE (status)) { 271 if (ACPI_FAILURE(status)) {
288 return_ACPI_STATUS (status); 272 return_ACPI_STATUS(status);
289 } 273 }
290 } 274 }
291 275
@@ -294,13 +278,12 @@ acpi_initialize_objects (
294 * the table load filled them up more than they will be at runtime -- 278 * the table load filled them up more than they will be at runtime --
295 * thus wasting non-paged memory. 279 * thus wasting non-paged memory.
296 */ 280 */
297 status = acpi_purge_cached_objects (); 281 status = acpi_purge_cached_objects();
298 282
299 acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK; 283 acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK;
300 return_ACPI_STATUS (status); 284 return_ACPI_STATUS(status);
301} 285}
302 286
303
304/******************************************************************************* 287/*******************************************************************************
305 * 288 *
306 * FUNCTION: acpi_terminate 289 * FUNCTION: acpi_terminate
@@ -313,15 +296,11 @@ acpi_initialize_objects (
313 * 296 *
314 ******************************************************************************/ 297 ******************************************************************************/
315 298
316acpi_status 299acpi_status acpi_terminate(void)
317acpi_terminate (
318 void)
319{ 300{
320 acpi_status status; 301 acpi_status status;
321
322
323 ACPI_FUNCTION_TRACE ("acpi_terminate");
324 302
303 ACPI_FUNCTION_TRACE("acpi_terminate");
325 304
326 /* Terminate the AML Debugger if present */ 305 /* Terminate the AML Debugger if present */
327 306
@@ -329,28 +308,25 @@ acpi_terminate (
329 308
330 /* Shutdown and free all resources */ 309 /* Shutdown and free all resources */
331 310
332 acpi_ut_subsystem_shutdown (); 311 acpi_ut_subsystem_shutdown();
333
334 312
335 /* Free the mutex objects */ 313 /* Free the mutex objects */
336 314
337 acpi_ut_mutex_terminate (); 315 acpi_ut_mutex_terminate();
338
339 316
340#ifdef ACPI_DEBUGGER 317#ifdef ACPI_DEBUGGER
341 318
342 /* Shut down the debugger */ 319 /* Shut down the debugger */
343 320
344 acpi_db_terminate (); 321 acpi_db_terminate();
345#endif 322#endif
346 323
347 /* Now we can shutdown the OS-dependent layer */ 324 /* Now we can shutdown the OS-dependent layer */
348 325
349 status = acpi_os_terminate (); 326 status = acpi_os_terminate();
350 return_ACPI_STATUS (status); 327 return_ACPI_STATUS(status);
351} 328}
352 329
353
354#ifdef ACPI_FUTURE_USAGE 330#ifdef ACPI_FUTURE_USAGE
355/******************************************************************************* 331/*******************************************************************************
356 * 332 *
@@ -366,20 +342,16 @@ acpi_terminate (
366 * 342 *
367 ******************************************************************************/ 343 ******************************************************************************/
368 344
369acpi_status 345acpi_status acpi_subsystem_status(void)
370acpi_subsystem_status (
371 void)
372{ 346{
373 347
374 if (acpi_gbl_startup_flags & ACPI_INITIALIZED_OK) { 348 if (acpi_gbl_startup_flags & ACPI_INITIALIZED_OK) {
375 return (AE_OK); 349 return (AE_OK);
376 } 350 } else {
377 else {
378 return (AE_ERROR); 351 return (AE_ERROR);
379 } 352 }
380} 353}
381 354
382
383/******************************************************************************* 355/*******************************************************************************
384 * 356 *
385 * FUNCTION: acpi_get_system_info 357 * FUNCTION: acpi_get_system_info
@@ -398,64 +370,60 @@ acpi_subsystem_status (
398 * 370 *
399 ******************************************************************************/ 371 ******************************************************************************/
400 372
401acpi_status 373acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
402acpi_get_system_info (
403 struct acpi_buffer *out_buffer)
404{ 374{
405 struct acpi_system_info *info_ptr; 375 struct acpi_system_info *info_ptr;
406 acpi_status status; 376 acpi_status status;
407 u32 i; 377 u32 i;
408
409
410 ACPI_FUNCTION_TRACE ("acpi_get_system_info");
411 378
379 ACPI_FUNCTION_TRACE("acpi_get_system_info");
412 380
413 /* Parameter validation */ 381 /* Parameter validation */
414 382
415 status = acpi_ut_validate_buffer (out_buffer); 383 status = acpi_ut_validate_buffer(out_buffer);
416 if (ACPI_FAILURE (status)) { 384 if (ACPI_FAILURE(status)) {
417 return_ACPI_STATUS (status); 385 return_ACPI_STATUS(status);
418 } 386 }
419 387
420 /* Validate/Allocate/Clear caller buffer */ 388 /* Validate/Allocate/Clear caller buffer */
421 389
422 status = acpi_ut_initialize_buffer (out_buffer, sizeof (struct acpi_system_info)); 390 status =
423 if (ACPI_FAILURE (status)) { 391 acpi_ut_initialize_buffer(out_buffer,
424 return_ACPI_STATUS (status); 392 sizeof(struct acpi_system_info));
393 if (ACPI_FAILURE(status)) {
394 return_ACPI_STATUS(status);
425 } 395 }
426 396
427 /* 397 /*
428 * Populate the return buffer 398 * Populate the return buffer
429 */ 399 */
430 info_ptr = (struct acpi_system_info *) out_buffer->pointer; 400 info_ptr = (struct acpi_system_info *)out_buffer->pointer;
431 401
432 info_ptr->acpi_ca_version = ACPI_CA_VERSION; 402 info_ptr->acpi_ca_version = ACPI_CA_VERSION;
433 403
434 /* System flags (ACPI capabilities) */ 404 /* System flags (ACPI capabilities) */
435 405
436 info_ptr->flags = ACPI_SYS_MODE_ACPI; 406 info_ptr->flags = ACPI_SYS_MODE_ACPI;
437 407
438 /* Timer resolution - 24 or 32 bits */ 408 /* Timer resolution - 24 or 32 bits */
439 409
440 if (!acpi_gbl_FADT) { 410 if (!acpi_gbl_FADT) {
441 info_ptr->timer_resolution = 0; 411 info_ptr->timer_resolution = 0;
442 } 412 } else if (acpi_gbl_FADT->tmr_val_ext == 0) {
443 else if (acpi_gbl_FADT->tmr_val_ext == 0) {
444 info_ptr->timer_resolution = 24; 413 info_ptr->timer_resolution = 24;
445 } 414 } else {
446 else {
447 info_ptr->timer_resolution = 32; 415 info_ptr->timer_resolution = 32;
448 } 416 }
449 417
450 /* Clear the reserved fields */ 418 /* Clear the reserved fields */
451 419
452 info_ptr->reserved1 = 0; 420 info_ptr->reserved1 = 0;
453 info_ptr->reserved2 = 0; 421 info_ptr->reserved2 = 0;
454 422
455 /* Current debug levels */ 423 /* Current debug levels */
456 424
457 info_ptr->debug_layer = acpi_dbg_layer; 425 info_ptr->debug_layer = acpi_dbg_layer;
458 info_ptr->debug_level = acpi_dbg_level; 426 info_ptr->debug_level = acpi_dbg_level;
459 427
460 /* Current status of the ACPI tables, per table type */ 428 /* Current status of the ACPI tables, per table type */
461 429
@@ -464,10 +432,10 @@ acpi_get_system_info (
464 info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count; 432 info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count;
465 } 433 }
466 434
467 return_ACPI_STATUS (AE_OK); 435 return_ACPI_STATUS(AE_OK);
468} 436}
469EXPORT_SYMBOL(acpi_get_system_info);
470 437
438EXPORT_SYMBOL(acpi_get_system_info);
471 439
472/***************************************************************************** 440/*****************************************************************************
473 * 441 *
@@ -485,9 +453,7 @@ EXPORT_SYMBOL(acpi_get_system_info);
485 ****************************************************************************/ 453 ****************************************************************************/
486 454
487acpi_status 455acpi_status
488acpi_install_initialization_handler ( 456acpi_install_initialization_handler(acpi_init_handler handler, u32 function)
489 acpi_init_handler handler,
490 u32 function)
491{ 457{
492 458
493 if (!handler) { 459 if (!handler) {
@@ -502,7 +468,7 @@ acpi_install_initialization_handler (
502 return AE_OK; 468 return AE_OK;
503} 469}
504 470
505#endif /* ACPI_FUTURE_USAGE */ 471#endif /* ACPI_FUTURE_USAGE */
506 472
507/***************************************************************************** 473/*****************************************************************************
508 * 474 *
@@ -516,19 +482,13 @@ acpi_install_initialization_handler (
516 * 482 *
517 ****************************************************************************/ 483 ****************************************************************************/
518 484
519acpi_status 485acpi_status acpi_purge_cached_objects(void)
520acpi_purge_cached_objects (
521 void)
522{ 486{
523 ACPI_FUNCTION_TRACE ("acpi_purge_cached_objects"); 487 ACPI_FUNCTION_TRACE("acpi_purge_cached_objects");
524
525
526#ifdef ACPI_ENABLE_OBJECT_CACHE
527 acpi_ut_delete_generic_state_cache ();
528 acpi_ut_delete_object_cache ();
529 acpi_ds_delete_walk_state_cache ();
530 acpi_ps_delete_parse_cache ();
531#endif
532 488
533 return_ACPI_STATUS (AE_OK); 489 (void)acpi_os_purge_cache(acpi_gbl_state_cache);
490 (void)acpi_os_purge_cache(acpi_gbl_operand_cache);
491 (void)acpi_os_purge_cache(acpi_gbl_ps_node_cache);
492 (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache);
493 return_ACPI_STATUS(AE_OK);
534} 494}