From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suravee Suthikulanit Subject: Re: [V4 PATCH 1/2] ACPI / scan: Add support for ACPI _CLS device matching Date: Fri, 6 Mar 2015 10:31:59 -0600 Message-ID: <54F9D67F.9040306@amd.com> References: <1425284840-9233-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1425284840-9233-2-git-send-email-Suravee.Suthikulpanit@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1425284840-9233-2-git-send-email-Suravee.Suthikulpanit@amd.com> Sender: linux-ide-owner@vger.kernel.org To: rjw@rjwysocki.net, mika.westerberg@linux.intel.com, lv.zheng@intel.com, hpa@linux.intel.com Cc: lenb@kernel.org, hdegoede@redhat.com, tj@kernel.org, arnd@arndb.de, mjg59@srcf.ucam.org, gregkh@linuxfoundation.org, hanjun.guo@linaro.org, al.stone@linaro.org, graeme.gregory@linaro.org, leo.duran@amd.com, linux-ide@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org List-Id: linux-acpi@vger.kernel.org On 3/2/2015 2:27 AM, Suravee Suthikulpanit wrote: > 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::::..::: > 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[] = { > { "", 0, PCI_CLASS_STORAGE_SATA_AHCI }, > {}, > }; > > In this case, the corresponded entry in modules.alias file would be: > > alias acpi*:010601:* ahci_platform > > Signed-off-by: Suravee Suthikulpanit > --- > drivers/acpi/acpica/acutils.h | 3 ++ > drivers/acpi/acpica/nsxfname.c | 20 +++++++++-- > drivers/acpi/acpica/utids.c | 71 +++++++++++++++++++++++++++++++++++++++ > drivers/acpi/scan.c | 17 ++++++++-- > include/acpi/acnames.h | 1 + > include/acpi/actypes.h | 4 ++- > include/linux/mod_devicetable.h | 1 + > scripts/mod/devicetable-offsets.c | 1 + > scripts/mod/file2alias.c | 13 +++++-- > 9 files changed, 123 insertions(+), 8 deletions(-) > > [....] > > diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h > index b034f10..50d8019 100644 > --- a/include/acpi/actypes.h > +++ b/include/acpi/actypes.h > @@ -1148,7 +1148,7 @@ struct acpi_device_info { > u32 name; /* ACPI object Name */ > acpi_object_type type; /* ACPI object Type */ > u8 param_count; /* If a method, required parameter count */ > - u8 valid; /* Indicates which optional fields are valid */ > + u16 valid; /* Indicates which optional fields are valid */ > u8 flags; /* Miscellaneous info */ > u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ > u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */ > @@ -1158,6 +1158,7 @@ struct acpi_device_info { > struct acpi_pnp_device_id unique_id; /* _UID value */ > struct acpi_pnp_device_id subsystem_id; /* _SUB value */ > struct acpi_pnp_device_id_list compatible_id_list; /* _CID list */ > + struct acpi_pnp_device_id cls; /* _CLS value */ > }; Please disregard this patch. I found out a mistake on my part here. I have sent out V5 here (https://lkml.org/lkml/2015/3/6/24) Thank you, Suravee From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753914AbbCFQc3 (ORCPT ); Fri, 6 Mar 2015 11:32:29 -0500 Received: from mail-bn1bon0148.outbound.protection.outlook.com ([157.56.111.148]:21056 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750843AbbCFQcZ (ORCPT ); Fri, 6 Mar 2015 11:32:25 -0500 X-Greylist: delayed 37233 seconds by postgrey-1.27 at vger.kernel.org; Fri, 06 Mar 2015 11:32:24 EST X-WSS-ID: 0NKSTXM-08-C0T-02 X-M-MSG: Message-ID: <54F9D67F.9040306@amd.com> Date: Fri, 6 Mar 2015 10:31:59 -0600 From: Suravee Suthikulanit User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: , , , CC: , , , , , , , , , , , , , Subject: Re: [V4 PATCH 1/2] ACPI / scan: Add support for ACPI _CLS device matching References: <1425284840-9233-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1425284840-9233-2-git-send-email-Suravee.Suthikulpanit@amd.com> In-Reply-To: <1425284840-9233-2-git-send-email-Suravee.Suthikulpanit@amd.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 Authentication-Results: spf=none (sender IP is 165.204.84.222) smtp.mailfrom=Suravee.Suthikulpanit@amd.com; arndb.de; dkim=none (message not signed) header.d=none; X-Forefront-Antispam-Report: CIP:165.204.84.222;CTRY:US;IPV:NLI;EFV:NLI;BMV:1;SFV:NSPM;SFS:(10019020)(6009001)(428002)(199003)(51704005)(479174004)(377454003)(189002)(24454002)(19580395003)(101416001)(80316001)(19580405001)(2950100001)(83506001)(87936001)(86362001)(2201001)(33656002)(15975445007)(77096005)(65816999)(76176999)(54356999)(87266999)(50466002)(105586002)(92566002)(46102003)(50986999)(106466001)(64126003)(36756003)(65956001)(77156002)(62966003)(23746002)(47776003)(59896002)(120886001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR0201MB1047;H:atltwp02.amd.com;FPR:;SPF:None;MLV:sfv;A:1;MX:1;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0201MB1047; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(5002007);SRVR:BY1PR0201MB1047;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0201MB1047; X-Forefront-PRVS: 05079D8470 X-OriginatorOrg: amd4.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2015 16:32:15.6289 (UTC) X-MS-Exchange-CrossTenant-Id: fde4dada-be84-483f-92cc-e026cbee8e96 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fde4dada-be84-483f-92cc-e026cbee8e96;Ip=[165.204.84.222];Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0201MB1047 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/2/2015 2:27 AM, Suravee Suthikulpanit wrote: > 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::::..::: > 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[] = { > { "", 0, PCI_CLASS_STORAGE_SATA_AHCI }, > {}, > }; > > In this case, the corresponded entry in modules.alias file would be: > > alias acpi*:010601:* ahci_platform > > Signed-off-by: Suravee Suthikulpanit > --- > drivers/acpi/acpica/acutils.h | 3 ++ > drivers/acpi/acpica/nsxfname.c | 20 +++++++++-- > drivers/acpi/acpica/utids.c | 71 +++++++++++++++++++++++++++++++++++++++ > drivers/acpi/scan.c | 17 ++++++++-- > include/acpi/acnames.h | 1 + > include/acpi/actypes.h | 4 ++- > include/linux/mod_devicetable.h | 1 + > scripts/mod/devicetable-offsets.c | 1 + > scripts/mod/file2alias.c | 13 +++++-- > 9 files changed, 123 insertions(+), 8 deletions(-) > > [....] > > diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h > index b034f10..50d8019 100644 > --- a/include/acpi/actypes.h > +++ b/include/acpi/actypes.h > @@ -1148,7 +1148,7 @@ struct acpi_device_info { > u32 name; /* ACPI object Name */ > acpi_object_type type; /* ACPI object Type */ > u8 param_count; /* If a method, required parameter count */ > - u8 valid; /* Indicates which optional fields are valid */ > + u16 valid; /* Indicates which optional fields are valid */ > u8 flags; /* Miscellaneous info */ > u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ > u8 lowest_dstates[5]; /* _sx_w values: 0xFF indicates not valid */ > @@ -1158,6 +1158,7 @@ struct acpi_device_info { > struct acpi_pnp_device_id unique_id; /* _UID value */ > struct acpi_pnp_device_id subsystem_id; /* _SUB value */ > struct acpi_pnp_device_id_list compatible_id_list; /* _CID list */ > + struct acpi_pnp_device_id cls; /* _CLS value */ > }; Please disregard this patch. I found out a mistake on my part here. I have sent out V5 here (https://lkml.org/lkml/2015/3/6/24) Thank you, Suravee