Thread (50 messages) 50 messages, 7 authors, 2015-10-20
STALE3933d
Revisions (5)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]
  5. v5 [diff vs current]

[PATCH 21/25] scsi: hisi_sas: add scan finished and start

From: John Garry <hidden>
Date: 2015-10-12 15:08:31
Also in: linux-scsi
Subsystem: hisilicon sas controller, scsi subsystem, the rest · Maintainers: Yihang Li, "James E.J. Bottomley", "Martin K. Petersen", Linus Torvalds

Add functions for scsi host template scan_finished
and scan_start methods.

Signed-off-by: John Garry <redacted>
---
 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)
-- 
1.9.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help