aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2014-11-19 05:32:12 -0500
committerJames Morris <james.l.morris@oracle.com>2014-11-19 05:32:12 -0500
commitb10778a00d40b3d9fdaaf5891e802794781ff71c (patch)
tree6ba4cbac86eecedc3f30650e7f764ecf00c83898 /drivers/message/fusion
parent594081ee7145cc30a3977cb4e218f81213b63dc5 (diff)
parentbfe01a5ba2490f299e1d2d5508cbbbadd897bbe9 (diff)
Merge commit 'v3.17' into next
Diffstat (limited to 'drivers/message/fusion')
-rw-r--r--drivers/message/fusion/Kconfig2
-rw-r--r--drivers/message/fusion/mptbase.c23
-rw-r--r--drivers/message/fusion/mptbase.h4
-rw-r--r--drivers/message/fusion/mptctl.c18
-rw-r--r--drivers/message/fusion/mptfc.c9
-rw-r--r--drivers/message/fusion/mptsas.c76
-rw-r--r--drivers/message/fusion/mptsas.h2
-rw-r--r--drivers/message/fusion/mptscsih.c31
-rw-r--r--drivers/message/fusion/mptscsih.h4
-rw-r--r--drivers/message/fusion/mptspi.c5
10 files changed, 76 insertions, 98 deletions
diff --git a/drivers/message/fusion/Kconfig b/drivers/message/fusion/Kconfig
index a34a11d2fef2..63ca9841db10 100644
--- a/drivers/message/fusion/Kconfig
+++ b/drivers/message/fusion/Kconfig
@@ -29,7 +29,7 @@ config FUSION_SPI
29config FUSION_FC 29config FUSION_FC
30 tristate "Fusion MPT ScsiHost drivers for FC" 30 tristate "Fusion MPT ScsiHost drivers for FC"
31 depends on PCI && SCSI 31 depends on PCI && SCSI
32 select SCSI_FC_ATTRS 32 depends on SCSI_FC_ATTRS
33 ---help--- 33 ---help---
34 SCSI HOST support for a Fiber Channel host adapters. 34 SCSI HOST support for a Fiber Channel host adapters.
35 35
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index ebc0af7d769c..a896d948b79e 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -649,12 +649,10 @@ mptbase_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
649 case MPI_FUNCTION_CONFIG: 649 case MPI_FUNCTION_CONFIG:
650 case MPI_FUNCTION_SAS_IO_UNIT_CONTROL: 650 case MPI_FUNCTION_SAS_IO_UNIT_CONTROL:
651 ioc->mptbase_cmds.status |= MPT_MGMT_STATUS_COMMAND_GOOD; 651 ioc->mptbase_cmds.status |= MPT_MGMT_STATUS_COMMAND_GOOD;
652 if (reply) { 652 ioc->mptbase_cmds.status |= MPT_MGMT_STATUS_RF_VALID;
653 ioc->mptbase_cmds.status |= MPT_MGMT_STATUS_RF_VALID; 653 memcpy(ioc->mptbase_cmds.reply, reply,
654 memcpy(ioc->mptbase_cmds.reply, reply, 654 min(MPT_DEFAULT_FRAME_SIZE,
655 min(MPT_DEFAULT_FRAME_SIZE, 655 4 * reply->u.reply.MsgLength));
656 4 * reply->u.reply.MsgLength));
657 }
658 if (ioc->mptbase_cmds.status & MPT_MGMT_STATUS_PENDING) { 656 if (ioc->mptbase_cmds.status & MPT_MGMT_STATUS_PENDING) {
659 ioc->mptbase_cmds.status &= ~MPT_MGMT_STATUS_PENDING; 657 ioc->mptbase_cmds.status &= ~MPT_MGMT_STATUS_PENDING;
660 complete(&ioc->mptbase_cmds.done); 658 complete(&ioc->mptbase_cmds.done);
@@ -1408,8 +1406,8 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp)
1408 * in /proc/mpt/summary and /sysfs/class/scsi_host/host<X>/version_product 1406 * in /proc/mpt/summary and /sysfs/class/scsi_host/host<X>/version_product
1409 * 1407 *
1410 **/ 1408 **/
1411static void 1409static const char*
1412mpt_get_product_name(u16 vendor, u16 device, u8 revision, char *prod_name) 1410mpt_get_product_name(u16 vendor, u16 device, u8 revision)
1413{ 1411{
1414 char *product_str = NULL; 1412 char *product_str = NULL;
1415 1413
@@ -1635,8 +1633,7 @@ mpt_get_product_name(u16 vendor, u16 device, u8 revision, char *prod_name)
1635 } 1633 }
1636 1634
1637 out: 1635 out:
1638 if (product_str) 1636 return product_str;
1639 sprintf(prod_name, "%s", product_str);
1640} 1637}
1641 1638
1642/** 1639/**
@@ -1887,8 +1884,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1887 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "facts @ %p, pfacts[0] @ %p\n", 1884 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "facts @ %p, pfacts[0] @ %p\n",
1888 ioc->name, &ioc->facts, &ioc->pfacts[0])); 1885 ioc->name, &ioc->facts, &ioc->pfacts[0]));
1889 1886
1890 mpt_get_product_name(pdev->vendor, pdev->device, pdev->revision, 1887 ioc->prod_name = mpt_get_product_name(pdev->vendor, pdev->device,
1891 ioc->prod_name); 1888 pdev->revision);
1892 1889
1893 switch (pdev->device) 1890 switch (pdev->device)
1894 { 1891 {
@@ -7007,7 +7004,7 @@ EXPORT_SYMBOL(mpt_halt_firmware);
7007 * IOC doesn't reply to any outstanding request. This will transfer IOC 7004 * IOC doesn't reply to any outstanding request. This will transfer IOC
7008 * to READY state. 7005 * to READY state.
7009 **/ 7006 **/
7010int 7007static int
7011mpt_SoftResetHandler(MPT_ADAPTER *ioc, int sleepFlag) 7008mpt_SoftResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
7012{ 7009{
7013 int rc; 7010 int rc;
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 76c05bc24cb7..8f14090b8b71 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -405,7 +405,7 @@ typedef struct _VirtTarget {
405typedef struct _VirtDevice { 405typedef struct _VirtDevice {
406 VirtTarget *vtarget; 406 VirtTarget *vtarget;
407 u8 configured_lun; 407 u8 configured_lun;
408 int lun; 408 u64 lun;
409} VirtDevice; 409} VirtDevice;
410 410
411/* 411/*
@@ -605,7 +605,7 @@ typedef struct _MPT_ADAPTER
605 int id; /* Unique adapter id N {0,1,2,...} */ 605 int id; /* Unique adapter id N {0,1,2,...} */
606 int pci_irq; /* This irq */ 606 int pci_irq; /* This irq */
607 char name[MPT_NAME_LENGTH]; /* "iocN" */ 607 char name[MPT_NAME_LENGTH]; /* "iocN" */
608 char prod_name[MPT_NAME_LENGTH]; /* "LSIFC9x9" */ 608 const char *prod_name; /* "LSIFC9x9" */
609#ifdef CONFIG_FUSION_LOGGING 609#ifdef CONFIG_FUSION_LOGGING
610 /* used in mpt_display_event_info */ 610 /* used in mpt_display_event_info */
611 char evStr[EVENT_DESCR_STR_SZ]; 611 char evStr[EVENT_DESCR_STR_SZ];
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index 8a050e885688..b0a892a2bf1b 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -1261,19 +1261,11 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
1261 else 1261 else
1262 return -EFAULT; 1262 return -EFAULT;
1263 1263
1264 karg = kmalloc(data_size, GFP_KERNEL); 1264 karg = memdup_user(uarg, data_size);
1265 if (karg == NULL) { 1265 if (IS_ERR(karg)) {
1266 printk(KERN_ERR MYNAM "%s::mpt_ioctl_iocinfo() @%d - no memory available!\n", 1266 printk(KERN_ERR MYNAM "%s@%d::mpt_ioctl_iocinfo() - memdup_user returned error [%ld]\n",
1267 __FILE__, __LINE__); 1267 __FILE__, __LINE__, PTR_ERR(karg));
1268 return -ENOMEM; 1268 return PTR_ERR(karg);
1269 }
1270
1271 if (copy_from_user(karg, uarg, data_size)) {
1272 printk(KERN_ERR MYNAM "%s@%d::mptctl_getiocinfo - "
1273 "Unable to read in mpt_ioctl_iocinfo struct @ %p\n",
1274 __FILE__, __LINE__, uarg);
1275 kfree(karg);
1276 return -EFAULT;
1277 } 1269 }
1278 1270
1279 if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) || 1271 if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) ||
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index 02a3eefd6931..d8bf84aef602 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -204,7 +204,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
204 || (loops > 0 && ioc->active == 0)) { 204 || (loops > 0 && ioc->active == 0)) {
205 spin_unlock_irqrestore(shost->host_lock, flags); 205 spin_unlock_irqrestore(shost->host_lock, flags);
206 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT 206 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
207 "mptfc_block_error_handler.%d: %d:%d, port status is " 207 "mptfc_block_error_handler.%d: %d:%llu, port status is "
208 "%x, active flag %d, deferring %s recovery.\n", 208 "%x, active flag %d, deferring %s recovery.\n",
209 ioc->name, ioc->sh->host_no, 209 ioc->name, ioc->sh->host_no,
210 SCpnt->device->id, SCpnt->device->lun, 210 SCpnt->device->id, SCpnt->device->lun,
@@ -218,7 +218,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
218 if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata 218 if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata
219 || ioc->active == 0) { 219 || ioc->active == 0) {
220 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT 220 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
221 "%s.%d: %d:%d, failing recovery, " 221 "%s.%d: %d:%llu, failing recovery, "
222 "port state %x, active %d, vdevice %p.\n", caller, 222 "port state %x, active %d, vdevice %p.\n", caller,
223 ioc->name, ioc->sh->host_no, 223 ioc->name, ioc->sh->host_no,
224 SCpnt->device->id, SCpnt->device->lun, ready, 224 SCpnt->device->id, SCpnt->device->lun, ready,
@@ -226,7 +226,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
226 return FAILED; 226 return FAILED;
227 } 227 }
228 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT 228 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
229 "%s.%d: %d:%d, executing recovery.\n", caller, 229 "%s.%d: %d:%llu, executing recovery.\n", caller,
230 ioc->name, ioc->sh->host_no, 230 ioc->name, ioc->sh->host_no,
231 SCpnt->device->id, SCpnt->device->lun)); 231 SCpnt->device->id, SCpnt->device->lun));
232 return (*func)(SCpnt); 232 return (*func)(SCpnt);
@@ -525,8 +525,7 @@ mptfc_target_destroy(struct scsi_target *starget)
525 if (ri) /* better be! */ 525 if (ri) /* better be! */
526 ri->starget = NULL; 526 ri->starget = NULL;
527 } 527 }
528 if (starget->hostdata) 528 kfree(starget->hostdata);
529 kfree(starget->hostdata);
530 starget->hostdata = NULL; 529 starget->hostdata = NULL;
531} 530}
532 531
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 711fcb5cec87..0707fa2c701b 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -990,11 +990,10 @@ mptsas_queue_device_delete(MPT_ADAPTER *ioc,
990 MpiEventDataSasDeviceStatusChange_t *sas_event_data) 990 MpiEventDataSasDeviceStatusChange_t *sas_event_data)
991{ 991{
992 struct fw_event_work *fw_event; 992 struct fw_event_work *fw_event;
993 int sz;
994 993
995 sz = offsetof(struct fw_event_work, event_data) + 994 fw_event = kzalloc(sizeof(*fw_event) +
996 sizeof(MpiEventDataSasDeviceStatusChange_t); 995 sizeof(MpiEventDataSasDeviceStatusChange_t),
997 fw_event = kzalloc(sz, GFP_ATOMIC); 996 GFP_ATOMIC);
998 if (!fw_event) { 997 if (!fw_event) {
999 printk(MYIOC_s_WARN_FMT "%s: failed at (line=%d)\n", 998 printk(MYIOC_s_WARN_FMT "%s: failed at (line=%d)\n",
1000 ioc->name, __func__, __LINE__); 999 ioc->name, __func__, __LINE__);
@@ -1011,10 +1010,8 @@ static void
1011mptsas_queue_rescan(MPT_ADAPTER *ioc) 1010mptsas_queue_rescan(MPT_ADAPTER *ioc)
1012{ 1011{
1013 struct fw_event_work *fw_event; 1012 struct fw_event_work *fw_event;
1014 int sz;
1015 1013
1016 sz = offsetof(struct fw_event_work, event_data); 1014 fw_event = kzalloc(sizeof(*fw_event), GFP_ATOMIC);
1017 fw_event = kzalloc(sz, GFP_ATOMIC);
1018 if (!fw_event) { 1015 if (!fw_event) {
1019 printk(MYIOC_s_WARN_FMT "%s: failed at (line=%d)\n", 1016 printk(MYIOC_s_WARN_FMT "%s: failed at (line=%d)\n",
1020 ioc->name, __func__, __LINE__); 1017 ioc->name, __func__, __LINE__);
@@ -1206,27 +1203,28 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
1206 "(mf = %p, mr = %p)\n", ioc->name, mf, mr)); 1203 "(mf = %p, mr = %p)\n", ioc->name, mf, mr));
1207 1204
1208 pScsiTmReply = (SCSITaskMgmtReply_t *)mr; 1205 pScsiTmReply = (SCSITaskMgmtReply_t *)mr;
1209 if (pScsiTmReply) { 1206 if (!pScsiTmReply)
1210 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT 1207 return 0;
1211 "\tTaskMgmt completed: fw_channel = %d, fw_id = %d,\n" 1208
1212 "\ttask_type = 0x%02X, iocstatus = 0x%04X " 1209 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1213 "loginfo = 0x%08X,\n\tresponse_code = 0x%02X, " 1210 "\tTaskMgmt completed: fw_channel = %d, fw_id = %d,\n"
1214 "term_cmnds = %d\n", ioc->name, 1211 "\ttask_type = 0x%02X, iocstatus = 0x%04X "
1215 pScsiTmReply->Bus, pScsiTmReply->TargetID, 1212 "loginfo = 0x%08X,\n\tresponse_code = 0x%02X, "
1216 pScsiTmReply->TaskType, 1213 "term_cmnds = %d\n", ioc->name,
1217 le16_to_cpu(pScsiTmReply->IOCStatus), 1214 pScsiTmReply->Bus, pScsiTmReply->TargetID,
1218 le32_to_cpu(pScsiTmReply->IOCLogInfo), 1215 pScsiTmReply->TaskType,
1219 pScsiTmReply->ResponseCode, 1216 le16_to_cpu(pScsiTmReply->IOCStatus),
1220 le32_to_cpu(pScsiTmReply->TerminationCount))); 1217 le32_to_cpu(pScsiTmReply->IOCLogInfo),
1221 1218 pScsiTmReply->ResponseCode,
1222 if (pScsiTmReply->ResponseCode) 1219 le32_to_cpu(pScsiTmReply->TerminationCount)));
1223 mptscsih_taskmgmt_response_code(ioc, 1220
1224 pScsiTmReply->ResponseCode); 1221 if (pScsiTmReply->ResponseCode)
1225 } 1222 mptscsih_taskmgmt_response_code(ioc,
1226 1223 pScsiTmReply->ResponseCode);
1227 if (pScsiTmReply && (pScsiTmReply->TaskType == 1224
1225 if (pScsiTmReply->TaskType ==
1228 MPI_SCSITASKMGMT_TASKTYPE_QUERY_TASK || pScsiTmReply->TaskType == 1226 MPI_SCSITASKMGMT_TASKTYPE_QUERY_TASK || pScsiTmReply->TaskType ==
1229 MPI_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET)) { 1227 MPI_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET) {
1230 ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_COMMAND_GOOD; 1228 ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_COMMAND_GOOD;
1231 ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_RF_VALID; 1229 ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_RF_VALID;
1232 memcpy(ioc->taskmgmt_cmds.reply, mr, 1230 memcpy(ioc->taskmgmt_cmds.reply, mr,
@@ -1575,7 +1573,7 @@ mptsas_del_end_device(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info)
1575 mptsas_port_delete(ioc, phy_info->port_details); 1573 mptsas_port_delete(ioc, phy_info->port_details);
1576} 1574}
1577 1575
1578struct mptsas_phyinfo * 1576static struct mptsas_phyinfo *
1579mptsas_refreshing_device_handles(MPT_ADAPTER *ioc, 1577mptsas_refreshing_device_handles(MPT_ADAPTER *ioc,
1580 struct mptsas_devinfo *sas_device) 1578 struct mptsas_devinfo *sas_device)
1581{ 1579{
@@ -3648,7 +3646,7 @@ mptsas_send_expander_event(struct fw_event_work *fw_event)
3648 * @handle: 3646 * @handle:
3649 * 3647 *
3650 */ 3648 */
3651struct mptsas_portinfo * 3649static struct mptsas_portinfo *
3652mptsas_expander_add(MPT_ADAPTER *ioc, u16 handle) 3650mptsas_expander_add(MPT_ADAPTER *ioc, u16 handle)
3653{ 3651{
3654 struct mptsas_portinfo buffer, *port_info; 3652 struct mptsas_portinfo buffer, *port_info;
@@ -3763,7 +3761,7 @@ mptsas_send_link_status_event(struct fw_event_work *fw_event)
3763 printk(MYIOC_s_DEBUG_FMT 3761 printk(MYIOC_s_DEBUG_FMT
3764 "SDEV OUTSTANDING CMDS" 3762 "SDEV OUTSTANDING CMDS"
3765 "%d\n", ioc->name, 3763 "%d\n", ioc->name,
3766 sdev->device_busy)); 3764 atomic_read(&sdev->device_busy)));
3767 } 3765 }
3768 3766
3769 } 3767 }
@@ -3856,10 +3854,8 @@ retry_page:
3856 phy_info = mptsas_find_phyinfo_by_sas_address(ioc, 3854 phy_info = mptsas_find_phyinfo_by_sas_address(ioc,
3857 sas_info->sas_address); 3855 sas_info->sas_address);
3858 3856
3859 if (phy_info) { 3857 mptsas_del_end_device(ioc, phy_info);
3860 mptsas_del_end_device(ioc, phy_info); 3858 goto redo_device_scan;
3861 goto redo_device_scan;
3862 }
3863 } else 3859 } else
3864 mptsas_volume_delete(ioc, sas_info->fw.id); 3860 mptsas_volume_delete(ioc, sas_info->fw.id);
3865 } 3861 }
@@ -3870,9 +3866,8 @@ retry_page:
3870 redo_expander_scan: 3866 redo_expander_scan:
3871 list_for_each_entry(port_info, &ioc->sas_topology, list) { 3867 list_for_each_entry(port_info, &ioc->sas_topology, list) {
3872 3868
3873 if (port_info->phy_info && 3869 if (!(port_info->phy_info[0].identify.device_info &
3874 (!(port_info->phy_info[0].identify.device_info & 3870 MPI_SAS_DEVICE_INFO_SMP_TARGET))
3875 MPI_SAS_DEVICE_INFO_SMP_TARGET)))
3876 continue; 3871 continue;
3877 found_expander = 0; 3872 found_expander = 0;
3878 handle = 0xFFFF; 3873 handle = 0xFFFF;
@@ -4983,7 +4978,7 @@ static int
4983mptsas_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *reply) 4978mptsas_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *reply)
4984{ 4979{
4985 u32 event = le32_to_cpu(reply->Event); 4980 u32 event = le32_to_cpu(reply->Event);
4986 int sz, event_data_sz; 4981 int event_data_sz;
4987 struct fw_event_work *fw_event; 4982 struct fw_event_work *fw_event;
4988 unsigned long delay; 4983 unsigned long delay;
4989 4984
@@ -5093,8 +5088,7 @@ mptsas_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *reply)
5093 5088
5094 event_data_sz = ((reply->MsgLength * 4) - 5089 event_data_sz = ((reply->MsgLength * 4) -
5095 offsetof(EventNotificationReply_t, Data)); 5090 offsetof(EventNotificationReply_t, Data));
5096 sz = offsetof(struct fw_event_work, event_data) + event_data_sz; 5091 fw_event = kzalloc(sizeof(*fw_event) + event_data_sz, GFP_ATOMIC);
5097 fw_event = kzalloc(sz, GFP_ATOMIC);
5098 if (!fw_event) { 5092 if (!fw_event) {
5099 printk(MYIOC_s_WARN_FMT "%s: failed at (line=%d)\n", ioc->name, 5093 printk(MYIOC_s_WARN_FMT "%s: failed at (line=%d)\n", ioc->name,
5100 __func__, __LINE__); 5094 __func__, __LINE__);
@@ -5321,7 +5315,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
5321 return error; 5315 return error;
5322} 5316}
5323 5317
5324void 5318static void
5325mptsas_shutdown(struct pci_dev *pdev) 5319mptsas_shutdown(struct pci_dev *pdev)
5326{ 5320{
5327 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 5321 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
diff --git a/drivers/message/fusion/mptsas.h b/drivers/message/fusion/mptsas.h
index 57e86ab77661..c396483d3624 100644
--- a/drivers/message/fusion/mptsas.h
+++ b/drivers/message/fusion/mptsas.h
@@ -110,7 +110,7 @@ struct fw_event_work {
110 MPT_ADAPTER *ioc; 110 MPT_ADAPTER *ioc;
111 u32 event; 111 u32 event;
112 u8 retries; 112 u8 retries;
113 u8 __attribute__((aligned(4))) event_data[1]; 113 char event_data[0] __aligned(4);
114}; 114};
115 115
116struct mptsas_discovery_event { 116struct mptsas_discovery_event {
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 2a1c6f21af27..e7dcb2583369 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -95,7 +95,7 @@ static void mptscsih_freeChainBuffers(MPT_ADAPTER *ioc, int req_idx);
95static void mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SCSIIOReply_t *pScsiReply); 95static void mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SCSIIOReply_t *pScsiReply);
96 96
97int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, 97int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id,
98 int lun, int ctx2abort, ulong timeout); 98 u64 lun, int ctx2abort, ulong timeout);
99 99
100int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); 100int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
101int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply); 101int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
@@ -536,7 +536,7 @@ mptscsih_info_scsiio(MPT_ADAPTER *ioc, struct scsi_cmnd *sc, SCSIIOReply_t * pSc
536 } 536 }
537 537
538 scsi_print_command(sc); 538 scsi_print_command(sc);
539 printk(MYIOC_s_DEBUG_FMT "\tfw_channel = %d, fw_id = %d, lun = %d\n", 539 printk(MYIOC_s_DEBUG_FMT "\tfw_channel = %d, fw_id = %d, lun = %llu\n",
540 ioc->name, pScsiReply->Bus, pScsiReply->TargetID, sc->device->lun); 540 ioc->name, pScsiReply->Bus, pScsiReply->TargetID, sc->device->lun);
541 printk(MYIOC_s_DEBUG_FMT "\trequest_len = %d, underflow = %d, " 541 printk(MYIOC_s_DEBUG_FMT "\trequest_len = %d, underflow = %d, "
542 "resid = %d\n", ioc->name, scsi_bufflen(sc), sc->underflow, 542 "resid = %d\n", ioc->name, scsi_bufflen(sc), sc->underflow,
@@ -692,7 +692,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
692 */ 692 */
693 if (scsi_state & MPI_SCSI_STATE_RESPONSE_INFO_VALID && 693 if (scsi_state & MPI_SCSI_STATE_RESPONSE_INFO_VALID &&
694 pScsiReply->ResponseInfo) { 694 pScsiReply->ResponseInfo) {
695 printk(MYIOC_s_NOTE_FMT "[%d:%d:%d:%d] " 695 printk(MYIOC_s_NOTE_FMT "[%d:%d:%d:%llu] "
696 "FCP_ResponseInfo=%08xh\n", ioc->name, 696 "FCP_ResponseInfo=%08xh\n", ioc->name,
697 sc->device->host->host_no, sc->device->channel, 697 sc->device->host->host_no, sc->device->channel,
698 sc->device->id, sc->device->lun, 698 sc->device->id, sc->device->lun,
@@ -1155,7 +1155,7 @@ mptscsih_report_queue_full(struct scsi_cmnd *sc, SCSIIOReply_t *pScsiReply, SCSI
1155 return; 1155 return;
1156 ioc = hd->ioc; 1156 ioc = hd->ioc;
1157 if (time - hd->last_queue_full > 10 * HZ) { 1157 if (time - hd->last_queue_full > 10 * HZ) {
1158 dprintk(ioc, printk(MYIOC_s_WARN_FMT "Device (%d:%d:%d) reported QUEUE_FULL!\n", 1158 dprintk(ioc, printk(MYIOC_s_WARN_FMT "Device (%d:%d:%llu) reported QUEUE_FULL!\n",
1159 ioc->name, 0, sc->device->id, sc->device->lun)); 1159 ioc->name, 0, sc->device->id, sc->device->lun));
1160 hd->last_queue_full = time; 1160 hd->last_queue_full = time;
1161 } 1161 }
@@ -1271,15 +1271,13 @@ mptscsih_info(struct Scsi_Host *SChost)
1271 1271
1272 h = shost_priv(SChost); 1272 h = shost_priv(SChost);
1273 1273
1274 if (h) { 1274 if (h->info_kbuf == NULL)
1275 if (h->info_kbuf == NULL) 1275 if ((h->info_kbuf = kmalloc(0x1000 /* 4Kb */, GFP_KERNEL)) == NULL)
1276 if ((h->info_kbuf = kmalloc(0x1000 /* 4Kb */, GFP_KERNEL)) == NULL) 1276 return h->info_kbuf;
1277 return h->info_kbuf; 1277 h->info_kbuf[0] = '\0';
1278 h->info_kbuf[0] = '\0';
1279 1278
1280 mpt_print_ioc_summary(h->ioc, h->info_kbuf, &size, 0, 0); 1279 mpt_print_ioc_summary(h->ioc, h->info_kbuf, &size, 0, 0);
1281 h->info_kbuf[size-1] = '\0'; 1280 h->info_kbuf[size-1] = '\0';
1282 }
1283 1281
1284 return h->info_kbuf; 1282 return h->info_kbuf;
1285} 1283}
@@ -1368,8 +1366,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt)
1368 /* Default to untagged. Once a target structure has been allocated, 1366 /* Default to untagged. Once a target structure has been allocated,
1369 * use the Inquiry data to determine if device supports tagged. 1367 * use the Inquiry data to determine if device supports tagged.
1370 */ 1368 */
1371 if (vdevice 1369 if ((vdevice->vtarget->tflags & MPT_TARGET_FLAGS_Q_YES)
1372 && (vdevice->vtarget->tflags & MPT_TARGET_FLAGS_Q_YES)
1373 && (SCpnt->device->tagged_supported)) { 1370 && (SCpnt->device->tagged_supported)) {
1374 scsictl = scsidir | MPI_SCSIIO_CONTROL_SIMPLEQ; 1371 scsictl = scsidir | MPI_SCSIIO_CONTROL_SIMPLEQ;
1375 if (SCpnt->request && SCpnt->request->ioprio) { 1372 if (SCpnt->request && SCpnt->request->ioprio) {
@@ -1518,7 +1515,7 @@ mptscsih_freeChainBuffers(MPT_ADAPTER *ioc, int req_idx)
1518 * 1515 *
1519 **/ 1516 **/
1520int 1517int
1521mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, 1518mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, u64 lun,
1522 int ctx2abort, ulong timeout) 1519 int ctx2abort, ulong timeout)
1523{ 1520{
1524 MPT_FRAME_HDR *mf; 1521 MPT_FRAME_HDR *mf;
@@ -2380,7 +2377,7 @@ mptscsih_slave_configure(struct scsi_device *sdev)
2380 vdevice = sdev->hostdata; 2377 vdevice = sdev->hostdata;
2381 2378
2382 dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT 2379 dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2383 "device @ %p, channel=%d, id=%d, lun=%d\n", 2380 "device @ %p, channel=%d, id=%d, lun=%llu\n",
2384 ioc->name, sdev, sdev->channel, sdev->id, sdev->lun)); 2381 ioc->name, sdev, sdev->channel, sdev->id, sdev->lun));
2385 if (ioc->bus_type == SPI) 2382 if (ioc->bus_type == SPI)
2386 dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT 2383 dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
@@ -2971,7 +2968,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io)
2971 + (my_idx * MPT_SENSE_BUFFER_ALLOC)); 2968 + (my_idx * MPT_SENSE_BUFFER_ALLOC));
2972 2969
2973 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT 2970 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2974 "%s: Sending Command 0x%02x for fw_channel=%d fw_id=%d lun=%d\n", 2971 "%s: Sending Command 0x%02x for fw_channel=%d fw_id=%d lun=%llu\n",
2975 ioc->name, __func__, cmd, io->channel, io->id, io->lun)); 2972 ioc->name, __func__, cmd, io->channel, io->id, io->lun));
2976 2973
2977 if (dir == MPI_SCSIIO_CONTROL_READ) 2974 if (dir == MPI_SCSIIO_CONTROL_READ)
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h
index 99e3390807f3..e1b1a198a62a 100644
--- a/drivers/message/fusion/mptscsih.h
+++ b/drivers/message/fusion/mptscsih.h
@@ -98,7 +98,7 @@ typedef struct _internal_cmd {
98 u8 cmd; /* SCSI Op Code */ 98 u8 cmd; /* SCSI Op Code */
99 u8 channel; /* bus number */ 99 u8 channel; /* bus number */
100 u8 id; /* SCSI ID (virtual) */ 100 u8 id; /* SCSI ID (virtual) */
101 int lun; 101 u64 lun;
102 u8 flags; /* Bit Field - See above */ 102 u8 flags; /* Bit Field - See above */
103 u8 physDiskNum; /* Phys disk number, -1 else */ 103 u8 physDiskNum; /* Phys disk number, -1 else */
104 u8 rsvd2; 104 u8 rsvd2;
@@ -115,7 +115,7 @@ extern int mptscsih_show_info(struct seq_file *, struct Scsi_Host *);
115extern const char * mptscsih_info(struct Scsi_Host *SChost); 115extern const char * mptscsih_info(struct Scsi_Host *SChost);
116extern int mptscsih_qcmd(struct scsi_cmnd *SCpnt); 116extern int mptscsih_qcmd(struct scsi_cmnd *SCpnt);
117extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, 117extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,
118 u8 id, int lun, int ctx2abort, ulong timeout); 118 u8 id, u64 lun, int ctx2abort, ulong timeout);
119extern void mptscsih_slave_destroy(struct scsi_device *device); 119extern void mptscsih_slave_destroy(struct scsi_device *device);
120extern int mptscsih_slave_configure(struct scsi_device *device); 120extern int mptscsih_slave_configure(struct scsi_device *device);
121extern int mptscsih_abort(struct scsi_cmnd * SCpnt); 121extern int mptscsih_abort(struct scsi_cmnd * SCpnt);
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 49d11338294b..787933d43d32 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -461,8 +461,7 @@ static int mptspi_target_alloc(struct scsi_target *starget)
461static void 461static void
462mptspi_target_destroy(struct scsi_target *starget) 462mptspi_target_destroy(struct scsi_target *starget)
463{ 463{
464 if (starget->hostdata) 464 kfree(starget->hostdata);
465 kfree(starget->hostdata);
466 starget->hostdata = NULL; 465 starget->hostdata = NULL;
467} 466}
468 467
@@ -620,7 +619,7 @@ static void mptspi_read_parameters(struct scsi_target *starget)
620 spi_width(starget) = (nego & MPI_SCSIDEVPAGE0_NP_WIDE) ? 1 : 0; 619 spi_width(starget) = (nego & MPI_SCSIDEVPAGE0_NP_WIDE) ? 1 : 0;
621} 620}
622 621
623int 622static int
624mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id) 623mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id)
625{ 624{
626 MPT_ADAPTER *ioc = hd->ioc; 625 MPT_ADAPTER *ioc = hd->ioc;