[SCSI] ipr: Fix adapter initialization failure

Since scsi core is always sending scatterlists now, remove
some code which was written with the bad assumption that
a small transfer would not be sent down in a scatterlist.
Without this fix, the ipr driver ends up sending garbage
data to the adapter following a reset, causing it to
fail the reset and take the adapter offline.

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

authored by Brian King and committed by 4733804c 0d4be124

+7 -47
+5 -44
drivers/scsi/ipr.c
··· 4236 } 4237 4238 /** 4239 - * ipr_save_ioafp_mode_select - Save adapters mode select data 4240 - * @ioa_cfg: ioa config struct 4241 - * @scsi_cmd: scsi command struct 4242 - * 4243 - * This function saves mode select data for the adapter to 4244 - * use following an adapter reset. 4245 - * 4246 - * Return value: 4247 - * 0 on success / SCSI_MLQUEUE_HOST_BUSY on failure 4248 - **/ 4249 - static int ipr_save_ioafp_mode_select(struct ipr_ioa_cfg *ioa_cfg, 4250 - struct scsi_cmnd *scsi_cmd) 4251 - { 4252 - if (!ioa_cfg->saved_mode_pages) { 4253 - ioa_cfg->saved_mode_pages = kmalloc(sizeof(struct ipr_mode_pages), 4254 - GFP_ATOMIC); 4255 - if (!ioa_cfg->saved_mode_pages) { 4256 - dev_err(&ioa_cfg->pdev->dev, 4257 - "IOA mode select buffer allocation failed\n"); 4258 - return SCSI_MLQUEUE_HOST_BUSY; 4259 - } 4260 - } 4261 - 4262 - memcpy(ioa_cfg->saved_mode_pages, scsi_cmd->buffer, scsi_cmd->cmnd[4]); 4263 - ioa_cfg->saved_mode_page_len = scsi_cmd->cmnd[4]; 4264 - return 0; 4265 - } 4266 - 4267 - /** 4268 * ipr_queuecommand - Queue a mid-layer request 4269 * @scsi_cmd: scsi command struct 4270 * @done: done function ··· 4308 if (scsi_cmd->cmnd[0] >= 0xC0 && 4309 (!ipr_is_gscsi(res) || scsi_cmd->cmnd[0] == IPR_QUERY_RSRC_STATE)) 4310 ioarcb->cmd_pkt.request_type = IPR_RQTYPE_IOACMD; 4311 - 4312 - if (ipr_is_ioa_resource(res) && scsi_cmd->cmnd[0] == MODE_SELECT) 4313 - rc = ipr_save_ioafp_mode_select(ioa_cfg, scsi_cmd); 4314 4315 if (likely(rc == 0)) 4316 rc = ipr_build_ioadl(ioa_cfg, ipr_cmd); ··· 4797 int length; 4798 4799 ENTER; 4800 - if (ioa_cfg->saved_mode_pages) { 4801 - memcpy(mode_pages, ioa_cfg->saved_mode_pages, 4802 - ioa_cfg->saved_mode_page_len); 4803 - length = ioa_cfg->saved_mode_page_len; 4804 - } else { 4805 - ipr_scsi_bus_speed_limit(ioa_cfg); 4806 - ipr_check_term_power(ioa_cfg, mode_pages); 4807 - ipr_modify_ioafp_mode_page_28(ioa_cfg, mode_pages); 4808 - length = mode_pages->hdr.length + 1; 4809 - mode_pages->hdr.length = 0; 4810 - } 4811 4812 ipr_build_mode_select(ipr_cmd, cpu_to_be32(IPR_IOA_RES_HANDLE), 0x11, 4813 ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, mode_pages), ··· 5931 } 5932 5933 ipr_free_dump(ioa_cfg); 5934 - kfree(ioa_cfg->saved_mode_pages); 5935 kfree(ioa_cfg->trace); 5936 } 5937
··· 4236 } 4237 4238 /** 4239 * ipr_queuecommand - Queue a mid-layer request 4240 * @scsi_cmd: scsi command struct 4241 * @done: done function ··· 4337 if (scsi_cmd->cmnd[0] >= 0xC0 && 4338 (!ipr_is_gscsi(res) || scsi_cmd->cmnd[0] == IPR_QUERY_RSRC_STATE)) 4339 ioarcb->cmd_pkt.request_type = IPR_RQTYPE_IOACMD; 4340 4341 if (likely(rc == 0)) 4342 rc = ipr_build_ioadl(ioa_cfg, ipr_cmd); ··· 4829 int length; 4830 4831 ENTER; 4832 + ipr_scsi_bus_speed_limit(ioa_cfg); 4833 + ipr_check_term_power(ioa_cfg, mode_pages); 4834 + ipr_modify_ioafp_mode_page_28(ioa_cfg, mode_pages); 4835 + length = mode_pages->hdr.length + 1; 4836 + mode_pages->hdr.length = 0; 4837 4838 ipr_build_mode_select(ipr_cmd, cpu_to_be32(IPR_IOA_RES_HANDLE), 0x11, 4839 ioa_cfg->vpd_cbs_dma + offsetof(struct ipr_misc_cbs, mode_pages), ··· 5969 } 5970 5971 ipr_free_dump(ioa_cfg); 5972 kfree(ioa_cfg->trace); 5973 } 5974
+2 -3
drivers/scsi/ipr.h
··· 36 /* 37 * Literals 38 */ 39 - #define IPR_DRIVER_VERSION "2.1.1" 40 - #define IPR_DRIVER_DATE "(November 15, 2005)" 41 42 /* 43 * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding ··· 1000 struct Scsi_Host *host; 1001 struct pci_dev *pdev; 1002 struct ipr_sglist *ucode_sglist; 1003 - struct ipr_mode_pages *saved_mode_pages; 1004 u8 saved_mode_page_len; 1005 1006 struct work_struct work_q;
··· 36 /* 37 * Literals 38 */ 39 + #define IPR_DRIVER_VERSION "2.1.2" 40 + #define IPR_DRIVER_DATE "(February 8, 2006)" 41 42 /* 43 * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding ··· 1000 struct Scsi_Host *host; 1001 struct pci_dev *pdev; 1002 struct ipr_sglist *ucode_sglist; 1003 u8 saved_mode_page_len; 1004 1005 struct work_struct work_q;