aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message/fusion')
-rw-r--r--drivers/message/fusion/mptbase.h5
-rw-r--r--drivers/message/fusion/mptfc.c33
-rw-r--r--drivers/message/fusion/mptsas.c24
-rw-r--r--drivers/message/fusion/mptscsih.c19
-rw-r--r--drivers/message/fusion/mptspi.c4
5 files changed, 30 insertions, 55 deletions
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 2b9c8b5522fa..9b58234add36 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -347,10 +347,7 @@ typedef struct _VirtTarget {
347} VirtTarget; 347} VirtTarget;
348 348
349typedef struct _VirtDevice { 349typedef struct _VirtDevice {
350 VirtTarget *vtarget; 350 VirtTarget *vtarget;
351 u8 ioc_id;
352 u8 bus_id;
353 u8 target_id;
354 u8 configured_lun; 351 u8 configured_lun;
355 u32 lun; 352 u32 lun;
356} VirtDevice; 353} VirtDevice;
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index 5a30621051c3..b343f2a68b1c 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -349,24 +349,6 @@ mptfc_generate_rport_ids(FCDevicePage0_t *pg0, struct fc_rport_identifiers *rid)
349} 349}
350 350
351static void 351static void
352mptfc_remap_sdev(struct scsi_device *sdev, void *arg)
353{
354 VirtDevice *vdev;
355 VirtTarget *vtarget;
356 struct scsi_target *starget;
357
358 starget = scsi_target(sdev);
359 if (starget->hostdata == arg) {
360 vtarget = arg;
361 vdev = sdev->hostdata;
362 if (vdev) {
363 vdev->bus_id = vtarget->bus_id;
364 vdev->target_id = vtarget->target_id;
365 }
366 }
367}
368
369static void
370mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0) 352mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0)
371{ 353{
372 struct fc_rport_identifiers rport_ids; 354 struct fc_rport_identifiers rport_ids;
@@ -423,8 +405,6 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0)
423 if (vtarget) { 405 if (vtarget) {
424 vtarget->target_id = pg0->CurrentTargetID; 406 vtarget->target_id = pg0->CurrentTargetID;
425 vtarget->bus_id = pg0->CurrentBus; 407 vtarget->bus_id = pg0->CurrentBus;
426 starget_for_each_device(ri->starget,
427 vtarget,mptfc_remap_sdev);
428 } 408 }
429 ri->remap_needed = 0; 409 ri->remap_needed = 0;
430 } 410 }
@@ -432,7 +412,7 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0)
432 "mptfc_reg_dev.%d: %x, %llx / %llx, tid %d, " 412 "mptfc_reg_dev.%d: %x, %llx / %llx, tid %d, "
433 "rport tid %d, tmo %d\n", 413 "rport tid %d, tmo %d\n",
434 ioc->name, 414 ioc->name,
435 oc->sh->host_no, 415 ioc->sh->host_no,
436 pg0->PortIdentifier, 416 pg0->PortIdentifier,
437 pg0->WWNN, 417 pg0->WWNN,
438 pg0->WWPN, 418 pg0->WWPN,
@@ -553,23 +533,26 @@ mptfc_slave_alloc(struct scsi_device *sdev)
553 } 533 }
554 534
555 vdev->vtarget = vtarget; 535 vdev->vtarget = vtarget;
556 vdev->ioc_id = hd->ioc->id;
557 vdev->lun = sdev->lun; 536 vdev->lun = sdev->lun;
558 vdev->target_id = vtarget->target_id;
559 vdev->bus_id = vtarget->bus_id;
560 537
561 spin_unlock_irqrestore(&hd->ioc->fc_rport_lock,flags); 538 spin_unlock_irqrestore(&hd->ioc->fc_rport_lock,flags);
562 539
563 vtarget->num_luns++; 540 vtarget->num_luns++;
564 541
542#ifdef DMPT_DEBUG_FC
543 {
544 struct mptfc_rport_info *ri;
545 ri = *((struct mptfc_rport_info **)rport->dd_data);
565 dfcprintk ((MYIOC_s_INFO_FMT 546 dfcprintk ((MYIOC_s_INFO_FMT
566 "mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, " 547 "mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, "
567 "CurrentTargetID %d, %x %llx %llx\n", 548 "CurrentTargetID %d, %x %llx %llx\n",
568 ioc->name, 549 hd->ioc->name,
569 sdev->host->host_no, 550 sdev->host->host_no,
570 vtarget->num_luns, 551 vtarget->num_luns,
571 sdev->id, ri->pg0.CurrentTargetID, 552 sdev->id, ri->pg0.CurrentTargetID,
572 ri->pg0.PortIdentifier, ri->pg0.WWPN, ri->pg0.WWNN)); 553 ri->pg0.PortIdentifier, ri->pg0.WWPN, ri->pg0.WWNN));
554 }
555#endif
573 556
574 return 0; 557 return 0;
575} 558}
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index ba93ef13a41e..ba555a60bf7f 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -350,6 +350,7 @@ mptsas_slave_alloc(struct scsi_device *sdev)
350 VirtTarget *vtarget; 350 VirtTarget *vtarget;
351 VirtDevice *vdev; 351 VirtDevice *vdev;
352 struct scsi_target *starget; 352 struct scsi_target *starget;
353 u32 target_id;
353 int i; 354 int i;
354 355
355 vdev = kzalloc(sizeof(VirtDevice), GFP_KERNEL); 356 vdev = kzalloc(sizeof(VirtDevice), GFP_KERNEL);
@@ -358,10 +359,10 @@ mptsas_slave_alloc(struct scsi_device *sdev)
358 hd->ioc->name, sizeof(VirtDevice)); 359 hd->ioc->name, sizeof(VirtDevice));
359 return -ENOMEM; 360 return -ENOMEM;
360 } 361 }
361 vdev->ioc_id = hd->ioc->id;
362 sdev->hostdata = vdev; 362 sdev->hostdata = vdev;
363 starget = scsi_target(sdev); 363 starget = scsi_target(sdev);
364 vtarget = starget->hostdata; 364 vtarget = starget->hostdata;
365 vtarget->ioc_id = hd->ioc->id;
365 vdev->vtarget = vtarget; 366 vdev->vtarget = vtarget;
366 if (vtarget->num_luns == 0) { 367 if (vtarget->num_luns == 0) {
367 vtarget->tflags = MPT_TARGET_FLAGS_Q_YES|MPT_TARGET_FLAGS_VALID_INQUIRY; 368 vtarget->tflags = MPT_TARGET_FLAGS_Q_YES|MPT_TARGET_FLAGS_VALID_INQUIRY;
@@ -372,8 +373,8 @@ mptsas_slave_alloc(struct scsi_device *sdev)
372 RAID volumes placed beyond the last expected port. 373 RAID volumes placed beyond the last expected port.
373 */ 374 */
374 if (sdev->channel == hd->ioc->num_ports) { 375 if (sdev->channel == hd->ioc->num_ports) {
375 vdev->target_id = sdev->id; 376 target_id = sdev->id;
376 vdev->bus_id = 0; 377 vtarget->bus_id = 0;
377 vdev->lun = 0; 378 vdev->lun = 0;
378 goto out; 379 goto out;
379 } 380 }
@@ -384,11 +385,10 @@ mptsas_slave_alloc(struct scsi_device *sdev)
384 for (i = 0; i < p->num_phys; i++) { 385 for (i = 0; i < p->num_phys; i++) {
385 if (p->phy_info[i].attached.sas_address == 386 if (p->phy_info[i].attached.sas_address ==
386 rphy->identify.sas_address) { 387 rphy->identify.sas_address) {
387 vdev->target_id = 388 target_id = p->phy_info[i].attached.id;
388 p->phy_info[i].attached.id; 389 vtarget->bus_id = p->phy_info[i].attached.channel;
389 vdev->bus_id = p->phy_info[i].attached.channel;
390 vdev->lun = sdev->lun; 390 vdev->lun = sdev->lun;
391 mutex_unlock(&hd->ioc->sas_topology_mutex); 391 mutex_unlock(&hd->ioc->sas_topology_mutex);
392 goto out; 392 goto out;
393 } 393 }
394 } 394 }
@@ -399,9 +399,7 @@ mptsas_slave_alloc(struct scsi_device *sdev)
399 return -ENXIO; 399 return -ENXIO;
400 400
401 out: 401 out:
402 vtarget->ioc_id = vdev->ioc_id; 402 vtarget->target_id = target_id;
403 vtarget->target_id = vdev->target_id;
404 vtarget->bus_id = vdev->bus_id;
405 vtarget->num_luns++; 403 vtarget->num_luns++;
406 return 0; 404 return 0;
407} 405}
@@ -444,8 +442,8 @@ mptsas_slave_destroy(struct scsi_device *sdev)
444 if (vdev->configured_lun){ 442 if (vdev->configured_lun){
445 if (mptscsih_TMHandler(hd, 443 if (mptscsih_TMHandler(hd,
446 MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, 444 MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
447 vdev->bus_id, 445 vdev->vtarget->bus_id,
448 vdev->target_id, 446 vdev->vtarget->target_id,
449 0, 0, 5 /* 5 second timeout */) 447 0, 0, 5 /* 5 second timeout */)
450 < 0){ 448 < 0){
451 449
@@ -455,7 +453,7 @@ mptsas_slave_destroy(struct scsi_device *sdev)
455 printk(MYIOC_s_WARN_FMT 453 printk(MYIOC_s_WARN_FMT
456 "Error processing TaskMgmt id=%d TARGET_RESET\n", 454 "Error processing TaskMgmt id=%d TARGET_RESET\n",
457 hd->ioc->name, 455 hd->ioc->name,
458 vdev->target_id); 456 vdev->vtarget->target_id);
459 457
460 hd->tmPending = 0; 458 hd->tmPending = 0;
461 hd->tmState = TM_STATE_NONE; 459 hd->tmState = TM_STATE_NONE;
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 77289fd07fe7..c99a918feb58 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -887,7 +887,7 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
887 dsprintk(( "search_running: found (sc=%p, mf = %p) target %d, lun %d \n", 887 dsprintk(( "search_running: found (sc=%p, mf = %p) target %d, lun %d \n",
888 hd->ScsiLookup[ii], mf, mf->TargetID, mf->LUN[1])); 888 hd->ScsiLookup[ii], mf, mf->TargetID, mf->LUN[1]));
889 889
890 if ((mf->TargetID != ((u8)vdevice->target_id)) || (mf->LUN[1] != ((u8) vdevice->lun))) 890 if ((mf->TargetID != ((u8)vdevice->vtarget->target_id)) || (mf->LUN[1] != ((u8) vdevice->lun)))
891 continue; 891 continue;
892 892
893 /* Cleanup 893 /* Cleanup
@@ -1285,8 +1285,8 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
1285 1285
1286 /* Use the above information to set up the message frame 1286 /* Use the above information to set up the message frame
1287 */ 1287 */
1288 pScsiReq->TargetID = (u8) vdev->target_id; 1288 pScsiReq->TargetID = (u8) vdev->vtarget->target_id;
1289 pScsiReq->Bus = vdev->bus_id; 1289 pScsiReq->Bus = vdev->vtarget->bus_id;
1290 pScsiReq->ChainOffset = 0; 1290 pScsiReq->ChainOffset = 0;
1291 if (vdev->vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT) 1291 if (vdev->vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT)
1292 pScsiReq->Function = MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH; 1292 pScsiReq->Function = MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH;
@@ -1701,7 +1701,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1701 1701
1702 vdev = SCpnt->device->hostdata; 1702 vdev = SCpnt->device->hostdata;
1703 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK, 1703 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK,
1704 vdev->bus_id, vdev->target_id, vdev->lun, 1704 vdev->vtarget->bus_id, vdev->vtarget->target_id, vdev->lun,
1705 ctx2abort, mptscsih_get_tm_timeout(ioc)); 1705 ctx2abort, mptscsih_get_tm_timeout(ioc));
1706 1706
1707 printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n", 1707 printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n",
@@ -1752,7 +1752,7 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
1752 1752
1753 vdev = SCpnt->device->hostdata; 1753 vdev = SCpnt->device->hostdata;
1754 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, 1754 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
1755 vdev->bus_id, vdev->target_id, 1755 vdev->vtarget->bus_id, vdev->vtarget->target_id,
1756 0, 0, mptscsih_get_tm_timeout(hd->ioc)); 1756 0, 0, mptscsih_get_tm_timeout(hd->ioc));
1757 1757
1758 printk (KERN_WARNING MYNAM ": %s: target reset: %s (sc=%p)\n", 1758 printk (KERN_WARNING MYNAM ": %s: target reset: %s (sc=%p)\n",
@@ -1803,7 +1803,7 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt)
1803 1803
1804 vdev = SCpnt->device->hostdata; 1804 vdev = SCpnt->device->hostdata;
1805 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, 1805 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS,
1806 vdev->bus_id, 0, 0, 0, mptscsih_get_tm_timeout(hd->ioc)); 1806 vdev->vtarget->bus_id, 0, 0, 0, mptscsih_get_tm_timeout(hd->ioc));
1807 1807
1808 printk (KERN_WARNING MYNAM ": %s: bus reset: %s (sc=%p)\n", 1808 printk (KERN_WARNING MYNAM ": %s: bus reset: %s (sc=%p)\n",
1809 hd->ioc->name, 1809 hd->ioc->name,
@@ -2162,9 +2162,6 @@ mptscsih_slave_alloc(struct scsi_device *sdev)
2162 return -ENOMEM; 2162 return -ENOMEM;
2163 } 2163 }
2164 2164
2165 vdev->ioc_id = hd->ioc->id;
2166 vdev->target_id = sdev->id;
2167 vdev->bus_id = sdev->channel;
2168 vdev->lun = sdev->lun; 2165 vdev->lun = sdev->lun;
2169 sdev->hostdata = vdev; 2166 sdev->hostdata = vdev;
2170 2167
@@ -3366,8 +3363,8 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
3366 iocmd.data_dma = -1; 3363 iocmd.data_dma = -1;
3367 iocmd.size = 0; 3364 iocmd.size = 0;
3368 iocmd.rsvd = iocmd.rsvd2 = 0; 3365 iocmd.rsvd = iocmd.rsvd2 = 0;
3369 iocmd.bus = vdevice->bus_id; 3366 iocmd.bus = vdevice->vtarget->bus_id;
3370 iocmd.id = vdevice->target_id; 3367 iocmd.id = vdevice->vtarget->target_id;
3371 iocmd.lun = (u8)vdevice->lun; 3368 iocmd.lun = (u8)vdevice->lun;
3372 3369
3373 if ((vdevice->vtarget->type == TYPE_DISK) && 3370 if ((vdevice->vtarget->type == TYPE_DISK) &&
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 9af69dd66f8b..09c745b19cc8 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -343,9 +343,9 @@ static int mptspi_slave_alloc(struct scsi_device *sdev)
343 sdev->no_uld_attach = 1; 343 sdev->no_uld_attach = 1;
344 vdev->vtarget->tflags |= MPT_TARGET_FLAGS_RAID_COMPONENT; 344 vdev->vtarget->tflags |= MPT_TARGET_FLAGS_RAID_COMPONENT;
345 /* The real channel for this device is zero */ 345 /* The real channel for this device is zero */
346 vdev->bus_id = 0; 346 vdev->vtarget->bus_id = 0;
347 /* The actual physdisknum (for RAID passthrough) */ 347 /* The actual physdisknum (for RAID passthrough) */
348 vdev->target_id = physdisknum; 348 vdev->vtarget->target_id = physdisknum;
349 } 349 }
350 350
351 return 0; 351 return 0;