diff options
author | Len Brown <len.brown@intel.com> | 2005-08-05 00:44:28 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-08-05 00:45:14 -0400 |
commit | 4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch) | |
tree | 5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/resources/rscalc.c | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/resources/rscalc.c')
-rw-r--r-- | drivers/acpi/resources/rscalc.c | 314 |
1 files changed, 151 insertions, 163 deletions
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") | 50 | ACPI_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 | |||
70 | acpi_status | 67 | acpi_status |
71 | acpi_rs_get_byte_stream_length ( | 68 | acpi_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 | ||
299 | acpi_status | 301 | acpi_status |
300 | acpi_rs_get_list_length ( | 302 | acpi_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 | ||
725 | acpi_status | 717 | acpi_status |
726 | acpi_rs_get_pci_routing_table_length ( | 718 | acpi_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 | } |