From patchwork Wed May 17 10:49:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 99953 Delivered-To: patch@linaro.org Received: by 10.182.142.97 with SMTP id rv1csp140271obb; Wed, 17 May 2017 03:21:23 -0700 (PDT) X-Received: by 10.98.60.8 with SMTP id j8mr2870116pfa.72.1495016483110; Wed, 17 May 2017 03:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495016483; cv=none; d=google.com; s=arc-20160816; b=a2XDgfMC4xR7ep7lijdxE/qEmvjbez6JCZCLTerxyK4SQ7A5etcYDtEpCYeX0QlVSp WIx33xjI+0Z7cLunCnSg6UmoKv4VNLdlR2cCBep60HdHxt1b4AIsu4d7q2QslGM40s0H eDmxsXwRnqMiROpTqdMpPs9ig+ICwA38yEwf5yR81XMtCpuL49fzGOC3AlNfXr+HUST3 zPN8JlPBcEgqUNHqZ6J1hur3+5kl2KO6/9vOuUR4xC41b8XsnnbHENQvC2AwFayyr5Y5 4Srdss/qzBqi9HfMR+/S1UJKeFBAAeDhbqXcFewHXJYqsLtjmU6tXzV4jtEKkyUF9u68 8HIA== 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=h8Wg69IfYpDHny/LXf4/QXVJnoJNnvaPujuiAkliHBU=; b=n4WCAxAHRbZ0OnZ283qDnrc9T5cU1f3ynCQ2UIyMLK9FaKvqZOzej1Ve1DQJISyJDW tTmGH7oUVG6tFqXJXrBgAbM49V3g+HI2nmDc/EB5TKexAELu2RTpv1Pt2+n7PAp6URes 6yCUOOOC0RlR0bSe4o6jC7O0Q8ryOn0+fPfxC6xc7zzX5YMVn+XDvNL9r39SabzmLR0j OYGFFUEjf2vI0ssKJQ5Df+BXY7LaO8dNVF9P4+vRQTe4Swx3nqcqWrM0C/hYgS5jZGM7 Be0y66c8jdoEl8glwA3nkcGSzRtgzOH05L3k/lWLbIqx/g+V2iLnXojbYi2Lu/hcUTYV LB2A== 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 e70si1656986pfd.278.2017.05.17.03.21.22; Wed, 17 May 2017 03:21:23 -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 S1754567AbdEQKU7 (ORCPT + 25 others); Wed, 17 May 2017 06:20:59 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:6763 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754441AbdEQKTv (ORCPT ); Wed, 17 May 2017 06:19:51 -0400 Received: from 172.30.72.53 (EHLO dggeml406-hub.china.huawei.com) ([172.30.72.53]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AOT12451; Wed, 17 May 2017 18:19:47 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by dggeml406-hub.china.huawei.com (10.3.17.50) with Microsoft SMTP Server id 14.3.301.0; Wed, 17 May 2017 18:19:36 +0800 From: John Garry To: , CC: , , , , , Xiang Chen , John Garry Subject: [PATCH 19/22] scsi: hisi_sas: add get_wideport_bitmap_v3_hw() Date: Wed, 17 May 2017 18:49:54 +0800 Message-ID: <1495018197-120535-20-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1495018197-120535-1-git-send-email-john.garry@huawei.com> References: <1495018197-120535-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.0A020202.591C23C4.0083, 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: 402ac8c38d2e65f2c4b5587574970d3d 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_wide_port_bitmap_v3_hw(). Signed-off-by: John Garry Signed-off-by: Xiang Chen --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 13 +++++++++++++ 1 file changed, 13 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 9d5047e..fa686e5 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -614,6 +614,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. @@ -1558,6 +1570,7 @@ static int hisi_sas_v3_init(struct hisi_hba *hisi_hba) .setup_itct = setup_itct_v3_hw, .max_command_entries = HISI_SAS_COMMAND_ENTRIES_V3_HW, .sl_notify = sl_notify_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, .prep_ssp = prep_ssp_v3_hw,