From patchwork Thu May 25 12:04:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 100484 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp717817qge; Thu, 25 May 2017 04:35:01 -0700 (PDT) X-Received: by 10.84.254.70 with SMTP id a6mr49822254pln.64.1495712101166; Thu, 25 May 2017 04:35:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495712101; cv=none; d=google.com; s=arc-20160816; b=G5BhSWDxOzAMV7taTG6rHIiDl3A6S39fJ3HVxPYH3PfbV75YOT4sReu3sUj0coFgyt M5zfQbbU0s5OB4BUQCJspOHpO6gcau9LUuSQp8f2D9D4MJwh2XDXOBw2n4hY0iM0GDfe SonKSzMSFaTob1d79z9X0aU/GKUJpA9hglRXgBMxzYdBAGSuAZ/RH3RE4ev7ovN1XCa4 QqzEemr2o6kDnuXGvgs5SHftNUrBVwJTlmgg+qE/MP2SAy+JDYmYDYN0OhhnqPElFHeu 3ej8+1+CPT915JG1Ow+mJV1Ut+t8jzwBJZXudcESoAiMnR0DHH+EspVU+fXu/+Iajir+ oNqg== 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=XqF94G38ovwYIUcbek+oXgwPNBhipEJI7E1KB1fbHQY=; b=AWs85ayArbwMT4PHjaC2QjLN0Mbectxfb7TZeif8Eo3eWy2se3LLBii7g4ftBvDGGu thBAQa7bEDYUVXRIyXdA62Cdbu2qTnLu5jS6IUVY/FBitvvHDSYw3iFguoEnGGvxo6pC 9ovKuArwT1+RW/DnPiAj7/xcUtMSkb5rRSTYZTQsO9tmetGO6ktEqfKSm+kSggi3kY/a LWbNom9TC4Hfd7TXn5GvRumOvTQbdLPqSeWqSxPFRJ/QTjnxQPyTWrIeyvRXzp93vwY2 LauYz+m+OJ2z19uPOz38+0fcuZCE+jhpT2bRhwJrv9b9XAtZKlfpb1fIpmFfGvnqdgip aG2g== 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 n34si27636953pld.268.2017.05.25.04.35.00; Thu, 25 May 2017 04:35:01 -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 S1764535AbdEYLeq (ORCPT + 25 others); Thu, 25 May 2017 07:34:46 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:6820 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1763503AbdEYLec (ORCPT ); Thu, 25 May 2017 07:34:32 -0400 Received: from 172.30.72.55 (EHLO DGGEML403-HUB.china.huawei.com) ([172.30.72.55]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id APE94319; Thu, 25 May 2017 19:34:28 +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:18 +0800 From: John Garry To: , CC: , , , , , Xiang Chen , John Garry Subject: [PATCH v2 04/22] scsi: hisi_sas: relocate sata_done_v2_hw() Date: Thu, 25 May 2017 20:04:53 +0800 Message-ID: <1495713911-80476-5-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.0A090206.5926C145.00C1, 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: 55070718844c03292957b06bdac53e6f Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen Relocate get_ata_protocol() to a common location, as future hw versions will require it. Also rename with "hisi_sas_" prefix for consistency. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 2 ++ drivers/scsi/hisi_sas/hisi_sas_main.c | 15 +++++++++++++++ drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 18 ++---------------- 3 files changed, 19 insertions(+), 16 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index 02ec10b..d0c0844 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -357,6 +357,8 @@ struct hisi_sas_command_table_ssp { extern u8 hisi_sas_get_ata_protocol(u8 cmd, int direction); extern struct hisi_sas_port *to_hisi_sas_port(struct asd_sas_port *sas_port); +extern void hisi_sas_sata_done(struct sas_task *task, + struct hisi_sas_slot *slot); extern int hisi_sas_probe(struct platform_device *pdev, const struct hisi_sas_hw *ops); extern int hisi_sas_remove(struct platform_device *pdev); diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 8fce20b..3f2bb8e 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -88,6 +88,21 @@ u8 hisi_sas_get_ata_protocol(u8 cmd, int direction) } EXPORT_SYMBOL_GPL(hisi_sas_get_ata_protocol); +void hisi_sas_sata_done(struct sas_task *task, + struct hisi_sas_slot *slot) +{ + struct task_status_struct *ts = &task->task_status; + struct ata_task_resp *resp = (struct ata_task_resp *)ts->buf; + struct dev_to_host_fis *d2h = slot->status_buffer + + sizeof(struct hisi_sas_err_record); + + resp->frame_len = sizeof(struct dev_to_host_fis); + memcpy(&resp->ending_fis[0], d2h, sizeof(struct dev_to_host_fis)); + + ts->buf_valid_size = sizeof(*resp); +} +EXPORT_SYMBOL_GPL(hisi_sas_sata_done); + static struct hisi_hba *dev_to_hisi_hba(struct domain_device *device) { return device->port->ha->lldd_ha; diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index 397f01e..51140dc 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -1679,20 +1679,6 @@ static int prep_ssp_v2_hw(struct hisi_hba *hisi_hba, return 0; } -static void sata_done_v2_hw(struct hisi_hba *hisi_hba, struct sas_task *task, - struct hisi_sas_slot *slot) -{ - struct task_status_struct *ts = &task->task_status; - struct ata_task_resp *resp = (struct ata_task_resp *)ts->buf; - struct dev_to_host_fis *d2h = slot->status_buffer + - sizeof(struct hisi_sas_err_record); - - resp->frame_len = sizeof(struct dev_to_host_fis); - memcpy(&resp->ending_fis[0], d2h, sizeof(struct dev_to_host_fis)); - - ts->buf_valid_size = sizeof(*resp); -} - #define TRANS_TX_ERR 0 #define TRANS_RX_ERR 1 #define DMA_TX_ERR 2 @@ -2185,7 +2171,7 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba, break; } } - sata_done_v2_hw(hisi_hba, task, slot); + hisi_sas_sata_done(task, slot); } break; default: @@ -2313,7 +2299,7 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba, case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP: { ts->stat = SAM_STAT_GOOD; - sata_done_v2_hw(hisi_hba, task, slot); + hisi_sas_sata_done(task, slot); break; } default: