aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rscalc.c
diff options
context:
space:
mode:
authorRobert Moore <robert.moore@intel.com>2005-04-18 22:49:35 -0400
committerLen Brown <len.brown@intel.com>2005-07-12 00:08:52 -0400
commit44f6c01242da4e162f28d8e1216a8c7a91174605 (patch)
tree53f724764f1bd9036dfb049a643d198125cc9edc /drivers/acpi/resources/rscalc.c
parentebb6e1a6122fd6b7c96470cfd4ce0f04150e5084 (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/resources/rscalc.c')
-rw-r--r--drivers/acpi/resources/rscalc.c144
1 files changed, 67 insertions, 77 deletions
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c
index 8a5f0a52371d..98176f2fcb5d 100644
--- a/drivers/acpi/resources/rscalc.c
+++ b/drivers/acpi/resources/rscalc.c
@@ -81,9 +81,8 @@ acpi_rs_get_byte_stream_length (
81 81
82 82
83 while (!done) { 83 while (!done) {
84 /* 84 /* Init the variable that will hold the size to add to the total. */
85 * Init the variable that will hold the size to add to the total. 85
86 */
87 segment_size = 0; 86 segment_size = 0;
88 87
89 switch (linked_list->id) { 88 switch (linked_list->id) {
@@ -196,7 +195,8 @@ acpi_rs_get_byte_stream_length (
196 segment_size = 16; 195 segment_size = 16;
197 196
198 if (linked_list->data.address16.resource_source.string_ptr) { 197 if (linked_list->data.address16.resource_source.string_ptr) {
199 segment_size += linked_list->data.address16.resource_source.string_length; 198 segment_size +=
199 linked_list->data.address16.resource_source.string_length;
200 segment_size++; 200 segment_size++;
201 } 201 }
202 break; 202 break;
@@ -212,7 +212,8 @@ acpi_rs_get_byte_stream_length (
212 segment_size = 26; 212 segment_size = 26;
213 213
214 if (linked_list->data.address32.resource_source.string_ptr) { 214 if (linked_list->data.address32.resource_source.string_ptr) {
215 segment_size += linked_list->data.address32.resource_source.string_length; 215 segment_size +=
216 linked_list->data.address32.resource_source.string_length;
216 segment_size++; 217 segment_size++;
217 } 218 }
218 break; 219 break;
@@ -227,7 +228,8 @@ acpi_rs_get_byte_stream_length (
227 segment_size = 46; 228 segment_size = 46;
228 229
229 if (linked_list->data.address64.resource_source.string_ptr) { 230 if (linked_list->data.address64.resource_source.string_ptr) {
230 segment_size += linked_list->data.address64.resource_source.string_length; 231 segment_size +=
232 linked_list->data.address64.resource_source.string_length;
231 segment_size++; 233 segment_size++;
232 } 234 }
233 break; 235 break;
@@ -241,38 +243,36 @@ acpi_rs_get_byte_stream_length (
241 * Index + the length of the null terminated string 243 * Index + the length of the null terminated string
242 * Resource Source + 1 for the null. 244 * Resource Source + 1 for the null.
243 */ 245 */
244 segment_size = 9 + 246 segment_size = 9 + (((acpi_size)
245 (((acpi_size) linked_list->data.extended_irq.number_of_interrupts - 1) * 4); 247 linked_list->data.extended_irq.number_of_interrupts - 1) * 4);
246 248
247 if (linked_list->data.extended_irq.resource_source.string_ptr) { 249 if (linked_list->data.extended_irq.resource_source.string_ptr) {
248 segment_size += linked_list->data.extended_irq.resource_source.string_length; 250 segment_size +=
251 linked_list->data.extended_irq.resource_source.string_length;
249 segment_size++; 252 segment_size++;
250 } 253 }
251 break; 254 break;
252 255
253 default: 256 default:
254 /* 257
255 * If we get here, everything is out of sync, exit with error 258 /* If we get here, everything is out of sync, exit with error */
256 */ 259
257 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); 260 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
258 261
259 } /* switch (linked_list->Id) */ 262 } /* switch (linked_list->Id) */
260 263
261 /* 264 /* Update the total */
262 * Update the total 265
263 */
264 byte_stream_size_needed += segment_size; 266 byte_stream_size_needed += segment_size;
265 267
266 /* 268 /* Point to the next object */
267 * Point to the next object 269
268 */
269 linked_list = ACPI_PTR_ADD (struct acpi_resource, 270 linked_list = ACPI_PTR_ADD (struct acpi_resource,
270 linked_list, linked_list->length); 271 linked_list, linked_list->length);
271 } 272 }
272 273
273 /* 274 /* This is the data the caller needs */
274 * This is the data the caller needs 275
275 */
276 *size_needed = byte_stream_size_needed; 276 *size_needed = byte_stream_size_needed;
277 return_ACPI_STATUS (AE_OK); 277 return_ACPI_STATUS (AE_OK);
278} 278}
@@ -320,9 +320,8 @@ acpi_rs_get_list_length (
320 320
321 321
322 while (bytes_parsed < byte_stream_buffer_length) { 322 while (bytes_parsed < byte_stream_buffer_length) {
323 /* 323 /* The next byte in the stream is the resource type */
324 * The next byte in the stream is the resource type 324
325 */
326 resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); 325 resource_type = acpi_rs_get_resource_type (*byte_stream_buffer);
327 326
328 switch (resource_type) { 327 switch (resource_type) {
@@ -346,9 +345,8 @@ acpi_rs_get_list_length (
346 ACPI_MOVE_16_TO_16 (&temp16, buffer); 345 ACPI_MOVE_16_TO_16 (&temp16, buffer);
347 bytes_consumed = temp16 + 3; 346 bytes_consumed = temp16 + 3;
348 347
349 /* 348 /* Ensure a 32-bit boundary for the structure */
350 * Ensure a 32-bit boundary for the structure 349
351 */
352 temp16 = (u16) ACPI_ROUND_UP_to_32_bITS (temp16); 350 temp16 = (u16) ACPI_ROUND_UP_to_32_bITS (temp16);
353 351
354 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + 352 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) +
@@ -416,9 +414,8 @@ acpi_rs_get_list_length (
416 temp8 = 0; 414 temp8 = 0;
417 } 415 }
418 416
419 /* 417 /* Ensure a 64-bit boundary for the structure */
420 * Ensure a 64-bit boundary for the structure 418
421 */
422 temp8 = (u8) ACPI_ROUND_UP_to_64_bITS (temp8); 419 temp8 = (u8) ACPI_ROUND_UP_to_64_bITS (temp8);
423 420
424 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64) + 421 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64) +
@@ -452,9 +449,8 @@ acpi_rs_get_list_length (
452 temp8 = 0; 449 temp8 = 0;
453 } 450 }
454 451
455 /* 452 /* Ensure a 32-bit boundary for the structure */
456 * Ensure a 32-bit boundary for the structure 453
457 */
458 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); 454 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
459 455
460 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32) + 456 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32) +
@@ -488,9 +484,8 @@ acpi_rs_get_list_length (
488 temp8 = 0; 484 temp8 = 0;
489 } 485 }
490 486
491 /* 487 /* Ensure a 32-bit boundary for the structure */
492 * Ensure a 32-bit boundary for the structure 488
493 */
494 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); 489 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
495 490
496 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16) + 491 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16) +
@@ -537,9 +532,8 @@ acpi_rs_get_list_length (
537 temp8 = 0; 532 temp8 = 0;
538 } 533 }
539 534
540 /* 535 /* Ensure a 32-bit boundary for the structure */
541 * Ensure a 32-bit boundary for the structure 536
542 */
543 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); 537 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
544 538
545 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq) + 539 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq) +
@@ -567,9 +561,8 @@ acpi_rs_get_list_length (
567 561
568 ++buffer; 562 ++buffer;
569 563
570 /* 564 /* Look at the number of bits set */
571 * Look at the number of bits set 565
572 */
573 ACPI_MOVE_16_TO_16 (&temp16, buffer); 566 ACPI_MOVE_16_TO_16 (&temp16, buffer);
574 567
575 for (index = 0; index < 16; index++) { 568 for (index = 0; index < 16; index++) {
@@ -596,9 +589,8 @@ acpi_rs_get_list_length (
596 589
597 ++buffer; 590 ++buffer;
598 591
599 /* 592 /* Look at the number of bits set */
600 * Look at the number of bits set 593
601 */
602 temp8 = *buffer; 594 temp8 = *buffer;
603 595
604 for(index = 0; index < 8; index++) { 596 for(index = 0; index < 8; index++) {
@@ -670,9 +662,8 @@ acpi_rs_get_list_length (
670 temp8 = (u8) (temp8 & 0x7); 662 temp8 = (u8) (temp8 & 0x7);
671 bytes_consumed = temp8 + 1; 663 bytes_consumed = temp8 + 1;
672 664
673 /* 665 /* Ensure a 32-bit boundary for the structure */
674 * Ensure a 32-bit boundary for the structure 666
675 */
676 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); 667 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
677 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + 668 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) +
678 (temp8 * sizeof (u8)); 669 (temp8 * sizeof (u8));
@@ -697,21 +688,18 @@ acpi_rs_get_list_length (
697 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); 688 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
698 } 689 }
699 690
700 /* 691 /* Update the return value and counter */
701 * Update the return value and counter 692
702 */
703 buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE (structure_size); 693 buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE (structure_size);
704 bytes_parsed += bytes_consumed; 694 bytes_parsed += bytes_consumed;
705 695
706 /* 696 /* Set the byte stream to point to the next resource */
707 * Set the byte stream to point to the next resource 697
708 */
709 byte_stream_buffer += bytes_consumed; 698 byte_stream_buffer += bytes_consumed;
710 } 699 }
711 700
712 /* 701 /* This is the data the caller needs */
713 * This is the data the caller needs 702
714 */
715 *size_needed = buffer_size; 703 *size_needed = buffer_size;
716 return_ACPI_STATUS (AE_OK); 704 return_ACPI_STATUS (AE_OK);
717} 705}
@@ -767,9 +755,8 @@ acpi_rs_get_pci_routing_table_length (
767 top_object_list = package_object->package.elements; 755 top_object_list = package_object->package.elements;
768 756
769 for (index = 0; index < number_of_elements; index++) { 757 for (index = 0; index < number_of_elements; index++) {
770 /* 758 /* Dereference the sub-package */
771 * Dereference the sub-package 759
772 */
773 package_element = *top_object_list; 760 package_element = *top_object_list;
774 761
775 /* 762 /*
@@ -778,37 +765,40 @@ acpi_rs_get_pci_routing_table_length (
778 */ 765 */
779 sub_object_list = package_element->package.elements; 766 sub_object_list = package_element->package.elements;
780 767
781 /* 768 /* Scan the irq_table_elements for the Source Name String */
782 * Scan the irq_table_elements for the Source Name String 769
783 */
784 name_found = FALSE; 770 name_found = FALSE;
785 771
786 for (table_index = 0; table_index < 4 && !name_found; table_index++) { 772 for (table_index = 0; table_index < 4 && !name_found; table_index++) {
787 if ((ACPI_TYPE_STRING == ACPI_GET_OBJECT_TYPE (*sub_object_list)) || 773 if ((ACPI_TYPE_STRING ==
788 ((ACPI_TYPE_LOCAL_REFERENCE == ACPI_GET_OBJECT_TYPE (*sub_object_list)) && 774 ACPI_GET_OBJECT_TYPE (*sub_object_list)) ||
789 ((*sub_object_list)->reference.opcode == AML_INT_NAMEPATH_OP))) { 775
776 ((ACPI_TYPE_LOCAL_REFERENCE ==
777 ACPI_GET_OBJECT_TYPE (*sub_object_list)) &&
778
779 ((*sub_object_list)->reference.opcode ==
780 AML_INT_NAMEPATH_OP))) {
790 name_found = TRUE; 781 name_found = TRUE;
791 } 782 }
792 else { 783 else {
793 /* 784 /* Look at the next element */
794 * Look at the next element 785
795 */
796 sub_object_list++; 786 sub_object_list++;
797 } 787 }
798 } 788 }
799 789
800 temp_size_needed += (sizeof (struct acpi_pci_routing_table) - 4); 790 temp_size_needed += (sizeof (struct acpi_pci_routing_table) - 4);
801 791
802 /* 792 /* Was a String type found? */
803 * Was a String type found? 793
804 */
805 if (name_found) { 794 if (name_found) {
806 if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) { 795 if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) {
807 /* 796 /*
808 * The length String.Length field does not include the 797 * The length String.Length field does not include the
809 * terminating NULL, add 1 798 * terminating NULL, add 1
810 */ 799 */
811 temp_size_needed += ((acpi_size) (*sub_object_list)->string.length + 1); 800 temp_size_needed += ((acpi_size)
801 (*sub_object_list)->string.length + 1);
812 } 802 }
813 else { 803 else {
814 temp_size_needed += acpi_ns_get_pathname_length ( 804 temp_size_needed += acpi_ns_get_pathname_length (
@@ -827,14 +817,14 @@ acpi_rs_get_pci_routing_table_length (
827 817
828 temp_size_needed = ACPI_ROUND_UP_to_64_bITS (temp_size_needed); 818 temp_size_needed = ACPI_ROUND_UP_to_64_bITS (temp_size_needed);
829 819
830 /* 820 /* Point to the next union acpi_operand_object */
831 * Point to the next union acpi_operand_object 821
832 */
833 top_object_list++; 822 top_object_list++;
834 } 823 }
835 824
836 /* 825 /*
837 * Adding an extra element to the end of the list, essentially a NULL terminator 826 * Adding an extra element to the end of the list, essentially a
827 * NULL terminator
838 */ 828 */
839 *buffer_size_needed = temp_size_needed + sizeof (struct acpi_pci_routing_table); 829 *buffer_size_needed = temp_size_needed + sizeof (struct acpi_pci_routing_table);
840 return_ACPI_STATUS (AE_OK); 830 return_ACPI_STATUS (AE_OK);