aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities')
-rw-r--r--drivers/acpi/utilities/utalloc.c5
-rw-r--r--drivers/acpi/utilities/utcache.c2
-rw-r--r--drivers/acpi/utilities/utcopy.c1
-rw-r--r--drivers/acpi/utilities/utdebug.c4
-rw-r--r--drivers/acpi/utilities/utdelete.c3
-rw-r--r--drivers/acpi/utilities/uteval.c4
-rw-r--r--drivers/acpi/utilities/utglobal.c2
-rw-r--r--drivers/acpi/utilities/utmisc.c31
-rw-r--r--drivers/acpi/utilities/utobject.c2
-rw-r--r--drivers/acpi/utilities/utresrc.c4
-rw-r--r--drivers/acpi/utilities/utstate.c2
11 files changed, 35 insertions, 25 deletions
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index 03b0044974c2..34de3791d4c2 100644
--- a/drivers/acpi/utilities/utalloc.c
+++ b/drivers/acpi/utilities/utalloc.c
@@ -308,6 +308,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
308 308
309 allocation = acpi_os_allocate(size); 309 allocation = acpi_os_allocate(size);
310 if (!allocation) { 310 if (!allocation) {
311
311 /* Report allocation error */ 312 /* Report allocation error */
312 313
313 ACPI_ERROR((module, line, 314 ACPI_ERROR((module, line,
@@ -351,6 +352,7 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
351 352
352 allocation = acpi_os_allocate(size); 353 allocation = acpi_os_allocate(size);
353 if (!allocation) { 354 if (!allocation) {
355
354 /* Report allocation error */ 356 /* Report allocation error */
355 357
356 ACPI_ERROR((module, line, 358 ACPI_ERROR((module, line,
@@ -477,6 +479,7 @@ void *acpi_ut_callocate_and_track(acpi_size size,
477 acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header), 479 acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header),
478 component, module, line); 480 component, module, line);
479 if (!allocation) { 481 if (!allocation) {
482
480 /* Report allocation error */ 483 /* Report allocation error */
481 484
482 ACPI_ERROR((module, line, 485 ACPI_ERROR((module, line,
@@ -681,6 +684,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
681 684
682 mem_list = acpi_gbl_global_list; 685 mem_list = acpi_gbl_global_list;
683 if (NULL == mem_list->list_head) { 686 if (NULL == mem_list->list_head) {
687
684 /* No allocations! */ 688 /* No allocations! */
685 689
686 ACPI_ERROR((module, line, 690 ACPI_ERROR((module, line,
@@ -807,6 +811,7 @@ void acpi_ut_dump_allocations(u32 component, char *module)
807 if ((element->component & component) && 811 if ((element->component & component) &&
808 ((module == NULL) 812 ((module == NULL)
809 || (0 == ACPI_STRCMP(module, element->module)))) { 813 || (0 == ACPI_STRCMP(module, element->module)))) {
814
810 /* Ignore allocated objects that are in a cache */ 815 /* Ignore allocated objects that are in a cache */
811 816
812 descriptor = 817 descriptor =
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c
index 2177cb1ef2c4..044c890e5b3c 100644
--- a/drivers/acpi/utilities/utcache.c
+++ b/drivers/acpi/utilities/utcache.c
@@ -118,6 +118,7 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache)
118 /* Walk the list of objects in this cache */ 118 /* Walk the list of objects in this cache */
119 119
120 while (cache->list_head) { 120 while (cache->list_head) {
121
121 /* Delete and unlink one cached state object */ 122 /* Delete and unlink one cached state object */
122 123
123 next = *(ACPI_CAST_INDIRECT_PTR(char, 124 next = *(ACPI_CAST_INDIRECT_PTR(char,
@@ -259,6 +260,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
259 /* Check the cache first */ 260 /* Check the cache first */
260 261
261 if (cache->list_head) { 262 if (cache->list_head) {
263
262 /* There is an object available, use it */ 264 /* There is an object available, use it */
263 265
264 object = cache->list_head; 266 object = cache->list_head;
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
index df2d32096b72..47875935c3f4 100644
--- a/drivers/acpi/utilities/utcopy.c
+++ b/drivers/acpi/utilities/utcopy.c
@@ -882,6 +882,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
882 acpi_ut_copy_ielement_to_ielement, 882 acpi_ut_copy_ielement_to_ielement,
883 walk_state); 883 walk_state);
884 if (ACPI_FAILURE(status)) { 884 if (ACPI_FAILURE(status)) {
885
885 /* On failure, delete the destination package object */ 886 /* On failure, delete the destination package object */
886 887
887 acpi_ut_remove_reference(dest_obj); 888 acpi_ut_remove_reference(dest_obj);
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c
index 35f3d581e034..6e92b2a3c0fd 100644
--- a/drivers/acpi/utilities/utdebug.c
+++ b/drivers/acpi/utilities/utdebug.c
@@ -123,12 +123,14 @@ static const char *acpi_ut_trim_function_name(const char *function_name)
123 /* All Function names are longer than 4 chars, check is safe */ 123 /* All Function names are longer than 4 chars, check is safe */
124 124
125 if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { 125 if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) {
126
126 /* This is the case where the original source has not been modified */ 127 /* This is the case where the original source has not been modified */
127 128
128 return (function_name + 4); 129 return (function_name + 4);
129 } 130 }
130 131
131 if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { 132 if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) {
133
132 /* This is the case where the source has been 'linuxized' */ 134 /* This is the case where the source has been 'linuxized' */
133 135
134 return (function_name + 5); 136 return (function_name + 5);
@@ -545,6 +547,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
545 /* Nasty little dump buffer routine! */ 547 /* Nasty little dump buffer routine! */
546 548
547 while (i < count) { 549 while (i < count) {
550
548 /* Print current offset */ 551 /* Print current offset */
549 552
550 acpi_os_printf("%6.4X: ", (u32) i); 553 acpi_os_printf("%6.4X: ", (u32) i);
@@ -553,6 +556,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id)
553 556
554 for (j = 0; j < 16;) { 557 for (j = 0; j < 16;) {
555 if (i + j >= count) { 558 if (i + j >= count) {
559
556 /* Dump fill spaces */ 560 /* Dump fill spaces */
557 561
558 acpi_os_printf("%*s", ((display * 2) + 1), " "); 562 acpi_os_printf("%*s", ((display * 2) + 1), " ");
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
index 1db9695b0029..dbae72121cea 100644
--- a/drivers/acpi/utilities/utdelete.c
+++ b/drivers/acpi/utilities/utdelete.c
@@ -96,6 +96,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
96 /* Free the actual string buffer */ 96 /* Free the actual string buffer */
97 97
98 if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { 98 if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) {
99
99 /* But only if it is NOT a pointer into an ACPI table */ 100 /* But only if it is NOT a pointer into an ACPI table */
100 101
101 obj_pointer = object->string.pointer; 102 obj_pointer = object->string.pointer;
@@ -111,6 +112,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
111 /* Free the actual buffer */ 112 /* Free the actual buffer */
112 113
113 if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { 114 if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) {
115
114 /* But only if it is NOT a pointer into an ACPI table */ 116 /* But only if it is NOT a pointer into an ACPI table */
115 117
116 obj_pointer = object->buffer.pointer; 118 obj_pointer = object->buffer.pointer;
@@ -415,6 +417,7 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
415 ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object); 417 ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object);
416 418
417 while (object) { 419 while (object) {
420
418 /* Make sure that this isn't a namespace handle */ 421 /* Make sure that this isn't a namespace handle */
419 422
420 if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { 423 if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) {
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c
index 106cc97cb4af..952ffdea93aa 100644
--- a/drivers/acpi/utilities/uteval.c
+++ b/drivers/acpi/utilities/uteval.c
@@ -98,6 +98,7 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
98 ACPI_CAST_PTR(char, 98 ACPI_CAST_PTR(char,
99 acpi_gbl_valid_osi_strings[i]))) 99 acpi_gbl_valid_osi_strings[i])))
100 { 100 {
101
101 /* This string is supported */ 102 /* This string is supported */
102 103
103 return_desc->integer.value = 0xFFFFFFFF; 104 return_desc->integer.value = 0xFFFFFFFF;
@@ -343,6 +344,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
343 } 344 }
344 345
345 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 346 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
347
346 /* Convert the Numeric HID to string */ 348 /* Convert the Numeric HID to string */
347 349
348 acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, 350 acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value,
@@ -479,6 +481,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node,
479 /* The _CID object can be either a single CID or a package (list) of CIDs */ 481 /* The _CID object can be either a single CID or a package (list) of CIDs */
480 482
481 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { 483 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
484
482 /* Translate each package element */ 485 /* Translate each package element */
483 486
484 for (i = 0; i < count; i++) { 487 for (i = 0; i < count; i++) {
@@ -543,6 +546,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
543 } 546 }
544 547
545 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 548 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
549
546 /* Convert the Numeric UID to string */ 550 /* Convert the Numeric UID to string */
547 551
548 acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, 552 acpi_ex_unsigned_integer_to_string(obj_desc->integer.value,
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index ffd13383a325..767c5e44a04b 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -119,6 +119,7 @@ const char *acpi_format_exception(acpi_status status)
119 } 119 }
120 120
121 if (!exception) { 121 if (!exception) {
122
122 /* Exception code was not recognized */ 123 /* Exception code was not recognized */
123 124
124 ACPI_ERROR((AE_INFO, 125 ACPI_ERROR((AE_INFO,
@@ -747,6 +748,7 @@ u8 acpi_ut_valid_object_type(acpi_object_type type)
747{ 748{
748 749
749 if (type > ACPI_TYPE_LOCAL_MAX) { 750 if (type > ACPI_TYPE_LOCAL_MAX) {
751
750 /* Note: Assumes all TYPEs are contiguous (external/local) */ 752 /* Note: Assumes all TYPEs are contiguous (external/local) */
751 753
752 return (FALSE); 754 return (FALSE);
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 7364f5f8c9cd..60f36130663c 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -97,6 +97,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
97 97
98 for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { 98 for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) {
99 if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { 99 if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) {
100
100 /* There are no free IDs in this mask */ 101 /* There are no free IDs in this mask */
101 102
102 break; 103 break;
@@ -273,6 +274,7 @@ void acpi_ut_print_string(char *string, u8 max_length)
273 274
274 acpi_os_printf("\""); 275 acpi_os_printf("\"");
275 for (i = 0; string[i] && (i < max_length); i++) { 276 for (i = 0; string[i] && (i < max_length); i++) {
277
276 /* Escape sequences */ 278 /* Escape sequences */
277 279
278 switch (string[i]) { 280 switch (string[i]) {
@@ -601,11 +603,13 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
601 603
602 while (*string) { 604 while (*string) {
603 if (ACPI_IS_DIGIT(*string)) { 605 if (ACPI_IS_DIGIT(*string)) {
606
604 /* Convert ASCII 0-9 to Decimal value */ 607 /* Convert ASCII 0-9 to Decimal value */
605 608
606 this_digit = ((u8) * string) - '0'; 609 this_digit = ((u8) * string) - '0';
607 } else { 610 } else {
608 if (base == 10) { 611 if (base == 10) {
612
609 /* Digit is out of range */ 613 /* Digit is out of range */
610 614
611 goto error_exit; 615 goto error_exit;
@@ -613,6 +617,7 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer)
613 617
614 this_digit = (u8) ACPI_TOUPPER(*string); 618 this_digit = (u8) ACPI_TOUPPER(*string);
615 if (ACPI_IS_XDIGIT((char)this_digit)) { 619 if (ACPI_IS_XDIGIT((char)this_digit)) {
620
616 /* Convert ASCII Hex char to value */ 621 /* Convert ASCII Hex char to value */
617 622
618 this_digit = this_digit - 'A' + 10; 623 this_digit = this_digit - 'A' + 10;
@@ -727,6 +732,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
727 } 732 }
728 733
729 while (state) { 734 while (state) {
735
730 /* Get one element of the package */ 736 /* Get one element of the package */
731 737
732 this_index = state->pkg.index; 738 this_index = state->pkg.index;
@@ -814,31 +820,6 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
814 820
815/******************************************************************************* 821/*******************************************************************************
816 * 822 *
817 * FUNCTION: acpi_ut_generate_checksum
818 *
819 * PARAMETERS: Buffer - Buffer to be scanned
820 * Length - number of bytes to examine
821 *
822 * RETURN: The generated checksum
823 *
824 * DESCRIPTION: Generate a checksum on a raw buffer
825 *
826 ******************************************************************************/
827
828u8 acpi_ut_generate_checksum(u8 * buffer, u32 length)
829{
830 u32 i;
831 signed char sum = 0;
832
833 for (i = 0; i < length; i++) {
834 sum = (signed char)(sum + buffer[i]);
835 }
836
837 return ((u8) (0 - sum));
838}
839
840/*******************************************************************************
841 *
842 * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info 823 * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info
843 * 824 *
844 * PARAMETERS: module_name - Caller's module name (for error output) 825 * PARAMETERS: module_name - Caller's module name (for error output)
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
index 7ee2d1d98071..b1205a58028c 100644
--- a/drivers/acpi/utilities/utobject.c
+++ b/drivers/acpi/utilities/utobject.c
@@ -173,6 +173,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size)
173 /* Create an actual buffer only if size > 0 */ 173 /* Create an actual buffer only if size > 0 */
174 174
175 if (buffer_size > 0) { 175 if (buffer_size > 0) {
176
176 /* Allocate the actual buffer */ 177 /* Allocate the actual buffer */
177 178
178 buffer = ACPI_MEM_CALLOCATE(buffer_size); 179 buffer = ACPI_MEM_CALLOCATE(buffer_size);
@@ -397,6 +398,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
397 length = sizeof(union acpi_object); 398 length = sizeof(union acpi_object);
398 399
399 if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { 400 if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) {
401
400 /* Object is a named object (reference), just return the length */ 402 /* Object is a named object (reference), just return the length */
401 403
402 *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); 404 *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c
index 16461317113f..27158dd0f877 100644
--- a/drivers/acpi/utilities/utresrc.c
+++ b/drivers/acpi/utilities/utresrc.c
@@ -273,6 +273,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index)
273 * Examine the large/small bit in the resource header 273 * Examine the large/small bit in the resource header
274 */ 274 */
275 if (resource_type & ACPI_RESOURCE_NAME_LARGE) { 275 if (resource_type & ACPI_RESOURCE_NAME_LARGE) {
276
276 /* Verify the large resource type (name) against the max */ 277 /* Verify the large resource type (name) against the max */
277 278
278 if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { 279 if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) {
@@ -376,6 +377,7 @@ u8 acpi_ut_get_resource_type(void *aml)
376 * Examine the large/small bit in the resource header 377 * Examine the large/small bit in the resource header
377 */ 378 */
378 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { 379 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
380
379 /* Large Resource Type -- bits 6:0 contain the name */ 381 /* Large Resource Type -- bits 6:0 contain the name */
380 382
381 return (ACPI_GET8(aml)); 383 return (ACPI_GET8(aml));
@@ -411,6 +413,7 @@ u16 acpi_ut_get_resource_length(void *aml)
411 * Examine the large/small bit in the resource header 413 * Examine the large/small bit in the resource header
412 */ 414 */
413 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { 415 if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) {
416
414 /* Large Resource type -- bytes 1-2 contain the 16-bit length */ 417 /* Large Resource type -- bytes 1-2 contain the 16-bit length */
415 418
416 ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1)); 419 ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1));
@@ -515,6 +518,7 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc,
515 /* Walk the resource template, one descriptor per iteration */ 518 /* Walk the resource template, one descriptor per iteration */
516 519
517 while (aml < end_aml) { 520 while (aml < end_aml) {
521
518 /* Validate the Resource Type and Resource Length */ 522 /* Validate the Resource Type and Resource Length */
519 523
520 status = acpi_ut_validate_resource(aml, NULL); 524 status = acpi_ut_validate_resource(aml, NULL);
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c
index 4b134a722907..69f2bfdc26ab 100644
--- a/drivers/acpi/utilities/utstate.c
+++ b/drivers/acpi/utilities/utstate.c
@@ -129,6 +129,7 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
129 129
130 state = *list_head; 130 state = *list_head;
131 if (state) { 131 if (state) {
132
132 /* Update the list head */ 133 /* Update the list head */
133 134
134 *list_head = state->common.next; 135 *list_head = state->common.next;
@@ -158,6 +159,7 @@ union acpi_generic_state *acpi_ut_create_generic_state(void)
158 159
159 state = acpi_os_acquire_object(acpi_gbl_state_cache); 160 state = acpi_os_acquire_object(acpi_gbl_state_cache);
160 if (state) { 161 if (state) {
162
161 /* Initialize */ 163 /* Initialize */
162 memset(state, 0, sizeof(union acpi_generic_state)); 164 memset(state, 0, sizeof(union acpi_generic_state));
163 state->common.data_type = ACPI_DESC_TYPE_STATE; 165 state->common.data_type = ACPI_DESC_TYPE_STATE;