aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Garry <john.garry@huawei.com>2016-04-15 09:36:37 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-04-15 16:53:23 -0400
commit330fa7f3140481463eb4956c38b9a44dfeee52b9 (patch)
tree02ce9d7eaac7fa1ca24a0fe606844df49e38c691
parent685b6d6e678705bf7ff5b7fdd9a904ec7ae9fbe3 (diff)
hisi_sas: add slot_index_alloc_quirk_v2_hw()
Add v2 hw custom function slot_index_alloc_quirk_v2_hw(). SAS devices should have IPTT bit0 equal to 1. 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_v2_hw.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index 4276594a14c8..f2966d8cde07 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -465,6 +465,33 @@ static u32 hisi_sas_phy_read32(struct hisi_hba *hisi_hba,
465 return readl(regs); 465 return readl(regs);
466} 466}
467 467
468/* This function needs to be protected from pre-emption. */
469static int
470slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, int *slot_idx,
471 struct domain_device *device)
472{
473 unsigned int index = 0;
474 void *bitmap = hisi_hba->slot_index_tags;
475 int sata_dev = dev_is_sata(device);
476
477 while (1) {
478 index = find_next_zero_bit(bitmap, hisi_hba->slot_index_count,
479 index);
480 if (index >= hisi_hba->slot_index_count)
481 return -SAS_QUEUE_FULL;
482 /*
483 * SAS IPTT bit0 should be 1
484 */
485 if (sata_dev || (index & 1))
486 break;
487 index++;
488 }
489
490 set_bit(index, bitmap);
491 *slot_idx = index;
492 return 0;
493}
494
468static void config_phy_opt_mode_v2_hw(struct hisi_hba *hisi_hba, int phy_no) 495static void config_phy_opt_mode_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
469{ 496{
470 u32 cfg = hisi_sas_phy_read32(hisi_hba, phy_no, PHY_CFG); 497 u32 cfg = hisi_sas_phy_read32(hisi_hba, phy_no, PHY_CFG);
@@ -2167,6 +2194,7 @@ static int hisi_sas_v2_init(struct hisi_hba *hisi_hba)
2167static const struct hisi_sas_hw hisi_sas_v2_hw = { 2194static const struct hisi_sas_hw hisi_sas_v2_hw = {
2168 .hw_init = hisi_sas_v2_init, 2195 .hw_init = hisi_sas_v2_init,
2169 .setup_itct = setup_itct_v2_hw, 2196 .setup_itct = setup_itct_v2_hw,
2197 .slot_index_alloc = slot_index_alloc_quirk_v2_hw,
2170 .sl_notify = sl_notify_v2_hw, 2198 .sl_notify = sl_notify_v2_hw,
2171 .get_wideport_bitmap = get_wideport_bitmap_v2_hw, 2199 .get_wideport_bitmap = get_wideport_bitmap_v2_hw,
2172 .free_device = free_device_v2_hw, 2200 .free_device = free_device_v2_hw,