aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/resources')
-rw-r--r--drivers/acpi/resources/rsaddr.c503
-rw-r--r--drivers/acpi/resources/rscalc.c314
-rw-r--r--drivers/acpi/resources/rscreate.c297
-rw-r--r--drivers/acpi/resources/rsdump.c847
-rw-r--r--drivers/acpi/resources/rsio.c172
-rw-r--r--drivers/acpi/resources/rsirq.c236
-rw-r--r--drivers/acpi/resources/rslist.c279
-rw-r--r--drivers/acpi/resources/rsmemory.c218
-rw-r--r--drivers/acpi/resources/rsmisc.c230
-rw-r--r--drivers/acpi/resources/rsutils.c159
-rw-r--r--drivers/acpi/resources/rsxface.c182
11 files changed, 1604 insertions, 1833 deletions
diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c
index 55d264771c48..4cf46e1ee01b 100644
--- a/drivers/acpi/resources/rsaddr.c
+++ b/drivers/acpi/resources/rsaddr.c
@@ -41,13 +41,11 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acresrc.h> 45#include <acpi/acresrc.h>
47 46
48#define _COMPONENT ACPI_RESOURCES 47#define _COMPONENT ACPI_RESOURCES
49 ACPI_MODULE_NAME ("rsaddr") 48ACPI_MODULE_NAME("rsaddr")
50
51 49
52/******************************************************************************* 50/*******************************************************************************
53 * 51 *
@@ -69,36 +67,31 @@
69 * number of bytes consumed from the byte stream. 67 * number of bytes consumed from the byte stream.
70 * 68 *
71 ******************************************************************************/ 69 ******************************************************************************/
72
73acpi_status 70acpi_status
74acpi_rs_address16_resource ( 71acpi_rs_address16_resource(u8 * byte_stream_buffer,
75 u8 *byte_stream_buffer, 72 acpi_size * bytes_consumed,
76 acpi_size *bytes_consumed, 73 u8 ** output_buffer, acpi_size * structure_size)
77 u8 **output_buffer,
78 acpi_size *structure_size)
79{ 74{
80 u32 index; 75 u32 index;
81 u16 temp16; 76 u16 temp16;
82 u8 temp8; 77 u8 temp8;
83 u8 *temp_ptr; 78 u8 *temp_ptr;
84 u8 *buffer = byte_stream_buffer; 79 u8 *buffer = byte_stream_buffer;
85 struct acpi_resource *output_struct = (void *) *output_buffer; 80 struct acpi_resource *output_struct = (void *)*output_buffer;
86 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 81 acpi_size struct_size =
87 struct acpi_resource_address16); 82 ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16);
88
89
90 ACPI_FUNCTION_TRACE ("rs_address16_resource");
91 83
84 ACPI_FUNCTION_TRACE("rs_address16_resource");
92 85
93 /* Point past the Descriptor to get the number of bytes consumed */ 86 /* Point past the Descriptor to get the number of bytes consumed */
94 87
95 buffer += 1; 88 buffer += 1;
96 ACPI_MOVE_16_TO_16 (&temp16, buffer); 89 ACPI_MOVE_16_TO_16(&temp16, buffer);
97 90
98 /* Validate minimum descriptor length */ 91 /* Validate minimum descriptor length */
99 92
100 if (temp16 < 13) { 93 if (temp16 < 13) {
101 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); 94 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
102 } 95 }
103 96
104 *bytes_consumed = temp16 + 3; 97 *bytes_consumed = temp16 + 3;
@@ -112,7 +105,7 @@ acpi_rs_address16_resource (
112 /* Values 0-2 and 0xC0-0xFF are valid */ 105 /* Values 0-2 and 0xC0-0xFF are valid */
113 106
114 if ((temp8 > 2) && (temp8 < 0xC0)) { 107 if ((temp8 > 2) && (temp8 < 0xC0)) {
115 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); 108 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
116 } 109 }
117 110
118 output_struct->data.address16.resource_type = temp8; 111 output_struct->data.address16.resource_type = temp8;
@@ -144,19 +137,18 @@ acpi_rs_address16_resource (
144 temp8 = *buffer; 137 temp8 = *buffer;
145 138
146 if (ACPI_MEMORY_RANGE == output_struct->data.address16.resource_type) { 139 if (ACPI_MEMORY_RANGE == output_struct->data.address16.resource_type) {
147 output_struct->data.address16.attribute.memory.read_write_attribute = 140 output_struct->data.address16.attribute.memory.
148 (u16) (temp8 & 0x01); 141 read_write_attribute = (u16) (temp8 & 0x01);
149 output_struct->data.address16.attribute.memory.cache_attribute = 142 output_struct->data.address16.attribute.memory.cache_attribute =
150 (u16) ((temp8 >> 1) & 0x03); 143 (u16) ((temp8 >> 1) & 0x03);
151 } 144 } else {
152 else { 145 if (ACPI_IO_RANGE ==
153 if (ACPI_IO_RANGE == output_struct->data.address16.resource_type) { 146 output_struct->data.address16.resource_type) {
154 output_struct->data.address16.attribute.io.range_attribute = 147 output_struct->data.address16.attribute.io.
155 (u16) (temp8 & 0x03); 148 range_attribute = (u16) (temp8 & 0x03);
156 output_struct->data.address16.attribute.io.translation_attribute = 149 output_struct->data.address16.attribute.io.
157 (u16) ((temp8 >> 4) & 0x03); 150 translation_attribute = (u16) ((temp8 >> 4) & 0x03);
158 } 151 } else {
159 else {
160 /* BUS_NUMBER_RANGE == Address16.Data->resource_type */ 152 /* BUS_NUMBER_RANGE == Address16.Data->resource_type */
161 /* Nothing needs to be filled in */ 153 /* Nothing needs to be filled in */
162 } 154 }
@@ -165,28 +157,31 @@ acpi_rs_address16_resource (
165 /* Get Granularity (Bytes 6-7) */ 157 /* Get Granularity (Bytes 6-7) */
166 158
167 buffer += 1; 159 buffer += 1;
168 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer); 160 ACPI_MOVE_16_TO_32(&output_struct->data.address16.granularity, buffer);
169 161
170 /* Get min_address_range (Bytes 8-9) */ 162 /* Get min_address_range (Bytes 8-9) */
171 163
172 buffer += 2; 164 buffer += 2;
173 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer); 165 ACPI_MOVE_16_TO_32(&output_struct->data.address16.min_address_range,
166 buffer);
174 167
175 /* Get max_address_range (Bytes 10-11) */ 168 /* Get max_address_range (Bytes 10-11) */
176 169
177 buffer += 2; 170 buffer += 2;
178 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer); 171 ACPI_MOVE_16_TO_32(&output_struct->data.address16.max_address_range,
172 buffer);
179 173
180 /* Get address_translation_offset (Bytes 12-13) */ 174 /* Get address_translation_offset (Bytes 12-13) */
181 175
182 buffer += 2; 176 buffer += 2;
183 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset, 177 ACPI_MOVE_16_TO_32(&output_struct->data.address16.
184 buffer); 178 address_translation_offset, buffer);
185 179
186 /* Get address_length (Bytes 14-15) */ 180 /* Get address_length (Bytes 14-15) */
187 181
188 buffer += 2; 182 buffer += 2;
189 ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer); 183 ACPI_MOVE_16_TO_32(&output_struct->data.address16.address_length,
184 buffer);
190 185
191 /* Resource Source Index (if present) */ 186 /* Resource Source Index (if present) */
192 187
@@ -206,7 +201,8 @@ acpi_rs_address16_resource (
206 /* Dereference the Index */ 201 /* Dereference the Index */
207 202
208 temp8 = *buffer; 203 temp8 = *buffer;
209 output_struct->data.address16.resource_source.index = (u32) temp8; 204 output_struct->data.address16.resource_source.index =
205 (u32) temp8;
210 206
211 /* Point to the String */ 207 /* Point to the String */
212 208
@@ -215,10 +211,10 @@ acpi_rs_address16_resource (
215 /* Point the String pointer to the end of this structure */ 211 /* Point the String pointer to the end of this structure */
216 212
217 output_struct->data.address16.resource_source.string_ptr = 213 output_struct->data.address16.resource_source.string_ptr =
218 (char *)((u8 * )output_struct + struct_size); 214 (char *)((u8 *) output_struct + struct_size);
219 215
220 temp_ptr = (u8 *) 216 temp_ptr = (u8 *)
221 output_struct->data.address16.resource_source.string_ptr; 217 output_struct->data.address16.resource_source.string_ptr;
222 218
223 /* Copy the string into the buffer */ 219 /* Copy the string into the buffer */
224 220
@@ -236,7 +232,8 @@ acpi_rs_address16_resource (
236 232
237 *temp_ptr = 0x00; 233 *temp_ptr = 0x00;
238 234
239 output_struct->data.address16.resource_source.string_length = index + 1; 235 output_struct->data.address16.resource_source.string_length =
236 index + 1;
240 237
241 /* 238 /*
242 * In order for the struct_size to fall on a 32-bit boundary, 239 * In order for the struct_size to fall on a 32-bit boundary,
@@ -244,9 +241,8 @@ acpi_rs_address16_resource (
244 * struct_size to the next 32-bit boundary. 241 * struct_size to the next 32-bit boundary.
245 */ 242 */
246 temp8 = (u8) (index + 1); 243 temp8 = (u8) (index + 1);
247 struct_size += ACPI_ROUND_UP_to_32_bITS (temp8); 244 struct_size += ACPI_ROUND_UP_to_32_bITS(temp8);
248 } 245 } else {
249 else {
250 output_struct->data.address16.resource_source.index = 0x00; 246 output_struct->data.address16.resource_source.index = 0x00;
251 output_struct->data.address16.resource_source.string_length = 0; 247 output_struct->data.address16.resource_source.string_length = 0;
252 output_struct->data.address16.resource_source.string_ptr = NULL; 248 output_struct->data.address16.resource_source.string_ptr = NULL;
@@ -259,10 +255,9 @@ acpi_rs_address16_resource (
259 /* Return the final size of the structure */ 255 /* Return the final size of the structure */
260 256
261 *structure_size = struct_size; 257 *structure_size = struct_size;
262 return_ACPI_STATUS (AE_OK); 258 return_ACPI_STATUS(AE_OK);
263} 259}
264 260
265
266/******************************************************************************* 261/*******************************************************************************
267 * 262 *
268 * FUNCTION: acpi_rs_address16_stream 263 * FUNCTION: acpi_rs_address16_stream
@@ -280,20 +275,16 @@ acpi_rs_address16_resource (
280 ******************************************************************************/ 275 ******************************************************************************/
281 276
282acpi_status 277acpi_status
283acpi_rs_address16_stream ( 278acpi_rs_address16_stream(struct acpi_resource *linked_list,
284 struct acpi_resource *linked_list, 279 u8 ** output_buffer, acpi_size * bytes_consumed)
285 u8 **output_buffer,
286 acpi_size *bytes_consumed)
287{ 280{
288 u8 *buffer = *output_buffer; 281 u8 *buffer = *output_buffer;
289 u8 *length_field; 282 u8 *length_field;
290 u8 temp8; 283 u8 temp8;
291 char *temp_pointer = NULL; 284 char *temp_pointer = NULL;
292 acpi_size actual_bytes; 285 acpi_size actual_bytes;
293
294
295 ACPI_FUNCTION_TRACE ("rs_address16_stream");
296 286
287 ACPI_FUNCTION_TRACE("rs_address16_stream");
297 288
298 /* The descriptor field is static */ 289 /* The descriptor field is static */
299 290
@@ -328,20 +319,19 @@ acpi_rs_address16_stream (
328 319
329 if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) { 320 if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) {
330 temp8 = (u8) 321 temp8 = (u8)
331 (linked_list->data.address16.attribute.memory.read_write_attribute & 322 (linked_list->data.address16.attribute.memory.
332 0x01); 323 read_write_attribute & 0x01);
333 324
334 temp8 |= 325 temp8 |=
335 (linked_list->data.address16.attribute.memory.cache_attribute & 326 (linked_list->data.address16.attribute.memory.
336 0x03) << 1; 327 cache_attribute & 0x03) << 1;
337 } 328 } else if (ACPI_IO_RANGE == linked_list->data.address16.resource_type) {
338 else if (ACPI_IO_RANGE == linked_list->data.address16.resource_type) {
339 temp8 = (u8) 329 temp8 = (u8)
340 (linked_list->data.address16.attribute.io.range_attribute & 330 (linked_list->data.address16.attribute.io.range_attribute &
341 0x03); 331 0x03);
342 temp8 |= 332 temp8 |=
343 (linked_list->data.address16.attribute.io.translation_attribute & 333 (linked_list->data.address16.attribute.io.
344 0x03) << 4; 334 translation_attribute & 0x03) << 4;
345 } 335 }
346 336
347 *buffer = temp8; 337 *buffer = temp8;
@@ -349,28 +339,31 @@ acpi_rs_address16_stream (
349 339
350 /* Set the address space granularity */ 340 /* Set the address space granularity */
351 341
352 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity); 342 ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.granularity);
353 buffer += 2; 343 buffer += 2;
354 344
355 /* Set the address range minimum */ 345 /* Set the address range minimum */
356 346
357 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range); 347 ACPI_MOVE_32_TO_16(buffer,
348 &linked_list->data.address16.min_address_range);
358 buffer += 2; 349 buffer += 2;
359 350
360 /* Set the address range maximum */ 351 /* Set the address range maximum */
361 352
362 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range); 353 ACPI_MOVE_32_TO_16(buffer,
354 &linked_list->data.address16.max_address_range);
363 buffer += 2; 355 buffer += 2;
364 356
365 /* Set the address translation offset */ 357 /* Set the address translation offset */
366 358
367 ACPI_MOVE_32_TO_16 (buffer, 359 ACPI_MOVE_32_TO_16(buffer,
368 &linked_list->data.address16.address_translation_offset); 360 &linked_list->data.address16.
361 address_translation_offset);
369 buffer += 2; 362 buffer += 2;
370 363
371 /* Set the address length */ 364 /* Set the address length */
372 365
373 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length); 366 ACPI_MOVE_32_TO_16(buffer, &linked_list->data.address16.address_length);
374 buffer += 2; 367 buffer += 2;
375 368
376 /* Resource Source Index and Resource Source are optional */ 369 /* Resource Source Index and Resource Source are optional */
@@ -381,24 +374,27 @@ acpi_rs_address16_stream (
381 *buffer = temp8; 374 *buffer = temp8;
382 buffer += 1; 375 buffer += 1;
383 376
384 temp_pointer = (char *) buffer; 377 temp_pointer = (char *)buffer;
385 378
386 /* Copy the string */ 379 /* Copy the string */
387 380
388 ACPI_STRCPY (temp_pointer, 381 ACPI_STRCPY(temp_pointer,
389 linked_list->data.address16.resource_source.string_ptr); 382 linked_list->data.address16.resource_source.
383 string_ptr);
390 384
391 /* 385 /*
392 * Buffer needs to be set to the length of the sting + one for the 386 * Buffer needs to be set to the length of the sting + one for the
393 * terminating null 387 * terminating null
394 */ 388 */
395 buffer += (acpi_size)(ACPI_STRLEN ( 389 buffer +=
396 linked_list->data.address16.resource_source.string_ptr) + 1); 390 (acpi_size) (ACPI_STRLEN
391 (linked_list->data.address16.resource_source.
392 string_ptr) + 1);
397 } 393 }
398 394
399 /* Return the number of bytes consumed in this operation */ 395 /* Return the number of bytes consumed in this operation */
400 396
401 actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer); 397 actual_bytes = ACPI_PTR_DIFF(buffer, *output_buffer);
402 *bytes_consumed = actual_bytes; 398 *bytes_consumed = actual_bytes;
403 399
404 /* 400 /*
@@ -406,11 +402,10 @@ acpi_rs_address16_stream (
406 * minus the header size (3 bytes) 402 * minus the header size (3 bytes)
407 */ 403 */
408 actual_bytes -= 3; 404 actual_bytes -= 3;
409 ACPI_MOVE_SIZE_TO_16 (length_field, &actual_bytes); 405 ACPI_MOVE_SIZE_TO_16(length_field, &actual_bytes);
410 return_ACPI_STATUS (AE_OK); 406 return_ACPI_STATUS(AE_OK);
411} 407}
412 408
413
414/******************************************************************************* 409/*******************************************************************************
415 * 410 *
416 * FUNCTION: acpi_rs_address32_resource 411 * FUNCTION: acpi_rs_address32_resource
@@ -433,36 +428,32 @@ acpi_rs_address16_stream (
433 ******************************************************************************/ 428 ******************************************************************************/
434 429
435acpi_status 430acpi_status
436acpi_rs_address32_resource ( 431acpi_rs_address32_resource(u8 * byte_stream_buffer,
437 u8 *byte_stream_buffer, 432 acpi_size * bytes_consumed,
438 acpi_size *bytes_consumed, 433 u8 ** output_buffer, acpi_size * structure_size)
439 u8 **output_buffer,
440 acpi_size *structure_size)
441{ 434{
442 u8 *buffer; 435 u8 *buffer;
443 struct acpi_resource *output_struct= (void *) *output_buffer; 436 struct acpi_resource *output_struct = (void *)*output_buffer;
444 u16 temp16; 437 u16 temp16;
445 u8 temp8; 438 u8 temp8;
446 u8 *temp_ptr; 439 u8 *temp_ptr;
447 acpi_size struct_size; 440 acpi_size struct_size;
448 u32 index; 441 u32 index;
449
450
451 ACPI_FUNCTION_TRACE ("rs_address32_resource");
452 442
443 ACPI_FUNCTION_TRACE("rs_address32_resource");
453 444
454 buffer = byte_stream_buffer; 445 buffer = byte_stream_buffer;
455 struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32); 446 struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32);
456 447
457 /* Point past the Descriptor to get the number of bytes consumed */ 448 /* Point past the Descriptor to get the number of bytes consumed */
458 449
459 buffer += 1; 450 buffer += 1;
460 ACPI_MOVE_16_TO_16 (&temp16, buffer); 451 ACPI_MOVE_16_TO_16(&temp16, buffer);
461 452
462 /* Validate minimum descriptor length */ 453 /* Validate minimum descriptor length */
463 454
464 if (temp16 < 23) { 455 if (temp16 < 23) {
465 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); 456 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
466 } 457 }
467 458
468 *bytes_consumed = temp16 + 3; 459 *bytes_consumed = temp16 + 3;
@@ -476,7 +467,7 @@ acpi_rs_address32_resource (
476 /* Values 0-2 and 0xC0-0xFF are valid */ 467 /* Values 0-2 and 0xC0-0xFF are valid */
477 468
478 if ((temp8 > 2) && (temp8 < 0xC0)) { 469 if ((temp8 > 2) && (temp8 < 0xC0)) {
479 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); 470 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
480 } 471 }
481 472
482 output_struct->data.address32.resource_type = temp8; 473 output_struct->data.address32.resource_type = temp8;
@@ -508,20 +499,19 @@ acpi_rs_address32_resource (
508 temp8 = *buffer; 499 temp8 = *buffer;
509 500
510 if (ACPI_MEMORY_RANGE == output_struct->data.address32.resource_type) { 501 if (ACPI_MEMORY_RANGE == output_struct->data.address32.resource_type) {
511 output_struct->data.address32.attribute.memory.read_write_attribute = 502 output_struct->data.address32.attribute.memory.
512 (u16) (temp8 & 0x01); 503 read_write_attribute = (u16) (temp8 & 0x01);
513 504
514 output_struct->data.address32.attribute.memory.cache_attribute = 505 output_struct->data.address32.attribute.memory.cache_attribute =
515 (u16) ((temp8 >> 1) & 0x03); 506 (u16) ((temp8 >> 1) & 0x03);
516 } 507 } else {
517 else { 508 if (ACPI_IO_RANGE ==
518 if (ACPI_IO_RANGE == output_struct->data.address32.resource_type) { 509 output_struct->data.address32.resource_type) {
519 output_struct->data.address32.attribute.io.range_attribute = 510 output_struct->data.address32.attribute.io.
520 (u16) (temp8 & 0x03); 511 range_attribute = (u16) (temp8 & 0x03);
521 output_struct->data.address32.attribute.io.translation_attribute = 512 output_struct->data.address32.attribute.io.
522 (u16) ((temp8 >> 4) & 0x03); 513 translation_attribute = (u16) ((temp8 >> 4) & 0x03);
523 } 514 } else {
524 else {
525 /* BUS_NUMBER_RANGE == output_struct->Data.Address32.resource_type */ 515 /* BUS_NUMBER_RANGE == output_struct->Data.Address32.resource_type */
526 /* Nothing needs to be filled in */ 516 /* Nothing needs to be filled in */
527 } 517 }
@@ -530,28 +520,31 @@ acpi_rs_address32_resource (
530 /* Get Granularity (Bytes 6-9) */ 520 /* Get Granularity (Bytes 6-9) */
531 521
532 buffer += 1; 522 buffer += 1;
533 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer); 523 ACPI_MOVE_32_TO_32(&output_struct->data.address32.granularity, buffer);
534 524
535 /* Get min_address_range (Bytes 10-13) */ 525 /* Get min_address_range (Bytes 10-13) */
536 526
537 buffer += 4; 527 buffer += 4;
538 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer); 528 ACPI_MOVE_32_TO_32(&output_struct->data.address32.min_address_range,
529 buffer);
539 530
540 /* Get max_address_range (Bytes 14-17) */ 531 /* Get max_address_range (Bytes 14-17) */
541 532
542 buffer += 4; 533 buffer += 4;
543 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer); 534 ACPI_MOVE_32_TO_32(&output_struct->data.address32.max_address_range,
535 buffer);
544 536
545 /* Get address_translation_offset (Bytes 18-21) */ 537 /* Get address_translation_offset (Bytes 18-21) */
546 538
547 buffer += 4; 539 buffer += 4;
548 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset, 540 ACPI_MOVE_32_TO_32(&output_struct->data.address32.
549 buffer); 541 address_translation_offset, buffer);
550 542
551 /* Get address_length (Bytes 22-25) */ 543 /* Get address_length (Bytes 22-25) */
552 544
553 buffer += 4; 545 buffer += 4;
554 ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer); 546 ACPI_MOVE_32_TO_32(&output_struct->data.address32.address_length,
547 buffer);
555 548
556 /* Resource Source Index (if present) */ 549 /* Resource Source Index (if present) */
557 550
@@ -570,7 +563,7 @@ acpi_rs_address32_resource (
570 563
571 temp8 = *buffer; 564 temp8 = *buffer;
572 output_struct->data.address32.resource_source.index = 565 output_struct->data.address32.resource_source.index =
573 (u32) temp8; 566 (u32) temp8;
574 567
575 /* Point to the String */ 568 /* Point to the String */
576 569
@@ -579,10 +572,10 @@ acpi_rs_address32_resource (
579 /* Point the String pointer to the end of this structure */ 572 /* Point the String pointer to the end of this structure */
580 573
581 output_struct->data.address32.resource_source.string_ptr = 574 output_struct->data.address32.resource_source.string_ptr =
582 (char *)((u8 *)output_struct + struct_size); 575 (char *)((u8 *) output_struct + struct_size);
583 576
584 temp_ptr = (u8 *) 577 temp_ptr = (u8 *)
585 output_struct->data.address32.resource_source.string_ptr; 578 output_struct->data.address32.resource_source.string_ptr;
586 579
587 /* Copy the string into the buffer */ 580 /* Copy the string into the buffer */
588 581
@@ -598,7 +591,8 @@ acpi_rs_address32_resource (
598 /* Add the terminating null */ 591 /* Add the terminating null */
599 592
600 *temp_ptr = 0x00; 593 *temp_ptr = 0x00;
601 output_struct->data.address32.resource_source.string_length = index + 1; 594 output_struct->data.address32.resource_source.string_length =
595 index + 1;
602 596
603 /* 597 /*
604 * In order for the struct_size to fall on a 32-bit boundary, 598 * In order for the struct_size to fall on a 32-bit boundary,
@@ -606,9 +600,8 @@ acpi_rs_address32_resource (
606 * struct_size to the next 32-bit boundary. 600 * struct_size to the next 32-bit boundary.
607 */ 601 */
608 temp8 = (u8) (index + 1); 602 temp8 = (u8) (index + 1);
609 struct_size += ACPI_ROUND_UP_to_32_bITS (temp8); 603 struct_size += ACPI_ROUND_UP_to_32_bITS(temp8);
610 } 604 } else {
611 else {
612 output_struct->data.address32.resource_source.index = 0x00; 605 output_struct->data.address32.resource_source.index = 0x00;
613 output_struct->data.address32.resource_source.string_length = 0; 606 output_struct->data.address32.resource_source.string_length = 0;
614 output_struct->data.address32.resource_source.string_ptr = NULL; 607 output_struct->data.address32.resource_source.string_ptr = NULL;
@@ -621,10 +614,9 @@ acpi_rs_address32_resource (
621 /* Return the final size of the structure */ 614 /* Return the final size of the structure */
622 615
623 *structure_size = struct_size; 616 *structure_size = struct_size;
624 return_ACPI_STATUS (AE_OK); 617 return_ACPI_STATUS(AE_OK);
625} 618}
626 619
627
628/******************************************************************************* 620/*******************************************************************************
629 * 621 *
630 * FUNCTION: acpi_rs_address32_stream 622 * FUNCTION: acpi_rs_address32_stream
@@ -642,19 +634,15 @@ acpi_rs_address32_resource (
642 ******************************************************************************/ 634 ******************************************************************************/
643 635
644acpi_status 636acpi_status
645acpi_rs_address32_stream ( 637acpi_rs_address32_stream(struct acpi_resource *linked_list,
646 struct acpi_resource *linked_list, 638 u8 ** output_buffer, acpi_size * bytes_consumed)
647 u8 **output_buffer,
648 acpi_size *bytes_consumed)
649{ 639{
650 u8 *buffer; 640 u8 *buffer;
651 u16 *length_field; 641 u16 *length_field;
652 u8 temp8; 642 u8 temp8;
653 char *temp_pointer; 643 char *temp_pointer;
654
655
656 ACPI_FUNCTION_TRACE ("rs_address32_stream");
657 644
645 ACPI_FUNCTION_TRACE("rs_address32_stream");
658 646
659 buffer = *output_buffer; 647 buffer = *output_buffer;
660 648
@@ -665,7 +653,7 @@ acpi_rs_address32_stream (
665 653
666 /* Set a pointer to the Length field - to be filled in later */ 654 /* Set a pointer to the Length field - to be filled in later */
667 655
668 length_field = ACPI_CAST_PTR (u16, buffer); 656 length_field = ACPI_CAST_PTR(u16, buffer);
669 buffer += 2; 657 buffer += 2;
670 658
671 /* Set the Resource Type (Memory, Io, bus_number) */ 659 /* Set the Resource Type (Memory, Io, bus_number) */
@@ -691,20 +679,19 @@ acpi_rs_address32_stream (
691 679
692 if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) { 680 if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) {
693 temp8 = (u8) 681 temp8 = (u8)
694 (linked_list->data.address32.attribute.memory.read_write_attribute & 682 (linked_list->data.address32.attribute.memory.
695 0x01); 683 read_write_attribute & 0x01);
696 684
697 temp8 |= 685 temp8 |=
698 (linked_list->data.address32.attribute.memory.cache_attribute & 686 (linked_list->data.address32.attribute.memory.
699 0x03) << 1; 687 cache_attribute & 0x03) << 1;
700 } 688 } else if (ACPI_IO_RANGE == linked_list->data.address32.resource_type) {
701 else if (ACPI_IO_RANGE == linked_list->data.address32.resource_type) {
702 temp8 = (u8) 689 temp8 = (u8)
703 (linked_list->data.address32.attribute.io.range_attribute & 690 (linked_list->data.address32.attribute.io.range_attribute &
704 0x03); 691 0x03);
705 temp8 |= 692 temp8 |=
706 (linked_list->data.address32.attribute.io.translation_attribute & 693 (linked_list->data.address32.attribute.io.
707 0x03) << 4; 694 translation_attribute & 0x03) << 4;
708 } 695 }
709 696
710 *buffer = temp8; 697 *buffer = temp8;
@@ -712,28 +699,31 @@ acpi_rs_address32_stream (
712 699
713 /* Set the address space granularity */ 700 /* Set the address space granularity */
714 701
715 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity); 702 ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.granularity);
716 buffer += 4; 703 buffer += 4;
717 704
718 /* Set the address range minimum */ 705 /* Set the address range minimum */
719 706
720 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range); 707 ACPI_MOVE_32_TO_32(buffer,
708 &linked_list->data.address32.min_address_range);
721 buffer += 4; 709 buffer += 4;
722 710
723 /* Set the address range maximum */ 711 /* Set the address range maximum */
724 712
725 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range); 713 ACPI_MOVE_32_TO_32(buffer,
714 &linked_list->data.address32.max_address_range);
726 buffer += 4; 715 buffer += 4;
727 716
728 /* Set the address translation offset */ 717 /* Set the address translation offset */
729 718
730 ACPI_MOVE_32_TO_32 (buffer, 719 ACPI_MOVE_32_TO_32(buffer,
731 &linked_list->data.address32.address_translation_offset); 720 &linked_list->data.address32.
721 address_translation_offset);
732 buffer += 4; 722 buffer += 4;
733 723
734 /* Set the address length */ 724 /* Set the address length */
735 725
736 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length); 726 ACPI_MOVE_32_TO_32(buffer, &linked_list->data.address32.address_length);
737 buffer += 4; 727 buffer += 4;
738 728
739 /* Resource Source Index and Resource Source are optional */ 729 /* Resource Source Index and Resource Source are optional */
@@ -744,34 +734,36 @@ acpi_rs_address32_stream (
744 *buffer = temp8; 734 *buffer = temp8;
745 buffer += 1; 735 buffer += 1;
746 736
747 temp_pointer = (char *) buffer; 737 temp_pointer = (char *)buffer;
748 738
749 /* Copy the string */ 739 /* Copy the string */
750 740
751 ACPI_STRCPY (temp_pointer, 741 ACPI_STRCPY(temp_pointer,
752 linked_list->data.address32.resource_source.string_ptr); 742 linked_list->data.address32.resource_source.
743 string_ptr);
753 744
754 /* 745 /*
755 * Buffer needs to be set to the length of the sting + one for the 746 * Buffer needs to be set to the length of the sting + one for the
756 * terminating null 747 * terminating null
757 */ 748 */
758 buffer += (acpi_size)(ACPI_STRLEN ( 749 buffer +=
759 linked_list->data.address32.resource_source.string_ptr) + 1); 750 (acpi_size) (ACPI_STRLEN
751 (linked_list->data.address32.resource_source.
752 string_ptr) + 1);
760 } 753 }
761 754
762 /* Return the number of bytes consumed in this operation */ 755 /* Return the number of bytes consumed in this operation */
763 756
764 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 757 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
765 758
766 /* 759 /*
767 * Set the length field to the number of bytes consumed 760 * Set the length field to the number of bytes consumed
768 * minus the header size (3 bytes) 761 * minus the header size (3 bytes)
769 */ 762 */
770 *length_field = (u16) (*bytes_consumed - 3); 763 *length_field = (u16) (*bytes_consumed - 3);
771 return_ACPI_STATUS (AE_OK); 764 return_ACPI_STATUS(AE_OK);
772} 765}
773 766
774
775/******************************************************************************* 767/*******************************************************************************
776 * 768 *
777 * FUNCTION: acpi_rs_address64_resource 769 * FUNCTION: acpi_rs_address64_resource
@@ -794,38 +786,34 @@ acpi_rs_address32_stream (
794 ******************************************************************************/ 786 ******************************************************************************/
795 787
796acpi_status 788acpi_status
797acpi_rs_address64_resource ( 789acpi_rs_address64_resource(u8 * byte_stream_buffer,
798 u8 *byte_stream_buffer, 790 acpi_size * bytes_consumed,
799 acpi_size *bytes_consumed, 791 u8 ** output_buffer, acpi_size * structure_size)
800 u8 **output_buffer,
801 acpi_size *structure_size)
802{ 792{
803 u8 *buffer; 793 u8 *buffer;
804 struct acpi_resource *output_struct = (void *) *output_buffer; 794 struct acpi_resource *output_struct = (void *)*output_buffer;
805 u16 temp16; 795 u16 temp16;
806 u8 temp8; 796 u8 temp8;
807 u8 resource_type; 797 u8 resource_type;
808 u8 *temp_ptr; 798 u8 *temp_ptr;
809 acpi_size struct_size; 799 acpi_size struct_size;
810 u32 index; 800 u32 index;
811
812
813 ACPI_FUNCTION_TRACE ("rs_address64_resource");
814 801
802 ACPI_FUNCTION_TRACE("rs_address64_resource");
815 803
816 buffer = byte_stream_buffer; 804 buffer = byte_stream_buffer;
817 struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64); 805 struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64);
818 resource_type = *buffer; 806 resource_type = *buffer;
819 807
820 /* Point past the Descriptor to get the number of bytes consumed */ 808 /* Point past the Descriptor to get the number of bytes consumed */
821 809
822 buffer += 1; 810 buffer += 1;
823 ACPI_MOVE_16_TO_16 (&temp16, buffer); 811 ACPI_MOVE_16_TO_16(&temp16, buffer);
824 812
825 /* Validate minimum descriptor length */ 813 /* Validate minimum descriptor length */
826 814
827 if (temp16 < 43) { 815 if (temp16 < 43) {
828 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); 816 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
829 } 817 }
830 818
831 *bytes_consumed = temp16 + 3; 819 *bytes_consumed = temp16 + 3;
@@ -839,7 +827,7 @@ acpi_rs_address64_resource (
839 /* Values 0-2 and 0xC0-0xFF are valid */ 827 /* Values 0-2 and 0xC0-0xFF are valid */
840 828
841 if ((temp8 > 2) && (temp8 < 0xC0)) { 829 if ((temp8 > 2) && (temp8 < 0xC0)) {
842 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); 830 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
843 } 831 }
844 832
845 output_struct->data.address64.resource_type = temp8; 833 output_struct->data.address64.resource_type = temp8;
@@ -871,20 +859,19 @@ acpi_rs_address64_resource (
871 temp8 = *buffer; 859 temp8 = *buffer;
872 860
873 if (ACPI_MEMORY_RANGE == output_struct->data.address64.resource_type) { 861 if (ACPI_MEMORY_RANGE == output_struct->data.address64.resource_type) {
874 output_struct->data.address64.attribute.memory.read_write_attribute = 862 output_struct->data.address64.attribute.memory.
875 (u16) (temp8 & 0x01); 863 read_write_attribute = (u16) (temp8 & 0x01);
876 864
877 output_struct->data.address64.attribute.memory.cache_attribute = 865 output_struct->data.address64.attribute.memory.cache_attribute =
878 (u16) ((temp8 >> 1) & 0x03); 866 (u16) ((temp8 >> 1) & 0x03);
879 } 867 } else {
880 else { 868 if (ACPI_IO_RANGE ==
881 if (ACPI_IO_RANGE == output_struct->data.address64.resource_type) { 869 output_struct->data.address64.resource_type) {
882 output_struct->data.address64.attribute.io.range_attribute = 870 output_struct->data.address64.attribute.io.
883 (u16) (temp8 & 0x03); 871 range_attribute = (u16) (temp8 & 0x03);
884 output_struct->data.address64.attribute.io.translation_attribute = 872 output_struct->data.address64.attribute.io.
885 (u16) ((temp8 >> 4) & 0x03); 873 translation_attribute = (u16) ((temp8 >> 4) & 0x03);
886 } 874 } else {
887 else {
888 /* BUS_NUMBER_RANGE == output_struct->Data.Address64.resource_type */ 875 /* BUS_NUMBER_RANGE == output_struct->Data.Address64.resource_type */
889 /* Nothing needs to be filled in */ 876 /* Nothing needs to be filled in */
890 } 877 }
@@ -899,28 +886,31 @@ acpi_rs_address64_resource (
899 /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */ 886 /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */
900 887
901 buffer += 1; 888 buffer += 1;
902 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer); 889 ACPI_MOVE_64_TO_64(&output_struct->data.address64.granularity, buffer);
903 890
904 /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */ 891 /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */
905 892
906 buffer += 8; 893 buffer += 8;
907 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer); 894 ACPI_MOVE_64_TO_64(&output_struct->data.address64.min_address_range,
895 buffer);
908 896
909 /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */ 897 /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */
910 898
911 buffer += 8; 899 buffer += 8;
912 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer); 900 ACPI_MOVE_64_TO_64(&output_struct->data.address64.max_address_range,
901 buffer);
913 902
914 /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */ 903 /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */
915 904
916 buffer += 8; 905 buffer += 8;
917 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset, 906 ACPI_MOVE_64_TO_64(&output_struct->data.address64.
918 buffer); 907 address_translation_offset, buffer);
919 908
920 /* Get address_length (Bytes 38-45) or (Bytes 40-47) */ 909 /* Get address_length (Bytes 38-45) or (Bytes 40-47) */
921 910
922 buffer += 8; 911 buffer += 8;
923 ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer); 912 ACPI_MOVE_64_TO_64(&output_struct->data.address64.address_length,
913 buffer);
924 914
925 output_struct->data.address64.resource_source.index = 0x00; 915 output_struct->data.address64.resource_source.index = 0x00;
926 output_struct->data.address64.resource_source.string_length = 0; 916 output_struct->data.address64.resource_source.string_length = 0;
@@ -930,11 +920,9 @@ acpi_rs_address64_resource (
930 /* Get type_specific_attribute (Bytes 48-55) */ 920 /* Get type_specific_attribute (Bytes 48-55) */
931 921
932 buffer += 8; 922 buffer += 8;
933 ACPI_MOVE_64_TO_64 ( 923 ACPI_MOVE_64_TO_64(&output_struct->data.address64.
934 &output_struct->data.address64.type_specific_attributes, 924 type_specific_attributes, buffer);
935 buffer); 925 } else {
936 }
937 else {
938 output_struct->data.address64.type_specific_attributes = 0; 926 output_struct->data.address64.type_specific_attributes = 0;
939 927
940 /* Resource Source Index (if present) */ 928 /* Resource Source Index (if present) */
@@ -956,7 +944,7 @@ acpi_rs_address64_resource (
956 944
957 temp8 = *buffer; 945 temp8 = *buffer;
958 output_struct->data.address64.resource_source.index = 946 output_struct->data.address64.resource_source.index =
959 (u32) temp8; 947 (u32) temp8;
960 948
961 /* Point to the String */ 949 /* Point to the String */
962 950
@@ -964,11 +952,13 @@ acpi_rs_address64_resource (
964 952
965 /* Point the String pointer to the end of this structure */ 953 /* Point the String pointer to the end of this structure */
966 954
967 output_struct->data.address64.resource_source.string_ptr = 955 output_struct->data.address64.resource_source.
968 (char *)((u8 *)output_struct + struct_size); 956 string_ptr =
957 (char *)((u8 *) output_struct + struct_size);
969 958
970 temp_ptr = (u8 *) 959 temp_ptr = (u8 *)
971 output_struct->data.address64.resource_source.string_ptr; 960 output_struct->data.address64.resource_source.
961 string_ptr;
972 962
973 /* Copy the string into the buffer */ 963 /* Copy the string into the buffer */
974 964
@@ -985,8 +975,8 @@ acpi_rs_address64_resource (
985 * Add the terminating null 975 * Add the terminating null
986 */ 976 */
987 *temp_ptr = 0x00; 977 *temp_ptr = 0x00;
988 output_struct->data.address64.resource_source.string_length = 978 output_struct->data.address64.resource_source.
989 index + 1; 979 string_length = index + 1;
990 980
991 /* 981 /*
992 * In order for the struct_size to fall on a 32-bit boundary, 982 * In order for the struct_size to fall on a 32-bit boundary,
@@ -994,7 +984,7 @@ acpi_rs_address64_resource (
994 * struct_size to the next 32-bit boundary. 984 * struct_size to the next 32-bit boundary.
995 */ 985 */
996 temp8 = (u8) (index + 1); 986 temp8 = (u8) (index + 1);
997 struct_size += ACPI_ROUND_UP_to_32_bITS (temp8); 987 struct_size += ACPI_ROUND_UP_to_32_bITS(temp8);
998 } 988 }
999 } 989 }
1000 990
@@ -1005,10 +995,9 @@ acpi_rs_address64_resource (
1005 /* Return the final size of the structure */ 995 /* Return the final size of the structure */
1006 996
1007 *structure_size = struct_size; 997 *structure_size = struct_size;
1008 return_ACPI_STATUS (AE_OK); 998 return_ACPI_STATUS(AE_OK);
1009} 999}
1010 1000
1011
1012/******************************************************************************* 1001/*******************************************************************************
1013 * 1002 *
1014 * FUNCTION: acpi_rs_address64_stream 1003 * FUNCTION: acpi_rs_address64_stream
@@ -1026,19 +1015,15 @@ acpi_rs_address64_resource (
1026 ******************************************************************************/ 1015 ******************************************************************************/
1027 1016
1028acpi_status 1017acpi_status
1029acpi_rs_address64_stream ( 1018acpi_rs_address64_stream(struct acpi_resource *linked_list,
1030 struct acpi_resource *linked_list, 1019 u8 ** output_buffer, acpi_size * bytes_consumed)
1031 u8 **output_buffer,
1032 acpi_size *bytes_consumed)
1033{ 1020{
1034 u8 *buffer; 1021 u8 *buffer;
1035 u16 *length_field; 1022 u16 *length_field;
1036 u8 temp8; 1023 u8 temp8;
1037 char *temp_pointer; 1024 char *temp_pointer;
1038
1039
1040 ACPI_FUNCTION_TRACE ("rs_address64_stream");
1041 1025
1026 ACPI_FUNCTION_TRACE("rs_address64_stream");
1042 1027
1043 buffer = *output_buffer; 1028 buffer = *output_buffer;
1044 1029
@@ -1049,7 +1034,7 @@ acpi_rs_address64_stream (
1049 1034
1050 /* Set a pointer to the Length field - to be filled in later */ 1035 /* Set a pointer to the Length field - to be filled in later */
1051 1036
1052 length_field = ACPI_CAST_PTR (u16, buffer); 1037 length_field = ACPI_CAST_PTR(u16, buffer);
1053 buffer += 2; 1038 buffer += 2;
1054 1039
1055 /* Set the Resource Type (Memory, Io, bus_number) */ 1040 /* Set the Resource Type (Memory, Io, bus_number) */
@@ -1075,20 +1060,19 @@ acpi_rs_address64_stream (
1075 1060
1076 if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) { 1061 if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) {
1077 temp8 = (u8) 1062 temp8 = (u8)
1078 (linked_list->data.address64.attribute.memory.read_write_attribute & 1063 (linked_list->data.address64.attribute.memory.
1079 0x01); 1064 read_write_attribute & 0x01);
1080 1065
1081 temp8 |= 1066 temp8 |=
1082 (linked_list->data.address64.attribute.memory.cache_attribute & 1067 (linked_list->data.address64.attribute.memory.
1083 0x03) << 1; 1068 cache_attribute & 0x03) << 1;
1084 } 1069 } else if (ACPI_IO_RANGE == linked_list->data.address64.resource_type) {
1085 else if (ACPI_IO_RANGE == linked_list->data.address64.resource_type) {
1086 temp8 = (u8) 1070 temp8 = (u8)
1087 (linked_list->data.address64.attribute.io.range_attribute & 1071 (linked_list->data.address64.attribute.io.range_attribute &
1088 0x03); 1072 0x03);
1089 temp8 |= 1073 temp8 |=
1090 (linked_list->data.address64.attribute.io.range_attribute & 1074 (linked_list->data.address64.attribute.io.range_attribute &
1091 0x03) << 4; 1075 0x03) << 4;
1092 } 1076 }
1093 1077
1094 *buffer = temp8; 1078 *buffer = temp8;
@@ -1096,28 +1080,31 @@ acpi_rs_address64_stream (
1096 1080
1097 /* Set the address space granularity */ 1081 /* Set the address space granularity */
1098 1082
1099 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity); 1083 ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.granularity);
1100 buffer += 8; 1084 buffer += 8;
1101 1085
1102 /* Set the address range minimum */ 1086 /* Set the address range minimum */
1103 1087
1104 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range); 1088 ACPI_MOVE_64_TO_64(buffer,
1089 &linked_list->data.address64.min_address_range);
1105 buffer += 8; 1090 buffer += 8;
1106 1091
1107 /* Set the address range maximum */ 1092 /* Set the address range maximum */
1108 1093
1109 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range); 1094 ACPI_MOVE_64_TO_64(buffer,
1095 &linked_list->data.address64.max_address_range);
1110 buffer += 8; 1096 buffer += 8;
1111 1097
1112 /* Set the address translation offset */ 1098 /* Set the address translation offset */
1113 1099
1114 ACPI_MOVE_64_TO_64 (buffer, 1100 ACPI_MOVE_64_TO_64(buffer,
1115 &linked_list->data.address64.address_translation_offset); 1101 &linked_list->data.address64.
1102 address_translation_offset);
1116 buffer += 8; 1103 buffer += 8;
1117 1104
1118 /* Set the address length */ 1105 /* Set the address length */
1119 1106
1120 ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length); 1107 ACPI_MOVE_64_TO_64(buffer, &linked_list->data.address64.address_length);
1121 buffer += 8; 1108 buffer += 8;
1122 1109
1123 /* Resource Source Index and Resource Source are optional */ 1110 /* Resource Source Index and Resource Source are optional */
@@ -1128,30 +1115,32 @@ acpi_rs_address64_stream (
1128 *buffer = temp8; 1115 *buffer = temp8;
1129 buffer += 1; 1116 buffer += 1;
1130 1117
1131 temp_pointer = (char *) buffer; 1118 temp_pointer = (char *)buffer;
1132 1119
1133 /* Copy the string */ 1120 /* Copy the string */
1134 1121
1135 ACPI_STRCPY (temp_pointer, 1122 ACPI_STRCPY(temp_pointer,
1136 linked_list->data.address64.resource_source.string_ptr); 1123 linked_list->data.address64.resource_source.
1124 string_ptr);
1137 1125
1138 /* 1126 /*
1139 * Buffer needs to be set to the length of the sting + one for the 1127 * Buffer needs to be set to the length of the sting + one for the
1140 * terminating null 1128 * terminating null
1141 */ 1129 */
1142 buffer += (acpi_size)(ACPI_STRLEN ( 1130 buffer +=
1143 linked_list->data.address64.resource_source.string_ptr) + 1); 1131 (acpi_size) (ACPI_STRLEN
1132 (linked_list->data.address64.resource_source.
1133 string_ptr) + 1);
1144 } 1134 }
1145 1135
1146 /* Return the number of bytes consumed in this operation */ 1136 /* Return the number of bytes consumed in this operation */
1147 1137
1148 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 1138 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
1149 1139
1150 /* 1140 /*
1151 * Set the length field to the number of bytes consumed 1141 * Set the length field to the number of bytes consumed
1152 * minus the header size (3 bytes) 1142 * minus the header size (3 bytes)
1153 */ 1143 */
1154 *length_field = (u16) (*bytes_consumed - 3); 1144 *length_field = (u16) (*bytes_consumed - 3);
1155 return_ACPI_STATUS (AE_OK); 1145 return_ACPI_STATUS(AE_OK);
1156} 1146}
1157
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c
index 98176f2fcb5d..378f58390fc1 100644
--- a/drivers/acpi/resources/rscalc.c
+++ b/drivers/acpi/resources/rscalc.c
@@ -41,15 +41,13 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acresrc.h> 45#include <acpi/acresrc.h>
47#include <acpi/amlcode.h> 46#include <acpi/amlcode.h>
48#include <acpi/acnamesp.h> 47#include <acpi/acnamesp.h>
49 48
50#define _COMPONENT ACPI_RESOURCES 49#define _COMPONENT ACPI_RESOURCES
51 ACPI_MODULE_NAME ("rscalc") 50ACPI_MODULE_NAME("rscalc")
52
53 51
54/******************************************************************************* 52/*******************************************************************************
55 * 53 *
@@ -66,19 +64,15 @@
66 * the resource data. 64 * the resource data.
67 * 65 *
68 ******************************************************************************/ 66 ******************************************************************************/
69
70acpi_status 67acpi_status
71acpi_rs_get_byte_stream_length ( 68acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list,
72 struct acpi_resource *linked_list, 69 acpi_size * size_needed)
73 acpi_size *size_needed)
74{ 70{
75 acpi_size byte_stream_size_needed = 0; 71 acpi_size byte_stream_size_needed = 0;
76 acpi_size segment_size; 72 acpi_size segment_size;
77 u8 done = FALSE; 73 u8 done = FALSE;
78
79
80 ACPI_FUNCTION_TRACE ("rs_get_byte_stream_length");
81 74
75 ACPI_FUNCTION_TRACE("rs_get_byte_stream_length");
82 76
83 while (!done) { 77 while (!done) {
84 /* Init the variable that will hold the size to add to the total. */ 78 /* Init the variable that will hold the size to add to the total. */
@@ -145,11 +139,11 @@ acpi_rs_get_byte_stream_length (
145 */ 139 */
146 if (linked_list->data.vendor_specific.length > 7) { 140 if (linked_list->data.vendor_specific.length > 7) {
147 segment_size = 3; 141 segment_size = 3;
148 } 142 } else {
149 else {
150 segment_size = 1; 143 segment_size = 1;
151 } 144 }
152 segment_size += linked_list->data.vendor_specific.length; 145 segment_size +=
146 linked_list->data.vendor_specific.length;
153 break; 147 break;
154 148
155 case ACPI_RSTYPE_END_TAG: 149 case ACPI_RSTYPE_END_TAG:
@@ -194,9 +188,11 @@ acpi_rs_get_byte_stream_length (
194 */ 188 */
195 segment_size = 16; 189 segment_size = 16;
196 190
197 if (linked_list->data.address16.resource_source.string_ptr) { 191 if (linked_list->data.address16.resource_source.
192 string_ptr) {
198 segment_size += 193 segment_size +=
199 linked_list->data.address16.resource_source.string_length; 194 linked_list->data.address16.resource_source.
195 string_length;
200 segment_size++; 196 segment_size++;
201 } 197 }
202 break; 198 break;
@@ -211,9 +207,11 @@ acpi_rs_get_byte_stream_length (
211 */ 207 */
212 segment_size = 26; 208 segment_size = 26;
213 209
214 if (linked_list->data.address32.resource_source.string_ptr) { 210 if (linked_list->data.address32.resource_source.
211 string_ptr) {
215 segment_size += 212 segment_size +=
216 linked_list->data.address32.resource_source.string_length; 213 linked_list->data.address32.resource_source.
214 string_length;
217 segment_size++; 215 segment_size++;
218 } 216 }
219 break; 217 break;
@@ -227,9 +225,11 @@ acpi_rs_get_byte_stream_length (
227 */ 225 */
228 segment_size = 46; 226 segment_size = 46;
229 227
230 if (linked_list->data.address64.resource_source.string_ptr) { 228 if (linked_list->data.address64.resource_source.
229 string_ptr) {
231 segment_size += 230 segment_size +=
232 linked_list->data.address64.resource_source.string_length; 231 linked_list->data.address64.resource_source.
232 string_length;
233 segment_size++; 233 segment_size++;
234 } 234 }
235 break; 235 break;
@@ -244,11 +244,14 @@ acpi_rs_get_byte_stream_length (
244 * Resource Source + 1 for the null. 244 * Resource Source + 1 for the null.
245 */ 245 */
246 segment_size = 9 + (((acpi_size) 246 segment_size = 9 + (((acpi_size)
247 linked_list->data.extended_irq.number_of_interrupts - 1) * 4); 247 linked_list->data.extended_irq.
248 number_of_interrupts - 1) * 4);
248 249
249 if (linked_list->data.extended_irq.resource_source.string_ptr) { 250 if (linked_list->data.extended_irq.resource_source.
251 string_ptr) {
250 segment_size += 252 segment_size +=
251 linked_list->data.extended_irq.resource_source.string_length; 253 linked_list->data.extended_irq.
254 resource_source.string_length;
252 segment_size++; 255 segment_size++;
253 } 256 }
254 break; 257 break;
@@ -257,9 +260,9 @@ acpi_rs_get_byte_stream_length (
257 260
258 /* If we get here, everything is out of sync, exit with error */ 261 /* If we get here, everything is out of sync, exit with error */
259 262
260 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); 263 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
261 264
262 } /* switch (linked_list->Id) */ 265 } /* switch (linked_list->Id) */
263 266
264 /* Update the total */ 267 /* Update the total */
265 268
@@ -267,17 +270,16 @@ acpi_rs_get_byte_stream_length (
267 270
268 /* Point to the next object */ 271 /* Point to the next object */
269 272
270 linked_list = ACPI_PTR_ADD (struct acpi_resource, 273 linked_list = ACPI_PTR_ADD(struct acpi_resource,
271 linked_list, linked_list->length); 274 linked_list, linked_list->length);
272 } 275 }
273 276
274 /* This is the data the caller needs */ 277 /* This is the data the caller needs */
275 278
276 *size_needed = byte_stream_size_needed; 279 *size_needed = byte_stream_size_needed;
277 return_ACPI_STATUS (AE_OK); 280 return_ACPI_STATUS(AE_OK);
278} 281}
279 282
280
281/******************************************************************************* 283/*******************************************************************************
282 * 284 *
283 * FUNCTION: acpi_rs_get_list_length 285 * FUNCTION: acpi_rs_get_list_length
@@ -297,32 +299,28 @@ acpi_rs_get_byte_stream_length (
297 ******************************************************************************/ 299 ******************************************************************************/
298 300
299acpi_status 301acpi_status
300acpi_rs_get_list_length ( 302acpi_rs_get_list_length(u8 * byte_stream_buffer,
301 u8 *byte_stream_buffer, 303 u32 byte_stream_buffer_length, acpi_size * size_needed)
302 u32 byte_stream_buffer_length,
303 acpi_size *size_needed)
304{ 304{
305 u32 buffer_size = 0; 305 u32 buffer_size = 0;
306 u32 bytes_parsed = 0; 306 u32 bytes_parsed = 0;
307 u8 number_of_interrupts = 0; 307 u8 number_of_interrupts = 0;
308 u8 number_of_channels = 0; 308 u8 number_of_channels = 0;
309 u8 resource_type; 309 u8 resource_type;
310 u32 structure_size; 310 u32 structure_size;
311 u32 bytes_consumed; 311 u32 bytes_consumed;
312 u8 *buffer; 312 u8 *buffer;
313 u8 temp8; 313 u8 temp8;
314 u16 temp16; 314 u16 temp16;
315 u8 index; 315 u8 index;
316 u8 additional_bytes; 316 u8 additional_bytes;
317 317
318 318 ACPI_FUNCTION_TRACE("rs_get_list_length");
319 ACPI_FUNCTION_TRACE ("rs_get_list_length");
320
321 319
322 while (bytes_parsed < byte_stream_buffer_length) { 320 while (bytes_parsed < byte_stream_buffer_length) {
323 /* The next byte in the stream is the resource type */ 321 /* The next byte in the stream is the resource type */
324 322
325 resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); 323 resource_type = acpi_rs_get_resource_type(*byte_stream_buffer);
326 324
327 switch (resource_type) { 325 switch (resource_type) {
328 case ACPI_RDESC_TYPE_MEMORY_24: 326 case ACPI_RDESC_TYPE_MEMORY_24:
@@ -331,10 +329,10 @@ acpi_rs_get_list_length (
331 */ 329 */
332 bytes_consumed = 12; 330 bytes_consumed = 12;
333 331
334 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem24); 332 structure_size =
333 ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24);
335 break; 334 break;
336 335
337
338 case ACPI_RDESC_TYPE_LARGE_VENDOR: 336 case ACPI_RDESC_TYPE_LARGE_VENDOR:
339 /* 337 /*
340 * Vendor Defined Resource 338 * Vendor Defined Resource
@@ -342,38 +340,39 @@ acpi_rs_get_list_length (
342 buffer = byte_stream_buffer; 340 buffer = byte_stream_buffer;
343 ++buffer; 341 ++buffer;
344 342
345 ACPI_MOVE_16_TO_16 (&temp16, buffer); 343 ACPI_MOVE_16_TO_16(&temp16, buffer);
346 bytes_consumed = temp16 + 3; 344 bytes_consumed = temp16 + 3;
347 345
348 /* Ensure a 32-bit boundary for the structure */ 346 /* Ensure a 32-bit boundary for the structure */
349 347
350 temp16 = (u16) ACPI_ROUND_UP_to_32_bITS (temp16); 348 temp16 = (u16) ACPI_ROUND_UP_to_32_bITS(temp16);
351 349
352 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + 350 structure_size =
353 (temp16 * sizeof (u8)); 351 ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) +
352 (temp16 * sizeof(u8));
354 break; 353 break;
355 354
356
357 case ACPI_RDESC_TYPE_MEMORY_32: 355 case ACPI_RDESC_TYPE_MEMORY_32:
358 /* 356 /*
359 * 32-Bit Memory Range Resource 357 * 32-Bit Memory Range Resource
360 */ 358 */
361 bytes_consumed = 20; 359 bytes_consumed = 20;
362 360
363 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_mem32); 361 structure_size =
362 ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32);
364 break; 363 break;
365 364
366
367 case ACPI_RDESC_TYPE_FIXED_MEMORY_32: 365 case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
368 /* 366 /*
369 * 32-Bit Fixed Memory Resource 367 * 32-Bit Fixed Memory Resource
370 */ 368 */
371 bytes_consumed = 12; 369 bytes_consumed = 12;
372 370
373 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_mem32); 371 structure_size =
372 ACPI_SIZEOF_RESOURCE(struct
373 acpi_resource_fixed_mem32);
374 break; 374 break;
375 375
376
377 case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE: 376 case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE:
378 /* 377 /*
379 * 64-Bit Address Resource 378 * 64-Bit Address Resource
@@ -381,13 +380,14 @@ acpi_rs_get_list_length (
381 buffer = byte_stream_buffer; 380 buffer = byte_stream_buffer;
382 381
383 ++buffer; 382 ++buffer;
384 ACPI_MOVE_16_TO_16 (&temp16, buffer); 383 ACPI_MOVE_16_TO_16(&temp16, buffer);
385 384
386 bytes_consumed = temp16 + 3; 385 bytes_consumed = temp16 + 3;
387 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64); 386 structure_size =
387 ACPI_SIZEOF_RESOURCE(struct
388 acpi_resource_address64);
388 break; 389 break;
389 390
390
391 case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: 391 case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
392 /* 392 /*
393 * 64-Bit Address Resource 393 * 64-Bit Address Resource
@@ -395,7 +395,7 @@ acpi_rs_get_list_length (
395 buffer = byte_stream_buffer; 395 buffer = byte_stream_buffer;
396 396
397 ++buffer; 397 ++buffer;
398 ACPI_MOVE_16_TO_16 (&temp16, buffer); 398 ACPI_MOVE_16_TO_16(&temp16, buffer);
399 399
400 bytes_consumed = temp16 + 3; 400 bytes_consumed = temp16 + 3;
401 401
@@ -409,20 +409,19 @@ acpi_rs_get_list_length (
409 */ 409 */
410 if (43 < temp16) { 410 if (43 < temp16) {
411 temp8 = (u8) (temp16 - 44); 411 temp8 = (u8) (temp16 - 44);
412 } 412 } else {
413 else {
414 temp8 = 0; 413 temp8 = 0;
415 } 414 }
416 415
417 /* Ensure a 64-bit boundary for the structure */ 416 /* Ensure a 64-bit boundary for the structure */
418 417
419 temp8 = (u8) ACPI_ROUND_UP_to_64_bITS (temp8); 418 temp8 = (u8) ACPI_ROUND_UP_to_64_bITS(temp8);
420 419
421 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64) + 420 structure_size =
422 (temp8 * sizeof (u8)); 421 ACPI_SIZEOF_RESOURCE(struct acpi_resource_address64)
422 + (temp8 * sizeof(u8));
423 break; 423 break;
424 424
425
426 case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: 425 case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
427 /* 426 /*
428 * 32-Bit Address Resource 427 * 32-Bit Address Resource
@@ -430,7 +429,7 @@ acpi_rs_get_list_length (
430 buffer = byte_stream_buffer; 429 buffer = byte_stream_buffer;
431 430
432 ++buffer; 431 ++buffer;
433 ACPI_MOVE_16_TO_16 (&temp16, buffer); 432 ACPI_MOVE_16_TO_16(&temp16, buffer);
434 433
435 bytes_consumed = temp16 + 3; 434 bytes_consumed = temp16 + 3;
436 435
@@ -444,20 +443,19 @@ acpi_rs_get_list_length (
444 */ 443 */
445 if (23 < temp16) { 444 if (23 < temp16) {
446 temp8 = (u8) (temp16 - 24); 445 temp8 = (u8) (temp16 - 24);
447 } 446 } else {
448 else {
449 temp8 = 0; 447 temp8 = 0;
450 } 448 }
451 449
452 /* Ensure a 32-bit boundary for the structure */ 450 /* Ensure a 32-bit boundary for the structure */
453 451
454 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); 452 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8);
455 453
456 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32) + 454 structure_size =
457 (temp8 * sizeof (u8)); 455 ACPI_SIZEOF_RESOURCE(struct acpi_resource_address32)
456 + (temp8 * sizeof(u8));
458 break; 457 break;
459 458
460
461 case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: 459 case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
462 /* 460 /*
463 * 16-Bit Address Resource 461 * 16-Bit Address Resource
@@ -465,7 +463,7 @@ acpi_rs_get_list_length (
465 buffer = byte_stream_buffer; 463 buffer = byte_stream_buffer;
466 464
467 ++buffer; 465 ++buffer;
468 ACPI_MOVE_16_TO_16 (&temp16, buffer); 466 ACPI_MOVE_16_TO_16(&temp16, buffer);
469 467
470 bytes_consumed = temp16 + 3; 468 bytes_consumed = temp16 + 3;
471 469
@@ -479,20 +477,19 @@ acpi_rs_get_list_length (
479 */ 477 */
480 if (13 < temp16) { 478 if (13 < temp16) {
481 temp8 = (u8) (temp16 - 14); 479 temp8 = (u8) (temp16 - 14);
482 } 480 } else {
483 else {
484 temp8 = 0; 481 temp8 = 0;
485 } 482 }
486 483
487 /* Ensure a 32-bit boundary for the structure */ 484 /* Ensure a 32-bit boundary for the structure */
488 485
489 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); 486 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8);
490 487
491 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16) + 488 structure_size =
492 (temp8 * sizeof (u8)); 489 ACPI_SIZEOF_RESOURCE(struct acpi_resource_address16)
490 + (temp8 * sizeof(u8));
493 break; 491 break;
494 492
495
496 case ACPI_RDESC_TYPE_EXTENDED_XRUPT: 493 case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
497 /* 494 /*
498 * Extended IRQ 495 * Extended IRQ
@@ -500,7 +497,7 @@ acpi_rs_get_list_length (
500 buffer = byte_stream_buffer; 497 buffer = byte_stream_buffer;
501 498
502 ++buffer; 499 ++buffer;
503 ACPI_MOVE_16_TO_16 (&temp16, buffer); 500 ACPI_MOVE_16_TO_16(&temp16, buffer);
504 501
505 bytes_consumed = temp16 + 3; 502 bytes_consumed = temp16 + 3;
506 503
@@ -527,21 +524,20 @@ acpi_rs_get_list_length (
527 */ 524 */
528 if (9 + additional_bytes < temp16) { 525 if (9 + additional_bytes < temp16) {
529 temp8 = (u8) (temp16 - (9 + additional_bytes)); 526 temp8 = (u8) (temp16 - (9 + additional_bytes));
530 } 527 } else {
531 else {
532 temp8 = 0; 528 temp8 = 0;
533 } 529 }
534 530
535 /* Ensure a 32-bit boundary for the structure */ 531 /* Ensure a 32-bit boundary for the structure */
536 532
537 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); 533 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8);
538 534
539 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq) + 535 structure_size =
540 (additional_bytes * sizeof (u8)) + 536 ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq) +
541 (temp8 * sizeof (u8)); 537 (additional_bytes * sizeof(u8)) +
538 (temp8 * sizeof(u8));
542 break; 539 break;
543 540
544
545 case ACPI_RDESC_TYPE_IRQ_FORMAT: 541 case ACPI_RDESC_TYPE_IRQ_FORMAT:
546 /* 542 /*
547 * IRQ Resource. 543 * IRQ Resource.
@@ -550,10 +546,9 @@ acpi_rs_get_list_length (
550 buffer = byte_stream_buffer; 546 buffer = byte_stream_buffer;
551 temp8 = *buffer; 547 temp8 = *buffer;
552 548
553 if(temp8 & 0x01) { 549 if (temp8 & 0x01) {
554 bytes_consumed = 4; 550 bytes_consumed = 4;
555 } 551 } else {
556 else {
557 bytes_consumed = 3; 552 bytes_consumed = 3;
558 } 553 }
559 554
@@ -563,7 +558,7 @@ acpi_rs_get_list_length (
563 558
564 /* Look at the number of bits set */ 559 /* Look at the number of bits set */
565 560
566 ACPI_MOVE_16_TO_16 (&temp16, buffer); 561 ACPI_MOVE_16_TO_16(&temp16, buffer);
567 562
568 for (index = 0; index < 16; index++) { 563 for (index = 0; index < 16; index++) {
569 if (temp16 & 0x1) { 564 if (temp16 & 0x1) {
@@ -573,11 +568,11 @@ acpi_rs_get_list_length (
573 temp16 >>= 1; 568 temp16 >>= 1;
574 } 569 }
575 570
576 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_io) + 571 structure_size =
577 (number_of_interrupts * sizeof (u32)); 572 ACPI_SIZEOF_RESOURCE(struct acpi_resource_io) +
573 (number_of_interrupts * sizeof(u32));
578 break; 574 break;
579 575
580
581 case ACPI_RDESC_TYPE_DMA_FORMAT: 576 case ACPI_RDESC_TYPE_DMA_FORMAT:
582 /* 577 /*
583 * DMA Resource 578 * DMA Resource
@@ -593,19 +588,19 @@ acpi_rs_get_list_length (
593 588
594 temp8 = *buffer; 589 temp8 = *buffer;
595 590
596 for(index = 0; index < 8; index++) { 591 for (index = 0; index < 8; index++) {
597 if(temp8 & 0x1) { 592 if (temp8 & 0x1) {
598 ++number_of_channels; 593 ++number_of_channels;
599 } 594 }
600 595
601 temp8 >>= 1; 596 temp8 >>= 1;
602 } 597 }
603 598
604 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_dma) + 599 structure_size =
605 (number_of_channels * sizeof (u32)); 600 ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma) +
601 (number_of_channels * sizeof(u32));
606 break; 602 break;
607 603
608
609 case ACPI_RDESC_TYPE_START_DEPENDENT: 604 case ACPI_RDESC_TYPE_START_DEPENDENT:
610 /* 605 /*
611 * Start Dependent Functions Resource 606 * Start Dependent Functions Resource
@@ -614,17 +609,17 @@ acpi_rs_get_list_length (
614 buffer = byte_stream_buffer; 609 buffer = byte_stream_buffer;
615 temp8 = *buffer; 610 temp8 = *buffer;
616 611
617 if(temp8 & 0x01) { 612 if (temp8 & 0x01) {
618 bytes_consumed = 2; 613 bytes_consumed = 2;
619 } 614 } else {
620 else {
621 bytes_consumed = 1; 615 bytes_consumed = 1;
622 } 616 }
623 617
624 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_start_dpf); 618 structure_size =
619 ACPI_SIZEOF_RESOURCE(struct
620 acpi_resource_start_dpf);
625 break; 621 break;
626 622
627
628 case ACPI_RDESC_TYPE_END_DEPENDENT: 623 case ACPI_RDESC_TYPE_END_DEPENDENT:
629 /* 624 /*
630 * End Dependent Functions Resource 625 * End Dependent Functions Resource
@@ -633,25 +628,24 @@ acpi_rs_get_list_length (
633 structure_size = ACPI_RESOURCE_LENGTH; 628 structure_size = ACPI_RESOURCE_LENGTH;
634 break; 629 break;
635 630
636
637 case ACPI_RDESC_TYPE_IO_PORT: 631 case ACPI_RDESC_TYPE_IO_PORT:
638 /* 632 /*
639 * IO Port Resource 633 * IO Port Resource
640 */ 634 */
641 bytes_consumed = 8; 635 bytes_consumed = 8;
642 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_io); 636 structure_size =
637 ACPI_SIZEOF_RESOURCE(struct acpi_resource_io);
643 break; 638 break;
644 639
645
646 case ACPI_RDESC_TYPE_FIXED_IO_PORT: 640 case ACPI_RDESC_TYPE_FIXED_IO_PORT:
647 /* 641 /*
648 * Fixed IO Port Resource 642 * Fixed IO Port Resource
649 */ 643 */
650 bytes_consumed = 4; 644 bytes_consumed = 4;
651 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_fixed_io); 645 structure_size =
646 ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io);
652 break; 647 break;
653 648
654
655 case ACPI_RDESC_TYPE_SMALL_VENDOR: 649 case ACPI_RDESC_TYPE_SMALL_VENDOR:
656 /* 650 /*
657 * Vendor Specific Resource 651 * Vendor Specific Resource
@@ -664,12 +658,12 @@ acpi_rs_get_list_length (
664 658
665 /* Ensure a 32-bit boundary for the structure */ 659 /* Ensure a 32-bit boundary for the structure */
666 660
667 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); 661 temp8 = (u8) ACPI_ROUND_UP_to_32_bITS(temp8);
668 structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + 662 structure_size =
669 (temp8 * sizeof (u8)); 663 ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor) +
664 (temp8 * sizeof(u8));
670 break; 665 break;
671 666
672
673 case ACPI_RDESC_TYPE_END_TAG: 667 case ACPI_RDESC_TYPE_END_TAG:
674 /* 668 /*
675 * End Tag 669 * End Tag
@@ -679,18 +673,17 @@ acpi_rs_get_list_length (
679 byte_stream_buffer_length = bytes_parsed; 673 byte_stream_buffer_length = bytes_parsed;
680 break; 674 break;
681 675
682
683 default: 676 default:
684 /* 677 /*
685 * If we get here, everything is out of sync, 678 * If we get here, everything is out of sync,
686 * exit with an error 679 * exit with an error
687 */ 680 */
688 return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); 681 return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE);
689 } 682 }
690 683
691 /* Update the return value and counter */ 684 /* Update the return value and counter */
692 685
693 buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE (structure_size); 686 buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE(structure_size);
694 bytes_parsed += bytes_consumed; 687 bytes_parsed += bytes_consumed;
695 688
696 /* Set the byte stream to point to the next resource */ 689 /* Set the byte stream to point to the next resource */
@@ -701,10 +694,9 @@ acpi_rs_get_list_length (
701 /* This is the data the caller needs */ 694 /* This is the data the caller needs */
702 695
703 *size_needed = buffer_size; 696 *size_needed = buffer_size;
704 return_ACPI_STATUS (AE_OK); 697 return_ACPI_STATUS(AE_OK);
705} 698}
706 699
707
708/******************************************************************************* 700/*******************************************************************************
709 * 701 *
710 * FUNCTION: acpi_rs_get_pci_routing_table_length 702 * FUNCTION: acpi_rs_get_pci_routing_table_length
@@ -723,22 +715,19 @@ acpi_rs_get_list_length (
723 ******************************************************************************/ 715 ******************************************************************************/
724 716
725acpi_status 717acpi_status
726acpi_rs_get_pci_routing_table_length ( 718acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
727 union acpi_operand_object *package_object, 719 acpi_size * buffer_size_needed)
728 acpi_size *buffer_size_needed)
729{ 720{
730 u32 number_of_elements; 721 u32 number_of_elements;
731 acpi_size temp_size_needed = 0; 722 acpi_size temp_size_needed = 0;
732 union acpi_operand_object **top_object_list; 723 union acpi_operand_object **top_object_list;
733 u32 index; 724 u32 index;
734 union acpi_operand_object *package_element; 725 union acpi_operand_object *package_element;
735 union acpi_operand_object **sub_object_list; 726 union acpi_operand_object **sub_object_list;
736 u8 name_found; 727 u8 name_found;
737 u32 table_index; 728 u32 table_index;
738
739
740 ACPI_FUNCTION_TRACE ("rs_get_pci_routing_table_length");
741 729
730 ACPI_FUNCTION_TRACE("rs_get_pci_routing_table_length");
742 731
743 number_of_elements = package_object->package.count; 732 number_of_elements = package_object->package.count;
744 733
@@ -769,53 +758,51 @@ acpi_rs_get_pci_routing_table_length (
769 758
770 name_found = FALSE; 759 name_found = FALSE;
771 760
772 for (table_index = 0; table_index < 4 && !name_found; table_index++) { 761 for (table_index = 0; table_index < 4 && !name_found;
762 table_index++) {
773 if ((ACPI_TYPE_STRING == 763 if ((ACPI_TYPE_STRING ==
774 ACPI_GET_OBJECT_TYPE (*sub_object_list)) || 764 ACPI_GET_OBJECT_TYPE(*sub_object_list))
775 765 ||
776 ((ACPI_TYPE_LOCAL_REFERENCE == 766 ((ACPI_TYPE_LOCAL_REFERENCE ==
777 ACPI_GET_OBJECT_TYPE (*sub_object_list)) && 767 ACPI_GET_OBJECT_TYPE(*sub_object_list))
778 768 && ((*sub_object_list)->reference.opcode ==
779 ((*sub_object_list)->reference.opcode == 769 AML_INT_NAMEPATH_OP))) {
780 AML_INT_NAMEPATH_OP))) {
781 name_found = TRUE; 770 name_found = TRUE;
782 } 771 } else {
783 else {
784 /* Look at the next element */ 772 /* Look at the next element */
785 773
786 sub_object_list++; 774 sub_object_list++;
787 } 775 }
788 } 776 }
789 777
790 temp_size_needed += (sizeof (struct acpi_pci_routing_table) - 4); 778 temp_size_needed += (sizeof(struct acpi_pci_routing_table) - 4);
791 779
792 /* Was a String type found? */ 780 /* Was a String type found? */
793 781
794 if (name_found) { 782 if (name_found) {
795 if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) { 783 if (ACPI_GET_OBJECT_TYPE(*sub_object_list) ==
784 ACPI_TYPE_STRING) {
796 /* 785 /*
797 * The length String.Length field does not include the 786 * The length String.Length field does not include the
798 * terminating NULL, add 1 787 * terminating NULL, add 1
799 */ 788 */
800 temp_size_needed += ((acpi_size) 789 temp_size_needed += ((acpi_size)
801 (*sub_object_list)->string.length + 1); 790 (*sub_object_list)->string.
791 length + 1);
792 } else {
793 temp_size_needed += acpi_ns_get_pathname_length((*sub_object_list)->reference.node);
802 } 794 }
803 else { 795 } else {
804 temp_size_needed += acpi_ns_get_pathname_length (
805 (*sub_object_list)->reference.node);
806 }
807 }
808 else {
809 /* 796 /*
810 * If no name was found, then this is a NULL, which is 797 * If no name was found, then this is a NULL, which is
811 * translated as a u32 zero. 798 * translated as a u32 zero.
812 */ 799 */
813 temp_size_needed += sizeof (u32); 800 temp_size_needed += sizeof(u32);
814 } 801 }
815 802
816 /* Round up the size since each element must be aligned */ 803 /* Round up the size since each element must be aligned */
817 804
818 temp_size_needed = ACPI_ROUND_UP_to_64_bITS (temp_size_needed); 805 temp_size_needed = ACPI_ROUND_UP_to_64_bITS(temp_size_needed);
819 806
820 /* Point to the next union acpi_operand_object */ 807 /* Point to the next union acpi_operand_object */
821 808
@@ -826,6 +813,7 @@ acpi_rs_get_pci_routing_table_length (
826 * Adding an extra element to the end of the list, essentially a 813 * Adding an extra element to the end of the list, essentially a
827 * NULL terminator 814 * NULL terminator
828 */ 815 */
829 *buffer_size_needed = temp_size_needed + sizeof (struct acpi_pci_routing_table); 816 *buffer_size_needed =
830 return_ACPI_STATUS (AE_OK); 817 temp_size_needed + sizeof(struct acpi_pci_routing_table);
818 return_ACPI_STATUS(AE_OK);
831} 819}
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c
index 8e0eae0d50bb..0911526b7ad8 100644
--- a/drivers/acpi/resources/rscreate.c
+++ b/drivers/acpi/resources/rscreate.c
@@ -41,15 +41,13 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acresrc.h> 45#include <acpi/acresrc.h>
47#include <acpi/amlcode.h> 46#include <acpi/amlcode.h>
48#include <acpi/acnamesp.h> 47#include <acpi/acnamesp.h>
49 48
50#define _COMPONENT ACPI_RESOURCES 49#define _COMPONENT ACPI_RESOURCES
51 ACPI_MODULE_NAME ("rscreate") 50ACPI_MODULE_NAME("rscreate")
52
53 51
54/******************************************************************************* 52/*******************************************************************************
55 * 53 *
@@ -68,24 +66,20 @@
68 * of device resources. 66 * of device resources.
69 * 67 *
70 ******************************************************************************/ 68 ******************************************************************************/
71
72acpi_status 69acpi_status
73acpi_rs_create_resource_list ( 70acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer,
74 union acpi_operand_object *byte_stream_buffer, 71 struct acpi_buffer *output_buffer)
75 struct acpi_buffer *output_buffer)
76{ 72{
77 73
78 acpi_status status; 74 acpi_status status;
79 u8 *byte_stream_start; 75 u8 *byte_stream_start;
80 acpi_size list_size_needed = 0; 76 acpi_size list_size_needed = 0;
81 u32 byte_stream_buffer_length; 77 u32 byte_stream_buffer_length;
82 78
79 ACPI_FUNCTION_TRACE("rs_create_resource_list");
83 80
84 ACPI_FUNCTION_TRACE ("rs_create_resource_list"); 81 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_buffer = %p\n",
85 82 byte_stream_buffer));
86
87 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_buffer = %p\n",
88 byte_stream_buffer));
89 83
90 /* Params already validated, so we don't re-validate here */ 84 /* Params already validated, so we don't re-validate here */
91 85
@@ -96,36 +90,39 @@ acpi_rs_create_resource_list (
96 * Pass the byte_stream_buffer into a module that can calculate 90 * Pass the byte_stream_buffer into a module that can calculate
97 * the buffer size needed for the linked list 91 * the buffer size needed for the linked list
98 */ 92 */
99 status = acpi_rs_get_list_length (byte_stream_start, byte_stream_buffer_length, 93 status =
100 &list_size_needed); 94 acpi_rs_get_list_length(byte_stream_start,
101 95 byte_stream_buffer_length,
102 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", 96 &list_size_needed);
103 status, (u32) list_size_needed)); 97
104 if (ACPI_FAILURE (status)) { 98 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n",
105 return_ACPI_STATUS (status); 99 status, (u32) list_size_needed));
100 if (ACPI_FAILURE(status)) {
101 return_ACPI_STATUS(status);
106 } 102 }
107 103
108 /* Validate/Allocate/Clear caller buffer */ 104 /* Validate/Allocate/Clear caller buffer */
109 105
110 status = acpi_ut_initialize_buffer (output_buffer, list_size_needed); 106 status = acpi_ut_initialize_buffer(output_buffer, list_size_needed);
111 if (ACPI_FAILURE (status)) { 107 if (ACPI_FAILURE(status)) {
112 return_ACPI_STATUS (status); 108 return_ACPI_STATUS(status);
113 } 109 }
114 110
115 /* Do the conversion */ 111 /* Do the conversion */
116 112
117 status = acpi_rs_byte_stream_to_list (byte_stream_start, byte_stream_buffer_length, 113 status =
118 output_buffer->pointer); 114 acpi_rs_byte_stream_to_list(byte_stream_start,
119 if (ACPI_FAILURE (status)) { 115 byte_stream_buffer_length,
120 return_ACPI_STATUS (status); 116 output_buffer->pointer);
117 if (ACPI_FAILURE(status)) {
118 return_ACPI_STATUS(status);
121 } 119 }
122 120
123 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "output_buffer %p Length %X\n", 121 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n",
124 output_buffer->pointer, (u32) output_buffer->length)); 122 output_buffer->pointer, (u32) output_buffer->length));
125 return_ACPI_STATUS (AE_OK); 123 return_ACPI_STATUS(AE_OK);
126} 124}
127 125
128
129/******************************************************************************* 126/*******************************************************************************
130 * 127 *
131 * FUNCTION: acpi_rs_create_pci_routing_table 128 * FUNCTION: acpi_rs_create_pci_routing_table
@@ -148,44 +145,41 @@ acpi_rs_create_resource_list (
148 ******************************************************************************/ 145 ******************************************************************************/
149 146
150acpi_status 147acpi_status
151acpi_rs_create_pci_routing_table ( 148acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
152 union acpi_operand_object *package_object, 149 struct acpi_buffer *output_buffer)
153 struct acpi_buffer *output_buffer)
154{ 150{
155 u8 *buffer; 151 u8 *buffer;
156 union acpi_operand_object **top_object_list; 152 union acpi_operand_object **top_object_list;
157 union acpi_operand_object **sub_object_list; 153 union acpi_operand_object **sub_object_list;
158 union acpi_operand_object *obj_desc; 154 union acpi_operand_object *obj_desc;
159 acpi_size buffer_size_needed = 0; 155 acpi_size buffer_size_needed = 0;
160 u32 number_of_elements; 156 u32 number_of_elements;
161 u32 index; 157 u32 index;
162 struct acpi_pci_routing_table *user_prt; 158 struct acpi_pci_routing_table *user_prt;
163 struct acpi_namespace_node *node; 159 struct acpi_namespace_node *node;
164 acpi_status status; 160 acpi_status status;
165 struct acpi_buffer path_buffer; 161 struct acpi_buffer path_buffer;
166 162
167 163 ACPI_FUNCTION_TRACE("rs_create_pci_routing_table");
168 ACPI_FUNCTION_TRACE ("rs_create_pci_routing_table");
169
170 164
171 /* Params already validated, so we don't re-validate here */ 165 /* Params already validated, so we don't re-validate here */
172 166
173 /* Get the required buffer length */ 167 /* Get the required buffer length */
174 168
175 status = acpi_rs_get_pci_routing_table_length (package_object, 169 status = acpi_rs_get_pci_routing_table_length(package_object,
176 &buffer_size_needed); 170 &buffer_size_needed);
177 if (ACPI_FAILURE (status)) { 171 if (ACPI_FAILURE(status)) {
178 return_ACPI_STATUS (status); 172 return_ACPI_STATUS(status);
179 } 173 }
180 174
181 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "buffer_size_needed = %X\n", 175 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "buffer_size_needed = %X\n",
182 (u32) buffer_size_needed)); 176 (u32) buffer_size_needed));
183 177
184 /* Validate/Allocate/Clear caller buffer */ 178 /* Validate/Allocate/Clear caller buffer */
185 179
186 status = acpi_ut_initialize_buffer (output_buffer, buffer_size_needed); 180 status = acpi_ut_initialize_buffer(output_buffer, buffer_size_needed);
187 if (ACPI_FAILURE (status)) { 181 if (ACPI_FAILURE(status)) {
188 return_ACPI_STATUS (status); 182 return_ACPI_STATUS(status);
189 } 183 }
190 184
191 /* 185 /*
@@ -193,10 +187,10 @@ acpi_rs_create_pci_routing_table (
193 * should be a package that in turn contains an 187 * should be a package that in turn contains an
194 * acpi_integer Address, a u8 Pin, a Name and a u8 source_index. 188 * acpi_integer Address, a u8 Pin, a Name and a u8 source_index.
195 */ 189 */
196 top_object_list = package_object->package.elements; 190 top_object_list = package_object->package.elements;
197 number_of_elements = package_object->package.count; 191 number_of_elements = package_object->package.count;
198 buffer = output_buffer->pointer; 192 buffer = output_buffer->pointer;
199 user_prt = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); 193 user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
200 194
201 for (index = 0; index < number_of_elements; index++) { 195 for (index = 0; index < number_of_elements; index++) {
202 /* 196 /*
@@ -206,31 +200,34 @@ acpi_rs_create_pci_routing_table (
206 * be zero because we cleared the return buffer earlier 200 * be zero because we cleared the return buffer earlier
207 */ 201 */
208 buffer += user_prt->length; 202 buffer += user_prt->length;
209 user_prt = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); 203 user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
210 204
211 /* 205 /*
212 * Fill in the Length field with the information we have at this point. 206 * Fill in the Length field with the information we have at this point.
213 * The minus four is to subtract the size of the u8 Source[4] member 207 * The minus four is to subtract the size of the u8 Source[4] member
214 * because it is added below. 208 * because it is added below.
215 */ 209 */
216 user_prt->length = (sizeof (struct acpi_pci_routing_table) - 4); 210 user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4);
217 211
218 /* Each element of the top-level package must also be a package */ 212 /* Each element of the top-level package must also be a package */
219 213
220 if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) { 214 if (ACPI_GET_OBJECT_TYPE(*top_object_list) != ACPI_TYPE_PACKAGE) {
221 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 215 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
222 "(PRT[%X]) Need sub-package, found %s\n", 216 "(PRT[%X]) Need sub-package, found %s\n",
223 index, acpi_ut_get_object_type_name (*top_object_list))); 217 index,
224 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 218 acpi_ut_get_object_type_name
219 (*top_object_list)));
220 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
225 } 221 }
226 222
227 /* Each sub-package must be of length 4 */ 223 /* Each sub-package must be of length 4 */
228 224
229 if ((*top_object_list)->package.count != 4) { 225 if ((*top_object_list)->package.count != 4) {
230 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 226 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
231 "(PRT[%X]) Need package of length 4, found length %d\n", 227 "(PRT[%X]) Need package of length 4, found length %d\n",
232 index, (*top_object_list)->package.count)); 228 index,
233 return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT); 229 (*top_object_list)->package.count));
230 return_ACPI_STATUS(AE_AML_PACKAGE_LIMIT);
234 } 231 }
235 232
236 /* 233 /*
@@ -243,40 +240,43 @@ acpi_rs_create_pci_routing_table (
243 /* 1) First subobject: Dereference the PRT.Address */ 240 /* 1) First subobject: Dereference the PRT.Address */
244 241
245 obj_desc = sub_object_list[0]; 242 obj_desc = sub_object_list[0];
246 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { 243 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
247 user_prt->address = obj_desc->integer.value; 244 user_prt->address = obj_desc->integer.value;
248 } 245 } else {
249 else { 246 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
250 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 247 "(PRT[%X].Address) Need Integer, found %s\n",
251 "(PRT[%X].Address) Need Integer, found %s\n", 248 index,
252 index, acpi_ut_get_object_type_name (obj_desc))); 249 acpi_ut_get_object_type_name
253 return_ACPI_STATUS (AE_BAD_DATA); 250 (obj_desc)));
251 return_ACPI_STATUS(AE_BAD_DATA);
254 } 252 }
255 253
256 /* 2) Second subobject: Dereference the PRT.Pin */ 254 /* 2) Second subobject: Dereference the PRT.Pin */
257 255
258 obj_desc = sub_object_list[1]; 256 obj_desc = sub_object_list[1];
259 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { 257 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
260 user_prt->pin = (u32) obj_desc->integer.value; 258 user_prt->pin = (u32) obj_desc->integer.value;
261 } 259 } else {
262 else { 260 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
263 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 261 "(PRT[%X].Pin) Need Integer, found %s\n",
264 "(PRT[%X].Pin) Need Integer, found %s\n", 262 index,
265 index, acpi_ut_get_object_type_name (obj_desc))); 263 acpi_ut_get_object_type_name
266 return_ACPI_STATUS (AE_BAD_DATA); 264 (obj_desc)));
265 return_ACPI_STATUS(AE_BAD_DATA);
267 } 266 }
268 267
269 /* 3) Third subobject: Dereference the PRT.source_name */ 268 /* 3) Third subobject: Dereference the PRT.source_name */
270 269
271 obj_desc = sub_object_list[2]; 270 obj_desc = sub_object_list[2];
272 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { 271 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
273 case ACPI_TYPE_LOCAL_REFERENCE: 272 case ACPI_TYPE_LOCAL_REFERENCE:
274 273
275 if (obj_desc->reference.opcode != AML_INT_NAMEPATH_OP) { 274 if (obj_desc->reference.opcode != AML_INT_NAMEPATH_OP) {
276 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 275 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
277 "(PRT[%X].Source) Need name, found reference op %X\n", 276 "(PRT[%X].Source) Need name, found reference op %X\n",
278 index, obj_desc->reference.opcode)); 277 index,
279 return_ACPI_STATUS (AE_BAD_DATA); 278 obj_desc->reference.opcode));
279 return_ACPI_STATUS(AE_BAD_DATA);
280 } 280 }
281 281
282 node = obj_desc->reference.node; 282 node = obj_desc->reference.node;
@@ -284,21 +284,23 @@ acpi_rs_create_pci_routing_table (
284 /* Use *remaining* length of the buffer as max for pathname */ 284 /* Use *remaining* length of the buffer as max for pathname */
285 285
286 path_buffer.length = output_buffer->length - 286 path_buffer.length = output_buffer->length -
287 (u32) ((u8 *) user_prt->source - 287 (u32) ((u8 *) user_prt->source -
288 (u8 *) output_buffer->pointer); 288 (u8 *) output_buffer->pointer);
289 path_buffer.pointer = user_prt->source; 289 path_buffer.pointer = user_prt->source;
290 290
291 status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer); 291 status =
292 acpi_ns_handle_to_pathname((acpi_handle) node,
293 &path_buffer);
292 294
293 /* +1 to include null terminator */ 295 /* +1 to include null terminator */
294 296
295 user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1; 297 user_prt->length +=
298 (u32) ACPI_STRLEN(user_prt->source) + 1;
296 break; 299 break;
297 300
298
299 case ACPI_TYPE_STRING: 301 case ACPI_TYPE_STRING:
300 302
301 ACPI_STRCPY (user_prt->source, obj_desc->string.pointer); 303 ACPI_STRCPY(user_prt->source, obj_desc->string.pointer);
302 304
303 /* 305 /*
304 * Add to the Length field the length of the string 306 * Add to the Length field the length of the string
@@ -307,7 +309,6 @@ acpi_rs_create_pci_routing_table (
307 user_prt->length += obj_desc->string.length + 1; 309 user_prt->length += obj_desc->string.length + 1;
308 break; 310 break;
309 311
310
311 case ACPI_TYPE_INTEGER: 312 case ACPI_TYPE_INTEGER:
312 /* 313 /*
313 * If this is a number, then the Source Name is NULL, since the 314 * If this is a number, then the Source Name is NULL, since the
@@ -315,33 +316,36 @@ acpi_rs_create_pci_routing_table (
315 * 316 *
316 * Add to the Length field the length of the u32 NULL 317 * Add to the Length field the length of the u32 NULL
317 */ 318 */
318 user_prt->length += sizeof (u32); 319 user_prt->length += sizeof(u32);
319 break; 320 break;
320 321
321
322 default: 322 default:
323 323
324 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 324 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
325 "(PRT[%X].Source) Need Ref/String/Integer, found %s\n", 325 "(PRT[%X].Source) Need Ref/String/Integer, found %s\n",
326 index, acpi_ut_get_object_type_name (obj_desc))); 326 index,
327 return_ACPI_STATUS (AE_BAD_DATA); 327 acpi_ut_get_object_type_name
328 (obj_desc)));
329 return_ACPI_STATUS(AE_BAD_DATA);
328 } 330 }
329 331
330 /* Now align the current length */ 332 /* Now align the current length */
331 333
332 user_prt->length = (u32) ACPI_ROUND_UP_to_64_bITS (user_prt->length); 334 user_prt->length =
335 (u32) ACPI_ROUND_UP_to_64_bITS(user_prt->length);
333 336
334 /* 4) Fourth subobject: Dereference the PRT.source_index */ 337 /* 4) Fourth subobject: Dereference the PRT.source_index */
335 338
336 obj_desc = sub_object_list[3]; 339 obj_desc = sub_object_list[3];
337 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { 340 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
338 user_prt->source_index = (u32) obj_desc->integer.value; 341 user_prt->source_index = (u32) obj_desc->integer.value;
339 } 342 } else {
340 else { 343 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
341 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 344 "(PRT[%X].source_index) Need Integer, found %s\n",
342 "(PRT[%X].source_index) Need Integer, found %s\n", 345 index,
343 index, acpi_ut_get_object_type_name (obj_desc))); 346 acpi_ut_get_object_type_name
344 return_ACPI_STATUS (AE_BAD_DATA); 347 (obj_desc)));
348 return_ACPI_STATUS(AE_BAD_DATA);
345 } 349 }
346 350
347 /* Point to the next union acpi_operand_object in the top level package */ 351 /* Point to the next union acpi_operand_object in the top level package */
@@ -349,12 +353,11 @@ acpi_rs_create_pci_routing_table (
349 top_object_list++; 353 top_object_list++;
350 } 354 }
351 355
352 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "output_buffer %p Length %X\n", 356 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n",
353 output_buffer->pointer, (u32) output_buffer->length)); 357 output_buffer->pointer, (u32) output_buffer->length));
354 return_ACPI_STATUS (AE_OK); 358 return_ACPI_STATUS(AE_OK);
355} 359}
356 360
357
358/******************************************************************************* 361/*******************************************************************************
359 * 362 *
360 * FUNCTION: acpi_rs_create_byte_stream 363 * FUNCTION: acpi_rs_create_byte_stream
@@ -374,19 +377,16 @@ acpi_rs_create_pci_routing_table (
374 ******************************************************************************/ 377 ******************************************************************************/
375 378
376acpi_status 379acpi_status
377acpi_rs_create_byte_stream ( 380acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer,
378 struct acpi_resource *linked_list_buffer, 381 struct acpi_buffer *output_buffer)
379 struct acpi_buffer *output_buffer)
380{ 382{
381 acpi_status status; 383 acpi_status status;
382 acpi_size byte_stream_size_needed = 0; 384 acpi_size byte_stream_size_needed = 0;
383
384
385 ACPI_FUNCTION_TRACE ("rs_create_byte_stream");
386 385
386 ACPI_FUNCTION_TRACE("rs_create_byte_stream");
387 387
388 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "linked_list_buffer = %p\n", 388 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n",
389 linked_list_buffer)); 389 linked_list_buffer));
390 390
391 /* 391 /*
392 * Params already validated, so we don't re-validate here 392 * Params already validated, so we don't re-validate here
@@ -394,32 +394,35 @@ acpi_rs_create_byte_stream (
394 * Pass the linked_list_buffer into a module that calculates 394 * Pass the linked_list_buffer into a module that calculates
395 * the buffer size needed for the byte stream. 395 * the buffer size needed for the byte stream.
396 */ 396 */
397 status = acpi_rs_get_byte_stream_length (linked_list_buffer, 397 status = acpi_rs_get_byte_stream_length(linked_list_buffer,
398 &byte_stream_size_needed); 398 &byte_stream_size_needed);
399 399
400 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n", 400 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n",
401 (u32) byte_stream_size_needed, acpi_format_exception (status))); 401 (u32) byte_stream_size_needed,
402 if (ACPI_FAILURE (status)) { 402 acpi_format_exception(status)));
403 return_ACPI_STATUS (status); 403 if (ACPI_FAILURE(status)) {
404 return_ACPI_STATUS(status);
404 } 405 }
405 406
406 /* Validate/Allocate/Clear caller buffer */ 407 /* Validate/Allocate/Clear caller buffer */
407 408
408 status = acpi_ut_initialize_buffer (output_buffer, byte_stream_size_needed); 409 status =
409 if (ACPI_FAILURE (status)) { 410 acpi_ut_initialize_buffer(output_buffer, byte_stream_size_needed);
410 return_ACPI_STATUS (status); 411 if (ACPI_FAILURE(status)) {
412 return_ACPI_STATUS(status);
411 } 413 }
412 414
413 /* Do the conversion */ 415 /* Do the conversion */
414 416
415 status = acpi_rs_list_to_byte_stream (linked_list_buffer, byte_stream_size_needed, 417 status =
416 output_buffer->pointer); 418 acpi_rs_list_to_byte_stream(linked_list_buffer,
417 if (ACPI_FAILURE (status)) { 419 byte_stream_size_needed,
418 return_ACPI_STATUS (status); 420 output_buffer->pointer);
421 if (ACPI_FAILURE(status)) {
422 return_ACPI_STATUS(status);
419 } 423 }
420 424
421 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "output_buffer %p Length %X\n", 425 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n",
422 output_buffer->pointer, (u32) output_buffer->length)); 426 output_buffer->pointer, (u32) output_buffer->length));
423 return_ACPI_STATUS (AE_OK); 427 return_ACPI_STATUS(AE_OK);
424} 428}
425
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c
index 2c3bb8c35741..75bd34d1783f 100644
--- a/drivers/acpi/resources/rsdump.c
+++ b/drivers/acpi/resources/rsdump.c
@@ -41,70 +41,39 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acresrc.h> 45#include <acpi/acresrc.h>
47 46
48#define _COMPONENT ACPI_RESOURCES 47#define _COMPONENT ACPI_RESOURCES
49 ACPI_MODULE_NAME ("rsdump") 48ACPI_MODULE_NAME("rsdump")
50
51 49
52#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 50#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
53
54/* Local prototypes */ 51/* Local prototypes */
52static void acpi_rs_dump_irq(union acpi_resource_data *data);
55 53
56static void 54static void acpi_rs_dump_address16(union acpi_resource_data *data);
57acpi_rs_dump_irq (
58 union acpi_resource_data *data);
59
60static void
61acpi_rs_dump_address16 (
62 union acpi_resource_data *data);
63 55
64static void 56static void acpi_rs_dump_address32(union acpi_resource_data *data);
65acpi_rs_dump_address32 (
66 union acpi_resource_data *data);
67 57
68static void 58static void acpi_rs_dump_address64(union acpi_resource_data *data);
69acpi_rs_dump_address64 (
70 union acpi_resource_data *data);
71 59
72static void 60static void acpi_rs_dump_dma(union acpi_resource_data *data);
73acpi_rs_dump_dma (
74 union acpi_resource_data *data);
75 61
76static void 62static void acpi_rs_dump_io(union acpi_resource_data *data);
77acpi_rs_dump_io (
78 union acpi_resource_data *data);
79 63
80static void 64static void acpi_rs_dump_extended_irq(union acpi_resource_data *data);
81acpi_rs_dump_extended_irq (
82 union acpi_resource_data *data);
83 65
84static void 66static void acpi_rs_dump_fixed_io(union acpi_resource_data *data);
85acpi_rs_dump_fixed_io (
86 union acpi_resource_data *data);
87 67
88static void 68static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data);
89acpi_rs_dump_fixed_memory32 (
90 union acpi_resource_data *data);
91 69
92static void 70static void acpi_rs_dump_memory24(union acpi_resource_data *data);
93acpi_rs_dump_memory24 (
94 union acpi_resource_data *data);
95 71
96static void 72static void acpi_rs_dump_memory32(union acpi_resource_data *data);
97acpi_rs_dump_memory32 (
98 union acpi_resource_data *data);
99 73
100static void 74static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data);
101acpi_rs_dump_start_depend_fns (
102 union acpi_resource_data *data);
103
104static void
105acpi_rs_dump_vendor_specific (
106 union acpi_resource_data *data);
107 75
76static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data);
108 77
109/******************************************************************************* 78/*******************************************************************************
110 * 79 *
@@ -118,39 +87,37 @@ acpi_rs_dump_vendor_specific (
118 * 87 *
119 ******************************************************************************/ 88 ******************************************************************************/
120 89
121static void 90static void acpi_rs_dump_irq(union acpi_resource_data *data)
122acpi_rs_dump_irq (
123 union acpi_resource_data *data)
124{ 91{
125 struct acpi_resource_irq *irq_data = (struct acpi_resource_irq *) data; 92 struct acpi_resource_irq *irq_data = (struct acpi_resource_irq *)data;
126 u8 index = 0; 93 u8 index = 0;
127
128
129 ACPI_FUNCTION_ENTRY ();
130 94
95 ACPI_FUNCTION_ENTRY();
131 96
132 acpi_os_printf ("IRQ Resource\n"); 97 acpi_os_printf("IRQ Resource\n");
133 98
134 acpi_os_printf (" %s Triggered\n", 99 acpi_os_printf(" %s Triggered\n",
135 ACPI_LEVEL_SENSITIVE == irq_data->edge_level ? "Level" : "Edge"); 100 ACPI_LEVEL_SENSITIVE ==
101 irq_data->edge_level ? "Level" : "Edge");
136 102
137 acpi_os_printf (" Active %s\n", 103 acpi_os_printf(" Active %s\n",
138 ACPI_ACTIVE_LOW == irq_data->active_high_low ? "Low" : "High"); 104 ACPI_ACTIVE_LOW ==
105 irq_data->active_high_low ? "Low" : "High");
139 106
140 acpi_os_printf (" %s\n", 107 acpi_os_printf(" %s\n",
141 ACPI_SHARED == irq_data->shared_exclusive ? "Shared" : "Exclusive"); 108 ACPI_SHARED ==
109 irq_data->shared_exclusive ? "Shared" : "Exclusive");
142 110
143 acpi_os_printf (" %X Interrupts ( ", irq_data->number_of_interrupts); 111 acpi_os_printf(" %X Interrupts ( ", irq_data->number_of_interrupts);
144 112
145 for (index = 0; index < irq_data->number_of_interrupts; index++) { 113 for (index = 0; index < irq_data->number_of_interrupts; index++) {
146 acpi_os_printf ("%X ", irq_data->interrupts[index]); 114 acpi_os_printf("%X ", irq_data->interrupts[index]);
147 } 115 }
148 116
149 acpi_os_printf (")\n"); 117 acpi_os_printf(")\n");
150 return; 118 return;
151} 119}
152 120
153
154/******************************************************************************* 121/*******************************************************************************
155 * 122 *
156 * FUNCTION: acpi_rs_dump_dma 123 * FUNCTION: acpi_rs_dump_dma
@@ -163,75 +130,69 @@ acpi_rs_dump_irq (
163 * 130 *
164 ******************************************************************************/ 131 ******************************************************************************/
165 132
166static void 133static void acpi_rs_dump_dma(union acpi_resource_data *data)
167acpi_rs_dump_dma (
168 union acpi_resource_data *data)
169{ 134{
170 struct acpi_resource_dma *dma_data = (struct acpi_resource_dma *) data; 135 struct acpi_resource_dma *dma_data = (struct acpi_resource_dma *)data;
171 u8 index = 0; 136 u8 index = 0;
172
173
174 ACPI_FUNCTION_ENTRY ();
175 137
138 ACPI_FUNCTION_ENTRY();
176 139
177 acpi_os_printf ("DMA Resource\n"); 140 acpi_os_printf("DMA Resource\n");
178 141
179 switch (dma_data->type) { 142 switch (dma_data->type) {
180 case ACPI_COMPATIBILITY: 143 case ACPI_COMPATIBILITY:
181 acpi_os_printf (" Compatibility mode\n"); 144 acpi_os_printf(" Compatibility mode\n");
182 break; 145 break;
183 146
184 case ACPI_TYPE_A: 147 case ACPI_TYPE_A:
185 acpi_os_printf (" Type A\n"); 148 acpi_os_printf(" Type A\n");
186 break; 149 break;
187 150
188 case ACPI_TYPE_B: 151 case ACPI_TYPE_B:
189 acpi_os_printf (" Type B\n"); 152 acpi_os_printf(" Type B\n");
190 break; 153 break;
191 154
192 case ACPI_TYPE_F: 155 case ACPI_TYPE_F:
193 acpi_os_printf (" Type F\n"); 156 acpi_os_printf(" Type F\n");
194 break; 157 break;
195 158
196 default: 159 default:
197 acpi_os_printf (" Invalid DMA type\n"); 160 acpi_os_printf(" Invalid DMA type\n");
198 break; 161 break;
199 } 162 }
200 163
201 acpi_os_printf (" %sBus Master\n", 164 acpi_os_printf(" %sBus Master\n",
202 ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a "); 165 ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a ");
203
204 166
205 switch (dma_data->transfer) { 167 switch (dma_data->transfer) {
206 case ACPI_TRANSFER_8: 168 case ACPI_TRANSFER_8:
207 acpi_os_printf (" 8-bit only transfer\n"); 169 acpi_os_printf(" 8-bit only transfer\n");
208 break; 170 break;
209 171
210 case ACPI_TRANSFER_8_16: 172 case ACPI_TRANSFER_8_16:
211 acpi_os_printf (" 8 and 16-bit transfer\n"); 173 acpi_os_printf(" 8 and 16-bit transfer\n");
212 break; 174 break;
213 175
214 case ACPI_TRANSFER_16: 176 case ACPI_TRANSFER_16:
215 acpi_os_printf (" 16 bit only transfer\n"); 177 acpi_os_printf(" 16 bit only transfer\n");
216 break; 178 break;
217 179
218 default: 180 default:
219 acpi_os_printf (" Invalid transfer preference\n"); 181 acpi_os_printf(" Invalid transfer preference\n");
220 break; 182 break;
221 } 183 }
222 184
223 acpi_os_printf (" Number of Channels: %X ( ", 185 acpi_os_printf(" Number of Channels: %X ( ",
224 dma_data->number_of_channels); 186 dma_data->number_of_channels);
225 187
226 for (index = 0; index < dma_data->number_of_channels; index++) { 188 for (index = 0; index < dma_data->number_of_channels; index++) {
227 acpi_os_printf ("%X ", dma_data->channels[index]); 189 acpi_os_printf("%X ", dma_data->channels[index]);
228 } 190 }
229 191
230 acpi_os_printf (")\n"); 192 acpi_os_printf(")\n");
231 return; 193 return;
232} 194}
233 195
234
235/******************************************************************************* 196/*******************************************************************************
236 * 197 *
237 * FUNCTION: acpi_rs_dump_start_depend_fns 198 * FUNCTION: acpi_rs_dump_start_depend_fns
@@ -244,58 +205,54 @@ acpi_rs_dump_dma (
244 * 205 *
245 ******************************************************************************/ 206 ******************************************************************************/
246 207
247static void 208static void acpi_rs_dump_start_depend_fns(union acpi_resource_data *data)
248acpi_rs_dump_start_depend_fns (
249 union acpi_resource_data *data)
250{ 209{
251 struct acpi_resource_start_dpf *sdf_data = (struct acpi_resource_start_dpf *) data; 210 struct acpi_resource_start_dpf *sdf_data =
252 211 (struct acpi_resource_start_dpf *)data;
253 212
254 ACPI_FUNCTION_ENTRY (); 213 ACPI_FUNCTION_ENTRY();
255 214
256 215 acpi_os_printf("Start Dependent Functions Resource\n");
257 acpi_os_printf ("Start Dependent Functions Resource\n");
258 216
259 switch (sdf_data->compatibility_priority) { 217 switch (sdf_data->compatibility_priority) {
260 case ACPI_GOOD_CONFIGURATION: 218 case ACPI_GOOD_CONFIGURATION:
261 acpi_os_printf (" Good configuration\n"); 219 acpi_os_printf(" Good configuration\n");
262 break; 220 break;
263 221
264 case ACPI_ACCEPTABLE_CONFIGURATION: 222 case ACPI_ACCEPTABLE_CONFIGURATION:
265 acpi_os_printf (" Acceptable configuration\n"); 223 acpi_os_printf(" Acceptable configuration\n");
266 break; 224 break;
267 225
268 case ACPI_SUB_OPTIMAL_CONFIGURATION: 226 case ACPI_SUB_OPTIMAL_CONFIGURATION:
269 acpi_os_printf (" Sub-optimal configuration\n"); 227 acpi_os_printf(" Sub-optimal configuration\n");
270 break; 228 break;
271 229
272 default: 230 default:
273 acpi_os_printf (" Invalid compatibility priority\n"); 231 acpi_os_printf(" Invalid compatibility priority\n");
274 break; 232 break;
275 } 233 }
276 234
277 switch(sdf_data->performance_robustness) { 235 switch (sdf_data->performance_robustness) {
278 case ACPI_GOOD_CONFIGURATION: 236 case ACPI_GOOD_CONFIGURATION:
279 acpi_os_printf (" Good configuration\n"); 237 acpi_os_printf(" Good configuration\n");
280 break; 238 break;
281 239
282 case ACPI_ACCEPTABLE_CONFIGURATION: 240 case ACPI_ACCEPTABLE_CONFIGURATION:
283 acpi_os_printf (" Acceptable configuration\n"); 241 acpi_os_printf(" Acceptable configuration\n");
284 break; 242 break;
285 243
286 case ACPI_SUB_OPTIMAL_CONFIGURATION: 244 case ACPI_SUB_OPTIMAL_CONFIGURATION:
287 acpi_os_printf (" Sub-optimal configuration\n"); 245 acpi_os_printf(" Sub-optimal configuration\n");
288 break; 246 break;
289 247
290 default: 248 default:
291 acpi_os_printf (" Invalid performance robustness preference\n"); 249 acpi_os_printf(" Invalid performance robustness preference\n");
292 break; 250 break;
293 } 251 }
294 252
295 return; 253 return;
296} 254}
297 255
298
299/******************************************************************************* 256/*******************************************************************************
300 * 257 *
301 * FUNCTION: acpi_rs_dump_io 258 * FUNCTION: acpi_rs_dump_io
@@ -308,33 +265,30 @@ acpi_rs_dump_start_depend_fns (
308 * 265 *
309 ******************************************************************************/ 266 ******************************************************************************/
310 267
311static void 268static void acpi_rs_dump_io(union acpi_resource_data *data)
312acpi_rs_dump_io (
313 union acpi_resource_data *data)
314{ 269{
315 struct acpi_resource_io *io_data = (struct acpi_resource_io *) data; 270 struct acpi_resource_io *io_data = (struct acpi_resource_io *)data;
316
317 271
318 ACPI_FUNCTION_ENTRY (); 272 ACPI_FUNCTION_ENTRY();
319 273
274 acpi_os_printf("Io Resource\n");
320 275
321 acpi_os_printf ("Io Resource\n"); 276 acpi_os_printf(" %d bit decode\n",
277 ACPI_DECODE_16 == io_data->io_decode ? 16 : 10);
322 278
323 acpi_os_printf (" %d bit decode\n", 279 acpi_os_printf(" Range minimum base: %08X\n",
324 ACPI_DECODE_16 == io_data->io_decode ? 16 : 10); 280 io_data->min_base_address);
325 281
326 acpi_os_printf (" Range minimum base: %08X\n", io_data->min_base_address); 282 acpi_os_printf(" Range maximum base: %08X\n",
283 io_data->max_base_address);
327 284
328 acpi_os_printf (" Range maximum base: %08X\n", io_data->max_base_address); 285 acpi_os_printf(" Alignment: %08X\n", io_data->alignment);
329 286
330 acpi_os_printf (" Alignment: %08X\n", io_data->alignment); 287 acpi_os_printf(" Range Length: %08X\n", io_data->range_length);
331
332 acpi_os_printf (" Range Length: %08X\n", io_data->range_length);
333 288
334 return; 289 return;
335} 290}
336 291
337
338/******************************************************************************* 292/*******************************************************************************
339 * 293 *
340 * FUNCTION: acpi_rs_dump_fixed_io 294 * FUNCTION: acpi_rs_dump_fixed_io
@@ -347,25 +301,22 @@ acpi_rs_dump_io (
347 * 301 *
348 ******************************************************************************/ 302 ******************************************************************************/
349 303
350static void 304static void acpi_rs_dump_fixed_io(union acpi_resource_data *data)
351acpi_rs_dump_fixed_io (
352 union acpi_resource_data *data)
353{ 305{
354 struct acpi_resource_fixed_io *fixed_io_data = (struct acpi_resource_fixed_io *) data; 306 struct acpi_resource_fixed_io *fixed_io_data =
355 307 (struct acpi_resource_fixed_io *)data;
356 308
357 ACPI_FUNCTION_ENTRY (); 309 ACPI_FUNCTION_ENTRY();
358 310
311 acpi_os_printf("Fixed Io Resource\n");
312 acpi_os_printf(" Range base address: %08X",
313 fixed_io_data->base_address);
359 314
360 acpi_os_printf ("Fixed Io Resource\n"); 315 acpi_os_printf(" Range length: %08X", fixed_io_data->range_length);
361 acpi_os_printf (" Range base address: %08X", fixed_io_data->base_address);
362
363 acpi_os_printf (" Range length: %08X", fixed_io_data->range_length);
364 316
365 return; 317 return;
366} 318}
367 319
368
369/******************************************************************************* 320/*******************************************************************************
370 * 321 *
371 * FUNCTION: acpi_rs_dump_vendor_specific 322 * FUNCTION: acpi_rs_dump_vendor_specific
@@ -378,30 +329,26 @@ acpi_rs_dump_fixed_io (
378 * 329 *
379 ******************************************************************************/ 330 ******************************************************************************/
380 331
381static void 332static void acpi_rs_dump_vendor_specific(union acpi_resource_data *data)
382acpi_rs_dump_vendor_specific (
383 union acpi_resource_data *data)
384{ 333{
385 struct acpi_resource_vendor *vendor_data = (struct acpi_resource_vendor *) data; 334 struct acpi_resource_vendor *vendor_data =
386 u16 index = 0; 335 (struct acpi_resource_vendor *)data;
387 336 u16 index = 0;
388 337
389 ACPI_FUNCTION_ENTRY (); 338 ACPI_FUNCTION_ENTRY();
390 339
340 acpi_os_printf("Vendor Specific Resource\n");
391 341
392 acpi_os_printf ("Vendor Specific Resource\n"); 342 acpi_os_printf(" Length: %08X\n", vendor_data->length);
393
394 acpi_os_printf (" Length: %08X\n", vendor_data->length);
395 343
396 for (index = 0; index < vendor_data->length; index++) { 344 for (index = 0; index < vendor_data->length; index++) {
397 acpi_os_printf (" Byte %X: %08X\n", 345 acpi_os_printf(" Byte %X: %08X\n",
398 index, vendor_data->reserved[index]); 346 index, vendor_data->reserved[index]);
399 } 347 }
400 348
401 return; 349 return;
402} 350}
403 351
404
405/******************************************************************************* 352/*******************************************************************************
406 * 353 *
407 * FUNCTION: acpi_rs_dump_memory24 354 * FUNCTION: acpi_rs_dump_memory24
@@ -414,37 +361,33 @@ acpi_rs_dump_vendor_specific (
414 * 361 *
415 ******************************************************************************/ 362 ******************************************************************************/
416 363
417static void 364static void acpi_rs_dump_memory24(union acpi_resource_data *data)
418acpi_rs_dump_memory24 (
419 union acpi_resource_data *data)
420{ 365{
421 struct acpi_resource_mem24 *memory24_data = (struct acpi_resource_mem24 *) data; 366 struct acpi_resource_mem24 *memory24_data =
422 367 (struct acpi_resource_mem24 *)data;
423 368
424 ACPI_FUNCTION_ENTRY (); 369 ACPI_FUNCTION_ENTRY();
425 370
371 acpi_os_printf("24-Bit Memory Range Resource\n");
426 372
427 acpi_os_printf ("24-Bit Memory Range Resource\n"); 373 acpi_os_printf(" Read%s\n",
374 ACPI_READ_WRITE_MEMORY ==
375 memory24_data->read_write_attribute ?
376 "/Write" : " only");
428 377
429 acpi_os_printf (" Read%s\n", 378 acpi_os_printf(" Range minimum base: %08X\n",
430 ACPI_READ_WRITE_MEMORY == 379 memory24_data->min_base_address);
431 memory24_data->read_write_attribute ?
432 "/Write" : " only");
433 380
434 acpi_os_printf (" Range minimum base: %08X\n", 381 acpi_os_printf(" Range maximum base: %08X\n",
435 memory24_data->min_base_address); 382 memory24_data->max_base_address);
436 383
437 acpi_os_printf (" Range maximum base: %08X\n", 384 acpi_os_printf(" Alignment: %08X\n", memory24_data->alignment);
438 memory24_data->max_base_address);
439 385
440 acpi_os_printf (" Alignment: %08X\n", memory24_data->alignment); 386 acpi_os_printf(" Range length: %08X\n", memory24_data->range_length);
441
442 acpi_os_printf (" Range length: %08X\n", memory24_data->range_length);
443 387
444 return; 388 return;
445} 389}
446 390
447
448/******************************************************************************* 391/*******************************************************************************
449 * 392 *
450 * FUNCTION: acpi_rs_dump_memory32 393 * FUNCTION: acpi_rs_dump_memory32
@@ -457,37 +400,33 @@ acpi_rs_dump_memory24 (
457 * 400 *
458 ******************************************************************************/ 401 ******************************************************************************/
459 402
460static void 403static void acpi_rs_dump_memory32(union acpi_resource_data *data)
461acpi_rs_dump_memory32 (
462 union acpi_resource_data *data)
463{ 404{
464 struct acpi_resource_mem32 *memory32_data = (struct acpi_resource_mem32 *) data; 405 struct acpi_resource_mem32 *memory32_data =
465 406 (struct acpi_resource_mem32 *)data;
466
467 ACPI_FUNCTION_ENTRY ();
468 407
408 ACPI_FUNCTION_ENTRY();
469 409
470 acpi_os_printf ("32-Bit Memory Range Resource\n"); 410 acpi_os_printf("32-Bit Memory Range Resource\n");
471 411
472 acpi_os_printf (" Read%s\n", 412 acpi_os_printf(" Read%s\n",
473 ACPI_READ_WRITE_MEMORY == 413 ACPI_READ_WRITE_MEMORY ==
474 memory32_data->read_write_attribute ? 414 memory32_data->read_write_attribute ?
475 "/Write" : " only"); 415 "/Write" : " only");
476 416
477 acpi_os_printf (" Range minimum base: %08X\n", 417 acpi_os_printf(" Range minimum base: %08X\n",
478 memory32_data->min_base_address); 418 memory32_data->min_base_address);
479 419
480 acpi_os_printf (" Range maximum base: %08X\n", 420 acpi_os_printf(" Range maximum base: %08X\n",
481 memory32_data->max_base_address); 421 memory32_data->max_base_address);
482 422
483 acpi_os_printf (" Alignment: %08X\n", memory32_data->alignment); 423 acpi_os_printf(" Alignment: %08X\n", memory32_data->alignment);
484 424
485 acpi_os_printf (" Range length: %08X\n", memory32_data->range_length); 425 acpi_os_printf(" Range length: %08X\n", memory32_data->range_length);
486 426
487 return; 427 return;
488} 428}
489 429
490
491/******************************************************************************* 430/*******************************************************************************
492 * 431 *
493 * FUNCTION: acpi_rs_dump_fixed_memory32 432 * FUNCTION: acpi_rs_dump_fixed_memory32
@@ -500,33 +439,29 @@ acpi_rs_dump_memory32 (
500 * 439 *
501 ******************************************************************************/ 440 ******************************************************************************/
502 441
503static void 442static void acpi_rs_dump_fixed_memory32(union acpi_resource_data *data)
504acpi_rs_dump_fixed_memory32 (
505 union acpi_resource_data *data)
506{ 443{
507 struct acpi_resource_fixed_mem32 *fixed_memory32_data = 444 struct acpi_resource_fixed_mem32 *fixed_memory32_data =
508 (struct acpi_resource_fixed_mem32 *) data; 445 (struct acpi_resource_fixed_mem32 *)data;
509
510
511 ACPI_FUNCTION_ENTRY ();
512 446
447 ACPI_FUNCTION_ENTRY();
513 448
514 acpi_os_printf ("32-Bit Fixed Location Memory Range Resource\n"); 449 acpi_os_printf("32-Bit Fixed Location Memory Range Resource\n");
515 450
516 acpi_os_printf (" Read%s\n", 451 acpi_os_printf(" Read%s\n",
517 ACPI_READ_WRITE_MEMORY == 452 ACPI_READ_WRITE_MEMORY ==
518 fixed_memory32_data->read_write_attribute ? "/Write" : " Only"); 453 fixed_memory32_data->
454 read_write_attribute ? "/Write" : " Only");
519 455
520 acpi_os_printf (" Range base address: %08X\n", 456 acpi_os_printf(" Range base address: %08X\n",
521 fixed_memory32_data->range_base_address); 457 fixed_memory32_data->range_base_address);
522 458
523 acpi_os_printf (" Range length: %08X\n", 459 acpi_os_printf(" Range length: %08X\n",
524 fixed_memory32_data->range_length); 460 fixed_memory32_data->range_length);
525 461
526 return; 462 return;
527} 463}
528 464
529
530/******************************************************************************* 465/*******************************************************************************
531 * 466 *
532 * FUNCTION: acpi_rs_dump_address16 467 * FUNCTION: acpi_rs_dump_address16
@@ -539,134 +474,136 @@ acpi_rs_dump_fixed_memory32 (
539 * 474 *
540 ******************************************************************************/ 475 ******************************************************************************/
541 476
542static void 477static void acpi_rs_dump_address16(union acpi_resource_data *data)
543acpi_rs_dump_address16 (
544 union acpi_resource_data *data)
545{ 478{
546 struct acpi_resource_address16 *address16_data = (struct acpi_resource_address16 *) data; 479 struct acpi_resource_address16 *address16_data =
547 480 (struct acpi_resource_address16 *)data;
548
549 ACPI_FUNCTION_ENTRY ();
550 481
482 ACPI_FUNCTION_ENTRY();
551 483
552 acpi_os_printf ("16-Bit Address Space Resource\n"); 484 acpi_os_printf("16-Bit Address Space Resource\n");
553 acpi_os_printf (" Resource Type: "); 485 acpi_os_printf(" Resource Type: ");
554 486
555 switch (address16_data->resource_type) { 487 switch (address16_data->resource_type) {
556 case ACPI_MEMORY_RANGE: 488 case ACPI_MEMORY_RANGE:
557 489
558 acpi_os_printf ("Memory Range\n"); 490 acpi_os_printf("Memory Range\n");
559 491
560 switch (address16_data->attribute.memory.cache_attribute) { 492 switch (address16_data->attribute.memory.cache_attribute) {
561 case ACPI_NON_CACHEABLE_MEMORY: 493 case ACPI_NON_CACHEABLE_MEMORY:
562 acpi_os_printf (" Type Specific: Noncacheable memory\n"); 494 acpi_os_printf
495 (" Type Specific: Noncacheable memory\n");
563 break; 496 break;
564 497
565 case ACPI_CACHABLE_MEMORY: 498 case ACPI_CACHABLE_MEMORY:
566 acpi_os_printf (" Type Specific: Cacheable memory\n"); 499 acpi_os_printf(" Type Specific: Cacheable memory\n");
567 break; 500 break;
568 501
569 case ACPI_WRITE_COMBINING_MEMORY: 502 case ACPI_WRITE_COMBINING_MEMORY:
570 acpi_os_printf (" Type Specific: Write-combining memory\n"); 503 acpi_os_printf
504 (" Type Specific: Write-combining memory\n");
571 break; 505 break;
572 506
573 case ACPI_PREFETCHABLE_MEMORY: 507 case ACPI_PREFETCHABLE_MEMORY:
574 acpi_os_printf (" Type Specific: Prefetchable memory\n"); 508 acpi_os_printf
509 (" Type Specific: Prefetchable memory\n");
575 break; 510 break;
576 511
577 default: 512 default:
578 acpi_os_printf (" Type Specific: Invalid cache attribute\n"); 513 acpi_os_printf
514 (" Type Specific: Invalid cache attribute\n");
579 break; 515 break;
580 } 516 }
581 517
582 acpi_os_printf (" Type Specific: Read%s\n", 518 acpi_os_printf(" Type Specific: Read%s\n",
583 ACPI_READ_WRITE_MEMORY == 519 ACPI_READ_WRITE_MEMORY ==
584 address16_data->attribute.memory.read_write_attribute ? 520 address16_data->attribute.memory.
585 "/Write" : " Only"); 521 read_write_attribute ? "/Write" : " Only");
586 break; 522 break;
587 523
588 case ACPI_IO_RANGE: 524 case ACPI_IO_RANGE:
589 525
590 acpi_os_printf ("I/O Range\n"); 526 acpi_os_printf("I/O Range\n");
591 527
592 switch (address16_data->attribute.io.range_attribute) { 528 switch (address16_data->attribute.io.range_attribute) {
593 case ACPI_NON_ISA_ONLY_RANGES: 529 case ACPI_NON_ISA_ONLY_RANGES:
594 acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n"); 530 acpi_os_printf
531 (" Type Specific: Non-ISA Io Addresses\n");
595 break; 532 break;
596 533
597 case ACPI_ISA_ONLY_RANGES: 534 case ACPI_ISA_ONLY_RANGES:
598 acpi_os_printf (" Type Specific: ISA Io Addresses\n"); 535 acpi_os_printf(" Type Specific: ISA Io Addresses\n");
599 break; 536 break;
600 537
601 case ACPI_ENTIRE_RANGE: 538 case ACPI_ENTIRE_RANGE:
602 acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n"); 539 acpi_os_printf
540 (" Type Specific: ISA and non-ISA Io Addresses\n");
603 break; 541 break;
604 542
605 default: 543 default:
606 acpi_os_printf (" Type Specific: Invalid range attribute\n"); 544 acpi_os_printf
545 (" Type Specific: Invalid range attribute\n");
607 break; 546 break;
608 } 547 }
609 548
610 acpi_os_printf (" Type Specific: %s Translation\n", 549 acpi_os_printf(" Type Specific: %s Translation\n",
611 ACPI_SPARSE_TRANSLATION == 550 ACPI_SPARSE_TRANSLATION ==
612 address16_data->attribute.io.translation_attribute ? 551 address16_data->attribute.io.
613 "Sparse" : "Dense"); 552 translation_attribute ? "Sparse" : "Dense");
614 break; 553 break;
615 554
616 case ACPI_BUS_NUMBER_RANGE: 555 case ACPI_BUS_NUMBER_RANGE:
617 556
618 acpi_os_printf ("Bus Number Range\n"); 557 acpi_os_printf("Bus Number Range\n");
619 break; 558 break;
620 559
621 default: 560 default:
622 561
623 acpi_os_printf ("0x%2.2X\n", address16_data->resource_type); 562 acpi_os_printf("0x%2.2X\n", address16_data->resource_type);
624 break; 563 break;
625 } 564 }
626 565
627 acpi_os_printf (" Resource %s\n", 566 acpi_os_printf(" Resource %s\n",
628 ACPI_CONSUMER == address16_data->producer_consumer ? 567 ACPI_CONSUMER == address16_data->producer_consumer ?
629 "Consumer" : "Producer"); 568 "Consumer" : "Producer");
630 569
631 acpi_os_printf (" %s decode\n", 570 acpi_os_printf(" %s decode\n",
632 ACPI_SUB_DECODE == address16_data->decode ? 571 ACPI_SUB_DECODE == address16_data->decode ?
633 "Subtractive" : "Positive"); 572 "Subtractive" : "Positive");
634 573
635 acpi_os_printf (" Min address is %s fixed\n", 574 acpi_os_printf(" Min address is %s fixed\n",
636 ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ? 575 ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ?
637 "" : "not"); 576 "" : "not");
638 577
639 acpi_os_printf (" Max address is %s fixed\n", 578 acpi_os_printf(" Max address is %s fixed\n",
640 ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ? 579 ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ?
641 "" : "not"); 580 "" : "not");
642 581
643 acpi_os_printf (" Granularity: %08X\n", 582 acpi_os_printf(" Granularity: %08X\n", address16_data->granularity);
644 address16_data->granularity);
645 583
646 acpi_os_printf (" Address range min: %08X\n", 584 acpi_os_printf(" Address range min: %08X\n",
647 address16_data->min_address_range); 585 address16_data->min_address_range);
648 586
649 acpi_os_printf (" Address range max: %08X\n", 587 acpi_os_printf(" Address range max: %08X\n",
650 address16_data->max_address_range); 588 address16_data->max_address_range);
651 589
652 acpi_os_printf (" Address translation offset: %08X\n", 590 acpi_os_printf(" Address translation offset: %08X\n",
653 address16_data->address_translation_offset); 591 address16_data->address_translation_offset);
654 592
655 acpi_os_printf (" Address Length: %08X\n", 593 acpi_os_printf(" Address Length: %08X\n",
656 address16_data->address_length); 594 address16_data->address_length);
657 595
658 if (0xFF != address16_data->resource_source.index) { 596 if (0xFF != address16_data->resource_source.index) {
659 acpi_os_printf (" Resource Source Index: %X\n", 597 acpi_os_printf(" Resource Source Index: %X\n",
660 address16_data->resource_source.index); 598 address16_data->resource_source.index);
661 599
662 acpi_os_printf (" Resource Source: %s\n", 600 acpi_os_printf(" Resource Source: %s\n",
663 address16_data->resource_source.string_ptr); 601 address16_data->resource_source.string_ptr);
664 } 602 }
665 603
666 return; 604 return;
667} 605}
668 606
669
670/******************************************************************************* 607/*******************************************************************************
671 * 608 *
672 * FUNCTION: acpi_rs_dump_address32 609 * FUNCTION: acpi_rs_dump_address32
@@ -679,134 +616,136 @@ acpi_rs_dump_address16 (
679 * 616 *
680 ******************************************************************************/ 617 ******************************************************************************/
681 618
682static void 619static void acpi_rs_dump_address32(union acpi_resource_data *data)
683acpi_rs_dump_address32 (
684 union acpi_resource_data *data)
685{ 620{
686 struct acpi_resource_address32 *address32_data = (struct acpi_resource_address32 *) data; 621 struct acpi_resource_address32 *address32_data =
687 622 (struct acpi_resource_address32 *)data;
688
689 ACPI_FUNCTION_ENTRY ();
690 623
624 ACPI_FUNCTION_ENTRY();
691 625
692 acpi_os_printf ("32-Bit Address Space Resource\n"); 626 acpi_os_printf("32-Bit Address Space Resource\n");
693 627
694 switch (address32_data->resource_type) { 628 switch (address32_data->resource_type) {
695 case ACPI_MEMORY_RANGE: 629 case ACPI_MEMORY_RANGE:
696 630
697 acpi_os_printf (" Resource Type: Memory Range\n"); 631 acpi_os_printf(" Resource Type: Memory Range\n");
698 632
699 switch (address32_data->attribute.memory.cache_attribute) { 633 switch (address32_data->attribute.memory.cache_attribute) {
700 case ACPI_NON_CACHEABLE_MEMORY: 634 case ACPI_NON_CACHEABLE_MEMORY:
701 acpi_os_printf (" Type Specific: Noncacheable memory\n"); 635 acpi_os_printf
636 (" Type Specific: Noncacheable memory\n");
702 break; 637 break;
703 638
704 case ACPI_CACHABLE_MEMORY: 639 case ACPI_CACHABLE_MEMORY:
705 acpi_os_printf (" Type Specific: Cacheable memory\n"); 640 acpi_os_printf(" Type Specific: Cacheable memory\n");
706 break; 641 break;
707 642
708 case ACPI_WRITE_COMBINING_MEMORY: 643 case ACPI_WRITE_COMBINING_MEMORY:
709 acpi_os_printf (" Type Specific: Write-combining memory\n"); 644 acpi_os_printf
645 (" Type Specific: Write-combining memory\n");
710 break; 646 break;
711 647
712 case ACPI_PREFETCHABLE_MEMORY: 648 case ACPI_PREFETCHABLE_MEMORY:
713 acpi_os_printf (" Type Specific: Prefetchable memory\n"); 649 acpi_os_printf
650 (" Type Specific: Prefetchable memory\n");
714 break; 651 break;
715 652
716 default: 653 default:
717 acpi_os_printf (" Type Specific: Invalid cache attribute\n"); 654 acpi_os_printf
655 (" Type Specific: Invalid cache attribute\n");
718 break; 656 break;
719 } 657 }
720 658
721 acpi_os_printf (" Type Specific: Read%s\n", 659 acpi_os_printf(" Type Specific: Read%s\n",
722 ACPI_READ_WRITE_MEMORY == 660 ACPI_READ_WRITE_MEMORY ==
723 address32_data->attribute.memory.read_write_attribute ? 661 address32_data->attribute.memory.
724 "/Write" : " Only"); 662 read_write_attribute ? "/Write" : " Only");
725 break; 663 break;
726 664
727 case ACPI_IO_RANGE: 665 case ACPI_IO_RANGE:
728 666
729 acpi_os_printf (" Resource Type: Io Range\n"); 667 acpi_os_printf(" Resource Type: Io Range\n");
730 668
731 switch (address32_data->attribute.io.range_attribute) { 669 switch (address32_data->attribute.io.range_attribute) {
732 case ACPI_NON_ISA_ONLY_RANGES: 670 case ACPI_NON_ISA_ONLY_RANGES:
733 acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n"); 671 acpi_os_printf
672 (" Type Specific: Non-ISA Io Addresses\n");
734 break; 673 break;
735 674
736 case ACPI_ISA_ONLY_RANGES: 675 case ACPI_ISA_ONLY_RANGES:
737 acpi_os_printf (" Type Specific: ISA Io Addresses\n"); 676 acpi_os_printf(" Type Specific: ISA Io Addresses\n");
738 break; 677 break;
739 678
740 case ACPI_ENTIRE_RANGE: 679 case ACPI_ENTIRE_RANGE:
741 acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n"); 680 acpi_os_printf
681 (" Type Specific: ISA and non-ISA Io Addresses\n");
742 break; 682 break;
743 683
744 default: 684 default:
745 acpi_os_printf (" Type Specific: Invalid Range attribute"); 685 acpi_os_printf
686 (" Type Specific: Invalid Range attribute");
746 break; 687 break;
747 } 688 }
748 689
749 acpi_os_printf (" Type Specific: %s Translation\n", 690 acpi_os_printf(" Type Specific: %s Translation\n",
750 ACPI_SPARSE_TRANSLATION == 691 ACPI_SPARSE_TRANSLATION ==
751 address32_data->attribute.io.translation_attribute ? 692 address32_data->attribute.io.
752 "Sparse" : "Dense"); 693 translation_attribute ? "Sparse" : "Dense");
753 break; 694 break;
754 695
755 case ACPI_BUS_NUMBER_RANGE: 696 case ACPI_BUS_NUMBER_RANGE:
756 697
757 acpi_os_printf (" Resource Type: Bus Number Range\n"); 698 acpi_os_printf(" Resource Type: Bus Number Range\n");
758 break; 699 break;
759 700
760 default: 701 default:
761 702
762 acpi_os_printf (" Resource Type: 0x%2.2X\n", 703 acpi_os_printf(" Resource Type: 0x%2.2X\n",
763 address32_data->resource_type); 704 address32_data->resource_type);
764 break; 705 break;
765 } 706 }
766 707
767 acpi_os_printf (" Resource %s\n", 708 acpi_os_printf(" Resource %s\n",
768 ACPI_CONSUMER == address32_data->producer_consumer ? 709 ACPI_CONSUMER == address32_data->producer_consumer ?
769 "Consumer" : "Producer"); 710 "Consumer" : "Producer");
770 711
771 acpi_os_printf (" %s decode\n", 712 acpi_os_printf(" %s decode\n",
772 ACPI_SUB_DECODE == address32_data->decode ? 713 ACPI_SUB_DECODE == address32_data->decode ?
773 "Subtractive" : "Positive"); 714 "Subtractive" : "Positive");
774 715
775 acpi_os_printf (" Min address is %s fixed\n", 716 acpi_os_printf(" Min address is %s fixed\n",
776 ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ? 717 ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ?
777 "" : "not "); 718 "" : "not ");
778 719
779 acpi_os_printf (" Max address is %s fixed\n", 720 acpi_os_printf(" Max address is %s fixed\n",
780 ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ? 721 ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ?
781 "" : "not "); 722 "" : "not ");
782 723
783 acpi_os_printf (" Granularity: %08X\n", 724 acpi_os_printf(" Granularity: %08X\n", address32_data->granularity);
784 address32_data->granularity);
785 725
786 acpi_os_printf (" Address range min: %08X\n", 726 acpi_os_printf(" Address range min: %08X\n",
787 address32_data->min_address_range); 727 address32_data->min_address_range);
788 728
789 acpi_os_printf (" Address range max: %08X\n", 729 acpi_os_printf(" Address range max: %08X\n",
790 address32_data->max_address_range); 730 address32_data->max_address_range);
791 731
792 acpi_os_printf (" Address translation offset: %08X\n", 732 acpi_os_printf(" Address translation offset: %08X\n",
793 address32_data->address_translation_offset); 733 address32_data->address_translation_offset);
794 734
795 acpi_os_printf (" Address Length: %08X\n", 735 acpi_os_printf(" Address Length: %08X\n",
796 address32_data->address_length); 736 address32_data->address_length);
797 737
798 if(0xFF != address32_data->resource_source.index) { 738 if (0xFF != address32_data->resource_source.index) {
799 acpi_os_printf (" Resource Source Index: %X\n", 739 acpi_os_printf(" Resource Source Index: %X\n",
800 address32_data->resource_source.index); 740 address32_data->resource_source.index);
801 741
802 acpi_os_printf (" Resource Source: %s\n", 742 acpi_os_printf(" Resource Source: %s\n",
803 address32_data->resource_source.string_ptr); 743 address32_data->resource_source.string_ptr);
804 } 744 }
805 745
806 return; 746 return;
807} 747}
808 748
809
810/******************************************************************************* 749/*******************************************************************************
811 * 750 *
812 * FUNCTION: acpi_rs_dump_address64 751 * FUNCTION: acpi_rs_dump_address64
@@ -819,137 +758,142 @@ acpi_rs_dump_address32 (
819 * 758 *
820 ******************************************************************************/ 759 ******************************************************************************/
821 760
822static void 761static void acpi_rs_dump_address64(union acpi_resource_data *data)
823acpi_rs_dump_address64 (
824 union acpi_resource_data *data)
825{ 762{
826 struct acpi_resource_address64 *address64_data = (struct acpi_resource_address64 *) data; 763 struct acpi_resource_address64 *address64_data =
827 764 (struct acpi_resource_address64 *)data;
828
829 ACPI_FUNCTION_ENTRY ();
830 765
766 ACPI_FUNCTION_ENTRY();
831 767
832 acpi_os_printf ("64-Bit Address Space Resource\n"); 768 acpi_os_printf("64-Bit Address Space Resource\n");
833 769
834 switch (address64_data->resource_type) { 770 switch (address64_data->resource_type) {
835 case ACPI_MEMORY_RANGE: 771 case ACPI_MEMORY_RANGE:
836 772
837 acpi_os_printf (" Resource Type: Memory Range\n"); 773 acpi_os_printf(" Resource Type: Memory Range\n");
838 774
839 switch (address64_data->attribute.memory.cache_attribute) { 775 switch (address64_data->attribute.memory.cache_attribute) {
840 case ACPI_NON_CACHEABLE_MEMORY: 776 case ACPI_NON_CACHEABLE_MEMORY:
841 acpi_os_printf (" Type Specific: Noncacheable memory\n"); 777 acpi_os_printf
778 (" Type Specific: Noncacheable memory\n");
842 break; 779 break;
843 780
844 case ACPI_CACHABLE_MEMORY: 781 case ACPI_CACHABLE_MEMORY:
845 acpi_os_printf (" Type Specific: Cacheable memory\n"); 782 acpi_os_printf(" Type Specific: Cacheable memory\n");
846 break; 783 break;
847 784
848 case ACPI_WRITE_COMBINING_MEMORY: 785 case ACPI_WRITE_COMBINING_MEMORY:
849 acpi_os_printf (" Type Specific: Write-combining memory\n"); 786 acpi_os_printf
787 (" Type Specific: Write-combining memory\n");
850 break; 788 break;
851 789
852 case ACPI_PREFETCHABLE_MEMORY: 790 case ACPI_PREFETCHABLE_MEMORY:
853 acpi_os_printf (" Type Specific: Prefetchable memory\n"); 791 acpi_os_printf
792 (" Type Specific: Prefetchable memory\n");
854 break; 793 break;
855 794
856 default: 795 default:
857 acpi_os_printf (" Type Specific: Invalid cache attribute\n"); 796 acpi_os_printf
797 (" Type Specific: Invalid cache attribute\n");
858 break; 798 break;
859 } 799 }
860 800
861 acpi_os_printf (" Type Specific: Read%s\n", 801 acpi_os_printf(" Type Specific: Read%s\n",
862 ACPI_READ_WRITE_MEMORY == 802 ACPI_READ_WRITE_MEMORY ==
863 address64_data->attribute.memory.read_write_attribute ? 803 address64_data->attribute.memory.
864 "/Write" : " Only"); 804 read_write_attribute ? "/Write" : " Only");
865 break; 805 break;
866 806
867 case ACPI_IO_RANGE: 807 case ACPI_IO_RANGE:
868 808
869 acpi_os_printf (" Resource Type: Io Range\n"); 809 acpi_os_printf(" Resource Type: Io Range\n");
870 810
871 switch (address64_data->attribute.io.range_attribute) { 811 switch (address64_data->attribute.io.range_attribute) {
872 case ACPI_NON_ISA_ONLY_RANGES: 812 case ACPI_NON_ISA_ONLY_RANGES:
873 acpi_os_printf (" Type Specific: Non-ISA Io Addresses\n"); 813 acpi_os_printf
814 (" Type Specific: Non-ISA Io Addresses\n");
874 break; 815 break;
875 816
876 case ACPI_ISA_ONLY_RANGES: 817 case ACPI_ISA_ONLY_RANGES:
877 acpi_os_printf (" Type Specific: ISA Io Addresses\n"); 818 acpi_os_printf(" Type Specific: ISA Io Addresses\n");
878 break; 819 break;
879 820
880 case ACPI_ENTIRE_RANGE: 821 case ACPI_ENTIRE_RANGE:
881 acpi_os_printf (" Type Specific: ISA and non-ISA Io Addresses\n"); 822 acpi_os_printf
823 (" Type Specific: ISA and non-ISA Io Addresses\n");
882 break; 824 break;
883 825
884 default: 826 default:
885 acpi_os_printf (" Type Specific: Invalid Range attribute"); 827 acpi_os_printf
828 (" Type Specific: Invalid Range attribute");
886 break; 829 break;
887 } 830 }
888 831
889 acpi_os_printf (" Type Specific: %s Translation\n", 832 acpi_os_printf(" Type Specific: %s Translation\n",
890 ACPI_SPARSE_TRANSLATION == 833 ACPI_SPARSE_TRANSLATION ==
891 address64_data->attribute.io.translation_attribute ? 834 address64_data->attribute.io.
892 "Sparse" : "Dense"); 835 translation_attribute ? "Sparse" : "Dense");
893 break; 836 break;
894 837
895 case ACPI_BUS_NUMBER_RANGE: 838 case ACPI_BUS_NUMBER_RANGE:
896 839
897 acpi_os_printf (" Resource Type: Bus Number Range\n"); 840 acpi_os_printf(" Resource Type: Bus Number Range\n");
898 break; 841 break;
899 842
900 default: 843 default:
901 844
902 acpi_os_printf (" Resource Type: 0x%2.2X\n", 845 acpi_os_printf(" Resource Type: 0x%2.2X\n",
903 address64_data->resource_type); 846 address64_data->resource_type);
904 break; 847 break;
905 } 848 }
906 849
907 acpi_os_printf (" Resource %s\n", 850 acpi_os_printf(" Resource %s\n",
908 ACPI_CONSUMER == address64_data->producer_consumer ? 851 ACPI_CONSUMER == address64_data->producer_consumer ?
909 "Consumer" : "Producer"); 852 "Consumer" : "Producer");
910 853
911 acpi_os_printf (" %s decode\n", 854 acpi_os_printf(" %s decode\n",
912 ACPI_SUB_DECODE == address64_data->decode ? 855 ACPI_SUB_DECODE == address64_data->decode ?
913 "Subtractive" : "Positive"); 856 "Subtractive" : "Positive");
914 857
915 acpi_os_printf (" Min address is %s fixed\n", 858 acpi_os_printf(" Min address is %s fixed\n",
916 ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ? 859 ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ?
917 "" : "not "); 860 "" : "not ");
918 861
919 acpi_os_printf (" Max address is %s fixed\n", 862 acpi_os_printf(" Max address is %s fixed\n",
920 ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ? 863 ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ?
921 "" : "not "); 864 "" : "not ");
922 865
923 acpi_os_printf (" Granularity: %8.8X%8.8X\n", 866 acpi_os_printf(" Granularity: %8.8X%8.8X\n",
924 ACPI_FORMAT_UINT64 (address64_data->granularity)); 867 ACPI_FORMAT_UINT64(address64_data->granularity));
925 868
926 acpi_os_printf (" Address range min: %8.8X%8.8X\n", 869 acpi_os_printf(" Address range min: %8.8X%8.8X\n",
927 ACPI_FORMAT_UINT64 (address64_data->min_address_range)); 870 ACPI_FORMAT_UINT64(address64_data->min_address_range));
928 871
929 acpi_os_printf (" Address range max: %8.8X%8.8X\n", 872 acpi_os_printf(" Address range max: %8.8X%8.8X\n",
930 ACPI_FORMAT_UINT64 (address64_data->max_address_range)); 873 ACPI_FORMAT_UINT64(address64_data->max_address_range));
931 874
932 acpi_os_printf (" Address translation offset: %8.8X%8.8X\n", 875 acpi_os_printf(" Address translation offset: %8.8X%8.8X\n",
933 ACPI_FORMAT_UINT64 (address64_data->address_translation_offset)); 876 ACPI_FORMAT_UINT64(address64_data->
877 address_translation_offset));
934 878
935 acpi_os_printf (" Address Length: %8.8X%8.8X\n", 879 acpi_os_printf(" Address Length: %8.8X%8.8X\n",
936 ACPI_FORMAT_UINT64 (address64_data->address_length)); 880 ACPI_FORMAT_UINT64(address64_data->address_length));
937 881
938 acpi_os_printf (" Type Specific Attributes: %8.8X%8.8X\n", 882 acpi_os_printf(" Type Specific Attributes: %8.8X%8.8X\n",
939 ACPI_FORMAT_UINT64 (address64_data->type_specific_attributes)); 883 ACPI_FORMAT_UINT64(address64_data->
884 type_specific_attributes));
940 885
941 if (0xFF != address64_data->resource_source.index) { 886 if (0xFF != address64_data->resource_source.index) {
942 acpi_os_printf (" Resource Source Index: %X\n", 887 acpi_os_printf(" Resource Source Index: %X\n",
943 address64_data->resource_source.index); 888 address64_data->resource_source.index);
944 889
945 acpi_os_printf (" Resource Source: %s\n", 890 acpi_os_printf(" Resource Source: %s\n",
946 address64_data->resource_source.string_ptr); 891 address64_data->resource_source.string_ptr);
947 } 892 }
948 893
949 return; 894 return;
950} 895}
951 896
952
953/******************************************************************************* 897/*******************************************************************************
954 * 898 *
955 * FUNCTION: acpi_rs_dump_extended_irq 899 * FUNCTION: acpi_rs_dump_extended_irq
@@ -962,55 +906,52 @@ acpi_rs_dump_address64 (
962 * 906 *
963 ******************************************************************************/ 907 ******************************************************************************/
964 908
965static void 909static void acpi_rs_dump_extended_irq(union acpi_resource_data *data)
966acpi_rs_dump_extended_irq (
967 union acpi_resource_data *data)
968{ 910{
969 struct acpi_resource_ext_irq *ext_irq_data = (struct acpi_resource_ext_irq *) data; 911 struct acpi_resource_ext_irq *ext_irq_data =
970 u8 index = 0; 912 (struct acpi_resource_ext_irq *)data;
971 913 u8 index = 0;
972
973 ACPI_FUNCTION_ENTRY ();
974 914
915 ACPI_FUNCTION_ENTRY();
975 916
976 acpi_os_printf ("Extended IRQ Resource\n"); 917 acpi_os_printf("Extended IRQ Resource\n");
977 918
978 acpi_os_printf (" Resource %s\n", 919 acpi_os_printf(" Resource %s\n",
979 ACPI_CONSUMER == ext_irq_data->producer_consumer ? 920 ACPI_CONSUMER == ext_irq_data->producer_consumer ?
980 "Consumer" : "Producer"); 921 "Consumer" : "Producer");
981 922
982 acpi_os_printf (" %s\n", 923 acpi_os_printf(" %s\n",
983 ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ? 924 ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ?
984 "Level" : "Edge"); 925 "Level" : "Edge");
985 926
986 acpi_os_printf (" Active %s\n", 927 acpi_os_printf(" Active %s\n",
987 ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ? 928 ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ?
988 "low" : "high"); 929 "low" : "high");
989 930
990 acpi_os_printf (" %s\n", 931 acpi_os_printf(" %s\n",
991 ACPI_SHARED == ext_irq_data->shared_exclusive ? 932 ACPI_SHARED == ext_irq_data->shared_exclusive ?
992 "Shared" : "Exclusive"); 933 "Shared" : "Exclusive");
993 934
994 acpi_os_printf (" Interrupts : %X ( ", ext_irq_data->number_of_interrupts); 935 acpi_os_printf(" Interrupts : %X ( ",
936 ext_irq_data->number_of_interrupts);
995 937
996 for (index = 0; index < ext_irq_data->number_of_interrupts; index++) { 938 for (index = 0; index < ext_irq_data->number_of_interrupts; index++) {
997 acpi_os_printf ("%X ", ext_irq_data->interrupts[index]); 939 acpi_os_printf("%X ", ext_irq_data->interrupts[index]);
998 } 940 }
999 941
1000 acpi_os_printf (")\n"); 942 acpi_os_printf(")\n");
1001 943
1002 if(0xFF != ext_irq_data->resource_source.index) { 944 if (0xFF != ext_irq_data->resource_source.index) {
1003 acpi_os_printf (" Resource Source Index: %X", 945 acpi_os_printf(" Resource Source Index: %X",
1004 ext_irq_data->resource_source.index); 946 ext_irq_data->resource_source.index);
1005 947
1006 acpi_os_printf (" Resource Source: %s", 948 acpi_os_printf(" Resource Source: %s",
1007 ext_irq_data->resource_source.string_ptr); 949 ext_irq_data->resource_source.string_ptr);
1008 } 950 }
1009 951
1010 return; 952 return;
1011} 953}
1012 954
1013
1014/******************************************************************************* 955/*******************************************************************************
1015 * 956 *
1016 * FUNCTION: acpi_rs_dump_resource_list 957 * FUNCTION: acpi_rs_dump_resource_list
@@ -1023,92 +964,91 @@ acpi_rs_dump_extended_irq (
1023 * 964 *
1024 ******************************************************************************/ 965 ******************************************************************************/
1025 966
1026void 967void acpi_rs_dump_resource_list(struct acpi_resource *resource)
1027acpi_rs_dump_resource_list (
1028 struct acpi_resource *resource)
1029{ 968{
1030 u8 count = 0; 969 u8 count = 0;
1031 u8 done = FALSE; 970 u8 done = FALSE;
1032
1033
1034 ACPI_FUNCTION_ENTRY ();
1035 971
972 ACPI_FUNCTION_ENTRY();
1036 973
1037 if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) { 974 if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) {
1038 while (!done) { 975 while (!done) {
1039 acpi_os_printf ("Resource structure %X.\n", count++); 976 acpi_os_printf("Resource structure %X.\n", count++);
1040 977
1041 switch (resource->id) { 978 switch (resource->id) {
1042 case ACPI_RSTYPE_IRQ: 979 case ACPI_RSTYPE_IRQ:
1043 acpi_rs_dump_irq (&resource->data); 980 acpi_rs_dump_irq(&resource->data);
1044 break; 981 break;
1045 982
1046 case ACPI_RSTYPE_DMA: 983 case ACPI_RSTYPE_DMA:
1047 acpi_rs_dump_dma (&resource->data); 984 acpi_rs_dump_dma(&resource->data);
1048 break; 985 break;
1049 986
1050 case ACPI_RSTYPE_START_DPF: 987 case ACPI_RSTYPE_START_DPF:
1051 acpi_rs_dump_start_depend_fns (&resource->data); 988 acpi_rs_dump_start_depend_fns(&resource->data);
1052 break; 989 break;
1053 990
1054 case ACPI_RSTYPE_END_DPF: 991 case ACPI_RSTYPE_END_DPF:
1055 acpi_os_printf ("end_dependent_functions Resource\n"); 992 acpi_os_printf
1056 /* acpi_rs_dump_end_dependent_functions (Resource->Data);*/ 993 ("end_dependent_functions Resource\n");
994 /* acpi_rs_dump_end_dependent_functions (Resource->Data); */
1057 break; 995 break;
1058 996
1059 case ACPI_RSTYPE_IO: 997 case ACPI_RSTYPE_IO:
1060 acpi_rs_dump_io (&resource->data); 998 acpi_rs_dump_io(&resource->data);
1061 break; 999 break;
1062 1000
1063 case ACPI_RSTYPE_FIXED_IO: 1001 case ACPI_RSTYPE_FIXED_IO:
1064 acpi_rs_dump_fixed_io (&resource->data); 1002 acpi_rs_dump_fixed_io(&resource->data);
1065 break; 1003 break;
1066 1004
1067 case ACPI_RSTYPE_VENDOR: 1005 case ACPI_RSTYPE_VENDOR:
1068 acpi_rs_dump_vendor_specific (&resource->data); 1006 acpi_rs_dump_vendor_specific(&resource->data);
1069 break; 1007 break;
1070 1008
1071 case ACPI_RSTYPE_END_TAG: 1009 case ACPI_RSTYPE_END_TAG:
1072 /*rs_dump_end_tag (Resource->Data);*/ 1010 /*rs_dump_end_tag (Resource->Data); */
1073 acpi_os_printf ("end_tag Resource\n"); 1011 acpi_os_printf("end_tag Resource\n");
1074 done = TRUE; 1012 done = TRUE;
1075 break; 1013 break;
1076 1014
1077 case ACPI_RSTYPE_MEM24: 1015 case ACPI_RSTYPE_MEM24:
1078 acpi_rs_dump_memory24 (&resource->data); 1016 acpi_rs_dump_memory24(&resource->data);
1079 break; 1017 break;
1080 1018
1081 case ACPI_RSTYPE_MEM32: 1019 case ACPI_RSTYPE_MEM32:
1082 acpi_rs_dump_memory32 (&resource->data); 1020 acpi_rs_dump_memory32(&resource->data);
1083 break; 1021 break;
1084 1022
1085 case ACPI_RSTYPE_FIXED_MEM32: 1023 case ACPI_RSTYPE_FIXED_MEM32:
1086 acpi_rs_dump_fixed_memory32 (&resource->data); 1024 acpi_rs_dump_fixed_memory32(&resource->data);
1087 break; 1025 break;
1088 1026
1089 case ACPI_RSTYPE_ADDRESS16: 1027 case ACPI_RSTYPE_ADDRESS16:
1090 acpi_rs_dump_address16 (&resource->data); 1028 acpi_rs_dump_address16(&resource->data);
1091 break; 1029 break;
1092 1030
1093 case ACPI_RSTYPE_ADDRESS32: 1031 case ACPI_RSTYPE_ADDRESS32:
1094 acpi_rs_dump_address32 (&resource->data); 1032 acpi_rs_dump_address32(&resource->data);
1095 break; 1033 break;
1096 1034
1097 case ACPI_RSTYPE_ADDRESS64: 1035 case ACPI_RSTYPE_ADDRESS64:
1098 acpi_rs_dump_address64 (&resource->data); 1036 acpi_rs_dump_address64(&resource->data);
1099 break; 1037 break;
1100 1038
1101 case ACPI_RSTYPE_EXT_IRQ: 1039 case ACPI_RSTYPE_EXT_IRQ:
1102 acpi_rs_dump_extended_irq (&resource->data); 1040 acpi_rs_dump_extended_irq(&resource->data);
1103 break; 1041 break;
1104 1042
1105 default: 1043 default:
1106 acpi_os_printf ("Invalid resource type\n"); 1044 acpi_os_printf("Invalid resource type\n");
1107 break; 1045 break;
1108 1046
1109 } 1047 }
1110 1048
1111 resource = ACPI_PTR_ADD (struct acpi_resource, resource, resource->length); 1049 resource =
1050 ACPI_PTR_ADD(struct acpi_resource, resource,
1051 resource->length);
1112 } 1052 }
1113 } 1053 }
1114 1054
@@ -1127,36 +1067,38 @@ acpi_rs_dump_resource_list (
1127 * 1067 *
1128 ******************************************************************************/ 1068 ******************************************************************************/
1129 1069
1130void 1070void acpi_rs_dump_irq_list(u8 * route_table)
1131acpi_rs_dump_irq_list (
1132 u8 *route_table)
1133{ 1071{
1134 u8 *buffer = route_table; 1072 u8 *buffer = route_table;
1135 u8 count = 0; 1073 u8 count = 0;
1136 u8 done = FALSE; 1074 u8 done = FALSE;
1137 struct acpi_pci_routing_table *prt_element; 1075 struct acpi_pci_routing_table *prt_element;
1138
1139
1140 ACPI_FUNCTION_ENTRY ();
1141 1076
1077 ACPI_FUNCTION_ENTRY();
1142 1078
1143 if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) { 1079 if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) {
1144 prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); 1080 prt_element =
1081 ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
1145 1082
1146 while (!done) { 1083 while (!done) {
1147 acpi_os_printf ("PCI IRQ Routing Table structure %X.\n", count++); 1084 acpi_os_printf("PCI IRQ Routing Table structure %X.\n",
1085 count++);
1148 1086
1149 acpi_os_printf (" Address: %8.8X%8.8X\n", 1087 acpi_os_printf(" Address: %8.8X%8.8X\n",
1150 ACPI_FORMAT_UINT64 (prt_element->address)); 1088 ACPI_FORMAT_UINT64(prt_element->
1089 address));
1151 1090
1152 acpi_os_printf (" Pin: %X\n", prt_element->pin); 1091 acpi_os_printf(" Pin: %X\n", prt_element->pin);
1153 1092
1154 acpi_os_printf (" Source: %s\n", prt_element->source); 1093 acpi_os_printf(" Source: %s\n", prt_element->source);
1155 1094
1156 acpi_os_printf (" source_index: %X\n", prt_element->source_index); 1095 acpi_os_printf(" source_index: %X\n",
1096 prt_element->source_index);
1157 1097
1158 buffer += prt_element->length; 1098 buffer += prt_element->length;
1159 prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); 1099 prt_element =
1100 ACPI_CAST_PTR(struct acpi_pci_routing_table,
1101 buffer);
1160 if (0 == prt_element->length) { 1102 if (0 == prt_element->length) {
1161 done = TRUE; 1103 done = TRUE;
1162 } 1104 }
@@ -1167,4 +1109,3 @@ acpi_rs_dump_irq_list (
1167} 1109}
1168 1110
1169#endif 1111#endif
1170
diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c
index 23a4d149fac8..d53bbe89e851 100644
--- a/drivers/acpi/resources/rsio.c
+++ b/drivers/acpi/resources/rsio.c
@@ -41,13 +41,11 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acresrc.h> 45#include <acpi/acresrc.h>
47 46
48#define _COMPONENT ACPI_RESOURCES 47#define _COMPONENT ACPI_RESOURCES
49 ACPI_MODULE_NAME ("rsio") 48ACPI_MODULE_NAME("rsio")
50
51 49
52/******************************************************************************* 50/*******************************************************************************
53 * 51 *
@@ -69,24 +67,18 @@
69 * number of bytes consumed from the byte stream. 67 * number of bytes consumed from the byte stream.
70 * 68 *
71 ******************************************************************************/ 69 ******************************************************************************/
72
73acpi_status 70acpi_status
74acpi_rs_io_resource ( 71acpi_rs_io_resource(u8 * byte_stream_buffer,
75 u8 *byte_stream_buffer, 72 acpi_size * bytes_consumed,
76 acpi_size *bytes_consumed, 73 u8 ** output_buffer, acpi_size * structure_size)
77 u8 **output_buffer,
78 acpi_size *structure_size)
79{ 74{
80 u8 *buffer = byte_stream_buffer; 75 u8 *buffer = byte_stream_buffer;
81 struct acpi_resource *output_struct = (void *) *output_buffer; 76 struct acpi_resource *output_struct = (void *)*output_buffer;
82 u16 temp16 = 0; 77 u16 temp16 = 0;
83 u8 temp8 = 0; 78 u8 temp8 = 0;
84 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 79 acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_io);
85 struct acpi_resource_io);
86
87
88 ACPI_FUNCTION_TRACE ("rs_io_resource");
89 80
81 ACPI_FUNCTION_TRACE("rs_io_resource");
90 82
91 /* The number of bytes consumed are Constant */ 83 /* The number of bytes consumed are Constant */
92 84
@@ -104,14 +96,14 @@ acpi_rs_io_resource (
104 /* Check min_base Address */ 96 /* Check min_base Address */
105 97
106 buffer += 1; 98 buffer += 1;
107 ACPI_MOVE_16_TO_16 (&temp16, buffer); 99 ACPI_MOVE_16_TO_16(&temp16, buffer);
108 100
109 output_struct->data.io.min_base_address = temp16; 101 output_struct->data.io.min_base_address = temp16;
110 102
111 /* Check max_base Address */ 103 /* Check max_base Address */
112 104
113 buffer += 2; 105 buffer += 2;
114 ACPI_MOVE_16_TO_16 (&temp16, buffer); 106 ACPI_MOVE_16_TO_16(&temp16, buffer);
115 107
116 output_struct->data.io.max_base_address = temp16; 108 output_struct->data.io.max_base_address = temp16;
117 109
@@ -136,10 +128,9 @@ acpi_rs_io_resource (
136 /* Return the final size of the structure */ 128 /* Return the final size of the structure */
137 129
138 *structure_size = struct_size; 130 *structure_size = struct_size;
139 return_ACPI_STATUS (AE_OK); 131 return_ACPI_STATUS(AE_OK);
140} 132}
141 133
142
143/******************************************************************************* 134/*******************************************************************************
144 * 135 *
145 * FUNCTION: acpi_rs_fixed_io_resource 136 * FUNCTION: acpi_rs_fixed_io_resource
@@ -162,22 +153,18 @@ acpi_rs_io_resource (
162 ******************************************************************************/ 153 ******************************************************************************/
163 154
164acpi_status 155acpi_status
165acpi_rs_fixed_io_resource ( 156acpi_rs_fixed_io_resource(u8 * byte_stream_buffer,
166 u8 *byte_stream_buffer, 157 acpi_size * bytes_consumed,
167 acpi_size *bytes_consumed, 158 u8 ** output_buffer, acpi_size * structure_size)
168 u8 **output_buffer,
169 acpi_size *structure_size)
170{ 159{
171 u8 *buffer = byte_stream_buffer; 160 u8 *buffer = byte_stream_buffer;
172 struct acpi_resource *output_struct = (void *) *output_buffer; 161 struct acpi_resource *output_struct = (void *)*output_buffer;
173 u16 temp16 = 0; 162 u16 temp16 = 0;
174 u8 temp8 = 0; 163 u8 temp8 = 0;
175 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 164 acpi_size struct_size =
176 struct acpi_resource_fixed_io); 165 ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_io);
177
178
179 ACPI_FUNCTION_TRACE ("rs_fixed_io_resource");
180 166
167 ACPI_FUNCTION_TRACE("rs_fixed_io_resource");
181 168
182 /* The number of bytes consumed are Constant */ 169 /* The number of bytes consumed are Constant */
183 170
@@ -188,7 +175,7 @@ acpi_rs_fixed_io_resource (
188 /* Check Range Base Address */ 175 /* Check Range Base Address */
189 176
190 buffer += 1; 177 buffer += 1;
191 ACPI_MOVE_16_TO_16 (&temp16, buffer); 178 ACPI_MOVE_16_TO_16(&temp16, buffer);
192 179
193 output_struct->data.fixed_io.base_address = temp16; 180 output_struct->data.fixed_io.base_address = temp16;
194 181
@@ -206,10 +193,9 @@ acpi_rs_fixed_io_resource (
206 /* Return the final size of the structure */ 193 /* Return the final size of the structure */
207 194
208 *structure_size = struct_size; 195 *structure_size = struct_size;
209 return_ACPI_STATUS (AE_OK); 196 return_ACPI_STATUS(AE_OK);
210} 197}
211 198
212
213/******************************************************************************* 199/*******************************************************************************
214 * 200 *
215 * FUNCTION: acpi_rs_io_stream 201 * FUNCTION: acpi_rs_io_stream
@@ -227,18 +213,14 @@ acpi_rs_fixed_io_resource (
227 ******************************************************************************/ 213 ******************************************************************************/
228 214
229acpi_status 215acpi_status
230acpi_rs_io_stream ( 216acpi_rs_io_stream(struct acpi_resource *linked_list,
231 struct acpi_resource *linked_list, 217 u8 ** output_buffer, acpi_size * bytes_consumed)
232 u8 **output_buffer,
233 acpi_size *bytes_consumed)
234{ 218{
235 u8 *buffer = *output_buffer; 219 u8 *buffer = *output_buffer;
236 u16 temp16 = 0; 220 u16 temp16 = 0;
237 u8 temp8 = 0; 221 u8 temp8 = 0;
238
239
240 ACPI_FUNCTION_TRACE ("rs_io_stream");
241 222
223 ACPI_FUNCTION_TRACE("rs_io_stream");
242 224
243 /* The descriptor field is static */ 225 /* The descriptor field is static */
244 226
@@ -256,14 +238,14 @@ acpi_rs_io_stream (
256 238
257 temp16 = (u16) linked_list->data.io.min_base_address; 239 temp16 = (u16) linked_list->data.io.min_base_address;
258 240
259 ACPI_MOVE_16_TO_16 (buffer, &temp16); 241 ACPI_MOVE_16_TO_16(buffer, &temp16);
260 buffer += 2; 242 buffer += 2;
261 243
262 /* Set the Range maximum base address */ 244 /* Set the Range maximum base address */
263 245
264 temp16 = (u16) linked_list->data.io.max_base_address; 246 temp16 = (u16) linked_list->data.io.max_base_address;
265 247
266 ACPI_MOVE_16_TO_16 (buffer, &temp16); 248 ACPI_MOVE_16_TO_16(buffer, &temp16);
267 buffer += 2; 249 buffer += 2;
268 250
269 /* Set the base alignment */ 251 /* Set the base alignment */
@@ -282,11 +264,10 @@ acpi_rs_io_stream (
282 264
283 /* Return the number of bytes consumed in this operation */ 265 /* Return the number of bytes consumed in this operation */
284 266
285 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 267 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
286 return_ACPI_STATUS (AE_OK); 268 return_ACPI_STATUS(AE_OK);
287} 269}
288 270
289
290/******************************************************************************* 271/*******************************************************************************
291 * 272 *
292 * FUNCTION: acpi_rs_fixed_io_stream 273 * FUNCTION: acpi_rs_fixed_io_stream
@@ -304,18 +285,14 @@ acpi_rs_io_stream (
304 ******************************************************************************/ 285 ******************************************************************************/
305 286
306acpi_status 287acpi_status
307acpi_rs_fixed_io_stream ( 288acpi_rs_fixed_io_stream(struct acpi_resource *linked_list,
308 struct acpi_resource *linked_list, 289 u8 ** output_buffer, acpi_size * bytes_consumed)
309 u8 **output_buffer,
310 acpi_size *bytes_consumed)
311{ 290{
312 u8 *buffer = *output_buffer; 291 u8 *buffer = *output_buffer;
313 u16 temp16 = 0; 292 u16 temp16 = 0;
314 u8 temp8 = 0; 293 u8 temp8 = 0;
315
316
317 ACPI_FUNCTION_TRACE ("rs_fixed_io_stream");
318 294
295 ACPI_FUNCTION_TRACE("rs_fixed_io_stream");
319 296
320 /* The descriptor field is static */ 297 /* The descriptor field is static */
321 298
@@ -327,7 +304,7 @@ acpi_rs_fixed_io_stream (
327 304
328 temp16 = (u16) linked_list->data.fixed_io.base_address; 305 temp16 = (u16) linked_list->data.fixed_io.base_address;
329 306
330 ACPI_MOVE_16_TO_16 (buffer, &temp16); 307 ACPI_MOVE_16_TO_16(buffer, &temp16);
331 buffer += 2; 308 buffer += 2;
332 309
333 /* Set the range length */ 310 /* Set the range length */
@@ -339,11 +316,10 @@ acpi_rs_fixed_io_stream (
339 316
340 /* Return the number of bytes consumed in this operation */ 317 /* Return the number of bytes consumed in this operation */
341 318
342 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 319 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
343 return_ACPI_STATUS (AE_OK); 320 return_ACPI_STATUS(AE_OK);
344} 321}
345 322
346
347/******************************************************************************* 323/*******************************************************************************
348 * 324 *
349 * FUNCTION: acpi_rs_dma_resource 325 * FUNCTION: acpi_rs_dma_resource
@@ -366,23 +342,18 @@ acpi_rs_fixed_io_stream (
366 ******************************************************************************/ 342 ******************************************************************************/
367 343
368acpi_status 344acpi_status
369acpi_rs_dma_resource ( 345acpi_rs_dma_resource(u8 * byte_stream_buffer,
370 u8 *byte_stream_buffer, 346 acpi_size * bytes_consumed,
371 acpi_size *bytes_consumed, 347 u8 ** output_buffer, acpi_size * structure_size)
372 u8 **output_buffer,
373 acpi_size *structure_size)
374{ 348{
375 u8 *buffer = byte_stream_buffer; 349 u8 *buffer = byte_stream_buffer;
376 struct acpi_resource *output_struct = (void *) *output_buffer; 350 struct acpi_resource *output_struct = (void *)*output_buffer;
377 u8 temp8 = 0; 351 u8 temp8 = 0;
378 u8 index; 352 u8 index;
379 u8 i; 353 u8 i;
380 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 354 acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_dma);
381 struct acpi_resource_dma);
382
383
384 ACPI_FUNCTION_TRACE ("rs_dma_resource");
385 355
356 ACPI_FUNCTION_TRACE("rs_dma_resource");
386 357
387 /* The number of bytes consumed are Constant */ 358 /* The number of bytes consumed are Constant */
388 359
@@ -422,9 +393,9 @@ acpi_rs_dma_resource (
422 output_struct->data.dma.transfer = temp8 & 0x03; 393 output_struct->data.dma.transfer = temp8 & 0x03;
423 394
424 if (0x03 == output_struct->data.dma.transfer) { 395 if (0x03 == output_struct->data.dma.transfer) {
425 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 396 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
426 "Invalid DMA.Transfer preference (3)\n")); 397 "Invalid DMA.Transfer preference (3)\n"));
427 return_ACPI_STATUS (AE_BAD_DATA); 398 return_ACPI_STATUS(AE_BAD_DATA);
428 } 399 }
429 400
430 /* Get bus master preference (Bit[2]) */ 401 /* Get bus master preference (Bit[2]) */
@@ -442,10 +413,9 @@ acpi_rs_dma_resource (
442 /* Return the final size of the structure */ 413 /* Return the final size of the structure */
443 414
444 *structure_size = struct_size; 415 *structure_size = struct_size;
445 return_ACPI_STATUS (AE_OK); 416 return_ACPI_STATUS(AE_OK);
446} 417}
447 418
448
449/******************************************************************************* 419/*******************************************************************************
450 * 420 *
451 * FUNCTION: acpi_rs_dma_stream 421 * FUNCTION: acpi_rs_dma_stream
@@ -463,19 +433,15 @@ acpi_rs_dma_resource (
463 ******************************************************************************/ 433 ******************************************************************************/
464 434
465acpi_status 435acpi_status
466acpi_rs_dma_stream ( 436acpi_rs_dma_stream(struct acpi_resource *linked_list,
467 struct acpi_resource *linked_list, 437 u8 ** output_buffer, acpi_size * bytes_consumed)
468 u8 **output_buffer,
469 acpi_size *bytes_consumed)
470{ 438{
471 u8 *buffer = *output_buffer; 439 u8 *buffer = *output_buffer;
472 u16 temp16 = 0; 440 u16 temp16 = 0;
473 u8 temp8 = 0; 441 u8 temp8 = 0;
474 u8 index; 442 u8 index;
475
476
477 ACPI_FUNCTION_TRACE ("rs_dma_stream");
478 443
444 ACPI_FUNCTION_TRACE("rs_dma_stream");
479 445
480 /* The descriptor field is static */ 446 /* The descriptor field is static */
481 447
@@ -486,8 +452,7 @@ acpi_rs_dma_stream (
486 /* Loop through all of the Channels and set the mask bits */ 452 /* Loop through all of the Channels and set the mask bits */
487 453
488 for (index = 0; 454 for (index = 0;
489 index < linked_list->data.dma.number_of_channels; 455 index < linked_list->data.dma.number_of_channels; index++) {
490 index++) {
491 temp16 = (u16) linked_list->data.dma.channels[index]; 456 temp16 = (u16) linked_list->data.dma.channels[index];
492 temp8 |= 0x1 << temp16; 457 temp8 |= 0x1 << temp16;
493 } 458 }
@@ -506,7 +471,6 @@ acpi_rs_dma_stream (
506 471
507 /* Return the number of bytes consumed in this operation */ 472 /* Return the number of bytes consumed in this operation */
508 473
509 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 474 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
510 return_ACPI_STATUS (AE_OK); 475 return_ACPI_STATUS(AE_OK);
511} 476}
512
diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c
index 8a2b630be45b..7179b6243f5b 100644
--- a/drivers/acpi/resources/rsirq.c
+++ b/drivers/acpi/resources/rsirq.c
@@ -41,13 +41,11 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acresrc.h> 45#include <acpi/acresrc.h>
47 46
48#define _COMPONENT ACPI_RESOURCES 47#define _COMPONENT ACPI_RESOURCES
49 ACPI_MODULE_NAME ("rsirq") 48ACPI_MODULE_NAME("rsirq")
50
51 49
52/******************************************************************************* 50/*******************************************************************************
53 * 51 *
@@ -69,26 +67,20 @@
69 * number of bytes consumed from the byte stream. 67 * number of bytes consumed from the byte stream.
70 * 68 *
71 ******************************************************************************/ 69 ******************************************************************************/
72
73acpi_status 70acpi_status
74acpi_rs_irq_resource ( 71acpi_rs_irq_resource(u8 * byte_stream_buffer,
75 u8 *byte_stream_buffer, 72 acpi_size * bytes_consumed,
76 acpi_size *bytes_consumed, 73 u8 ** output_buffer, acpi_size * structure_size)
77 u8 **output_buffer,
78 acpi_size *structure_size)
79{ 74{
80 u8 *buffer = byte_stream_buffer; 75 u8 *buffer = byte_stream_buffer;
81 struct acpi_resource *output_struct = (void *) *output_buffer; 76 struct acpi_resource *output_struct = (void *)*output_buffer;
82 u16 temp16 = 0; 77 u16 temp16 = 0;
83 u8 temp8 = 0; 78 u8 temp8 = 0;
84 u8 index; 79 u8 index;
85 u8 i; 80 u8 i;
86 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 81 acpi_size struct_size = ACPI_SIZEOF_RESOURCE(struct acpi_resource_irq);
87 struct acpi_resource_irq);
88
89
90 ACPI_FUNCTION_TRACE ("rs_irq_resource");
91 82
83 ACPI_FUNCTION_TRACE("rs_irq_resource");
92 84
93 /* 85 /*
94 * The number of bytes consumed are contained in the descriptor 86 * The number of bytes consumed are contained in the descriptor
@@ -101,7 +93,7 @@ acpi_rs_irq_resource (
101 /* Point to the 16-bits of Bytes 1 and 2 */ 93 /* Point to the 16-bits of Bytes 1 and 2 */
102 94
103 buffer += 1; 95 buffer += 1;
104 ACPI_MOVE_16_TO_16 (&temp16, buffer); 96 ACPI_MOVE_16_TO_16(&temp16, buffer);
105 97
106 output_struct->data.irq.number_of_interrupts = 0; 98 output_struct->data.irq.number_of_interrupts = 0;
107 99
@@ -132,14 +124,18 @@ acpi_rs_irq_resource (
132 /* Check for HE, LL interrupts */ 124 /* Check for HE, LL interrupts */
133 125
134 switch (temp8 & 0x09) { 126 switch (temp8 & 0x09) {
135 case 0x01: /* HE */ 127 case 0x01: /* HE */
136 output_struct->data.irq.edge_level = ACPI_EDGE_SENSITIVE; 128 output_struct->data.irq.edge_level =
137 output_struct->data.irq.active_high_low = ACPI_ACTIVE_HIGH; 129 ACPI_EDGE_SENSITIVE;
130 output_struct->data.irq.active_high_low =
131 ACPI_ACTIVE_HIGH;
138 break; 132 break;
139 133
140 case 0x08: /* LL */ 134 case 0x08: /* LL */
141 output_struct->data.irq.edge_level = ACPI_LEVEL_SENSITIVE; 135 output_struct->data.irq.edge_level =
142 output_struct->data.irq.active_high_low = ACPI_ACTIVE_LOW; 136 ACPI_LEVEL_SENSITIVE;
137 output_struct->data.irq.active_high_low =
138 ACPI_ACTIVE_LOW;
143 break; 139 break;
144 140
145 default: 141 default:
@@ -148,17 +144,16 @@ acpi_rs_irq_resource (
148 * are allowed (ACPI spec, section "IRQ Format") 144 * are allowed (ACPI spec, section "IRQ Format")
149 * so 0x00 and 0x09 are illegal. 145 * so 0x00 and 0x09 are illegal.
150 */ 146 */
151 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 147 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
152 "Invalid interrupt polarity/trigger in resource list, %X\n", 148 "Invalid interrupt polarity/trigger in resource list, %X\n",
153 temp8)); 149 temp8));
154 return_ACPI_STATUS (AE_BAD_DATA); 150 return_ACPI_STATUS(AE_BAD_DATA);
155 } 151 }
156 152
157 /* Check for sharable */ 153 /* Check for sharable */
158 154
159 output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01; 155 output_struct->data.irq.shared_exclusive = (temp8 >> 3) & 0x01;
160 } 156 } else {
161 else {
162 /* 157 /*
163 * Assume Edge Sensitive, Active High, Non-Sharable 158 * Assume Edge Sensitive, Active High, Non-Sharable
164 * per ACPI Specification 159 * per ACPI Specification
@@ -175,10 +170,9 @@ acpi_rs_irq_resource (
175 /* Return the final size of the structure */ 170 /* Return the final size of the structure */
176 171
177 *structure_size = struct_size; 172 *structure_size = struct_size;
178 return_ACPI_STATUS (AE_OK); 173 return_ACPI_STATUS(AE_OK);
179} 174}
180 175
181
182/******************************************************************************* 176/*******************************************************************************
183 * 177 *
184 * FUNCTION: acpi_rs_irq_stream 178 * FUNCTION: acpi_rs_irq_stream
@@ -196,32 +190,27 @@ acpi_rs_irq_resource (
196 ******************************************************************************/ 190 ******************************************************************************/
197 191
198acpi_status 192acpi_status
199acpi_rs_irq_stream ( 193acpi_rs_irq_stream(struct acpi_resource *linked_list,
200 struct acpi_resource *linked_list, 194 u8 ** output_buffer, acpi_size * bytes_consumed)
201 u8 **output_buffer,
202 acpi_size *bytes_consumed)
203{ 195{
204 u8 *buffer = *output_buffer; 196 u8 *buffer = *output_buffer;
205 u16 temp16 = 0; 197 u16 temp16 = 0;
206 u8 temp8 = 0; 198 u8 temp8 = 0;
207 u8 index; 199 u8 index;
208 u8 IRqinfo_byte_needed; 200 u8 IRqinfo_byte_needed;
209
210
211 ACPI_FUNCTION_TRACE ("rs_irq_stream");
212 201
202 ACPI_FUNCTION_TRACE("rs_irq_stream");
213 203
214 /* 204 /*
215 * The descriptor field is set based upon whether a third byte is 205 * The descriptor field is set based upon whether a third byte is
216 * needed to contain the IRQ Information. 206 * needed to contain the IRQ Information.
217 */ 207 */
218 if (ACPI_EDGE_SENSITIVE == linked_list->data.irq.edge_level && 208 if (ACPI_EDGE_SENSITIVE == linked_list->data.irq.edge_level &&
219 ACPI_ACTIVE_HIGH == linked_list->data.irq.active_high_low && 209 ACPI_ACTIVE_HIGH == linked_list->data.irq.active_high_low &&
220 ACPI_EXCLUSIVE == linked_list->data.irq.shared_exclusive) { 210 ACPI_EXCLUSIVE == linked_list->data.irq.shared_exclusive) {
221 *buffer = 0x22; 211 *buffer = 0x22;
222 IRqinfo_byte_needed = FALSE; 212 IRqinfo_byte_needed = FALSE;
223 } 213 } else {
224 else {
225 *buffer = 0x23; 214 *buffer = 0x23;
226 IRqinfo_byte_needed = TRUE; 215 IRqinfo_byte_needed = TRUE;
227 } 216 }
@@ -231,14 +220,13 @@ acpi_rs_irq_stream (
231 220
232 /* Loop through all of the interrupts and set the mask bits */ 221 /* Loop through all of the interrupts and set the mask bits */
233 222
234 for(index = 0; 223 for (index = 0;
235 index < linked_list->data.irq.number_of_interrupts; 224 index < linked_list->data.irq.number_of_interrupts; index++) {
236 index++) {
237 temp8 = (u8) linked_list->data.irq.interrupts[index]; 225 temp8 = (u8) linked_list->data.irq.interrupts[index];
238 temp16 |= 0x1 << temp8; 226 temp16 |= 0x1 << temp8;
239 } 227 }
240 228
241 ACPI_MOVE_16_TO_16 (buffer, &temp16); 229 ACPI_MOVE_16_TO_16(buffer, &temp16);
242 buffer += 2; 230 buffer += 2;
243 231
244 /* Set the IRQ Info byte if needed. */ 232 /* Set the IRQ Info byte if needed. */
@@ -246,13 +234,12 @@ acpi_rs_irq_stream (
246 if (IRqinfo_byte_needed) { 234 if (IRqinfo_byte_needed) {
247 temp8 = 0; 235 temp8 = 0;
248 temp8 = (u8) ((linked_list->data.irq.shared_exclusive & 236 temp8 = (u8) ((linked_list->data.irq.shared_exclusive &
249 0x01) << 4); 237 0x01) << 4);
250 238
251 if (ACPI_LEVEL_SENSITIVE == linked_list->data.irq.edge_level && 239 if (ACPI_LEVEL_SENSITIVE == linked_list->data.irq.edge_level &&
252 ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) { 240 ACPI_ACTIVE_LOW == linked_list->data.irq.active_high_low) {
253 temp8 |= 0x08; 241 temp8 |= 0x08;
254 } 242 } else {
255 else {
256 temp8 |= 0x01; 243 temp8 |= 0x01;
257 } 244 }
258 245
@@ -262,11 +249,10 @@ acpi_rs_irq_stream (
262 249
263 /* Return the number of bytes consumed in this operation */ 250 /* Return the number of bytes consumed in this operation */
264 251
265 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 252 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
266 return_ACPI_STATUS (AE_OK); 253 return_ACPI_STATUS(AE_OK);
267} 254}
268 255
269
270/******************************************************************************* 256/*******************************************************************************
271 * 257 *
272 * FUNCTION: acpi_rs_extended_irq_resource 258 * FUNCTION: acpi_rs_extended_irq_resource
@@ -289,34 +275,30 @@ acpi_rs_irq_stream (
289 ******************************************************************************/ 275 ******************************************************************************/
290 276
291acpi_status 277acpi_status
292acpi_rs_extended_irq_resource ( 278acpi_rs_extended_irq_resource(u8 * byte_stream_buffer,
293 u8 *byte_stream_buffer, 279 acpi_size * bytes_consumed,
294 acpi_size *bytes_consumed, 280 u8 ** output_buffer, acpi_size * structure_size)
295 u8 **output_buffer,
296 acpi_size *structure_size)
297{ 281{
298 u8 *buffer = byte_stream_buffer; 282 u8 *buffer = byte_stream_buffer;
299 struct acpi_resource *output_struct = (void *) *output_buffer; 283 struct acpi_resource *output_struct = (void *)*output_buffer;
300 u16 temp16 = 0; 284 u16 temp16 = 0;
301 u8 temp8 = 0; 285 u8 temp8 = 0;
302 u8 *temp_ptr; 286 u8 *temp_ptr;
303 u8 index; 287 u8 index;
304 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 288 acpi_size struct_size =
305 struct acpi_resource_ext_irq); 289 ACPI_SIZEOF_RESOURCE(struct acpi_resource_ext_irq);
306
307
308 ACPI_FUNCTION_TRACE ("rs_extended_irq_resource");
309 290
291 ACPI_FUNCTION_TRACE("rs_extended_irq_resource");
310 292
311 /* Point past the Descriptor to get the number of bytes consumed */ 293 /* Point past the Descriptor to get the number of bytes consumed */
312 294
313 buffer += 1; 295 buffer += 1;
314 ACPI_MOVE_16_TO_16 (&temp16, buffer); 296 ACPI_MOVE_16_TO_16(&temp16, buffer);
315 297
316 /* Validate minimum descriptor length */ 298 /* Validate minimum descriptor length */
317 299
318 if (temp16 < 6) { 300 if (temp16 < 6) {
319 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); 301 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
320 } 302 }
321 303
322 *bytes_consumed = temp16 + 3; 304 *bytes_consumed = temp16 + 3;
@@ -338,7 +320,7 @@ acpi_rs_extended_irq_resource (
338 * - Edge/Level are defined opposite in the table vs the headers 320 * - Edge/Level are defined opposite in the table vs the headers
339 */ 321 */
340 output_struct->data.extended_irq.edge_level = 322 output_struct->data.extended_irq.edge_level =
341 (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE; 323 (temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE;
342 324
343 /* Check Interrupt Polarity */ 325 /* Check Interrupt Polarity */
344 326
@@ -356,7 +338,7 @@ acpi_rs_extended_irq_resource (
356 /* Must have at least one IRQ */ 338 /* Must have at least one IRQ */
357 339
358 if (temp8 < 1) { 340 if (temp8 < 1) {
359 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); 341 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH);
360 } 342 }
361 343
362 output_struct->data.extended_irq.number_of_interrupts = temp8; 344 output_struct->data.extended_irq.number_of_interrupts = temp8;
@@ -374,8 +356,8 @@ acpi_rs_extended_irq_resource (
374 /* Cycle through every IRQ in the table */ 356 /* Cycle through every IRQ in the table */
375 357
376 for (index = 0; index < temp8; index++) { 358 for (index = 0; index < temp8; index++) {
377 ACPI_MOVE_32_TO_32 ( 359 ACPI_MOVE_32_TO_32(&output_struct->data.extended_irq.
378 &output_struct->data.extended_irq.interrupts[index], buffer); 360 interrupts[index], buffer);
379 361
380 /* Point to the next IRQ */ 362 /* Point to the next IRQ */
381 363
@@ -393,12 +375,13 @@ acpi_rs_extended_irq_resource (
393 * we add 1 to the length. 375 * we add 1 to the length.
394 */ 376 */
395 if (*bytes_consumed > 377 if (*bytes_consumed >
396 ((acpi_size) output_struct->data.extended_irq.number_of_interrupts * 4) + 378 ((acpi_size) output_struct->data.extended_irq.number_of_interrupts *
397 (5 + 1)) { 379 4) + (5 + 1)) {
398 /* Dereference the Index */ 380 /* Dereference the Index */
399 381
400 temp8 = *buffer; 382 temp8 = *buffer;
401 output_struct->data.extended_irq.resource_source.index = (u32) temp8; 383 output_struct->data.extended_irq.resource_source.index =
384 (u32) temp8;
402 385
403 /* Point to the String */ 386 /* Point to the String */
404 387
@@ -407,10 +390,10 @@ acpi_rs_extended_irq_resource (
407 /* Point the String pointer to the end of this structure. */ 390 /* Point the String pointer to the end of this structure. */
408 391
409 output_struct->data.extended_irq.resource_source.string_ptr = 392 output_struct->data.extended_irq.resource_source.string_ptr =
410 (char *)((char *) output_struct + struct_size); 393 (char *)((char *)output_struct + struct_size);
411 394
412 temp_ptr = (u8 *) 395 temp_ptr = (u8 *)
413 output_struct->data.extended_irq.resource_source.string_ptr; 396 output_struct->data.extended_irq.resource_source.string_ptr;
414 397
415 /* Copy the string into the buffer */ 398 /* Copy the string into the buffer */
416 399
@@ -426,7 +409,8 @@ acpi_rs_extended_irq_resource (
426 /* Add the terminating null */ 409 /* Add the terminating null */
427 410
428 *temp_ptr = 0x00; 411 *temp_ptr = 0x00;
429 output_struct->data.extended_irq.resource_source.string_length = index + 1; 412 output_struct->data.extended_irq.resource_source.string_length =
413 index + 1;
430 414
431 /* 415 /*
432 * In order for the struct_size to fall on a 32-bit boundary, 416 * In order for the struct_size to fall on a 32-bit boundary,
@@ -434,12 +418,13 @@ acpi_rs_extended_irq_resource (
434 * struct_size to the next 32-bit boundary. 418 * struct_size to the next 32-bit boundary.
435 */ 419 */
436 temp8 = (u8) (index + 1); 420 temp8 = (u8) (index + 1);
437 struct_size += ACPI_ROUND_UP_to_32_bITS (temp8); 421 struct_size += ACPI_ROUND_UP_to_32_bITS(temp8);
438 } 422 } else {
439 else {
440 output_struct->data.extended_irq.resource_source.index = 0x00; 423 output_struct->data.extended_irq.resource_source.index = 0x00;
441 output_struct->data.extended_irq.resource_source.string_length = 0; 424 output_struct->data.extended_irq.resource_source.string_length =
442 output_struct->data.extended_irq.resource_source.string_ptr = NULL; 425 0;
426 output_struct->data.extended_irq.resource_source.string_ptr =
427 NULL;
443 } 428 }
444 429
445 /* Set the Length parameter */ 430 /* Set the Length parameter */
@@ -449,10 +434,9 @@ acpi_rs_extended_irq_resource (
449 /* Return the final size of the structure */ 434 /* Return the final size of the structure */
450 435
451 *structure_size = struct_size; 436 *structure_size = struct_size;
452 return_ACPI_STATUS (AE_OK); 437 return_ACPI_STATUS(AE_OK);
453} 438}
454 439
455
456/******************************************************************************* 440/*******************************************************************************
457 * 441 *
458 * FUNCTION: acpi_rs_extended_irq_stream 442 * FUNCTION: acpi_rs_extended_irq_stream
@@ -470,20 +454,16 @@ acpi_rs_extended_irq_resource (
470 ******************************************************************************/ 454 ******************************************************************************/
471 455
472acpi_status 456acpi_status
473acpi_rs_extended_irq_stream ( 457acpi_rs_extended_irq_stream(struct acpi_resource *linked_list,
474 struct acpi_resource *linked_list, 458 u8 ** output_buffer, acpi_size * bytes_consumed)
475 u8 **output_buffer,
476 acpi_size *bytes_consumed)
477{ 459{
478 u8 *buffer = *output_buffer; 460 u8 *buffer = *output_buffer;
479 u16 *length_field; 461 u16 *length_field;
480 u8 temp8 = 0; 462 u8 temp8 = 0;
481 u8 index; 463 u8 index;
482 char *temp_pointer = NULL; 464 char *temp_pointer = NULL;
483
484
485 ACPI_FUNCTION_TRACE ("rs_extended_irq_stream");
486 465
466 ACPI_FUNCTION_TRACE("rs_extended_irq_stream");
487 467
488 /* The descriptor field is static */ 468 /* The descriptor field is static */
489 469
@@ -492,13 +472,14 @@ acpi_rs_extended_irq_stream (
492 472
493 /* Set a pointer to the Length field - to be filled in later */ 473 /* Set a pointer to the Length field - to be filled in later */
494 474
495 length_field = ACPI_CAST_PTR (u16, buffer); 475 length_field = ACPI_CAST_PTR(u16, buffer);
496 buffer += 2; 476 buffer += 2;
497 477
498 /* Set the Interrupt vector flags */ 478 /* Set the Interrupt vector flags */
499 479
500 temp8 = (u8)(linked_list->data.extended_irq.producer_consumer & 0x01); 480 temp8 = (u8) (linked_list->data.extended_irq.producer_consumer & 0x01);
501 temp8 |= ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3); 481 temp8 |=
482 ((linked_list->data.extended_irq.shared_exclusive & 0x01) << 3);
502 483
503 /* 484 /*
504 * Set the Interrupt Mode 485 * Set the Interrupt Mode
@@ -527,43 +508,48 @@ acpi_rs_extended_irq_stream (
527 *buffer = temp8; 508 *buffer = temp8;
528 buffer += 1; 509 buffer += 1;
529 510
530 for (index = 0; index < linked_list->data.extended_irq.number_of_interrupts; 511 for (index = 0;
531 index++) { 512 index < linked_list->data.extended_irq.number_of_interrupts;
532 ACPI_MOVE_32_TO_32 (buffer, 513 index++) {
533 &linked_list->data.extended_irq.interrupts[index]); 514 ACPI_MOVE_32_TO_32(buffer,
515 &linked_list->data.extended_irq.
516 interrupts[index]);
534 buffer += 4; 517 buffer += 4;
535 } 518 }
536 519
537 /* Resource Source Index and Resource Source are optional */ 520 /* Resource Source Index and Resource Source are optional */
538 521
539 if (0 != linked_list->data.extended_irq.resource_source.string_length) { 522 if (0 != linked_list->data.extended_irq.resource_source.string_length) {
540 *buffer = (u8) linked_list->data.extended_irq.resource_source.index; 523 *buffer =
524 (u8) linked_list->data.extended_irq.resource_source.index;
541 buffer += 1; 525 buffer += 1;
542 526
543 temp_pointer = (char *) buffer; 527 temp_pointer = (char *)buffer;
544 528
545 /* Copy the string */ 529 /* Copy the string */
546 530
547 ACPI_STRCPY (temp_pointer, 531 ACPI_STRCPY(temp_pointer,
548 linked_list->data.extended_irq.resource_source.string_ptr); 532 linked_list->data.extended_irq.resource_source.
533 string_ptr);
549 534
550 /* 535 /*
551 * Buffer needs to be set to the length of the sting + one for the 536 * Buffer needs to be set to the length of the sting + one for the
552 * terminating null 537 * terminating null
553 */ 538 */
554 buffer += (acpi_size) (ACPI_STRLEN ( 539 buffer +=
555 linked_list->data.extended_irq.resource_source.string_ptr) + 1); 540 (acpi_size) (ACPI_STRLEN
541 (linked_list->data.extended_irq.
542 resource_source.string_ptr) + 1);
556 } 543 }
557 544
558 /* Return the number of bytes consumed in this operation */ 545 /* Return the number of bytes consumed in this operation */
559 546
560 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 547 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
561 548
562 /* 549 /*
563 * Set the length field to the number of bytes consumed 550 * Set the length field to the number of bytes consumed
564 * minus the header size (3 bytes) 551 * minus the header size (3 bytes)
565 */ 552 */
566 *length_field = (u16) (*bytes_consumed - 3); 553 *length_field = (u16) (*bytes_consumed - 3);
567 return_ACPI_STATUS (AE_OK); 554 return_ACPI_STATUS(AE_OK);
568} 555}
569
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c
index db7bcb4e60e3..103eb31c284e 100644
--- a/drivers/acpi/resources/rslist.c
+++ b/drivers/acpi/resources/rslist.c
@@ -41,13 +41,11 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acresrc.h> 45#include <acpi/acresrc.h>
47 46
48#define _COMPONENT ACPI_RESOURCES 47#define _COMPONENT ACPI_RESOURCES
49 ACPI_MODULE_NAME ("rslist") 48ACPI_MODULE_NAME("rslist")
50
51 49
52/******************************************************************************* 50/*******************************************************************************
53 * 51 *
@@ -61,14 +59,10 @@
61 * a resource descriptor. 59 * a resource descriptor.
62 * 60 *
63 ******************************************************************************/ 61 ******************************************************************************/
64 62u8 acpi_rs_get_resource_type(u8 resource_start_byte)
65u8
66acpi_rs_get_resource_type (
67 u8 resource_start_byte)
68{ 63{
69 64
70 ACPI_FUNCTION_ENTRY (); 65 ACPI_FUNCTION_ENTRY();
71
72 66
73 /* Determine if this is a small or large resource */ 67 /* Determine if this is a small or large resource */
74 68
@@ -79,14 +73,12 @@ acpi_rs_get_resource_type (
79 73
80 return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK)); 74 return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK));
81 75
82
83 case ACPI_RDESC_TYPE_LARGE: 76 case ACPI_RDESC_TYPE_LARGE:
84 77
85 /* Large Resource Type -- All bits are valid */ 78 /* Large Resource Type -- All bits are valid */
86 79
87 return (resource_start_byte); 80 return (resource_start_byte);
88 81
89
90 default: 82 default:
91 /* Invalid type */ 83 /* Invalid type */
92 break; 84 break;
@@ -95,7 +87,6 @@ acpi_rs_get_resource_type (
95 return (0xFF); 87 return (0xFF);
96} 88}
97 89
98
99/******************************************************************************* 90/*******************************************************************************
100 * 91 *
101 * FUNCTION: acpi_rs_byte_stream_to_list 92 * FUNCTION: acpi_rs_byte_stream_to_list
@@ -113,176 +104,189 @@ acpi_rs_get_resource_type (
113 ******************************************************************************/ 104 ******************************************************************************/
114 105
115acpi_status 106acpi_status
116acpi_rs_byte_stream_to_list ( 107acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer,
117 u8 *byte_stream_buffer, 108 u32 byte_stream_buffer_length, u8 * output_buffer)
118 u32 byte_stream_buffer_length,
119 u8 *output_buffer)
120{ 109{
121 acpi_status status; 110 acpi_status status;
122 acpi_size bytes_parsed = 0; 111 acpi_size bytes_parsed = 0;
123 u8 resource_type = 0; 112 u8 resource_type = 0;
124 acpi_size bytes_consumed = 0; 113 acpi_size bytes_consumed = 0;
125 u8 *buffer = output_buffer; 114 u8 *buffer = output_buffer;
126 acpi_size structure_size = 0; 115 acpi_size structure_size = 0;
127 u8 end_tag_processed = FALSE; 116 u8 end_tag_processed = FALSE;
128 struct acpi_resource *resource; 117 struct acpi_resource *resource;
129 118
130 ACPI_FUNCTION_TRACE ("rs_byte_stream_to_list"); 119 ACPI_FUNCTION_TRACE("rs_byte_stream_to_list");
131 120
132 121 while (bytes_parsed < byte_stream_buffer_length && !end_tag_processed) {
133 while (bytes_parsed < byte_stream_buffer_length &&
134 !end_tag_processed) {
135 /* The next byte in the stream is the resource type */ 122 /* The next byte in the stream is the resource type */
136 123
137 resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); 124 resource_type = acpi_rs_get_resource_type(*byte_stream_buffer);
138 125
139 switch (resource_type) { 126 switch (resource_type) {
140 case ACPI_RDESC_TYPE_MEMORY_24: 127 case ACPI_RDESC_TYPE_MEMORY_24:
141 /* 128 /*
142 * 24-Bit Memory Resource 129 * 24-Bit Memory Resource
143 */ 130 */
144 status = acpi_rs_memory24_resource (byte_stream_buffer, 131 status = acpi_rs_memory24_resource(byte_stream_buffer,
145 &bytes_consumed, &buffer, &structure_size); 132 &bytes_consumed,
133 &buffer,
134 &structure_size);
146 break; 135 break;
147 136
148
149 case ACPI_RDESC_TYPE_LARGE_VENDOR: 137 case ACPI_RDESC_TYPE_LARGE_VENDOR:
150 /* 138 /*
151 * Vendor Defined Resource 139 * Vendor Defined Resource
152 */ 140 */
153 status = acpi_rs_vendor_resource (byte_stream_buffer, 141 status = acpi_rs_vendor_resource(byte_stream_buffer,
154 &bytes_consumed, &buffer, &structure_size); 142 &bytes_consumed,
143 &buffer,
144 &structure_size);
155 break; 145 break;
156 146
157
158 case ACPI_RDESC_TYPE_MEMORY_32: 147 case ACPI_RDESC_TYPE_MEMORY_32:
159 /* 148 /*
160 * 32-Bit Memory Range Resource 149 * 32-Bit Memory Range Resource
161 */ 150 */
162 status = acpi_rs_memory32_range_resource (byte_stream_buffer, 151 status =
163 &bytes_consumed, &buffer, &structure_size); 152 acpi_rs_memory32_range_resource(byte_stream_buffer,
153 &bytes_consumed,
154 &buffer,
155 &structure_size);
164 break; 156 break;
165 157
166
167 case ACPI_RDESC_TYPE_FIXED_MEMORY_32: 158 case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
168 /* 159 /*
169 * 32-Bit Fixed Memory Resource 160 * 32-Bit Fixed Memory Resource
170 */ 161 */
171 status = acpi_rs_fixed_memory32_resource (byte_stream_buffer, 162 status =
172 &bytes_consumed, &buffer, &structure_size); 163 acpi_rs_fixed_memory32_resource(byte_stream_buffer,
164 &bytes_consumed,
165 &buffer,
166 &structure_size);
173 break; 167 break;
174 168
175
176 case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE: 169 case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
177 case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE: 170 case ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE:
178 /* 171 /*
179 * 64-Bit Address Resource 172 * 64-Bit Address Resource
180 */ 173 */
181 status = acpi_rs_address64_resource (byte_stream_buffer, 174 status = acpi_rs_address64_resource(byte_stream_buffer,
182 &bytes_consumed, &buffer, &structure_size); 175 &bytes_consumed,
176 &buffer,
177 &structure_size);
183 break; 178 break;
184 179
185
186 case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE: 180 case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
187 /* 181 /*
188 * 32-Bit Address Resource 182 * 32-Bit Address Resource
189 */ 183 */
190 status = acpi_rs_address32_resource (byte_stream_buffer, 184 status = acpi_rs_address32_resource(byte_stream_buffer,
191 &bytes_consumed, &buffer, &structure_size); 185 &bytes_consumed,
186 &buffer,
187 &structure_size);
192 break; 188 break;
193 189
194
195 case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE: 190 case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
196 /* 191 /*
197 * 16-Bit Address Resource 192 * 16-Bit Address Resource
198 */ 193 */
199 status = acpi_rs_address16_resource (byte_stream_buffer, 194 status = acpi_rs_address16_resource(byte_stream_buffer,
200 &bytes_consumed, &buffer, &structure_size); 195 &bytes_consumed,
196 &buffer,
197 &structure_size);
201 break; 198 break;
202 199
203
204 case ACPI_RDESC_TYPE_EXTENDED_XRUPT: 200 case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
205 /* 201 /*
206 * Extended IRQ 202 * Extended IRQ
207 */ 203 */
208 status = acpi_rs_extended_irq_resource (byte_stream_buffer, 204 status =
209 &bytes_consumed, &buffer, &structure_size); 205 acpi_rs_extended_irq_resource(byte_stream_buffer,
206 &bytes_consumed,
207 &buffer,
208 &structure_size);
210 break; 209 break;
211 210
212
213 case ACPI_RDESC_TYPE_IRQ_FORMAT: 211 case ACPI_RDESC_TYPE_IRQ_FORMAT:
214 /* 212 /*
215 * IRQ Resource 213 * IRQ Resource
216 */ 214 */
217 status = acpi_rs_irq_resource (byte_stream_buffer, 215 status = acpi_rs_irq_resource(byte_stream_buffer,
218 &bytes_consumed, &buffer, &structure_size); 216 &bytes_consumed, &buffer,
217 &structure_size);
219 break; 218 break;
220 219
221
222 case ACPI_RDESC_TYPE_DMA_FORMAT: 220 case ACPI_RDESC_TYPE_DMA_FORMAT:
223 /* 221 /*
224 * DMA Resource 222 * DMA Resource
225 */ 223 */
226 status = acpi_rs_dma_resource (byte_stream_buffer, 224 status = acpi_rs_dma_resource(byte_stream_buffer,
227 &bytes_consumed, &buffer, &structure_size); 225 &bytes_consumed, &buffer,
226 &structure_size);
228 break; 227 break;
229 228
230
231 case ACPI_RDESC_TYPE_START_DEPENDENT: 229 case ACPI_RDESC_TYPE_START_DEPENDENT:
232 /* 230 /*
233 * Start Dependent Functions Resource 231 * Start Dependent Functions Resource
234 */ 232 */
235 status = acpi_rs_start_depend_fns_resource (byte_stream_buffer, 233 status =
236 &bytes_consumed, &buffer, &structure_size); 234 acpi_rs_start_depend_fns_resource
235 (byte_stream_buffer, &bytes_consumed, &buffer,
236 &structure_size);
237 break; 237 break;
238 238
239
240 case ACPI_RDESC_TYPE_END_DEPENDENT: 239 case ACPI_RDESC_TYPE_END_DEPENDENT:
241 /* 240 /*
242 * End Dependent Functions Resource 241 * End Dependent Functions Resource
243 */ 242 */
244 status = acpi_rs_end_depend_fns_resource (byte_stream_buffer, 243 status =
245 &bytes_consumed, &buffer, &structure_size); 244 acpi_rs_end_depend_fns_resource(byte_stream_buffer,
245 &bytes_consumed,
246 &buffer,
247 &structure_size);
246 break; 248 break;
247 249
248
249 case ACPI_RDESC_TYPE_IO_PORT: 250 case ACPI_RDESC_TYPE_IO_PORT:
250 /* 251 /*
251 * IO Port Resource 252 * IO Port Resource
252 */ 253 */
253 status = acpi_rs_io_resource (byte_stream_buffer, 254 status = acpi_rs_io_resource(byte_stream_buffer,
254 &bytes_consumed, &buffer, &structure_size); 255 &bytes_consumed, &buffer,
256 &structure_size);
255 break; 257 break;
256 258
257
258 case ACPI_RDESC_TYPE_FIXED_IO_PORT: 259 case ACPI_RDESC_TYPE_FIXED_IO_PORT:
259 /* 260 /*
260 * Fixed IO Port Resource 261 * Fixed IO Port Resource
261 */ 262 */
262 status = acpi_rs_fixed_io_resource (byte_stream_buffer, 263 status = acpi_rs_fixed_io_resource(byte_stream_buffer,
263 &bytes_consumed, &buffer, &structure_size); 264 &bytes_consumed,
265 &buffer,
266 &structure_size);
264 break; 267 break;
265 268
266
267 case ACPI_RDESC_TYPE_SMALL_VENDOR: 269 case ACPI_RDESC_TYPE_SMALL_VENDOR:
268 /* 270 /*
269 * Vendor Specific Resource 271 * Vendor Specific Resource
270 */ 272 */
271 status = acpi_rs_vendor_resource (byte_stream_buffer, 273 status = acpi_rs_vendor_resource(byte_stream_buffer,
272 &bytes_consumed, &buffer, &structure_size); 274 &bytes_consumed,
275 &buffer,
276 &structure_size);
273 break; 277 break;
274 278
275
276 case ACPI_RDESC_TYPE_END_TAG: 279 case ACPI_RDESC_TYPE_END_TAG:
277 /* 280 /*
278 * End Tag 281 * End Tag
279 */ 282 */
280 end_tag_processed = TRUE; 283 end_tag_processed = TRUE;
281 status = acpi_rs_end_tag_resource (byte_stream_buffer, 284 status = acpi_rs_end_tag_resource(byte_stream_buffer,
282 &bytes_consumed, &buffer, &structure_size); 285 &bytes_consumed,
286 &buffer,
287 &structure_size);
283 break; 288 break;
284 289
285
286 default: 290 default:
287 /* 291 /*
288 * Invalid/Unknown resource type 292 * Invalid/Unknown resource type
@@ -291,8 +295,8 @@ acpi_rs_byte_stream_to_list (
291 break; 295 break;
292 } 296 }
293 297
294 if (ACPI_FAILURE (status)) { 298 if (ACPI_FAILURE(status)) {
295 return_ACPI_STATUS (status); 299 return_ACPI_STATUS(status);
296 } 300 }
297 301
298 /* Update the return value and counter */ 302 /* Update the return value and counter */
@@ -305,21 +309,21 @@ acpi_rs_byte_stream_to_list (
305 309
306 /* Set the Buffer to the next structure */ 310 /* Set the Buffer to the next structure */
307 311
308 resource = ACPI_CAST_PTR (struct acpi_resource, buffer); 312 resource = ACPI_CAST_PTR(struct acpi_resource, buffer);
309 resource->length = (u32) ACPI_ALIGN_RESOURCE_SIZE (resource->length); 313 resource->length =
310 buffer += ACPI_ALIGN_RESOURCE_SIZE (structure_size); 314 (u32) ACPI_ALIGN_RESOURCE_SIZE(resource->length);
315 buffer += ACPI_ALIGN_RESOURCE_SIZE(structure_size);
311 } 316 }
312 317
313 /* Check the reason for exiting the while loop */ 318 /* Check the reason for exiting the while loop */
314 319
315 if (!end_tag_processed) { 320 if (!end_tag_processed) {
316 return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); 321 return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
317 } 322 }
318 323
319 return_ACPI_STATUS (AE_OK); 324 return_ACPI_STATUS(AE_OK);
320} 325}
321 326
322
323/******************************************************************************* 327/*******************************************************************************
324 * 328 *
325 * FUNCTION: acpi_rs_list_to_byte_stream 329 * FUNCTION: acpi_rs_list_to_byte_stream
@@ -342,19 +346,16 @@ acpi_rs_byte_stream_to_list (
342 ******************************************************************************/ 346 ******************************************************************************/
343 347
344acpi_status 348acpi_status
345acpi_rs_list_to_byte_stream ( 349acpi_rs_list_to_byte_stream(struct acpi_resource *linked_list,
346 struct acpi_resource *linked_list, 350 acpi_size byte_stream_size_needed,
347 acpi_size byte_stream_size_needed, 351 u8 * output_buffer)
348 u8 *output_buffer)
349{ 352{
350 acpi_status status; 353 acpi_status status;
351 u8 *buffer = output_buffer; 354 u8 *buffer = output_buffer;
352 acpi_size bytes_consumed = 0; 355 acpi_size bytes_consumed = 0;
353 u8 done = FALSE; 356 u8 done = FALSE;
354
355
356 ACPI_FUNCTION_TRACE ("rs_list_to_byte_stream");
357 357
358 ACPI_FUNCTION_TRACE("rs_list_to_byte_stream");
358 359
359 while (!done) { 360 while (!done) {
360 switch (linked_list->id) { 361 switch (linked_list->id) {
@@ -362,58 +363,72 @@ acpi_rs_list_to_byte_stream (
362 /* 363 /*
363 * IRQ Resource 364 * IRQ Resource
364 */ 365 */
365 status = acpi_rs_irq_stream (linked_list, &buffer, &bytes_consumed); 366 status =
367 acpi_rs_irq_stream(linked_list, &buffer,
368 &bytes_consumed);
366 break; 369 break;
367 370
368 case ACPI_RSTYPE_DMA: 371 case ACPI_RSTYPE_DMA:
369 /* 372 /*
370 * DMA Resource 373 * DMA Resource
371 */ 374 */
372 status = acpi_rs_dma_stream (linked_list, &buffer, &bytes_consumed); 375 status =
376 acpi_rs_dma_stream(linked_list, &buffer,
377 &bytes_consumed);
373 break; 378 break;
374 379
375 case ACPI_RSTYPE_START_DPF: 380 case ACPI_RSTYPE_START_DPF:
376 /* 381 /*
377 * Start Dependent Functions Resource 382 * Start Dependent Functions Resource
378 */ 383 */
379 status = acpi_rs_start_depend_fns_stream (linked_list, 384 status = acpi_rs_start_depend_fns_stream(linked_list,
380 &buffer, &bytes_consumed); 385 &buffer,
386 &bytes_consumed);
381 break; 387 break;
382 388
383 case ACPI_RSTYPE_END_DPF: 389 case ACPI_RSTYPE_END_DPF:
384 /* 390 /*
385 * End Dependent Functions Resource 391 * End Dependent Functions Resource
386 */ 392 */
387 status = acpi_rs_end_depend_fns_stream (linked_list, 393 status = acpi_rs_end_depend_fns_stream(linked_list,
388 &buffer, &bytes_consumed); 394 &buffer,
395 &bytes_consumed);
389 break; 396 break;
390 397
391 case ACPI_RSTYPE_IO: 398 case ACPI_RSTYPE_IO:
392 /* 399 /*
393 * IO Port Resource 400 * IO Port Resource
394 */ 401 */
395 status = acpi_rs_io_stream (linked_list, &buffer, &bytes_consumed); 402 status =
403 acpi_rs_io_stream(linked_list, &buffer,
404 &bytes_consumed);
396 break; 405 break;
397 406
398 case ACPI_RSTYPE_FIXED_IO: 407 case ACPI_RSTYPE_FIXED_IO:
399 /* 408 /*
400 * Fixed IO Port Resource 409 * Fixed IO Port Resource
401 */ 410 */
402 status = acpi_rs_fixed_io_stream (linked_list, &buffer, &bytes_consumed); 411 status =
412 acpi_rs_fixed_io_stream(linked_list, &buffer,
413 &bytes_consumed);
403 break; 414 break;
404 415
405 case ACPI_RSTYPE_VENDOR: 416 case ACPI_RSTYPE_VENDOR:
406 /* 417 /*
407 * Vendor Defined Resource 418 * Vendor Defined Resource
408 */ 419 */
409 status = acpi_rs_vendor_stream (linked_list, &buffer, &bytes_consumed); 420 status =
421 acpi_rs_vendor_stream(linked_list, &buffer,
422 &bytes_consumed);
410 break; 423 break;
411 424
412 case ACPI_RSTYPE_END_TAG: 425 case ACPI_RSTYPE_END_TAG:
413 /* 426 /*
414 * End Tag 427 * End Tag
415 */ 428 */
416 status = acpi_rs_end_tag_stream (linked_list, &buffer, &bytes_consumed); 429 status =
430 acpi_rs_end_tag_stream(linked_list, &buffer,
431 &bytes_consumed);
417 432
418 /* An End Tag indicates the end of the Resource Template */ 433 /* An End Tag indicates the end of the Resource Template */
419 434
@@ -424,55 +439,60 @@ acpi_rs_list_to_byte_stream (
424 /* 439 /*
425 * 24-Bit Memory Resource 440 * 24-Bit Memory Resource
426 */ 441 */
427 status = acpi_rs_memory24_stream (linked_list, &buffer, &bytes_consumed); 442 status =
443 acpi_rs_memory24_stream(linked_list, &buffer,
444 &bytes_consumed);
428 break; 445 break;
429 446
430 case ACPI_RSTYPE_MEM32: 447 case ACPI_RSTYPE_MEM32:
431 /* 448 /*
432 * 32-Bit Memory Range Resource 449 * 32-Bit Memory Range Resource
433 */ 450 */
434 status = acpi_rs_memory32_range_stream (linked_list, &buffer, 451 status =
435 &bytes_consumed); 452 acpi_rs_memory32_range_stream(linked_list, &buffer,
453 &bytes_consumed);
436 break; 454 break;
437 455
438 case ACPI_RSTYPE_FIXED_MEM32: 456 case ACPI_RSTYPE_FIXED_MEM32:
439 /* 457 /*
440 * 32-Bit Fixed Memory Resource 458 * 32-Bit Fixed Memory Resource
441 */ 459 */
442 status = acpi_rs_fixed_memory32_stream (linked_list, &buffer, 460 status =
443 &bytes_consumed); 461 acpi_rs_fixed_memory32_stream(linked_list, &buffer,
462 &bytes_consumed);
444 break; 463 break;
445 464
446 case ACPI_RSTYPE_ADDRESS16: 465 case ACPI_RSTYPE_ADDRESS16:
447 /* 466 /*
448 * 16-Bit Address Descriptor Resource 467 * 16-Bit Address Descriptor Resource
449 */ 468 */
450 status = acpi_rs_address16_stream (linked_list, &buffer, 469 status = acpi_rs_address16_stream(linked_list, &buffer,
451 &bytes_consumed); 470 &bytes_consumed);
452 break; 471 break;
453 472
454 case ACPI_RSTYPE_ADDRESS32: 473 case ACPI_RSTYPE_ADDRESS32:
455 /* 474 /*
456 * 32-Bit Address Descriptor Resource 475 * 32-Bit Address Descriptor Resource
457 */ 476 */
458 status = acpi_rs_address32_stream (linked_list, &buffer, 477 status = acpi_rs_address32_stream(linked_list, &buffer,
459 &bytes_consumed); 478 &bytes_consumed);
460 break; 479 break;
461 480
462 case ACPI_RSTYPE_ADDRESS64: 481 case ACPI_RSTYPE_ADDRESS64:
463 /* 482 /*
464 * 64-Bit Address Descriptor Resource 483 * 64-Bit Address Descriptor Resource
465 */ 484 */
466 status = acpi_rs_address64_stream (linked_list, &buffer, 485 status = acpi_rs_address64_stream(linked_list, &buffer,
467 &bytes_consumed); 486 &bytes_consumed);
468 break; 487 break;
469 488
470 case ACPI_RSTYPE_EXT_IRQ: 489 case ACPI_RSTYPE_EXT_IRQ:
471 /* 490 /*
472 * Extended IRQ Resource 491 * Extended IRQ Resource
473 */ 492 */
474 status = acpi_rs_extended_irq_stream (linked_list, &buffer, 493 status =
475 &bytes_consumed); 494 acpi_rs_extended_irq_stream(linked_list, &buffer,
495 &bytes_consumed);
476 break; 496 break;
477 497
478 default: 498 default:
@@ -480,15 +500,15 @@ acpi_rs_list_to_byte_stream (
480 * If we get here, everything is out of sync, 500 * If we get here, everything is out of sync,
481 * so exit with an error 501 * so exit with an error
482 */ 502 */
483 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 503 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
484 "Invalid descriptor type (%X) in resource list\n", 504 "Invalid descriptor type (%X) in resource list\n",
485 linked_list->id)); 505 linked_list->id));
486 status = AE_BAD_DATA; 506 status = AE_BAD_DATA;
487 break; 507 break;
488 } 508 }
489 509
490 if (ACPI_FAILURE (status)) { 510 if (ACPI_FAILURE(status)) {
491 return_ACPI_STATUS (status); 511 return_ACPI_STATUS(status);
492 } 512 }
493 513
494 /* Set the Buffer to point to the open byte */ 514 /* Set the Buffer to point to the open byte */
@@ -497,10 +517,9 @@ acpi_rs_list_to_byte_stream (
497 517
498 /* Point to the next object */ 518 /* Point to the next object */
499 519
500 linked_list = ACPI_PTR_ADD (struct acpi_resource, 520 linked_list = ACPI_PTR_ADD(struct acpi_resource,
501 linked_list, linked_list->length); 521 linked_list, linked_list->length);
502 } 522 }
503 523
504 return_ACPI_STATUS (AE_OK); 524 return_ACPI_STATUS(AE_OK);
505} 525}
506
diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c
index 91d0207f01ac..daba1a1ed46d 100644
--- a/drivers/acpi/resources/rsmemory.c
+++ b/drivers/acpi/resources/rsmemory.c
@@ -41,13 +41,11 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acresrc.h> 45#include <acpi/acresrc.h>
47 46
48#define _COMPONENT ACPI_RESOURCES 47#define _COMPONENT ACPI_RESOURCES
49 ACPI_MODULE_NAME ("rsmemory") 48ACPI_MODULE_NAME("rsmemory")
50
51 49
52/******************************************************************************* 50/*******************************************************************************
53 * 51 *
@@ -69,30 +67,25 @@
69 * number of bytes consumed from the byte stream. 67 * number of bytes consumed from the byte stream.
70 * 68 *
71 ******************************************************************************/ 69 ******************************************************************************/
72
73acpi_status 70acpi_status
74acpi_rs_memory24_resource ( 71acpi_rs_memory24_resource(u8 * byte_stream_buffer,
75 u8 *byte_stream_buffer, 72 acpi_size * bytes_consumed,
76 acpi_size *bytes_consumed, 73 u8 ** output_buffer, acpi_size * structure_size)
77 u8 **output_buffer,
78 acpi_size *structure_size)
79{ 74{
80 u8 *buffer = byte_stream_buffer; 75 u8 *buffer = byte_stream_buffer;
81 struct acpi_resource *output_struct = (void *) *output_buffer; 76 struct acpi_resource *output_struct = (void *)*output_buffer;
82 u16 temp16 = 0; 77 u16 temp16 = 0;
83 u8 temp8 = 0; 78 u8 temp8 = 0;
84 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 79 acpi_size struct_size =
85 struct acpi_resource_mem24); 80 ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem24);
86
87
88 ACPI_FUNCTION_TRACE ("rs_memory24_resource");
89 81
82 ACPI_FUNCTION_TRACE("rs_memory24_resource");
90 83
91 /* Point past the Descriptor to get the number of bytes consumed */ 84 /* Point past the Descriptor to get the number of bytes consumed */
92 85
93 buffer += 1; 86 buffer += 1;
94 87
95 ACPI_MOVE_16_TO_16 (&temp16, buffer); 88 ACPI_MOVE_16_TO_16(&temp16, buffer);
96 buffer += 2; 89 buffer += 2;
97 *bytes_consumed = (acpi_size) temp16 + 3; 90 *bytes_consumed = (acpi_size) temp16 + 3;
98 output_struct->id = ACPI_RSTYPE_MEM24; 91 output_struct->id = ACPI_RSTYPE_MEM24;
@@ -105,25 +98,25 @@ acpi_rs_memory24_resource (
105 98
106 /* Get min_base_address (Bytes 4-5) */ 99 /* Get min_base_address (Bytes 4-5) */
107 100
108 ACPI_MOVE_16_TO_16 (&temp16, buffer); 101 ACPI_MOVE_16_TO_16(&temp16, buffer);
109 buffer += 2; 102 buffer += 2;
110 output_struct->data.memory24.min_base_address = temp16; 103 output_struct->data.memory24.min_base_address = temp16;
111 104
112 /* Get max_base_address (Bytes 6-7) */ 105 /* Get max_base_address (Bytes 6-7) */
113 106
114 ACPI_MOVE_16_TO_16 (&temp16, buffer); 107 ACPI_MOVE_16_TO_16(&temp16, buffer);
115 buffer += 2; 108 buffer += 2;
116 output_struct->data.memory24.max_base_address = temp16; 109 output_struct->data.memory24.max_base_address = temp16;
117 110
118 /* Get Alignment (Bytes 8-9) */ 111 /* Get Alignment (Bytes 8-9) */
119 112
120 ACPI_MOVE_16_TO_16 (&temp16, buffer); 113 ACPI_MOVE_16_TO_16(&temp16, buffer);
121 buffer += 2; 114 buffer += 2;
122 output_struct->data.memory24.alignment = temp16; 115 output_struct->data.memory24.alignment = temp16;
123 116
124 /* Get range_length (Bytes 10-11) */ 117 /* Get range_length (Bytes 10-11) */
125 118
126 ACPI_MOVE_16_TO_16 (&temp16, buffer); 119 ACPI_MOVE_16_TO_16(&temp16, buffer);
127 output_struct->data.memory24.range_length = temp16; 120 output_struct->data.memory24.range_length = temp16;
128 121
129 /* Set the Length parameter */ 122 /* Set the Length parameter */
@@ -133,10 +126,9 @@ acpi_rs_memory24_resource (
133 /* Return the final size of the structure */ 126 /* Return the final size of the structure */
134 127
135 *structure_size = struct_size; 128 *structure_size = struct_size;
136 return_ACPI_STATUS (AE_OK); 129 return_ACPI_STATUS(AE_OK);
137} 130}
138 131
139
140/******************************************************************************* 132/*******************************************************************************
141 * 133 *
142 * FUNCTION: acpi_rs_memory24_stream 134 * FUNCTION: acpi_rs_memory24_stream
@@ -154,18 +146,14 @@ acpi_rs_memory24_resource (
154 ******************************************************************************/ 146 ******************************************************************************/
155 147
156acpi_status 148acpi_status
157acpi_rs_memory24_stream ( 149acpi_rs_memory24_stream(struct acpi_resource *linked_list,
158 struct acpi_resource *linked_list, 150 u8 ** output_buffer, acpi_size * bytes_consumed)
159 u8 **output_buffer,
160 acpi_size *bytes_consumed)
161{ 151{
162 u8 *buffer = *output_buffer; 152 u8 *buffer = *output_buffer;
163 u16 temp16 = 0; 153 u16 temp16 = 0;
164 u8 temp8 = 0; 154 u8 temp8 = 0;
165
166
167 ACPI_FUNCTION_TRACE ("rs_memory24_stream");
168 155
156 ACPI_FUNCTION_TRACE("rs_memory24_stream");
169 157
170 /* The descriptor field is static */ 158 /* The descriptor field is static */
171 159
@@ -175,7 +163,7 @@ acpi_rs_memory24_stream (
175 /* The length field is static */ 163 /* The length field is static */
176 164
177 temp16 = 0x09; 165 temp16 = 0x09;
178 ACPI_MOVE_16_TO_16 (buffer, &temp16); 166 ACPI_MOVE_16_TO_16(buffer, &temp16);
179 buffer += 2; 167 buffer += 2;
180 168
181 /* Set the Information Byte */ 169 /* Set the Information Byte */
@@ -186,31 +174,32 @@ acpi_rs_memory24_stream (
186 174
187 /* Set the Range minimum base address */ 175 /* Set the Range minimum base address */
188 176
189 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.min_base_address); 177 ACPI_MOVE_32_TO_16(buffer,
178 &linked_list->data.memory24.min_base_address);
190 buffer += 2; 179 buffer += 2;
191 180
192 /* Set the Range maximum base address */ 181 /* Set the Range maximum base address */
193 182
194 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.max_base_address); 183 ACPI_MOVE_32_TO_16(buffer,
184 &linked_list->data.memory24.max_base_address);
195 buffer += 2; 185 buffer += 2;
196 186
197 /* Set the base alignment */ 187 /* Set the base alignment */
198 188
199 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.alignment); 189 ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.alignment);
200 buffer += 2; 190 buffer += 2;
201 191
202 /* Set the range length */ 192 /* Set the range length */
203 193
204 ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.memory24.range_length); 194 ACPI_MOVE_32_TO_16(buffer, &linked_list->data.memory24.range_length);
205 buffer += 2; 195 buffer += 2;
206 196
207 /* Return the number of bytes consumed in this operation */ 197 /* Return the number of bytes consumed in this operation */
208 198
209 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 199 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
210 return_ACPI_STATUS (AE_OK); 200 return_ACPI_STATUS(AE_OK);
211} 201}
212 202
213
214/******************************************************************************* 203/*******************************************************************************
215 * 204 *
216 * FUNCTION: acpi_rs_memory32_range_resource 205 * FUNCTION: acpi_rs_memory32_range_resource
@@ -233,28 +222,24 @@ acpi_rs_memory24_stream (
233 ******************************************************************************/ 222 ******************************************************************************/
234 223
235acpi_status 224acpi_status
236acpi_rs_memory32_range_resource ( 225acpi_rs_memory32_range_resource(u8 * byte_stream_buffer,
237 u8 *byte_stream_buffer, 226 acpi_size * bytes_consumed,
238 acpi_size *bytes_consumed, 227 u8 ** output_buffer, acpi_size * structure_size)
239 u8 **output_buffer,
240 acpi_size *structure_size)
241{ 228{
242 u8 *buffer = byte_stream_buffer; 229 u8 *buffer = byte_stream_buffer;
243 struct acpi_resource *output_struct = (void *) *output_buffer; 230 struct acpi_resource *output_struct = (void *)*output_buffer;
244 u16 temp16 = 0; 231 u16 temp16 = 0;
245 u8 temp8 = 0; 232 u8 temp8 = 0;
246 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 233 acpi_size struct_size =
247 struct acpi_resource_mem32); 234 ACPI_SIZEOF_RESOURCE(struct acpi_resource_mem32);
248
249
250 ACPI_FUNCTION_TRACE ("rs_memory32_range_resource");
251 235
236 ACPI_FUNCTION_TRACE("rs_memory32_range_resource");
252 237
253 /* Point past the Descriptor to get the number of bytes consumed */ 238 /* Point past the Descriptor to get the number of bytes consumed */
254 239
255 buffer += 1; 240 buffer += 1;
256 241
257 ACPI_MOVE_16_TO_16 (&temp16, buffer); 242 ACPI_MOVE_16_TO_16(&temp16, buffer);
258 buffer += 2; 243 buffer += 2;
259 *bytes_consumed = (acpi_size) temp16 + 3; 244 *bytes_consumed = (acpi_size) temp16 + 3;
260 245
@@ -279,22 +264,24 @@ acpi_rs_memory32_range_resource (
279 264
280 /* Get min_base_address (Bytes 4-7) */ 265 /* Get min_base_address (Bytes 4-7) */
281 266
282 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.min_base_address, buffer); 267 ACPI_MOVE_32_TO_32(&output_struct->data.memory32.min_base_address,
268 buffer);
283 buffer += 4; 269 buffer += 4;
284 270
285 /* Get max_base_address (Bytes 8-11) */ 271 /* Get max_base_address (Bytes 8-11) */
286 272
287 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.max_base_address, buffer); 273 ACPI_MOVE_32_TO_32(&output_struct->data.memory32.max_base_address,
274 buffer);
288 buffer += 4; 275 buffer += 4;
289 276
290 /* Get Alignment (Bytes 12-15) */ 277 /* Get Alignment (Bytes 12-15) */
291 278
292 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.alignment, buffer); 279 ACPI_MOVE_32_TO_32(&output_struct->data.memory32.alignment, buffer);
293 buffer += 4; 280 buffer += 4;
294 281
295 /* Get range_length (Bytes 16-19) */ 282 /* Get range_length (Bytes 16-19) */
296 283
297 ACPI_MOVE_32_TO_32 (&output_struct->data.memory32.range_length, buffer); 284 ACPI_MOVE_32_TO_32(&output_struct->data.memory32.range_length, buffer);
298 285
299 /* Set the Length parameter */ 286 /* Set the Length parameter */
300 287
@@ -303,10 +290,9 @@ acpi_rs_memory32_range_resource (
303 /* Return the final size of the structure */ 290 /* Return the final size of the structure */
304 291
305 *structure_size = struct_size; 292 *structure_size = struct_size;
306 return_ACPI_STATUS (AE_OK); 293 return_ACPI_STATUS(AE_OK);
307} 294}
308 295
309
310/******************************************************************************* 296/*******************************************************************************
311 * 297 *
312 * FUNCTION: acpi_rs_fixed_memory32_resource 298 * FUNCTION: acpi_rs_fixed_memory32_resource
@@ -329,27 +315,23 @@ acpi_rs_memory32_range_resource (
329 ******************************************************************************/ 315 ******************************************************************************/
330 316
331acpi_status 317acpi_status
332acpi_rs_fixed_memory32_resource ( 318acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer,
333 u8 *byte_stream_buffer, 319 acpi_size * bytes_consumed,
334 acpi_size *bytes_consumed, 320 u8 ** output_buffer, acpi_size * structure_size)
335 u8 **output_buffer,
336 acpi_size *structure_size)
337{ 321{
338 u8 *buffer = byte_stream_buffer; 322 u8 *buffer = byte_stream_buffer;
339 struct acpi_resource *output_struct = (void *) *output_buffer; 323 struct acpi_resource *output_struct = (void *)*output_buffer;
340 u16 temp16 = 0; 324 u16 temp16 = 0;
341 u8 temp8 = 0; 325 u8 temp8 = 0;
342 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 326 acpi_size struct_size =
343 struct acpi_resource_fixed_mem32); 327 ACPI_SIZEOF_RESOURCE(struct acpi_resource_fixed_mem32);
344
345
346 ACPI_FUNCTION_TRACE ("rs_fixed_memory32_resource");
347 328
329 ACPI_FUNCTION_TRACE("rs_fixed_memory32_resource");
348 330
349 /* Point past the Descriptor to get the number of bytes consumed */ 331 /* Point past the Descriptor to get the number of bytes consumed */
350 332
351 buffer += 1; 333 buffer += 1;
352 ACPI_MOVE_16_TO_16 (&temp16, buffer); 334 ACPI_MOVE_16_TO_16(&temp16, buffer);
353 335
354 buffer += 2; 336 buffer += 2;
355 *bytes_consumed = (acpi_size) temp16 + 3; 337 *bytes_consumed = (acpi_size) temp16 + 3;
@@ -364,13 +346,14 @@ acpi_rs_fixed_memory32_resource (
364 346
365 /* Get range_base_address (Bytes 4-7) */ 347 /* Get range_base_address (Bytes 4-7) */
366 348
367 ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_base_address, 349 ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32.
368 buffer); 350 range_base_address, buffer);
369 buffer += 4; 351 buffer += 4;
370 352
371 /* Get range_length (Bytes 8-11) */ 353 /* Get range_length (Bytes 8-11) */
372 354
373 ACPI_MOVE_32_TO_32 (&output_struct->data.fixed_memory32.range_length, buffer); 355 ACPI_MOVE_32_TO_32(&output_struct->data.fixed_memory32.range_length,
356 buffer);
374 357
375 /* Set the Length parameter */ 358 /* Set the Length parameter */
376 359
@@ -379,10 +362,9 @@ acpi_rs_fixed_memory32_resource (
379 /* Return the final size of the structure */ 362 /* Return the final size of the structure */
380 363
381 *structure_size = struct_size; 364 *structure_size = struct_size;
382 return_ACPI_STATUS (AE_OK); 365 return_ACPI_STATUS(AE_OK);
383} 366}
384 367
385
386/******************************************************************************* 368/*******************************************************************************
387 * 369 *
388 * FUNCTION: acpi_rs_memory32_range_stream 370 * FUNCTION: acpi_rs_memory32_range_stream
@@ -400,18 +382,14 @@ acpi_rs_fixed_memory32_resource (
400 ******************************************************************************/ 382 ******************************************************************************/
401 383
402acpi_status 384acpi_status
403acpi_rs_memory32_range_stream ( 385acpi_rs_memory32_range_stream(struct acpi_resource *linked_list,
404 struct acpi_resource *linked_list, 386 u8 ** output_buffer, acpi_size * bytes_consumed)
405 u8 **output_buffer,
406 acpi_size *bytes_consumed)
407{ 387{
408 u8 *buffer = *output_buffer; 388 u8 *buffer = *output_buffer;
409 u16 temp16 = 0; 389 u16 temp16 = 0;
410 u8 temp8 = 0; 390 u8 temp8 = 0;
411
412
413 ACPI_FUNCTION_TRACE ("rs_memory32_range_stream");
414 391
392 ACPI_FUNCTION_TRACE("rs_memory32_range_stream");
415 393
416 /* The descriptor field is static */ 394 /* The descriptor field is static */
417 395
@@ -422,7 +400,7 @@ acpi_rs_memory32_range_stream (
422 400
423 temp16 = 0x11; 401 temp16 = 0x11;
424 402
425 ACPI_MOVE_16_TO_16 (buffer, &temp16); 403 ACPI_MOVE_16_TO_16(buffer, &temp16);
426 buffer += 2; 404 buffer += 2;
427 405
428 /* Set the Information Byte */ 406 /* Set the Information Byte */
@@ -433,31 +411,32 @@ acpi_rs_memory32_range_stream (
433 411
434 /* Set the Range minimum base address */ 412 /* Set the Range minimum base address */
435 413
436 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.min_base_address); 414 ACPI_MOVE_32_TO_32(buffer,
415 &linked_list->data.memory32.min_base_address);
437 buffer += 4; 416 buffer += 4;
438 417
439 /* Set the Range maximum base address */ 418 /* Set the Range maximum base address */
440 419
441 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.max_base_address); 420 ACPI_MOVE_32_TO_32(buffer,
421 &linked_list->data.memory32.max_base_address);
442 buffer += 4; 422 buffer += 4;
443 423
444 /* Set the base alignment */ 424 /* Set the base alignment */
445 425
446 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.alignment); 426 ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.alignment);
447 buffer += 4; 427 buffer += 4;
448 428
449 /* Set the range length */ 429 /* Set the range length */
450 430
451 ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.memory32.range_length); 431 ACPI_MOVE_32_TO_32(buffer, &linked_list->data.memory32.range_length);
452 buffer += 4; 432 buffer += 4;
453 433
454 /* Return the number of bytes consumed in this operation */ 434 /* Return the number of bytes consumed in this operation */
455 435
456 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 436 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
457 return_ACPI_STATUS (AE_OK); 437 return_ACPI_STATUS(AE_OK);
458} 438}
459 439
460
461/******************************************************************************* 440/*******************************************************************************
462 * 441 *
463 * FUNCTION: acpi_rs_fixed_memory32_stream 442 * FUNCTION: acpi_rs_fixed_memory32_stream
@@ -475,18 +454,14 @@ acpi_rs_memory32_range_stream (
475 ******************************************************************************/ 454 ******************************************************************************/
476 455
477acpi_status 456acpi_status
478acpi_rs_fixed_memory32_stream ( 457acpi_rs_fixed_memory32_stream(struct acpi_resource *linked_list,
479 struct acpi_resource *linked_list, 458 u8 ** output_buffer, acpi_size * bytes_consumed)
480 u8 **output_buffer,
481 acpi_size *bytes_consumed)
482{ 459{
483 u8 *buffer = *output_buffer; 460 u8 *buffer = *output_buffer;
484 u16 temp16 = 0; 461 u16 temp16 = 0;
485 u8 temp8 = 0; 462 u8 temp8 = 0;
486
487
488 ACPI_FUNCTION_TRACE ("rs_fixed_memory32_stream");
489 463
464 ACPI_FUNCTION_TRACE("rs_fixed_memory32_stream");
490 465
491 /* The descriptor field is static */ 466 /* The descriptor field is static */
492 467
@@ -497,30 +472,31 @@ acpi_rs_fixed_memory32_stream (
497 472
498 temp16 = 0x09; 473 temp16 = 0x09;
499 474
500 ACPI_MOVE_16_TO_16 (buffer, &temp16); 475 ACPI_MOVE_16_TO_16(buffer, &temp16);
501 buffer += 2; 476 buffer += 2;
502 477
503 /* Set the Information Byte */ 478 /* Set the Information Byte */
504 479
505 temp8 = (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01); 480 temp8 =
481 (u8) (linked_list->data.fixed_memory32.read_write_attribute & 0x01);
506 *buffer = temp8; 482 *buffer = temp8;
507 buffer += 1; 483 buffer += 1;
508 484
509 /* Set the Range base address */ 485 /* Set the Range base address */
510 486
511 ACPI_MOVE_32_TO_32 (buffer, 487 ACPI_MOVE_32_TO_32(buffer,
512 &linked_list->data.fixed_memory32.range_base_address); 488 &linked_list->data.fixed_memory32.
489 range_base_address);
513 buffer += 4; 490 buffer += 4;
514 491
515 /* Set the range length */ 492 /* Set the range length */
516 493
517 ACPI_MOVE_32_TO_32 (buffer, 494 ACPI_MOVE_32_TO_32(buffer,
518 &linked_list->data.fixed_memory32.range_length); 495 &linked_list->data.fixed_memory32.range_length);
519 buffer += 4; 496 buffer += 4;
520 497
521 /* Return the number of bytes consumed in this operation */ 498 /* Return the number of bytes consumed in this operation */
522 499
523 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 500 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
524 return_ACPI_STATUS (AE_OK); 501 return_ACPI_STATUS(AE_OK);
525} 502}
526
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c
index a1f1741f0d83..7a8a34e757f5 100644
--- a/drivers/acpi/resources/rsmisc.c
+++ b/drivers/acpi/resources/rsmisc.c
@@ -41,13 +41,11 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acresrc.h> 45#include <acpi/acresrc.h>
47 46
48#define _COMPONENT ACPI_RESOURCES 47#define _COMPONENT ACPI_RESOURCES
49 ACPI_MODULE_NAME ("rsmisc") 48ACPI_MODULE_NAME("rsmisc")
50
51 49
52/******************************************************************************* 50/*******************************************************************************
53 * 51 *
@@ -69,20 +67,15 @@
69 * number of bytes consumed from the byte stream. 67 * number of bytes consumed from the byte stream.
70 * 68 *
71 ******************************************************************************/ 69 ******************************************************************************/
72
73acpi_status 70acpi_status
74acpi_rs_end_tag_resource ( 71acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
75 u8 *byte_stream_buffer, 72 acpi_size * bytes_consumed,
76 acpi_size *bytes_consumed, 73 u8 ** output_buffer, acpi_size * structure_size)
77 u8 **output_buffer,
78 acpi_size *structure_size)
79{ 74{
80 struct acpi_resource *output_struct = (void *) *output_buffer; 75 struct acpi_resource *output_struct = (void *)*output_buffer;
81 acpi_size struct_size = ACPI_RESOURCE_LENGTH; 76 acpi_size struct_size = ACPI_RESOURCE_LENGTH;
82
83
84 ACPI_FUNCTION_TRACE ("rs_end_tag_resource");
85 77
78 ACPI_FUNCTION_TRACE("rs_end_tag_resource");
86 79
87 /* The number of bytes consumed is static */ 80 /* The number of bytes consumed is static */
88 81
@@ -99,10 +92,9 @@ acpi_rs_end_tag_resource (
99 /* Return the final size of the structure */ 92 /* Return the final size of the structure */
100 93
101 *structure_size = struct_size; 94 *structure_size = struct_size;
102 return_ACPI_STATUS (AE_OK); 95 return_ACPI_STATUS(AE_OK);
103} 96}
104 97
105
106/******************************************************************************* 98/*******************************************************************************
107 * 99 *
108 * FUNCTION: acpi_rs_end_tag_stream 100 * FUNCTION: acpi_rs_end_tag_stream
@@ -120,17 +112,13 @@ acpi_rs_end_tag_resource (
120 ******************************************************************************/ 112 ******************************************************************************/
121 113
122acpi_status 114acpi_status
123acpi_rs_end_tag_stream ( 115acpi_rs_end_tag_stream(struct acpi_resource *linked_list,
124 struct acpi_resource *linked_list, 116 u8 ** output_buffer, acpi_size * bytes_consumed)
125 u8 **output_buffer,
126 acpi_size *bytes_consumed)
127{ 117{
128 u8 *buffer = *output_buffer; 118 u8 *buffer = *output_buffer;
129 u8 temp8 = 0; 119 u8 temp8 = 0;
130
131
132 ACPI_FUNCTION_TRACE ("rs_end_tag_stream");
133 120
121 ACPI_FUNCTION_TRACE("rs_end_tag_stream");
134 122
135 /* The descriptor field is static */ 123 /* The descriptor field is static */
136 124
@@ -148,11 +136,10 @@ acpi_rs_end_tag_stream (
148 136
149 /* Return the number of bytes consumed in this operation */ 137 /* Return the number of bytes consumed in this operation */
150 138
151 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 139 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
152 return_ACPI_STATUS (AE_OK); 140 return_ACPI_STATUS(AE_OK);
153} 141}
154 142
155
156/******************************************************************************* 143/*******************************************************************************
157 * 144 *
158 * FUNCTION: acpi_rs_vendor_resource 145 * FUNCTION: acpi_rs_vendor_resource
@@ -175,23 +162,19 @@ acpi_rs_end_tag_stream (
175 ******************************************************************************/ 162 ******************************************************************************/
176 163
177acpi_status 164acpi_status
178acpi_rs_vendor_resource ( 165acpi_rs_vendor_resource(u8 * byte_stream_buffer,
179 u8 *byte_stream_buffer, 166 acpi_size * bytes_consumed,
180 acpi_size *bytes_consumed, 167 u8 ** output_buffer, acpi_size * structure_size)
181 u8 **output_buffer,
182 acpi_size *structure_size)
183{ 168{
184 u8 *buffer = byte_stream_buffer; 169 u8 *buffer = byte_stream_buffer;
185 struct acpi_resource *output_struct = (void *) *output_buffer; 170 struct acpi_resource *output_struct = (void *)*output_buffer;
186 u16 temp16 = 0; 171 u16 temp16 = 0;
187 u8 temp8 = 0; 172 u8 temp8 = 0;
188 u8 index; 173 u8 index;
189 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 174 acpi_size struct_size =
190 struct acpi_resource_vendor); 175 ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor);
191
192
193 ACPI_FUNCTION_TRACE ("rs_vendor_resource");
194 176
177 ACPI_FUNCTION_TRACE("rs_vendor_resource");
195 178
196 /* Dereference the Descriptor to find if this is a large or small item. */ 179 /* Dereference the Descriptor to find if this is a large or small item. */
197 180
@@ -204,7 +187,7 @@ acpi_rs_vendor_resource (
204 187
205 /* Dereference */ 188 /* Dereference */
206 189
207 ACPI_MOVE_16_TO_16 (&temp16, buffer); 190 ACPI_MOVE_16_TO_16(&temp16, buffer);
208 191
209 /* Calculate bytes consumed */ 192 /* Calculate bytes consumed */
210 193
@@ -213,11 +196,10 @@ acpi_rs_vendor_resource (
213 /* Point to the first vendor byte */ 196 /* Point to the first vendor byte */
214 197
215 buffer += 2; 198 buffer += 2;
216 } 199 } else {
217 else {
218 /* Small Item, dereference the size */ 200 /* Small Item, dereference the size */
219 201
220 temp16 = (u8)(*buffer & 0x07); 202 temp16 = (u8) (*buffer & 0x07);
221 203
222 /* Calculate bytes consumed */ 204 /* Calculate bytes consumed */
223 205
@@ -241,7 +223,7 @@ acpi_rs_vendor_resource (
241 * calculate the length of the vendor string and expand the 223 * calculate the length of the vendor string and expand the
242 * struct_size to the next 32-bit boundary. 224 * struct_size to the next 32-bit boundary.
243 */ 225 */
244 struct_size += ACPI_ROUND_UP_to_32_bITS (temp16); 226 struct_size += ACPI_ROUND_UP_to_32_bITS(temp16);
245 227
246 /* Set the Length parameter */ 228 /* Set the Length parameter */
247 229
@@ -250,10 +232,9 @@ acpi_rs_vendor_resource (
250 /* Return the final size of the structure */ 232 /* Return the final size of the structure */
251 233
252 *structure_size = struct_size; 234 *structure_size = struct_size;
253 return_ACPI_STATUS (AE_OK); 235 return_ACPI_STATUS(AE_OK);
254} 236}
255 237
256
257/******************************************************************************* 238/*******************************************************************************
258 * 239 *
259 * FUNCTION: acpi_rs_vendor_stream 240 * FUNCTION: acpi_rs_vendor_stream
@@ -271,23 +252,19 @@ acpi_rs_vendor_resource (
271 ******************************************************************************/ 252 ******************************************************************************/
272 253
273acpi_status 254acpi_status
274acpi_rs_vendor_stream ( 255acpi_rs_vendor_stream(struct acpi_resource *linked_list,
275 struct acpi_resource *linked_list, 256 u8 ** output_buffer, acpi_size * bytes_consumed)
276 u8 **output_buffer,
277 acpi_size *bytes_consumed)
278{ 257{
279 u8 *buffer = *output_buffer; 258 u8 *buffer = *output_buffer;
280 u16 temp16 = 0; 259 u16 temp16 = 0;
281 u8 temp8 = 0; 260 u8 temp8 = 0;
282 u8 index; 261 u8 index;
283
284
285 ACPI_FUNCTION_TRACE ("rs_vendor_stream");
286 262
263 ACPI_FUNCTION_TRACE("rs_vendor_stream");
287 264
288 /* Dereference the length to find if this is a large or small item. */ 265 /* Dereference the length to find if this is a large or small item. */
289 266
290 if(linked_list->data.vendor_specific.length > 7) { 267 if (linked_list->data.vendor_specific.length > 7) {
291 /* Large Item, Set the descriptor field and length bytes */ 268 /* Large Item, Set the descriptor field and length bytes */
292 269
293 *buffer = 0x84; 270 *buffer = 0x84;
@@ -295,10 +272,9 @@ acpi_rs_vendor_stream (
295 272
296 temp16 = (u16) linked_list->data.vendor_specific.length; 273 temp16 = (u16) linked_list->data.vendor_specific.length;
297 274
298 ACPI_MOVE_16_TO_16 (buffer, &temp16); 275 ACPI_MOVE_16_TO_16(buffer, &temp16);
299 buffer += 2; 276 buffer += 2;
300 } 277 } else {
301 else {
302 /* Small Item, Set the descriptor field */ 278 /* Small Item, Set the descriptor field */
303 279
304 temp8 = 0x70; 280 temp8 = 0x70;
@@ -310,7 +286,8 @@ acpi_rs_vendor_stream (
310 286
311 /* Loop through all of the Vendor Specific fields */ 287 /* Loop through all of the Vendor Specific fields */
312 288
313 for (index = 0; index < linked_list->data.vendor_specific.length; index++) { 289 for (index = 0; index < linked_list->data.vendor_specific.length;
290 index++) {
314 temp8 = linked_list->data.vendor_specific.reserved[index]; 291 temp8 = linked_list->data.vendor_specific.reserved[index];
315 292
316 *buffer = temp8; 293 *buffer = temp8;
@@ -319,11 +296,10 @@ acpi_rs_vendor_stream (
319 296
320 /* Return the number of bytes consumed in this operation */ 297 /* Return the number of bytes consumed in this operation */
321 298
322 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 299 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
323 return_ACPI_STATUS (AE_OK); 300 return_ACPI_STATUS(AE_OK);
324} 301}
325 302
326
327/******************************************************************************* 303/*******************************************************************************
328 * 304 *
329 * FUNCTION: acpi_rs_start_depend_fns_resource 305 * FUNCTION: acpi_rs_start_depend_fns_resource
@@ -346,21 +322,18 @@ acpi_rs_vendor_stream (
346 ******************************************************************************/ 322 ******************************************************************************/
347 323
348acpi_status 324acpi_status
349acpi_rs_start_depend_fns_resource ( 325acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer,
350 u8 *byte_stream_buffer, 326 acpi_size * bytes_consumed,
351 acpi_size *bytes_consumed, 327 u8 ** output_buffer,
352 u8 **output_buffer, 328 acpi_size * structure_size)
353 acpi_size *structure_size)
354{ 329{
355 u8 *buffer = byte_stream_buffer; 330 u8 *buffer = byte_stream_buffer;
356 struct acpi_resource *output_struct = (void *) *output_buffer; 331 struct acpi_resource *output_struct = (void *)*output_buffer;
357 u8 temp8 = 0; 332 u8 temp8 = 0;
358 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 333 acpi_size struct_size =
359 struct acpi_resource_start_dpf); 334 ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf);
360
361
362 ACPI_FUNCTION_TRACE ("rs_start_depend_fns_resource");
363 335
336 ACPI_FUNCTION_TRACE("rs_start_depend_fns_resource");
364 337
365 /* The number of bytes consumed are found in the descriptor (Bits:0-1) */ 338 /* The number of bytes consumed are found in the descriptor (Bits:0-1) */
366 339
@@ -378,26 +351,27 @@ acpi_rs_start_depend_fns_resource (
378 351
379 /* Check Compatibility priority */ 352 /* Check Compatibility priority */
380 353
381 output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03; 354 output_struct->data.start_dpf.compatibility_priority =
355 temp8 & 0x03;
382 356
383 if (3 == output_struct->data.start_dpf.compatibility_priority) { 357 if (3 == output_struct->data.start_dpf.compatibility_priority) {
384 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); 358 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
385 } 359 }
386 360
387 /* Check Performance/Robustness preference */ 361 /* Check Performance/Robustness preference */
388 362
389 output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03; 363 output_struct->data.start_dpf.performance_robustness =
364 (temp8 >> 2) & 0x03;
390 365
391 if (3 == output_struct->data.start_dpf.performance_robustness) { 366 if (3 == output_struct->data.start_dpf.performance_robustness) {
392 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); 367 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
393 } 368 }
394 } 369 } else {
395 else {
396 output_struct->data.start_dpf.compatibility_priority = 370 output_struct->data.start_dpf.compatibility_priority =
397 ACPI_ACCEPTABLE_CONFIGURATION; 371 ACPI_ACCEPTABLE_CONFIGURATION;
398 372
399 output_struct->data.start_dpf.performance_robustness = 373 output_struct->data.start_dpf.performance_robustness =
400 ACPI_ACCEPTABLE_CONFIGURATION; 374 ACPI_ACCEPTABLE_CONFIGURATION;
401 } 375 }
402 376
403 /* Set the Length parameter */ 377 /* Set the Length parameter */
@@ -407,10 +381,9 @@ acpi_rs_start_depend_fns_resource (
407 /* Return the final size of the structure */ 381 /* Return the final size of the structure */
408 382
409 *structure_size = struct_size; 383 *structure_size = struct_size;
410 return_ACPI_STATUS (AE_OK); 384 return_ACPI_STATUS(AE_OK);
411} 385}
412 386
413
414/******************************************************************************* 387/*******************************************************************************
415 * 388 *
416 * FUNCTION: acpi_rs_end_depend_fns_resource 389 * FUNCTION: acpi_rs_end_depend_fns_resource
@@ -433,18 +406,14 @@ acpi_rs_start_depend_fns_resource (
433 ******************************************************************************/ 406 ******************************************************************************/
434 407
435acpi_status 408acpi_status
436acpi_rs_end_depend_fns_resource ( 409acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
437 u8 *byte_stream_buffer, 410 acpi_size * bytes_consumed,
438 acpi_size *bytes_consumed, 411 u8 ** output_buffer, acpi_size * structure_size)
439 u8 **output_buffer,
440 acpi_size *structure_size)
441{ 412{
442 struct acpi_resource *output_struct = (void *) *output_buffer; 413 struct acpi_resource *output_struct = (void *)*output_buffer;
443 acpi_size struct_size = ACPI_RESOURCE_LENGTH; 414 acpi_size struct_size = ACPI_RESOURCE_LENGTH;
444
445
446 ACPI_FUNCTION_TRACE ("rs_end_depend_fns_resource");
447 415
416 ACPI_FUNCTION_TRACE("rs_end_depend_fns_resource");
448 417
449 /* The number of bytes consumed is static */ 418 /* The number of bytes consumed is static */
450 419
@@ -461,10 +430,9 @@ acpi_rs_end_depend_fns_resource (
461 /* Return the final size of the structure */ 430 /* Return the final size of the structure */
462 431
463 *structure_size = struct_size; 432 *structure_size = struct_size;
464 return_ACPI_STATUS (AE_OK); 433 return_ACPI_STATUS(AE_OK);
465} 434}
466 435
467
468/******************************************************************************* 436/*******************************************************************************
469 * 437 *
470 * FUNCTION: acpi_rs_start_depend_fns_stream 438 * FUNCTION: acpi_rs_start_depend_fns_stream
@@ -483,39 +451,35 @@ acpi_rs_end_depend_fns_resource (
483 ******************************************************************************/ 451 ******************************************************************************/
484 452
485acpi_status 453acpi_status
486acpi_rs_start_depend_fns_stream ( 454acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
487 struct acpi_resource *linked_list, 455 u8 ** output_buffer, acpi_size * bytes_consumed)
488 u8 **output_buffer,
489 acpi_size *bytes_consumed)
490{ 456{
491 u8 *buffer = *output_buffer; 457 u8 *buffer = *output_buffer;
492 u8 temp8 = 0; 458 u8 temp8 = 0;
493
494
495 ACPI_FUNCTION_TRACE ("rs_start_depend_fns_stream");
496 459
460 ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream");
497 461
498 /* 462 /*
499 * The descriptor field is set based upon whether a byte is needed 463 * The descriptor field is set based upon whether a byte is needed
500 * to contain Priority data. 464 * to contain Priority data.
501 */ 465 */
502 if (ACPI_ACCEPTABLE_CONFIGURATION == 466 if (ACPI_ACCEPTABLE_CONFIGURATION ==
503 linked_list->data.start_dpf.compatibility_priority && 467 linked_list->data.start_dpf.compatibility_priority &&
504 ACPI_ACCEPTABLE_CONFIGURATION == 468 ACPI_ACCEPTABLE_CONFIGURATION ==
505 linked_list->data.start_dpf.performance_robustness) { 469 linked_list->data.start_dpf.performance_robustness) {
506 *buffer = 0x30; 470 *buffer = 0x30;
507 } 471 } else {
508 else {
509 *buffer = 0x31; 472 *buffer = 0x31;
510 buffer += 1; 473 buffer += 1;
511 474
512 /* Set the Priority Byte Definition */ 475 /* Set the Priority Byte Definition */
513 476
514 temp8 = 0; 477 temp8 = 0;
515 temp8 = (u8) ((linked_list->data.start_dpf.performance_robustness & 478 temp8 =
516 0x03) << 2); 479 (u8) ((linked_list->data.start_dpf.
517 temp8 |= (linked_list->data.start_dpf.compatibility_priority & 480 performance_robustness & 0x03) << 2);
518 0x03); 481 temp8 |=
482 (linked_list->data.start_dpf.compatibility_priority & 0x03);
519 *buffer = temp8; 483 *buffer = temp8;
520 } 484 }
521 485
@@ -523,11 +487,10 @@ acpi_rs_start_depend_fns_stream (
523 487
524 /* Return the number of bytes consumed in this operation */ 488 /* Return the number of bytes consumed in this operation */
525 489
526 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 490 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
527 return_ACPI_STATUS (AE_OK); 491 return_ACPI_STATUS(AE_OK);
528} 492}
529 493
530
531/******************************************************************************* 494/*******************************************************************************
532 * 495 *
533 * FUNCTION: acpi_rs_end_depend_fns_stream 496 * FUNCTION: acpi_rs_end_depend_fns_stream
@@ -545,16 +508,12 @@ acpi_rs_start_depend_fns_stream (
545 ******************************************************************************/ 508 ******************************************************************************/
546 509
547acpi_status 510acpi_status
548acpi_rs_end_depend_fns_stream ( 511acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list,
549 struct acpi_resource *linked_list, 512 u8 ** output_buffer, acpi_size * bytes_consumed)
550 u8 **output_buffer,
551 acpi_size *bytes_consumed)
552{ 513{
553 u8 *buffer = *output_buffer; 514 u8 *buffer = *output_buffer;
554
555
556 ACPI_FUNCTION_TRACE ("rs_end_depend_fns_stream");
557 515
516 ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream");
558 517
559 /* The descriptor field is static */ 518 /* The descriptor field is static */
560 519
@@ -563,7 +522,6 @@ acpi_rs_end_depend_fns_stream (
563 522
564 /* Return the number of bytes consumed in this operation */ 523 /* Return the number of bytes consumed in this operation */
565 524
566 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 525 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
567 return_ACPI_STATUS (AE_OK); 526 return_ACPI_STATUS(AE_OK);
568} 527}
569
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c
index 700cf7d65d76..4446778eaf79 100644
--- a/drivers/acpi/resources/rsutils.c
+++ b/drivers/acpi/resources/rsutils.c
@@ -41,15 +41,12 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acnamesp.h> 45#include <acpi/acnamesp.h>
47#include <acpi/acresrc.h> 46#include <acpi/acresrc.h>
48 47
49
50#define _COMPONENT ACPI_RESOURCES 48#define _COMPONENT ACPI_RESOURCES
51 ACPI_MODULE_NAME ("rsutils") 49ACPI_MODULE_NAME("rsutils")
52
53 50
54/******************************************************************************* 51/*******************************************************************************
55 * 52 *
@@ -68,42 +65,36 @@
68 * and the contents of the callers buffer is undefined. 65 * and the contents of the callers buffer is undefined.
69 * 66 *
70 ******************************************************************************/ 67 ******************************************************************************/
71
72acpi_status 68acpi_status
73acpi_rs_get_prt_method_data ( 69acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
74 acpi_handle handle,
75 struct acpi_buffer *ret_buffer)
76{ 70{
77 union acpi_operand_object *obj_desc; 71 union acpi_operand_object *obj_desc;
78 acpi_status status; 72 acpi_status status;
79
80
81 ACPI_FUNCTION_TRACE ("rs_get_prt_method_data");
82 73
74 ACPI_FUNCTION_TRACE("rs_get_prt_method_data");
83 75
84 /* Parameters guaranteed valid by caller */ 76 /* Parameters guaranteed valid by caller */
85 77
86 /* Execute the method, no parameters */ 78 /* Execute the method, no parameters */
87 79
88 status = acpi_ut_evaluate_object (handle, METHOD_NAME__PRT, 80 status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRT,
89 ACPI_BTYPE_PACKAGE, &obj_desc); 81 ACPI_BTYPE_PACKAGE, &obj_desc);
90 if (ACPI_FAILURE (status)) { 82 if (ACPI_FAILURE(status)) {
91 return_ACPI_STATUS (status); 83 return_ACPI_STATUS(status);
92 } 84 }
93 85
94 /* 86 /*
95 * Create a resource linked list from the byte stream buffer that comes 87 * Create a resource linked list from the byte stream buffer that comes
96 * back from the _CRS method execution. 88 * back from the _CRS method execution.
97 */ 89 */
98 status = acpi_rs_create_pci_routing_table (obj_desc, ret_buffer); 90 status = acpi_rs_create_pci_routing_table(obj_desc, ret_buffer);
99 91
100 /* On exit, we must delete the object returned by evaluate_object */ 92 /* On exit, we must delete the object returned by evaluate_object */
101 93
102 acpi_ut_remove_reference (obj_desc); 94 acpi_ut_remove_reference(obj_desc);
103 return_ACPI_STATUS (status); 95 return_ACPI_STATUS(status);
104} 96}
105 97
106
107/******************************************************************************* 98/*******************************************************************************
108 * 99 *
109 * FUNCTION: acpi_rs_get_crs_method_data 100 * FUNCTION: acpi_rs_get_crs_method_data
@@ -123,25 +114,21 @@ acpi_rs_get_prt_method_data (
123 ******************************************************************************/ 114 ******************************************************************************/
124 115
125acpi_status 116acpi_status
126acpi_rs_get_crs_method_data ( 117acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
127 acpi_handle handle,
128 struct acpi_buffer *ret_buffer)
129{ 118{
130 union acpi_operand_object *obj_desc; 119 union acpi_operand_object *obj_desc;
131 acpi_status status; 120 acpi_status status;
132
133
134 ACPI_FUNCTION_TRACE ("rs_get_crs_method_data");
135 121
122 ACPI_FUNCTION_TRACE("rs_get_crs_method_data");
136 123
137 /* Parameters guaranteed valid by caller */ 124 /* Parameters guaranteed valid by caller */
138 125
139 /* Execute the method, no parameters */ 126 /* Execute the method, no parameters */
140 127
141 status = acpi_ut_evaluate_object (handle, METHOD_NAME__CRS, 128 status = acpi_ut_evaluate_object(handle, METHOD_NAME__CRS,
142 ACPI_BTYPE_BUFFER, &obj_desc); 129 ACPI_BTYPE_BUFFER, &obj_desc);
143 if (ACPI_FAILURE (status)) { 130 if (ACPI_FAILURE(status)) {
144 return_ACPI_STATUS (status); 131 return_ACPI_STATUS(status);
145 } 132 }
146 133
147 /* 134 /*
@@ -149,15 +136,14 @@ acpi_rs_get_crs_method_data (
149 * byte stream buffer that comes back from the _CRS method 136 * byte stream buffer that comes back from the _CRS method
150 * execution. 137 * execution.
151 */ 138 */
152 status = acpi_rs_create_resource_list (obj_desc, ret_buffer); 139 status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
153 140
154 /* on exit, we must delete the object returned by evaluate_object */ 141 /* on exit, we must delete the object returned by evaluate_object */
155 142
156 acpi_ut_remove_reference (obj_desc); 143 acpi_ut_remove_reference(obj_desc);
157 return_ACPI_STATUS (status); 144 return_ACPI_STATUS(status);
158} 145}
159 146
160
161/******************************************************************************* 147/*******************************************************************************
162 * 148 *
163 * FUNCTION: acpi_rs_get_prs_method_data 149 * FUNCTION: acpi_rs_get_prs_method_data
@@ -178,25 +164,21 @@ acpi_rs_get_crs_method_data (
178 164
179#ifdef ACPI_FUTURE_USAGE 165#ifdef ACPI_FUTURE_USAGE
180acpi_status 166acpi_status
181acpi_rs_get_prs_method_data ( 167acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer)
182 acpi_handle handle,
183 struct acpi_buffer *ret_buffer)
184{ 168{
185 union acpi_operand_object *obj_desc; 169 union acpi_operand_object *obj_desc;
186 acpi_status status; 170 acpi_status status;
187
188
189 ACPI_FUNCTION_TRACE ("rs_get_prs_method_data");
190 171
172 ACPI_FUNCTION_TRACE("rs_get_prs_method_data");
191 173
192 /* Parameters guaranteed valid by caller */ 174 /* Parameters guaranteed valid by caller */
193 175
194 /* Execute the method, no parameters */ 176 /* Execute the method, no parameters */
195 177
196 status = acpi_ut_evaluate_object (handle, METHOD_NAME__PRS, 178 status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRS,
197 ACPI_BTYPE_BUFFER, &obj_desc); 179 ACPI_BTYPE_BUFFER, &obj_desc);
198 if (ACPI_FAILURE (status)) { 180 if (ACPI_FAILURE(status)) {
199 return_ACPI_STATUS (status); 181 return_ACPI_STATUS(status);
200 } 182 }
201 183
202 /* 184 /*
@@ -204,15 +186,14 @@ acpi_rs_get_prs_method_data (
204 * byte stream buffer that comes back from the _CRS method 186 * byte stream buffer that comes back from the _CRS method
205 * execution. 187 * execution.
206 */ 188 */
207 status = acpi_rs_create_resource_list (obj_desc, ret_buffer); 189 status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
208 190
209 /* on exit, we must delete the object returned by evaluate_object */ 191 /* on exit, we must delete the object returned by evaluate_object */
210 192
211 acpi_ut_remove_reference (obj_desc); 193 acpi_ut_remove_reference(obj_desc);
212 return_ACPI_STATUS (status); 194 return_ACPI_STATUS(status);
213} 195}
214#endif /* ACPI_FUTURE_USAGE */ 196#endif /* ACPI_FUTURE_USAGE */
215
216 197
217/******************************************************************************* 198/*******************************************************************************
218 * 199 *
@@ -234,25 +215,22 @@ acpi_rs_get_prs_method_data (
234 ******************************************************************************/ 215 ******************************************************************************/
235 216
236acpi_status 217acpi_status
237acpi_rs_get_method_data ( 218acpi_rs_get_method_data(acpi_handle handle,
238 acpi_handle handle, 219 char *path, struct acpi_buffer *ret_buffer)
239 char *path,
240 struct acpi_buffer *ret_buffer)
241{ 220{
242 union acpi_operand_object *obj_desc; 221 union acpi_operand_object *obj_desc;
243 acpi_status status; 222 acpi_status status;
244
245
246 ACPI_FUNCTION_TRACE ("rs_get_method_data");
247 223
224 ACPI_FUNCTION_TRACE("rs_get_method_data");
248 225
249 /* Parameters guaranteed valid by caller */ 226 /* Parameters guaranteed valid by caller */
250 227
251 /* Execute the method, no parameters */ 228 /* Execute the method, no parameters */
252 229
253 status = acpi_ut_evaluate_object (handle, path, ACPI_BTYPE_BUFFER, &obj_desc); 230 status =
254 if (ACPI_FAILURE (status)) { 231 acpi_ut_evaluate_object(handle, path, ACPI_BTYPE_BUFFER, &obj_desc);
255 return_ACPI_STATUS (status); 232 if (ACPI_FAILURE(status)) {
233 return_ACPI_STATUS(status);
256 } 234 }
257 235
258 /* 236 /*
@@ -260,12 +238,12 @@ acpi_rs_get_method_data (
260 * byte stream buffer that comes back from the method 238 * byte stream buffer that comes back from the method
261 * execution. 239 * execution.
262 */ 240 */
263 status = acpi_rs_create_resource_list (obj_desc, ret_buffer); 241 status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
264 242
265 /* On exit, we must delete the object returned by evaluate_object */ 243 /* On exit, we must delete the object returned by evaluate_object */
266 244
267 acpi_ut_remove_reference (obj_desc); 245 acpi_ut_remove_reference(obj_desc);
268 return_ACPI_STATUS (status); 246 return_ACPI_STATUS(status);
269} 247}
270 248
271/******************************************************************************* 249/*******************************************************************************
@@ -287,18 +265,14 @@ acpi_rs_get_method_data (
287 ******************************************************************************/ 265 ******************************************************************************/
288 266
289acpi_status 267acpi_status
290acpi_rs_set_srs_method_data ( 268acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer)
291 acpi_handle handle,
292 struct acpi_buffer *in_buffer)
293{ 269{
294 struct acpi_parameter_info info; 270 struct acpi_parameter_info info;
295 union acpi_operand_object *params[2]; 271 union acpi_operand_object *params[2];
296 acpi_status status; 272 acpi_status status;
297 struct acpi_buffer buffer; 273 struct acpi_buffer buffer;
298
299
300 ACPI_FUNCTION_TRACE ("rs_set_srs_method_data");
301 274
275 ACPI_FUNCTION_TRACE("rs_set_srs_method_data");
302 276
303 /* Parameters guaranteed valid by caller */ 277 /* Parameters guaranteed valid by caller */
304 278
@@ -310,24 +284,24 @@ acpi_rs_set_srs_method_data (
310 * Convert the linked list into a byte stream 284 * Convert the linked list into a byte stream
311 */ 285 */
312 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; 286 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
313 status = acpi_rs_create_byte_stream (in_buffer->pointer, &buffer); 287 status = acpi_rs_create_byte_stream(in_buffer->pointer, &buffer);
314 if (ACPI_FAILURE (status)) { 288 if (ACPI_FAILURE(status)) {
315 return_ACPI_STATUS (status); 289 return_ACPI_STATUS(status);
316 } 290 }
317 291
318 /* Init the param object */ 292 /* Init the param object */
319 293
320 params[0] = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); 294 params[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
321 if (!params[0]) { 295 if (!params[0]) {
322 acpi_os_free (buffer.pointer); 296 acpi_os_free(buffer.pointer);
323 return_ACPI_STATUS (AE_NO_MEMORY); 297 return_ACPI_STATUS(AE_NO_MEMORY);
324 } 298 }
325 299
326 /* Set up the parameter object */ 300 /* Set up the parameter object */
327 301
328 params[0]->buffer.length = (u32) buffer.length; 302 params[0]->buffer.length = (u32) buffer.length;
329 params[0]->buffer.pointer = buffer.pointer; 303 params[0]->buffer.pointer = buffer.pointer;
330 params[0]->common.flags = AOPOBJ_DATA_VALID; 304 params[0]->common.flags = AOPOBJ_DATA_VALID;
331 params[1] = NULL; 305 params[1] = NULL;
332 306
333 info.node = handle; 307 info.node = handle;
@@ -336,18 +310,17 @@ acpi_rs_set_srs_method_data (
336 310
337 /* Execute the method, no return value */ 311 /* Execute the method, no return value */
338 312
339 status = acpi_ns_evaluate_relative (METHOD_NAME__SRS, &info); 313 status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info);
340 if (ACPI_SUCCESS (status)) { 314 if (ACPI_SUCCESS(status)) {
341 /* Delete any return object (especially if implicit_return is enabled) */ 315 /* Delete any return object (especially if implicit_return is enabled) */
342 316
343 if (info.return_object) { 317 if (info.return_object) {
344 acpi_ut_remove_reference (info.return_object); 318 acpi_ut_remove_reference(info.return_object);
345 } 319 }
346 } 320 }
347 321
348 /* Clean up and return the status from acpi_ns_evaluate_relative */ 322 /* Clean up and return the status from acpi_ns_evaluate_relative */
349 323
350 acpi_ut_remove_reference (params[0]); 324 acpi_ut_remove_reference(params[0]);
351 return_ACPI_STATUS (status); 325 return_ACPI_STATUS(status);
352} 326}
353
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c
index 83c944b8b097..ee5a5c509199 100644
--- a/drivers/acpi/resources/rsxface.c
+++ b/drivers/acpi/resources/rsxface.c
@@ -47,10 +47,9 @@
47#include <acpi/acresrc.h> 47#include <acpi/acresrc.h>
48 48
49#define _COMPONENT ACPI_RESOURCES 49#define _COMPONENT ACPI_RESOURCES
50 ACPI_MODULE_NAME ("rsxface") 50ACPI_MODULE_NAME("rsxface")
51 51
52/* Local macros for 16,32-bit to 64-bit conversion */ 52/* Local macros for 16,32-bit to 64-bit conversion */
53
54#define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field) 53#define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field)
55#define ACPI_COPY_ADDRESS(out, in) \ 54#define ACPI_COPY_ADDRESS(out, in) \
56 ACPI_COPY_FIELD(out, in, resource_type); \ 55 ACPI_COPY_FIELD(out, in, resource_type); \
@@ -65,8 +64,6 @@
65 ACPI_COPY_FIELD(out, in, address_translation_offset); \ 64 ACPI_COPY_FIELD(out, in, address_translation_offset); \
66 ACPI_COPY_FIELD(out, in, address_length); \ 65 ACPI_COPY_FIELD(out, in, address_length); \
67 ACPI_COPY_FIELD(out, in, resource_source); 66 ACPI_COPY_FIELD(out, in, resource_source);
68
69
70/******************************************************************************* 67/*******************************************************************************
71 * 68 *
72 * FUNCTION: acpi_get_irq_routing_table 69 * FUNCTION: acpi_get_irq_routing_table
@@ -89,17 +86,13 @@
89 * the object indicated by the passed device_handle. 86 * the object indicated by the passed device_handle.
90 * 87 *
91 ******************************************************************************/ 88 ******************************************************************************/
92
93acpi_status 89acpi_status
94acpi_get_irq_routing_table ( 90acpi_get_irq_routing_table(acpi_handle device_handle,
95 acpi_handle device_handle, 91 struct acpi_buffer *ret_buffer)
96 struct acpi_buffer *ret_buffer)
97{ 92{
98 acpi_status status; 93 acpi_status status;
99
100
101 ACPI_FUNCTION_TRACE ("acpi_get_irq_routing_table ");
102 94
95 ACPI_FUNCTION_TRACE("acpi_get_irq_routing_table ");
103 96
104 /* 97 /*
105 * Must have a valid handle and buffer, So we have to have a handle 98 * Must have a valid handle and buffer, So we have to have a handle
@@ -108,19 +101,18 @@ acpi_get_irq_routing_table (
108 * we'll be returning the needed buffer size, so keep going. 101 * we'll be returning the needed buffer size, so keep going.
109 */ 102 */
110 if (!device_handle) { 103 if (!device_handle) {
111 return_ACPI_STATUS (AE_BAD_PARAMETER); 104 return_ACPI_STATUS(AE_BAD_PARAMETER);
112 } 105 }
113 106
114 status = acpi_ut_validate_buffer (ret_buffer); 107 status = acpi_ut_validate_buffer(ret_buffer);
115 if (ACPI_FAILURE (status)) { 108 if (ACPI_FAILURE(status)) {
116 return_ACPI_STATUS (status); 109 return_ACPI_STATUS(status);
117 } 110 }
118 111
119 status = acpi_rs_get_prt_method_data (device_handle, ret_buffer); 112 status = acpi_rs_get_prt_method_data(device_handle, ret_buffer);
120 return_ACPI_STATUS (status); 113 return_ACPI_STATUS(status);
121} 114}
122 115
123
124/******************************************************************************* 116/*******************************************************************************
125 * 117 *
126 * FUNCTION: acpi_get_current_resources 118 * FUNCTION: acpi_get_current_resources
@@ -146,15 +138,12 @@ acpi_get_irq_routing_table (
146 ******************************************************************************/ 138 ******************************************************************************/
147 139
148acpi_status 140acpi_status
149acpi_get_current_resources ( 141acpi_get_current_resources(acpi_handle device_handle,
150 acpi_handle device_handle, 142 struct acpi_buffer *ret_buffer)
151 struct acpi_buffer *ret_buffer)
152{ 143{
153 acpi_status status; 144 acpi_status status;
154
155
156 ACPI_FUNCTION_TRACE ("acpi_get_current_resources");
157 145
146 ACPI_FUNCTION_TRACE("acpi_get_current_resources");
158 147
159 /* 148 /*
160 * Must have a valid handle and buffer, So we have to have a handle 149 * Must have a valid handle and buffer, So we have to have a handle
@@ -163,19 +152,19 @@ acpi_get_current_resources (
163 * we'll be returning the needed buffer size, so keep going. 152 * we'll be returning the needed buffer size, so keep going.
164 */ 153 */
165 if (!device_handle) { 154 if (!device_handle) {
166 return_ACPI_STATUS (AE_BAD_PARAMETER); 155 return_ACPI_STATUS(AE_BAD_PARAMETER);
167 } 156 }
168 157
169 status = acpi_ut_validate_buffer (ret_buffer); 158 status = acpi_ut_validate_buffer(ret_buffer);
170 if (ACPI_FAILURE (status)) { 159 if (ACPI_FAILURE(status)) {
171 return_ACPI_STATUS (status); 160 return_ACPI_STATUS(status);
172 } 161 }
173 162
174 status = acpi_rs_get_crs_method_data (device_handle, ret_buffer); 163 status = acpi_rs_get_crs_method_data(device_handle, ret_buffer);
175 return_ACPI_STATUS (status); 164 return_ACPI_STATUS(status);
176} 165}
177EXPORT_SYMBOL(acpi_get_current_resources);
178 166
167EXPORT_SYMBOL(acpi_get_current_resources);
179 168
180/******************************************************************************* 169/*******************************************************************************
181 * 170 *
@@ -200,15 +189,12 @@ EXPORT_SYMBOL(acpi_get_current_resources);
200 189
201#ifdef ACPI_FUTURE_USAGE 190#ifdef ACPI_FUTURE_USAGE
202acpi_status 191acpi_status
203acpi_get_possible_resources ( 192acpi_get_possible_resources(acpi_handle device_handle,
204 acpi_handle device_handle, 193 struct acpi_buffer *ret_buffer)
205 struct acpi_buffer *ret_buffer)
206{ 194{
207 acpi_status status; 195 acpi_status status;
208
209
210 ACPI_FUNCTION_TRACE ("acpi_get_possible_resources");
211 196
197 ACPI_FUNCTION_TRACE("acpi_get_possible_resources");
212 198
213 /* 199 /*
214 * Must have a valid handle and buffer, So we have to have a handle 200 * Must have a valid handle and buffer, So we have to have a handle
@@ -217,20 +203,20 @@ acpi_get_possible_resources (
217 * we'll be returning the needed buffer size, so keep going. 203 * we'll be returning the needed buffer size, so keep going.
218 */ 204 */
219 if (!device_handle) { 205 if (!device_handle) {
220 return_ACPI_STATUS (AE_BAD_PARAMETER); 206 return_ACPI_STATUS(AE_BAD_PARAMETER);
221 } 207 }
222 208
223 status = acpi_ut_validate_buffer (ret_buffer); 209 status = acpi_ut_validate_buffer(ret_buffer);
224 if (ACPI_FAILURE (status)) { 210 if (ACPI_FAILURE(status)) {
225 return_ACPI_STATUS (status); 211 return_ACPI_STATUS(status);
226 } 212 }
227 213
228 status = acpi_rs_get_prs_method_data (device_handle, ret_buffer); 214 status = acpi_rs_get_prs_method_data(device_handle, ret_buffer);
229 return_ACPI_STATUS (status); 215 return_ACPI_STATUS(status);
230} 216}
231EXPORT_SYMBOL(acpi_get_possible_resources);
232#endif /* ACPI_FUTURE_USAGE */
233 217
218EXPORT_SYMBOL(acpi_get_possible_resources);
219#endif /* ACPI_FUTURE_USAGE */
234 220
235/******************************************************************************* 221/*******************************************************************************
236 * 222 *
@@ -252,37 +238,33 @@ EXPORT_SYMBOL(acpi_get_possible_resources);
252 ******************************************************************************/ 238 ******************************************************************************/
253 239
254acpi_status 240acpi_status
255acpi_walk_resources ( 241acpi_walk_resources(acpi_handle device_handle,
256 acpi_handle device_handle, 242 char *path,
257 char *path, 243 ACPI_WALK_RESOURCE_CALLBACK user_function, void *context)
258 ACPI_WALK_RESOURCE_CALLBACK user_function,
259 void *context)
260{ 244{
261 acpi_status status; 245 acpi_status status;
262 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; 246 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
263 struct acpi_resource *resource; 247 struct acpi_resource *resource;
264 struct acpi_resource *buffer_end; 248 struct acpi_resource *buffer_end;
265
266
267 ACPI_FUNCTION_TRACE ("acpi_walk_resources");
268 249
250 ACPI_FUNCTION_TRACE("acpi_walk_resources");
269 251
270 if (!device_handle || 252 if (!device_handle ||
271 (ACPI_STRNCMP (path, METHOD_NAME__CRS, sizeof (METHOD_NAME__CRS)) && 253 (ACPI_STRNCMP(path, METHOD_NAME__CRS, sizeof(METHOD_NAME__CRS)) &&
272 ACPI_STRNCMP (path, METHOD_NAME__PRS, sizeof (METHOD_NAME__PRS)))) { 254 ACPI_STRNCMP(path, METHOD_NAME__PRS, sizeof(METHOD_NAME__PRS)))) {
273 return_ACPI_STATUS (AE_BAD_PARAMETER); 255 return_ACPI_STATUS(AE_BAD_PARAMETER);
274 } 256 }
275 257
276 status = acpi_rs_get_method_data (device_handle, path, &buffer); 258 status = acpi_rs_get_method_data(device_handle, path, &buffer);
277 if (ACPI_FAILURE (status)) { 259 if (ACPI_FAILURE(status)) {
278 return_ACPI_STATUS (status); 260 return_ACPI_STATUS(status);
279 } 261 }
280 262
281 /* Setup pointers */ 263 /* Setup pointers */
282 264
283 resource = (struct acpi_resource *) buffer.pointer; 265 resource = (struct acpi_resource *)buffer.pointer;
284 buffer_end = ACPI_CAST_PTR (struct acpi_resource, 266 buffer_end = ACPI_CAST_PTR(struct acpi_resource,
285 ((u8 *) buffer.pointer + buffer.length)); 267 ((u8 *) buffer.pointer + buffer.length));
286 268
287 /* Walk the resource list */ 269 /* Walk the resource list */
288 270
@@ -291,7 +273,7 @@ acpi_walk_resources (
291 break; 273 break;
292 } 274 }
293 275
294 status = user_function (resource, context); 276 status = user_function(resource, context);
295 277
296 switch (status) { 278 switch (status) {
297 case AE_OK: 279 case AE_OK:
@@ -318,7 +300,7 @@ acpi_walk_resources (
318 300
319 /* Get the next resource descriptor */ 301 /* Get the next resource descriptor */
320 302
321 resource = ACPI_NEXT_RESOURCE (resource); 303 resource = ACPI_NEXT_RESOURCE(resource);
322 304
323 /* Check for end-of-buffer */ 305 /* Check for end-of-buffer */
324 306
@@ -327,13 +309,13 @@ acpi_walk_resources (
327 } 309 }
328 } 310 }
329 311
330cleanup: 312 cleanup:
331 313
332 acpi_os_free (buffer.pointer); 314 acpi_os_free(buffer.pointer);
333 return_ACPI_STATUS (status); 315 return_ACPI_STATUS(status);
334} 316}
335EXPORT_SYMBOL(acpi_walk_resources);
336 317
318EXPORT_SYMBOL(acpi_walk_resources);
337 319
338/******************************************************************************* 320/*******************************************************************************
339 * 321 *
@@ -354,30 +336,25 @@ EXPORT_SYMBOL(acpi_walk_resources);
354 ******************************************************************************/ 336 ******************************************************************************/
355 337
356acpi_status 338acpi_status
357acpi_set_current_resources ( 339acpi_set_current_resources(acpi_handle device_handle,
358 acpi_handle device_handle, 340 struct acpi_buffer *in_buffer)
359 struct acpi_buffer *in_buffer)
360{ 341{
361 acpi_status status; 342 acpi_status status;
362
363
364 ACPI_FUNCTION_TRACE ("acpi_set_current_resources");
365 343
344 ACPI_FUNCTION_TRACE("acpi_set_current_resources");
366 345
367 /* Must have a valid handle and buffer */ 346 /* Must have a valid handle and buffer */
368 347
369 if ((!device_handle) || 348 if ((!device_handle) ||
370 (!in_buffer) || 349 (!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) {
371 (!in_buffer->pointer) || 350 return_ACPI_STATUS(AE_BAD_PARAMETER);
372 (!in_buffer->length)) {
373 return_ACPI_STATUS (AE_BAD_PARAMETER);
374 } 351 }
375 352
376 status = acpi_rs_set_srs_method_data (device_handle, in_buffer); 353 status = acpi_rs_set_srs_method_data(device_handle, in_buffer);
377 return_ACPI_STATUS (status); 354 return_ACPI_STATUS(status);
378} 355}
379EXPORT_SYMBOL(acpi_set_current_resources);
380 356
357EXPORT_SYMBOL(acpi_set_current_resources);
381 358
382/****************************************************************************** 359/******************************************************************************
383 * 360 *
@@ -398,41 +375,38 @@ EXPORT_SYMBOL(acpi_set_current_resources);
398 ******************************************************************************/ 375 ******************************************************************************/
399 376
400acpi_status 377acpi_status
401acpi_resource_to_address64 ( 378acpi_resource_to_address64(struct acpi_resource *resource,
402 struct acpi_resource *resource, 379 struct acpi_resource_address64 *out)
403 struct acpi_resource_address64 *out)
404{ 380{
405 struct acpi_resource_address16 *address16; 381 struct acpi_resource_address16 *address16;
406 struct acpi_resource_address32 *address32; 382 struct acpi_resource_address32 *address32;
407
408 383
409 switch (resource->id) { 384 switch (resource->id) {
410 case ACPI_RSTYPE_ADDRESS16: 385 case ACPI_RSTYPE_ADDRESS16:
411 386
412 address16 = (struct acpi_resource_address16 *) &resource->data; 387 address16 = (struct acpi_resource_address16 *)&resource->data;
413 ACPI_COPY_ADDRESS (out, address16); 388 ACPI_COPY_ADDRESS(out, address16);
414 break; 389 break;
415 390
416
417 case ACPI_RSTYPE_ADDRESS32: 391 case ACPI_RSTYPE_ADDRESS32:
418 392
419 address32 = (struct acpi_resource_address32 *) &resource->data; 393 address32 = (struct acpi_resource_address32 *)&resource->data;
420 ACPI_COPY_ADDRESS (out, address32); 394 ACPI_COPY_ADDRESS(out, address32);
421 break; 395 break;
422 396
423
424 case ACPI_RSTYPE_ADDRESS64: 397 case ACPI_RSTYPE_ADDRESS64:
425 398
426 /* Simple copy for 64 bit source */ 399 /* Simple copy for 64 bit source */
427 400
428 ACPI_MEMCPY (out, &resource->data, sizeof (struct acpi_resource_address64)); 401 ACPI_MEMCPY(out, &resource->data,
402 sizeof(struct acpi_resource_address64));
429 break; 403 break;
430 404
431
432 default: 405 default:
433 return (AE_BAD_PARAMETER); 406 return (AE_BAD_PARAMETER);
434 } 407 }
435 408
436 return (AE_OK); 409 return (AE_OK);
437} 410}
411
438EXPORT_SYMBOL(acpi_resource_to_address64); 412EXPORT_SYMBOL(acpi_resource_to_address64);