diff options
author | Eric Moore <eric.moore@lsi.com> | 2007-01-29 11:42:20 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-02-02 21:48:49 -0500 |
commit | 793955f549c710a1b0c18f823d5d710840747b15 (patch) | |
tree | ef85a09c1d90404a83f95b35d6fd717c421a4e5b /drivers/message/fusion/mptfc.c | |
parent | 502c62f17aa7daa78d5da963305251b872885ff9 (diff) |
[SCSI] fusion - Greater than 255 target and lun support
Add support for greater than 255 target and luns.
Kill the hd->Target[] field, and change all references
of bus_id/target_id, to channel/id.
Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message/fusion/mptfc.c')
-rw-r--r-- | drivers/message/fusion/mptfc.c | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index c819c23b55b1..cd8fa39ec270 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c | |||
@@ -86,6 +86,12 @@ MODULE_PARM_DESC(mptfc_dev_loss_tmo, " Initial time the driver programs the " | |||
86 | " return following a device loss event." | 86 | " return following a device loss event." |
87 | " Default=60."); | 87 | " Default=60."); |
88 | 88 | ||
89 | /* scsi-mid layer global parmeter is max_report_luns, which is 511 */ | ||
90 | #define MPTFC_MAX_LUN (16895) | ||
91 | static int max_lun = MPTFC_MAX_LUN; | ||
92 | module_param(max_lun, int, 0); | ||
93 | MODULE_PARM_DESC(max_lun, " max lun, default=16895 "); | ||
94 | |||
89 | static int mptfcDoneCtx = -1; | 95 | static int mptfcDoneCtx = -1; |
90 | static int mptfcTaskCtx = -1; | 96 | static int mptfcTaskCtx = -1; |
91 | static int mptfcInternalCtx = -1; /* Used only for internal commands */ | 97 | static int mptfcInternalCtx = -1; /* Used only for internal commands */ |
@@ -292,10 +298,9 @@ mptfc_GetFcDevPage0(MPT_ADAPTER *ioc, int ioc_port, | |||
292 | U32 port_id = 0xffffff; | 298 | U32 port_id = 0xffffff; |
293 | int num_targ = 0; | 299 | int num_targ = 0; |
294 | int max_bus = ioc->facts.MaxBuses; | 300 | int max_bus = ioc->facts.MaxBuses; |
295 | int max_targ = ioc->facts.MaxDevices; | 301 | int max_targ; |
296 | 302 | ||
297 | if (max_bus == 0 || max_targ == 0) | 303 | max_targ = (ioc->facts.MaxDevices == 0) ? 256 : ioc->facts.MaxDevices; |
298 | goto out; | ||
299 | 304 | ||
300 | data_sz = sizeof(FCDevicePage0_t) * max_bus * max_targ; | 305 | data_sz = sizeof(FCDevicePage0_t) * max_bus * max_targ; |
301 | p_p0 = p0_array = kzalloc(data_sz, GFP_KERNEL); | 306 | p_p0 = p0_array = kzalloc(data_sz, GFP_KERNEL); |
@@ -467,8 +472,8 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0) | |||
467 | if (ri->starget) { | 472 | if (ri->starget) { |
468 | vtarget = ri->starget->hostdata; | 473 | vtarget = ri->starget->hostdata; |
469 | if (vtarget) { | 474 | if (vtarget) { |
470 | vtarget->target_id = pg0->CurrentTargetID; | 475 | vtarget->id = pg0->CurrentTargetID; |
471 | vtarget->bus_id = pg0->CurrentBus; | 476 | vtarget->channel = pg0->CurrentBus; |
472 | } | 477 | } |
473 | } | 478 | } |
474 | *((struct mptfc_rport_info **)rport->dd_data) = ri; | 479 | *((struct mptfc_rport_info **)rport->dd_data) = ri; |
@@ -540,8 +545,8 @@ mptfc_target_alloc(struct scsi_target *starget) | |||
540 | if (rport) { | 545 | if (rport) { |
541 | ri = *((struct mptfc_rport_info **)rport->dd_data); | 546 | ri = *((struct mptfc_rport_info **)rport->dd_data); |
542 | if (ri) { /* better be! */ | 547 | if (ri) { /* better be! */ |
543 | vtarget->target_id = ri->pg0.CurrentTargetID; | 548 | vtarget->id = ri->pg0.CurrentTargetID; |
544 | vtarget->bus_id = ri->pg0.CurrentBus; | 549 | vtarget->channel = ri->pg0.CurrentBus; |
545 | ri->starget = starget; | 550 | ri->starget = starget; |
546 | rc = 0; | 551 | rc = 0; |
547 | } | 552 | } |
@@ -592,7 +597,6 @@ mptfc_slave_alloc(struct scsi_device *sdev) | |||
592 | if (vtarget->num_luns == 0) { | 597 | if (vtarget->num_luns == 0) { |
593 | vtarget->ioc_id = hd->ioc->id; | 598 | vtarget->ioc_id = hd->ioc->id; |
594 | vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; | 599 | vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; |
595 | hd->Targets[sdev->id] = vtarget; | ||
596 | } | 600 | } |
597 | 601 | ||
598 | vdev->vtarget = vtarget; | 602 | vdev->vtarget = vtarget; |
@@ -630,16 +634,17 @@ mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
630 | struct mptfc_rport_info *ri; | 634 | struct mptfc_rport_info *ri; |
631 | struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device)); | 635 | struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device)); |
632 | int err; | 636 | int err; |
637 | VirtDevice *vdev = SCpnt->device->hostdata; | ||
633 | 638 | ||
634 | err = fc_remote_port_chkready(rport); | 639 | if (!vdev || !vdev->vtarget) { |
635 | if (unlikely(err)) { | 640 | SCpnt->result = DID_NO_CONNECT << 16; |
636 | SCpnt->result = err; | ||
637 | done(SCpnt); | 641 | done(SCpnt); |
638 | return 0; | 642 | return 0; |
639 | } | 643 | } |
640 | 644 | ||
641 | if (!SCpnt->device->hostdata) { /* vdev */ | 645 | err = fc_remote_port_chkready(rport); |
642 | SCpnt->result = DID_NO_CONNECT << 16; | 646 | if (unlikely(err)) { |
647 | SCpnt->result = err; | ||
643 | done(SCpnt); | 648 | done(SCpnt); |
644 | return 0; | 649 | return 0; |
645 | } | 650 | } |
@@ -1143,7 +1148,7 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1143 | printk(MYIOC_s_WARN_FMT | 1148 | printk(MYIOC_s_WARN_FMT |
1144 | "Skipping ioc=%p because SCSI Initiator mode is NOT enabled!\n", | 1149 | "Skipping ioc=%p because SCSI Initiator mode is NOT enabled!\n", |
1145 | ioc->name, ioc); | 1150 | ioc->name, ioc); |
1146 | return -ENODEV; | 1151 | return 0; |
1147 | } | 1152 | } |
1148 | 1153 | ||
1149 | sh = scsi_host_alloc(&mptfc_driver_template, sizeof(MPT_SCSI_HOST)); | 1154 | sh = scsi_host_alloc(&mptfc_driver_template, sizeof(MPT_SCSI_HOST)); |
@@ -1173,10 +1178,9 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1173 | /* set 16 byte cdb's */ | 1178 | /* set 16 byte cdb's */ |
1174 | sh->max_cmd_len = 16; | 1179 | sh->max_cmd_len = 16; |
1175 | 1180 | ||
1176 | sh->max_id = MPT_MAX_FC_DEVICES<256 ? MPT_MAX_FC_DEVICES : 255; | 1181 | sh->max_id = ioc->pfacts->MaxDevices; |
1182 | sh->max_lun = max_lun; | ||
1177 | 1183 | ||
1178 | sh->max_lun = MPT_LAST_LUN + 1; | ||
1179 | sh->max_channel = 0; | ||
1180 | sh->this_id = ioc->pfacts[0].PortSCSIID; | 1184 | sh->this_id = ioc->pfacts[0].PortSCSIID; |
1181 | 1185 | ||
1182 | /* Required entry. | 1186 | /* Required entry. |
@@ -1230,19 +1234,6 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1230 | dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p\n", | 1234 | dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p\n", |
1231 | ioc->name, hd->ScsiLookup)); | 1235 | ioc->name, hd->ScsiLookup)); |
1232 | 1236 | ||
1233 | /* Allocate memory for the device structures. | ||
1234 | * A non-Null pointer at an offset | ||
1235 | * indicates a device exists. | ||
1236 | * max_id = 1 + maximum id (hosts.h) | ||
1237 | */ | ||
1238 | hd->Targets = kcalloc(sh->max_id, sizeof(void *), GFP_ATOMIC); | ||
1239 | if (!hd->Targets) { | ||
1240 | error = -ENOMEM; | ||
1241 | goto out_mptfc_probe; | ||
1242 | } | ||
1243 | |||
1244 | dprintk((KERN_INFO " vdev @ %p\n", hd->Targets)); | ||
1245 | |||
1246 | /* Clear the TM flags | 1237 | /* Clear the TM flags |
1247 | */ | 1238 | */ |
1248 | hd->tmPending = 0; | 1239 | hd->tmPending = 0; |