diff options
author | Robert Moore <robert.moore@intel.com> | 2005-04-18 22:49:35 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-07-12 00:08:52 -0400 |
commit | 44f6c01242da4e162f28d8e1216a8c7a91174605 (patch) | |
tree | 53f724764f1bd9036dfb049a643d198125cc9edc /drivers/acpi/utilities/utalloc.c | |
parent | ebb6e1a6122fd6b7c96470cfd4ce0f04150e5084 (diff) |
ACPICA 20050408 from Bob Moore
Fixed three cases in the interpreter where an "index"
argument to an ASL function was still (internally) 32
bits instead of the required 64 bits. This was the Index
argument to the Index, Mid, and Match operators.
The "strupr" function is now permanently local
(acpi_ut_strupr), since this is not a POSIX-defined
function and not present in most kernel-level C
libraries. References to the C library strupr function
have been removed from the headers.
Completed the deployment of static
functions/prototypes. All prototypes with the static
attribute have been moved from the headers to the owning
C file.
ACPICA 20050329 from Bob Moore
An error is now generated if an attempt is made to create
a Buffer Field of length zero (A CreateField with a length
operand of zero.)
The interpreter now issues a warning whenever executable
code at the module level is detected during ACPI table
load. This will give some idea of the prevalence of this
type of code.
Implemented support for references to named objects (other
than control methods) within package objects.
Enhanced package object output for the debug
object. Package objects are now completely dumped, showing
all elements.
Enhanced miscellaneous object output for the debug
object. Any object can now be written to the debug object
(for example, a device object can be written, and the type
of the object will be displayed.)
The "static" qualifier has been added to all local
functions across the core subsystem.
The number of "long" lines (> 80 chars) within the source
has been significantly reduced, by about 1/3.
Cleaned up all header files to ensure that all CA/iASL
functions are prototyped (even static functions) and the
formatting is consistent.
Two new header files have been added, acopcode.h and
acnames.h.
Removed several obsolete functions that were no longer
used.
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 | 84 |
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 |
53 | static struct acpi_debug_mem_block * | ||
54 | acpi_ut_find_allocation ( | ||
55 | u32 list_id, | ||
56 | void *allocation); | ||
57 | |||
58 | static acpi_status | ||
59 | acpi_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 | |||
68 | static acpi_status | ||
69 | acpi_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 | ||
640 | struct acpi_debug_mem_block * | 670 | static struct acpi_debug_mem_block * |
641 | acpi_ut_find_allocation ( | 671 | acpi_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 | ||
689 | acpi_status | 719 | static acpi_status |
690 | acpi_ut_track_allocation ( | 720 | acpi_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 | ||
776 | acpi_status | 808 | static acpi_status |
777 | acpi_ut_remove_allocation ( | 809 | acpi_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 |
846 | void | 880 | void |
847 | acpi_ut_dump_allocation_info ( | 881 | acpi_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 | ||