aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
diff options
context:
space:
mode:
authorJohn Garry <john.garry@huawei.com>2016-04-15 09:36:38 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-04-15 16:53:23 -0400
commitb2bdaf2bde16537cbdbd5376acecc555f428603f (patch)
treedc61537eb83e8dfa73cd49641592ade61d73fb77 /drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
parent330fa7f3140481463eb4956c38b9a44dfeee52b9 (diff)
hisi_sas: add alloc_dev_quirk_v2_hw()
Add custom version of function to allocate device, alloc_dev_quirk_v2_hw(). For sata devices the device id bit0 should be 0. 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>
Diffstat (limited to 'drivers/scsi/hisi_sas/hisi_sas_v2_hw.c')
-rw-r--r--drivers/scsi/hisi_sas/hisi_sas_v2_hw.c30
1 files changed, 30 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 f2966d8cde07..bbe98ecea0bc 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -492,6 +492,35 @@ slot_index_alloc_quirk_v2_hw(struct hisi_hba *hisi_hba, int *slot_idx,
492 return 0; 492 return 0;
493} 493}
494 494
495static struct
496hisi_sas_device *alloc_dev_quirk_v2_hw(struct domain_device *device)
497{
498 struct hisi_hba *hisi_hba = device->port->ha->lldd_ha;
499 struct hisi_sas_device *sas_dev = NULL;
500 int i, sata_dev = dev_is_sata(device);
501
502 spin_lock(&hisi_hba->lock);
503 for (i = 0; i < HISI_SAS_MAX_DEVICES; i++) {
504 /*
505 * SATA device id bit0 should be 0
506 */
507 if (sata_dev && (i & 1))
508 continue;
509 if (hisi_hba->devices[i].dev_type == SAS_PHY_UNUSED) {
510 hisi_hba->devices[i].device_id = i;
511 sas_dev = &hisi_hba->devices[i];
512 sas_dev->dev_status = HISI_SAS_DEV_NORMAL;
513 sas_dev->dev_type = device->dev_type;
514 sas_dev->hisi_hba = hisi_hba;
515 sas_dev->sas_device = device;
516 break;
517 }
518 }
519 spin_unlock(&hisi_hba->lock);
520
521 return sas_dev;
522}
523
495static void config_phy_opt_mode_v2_hw(struct hisi_hba *hisi_hba, int phy_no) 524static void config_phy_opt_mode_v2_hw(struct hisi_hba *hisi_hba, int phy_no)
496{ 525{
497 u32 cfg = hisi_sas_phy_read32(hisi_hba, phy_no, PHY_CFG); 526 u32 cfg = hisi_sas_phy_read32(hisi_hba, phy_no, PHY_CFG);
@@ -2195,6 +2224,7 @@ static const struct hisi_sas_hw hisi_sas_v2_hw = {
2195 .hw_init = hisi_sas_v2_init, 2224 .hw_init = hisi_sas_v2_init,
2196 .setup_itct = setup_itct_v2_hw, 2225 .setup_itct = setup_itct_v2_hw,
2197 .slot_index_alloc = slot_index_alloc_quirk_v2_hw, 2226 .slot_index_alloc = slot_index_alloc_quirk_v2_hw,
2227 .alloc_dev = alloc_dev_quirk_v2_hw,
2198 .sl_notify = sl_notify_v2_hw, 2228 .sl_notify = sl_notify_v2_hw,
2199 .get_wideport_bitmap = get_wideport_bitmap_v2_hw, 2229 .get_wideport_bitmap = get_wideport_bitmap_v2_hw,
2200 .free_device = free_device_v2_hw, 2230 .free_device = free_device_v2_hw,