aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities')
-rw-r--r--drivers/acpi/utilities/utalloc.c634
-rw-r--r--drivers/acpi/utilities/utcache.c18
-rw-r--r--drivers/acpi/utilities/utcopy.c41
-rw-r--r--drivers/acpi/utilities/utdebug.c65
-rw-r--r--drivers/acpi/utilities/utdelete.c62
-rw-r--r--drivers/acpi/utilities/uteval.c141
-rw-r--r--drivers/acpi/utilities/utglobal.c62
-rw-r--r--drivers/acpi/utilities/utinit.c26
-rw-r--r--drivers/acpi/utilities/utmath.c8
-rw-r--r--drivers/acpi/utilities/utmisc.c293
-rw-r--r--drivers/acpi/utilities/utmutex.c42
-rw-r--r--drivers/acpi/utilities/utobject.c23
-rw-r--r--drivers/acpi/utilities/utresrc.c256
-rw-r--r--drivers/acpi/utilities/utstate.c36
-rw-r--r--drivers/acpi/utilities/utxface.c44
15 files changed, 716 insertions, 1035 deletions
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index 03b0044974c2..7940fc1bd69e 100644
--- a/drivers/acpi/utilities/utalloc.c
+++ b/drivers/acpi/utilities/utalloc.c
@@ -46,24 +46,6 @@
46#define _COMPONENT ACPI_UTILITIES 46#define _COMPONENT ACPI_UTILITIES
47ACPI_MODULE_NAME("utalloc") 47ACPI_MODULE_NAME("utalloc")
48 48
49/* Local prototypes */
50#ifdef ACPI_DBG_TRACK_ALLOCATIONS
51static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation);
52
53static acpi_status
54acpi_ut_track_allocation(struct acpi_debug_mem_block *address,
55 acpi_size size,
56 u8 alloc_type, u32 component, char *module, u32 line);
57
58static acpi_status
59acpi_ut_remove_allocation(struct acpi_debug_mem_block *address,
60 u32 component, char *module, u32 line);
61
62static acpi_status
63acpi_ut_create_list(char *list_name,
64 u16 object_size, struct acpi_memory_list **return_cache);
65#endif
66
67/******************************************************************************* 49/*******************************************************************************
68 * 50 *
69 * FUNCTION: acpi_ut_create_caches 51 * FUNCTION: acpi_ut_create_caches
@@ -75,33 +57,23 @@ acpi_ut_create_list(char *list_name,
75 * DESCRIPTION: Create all local caches 57 * DESCRIPTION: Create all local caches
76 * 58 *
77 ******************************************************************************/ 59 ******************************************************************************/
78
79acpi_status acpi_ut_create_caches(void) 60acpi_status acpi_ut_create_caches(void)
80{ 61{
81 acpi_status status; 62 acpi_status status;
82 63
83#ifdef ACPI_DBG_TRACK_ALLOCATIONS 64 /* Object Caches, for frequently used objects */
84
85 /* Memory allocation lists */
86
87 status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list);
88 if (ACPI_FAILURE(status)) {
89 return (status);
90 }
91 65
92 status = 66 status =
93 acpi_ut_create_list("Acpi-Namespace", 67 acpi_os_create_cache("Acpi-Namespace",
94 sizeof(struct acpi_namespace_node), 68 sizeof(struct acpi_namespace_node),
95 &acpi_gbl_ns_node_list); 69 ACPI_MAX_NAMESPACE_CACHE_DEPTH,
70 &acpi_gbl_namespace_cache);
96 if (ACPI_FAILURE(status)) { 71 if (ACPI_FAILURE(status)) {
97 return (status); 72 return (status);
98 } 73 }
99#endif
100
101 /* Object Caches, for frequently used objects */
102 74
103 status = 75 status =
104 acpi_os_create_cache("acpi_state", sizeof(union acpi_generic_state), 76 acpi_os_create_cache("Acpi-State", sizeof(union acpi_generic_state),
105 ACPI_MAX_STATE_CACHE_DEPTH, 77 ACPI_MAX_STATE_CACHE_DEPTH,
106 &acpi_gbl_state_cache); 78 &acpi_gbl_state_cache);
107 if (ACPI_FAILURE(status)) { 79 if (ACPI_FAILURE(status)) {
@@ -109,7 +81,7 @@ acpi_status acpi_ut_create_caches(void)
109 } 81 }
110 82
111 status = 83 status =
112 acpi_os_create_cache("acpi_parse", 84 acpi_os_create_cache("Acpi-Parse",
113 sizeof(struct acpi_parse_obj_common), 85 sizeof(struct acpi_parse_obj_common),
114 ACPI_MAX_PARSE_CACHE_DEPTH, 86 ACPI_MAX_PARSE_CACHE_DEPTH,
115 &acpi_gbl_ps_node_cache); 87 &acpi_gbl_ps_node_cache);
@@ -118,7 +90,7 @@ acpi_status acpi_ut_create_caches(void)
118 } 90 }
119 91
120 status = 92 status =
121 acpi_os_create_cache("acpi_parse_ext", 93 acpi_os_create_cache("Acpi-ParseExt",
122 sizeof(struct acpi_parse_obj_named), 94 sizeof(struct acpi_parse_obj_named),
123 ACPI_MAX_EXTPARSE_CACHE_DEPTH, 95 ACPI_MAX_EXTPARSE_CACHE_DEPTH,
124 &acpi_gbl_ps_node_ext_cache); 96 &acpi_gbl_ps_node_ext_cache);
@@ -127,7 +99,7 @@ acpi_status acpi_ut_create_caches(void)
127 } 99 }
128 100
129 status = 101 status =
130 acpi_os_create_cache("acpi_operand", 102 acpi_os_create_cache("Acpi-Operand",
131 sizeof(union acpi_operand_object), 103 sizeof(union acpi_operand_object),
132 ACPI_MAX_OBJECT_CACHE_DEPTH, 104 ACPI_MAX_OBJECT_CACHE_DEPTH,
133 &acpi_gbl_operand_cache); 105 &acpi_gbl_operand_cache);
@@ -135,6 +107,24 @@ acpi_status acpi_ut_create_caches(void)
135 return (status); 107 return (status);
136 } 108 }
137 109
110#ifdef ACPI_DBG_TRACK_ALLOCATIONS
111
112 /* Memory allocation lists */
113
114 status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list);
115 if (ACPI_FAILURE(status)) {
116 return (status);
117 }
118
119 status =
120 acpi_ut_create_list("Acpi-Namespace",
121 sizeof(struct acpi_namespace_node),
122 &acpi_gbl_ns_node_list);
123 if (ACPI_FAILURE(status)) {
124 return (status);
125 }
126#endif
127
138 return (AE_OK); 128 return (AE_OK);
139} 129}
140 130
@@ -153,6 +143,9 @@ acpi_status acpi_ut_create_caches(void)
153acpi_status acpi_ut_delete_caches(void) 143acpi_status acpi_ut_delete_caches(void)
154{ 144{
155 145
146 (void)acpi_os_delete_cache(acpi_gbl_namespace_cache);
147 acpi_gbl_namespace_cache = NULL;
148
156 (void)acpi_os_delete_cache(acpi_gbl_state_cache); 149 (void)acpi_os_delete_cache(acpi_gbl_state_cache);
157 acpi_gbl_state_cache = NULL; 150 acpi_gbl_state_cache = NULL;
158 151
@@ -165,6 +158,21 @@ acpi_status acpi_ut_delete_caches(void)
165 (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache); 158 (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache);
166 acpi_gbl_ps_node_ext_cache = NULL; 159 acpi_gbl_ps_node_ext_cache = NULL;
167 160
161#ifdef ACPI_DBG_TRACK_ALLOCATIONS
162
163 /* Debug only - display leftover memory allocation, if any */
164
165 acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL);
166
167 /* Free memory lists */
168
169 acpi_os_free(acpi_gbl_global_list);
170 acpi_gbl_global_list = NULL;
171
172 acpi_os_free(acpi_gbl_ns_node_list);
173 acpi_gbl_ns_node_list = NULL;
174#endif
175
168 return (AE_OK); 176 return (AE_OK);
169} 177}
170 178
@@ -252,7 +260,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
252 260
253 /* Allocate a new buffer with local interface to allow tracking */ 261 /* Allocate a new buffer with local interface to allow tracking */
254 262
255 buffer->pointer = ACPI_MEM_CALLOCATE(required_length); 263 buffer->pointer = ACPI_ALLOCATE_ZEROED(required_length);
256 if (!buffer->pointer) { 264 if (!buffer->pointer) {
257 return (AE_NO_MEMORY); 265 return (AE_NO_MEMORY);
258 } 266 }
@@ -288,7 +296,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
288 * 296 *
289 * RETURN: Address of the allocated memory on success, NULL on failure. 297 * RETURN: Address of the allocated memory on success, NULL on failure.
290 * 298 *
291 * DESCRIPTION: The subsystem's equivalent of malloc. 299 * DESCRIPTION: Subsystem equivalent of malloc.
292 * 300 *
293 ******************************************************************************/ 301 ******************************************************************************/
294 302
@@ -296,23 +304,23 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
296{ 304{
297 void *allocation; 305 void *allocation;
298 306
299 ACPI_FUNCTION_TRACE_U32("ut_allocate", size); 307 ACPI_FUNCTION_TRACE_U32(ut_allocate, size);
300 308
301 /* Check for an inadvertent size of zero bytes */ 309 /* Check for an inadvertent size of zero bytes */
302 310
303 if (!size) { 311 if (!size) {
304 ACPI_ERROR((module, line, 312 ACPI_WARNING((module, line,
305 "ut_allocate: Attempt to allocate zero bytes, allocating 1 byte")); 313 "Attempt to allocate zero bytes, allocating 1 byte"));
306 size = 1; 314 size = 1;
307 } 315 }
308 316
309 allocation = acpi_os_allocate(size); 317 allocation = acpi_os_allocate(size);
310 if (!allocation) { 318 if (!allocation) {
319
311 /* Report allocation error */ 320 /* Report allocation error */
312 321
313 ACPI_ERROR((module, line, 322 ACPI_WARNING((module, line,
314 "ut_allocate: Could not allocate size %X", 323 "Could not allocate size %X", (u32) size));
315 (u32) size));
316 324
317 return_PTR(NULL); 325 return_PTR(NULL);
318 } 326 }
@@ -322,7 +330,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
322 330
323/******************************************************************************* 331/*******************************************************************************
324 * 332 *
325 * FUNCTION: acpi_ut_callocate 333 * FUNCTION: acpi_ut_allocate_zeroed
326 * 334 *
327 * PARAMETERS: Size - Size of the allocation 335 * PARAMETERS: Size - Size of the allocation
328 * Component - Component type of caller 336 * Component - Component type of caller
@@ -331,542 +339,24 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
331 * 339 *
332 * RETURN: Address of the allocated memory on success, NULL on failure. 340 * RETURN: Address of the allocated memory on success, NULL on failure.
333 * 341 *
334 * DESCRIPTION: Subsystem equivalent of calloc. 342 * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory.
335 * 343 *
336 ******************************************************************************/ 344 ******************************************************************************/
337 345
338void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) 346void *acpi_ut_allocate_zeroed(acpi_size size,
347 u32 component, char *module, u32 line)
339{ 348{
340 void *allocation; 349 void *allocation;
341 350
342 ACPI_FUNCTION_TRACE_U32("ut_callocate", size);
343
344 /* Check for an inadvertent size of zero bytes */
345
346 if (!size) {
347 ACPI_ERROR((module, line,
348 "Attempt to allocate zero bytes, allocating 1 byte"));
349 size = 1;
350 }
351
352 allocation = acpi_os_allocate(size);
353 if (!allocation) {
354 /* Report allocation error */
355
356 ACPI_ERROR((module, line,
357 "Could not allocate size %X", (u32) size));
358 return_PTR(NULL);
359 }
360
361 /* Clear the memory block */
362
363 ACPI_MEMSET(allocation, 0, size);
364 return_PTR(allocation);
365}
366
367#ifdef ACPI_DBG_TRACK_ALLOCATIONS
368/*
369 * These procedures are used for tracking memory leaks in the subsystem, and
370 * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set.
371 *
372 * Each memory allocation is tracked via a doubly linked list. Each
373 * element contains the caller's component, module name, function name, and
374 * line number. acpi_ut_allocate and acpi_ut_callocate call
375 * acpi_ut_track_allocation to add an element to the list; deletion
376 * occurs in the body of acpi_ut_free.
377 */
378
379/*******************************************************************************
380 *
381 * FUNCTION: acpi_ut_create_list
382 *
383 * PARAMETERS: cache_name - Ascii name for the cache
384 * object_size - Size of each cached object
385 * return_cache - Where the new cache object is returned
386 *
387 * RETURN: Status
388 *
389 * DESCRIPTION: Create a local memory list for tracking purposed
390 *
391 ******************************************************************************/
392
393static acpi_status
394acpi_ut_create_list(char *list_name,
395 u16 object_size, struct acpi_memory_list **return_cache)
396{
397 struct acpi_memory_list *cache;
398
399 cache = acpi_os_allocate(sizeof(struct acpi_memory_list));
400 if (!cache) {
401 return (AE_NO_MEMORY);
402 }
403
404 ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list));
405
406 cache->list_name = list_name;
407 cache->object_size = object_size;
408
409 *return_cache = cache;
410 return (AE_OK);
411}
412
413/*******************************************************************************
414 *
415 * FUNCTION: acpi_ut_allocate_and_track
416 *
417 * PARAMETERS: Size - Size of the allocation
418 * Component - Component type of caller
419 * Module - Source file name of caller
420 * Line - Line number of caller
421 *
422 * RETURN: Address of the allocated memory on success, NULL on failure.
423 *
424 * DESCRIPTION: The subsystem's equivalent of malloc.
425 *
426 ******************************************************************************/
427
428void *acpi_ut_allocate_and_track(acpi_size size,
429 u32 component, char *module, u32 line)
430{
431 struct acpi_debug_mem_block *allocation;
432 acpi_status status;
433
434 allocation =
435 acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header),
436 component, module, line);
437 if (!allocation) {
438 return (NULL);
439 }
440
441 status = acpi_ut_track_allocation(allocation, size,
442 ACPI_MEM_MALLOC, component, module,
443 line);
444 if (ACPI_FAILURE(status)) {
445 acpi_os_free(allocation);
446 return (NULL);
447 }
448
449 acpi_gbl_global_list->total_allocated++;
450 acpi_gbl_global_list->current_total_size += (u32) size;
451
452 return ((void *)&allocation->user_space);
453}
454
455/*******************************************************************************
456 *
457 * FUNCTION: acpi_ut_callocate_and_track
458 *
459 * PARAMETERS: Size - Size of the allocation
460 * Component - Component type of caller
461 * Module - Source file name of caller
462 * Line - Line number of caller
463 *
464 * RETURN: Address of the allocated memory on success, NULL on failure.
465 *
466 * DESCRIPTION: Subsystem equivalent of calloc.
467 *
468 ******************************************************************************/
469
470void *acpi_ut_callocate_and_track(acpi_size size,
471 u32 component, char *module, u32 line)
472{
473 struct acpi_debug_mem_block *allocation;
474 acpi_status status;
475
476 allocation =
477 acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header),
478 component, module, line);
479 if (!allocation) {
480 /* Report allocation error */
481
482 ACPI_ERROR((module, line,
483 "Could not allocate size %X", (u32) size));
484 return (NULL);
485 }
486
487 status = acpi_ut_track_allocation(allocation, size,
488 ACPI_MEM_CALLOC, component, module,
489 line);
490 if (ACPI_FAILURE(status)) {
491 acpi_os_free(allocation);
492 return (NULL);
493 }
494
495 acpi_gbl_global_list->total_allocated++;
496 acpi_gbl_global_list->current_total_size += (u32) size;
497
498 return ((void *)&allocation->user_space);
499}
500
501/*******************************************************************************
502 *
503 * FUNCTION: acpi_ut_free_and_track
504 *
505 * PARAMETERS: Allocation - Address of the memory to deallocate
506 * Component - Component type of caller
507 * Module - Source file name of caller
508 * Line - Line number of caller
509 *
510 * RETURN: None
511 *
512 * DESCRIPTION: Frees the memory at Allocation
513 *
514 ******************************************************************************/
515
516void
517acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
518{
519 struct acpi_debug_mem_block *debug_block;
520 acpi_status status;
521
522 ACPI_FUNCTION_TRACE_PTR("ut_free", allocation);
523
524 if (NULL == allocation) {
525 ACPI_ERROR((module, line, "Attempt to delete a NULL address"));
526
527 return_VOID;
528 }
529
530 debug_block = ACPI_CAST_PTR(struct acpi_debug_mem_block,
531 (((char *)allocation) -
532 sizeof(struct acpi_debug_mem_header)));
533
534 acpi_gbl_global_list->total_freed++;
535 acpi_gbl_global_list->current_total_size -= debug_block->size;
536
537 status = acpi_ut_remove_allocation(debug_block,
538 component, module, line);
539 if (ACPI_FAILURE(status)) {
540 ACPI_EXCEPTION((AE_INFO, status, "Could not free memory"));
541 }
542
543 acpi_os_free(debug_block);
544 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation));
545 return_VOID;
546}
547
548/*******************************************************************************
549 *
550 * FUNCTION: acpi_ut_find_allocation
551 *
552 * PARAMETERS: Allocation - Address of allocated memory
553 *
554 * RETURN: A list element if found; NULL otherwise.
555 *
556 * DESCRIPTION: Searches for an element in the global allocation tracking list.
557 *
558 ******************************************************************************/
559
560static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation)
561{
562 struct acpi_debug_mem_block *element;
563
564 ACPI_FUNCTION_ENTRY(); 351 ACPI_FUNCTION_ENTRY();
565 352
566 element = acpi_gbl_global_list->list_head; 353 allocation = acpi_ut_allocate(size, component, module, line);
567 354 if (allocation) {
568 /* Search for the address. */
569
570 while (element) {
571 if (element == allocation) {
572 return (element);
573 }
574
575 element = element->next;
576 }
577
578 return (NULL);
579}
580
581/*******************************************************************************
582 *
583 * FUNCTION: acpi_ut_track_allocation
584 *
585 * PARAMETERS: Allocation - Address of allocated memory
586 * Size - Size of the allocation
587 * alloc_type - MEM_MALLOC or MEM_CALLOC
588 * Component - Component type of caller
589 * Module - Source file name of caller
590 * Line - Line number of caller
591 *
592 * RETURN: None.
593 *
594 * DESCRIPTION: Inserts an element into the global allocation tracking list.
595 *
596 ******************************************************************************/
597
598static acpi_status
599acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
600 acpi_size size,
601 u8 alloc_type, u32 component, char *module, u32 line)
602{
603 struct acpi_memory_list *mem_list;
604 struct acpi_debug_mem_block *element;
605 acpi_status status = AE_OK;
606
607 ACPI_FUNCTION_TRACE_PTR("ut_track_allocation", allocation);
608
609 mem_list = acpi_gbl_global_list;
610 status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY);
611 if (ACPI_FAILURE(status)) {
612 return_ACPI_STATUS(status);
613 }
614
615 /*
616 * Search list for this address to make sure it is not already on the list.
617 * This will catch several kinds of problems.
618 */
619 element = acpi_ut_find_allocation(allocation);
620 if (element) {
621 ACPI_ERROR((AE_INFO,
622 "ut_track_allocation: Allocation already present in list! (%p)",
623 allocation));
624
625 ACPI_ERROR((AE_INFO, "Element %p Address %p",
626 element, allocation));
627
628 goto unlock_and_exit;
629 }
630
631 /* Fill in the instance data. */
632
633 allocation->size = (u32) size;
634 allocation->alloc_type = alloc_type;
635 allocation->component = component;
636 allocation->line = line;
637
638 ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME);
639 allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0;
640
641 /* Insert at list head */
642
643 if (mem_list->list_head) {
644 ((struct acpi_debug_mem_block *)(mem_list->list_head))->
645 previous = allocation;
646 }
647
648 allocation->next = mem_list->list_head;
649 allocation->previous = NULL;
650
651 mem_list->list_head = allocation;
652
653 unlock_and_exit:
654 status = acpi_ut_release_mutex(ACPI_MTX_MEMORY);
655 return_ACPI_STATUS(status);
656}
657
658/*******************************************************************************
659 *
660 * FUNCTION: acpi_ut_remove_allocation
661 *
662 * PARAMETERS: Allocation - Address of allocated memory
663 * Component - Component type of caller
664 * Module - Source file name of caller
665 * Line - Line number of caller
666 *
667 * RETURN:
668 *
669 * DESCRIPTION: Deletes an element from the global allocation tracking list.
670 *
671 ******************************************************************************/
672
673static acpi_status
674acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
675 u32 component, char *module, u32 line)
676{
677 struct acpi_memory_list *mem_list;
678 acpi_status status;
679
680 ACPI_FUNCTION_TRACE("ut_remove_allocation");
681
682 mem_list = acpi_gbl_global_list;
683 if (NULL == mem_list->list_head) {
684 /* No allocations! */
685
686 ACPI_ERROR((module, line,
687 "Empty allocation list, nothing to free!"));
688
689 return_ACPI_STATUS(AE_OK);
690 }
691
692 status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY);
693 if (ACPI_FAILURE(status)) {
694 return_ACPI_STATUS(status);
695 }
696
697 /* Unlink */
698
699 if (allocation->previous) {
700 (allocation->previous)->next = allocation->next;
701 } else {
702 mem_list->list_head = allocation->next;
703 }
704
705 if (allocation->next) {
706 (allocation->next)->previous = allocation->previous;
707 }
708
709 /* Mark the segment as deleted */
710
711 ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size);
712
713 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n",
714 allocation->size));
715 355
716 status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); 356 /* Clear the memory block */
717 return_ACPI_STATUS(status);
718}
719
720/*******************************************************************************
721 *
722 * FUNCTION: acpi_ut_dump_allocation_info
723 *
724 * PARAMETERS:
725 *
726 * RETURN: None
727 *
728 * DESCRIPTION: Print some info about the outstanding allocations.
729 *
730 ******************************************************************************/
731 357
732#ifdef ACPI_FUTURE_USAGE 358 ACPI_MEMSET(allocation, 0, size);
733void acpi_ut_dump_allocation_info(void)
734{
735/*
736 struct acpi_memory_list *mem_list;
737*/
738
739 ACPI_FUNCTION_TRACE("ut_dump_allocation_info");
740
741/*
742 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
743 ("%30s: %4d (%3d Kb)\n", "Current allocations",
744 mem_list->current_count,
745 ROUND_UP_TO_1K (mem_list->current_size)));
746
747 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
748 ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations",
749 mem_list->max_concurrent_count,
750 ROUND_UP_TO_1K (mem_list->max_concurrent_size)));
751
752 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
753 ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects",
754 running_object_count,
755 ROUND_UP_TO_1K (running_object_size)));
756
757 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
758 ("%30s: %4d (%3d Kb)\n", "Total (all) allocations",
759 running_alloc_count,
760 ROUND_UP_TO_1K (running_alloc_size)));
761
762 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
763 ("%30s: %4d (%3d Kb)\n", "Current Nodes",
764 acpi_gbl_current_node_count,
765 ROUND_UP_TO_1K (acpi_gbl_current_node_size)));
766
767 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
768 ("%30s: %4d (%3d Kb)\n", "Max Nodes",
769 acpi_gbl_max_concurrent_node_count,
770 ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count *
771 sizeof (struct acpi_namespace_node)))));
772*/
773 return_VOID;
774}
775#endif /* ACPI_FUTURE_USAGE */
776
777/*******************************************************************************
778 *
779 * FUNCTION: acpi_ut_dump_allocations
780 *
781 * PARAMETERS: Component - Component(s) to dump info for.
782 * Module - Module to dump info for. NULL means all.
783 *
784 * RETURN: None
785 *
786 * DESCRIPTION: Print a list of all outstanding allocations.
787 *
788 ******************************************************************************/
789
790void acpi_ut_dump_allocations(u32 component, char *module)
791{
792 struct acpi_debug_mem_block *element;
793 union acpi_descriptor *descriptor;
794 u32 num_outstanding = 0;
795
796 ACPI_FUNCTION_TRACE("ut_dump_allocations");
797
798 /*
799 * Walk the allocation list.
800 */
801 if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_MEMORY))) {
802 return;
803 } 359 }
804 360
805 element = acpi_gbl_global_list->list_head; 361 return (allocation);
806 while (element) {
807 if ((element->component & component) &&
808 ((module == NULL)
809 || (0 == ACPI_STRCMP(module, element->module)))) {
810 /* Ignore allocated objects that are in a cache */
811
812 descriptor =
813 ACPI_CAST_PTR(union acpi_descriptor,
814 &element->user_space);
815 if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) {
816 acpi_os_printf("%p Len %04X %9.9s-%d [%s] ",
817 descriptor, element->size,
818 element->module, element->line,
819 acpi_ut_get_descriptor_name
820 (descriptor));
821
822 /* Most of the elements will be Operand objects. */
823
824 switch (ACPI_GET_DESCRIPTOR_TYPE(descriptor)) {
825 case ACPI_DESC_TYPE_OPERAND:
826 acpi_os_printf("%12.12s R%hd",
827 acpi_ut_get_type_name
828 (descriptor->object.
829 common.type),
830 descriptor->object.
831 common.reference_count);
832 break;
833
834 case ACPI_DESC_TYPE_PARSER:
835 acpi_os_printf("aml_opcode %04hX",
836 descriptor->op.asl.
837 aml_opcode);
838 break;
839
840 case ACPI_DESC_TYPE_NAMED:
841 acpi_os_printf("%4.4s",
842 acpi_ut_get_node_name
843 (&descriptor->node));
844 break;
845
846 default:
847 break;
848 }
849
850 acpi_os_printf("\n");
851 num_outstanding++;
852 }
853 }
854 element = element->next;
855 }
856
857 (void)acpi_ut_release_mutex(ACPI_MTX_MEMORY);
858
859 /* Print summary */
860
861 if (!num_outstanding) {
862 ACPI_INFO((AE_INFO, "No outstanding allocations"));
863 } else {
864 ACPI_ERROR((AE_INFO,
865 "%d(%X) Outstanding allocations",
866 num_outstanding, num_outstanding));
867 }
868
869 return_VOID;
870} 362}
871
872#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c
index 2177cb1ef2c4..56270a30718a 100644
--- a/drivers/acpi/utilities/utcache.c
+++ b/drivers/acpi/utilities/utcache.c
@@ -118,13 +118,14 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache)
118 /* Walk the list of objects in this cache */ 118 /* Walk the list of objects in this cache */
119 119
120 while (cache->list_head) { 120 while (cache->list_head) {
121
121 /* Delete and unlink one cached state object */ 122 /* Delete and unlink one cached state object */
122 123
123 next = *(ACPI_CAST_INDIRECT_PTR(char, 124 next = *(ACPI_CAST_INDIRECT_PTR(char,
124 &(((char *)cache-> 125 &(((char *)cache->
125 list_head)[cache-> 126 list_head)[cache->
126 link_offset]))); 127 link_offset])));
127 ACPI_MEM_FREE(cache->list_head); 128 ACPI_FREE(cache->list_head);
128 129
129 cache->list_head = next; 130 cache->list_head = next;
130 cache->current_depth--; 131 cache->current_depth--;
@@ -193,7 +194,7 @@ acpi_os_release_object(struct acpi_memory_list * cache, void *object)
193 /* If cache is full, just free this object */ 194 /* If cache is full, just free this object */
194 195
195 if (cache->current_depth >= cache->max_depth) { 196 if (cache->current_depth >= cache->max_depth) {
196 ACPI_MEM_FREE(object); 197 ACPI_FREE(object);
197 ACPI_MEM_TRACKING(cache->total_freed++); 198 ACPI_MEM_TRACKING(cache->total_freed++);
198 } 199 }
199 200
@@ -243,7 +244,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
243 acpi_status status; 244 acpi_status status;
244 void *object; 245 void *object;
245 246
246 ACPI_FUNCTION_NAME("os_acquire_object"); 247 ACPI_FUNCTION_NAME(os_acquire_object);
247 248
248 if (!cache) { 249 if (!cache) {
249 return (NULL); 250 return (NULL);
@@ -259,6 +260,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
259 /* Check the cache first */ 260 /* Check the cache first */
260 261
261 if (cache->list_head) { 262 if (cache->list_head) {
263
262 /* There is an object available, use it */ 264 /* There is an object available, use it */
263 265
264 object = cache->list_head; 266 object = cache->list_head;
@@ -270,9 +272,9 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
270 cache->current_depth--; 272 cache->current_depth--;
271 273
272 ACPI_MEM_TRACKING(cache->hits++); 274 ACPI_MEM_TRACKING(cache->hits++);
273 ACPI_MEM_TRACKING(ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 275 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
274 "Object %p from %s cache\n", 276 "Object %p from %s cache\n", object,
275 object, cache->list_name))); 277 cache->list_name));
276 278
277 status = acpi_ut_release_mutex(ACPI_MTX_CACHES); 279 status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
278 if (ACPI_FAILURE(status)) { 280 if (ACPI_FAILURE(status)) {
@@ -287,14 +289,14 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
287 289
288 ACPI_MEM_TRACKING(cache->total_allocated++); 290 ACPI_MEM_TRACKING(cache->total_allocated++);
289 291
290 /* Avoid deadlock with ACPI_MEM_CALLOCATE */ 292 /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
291 293
292 status = acpi_ut_release_mutex(ACPI_MTX_CACHES); 294 status = acpi_ut_release_mutex(ACPI_MTX_CACHES);
293 if (ACPI_FAILURE(status)) { 295 if (ACPI_FAILURE(status)) {
294 return (NULL); 296 return (NULL);
295 } 297 }
296 298
297 object = ACPI_MEM_CALLOCATE(cache->object_size); 299 object = ACPI_ALLOCATE_ZEROED(cache->object_size);
298 if (!object) { 300 if (!object) {
299 return (NULL); 301 return (NULL);
300 } 302 }
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
index df2d32096b72..5e1a80d1bc36 100644
--- a/drivers/acpi/utilities/utcopy.c
+++ b/drivers/acpi/utilities/utcopy.c
@@ -109,7 +109,7 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
109{ 109{
110 acpi_status status = AE_OK; 110 acpi_status status = AE_OK;
111 111
112 ACPI_FUNCTION_TRACE("ut_copy_isimple_to_esimple"); 112 ACPI_FUNCTION_TRACE(ut_copy_isimple_to_esimple);
113 113
114 *buffer_space_used = 0; 114 *buffer_space_used = 0;
115 115
@@ -325,7 +325,7 @@ acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object,
325 acpi_status status; 325 acpi_status status;
326 struct acpi_pkg_info info; 326 struct acpi_pkg_info info;
327 327
328 ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_epackage"); 328 ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_epackage);
329 329
330 /* 330 /*
331 * First package at head of the buffer 331 * First package at head of the buffer
@@ -383,7 +383,7 @@ acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object,
383{ 383{
384 acpi_status status; 384 acpi_status status;
385 385
386 ACPI_FUNCTION_TRACE("ut_copy_iobject_to_eobject"); 386 ACPI_FUNCTION_TRACE(ut_copy_iobject_to_eobject);
387 387
388 if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) { 388 if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) {
389 /* 389 /*
@@ -442,7 +442,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
442{ 442{
443 union acpi_operand_object *internal_object; 443 union acpi_operand_object *internal_object;
444 444
445 ACPI_FUNCTION_TRACE("ut_copy_esimple_to_isimple"); 445 ACPI_FUNCTION_TRACE(ut_copy_esimple_to_isimple);
446 446
447 /* 447 /*
448 * Simple types supported are: String, Buffer, Integer 448 * Simple types supported are: String, Buffer, Integer
@@ -472,8 +472,8 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
472 case ACPI_TYPE_STRING: 472 case ACPI_TYPE_STRING:
473 473
474 internal_object->string.pointer = 474 internal_object->string.pointer =
475 ACPI_MEM_CALLOCATE((acpi_size) external_object->string. 475 ACPI_ALLOCATE_ZEROED((acpi_size) external_object->string.
476 length + 1); 476 length + 1);
477 if (!internal_object->string.pointer) { 477 if (!internal_object->string.pointer) {
478 goto error_exit; 478 goto error_exit;
479 } 479 }
@@ -488,7 +488,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
488 case ACPI_TYPE_BUFFER: 488 case ACPI_TYPE_BUFFER:
489 489
490 internal_object->buffer.pointer = 490 internal_object->buffer.pointer =
491 ACPI_MEM_CALLOCATE(external_object->buffer.length); 491 ACPI_ALLOCATE_ZEROED(external_object->buffer.length);
492 if (!internal_object->buffer.pointer) { 492 if (!internal_object->buffer.pointer) {
493 goto error_exit; 493 goto error_exit;
494 } 494 }
@@ -552,7 +552,7 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_operand_object *internal_object,
552 union acpi_operand_object *this_internal_obj; 552 union acpi_operand_object *this_internal_obj;
553 union acpi_object *this_external_obj; 553 union acpi_object *this_external_obj;
554 554
555 ACPI_FUNCTION_TRACE("ut_copy_epackage_to_ipackage"); 555 ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage);
556 556
557 /* 557 /*
558 * First package at head of the buffer 558 * First package at head of the buffer
@@ -600,7 +600,7 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object,
600{ 600{
601 acpi_status status; 601 acpi_status status;
602 602
603 ACPI_FUNCTION_TRACE("ut_copy_eobject_to_iobject"); 603 ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject);
604 604
605 if (external_object->type == ACPI_TYPE_PACKAGE) { 605 if (external_object->type == ACPI_TYPE_PACKAGE) {
606 /* 606 /*
@@ -676,7 +676,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
676 if ((source_desc->buffer.pointer) && 676 if ((source_desc->buffer.pointer) &&
677 (source_desc->buffer.length)) { 677 (source_desc->buffer.length)) {
678 dest_desc->buffer.pointer = 678 dest_desc->buffer.pointer =
679 ACPI_MEM_ALLOCATE(source_desc->buffer.length); 679 ACPI_ALLOCATE(source_desc->buffer.length);
680 if (!dest_desc->buffer.pointer) { 680 if (!dest_desc->buffer.pointer) {
681 return (AE_NO_MEMORY); 681 return (AE_NO_MEMORY);
682 } 682 }
@@ -697,8 +697,8 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
697 */ 697 */
698 if (source_desc->string.pointer) { 698 if (source_desc->string.pointer) {
699 dest_desc->string.pointer = 699 dest_desc->string.pointer =
700 ACPI_MEM_ALLOCATE((acpi_size) source_desc->string. 700 ACPI_ALLOCATE((acpi_size) source_desc->string.
701 length + 1); 701 length + 1);
702 if (!dest_desc->string.pointer) { 702 if (!dest_desc->string.pointer) {
703 return (AE_NO_MEMORY); 703 return (AE_NO_MEMORY);
704 } 704 }
@@ -805,9 +805,7 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type,
805 /* 805 /*
806 * Create the object array 806 * Create the object array
807 */ 807 */
808 target_object->package.elements = 808 target_object->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) source_object->package.count + 1) * sizeof(void *));
809 ACPI_MEM_CALLOCATE(((acpi_size) source_object->package.
810 count + 1) * sizeof(void *));
811 if (!target_object->package.elements) { 809 if (!target_object->package.elements) {
812 status = AE_NO_MEMORY; 810 status = AE_NO_MEMORY;
813 goto error_exit; 811 goto error_exit;
@@ -856,7 +854,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
856{ 854{
857 acpi_status status = AE_OK; 855 acpi_status status = AE_OK;
858 856
859 ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_ipackage"); 857 ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_ipackage);
860 858
861 dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj); 859 dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj);
862 dest_obj->common.flags = source_obj->common.flags; 860 dest_obj->common.flags = source_obj->common.flags;
@@ -865,10 +863,10 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
865 /* 863 /*
866 * Create the object array and walk the source package tree 864 * Create the object array and walk the source package tree
867 */ 865 */
868 dest_obj->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) 866 dest_obj->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size)
869 source_obj->package. 867 source_obj->package.
870 count + 868 count +
871 1) * sizeof(void *)); 869 1) * sizeof(void *));
872 if (!dest_obj->package.elements) { 870 if (!dest_obj->package.elements) {
873 ACPI_ERROR((AE_INFO, "Package allocation failure")); 871 ACPI_ERROR((AE_INFO, "Package allocation failure"));
874 return_ACPI_STATUS(AE_NO_MEMORY); 872 return_ACPI_STATUS(AE_NO_MEMORY);
@@ -882,6 +880,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
882 acpi_ut_copy_ielement_to_ielement, 880 acpi_ut_copy_ielement_to_ielement,
883 walk_state); 881 walk_state);
884 if (ACPI_FAILURE(status)) { 882 if (ACPI_FAILURE(status)) {
883
885 /* On failure, delete the destination package object */ 884 /* On failure, delete the destination package object */
886 885
887 acpi_ut_remove_reference(dest_obj); 886 acpi_ut_remove_reference(dest_obj);
@@ -911,7 +910,7 @@ acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc,
911{ 910{
912 acpi_status status = AE_OK; 911 acpi_status status = AE_OK;
913 912
914 ACPI_FUNCTION_TRACE("ut_copy_iobject_to_iobject"); 913 ACPI_FUNCTION_TRACE(ut_copy_iobject_to_iobject);
915 914
916 /* Create the top level object */ 915 /* Create the top level object */
917 916
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
index 35f3d581e034..5ec1cfcc611d 100644
--- a/drivers/acpi/utilities/utdebug.c
+++ b/drivers/acpi/utilities/utdebug.c
@@ -41,8 +41,6 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44#include <linux/module.h>
45
46#include <acpi/acpi.h> 44#include <acpi/acpi.h>
47 45
48#define _COMPONENT ACPI_UTILITIES 46#define _COMPONENT ACPI_UTILITIES
@@ -123,12 +121,14 @@ static const char *acpi_ut_trim_function_name(const char *function_name)
123 /* All Function names are longer than 4 chars, check is safe */ 121 /* All Function names are longer than 4 chars, check is safe */
124 122
125 if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { 123 if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) {
124
126 /* This is the case where the original source has not been modified */ 125 /* This is the case where the original source has not been modified */
127 126
128 return (function_name + 4); 127 return (function_name + 4);
129 } 128 }
130 129
131 if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { 130 if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) {
131
132 /* This is the case where the source has been 'linuxized' */ 132 /* This is the case where the source has been 'linuxized' */
133 133
134 return (function_name + 5); 134 return (function_name + 5);
@@ -162,7 +162,7 @@ acpi_ut_debug_print(u32 requested_debug_level,
162 const char *function_name, 162 const char *function_name,
163 char *module_name, u32 component_id, char *format, ...) 163 char *module_name, u32 component_id, char *format, ...)
164{ 164{
165 u32 thread_id; 165 acpi_thread_id thread_id;
166 va_list args; 166 va_list args;
167 167
168 /* 168 /*
@@ -177,7 +177,6 @@ acpi_ut_debug_print(u32 requested_debug_level,
177 * Thread tracking and context switch notification 177 * Thread tracking and context switch notification
178 */ 178 */
179 thread_id = acpi_os_get_thread_id(); 179 thread_id = acpi_os_get_thread_id();
180
181 if (thread_id != acpi_gbl_prev_thread_id) { 180 if (thread_id != acpi_gbl_prev_thread_id) {
182 if (ACPI_LV_THREADS & acpi_dbg_level) { 181 if (ACPI_LV_THREADS & acpi_dbg_level) {
183 acpi_os_printf 182 acpi_os_printf
@@ -206,7 +205,7 @@ acpi_ut_debug_print(u32 requested_debug_level,
206 acpi_os_vprintf(format, args); 205 acpi_os_vprintf(format, args);
207} 206}
208 207
209EXPORT_SYMBOL(acpi_ut_debug_print); 208ACPI_EXPORT_SYMBOL(acpi_ut_debug_print)
210 209
211/******************************************************************************* 210/*******************************************************************************
212 * 211 *
@@ -226,7 +225,6 @@ EXPORT_SYMBOL(acpi_ut_debug_print);
226 * debug_print so that the same macros can be used. 225 * debug_print so that the same macros can be used.
227 * 226 *
228 ******************************************************************************/ 227 ******************************************************************************/
229
230void ACPI_INTERNAL_VAR_XFACE 228void ACPI_INTERNAL_VAR_XFACE
231acpi_ut_debug_print_raw(u32 requested_debug_level, 229acpi_ut_debug_print_raw(u32 requested_debug_level,
232 u32 line_number, 230 u32 line_number,
@@ -244,7 +242,7 @@ acpi_ut_debug_print_raw(u32 requested_debug_level,
244 acpi_os_vprintf(format, args); 242 acpi_os_vprintf(format, args);
245} 243}
246 244
247EXPORT_SYMBOL(acpi_ut_debug_print_raw); 245ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw)
248 246
249/******************************************************************************* 247/*******************************************************************************
250 * 248 *
@@ -261,7 +259,6 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw);
261 * set in debug_level 259 * set in debug_level
262 * 260 *
263 ******************************************************************************/ 261 ******************************************************************************/
264
265void 262void
266acpi_ut_trace(u32 line_number, 263acpi_ut_trace(u32 line_number,
267 const char *function_name, char *module_name, u32 component_id) 264 const char *function_name, char *module_name, u32 component_id)
@@ -275,7 +272,7 @@ acpi_ut_trace(u32 line_number,
275 component_id, "%s\n", acpi_gbl_fn_entry_str); 272 component_id, "%s\n", acpi_gbl_fn_entry_str);
276} 273}
277 274
278EXPORT_SYMBOL(acpi_ut_trace); 275ACPI_EXPORT_SYMBOL(acpi_ut_trace)
279 276
280/******************************************************************************* 277/*******************************************************************************
281 * 278 *
@@ -293,7 +290,6 @@ EXPORT_SYMBOL(acpi_ut_trace);
293 * set in debug_level 290 * set in debug_level
294 * 291 *
295 ******************************************************************************/ 292 ******************************************************************************/
296
297void 293void
298acpi_ut_trace_ptr(u32 line_number, 294acpi_ut_trace_ptr(u32 line_number,
299 const char *function_name, 295 const char *function_name,
@@ -400,7 +396,7 @@ acpi_ut_exit(u32 line_number,
400 acpi_gbl_nesting_level--; 396 acpi_gbl_nesting_level--;
401} 397}
402 398
403EXPORT_SYMBOL(acpi_ut_exit); 399ACPI_EXPORT_SYMBOL(acpi_ut_exit)
404 400
405/******************************************************************************* 401/*******************************************************************************
406 * 402 *
@@ -418,7 +414,6 @@ EXPORT_SYMBOL(acpi_ut_exit);
418 * set in debug_level. Prints exit status also. 414 * set in debug_level. Prints exit status also.
419 * 415 *
420 ******************************************************************************/ 416 ******************************************************************************/
421
422void 417void
423acpi_ut_status_exit(u32 line_number, 418acpi_ut_status_exit(u32 line_number,
424 const char *function_name, 419 const char *function_name,
@@ -442,7 +437,7 @@ acpi_ut_status_exit(u32 line_number,
442 acpi_gbl_nesting_level--; 437 acpi_gbl_nesting_level--;
443} 438}
444 439
445EXPORT_SYMBOL(acpi_ut_status_exit); 440ACPI_EXPORT_SYMBOL(acpi_ut_status_exit)
446 441
447/******************************************************************************* 442/*******************************************************************************
448 * 443 *
@@ -460,7 +455,6 @@ EXPORT_SYMBOL(acpi_ut_status_exit);
460 * set in debug_level. Prints exit value also. 455 * set in debug_level. Prints exit value also.
461 * 456 *
462 ******************************************************************************/ 457 ******************************************************************************/
463
464void 458void
465acpi_ut_value_exit(u32 line_number, 459acpi_ut_value_exit(u32 line_number,
466 const char *function_name, 460 const char *function_name,
@@ -475,7 +469,7 @@ acpi_ut_value_exit(u32 line_number,
475 acpi_gbl_nesting_level--; 469 acpi_gbl_nesting_level--;
476} 470}
477 471
478EXPORT_SYMBOL(acpi_ut_value_exit); 472ACPI_EXPORT_SYMBOL(acpi_ut_value_exit)
479 473
480/******************************************************************************* 474/*******************************************************************************
481 * 475 *
@@ -493,7 +487,6 @@ EXPORT_SYMBOL(acpi_ut_value_exit);
493 * set in debug_level. Prints exit value also. 487 * set in debug_level. Prints exit value also.
494 * 488 *
495 ******************************************************************************/ 489 ******************************************************************************/
496
497void 490void
498acpi_ut_ptr_exit(u32 line_number, 491acpi_ut_ptr_exit(u32 line_number,
499 const char *function_name, 492 const char *function_name,
@@ -524,20 +517,13 @@ acpi_ut_ptr_exit(u32 line_number,
524 * 517 *
525 ******************************************************************************/ 518 ******************************************************************************/
526 519
527void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) 520void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display)
528{ 521{
529 acpi_native_uint i = 0; 522 acpi_native_uint i = 0;
530 acpi_native_uint j; 523 acpi_native_uint j;
531 u32 temp32; 524 u32 temp32;
532 u8 buf_char; 525 u8 buf_char;
533 526
534 /* Only dump the buffer if tracing is enabled */
535
536 if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
537 (component_id & acpi_dbg_layer))) {
538 return;
539 }
540
541 if ((count < 4) || (count & 0x01)) { 527 if ((count < 4) || (count & 0x01)) {
542 display = DB_BYTE_DISPLAY; 528 display = DB_BYTE_DISPLAY;
543 } 529 }
@@ -545,6 +531,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
545 /* Nasty little dump buffer routine! */ 531 /* Nasty little dump buffer routine! */
546 532
547 while (i < count) { 533 while (i < count) {
534
548 /* Print current offset */ 535 /* Print current offset */
549 536
550 acpi_os_printf("%6.4X: ", (u32) i); 537 acpi_os_printf("%6.4X: ", (u32) i);
@@ -553,6 +540,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
553 540
554 for (j = 0; j < 16;) { 541 for (j = 0; j < 16;) {
555 if (i + j >= count) { 542 if (i + j >= count) {
543
556 /* Dump fill spaces */ 544 /* Dump fill spaces */
557 545
558 acpi_os_printf("%*s", ((display * 2) + 1), " "); 546 acpi_os_printf("%*s", ((display * 2) + 1), " ");
@@ -561,6 +549,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
561 } 549 }
562 550
563 switch (display) { 551 switch (display) {
552 case DB_BYTE_DISPLAY:
564 default: /* Default is BYTE display */ 553 default: /* Default is BYTE display */
565 554
566 acpi_os_printf("%02X ", buffer[i + j]); 555 acpi_os_printf("%02X ", buffer[i + j]);
@@ -618,3 +607,31 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
618 607
619 return; 608 return;
620} 609}
610
611/*******************************************************************************
612 *
613 * FUNCTION: acpi_ut_dump_buffer
614 *
615 * PARAMETERS: Buffer - Buffer to dump
616 * Count - Amount to dump, in bytes
617 * Display - BYTE, WORD, DWORD, or QWORD display
618 * component_iD - Caller's component ID
619 *
620 * RETURN: None
621 *
622 * DESCRIPTION: Generic dump buffer in both hex and ascii.
623 *
624 ******************************************************************************/
625
626void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
627{
628
629 /* Only dump the buffer if tracing is enabled */
630
631 if (!((ACPI_LV_TABLES & acpi_dbg_level) &&
632 (component_id & acpi_dbg_layer))) {
633 return;
634 }
635
636 acpi_ut_dump_buffer2(buffer, count, display);
637}
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
index 1db9695b0029..67b9f325c6fa 100644
--- a/drivers/acpi/utilities/utdelete.c
+++ b/drivers/acpi/utilities/utdelete.c
@@ -76,7 +76,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
76 union acpi_operand_object *second_desc; 76 union acpi_operand_object *second_desc;
77 union acpi_operand_object *next_desc; 77 union acpi_operand_object *next_desc;
78 78
79 ACPI_FUNCTION_TRACE_PTR("ut_delete_internal_obj", object); 79 ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object);
80 80
81 if (!object) { 81 if (!object) {
82 return_VOID; 82 return_VOID;
@@ -96,6 +96,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
96 /* Free the actual string buffer */ 96 /* Free the actual string buffer */
97 97
98 if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { 98 if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) {
99
99 /* But only if it is NOT a pointer into an ACPI table */ 100 /* But only if it is NOT a pointer into an ACPI table */
100 101
101 obj_pointer = object->string.pointer; 102 obj_pointer = object->string.pointer;
@@ -111,6 +112,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
111 /* Free the actual buffer */ 112 /* Free the actual buffer */
112 113
113 if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { 114 if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) {
115
114 /* But only if it is NOT a pointer into an ACPI table */ 116 /* But only if it is NOT a pointer into an ACPI table */
115 117
116 obj_pointer = object->buffer.pointer; 118 obj_pointer = object->buffer.pointer;
@@ -198,11 +200,22 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
198 */ 200 */
199 handler_desc = object->region.handler; 201 handler_desc = object->region.handler;
200 if (handler_desc) { 202 if (handler_desc) {
201 if (handler_desc->address_space. 203 if (handler_desc->address_space.handler_flags &
202 hflags &
203 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { 204 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
204 obj_pointer = 205
205 second_desc->extra.region_context; 206 /* Deactivate region and free region context */
207
208 if (handler_desc->address_space.setup) {
209 (void)handler_desc->
210 address_space.setup(object,
211 ACPI_REGION_DEACTIVATE,
212 handler_desc->
213 address_space.
214 context,
215 &second_desc->
216 extra.
217 region_context);
218 }
206 } 219 }
207 220
208 acpi_ut_remove_reference(handler_desc); 221 acpi_ut_remove_reference(handler_desc);
@@ -234,7 +247,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
234 if (obj_pointer) { 247 if (obj_pointer) {
235 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, 248 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
236 "Deleting Object Subptr %p\n", obj_pointer)); 249 "Deleting Object Subptr %p\n", obj_pointer));
237 ACPI_MEM_FREE(obj_pointer); 250 ACPI_FREE(obj_pointer);
238 } 251 }
239 252
240 /* Now the object can be safely deleted */ 253 /* Now the object can be safely deleted */
@@ -263,7 +276,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list)
263{ 276{
264 union acpi_operand_object **internal_obj; 277 union acpi_operand_object **internal_obj;
265 278
266 ACPI_FUNCTION_TRACE("ut_delete_internal_object_list"); 279 ACPI_FUNCTION_TRACE(ut_delete_internal_object_list);
267 280
268 /* Walk the null-terminated internal list */ 281 /* Walk the null-terminated internal list */
269 282
@@ -273,7 +286,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list)
273 286
274 /* Free the combined parameter pointer list and object array */ 287 /* Free the combined parameter pointer list and object array */
275 288
276 ACPI_MEM_FREE(obj_list); 289 ACPI_FREE(obj_list);
277 return_VOID; 290 return_VOID;
278} 291}
279 292
@@ -296,7 +309,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
296 u16 count; 309 u16 count;
297 u16 new_count; 310 u16 new_count;
298 311
299 ACPI_FUNCTION_NAME("ut_update_ref_count"); 312 ACPI_FUNCTION_NAME(ut_update_ref_count);
300 313
301 if (!object) { 314 if (!object) {
302 return; 315 return;
@@ -306,11 +319,9 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
306 new_count = count; 319 new_count = count;
307 320
308 /* 321 /*
309 * Perform the reference count action 322 * Perform the reference count action (increment, decrement, force delete)
310 * (increment, decrement, or force delete)
311 */ 323 */
312 switch (action) { 324 switch (action) {
313
314 case REF_INCREMENT: 325 case REF_INCREMENT:
315 326
316 new_count++; 327 new_count++;
@@ -347,7 +358,6 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
347 if (new_count == 0) { 358 if (new_count == 0) {
348 acpi_ut_delete_internal_obj(object); 359 acpi_ut_delete_internal_obj(object);
349 } 360 }
350
351 break; 361 break;
352 362
353 case REF_FORCE_DELETE: 363 case REF_FORCE_DELETE:
@@ -372,13 +382,10 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
372 * (A deleted object will have a huge reference count) 382 * (A deleted object will have a huge reference count)
373 */ 383 */
374 if (count > ACPI_MAX_REFERENCE_COUNT) { 384 if (count > ACPI_MAX_REFERENCE_COUNT) {
375
376 ACPI_WARNING((AE_INFO, 385 ACPI_WARNING((AE_INFO,
377 "Large Reference Count (%X) in object %p", 386 "Large Reference Count (%X) in object %p", count,
378 count, object)); 387 object));
379 } 388 }
380
381 return;
382} 389}
383 390
384/******************************************************************************* 391/*******************************************************************************
@@ -404,7 +411,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
404 ******************************************************************************/ 411 ******************************************************************************/
405 412
406acpi_status 413acpi_status
407acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) 414acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
408{ 415{
409 acpi_status status = AE_OK; 416 acpi_status status = AE_OK;
410 union acpi_generic_state *state_list = NULL; 417 union acpi_generic_state *state_list = NULL;
@@ -412,9 +419,10 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
412 union acpi_generic_state *state; 419 union acpi_generic_state *state;
413 acpi_native_uint i; 420 acpi_native_uint i;
414 421
415 ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object); 422 ACPI_FUNCTION_TRACE_PTR(ut_update_object_reference, object);
416 423
417 while (object) { 424 while (object) {
425
418 /* Make sure that this isn't a namespace handle */ 426 /* Make sure that this isn't a namespace handle */
419 427
420 if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { 428 if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) {
@@ -507,11 +515,11 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
507 515
508 case ACPI_TYPE_REGION: 516 case ACPI_TYPE_REGION:
509 default: 517 default:
510 break; /* No subobjects */ 518 break; /* No subobjects for all other types */
511 } 519 }
512 520
513 /* 521 /*
514 * Now we can update the count in the main object. This can only 522 * Now we can update the count in the main object. This can only
515 * happen after we update the sub-objects in case this causes the 523 * happen after we update the sub-objects in case this causes the
516 * main object to be deleted. 524 * main object to be deleted.
517 */ 525 */
@@ -556,7 +564,7 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
556void acpi_ut_add_reference(union acpi_operand_object *object) 564void acpi_ut_add_reference(union acpi_operand_object *object)
557{ 565{
558 566
559 ACPI_FUNCTION_TRACE_PTR("ut_add_reference", object); 567 ACPI_FUNCTION_TRACE_PTR(ut_add_reference, object);
560 568
561 /* Ensure that we have a valid object */ 569 /* Ensure that we have a valid object */
562 570
@@ -589,11 +597,11 @@ void acpi_ut_add_reference(union acpi_operand_object *object)
589void acpi_ut_remove_reference(union acpi_operand_object *object) 597void acpi_ut_remove_reference(union acpi_operand_object *object)
590{ 598{
591 599
592 ACPI_FUNCTION_TRACE_PTR("ut_remove_reference", object); 600 ACPI_FUNCTION_TRACE_PTR(ut_remove_reference, object);
593 601
594 /* 602 /*
595 * Allow a NULL pointer to be passed in, just ignore it. This saves 603 * Allow a NULL pointer to be passed in, just ignore it. This saves
596 * each caller from having to check. Also, ignore NS nodes. 604 * each caller from having to check. Also, ignore NS nodes.
597 * 605 *
598 */ 606 */
599 if (!object || 607 if (!object ||
@@ -613,7 +621,7 @@ void acpi_ut_remove_reference(union acpi_operand_object *object)
613 621
614 /* 622 /*
615 * Decrement the reference count, and only actually delete the object 623 * Decrement the reference count, and only actually delete the object
616 * if the reference count becomes 0. (Must also decrement the ref count 624 * if the reference count becomes 0. (Must also decrement the ref count
617 * of all subobjects!) 625 * of all subobjects!)
618 */ 626 */
619 (void)acpi_ut_update_object_reference(object, REF_DECREMENT); 627 (void)acpi_ut_update_object_reference(object, REF_DECREMENT);
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c
index 106cc97cb4af..d6d7121583c0 100644
--- a/drivers/acpi/utilities/uteval.c
+++ b/drivers/acpi/utilities/uteval.c
@@ -56,6 +56,34 @@ static acpi_status
56acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, 56acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
57 struct acpi_compatible_id *one_cid); 57 struct acpi_compatible_id *one_cid);
58 58
59/*
60 * Strings supported by the _OSI predefined (internal) method.
61 */
62static const char *acpi_interfaces_supported[] = {
63 /* Operating System Vendor Strings */
64
65 "Linux",
66 "Windows 2000",
67 "Windows 2001",
68 "Windows 2001 SP0",
69 "Windows 2001 SP1",
70 "Windows 2001 SP2",
71 "Windows 2001 SP3",
72 "Windows 2001 SP4",
73 "Windows 2001.1",
74 "Windows 2001.1 SP1", /* Added 03/2006 */
75 "Windows 2006", /* Added 03/2006 */
76
77 /* Feature Group Strings */
78
79 "Extended Address Space Descriptor"
80 /*
81 * All "optional" feature group strings (features that are implemented
82 * by the host) should be implemented in the host version of
83 * acpi_os_validate_interface and should not be added here.
84 */
85};
86
59/******************************************************************************* 87/*******************************************************************************
60 * 88 *
61 * FUNCTION: acpi_ut_osi_implementation 89 * FUNCTION: acpi_ut_osi_implementation
@@ -64,18 +92,18 @@ acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
64 * 92 *
65 * RETURN: Status 93 * RETURN: Status
66 * 94 *
67 * DESCRIPTION: Implementation of _OSI predefined control method 95 * DESCRIPTION: Implementation of the _OSI predefined control method
68 * Supported = _OSI (String)
69 * 96 *
70 ******************************************************************************/ 97 ******************************************************************************/
71 98
72acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) 99acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
73{ 100{
101 acpi_status status;
74 union acpi_operand_object *string_desc; 102 union acpi_operand_object *string_desc;
75 union acpi_operand_object *return_desc; 103 union acpi_operand_object *return_desc;
76 acpi_native_uint i; 104 acpi_native_uint i;
77 105
78 ACPI_FUNCTION_TRACE("ut_osi_implementation"); 106 ACPI_FUNCTION_TRACE(ut_osi_implementation);
79 107
80 /* Validate the string input argument */ 108 /* Validate the string input argument */
81 109
@@ -84,28 +112,47 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
84 return_ACPI_STATUS(AE_TYPE); 112 return_ACPI_STATUS(AE_TYPE);
85 } 113 }
86 114
87 /* Create a return object (Default value = 0) */ 115 /* Create a return object */
88 116
89 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); 117 return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
90 if (!return_desc) { 118 if (!return_desc) {
91 return_ACPI_STATUS(AE_NO_MEMORY); 119 return_ACPI_STATUS(AE_NO_MEMORY);
92 } 120 }
93 121
94 /* Compare input string to table of supported strings */ 122 /* Default return value is SUPPORTED */
123
124 return_desc->integer.value = ACPI_UINT32_MAX;
125 walk_state->return_desc = return_desc;
126
127 /* Compare input string to static table of supported interfaces */
95 128
96 for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { 129 for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) {
97 if (!ACPI_STRCMP(string_desc->string.pointer, 130 if (!ACPI_STRCMP
98 ACPI_CAST_PTR(char, 131 (string_desc->string.pointer,
99 acpi_gbl_valid_osi_strings[i]))) 132 acpi_interfaces_supported[i])) {
100 {
101 /* This string is supported */
102 133
103 return_desc->integer.value = 0xFFFFFFFF; 134 /* The interface is supported */
104 break; 135
136 return_ACPI_STATUS(AE_CTRL_TERMINATE);
105 } 137 }
106 } 138 }
107 139
108 walk_state->return_desc = return_desc; 140 /*
141 * Did not match the string in the static table, call the host OSL to
142 * check for a match with one of the optional strings (such as
143 * "Module Device", "3.0 Thermal Model", etc.)
144 */
145 status = acpi_os_validate_interface(string_desc->string.pointer);
146 if (ACPI_SUCCESS(status)) {
147
148 /* The interface is supported */
149
150 return_ACPI_STATUS(AE_CTRL_TERMINATE);
151 }
152
153 /* The interface is not supported */
154
155 return_desc->integer.value = 0;
109 return_ACPI_STATUS(AE_CTRL_TERMINATE); 156 return_ACPI_STATUS(AE_CTRL_TERMINATE);
110} 157}
111 158
@@ -134,19 +181,26 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
134 u32 expected_return_btypes, 181 u32 expected_return_btypes,
135 union acpi_operand_object **return_desc) 182 union acpi_operand_object **return_desc)
136{ 183{
137 struct acpi_parameter_info info; 184 struct acpi_evaluate_info *info;
138 acpi_status status; 185 acpi_status status;
139 u32 return_btype; 186 u32 return_btype;
140 187
141 ACPI_FUNCTION_TRACE("ut_evaluate_object"); 188 ACPI_FUNCTION_TRACE(ut_evaluate_object);
142 189
143 info.node = prefix_node; 190 /* Allocate the evaluation information block */
144 info.parameters = NULL; 191
145 info.parameter_type = ACPI_PARAM_ARGS; 192 info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
193 if (!info) {
194 return_ACPI_STATUS(AE_NO_MEMORY);
195 }
196
197 info->prefix_node = prefix_node;
198 info->pathname = path;
199 info->parameter_type = ACPI_PARAM_ARGS;
146 200
147 /* Evaluate the object/method */ 201 /* Evaluate the object/method */
148 202
149 status = acpi_ns_evaluate_relative(path, &info); 203 status = acpi_ns_evaluate(info);
150 if (ACPI_FAILURE(status)) { 204 if (ACPI_FAILURE(status)) {
151 if (status == AE_NOT_FOUND) { 205 if (status == AE_NOT_FOUND) {
152 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 206 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -158,25 +212,25 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
158 prefix_node, path, status); 212 prefix_node, path, status);
159 } 213 }
160 214
161 return_ACPI_STATUS(status); 215 goto cleanup;
162 } 216 }
163 217
164 /* Did we get a return object? */ 218 /* Did we get a return object? */
165 219
166 if (!info.return_object) { 220 if (!info->return_object) {
167 if (expected_return_btypes) { 221 if (expected_return_btypes) {
168 ACPI_ERROR_METHOD("No object was returned from", 222 ACPI_ERROR_METHOD("No object was returned from",
169 prefix_node, path, AE_NOT_EXIST); 223 prefix_node, path, AE_NOT_EXIST);
170 224
171 return_ACPI_STATUS(AE_NOT_EXIST); 225 status = AE_NOT_EXIST;
172 } 226 }
173 227
174 return_ACPI_STATUS(AE_OK); 228 goto cleanup;
175 } 229 }
176 230
177 /* Map the return object type to the bitmapped type */ 231 /* Map the return object type to the bitmapped type */
178 232
179 switch (ACPI_GET_OBJECT_TYPE(info.return_object)) { 233 switch (ACPI_GET_OBJECT_TYPE(info->return_object)) {
180 case ACPI_TYPE_INTEGER: 234 case ACPI_TYPE_INTEGER:
181 return_btype = ACPI_BTYPE_INTEGER; 235 return_btype = ACPI_BTYPE_INTEGER;
182 break; 236 break;
@@ -204,8 +258,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
204 * happen frequently if the "implicit return" feature is enabled. 258 * happen frequently if the "implicit return" feature is enabled.
205 * Just delete the return object and return AE_OK. 259 * Just delete the return object and return AE_OK.
206 */ 260 */
207 acpi_ut_remove_reference(info.return_object); 261 acpi_ut_remove_reference(info->return_object);
208 return_ACPI_STATUS(AE_OK); 262 goto cleanup;
209 } 263 }
210 264
211 /* Is the return object one of the expected types? */ 265 /* Is the return object one of the expected types? */
@@ -217,19 +271,23 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
217 ACPI_ERROR((AE_INFO, 271 ACPI_ERROR((AE_INFO,
218 "Type returned from %s was incorrect: %s, expected Btypes: %X", 272 "Type returned from %s was incorrect: %s, expected Btypes: %X",
219 path, 273 path,
220 acpi_ut_get_object_type_name(info.return_object), 274 acpi_ut_get_object_type_name(info->return_object),
221 expected_return_btypes)); 275 expected_return_btypes));
222 276
223 /* On error exit, we must delete the return object */ 277 /* On error exit, we must delete the return object */
224 278
225 acpi_ut_remove_reference(info.return_object); 279 acpi_ut_remove_reference(info->return_object);
226 return_ACPI_STATUS(AE_TYPE); 280 status = AE_TYPE;
281 goto cleanup;
227 } 282 }
228 283
229 /* Object type is OK, return it */ 284 /* Object type is OK, return it */
230 285
231 *return_desc = info.return_object; 286 *return_desc = info->return_object;
232 return_ACPI_STATUS(AE_OK); 287
288 cleanup:
289 ACPI_FREE(info);
290 return_ACPI_STATUS(status);
233} 291}
234 292
235/******************************************************************************* 293/*******************************************************************************
@@ -257,7 +315,7 @@ acpi_ut_evaluate_numeric_object(char *object_name,
257 union acpi_operand_object *obj_desc; 315 union acpi_operand_object *obj_desc;
258 acpi_status status; 316 acpi_status status;
259 317
260 ACPI_FUNCTION_TRACE("ut_evaluate_numeric_object"); 318 ACPI_FUNCTION_TRACE(ut_evaluate_numeric_object);
261 319
262 status = acpi_ut_evaluate_object(device_node, object_name, 320 status = acpi_ut_evaluate_object(device_node, object_name,
263 ACPI_BTYPE_INTEGER, &obj_desc); 321 ACPI_BTYPE_INTEGER, &obj_desc);
@@ -333,7 +391,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
333 union acpi_operand_object *obj_desc; 391 union acpi_operand_object *obj_desc;
334 acpi_status status; 392 acpi_status status;
335 393
336 ACPI_FUNCTION_TRACE("ut_execute_HID"); 394 ACPI_FUNCTION_TRACE(ut_execute_HID);
337 395
338 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID, 396 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID,
339 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, 397 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
@@ -343,6 +401,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
343 } 401 }
344 402
345 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 403 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
404
346 /* Convert the Numeric HID to string */ 405 /* Convert the Numeric HID to string */
347 406
348 acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, 407 acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
@@ -436,7 +495,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
436 struct acpi_compatible_id_list *cid_list; 495 struct acpi_compatible_id_list *cid_list;
437 acpi_native_uint i; 496 acpi_native_uint i;
438 497
439 ACPI_FUNCTION_TRACE("ut_execute_CID"); 498 ACPI_FUNCTION_TRACE(ut_execute_CID);
440 499
441 /* Evaluate the _CID method for this device */ 500 /* Evaluate the _CID method for this device */
442 501
@@ -459,7 +518,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
459 size = (((count - 1) * sizeof(struct acpi_compatible_id)) + 518 size = (((count - 1) * sizeof(struct acpi_compatible_id)) +
460 sizeof(struct acpi_compatible_id_list)); 519 sizeof(struct acpi_compatible_id_list));
461 520
462 cid_list = ACPI_MEM_CALLOCATE((acpi_size) size); 521 cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size);
463 if (!cid_list) { 522 if (!cid_list) {
464 return_ACPI_STATUS(AE_NO_MEMORY); 523 return_ACPI_STATUS(AE_NO_MEMORY);
465 } 524 }
@@ -479,6 +538,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
479 /* The _CID object can be either a single CID or a package (list) of CIDs */ 538 /* The _CID object can be either a single CID or a package (list) of CIDs */
480 539
481 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { 540 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
541
482 /* Translate each package element */ 542 /* Translate each package element */
483 543
484 for (i = 0; i < count; i++) { 544 for (i = 0; i < count; i++) {
@@ -499,7 +559,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
499 /* Cleanup on error */ 559 /* Cleanup on error */
500 560
501 if (ACPI_FAILURE(status)) { 561 if (ACPI_FAILURE(status)) {
502 ACPI_MEM_FREE(cid_list); 562 ACPI_FREE(cid_list);
503 } else { 563 } else {
504 *return_cid_list = cid_list; 564 *return_cid_list = cid_list;
505 } 565 }
@@ -533,7 +593,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
533 union acpi_operand_object *obj_desc; 593 union acpi_operand_object *obj_desc;
534 acpi_status status; 594 acpi_status status;
535 595
536 ACPI_FUNCTION_TRACE("ut_execute_UID"); 596 ACPI_FUNCTION_TRACE(ut_execute_UID);
537 597
538 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID, 598 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID,
539 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, 599 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING,
@@ -543,6 +603,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
543 } 603 }
544 604
545 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 605 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
606
546 /* Convert the Numeric UID to string */ 607 /* Convert the Numeric UID to string */
547 608
548 acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, 609 acpi_ex_unsigned_integer_to_string(obj_desc->integer.value,
@@ -582,7 +643,7 @@ acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags)
582 union acpi_operand_object *obj_desc; 643 union acpi_operand_object *obj_desc;
583 acpi_status status; 644 acpi_status status;
584 645
585 ACPI_FUNCTION_TRACE("ut_execute_STA"); 646 ACPI_FUNCTION_TRACE(ut_execute_STA);
586 647
587 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA, 648 status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA,
588 ACPI_BTYPE_INTEGER, &obj_desc); 649 ACPI_BTYPE_INTEGER, &obj_desc);
@@ -632,7 +693,7 @@ acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest)
632 acpi_status status; 693 acpi_status status;
633 u32 i; 694 u32 i;
634 695
635 ACPI_FUNCTION_TRACE("ut_execute_Sxds"); 696 ACPI_FUNCTION_TRACE(ut_execute_sxds);
636 697
637 for (i = 0; i < 4; i++) { 698 for (i = 0; i < 4; i++) {
638 highest[i] = 0xFF; 699 highest[i] = 0xFF;
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index ffd13383a325..e5999c65c0b8 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -43,7 +43,6 @@
43 43
44#define DEFINE_ACPI_GLOBALS 44#define DEFINE_ACPI_GLOBALS
45 45
46#include <linux/module.h>
47#include <acpi/acpi.h> 46#include <acpi/acpi.h>
48#include <acpi/acnamesp.h> 47#include <acpi/acnamesp.h>
49 48
@@ -119,6 +118,7 @@ const char *acpi_format_exception(acpi_status status)
119 } 118 }
120 119
121 if (!exception) { 120 if (!exception) {
121
122 /* Exception code was not recognized */ 122 /* Exception code was not recognized */
123 123
124 ACPI_ERROR((AE_INFO, 124 ACPI_ERROR((AE_INFO,
@@ -143,12 +143,10 @@ const char *acpi_format_exception(acpi_status status)
143 143
144/* Debug switch - level and trace mask */ 144/* Debug switch - level and trace mask */
145u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; 145u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT;
146EXPORT_SYMBOL(acpi_dbg_level);
147 146
148/* Debug switch - layer (component) mask */ 147/* Debug switch - layer (component) mask */
149 148
150u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; 149u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS;
151EXPORT_SYMBOL(acpi_dbg_layer);
152u32 acpi_gbl_nesting_level = 0; 150u32 acpi_gbl_nesting_level = 0;
153 151
154/* Debugger globals */ 152/* Debugger globals */
@@ -183,28 +181,6 @@ const char *acpi_gbl_highest_dstate_names[4] = {
183 "_S4D" 181 "_S4D"
184}; 182};
185 183
186/*
187 * Strings supported by the _OSI predefined (internal) method.
188 * When adding strings, be sure to update ACPI_NUM_OSI_STRINGS.
189 */
190const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = {
191 /* Operating System Vendor Strings */
192
193 "Linux",
194 "Windows 2000",
195 "Windows 2001",
196 "Windows 2001.1",
197 "Windows 2001 SP0",
198 "Windows 2001 SP1",
199 "Windows 2001 SP2",
200 "Windows 2001 SP3",
201 "Windows 2001 SP4",
202
203 /* Feature Group Strings */
204
205 "Extended Address Space Descriptor"
206};
207
208/******************************************************************************* 184/*******************************************************************************
209 * 185 *
210 * Namespace globals 186 * Namespace globals
@@ -317,9 +293,9 @@ char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position)
317 * 293 *
318 ******************************************************************************/ 294 ******************************************************************************/
319 295
320struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; 296struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1];
321 297
322struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES] = { 298struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1] = {
323 /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */ 299 /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */
324 300
325 /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1, 301 /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1,
@@ -467,7 +443,6 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
467/* Region type decoding */ 443/* Region type decoding */
468 444
469const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { 445const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
470/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
471 "SystemMemory", 446 "SystemMemory",
472 "SystemIO", 447 "SystemIO",
473 "PCI_Config", 448 "PCI_Config",
@@ -476,16 +451,15 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = {
476 "CMOS", 451 "CMOS",
477 "PCIBARTarget", 452 "PCIBARTarget",
478 "DataTable" 453 "DataTable"
479/*! [End] no source code translation !*/
480}; 454};
481 455
482char *acpi_ut_get_region_name(u8 space_id) 456char *acpi_ut_get_region_name(u8 space_id)
483{ 457{
484 458
485 if (space_id >= ACPI_USER_REGION_BEGIN) { 459 if (space_id >= ACPI_USER_REGION_BEGIN) {
486 return ("user_defined_region"); 460 return ("UserDefinedRegion");
487 } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) { 461 } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) {
488 return ("invalid_space_id"); 462 return ("InvalidSpaceId");
489 } 463 }
490 464
491 return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); 465 return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id]));
@@ -506,20 +480,18 @@ char *acpi_ut_get_region_name(u8 space_id)
506/* Event type decoding */ 480/* Event type decoding */
507 481
508static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { 482static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = {
509/*! [Begin] no source code translation (keep these strings as-is) */
510 "PM_Timer", 483 "PM_Timer",
511 "GlobalLock", 484 "GlobalLock",
512 "PowerButton", 485 "PowerButton",
513 "SleepButton", 486 "SleepButton",
514 "RealTimeClock", 487 "RealTimeClock",
515/*! [End] no source code translation !*/
516}; 488};
517 489
518char *acpi_ut_get_event_name(u32 event_id) 490char *acpi_ut_get_event_name(u32 event_id)
519{ 491{
520 492
521 if (event_id > ACPI_EVENT_MAX) { 493 if (event_id > ACPI_EVENT_MAX) {
522 return ("invalid_event_iD"); 494 return ("InvalidEventID");
523 } 495 }
524 496
525 return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); 497 return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id]));
@@ -550,7 +522,6 @@ static const char acpi_gbl_bad_type[] = "UNDEFINED";
550/* Printable names of the ACPI object types */ 522/* Printable names of the ACPI object types */
551 523
552static const char *acpi_gbl_ns_type_names[] = { 524static const char *acpi_gbl_ns_type_names[] = {
553/*! [Begin] no source code translation (keep these strings as-is) */
554 /* 00 */ "Untyped", 525 /* 00 */ "Untyped",
555 /* 01 */ "Integer", 526 /* 01 */ "Integer",
556 /* 02 */ "String", 527 /* 02 */ "String",
@@ -582,7 +553,6 @@ static const char *acpi_gbl_ns_type_names[] = {
582 /* 28 */ "Extra", 553 /* 28 */ "Extra",
583 /* 29 */ "Data", 554 /* 29 */ "Data",
584 /* 30 */ "Invalid" 555 /* 30 */ "Invalid"
585/*! [End] no source code translation !*/
586}; 556};
587 557
588char *acpi_ut_get_type_name(acpi_object_type type) 558char *acpi_ut_get_type_name(acpi_object_type type)
@@ -635,14 +605,14 @@ char *acpi_ut_get_node_name(void *object)
635 605
636 /* Descriptor must be a namespace node */ 606 /* Descriptor must be a namespace node */
637 607
638 if (node->descriptor != ACPI_DESC_TYPE_NAMED) { 608 if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
639 return ("####"); 609 return ("####");
640 } 610 }
641 611
642 /* Name must be a valid ACPI name */ 612 /* Name must be a valid ACPI name */
643 613
644 if (!acpi_ut_valid_acpi_name(node->name.integer)) { 614 if (!acpi_ut_valid_acpi_name(node->name.integer)) {
645 return ("????"); 615 node->name.integer = acpi_ut_repair_name(node->name.integer);
646 } 616 }
647 617
648 /* Return the name */ 618 /* Return the name */
@@ -665,7 +635,6 @@ char *acpi_ut_get_node_name(void *object)
665/* Printable names of object descriptor types */ 635/* Printable names of object descriptor types */
666 636
667static const char *acpi_gbl_desc_type_names[] = { 637static const char *acpi_gbl_desc_type_names[] = {
668/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
669 /* 00 */ "Invalid", 638 /* 00 */ "Invalid",
670 /* 01 */ "Cached", 639 /* 01 */ "Cached",
671 /* 02 */ "State-Generic", 640 /* 02 */ "State-Generic",
@@ -682,7 +651,6 @@ static const char *acpi_gbl_desc_type_names[] = {
682 /* 13 */ "Parser", 651 /* 13 */ "Parser",
683 /* 14 */ "Operand", 652 /* 14 */ "Operand",
684 /* 15 */ "Node" 653 /* 15 */ "Node"
685/*! [End] no source code translation !*/
686}; 654};
687 655
688char *acpi_ut_get_descriptor_name(void *object) 656char *acpi_ut_get_descriptor_name(void *object)
@@ -723,7 +691,7 @@ char *acpi_ut_get_descriptor_name(void *object)
723char *acpi_ut_get_mutex_name(u32 mutex_id) 691char *acpi_ut_get_mutex_name(u32 mutex_id)
724{ 692{
725 693
726 if (mutex_id > MAX_MUTEX) { 694 if (mutex_id > ACPI_MAX_MUTEX) {
727 return ("Invalid Mutex ID"); 695 return ("Invalid Mutex ID");
728 } 696 }
729 697
@@ -747,6 +715,7 @@ u8 acpi_ut_valid_object_type(acpi_object_type type)
747{ 715{
748 716
749 if (type > ACPI_TYPE_LOCAL_MAX) { 717 if (type > ACPI_TYPE_LOCAL_MAX) {
718
750 /* Note: Assumes all TYPEs are contiguous (external/local) */ 719 /* Note: Assumes all TYPEs are contiguous (external/local) */
751 720
752 return (FALSE); 721 return (FALSE);
@@ -773,7 +742,7 @@ void acpi_ut_init_globals(void)
773 acpi_status status; 742 acpi_status status;
774 u32 i; 743 u32 i;
775 744
776 ACPI_FUNCTION_TRACE("ut_init_globals"); 745 ACPI_FUNCTION_TRACE(ut_init_globals);
777 746
778 /* Create all memory caches */ 747 /* Create all memory caches */
779 748
@@ -784,14 +753,14 @@ void acpi_ut_init_globals(void)
784 753
785 /* ACPI table structure */ 754 /* ACPI table structure */
786 755
787 for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { 756 for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) {
788 acpi_gbl_table_lists[i].next = NULL; 757 acpi_gbl_table_lists[i].next = NULL;
789 acpi_gbl_table_lists[i].count = 0; 758 acpi_gbl_table_lists[i].count = 0;
790 } 759 }
791 760
792 /* Mutex locked flags */ 761 /* Mutex locked flags */
793 762
794 for (i = 0; i < NUM_MUTEX; i++) { 763 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
795 acpi_gbl_mutex_info[i].mutex = NULL; 764 acpi_gbl_mutex_info[i].mutex = NULL;
796 acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; 765 acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED;
797 acpi_gbl_mutex_info[i].use_count = 0; 766 acpi_gbl_mutex_info[i].use_count = 0;
@@ -856,7 +825,7 @@ void acpi_ut_init_globals(void)
856 825
857 acpi_gbl_root_node = NULL; 826 acpi_gbl_root_node = NULL;
858 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; 827 acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME;
859 acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED; 828 acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED;
860 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; 829 acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE;
861 acpi_gbl_root_node_struct.child = NULL; 830 acpi_gbl_root_node_struct.child = NULL;
862 acpi_gbl_root_node_struct.peer = NULL; 831 acpi_gbl_root_node_struct.peer = NULL;
@@ -869,3 +838,6 @@ void acpi_ut_init_globals(void)
869 838
870 return_VOID; 839 return_VOID;
871} 840}
841
842ACPI_EXPORT_SYMBOL(acpi_dbg_level)
843ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c
index ba771b4f39bc..ff76055eb7d6 100644
--- a/drivers/acpi/utilities/utinit.c
+++ b/drivers/acpi/utilities/utinit.c
@@ -50,7 +50,7 @@ ACPI_MODULE_NAME("utinit")
50 50
51/* Local prototypes */ 51/* Local prototypes */
52static void 52static void
53acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset); 53acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset);
54 54
55static void acpi_ut_terminate(void); 55static void acpi_ut_terminate(void);
56 56
@@ -69,12 +69,12 @@ static void acpi_ut_terminate(void);
69 ******************************************************************************/ 69 ******************************************************************************/
70 70
71static void 71static void
72acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset) 72acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset)
73{ 73{
74 74
75 ACPI_WARNING((AE_INFO, 75 ACPI_WARNING((AE_INFO,
76 "Invalid FADT value %s=%X at offset %X FADT=%p", 76 "Invalid FADT value %s=%X at offset %X FADT=%p",
77 register_name, value, (u32) offset, acpi_gbl_FADT)); 77 register_name, value, offset, acpi_gbl_FADT));
78} 78}
79 79
80/****************************************************************************** 80/******************************************************************************
@@ -176,7 +176,7 @@ static void acpi_ut_terminate(void)
176 struct acpi_gpe_xrupt_info *gpe_xrupt_info; 176 struct acpi_gpe_xrupt_info *gpe_xrupt_info;
177 struct acpi_gpe_xrupt_info *next_gpe_xrupt_info; 177 struct acpi_gpe_xrupt_info *next_gpe_xrupt_info;
178 178
179 ACPI_FUNCTION_TRACE("ut_terminate"); 179 ACPI_FUNCTION_TRACE(ut_terminate);
180 180
181 /* Free global tables, etc. */ 181 /* Free global tables, etc. */
182 /* Free global GPE blocks and related info structures */ 182 /* Free global GPE blocks and related info structures */
@@ -186,14 +186,14 @@ static void acpi_ut_terminate(void)
186 gpe_block = gpe_xrupt_info->gpe_block_list_head; 186 gpe_block = gpe_xrupt_info->gpe_block_list_head;
187 while (gpe_block) { 187 while (gpe_block) {
188 next_gpe_block = gpe_block->next; 188 next_gpe_block = gpe_block->next;
189 ACPI_MEM_FREE(gpe_block->event_info); 189 ACPI_FREE(gpe_block->event_info);
190 ACPI_MEM_FREE(gpe_block->register_info); 190 ACPI_FREE(gpe_block->register_info);
191 ACPI_MEM_FREE(gpe_block); 191 ACPI_FREE(gpe_block);
192 192
193 gpe_block = next_gpe_block; 193 gpe_block = next_gpe_block;
194 } 194 }
195 next_gpe_xrupt_info = gpe_xrupt_info->next; 195 next_gpe_xrupt_info = gpe_xrupt_info->next;
196 ACPI_MEM_FREE(gpe_xrupt_info); 196 ACPI_FREE(gpe_xrupt_info);
197 gpe_xrupt_info = next_gpe_xrupt_info; 197 gpe_xrupt_info = next_gpe_xrupt_info;
198 } 198 }
199 199
@@ -216,7 +216,7 @@ static void acpi_ut_terminate(void)
216void acpi_ut_subsystem_shutdown(void) 216void acpi_ut_subsystem_shutdown(void)
217{ 217{
218 218
219 ACPI_FUNCTION_TRACE("ut_subsystem_shutdown"); 219 ACPI_FUNCTION_TRACE(ut_subsystem_shutdown);
220 220
221 /* Just exit if subsystem is already shutdown */ 221 /* Just exit if subsystem is already shutdown */
222 222
@@ -228,6 +228,7 @@ void acpi_ut_subsystem_shutdown(void)
228 /* Subsystem appears active, go ahead and shut it down */ 228 /* Subsystem appears active, go ahead and shut it down */
229 229
230 acpi_gbl_shutdown = TRUE; 230 acpi_gbl_shutdown = TRUE;
231 acpi_gbl_startup_flags = 0;
231 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); 232 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n"));
232 233
233 /* Close the acpi_event Handling */ 234 /* Close the acpi_event Handling */
@@ -245,12 +246,5 @@ void acpi_ut_subsystem_shutdown(void)
245 /* Purge the local caches */ 246 /* Purge the local caches */
246 247
247 (void)acpi_ut_delete_caches(); 248 (void)acpi_ut_delete_caches();
248
249 /* Debug only - display leftover memory allocation, if any */
250
251#ifdef ACPI_DBG_TRACK_ALLOCATIONS
252 acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL);
253#endif
254
255 return_VOID; 249 return_VOID;
256} 250}
diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c
index 4a3360484e72..19d74bedce27 100644
--- a/drivers/acpi/utilities/utmath.c
+++ b/drivers/acpi/utilities/utmath.c
@@ -77,7 +77,7 @@ acpi_ut_short_divide(acpi_integer dividend,
77 union uint64_overlay quotient; 77 union uint64_overlay quotient;
78 u32 remainder32; 78 u32 remainder32;
79 79
80 ACPI_FUNCTION_TRACE("ut_short_divide"); 80 ACPI_FUNCTION_TRACE(ut_short_divide);
81 81
82 /* Always check for a zero divisor */ 82 /* Always check for a zero divisor */
83 83
@@ -139,7 +139,7 @@ acpi_ut_divide(acpi_integer in_dividend,
139 union uint64_overlay partial2; 139 union uint64_overlay partial2;
140 union uint64_overlay partial3; 140 union uint64_overlay partial3;
141 141
142 ACPI_FUNCTION_TRACE("ut_divide"); 142 ACPI_FUNCTION_TRACE(ut_divide);
143 143
144 /* Always check for a zero divisor */ 144 /* Always check for a zero divisor */
145 145
@@ -261,7 +261,7 @@ acpi_ut_short_divide(acpi_integer in_dividend,
261 acpi_integer * out_quotient, u32 * out_remainder) 261 acpi_integer * out_quotient, u32 * out_remainder)
262{ 262{
263 263
264 ACPI_FUNCTION_TRACE("ut_short_divide"); 264 ACPI_FUNCTION_TRACE(ut_short_divide);
265 265
266 /* Always check for a zero divisor */ 266 /* Always check for a zero divisor */
267 267
@@ -287,7 +287,7 @@ acpi_ut_divide(acpi_integer in_dividend,
287 acpi_integer in_divisor, 287 acpi_integer in_divisor,
288 acpi_integer * out_quotient, acpi_integer * out_remainder) 288 acpi_integer * out_quotient, acpi_integer * out_remainder)
289{ 289{
290 ACPI_FUNCTION_TRACE("ut_divide"); 290 ACPI_FUNCTION_TRACE(ut_divide);
291 291
292 /* Always check for a zero divisor */ 292 /* Always check for a zero divisor */
293 293
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 7364f5f8c9cd..5c75d35ad1cd 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -49,6 +49,33 @@ ACPI_MODULE_NAME("utmisc")
49 49
50/******************************************************************************* 50/*******************************************************************************
51 * 51 *
52 * FUNCTION: acpi_ut_is_aml_table
53 *
54 * PARAMETERS: Table - An ACPI table
55 *
56 * RETURN: TRUE if table contains executable AML; FALSE otherwise
57 *
58 * DESCRIPTION: Check ACPI Signature for a table that contains AML code.
59 * Currently, these are DSDT,SSDT,PSDT. All other table types are
60 * data tables that do not contain AML code.
61 *
62 ******************************************************************************/
63u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
64{
65
66 /* Ignore tables that contain AML */
67
68 if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) ||
69 ACPI_COMPARE_NAME(table->signature, PSDT_SIG) ||
70 ACPI_COMPARE_NAME(table->signature, SSDT_SIG)) {
71 return (TRUE);
72 }
73
74 return (FALSE);
75}
76
77/*******************************************************************************
78 *
52 * FUNCTION: acpi_ut_allocate_owner_id 79 * FUNCTION: acpi_ut_allocate_owner_id
53 * 80 *
54 * PARAMETERS: owner_id - Where the new owner ID is returned 81 * PARAMETERS: owner_id - Where the new owner ID is returned
@@ -60,6 +87,7 @@ ACPI_MODULE_NAME("utmisc")
60 * when the method exits or the table is unloaded. 87 * when the method exits or the table is unloaded.
61 * 88 *
62 ******************************************************************************/ 89 ******************************************************************************/
90
63acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) 91acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
64{ 92{
65 acpi_native_uint i; 93 acpi_native_uint i;
@@ -67,7 +95,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
67 acpi_native_uint k; 95 acpi_native_uint k;
68 acpi_status status; 96 acpi_status status;
69 97
70 ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); 98 ACPI_FUNCTION_TRACE(ut_allocate_owner_id);
71 99
72 /* Guard against multiple allocations of ID to the same location */ 100 /* Guard against multiple allocations of ID to the same location */
73 101
@@ -97,6 +125,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
97 125
98 for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { 126 for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) {
99 if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { 127 if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) {
128
100 /* There are no free IDs in this mask */ 129 /* There are no free IDs in this mask */
101 130
102 break; 131 break;
@@ -123,7 +152,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
123 (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); 152 (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j));
124 153
125 ACPI_DEBUG_PRINT((ACPI_DB_VALUES, 154 ACPI_DEBUG_PRINT((ACPI_DB_VALUES,
126 "Allocated owner_id: %2.2X\n", 155 "Allocated OwnerId: %2.2X\n",
127 (unsigned int)*owner_id)); 156 (unsigned int)*owner_id));
128 goto exit; 157 goto exit;
129 } 158 }
@@ -144,7 +173,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
144 */ 173 */
145 status = AE_OWNER_ID_LIMIT; 174 status = AE_OWNER_ID_LIMIT;
146 ACPI_ERROR((AE_INFO, 175 ACPI_ERROR((AE_INFO,
147 "Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT")); 176 "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT"));
148 177
149 exit: 178 exit:
150 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); 179 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
@@ -172,7 +201,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
172 acpi_native_uint index; 201 acpi_native_uint index;
173 u32 bit; 202 u32 bit;
174 203
175 ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id); 204 ACPI_FUNCTION_TRACE_U32(ut_release_owner_id, owner_id);
176 205
177 /* Always clear the input owner_id (zero is an invalid ID) */ 206 /* Always clear the input owner_id (zero is an invalid ID) */
178 207
@@ -181,7 +210,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
181 /* Zero is not a valid owner_iD */ 210 /* Zero is not a valid owner_iD */
182 211
183 if (owner_id == 0) { 212 if (owner_id == 0) {
184 ACPI_ERROR((AE_INFO, "Invalid owner_id: %2.2X", owner_id)); 213 ACPI_ERROR((AE_INFO, "Invalid OwnerId: %2.2X", owner_id));
185 return_VOID; 214 return_VOID;
186 } 215 }
187 216
@@ -207,7 +236,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
207 acpi_gbl_owner_id_mask[index] ^= bit; 236 acpi_gbl_owner_id_mask[index] ^= bit;
208 } else { 237 } else {
209 ACPI_ERROR((AE_INFO, 238 ACPI_ERROR((AE_INFO,
210 "Release of non-allocated owner_id: %2.2X", 239 "Release of non-allocated OwnerId: %2.2X",
211 owner_id + 1)); 240 owner_id + 1));
212 } 241 }
213 242
@@ -273,6 +302,7 @@ void acpi_ut_print_string(char *string, u8 max_length)
273 302
274 acpi_os_printf("\""); 303 acpi_os_printf("\"");
275 for (i = 0; string[i] && (i < max_length); i++) { 304 for (i = 0; string[i] && (i < max_length); i++) {
305
276 /* Escape sequences */ 306 /* Escape sequences */
277 307
278 switch (string[i]) { 308 switch (string[i]) {
@@ -461,12 +491,47 @@ acpi_ut_display_init_pathname(u8 type,
461 } 491 }
462 acpi_os_printf("\n"); 492 acpi_os_printf("\n");
463 493
464 ACPI_MEM_FREE(buffer.pointer); 494 ACPI_FREE(buffer.pointer);
465} 495}
466#endif 496#endif
467 497
468/******************************************************************************* 498/*******************************************************************************
469 * 499 *
500 * FUNCTION: acpi_ut_valid_acpi_char
501 *
502 * PARAMETERS: Char - The character to be examined
503 *
504 * RETURN: TRUE if the character is valid, FALSE otherwise
505 *
506 * DESCRIPTION: Check for a valid ACPI character. Must be one of:
507 * 1) Upper case alpha
508 * 2) numeric
509 * 3) underscore
510 *
511 * We allow a '!' as the last character because of the ASF! table
512 *
513 ******************************************************************************/
514
515u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position)
516{
517
518 if (!((character >= 'A' && character <= 'Z') ||
519 (character >= '0' && character <= '9') || (character == '_'))) {
520
521 /* Allow a '!' in the last position */
522
523 if (character == '!' && position == 3) {
524 return (TRUE);
525 }
526
527 return (FALSE);
528 }
529
530 return (TRUE);
531}
532
533/*******************************************************************************
534 *
470 * FUNCTION: acpi_ut_valid_acpi_name 535 * FUNCTION: acpi_ut_valid_acpi_name
471 * 536 *
472 * PARAMETERS: Name - The name to be examined 537 * PARAMETERS: Name - The name to be examined
@@ -482,19 +547,13 @@ acpi_ut_display_init_pathname(u8 type,
482 547
483u8 acpi_ut_valid_acpi_name(u32 name) 548u8 acpi_ut_valid_acpi_name(u32 name)
484{ 549{
485 char *name_ptr = (char *)&name;
486 char character;
487 acpi_native_uint i; 550 acpi_native_uint i;
488 551
489 ACPI_FUNCTION_ENTRY(); 552 ACPI_FUNCTION_ENTRY();
490 553
491 for (i = 0; i < ACPI_NAME_SIZE; i++) { 554 for (i = 0; i < ACPI_NAME_SIZE; i++) {
492 character = *name_ptr; 555 if (!acpi_ut_valid_acpi_char
493 name_ptr++; 556 ((ACPI_CAST_PTR(char, &name))[i], i)) {
494
495 if (!((character == '_') ||
496 (character >= 'A' && character <= 'Z') ||
497 (character >= '0' && character <= '9'))) {
498 return (FALSE); 557 return (FALSE);
499 } 558 }
500 } 559 }
@@ -504,24 +563,37 @@ u8 acpi_ut_valid_acpi_name(u32 name)
504 563
505/******************************************************************************* 564/*******************************************************************************
506 * 565 *
507 * FUNCTION: acpi_ut_valid_acpi_character 566 * FUNCTION: acpi_ut_repair_name
508 * 567 *
509 * PARAMETERS: Character - The character to be examined 568 * PARAMETERS: Name - The ACPI name to be repaired
510 * 569 *
511 * RETURN: 1 if Character may appear in a name, else 0 570 * RETURN: Repaired version of the name
512 * 571 *
513 * DESCRIPTION: Check for a printable character 572 * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
573 * return the new name.
514 * 574 *
515 ******************************************************************************/ 575 ******************************************************************************/
516 576
517u8 acpi_ut_valid_acpi_character(char character) 577acpi_name acpi_ut_repair_name(acpi_name name)
518{ 578{
579 char *name_ptr = ACPI_CAST_PTR(char, &name);
580 char new_name[ACPI_NAME_SIZE];
581 acpi_native_uint i;
519 582
520 ACPI_FUNCTION_ENTRY(); 583 for (i = 0; i < ACPI_NAME_SIZE; i++) {
584 new_name[i] = name_ptr[i];
521 585
522 return ((u8) ((character == '_') || 586 /*
523 (character >= 'A' && character <= 'Z') || 587 * Replace a bad character with something printable, yet technically
524 (character >= '0' && character <= '9'))); 588 * still invalid. This prevents any collisions with existing "good"
589 * names in the namespace.
590 */
591 if (!acpi_ut_valid_acpi_char(name_ptr[i], i)) {
592 new_name[i] = '*';
593 }
594 }
595
596 return (*ACPI_CAST_PTR(u32, new_name));
525} 597}
526 598
527/******************************************************************************* 599/*******************************************************************************
@@ -529,7 +601,8 @@ u8 acpi_ut_valid_acpi_character(char character)
529 * FUNCTION: acpi_ut_strtoul64 601 * FUNCTION: acpi_ut_strtoul64
530 * 602 *
531 * PARAMETERS: String - Null terminated string 603 * PARAMETERS: String - Null terminated string
532 * Base - Radix of the string: 10, 16, or ACPI_ANY_BASE 604 * Base - Radix of the string: 16 or ACPI_ANY_BASE;
605 * ACPI_ANY_BASE means 'in behalf of to_integer'
533 * ret_integer - Where the converted integer is returned 606 * ret_integer - Where the converted integer is returned
534 * 607 *
535 * RETURN: Status and Converted value 608 * RETURN: Status and Converted value
@@ -545,16 +618,17 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
545 u32 this_digit = 0; 618 u32 this_digit = 0;
546 acpi_integer return_value = 0; 619 acpi_integer return_value = 0;
547 acpi_integer quotient; 620 acpi_integer quotient;
621 acpi_integer dividend;
622 u32 to_integer_op = (base == ACPI_ANY_BASE);
623 u32 mode32 = (acpi_gbl_integer_byte_width == 4);
624 u8 valid_digits = 0;
625 u8 sign_of0x = 0;
626 u8 term = 0;
548 627
549 ACPI_FUNCTION_TRACE("ut_stroul64"); 628 ACPI_FUNCTION_TRACE(ut_stroul64);
550
551 if ((!string) || !(*string)) {
552 goto error_exit;
553 }
554 629
555 switch (base) { 630 switch (base) {
556 case ACPI_ANY_BASE: 631 case ACPI_ANY_BASE:
557 case 10:
558 case 16: 632 case 16:
559 break; 633 break;
560 634
@@ -563,76 +637,110 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
563 return_ACPI_STATUS(AE_BAD_PARAMETER); 637 return_ACPI_STATUS(AE_BAD_PARAMETER);
564 } 638 }
565 639
640 if (!string) {
641 goto error_exit;
642 }
643
566 /* Skip over any white space in the buffer */ 644 /* Skip over any white space in the buffer */
567 645
568 while (ACPI_IS_SPACE(*string) || *string == '\t') { 646 while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) {
569 string++; 647 string++;
570 } 648 }
571 649
572 /* 650 if (to_integer_op) {
573 * If the input parameter Base is zero, then we need to 651 /*
574 * determine if it is decimal or hexadecimal: 652 * Base equal to ACPI_ANY_BASE means 'to_integer operation case'.
575 */ 653 * We need to determine if it is decimal or hexadecimal.
576 if (base == 0) { 654 */
577 if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { 655 if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) {
656 sign_of0x = 1;
578 base = 16; 657 base = 16;
658
659 /* Skip over the leading '0x' */
579 string += 2; 660 string += 2;
580 } else { 661 } else {
581 base = 10; 662 base = 10;
582 } 663 }
583 } 664 }
584 665
585 /* 666 /* Any string left? Check that '0x' is not followed by white space. */
586 * For hexadecimal base, skip over the leading 667
587 * 0 or 0x, if they are present. 668 if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') {
588 */ 669 if (to_integer_op) {
589 if ((base == 16) && 670 goto error_exit;
590 (*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { 671 } else {
591 string += 2; 672 goto all_done;
673 }
592 } 674 }
593 675
594 /* Any string left? */ 676 dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
595 677
596 if (!(*string)) { 678 /* At least one character in the string here */
597 goto error_exit;
598 }
599 679
600 /* Main loop: convert the string to a 64-bit integer */ 680 /* Main loop: convert the string to a 64-bit integer */
601 681
602 while (*string) { 682 while (*string) {
603 if (ACPI_IS_DIGIT(*string)) { 683 if (ACPI_IS_DIGIT(*string)) {
684
604 /* Convert ASCII 0-9 to Decimal value */ 685 /* Convert ASCII 0-9 to Decimal value */
605 686
606 this_digit = ((u8) * string) - '0'; 687 this_digit = ((u8) * string) - '0';
607 } else { 688 } else if (base == 10) {
608 if (base == 10) {
609 /* Digit is out of range */
610 689
611 goto error_exit; 690 /* Digit is out of range; possible in to_integer case only */
612 }
613 691
692 term = 1;
693 } else {
614 this_digit = (u8) ACPI_TOUPPER(*string); 694 this_digit = (u8) ACPI_TOUPPER(*string);
615 if (ACPI_IS_XDIGIT((char)this_digit)) { 695 if (ACPI_IS_XDIGIT((char)this_digit)) {
696
616 /* Convert ASCII Hex char to value */ 697 /* Convert ASCII Hex char to value */
617 698
618 this_digit = this_digit - 'A' + 10; 699 this_digit = this_digit - 'A' + 10;
619 } else { 700 } else {
620 /* 701 term = 1;
621 * We allow non-hex chars, just stop now, same as end-of-string. 702 }
622 * See ACPI spec, string-to-integer conversion. 703 }
623 */ 704
705 if (term) {
706 if (to_integer_op) {
707 goto error_exit;
708 } else {
624 break; 709 break;
625 } 710 }
711 } else if ((valid_digits == 0) && (this_digit == 0)
712 && !sign_of0x) {
713
714 /* Skip zeros */
715 string++;
716 continue;
717 }
718
719 valid_digits++;
720
721 if (sign_of0x
722 && ((valid_digits > 16)
723 || ((valid_digits > 8) && mode32))) {
724 /*
725 * This is to_integer operation case.
726 * No any restrictions for string-to-integer conversion,
727 * see ACPI spec.
728 */
729 goto error_exit;
626 } 730 }
627 731
628 /* Divide the digit into the correct position */ 732 /* Divide the digit into the correct position */
629 733
630 (void) 734 (void)
631 acpi_ut_short_divide((ACPI_INTEGER_MAX - 735 acpi_ut_short_divide((dividend - (acpi_integer) this_digit),
632 (acpi_integer) this_digit), base, 736 base, &quotient, NULL);
633 &quotient, NULL); 737
634 if (return_value > quotient) { 738 if (return_value > quotient) {
635 goto error_exit; 739 if (to_integer_op) {
740 goto error_exit;
741 } else {
742 break;
743 }
636 } 744 }
637 745
638 return_value *= base; 746 return_value *= base;
@@ -642,6 +750,8 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
642 750
643 /* All done, normal exit */ 751 /* All done, normal exit */
644 752
753 all_done:
754
645 *ret_integer = return_value; 755 *ret_integer = return_value;
646 return_ACPI_STATUS(AE_OK); 756 return_ACPI_STATUS(AE_OK);
647 757
@@ -719,7 +829,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
719 u32 this_index; 829 u32 this_index;
720 union acpi_operand_object *this_source_obj; 830 union acpi_operand_object *this_source_obj;
721 831
722 ACPI_FUNCTION_TRACE("ut_walk_package_tree"); 832 ACPI_FUNCTION_TRACE(ut_walk_package_tree);
723 833
724 state = acpi_ut_create_pkg_state(source_object, target_object, 0); 834 state = acpi_ut_create_pkg_state(source_object, target_object, 0);
725 if (!state) { 835 if (!state) {
@@ -727,6 +837,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
727 } 837 }
728 838
729 while (state) { 839 while (state) {
840
730 /* Get one element of the package */ 841 /* Get one element of the package */
731 842
732 this_index = state->pkg.index; 843 this_index = state->pkg.index;
@@ -814,31 +925,6 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
814 925
815/******************************************************************************* 926/*******************************************************************************
816 * 927 *
817 * FUNCTION: acpi_ut_generate_checksum
818 *
819 * PARAMETERS: Buffer - Buffer to be scanned
820 * Length - number of bytes to examine
821 *
822 * RETURN: The generated checksum
823 *
824 * DESCRIPTION: Generate a checksum on a raw buffer
825 *
826 ******************************************************************************/
827
828u8 acpi_ut_generate_checksum(u8 * buffer, u32 length)
829{
830 u32 i;
831 signed char sum = 0;
832
833 for (i = 0; i < length; i++) {
834 sum = (signed char)(sum + buffer[i]);
835 }
836
837 return ((u8) (0 - sum));
838}
839
840/*******************************************************************************
841 *
842 * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info 928 * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info
843 * 929 *
844 * PARAMETERS: module_name - Caller's module name (for error output) 930 * PARAMETERS: module_name - Caller's module name (for error output)
@@ -900,36 +986,3 @@ acpi_ut_info(char *module_name, u32 line_number, char *format, ...)
900 acpi_os_vprintf(format, args); 986 acpi_os_vprintf(format, args);
901 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); 987 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
902} 988}
903
904/*******************************************************************************
905 *
906 * FUNCTION: acpi_ut_report_error, Warning, Info
907 *
908 * PARAMETERS: module_name - Caller's module name (for error output)
909 * line_number - Caller's line number (for error output)
910 *
911 * RETURN: None
912 *
913 * DESCRIPTION: Print error message
914 *
915 * Note: Legacy only, should be removed when no longer used by drivers.
916 *
917 ******************************************************************************/
918
919void acpi_ut_report_error(char *module_name, u32 line_number)
920{
921
922 acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
923}
924
925void acpi_ut_report_warning(char *module_name, u32 line_number)
926{
927
928 acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number);
929}
930
931void acpi_ut_report_info(char *module_name, u32 line_number)
932{
933
934 acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number);
935}
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c
index 45a7244df924..25eb34369afa 100644
--- a/drivers/acpi/utilities/utmutex.c
+++ b/drivers/acpi/utilities/utmutex.c
@@ -68,19 +68,26 @@ acpi_status acpi_ut_mutex_initialize(void)
68 u32 i; 68 u32 i;
69 acpi_status status; 69 acpi_status status;
70 70
71 ACPI_FUNCTION_TRACE("ut_mutex_initialize"); 71 ACPI_FUNCTION_TRACE(ut_mutex_initialize);
72 72
73 /* 73 /*
74 * Create each of the predefined mutex objects 74 * Create each of the predefined mutex objects
75 */ 75 */
76 for (i = 0; i < NUM_MUTEX; i++) { 76 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
77 status = acpi_ut_create_mutex(i); 77 status = acpi_ut_create_mutex(i);
78 if (ACPI_FAILURE(status)) { 78 if (ACPI_FAILURE(status)) {
79 return_ACPI_STATUS(status); 79 return_ACPI_STATUS(status);
80 } 80 }
81 } 81 }
82 82
83 /* Create the spinlocks for use at interrupt level */
84
83 status = acpi_os_create_lock(&acpi_gbl_gpe_lock); 85 status = acpi_os_create_lock(&acpi_gbl_gpe_lock);
86 if (ACPI_FAILURE(status)) {
87 return_ACPI_STATUS(status);
88 }
89
90 status = acpi_os_create_lock(&acpi_gbl_hardware_lock);
84 return_ACPI_STATUS(status); 91 return_ACPI_STATUS(status);
85} 92}
86 93
@@ -100,16 +107,19 @@ void acpi_ut_mutex_terminate(void)
100{ 107{
101 u32 i; 108 u32 i;
102 109
103 ACPI_FUNCTION_TRACE("ut_mutex_terminate"); 110 ACPI_FUNCTION_TRACE(ut_mutex_terminate);
104 111
105 /* 112 /*
106 * Delete each predefined mutex object 113 * Delete each predefined mutex object
107 */ 114 */
108 for (i = 0; i < NUM_MUTEX; i++) { 115 for (i = 0; i < ACPI_NUM_MUTEX; i++) {
109 (void)acpi_ut_delete_mutex(i); 116 (void)acpi_ut_delete_mutex(i);
110 } 117 }
111 118
119 /* Delete the spinlocks */
120
112 acpi_os_delete_lock(acpi_gbl_gpe_lock); 121 acpi_os_delete_lock(acpi_gbl_gpe_lock);
122 acpi_os_delete_lock(acpi_gbl_hardware_lock);
113 return_VOID; 123 return_VOID;
114} 124}
115 125
@@ -129,9 +139,9 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id)
129{ 139{
130 acpi_status status = AE_OK; 140 acpi_status status = AE_OK;
131 141
132 ACPI_FUNCTION_TRACE_U32("ut_create_mutex", mutex_id); 142 ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id);
133 143
134 if (mutex_id > MAX_MUTEX) { 144 if (mutex_id > ACPI_MAX_MUTEX) {
135 return_ACPI_STATUS(AE_BAD_PARAMETER); 145 return_ACPI_STATUS(AE_BAD_PARAMETER);
136 } 146 }
137 147
@@ -163,9 +173,9 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
163{ 173{
164 acpi_status status; 174 acpi_status status;
165 175
166 ACPI_FUNCTION_TRACE_U32("ut_delete_mutex", mutex_id); 176 ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id);
167 177
168 if (mutex_id > MAX_MUTEX) { 178 if (mutex_id > ACPI_MAX_MUTEX) {
169 return_ACPI_STATUS(AE_BAD_PARAMETER); 179 return_ACPI_STATUS(AE_BAD_PARAMETER);
170 } 180 }
171 181
@@ -192,11 +202,11 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id)
192acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) 202acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
193{ 203{
194 acpi_status status; 204 acpi_status status;
195 u32 this_thread_id; 205 acpi_thread_id this_thread_id;
196 206
197 ACPI_FUNCTION_NAME("ut_acquire_mutex"); 207 ACPI_FUNCTION_NAME(ut_acquire_mutex);
198 208
199 if (mutex_id > MAX_MUTEX) { 209 if (mutex_id > ACPI_MAX_MUTEX) {
200 return (AE_BAD_PARAMETER); 210 return (AE_BAD_PARAMETER);
201 } 211 }
202 212
@@ -213,7 +223,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
213 * the mutex ordering rule. This indicates a coding error somewhere in 223 * the mutex ordering rule. This indicates a coding error somewhere in
214 * the ACPI subsystem code. 224 * the ACPI subsystem code.
215 */ 225 */
216 for (i = mutex_id; i < MAX_MUTEX; i++) { 226 for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) {
217 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { 227 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
218 if (i == mutex_id) { 228 if (i == mutex_id) {
219 ACPI_ERROR((AE_INFO, 229 ACPI_ERROR((AE_INFO,
@@ -275,16 +285,16 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
275acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) 285acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
276{ 286{
277 acpi_status status; 287 acpi_status status;
278 u32 this_thread_id; 288 acpi_thread_id this_thread_id;
279 289
280 ACPI_FUNCTION_NAME("ut_release_mutex"); 290 ACPI_FUNCTION_NAME(ut_release_mutex);
281 291
282 this_thread_id = acpi_os_get_thread_id(); 292 this_thread_id = acpi_os_get_thread_id();
283 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, 293 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
284 "Thread %X releasing Mutex [%s]\n", this_thread_id, 294 "Thread %X releasing Mutex [%s]\n", this_thread_id,
285 acpi_ut_get_mutex_name(mutex_id))); 295 acpi_ut_get_mutex_name(mutex_id)));
286 296
287 if (mutex_id > MAX_MUTEX) { 297 if (mutex_id > ACPI_MAX_MUTEX) {
288 return (AE_BAD_PARAMETER); 298 return (AE_BAD_PARAMETER);
289 } 299 }
290 300
@@ -309,7 +319,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
309 * ordering rule. This indicates a coding error somewhere in 319 * ordering rule. This indicates a coding error somewhere in
310 * the ACPI subsystem code. 320 * the ACPI subsystem code.
311 */ 321 */
312 for (i = mutex_id; i < MAX_MUTEX; i++) { 322 for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) {
313 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { 323 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
314 if (i == mutex_id) { 324 if (i == mutex_id) {
315 continue; 325 continue;
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
index 7ee2d1d98071..ba7d8ac702df 100644
--- a/drivers/acpi/utilities/utobject.c
+++ b/drivers/acpi/utilities/utobject.c
@@ -92,7 +92,7 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name,
92 union acpi_operand_object *object; 92 union acpi_operand_object *object;
93 union acpi_operand_object *second_object; 93 union acpi_operand_object *second_object;
94 94
95 ACPI_FUNCTION_TRACE_STR("ut_create_internal_object_dbg", 95 ACPI_FUNCTION_TRACE_STR(ut_create_internal_object_dbg,
96 acpi_ut_get_type_name(type)); 96 acpi_ut_get_type_name(type));
97 97
98 /* Allocate the raw object descriptor */ 98 /* Allocate the raw object descriptor */
@@ -161,7 +161,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size)
161 union acpi_operand_object *buffer_desc; 161 union acpi_operand_object *buffer_desc;
162 u8 *buffer = NULL; 162 u8 *buffer = NULL;
163 163
164 ACPI_FUNCTION_TRACE_U32("ut_create_buffer_object", buffer_size); 164 ACPI_FUNCTION_TRACE_U32(ut_create_buffer_object, buffer_size);
165 165
166 /* Create a new Buffer object */ 166 /* Create a new Buffer object */
167 167
@@ -173,9 +173,10 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size)
173 /* Create an actual buffer only if size > 0 */ 173 /* Create an actual buffer only if size > 0 */
174 174
175 if (buffer_size > 0) { 175 if (buffer_size > 0) {
176
176 /* Allocate the actual buffer */ 177 /* Allocate the actual buffer */
177 178
178 buffer = ACPI_MEM_CALLOCATE(buffer_size); 179 buffer = ACPI_ALLOCATE_ZEROED(buffer_size);
179 if (!buffer) { 180 if (!buffer) {
180 ACPI_ERROR((AE_INFO, "Could not allocate size %X", 181 ACPI_ERROR((AE_INFO, "Could not allocate size %X",
181 (u32) buffer_size)); 182 (u32) buffer_size));
@@ -214,7 +215,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
214 union acpi_operand_object *string_desc; 215 union acpi_operand_object *string_desc;
215 char *string; 216 char *string;
216 217
217 ACPI_FUNCTION_TRACE_U32("ut_create_string_object", string_size); 218 ACPI_FUNCTION_TRACE_U32(ut_create_string_object, string_size);
218 219
219 /* Create a new String object */ 220 /* Create a new String object */
220 221
@@ -227,7 +228,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
227 * Allocate the actual string buffer -- (Size + 1) for NULL terminator. 228 * Allocate the actual string buffer -- (Size + 1) for NULL terminator.
228 * NOTE: Zero-length strings are NULL terminated 229 * NOTE: Zero-length strings are NULL terminated
229 */ 230 */
230 string = ACPI_MEM_CALLOCATE(string_size + 1); 231 string = ACPI_ALLOCATE_ZEROED(string_size + 1);
231 if (!string) { 232 if (!string) {
232 ACPI_ERROR((AE_INFO, "Could not allocate size %X", 233 ACPI_ERROR((AE_INFO, "Could not allocate size %X",
233 (u32) string_size)); 234 (u32) string_size));
@@ -260,7 +261,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
260u8 acpi_ut_valid_internal_object(void *object) 261u8 acpi_ut_valid_internal_object(void *object)
261{ 262{
262 263
263 ACPI_FUNCTION_NAME("ut_valid_internal_object"); 264 ACPI_FUNCTION_NAME(ut_valid_internal_object);
264 265
265 /* Check for a null pointer */ 266 /* Check for a null pointer */
266 267
@@ -308,7 +309,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name,
308{ 309{
309 union acpi_operand_object *object; 310 union acpi_operand_object *object;
310 311
311 ACPI_FUNCTION_TRACE("ut_allocate_object_desc_dbg"); 312 ACPI_FUNCTION_TRACE(ut_allocate_object_desc_dbg);
312 313
313 object = acpi_os_acquire_object(acpi_gbl_operand_cache); 314 object = acpi_os_acquire_object(acpi_gbl_operand_cache);
314 if (!object) { 315 if (!object) {
@@ -319,6 +320,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name,
319 } 320 }
320 321
321 /* Mark the descriptor type */ 322 /* Mark the descriptor type */
323
322 memset(object, 0, sizeof(union acpi_operand_object)); 324 memset(object, 0, sizeof(union acpi_operand_object));
323 ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND); 325 ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND);
324 326
@@ -342,7 +344,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name,
342 344
343void acpi_ut_delete_object_desc(union acpi_operand_object *object) 345void acpi_ut_delete_object_desc(union acpi_operand_object *object)
344{ 346{
345 ACPI_FUNCTION_TRACE_PTR("ut_delete_object_desc", object); 347 ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object);
346 348
347 /* Object must be an union acpi_operand_object */ 349 /* Object must be an union acpi_operand_object */
348 350
@@ -381,7 +383,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
381 acpi_size length; 383 acpi_size length;
382 acpi_status status = AE_OK; 384 acpi_status status = AE_OK;
383 385
384 ACPI_FUNCTION_TRACE_PTR("ut_get_simple_object_size", internal_object); 386 ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object);
385 387
386 /* 388 /*
387 * Handle a null object (Could be a uninitialized package 389 * Handle a null object (Could be a uninitialized package
@@ -397,6 +399,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
397 length = sizeof(union acpi_object); 399 length = sizeof(union acpi_object);
398 400
399 if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { 401 if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) {
402
400 /* Object is a named object (reference), just return the length */ 403 /* Object is a named object (reference), just return the length */
401 404
402 *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); 405 *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
@@ -559,7 +562,7 @@ acpi_ut_get_package_object_size(union acpi_operand_object *internal_object,
559 acpi_status status; 562 acpi_status status;
560 struct acpi_pkg_info info; 563 struct acpi_pkg_info info;
561 564
562 ACPI_FUNCTION_TRACE_PTR("ut_get_package_object_size", internal_object); 565 ACPI_FUNCTION_TRACE_PTR(ut_get_package_object_size, internal_object);
563 566
564 info.length = 0; 567 info.length = 0;
565 info.object_space = 0; 568 info.object_space = 0;
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c
index 16461317113f..5a2de92831d3 100644
--- a/drivers/acpi/utilities/utresrc.c
+++ b/drivers/acpi/utilities/utresrc.c
@@ -45,113 +45,113 @@
45#include <acpi/amlresrc.h> 45#include <acpi/amlresrc.h>
46 46
47#define _COMPONENT ACPI_UTILITIES 47#define _COMPONENT ACPI_UTILITIES
48ACPI_MODULE_NAME("utmisc") 48ACPI_MODULE_NAME("utresrc")
49 49
50#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) 50#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
51/* 51/*
52 * Strings used to decode resource descriptors. 52 * Strings used to decode resource descriptors.
53 * Used by both the disasssembler and the debugger resource dump routines 53 * Used by both the disasssembler and the debugger resource dump routines
54 */ 54 */
55const char *acpi_gbl_BMdecode[2] = { 55const char *acpi_gbl_bm_decode[] = {
56 "not_bus_master", 56 "NotBusMaster",
57 "bus_master" 57 "BusMaster"
58}; 58};
59 59
60const char *acpi_gbl_config_decode[4] = { 60const char *acpi_gbl_config_decode[] = {
61 "0 - Good Configuration", 61 "0 - Good Configuration",
62 "1 - Acceptable Configuration", 62 "1 - Acceptable Configuration",
63 "2 - Suboptimal Configuration", 63 "2 - Suboptimal Configuration",
64 "3 - ***Invalid Configuration***", 64 "3 - ***Invalid Configuration***",
65}; 65};
66 66
67const char *acpi_gbl_consume_decode[2] = { 67const char *acpi_gbl_consume_decode[] = {
68 "resource_producer", 68 "ResourceProducer",
69 "resource_consumer" 69 "ResourceConsumer"
70}; 70};
71 71
72const char *acpi_gbl_DECdecode[2] = { 72const char *acpi_gbl_dec_decode[] = {
73 "pos_decode", 73 "PosDecode",
74 "sub_decode" 74 "SubDecode"
75}; 75};
76 76
77const char *acpi_gbl_HEdecode[2] = { 77const char *acpi_gbl_he_decode[] = {
78 "Level", 78 "Level",
79 "Edge" 79 "Edge"
80}; 80};
81 81
82const char *acpi_gbl_io_decode[2] = { 82const char *acpi_gbl_io_decode[] = {
83 "Decode10", 83 "Decode10",
84 "Decode16" 84 "Decode16"
85}; 85};
86 86
87const char *acpi_gbl_LLdecode[2] = { 87const char *acpi_gbl_ll_decode[] = {
88 "active_high", 88 "ActiveHigh",
89 "active_low" 89 "ActiveLow"
90}; 90};
91 91
92const char *acpi_gbl_max_decode[2] = { 92const char *acpi_gbl_max_decode[] = {
93 "max_not_fixed", 93 "MaxNotFixed",
94 "max_fixed" 94 "MaxFixed"
95}; 95};
96 96
97const char *acpi_gbl_MEMdecode[4] = { 97const char *acpi_gbl_mem_decode[] = {
98 "non_cacheable", 98 "NonCacheable",
99 "Cacheable", 99 "Cacheable",
100 "write_combining", 100 "WriteCombining",
101 "Prefetchable" 101 "Prefetchable"
102}; 102};
103 103
104const char *acpi_gbl_min_decode[2] = { 104const char *acpi_gbl_min_decode[] = {
105 "min_not_fixed", 105 "MinNotFixed",
106 "min_fixed" 106 "MinFixed"
107}; 107};
108 108
109const char *acpi_gbl_MTPdecode[4] = { 109const char *acpi_gbl_mtp_decode[] = {
110 "address_range_memory", 110 "AddressRangeMemory",
111 "address_range_reserved", 111 "AddressRangeReserved",
112 "address_range_aCPI", 112 "AddressRangeACPI",
113 "address_range_nVS" 113 "AddressRangeNVS"
114}; 114};
115 115
116const char *acpi_gbl_RNGdecode[4] = { 116const char *acpi_gbl_rng_decode[] = {
117 "invalid_ranges", 117 "InvalidRanges",
118 "non_iSAonly_ranges", 118 "NonISAOnlyRanges",
119 "ISAonly_ranges", 119 "ISAOnlyRanges",
120 "entire_range" 120 "EntireRange"
121}; 121};
122 122
123const char *acpi_gbl_RWdecode[2] = { 123const char *acpi_gbl_rw_decode[] = {
124 "read_only", 124 "ReadOnly",
125 "read_write" 125 "ReadWrite"
126}; 126};
127 127
128const char *acpi_gbl_SHRdecode[2] = { 128const char *acpi_gbl_shr_decode[] = {
129 "Exclusive", 129 "Exclusive",
130 "Shared" 130 "Shared"
131}; 131};
132 132
133const char *acpi_gbl_SIZdecode[4] = { 133const char *acpi_gbl_siz_decode[] = {
134 "Transfer8", 134 "Transfer8",
135 "Transfer8_16", 135 "Transfer8_16",
136 "Transfer16", 136 "Transfer16",
137 "invalid_size" 137 "InvalidSize"
138}; 138};
139 139
140const char *acpi_gbl_TRSdecode[2] = { 140const char *acpi_gbl_trs_decode[] = {
141 "dense_translation", 141 "DenseTranslation",
142 "sparse_translation" 142 "SparseTranslation"
143}; 143};
144 144
145const char *acpi_gbl_TTPdecode[2] = { 145const char *acpi_gbl_ttp_decode[] = {
146 "type_static", 146 "TypeStatic",
147 "type_translation" 147 "TypeTranslation"
148}; 148};
149 149
150const char *acpi_gbl_TYPdecode[4] = { 150const char *acpi_gbl_typ_decode[] = {
151 "Compatibility", 151 "Compatibility",
152 "type_a", 152 "TypeA",
153 "type_b", 153 "TypeB",
154 "type_f" 154 "TypeF"
155}; 155};
156 156
157#endif 157#endif
@@ -240,6 +240,104 @@ static const u8 acpi_gbl_resource_types[] = {
240 240
241/******************************************************************************* 241/*******************************************************************************
242 * 242 *
243 * FUNCTION: acpi_ut_walk_aml_resources
244 *
245 * PARAMETERS: Aml - Pointer to the raw AML resource template
246 * aml_length - Length of the entire template
247 * user_function - Called once for each descriptor found. If
248 * NULL, a pointer to the end_tag is returned
249 * Context - Passed to user_function
250 *
251 * RETURN: Status
252 *
253 * DESCRIPTION: Walk a raw AML resource list(buffer). User function called
254 * once for each resource found.
255 *
256 ******************************************************************************/
257
258acpi_status
259acpi_ut_walk_aml_resources(u8 * aml,
260 acpi_size aml_length,
261 acpi_walk_aml_callback user_function, void **context)
262{
263 acpi_status status;
264 u8 *end_aml;
265 u8 resource_index;
266 u32 length;
267 u32 offset = 0;
268
269 ACPI_FUNCTION_TRACE(ut_walk_aml_resources);
270
271 /* The absolute minimum resource template is one end_tag descriptor */
272
273 if (aml_length < sizeof(struct aml_resource_end_tag)) {
274 return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
275 }
276
277 /* Point to the end of the resource template buffer */
278
279 end_aml = aml + aml_length;
280
281 /* Walk the byte list, abort on any invalid descriptor type or length */
282
283 while (aml < end_aml) {
284
285 /* Validate the Resource Type and Resource Length */
286
287 status = acpi_ut_validate_resource(aml, &resource_index);
288 if (ACPI_FAILURE(status)) {
289 return_ACPI_STATUS(status);
290 }
291
292 /* Get the length of this descriptor */
293
294 length = acpi_ut_get_descriptor_length(aml);
295
296 /* Invoke the user function */
297
298 if (user_function) {
299 status =
300 user_function(aml, length, offset, resource_index,
301 context);
302 if (ACPI_FAILURE(status)) {
303 return (status);
304 }
305 }
306
307 /* An end_tag descriptor terminates this resource template */
308
309 if (acpi_ut_get_resource_type(aml) ==
310 ACPI_RESOURCE_NAME_END_TAG) {
311 /*
312 * There must be at least one more byte in the buffer for
313 * the 2nd byte of the end_tag
314 */
315 if ((aml + 1) >= end_aml) {
316 return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
317 }
318
319 /* Return the pointer to the end_tag if requested */
320
321 if (!user_function) {
322 *context = aml;
323 }
324
325 /* Normal exit */
326
327 return_ACPI_STATUS(AE_OK);
328 }
329
330 aml += length;
331 offset += length;
332 }
333
334 /* Did not find an end_tag descriptor */
335
336 return (AE_AML_NO_RESOURCE_END_TAG);
337}
338
339/*******************************************************************************
340 *
243 * FUNCTION: acpi_ut_validate_resource 341 * FUNCTION: acpi_ut_validate_resource
244 * 342 *
245 * PARAMETERS: Aml - Pointer to the raw AML resource descriptor 343 * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
@@ -273,6 +371,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
273 * Examine the large/small bit in the resource header 371 * Examine the large/small bit in the resource header
274 */ 372 */
275 if (resource_type & ACPI_RESOURCE_NAME_LARGE) { 373 if (resource_type & ACPI_RESOURCE_NAME_LARGE) {
374
276 /* Verify the large resource type (name) against the max */ 375 /* Verify the large resource type (name) against the max */
277 376
278 if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { 377 if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) {
@@ -376,6 +475,7 @@ u8 acpi_ut_get_resource_type(void *aml)
376 * Examine the large/small bit in the resource header 475 * Examine the large/small bit in the resource header
377 */ 476 */
378 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { 477 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
478
379 /* Large Resource Type -- bits 6:0 contain the name */ 479 /* Large Resource Type -- bits 6:0 contain the name */
380 480
381 return (ACPI_GET8(aml)); 481 return (ACPI_GET8(aml));
@@ -411,6 +511,7 @@ u16 acpi_ut_get_resource_length(void *aml)
411 * Examine the large/small bit in the resource header 511 * Examine the large/small bit in the resource header
412 */ 512 */
413 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { 513 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
514
414 /* Large Resource type -- bytes 1-2 contain the 16-bit length */ 515 /* Large Resource type -- bytes 1-2 contain the 16-bit length */
415 516
416 ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1)); 517 ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1));
@@ -495,60 +596,21 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc,
495 u8 ** end_tag) 596 u8 ** end_tag)
496{ 597{
497 acpi_status status; 598 acpi_status status;
498 u8 *aml;
499 u8 *end_aml;
500
501 ACPI_FUNCTION_TRACE("ut_get_resource_end_tag");
502 599
503 /* Get start and end pointers */ 600 ACPI_FUNCTION_TRACE(ut_get_resource_end_tag);
504
505 aml = obj_desc->buffer.pointer;
506 end_aml = aml + obj_desc->buffer.length;
507 601
508 /* Allow a buffer length of zero */ 602 /* Allow a buffer length of zero */
509 603
510 if (!obj_desc->buffer.length) { 604 if (!obj_desc->buffer.length) {
511 *end_tag = aml; 605 *end_tag = obj_desc->buffer.pointer;
512 return_ACPI_STATUS(AE_OK); 606 return_ACPI_STATUS(AE_OK);
513 } 607 }
514 608
515 /* Walk the resource template, one descriptor per iteration */ 609 /* Validate the template and get a pointer to the end_tag */
516
517 while (aml < end_aml) {
518 /* Validate the Resource Type and Resource Length */
519
520 status = acpi_ut_validate_resource(aml, NULL);
521 if (ACPI_FAILURE(status)) {
522 return_ACPI_STATUS(status);
523 }
524
525 /* end_tag resource indicates the end of the resource template */
526
527 if (acpi_ut_get_resource_type(aml) ==
528 ACPI_RESOURCE_NAME_END_TAG) {
529 /*
530 * There must be at least one more byte in the buffer for
531 * the 2nd byte of the end_tag
532 */
533 if ((aml + 1) >= end_aml) {
534 return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
535 }
536
537 /* Return the pointer to the end_tag */
538
539 *end_tag = aml;
540 return_ACPI_STATUS(AE_OK);
541 }
542
543 /*
544 * Point to the next resource descriptor in the AML buffer. The
545 * descriptor length is guaranteed to be non-zero by resource
546 * validation above.
547 */
548 aml += acpi_ut_get_descriptor_length(aml);
549 }
550 610
551 /* Did not find an end_tag resource descriptor */ 611 status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer,
612 obj_desc->buffer.length, NULL,
613 (void **)end_tag);
552 614
553 return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); 615 return_ACPI_STATUS(status);
554} 616}
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c
index 4b134a722907..0f5c5bb5deff 100644
--- a/drivers/acpi/utilities/utstate.c
+++ b/drivers/acpi/utilities/utstate.c
@@ -96,7 +96,7 @@ void
96acpi_ut_push_generic_state(union acpi_generic_state **list_head, 96acpi_ut_push_generic_state(union acpi_generic_state **list_head,
97 union acpi_generic_state *state) 97 union acpi_generic_state *state)
98{ 98{
99 ACPI_FUNCTION_TRACE("ut_push_generic_state"); 99 ACPI_FUNCTION_TRACE(ut_push_generic_state);
100 100
101 /* Push the state object onto the front of the list (stack) */ 101 /* Push the state object onto the front of the list (stack) */
102 102
@@ -123,12 +123,13 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
123{ 123{
124 union acpi_generic_state *state; 124 union acpi_generic_state *state;
125 125
126 ACPI_FUNCTION_TRACE("ut_pop_generic_state"); 126 ACPI_FUNCTION_TRACE(ut_pop_generic_state);
127 127
128 /* Remove the state object at the head of the list (stack) */ 128 /* Remove the state object at the head of the list (stack) */
129 129
130 state = *list_head; 130 state = *list_head;
131 if (state) { 131 if (state) {
132
132 /* Update the list head */ 133 /* Update the list head */
133 134
134 *list_head = state->common.next; 135 *list_head = state->common.next;
@@ -158,9 +159,10 @@ union acpi_generic_state *acpi_ut_create_generic_state(void)
158 159
159 state = acpi_os_acquire_object(acpi_gbl_state_cache); 160 state = acpi_os_acquire_object(acpi_gbl_state_cache);
160 if (state) { 161 if (state) {
162
161 /* Initialize */ 163 /* Initialize */
162 memset(state, 0, sizeof(union acpi_generic_state)); 164 memset(state, 0, sizeof(union acpi_generic_state));
163 state->common.data_type = ACPI_DESC_TYPE_STATE; 165 state->common.descriptor_type = ACPI_DESC_TYPE_STATE;
164 } 166 }
165 167
166 return (state); 168 return (state);
@@ -183,7 +185,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void)
183{ 185{
184 union acpi_generic_state *state; 186 union acpi_generic_state *state;
185 187
186 ACPI_FUNCTION_TRACE("ut_create_thread_state"); 188 ACPI_FUNCTION_TRACE(ut_create_thread_state);
187 189
188 /* Create the generic state object */ 190 /* Create the generic state object */
189 191
@@ -194,7 +196,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void)
194 196
195 /* Init fields specific to the update struct */ 197 /* Init fields specific to the update struct */
196 198
197 state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD; 199 state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD;
198 state->thread.thread_id = acpi_os_get_thread_id(); 200 state->thread.thread_id = acpi_os_get_thread_id();
199 201
200 return_PTR((struct acpi_thread_state *)state); 202 return_PTR((struct acpi_thread_state *)state);
@@ -220,7 +222,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
220{ 222{
221 union acpi_generic_state *state; 223 union acpi_generic_state *state;
222 224
223 ACPI_FUNCTION_TRACE_PTR("ut_create_update_state", object); 225 ACPI_FUNCTION_TRACE_PTR(ut_create_update_state, object);
224 226
225 /* Create the generic state object */ 227 /* Create the generic state object */
226 228
@@ -231,7 +233,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
231 233
232 /* Init fields specific to the update struct */ 234 /* Init fields specific to the update struct */
233 235
234 state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE; 236 state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE;
235 state->update.object = object; 237 state->update.object = object;
236 state->update.value = action; 238 state->update.value = action;
237 239
@@ -257,7 +259,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
257{ 259{
258 union acpi_generic_state *state; 260 union acpi_generic_state *state;
259 261
260 ACPI_FUNCTION_TRACE_PTR("ut_create_pkg_state", internal_object); 262 ACPI_FUNCTION_TRACE_PTR(ut_create_pkg_state, internal_object);
261 263
262 /* Create the generic state object */ 264 /* Create the generic state object */
263 265
@@ -268,7 +270,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
268 270
269 /* Init fields specific to the update struct */ 271 /* Init fields specific to the update struct */
270 272
271 state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE; 273 state->common.descriptor_type = ACPI_DESC_TYPE_STATE_PACKAGE;
272 state->pkg.source_object = (union acpi_operand_object *)internal_object; 274 state->pkg.source_object = (union acpi_operand_object *)internal_object;
273 state->pkg.dest_object = external_object; 275 state->pkg.dest_object = external_object;
274 state->pkg.index = index; 276 state->pkg.index = index;
@@ -294,7 +296,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void)
294{ 296{
295 union acpi_generic_state *state; 297 union acpi_generic_state *state;
296 298
297 ACPI_FUNCTION_TRACE("ut_create_control_state"); 299 ACPI_FUNCTION_TRACE(ut_create_control_state);
298 300
299 /* Create the generic state object */ 301 /* Create the generic state object */
300 302
@@ -305,7 +307,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void)
305 307
306 /* Init fields specific to the control struct */ 308 /* Init fields specific to the control struct */
307 309
308 state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL; 310 state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL;
309 state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; 311 state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING;
310 312
311 return_PTR(state); 313 return_PTR(state);
@@ -319,15 +321,19 @@ union acpi_generic_state *acpi_ut_create_control_state(void)
319 * 321 *
320 * RETURN: None 322 * RETURN: None
321 * 323 *
322 * DESCRIPTION: Put a state object back into the global state cache. The object 324 * DESCRIPTION: Release a state object to the state cache. NULL state objects
323 * is not actually freed at this time. 325 * are ignored.
324 * 326 *
325 ******************************************************************************/ 327 ******************************************************************************/
326 328
327void acpi_ut_delete_generic_state(union acpi_generic_state *state) 329void acpi_ut_delete_generic_state(union acpi_generic_state *state)
328{ 330{
329 ACPI_FUNCTION_TRACE("ut_delete_generic_state"); 331 ACPI_FUNCTION_TRACE(ut_delete_generic_state);
332
333 /* Ignore null state */
330 334
331 (void)acpi_os_release_object(acpi_gbl_state_cache, state); 335 if (state) {
336 (void)acpi_os_release_object(acpi_gbl_state_cache, state);
337 }
332 return_VOID; 338 return_VOID;
333} 339}
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c
index 308a960871be..3538f69c82a1 100644
--- a/drivers/acpi/utilities/utxface.c
+++ b/drivers/acpi/utilities/utxface.c
@@ -41,8 +41,6 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44#include <linux/module.h>
45
46#include <acpi/acpi.h> 44#include <acpi/acpi.h>
47#include <acpi/acevents.h> 45#include <acpi/acevents.h>
48#include <acpi/acnamesp.h> 46#include <acpi/acnamesp.h>
@@ -67,7 +65,7 @@ acpi_status acpi_initialize_subsystem(void)
67{ 65{
68 acpi_status status; 66 acpi_status status;
69 67
70 ACPI_FUNCTION_TRACE("acpi_initialize_subsystem"); 68 ACPI_FUNCTION_TRACE(acpi_initialize_subsystem);
71 69
72 ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); 70 ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace());
73 71
@@ -109,6 +107,8 @@ acpi_status acpi_initialize_subsystem(void)
109 return_ACPI_STATUS(status); 107 return_ACPI_STATUS(status);
110} 108}
111 109
110ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem)
111
112/******************************************************************************* 112/*******************************************************************************
113 * 113 *
114 * FUNCTION: acpi_enable_subsystem 114 * FUNCTION: acpi_enable_subsystem
@@ -121,12 +121,11 @@ acpi_status acpi_initialize_subsystem(void)
121 * Puts system into ACPI mode if it isn't already. 121 * Puts system into ACPI mode if it isn't already.
122 * 122 *
123 ******************************************************************************/ 123 ******************************************************************************/
124
125acpi_status acpi_enable_subsystem(u32 flags) 124acpi_status acpi_enable_subsystem(u32 flags)
126{ 125{
127 acpi_status status = AE_OK; 126 acpi_status status = AE_OK;
128 127
129 ACPI_FUNCTION_TRACE("acpi_enable_subsystem"); 128 ACPI_FUNCTION_TRACE(acpi_enable_subsystem);
130 129
131 /* 130 /*
132 * We must initialize the hardware before we can enable ACPI. 131 * We must initialize the hardware before we can enable ACPI.
@@ -152,7 +151,7 @@ acpi_status acpi_enable_subsystem(u32 flags)
152 151
153 status = acpi_enable(); 152 status = acpi_enable();
154 if (ACPI_FAILURE(status)) { 153 if (ACPI_FAILURE(status)) {
155 ACPI_WARNING((AE_INFO, "acpi_enable failed")); 154 ACPI_WARNING((AE_INFO, "AcpiEnable failed"));
156 return_ACPI_STATUS(status); 155 return_ACPI_STATUS(status);
157 } 156 }
158 } 157 }
@@ -229,6 +228,8 @@ acpi_status acpi_enable_subsystem(u32 flags)
229 return_ACPI_STATUS(status); 228 return_ACPI_STATUS(status);
230} 229}
231 230
231ACPI_EXPORT_SYMBOL(acpi_enable_subsystem)
232
232/******************************************************************************* 233/*******************************************************************************
233 * 234 *
234 * FUNCTION: acpi_initialize_objects 235 * FUNCTION: acpi_initialize_objects
@@ -241,12 +242,11 @@ acpi_status acpi_enable_subsystem(u32 flags)
241 * objects and executing AML code for Regions, buffers, etc. 242 * objects and executing AML code for Regions, buffers, etc.
242 * 243 *
243 ******************************************************************************/ 244 ******************************************************************************/
244
245acpi_status acpi_initialize_objects(u32 flags) 245acpi_status acpi_initialize_objects(u32 flags)
246{ 246{
247 acpi_status status = AE_OK; 247 acpi_status status = AE_OK;
248 248
249 ACPI_FUNCTION_TRACE("acpi_initialize_objects"); 249 ACPI_FUNCTION_TRACE(acpi_initialize_objects);
250 250
251 /* 251 /*
252 * Run all _REG methods 252 * Run all _REG methods
@@ -257,7 +257,7 @@ acpi_status acpi_initialize_objects(u32 flags)
257 */ 257 */
258 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { 258 if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
259 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 259 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
260 "[Init] Executing _REG op_region methods\n")); 260 "[Init] Executing _REG OpRegion methods\n"));
261 261
262 status = acpi_ev_initialize_op_regions(); 262 status = acpi_ev_initialize_op_regions();
263 if (ACPI_FAILURE(status)) { 263 if (ACPI_FAILURE(status)) {
@@ -305,6 +305,8 @@ acpi_status acpi_initialize_objects(u32 flags)
305 return_ACPI_STATUS(status); 305 return_ACPI_STATUS(status);
306} 306}
307 307
308ACPI_EXPORT_SYMBOL(acpi_initialize_objects)
309
308/******************************************************************************* 310/*******************************************************************************
309 * 311 *
310 * FUNCTION: acpi_terminate 312 * FUNCTION: acpi_terminate
@@ -316,12 +318,11 @@ acpi_status acpi_initialize_objects(u32 flags)
316 * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. 318 * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources.
317 * 319 *
318 ******************************************************************************/ 320 ******************************************************************************/
319
320acpi_status acpi_terminate(void) 321acpi_status acpi_terminate(void)
321{ 322{
322 acpi_status status; 323 acpi_status status;
323 324
324 ACPI_FUNCTION_TRACE("acpi_terminate"); 325 ACPI_FUNCTION_TRACE(acpi_terminate);
325 326
326 /* Terminate the AML Debugger if present */ 327 /* Terminate the AML Debugger if present */
327 328
@@ -348,6 +349,8 @@ acpi_status acpi_terminate(void)
348 return_ACPI_STATUS(status); 349 return_ACPI_STATUS(status);
349} 350}
350 351
352ACPI_EXPORT_SYMBOL(acpi_terminate)
353
351#ifdef ACPI_FUTURE_USAGE 354#ifdef ACPI_FUTURE_USAGE
352/******************************************************************************* 355/*******************************************************************************
353 * 356 *
@@ -362,7 +365,6 @@ acpi_status acpi_terminate(void)
362 * initialized successfully. 365 * initialized successfully.
363 * 366 *
364 ******************************************************************************/ 367 ******************************************************************************/
365
366acpi_status acpi_subsystem_status(void) 368acpi_status acpi_subsystem_status(void)
367{ 369{
368 370
@@ -373,6 +375,8 @@ acpi_status acpi_subsystem_status(void)
373 } 375 }
374} 376}
375 377
378ACPI_EXPORT_SYMBOL(acpi_subsystem_status)
379
376/******************************************************************************* 380/*******************************************************************************
377 * 381 *
378 * FUNCTION: acpi_get_system_info 382 * FUNCTION: acpi_get_system_info
@@ -390,14 +394,13 @@ acpi_status acpi_subsystem_status(void)
390 * and the value of out_buffer is undefined. 394 * and the value of out_buffer is undefined.
391 * 395 *
392 ******************************************************************************/ 396 ******************************************************************************/
393
394acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) 397acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
395{ 398{
396 struct acpi_system_info *info_ptr; 399 struct acpi_system_info *info_ptr;
397 acpi_status status; 400 acpi_status status;
398 u32 i; 401 u32 i;
399 402
400 ACPI_FUNCTION_TRACE("acpi_get_system_info"); 403 ACPI_FUNCTION_TRACE(acpi_get_system_info);
401 404
402 /* Parameter validation */ 405 /* Parameter validation */
403 406
@@ -448,15 +451,15 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
448 451
449 /* Current status of the ACPI tables, per table type */ 452 /* Current status of the ACPI tables, per table type */
450 453
451 info_ptr->num_table_types = NUM_ACPI_TABLE_TYPES; 454 info_ptr->num_table_types = ACPI_TABLE_ID_MAX + 1;
452 for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { 455 for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) {
453 info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count; 456 info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count;
454 } 457 }
455 458
456 return_ACPI_STATUS(AE_OK); 459 return_ACPI_STATUS(AE_OK);
457} 460}
458 461
459EXPORT_SYMBOL(acpi_get_system_info); 462ACPI_EXPORT_SYMBOL(acpi_get_system_info)
460 463
461/***************************************************************************** 464/*****************************************************************************
462 * 465 *
@@ -472,7 +475,6 @@ EXPORT_SYMBOL(acpi_get_system_info);
472 * TBD: When a second function is added, must save the Function also. 475 * TBD: When a second function is added, must save the Function also.
473 * 476 *
474 ****************************************************************************/ 477 ****************************************************************************/
475
476acpi_status 478acpi_status
477acpi_install_initialization_handler(acpi_init_handler handler, u32 function) 479acpi_install_initialization_handler(acpi_init_handler handler, u32 function)
478{ 480{
@@ -489,6 +491,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function)
489 return AE_OK; 491 return AE_OK;
490} 492}
491 493
494ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler)
492#endif /* ACPI_FUTURE_USAGE */ 495#endif /* ACPI_FUTURE_USAGE */
493 496
494/***************************************************************************** 497/*****************************************************************************
@@ -502,10 +505,9 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function)
502 * DESCRIPTION: Empty all caches (delete the cached objects) 505 * DESCRIPTION: Empty all caches (delete the cached objects)
503 * 506 *
504 ****************************************************************************/ 507 ****************************************************************************/
505
506acpi_status acpi_purge_cached_objects(void) 508acpi_status acpi_purge_cached_objects(void)
507{ 509{
508 ACPI_FUNCTION_TRACE("acpi_purge_cached_objects"); 510 ACPI_FUNCTION_TRACE(acpi_purge_cached_objects);
509 511
510 (void)acpi_os_purge_cache(acpi_gbl_state_cache); 512 (void)acpi_os_purge_cache(acpi_gbl_state_cache);
511 (void)acpi_os_purge_cache(acpi_gbl_operand_cache); 513 (void)acpi_os_purge_cache(acpi_gbl_operand_cache);
@@ -513,3 +515,5 @@ acpi_status acpi_purge_cached_objects(void)
513 (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache); 515 (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache);
514 return_ACPI_STATUS(AE_OK); 516 return_ACPI_STATUS(AE_OK);
515} 517}
518
519ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects)