aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas/mpt2sas_scsih.c
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2009-09-25 02:14:41 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-10-02 10:47:52 -0400
commit7b936b02293b2891d899233d3f4bb45295e8c1f9 (patch)
tree462d97406247680f3e0d49f720bde991a0a97538 /drivers/scsi/mpt2sas/mpt2sas_scsih.c
parent7725ccfda59715ecf8f99e3b520a0b84cc2ea79e (diff)
[SCSI] mpt2sas: Update driver to MPI2 REV K headers.
Drivers header are updated to the MPI2 REV K headers. Renamed VF_ID to msix_index in all call back handlers. VF_ID is removed from all request descriptor. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_scsih.c')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c152
1 files changed, 80 insertions, 72 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 774b34525bba..8277fa366898 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -109,6 +109,7 @@ struct sense_info {
109 * @work: work object (ioc->fault_reset_work_q) 109 * @work: work object (ioc->fault_reset_work_q)
110 * @ioc: per adapter object 110 * @ioc: per adapter object
111 * @VF_ID: virtual function id 111 * @VF_ID: virtual function id
112 * @VP_ID: virtual port id
112 * @host_reset_handling: handling events during host reset 113 * @host_reset_handling: handling events during host reset
113 * @ignore: flag meaning this event has been marked to ignore 114 * @ignore: flag meaning this event has been marked to ignore
114 * @event: firmware event MPI2_EVENT_XXX defined in mpt2_ioc.h 115 * @event: firmware event MPI2_EVENT_XXX defined in mpt2_ioc.h
@@ -121,6 +122,7 @@ struct fw_event_work {
121 struct work_struct work; 122 struct work_struct work;
122 struct MPT2SAS_ADAPTER *ioc; 123 struct MPT2SAS_ADAPTER *ioc;
123 u8 VF_ID; 124 u8 VF_ID;
125 u8 VP_ID;
124 u8 host_reset_handling; 126 u8 host_reset_handling;
125 u8 ignore; 127 u8 ignore;
126 u16 event; 128 u16 event;
@@ -138,8 +140,10 @@ struct fw_event_work {
138 * @lun: lun number 140 * @lun: lun number
139 * @cdb_length: cdb length 141 * @cdb_length: cdb length
140 * @cdb: cdb contents 142 * @cdb: cdb contents
141 * @valid_reply: flag set for reply message
142 * @timeout: timeout for this command 143 * @timeout: timeout for this command
144 * @VF_ID: virtual function id
145 * @VP_ID: virtual port id
146 * @valid_reply: flag set for reply message
143 * @sense_length: sense length 147 * @sense_length: sense length
144 * @ioc_status: ioc status 148 * @ioc_status: ioc status
145 * @scsi_state: scsi state 149 * @scsi_state: scsi state
@@ -161,6 +165,8 @@ struct _scsi_io_transfer {
161 u8 cdb_length; 165 u8 cdb_length;
162 u8 cdb[32]; 166 u8 cdb[32];
163 u8 timeout; 167 u8 timeout;
168 u8 VF_ID;
169 u8 VP_ID;
164 u8 valid_reply; 170 u8 valid_reply;
165 /* the following bits are only valid when 'valid_reply = 1' */ 171 /* the following bits are only valid when 'valid_reply = 1' */
166 u32 sense_length; 172 u32 sense_length;
@@ -1679,7 +1685,7 @@ _scsih_response_code(struct MPT2SAS_ADAPTER *ioc, u8 response_code)
1679 * _scsih_tm_done - tm completion routine 1685 * _scsih_tm_done - tm completion routine
1680 * @ioc: per adapter object 1686 * @ioc: per adapter object
1681 * @smid: system request message index 1687 * @smid: system request message index
1682 * @VF_ID: virtual function id 1688 * @msix_index: MSIX table index supplied by the OS
1683 * @reply: reply message frame(lower 32bit addr) 1689 * @reply: reply message frame(lower 32bit addr)
1684 * Context: none. 1690 * Context: none.
1685 * 1691 *
@@ -1688,7 +1694,7 @@ _scsih_response_code(struct MPT2SAS_ADAPTER *ioc, u8 response_code)
1688 * Return nothing. 1694 * Return nothing.
1689 */ 1695 */
1690static void 1696static void
1691_scsih_tm_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, u32 reply) 1697_scsih_tm_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
1692{ 1698{
1693 MPI2DefaultReply_t *mpi_reply; 1699 MPI2DefaultReply_t *mpi_reply;
1694 1700
@@ -1790,7 +1796,6 @@ mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle, uint lun,
1790 u16 smid = 0; 1796 u16 smid = 0;
1791 u32 ioc_state; 1797 u32 ioc_state;
1792 unsigned long timeleft; 1798 unsigned long timeleft;
1793 u8 VF_ID = 0;
1794 1799
1795 if (ioc->tm_cmds.status != MPT2_CMD_NOT_USED) { 1800 if (ioc->tm_cmds.status != MPT2_CMD_NOT_USED) {
1796 printk(MPT2SAS_INFO_FMT "%s: tm_cmd busy!!!\n", 1801 printk(MPT2SAS_INFO_FMT "%s: tm_cmd busy!!!\n",
@@ -1834,10 +1839,12 @@ mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle, uint lun,
1834 mpi_request->DevHandle = cpu_to_le16(handle); 1839 mpi_request->DevHandle = cpu_to_le16(handle);
1835 mpi_request->TaskType = type; 1840 mpi_request->TaskType = type;
1836 mpi_request->TaskMID = cpu_to_le16(smid_task); 1841 mpi_request->TaskMID = cpu_to_le16(smid_task);
1842 mpi_request->VP_ID = 0; /* TODO */
1843 mpi_request->VF_ID = 0;
1837 int_to_scsilun(lun, (struct scsi_lun *)mpi_request->LUN); 1844 int_to_scsilun(lun, (struct scsi_lun *)mpi_request->LUN);
1838 mpt2sas_scsih_set_tm_flag(ioc, handle); 1845 mpt2sas_scsih_set_tm_flag(ioc, handle);
1839 init_completion(&ioc->tm_cmds.done); 1846 init_completion(&ioc->tm_cmds.done);
1840 mpt2sas_base_put_smid_hi_priority(ioc, smid, VF_ID); 1847 mpt2sas_base_put_smid_hi_priority(ioc, smid);
1841 timeleft = wait_for_completion_timeout(&ioc->tm_cmds.done, timeout*HZ); 1848 timeleft = wait_for_completion_timeout(&ioc->tm_cmds.done, timeout*HZ);
1842 mpt2sas_scsih_clear_tm_flag(ioc, handle); 1849 mpt2sas_scsih_clear_tm_flag(ioc, handle);
1843 if (!(ioc->tm_cmds.status & MPT2_CMD_COMPLETE)) { 1850 if (!(ioc->tm_cmds.status & MPT2_CMD_COMPLETE)) {
@@ -2643,7 +2650,8 @@ _scsih_qcmd(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))
2643 mpi_request->SGLOffset0 = offsetof(Mpi2SCSIIORequest_t, SGL) / 4; 2650 mpi_request->SGLOffset0 = offsetof(Mpi2SCSIIORequest_t, SGL) / 4;
2644 mpi_request->SGLFlags = cpu_to_le16(MPI2_SCSIIO_SGLFLAGS_TYPE_MPI + 2651 mpi_request->SGLFlags = cpu_to_le16(MPI2_SCSIIO_SGLFLAGS_TYPE_MPI +
2645 MPI2_SCSIIO_SGLFLAGS_SYSTEM_ADDR); 2652 MPI2_SCSIIO_SGLFLAGS_SYSTEM_ADDR);
2646 2653 mpi_request->VF_ID = 0; /* TODO */
2654 mpi_request->VP_ID = 0;
2647 int_to_scsilun(sas_device_priv_data->lun, (struct scsi_lun *) 2655 int_to_scsilun(sas_device_priv_data->lun, (struct scsi_lun *)
2648 mpi_request->LUN); 2656 mpi_request->LUN);
2649 memcpy(mpi_request->CDB.CDB32, scmd->cmnd, scmd->cmd_len); 2657 memcpy(mpi_request->CDB.CDB32, scmd->cmnd, scmd->cmd_len);
@@ -2658,7 +2666,7 @@ _scsih_qcmd(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))
2658 } 2666 }
2659 2667
2660 _scsih_scsi_lookup_set(ioc, smid, scmd); 2668 _scsih_scsi_lookup_set(ioc, smid, scmd);
2661 mpt2sas_base_put_smid_scsi_io(ioc, smid, 0, 2669 mpt2sas_base_put_smid_scsi_io(ioc, smid,
2662 sas_device_priv_data->sas_target->handle); 2670 sas_device_priv_data->sas_target->handle);
2663 return 0; 2671 return 0;
2664 2672
@@ -2954,7 +2962,7 @@ _scsih_smart_predicted_fault(struct MPT2SAS_ADAPTER *ioc, u16 handle)
2954 * _scsih_io_done - scsi request callback 2962 * _scsih_io_done - scsi request callback
2955 * @ioc: per adapter object 2963 * @ioc: per adapter object
2956 * @smid: system request message index 2964 * @smid: system request message index
2957 * @VF_ID: virtual function id 2965 * @msix_index: MSIX table index supplied by the OS
2958 * @reply: reply message frame(lower 32bit addr) 2966 * @reply: reply message frame(lower 32bit addr)
2959 * 2967 *
2960 * Callback handler when using scsih_qcmd. 2968 * Callback handler when using scsih_qcmd.
@@ -2962,7 +2970,7 @@ _scsih_smart_predicted_fault(struct MPT2SAS_ADAPTER *ioc, u16 handle)
2962 * Return nothing. 2970 * Return nothing.
2963 */ 2971 */
2964static void 2972static void
2965_scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, u32 reply) 2973_scsih_io_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
2966{ 2974{
2967 Mpi2SCSIIORequest_t *mpi_request; 2975 Mpi2SCSIIORequest_t *mpi_request;
2968 Mpi2SCSIIOReply_t *mpi_reply; 2976 Mpi2SCSIIOReply_t *mpi_reply;
@@ -3690,7 +3698,8 @@ _scsih_remove_device(struct MPT2SAS_ADAPTER *ioc, u16 handle)
3690 mpi_request.Function = MPI2_FUNCTION_SAS_IO_UNIT_CONTROL; 3698 mpi_request.Function = MPI2_FUNCTION_SAS_IO_UNIT_CONTROL;
3691 mpi_request.Operation = MPI2_SAS_OP_REMOVE_DEVICE; 3699 mpi_request.Operation = MPI2_SAS_OP_REMOVE_DEVICE;
3692 mpi_request.DevHandle = handle; 3700 mpi_request.DevHandle = handle;
3693 mpi_request.VF_ID = 0; 3701 mpi_request.VF_ID = 0; /* TODO */
3702 mpi_request.VP_ID = 0;
3694 if ((mpt2sas_base_sas_iounit_control(ioc, &mpi_reply, 3703 if ((mpt2sas_base_sas_iounit_control(ioc, &mpi_reply,
3695 &mpi_request)) != 0) { 3704 &mpi_request)) != 0) {
3696 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", 3705 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
@@ -3800,15 +3809,12 @@ _scsih_sas_topology_change_event_debug(struct MPT2SAS_ADAPTER *ioc,
3800/** 3809/**
3801 * _scsih_sas_topology_change_event - handle topology changes 3810 * _scsih_sas_topology_change_event - handle topology changes
3802 * @ioc: per adapter object 3811 * @ioc: per adapter object
3803 * @VF_ID: 3812 * @fw_event: The fw_event_work object
3804 * @event_data: event data payload
3805 * fw_event:
3806 * Context: user. 3813 * Context: user.
3807 * 3814 *
3808 */ 3815 */
3809static void 3816static void
3810_scsih_sas_topology_change_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, 3817_scsih_sas_topology_change_event(struct MPT2SAS_ADAPTER *ioc,
3811 Mpi2EventDataSasTopologyChangeList_t *event_data,
3812 struct fw_event_work *fw_event) 3818 struct fw_event_work *fw_event)
3813{ 3819{
3814 int i; 3820 int i;
@@ -3818,6 +3824,7 @@ _scsih_sas_topology_change_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
3818 struct _sas_node *sas_expander; 3824 struct _sas_node *sas_expander;
3819 unsigned long flags; 3825 unsigned long flags;
3820 u8 link_rate_; 3826 u8 link_rate_;
3827 Mpi2EventDataSasTopologyChangeList_t *event_data = fw_event->event_data;
3821 3828
3822#ifdef CONFIG_SCSI_MPT2SAS_LOGGING 3829#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
3823 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) 3830 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK)
@@ -3971,19 +3978,19 @@ _scsih_sas_device_status_change_event_debug(struct MPT2SAS_ADAPTER *ioc,
3971/** 3978/**
3972 * _scsih_sas_device_status_change_event - handle device status change 3979 * _scsih_sas_device_status_change_event - handle device status change
3973 * @ioc: per adapter object 3980 * @ioc: per adapter object
3974 * @VF_ID: 3981 * @fw_event: The fw_event_work object
3975 * @event_data: event data payload
3976 * Context: user. 3982 * Context: user.
3977 * 3983 *
3978 * Return nothing. 3984 * Return nothing.
3979 */ 3985 */
3980static void 3986static void
3981_scsih_sas_device_status_change_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, 3987_scsih_sas_device_status_change_event(struct MPT2SAS_ADAPTER *ioc,
3982 Mpi2EventDataSasDeviceStatusChange_t *event_data) 3988 struct fw_event_work *fw_event)
3983{ 3989{
3984#ifdef CONFIG_SCSI_MPT2SAS_LOGGING 3990#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
3985 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) 3991 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK)
3986 _scsih_sas_device_status_change_event_debug(ioc, event_data); 3992 _scsih_sas_device_status_change_event_debug(ioc,
3993 fw_event->event_data);
3987#endif 3994#endif
3988} 3995}
3989 3996
@@ -4026,34 +4033,33 @@ _scsih_sas_enclosure_dev_status_change_event_debug(struct MPT2SAS_ADAPTER *ioc,
4026/** 4033/**
4027 * _scsih_sas_enclosure_dev_status_change_event - handle enclosure events 4034 * _scsih_sas_enclosure_dev_status_change_event - handle enclosure events
4028 * @ioc: per adapter object 4035 * @ioc: per adapter object
4029 * @VF_ID: 4036 * @fw_event: The fw_event_work object
4030 * @event_data: event data payload
4031 * Context: user. 4037 * Context: user.
4032 * 4038 *
4033 * Return nothing. 4039 * Return nothing.
4034 */ 4040 */
4035static void 4041static void
4036_scsih_sas_enclosure_dev_status_change_event(struct MPT2SAS_ADAPTER *ioc, 4042_scsih_sas_enclosure_dev_status_change_event(struct MPT2SAS_ADAPTER *ioc,
4037 u8 VF_ID, Mpi2EventDataSasEnclDevStatusChange_t *event_data) 4043 struct fw_event_work *fw_event)
4038{ 4044{
4039#ifdef CONFIG_SCSI_MPT2SAS_LOGGING 4045#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
4040 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) 4046 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK)
4041 _scsih_sas_enclosure_dev_status_change_event_debug(ioc, 4047 _scsih_sas_enclosure_dev_status_change_event_debug(ioc,
4042 event_data); 4048 fw_event->event_data);
4043#endif 4049#endif
4044} 4050}
4045 4051
4046/** 4052/**
4047 * _scsih_sas_broadcast_primative_event - handle broadcast events 4053 * _scsih_sas_broadcast_primative_event - handle broadcast events
4048 * @ioc: per adapter object 4054 * @ioc: per adapter object
4049 * @event_data: event data payload 4055 * @fw_event: The fw_event_work object
4050 * Context: user. 4056 * Context: user.
4051 * 4057 *
4052 * Return nothing. 4058 * Return nothing.
4053 */ 4059 */
4054static void 4060static void
4055_scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, 4061_scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc,
4056 Mpi2EventDataSasBroadcastPrimitive_t *event_data) 4062 struct fw_event_work *fw_event)
4057{ 4063{
4058 struct scsi_cmnd *scmd; 4064 struct scsi_cmnd *scmd;
4059 u16 smid, handle; 4065 u16 smid, handle;
@@ -4062,11 +4068,12 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
4062 u32 termination_count; 4068 u32 termination_count;
4063 u32 query_count; 4069 u32 query_count;
4064 Mpi2SCSITaskManagementReply_t *mpi_reply; 4070 Mpi2SCSITaskManagementReply_t *mpi_reply;
4065 4071#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
4072 Mpi2EventDataSasBroadcastPrimitive_t *event_data = fw_event->event_data;
4073#endif
4066 dewtprintk(ioc, printk(MPT2SAS_DEBUG_FMT "broadcast primative: " 4074 dewtprintk(ioc, printk(MPT2SAS_DEBUG_FMT "broadcast primative: "
4067 "phy number(%d), width(%d)\n", ioc->name, event_data->PhyNum, 4075 "phy number(%d), width(%d)\n", ioc->name, event_data->PhyNum,
4068 event_data->PortWidth)); 4076 event_data->PortWidth));
4069
4070 dtmprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: enter\n", ioc->name, 4077 dtmprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: enter\n", ioc->name,
4071 __func__)); 4078 __func__));
4072 4079
@@ -4121,15 +4128,17 @@ _scsih_sas_broadcast_primative_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
4121/** 4128/**
4122 * _scsih_sas_discovery_event - handle discovery events 4129 * _scsih_sas_discovery_event - handle discovery events
4123 * @ioc: per adapter object 4130 * @ioc: per adapter object
4124 * @event_data: event data payload 4131 * @fw_event: The fw_event_work object
4125 * Context: user. 4132 * Context: user.
4126 * 4133 *
4127 * Return nothing. 4134 * Return nothing.
4128 */ 4135 */
4129static void 4136static void
4130_scsih_sas_discovery_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, 4137_scsih_sas_discovery_event(struct MPT2SAS_ADAPTER *ioc,
4131 Mpi2EventDataSasDiscovery_t *event_data) 4138 struct fw_event_work *fw_event)
4132{ 4139{
4140 Mpi2EventDataSasDiscovery_t *event_data = fw_event->event_data;
4141
4133#ifdef CONFIG_SCSI_MPT2SAS_LOGGING 4142#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
4134 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) { 4143 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) {
4135 printk(MPT2SAS_DEBUG_FMT "discovery event: (%s)", ioc->name, 4144 printk(MPT2SAS_DEBUG_FMT "discovery event: (%s)", ioc->name,
@@ -4488,19 +4497,19 @@ _scsih_sas_ir_config_change_event_debug(struct MPT2SAS_ADAPTER *ioc,
4488/** 4497/**
4489 * _scsih_sas_ir_config_change_event - handle ir configuration change events 4498 * _scsih_sas_ir_config_change_event - handle ir configuration change events
4490 * @ioc: per adapter object 4499 * @ioc: per adapter object
4491 * @VF_ID: 4500 * @fw_event: The fw_event_work object
4492 * @event_data: event data payload
4493 * Context: user. 4501 * Context: user.
4494 * 4502 *
4495 * Return nothing. 4503 * Return nothing.
4496 */ 4504 */
4497static void 4505static void
4498_scsih_sas_ir_config_change_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, 4506_scsih_sas_ir_config_change_event(struct MPT2SAS_ADAPTER *ioc,
4499 Mpi2EventDataIrConfigChangeList_t *event_data) 4507 struct fw_event_work *fw_event)
4500{ 4508{
4501 Mpi2EventIrConfigElement_t *element; 4509 Mpi2EventIrConfigElement_t *element;
4502 int i; 4510 int i;
4503 u8 foreign_config; 4511 u8 foreign_config;
4512 Mpi2EventDataIrConfigChangeList_t *event_data = fw_event->event_data;
4504 4513
4505#ifdef CONFIG_SCSI_MPT2SAS_LOGGING 4514#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
4506 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) 4515 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK)
@@ -4543,14 +4552,14 @@ _scsih_sas_ir_config_change_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
4543/** 4552/**
4544 * _scsih_sas_ir_volume_event - IR volume event 4553 * _scsih_sas_ir_volume_event - IR volume event
4545 * @ioc: per adapter object 4554 * @ioc: per adapter object
4546 * @event_data: event data payload 4555 * @fw_event: The fw_event_work object
4547 * Context: user. 4556 * Context: user.
4548 * 4557 *
4549 * Return nothing. 4558 * Return nothing.
4550 */ 4559 */
4551static void 4560static void
4552_scsih_sas_ir_volume_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, 4561_scsih_sas_ir_volume_event(struct MPT2SAS_ADAPTER *ioc,
4553 Mpi2EventDataIrVolume_t *event_data) 4562 struct fw_event_work *fw_event)
4554{ 4563{
4555 u64 wwid; 4564 u64 wwid;
4556 unsigned long flags; 4565 unsigned long flags;
@@ -4559,6 +4568,7 @@ _scsih_sas_ir_volume_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
4559 u32 state; 4568 u32 state;
4560 int rc; 4569 int rc;
4561 struct MPT2SAS_TARGET *sas_target_priv_data; 4570 struct MPT2SAS_TARGET *sas_target_priv_data;
4571 Mpi2EventDataIrVolume_t *event_data = fw_event->event_data;
4562 4572
4563 if (event_data->ReasonCode != MPI2_EVENT_IR_VOLUME_RC_STATE_CHANGED) 4573 if (event_data->ReasonCode != MPI2_EVENT_IR_VOLUME_RC_STATE_CHANGED)
4564 return; 4574 return;
@@ -4628,14 +4638,14 @@ _scsih_sas_ir_volume_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
4628/** 4638/**
4629 * _scsih_sas_ir_physical_disk_event - PD event 4639 * _scsih_sas_ir_physical_disk_event - PD event
4630 * @ioc: per adapter object 4640 * @ioc: per adapter object
4631 * @event_data: event data payload 4641 * @fw_event: The fw_event_work object
4632 * Context: user. 4642 * Context: user.
4633 * 4643 *
4634 * Return nothing. 4644 * Return nothing.
4635 */ 4645 */
4636static void 4646static void
4637_scsih_sas_ir_physical_disk_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, 4647_scsih_sas_ir_physical_disk_event(struct MPT2SAS_ADAPTER *ioc,
4638 Mpi2EventDataIrPhysicalDisk_t *event_data) 4648 struct fw_event_work *fw_event)
4639{ 4649{
4640 u16 handle; 4650 u16 handle;
4641 u32 state; 4651 u32 state;
@@ -4644,6 +4654,7 @@ _scsih_sas_ir_physical_disk_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
4644 Mpi2ConfigReply_t mpi_reply; 4654 Mpi2ConfigReply_t mpi_reply;
4645 Mpi2SasDevicePage0_t sas_device_pg0; 4655 Mpi2SasDevicePage0_t sas_device_pg0;
4646 u32 ioc_status; 4656 u32 ioc_status;
4657 Mpi2EventDataIrPhysicalDisk_t *event_data = fw_event->event_data;
4647 4658
4648 if (event_data->ReasonCode != MPI2_EVENT_IR_PHYSDISK_RC_STATE_CHANGED) 4659 if (event_data->ReasonCode != MPI2_EVENT_IR_PHYSDISK_RC_STATE_CHANGED)
4649 return; 4660 return;
@@ -4743,33 +4754,33 @@ _scsih_sas_ir_operation_status_event_debug(struct MPT2SAS_ADAPTER *ioc,
4743/** 4754/**
4744 * _scsih_sas_ir_operation_status_event - handle RAID operation events 4755 * _scsih_sas_ir_operation_status_event - handle RAID operation events
4745 * @ioc: per adapter object 4756 * @ioc: per adapter object
4746 * @VF_ID: 4757 * @fw_event: The fw_event_work object
4747 * @event_data: event data payload
4748 * Context: user. 4758 * Context: user.
4749 * 4759 *
4750 * Return nothing. 4760 * Return nothing.
4751 */ 4761 */
4752static void 4762static void
4753_scsih_sas_ir_operation_status_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, 4763_scsih_sas_ir_operation_status_event(struct MPT2SAS_ADAPTER *ioc,
4754 Mpi2EventDataIrOperationStatus_t *event_data) 4764 struct fw_event_work *fw_event)
4755{ 4765{
4756#ifdef CONFIG_SCSI_MPT2SAS_LOGGING 4766#ifdef CONFIG_SCSI_MPT2SAS_LOGGING
4757 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) 4767 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK)
4758 _scsih_sas_ir_operation_status_event_debug(ioc, event_data); 4768 _scsih_sas_ir_operation_status_event_debug(ioc,
4769 fw_event->event_data);
4759#endif 4770#endif
4760} 4771}
4761 4772
4762/** 4773/**
4763 * _scsih_task_set_full - handle task set full 4774 * _scsih_task_set_full - handle task set full
4764 * @ioc: per adapter object 4775 * @ioc: per adapter object
4765 * @event_data: event data payload 4776 * @fw_event: The fw_event_work object
4766 * Context: user. 4777 * Context: user.
4767 * 4778 *
4768 * Throttle back qdepth. 4779 * Throttle back qdepth.
4769 */ 4780 */
4770static void 4781static void
4771_scsih_task_set_full(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, 4782_scsih_task_set_full(struct MPT2SAS_ADAPTER *ioc, struct fw_event_work
4772 Mpi2EventDataTaskSetFull_t *event_data) 4783 *fw_event)
4773{ 4784{
4774 unsigned long flags; 4785 unsigned long flags;
4775 struct _sas_device *sas_device; 4786 struct _sas_device *sas_device;
@@ -4780,6 +4791,7 @@ _scsih_task_set_full(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID,
4780 u16 handle; 4791 u16 handle;
4781 int id, channel; 4792 int id, channel;
4782 u64 sas_address; 4793 u64 sas_address;
4794 Mpi2EventDataTaskSetFull_t *event_data = fw_event->event_data;
4783 4795
4784 current_depth = le16_to_cpu(event_data->CurrentDepth); 4796 current_depth = le16_to_cpu(event_data->CurrentDepth);
4785 handle = le16_to_cpu(event_data->DevHandle); 4797 handle = le16_to_cpu(event_data->DevHandle);
@@ -5227,44 +5239,38 @@ _firmware_event_work(struct work_struct *work)
5227 5239
5228 switch (fw_event->event) { 5240 switch (fw_event->event) {
5229 case MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST: 5241 case MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST:
5230 _scsih_sas_topology_change_event(ioc, fw_event->VF_ID, 5242 _scsih_sas_topology_change_event(ioc, fw_event);
5231 fw_event->event_data, fw_event);
5232 break; 5243 break;
5233 case MPI2_EVENT_SAS_DEVICE_STATUS_CHANGE: 5244 case MPI2_EVENT_SAS_DEVICE_STATUS_CHANGE:
5234 _scsih_sas_device_status_change_event(ioc, fw_event->VF_ID, 5245 _scsih_sas_device_status_change_event(ioc,
5235 fw_event->event_data); 5246 fw_event);
5236 break; 5247 break;
5237 case MPI2_EVENT_SAS_DISCOVERY: 5248 case MPI2_EVENT_SAS_DISCOVERY:
5238 _scsih_sas_discovery_event(ioc, fw_event->VF_ID, 5249 _scsih_sas_discovery_event(ioc,
5239 fw_event->event_data); 5250 fw_event);
5240 break; 5251 break;
5241 case MPI2_EVENT_SAS_BROADCAST_PRIMITIVE: 5252 case MPI2_EVENT_SAS_BROADCAST_PRIMITIVE:
5242 _scsih_sas_broadcast_primative_event(ioc, fw_event->VF_ID, 5253 _scsih_sas_broadcast_primative_event(ioc,
5243 fw_event->event_data); 5254 fw_event);
5244 break; 5255 break;
5245 case MPI2_EVENT_SAS_ENCL_DEVICE_STATUS_CHANGE: 5256 case MPI2_EVENT_SAS_ENCL_DEVICE_STATUS_CHANGE:
5246 _scsih_sas_enclosure_dev_status_change_event(ioc, 5257 _scsih_sas_enclosure_dev_status_change_event(ioc,
5247 fw_event->VF_ID, fw_event->event_data); 5258 fw_event);
5248 break; 5259 break;
5249 case MPI2_EVENT_IR_CONFIGURATION_CHANGE_LIST: 5260 case MPI2_EVENT_IR_CONFIGURATION_CHANGE_LIST:
5250 _scsih_sas_ir_config_change_event(ioc, fw_event->VF_ID, 5261 _scsih_sas_ir_config_change_event(ioc, fw_event);
5251 fw_event->event_data);
5252 break; 5262 break;
5253 case MPI2_EVENT_IR_VOLUME: 5263 case MPI2_EVENT_IR_VOLUME:
5254 _scsih_sas_ir_volume_event(ioc, fw_event->VF_ID, 5264 _scsih_sas_ir_volume_event(ioc, fw_event);
5255 fw_event->event_data);
5256 break; 5265 break;
5257 case MPI2_EVENT_IR_PHYSICAL_DISK: 5266 case MPI2_EVENT_IR_PHYSICAL_DISK:
5258 _scsih_sas_ir_physical_disk_event(ioc, fw_event->VF_ID, 5267 _scsih_sas_ir_physical_disk_event(ioc, fw_event);
5259 fw_event->event_data);
5260 break; 5268 break;
5261 case MPI2_EVENT_IR_OPERATION_STATUS: 5269 case MPI2_EVENT_IR_OPERATION_STATUS:
5262 _scsih_sas_ir_operation_status_event(ioc, fw_event->VF_ID, 5270 _scsih_sas_ir_operation_status_event(ioc, fw_event);
5263 fw_event->event_data);
5264 break; 5271 break;
5265 case MPI2_EVENT_TASK_SET_FULL: 5272 case MPI2_EVENT_TASK_SET_FULL:
5266 _scsih_task_set_full(ioc, fw_event->VF_ID, 5273 _scsih_task_set_full(ioc, fw_event);
5267 fw_event->event_data);
5268 break; 5274 break;
5269 } 5275 }
5270 _scsih_fw_event_free(ioc, fw_event); 5276 _scsih_fw_event_free(ioc, fw_event);
@@ -5273,7 +5279,7 @@ _firmware_event_work(struct work_struct *work)
5273/** 5279/**
5274 * mpt2sas_scsih_event_callback - firmware event handler (called at ISR time) 5280 * mpt2sas_scsih_event_callback - firmware event handler (called at ISR time)
5275 * @ioc: per adapter object 5281 * @ioc: per adapter object
5276 * @VF_ID: virtual function id 5282 * @msix_index: MSIX table index supplied by the OS
5277 * @reply: reply message frame(lower 32bit addr) 5283 * @reply: reply message frame(lower 32bit addr)
5278 * Context: interrupt. 5284 * Context: interrupt.
5279 * 5285 *
@@ -5283,7 +5289,8 @@ _firmware_event_work(struct work_struct *work)
5283 * Return nothing. 5289 * Return nothing.
5284 */ 5290 */
5285void 5291void
5286mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, u32 reply) 5292mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index,
5293 u32 reply)
5287{ 5294{
5288 struct fw_event_work *fw_event; 5295 struct fw_event_work *fw_event;
5289 Mpi2EventNotificationReply_t *mpi_reply; 5296 Mpi2EventNotificationReply_t *mpi_reply;
@@ -5355,7 +5362,8 @@ mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, u32 reply)
5355 memcpy(fw_event->event_data, mpi_reply->EventData, 5362 memcpy(fw_event->event_data, mpi_reply->EventData,
5356 mpi_reply->EventDataLength*4); 5363 mpi_reply->EventDataLength*4);
5357 fw_event->ioc = ioc; 5364 fw_event->ioc = ioc;
5358 fw_event->VF_ID = VF_ID; 5365 fw_event->VF_ID = mpi_reply->VF_ID;
5366 fw_event->VP_ID = mpi_reply->VP_ID;
5359 fw_event->event = event; 5367 fw_event->event = event;
5360 _scsih_fw_event_add(ioc, fw_event); 5368 _scsih_fw_event_add(ioc, fw_event);
5361} 5369}