diff options
| author | Lin Ming <ming.m.lin@intel.com> | 2010-09-15 01:55:13 -0400 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2010-10-01 01:47:55 -0400 |
| commit | 28eb3fcf8762a3b52f4fef5af29dce50d23c7151 (patch) | |
| tree | c3ccfc3008b7bd9a41c3637003f180a50b843fa0 | |
| parent | 8f40f171a29d0d2ae1ca8bd4a0c3fc9f514d1e20 (diff) | |
ACPICA: Make acpi_thread_id no longer configurable, always u64
Change definition of acpi_thread_id to always be a u64. This
simplifies the code, especially any printf output. u64 is
the only common data type for all thread_id types across all
operating systems. We now force the OSL to cast the native
thread_id type to u64 before returning the value to ACPICA
(via acpi_os_get_thread_id).
Signed-off-by: Lin Ming <ming.m.lin@intel.com
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
| -rw-r--r-- | drivers/acpi/acpica/achware.h | 2 | ||||
| -rw-r--r-- | drivers/acpi/acpica/aclocal.h | 2 | ||||
| -rw-r--r-- | drivers/acpi/acpica/dsmethod.c | 2 | ||||
| -rw-r--r-- | drivers/acpi/acpica/evmisc.c | 2 | ||||
| -rw-r--r-- | drivers/acpi/acpica/exmutex.c | 10 | ||||
| -rw-r--r-- | drivers/acpi/acpica/utdebug.c | 7 | ||||
| -rw-r--r-- | drivers/acpi/acpica/utmutex.c | 29 | ||||
| -rw-r--r-- | include/acpi/actypes.h | 17 | ||||
| -rw-r--r-- | include/acpi/platform/aclinux.h | 7 |
9 files changed, 41 insertions, 37 deletions
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h index e7c5545d8597..167470ad2d21 100644 --- a/drivers/acpi/acpica/achware.h +++ b/drivers/acpi/acpica/achware.h | |||
| @@ -121,7 +121,6 @@ acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
| 121 | struct acpi_gpe_block_info *gpe_block, | 121 | struct acpi_gpe_block_info *gpe_block, |
| 122 | void *context); | 122 | void *context); |
| 123 | 123 | ||
| 124 | #ifdef ACPI_FUTURE_USAGE | ||
| 125 | /* | 124 | /* |
| 126 | * hwpci - PCI configuration support | 125 | * hwpci - PCI configuration support |
| 127 | */ | 126 | */ |
| @@ -129,6 +128,7 @@ acpi_status | |||
| 129 | acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id, | 128 | acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id, |
| 130 | acpi_handle root_pci_device, acpi_handle pci_region); | 129 | acpi_handle root_pci_device, acpi_handle pci_region); |
| 131 | 130 | ||
| 131 | #ifdef ACPI_FUTURE_USAGE | ||
| 132 | /* | 132 | /* |
| 133 | * hwtimer - ACPI Timer prototypes | 133 | * hwtimer - ACPI Timer prototypes |
| 134 | */ | 134 | */ |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 53f7512b060f..04ce32272546 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
| @@ -1001,7 +1001,7 @@ struct acpi_port_info { | |||
| 1001 | struct acpi_db_method_info { | 1001 | struct acpi_db_method_info { |
| 1002 | acpi_handle main_thread_gate; | 1002 | acpi_handle main_thread_gate; |
| 1003 | acpi_handle thread_complete_gate; | 1003 | acpi_handle thread_complete_gate; |
| 1004 | u32 *threads; | 1004 | acpi_thread_id *threads; |
| 1005 | u32 num_threads; | 1005 | u32 num_threads; |
| 1006 | u32 num_created; | 1006 | u32 num_created; |
| 1007 | u32 num_completed; | 1007 | u32 num_completed; |
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index 64750ee96e20..d94dd8974b55 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c | |||
| @@ -573,7 +573,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
| 573 | 573 | ||
| 574 | acpi_os_release_mutex(method_desc->method. | 574 | acpi_os_release_mutex(method_desc->method. |
| 575 | mutex->mutex.os_mutex); | 575 | mutex->mutex.os_mutex); |
| 576 | method_desc->method.mutex->mutex.thread_id = NULL; | 576 | method_desc->method.mutex->mutex.thread_id = 0; |
| 577 | } | 577 | } |
| 578 | } | 578 | } |
| 579 | 579 | ||
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c index df0aea9a8cfd..fcaed9fb44ff 100644 --- a/drivers/acpi/acpica/evmisc.c +++ b/drivers/acpi/acpica/evmisc.c | |||
| @@ -553,7 +553,7 @@ acpi_status acpi_ev_release_global_lock(void) | |||
| 553 | acpi_gbl_global_lock_acquired = FALSE; | 553 | acpi_gbl_global_lock_acquired = FALSE; |
| 554 | 554 | ||
| 555 | /* Release the local GL mutex */ | 555 | /* Release the local GL mutex */ |
| 556 | acpi_ev_global_lock_thread_id = NULL; | 556 | acpi_ev_global_lock_thread_id = 0; |
| 557 | acpi_ev_global_lock_acquired = 0; | 557 | acpi_ev_global_lock_acquired = 0; |
| 558 | acpi_os_release_mutex(acpi_gbl_global_lock_mutex->mutex.os_mutex); | 558 | acpi_os_release_mutex(acpi_gbl_global_lock_mutex->mutex.os_mutex); |
| 559 | return_ACPI_STATUS(status); | 559 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c index f73be97043c0..6af14e43f839 100644 --- a/drivers/acpi/acpica/exmutex.c +++ b/drivers/acpi/acpica/exmutex.c | |||
| @@ -336,7 +336,7 @@ acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc) | |||
| 336 | 336 | ||
| 337 | /* Clear mutex info */ | 337 | /* Clear mutex info */ |
| 338 | 338 | ||
| 339 | obj_desc->mutex.thread_id = NULL; | 339 | obj_desc->mutex.thread_id = 0; |
| 340 | return_ACPI_STATUS(status); | 340 | return_ACPI_STATUS(status); |
| 341 | } | 341 | } |
| 342 | 342 | ||
| @@ -393,10 +393,10 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
| 393 | if ((owner_thread->thread_id != walk_state->thread->thread_id) && | 393 | if ((owner_thread->thread_id != walk_state->thread->thread_id) && |
| 394 | (obj_desc != acpi_gbl_global_lock_mutex)) { | 394 | (obj_desc != acpi_gbl_global_lock_mutex)) { |
| 395 | ACPI_ERROR((AE_INFO, | 395 | ACPI_ERROR((AE_INFO, |
| 396 | "Thread %p cannot release Mutex [%4.4s] acquired by thread %p", | 396 | "Thread %u cannot release Mutex [%4.4s] acquired by thread %u", |
| 397 | ACPI_CAST_PTR(void, walk_state->thread->thread_id), | 397 | (u32)walk_state->thread->thread_id, |
| 398 | acpi_ut_get_node_name(obj_desc->mutex.node), | 398 | acpi_ut_get_node_name(obj_desc->mutex.node), |
| 399 | ACPI_CAST_PTR(void, owner_thread->thread_id))); | 399 | (u32)owner_thread->thread_id)); |
| 400 | return_ACPI_STATUS(AE_AML_NOT_OWNER); | 400 | return_ACPI_STATUS(AE_AML_NOT_OWNER); |
| 401 | } | 401 | } |
| 402 | 402 | ||
| @@ -488,7 +488,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) | |||
| 488 | /* Mark mutex unowned */ | 488 | /* Mark mutex unowned */ |
| 489 | 489 | ||
| 490 | obj_desc->mutex.owner_thread = NULL; | 490 | obj_desc->mutex.owner_thread = NULL; |
| 491 | obj_desc->mutex.thread_id = NULL; | 491 | obj_desc->mutex.thread_id = 0; |
| 492 | 492 | ||
| 493 | /* Update Thread sync_level (Last mutex is the important one) */ | 493 | /* Update Thread sync_level (Last mutex is the important one) */ |
| 494 | 494 | ||
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c index 983510640059..f21c486929a5 100644 --- a/drivers/acpi/acpica/utdebug.c +++ b/drivers/acpi/acpica/utdebug.c | |||
| @@ -179,9 +179,8 @@ acpi_debug_print(u32 requested_debug_level, | |||
| 179 | if (thread_id != acpi_gbl_prev_thread_id) { | 179 | if (thread_id != acpi_gbl_prev_thread_id) { |
| 180 | if (ACPI_LV_THREADS & acpi_dbg_level) { | 180 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
| 181 | acpi_os_printf | 181 | acpi_os_printf |
| 182 | ("\n**** Context Switch from TID %p to TID %p ****\n\n", | 182 | ("\n**** Context Switch from TID %u to TID %u ****\n\n", |
| 183 | ACPI_CAST_PTR(void, acpi_gbl_prev_thread_id), | 183 | (u32)acpi_gbl_prev_thread_id, (u32)thread_id); |
| 184 | ACPI_CAST_PTR(void, thread_id)); | ||
| 185 | } | 184 | } |
| 186 | 185 | ||
| 187 | acpi_gbl_prev_thread_id = thread_id; | 186 | acpi_gbl_prev_thread_id = thread_id; |
| @@ -194,7 +193,7 @@ acpi_debug_print(u32 requested_debug_level, | |||
| 194 | acpi_os_printf("%8s-%04ld ", module_name, line_number); | 193 | acpi_os_printf("%8s-%04ld ", module_name, line_number); |
| 195 | 194 | ||
| 196 | if (ACPI_LV_THREADS & acpi_dbg_level) { | 195 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
| 197 | acpi_os_printf("[%p] ", ACPI_CAST_PTR(void, thread_id)); | 196 | acpi_os_printf("[%u] ", (u32)thread_id); |
| 198 | } | 197 | } |
| 199 | 198 | ||
| 200 | acpi_os_printf("[%02ld] %-22.22s: ", | 199 | acpi_os_printf("[%02ld] %-22.22s: ", |
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c index b07b425e2113..d9efa495b433 100644 --- a/drivers/acpi/acpica/utmutex.c +++ b/drivers/acpi/acpica/utmutex.c | |||
| @@ -228,18 +228,17 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
| 228 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { | 228 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { |
| 229 | if (i == mutex_id) { | 229 | if (i == mutex_id) { |
| 230 | ACPI_ERROR((AE_INFO, | 230 | ACPI_ERROR((AE_INFO, |
| 231 | "Mutex [%s] already acquired by this thread [%p]", | 231 | "Mutex [%s] already acquired by this thread [%u]", |
| 232 | acpi_ut_get_mutex_name | 232 | acpi_ut_get_mutex_name |
| 233 | (mutex_id), | 233 | (mutex_id), |
| 234 | ACPI_CAST_PTR(void, | 234 | (u32)this_thread_id)); |
| 235 | this_thread_id))); | ||
| 236 | 235 | ||
| 237 | return (AE_ALREADY_ACQUIRED); | 236 | return (AE_ALREADY_ACQUIRED); |
| 238 | } | 237 | } |
| 239 | 238 | ||
| 240 | ACPI_ERROR((AE_INFO, | 239 | ACPI_ERROR((AE_INFO, |
| 241 | "Invalid acquire order: Thread %p owns [%s], wants [%s]", | 240 | "Invalid acquire order: Thread %u owns [%s], wants [%s]", |
| 242 | ACPI_CAST_PTR(void, this_thread_id), | 241 | (u32)this_thread_id, |
| 243 | acpi_ut_get_mutex_name(i), | 242 | acpi_ut_get_mutex_name(i), |
| 244 | acpi_ut_get_mutex_name(mutex_id))); | 243 | acpi_ut_get_mutex_name(mutex_id))); |
| 245 | 244 | ||
| @@ -250,24 +249,24 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
| 250 | #endif | 249 | #endif |
| 251 | 250 | ||
| 252 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 251 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
| 253 | "Thread %p attempting to acquire Mutex [%s]\n", | 252 | "Thread %u attempting to acquire Mutex [%s]\n", |
| 254 | ACPI_CAST_PTR(void, this_thread_id), | 253 | (u32)this_thread_id, |
| 255 | acpi_ut_get_mutex_name(mutex_id))); | 254 | acpi_ut_get_mutex_name(mutex_id))); |
| 256 | 255 | ||
| 257 | status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, | 256 | status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, |
| 258 | ACPI_WAIT_FOREVER); | 257 | ACPI_WAIT_FOREVER); |
| 259 | if (ACPI_SUCCESS(status)) { | 258 | if (ACPI_SUCCESS(status)) { |
| 260 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 259 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
| 261 | "Thread %p acquired Mutex [%s]\n", | 260 | "Thread %u acquired Mutex [%s]\n", |
| 262 | ACPI_CAST_PTR(void, this_thread_id), | 261 | (u32)this_thread_id, |
| 263 | acpi_ut_get_mutex_name(mutex_id))); | 262 | acpi_ut_get_mutex_name(mutex_id))); |
| 264 | 263 | ||
| 265 | acpi_gbl_mutex_info[mutex_id].use_count++; | 264 | acpi_gbl_mutex_info[mutex_id].use_count++; |
| 266 | acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; | 265 | acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; |
| 267 | } else { | 266 | } else { |
| 268 | ACPI_EXCEPTION((AE_INFO, status, | 267 | ACPI_EXCEPTION((AE_INFO, status, |
| 269 | "Thread %p could not acquire Mutex [0x%X]", | 268 | "Thread %u could not acquire Mutex [0x%X]", |
| 270 | ACPI_CAST_PTR(void, this_thread_id), mutex_id)); | 269 | (u32)this_thread_id, mutex_id)); |
| 271 | } | 270 | } |
| 272 | 271 | ||
| 273 | return (status); | 272 | return (status); |
| @@ -287,10 +286,14 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
| 287 | 286 | ||
| 288 | acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) | 287 | acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) |
| 289 | { | 288 | { |
| 289 | acpi_thread_id this_thread_id; | ||
| 290 | |||
| 290 | ACPI_FUNCTION_NAME(ut_release_mutex); | 291 | ACPI_FUNCTION_NAME(ut_release_mutex); |
| 291 | 292 | ||
| 292 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n", | 293 | this_thread_id = acpi_os_get_thread_id(); |
| 293 | ACPI_CAST_PTR(void, acpi_os_get_thread_id()), | 294 | |
| 295 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %u releasing Mutex [%s]\n", | ||
| 296 | (u32)this_thread_id, | ||
| 294 | acpi_ut_get_mutex_name(mutex_id))); | 297 | acpi_ut_get_mutex_name(mutex_id))); |
| 295 | 298 | ||
| 296 | if (mutex_id > ACPI_MAX_MUTEX) { | 299 | if (mutex_id > ACPI_MAX_MUTEX) { |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 332d076f3f10..864cfae337f3 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
| @@ -115,7 +115,6 @@ | |||
| 115 | * | 115 | * |
| 116 | * ACPI_SIZE 16/32/64-bit unsigned value | 116 | * ACPI_SIZE 16/32/64-bit unsigned value |
| 117 | * ACPI_NATIVE_INT 16/32/64-bit signed value | 117 | * ACPI_NATIVE_INT 16/32/64-bit signed value |
| 118 | * | ||
| 119 | */ | 118 | */ |
| 120 | 119 | ||
| 121 | /******************************************************************************* | 120 | /******************************************************************************* |
| @@ -132,6 +131,16 @@ typedef COMPILER_DEPENDENT_INT64 INT64; | |||
| 132 | 131 | ||
| 133 | /*! [End] no source code translation !*/ | 132 | /*! [End] no source code translation !*/ |
| 134 | 133 | ||
| 134 | /* | ||
| 135 | * Value returned by acpi_os_get_thread_id. There is no standard "thread_id" | ||
| 136 | * across operating systems or even the various UNIX systems. Since ACPICA | ||
| 137 | * only needs the thread ID as a unique thread identifier, we use a u64 | ||
| 138 | * as the only common data type - it will accommodate any type of pointer or | ||
| 139 | * any type of integer. It is up to the host-dependent OSL to cast the | ||
| 140 | * native thread ID type to a u64 (in acpi_os_get_thread_id). | ||
| 141 | */ | ||
| 142 | #define acpi_thread_id u64 | ||
| 143 | |||
| 135 | /******************************************************************************* | 144 | /******************************************************************************* |
| 136 | * | 145 | * |
| 137 | * Types specific to 64-bit targets | 146 | * Types specific to 64-bit targets |
| @@ -211,12 +220,6 @@ typedef u32 acpi_physical_address; | |||
| 211 | * | 220 | * |
| 212 | ******************************************************************************/ | 221 | ******************************************************************************/ |
| 213 | 222 | ||
| 214 | /* Value returned by acpi_os_get_thread_id */ | ||
| 215 | |||
| 216 | #ifndef acpi_thread_id | ||
| 217 | #define acpi_thread_id acpi_size | ||
| 218 | #endif | ||
| 219 | |||
| 220 | /* Flags for acpi_os_acquire_lock/acpi_os_release_lock */ | 223 | /* Flags for acpi_os_acquire_lock/acpi_os_release_lock */ |
| 221 | 224 | ||
| 222 | #ifndef acpi_cpu_flags | 225 | #ifndef acpi_cpu_flags |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 103f08aca764..572189e37133 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
| @@ -75,7 +75,6 @@ | |||
| 75 | #define acpi_cache_t struct kmem_cache | 75 | #define acpi_cache_t struct kmem_cache |
| 76 | #define acpi_spinlock spinlock_t * | 76 | #define acpi_spinlock spinlock_t * |
| 77 | #define acpi_cpu_flags unsigned long | 77 | #define acpi_cpu_flags unsigned long |
| 78 | #define acpi_thread_id struct task_struct * | ||
| 79 | 78 | ||
| 80 | #else /* !__KERNEL__ */ | 79 | #else /* !__KERNEL__ */ |
| 81 | 80 | ||
| @@ -88,7 +87,7 @@ | |||
| 88 | /* Host-dependent types and defines for user-space ACPICA */ | 87 | /* Host-dependent types and defines for user-space ACPICA */ |
| 89 | 88 | ||
| 90 | #define ACPI_FLUSH_CPU_CACHE() | 89 | #define ACPI_FLUSH_CPU_CACHE() |
| 91 | #define acpi_thread_id pthread_t | 90 | #define ACPI_CAST_PTHREAD_T(pthread) ((acpi_thread_id) (pthread)) |
| 92 | 91 | ||
| 93 | #if defined(__ia64__) || defined(__x86_64__) | 92 | #if defined(__ia64__) || defined(__x86_64__) |
| 94 | #define ACPI_MACHINE_WIDTH 64 | 93 | #define ACPI_MACHINE_WIDTH 64 |
| @@ -113,12 +112,13 @@ | |||
| 113 | 112 | ||
| 114 | 113 | ||
| 115 | #ifdef __KERNEL__ | 114 | #ifdef __KERNEL__ |
| 115 | #include <acpi/actypes.h> | ||
| 116 | /* | 116 | /* |
| 117 | * Overrides for in-kernel ACPICA | 117 | * Overrides for in-kernel ACPICA |
| 118 | */ | 118 | */ |
| 119 | static inline acpi_thread_id acpi_os_get_thread_id(void) | 119 | static inline acpi_thread_id acpi_os_get_thread_id(void) |
| 120 | { | 120 | { |
| 121 | return current; | 121 | return (acpi_thread_id)(unsigned long)current; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | /* | 124 | /* |
| @@ -127,7 +127,6 @@ static inline acpi_thread_id acpi_os_get_thread_id(void) | |||
| 127 | * However, boot has (system_state != SYSTEM_RUNNING) | 127 | * However, boot has (system_state != SYSTEM_RUNNING) |
| 128 | * to quiet __might_sleep() in kmalloc() and resume does not. | 128 | * to quiet __might_sleep() in kmalloc() and resume does not. |
| 129 | */ | 129 | */ |
| 130 | #include <acpi/actypes.h> | ||
| 131 | static inline void *acpi_os_allocate(acpi_size size) | 130 | static inline void *acpi_os_allocate(acpi_size size) |
| 132 | { | 131 | { |
| 133 | return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); | 132 | return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); |
