Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / drivers / s390 / char / tape_3590.c
1 /*
2  *  drivers/s390/char/tape_3590.c
3  *    tape device discipline for 3590 tapes.
4  *
5  *    Copyright (C) IBM Corp. 2001,2006
6  *    Author(s): Stefan Bader <shbader@de.ibm.com>
7  *               Michael Holzheu <holzheu@de.ibm.com>
8  *               Martin Schwidefsky <schwidefsky@de.ibm.com>
9  */
10
11 #include <linux/module.h>
12 #include <linux/init.h>
13 #include <linux/bio.h>
14
15 #define TAPE_DBF_AREA   tape_3590_dbf
16
17 #include "tape.h"
18 #include "tape_std.h"
19 #include "tape_3590.h"
20
21 /*
22  * Pointer to debug area.
23  */
24 debug_info_t *TAPE_DBF_AREA = NULL;
25 EXPORT_SYMBOL(TAPE_DBF_AREA);
26
27 /*******************************************************************
28  * Error Recovery fuctions:
29  * - Read Opposite:              implemented
30  * - Read Device (buffered) log: BRA
31  * - Read Library log:           BRA
32  * - Swap Devices:               BRA
33  * - Long Busy:                  BRA
34  * - Special Intercept:          BRA
35  * - Read Alternate:             implemented
36  *******************************************************************/
37
38 #define PRINTK_HEADER "TAPE_3590: "
39
40 static const char *tape_3590_msg[TAPE_3590_MAX_MSG] = {
41         [0x00] = "",
42         [0x10] = "Lost Sense",
43         [0x11] = "Assigned Elsewhere",
44         [0x12] = "Allegiance Reset",
45         [0x13] = "Shared Access Violation",
46         [0x20] = "Command Reject",
47         [0x21] = "Configuration Error",
48         [0x22] = "Protection Exception",
49         [0x23] = "Write Protect",
50         [0x24] = "Write Length",
51         [0x25] = "Read-Only Format",
52         [0x31] = "Beginning of Partition",
53         [0x33] = "End of Partition",
54         [0x34] = "End of Data",
55         [0x35] = "Block not found",
56         [0x40] = "Device Intervention",
57         [0x41] = "Loader Intervention",
58         [0x42] = "Library Intervention",
59         [0x50] = "Write Error",
60         [0x51] = "Erase Error",
61         [0x52] = "Formatting Error",
62         [0x53] = "Read Error",
63         [0x54] = "Unsupported Format",
64         [0x55] = "No Formatting",
65         [0x56] = "Positioning lost",
66         [0x57] = "Read Length",
67         [0x60] = "Unsupported Medium",
68         [0x61] = "Medium Length Error",
69         [0x62] = "Medium removed",
70         [0x64] = "Load Check",
71         [0x65] = "Unload Check",
72         [0x70] = "Equipment Check",
73         [0x71] = "Bus out Check",
74         [0x72] = "Protocol Error",
75         [0x73] = "Interface Error",
76         [0x74] = "Overrun",
77         [0x75] = "Halt Signal",
78         [0x90] = "Device fenced",
79         [0x91] = "Device Path fenced",
80         [0xa0] = "Volume misplaced",
81         [0xa1] = "Volume inaccessible",
82         [0xa2] = "Volume in input",
83         [0xa3] = "Volume ejected",
84         [0xa4] = "All categories reserved",
85         [0xa5] = "Duplicate Volume",
86         [0xa6] = "Library Manager Offline",
87         [0xa7] = "Library Output Station full",
88         [0xa8] = "Vision System non-operational",
89         [0xa9] = "Library Manager Equipment Check",
90         [0xaa] = "Library Equipment Check",
91         [0xab] = "All Library Cells full",
92         [0xac] = "No Cleaner Volumes in Library",
93         [0xad] = "I/O Station door open",
94         [0xae] = "Subsystem environmental alert",
95 };
96
97 /*
98  * 3590 IOCTL Overload
99  */
100 static int
101 tape_3590_ioctl(struct tape_device *device, unsigned int cmd, unsigned long arg)
102 {
103         switch (cmd) {
104         case TAPE390_DISPLAY: {
105                 struct display_struct disp;
106
107                 if (copy_from_user(&disp, (char __user *) arg, sizeof(disp)))
108                         return -EFAULT;
109
110                 return tape_std_display(device, &disp);
111         }
112         default:
113                 return -EINVAL; /* no additional ioctls */
114         }
115 }
116
117 /*
118  * SENSE Medium: Get Sense data about medium state
119  */
120 static int
121 tape_3590_sense_medium(struct tape_device *device)
122 {
123         struct tape_request *request;
124
125         request = tape_alloc_request(1, 128);
126         if (IS_ERR(request))
127                 return PTR_ERR(request);
128         request->op = TO_MSEN;
129         tape_ccw_end(request->cpaddr, MEDIUM_SENSE, 128, request->cpdata);
130         return tape_do_io_free(device, request);
131 }
132
133 /*
134  * MTTELL: Tell block. Return the number of block relative to current file.
135  */
136 static int
137 tape_3590_mttell(struct tape_device *device, int mt_count)
138 {
139         __u64 block_id;
140         int rc;
141
142         rc = tape_std_read_block_id(device, &block_id);
143         if (rc)
144                 return rc;
145         return block_id >> 32;
146 }
147
148 /*
149  * MTSEEK: seek to the specified block.
150  */
151 static int
152 tape_3590_mtseek(struct tape_device *device, int count)
153 {
154         struct tape_request *request;
155
156         DBF_EVENT(6, "xsee id: %x\n", count);
157         request = tape_alloc_request(3, 4);
158         if (IS_ERR(request))
159                 return PTR_ERR(request);
160         request->op = TO_LBL;
161         tape_ccw_cc(request->cpaddr, MODE_SET_DB, 1, device->modeset_byte);
162         *(__u32 *) request->cpdata = count;
163         tape_ccw_cc(request->cpaddr + 1, LOCATE, 4, request->cpdata);
164         tape_ccw_end(request->cpaddr + 2, NOP, 0, NULL);
165         return tape_do_io_free(device, request);
166 }
167
168 /*
169  * Read Opposite Error Recovery Function:
170  * Used, when Read Forward does not work
171  */
172 static void
173 tape_3590_read_opposite(struct tape_device *device,
174                         struct tape_request *request)
175 {
176         struct tape_3590_disc_data *data;
177
178         /*
179          * We have allocated 4 ccws in tape_std_read, so we can now
180          * transform the request to a read backward, followed by a
181          * forward space block.
182          */
183         request->op = TO_RBA;
184         tape_ccw_cc(request->cpaddr, MODE_SET_DB, 1, device->modeset_byte);
185         data = device->discdata;
186         tape_ccw_cc_idal(request->cpaddr + 1, data->read_back_op,
187                          device->char_data.idal_buf);
188         tape_ccw_cc(request->cpaddr + 2, FORSPACEBLOCK, 0, NULL);
189         tape_ccw_end(request->cpaddr + 3, NOP, 0, NULL);
190         DBF_EVENT(6, "xrop ccwg\n");
191 }
192
193 /*
194  * Read Attention Msg
195  * This should be done after an interrupt with attention bit (0x80)
196  * in device state.
197  *
198  * After a "read attention message" request there are two possible
199  * results:
200  *
201  * 1. A unit check is presented, when attention sense is present (e.g. when
202  * a medium has been unloaded). The attention sense comes then
203  * together with the unit check. The recovery action is either "retry"
204  * (in case there is an attention message pending) or "permanent error".
205  *
206  * 2. The attention msg is written to the "read subsystem data" buffer.
207  * In this case we probably should print it to the console.
208  */
209 static int
210 tape_3590_read_attmsg(struct tape_device *device)
211 {
212         struct tape_request *request;
213         char *buf;
214
215         request = tape_alloc_request(3, 4096);
216         if (IS_ERR(request))
217                 return PTR_ERR(request);
218         request->op = TO_READ_ATTMSG;
219         buf = request->cpdata;
220         buf[0] = PREP_RD_SS_DATA;
221         buf[6] = RD_ATTMSG;     /* read att msg */
222         tape_ccw_cc(request->cpaddr, PERFORM_SS_FUNC, 12, buf);
223         tape_ccw_cc(request->cpaddr + 1, READ_SS_DATA, 4096 - 12, buf + 12);
224         tape_ccw_end(request->cpaddr + 2, NOP, 0, NULL);
225         return tape_do_io_free(device, request);
226 }
227
228 /*
229  * These functions are used to schedule follow-up actions from within an
230  * interrupt context (like unsolicited interrupts).
231  */
232 struct work_handler_data {
233         struct tape_device *device;
234         enum tape_op        op;
235         struct work_struct  work;
236 };
237
238 static void
239 tape_3590_work_handler(void *data)
240 {
241         struct work_handler_data *p = data;
242
243         switch (p->op) {
244         case TO_MSEN:
245                 tape_3590_sense_medium(p->device);
246                 break;
247         case TO_READ_ATTMSG:
248                 tape_3590_read_attmsg(p->device);
249                 break;
250         default:
251                 DBF_EVENT(3, "T3590: work handler undefined for "
252                           "operation 0x%02x\n", p->op);
253         }
254         tape_put_device(p->device);
255         kfree(p);
256 }
257
258 static int
259 tape_3590_schedule_work(struct tape_device *device, enum tape_op op)
260 {
261         struct work_handler_data *p;
262
263         if ((p = kzalloc(sizeof(*p), GFP_ATOMIC)) == NULL)
264                 return -ENOMEM;
265
266         INIT_WORK(&p->work, tape_3590_work_handler, p);
267
268         p->device = tape_get_device_reference(device);
269         p->op = op;
270
271         schedule_work(&p->work);
272         return 0;
273 }
274
275 #ifdef CONFIG_S390_TAPE_BLOCK
276 /*
277  * Tape Block READ
278  */
279 static struct tape_request *
280 tape_3590_bread(struct tape_device *device, struct request *req)
281 {
282         struct tape_request *request;
283         struct ccw1 *ccw;
284         int count = 0, start_block, i;
285         unsigned off;
286         char *dst;
287         struct bio_vec *bv;
288         struct bio *bio;
289
290         DBF_EVENT(6, "xBREDid:");
291         start_block = req->sector >> TAPEBLOCK_HSEC_S2B;
292         DBF_EVENT(6, "start_block = %i\n", start_block);
293
294         rq_for_each_bio(bio, req) {
295                 bio_for_each_segment(bv, bio, i) {
296                         count += bv->bv_len >> (TAPEBLOCK_HSEC_S2B + 9);
297                 }
298         }
299         request = tape_alloc_request(2 + count + 1, 4);
300         if (IS_ERR(request))
301                 return request;
302         request->op = TO_BLOCK;
303         *(__u32 *) request->cpdata = start_block;
304         ccw = request->cpaddr;
305         ccw = tape_ccw_cc(ccw, MODE_SET_DB, 1, device->modeset_byte);
306
307         /*
308          * We always setup a nop after the mode set ccw. This slot is
309          * used in tape_std_check_locate to insert a locate ccw if the
310          * current tape position doesn't match the start block to be read.
311          */
312         ccw = tape_ccw_cc(ccw, NOP, 0, NULL);
313
314         rq_for_each_bio(bio, req) {
315                 bio_for_each_segment(bv, bio, i) {
316                         dst = page_address(bv->bv_page) + bv->bv_offset;
317                         for (off = 0; off < bv->bv_len;
318                              off += TAPEBLOCK_HSEC_SIZE) {
319                                 ccw->flags = CCW_FLAG_CC;
320                                 ccw->cmd_code = READ_FORWARD;
321                                 ccw->count = TAPEBLOCK_HSEC_SIZE;
322                                 set_normalized_cda(ccw, (void *) __pa(dst));
323                                 ccw++;
324                                 dst += TAPEBLOCK_HSEC_SIZE;
325                         }
326                         if (off > bv->bv_len)
327                                 BUG();
328                 }
329         }
330         ccw = tape_ccw_end(ccw, NOP, 0, NULL);
331         DBF_EVENT(6, "xBREDccwg\n");
332         return request;
333 }
334
335 static void
336 tape_3590_free_bread(struct tape_request *request)
337 {
338         struct ccw1 *ccw;
339
340         /* Last ccw is a nop and doesn't need clear_normalized_cda */
341         for (ccw = request->cpaddr; ccw->flags & CCW_FLAG_CC; ccw++)
342                 if (ccw->cmd_code == READ_FORWARD)
343                         clear_normalized_cda(ccw);
344         tape_free_request(request);
345 }
346
347 /*
348  * check_locate is called just before the tape request is passed to
349  * the common io layer for execution. It has to check the current
350  * tape position and insert a locate ccw if it doesn't match the
351  * start block for the request.
352  */
353 static void
354 tape_3590_check_locate(struct tape_device *device, struct tape_request *request)
355 {
356         __u32 *start_block;
357
358         start_block = (__u32 *) request->cpdata;
359         if (*start_block != device->blk_data.block_position) {
360                 /* Add the start offset of the file to get the real block. */
361                 *start_block += device->bof;
362                 tape_ccw_cc(request->cpaddr + 1, LOCATE, 4, request->cpdata);
363         }
364 }
365 #endif
366
367 /*
368  * The done handler is called at device/channel end and wakes up the sleeping
369  * process
370  */
371 static int
372 tape_3590_done(struct tape_device *device, struct tape_request *request)
373 {
374         struct tape_3590_med_sense *sense;
375
376         DBF_EVENT(6, "%s done\n", tape_op_verbose[request->op]);
377
378         switch (request->op) {
379         case TO_BSB:
380         case TO_BSF:
381         case TO_DSE:
382         case TO_FSB:
383         case TO_FSF:
384         case TO_LBL:
385         case TO_RFO:
386         case TO_RBA:
387         case TO_REW:
388         case TO_WRI:
389         case TO_WTM:
390         case TO_BLOCK:
391         case TO_LOAD:
392                 tape_med_state_set(device, MS_LOADED);
393                 break;
394         case TO_RUN:
395                 tape_med_state_set(device, MS_UNLOADED);
396                 break;
397         case TO_MSEN:
398                 sense = (struct tape_3590_med_sense *) request->cpdata;
399                 if (sense->masst == MSENSE_UNASSOCIATED)
400                         tape_med_state_set(device, MS_UNLOADED);
401                 if (sense->masst == MSENSE_ASSOCIATED_MOUNT)
402                         tape_med_state_set(device, MS_LOADED);
403                 break;
404         case TO_RBI:    /* RBI seems to succeed even without medium loaded. */
405         case TO_NOP:    /* Same to NOP. */
406         case TO_READ_CONFIG:
407         case TO_READ_ATTMSG:
408         case TO_DIS:
409         case TO_ASSIGN:
410         case TO_UNASSIGN:
411                 break;
412         case TO_SIZE:
413                 break;
414         }
415         return TAPE_IO_SUCCESS;
416 }
417
418 /*
419  * This fuction is called, when error recovery was successfull
420  */
421 static inline int
422 tape_3590_erp_succeded(struct tape_device *device, struct tape_request *request)
423 {
424         DBF_EVENT(3, "Error Recovery successfull for %s\n",
425                   tape_op_verbose[request->op]);
426         return tape_3590_done(device, request);
427 }
428
429 /*
430  * This fuction is called, when error recovery was not successfull
431  */
432 static inline int
433 tape_3590_erp_failed(struct tape_device *device, struct tape_request *request,
434                      struct irb *irb, int rc)
435 {
436         DBF_EVENT(3, "Error Recovery failed for %s\n",
437                   tape_op_verbose[request->op]);
438         tape_dump_sense_dbf(device, request, irb);
439         return rc;
440 }
441
442 /*
443  * Error Recovery do retry
444  */
445 static inline int
446 tape_3590_erp_retry(struct tape_device *device, struct tape_request *request,
447                     struct irb *irb)
448 {
449         DBF_EVENT(2, "Retry: %s\n", tape_op_verbose[request->op]);
450         tape_dump_sense_dbf(device, request, irb);
451         return TAPE_IO_RETRY;
452 }
453
454 /*
455  * Handle unsolicited interrupts
456  */
457 static int
458 tape_3590_unsolicited_irq(struct tape_device *device, struct irb *irb)
459 {
460         if (irb->scsw.dstat == DEV_STAT_CHN_END)
461                 /* Probably result of halt ssch */
462                 return TAPE_IO_PENDING;
463         else if (irb->scsw.dstat == 0x85)
464                 /* Device Ready -> check medium state */
465                 tape_3590_schedule_work(device, TO_MSEN);
466         else if (irb->scsw.dstat & DEV_STAT_ATTENTION)
467                 tape_3590_schedule_work(device, TO_READ_ATTMSG);
468         else {
469                 DBF_EVENT(3, "unsol.irq! dev end: %08x\n", device->cdev_id);
470                 PRINT_WARN("Unsolicited IRQ (Device End) caught.\n");
471                 tape_dump_sense(device, NULL, irb);
472         }
473         return TAPE_IO_SUCCESS;
474 }
475
476 /*
477  * Basic Recovery routine
478  */
479 static int
480 tape_3590_erp_basic(struct tape_device *device, struct tape_request *request,
481                     struct irb *irb, int rc)
482 {
483         struct tape_3590_sense *sense;
484
485         sense = (struct tape_3590_sense *) irb->ecw;
486
487         switch (sense->bra) {
488         case SENSE_BRA_PER:
489                 return tape_3590_erp_failed(device, request, irb, rc);
490         case SENSE_BRA_CONT:
491                 return tape_3590_erp_succeded(device, request);
492         case SENSE_BRA_RE:
493                 return tape_3590_erp_retry(device, request, irb);
494         case SENSE_BRA_DRE:
495                 return tape_3590_erp_failed(device, request, irb, rc);
496         default:
497                 PRINT_ERR("Unknown BRA %x - This should not happen!\n",
498                           sense->bra);
499                 BUG();
500                 return TAPE_IO_STOP;
501         }
502 }
503
504 /*
505  *  RDL: Read Device (buffered) log
506  */
507 static int
508 tape_3590_erp_read_buf_log(struct tape_device *device,
509                            struct tape_request *request, struct irb *irb)
510 {
511         /*
512          * We just do the basic error recovery at the moment (retry).
513          * Perhaps in the future, we read the log and dump it somewhere...
514          */
515         return tape_3590_erp_basic(device, request, irb, -EIO);
516 }
517
518 /*
519  *  SWAP: Swap Devices
520  */
521 static int
522 tape_3590_erp_swap(struct tape_device *device, struct tape_request *request,
523                    struct irb *irb)
524 {
525         /*
526          * This error recovery should swap the tapes
527          * if the original has a problem. The operation
528          * should proceed with the new tape... this
529          * should probably be done in user space!
530          */
531         PRINT_WARN("(%s): Swap Tape Device!\n", device->cdev->dev.bus_id);
532         return tape_3590_erp_basic(device, request, irb, -EIO);
533 }
534
535 /*
536  *  LBY: Long Busy
537  */
538 static int
539 tape_3590_erp_long_busy(struct tape_device *device,
540                         struct tape_request *request, struct irb *irb)
541 {
542         /* FIXME: how about WAITING for a minute ? */
543         PRINT_WARN("(%s): Device is busy! Please wait a minute!\n",
544                    device->cdev->dev.bus_id);
545         return tape_3590_erp_basic(device, request, irb, -EBUSY);
546 }
547
548 /*
549  *  SPI: Special Intercept
550  */
551 static int
552 tape_3590_erp_special_interrupt(struct tape_device *device,
553                                 struct tape_request *request, struct irb *irb)
554 {
555         return tape_3590_erp_basic(device, request, irb, -EIO);
556 }
557
558 /*
559  *  RDA: Read Alternate
560  */
561 static int
562 tape_3590_erp_read_alternate(struct tape_device *device,
563                              struct tape_request *request, struct irb *irb)
564 {
565         struct tape_3590_disc_data *data;
566
567         /*
568          * The issued Read Backward or Read Previous command is not
569          * supported by the device
570          * The recovery action should be to issue another command:
571          * Read Revious: if Read Backward is not supported
572          * Read Backward: if Read Previous is not supported
573          */
574         data = device->discdata;
575         if (data->read_back_op == READ_PREVIOUS) {
576                 DBF_EVENT(2, "(%08x): No support for READ_PREVIOUS command\n",
577                           device->cdev_id);
578                 data->read_back_op = READ_BACKWARD;
579         } else {
580                 DBF_EVENT(2, "(%08x): No support for READ_BACKWARD command\n",
581                           device->cdev_id);
582                 data->read_back_op = READ_PREVIOUS;
583         }
584         tape_3590_read_opposite(device, request);
585         return tape_3590_erp_retry(device, request, irb);
586 }
587
588 /*
589  * Error Recovery read opposite
590  */
591 static int
592 tape_3590_erp_read_opposite(struct tape_device *device,
593                             struct tape_request *request, struct irb *irb)
594 {
595         switch (request->op) {
596         case TO_RFO:
597                 /*
598                  * We did read forward, but the data could not be read.
599                  * We will read backward and then skip forward again.
600                  */
601                 tape_3590_read_opposite(device, request);
602                 return tape_3590_erp_retry(device, request, irb);
603         case TO_RBA:
604                 /* We tried to read forward and backward, but hat no success */
605                 return tape_3590_erp_failed(device, request, irb, -EIO);
606                 break;
607         default:
608                 PRINT_WARN("read_opposite_recovery_called_with_op: %s\n",
609                            tape_op_verbose[request->op]);
610                 return tape_3590_erp_failed(device, request, irb, -EIO);
611         }
612 }
613
614 /*
615  * Print an MIM (Media Information  Message) (message code f0)
616  */
617 static void
618 tape_3590_print_mim_msg_f0(struct tape_device *device, struct irb *irb)
619 {
620         struct tape_3590_sense *sense;
621
622         sense = (struct tape_3590_sense *) irb->ecw;
623         /* Exception Message */
624         switch (sense->fmt.f70.emc) {
625         case 0x02:
626                 PRINT_WARN("(%s): Data degraded\n", device->cdev->dev.bus_id);
627                 break;
628         case 0x03:
629                 PRINT_WARN("(%s): Data degraded in partion %i\n",
630                            device->cdev->dev.bus_id, sense->fmt.f70.mp);
631                 break;
632         case 0x04:
633                 PRINT_WARN("(%s): Medium degraded\n", device->cdev->dev.bus_id);
634                 break;
635         case 0x05:
636                 PRINT_WARN("(%s): Medium degraded in partition %i\n",
637                            device->cdev->dev.bus_id, sense->fmt.f70.mp);
638                 break;
639         case 0x06:
640                 PRINT_WARN("(%s): Block 0 Error\n", device->cdev->dev.bus_id);
641                 break;
642         case 0x07:
643                 PRINT_WARN("(%s): Medium Exception 0x%02x\n",
644                            device->cdev->dev.bus_id, sense->fmt.f70.md);
645                 break;
646         default:
647                 PRINT_WARN("(%s): MIM ExMsg: 0x%02x\n",
648                            device->cdev->dev.bus_id, sense->fmt.f70.emc);
649                 break;
650         }
651         /* Service Message */
652         switch (sense->fmt.f70.smc) {
653         case 0x02:
654                 PRINT_WARN("(%s): Reference Media maintenance procedure %i\n",
655                            device->cdev->dev.bus_id, sense->fmt.f70.md);
656                 break;
657         default:
658                 PRINT_WARN("(%s): MIM ServiceMsg: 0x%02x\n",
659                            device->cdev->dev.bus_id, sense->fmt.f70.smc);
660                 break;
661         }
662 }
663
664 /*
665  * Print an I/O Subsystem Service Information Message (message code f1)
666  */
667 static void
668 tape_3590_print_io_sim_msg_f1(struct tape_device *device, struct irb *irb)
669 {
670         struct tape_3590_sense *sense;
671
672         sense = (struct tape_3590_sense *) irb->ecw;
673         /* Exception Message */
674         switch (sense->fmt.f71.emc) {
675         case 0x01:
676                 PRINT_WARN("(%s): Effect of failure is unknown\n",
677                            device->cdev->dev.bus_id);
678                 break;
679         case 0x02:
680                 PRINT_WARN("(%s): CU Exception - no performance impact\n",
681                            device->cdev->dev.bus_id);
682                 break;
683         case 0x03:
684                 PRINT_WARN("(%s): CU Exception on channel interface 0x%02x\n",
685                            device->cdev->dev.bus_id, sense->fmt.f71.md[0]);
686                 break;
687         case 0x04:
688                 PRINT_WARN("(%s): CU Exception on device path 0x%02x\n",
689                            device->cdev->dev.bus_id, sense->fmt.f71.md[0]);
690                 break;
691         case 0x05:
692                 PRINT_WARN("(%s): CU Exception on library path 0x%02x\n",
693                            device->cdev->dev.bus_id, sense->fmt.f71.md[0]);
694                 break;
695         case 0x06:
696                 PRINT_WARN("(%s): CU Exception on node 0x%02x\n",
697                            device->cdev->dev.bus_id, sense->fmt.f71.md[0]);
698                 break;
699         case 0x07:
700                 PRINT_WARN("(%s): CU Exception on partition 0x%02x\n",
701                            device->cdev->dev.bus_id, sense->fmt.f71.md[0]);
702                 break;
703         default:
704                 PRINT_WARN("(%s): SIM ExMsg: 0x%02x\n",
705                            device->cdev->dev.bus_id, sense->fmt.f71.emc);
706         }
707         /* Service Message */
708         switch (sense->fmt.f71.smc) {
709         case 0x01:
710                 PRINT_WARN("(%s): Repair impact is unknown\n",
711                            device->cdev->dev.bus_id);
712                 break;
713         case 0x02:
714                 PRINT_WARN("(%s): Repair will not impact cu performance\n",
715                            device->cdev->dev.bus_id);
716                 break;
717         case 0x03:
718                 if (sense->fmt.f71.mdf == 0)
719                         PRINT_WARN("(%s): Repair will disable node "
720                                    "0x%x on CU\n",
721                                    device->cdev->dev.bus_id,
722                                    sense->fmt.f71.md[1]);
723                 else
724                         PRINT_WARN("(%s): Repair will disable nodes "
725                                    "(0x%x-0x%x) on CU\n",
726                                    device->cdev->dev.bus_id,
727                                    sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
728                 break;
729         case 0x04:
730                 if (sense->fmt.f71.mdf == 0)
731                         PRINT_WARN("(%s): Repair will disable cannel path "
732                                    "0x%x on CU\n",
733                                    device->cdev->dev.bus_id,
734                                    sense->fmt.f71.md[1]);
735                 else
736                         PRINT_WARN("(%s): Repair will disable cannel paths "
737                                    "(0x%x-0x%x) on CU\n",
738                                    device->cdev->dev.bus_id,
739                                    sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
740                 break;
741         case 0x05:
742                 if (sense->fmt.f71.mdf == 0)
743                         PRINT_WARN("(%s): Repair will disable device path "
744                                    "0x%x on CU\n",
745                                    device->cdev->dev.bus_id,
746                                    sense->fmt.f71.md[1]);
747                 else
748                         PRINT_WARN("(%s): Repair will disable device paths "
749                                    "(0x%x-0x%x) on CU\n",
750                                    device->cdev->dev.bus_id,
751                                    sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
752                 break;
753         case 0x06:
754                 if (sense->fmt.f71.mdf == 0)
755                         PRINT_WARN("(%s): Repair will disable library path "
756                                    "0x%x on CU\n",
757                                    device->cdev->dev.bus_id,
758                                    sense->fmt.f71.md[1]);
759                 else
760                         PRINT_WARN("(%s): Repair will disable library paths "
761                                    "(0x%x-0x%x) on CU\n",
762                                    device->cdev->dev.bus_id,
763                                    sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
764                 break;
765         case 0x07:
766                 PRINT_WARN("(%s): Repair will disable access to CU\n",
767                            device->cdev->dev.bus_id);
768                 break;
769         default:
770                 PRINT_WARN("(%s): SIM ServiceMsg: 0x%02x\n",
771                            device->cdev->dev.bus_id, sense->fmt.f71.smc);
772         }
773 }
774
775 /*
776  * Print an Device Subsystem Service Information Message (message code f2)
777  */
778 static void
779 tape_3590_print_dev_sim_msg_f2(struct tape_device *device, struct irb *irb)
780 {
781         struct tape_3590_sense *sense;
782
783         sense = (struct tape_3590_sense *) irb->ecw;
784         /* Exception Message */
785         switch (sense->fmt.f71.emc) {
786         case 0x01:
787                 PRINT_WARN("(%s): Effect of failure is unknown\n",
788                            device->cdev->dev.bus_id);
789                 break;
790         case 0x02:
791                 PRINT_WARN("(%s): DV Exception - no performance impact\n",
792                            device->cdev->dev.bus_id);
793                 break;
794         case 0x03:
795                 PRINT_WARN("(%s): DV Exception on channel interface 0x%02x\n",
796                            device->cdev->dev.bus_id, sense->fmt.f71.md[0]);
797                 break;
798         case 0x04:
799                 PRINT_WARN("(%s): DV Exception on loader 0x%02x\n",
800                            device->cdev->dev.bus_id, sense->fmt.f71.md[0]);
801                 break;
802         case 0x05:
803                 PRINT_WARN("(%s): DV Exception on message display 0x%02x\n",
804                            device->cdev->dev.bus_id, sense->fmt.f71.md[0]);
805                 break;
806         case 0x06:
807                 PRINT_WARN("(%s): DV Exception in tape path\n",
808                            device->cdev->dev.bus_id);
809                 break;
810         case 0x07:
811                 PRINT_WARN("(%s): DV Exception in drive\n",
812                            device->cdev->dev.bus_id);
813                 break;
814         default:
815                 PRINT_WARN("(%s): DSIM ExMsg: 0x%02x\n",
816                            device->cdev->dev.bus_id, sense->fmt.f71.emc);
817         }
818         /* Service Message */
819         switch (sense->fmt.f71.smc) {
820         case 0x01:
821                 PRINT_WARN("(%s): Repair impact is unknown\n",
822                            device->cdev->dev.bus_id);
823                 break;
824         case 0x02:
825                 PRINT_WARN("(%s): Repair will not impact device performance\n",
826                            device->cdev->dev.bus_id);
827                 break;
828         case 0x03:
829                 if (sense->fmt.f71.mdf == 0)
830                         PRINT_WARN("(%s): Repair will disable channel path "
831                                    "0x%x on DV\n",
832                                    device->cdev->dev.bus_id,
833                                    sense->fmt.f71.md[1]);
834                 else
835                         PRINT_WARN("(%s): Repair will disable channel path "
836                                    "(0x%x-0x%x) on DV\n",
837                                    device->cdev->dev.bus_id,
838                                    sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
839                 break;
840         case 0x04:
841                 if (sense->fmt.f71.mdf == 0)
842                         PRINT_WARN("(%s): Repair will disable interface 0x%x "
843                                    "on DV\n",
844                                    device->cdev->dev.bus_id,
845                                    sense->fmt.f71.md[1]);
846                 else
847                         PRINT_WARN("(%s): Repair will disable interfaces "
848                                    "(0x%x-0x%x) on DV\n",
849                                    device->cdev->dev.bus_id,
850                                    sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
851                 break;
852         case 0x05:
853                 if (sense->fmt.f71.mdf == 0)
854                         PRINT_WARN("(%s): Repair will disable loader 0x%x "
855                                    "on DV\n",
856                                    device->cdev->dev.bus_id,
857                                    sense->fmt.f71.md[1]);
858                 else
859                         PRINT_WARN("(%s): Repair will disable loader "
860                                    "(0x%x-0x%x) on DV\n",
861                                    device->cdev->dev.bus_id,
862                                    sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
863                 break;
864         case 0x07:
865                 PRINT_WARN("(%s): Repair will disable access to DV\n",
866                            device->cdev->dev.bus_id);
867                 break;
868         case 0x08:
869                 if (sense->fmt.f71.mdf == 0)
870                         PRINT_WARN("(%s): Repair will disable message "
871                                    "display 0x%x on DV\n",
872                                    device->cdev->dev.bus_id,
873                                    sense->fmt.f71.md[1]);
874                 else
875                         PRINT_WARN("(%s): Repair will disable message "
876                                    "displays (0x%x-0x%x) on DV\n",
877                                    device->cdev->dev.bus_id,
878                                    sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
879                 break;
880         case 0x09:
881                 PRINT_WARN("(%s): Clean DV\n", device->cdev->dev.bus_id);
882                 break;
883         default:
884                 PRINT_WARN("(%s): DSIM ServiceMsg: 0x%02x\n",
885                            device->cdev->dev.bus_id, sense->fmt.f71.smc);
886         }
887 }
888
889 /*
890  * Print standard ERA Message
891  */
892 static void
893 tape_3590_print_era_msg(struct tape_device *device, struct irb *irb)
894 {
895         struct tape_3590_sense *sense;
896
897         sense = (struct tape_3590_sense *) irb->ecw;
898         if (sense->mc == 0)
899                 return;
900         if ((sense->mc > 0) && (sense->mc < TAPE_3590_MAX_MSG)) {
901                 if (tape_3590_msg[sense->mc] != NULL)
902                         PRINT_WARN("(%s): %s\n", device->cdev->dev.bus_id,
903                                    tape_3590_msg[sense->mc]);
904                 else {
905                         PRINT_WARN("(%s): Message Code 0x%x\n",
906                                    device->cdev->dev.bus_id, sense->mc);
907                 }
908                 return;
909         }
910         if (sense->mc == 0xf0) {
911                 /* Standard Media Information Message */
912                 PRINT_WARN("(%s): MIM SEV=%i, MC=%02x, ES=%x/%x, "
913                            "RC=%02x-%04x-%02x\n", device->cdev->dev.bus_id,
914                            sense->fmt.f70.sev, sense->mc,
915                            sense->fmt.f70.emc, sense->fmt.f70.smc,
916                            sense->fmt.f70.refcode, sense->fmt.f70.mid,
917                            sense->fmt.f70.fid);
918                 tape_3590_print_mim_msg_f0(device, irb);
919                 return;
920         }
921         if (sense->mc == 0xf1) {
922                 /* Standard I/O Subsystem Service Information Message */
923                 PRINT_WARN("(%s): IOSIM SEV=%i, DEVTYPE=3590/%02x, "
924                            "MC=%02x, ES=%x/%x, REF=0x%04x-0x%04x-0x%04x\n",
925                            device->cdev->dev.bus_id, sense->fmt.f71.sev,
926                            device->cdev->id.dev_model,
927                            sense->mc, sense->fmt.f71.emc,
928                            sense->fmt.f71.smc, sense->fmt.f71.refcode1,
929                            sense->fmt.f71.refcode2, sense->fmt.f71.refcode3);
930                 tape_3590_print_io_sim_msg_f1(device, irb);
931                 return;
932         }
933         if (sense->mc == 0xf2) {
934                 /* Standard Device Service Information Message */
935                 PRINT_WARN("(%s): DEVSIM SEV=%i, DEVTYPE=3590/%02x, "
936                            "MC=%02x, ES=%x/%x, REF=0x%04x-0x%04x-0x%04x\n",
937                            device->cdev->dev.bus_id, sense->fmt.f71.sev,
938                            device->cdev->id.dev_model,
939                            sense->mc, sense->fmt.f71.emc,
940                            sense->fmt.f71.smc, sense->fmt.f71.refcode1,
941                            sense->fmt.f71.refcode2, sense->fmt.f71.refcode3);
942                 tape_3590_print_dev_sim_msg_f2(device, irb);
943                 return;
944         }
945         if (sense->mc == 0xf3) {
946                 /* Standard Library Service Information Message */
947                 return;
948         }
949         PRINT_WARN("(%s): Device Message(%x)\n",
950                    device->cdev->dev.bus_id, sense->mc);
951 }
952
953 /*
954  *  3590 error Recovery routine:
955  *  If possible, it tries to recover from the error. If this is not possible,
956  *  inform the user about the problem.
957  */
958 static int
959 tape_3590_unit_check(struct tape_device *device, struct tape_request *request,
960                      struct irb *irb)
961 {
962         struct tape_3590_sense *sense;
963         int rc;
964
965 #ifdef CONFIG_S390_TAPE_BLOCK
966         if (request->op == TO_BLOCK) {
967                 /*
968                  * Recovery for block device requests. Set the block_position
969                  * to something invalid and retry.
970                  */
971                 device->blk_data.block_position = -1;
972                 if (request->retries-- <= 0)
973                         return tape_3590_erp_failed(device, request, irb, -EIO);
974                 else
975                         return tape_3590_erp_retry(device, request, irb);
976         }
977 #endif
978
979         sense = (struct tape_3590_sense *) irb->ecw;
980
981         /*
982          * First check all RC-QRCs where we want to do something special
983          *   - "break":     basic error recovery is done
984          *   - "goto out:": just print error message if available
985          */
986         rc = -EIO;
987         switch (sense->rc_rqc) {
988
989         case 0x1110:
990                 tape_3590_print_era_msg(device, irb);
991                 return tape_3590_erp_read_buf_log(device, request, irb);
992
993         case 0x2011:
994                 tape_3590_print_era_msg(device, irb);
995                 return tape_3590_erp_read_alternate(device, request, irb);
996
997         case 0x2230:
998         case 0x2231:
999                 tape_3590_print_era_msg(device, irb);
1000                 return tape_3590_erp_special_interrupt(device, request, irb);
1001
1002         case 0x3010:
1003                 DBF_EVENT(2, "(%08x): Backward at Beginning of Partition\n",
1004                           device->cdev_id);
1005                 return tape_3590_erp_basic(device, request, irb, -ENOSPC);
1006         case 0x3012:
1007                 DBF_EVENT(2, "(%08x): Forward at End of Partition\n",
1008                           device->cdev_id);
1009                 return tape_3590_erp_basic(device, request, irb, -ENOSPC);
1010         case 0x3020:
1011                 DBF_EVENT(2, "(%08x): End of Data Mark\n", device->cdev_id);
1012                 return tape_3590_erp_basic(device, request, irb, -ENOSPC);
1013
1014         case 0x3122:
1015                 DBF_EVENT(2, "(%08x): Rewind Unload initiated\n",
1016                           device->cdev_id);
1017                 return tape_3590_erp_basic(device, request, irb, -EIO);
1018         case 0x3123:
1019                 DBF_EVENT(2, "(%08x): Rewind Unload complete\n",
1020                           device->cdev_id);
1021                 tape_med_state_set(device, MS_UNLOADED);
1022                 return tape_3590_erp_basic(device, request, irb, 0);
1023
1024         case 0x4010:
1025                 /*
1026                  * print additional msg since default msg
1027                  * "device intervention" is not very meaningfull
1028                  */
1029                 PRINT_WARN("(%s): Tape operation when medium not loaded\n",
1030                            device->cdev->dev.bus_id);
1031                 tape_med_state_set(device, MS_UNLOADED);
1032                 return tape_3590_erp_basic(device, request, irb, -ENOMEDIUM);
1033         case 0x4012:            /* Device Long Busy */
1034                 tape_3590_print_era_msg(device, irb);
1035                 return tape_3590_erp_long_busy(device, request, irb);
1036
1037         case 0x5010:
1038                 if (sense->rac == 0xd0) {
1039                         /* Swap */
1040                         tape_3590_print_era_msg(device, irb);
1041                         return tape_3590_erp_swap(device, request, irb);
1042                 }
1043                 if (sense->rac == 0x26) {
1044                         /* Read Opposite */
1045                         tape_3590_print_era_msg(device, irb);
1046                         return tape_3590_erp_read_opposite(device, request,
1047                                                            irb);
1048                 }
1049                 return tape_3590_erp_basic(device, request, irb, -EIO);
1050         case 0x5020:
1051         case 0x5021:
1052         case 0x5022:
1053         case 0x5040:
1054         case 0x5041:
1055         case 0x5042:
1056                 tape_3590_print_era_msg(device, irb);
1057                 return tape_3590_erp_swap(device, request, irb);
1058
1059         case 0x5110:
1060         case 0x5111:
1061                 return tape_3590_erp_basic(device, request, irb, -EMEDIUMTYPE);
1062
1063         case 0x5120:
1064         case 0x1120:
1065                 tape_med_state_set(device, MS_UNLOADED);
1066                 return tape_3590_erp_basic(device, request, irb, -ENOMEDIUM);
1067
1068         case 0x6020:
1069                 PRINT_WARN("(%s): Cartridge of wrong type ?\n",
1070                            device->cdev->dev.bus_id);
1071                 return tape_3590_erp_basic(device, request, irb, -EMEDIUMTYPE);
1072
1073         case 0x8011:
1074                 PRINT_WARN("(%s): Another host has reserved the tape device\n",
1075                            device->cdev->dev.bus_id);
1076                 return tape_3590_erp_basic(device, request, irb, -EPERM);
1077         case 0x8013:
1078                 PRINT_WARN("(%s): Another host has priviliged access to the "
1079                            "tape device\n", device->cdev->dev.bus_id);
1080                 PRINT_WARN("(%s): To solve the problem unload the current "
1081                            "cartridge!\n", device->cdev->dev.bus_id);
1082                 return tape_3590_erp_basic(device, request, irb, -EPERM);
1083         default:
1084                 return tape_3590_erp_basic(device, request, irb, -EIO);
1085         }
1086 }
1087
1088 /*
1089  * 3590 interrupt handler:
1090  */
1091 static int
1092 tape_3590_irq(struct tape_device *device, struct tape_request *request,
1093               struct irb *irb)
1094 {
1095         if (request == NULL)
1096                 return tape_3590_unsolicited_irq(device, irb);
1097
1098         if ((irb->scsw.dstat & DEV_STAT_UNIT_EXCEP) &&
1099             (irb->scsw.dstat & DEV_STAT_DEV_END) && (request->op == TO_WRI)) {
1100                 /* Write at end of volume */
1101                 DBF_EVENT(2, "End of volume\n");
1102                 return tape_3590_erp_failed(device, request, irb, -ENOSPC);
1103         }
1104
1105         if (irb->scsw.dstat & DEV_STAT_UNIT_CHECK)
1106                 return tape_3590_unit_check(device, request, irb);
1107
1108         if (irb->scsw.dstat & DEV_STAT_DEV_END) {
1109                 if (irb->scsw.dstat == DEV_STAT_UNIT_EXCEP) {
1110                         if (request->op == TO_FSB || request->op == TO_BSB)
1111                                 request->rescnt++;
1112                         else
1113                                 DBF_EVENT(5, "Unit Exception!\n");
1114                 }
1115
1116                 return tape_3590_done(device, request);
1117         }
1118
1119         if (irb->scsw.dstat & DEV_STAT_CHN_END) {
1120                 DBF_EVENT(2, "cannel end\n");
1121                 return TAPE_IO_PENDING;
1122         }
1123
1124         if (irb->scsw.dstat & DEV_STAT_ATTENTION) {
1125                 DBF_EVENT(2, "Unit Attention when busy..\n");
1126                 return TAPE_IO_PENDING;
1127         }
1128
1129         DBF_EVENT(6, "xunknownirq\n");
1130         PRINT_ERR("Unexpected interrupt.\n");
1131         PRINT_ERR("Current op is: %s", tape_op_verbose[request->op]);
1132         tape_dump_sense(device, request, irb);
1133         return TAPE_IO_STOP;
1134 }
1135
1136 /*
1137  * Setup device function
1138  */
1139 static int
1140 tape_3590_setup_device(struct tape_device *device)
1141 {
1142         int rc;
1143         struct tape_3590_disc_data *data;
1144
1145         DBF_EVENT(6, "3590 device setup\n");
1146         data = kmalloc(sizeof(struct tape_3590_disc_data),
1147                        GFP_KERNEL | GFP_DMA);
1148         if (data == NULL)
1149                 return -ENOMEM;
1150         data->read_back_op = READ_PREVIOUS;
1151         device->discdata = data;
1152
1153         if ((rc = tape_std_assign(device)) == 0) {
1154                 /* Try to find out if medium is loaded */
1155                 if ((rc = tape_3590_sense_medium(device)) != 0)
1156                         DBF_LH(3, "3590 medium sense returned %d\n", rc);
1157         }
1158
1159         return rc;
1160 }
1161
1162 /*
1163  * Cleanup device function
1164  */
1165 static void
1166 tape_3590_cleanup_device(struct tape_device *device)
1167 {
1168         flush_scheduled_work();
1169         tape_std_unassign(device);
1170
1171         kfree(device->discdata);
1172         device->discdata = NULL;
1173 }
1174
1175 /*
1176  * List of 3590 magnetic tape commands.
1177  */
1178 static tape_mtop_fn tape_3590_mtop[TAPE_NR_MTOPS] = {
1179         [MTRESET]        = tape_std_mtreset,
1180         [MTFSF]          = tape_std_mtfsf,
1181         [MTBSF]          = tape_std_mtbsf,
1182         [MTFSR]          = tape_std_mtfsr,
1183         [MTBSR]          = tape_std_mtbsr,
1184         [MTWEOF]         = tape_std_mtweof,
1185         [MTREW]          = tape_std_mtrew,
1186         [MTOFFL]         = tape_std_mtoffl,
1187         [MTNOP]          = tape_std_mtnop,
1188         [MTRETEN]        = tape_std_mtreten,
1189         [MTBSFM]         = tape_std_mtbsfm,
1190         [MTFSFM]         = tape_std_mtfsfm,
1191         [MTEOM]          = tape_std_mteom,
1192         [MTERASE]        = tape_std_mterase,
1193         [MTRAS1]         = NULL,
1194         [MTRAS2]         = NULL,
1195         [MTRAS3]         = NULL,
1196         [MTSETBLK]       = tape_std_mtsetblk,
1197         [MTSETDENSITY]   = NULL,
1198         [MTSEEK]         = tape_3590_mtseek,
1199         [MTTELL]         = tape_3590_mttell,
1200         [MTSETDRVBUFFER] = NULL,
1201         [MTFSS]          = NULL,
1202         [MTBSS]          = NULL,
1203         [MTWSM]          = NULL,
1204         [MTLOCK]         = NULL,
1205         [MTUNLOCK]       = NULL,
1206         [MTLOAD]         = tape_std_mtload,
1207         [MTUNLOAD]       = tape_std_mtunload,
1208         [MTCOMPRESSION]  = tape_std_mtcompression,
1209         [MTSETPART]      = NULL,
1210         [MTMKPART]       = NULL
1211 };
1212
1213 /*
1214  * Tape discipline structure for 3590.
1215  */
1216 static struct tape_discipline tape_discipline_3590 = {
1217         .owner = THIS_MODULE,
1218         .setup_device = tape_3590_setup_device,
1219         .cleanup_device = tape_3590_cleanup_device,
1220         .process_eov = tape_std_process_eov,
1221         .irq = tape_3590_irq,
1222         .read_block = tape_std_read_block,
1223         .write_block = tape_std_write_block,
1224 #ifdef CONFIG_S390_TAPE_BLOCK
1225         .bread = tape_3590_bread,
1226         .free_bread = tape_3590_free_bread,
1227         .check_locate = tape_3590_check_locate,
1228 #endif
1229         .ioctl_fn = tape_3590_ioctl,
1230         .mtop_array = tape_3590_mtop
1231 };
1232
1233 static struct ccw_device_id tape_3590_ids[] = {
1234         {CCW_DEVICE_DEVTYPE(0x3590, 0, 0x3590, 0), .driver_info = tape_3590},
1235         {CCW_DEVICE_DEVTYPE(0x3592, 0, 0x3592, 0), .driver_info = tape_3592},
1236         { /* end of list */ }
1237 };
1238
1239 static int
1240 tape_3590_online(struct ccw_device *cdev)
1241 {
1242         return tape_generic_online(cdev->dev.driver_data,
1243                                    &tape_discipline_3590);
1244 }
1245
1246 static int
1247 tape_3590_offline(struct ccw_device *cdev)
1248 {
1249         return tape_generic_offline(cdev->dev.driver_data);
1250 }
1251
1252 static struct ccw_driver tape_3590_driver = {
1253         .name = "tape_3590",
1254         .owner = THIS_MODULE,
1255         .ids = tape_3590_ids,
1256         .probe = tape_generic_probe,
1257         .remove = tape_generic_remove,
1258         .set_offline = tape_3590_offline,
1259         .set_online = tape_3590_online,
1260 };
1261
1262 /*
1263  * Setup discipline structure.
1264  */
1265 static int
1266 tape_3590_init(void)
1267 {
1268         int rc;
1269
1270         TAPE_DBF_AREA = debug_register("tape_3590", 2, 2, 4 * sizeof(long));
1271         debug_register_view(TAPE_DBF_AREA, &debug_sprintf_view);
1272 #ifdef DBF_LIKE_HELL
1273         debug_set_level(TAPE_DBF_AREA, 6);
1274 #endif
1275
1276         DBF_EVENT(3, "3590 init\n");
1277         /* Register driver for 3590 tapes. */
1278         rc = ccw_driver_register(&tape_3590_driver);
1279         if (rc)
1280                 DBF_EVENT(3, "3590 init failed\n");
1281         else
1282                 DBF_EVENT(3, "3590 registered\n");
1283         return rc;
1284 }
1285
1286 static void
1287 tape_3590_exit(void)
1288 {
1289         ccw_driver_unregister(&tape_3590_driver);
1290
1291         debug_unregister(TAPE_DBF_AREA);
1292 }
1293
1294 MODULE_DEVICE_TABLE(ccw, tape_3590_ids);
1295 MODULE_AUTHOR("(C) 2001,2006 IBM Corporation");
1296 MODULE_DESCRIPTION("Linux on zSeries channel attached 3590 tape device driver");
1297 MODULE_LICENSE("GPL");
1298
1299 module_init(tape_3590_init);
1300 module_exit(tape_3590_exit);