From patchwork Wed May 31 14:33:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 100769 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp340333qge; Wed, 31 May 2017 07:06:49 -0700 (PDT) X-Received: by 10.101.86.12 with SMTP id l12mr32025605pgs.114.1496239609046; Wed, 31 May 2017 07:06:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496239609; cv=none; d=google.com; s=arc-20160816; b=Qha929K8BL9M6lygPOvuHKGuySOREfJKuECBensQOWne1uf75TnwWX392kVoXQurpw rbQPLcA2nXSeiM4jKoTvFSowQIdXx6mNjkvP/77i+gck2+7hO6tPTz/Al+n3DxoYnVP9 4cL1/nTQ621GQJ9yD2irRwFC2122kwlSZC158mvRj3KLgj8DdnKjJiY1GitYEly/KZel k+eHHRs0CpLOEOjvoAaZTeEQ+XJnBKrw3LKPWf2PCAaaQ2vNcSrFGwLMJGNJBLMmqQnG OeTW5F3TuFLzwe9ea57bajEp2jevSSESRF1fONSe07PIWfpB/k83lLuHe0LbWllvqTLi liNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=wB3+axlurJtBFSkfr5za8euWKCTaxSgDZcELK4CQ5Os=; b=X25QAz2jh6HqDLcaqgNmJAq+XnxbAxeSIQYo9dJU7uDkduyCLG0uSLjGeOUROkH9VA AxCsXky3h538OZAU8ylSSxYOHJNJ6JdYlsUNp1z5yeb9UXNY0rgJGWf07d0DmDFGvgl4 yH/eeNhf3hJMzX50Ny14ARpktJJWF48tRuxjEKr7utnMiMiEdG347ndKU1m7xst/IucR vq2hDH27Yq4V1zgc2nDKUkafd1hz51SNplLazb6uh6xK4JzdqUrhlkxg7UP9I3g915VA A/ALKEH2fIvznqaZOA7r/SHsWiBJwdZRpfhsaa0ux3mfV4cmKZITmFrb6N+3+En9u8A4 ajVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si47115472pln.77.2017.05.31.07.06.48; Wed, 31 May 2017 07:06:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751548AbdEaOGV (ORCPT + 25 others); Wed, 31 May 2017 10:06:21 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:6851 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751441AbdEaOF2 (ORCPT ); Wed, 31 May 2017 10:05:28 -0400 Received: from 172.30.72.53 (EHLO dggeml405-hub.china.huawei.com) ([172.30.72.53]) by dggrg02-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AON26174; Wed, 31 May 2017 22:05:13 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by dggeml405-hub.china.huawei.com (10.3.17.49) with Microsoft SMTP Server id 14.3.301.0; Wed, 31 May 2017 22:05:03 +0800 From: John Garry To: , CC: , , , , , Xiang Chen , John Garry Subject: [PATCH v3 20/23] scsi: hisi_sas: add get_wideport_bitmap_v3_hw() Date: Wed, 31 May 2017 22:33:12 +0800 Message-ID: <1496241195-217678-21-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1496241195-217678-1-git-send-email-john.garry@huawei.com> References: <1496241195-217678-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.592ECD9B.0039, 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: 82f96cb5f54d656f05f6fe041073c1a9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen Add code for interface get_wideport_bitmap. Signed-off-by: John Garry Signed-off-by: Xiang Chen --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 7bb9d2a..f71f1ba 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -613,6 +613,18 @@ static void sl_notify_v3_hw(struct hisi_hba *hisi_hba, int phy_no) hisi_sas_phy_write32(hisi_hba, phy_no, SL_CONTROL, sl_control); } +static int get_wideport_bitmap_v3_hw(struct hisi_hba *hisi_hba, int port_id) +{ + int i, bitmap = 0; + u32 phy_port_num_ma = hisi_sas_read32(hisi_hba, PHY_PORT_NUM_MA); + + for (i = 0; i < hisi_hba->n_phy; i++) + if (((phy_port_num_ma >> (i * 4)) & 0xf) == port_id) + bitmap |= 1 << i; + + return bitmap; +} + /** * The callpath to this function and upto writing the write * queue pointer should be safe from interruption. @@ -1555,6 +1567,7 @@ static int hisi_sas_v3_init(struct hisi_hba *hisi_hba) .hw_init = hisi_sas_v3_init, .setup_itct = setup_itct_v3_hw, .max_command_entries = HISI_SAS_COMMAND_ENTRIES_V3_HW, + .get_wideport_bitmap = get_wideport_bitmap_v3_hw, .complete_hdr_size = sizeof(struct hisi_sas_complete_v3_hdr), .free_device = free_device_v3_hw, .sl_notify = sl_notify_v3_hw, @@ -1730,6 +1743,7 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) pci_disable_device(pdev); } + enum { /* instances of the controller */ hip08,