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/namespace/nsalloc.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/namespace/nsalloc.c')
-rw-r--r-- | drivers/acpi/namespace/nsalloc.c | 121 |
1 files changed, 64 insertions, 57 deletions
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index bfd922c5c7d1..5653a19d7172 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c | |||
@@ -49,14 +49,20 @@ | |||
49 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME ("nsalloc") | 50 | ACPI_MODULE_NAME ("nsalloc") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static void | ||
55 | acpi_ns_remove_reference ( | ||
56 | struct acpi_namespace_node *node); | ||
57 | |||
52 | 58 | ||
53 | /******************************************************************************* | 59 | /******************************************************************************* |
54 | * | 60 | * |
55 | * FUNCTION: acpi_ns_create_node | 61 | * FUNCTION: acpi_ns_create_node |
56 | * | 62 | * |
57 | * PARAMETERS: acpi_name - Name of the new node | 63 | * PARAMETERS: Name - Name of the new node (4 char ACPI name) |
58 | * | 64 | * |
59 | * RETURN: None | 65 | * RETURN: New namespace node (Null on failure) |
60 | * | 66 | * |
61 | * DESCRIPTION: Create a namespace node | 67 | * DESCRIPTION: Create a namespace node |
62 | * | 68 | * |
@@ -145,7 +151,6 @@ acpi_ns_delete_node ( | |||
145 | } | 151 | } |
146 | } | 152 | } |
147 | 153 | ||
148 | |||
149 | ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++); | 154 | ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++); |
150 | 155 | ||
151 | /* | 156 | /* |
@@ -157,57 +162,6 @@ acpi_ns_delete_node ( | |||
157 | } | 162 | } |
158 | 163 | ||
159 | 164 | ||
160 | #ifdef ACPI_ALPHABETIC_NAMESPACE | ||
161 | /******************************************************************************* | ||
162 | * | ||
163 | * FUNCTION: acpi_ns_compare_names | ||
164 | * | ||
165 | * PARAMETERS: Name1 - First name to compare | ||
166 | * Name2 - Second name to compare | ||
167 | * | ||
168 | * RETURN: value from strncmp | ||
169 | * | ||
170 | * DESCRIPTION: Compare two ACPI names. Names that are prefixed with an | ||
171 | * underscore are forced to be alphabetically first. | ||
172 | * | ||
173 | ******************************************************************************/ | ||
174 | |||
175 | int | ||
176 | acpi_ns_compare_names ( | ||
177 | char *name1, | ||
178 | char *name2) | ||
179 | { | ||
180 | char reversed_name1[ACPI_NAME_SIZE]; | ||
181 | char reversed_name2[ACPI_NAME_SIZE]; | ||
182 | u32 i; | ||
183 | u32 j; | ||
184 | |||
185 | |||
186 | /* | ||
187 | * Replace all instances of "underscore" with a value that is smaller so | ||
188 | * that all names that are prefixed with underscore(s) are alphabetically | ||
189 | * first. | ||
190 | * | ||
191 | * Reverse the name bytewise so we can just do a 32-bit compare instead | ||
192 | * of a strncmp. | ||
193 | */ | ||
194 | for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) { | ||
195 | reversed_name1[j] = name1[i]; | ||
196 | if (name1[i] == '_') { | ||
197 | reversed_name1[j] = '*'; | ||
198 | } | ||
199 | |||
200 | reversed_name2[j] = name2[i]; | ||
201 | if (name2[i] == '_') { | ||
202 | reversed_name2[j] = '*'; | ||
203 | } | ||
204 | } | ||
205 | |||
206 | return (*(int *) reversed_name1 - *(int *) reversed_name2); | ||
207 | } | ||
208 | #endif | ||
209 | |||
210 | |||
211 | /******************************************************************************* | 165 | /******************************************************************************* |
212 | * | 166 | * |
213 | * FUNCTION: acpi_ns_install_node | 167 | * FUNCTION: acpi_ns_install_node |
@@ -271,7 +225,8 @@ acpi_ns_install_node ( | |||
271 | * alphabetic placement. | 225 | * alphabetic placement. |
272 | */ | 226 | */ |
273 | previous_child_node = NULL; | 227 | previous_child_node = NULL; |
274 | while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node), acpi_ut_get_node_name (node)) < 0) { | 228 | while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node), |
229 | acpi_ut_get_node_name (node)) < 0) { | ||
275 | if (child_node->flags & ANOBJ_END_OF_PEER_LIST) { | 230 | if (child_node->flags & ANOBJ_END_OF_PEER_LIST) { |
276 | /* Last peer; Clear end-of-list flag */ | 231 | /* Last peer; Clear end-of-list flag */ |
277 | 232 | ||
@@ -429,7 +384,8 @@ acpi_ns_delete_children ( | |||
429 | /* There should be only one reference remaining on this node */ | 384 | /* There should be only one reference remaining on this node */ |
430 | 385 | ||
431 | if (child_node->reference_count != 1) { | 386 | if (child_node->reference_count != 1) { |
432 | ACPI_REPORT_WARNING (("Existing references (%d) on node being deleted (%p)\n", | 387 | ACPI_REPORT_WARNING (( |
388 | "Existing references (%d) on node being deleted (%p)\n", | ||
433 | child_node->reference_count, child_node)); | 389 | child_node->reference_count, child_node)); |
434 | } | 390 | } |
435 | 391 | ||
@@ -548,7 +504,7 @@ acpi_ns_delete_namespace_subtree ( | |||
548 | * | 504 | * |
549 | ******************************************************************************/ | 505 | ******************************************************************************/ |
550 | 506 | ||
551 | void | 507 | static void |
552 | acpi_ns_remove_reference ( | 508 | acpi_ns_remove_reference ( |
553 | struct acpi_namespace_node *node) | 509 | struct acpi_namespace_node *node) |
554 | { | 510 | { |
@@ -683,3 +639,54 @@ acpi_ns_delete_namespace_by_owner ( | |||
683 | } | 639 | } |
684 | 640 | ||
685 | 641 | ||
642 | #ifdef ACPI_ALPHABETIC_NAMESPACE | ||
643 | /******************************************************************************* | ||
644 | * | ||
645 | * FUNCTION: acpi_ns_compare_names | ||
646 | * | ||
647 | * PARAMETERS: Name1 - First name to compare | ||
648 | * Name2 - Second name to compare | ||
649 | * | ||
650 | * RETURN: value from strncmp | ||
651 | * | ||
652 | * DESCRIPTION: Compare two ACPI names. Names that are prefixed with an | ||
653 | * underscore are forced to be alphabetically first. | ||
654 | * | ||
655 | ******************************************************************************/ | ||
656 | |||
657 | int | ||
658 | acpi_ns_compare_names ( | ||
659 | char *name1, | ||
660 | char *name2) | ||
661 | { | ||
662 | char reversed_name1[ACPI_NAME_SIZE]; | ||
663 | char reversed_name2[ACPI_NAME_SIZE]; | ||
664 | u32 i; | ||
665 | u32 j; | ||
666 | |||
667 | |||
668 | /* | ||
669 | * Replace all instances of "underscore" with a value that is smaller so | ||
670 | * that all names that are prefixed with underscore(s) are alphabetically | ||
671 | * first. | ||
672 | * | ||
673 | * Reverse the name bytewise so we can just do a 32-bit compare instead | ||
674 | * of a strncmp. | ||
675 | */ | ||
676 | for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) { | ||
677 | reversed_name1[j] = name1[i]; | ||
678 | if (name1[i] == '_') { | ||
679 | reversed_name1[j] = '*'; | ||
680 | } | ||
681 | |||
682 | reversed_name2[j] = name2[i]; | ||
683 | if (name2[i] == '_') { | ||
684 | reversed_name2[j] = '*'; | ||
685 | } | ||
686 | } | ||
687 | |||
688 | return (*(int *) reversed_name1 - *(int *) reversed_name2); | ||
689 | } | ||
690 | #endif | ||
691 | |||
692 | |||