aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Garry <john.garry@huawei.com>2016-04-15 09:36:36 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-04-15 16:53:22 -0400
commit685b6d6e678705bf7ff5b7fdd9a904ec7ae9fbe3 (patch)
tree7caa51aca4622f1859cb1fc94541f605f793b4d7
parent54c4042852a85713a7bdd8436cc63762049fbb39 (diff)
hisi_sas: add device and slot alloc hw methods
Add methods to use HW specific versions of functions to allocate slot and device. HW specific methods are permitted to workaround device id vs IPTT collision issue in v2 hw. Signed-off-by: John Garry <john.garry@huawei.com> Reviewed-by: Hannes Reinicke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/hisi_sas/hisi_sas.h3
-rw-r--r--drivers/scsi/hisi_sas/hisi_sas_main.c11
2 files changed, 12 insertions, 2 deletions
diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
index 0978016482c1..d7cab724f203 100644
--- a/drivers/scsi/hisi_sas/hisi_sas.h
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
@@ -133,6 +133,9 @@ struct hisi_sas_hw {
133 int (*hw_init)(struct hisi_hba *hisi_hba); 133 int (*hw_init)(struct hisi_hba *hisi_hba);
134 void (*setup_itct)(struct hisi_hba *hisi_hba, 134 void (*setup_itct)(struct hisi_hba *hisi_hba,
135 struct hisi_sas_device *device); 135 struct hisi_sas_device *device);
136 int (*slot_index_alloc)(struct hisi_hba *hisi_hba, int *slot_idx,
137 struct domain_device *device);
138 struct hisi_sas_device *(*alloc_dev)(struct domain_device *device);
136 void (*sl_notify)(struct hisi_hba *hisi_hba, int phy_no); 139 void (*sl_notify)(struct hisi_hba *hisi_hba, int phy_no);
137 int (*get_free_slot)(struct hisi_hba *hisi_hba, int *q, int *s); 140 int (*get_free_slot)(struct hisi_hba *hisi_hba, int *q, int *s);
138 void (*start_delivery)(struct hisi_hba *hisi_hba); 141 void (*start_delivery)(struct hisi_hba *hisi_hba);
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 097ab4f27a6b..18dd5ea2c721 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -227,7 +227,11 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_hba *hisi_hba,
227 } else 227 } else
228 n_elem = task->num_scatter; 228 n_elem = task->num_scatter;
229 229
230 rc = hisi_sas_slot_index_alloc(hisi_hba, &slot_idx); 230 if (hisi_hba->hw->slot_index_alloc)
231 rc = hisi_hba->hw->slot_index_alloc(hisi_hba, &slot_idx,
232 device);
233 else
234 rc = hisi_sas_slot_index_alloc(hisi_hba, &slot_idx);
231 if (rc) 235 if (rc)
232 goto err_out; 236 goto err_out;
233 rc = hisi_hba->hw->get_free_slot(hisi_hba, &dlvry_queue, 237 rc = hisi_hba->hw->get_free_slot(hisi_hba, &dlvry_queue,
@@ -417,7 +421,10 @@ static int hisi_sas_dev_found(struct domain_device *device)
417 struct hisi_sas_device *sas_dev; 421 struct hisi_sas_device *sas_dev;
418 struct device *dev = &hisi_hba->pdev->dev; 422 struct device *dev = &hisi_hba->pdev->dev;
419 423
420 sas_dev = hisi_sas_alloc_dev(device); 424 if (hisi_hba->hw->alloc_dev)
425 sas_dev = hisi_hba->hw->alloc_dev(device);
426 else
427 sas_dev = hisi_sas_alloc_dev(device);
421 if (!sas_dev) { 428 if (!sas_dev) {
422 dev_err(dev, "fail alloc dev: max support %d devices\n", 429 dev_err(dev, "fail alloc dev: max support %d devices\n",
423 HISI_SAS_MAX_DEVICES); 430 HISI_SAS_MAX_DEVICES);