diff options
Diffstat (limited to 'drivers/acpi/acpica/rscreate.c')
-rw-r--r-- | drivers/acpi/acpica/rscreate.c | 69 |
1 files changed, 67 insertions, 2 deletions
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c index 4ce6e1147e80..46d6eb38ae66 100644 --- a/drivers/acpi/acpica/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2011, Intel Corp. | 8 | * Copyright (C) 2000 - 2012, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -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 |
@@ -66,9 +130,10 @@ ACPI_MODULE_NAME("rscreate") | |||
66 | * of device resources. | 130 | * of device resources. |
67 | * | 131 | * |
68 | ******************************************************************************/ | 132 | ******************************************************************************/ |
133 | |||
69 | acpi_status | 134 | acpi_status |
70 | acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, | 135 | acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, |
71 | struct acpi_buffer *output_buffer) | 136 | struct acpi_buffer * output_buffer) |
72 | { | 137 | { |
73 | 138 | ||
74 | acpi_status status; | 139 | acpi_status status; |