aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2009-12-11 02:18:52 -0500
committerLen Brown <len.brown@intel.com>2009-12-15 17:29:36 -0500
commitea7c5ec148044776d5e134e52a3e1aca8d662dbe (patch)
treef1f37cf9b22ea9e48c5b90f1842cfef5a9275111 /drivers/acpi/acpica
parentd97659112044c0c77b93c6199eee7ee884eb3cca (diff)
ACPICA: Move Package-to-Buffer repair code into common ToBuffer function
Move code specific to _FDE and _GTM into the generic repair code. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r--drivers/acpi/acpica/nspredef.c11
-rw-r--r--drivers/acpi/acpica/nsrepair.c43
-rw-r--r--drivers/acpi/acpica/nsrepair2.c43
3 files changed, 48 insertions, 49 deletions
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c
index 1782c3d85ba2..c6297f57fea8 100644
--- a/drivers/acpi/acpica/nspredef.c
+++ b/drivers/acpi/acpica/nspredef.c
@@ -215,6 +215,8 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
215 data->node_flags = node->flags; 215 data->node_flags = node->flags;
216 data->pathname = pathname; 216 data->pathname = pathname;
217 217
218 /* TBD: For variable-length Packages, remove NULL elements here */
219
218 /* 220 /*
219 * Check that the type of the return object is what is expected for 221 * Check that the type of the return object is what is expected for
220 * this predefined name 222 * this predefined name
@@ -223,10 +225,11 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
223 predefined->info.expected_btypes, 225 predefined->info.expected_btypes,
224 ACPI_NOT_PACKAGE_ELEMENT); 226 ACPI_NOT_PACKAGE_ELEMENT);
225 if (ACPI_SUCCESS(status)) { 227 if (ACPI_SUCCESS(status)) {
226 228 /*
227 /* For returned Package objects, check the type of all sub-objects */ 229 * For returned Package objects, check the type of all sub-objects.
228 230 * Note: Package may have been created by call above.
229 if (return_object->common.type == ACPI_TYPE_PACKAGE) { 231 */
232 if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) {
230 status = acpi_ns_check_package(data, return_object_ptr); 233 status = acpi_ns_check_package(data, return_object_ptr);
231 } 234 }
232 } 235 }
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c
index 10629fa55d83..062a016d4554 100644
--- a/drivers/acpi/acpica/nsrepair.c
+++ b/drivers/acpi/acpica/nsrepair.c
@@ -350,7 +350,7 @@ acpi_ns_convert_to_string(union acpi_operand_object *original_object,
350 * 350 *
351 * RETURN: Status. AE_OK if conversion was successful. 351 * RETURN: Status. AE_OK if conversion was successful.
352 * 352 *
353 * DESCRIPTION: Attempt to convert a Integer/String object to a Buffer. 353 * DESCRIPTION: Attempt to convert a Integer/String/Package object to a Buffer.
354 * 354 *
355 ******************************************************************************/ 355 ******************************************************************************/
356 356
@@ -360,6 +360,10 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
360{ 360{
361 union acpi_operand_object *new_object; 361 union acpi_operand_object *new_object;
362 acpi_status status; 362 acpi_status status;
363 union acpi_operand_object **elements;
364 u32 *dword_buffer;
365 u32 count;
366 u32 i;
363 367
364 switch (original_object->common.type) { 368 switch (original_object->common.type) {
365 case ACPI_TYPE_INTEGER: 369 case ACPI_TYPE_INTEGER:
@@ -393,6 +397,40 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
393 original_object->string.length); 397 original_object->string.length);
394 break; 398 break;
395 399
400 case ACPI_TYPE_PACKAGE:
401
402 /* All elements of the Package must be integers */
403
404 elements = original_object->package.elements;
405 count = original_object->package.count;
406
407 for (i = 0; i < count; i++) {
408 if ((!*elements) ||
409 ((*elements)->common.type != ACPI_TYPE_INTEGER)) {
410 return (AE_AML_OPERAND_TYPE);
411 }
412 elements++;
413 }
414
415 /* Create the new buffer object to replace the Package */
416
417 new_object = acpi_ut_create_buffer_object(ACPI_MUL_4(count));
418 if (!new_object) {
419 return (AE_NO_MEMORY);
420 }
421
422 /* Copy the package elements (integers) to the buffer as DWORDs */
423
424 elements = original_object->package.elements;
425 dword_buffer = ACPI_CAST_PTR(u32, new_object->buffer.pointer);
426
427 for (i = 0; i < count; i++) {
428 *dword_buffer = (u32) (*elements)->integer.value;
429 dword_buffer++;
430 elements++;
431 }
432 break;
433
396 default: 434 default:
397 return (AE_AML_OPERAND_TYPE); 435 return (AE_AML_OPERAND_TYPE);
398 } 436 }
@@ -441,7 +479,8 @@ acpi_ns_convert_to_package(union acpi_operand_object *original_object,
441 buffer = original_object->buffer.pointer; 479 buffer = original_object->buffer.pointer;
442 480
443 while (length--) { 481 while (length--) {
444 *elements = acpi_ut_create_integer_object(*buffer); 482 *elements =
483 acpi_ut_create_integer_object((u64) *buffer);
445 if (!*elements) { 484 if (!*elements) {
446 acpi_ut_remove_reference(new_object); 485 acpi_ut_remove_reference(new_object);
447 return (AE_NO_MEMORY); 486 return (AE_NO_MEMORY);
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c
index 6c35b57a7fd0..846df7047a81 100644
--- a/drivers/acpi/acpica/nsrepair2.c
+++ b/drivers/acpi/acpica/nsrepair2.c
@@ -250,11 +250,9 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
250 union acpi_operand_object **return_object_ptr) 250 union acpi_operand_object **return_object_ptr)
251{ 251{
252 union acpi_operand_object *return_object = *return_object_ptr; 252 union acpi_operand_object *return_object = *return_object_ptr;
253 union acpi_operand_object **elements;
254 union acpi_operand_object *buffer_object; 253 union acpi_operand_object *buffer_object;
255 u8 *byte_buffer; 254 u8 *byte_buffer;
256 u32 *dword_buffer; 255 u32 *dword_buffer;
257 u32 count;
258 u32 i; 256 u32 i;
259 257
260 switch (return_object->common.type) { 258 switch (return_object->common.type) {
@@ -302,47 +300,6 @@ acpi_ns_repair_FDE(struct acpi_predefined_data *data,
302 "Expanded Byte Buffer to expected DWord Buffer")); 300 "Expanded Byte Buffer to expected DWord Buffer"));
303 break; 301 break;
304 302
305 case ACPI_TYPE_PACKAGE:
306
307 /* All elements of the Package must be integers */
308
309 elements = return_object->package.elements;
310 count =
311 ACPI_MIN(ACPI_FDE_FIELD_COUNT,
312 return_object->package.count);
313
314 for (i = 0; i < count; i++) {
315 if ((!*elements) ||
316 ((*elements)->common.type != ACPI_TYPE_INTEGER)) {
317 return (AE_AML_OPERAND_TYPE);
318 }
319 elements++;
320 }
321
322 /* Create the new buffer object to replace the Package */
323
324 buffer_object =
325 acpi_ut_create_buffer_object(ACPI_FDE_DWORD_BUFFER_SIZE);
326 if (!buffer_object) {
327 return (AE_NO_MEMORY);
328 }
329
330 /* Copy the package elements (integers) to the buffer */
331
332 elements = return_object->package.elements;
333 dword_buffer =
334 ACPI_CAST_PTR(u32, buffer_object->buffer.pointer);
335
336 for (i = 0; i < count; i++) {
337 *dword_buffer = (u32) (*elements)->integer.value;
338 dword_buffer++;
339 elements++;
340 }
341
342 ACPI_INFO_PREDEFINED((AE_INFO, data->pathname, data->node_flags,
343 "Converted Package to expected Buffer"));
344 break;
345
346 default: 303 default:
347 return (AE_AML_OPERAND_TYPE); 304 return (AE_AML_OPERAND_TYPE);
348 } 305 }