From patchwork Thu May 25 12:05:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 100493 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp718697qge; Thu, 25 May 2017 04:37:40 -0700 (PDT) X-Received: by 10.98.40.198 with SMTP id o189mr45094741pfo.238.1495712259949; Thu, 25 May 2017 04:37:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495712259; cv=none; d=google.com; s=arc-20160816; b=YXvk/mvrp7GutBsKVcOAt4mbS2F6NKhTY4tJD7v/62NRs2o4/1VyFPwnvhreREv+Sa uzOoSCXu1ytprOxsGmov/GKCCgLpX4WVKdwTuQ/wXCcm0/5U3mILoncxB9W5K50wrUX5 Xbb2rs8Dlf6//ilf5Q42ztCa1z3lxPe3t6R67itfqADsGYY2YzPYseAMfZTRsT0lZ0Ed xLGNYnGF8oxFSMCU6FnsAMoeghpvODadhlDx5jK5Jzq3E9/ZhMqloe8XphicAlUisEvI pgTzxGwIvVwgM3As1G9pUuagkJc4ipb5SP9U+xaLWGNB2Z1LUqMgl4OUNfuMIURjwAQu wgsg== 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=PPLlerIP6UmES6xpXu0jJRxqNoh46zVhJD39tOGwhvE=; b=L/vLxYy8ECA/Fk593g8UE2GSjTahuw+mzjBV/3r+NFRLfkyZx0CcG6ckLmkzoL7X+d pRTcKZyEdxE1ozyxCT3FbLFk5++ihW+oYMHjb+JGjoAy8WFLcVKGuNMUl4Me/SrPWKY/ zuNWoQHqwTMI6tShjHe5lOkSk8BpXSFq/zcGyRpzz6gKuu4HvmyBZpeDfymsd8ZLTRyL vvQoO/mILPcykNLhrZydITsHbmibjxgzr6y/SKqL4RMZB6VSNLaVLtro/PjS8BE7cJAb DPJXjCq8jwaij6wFy6tWvCzeaPZDgkLJYVg2OEQ9O+mdM46iAQvtcCS0UxB2KRnA/HP7 Pc3w== 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 l62si2211170pge.309.2017.05.25.04.37.39; Thu, 25 May 2017 04:37:39 -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 S1423939AbdEYLh0 (ORCPT + 25 others); Thu, 25 May 2017 07:37:26 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:6385 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1763946AbdEYLeh (ORCPT ); Thu, 25 May 2017 07:34:37 -0400 Received: from 172.30.72.53 (EHLO DGGEML403-HUB.china.huawei.com) ([172.30.72.53]) by dggrg02-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AOF01642; Thu, 25 May 2017 19:34:34 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEML403-HUB.china.huawei.com (10.3.17.33) with Microsoft SMTP Server id 14.3.301.0; Thu, 25 May 2017 19:34:24 +0800 From: John Garry To: , CC: , , , , , Xiang Chen , John Garry Subject: [PATCH v2 19/22] scsi: hisi_sas: add get_wideport_bitmap_v3_hw() Date: Thu, 25 May 2017 20:05:08 +0800 Message-ID: <1495713911-80476-20-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1495713911-80476-1-git-send-email-john.garry@huawei.com> References: <1495713911-80476-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.0A020206.5926C14B.001C, 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: 6ec8f0d8ecabf5a01886f362295cd183 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 6273368..4169e6a 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -616,6 +616,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. @@ -1721,6 +1733,7 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) .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,