aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/hardware
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2007-02-02 11:48:18 -0500
committerLen Brown <len.brown@intel.com>2007-02-02 21:14:21 -0500
commitf3d2e7865c816258c699ff965768e46b50d536d3 (patch)
tree83d21269e506109275b77d3ed161883bba8a39cf /drivers/acpi/hardware
parent2e42005bcdb4f63bed1cea7f537a5534d4bd7a57 (diff)
ACPICA: Implement simplified Table Manager
The Table Manager component has been completely redesigned and reimplemented. The new design is much simpler, and reduces the overall code and data size of the kernel-resident ACPICA by approximately 5%. Also, it is now possible to obtain the ACPI tables very early during kernel initialization, even before dynamic memory management is initialized. Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/hardware')
-rw-r--r--drivers/acpi/hardware/hwacpi.c22
-rw-r--r--drivers/acpi/hardware/hwregs.c64
-rw-r--r--drivers/acpi/hardware/hwsleep.c57
-rw-r--r--drivers/acpi/hardware/hwtimer.c7
4 files changed, 88 insertions, 62 deletions
diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c
index de50fab2a910..14e8111769a3 100644
--- a/drivers/acpi/hardware/hwacpi.c
+++ b/drivers/acpi/hardware/hwacpi.c
@@ -65,13 +65,6 @@ acpi_status acpi_hw_initialize(void)
65 65
66 ACPI_FUNCTION_TRACE(hw_initialize); 66 ACPI_FUNCTION_TRACE(hw_initialize);
67 67
68 /* We must have the ACPI tables by the time we get here */
69
70 if (!acpi_gbl_FADT) {
71 ACPI_ERROR((AE_INFO, "No FADT is present"));
72 return_ACPI_STATUS(AE_NO_ACPI_TABLES);
73 }
74
75 /* Sanity check the FADT for valid values */ 68 /* Sanity check the FADT for valid values */
76 69
77 status = acpi_ut_validate_fadt(); 70 status = acpi_ut_validate_fadt();
@@ -106,7 +99,7 @@ acpi_status acpi_hw_set_mode(u32 mode)
106 * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, 99 * ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
107 * system does not support mode transition. 100 * system does not support mode transition.
108 */ 101 */
109 if (!acpi_gbl_FADT->smi_cmd) { 102 if (!acpi_gbl_FADT.smi_command) {
110 ACPI_ERROR((AE_INFO, 103 ACPI_ERROR((AE_INFO,
111 "No SMI_CMD in FADT, mode transition failed")); 104 "No SMI_CMD in FADT, mode transition failed"));
112 return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); 105 return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
@@ -119,7 +112,7 @@ acpi_status acpi_hw_set_mode(u32 mode)
119 * we make sure both the numbers are zero to determine these 112 * we make sure both the numbers are zero to determine these
120 * transitions are not supported. 113 * transitions are not supported.
121 */ 114 */
122 if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) { 115 if (!acpi_gbl_FADT.acpi_enable && !acpi_gbl_FADT.acpi_disable) {
123 ACPI_ERROR((AE_INFO, 116 ACPI_ERROR((AE_INFO,
124 "No ACPI mode transition supported in this system (enable/disable both zero)")); 117 "No ACPI mode transition supported in this system (enable/disable both zero)"));
125 return_ACPI_STATUS(AE_OK); 118 return_ACPI_STATUS(AE_OK);
@@ -130,9 +123,8 @@ acpi_status acpi_hw_set_mode(u32 mode)
130 123
131 /* BIOS should have disabled ALL fixed and GP events */ 124 /* BIOS should have disabled ALL fixed and GP events */
132 125
133 status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, 126 status = acpi_os_write_port(acpi_gbl_FADT.smi_command,
134 (u32) acpi_gbl_FADT->acpi_enable, 127 (u32) acpi_gbl_FADT.acpi_enable, 8);
135 8);
136 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 128 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
137 "Attempting to enable ACPI mode\n")); 129 "Attempting to enable ACPI mode\n"));
138 break; 130 break;
@@ -143,8 +135,8 @@ acpi_status acpi_hw_set_mode(u32 mode)
143 * BIOS should clear all fixed status bits and restore fixed event 135 * BIOS should clear all fixed status bits and restore fixed event
144 * enable bits to default 136 * enable bits to default
145 */ 137 */
146 status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, 138 status = acpi_os_write_port(acpi_gbl_FADT.smi_command,
147 (u32) acpi_gbl_FADT->acpi_disable, 139 (u32) acpi_gbl_FADT.acpi_disable,
148 8); 140 8);
149 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 141 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
150 "Attempting to enable Legacy (non-ACPI) mode\n")); 142 "Attempting to enable Legacy (non-ACPI) mode\n"));
@@ -204,7 +196,7 @@ u32 acpi_hw_get_mode(void)
204 * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, 196 * ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
205 * system does not support mode transition. 197 * system does not support mode transition.
206 */ 198 */
207 if (!acpi_gbl_FADT->smi_cmd) { 199 if (!acpi_gbl_FADT.smi_command) {
208 return_UINT32(ACPI_SYS_MODE_ACPI); 200 return_UINT32(ACPI_SYS_MODE_ACPI);
209 } 201 }
210 202
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c
index fa58c1edce1e..9fe7adf21f8b 100644
--- a/drivers/acpi/hardware/hwregs.c
+++ b/drivers/acpi/hardware/hwregs.c
@@ -73,7 +73,7 @@ acpi_status acpi_hw_clear_acpi_status(u32 flags)
73 73
74 ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n", 74 ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n",
75 ACPI_BITMASK_ALL_FIXED_STATUS, 75 ACPI_BITMASK_ALL_FIXED_STATUS,
76 (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); 76 (u16) acpi_gbl_FADT.xpm1a_event_block.address));
77 77
78 lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); 78 lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
79 79
@@ -86,10 +86,10 @@ acpi_status acpi_hw_clear_acpi_status(u32 flags)
86 86
87 /* Clear the fixed events */ 87 /* Clear the fixed events */
88 88
89 if (acpi_gbl_FADT->xpm1b_evt_blk.address) { 89 if (acpi_gbl_FADT.xpm1b_event_block.address) {
90 status = 90 status =
91 acpi_hw_low_level_write(16, ACPI_BITMASK_ALL_FIXED_STATUS, 91 acpi_hw_low_level_write(16, ACPI_BITMASK_ALL_FIXED_STATUS,
92 &acpi_gbl_FADT->xpm1b_evt_blk); 92 &acpi_gbl_FADT.xpm1b_event_block);
93 if (ACPI_FAILURE(status)) { 93 if (ACPI_FAILURE(status)) {
94 goto unlock_and_exit; 94 goto unlock_and_exit;
95 } 95 }
@@ -422,8 +422,9 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
422 ACPI_DEBUG_PRINT((ACPI_DB_IO, 422 ACPI_DEBUG_PRINT((ACPI_DB_IO,
423 "PM2 control: Read %X from %8.8X%8.8X\n", 423 "PM2 control: Read %X from %8.8X%8.8X\n",
424 register_value, 424 register_value,
425 ACPI_FORMAT_UINT64(acpi_gbl_FADT-> 425 ACPI_FORMAT_UINT64(acpi_gbl_FADT.
426 xpm2_cnt_blk.address))); 426 xpm2_control_block.
427 address)));
427 428
428 ACPI_REGISTER_INSERT_VALUE(register_value, 429 ACPI_REGISTER_INSERT_VALUE(register_value,
429 bit_reg_info->bit_position, 430 bit_reg_info->bit_position,
@@ -433,8 +434,9 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
433 ACPI_DEBUG_PRINT((ACPI_DB_IO, 434 ACPI_DEBUG_PRINT((ACPI_DB_IO,
434 "About to write %4.4X to %8.8X%8.8X\n", 435 "About to write %4.4X to %8.8X%8.8X\n",
435 register_value, 436 register_value,
436 ACPI_FORMAT_UINT64(acpi_gbl_FADT-> 437 ACPI_FORMAT_UINT64(acpi_gbl_FADT.
437 xpm2_cnt_blk.address))); 438 xpm2_control_block.
439 address)));
438 440
439 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 441 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
440 ACPI_REGISTER_PM2_CONTROL, 442 ACPI_REGISTER_PM2_CONTROL,
@@ -495,7 +497,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
495 497
496 status = 498 status =
497 acpi_hw_low_level_read(16, &value1, 499 acpi_hw_low_level_read(16, &value1,
498 &acpi_gbl_FADT->xpm1a_evt_blk); 500 &acpi_gbl_FADT.xpm1a_event_block);
499 if (ACPI_FAILURE(status)) { 501 if (ACPI_FAILURE(status)) {
500 goto unlock_and_exit; 502 goto unlock_and_exit;
501 } 503 }
@@ -504,7 +506,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
504 506
505 status = 507 status =
506 acpi_hw_low_level_read(16, &value2, 508 acpi_hw_low_level_read(16, &value2,
507 &acpi_gbl_FADT->xpm1b_evt_blk); 509 &acpi_gbl_FADT.xpm1b_event_block);
508 value1 |= value2; 510 value1 |= value2;
509 break; 511 break;
510 512
@@ -527,14 +529,14 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
527 529
528 status = 530 status =
529 acpi_hw_low_level_read(16, &value1, 531 acpi_hw_low_level_read(16, &value1,
530 &acpi_gbl_FADT->xpm1a_cnt_blk); 532 &acpi_gbl_FADT.xpm1a_control_block);
531 if (ACPI_FAILURE(status)) { 533 if (ACPI_FAILURE(status)) {
532 goto unlock_and_exit; 534 goto unlock_and_exit;
533 } 535 }
534 536
535 status = 537 status =
536 acpi_hw_low_level_read(16, &value2, 538 acpi_hw_low_level_read(16, &value2,
537 &acpi_gbl_FADT->xpm1b_cnt_blk); 539 &acpi_gbl_FADT.xpm1b_control_block);
538 value1 |= value2; 540 value1 |= value2;
539 break; 541 break;
540 542
@@ -542,19 +544,20 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
542 544
543 status = 545 status =
544 acpi_hw_low_level_read(8, &value1, 546 acpi_hw_low_level_read(8, &value1,
545 &acpi_gbl_FADT->xpm2_cnt_blk); 547 &acpi_gbl_FADT.xpm2_control_block);
546 break; 548 break;
547 549
548 case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ 550 case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
549 551
550 status = 552 status =
551 acpi_hw_low_level_read(32, &value1, 553 acpi_hw_low_level_read(32, &value1,
552 &acpi_gbl_FADT->xpm_tmr_blk); 554 &acpi_gbl_FADT.xpm_timer_block);
553 break; 555 break;
554 556
555 case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ 557 case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
556 558
557 status = acpi_os_read_port(acpi_gbl_FADT->smi_cmd, &value1, 8); 559 status =
560 acpi_os_read_port(acpi_gbl_FADT.smi_command, &value1, 8);
558 break; 561 break;
559 562
560 default: 563 default:
@@ -635,7 +638,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
635 638
636 status = 639 status =
637 acpi_hw_low_level_write(16, value, 640 acpi_hw_low_level_write(16, value,
638 &acpi_gbl_FADT->xpm1a_evt_blk); 641 &acpi_gbl_FADT.xpm1a_event_block);
639 if (ACPI_FAILURE(status)) { 642 if (ACPI_FAILURE(status)) {
640 goto unlock_and_exit; 643 goto unlock_and_exit;
641 } 644 }
@@ -644,7 +647,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
644 647
645 status = 648 status =
646 acpi_hw_low_level_write(16, value, 649 acpi_hw_low_level_write(16, value,
647 &acpi_gbl_FADT->xpm1b_evt_blk); 650 &acpi_gbl_FADT.xpm1b_event_block);
648 break; 651 break;
649 652
650 case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ 653 case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */
@@ -682,49 +685,50 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
682 685
683 status = 686 status =
684 acpi_hw_low_level_write(16, value, 687 acpi_hw_low_level_write(16, value,
685 &acpi_gbl_FADT->xpm1a_cnt_blk); 688 &acpi_gbl_FADT.xpm1a_control_block);
686 if (ACPI_FAILURE(status)) { 689 if (ACPI_FAILURE(status)) {
687 goto unlock_and_exit; 690 goto unlock_and_exit;
688 } 691 }
689 692
690 status = 693 status =
691 acpi_hw_low_level_write(16, value, 694 acpi_hw_low_level_write(16, value,
692 &acpi_gbl_FADT->xpm1b_cnt_blk); 695 &acpi_gbl_FADT.xpm1b_control_block);
693 break; 696 break;
694 697
695 case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */ 698 case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */
696 699
697 status = 700 status =
698 acpi_hw_low_level_write(16, value, 701 acpi_hw_low_level_write(16, value,
699 &acpi_gbl_FADT->xpm1a_cnt_blk); 702 &acpi_gbl_FADT.xpm1a_control_block);
700 break; 703 break;
701 704
702 case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */ 705 case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */
703 706
704 status = 707 status =
705 acpi_hw_low_level_write(16, value, 708 acpi_hw_low_level_write(16, value,
706 &acpi_gbl_FADT->xpm1b_cnt_blk); 709 &acpi_gbl_FADT.xpm1b_control_block);
707 break; 710 break;
708 711
709 case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ 712 case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
710 713
711 status = 714 status =
712 acpi_hw_low_level_write(8, value, 715 acpi_hw_low_level_write(8, value,
713 &acpi_gbl_FADT->xpm2_cnt_blk); 716 &acpi_gbl_FADT.xpm2_control_block);
714 break; 717 break;
715 718
716 case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ 719 case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
717 720
718 status = 721 status =
719 acpi_hw_low_level_write(32, value, 722 acpi_hw_low_level_write(32, value,
720 &acpi_gbl_FADT->xpm_tmr_blk); 723 &acpi_gbl_FADT.xpm_timer_block);
721 break; 724 break;
722 725
723 case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ 726 case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
724 727
725 /* SMI_CMD is currently always in IO space */ 728 /* SMI_CMD is currently always in IO space */
726 729
727 status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, value, 8); 730 status =
731 acpi_os_write_port(acpi_gbl_FADT.smi_command, value, 8);
728 break; 732 break;
729 733
730 default: 734 default:
@@ -783,7 +787,7 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg)
783 * Two address spaces supported: Memory or IO. 787 * Two address spaces supported: Memory or IO.
784 * PCI_Config is not supported here because the GAS struct is insufficient 788 * PCI_Config is not supported here because the GAS struct is insufficient
785 */ 789 */
786 switch (reg->address_space_id) { 790 switch (reg->space_id) {
787 case ACPI_ADR_SPACE_SYSTEM_MEMORY: 791 case ACPI_ADR_SPACE_SYSTEM_MEMORY:
788 792
789 status = acpi_os_read_memory((acpi_physical_address) address, 793 status = acpi_os_read_memory((acpi_physical_address) address,
@@ -798,8 +802,7 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg)
798 802
799 default: 803 default:
800 ACPI_ERROR((AE_INFO, 804 ACPI_ERROR((AE_INFO,
801 "Unsupported address space: %X", 805 "Unsupported address space: %X", reg->space_id));
802 reg->address_space_id));
803 return (AE_BAD_PARAMETER); 806 return (AE_BAD_PARAMETER);
804 } 807 }
805 808
@@ -807,7 +810,7 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg)
807 "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", 810 "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
808 *value, width, 811 *value, width,
809 ACPI_FORMAT_UINT64(address), 812 ACPI_FORMAT_UINT64(address),
810 acpi_ut_get_region_name(reg->address_space_id))); 813 acpi_ut_get_region_name(reg->space_id)));
811 814
812 return (status); 815 return (status);
813} 816}
@@ -854,7 +857,7 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg)
854 * Two address spaces supported: Memory or IO. 857 * Two address spaces supported: Memory or IO.
855 * PCI_Config is not supported here because the GAS struct is insufficient 858 * PCI_Config is not supported here because the GAS struct is insufficient
856 */ 859 */
857 switch (reg->address_space_id) { 860 switch (reg->space_id) {
858 case ACPI_ADR_SPACE_SYSTEM_MEMORY: 861 case ACPI_ADR_SPACE_SYSTEM_MEMORY:
859 862
860 status = acpi_os_write_memory((acpi_physical_address) address, 863 status = acpi_os_write_memory((acpi_physical_address) address,
@@ -869,8 +872,7 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg)
869 872
870 default: 873 default:
871 ACPI_ERROR((AE_INFO, 874 ACPI_ERROR((AE_INFO,
872 "Unsupported address space: %X", 875 "Unsupported address space: %X", reg->space_id));
873 reg->address_space_id));
874 return (AE_BAD_PARAMETER); 876 return (AE_BAD_PARAMETER);
875 } 877 }
876 878
@@ -878,7 +880,7 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg)
878 "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", 880 "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
879 value, width, 881 value, width,
880 ACPI_FORMAT_UINT64(address), 882 ACPI_FORMAT_UINT64(address),
881 acpi_ut_get_region_name(reg->address_space_id))); 883 acpi_ut_get_region_name(reg->space_id)));
882 884
883 return (status); 885 return (status);
884} 886}
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index 8bb43cae60c2..6faa76bdc3d5 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -43,6 +43,7 @@
43 */ 43 */
44 44
45#include <acpi/acpi.h> 45#include <acpi/acpi.h>
46#include <acpi/actables.h>
46 47
47#define _COMPONENT ACPI_HARDWARE 48#define _COMPONENT ACPI_HARDWARE
48ACPI_MODULE_NAME("hwsleep") 49ACPI_MODULE_NAME("hwsleep")
@@ -62,17 +63,32 @@ ACPI_MODULE_NAME("hwsleep")
62acpi_status 63acpi_status
63acpi_set_firmware_waking_vector(acpi_physical_address physical_address) 64acpi_set_firmware_waking_vector(acpi_physical_address physical_address)
64{ 65{
66 struct acpi_table_facs *facs;
67 acpi_status status;
65 68
66 ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); 69 ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector);
67 70
71 /* Get the FACS */
72
73 status =
74 acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
75 (struct acpi_table_header **)&facs);
76 if (ACPI_FAILURE(status)) {
77 return_ACPI_STATUS(status);
78 }
79
68 /* Set the vector */ 80 /* Set the vector */
69 81
70 if (acpi_gbl_common_fACS.vector_width == 32) { 82 if ((facs->length < 32) || (!(facs->xfirmware_waking_vector))) {
71 *(ACPI_CAST_PTR 83 /*
72 (u32, acpi_gbl_common_fACS.firmware_waking_vector)) 84 * ACPI 1.0 FACS or short table or optional X_ field is zero
73 = (u32) physical_address; 85 */
86 facs->firmware_waking_vector = (u32) physical_address;
74 } else { 87 } else {
75 *acpi_gbl_common_fACS.firmware_waking_vector = physical_address; 88 /*
89 * ACPI 2.0 FACS with valid X_ field
90 */
91 facs->xfirmware_waking_vector = physical_address;
76 } 92 }
77 93
78 return_ACPI_STATUS(AE_OK); 94 return_ACPI_STATUS(AE_OK);
@@ -97,6 +113,8 @@ ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector)
97acpi_status 113acpi_status
98acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) 114acpi_get_firmware_waking_vector(acpi_physical_address * physical_address)
99{ 115{
116 struct acpi_table_facs *facs;
117 acpi_status status;
100 118
101 ACPI_FUNCTION_TRACE(acpi_get_firmware_waking_vector); 119 ACPI_FUNCTION_TRACE(acpi_get_firmware_waking_vector);
102 120
@@ -104,16 +122,29 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address)
104 return_ACPI_STATUS(AE_BAD_PARAMETER); 122 return_ACPI_STATUS(AE_BAD_PARAMETER);
105 } 123 }
106 124
125 /* Get the FACS */
126
127 status =
128 acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
129 (struct acpi_table_header **)&facs);
130 if (ACPI_FAILURE(status)) {
131 return_ACPI_STATUS(status);
132 }
133
107 /* Get the vector */ 134 /* Get the vector */
108 135
109 if (acpi_gbl_common_fACS.vector_width == 32) { 136 if ((facs->length < 32) || (!(facs->xfirmware_waking_vector))) {
110 *physical_address = (acpi_physical_address) 137 /*
111 * 138 * ACPI 1.0 FACS or short table or optional X_ field is zero
112 (ACPI_CAST_PTR 139 */
113 (u32, acpi_gbl_common_fACS.firmware_waking_vector)); 140 *physical_address =
141 (acpi_physical_address) facs->firmware_waking_vector;
114 } else { 142 } else {
143 /*
144 * ACPI 2.0 FACS with valid X_ field
145 */
115 *physical_address = 146 *physical_address =
116 *acpi_gbl_common_fACS.firmware_waking_vector; 147 (acpi_physical_address) facs->xfirmware_waking_vector;
117 } 148 }
118 149
119 return_ACPI_STATUS(AE_OK); 150 return_ACPI_STATUS(AE_OK);
@@ -429,8 +460,8 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
429 460
430 ACPI_FLUSH_CPU_CACHE(); 461 ACPI_FLUSH_CPU_CACHE();
431 462
432 status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, 463 status = acpi_os_write_port(acpi_gbl_FADT.smi_command,
433 (u32) acpi_gbl_FADT->S4bios_req, 8); 464 (u32) acpi_gbl_FADT.S4bios_request, 8);
434 465
435 do { 466 do {
436 acpi_os_stall(1000); 467 acpi_os_stall(1000);
diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c
index c4ec47c939fd..abd86e8d6287 100644
--- a/drivers/acpi/hardware/hwtimer.c
+++ b/drivers/acpi/hardware/hwtimer.c
@@ -66,7 +66,7 @@ acpi_status acpi_get_timer_resolution(u32 * resolution)
66 return_ACPI_STATUS(AE_BAD_PARAMETER); 66 return_ACPI_STATUS(AE_BAD_PARAMETER);
67 } 67 }
68 68
69 if (acpi_gbl_FADT->tmr_val_ext == 0) { 69 if ((acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) == 0) {
70 *resolution = 24; 70 *resolution = 24;
71 } else { 71 } else {
72 *resolution = 32; 72 *resolution = 32;
@@ -98,7 +98,8 @@ acpi_status acpi_get_timer(u32 * ticks)
98 return_ACPI_STATUS(AE_BAD_PARAMETER); 98 return_ACPI_STATUS(AE_BAD_PARAMETER);
99 } 99 }
100 100
101 status = acpi_hw_low_level_read(32, ticks, &acpi_gbl_FADT->xpm_tmr_blk); 101 status =
102 acpi_hw_low_level_read(32, ticks, &acpi_gbl_FADT.xpm_timer_block);
102 103
103 return_ACPI_STATUS(status); 104 return_ACPI_STATUS(status);
104} 105}
@@ -153,7 +154,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
153 if (start_ticks < end_ticks) { 154 if (start_ticks < end_ticks) {
154 delta_ticks = end_ticks - start_ticks; 155 delta_ticks = end_ticks - start_ticks;
155 } else if (start_ticks > end_ticks) { 156 } else if (start_ticks > end_ticks) {
156 if (acpi_gbl_FADT->tmr_val_ext == 0) { 157 if ((acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER) == 0) {
157 158
158 /* 24-bit Timer */ 159 /* 24-bit Timer */
159 160