aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities/utalloc.c')
-rw-r--r--drivers/acpi/utilities/utalloc.c84
1 files changed, 59 insertions, 25 deletions
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index 3313439c4bc7..c4e7f989a2bd 100644
--- a/drivers/acpi/utilities/utalloc.c
+++ b/drivers/acpi/utilities/utalloc.c
@@ -47,8 +47,35 @@
47#define _COMPONENT ACPI_UTILITIES 47#define _COMPONENT ACPI_UTILITIES
48 ACPI_MODULE_NAME ("utalloc") 48 ACPI_MODULE_NAME ("utalloc")
49 49
50/* Local prototypes */
50 51
51/****************************************************************************** 52#ifdef ACPI_DBG_TRACK_ALLOCATIONS
53static struct acpi_debug_mem_block *
54acpi_ut_find_allocation (
55 u32 list_id,
56 void *allocation);
57
58static acpi_status
59acpi_ut_track_allocation (
60 u32 list_id,
61 struct acpi_debug_mem_block *address,
62 acpi_size size,
63 u8 alloc_type,
64 u32 component,
65 char *module,
66 u32 line);
67
68static acpi_status
69acpi_ut_remove_allocation (
70 u32 list_id,
71 struct acpi_debug_mem_block *address,
72 u32 component,
73 char *module,
74 u32 line);
75#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
76
77
78/*******************************************************************************
52 * 79 *
53 * FUNCTION: acpi_ut_release_to_cache 80 * FUNCTION: acpi_ut_release_to_cache
54 * 81 *
@@ -98,7 +125,8 @@ acpi_ut_release_to_cache (
98 125
99 /* Put the object at the head of the cache list */ 126 /* Put the object at the head of the cache list */
100 127
101 * (ACPI_CAST_INDIRECT_PTR (char, &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head; 128 * (ACPI_CAST_INDIRECT_PTR (char,
129 &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head;
102 cache_info->list_head = object; 130 cache_info->list_head = object;
103 cache_info->cache_depth++; 131 cache_info->cache_depth++;
104 132
@@ -115,7 +143,7 @@ acpi_ut_release_to_cache (
115} 143}
116 144
117 145
118/****************************************************************************** 146/*******************************************************************************
119 * 147 *
120 * FUNCTION: acpi_ut_acquire_from_cache 148 * FUNCTION: acpi_ut_acquire_from_cache
121 * 149 *
@@ -156,7 +184,8 @@ acpi_ut_acquire_from_cache (
156 /* There is an object available, use it */ 184 /* There is an object available, use it */
157 185
158 object = cache_info->list_head; 186 object = cache_info->list_head;
159 cache_info->list_head = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) object)[cache_info->link_offset]))); 187 cache_info->list_head = *(ACPI_CAST_INDIRECT_PTR (char,
188 &(((char *) object)[cache_info->link_offset])));
160 189
161 ACPI_MEM_TRACKING (cache_info->cache_hits++); 190 ACPI_MEM_TRACKING (cache_info->cache_hits++);
162 cache_info->cache_depth--; 191 cache_info->cache_depth--;
@@ -201,7 +230,7 @@ acpi_ut_acquire_from_cache (
201 230
202 231
203#ifdef ACPI_ENABLE_OBJECT_CACHE 232#ifdef ACPI_ENABLE_OBJECT_CACHE
204/****************************************************************************** 233/*******************************************************************************
205 * 234 *
206 * FUNCTION: acpi_ut_delete_generic_cache 235 * FUNCTION: acpi_ut_delete_generic_cache
207 * 236 *
@@ -228,7 +257,8 @@ acpi_ut_delete_generic_cache (
228 while (cache_info->list_head) { 257 while (cache_info->list_head) {
229 /* Delete one cached state object */ 258 /* Delete one cached state object */
230 259
231 next = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) cache_info->list_head)[cache_info->link_offset]))); 260 next = *(ACPI_CAST_INDIRECT_PTR (char,
261 &(((char *) cache_info->list_head)[cache_info->link_offset])));
232 ACPI_MEM_FREE (cache_info->list_head); 262 ACPI_MEM_FREE (cache_info->list_head);
233 263
234 cache_info->list_head = next; 264 cache_info->list_head = next;
@@ -497,8 +527,8 @@ acpi_ut_allocate_and_track (
497 acpi_status status; 527 acpi_status status;
498 528
499 529
500 allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_header), component, 530 allocation = acpi_ut_allocate (size + sizeof (struct acpi_debug_mem_header),
501 module, line); 531 component, module, line);
502 if (!allocation) { 532 if (!allocation) {
503 return (NULL); 533 return (NULL);
504 } 534 }
@@ -543,8 +573,8 @@ acpi_ut_callocate_and_track (
543 acpi_status status; 573 acpi_status status;
544 574
545 575
546 allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_header), component, 576 allocation = acpi_ut_callocate (size + sizeof (struct acpi_debug_mem_header),
547 module, line); 577 component, module, line);
548 if (!allocation) { 578 if (!allocation) {
549 /* Report allocation error */ 579 /* Report allocation error */
550 580
@@ -637,7 +667,7 @@ acpi_ut_free_and_track (
637 * 667 *
638 ******************************************************************************/ 668 ******************************************************************************/
639 669
640struct acpi_debug_mem_block * 670static struct acpi_debug_mem_block *
641acpi_ut_find_allocation ( 671acpi_ut_find_allocation (
642 u32 list_id, 672 u32 list_id,
643 void *allocation) 673 void *allocation)
@@ -686,7 +716,7 @@ acpi_ut_find_allocation (
686 * 716 *
687 ******************************************************************************/ 717 ******************************************************************************/
688 718
689acpi_status 719static acpi_status
690acpi_ut_track_allocation ( 720acpi_ut_track_allocation (
691 u32 list_id, 721 u32 list_id,
692 struct acpi_debug_mem_block *allocation, 722 struct acpi_debug_mem_block *allocation,
@@ -721,10 +751,12 @@ acpi_ut_track_allocation (
721 751
722 element = acpi_ut_find_allocation (list_id, allocation); 752 element = acpi_ut_find_allocation (list_id, allocation);
723 if (element) { 753 if (element) {
724 ACPI_REPORT_ERROR (("ut_track_allocation: Allocation already present in list! (%p)\n", 754 ACPI_REPORT_ERROR ((
755 "ut_track_allocation: Allocation already present in list! (%p)\n",
725 allocation)); 756 allocation));
726 757
727 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", element, allocation)); 758 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n",
759 element, allocation));
728 760
729 goto unlock_and_exit; 761 goto unlock_and_exit;
730 } 762 }
@@ -773,7 +805,7 @@ unlock_and_exit:
773 * 805 *
774 ******************************************************************************/ 806 ******************************************************************************/
775 807
776acpi_status 808static acpi_status
777acpi_ut_remove_allocation ( 809acpi_ut_remove_allocation (
778 u32 list_id, 810 u32 list_id,
779 struct acpi_debug_mem_block *allocation, 811 struct acpi_debug_mem_block *allocation,
@@ -797,7 +829,7 @@ acpi_ut_remove_allocation (
797 /* No allocations! */ 829 /* No allocations! */
798 830
799 _ACPI_REPORT_ERROR (module, line, component, 831 _ACPI_REPORT_ERROR (module, line, component,
800 ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); 832 ("ut_remove_allocation: Empty allocation list, nothing to free!\n"));
801 833
802 return_ACPI_STATUS (AE_OK); 834 return_ACPI_STATUS (AE_OK);
803 } 835 }
@@ -824,7 +856,8 @@ acpi_ut_remove_allocation (
824 856
825 ACPI_MEMSET (&allocation->user_space, 0xEA, allocation->size); 857 ACPI_MEMSET (&allocation->user_space, 0xEA, allocation->size);
826 858
827 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", allocation->size)); 859 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n",
860 allocation->size));
828 861
829 status = acpi_ut_release_mutex (ACPI_MTX_MEMORY); 862 status = acpi_ut_release_mutex (ACPI_MTX_MEMORY);
830 return_ACPI_STATUS (status); 863 return_ACPI_STATUS (status);
@@ -842,6 +875,7 @@ acpi_ut_remove_allocation (
842 * DESCRIPTION: Print some info about the outstanding allocations. 875 * DESCRIPTION: Print some info about the outstanding allocations.
843 * 876 *
844 ******************************************************************************/ 877 ******************************************************************************/
878
845#ifdef ACPI_FUTURE_USAGE 879#ifdef ACPI_FUTURE_USAGE
846void 880void
847acpi_ut_dump_allocation_info ( 881acpi_ut_dump_allocation_info (
@@ -884,7 +918,8 @@ acpi_ut_dump_allocation_info (
884 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, 918 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
885 ("%30s: %4d (%3d Kb)\n", "Max Nodes", 919 ("%30s: %4d (%3d Kb)\n", "Max Nodes",
886 acpi_gbl_max_concurrent_node_count, 920 acpi_gbl_max_concurrent_node_count,
887 ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * sizeof (struct acpi_namespace_node))))); 921 ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count *
922 sizeof (struct acpi_namespace_node)))));
888*/ 923*/
889 return_VOID; 924 return_VOID;
890} 925}
@@ -933,26 +968,26 @@ acpi_ut_dump_allocations (
933 descriptor = ACPI_CAST_PTR (union acpi_descriptor, &element->user_space); 968 descriptor = ACPI_CAST_PTR (union acpi_descriptor, &element->user_space);
934 if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) { 969 if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) {
935 acpi_os_printf ("%p Len %04X %9.9s-%d [%s] ", 970 acpi_os_printf ("%p Len %04X %9.9s-%d [%s] ",
936 descriptor, element->size, element->module, 971 descriptor, element->size, element->module,
937 element->line, acpi_ut_get_descriptor_name (descriptor)); 972 element->line, acpi_ut_get_descriptor_name (descriptor));
938 973
939 /* Most of the elements will be Operand objects. */ 974 /* Most of the elements will be Operand objects. */
940 975
941 switch (ACPI_GET_DESCRIPTOR_TYPE (descriptor)) { 976 switch (ACPI_GET_DESCRIPTOR_TYPE (descriptor)) {
942 case ACPI_DESC_TYPE_OPERAND: 977 case ACPI_DESC_TYPE_OPERAND:
943 acpi_os_printf ("%12.12s R%hd", 978 acpi_os_printf ("%12.12s R%hd",
944 acpi_ut_get_type_name (descriptor->object.common.type), 979 acpi_ut_get_type_name (descriptor->object.common.type),
945 descriptor->object.common.reference_count); 980 descriptor->object.common.reference_count);
946 break; 981 break;
947 982
948 case ACPI_DESC_TYPE_PARSER: 983 case ACPI_DESC_TYPE_PARSER:
949 acpi_os_printf ("aml_opcode %04hX", 984 acpi_os_printf ("aml_opcode %04hX",
950 descriptor->op.asl.aml_opcode); 985 descriptor->op.asl.aml_opcode);
951 break; 986 break;
952 987
953 case ACPI_DESC_TYPE_NAMED: 988 case ACPI_DESC_TYPE_NAMED:
954 acpi_os_printf ("%4.4s", 989 acpi_os_printf ("%4.4s",
955 acpi_ut_get_node_name (&descriptor->node)); 990 acpi_ut_get_node_name (&descriptor->node));
956 break; 991 break;
957 992
958 default: 993 default:
@@ -983,6 +1018,5 @@ acpi_ut_dump_allocations (
983 return_VOID; 1018 return_VOID;
984} 1019}
985 1020
986
987#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ 1021#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */
988 1022