• S
    ACPI / scan: Add support for ACPI _CLS device matching · 26095a01
    Suthikulpanit, Suravee 提交于
    Device drivers typically use ACPI _HIDs/_CIDs listed in struct device_driver
    acpi_match_table to match devices. However, for generic drivers, we do not
    want to list _HID for all supported devices. Also, certain classes of devices
    do not have _CID (e.g. SATA, USB). Instead, we can leverage ACPI _CLS,
    which specifies PCI-defined class code (i.e. base-class, subclass and
    programming interface). This patch adds support for matching ACPI devices using
    the _CLS method.
    
    To support loadable module, current design uses _HID or _CID to match device's
    modalias. With the new way of matching with _CLS this would requires modification
    to the current ACPI modalias key to include _CLS. This patch appends PCI-defined
    class-code to the existing ACPI modalias as following.
    
        acpi:<HID>:<CID1>:<CID2>:..:<CIDn>:<bbsspp>:
    E.g:
        # cat /sys/devices/platform/AMDI0600:00/modalias
        acpi:AMDI0600:010601:
    
    where bb is th base-class code, ss is te sub-class code, and pp is the
    programming interface code
    
    Since there would not be _HID/_CID in the ACPI matching table of the driver,
    this patch adds a field to acpi_device_id to specify the matching _CLS.
    
        static const struct acpi_device_id ahci_acpi_match[] = {
            { ACPI_DEVICE_CLASS(PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff) },
            {},
        };
    
    In this case, the corresponded entry in modules.alias file would be:
    
        alias acpi*:010601:* ahci_platform
    Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com>
    Reviewed-by: NHanjun Guo <hanjun.guo@linaro.org>
    Signed-off-by: NSuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
    Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
    26095a01
acpi.h 25.2 KB