diff options
author | Robert Moore <robert.moore@intel.com> | 2005-06-24 00:00:00 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-07-13 23:45:36 -0400 |
commit | 73459f73e5d1602c59ebec114fc45185521353c1 (patch) | |
tree | 56c2183e345784d2be09c2f5d2530cf36221c55e /drivers/acpi/utilities/utalloc.c | |
parent | 88ac00f5a841dcfc5c682000f4a6add0add8caac (diff) |
ACPICA 20050617-0624 from Bob Moore <robert.moore@intel.com>
ACPICA 20050617:
Moved the object cache operations into the OS interface
layer (OSL) to allow the host OS to handle these operations
if desired (for example, the Linux OSL will invoke the
slab allocator). This support is optional; the compile
time define ACPI_USE_LOCAL_CACHE may be used to utilize
the original cache code in the ACPI CA core. The new OSL
interfaces are shown below. See utalloc.c for an example
implementation, and acpiosxf.h for the exact interface
definitions. Thanks to Alexey Starikovskiy.
acpi_os_create_cache
acpi_os_delete_cache
acpi_os_purge_cache
acpi_os_acquire_object
acpi_os_release_object
Modified the interfaces to acpi_os_acquire_lock and
acpi_os_release_lock to return and restore a flags
parameter. This fits better with many OS lock models.
Note: the current execution state (interrupt handler
or not) is no longer passed to these interfaces. If
necessary, the OSL must determine this state by itself, a
simple and fast operation. Thanks to Alexey Starikovskiy.
Fixed a problem in the ACPI table handling where a valid
XSDT was assumed present if the revision of the RSDP
was 2 or greater. According to the ACPI specification,
the XSDT is optional in all cases, and the table manager
therefore now checks for both an RSDP >=2 and a valid
XSDT pointer. Otherwise, the RSDT pointer is used.
Some ACPI 2.0 compliant BIOSs contain only the RSDT.
Fixed an interpreter problem with the Mid() operator in the
case of an input string where the resulting output string
is of zero length. It now correctly returns a valid,
null terminated string object instead of a string object
with a null pointer.
Fixed a problem with the control method argument handling
to allow a store to an Arg object that already contains an
object of type Device. The Device object is now correctly
overwritten. Previously, an error was returned.
ACPICA 20050624:
Modified the new OSL cache interfaces to use ACPI_CACHE_T
as the type for the host-defined cache object. This allows
the OSL implementation to define and type this object in
any manner desired, simplifying the OSL implementation.
For example, ACPI_CACHE_T is defined as kmem_cache_t for
Linux, and should be defined in the OS-specific header
file for other operating systems as required.
Changed the interface to AcpiOsAcquireObject to directly
return the requested object as the function return (instead
of ACPI_STATUS.) This change was made for performance
reasons, since this is the purpose of the interface in the
first place. acpi_os_acquire_object is now similar to the
acpi_os_allocate interface. Thanks to Alexey Starikovskiy.
Modified the initialization sequence in
acpi_initialize_subsystem to call the OSL interface
acpi_osl_initialize first, before any local initialization.
This change was required because the global initialization
now calls OSL interfaces.
Restructured the code base to split some files because
of size and/or because the code logically belonged in a
separate file. New files are listed below.
utilities/utcache.c /* Local cache interfaces */
utilities/utmutex.c /* Local mutex support */
utilities/utstate.c /* State object support */
parser/psloop.c /* Main AML parse loop */
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/utilities/utalloc.c')
-rw-r--r-- | drivers/acpi/utilities/utalloc.c | 304 |
1 files changed, 116 insertions, 188 deletions
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index c4e7f989a2bd..5061c6f0ee66 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Module Name: utalloc - local cache and memory allocation routines | 3 | * Module Name: utalloc - local memory allocation routines |
4 | * | 4 | * |
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
@@ -52,12 +52,10 @@ | |||
52 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 52 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
53 | static struct acpi_debug_mem_block * | 53 | static struct acpi_debug_mem_block * |
54 | acpi_ut_find_allocation ( | 54 | acpi_ut_find_allocation ( |
55 | u32 list_id, | ||
56 | void *allocation); | 55 | void *allocation); |
57 | 56 | ||
58 | static acpi_status | 57 | static acpi_status |
59 | acpi_ut_track_allocation ( | 58 | acpi_ut_track_allocation ( |
60 | u32 list_id, | ||
61 | struct acpi_debug_mem_block *address, | 59 | struct acpi_debug_mem_block *address, |
62 | acpi_size size, | 60 | acpi_size size, |
63 | u8 alloc_type, | 61 | u8 alloc_type, |
@@ -67,206 +65,118 @@ acpi_ut_track_allocation ( | |||
67 | 65 | ||
68 | static acpi_status | 66 | static acpi_status |
69 | acpi_ut_remove_allocation ( | 67 | acpi_ut_remove_allocation ( |
70 | u32 list_id, | ||
71 | struct acpi_debug_mem_block *address, | 68 | struct acpi_debug_mem_block *address, |
72 | u32 component, | 69 | u32 component, |
73 | char *module, | 70 | char *module, |
74 | u32 line); | 71 | u32 line); |
75 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ | 72 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ |
76 | 73 | ||
77 | 74 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | |
78 | /******************************************************************************* | 75 | static acpi_status |
79 | * | 76 | acpi_ut_create_list ( |
80 | * FUNCTION: acpi_ut_release_to_cache | 77 | char *list_name, |
81 | * | 78 | u16 object_size, |
82 | * PARAMETERS: list_id - Memory list/cache ID | 79 | acpi_handle *return_cache); |
83 | * Object - The object to be released | ||
84 | * | ||
85 | * RETURN: None | ||
86 | * | ||
87 | * DESCRIPTION: Release an object to the specified cache. If cache is full, | ||
88 | * the object is deleted. | ||
89 | * | ||
90 | ******************************************************************************/ | ||
91 | |||
92 | void | ||
93 | acpi_ut_release_to_cache ( | ||
94 | u32 list_id, | ||
95 | void *object) | ||
96 | { | ||
97 | struct acpi_memory_list *cache_info; | ||
98 | |||
99 | |||
100 | ACPI_FUNCTION_ENTRY (); | ||
101 | |||
102 | |||
103 | cache_info = &acpi_gbl_memory_lists[list_id]; | ||
104 | |||
105 | #ifdef ACPI_ENABLE_OBJECT_CACHE | ||
106 | |||
107 | /* If walk cache is full, just free this wallkstate object */ | ||
108 | |||
109 | if (cache_info->cache_depth >= cache_info->max_cache_depth) { | ||
110 | ACPI_MEM_FREE (object); | ||
111 | ACPI_MEM_TRACKING (cache_info->total_freed++); | ||
112 | } | ||
113 | |||
114 | /* Otherwise put this object back into the cache */ | ||
115 | |||
116 | else { | ||
117 | if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) { | ||
118 | return; | ||
119 | } | ||
120 | |||
121 | /* Mark the object as cached */ | ||
122 | |||
123 | ACPI_MEMSET (object, 0xCA, cache_info->object_size); | ||
124 | ACPI_SET_DESCRIPTOR_TYPE (object, ACPI_DESC_TYPE_CACHED); | ||
125 | |||
126 | /* Put the object at the head of the cache list */ | ||
127 | |||
128 | * (ACPI_CAST_INDIRECT_PTR (char, | ||
129 | &(((char *) object)[cache_info->link_offset]))) = cache_info->list_head; | ||
130 | cache_info->list_head = object; | ||
131 | cache_info->cache_depth++; | ||
132 | |||
133 | (void) acpi_ut_release_mutex (ACPI_MTX_CACHES); | ||
134 | } | ||
135 | |||
136 | #else | ||
137 | |||
138 | /* Object cache is disabled; just free the object */ | ||
139 | |||
140 | ACPI_MEM_FREE (object); | ||
141 | ACPI_MEM_TRACKING (cache_info->total_freed++); | ||
142 | #endif | 80 | #endif |
143 | } | ||
144 | 81 | ||
145 | 82 | ||
146 | /******************************************************************************* | 83 | /******************************************************************************* |
147 | * | 84 | * |
148 | * FUNCTION: acpi_ut_acquire_from_cache | 85 | * FUNCTION: acpi_ut_create_caches |
149 | * | 86 | * |
150 | * PARAMETERS: list_id - Memory list ID | 87 | * PARAMETERS: None |
151 | * | 88 | * |
152 | * RETURN: A requested object. NULL if the object could not be | 89 | * RETURN: Status |
153 | * allocated. | ||
154 | * | 90 | * |
155 | * DESCRIPTION: Get an object from the specified cache. If cache is empty, | 91 | * DESCRIPTION: Create all local caches |
156 | * the object is allocated. | ||
157 | * | 92 | * |
158 | ******************************************************************************/ | 93 | ******************************************************************************/ |
159 | 94 | ||
160 | void * | 95 | acpi_status |
161 | acpi_ut_acquire_from_cache ( | 96 | acpi_ut_create_caches ( |
162 | u32 list_id) | 97 | void) |
163 | { | 98 | { |
164 | struct acpi_memory_list *cache_info; | 99 | acpi_status status; |
165 | void *object; | ||
166 | |||
167 | |||
168 | ACPI_FUNCTION_NAME ("ut_acquire_from_cache"); | ||
169 | 100 | ||
170 | 101 | ||
171 | cache_info = &acpi_gbl_memory_lists[list_id]; | 102 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
172 | 103 | ||
173 | #ifdef ACPI_ENABLE_OBJECT_CACHE | 104 | /* Memory allocation lists */ |
174 | 105 | ||
175 | if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES))) { | 106 | status = acpi_ut_create_list ("Acpi-Global", 0, |
176 | return (NULL); | 107 | &acpi_gbl_global_list); |
108 | if (ACPI_FAILURE (status)) { | ||
109 | return (status); | ||
177 | } | 110 | } |
178 | 111 | ||
179 | ACPI_MEM_TRACKING (cache_info->cache_requests++); | 112 | status = acpi_ut_create_list ("Acpi-Namespace", sizeof (struct acpi_namespace_node), |
180 | 113 | &acpi_gbl_ns_node_list); | |
181 | /* Check the cache first */ | 114 | if (ACPI_FAILURE (status)) { |
182 | 115 | return (status); | |
183 | if (cache_info->list_head) { | 116 | } |
184 | /* There is an object available, use it */ | ||
185 | |||
186 | object = cache_info->list_head; | ||
187 | cache_info->list_head = *(ACPI_CAST_INDIRECT_PTR (char, | ||
188 | &(((char *) object)[cache_info->link_offset]))); | ||
189 | |||
190 | ACPI_MEM_TRACKING (cache_info->cache_hits++); | ||
191 | cache_info->cache_depth--; | ||
192 | |||
193 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
194 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p from %s\n", | ||
195 | object, acpi_gbl_memory_lists[list_id].list_name)); | ||
196 | #endif | 117 | #endif |
197 | 118 | ||
198 | if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_CACHES))) { | 119 | /* Object Caches, for frequently used objects */ |
199 | return (NULL); | ||
200 | } | ||
201 | |||
202 | /* Clear (zero) the previously used Object */ | ||
203 | 120 | ||
204 | ACPI_MEMSET (object, 0, cache_info->object_size); | 121 | status = acpi_os_create_cache ("acpi_state", sizeof (union acpi_generic_state), |
122 | ACPI_MAX_STATE_CACHE_DEPTH, &acpi_gbl_state_cache); | ||
123 | if (ACPI_FAILURE (status)) { | ||
124 | return (status); | ||
205 | } | 125 | } |
206 | 126 | ||
207 | else { | 127 | status = acpi_os_create_cache ("acpi_parse", sizeof (struct acpi_parse_obj_common), |
208 | /* The cache is empty, create a new object */ | 128 | ACPI_MAX_PARSE_CACHE_DEPTH, &acpi_gbl_ps_node_cache); |
209 | 129 | if (ACPI_FAILURE (status)) { | |
210 | /* Avoid deadlock with ACPI_MEM_CALLOCATE */ | 130 | return (status); |
211 | |||
212 | if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_CACHES))) { | ||
213 | return (NULL); | ||
214 | } | ||
215 | |||
216 | object = ACPI_MEM_CALLOCATE (cache_info->object_size); | ||
217 | ACPI_MEM_TRACKING (cache_info->total_allocated++); | ||
218 | } | 131 | } |
219 | 132 | ||
220 | #else | 133 | status = acpi_os_create_cache ("acpi_parse_ext", sizeof (struct acpi_parse_obj_named), |
221 | 134 | ACPI_MAX_EXTPARSE_CACHE_DEPTH, &acpi_gbl_ps_node_ext_cache); | |
222 | /* Object cache is disabled; just allocate the object */ | 135 | if (ACPI_FAILURE (status)) { |
136 | return (status); | ||
137 | } | ||
223 | 138 | ||
224 | object = ACPI_MEM_CALLOCATE (cache_info->object_size); | 139 | status = acpi_os_create_cache ("acpi_operand", sizeof (union acpi_operand_object), |
225 | ACPI_MEM_TRACKING (cache_info->total_allocated++); | 140 | ACPI_MAX_OBJECT_CACHE_DEPTH, &acpi_gbl_operand_cache); |
226 | #endif | 141 | if (ACPI_FAILURE (status)) { |
142 | return (status); | ||
143 | } | ||
227 | 144 | ||
228 | return (object); | 145 | return (AE_OK); |
229 | } | 146 | } |
230 | 147 | ||
231 | 148 | ||
232 | #ifdef ACPI_ENABLE_OBJECT_CACHE | ||
233 | /******************************************************************************* | 149 | /******************************************************************************* |
234 | * | 150 | * |
235 | * FUNCTION: acpi_ut_delete_generic_cache | 151 | * FUNCTION: acpi_ut_delete_caches |
236 | * | 152 | * |
237 | * PARAMETERS: list_id - Memory list ID | 153 | * PARAMETERS: None |
238 | * | 154 | * |
239 | * RETURN: None | 155 | * RETURN: Status |
240 | * | 156 | * |
241 | * DESCRIPTION: Free all objects within the requested cache. | 157 | * DESCRIPTION: Purge and delete all local caches |
242 | * | 158 | * |
243 | ******************************************************************************/ | 159 | ******************************************************************************/ |
244 | 160 | ||
245 | void | 161 | acpi_status |
246 | acpi_ut_delete_generic_cache ( | 162 | acpi_ut_delete_caches ( |
247 | u32 list_id) | 163 | void) |
248 | { | 164 | { |
249 | struct acpi_memory_list *cache_info; | ||
250 | char *next; | ||
251 | 165 | ||
166 | (void) acpi_os_delete_cache (acpi_gbl_state_cache); | ||
167 | acpi_gbl_state_cache = NULL; | ||
252 | 168 | ||
253 | ACPI_FUNCTION_ENTRY (); | 169 | (void) acpi_os_delete_cache (acpi_gbl_operand_cache); |
254 | 170 | acpi_gbl_operand_cache = NULL; | |
255 | 171 | ||
256 | cache_info = &acpi_gbl_memory_lists[list_id]; | 172 | (void) acpi_os_delete_cache (acpi_gbl_ps_node_cache); |
257 | while (cache_info->list_head) { | 173 | acpi_gbl_ps_node_cache = NULL; |
258 | /* Delete one cached state object */ | ||
259 | 174 | ||
260 | next = *(ACPI_CAST_INDIRECT_PTR (char, | 175 | (void) acpi_os_delete_cache (acpi_gbl_ps_node_ext_cache); |
261 | &(((char *) cache_info->list_head)[cache_info->link_offset]))); | 176 | acpi_gbl_ps_node_ext_cache = NULL; |
262 | ACPI_MEM_FREE (cache_info->list_head); | ||
263 | 177 | ||
264 | cache_info->list_head = next; | 178 | return (AE_OK); |
265 | cache_info->cache_depth--; | ||
266 | } | ||
267 | } | 179 | } |
268 | #endif | ||
269 | |||
270 | 180 | ||
271 | /******************************************************************************* | 181 | /******************************************************************************* |
272 | * | 182 | * |
@@ -500,6 +410,43 @@ acpi_ut_callocate ( | |||
500 | * occurs in the body of acpi_ut_free. | 410 | * occurs in the body of acpi_ut_free. |
501 | */ | 411 | */ |
502 | 412 | ||
413 | /******************************************************************************* | ||
414 | * | ||
415 | * FUNCTION: acpi_ut_create_list | ||
416 | * | ||
417 | * PARAMETERS: cache_name - Ascii name for the cache | ||
418 | * object_size - Size of each cached object | ||
419 | * return_cache - Where the new cache object is returned | ||
420 | * | ||
421 | * RETURN: Status | ||
422 | * | ||
423 | * DESCRIPTION: Create a local memory list for tracking purposed | ||
424 | * | ||
425 | ******************************************************************************/ | ||
426 | |||
427 | static acpi_status | ||
428 | acpi_ut_create_list ( | ||
429 | char *list_name, | ||
430 | u16 object_size, | ||
431 | acpi_handle *return_cache) | ||
432 | { | ||
433 | struct acpi_memory_list *cache; | ||
434 | |||
435 | |||
436 | cache = acpi_os_allocate (sizeof (struct acpi_memory_list)); | ||
437 | if (!cache) { | ||
438 | return (AE_NO_MEMORY); | ||
439 | } | ||
440 | |||
441 | ACPI_MEMSET (cache, 0, sizeof (struct acpi_memory_list)); | ||
442 | |||
443 | cache->list_name = list_name; | ||
444 | cache->object_size = object_size; | ||
445 | |||
446 | *return_cache = cache; | ||
447 | return (AE_OK); | ||
448 | } | ||
449 | |||
503 | 450 | ||
504 | /******************************************************************************* | 451 | /******************************************************************************* |
505 | * | 452 | * |
@@ -533,15 +480,15 @@ acpi_ut_allocate_and_track ( | |||
533 | return (NULL); | 480 | return (NULL); |
534 | } | 481 | } |
535 | 482 | ||
536 | status = acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL, allocation, size, | 483 | status = acpi_ut_track_allocation (allocation, size, |
537 | ACPI_MEM_MALLOC, component, module, line); | 484 | ACPI_MEM_MALLOC, component, module, line); |
538 | if (ACPI_FAILURE (status)) { | 485 | if (ACPI_FAILURE (status)) { |
539 | acpi_os_free (allocation); | 486 | acpi_os_free (allocation); |
540 | return (NULL); | 487 | return (NULL); |
541 | } | 488 | } |
542 | 489 | ||
543 | acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_allocated++; | 490 | acpi_gbl_global_list->total_allocated++; |
544 | acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size += (u32) size; | 491 | acpi_gbl_global_list->current_total_size += (u32) size; |
545 | 492 | ||
546 | return ((void *) &allocation->user_space); | 493 | return ((void *) &allocation->user_space); |
547 | } | 494 | } |
@@ -583,15 +530,15 @@ acpi_ut_callocate_and_track ( | |||
583 | return (NULL); | 530 | return (NULL); |
584 | } | 531 | } |
585 | 532 | ||
586 | status = acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL, allocation, size, | 533 | status = acpi_ut_track_allocation (allocation, size, |
587 | ACPI_MEM_CALLOC, component, module, line); | 534 | ACPI_MEM_CALLOC, component, module, line); |
588 | if (ACPI_FAILURE (status)) { | 535 | if (ACPI_FAILURE (status)) { |
589 | acpi_os_free (allocation); | 536 | acpi_os_free (allocation); |
590 | return (NULL); | 537 | return (NULL); |
591 | } | 538 | } |
592 | 539 | ||
593 | acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_allocated++; | 540 | acpi_gbl_global_list->total_allocated++; |
594 | acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size += (u32) size; | 541 | acpi_gbl_global_list->current_total_size += (u32) size; |
595 | 542 | ||
596 | return ((void *) &allocation->user_space); | 543 | return ((void *) &allocation->user_space); |
597 | } | 544 | } |
@@ -636,10 +583,10 @@ acpi_ut_free_and_track ( | |||
636 | debug_block = ACPI_CAST_PTR (struct acpi_debug_mem_block, | 583 | debug_block = ACPI_CAST_PTR (struct acpi_debug_mem_block, |
637 | (((char *) allocation) - sizeof (struct acpi_debug_mem_header))); | 584 | (((char *) allocation) - sizeof (struct acpi_debug_mem_header))); |
638 | 585 | ||
639 | acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].total_freed++; | 586 | acpi_gbl_global_list->total_freed++; |
640 | acpi_gbl_memory_lists[ACPI_MEM_LIST_GLOBAL].current_total_size -= debug_block->size; | 587 | acpi_gbl_global_list->current_total_size -= debug_block->size; |
641 | 588 | ||
642 | status = acpi_ut_remove_allocation (ACPI_MEM_LIST_GLOBAL, debug_block, | 589 | status = acpi_ut_remove_allocation (debug_block, |
643 | component, module, line); | 590 | component, module, line); |
644 | if (ACPI_FAILURE (status)) { | 591 | if (ACPI_FAILURE (status)) { |
645 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not free memory, %s\n", | 592 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not free memory, %s\n", |
@@ -658,8 +605,7 @@ acpi_ut_free_and_track ( | |||
658 | * | 605 | * |
659 | * FUNCTION: acpi_ut_find_allocation | 606 | * FUNCTION: acpi_ut_find_allocation |
660 | * | 607 | * |
661 | * PARAMETERS: list_id - Memory list to search | 608 | * PARAMETERS: Allocation - Address of allocated memory |
662 | * Allocation - Address of allocated memory | ||
663 | * | 609 | * |
664 | * RETURN: A list element if found; NULL otherwise. | 610 | * RETURN: A list element if found; NULL otherwise. |
665 | * | 611 | * |
@@ -669,7 +615,6 @@ acpi_ut_free_and_track ( | |||
669 | 615 | ||
670 | static struct acpi_debug_mem_block * | 616 | static struct acpi_debug_mem_block * |
671 | acpi_ut_find_allocation ( | 617 | acpi_ut_find_allocation ( |
672 | u32 list_id, | ||
673 | void *allocation) | 618 | void *allocation) |
674 | { | 619 | { |
675 | struct acpi_debug_mem_block *element; | 620 | struct acpi_debug_mem_block *element; |
@@ -678,11 +623,7 @@ acpi_ut_find_allocation ( | |||
678 | ACPI_FUNCTION_ENTRY (); | 623 | ACPI_FUNCTION_ENTRY (); |
679 | 624 | ||
680 | 625 | ||
681 | if (list_id > ACPI_MEM_LIST_MAX) { | 626 | element = acpi_gbl_global_list->list_head; |
682 | return (NULL); | ||
683 | } | ||
684 | |||
685 | element = acpi_gbl_memory_lists[list_id].list_head; | ||
686 | 627 | ||
687 | /* Search for the address. */ | 628 | /* Search for the address. */ |
688 | 629 | ||
@@ -702,8 +643,7 @@ acpi_ut_find_allocation ( | |||
702 | * | 643 | * |
703 | * FUNCTION: acpi_ut_track_allocation | 644 | * FUNCTION: acpi_ut_track_allocation |
704 | * | 645 | * |
705 | * PARAMETERS: list_id - Memory list to search | 646 | * PARAMETERS: Allocation - Address of allocated memory |
706 | * Allocation - Address of allocated memory | ||
707 | * Size - Size of the allocation | 647 | * Size - Size of the allocation |
708 | * alloc_type - MEM_MALLOC or MEM_CALLOC | 648 | * alloc_type - MEM_MALLOC or MEM_CALLOC |
709 | * Component - Component type of caller | 649 | * Component - Component type of caller |
@@ -718,7 +658,6 @@ acpi_ut_find_allocation ( | |||
718 | 658 | ||
719 | static acpi_status | 659 | static acpi_status |
720 | acpi_ut_track_allocation ( | 660 | acpi_ut_track_allocation ( |
721 | u32 list_id, | ||
722 | struct acpi_debug_mem_block *allocation, | 661 | struct acpi_debug_mem_block *allocation, |
723 | acpi_size size, | 662 | acpi_size size, |
724 | u8 alloc_type, | 663 | u8 alloc_type, |
@@ -734,11 +673,7 @@ acpi_ut_track_allocation ( | |||
734 | ACPI_FUNCTION_TRACE_PTR ("ut_track_allocation", allocation); | 673 | ACPI_FUNCTION_TRACE_PTR ("ut_track_allocation", allocation); |
735 | 674 | ||
736 | 675 | ||
737 | if (list_id > ACPI_MEM_LIST_MAX) { | 676 | mem_list = acpi_gbl_global_list; |
738 | return_ACPI_STATUS (AE_BAD_PARAMETER); | ||
739 | } | ||
740 | |||
741 | mem_list = &acpi_gbl_memory_lists[list_id]; | ||
742 | status = acpi_ut_acquire_mutex (ACPI_MTX_MEMORY); | 677 | status = acpi_ut_acquire_mutex (ACPI_MTX_MEMORY); |
743 | if (ACPI_FAILURE (status)) { | 678 | if (ACPI_FAILURE (status)) { |
744 | return_ACPI_STATUS (status); | 679 | return_ACPI_STATUS (status); |
@@ -748,8 +683,7 @@ acpi_ut_track_allocation ( | |||
748 | * Search list for this address to make sure it is not already on the list. | 683 | * Search list for this address to make sure it is not already on the list. |
749 | * This will catch several kinds of problems. | 684 | * This will catch several kinds of problems. |
750 | */ | 685 | */ |
751 | 686 | element = acpi_ut_find_allocation (allocation); | |
752 | element = acpi_ut_find_allocation (list_id, allocation); | ||
753 | if (element) { | 687 | if (element) { |
754 | ACPI_REPORT_ERROR (( | 688 | ACPI_REPORT_ERROR (( |
755 | "ut_track_allocation: Allocation already present in list! (%p)\n", | 689 | "ut_track_allocation: Allocation already present in list! (%p)\n", |
@@ -793,8 +727,7 @@ unlock_and_exit: | |||
793 | * | 727 | * |
794 | * FUNCTION: acpi_ut_remove_allocation | 728 | * FUNCTION: acpi_ut_remove_allocation |
795 | * | 729 | * |
796 | * PARAMETERS: list_id - Memory list to search | 730 | * PARAMETERS: Allocation - Address of allocated memory |
797 | * Allocation - Address of allocated memory | ||
798 | * Component - Component type of caller | 731 | * Component - Component type of caller |
799 | * Module - Source file name of caller | 732 | * Module - Source file name of caller |
800 | * Line - Line number of caller | 733 | * Line - Line number of caller |
@@ -807,7 +740,6 @@ unlock_and_exit: | |||
807 | 740 | ||
808 | static acpi_status | 741 | static acpi_status |
809 | acpi_ut_remove_allocation ( | 742 | acpi_ut_remove_allocation ( |
810 | u32 list_id, | ||
811 | struct acpi_debug_mem_block *allocation, | 743 | struct acpi_debug_mem_block *allocation, |
812 | u32 component, | 744 | u32 component, |
813 | char *module, | 745 | char *module, |
@@ -820,11 +752,7 @@ acpi_ut_remove_allocation ( | |||
820 | ACPI_FUNCTION_TRACE ("ut_remove_allocation"); | 752 | ACPI_FUNCTION_TRACE ("ut_remove_allocation"); |
821 | 753 | ||
822 | 754 | ||
823 | if (list_id > ACPI_MEM_LIST_MAX) { | 755 | mem_list = acpi_gbl_global_list; |
824 | return_ACPI_STATUS (AE_BAD_PARAMETER); | ||
825 | } | ||
826 | |||
827 | mem_list = &acpi_gbl_memory_lists[list_id]; | ||
828 | if (NULL == mem_list->list_head) { | 756 | if (NULL == mem_list->list_head) { |
829 | /* No allocations! */ | 757 | /* No allocations! */ |
830 | 758 | ||
@@ -959,7 +887,7 @@ acpi_ut_dump_allocations ( | |||
959 | return; | 887 | return; |
960 | } | 888 | } |
961 | 889 | ||
962 | element = acpi_gbl_memory_lists[0].list_head; | 890 | element = acpi_gbl_global_list->list_head; |
963 | while (element) { | 891 | while (element) { |
964 | if ((element->component & component) && | 892 | if ((element->component & component) && |
965 | ((module == NULL) || (0 == ACPI_STRCMP (module, element->module)))) { | 893 | ((module == NULL) || (0 == ACPI_STRCMP (module, element->module)))) { |