diff options
Diffstat (limited to 'drivers/acpi/resources/rslist.c')
-rw-r--r-- | drivers/acpi/resources/rslist.c | 68 |
1 files changed, 28 insertions, 40 deletions
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index e49c1e030f99..db7bcb4e60e3 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c | |||
@@ -55,7 +55,7 @@ | |||
55 | * | 55 | * |
56 | * PARAMETERS: resource_start_byte - Byte 0 of a resource descriptor | 56 | * PARAMETERS: resource_start_byte - Byte 0 of a resource descriptor |
57 | * | 57 | * |
58 | * RETURN: The Resource Type (Name) with no extraneous bits | 58 | * RETURN: The Resource Type with no extraneous bits |
59 | * | 59 | * |
60 | * DESCRIPTION: Extract the Resource Type/Name from the first byte of | 60 | * DESCRIPTION: Extract the Resource Type/Name from the first byte of |
61 | * a resource descriptor. | 61 | * a resource descriptor. |
@@ -70,28 +70,25 @@ acpi_rs_get_resource_type ( | |||
70 | ACPI_FUNCTION_ENTRY (); | 70 | ACPI_FUNCTION_ENTRY (); |
71 | 71 | ||
72 | 72 | ||
73 | /* | 73 | /* Determine if this is a small or large resource */ |
74 | * Determine if this is a small or large resource | 74 | |
75 | */ | ||
76 | switch (resource_start_byte & ACPI_RDESC_TYPE_MASK) { | 75 | switch (resource_start_byte & ACPI_RDESC_TYPE_MASK) { |
77 | case ACPI_RDESC_TYPE_SMALL: | 76 | case ACPI_RDESC_TYPE_SMALL: |
78 | 77 | ||
79 | /* | 78 | /* Small Resource Type -- Only bits 6:3 are valid */ |
80 | * Small Resource Type -- Only bits 6:3 are valid | 79 | |
81 | */ | ||
82 | return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK)); | 80 | return ((u8) (resource_start_byte & ACPI_RDESC_SMALL_MASK)); |
83 | 81 | ||
84 | 82 | ||
85 | case ACPI_RDESC_TYPE_LARGE: | 83 | case ACPI_RDESC_TYPE_LARGE: |
86 | 84 | ||
87 | /* | 85 | /* Large Resource Type -- All bits are valid */ |
88 | * Large Resource Type -- All bits are valid | 86 | |
89 | */ | ||
90 | return (resource_start_byte); | 87 | return (resource_start_byte); |
91 | 88 | ||
92 | 89 | ||
93 | default: | 90 | default: |
94 | /* No other types of resource descriptor */ | 91 | /* Invalid type */ |
95 | break; | 92 | break; |
96 | } | 93 | } |
97 | 94 | ||
@@ -135,9 +132,8 @@ acpi_rs_byte_stream_to_list ( | |||
135 | 132 | ||
136 | while (bytes_parsed < byte_stream_buffer_length && | 133 | while (bytes_parsed < byte_stream_buffer_length && |
137 | !end_tag_processed) { | 134 | !end_tag_processed) { |
138 | /* | 135 | /* The next byte in the stream is the resource type */ |
139 | * The next byte in the stream is the resource type | 136 | |
140 | */ | ||
141 | resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); | 137 | resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); |
142 | 138 | ||
143 | switch (resource_type) { | 139 | switch (resource_type) { |
@@ -299,28 +295,23 @@ acpi_rs_byte_stream_to_list ( | |||
299 | return_ACPI_STATUS (status); | 295 | return_ACPI_STATUS (status); |
300 | } | 296 | } |
301 | 297 | ||
302 | /* | 298 | /* Update the return value and counter */ |
303 | * Update the return value and counter | 299 | |
304 | */ | ||
305 | bytes_parsed += bytes_consumed; | 300 | bytes_parsed += bytes_consumed; |
306 | 301 | ||
307 | /* | 302 | /* Set the byte stream to point to the next resource */ |
308 | * Set the byte stream to point to the next resource | 303 | |
309 | */ | ||
310 | byte_stream_buffer += bytes_consumed; | 304 | byte_stream_buffer += bytes_consumed; |
311 | 305 | ||
312 | /* | 306 | /* Set the Buffer to the next structure */ |
313 | * Set the Buffer to the next structure | 307 | |
314 | */ | ||
315 | resource = ACPI_CAST_PTR (struct acpi_resource, buffer); | 308 | resource = ACPI_CAST_PTR (struct acpi_resource, buffer); |
316 | resource->length = (u32) ACPI_ALIGN_RESOURCE_SIZE (resource->length); | 309 | resource->length = (u32) ACPI_ALIGN_RESOURCE_SIZE (resource->length); |
317 | buffer += ACPI_ALIGN_RESOURCE_SIZE (structure_size); | 310 | buffer += ACPI_ALIGN_RESOURCE_SIZE (structure_size); |
311 | } | ||
318 | 312 | ||
319 | } /* end while */ | 313 | /* Check the reason for exiting the while loop */ |
320 | 314 | ||
321 | /* | ||
322 | * Check the reason for exiting the while loop | ||
323 | */ | ||
324 | if (!end_tag_processed) { | 315 | if (!end_tag_processed) { |
325 | return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); | 316 | return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); |
326 | } | 317 | } |
@@ -424,9 +415,8 @@ acpi_rs_list_to_byte_stream ( | |||
424 | */ | 415 | */ |
425 | status = acpi_rs_end_tag_stream (linked_list, &buffer, &bytes_consumed); | 416 | status = acpi_rs_end_tag_stream (linked_list, &buffer, &bytes_consumed); |
426 | 417 | ||
427 | /* | 418 | /* An End Tag indicates the end of the Resource Template */ |
428 | * An End Tag indicates the end of the Resource Template | 419 | |
429 | */ | ||
430 | done = TRUE; | 420 | done = TRUE; |
431 | break; | 421 | break; |
432 | 422 | ||
@@ -488,27 +478,25 @@ acpi_rs_list_to_byte_stream ( | |||
488 | default: | 478 | default: |
489 | /* | 479 | /* |
490 | * If we get here, everything is out of sync, | 480 | * If we get here, everything is out of sync, |
491 | * so exit with an error | 481 | * so exit with an error |
492 | */ | 482 | */ |
493 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid descriptor type (%X) in resource list\n", | 483 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
484 | "Invalid descriptor type (%X) in resource list\n", | ||
494 | linked_list->id)); | 485 | linked_list->id)); |
495 | status = AE_BAD_DATA; | 486 | status = AE_BAD_DATA; |
496 | break; | 487 | break; |
497 | 488 | } | |
498 | } /* switch (linked_list->Id) */ | ||
499 | 489 | ||
500 | if (ACPI_FAILURE (status)) { | 490 | if (ACPI_FAILURE (status)) { |
501 | return_ACPI_STATUS (status); | 491 | return_ACPI_STATUS (status); |
502 | } | 492 | } |
503 | 493 | ||
504 | /* | 494 | /* Set the Buffer to point to the open byte */ |
505 | * Set the Buffer to point to the open byte | 495 | |
506 | */ | ||
507 | buffer += bytes_consumed; | 496 | buffer += bytes_consumed; |
508 | 497 | ||
509 | /* | 498 | /* Point to the next object */ |
510 | * Point to the next object | 499 | |
511 | */ | ||
512 | linked_list = ACPI_PTR_ADD (struct acpi_resource, | 500 | linked_list = ACPI_PTR_ADD (struct acpi_resource, |
513 | linked_list, linked_list->length); | 501 | linked_list, linked_list->length); |
514 | } | 502 | } |