ACPICA: Utilities: Add _CLS processing
[firefly-linux-kernel-4.4.55.git] / drivers / acpi / acpica / nsxfname.c
index d66c326485d82e769d5c93d4692ac0b02ca277f1..dc0836a9cf179640248dc4b2db60ef41e8227067 100644 (file)
@@ -260,7 +260,7 @@ static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest,
  *              control methods (Such as in the case of a device.)
  *
  * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB,
- * _STA, _ADR, _sx_w, and _sx_d methods.
+ * _CLS, _STA, _ADR, _sx_w, and _sx_d methods.
  *
  * Note: Allocates the return buffer, must be freed by the caller.
  *
@@ -276,11 +276,12 @@ acpi_get_object_info(acpi_handle handle,
        struct acpi_pnp_device_id *hid = NULL;
        struct acpi_pnp_device_id *uid = NULL;
        struct acpi_pnp_device_id *sub = NULL;
+       struct acpi_pnp_device_id *cls = NULL;
        char *next_id_string;
        acpi_object_type type;
        acpi_name name;
        u8 param_count = 0;
-       u8 valid = 0;
+       u16 valid = 0;
        u32 info_size;
        u32 i;
        acpi_status status;
@@ -320,7 +321,7 @@ acpi_get_object_info(acpi_handle handle,
        if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) {
                /*
                 * Get extra info for ACPI Device/Processor objects only:
-                * Run the Device _HID, _UID, _SUB, and _CID methods.
+                * Run the Device _HID, _UID, _SUB, _CID, and _CLS methods.
                 *
                 * Note: none of these methods are required, so they may or may
                 * not be present for this device. The Info->Valid bitfield is used
@@ -363,6 +364,14 @@ acpi_get_object_info(acpi_handle handle,
                             sizeof(struct acpi_pnp_device_id_list));
                        valid |= ACPI_VALID_CID;
                }
+
+               /* Execute the Device._CLS method */
+
+               status = acpi_ut_execute_CLS(node, &cls);
+               if (ACPI_SUCCESS(status)) {
+                       info_size += cls->length;
+                       valid |= ACPI_VALID_CLS;
+               }
        }
 
        /*
@@ -486,6 +495,11 @@ acpi_get_object_info(acpi_handle handle,
                }
        }
 
+       if (cls) {
+               next_id_string = acpi_ns_copy_device_id(&info->class_code,
+                                                       cls, next_id_string);
+       }
+
        /* Copy the fixed-length data */
 
        info->info_size = info_size;
@@ -510,6 +524,9 @@ cleanup:
        if (cid_list) {
                ACPI_FREE(cid_list);
        }
+       if (cls) {
+               ACPI_FREE(cls);
+       }
        return (status);
 }