diff options
Diffstat (limited to 'drivers/acpi/executer/exmisc.c')
-rw-r--r-- | drivers/acpi/executer/exmisc.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 5ad34566738c..48c18d29222a 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -98,8 +98,8 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, | |||
98 | 98 | ||
99 | default: | 99 | default: |
100 | 100 | ||
101 | ACPI_REPORT_ERROR(("Unknown Reference opcode %X\n", | 101 | ACPI_ERROR((AE_INFO, "Unknown Reference opcode %X", |
102 | obj_desc->reference.opcode)); | 102 | obj_desc->reference.opcode)); |
103 | return_ACPI_STATUS(AE_AML_INTERNAL); | 103 | return_ACPI_STATUS(AE_AML_INTERNAL); |
104 | } | 104 | } |
105 | break; | 105 | break; |
@@ -114,8 +114,8 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, | |||
114 | 114 | ||
115 | default: | 115 | default: |
116 | 116 | ||
117 | ACPI_REPORT_ERROR(("Invalid descriptor type %X\n", | 117 | ACPI_ERROR((AE_INFO, "Invalid descriptor type %X", |
118 | ACPI_GET_DESCRIPTOR_TYPE(obj_desc))); | 118 | ACPI_GET_DESCRIPTOR_TYPE(obj_desc))); |
119 | return_ACPI_STATUS(AE_TYPE); | 119 | return_ACPI_STATUS(AE_TYPE); |
120 | } | 120 | } |
121 | 121 | ||
@@ -166,15 +166,18 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, | |||
166 | u8 *end_tag; | 166 | u8 *end_tag; |
167 | acpi_size length0; | 167 | acpi_size length0; |
168 | acpi_size length1; | 168 | acpi_size length1; |
169 | acpi_size new_length; | ||
169 | 170 | ||
170 | ACPI_FUNCTION_TRACE("ex_concat_template"); | 171 | ACPI_FUNCTION_TRACE("ex_concat_template"); |
171 | 172 | ||
172 | /* | 173 | /* |
173 | * Find the end_tag descriptor in each resource template. | 174 | * Find the end_tag descriptor in each resource template. |
174 | * Note: returned pointers point TO the end_tag, not past it. | 175 | * Note1: returned pointers point TO the end_tag, not past it. |
175 | * | 176 | * Note2: zero-length buffers are allowed; treated like one end_tag |
176 | * Compute the length of each resource template | ||
177 | */ | 177 | */ |
178 | |||
179 | /* Get the length of the first resource template */ | ||
180 | |||
178 | status = acpi_ut_get_resource_end_tag(operand0, &end_tag); | 181 | status = acpi_ut_get_resource_end_tag(operand0, &end_tag); |
179 | if (ACPI_FAILURE(status)) { | 182 | if (ACPI_FAILURE(status)) { |
180 | return_ACPI_STATUS(status); | 183 | return_ACPI_STATUS(status); |
@@ -182,19 +185,22 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, | |||
182 | 185 | ||
183 | length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer); | 186 | length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer); |
184 | 187 | ||
188 | /* Get the length of the second resource template */ | ||
189 | |||
185 | status = acpi_ut_get_resource_end_tag(operand1, &end_tag); | 190 | status = acpi_ut_get_resource_end_tag(operand1, &end_tag); |
186 | if (ACPI_FAILURE(status)) { | 191 | if (ACPI_FAILURE(status)) { |
187 | return_ACPI_STATUS(status); | 192 | return_ACPI_STATUS(status); |
188 | } | 193 | } |
189 | 194 | ||
190 | /* Include the end_tag in the second template length */ | 195 | length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer); |
196 | |||
197 | /* Combine both lengths, minimum size will be 2 for end_tag */ | ||
191 | 198 | ||
192 | length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer) + | 199 | new_length = length0 + length1 + sizeof(struct aml_resource_end_tag); |
193 | sizeof(struct aml_resource_end_tag); | ||
194 | 200 | ||
195 | /* Create a new buffer object for the result */ | 201 | /* Create a new buffer object for the result (with one end_tag) */ |
196 | 202 | ||
197 | return_desc = acpi_ut_create_buffer_object(length0 + length1); | 203 | return_desc = acpi_ut_create_buffer_object(new_length); |
198 | if (!return_desc) { | 204 | if (!return_desc) { |
199 | return_ACPI_STATUS(AE_NO_MEMORY); | 205 | return_ACPI_STATUS(AE_NO_MEMORY); |
200 | } | 206 | } |
@@ -207,9 +213,10 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, | |||
207 | ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0); | 213 | ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0); |
208 | ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1); | 214 | ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1); |
209 | 215 | ||
210 | /* Set the end_tag checksum to zero, means "ignore checksum" */ | 216 | /* Insert end_tag and set the checksum to zero, means "ignore checksum" */ |
211 | 217 | ||
212 | new_buf[return_desc->buffer.length - 1] = 0; | 218 | new_buf[new_length - 1] = 0; |
219 | new_buf[new_length - 2] = ACPI_RESOURCE_NAME_END_TAG | 1; | ||
213 | 220 | ||
214 | /* Return the completed resource template */ | 221 | /* Return the completed resource template */ |
215 | 222 | ||
@@ -268,8 +275,8 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
268 | break; | 275 | break; |
269 | 276 | ||
270 | default: | 277 | default: |
271 | ACPI_REPORT_ERROR(("Invalid object type: %X\n", | 278 | ACPI_ERROR((AE_INFO, "Invalid object type: %X", |
272 | ACPI_GET_OBJECT_TYPE(operand0))); | 279 | ACPI_GET_OBJECT_TYPE(operand0))); |
273 | status = AE_AML_INTERNAL; | 280 | status = AE_AML_INTERNAL; |
274 | } | 281 | } |
275 | 282 | ||
@@ -370,8 +377,8 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
370 | 377 | ||
371 | /* Invalid object type, should not happen here */ | 378 | /* Invalid object type, should not happen here */ |
372 | 379 | ||
373 | ACPI_REPORT_ERROR(("Invalid object type: %X\n", | 380 | ACPI_ERROR((AE_INFO, "Invalid object type: %X", |
374 | ACPI_GET_OBJECT_TYPE(operand0))); | 381 | ACPI_GET_OBJECT_TYPE(operand0))); |
375 | status = AE_AML_INTERNAL; | 382 | status = AE_AML_INTERNAL; |
376 | goto cleanup; | 383 | goto cleanup; |
377 | } | 384 | } |