diff options
| -rw-r--r-- | drivers/block/ll_rw_blk.c | 9 | ||||
| -rw-r--r-- | drivers/s390/scsi/zfcp_aux.c | 34 | ||||
| -rw-r--r-- | drivers/scsi/53c700.c | 3 | ||||
| -rw-r--r-- | drivers/scsi/53c700.h | 192 | ||||
| -rw-r--r-- | drivers/scsi/Kconfig | 10 | ||||
| -rw-r--r-- | drivers/scsi/NCR_D700.c | 5 | ||||
| -rw-r--r-- | drivers/scsi/lasi700.c | 1 | ||||
| -rw-r--r-- | drivers/scsi/scsi_lib.c | 6 | ||||
| -rw-r--r-- | drivers/scsi/scsi_scan.c | 1 | ||||
| -rw-r--r-- | drivers/scsi/scsi_sysfs.c | 3 | ||||
| -rw-r--r-- | drivers/scsi/sg.c | 203 | ||||
| -rw-r--r-- | drivers/scsi/sim710.c | 5 | ||||
| -rw-r--r-- | include/linux/blkdev.h | 5 | ||||
| -rw-r--r-- | include/scsi/scsi_device.h | 2 |
14 files changed, 191 insertions, 288 deletions
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 46e54b441663..11ef9d9ea139 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c | |||
| @@ -1715,6 +1715,15 @@ request_queue_t *blk_init_queue(request_fn_proc *rfn, spinlock_t *lock) | |||
| 1715 | if (blk_init_free_list(q)) | 1715 | if (blk_init_free_list(q)) |
| 1716 | goto out_init; | 1716 | goto out_init; |
| 1717 | 1717 | ||
| 1718 | /* | ||
| 1719 | * if caller didn't supply a lock, they get per-queue locking with | ||
| 1720 | * our embedded lock | ||
| 1721 | */ | ||
| 1722 | if (!lock) { | ||
| 1723 | spin_lock_init(&q->__queue_lock); | ||
| 1724 | lock = &q->__queue_lock; | ||
| 1725 | } | ||
| 1726 | |||
| 1718 | q->request_fn = rfn; | 1727 | q->request_fn = rfn; |
| 1719 | q->back_merge_fn = ll_back_merge_fn; | 1728 | q->back_merge_fn = ll_back_merge_fn; |
| 1720 | q->front_merge_fn = ll_front_merge_fn; | 1729 | q->front_merge_fn = ll_front_merge_fn; |
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index a393cf4d0313..1f9aeb4accc6 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
| @@ -52,19 +52,18 @@ static inline int zfcp_sg_list_copy_from_user(struct zfcp_sg_list *, | |||
| 52 | static inline int zfcp_sg_list_copy_to_user(void __user *, | 52 | static inline int zfcp_sg_list_copy_to_user(void __user *, |
| 53 | struct zfcp_sg_list *, size_t); | 53 | struct zfcp_sg_list *, size_t); |
| 54 | 54 | ||
| 55 | static int zfcp_cfdc_dev_ioctl(struct inode *, struct file *, | 55 | static int zfcp_cfdc_dev_ioctl(struct file *, unsigned int, unsigned long); |
| 56 | unsigned int, unsigned long); | ||
| 57 | 56 | ||
| 58 | #define ZFCP_CFDC_IOC_MAGIC 0xDD | 57 | #define ZFCP_CFDC_IOC_MAGIC 0xDD |
| 59 | #define ZFCP_CFDC_IOC \ | 58 | #define ZFCP_CFDC_IOC \ |
| 60 | _IOWR(ZFCP_CFDC_IOC_MAGIC, 0, struct zfcp_cfdc_sense_data) | 59 | _IOWR(ZFCP_CFDC_IOC_MAGIC, 0, struct zfcp_cfdc_sense_data) |
| 61 | 60 | ||
| 62 | #ifdef CONFIG_COMPAT | ||
| 63 | static struct ioctl_trans zfcp_ioctl_trans = {ZFCP_CFDC_IOC, (void*) sys_ioctl}; | ||
| 64 | #endif | ||
| 65 | 61 | ||
| 66 | static struct file_operations zfcp_cfdc_fops = { | 62 | static struct file_operations zfcp_cfdc_fops = { |
| 67 | .ioctl = zfcp_cfdc_dev_ioctl | 63 | .unlocked_ioctl = zfcp_cfdc_dev_ioctl, |
| 64 | #ifdef CONFIG_COMPAT | ||
| 65 | .compat_ioctl = zfcp_cfdc_dev_ioctl | ||
| 66 | #endif | ||
| 68 | }; | 67 | }; |
| 69 | 68 | ||
| 70 | static struct miscdevice zfcp_cfdc_misc = { | 69 | static struct miscdevice zfcp_cfdc_misc = { |
| @@ -308,23 +307,16 @@ zfcp_module_init(void) | |||
| 308 | if (!zfcp_transport_template) | 307 | if (!zfcp_transport_template) |
| 309 | return -ENODEV; | 308 | return -ENODEV; |
| 310 | 309 | ||
| 311 | retval = register_ioctl32_conversion(zfcp_ioctl_trans.cmd, | ||
| 312 | zfcp_ioctl_trans.handler); | ||
| 313 | if (retval != 0) { | ||
| 314 | ZFCP_LOG_INFO("registration of ioctl32 conversion failed\n"); | ||
| 315 | goto out; | ||
| 316 | } | ||
| 317 | |||
| 318 | retval = misc_register(&zfcp_cfdc_misc); | 310 | retval = misc_register(&zfcp_cfdc_misc); |
| 319 | if (retval != 0) { | 311 | if (retval != 0) { |
| 320 | ZFCP_LOG_INFO("registration of misc device " | 312 | ZFCP_LOG_INFO("registration of misc device " |
| 321 | "zfcp_cfdc failed\n"); | 313 | "zfcp_cfdc failed\n"); |
| 322 | goto out_misc_register; | 314 | goto out; |
| 323 | } else { | ||
| 324 | ZFCP_LOG_TRACE("major/minor for zfcp_cfdc: %d/%d\n", | ||
| 325 | ZFCP_CFDC_DEV_MAJOR, zfcp_cfdc_misc.minor); | ||
| 326 | } | 315 | } |
| 327 | 316 | ||
| 317 | ZFCP_LOG_TRACE("major/minor for zfcp_cfdc: %d/%d\n", | ||
| 318 | ZFCP_CFDC_DEV_MAJOR, zfcp_cfdc_misc.minor); | ||
| 319 | |||
| 328 | /* Initialise proc semaphores */ | 320 | /* Initialise proc semaphores */ |
| 329 | sema_init(&zfcp_data.config_sema, 1); | 321 | sema_init(&zfcp_data.config_sema, 1); |
| 330 | 322 | ||
| @@ -348,8 +340,6 @@ zfcp_module_init(void) | |||
| 348 | 340 | ||
| 349 | out_ccw_register: | 341 | out_ccw_register: |
| 350 | misc_deregister(&zfcp_cfdc_misc); | 342 | misc_deregister(&zfcp_cfdc_misc); |
| 351 | out_misc_register: | ||
| 352 | unregister_ioctl32_conversion(zfcp_ioctl_trans.cmd); | ||
| 353 | out: | 343 | out: |
| 354 | return retval; | 344 | return retval; |
| 355 | } | 345 | } |
| @@ -370,9 +360,9 @@ zfcp_module_init(void) | |||
| 370 | * -EPERM - Cannot create or queue FSF request or create SBALs | 360 | * -EPERM - Cannot create or queue FSF request or create SBALs |
| 371 | * -ERESTARTSYS- Received signal (is mapped to EAGAIN by VFS) | 361 | * -ERESTARTSYS- Received signal (is mapped to EAGAIN by VFS) |
| 372 | */ | 362 | */ |
| 373 | static int | 363 | static long |
| 374 | zfcp_cfdc_dev_ioctl(struct inode *inode, struct file *file, | 364 | zfcp_cfdc_dev_ioctl(struct file *file, unsigned int command, |
| 375 | unsigned int command, unsigned long buffer) | 365 | unsigned long buffer) |
| 376 | { | 366 | { |
| 377 | struct zfcp_cfdc_sense_data *sense_data, __user *sense_data_user; | 367 | struct zfcp_cfdc_sense_data *sense_data, __user *sense_data_user; |
| 378 | struct zfcp_adapter *adapter = NULL; | 368 | struct zfcp_adapter *adapter = NULL; |
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c index a591fcb8aab1..4b1bb529f676 100644 --- a/drivers/scsi/53c700.c +++ b/drivers/scsi/53c700.c | |||
| @@ -389,8 +389,7 @@ NCR_700_detect(struct scsi_host_template *tpnt, | |||
| 389 | host->max_lun = NCR_700_MAX_LUNS; | 389 | host->max_lun = NCR_700_MAX_LUNS; |
| 390 | BUG_ON(NCR_700_transport_template == NULL); | 390 | BUG_ON(NCR_700_transport_template == NULL); |
| 391 | host->transportt = NCR_700_transport_template; | 391 | host->transportt = NCR_700_transport_template; |
| 392 | host->unique_id = hostdata->base; | 392 | host->unique_id = (unsigned long)hostdata->base; |
| 393 | host->base = hostdata->base; | ||
| 394 | hostdata->eh_complete = NULL; | 393 | hostdata->eh_complete = NULL; |
| 395 | host->hostdata[0] = (unsigned long)hostdata; | 394 | host->hostdata[0] = (unsigned long)hostdata; |
| 396 | /* kick the chip */ | 395 | /* kick the chip */ |
diff --git a/drivers/scsi/53c700.h b/drivers/scsi/53c700.h index df4aa30ae0aa..e86012cf6ab7 100644 --- a/drivers/scsi/53c700.h +++ b/drivers/scsi/53c700.h | |||
| @@ -14,10 +14,6 @@ | |||
| 14 | #include <scsi/scsi_device.h> | 14 | #include <scsi/scsi_device.h> |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | #if defined(CONFIG_53C700_MEM_MAPPED) && defined(CONFIG_53C700_IO_MAPPED) | ||
| 18 | #define CONFIG_53C700_BOTH_MAPPED | ||
| 19 | #endif | ||
| 20 | |||
| 21 | /* Turn on for general debugging---too verbose for normal use */ | 17 | /* Turn on for general debugging---too verbose for normal use */ |
| 22 | #undef NCR_700_DEBUG | 18 | #undef NCR_700_DEBUG |
| 23 | /* Debug the tag queues, checking hash queue allocation and deallocation | 19 | /* Debug the tag queues, checking hash queue allocation and deallocation |
| @@ -49,13 +45,6 @@ | |||
| 49 | /* magic byte identifying an internally generated REQUEST_SENSE command */ | 45 | /* magic byte identifying an internally generated REQUEST_SENSE command */ |
| 50 | #define NCR_700_INTERNAL_SENSE_MAGIC 0x42 | 46 | #define NCR_700_INTERNAL_SENSE_MAGIC 0x42 |
| 51 | 47 | ||
| 52 | /* WARNING: Leave this in for now: the dependency preprocessor doesn't | ||
| 53 | * pick up file specific flags, so must define here if they are not | ||
| 54 | * set */ | ||
| 55 | #if !defined(CONFIG_53C700_IO_MAPPED) && !defined(CONFIG_53C700_MEM_MAPPED) | ||
| 56 | #error "Config.in must define either CONFIG_53C700_IO_MAPPED or CONFIG_53C700_MEM_MAPPED to use this scsi core." | ||
| 57 | #endif | ||
| 58 | |||
| 59 | struct NCR_700_Host_Parameters; | 48 | struct NCR_700_Host_Parameters; |
| 60 | 49 | ||
| 61 | /* These are the externally used routines */ | 50 | /* These are the externally used routines */ |
| @@ -184,7 +173,7 @@ struct NCR_700_command_slot { | |||
| 184 | struct NCR_700_Host_Parameters { | 173 | struct NCR_700_Host_Parameters { |
| 185 | /* These must be filled in by the calling driver */ | 174 | /* These must be filled in by the calling driver */ |
| 186 | int clock; /* board clock speed in MHz */ | 175 | int clock; /* board clock speed in MHz */ |
| 187 | unsigned long base; /* the base for the port (copied to host) */ | 176 | void __iomem *base; /* the base for the port (copied to host) */ |
| 188 | struct device *dev; | 177 | struct device *dev; |
| 189 | __u32 dmode_extra; /* adjustable bus settings */ | 178 | __u32 dmode_extra; /* adjustable bus settings */ |
| 190 | __u32 differential:1; /* if we are differential */ | 179 | __u32 differential:1; /* if we are differential */ |
| @@ -199,9 +188,6 @@ struct NCR_700_Host_Parameters { | |||
| 199 | /* NOTHING BELOW HERE NEEDS ALTERING */ | 188 | /* NOTHING BELOW HERE NEEDS ALTERING */ |
| 200 | __u32 fast:1; /* if we can alter the SCSI bus clock | 189 | __u32 fast:1; /* if we can alter the SCSI bus clock |
| 201 | speed (so can negiotiate sync) */ | 190 | speed (so can negiotiate sync) */ |
| 202 | #ifdef CONFIG_53C700_BOTH_MAPPED | ||
| 203 | __u32 mem_mapped; /* set if memory mapped */ | ||
| 204 | #endif | ||
| 205 | int sync_clock; /* The speed of the SYNC core */ | 191 | int sync_clock; /* The speed of the SYNC core */ |
| 206 | 192 | ||
| 207 | __u32 *script; /* pointer to script location */ | 193 | __u32 *script; /* pointer to script location */ |
| @@ -246,12 +232,18 @@ struct NCR_700_Host_Parameters { | |||
| 246 | #ifdef CONFIG_53C700_LE_ON_BE | 232 | #ifdef CONFIG_53C700_LE_ON_BE |
| 247 | #define bE (hostdata->force_le_on_be ? 0 : 3) | 233 | #define bE (hostdata->force_le_on_be ? 0 : 3) |
| 248 | #define bSWAP (hostdata->force_le_on_be) | 234 | #define bSWAP (hostdata->force_le_on_be) |
| 235 | /* This is terrible, but there's no raw version of ioread32. That means | ||
| 236 | * that on a be board we swap twice (once in ioread32 and once again to | ||
| 237 | * get the value correct) */ | ||
| 238 | #define bS_to_io(x) ((hostdata->force_le_on_be) ? (x) : cpu_to_le32(x)) | ||
| 249 | #elif defined(__BIG_ENDIAN) | 239 | #elif defined(__BIG_ENDIAN) |
| 250 | #define bE 3 | 240 | #define bE 3 |
| 251 | #define bSWAP 0 | 241 | #define bSWAP 0 |
| 242 | #define bS_to_io(x) (x) | ||
| 252 | #elif defined(__LITTLE_ENDIAN) | 243 | #elif defined(__LITTLE_ENDIAN) |
| 253 | #define bE 0 | 244 | #define bE 0 |
| 254 | #define bSWAP 0 | 245 | #define bSWAP 0 |
| 246 | #define bS_to_io(x) (x) | ||
| 255 | #else | 247 | #else |
| 256 | #error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined, did you include byteorder.h?" | 248 | #error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined, did you include byteorder.h?" |
| 257 | #endif | 249 | #endif |
| @@ -455,91 +447,42 @@ struct NCR_700_Host_Parameters { | |||
| 455 | 447 | ||
| 456 | 448 | ||
| 457 | static inline __u8 | 449 | static inline __u8 |
| 458 | NCR_700_mem_readb(struct Scsi_Host *host, __u32 reg) | 450 | NCR_700_readb(struct Scsi_Host *host, __u32 reg) |
| 459 | { | ||
| 460 | const struct NCR_700_Host_Parameters *hostdata __attribute__((unused)) | ||
| 461 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; | ||
| 462 | |||
| 463 | return readb(host->base + (reg^bE)); | ||
| 464 | } | ||
| 465 | |||
| 466 | static inline __u32 | ||
| 467 | NCR_700_mem_readl(struct Scsi_Host *host, __u32 reg) | ||
| 468 | { | ||
| 469 | __u32 value = __raw_readl(host->base + reg); | ||
| 470 | const struct NCR_700_Host_Parameters *hostdata __attribute__((unused)) | ||
| 471 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; | ||
| 472 | #if 1 | ||
| 473 | /* sanity check the register */ | ||
| 474 | if((reg & 0x3) != 0) | ||
| 475 | BUG(); | ||
| 476 | #endif | ||
| 477 | |||
| 478 | return bS_to_cpu(value); | ||
| 479 | } | ||
| 480 | |||
| 481 | static inline void | ||
| 482 | NCR_700_mem_writeb(__u8 value, struct Scsi_Host *host, __u32 reg) | ||
| 483 | { | ||
| 484 | const struct NCR_700_Host_Parameters *hostdata __attribute__((unused)) | ||
| 485 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; | ||
| 486 | |||
| 487 | writeb(value, host->base + (reg^bE)); | ||
| 488 | } | ||
| 489 | |||
| 490 | static inline void | ||
| 491 | NCR_700_mem_writel(__u32 value, struct Scsi_Host *host, __u32 reg) | ||
| 492 | { | ||
| 493 | const struct NCR_700_Host_Parameters *hostdata __attribute__((unused)) | ||
| 494 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; | ||
| 495 | |||
| 496 | #if 1 | ||
| 497 | /* sanity check the register */ | ||
| 498 | if((reg & 0x3) != 0) | ||
| 499 | BUG(); | ||
| 500 | #endif | ||
| 501 | |||
| 502 | __raw_writel(bS_to_host(value), host->base + reg); | ||
| 503 | } | ||
| 504 | |||
| 505 | static inline __u8 | ||
| 506 | NCR_700_io_readb(struct Scsi_Host *host, __u32 reg) | ||
| 507 | { | 451 | { |
| 508 | const struct NCR_700_Host_Parameters *hostdata __attribute__((unused)) | 452 | const struct NCR_700_Host_Parameters *hostdata |
| 509 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; | 453 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; |
| 510 | 454 | ||
| 511 | return inb(host->base + (reg^bE)); | 455 | return ioread8(hostdata->base + (reg^bE)); |
| 512 | } | 456 | } |
| 513 | 457 | ||
| 514 | static inline __u32 | 458 | static inline __u32 |
| 515 | NCR_700_io_readl(struct Scsi_Host *host, __u32 reg) | 459 | NCR_700_readl(struct Scsi_Host *host, __u32 reg) |
| 516 | { | 460 | { |
| 517 | __u32 value = inl(host->base + reg); | 461 | const struct NCR_700_Host_Parameters *hostdata |
| 518 | const struct NCR_700_Host_Parameters *hostdata __attribute__((unused)) | ||
| 519 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; | 462 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; |
| 520 | 463 | __u32 value = ioread32(hostdata->base + reg); | |
| 521 | #if 1 | 464 | #if 1 |
| 522 | /* sanity check the register */ | 465 | /* sanity check the register */ |
| 523 | if((reg & 0x3) != 0) | 466 | if((reg & 0x3) != 0) |
| 524 | BUG(); | 467 | BUG(); |
| 525 | #endif | 468 | #endif |
| 526 | 469 | ||
| 527 | return bS_to_cpu(value); | 470 | return bS_to_io(value); |
| 528 | } | 471 | } |
| 529 | 472 | ||
| 530 | static inline void | 473 | static inline void |
| 531 | NCR_700_io_writeb(__u8 value, struct Scsi_Host *host, __u32 reg) | 474 | NCR_700_writeb(__u8 value, struct Scsi_Host *host, __u32 reg) |
| 532 | { | 475 | { |
| 533 | const struct NCR_700_Host_Parameters *hostdata __attribute__((unused)) | 476 | const struct NCR_700_Host_Parameters *hostdata |
| 534 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; | 477 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; |
| 535 | 478 | ||
| 536 | outb(value, host->base + (reg^bE)); | 479 | iowrite8(value, hostdata->base + (reg^bE)); |
| 537 | } | 480 | } |
| 538 | 481 | ||
| 539 | static inline void | 482 | static inline void |
| 540 | NCR_700_io_writel(__u32 value, struct Scsi_Host *host, __u32 reg) | 483 | NCR_700_writel(__u32 value, struct Scsi_Host *host, __u32 reg) |
| 541 | { | 484 | { |
| 542 | const struct NCR_700_Host_Parameters *hostdata __attribute__((unused)) | 485 | const struct NCR_700_Host_Parameters *hostdata |
| 543 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; | 486 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; |
| 544 | 487 | ||
| 545 | #if 1 | 488 | #if 1 |
| @@ -548,102 +491,7 @@ NCR_700_io_writel(__u32 value, struct Scsi_Host *host, __u32 reg) | |||
| 548 | BUG(); | 491 | BUG(); |
| 549 | #endif | 492 | #endif |
| 550 | 493 | ||
| 551 | outl(bS_to_host(value), host->base + reg); | 494 | iowrite32(bS_to_io(value), hostdata->base + reg); |
| 552 | } | ||
| 553 | |||
| 554 | #ifdef CONFIG_53C700_BOTH_MAPPED | ||
| 555 | |||
| 556 | static inline __u8 | ||
| 557 | NCR_700_readb(struct Scsi_Host *host, __u32 reg) | ||
| 558 | { | ||
| 559 | __u8 val; | ||
| 560 | |||
| 561 | const struct NCR_700_Host_Parameters *hostdata __attribute__((unused)) | ||
| 562 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; | ||
| 563 | |||
| 564 | if(hostdata->mem_mapped) | ||
| 565 | val = NCR_700_mem_readb(host, reg); | ||
| 566 | else | ||
| 567 | val = NCR_700_io_readb(host, reg); | ||
| 568 | |||
| 569 | return val; | ||
| 570 | } | ||
| 571 | |||
| 572 | static inline __u32 | ||
| 573 | NCR_700_readl(struct Scsi_Host *host, __u32 reg) | ||
| 574 | { | ||
| 575 | __u32 val; | ||
| 576 | |||
| 577 | const struct NCR_700_Host_Parameters *hostdata __attribute__((unused)) | ||
| 578 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; | ||
| 579 | |||
| 580 | if(hostdata->mem_mapped) | ||
| 581 | val = NCR_700_mem_readl(host, reg); | ||
| 582 | else | ||
| 583 | val = NCR_700_io_readl(host, reg); | ||
| 584 | |||
| 585 | return val; | ||
| 586 | } | ||
| 587 | |||
| 588 | static inline void | ||
| 589 | NCR_700_writeb(__u8 value, struct Scsi_Host *host, __u32 reg) | ||
| 590 | { | ||
| 591 | const struct NCR_700_Host_Parameters *hostdata __attribute__((unused)) | ||
| 592 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; | ||
| 593 | |||
| 594 | if(hostdata->mem_mapped) | ||
| 595 | NCR_700_mem_writeb(value, host, reg); | ||
| 596 | else | ||
| 597 | NCR_700_io_writeb(value, host, reg); | ||
| 598 | } | ||
| 599 | |||
| 600 | static inline void | ||
| 601 | NCR_700_writel(__u32 value, struct Scsi_Host *host, __u32 reg) | ||
| 602 | { | ||
| 603 | const struct NCR_700_Host_Parameters *hostdata __attribute__((unused)) | ||
| 604 | = (struct NCR_700_Host_Parameters *)host->hostdata[0]; | ||
| 605 | |||
| 606 | if(hostdata->mem_mapped) | ||
| 607 | NCR_700_mem_writel(value, host, reg); | ||
| 608 | else | ||
| 609 | NCR_700_io_writel(value, host, reg); | ||
| 610 | } | ||
| 611 | |||
| 612 | static inline void | ||
| 613 | NCR_700_set_mem_mapped(struct NCR_700_Host_Parameters *hostdata) | ||
| 614 | { | ||
| 615 | hostdata->mem_mapped = 1; | ||
| 616 | } | ||
| 617 | |||
| 618 | static inline void | ||
| 619 | NCR_700_set_io_mapped(struct NCR_700_Host_Parameters *hostdata) | ||
| 620 | { | ||
| 621 | hostdata->mem_mapped = 0; | ||
| 622 | } | 495 | } |
| 623 | 496 | ||
| 624 | |||
| 625 | #elif defined(CONFIG_53C700_IO_MAPPED) | ||
| 626 | |||
| 627 | #define NCR_700_readb NCR_700_io_readb | ||
| 628 | #define NCR_700_readl NCR_700_io_readl | ||
| 629 | #define NCR_700_writeb NCR_700_io_writeb | ||
| 630 | #define NCR_700_writel NCR_700_io_writel | ||
| 631 | |||
| 632 | #define NCR_700_set_io_mapped(x) | ||
| 633 | #define NCR_700_set_mem_mapped(x) error I/O mapped only | ||
| 634 | |||
| 635 | #elif defined(CONFIG_53C700_MEM_MAPPED) | ||
| 636 | |||
| 637 | #define NCR_700_readb NCR_700_mem_readb | ||
| 638 | #define NCR_700_readl NCR_700_mem_readl | ||
| 639 | #define NCR_700_writeb NCR_700_mem_writeb | ||
| 640 | #define NCR_700_writel NCR_700_mem_writel | ||
| 641 | |||
| 642 | #define NCR_700_set_io_mapped(x) error MEM mapped only | ||
| 643 | #define NCR_700_set_mem_mapped(x) | ||
| 644 | |||
| 645 | #else | ||
| 646 | #error neither CONFIG_53C700_MEM_MAPPED nor CONFIG_53C700_IO_MAPPED is set | ||
| 647 | #endif | ||
| 648 | |||
| 649 | #endif | 497 | #endif |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index d22b32f4662d..718df4c6c3b2 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
| @@ -942,11 +942,6 @@ config SCSI_NCR_D700 | |||
| 942 | Unless you have an NCR manufactured machine, the chances are that | 942 | Unless you have an NCR manufactured machine, the chances are that |
| 943 | you do not have this SCSI card, so say N. | 943 | you do not have this SCSI card, so say N. |
| 944 | 944 | ||
| 945 | config 53C700_IO_MAPPED | ||
| 946 | bool | ||
| 947 | depends on SCSI_NCR_D700 | ||
| 948 | default y | ||
| 949 | |||
| 950 | config SCSI_LASI700 | 945 | config SCSI_LASI700 |
| 951 | tristate "HP Lasi SCSI support for 53c700/710" | 946 | tristate "HP Lasi SCSI support for 53c700/710" |
| 952 | depends on GSC && SCSI | 947 | depends on GSC && SCSI |
| @@ -956,11 +951,6 @@ config SCSI_LASI700 | |||
| 956 | many PA-RISC workstations & servers. If you do not know whether you | 951 | many PA-RISC workstations & servers. If you do not know whether you |
| 957 | have a Lasi chip, it is safe to say "Y" here. | 952 | have a Lasi chip, it is safe to say "Y" here. |
| 958 | 953 | ||
| 959 | config 53C700_MEM_MAPPED | ||
| 960 | bool | ||
| 961 | depends on SCSI_LASI700 | ||
| 962 | default y | ||
| 963 | |||
| 964 | config 53C700_LE_ON_BE | 954 | config 53C700_LE_ON_BE |
| 965 | bool | 955 | bool |
| 966 | depends on SCSI_LASI700 | 956 | depends on SCSI_LASI700 |
diff --git a/drivers/scsi/NCR_D700.c b/drivers/scsi/NCR_D700.c index 507751941f1e..e993a7ba276f 100644 --- a/drivers/scsi/NCR_D700.c +++ b/drivers/scsi/NCR_D700.c | |||
| @@ -197,12 +197,10 @@ NCR_D700_probe_one(struct NCR_D700_private *p, int siop, int irq, | |||
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | /* Fill in the three required pieces of hostdata */ | 199 | /* Fill in the three required pieces of hostdata */ |
| 200 | hostdata->base = region; | 200 | hostdata->base = ioport_map(region, 64); |
| 201 | hostdata->differential = (((1<<siop) & differential) != 0); | 201 | hostdata->differential = (((1<<siop) & differential) != 0); |
| 202 | hostdata->clock = NCR_D700_CLOCK_MHZ; | 202 | hostdata->clock = NCR_D700_CLOCK_MHZ; |
| 203 | 203 | ||
| 204 | NCR_700_set_io_mapped(hostdata); | ||
| 205 | |||
| 206 | /* and register the siop */ | 204 | /* and register the siop */ |
| 207 | host = NCR_700_detect(&NCR_D700_driver_template, hostdata, p->dev); | 205 | host = NCR_700_detect(&NCR_D700_driver_template, hostdata, p->dev); |
| 208 | if (!host) { | 206 | if (!host) { |
| @@ -214,6 +212,7 @@ NCR_D700_probe_one(struct NCR_D700_private *p, int siop, int irq, | |||
| 214 | /* FIXME: read this from SUS */ | 212 | /* FIXME: read this from SUS */ |
| 215 | host->this_id = id_array[slot * 2 + siop]; | 213 | host->this_id = id_array[slot * 2 + siop]; |
| 216 | host->irq = irq; | 214 | host->irq = irq; |
| 215 | host->base = region; | ||
| 217 | scsi_scan_host(host); | 216 | scsi_scan_host(host); |
| 218 | 217 | ||
| 219 | return 0; | 218 | return 0; |
diff --git a/drivers/scsi/lasi700.c b/drivers/scsi/lasi700.c index 29f250c80b98..4cbb6187cc44 100644 --- a/drivers/scsi/lasi700.c +++ b/drivers/scsi/lasi700.c | |||
| @@ -131,6 +131,7 @@ lasi700_probe(struct parisc_device *dev) | |||
| 131 | if (!host) | 131 | if (!host) |
| 132 | goto out_kfree; | 132 | goto out_kfree; |
| 133 | host->this_id = 7; | 133 | host->this_id = 7; |
| 134 | host->base = base; | ||
| 134 | host->irq = dev->irq; | 135 | host->irq = dev->irq; |
| 135 | if(request_irq(dev->irq, NCR_700_intr, SA_SHIRQ, "lasi700", host)) { | 136 | if(request_irq(dev->irq, NCR_700_intr, SA_SHIRQ, "lasi700", host)) { |
| 136 | printk(KERN_ERR "lasi700: request_irq failed!\n"); | 137 | printk(KERN_ERR "lasi700: request_irq failed!\n"); |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 619d3fb7a2f0..d18da21c9c57 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
| @@ -358,9 +358,9 @@ void scsi_device_unbusy(struct scsi_device *sdev) | |||
| 358 | shost->host_failed)) | 358 | shost->host_failed)) |
| 359 | scsi_eh_wakeup(shost); | 359 | scsi_eh_wakeup(shost); |
| 360 | spin_unlock(shost->host_lock); | 360 | spin_unlock(shost->host_lock); |
| 361 | spin_lock(&sdev->sdev_lock); | 361 | spin_lock(sdev->request_queue->queue_lock); |
| 362 | sdev->device_busy--; | 362 | sdev->device_busy--; |
| 363 | spin_unlock_irqrestore(&sdev->sdev_lock, flags); | 363 | spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); |
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | /* | 366 | /* |
| @@ -1423,7 +1423,7 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev) | |||
| 1423 | struct Scsi_Host *shost = sdev->host; | 1423 | struct Scsi_Host *shost = sdev->host; |
| 1424 | struct request_queue *q; | 1424 | struct request_queue *q; |
| 1425 | 1425 | ||
| 1426 | q = blk_init_queue(scsi_request_fn, &sdev->sdev_lock); | 1426 | q = blk_init_queue(scsi_request_fn, NULL); |
| 1427 | if (!q) | 1427 | if (!q) |
| 1428 | return NULL; | 1428 | return NULL; |
| 1429 | 1429 | ||
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index a8a37a338c02..287d197a7c17 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
| @@ -249,7 +249,6 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, | |||
| 249 | */ | 249 | */ |
| 250 | sdev->borken = 1; | 250 | sdev->borken = 1; |
| 251 | 251 | ||
| 252 | spin_lock_init(&sdev->sdev_lock); | ||
| 253 | sdev->request_queue = scsi_alloc_queue(sdev); | 252 | sdev->request_queue = scsi_alloc_queue(sdev); |
| 254 | if (!sdev->request_queue) { | 253 | if (!sdev->request_queue) { |
| 255 | /* release fn is set up in scsi_sysfs_device_initialise, so | 254 | /* release fn is set up in scsi_sysfs_device_initialise, so |
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 134d3a3e4222..e75ee4671ee3 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
| @@ -171,6 +171,9 @@ void scsi_device_dev_release(struct device *dev) | |||
| 171 | if (sdev->request_queue) { | 171 | if (sdev->request_queue) { |
| 172 | sdev->request_queue->queuedata = NULL; | 172 | sdev->request_queue->queuedata = NULL; |
| 173 | scsi_free_queue(sdev->request_queue); | 173 | scsi_free_queue(sdev->request_queue); |
| 174 | /* temporary expedient, try to catch use of queue lock | ||
| 175 | * after free of sdev */ | ||
| 176 | sdev->request_queue = NULL; | ||
| 174 | } | 177 | } |
| 175 | 178 | ||
| 176 | scsi_target_reap(scsi_target(sdev)); | 179 | scsi_target_reap(scsi_target(sdev)); |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index cf6b1f0fb124..ce8332297dfa 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
| @@ -18,8 +18,8 @@ | |||
| 18 | * | 18 | * |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | static int sg_version_num = 30532; /* 2 digits for each component */ | 21 | static int sg_version_num = 30533; /* 2 digits for each component */ |
| 22 | #define SG_VERSION_STR "3.5.32" | 22 | #define SG_VERSION_STR "3.5.33" |
| 23 | 23 | ||
| 24 | /* | 24 | /* |
| 25 | * D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au), notes: | 25 | * D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au), notes: |
| @@ -61,7 +61,7 @@ static int sg_version_num = 30532; /* 2 digits for each component */ | |||
| 61 | 61 | ||
| 62 | #ifdef CONFIG_SCSI_PROC_FS | 62 | #ifdef CONFIG_SCSI_PROC_FS |
| 63 | #include <linux/proc_fs.h> | 63 | #include <linux/proc_fs.h> |
| 64 | static char *sg_version_date = "20050117"; | 64 | static char *sg_version_date = "20050328"; |
| 65 | 65 | ||
| 66 | static int sg_proc_init(void); | 66 | static int sg_proc_init(void); |
| 67 | static void sg_proc_cleanup(void); | 67 | static void sg_proc_cleanup(void); |
| @@ -331,14 +331,13 @@ sg_release(struct inode *inode, struct file *filp) | |||
| 331 | static ssize_t | 331 | static ssize_t |
| 332 | sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) | 332 | sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) |
| 333 | { | 333 | { |
| 334 | int res; | ||
| 335 | Sg_device *sdp; | 334 | Sg_device *sdp; |
| 336 | Sg_fd *sfp; | 335 | Sg_fd *sfp; |
| 337 | Sg_request *srp; | 336 | Sg_request *srp; |
| 338 | int req_pack_id = -1; | 337 | int req_pack_id = -1; |
| 339 | struct sg_header old_hdr; | ||
| 340 | sg_io_hdr_t new_hdr; | ||
| 341 | sg_io_hdr_t *hp; | 338 | sg_io_hdr_t *hp; |
| 339 | struct sg_header *old_hdr = NULL; | ||
| 340 | int retval = 0; | ||
| 342 | 341 | ||
| 343 | if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))) | 342 | if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp))) |
| 344 | return -ENXIO; | 343 | return -ENXIO; |
| @@ -347,98 +346,138 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) | |||
| 347 | if (!access_ok(VERIFY_WRITE, buf, count)) | 346 | if (!access_ok(VERIFY_WRITE, buf, count)) |
| 348 | return -EFAULT; | 347 | return -EFAULT; |
| 349 | if (sfp->force_packid && (count >= SZ_SG_HEADER)) { | 348 | if (sfp->force_packid && (count >= SZ_SG_HEADER)) { |
| 350 | if (__copy_from_user(&old_hdr, buf, SZ_SG_HEADER)) | 349 | old_hdr = kmalloc(SZ_SG_HEADER, GFP_KERNEL); |
| 351 | return -EFAULT; | 350 | if (!old_hdr) |
| 352 | if (old_hdr.reply_len < 0) { | 351 | return -ENOMEM; |
| 352 | if (__copy_from_user(old_hdr, buf, SZ_SG_HEADER)) { | ||
| 353 | retval = -EFAULT; | ||
| 354 | goto free_old_hdr; | ||
| 355 | } | ||
| 356 | if (old_hdr->reply_len < 0) { | ||
| 353 | if (count >= SZ_SG_IO_HDR) { | 357 | if (count >= SZ_SG_IO_HDR) { |
| 354 | if (__copy_from_user | 358 | sg_io_hdr_t *new_hdr; |
| 355 | (&new_hdr, buf, SZ_SG_IO_HDR)) | 359 | new_hdr = kmalloc(SZ_SG_IO_HDR, GFP_KERNEL); |
| 356 | return -EFAULT; | 360 | if (!new_hdr) { |
| 357 | req_pack_id = new_hdr.pack_id; | 361 | retval = -ENOMEM; |
| 362 | goto free_old_hdr; | ||
| 363 | } | ||
| 364 | retval =__copy_from_user | ||
| 365 | (new_hdr, buf, SZ_SG_IO_HDR); | ||
| 366 | req_pack_id = new_hdr->pack_id; | ||
| 367 | kfree(new_hdr); | ||
| 368 | if (retval) { | ||
| 369 | retval = -EFAULT; | ||
| 370 | goto free_old_hdr; | ||
| 371 | } | ||
| 358 | } | 372 | } |
| 359 | } else | 373 | } else |
| 360 | req_pack_id = old_hdr.pack_id; | 374 | req_pack_id = old_hdr->pack_id; |
| 361 | } | 375 | } |
| 362 | srp = sg_get_rq_mark(sfp, req_pack_id); | 376 | srp = sg_get_rq_mark(sfp, req_pack_id); |
| 363 | if (!srp) { /* now wait on packet to arrive */ | 377 | if (!srp) { /* now wait on packet to arrive */ |
| 364 | if (sdp->detached) | 378 | if (sdp->detached) { |
| 365 | return -ENODEV; | 379 | retval = -ENODEV; |
| 366 | if (filp->f_flags & O_NONBLOCK) | 380 | goto free_old_hdr; |
| 367 | return -EAGAIN; | 381 | } |
| 382 | if (filp->f_flags & O_NONBLOCK) { | ||
| 383 | retval = -EAGAIN; | ||
| 384 | goto free_old_hdr; | ||
| 385 | } | ||
| 368 | while (1) { | 386 | while (1) { |
| 369 | res = 0; /* following is a macro that beats race condition */ | 387 | retval = 0; /* following macro beats race condition */ |
| 370 | __wait_event_interruptible(sfp->read_wait, | 388 | __wait_event_interruptible(sfp->read_wait, |
| 371 | (sdp->detached || (srp = sg_get_rq_mark(sfp, req_pack_id))), | 389 | (sdp->detached || |
| 372 | res); | 390 | (srp = sg_get_rq_mark(sfp, req_pack_id))), |
| 373 | if (sdp->detached) | 391 | retval); |
| 374 | return -ENODEV; | 392 | if (sdp->detached) { |
| 375 | if (0 == res) | 393 | retval = -ENODEV; |
| 394 | goto free_old_hdr; | ||
| 395 | } | ||
| 396 | if (0 == retval) | ||
| 376 | break; | 397 | break; |
| 377 | return res; /* -ERESTARTSYS because signal hit process */ | 398 | |
| 399 | /* -ERESTARTSYS as signal hit process */ | ||
| 400 | goto free_old_hdr; | ||
| 378 | } | 401 | } |
| 379 | } | 402 | } |
| 380 | if (srp->header.interface_id != '\0') | 403 | if (srp->header.interface_id != '\0') { |
| 381 | return sg_new_read(sfp, buf, count, srp); | 404 | retval = sg_new_read(sfp, buf, count, srp); |
| 405 | goto free_old_hdr; | ||
| 406 | } | ||
| 382 | 407 | ||
| 383 | hp = &srp->header; | 408 | hp = &srp->header; |
| 384 | memset(&old_hdr, 0, SZ_SG_HEADER); | 409 | if (old_hdr == NULL) { |
| 385 | old_hdr.reply_len = (int) hp->timeout; | 410 | old_hdr = kmalloc(SZ_SG_HEADER, GFP_KERNEL); |
| 386 | old_hdr.pack_len = old_hdr.reply_len; /* very old, strange behaviour */ | 411 | if (! old_hdr) { |
| 387 | old_hdr.pack_id = hp->pack_id; | 412 | retval = -ENOMEM; |
| 388 | old_hdr.twelve_byte = | 413 | goto free_old_hdr; |
| 414 | } | ||
| 415 | } | ||
| 416 | memset(old_hdr, 0, SZ_SG_HEADER); | ||
| 417 | old_hdr->reply_len = (int) hp->timeout; | ||
| 418 | old_hdr->pack_len = old_hdr->reply_len; /* old, strange behaviour */ | ||
| 419 | old_hdr->pack_id = hp->pack_id; | ||
| 420 | old_hdr->twelve_byte = | ||
| 389 | ((srp->data.cmd_opcode >= 0xc0) && (12 == hp->cmd_len)) ? 1 : 0; | 421 | ((srp->data.cmd_opcode >= 0xc0) && (12 == hp->cmd_len)) ? 1 : 0; |
| 390 | old_hdr.target_status = hp->masked_status; | 422 | old_hdr->target_status = hp->masked_status; |
| 391 | old_hdr.host_status = hp->host_status; | 423 | old_hdr->host_status = hp->host_status; |
| 392 | old_hdr.driver_status = hp->driver_status; | 424 | old_hdr->driver_status = hp->driver_status; |
| 393 | if ((CHECK_CONDITION & hp->masked_status) || | 425 | if ((CHECK_CONDITION & hp->masked_status) || |
| 394 | (DRIVER_SENSE & hp->driver_status)) | 426 | (DRIVER_SENSE & hp->driver_status)) |
| 395 | memcpy(old_hdr.sense_buffer, srp->sense_b, | 427 | memcpy(old_hdr->sense_buffer, srp->sense_b, |
| 396 | sizeof (old_hdr.sense_buffer)); | 428 | sizeof (old_hdr->sense_buffer)); |
| 397 | switch (hp->host_status) { | 429 | switch (hp->host_status) { |
| 398 | /* This setup of 'result' is for backward compatibility and is best | 430 | /* This setup of 'result' is for backward compatibility and is best |
| 399 | ignored by the user who should use target, host + driver status */ | 431 | ignored by the user who should use target, host + driver status */ |
| 400 | case DID_OK: | 432 | case DID_OK: |
| 401 | case DID_PASSTHROUGH: | 433 | case DID_PASSTHROUGH: |
| 402 | case DID_SOFT_ERROR: | 434 | case DID_SOFT_ERROR: |
| 403 | old_hdr.result = 0; | 435 | old_hdr->result = 0; |
| 404 | break; | 436 | break; |
| 405 | case DID_NO_CONNECT: | 437 | case DID_NO_CONNECT: |
| 406 | case DID_BUS_BUSY: | 438 | case DID_BUS_BUSY: |
| 407 | case DID_TIME_OUT: | 439 | case DID_TIME_OUT: |
| 408 | old_hdr.result = EBUSY; | 440 | old_hdr->result = EBUSY; |
| 409 | break; | 441 | break; |
| 410 | case DID_BAD_TARGET: | 442 | case DID_BAD_TARGET: |
| 411 | case DID_ABORT: | 443 | case DID_ABORT: |
| 412 | case DID_PARITY: | 444 | case DID_PARITY: |
| 413 | case DID_RESET: | 445 | case DID_RESET: |
| 414 | case DID_BAD_INTR: | 446 | case DID_BAD_INTR: |
| 415 | old_hdr.result = EIO; | 447 | old_hdr->result = EIO; |
| 416 | break; | 448 | break; |
| 417 | case DID_ERROR: | 449 | case DID_ERROR: |
| 418 | old_hdr.result = (srp->sense_b[0] == 0 && | 450 | old_hdr->result = (srp->sense_b[0] == 0 && |
| 419 | hp->masked_status == GOOD) ? 0 : EIO; | 451 | hp->masked_status == GOOD) ? 0 : EIO; |
| 420 | break; | 452 | break; |
| 421 | default: | 453 | default: |
| 422 | old_hdr.result = EIO; | 454 | old_hdr->result = EIO; |
| 423 | break; | 455 | break; |
| 424 | } | 456 | } |
| 425 | 457 | ||
| 426 | /* Now copy the result back to the user buffer. */ | 458 | /* Now copy the result back to the user buffer. */ |
| 427 | if (count >= SZ_SG_HEADER) { | 459 | if (count >= SZ_SG_HEADER) { |
| 428 | if (__copy_to_user(buf, &old_hdr, SZ_SG_HEADER)) | 460 | if (__copy_to_user(buf, old_hdr, SZ_SG_HEADER)) { |
| 429 | return -EFAULT; | 461 | retval = -EFAULT; |
| 462 | goto free_old_hdr; | ||
| 463 | } | ||
| 430 | buf += SZ_SG_HEADER; | 464 | buf += SZ_SG_HEADER; |
| 431 | if (count > old_hdr.reply_len) | 465 | if (count > old_hdr->reply_len) |
| 432 | count = old_hdr.reply_len; | 466 | count = old_hdr->reply_len; |
| 433 | if (count > SZ_SG_HEADER) { | 467 | if (count > SZ_SG_HEADER) { |
| 434 | if ((res = | 468 | if (sg_read_oxfer(srp, buf, count - SZ_SG_HEADER)) { |
| 435 | sg_read_oxfer(srp, buf, count - SZ_SG_HEADER))) | 469 | retval = -EFAULT; |
| 436 | return -EFAULT; | 470 | goto free_old_hdr; |
| 471 | } | ||
| 437 | } | 472 | } |
| 438 | } else | 473 | } else |
| 439 | count = (old_hdr.result == 0) ? 0 : -EIO; | 474 | count = (old_hdr->result == 0) ? 0 : -EIO; |
| 440 | sg_finish_rem_req(srp); | 475 | sg_finish_rem_req(srp); |
| 441 | return count; | 476 | retval = count; |
| 477 | free_old_hdr: | ||
| 478 | if (old_hdr) | ||
| 479 | kfree(old_hdr); | ||
| 480 | return retval; | ||
| 442 | } | 481 | } |
| 443 | 482 | ||
| 444 | static ssize_t | 483 | static ssize_t |
| @@ -725,7 +764,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, | |||
| 725 | srp->data.sglist_len = 0; | 764 | srp->data.sglist_len = 0; |
| 726 | srp->data.bufflen = 0; | 765 | srp->data.bufflen = 0; |
| 727 | srp->data.buffer = NULL; | 766 | srp->data.buffer = NULL; |
| 728 | hp->duration = jiffies; /* unit jiffies now, millisecs after done */ | 767 | hp->duration = jiffies_to_msecs(jiffies); |
| 729 | /* Now send everything of to mid-level. The next time we hear about this | 768 | /* Now send everything of to mid-level. The next time we hear about this |
| 730 | packet is when sg_cmd_done() is called (i.e. a callback). */ | 769 | packet is when sg_cmd_done() is called (i.e. a callback). */ |
| 731 | scsi_do_req(SRpnt, (void *) cmnd, | 770 | scsi_do_req(SRpnt, (void *) cmnd, |
| @@ -938,8 +977,13 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
| 938 | if (!access_ok(VERIFY_WRITE, p, SZ_SG_REQ_INFO * SG_MAX_QUEUE)) | 977 | if (!access_ok(VERIFY_WRITE, p, SZ_SG_REQ_INFO * SG_MAX_QUEUE)) |
| 939 | return -EFAULT; | 978 | return -EFAULT; |
| 940 | else { | 979 | else { |
| 941 | sg_req_info_t rinfo[SG_MAX_QUEUE]; | 980 | sg_req_info_t *rinfo; |
| 942 | Sg_request *srp; | 981 | unsigned int ms; |
| 982 | |||
| 983 | rinfo = kmalloc(SZ_SG_REQ_INFO * SG_MAX_QUEUE, | ||
| 984 | GFP_KERNEL); | ||
| 985 | if (!rinfo) | ||
| 986 | return -ENOMEM; | ||
| 943 | read_lock_irqsave(&sfp->rq_list_lock, iflags); | 987 | read_lock_irqsave(&sfp->rq_list_lock, iflags); |
| 944 | for (srp = sfp->headrp, val = 0; val < SG_MAX_QUEUE; | 988 | for (srp = sfp->headrp, val = 0; val < SG_MAX_QUEUE; |
| 945 | ++val, srp = srp ? srp->nextrp : srp) { | 989 | ++val, srp = srp ? srp->nextrp : srp) { |
| @@ -950,19 +994,30 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
| 950 | srp->header.masked_status & | 994 | srp->header.masked_status & |
| 951 | srp->header.host_status & | 995 | srp->header.host_status & |
| 952 | srp->header.driver_status; | 996 | srp->header.driver_status; |
| 953 | rinfo[val].duration = | 997 | if (srp->done) |
| 954 | srp->done ? srp->header.duration : | 998 | rinfo[val].duration = |
| 955 | jiffies_to_msecs( | 999 | srp->header.duration; |
| 956 | jiffies - srp->header.duration); | 1000 | else { |
| 1001 | ms = jiffies_to_msecs(jiffies); | ||
| 1002 | rinfo[val].duration = | ||
| 1003 | (ms > srp->header.duration) ? | ||
| 1004 | (ms - srp->header.duration) : 0; | ||
| 1005 | } | ||
| 957 | rinfo[val].orphan = srp->orphan; | 1006 | rinfo[val].orphan = srp->orphan; |
| 958 | rinfo[val].sg_io_owned = srp->sg_io_owned; | 1007 | rinfo[val].sg_io_owned = |
| 959 | rinfo[val].pack_id = srp->header.pack_id; | 1008 | srp->sg_io_owned; |
| 960 | rinfo[val].usr_ptr = srp->header.usr_ptr; | 1009 | rinfo[val].pack_id = |
| 1010 | srp->header.pack_id; | ||
| 1011 | rinfo[val].usr_ptr = | ||
| 1012 | srp->header.usr_ptr; | ||
| 961 | } | 1013 | } |
| 962 | } | 1014 | } |
| 963 | read_unlock_irqrestore(&sfp->rq_list_lock, iflags); | 1015 | read_unlock_irqrestore(&sfp->rq_list_lock, iflags); |
| 964 | return (__copy_to_user(p, rinfo, | 1016 | result = __copy_to_user(p, rinfo, |
| 965 | SZ_SG_REQ_INFO * SG_MAX_QUEUE) ? -EFAULT : 0); | 1017 | SZ_SG_REQ_INFO * SG_MAX_QUEUE); |
| 1018 | result = result ? -EFAULT : 0; | ||
| 1019 | kfree(rinfo); | ||
| 1020 | return result; | ||
| 966 | } | 1021 | } |
| 967 | case SG_EMULATED_HOST: | 1022 | case SG_EMULATED_HOST: |
| 968 | if (sdp->detached) | 1023 | if (sdp->detached) |
| @@ -1209,11 +1264,12 @@ static int | |||
| 1209 | sg_mmap(struct file *filp, struct vm_area_struct *vma) | 1264 | sg_mmap(struct file *filp, struct vm_area_struct *vma) |
| 1210 | { | 1265 | { |
| 1211 | Sg_fd *sfp; | 1266 | Sg_fd *sfp; |
| 1212 | unsigned long req_sz = vma->vm_end - vma->vm_start; | 1267 | unsigned long req_sz; |
| 1213 | Sg_scatter_hold *rsv_schp; | 1268 | Sg_scatter_hold *rsv_schp; |
| 1214 | 1269 | ||
| 1215 | if ((!filp) || (!vma) || (!(sfp = (Sg_fd *) filp->private_data))) | 1270 | if ((!filp) || (!vma) || (!(sfp = (Sg_fd *) filp->private_data))) |
| 1216 | return -ENXIO; | 1271 | return -ENXIO; |
| 1272 | req_sz = vma->vm_end - vma->vm_start; | ||
| 1217 | SCSI_LOG_TIMEOUT(3, printk("sg_mmap starting, vm_start=%p, len=%d\n", | 1273 | SCSI_LOG_TIMEOUT(3, printk("sg_mmap starting, vm_start=%p, len=%d\n", |
| 1218 | (void *) vma->vm_start, (int) req_sz)); | 1274 | (void *) vma->vm_start, (int) req_sz)); |
| 1219 | if (vma->vm_pgoff) | 1275 | if (vma->vm_pgoff) |
| @@ -1260,6 +1316,7 @@ sg_cmd_done(Scsi_Cmnd * SCpnt) | |||
| 1260 | Sg_fd *sfp; | 1316 | Sg_fd *sfp; |
| 1261 | Sg_request *srp = NULL; | 1317 | Sg_request *srp = NULL; |
| 1262 | unsigned long iflags; | 1318 | unsigned long iflags; |
| 1319 | unsigned int ms; | ||
| 1263 | 1320 | ||
| 1264 | if (SCpnt && (SRpnt = SCpnt->sc_request)) | 1321 | if (SCpnt && (SRpnt = SCpnt->sc_request)) |
| 1265 | srp = (Sg_request *) SRpnt->upper_private_data; | 1322 | srp = (Sg_request *) SRpnt->upper_private_data; |
| @@ -1296,9 +1353,9 @@ sg_cmd_done(Scsi_Cmnd * SCpnt) | |||
| 1296 | SCSI_LOG_TIMEOUT(4, printk("sg_cmd_done: %s, pack_id=%d, res=0x%x\n", | 1353 | SCSI_LOG_TIMEOUT(4, printk("sg_cmd_done: %s, pack_id=%d, res=0x%x\n", |
| 1297 | sdp->disk->disk_name, srp->header.pack_id, (int) SRpnt->sr_result)); | 1354 | sdp->disk->disk_name, srp->header.pack_id, (int) SRpnt->sr_result)); |
| 1298 | srp->header.resid = SCpnt->resid; | 1355 | srp->header.resid = SCpnt->resid; |
| 1299 | /* N.B. unit of duration changes here from jiffies to millisecs */ | 1356 | ms = jiffies_to_msecs(jiffies); |
| 1300 | srp->header.duration = | 1357 | srp->header.duration = (ms > srp->header.duration) ? |
| 1301 | jiffies_to_msecs(jiffies - srp->header.duration); | 1358 | (ms - srp->header.duration) : 0; |
| 1302 | if (0 != SRpnt->sr_result) { | 1359 | if (0 != SRpnt->sr_result) { |
| 1303 | struct scsi_sense_hdr sshdr; | 1360 | struct scsi_sense_hdr sshdr; |
| 1304 | 1361 | ||
| @@ -2396,7 +2453,7 @@ sg_add_request(Sg_fd * sfp) | |||
| 2396 | } | 2453 | } |
| 2397 | if (resp) { | 2454 | if (resp) { |
| 2398 | resp->nextrp = NULL; | 2455 | resp->nextrp = NULL; |
| 2399 | resp->header.duration = jiffies; | 2456 | resp->header.duration = jiffies_to_msecs(jiffies); |
| 2400 | resp->my_cmdp = NULL; | 2457 | resp->my_cmdp = NULL; |
| 2401 | } | 2458 | } |
| 2402 | write_unlock_irqrestore(&sfp->rq_list_lock, iflags); | 2459 | write_unlock_irqrestore(&sfp->rq_list_lock, iflags); |
| @@ -2991,6 +3048,7 @@ static void sg_proc_debug_helper(struct seq_file *s, Sg_device * sdp) | |||
| 2991 | Sg_fd *fp; | 3048 | Sg_fd *fp; |
| 2992 | const sg_io_hdr_t *hp; | 3049 | const sg_io_hdr_t *hp; |
| 2993 | const char * cp; | 3050 | const char * cp; |
| 3051 | unsigned int ms; | ||
| 2994 | 3052 | ||
| 2995 | for (k = 0; (fp = sg_get_nth_sfp(sdp, k)); ++k) { | 3053 | for (k = 0; (fp = sg_get_nth_sfp(sdp, k)); ++k) { |
| 2996 | seq_printf(s, " FD(%d): timeout=%dms bufflen=%d " | 3054 | seq_printf(s, " FD(%d): timeout=%dms bufflen=%d " |
| @@ -3029,10 +3087,13 @@ static void sg_proc_debug_helper(struct seq_file *s, Sg_device * sdp) | |||
| 3029 | srp->header.pack_id, blen); | 3087 | srp->header.pack_id, blen); |
| 3030 | if (srp->done) | 3088 | if (srp->done) |
| 3031 | seq_printf(s, " dur=%d", hp->duration); | 3089 | seq_printf(s, " dur=%d", hp->duration); |
| 3032 | else | 3090 | else { |
| 3091 | ms = jiffies_to_msecs(jiffies); | ||
| 3033 | seq_printf(s, " t_o/elap=%d/%d", | 3092 | seq_printf(s, " t_o/elap=%d/%d", |
| 3034 | new_interface ? hp->timeout : jiffies_to_msecs(fp->timeout), | 3093 | (new_interface ? hp->timeout : |
| 3035 | jiffies_to_msecs(hp->duration ? (jiffies - hp->duration) : 0)); | 3094 | jiffies_to_msecs(fp->timeout)), |
| 3095 | (ms > hp->duration ? ms - hp->duration : 0)); | ||
| 3096 | } | ||
| 3036 | seq_printf(s, "ms sgat=%d op=0x%02x\n", usg, | 3097 | seq_printf(s, "ms sgat=%d op=0x%02x\n", usg, |
| 3037 | (int) srp->data.cmd_opcode); | 3098 | (int) srp->data.cmd_opcode); |
| 3038 | } | 3099 | } |
diff --git a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c index 63bf2aecbc57..9171788348c4 100644 --- a/drivers/scsi/sim710.c +++ b/drivers/scsi/sim710.c | |||
| @@ -120,11 +120,10 @@ sim710_probe_common(struct device *dev, unsigned long base_addr, | |||
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | /* Fill in the three required pieces of hostdata */ | 122 | /* Fill in the three required pieces of hostdata */ |
| 123 | hostdata->base = base_addr; | 123 | hostdata->base = ioport_map(base_addr, 64); |
| 124 | hostdata->differential = differential; | 124 | hostdata->differential = differential; |
| 125 | hostdata->clock = clock; | 125 | hostdata->clock = clock; |
| 126 | hostdata->chip710 = 1; | 126 | hostdata->chip710 = 1; |
| 127 | NCR_700_set_io_mapped(hostdata); | ||
| 128 | 127 | ||
| 129 | /* and register the chip */ | 128 | /* and register the chip */ |
| 130 | if((host = NCR_700_detect(&sim710_driver_template, hostdata, dev)) | 129 | if((host = NCR_700_detect(&sim710_driver_template, hostdata, dev)) |
| @@ -133,6 +132,7 @@ sim710_probe_common(struct device *dev, unsigned long base_addr, | |||
| 133 | goto out_release; | 132 | goto out_release; |
| 134 | } | 133 | } |
| 135 | host->this_id = scsi_id; | 134 | host->this_id = scsi_id; |
| 135 | host->base = base_addr; | ||
| 136 | host->irq = irq; | 136 | host->irq = irq; |
| 137 | if (request_irq(irq, NCR_700_intr, SA_SHIRQ, "sim710", host)) { | 137 | if (request_irq(irq, NCR_700_intr, SA_SHIRQ, "sim710", host)) { |
| 138 | printk(KERN_ERR "sim710: request_irq failed\n"); | 138 | printk(KERN_ERR "sim710: request_irq failed\n"); |
| @@ -164,6 +164,7 @@ sim710_device_remove(struct device *dev) | |||
| 164 | NCR_700_release(host); | 164 | NCR_700_release(host); |
| 165 | kfree(hostdata); | 165 | kfree(hostdata); |
| 166 | free_irq(host->irq, host); | 166 | free_irq(host->irq, host); |
| 167 | release_region(host->base, 64); | ||
| 167 | return 0; | 168 | return 0; |
| 168 | } | 169 | } |
| 169 | 170 | ||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 70ac2860a605..ef1afc178c0a 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -355,8 +355,11 @@ struct request_queue | |||
| 355 | unsigned long queue_flags; | 355 | unsigned long queue_flags; |
| 356 | 356 | ||
| 357 | /* | 357 | /* |
| 358 | * protects queue structures from reentrancy | 358 | * protects queue structures from reentrancy. ->__queue_lock should |
| 359 | * _never_ be used directly, it is queue private. always use | ||
| 360 | * ->queue_lock. | ||
| 359 | */ | 361 | */ |
| 362 | spinlock_t __queue_lock; | ||
| 360 | spinlock_t *queue_lock; | 363 | spinlock_t *queue_lock; |
| 361 | 364 | ||
| 362 | /* | 365 | /* |
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 7099d2ce967e..c018020d9160 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
| @@ -43,9 +43,9 @@ struct scsi_device { | |||
| 43 | struct list_head siblings; /* list of all devices on this host */ | 43 | struct list_head siblings; /* list of all devices on this host */ |
| 44 | struct list_head same_target_siblings; /* just the devices sharing same target id */ | 44 | struct list_head same_target_siblings; /* just the devices sharing same target id */ |
| 45 | 45 | ||
| 46 | /* this is now protected by the request_queue->queue_lock */ | ||
| 46 | unsigned int device_busy; /* commands actually active on | 47 | unsigned int device_busy; /* commands actually active on |
| 47 | * low-level. protected by queue_lock. */ | 48 | * low-level. protected by queue_lock. */ |
| 48 | spinlock_t sdev_lock; /* also the request queue_lock */ | ||
| 49 | spinlock_t list_lock; | 49 | spinlock_t list_lock; |
| 50 | struct list_head cmd_list; /* queue of in use SCSI Command structures */ | 50 | struct list_head cmd_list; /* queue of in use SCSI Command structures */ |
| 51 | struct list_head starved_entry; | 51 | struct list_head starved_entry; |
