aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2006-10-02 00:00:00 -0400
committerLen Brown <len.brown@intel.com>2006-03-31 02:19:03 -0500
commit52fc0b026e99b5d5d585095148d997d5634bbc25 (patch)
tree7bf93132cfd3e6957308a84198ee159f7d43cf6f /drivers/acpi/resources
parent46358614ed5b031797522f1020e989c959a8d8a6 (diff)
[ACPI] ACPICA 20060210
Removed a couple of extraneous ACPI_ERROR messages that appeared during normal execution. These became apparent after the conversion from ACPI_DEBUG_PRINT. Fixed a problem where the CreateField operator could hang if the BitIndex or NumBits parameter referred to a named object. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5359 Fixed a problem where a DeRefOf operation on a buffer object incorrectly failed with an exception. This also fixes a couple of related RefOf and DeRefOf issues. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5360 http://bugzilla.kernel.org/show_bug.cgi?id=5387 http://bugzilla.kernel.org/show_bug.cgi?id=5392 Fixed a problem where the AE_BUFFER_LIMIT exception was returned instead of AE_STRING_LIMIT on an out-of-bounds Index() operation. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5480 Implemented a memory cleanup at the end of the execution of each iteration of an AML While() loop, preventing the accumulation of outstanding objects. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5427 Eliminated a chunk of duplicate code in the object resolution code. From Valery Podrezov. http://bugzilla.kernel.org/show_bug.cgi?id=5336 Fixed several warnings during the 64-bit code generation. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/resources')
-rw-r--r--drivers/acpi/resources/rscalc.c16
-rw-r--r--drivers/acpi/resources/rslist.c3
-rw-r--r--drivers/acpi/resources/rsmisc.c6
-rw-r--r--drivers/acpi/resources/rsutils.c46
-rw-r--r--drivers/acpi/resources/rsxface.c2
5 files changed, 48 insertions, 25 deletions
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c
index 7d6481d9fbec..223bdc493269 100644
--- a/drivers/acpi/resources/rscalc.c
+++ b/drivers/acpi/resources/rscalc.c
@@ -78,6 +78,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field)
78 ACPI_FUNCTION_ENTRY(); 78 ACPI_FUNCTION_ENTRY();
79 79
80 for (bits_set = 0; bit_field; bits_set++) { 80 for (bits_set = 0; bit_field; bits_set++) {
81
81 /* Zero the least significant bit that is set */ 82 /* Zero the least significant bit that is set */
82 83
83 bit_field &= (bit_field - 1); 84 bit_field &= (bit_field - 1);
@@ -154,6 +155,7 @@ acpi_rs_stream_option_length(u32 resource_length,
154 * length, minus one byte for the resource_source_index itself. 155 * length, minus one byte for the resource_source_index itself.
155 */ 156 */
156 if (resource_length > minimum_aml_resource_length) { 157 if (resource_length > minimum_aml_resource_length) {
158
157 /* Compute the length of the optional string */ 159 /* Compute the length of the optional string */
158 160
159 string_length = 161 string_length =
@@ -162,7 +164,7 @@ acpi_rs_stream_option_length(u32 resource_length,
162 164
163 /* Round up length to 32 bits for internal structure alignment */ 165 /* Round up length to 32 bits for internal structure alignment */
164 166
165 return (ACPI_ROUND_UP_to_32_bITS(string_length)); 167 return ((u32) ACPI_ROUND_UP_to_32_bITS(string_length));
166} 168}
167 169
168/******************************************************************************* 170/*******************************************************************************
@@ -191,6 +193,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
191 /* Traverse entire list of internal resource descriptors */ 193 /* Traverse entire list of internal resource descriptors */
192 194
193 while (resource) { 195 while (resource) {
196
194 /* Validate the descriptor type */ 197 /* Validate the descriptor type */
195 198
196 if (resource->type > ACPI_RESOURCE_TYPE_MAX) { 199 if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
@@ -214,6 +217,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
214 * is a Large Resource data type. 217 * is a Large Resource data type.
215 */ 218 */
216 if (resource->data.vendor.byte_length > 7) { 219 if (resource->data.vendor.byte_length > 7) {
220
217 /* Base size of a Large resource descriptor */ 221 /* Base size of a Large resource descriptor */
218 222
219 total_size = 223 total_size =
@@ -346,6 +350,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
346 /* Walk the list of AML resource descriptors */ 350 /* Walk the list of AML resource descriptors */
347 351
348 while (aml_buffer < end_aml) { 352 while (aml_buffer < end_aml) {
353
349 /* Validate the Resource Type and Resource Length */ 354 /* Validate the Resource Type and Resource Length */
350 355
351 status = acpi_ut_validate_resource(aml_buffer, &resource_index); 356 status = acpi_ut_validate_resource(aml_buffer, &resource_index);
@@ -390,7 +395,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
390 * Vendor Resource: 395 * Vendor Resource:
391 * Ensure a 32-bit boundary for the structure 396 * Ensure a 32-bit boundary for the structure
392 */ 397 */
393 extra_struct_bytes = 398 extra_struct_bytes = (u32)
394 ACPI_ROUND_UP_to_32_bITS(resource_length) - 399 ACPI_ROUND_UP_to_32_bITS(resource_length) -
395 resource_length; 400 resource_length;
396 break; 401 break;
@@ -407,7 +412,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
407 * Vendor Resource: 412 * Vendor Resource:
408 * Add vendor data and ensure a 32-bit boundary for the structure 413 * Add vendor data and ensure a 32-bit boundary for the structure
409 */ 414 */
410 extra_struct_bytes = 415 extra_struct_bytes = (u32)
411 ACPI_ROUND_UP_to_32_bITS(resource_length) - 416 ACPI_ROUND_UP_to_32_bITS(resource_length) -
412 resource_length; 417 resource_length;
413 break; 418 break;
@@ -431,7 +436,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
431 */ 436 */
432 buffer++; 437 buffer++;
433 438
434 extra_struct_bytes = 439 extra_struct_bytes = (u32)
435 /* 440 /*
436 * Add 4 bytes for each additional interrupt. Note: at 441 * Add 4 bytes for each additional interrupt. Note: at
437 * least one interrupt is required and is included in 442 * least one interrupt is required and is included in
@@ -450,7 +455,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
450 * Add the size of any optional data (resource_source) 455 * Add the size of any optional data (resource_source)
451 * Ensure a 64-bit boundary for the structure 456 * Ensure a 64-bit boundary for the structure
452 */ 457 */
453 extra_struct_bytes = 458 extra_struct_bytes = (u32)
454 ACPI_ROUND_UP_to_64_bITS 459 ACPI_ROUND_UP_to_64_bITS
455 (acpi_rs_stream_option_length 460 (acpi_rs_stream_option_length
456 (resource_length, minimum_aml_resource_length)); 461 (resource_length, minimum_aml_resource_length));
@@ -525,6 +530,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
525 top_object_list = package_object->package.elements; 530 top_object_list = package_object->package.elements;
526 531
527 for (index = 0; index < number_of_elements; index++) { 532 for (index = 0; index < number_of_elements; index++) {
533
528 /* Dereference the sub-package */ 534 /* Dereference the sub-package */
529 535
530 package_element = *top_object_list; 536 package_element = *top_object_list;
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c
index 1434e786477e..c27dca64d5d0 100644
--- a/drivers/acpi/resources/rslist.c
+++ b/drivers/acpi/resources/rslist.c
@@ -77,6 +77,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer)
77 /* Loop until end-of-buffer or an end_tag is found */ 77 /* Loop until end-of-buffer or an end_tag is found */
78 78
79 while (aml < end_aml) { 79 while (aml < end_aml) {
80
80 /* Validate the Resource Type and Resource Length */ 81 /* Validate the Resource Type and Resource Length */
81 82
82 status = acpi_ut_validate_resource(aml, &resource_index); 83 status = acpi_ut_validate_resource(aml, &resource_index);
@@ -155,6 +156,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
155 /* Walk the resource descriptor list, convert each descriptor */ 156 /* Walk the resource descriptor list, convert each descriptor */
156 157
157 while (aml < end_aml) { 158 while (aml < end_aml) {
159
158 /* Validate the (internal) Resource Type */ 160 /* Validate the (internal) Resource Type */
159 161
160 if (resource->type > ACPI_RESOURCE_TYPE_MAX) { 162 if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
@@ -191,6 +193,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
191 /* Check for end-of-list, normal exit */ 193 /* Check for end-of-list, normal exit */
192 194
193 if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { 195 if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) {
196
194 /* An End Tag indicates the end of the input Resource Template */ 197 /* An End Tag indicates the end of the input Resource Template */
195 198
196 return_ACPI_STATUS(AE_OK); 199 return_ACPI_STATUS(AE_OK);
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c
index ed866cf1c6d2..095730196a8a 100644
--- a/drivers/acpi/resources/rsmisc.c
+++ b/drivers/acpi/resources/rsmisc.c
@@ -84,6 +84,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
84 ACPI_FUNCTION_TRACE("rs_get_resource"); 84 ACPI_FUNCTION_TRACE("rs_get_resource");
85 85
86 if (((acpi_native_uint) resource) & 0x3) { 86 if (((acpi_native_uint) resource) & 0x3) {
87
87 /* Each internal resource struct is expected to be 32-bit aligned */ 88 /* Each internal resource struct is expected to be 32-bit aligned */
88 89
89 ACPI_WARNING((AE_INFO, 90 ACPI_WARNING((AE_INFO,
@@ -295,9 +296,11 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
295 296
296 exit: 297 exit:
297 if (!flags_mode) { 298 if (!flags_mode) {
299
298 /* Round the resource struct length up to the next 32-bit boundary */ 300 /* Round the resource struct length up to the next 32-bit boundary */
299 301
300 resource->length = ACPI_ROUND_UP_to_32_bITS(resource->length); 302 resource->length =
303 (u32) ACPI_ROUND_UP_to_32_bITS(resource->length);
301 } 304 }
302 return_ACPI_STATUS(AE_OK); 305 return_ACPI_STATUS(AE_OK);
303} 306}
@@ -535,6 +538,7 @@ if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) {
535 538
536resource->data.extended_irq.interrupt_count = temp8; 539resource->data.extended_irq.interrupt_count = temp8;
537if (temp8 < 1) { 540if (temp8 < 1) {
541
538 /* Must have at least one IRQ */ 542 /* Must have at least one IRQ */
539 543
540 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); 544 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c
index 25b5aedd6612..c5f7014929b4 100644
--- a/drivers/acpi/resources/rsutils.c
+++ b/drivers/acpi/resources/rsutils.c
@@ -205,6 +205,7 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
205 /* Length is stored differently for large and small descriptors */ 205 /* Length is stored differently for large and small descriptors */
206 206
207 if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { 207 if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
208
208 /* Large descriptor -- bytes 1-2 contain the 16-bit length */ 209 /* Large descriptor -- bytes 1-2 contain the 16-bit length */
209 210
210 ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, 211 ACPI_MOVE_16_TO_16(&aml->large_header.resource_length,
@@ -328,6 +329,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
328 * we add 1 to the minimum length. 329 * we add 1 to the minimum length.
329 */ 330 */
330 if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { 331 if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) {
332
331 /* Get the resource_source_index */ 333 /* Get the resource_source_index */
332 334
333 resource_source->index = aml_resource_source[0]; 335 resource_source->index = aml_resource_source[0];
@@ -351,16 +353,20 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
351 * Zero the entire area of the buffer. 353 * Zero the entire area of the buffer.
352 */ 354 */
353 total_length = 355 total_length =
356 (u32)
354 ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN 357 ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN
355 ((char *)&aml_resource_source[1]) + 358 (ACPI_CAST_PTR
356 1); 359 (char,
360 &aml_resource_source[1])) + 1);
361
357 ACPI_MEMSET(resource_source->string_ptr, 0, total_length); 362 ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
358 363
359 /* Copy the resource_source string to the destination */ 364 /* Copy the resource_source string to the destination */
360 365
361 resource_source->string_length = 366 resource_source->string_length =
362 acpi_rs_strcpy(resource_source->string_ptr, 367 acpi_rs_strcpy(resource_source->string_ptr,
363 (char *)&aml_resource_source[1]); 368 ACPI_CAST_PTR(char,
369 &aml_resource_source[1]));
364 370
365 return ((acpi_rs_length) total_length); 371 return ((acpi_rs_length) total_length);
366 } 372 }
@@ -405,6 +411,7 @@ acpi_rs_set_resource_source(union aml_resource * aml,
405 /* Non-zero string length indicates presence of a resource_source */ 411 /* Non-zero string length indicates presence of a resource_source */
406 412
407 if (resource_source->string_length) { 413 if (resource_source->string_length) {
414
408 /* Point to the end of the AML descriptor */ 415 /* Point to the end of the AML descriptor */
409 416
410 aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); 417 aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length);
@@ -415,7 +422,7 @@ acpi_rs_set_resource_source(union aml_resource * aml,
415 422
416 /* Copy the resource_source string */ 423 /* Copy the resource_source string */
417 424
418 ACPI_STRCPY((char *)&aml_resource_source[1], 425 ACPI_STRCPY(ACPI_CAST_PTR(char, &aml_resource_source[1]),
419 resource_source->string_ptr); 426 resource_source->string_ptr);
420 427
421 /* 428 /*
@@ -435,9 +442,9 @@ acpi_rs_set_resource_source(union aml_resource * aml,
435 * 442 *
436 * FUNCTION: acpi_rs_get_prt_method_data 443 * FUNCTION: acpi_rs_get_prt_method_data
437 * 444 *
438 * PARAMETERS: Handle - a handle to the containing object 445 * PARAMETERS: Handle - Handle to the containing object
439 * ret_buffer - a pointer to a buffer structure for the 446 * ret_buffer - Pointer to a buffer structure for the
440 * results 447 * results
441 * 448 *
442 * RETURN: Status 449 * RETURN: Status
443 * 450 *
@@ -483,9 +490,9 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer)
483 * 490 *
484 * FUNCTION: acpi_rs_get_crs_method_data 491 * FUNCTION: acpi_rs_get_crs_method_data
485 * 492 *
486 * PARAMETERS: Handle - a handle to the containing object 493 * PARAMETERS: Handle - Handle to the containing object
487 * ret_buffer - a pointer to a buffer structure for the 494 * ret_buffer - Pointer to a buffer structure for the
488 * results 495 * results
489 * 496 *
490 * RETURN: Status 497 * RETURN: Status
491 * 498 *
@@ -532,9 +539,9 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
532 * 539 *
533 * FUNCTION: acpi_rs_get_prs_method_data 540 * FUNCTION: acpi_rs_get_prs_method_data
534 * 541 *
535 * PARAMETERS: Handle - a handle to the containing object 542 * PARAMETERS: Handle - Handle to the containing object
536 * ret_buffer - a pointer to a buffer structure for the 543 * ret_buffer - Pointer to a buffer structure for the
537 * results 544 * results
538 * 545 *
539 * RETURN: Status 546 * RETURN: Status
540 * 547 *
@@ -583,10 +590,10 @@ acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
583 * 590 *
584 * FUNCTION: acpi_rs_get_method_data 591 * FUNCTION: acpi_rs_get_method_data
585 * 592 *
586 * PARAMETERS: Handle - a handle to the containing object 593 * PARAMETERS: Handle - Handle to the containing object
587 * Path - Path to method, relative to Handle 594 * Path - Path to method, relative to Handle
588 * ret_buffer - a pointer to a buffer structure for the 595 * ret_buffer - Pointer to a buffer structure for the
589 * results 596 * results
590 * 597 *
591 * RETURN: Status 598 * RETURN: Status
592 * 599 *
@@ -634,9 +641,9 @@ acpi_rs_get_method_data(acpi_handle handle,
634 * 641 *
635 * FUNCTION: acpi_rs_set_srs_method_data 642 * FUNCTION: acpi_rs_set_srs_method_data
636 * 643 *
637 * PARAMETERS: Handle - a handle to the containing object 644 * PARAMETERS: Handle - Handle to the containing object
638 * in_buffer - a pointer to a buffer structure of the 645 * in_buffer - Pointer to a buffer structure of the
639 * parameter 646 * parameter
640 * 647 *
641 * RETURN: Status 648 * RETURN: Status
642 * 649 *
@@ -696,6 +703,7 @@ acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer)
696 703
697 status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info); 704 status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info);
698 if (ACPI_SUCCESS(status)) { 705 if (ACPI_SUCCESS(status)) {
706
699 /* Delete any return object (especially if implicit_return is enabled) */ 707 /* Delete any return object (especially if implicit_return is enabled) */
700 708
701 if (info.return_object) { 709 if (info.return_object) {
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c
index 88b67077aeeb..2e1bc71acd94 100644
--- a/drivers/acpi/resources/rsxface.c
+++ b/drivers/acpi/resources/rsxface.c
@@ -279,6 +279,7 @@ acpi_walk_resources(acpi_handle device_handle,
279 /* Walk the resource list until the end_tag is found (or buffer end) */ 279 /* Walk the resource list until the end_tag is found (or buffer end) */
280 280
281 while (resource < resource_end) { 281 while (resource < resource_end) {
282
282 /* Sanity check the resource */ 283 /* Sanity check the resource */
283 284
284 if (resource->type > ACPI_RESOURCE_TYPE_MAX) { 285 if (resource->type > ACPI_RESOURCE_TYPE_MAX) {
@@ -291,6 +292,7 @@ acpi_walk_resources(acpi_handle device_handle,
291 status = user_function(resource, context); 292 status = user_function(resource, context);
292 if (ACPI_FAILURE(status)) { 293 if (ACPI_FAILURE(status)) {
293 if (status == AE_CTRL_TERMINATE) { 294 if (status == AE_CTRL_TERMINATE) {
295
294 /* This is an OK termination by the user function */ 296 /* This is an OK termination by the user function */
295 297
296 status = AE_OK; 298 status = AE_OK;