summaryrefslogtreecommitdiff
path: root/drivers/acpi/acpica/nsrepair.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2009-12-11 10:18:52 +0300
committerLen Brown <len.brown@intel.com>2009-12-16 01:29:36 +0300
commitea7c5ec148044776d5e134e52a3e1aca8d662dbe (patch)
treef1f37cf9b22ea9e48c5b90f1842cfef5a9275111 /drivers/acpi/acpica/nsrepair.c
parentd97659112044c0c77b93c6199eee7ee884eb3cca (diff)
downloadlinux-ea7c5ec148044776d5e134e52a3e1aca8d662dbe.tar.xz
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/nsrepair.c')
-rw-r--r--drivers/acpi/acpica/nsrepair.c43
1 files changed, 41 insertions, 2 deletions
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,
*
* RETURN: Status. AE_OK if conversion was successful.
*
- * DESCRIPTION: Attempt to convert a Integer/String object to a Buffer.
+ * DESCRIPTION: Attempt to convert a Integer/String/Package object to a Buffer.
*
******************************************************************************/
@@ -360,6 +360,10 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
{
union acpi_operand_object *new_object;
acpi_status status;
+ union acpi_operand_object **elements;
+ u32 *dword_buffer;
+ u32 count;
+ u32 i;
switch (original_object->common.type) {
case ACPI_TYPE_INTEGER:
@@ -393,6 +397,40 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
original_object->string.length);
break;
+ case ACPI_TYPE_PACKAGE:
+
+ /* All elements of the Package must be integers */
+
+ elements = original_object->package.elements;
+ count = original_object->package.count;
+
+ for (i = 0; i < count; i++) {
+ if ((!*elements) ||
+ ((*elements)->common.type != ACPI_TYPE_INTEGER)) {
+ return (AE_AML_OPERAND_TYPE);
+ }
+ elements++;
+ }
+
+ /* Create the new buffer object to replace the Package */
+
+ new_object = acpi_ut_create_buffer_object(ACPI_MUL_4(count));
+ if (!new_object) {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Copy the package elements (integers) to the buffer as DWORDs */
+
+ elements = original_object->package.elements;
+ dword_buffer = ACPI_CAST_PTR(u32, new_object->buffer.pointer);
+
+ for (i = 0; i < count; i++) {
+ *dword_buffer = (u32) (*elements)->integer.value;
+ dword_buffer++;
+ elements++;
+ }
+ break;
+
default:
return (AE_AML_OPERAND_TYPE);
}
@@ -441,7 +479,8 @@ acpi_ns_convert_to_package(union acpi_operand_object *original_object,
buffer = original_object->buffer.pointer;
while (length--) {
- *elements = acpi_ut_create_integer_object(*buffer);
+ *elements =
+ acpi_ut_create_integer_object((u64) *buffer);
if (!*elements) {
acpi_ut_remove_reference(new_object);
return (AE_NO_MEMORY);