aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities')
-rw-r--r--drivers/acpi/utilities/utcache.c12
-rw-r--r--drivers/acpi/utilities/utdebug.c169
-rw-r--r--drivers/acpi/utilities/utdelete.c98
-rw-r--r--drivers/acpi/utilities/utglobal.c72
-rw-r--r--drivers/acpi/utilities/utmisc.c94
-rw-r--r--drivers/acpi/utilities/utmutex.c10
6 files changed, 235 insertions, 220 deletions
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c
index 07588812e72d..c0df0585c683 100644
--- a/drivers/acpi/utilities/utcache.c
+++ b/drivers/acpi/utilities/utcache.c
@@ -74,6 +74,9 @@ acpi_os_create_cache (
74 struct acpi_memory_list *cache; 74 struct acpi_memory_list *cache;
75 75
76 76
77 ACPI_FUNCTION_ENTRY ();
78
79
77 if (!cache_name || !return_cache || (object_size < 16)) { 80 if (!cache_name || !return_cache || (object_size < 16)) {
78 return (AE_BAD_PARAMETER); 81 return (AE_BAD_PARAMETER);
79 } 82 }
@@ -161,7 +164,10 @@ acpi_os_delete_cache (
161 acpi_status status; 164 acpi_status status;
162 165
163 166
164 /* Purge all objects in the cache */ 167 ACPI_FUNCTION_ENTRY ();
168
169
170 /* Purge all objects in the cache */
165 171
166 status = acpi_os_purge_cache (cache); 172 status = acpi_os_purge_cache (cache);
167 if (ACPI_FAILURE (status)) { 173 if (ACPI_FAILURE (status)) {
@@ -259,7 +265,7 @@ acpi_os_acquire_object (
259 void *object; 265 void *object;
260 266
261 267
262 ACPI_FUNCTION_NAME ("ut_acquire_from_cache"); 268 ACPI_FUNCTION_NAME ("os_acquire_object");
263 269
264 270
265 if (!cache) { 271 if (!cache) {
@@ -286,7 +292,7 @@ acpi_os_acquire_object (
286 292
287 ACPI_MEM_TRACKING (cache->hits++); 293 ACPI_MEM_TRACKING (cache->hits++);
288 ACPI_MEM_TRACKING (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 294 ACPI_MEM_TRACKING (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
289 "Object %p from %s\n", object, cache->list_name))); 295 "Object %p from %s cache\n", object, cache->list_name)));
290 296
291 status = acpi_ut_release_mutex (ACPI_MTX_CACHES); 297 status = acpi_ut_release_mutex (ACPI_MTX_CACHES);
292 if (ACPI_FAILURE (status)) { 298 if (ACPI_FAILURE (status)) {
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
index 08362f686ec1..3d5fbc810b0b 100644
--- a/drivers/acpi/utilities/utdebug.c
+++ b/drivers/acpi/utilities/utdebug.c
@@ -116,10 +116,9 @@ acpi_ut_track_stack_ptr (
116 * 116 *
117 * PARAMETERS: requested_debug_level - Requested debug print level 117 * PARAMETERS: requested_debug_level - Requested debug print level
118 * line_number - Caller's line number (for error output) 118 * line_number - Caller's line number (for error output)
119 * dbg_info - Contains: 119 * function_name - Caller's procedure name
120 * proc_name - Caller's procedure name 120 * module_name - Caller's module name
121 * module_name - Caller's module name 121 * component_id - Caller's component ID
122 * component_id - Caller's component ID
123 * Format - Printf format field 122 * Format - Printf format field
124 * ... - Optional printf arguments 123 * ... - Optional printf arguments
125 * 124 *
@@ -134,7 +133,9 @@ void ACPI_INTERNAL_VAR_XFACE
134acpi_ut_debug_print ( 133acpi_ut_debug_print (
135 u32 requested_debug_level, 134 u32 requested_debug_level,
136 u32 line_number, 135 u32 line_number,
137 struct acpi_debug_print_info *dbg_info, 136 char *function_name,
137 char *module_name,
138 u32 component_id,
138 char *format, 139 char *format,
139 ...) 140 ...)
140{ 141{
@@ -146,7 +147,7 @@ acpi_ut_debug_print (
146 * Stay silent if the debug level or component ID is disabled 147 * Stay silent if the debug level or component ID is disabled
147 */ 148 */
148 if (!(requested_debug_level & acpi_dbg_level) || 149 if (!(requested_debug_level & acpi_dbg_level) ||
149 !(dbg_info->component_id & acpi_dbg_layer)) { 150 !(component_id & acpi_dbg_layer)) {
150 return; 151 return;
151 } 152 }
152 153
@@ -169,14 +170,14 @@ acpi_ut_debug_print (
169 * Display the module name, current line number, thread ID (if requested), 170 * Display the module name, current line number, thread ID (if requested),
170 * current procedure nesting level, and the current procedure name 171 * current procedure nesting level, and the current procedure name
171 */ 172 */
172 acpi_os_printf ("%8s-%04ld ", dbg_info->module_name, line_number); 173 acpi_os_printf ("%8s-%04ld ", module_name, line_number);
173 174
174 if (ACPI_LV_THREADS & acpi_dbg_level) { 175 if (ACPI_LV_THREADS & acpi_dbg_level) {
175 acpi_os_printf ("[%04lX] ", thread_id); 176 acpi_os_printf ("[%04lX] ", thread_id);
176 } 177 }
177 178
178 acpi_os_printf ("[%02ld] %-22.22s: ", 179 acpi_os_printf ("[%02ld] %-22.22s: ",
179 acpi_gbl_nesting_level, dbg_info->proc_name); 180 acpi_gbl_nesting_level, function_name);
180 181
181 va_start (args, format); 182 va_start (args, format);
182 acpi_os_vprintf (format, args); 183 acpi_os_vprintf (format, args);
@@ -190,10 +191,9 @@ EXPORT_SYMBOL(acpi_ut_debug_print);
190 * 191 *
191 * PARAMETERS: requested_debug_level - Requested debug print level 192 * PARAMETERS: requested_debug_level - Requested debug print level
192 * line_number - Caller's line number 193 * line_number - Caller's line number
193 * dbg_info - Contains: 194 * function_name - Caller's procedure name
194 * proc_name - Caller's procedure name 195 * module_name - Caller's module name
195 * module_name - Caller's module name 196 * component_id - Caller's component ID
196 * component_id - Caller's component ID
197 * Format - Printf format field 197 * Format - Printf format field
198 * ... - Optional printf arguments 198 * ... - Optional printf arguments
199 * 199 *
@@ -208,7 +208,9 @@ void ACPI_INTERNAL_VAR_XFACE
208acpi_ut_debug_print_raw ( 208acpi_ut_debug_print_raw (
209 u32 requested_debug_level, 209 u32 requested_debug_level,
210 u32 line_number, 210 u32 line_number,
211 struct acpi_debug_print_info *dbg_info, 211 char *function_name,
212 char *module_name,
213 u32 component_id,
212 char *format, 214 char *format,
213 ...) 215 ...)
214{ 216{
@@ -216,7 +218,7 @@ acpi_ut_debug_print_raw (
216 218
217 219
218 if (!(requested_debug_level & acpi_dbg_level) || 220 if (!(requested_debug_level & acpi_dbg_level) ||
219 !(dbg_info->component_id & acpi_dbg_layer)) { 221 !(component_id & acpi_dbg_layer)) {
220 return; 222 return;
221 } 223 }
222 224
@@ -231,10 +233,9 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw);
231 * FUNCTION: acpi_ut_trace 233 * FUNCTION: acpi_ut_trace
232 * 234 *
233 * PARAMETERS: line_number - Caller's line number 235 * PARAMETERS: line_number - Caller's line number
234 * dbg_info - Contains: 236 * function_name - Caller's procedure name
235 * proc_name - Caller's procedure name 237 * module_name - Caller's module name
236 * module_name - Caller's module name 238 * component_id - Caller's component ID
237 * component_id - Caller's component ID
238 * 239 *
239 * RETURN: None 240 * RETURN: None
240 * 241 *
@@ -246,14 +247,17 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw);
246void 247void
247acpi_ut_trace ( 248acpi_ut_trace (
248 u32 line_number, 249 u32 line_number,
249 struct acpi_debug_print_info *dbg_info) 250 char *function_name,
251 char *module_name,
252 u32 component_id)
250{ 253{
251 254
252 acpi_gbl_nesting_level++; 255 acpi_gbl_nesting_level++;
253 acpi_ut_track_stack_ptr (); 256 acpi_ut_track_stack_ptr ();
254 257
255 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 258 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
256 "%s\n", acpi_gbl_fn_entry_str); 259 line_number, function_name, module_name, component_id,
260 "%s\n", acpi_gbl_fn_entry_str);
257} 261}
258EXPORT_SYMBOL(acpi_ut_trace); 262EXPORT_SYMBOL(acpi_ut_trace);
259 263
@@ -263,10 +267,9 @@ EXPORT_SYMBOL(acpi_ut_trace);
263 * FUNCTION: acpi_ut_trace_ptr 267 * FUNCTION: acpi_ut_trace_ptr
264 * 268 *
265 * PARAMETERS: line_number - Caller's line number 269 * PARAMETERS: line_number - Caller's line number
266 * dbg_info - Contains: 270 * function_name - Caller's procedure name
267 * proc_name - Caller's procedure name 271 * module_name - Caller's module name
268 * module_name - Caller's module name 272 * component_id - Caller's component ID
269 * component_id - Caller's component ID
270 * Pointer - Pointer to display 273 * Pointer - Pointer to display
271 * 274 *
272 * RETURN: None 275 * RETURN: None
@@ -279,14 +282,17 @@ EXPORT_SYMBOL(acpi_ut_trace);
279void 282void
280acpi_ut_trace_ptr ( 283acpi_ut_trace_ptr (
281 u32 line_number, 284 u32 line_number,
282 struct acpi_debug_print_info *dbg_info, 285 char *function_name,
286 char *module_name,
287 u32 component_id,
283 void *pointer) 288 void *pointer)
284{ 289{
285 acpi_gbl_nesting_level++; 290 acpi_gbl_nesting_level++;
286 acpi_ut_track_stack_ptr (); 291 acpi_ut_track_stack_ptr ();
287 292
288 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 293 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
289 "%s %p\n", acpi_gbl_fn_entry_str, pointer); 294 line_number, function_name, module_name, component_id,
295 "%s %p\n", acpi_gbl_fn_entry_str, pointer);
290} 296}
291 297
292 298
@@ -295,10 +301,9 @@ acpi_ut_trace_ptr (
295 * FUNCTION: acpi_ut_trace_str 301 * FUNCTION: acpi_ut_trace_str
296 * 302 *
297 * PARAMETERS: line_number - Caller's line number 303 * PARAMETERS: line_number - Caller's line number
298 * dbg_info - Contains: 304 * function_name - Caller's procedure name
299 * proc_name - Caller's procedure name 305 * module_name - Caller's module name
300 * module_name - Caller's module name 306 * component_id - Caller's component ID
301 * component_id - Caller's component ID
302 * String - Additional string to display 307 * String - Additional string to display
303 * 308 *
304 * RETURN: None 309 * RETURN: None
@@ -311,15 +316,18 @@ acpi_ut_trace_ptr (
311void 316void
312acpi_ut_trace_str ( 317acpi_ut_trace_str (
313 u32 line_number, 318 u32 line_number,
314 struct acpi_debug_print_info *dbg_info, 319 char *function_name,
320 char *module_name,
321 u32 component_id,
315 char *string) 322 char *string)
316{ 323{
317 324
318 acpi_gbl_nesting_level++; 325 acpi_gbl_nesting_level++;
319 acpi_ut_track_stack_ptr (); 326 acpi_ut_track_stack_ptr ();
320 327
321 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 328 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
322 "%s %s\n", acpi_gbl_fn_entry_str, string); 329 line_number, function_name, module_name, component_id,
330 "%s %s\n", acpi_gbl_fn_entry_str, string);
323} 331}
324 332
325 333
@@ -328,10 +336,9 @@ acpi_ut_trace_str (
328 * FUNCTION: acpi_ut_trace_u32 336 * FUNCTION: acpi_ut_trace_u32
329 * 337 *
330 * PARAMETERS: line_number - Caller's line number 338 * PARAMETERS: line_number - Caller's line number
331 * dbg_info - Contains: 339 * function_name - Caller's procedure name
332 * proc_name - Caller's procedure name 340 * module_name - Caller's module name
333 * module_name - Caller's module name 341 * component_id - Caller's component ID
334 * component_id - Caller's component ID
335 * Integer - Integer to display 342 * Integer - Integer to display
336 * 343 *
337 * RETURN: None 344 * RETURN: None
@@ -344,15 +351,18 @@ acpi_ut_trace_str (
344void 351void
345acpi_ut_trace_u32 ( 352acpi_ut_trace_u32 (
346 u32 line_number, 353 u32 line_number,
347 struct acpi_debug_print_info *dbg_info, 354 char *function_name,
355 char *module_name,
356 u32 component_id,
348 u32 integer) 357 u32 integer)
349{ 358{
350 359
351 acpi_gbl_nesting_level++; 360 acpi_gbl_nesting_level++;
352 acpi_ut_track_stack_ptr (); 361 acpi_ut_track_stack_ptr ();
353 362
354 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 363 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
355 "%s %08X\n", acpi_gbl_fn_entry_str, integer); 364 line_number, function_name, module_name, component_id,
365 "%s %08X\n", acpi_gbl_fn_entry_str, integer);
356} 366}
357 367
358 368
@@ -361,10 +371,9 @@ acpi_ut_trace_u32 (
361 * FUNCTION: acpi_ut_exit 371 * FUNCTION: acpi_ut_exit
362 * 372 *
363 * PARAMETERS: line_number - Caller's line number 373 * PARAMETERS: line_number - Caller's line number
364 * dbg_info - Contains: 374 * function_name - Caller's procedure name
365 * proc_name - Caller's procedure name 375 * module_name - Caller's module name
366 * module_name - Caller's module name 376 * component_id - Caller's component ID
367 * component_id - Caller's component ID
368 * 377 *
369 * RETURN: None 378 * RETURN: None
370 * 379 *
@@ -376,11 +385,14 @@ acpi_ut_trace_u32 (
376void 385void
377acpi_ut_exit ( 386acpi_ut_exit (
378 u32 line_number, 387 u32 line_number,
379 struct acpi_debug_print_info *dbg_info) 388 char *function_name,
389 char *module_name,
390 u32 component_id)
380{ 391{
381 392
382 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 393 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
383 "%s\n", acpi_gbl_fn_exit_str); 394 line_number, function_name, module_name, component_id,
395 "%s\n", acpi_gbl_fn_exit_str);
384 396
385 acpi_gbl_nesting_level--; 397 acpi_gbl_nesting_level--;
386} 398}
@@ -392,10 +404,9 @@ EXPORT_SYMBOL(acpi_ut_exit);
392 * FUNCTION: acpi_ut_status_exit 404 * FUNCTION: acpi_ut_status_exit
393 * 405 *
394 * PARAMETERS: line_number - Caller's line number 406 * PARAMETERS: line_number - Caller's line number
395 * dbg_info - Contains: 407 * function_name - Caller's procedure name
396 * proc_name - Caller's procedure name 408 * module_name - Caller's module name
397 * module_name - Caller's module name 409 * component_id - Caller's component ID
398 * component_id - Caller's component ID
399 * Status - Exit status code 410 * Status - Exit status code
400 * 411 *
401 * RETURN: None 412 * RETURN: None
@@ -408,19 +419,23 @@ EXPORT_SYMBOL(acpi_ut_exit);
408void 419void
409acpi_ut_status_exit ( 420acpi_ut_status_exit (
410 u32 line_number, 421 u32 line_number,
411 struct acpi_debug_print_info *dbg_info, 422 char *function_name,
423 char *module_name,
424 u32 component_id,
412 acpi_status status) 425 acpi_status status)
413{ 426{
414 427
415 if (ACPI_SUCCESS (status)) { 428 if (ACPI_SUCCESS (status)) {
416 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 429 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
417 "%s %s\n", acpi_gbl_fn_exit_str, 430 line_number, function_name, module_name, component_id,
418 acpi_format_exception (status)); 431 "%s %s\n", acpi_gbl_fn_exit_str,
432 acpi_format_exception (status));
419 } 433 }
420 else { 434 else {
421 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 435 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
422 "%s ****Exception****: %s\n", acpi_gbl_fn_exit_str, 436 line_number, function_name, module_name, component_id,
423 acpi_format_exception (status)); 437 "%s ****Exception****: %s\n", acpi_gbl_fn_exit_str,
438 acpi_format_exception (status));
424 } 439 }
425 440
426 acpi_gbl_nesting_level--; 441 acpi_gbl_nesting_level--;
@@ -433,10 +448,9 @@ EXPORT_SYMBOL(acpi_ut_status_exit);
433 * FUNCTION: acpi_ut_value_exit 448 * FUNCTION: acpi_ut_value_exit
434 * 449 *
435 * PARAMETERS: line_number - Caller's line number 450 * PARAMETERS: line_number - Caller's line number
436 * dbg_info - Contains: 451 * function_name - Caller's procedure name
437 * proc_name - Caller's procedure name 452 * module_name - Caller's module name
438 * module_name - Caller's module name 453 * component_id - Caller's component ID
439 * component_id - Caller's component ID
440 * Value - Value to be printed with exit msg 454 * Value - Value to be printed with exit msg
441 * 455 *
442 * RETURN: None 456 * RETURN: None
@@ -449,13 +463,16 @@ EXPORT_SYMBOL(acpi_ut_status_exit);
449void 463void
450acpi_ut_value_exit ( 464acpi_ut_value_exit (
451 u32 line_number, 465 u32 line_number,
452 struct acpi_debug_print_info *dbg_info, 466 char *function_name,
467 char *module_name,
468 u32 component_id,
453 acpi_integer value) 469 acpi_integer value)
454{ 470{
455 471
456 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 472 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
457 "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str, 473 line_number, function_name, module_name, component_id,
458 ACPI_FORMAT_UINT64 (value)); 474 "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str,
475 ACPI_FORMAT_UINT64 (value));
459 476
460 acpi_gbl_nesting_level--; 477 acpi_gbl_nesting_level--;
461} 478}
@@ -467,10 +484,9 @@ EXPORT_SYMBOL(acpi_ut_value_exit);
467 * FUNCTION: acpi_ut_ptr_exit 484 * FUNCTION: acpi_ut_ptr_exit
468 * 485 *
469 * PARAMETERS: line_number - Caller's line number 486 * PARAMETERS: line_number - Caller's line number
470 * dbg_info - Contains: 487 * function_name - Caller's procedure name
471 * proc_name - Caller's procedure name 488 * module_name - Caller's module name
472 * module_name - Caller's module name 489 * component_id - Caller's component ID
473 * component_id - Caller's component ID
474 * Ptr - Pointer to display 490 * Ptr - Pointer to display
475 * 491 *
476 * RETURN: None 492 * RETURN: None
@@ -483,12 +499,15 @@ EXPORT_SYMBOL(acpi_ut_value_exit);
483void 499void
484acpi_ut_ptr_exit ( 500acpi_ut_ptr_exit (
485 u32 line_number, 501 u32 line_number,
486 struct acpi_debug_print_info *dbg_info, 502 char *function_name,
503 char *module_name,
504 u32 component_id,
487 u8 *ptr) 505 u8 *ptr)
488{ 506{
489 507
490 acpi_ut_debug_print (ACPI_LV_FUNCTIONS, line_number, dbg_info, 508 acpi_ut_debug_print (ACPI_LV_FUNCTIONS,
491 "%s %p\n", acpi_gbl_fn_exit_str, ptr); 509 line_number, function_name, module_name, component_id,
510 "%s %p\n", acpi_gbl_fn_exit_str, ptr);
492 511
493 acpi_gbl_nesting_level--; 512 acpi_gbl_nesting_level--;
494} 513}
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
index be97ada23c3d..eeafb324c504 100644
--- a/drivers/acpi/utilities/utdelete.c
+++ b/drivers/acpi/utilities/utdelete.c
@@ -435,35 +435,24 @@ acpi_ut_update_object_reference (
435 union acpi_operand_object *object, 435 union acpi_operand_object *object,
436 u16 action) 436 u16 action)
437{ 437{
438 acpi_status status; 438 acpi_status status = AE_OK;
439 u32 i; 439 union acpi_generic_state *state_list = NULL;
440 union acpi_generic_state *state_list = NULL; 440 union acpi_operand_object *next_object = NULL;
441 union acpi_generic_state *state; 441 union acpi_generic_state *state;
442 acpi_native_uint i;
442 443
443 444
444 ACPI_FUNCTION_TRACE_PTR ("ut_update_object_reference", object); 445 ACPI_FUNCTION_TRACE_PTR ("ut_update_object_reference", object);
445 446
446 447
447 /* Ignore a null object ptr */ 448 while (object) {
449 /* Make sure that this isn't a namespace handle */
448 450
449 if (!object) { 451 if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) {
450 return_ACPI_STATUS (AE_OK); 452 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
451 } 453 "Object %p is NS handle\n", object));
452 454 return_ACPI_STATUS (AE_OK);
453 /* Make sure that this isn't a namespace handle */ 455 }
454
455 if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) {
456 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
457 "Object %p is NS handle\n", object));
458 return_ACPI_STATUS (AE_OK);
459 }
460
461 state = acpi_ut_create_update_state (object, action);
462
463 while (state) {
464 object = state->update.object;
465 action = state->update.value;
466 acpi_ut_delete_generic_state (state);
467 456
468 /* 457 /*
469 * All sub-objects must have their reference count incremented also. 458 * All sub-objects must have their reference count incremented also.
@@ -476,12 +465,10 @@ acpi_ut_update_object_reference (
476 acpi_ut_update_ref_count (object->device.device_notify, action); 465 acpi_ut_update_ref_count (object->device.device_notify, action);
477 break; 466 break;
478 467
479
480 case ACPI_TYPE_PACKAGE: 468 case ACPI_TYPE_PACKAGE:
481
482 /* 469 /*
483 * We must update all the sub-objects of the package 470 * We must update all the sub-objects of the package,
484 * (Each of whom may have their own sub-objects, etc. 471 * each of whom may have their own sub-objects.
485 */ 472 */
486 for (i = 0; i < object->package.count; i++) { 473 for (i = 0; i < object->package.count; i++) {
487 /* 474 /*
@@ -497,35 +484,19 @@ acpi_ut_update_object_reference (
497 } 484 }
498 break; 485 break;
499 486
500
501 case ACPI_TYPE_BUFFER_FIELD: 487 case ACPI_TYPE_BUFFER_FIELD:
502 488
503 status = acpi_ut_create_update_state_and_push ( 489 next_object = object->buffer_field.buffer_obj;
504 object->buffer_field.buffer_obj, action, &state_list);
505 if (ACPI_FAILURE (status)) {
506 goto error_exit;
507 }
508 break; 490 break;
509 491
510
511 case ACPI_TYPE_LOCAL_REGION_FIELD: 492 case ACPI_TYPE_LOCAL_REGION_FIELD:
512 493
513 status = acpi_ut_create_update_state_and_push ( 494 next_object = object->field.region_obj;
514 object->field.region_obj, action, &state_list); 495 break;
515 if (ACPI_FAILURE (status)) {
516 goto error_exit;
517 }
518 break;
519
520 496
521 case ACPI_TYPE_LOCAL_BANK_FIELD: 497 case ACPI_TYPE_LOCAL_BANK_FIELD:
522 498
523 status = acpi_ut_create_update_state_and_push ( 499 next_object = object->bank_field.bank_obj;
524 object->bank_field.bank_obj, action, &state_list);
525 if (ACPI_FAILURE (status)) {
526 goto error_exit;
527 }
528
529 status = acpi_ut_create_update_state_and_push ( 500 status = acpi_ut_create_update_state_and_push (
530 object->bank_field.region_obj, action, &state_list); 501 object->bank_field.region_obj, action, &state_list);
531 if (ACPI_FAILURE (status)) { 502 if (ACPI_FAILURE (status)) {
@@ -533,15 +504,9 @@ acpi_ut_update_object_reference (
533 } 504 }
534 break; 505 break;
535 506
536
537 case ACPI_TYPE_LOCAL_INDEX_FIELD: 507 case ACPI_TYPE_LOCAL_INDEX_FIELD:
538 508
539 status = acpi_ut_create_update_state_and_push ( 509 next_object = object->index_field.index_obj;
540 object->index_field.index_obj, action, &state_list);
541 if (ACPI_FAILURE (status)) {
542 goto error_exit;
543 }
544
545 status = acpi_ut_create_update_state_and_push ( 510 status = acpi_ut_create_update_state_and_push (
546 object->index_field.data_obj, action, &state_list); 511 object->index_field.data_obj, action, &state_list);
547 if (ACPI_FAILURE (status)) { 512 if (ACPI_FAILURE (status)) {
@@ -549,28 +514,19 @@ acpi_ut_update_object_reference (
549 } 514 }
550 break; 515 break;
551 516
552
553 case ACPI_TYPE_LOCAL_REFERENCE: 517 case ACPI_TYPE_LOCAL_REFERENCE:
554
555 /* 518 /*
556 * The target of an Index (a package, string, or buffer) must track 519 * The target of an Index (a package, string, or buffer) must track
557 * changes to the ref count of the index. 520 * changes to the ref count of the index.
558 */ 521 */
559 if (object->reference.opcode == AML_INDEX_OP) { 522 if (object->reference.opcode == AML_INDEX_OP) {
560 status = acpi_ut_create_update_state_and_push ( 523 next_object = object->reference.object;
561 object->reference.object, action, &state_list);
562 if (ACPI_FAILURE (status)) {
563 goto error_exit;
564 }
565 } 524 }
566 break; 525 break;
567 526
568
569 case ACPI_TYPE_REGION: 527 case ACPI_TYPE_REGION:
570 default: 528 default:
571 529 break;/* No subobjects */
572 /* No subobjects */
573 break;
574 } 530 }
575 531
576 /* 532 /*
@@ -579,15 +535,23 @@ acpi_ut_update_object_reference (
579 * main object to be deleted. 535 * main object to be deleted.
580 */ 536 */
581 acpi_ut_update_ref_count (object, action); 537 acpi_ut_update_ref_count (object, action);
538 object = NULL;
582 539
583 /* Move on to the next object to be updated */ 540 /* Move on to the next object to be updated */
584 541
585 state = acpi_ut_pop_generic_state (&state_list); 542 if (next_object) {
543 object = next_object;
544 next_object = NULL;
545 }
546 else if (state_list) {
547 state = acpi_ut_pop_generic_state (&state_list);
548 object = state->update.object;
549 acpi_ut_delete_generic_state (state);
550 }
586 } 551 }
587 552
588 return_ACPI_STATUS (AE_OK); 553 return_ACPI_STATUS (AE_OK);
589 554
590
591error_exit: 555error_exit:
592 556
593 ACPI_REPORT_ERROR (("Could not update object reference count, %s\n", 557 ACPI_REPORT_ERROR (("Could not update object reference count, %s\n",
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 8653dda4f813..0e4161c81076 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -738,73 +738,6 @@ acpi_ut_valid_object_type (
738 738
739/******************************************************************************* 739/*******************************************************************************
740 * 740 *
741 * FUNCTION: acpi_ut_allocate_owner_id
742 *
743 * PARAMETERS: id_type - Type of ID (method or table)
744 *
745 * DESCRIPTION: Allocate a table or method owner id
746 *
747 * NOTE: this algorithm has a wraparound problem at 64_k method invocations, and
748 * should be revisited (TBD)
749 *
750 ******************************************************************************/
751
752acpi_owner_id
753acpi_ut_allocate_owner_id (
754 u32 id_type)
755{
756 acpi_owner_id owner_id = 0xFFFF;
757
758
759 ACPI_FUNCTION_TRACE ("ut_allocate_owner_id");
760
761
762 if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES)))
763 {
764 return (0);
765 }
766
767 switch (id_type)
768 {
769 case ACPI_OWNER_TYPE_TABLE:
770
771 owner_id = acpi_gbl_next_table_owner_id;
772 acpi_gbl_next_table_owner_id++;
773
774 /* Check for wraparound */
775
776 if (acpi_gbl_next_table_owner_id == ACPI_FIRST_METHOD_ID)
777 {
778 acpi_gbl_next_table_owner_id = ACPI_FIRST_TABLE_ID;
779 ACPI_REPORT_WARNING (("Table owner ID wraparound\n"));
780 }
781 break;
782
783
784 case ACPI_OWNER_TYPE_METHOD:
785
786 owner_id = acpi_gbl_next_method_owner_id;
787 acpi_gbl_next_method_owner_id++;
788
789 if (acpi_gbl_next_method_owner_id == ACPI_FIRST_TABLE_ID)
790 {
791 /* Check for wraparound */
792
793 acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID;
794 }
795 break;
796
797 default:
798 break;
799 }
800
801 (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
802 return_VALUE (owner_id);
803}
804
805
806/*******************************************************************************
807 *
808 * FUNCTION: acpi_ut_init_globals 741 * FUNCTION: acpi_ut_init_globals
809 * 742 *
810 * PARAMETERS: None 743 * PARAMETERS: None
@@ -848,7 +781,7 @@ acpi_ut_init_globals (
848 for (i = 0; i < NUM_MUTEX; i++) 781 for (i = 0; i < NUM_MUTEX; i++)
849 { 782 {
850 acpi_gbl_mutex_info[i].mutex = NULL; 783 acpi_gbl_mutex_info[i].mutex = NULL;
851 acpi_gbl_mutex_info[i].owner_id = ACPI_MUTEX_NOT_ACQUIRED; 784 acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
852 acpi_gbl_mutex_info[i].use_count = 0; 785 acpi_gbl_mutex_info[i].use_count = 0;
853 } 786 }
854 787
@@ -889,8 +822,7 @@ acpi_ut_init_globals (
889 acpi_gbl_ns_lookup_count = 0; 822 acpi_gbl_ns_lookup_count = 0;
890 acpi_gbl_ps_find_count = 0; 823 acpi_gbl_ps_find_count = 0;
891 acpi_gbl_acpi_hardware_present = TRUE; 824 acpi_gbl_acpi_hardware_present = TRUE;
892 acpi_gbl_next_table_owner_id = ACPI_FIRST_TABLE_ID; 825 acpi_gbl_owner_id_mask = 0;
893 acpi_gbl_next_method_owner_id = ACPI_FIRST_METHOD_ID;
894 acpi_gbl_debugger_configuration = DEBUGGER_THREADING; 826 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
895 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; 827 acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
896 828
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 207c836aec64..df715cd89105 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -52,6 +52,100 @@
52 52
53/******************************************************************************* 53/*******************************************************************************
54 * 54 *
55 * FUNCTION: acpi_ut_allocate_owner_id
56 *
57 * PARAMETERS: owner_id - Where the new owner ID is returned
58 *
59 * DESCRIPTION: Allocate a table or method owner id
60 *
61 ******************************************************************************/
62
63acpi_status
64acpi_ut_allocate_owner_id (
65 acpi_owner_id *owner_id)
66{
67 acpi_native_uint i;
68 acpi_status status;
69
70
71 ACPI_FUNCTION_TRACE ("ut_allocate_owner_id");
72
73
74 status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
75 if (ACPI_FAILURE (status)) {
76 return_ACPI_STATUS (status);
77 }
78
79 /* Find a free owner ID */
80
81 for (i = 0; i < 32; i++) {
82 if (!(acpi_gbl_owner_id_mask & (1 << i))) {
83 acpi_gbl_owner_id_mask |= (1 << i);
84 *owner_id = (acpi_owner_id) i;
85 goto exit;
86 }
87 }
88
89 /*
90 * If we are here, all owner_ids have been allocated. This probably should
91 * not happen since the IDs are reused after deallocation. The IDs are
92 * allocated upon table load (one per table) and method execution, and
93 * they are released when a table is unloaded or a method completes
94 * execution.
95 */
96 status = AE_OWNER_ID_LIMIT;
97 ACPI_REPORT_ERROR ((
98 "Could not allocate new owner_id (32 max), AE_OWNER_ID_LIMIT\n"));
99
100exit:
101 (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
102 return_ACPI_STATUS (status);
103}
104
105
106/*******************************************************************************
107 *
108 * FUNCTION: acpi_ut_release_owner_id
109 *
110 * PARAMETERS: owner_id - A previously allocated owner ID
111 *
112 * DESCRIPTION: Release a table or method owner id
113 *
114 ******************************************************************************/
115
116acpi_status
117acpi_ut_release_owner_id (
118 acpi_owner_id owner_id)
119{
120 acpi_status status;
121
122
123 ACPI_FUNCTION_TRACE ("ut_release_owner_id");
124
125
126 status = acpi_ut_acquire_mutex (ACPI_MTX_CACHES);
127 if (ACPI_FAILURE (status)) {
128 return_ACPI_STATUS (status);
129 }
130
131 /* Free the owner ID */
132
133 if (acpi_gbl_owner_id_mask & (1 << owner_id)) {
134 acpi_gbl_owner_id_mask ^= (1 << owner_id);
135 }
136 else {
137 /* This owner_id has not been allocated */
138
139 status = AE_NOT_EXIST;
140 }
141
142 (void) acpi_ut_release_mutex (ACPI_MTX_CACHES);
143 return_ACPI_STATUS (status);
144}
145
146
147/*******************************************************************************
148 *
55 * FUNCTION: acpi_ut_strupr (strupr) 149 * FUNCTION: acpi_ut_strupr (strupr)
56 * 150 *
57 * PARAMETERS: src_string - The source string to convert 151 * PARAMETERS: src_string - The source string to convert
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c
index a80b97cb2e56..0699b6be62b6 100644
--- a/drivers/acpi/utilities/utmutex.c
+++ b/drivers/acpi/utilities/utmutex.c
@@ -159,7 +159,7 @@ acpi_ut_create_mutex (
159 if (!acpi_gbl_mutex_info[mutex_id].mutex) { 159 if (!acpi_gbl_mutex_info[mutex_id].mutex) {
160 status = acpi_os_create_semaphore (1, 1, 160 status = acpi_os_create_semaphore (1, 1,
161 &acpi_gbl_mutex_info[mutex_id].mutex); 161 &acpi_gbl_mutex_info[mutex_id].mutex);
162 acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; 162 acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
163 acpi_gbl_mutex_info[mutex_id].use_count = 0; 163 acpi_gbl_mutex_info[mutex_id].use_count = 0;
164 } 164 }
165 165
@@ -196,7 +196,7 @@ acpi_ut_delete_mutex (
196 status = acpi_os_delete_semaphore (acpi_gbl_mutex_info[mutex_id].mutex); 196 status = acpi_os_delete_semaphore (acpi_gbl_mutex_info[mutex_id].mutex);
197 197
198 acpi_gbl_mutex_info[mutex_id].mutex = NULL; 198 acpi_gbl_mutex_info[mutex_id].mutex = NULL;
199 acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; 199 acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
200 200
201 return_ACPI_STATUS (status); 201 return_ACPI_STATUS (status);
202} 202}
@@ -274,7 +274,7 @@ acpi_ut_acquire_mutex (
274 this_thread_id, acpi_ut_get_mutex_name (mutex_id))); 274 this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
275 275
276 acpi_gbl_mutex_info[mutex_id].use_count++; 276 acpi_gbl_mutex_info[mutex_id].use_count++;
277 acpi_gbl_mutex_info[mutex_id].owner_id = this_thread_id; 277 acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id;
278 } 278 }
279 else { 279 else {
280 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 280 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
@@ -322,7 +322,7 @@ acpi_ut_release_mutex (
322 /* 322 /*
323 * Mutex must be acquired in order to release it! 323 * Mutex must be acquired in order to release it!
324 */ 324 */
325 if (acpi_gbl_mutex_info[mutex_id].owner_id == ACPI_MUTEX_NOT_ACQUIRED) { 325 if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) {
326 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 326 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
327 "Mutex [%s] is not acquired, cannot release\n", 327 "Mutex [%s] is not acquired, cannot release\n",
328 acpi_ut_get_mutex_name (mutex_id))); 328 acpi_ut_get_mutex_name (mutex_id)));
@@ -359,7 +359,7 @@ acpi_ut_release_mutex (
359 359
360 /* Mark unlocked FIRST */ 360 /* Mark unlocked FIRST */
361 361
362 acpi_gbl_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; 362 acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
363 363
364 status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1); 364 status = acpi_os_signal_semaphore (acpi_gbl_mutex_info[mutex_id].mutex, 1);
365 365