diff options
| -rw-r--r-- | drivers/acpi/acpica/rscreate.c | 64 | ||||
| -rw-r--r-- | include/acpi/acpixf.h | 5 |
2 files changed, 69 insertions, 0 deletions
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c index f61285d5edc3..06264e8b58d9 100644 --- a/drivers/acpi/acpica/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c | |||
| @@ -51,6 +51,70 @@ ACPI_MODULE_NAME("rscreate") | |||
| 51 | 51 | ||
| 52 | /******************************************************************************* | 52 | /******************************************************************************* |
| 53 | * | 53 | * |
| 54 | * FUNCTION: acpi_buffer_to_resource | ||
| 55 | * | ||
| 56 | * PARAMETERS: aml_buffer - Pointer to the resource byte stream | ||
| 57 | * aml_buffer_length - Length of the aml_buffer | ||
| 58 | * resource_ptr - Where the converted resource is returned | ||
| 59 | * | ||
| 60 | * RETURN: Status | ||
| 61 | * | ||
| 62 | * DESCRIPTION: Convert a raw AML buffer to a resource list | ||
| 63 | * | ||
| 64 | ******************************************************************************/ | ||
| 65 | acpi_status | ||
| 66 | acpi_buffer_to_resource(u8 *aml_buffer, | ||
| 67 | u16 aml_buffer_length, | ||
| 68 | struct acpi_resource **resource_ptr) | ||
| 69 | { | ||
| 70 | acpi_status status; | ||
| 71 | acpi_size list_size_needed; | ||
| 72 | void *resource; | ||
| 73 | void *current_resource_ptr; | ||
| 74 | |||
| 75 | /* | ||
| 76 | * Note: we allow AE_AML_NO_RESOURCE_END_TAG, since an end tag | ||
| 77 | * is not required here. | ||
| 78 | */ | ||
| 79 | |||
| 80 | /* Get the required length for the converted resource */ | ||
| 81 | |||
| 82 | status = acpi_rs_get_list_length(aml_buffer, aml_buffer_length, | ||
| 83 | &list_size_needed); | ||
| 84 | if (status == AE_AML_NO_RESOURCE_END_TAG) { | ||
| 85 | status = AE_OK; | ||
| 86 | } | ||
| 87 | if (ACPI_FAILURE(status)) { | ||
| 88 | return (status); | ||
| 89 | } | ||
| 90 | |||
| 91 | /* Allocate a buffer for the converted resource */ | ||
| 92 | |||
| 93 | resource = ACPI_ALLOCATE_ZEROED(list_size_needed); | ||
| 94 | current_resource_ptr = resource; | ||
| 95 | if (!resource) { | ||
| 96 | return (AE_NO_MEMORY); | ||
| 97 | } | ||
| 98 | |||
| 99 | /* Perform the AML-to-Resource conversion */ | ||
| 100 | |||
| 101 | status = acpi_ut_walk_aml_resources(aml_buffer, aml_buffer_length, | ||
| 102 | acpi_rs_convert_aml_to_resources, | ||
| 103 | ¤t_resource_ptr); | ||
| 104 | if (status == AE_AML_NO_RESOURCE_END_TAG) { | ||
| 105 | status = AE_OK; | ||
| 106 | } | ||
| 107 | if (ACPI_FAILURE(status)) { | ||
| 108 | ACPI_FREE(resource); | ||
| 109 | } else { | ||
| 110 | *resource_ptr = resource; | ||
| 111 | } | ||
| 112 | |||
| 113 | return (status); | ||
| 114 | } | ||
| 115 | |||
| 116 | /******************************************************************************* | ||
| 117 | * | ||
| 54 | * FUNCTION: acpi_rs_create_resource_list | 118 | * FUNCTION: acpi_rs_create_resource_list |
| 55 | * | 119 | * |
| 56 | * PARAMETERS: aml_buffer - Pointer to the resource byte stream | 120 | * PARAMETERS: aml_buffer - Pointer to the resource byte stream |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 726d937ef5b1..5d8df1dfb203 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
| @@ -376,6 +376,11 @@ acpi_status | |||
| 376 | acpi_resource_to_address64(struct acpi_resource *resource, | 376 | acpi_resource_to_address64(struct acpi_resource *resource, |
| 377 | struct acpi_resource_address64 *out); | 377 | struct acpi_resource_address64 *out); |
| 378 | 378 | ||
| 379 | acpi_status | ||
| 380 | acpi_buffer_to_resource(u8 *aml_buffer, | ||
| 381 | u16 aml_buffer_length, | ||
| 382 | struct acpi_resource **resource_ptr); | ||
| 383 | |||
| 379 | /* | 384 | /* |
| 380 | * Hardware (ACPI device) interfaces | 385 | * Hardware (ACPI device) interfaces |
| 381 | */ | 386 | */ |
