aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rsaddr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/resources/rsaddr.c')
-rw-r--r--drivers/acpi/resources/rsaddr.c480
1 files changed, 206 insertions, 274 deletions
diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c
index 4788c079735d..55d264771c48 100644
--- a/drivers/acpi/resources/rsaddr.c
+++ b/drivers/acpi/resources/rsaddr.c
@@ -77,21 +77,21 @@ acpi_rs_address16_resource (
77 u8 **output_buffer, 77 u8 **output_buffer,
78 acpi_size *structure_size) 78 acpi_size *structure_size)
79{ 79{
80 u8 *buffer = byte_stream_buffer;
81 struct acpi_resource *output_struct = (void *) *output_buffer;
82 u8 *temp_ptr;
83 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16);
84 u32 index; 80 u32 index;
85 u16 temp16; 81 u16 temp16;
86 u8 temp8; 82 u8 temp8;
83 u8 *temp_ptr;
84 u8 *buffer = byte_stream_buffer;
85 struct acpi_resource *output_struct = (void *) *output_buffer;
86 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (
87 struct acpi_resource_address16);
87 88
88 89
89 ACPI_FUNCTION_TRACE ("rs_address16_resource"); 90 ACPI_FUNCTION_TRACE ("rs_address16_resource");
90 91
91 92
92 /* 93 /* Point past the Descriptor to get the number of bytes consumed */
93 * Point past the Descriptor to get the number of bytes consumed 94
94 */
95 buffer += 1; 95 buffer += 1;
96 ACPI_MOVE_16_TO_16 (&temp16, buffer); 96 ACPI_MOVE_16_TO_16 (&temp16, buffer);
97 97
@@ -104,9 +104,8 @@ acpi_rs_address16_resource (
104 *bytes_consumed = temp16 + 3; 104 *bytes_consumed = temp16 + 3;
105 output_struct->id = ACPI_RSTYPE_ADDRESS16; 105 output_struct->id = ACPI_RSTYPE_ADDRESS16;
106 106
107 /* 107 /* Get the Resource Type (Byte3) */
108 * Get the Resource Type (Byte3) 108
109 */
110 buffer += 2; 109 buffer += 2;
111 temp8 = *buffer; 110 temp8 = *buffer;
112 111
@@ -118,9 +117,8 @@ acpi_rs_address16_resource (
118 117
119 output_struct->data.address16.resource_type = temp8; 118 output_struct->data.address16.resource_type = temp8;
120 119
121 /* 120 /* Get the General Flags (Byte4) */
122 * Get the General Flags (Byte4) 121
123 */
124 buffer += 1; 122 buffer += 1;
125 temp8 = *buffer; 123 temp8 = *buffer;
126 124
@@ -140,9 +138,8 @@ acpi_rs_address16_resource (
140 138
141 output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01; 139 output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01;
142 140
143 /* 141 /* Get the Type Specific Flags (Byte5) */
144 * Get the Type Specific Flags (Byte5) 142
145 */
146 buffer += 1; 143 buffer += 1;
147 temp8 = *buffer; 144 temp8 = *buffer;
148 145
@@ -165,39 +162,34 @@ acpi_rs_address16_resource (
165 } 162 }
166 } 163 }
167 164
168 /* 165 /* Get Granularity (Bytes 6-7) */
169 * Get Granularity (Bytes 6-7) 166
170 */
171 buffer += 1; 167 buffer += 1;
172 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer); 168 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer);
173 169
174 /* 170 /* Get min_address_range (Bytes 8-9) */
175 * Get min_address_range (Bytes 8-9) 171
176 */
177 buffer += 2; 172 buffer += 2;
178 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer); 173 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer);
179 174
180 /* 175 /* Get max_address_range (Bytes 10-11) */
181 * Get max_address_range (Bytes 10-11) 176
182 */
183 buffer += 2; 177 buffer += 2;
184 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer); 178 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer);
185 179
186 /* 180 /* Get address_translation_offset (Bytes 12-13) */
187 * Get address_translation_offset (Bytes 12-13) 181
188 */
189 buffer += 2; 182 buffer += 2;
190 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset, buffer); 183 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset,
184 buffer);
185
186 /* Get address_length (Bytes 14-15) */
191 187
192 /*
193 * Get address_length (Bytes 14-15)
194 */
195 buffer += 2; 188 buffer += 2;
196 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer); 189 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer);
197 190
198 /* 191 /* Resource Source Index (if present) */
199 * Resource Source Index (if present) 192
200 */
201 buffer += 2; 193 buffer += 2;
202 194
203 /* 195 /*
@@ -225,7 +217,8 @@ acpi_rs_address16_resource (
225 output_struct->data.address16.resource_source.string_ptr = 217 output_struct->data.address16.resource_source.string_ptr =
226 (char *)((u8 * )output_struct + struct_size); 218 (char *)((u8 * )output_struct + struct_size);
227 219
228 temp_ptr = (u8 *) output_struct->data.address16.resource_source.string_ptr; 220 temp_ptr = (u8 *)
221 output_struct->data.address16.resource_source.string_ptr;
229 222
230 /* Copy the string into the buffer */ 223 /* Copy the string into the buffer */
231 224
@@ -239,9 +232,8 @@ acpi_rs_address16_resource (
239 index += 1; 232 index += 1;
240 } 233 }
241 234
242 /* 235 /* Add the terminating null */
243 * Add the terminating null 236
244 */
245 *temp_ptr = 0x00; 237 *temp_ptr = 0x00;
246 238
247 output_struct->data.address16.resource_source.string_length = index + 1; 239 output_struct->data.address16.resource_source.string_length = index + 1;
@@ -260,14 +252,12 @@ acpi_rs_address16_resource (
260 output_struct->data.address16.resource_source.string_ptr = NULL; 252 output_struct->data.address16.resource_source.string_ptr = NULL;
261 } 253 }
262 254
263 /* 255 /* Set the Length parameter */
264 * Set the Length parameter 256
265 */
266 output_struct->length = (u32) struct_size; 257 output_struct->length = (u32) struct_size;
267 258
268 /* 259 /* Return the final size of the structure */
269 * Return the final size of the structure 260
270 */
271 *structure_size = struct_size; 261 *structure_size = struct_size;
272 return_ACPI_STATUS (AE_OK); 262 return_ACPI_STATUS (AE_OK);
273} 263}
@@ -305,28 +295,24 @@ acpi_rs_address16_stream (
305 ACPI_FUNCTION_TRACE ("rs_address16_stream"); 295 ACPI_FUNCTION_TRACE ("rs_address16_stream");
306 296
307 297
308 /* 298 /* The descriptor field is static */
309 * The descriptor field is static 299
310 */
311 *buffer = 0x88; 300 *buffer = 0x88;
312 buffer += 1; 301 buffer += 1;
313 302
314 /* 303 /* Save a pointer to the Length field - to be filled in later */
315 * Save a pointer to the Length field - to be filled in later 304
316 */
317 length_field = buffer; 305 length_field = buffer;
318 buffer += 2; 306 buffer += 2;
319 307
320 /* 308 /* Set the Resource Type (Memory, Io, bus_number) */
321 * Set the Resource Type (Memory, Io, bus_number) 309
322 */
323 temp8 = (u8) (linked_list->data.address16.resource_type & 0x03); 310 temp8 = (u8) (linked_list->data.address16.resource_type & 0x03);
324 *buffer = temp8; 311 *buffer = temp8;
325 buffer += 1; 312 buffer += 1;
326 313
327 /* 314 /* Set the general flags */
328 * Set the general flags 315
329 */
330 temp8 = (u8) (linked_list->data.address16.producer_consumer & 0x01); 316 temp8 = (u8) (linked_list->data.address16.producer_consumer & 0x01);
331 317
332 temp8 |= (linked_list->data.address16.decode & 0x01) << 1; 318 temp8 |= (linked_list->data.address16.decode & 0x01) << 1;
@@ -336,9 +322,8 @@ acpi_rs_address16_stream (
336 *buffer = temp8; 322 *buffer = temp8;
337 buffer += 1; 323 buffer += 1;
338 324
339 /* 325 /* Set the type specific flags */
340 * Set the type specific flags 326
341 */
342 temp8 = 0; 327 temp8 = 0;
343 328
344 if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) { 329 if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) {
@@ -362,39 +347,34 @@ acpi_rs_address16_stream (
362 *buffer = temp8; 347 *buffer = temp8;
363 buffer += 1; 348 buffer += 1;
364 349
365 /* 350 /* Set the address space granularity */
366 * Set the address space granularity 351
367 */
368 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity); 352 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity);
369 buffer += 2; 353 buffer += 2;
370 354
371 /* 355 /* Set the address range minimum */
372 * Set the address range minimum 356
373 */
374 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range); 357 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range);
375 buffer += 2; 358 buffer += 2;
376 359
377 /* 360 /* Set the address range maximum */
378 * Set the address range maximum 361
379 */
380 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range); 362 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range);
381 buffer += 2; 363 buffer += 2;
382 364
383 /* 365 /* Set the address translation offset */
384 * Set the address translation offset 366
385 */ 367 ACPI_MOVE_32_TO_16 (buffer,
386 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_translation_offset); 368 &linked_list->data.address16.address_translation_offset);
387 buffer += 2; 369 buffer += 2;
388 370
389 /* 371 /* Set the address length */
390 * Set the address length 372
391 */
392 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length); 373 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length);
393 buffer += 2; 374 buffer += 2;
394 375
395 /* 376 /* Resource Source Index and Resource Source are optional */
396 * Resource Source Index and Resource Source are optional 377
397 */
398 if (0 != linked_list->data.address16.resource_source.string_length) { 378 if (0 != linked_list->data.address16.resource_source.string_length) {
399 temp8 = (u8) linked_list->data.address16.resource_source.index; 379 temp8 = (u8) linked_list->data.address16.resource_source.index;
400 380
@@ -403,9 +383,8 @@ acpi_rs_address16_stream (
403 383
404 temp_pointer = (char *) buffer; 384 temp_pointer = (char *) buffer;
405 385
406 /* 386 /* Copy the string */
407 * Copy the string 387
408 */
409 ACPI_STRCPY (temp_pointer, 388 ACPI_STRCPY (temp_pointer,
410 linked_list->data.address16.resource_source.string_ptr); 389 linked_list->data.address16.resource_source.string_ptr);
411 390
@@ -413,12 +392,12 @@ acpi_rs_address16_stream (
413 * Buffer needs to be set to the length of the sting + one for the 392 * Buffer needs to be set to the length of the sting + one for the
414 * terminating null 393 * terminating null
415 */ 394 */
416 buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address16.resource_source.string_ptr) + 1); 395 buffer += (acpi_size)(ACPI_STRLEN (
396 linked_list->data.address16.resource_source.string_ptr) + 1);
417 } 397 }
418 398
419 /* 399 /* Return the number of bytes consumed in this operation */
420 * Return the number of bytes consumed in this operation 400
421 */
422 actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer); 401 actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer);
423 *bytes_consumed = actual_bytes; 402 *bytes_consumed = actual_bytes;
424 403
@@ -475,9 +454,8 @@ acpi_rs_address32_resource (
475 buffer = byte_stream_buffer; 454 buffer = byte_stream_buffer;
476 struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32); 455 struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32);
477 456
478 /* 457 /* Point past the Descriptor to get the number of bytes consumed */
479 * Point past the Descriptor to get the number of bytes consumed 458
480 */
481 buffer += 1; 459 buffer += 1;
482 ACPI_MOVE_16_TO_16 (&temp16, buffer); 460 ACPI_MOVE_16_TO_16 (&temp16, buffer);
483 461
@@ -490,9 +468,8 @@ acpi_rs_address32_resource (
490 *bytes_consumed = temp16 + 3; 468 *bytes_consumed = temp16 + 3;
491 output_struct->id = ACPI_RSTYPE_ADDRESS32; 469 output_struct->id = ACPI_RSTYPE_ADDRESS32;
492 470
493 /* 471 /* Get the Resource Type (Byte3) */
494 * Get the Resource Type (Byte3) 472
495 */
496 buffer += 2; 473 buffer += 2;
497 temp8 = *buffer; 474 temp8 = *buffer;
498 475
@@ -504,35 +481,29 @@ acpi_rs_address32_resource (
504 481
505 output_struct->data.address32.resource_type = temp8; 482 output_struct->data.address32.resource_type = temp8;
506 483
507 /* 484 /* Get the General Flags (Byte4) */
508 * Get the General Flags (Byte4) 485
509 */
510 buffer += 1; 486 buffer += 1;
511 temp8 = *buffer; 487 temp8 = *buffer;
512 488
513 /* 489 /* Producer / Consumer */
514 * Producer / Consumer 490
515 */
516 output_struct->data.address32.producer_consumer = temp8 & 0x01; 491 output_struct->data.address32.producer_consumer = temp8 & 0x01;
517 492
518 /* 493 /* Decode */
519 * Decode 494
520 */
521 output_struct->data.address32.decode = (temp8 >> 1) & 0x01; 495 output_struct->data.address32.decode = (temp8 >> 1) & 0x01;
522 496
523 /* 497 /* Min Address Fixed */
524 * Min Address Fixed 498
525 */
526 output_struct->data.address32.min_address_fixed = (temp8 >> 2) & 0x01; 499 output_struct->data.address32.min_address_fixed = (temp8 >> 2) & 0x01;
527 500
528 /* 501 /* Max Address Fixed */
529 * Max Address Fixed 502
530 */
531 output_struct->data.address32.max_address_fixed = (temp8 >> 3) & 0x01; 503 output_struct->data.address32.max_address_fixed = (temp8 >> 3) & 0x01;
532 504
533 /* 505 /* Get the Type Specific Flags (Byte5) */
534 * Get the Type Specific Flags (Byte5) 506
535 */
536 buffer += 1; 507 buffer += 1;
537 temp8 = *buffer; 508 temp8 = *buffer;
538 509
@@ -556,39 +527,34 @@ acpi_rs_address32_resource (
556 } 527 }
557 } 528 }
558 529
559 /* 530 /* Get Granularity (Bytes 6-9) */
560 * Get Granularity (Bytes 6-9) 531
561 */
562 buffer += 1; 532 buffer += 1;
563 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer); 533 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer);
564 534
565 /* 535 /* Get min_address_range (Bytes 10-13) */
566 * Get min_address_range (Bytes 10-13) 536
567 */
568 buffer += 4; 537 buffer += 4;
569 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer); 538 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer);
570 539
571 /* 540 /* Get max_address_range (Bytes 14-17) */
572 * Get max_address_range (Bytes 14-17) 541
573 */
574 buffer += 4; 542 buffer += 4;
575 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer); 543 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer);
576 544
577 /* 545 /* Get address_translation_offset (Bytes 18-21) */
578 * Get address_translation_offset (Bytes 18-21) 546
579 */
580 buffer += 4; 547 buffer += 4;
581 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset, buffer); 548 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset,
549 buffer);
550
551 /* Get address_length (Bytes 22-25) */
582 552
583 /*
584 * Get address_length (Bytes 22-25)
585 */
586 buffer += 4; 553 buffer += 4;
587 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer); 554 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer);
588 555
589 /* 556 /* Resource Source Index (if present) */
590 * Resource Source Index (if present) 557
591 */
592 buffer += 4; 558 buffer += 4;
593 559
594 /* 560 /*
@@ -615,7 +581,8 @@ acpi_rs_address32_resource (
615 output_struct->data.address32.resource_source.string_ptr = 581 output_struct->data.address32.resource_source.string_ptr =
616 (char *)((u8 *)output_struct + struct_size); 582 (char *)((u8 *)output_struct + struct_size);
617 583
618 temp_ptr = (u8 *) output_struct->data.address32.resource_source.string_ptr; 584 temp_ptr = (u8 *)
585 output_struct->data.address32.resource_source.string_ptr;
619 586
620 /* Copy the string into the buffer */ 587 /* Copy the string into the buffer */
621 588
@@ -628,9 +595,8 @@ acpi_rs_address32_resource (
628 index += 1; 595 index += 1;
629 } 596 }
630 597
631 /* 598 /* Add the terminating null */
632 * Add the terminating null 599
633 */
634 *temp_ptr = 0x00; 600 *temp_ptr = 0x00;
635 output_struct->data.address32.resource_source.string_length = index + 1; 601 output_struct->data.address32.resource_source.string_length = index + 1;
636 602
@@ -648,14 +614,12 @@ acpi_rs_address32_resource (
648 output_struct->data.address32.resource_source.string_ptr = NULL; 614 output_struct->data.address32.resource_source.string_ptr = NULL;
649 } 615 }
650 616
651 /* 617 /* Set the Length parameter */
652 * Set the Length parameter 618
653 */
654 output_struct->length = (u32) struct_size; 619 output_struct->length = (u32) struct_size;
655 620
656 /* 621 /* Return the final size of the structure */
657 * Return the final size of the structure 622
658 */
659 *structure_size = struct_size; 623 *structure_size = struct_size;
660 return_ACPI_STATUS (AE_OK); 624 return_ACPI_STATUS (AE_OK);
661} 625}
@@ -694,29 +658,25 @@ acpi_rs_address32_stream (
694 658
695 buffer = *output_buffer; 659 buffer = *output_buffer;
696 660
697 /* 661 /* The descriptor field is static */
698 * The descriptor field is static 662
699 */
700 *buffer = 0x87; 663 *buffer = 0x87;
701 buffer += 1; 664 buffer += 1;
702 665
703 /* 666 /* Set a pointer to the Length field - to be filled in later */
704 * Set a pointer to the Length field - to be filled in later 667
705 */
706 length_field = ACPI_CAST_PTR (u16, buffer); 668 length_field = ACPI_CAST_PTR (u16, buffer);
707 buffer += 2; 669 buffer += 2;
708 670
709 /* 671 /* Set the Resource Type (Memory, Io, bus_number) */
710 * Set the Resource Type (Memory, Io, bus_number) 672
711 */
712 temp8 = (u8) (linked_list->data.address32.resource_type & 0x03); 673 temp8 = (u8) (linked_list->data.address32.resource_type & 0x03);
713 674
714 *buffer = temp8; 675 *buffer = temp8;
715 buffer += 1; 676 buffer += 1;
716 677
717 /* 678 /* Set the general flags */
718 * Set the general flags 679
719 */
720 temp8 = (u8) (linked_list->data.address32.producer_consumer & 0x01); 680 temp8 = (u8) (linked_list->data.address32.producer_consumer & 0x01);
721 temp8 |= (linked_list->data.address32.decode & 0x01) << 1; 681 temp8 |= (linked_list->data.address32.decode & 0x01) << 1;
722 temp8 |= (linked_list->data.address32.min_address_fixed & 0x01) << 2; 682 temp8 |= (linked_list->data.address32.min_address_fixed & 0x01) << 2;
@@ -725,9 +685,8 @@ acpi_rs_address32_stream (
725 *buffer = temp8; 685 *buffer = temp8;
726 buffer += 1; 686 buffer += 1;
727 687
728 /* 688 /* Set the type specific flags */
729 * Set the type specific flags 689
730 */
731 temp8 = 0; 690 temp8 = 0;
732 691
733 if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) { 692 if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) {
@@ -751,39 +710,34 @@ acpi_rs_address32_stream (
751 *buffer = temp8; 710 *buffer = temp8;
752 buffer += 1; 711 buffer += 1;
753 712
754 /* 713 /* Set the address space granularity */
755 * Set the address space granularity 714
756 */
757 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity); 715 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity);
758 buffer += 4; 716 buffer += 4;
759 717
760 /* 718 /* Set the address range minimum */
761 * Set the address range minimum 719
762 */
763 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range); 720 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range);
764 buffer += 4; 721 buffer += 4;
765 722
766 /* 723 /* Set the address range maximum */
767 * Set the address range maximum 724
768 */
769 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range); 725 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range);
770 buffer += 4; 726 buffer += 4;
771 727
772 /* 728 /* Set the address translation offset */
773 * Set the address translation offset 729
774 */ 730 ACPI_MOVE_32_TO_32 (buffer,
775 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_translation_offset); 731 &linked_list->data.address32.address_translation_offset);
776 buffer += 4; 732 buffer += 4;
777 733
778 /* 734 /* Set the address length */
779 * Set the address length 735
780 */
781 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length); 736 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length);
782 buffer += 4; 737 buffer += 4;
783 738
784 /* 739 /* Resource Source Index and Resource Source are optional */
785 * Resource Source Index and Resource Source are optional 740
786 */
787 if (0 != linked_list->data.address32.resource_source.string_length) { 741 if (0 != linked_list->data.address32.resource_source.string_length) {
788 temp8 = (u8) linked_list->data.address32.resource_source.index; 742 temp8 = (u8) linked_list->data.address32.resource_source.index;
789 743
@@ -792,9 +746,8 @@ acpi_rs_address32_stream (
792 746
793 temp_pointer = (char *) buffer; 747 temp_pointer = (char *) buffer;
794 748
795 /* 749 /* Copy the string */
796 * Copy the string 750
797 */
798 ACPI_STRCPY (temp_pointer, 751 ACPI_STRCPY (temp_pointer,
799 linked_list->data.address32.resource_source.string_ptr); 752 linked_list->data.address32.resource_source.string_ptr);
800 753
@@ -802,12 +755,12 @@ acpi_rs_address32_stream (
802 * Buffer needs to be set to the length of the sting + one for the 755 * Buffer needs to be set to the length of the sting + one for the
803 * terminating null 756 * terminating null
804 */ 757 */
805 buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address32.resource_source.string_ptr) + 1); 758 buffer += (acpi_size)(ACPI_STRLEN (
759 linked_list->data.address32.resource_source.string_ptr) + 1);
806 } 760 }
807 761
808 /* 762 /* Return the number of bytes consumed in this operation */
809 * Return the number of bytes consumed in this operation 763
810 */
811 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 764 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
812 765
813 /* 766 /*
@@ -864,9 +817,8 @@ acpi_rs_address64_resource (
864 struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64); 817 struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64);
865 resource_type = *buffer; 818 resource_type = *buffer;
866 819
867 /* 820 /* Point past the Descriptor to get the number of bytes consumed */
868 * Point past the Descriptor to get the number of bytes consumed 821
869 */
870 buffer += 1; 822 buffer += 1;
871 ACPI_MOVE_16_TO_16 (&temp16, buffer); 823 ACPI_MOVE_16_TO_16 (&temp16, buffer);
872 824
@@ -879,9 +831,8 @@ acpi_rs_address64_resource (
879 *bytes_consumed = temp16 + 3; 831 *bytes_consumed = temp16 + 3;
880 output_struct->id = ACPI_RSTYPE_ADDRESS64; 832 output_struct->id = ACPI_RSTYPE_ADDRESS64;
881 833
882 /* 834 /* Get the Resource Type (Byte3) */
883 * Get the Resource Type (Byte3) 835
884 */
885 buffer += 2; 836 buffer += 2;
886 temp8 = *buffer; 837 temp8 = *buffer;
887 838
@@ -893,35 +844,29 @@ acpi_rs_address64_resource (
893 844
894 output_struct->data.address64.resource_type = temp8; 845 output_struct->data.address64.resource_type = temp8;
895 846
896 /* 847 /* Get the General Flags (Byte4) */
897 * Get the General Flags (Byte4) 848
898 */
899 buffer += 1; 849 buffer += 1;
900 temp8 = *buffer; 850 temp8 = *buffer;
901 851
902 /* 852 /* Producer / Consumer */
903 * Producer / Consumer 853
904 */
905 output_struct->data.address64.producer_consumer = temp8 & 0x01; 854 output_struct->data.address64.producer_consumer = temp8 & 0x01;
906 855
907 /* 856 /* Decode */
908 * Decode 857
909 */
910 output_struct->data.address64.decode = (temp8 >> 1) & 0x01; 858 output_struct->data.address64.decode = (temp8 >> 1) & 0x01;
911 859
912 /* 860 /* Min Address Fixed */
913 * Min Address Fixed 861
914 */
915 output_struct->data.address64.min_address_fixed = (temp8 >> 2) & 0x01; 862 output_struct->data.address64.min_address_fixed = (temp8 >> 2) & 0x01;
916 863
917 /* 864 /* Max Address Fixed */
918 * Max Address Fixed 865
919 */
920 output_struct->data.address64.max_address_fixed = (temp8 >> 3) & 0x01; 866 output_struct->data.address64.max_address_fixed = (temp8 >> 3) & 0x01;
921 867
922 /* 868 /* Get the Type Specific Flags (Byte5) */
923 * Get the Type Specific Flags (Byte5) 869
924 */
925 buffer += 1; 870 buffer += 1;
926 temp8 = *buffer; 871 temp8 = *buffer;
927 872
@@ -951,33 +896,29 @@ acpi_rs_address64_resource (
951 buffer += 2; 896 buffer += 2;
952 } 897 }
953 898
954 /* 899 /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */
955 * Get Granularity (Bytes 6-13) or (Bytes 8-15) 900
956 */
957 buffer += 1; 901 buffer += 1;
958 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer); 902 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer);
959 903
960 /* 904 /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */
961 * Get min_address_range (Bytes 14-21) or (Bytes 16-23) 905
962 */
963 buffer += 8; 906 buffer += 8;
964 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer); 907 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer);
965 908
966 /* 909 /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */
967 * Get max_address_range (Bytes 22-29) or (Bytes 24-31) 910
968 */
969 buffer += 8; 911 buffer += 8;
970 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer); 912 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer);
971 913
972 /* 914 /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */
973 * Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) 915
974 */
975 buffer += 8; 916 buffer += 8;
976 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset, buffer); 917 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset,
918 buffer);
919
920 /* Get address_length (Bytes 38-45) or (Bytes 40-47) */
977 921
978 /*
979 * Get address_length (Bytes 38-45) or (Bytes 40-47)
980 */
981 buffer += 8; 922 buffer += 8;
982 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer); 923 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer);
983 924
@@ -989,14 +930,15 @@ acpi_rs_address64_resource (
989 /* Get type_specific_attribute (Bytes 48-55) */ 930 /* Get type_specific_attribute (Bytes 48-55) */
990 931
991 buffer += 8; 932 buffer += 8;
992 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.type_specific_attributes, buffer); 933 ACPI_MOVE_64_TO_64 (
934 &output_struct->data.address64.type_specific_attributes,
935 buffer);
993 } 936 }
994 else { 937 else {
995 output_struct->data.address64.type_specific_attributes = 0; 938 output_struct->data.address64.type_specific_attributes = 0;
996 939
997 /* 940 /* Resource Source Index (if present) */
998 * Resource Source Index (if present) 941
999 */
1000 buffer += 8; 942 buffer += 8;
1001 943
1002 /* 944 /*
@@ -1025,7 +967,8 @@ acpi_rs_address64_resource (
1025 output_struct->data.address64.resource_source.string_ptr = 967 output_struct->data.address64.resource_source.string_ptr =
1026 (char *)((u8 *)output_struct + struct_size); 968 (char *)((u8 *)output_struct + struct_size);
1027 969
1028 temp_ptr = (u8 *) output_struct->data.address64.resource_source.string_ptr; 970 temp_ptr = (u8 *)
971 output_struct->data.address64.resource_source.string_ptr;
1029 972
1030 /* Copy the string into the buffer */ 973 /* Copy the string into the buffer */
1031 974
@@ -1042,7 +985,8 @@ acpi_rs_address64_resource (
1042 * Add the terminating null 985 * Add the terminating null
1043 */ 986 */
1044 *temp_ptr = 0x00; 987 *temp_ptr = 0x00;
1045 output_struct->data.address64.resource_source.string_length = index + 1; 988 output_struct->data.address64.resource_source.string_length =
989 index + 1;
1046 990
1047 /* 991 /*
1048 * In order for the struct_size to fall on a 32-bit boundary, 992 * In order for the struct_size to fall on a 32-bit boundary,
@@ -1054,14 +998,12 @@ acpi_rs_address64_resource (
1054 } 998 }
1055 } 999 }
1056 1000
1057 /* 1001 /* Set the Length parameter */
1058 * Set the Length parameter 1002
1059 */
1060 output_struct->length = (u32) struct_size; 1003 output_struct->length = (u32) struct_size;
1061 1004
1062 /* 1005 /* Return the final size of the structure */
1063 * Return the final size of the structure 1006
1064 */
1065 *structure_size = struct_size; 1007 *structure_size = struct_size;
1066 return_ACPI_STATUS (AE_OK); 1008 return_ACPI_STATUS (AE_OK);
1067} 1009}
@@ -1100,29 +1042,25 @@ acpi_rs_address64_stream (
1100 1042
1101 buffer = *output_buffer; 1043 buffer = *output_buffer;
1102 1044
1103 /* 1045 /* The descriptor field is static */
1104 * The descriptor field is static 1046
1105 */
1106 *buffer = 0x8A; 1047 *buffer = 0x8A;
1107 buffer += 1; 1048 buffer += 1;
1108 1049
1109 /* 1050 /* Set a pointer to the Length field - to be filled in later */
1110 * Set a pointer to the Length field - to be filled in later 1051
1111 */
1112 length_field = ACPI_CAST_PTR (u16, buffer); 1052 length_field = ACPI_CAST_PTR (u16, buffer);
1113 buffer += 2; 1053 buffer += 2;
1114 1054
1115 /* 1055 /* Set the Resource Type (Memory, Io, bus_number) */
1116 * Set the Resource Type (Memory, Io, bus_number) 1056
1117 */
1118 temp8 = (u8) (linked_list->data.address64.resource_type & 0x03); 1057 temp8 = (u8) (linked_list->data.address64.resource_type & 0x03);
1119 1058
1120 *buffer = temp8; 1059 *buffer = temp8;
1121 buffer += 1; 1060 buffer += 1;
1122 1061
1123 /* 1062 /* Set the general flags */
1124 * Set the general flags 1063
1125 */
1126 temp8 = (u8) (linked_list->data.address64.producer_consumer & 0x01); 1064 temp8 = (u8) (linked_list->data.address64.producer_consumer & 0x01);
1127 temp8 |= (linked_list->data.address64.decode & 0x01) << 1; 1065 temp8 |= (linked_list->data.address64.decode & 0x01) << 1;
1128 temp8 |= (linked_list->data.address64.min_address_fixed & 0x01) << 2; 1066 temp8 |= (linked_list->data.address64.min_address_fixed & 0x01) << 2;
@@ -1131,9 +1069,8 @@ acpi_rs_address64_stream (
1131 *buffer = temp8; 1069 *buffer = temp8;
1132 buffer += 1; 1070 buffer += 1;
1133 1071
1134 /* 1072 /* Set the type specific flags */
1135 * Set the type specific flags 1073
1136 */
1137 temp8 = 0; 1074 temp8 = 0;
1138 1075
1139 if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) { 1076 if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) {
@@ -1157,39 +1094,34 @@ acpi_rs_address64_stream (
1157 *buffer = temp8; 1094 *buffer = temp8;
1158 buffer += 1; 1095 buffer += 1;
1159 1096
1160 /* 1097 /* Set the address space granularity */
1161 * Set the address space granularity 1098
1162 */
1163 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity); 1099 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity);
1164 buffer += 8; 1100 buffer += 8;
1165 1101
1166 /* 1102 /* Set the address range minimum */
1167 * Set the address range minimum 1103
1168 */
1169 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range); 1104 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range);
1170 buffer += 8; 1105 buffer += 8;
1171 1106
1172 /* 1107 /* Set the address range maximum */
1173 * Set the address range maximum 1108
1174 */
1175 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range); 1109 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range);
1176 buffer += 8; 1110 buffer += 8;
1177 1111
1178 /* 1112 /* Set the address translation offset */
1179 * Set the address translation offset 1113
1180 */ 1114 ACPI_MOVE_64_TO_64 (buffer,
1181 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_translation_offset); 1115 &linked_list->data.address64.address_translation_offset);
1182 buffer += 8; 1116 buffer += 8;
1183 1117
1184 /* 1118 /* Set the address length */
1185 * Set the address length 1119
1186 */
1187 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length); 1120 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length);
1188 buffer += 8; 1121 buffer += 8;
1189 1122
1190 /* 1123 /* Resource Source Index and Resource Source are optional */
1191 * Resource Source Index and Resource Source are optional 1124
1192 */
1193 if (0 != linked_list->data.address64.resource_source.string_length) { 1125 if (0 != linked_list->data.address64.resource_source.string_length) {
1194 temp8 = (u8) linked_list->data.address64.resource_source.index; 1126 temp8 = (u8) linked_list->data.address64.resource_source.index;
1195 1127
@@ -1198,21 +1130,21 @@ acpi_rs_address64_stream (
1198 1130
1199 temp_pointer = (char *) buffer; 1131 temp_pointer = (char *) buffer;
1200 1132
1201 /* 1133 /* Copy the string */
1202 * Copy the string 1134
1203 */ 1135 ACPI_STRCPY (temp_pointer,
1204 ACPI_STRCPY (temp_pointer, linked_list->data.address64.resource_source.string_ptr); 1136 linked_list->data.address64.resource_source.string_ptr);
1205 1137
1206 /* 1138 /*
1207 * Buffer needs to be set to the length of the sting + one for the 1139 * Buffer needs to be set to the length of the sting + one for the
1208 * terminating null 1140 * terminating null
1209 */ 1141 */
1210 buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address64.resource_source.string_ptr) + 1); 1142 buffer += (acpi_size)(ACPI_STRLEN (
1143 linked_list->data.address64.resource_source.string_ptr) + 1);
1211 } 1144 }
1212 1145
1213 /* 1146 /* Return the number of bytes consumed in this operation */
1214 * Return the number of bytes consumed in this operation 1147
1215 */
1216 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 1148 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
1217 1149
1218 /* 1150 /*