]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/utilities/utobject.c
Merge branches 'release', 'acpica', 'bugzilla-10224', 'bugzilla-9772', 'bugzilla...
[linux-2.6-omap-h63xx.git] / drivers / acpi / utilities / utobject.c
index 4696124759e1546b16cde08d99d15bcc4515abb2..e68466de80447c7068ffbd740ff9f265a22421fd 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2007, R. Byron Moore
+ * Copyright (C) 2000 - 2008, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -107,6 +107,7 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name,
        switch (type) {
        case ACPI_TYPE_REGION:
        case ACPI_TYPE_BUFFER_FIELD:
+       case ACPI_TYPE_LOCAL_BANK_FIELD:
 
                /* These types require a secondary object */
 
@@ -144,6 +145,48 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name,
        return_PTR(object);
 }
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_create_package_object
+ *
+ * PARAMETERS:  Count               - Number of package elements
+ *
+ * RETURN:      Pointer to a new Package object, null on failure
+ *
+ * DESCRIPTION: Create a fully initialized package object
+ *
+ ******************************************************************************/
+
+union acpi_operand_object *acpi_ut_create_package_object(u32 count)
+{
+       union acpi_operand_object *package_desc;
+       union acpi_operand_object **package_elements;
+
+       ACPI_FUNCTION_TRACE_U32(ut_create_package_object, count);
+
+       /* Create a new Package object */
+
+       package_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
+       if (!package_desc) {
+               return_PTR(NULL);
+       }
+
+       /*
+        * Create the element array. Count+1 allows the array to be null
+        * terminated.
+        */
+       package_elements = ACPI_ALLOCATE_ZEROED((acpi_size)
+                                               (count + 1) * sizeof(void *));
+       if (!package_elements) {
+               acpi_ut_remove_reference(package_desc);
+               return_PTR(NULL);
+       }
+
+       package_desc->package.count = count;
+       package_desc->package.elements = package_elements;
+       return_PTR(package_desc);
+}
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ut_create_buffer_object
@@ -390,7 +433,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
         * element -- which is legal)
         */
        if (!internal_object) {
-               *obj_length = 0;
+               *obj_length = sizeof(union acpi_object);
                return_ACPI_STATUS(AE_OK);
        }
 
@@ -427,9 +470,8 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
        case ACPI_TYPE_PROCESSOR:
        case ACPI_TYPE_POWER:
 
-               /*
-                * No extra data for these types
-                */
+               /* No extra data for these types */
+
                break;
 
        case ACPI_TYPE_LOCAL_REFERENCE: