aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-02-10 14:45:43 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-02-10 14:45:43 -0500
commit81b7bbd1932a04869d4c8635a75222dfc6089f96 (patch)
tree285ae868a1e3a41fb0dbfe346c28e380949bcb55 /drivers/scsi
parent98051995ab44b993f992946055edc6115351f725 (diff)
parent66efc5a7e3061c3597ac43a8bb1026488d57e66b (diff)
Merge branch 'linus'
Conflicts: drivers/scsi/ipr.c Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/NCR53C9x.c8
-rw-r--r--drivers/scsi/NCR53C9x.h2
-rw-r--r--drivers/scsi/blz1230.c3
-rw-r--r--drivers/scsi/blz2060.c2
-rw-r--r--drivers/scsi/cyberstorm.c2
-rw-r--r--drivers/scsi/cyberstormII.c2
-rw-r--r--drivers/scsi/dec_esp.c355
-rw-r--r--drivers/scsi/fastlane.c2
-rw-r--r--drivers/scsi/iscsi_tcp.c2
-rw-r--r--drivers/scsi/jazz_esp.c2
-rw-r--r--drivers/scsi/libiscsi.c40
-rw-r--r--drivers/scsi/mac_esp.c2
-rw-r--r--drivers/scsi/mca_53c9x.c2
-rw-r--r--drivers/scsi/oktagon_esp.c2
-rw-r--r--drivers/scsi/osst.c8
-rw-r--r--drivers/scsi/osst.h68
-rw-r--r--drivers/scsi/qla4xxx/ql4_def.h1
-rw-r--r--drivers/scsi/qla4xxx/ql4_glbl.h1
-rw-r--r--drivers/scsi/qla4xxx/ql4_init.c18
-rw-r--r--drivers/scsi/qla4xxx/ql4_isr.c4
-rw-r--r--drivers/scsi/qla4xxx/ql4_mbx.c35
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c64
-rw-r--r--drivers/scsi/qla4xxx/ql4_version.h2
-rw-r--r--drivers/scsi/scsi_scan.c6
-rw-r--r--drivers/scsi/sd.c20
-rw-r--r--drivers/scsi/st.c19
-rw-r--r--drivers/scsi/sun3x_esp.c2
27 files changed, 408 insertions, 266 deletions
diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c
index 3c912ee29da0..8b5334c56f0a 100644
--- a/drivers/scsi/NCR53C9x.c
+++ b/drivers/scsi/NCR53C9x.c
@@ -528,12 +528,16 @@ void esp_bootup_reset(struct NCR_ESP *esp, struct ESP_regs *eregs)
528/* Allocate structure and insert basic data such as SCSI chip frequency 528/* Allocate structure and insert basic data such as SCSI chip frequency
529 * data and a pointer to the device 529 * data and a pointer to the device
530 */ 530 */
531struct NCR_ESP* esp_allocate(struct scsi_host_template *tpnt, void *esp_dev) 531struct NCR_ESP* esp_allocate(struct scsi_host_template *tpnt, void *esp_dev,
532 int hotplug)
532{ 533{
533 struct NCR_ESP *esp, *elink; 534 struct NCR_ESP *esp, *elink;
534 struct Scsi_Host *esp_host; 535 struct Scsi_Host *esp_host;
535 536
536 esp_host = scsi_register(tpnt, sizeof(struct NCR_ESP)); 537 if (hotplug)
538 esp_host = scsi_host_alloc(tpnt, sizeof(struct NCR_ESP));
539 else
540 esp_host = scsi_register(tpnt, sizeof(struct NCR_ESP));
537 if(!esp_host) 541 if(!esp_host)
538 panic("Cannot register ESP SCSI host"); 542 panic("Cannot register ESP SCSI host");
539 esp = (struct NCR_ESP *) esp_host->hostdata; 543 esp = (struct NCR_ESP *) esp_host->hostdata;
diff --git a/drivers/scsi/NCR53C9x.h b/drivers/scsi/NCR53C9x.h
index 521e3f842cfd..d85cb73a9f69 100644
--- a/drivers/scsi/NCR53C9x.h
+++ b/drivers/scsi/NCR53C9x.h
@@ -652,7 +652,7 @@ extern int nesps, esps_in_use, esps_running;
652 652
653/* External functions */ 653/* External functions */
654extern void esp_bootup_reset(struct NCR_ESP *esp, struct ESP_regs *eregs); 654extern void esp_bootup_reset(struct NCR_ESP *esp, struct ESP_regs *eregs);
655extern struct NCR_ESP *esp_allocate(struct scsi_host_template *, void *); 655extern struct NCR_ESP *esp_allocate(struct scsi_host_template *, void *, int);
656extern void esp_deallocate(struct NCR_ESP *); 656extern void esp_deallocate(struct NCR_ESP *);
657extern void esp_release(void); 657extern void esp_release(void);
658extern void esp_initialize(struct NCR_ESP *); 658extern void esp_initialize(struct NCR_ESP *);
diff --git a/drivers/scsi/blz1230.c b/drivers/scsi/blz1230.c
index 329a8f297b31..23f7c24ab809 100644
--- a/drivers/scsi/blz1230.c
+++ b/drivers/scsi/blz1230.c
@@ -121,7 +121,8 @@ int __init blz1230_esp_detect(struct scsi_host_template *tpnt)
121 */ 121 */
122 address = ZTWO_VADDR(board); 122 address = ZTWO_VADDR(board);
123 eregs = (struct ESP_regs *)(address + REAL_BLZ1230_ESP_ADDR); 123 eregs = (struct ESP_regs *)(address + REAL_BLZ1230_ESP_ADDR);
124 esp = esp_allocate(tpnt, (void *)board+REAL_BLZ1230_ESP_ADDR); 124 esp = esp_allocate(tpnt, (void *)board + REAL_BLZ1230_ESP_ADDR,
125 0);
125 126
126 esp_write(eregs->esp_cfg1, (ESP_CONFIG1_PENABLE | 7)); 127 esp_write(eregs->esp_cfg1, (ESP_CONFIG1_PENABLE | 7));
127 udelay(5); 128 udelay(5);
diff --git a/drivers/scsi/blz2060.c b/drivers/scsi/blz2060.c
index b6c137b97350..b6203ec00961 100644
--- a/drivers/scsi/blz2060.c
+++ b/drivers/scsi/blz2060.c
@@ -100,7 +100,7 @@ int __init blz2060_esp_detect(struct scsi_host_template *tpnt)
100 unsigned long board = z->resource.start; 100 unsigned long board = z->resource.start;
101 if (request_mem_region(board+BLZ2060_ESP_ADDR, 101 if (request_mem_region(board+BLZ2060_ESP_ADDR,
102 sizeof(struct ESP_regs), "NCR53C9x")) { 102 sizeof(struct ESP_regs), "NCR53C9x")) {
103 esp = esp_allocate(tpnt, (void *)board+BLZ2060_ESP_ADDR); 103 esp = esp_allocate(tpnt, (void *)board + BLZ2060_ESP_ADDR, 0);
104 104
105 /* Do command transfer with programmed I/O */ 105 /* Do command transfer with programmed I/O */
106 esp->do_pio_cmds = 1; 106 esp->do_pio_cmds = 1;
diff --git a/drivers/scsi/cyberstorm.c b/drivers/scsi/cyberstorm.c
index 7c7cfb54e897..c6b98a42e89d 100644
--- a/drivers/scsi/cyberstorm.c
+++ b/drivers/scsi/cyberstorm.c
@@ -126,7 +126,7 @@ int __init cyber_esp_detect(struct scsi_host_template *tpnt)
126 sizeof(struct ESP_regs)); 126 sizeof(struct ESP_regs));
127 return 0; 127 return 0;
128 } 128 }
129 esp = esp_allocate(tpnt, (void *)board+CYBER_ESP_ADDR); 129 esp = esp_allocate(tpnt, (void *)board + CYBER_ESP_ADDR, 0);
130 130
131 /* Do command transfer with programmed I/O */ 131 /* Do command transfer with programmed I/O */
132 esp->do_pio_cmds = 1; 132 esp->do_pio_cmds = 1;
diff --git a/drivers/scsi/cyberstormII.c b/drivers/scsi/cyberstormII.c
index d88cb9cf091e..e336e853e66f 100644
--- a/drivers/scsi/cyberstormII.c
+++ b/drivers/scsi/cyberstormII.c
@@ -98,7 +98,7 @@ int __init cyberII_esp_detect(struct scsi_host_template *tpnt)
98 address = (unsigned long)ZTWO_VADDR(board); 98 address = (unsigned long)ZTWO_VADDR(board);
99 eregs = (struct ESP_regs *)(address + CYBERII_ESP_ADDR); 99 eregs = (struct ESP_regs *)(address + CYBERII_ESP_ADDR);
100 100
101 esp = esp_allocate(tpnt, (void *)board+CYBERII_ESP_ADDR); 101 esp = esp_allocate(tpnt, (void *)board + CYBERII_ESP_ADDR, 0);
102 102
103 esp_write(eregs->esp_cfg1, (ESP_CONFIG1_PENABLE | 7)); 103 esp_write(eregs->esp_cfg1, (ESP_CONFIG1_PENABLE | 7));
104 udelay(5); 104 udelay(5);
diff --git a/drivers/scsi/dec_esp.c b/drivers/scsi/dec_esp.c
index c29ccbc44693..d42ad663ffee 100644
--- a/drivers/scsi/dec_esp.c
+++ b/drivers/scsi/dec_esp.c
@@ -18,7 +18,7 @@
18 * 20001005 - Initialization fixes for 2.4.0-test9 18 * 20001005 - Initialization fixes for 2.4.0-test9
19 * Florian Lohoff <flo@rfc822.org> 19 * Florian Lohoff <flo@rfc822.org>
20 * 20 *
21 * Copyright (C) 2002, 2003, 2005 Maciej W. Rozycki 21 * Copyright (C) 2002, 2003, 2005, 2006 Maciej W. Rozycki
22 */ 22 */
23 23
24#include <linux/kernel.h> 24#include <linux/kernel.h>
@@ -30,6 +30,7 @@
30#include <linux/proc_fs.h> 30#include <linux/proc_fs.h>
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
32#include <linux/stat.h> 32#include <linux/stat.h>
33#include <linux/tc.h>
33 34
34#include <asm/dma.h> 35#include <asm/dma.h>
35#include <asm/irq.h> 36#include <asm/irq.h>
@@ -42,7 +43,6 @@
42#include <asm/dec/ioasic_ints.h> 43#include <asm/dec/ioasic_ints.h>
43#include <asm/dec/machtype.h> 44#include <asm/dec/machtype.h>
44#include <asm/dec/system.h> 45#include <asm/dec/system.h>
45#include <asm/dec/tc.h>
46 46
47#define DEC_SCSI_SREG 0 47#define DEC_SCSI_SREG 0
48#define DEC_SCSI_DMAREG 0x40000 48#define DEC_SCSI_DMAREG 0x40000
@@ -98,51 +98,33 @@ static irqreturn_t scsi_dma_merr_int(int, void *);
98static irqreturn_t scsi_dma_err_int(int, void *); 98static irqreturn_t scsi_dma_err_int(int, void *);
99static irqreturn_t scsi_dma_int(int, void *); 99static irqreturn_t scsi_dma_int(int, void *);
100 100
101static int dec_esp_detect(struct scsi_host_template * tpnt); 101static struct scsi_host_template dec_esp_template = {
102 102 .module = THIS_MODULE,
103static int dec_esp_release(struct Scsi_Host *shost)
104{
105 if (shost->irq)
106 free_irq(shost->irq, NULL);
107 if (shost->io_port && shost->n_io_port)
108 release_region(shost->io_port, shost->n_io_port);
109 scsi_unregister(shost);
110 return 0;
111}
112
113static struct scsi_host_template driver_template = {
114 .proc_name = "dec_esp",
115 .proc_info = esp_proc_info,
116 .name = "NCR53C94", 103 .name = "NCR53C94",
117 .detect = dec_esp_detect,
118 .slave_alloc = esp_slave_alloc,
119 .slave_destroy = esp_slave_destroy,
120 .release = dec_esp_release,
121 .info = esp_info, 104 .info = esp_info,
122 .queuecommand = esp_queue, 105 .queuecommand = esp_queue,
123 .eh_abort_handler = esp_abort, 106 .eh_abort_handler = esp_abort,
124 .eh_bus_reset_handler = esp_reset, 107 .eh_bus_reset_handler = esp_reset,
108 .slave_alloc = esp_slave_alloc,
109 .slave_destroy = esp_slave_destroy,
110 .proc_info = esp_proc_info,
111 .proc_name = "dec_esp",
125 .can_queue = 7, 112 .can_queue = 7,
126 .this_id = 7,
127 .sg_tablesize = SG_ALL, 113 .sg_tablesize = SG_ALL,
128 .cmd_per_lun = 1, 114 .cmd_per_lun = 1,
129 .use_clustering = DISABLE_CLUSTERING, 115 .use_clustering = DISABLE_CLUSTERING,
130}; 116};
131 117
132 118static struct NCR_ESP *dec_esp_platform;
133#include "scsi_module.c"
134 119
135/***************************************************************** Detection */ 120/***************************************************************** Detection */
136static int dec_esp_detect(struct scsi_host_template * tpnt) 121static int dec_esp_platform_probe(void)
137{ 122{
138 struct NCR_ESP *esp; 123 struct NCR_ESP *esp;
139 struct ConfigDev *esp_dev; 124 int err = 0;
140 int slot;
141 unsigned long mem_start;
142 125
143 if (IOASIC) { 126 if (IOASIC) {
144 esp_dev = 0; 127 esp = esp_allocate(&dec_esp_template, NULL, 1);
145 esp = esp_allocate(tpnt, (void *) esp_dev);
146 128
147 /* Do command transfer with programmed I/O */ 129 /* Do command transfer with programmed I/O */
148 esp->do_pio_cmds = 1; 130 esp->do_pio_cmds = 1;
@@ -200,112 +182,175 @@ static int dec_esp_detect(struct scsi_host_template * tpnt)
200 /* Check for differential SCSI-bus */ 182 /* Check for differential SCSI-bus */
201 esp->diff = 0; 183 esp->diff = 0;
202 184
185 err = request_irq(esp->irq, esp_intr, IRQF_DISABLED,
186 "ncr53c94", esp->ehost);
187 if (err)
188 goto err_alloc;
189 err = request_irq(dec_interrupt[DEC_IRQ_ASC_MERR],
190 scsi_dma_merr_int, IRQF_DISABLED,
191 "ncr53c94 error", esp->ehost);
192 if (err)
193 goto err_irq;
194 err = request_irq(dec_interrupt[DEC_IRQ_ASC_ERR],
195 scsi_dma_err_int, IRQF_DISABLED,
196 "ncr53c94 overrun", esp->ehost);
197 if (err)
198 goto err_irq_merr;
199 err = request_irq(dec_interrupt[DEC_IRQ_ASC_DMA], scsi_dma_int,
200 IRQF_DISABLED, "ncr53c94 dma", esp->ehost);
201 if (err)
202 goto err_irq_err;
203
203 esp_initialize(esp); 204 esp_initialize(esp);
204 205
205 if (request_irq(esp->irq, esp_intr, IRQF_DISABLED, 206 err = scsi_add_host(esp->ehost, NULL);
206 "ncr53c94", esp->ehost)) 207 if (err) {
207 goto err_dealloc; 208 printk(KERN_ERR "ESP: Unable to register adapter\n");
208 if (request_irq(dec_interrupt[DEC_IRQ_ASC_MERR], 209 goto err_irq_dma;
209 scsi_dma_merr_int, IRQF_DISABLED, 210 }
210 "ncr53c94 error", esp->ehost)) 211
211 goto err_free_irq; 212 scsi_scan_host(esp->ehost);
212 if (request_irq(dec_interrupt[DEC_IRQ_ASC_ERR],
213 scsi_dma_err_int, IRQF_DISABLED,
214 "ncr53c94 overrun", esp->ehost))
215 goto err_free_irq_merr;
216 if (request_irq(dec_interrupt[DEC_IRQ_ASC_DMA],
217 scsi_dma_int, IRQF_DISABLED,
218 "ncr53c94 dma", esp->ehost))
219 goto err_free_irq_err;
220 213
214 dec_esp_platform = esp;
221 } 215 }
222 216
223 if (TURBOCHANNEL) { 217 return 0;
224 while ((slot = search_tc_card("PMAZ-AA")) >= 0) { 218
225 claim_tc_card(slot); 219err_irq_dma:
226 220 free_irq(dec_interrupt[DEC_IRQ_ASC_DMA], esp->ehost);
227 esp_dev = 0; 221err_irq_err:
228 esp = esp_allocate(tpnt, (void *) esp_dev); 222 free_irq(dec_interrupt[DEC_IRQ_ASC_ERR], esp->ehost);
229 223err_irq_merr:
230 mem_start = get_tc_base_addr(slot); 224 free_irq(dec_interrupt[DEC_IRQ_ASC_MERR], esp->ehost);
231 225err_irq:
232 /* Store base addr into esp struct */ 226 free_irq(esp->irq, esp->ehost);
233 esp->slot = CPHYSADDR(mem_start); 227err_alloc:
234 228 esp_deallocate(esp);
235 esp->dregs = 0; 229 scsi_host_put(esp->ehost);
236 esp->eregs = (void *)CKSEG1ADDR(mem_start + 230 return err;
237 DEC_SCSI_SREG); 231}
238 esp->do_pio_cmds = 1; 232
239 233static int __init dec_esp_probe(struct device *dev)
240 /* Set the command buffer */ 234{
241 esp->esp_command = (volatile unsigned char *) pmaz_cmd_buffer; 235 struct NCR_ESP *esp;
242 236 resource_size_t start, len;
243 /* get virtual dma address for command buffer */ 237 int err;
244 esp->esp_command_dvma = virt_to_phys(pmaz_cmd_buffer); 238
245 239 esp = esp_allocate(&dec_esp_template, NULL, 1);
246 esp->cfreq = get_tc_speed(); 240
247 241 dev_set_drvdata(dev, esp);
248 esp->irq = get_tc_irq_nr(slot); 242
249 243 start = to_tc_dev(dev)->resource.start;
250 /* Required functions */ 244 len = to_tc_dev(dev)->resource.end - start + 1;
251 esp->dma_bytes_sent = &dma_bytes_sent; 245
252 esp->dma_can_transfer = &dma_can_transfer; 246 if (!request_mem_region(start, len, dev->bus_id)) {
253 esp->dma_dump_state = &dma_dump_state; 247 printk(KERN_ERR "%s: Unable to reserve MMIO resource\n",
254 esp->dma_init_read = &pmaz_dma_init_read; 248 dev->bus_id);
255 esp->dma_init_write = &pmaz_dma_init_write; 249 err = -EBUSY;
256 esp->dma_ints_off = &pmaz_dma_ints_off; 250 goto err_alloc;
257 esp->dma_ints_on = &pmaz_dma_ints_on;
258 esp->dma_irq_p = &dma_irq_p;
259 esp->dma_ports_p = &dma_ports_p;
260 esp->dma_setup = &pmaz_dma_setup;
261
262 /* Optional functions */
263 esp->dma_barrier = 0;
264 esp->dma_drain = &pmaz_dma_drain;
265 esp->dma_invalidate = 0;
266 esp->dma_irq_entry = 0;
267 esp->dma_irq_exit = 0;
268 esp->dma_poll = 0;
269 esp->dma_reset = 0;
270 esp->dma_led_off = 0;
271 esp->dma_led_on = 0;
272
273 esp->dma_mmu_get_scsi_one = pmaz_dma_mmu_get_scsi_one;
274 esp->dma_mmu_get_scsi_sgl = 0;
275 esp->dma_mmu_release_scsi_one = 0;
276 esp->dma_mmu_release_scsi_sgl = 0;
277 esp->dma_advance_sg = 0;
278
279 if (request_irq(esp->irq, esp_intr, IRQF_DISABLED,
280 "PMAZ_AA", esp->ehost)) {
281 esp_deallocate(esp);
282 release_tc_card(slot);
283 continue;
284 }
285 esp->scsi_id = 7;
286 esp->diff = 0;
287 esp_initialize(esp);
288 }
289 } 251 }
290 252
291 if(nesps) { 253 /* Store base addr into esp struct. */
292 printk("ESP: Total of %d ESP hosts found, %d actually in use.\n", nesps, esps_in_use); 254 esp->slot = start;
293 esps_running = esps_in_use; 255
294 return esps_in_use; 256 esp->dregs = 0;
257 esp->eregs = (void *)CKSEG1ADDR(start + DEC_SCSI_SREG);
258 esp->do_pio_cmds = 1;
259
260 /* Set the command buffer. */
261 esp->esp_command = (volatile unsigned char *)pmaz_cmd_buffer;
262
263 /* Get virtual dma address for command buffer. */
264 esp->esp_command_dvma = virt_to_phys(pmaz_cmd_buffer);
265
266 esp->cfreq = tc_get_speed(to_tc_dev(dev)->bus);
267
268 esp->irq = to_tc_dev(dev)->interrupt;
269
270 /* Required functions. */
271 esp->dma_bytes_sent = &dma_bytes_sent;
272 esp->dma_can_transfer = &dma_can_transfer;
273 esp->dma_dump_state = &dma_dump_state;
274 esp->dma_init_read = &pmaz_dma_init_read;
275 esp->dma_init_write = &pmaz_dma_init_write;
276 esp->dma_ints_off = &pmaz_dma_ints_off;
277 esp->dma_ints_on = &pmaz_dma_ints_on;
278 esp->dma_irq_p = &dma_irq_p;
279 esp->dma_ports_p = &dma_ports_p;
280 esp->dma_setup = &pmaz_dma_setup;
281
282 /* Optional functions. */
283 esp->dma_barrier = 0;
284 esp->dma_drain = &pmaz_dma_drain;
285 esp->dma_invalidate = 0;
286 esp->dma_irq_entry = 0;
287 esp->dma_irq_exit = 0;
288 esp->dma_poll = 0;
289 esp->dma_reset = 0;
290 esp->dma_led_off = 0;
291 esp->dma_led_on = 0;
292
293 esp->dma_mmu_get_scsi_one = pmaz_dma_mmu_get_scsi_one;
294 esp->dma_mmu_get_scsi_sgl = 0;
295 esp->dma_mmu_release_scsi_one = 0;
296 esp->dma_mmu_release_scsi_sgl = 0;
297 esp->dma_advance_sg = 0;
298
299 err = request_irq(esp->irq, esp_intr, IRQF_DISABLED, "PMAZ_AA",
300 esp->ehost);
301 if (err) {
302 printk(KERN_ERR "%s: Unable to get IRQ %d\n",
303 dev->bus_id, esp->irq);
304 goto err_resource;
305 }
306
307 esp->scsi_id = 7;
308 esp->diff = 0;
309 esp_initialize(esp);
310
311 err = scsi_add_host(esp->ehost, dev);
312 if (err) {
313 printk(KERN_ERR "%s: Unable to register adapter\n",
314 dev->bus_id);
315 goto err_irq;
295 } 316 }
317
318 scsi_scan_host(esp->ehost);
319
296 return 0; 320 return 0;
297 321
298err_free_irq_err: 322err_irq:
299 free_irq(dec_interrupt[DEC_IRQ_ASC_ERR], scsi_dma_err_int); 323 free_irq(esp->irq, esp->ehost);
300err_free_irq_merr: 324
301 free_irq(dec_interrupt[DEC_IRQ_ASC_MERR], scsi_dma_merr_int); 325err_resource:
302err_free_irq: 326 release_mem_region(start, len);
303 free_irq(esp->irq, esp_intr); 327
304err_dealloc: 328err_alloc:
305 esp_deallocate(esp); 329 esp_deallocate(esp);
306 return 0; 330 scsi_host_put(esp->ehost);
331 return err;
332}
333
334static void __exit dec_esp_platform_remove(void)
335{
336 struct NCR_ESP *esp = dec_esp_platform;
337
338 free_irq(esp->irq, esp->ehost);
339 esp_deallocate(esp);
340 scsi_host_put(esp->ehost);
341 dec_esp_platform = NULL;
307} 342}
308 343
344static void __exit dec_esp_remove(struct device *dev)
345{
346 struct NCR_ESP *esp = dev_get_drvdata(dev);
347
348 free_irq(esp->irq, esp->ehost);
349 esp_deallocate(esp);
350 scsi_host_put(esp->ehost);
351}
352
353
309/************************************************************* DMA Functions */ 354/************************************************************* DMA Functions */
310static irqreturn_t scsi_dma_merr_int(int irq, void *dev_id) 355static irqreturn_t scsi_dma_merr_int(int irq, void *dev_id)
311{ 356{
@@ -576,3 +621,67 @@ static void pmaz_dma_mmu_get_scsi_one(struct NCR_ESP *esp, struct scsi_cmnd * sp
576{ 621{
577 sp->SCp.ptr = (char *)virt_to_phys(sp->request_buffer); 622 sp->SCp.ptr = (char *)virt_to_phys(sp->request_buffer);
578} 623}
624
625
626#ifdef CONFIG_TC
627static int __init dec_esp_tc_probe(struct device *dev);
628static int __exit dec_esp_tc_remove(struct device *dev);
629
630static const struct tc_device_id dec_esp_tc_table[] = {
631 { "DEC ", "PMAZ-AA " },
632 { }
633};
634MODULE_DEVICE_TABLE(tc, dec_esp_tc_table);
635
636static struct tc_driver dec_esp_tc_driver = {
637 .id_table = dec_esp_tc_table,
638 .driver = {
639 .name = "dec_esp",
640 .bus = &tc_bus_type,
641 .probe = dec_esp_tc_probe,
642 .remove = __exit_p(dec_esp_tc_remove),
643 },
644};
645
646static int __init dec_esp_tc_probe(struct device *dev)
647{
648 int status = dec_esp_probe(dev);
649 if (!status)
650 get_device(dev);
651 return status;
652}
653
654static int __exit dec_esp_tc_remove(struct device *dev)
655{
656 put_device(dev);
657 dec_esp_remove(dev);
658 return 0;
659}
660#endif
661
662static int __init dec_esp_init(void)
663{
664 int status;
665
666 status = tc_register_driver(&dec_esp_tc_driver);
667 if (!status)
668 dec_esp_platform_probe();
669
670 if (nesps) {
671 pr_info("ESP: Total of %d ESP hosts found, "
672 "%d actually in use.\n", nesps, esps_in_use);
673 esps_running = esps_in_use;
674 }
675
676 return status;
677}
678
679static void __exit dec_esp_exit(void)
680{
681 dec_esp_platform_remove();
682 tc_unregister_driver(&dec_esp_tc_driver);
683}
684
685
686module_init(dec_esp_init);
687module_exit(dec_esp_exit);
diff --git a/drivers/scsi/fastlane.c b/drivers/scsi/fastlane.c
index 2a1c5c22b9e0..4266a2139b5f 100644
--- a/drivers/scsi/fastlane.c
+++ b/drivers/scsi/fastlane.c
@@ -142,7 +142,7 @@ int __init fastlane_esp_detect(struct scsi_host_template *tpnt)
142 if (board < 0x1000000) { 142 if (board < 0x1000000) {
143 goto err_release; 143 goto err_release;
144 } 144 }
145 esp = esp_allocate(tpnt, (void *)board+FASTLANE_ESP_ADDR); 145 esp = esp_allocate(tpnt, (void *)board + FASTLANE_ESP_ADDR, 0);
146 146
147 /* Do command transfer with programmed I/O */ 147 /* Do command transfer with programmed I/O */
148 esp->do_pio_cmds = 1; 148 esp->do_pio_cmds = 1;
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 437684084377..8f55e1431433 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -1375,7 +1375,7 @@ iscsi_tcp_mtask_xmit(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask)
1375 } 1375 }
1376 1376
1377 BUG_ON(tcp_mtask->xmstate != XMSTATE_IDLE); 1377 BUG_ON(tcp_mtask->xmstate != XMSTATE_IDLE);
1378 if (mtask->hdr->itt == cpu_to_be32(ISCSI_RESERVED_TAG)) { 1378 if (mtask->hdr->itt == RESERVED_ITT) {
1379 struct iscsi_session *session = conn->session; 1379 struct iscsi_session *session = conn->session;
1380 1380
1381 spin_lock_bh(&session->lock); 1381 spin_lock_bh(&session->lock);
diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c
index bfac4441d89f..19dd4b962e18 100644
--- a/drivers/scsi/jazz_esp.c
+++ b/drivers/scsi/jazz_esp.c
@@ -75,7 +75,7 @@ static int jazz_esp_detect(struct scsi_host_template *tpnt)
75 */ 75 */
76 if (1) { 76 if (1) {
77 esp_dev = NULL; 77 esp_dev = NULL;
78 esp = esp_allocate(tpnt, (void *) esp_dev); 78 esp = esp_allocate(tpnt, esp_dev, 0);
79 79
80 /* Do command transfer with programmed I/O */ 80 /* Do command transfer with programmed I/O */
81 esp->do_pio_cmds = 1; 81 esp->do_pio_cmds = 1;
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index d37048c96eab..7c75771c77ff 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -113,8 +113,7 @@ static void iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask)
113 hdr->opcode = ISCSI_OP_SCSI_CMD; 113 hdr->opcode = ISCSI_OP_SCSI_CMD;
114 hdr->flags = ISCSI_ATTR_SIMPLE; 114 hdr->flags = ISCSI_ATTR_SIMPLE;
115 int_to_scsilun(sc->device->lun, (struct scsi_lun *)hdr->lun); 115 int_to_scsilun(sc->device->lun, (struct scsi_lun *)hdr->lun);
116 hdr->itt = ctask->itt | (conn->id << ISCSI_CID_SHIFT) | 116 hdr->itt = build_itt(ctask->itt, conn->id, session->age);
117 (session->age << ISCSI_AGE_SHIFT);
118 hdr->data_length = cpu_to_be32(sc->request_bufflen); 117 hdr->data_length = cpu_to_be32(sc->request_bufflen);
119 hdr->cmdsn = cpu_to_be32(session->cmdsn); 118 hdr->cmdsn = cpu_to_be32(session->cmdsn);
120 session->cmdsn++; 119 session->cmdsn++;
@@ -270,7 +269,7 @@ invalid_datalen:
270 goto out; 269 goto out;
271 } 270 }
272 271
273 senselen = be16_to_cpu(*(uint16_t *)data); 272 senselen = be16_to_cpu(*(__be16 *)data);
274 if (datalen < senselen) 273 if (datalen < senselen)
275 goto invalid_datalen; 274 goto invalid_datalen;
276 275
@@ -338,7 +337,7 @@ static int iscsi_handle_reject(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
338 337
339 if (ntoh24(reject->dlength) >= sizeof(struct iscsi_hdr)) { 338 if (ntoh24(reject->dlength) >= sizeof(struct iscsi_hdr)) {
340 memcpy(&rejected_pdu, data, sizeof(struct iscsi_hdr)); 339 memcpy(&rejected_pdu, data, sizeof(struct iscsi_hdr));
341 itt = rejected_pdu.itt & ISCSI_ITT_MASK; 340 itt = get_itt(rejected_pdu.itt);
342 printk(KERN_ERR "itt 0x%x had pdu (op 0x%x) rejected " 341 printk(KERN_ERR "itt 0x%x had pdu (op 0x%x) rejected "
343 "due to DataDigest error.\n", itt, 342 "due to DataDigest error.\n", itt,
344 rejected_pdu.opcode); 343 rejected_pdu.opcode);
@@ -367,10 +366,10 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
367 struct iscsi_mgmt_task *mtask; 366 struct iscsi_mgmt_task *mtask;
368 uint32_t itt; 367 uint32_t itt;
369 368
370 if (hdr->itt != cpu_to_be32(ISCSI_RESERVED_TAG)) 369 if (hdr->itt != RESERVED_ITT)
371 itt = hdr->itt & ISCSI_ITT_MASK; 370 itt = get_itt(hdr->itt);
372 else 371 else
373 itt = hdr->itt; 372 itt = ~0U;
374 373
375 if (itt < session->cmds_max) { 374 if (itt < session->cmds_max) {
376 ctask = session->cmds[itt]; 375 ctask = session->cmds[itt];
@@ -440,7 +439,7 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
440 iscsi_tmf_rsp(conn, hdr); 439 iscsi_tmf_rsp(conn, hdr);
441 break; 440 break;
442 case ISCSI_OP_NOOP_IN: 441 case ISCSI_OP_NOOP_IN:
443 if (hdr->ttt != ISCSI_RESERVED_TAG || datalen) { 442 if (hdr->ttt != cpu_to_be32(ISCSI_RESERVED_TAG) || datalen) {
444 rc = ISCSI_ERR_PROTO; 443 rc = ISCSI_ERR_PROTO;
445 break; 444 break;
446 } 445 }
@@ -457,7 +456,7 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
457 rc = ISCSI_ERR_BAD_OPCODE; 456 rc = ISCSI_ERR_BAD_OPCODE;
458 break; 457 break;
459 } 458 }
460 } else if (itt == ISCSI_RESERVED_TAG) { 459 } else if (itt == ~0U) {
461 rc = iscsi_check_assign_cmdsn(session, 460 rc = iscsi_check_assign_cmdsn(session,
462 (struct iscsi_nopin*)hdr); 461 (struct iscsi_nopin*)hdr);
463 if (rc) 462 if (rc)
@@ -470,7 +469,7 @@ int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
470 break; 469 break;
471 } 470 }
472 471
473 if (hdr->ttt == ISCSI_RESERVED_TAG) 472 if (hdr->ttt == cpu_to_be32(ISCSI_RESERVED_TAG))
474 break; 473 break;
475 474
476 if (iscsi_recv_pdu(conn->cls_conn, hdr, NULL, 0)) 475 if (iscsi_recv_pdu(conn->cls_conn, hdr, NULL, 0))
@@ -516,24 +515,24 @@ int iscsi_verify_itt(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
516 struct iscsi_cmd_task *ctask; 515 struct iscsi_cmd_task *ctask;
517 uint32_t itt; 516 uint32_t itt;
518 517
519 if (hdr->itt != cpu_to_be32(ISCSI_RESERVED_TAG)) { 518 if (hdr->itt != RESERVED_ITT) {
520 if ((hdr->itt & ISCSI_AGE_MASK) != 519 if (((__force u32)hdr->itt & ISCSI_AGE_MASK) !=
521 (session->age << ISCSI_AGE_SHIFT)) { 520 (session->age << ISCSI_AGE_SHIFT)) {
522 printk(KERN_ERR "iscsi: received itt %x expected " 521 printk(KERN_ERR "iscsi: received itt %x expected "
523 "session age (%x)\n", hdr->itt, 522 "session age (%x)\n", (__force u32)hdr->itt,
524 session->age & ISCSI_AGE_MASK); 523 session->age & ISCSI_AGE_MASK);
525 return ISCSI_ERR_BAD_ITT; 524 return ISCSI_ERR_BAD_ITT;
526 } 525 }
527 526
528 if ((hdr->itt & ISCSI_CID_MASK) != 527 if (((__force u32)hdr->itt & ISCSI_CID_MASK) !=
529 (conn->id << ISCSI_CID_SHIFT)) { 528 (conn->id << ISCSI_CID_SHIFT)) {
530 printk(KERN_ERR "iscsi: received itt %x, expected " 529 printk(KERN_ERR "iscsi: received itt %x, expected "
531 "CID (%x)\n", hdr->itt, conn->id); 530 "CID (%x)\n", (__force u32)hdr->itt, conn->id);
532 return ISCSI_ERR_BAD_ITT; 531 return ISCSI_ERR_BAD_ITT;
533 } 532 }
534 itt = hdr->itt & ISCSI_ITT_MASK; 533 itt = get_itt(hdr->itt);
535 } else 534 } else
536 itt = hdr->itt; 535 itt = ~0U;
537 536
538 if (itt < session->cmds_max) { 537 if (itt < session->cmds_max) {
539 ctask = session->cmds[itt]; 538 ctask = session->cmds[itt];
@@ -896,9 +895,8 @@ iscsi_conn_send_generic(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
896 /* 895 /*
897 * pre-format CmdSN for outgoing PDU. 896 * pre-format CmdSN for outgoing PDU.
898 */ 897 */
899 if (hdr->itt != cpu_to_be32(ISCSI_RESERVED_TAG)) { 898 if (hdr->itt != RESERVED_ITT) {
900 hdr->itt = mtask->itt | (conn->id << ISCSI_CID_SHIFT) | 899 hdr->itt = build_itt(mtask->itt, conn->id, session->age);
901 (session->age << ISCSI_AGE_SHIFT);
902 nop->cmdsn = cpu_to_be32(session->cmdsn); 900 nop->cmdsn = cpu_to_be32(session->cmdsn);
903 if (conn->c_stage == ISCSI_CONN_STARTED && 901 if (conn->c_stage == ISCSI_CONN_STARTED &&
904 !(hdr->opcode & ISCSI_OP_IMMEDIATE)) 902 !(hdr->opcode & ISCSI_OP_IMMEDIATE))
@@ -1064,7 +1062,7 @@ static int iscsi_exec_abort_task(struct scsi_cmnd *sc,
1064 1062
1065 spin_lock_bh(&session->lock); 1063 spin_lock_bh(&session->lock);
1066 ctask->mtask = (struct iscsi_mgmt_task *) 1064 ctask->mtask = (struct iscsi_mgmt_task *)
1067 session->mgmt_cmds[(hdr->itt & ISCSI_ITT_MASK) - 1065 session->mgmt_cmds[get_itt(hdr->itt) -
1068 ISCSI_MGMT_ITT_OFFSET]; 1066 ISCSI_MGMT_ITT_OFFSET];
1069 1067
1070 if (conn->tmabort_state == TMABORT_INITIAL) { 1068 if (conn->tmabort_state == TMABORT_INITIAL) {
diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c
index 3586fac9be9a..bcb49021b7e2 100644
--- a/drivers/scsi/mac_esp.c
+++ b/drivers/scsi/mac_esp.c
@@ -351,7 +351,7 @@ int mac_esp_detect(struct scsi_host_template * tpnt)
351 for (chipnum = 0; chipnum < chipspresent; chipnum ++) { 351 for (chipnum = 0; chipnum < chipspresent; chipnum ++) {
352 struct NCR_ESP * esp; 352 struct NCR_ESP * esp;
353 353
354 esp = esp_allocate(tpnt, (void *) NULL); 354 esp = esp_allocate(tpnt, NULL, 0);
355 esp->eregs = (struct ESP_regs *) get_base(chipnum); 355 esp->eregs = (struct ESP_regs *) get_base(chipnum);
356 356
357 esp->dma_irq_p = &esp_dafb_dma_irq_p; 357 esp->dma_irq_p = &esp_dafb_dma_irq_p;
diff --git a/drivers/scsi/mca_53c9x.c b/drivers/scsi/mca_53c9x.c
index 998a8bbc1a4b..d693d0f21395 100644
--- a/drivers/scsi/mca_53c9x.c
+++ b/drivers/scsi/mca_53c9x.c
@@ -122,7 +122,7 @@ static int mca_esp_detect(struct scsi_host_template *tpnt)
122 if ((slot = mca_find_adapter(*id_to_check, 0)) != 122 if ((slot = mca_find_adapter(*id_to_check, 0)) !=
123 MCA_NOTFOUND) 123 MCA_NOTFOUND)
124 { 124 {
125 esp = esp_allocate(tpnt, (void *) NULL); 125 esp = esp_allocate(tpnt, NULL, 0);
126 126
127 pos[0] = mca_read_stored_pos(slot, 2); 127 pos[0] = mca_read_stored_pos(slot, 2);
128 pos[1] = mca_read_stored_pos(slot, 3); 128 pos[1] = mca_read_stored_pos(slot, 3);
diff --git a/drivers/scsi/oktagon_esp.c b/drivers/scsi/oktagon_esp.c
index c116a6ae3c54..26a6d55faf3e 100644
--- a/drivers/scsi/oktagon_esp.c
+++ b/drivers/scsi/oktagon_esp.c
@@ -133,7 +133,7 @@ int oktagon_esp_detect(struct scsi_host_template *tpnt)
133 eregs = (struct ESP_regs *)(address + OKTAGON_ESP_ADDR); 133 eregs = (struct ESP_regs *)(address + OKTAGON_ESP_ADDR);
134 134
135 /* This line was 5 lines lower */ 135 /* This line was 5 lines lower */
136 esp = esp_allocate(tpnt, (void *)board+OKTAGON_ESP_ADDR); 136 esp = esp_allocate(tpnt, (void *)board + OKTAGON_ESP_ADDR, 0);
137 137
138 /* we have to shift the registers only one bit for oktagon */ 138 /* we have to shift the registers only one bit for oktagon */
139 esp->shift = 1; 139 esp->shift = 1;
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 7d2311067903..bd6bbf61adb8 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -521,10 +521,10 @@ static void osst_init_aux(struct osst_tape * STp, int frame_type, int frame_seq_
521 break; 521 break;
522 default: ; /* probably FILL */ 522 default: ; /* probably FILL */
523 } 523 }
524 aux->filemark_cnt = ntohl(STp->filemark_cnt); 524 aux->filemark_cnt = htonl(STp->filemark_cnt);
525 aux->phys_fm = ntohl(0xffffffff); 525 aux->phys_fm = htonl(0xffffffff);
526 aux->last_mark_ppos = ntohl(STp->last_mark_ppos); 526 aux->last_mark_ppos = htonl(STp->last_mark_ppos);
527 aux->last_mark_lbn = ntohl(STp->last_mark_lbn); 527 aux->last_mark_lbn = htonl(STp->last_mark_lbn);
528} 528}
529 529
530/* 530/*
diff --git a/drivers/scsi/osst.h b/drivers/scsi/osst.h
index 1e426f5d0ed8..2cc7b5a1606a 100644
--- a/drivers/scsi/osst.h
+++ b/drivers/scsi/osst.h
@@ -288,11 +288,11 @@ typedef struct {
288#else 288#else
289#error "Please fix <asm/byteorder.h>" 289#error "Please fix <asm/byteorder.h>"
290#endif 290#endif
291 u16 max_speed; /* Maximum speed supported in KBps */ 291 __be16 max_speed; /* Maximum speed supported in KBps */
292 u8 reserved10, reserved11; 292 u8 reserved10, reserved11;
293 u16 ctl; /* Continuous Transfer Limit in blocks */ 293 __be16 ctl; /* Continuous Transfer Limit in blocks */
294 u16 speed; /* Current Speed, in KBps */ 294 __be16 speed; /* Current Speed, in KBps */
295 u16 buffer_size; /* Buffer Size, in 512 bytes */ 295 __be16 buffer_size; /* Buffer Size, in 512 bytes */
296 u8 reserved18, reserved19; 296 u8 reserved18, reserved19;
297} osst_capabilities_page_t; 297} osst_capabilities_page_t;
298 298
@@ -352,8 +352,8 @@ typedef struct {
352 u8 reserved2; 352 u8 reserved2;
353 u8 density; 353 u8 density;
354 u8 reserved3,reserved4; 354 u8 reserved3,reserved4;
355 u16 segtrk; 355 __be16 segtrk;
356 u16 trks; 356 __be16 trks;
357 u8 reserved5,reserved6,reserved7,reserved8,reserved9,reserved10; 357 u8 reserved5,reserved6,reserved7,reserved8,reserved9,reserved10;
358} osst_tape_paramtr_page_t; 358} osst_tape_paramtr_page_t;
359 359
@@ -369,18 +369,18 @@ typedef struct {
369typedef struct os_partition_s { 369typedef struct os_partition_s {
370 __u8 partition_num; 370 __u8 partition_num;
371 __u8 par_desc_ver; 371 __u8 par_desc_ver;
372 __u16 wrt_pass_cntr; 372 __be16 wrt_pass_cntr;
373 __u32 first_frame_ppos; 373 __be32 first_frame_ppos;
374 __u32 last_frame_ppos; 374 __be32 last_frame_ppos;
375 __u32 eod_frame_ppos; 375 __be32 eod_frame_ppos;
376} os_partition_t; 376} os_partition_t;
377 377
378/* 378/*
379 * DAT entry 379 * DAT entry
380 */ 380 */
381typedef struct os_dat_entry_s { 381typedef struct os_dat_entry_s {
382 __u32 blk_sz; 382 __be32 blk_sz;
383 __u16 blk_cnt; 383 __be16 blk_cnt;
384 __u8 flags; 384 __u8 flags;
385 __u8 reserved; 385 __u8 reserved;
386} os_dat_entry_t; 386} os_dat_entry_t;
@@ -412,23 +412,23 @@ typedef struct os_dat_s {
412 * AUX 412 * AUX
413 */ 413 */
414typedef struct os_aux_s { 414typedef struct os_aux_s {
415 __u32 format_id; /* hardware compability AUX is based on */ 415 __be32 format_id; /* hardware compability AUX is based on */
416 char application_sig[4]; /* driver used to write this media */ 416 char application_sig[4]; /* driver used to write this media */
417 __u32 hdwr; /* reserved */ 417 __be32 hdwr; /* reserved */
418 __u32 update_frame_cntr; /* for configuration frame */ 418 __be32 update_frame_cntr; /* for configuration frame */
419 __u8 frame_type; 419 __u8 frame_type;
420 __u8 frame_type_reserved; 420 __u8 frame_type_reserved;
421 __u8 reserved_18_19[2]; 421 __u8 reserved_18_19[2];
422 os_partition_t partition; 422 os_partition_t partition;
423 __u8 reserved_36_43[8]; 423 __u8 reserved_36_43[8];
424 __u32 frame_seq_num; 424 __be32 frame_seq_num;
425 __u32 logical_blk_num_high; 425 __be32 logical_blk_num_high;
426 __u32 logical_blk_num; 426 __be32 logical_blk_num;
427 os_dat_t dat; 427 os_dat_t dat;
428 __u8 reserved188_191[4]; 428 __u8 reserved188_191[4];
429 __u32 filemark_cnt; 429 __be32 filemark_cnt;
430 __u32 phys_fm; 430 __be32 phys_fm;
431 __u32 last_mark_ppos; 431 __be32 last_mark_ppos;
432 __u8 reserved204_223[20]; 432 __u8 reserved204_223[20];
433 433
434 /* 434 /*
@@ -436,8 +436,8 @@ typedef struct os_aux_s {
436 * 436 *
437 * Linux specific fields: 437 * Linux specific fields:
438 */ 438 */
439 __u32 next_mark_ppos; /* when known, points to next marker */ 439 __be32 next_mark_ppos; /* when known, points to next marker */
440 __u32 last_mark_lbn; /* storing log_blk_num of last mark is extends ADR spec */ 440 __be32 last_mark_lbn; /* storing log_blk_num of last mark is extends ADR spec */
441 __u8 linux_specific[24]; 441 __u8 linux_specific[24];
442 442
443 __u8 reserved_256_511[256]; 443 __u8 reserved_256_511[256];
@@ -450,19 +450,19 @@ typedef struct os_fm_tab_s {
450 __u8 reserved_1; 450 __u8 reserved_1;
451 __u8 fm_tab_ent_sz; 451 __u8 fm_tab_ent_sz;
452 __u8 reserved_3; 452 __u8 reserved_3;
453 __u16 fm_tab_ent_cnt; 453 __be16 fm_tab_ent_cnt;
454 __u8 reserved6_15[10]; 454 __u8 reserved6_15[10];
455 __u32 fm_tab_ent[OS_FM_TAB_MAX]; 455 __be32 fm_tab_ent[OS_FM_TAB_MAX];
456} os_fm_tab_t; 456} os_fm_tab_t;
457 457
458typedef struct os_ext_trk_ey_s { 458typedef struct os_ext_trk_ey_s {
459 __u8 et_part_num; 459 __u8 et_part_num;
460 __u8 fmt; 460 __u8 fmt;
461 __u16 fm_tab_off; 461 __be16 fm_tab_off;
462 __u8 reserved4_7[4]; 462 __u8 reserved4_7[4];
463 __u32 last_hlb_hi; 463 __be32 last_hlb_hi;
464 __u32 last_hlb; 464 __be32 last_hlb;
465 __u32 last_pp; 465 __be32 last_pp;
466 __u8 reserved20_31[12]; 466 __u8 reserved20_31[12];
467} os_ext_trk_ey_t; 467} os_ext_trk_ey_t;
468 468
@@ -479,17 +479,17 @@ typedef struct os_header_s {
479 char ident_str[8]; 479 char ident_str[8];
480 __u8 major_rev; 480 __u8 major_rev;
481 __u8 minor_rev; 481 __u8 minor_rev;
482 __u16 ext_trk_tb_off; 482 __be16 ext_trk_tb_off;
483 __u8 reserved12_15[4]; 483 __u8 reserved12_15[4];
484 __u8 pt_par_num; 484 __u8 pt_par_num;
485 __u8 pt_reserved1_3[3]; 485 __u8 pt_reserved1_3[3];
486 os_partition_t partition[16]; 486 os_partition_t partition[16];
487 __u32 cfg_col_width; 487 __be32 cfg_col_width;
488 __u32 dat_col_width; 488 __be32 dat_col_width;
489 __u32 qfa_col_width; 489 __be32 qfa_col_width;
490 __u8 cartridge[16]; 490 __u8 cartridge[16];
491 __u8 reserved304_511[208]; 491 __u8 reserved304_511[208];
492 __u32 old_filemark_list[16680/4]; /* in ADR 1.4 __u8 track_table[16680] */ 492 __be32 old_filemark_list[16680/4]; /* in ADR 1.4 __u8 track_table[16680] */
493 os_ext_trk_tb_t ext_track_tb; 493 os_ext_trk_tb_t ext_track_tb;
494 __u8 reserved17272_17735[464]; 494 __u8 reserved17272_17735[464];
495 os_fm_tab_t dat_fm_tab; 495 os_fm_tab_t dat_fm_tab;
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index 4249e52a5592..6f4cf2dd2f4a 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -418,7 +418,6 @@ struct scsi_qla_host {
418 * concurrently. 418 * concurrently.
419 */ 419 */
420 struct mutex mbox_sem; 420 struct mutex mbox_sem;
421 wait_queue_head_t mailbox_wait_queue;
422 421
423 /* temporary mailbox status registers */ 422 /* temporary mailbox status registers */
424 volatile uint8_t mbox_status_count; 423 volatile uint8_t mbox_status_count;
diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h
index 2122967bbf0b..e021eb5db2b2 100644
--- a/drivers/scsi/qla4xxx/ql4_glbl.h
+++ b/drivers/scsi/qla4xxx/ql4_glbl.h
@@ -76,4 +76,5 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host * ha,
76extern int ql4xextended_error_logging; 76extern int ql4xextended_error_logging;
77extern int ql4xdiscoverywait; 77extern int ql4xdiscoverywait;
78extern int ql4xdontresethba; 78extern int ql4xdontresethba;
79extern int ql4_mod_unload;
79#endif /* _QLA4x_GBL_H */ 80#endif /* _QLA4x_GBL_H */
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index cc210f297a78..b907b06d72ab 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -958,25 +958,25 @@ static int qla4xxx_start_firmware_from_flash(struct scsi_qla_host *ha)
958 return status; 958 return status;
959} 959}
960 960
961int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a) 961int ql4xxx_lock_drvr_wait(struct scsi_qla_host *ha)
962{ 962{
963#define QL4_LOCK_DRVR_WAIT 300 963#define QL4_LOCK_DRVR_WAIT 30
964#define QL4_LOCK_DRVR_SLEEP 100 964#define QL4_LOCK_DRVR_SLEEP 1
965 965
966 int drvr_wait = QL4_LOCK_DRVR_WAIT; 966 int drvr_wait = QL4_LOCK_DRVR_WAIT;
967 while (drvr_wait) { 967 while (drvr_wait) {
968 if (ql4xxx_lock_drvr(a) == 0) { 968 if (ql4xxx_lock_drvr(ha) == 0) {
969 msleep(QL4_LOCK_DRVR_SLEEP); 969 ssleep(QL4_LOCK_DRVR_SLEEP);
970 if (drvr_wait) { 970 if (drvr_wait) {
971 DEBUG2(printk("scsi%ld: %s: Waiting for " 971 DEBUG2(printk("scsi%ld: %s: Waiting for "
972 "Global Init Semaphore...n", 972 "Global Init Semaphore(%d)...n",
973 a->host_no, 973 ha->host_no,
974 __func__)); 974 __func__, drvr_wait));
975 } 975 }
976 drvr_wait -= QL4_LOCK_DRVR_SLEEP; 976 drvr_wait -= QL4_LOCK_DRVR_SLEEP;
977 } else { 977 } else {
978 DEBUG2(printk("scsi%ld: %s: Global Init Semaphore " 978 DEBUG2(printk("scsi%ld: %s: Global Init Semaphore "
979 "acquired.n", a->host_no, __func__)); 979 "acquired.n", ha->host_no, __func__));
980 return QLA_SUCCESS; 980 return QLA_SUCCESS;
981 } 981 }
982 } 982 }
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index ef975e0dc87f..35b9e36a0e8d 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -433,7 +433,6 @@ static void qla4xxx_isr_decode_mailbox(struct scsi_qla_host * ha,
433 readl(&ha->reg->mailbox[i]); 433 readl(&ha->reg->mailbox[i]);
434 434
435 set_bit(AF_MBOX_COMMAND_DONE, &ha->flags); 435 set_bit(AF_MBOX_COMMAND_DONE, &ha->flags);
436 wake_up(&ha->mailbox_wait_queue);
437 } 436 }
438 } else if (mbox_status >> 12 == MBOX_ASYNC_EVENT_STATUS) { 437 } else if (mbox_status >> 12 == MBOX_ASYNC_EVENT_STATUS) {
439 /* Immediately process the AENs that don't require much work. 438 /* Immediately process the AENs that don't require much work.
@@ -686,7 +685,8 @@ irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id)
686 &ha->reg->ctrl_status); 685 &ha->reg->ctrl_status);
687 readl(&ha->reg->ctrl_status); 686 readl(&ha->reg->ctrl_status);
688 687
689 set_bit(DPC_RESET_HA_INTR, &ha->dpc_flags); 688 if (!ql4_mod_unload)
689 set_bit(DPC_RESET_HA_INTR, &ha->dpc_flags);
690 690
691 break; 691 break;
692 } else if (intr_status & INTR_PENDING) { 692 } else if (intr_status & INTR_PENDING) {
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index b721dc5dd711..7f28657eef3f 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -29,18 +29,30 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
29 u_long wait_count; 29 u_long wait_count;
30 uint32_t intr_status; 30 uint32_t intr_status;
31 unsigned long flags = 0; 31 unsigned long flags = 0;
32 DECLARE_WAITQUEUE(wait, current);
33
34 mutex_lock(&ha->mbox_sem);
35
36 /* Mailbox code active */
37 set_bit(AF_MBOX_COMMAND, &ha->flags);
38 32
39 /* Make sure that pointers are valid */ 33 /* Make sure that pointers are valid */
40 if (!mbx_cmd || !mbx_sts) { 34 if (!mbx_cmd || !mbx_sts) {
41 DEBUG2(printk("scsi%ld: %s: Invalid mbx_cmd or mbx_sts " 35 DEBUG2(printk("scsi%ld: %s: Invalid mbx_cmd or mbx_sts "
42 "pointer\n", ha->host_no, __func__)); 36 "pointer\n", ha->host_no, __func__));
43 goto mbox_exit; 37 return status;
38 }
39 /* Mailbox code active */
40 wait_count = MBOX_TOV * 100;
41
42 while (wait_count--) {
43 mutex_lock(&ha->mbox_sem);
44 if (!test_bit(AF_MBOX_COMMAND, &ha->flags)) {
45 set_bit(AF_MBOX_COMMAND, &ha->flags);
46 mutex_unlock(&ha->mbox_sem);
47 break;
48 }
49 mutex_unlock(&ha->mbox_sem);
50 if (!wait_count) {
51 DEBUG2(printk("scsi%ld: %s: mbox_sem failed\n",
52 ha->host_no, __func__));
53 return status;
54 }
55 msleep(10);
44 } 56 }
45 57
46 /* To prevent overwriting mailbox registers for a command that has 58 /* To prevent overwriting mailbox registers for a command that has
@@ -73,8 +85,6 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
73 spin_unlock_irqrestore(&ha->hardware_lock, flags); 85 spin_unlock_irqrestore(&ha->hardware_lock, flags);
74 86
75 /* Wait for completion */ 87 /* Wait for completion */
76 set_current_state(TASK_UNINTERRUPTIBLE);
77 add_wait_queue(&ha->mailbox_wait_queue, &wait);
78 88
79 /* 89 /*
80 * If we don't want status, don't wait for the mailbox command to 90 * If we don't want status, don't wait for the mailbox command to
@@ -83,8 +93,6 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
83 */ 93 */
84 if (outCount == 0) { 94 if (outCount == 0) {
85 status = QLA_SUCCESS; 95 status = QLA_SUCCESS;
86 set_current_state(TASK_RUNNING);
87 remove_wait_queue(&ha->mailbox_wait_queue, &wait);
88 goto mbox_exit; 96 goto mbox_exit;
89 } 97 }
90 /* Wait for command to complete */ 98 /* Wait for command to complete */
@@ -108,8 +116,6 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
108 spin_unlock_irqrestore(&ha->hardware_lock, flags); 116 spin_unlock_irqrestore(&ha->hardware_lock, flags);
109 msleep(10); 117 msleep(10);
110 } 118 }
111 set_current_state(TASK_RUNNING);
112 remove_wait_queue(&ha->mailbox_wait_queue, &wait);
113 119
114 /* Check for mailbox timeout. */ 120 /* Check for mailbox timeout. */
115 if (!test_bit(AF_MBOX_COMMAND_DONE, &ha->flags)) { 121 if (!test_bit(AF_MBOX_COMMAND_DONE, &ha->flags)) {
@@ -155,9 +161,10 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
155 spin_unlock_irqrestore(&ha->hardware_lock, flags); 161 spin_unlock_irqrestore(&ha->hardware_lock, flags);
156 162
157mbox_exit: 163mbox_exit:
164 mutex_lock(&ha->mbox_sem);
158 clear_bit(AF_MBOX_COMMAND, &ha->flags); 165 clear_bit(AF_MBOX_COMMAND, &ha->flags);
159 clear_bit(AF_MBOX_COMMAND_DONE, &ha->flags);
160 mutex_unlock(&ha->mbox_sem); 166 mutex_unlock(&ha->mbox_sem);
167 clear_bit(AF_MBOX_COMMAND_DONE, &ha->flags);
161 168
162 return status; 169 return status;
163} 170}
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 9ef693c8809a..81fb7bd44f01 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -40,6 +40,8 @@ MODULE_PARM_DESC(ql4xextended_error_logging,
40 "Option to enable extended error logging, " 40 "Option to enable extended error logging, "
41 "Default is 0 - no logging, 1 - debug logging"); 41 "Default is 0 - no logging, 1 - debug logging");
42 42
43int ql4_mod_unload = 0;
44
43/* 45/*
44 * SCSI host template entry points 46 * SCSI host template entry points
45 */ 47 */
@@ -422,6 +424,9 @@ static int qla4xxx_queuecommand(struct scsi_cmnd *cmd,
422 goto qc_host_busy; 424 goto qc_host_busy;
423 } 425 }
424 426
427 if (test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags))
428 goto qc_host_busy;
429
425 spin_unlock_irq(ha->host->host_lock); 430 spin_unlock_irq(ha->host->host_lock);
426 431
427 srb = qla4xxx_get_new_srb(ha, ddb_entry, cmd, done); 432 srb = qla4xxx_get_new_srb(ha, ddb_entry, cmd, done);
@@ -707,16 +712,12 @@ static int qla4xxx_cmd_wait(struct scsi_qla_host *ha)
707 return stat; 712 return stat;
708} 713}
709 714
710/** 715static void qla4xxx_hw_reset(struct scsi_qla_host *ha)
711 * qla4xxx_soft_reset - performs soft reset.
712 * @ha: Pointer to host adapter structure.
713 **/
714int qla4xxx_soft_reset(struct scsi_qla_host *ha)
715{ 716{
716 uint32_t max_wait_time;
717 unsigned long flags = 0;
718 int status = QLA_ERROR;
719 uint32_t ctrl_status; 717 uint32_t ctrl_status;
718 unsigned long flags = 0;
719
720 DEBUG2(printk(KERN_ERR "scsi%ld: %s\n", ha->host_no, __func__));
720 721
721 spin_lock_irqsave(&ha->hardware_lock, flags); 722 spin_lock_irqsave(&ha->hardware_lock, flags);
722 723
@@ -733,6 +734,20 @@ int qla4xxx_soft_reset(struct scsi_qla_host *ha)
733 readl(&ha->reg->ctrl_status); 734 readl(&ha->reg->ctrl_status);
734 735
735 spin_unlock_irqrestore(&ha->hardware_lock, flags); 736 spin_unlock_irqrestore(&ha->hardware_lock, flags);
737}
738
739/**
740 * qla4xxx_soft_reset - performs soft reset.
741 * @ha: Pointer to host adapter structure.
742 **/
743int qla4xxx_soft_reset(struct scsi_qla_host *ha)
744{
745 uint32_t max_wait_time;
746 unsigned long flags = 0;
747 int status = QLA_ERROR;
748 uint32_t ctrl_status;
749
750 qla4xxx_hw_reset(ha);
736 751
737 /* Wait until the Network Reset Intr bit is cleared */ 752 /* Wait until the Network Reset Intr bit is cleared */
738 max_wait_time = RESET_INTR_TOV; 753 max_wait_time = RESET_INTR_TOV;
@@ -966,10 +981,12 @@ static void qla4xxx_do_dpc(struct work_struct *work)
966 struct scsi_qla_host *ha = 981 struct scsi_qla_host *ha =
967 container_of(work, struct scsi_qla_host, dpc_work); 982 container_of(work, struct scsi_qla_host, dpc_work);
968 struct ddb_entry *ddb_entry, *dtemp; 983 struct ddb_entry *ddb_entry, *dtemp;
984 int status = QLA_ERROR;
969 985
970 DEBUG2(printk("scsi%ld: %s: DPC handler waking up." 986 DEBUG2(printk("scsi%ld: %s: DPC handler waking up."
971 "flags = 0x%08lx, dpc_flags = 0x%08lx\n", 987 "flags = 0x%08lx, dpc_flags = 0x%08lx ctrl_stat = 0x%08x\n",
972 ha->host_no, __func__, ha->flags, ha->dpc_flags)); 988 ha->host_no, __func__, ha->flags, ha->dpc_flags,
989 readw(&ha->reg->ctrl_status)));
973 990
974 /* Initialization not yet finished. Don't do anything yet. */ 991 /* Initialization not yet finished. Don't do anything yet. */
975 if (!test_bit(AF_INIT_DONE, &ha->flags)) 992 if (!test_bit(AF_INIT_DONE, &ha->flags))
@@ -983,31 +1000,28 @@ static void qla4xxx_do_dpc(struct work_struct *work)
983 test_bit(DPC_RESET_HA, &ha->dpc_flags)) 1000 test_bit(DPC_RESET_HA, &ha->dpc_flags))
984 qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST); 1001 qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST);
985 1002
986 if (test_and_clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) { 1003 if (test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) {
987 uint8_t wait_time = RESET_INTR_TOV; 1004 uint8_t wait_time = RESET_INTR_TOV;
988 unsigned long flags = 0;
989
990 qla4xxx_flush_active_srbs(ha);
991 1005
992 spin_lock_irqsave(&ha->hardware_lock, flags);
993 while ((readw(&ha->reg->ctrl_status) & 1006 while ((readw(&ha->reg->ctrl_status) &
994 (CSR_SOFT_RESET | CSR_FORCE_SOFT_RESET)) != 0) { 1007 (CSR_SOFT_RESET | CSR_FORCE_SOFT_RESET)) != 0) {
995 if (--wait_time == 0) 1008 if (--wait_time == 0)
996 break; 1009 break;
997
998 spin_unlock_irqrestore(&ha->hardware_lock,
999 flags);
1000
1001 msleep(1000); 1010 msleep(1000);
1002
1003 spin_lock_irqsave(&ha->hardware_lock, flags);
1004 } 1011 }
1005 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1006
1007 if (wait_time == 0) 1012 if (wait_time == 0)
1008 DEBUG2(printk("scsi%ld: %s: SR|FSR " 1013 DEBUG2(printk("scsi%ld: %s: SR|FSR "
1009 "bit not cleared-- resetting\n", 1014 "bit not cleared-- resetting\n",
1010 ha->host_no, __func__)); 1015 ha->host_no, __func__));
1016 qla4xxx_flush_active_srbs(ha);
1017 if (ql4xxx_lock_drvr_wait(ha) == QLA_SUCCESS) {
1018 qla4xxx_process_aen(ha, FLUSH_DDB_CHANGED_AENS);
1019 status = qla4xxx_initialize_adapter(ha,
1020 PRESERVE_DDB_LIST);
1021 }
1022 clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags);
1023 if (status == QLA_SUCCESS)
1024 qla4xxx_enable_intrs(ha);
1011 } 1025 }
1012 } 1026 }
1013 1027
@@ -1062,7 +1076,7 @@ static void qla4xxx_free_adapter(struct scsi_qla_host *ha)
1062 1076
1063 /* Issue Soft Reset to put firmware in unknown state */ 1077 /* Issue Soft Reset to put firmware in unknown state */
1064 if (ql4xxx_lock_drvr_wait(ha) == QLA_SUCCESS) 1078 if (ql4xxx_lock_drvr_wait(ha) == QLA_SUCCESS)
1065 qla4xxx_soft_reset(ha); 1079 qla4xxx_hw_reset(ha);
1066 1080
1067 /* Remove timer thread, if present */ 1081 /* Remove timer thread, if present */
1068 if (ha->timer_active) 1082 if (ha->timer_active)
@@ -1198,7 +1212,6 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev,
1198 INIT_LIST_HEAD(&ha->free_srb_q); 1212 INIT_LIST_HEAD(&ha->free_srb_q);
1199 1213
1200 mutex_init(&ha->mbox_sem); 1214 mutex_init(&ha->mbox_sem);
1201 init_waitqueue_head(&ha->mailbox_wait_queue);
1202 1215
1203 spin_lock_init(&ha->hardware_lock); 1216 spin_lock_init(&ha->hardware_lock);
1204 1217
@@ -1665,6 +1678,7 @@ no_srp_cache:
1665 1678
1666static void __exit qla4xxx_module_exit(void) 1679static void __exit qla4xxx_module_exit(void)
1667{ 1680{
1681 ql4_mod_unload = 1;
1668 pci_unregister_driver(&qla4xxx_pci_driver); 1682 pci_unregister_driver(&qla4xxx_pci_driver);
1669 iscsi_unregister_transport(&qla4xxx_iscsi_transport); 1683 iscsi_unregister_transport(&qla4xxx_iscsi_transport);
1670 kmem_cache_destroy(srb_cachep); 1684 kmem_cache_destroy(srb_cachep);
diff --git a/drivers/scsi/qla4xxx/ql4_version.h b/drivers/scsi/qla4xxx/ql4_version.h
index 454e19c8ad68..e5183a697d1f 100644
--- a/drivers/scsi/qla4xxx/ql4_version.h
+++ b/drivers/scsi/qla4xxx/ql4_version.h
@@ -5,4 +5,4 @@
5 * See LICENSE.qla4xxx for copyright and licensing details. 5 * See LICENSE.qla4xxx for copyright and licensing details.
6 */ 6 */
7 7
8#define QLA4XXX_DRIVER_VERSION "5.00.07-k" 8#define QLA4XXX_DRIVER_VERSION "5.00.07-k1"
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 8160c00d1092..a43b9ec3aefd 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1453,6 +1453,12 @@ struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel,
1453 struct device *parent = &shost->shost_gendev; 1453 struct device *parent = &shost->shost_gendev;
1454 struct scsi_target *starget; 1454 struct scsi_target *starget;
1455 1455
1456 if (strncmp(scsi_scan_type, "none", 4) == 0)
1457 return ERR_PTR(-ENODEV);
1458
1459 if (!shost->async_scan)
1460 scsi_complete_async_scans();
1461
1456 starget = scsi_alloc_target(parent, channel, id); 1462 starget = scsi_alloc_target(parent, channel, id);
1457 if (!starget) 1463 if (!starget)
1458 return ERR_PTR(-ENOMEM); 1464 return ERR_PTR(-ENOMEM);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 978bfc1e0c6a..b781a90d6699 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1647,16 +1647,6 @@ static int sd_probe(struct device *dev)
1647 if (error) 1647 if (error)
1648 goto out_put; 1648 goto out_put;
1649 1649
1650 class_device_initialize(&sdkp->cdev);
1651 sdkp->cdev.dev = &sdp->sdev_gendev;
1652 sdkp->cdev.class = &sd_disk_class;
1653 strncpy(sdkp->cdev.class_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE);
1654
1655 if (class_device_add(&sdkp->cdev))
1656 goto out_put;
1657
1658 get_device(&sdp->sdev_gendev);
1659
1660 sdkp->device = sdp; 1650 sdkp->device = sdp;
1661 sdkp->driver = &sd_template; 1651 sdkp->driver = &sd_template;
1662 sdkp->disk = gd; 1652 sdkp->disk = gd;
@@ -1670,6 +1660,16 @@ static int sd_probe(struct device *dev)
1670 sdp->timeout = SD_MOD_TIMEOUT; 1660 sdp->timeout = SD_MOD_TIMEOUT;
1671 } 1661 }
1672 1662
1663 class_device_initialize(&sdkp->cdev);
1664 sdkp->cdev.dev = &sdp->sdev_gendev;
1665 sdkp->cdev.class = &sd_disk_class;
1666 strncpy(sdkp->cdev.class_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE);
1667
1668 if (class_device_add(&sdkp->cdev))
1669 goto out_put;
1670
1671 get_device(&sdp->sdev_gendev);
1672
1673 gd->major = sd_major((index & 0xf0) >> 4); 1673 gd->major = sd_major((index & 0xf0) >> 4);
1674 gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); 1674 gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00);
1675 gd->minors = 16; 1675 gd->minors = 16;
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index fba8b204e310..16e279be4a3e 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -2819,15 +2819,18 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon
2819 2819
2820 if (cmd_in == MTWEOF && 2820 if (cmd_in == MTWEOF &&
2821 cmdstatp->have_sense && 2821 cmdstatp->have_sense &&
2822 (cmdstatp->flags & SENSE_EOM) && 2822 (cmdstatp->flags & SENSE_EOM)) {
2823 (cmdstatp->sense_hdr.sense_key == NO_SENSE || 2823 if (cmdstatp->sense_hdr.sense_key == NO_SENSE ||
2824 cmdstatp->sense_hdr.sense_key == RECOVERED_ERROR) && 2824 cmdstatp->sense_hdr.sense_key == RECOVERED_ERROR) {
2825 undone == 0) { 2825 ioctl_result = 0; /* EOF(s) written successfully at EOM */
2826 ioctl_result = 0; /* EOF written successfully at EOM */ 2826 STps->eof = ST_NOEOF;
2827 if (fileno >= 0) 2827 } else { /* Writing EOF(s) failed */
2828 fileno++; 2828 if (fileno >= 0)
2829 fileno -= undone;
2830 if (undone < arg)
2831 STps->eof = ST_NOEOF;
2832 }
2829 STps->drv_file = fileno; 2833 STps->drv_file = fileno;
2830 STps->eof = ST_NOEOF;
2831 } else if ((cmd_in == MTFSF) || (cmd_in == MTFSFM)) { 2834 } else if ((cmd_in == MTFSF) || (cmd_in == MTFSFM)) {
2832 if (fileno >= 0) 2835 if (fileno >= 0)
2833 STps->drv_file = fileno - undone; 2836 STps->drv_file = fileno - undone;
diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c
index 6b60536ac92b..80fb3f88af2e 100644
--- a/drivers/scsi/sun3x_esp.c
+++ b/drivers/scsi/sun3x_esp.c
@@ -53,7 +53,7 @@ int sun3x_esp_detect(struct scsi_host_template *tpnt)
53 struct ConfigDev *esp_dev; 53 struct ConfigDev *esp_dev;
54 54
55 esp_dev = 0; 55 esp_dev = 0;
56 esp = esp_allocate(tpnt, (void *) esp_dev); 56 esp = esp_allocate(tpnt, esp_dev, 0);
57 57
58 /* Do command transfer with DMA */ 58 /* Do command transfer with DMA */
59 esp->do_pio_cmds = 0; 59 esp->do_pio_cmds = 0;