From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754282AbdEQNhz (ORCPT ); Wed, 17 May 2017 09:37:55 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:6340 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751155AbdEQNhw (ORCPT ); Wed, 17 May 2017 09:37:52 -0400 Subject: Re: [PATCH 09/22] scsi: hisi_sas: retrieve SAS address for pci-based controller To: Arnd Bergmann References: <1495018197-120535-1-git-send-email-john.garry@huawei.com> <1495018197-120535-10-git-send-email-john.garry@huawei.com> CC: "James E.J. Bottomley" , "Martin K. Petersen" , John Garry , , , "Linux Kernel Mailing List" From: John Garry Message-ID: Date: Wed, 17 May 2017 14:37:23 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.181.157] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.591C5223.02A4,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 96d93076d245b1094211246330301cae Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/05/2017 13:37, Arnd Bergmann wrote: > On Wed, May 17, 2017 at 12:49 PM, John Garry wrote: >> > For a pci-based controller, retrieve the SAS address from the >> > ACPI tables. >> > >> > The retrieval is based on the ACPI device node name. Sample is >> > as follows: >> > Scope(_SB) >> > { >> > Device(SAS0) { >> > Name(_HID, "HISI0163") >> > Name (_DSD, Package () { >> > ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), >> > Package () { >> > Package (2) {"sas-addr", Package() {0x50, 0x01, 0x88, 0x20, 0x16, 00, 00, 0x00}}, >> > } >> > }) >> > } >> > } >> > >> > If the ACPI node or node property is not available, then we fall >> > back on a default address. >> > >> > Signed-off-by: John Garry > Since this uses the _DSD information that was introduced for compatibility > between device tree and ACPI based data, why not write the code so that > it can work for both? > > Ideally this should just look up the property for pci_dev->fwnode, but I'm > not entirely sure if this works the same way on ACPI and DT today. > Hi Arnd, There is no relation at all between the pci device and the ACPI DSDT, apart from the fact that the device node name is known by the driver, that being "SAS0". I am not 100% comfortable with this, as we are introducing some sort of device indexing in the driver. Please note that Cavium did something similar on their thunderx network driver: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/cavium/thunder/thunder_bgx.c?h=v4.12-rc1#n1162 As for your suggestion, in theory it could be ok to have a pci_dev->fwnode, and this would work for Unified Device Properties Interface (if that is indeed what you mean). But how to create/match this fwnode? Thanks, John > Arnd