aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2009-02-18 02:10:07 -0500
committerLen Brown <len.brown@intel.com>2009-03-26 16:38:30 -0400
commit9892dd23cbbfab1f7d4818622296e415979a9c77 (patch)
treeae729299168fa2403c7a180da33b8091da51936b
parentec41f193eadb6301f3c052b5e0dbc0b5636982e8 (diff)
ACPICA: Optimize ACPI register locking
Removed locking for reads from the ACPI bit registers in PM1 Status, Enable, Control, and PM2 Control. The lock is not required when reading the single-bit registers. The acpi_get_register_unlocked function is no longer needed and has been removed. This will improve performance for reads on these registers. ACPICA BZ 760. http://www.acpica.org/bugzilla/show_bug.cgi?id=760 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>
-rw-r--r--drivers/acpi/acpica/hwsleep.c2
-rw-r--r--drivers/acpi/acpica/hwxface.c65
-rw-r--r--drivers/acpi/processor_idle.c2
-rw-r--r--include/acpi/acpixf.h2
4 files changed, 29 insertions, 42 deletions
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 26e249e69ead..677ccb6bceea 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -365,7 +365,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
365 /* Wait until we enter sleep state */ 365 /* Wait until we enter sleep state */
366 366
367 do { 367 do {
368 status = acpi_get_register_unlocked(ACPI_BITREG_WAKE_STATUS, 368 status = acpi_get_register(ACPI_BITREG_WAKE_STATUS,
369 &in_value); 369 &in_value);
370 if (ACPI_FAILURE(status)) { 370 if (ACPI_FAILURE(status)) {
371 return_ACPI_STATUS(status); 371 return_ACPI_STATUS(status);
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index 4df9eacb7c88..c8100199634b 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -242,24 +242,35 @@ ACPI_EXPORT_SYMBOL(acpi_write)
242 242
243/******************************************************************************* 243/*******************************************************************************
244 * 244 *
245 * FUNCTION: acpi_get_register_unlocked 245 * FUNCTION: acpi_get_register
246 * 246 *
247 * PARAMETERS: register_id - ID of ACPI bit_register to access 247 * PARAMETERS: register_id - ID of ACPI Bit Register to access
248 * return_value - Value that was read from the register 248 * return_value - Value that was read from the register,
249 * normalized to bit position zero.
249 * 250 *
250 * RETURN: Status and the value read from specified Register. Value 251 * RETURN: Status and the value read from the specified Register. Value
251 * returned is normalized to bit0 (is shifted all the way right) 252 * returned is normalized to bit0 (is shifted all the way right)
252 * 253 *
253 * DESCRIPTION: ACPI bit_register read function. Does not acquire the HW lock. 254 * DESCRIPTION: ACPI bit_register read function. Does not acquire the HW lock.
254 * 255 *
256 * SUPPORTS: Bit fields in PM1 Status, PM1 Enable, PM1 Control, and
257 * PM2 Control.
258 *
259 * Note: The hardware lock is not required when reading the ACPI bit registers
260 * since almost all of them are single bit and it does not matter that
261 * the parent hardware register can be split across two physical
262 * registers. The only multi-bit field is SLP_TYP in the PM1 control
263 * register, but this field does not cross an 8-bit boundary (nor does
264 * it make much sense to actually read this field.)
265 *
255 ******************************************************************************/ 266 ******************************************************************************/
256acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value) 267acpi_status acpi_get_register(u32 register_id, u32 *return_value)
257{ 268{
258 u32 register_value = 0; 269 u32 register_value = 0;
259 struct acpi_bit_register_info *bit_reg_info; 270 struct acpi_bit_register_info *bit_reg_info;
260 acpi_status status; 271 acpi_status status;
261 272
262 ACPI_FUNCTION_TRACE(acpi_get_register_unlocked); 273 ACPI_FUNCTION_TRACE(acpi_get_register);
263 274
264 /* Get the info structure corresponding to the requested ACPI Register */ 275 /* Get the info structure corresponding to the requested ACPI Register */
265 276
@@ -268,7 +279,7 @@ acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value)
268 return_ACPI_STATUS(AE_BAD_PARAMETER); 279 return_ACPI_STATUS(AE_BAD_PARAMETER);
269 } 280 }
270 281
271 /* Read from the register */ 282 /* Read the entire parent register */
272 283
273 status = acpi_hw_register_read(bit_reg_info->parent_register, 284 status = acpi_hw_register_read(bit_reg_info->parent_register,
274 &register_value); 285 &register_value);
@@ -291,46 +302,24 @@ acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value)
291 return_ACPI_STATUS(status); 302 return_ACPI_STATUS(status);
292} 303}
293 304
294ACPI_EXPORT_SYMBOL(acpi_get_register_unlocked)
295
296/*******************************************************************************
297 *
298 * FUNCTION: acpi_get_register
299 *
300 * PARAMETERS: register_id - ID of ACPI bit_register to access
301 * return_value - Value that was read from the register
302 *
303 * RETURN: Status and the value read from specified Register. Value
304 * returned is normalized to bit0 (is shifted all the way right)
305 *
306 * DESCRIPTION: ACPI bit_register read function.
307 *
308 ******************************************************************************/
309acpi_status acpi_get_register(u32 register_id, u32 *return_value)
310{
311 acpi_status status;
312 acpi_cpu_flags flags;
313
314 flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
315 status = acpi_get_register_unlocked(register_id, return_value);
316 acpi_os_release_lock(acpi_gbl_hardware_lock, flags);
317
318 return (status);
319}
320
321ACPI_EXPORT_SYMBOL(acpi_get_register) 305ACPI_EXPORT_SYMBOL(acpi_get_register)
322 306
323/******************************************************************************* 307/*******************************************************************************
324 * 308 *
325 * FUNCTION: acpi_set_register 309 * FUNCTION: acpi_set_register
326 * 310 *
327 * PARAMETERS: register_id - ID of ACPI bit_register to access 311 * PARAMETERS: register_id - ID of ACPI Bit Register to access
328 * Value - (only used on write) value to write to the 312 * Value - Value to write to the register, in bit
329 * Register, NOT pre-normalized to the bit pos 313 * position zero. The bit is automaticallly
314 * shifted to the correct position.
330 * 315 *
331 * RETURN: Status 316 * RETURN: Status
332 * 317 *
333 * DESCRIPTION: ACPI Bit Register write function. 318 * DESCRIPTION: ACPI Bit Register write function. Acquires the hardware lock
319 * since most operations require a read/modify/write sequence.
320 *
321 * SUPPORTS: Bit fields in PM1 Status, PM1 Enable, PM1 Control, and
322 * PM2 Control.
334 * 323 *
335 ******************************************************************************/ 324 ******************************************************************************/
336acpi_status acpi_set_register(u32 register_id, u32 value) 325acpi_status acpi_set_register(u32 register_id, u32 value)
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 7bc22a471fe3..6946047d0096 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -800,7 +800,7 @@ static int acpi_idle_bm_check(void)
800{ 800{
801 u32 bm_status = 0; 801 u32 bm_status = 0;
802 802
803 acpi_get_register_unlocked(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status); 803 acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status);
804 if (bm_status) 804 if (bm_status)
805 acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1); 805 acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1);
806 /* 806 /*
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index e10c89691043..325d4b073aca 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -347,8 +347,6 @@ acpi_status acpi_reset(void);
347 347
348acpi_status acpi_get_register(u32 register_id, u32 * return_value); 348acpi_status acpi_get_register(u32 register_id, u32 * return_value);
349 349
350acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value);
351
352acpi_status acpi_set_register(u32 register_id, u32 value); 350acpi_status acpi_set_register(u32 register_id, u32 value);
353 351
354acpi_status acpi_set_firmware_waking_vector(u32 physical_address); 352acpi_status acpi_set_firmware_waking_vector(u32 physical_address);