From patchwork Tue Oct 24 15:51:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 116970 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5918083qgn; Tue, 24 Oct 2017 08:10:10 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TOWwKfM+n7FqmJ3UP8NN4BwY0TtbQ9cgGzIztfYpfrN5IalB5M8W8CX4SegJs+NVL3cu1V X-Received: by 10.99.110.196 with SMTP id j187mr12817544pgc.393.1508857810451; Tue, 24 Oct 2017 08:10:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508857810; cv=none; d=google.com; s=arc-20160816; b=Anhek1uL7bepm8ikMyiPz5tw4T851ri5XVje2MgQQf35KfKn2DUG288SAwkVig8xsQ el+V1vhTSPPe8e4g7mz4zKIYSf7XGVJr4ZIV8ixZWPl5nuK/TBsiUczBh8GhO1B3svi7 DcM/JbCG8zoGwjOE56tC8dm925abaALuhp7SedvKsU5eEeVPqYOIxfPelODVh2k+wijh HNBmeZqTrKkkLAp4yddrsqaMb2EOBj2Mj+0KoA2LcfPiEPzRSOUYv82EpaslEg9mxBuR gWzCEtDh05pboQO90fRb/J7ltLPnPhPVxEMRxRV9iPRRzpj29131YLJRZrSF+RRf0gF3 KjVQ== 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=QfQ+FPI7av7rdMdGVTX6afHxRrwX7LFNUe5jovh8/mo=; b=s5jihhVslpfpex6BGW982b/0ZG/Em1EFe7es+RCVuyyBslq1enSh0+UpGqRczu8IS/ BwQH8/GZzwL0MhZAa/uczH6rxPPnHGrcZbN38JeG9RloEzR1FcKbg1p5dA1FRut4EyfD j4D3v4LMIt2MwLU7q86rgfBESkV9odj3fzGBcCwPg0hB6yqzep21w5y175JtVf5elx8b zYCHPUOrpkZN/FjVh9SUp6QnDoLoodQuqQQpthibi3Zei21MDSv7rY/alu2UKqlCLW5A fBRSNARI9jls4UFr2WqMiBOlzWKdQrIMhC0gsyt5uKaVLx+FUnS8ujUIIellwO4SyUvD vxew== 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 125si328287pff.574.2017.10.24.08.10.10; Tue, 24 Oct 2017 08:10:10 -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 S932317AbdJXPKJ (ORCPT + 27 others); Tue, 24 Oct 2017 11:10:09 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:9041 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751750AbdJXPIw (ORCPT ); Tue, 24 Oct 2017 11:08:52 -0400 Received: from 172.30.72.58 (EHLO DGGEMS406-HUB.china.huawei.com) ([172.30.72.58]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DJW29915; Tue, 24 Oct 2017 23:05:29 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.361.1; Tue, 24 Oct 2017 23:05:19 +0800 From: John Garry To: , CC: , , , , Xiaofei Tan , John Garry Subject: [PATCH 14/19] scsi: hisi_sas: add v3 hw DFX feature Date: Tue, 24 Oct 2017 23:51:44 +0800 Message-ID: <1508860309-212397-15-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508860309-212397-1-git-send-email-john.garry@huawei.com> References: <1508860309-212397-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.0A0B0207.59EF56BA.0053, 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: aa79d9f0b4e4f4506528f382178f94d0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaofei Tan Realise get_events() to add DFX feature for v3 hw. Just like v2 hw, We support the following errors: - loss_of_dword_sync_count - invalid_dword_count - phy_reset_problem_count - running_disparity_error_count Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 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 5fbd121..818bd575 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -172,6 +172,10 @@ #define DMA_RX_STATUS (PORT_BASE + 0x2e8) #define DMA_RX_STATUS_BUSY_OFF 0 #define DMA_RX_STATUS_BUSY_MSK (0x1 << DMA_RX_STATUS_BUSY_OFF) +#define ERR_CNT_DWS_LOST (PORT_BASE + 0x380) +#define ERR_CNT_RESET_PROB (PORT_BASE + 0x384) +#define ERR_CNT_INVLD_DW (PORT_BASE + 0x390) +#define ERR_CNT_DISP_ERR (PORT_BASE + 0x398) #define DEFAULT_ITCT_HW 2048 /* reset value, not reprogrammed */ #if (HISI_SAS_MAX_DEVICES > DEFAULT_ITCT_HW) @@ -1742,6 +1746,31 @@ static u32 get_phys_state_v3_hw(struct hisi_hba *hisi_hba) return hisi_sas_read32(hisi_hba, PHY_STATE); } +static void phy_get_events_v3_hw(struct hisi_hba *hisi_hba, int phy_no) +{ + struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; + struct asd_sas_phy *sas_phy = &phy->sas_phy; + struct sas_phy *sphy = sas_phy->phy; + u32 reg_value; + + /* loss dword sync */ + reg_value = hisi_sas_phy_read32(hisi_hba, phy_no, ERR_CNT_DWS_LOST); + sphy->loss_of_dword_sync_count += reg_value; + + /* phy reset problem */ + reg_value = hisi_sas_phy_read32(hisi_hba, phy_no, ERR_CNT_RESET_PROB); + sphy->phy_reset_problem_count += reg_value; + + /* invalid dword */ + reg_value = hisi_sas_phy_read32(hisi_hba, phy_no, ERR_CNT_INVLD_DW); + sphy->invalid_dword_count += reg_value; + + /* disparity err */ + reg_value = hisi_sas_phy_read32(hisi_hba, phy_no, ERR_CNT_DISP_ERR); + sphy->running_disparity_error_count += reg_value; + +} + static int soft_reset_v3_hw(struct hisi_hba *hisi_hba) { struct device *dev = hisi_hba->dev; @@ -1794,6 +1823,7 @@ static int soft_reset_v3_hw(struct hisi_hba *hisi_hba) .dereg_device = dereg_device_v3_hw, .soft_reset = soft_reset_v3_hw, .get_phys_state = get_phys_state_v3_hw, + .get_events = phy_get_events_v3_hw, }; static struct Scsi_Host *