From patchwork Mon Oct 12 15:20:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 54788 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id EA92E23001 for ; Mon, 12 Oct 2015 15:08:35 +0000 (UTC) Received: by wibzt1 with SMTP id zt1sf16759881wib.0 for ; Mon, 12 Oct 2015 08:08:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=5rE3ctSjXMBTFM/RD9Qk7RyL+hibnm6BfqGvP15ypKA=; b=A+bKBRgPwntbJtlJZnb33ZZsG4GrauCZCw8W1lY0YjF7YeVPlH1L3vR9KPOWu4Vgfj 6aHC8AsyefgBnWbOebSllEsHHiWLYo72nSzzNH23/LG8uKKzY/4E49KIkSMJISKbOhR1 owKS3ex64829ixQXdYq4XgireNVgA5h6RDOosUp7jyyFDvaH+Cw+MjhOoNDRAF5zWFKW frRx8s8Gdi/3UaOsqassqMuLqCIc7XrlCsOKFuPrCUlExW06j8nDyUC7JVAvC7UCCQ6Y S8E+27ZeHp4z0CqP3r1uLi16vcHxdFazaSa/FVxzE2i7/7yscnDuUvo8ViIk012kfUAc yXpw== X-Gm-Message-State: ALoCoQkZ4bkTFRmyZVdCjRGRxTIGnhBHZSiebtedErKOIVeOF1SITKxEGON+7bSiHMgWRsbHyB/3 X-Received: by 10.112.198.33 with SMTP id iz1mr5693179lbc.8.1444662515270; Mon, 12 Oct 2015 08:08:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.211.205 with SMTP id k196ls534056lfg.53.gmail; Mon, 12 Oct 2015 08:08:35 -0700 (PDT) X-Received: by 10.25.91.4 with SMTP id p4mr8150572lfb.95.1444662515119; Mon, 12 Oct 2015 08:08:35 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id wq1si11527627lbb.75.2015.10.12.08.08.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2015 08:08:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbk10 with SMTP id k10so33870337lbb.0 for ; Mon, 12 Oct 2015 08:08:35 -0700 (PDT) X-Received: by 10.112.199.137 with SMTP id jk9mr12817391lbc.86.1444662514795; Mon, 12 Oct 2015 08:08:34 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1600987lbq; Mon, 12 Oct 2015 08:08:33 -0700 (PDT) X-Received: by 10.68.65.70 with SMTP id v6mr35848554pbs.23.1444662513742; Mon, 12 Oct 2015 08:08:33 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id im5si26680790pbd.228.2015.10.12.08.08.33 for ; Mon, 12 Oct 2015 08:08:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752035AbbJLPIc (ORCPT ); Mon, 12 Oct 2015 11:08:32 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:12575 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751986AbbJLPIb (ORCPT ); Mon, 12 Oct 2015 11:08:31 -0400 Received: from 172.24.1.49 (EHLO szxeml432-hub.china.huawei.com) ([172.24.1.49]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CUB61545; Mon, 12 Oct 2015 23:05:21 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by szxeml432-hub.china.huawei.com (10.82.67.209) with Microsoft SMTP Server id 14.3.235.1; Mon, 12 Oct 2015 23:05:04 +0800 From: John Garry To: CC: , , , , , , , , , John Garry Subject: [PATCH 21/25] scsi: hisi_sas: add scan finished and start Date: Mon, 12 Oct 2015 23:20:33 +0800 Message-ID: <1444663237-238302-22-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444663237-238302-1-git-send-email-john.garry@huawei.com> References: <1444663237-238302-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.garry@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add functions for scsi host template scan_finished and scan_start methods. Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 4 ++++ drivers/scsi/hisi_sas/hisi_sas_init.c | 2 ++ drivers/scsi/hisi_sas/hisi_sas_main.c | 24 ++++++++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index be2cdf5..9565a2a 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -165,6 +165,7 @@ struct hisi_hba { int n_phy; + int scan_finished; struct timer_list timer; struct workqueue_struct *wq; @@ -351,6 +352,9 @@ union hisi_sas_command_table { struct hisi_sas_command_table_stp stp; }; +int hisi_sas_scan_finished(struct Scsi_Host *shost, unsigned long time); +void hisi_sas_scan_start(struct Scsi_Host *shost); + void hisi_sas_slot_index_init(struct hisi_hba *hisi_hba); void hisi_sas_phy_init(struct hisi_hba *hisi_hba, int i); int hisi_sas_dev_found(struct domain_device *dev); diff --git a/drivers/scsi/hisi_sas/hisi_sas_init.c b/drivers/scsi/hisi_sas/hisi_sas_init.c index ba64562..caab645 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_init.c +++ b/drivers/scsi/hisi_sas/hisi_sas_init.c @@ -18,6 +18,8 @@ static struct scsi_host_template hisi_sas_sht = { .queuecommand = sas_queuecommand, .target_alloc = sas_target_alloc, .slave_configure = sas_slave_configure, + .scan_finished = hisi_sas_scan_finished, + .scan_start = hisi_sas_scan_start, .change_queue_depth = sas_change_queue_depth, .bios_param = sas_bios_param, .can_queue = 1, diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 91620b0..393d22a 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -435,6 +435,30 @@ found_out: return res; } +void hisi_sas_scan_start(struct Scsi_Host *shost) +{ + struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); + struct hisi_hba *hisi_hba = sha->lldd_ha; + int i; + + for (i = 0; i < hisi_hba->n_phy; ++i) + hisi_sas_bytes_dmaed(hisi_hba, i); + + hisi_hba->scan_finished = 1; +} + +int hisi_sas_scan_finished(struct Scsi_Host *shost, unsigned long time) +{ + struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); + struct hisi_hba *hisi_hba = sha->lldd_ha; + + if (hisi_hba->scan_finished == 0) + return 0; + + sas_drain_work(sha); + return 1; +} + static void hisi_sas_phyup_work(struct hisi_hba *hisi_hba, int phy_no)