1 /******************************************************************************
3 * Module Name: utalloc - local cache and memory allocation routines
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2005, R. Byron Moore
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
45 #include <acpi/acpi.h>
47 #define _COMPONENT ACPI_UTILITIES
48 ACPI_MODULE_NAME ("utalloc")
51 /******************************************************************************
53 * FUNCTION: acpi_ut_release_to_cache
55 * PARAMETERS: list_id - Memory list/cache ID
56 * Object - The object to be released
60 * DESCRIPTION: Release an object to the specified cache. If cache is full,
61 * the object is deleted.
63 ******************************************************************************/
66 acpi_ut_release_to_cache (
70 struct acpi_memory_list
*cache_info
;
73 ACPI_FUNCTION_ENTRY ();
76 cache_info
= &acpi_gbl_memory_lists
[list_id
];
78 #ifdef ACPI_ENABLE_OBJECT_CACHE
80 /* If walk cache is full, just free this wallkstate object */
82 if (cache_info
->cache_depth
>= cache_info
->max_cache_depth
) {
83 ACPI_MEM_FREE (object
);
84 ACPI_MEM_TRACKING (cache_info
->total_freed
++);
87 /* Otherwise put this object back into the cache */
90 if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES
))) {
94 /* Mark the object as cached */
96 ACPI_MEMSET (object
, 0xCA, cache_info
->object_size
);
97 ACPI_SET_DESCRIPTOR_TYPE (object
, ACPI_DESC_TYPE_CACHED
);
99 /* Put the object at the head of the cache list */
101 * (ACPI_CAST_INDIRECT_PTR (char, &(((char *) object
)[cache_info
->link_offset
]))) = cache_info
->list_head
;
102 cache_info
->list_head
= object
;
103 cache_info
->cache_depth
++;
105 (void) acpi_ut_release_mutex (ACPI_MTX_CACHES
);
110 /* Object cache is disabled; just free the object */
112 ACPI_MEM_FREE (object
);
113 ACPI_MEM_TRACKING (cache_info
->total_freed
++);
118 /******************************************************************************
120 * FUNCTION: acpi_ut_acquire_from_cache
122 * PARAMETERS: list_id - Memory list ID
124 * RETURN: A requested object. NULL if the object could not be
127 * DESCRIPTION: Get an object from the specified cache. If cache is empty,
128 * the object is allocated.
130 ******************************************************************************/
133 acpi_ut_acquire_from_cache (
136 struct acpi_memory_list
*cache_info
;
140 ACPI_FUNCTION_NAME ("ut_acquire_from_cache");
143 cache_info
= &acpi_gbl_memory_lists
[list_id
];
145 #ifdef ACPI_ENABLE_OBJECT_CACHE
147 if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_CACHES
))) {
151 ACPI_MEM_TRACKING (cache_info
->cache_requests
++);
153 /* Check the cache first */
155 if (cache_info
->list_head
) {
156 /* There is an object available, use it */
158 object
= cache_info
->list_head
;
159 cache_info
->list_head
= *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) object
)[cache_info
->link_offset
])));
161 ACPI_MEM_TRACKING (cache_info
->cache_hits
++);
162 cache_info
->cache_depth
--;
164 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
165 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC
, "Object %p from %s\n",
166 object
, acpi_gbl_memory_lists
[list_id
].list_name
));
169 if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_CACHES
))) {
173 /* Clear (zero) the previously used Object */
175 ACPI_MEMSET (object
, 0, cache_info
->object_size
);
179 /* The cache is empty, create a new object */
181 /* Avoid deadlock with ACPI_MEM_CALLOCATE */
183 if (ACPI_FAILURE (acpi_ut_release_mutex (ACPI_MTX_CACHES
))) {
187 object
= ACPI_MEM_CALLOCATE (cache_info
->object_size
);
188 ACPI_MEM_TRACKING (cache_info
->total_allocated
++);
193 /* Object cache is disabled; just allocate the object */
195 object
= ACPI_MEM_CALLOCATE (cache_info
->object_size
);
196 ACPI_MEM_TRACKING (cache_info
->total_allocated
++);
203 #ifdef ACPI_ENABLE_OBJECT_CACHE
204 /******************************************************************************
206 * FUNCTION: acpi_ut_delete_generic_cache
208 * PARAMETERS: list_id - Memory list ID
212 * DESCRIPTION: Free all objects within the requested cache.
214 ******************************************************************************/
217 acpi_ut_delete_generic_cache (
220 struct acpi_memory_list
*cache_info
;
224 ACPI_FUNCTION_ENTRY ();
227 cache_info
= &acpi_gbl_memory_lists
[list_id
];
228 while (cache_info
->list_head
) {
229 /* Delete one cached state object */
231 next
= *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) cache_info
->list_head
)[cache_info
->link_offset
])));
232 ACPI_MEM_FREE (cache_info
->list_head
);
234 cache_info
->list_head
= next
;
235 cache_info
->cache_depth
--;
241 /*******************************************************************************
243 * FUNCTION: acpi_ut_validate_buffer
245 * PARAMETERS: Buffer - Buffer descriptor to be validated
249 * DESCRIPTION: Perform parameter validation checks on an struct acpi_buffer
251 ******************************************************************************/
254 acpi_ut_validate_buffer (
255 struct acpi_buffer
*buffer
)
258 /* Obviously, the structure pointer must be valid */
261 return (AE_BAD_PARAMETER
);
264 /* Special semantics for the length */
266 if ((buffer
->length
== ACPI_NO_BUFFER
) ||
267 (buffer
->length
== ACPI_ALLOCATE_BUFFER
) ||
268 (buffer
->length
== ACPI_ALLOCATE_LOCAL_BUFFER
)) {
272 /* Length is valid, the buffer pointer must be also */
274 if (!buffer
->pointer
) {
275 return (AE_BAD_PARAMETER
);
282 /*******************************************************************************
284 * FUNCTION: acpi_ut_initialize_buffer
286 * PARAMETERS: Buffer - Buffer to be validated
287 * required_length - Length needed
291 * DESCRIPTION: Validate that the buffer is of the required length or
292 * allocate a new buffer. Returned buffer is always zeroed.
294 ******************************************************************************/
297 acpi_ut_initialize_buffer (
298 struct acpi_buffer
*buffer
,
299 acpi_size required_length
)
301 acpi_status status
= AE_OK
;
304 switch (buffer
->length
) {
307 /* Set the exception and returned the required length */
309 status
= AE_BUFFER_OVERFLOW
;
313 case ACPI_ALLOCATE_BUFFER
:
315 /* Allocate a new buffer */
317 buffer
->pointer
= acpi_os_allocate (required_length
);
318 if (!buffer
->pointer
) {
319 return (AE_NO_MEMORY
);
322 /* Clear the buffer */
324 ACPI_MEMSET (buffer
->pointer
, 0, required_length
);
328 case ACPI_ALLOCATE_LOCAL_BUFFER
:
330 /* Allocate a new buffer with local interface to allow tracking */
332 buffer
->pointer
= ACPI_MEM_CALLOCATE (required_length
);
333 if (!buffer
->pointer
) {
334 return (AE_NO_MEMORY
);
341 /* Existing buffer: Validate the size of the buffer */
343 if (buffer
->length
< required_length
) {
344 status
= AE_BUFFER_OVERFLOW
;
348 /* Clear the buffer */
350 ACPI_MEMSET (buffer
->pointer
, 0, required_length
);
354 buffer
->length
= required_length
;
359 /*******************************************************************************
361 * FUNCTION: acpi_ut_allocate
363 * PARAMETERS: Size - Size of the allocation
364 * Component - Component type of caller
365 * Module - Source file name of caller
366 * Line - Line number of caller
368 * RETURN: Address of the allocated memory on success, NULL on failure.
370 * DESCRIPTION: The subsystem's equivalent of malloc.
372 ******************************************************************************/
384 ACPI_FUNCTION_TRACE_U32 ("ut_allocate", size
);
387 /* Check for an inadvertent size of zero bytes */
390 _ACPI_REPORT_ERROR (module
, line
, component
,
391 ("ut_allocate: Attempt to allocate zero bytes\n"));
395 allocation
= acpi_os_allocate (size
);
397 /* Report allocation error */
399 _ACPI_REPORT_ERROR (module
, line
, component
,
400 ("ut_allocate: Could not allocate size %X\n", (u32
) size
));
405 return_PTR (allocation
);
409 /*******************************************************************************
411 * FUNCTION: acpi_ut_callocate
413 * PARAMETERS: Size - Size of the allocation
414 * Component - Component type of caller
415 * Module - Source file name of caller
416 * Line - Line number of caller
418 * RETURN: Address of the allocated memory on success, NULL on failure.
420 * DESCRIPTION: Subsystem equivalent of calloc.
422 ******************************************************************************/
434 ACPI_FUNCTION_TRACE_U32 ("ut_callocate", size
);
437 /* Check for an inadvertent size of zero bytes */
440 _ACPI_REPORT_ERROR (module
, line
, component
,
441 ("ut_callocate: Attempt to allocate zero bytes\n"));
445 allocation
= acpi_os_allocate (size
);
447 /* Report allocation error */
449 _ACPI_REPORT_ERROR (module
, line
, component
,
450 ("ut_callocate: Could not allocate size %X\n", (u32
) size
));
454 /* Clear the memory block */
456 ACPI_MEMSET (allocation
, 0, size
);
457 return_PTR (allocation
);
461 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
463 * These procedures are used for tracking memory leaks in the subsystem, and
464 * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set.
466 * Each memory allocation is tracked via a doubly linked list. Each
467 * element contains the caller's component, module name, function name, and
468 * line number. acpi_ut_allocate and acpi_ut_callocate call
469 * acpi_ut_track_allocation to add an element to the list; deletion
470 * occurs in the body of acpi_ut_free.
474 /*******************************************************************************
476 * FUNCTION: acpi_ut_allocate_and_track
478 * PARAMETERS: Size - Size of the allocation
479 * Component - Component type of caller
480 * Module - Source file name of caller
481 * Line - Line number of caller
483 * RETURN: Address of the allocated memory on success, NULL on failure.
485 * DESCRIPTION: The subsystem's equivalent of malloc.
487 ******************************************************************************/
490 acpi_ut_allocate_and_track (
496 struct acpi_debug_mem_block
*allocation
;
500 allocation
= acpi_ut_allocate (size
+ sizeof (struct acpi_debug_mem_header
), component
,
506 status
= acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL
, allocation
, size
,
507 ACPI_MEM_MALLOC
, component
, module
, line
);
508 if (ACPI_FAILURE (status
)) {
509 acpi_os_free (allocation
);
513 acpi_gbl_memory_lists
[ACPI_MEM_LIST_GLOBAL
].total_allocated
++;
514 acpi_gbl_memory_lists
[ACPI_MEM_LIST_GLOBAL
].current_total_size
+= (u32
) size
;
516 return ((void *) &allocation
->user_space
);
520 /*******************************************************************************
522 * FUNCTION: acpi_ut_callocate_and_track
524 * PARAMETERS: Size - Size of the allocation
525 * Component - Component type of caller
526 * Module - Source file name of caller
527 * Line - Line number of caller
529 * RETURN: Address of the allocated memory on success, NULL on failure.
531 * DESCRIPTION: Subsystem equivalent of calloc.
533 ******************************************************************************/
536 acpi_ut_callocate_and_track (
542 struct acpi_debug_mem_block
*allocation
;
546 allocation
= acpi_ut_callocate (size
+ sizeof (struct acpi_debug_mem_header
), component
,
549 /* Report allocation error */
551 _ACPI_REPORT_ERROR (module
, line
, component
,
552 ("ut_callocate: Could not allocate size %X\n", (u32
) size
));
556 status
= acpi_ut_track_allocation (ACPI_MEM_LIST_GLOBAL
, allocation
, size
,
557 ACPI_MEM_CALLOC
, component
, module
, line
);
558 if (ACPI_FAILURE (status
)) {
559 acpi_os_free (allocation
);
563 acpi_gbl_memory_lists
[ACPI_MEM_LIST_GLOBAL
].total_allocated
++;
564 acpi_gbl_memory_lists
[ACPI_MEM_LIST_GLOBAL
].current_total_size
+= (u32
) size
;
566 return ((void *) &allocation
->user_space
);
570 /*******************************************************************************
572 * FUNCTION: acpi_ut_free_and_track
574 * PARAMETERS: Allocation - Address of the memory to deallocate
575 * Component - Component type of caller
576 * Module - Source file name of caller
577 * Line - Line number of caller
581 * DESCRIPTION: Frees the memory at Allocation
583 ******************************************************************************/
586 acpi_ut_free_and_track (
592 struct acpi_debug_mem_block
*debug_block
;
596 ACPI_FUNCTION_TRACE_PTR ("ut_free", allocation
);
599 if (NULL
== allocation
) {
600 _ACPI_REPORT_ERROR (module
, line
, component
,
601 ("acpi_ut_free: Attempt to delete a NULL address\n"));
606 debug_block
= ACPI_CAST_PTR (struct acpi_debug_mem_block
,
607 (((char *) allocation
) - sizeof (struct acpi_debug_mem_header
)));
609 acpi_gbl_memory_lists
[ACPI_MEM_LIST_GLOBAL
].total_freed
++;
610 acpi_gbl_memory_lists
[ACPI_MEM_LIST_GLOBAL
].current_total_size
-= debug_block
->size
;
612 status
= acpi_ut_remove_allocation (ACPI_MEM_LIST_GLOBAL
, debug_block
,
613 component
, module
, line
);
614 if (ACPI_FAILURE (status
)) {
615 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR
, "Could not free memory, %s\n",
616 acpi_format_exception (status
)));
619 acpi_os_free (debug_block
);
621 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS
, "%p freed\n", allocation
));
627 /*******************************************************************************
629 * FUNCTION: acpi_ut_find_allocation
631 * PARAMETERS: list_id - Memory list to search
632 * Allocation - Address of allocated memory
634 * RETURN: A list element if found; NULL otherwise.
636 * DESCRIPTION: Searches for an element in the global allocation tracking list.
638 ******************************************************************************/
640 struct acpi_debug_mem_block
*
641 acpi_ut_find_allocation (
645 struct acpi_debug_mem_block
*element
;
648 ACPI_FUNCTION_ENTRY ();
651 if (list_id
> ACPI_MEM_LIST_MAX
) {
655 element
= acpi_gbl_memory_lists
[list_id
].list_head
;
657 /* Search for the address. */
660 if (element
== allocation
) {
664 element
= element
->next
;
671 /*******************************************************************************
673 * FUNCTION: acpi_ut_track_allocation
675 * PARAMETERS: list_id - Memory list to search
676 * Allocation - Address of allocated memory
677 * Size - Size of the allocation
678 * alloc_type - MEM_MALLOC or MEM_CALLOC
679 * Component - Component type of caller
680 * Module - Source file name of caller
681 * Line - Line number of caller
685 * DESCRIPTION: Inserts an element into the global allocation tracking list.
687 ******************************************************************************/
690 acpi_ut_track_allocation (
692 struct acpi_debug_mem_block
*allocation
,
699 struct acpi_memory_list
*mem_list
;
700 struct acpi_debug_mem_block
*element
;
701 acpi_status status
= AE_OK
;
704 ACPI_FUNCTION_TRACE_PTR ("ut_track_allocation", allocation
);
707 if (list_id
> ACPI_MEM_LIST_MAX
) {
708 return_ACPI_STATUS (AE_BAD_PARAMETER
);
711 mem_list
= &acpi_gbl_memory_lists
[list_id
];
712 status
= acpi_ut_acquire_mutex (ACPI_MTX_MEMORY
);
713 if (ACPI_FAILURE (status
)) {
714 return_ACPI_STATUS (status
);
718 * Search list for this address to make sure it is not already on the list.
719 * This will catch several kinds of problems.
722 element
= acpi_ut_find_allocation (list_id
, allocation
);
724 ACPI_REPORT_ERROR (("ut_track_allocation: Allocation already present in list! (%p)\n",
727 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR
, "Element %p Address %p\n", element
, allocation
));
729 goto unlock_and_exit
;
732 /* Fill in the instance data. */
734 allocation
->size
= (u32
) size
;
735 allocation
->alloc_type
= alloc_type
;
736 allocation
->component
= component
;
737 allocation
->line
= line
;
739 ACPI_STRNCPY (allocation
->module
, module
, ACPI_MAX_MODULE_NAME
);
740 allocation
->module
[ACPI_MAX_MODULE_NAME
-1] = 0;
742 /* Insert at list head */
744 if (mem_list
->list_head
) {
745 ((struct acpi_debug_mem_block
*)(mem_list
->list_head
))->previous
= allocation
;
748 allocation
->next
= mem_list
->list_head
;
749 allocation
->previous
= NULL
;
751 mem_list
->list_head
= allocation
;
755 status
= acpi_ut_release_mutex (ACPI_MTX_MEMORY
);
756 return_ACPI_STATUS (status
);
760 /*******************************************************************************
762 * FUNCTION: acpi_ut_remove_allocation
764 * PARAMETERS: list_id - Memory list to search
765 * Allocation - Address of allocated memory
766 * Component - Component type of caller
767 * Module - Source file name of caller
768 * Line - Line number of caller
772 * DESCRIPTION: Deletes an element from the global allocation tracking list.
774 ******************************************************************************/
777 acpi_ut_remove_allocation (
779 struct acpi_debug_mem_block
*allocation
,
784 struct acpi_memory_list
*mem_list
;
788 ACPI_FUNCTION_TRACE ("ut_remove_allocation");
791 if (list_id
> ACPI_MEM_LIST_MAX
) {
792 return_ACPI_STATUS (AE_BAD_PARAMETER
);
795 mem_list
= &acpi_gbl_memory_lists
[list_id
];
796 if (NULL
== mem_list
->list_head
) {
797 /* No allocations! */
799 _ACPI_REPORT_ERROR (module
, line
, component
,
800 ("ut_remove_allocation: Empty allocation list, nothing to free!\n"));
802 return_ACPI_STATUS (AE_OK
);
805 status
= acpi_ut_acquire_mutex (ACPI_MTX_MEMORY
);
806 if (ACPI_FAILURE (status
)) {
807 return_ACPI_STATUS (status
);
812 if (allocation
->previous
) {
813 (allocation
->previous
)->next
= allocation
->next
;
816 mem_list
->list_head
= allocation
->next
;
819 if (allocation
->next
) {
820 (allocation
->next
)->previous
= allocation
->previous
;
823 /* Mark the segment as deleted */
825 ACPI_MEMSET (&allocation
->user_space
, 0xEA, allocation
->size
);
827 ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS
, "Freeing size 0%X\n", allocation
->size
));
829 status
= acpi_ut_release_mutex (ACPI_MTX_MEMORY
);
830 return_ACPI_STATUS (status
);
834 /*******************************************************************************
836 * FUNCTION: acpi_ut_dump_allocation_info
842 * DESCRIPTION: Print some info about the outstanding allocations.
844 ******************************************************************************/
845 #ifdef ACPI_FUTURE_USAGE
847 acpi_ut_dump_allocation_info (
851 struct acpi_memory_list *mem_list;
854 ACPI_FUNCTION_TRACE ("ut_dump_allocation_info");
857 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
858 ("%30s: %4d (%3d Kb)\n", "Current allocations",
859 mem_list->current_count,
860 ROUND_UP_TO_1K (mem_list->current_size)));
862 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
863 ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations",
864 mem_list->max_concurrent_count,
865 ROUND_UP_TO_1K (mem_list->max_concurrent_size)));
868 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
869 ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects",
870 running_object_count,
871 ROUND_UP_TO_1K (running_object_size)));
873 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
874 ("%30s: %4d (%3d Kb)\n", "Total (all) allocations",
876 ROUND_UP_TO_1K (running_alloc_size)));
879 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
880 ("%30s: %4d (%3d Kb)\n", "Current Nodes",
881 acpi_gbl_current_node_count,
882 ROUND_UP_TO_1K (acpi_gbl_current_node_size)));
884 ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
885 ("%30s: %4d (%3d Kb)\n", "Max Nodes",
886 acpi_gbl_max_concurrent_node_count,
887 ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * sizeof (struct acpi_namespace_node)))));
891 #endif /* ACPI_FUTURE_USAGE */
894 /*******************************************************************************
896 * FUNCTION: acpi_ut_dump_allocations
898 * PARAMETERS: Component - Component(s) to dump info for.
899 * Module - Module to dump info for. NULL means all.
903 * DESCRIPTION: Print a list of all outstanding allocations.
905 ******************************************************************************/
908 acpi_ut_dump_allocations (
912 struct acpi_debug_mem_block
*element
;
913 union acpi_descriptor
*descriptor
;
914 u32 num_outstanding
= 0;
917 ACPI_FUNCTION_TRACE ("ut_dump_allocations");
921 * Walk the allocation list.
923 if (ACPI_FAILURE (acpi_ut_acquire_mutex (ACPI_MTX_MEMORY
))) {
927 element
= acpi_gbl_memory_lists
[0].list_head
;
929 if ((element
->component
& component
) &&
930 ((module
== NULL
) || (0 == ACPI_STRCMP (module
, element
->module
)))) {
931 /* Ignore allocated objects that are in a cache */
933 descriptor
= ACPI_CAST_PTR (union acpi_descriptor
, &element
->user_space
);
934 if (descriptor
->descriptor_id
!= ACPI_DESC_TYPE_CACHED
) {
935 acpi_os_printf ("%p Len %04X %9.9s-%d [%s] ",
936 descriptor
, element
->size
, element
->module
,
937 element
->line
, acpi_ut_get_descriptor_name (descriptor
));
939 /* Most of the elements will be Operand objects. */
941 switch (ACPI_GET_DESCRIPTOR_TYPE (descriptor
)) {
942 case ACPI_DESC_TYPE_OPERAND
:
943 acpi_os_printf ("%12.12s R%hd",
944 acpi_ut_get_type_name (descriptor
->object
.common
.type
),
945 descriptor
->object
.common
.reference_count
);
948 case ACPI_DESC_TYPE_PARSER
:
949 acpi_os_printf ("aml_opcode %04hX",
950 descriptor
->op
.asl
.aml_opcode
);
953 case ACPI_DESC_TYPE_NAMED
:
954 acpi_os_printf ("%4.4s",
955 acpi_ut_get_node_name (&descriptor
->node
));
962 acpi_os_printf ( "\n");
966 element
= element
->next
;
969 (void) acpi_ut_release_mutex (ACPI_MTX_MEMORY
);
973 if (!num_outstanding
) {
974 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR
,
975 "No outstanding allocations.\n"));
978 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR
,
979 "%d(%X) Outstanding allocations\n",
980 num_outstanding
, num_outstanding
));
987 #endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */