[S390] rename NT_PRXSTATUS to NT_S390_HIGHREGS
[deliverable/linux.git] / drivers / s390 / char / tape_core.c
CommitLineData
1da177e4
LT
1/*
2 * drivers/s390/char/tape_core.c
3 * basic function of the tape device driver
4 *
5 * S390 and zSeries version
3ef32e62 6 * Copyright IBM Corp. 2001, 2009
1da177e4
LT
7 * Author(s): Carsten Otte <cotte@de.ibm.com>
8 * Michael Holzheu <holzheu@de.ibm.com>
9 * Tuan Ngo-Anh <ngoanh@de.ibm.com>
10 * Martin Schwidefsky <schwidefsky@de.ibm.com>
4111796d 11 * Stefan Bader <shbader@de.ibm.com>
1da177e4
LT
12 */
13
ab640db0 14#define KMSG_COMPONENT "tape"
1da177e4
LT
15#include <linux/module.h>
16#include <linux/init.h> // for kernel parameters
17#include <linux/kmod.h> // for requesting modules
18#include <linux/spinlock.h> // for locks
19#include <linux/vmalloc.h>
20#include <linux/list.h>
21
22#include <asm/types.h> // for variable types
23
24#define TAPE_DBF_AREA tape_core_dbf
25
26#include "tape.h"
27#include "tape_std.h"
28
cced1dd4 29#define LONG_BUSY_TIMEOUT 180 /* seconds */
1da177e4
LT
30
31static void __tape_do_irq (struct ccw_device *, unsigned long, struct irb *);
c1637532 32static void tape_delayed_next_request(struct work_struct *);
cced1dd4 33static void tape_long_busy_timeout(unsigned long data);
1da177e4
LT
34
35/*
36 * One list to contain all tape devices of all disciplines, so
37 * we can assign the devices to minor numbers of the same major
38 * The list is protected by the rwlock
39 */
c11ca97e 40static LIST_HEAD(tape_device_list);
1da177e4
LT
41static DEFINE_RWLOCK(tape_device_lock);
42
43/*
44 * Pointer to debug area.
45 */
46debug_info_t *TAPE_DBF_AREA = NULL;
47EXPORT_SYMBOL(TAPE_DBF_AREA);
48
49/*
50 * Printable strings for tape enumerations.
51 */
52const char *tape_state_verbose[TS_SIZE] =
53{
54 [TS_UNUSED] = "UNUSED",
55 [TS_IN_USE] = "IN_USE",
56 [TS_BLKUSE] = "BLKUSE",
57 [TS_INIT] = "INIT ",
58 [TS_NOT_OPER] = "NOT_OP"
59};
60
61const char *tape_op_verbose[TO_SIZE] =
62{
63 [TO_BLOCK] = "BLK", [TO_BSB] = "BSB",
64 [TO_BSF] = "BSF", [TO_DSE] = "DSE",
65 [TO_FSB] = "FSB", [TO_FSF] = "FSF",
66 [TO_LBL] = "LBL", [TO_NOP] = "NOP",
67 [TO_RBA] = "RBA", [TO_RBI] = "RBI",
68 [TO_RFO] = "RFO", [TO_REW] = "REW",
69 [TO_RUN] = "RUN", [TO_WRI] = "WRI",
70 [TO_WTM] = "WTM", [TO_MSEN] = "MSN",
71 [TO_LOAD] = "LOA", [TO_READ_CONFIG] = "RCF",
72 [TO_READ_ATTMSG] = "RAT",
73 [TO_DIS] = "DIS", [TO_ASSIGN] = "ASS",
cced1dd4
MH
74 [TO_UNASSIGN] = "UAS", [TO_CRYPT_ON] = "CON",
75 [TO_CRYPT_OFF] = "COF", [TO_KEKL_SET] = "KLS",
e2963062 76 [TO_KEKL_QUERY] = "KLQ",[TO_RDC] = "RDC",
1da177e4
LT
77};
78
f455adcf 79static int devid_to_int(struct ccw_dev_id *dev_id)
1da177e4 80{
f455adcf 81 return dev_id->devno + (dev_id->ssid << 16);
1da177e4
LT
82}
83
84/*
85 * Some channel attached tape specific attributes.
86 *
87 * FIXME: In the future the first_minor and blocksize attribute should be
88 * replaced by a link to the cdev tree.
89 */
90static ssize_t
3fd3c0a5 91tape_medium_state_show(struct device *dev, struct device_attribute *attr, char *buf)
1da177e4
LT
92{
93 struct tape_device *tdev;
94
dff59b64 95 tdev = dev_get_drvdata(dev);
1da177e4
LT
96 return scnprintf(buf, PAGE_SIZE, "%i\n", tdev->medium_state);
97}
98
99static
100DEVICE_ATTR(medium_state, 0444, tape_medium_state_show, NULL);
101
102static ssize_t
3fd3c0a5 103tape_first_minor_show(struct device *dev, struct device_attribute *attr, char *buf)
1da177e4
LT
104{
105 struct tape_device *tdev;
106
dff59b64 107 tdev = dev_get_drvdata(dev);
1da177e4
LT
108 return scnprintf(buf, PAGE_SIZE, "%i\n", tdev->first_minor);
109}
110
111static
112DEVICE_ATTR(first_minor, 0444, tape_first_minor_show, NULL);
113
114static ssize_t
3fd3c0a5 115tape_state_show(struct device *dev, struct device_attribute *attr, char *buf)
1da177e4
LT
116{
117 struct tape_device *tdev;
118
dff59b64 119 tdev = dev_get_drvdata(dev);
1da177e4
LT
120 return scnprintf(buf, PAGE_SIZE, "%s\n", (tdev->first_minor < 0) ?
121 "OFFLINE" : tape_state_verbose[tdev->tape_state]);
122}
123
124static
125DEVICE_ATTR(state, 0444, tape_state_show, NULL);
126
127static ssize_t
3fd3c0a5 128tape_operation_show(struct device *dev, struct device_attribute *attr, char *buf)
1da177e4
LT
129{
130 struct tape_device *tdev;
131 ssize_t rc;
132
dff59b64 133 tdev = dev_get_drvdata(dev);
1da177e4
LT
134 if (tdev->first_minor < 0)
135 return scnprintf(buf, PAGE_SIZE, "N/A\n");
136
137 spin_lock_irq(get_ccwdev_lock(tdev->cdev));
138 if (list_empty(&tdev->req_queue))
139 rc = scnprintf(buf, PAGE_SIZE, "---\n");
140 else {
141 struct tape_request *req;
142
143 req = list_entry(tdev->req_queue.next, struct tape_request,
144 list);
145 rc = scnprintf(buf,PAGE_SIZE, "%s\n", tape_op_verbose[req->op]);
146 }
147 spin_unlock_irq(get_ccwdev_lock(tdev->cdev));
148 return rc;
149}
150
151static
152DEVICE_ATTR(operation, 0444, tape_operation_show, NULL);
153
154static ssize_t
3fd3c0a5 155tape_blocksize_show(struct device *dev, struct device_attribute *attr, char *buf)
1da177e4
LT
156{
157 struct tape_device *tdev;
158
dff59b64 159 tdev = dev_get_drvdata(dev);
1da177e4
LT
160
161 return scnprintf(buf, PAGE_SIZE, "%i\n", tdev->char_data.block_size);
162}
163
164static
165DEVICE_ATTR(blocksize, 0444, tape_blocksize_show, NULL);
166
167static struct attribute *tape_attrs[] = {
168 &dev_attr_medium_state.attr,
169 &dev_attr_first_minor.attr,
170 &dev_attr_state.attr,
171 &dev_attr_operation.attr,
172 &dev_attr_blocksize.attr,
173 NULL
174};
175
176static struct attribute_group tape_attr_group = {
177 .attrs = tape_attrs,
178};
179
180/*
181 * Tape state functions
182 */
183void
184tape_state_set(struct tape_device *device, enum tape_state newstate)
185{
186 const char *str;
187
188 if (device->tape_state == TS_NOT_OPER) {
189 DBF_EVENT(3, "ts_set err: not oper\n");
190 return;
191 }
192 DBF_EVENT(4, "ts. dev: %x\n", device->first_minor);
f976069a
PO
193 DBF_EVENT(4, "old ts:\t\n");
194 if (device->tape_state < TS_SIZE && device->tape_state >=0 )
1da177e4
LT
195 str = tape_state_verbose[device->tape_state];
196 else
197 str = "UNKNOWN TS";
198 DBF_EVENT(4, "%s\n", str);
199 DBF_EVENT(4, "new ts:\t\n");
f976069a 200 if (newstate < TS_SIZE && newstate >= 0)
1da177e4
LT
201 str = tape_state_verbose[newstate];
202 else
203 str = "UNKNOWN TS";
204 DBF_EVENT(4, "%s\n", str);
205 device->tape_state = newstate;
206 wake_up(&device->state_change_wq);
207}
208
209void
210tape_med_state_set(struct tape_device *device, enum tape_medium_state newstate)
211{
212 if (device->medium_state == newstate)
213 return;
214 switch(newstate){
215 case MS_UNLOADED:
216 device->tape_generic_status |= GMT_DR_OPEN(~0);
53f8c573 217 if (device->medium_state == MS_LOADED)
59e36927
MH
218 pr_info("%s: The tape cartridge has been successfully "
219 "unloaded\n", dev_name(&device->cdev->dev));
1da177e4
LT
220 break;
221 case MS_LOADED:
222 device->tape_generic_status &= ~GMT_DR_OPEN(~0);
53f8c573 223 if (device->medium_state == MS_UNLOADED)
59e36927
MH
224 pr_info("%s: A tape cartridge has been mounted\n",
225 dev_name(&device->cdev->dev));
1da177e4
LT
226 break;
227 default:
228 // print nothing
229 break;
230 }
231 device->medium_state = newstate;
232 wake_up(&device->state_change_wq);
233}
234
235/*
236 * Stop running ccw. Has to be called with the device lock held.
237 */
4d284cac 238static int
4111796d 239__tape_cancel_io(struct tape_device *device, struct tape_request *request)
1da177e4
LT
240{
241 int retries;
242 int rc;
243
244 /* Check if interrupt has already been processed */
245 if (request->callback == NULL)
246 return 0;
247
248 rc = 0;
249 for (retries = 0; retries < 5; retries++) {
250 rc = ccw_device_clear(device->cdev, (long) request);
251
4111796d
SB
252 switch (rc) {
253 case 0:
254 request->status = TAPE_REQUEST_DONE;
255 return 0;
256 case -EBUSY:
257 request->status = TAPE_REQUEST_CANCEL;
c1637532 258 schedule_delayed_work(&device->tape_dnr, 0);
4111796d
SB
259 return 0;
260 case -ENODEV:
261 DBF_EXCEPTION(2, "device gone, retry\n");
262 break;
263 case -EIO:
264 DBF_EXCEPTION(2, "I/O error, retry\n");
265 break;
266 default:
267 BUG();
1da177e4 268 }
1da177e4
LT
269 }
270
271 return rc;
272}
273
274/*
275 * Add device into the sorted list, giving it the first
276 * available minor number.
277 */
278static int
279tape_assign_minor(struct tape_device *device)
280{
281 struct tape_device *tmp;
282 int minor;
283
284 minor = 0;
285 write_lock(&tape_device_lock);
286 list_for_each_entry(tmp, &tape_device_list, node) {
287 if (minor < tmp->first_minor)
288 break;
289 minor += TAPE_MINORS_PER_DEV;
290 }
291 if (minor >= 256) {
292 write_unlock(&tape_device_lock);
293 return -ENODEV;
294 }
295 device->first_minor = minor;
296 list_add_tail(&device->node, &tmp->node);
297 write_unlock(&tape_device_lock);
298 return 0;
299}
300
301/* remove device from the list */
302static void
303tape_remove_minor(struct tape_device *device)
304{
305 write_lock(&tape_device_lock);
306 list_del_init(&device->node);
307 device->first_minor = -1;
308 write_unlock(&tape_device_lock);
309}
310
311/*
312 * Set a device online.
313 *
314 * This function is called by the common I/O layer to move a device from the
315 * detected but offline into the online state.
316 * If we return an error (RC < 0) the device remains in the offline state. This
317 * can happen if the device is assigned somewhere else, for example.
318 */
319int
320tape_generic_online(struct tape_device *device,
321 struct tape_discipline *discipline)
322{
323 int rc;
324
325 DBF_LH(6, "tape_enable_device(%p, %p)\n", device, discipline);
326
327 if (device->tape_state != TS_INIT) {
328 DBF_LH(3, "Tapestate not INIT (%d)\n", device->tape_state);
329 return -EINVAL;
330 }
331
cced1dd4
MH
332 init_timer(&device->lb_timeout);
333 device->lb_timeout.function = tape_long_busy_timeout;
334
1da177e4
LT
335 /* Let the discipline have a go at the device. */
336 device->discipline = discipline;
337 if (!try_module_get(discipline->owner)) {
1da177e4
LT
338 return -EINVAL;
339 }
340
341 rc = discipline->setup_device(device);
342 if (rc)
343 goto out;
344 rc = tape_assign_minor(device);
345 if (rc)
346 goto out_discipline;
347
348 rc = tapechar_setup_device(device);
349 if (rc)
350 goto out_minor;
351 rc = tapeblock_setup_device(device);
352 if (rc)
353 goto out_char;
354
355 tape_state_set(device, TS_UNUSED);
356
357 DBF_LH(3, "(%08x): Drive set online\n", device->cdev_id);
358
359 return 0;
360
361out_char:
362 tapechar_cleanup_device(device);
68d36bdb
RK
363out_minor:
364 tape_remove_minor(device);
1da177e4
LT
365out_discipline:
366 device->discipline->cleanup_device(device);
367 device->discipline = NULL;
1da177e4
LT
368out:
369 module_put(discipline->owner);
370 return rc;
371}
372
4d284cac 373static void
1da177e4
LT
374tape_cleanup_device(struct tape_device *device)
375{
376 tapeblock_cleanup_device(device);
377 tapechar_cleanup_device(device);
378 device->discipline->cleanup_device(device);
379 module_put(device->discipline->owner);
380 tape_remove_minor(device);
381 tape_med_state_set(device, MS_UNKNOWN);
382}
383
3ef32e62
FM
384/*
385 * Suspend device.
386 *
387 * Called by the common I/O layer if the drive should be suspended on user
388 * request. We refuse to suspend if the device is loaded or in use for the
389 * following reason:
390 * While the Linux guest is suspended, it might be logged off which causes
391 * devices to be detached. Tape devices are automatically rewound and unloaded
392 * during DETACH processing (unless the tape device was attached with the
393 * NOASSIGN or MULTIUSER option). After rewind/unload, there is no way to
394 * resume the original state of the tape device, since we would need to
395 * manually re-load the cartridge which was active at suspend time.
396 */
397int tape_generic_pm_suspend(struct ccw_device *cdev)
398{
399 struct tape_device *device;
400
4f0076f7 401 device = dev_get_drvdata(&cdev->dev);
3ef32e62
FM
402 if (!device) {
403 return -ENODEV;
404 }
405
406 DBF_LH(3, "(%08x): tape_generic_pm_suspend(%p)\n",
407 device->cdev_id, device);
408
409 if (device->medium_state != MS_UNLOADED) {
410 pr_err("A cartridge is loaded in tape device %s, "
411 "refusing to suspend\n", dev_name(&cdev->dev));
412 return -EBUSY;
413 }
414
415 spin_lock_irq(get_ccwdev_lock(device->cdev));
416 switch (device->tape_state) {
417 case TS_INIT:
418 case TS_NOT_OPER:
419 case TS_UNUSED:
420 spin_unlock_irq(get_ccwdev_lock(device->cdev));
421 break;
422 default:
423 pr_err("Tape device %s is busy, refusing to "
424 "suspend\n", dev_name(&cdev->dev));
425 spin_unlock_irq(get_ccwdev_lock(device->cdev));
426 return -EBUSY;
427 }
428
429 DBF_LH(3, "(%08x): Drive suspended.\n", device->cdev_id);
430 return 0;
431}
432
1da177e4
LT
433/*
434 * Set device offline.
435 *
436 * Called by the common I/O layer if the drive should set offline on user
437 * request. We may prevent this by returning an error.
438 * Manual offline is only allowed while the drive is not in use.
439 */
440int
4d7a3cdf 441tape_generic_offline(struct ccw_device *cdev)
1da177e4 442{
4d7a3cdf
FM
443 struct tape_device *device;
444
dff59b64 445 device = dev_get_drvdata(&cdev->dev);
1da177e4 446 if (!device) {
1da177e4
LT
447 return -ENODEV;
448 }
449
450 DBF_LH(3, "(%08x): tape_generic_offline(%p)\n",
451 device->cdev_id, device);
452
453 spin_lock_irq(get_ccwdev_lock(device->cdev));
454 switch (device->tape_state) {
455 case TS_INIT:
456 case TS_NOT_OPER:
457 spin_unlock_irq(get_ccwdev_lock(device->cdev));
458 break;
459 case TS_UNUSED:
460 tape_state_set(device, TS_INIT);
461 spin_unlock_irq(get_ccwdev_lock(device->cdev));
462 tape_cleanup_device(device);
463 break;
464 default:
465 DBF_EVENT(3, "(%08x): Set offline failed "
466 "- drive in use.\n",
467 device->cdev_id);
1da177e4
LT
468 spin_unlock_irq(get_ccwdev_lock(device->cdev));
469 return -EBUSY;
470 }
471
472 DBF_LH(3, "(%08x): Drive set offline.\n", device->cdev_id);
473 return 0;
474}
475
476/*
477 * Allocate memory for a new device structure.
478 */
479static struct tape_device *
480tape_alloc_device(void)
481{
482 struct tape_device *device;
483
88abaab4 484 device = kzalloc(sizeof(struct tape_device), GFP_KERNEL);
1da177e4
LT
485 if (device == NULL) {
486 DBF_EXCEPTION(2, "ti:no mem\n");
1da177e4
LT
487 return ERR_PTR(-ENOMEM);
488 }
88abaab4 489 device->modeset_byte = kmalloc(1, GFP_KERNEL | GFP_DMA);
1da177e4
LT
490 if (device->modeset_byte == NULL) {
491 DBF_EXCEPTION(2, "ti:no mem\n");
1da177e4
LT
492 kfree(device);
493 return ERR_PTR(-ENOMEM);
494 }
369a4632 495 mutex_init(&device->mutex);
1da177e4
LT
496 INIT_LIST_HEAD(&device->req_queue);
497 INIT_LIST_HEAD(&device->node);
498 init_waitqueue_head(&device->state_change_wq);
4657fb8a 499 init_waitqueue_head(&device->wait_queue);
1da177e4
LT
500 device->tape_state = TS_INIT;
501 device->medium_state = MS_UNKNOWN;
502 *device->modeset_byte = 0;
503 device->first_minor = -1;
504 atomic_set(&device->ref_count, 1);
c1637532 505 INIT_DELAYED_WORK(&device->tape_dnr, tape_delayed_next_request);
1da177e4
LT
506
507 return device;
508}
509
510/*
511 * Get a reference to an existing device structure. This will automatically
512 * increment the reference count.
513 */
514struct tape_device *
8fd138c3 515tape_get_device(struct tape_device *device)
1da177e4 516{
8fd138c3 517 int count;
1da177e4 518
8fd138c3
MS
519 count = atomic_inc_return(&device->ref_count);
520 DBF_EVENT(4, "tape_get_device(%p) = %i\n", device, count);
1da177e4
LT
521 return device;
522}
523
524/*
525 * Decrease the reference counter of a devices structure. If the
526 * reference counter reaches zero free the device structure.
527 * The function returns a NULL pointer to be used by the caller
528 * for clearing reference pointers.
529 */
8fd138c3 530void
1da177e4
LT
531tape_put_device(struct tape_device *device)
532{
8fd138c3 533 int count;
1da177e4 534
8fd138c3
MS
535 count = atomic_dec_return(&device->ref_count);
536 DBF_EVENT(4, "tape_put_device(%p) -> %i\n", device, count);
537 BUG_ON(count < 0);
538 if (count == 0) {
539 kfree(device->modeset_byte);
540 kfree(device);
1da177e4 541 }
1da177e4
LT
542}
543
544/*
545 * Find tape device by a device index.
546 */
547struct tape_device *
8fd138c3 548tape_find_device(int devindex)
1da177e4
LT
549{
550 struct tape_device *device, *tmp;
551
552 device = ERR_PTR(-ENODEV);
553 read_lock(&tape_device_lock);
554 list_for_each_entry(tmp, &tape_device_list, node) {
555 if (tmp->first_minor / TAPE_MINORS_PER_DEV == devindex) {
8fd138c3 556 device = tape_get_device(tmp);
1da177e4
LT
557 break;
558 }
559 }
560 read_unlock(&tape_device_lock);
561 return device;
562}
563
564/*
565 * Driverfs tape probe function.
566 */
567int
568tape_generic_probe(struct ccw_device *cdev)
569{
570 struct tape_device *device;
d7cf0d57 571 int ret;
f455adcf 572 struct ccw_dev_id dev_id;
1da177e4
LT
573
574 device = tape_alloc_device();
575 if (IS_ERR(device))
576 return -ENODEV;
454e1fa1
PO
577 ccw_device_set_options(cdev, CCWDEV_DO_PATHGROUP |
578 CCWDEV_DO_MULTIPATH);
d7cf0d57
HC
579 ret = sysfs_create_group(&cdev->dev.kobj, &tape_attr_group);
580 if (ret) {
581 tape_put_device(device);
d7cf0d57
HC
582 return ret;
583 }
dff59b64 584 dev_set_drvdata(&cdev->dev, device);
d7cf0d57 585 cdev->handler = __tape_do_irq;
1da177e4 586 device->cdev = cdev;
f455adcf
CH
587 ccw_device_get_id(cdev, &dev_id);
588 device->cdev_id = devid_to_int(&dev_id);
d7cf0d57 589 return ret;
1da177e4
LT
590}
591
4d284cac 592static void
1da177e4
LT
593__tape_discard_requests(struct tape_device *device)
594{
595 struct tape_request * request;
596 struct list_head * l, *n;
597
598 list_for_each_safe(l, n, &device->req_queue) {
599 request = list_entry(l, struct tape_request, list);
600 if (request->status == TAPE_REQUEST_IN_IO)
601 request->status = TAPE_REQUEST_DONE;
602 list_del(&request->list);
603
604 /* Decrease ref_count for removed request. */
8fd138c3
MS
605 request->device = NULL;
606 tape_put_device(device);
1da177e4
LT
607 request->rc = -EIO;
608 if (request->callback != NULL)
609 request->callback(request, request->callback_data);
610 }
611}
612
613/*
614 * Driverfs tape remove function.
615 *
616 * This function is called whenever the common I/O layer detects the device
617 * gone. This can happen at any time and we cannot refuse.
618 */
619void
620tape_generic_remove(struct ccw_device *cdev)
621{
622 struct tape_device * device;
623
dff59b64 624 device = dev_get_drvdata(&cdev->dev);
1da177e4 625 if (!device) {
1da177e4
LT
626 return;
627 }
628 DBF_LH(3, "(%08x): tape_generic_remove(%p)\n", device->cdev_id, cdev);
629
630 spin_lock_irq(get_ccwdev_lock(device->cdev));
631 switch (device->tape_state) {
632 case TS_INIT:
633 tape_state_set(device, TS_NOT_OPER);
634 case TS_NOT_OPER:
635 /*
636 * Nothing to do.
637 */
638 spin_unlock_irq(get_ccwdev_lock(device->cdev));
639 break;
640 case TS_UNUSED:
641 /*
642 * Need only to release the device.
643 */
644 tape_state_set(device, TS_NOT_OPER);
645 spin_unlock_irq(get_ccwdev_lock(device->cdev));
646 tape_cleanup_device(device);
647 break;
648 default:
649 /*
650 * There may be requests on the queue. We will not get
651 * an interrupt for a request that was running. So we
652 * just post them all as I/O errors.
653 */
654 DBF_EVENT(3, "(%08x): Drive in use vanished!\n",
655 device->cdev_id);
59e36927
MH
656 pr_warning("%s: A tape unit was detached while in "
657 "use\n", dev_name(&device->cdev->dev));
1da177e4
LT
658 tape_state_set(device, TS_NOT_OPER);
659 __tape_discard_requests(device);
660 spin_unlock_irq(get_ccwdev_lock(device->cdev));
661 tape_cleanup_device(device);
662 }
663
8fd138c3
MS
664 device = dev_get_drvdata(&cdev->dev);
665 if (device) {
1da177e4 666 sysfs_remove_group(&cdev->dev.kobj, &tape_attr_group);
8fd138c3
MS
667 dev_set_drvdata(&cdev->dev, NULL);
668 tape_put_device(device);
1da177e4
LT
669 }
670}
671
672/*
673 * Allocate a new tape ccw request
674 */
675struct tape_request *
676tape_alloc_request(int cplength, int datasize)
677{
678 struct tape_request *request;
679
6aa0d3a9 680 BUG_ON(datasize > PAGE_SIZE || (cplength*sizeof(struct ccw1)) > PAGE_SIZE);
1da177e4
LT
681
682 DBF_LH(6, "tape_alloc_request(%d, %d)\n", cplength, datasize);
683
88abaab4 684 request = kzalloc(sizeof(struct tape_request), GFP_KERNEL);
1da177e4
LT
685 if (request == NULL) {
686 DBF_EXCEPTION(1, "cqra nomem\n");
687 return ERR_PTR(-ENOMEM);
688 }
1da177e4
LT
689 /* allocate channel program */
690 if (cplength > 0) {
88abaab4 691 request->cpaddr = kcalloc(cplength, sizeof(struct ccw1),
1da177e4
LT
692 GFP_ATOMIC | GFP_DMA);
693 if (request->cpaddr == NULL) {
694 DBF_EXCEPTION(1, "cqra nomem\n");
695 kfree(request);
696 return ERR_PTR(-ENOMEM);
697 }
1da177e4
LT
698 }
699 /* alloc small kernel buffer */
700 if (datasize > 0) {
88abaab4 701 request->cpdata = kzalloc(datasize, GFP_KERNEL | GFP_DMA);
1da177e4
LT
702 if (request->cpdata == NULL) {
703 DBF_EXCEPTION(1, "cqra nomem\n");
17fd682e 704 kfree(request->cpaddr);
1da177e4
LT
705 kfree(request);
706 return ERR_PTR(-ENOMEM);
707 }
1da177e4
LT
708 }
709 DBF_LH(6, "New request %p(%p/%p)\n", request, request->cpaddr,
710 request->cpdata);
711
712 return request;
713}
714
715/*
716 * Free tape ccw request
717 */
718void
719tape_free_request (struct tape_request * request)
720{
721 DBF_LH(6, "Free request %p\n", request);
722
8fd138c3
MS
723 if (request->device)
724 tape_put_device(request->device);
17fd682e
JJ
725 kfree(request->cpdata);
726 kfree(request->cpaddr);
1da177e4
LT
727 kfree(request);
728}
729
4d284cac 730static int
4111796d
SB
731__tape_start_io(struct tape_device *device, struct tape_request *request)
732{
733 int rc;
734
735#ifdef CONFIG_S390_TAPE_BLOCK
736 if (request->op == TO_BLOCK)
737 device->discipline->check_locate(device, request);
738#endif
739 rc = ccw_device_start(
740 device->cdev,
741 request->cpaddr,
742 (unsigned long) request,
743 0x00,
744 request->options
745 );
746 if (rc == 0) {
747 request->status = TAPE_REQUEST_IN_IO;
748 } else if (rc == -EBUSY) {
749 /* The common I/O subsystem is currently busy. Retry later. */
750 request->status = TAPE_REQUEST_QUEUED;
c1637532 751 schedule_delayed_work(&device->tape_dnr, 0);
4111796d
SB
752 rc = 0;
753 } else {
754 /* Start failed. Remove request and indicate failure. */
755 DBF_EVENT(1, "tape: start request failed with RC = %i\n", rc);
756 }
757 return rc;
758}
759
4d284cac 760static void
4111796d 761__tape_start_next_request(struct tape_device *device)
1da177e4
LT
762{
763 struct list_head *l, *n;
764 struct tape_request *request;
765 int rc;
766
4111796d 767 DBF_LH(6, "__tape_start_next_request(%p)\n", device);
1da177e4
LT
768 /*
769 * Try to start each request on request queue until one is
770 * started successful.
771 */
772 list_for_each_safe(l, n, &device->req_queue) {
773 request = list_entry(l, struct tape_request, list);
4111796d
SB
774
775 /*
776 * Avoid race condition if bottom-half was triggered more than
777 * once.
778 */
779 if (request->status == TAPE_REQUEST_IN_IO)
780 return;
5f384338
MH
781 /*
782 * Request has already been stopped. We have to wait until
783 * the request is removed from the queue in the interrupt
784 * handling.
785 */
786 if (request->status == TAPE_REQUEST_DONE)
787 return;
4111796d
SB
788
789 /*
790 * We wanted to cancel the request but the common I/O layer
791 * was busy at that time. This can only happen if this
792 * function is called by delayed_next_request.
793 * Otherwise we start the next request on the queue.
794 */
795 if (request->status == TAPE_REQUEST_CANCEL) {
796 rc = __tape_cancel_io(device, request);
797 } else {
798 rc = __tape_start_io(device, request);
1da177e4 799 }
4111796d
SB
800 if (rc == 0)
801 return;
1da177e4 802
4111796d 803 /* Set ending status. */
1da177e4
LT
804 request->rc = rc;
805 request->status = TAPE_REQUEST_DONE;
4111796d
SB
806
807 /* Remove from request queue. */
808 list_del(&request->list);
809
810 /* Do callback. */
811 if (request->callback != NULL)
812 request->callback(request, request->callback_data);
1da177e4
LT
813 }
814}
815
816static void
c1637532 817tape_delayed_next_request(struct work_struct *work)
1da177e4 818{
c1637532
MS
819 struct tape_device *device =
820 container_of(work, struct tape_device, tape_dnr.work);
1da177e4 821
4111796d
SB
822 DBF_LH(6, "tape_delayed_next_request(%p)\n", device);
823 spin_lock_irq(get_ccwdev_lock(device->cdev));
824 __tape_start_next_request(device);
825 spin_unlock_irq(get_ccwdev_lock(device->cdev));
826}
827
cced1dd4
MH
828static void tape_long_busy_timeout(unsigned long data)
829{
830 struct tape_request *request;
831 struct tape_device *device;
832
833 device = (struct tape_device *) data;
834 spin_lock_irq(get_ccwdev_lock(device->cdev));
835 request = list_entry(device->req_queue.next, struct tape_request, list);
6aa0d3a9 836 BUG_ON(request->status != TAPE_REQUEST_LONG_BUSY);
cced1dd4
MH
837 DBF_LH(6, "%08x: Long busy timeout.\n", device->cdev_id);
838 __tape_start_next_request(device);
8fd138c3
MS
839 device->lb_timeout.data = 0UL;
840 tape_put_device(device);
cced1dd4
MH
841 spin_unlock_irq(get_ccwdev_lock(device->cdev));
842}
843
4d284cac 844static void
4111796d
SB
845__tape_end_request(
846 struct tape_device * device,
847 struct tape_request * request,
848 int rc)
849{
850 DBF_LH(6, "__tape_end_request(%p, %p, %i)\n", device, request, rc);
851 if (request) {
852 request->rc = rc;
853 request->status = TAPE_REQUEST_DONE;
854
855 /* Remove from request queue. */
856 list_del(&request->list);
857
858 /* Do callback. */
859 if (request->callback != NULL)
860 request->callback(request, request->callback_data);
861 }
1da177e4
LT
862
863 /* Start next request. */
864 if (!list_empty(&device->req_queue))
4111796d 865 __tape_start_next_request(device);
1da177e4
LT
866}
867
1da177e4
LT
868/*
869 * Write sense data to dbf
870 */
871void
872tape_dump_sense_dbf(struct tape_device *device, struct tape_request *request,
873 struct irb *irb)
874{
875 unsigned int *sptr;
876 const char* op;
877
878 if (request != NULL)
879 op = tape_op_verbose[request->op];
880 else
881 op = "---";
882 DBF_EVENT(3, "DSTAT : %02x CSTAT: %02x\n",
23d805b6 883 irb->scsw.cmd.dstat, irb->scsw.cmd.cstat);
1da177e4
LT
884 DBF_EVENT(3, "DEVICE: %08x OP\t: %s\n", device->cdev_id, op);
885 sptr = (unsigned int *) irb->ecw;
886 DBF_EVENT(3, "%08x %08x\n", sptr[0], sptr[1]);
887 DBF_EVENT(3, "%08x %08x\n", sptr[2], sptr[3]);
888 DBF_EVENT(3, "%08x %08x\n", sptr[4], sptr[5]);
889 DBF_EVENT(3, "%08x %08x\n", sptr[6], sptr[7]);
890}
891
892/*
893 * I/O helper function. Adds the request to the request queue
894 * and starts it if the tape is idle. Has to be called with
895 * the device lock held.
896 */
4d284cac 897static int
4111796d 898__tape_start_request(struct tape_device *device, struct tape_request *request)
1da177e4
LT
899{
900 int rc;
901
902 switch (request->op) {
903 case TO_MSEN:
904 case TO_ASSIGN:
905 case TO_UNASSIGN:
906 case TO_READ_ATTMSG:
e2963062 907 case TO_RDC:
1da177e4
LT
908 if (device->tape_state == TS_INIT)
909 break;
910 if (device->tape_state == TS_UNUSED)
911 break;
912 default:
913 if (device->tape_state == TS_BLKUSE)
914 break;
915 if (device->tape_state != TS_IN_USE)
916 return -ENODEV;
917 }
918
919 /* Increase use count of device for the added request. */
8fd138c3 920 request->device = tape_get_device(device);
1da177e4
LT
921
922 if (list_empty(&device->req_queue)) {
923 /* No other requests are on the queue. Start this one. */
4111796d
SB
924 rc = __tape_start_io(device, request);
925 if (rc)
1da177e4 926 return rc;
4111796d 927
1da177e4
LT
928 DBF_LH(5, "Request %p added for execution.\n", request);
929 list_add(&request->list, &device->req_queue);
1da177e4
LT
930 } else {
931 DBF_LH(5, "Request %p add to queue.\n", request);
1da177e4 932 request->status = TAPE_REQUEST_QUEUED;
4111796d 933 list_add_tail(&request->list, &device->req_queue);
1da177e4
LT
934 }
935 return 0;
936}
937
938/*
939 * Add the request to the request queue, try to start it if the
940 * tape is idle. Return without waiting for end of i/o.
941 */
942int
943tape_do_io_async(struct tape_device *device, struct tape_request *request)
944{
945 int rc;
946
947 DBF_LH(6, "tape_do_io_async(%p, %p)\n", device, request);
948
949 spin_lock_irq(get_ccwdev_lock(device->cdev));
950 /* Add request to request queue and try to start it. */
4111796d 951 rc = __tape_start_request(device, request);
1da177e4
LT
952 spin_unlock_irq(get_ccwdev_lock(device->cdev));
953 return rc;
954}
955
956/*
957 * tape_do_io/__tape_wake_up
958 * Add the request to the request queue, try to start it if the
959 * tape is idle and wait uninterruptible for its completion.
960 */
961static void
962__tape_wake_up(struct tape_request *request, void *data)
963{
964 request->callback = NULL;
965 wake_up((wait_queue_head_t *) data);
966}
967
968int
969tape_do_io(struct tape_device *device, struct tape_request *request)
970{
1da177e4
LT
971 int rc;
972
1da177e4
LT
973 spin_lock_irq(get_ccwdev_lock(device->cdev));
974 /* Setup callback */
975 request->callback = __tape_wake_up;
4657fb8a 976 request->callback_data = &device->wait_queue;
1da177e4 977 /* Add request to request queue and try to start it. */
4111796d 978 rc = __tape_start_request(device, request);
1da177e4
LT
979 spin_unlock_irq(get_ccwdev_lock(device->cdev));
980 if (rc)
981 return rc;
982 /* Request added to the queue. Wait for its completion. */
4657fb8a 983 wait_event(device->wait_queue, (request->callback == NULL));
1da177e4
LT
984 /* Get rc from request */
985 return request->rc;
986}
987
988/*
989 * tape_do_io_interruptible/__tape_wake_up_interruptible
990 * Add the request to the request queue, try to start it if the
991 * tape is idle and wait uninterruptible for its completion.
992 */
993static void
994__tape_wake_up_interruptible(struct tape_request *request, void *data)
995{
996 request->callback = NULL;
997 wake_up_interruptible((wait_queue_head_t *) data);
998}
999
1000int
1001tape_do_io_interruptible(struct tape_device *device,
1002 struct tape_request *request)
1003{
1da177e4
LT
1004 int rc;
1005
1da177e4
LT
1006 spin_lock_irq(get_ccwdev_lock(device->cdev));
1007 /* Setup callback */
1008 request->callback = __tape_wake_up_interruptible;
4657fb8a 1009 request->callback_data = &device->wait_queue;
4111796d 1010 rc = __tape_start_request(device, request);
1da177e4
LT
1011 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1012 if (rc)
1013 return rc;
1014 /* Request added to the queue. Wait for its completion. */
4657fb8a
MS
1015 rc = wait_event_interruptible(device->wait_queue,
1016 (request->callback == NULL));
1da177e4
LT
1017 if (rc != -ERESTARTSYS)
1018 /* Request finished normally. */
1019 return request->rc;
4111796d 1020
1da177e4
LT
1021 /* Interrupted by a signal. We have to stop the current request. */
1022 spin_lock_irq(get_ccwdev_lock(device->cdev));
4111796d
SB
1023 rc = __tape_cancel_io(device, request);
1024 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1da177e4 1025 if (rc == 0) {
4111796d
SB
1026 /* Wait for the interrupt that acknowledges the halt. */
1027 do {
1028 rc = wait_event_interruptible(
4657fb8a 1029 device->wait_queue,
4111796d
SB
1030 (request->callback == NULL)
1031 );
4cd190a7 1032 } while (rc == -ERESTARTSYS);
4111796d 1033
1da177e4
LT
1034 DBF_EVENT(3, "IO stopped on %08x\n", device->cdev_id);
1035 rc = -ERESTARTSYS;
1036 }
1da177e4
LT
1037 return rc;
1038}
1039
5f384338
MH
1040/*
1041 * Stop running ccw.
1042 */
1043int
1044tape_cancel_io(struct tape_device *device, struct tape_request *request)
1045{
1046 int rc;
1047
1048 spin_lock_irq(get_ccwdev_lock(device->cdev));
1049 rc = __tape_cancel_io(device, request);
1050 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1051 return rc;
1052}
1053
1da177e4
LT
1054/*
1055 * Tape interrupt routine, called from the ccw_device layer
1056 */
1057static void
1058__tape_do_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
1059{
1060 struct tape_device *device;
1061 struct tape_request *request;
1da177e4
LT
1062 int rc;
1063
dff59b64 1064 device = dev_get_drvdata(&cdev->dev);
1da177e4 1065 if (device == NULL) {
1da177e4
LT
1066 return;
1067 }
1068 request = (struct tape_request *) intparm;
1069
1070 DBF_LH(6, "__tape_do_irq(device=%p, request=%p)\n", device, request);
1071
1072 /* On special conditions irb is an error pointer */
1073 if (IS_ERR(irb)) {
4111796d 1074 /* FIXME: What to do with the request? */
1da177e4
LT
1075 switch (PTR_ERR(irb)) {
1076 case -ETIMEDOUT:
ab640db0 1077 DBF_LH(1, "(%s): Request timed out\n",
2a0217d5 1078 dev_name(&cdev->dev));
1da177e4 1079 case -EIO:
4111796d 1080 __tape_end_request(device, request, -EIO);
1da177e4
LT
1081 break;
1082 default:
ab640db0 1083 DBF_LH(1, "(%s): Unexpected i/o error %li\n",
2a0217d5 1084 dev_name(&cdev->dev),
1da177e4
LT
1085 PTR_ERR(irb));
1086 }
1087 return;
1088 }
1089
4111796d
SB
1090 /*
1091 * If the condition code is not zero and the start function bit is
1092 * still set, this is an deferred error and the last start I/O did
842d3fba
SB
1093 * not succeed. At this point the condition that caused the deferred
1094 * error might still apply. So we just schedule the request to be
1095 * started later.
4111796d 1096 */
23d805b6
PO
1097 if (irb->scsw.cmd.cc != 0 &&
1098 (irb->scsw.cmd.fctl & SCSW_FCTL_START_FUNC) &&
5f384338
MH
1099 (request->status == TAPE_REQUEST_IN_IO)) {
1100 DBF_EVENT(3,"(%08x): deferred cc=%i, fctl=%i. restarting\n",
23d805b6 1101 device->cdev_id, irb->scsw.cmd.cc, irb->scsw.cmd.fctl);
842d3fba 1102 request->status = TAPE_REQUEST_QUEUED;
5f384338 1103 schedule_delayed_work(&device->tape_dnr, HZ);
4111796d
SB
1104 return;
1105 }
1106
1da177e4
LT
1107 /* May be an unsolicited irq */
1108 if(request != NULL)
23d805b6
PO
1109 request->rescnt = irb->scsw.cmd.count;
1110 else if ((irb->scsw.cmd.dstat == 0x85 || irb->scsw.cmd.dstat == 0x80) &&
cced1dd4
MH
1111 !list_empty(&device->req_queue)) {
1112 /* Not Ready to Ready after long busy ? */
1113 struct tape_request *req;
1114 req = list_entry(device->req_queue.next,
1115 struct tape_request, list);
1116 if (req->status == TAPE_REQUEST_LONG_BUSY) {
1117 DBF_EVENT(3, "(%08x): del timer\n", device->cdev_id);
1118 if (del_timer(&device->lb_timeout)) {
8fd138c3
MS
1119 device->lb_timeout.data = 0UL;
1120 tape_put_device(device);
cced1dd4
MH
1121 __tape_start_next_request(device);
1122 }
1123 return;
1124 }
1125 }
23d805b6 1126 if (irb->scsw.cmd.dstat != 0x0c) {
1da177e4
LT
1127 /* Set the 'ONLINE' flag depending on sense byte 1 */
1128 if(*(((__u8 *) irb->ecw) + 1) & SENSE_DRIVE_ONLINE)
1129 device->tape_generic_status |= GMT_ONLINE(~0);
1130 else
1131 device->tape_generic_status &= ~GMT_ONLINE(~0);
1132
1133 /*
1134 * Any request that does not come back with channel end
1135 * and device end is unusual. Log the sense data.
1136 */
1137 DBF_EVENT(3,"-- Tape Interrupthandler --\n");
1138 tape_dump_sense_dbf(device, request, irb);
1139 } else {
1140 /* Upon normal completion the device _is_ online */
1141 device->tape_generic_status |= GMT_ONLINE(~0);
1142 }
1143 if (device->tape_state == TS_NOT_OPER) {
1144 DBF_EVENT(6, "tape:device is not operational\n");
1145 return;
1146 }
1147
1148 /*
1149 * Request that were canceled still come back with an interrupt.
1150 * To detect these request the state will be set to TAPE_REQUEST_DONE.
1151 */
1152 if(request != NULL && request->status == TAPE_REQUEST_DONE) {
4111796d 1153 __tape_end_request(device, request, -EIO);
1da177e4
LT
1154 return;
1155 }
1156
1157 rc = device->discipline->irq(device, request, irb);
1158 /*
1159 * rc < 0 : request finished unsuccessfully.
1160 * rc == TAPE_IO_SUCCESS: request finished successfully.
1161 * rc == TAPE_IO_PENDING: request is still running. Ignore rc.
1162 * rc == TAPE_IO_RETRY: request finished but needs another go.
1163 * rc == TAPE_IO_STOP: request needs to get terminated.
1164 */
1da177e4 1165 switch (rc) {
4111796d
SB
1166 case TAPE_IO_SUCCESS:
1167 /* Upon normal completion the device _is_ online */
1168 device->tape_generic_status |= GMT_ONLINE(~0);
1169 __tape_end_request(device, request, rc);
1170 break;
1171 case TAPE_IO_PENDING:
1172 break;
cced1dd4
MH
1173 case TAPE_IO_LONG_BUSY:
1174 device->lb_timeout.data =
8fd138c3 1175 (unsigned long) tape_get_device(device);
cced1dd4
MH
1176 device->lb_timeout.expires = jiffies +
1177 LONG_BUSY_TIMEOUT * HZ;
1178 DBF_EVENT(3, "(%08x): add timer\n", device->cdev_id);
1179 add_timer(&device->lb_timeout);
1180 request->status = TAPE_REQUEST_LONG_BUSY;
1181 break;
4111796d
SB
1182 case TAPE_IO_RETRY:
1183 rc = __tape_start_io(device, request);
1184 if (rc)
1185 __tape_end_request(device, request, rc);
1186 break;
1187 case TAPE_IO_STOP:
1188 rc = __tape_cancel_io(device, request);
1189 if (rc)
1190 __tape_end_request(device, request, rc);
1191 break;
1192 default:
1193 if (rc > 0) {
1194 DBF_EVENT(6, "xunknownrc\n");
4111796d
SB
1195 __tape_end_request(device, request, -EIO);
1196 } else {
1197 __tape_end_request(device, request, rc);
1198 }
1199 break;
1da177e4
LT
1200 }
1201}
1202
1203/*
1204 * Tape device open function used by tape_char & tape_block frontends.
1205 */
1206int
1207tape_open(struct tape_device *device)
1208{
1209 int rc;
1210
b3c21e49 1211 spin_lock_irq(get_ccwdev_lock(device->cdev));
1da177e4
LT
1212 if (device->tape_state == TS_NOT_OPER) {
1213 DBF_EVENT(6, "TAPE:nodev\n");
1214 rc = -ENODEV;
1215 } else if (device->tape_state == TS_IN_USE) {
1216 DBF_EVENT(6, "TAPE:dbusy\n");
1217 rc = -EBUSY;
1218 } else if (device->tape_state == TS_BLKUSE) {
1219 DBF_EVENT(6, "TAPE:dbusy\n");
1220 rc = -EBUSY;
1221 } else if (device->discipline != NULL &&
1222 !try_module_get(device->discipline->owner)) {
1223 DBF_EVENT(6, "TAPE:nodisc\n");
1224 rc = -ENODEV;
1225 } else {
1226 tape_state_set(device, TS_IN_USE);
1227 rc = 0;
1228 }
b3c21e49 1229 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1da177e4
LT
1230 return rc;
1231}
1232
1233/*
1234 * Tape device release function used by tape_char & tape_block frontends.
1235 */
1236int
1237tape_release(struct tape_device *device)
1238{
b3c21e49 1239 spin_lock_irq(get_ccwdev_lock(device->cdev));
1da177e4
LT
1240 if (device->tape_state == TS_IN_USE)
1241 tape_state_set(device, TS_UNUSED);
1242 module_put(device->discipline->owner);
b3c21e49 1243 spin_unlock_irq(get_ccwdev_lock(device->cdev));
1da177e4
LT
1244 return 0;
1245}
1246
1247/*
1248 * Execute a magnetic tape command a number of times.
1249 */
1250int
1251tape_mtop(struct tape_device *device, int mt_op, int mt_count)
1252{
1253 tape_mtop_fn fn;
1254 int rc;
1255
1256 DBF_EVENT(6, "TAPE:mtio\n");
1257 DBF_EVENT(6, "TAPE:ioop: %x\n", mt_op);
1258 DBF_EVENT(6, "TAPE:arg: %x\n", mt_count);
1259
1260 if (mt_op < 0 || mt_op >= TAPE_NR_MTOPS)
1261 return -EINVAL;
1262 fn = device->discipline->mtop_array[mt_op];
1263 if (fn == NULL)
1264 return -EINVAL;
1265
1266 /* We assume that the backends can handle count up to 500. */
1267 if (mt_op == MTBSR || mt_op == MTFSR || mt_op == MTFSF ||
1268 mt_op == MTBSF || mt_op == MTFSFM || mt_op == MTBSFM) {
1269 rc = 0;
1270 for (; mt_count > 500; mt_count -= 500)
1271 if ((rc = fn(device, 500)) != 0)
1272 break;
1273 if (rc == 0)
1274 rc = fn(device, mt_count);
1275 } else
1276 rc = fn(device, mt_count);
1277 return rc;
1278
1279}
1280
1281/*
1282 * Tape init function.
1283 */
1284static int
1285tape_init (void)
1286{
66a464db 1287 TAPE_DBF_AREA = debug_register ( "tape", 2, 2, 4*sizeof(long));
1da177e4
LT
1288 debug_register_view(TAPE_DBF_AREA, &debug_sprintf_view);
1289#ifdef DBF_LIKE_HELL
1290 debug_set_level(TAPE_DBF_AREA, 6);
1291#endif
e018ba1f 1292 DBF_EVENT(3, "tape init\n");
1da177e4
LT
1293 tape_proc_init();
1294 tapechar_init ();
1295 tapeblock_init ();
1296 return 0;
1297}
1298
1299/*
1300 * Tape exit function.
1301 */
1302static void
1303tape_exit(void)
1304{
1305 DBF_EVENT(6, "tape exit\n");
1306
1307 /* Get rid of the frontends */
1308 tapechar_exit();
1309 tapeblock_exit();
1310 tape_proc_cleanup();
1311 debug_unregister (TAPE_DBF_AREA);
1312}
1313
1314MODULE_AUTHOR("(C) 2001 IBM Deutschland Entwicklung GmbH by Carsten Otte and "
1315 "Michael Holzheu (cotte@de.ibm.com,holzheu@de.ibm.com)");
e018ba1f 1316MODULE_DESCRIPTION("Linux on zSeries channel attached tape device driver");
1da177e4
LT
1317MODULE_LICENSE("GPL");
1318
1319module_init(tape_init);
1320module_exit(tape_exit);
1321
1322EXPORT_SYMBOL(tape_generic_remove);
1323EXPORT_SYMBOL(tape_generic_probe);
1324EXPORT_SYMBOL(tape_generic_online);
1325EXPORT_SYMBOL(tape_generic_offline);
3ef32e62 1326EXPORT_SYMBOL(tape_generic_pm_suspend);
1da177e4 1327EXPORT_SYMBOL(tape_put_device);
8fd138c3 1328EXPORT_SYMBOL(tape_get_device);
1da177e4
LT
1329EXPORT_SYMBOL(tape_state_verbose);
1330EXPORT_SYMBOL(tape_op_verbose);
1331EXPORT_SYMBOL(tape_state_set);
1332EXPORT_SYMBOL(tape_med_state_set);
1333EXPORT_SYMBOL(tape_alloc_request);
1334EXPORT_SYMBOL(tape_free_request);
1da177e4
LT
1335EXPORT_SYMBOL(tape_dump_sense_dbf);
1336EXPORT_SYMBOL(tape_do_io);
1337EXPORT_SYMBOL(tape_do_io_async);
1338EXPORT_SYMBOL(tape_do_io_interruptible);
5f384338 1339EXPORT_SYMBOL(tape_cancel_io);
1da177e4 1340EXPORT_SYMBOL(tape_mtop);
This page took 0.600986 seconds and 5 git commands to generate.