aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/3w-9xxx.c57
-rw-r--r--drivers/scsi/3w-9xxx.h5
-rw-r--r--drivers/scsi/3w-sas.c50
-rw-r--r--drivers/scsi/3w-sas.h4
-rw-r--r--drivers/scsi/3w-xxxx.c42
-rw-r--r--drivers/scsi/3w-xxxx.h5
-rw-r--r--drivers/scsi/aha1542.c23
-rw-r--r--drivers/scsi/scsi_devinfo.c1
-rw-r--r--drivers/scsi/scsi_scan.c6
-rw-r--r--include/scsi/scsi_devinfo.h1
10 files changed, 48 insertions, 146 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 7600639db4c4..add419d6ff34 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -149,7 +149,6 @@ static int twa_reset_sequence(TW_Device_Extension *tw_dev, int soft_reset);
149static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg); 149static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg);
150static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int request_id); 150static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int request_id);
151static char *twa_string_lookup(twa_message_type *table, unsigned int aen_code); 151static char *twa_string_lookup(twa_message_type *table, unsigned int aen_code);
152static void twa_unmap_scsi_data(TW_Device_Extension *tw_dev, int request_id);
153 152
154/* Functions */ 153/* Functions */
155 154
@@ -1340,11 +1339,11 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance)
1340 } 1339 }
1341 1340
1342 /* Now complete the io */ 1341 /* Now complete the io */
1342 scsi_dma_unmap(cmd);
1343 cmd->scsi_done(cmd);
1343 tw_dev->state[request_id] = TW_S_COMPLETED; 1344 tw_dev->state[request_id] = TW_S_COMPLETED;
1344 twa_free_request_id(tw_dev, request_id); 1345 twa_free_request_id(tw_dev, request_id);
1345 tw_dev->posted_request_count--; 1346 tw_dev->posted_request_count--;
1346 tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
1347 twa_unmap_scsi_data(tw_dev, request_id);
1348 } 1347 }
1349 1348
1350 /* Check for valid status after each drain */ 1349 /* Check for valid status after each drain */
@@ -1402,26 +1401,6 @@ static void twa_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_comm
1402 } 1401 }
1403} /* End twa_load_sgl() */ 1402} /* End twa_load_sgl() */
1404 1403
1405/* This function will perform a pci-dma mapping for a scatter gather list */
1406static int twa_map_scsi_sg_data(TW_Device_Extension *tw_dev, int request_id)
1407{
1408 int use_sg;
1409 struct scsi_cmnd *cmd = tw_dev->srb[request_id];
1410
1411 use_sg = scsi_dma_map(cmd);
1412 if (!use_sg)
1413 return 0;
1414 else if (use_sg < 0) {
1415 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1c, "Failed to map scatter gather list");
1416 return 0;
1417 }
1418
1419 cmd->SCp.phase = TW_PHASE_SGLIST;
1420 cmd->SCp.have_data_in = use_sg;
1421
1422 return use_sg;
1423} /* End twa_map_scsi_sg_data() */
1424
1425/* This function will poll for a response interrupt of a request */ 1404/* This function will poll for a response interrupt of a request */
1426static int twa_poll_response(TW_Device_Extension *tw_dev, int request_id, int seconds) 1405static int twa_poll_response(TW_Device_Extension *tw_dev, int request_id, int seconds)
1427{ 1406{
@@ -1600,9 +1579,11 @@ static int twa_reset_device_extension(TW_Device_Extension *tw_dev)
1600 (tw_dev->state[i] != TW_S_INITIAL) && 1579 (tw_dev->state[i] != TW_S_INITIAL) &&
1601 (tw_dev->state[i] != TW_S_COMPLETED)) { 1580 (tw_dev->state[i] != TW_S_COMPLETED)) {
1602 if (tw_dev->srb[i]) { 1581 if (tw_dev->srb[i]) {
1603 tw_dev->srb[i]->result = (DID_RESET << 16); 1582 struct scsi_cmnd *cmd = tw_dev->srb[i];
1604 tw_dev->srb[i]->scsi_done(tw_dev->srb[i]); 1583
1605 twa_unmap_scsi_data(tw_dev, i); 1584 cmd->result = (DID_RESET << 16);
1585 scsi_dma_unmap(cmd);
1586 cmd->scsi_done(cmd);
1606 } 1587 }
1607 } 1588 }
1608 } 1589 }
@@ -1781,21 +1762,18 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
1781 /* Save the scsi command for use by the ISR */ 1762 /* Save the scsi command for use by the ISR */
1782 tw_dev->srb[request_id] = SCpnt; 1763 tw_dev->srb[request_id] = SCpnt;
1783 1764
1784 /* Initialize phase to zero */
1785 SCpnt->SCp.phase = TW_PHASE_INITIAL;
1786
1787 retval = twa_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL); 1765 retval = twa_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL);
1788 switch (retval) { 1766 switch (retval) {
1789 case SCSI_MLQUEUE_HOST_BUSY: 1767 case SCSI_MLQUEUE_HOST_BUSY:
1768 scsi_dma_unmap(SCpnt);
1790 twa_free_request_id(tw_dev, request_id); 1769 twa_free_request_id(tw_dev, request_id);
1791 twa_unmap_scsi_data(tw_dev, request_id);
1792 break; 1770 break;
1793 case 1: 1771 case 1:
1794 tw_dev->state[request_id] = TW_S_COMPLETED;
1795 twa_free_request_id(tw_dev, request_id);
1796 twa_unmap_scsi_data(tw_dev, request_id);
1797 SCpnt->result = (DID_ERROR << 16); 1772 SCpnt->result = (DID_ERROR << 16);
1773 scsi_dma_unmap(SCpnt);
1798 done(SCpnt); 1774 done(SCpnt);
1775 tw_dev->state[request_id] = TW_S_COMPLETED;
1776 twa_free_request_id(tw_dev, request_id);
1799 retval = 0; 1777 retval = 0;
1800 } 1778 }
1801out: 1779out:
@@ -1863,8 +1841,8 @@ static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
1863 command_packet->sg_list[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); 1841 command_packet->sg_list[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]);
1864 command_packet->sg_list[0].length = cpu_to_le32(TW_MIN_SGL_LENGTH); 1842 command_packet->sg_list[0].length = cpu_to_le32(TW_MIN_SGL_LENGTH);
1865 } else { 1843 } else {
1866 sg_count = twa_map_scsi_sg_data(tw_dev, request_id); 1844 sg_count = scsi_dma_map(srb);
1867 if (sg_count == 0) 1845 if (sg_count < 0)
1868 goto out; 1846 goto out;
1869 1847
1870 scsi_for_each_sg(srb, sg, sg_count, i) { 1848 scsi_for_each_sg(srb, sg, sg_count, i) {
@@ -1979,15 +1957,6 @@ static char *twa_string_lookup(twa_message_type *table, unsigned int code)
1979 return(table[index].text); 1957 return(table[index].text);
1980} /* End twa_string_lookup() */ 1958} /* End twa_string_lookup() */
1981 1959
1982/* This function will perform a pci-dma unmap */
1983static void twa_unmap_scsi_data(TW_Device_Extension *tw_dev, int request_id)
1984{
1985 struct scsi_cmnd *cmd = tw_dev->srb[request_id];
1986
1987 if (cmd->SCp.phase == TW_PHASE_SGLIST)
1988 scsi_dma_unmap(cmd);
1989} /* End twa_unmap_scsi_data() */
1990
1991/* This function gets called when a disk is coming on-line */ 1960/* This function gets called when a disk is coming on-line */
1992static int twa_slave_configure(struct scsi_device *sdev) 1961static int twa_slave_configure(struct scsi_device *sdev)
1993{ 1962{
diff --git a/drivers/scsi/3w-9xxx.h b/drivers/scsi/3w-9xxx.h
index 040f7214e5b7..0fdc83cfa0e1 100644
--- a/drivers/scsi/3w-9xxx.h
+++ b/drivers/scsi/3w-9xxx.h
@@ -324,11 +324,6 @@ static twa_message_type twa_error_table[] = {
324#define TW_CURRENT_DRIVER_BUILD 0 324#define TW_CURRENT_DRIVER_BUILD 0
325#define TW_CURRENT_DRIVER_BRANCH 0 325#define TW_CURRENT_DRIVER_BRANCH 0
326 326
327/* Phase defines */
328#define TW_PHASE_INITIAL 0
329#define TW_PHASE_SINGLE 1
330#define TW_PHASE_SGLIST 2
331
332/* Misc defines */ 327/* Misc defines */
333#define TW_9550SX_DRAIN_COMPLETED 0xFFFF 328#define TW_9550SX_DRAIN_COMPLETED 0xFFFF
334#define TW_SECTOR_SIZE 512 329#define TW_SECTOR_SIZE 512
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index 2361772d5909..f8374850f714 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -290,26 +290,6 @@ static int twl_post_command_packet(TW_Device_Extension *tw_dev, int request_id)
290 return 0; 290 return 0;
291} /* End twl_post_command_packet() */ 291} /* End twl_post_command_packet() */
292 292
293/* This function will perform a pci-dma mapping for a scatter gather list */
294static int twl_map_scsi_sg_data(TW_Device_Extension *tw_dev, int request_id)
295{
296 int use_sg;
297 struct scsi_cmnd *cmd = tw_dev->srb[request_id];
298
299 use_sg = scsi_dma_map(cmd);
300 if (!use_sg)
301 return 0;
302 else if (use_sg < 0) {
303 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1, "Failed to map scatter gather list");
304 return 0;
305 }
306
307 cmd->SCp.phase = TW_PHASE_SGLIST;
308 cmd->SCp.have_data_in = use_sg;
309
310 return use_sg;
311} /* End twl_map_scsi_sg_data() */
312
313/* This function hands scsi cdb's to the firmware */ 293/* This function hands scsi cdb's to the firmware */
314static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry_ISO *sglistarg) 294static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry_ISO *sglistarg)
315{ 295{
@@ -357,8 +337,8 @@ static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
357 if (!sglistarg) { 337 if (!sglistarg) {
358 /* Map sglist from scsi layer to cmd packet */ 338 /* Map sglist from scsi layer to cmd packet */
359 if (scsi_sg_count(srb)) { 339 if (scsi_sg_count(srb)) {
360 sg_count = twl_map_scsi_sg_data(tw_dev, request_id); 340 sg_count = scsi_dma_map(srb);
361 if (sg_count == 0) 341 if (sg_count <= 0)
362 goto out; 342 goto out;
363 343
364 scsi_for_each_sg(srb, sg, sg_count, i) { 344 scsi_for_each_sg(srb, sg, sg_count, i) {
@@ -1102,15 +1082,6 @@ out:
1102 return retval; 1082 return retval;
1103} /* End twl_initialize_device_extension() */ 1083} /* End twl_initialize_device_extension() */
1104 1084
1105/* This function will perform a pci-dma unmap */
1106static void twl_unmap_scsi_data(TW_Device_Extension *tw_dev, int request_id)
1107{
1108 struct scsi_cmnd *cmd = tw_dev->srb[request_id];
1109
1110 if (cmd->SCp.phase == TW_PHASE_SGLIST)
1111 scsi_dma_unmap(cmd);
1112} /* End twl_unmap_scsi_data() */
1113
1114/* This function will handle attention interrupts */ 1085/* This function will handle attention interrupts */
1115static int twl_handle_attention_interrupt(TW_Device_Extension *tw_dev) 1086static int twl_handle_attention_interrupt(TW_Device_Extension *tw_dev)
1116{ 1087{
@@ -1251,11 +1222,11 @@ static irqreturn_t twl_interrupt(int irq, void *dev_instance)
1251 } 1222 }
1252 1223
1253 /* Now complete the io */ 1224 /* Now complete the io */
1225 scsi_dma_unmap(cmd);
1226 cmd->scsi_done(cmd);
1254 tw_dev->state[request_id] = TW_S_COMPLETED; 1227 tw_dev->state[request_id] = TW_S_COMPLETED;
1255 twl_free_request_id(tw_dev, request_id); 1228 twl_free_request_id(tw_dev, request_id);
1256 tw_dev->posted_request_count--; 1229 tw_dev->posted_request_count--;
1257 tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
1258 twl_unmap_scsi_data(tw_dev, request_id);
1259 } 1230 }
1260 1231
1261 /* Check for another response interrupt */ 1232 /* Check for another response interrupt */
@@ -1400,10 +1371,12 @@ static int twl_reset_device_extension(TW_Device_Extension *tw_dev, int ioctl_res
1400 if ((tw_dev->state[i] != TW_S_FINISHED) && 1371 if ((tw_dev->state[i] != TW_S_FINISHED) &&
1401 (tw_dev->state[i] != TW_S_INITIAL) && 1372 (tw_dev->state[i] != TW_S_INITIAL) &&
1402 (tw_dev->state[i] != TW_S_COMPLETED)) { 1373 (tw_dev->state[i] != TW_S_COMPLETED)) {
1403 if (tw_dev->srb[i]) { 1374 struct scsi_cmnd *cmd = tw_dev->srb[i];
1404 tw_dev->srb[i]->result = (DID_RESET << 16); 1375
1405 tw_dev->srb[i]->scsi_done(tw_dev->srb[i]); 1376 if (cmd) {
1406 twl_unmap_scsi_data(tw_dev, i); 1377 cmd->result = (DID_RESET << 16);
1378 scsi_dma_unmap(cmd);
1379 cmd->scsi_done(cmd);
1407 } 1380 }
1408 } 1381 }
1409 } 1382 }
@@ -1507,9 +1480,6 @@ static int twl_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
1507 /* Save the scsi command for use by the ISR */ 1480 /* Save the scsi command for use by the ISR */
1508 tw_dev->srb[request_id] = SCpnt; 1481 tw_dev->srb[request_id] = SCpnt;
1509 1482
1510 /* Initialize phase to zero */
1511 SCpnt->SCp.phase = TW_PHASE_INITIAL;
1512
1513 retval = twl_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL); 1483 retval = twl_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL);
1514 if (retval) { 1484 if (retval) {
1515 tw_dev->state[request_id] = TW_S_COMPLETED; 1485 tw_dev->state[request_id] = TW_S_COMPLETED;
diff --git a/drivers/scsi/3w-sas.h b/drivers/scsi/3w-sas.h
index d474892701d4..fec6449c7595 100644
--- a/drivers/scsi/3w-sas.h
+++ b/drivers/scsi/3w-sas.h
@@ -103,10 +103,6 @@ static char *twl_aen_severity_table[] =
103#define TW_CURRENT_DRIVER_BUILD 0 103#define TW_CURRENT_DRIVER_BUILD 0
104#define TW_CURRENT_DRIVER_BRANCH 0 104#define TW_CURRENT_DRIVER_BRANCH 0
105 105
106/* Phase defines */
107#define TW_PHASE_INITIAL 0
108#define TW_PHASE_SGLIST 2
109
110/* Misc defines */ 106/* Misc defines */
111#define TW_SECTOR_SIZE 512 107#define TW_SECTOR_SIZE 512
112#define TW_MAX_UNITS 32 108#define TW_MAX_UNITS 32
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index c75f2048319f..2940bd769936 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -1271,32 +1271,6 @@ static int tw_initialize_device_extension(TW_Device_Extension *tw_dev)
1271 return 0; 1271 return 0;
1272} /* End tw_initialize_device_extension() */ 1272} /* End tw_initialize_device_extension() */
1273 1273
1274static int tw_map_scsi_sg_data(struct pci_dev *pdev, struct scsi_cmnd *cmd)
1275{
1276 int use_sg;
1277
1278 dprintk(KERN_WARNING "3w-xxxx: tw_map_scsi_sg_data()\n");
1279
1280 use_sg = scsi_dma_map(cmd);
1281 if (use_sg < 0) {
1282 printk(KERN_WARNING "3w-xxxx: tw_map_scsi_sg_data(): pci_map_sg() failed.\n");
1283 return 0;
1284 }
1285
1286 cmd->SCp.phase = TW_PHASE_SGLIST;
1287 cmd->SCp.have_data_in = use_sg;
1288
1289 return use_sg;
1290} /* End tw_map_scsi_sg_data() */
1291
1292static void tw_unmap_scsi_data(struct pci_dev *pdev, struct scsi_cmnd *cmd)
1293{
1294 dprintk(KERN_WARNING "3w-xxxx: tw_unmap_scsi_data()\n");
1295
1296 if (cmd->SCp.phase == TW_PHASE_SGLIST)
1297 scsi_dma_unmap(cmd);
1298} /* End tw_unmap_scsi_data() */
1299
1300/* This function will reset a device extension */ 1274/* This function will reset a device extension */
1301static int tw_reset_device_extension(TW_Device_Extension *tw_dev) 1275static int tw_reset_device_extension(TW_Device_Extension *tw_dev)
1302{ 1276{
@@ -1319,8 +1293,8 @@ static int tw_reset_device_extension(TW_Device_Extension *tw_dev)
1319 srb = tw_dev->srb[i]; 1293 srb = tw_dev->srb[i];
1320 if (srb != NULL) { 1294 if (srb != NULL) {
1321 srb->result = (DID_RESET << 16); 1295 srb->result = (DID_RESET << 16);
1322 tw_dev->srb[i]->scsi_done(tw_dev->srb[i]); 1296 scsi_dma_unmap(srb);
1323 tw_unmap_scsi_data(tw_dev->tw_pci_dev, tw_dev->srb[i]); 1297 srb->scsi_done(srb);
1324 } 1298 }
1325 } 1299 }
1326 } 1300 }
@@ -1767,8 +1741,8 @@ static int tw_scsiop_read_write(TW_Device_Extension *tw_dev, int request_id)
1767 command_packet->byte8.io.lba = lba; 1741 command_packet->byte8.io.lba = lba;
1768 command_packet->byte6.block_count = num_sectors; 1742 command_packet->byte6.block_count = num_sectors;
1769 1743
1770 use_sg = tw_map_scsi_sg_data(tw_dev->tw_pci_dev, tw_dev->srb[request_id]); 1744 use_sg = scsi_dma_map(srb);
1771 if (!use_sg) 1745 if (use_sg <= 0)
1772 return 1; 1746 return 1;
1773 1747
1774 scsi_for_each_sg(tw_dev->srb[request_id], sg, use_sg, i) { 1748 scsi_for_each_sg(tw_dev->srb[request_id], sg, use_sg, i) {
@@ -1955,9 +1929,6 @@ static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_c
1955 /* Save the scsi command for use by the ISR */ 1929 /* Save the scsi command for use by the ISR */
1956 tw_dev->srb[request_id] = SCpnt; 1930 tw_dev->srb[request_id] = SCpnt;
1957 1931
1958 /* Initialize phase to zero */
1959 SCpnt->SCp.phase = TW_PHASE_INITIAL;
1960
1961 switch (*command) { 1932 switch (*command) {
1962 case READ_10: 1933 case READ_10:
1963 case READ_6: 1934 case READ_6:
@@ -2185,12 +2156,11 @@ static irqreturn_t tw_interrupt(int irq, void *dev_instance)
2185 2156
2186 /* Now complete the io */ 2157 /* Now complete the io */
2187 if ((error != TW_ISR_DONT_COMPLETE)) { 2158 if ((error != TW_ISR_DONT_COMPLETE)) {
2159 scsi_dma_unmap(tw_dev->srb[request_id]);
2160 tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
2188 tw_dev->state[request_id] = TW_S_COMPLETED; 2161 tw_dev->state[request_id] = TW_S_COMPLETED;
2189 tw_state_request_finish(tw_dev, request_id); 2162 tw_state_request_finish(tw_dev, request_id);
2190 tw_dev->posted_request_count--; 2163 tw_dev->posted_request_count--;
2191 tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
2192
2193 tw_unmap_scsi_data(tw_dev->tw_pci_dev, tw_dev->srb[request_id]);
2194 } 2164 }
2195 } 2165 }
2196 2166
diff --git a/drivers/scsi/3w-xxxx.h b/drivers/scsi/3w-xxxx.h
index 29b0b84ed69e..6f65e663d393 100644
--- a/drivers/scsi/3w-xxxx.h
+++ b/drivers/scsi/3w-xxxx.h
@@ -195,11 +195,6 @@ static unsigned char tw_sense_table[][4] =
195#define TW_AEN_SMART_FAIL 0x000F 195#define TW_AEN_SMART_FAIL 0x000F
196#define TW_AEN_SBUF_FAIL 0x0024 196#define TW_AEN_SBUF_FAIL 0x0024
197 197
198/* Phase defines */
199#define TW_PHASE_INITIAL 0
200#define TW_PHASE_SINGLE 1
201#define TW_PHASE_SGLIST 2
202
203/* Misc defines */ 198/* Misc defines */
204#define TW_ALIGNMENT_6000 64 /* 64 bytes */ 199#define TW_ALIGNMENT_6000 64 /* 64 bytes */
205#define TW_ALIGNMENT_7000 4 /* 4 bytes */ 200#define TW_ALIGNMENT_7000 4 /* 4 bytes */
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index ec432763a29a..b95d2779f467 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -375,9 +375,10 @@ static int aha1542_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
375 u8 lun = cmd->device->lun; 375 u8 lun = cmd->device->lun;
376 unsigned long flags; 376 unsigned long flags;
377 int bufflen = scsi_bufflen(cmd); 377 int bufflen = scsi_bufflen(cmd);
378 int mbo; 378 int mbo, sg_count;
379 struct mailbox *mb = aha1542->mb; 379 struct mailbox *mb = aha1542->mb;
380 struct ccb *ccb = aha1542->ccb; 380 struct ccb *ccb = aha1542->ccb;
381 struct chain *cptr;
381 382
382 if (*cmd->cmnd == REQUEST_SENSE) { 383 if (*cmd->cmnd == REQUEST_SENSE) {
383 /* Don't do the command - we have the sense data already */ 384 /* Don't do the command - we have the sense data already */
@@ -397,6 +398,13 @@ static int aha1542_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
397 print_hex_dump_bytes("command: ", DUMP_PREFIX_NONE, cmd->cmnd, cmd->cmd_len); 398 print_hex_dump_bytes("command: ", DUMP_PREFIX_NONE, cmd->cmnd, cmd->cmd_len);
398 } 399 }
399#endif 400#endif
401 if (bufflen) { /* allocate memory before taking host_lock */
402 sg_count = scsi_sg_count(cmd);
403 cptr = kmalloc(sizeof(*cptr) * sg_count, GFP_KERNEL | GFP_DMA);
404 if (!cptr)
405 return SCSI_MLQUEUE_HOST_BUSY;
406 }
407
400 /* Use the outgoing mailboxes in a round-robin fashion, because this 408 /* Use the outgoing mailboxes in a round-robin fashion, because this
401 is how the host adapter will scan for them */ 409 is how the host adapter will scan for them */
402 410
@@ -441,19 +449,10 @@ static int aha1542_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
441 449
442 if (bufflen) { 450 if (bufflen) {
443 struct scatterlist *sg; 451 struct scatterlist *sg;
444 struct chain *cptr; 452 int i;
445 int i, sg_count = scsi_sg_count(cmd);
446 453
447 ccb[mbo].op = 2; /* SCSI Initiator Command w/scatter-gather */ 454 ccb[mbo].op = 2; /* SCSI Initiator Command w/scatter-gather */
448 cmd->host_scribble = kmalloc(sizeof(*cptr)*sg_count, 455 cmd->host_scribble = (void *)cptr;
449 GFP_KERNEL | GFP_DMA);
450 cptr = (struct chain *) cmd->host_scribble;
451 if (cptr == NULL) {
452 /* free the claimed mailbox slot */
453 aha1542->int_cmds[mbo] = NULL;
454 spin_unlock_irqrestore(sh->host_lock, flags);
455 return SCSI_MLQUEUE_HOST_BUSY;
456 }
457 scsi_for_each_sg(cmd, sg, sg_count, i) { 456 scsi_for_each_sg(cmd, sg, sg_count, i) {
458 any2scsi(cptr[i].dataptr, isa_page_to_bus(sg_page(sg)) 457 any2scsi(cptr[i].dataptr, isa_page_to_bus(sg_page(sg))
459 + sg->offset); 458 + sg->offset);
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 262ab837a704..9f77d23239a2 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -226,6 +226,7 @@ static struct {
226 {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, 226 {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
227 {"Promise", "VTrak E610f", NULL, BLIST_SPARSELUN | BLIST_NO_RSOC}, 227 {"Promise", "VTrak E610f", NULL, BLIST_SPARSELUN | BLIST_NO_RSOC},
228 {"Promise", "", NULL, BLIST_SPARSELUN}, 228 {"Promise", "", NULL, BLIST_SPARSELUN},
229 {"QNAP", "iSCSI Storage", NULL, BLIST_MAX_1024},
229 {"QUANTUM", "XP34301", "1071", BLIST_NOTQ}, 230 {"QUANTUM", "XP34301", "1071", BLIST_NOTQ},
230 {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN}, 231 {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN},
231 {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN}, 232 {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN},
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 60aae01caa89..6efab1c455e1 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -897,6 +897,12 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
897 */ 897 */
898 if (*bflags & BLIST_MAX_512) 898 if (*bflags & BLIST_MAX_512)
899 blk_queue_max_hw_sectors(sdev->request_queue, 512); 899 blk_queue_max_hw_sectors(sdev->request_queue, 512);
900 /*
901 * Max 1024 sector transfer length for targets that report incorrect
902 * max/optimal lengths and relied on the old block layer safe default
903 */
904 else if (*bflags & BLIST_MAX_1024)
905 blk_queue_max_hw_sectors(sdev->request_queue, 1024);
900 906
901 /* 907 /*
902 * Some devices may not want to have a start command automatically 908 * Some devices may not want to have a start command automatically
diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
index 183eaab7c380..96e3f56519e7 100644
--- a/include/scsi/scsi_devinfo.h
+++ b/include/scsi/scsi_devinfo.h
@@ -36,5 +36,6 @@
36 for sequential scan */ 36 for sequential scan */
37#define BLIST_TRY_VPD_PAGES 0x10000000 /* Attempt to read VPD pages */ 37#define BLIST_TRY_VPD_PAGES 0x10000000 /* Attempt to read VPD pages */
38#define BLIST_NO_RSOC 0x20000000 /* don't try to issue RSOC */ 38#define BLIST_NO_RSOC 0x20000000 /* don't try to issue RSOC */
39#define BLIST_MAX_1024 0x40000000 /* maximum 1024 sector cdb length */
39 40
40#endif 41#endif