aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2007-10-10 01:00:45 -0400
committerLen Brown <len.brown@intel.com>2007-10-10 01:00:45 -0400
commit00a2b433557f10736e8a02de619b3e9052556c12 (patch)
treedec892a10006763f7b7c3818a0099bb7730793da /drivers
parentde85871a9a53c00cae4c3a70849b5eaad0eb38b2 (diff)
parent2d571b33cf7efd6a894e765e3cb45587ec5b834a (diff)
Pull acpica into test branch
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/events/evevent.c6
-rw-r--r--drivers/acpi/hardware/hwregs.c89
-rw-r--r--drivers/acpi/hardware/hwsleep.c30
3 files changed, 48 insertions, 77 deletions
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c
index a1f87b5def2..e41287815ea 100644
--- a/drivers/acpi/events/evevent.c
+++ b/drivers/acpi/events/evevent.c
@@ -239,10 +239,8 @@ u32 acpi_ev_fixed_event_detect(void)
239 * Read the fixed feature status and enable registers, as all the cases 239 * Read the fixed feature status and enable registers, as all the cases
240 * depend on their values. Ignore errors here. 240 * depend on their values. Ignore errors here.
241 */ 241 */
242 (void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, 242 (void)acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, &fixed_status);
243 ACPI_REGISTER_PM1_STATUS, &fixed_status); 243 (void)acpi_hw_register_read(ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
244 (void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
245 ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
246 244
247 ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, 245 ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
248 "Fixed Event Block: Enable %08X Status %08X\n", 246 "Fixed Event Block: Enable %08X Status %08X\n",
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c
index 1d371fa663f..73f9c5fb1ba 100644
--- a/drivers/acpi/hardware/hwregs.c
+++ b/drivers/acpi/hardware/hwregs.c
@@ -75,8 +75,7 @@ acpi_status acpi_hw_clear_acpi_status(void)
75 75
76 lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); 76 lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
77 77
78 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 78 status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS,
79 ACPI_REGISTER_PM1_STATUS,
80 ACPI_BITMASK_ALL_FIXED_STATUS); 79 ACPI_BITMASK_ALL_FIXED_STATUS);
81 if (ACPI_FAILURE(status)) { 80 if (ACPI_FAILURE(status)) {
82 goto unlock_and_exit; 81 goto unlock_and_exit;
@@ -259,7 +258,7 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
259 * 258 *
260 ******************************************************************************/ 259 ******************************************************************************/
261 260
262acpi_status acpi_get_register(u32 register_id, u32 * return_value) 261acpi_status acpi_get_register_unlocked(u32 register_id, u32 * return_value)
263{ 262{
264 u32 register_value = 0; 263 u32 register_value = 0;
265 struct acpi_bit_register_info *bit_reg_info; 264 struct acpi_bit_register_info *bit_reg_info;
@@ -276,8 +275,7 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value)
276 275
277 /* Read from the register */ 276 /* Read from the register */
278 277
279 status = acpi_hw_register_read(ACPI_MTX_LOCK, 278 status = acpi_hw_register_read(bit_reg_info->parent_register,
280 bit_reg_info->parent_register,
281 &register_value); 279 &register_value);
282 280
283 if (ACPI_SUCCESS(status)) { 281 if (ACPI_SUCCESS(status)) {
@@ -298,6 +296,16 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value)
298 return_ACPI_STATUS(status); 296 return_ACPI_STATUS(status);
299} 297}
300 298
299acpi_status acpi_get_register(u32 register_id, u32 * return_value)
300{
301 acpi_status status;
302 acpi_cpu_flags flags;
303 flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
304 status = acpi_get_register_unlocked(register_id, return_value);
305 acpi_os_release_lock(acpi_gbl_hardware_lock, flags);
306 return status;
307}
308
301ACPI_EXPORT_SYMBOL(acpi_get_register) 309ACPI_EXPORT_SYMBOL(acpi_get_register)
302 310
303/******************************************************************************* 311/*******************************************************************************
@@ -335,8 +343,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value)
335 343
336 /* Always do a register read first so we can insert the new bits */ 344 /* Always do a register read first so we can insert the new bits */
337 345
338 status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, 346 status = acpi_hw_register_read(bit_reg_info->parent_register,
339 bit_reg_info->parent_register,
340 &register_value); 347 &register_value);
341 if (ACPI_FAILURE(status)) { 348 if (ACPI_FAILURE(status)) {
342 goto unlock_and_exit; 349 goto unlock_and_exit;
@@ -363,8 +370,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value)
363 bit_reg_info-> 370 bit_reg_info->
364 access_bit_mask); 371 access_bit_mask);
365 if (value) { 372 if (value) {
366 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 373 status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS,
367 ACPI_REGISTER_PM1_STATUS,
368 (u16) value); 374 (u16) value);
369 register_value = 0; 375 register_value = 0;
370 } 376 }
@@ -377,8 +383,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value)
377 bit_reg_info->access_bit_mask, 383 bit_reg_info->access_bit_mask,
378 value); 384 value);
379 385
380 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 386 status = acpi_hw_register_write(ACPI_REGISTER_PM1_ENABLE,
381 ACPI_REGISTER_PM1_ENABLE,
382 (u16) register_value); 387 (u16) register_value);
383 break; 388 break;
384 389
@@ -397,15 +402,13 @@ acpi_status acpi_set_register(u32 register_id, u32 value)
397 bit_reg_info->access_bit_mask, 402 bit_reg_info->access_bit_mask,
398 value); 403 value);
399 404
400 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 405 status = acpi_hw_register_write(ACPI_REGISTER_PM1_CONTROL,
401 ACPI_REGISTER_PM1_CONTROL,
402 (u16) register_value); 406 (u16) register_value);
403 break; 407 break;
404 408
405 case ACPI_REGISTER_PM2_CONTROL: 409 case ACPI_REGISTER_PM2_CONTROL:
406 410
407 status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, 411 status = acpi_hw_register_read(ACPI_REGISTER_PM2_CONTROL,
408 ACPI_REGISTER_PM2_CONTROL,
409 &register_value); 412 &register_value);
410 if (ACPI_FAILURE(status)) { 413 if (ACPI_FAILURE(status)) {
411 goto unlock_and_exit; 414 goto unlock_and_exit;
@@ -430,8 +433,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value)
430 xpm2_control_block. 433 xpm2_control_block.
431 address))); 434 address)));
432 435
433 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 436 status = acpi_hw_register_write(ACPI_REGISTER_PM2_CONTROL,
434 ACPI_REGISTER_PM2_CONTROL,
435 (u8) (register_value)); 437 (u8) (register_value));
436 break; 438 break;
437 439
@@ -461,8 +463,7 @@ ACPI_EXPORT_SYMBOL(acpi_set_register)
461 * 463 *
462 * FUNCTION: acpi_hw_register_read 464 * FUNCTION: acpi_hw_register_read
463 * 465 *
464 * PARAMETERS: use_lock - Lock hardware? True/False 466 * PARAMETERS: register_id - ACPI Register ID
465 * register_id - ACPI Register ID
466 * return_value - Where the register value is returned 467 * return_value - Where the register value is returned
467 * 468 *
468 * RETURN: Status and the value read. 469 * RETURN: Status and the value read.
@@ -471,19 +472,14 @@ ACPI_EXPORT_SYMBOL(acpi_set_register)
471 * 472 *
472 ******************************************************************************/ 473 ******************************************************************************/
473acpi_status 474acpi_status
474acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) 475acpi_hw_register_read(u32 register_id, u32 * return_value)
475{ 476{
476 u32 value1 = 0; 477 u32 value1 = 0;
477 u32 value2 = 0; 478 u32 value2 = 0;
478 acpi_status status; 479 acpi_status status;
479 acpi_cpu_flags lock_flags = 0;
480 480
481 ACPI_FUNCTION_TRACE(hw_register_read); 481 ACPI_FUNCTION_TRACE(hw_register_read);
482 482
483 if (ACPI_MTX_LOCK == use_lock) {
484 lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
485 }
486
487 switch (register_id) { 483 switch (register_id) {
488 case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ 484 case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
489 485
@@ -491,7 +487,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
491 acpi_hw_low_level_read(16, &value1, 487 acpi_hw_low_level_read(16, &value1,
492 &acpi_gbl_FADT.xpm1a_event_block); 488 &acpi_gbl_FADT.xpm1a_event_block);
493 if (ACPI_FAILURE(status)) { 489 if (ACPI_FAILURE(status)) {
494 goto unlock_and_exit; 490 goto exit;
495 } 491 }
496 492
497 /* PM1B is optional */ 493 /* PM1B is optional */
@@ -507,7 +503,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
507 status = 503 status =
508 acpi_hw_low_level_read(16, &value1, &acpi_gbl_xpm1a_enable); 504 acpi_hw_low_level_read(16, &value1, &acpi_gbl_xpm1a_enable);
509 if (ACPI_FAILURE(status)) { 505 if (ACPI_FAILURE(status)) {
510 goto unlock_and_exit; 506 goto exit;
511 } 507 }
512 508
513 /* PM1B is optional */ 509 /* PM1B is optional */
@@ -523,7 +519,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
523 acpi_hw_low_level_read(16, &value1, 519 acpi_hw_low_level_read(16, &value1,
524 &acpi_gbl_FADT.xpm1a_control_block); 520 &acpi_gbl_FADT.xpm1a_control_block);
525 if (ACPI_FAILURE(status)) { 521 if (ACPI_FAILURE(status)) {
526 goto unlock_and_exit; 522 goto exit;
527 } 523 }
528 524
529 status = 525 status =
@@ -558,10 +554,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
558 break; 554 break;
559 } 555 }
560 556
561 unlock_and_exit: 557 exit:
562 if (ACPI_MTX_LOCK == use_lock) {
563 acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
564 }
565 558
566 if (ACPI_SUCCESS(status)) { 559 if (ACPI_SUCCESS(status)) {
567 *return_value = value1; 560 *return_value = value1;
@@ -574,8 +567,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
574 * 567 *
575 * FUNCTION: acpi_hw_register_write 568 * FUNCTION: acpi_hw_register_write
576 * 569 *
577 * PARAMETERS: use_lock - Lock hardware? True/False 570 * PARAMETERS: register_id - ACPI Register ID
578 * register_id - ACPI Register ID
579 * Value - The value to write 571 * Value - The value to write
580 * 572 *
581 * RETURN: Status 573 * RETURN: Status
@@ -597,28 +589,22 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
597 * 589 *
598 ******************************************************************************/ 590 ******************************************************************************/
599 591
600acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) 592acpi_status acpi_hw_register_write(u32 register_id, u32 value)
601{ 593{
602 acpi_status status; 594 acpi_status status;
603 acpi_cpu_flags lock_flags = 0;
604 u32 read_value; 595 u32 read_value;
605 596
606 ACPI_FUNCTION_TRACE(hw_register_write); 597 ACPI_FUNCTION_TRACE(hw_register_write);
607 598
608 if (ACPI_MTX_LOCK == use_lock) {
609 lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
610 }
611
612 switch (register_id) { 599 switch (register_id) {
613 case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ 600 case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
614 601
615 /* Perform a read first to preserve certain bits (per ACPI spec) */ 602 /* Perform a read first to preserve certain bits (per ACPI spec) */
616 603
617 status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, 604 status = acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS,
618 ACPI_REGISTER_PM1_STATUS,
619 &read_value); 605 &read_value);
620 if (ACPI_FAILURE(status)) { 606 if (ACPI_FAILURE(status)) {
621 goto unlock_and_exit; 607 goto exit;
622 } 608 }
623 609
624 /* Insert the bits to be preserved */ 610 /* Insert the bits to be preserved */
@@ -632,7 +618,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
632 acpi_hw_low_level_write(16, value, 618 acpi_hw_low_level_write(16, value,
633 &acpi_gbl_FADT.xpm1a_event_block); 619 &acpi_gbl_FADT.xpm1a_event_block);
634 if (ACPI_FAILURE(status)) { 620 if (ACPI_FAILURE(status)) {
635 goto unlock_and_exit; 621 goto exit;
636 } 622 }
637 623
638 /* PM1B is optional */ 624 /* PM1B is optional */
@@ -647,7 +633,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
647 status = 633 status =
648 acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1a_enable); 634 acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1a_enable);
649 if (ACPI_FAILURE(status)) { 635 if (ACPI_FAILURE(status)) {
650 goto unlock_and_exit; 636 goto exit;
651 } 637 }
652 638
653 /* PM1B is optional */ 639 /* PM1B is optional */
@@ -661,11 +647,10 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
661 /* 647 /*
662 * Perform a read first to preserve certain bits (per ACPI spec) 648 * Perform a read first to preserve certain bits (per ACPI spec)
663 */ 649 */
664 status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, 650 status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL,
665 ACPI_REGISTER_PM1_CONTROL,
666 &read_value); 651 &read_value);
667 if (ACPI_FAILURE(status)) { 652 if (ACPI_FAILURE(status)) {
668 goto unlock_and_exit; 653 goto exit;
669 } 654 }
670 655
671 /* Insert the bits to be preserved */ 656 /* Insert the bits to be preserved */
@@ -679,7 +664,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
679 acpi_hw_low_level_write(16, value, 664 acpi_hw_low_level_write(16, value,
680 &acpi_gbl_FADT.xpm1a_control_block); 665 &acpi_gbl_FADT.xpm1a_control_block);
681 if (ACPI_FAILURE(status)) { 666 if (ACPI_FAILURE(status)) {
682 goto unlock_and_exit; 667 goto exit;
683 } 668 }
684 669
685 status = 670 status =
@@ -728,11 +713,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
728 break; 713 break;
729 } 714 }
730 715
731 unlock_and_exit: 716 exit:
732 if (ACPI_MTX_LOCK == use_lock) {
733 acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
734 }
735
736 return_ACPI_STATUS(status); 717 return_ACPI_STATUS(status);
737} 718}
738 719
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index 8181afbd1d4..81b24842970 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -309,8 +309,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
309 309
310 /* Get current value of PM1A control */ 310 /* Get current value of PM1A control */
311 311
312 status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, 312 status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
313 ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
314 if (ACPI_FAILURE(status)) { 313 if (ACPI_FAILURE(status)) {
315 return_ACPI_STATUS(status); 314 return_ACPI_STATUS(status);
316 } 315 }
@@ -337,15 +336,13 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
337 336
338 /* Write #1: fill in SLP_TYP data */ 337 /* Write #1: fill in SLP_TYP data */
339 338
340 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 339 status = acpi_hw_register_write(ACPI_REGISTER_PM1A_CONTROL,
341 ACPI_REGISTER_PM1A_CONTROL,
342 PM1Acontrol); 340 PM1Acontrol);
343 if (ACPI_FAILURE(status)) { 341 if (ACPI_FAILURE(status)) {
344 return_ACPI_STATUS(status); 342 return_ACPI_STATUS(status);
345 } 343 }
346 344
347 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 345 status = acpi_hw_register_write(ACPI_REGISTER_PM1B_CONTROL,
348 ACPI_REGISTER_PM1B_CONTROL,
349 PM1Bcontrol); 346 PM1Bcontrol);
350 if (ACPI_FAILURE(status)) { 347 if (ACPI_FAILURE(status)) {
351 return_ACPI_STATUS(status); 348 return_ACPI_STATUS(status);
@@ -360,15 +357,13 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
360 357
361 ACPI_FLUSH_CPU_CACHE(); 358 ACPI_FLUSH_CPU_CACHE();
362 359
363 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 360 status = acpi_hw_register_write(ACPI_REGISTER_PM1A_CONTROL,
364 ACPI_REGISTER_PM1A_CONTROL,
365 PM1Acontrol); 361 PM1Acontrol);
366 if (ACPI_FAILURE(status)) { 362 if (ACPI_FAILURE(status)) {
367 return_ACPI_STATUS(status); 363 return_ACPI_STATUS(status);
368 } 364 }
369 365
370 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 366 status = acpi_hw_register_write(ACPI_REGISTER_PM1B_CONTROL,
371 ACPI_REGISTER_PM1B_CONTROL,
372 PM1Bcontrol); 367 PM1Bcontrol);
373 if (ACPI_FAILURE(status)) { 368 if (ACPI_FAILURE(status)) {
374 return_ACPI_STATUS(status); 369 return_ACPI_STATUS(status);
@@ -388,8 +383,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
388 */ 383 */
389 acpi_os_stall(10000000); 384 acpi_os_stall(10000000);
390 385
391 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 386 status = acpi_hw_register_write(ACPI_REGISTER_PM1_CONTROL,
392 ACPI_REGISTER_PM1_CONTROL,
393 sleep_enable_reg_info-> 387 sleep_enable_reg_info->
394 access_bit_mask); 388 access_bit_mask);
395 if (ACPI_FAILURE(status)) { 389 if (ACPI_FAILURE(status)) {
@@ -400,7 +394,8 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
400 /* Wait until we enter sleep state */ 394 /* Wait until we enter sleep state */
401 395
402 do { 396 do {
403 status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value); 397 status = acpi_get_register_unlocked(ACPI_BITREG_WAKE_STATUS,
398 &in_value);
404 if (ACPI_FAILURE(status)) { 399 if (ACPI_FAILURE(status)) {
405 return_ACPI_STATUS(status); 400 return_ACPI_STATUS(status);
406 } 401 }
@@ -516,8 +511,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
516 511
517 /* Get current value of PM1A control */ 512 /* Get current value of PM1A control */
518 513
519 status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, 514 status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL,
520 ACPI_REGISTER_PM1_CONTROL,
521 &PM1Acontrol); 515 &PM1Acontrol);
522 if (ACPI_SUCCESS(status)) { 516 if (ACPI_SUCCESS(status)) {
523 517
@@ -539,11 +533,9 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
539 533
540 /* Just ignore any errors */ 534 /* Just ignore any errors */
541 535
542 (void)acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 536 (void)acpi_hw_register_write(ACPI_REGISTER_PM1A_CONTROL,
543 ACPI_REGISTER_PM1A_CONTROL,
544 PM1Acontrol); 537 PM1Acontrol);
545 (void)acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 538 (void)acpi_hw_register_write(ACPI_REGISTER_PM1B_CONTROL,
546 ACPI_REGISTER_PM1B_CONTROL,
547 PM1Bcontrol); 539 PM1Bcontrol);
548 } 540 }
549 } 541 }