diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-30 17:28:49 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-30 17:28:49 -0500 |
commit | 2419505acc479d2f1feed94d195b0554a64269a4 (patch) | |
tree | b704f4745dc728ac2402a5407f2052e1949b381e /drivers | |
parent | caf03feb61bc47dda6dca69a2abb1f5d57dc681e (diff) | |
parent | 203a512f0976e8ba85df36d76b40af6c80239121 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (21 commits)
[SCSI] Revert "[SCSI] aacraid: fib context lock for management ioctls"
[SCSI] bsg: copy the cmd_type field to the subordinate request for bidi
[SCSI] handle scsi_init_queue failure properly
[SCSI] destroy scsi_bidi_sdb_cache in scsi_exit_queue
[SCSI] scsi_debug: add XDWRITEREAD_10 support
[SCSI] scsi_debug: add bidi data transfer support
[SCSI] scsi_debug: add get_data_transfer_info helper function
[SCSI] remove use_sg_chaining
[SCSI] bidirectional: fix up for the new blk_end_request code
[SCSI] bidirectional command support
[SCSI] implement scsi_data_buffer
[SCSI] tgt: use scsi_init_io instead of scsi_alloc_sgtable
[SCSI] aic7xxx: fix warnings with CONFIG_PM disabled
[SCSI] aic79xx: fix warnings with CONFIG_PM disabled
[SCSI] aic7xxx: fix ahc_done check SCB_ACTIVE for tagged transactions
[SCSI] sgiwd93: use cached memory access to make driver work on IP28
[SCSI] zfcp: fix sense_buffer access bug
[SCSI] ncr53c8xx: fix sense_buffer access bug
[SCSI] aic79xx: fix sense_buffer access bug
[SCSI] hptiop: fix sense_buffer access bug
...
Diffstat (limited to 'drivers')
61 files changed, 424 insertions, 369 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index f2d2c7e2c76b..195ce7c12319 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -1571,7 +1571,6 @@ static struct scsi_host_template srp_template = { | |||
1571 | .this_id = -1, | 1571 | .this_id = -1, |
1572 | .cmd_per_lun = SRP_SQ_SIZE, | 1572 | .cmd_per_lun = SRP_SQ_SIZE, |
1573 | .use_clustering = ENABLE_CLUSTERING, | 1573 | .use_clustering = ENABLE_CLUSTERING, |
1574 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1575 | .shost_attrs = srp_host_attrs | 1574 | .shost_attrs = srp_host_attrs |
1576 | }; | 1575 | }; |
1577 | 1576 | ||
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index e45f85f7c7ed..0dff05840ee2 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -4224,10 +4224,10 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req) | |||
4224 | 4224 | ||
4225 | ZFCP_LOG_TRACE("%i bytes sense data provided by FCP\n", | 4225 | ZFCP_LOG_TRACE("%i bytes sense data provided by FCP\n", |
4226 | fcp_rsp_iu->fcp_sns_len); | 4226 | fcp_rsp_iu->fcp_sns_len); |
4227 | memcpy(&scpnt->sense_buffer, | 4227 | memcpy(scpnt->sense_buffer, |
4228 | zfcp_get_fcp_sns_info_ptr(fcp_rsp_iu), sns_len); | 4228 | zfcp_get_fcp_sns_info_ptr(fcp_rsp_iu), sns_len); |
4229 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE, | 4229 | ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE, |
4230 | (void *) &scpnt->sense_buffer, sns_len); | 4230 | (void *)scpnt->sense_buffer, sns_len); |
4231 | } | 4231 | } |
4232 | 4232 | ||
4233 | /* check for overrun */ | 4233 | /* check for overrun */ |
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index 1c244832c6c8..b4912d1cee2a 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -1990,7 +1990,6 @@ static struct scsi_host_template driver_template = { | |||
1990 | .max_sectors = TW_MAX_SECTORS, | 1990 | .max_sectors = TW_MAX_SECTORS, |
1991 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, | 1991 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, |
1992 | .use_clustering = ENABLE_CLUSTERING, | 1992 | .use_clustering = ENABLE_CLUSTERING, |
1993 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1994 | .shost_attrs = twa_host_attrs, | 1993 | .shost_attrs = twa_host_attrs, |
1995 | .emulated = 1 | 1994 | .emulated = 1 |
1996 | }; | 1995 | }; |
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index 59716ebeb10c..d09532162217 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c | |||
@@ -2261,7 +2261,6 @@ static struct scsi_host_template driver_template = { | |||
2261 | .max_sectors = TW_MAX_SECTORS, | 2261 | .max_sectors = TW_MAX_SECTORS, |
2262 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, | 2262 | .cmd_per_lun = TW_MAX_CMDS_PER_LUN, |
2263 | .use_clustering = ENABLE_CLUSTERING, | 2263 | .use_clustering = ENABLE_CLUSTERING, |
2264 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
2265 | .shost_attrs = tw_host_attrs, | 2264 | .shost_attrs = tw_host_attrs, |
2266 | .emulated = 1 | 2265 | .emulated = 1 |
2267 | }; | 2266 | }; |
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c index ead47c143ce0..4d3ebb1af490 100644 --- a/drivers/scsi/BusLogic.c +++ b/drivers/scsi/BusLogic.c | |||
@@ -3575,7 +3575,6 @@ static struct scsi_host_template Bus_Logic_template = { | |||
3575 | .unchecked_isa_dma = 1, | 3575 | .unchecked_isa_dma = 1, |
3576 | .max_sectors = 128, | 3576 | .max_sectors = 128, |
3577 | .use_clustering = ENABLE_CLUSTERING, | 3577 | .use_clustering = ENABLE_CLUSTERING, |
3578 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
3579 | }; | 3578 | }; |
3580 | 3579 | ||
3581 | /* | 3580 | /* |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 3e161cd66463..14fc7f39e83e 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -345,7 +345,7 @@ config ISCSI_TCP | |||
345 | 345 | ||
346 | config SGIWD93_SCSI | 346 | config SGIWD93_SCSI |
347 | tristate "SGI WD93C93 SCSI Driver" | 347 | tristate "SGI WD93C93 SCSI Driver" |
348 | depends on SGI_IP22 && SCSI | 348 | depends on SGI_HAS_WD93 && SCSI |
349 | help | 349 | help |
350 | If you have a Western Digital WD93 SCSI controller on | 350 | If you have a Western Digital WD93 SCSI controller on |
351 | an SGI MIPS system, say Y. Otherwise, say N. | 351 | an SGI MIPS system, say Y. Otherwise, say N. |
diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c index 137d065db3da..6961f78742ae 100644 --- a/drivers/scsi/NCR53c406a.c +++ b/drivers/scsi/NCR53c406a.c | |||
@@ -1065,7 +1065,6 @@ static struct scsi_host_template driver_template = | |||
1065 | .cmd_per_lun = 1 /* commands per lun */, | 1065 | .cmd_per_lun = 1 /* commands per lun */, |
1066 | .unchecked_isa_dma = 1 /* unchecked_isa_dma */, | 1066 | .unchecked_isa_dma = 1 /* unchecked_isa_dma */, |
1067 | .use_clustering = ENABLE_CLUSTERING, | 1067 | .use_clustering = ENABLE_CLUSTERING, |
1068 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1069 | }; | 1068 | }; |
1070 | 1069 | ||
1071 | #include "scsi_module.c" | 1070 | #include "scsi_module.c" |
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c index d3a6d15fb77a..f608d4a1d6da 100644 --- a/drivers/scsi/a100u2w.c +++ b/drivers/scsi/a100u2w.c | |||
@@ -1071,7 +1071,6 @@ static struct scsi_host_template inia100_template = { | |||
1071 | .sg_tablesize = SG_ALL, | 1071 | .sg_tablesize = SG_ALL, |
1072 | .cmd_per_lun = 1, | 1072 | .cmd_per_lun = 1, |
1073 | .use_clustering = ENABLE_CLUSTERING, | 1073 | .use_clustering = ENABLE_CLUSTERING, |
1074 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1075 | }; | 1074 | }; |
1076 | 1075 | ||
1077 | static int __devinit inia100_probe_one(struct pci_dev *pdev, | 1076 | static int __devinit inia100_probe_one(struct pci_dev *pdev, |
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index 851a7e599c50..f8afa358b6b6 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c | |||
@@ -243,7 +243,6 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg) | |||
243 | * Search the list of AdapterFibContext addresses on the adapter | 243 | * Search the list of AdapterFibContext addresses on the adapter |
244 | * to be sure this is a valid address | 244 | * to be sure this is a valid address |
245 | */ | 245 | */ |
246 | spin_lock_irqsave(&dev->fib_lock, flags); | ||
247 | entry = dev->fib_list.next; | 246 | entry = dev->fib_list.next; |
248 | fibctx = NULL; | 247 | fibctx = NULL; |
249 | 248 | ||
@@ -252,25 +251,24 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg) | |||
252 | /* | 251 | /* |
253 | * Extract the AdapterFibContext from the Input parameters. | 252 | * Extract the AdapterFibContext from the Input parameters. |
254 | */ | 253 | */ |
255 | if (fibctx->unique == f.fibctx) { /* We found a winner */ | 254 | if (fibctx->unique == f.fibctx) { /* We found a winner */ |
256 | break; | 255 | break; |
257 | } | 256 | } |
258 | entry = entry->next; | 257 | entry = entry->next; |
259 | fibctx = NULL; | 258 | fibctx = NULL; |
260 | } | 259 | } |
261 | if (!fibctx) { | 260 | if (!fibctx) { |
262 | spin_unlock_irqrestore(&dev->fib_lock, flags); | ||
263 | dprintk ((KERN_INFO "Fib Context not found\n")); | 261 | dprintk ((KERN_INFO "Fib Context not found\n")); |
264 | return -EINVAL; | 262 | return -EINVAL; |
265 | } | 263 | } |
266 | 264 | ||
267 | if((fibctx->type != FSAFS_NTC_GET_ADAPTER_FIB_CONTEXT) || | 265 | if((fibctx->type != FSAFS_NTC_GET_ADAPTER_FIB_CONTEXT) || |
268 | (fibctx->size != sizeof(struct aac_fib_context))) { | 266 | (fibctx->size != sizeof(struct aac_fib_context))) { |
269 | spin_unlock_irqrestore(&dev->fib_lock, flags); | ||
270 | dprintk ((KERN_INFO "Fib Context corrupt?\n")); | 267 | dprintk ((KERN_INFO "Fib Context corrupt?\n")); |
271 | return -EINVAL; | 268 | return -EINVAL; |
272 | } | 269 | } |
273 | status = 0; | 270 | status = 0; |
271 | spin_lock_irqsave(&dev->fib_lock, flags); | ||
274 | /* | 272 | /* |
275 | * If there are no fibs to send back, then either wait or return | 273 | * If there are no fibs to send back, then either wait or return |
276 | * -EAGAIN | 274 | * -EAGAIN |
@@ -328,9 +326,7 @@ return_fib: | |||
328 | int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx) | 326 | int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx) |
329 | { | 327 | { |
330 | struct fib *fib; | 328 | struct fib *fib; |
331 | unsigned long flags; | ||
332 | 329 | ||
333 | spin_lock_irqsave(&dev->fib_lock, flags); | ||
334 | /* | 330 | /* |
335 | * First free any FIBs that have not been consumed. | 331 | * First free any FIBs that have not been consumed. |
336 | */ | 332 | */ |
@@ -353,7 +349,6 @@ int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx) | |||
353 | * Remove the Context from the AdapterFibContext List | 349 | * Remove the Context from the AdapterFibContext List |
354 | */ | 350 | */ |
355 | list_del(&fibctx->next); | 351 | list_del(&fibctx->next); |
356 | spin_unlock_irqrestore(&dev->fib_lock, flags); | ||
357 | /* | 352 | /* |
358 | * Invalidate context | 353 | * Invalidate context |
359 | */ | 354 | */ |
@@ -419,8 +414,8 @@ static int close_getadapter_fib(struct aac_dev * dev, void __user *arg) | |||
419 | * @arg: ioctl arguments | 414 | * @arg: ioctl arguments |
420 | * | 415 | * |
421 | * This routine returns the driver version. | 416 | * This routine returns the driver version. |
422 | * Under Linux, there have been no version incompatibilities, so this is | 417 | * Under Linux, there have been no version incompatibilities, so this is |
423 | * simple! | 418 | * simple! |
424 | */ | 419 | */ |
425 | 420 | ||
426 | static int check_revision(struct aac_dev *dev, void __user *arg) | 421 | static int check_revision(struct aac_dev *dev, void __user *arg) |
@@ -468,7 +463,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
468 | u32 data_dir; | 463 | u32 data_dir; |
469 | void __user *sg_user[32]; | 464 | void __user *sg_user[32]; |
470 | void *sg_list[32]; | 465 | void *sg_list[32]; |
471 | u32 sg_indx = 0; | 466 | u32 sg_indx = 0; |
472 | u32 byte_count = 0; | 467 | u32 byte_count = 0; |
473 | u32 actual_fibsize64, actual_fibsize = 0; | 468 | u32 actual_fibsize64, actual_fibsize = 0; |
474 | int i; | 469 | int i; |
@@ -522,11 +517,11 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg) | |||
522 | // Fix up srb for endian and force some values | 517 | // Fix up srb for endian and force some values |
523 | 518 | ||
524 | srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); // Force this | 519 | srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi); // Force this |
525 | srbcmd->channel = cpu_to_le32(user_srbcmd->channel); | 520 | srbcmd->channel = cpu_to_le32(user_srbcmd->channel); |
526 | srbcmd->id = cpu_to_le32(user_srbcmd->id); | 521 | srbcmd->id = cpu_to_le32(user_srbcmd->id); |
527 | srbcmd->lun = cpu_to_le32(user_srbcmd->lun); | 522 | srbcmd->lun = cpu_to_le32(user_srbcmd->lun); |
528 | srbcmd->timeout = cpu_to_le32(user_srbcmd->timeout); | 523 | srbcmd->timeout = cpu_to_le32(user_srbcmd->timeout); |
529 | srbcmd->flags = cpu_to_le32(flags); | 524 | srbcmd->flags = cpu_to_le32(flags); |
530 | srbcmd->retry_limit = 0; // Obsolete parameter | 525 | srbcmd->retry_limit = 0; // Obsolete parameter |
531 | srbcmd->cdb_size = cpu_to_le32(user_srbcmd->cdb_size); | 526 | srbcmd->cdb_size = cpu_to_le32(user_srbcmd->cdb_size); |
532 | memcpy(srbcmd->cdb, user_srbcmd->cdb, sizeof(srbcmd->cdb)); | 527 | memcpy(srbcmd->cdb, user_srbcmd->cdb, sizeof(srbcmd->cdb)); |
@@ -791,9 +786,9 @@ static int aac_get_pci_info(struct aac_dev* dev, void __user *arg) | |||
791 | pci_info.bus = dev->pdev->bus->number; | 786 | pci_info.bus = dev->pdev->bus->number; |
792 | pci_info.slot = PCI_SLOT(dev->pdev->devfn); | 787 | pci_info.slot = PCI_SLOT(dev->pdev->devfn); |
793 | 788 | ||
794 | if (copy_to_user(arg, &pci_info, sizeof(struct aac_pci_info))) { | 789 | if (copy_to_user(arg, &pci_info, sizeof(struct aac_pci_info))) { |
795 | dprintk((KERN_DEBUG "aacraid: Could not copy pci info\n")); | 790 | dprintk((KERN_DEBUG "aacraid: Could not copy pci info\n")); |
796 | return -EFAULT; | 791 | return -EFAULT; |
797 | } | 792 | } |
798 | return 0; | 793 | return 0; |
799 | } | 794 | } |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 61be22774e99..0e8267c1e915 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -1032,7 +1032,6 @@ static struct scsi_host_template aac_driver_template = { | |||
1032 | .cmd_per_lun = AAC_NUM_IO_FIB, | 1032 | .cmd_per_lun = AAC_NUM_IO_FIB, |
1033 | #endif | 1033 | #endif |
1034 | .use_clustering = ENABLE_CLUSTERING, | 1034 | .use_clustering = ENABLE_CLUSTERING, |
1035 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1036 | .emulated = 1, | 1035 | .emulated = 1, |
1037 | }; | 1036 | }; |
1038 | 1037 | ||
diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c index be58a0b097c7..7c45d88a205b 100644 --- a/drivers/scsi/aha1740.c +++ b/drivers/scsi/aha1740.c | |||
@@ -563,7 +563,6 @@ static struct scsi_host_template aha1740_template = { | |||
563 | .sg_tablesize = AHA1740_SCATTER, | 563 | .sg_tablesize = AHA1740_SCATTER, |
564 | .cmd_per_lun = AHA1740_CMDLUN, | 564 | .cmd_per_lun = AHA1740_CMDLUN, |
565 | .use_clustering = ENABLE_CLUSTERING, | 565 | .use_clustering = ENABLE_CLUSTERING, |
566 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
567 | .eh_abort_handler = aha1740_eh_abort_handler, | 566 | .eh_abort_handler = aha1740_eh_abort_handler, |
568 | }; | 567 | }; |
569 | 568 | ||
diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h index ce638aa6005a..2f00467b6b8c 100644 --- a/drivers/scsi/aic7xxx/aic79xx.h +++ b/drivers/scsi/aic7xxx/aic79xx.h | |||
@@ -1340,8 +1340,10 @@ struct ahd_pci_identity *ahd_find_pci_device(ahd_dev_softc_t); | |||
1340 | int ahd_pci_config(struct ahd_softc *, | 1340 | int ahd_pci_config(struct ahd_softc *, |
1341 | struct ahd_pci_identity *); | 1341 | struct ahd_pci_identity *); |
1342 | int ahd_pci_test_register_access(struct ahd_softc *); | 1342 | int ahd_pci_test_register_access(struct ahd_softc *); |
1343 | #ifdef CONFIG_PM | ||
1343 | void ahd_pci_suspend(struct ahd_softc *); | 1344 | void ahd_pci_suspend(struct ahd_softc *); |
1344 | void ahd_pci_resume(struct ahd_softc *); | 1345 | void ahd_pci_resume(struct ahd_softc *); |
1346 | #endif | ||
1345 | 1347 | ||
1346 | /************************** SCB and SCB queue management **********************/ | 1348 | /************************** SCB and SCB queue management **********************/ |
1347 | void ahd_qinfifo_requeue_tail(struct ahd_softc *ahd, | 1349 | void ahd_qinfifo_requeue_tail(struct ahd_softc *ahd, |
@@ -1352,8 +1354,10 @@ struct ahd_softc *ahd_alloc(void *platform_arg, char *name); | |||
1352 | int ahd_softc_init(struct ahd_softc *); | 1354 | int ahd_softc_init(struct ahd_softc *); |
1353 | void ahd_controller_info(struct ahd_softc *ahd, char *buf); | 1355 | void ahd_controller_info(struct ahd_softc *ahd, char *buf); |
1354 | int ahd_init(struct ahd_softc *ahd); | 1356 | int ahd_init(struct ahd_softc *ahd); |
1357 | #ifdef CONFIG_PM | ||
1355 | int ahd_suspend(struct ahd_softc *ahd); | 1358 | int ahd_suspend(struct ahd_softc *ahd); |
1356 | void ahd_resume(struct ahd_softc *ahd); | 1359 | void ahd_resume(struct ahd_softc *ahd); |
1360 | #endif | ||
1357 | int ahd_default_config(struct ahd_softc *ahd); | 1361 | int ahd_default_config(struct ahd_softc *ahd); |
1358 | int ahd_parse_vpddata(struct ahd_softc *ahd, | 1362 | int ahd_parse_vpddata(struct ahd_softc *ahd, |
1359 | struct vpd_config *vpd); | 1363 | struct vpd_config *vpd); |
@@ -1361,7 +1365,6 @@ int ahd_parse_cfgdata(struct ahd_softc *ahd, | |||
1361 | struct seeprom_config *sc); | 1365 | struct seeprom_config *sc); |
1362 | void ahd_intr_enable(struct ahd_softc *ahd, int enable); | 1366 | void ahd_intr_enable(struct ahd_softc *ahd, int enable); |
1363 | void ahd_pause_and_flushwork(struct ahd_softc *ahd); | 1367 | void ahd_pause_and_flushwork(struct ahd_softc *ahd); |
1364 | int ahd_suspend(struct ahd_softc *ahd); | ||
1365 | void ahd_set_unit(struct ahd_softc *, int); | 1368 | void ahd_set_unit(struct ahd_softc *, int); |
1366 | void ahd_set_name(struct ahd_softc *, char *); | 1369 | void ahd_set_name(struct ahd_softc *, char *); |
1367 | struct scb *ahd_get_scb(struct ahd_softc *ahd, u_int col_idx); | 1370 | struct scb *ahd_get_scb(struct ahd_softc *ahd, u_int col_idx); |
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index a7dd8cdda472..ade0fb8fbdb2 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c | |||
@@ -7175,6 +7175,7 @@ ahd_pause_and_flushwork(struct ahd_softc *ahd) | |||
7175 | ahd->flags &= ~AHD_ALL_INTERRUPTS; | 7175 | ahd->flags &= ~AHD_ALL_INTERRUPTS; |
7176 | } | 7176 | } |
7177 | 7177 | ||
7178 | #ifdef CONFIG_PM | ||
7178 | int | 7179 | int |
7179 | ahd_suspend(struct ahd_softc *ahd) | 7180 | ahd_suspend(struct ahd_softc *ahd) |
7180 | { | 7181 | { |
@@ -7197,6 +7198,7 @@ ahd_resume(struct ahd_softc *ahd) | |||
7197 | ahd_intr_enable(ahd, TRUE); | 7198 | ahd_intr_enable(ahd, TRUE); |
7198 | ahd_restart(ahd); | 7199 | ahd_restart(ahd); |
7199 | } | 7200 | } |
7201 | #endif | ||
7200 | 7202 | ||
7201 | /************************** Busy Target Table *********************************/ | 7203 | /************************** Busy Target Table *********************************/ |
7202 | /* | 7204 | /* |
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 0e4708fd43c8..014654792901 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c | |||
@@ -766,7 +766,6 @@ struct scsi_host_template aic79xx_driver_template = { | |||
766 | .max_sectors = 8192, | 766 | .max_sectors = 8192, |
767 | .cmd_per_lun = 2, | 767 | .cmd_per_lun = 2, |
768 | .use_clustering = ENABLE_CLUSTERING, | 768 | .use_clustering = ENABLE_CLUSTERING, |
769 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
770 | .slave_alloc = ahd_linux_slave_alloc, | 769 | .slave_alloc = ahd_linux_slave_alloc, |
771 | .slave_configure = ahd_linux_slave_configure, | 770 | .slave_configure = ahd_linux_slave_configure, |
772 | .target_alloc = ahd_linux_target_alloc, | 771 | .target_alloc = ahd_linux_target_alloc, |
@@ -1922,7 +1921,7 @@ ahd_linux_queue_cmd_complete(struct ahd_softc *ahd, struct scsi_cmnd *cmd) | |||
1922 | struct scsi_sense_data *sense; | 1921 | struct scsi_sense_data *sense; |
1923 | 1922 | ||
1924 | sense = (struct scsi_sense_data *) | 1923 | sense = (struct scsi_sense_data *) |
1925 | &cmd->sense_buffer; | 1924 | cmd->sense_buffer; |
1926 | if (sense->extra_len >= 5 && | 1925 | if (sense->extra_len >= 5 && |
1927 | (sense->add_sense_code == 0x47 | 1926 | (sense->add_sense_code == 0x47 |
1928 | || sense->add_sense_code == 0x48)) | 1927 | || sense->add_sense_code == 0x48)) |
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c index 66f0259edb69..4150c8a8fdc2 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c | |||
@@ -43,17 +43,6 @@ | |||
43 | #include "aic79xx_inline.h" | 43 | #include "aic79xx_inline.h" |
44 | #include "aic79xx_pci.h" | 44 | #include "aic79xx_pci.h" |
45 | 45 | ||
46 | static int ahd_linux_pci_dev_probe(struct pci_dev *pdev, | ||
47 | const struct pci_device_id *ent); | ||
48 | static int ahd_linux_pci_reserve_io_regions(struct ahd_softc *ahd, | ||
49 | u_long *base, u_long *base2); | ||
50 | static int ahd_linux_pci_reserve_mem_region(struct ahd_softc *ahd, | ||
51 | u_long *bus_addr, | ||
52 | uint8_t __iomem **maddr); | ||
53 | static int ahd_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg); | ||
54 | static int ahd_linux_pci_dev_resume(struct pci_dev *pdev); | ||
55 | static void ahd_linux_pci_dev_remove(struct pci_dev *pdev); | ||
56 | |||
57 | /* Define the macro locally since it's different for different class of chips. | 46 | /* Define the macro locally since it's different for different class of chips. |
58 | */ | 47 | */ |
59 | #define ID(x) \ | 48 | #define ID(x) \ |
@@ -85,17 +74,7 @@ static struct pci_device_id ahd_linux_pci_id_table[] = { | |||
85 | 74 | ||
86 | MODULE_DEVICE_TABLE(pci, ahd_linux_pci_id_table); | 75 | MODULE_DEVICE_TABLE(pci, ahd_linux_pci_id_table); |
87 | 76 | ||
88 | static struct pci_driver aic79xx_pci_driver = { | ||
89 | .name = "aic79xx", | ||
90 | .probe = ahd_linux_pci_dev_probe, | ||
91 | #ifdef CONFIG_PM | 77 | #ifdef CONFIG_PM |
92 | .suspend = ahd_linux_pci_dev_suspend, | ||
93 | .resume = ahd_linux_pci_dev_resume, | ||
94 | #endif | ||
95 | .remove = ahd_linux_pci_dev_remove, | ||
96 | .id_table = ahd_linux_pci_id_table | ||
97 | }; | ||
98 | |||
99 | static int | 78 | static int |
100 | ahd_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg) | 79 | ahd_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg) |
101 | { | 80 | { |
@@ -139,6 +118,7 @@ ahd_linux_pci_dev_resume(struct pci_dev *pdev) | |||
139 | 118 | ||
140 | return rc; | 119 | return rc; |
141 | } | 120 | } |
121 | #endif | ||
142 | 122 | ||
143 | static void | 123 | static void |
144 | ahd_linux_pci_dev_remove(struct pci_dev *pdev) | 124 | ahd_linux_pci_dev_remove(struct pci_dev *pdev) |
@@ -245,6 +225,17 @@ ahd_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
245 | return (0); | 225 | return (0); |
246 | } | 226 | } |
247 | 227 | ||
228 | static struct pci_driver aic79xx_pci_driver = { | ||
229 | .name = "aic79xx", | ||
230 | .probe = ahd_linux_pci_dev_probe, | ||
231 | #ifdef CONFIG_PM | ||
232 | .suspend = ahd_linux_pci_dev_suspend, | ||
233 | .resume = ahd_linux_pci_dev_resume, | ||
234 | #endif | ||
235 | .remove = ahd_linux_pci_dev_remove, | ||
236 | .id_table = ahd_linux_pci_id_table | ||
237 | }; | ||
238 | |||
248 | int | 239 | int |
249 | ahd_linux_pci_init(void) | 240 | ahd_linux_pci_init(void) |
250 | { | 241 | { |
diff --git a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c index 7a203a90601a..df853676e66a 100644 --- a/drivers/scsi/aic7xxx/aic79xx_pci.c +++ b/drivers/scsi/aic7xxx/aic79xx_pci.c | |||
@@ -389,6 +389,7 @@ ahd_pci_config(struct ahd_softc *ahd, struct ahd_pci_identity *entry) | |||
389 | return error; | 389 | return error; |
390 | } | 390 | } |
391 | 391 | ||
392 | #ifdef CONFIG_PM | ||
392 | void | 393 | void |
393 | ahd_pci_suspend(struct ahd_softc *ahd) | 394 | ahd_pci_suspend(struct ahd_softc *ahd) |
394 | { | 395 | { |
@@ -415,6 +416,7 @@ ahd_pci_resume(struct ahd_softc *ahd) | |||
415 | ahd_pci_write_config(ahd->dev_softc, CSIZE_LATTIME, | 416 | ahd_pci_write_config(ahd->dev_softc, CSIZE_LATTIME, |
416 | ahd->suspend_state.pci_state.csize_lattime, /*bytes*/1); | 417 | ahd->suspend_state.pci_state.csize_lattime, /*bytes*/1); |
417 | } | 418 | } |
419 | #endif | ||
418 | 420 | ||
419 | /* | 421 | /* |
420 | * Perform some simple tests that should catch situations where | 422 | * Perform some simple tests that should catch situations where |
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h index 3d4e42d90452..c0344e617651 100644 --- a/drivers/scsi/aic7xxx/aic7xxx.h +++ b/drivers/scsi/aic7xxx/aic7xxx.h | |||
@@ -1143,7 +1143,9 @@ struct ahc_pci_identity *ahc_find_pci_device(ahc_dev_softc_t); | |||
1143 | int ahc_pci_config(struct ahc_softc *, | 1143 | int ahc_pci_config(struct ahc_softc *, |
1144 | struct ahc_pci_identity *); | 1144 | struct ahc_pci_identity *); |
1145 | int ahc_pci_test_register_access(struct ahc_softc *); | 1145 | int ahc_pci_test_register_access(struct ahc_softc *); |
1146 | #ifdef CONFIG_PM | ||
1146 | void ahc_pci_resume(struct ahc_softc *ahc); | 1147 | void ahc_pci_resume(struct ahc_softc *ahc); |
1148 | #endif | ||
1147 | 1149 | ||
1148 | /*************************** EISA/VL Front End ********************************/ | 1150 | /*************************** EISA/VL Front End ********************************/ |
1149 | struct aic7770_identity *aic7770_find_device(uint32_t); | 1151 | struct aic7770_identity *aic7770_find_device(uint32_t); |
@@ -1170,8 +1172,10 @@ int ahc_chip_init(struct ahc_softc *ahc); | |||
1170 | int ahc_init(struct ahc_softc *ahc); | 1172 | int ahc_init(struct ahc_softc *ahc); |
1171 | void ahc_intr_enable(struct ahc_softc *ahc, int enable); | 1173 | void ahc_intr_enable(struct ahc_softc *ahc, int enable); |
1172 | void ahc_pause_and_flushwork(struct ahc_softc *ahc); | 1174 | void ahc_pause_and_flushwork(struct ahc_softc *ahc); |
1175 | #ifdef CONFIG_PM | ||
1173 | int ahc_suspend(struct ahc_softc *ahc); | 1176 | int ahc_suspend(struct ahc_softc *ahc); |
1174 | int ahc_resume(struct ahc_softc *ahc); | 1177 | int ahc_resume(struct ahc_softc *ahc); |
1178 | #endif | ||
1175 | void ahc_set_unit(struct ahc_softc *, int); | 1179 | void ahc_set_unit(struct ahc_softc *, int); |
1176 | void ahc_set_name(struct ahc_softc *, char *); | 1180 | void ahc_set_name(struct ahc_softc *, char *); |
1177 | void ahc_alloc_scbs(struct ahc_softc *ahc); | 1181 | void ahc_alloc_scbs(struct ahc_softc *ahc); |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c index f350b5e89e76..6d2ae641273c 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c | |||
@@ -5078,6 +5078,7 @@ ahc_pause_and_flushwork(struct ahc_softc *ahc) | |||
5078 | ahc->flags &= ~AHC_ALL_INTERRUPTS; | 5078 | ahc->flags &= ~AHC_ALL_INTERRUPTS; |
5079 | } | 5079 | } |
5080 | 5080 | ||
5081 | #ifdef CONFIG_PM | ||
5081 | int | 5082 | int |
5082 | ahc_suspend(struct ahc_softc *ahc) | 5083 | ahc_suspend(struct ahc_softc *ahc) |
5083 | { | 5084 | { |
@@ -5113,7 +5114,7 @@ ahc_resume(struct ahc_softc *ahc) | |||
5113 | ahc_restart(ahc); | 5114 | ahc_restart(ahc); |
5114 | return (0); | 5115 | return (0); |
5115 | } | 5116 | } |
5116 | 5117 | #endif | |
5117 | /************************** Busy Target Table *********************************/ | 5118 | /************************** Busy Target Table *********************************/ |
5118 | /* | 5119 | /* |
5119 | * Return the untagged transaction id for a given target/channel lun. | 5120 | * Return the untagged transaction id for a given target/channel lun. |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index e310e414067f..99a3b33a3233 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c | |||
@@ -747,7 +747,6 @@ struct scsi_host_template aic7xxx_driver_template = { | |||
747 | .max_sectors = 8192, | 747 | .max_sectors = 8192, |
748 | .cmd_per_lun = 2, | 748 | .cmd_per_lun = 2, |
749 | .use_clustering = ENABLE_CLUSTERING, | 749 | .use_clustering = ENABLE_CLUSTERING, |
750 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
751 | .slave_alloc = ahc_linux_slave_alloc, | 750 | .slave_alloc = ahc_linux_slave_alloc, |
752 | .slave_configure = ahc_linux_slave_configure, | 751 | .slave_configure = ahc_linux_slave_configure, |
753 | .target_alloc = ahc_linux_target_alloc, | 752 | .target_alloc = ahc_linux_target_alloc, |
@@ -1658,9 +1657,12 @@ ahc_done(struct ahc_softc *ahc, struct scb *scb) | |||
1658 | untagged_q = &(ahc->untagged_queues[target_offset]); | 1657 | untagged_q = &(ahc->untagged_queues[target_offset]); |
1659 | TAILQ_REMOVE(untagged_q, scb, links.tqe); | 1658 | TAILQ_REMOVE(untagged_q, scb, links.tqe); |
1660 | BUG_ON(!TAILQ_EMPTY(untagged_q)); | 1659 | BUG_ON(!TAILQ_EMPTY(untagged_q)); |
1661 | } | 1660 | } else if ((scb->flags & SCB_ACTIVE) == 0) { |
1662 | 1661 | /* | |
1663 | if ((scb->flags & SCB_ACTIVE) == 0) { | 1662 | * Transactions aborted from the untagged queue may |
1663 | * not have been dispatched to the controller, so | ||
1664 | * only check the SCB_ACTIVE flag for tagged transactions. | ||
1665 | */ | ||
1664 | printf("SCB %d done'd twice\n", scb->hscb->tag); | 1666 | printf("SCB %d done'd twice\n", scb->hscb->tag); |
1665 | ahc_dump_card_state(ahc); | 1667 | ahc_dump_card_state(ahc); |
1666 | panic("Stopping for safety"); | 1668 | panic("Stopping for safety"); |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c index 4488946cff2e..dd6e21d6f1dd 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | |||
@@ -42,17 +42,6 @@ | |||
42 | #include "aic7xxx_osm.h" | 42 | #include "aic7xxx_osm.h" |
43 | #include "aic7xxx_pci.h" | 43 | #include "aic7xxx_pci.h" |
44 | 44 | ||
45 | static int ahc_linux_pci_dev_probe(struct pci_dev *pdev, | ||
46 | const struct pci_device_id *ent); | ||
47 | static int ahc_linux_pci_reserve_io_region(struct ahc_softc *ahc, | ||
48 | u_long *base); | ||
49 | static int ahc_linux_pci_reserve_mem_region(struct ahc_softc *ahc, | ||
50 | u_long *bus_addr, | ||
51 | uint8_t __iomem **maddr); | ||
52 | static int ahc_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg); | ||
53 | static int ahc_linux_pci_dev_resume(struct pci_dev *pdev); | ||
54 | static void ahc_linux_pci_dev_remove(struct pci_dev *pdev); | ||
55 | |||
56 | /* Define the macro locally since it's different for different class of chips. | 45 | /* Define the macro locally since it's different for different class of chips. |
57 | */ | 46 | */ |
58 | #define ID(x) ID_C(x, PCI_CLASS_STORAGE_SCSI) | 47 | #define ID(x) ID_C(x, PCI_CLASS_STORAGE_SCSI) |
@@ -132,17 +121,7 @@ static struct pci_device_id ahc_linux_pci_id_table[] = { | |||
132 | 121 | ||
133 | MODULE_DEVICE_TABLE(pci, ahc_linux_pci_id_table); | 122 | MODULE_DEVICE_TABLE(pci, ahc_linux_pci_id_table); |
134 | 123 | ||
135 | static struct pci_driver aic7xxx_pci_driver = { | ||
136 | .name = "aic7xxx", | ||
137 | .probe = ahc_linux_pci_dev_probe, | ||
138 | #ifdef CONFIG_PM | 124 | #ifdef CONFIG_PM |
139 | .suspend = ahc_linux_pci_dev_suspend, | ||
140 | .resume = ahc_linux_pci_dev_resume, | ||
141 | #endif | ||
142 | .remove = ahc_linux_pci_dev_remove, | ||
143 | .id_table = ahc_linux_pci_id_table | ||
144 | }; | ||
145 | |||
146 | static int | 125 | static int |
147 | ahc_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg) | 126 | ahc_linux_pci_dev_suspend(struct pci_dev *pdev, pm_message_t mesg) |
148 | { | 127 | { |
@@ -182,6 +161,7 @@ ahc_linux_pci_dev_resume(struct pci_dev *pdev) | |||
182 | 161 | ||
183 | return (ahc_resume(ahc)); | 162 | return (ahc_resume(ahc)); |
184 | } | 163 | } |
164 | #endif | ||
185 | 165 | ||
186 | static void | 166 | static void |
187 | ahc_linux_pci_dev_remove(struct pci_dev *pdev) | 167 | ahc_linux_pci_dev_remove(struct pci_dev *pdev) |
@@ -289,6 +269,17 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
289 | return (0); | 269 | return (0); |
290 | } | 270 | } |
291 | 271 | ||
272 | static struct pci_driver aic7xxx_pci_driver = { | ||
273 | .name = "aic7xxx", | ||
274 | .probe = ahc_linux_pci_dev_probe, | ||
275 | #ifdef CONFIG_PM | ||
276 | .suspend = ahc_linux_pci_dev_suspend, | ||
277 | .resume = ahc_linux_pci_dev_resume, | ||
278 | #endif | ||
279 | .remove = ahc_linux_pci_dev_remove, | ||
280 | .id_table = ahc_linux_pci_id_table | ||
281 | }; | ||
282 | |||
292 | int | 283 | int |
293 | ahc_linux_pci_init(void) | 284 | ahc_linux_pci_init(void) |
294 | { | 285 | { |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_pci.c b/drivers/scsi/aic7xxx/aic7xxx_pci.c index ae35937b8055..56848f41e4f9 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_pci.c | |||
@@ -2020,6 +2020,7 @@ ahc_pci_chip_init(struct ahc_softc *ahc) | |||
2020 | return (ahc_chip_init(ahc)); | 2020 | return (ahc_chip_init(ahc)); |
2021 | } | 2021 | } |
2022 | 2022 | ||
2023 | #ifdef CONFIG_PM | ||
2023 | void | 2024 | void |
2024 | ahc_pci_resume(struct ahc_softc *ahc) | 2025 | ahc_pci_resume(struct ahc_softc *ahc) |
2025 | { | 2026 | { |
@@ -2051,6 +2052,7 @@ ahc_pci_resume(struct ahc_softc *ahc) | |||
2051 | ahc_release_seeprom(&sd); | 2052 | ahc_release_seeprom(&sd); |
2052 | } | 2053 | } |
2053 | } | 2054 | } |
2055 | #endif | ||
2054 | 2056 | ||
2055 | static int | 2057 | static int |
2056 | ahc_aic785X_setup(struct ahc_softc *ahc) | 2058 | ahc_aic785X_setup(struct ahc_softc *ahc) |
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c index bcb0b870320c..3bfd9296bbfa 100644 --- a/drivers/scsi/aic7xxx_old.c +++ b/drivers/scsi/aic7xxx_old.c | |||
@@ -11141,7 +11141,6 @@ static struct scsi_host_template driver_template = { | |||
11141 | .max_sectors = 2048, | 11141 | .max_sectors = 2048, |
11142 | .cmd_per_lun = 3, | 11142 | .cmd_per_lun = 3, |
11143 | .use_clustering = ENABLE_CLUSTERING, | 11143 | .use_clustering = ENABLE_CLUSTERING, |
11144 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
11145 | }; | 11144 | }; |
11146 | 11145 | ||
11147 | #include "scsi_module.c" | 11146 | #include "scsi_module.c" |
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index d80dba913a75..f4a202e8df26 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c | |||
@@ -122,7 +122,6 @@ static struct scsi_host_template arcmsr_scsi_host_template = { | |||
122 | .max_sectors = ARCMSR_MAX_XFER_SECTORS, | 122 | .max_sectors = ARCMSR_MAX_XFER_SECTORS, |
123 | .cmd_per_lun = ARCMSR_MAX_CMD_PERLUN, | 123 | .cmd_per_lun = ARCMSR_MAX_CMD_PERLUN, |
124 | .use_clustering = ENABLE_CLUSTERING, | 124 | .use_clustering = ENABLE_CLUSTERING, |
125 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
126 | .shost_attrs = arcmsr_host_attrs, | 125 | .shost_attrs = arcmsr_host_attrs, |
127 | }; | 126 | }; |
128 | #ifdef CONFIG_SCSI_ARCMSR_AER | 127 | #ifdef CONFIG_SCSI_ARCMSR_AER |
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index f93c73c0ba53..22ef3716e786 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c | |||
@@ -4763,7 +4763,6 @@ static struct scsi_host_template dc395x_driver_template = { | |||
4763 | .eh_bus_reset_handler = dc395x_eh_bus_reset, | 4763 | .eh_bus_reset_handler = dc395x_eh_bus_reset, |
4764 | .unchecked_isa_dma = 0, | 4764 | .unchecked_isa_dma = 0, |
4765 | .use_clustering = DISABLE_CLUSTERING, | 4765 | .use_clustering = DISABLE_CLUSTERING, |
4766 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
4767 | }; | 4766 | }; |
4768 | 4767 | ||
4769 | 4768 | ||
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 19cce125124c..c9dd8392aab2 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -3340,7 +3340,6 @@ static struct scsi_host_template driver_template = { | |||
3340 | .this_id = 7, | 3340 | .this_id = 7, |
3341 | .cmd_per_lun = 1, | 3341 | .cmd_per_lun = 1, |
3342 | .use_clustering = ENABLE_CLUSTERING, | 3342 | .use_clustering = ENABLE_CLUSTERING, |
3343 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
3344 | }; | 3343 | }; |
3345 | #include "scsi_module.c" | 3344 | #include "scsi_module.c" |
3346 | MODULE_LICENSE("GPL"); | 3345 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c index 05163cefec12..8be3d76656fa 100644 --- a/drivers/scsi/eata.c +++ b/drivers/scsi/eata.c | |||
@@ -524,7 +524,6 @@ static struct scsi_host_template driver_template = { | |||
524 | .this_id = 7, | 524 | .this_id = 7, |
525 | .unchecked_isa_dma = 1, | 525 | .unchecked_isa_dma = 1, |
526 | .use_clustering = ENABLE_CLUSTERING, | 526 | .use_clustering = ENABLE_CLUSTERING, |
527 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
528 | }; | 527 | }; |
529 | 528 | ||
530 | #if !defined(__BIG_ENDIAN_BITFIELD) && !defined(__LITTLE_ENDIAN_BITFIELD) | 529 | #if !defined(__BIG_ENDIAN_BITFIELD) && !defined(__LITTLE_ENDIAN_BITFIELD) |
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 5ea1f986220c..880c78bff0e1 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
@@ -342,7 +342,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) | |||
342 | shost->use_clustering = sht->use_clustering; | 342 | shost->use_clustering = sht->use_clustering; |
343 | shost->ordered_tag = sht->ordered_tag; | 343 | shost->ordered_tag = sht->ordered_tag; |
344 | shost->active_mode = sht->supported_mode; | 344 | shost->active_mode = sht->supported_mode; |
345 | shost->use_sg_chaining = sht->use_sg_chaining; | ||
346 | 345 | ||
347 | if (sht->supported_mode == MODE_UNKNOWN) | 346 | if (sht->supported_mode == MODE_UNKNOWN) |
348 | /* means we didn't set it ... default to INITIATOR */ | 347 | /* means we didn't set it ... default to INITIATOR */ |
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c index e7b2f3575ce9..ff149ad6bc4e 100644 --- a/drivers/scsi/hptiop.c +++ b/drivers/scsi/hptiop.c | |||
@@ -573,7 +573,7 @@ static void hptiop_finish_scsi_req(struct hptiop_hba *hba, u32 tag, | |||
573 | scsi_set_resid(scp, | 573 | scsi_set_resid(scp, |
574 | scsi_bufflen(scp) - le32_to_cpu(req->dataxfer_length)); | 574 | scsi_bufflen(scp) - le32_to_cpu(req->dataxfer_length)); |
575 | scp->result = SAM_STAT_CHECK_CONDITION; | 575 | scp->result = SAM_STAT_CHECK_CONDITION; |
576 | memcpy(&scp->sense_buffer, &req->sg_list, | 576 | memcpy(scp->sense_buffer, &req->sg_list, |
577 | min_t(size_t, SCSI_SENSE_BUFFERSIZE, | 577 | min_t(size_t, SCSI_SENSE_BUFFERSIZE, |
578 | le32_to_cpu(req->dataxfer_length))); | 578 | le32_to_cpu(req->dataxfer_length))); |
579 | break; | 579 | break; |
@@ -906,7 +906,6 @@ static struct scsi_host_template driver_template = { | |||
906 | .unchecked_isa_dma = 0, | 906 | .unchecked_isa_dma = 0, |
907 | .emulated = 0, | 907 | .emulated = 0, |
908 | .use_clustering = ENABLE_CLUSTERING, | 908 | .use_clustering = ENABLE_CLUSTERING, |
909 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
910 | .proc_name = driver_name, | 909 | .proc_name = driver_name, |
911 | .shost_attrs = hptiop_attrs, | 910 | .shost_attrs = hptiop_attrs, |
912 | .this_id = -1, | 911 | .this_id = -1, |
diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c index db004a450732..4d15a62914e9 100644 --- a/drivers/scsi/ibmmca.c +++ b/drivers/scsi/ibmmca.c | |||
@@ -1501,7 +1501,6 @@ static struct scsi_host_template ibmmca_driver_template = { | |||
1501 | .sg_tablesize = 16, | 1501 | .sg_tablesize = 16, |
1502 | .cmd_per_lun = 1, | 1502 | .cmd_per_lun = 1, |
1503 | .use_clustering = ENABLE_CLUSTERING, | 1503 | .use_clustering = ENABLE_CLUSTERING, |
1504 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1505 | }; | 1504 | }; |
1506 | 1505 | ||
1507 | static int ibmmca_probe(struct device *dev) | 1506 | static int ibmmca_probe(struct device *dev) |
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 30819012898f..78d46a900bb5 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -1600,7 +1600,6 @@ static struct scsi_host_template driver_template = { | |||
1600 | .this_id = -1, | 1600 | .this_id = -1, |
1601 | .sg_tablesize = SG_ALL, | 1601 | .sg_tablesize = SG_ALL, |
1602 | .use_clustering = ENABLE_CLUSTERING, | 1602 | .use_clustering = ENABLE_CLUSTERING, |
1603 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1604 | .shost_attrs = ibmvscsi_attrs, | 1603 | .shost_attrs = ibmvscsi_attrs, |
1605 | }; | 1604 | }; |
1606 | 1605 | ||
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c index a10a5c74b48d..0cc8868ea35d 100644 --- a/drivers/scsi/initio.c +++ b/drivers/scsi/initio.c | |||
@@ -2833,7 +2833,6 @@ static struct scsi_host_template initio_template = { | |||
2833 | .sg_tablesize = SG_ALL, | 2833 | .sg_tablesize = SG_ALL, |
2834 | .cmd_per_lun = 1, | 2834 | .cmd_per_lun = 1, |
2835 | .use_clustering = ENABLE_CLUSTERING, | 2835 | .use_clustering = ENABLE_CLUSTERING, |
2836 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
2837 | }; | 2836 | }; |
2838 | 2837 | ||
2839 | static int initio_probe_one(struct pci_dev *pdev, | 2838 | static int initio_probe_one(struct pci_dev *pdev, |
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index e5be5fd4ef58..b6f99dfbb038 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -1933,7 +1933,6 @@ static struct scsi_host_template iscsi_sht = { | |||
1933 | .eh_device_reset_handler= iscsi_eh_device_reset, | 1933 | .eh_device_reset_handler= iscsi_eh_device_reset, |
1934 | .eh_host_reset_handler = iscsi_eh_host_reset, | 1934 | .eh_host_reset_handler = iscsi_eh_host_reset, |
1935 | .use_clustering = DISABLE_CLUSTERING, | 1935 | .use_clustering = DISABLE_CLUSTERING, |
1936 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1937 | .slave_configure = iscsi_tcp_slave_configure, | 1936 | .slave_configure = iscsi_tcp_slave_configure, |
1938 | .proc_name = "iscsi_tcp", | 1937 | .proc_name = "iscsi_tcp", |
1939 | .this_id = -1, | 1938 | .this_id = -1, |
diff --git a/drivers/scsi/libsrp.c b/drivers/scsi/libsrp.c index 5cff0204227d..6d6a76e65a6c 100644 --- a/drivers/scsi/libsrp.c +++ b/drivers/scsi/libsrp.c | |||
@@ -426,8 +426,8 @@ int srp_cmd_queue(struct Scsi_Host *shost, struct srp_cmd *cmd, void *info, | |||
426 | 426 | ||
427 | sc->SCp.ptr = info; | 427 | sc->SCp.ptr = info; |
428 | memcpy(sc->cmnd, cmd->cdb, MAX_COMMAND_SIZE); | 428 | memcpy(sc->cmnd, cmd->cdb, MAX_COMMAND_SIZE); |
429 | sc->request_bufflen = len; | 429 | sc->sdb.length = len; |
430 | sc->request_buffer = (void *) (unsigned long) addr; | 430 | sc->sdb.table.sgl = (void *) (unsigned long) addr; |
431 | sc->tag = tag; | 431 | sc->tag = tag; |
432 | err = scsi_tgt_queue_command(sc, itn_id, (struct scsi_lun *)&cmd->lun, | 432 | err = scsi_tgt_queue_command(sc, itn_id, (struct scsi_lun *)&cmd->lun, |
433 | cmd->tag); | 433 | cmd->tag); |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 6483c62730b3..fc5c3a42b05a 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -1459,7 +1459,6 @@ struct scsi_host_template lpfc_template = { | |||
1459 | .scan_finished = lpfc_scan_finished, | 1459 | .scan_finished = lpfc_scan_finished, |
1460 | .this_id = -1, | 1460 | .this_id = -1, |
1461 | .sg_tablesize = LPFC_DEFAULT_SG_SEG_CNT, | 1461 | .sg_tablesize = LPFC_DEFAULT_SG_SEG_CNT, |
1462 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1463 | .cmd_per_lun = LPFC_CMD_PER_LUN, | 1462 | .cmd_per_lun = LPFC_CMD_PER_LUN, |
1464 | .use_clustering = ENABLE_CLUSTERING, | 1463 | .use_clustering = ENABLE_CLUSTERING, |
1465 | .shost_attrs = lpfc_hba_attrs, | 1464 | .shost_attrs = lpfc_hba_attrs, |
@@ -1482,7 +1481,6 @@ struct scsi_host_template lpfc_vport_template = { | |||
1482 | .sg_tablesize = LPFC_DEFAULT_SG_SEG_CNT, | 1481 | .sg_tablesize = LPFC_DEFAULT_SG_SEG_CNT, |
1483 | .cmd_per_lun = LPFC_CMD_PER_LUN, | 1482 | .cmd_per_lun = LPFC_CMD_PER_LUN, |
1484 | .use_clustering = ENABLE_CLUSTERING, | 1483 | .use_clustering = ENABLE_CLUSTERING, |
1485 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1486 | .shost_attrs = lpfc_vport_attrs, | 1484 | .shost_attrs = lpfc_vport_attrs, |
1487 | .max_sectors = 0xFFFF, | 1485 | .max_sectors = 0xFFFF, |
1488 | }; | 1486 | }; |
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c index a035001f4438..b12ad7c7c673 100644 --- a/drivers/scsi/mac53c94.c +++ b/drivers/scsi/mac53c94.c | |||
@@ -402,7 +402,6 @@ static struct scsi_host_template mac53c94_template = { | |||
402 | .sg_tablesize = SG_ALL, | 402 | .sg_tablesize = SG_ALL, |
403 | .cmd_per_lun = 1, | 403 | .cmd_per_lun = 1, |
404 | .use_clustering = DISABLE_CLUSTERING, | 404 | .use_clustering = DISABLE_CLUSTERING, |
405 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
406 | }; | 405 | }; |
407 | 406 | ||
408 | static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *match) | 407 | static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *match) |
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 765c24d2bc38..4d59ae8491a4 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -4490,7 +4490,6 @@ static struct scsi_host_template megaraid_template = { | |||
4490 | .sg_tablesize = MAX_SGLIST, | 4490 | .sg_tablesize = MAX_SGLIST, |
4491 | .cmd_per_lun = DEF_CMD_PER_LUN, | 4491 | .cmd_per_lun = DEF_CMD_PER_LUN, |
4492 | .use_clustering = ENABLE_CLUSTERING, | 4492 | .use_clustering = ENABLE_CLUSTERING, |
4493 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
4494 | .eh_abort_handler = megaraid_abort, | 4493 | .eh_abort_handler = megaraid_abort, |
4495 | .eh_device_reset_handler = megaraid_reset, | 4494 | .eh_device_reset_handler = megaraid_reset, |
4496 | .eh_bus_reset_handler = megaraid_reset, | 4495 | .eh_bus_reset_handler = megaraid_reset, |
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index 24e32e446e76..6db77c00e3ee 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c | |||
@@ -361,7 +361,6 @@ static struct scsi_host_template megaraid_template_g = { | |||
361 | .eh_host_reset_handler = megaraid_reset_handler, | 361 | .eh_host_reset_handler = megaraid_reset_handler, |
362 | .change_queue_depth = megaraid_change_queue_depth, | 362 | .change_queue_depth = megaraid_change_queue_depth, |
363 | .use_clustering = ENABLE_CLUSTERING, | 363 | .use_clustering = ENABLE_CLUSTERING, |
364 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
365 | .sdev_attrs = megaraid_sdev_attrs, | 364 | .sdev_attrs = megaraid_sdev_attrs, |
366 | .shost_attrs = megaraid_shost_attrs, | 365 | .shost_attrs = megaraid_shost_attrs, |
367 | }; | 366 | }; |
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index d7ec921865c4..672c759ac24d 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
@@ -1192,7 +1192,6 @@ static struct scsi_host_template megasas_template = { | |||
1192 | .eh_timed_out = megasas_reset_timer, | 1192 | .eh_timed_out = megasas_reset_timer, |
1193 | .bios_param = megasas_bios_param, | 1193 | .bios_param = megasas_bios_param, |
1194 | .use_clustering = ENABLE_CLUSTERING, | 1194 | .use_clustering = ENABLE_CLUSTERING, |
1195 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1196 | }; | 1195 | }; |
1197 | 1196 | ||
1198 | /** | 1197 | /** |
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index 7470ff39ab22..651d09b08f2a 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c | |||
@@ -1843,7 +1843,6 @@ static struct scsi_host_template mesh_template = { | |||
1843 | .sg_tablesize = SG_ALL, | 1843 | .sg_tablesize = SG_ALL, |
1844 | .cmd_per_lun = 2, | 1844 | .cmd_per_lun = 2, |
1845 | .use_clustering = DISABLE_CLUSTERING, | 1845 | .use_clustering = DISABLE_CLUSTERING, |
1846 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1847 | }; | 1846 | }; |
1848 | 1847 | ||
1849 | static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) | 1848 | static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) |
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c index c02771aa6c9b..c5ebf018b378 100644 --- a/drivers/scsi/ncr53c8xx.c +++ b/drivers/scsi/ncr53c8xx.c | |||
@@ -4967,7 +4967,7 @@ void ncr_complete (struct ncb *np, struct ccb *cp) | |||
4967 | sizeof(cp->sense_buf))); | 4967 | sizeof(cp->sense_buf))); |
4968 | 4968 | ||
4969 | if (DEBUG_FLAGS & (DEBUG_RESULT|DEBUG_TINY)) { | 4969 | if (DEBUG_FLAGS & (DEBUG_RESULT|DEBUG_TINY)) { |
4970 | u_char * p = (u_char*) & cmd->sense_buffer; | 4970 | u_char *p = cmd->sense_buffer; |
4971 | int i; | 4971 | int i; |
4972 | PRINT_ADDR(cmd, "sense data:"); | 4972 | PRINT_ADDR(cmd, "sense data:"); |
4973 | for (i=0; i<14; i++) printk (" %x", *p++); | 4973 | for (i=0; i<14; i++) printk (" %x", *p++); |
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c index 28161dc95e0d..7fed35372150 100644 --- a/drivers/scsi/nsp32.c +++ b/drivers/scsi/nsp32.c | |||
@@ -281,7 +281,6 @@ static struct scsi_host_template nsp32_template = { | |||
281 | .cmd_per_lun = 1, | 281 | .cmd_per_lun = 1, |
282 | .this_id = NSP32_HOST_SCSIID, | 282 | .this_id = NSP32_HOST_SCSIID, |
283 | .use_clustering = DISABLE_CLUSTERING, | 283 | .use_clustering = DISABLE_CLUSTERING, |
284 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
285 | .eh_abort_handler = nsp32_eh_abort, | 284 | .eh_abort_handler = nsp32_eh_abort, |
286 | .eh_bus_reset_handler = nsp32_eh_bus_reset, | 285 | .eh_bus_reset_handler = nsp32_eh_bus_reset, |
287 | .eh_host_reset_handler = nsp32_eh_host_reset, | 286 | .eh_host_reset_handler = nsp32_eh_host_reset, |
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 969b9387a0c3..3454a5714749 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c | |||
@@ -692,7 +692,6 @@ static struct scsi_host_template sym53c500_driver_template = { | |||
692 | .sg_tablesize = 32, | 692 | .sg_tablesize = 32, |
693 | .cmd_per_lun = 1, | 693 | .cmd_per_lun = 1, |
694 | .use_clustering = ENABLE_CLUSTERING, | 694 | .use_clustering = ENABLE_CLUSTERING, |
695 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
696 | .shost_attrs = SYM53C500_shost_attrs | 695 | .shost_attrs = SYM53C500_shost_attrs |
697 | }; | 696 | }; |
698 | 697 | ||
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index c94906abfee3..68c0d09ffe78 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c | |||
@@ -4204,7 +4204,6 @@ static struct scsi_host_template qla1280_driver_template = { | |||
4204 | .sg_tablesize = SG_ALL, | 4204 | .sg_tablesize = SG_ALL, |
4205 | .cmd_per_lun = 1, | 4205 | .cmd_per_lun = 1, |
4206 | .use_clustering = ENABLE_CLUSTERING, | 4206 | .use_clustering = ENABLE_CLUSTERING, |
4207 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
4208 | }; | 4207 | }; |
4209 | 4208 | ||
4210 | 4209 | ||
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index aba1e6d48066..3954ed2d7b51 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -131,7 +131,6 @@ static struct scsi_host_template qla2x00_driver_template = { | |||
131 | .this_id = -1, | 131 | .this_id = -1, |
132 | .cmd_per_lun = 3, | 132 | .cmd_per_lun = 3, |
133 | .use_clustering = ENABLE_CLUSTERING, | 133 | .use_clustering = ENABLE_CLUSTERING, |
134 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
135 | .sg_tablesize = SG_ALL, | 134 | .sg_tablesize = SG_ALL, |
136 | 135 | ||
137 | /* | 136 | /* |
@@ -163,7 +162,6 @@ struct scsi_host_template qla24xx_driver_template = { | |||
163 | .this_id = -1, | 162 | .this_id = -1, |
164 | .cmd_per_lun = 3, | 163 | .cmd_per_lun = 3, |
165 | .use_clustering = ENABLE_CLUSTERING, | 164 | .use_clustering = ENABLE_CLUSTERING, |
166 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
167 | .sg_tablesize = SG_ALL, | 165 | .sg_tablesize = SG_ALL, |
168 | 166 | ||
169 | .max_sectors = 0xFFFF, | 167 | .max_sectors = 0xFFFF, |
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index d3f86646cb08..2e2b9fedffcc 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c | |||
@@ -94,7 +94,6 @@ static struct scsi_host_template qla4xxx_driver_template = { | |||
94 | .this_id = -1, | 94 | .this_id = -1, |
95 | .cmd_per_lun = 3, | 95 | .cmd_per_lun = 3, |
96 | .use_clustering = ENABLE_CLUSTERING, | 96 | .use_clustering = ENABLE_CLUSTERING, |
97 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
98 | .sg_tablesize = SG_ALL, | 97 | .sg_tablesize = SG_ALL, |
99 | 98 | ||
100 | .max_sectors = 0xFFFF, | 99 | .max_sectors = 0xFFFF, |
diff --git a/drivers/scsi/qlogicfas.c b/drivers/scsi/qlogicfas.c index 1769f965eedf..1e874f1fb5c6 100644 --- a/drivers/scsi/qlogicfas.c +++ b/drivers/scsi/qlogicfas.c | |||
@@ -197,7 +197,6 @@ static struct scsi_host_template qlogicfas_driver_template = { | |||
197 | .sg_tablesize = SG_ALL, | 197 | .sg_tablesize = SG_ALL, |
198 | .cmd_per_lun = 1, | 198 | .cmd_per_lun = 1, |
199 | .use_clustering = DISABLE_CLUSTERING, | 199 | .use_clustering = DISABLE_CLUSTERING, |
200 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
201 | }; | 200 | }; |
202 | 201 | ||
203 | static __init int qlogicfas_init(void) | 202 | static __init int qlogicfas_init(void) |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 1a9fba6a9f92..b35d19472caa 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -757,7 +757,7 @@ void scsi_finish_command(struct scsi_cmnd *cmd) | |||
757 | "Notifying upper driver of completion " | 757 | "Notifying upper driver of completion " |
758 | "(result %x)\n", cmd->result)); | 758 | "(result %x)\n", cmd->result)); |
759 | 759 | ||
760 | good_bytes = cmd->request_bufflen; | 760 | good_bytes = scsi_bufflen(cmd); |
761 | if (cmd->request->cmd_type != REQ_TYPE_BLOCK_PC) { | 761 | if (cmd->request->cmd_type != REQ_TYPE_BLOCK_PC) { |
762 | drv = scsi_cmd_to_driver(cmd); | 762 | drv = scsi_cmd_to_driver(cmd); |
763 | if (drv->done) | 763 | if (drv->done) |
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 82c06f0a9d02..1541c174937a 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -280,6 +280,8 @@ static int resp_write(struct scsi_cmnd * SCpnt, unsigned long long lba, | |||
280 | unsigned int num, struct sdebug_dev_info * devip); | 280 | unsigned int num, struct sdebug_dev_info * devip); |
281 | static int resp_report_luns(struct scsi_cmnd * SCpnt, | 281 | static int resp_report_luns(struct scsi_cmnd * SCpnt, |
282 | struct sdebug_dev_info * devip); | 282 | struct sdebug_dev_info * devip); |
283 | static int resp_xdwriteread(struct scsi_cmnd *scp, unsigned long long lba, | ||
284 | unsigned int num, struct sdebug_dev_info *devip); | ||
283 | static int fill_from_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr, | 285 | static int fill_from_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr, |
284 | int arr_len); | 286 | int arr_len); |
285 | static int fetch_to_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr, | 287 | static int fetch_to_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr, |
@@ -311,12 +313,48 @@ static void sdebug_max_tgts_luns(void); | |||
311 | static struct device pseudo_primary; | 313 | static struct device pseudo_primary; |
312 | static struct bus_type pseudo_lld_bus; | 314 | static struct bus_type pseudo_lld_bus; |
313 | 315 | ||
316 | static void get_data_transfer_info(unsigned char *cmd, | ||
317 | unsigned long long *lba, unsigned int *num) | ||
318 | { | ||
319 | int i; | ||
320 | |||
321 | switch (*cmd) { | ||
322 | case WRITE_16: | ||
323 | case READ_16: | ||
324 | for (*lba = 0, i = 0; i < 8; ++i) { | ||
325 | if (i > 0) | ||
326 | *lba <<= 8; | ||
327 | *lba += cmd[2 + i]; | ||
328 | } | ||
329 | *num = cmd[13] + (cmd[12] << 8) + | ||
330 | (cmd[11] << 16) + (cmd[10] << 24); | ||
331 | break; | ||
332 | case WRITE_12: | ||
333 | case READ_12: | ||
334 | *lba = cmd[5] + (cmd[4] << 8) + (cmd[3] << 16) + (cmd[2] << 24); | ||
335 | *num = cmd[9] + (cmd[8] << 8) + (cmd[7] << 16) + (cmd[6] << 24); | ||
336 | break; | ||
337 | case WRITE_10: | ||
338 | case READ_10: | ||
339 | case XDWRITEREAD_10: | ||
340 | *lba = cmd[5] + (cmd[4] << 8) + (cmd[3] << 16) + (cmd[2] << 24); | ||
341 | *num = cmd[8] + (cmd[7] << 8); | ||
342 | break; | ||
343 | case WRITE_6: | ||
344 | case READ_6: | ||
345 | *lba = cmd[3] + (cmd[2] << 8) + ((cmd[1] & 0x1f) << 16); | ||
346 | *num = (0 == cmd[4]) ? 256 : cmd[4]; | ||
347 | break; | ||
348 | default: | ||
349 | break; | ||
350 | } | ||
351 | } | ||
314 | 352 | ||
315 | static | 353 | static |
316 | int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done) | 354 | int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done) |
317 | { | 355 | { |
318 | unsigned char *cmd = (unsigned char *) SCpnt->cmnd; | 356 | unsigned char *cmd = (unsigned char *) SCpnt->cmnd; |
319 | int len, k, j; | 357 | int len, k; |
320 | unsigned int num; | 358 | unsigned int num; |
321 | unsigned long long lba; | 359 | unsigned long long lba; |
322 | int errsts = 0; | 360 | int errsts = 0; |
@@ -452,28 +490,7 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done) | |||
452 | break; | 490 | break; |
453 | if (scsi_debug_fake_rw) | 491 | if (scsi_debug_fake_rw) |
454 | break; | 492 | break; |
455 | if ((*cmd) == READ_16) { | 493 | get_data_transfer_info(cmd, &lba, &num); |
456 | for (lba = 0, j = 0; j < 8; ++j) { | ||
457 | if (j > 0) | ||
458 | lba <<= 8; | ||
459 | lba += cmd[2 + j]; | ||
460 | } | ||
461 | num = cmd[13] + (cmd[12] << 8) + | ||
462 | (cmd[11] << 16) + (cmd[10] << 24); | ||
463 | } else if ((*cmd) == READ_12) { | ||
464 | lba = cmd[5] + (cmd[4] << 8) + | ||
465 | (cmd[3] << 16) + (cmd[2] << 24); | ||
466 | num = cmd[9] + (cmd[8] << 8) + | ||
467 | (cmd[7] << 16) + (cmd[6] << 24); | ||
468 | } else if ((*cmd) == READ_10) { | ||
469 | lba = cmd[5] + (cmd[4] << 8) + | ||
470 | (cmd[3] << 16) + (cmd[2] << 24); | ||
471 | num = cmd[8] + (cmd[7] << 8); | ||
472 | } else { /* READ (6) */ | ||
473 | lba = cmd[3] + (cmd[2] << 8) + | ||
474 | ((cmd[1] & 0x1f) << 16); | ||
475 | num = (0 == cmd[4]) ? 256 : cmd[4]; | ||
476 | } | ||
477 | errsts = resp_read(SCpnt, lba, num, devip); | 494 | errsts = resp_read(SCpnt, lba, num, devip); |
478 | if (inj_recovered && (0 == errsts)) { | 495 | if (inj_recovered && (0 == errsts)) { |
479 | mk_sense_buffer(devip, RECOVERED_ERROR, | 496 | mk_sense_buffer(devip, RECOVERED_ERROR, |
@@ -500,28 +517,7 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done) | |||
500 | break; | 517 | break; |
501 | if (scsi_debug_fake_rw) | 518 | if (scsi_debug_fake_rw) |
502 | break; | 519 | break; |
503 | if ((*cmd) == WRITE_16) { | 520 | get_data_transfer_info(cmd, &lba, &num); |
504 | for (lba = 0, j = 0; j < 8; ++j) { | ||
505 | if (j > 0) | ||
506 | lba <<= 8; | ||
507 | lba += cmd[2 + j]; | ||
508 | } | ||
509 | num = cmd[13] + (cmd[12] << 8) + | ||
510 | (cmd[11] << 16) + (cmd[10] << 24); | ||
511 | } else if ((*cmd) == WRITE_12) { | ||
512 | lba = cmd[5] + (cmd[4] << 8) + | ||
513 | (cmd[3] << 16) + (cmd[2] << 24); | ||
514 | num = cmd[9] + (cmd[8] << 8) + | ||
515 | (cmd[7] << 16) + (cmd[6] << 24); | ||
516 | } else if ((*cmd) == WRITE_10) { | ||
517 | lba = cmd[5] + (cmd[4] << 8) + | ||
518 | (cmd[3] << 16) + (cmd[2] << 24); | ||
519 | num = cmd[8] + (cmd[7] << 8); | ||
520 | } else { /* WRITE (6) */ | ||
521 | lba = cmd[3] + (cmd[2] << 8) + | ||
522 | ((cmd[1] & 0x1f) << 16); | ||
523 | num = (0 == cmd[4]) ? 256 : cmd[4]; | ||
524 | } | ||
525 | errsts = resp_write(SCpnt, lba, num, devip); | 521 | errsts = resp_write(SCpnt, lba, num, devip); |
526 | if (inj_recovered && (0 == errsts)) { | 522 | if (inj_recovered && (0 == errsts)) { |
527 | mk_sense_buffer(devip, RECOVERED_ERROR, | 523 | mk_sense_buffer(devip, RECOVERED_ERROR, |
@@ -549,6 +545,28 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done) | |||
549 | case WRITE_BUFFER: | 545 | case WRITE_BUFFER: |
550 | errsts = check_readiness(SCpnt, 1, devip); | 546 | errsts = check_readiness(SCpnt, 1, devip); |
551 | break; | 547 | break; |
548 | case XDWRITEREAD_10: | ||
549 | if (!scsi_bidi_cmnd(SCpnt)) { | ||
550 | mk_sense_buffer(devip, ILLEGAL_REQUEST, | ||
551 | INVALID_FIELD_IN_CDB, 0); | ||
552 | errsts = check_condition_result; | ||
553 | break; | ||
554 | } | ||
555 | |||
556 | errsts = check_readiness(SCpnt, 0, devip); | ||
557 | if (errsts) | ||
558 | break; | ||
559 | if (scsi_debug_fake_rw) | ||
560 | break; | ||
561 | get_data_transfer_info(cmd, &lba, &num); | ||
562 | errsts = resp_read(SCpnt, lba, num, devip); | ||
563 | if (errsts) | ||
564 | break; | ||
565 | errsts = resp_write(SCpnt, lba, num, devip); | ||
566 | if (errsts) | ||
567 | break; | ||
568 | errsts = resp_xdwriteread(SCpnt, lba, num, devip); | ||
569 | break; | ||
552 | default: | 570 | default: |
553 | if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) | 571 | if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) |
554 | printk(KERN_INFO "scsi_debug: Opcode: 0x%x not " | 572 | printk(KERN_INFO "scsi_debug: Opcode: 0x%x not " |
@@ -601,18 +619,18 @@ static int fill_from_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr, | |||
601 | int k, req_len, act_len, len, active; | 619 | int k, req_len, act_len, len, active; |
602 | void * kaddr; | 620 | void * kaddr; |
603 | void * kaddr_off; | 621 | void * kaddr_off; |
604 | struct scatterlist * sg; | 622 | struct scatterlist *sg; |
623 | struct scsi_data_buffer *sdb = scsi_in(scp); | ||
605 | 624 | ||
606 | if (0 == scsi_bufflen(scp)) | 625 | if (!sdb->length) |
607 | return 0; | 626 | return 0; |
608 | if (NULL == scsi_sglist(scp)) | 627 | if (!sdb->table.sgl) |
609 | return (DID_ERROR << 16); | 628 | return (DID_ERROR << 16); |
610 | if (! ((scp->sc_data_direction == DMA_BIDIRECTIONAL) || | 629 | if (!(scsi_bidi_cmnd(scp) || scp->sc_data_direction == DMA_FROM_DEVICE)) |
611 | (scp->sc_data_direction == DMA_FROM_DEVICE))) | ||
612 | return (DID_ERROR << 16); | 630 | return (DID_ERROR << 16); |
613 | active = 1; | 631 | active = 1; |
614 | req_len = act_len = 0; | 632 | req_len = act_len = 0; |
615 | scsi_for_each_sg(scp, sg, scsi_sg_count(scp), k) { | 633 | for_each_sg(sdb->table.sgl, sg, sdb->table.nents, k) { |
616 | if (active) { | 634 | if (active) { |
617 | kaddr = (unsigned char *) | 635 | kaddr = (unsigned char *) |
618 | kmap_atomic(sg_page(sg), KM_USER0); | 636 | kmap_atomic(sg_page(sg), KM_USER0); |
@@ -630,10 +648,10 @@ static int fill_from_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr, | |||
630 | } | 648 | } |
631 | req_len += sg->length; | 649 | req_len += sg->length; |
632 | } | 650 | } |
633 | if (scsi_get_resid(scp)) | 651 | if (sdb->resid) |
634 | scsi_set_resid(scp, scsi_get_resid(scp) - act_len); | 652 | sdb->resid -= act_len; |
635 | else | 653 | else |
636 | scsi_set_resid(scp, req_len - act_len); | 654 | sdb->resid = req_len - act_len; |
637 | return 0; | 655 | return 0; |
638 | } | 656 | } |
639 | 657 | ||
@@ -650,8 +668,7 @@ static int fetch_to_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr, | |||
650 | return 0; | 668 | return 0; |
651 | if (NULL == scsi_sglist(scp)) | 669 | if (NULL == scsi_sglist(scp)) |
652 | return -1; | 670 | return -1; |
653 | if (! ((scp->sc_data_direction == DMA_BIDIRECTIONAL) || | 671 | if (!(scsi_bidi_cmnd(scp) || scp->sc_data_direction == DMA_TO_DEVICE)) |
654 | (scp->sc_data_direction == DMA_TO_DEVICE))) | ||
655 | return -1; | 672 | return -1; |
656 | req_len = fin = 0; | 673 | req_len = fin = 0; |
657 | scsi_for_each_sg(scp, sg, scsi_sg_count(scp), k) { | 674 | scsi_for_each_sg(scp, sg, scsi_sg_count(scp), k) { |
@@ -1956,6 +1973,50 @@ static int resp_report_luns(struct scsi_cmnd * scp, | |||
1956 | min((int)alloc_len, SDEBUG_RLUN_ARR_SZ)); | 1973 | min((int)alloc_len, SDEBUG_RLUN_ARR_SZ)); |
1957 | } | 1974 | } |
1958 | 1975 | ||
1976 | static int resp_xdwriteread(struct scsi_cmnd *scp, unsigned long long lba, | ||
1977 | unsigned int num, struct sdebug_dev_info *devip) | ||
1978 | { | ||
1979 | int i, j, ret = -1; | ||
1980 | unsigned char *kaddr, *buf; | ||
1981 | unsigned int offset; | ||
1982 | struct scatterlist *sg; | ||
1983 | struct scsi_data_buffer *sdb = scsi_in(scp); | ||
1984 | |||
1985 | /* better not to use temporary buffer. */ | ||
1986 | buf = kmalloc(scsi_bufflen(scp), GFP_ATOMIC); | ||
1987 | if (!buf) | ||
1988 | return ret; | ||
1989 | |||
1990 | offset = 0; | ||
1991 | scsi_for_each_sg(scp, sg, scsi_sg_count(scp), i) { | ||
1992 | kaddr = (unsigned char *)kmap_atomic(sg_page(sg), KM_USER0); | ||
1993 | if (!kaddr) | ||
1994 | goto out; | ||
1995 | |||
1996 | memcpy(buf + offset, kaddr + sg->offset, sg->length); | ||
1997 | offset += sg->length; | ||
1998 | kunmap_atomic(kaddr, KM_USER0); | ||
1999 | } | ||
2000 | |||
2001 | offset = 0; | ||
2002 | for_each_sg(sdb->table.sgl, sg, sdb->table.nents, i) { | ||
2003 | kaddr = (unsigned char *)kmap_atomic(sg_page(sg), KM_USER0); | ||
2004 | if (!kaddr) | ||
2005 | goto out; | ||
2006 | |||
2007 | for (j = 0; j < sg->length; j++) | ||
2008 | *(kaddr + sg->offset + j) ^= *(buf + offset + j); | ||
2009 | |||
2010 | offset += sg->length; | ||
2011 | kunmap_atomic(kaddr, KM_USER0); | ||
2012 | } | ||
2013 | ret = 0; | ||
2014 | out: | ||
2015 | kfree(buf); | ||
2016 | |||
2017 | return ret; | ||
2018 | } | ||
2019 | |||
1959 | /* When timer goes off this function is called. */ | 2020 | /* When timer goes off this function is called. */ |
1960 | static void timer_intr_handler(unsigned long indx) | 2021 | static void timer_intr_handler(unsigned long indx) |
1961 | { | 2022 | { |
@@ -1989,6 +2050,7 @@ static int scsi_debug_slave_alloc(struct scsi_device * sdp) | |||
1989 | if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) | 2050 | if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) |
1990 | printk(KERN_INFO "scsi_debug: slave_alloc <%u %u %u %u>\n", | 2051 | printk(KERN_INFO "scsi_debug: slave_alloc <%u %u %u %u>\n", |
1991 | sdp->host->host_no, sdp->channel, sdp->id, sdp->lun); | 2052 | sdp->host->host_no, sdp->channel, sdp->id, sdp->lun); |
2053 | set_bit(QUEUE_FLAG_BIDI, &sdp->request_queue->queue_flags); | ||
1992 | return 0; | 2054 | return 0; |
1993 | } | 2055 | } |
1994 | 2056 | ||
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 547e85aa414f..045a0868fc7b 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -617,29 +617,27 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, | |||
617 | ses->cmd_len = scmd->cmd_len; | 617 | ses->cmd_len = scmd->cmd_len; |
618 | memcpy(ses->cmnd, scmd->cmnd, sizeof(scmd->cmnd)); | 618 | memcpy(ses->cmnd, scmd->cmnd, sizeof(scmd->cmnd)); |
619 | ses->data_direction = scmd->sc_data_direction; | 619 | ses->data_direction = scmd->sc_data_direction; |
620 | ses->bufflen = scmd->request_bufflen; | 620 | ses->sdb = scmd->sdb; |
621 | ses->buffer = scmd->request_buffer; | 621 | ses->next_rq = scmd->request->next_rq; |
622 | ses->use_sg = scmd->use_sg; | ||
623 | ses->resid = scmd->resid; | ||
624 | ses->result = scmd->result; | 622 | ses->result = scmd->result; |
625 | 623 | ||
624 | memset(&scmd->sdb, 0, sizeof(scmd->sdb)); | ||
625 | scmd->request->next_rq = NULL; | ||
626 | |||
626 | if (sense_bytes) { | 627 | if (sense_bytes) { |
627 | scmd->request_bufflen = min_t(unsigned, | 628 | scmd->sdb.length = min_t(unsigned, SCSI_SENSE_BUFFERSIZE, |
628 | SCSI_SENSE_BUFFERSIZE, sense_bytes); | 629 | sense_bytes); |
629 | sg_init_one(&ses->sense_sgl, scmd->sense_buffer, | 630 | sg_init_one(&ses->sense_sgl, scmd->sense_buffer, |
630 | scmd->request_bufflen); | 631 | scmd->sdb.length); |
631 | scmd->request_buffer = &ses->sense_sgl; | 632 | scmd->sdb.table.sgl = &ses->sense_sgl; |
632 | scmd->sc_data_direction = DMA_FROM_DEVICE; | 633 | scmd->sc_data_direction = DMA_FROM_DEVICE; |
633 | scmd->use_sg = 1; | 634 | scmd->sdb.table.nents = 1; |
634 | memset(scmd->cmnd, 0, sizeof(scmd->cmnd)); | 635 | memset(scmd->cmnd, 0, sizeof(scmd->cmnd)); |
635 | scmd->cmnd[0] = REQUEST_SENSE; | 636 | scmd->cmnd[0] = REQUEST_SENSE; |
636 | scmd->cmnd[4] = scmd->request_bufflen; | 637 | scmd->cmnd[4] = scmd->sdb.length; |
637 | scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); | 638 | scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); |
638 | } else { | 639 | } else { |
639 | scmd->request_buffer = NULL; | ||
640 | scmd->request_bufflen = 0; | ||
641 | scmd->sc_data_direction = DMA_NONE; | 640 | scmd->sc_data_direction = DMA_NONE; |
642 | scmd->use_sg = 0; | ||
643 | if (cmnd) { | 641 | if (cmnd) { |
644 | memset(scmd->cmnd, 0, sizeof(scmd->cmnd)); | 642 | memset(scmd->cmnd, 0, sizeof(scmd->cmnd)); |
645 | memcpy(scmd->cmnd, cmnd, cmnd_size); | 643 | memcpy(scmd->cmnd, cmnd, cmnd_size); |
@@ -676,10 +674,8 @@ void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses) | |||
676 | scmd->cmd_len = ses->cmd_len; | 674 | scmd->cmd_len = ses->cmd_len; |
677 | memcpy(scmd->cmnd, ses->cmnd, sizeof(scmd->cmnd)); | 675 | memcpy(scmd->cmnd, ses->cmnd, sizeof(scmd->cmnd)); |
678 | scmd->sc_data_direction = ses->data_direction; | 676 | scmd->sc_data_direction = ses->data_direction; |
679 | scmd->request_bufflen = ses->bufflen; | 677 | scmd->sdb = ses->sdb; |
680 | scmd->request_buffer = ses->buffer; | 678 | scmd->request->next_rq = ses->next_rq; |
681 | scmd->use_sg = ses->use_sg; | ||
682 | scmd->resid = ses->resid; | ||
683 | scmd->result = ses->result; | 679 | scmd->result = ses->result; |
684 | } | 680 | } |
685 | EXPORT_SYMBOL(scsi_eh_restore_cmnd); | 681 | EXPORT_SYMBOL(scsi_eh_restore_cmnd); |
@@ -1700,8 +1696,7 @@ scsi_reset_provider(struct scsi_device *dev, int flag) | |||
1700 | memset(&scmd->cmnd, '\0', sizeof(scmd->cmnd)); | 1696 | memset(&scmd->cmnd, '\0', sizeof(scmd->cmnd)); |
1701 | 1697 | ||
1702 | scmd->scsi_done = scsi_reset_provider_done_command; | 1698 | scmd->scsi_done = scsi_reset_provider_done_command; |
1703 | scmd->request_buffer = NULL; | 1699 | memset(&scmd->sdb, 0, sizeof(scmd->sdb)); |
1704 | scmd->request_bufflen = 0; | ||
1705 | 1700 | ||
1706 | scmd->cmd_len = 0; | 1701 | scmd->cmd_len = 0; |
1707 | 1702 | ||
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 7c4c889c5221..b12fb310e399 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/bio.h> | 10 | #include <linux/bio.h> |
11 | #include <linux/bitops.h> | ||
11 | #include <linux/blkdev.h> | 12 | #include <linux/blkdev.h> |
12 | #include <linux/completion.h> | 13 | #include <linux/completion.h> |
13 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
@@ -34,13 +35,6 @@ | |||
34 | #define SG_MEMPOOL_NR ARRAY_SIZE(scsi_sg_pools) | 35 | #define SG_MEMPOOL_NR ARRAY_SIZE(scsi_sg_pools) |
35 | #define SG_MEMPOOL_SIZE 2 | 36 | #define SG_MEMPOOL_SIZE 2 |
36 | 37 | ||
37 | /* | ||
38 | * The maximum number of SG segments that we will put inside a scatterlist | ||
39 | * (unless chaining is used). Should ideally fit inside a single page, to | ||
40 | * avoid a higher order allocation. | ||
41 | */ | ||
42 | #define SCSI_MAX_SG_SEGMENTS 128 | ||
43 | |||
44 | struct scsi_host_sg_pool { | 38 | struct scsi_host_sg_pool { |
45 | size_t size; | 39 | size_t size; |
46 | char *name; | 40 | char *name; |
@@ -48,22 +42,31 @@ struct scsi_host_sg_pool { | |||
48 | mempool_t *pool; | 42 | mempool_t *pool; |
49 | }; | 43 | }; |
50 | 44 | ||
51 | #define SP(x) { x, "sgpool-" #x } | 45 | #define SP(x) { x, "sgpool-" __stringify(x) } |
46 | #if (SCSI_MAX_SG_SEGMENTS < 32) | ||
47 | #error SCSI_MAX_SG_SEGMENTS is too small (must be 32 or greater) | ||
48 | #endif | ||
52 | static struct scsi_host_sg_pool scsi_sg_pools[] = { | 49 | static struct scsi_host_sg_pool scsi_sg_pools[] = { |
53 | SP(8), | 50 | SP(8), |
54 | SP(16), | 51 | SP(16), |
55 | #if (SCSI_MAX_SG_SEGMENTS > 16) | ||
56 | SP(32), | ||
57 | #if (SCSI_MAX_SG_SEGMENTS > 32) | 52 | #if (SCSI_MAX_SG_SEGMENTS > 32) |
58 | SP(64), | 53 | SP(32), |
59 | #if (SCSI_MAX_SG_SEGMENTS > 64) | 54 | #if (SCSI_MAX_SG_SEGMENTS > 64) |
55 | SP(64), | ||
56 | #if (SCSI_MAX_SG_SEGMENTS > 128) | ||
60 | SP(128), | 57 | SP(128), |
58 | #if (SCSI_MAX_SG_SEGMENTS > 256) | ||
59 | #error SCSI_MAX_SG_SEGMENTS is too large (256 MAX) | ||
60 | #endif | ||
61 | #endif | 61 | #endif |
62 | #endif | 62 | #endif |
63 | #endif | 63 | #endif |
64 | SP(SCSI_MAX_SG_SEGMENTS) | ||
64 | }; | 65 | }; |
65 | #undef SP | 66 | #undef SP |
66 | 67 | ||
68 | static struct kmem_cache *scsi_bidi_sdb_cache; | ||
69 | |||
67 | static void scsi_run_queue(struct request_queue *q); | 70 | static void scsi_run_queue(struct request_queue *q); |
68 | 71 | ||
69 | /* | 72 | /* |
@@ -440,7 +443,7 @@ EXPORT_SYMBOL_GPL(scsi_execute_async); | |||
440 | static void scsi_init_cmd_errh(struct scsi_cmnd *cmd) | 443 | static void scsi_init_cmd_errh(struct scsi_cmnd *cmd) |
441 | { | 444 | { |
442 | cmd->serial_number = 0; | 445 | cmd->serial_number = 0; |
443 | cmd->resid = 0; | 446 | scsi_set_resid(cmd, 0); |
444 | memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); | 447 | memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); |
445 | if (cmd->cmd_len == 0) | 448 | if (cmd->cmd_len == 0) |
446 | cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]); | 449 | cmd->cmd_len = COMMAND_SIZE(cmd->cmnd[0]); |
@@ -690,42 +693,16 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int error, | |||
690 | return NULL; | 693 | return NULL; |
691 | } | 694 | } |
692 | 695 | ||
693 | /* | ||
694 | * Like SCSI_MAX_SG_SEGMENTS, but for archs that have sg chaining. This limit | ||
695 | * is totally arbitrary, a setting of 2048 will get you at least 8mb ios. | ||
696 | */ | ||
697 | #define SCSI_MAX_SG_CHAIN_SEGMENTS 2048 | ||
698 | |||
699 | static inline unsigned int scsi_sgtable_index(unsigned short nents) | 696 | static inline unsigned int scsi_sgtable_index(unsigned short nents) |
700 | { | 697 | { |
701 | unsigned int index; | 698 | unsigned int index; |
702 | 699 | ||
703 | switch (nents) { | 700 | BUG_ON(nents > SCSI_MAX_SG_SEGMENTS); |
704 | case 1 ... 8: | 701 | |
702 | if (nents <= 8) | ||
705 | index = 0; | 703 | index = 0; |
706 | break; | 704 | else |
707 | case 9 ... 16: | 705 | index = get_count_order(nents) - 3; |
708 | index = 1; | ||
709 | break; | ||
710 | #if (SCSI_MAX_SG_SEGMENTS > 16) | ||
711 | case 17 ... 32: | ||
712 | index = 2; | ||
713 | break; | ||
714 | #if (SCSI_MAX_SG_SEGMENTS > 32) | ||
715 | case 33 ... 64: | ||
716 | index = 3; | ||
717 | break; | ||
718 | #if (SCSI_MAX_SG_SEGMENTS > 64) | ||
719 | case 65 ... 128: | ||
720 | index = 4; | ||
721 | break; | ||
722 | #endif | ||
723 | #endif | ||
724 | #endif | ||
725 | default: | ||
726 | printk(KERN_ERR "scsi: bad segment count=%d\n", nents); | ||
727 | BUG(); | ||
728 | } | ||
729 | 706 | ||
730 | return index; | 707 | return index; |
731 | } | 708 | } |
@@ -746,31 +723,27 @@ static struct scatterlist *scsi_sg_alloc(unsigned int nents, gfp_t gfp_mask) | |||
746 | return mempool_alloc(sgp->pool, gfp_mask); | 723 | return mempool_alloc(sgp->pool, gfp_mask); |
747 | } | 724 | } |
748 | 725 | ||
749 | int scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask) | 726 | static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, |
727 | gfp_t gfp_mask) | ||
750 | { | 728 | { |
751 | int ret; | 729 | int ret; |
752 | 730 | ||
753 | BUG_ON(!cmd->use_sg); | 731 | BUG_ON(!nents); |
754 | 732 | ||
755 | ret = __sg_alloc_table(&cmd->sg_table, cmd->use_sg, | 733 | ret = __sg_alloc_table(&sdb->table, nents, SCSI_MAX_SG_SEGMENTS, |
756 | SCSI_MAX_SG_SEGMENTS, gfp_mask, scsi_sg_alloc); | 734 | gfp_mask, scsi_sg_alloc); |
757 | if (unlikely(ret)) | 735 | if (unlikely(ret)) |
758 | __sg_free_table(&cmd->sg_table, SCSI_MAX_SG_SEGMENTS, | 736 | __sg_free_table(&sdb->table, SCSI_MAX_SG_SEGMENTS, |
759 | scsi_sg_free); | 737 | scsi_sg_free); |
760 | 738 | ||
761 | cmd->request_buffer = cmd->sg_table.sgl; | ||
762 | return ret; | 739 | return ret; |
763 | } | 740 | } |
764 | 741 | ||
765 | EXPORT_SYMBOL(scsi_alloc_sgtable); | 742 | static void scsi_free_sgtable(struct scsi_data_buffer *sdb) |
766 | |||
767 | void scsi_free_sgtable(struct scsi_cmnd *cmd) | ||
768 | { | 743 | { |
769 | __sg_free_table(&cmd->sg_table, SCSI_MAX_SG_SEGMENTS, scsi_sg_free); | 744 | __sg_free_table(&sdb->table, SCSI_MAX_SG_SEGMENTS, scsi_sg_free); |
770 | } | 745 | } |
771 | 746 | ||
772 | EXPORT_SYMBOL(scsi_free_sgtable); | ||
773 | |||
774 | /* | 747 | /* |
775 | * Function: scsi_release_buffers() | 748 | * Function: scsi_release_buffers() |
776 | * | 749 | * |
@@ -788,17 +761,49 @@ EXPORT_SYMBOL(scsi_free_sgtable); | |||
788 | * the scatter-gather table, and potentially any bounce | 761 | * the scatter-gather table, and potentially any bounce |
789 | * buffers. | 762 | * buffers. |
790 | */ | 763 | */ |
791 | static void scsi_release_buffers(struct scsi_cmnd *cmd) | 764 | void scsi_release_buffers(struct scsi_cmnd *cmd) |
765 | { | ||
766 | if (cmd->sdb.table.nents) | ||
767 | scsi_free_sgtable(&cmd->sdb); | ||
768 | |||
769 | memset(&cmd->sdb, 0, sizeof(cmd->sdb)); | ||
770 | |||
771 | if (scsi_bidi_cmnd(cmd)) { | ||
772 | struct scsi_data_buffer *bidi_sdb = | ||
773 | cmd->request->next_rq->special; | ||
774 | scsi_free_sgtable(bidi_sdb); | ||
775 | kmem_cache_free(scsi_bidi_sdb_cache, bidi_sdb); | ||
776 | cmd->request->next_rq->special = NULL; | ||
777 | } | ||
778 | } | ||
779 | EXPORT_SYMBOL(scsi_release_buffers); | ||
780 | |||
781 | /* | ||
782 | * Bidi commands Must be complete as a whole, both sides at once. | ||
783 | * If part of the bytes were written and lld returned | ||
784 | * scsi_in()->resid and/or scsi_out()->resid this information will be left | ||
785 | * in req->data_len and req->next_rq->data_len. The upper-layer driver can | ||
786 | * decide what to do with this information. | ||
787 | */ | ||
788 | void scsi_end_bidi_request(struct scsi_cmnd *cmd) | ||
792 | { | 789 | { |
793 | if (cmd->use_sg) | 790 | struct request *req = cmd->request; |
794 | scsi_free_sgtable(cmd); | 791 | unsigned int dlen = req->data_len; |
792 | unsigned int next_dlen = req->next_rq->data_len; | ||
793 | |||
794 | req->data_len = scsi_out(cmd)->resid; | ||
795 | req->next_rq->data_len = scsi_in(cmd)->resid; | ||
796 | |||
797 | /* The req and req->next_rq have not been completed */ | ||
798 | BUG_ON(blk_end_bidi_request(req, 0, dlen, next_dlen)); | ||
799 | |||
800 | scsi_release_buffers(cmd); | ||
795 | 801 | ||
796 | /* | 802 | /* |
797 | * Zero these out. They now point to freed memory, and it is | 803 | * This will goose the queue request function at the end, so we don't |
798 | * dangerous to hang onto the pointers. | 804 | * need to worry about launching another command. |
799 | */ | 805 | */ |
800 | cmd->request_buffer = NULL; | 806 | scsi_next_command(cmd); |
801 | cmd->request_bufflen = 0; | ||
802 | } | 807 | } |
803 | 808 | ||
804 | /* | 809 | /* |
@@ -832,7 +837,7 @@ static void scsi_release_buffers(struct scsi_cmnd *cmd) | |||
832 | void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | 837 | void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) |
833 | { | 838 | { |
834 | int result = cmd->result; | 839 | int result = cmd->result; |
835 | int this_count = cmd->request_bufflen; | 840 | int this_count = scsi_bufflen(cmd); |
836 | struct request_queue *q = cmd->device->request_queue; | 841 | struct request_queue *q = cmd->device->request_queue; |
837 | struct request *req = cmd->request; | 842 | struct request *req = cmd->request; |
838 | int clear_errors = 1; | 843 | int clear_errors = 1; |
@@ -840,8 +845,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
840 | int sense_valid = 0; | 845 | int sense_valid = 0; |
841 | int sense_deferred = 0; | 846 | int sense_deferred = 0; |
842 | 847 | ||
843 | scsi_release_buffers(cmd); | ||
844 | |||
845 | if (result) { | 848 | if (result) { |
846 | sense_valid = scsi_command_normalize_sense(cmd, &sshdr); | 849 | sense_valid = scsi_command_normalize_sense(cmd, &sshdr); |
847 | if (sense_valid) | 850 | if (sense_valid) |
@@ -864,9 +867,17 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
864 | req->sense_len = len; | 867 | req->sense_len = len; |
865 | } | 868 | } |
866 | } | 869 | } |
867 | req->data_len = cmd->resid; | 870 | if (scsi_bidi_cmnd(cmd)) { |
871 | /* will also release_buffers */ | ||
872 | scsi_end_bidi_request(cmd); | ||
873 | return; | ||
874 | } | ||
875 | req->data_len = scsi_get_resid(cmd); | ||
868 | } | 876 | } |
869 | 877 | ||
878 | BUG_ON(blk_bidi_rq(req)); /* bidi not support for !blk_pc_request yet */ | ||
879 | scsi_release_buffers(cmd); | ||
880 | |||
870 | /* | 881 | /* |
871 | * Next deal with any sectors which we were able to correctly | 882 | * Next deal with any sectors which we were able to correctly |
872 | * handle. | 883 | * handle. |
@@ -874,7 +885,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
874 | SCSI_LOG_HLCOMPLETE(1, printk("%ld sectors total, " | 885 | SCSI_LOG_HLCOMPLETE(1, printk("%ld sectors total, " |
875 | "%d bytes done.\n", | 886 | "%d bytes done.\n", |
876 | req->nr_sectors, good_bytes)); | 887 | req->nr_sectors, good_bytes)); |
877 | SCSI_LOG_HLCOMPLETE(1, printk("use_sg is %d\n", cmd->use_sg)); | ||
878 | 888 | ||
879 | if (clear_errors) | 889 | if (clear_errors) |
880 | req->errors = 0; | 890 | req->errors = 0; |
@@ -991,52 +1001,80 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
991 | scsi_end_request(cmd, -EIO, this_count, !result); | 1001 | scsi_end_request(cmd, -EIO, this_count, !result); |
992 | } | 1002 | } |
993 | 1003 | ||
994 | /* | 1004 | static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb, |
995 | * Function: scsi_init_io() | 1005 | gfp_t gfp_mask) |
996 | * | ||
997 | * Purpose: SCSI I/O initialize function. | ||
998 | * | ||
999 | * Arguments: cmd - Command descriptor we wish to initialize | ||
1000 | * | ||
1001 | * Returns: 0 on success | ||
1002 | * BLKPREP_DEFER if the failure is retryable | ||
1003 | */ | ||
1004 | static int scsi_init_io(struct scsi_cmnd *cmd) | ||
1005 | { | 1006 | { |
1006 | struct request *req = cmd->request; | 1007 | int count; |
1007 | int count; | ||
1008 | |||
1009 | /* | ||
1010 | * We used to not use scatter-gather for single segment request, | ||
1011 | * but now we do (it makes highmem I/O easier to support without | ||
1012 | * kmapping pages) | ||
1013 | */ | ||
1014 | cmd->use_sg = req->nr_phys_segments; | ||
1015 | 1008 | ||
1016 | /* | 1009 | /* |
1017 | * If sg table allocation fails, requeue request later. | 1010 | * If sg table allocation fails, requeue request later. |
1018 | */ | 1011 | */ |
1019 | if (unlikely(scsi_alloc_sgtable(cmd, GFP_ATOMIC))) { | 1012 | if (unlikely(scsi_alloc_sgtable(sdb, req->nr_phys_segments, |
1020 | scsi_unprep_request(req); | 1013 | gfp_mask))) { |
1021 | return BLKPREP_DEFER; | 1014 | return BLKPREP_DEFER; |
1022 | } | 1015 | } |
1023 | 1016 | ||
1024 | req->buffer = NULL; | 1017 | req->buffer = NULL; |
1025 | if (blk_pc_request(req)) | 1018 | if (blk_pc_request(req)) |
1026 | cmd->request_bufflen = req->data_len; | 1019 | sdb->length = req->data_len; |
1027 | else | 1020 | else |
1028 | cmd->request_bufflen = req->nr_sectors << 9; | 1021 | sdb->length = req->nr_sectors << 9; |
1029 | 1022 | ||
1030 | /* | 1023 | /* |
1031 | * Next, walk the list, and fill in the addresses and sizes of | 1024 | * Next, walk the list, and fill in the addresses and sizes of |
1032 | * each segment. | 1025 | * each segment. |
1033 | */ | 1026 | */ |
1034 | count = blk_rq_map_sg(req->q, req, cmd->request_buffer); | 1027 | count = blk_rq_map_sg(req->q, req, sdb->table.sgl); |
1035 | BUG_ON(count > cmd->use_sg); | 1028 | BUG_ON(count > sdb->table.nents); |
1036 | cmd->use_sg = count; | 1029 | sdb->table.nents = count; |
1037 | return BLKPREP_OK; | 1030 | return BLKPREP_OK; |
1038 | } | 1031 | } |
1039 | 1032 | ||
1033 | /* | ||
1034 | * Function: scsi_init_io() | ||
1035 | * | ||
1036 | * Purpose: SCSI I/O initialize function. | ||
1037 | * | ||
1038 | * Arguments: cmd - Command descriptor we wish to initialize | ||
1039 | * | ||
1040 | * Returns: 0 on success | ||
1041 | * BLKPREP_DEFER if the failure is retryable | ||
1042 | * BLKPREP_KILL if the failure is fatal | ||
1043 | */ | ||
1044 | int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask) | ||
1045 | { | ||
1046 | int error = scsi_init_sgtable(cmd->request, &cmd->sdb, gfp_mask); | ||
1047 | if (error) | ||
1048 | goto err_exit; | ||
1049 | |||
1050 | if (blk_bidi_rq(cmd->request)) { | ||
1051 | struct scsi_data_buffer *bidi_sdb = kmem_cache_zalloc( | ||
1052 | scsi_bidi_sdb_cache, GFP_ATOMIC); | ||
1053 | if (!bidi_sdb) { | ||
1054 | error = BLKPREP_DEFER; | ||
1055 | goto err_exit; | ||
1056 | } | ||
1057 | |||
1058 | cmd->request->next_rq->special = bidi_sdb; | ||
1059 | error = scsi_init_sgtable(cmd->request->next_rq, bidi_sdb, | ||
1060 | GFP_ATOMIC); | ||
1061 | if (error) | ||
1062 | goto err_exit; | ||
1063 | } | ||
1064 | |||
1065 | return BLKPREP_OK ; | ||
1066 | |||
1067 | err_exit: | ||
1068 | scsi_release_buffers(cmd); | ||
1069 | if (error == BLKPREP_KILL) | ||
1070 | scsi_put_command(cmd); | ||
1071 | else /* BLKPREP_DEFER */ | ||
1072 | scsi_unprep_request(cmd->request); | ||
1073 | |||
1074 | return error; | ||
1075 | } | ||
1076 | EXPORT_SYMBOL(scsi_init_io); | ||
1077 | |||
1040 | static struct scsi_cmnd *scsi_get_cmd_from_req(struct scsi_device *sdev, | 1078 | static struct scsi_cmnd *scsi_get_cmd_from_req(struct scsi_device *sdev, |
1041 | struct request *req) | 1079 | struct request *req) |
1042 | { | 1080 | { |
@@ -1081,16 +1119,14 @@ int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req) | |||
1081 | 1119 | ||
1082 | BUG_ON(!req->nr_phys_segments); | 1120 | BUG_ON(!req->nr_phys_segments); |
1083 | 1121 | ||
1084 | ret = scsi_init_io(cmd); | 1122 | ret = scsi_init_io(cmd, GFP_ATOMIC); |
1085 | if (unlikely(ret)) | 1123 | if (unlikely(ret)) |
1086 | return ret; | 1124 | return ret; |
1087 | } else { | 1125 | } else { |
1088 | BUG_ON(req->data_len); | 1126 | BUG_ON(req->data_len); |
1089 | BUG_ON(req->data); | 1127 | BUG_ON(req->data); |
1090 | 1128 | ||
1091 | cmd->request_bufflen = 0; | 1129 | memset(&cmd->sdb, 0, sizeof(cmd->sdb)); |
1092 | cmd->request_buffer = NULL; | ||
1093 | cmd->use_sg = 0; | ||
1094 | req->buffer = NULL; | 1130 | req->buffer = NULL; |
1095 | } | 1131 | } |
1096 | 1132 | ||
@@ -1132,7 +1168,7 @@ int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req) | |||
1132 | if (unlikely(!cmd)) | 1168 | if (unlikely(!cmd)) |
1133 | return BLKPREP_DEFER; | 1169 | return BLKPREP_DEFER; |
1134 | 1170 | ||
1135 | return scsi_init_io(cmd); | 1171 | return scsi_init_io(cmd, GFP_ATOMIC); |
1136 | } | 1172 | } |
1137 | EXPORT_SYMBOL(scsi_setup_fs_cmnd); | 1173 | EXPORT_SYMBOL(scsi_setup_fs_cmnd); |
1138 | 1174 | ||
@@ -1542,20 +1578,7 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost, | |||
1542 | * this limit is imposed by hardware restrictions | 1578 | * this limit is imposed by hardware restrictions |
1543 | */ | 1579 | */ |
1544 | blk_queue_max_hw_segments(q, shost->sg_tablesize); | 1580 | blk_queue_max_hw_segments(q, shost->sg_tablesize); |
1545 | 1581 | blk_queue_max_phys_segments(q, SCSI_MAX_SG_CHAIN_SEGMENTS); | |
1546 | /* | ||
1547 | * In the future, sg chaining support will be mandatory and this | ||
1548 | * ifdef can then go away. Right now we don't have all archs | ||
1549 | * converted, so better keep it safe. | ||
1550 | */ | ||
1551 | #ifdef ARCH_HAS_SG_CHAIN | ||
1552 | if (shost->use_sg_chaining) | ||
1553 | blk_queue_max_phys_segments(q, SCSI_MAX_SG_CHAIN_SEGMENTS); | ||
1554 | else | ||
1555 | blk_queue_max_phys_segments(q, SCSI_MAX_SG_SEGMENTS); | ||
1556 | #else | ||
1557 | blk_queue_max_phys_segments(q, SCSI_MAX_SG_SEGMENTS); | ||
1558 | #endif | ||
1559 | 1582 | ||
1560 | blk_queue_max_sectors(q, shost->max_sectors); | 1583 | blk_queue_max_sectors(q, shost->max_sectors); |
1561 | blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost)); | 1584 | blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost)); |
@@ -1654,6 +1677,14 @@ int __init scsi_init_queue(void) | |||
1654 | return -ENOMEM; | 1677 | return -ENOMEM; |
1655 | } | 1678 | } |
1656 | 1679 | ||
1680 | scsi_bidi_sdb_cache = kmem_cache_create("scsi_bidi_sdb", | ||
1681 | sizeof(struct scsi_data_buffer), | ||
1682 | 0, 0, NULL); | ||
1683 | if (!scsi_bidi_sdb_cache) { | ||
1684 | printk(KERN_ERR "SCSI: can't init scsi bidi sdb cache\n"); | ||
1685 | goto cleanup_io_context; | ||
1686 | } | ||
1687 | |||
1657 | for (i = 0; i < SG_MEMPOOL_NR; i++) { | 1688 | for (i = 0; i < SG_MEMPOOL_NR; i++) { |
1658 | struct scsi_host_sg_pool *sgp = scsi_sg_pools + i; | 1689 | struct scsi_host_sg_pool *sgp = scsi_sg_pools + i; |
1659 | int size = sgp->size * sizeof(struct scatterlist); | 1690 | int size = sgp->size * sizeof(struct scatterlist); |
@@ -1663,6 +1694,7 @@ int __init scsi_init_queue(void) | |||
1663 | if (!sgp->slab) { | 1694 | if (!sgp->slab) { |
1664 | printk(KERN_ERR "SCSI: can't init sg slab %s\n", | 1695 | printk(KERN_ERR "SCSI: can't init sg slab %s\n", |
1665 | sgp->name); | 1696 | sgp->name); |
1697 | goto cleanup_bidi_sdb; | ||
1666 | } | 1698 | } |
1667 | 1699 | ||
1668 | sgp->pool = mempool_create_slab_pool(SG_MEMPOOL_SIZE, | 1700 | sgp->pool = mempool_create_slab_pool(SG_MEMPOOL_SIZE, |
@@ -1670,10 +1702,25 @@ int __init scsi_init_queue(void) | |||
1670 | if (!sgp->pool) { | 1702 | if (!sgp->pool) { |
1671 | printk(KERN_ERR "SCSI: can't init sg mempool %s\n", | 1703 | printk(KERN_ERR "SCSI: can't init sg mempool %s\n", |
1672 | sgp->name); | 1704 | sgp->name); |
1705 | goto cleanup_bidi_sdb; | ||
1673 | } | 1706 | } |
1674 | } | 1707 | } |
1675 | 1708 | ||
1676 | return 0; | 1709 | return 0; |
1710 | |||
1711 | cleanup_bidi_sdb: | ||
1712 | for (i = 0; i < SG_MEMPOOL_NR; i++) { | ||
1713 | struct scsi_host_sg_pool *sgp = scsi_sg_pools + i; | ||
1714 | if (sgp->pool) | ||
1715 | mempool_destroy(sgp->pool); | ||
1716 | if (sgp->slab) | ||
1717 | kmem_cache_destroy(sgp->slab); | ||
1718 | } | ||
1719 | kmem_cache_destroy(scsi_bidi_sdb_cache); | ||
1720 | cleanup_io_context: | ||
1721 | kmem_cache_destroy(scsi_io_context_cache); | ||
1722 | |||
1723 | return -ENOMEM; | ||
1677 | } | 1724 | } |
1678 | 1725 | ||
1679 | void scsi_exit_queue(void) | 1726 | void scsi_exit_queue(void) |
@@ -1681,6 +1728,7 @@ void scsi_exit_queue(void) | |||
1681 | int i; | 1728 | int i; |
1682 | 1729 | ||
1683 | kmem_cache_destroy(scsi_io_context_cache); | 1730 | kmem_cache_destroy(scsi_io_context_cache); |
1731 | kmem_cache_destroy(scsi_bidi_sdb_cache); | ||
1684 | 1732 | ||
1685 | for (i = 0; i < SG_MEMPOOL_NR; i++) { | 1733 | for (i = 0; i < SG_MEMPOOL_NR; i++) { |
1686 | struct scsi_host_sg_pool *sgp = scsi_sg_pools + i; | 1734 | struct scsi_host_sg_pool *sgp = scsi_sg_pools + i; |
diff --git a/drivers/scsi/scsi_tgt_lib.c b/drivers/scsi/scsi_tgt_lib.c index 01e03f3f6ffa..91630baea532 100644 --- a/drivers/scsi/scsi_tgt_lib.c +++ b/drivers/scsi/scsi_tgt_lib.c | |||
@@ -331,8 +331,7 @@ static void scsi_tgt_cmd_done(struct scsi_cmnd *cmd) | |||
331 | 331 | ||
332 | scsi_tgt_uspace_send_status(cmd, tcmd->itn_id, tcmd->tag); | 332 | scsi_tgt_uspace_send_status(cmd, tcmd->itn_id, tcmd->tag); |
333 | 333 | ||
334 | if (scsi_sglist(cmd)) | 334 | scsi_release_buffers(cmd); |
335 | scsi_free_sgtable(cmd); | ||
336 | 335 | ||
337 | queue_work(scsi_tgtd, &tcmd->work); | 336 | queue_work(scsi_tgtd, &tcmd->work); |
338 | } | 337 | } |
@@ -353,25 +352,6 @@ static int scsi_tgt_transfer_response(struct scsi_cmnd *cmd) | |||
353 | return 0; | 352 | return 0; |
354 | } | 353 | } |
355 | 354 | ||
356 | static int scsi_tgt_init_cmd(struct scsi_cmnd *cmd, gfp_t gfp_mask) | ||
357 | { | ||
358 | struct request *rq = cmd->request; | ||
359 | int count; | ||
360 | |||
361 | cmd->use_sg = rq->nr_phys_segments; | ||
362 | if (scsi_alloc_sgtable(cmd, gfp_mask)) | ||
363 | return -ENOMEM; | ||
364 | |||
365 | cmd->request_bufflen = rq->data_len; | ||
366 | |||
367 | dprintk("cmd %p cnt %d %lu\n", cmd, scsi_sg_count(cmd), | ||
368 | rq_data_dir(rq)); | ||
369 | count = blk_rq_map_sg(rq->q, rq, scsi_sglist(cmd)); | ||
370 | BUG_ON(count > cmd->use_sg); | ||
371 | cmd->use_sg = count; | ||
372 | return 0; | ||
373 | } | ||
374 | |||
375 | /* TODO: test this crap and replace bio_map_user with new interface maybe */ | 355 | /* TODO: test this crap and replace bio_map_user with new interface maybe */ |
376 | static int scsi_map_user_pages(struct scsi_tgt_cmd *tcmd, struct scsi_cmnd *cmd, | 356 | static int scsi_map_user_pages(struct scsi_tgt_cmd *tcmd, struct scsi_cmnd *cmd, |
377 | unsigned long uaddr, unsigned int len, int rw) | 357 | unsigned long uaddr, unsigned int len, int rw) |
@@ -397,9 +377,11 @@ static int scsi_map_user_pages(struct scsi_tgt_cmd *tcmd, struct scsi_cmnd *cmd, | |||
397 | } | 377 | } |
398 | 378 | ||
399 | tcmd->bio = rq->bio; | 379 | tcmd->bio = rq->bio; |
400 | err = scsi_tgt_init_cmd(cmd, GFP_KERNEL); | 380 | err = scsi_init_io(cmd, GFP_KERNEL); |
401 | if (err) | 381 | if (err) { |
382 | scsi_release_buffers(cmd); | ||
402 | goto unmap_rq; | 383 | goto unmap_rq; |
384 | } | ||
403 | 385 | ||
404 | return 0; | 386 | return 0; |
405 | 387 | ||
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 24eba3118b5a..51a5557f42dd 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -519,7 +519,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) | |||
519 | SCpnt->cmnd[4] = (unsigned char) this_count; | 519 | SCpnt->cmnd[4] = (unsigned char) this_count; |
520 | SCpnt->cmnd[5] = 0; | 520 | SCpnt->cmnd[5] = 0; |
521 | } | 521 | } |
522 | SCpnt->request_bufflen = this_count * sdp->sector_size; | 522 | SCpnt->sdb.length = this_count * sdp->sector_size; |
523 | 523 | ||
524 | /* | 524 | /* |
525 | * We shouldn't disconnect in the middle of a sector, so with a dumb | 525 | * We shouldn't disconnect in the middle of a sector, so with a dumb |
@@ -926,7 +926,7 @@ static struct block_device_operations sd_fops = { | |||
926 | static int sd_done(struct scsi_cmnd *SCpnt) | 926 | static int sd_done(struct scsi_cmnd *SCpnt) |
927 | { | 927 | { |
928 | int result = SCpnt->result; | 928 | int result = SCpnt->result; |
929 | unsigned int xfer_size = SCpnt->request_bufflen; | 929 | unsigned int xfer_size = scsi_bufflen(SCpnt); |
930 | unsigned int good_bytes = result ? 0 : xfer_size; | 930 | unsigned int good_bytes = result ? 0 : xfer_size; |
931 | u64 start_lba = SCpnt->request->sector; | 931 | u64 start_lba = SCpnt->request->sector; |
932 | u64 bad_lba; | 932 | u64 bad_lba; |
diff --git a/drivers/scsi/sgiwd93.c b/drivers/scsi/sgiwd93.c index d4ebe8c67ba9..26cfc56c7091 100644 --- a/drivers/scsi/sgiwd93.c +++ b/drivers/scsi/sgiwd93.c | |||
@@ -33,10 +33,9 @@ | |||
33 | 33 | ||
34 | struct ip22_hostdata { | 34 | struct ip22_hostdata { |
35 | struct WD33C93_hostdata wh; | 35 | struct WD33C93_hostdata wh; |
36 | struct hpc_data { | 36 | dma_addr_t dma; |
37 | dma_addr_t dma; | 37 | void *cpu; |
38 | void *cpu; | 38 | struct device *dev; |
39 | } hd; | ||
40 | }; | 39 | }; |
41 | 40 | ||
42 | #define host_to_hostdata(host) ((struct ip22_hostdata *)((host)->hostdata)) | 41 | #define host_to_hostdata(host) ((struct ip22_hostdata *)((host)->hostdata)) |
@@ -46,6 +45,11 @@ struct hpc_chunk { | |||
46 | u32 _padding; /* align to quadword boundary */ | 45 | u32 _padding; /* align to quadword boundary */ |
47 | }; | 46 | }; |
48 | 47 | ||
48 | /* space for hpc dma descriptors */ | ||
49 | #define HPC_DMA_SIZE PAGE_SIZE | ||
50 | |||
51 | #define DMA_DIR(d) ((d == DATA_OUT_DIR) ? DMA_TO_DEVICE : DMA_FROM_DEVICE) | ||
52 | |||
49 | static irqreturn_t sgiwd93_intr(int irq, void *dev_id) | 53 | static irqreturn_t sgiwd93_intr(int irq, void *dev_id) |
50 | { | 54 | { |
51 | struct Scsi_Host * host = dev_id; | 55 | struct Scsi_Host * host = dev_id; |
@@ -59,15 +63,17 @@ static irqreturn_t sgiwd93_intr(int irq, void *dev_id) | |||
59 | } | 63 | } |
60 | 64 | ||
61 | static inline | 65 | static inline |
62 | void fill_hpc_entries(struct hpc_chunk *hcp, struct scsi_cmnd *cmd, int datainp) | 66 | void fill_hpc_entries(struct ip22_hostdata *hd, struct scsi_cmnd *cmd, int din) |
63 | { | 67 | { |
64 | unsigned long len = cmd->SCp.this_residual; | 68 | unsigned long len = cmd->SCp.this_residual; |
65 | void *addr = cmd->SCp.ptr; | 69 | void *addr = cmd->SCp.ptr; |
66 | dma_addr_t physaddr; | 70 | dma_addr_t physaddr; |
67 | unsigned long count; | 71 | unsigned long count; |
72 | struct hpc_chunk *hcp; | ||
68 | 73 | ||
69 | physaddr = dma_map_single(NULL, addr, len, cmd->sc_data_direction); | 74 | physaddr = dma_map_single(hd->dev, addr, len, DMA_DIR(din)); |
70 | cmd->SCp.dma_handle = physaddr; | 75 | cmd->SCp.dma_handle = physaddr; |
76 | hcp = hd->cpu; | ||
71 | 77 | ||
72 | while (len) { | 78 | while (len) { |
73 | /* | 79 | /* |
@@ -89,6 +95,9 @@ void fill_hpc_entries(struct hpc_chunk *hcp, struct scsi_cmnd *cmd, int datainp) | |||
89 | */ | 95 | */ |
90 | hcp->desc.pbuf = 0; | 96 | hcp->desc.pbuf = 0; |
91 | hcp->desc.cntinfo = HPCDMA_EOX; | 97 | hcp->desc.cntinfo = HPCDMA_EOX; |
98 | dma_cache_sync(hd->dev, hd->cpu, | ||
99 | (unsigned long)(hcp + 1) - (unsigned long)hd->cpu, | ||
100 | DMA_TO_DEVICE); | ||
92 | } | 101 | } |
93 | 102 | ||
94 | static int dma_setup(struct scsi_cmnd *cmd, int datainp) | 103 | static int dma_setup(struct scsi_cmnd *cmd, int datainp) |
@@ -96,9 +105,8 @@ static int dma_setup(struct scsi_cmnd *cmd, int datainp) | |||
96 | struct ip22_hostdata *hdata = host_to_hostdata(cmd->device->host); | 105 | struct ip22_hostdata *hdata = host_to_hostdata(cmd->device->host); |
97 | struct hpc3_scsiregs *hregs = | 106 | struct hpc3_scsiregs *hregs = |
98 | (struct hpc3_scsiregs *) cmd->device->host->base; | 107 | (struct hpc3_scsiregs *) cmd->device->host->base; |
99 | struct hpc_chunk *hcp = (struct hpc_chunk *) hdata->hd.cpu; | ||
100 | 108 | ||
101 | pr_debug("dma_setup: datainp<%d> hcp<%p> ", datainp, hcp); | 109 | pr_debug("dma_setup: datainp<%d> hcp<%p> ", datainp, hdata->cpu); |
102 | 110 | ||
103 | hdata->wh.dma_dir = datainp; | 111 | hdata->wh.dma_dir = datainp; |
104 | 112 | ||
@@ -111,12 +119,12 @@ static int dma_setup(struct scsi_cmnd *cmd, int datainp) | |||
111 | if (cmd->SCp.ptr == NULL || cmd->SCp.this_residual == 0) | 119 | if (cmd->SCp.ptr == NULL || cmd->SCp.this_residual == 0) |
112 | return 1; | 120 | return 1; |
113 | 121 | ||
114 | fill_hpc_entries(hcp, cmd, datainp); | 122 | fill_hpc_entries(hdata, cmd, datainp); |
115 | 123 | ||
116 | pr_debug(" HPCGO\n"); | 124 | pr_debug(" HPCGO\n"); |
117 | 125 | ||
118 | /* Start up the HPC. */ | 126 | /* Start up the HPC. */ |
119 | hregs->ndptr = hdata->hd.dma; | 127 | hregs->ndptr = hdata->dma; |
120 | if (datainp) | 128 | if (datainp) |
121 | hregs->ctrl = HPC3_SCTRL_ACTIVE; | 129 | hregs->ctrl = HPC3_SCTRL_ACTIVE; |
122 | else | 130 | else |
@@ -134,6 +142,9 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, | |||
134 | if (!SCpnt) | 142 | if (!SCpnt) |
135 | return; | 143 | return; |
136 | 144 | ||
145 | if (SCpnt->SCp.ptr == NULL || SCpnt->SCp.this_residual == 0) | ||
146 | return; | ||
147 | |||
137 | hregs = (struct hpc3_scsiregs *) SCpnt->device->host->base; | 148 | hregs = (struct hpc3_scsiregs *) SCpnt->device->host->base; |
138 | 149 | ||
139 | pr_debug("dma_stop: status<%d> ", status); | 150 | pr_debug("dma_stop: status<%d> ", status); |
@@ -145,8 +156,9 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, | |||
145 | barrier(); | 156 | barrier(); |
146 | } | 157 | } |
147 | hregs->ctrl = 0; | 158 | hregs->ctrl = 0; |
148 | dma_unmap_single(NULL, SCpnt->SCp.dma_handle, SCpnt->SCp.this_residual, | 159 | dma_unmap_single(hdata->dev, SCpnt->SCp.dma_handle, |
149 | SCpnt->sc_data_direction); | 160 | SCpnt->SCp.this_residual, |
161 | DMA_DIR(hdata->wh.dma_dir)); | ||
150 | 162 | ||
151 | pr_debug("\n"); | 163 | pr_debug("\n"); |
152 | } | 164 | } |
@@ -161,22 +173,23 @@ void sgiwd93_reset(unsigned long base) | |||
161 | } | 173 | } |
162 | EXPORT_SYMBOL_GPL(sgiwd93_reset); | 174 | EXPORT_SYMBOL_GPL(sgiwd93_reset); |
163 | 175 | ||
164 | static inline void init_hpc_chain(struct hpc_data *hd) | 176 | static inline void init_hpc_chain(struct ip22_hostdata *hdata) |
165 | { | 177 | { |
166 | struct hpc_chunk *hcp = (struct hpc_chunk *) hd->cpu; | 178 | struct hpc_chunk *hcp = (struct hpc_chunk *)hdata->cpu; |
167 | struct hpc_chunk *dma = (struct hpc_chunk *) hd->dma; | 179 | dma_addr_t dma = hdata->dma; |
168 | unsigned long start, end; | 180 | unsigned long start, end; |
169 | 181 | ||
170 | start = (unsigned long) hcp; | 182 | start = (unsigned long) hcp; |
171 | end = start + PAGE_SIZE; | 183 | end = start + HPC_DMA_SIZE; |
172 | while (start < end) { | 184 | while (start < end) { |
173 | hcp->desc.pnext = (u32) (dma + 1); | 185 | hcp->desc.pnext = (u32) (dma + sizeof(struct hpc_chunk)); |
174 | hcp->desc.cntinfo = HPCDMA_EOX; | 186 | hcp->desc.cntinfo = HPCDMA_EOX; |
175 | hcp++; dma++; | 187 | hcp++; |
188 | dma += sizeof(struct hpc_chunk); | ||
176 | start += sizeof(struct hpc_chunk); | 189 | start += sizeof(struct hpc_chunk); |
177 | }; | 190 | }; |
178 | hcp--; | 191 | hcp--; |
179 | hcp->desc.pnext = hd->dma; | 192 | hcp->desc.pnext = hdata->dma; |
180 | } | 193 | } |
181 | 194 | ||
182 | static int sgiwd93_bus_reset(struct scsi_cmnd *cmd) | 195 | static int sgiwd93_bus_reset(struct scsi_cmnd *cmd) |
@@ -235,16 +248,17 @@ static int __init sgiwd93_probe(struct platform_device *pdev) | |||
235 | host->irq = irq; | 248 | host->irq = irq; |
236 | 249 | ||
237 | hdata = host_to_hostdata(host); | 250 | hdata = host_to_hostdata(host); |
238 | hdata->hd.cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE, | 251 | hdata->dev = &pdev->dev; |
239 | &hdata->hd.dma, GFP_KERNEL); | 252 | hdata->cpu = dma_alloc_noncoherent(&pdev->dev, HPC_DMA_SIZE, |
240 | if (!hdata->hd.cpu) { | 253 | &hdata->dma, GFP_KERNEL); |
254 | if (!hdata->cpu) { | ||
241 | printk(KERN_WARNING "sgiwd93: Could not allocate memory for " | 255 | printk(KERN_WARNING "sgiwd93: Could not allocate memory for " |
242 | "host %d buffer.\n", unit); | 256 | "host %d buffer.\n", unit); |
243 | err = -ENOMEM; | 257 | err = -ENOMEM; |
244 | goto out_put; | 258 | goto out_put; |
245 | } | 259 | } |
246 | 260 | ||
247 | init_hpc_chain(&hdata->hd); | 261 | init_hpc_chain(hdata); |
248 | 262 | ||
249 | regs.SASR = wdregs + 3; | 263 | regs.SASR = wdregs + 3; |
250 | regs.SCMD = wdregs + 7; | 264 | regs.SCMD = wdregs + 7; |
@@ -274,7 +288,7 @@ static int __init sgiwd93_probe(struct platform_device *pdev) | |||
274 | out_irq: | 288 | out_irq: |
275 | free_irq(irq, host); | 289 | free_irq(irq, host); |
276 | out_free: | 290 | out_free: |
277 | dma_free_coherent(NULL, PAGE_SIZE, hdata->hd.cpu, hdata->hd.dma); | 291 | dma_free_noncoherent(&pdev->dev, HPC_DMA_SIZE, hdata->cpu, hdata->dma); |
278 | out_put: | 292 | out_put: |
279 | scsi_host_put(host); | 293 | scsi_host_put(host); |
280 | out: | 294 | out: |
@@ -290,7 +304,7 @@ static void __exit sgiwd93_remove(struct platform_device *pdev) | |||
290 | 304 | ||
291 | scsi_remove_host(host); | 305 | scsi_remove_host(host); |
292 | free_irq(pd->irq, host); | 306 | free_irq(pd->irq, host); |
293 | dma_free_coherent(&pdev->dev, PAGE_SIZE, hdata->hd.cpu, hdata->hd.dma); | 307 | dma_free_noncoherent(&pdev->dev, HPC_DMA_SIZE, hdata->cpu, hdata->dma); |
294 | scsi_host_put(host); | 308 | scsi_host_put(host); |
295 | } | 309 | } |
296 | 310 | ||
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 1fcee16fa36d..50ba49250203 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
@@ -231,7 +231,7 @@ out: | |||
231 | static int sr_done(struct scsi_cmnd *SCpnt) | 231 | static int sr_done(struct scsi_cmnd *SCpnt) |
232 | { | 232 | { |
233 | int result = SCpnt->result; | 233 | int result = SCpnt->result; |
234 | int this_count = SCpnt->request_bufflen; | 234 | int this_count = scsi_bufflen(SCpnt); |
235 | int good_bytes = (result == 0 ? this_count : 0); | 235 | int good_bytes = (result == 0 ? this_count : 0); |
236 | int block_sectors = 0; | 236 | int block_sectors = 0; |
237 | long error_sector; | 237 | long error_sector; |
@@ -379,17 +379,18 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq) | |||
379 | } | 379 | } |
380 | 380 | ||
381 | { | 381 | { |
382 | struct scatterlist *sg = SCpnt->request_buffer; | 382 | struct scatterlist *sg; |
383 | int i, size = 0; | 383 | int i, size = 0, sg_count = scsi_sg_count(SCpnt); |
384 | for (i = 0; i < SCpnt->use_sg; i++) | ||
385 | size += sg[i].length; | ||
386 | 384 | ||
387 | if (size != SCpnt->request_bufflen && SCpnt->use_sg) { | 385 | scsi_for_each_sg(SCpnt, sg, sg_count, i) |
386 | size += sg->length; | ||
387 | |||
388 | if (size != scsi_bufflen(SCpnt)) { | ||
388 | scmd_printk(KERN_ERR, SCpnt, | 389 | scmd_printk(KERN_ERR, SCpnt, |
389 | "mismatch count %d, bytes %d\n", | 390 | "mismatch count %d, bytes %d\n", |
390 | size, SCpnt->request_bufflen); | 391 | size, scsi_bufflen(SCpnt)); |
391 | if (SCpnt->request_bufflen > size) | 392 | if (scsi_bufflen(SCpnt) > size) |
392 | SCpnt->request_bufflen = size; | 393 | SCpnt->sdb.length = size; |
393 | } | 394 | } |
394 | } | 395 | } |
395 | 396 | ||
@@ -397,12 +398,12 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq) | |||
397 | * request doesn't start on hw block boundary, add scatter pads | 398 | * request doesn't start on hw block boundary, add scatter pads |
398 | */ | 399 | */ |
399 | if (((unsigned int)rq->sector % (s_size >> 9)) || | 400 | if (((unsigned int)rq->sector % (s_size >> 9)) || |
400 | (SCpnt->request_bufflen % s_size)) { | 401 | (scsi_bufflen(SCpnt) % s_size)) { |
401 | scmd_printk(KERN_NOTICE, SCpnt, "unaligned transfer\n"); | 402 | scmd_printk(KERN_NOTICE, SCpnt, "unaligned transfer\n"); |
402 | goto out; | 403 | goto out; |
403 | } | 404 | } |
404 | 405 | ||
405 | this_count = (SCpnt->request_bufflen >> 9) / (s_size >> 9); | 406 | this_count = (scsi_bufflen(SCpnt) >> 9) / (s_size >> 9); |
406 | 407 | ||
407 | 408 | ||
408 | SCSI_LOG_HLQUEUE(2, printk("%s : %s %d/%ld 512 byte blocks.\n", | 409 | SCSI_LOG_HLQUEUE(2, printk("%s : %s %d/%ld 512 byte blocks.\n", |
@@ -416,7 +417,7 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq) | |||
416 | 417 | ||
417 | if (this_count > 0xffff) { | 418 | if (this_count > 0xffff) { |
418 | this_count = 0xffff; | 419 | this_count = 0xffff; |
419 | SCpnt->request_bufflen = this_count * s_size; | 420 | SCpnt->sdb.length = this_count * s_size; |
420 | } | 421 | } |
421 | 422 | ||
422 | SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff; | 423 | SCpnt->cmnd[2] = (unsigned char) (block >> 24) & 0xff; |
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c index e3fab3a6aed7..72f6d8015358 100644 --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c | |||
@@ -1123,7 +1123,6 @@ static struct scsi_host_template driver_template = { | |||
1123 | .this_id = -1, | 1123 | .this_id = -1, |
1124 | .sg_tablesize = ST_MAX_SG, | 1124 | .sg_tablesize = ST_MAX_SG, |
1125 | .cmd_per_lun = ST_CMD_PER_LUN, | 1125 | .cmd_per_lun = ST_CMD_PER_LUN, |
1126 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1127 | }; | 1126 | }; |
1128 | 1127 | ||
1129 | static int stex_set_dma_mask(struct pci_dev * pdev) | 1128 | static int stex_set_dma_mask(struct pci_dev * pdev) |
diff --git a/drivers/scsi/sym53c416.c b/drivers/scsi/sym53c416.c index 1f6fd1680335..6325901e5093 100644 --- a/drivers/scsi/sym53c416.c +++ b/drivers/scsi/sym53c416.c | |||
@@ -840,6 +840,5 @@ static struct scsi_host_template driver_template = { | |||
840 | .cmd_per_lun = 1, | 840 | .cmd_per_lun = 1, |
841 | .unchecked_isa_dma = 1, | 841 | .unchecked_isa_dma = 1, |
842 | .use_clustering = ENABLE_CLUSTERING, | 842 | .use_clustering = ENABLE_CLUSTERING, |
843 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
844 | }; | 843 | }; |
845 | #include "scsi_module.c" | 844 | #include "scsi_module.c" |
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index 21e926dcdab0..d39107b7669b 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c | |||
@@ -207,7 +207,7 @@ void sym_set_cam_result_error(struct sym_hcb *np, struct sym_ccb *cp, int resid) | |||
207 | /* | 207 | /* |
208 | * Bounce back the sense data to user. | 208 | * Bounce back the sense data to user. |
209 | */ | 209 | */ |
210 | memset(&cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); | 210 | memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); |
211 | memcpy(cmd->sense_buffer, cp->sns_bbuf, | 211 | memcpy(cmd->sense_buffer, cp->sns_bbuf, |
212 | min(SCSI_SENSE_BUFFERSIZE, SYM_SNS_BBUF_LEN)); | 212 | min(SCSI_SENSE_BUFFERSIZE, SYM_SNS_BBUF_LEN)); |
213 | #if 0 | 213 | #if 0 |
@@ -1681,7 +1681,6 @@ static struct scsi_host_template sym2_template = { | |||
1681 | .eh_host_reset_handler = sym53c8xx_eh_host_reset_handler, | 1681 | .eh_host_reset_handler = sym53c8xx_eh_host_reset_handler, |
1682 | .this_id = 7, | 1682 | .this_id = 7, |
1683 | .use_clustering = ENABLE_CLUSTERING, | 1683 | .use_clustering = ENABLE_CLUSTERING, |
1684 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1685 | .max_sectors = 0xFFFF, | 1684 | .max_sectors = 0xFFFF, |
1686 | #ifdef SYM_LINUX_PROC_INFO_SUPPORT | 1685 | #ifdef SYM_LINUX_PROC_INFO_SUPPORT |
1687 | .proc_info = sym53c8xx_proc_info, | 1686 | .proc_info = sym53c8xx_proc_info, |
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c index 4bc5407f9695..662c00451be4 100644 --- a/drivers/scsi/u14-34f.c +++ b/drivers/scsi/u14-34f.c | |||
@@ -451,7 +451,6 @@ static struct scsi_host_template driver_template = { | |||
451 | .this_id = 7, | 451 | .this_id = 7, |
452 | .unchecked_isa_dma = 1, | 452 | .unchecked_isa_dma = 1, |
453 | .use_clustering = ENABLE_CLUSTERING, | 453 | .use_clustering = ENABLE_CLUSTERING, |
454 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
455 | }; | 454 | }; |
456 | 455 | ||
457 | #if !defined(__BIG_ENDIAN_BITFIELD) && !defined(__LITTLE_ENDIAN_BITFIELD) | 456 | #if !defined(__BIG_ENDIAN_BITFIELD) && !defined(__LITTLE_ENDIAN_BITFIELD) |
diff --git a/drivers/scsi/ultrastor.c b/drivers/scsi/ultrastor.c index 75eca6b22db5..f385dce8dfbe 100644 --- a/drivers/scsi/ultrastor.c +++ b/drivers/scsi/ultrastor.c | |||
@@ -1204,6 +1204,5 @@ static struct scsi_host_template driver_template = { | |||
1204 | .cmd_per_lun = ULTRASTOR_MAX_CMDS_PER_LUN, | 1204 | .cmd_per_lun = ULTRASTOR_MAX_CMDS_PER_LUN, |
1205 | .unchecked_isa_dma = 1, | 1205 | .unchecked_isa_dma = 1, |
1206 | .use_clustering = ENABLE_CLUSTERING, | 1206 | .use_clustering = ENABLE_CLUSTERING, |
1207 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1208 | }; | 1207 | }; |
1209 | #include "scsi_module.c" | 1208 | #include "scsi_module.c" |
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c index b4304ae78527..c975c01b3a02 100644 --- a/drivers/scsi/wd7000.c +++ b/drivers/scsi/wd7000.c | |||
@@ -1671,7 +1671,6 @@ static struct scsi_host_template driver_template = { | |||
1671 | .cmd_per_lun = 1, | 1671 | .cmd_per_lun = 1, |
1672 | .unchecked_isa_dma = 1, | 1672 | .unchecked_isa_dma = 1, |
1673 | .use_clustering = ENABLE_CLUSTERING, | 1673 | .use_clustering = ENABLE_CLUSTERING, |
1674 | .use_sg_chaining = ENABLE_SG_CHAINING, | ||
1675 | }; | 1674 | }; |
1676 | 1675 | ||
1677 | #include "scsi_module.c" | 1676 | #include "scsi_module.c" |
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index 178e8c2a8a2f..0db488624ab1 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c | |||
@@ -415,14 +415,14 @@ static void isd200_set_srb(struct isd200_info *info, | |||
415 | sg_init_one(&info->sg, buff, bufflen); | 415 | sg_init_one(&info->sg, buff, bufflen); |
416 | 416 | ||
417 | srb->sc_data_direction = dir; | 417 | srb->sc_data_direction = dir; |
418 | srb->request_buffer = buff ? &info->sg : NULL; | 418 | srb->sdb.table.sgl = buff ? &info->sg : NULL; |
419 | srb->request_bufflen = bufflen; | 419 | srb->sdb.length = bufflen; |
420 | srb->use_sg = buff ? 1 : 0; | 420 | srb->sdb.table.nents = buff ? 1 : 0; |
421 | } | 421 | } |
422 | 422 | ||
423 | static void isd200_srb_set_bufflen(struct scsi_cmnd *srb, unsigned bufflen) | 423 | static void isd200_srb_set_bufflen(struct scsi_cmnd *srb, unsigned bufflen) |
424 | { | 424 | { |
425 | srb->request_bufflen = bufflen; | 425 | srb->sdb.length = bufflen; |
426 | } | 426 | } |
427 | 427 | ||
428 | 428 | ||