diff options
author | Eric Moore <eric.moore@lsi.com> | 2007-09-14 20:49:03 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:48:46 -0400 |
commit | e80b002bfd38263117da93feb4f67f5cf7d9221b (patch) | |
tree | 169d482e07e69dbe0fb6407f342e625099916b5c /drivers/message | |
parent | a69de507aae293e32d22e873f34f25f49b2db3b2 (diff) |
[SCSI] mpt fusion: removing references to hd->ioc
Cleaning up code by accesing the ioc pointer directly instead of via hd->ioc. In the future, most data members of struct MPT_SCSI_HOST will be either deleted or moved to struct MPT_ADAPTER.
Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message')
-rw-r--r-- | drivers/message/fusion/mptfc.c | 17 | ||||
-rw-r--r-- | drivers/message/fusion/mptsas.c | 37 | ||||
-rw-r--r-- | drivers/message/fusion/mptscsih.c | 199 | ||||
-rw-r--r-- | drivers/message/fusion/mptspi.c | 97 |
4 files changed, 188 insertions, 162 deletions
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index 061702d32888..19438ecc47a6 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c | |||
@@ -194,12 +194,14 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt, | |||
194 | struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); | 194 | struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); |
195 | unsigned long flags; | 195 | unsigned long flags; |
196 | int ready; | 196 | int ready; |
197 | MPT_ADAPTER *ioc; | ||
197 | 198 | ||
198 | hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata; | 199 | hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata; |
200 | ioc = hd->ioc; | ||
199 | spin_lock_irqsave(shost->host_lock, flags); | 201 | spin_lock_irqsave(shost->host_lock, flags); |
200 | while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) { | 202 | while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) { |
201 | spin_unlock_irqrestore(shost->host_lock, flags); | 203 | spin_unlock_irqrestore(shost->host_lock, flags); |
202 | dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT | 204 | dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT |
203 | "mptfc_block_error_handler.%d: %d:%d, port status is " | 205 | "mptfc_block_error_handler.%d: %d:%d, port status is " |
204 | "DID_IMM_RETRY, deferring %s recovery.\n", | 206 | "DID_IMM_RETRY, deferring %s recovery.\n", |
205 | ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, | 207 | ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, |
@@ -211,7 +213,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt, | |||
211 | spin_unlock_irqrestore(shost->host_lock, flags); | 213 | spin_unlock_irqrestore(shost->host_lock, flags); |
212 | 214 | ||
213 | if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata) { | 215 | if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata) { |
214 | dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT | 216 | dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT |
215 | "%s.%d: %d:%d, failing recovery, " | 217 | "%s.%d: %d:%d, failing recovery, " |
216 | "port state %d, vdevice %p.\n", caller, | 218 | "port state %d, vdevice %p.\n", caller, |
217 | ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, | 219 | ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, |
@@ -220,7 +222,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt, | |||
220 | SCpnt->device->hostdata)); | 222 | SCpnt->device->hostdata)); |
221 | return FAILED; | 223 | return FAILED; |
222 | } | 224 | } |
223 | dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT | 225 | dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT |
224 | "%s.%d: %d:%d, executing recovery.\n", caller, | 226 | "%s.%d: %d:%d, executing recovery.\n", caller, |
225 | ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, | 227 | ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, |
226 | ((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no, | 228 | ((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no, |
@@ -605,7 +607,7 @@ mptfc_slave_alloc(struct scsi_device *sdev) | |||
605 | VirtDevice *vdevice; | 607 | VirtDevice *vdevice; |
606 | struct scsi_target *starget; | 608 | struct scsi_target *starget; |
607 | struct fc_rport *rport; | 609 | struct fc_rport *rport; |
608 | 610 | MPT_ADAPTER *ioc; | |
609 | 611 | ||
610 | starget = scsi_target(sdev); | 612 | starget = scsi_target(sdev); |
611 | rport = starget_to_rport(starget); | 613 | rport = starget_to_rport(starget); |
@@ -614,11 +616,12 @@ mptfc_slave_alloc(struct scsi_device *sdev) | |||
614 | return -ENXIO; | 616 | return -ENXIO; |
615 | 617 | ||
616 | hd = (MPT_SCSI_HOST *)sdev->host->hostdata; | 618 | hd = (MPT_SCSI_HOST *)sdev->host->hostdata; |
619 | ioc = hd->ioc; | ||
617 | 620 | ||
618 | vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL); | 621 | vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL); |
619 | if (!vdevice) { | 622 | if (!vdevice) { |
620 | printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n", | 623 | printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n", |
621 | hd->ioc->name, sizeof(VirtDevice)); | 624 | ioc->name, sizeof(VirtDevice)); |
622 | return -ENOMEM; | 625 | return -ENOMEM; |
623 | } | 626 | } |
624 | 627 | ||
@@ -627,7 +630,7 @@ mptfc_slave_alloc(struct scsi_device *sdev) | |||
627 | vtarget = starget->hostdata; | 630 | vtarget = starget->hostdata; |
628 | 631 | ||
629 | if (vtarget->num_luns == 0) { | 632 | if (vtarget->num_luns == 0) { |
630 | vtarget->ioc_id = hd->ioc->id; | 633 | vtarget->ioc_id = ioc->id; |
631 | vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; | 634 | vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; |
632 | } | 635 | } |
633 | 636 | ||
@@ -637,7 +640,7 @@ mptfc_slave_alloc(struct scsi_device *sdev) | |||
637 | vtarget->num_luns++; | 640 | vtarget->num_luns++; |
638 | 641 | ||
639 | 642 | ||
640 | mptfc_dump_lun_info(hd->ioc, rport, sdev, vtarget); | 643 | mptfc_dump_lun_info(ioc, rport, sdev, vtarget); |
641 | 644 | ||
642 | return 0; | 645 | return 0; |
643 | } | 646 | } |
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 1dfe7d713aea..ee03c3f20526 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
@@ -846,13 +846,14 @@ mptsas_target_alloc(struct scsi_target *starget) | |||
846 | struct sas_rphy *rphy; | 846 | struct sas_rphy *rphy; |
847 | struct mptsas_portinfo *p; | 847 | struct mptsas_portinfo *p; |
848 | int i; | 848 | int i; |
849 | MPT_ADAPTER *ioc = hd->ioc; | ||
849 | 850 | ||
850 | vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL); | 851 | vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL); |
851 | if (!vtarget) | 852 | if (!vtarget) |
852 | return -ENOMEM; | 853 | return -ENOMEM; |
853 | 854 | ||
854 | vtarget->starget = starget; | 855 | vtarget->starget = starget; |
855 | vtarget->ioc_id = hd->ioc->id; | 856 | vtarget->ioc_id = ioc->id; |
856 | vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; | 857 | vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; |
857 | id = starget->id; | 858 | id = starget->id; |
858 | channel = 0; | 859 | channel = 0; |
@@ -861,15 +862,15 @@ mptsas_target_alloc(struct scsi_target *starget) | |||
861 | * RAID volumes placed beyond the last expected port. | 862 | * RAID volumes placed beyond the last expected port. |
862 | */ | 863 | */ |
863 | if (starget->channel == MPTSAS_RAID_CHANNEL) { | 864 | if (starget->channel == MPTSAS_RAID_CHANNEL) { |
864 | for (i=0; i < hd->ioc->raid_data.pIocPg2->NumActiveVolumes; i++) | 865 | for (i=0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) |
865 | if (id == hd->ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID) | 866 | if (id == ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID) |
866 | channel = hd->ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus; | 867 | channel = ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus; |
867 | goto out; | 868 | goto out; |
868 | } | 869 | } |
869 | 870 | ||
870 | rphy = dev_to_rphy(starget->dev.parent); | 871 | rphy = dev_to_rphy(starget->dev.parent); |
871 | mutex_lock(&hd->ioc->sas_topology_mutex); | 872 | mutex_lock(&ioc->sas_topology_mutex); |
872 | list_for_each_entry(p, &hd->ioc->sas_topology, list) { | 873 | list_for_each_entry(p, &ioc->sas_topology, list) { |
873 | for (i = 0; i < p->num_phys; i++) { | 874 | for (i = 0; i < p->num_phys; i++) { |
874 | if (p->phy_info[i].attached.sas_address != | 875 | if (p->phy_info[i].attached.sas_address != |
875 | rphy->identify.sas_address) | 876 | rphy->identify.sas_address) |
@@ -881,18 +882,18 @@ mptsas_target_alloc(struct scsi_target *starget) | |||
881 | /* | 882 | /* |
882 | * Exposing hidden raid components | 883 | * Exposing hidden raid components |
883 | */ | 884 | */ |
884 | if (mptscsih_is_phys_disk(hd->ioc, channel, id)) { | 885 | if (mptscsih_is_phys_disk(ioc, channel, id)) { |
885 | id = mptscsih_raid_id_to_num(hd->ioc, | 886 | id = mptscsih_raid_id_to_num(ioc, |
886 | channel, id); | 887 | channel, id); |
887 | vtarget->tflags |= | 888 | vtarget->tflags |= |
888 | MPT_TARGET_FLAGS_RAID_COMPONENT; | 889 | MPT_TARGET_FLAGS_RAID_COMPONENT; |
889 | p->phy_info[i].attached.phys_disk_num = id; | 890 | p->phy_info[i].attached.phys_disk_num = id; |
890 | } | 891 | } |
891 | mutex_unlock(&hd->ioc->sas_topology_mutex); | 892 | mutex_unlock(&ioc->sas_topology_mutex); |
892 | goto out; | 893 | goto out; |
893 | } | 894 | } |
894 | } | 895 | } |
895 | mutex_unlock(&hd->ioc->sas_topology_mutex); | 896 | mutex_unlock(&ioc->sas_topology_mutex); |
896 | 897 | ||
897 | kfree(vtarget); | 898 | kfree(vtarget); |
898 | return -ENXIO; | 899 | return -ENXIO; |
@@ -912,6 +913,7 @@ mptsas_target_destroy(struct scsi_target *starget) | |||
912 | struct sas_rphy *rphy; | 913 | struct sas_rphy *rphy; |
913 | struct mptsas_portinfo *p; | 914 | struct mptsas_portinfo *p; |
914 | int i; | 915 | int i; |
916 | MPT_ADAPTER *ioc = hd->ioc; | ||
915 | 917 | ||
916 | if (!starget->hostdata) | 918 | if (!starget->hostdata) |
917 | return; | 919 | return; |
@@ -920,7 +922,7 @@ mptsas_target_destroy(struct scsi_target *starget) | |||
920 | goto out; | 922 | goto out; |
921 | 923 | ||
922 | rphy = dev_to_rphy(starget->dev.parent); | 924 | rphy = dev_to_rphy(starget->dev.parent); |
923 | list_for_each_entry(p, &hd->ioc->sas_topology, list) { | 925 | list_for_each_entry(p, &ioc->sas_topology, list) { |
924 | for (i = 0; i < p->num_phys; i++) { | 926 | for (i = 0; i < p->num_phys; i++) { |
925 | if (p->phy_info[i].attached.sas_address != | 927 | if (p->phy_info[i].attached.sas_address != |
926 | rphy->identify.sas_address) | 928 | rphy->identify.sas_address) |
@@ -946,11 +948,12 @@ mptsas_slave_alloc(struct scsi_device *sdev) | |||
946 | VirtDevice *vdevice; | 948 | VirtDevice *vdevice; |
947 | struct scsi_target *starget; | 949 | struct scsi_target *starget; |
948 | int i; | 950 | int i; |
951 | MPT_ADAPTER *ioc = hd->ioc; | ||
949 | 952 | ||
950 | vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL); | 953 | vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL); |
951 | if (!vdevice) { | 954 | if (!vdevice) { |
952 | printk(MYIOC_s_ERR_FMT "slave_alloc kzalloc(%zd) FAILED!\n", | 955 | printk(MYIOC_s_ERR_FMT "slave_alloc kzalloc(%zd) FAILED!\n", |
953 | hd->ioc->name, sizeof(VirtDevice)); | 956 | ioc->name, sizeof(VirtDevice)); |
954 | return -ENOMEM; | 957 | return -ENOMEM; |
955 | } | 958 | } |
956 | starget = scsi_target(sdev); | 959 | starget = scsi_target(sdev); |
@@ -960,8 +963,8 @@ mptsas_slave_alloc(struct scsi_device *sdev) | |||
960 | goto out; | 963 | goto out; |
961 | 964 | ||
962 | rphy = dev_to_rphy(sdev->sdev_target->dev.parent); | 965 | rphy = dev_to_rphy(sdev->sdev_target->dev.parent); |
963 | mutex_lock(&hd->ioc->sas_topology_mutex); | 966 | mutex_lock(&ioc->sas_topology_mutex); |
964 | list_for_each_entry(p, &hd->ioc->sas_topology, list) { | 967 | list_for_each_entry(p, &ioc->sas_topology, list) { |
965 | for (i = 0; i < p->num_phys; i++) { | 968 | for (i = 0; i < p->num_phys; i++) { |
966 | if (p->phy_info[i].attached.sas_address != | 969 | if (p->phy_info[i].attached.sas_address != |
967 | rphy->identify.sas_address) | 970 | rphy->identify.sas_address) |
@@ -970,15 +973,15 @@ mptsas_slave_alloc(struct scsi_device *sdev) | |||
970 | /* | 973 | /* |
971 | * Exposing hidden raid components | 974 | * Exposing hidden raid components |
972 | */ | 975 | */ |
973 | if (mptscsih_is_phys_disk(hd->ioc, | 976 | if (mptscsih_is_phys_disk(ioc, |
974 | p->phy_info[i].attached.channel, | 977 | p->phy_info[i].attached.channel, |
975 | p->phy_info[i].attached.id)) | 978 | p->phy_info[i].attached.id)) |
976 | sdev->no_uld_attach = 1; | 979 | sdev->no_uld_attach = 1; |
977 | mutex_unlock(&hd->ioc->sas_topology_mutex); | 980 | mutex_unlock(&ioc->sas_topology_mutex); |
978 | goto out; | 981 | goto out; |
979 | } | 982 | } |
980 | } | 983 | } |
981 | mutex_unlock(&hd->ioc->sas_topology_mutex); | 984 | mutex_unlock(&ioc->sas_topology_mutex); |
982 | 985 | ||
983 | kfree(vdevice); | 986 | kfree(vdevice); |
984 | return -ENXIO; | 987 | return -ENXIO; |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 02f95900e095..17369f8ba88b 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -1036,14 +1036,15 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice) | |||
1036 | int max = hd->ioc->req_depth; | 1036 | int max = hd->ioc->req_depth; |
1037 | struct scsi_cmnd *sc; | 1037 | struct scsi_cmnd *sc; |
1038 | struct scsi_lun lun; | 1038 | struct scsi_lun lun; |
1039 | MPT_ADAPTER *ioc = hd->ioc; | ||
1039 | 1040 | ||
1040 | dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT ": search_running channel %d id %d lun %d max %d\n", | 1041 | dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": search_running channel %d id %d lun %d max %d\n", |
1041 | hd->ioc->name, vdevice->vtarget->channel, vdevice->vtarget->id, vdevice->lun, max)); | 1042 | ioc->name, vdevice->vtarget->channel, vdevice->vtarget->id, vdevice->lun, max)); |
1042 | 1043 | ||
1043 | for (ii=0; ii < max; ii++) { | 1044 | for (ii=0; ii < max; ii++) { |
1044 | if ((sc = hd->ScsiLookup[ii]) != NULL) { | 1045 | if ((sc = hd->ScsiLookup[ii]) != NULL) { |
1045 | 1046 | ||
1046 | mf = (SCSIIORequest_t *)MPT_INDEX_2_MFPTR(hd->ioc, ii); | 1047 | mf = (SCSIIORequest_t *)MPT_INDEX_2_MFPTR(ioc, ii); |
1047 | if (mf == NULL) | 1048 | if (mf == NULL) |
1048 | continue; | 1049 | continue; |
1049 | /* If the device is a hidden raid component, then its | 1050 | /* If the device is a hidden raid component, then its |
@@ -1063,15 +1064,15 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice) | |||
1063 | /* Cleanup | 1064 | /* Cleanup |
1064 | */ | 1065 | */ |
1065 | hd->ScsiLookup[ii] = NULL; | 1066 | hd->ScsiLookup[ii] = NULL; |
1066 | mptscsih_freeChainBuffers(hd->ioc, ii); | 1067 | mptscsih_freeChainBuffers(ioc, ii); |
1067 | mpt_free_msg_frame(hd->ioc, (MPT_FRAME_HDR *)mf); | 1068 | mpt_free_msg_frame(ioc, (MPT_FRAME_HDR *)mf); |
1068 | if ((unsigned char *)mf != sc->host_scribble) | 1069 | if ((unsigned char *)mf != sc->host_scribble) |
1069 | continue; | 1070 | continue; |
1070 | scsi_dma_unmap(sc); | 1071 | scsi_dma_unmap(sc); |
1071 | sc->host_scribble = NULL; | 1072 | sc->host_scribble = NULL; |
1072 | sc->result = DID_NO_CONNECT << 16; | 1073 | sc->result = DID_NO_CONNECT << 16; |
1073 | sdev_printk(MYIOC_s_INFO_FMT, sc->device, "completing cmds: fw_channel %d," | 1074 | sdev_printk(MYIOC_s_INFO_FMT, sc->device, "completing cmds: fw_channel %d," |
1074 | "fw_id %d, sc=%p, mf = %p, idx=%x\n", hd->ioc->name, vdevice->vtarget->channel, | 1075 | "fw_id %d, sc=%p, mf = %p, idx=%x\n", ioc->name, vdevice->vtarget->channel, |
1075 | vdevice->vtarget->id, sc, mf, ii); | 1076 | vdevice->vtarget->id, sc, mf, ii); |
1076 | sc->scsi_done(sc); | 1077 | sc->scsi_done(sc); |
1077 | } | 1078 | } |
@@ -1098,6 +1099,7 @@ mptscsih_report_queue_full(struct scsi_cmnd *sc, SCSIIOReply_t *pScsiReply, SCSI | |||
1098 | { | 1099 | { |
1099 | long time = jiffies; | 1100 | long time = jiffies; |
1100 | MPT_SCSI_HOST *hd; | 1101 | MPT_SCSI_HOST *hd; |
1102 | MPT_ADAPTER *ioc; | ||
1101 | 1103 | ||
1102 | if (sc->device == NULL) | 1104 | if (sc->device == NULL) |
1103 | return; | 1105 | return; |
@@ -1105,10 +1107,10 @@ mptscsih_report_queue_full(struct scsi_cmnd *sc, SCSIIOReply_t *pScsiReply, SCSI | |||
1105 | return; | 1107 | return; |
1106 | if ((hd = (MPT_SCSI_HOST *)sc->device->host->hostdata) == NULL) | 1108 | if ((hd = (MPT_SCSI_HOST *)sc->device->host->hostdata) == NULL) |
1107 | return; | 1109 | return; |
1108 | 1110 | ioc = hd->ioc; | |
1109 | if (time - hd->last_queue_full > 10 * HZ) { | 1111 | if (time - hd->last_queue_full > 10 * HZ) { |
1110 | dprintk(hd->ioc, printk(MYIOC_s_WARN_FMT "Device (%d:%d:%d) reported QUEUE_FULL!\n", | 1112 | dprintk(ioc, printk(MYIOC_s_WARN_FMT "Device (%d:%d:%d) reported QUEUE_FULL!\n", |
1111 | hd->ioc->name, 0, sc->device->id, sc->device->lun)); | 1113 | ioc->name, 0, sc->device->id, sc->device->lun)); |
1112 | hd->last_queue_full = time; | 1114 | hd->last_queue_full = time; |
1113 | } | 1115 | } |
1114 | } | 1116 | } |
@@ -1143,20 +1145,20 @@ mptscsih_remove(struct pci_dev *pdev) | |||
1143 | sz1=0; | 1145 | sz1=0; |
1144 | 1146 | ||
1145 | if (hd->ScsiLookup != NULL) { | 1147 | if (hd->ScsiLookup != NULL) { |
1146 | sz1 = hd->ioc->req_depth * sizeof(void *); | 1148 | sz1 = ioc->req_depth * sizeof(void *); |
1147 | kfree(hd->ScsiLookup); | 1149 | kfree(hd->ScsiLookup); |
1148 | hd->ScsiLookup = NULL; | 1150 | hd->ScsiLookup = NULL; |
1149 | } | 1151 | } |
1150 | 1152 | ||
1151 | dprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT | 1153 | dprintk(ioc, printk(MYIOC_s_DEBUG_FMT |
1152 | "Free'd ScsiLookup (%d) memory\n", | 1154 | "Free'd ScsiLookup (%d) memory\n", |
1153 | hd->ioc->name, sz1)); | 1155 | ioc->name, sz1)); |
1154 | 1156 | ||
1155 | kfree(hd->info_kbuf); | 1157 | kfree(hd->info_kbuf); |
1156 | 1158 | ||
1157 | /* NULL the Scsi_Host pointer | 1159 | /* NULL the Scsi_Host pointer |
1158 | */ | 1160 | */ |
1159 | hd->ioc->sh = NULL; | 1161 | ioc->sh = NULL; |
1160 | 1162 | ||
1161 | scsi_host_put(host); | 1163 | scsi_host_put(host); |
1162 | 1164 | ||
@@ -1386,7 +1388,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
1386 | /* | 1388 | /* |
1387 | * Put together a MPT SCSI request... | 1389 | * Put together a MPT SCSI request... |
1388 | */ | 1390 | */ |
1389 | if ((mf = mpt_get_msg_frame(hd->ioc->DoneCtx, hd->ioc)) == NULL) { | 1391 | if ((mf = mpt_get_msg_frame(ioc->DoneCtx, ioc)) == NULL) { |
1390 | dprintk(ioc, printk(MYIOC_s_WARN_FMT "QueueCmd, no msg frames!!\n", | 1392 | dprintk(ioc, printk(MYIOC_s_WARN_FMT "QueueCmd, no msg frames!!\n", |
1391 | ioc->name)); | 1393 | ioc->name)); |
1392 | return SCSI_MLQUEUE_HOST_BUSY; | 1394 | return SCSI_MLQUEUE_HOST_BUSY; |
@@ -1454,7 +1456,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
1454 | pScsiReq->DataLength = cpu_to_le32(datalen); | 1456 | pScsiReq->DataLength = cpu_to_le32(datalen); |
1455 | 1457 | ||
1456 | /* SenseBuffer low address */ | 1458 | /* SenseBuffer low address */ |
1457 | pScsiReq->SenseBufferLowAddr = cpu_to_le32(hd->ioc->sense_buf_low_dma | 1459 | pScsiReq->SenseBufferLowAddr = cpu_to_le32(ioc->sense_buf_low_dma |
1458 | + (my_idx * MPT_SENSE_BUFFER_ALLOC)); | 1460 | + (my_idx * MPT_SENSE_BUFFER_ALLOC)); |
1459 | 1461 | ||
1460 | /* Now add the SG list | 1462 | /* Now add the SG list |
@@ -1466,14 +1468,14 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
1466 | (dma_addr_t) -1); | 1468 | (dma_addr_t) -1); |
1467 | } else { | 1469 | } else { |
1468 | /* Add a 32 or 64 bit SGE */ | 1470 | /* Add a 32 or 64 bit SGE */ |
1469 | if (mptscsih_AddSGE(hd->ioc, SCpnt, pScsiReq, my_idx) != SUCCESS) | 1471 | if (mptscsih_AddSGE(ioc, SCpnt, pScsiReq, my_idx) != SUCCESS) |
1470 | goto fail; | 1472 | goto fail; |
1471 | } | 1473 | } |
1472 | 1474 | ||
1473 | SCpnt->host_scribble = (unsigned char *)mf; | 1475 | SCpnt->host_scribble = (unsigned char *)mf; |
1474 | hd->ScsiLookup[my_idx] = SCpnt; | 1476 | hd->ScsiLookup[my_idx] = SCpnt; |
1475 | 1477 | ||
1476 | mpt_put_msg_frame(hd->ioc->DoneCtx, hd->ioc, mf); | 1478 | mpt_put_msg_frame(ioc->DoneCtx, ioc, mf); |
1477 | dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Issued SCSI cmd (%p) mf=%p idx=%d\n", | 1479 | dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Issued SCSI cmd (%p) mf=%p idx=%d\n", |
1478 | ioc->name, SCpnt, mf, my_idx)); | 1480 | ioc->name, SCpnt, mf, my_idx)); |
1479 | DBG_DUMP_REQUEST_FRAME(ioc, (u32 *)mf); | 1481 | DBG_DUMP_REQUEST_FRAME(ioc, (u32 *)mf); |
@@ -1481,8 +1483,8 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
1481 | 1483 | ||
1482 | fail: | 1484 | fail: |
1483 | hd->ScsiLookup[my_idx] = NULL; | 1485 | hd->ScsiLookup[my_idx] = NULL; |
1484 | mptscsih_freeChainBuffers(hd->ioc, my_idx); | 1486 | mptscsih_freeChainBuffers(ioc, my_idx); |
1485 | mpt_free_msg_frame(hd->ioc, mf); | 1487 | mpt_free_msg_frame(ioc, mf); |
1486 | return SCSI_MLQUEUE_HOST_BUSY; | 1488 | return SCSI_MLQUEUE_HOST_BUSY; |
1487 | } | 1489 | } |
1488 | 1490 | ||
@@ -1608,12 +1610,12 @@ mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int c | |||
1608 | return FAILED; | 1610 | return FAILED; |
1609 | } | 1611 | } |
1610 | } else { | 1612 | } else { |
1611 | spin_lock_irqsave(&hd->ioc->FreeQlock, flags); | 1613 | spin_lock_irqsave(&ioc->FreeQlock, flags); |
1612 | hd->tmPending |= (1 << type); | 1614 | hd->tmPending |= (1 << type); |
1613 | spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags); | 1615 | spin_unlock_irqrestore(&ioc->FreeQlock, flags); |
1614 | } | 1616 | } |
1615 | 1617 | ||
1616 | ioc_raw_state = mpt_GetIocState(hd->ioc, 0); | 1618 | ioc_raw_state = mpt_GetIocState(ioc, 0); |
1617 | 1619 | ||
1618 | if ((ioc_raw_state & MPI_IOC_STATE_MASK) != MPI_IOC_STATE_OPERATIONAL) { | 1620 | if ((ioc_raw_state & MPI_IOC_STATE_MASK) != MPI_IOC_STATE_OPERATIONAL) { |
1619 | printk(MYIOC_s_WARN_FMT | 1621 | printk(MYIOC_s_WARN_FMT |
@@ -1681,16 +1683,17 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, i | |||
1681 | SCSITaskMgmt_t *pScsiTm; | 1683 | SCSITaskMgmt_t *pScsiTm; |
1682 | int ii; | 1684 | int ii; |
1683 | int retval; | 1685 | int retval; |
1686 | MPT_ADAPTER *ioc = hd->ioc; | ||
1684 | 1687 | ||
1685 | /* Return Fail to calling function if no message frames available. | 1688 | /* Return Fail to calling function if no message frames available. |
1686 | */ | 1689 | */ |
1687 | if ((mf = mpt_get_msg_frame(hd->ioc->TaskCtx, hd->ioc)) == NULL) { | 1690 | if ((mf = mpt_get_msg_frame(ioc->TaskCtx, ioc)) == NULL) { |
1688 | dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "IssueTaskMgmt, no msg frames!!\n", | 1691 | dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "IssueTaskMgmt, no msg frames!!\n", |
1689 | hd->ioc->name)); | 1692 | ioc->name)); |
1690 | return FAILED; | 1693 | return FAILED; |
1691 | } | 1694 | } |
1692 | dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt request @ %p\n", | 1695 | dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt request @ %p\n", |
1693 | hd->ioc->name, mf)); | 1696 | ioc->name, mf)); |
1694 | 1697 | ||
1695 | /* Format the Request | 1698 | /* Format the Request |
1696 | */ | 1699 | */ |
@@ -1713,34 +1716,34 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, i | |||
1713 | 1716 | ||
1714 | pScsiTm->TaskMsgContext = ctx2abort; | 1717 | pScsiTm->TaskMsgContext = ctx2abort; |
1715 | 1718 | ||
1716 | dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt: ctx2abort (0x%08x) " | 1719 | dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt: ctx2abort (0x%08x) " |
1717 | "type=%d\n", hd->ioc->name, ctx2abort, type)); | 1720 | "type=%d\n", ioc->name, ctx2abort, type)); |
1718 | 1721 | ||
1719 | DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)pScsiTm); | 1722 | DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)pScsiTm); |
1720 | 1723 | ||
1721 | if ((hd->ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q) && | 1724 | if ((ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q) && |
1722 | (hd->ioc->facts.MsgVersion >= MPI_VERSION_01_05)) | 1725 | (ioc->facts.MsgVersion >= MPI_VERSION_01_05)) |
1723 | mpt_put_msg_frame_hi_pri(hd->ioc->TaskCtx, hd->ioc, mf); | 1726 | mpt_put_msg_frame_hi_pri(ioc->TaskCtx, ioc, mf); |
1724 | else { | 1727 | else { |
1725 | retval = mpt_send_handshake_request(hd->ioc->TaskCtx, hd->ioc, | 1728 | retval = mpt_send_handshake_request(ioc->TaskCtx, ioc, |
1726 | sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP); | 1729 | sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP); |
1727 | if (retval) { | 1730 | if (retval) { |
1728 | dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "send_handshake FAILED!" | 1731 | dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "send_handshake FAILED!" |
1729 | " (hd %p, ioc %p, mf %p, rc=%d) \n", hd->ioc->name, hd, | 1732 | " (hd %p, ioc %p, mf %p, rc=%d) \n", ioc->name, hd, |
1730 | hd->ioc, mf, retval)); | 1733 | ioc, mf, retval)); |
1731 | goto fail_out; | 1734 | goto fail_out; |
1732 | } | 1735 | } |
1733 | } | 1736 | } |
1734 | 1737 | ||
1735 | if(mptscsih_tm_wait_for_completion(hd, timeout) == FAILED) { | 1738 | if(mptscsih_tm_wait_for_completion(hd, timeout) == FAILED) { |
1736 | dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "task management request TIMED OUT!" | 1739 | dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "task management request TIMED OUT!" |
1737 | " (hd %p, ioc %p, mf %p) \n", hd->ioc->name, hd, | 1740 | " (hd %p, ioc %p, mf %p) \n", ioc->name, hd, |
1738 | hd->ioc, mf)); | 1741 | ioc, mf)); |
1739 | dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Calling HardReset! \n", | 1742 | dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Calling HardReset! \n", |
1740 | hd->ioc->name)); | 1743 | ioc->name)); |
1741 | retval = mpt_HardResetHandler(hd->ioc, CAN_SLEEP); | 1744 | retval = mpt_HardResetHandler(ioc, CAN_SLEEP); |
1742 | dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "rc=%d \n", | 1745 | dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "rc=%d \n", |
1743 | hd->ioc->name, retval)); | 1746 | ioc->name, retval)); |
1744 | goto fail_out; | 1747 | goto fail_out; |
1745 | } | 1748 | } |
1746 | 1749 | ||
@@ -1761,7 +1764,7 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, i | |||
1761 | /* | 1764 | /* |
1762 | * Free task managment mf, and corresponding tm flags | 1765 | * Free task managment mf, and corresponding tm flags |
1763 | */ | 1766 | */ |
1764 | mpt_free_msg_frame(hd->ioc, mf); | 1767 | mpt_free_msg_frame(ioc, mf); |
1765 | hd->tmPending = 0; | 1768 | hd->tmPending = 0; |
1766 | hd->tmState = TM_STATE_NONE; | 1769 | hd->tmState = TM_STATE_NONE; |
1767 | return FAILED; | 1770 | return FAILED; |
@@ -1868,7 +1871,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt) | |||
1868 | * swap it here either. It is an opaque cookie to | 1871 | * swap it here either. It is an opaque cookie to |
1869 | * the controller, so it does not matter. -DaveM | 1872 | * the controller, so it does not matter. -DaveM |
1870 | */ | 1873 | */ |
1871 | mf = MPT_INDEX_2_MFPTR(hd->ioc, scpnt_idx); | 1874 | mf = MPT_INDEX_2_MFPTR(ioc, scpnt_idx); |
1872 | ctx2abort = mf->u.frame.hwhdr.msgctxu.MsgContext; | 1875 | ctx2abort = mf->u.frame.hwhdr.msgctxu.MsgContext; |
1873 | 1876 | ||
1874 | hd->abortSCpnt = SCpnt; | 1877 | hd->abortSCpnt = SCpnt; |
@@ -2030,7 +2033,7 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt) | |||
2030 | /* If our attempts to reset the host failed, then return a failed | 2033 | /* If our attempts to reset the host failed, then return a failed |
2031 | * status. The host will be taken off line by the SCSI mid-layer. | 2034 | * status. The host will be taken off line by the SCSI mid-layer. |
2032 | */ | 2035 | */ |
2033 | if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0) { | 2036 | if (mpt_HardResetHandler(ioc, CAN_SLEEP) < 0) { |
2034 | retval = FAILED; | 2037 | retval = FAILED; |
2035 | } else { | 2038 | } else { |
2036 | /* Make sure TM pending is cleared and TM state is set to | 2039 | /* Make sure TM pending is cleared and TM state is set to |
@@ -2060,17 +2063,18 @@ mptscsih_tm_pending_wait(MPT_SCSI_HOST * hd) | |||
2060 | unsigned long flags; | 2063 | unsigned long flags; |
2061 | int loop_count = 4 * 10; /* Wait 10 seconds */ | 2064 | int loop_count = 4 * 10; /* Wait 10 seconds */ |
2062 | int status = FAILED; | 2065 | int status = FAILED; |
2066 | MPT_ADAPTER *ioc = hd->ioc; | ||
2063 | 2067 | ||
2064 | do { | 2068 | do { |
2065 | spin_lock_irqsave(&hd->ioc->FreeQlock, flags); | 2069 | spin_lock_irqsave(&ioc->FreeQlock, flags); |
2066 | if (hd->tmState == TM_STATE_NONE) { | 2070 | if (hd->tmState == TM_STATE_NONE) { |
2067 | hd->tmState = TM_STATE_IN_PROGRESS; | 2071 | hd->tmState = TM_STATE_IN_PROGRESS; |
2068 | hd->tmPending = 1; | 2072 | hd->tmPending = 1; |
2069 | spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags); | 2073 | spin_unlock_irqrestore(&ioc->FreeQlock, flags); |
2070 | status = SUCCESS; | 2074 | status = SUCCESS; |
2071 | break; | 2075 | break; |
2072 | } | 2076 | } |
2073 | spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags); | 2077 | spin_unlock_irqrestore(&ioc->FreeQlock, flags); |
2074 | msleep(250); | 2078 | msleep(250); |
2075 | } while (--loop_count); | 2079 | } while (--loop_count); |
2076 | 2080 | ||
@@ -2091,15 +2095,16 @@ mptscsih_tm_wait_for_completion(MPT_SCSI_HOST * hd, ulong timeout ) | |||
2091 | unsigned long flags; | 2095 | unsigned long flags; |
2092 | int loop_count = 4 * timeout; | 2096 | int loop_count = 4 * timeout; |
2093 | int status = FAILED; | 2097 | int status = FAILED; |
2098 | MPT_ADAPTER *ioc = hd->ioc; | ||
2094 | 2099 | ||
2095 | do { | 2100 | do { |
2096 | spin_lock_irqsave(&hd->ioc->FreeQlock, flags); | 2101 | spin_lock_irqsave(&ioc->FreeQlock, flags); |
2097 | if(hd->tmPending == 0) { | 2102 | if(hd->tmPending == 0) { |
2098 | status = SUCCESS; | 2103 | status = SUCCESS; |
2099 | spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags); | 2104 | spin_unlock_irqrestore(&ioc->FreeQlock, flags); |
2100 | break; | 2105 | break; |
2101 | } | 2106 | } |
2102 | spin_unlock_irqrestore(&hd->ioc->FreeQlock, flags); | 2107 | spin_unlock_irqrestore(&ioc->FreeQlock, flags); |
2103 | msleep(250); | 2108 | msleep(250); |
2104 | } while (--loop_count); | 2109 | } while (--loop_count); |
2105 | 2110 | ||
@@ -2407,11 +2412,12 @@ mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth) | |||
2407 | struct scsi_target *starget; | 2412 | struct scsi_target *starget; |
2408 | int max_depth; | 2413 | int max_depth; |
2409 | int tagged; | 2414 | int tagged; |
2415 | MPT_ADAPTER *ioc = hd->ioc; | ||
2410 | 2416 | ||
2411 | starget = scsi_target(sdev); | 2417 | starget = scsi_target(sdev); |
2412 | vtarget = starget->hostdata; | 2418 | vtarget = starget->hostdata; |
2413 | 2419 | ||
2414 | if (hd->ioc->bus_type == SPI) { | 2420 | if (ioc->bus_type == SPI) { |
2415 | if (!(vtarget->tflags & MPT_TARGET_FLAGS_Q_YES)) | 2421 | if (!(vtarget->tflags & MPT_TARGET_FLAGS_Q_YES)) |
2416 | max_depth = 1; | 2422 | max_depth = 1; |
2417 | else if (sdev->type == TYPE_DISK && | 2423 | else if (sdev->type == TYPE_DISK && |
@@ -2447,18 +2453,19 @@ mptscsih_slave_configure(struct scsi_device *sdev) | |||
2447 | VirtDevice *vdevice; | 2453 | VirtDevice *vdevice; |
2448 | struct scsi_target *starget; | 2454 | struct scsi_target *starget; |
2449 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)sh->hostdata; | 2455 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)sh->hostdata; |
2456 | MPT_ADAPTER *ioc = hd->ioc; | ||
2450 | 2457 | ||
2451 | starget = scsi_target(sdev); | 2458 | starget = scsi_target(sdev); |
2452 | vtarget = starget->hostdata; | 2459 | vtarget = starget->hostdata; |
2453 | vdevice = sdev->hostdata; | 2460 | vdevice = sdev->hostdata; |
2454 | 2461 | ||
2455 | dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT | 2462 | dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT |
2456 | "device @ %p, channel=%d, id=%d, lun=%d\n", | 2463 | "device @ %p, channel=%d, id=%d, lun=%d\n", |
2457 | hd->ioc->name, sdev, sdev->channel, sdev->id, sdev->lun)); | 2464 | ioc->name, sdev, sdev->channel, sdev->id, sdev->lun)); |
2458 | if (hd->ioc->bus_type == SPI) | 2465 | if (ioc->bus_type == SPI) |
2459 | dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT | 2466 | dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT |
2460 | "sdtr %d wdtr %d ppr %d inq length=%d\n", | 2467 | "sdtr %d wdtr %d ppr %d inq length=%d\n", |
2461 | hd->ioc->name, sdev->sdtr, sdev->wdtr, | 2468 | ioc->name, sdev->sdtr, sdev->wdtr, |
2462 | sdev->ppr, sdev->inquiry_len)); | 2469 | sdev->ppr, sdev->inquiry_len)); |
2463 | 2470 | ||
2464 | if (sdev->id > sh->max_id) { | 2471 | if (sdev->id > sh->max_id) { |
@@ -2470,21 +2477,21 @@ mptscsih_slave_configure(struct scsi_device *sdev) | |||
2470 | vdevice->configured_lun = 1; | 2477 | vdevice->configured_lun = 1; |
2471 | mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH); | 2478 | mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH); |
2472 | 2479 | ||
2473 | dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT | 2480 | dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT |
2474 | "Queue depth=%d, tflags=%x\n", | 2481 | "Queue depth=%d, tflags=%x\n", |
2475 | hd->ioc->name, sdev->queue_depth, vtarget->tflags)); | 2482 | ioc->name, sdev->queue_depth, vtarget->tflags)); |
2476 | 2483 | ||
2477 | if (hd->ioc->bus_type == SPI) | 2484 | if (ioc->bus_type == SPI) |
2478 | dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT | 2485 | dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT |
2479 | "negoFlags=%x, maxOffset=%x, SyncFactor=%x\n", | 2486 | "negoFlags=%x, maxOffset=%x, SyncFactor=%x\n", |
2480 | hd->ioc->name, vtarget->negoFlags, vtarget->maxOffset, | 2487 | ioc->name, vtarget->negoFlags, vtarget->maxOffset, |
2481 | vtarget->minSyncFactor)); | 2488 | vtarget->minSyncFactor)); |
2482 | 2489 | ||
2483 | slave_configure_exit: | 2490 | slave_configure_exit: |
2484 | 2491 | ||
2485 | dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT | 2492 | dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT |
2486 | "tagged %d, simple %d, ordered %d\n", | 2493 | "tagged %d, simple %d, ordered %d\n", |
2487 | hd->ioc->name,sdev->tagged_supported, sdev->simple_tags, | 2494 | ioc->name,sdev->tagged_supported, sdev->simple_tags, |
2488 | sdev->ordered_tags)); | 2495 | sdev->ordered_tags)); |
2489 | 2496 | ||
2490 | return 0; | 2497 | return 0; |
@@ -2506,6 +2513,7 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR | |||
2506 | VirtDevice *vdevice; | 2513 | VirtDevice *vdevice; |
2507 | SCSIIORequest_t *pReq; | 2514 | SCSIIORequest_t *pReq; |
2508 | u32 sense_count = le32_to_cpu(pScsiReply->SenseCount); | 2515 | u32 sense_count = le32_to_cpu(pScsiReply->SenseCount); |
2516 | MPT_ADAPTER *ioc = hd->ioc; | ||
2509 | 2517 | ||
2510 | /* Get target structure | 2518 | /* Get target structure |
2511 | */ | 2519 | */ |
@@ -2518,15 +2526,14 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR | |||
2518 | 2526 | ||
2519 | /* Copy the sense received into the scsi command block. */ | 2527 | /* Copy the sense received into the scsi command block. */ |
2520 | req_index = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx); | 2528 | req_index = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx); |
2521 | sense_data = ((u8 *)hd->ioc->sense_buf_pool + (req_index * MPT_SENSE_BUFFER_ALLOC)); | 2529 | sense_data = ((u8 *)ioc->sense_buf_pool + (req_index * MPT_SENSE_BUFFER_ALLOC)); |
2522 | memcpy(sc->sense_buffer, sense_data, SNS_LEN(sc)); | 2530 | memcpy(sc->sense_buffer, sense_data, SNS_LEN(sc)); |
2523 | 2531 | ||
2524 | /* Log SMART data (asc = 0x5D, non-IM case only) if required. | 2532 | /* Log SMART data (asc = 0x5D, non-IM case only) if required. |
2525 | */ | 2533 | */ |
2526 | if ((hd->ioc->events) && (hd->ioc->eventTypes & (1 << MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE))) { | 2534 | if ((ioc->events) && (ioc->eventTypes & (1 << MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE))) { |
2527 | if ((sense_data[12] == 0x5D) && (vdevice->vtarget->raidVolume == 0)) { | 2535 | if ((sense_data[12] == 0x5D) && (vdevice->vtarget->raidVolume == 0)) { |
2528 | int idx; | 2536 | int idx; |
2529 | MPT_ADAPTER *ioc = hd->ioc; | ||
2530 | 2537 | ||
2531 | idx = ioc->eventContext % MPTCTL_EVENT_LOG_SIZE; | 2538 | idx = ioc->eventContext % MPTCTL_EVENT_LOG_SIZE; |
2532 | ioc->events[idx].event = MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE; | 2539 | ioc->events[idx].event = MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE; |
@@ -2539,9 +2546,9 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR | |||
2539 | ioc->events[idx].data[1] = (sense_data[13] << 8) | sense_data[12]; | 2546 | ioc->events[idx].data[1] = (sense_data[13] << 8) | sense_data[12]; |
2540 | 2547 | ||
2541 | ioc->eventContext++; | 2548 | ioc->eventContext++; |
2542 | if (hd->ioc->pcidev->vendor == | 2549 | if (ioc->pcidev->vendor == |
2543 | PCI_VENDOR_ID_IBM) { | 2550 | PCI_VENDOR_ID_IBM) { |
2544 | mptscsih_issue_sep_command(hd->ioc, | 2551 | mptscsih_issue_sep_command(ioc, |
2545 | vdevice->vtarget, MPI_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT); | 2552 | vdevice->vtarget, MPI_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT); |
2546 | vdevice->vtarget->tflags |= | 2553 | vdevice->vtarget->tflags |= |
2547 | MPT_TARGET_FLAGS_LED_ON; | 2554 | MPT_TARGET_FLAGS_LED_ON; |
@@ -2549,8 +2556,8 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR | |||
2549 | } | 2556 | } |
2550 | } | 2557 | } |
2551 | } else { | 2558 | } else { |
2552 | dprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Hmmm... SenseData len=0! (?)\n", | 2559 | dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Hmmm... SenseData len=0! (?)\n", |
2553 | hd->ioc->name)); | 2560 | ioc->name)); |
2554 | } | 2561 | } |
2555 | } | 2562 | } |
2556 | 2563 | ||
@@ -2635,7 +2642,7 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | |||
2635 | 2642 | ||
2636 | /* ScsiLookup initialization | 2643 | /* ScsiLookup initialization |
2637 | */ | 2644 | */ |
2638 | for (ii=0; ii < hd->ioc->req_depth; ii++) | 2645 | for (ii=0; ii < ioc->req_depth; ii++) |
2639 | hd->ScsiLookup[ii] = NULL; | 2646 | hd->ScsiLookup[ii] = NULL; |
2640 | 2647 | ||
2641 | /* 2. Chain Buffer initialization | 2648 | /* 2. Chain Buffer initialization |
@@ -2780,12 +2787,12 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) | |||
2780 | 2787 | ||
2781 | if (mf != hd->cmdPtr) { | 2788 | if (mf != hd->cmdPtr) { |
2782 | printk(MYIOC_s_WARN_FMT "ScanDvComplete (mf=%p, cmdPtr=%p, idx=%d)\n", | 2789 | printk(MYIOC_s_WARN_FMT "ScanDvComplete (mf=%p, cmdPtr=%p, idx=%d)\n", |
2783 | hd->ioc->name, (void *)mf, (void *) hd->cmdPtr, req_idx); | 2790 | ioc->name, (void *)mf, (void *) hd->cmdPtr, req_idx); |
2784 | } | 2791 | } |
2785 | hd->cmdPtr = NULL; | 2792 | hd->cmdPtr = NULL; |
2786 | 2793 | ||
2787 | ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScanDvComplete (mf=%p,mr=%p,idx=%d)\n", | 2794 | ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScanDvComplete (mf=%p,mr=%p,idx=%d)\n", |
2788 | hd->ioc->name, mf, mr, req_idx)); | 2795 | ioc->name, mf, mr, req_idx)); |
2789 | 2796 | ||
2790 | hd->pLocal = &hd->localReply; | 2797 | hd->pLocal = &hd->localReply; |
2791 | hd->pLocal->scsiStatus = 0; | 2798 | hd->pLocal->scsiStatus = 0; |
@@ -2849,7 +2856,7 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) | |||
2849 | */ | 2856 | */ |
2850 | completionCode = MPT_SCANDV_SENSE; | 2857 | completionCode = MPT_SCANDV_SENSE; |
2851 | hd->pLocal->scsiStatus = scsi_status; | 2858 | hd->pLocal->scsiStatus = scsi_status; |
2852 | sense_data = ((u8 *)hd->ioc->sense_buf_pool + | 2859 | sense_data = ((u8 *)ioc->sense_buf_pool + |
2853 | (req_idx * MPT_SENSE_BUFFER_ALLOC)); | 2860 | (req_idx * MPT_SENSE_BUFFER_ALLOC)); |
2854 | 2861 | ||
2855 | sz = min_t(int, pReq->SenseBufferLength, | 2862 | sz = min_t(int, pReq->SenseBufferLength, |
@@ -2916,8 +2923,9 @@ void | |||
2916 | mptscsih_timer_expired(unsigned long data) | 2923 | mptscsih_timer_expired(unsigned long data) |
2917 | { | 2924 | { |
2918 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *) data; | 2925 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *) data; |
2926 | MPT_ADAPTER *ioc = hd->ioc; | ||
2919 | 2927 | ||
2920 | ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Timer Expired! Cmd %p\n", hd->ioc->name, hd->cmdPtr)); | 2928 | ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Timer Expired! Cmd %p\n", ioc->name, hd->cmdPtr)); |
2921 | 2929 | ||
2922 | if (hd->cmdPtr) { | 2930 | if (hd->cmdPtr) { |
2923 | MPIHeader_t *cmd = (MPIHeader_t *)hd->cmdPtr; | 2931 | MPIHeader_t *cmd = (MPIHeader_t *)hd->cmdPtr; |
@@ -2931,13 +2939,13 @@ mptscsih_timer_expired(unsigned long data) | |||
2931 | */ | 2939 | */ |
2932 | } else { | 2940 | } else { |
2933 | /* Perform a FW reload */ | 2941 | /* Perform a FW reload */ |
2934 | if (mpt_HardResetHandler(hd->ioc, NO_SLEEP) < 0) { | 2942 | if (mpt_HardResetHandler(ioc, NO_SLEEP) < 0) { |
2935 | printk(MYIOC_s_WARN_FMT "Firmware Reload FAILED!\n", hd->ioc->name); | 2943 | printk(MYIOC_s_WARN_FMT "Firmware Reload FAILED!\n", ioc->name); |
2936 | } | 2944 | } |
2937 | } | 2945 | } |
2938 | } else { | 2946 | } else { |
2939 | /* This should NEVER happen */ | 2947 | /* This should NEVER happen */ |
2940 | printk(MYIOC_s_WARN_FMT "Null cmdPtr!!!!\n", hd->ioc->name); | 2948 | printk(MYIOC_s_WARN_FMT "Null cmdPtr!!!!\n", ioc->name); |
2941 | } | 2949 | } |
2942 | 2950 | ||
2943 | /* No more processing. | 2951 | /* No more processing. |
@@ -2945,7 +2953,7 @@ mptscsih_timer_expired(unsigned long data) | |||
2945 | * The FW will reply to all outstanding commands, callback will finish cleanup. | 2953 | * The FW will reply to all outstanding commands, callback will finish cleanup. |
2946 | * Hard reset clean-up will free all resources. | 2954 | * Hard reset clean-up will free all resources. |
2947 | */ | 2955 | */ |
2948 | ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Timer Expired Complete!\n", hd->ioc->name)); | 2956 | ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Timer Expired Complete!\n", ioc->name)); |
2949 | 2957 | ||
2950 | return; | 2958 | return; |
2951 | } | 2959 | } |
@@ -2983,11 +2991,12 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io) | |||
2983 | char cmdLen; | 2991 | char cmdLen; |
2984 | char CDB[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; | 2992 | char CDB[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; |
2985 | char cmd = io->cmd; | 2993 | char cmd = io->cmd; |
2994 | MPT_ADAPTER *ioc = hd->ioc; | ||
2986 | 2995 | ||
2987 | in_isr = in_interrupt(); | 2996 | in_isr = in_interrupt(); |
2988 | if (in_isr) { | 2997 | if (in_isr) { |
2989 | dprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Internal SCSI IO request not allowed in ISR context!\n", | 2998 | dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Internal SCSI IO request not allowed in ISR context!\n", |
2990 | hd->ioc->name)); | 2999 | ioc->name)); |
2991 | return -EPERM; | 3000 | return -EPERM; |
2992 | } | 3001 | } |
2993 | 3002 | ||
@@ -3088,9 +3097,9 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io) | |||
3088 | 3097 | ||
3089 | /* Get and Populate a free Frame | 3098 | /* Get and Populate a free Frame |
3090 | */ | 3099 | */ |
3091 | if ((mf = mpt_get_msg_frame(hd->ioc->InternalCtx, hd->ioc)) == NULL) { | 3100 | if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) { |
3092 | dfailprintk(hd->ioc, printk(MYIOC_s_WARN_FMT "No msg frames!\n", | 3101 | dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "No msg frames!\n", |
3093 | hd->ioc->name)); | 3102 | ioc->name)); |
3094 | return -EBUSY; | 3103 | return -EBUSY; |
3095 | } | 3104 | } |
3096 | 3105 | ||
@@ -3129,19 +3138,19 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io) | |||
3129 | 3138 | ||
3130 | if (cmd == REQUEST_SENSE) { | 3139 | if (cmd == REQUEST_SENSE) { |
3131 | pScsiReq->Control = cpu_to_le32(dir | MPI_SCSIIO_CONTROL_UNTAGGED); | 3140 | pScsiReq->Control = cpu_to_le32(dir | MPI_SCSIIO_CONTROL_UNTAGGED); |
3132 | ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Untagged! 0x%2x\n", | 3141 | ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Untagged! 0x%2x\n", |
3133 | hd->ioc->name, cmd)); | 3142 | ioc->name, cmd)); |
3134 | } | 3143 | } |
3135 | 3144 | ||
3136 | for (ii=0; ii < 16; ii++) | 3145 | for (ii=0; ii < 16; ii++) |
3137 | pScsiReq->CDB[ii] = CDB[ii]; | 3146 | pScsiReq->CDB[ii] = CDB[ii]; |
3138 | 3147 | ||
3139 | pScsiReq->DataLength = cpu_to_le32(io->size); | 3148 | pScsiReq->DataLength = cpu_to_le32(io->size); |
3140 | pScsiReq->SenseBufferLowAddr = cpu_to_le32(hd->ioc->sense_buf_low_dma | 3149 | pScsiReq->SenseBufferLowAddr = cpu_to_le32(ioc->sense_buf_low_dma |
3141 | + (my_idx * MPT_SENSE_BUFFER_ALLOC)); | 3150 | + (my_idx * MPT_SENSE_BUFFER_ALLOC)); |
3142 | 3151 | ||
3143 | ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Sending Command 0x%x for (%d:%d:%d)\n", | 3152 | ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending Command 0x%x for (%d:%d:%d)\n", |
3144 | hd->ioc->name, cmd, io->channel, io->id, io->lun)); | 3153 | ioc->name, cmd, io->channel, io->id, io->lun)); |
3145 | 3154 | ||
3146 | if (dir == MPI_SCSIIO_CONTROL_READ) { | 3155 | if (dir == MPI_SCSIIO_CONTROL_READ) { |
3147 | mpt_add_sge((char *) &pScsiReq->SGL, | 3156 | mpt_add_sge((char *) &pScsiReq->SGL, |
@@ -3176,7 +3185,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io) | |||
3176 | hd->cmdPtr = mf; | 3185 | hd->cmdPtr = mf; |
3177 | 3186 | ||
3178 | add_timer(&hd->timer); | 3187 | add_timer(&hd->timer); |
3179 | mpt_put_msg_frame(hd->ioc->InternalCtx, hd->ioc, mf); | 3188 | mpt_put_msg_frame(ioc->InternalCtx, ioc, mf); |
3180 | wait_event(hd->scandv_waitq, hd->scandv_wait_done); | 3189 | wait_event(hd->scandv_waitq, hd->scandv_wait_done); |
3181 | 3190 | ||
3182 | if (hd->pLocal) { | 3191 | if (hd->pLocal) { |
@@ -3192,8 +3201,8 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io) | |||
3192 | } else { | 3201 | } else { |
3193 | rc = -EFAULT; | 3202 | rc = -EFAULT; |
3194 | /* This should never happen. */ | 3203 | /* This should never happen. */ |
3195 | ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "_do_cmd: Null pLocal!!!\n", | 3204 | ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "_do_cmd: Null pLocal!!!\n", |
3196 | hd->ioc->name)); | 3205 | ioc->name)); |
3197 | } | 3206 | } |
3198 | 3207 | ||
3199 | return rc; | 3208 | return rc; |
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c index 4248bf331e13..02062f198be3 100644 --- a/drivers/message/fusion/mptspi.c +++ b/drivers/message/fusion/mptspi.c | |||
@@ -107,7 +107,8 @@ static void | |||
107 | mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target, | 107 | mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target, |
108 | struct scsi_device *sdev) | 108 | struct scsi_device *sdev) |
109 | { | 109 | { |
110 | SpiCfgData *pspi_data = &hd->ioc->spi_data; | 110 | MPT_ADAPTER *ioc = hd->ioc; |
111 | SpiCfgData *pspi_data = &ioc->spi_data; | ||
111 | int id = (int) target->id; | 112 | int id = (int) target->id; |
112 | int nvram; | 113 | int nvram; |
113 | u8 width = MPT_NARROW; | 114 | u8 width = MPT_NARROW; |
@@ -138,9 +139,9 @@ mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target, | |||
138 | else { | 139 | else { |
139 | factor = MPT_ULTRA320; | 140 | factor = MPT_ULTRA320; |
140 | if (scsi_device_qas(sdev)) { | 141 | if (scsi_device_qas(sdev)) { |
141 | ddvprintk(hd->ioc, | 142 | ddvprintk(ioc, |
142 | printk(MYIOC_s_DEBUG_FMT "Enabling QAS due to " | 143 | printk(MYIOC_s_DEBUG_FMT "Enabling QAS due to " |
143 | "byte56=%02x on id=%d!\n", hd->ioc->name, | 144 | "byte56=%02x on id=%d!\n", ioc->name, |
144 | scsi_device_qas(sdev), id)); | 145 | scsi_device_qas(sdev), id)); |
145 | noQas = 0; | 146 | noQas = 0; |
146 | } | 147 | } |
@@ -228,8 +229,8 @@ mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target, | |||
228 | /* Disable QAS in a mixed configuration case | 229 | /* Disable QAS in a mixed configuration case |
229 | */ | 230 | */ |
230 | 231 | ||
231 | ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT | 232 | ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT |
232 | "Disabling QAS due to noQas=%02x on id=%d!\n", hd->ioc->name, noQas, id)); | 233 | "Disabling QAS due to noQas=%02x on id=%d!\n", ioc->name, noQas, id)); |
233 | } | 234 | } |
234 | } | 235 | } |
235 | 236 | ||
@@ -375,14 +376,15 @@ static int | |||
375 | mptspi_is_raid(struct _MPT_SCSI_HOST *hd, u32 id) | 376 | mptspi_is_raid(struct _MPT_SCSI_HOST *hd, u32 id) |
376 | { | 377 | { |
377 | int i, rc = 0; | 378 | int i, rc = 0; |
379 | MPT_ADAPTER *ioc = hd->ioc; | ||
378 | 380 | ||
379 | if (!hd->ioc->raid_data.pIocPg2) | 381 | if (!ioc->raid_data.pIocPg2) |
380 | goto out; | 382 | goto out; |
381 | 383 | ||
382 | if (!hd->ioc->raid_data.pIocPg2->NumActiveVolumes) | 384 | if (!ioc->raid_data.pIocPg2->NumActiveVolumes) |
383 | goto out; | 385 | goto out; |
384 | for (i=0; i < hd->ioc->raid_data.pIocPg2->NumActiveVolumes; i++) { | 386 | for (i=0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) { |
385 | if (hd->ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID == id) { | 387 | if (ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID == id) { |
386 | rc = 1; | 388 | rc = 1; |
387 | goto out; | 389 | goto out; |
388 | } | 390 | } |
@@ -397,15 +399,17 @@ static int mptspi_target_alloc(struct scsi_target *starget) | |||
397 | struct Scsi_Host *shost = dev_to_shost(&starget->dev); | 399 | struct Scsi_Host *shost = dev_to_shost(&starget->dev); |
398 | struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)shost->hostdata; | 400 | struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)shost->hostdata; |
399 | VirtTarget *vtarget; | 401 | VirtTarget *vtarget; |
402 | MPT_ADAPTER *ioc; | ||
400 | 403 | ||
401 | if (hd == NULL) | 404 | if (hd == NULL) |
402 | return -ENODEV; | 405 | return -ENODEV; |
403 | 406 | ||
407 | ioc = hd->ioc; | ||
404 | vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL); | 408 | vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL); |
405 | if (!vtarget) | 409 | if (!vtarget) |
406 | return -ENOMEM; | 410 | return -ENOMEM; |
407 | 411 | ||
408 | vtarget->ioc_id = hd->ioc->id; | 412 | vtarget->ioc_id = ioc->id; |
409 | vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; | 413 | vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; |
410 | vtarget->id = (u8)starget->id; | 414 | vtarget->id = (u8)starget->id; |
411 | vtarget->channel = (u8)starget->channel; | 415 | vtarget->channel = (u8)starget->channel; |
@@ -413,34 +417,34 @@ static int mptspi_target_alloc(struct scsi_target *starget) | |||
413 | starget->hostdata = vtarget; | 417 | starget->hostdata = vtarget; |
414 | 418 | ||
415 | if (starget->channel == 1) { | 419 | if (starget->channel == 1) { |
416 | if (mptscsih_is_phys_disk(hd->ioc, 0, starget->id) == 0) | 420 | if (mptscsih_is_phys_disk(ioc, 0, starget->id) == 0) |
417 | return 0; | 421 | return 0; |
418 | vtarget->tflags |= MPT_TARGET_FLAGS_RAID_COMPONENT; | 422 | vtarget->tflags |= MPT_TARGET_FLAGS_RAID_COMPONENT; |
419 | /* The real channel for this device is zero */ | 423 | /* The real channel for this device is zero */ |
420 | vtarget->channel = 0; | 424 | vtarget->channel = 0; |
421 | /* The actual physdisknum (for RAID passthrough) */ | 425 | /* The actual physdisknum (for RAID passthrough) */ |
422 | vtarget->id = mptscsih_raid_id_to_num(hd->ioc, 0, | 426 | vtarget->id = mptscsih_raid_id_to_num(ioc, 0, |
423 | starget->id); | 427 | starget->id); |
424 | } | 428 | } |
425 | 429 | ||
426 | if (starget->channel == 0 && | 430 | if (starget->channel == 0 && |
427 | mptspi_is_raid(hd, starget->id)) { | 431 | mptspi_is_raid(hd, starget->id)) { |
428 | vtarget->raidVolume = 1; | 432 | vtarget->raidVolume = 1; |
429 | ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT | 433 | ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT |
430 | "RAID Volume @ channel=%d id=%d\n", hd->ioc->name, starget->channel, | 434 | "RAID Volume @ channel=%d id=%d\n", ioc->name, starget->channel, |
431 | starget->id)); | 435 | starget->id)); |
432 | } | 436 | } |
433 | 437 | ||
434 | if (hd->ioc->spi_data.nvram && | 438 | if (ioc->spi_data.nvram && |
435 | hd->ioc->spi_data.nvram[starget->id] != MPT_HOST_NVRAM_INVALID) { | 439 | ioc->spi_data.nvram[starget->id] != MPT_HOST_NVRAM_INVALID) { |
436 | u32 nvram = hd->ioc->spi_data.nvram[starget->id]; | 440 | u32 nvram = ioc->spi_data.nvram[starget->id]; |
437 | spi_min_period(starget) = (nvram & MPT_NVRAM_SYNC_MASK) >> MPT_NVRAM_SYNC_SHIFT; | 441 | spi_min_period(starget) = (nvram & MPT_NVRAM_SYNC_MASK) >> MPT_NVRAM_SYNC_SHIFT; |
438 | spi_max_width(starget) = nvram & MPT_NVRAM_WIDE_DISABLE ? 0 : 1; | 442 | spi_max_width(starget) = nvram & MPT_NVRAM_WIDE_DISABLE ? 0 : 1; |
439 | } else { | 443 | } else { |
440 | spi_min_period(starget) = hd->ioc->spi_data.minSyncFactor; | 444 | spi_min_period(starget) = ioc->spi_data.minSyncFactor; |
441 | spi_max_width(starget) = hd->ioc->spi_data.maxBusWidth; | 445 | spi_max_width(starget) = ioc->spi_data.maxBusWidth; |
442 | } | 446 | } |
443 | spi_max_offset(starget) = hd->ioc->spi_data.maxSyncOffset; | 447 | spi_max_offset(starget) = ioc->spi_data.maxSyncOffset; |
444 | 448 | ||
445 | spi_offset(starget) = 0; | 449 | spi_offset(starget) = 0; |
446 | mptspi_write_width(starget, 0); | 450 | mptspi_write_width(starget, 0); |
@@ -614,12 +618,13 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id) | |||
614 | { | 618 | { |
615 | MpiRaidActionRequest_t *pReq; | 619 | MpiRaidActionRequest_t *pReq; |
616 | MPT_FRAME_HDR *mf; | 620 | MPT_FRAME_HDR *mf; |
621 | MPT_ADAPTER *ioc = hd->ioc; | ||
617 | 622 | ||
618 | /* Get and Populate a free Frame | 623 | /* Get and Populate a free Frame |
619 | */ | 624 | */ |
620 | if ((mf = mpt_get_msg_frame(hd->ioc->InternalCtx, hd->ioc)) == NULL) { | 625 | if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) { |
621 | ddvprintk(hd->ioc, printk(MYIOC_s_WARN_FMT "_do_raid: no msg frames!\n", | 626 | ddvprintk(ioc, printk(MYIOC_s_WARN_FMT "_do_raid: no msg frames!\n", |
622 | hd->ioc->name)); | 627 | ioc->name)); |
623 | return -EAGAIN; | 628 | return -EAGAIN; |
624 | } | 629 | } |
625 | pReq = (MpiRaidActionRequest_t *)mf; | 630 | pReq = (MpiRaidActionRequest_t *)mf; |
@@ -640,8 +645,8 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id) | |||
640 | mpt_add_sge((char *)&pReq->ActionDataSGE, | 645 | mpt_add_sge((char *)&pReq->ActionDataSGE, |
641 | MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1); | 646 | MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1); |
642 | 647 | ||
643 | ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "RAID Volume action=%x channel=%d id=%d\n", | 648 | ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RAID Volume action=%x channel=%d id=%d\n", |
644 | hd->ioc->name, pReq->Action, channel, id)); | 649 | ioc->name, pReq->Action, channel, id)); |
645 | 650 | ||
646 | hd->pLocal = NULL; | 651 | hd->pLocal = NULL; |
647 | hd->timer.expires = jiffies + HZ*10; /* 10 second timeout */ | 652 | hd->timer.expires = jiffies + HZ*10; /* 10 second timeout */ |
@@ -653,7 +658,7 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id) | |||
653 | hd->cmdPtr = mf; | 658 | hd->cmdPtr = mf; |
654 | 659 | ||
655 | add_timer(&hd->timer); | 660 | add_timer(&hd->timer); |
656 | mpt_put_msg_frame(hd->ioc->InternalCtx, hd->ioc, mf); | 661 | mpt_put_msg_frame(ioc->InternalCtx, ioc, mf); |
657 | wait_event(hd->scandv_waitq, hd->scandv_wait_done); | 662 | wait_event(hd->scandv_waitq, hd->scandv_wait_done); |
658 | 663 | ||
659 | if ((hd->pLocal == NULL) || (hd->pLocal->completion != 0)) | 664 | if ((hd->pLocal == NULL) || (hd->pLocal->completion != 0)) |
@@ -666,6 +671,7 @@ static void mptspi_dv_device(struct _MPT_SCSI_HOST *hd, | |||
666 | struct scsi_device *sdev) | 671 | struct scsi_device *sdev) |
667 | { | 672 | { |
668 | VirtTarget *vtarget = scsi_target(sdev)->hostdata; | 673 | VirtTarget *vtarget = scsi_target(sdev)->hostdata; |
674 | MPT_ADAPTER *ioc = hd->ioc; | ||
669 | 675 | ||
670 | /* no DV on RAID devices */ | 676 | /* no DV on RAID devices */ |
671 | if (sdev->channel == 0 && | 677 | if (sdev->channel == 0 && |
@@ -676,7 +682,7 @@ static void mptspi_dv_device(struct _MPT_SCSI_HOST *hd, | |||
676 | if (sdev->channel == 1 && | 682 | if (sdev->channel == 1 && |
677 | mptscsih_quiesce_raid(hd, 1, vtarget->channel, vtarget->id) < 0) { | 683 | mptscsih_quiesce_raid(hd, 1, vtarget->channel, vtarget->id) < 0) { |
678 | starget_printk(MYIOC_s_ERR_FMT, scsi_target(sdev), | 684 | starget_printk(MYIOC_s_ERR_FMT, scsi_target(sdev), |
679 | "Integrated RAID quiesce failed\n", hd->ioc->name); | 685 | "Integrated RAID quiesce failed\n", ioc->name); |
680 | return; | 686 | return; |
681 | } | 687 | } |
682 | 688 | ||
@@ -687,7 +693,7 @@ static void mptspi_dv_device(struct _MPT_SCSI_HOST *hd, | |||
687 | if (sdev->channel == 1 && | 693 | if (sdev->channel == 1 && |
688 | mptscsih_quiesce_raid(hd, 0, vtarget->channel, vtarget->id) < 0) | 694 | mptscsih_quiesce_raid(hd, 0, vtarget->channel, vtarget->id) < 0) |
689 | starget_printk(MYIOC_s_ERR_FMT, scsi_target(sdev), | 695 | starget_printk(MYIOC_s_ERR_FMT, scsi_target(sdev), |
690 | "Integrated RAID resume failed\n", hd->ioc->name); | 696 | "Integrated RAID resume failed\n", ioc->name); |
691 | 697 | ||
692 | mptspi_read_parameters(sdev->sdev_target); | 698 | mptspi_read_parameters(sdev->sdev_target); |
693 | spi_display_xfer_agreement(sdev->sdev_target); | 699 | spi_display_xfer_agreement(sdev->sdev_target); |
@@ -700,15 +706,16 @@ static int mptspi_slave_alloc(struct scsi_device *sdev) | |||
700 | VirtTarget *vtarget; | 706 | VirtTarget *vtarget; |
701 | VirtDevice *vdevice; | 707 | VirtDevice *vdevice; |
702 | struct scsi_target *starget; | 708 | struct scsi_target *starget; |
709 | MPT_ADAPTER *ioc = hd->ioc; | ||
703 | 710 | ||
704 | if (sdev->channel == 1 && | 711 | if (sdev->channel == 1 && |
705 | mptscsih_is_phys_disk(hd->ioc, 0, sdev->id) == 0) | 712 | mptscsih_is_phys_disk(ioc, 0, sdev->id) == 0) |
706 | return -ENXIO; | 713 | return -ENXIO; |
707 | 714 | ||
708 | vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL); | 715 | vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL); |
709 | if (!vdevice) { | 716 | if (!vdevice) { |
710 | printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n", | 717 | printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n", |
711 | hd->ioc->name, sizeof(VirtDevice)); | 718 | ioc->name, sizeof(VirtDevice)); |
712 | return -ENOMEM; | 719 | return -ENOMEM; |
713 | } | 720 | } |
714 | 721 | ||
@@ -759,6 +766,7 @@ mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
759 | { | 766 | { |
760 | struct _MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata; | 767 | struct _MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata; |
761 | VirtDevice *vdevice = SCpnt->device->hostdata; | 768 | VirtDevice *vdevice = SCpnt->device->hostdata; |
769 | MPT_ADAPTER *ioc = hd->ioc; | ||
762 | 770 | ||
763 | if (!vdevice || !vdevice->vtarget) { | 771 | if (!vdevice || !vdevice->vtarget) { |
764 | SCpnt->result = DID_NO_CONNECT << 16; | 772 | SCpnt->result = DID_NO_CONNECT << 16; |
@@ -767,14 +775,14 @@ mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
767 | } | 775 | } |
768 | 776 | ||
769 | if (SCpnt->device->channel == 1 && | 777 | if (SCpnt->device->channel == 1 && |
770 | mptscsih_is_phys_disk(hd->ioc, 0, SCpnt->device->id) == 0) { | 778 | mptscsih_is_phys_disk(ioc, 0, SCpnt->device->id) == 0) { |
771 | SCpnt->result = DID_NO_CONNECT << 16; | 779 | SCpnt->result = DID_NO_CONNECT << 16; |
772 | done(SCpnt); | 780 | done(SCpnt); |
773 | return 0; | 781 | return 0; |
774 | } | 782 | } |
775 | 783 | ||
776 | if (spi_dv_pending(scsi_target(SCpnt->device))) | 784 | if (spi_dv_pending(scsi_target(SCpnt->device))) |
777 | ddvprintk(hd->ioc, scsi_print_command(SCpnt)); | 785 | ddvprintk(ioc, scsi_print_command(SCpnt)); |
778 | 786 | ||
779 | return mptscsih_qcmd(SCpnt,done); | 787 | return mptscsih_qcmd(SCpnt,done); |
780 | } | 788 | } |
@@ -1071,15 +1079,16 @@ static void mpt_work_wrapper(struct work_struct *work) | |||
1071 | struct work_queue_wrapper *wqw = | 1079 | struct work_queue_wrapper *wqw = |
1072 | container_of(work, struct work_queue_wrapper, work); | 1080 | container_of(work, struct work_queue_wrapper, work); |
1073 | struct _MPT_SCSI_HOST *hd = wqw->hd; | 1081 | struct _MPT_SCSI_HOST *hd = wqw->hd; |
1074 | struct Scsi_Host *shost = hd->ioc->sh; | 1082 | MPT_ADAPTER *ioc = hd->ioc; |
1083 | struct Scsi_Host *shost = ioc->sh; | ||
1075 | struct scsi_device *sdev; | 1084 | struct scsi_device *sdev; |
1076 | int disk = wqw->disk; | 1085 | int disk = wqw->disk; |
1077 | struct _CONFIG_PAGE_IOC_3 *pg3; | 1086 | struct _CONFIG_PAGE_IOC_3 *pg3; |
1078 | 1087 | ||
1079 | kfree(wqw); | 1088 | kfree(wqw); |
1080 | 1089 | ||
1081 | mpt_findImVolumes(hd->ioc); | 1090 | mpt_findImVolumes(ioc); |
1082 | pg3 = hd->ioc->raid_data.pIocPg3; | 1091 | pg3 = ioc->raid_data.pIocPg3; |
1083 | if (!pg3) | 1092 | if (!pg3) |
1084 | return; | 1093 | return; |
1085 | 1094 | ||
@@ -1097,23 +1106,24 @@ static void mpt_work_wrapper(struct work_struct *work) | |||
1097 | continue; | 1106 | continue; |
1098 | 1107 | ||
1099 | starget_printk(MYIOC_s_INFO_FMT, vtarget->starget, | 1108 | starget_printk(MYIOC_s_INFO_FMT, vtarget->starget, |
1100 | "Integrated RAID requests DV of new device\n", hd->ioc->name); | 1109 | "Integrated RAID requests DV of new device\n", ioc->name); |
1101 | mptspi_dv_device(hd, sdev); | 1110 | mptspi_dv_device(hd, sdev); |
1102 | } | 1111 | } |
1103 | shost_printk(MYIOC_s_INFO_FMT, shost, | 1112 | shost_printk(MYIOC_s_INFO_FMT, shost, |
1104 | "Integrated RAID detects new device %d\n", hd->ioc->name, disk); | 1113 | "Integrated RAID detects new device %d\n", ioc->name, disk); |
1105 | scsi_scan_target(&hd->ioc->sh->shost_gendev, 1, disk, 0, 1); | 1114 | scsi_scan_target(&ioc->sh->shost_gendev, 1, disk, 0, 1); |
1106 | } | 1115 | } |
1107 | 1116 | ||
1108 | 1117 | ||
1109 | static void mpt_dv_raid(struct _MPT_SCSI_HOST *hd, int disk) | 1118 | static void mpt_dv_raid(struct _MPT_SCSI_HOST *hd, int disk) |
1110 | { | 1119 | { |
1111 | struct work_queue_wrapper *wqw = kmalloc(sizeof(*wqw), GFP_ATOMIC); | 1120 | struct work_queue_wrapper *wqw = kmalloc(sizeof(*wqw), GFP_ATOMIC); |
1121 | MPT_ADAPTER *ioc = hd->ioc; | ||
1112 | 1122 | ||
1113 | if (!wqw) { | 1123 | if (!wqw) { |
1114 | shost_printk(MYIOC_s_ERR_FMT, hd->ioc->sh, | 1124 | shost_printk(MYIOC_s_ERR_FMT, ioc->sh, |
1115 | "Failed to act on RAID event for physical disk %d\n", | 1125 | "Failed to act on RAID event for physical disk %d\n", |
1116 | hd->ioc->name, disk); | 1126 | ioc->name, disk); |
1117 | return; | 1127 | return; |
1118 | } | 1128 | } |
1119 | INIT_WORK(&wqw->work, mpt_work_wrapper); | 1129 | INIT_WORK(&wqw->work, mpt_work_wrapper); |
@@ -1216,11 +1226,12 @@ mptspi_dv_renegotiate_work(struct work_struct *work) | |||
1216 | struct scsi_target *starget; | 1226 | struct scsi_target *starget; |
1217 | struct _CONFIG_PAGE_SCSI_DEVICE_1 pg1; | 1227 | struct _CONFIG_PAGE_SCSI_DEVICE_1 pg1; |
1218 | u32 nego; | 1228 | u32 nego; |
1229 | MPT_ADAPTER *ioc = hd->ioc; | ||
1219 | 1230 | ||
1220 | kfree(wqw); | 1231 | kfree(wqw); |
1221 | 1232 | ||
1222 | if (hd->spi_pending) { | 1233 | if (hd->spi_pending) { |
1223 | shost_for_each_device(sdev, hd->ioc->sh) { | 1234 | shost_for_each_device(sdev, ioc->sh) { |
1224 | if (hd->spi_pending & (1 << sdev->id)) | 1235 | if (hd->spi_pending & (1 << sdev->id)) |
1225 | continue; | 1236 | continue; |
1226 | starget = scsi_target(sdev); | 1237 | starget = scsi_target(sdev); |
@@ -1231,7 +1242,7 @@ mptspi_dv_renegotiate_work(struct work_struct *work) | |||
1231 | mptspi_write_spi_device_pg1(starget, &pg1); | 1242 | mptspi_write_spi_device_pg1(starget, &pg1); |
1232 | } | 1243 | } |
1233 | } else { | 1244 | } else { |
1234 | shost_for_each_device(sdev, hd->ioc->sh) | 1245 | shost_for_each_device(sdev, ioc->sh) |
1235 | mptspi_dv_device(hd, sdev); | 1246 | mptspi_dv_device(hd, sdev); |
1236 | } | 1247 | } |
1237 | } | 1248 | } |
@@ -1483,7 +1494,7 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1483 | 1494 | ||
1484 | /* Some versions of the firmware don't support page 0; without | 1495 | /* Some versions of the firmware don't support page 0; without |
1485 | * that we can't get the parameters */ | 1496 | * that we can't get the parameters */ |
1486 | if (hd->ioc->spi_data.sdp0length != 0) | 1497 | if (ioc->spi_data.sdp0length != 0) |
1487 | sh->transportt = mptspi_transport_template; | 1498 | sh->transportt = mptspi_transport_template; |
1488 | 1499 | ||
1489 | error = scsi_add_host (sh, &ioc->pcidev->dev); | 1500 | error = scsi_add_host (sh, &ioc->pcidev->dev); |