diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/Kconfig | 14 | ||||
-rw-r--r-- | drivers/scsi/Makefile | 5 | ||||
-rw-r--r-- | drivers/scsi/aacraid/aachba.c | 15 | ||||
-rw-r--r-- | drivers/scsi/aacraid/aacraid.h | 3 | ||||
-rw-r--r-- | drivers/scsi/aacraid/rx.c | 8 | ||||
-rw-r--r-- | drivers/scsi/aacraid/sa.c | 9 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aicasm/aicasm_gram.y | 1 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y | 1 | ||||
-rw-r--r-- | drivers/scsi/aic94xx/aic94xx_tmf.c | 14 | ||||
-rw-r--r-- | drivers/scsi/ipr.c | 7 | ||||
-rw-r--r-- | drivers/scsi/jazz_esp.c | 429 | ||||
-rw-r--r-- | drivers/scsi/libsrp.c | 1 | ||||
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.c | 67 | ||||
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.h | 14 | ||||
-rw-r--r-- | drivers/scsi/pluto.c | 18 | ||||
-rw-r--r-- | drivers/scsi/scsi_devinfo.c | 1 | ||||
-rw-r--r-- | drivers/scsi/sd.c | 18 | ||||
-rw-r--r-- | drivers/scsi/stex.c | 90 |
18 files changed, 370 insertions, 345 deletions
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index d28c14e23c32..572034ceb143 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -1753,23 +1753,9 @@ config SUN3X_ESP | |||
1753 | The ESP was an on-board SCSI controller used on Sun 3/80 | 1753 | The ESP was an on-board SCSI controller used on Sun 3/80 |
1754 | machines. Say Y here to compile in support for it. | 1754 | machines. Say Y here to compile in support for it. |
1755 | 1755 | ||
1756 | config SCSI_ESP_CORE | ||
1757 | tristate "ESP Scsi Driver Core" | ||
1758 | depends on SCSI | ||
1759 | select SCSI_SPI_ATTRS | ||
1760 | help | ||
1761 | This is a core driver for NCR53c9x based scsi chipsets, | ||
1762 | also known as "ESP" for Emulex Scsi Processor or | ||
1763 | Enhanced Scsi Processor. This driver does not exist by | ||
1764 | itself, there are front-end drivers which, when enabled, | ||
1765 | select and enable this driver. One example is SCSI_SUNESP. | ||
1766 | These front-end drivers provide probing, DMA, and register | ||
1767 | access support for the core driver. | ||
1768 | |||
1769 | config SCSI_SUNESP | 1756 | config SCSI_SUNESP |
1770 | tristate "Sparc ESP Scsi Driver" | 1757 | tristate "Sparc ESP Scsi Driver" |
1771 | depends on SBUS && SCSI | 1758 | depends on SBUS && SCSI |
1772 | select SCSI_ESP_CORE | ||
1773 | help | 1759 | help |
1774 | This is the driver for the Sun ESP SCSI host adapter. The ESP | 1760 | This is the driver for the Sun ESP SCSI host adapter. The ESP |
1775 | chipset is present in most SPARC SBUS-based computers. | 1761 | chipset is present in most SPARC SBUS-based computers. |
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 51e884fa10b0..b1b632791580 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile | |||
@@ -106,8 +106,7 @@ obj-$(CONFIG_MEGARAID_LEGACY) += megaraid.o | |||
106 | obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/ | 106 | obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/ |
107 | obj-$(CONFIG_MEGARAID_SAS) += megaraid/ | 107 | obj-$(CONFIG_MEGARAID_SAS) += megaraid/ |
108 | obj-$(CONFIG_SCSI_ACARD) += atp870u.o | 108 | obj-$(CONFIG_SCSI_ACARD) += atp870u.o |
109 | obj-$(CONFIG_SCSI_ESP_CORE) += esp_scsi.o | 109 | obj-$(CONFIG_SCSI_SUNESP) += esp_scsi.o sun_esp.o |
110 | obj-$(CONFIG_SCSI_SUNESP) += sun_esp.o | ||
111 | obj-$(CONFIG_SCSI_GDTH) += gdth.o | 110 | obj-$(CONFIG_SCSI_GDTH) += gdth.o |
112 | obj-$(CONFIG_SCSI_INITIO) += initio.o | 111 | obj-$(CONFIG_SCSI_INITIO) += initio.o |
113 | obj-$(CONFIG_SCSI_INIA100) += a100u2w.o | 112 | obj-$(CONFIG_SCSI_INIA100) += a100u2w.o |
@@ -121,7 +120,7 @@ obj-$(CONFIG_BLK_DEV_3W_XXXX_RAID) += 3w-xxxx.o | |||
121 | obj-$(CONFIG_SCSI_3W_9XXX) += 3w-9xxx.o | 120 | obj-$(CONFIG_SCSI_3W_9XXX) += 3w-9xxx.o |
122 | obj-$(CONFIG_SCSI_PPA) += ppa.o | 121 | obj-$(CONFIG_SCSI_PPA) += ppa.o |
123 | obj-$(CONFIG_SCSI_IMM) += imm.o | 122 | obj-$(CONFIG_SCSI_IMM) += imm.o |
124 | obj-$(CONFIG_JAZZ_ESP) += NCR53C9x.o jazz_esp.o | 123 | obj-$(CONFIG_JAZZ_ESP) += esp_scsi.o jazz_esp.o |
125 | obj-$(CONFIG_SUN3X_ESP) += NCR53C9x.o sun3x_esp.o | 124 | obj-$(CONFIG_SUN3X_ESP) += NCR53C9x.o sun3x_esp.o |
126 | obj-$(CONFIG_SCSI_FCAL) += fcal.o | 125 | obj-$(CONFIG_SCSI_FCAL) += fcal.o |
127 | obj-$(CONFIG_SCSI_LASI700) += 53c700.o lasi700.o | 126 | obj-$(CONFIG_SCSI_LASI700) += 53c700.o lasi700.o |
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 1e82c69b36b0..8dcfe4ec35c2 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c | |||
@@ -146,7 +146,7 @@ static char *aac_get_status_string(u32 status); | |||
146 | static int nondasd = -1; | 146 | static int nondasd = -1; |
147 | static int dacmode = -1; | 147 | static int dacmode = -1; |
148 | 148 | ||
149 | static int commit = -1; | 149 | int aac_commit = -1; |
150 | int startup_timeout = 180; | 150 | int startup_timeout = 180; |
151 | int aif_timeout = 120; | 151 | int aif_timeout = 120; |
152 | 152 | ||
@@ -154,7 +154,7 @@ module_param(nondasd, int, S_IRUGO|S_IWUSR); | |||
154 | MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on"); | 154 | MODULE_PARM_DESC(nondasd, "Control scanning of hba for nondasd devices. 0=off, 1=on"); |
155 | module_param(dacmode, int, S_IRUGO|S_IWUSR); | 155 | module_param(dacmode, int, S_IRUGO|S_IWUSR); |
156 | MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on"); | 156 | MODULE_PARM_DESC(dacmode, "Control whether dma addressing is using 64 bit DAC. 0=off, 1=on"); |
157 | module_param(commit, int, S_IRUGO|S_IWUSR); | 157 | module_param_named(commit, aac_commit, int, S_IRUGO|S_IWUSR); |
158 | MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the adapter for foreign arrays.\nThis is typically needed in systems that do not have a BIOS. 0=off, 1=on"); | 158 | MODULE_PARM_DESC(commit, "Control whether a COMMIT_CONFIG is issued to the adapter for foreign arrays.\nThis is typically needed in systems that do not have a BIOS. 0=off, 1=on"); |
159 | module_param(startup_timeout, int, S_IRUGO|S_IWUSR); | 159 | module_param(startup_timeout, int, S_IRUGO|S_IWUSR); |
160 | MODULE_PARM_DESC(startup_timeout, "The duration of time in seconds to wait for adapter to have it's kernel up and\nrunning. This is typically adjusted for large systems that do not have a BIOS."); | 160 | MODULE_PARM_DESC(startup_timeout, "The duration of time in seconds to wait for adapter to have it's kernel up and\nrunning. This is typically adjusted for large systems that do not have a BIOS."); |
@@ -173,6 +173,9 @@ int expose_physicals = -1; | |||
173 | module_param(expose_physicals, int, S_IRUGO|S_IWUSR); | 173 | module_param(expose_physicals, int, S_IRUGO|S_IWUSR); |
174 | MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. -1=protect 0=off, 1=on"); | 174 | MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. -1=protect 0=off, 1=on"); |
175 | 175 | ||
176 | int aac_reset_devices = 0; | ||
177 | module_param_named(reset_devices, aac_reset_devices, int, S_IRUGO|S_IWUSR); | ||
178 | MODULE_PARM_DESC(reset_devices, "Force an adapter reset at initialization."); | ||
176 | 179 | ||
177 | static inline int aac_valid_context(struct scsi_cmnd *scsicmd, | 180 | static inline int aac_valid_context(struct scsi_cmnd *scsicmd, |
178 | struct fib *fibptr) { | 181 | struct fib *fibptr) { |
@@ -246,7 +249,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag) | |||
246 | aac_fib_complete(fibptr); | 249 | aac_fib_complete(fibptr); |
247 | /* Send a CT_COMMIT_CONFIG to enable discovery of devices */ | 250 | /* Send a CT_COMMIT_CONFIG to enable discovery of devices */ |
248 | if (status >= 0) { | 251 | if (status >= 0) { |
249 | if ((commit == 1) || commit_flag) { | 252 | if ((aac_commit == 1) || commit_flag) { |
250 | struct aac_commit_config * dinfo; | 253 | struct aac_commit_config * dinfo; |
251 | aac_fib_init(fibptr); | 254 | aac_fib_init(fibptr); |
252 | dinfo = (struct aac_commit_config *) fib_data(fibptr); | 255 | dinfo = (struct aac_commit_config *) fib_data(fibptr); |
@@ -261,7 +264,7 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag) | |||
261 | 1, 1, | 264 | 1, 1, |
262 | NULL, NULL); | 265 | NULL, NULL); |
263 | aac_fib_complete(fibptr); | 266 | aac_fib_complete(fibptr); |
264 | } else if (commit == 0) { | 267 | } else if (aac_commit == 0) { |
265 | printk(KERN_WARNING | 268 | printk(KERN_WARNING |
266 | "aac_get_config_status: Foreign device configurations are being ignored\n"); | 269 | "aac_get_config_status: Foreign device configurations are being ignored\n"); |
267 | } | 270 | } |
@@ -340,7 +343,7 @@ int aac_get_containers(struct aac_dev *dev) | |||
340 | static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigned int offset, unsigned int len) | 343 | static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigned int offset, unsigned int len) |
341 | { | 344 | { |
342 | void *buf; | 345 | void *buf; |
343 | unsigned int transfer_len; | 346 | int transfer_len; |
344 | struct scatterlist *sg = scsicmd->request_buffer; | 347 | struct scatterlist *sg = scsicmd->request_buffer; |
345 | 348 | ||
346 | if (scsicmd->use_sg) { | 349 | if (scsicmd->use_sg) { |
@@ -351,7 +354,7 @@ static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigne | |||
351 | transfer_len = min(scsicmd->request_bufflen, len + offset); | 354 | transfer_len = min(scsicmd->request_bufflen, len + offset); |
352 | } | 355 | } |
353 | transfer_len -= offset; | 356 | transfer_len -= offset; |
354 | if (buf && transfer_len) | 357 | if (buf && transfer_len > 0) |
355 | memcpy(buf + offset, data, transfer_len); | 358 | memcpy(buf + offset, data, transfer_len); |
356 | 359 | ||
357 | if (scsicmd->use_sg) | 360 | if (scsicmd->use_sg) |
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 45ca3e801619..c81edf36913f 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h | |||
@@ -1823,9 +1823,12 @@ int aac_send_shutdown(struct aac_dev *dev); | |||
1823 | int aac_probe_container(struct aac_dev *dev, int cid); | 1823 | int aac_probe_container(struct aac_dev *dev, int cid); |
1824 | int _aac_rx_init(struct aac_dev *dev); | 1824 | int _aac_rx_init(struct aac_dev *dev); |
1825 | int aac_rx_select_comm(struct aac_dev *dev, int comm); | 1825 | int aac_rx_select_comm(struct aac_dev *dev, int comm); |
1826 | int aac_rx_deliver_producer(struct fib * fib); | ||
1826 | extern int numacb; | 1827 | extern int numacb; |
1827 | extern int acbsize; | 1828 | extern int acbsize; |
1828 | extern char aac_driver_version[]; | 1829 | extern char aac_driver_version[]; |
1829 | extern int startup_timeout; | 1830 | extern int startup_timeout; |
1830 | extern int aif_timeout; | 1831 | extern int aif_timeout; |
1831 | extern int expose_physicals; | 1832 | extern int expose_physicals; |
1833 | extern int aac_reset_devices; | ||
1834 | extern int aac_commit; | ||
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c index 291cd14f4e98..ae978a373c56 100644 --- a/drivers/scsi/aacraid/rx.c +++ b/drivers/scsi/aacraid/rx.c | |||
@@ -378,7 +378,7 @@ static int aac_rx_check_health(struct aac_dev *dev) | |||
378 | * | 378 | * |
379 | * Will send a fib, returning 0 if successful. | 379 | * Will send a fib, returning 0 if successful. |
380 | */ | 380 | */ |
381 | static int aac_rx_deliver_producer(struct fib * fib) | 381 | int aac_rx_deliver_producer(struct fib * fib) |
382 | { | 382 | { |
383 | struct aac_dev *dev = fib->dev; | 383 | struct aac_dev *dev = fib->dev; |
384 | struct aac_queue *q = &dev->queues->queue[AdapNormCmdQueue]; | 384 | struct aac_queue *q = &dev->queues->queue[AdapNormCmdQueue]; |
@@ -488,6 +488,8 @@ static int aac_rx_restart_adapter(struct aac_dev *dev, int bled) | |||
488 | return -EINVAL; | 488 | return -EINVAL; |
489 | if (rx_readl(dev, MUnit.OMRx[0]) & KERNEL_PANIC) | 489 | if (rx_readl(dev, MUnit.OMRx[0]) & KERNEL_PANIC) |
490 | return -ENODEV; | 490 | return -ENODEV; |
491 | if (startup_timeout < 300) | ||
492 | startup_timeout = 300; | ||
491 | return 0; | 493 | return 0; |
492 | } | 494 | } |
493 | 495 | ||
@@ -542,7 +544,7 @@ int _aac_rx_init(struct aac_dev *dev) | |||
542 | dev->a_ops.adapter_sync_cmd = rx_sync_cmd; | 544 | dev->a_ops.adapter_sync_cmd = rx_sync_cmd; |
543 | dev->a_ops.adapter_enable_int = aac_rx_disable_interrupt; | 545 | dev->a_ops.adapter_enable_int = aac_rx_disable_interrupt; |
544 | dev->OIMR = status = rx_readb (dev, MUnit.OIMR); | 546 | dev->OIMR = status = rx_readb (dev, MUnit.OIMR); |
545 | if ((((status & 0x0c) != 0x0c) || reset_devices) && | 547 | if ((((status & 0x0c) != 0x0c) || aac_reset_devices || reset_devices) && |
546 | !aac_rx_restart_adapter(dev, 0)) | 548 | !aac_rx_restart_adapter(dev, 0)) |
547 | ++restart; | 549 | ++restart; |
548 | /* | 550 | /* |
@@ -594,6 +596,8 @@ int _aac_rx_init(struct aac_dev *dev) | |||
594 | } | 596 | } |
595 | msleep(1); | 597 | msleep(1); |
596 | } | 598 | } |
599 | if (restart) | ||
600 | aac_commit = 1; | ||
597 | /* | 601 | /* |
598 | * Fill in the common function dispatch table. | 602 | * Fill in the common function dispatch table. |
599 | */ | 603 | */ |
diff --git a/drivers/scsi/aacraid/sa.c b/drivers/scsi/aacraid/sa.c index f4b5e9742ab0..85b91bc578c9 100644 --- a/drivers/scsi/aacraid/sa.c +++ b/drivers/scsi/aacraid/sa.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * based on the old aacraid driver that is.. | 5 | * based on the old aacraid driver that is.. |
6 | * Adaptec aacraid device driver for Linux. | 6 | * Adaptec aacraid device driver for Linux. |
7 | * | 7 | * |
8 | * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com) | 8 | * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com) |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License as published by |
@@ -257,6 +257,11 @@ static void aac_sa_start_adapter(struct aac_dev *dev) | |||
257 | NULL, NULL, NULL, NULL, NULL); | 257 | NULL, NULL, NULL, NULL, NULL); |
258 | } | 258 | } |
259 | 259 | ||
260 | static int aac_sa_restart_adapter(struct aac_dev *dev, int bled) | ||
261 | { | ||
262 | return -EINVAL; | ||
263 | } | ||
264 | |||
260 | /** | 265 | /** |
261 | * aac_sa_check_health | 266 | * aac_sa_check_health |
262 | * @dev: device to check if healthy | 267 | * @dev: device to check if healthy |
@@ -366,7 +371,9 @@ int aac_sa_init(struct aac_dev *dev) | |||
366 | dev->a_ops.adapter_notify = aac_sa_notify_adapter; | 371 | dev->a_ops.adapter_notify = aac_sa_notify_adapter; |
367 | dev->a_ops.adapter_sync_cmd = sa_sync_cmd; | 372 | dev->a_ops.adapter_sync_cmd = sa_sync_cmd; |
368 | dev->a_ops.adapter_check_health = aac_sa_check_health; | 373 | dev->a_ops.adapter_check_health = aac_sa_check_health; |
374 | dev->a_ops.adapter_restart = aac_sa_restart_adapter; | ||
369 | dev->a_ops.adapter_intr = aac_sa_intr; | 375 | dev->a_ops.adapter_intr = aac_sa_intr; |
376 | dev->a_ops.adapter_deliver = aac_rx_deliver_producer; | ||
370 | dev->a_ops.adapter_ioremap = aac_sa_ioremap; | 377 | dev->a_ops.adapter_ioremap = aac_sa_ioremap; |
371 | 378 | ||
372 | /* | 379 | /* |
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y index c328596def3c..6066998ed562 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y | |||
@@ -106,6 +106,7 @@ static void make_expression(expression_t *immed, int value); | |||
106 | static void add_conditional(symbol_t *symbol); | 106 | static void add_conditional(symbol_t *symbol); |
107 | static void add_version(const char *verstring); | 107 | static void add_version(const char *verstring); |
108 | static int is_download_const(expression_t *immed); | 108 | static int is_download_const(expression_t *immed); |
109 | void yyerror(const char *string); | ||
109 | 110 | ||
110 | #define SRAM_SYMNAME "SRAM_BASE" | 111 | #define SRAM_SYMNAME "SRAM_BASE" |
111 | #define SCB_SYMNAME "SCB_BASE" | 112 | #define SCB_SYMNAME "SCB_BASE" |
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y b/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y index 439f760b34b5..ff46aa6801bf 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y | |||
@@ -65,6 +65,7 @@ | |||
65 | static symbol_t *macro_symbol; | 65 | static symbol_t *macro_symbol; |
66 | 66 | ||
67 | static void add_macro_arg(const char *argtext, int position); | 67 | static void add_macro_arg(const char *argtext, int position); |
68 | void mmerror(const char *string); | ||
68 | 69 | ||
69 | %} | 70 | %} |
70 | 71 | ||
diff --git a/drivers/scsi/aic94xx/aic94xx_tmf.c b/drivers/scsi/aic94xx/aic94xx_tmf.c index 9a14a6d97275..c0d0b7d7a8ce 100644 --- a/drivers/scsi/aic94xx/aic94xx_tmf.c +++ b/drivers/scsi/aic94xx/aic94xx_tmf.c | |||
@@ -290,6 +290,7 @@ static void asd_tmf_tasklet_complete(struct asd_ascb *ascb, | |||
290 | static inline int asd_clear_nexus(struct sas_task *task) | 290 | static inline int asd_clear_nexus(struct sas_task *task) |
291 | { | 291 | { |
292 | int res = TMF_RESP_FUNC_FAILED; | 292 | int res = TMF_RESP_FUNC_FAILED; |
293 | int leftover; | ||
293 | struct asd_ascb *tascb = task->lldd_task; | 294 | struct asd_ascb *tascb = task->lldd_task; |
294 | unsigned long flags; | 295 | unsigned long flags; |
295 | 296 | ||
@@ -298,10 +299,12 @@ static inline int asd_clear_nexus(struct sas_task *task) | |||
298 | res = asd_clear_nexus_tag(task); | 299 | res = asd_clear_nexus_tag(task); |
299 | else | 300 | else |
300 | res = asd_clear_nexus_index(task); | 301 | res = asd_clear_nexus_index(task); |
301 | wait_for_completion_timeout(&tascb->completion, | 302 | leftover = wait_for_completion_timeout(&tascb->completion, |
302 | AIC94XX_SCB_TIMEOUT); | 303 | AIC94XX_SCB_TIMEOUT); |
303 | ASD_DPRINTK("came back from clear nexus\n"); | 304 | ASD_DPRINTK("came back from clear nexus\n"); |
304 | spin_lock_irqsave(&task->task_state_lock, flags); | 305 | spin_lock_irqsave(&task->task_state_lock, flags); |
306 | if (leftover < 1) | ||
307 | res = TMF_RESP_FUNC_FAILED; | ||
305 | if (task->task_state_flags & SAS_TASK_STATE_DONE) | 308 | if (task->task_state_flags & SAS_TASK_STATE_DONE) |
306 | res = TMF_RESP_FUNC_COMPLETE; | 309 | res = TMF_RESP_FUNC_COMPLETE; |
307 | spin_unlock_irqrestore(&task->task_state_lock, flags); | 310 | spin_unlock_irqrestore(&task->task_state_lock, flags); |
@@ -350,6 +353,7 @@ int asd_abort_task(struct sas_task *task) | |||
350 | unsigned long flags; | 353 | unsigned long flags; |
351 | struct asd_ascb *ascb = NULL; | 354 | struct asd_ascb *ascb = NULL; |
352 | struct scb *scb; | 355 | struct scb *scb; |
356 | int leftover; | ||
353 | 357 | ||
354 | spin_lock_irqsave(&task->task_state_lock, flags); | 358 | spin_lock_irqsave(&task->task_state_lock, flags); |
355 | if (task->task_state_flags & SAS_TASK_STATE_DONE) { | 359 | if (task->task_state_flags & SAS_TASK_STATE_DONE) { |
@@ -455,9 +459,11 @@ int asd_abort_task(struct sas_task *task) | |||
455 | break; | 459 | break; |
456 | case TF_TMF_TASK_DONE + 0xFF00: /* done but not reported yet */ | 460 | case TF_TMF_TASK_DONE + 0xFF00: /* done but not reported yet */ |
457 | res = TMF_RESP_FUNC_FAILED; | 461 | res = TMF_RESP_FUNC_FAILED; |
458 | wait_for_completion_timeout(&tascb->completion, | 462 | leftover = wait_for_completion_timeout(&tascb->completion, |
459 | AIC94XX_SCB_TIMEOUT); | 463 | AIC94XX_SCB_TIMEOUT); |
460 | spin_lock_irqsave(&task->task_state_lock, flags); | 464 | spin_lock_irqsave(&task->task_state_lock, flags); |
465 | if (leftover < 1) | ||
466 | res = TMF_RESP_FUNC_FAILED; | ||
461 | if (task->task_state_flags & SAS_TASK_STATE_DONE) | 467 | if (task->task_state_flags & SAS_TASK_STATE_DONE) |
462 | res = TMF_RESP_FUNC_COMPLETE; | 468 | res = TMF_RESP_FUNC_COMPLETE; |
463 | spin_unlock_irqrestore(&task->task_state_lock, flags); | 469 | spin_unlock_irqrestore(&task->task_state_lock, flags); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 4baa79e68679..fa6ff295e568 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -3954,6 +3954,13 @@ static int __ipr_eh_dev_reset(struct scsi_cmnd * scsi_cmd) | |||
3954 | spin_unlock_irq(scsi_cmd->device->host->host_lock); | 3954 | spin_unlock_irq(scsi_cmd->device->host->host_lock); |
3955 | ata_do_eh(ap, NULL, NULL, ipr_sata_reset, NULL); | 3955 | ata_do_eh(ap, NULL, NULL, ipr_sata_reset, NULL); |
3956 | spin_lock_irq(scsi_cmd->device->host->host_lock); | 3956 | spin_lock_irq(scsi_cmd->device->host->host_lock); |
3957 | |||
3958 | list_for_each_entry(ipr_cmd, &ioa_cfg->pending_q, queue) { | ||
3959 | if (ipr_cmd->ioarcb.res_handle == res->cfgte.res_handle) { | ||
3960 | rc = -EIO; | ||
3961 | break; | ||
3962 | } | ||
3963 | } | ||
3957 | } else | 3964 | } else |
3958 | rc = ipr_device_reset(ioa_cfg, res); | 3965 | rc = ipr_device_reset(ioa_cfg, res); |
3959 | res->resetting_device = 0; | 3966 | res->resetting_device = 0; |
diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c index 19dd4b962e18..81e497d9eae0 100644 --- a/drivers/scsi/jazz_esp.c +++ b/drivers/scsi/jazz_esp.c | |||
@@ -1,307 +1,244 @@ | |||
1 | /* | 1 | /* jazz_esp.c: ESP front-end for MIPS JAZZ systems. |
2 | * jazz_esp.c: Driver for SCSI chip on Mips Magnum Boards (JAZZ architecture) | ||
3 | * | 2 | * |
4 | * Copyright (C) 1997 Thomas Bogendoerfer (tsbogend@alpha.franken.de) | 3 | * Copyright (C) 2007 Thomas Bogendörfer (tsbogend@alpha.frankende) |
5 | * | ||
6 | * jazz_esp is based on David S. Miller's ESP driver and cyber_esp | ||
7 | */ | 4 | */ |
8 | 5 | ||
9 | #include <linux/init.h> | ||
10 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
11 | #include <linux/delay.h> | ||
12 | #include <linux/types.h> | 7 | #include <linux/types.h> |
13 | #include <linux/string.h> | 8 | #include <linux/module.h> |
14 | #include <linux/slab.h> | 9 | #include <linux/init.h> |
15 | #include <linux/blkdev.h> | 10 | #include <linux/interrupt.h> |
16 | #include <linux/proc_fs.h> | 11 | #include <linux/platform_device.h> |
17 | #include <linux/stat.h> | 12 | #include <linux/dma-mapping.h> |
18 | |||
19 | #include "scsi.h" | ||
20 | #include <scsi/scsi_host.h> | ||
21 | #include "NCR53C9x.h" | ||
22 | 13 | ||
23 | #include <asm/irq.h> | 14 | #include <asm/irq.h> |
15 | #include <asm/io.h> | ||
16 | #include <asm/dma.h> | ||
17 | |||
24 | #include <asm/jazz.h> | 18 | #include <asm/jazz.h> |
25 | #include <asm/jazzdma.h> | 19 | #include <asm/jazzdma.h> |
26 | #include <asm/dma.h> | ||
27 | 20 | ||
28 | #include <asm/pgtable.h> | 21 | #include <scsi/scsi_host.h> |
29 | |||
30 | static int dma_bytes_sent(struct NCR_ESP *esp, int fifo_count); | ||
31 | static int dma_can_transfer(struct NCR_ESP *esp, struct scsi_cmnd *sp); | ||
32 | static void dma_dump_state(struct NCR_ESP *esp); | ||
33 | static void dma_init_read(struct NCR_ESP *esp, __u32 vaddress, int length); | ||
34 | static void dma_init_write(struct NCR_ESP *esp, __u32 vaddress, int length); | ||
35 | static void dma_ints_off(struct NCR_ESP *esp); | ||
36 | static void dma_ints_on(struct NCR_ESP *esp); | ||
37 | static int dma_irq_p(struct NCR_ESP *esp); | ||
38 | static int dma_ports_p(struct NCR_ESP *esp); | ||
39 | static void dma_setup(struct NCR_ESP *esp, __u32 addr, int count, int write); | ||
40 | static void dma_mmu_get_scsi_one (struct NCR_ESP *esp, struct scsi_cmnd *sp); | ||
41 | static void dma_mmu_get_scsi_sgl (struct NCR_ESP *esp, struct scsi_cmnd *sp); | ||
42 | static void dma_mmu_release_scsi_one (struct NCR_ESP *esp, struct scsi_cmnd *sp); | ||
43 | static void dma_mmu_release_scsi_sgl (struct NCR_ESP *esp, struct scsi_cmnd *sp); | ||
44 | static void dma_advance_sg (struct scsi_cmnd *sp); | ||
45 | static void dma_led_off(struct NCR_ESP *); | ||
46 | static void dma_led_on(struct NCR_ESP *); | ||
47 | |||
48 | |||
49 | static volatile unsigned char cmd_buffer[16]; | ||
50 | /* This is where all commands are put | ||
51 | * before they are trasfered to the ESP chip | ||
52 | * via PIO. | ||
53 | */ | ||
54 | |||
55 | static int jazz_esp_release(struct Scsi_Host *shost) | ||
56 | { | ||
57 | if (shost->irq) | ||
58 | free_irq(shost->irq, NULL); | ||
59 | if (shost->dma_channel != 0xff) | ||
60 | free_dma(shost->dma_channel); | ||
61 | if (shost->io_port && shost->n_io_port) | ||
62 | release_region(shost->io_port, shost->n_io_port); | ||
63 | scsi_unregister(shost); | ||
64 | return 0; | ||
65 | } | ||
66 | 22 | ||
67 | /***************************************************************** Detection */ | 23 | #include "esp_scsi.h" |
68 | static int jazz_esp_detect(struct scsi_host_template *tpnt) | ||
69 | { | ||
70 | struct NCR_ESP *esp; | ||
71 | struct ConfigDev *esp_dev; | ||
72 | |||
73 | /* | ||
74 | * first assumption it is there:-) | ||
75 | */ | ||
76 | if (1) { | ||
77 | esp_dev = NULL; | ||
78 | esp = esp_allocate(tpnt, esp_dev, 0); | ||
79 | |||
80 | /* Do command transfer with programmed I/O */ | ||
81 | esp->do_pio_cmds = 1; | ||
82 | |||
83 | /* Required functions */ | ||
84 | esp->dma_bytes_sent = &dma_bytes_sent; | ||
85 | esp->dma_can_transfer = &dma_can_transfer; | ||
86 | esp->dma_dump_state = &dma_dump_state; | ||
87 | esp->dma_init_read = &dma_init_read; | ||
88 | esp->dma_init_write = &dma_init_write; | ||
89 | esp->dma_ints_off = &dma_ints_off; | ||
90 | esp->dma_ints_on = &dma_ints_on; | ||
91 | esp->dma_irq_p = &dma_irq_p; | ||
92 | esp->dma_ports_p = &dma_ports_p; | ||
93 | esp->dma_setup = &dma_setup; | ||
94 | |||
95 | /* Optional functions */ | ||
96 | esp->dma_barrier = NULL; | ||
97 | esp->dma_drain = NULL; | ||
98 | esp->dma_invalidate = NULL; | ||
99 | esp->dma_irq_entry = NULL; | ||
100 | esp->dma_irq_exit = NULL; | ||
101 | esp->dma_poll = NULL; | ||
102 | esp->dma_reset = NULL; | ||
103 | esp->dma_led_off = &dma_led_off; | ||
104 | esp->dma_led_on = &dma_led_on; | ||
105 | |||
106 | /* virtual DMA functions */ | ||
107 | esp->dma_mmu_get_scsi_one = &dma_mmu_get_scsi_one; | ||
108 | esp->dma_mmu_get_scsi_sgl = &dma_mmu_get_scsi_sgl; | ||
109 | esp->dma_mmu_release_scsi_one = &dma_mmu_release_scsi_one; | ||
110 | esp->dma_mmu_release_scsi_sgl = &dma_mmu_release_scsi_sgl; | ||
111 | esp->dma_advance_sg = &dma_advance_sg; | ||
112 | |||
113 | |||
114 | /* SCSI chip speed */ | ||
115 | esp->cfreq = 40000000; | ||
116 | 24 | ||
117 | /* | 25 | #define DRV_MODULE_NAME "jazz_esp" |
118 | * we don't give the address of DMA channel, but the number | 26 | #define PFX DRV_MODULE_NAME ": " |
119 | * of DMA channel, so we can use the jazz DMA functions | 27 | #define DRV_VERSION "1.000" |
120 | * | 28 | #define DRV_MODULE_RELDATE "May 19, 2007" |
121 | */ | ||
122 | esp->dregs = (void *) JAZZ_SCSI_DMA; | ||
123 | |||
124 | /* ESP register base */ | ||
125 | esp->eregs = (struct ESP_regs *)(JAZZ_SCSI_BASE); | ||
126 | |||
127 | /* Set the command buffer */ | ||
128 | esp->esp_command = (volatile unsigned char *)cmd_buffer; | ||
129 | |||
130 | /* get virtual dma address for command buffer */ | ||
131 | esp->esp_command_dvma = vdma_alloc(CPHYSADDR(cmd_buffer), sizeof (cmd_buffer)); | ||
132 | |||
133 | esp->irq = JAZZ_SCSI_IRQ; | ||
134 | request_irq(JAZZ_SCSI_IRQ, esp_intr, IRQF_DISABLED, "JAZZ SCSI", | ||
135 | esp->ehost); | ||
136 | |||
137 | /* | ||
138 | * FIXME, look if the scsi id is available from NVRAM | ||
139 | */ | ||
140 | esp->scsi_id = 7; | ||
141 | |||
142 | /* Check for differential SCSI-bus */ | ||
143 | /* What is this stuff? */ | ||
144 | esp->diff = 0; | ||
145 | |||
146 | esp_initialize(esp); | ||
147 | |||
148 | printk("ESP: Total of %d ESP hosts found, %d actually in use.\n", nesps,esps_in_use); | ||
149 | esps_running = esps_in_use; | ||
150 | return esps_in_use; | ||
151 | } | ||
152 | return 0; | ||
153 | } | ||
154 | 29 | ||
155 | /************************************************************* DMA Functions */ | 30 | static void jazz_esp_write8(struct esp *esp, u8 val, unsigned long reg) |
156 | static int dma_bytes_sent(struct NCR_ESP *esp, int fifo_count) | ||
157 | { | 31 | { |
158 | return fifo_count; | 32 | *(volatile u8 *)(esp->regs + reg) = val; |
159 | } | 33 | } |
160 | 34 | ||
161 | static int dma_can_transfer(struct NCR_ESP *esp, struct scsi_cmnd *sp) | 35 | static u8 jazz_esp_read8(struct esp *esp, unsigned long reg) |
162 | { | 36 | { |
163 | /* | 37 | return *(volatile u8 *)(esp->regs + reg); |
164 | * maximum DMA size is 1MB | ||
165 | */ | ||
166 | unsigned long sz = sp->SCp.this_residual; | ||
167 | if(sz > 0x100000) | ||
168 | sz = 0x100000; | ||
169 | return sz; | ||
170 | } | 38 | } |
171 | 39 | ||
172 | static void dma_dump_state(struct NCR_ESP *esp) | 40 | static dma_addr_t jazz_esp_map_single(struct esp *esp, void *buf, |
41 | size_t sz, int dir) | ||
173 | { | 42 | { |
174 | 43 | return dma_map_single(esp->dev, buf, sz, dir); | |
175 | ESPLOG(("esp%d: dma -- enable <%08x> residue <%08x\n", | ||
176 | esp->esp_id, vdma_get_enable((int)esp->dregs), vdma_get_residue((int)esp->dregs))); | ||
177 | } | 44 | } |
178 | 45 | ||
179 | static void dma_init_read(struct NCR_ESP *esp, __u32 vaddress, int length) | 46 | static int jazz_esp_map_sg(struct esp *esp, struct scatterlist *sg, |
47 | int num_sg, int dir) | ||
180 | { | 48 | { |
181 | dma_cache_wback_inv ((unsigned long)phys_to_virt(vdma_log2phys(vaddress)), length); | 49 | return dma_map_sg(esp->dev, sg, num_sg, dir); |
182 | vdma_disable ((int)esp->dregs); | ||
183 | vdma_set_mode ((int)esp->dregs, DMA_MODE_READ); | ||
184 | vdma_set_addr ((int)esp->dregs, vaddress); | ||
185 | vdma_set_count ((int)esp->dregs, length); | ||
186 | vdma_enable ((int)esp->dregs); | ||
187 | } | 50 | } |
188 | 51 | ||
189 | static void dma_init_write(struct NCR_ESP *esp, __u32 vaddress, int length) | 52 | static void jazz_esp_unmap_single(struct esp *esp, dma_addr_t addr, |
53 | size_t sz, int dir) | ||
190 | { | 54 | { |
191 | dma_cache_wback_inv ((unsigned long)phys_to_virt(vdma_log2phys(vaddress)), length); | 55 | dma_unmap_single(esp->dev, addr, sz, dir); |
192 | vdma_disable ((int)esp->dregs); | ||
193 | vdma_set_mode ((int)esp->dregs, DMA_MODE_WRITE); | ||
194 | vdma_set_addr ((int)esp->dregs, vaddress); | ||
195 | vdma_set_count ((int)esp->dregs, length); | ||
196 | vdma_enable ((int)esp->dregs); | ||
197 | } | 56 | } |
198 | 57 | ||
199 | static void dma_ints_off(struct NCR_ESP *esp) | 58 | static void jazz_esp_unmap_sg(struct esp *esp, struct scatterlist *sg, |
59 | int num_sg, int dir) | ||
200 | { | 60 | { |
201 | disable_irq(esp->irq); | 61 | dma_unmap_sg(esp->dev, sg, num_sg, dir); |
202 | } | 62 | } |
203 | 63 | ||
204 | static void dma_ints_on(struct NCR_ESP *esp) | 64 | static int jazz_esp_irq_pending(struct esp *esp) |
205 | { | 65 | { |
206 | enable_irq(esp->irq); | 66 | if (jazz_esp_read8(esp, ESP_STATUS) & ESP_STAT_INTR) |
67 | return 1; | ||
68 | return 0; | ||
207 | } | 69 | } |
208 | 70 | ||
209 | static int dma_irq_p(struct NCR_ESP *esp) | 71 | static void jazz_esp_reset_dma(struct esp *esp) |
210 | { | 72 | { |
211 | return (esp_read(esp->eregs->esp_status) & ESP_STAT_INTR); | 73 | vdma_disable ((int)esp->dma_regs); |
212 | } | 74 | } |
213 | 75 | ||
214 | static int dma_ports_p(struct NCR_ESP *esp) | 76 | static void jazz_esp_dma_drain(struct esp *esp) |
215 | { | 77 | { |
216 | int enable = vdma_get_enable((int)esp->dregs); | 78 | /* nothing to do */ |
217 | |||
218 | return (enable & R4030_CHNL_ENABLE); | ||
219 | } | 79 | } |
220 | 80 | ||
221 | static void dma_setup(struct NCR_ESP *esp, __u32 addr, int count, int write) | 81 | static void jazz_esp_dma_invalidate(struct esp *esp) |
222 | { | 82 | { |
223 | /* | 83 | vdma_disable ((int)esp->dma_regs); |
224 | * On the Sparc, DMA_ST_WRITE means "move data from device to memory" | ||
225 | * so when (write) is true, it actually means READ! | ||
226 | */ | ||
227 | if(write){ | ||
228 | dma_init_read(esp, addr, count); | ||
229 | } else { | ||
230 | dma_init_write(esp, addr, count); | ||
231 | } | ||
232 | } | 84 | } |
233 | 85 | ||
234 | static void dma_mmu_get_scsi_one (struct NCR_ESP *esp, struct scsi_cmnd *sp) | 86 | static void jazz_esp_send_dma_cmd(struct esp *esp, u32 addr, u32 esp_count, |
87 | u32 dma_count, int write, u8 cmd) | ||
235 | { | 88 | { |
236 | sp->SCp.have_data_in = vdma_alloc(CPHYSADDR(sp->SCp.buffer), sp->SCp.this_residual); | 89 | BUG_ON(!(cmd & ESP_CMD_DMA)); |
237 | sp->SCp.ptr = (char *)((unsigned long)sp->SCp.have_data_in); | 90 | |
91 | jazz_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW); | ||
92 | jazz_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED); | ||
93 | vdma_disable ((int)esp->dma_regs); | ||
94 | if (write) | ||
95 | vdma_set_mode ((int)esp->dma_regs, DMA_MODE_READ); | ||
96 | else | ||
97 | vdma_set_mode ((int)esp->dma_regs, DMA_MODE_WRITE); | ||
98 | |||
99 | vdma_set_addr ((int)esp->dma_regs, addr); | ||
100 | vdma_set_count ((int)esp->dma_regs, dma_count); | ||
101 | vdma_enable ((int)esp->dma_regs); | ||
102 | |||
103 | scsi_esp_cmd(esp, cmd); | ||
238 | } | 104 | } |
239 | 105 | ||
240 | static void dma_mmu_get_scsi_sgl (struct NCR_ESP *esp, struct scsi_cmnd *sp) | 106 | static int jazz_esp_dma_error(struct esp *esp) |
241 | { | ||
242 | int sz = sp->SCp.buffers_residual; | ||
243 | struct scatterlist *sg = (struct scatterlist *) sp->SCp.buffer; | ||
244 | |||
245 | while (sz >= 0) { | ||
246 | sg[sz].dma_address = vdma_alloc(CPHYSADDR(page_address(sg[sz].page) + sg[sz].offset), sg[sz].length); | ||
247 | sz--; | ||
248 | } | ||
249 | sp->SCp.ptr=(char *)(sp->SCp.buffer->dma_address); | ||
250 | } | ||
251 | |||
252 | static void dma_mmu_release_scsi_one (struct NCR_ESP *esp, struct scsi_cmnd *sp) | ||
253 | { | 107 | { |
254 | vdma_free(sp->SCp.have_data_in); | 108 | u32 enable = vdma_get_enable((int)esp->dma_regs); |
109 | |||
110 | if (enable & (R4030_MEM_INTR|R4030_ADDR_INTR)) | ||
111 | return 1; | ||
112 | |||
113 | return 0; | ||
255 | } | 114 | } |
256 | 115 | ||
257 | static void dma_mmu_release_scsi_sgl (struct NCR_ESP *esp, struct scsi_cmnd *sp) | 116 | static const struct esp_driver_ops jazz_esp_ops = { |
117 | .esp_write8 = jazz_esp_write8, | ||
118 | .esp_read8 = jazz_esp_read8, | ||
119 | .map_single = jazz_esp_map_single, | ||
120 | .map_sg = jazz_esp_map_sg, | ||
121 | .unmap_single = jazz_esp_unmap_single, | ||
122 | .unmap_sg = jazz_esp_unmap_sg, | ||
123 | .irq_pending = jazz_esp_irq_pending, | ||
124 | .reset_dma = jazz_esp_reset_dma, | ||
125 | .dma_drain = jazz_esp_dma_drain, | ||
126 | .dma_invalidate = jazz_esp_dma_invalidate, | ||
127 | .send_dma_cmd = jazz_esp_send_dma_cmd, | ||
128 | .dma_error = jazz_esp_dma_error, | ||
129 | }; | ||
130 | |||
131 | static int __devinit esp_jazz_probe(struct platform_device *dev) | ||
258 | { | 132 | { |
259 | int sz = sp->use_sg - 1; | 133 | struct scsi_host_template *tpnt = &scsi_esp_template; |
260 | struct scatterlist *sg = (struct scatterlist *)sp->request_buffer; | 134 | struct Scsi_Host *host; |
261 | 135 | struct esp *esp; | |
262 | while(sz >= 0) { | 136 | struct resource *res; |
263 | vdma_free(sg[sz].dma_address); | 137 | int err; |
264 | sz--; | 138 | |
265 | } | 139 | host = scsi_host_alloc(tpnt, sizeof(struct esp)); |
140 | |||
141 | err = -ENOMEM; | ||
142 | if (!host) | ||
143 | goto fail; | ||
144 | |||
145 | host->max_id = 8; | ||
146 | esp = host_to_esp(host); | ||
147 | |||
148 | esp->host = host; | ||
149 | esp->dev = dev; | ||
150 | esp->ops = &jazz_esp_ops; | ||
151 | |||
152 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
153 | if (!res) | ||
154 | goto fail_unlink; | ||
155 | |||
156 | esp->regs = (void __iomem *)res->start; | ||
157 | if (!esp->regs) | ||
158 | goto fail_unlink; | ||
159 | |||
160 | res = platform_get_resource(dev, IORESOURCE_MEM, 1); | ||
161 | if (!res) | ||
162 | goto fail_unlink; | ||
163 | |||
164 | esp->dma_regs = (void __iomem *)res->start; | ||
165 | |||
166 | esp->command_block = dma_alloc_coherent(esp->dev, 16, | ||
167 | &esp->command_block_dma, | ||
168 | GFP_KERNEL); | ||
169 | if (!esp->command_block) | ||
170 | goto fail_unmap_regs; | ||
171 | |||
172 | host->irq = platform_get_irq(dev, 0); | ||
173 | err = request_irq(host->irq, scsi_esp_intr, IRQF_SHARED, "ESP", esp); | ||
174 | if (err < 0) | ||
175 | goto fail_unmap_command_block; | ||
176 | |||
177 | esp->scsi_id = 7; | ||
178 | esp->host->this_id = esp->scsi_id; | ||
179 | esp->scsi_id_mask = (1 << esp->scsi_id); | ||
180 | esp->cfreq = 40000000; | ||
181 | |||
182 | dev_set_drvdata(&dev->dev, esp); | ||
183 | |||
184 | err = scsi_esp_register(esp, &dev->dev); | ||
185 | if (err) | ||
186 | goto fail_free_irq; | ||
187 | |||
188 | return 0; | ||
189 | |||
190 | fail_free_irq: | ||
191 | free_irq(host->irq, esp); | ||
192 | fail_unmap_command_block: | ||
193 | dma_free_coherent(esp->dev, 16, | ||
194 | esp->command_block, | ||
195 | esp->command_block_dma); | ||
196 | fail_unmap_regs: | ||
197 | fail_unlink: | ||
198 | scsi_host_put(host); | ||
199 | fail: | ||
200 | return err; | ||
266 | } | 201 | } |
267 | 202 | ||
268 | static void dma_advance_sg (struct scsi_cmnd *sp) | 203 | static int __devexit esp_jazz_remove(struct platform_device *dev) |
269 | { | 204 | { |
270 | sp->SCp.ptr = (char *)(sp->SCp.buffer->dma_address); | 205 | struct esp *esp = dev_get_drvdata(&dev->dev); |
206 | unsigned int irq = esp->host->irq; | ||
207 | |||
208 | scsi_esp_unregister(esp); | ||
209 | |||
210 | free_irq(irq, esp); | ||
211 | dma_free_coherent(esp->dev, 16, | ||
212 | esp->command_block, | ||
213 | esp->command_block_dma); | ||
214 | |||
215 | scsi_host_put(esp->host); | ||
216 | |||
217 | return 0; | ||
271 | } | 218 | } |
272 | 219 | ||
273 | #define JAZZ_HDC_LED 0xe000d100 /* FIXME, find correct address */ | 220 | static struct platform_driver esp_jazz_driver = { |
221 | .probe = esp_jazz_probe, | ||
222 | .remove = __devexit_p(esp_jazz_remove), | ||
223 | .driver = { | ||
224 | .name = "jazz_esp", | ||
225 | }, | ||
226 | }; | ||
274 | 227 | ||
275 | static void dma_led_off(struct NCR_ESP *esp) | 228 | static int __init jazz_esp_init(void) |
276 | { | 229 | { |
277 | #if 0 | 230 | return platform_driver_register(&esp_jazz_driver); |
278 | *(unsigned char *)JAZZ_HDC_LED = 0; | ||
279 | #endif | ||
280 | } | 231 | } |
281 | 232 | ||
282 | static void dma_led_on(struct NCR_ESP *esp) | 233 | static void __exit jazz_esp_exit(void) |
283 | { | 234 | { |
284 | #if 0 | 235 | platform_driver_unregister(&esp_jazz_driver); |
285 | *(unsigned char *)JAZZ_HDC_LED = 1; | ||
286 | #endif | ||
287 | } | 236 | } |
288 | 237 | ||
289 | static struct scsi_host_template driver_template = { | 238 | MODULE_DESCRIPTION("JAZZ ESP SCSI driver"); |
290 | .proc_name = "jazz_esp", | 239 | MODULE_AUTHOR("Thomas Bogendoerfer (tsbogend@alpha.franken.de)"); |
291 | .proc_info = esp_proc_info, | 240 | MODULE_LICENSE("GPL"); |
292 | .name = "ESP 100/100a/200", | 241 | MODULE_VERSION(DRV_VERSION); |
293 | .detect = jazz_esp_detect, | 242 | |
294 | .slave_alloc = esp_slave_alloc, | 243 | module_init(jazz_esp_init); |
295 | .slave_destroy = esp_slave_destroy, | 244 | module_exit(jazz_esp_exit); |
296 | .release = jazz_esp_release, | ||
297 | .info = esp_info, | ||
298 | .queuecommand = esp_queue, | ||
299 | .eh_abort_handler = esp_abort, | ||
300 | .eh_bus_reset_handler = esp_reset, | ||
301 | .can_queue = 7, | ||
302 | .this_id = 7, | ||
303 | .sg_tablesize = SG_ALL, | ||
304 | .cmd_per_lun = 1, | ||
305 | .use_clustering = DISABLE_CLUSTERING, | ||
306 | }; | ||
307 | #include "scsi_module.c" | ||
diff --git a/drivers/scsi/libsrp.c b/drivers/scsi/libsrp.c index 5631c199a8eb..732446e63963 100644 --- a/drivers/scsi/libsrp.c +++ b/drivers/scsi/libsrp.c | |||
@@ -254,6 +254,7 @@ static int srp_indirect_data(struct scsi_cmnd *sc, struct srp_cmd *cmd, | |||
254 | 254 | ||
255 | sg_init_one(&dummy, md, id->table_desc.len); | 255 | sg_init_one(&dummy, md, id->table_desc.len); |
256 | sg_dma_address(&dummy) = token; | 256 | sg_dma_address(&dummy) = token; |
257 | sg_dma_len(&dummy) = id->table_desc.len; | ||
257 | err = rdma_io(sc, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE, | 258 | err = rdma_io(sc, &dummy, 1, &id->table_desc, 1, DMA_TO_DEVICE, |
258 | id->table_desc.len); | 259 | id->table_desc.len); |
259 | if (err) { | 260 | if (err) { |
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index 7a812677ff8a..e2cf12ef3688 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * 2 of the License, or (at your option) any later version. | 10 | * 2 of the License, or (at your option) any later version. |
11 | * | 11 | * |
12 | * FILE : megaraid_sas.c | 12 | * FILE : megaraid_sas.c |
13 | * Version : v00.00.03.10-rc1 | 13 | * Version : v00.00.03.10-rc5 |
14 | * | 14 | * |
15 | * Authors: | 15 | * Authors: |
16 | * (email-id : megaraidlinux@lsi.com) | 16 | * (email-id : megaraidlinux@lsi.com) |
@@ -886,6 +886,7 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) | |||
886 | goto out_return_cmd; | 886 | goto out_return_cmd; |
887 | 887 | ||
888 | cmd->scmd = scmd; | 888 | cmd->scmd = scmd; |
889 | scmd->SCp.ptr = (char *)cmd; | ||
889 | 890 | ||
890 | /* | 891 | /* |
891 | * Issue the command to the FW | 892 | * Issue the command to the FW |
@@ -919,7 +920,7 @@ static int megasas_slave_configure(struct scsi_device *sdev) | |||
919 | * The RAID firmware may require extended timeouts. | 920 | * The RAID firmware may require extended timeouts. |
920 | */ | 921 | */ |
921 | if (sdev->channel >= MEGASAS_MAX_PD_CHANNELS) | 922 | if (sdev->channel >= MEGASAS_MAX_PD_CHANNELS) |
922 | sdev->timeout = 90 * HZ; | 923 | sdev->timeout = MEGASAS_DEFAULT_CMD_TIMEOUT * HZ; |
923 | return 0; | 924 | return 0; |
924 | } | 925 | } |
925 | 926 | ||
@@ -981,8 +982,8 @@ static int megasas_generic_reset(struct scsi_cmnd *scmd) | |||
981 | 982 | ||
982 | instance = (struct megasas_instance *)scmd->device->host->hostdata; | 983 | instance = (struct megasas_instance *)scmd->device->host->hostdata; |
983 | 984 | ||
984 | scmd_printk(KERN_NOTICE, scmd, "megasas: RESET -%ld cmd=%x\n", | 985 | scmd_printk(KERN_NOTICE, scmd, "megasas: RESET -%ld cmd=%x retries=%x\n", |
985 | scmd->serial_number, scmd->cmnd[0]); | 986 | scmd->serial_number, scmd->cmnd[0], scmd->retries); |
986 | 987 | ||
987 | if (instance->hw_crit_error) { | 988 | if (instance->hw_crit_error) { |
988 | printk(KERN_ERR "megasas: cannot recover from previous reset " | 989 | printk(KERN_ERR "megasas: cannot recover from previous reset " |
@@ -1000,6 +1001,39 @@ static int megasas_generic_reset(struct scsi_cmnd *scmd) | |||
1000 | } | 1001 | } |
1001 | 1002 | ||
1002 | /** | 1003 | /** |
1004 | * megasas_reset_timer - quiesce the adapter if required | ||
1005 | * @scmd: scsi cmnd | ||
1006 | * | ||
1007 | * Sets the FW busy flag and reduces the host->can_queue if the | ||
1008 | * cmd has not been completed within the timeout period. | ||
1009 | */ | ||
1010 | static enum | ||
1011 | scsi_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd) | ||
1012 | { | ||
1013 | struct megasas_cmd *cmd = (struct megasas_cmd *)scmd->SCp.ptr; | ||
1014 | struct megasas_instance *instance; | ||
1015 | unsigned long flags; | ||
1016 | |||
1017 | if (time_after(jiffies, scmd->jiffies_at_alloc + | ||
1018 | (MEGASAS_DEFAULT_CMD_TIMEOUT * 2) * HZ)) { | ||
1019 | return EH_NOT_HANDLED; | ||
1020 | } | ||
1021 | |||
1022 | instance = cmd->instance; | ||
1023 | if (!(instance->flag & MEGASAS_FW_BUSY)) { | ||
1024 | /* FW is busy, throttle IO */ | ||
1025 | spin_lock_irqsave(instance->host->host_lock, flags); | ||
1026 | |||
1027 | instance->host->can_queue = 16; | ||
1028 | instance->last_time = jiffies; | ||
1029 | instance->flag |= MEGASAS_FW_BUSY; | ||
1030 | |||
1031 | spin_unlock_irqrestore(instance->host->host_lock, flags); | ||
1032 | } | ||
1033 | return EH_RESET_TIMER; | ||
1034 | } | ||
1035 | |||
1036 | /** | ||
1003 | * megasas_reset_device - Device reset handler entry point | 1037 | * megasas_reset_device - Device reset handler entry point |
1004 | */ | 1038 | */ |
1005 | static int megasas_reset_device(struct scsi_cmnd *scmd) | 1039 | static int megasas_reset_device(struct scsi_cmnd *scmd) |
@@ -1112,6 +1146,7 @@ static struct scsi_host_template megasas_template = { | |||
1112 | .eh_device_reset_handler = megasas_reset_device, | 1146 | .eh_device_reset_handler = megasas_reset_device, |
1113 | .eh_bus_reset_handler = megasas_reset_bus_host, | 1147 | .eh_bus_reset_handler = megasas_reset_bus_host, |
1114 | .eh_host_reset_handler = megasas_reset_bus_host, | 1148 | .eh_host_reset_handler = megasas_reset_bus_host, |
1149 | .eh_timed_out = megasas_reset_timer, | ||
1115 | .bios_param = megasas_bios_param, | 1150 | .bios_param = megasas_bios_param, |
1116 | .use_clustering = ENABLE_CLUSTERING, | 1151 | .use_clustering = ENABLE_CLUSTERING, |
1117 | }; | 1152 | }; |
@@ -1215,9 +1250,8 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, | |||
1215 | int exception = 0; | 1250 | int exception = 0; |
1216 | struct megasas_header *hdr = &cmd->frame->hdr; | 1251 | struct megasas_header *hdr = &cmd->frame->hdr; |
1217 | 1252 | ||
1218 | if (cmd->scmd) { | 1253 | if (cmd->scmd) |
1219 | cmd->scmd->SCp.ptr = (char *)0; | 1254 | cmd->scmd->SCp.ptr = NULL; |
1220 | } | ||
1221 | 1255 | ||
1222 | switch (hdr->cmd) { | 1256 | switch (hdr->cmd) { |
1223 | 1257 | ||
@@ -1806,6 +1840,7 @@ static void megasas_complete_cmd_dpc(unsigned long instance_addr) | |||
1806 | u32 context; | 1840 | u32 context; |
1807 | struct megasas_cmd *cmd; | 1841 | struct megasas_cmd *cmd; |
1808 | struct megasas_instance *instance = (struct megasas_instance *)instance_addr; | 1842 | struct megasas_instance *instance = (struct megasas_instance *)instance_addr; |
1843 | unsigned long flags; | ||
1809 | 1844 | ||
1810 | /* If we have already declared adapter dead, donot complete cmds */ | 1845 | /* If we have already declared adapter dead, donot complete cmds */ |
1811 | if (instance->hw_crit_error) | 1846 | if (instance->hw_crit_error) |
@@ -1828,6 +1863,22 @@ static void megasas_complete_cmd_dpc(unsigned long instance_addr) | |||
1828 | } | 1863 | } |
1829 | 1864 | ||
1830 | *instance->consumer = producer; | 1865 | *instance->consumer = producer; |
1866 | |||
1867 | /* | ||
1868 | * Check if we can restore can_queue | ||
1869 | */ | ||
1870 | if (instance->flag & MEGASAS_FW_BUSY | ||
1871 | && time_after(jiffies, instance->last_time + 5 * HZ) | ||
1872 | && atomic_read(&instance->fw_outstanding) < 17) { | ||
1873 | |||
1874 | spin_lock_irqsave(instance->host->host_lock, flags); | ||
1875 | instance->flag &= ~MEGASAS_FW_BUSY; | ||
1876 | instance->host->can_queue = | ||
1877 | instance->max_fw_cmds - MEGASAS_INT_CMDS; | ||
1878 | |||
1879 | spin_unlock_irqrestore(instance->host->host_lock, flags); | ||
1880 | } | ||
1881 | |||
1831 | } | 1882 | } |
1832 | 1883 | ||
1833 | /** | 1884 | /** |
@@ -2398,6 +2449,8 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
2398 | instance->init_id = MEGASAS_DEFAULT_INIT_ID; | 2449 | instance->init_id = MEGASAS_DEFAULT_INIT_ID; |
2399 | 2450 | ||
2400 | megasas_dbg_lvl = 0; | 2451 | megasas_dbg_lvl = 0; |
2452 | instance->flag = 0; | ||
2453 | instance->last_time = 0; | ||
2401 | 2454 | ||
2402 | /* | 2455 | /* |
2403 | * Initialize MFI Firmware | 2456 | * Initialize MFI Firmware |
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index e862992ee377..4dffc918a414 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h | |||
@@ -18,9 +18,9 @@ | |||
18 | /* | 18 | /* |
19 | * MegaRAID SAS Driver meta data | 19 | * MegaRAID SAS Driver meta data |
20 | */ | 20 | */ |
21 | #define MEGASAS_VERSION "00.00.03.10-rc1" | 21 | #define MEGASAS_VERSION "00.00.03.10-rc5" |
22 | #define MEGASAS_RELDATE "Feb 14, 2007" | 22 | #define MEGASAS_RELDATE "May 17, 2007" |
23 | #define MEGASAS_EXT_VERSION "Wed Feb 14 10:14:25 PST 2007" | 23 | #define MEGASAS_EXT_VERSION "Thu May 17 10:09:32 PDT 2007" |
24 | 24 | ||
25 | /* | 25 | /* |
26 | * Device IDs | 26 | * Device IDs |
@@ -539,6 +539,8 @@ struct megasas_ctrl_info { | |||
539 | 539 | ||
540 | #define MEGASAS_DBG_LVL 1 | 540 | #define MEGASAS_DBG_LVL 1 |
541 | 541 | ||
542 | #define MEGASAS_FW_BUSY 1 | ||
543 | |||
542 | /* | 544 | /* |
543 | * When SCSI mid-layer calls driver's reset routine, driver waits for | 545 | * When SCSI mid-layer calls driver's reset routine, driver waits for |
544 | * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note | 546 | * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note |
@@ -549,8 +551,8 @@ struct megasas_ctrl_info { | |||
549 | #define MEGASAS_RESET_WAIT_TIME 180 | 551 | #define MEGASAS_RESET_WAIT_TIME 180 |
550 | #define MEGASAS_INTERNAL_CMD_WAIT_TIME 180 | 552 | #define MEGASAS_INTERNAL_CMD_WAIT_TIME 180 |
551 | #define MEGASAS_RESET_NOTICE_INTERVAL 5 | 553 | #define MEGASAS_RESET_NOTICE_INTERVAL 5 |
552 | |||
553 | #define MEGASAS_IOCTL_CMD 0 | 554 | #define MEGASAS_IOCTL_CMD 0 |
555 | #define MEGASAS_DEFAULT_CMD_TIMEOUT 90 | ||
554 | 556 | ||
555 | /* | 557 | /* |
556 | * FW reports the maximum of number of commands that it can accept (maximum | 558 | * FW reports the maximum of number of commands that it can accept (maximum |
@@ -1073,7 +1075,6 @@ struct megasas_instance { | |||
1073 | struct megasas_register_set __iomem *reg_set; | 1075 | struct megasas_register_set __iomem *reg_set; |
1074 | 1076 | ||
1075 | s8 init_id; | 1077 | s8 init_id; |
1076 | u8 reserved[3]; | ||
1077 | 1078 | ||
1078 | u16 max_num_sge; | 1079 | u16 max_num_sge; |
1079 | u16 max_fw_cmds; | 1080 | u16 max_fw_cmds; |
@@ -1104,6 +1105,9 @@ struct megasas_instance { | |||
1104 | 1105 | ||
1105 | struct megasas_instance_template *instancet; | 1106 | struct megasas_instance_template *instancet; |
1106 | struct tasklet_struct isr_tasklet; | 1107 | struct tasklet_struct isr_tasklet; |
1108 | |||
1109 | u8 flag; | ||
1110 | unsigned long last_time; | ||
1107 | }; | 1111 | }; |
1108 | 1112 | ||
1109 | #define MEGASAS_IS_LOGICAL(scp) \ | 1113 | #define MEGASAS_IS_LOGICAL(scp) \ |
diff --git a/drivers/scsi/pluto.c b/drivers/scsi/pluto.c index 3b2e1a53e6e2..d953d43fe2e6 100644 --- a/drivers/scsi/pluto.c +++ b/drivers/scsi/pluto.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/completion.h> | ||
7 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
8 | #include <linux/delay.h> | 9 | #include <linux/delay.h> |
9 | #include <linux/types.h> | 10 | #include <linux/types.h> |
@@ -50,16 +51,10 @@ static struct ctrl_inquiry { | |||
50 | } *fcs __initdata; | 51 | } *fcs __initdata; |
51 | static int fcscount __initdata = 0; | 52 | static int fcscount __initdata = 0; |
52 | static atomic_t fcss __initdata = ATOMIC_INIT(0); | 53 | static atomic_t fcss __initdata = ATOMIC_INIT(0); |
53 | DECLARE_MUTEX_LOCKED(fc_sem); | 54 | static DECLARE_COMPLETION(fc_detect_complete); |
54 | 55 | ||
55 | static int pluto_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd); | 56 | static int pluto_encode_addr(Scsi_Cmnd *SCpnt, u16 *addr, fc_channel *fc, fcp_cmnd *fcmd); |
56 | 57 | ||
57 | static void __init pluto_detect_timeout(unsigned long data) | ||
58 | { | ||
59 | PLND(("Timeout\n")) | ||
60 | up(&fc_sem); | ||
61 | } | ||
62 | |||
63 | static void __init pluto_detect_done(Scsi_Cmnd *SCpnt) | 58 | static void __init pluto_detect_done(Scsi_Cmnd *SCpnt) |
64 | { | 59 | { |
65 | /* Do nothing */ | 60 | /* Do nothing */ |
@@ -69,7 +64,7 @@ static void __init pluto_detect_scsi_done(Scsi_Cmnd *SCpnt) | |||
69 | { | 64 | { |
70 | PLND(("Detect done %08lx\n", (long)SCpnt)) | 65 | PLND(("Detect done %08lx\n", (long)SCpnt)) |
71 | if (atomic_dec_and_test (&fcss)) | 66 | if (atomic_dec_and_test (&fcss)) |
72 | up(&fc_sem); | 67 | complete(&fc_detect_complete); |
73 | } | 68 | } |
74 | 69 | ||
75 | int pluto_slave_configure(struct scsi_device *device) | 70 | int pluto_slave_configure(struct scsi_device *device) |
@@ -96,7 +91,6 @@ int __init pluto_detect(struct scsi_host_template *tpnt) | |||
96 | int i, retry, nplutos; | 91 | int i, retry, nplutos; |
97 | fc_channel *fc; | 92 | fc_channel *fc; |
98 | struct scsi_device dev; | 93 | struct scsi_device dev; |
99 | DEFINE_TIMER(fc_timer, pluto_detect_timeout, 0, 0); | ||
100 | 94 | ||
101 | tpnt->proc_name = "pluto"; | 95 | tpnt->proc_name = "pluto"; |
102 | fcscount = 0; | 96 | fcscount = 0; |
@@ -187,15 +181,11 @@ int __init pluto_detect(struct scsi_host_template *tpnt) | |||
187 | } | 181 | } |
188 | } | 182 | } |
189 | 183 | ||
190 | fc_timer.expires = jiffies + 10 * HZ; | 184 | wait_for_completion_timeout(&fc_detect_complete, 10 * HZ); |
191 | add_timer(&fc_timer); | ||
192 | |||
193 | down(&fc_sem); | ||
194 | PLND(("Woken up\n")) | 185 | PLND(("Woken up\n")) |
195 | if (!atomic_read(&fcss)) | 186 | if (!atomic_read(&fcss)) |
196 | break; /* All fc channels have answered us */ | 187 | break; /* All fc channels have answered us */ |
197 | } | 188 | } |
198 | del_timer_sync(&fc_timer); | ||
199 | 189 | ||
200 | PLND(("Finished search\n")) | 190 | PLND(("Finished search\n")) |
201 | for (i = 0, nplutos = 0; i < fcscount; i++) { | 191 | for (i = 0, nplutos = 0; i < fcscount; i++) { |
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c index ce63044b1ec8..18dd5cc4d7c6 100644 --- a/drivers/scsi/scsi_devinfo.c +++ b/drivers/scsi/scsi_devinfo.c | |||
@@ -209,6 +209,7 @@ static struct { | |||
209 | {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, | 209 | {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, |
210 | {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, | 210 | {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, |
211 | {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, | 211 | {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, |
212 | {"Promise", "", NULL, BLIST_SPARSELUN}, | ||
212 | {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN}, | 213 | {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN}, |
213 | {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN}, | 214 | {"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN}, |
214 | {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */ | 215 | {"SEAGATE", "ST34555N", "0930", BLIST_NOTQ}, /* Chokes on tagged INQUIRY */ |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 00e46662296f..3d8c9cb24f91 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -1789,7 +1789,7 @@ static void sd_shutdown(struct device *dev) | |||
1789 | static int sd_suspend(struct device *dev, pm_message_t mesg) | 1789 | static int sd_suspend(struct device *dev, pm_message_t mesg) |
1790 | { | 1790 | { |
1791 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); | 1791 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); |
1792 | int ret; | 1792 | int ret = 0; |
1793 | 1793 | ||
1794 | if (!sdkp) | 1794 | if (!sdkp) |
1795 | return 0; /* this can happen */ | 1795 | return 0; /* this can happen */ |
@@ -1798,30 +1798,34 @@ static int sd_suspend(struct device *dev, pm_message_t mesg) | |||
1798 | sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); | 1798 | sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); |
1799 | ret = sd_sync_cache(sdkp); | 1799 | ret = sd_sync_cache(sdkp); |
1800 | if (ret) | 1800 | if (ret) |
1801 | return ret; | 1801 | goto done; |
1802 | } | 1802 | } |
1803 | 1803 | ||
1804 | if (mesg.event == PM_EVENT_SUSPEND && | 1804 | if (mesg.event == PM_EVENT_SUSPEND && |
1805 | sdkp->device->manage_start_stop) { | 1805 | sdkp->device->manage_start_stop) { |
1806 | sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); | 1806 | sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n"); |
1807 | ret = sd_start_stop_device(sdkp, 0); | 1807 | ret = sd_start_stop_device(sdkp, 0); |
1808 | if (ret) | ||
1809 | return ret; | ||
1810 | } | 1808 | } |
1811 | 1809 | ||
1812 | return 0; | 1810 | done: |
1811 | scsi_disk_put(sdkp); | ||
1812 | return ret; | ||
1813 | } | 1813 | } |
1814 | 1814 | ||
1815 | static int sd_resume(struct device *dev) | 1815 | static int sd_resume(struct device *dev) |
1816 | { | 1816 | { |
1817 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); | 1817 | struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); |
1818 | int ret = 0; | ||
1818 | 1819 | ||
1819 | if (!sdkp->device->manage_start_stop) | 1820 | if (!sdkp->device->manage_start_stop) |
1820 | return 0; | 1821 | goto done; |
1821 | 1822 | ||
1822 | sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); | 1823 | sd_printk(KERN_NOTICE, sdkp, "Starting disk\n"); |
1824 | ret = sd_start_stop_device(sdkp, 1); | ||
1823 | 1825 | ||
1824 | return sd_start_stop_device(sdkp, 1); | 1826 | done: |
1827 | scsi_disk_put(sdkp); | ||
1828 | return ret; | ||
1825 | } | 1829 | } |
1826 | 1830 | ||
1827 | /** | 1831 | /** |
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c index 69be1324b114..9ac83abc4028 100644 --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c | |||
@@ -32,11 +32,12 @@ | |||
32 | #include <scsi/scsi_cmnd.h> | 32 | #include <scsi/scsi_cmnd.h> |
33 | #include <scsi/scsi_host.h> | 33 | #include <scsi/scsi_host.h> |
34 | #include <scsi/scsi_tcq.h> | 34 | #include <scsi/scsi_tcq.h> |
35 | #include <scsi/scsi_dbg.h> | ||
35 | 36 | ||
36 | #define DRV_NAME "stex" | 37 | #define DRV_NAME "stex" |
37 | #define ST_DRIVER_VERSION "3.1.0.1" | 38 | #define ST_DRIVER_VERSION "3.6.0000.1" |
38 | #define ST_VER_MAJOR 3 | 39 | #define ST_VER_MAJOR 3 |
39 | #define ST_VER_MINOR 1 | 40 | #define ST_VER_MINOR 6 |
40 | #define ST_OEM 0 | 41 | #define ST_OEM 0 |
41 | #define ST_BUILD_VER 1 | 42 | #define ST_BUILD_VER 1 |
42 | 43 | ||
@@ -113,10 +114,6 @@ enum { | |||
113 | SG_CF_64B = 0x40, /* 64 bit item */ | 114 | SG_CF_64B = 0x40, /* 64 bit item */ |
114 | SG_CF_HOST = 0x20, /* sg in host memory */ | 115 | SG_CF_HOST = 0x20, /* sg in host memory */ |
115 | 116 | ||
116 | ST_MAX_ARRAY_SUPPORTED = 16, | ||
117 | ST_MAX_TARGET_NUM = (ST_MAX_ARRAY_SUPPORTED+1), | ||
118 | ST_MAX_LUN_PER_TARGET = 16, | ||
119 | |||
120 | st_shasta = 0, | 117 | st_shasta = 0, |
121 | st_vsc = 1, | 118 | st_vsc = 1, |
122 | st_vsc1 = 2, | 119 | st_vsc1 = 2, |
@@ -586,7 +583,7 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | |||
586 | u16 tag; | 583 | u16 tag; |
587 | host = cmd->device->host; | 584 | host = cmd->device->host; |
588 | id = cmd->device->id; | 585 | id = cmd->device->id; |
589 | lun = cmd->device->channel; /* firmware lun issue work around */ | 586 | lun = cmd->device->lun; |
590 | hba = (struct st_hba *) &host->hostdata[0]; | 587 | hba = (struct st_hba *) &host->hostdata[0]; |
591 | 588 | ||
592 | switch (cmd->cmnd[0]) { | 589 | switch (cmd->cmnd[0]) { |
@@ -605,8 +602,26 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | |||
605 | stex_invalid_field(cmd, done); | 602 | stex_invalid_field(cmd, done); |
606 | return 0; | 603 | return 0; |
607 | } | 604 | } |
605 | case REPORT_LUNS: | ||
606 | /* | ||
607 | * The shasta firmware does not report actual luns in the | ||
608 | * target, so fail the command to force sequential lun scan. | ||
609 | * Also, the console device does not support this command. | ||
610 | */ | ||
611 | if (hba->cardtype == st_shasta || id == host->max_id - 1) { | ||
612 | stex_invalid_field(cmd, done); | ||
613 | return 0; | ||
614 | } | ||
615 | break; | ||
616 | case TEST_UNIT_READY: | ||
617 | if (id == host->max_id - 1) { | ||
618 | cmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; | ||
619 | done(cmd); | ||
620 | return 0; | ||
621 | } | ||
622 | break; | ||
608 | case INQUIRY: | 623 | case INQUIRY: |
609 | if (id != ST_MAX_ARRAY_SUPPORTED) | 624 | if (id != host->max_id - 1) |
610 | break; | 625 | break; |
611 | if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) { | 626 | if (lun == 0 && (cmd->cmnd[1] & INQUIRY_EVPD) == 0) { |
612 | stex_direct_copy(cmd, console_inq_page, | 627 | stex_direct_copy(cmd, console_inq_page, |
@@ -624,7 +639,7 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | |||
624 | ver.oem = ST_OEM; | 639 | ver.oem = ST_OEM; |
625 | ver.build = ST_BUILD_VER; | 640 | ver.build = ST_BUILD_VER; |
626 | ver.signature[0] = PASSTHRU_SIGNATURE; | 641 | ver.signature[0] = PASSTHRU_SIGNATURE; |
627 | ver.console_id = ST_MAX_ARRAY_SUPPORTED; | 642 | ver.console_id = host->max_id - 1; |
628 | ver.host_no = hba->host->host_no; | 643 | ver.host_no = hba->host->host_no; |
629 | cmd->result = stex_direct_copy(cmd, &ver, sizeof(ver)) ? | 644 | cmd->result = stex_direct_copy(cmd, &ver, sizeof(ver)) ? |
630 | DID_OK << 16 | COMMAND_COMPLETE << 8 : | 645 | DID_OK << 16 | COMMAND_COMPLETE << 8 : |
@@ -645,13 +660,8 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | |||
645 | 660 | ||
646 | req = stex_alloc_req(hba); | 661 | req = stex_alloc_req(hba); |
647 | 662 | ||
648 | if (hba->cardtype == st_yosemite) { | 663 | req->lun = lun; |
649 | req->lun = lun * (ST_MAX_TARGET_NUM - 1) + id; | 664 | req->target = id; |
650 | req->target = 0; | ||
651 | } else { | ||
652 | req->lun = lun; | ||
653 | req->target = id; | ||
654 | } | ||
655 | 665 | ||
656 | /* cdb */ | 666 | /* cdb */ |
657 | memcpy(req->cdb, cmd->cmnd, STEX_CDB_LENGTH); | 667 | memcpy(req->cdb, cmd->cmnd, STEX_CDB_LENGTH); |
@@ -767,18 +777,6 @@ static void stex_ys_commands(struct st_hba *hba, | |||
767 | ccb->srb_status = SRB_STATUS_SELECTION_TIMEOUT; | 777 | ccb->srb_status = SRB_STATUS_SELECTION_TIMEOUT; |
768 | else | 778 | else |
769 | ccb->srb_status = SRB_STATUS_SUCCESS; | 779 | ccb->srb_status = SRB_STATUS_SUCCESS; |
770 | } else if (ccb->cmd->cmnd[0] == REPORT_LUNS) { | ||
771 | u8 *report_lun_data = (u8 *)hba->copy_buffer; | ||
772 | |||
773 | count = STEX_EXTRA_SIZE; | ||
774 | stex_internal_copy(ccb->cmd, report_lun_data, | ||
775 | &count, ccb->sg_count, ST_FROM_CMD); | ||
776 | if (report_lun_data[2] || report_lun_data[3]) { | ||
777 | report_lun_data[2] = 0x00; | ||
778 | report_lun_data[3] = 0x08; | ||
779 | stex_internal_copy(ccb->cmd, report_lun_data, | ||
780 | &count, ccb->sg_count, ST_TO_CMD); | ||
781 | } | ||
782 | } | 780 | } |
783 | } | 781 | } |
784 | 782 | ||
@@ -995,6 +993,11 @@ static int stex_abort(struct scsi_cmnd *cmd) | |||
995 | u32 data; | 993 | u32 data; |
996 | int result = SUCCESS; | 994 | int result = SUCCESS; |
997 | unsigned long flags; | 995 | unsigned long flags; |
996 | |||
997 | printk(KERN_INFO DRV_NAME | ||
998 | "(%s): aborting command\n", pci_name(hba->pdev)); | ||
999 | scsi_print_command(cmd); | ||
1000 | |||
998 | base = hba->mmio_base; | 1001 | base = hba->mmio_base; |
999 | spin_lock_irqsave(host->host_lock, flags); | 1002 | spin_lock_irqsave(host->host_lock, flags); |
1000 | if (tag < host->can_queue && hba->ccb[tag].cmd == cmd) | 1003 | if (tag < host->can_queue && hba->ccb[tag].cmd == cmd) |
@@ -1051,7 +1054,12 @@ static void stex_hard_reset(struct st_hba *hba) | |||
1051 | pci_read_config_byte(bus->self, PCI_BRIDGE_CONTROL, &pci_bctl); | 1054 | pci_read_config_byte(bus->self, PCI_BRIDGE_CONTROL, &pci_bctl); |
1052 | pci_bctl |= PCI_BRIDGE_CTL_BUS_RESET; | 1055 | pci_bctl |= PCI_BRIDGE_CTL_BUS_RESET; |
1053 | pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); | 1056 | pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); |
1054 | msleep(1); | 1057 | |
1058 | /* | ||
1059 | * 1 ms may be enough for 8-port controllers. But 16-port controllers | ||
1060 | * require more time to finish bus reset. Use 100 ms here for safety | ||
1061 | */ | ||
1062 | msleep(100); | ||
1055 | pci_bctl &= ~PCI_BRIDGE_CTL_BUS_RESET; | 1063 | pci_bctl &= ~PCI_BRIDGE_CTL_BUS_RESET; |
1056 | pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); | 1064 | pci_write_config_byte(bus->self, PCI_BRIDGE_CONTROL, pci_bctl); |
1057 | 1065 | ||
@@ -1075,6 +1083,10 @@ static int stex_reset(struct scsi_cmnd *cmd) | |||
1075 | unsigned long before; | 1083 | unsigned long before; |
1076 | hba = (struct st_hba *) &cmd->device->host->hostdata[0]; | 1084 | hba = (struct st_hba *) &cmd->device->host->hostdata[0]; |
1077 | 1085 | ||
1086 | printk(KERN_INFO DRV_NAME | ||
1087 | "(%s): resetting host\n", pci_name(hba->pdev)); | ||
1088 | scsi_print_command(cmd); | ||
1089 | |||
1078 | hba->mu_status = MU_STATE_RESETTING; | 1090 | hba->mu_status = MU_STATE_RESETTING; |
1079 | 1091 | ||
1080 | if (hba->cardtype == st_shasta) | 1092 | if (hba->cardtype == st_shasta) |
@@ -1194,7 +1206,7 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1194 | goto out_scsi_host_put; | 1206 | goto out_scsi_host_put; |
1195 | } | 1207 | } |
1196 | 1208 | ||
1197 | hba->mmio_base = ioremap(pci_resource_start(pdev, 0), | 1209 | hba->mmio_base = ioremap_nocache(pci_resource_start(pdev, 0), |
1198 | pci_resource_len(pdev, 0)); | 1210 | pci_resource_len(pdev, 0)); |
1199 | if ( !hba->mmio_base) { | 1211 | if ( !hba->mmio_base) { |
1200 | printk(KERN_ERR DRV_NAME "(%s): memory map failed\n", | 1212 | printk(KERN_ERR DRV_NAME "(%s): memory map failed\n", |
@@ -1229,12 +1241,18 @@ stex_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1229 | hba->copy_buffer = hba->dma_mem + MU_BUFFER_SIZE; | 1241 | hba->copy_buffer = hba->dma_mem + MU_BUFFER_SIZE; |
1230 | hba->mu_status = MU_STATE_STARTING; | 1242 | hba->mu_status = MU_STATE_STARTING; |
1231 | 1243 | ||
1232 | /* firmware uses id/lun pair for a logical drive, but lun would be | 1244 | if (hba->cardtype == st_shasta) { |
1233 | always 0 if CONFIG_SCSI_MULTI_LUN not configured, so we use | 1245 | host->max_lun = 8; |
1234 | channel to map lun here */ | 1246 | host->max_id = 16 + 1; |
1235 | host->max_channel = ST_MAX_LUN_PER_TARGET - 1; | 1247 | } else if (hba->cardtype == st_yosemite) { |
1236 | host->max_id = ST_MAX_TARGET_NUM; | 1248 | host->max_lun = 128; |
1237 | host->max_lun = 1; | 1249 | host->max_id = 1 + 1; |
1250 | } else { | ||
1251 | /* st_vsc and st_vsc1 */ | ||
1252 | host->max_lun = 1; | ||
1253 | host->max_id = 128 + 1; | ||
1254 | } | ||
1255 | host->max_channel = 0; | ||
1238 | host->unique_id = host->host_no; | 1256 | host->unique_id = host->host_no; |
1239 | host->max_cmd_len = STEX_CDB_LENGTH; | 1257 | host->max_cmd_len = STEX_CDB_LENGTH; |
1240 | 1258 | ||