aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2008-11-12 02:34:52 -0500
committerLen Brown <len.brown@intel.com>2008-12-29 22:38:37 -0500
commit009c4cbe99bea2da53f29ad685975a36f38c001c (patch)
tree170887ee9986ae84792200abd3f3022df01630ce /drivers/acpi
parentc87609f31a8641009641fc1d19dac75e6de06fd4 (diff)
ACPICA: Add global pointer for FACS table to simplify FACS access
Use a global pointer instead of using AcpiGetTableByIndex for each FACS access. This simplifies the code for the Global Lock and the Firmware Waking Vector(s). Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/events/evmisc.c22
-rw-r--r--drivers/acpi/hardware/hwsleep.c37
-rw-r--r--drivers/acpi/tables/tbutils.c24
-rw-r--r--drivers/acpi/utilities/utglobal.c1
-rw-r--r--drivers/acpi/utilities/utxface.c11
5 files changed, 48 insertions, 47 deletions
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c
index 1d5670be729a..82c457fa5a1f 100644
--- a/drivers/acpi/events/evmisc.c
+++ b/drivers/acpi/events/evmisc.c
@@ -49,11 +49,7 @@
49#define _COMPONENT ACPI_EVENTS 49#define _COMPONENT ACPI_EVENTS
50ACPI_MODULE_NAME("evmisc") 50ACPI_MODULE_NAME("evmisc")
51 51
52/* Pointer to FACS needed for the Global Lock */
53static struct acpi_table_facs *facs = NULL;
54
55/* Local prototypes */ 52/* Local prototypes */
56
57static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context); 53static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context);
58 54
59static u32 acpi_ev_global_lock_handler(void *context); 55static u32 acpi_ev_global_lock_handler(void *context);
@@ -299,7 +295,7 @@ static u32 acpi_ev_global_lock_handler(void *context)
299 * If we don't get it now, it will be marked pending and we will 295 * If we don't get it now, it will be marked pending and we will
300 * take another interrupt when it becomes free. 296 * take another interrupt when it becomes free.
301 */ 297 */
302 ACPI_ACQUIRE_GLOBAL_LOCK(facs, acquired); 298 ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_FACS, acquired);
303 if (acquired) { 299 if (acquired) {
304 300
305 /* Got the lock, now wake all threads waiting for it */ 301 /* Got the lock, now wake all threads waiting for it */
@@ -336,15 +332,8 @@ acpi_status acpi_ev_init_global_lock_handler(void)
336 332
337 ACPI_FUNCTION_TRACE(ev_init_global_lock_handler); 333 ACPI_FUNCTION_TRACE(ev_init_global_lock_handler);
338 334
339 status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, 335 /* Attempt installation of the global lock handler */
340 ACPI_CAST_INDIRECT_PTR(struct
341 acpi_table_header,
342 &facs));
343 if (ACPI_FAILURE(status)) {
344 return_ACPI_STATUS(status);
345 }
346 336
347 acpi_gbl_global_lock_present = TRUE;
348 status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, 337 status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL,
349 acpi_ev_global_lock_handler, 338 acpi_ev_global_lock_handler,
350 NULL); 339 NULL);
@@ -361,9 +350,10 @@ acpi_status acpi_ev_init_global_lock_handler(void)
361 "No response from Global Lock hardware, disabling lock")); 350 "No response from Global Lock hardware, disabling lock"));
362 351
363 acpi_gbl_global_lock_present = FALSE; 352 acpi_gbl_global_lock_present = FALSE;
364 status = AE_OK; 353 return_ACPI_STATUS(AE_OK);
365 } 354 }
366 355
356 acpi_gbl_global_lock_present = TRUE;
367 return_ACPI_STATUS(status); 357 return_ACPI_STATUS(status);
368} 358}
369 359
@@ -472,7 +462,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
472 462
473 /* Attempt to acquire the actual hardware lock */ 463 /* Attempt to acquire the actual hardware lock */
474 464
475 ACPI_ACQUIRE_GLOBAL_LOCK(facs, acquired); 465 ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_FACS, acquired);
476 if (acquired) { 466 if (acquired) {
477 467
478 /* We got the lock */ 468 /* We got the lock */
@@ -536,7 +526,7 @@ acpi_status acpi_ev_release_global_lock(void)
536 526
537 /* Allow any thread to release the lock */ 527 /* Allow any thread to release the lock */
538 528
539 ACPI_RELEASE_GLOBAL_LOCK(facs, pending); 529 ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_FACS, pending);
540 530
541 /* 531 /*
542 * If the pending bit was set, we must write GBL_RLS to the control 532 * If the pending bit was set, we must write GBL_RLS to the control
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index 6a30c8095ff1..5ec727ffcbe3 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -63,20 +63,8 @@ ACPI_MODULE_NAME("hwsleep")
63acpi_status 63acpi_status
64acpi_set_firmware_waking_vector(u32 physical_address) 64acpi_set_firmware_waking_vector(u32 physical_address)
65{ 65{
66 struct acpi_table_facs *facs;
67 acpi_status status;
68
69 ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); 66 ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector);
70 67
71 /* Get the FACS */
72
73 status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
74 ACPI_CAST_INDIRECT_PTR(struct
75 acpi_table_header,
76 &facs));
77 if (ACPI_FAILURE(status)) {
78 return_ACPI_STATUS(status);
79 }
80 68
81 /* 69 /*
82 * According to the ACPI specification 2.0c and later, the 64-bit 70 * According to the ACPI specification 2.0c and later, the 64-bit
@@ -88,12 +76,12 @@ acpi_set_firmware_waking_vector(u32 physical_address)
88 76
89 /* Set the 32-bit vector */ 77 /* Set the 32-bit vector */
90 78
91 facs->firmware_waking_vector = physical_address; 79 acpi_gbl_FACS->firmware_waking_vector = physical_address;
92 80
93 /* Clear the 64-bit vector if it exists */ 81 /* Clear the 64-bit vector if it exists */
94 82
95 if ((facs->length > 32) && (facs->version >= 1)) { 83 if ((acpi_gbl_FACS->length > 32) && (acpi_gbl_FACS->version >= 1)) {
96 facs->xfirmware_waking_vector = 0; 84 acpi_gbl_FACS->xfirmware_waking_vector = 0;
97 } 85 }
98 86
99 return_ACPI_STATUS(AE_OK); 87 return_ACPI_STATUS(AE_OK);
@@ -117,32 +105,19 @@ ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector)
117acpi_status 105acpi_status
118acpi_set_firmware_waking_vector64(u64 physical_address) 106acpi_set_firmware_waking_vector64(u64 physical_address)
119{ 107{
120 struct acpi_table_facs *facs;
121 acpi_status status;
122
123 ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64); 108 ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64);
124 109
125 110
126 /* Get the FACS */
127
128 status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
129 ACPI_CAST_INDIRECT_PTR(struct
130 acpi_table_header,
131 &facs));
132 if (ACPI_FAILURE(status)) {
133 return_ACPI_STATUS(status);
134 }
135
136 /* Determine if the 64-bit vector actually exists */ 111 /* Determine if the 64-bit vector actually exists */
137 112
138 if ((facs->length <= 32) || (facs->version < 1)) { 113 if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) {
139 return_ACPI_STATUS(AE_NOT_EXIST); 114 return_ACPI_STATUS(AE_NOT_EXIST);
140 } 115 }
141 116
142 /* Clear 32-bit vector, set the 64-bit X_ vector */ 117 /* Clear 32-bit vector, set the 64-bit X_ vector */
143 118
144 facs->firmware_waking_vector = 0; 119 acpi_gbl_FACS->firmware_waking_vector = 0;
145 facs->xfirmware_waking_vector = physical_address; 120 acpi_gbl_FACS->xfirmware_waking_vector = physical_address;
146 121
147 return_ACPI_STATUS(AE_OK); 122 return_ACPI_STATUS(AE_OK);
148} 123}
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index 0cc92ef5236f..50e677711e5b 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -113,6 +113,30 @@ acpi_tb_check_xsdt(acpi_physical_address address)
113 113
114/******************************************************************************* 114/*******************************************************************************
115 * 115 *
116 * FUNCTION: acpi_tb_initialize_facs
117 *
118 * PARAMETERS: None
119 *
120 * RETURN: Status
121 *
122 * DESCRIPTION: Create a permanent mapping for the FADT and save it in a global
123 * for accessing the Global Lock and Firmware Waking Vector
124 *
125 ******************************************************************************/
126
127acpi_status acpi_tb_initialize_facs(void)
128{
129 acpi_status status;
130
131 status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
132 ACPI_CAST_INDIRECT_PTR(struct
133 acpi_table_header,
134 &acpi_gbl_FACS));
135 return status;
136}
137
138/*******************************************************************************
139 *
116 * FUNCTION: acpi_tb_tables_loaded 140 * FUNCTION: acpi_tb_tables_loaded
117 * 141 *
118 * PARAMETERS: None 142 * PARAMETERS: None
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 3dc53114395b..211d621f42a9 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -771,6 +771,7 @@ acpi_status acpi_ut_init_globals(void)
771 acpi_gbl_global_lock_mutex = NULL; 771 acpi_gbl_global_lock_mutex = NULL;
772 acpi_gbl_global_lock_acquired = FALSE; 772 acpi_gbl_global_lock_acquired = FALSE;
773 acpi_gbl_global_lock_handle = 0; 773 acpi_gbl_global_lock_handle = 0;
774 acpi_gbl_global_lock_present = FALSE;
774 775
775 /* Miscellaneous variables */ 776 /* Miscellaneous variables */
776 777
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c
index c198a4d40583..7ca8952eb1b8 100644
--- a/drivers/acpi/utilities/utxface.c
+++ b/drivers/acpi/utilities/utxface.c
@@ -45,6 +45,7 @@
45#include <acpi/acevents.h> 45#include <acpi/acevents.h>
46#include <acpi/acnamesp.h> 46#include <acpi/acnamesp.h>
47#include <acpi/acdebug.h> 47#include <acpi/acdebug.h>
48#include <acpi/actables.h>
48 49
49#define _COMPONENT ACPI_UTILITIES 50#define _COMPONENT ACPI_UTILITIES
50ACPI_MODULE_NAME("utxface") 51ACPI_MODULE_NAME("utxface")
@@ -148,6 +149,16 @@ acpi_status acpi_enable_subsystem(u32 flags)
148 } 149 }
149 150
150 /* 151 /*
152 * Obtain a permanent mapping for the FACS. This is required for the
153 * Global Lock and the Firmware Waking Vector
154 */
155 status = acpi_tb_initialize_facs();
156 if (ACPI_FAILURE(status)) {
157 ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
158 return_ACPI_STATUS(status);
159 }
160
161 /*
151 * Install the default op_region handlers. These are installed unless 162 * Install the default op_region handlers. These are installed unless
152 * other handlers have already been installed via the 163 * other handlers have already been installed via the
153 * install_address_space_handler interface. 164 * install_address_space_handler interface.