tape_core.c 33 KB

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