tape_34xx.c 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233
  1. /*
  2. * tape device discipline for 3480/3490 tapes.
  3. *
  4. * Copyright IBM Corp. 2001, 2009
  5. * Author(s): Carsten Otte <cotte@de.ibm.com>
  6. * Tuan Ngo-Anh <ngoanh@de.ibm.com>
  7. * Martin Schwidefsky <schwidefsky@de.ibm.com>
  8. */
  9. #define KMSG_COMPONENT "tape_34xx"
  10. #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
  11. #include <linux/module.h>
  12. #include <linux/init.h>
  13. #include <linux/bio.h>
  14. #include <linux/workqueue.h>
  15. #include <linux/slab.h>
  16. #define TAPE_DBF_AREA tape_34xx_dbf
  17. #include "tape.h"
  18. #include "tape_std.h"
  19. /*
  20. * Pointer to debug area.
  21. */
  22. debug_info_t *TAPE_DBF_AREA = NULL;
  23. EXPORT_SYMBOL(TAPE_DBF_AREA);
  24. #define TAPE34XX_FMT_3480 0
  25. #define TAPE34XX_FMT_3480_2_XF 1
  26. #define TAPE34XX_FMT_3480_XF 2
  27. struct tape_34xx_block_id {
  28. unsigned int wrap : 1;
  29. unsigned int segment : 7;
  30. unsigned int format : 2;
  31. unsigned int block : 22;
  32. };
  33. /*
  34. * A list of block ID's is used to faster seek blocks.
  35. */
  36. struct tape_34xx_sbid {
  37. struct list_head list;
  38. struct tape_34xx_block_id bid;
  39. };
  40. static void tape_34xx_delete_sbid_from(struct tape_device *, int);
  41. /*
  42. * Medium sense for 34xx tapes. There is no 'real' medium sense call.
  43. * So we just do a normal sense.
  44. */
  45. static void __tape_34xx_medium_sense(struct tape_request *request)
  46. {
  47. struct tape_device *device = request->device;
  48. unsigned char *sense;
  49. if (request->rc == 0) {
  50. sense = request->cpdata;
  51. /*
  52. * This isn't quite correct. But since INTERVENTION_REQUIRED
  53. * means that the drive is 'neither ready nor on-line' it is
  54. * only slightly inaccurate to say there is no tape loaded if
  55. * the drive isn't online...
  56. */
  57. if (sense[0] & SENSE_INTERVENTION_REQUIRED)
  58. tape_med_state_set(device, MS_UNLOADED);
  59. else
  60. tape_med_state_set(device, MS_LOADED);
  61. if (sense[1] & SENSE_WRITE_PROTECT)
  62. device->tape_generic_status |= GMT_WR_PROT(~0);
  63. else
  64. device->tape_generic_status &= ~GMT_WR_PROT(~0);
  65. } else
  66. DBF_EVENT(4, "tape_34xx: medium sense failed with rc=%d\n",
  67. request->rc);
  68. tape_free_request(request);
  69. }
  70. static int tape_34xx_medium_sense(struct tape_device *device)
  71. {
  72. struct tape_request *request;
  73. int rc;
  74. request = tape_alloc_request(1, 32);
  75. if (IS_ERR(request)) {
  76. DBF_EXCEPTION(6, "MSEN fail\n");
  77. return PTR_ERR(request);
  78. }
  79. request->op = TO_MSEN;
  80. tape_ccw_end(request->cpaddr, SENSE, 32, request->cpdata);
  81. rc = tape_do_io_interruptible(device, request);
  82. __tape_34xx_medium_sense(request);
  83. return rc;
  84. }
  85. static void tape_34xx_medium_sense_async(struct tape_device *device)
  86. {
  87. struct tape_request *request;
  88. request = tape_alloc_request(1, 32);
  89. if (IS_ERR(request)) {
  90. DBF_EXCEPTION(6, "MSEN fail\n");
  91. return;
  92. }
  93. request->op = TO_MSEN;
  94. tape_ccw_end(request->cpaddr, SENSE, 32, request->cpdata);
  95. request->callback = (void *) __tape_34xx_medium_sense;
  96. request->callback_data = NULL;
  97. tape_do_io_async(device, request);
  98. }
  99. struct tape_34xx_work {
  100. struct tape_device *device;
  101. enum tape_op op;
  102. struct work_struct work;
  103. };
  104. /*
  105. * These functions are currently used only to schedule a medium_sense for
  106. * later execution. This is because we get an interrupt whenever a medium
  107. * is inserted but cannot call tape_do_io* from an interrupt context.
  108. * Maybe that's useful for other actions we want to start from the
  109. * interrupt handler.
  110. * Note: the work handler is called by the system work queue. The tape
  111. * commands started by the handler need to be asynchrounous, otherwise
  112. * a deadlock can occur e.g. in case of a deferred cc=1 (see __tape_do_irq).
  113. */
  114. static void
  115. tape_34xx_work_handler(struct work_struct *work)
  116. {
  117. struct tape_34xx_work *p =
  118. container_of(work, struct tape_34xx_work, work);
  119. struct tape_device *device = p->device;
  120. switch(p->op) {
  121. case TO_MSEN:
  122. tape_34xx_medium_sense_async(device);
  123. break;
  124. default:
  125. DBF_EVENT(3, "T34XX: internal error: unknown work\n");
  126. }
  127. tape_put_device(device);
  128. kfree(p);
  129. }
  130. static int
  131. tape_34xx_schedule_work(struct tape_device *device, enum tape_op op)
  132. {
  133. struct tape_34xx_work *p;
  134. if ((p = kzalloc(sizeof(*p), GFP_ATOMIC)) == NULL)
  135. return -ENOMEM;
  136. INIT_WORK(&p->work, tape_34xx_work_handler);
  137. p->device = tape_get_device(device);
  138. p->op = op;
  139. schedule_work(&p->work);
  140. return 0;
  141. }
  142. /*
  143. * Done Handler is called when dev stat = DEVICE-END (successful operation)
  144. */
  145. static inline int
  146. tape_34xx_done(struct tape_request *request)
  147. {
  148. DBF_EVENT(6, "%s done\n", tape_op_verbose[request->op]);
  149. switch (request->op) {
  150. case TO_DSE:
  151. case TO_RUN:
  152. case TO_WRI:
  153. case TO_WTM:
  154. case TO_ASSIGN:
  155. case TO_UNASSIGN:
  156. tape_34xx_delete_sbid_from(request->device, 0);
  157. break;
  158. default:
  159. ;
  160. }
  161. return TAPE_IO_SUCCESS;
  162. }
  163. static inline int
  164. tape_34xx_erp_failed(struct tape_request *request, int rc)
  165. {
  166. DBF_EVENT(3, "Error recovery failed for %s (RC=%d)\n",
  167. tape_op_verbose[request->op], rc);
  168. return rc;
  169. }
  170. static inline int
  171. tape_34xx_erp_succeeded(struct tape_request *request)
  172. {
  173. DBF_EVENT(3, "Error Recovery successful for %s\n",
  174. tape_op_verbose[request->op]);
  175. return tape_34xx_done(request);
  176. }
  177. static inline int
  178. tape_34xx_erp_retry(struct tape_request *request)
  179. {
  180. DBF_EVENT(3, "xerp retr %s\n", tape_op_verbose[request->op]);
  181. return TAPE_IO_RETRY;
  182. }
  183. /*
  184. * This function is called, when no request is outstanding and we get an
  185. * interrupt
  186. */
  187. static int
  188. tape_34xx_unsolicited_irq(struct tape_device *device, struct irb *irb)
  189. {
  190. if (irb->scsw.cmd.dstat == 0x85) { /* READY */
  191. /* A medium was inserted in the drive. */
  192. DBF_EVENT(6, "xuud med\n");
  193. tape_34xx_delete_sbid_from(device, 0);
  194. tape_34xx_schedule_work(device, TO_MSEN);
  195. } else {
  196. DBF_EVENT(3, "unsol.irq! dev end: %08x\n", device->cdev_id);
  197. tape_dump_sense_dbf(device, NULL, irb);
  198. }
  199. return TAPE_IO_SUCCESS;
  200. }
  201. /*
  202. * Read Opposite Error Recovery Function:
  203. * Used, when Read Forward does not work
  204. */
  205. static int
  206. tape_34xx_erp_read_opposite(struct tape_device *device,
  207. struct tape_request *request)
  208. {
  209. if (request->op == TO_RFO) {
  210. /*
  211. * We did read forward, but the data could not be read
  212. * *correctly*. We transform the request to a read backward
  213. * and try again.
  214. */
  215. tape_std_read_backward(device, request);
  216. return tape_34xx_erp_retry(request);
  217. }
  218. /*
  219. * We tried to read forward and backward, but hat no
  220. * success -> failed.
  221. */
  222. return tape_34xx_erp_failed(request, -EIO);
  223. }
  224. static int
  225. tape_34xx_erp_bug(struct tape_device *device, struct tape_request *request,
  226. struct irb *irb, int no)
  227. {
  228. if (request->op != TO_ASSIGN) {
  229. dev_err(&device->cdev->dev, "An unexpected condition %d "
  230. "occurred in tape error recovery\n", no);
  231. tape_dump_sense_dbf(device, request, irb);
  232. }
  233. return tape_34xx_erp_failed(request, -EIO);
  234. }
  235. /*
  236. * Handle data overrun between cu and drive. The channel speed might
  237. * be too slow.
  238. */
  239. static int
  240. tape_34xx_erp_overrun(struct tape_device *device, struct tape_request *request,
  241. struct irb *irb)
  242. {
  243. if (irb->ecw[3] == 0x40) {
  244. dev_warn (&device->cdev->dev, "A data overrun occurred between"
  245. " the control unit and tape unit\n");
  246. return tape_34xx_erp_failed(request, -EIO);
  247. }
  248. return tape_34xx_erp_bug(device, request, irb, -1);
  249. }
  250. /*
  251. * Handle record sequence error.
  252. */
  253. static int
  254. tape_34xx_erp_sequence(struct tape_device *device,
  255. struct tape_request *request, struct irb *irb)
  256. {
  257. if (irb->ecw[3] == 0x41) {
  258. /*
  259. * cu detected incorrect block-id sequence on tape.
  260. */
  261. dev_warn (&device->cdev->dev, "The block ID sequence on the "
  262. "tape is incorrect\n");
  263. return tape_34xx_erp_failed(request, -EIO);
  264. }
  265. /*
  266. * Record sequence error bit is set, but erpa does not
  267. * show record sequence error.
  268. */
  269. return tape_34xx_erp_bug(device, request, irb, -2);
  270. }
  271. /*
  272. * This function analyses the tape's sense-data in case of a unit-check.
  273. * If possible, it tries to recover from the error. Else the user is
  274. * informed about the problem.
  275. */
  276. static int
  277. tape_34xx_unit_check(struct tape_device *device, struct tape_request *request,
  278. struct irb *irb)
  279. {
  280. int inhibit_cu_recovery;
  281. __u8* sense;
  282. inhibit_cu_recovery = (*device->modeset_byte & 0x80) ? 1 : 0;
  283. sense = irb->ecw;
  284. if (
  285. sense[0] & SENSE_COMMAND_REJECT &&
  286. sense[1] & SENSE_WRITE_PROTECT
  287. ) {
  288. if (
  289. request->op == TO_DSE ||
  290. request->op == TO_WRI ||
  291. request->op == TO_WTM
  292. ) {
  293. /* medium is write protected */
  294. return tape_34xx_erp_failed(request, -EACCES);
  295. } else {
  296. return tape_34xx_erp_bug(device, request, irb, -3);
  297. }
  298. }
  299. /*
  300. * Special cases for various tape-states when reaching
  301. * end of recorded area
  302. *
  303. * FIXME: Maybe a special case of the special case:
  304. * sense[0] == SENSE_EQUIPMENT_CHECK &&
  305. * sense[1] == SENSE_DRIVE_ONLINE &&
  306. * sense[3] == 0x47 (Volume Fenced)
  307. *
  308. * This was caused by continued FSF or FSR after an
  309. * 'End Of Data'.
  310. */
  311. if ((
  312. sense[0] == SENSE_DATA_CHECK ||
  313. sense[0] == SENSE_EQUIPMENT_CHECK ||
  314. sense[0] == SENSE_EQUIPMENT_CHECK + SENSE_DEFERRED_UNIT_CHECK
  315. ) && (
  316. sense[1] == SENSE_DRIVE_ONLINE ||
  317. sense[1] == SENSE_BEGINNING_OF_TAPE + SENSE_WRITE_MODE
  318. )) {
  319. switch (request->op) {
  320. /*
  321. * sense[0] == SENSE_DATA_CHECK &&
  322. * sense[1] == SENSE_DRIVE_ONLINE
  323. * sense[3] == 0x36 (End Of Data)
  324. *
  325. * Further seeks might return a 'Volume Fenced'.
  326. */
  327. case TO_FSF:
  328. case TO_FSB:
  329. /* Trying to seek beyond end of recorded area */
  330. return tape_34xx_erp_failed(request, -ENOSPC);
  331. case TO_BSB:
  332. return tape_34xx_erp_retry(request);
  333. /*
  334. * sense[0] == SENSE_DATA_CHECK &&
  335. * sense[1] == SENSE_DRIVE_ONLINE &&
  336. * sense[3] == 0x36 (End Of Data)
  337. */
  338. case TO_LBL:
  339. /* Block could not be located. */
  340. tape_34xx_delete_sbid_from(device, 0);
  341. return tape_34xx_erp_failed(request, -EIO);
  342. case TO_RFO:
  343. /* Read beyond end of recorded area -> 0 bytes read */
  344. return tape_34xx_erp_failed(request, 0);
  345. /*
  346. * sense[0] == SENSE_EQUIPMENT_CHECK &&
  347. * sense[1] == SENSE_DRIVE_ONLINE &&
  348. * sense[3] == 0x38 (Physical End Of Volume)
  349. */
  350. case TO_WRI:
  351. /* Writing at physical end of volume */
  352. return tape_34xx_erp_failed(request, -ENOSPC);
  353. default:
  354. return tape_34xx_erp_failed(request, 0);
  355. }
  356. }
  357. /* Sensing special bits */
  358. if (sense[0] & SENSE_BUS_OUT_CHECK)
  359. return tape_34xx_erp_retry(request);
  360. if (sense[0] & SENSE_DATA_CHECK) {
  361. /*
  362. * hardware failure, damaged tape or improper
  363. * operating conditions
  364. */
  365. switch (sense[3]) {
  366. case 0x23:
  367. /* a read data check occurred */
  368. if ((sense[2] & SENSE_TAPE_SYNC_MODE) ||
  369. inhibit_cu_recovery)
  370. // data check is not permanent, may be
  371. // recovered. We always use async-mode with
  372. // cu-recovery, so this should *never* happen.
  373. return tape_34xx_erp_bug(device, request,
  374. irb, -4);
  375. /* data check is permanent, CU recovery has failed */
  376. dev_warn (&device->cdev->dev, "A read error occurred "
  377. "that cannot be recovered\n");
  378. return tape_34xx_erp_failed(request, -EIO);
  379. case 0x25:
  380. // a write data check occurred
  381. if ((sense[2] & SENSE_TAPE_SYNC_MODE) ||
  382. inhibit_cu_recovery)
  383. // data check is not permanent, may be
  384. // recovered. We always use async-mode with
  385. // cu-recovery, so this should *never* happen.
  386. return tape_34xx_erp_bug(device, request,
  387. irb, -5);
  388. // data check is permanent, cu-recovery has failed
  389. dev_warn (&device->cdev->dev, "A write error on the "
  390. "tape cannot be recovered\n");
  391. return tape_34xx_erp_failed(request, -EIO);
  392. case 0x26:
  393. /* Data Check (read opposite) occurred. */
  394. return tape_34xx_erp_read_opposite(device, request);
  395. case 0x28:
  396. /* ID-Mark at tape start couldn't be written */
  397. dev_warn (&device->cdev->dev, "Writing the ID-mark "
  398. "failed\n");
  399. return tape_34xx_erp_failed(request, -EIO);
  400. case 0x31:
  401. /* Tape void. Tried to read beyond end of device. */
  402. dev_warn (&device->cdev->dev, "Reading the tape beyond"
  403. " the end of the recorded area failed\n");
  404. return tape_34xx_erp_failed(request, -ENOSPC);
  405. case 0x41:
  406. /* Record sequence error. */
  407. dev_warn (&device->cdev->dev, "The tape contains an "
  408. "incorrect block ID sequence\n");
  409. return tape_34xx_erp_failed(request, -EIO);
  410. default:
  411. /* all data checks for 3480 should result in one of
  412. * the above erpa-codes. For 3490, other data-check
  413. * conditions do exist. */
  414. if (device->cdev->id.driver_info == tape_3480)
  415. return tape_34xx_erp_bug(device, request,
  416. irb, -6);
  417. }
  418. }
  419. if (sense[0] & SENSE_OVERRUN)
  420. return tape_34xx_erp_overrun(device, request, irb);
  421. if (sense[1] & SENSE_RECORD_SEQUENCE_ERR)
  422. return tape_34xx_erp_sequence(device, request, irb);
  423. /* Sensing erpa codes */
  424. switch (sense[3]) {
  425. case 0x00:
  426. /* Unit check with erpa code 0. Report and ignore. */
  427. return TAPE_IO_SUCCESS;
  428. case 0x21:
  429. /*
  430. * Data streaming not operational. CU will switch to
  431. * interlock mode. Reissue the command.
  432. */
  433. return tape_34xx_erp_retry(request);
  434. case 0x22:
  435. /*
  436. * Path equipment check. Might be drive adapter error, buffer
  437. * error on the lower interface, internal path not usable,
  438. * or error during cartridge load.
  439. */
  440. dev_warn (&device->cdev->dev, "A path equipment check occurred"
  441. " for the tape device\n");
  442. return tape_34xx_erp_failed(request, -EIO);
  443. case 0x24:
  444. /*
  445. * Load display check. Load display was command was issued,
  446. * but the drive is displaying a drive check message. Can
  447. * be threated as "device end".
  448. */
  449. return tape_34xx_erp_succeeded(request);
  450. case 0x27:
  451. /*
  452. * Command reject. May indicate illegal channel program or
  453. * buffer over/underrun. Since all channel programs are
  454. * issued by this driver and ought be correct, we assume a
  455. * over/underrun situation and retry the channel program.
  456. */
  457. return tape_34xx_erp_retry(request);
  458. case 0x29:
  459. /*
  460. * Function incompatible. Either the tape is idrc compressed
  461. * but the hardware isn't capable to do idrc, or a perform
  462. * subsystem func is issued and the CU is not on-line.
  463. */
  464. return tape_34xx_erp_failed(request, -EIO);
  465. case 0x2a:
  466. /*
  467. * Unsolicited environmental data. An internal counter
  468. * overflows, we can ignore this and reissue the cmd.
  469. */
  470. return tape_34xx_erp_retry(request);
  471. case 0x2b:
  472. /*
  473. * Environmental data present. Indicates either unload
  474. * completed ok or read buffered log command completed ok.
  475. */
  476. if (request->op == TO_RUN) {
  477. /* Rewind unload completed ok. */
  478. tape_med_state_set(device, MS_UNLOADED);
  479. return tape_34xx_erp_succeeded(request);
  480. }
  481. /* tape_34xx doesn't use read buffered log commands. */
  482. return tape_34xx_erp_bug(device, request, irb, sense[3]);
  483. case 0x2c:
  484. /*
  485. * Permanent equipment check. CU has tried recovery, but
  486. * did not succeed.
  487. */
  488. return tape_34xx_erp_failed(request, -EIO);
  489. case 0x2d:
  490. /* Data security erase failure. */
  491. if (request->op == TO_DSE)
  492. return tape_34xx_erp_failed(request, -EIO);
  493. /* Data security erase failure, but no such command issued. */
  494. return tape_34xx_erp_bug(device, request, irb, sense[3]);
  495. case 0x2e:
  496. /*
  497. * Not capable. This indicates either that the drive fails
  498. * reading the format id mark or that that format specified
  499. * is not supported by the drive.
  500. */
  501. dev_warn (&device->cdev->dev, "The tape unit cannot process "
  502. "the tape format\n");
  503. return tape_34xx_erp_failed(request, -EMEDIUMTYPE);
  504. case 0x30:
  505. /* The medium is write protected. */
  506. dev_warn (&device->cdev->dev, "The tape medium is write-"
  507. "protected\n");
  508. return tape_34xx_erp_failed(request, -EACCES);
  509. case 0x32:
  510. // Tension loss. We cannot recover this, it's an I/O error.
  511. dev_warn (&device->cdev->dev, "The tape does not have the "
  512. "required tape tension\n");
  513. return tape_34xx_erp_failed(request, -EIO);
  514. case 0x33:
  515. /*
  516. * Load Failure. The cartridge was not inserted correctly or
  517. * the tape is not threaded correctly.
  518. */
  519. dev_warn (&device->cdev->dev, "The tape unit failed to load"
  520. " the cartridge\n");
  521. tape_34xx_delete_sbid_from(device, 0);
  522. return tape_34xx_erp_failed(request, -EIO);
  523. case 0x34:
  524. /*
  525. * Unload failure. The drive cannot maintain tape tension
  526. * and control tape movement during an unload operation.
  527. */
  528. dev_warn (&device->cdev->dev, "Automatic unloading of the tape"
  529. " cartridge failed\n");
  530. if (request->op == TO_RUN)
  531. return tape_34xx_erp_failed(request, -EIO);
  532. return tape_34xx_erp_bug(device, request, irb, sense[3]);
  533. case 0x35:
  534. /*
  535. * Drive equipment check. One of the following:
  536. * - cu cannot recover from a drive detected error
  537. * - a check code message is shown on drive display
  538. * - the cartridge loader does not respond correctly
  539. * - a failure occurs during an index, load, or unload cycle
  540. */
  541. dev_warn (&device->cdev->dev, "An equipment check has occurred"
  542. " on the tape unit\n");
  543. return tape_34xx_erp_failed(request, -EIO);
  544. case 0x36:
  545. if (device->cdev->id.driver_info == tape_3490)
  546. /* End of data. */
  547. return tape_34xx_erp_failed(request, -EIO);
  548. /* This erpa is reserved for 3480 */
  549. return tape_34xx_erp_bug(device, request, irb, sense[3]);
  550. case 0x37:
  551. /*
  552. * Tape length error. The tape is shorter than reported in
  553. * the beginning-of-tape data.
  554. */
  555. dev_warn (&device->cdev->dev, "The tape information states an"
  556. " incorrect length\n");
  557. return tape_34xx_erp_failed(request, -EIO);
  558. case 0x38:
  559. /*
  560. * Physical end of tape. A read/write operation reached
  561. * the physical end of tape.
  562. */
  563. if (request->op==TO_WRI ||
  564. request->op==TO_DSE ||
  565. request->op==TO_WTM)
  566. return tape_34xx_erp_failed(request, -ENOSPC);
  567. return tape_34xx_erp_failed(request, -EIO);
  568. case 0x39:
  569. /* Backward at Beginning of tape. */
  570. return tape_34xx_erp_failed(request, -EIO);
  571. case 0x3a:
  572. /* Drive switched to not ready. */
  573. dev_warn (&device->cdev->dev, "The tape unit is not ready\n");
  574. return tape_34xx_erp_failed(request, -EIO);
  575. case 0x3b:
  576. /* Manual rewind or unload. This causes an I/O error. */
  577. dev_warn (&device->cdev->dev, "The tape medium has been "
  578. "rewound or unloaded manually\n");
  579. tape_34xx_delete_sbid_from(device, 0);
  580. return tape_34xx_erp_failed(request, -EIO);
  581. case 0x42:
  582. /*
  583. * Degraded mode. A condition that can cause degraded
  584. * performance is detected.
  585. */
  586. dev_warn (&device->cdev->dev, "The tape subsystem is running "
  587. "in degraded mode\n");
  588. return tape_34xx_erp_retry(request);
  589. case 0x43:
  590. /* Drive not ready. */
  591. tape_34xx_delete_sbid_from(device, 0);
  592. tape_med_state_set(device, MS_UNLOADED);
  593. /* Some commands commands are successful even in this case */
  594. if (sense[1] & SENSE_DRIVE_ONLINE) {
  595. switch(request->op) {
  596. case TO_ASSIGN:
  597. case TO_UNASSIGN:
  598. case TO_DIS:
  599. case TO_NOP:
  600. return tape_34xx_done(request);
  601. break;
  602. default:
  603. break;
  604. }
  605. }
  606. return tape_34xx_erp_failed(request, -ENOMEDIUM);
  607. case 0x44:
  608. /* Locate Block unsuccessful. */
  609. if (request->op != TO_BLOCK && request->op != TO_LBL)
  610. /* No locate block was issued. */
  611. return tape_34xx_erp_bug(device, request,
  612. irb, sense[3]);
  613. return tape_34xx_erp_failed(request, -EIO);
  614. case 0x45:
  615. /* The drive is assigned to a different channel path. */
  616. dev_warn (&device->cdev->dev, "The tape unit is already "
  617. "assigned\n");
  618. return tape_34xx_erp_failed(request, -EIO);
  619. case 0x46:
  620. /*
  621. * Drive not on-line. Drive may be switched offline,
  622. * the power supply may be switched off or
  623. * the drive address may not be set correctly.
  624. */
  625. dev_warn (&device->cdev->dev, "The tape unit is not online\n");
  626. return tape_34xx_erp_failed(request, -EIO);
  627. case 0x47:
  628. /* Volume fenced. CU reports volume integrity is lost. */
  629. dev_warn (&device->cdev->dev, "The control unit has fenced "
  630. "access to the tape volume\n");
  631. tape_34xx_delete_sbid_from(device, 0);
  632. return tape_34xx_erp_failed(request, -EIO);
  633. case 0x48:
  634. /* Log sense data and retry request. */
  635. return tape_34xx_erp_retry(request);
  636. case 0x49:
  637. /* Bus out check. A parity check error on the bus was found. */
  638. dev_warn (&device->cdev->dev, "A parity error occurred on the "
  639. "tape bus\n");
  640. return tape_34xx_erp_failed(request, -EIO);
  641. case 0x4a:
  642. /* Control unit erp failed. */
  643. dev_warn (&device->cdev->dev, "I/O error recovery failed on "
  644. "the tape control unit\n");
  645. return tape_34xx_erp_failed(request, -EIO);
  646. case 0x4b:
  647. /*
  648. * CU and drive incompatible. The drive requests micro-program
  649. * patches, which are not available on the CU.
  650. */
  651. dev_warn (&device->cdev->dev, "The tape unit requires a "
  652. "firmware update\n");
  653. return tape_34xx_erp_failed(request, -EIO);
  654. case 0x4c:
  655. /*
  656. * Recovered Check-One failure. Cu develops a hardware error,
  657. * but is able to recover.
  658. */
  659. return tape_34xx_erp_retry(request);
  660. case 0x4d:
  661. if (device->cdev->id.driver_info == tape_3490)
  662. /*
  663. * Resetting event received. Since the driver does
  664. * not support resetting event recovery (which has to
  665. * be handled by the I/O Layer), retry our command.
  666. */
  667. return tape_34xx_erp_retry(request);
  668. /* This erpa is reserved for 3480. */
  669. return tape_34xx_erp_bug(device, request, irb, sense[3]);
  670. case 0x4e:
  671. if (device->cdev->id.driver_info == tape_3490) {
  672. /*
  673. * Maximum block size exceeded. This indicates, that
  674. * the block to be written is larger than allowed for
  675. * buffered mode.
  676. */
  677. dev_warn (&device->cdev->dev, "The maximum block size"
  678. " for buffered mode is exceeded\n");
  679. return tape_34xx_erp_failed(request, -ENOBUFS);
  680. }
  681. /* This erpa is reserved for 3480. */
  682. return tape_34xx_erp_bug(device, request, irb, sense[3]);
  683. case 0x50:
  684. /*
  685. * Read buffered log (Overflow). CU is running in extended
  686. * buffered log mode, and a counter overflows. This should
  687. * never happen, since we're never running in extended
  688. * buffered log mode.
  689. */
  690. return tape_34xx_erp_retry(request);
  691. case 0x51:
  692. /*
  693. * Read buffered log (EOV). EOF processing occurs while the
  694. * CU is in extended buffered log mode. This should never
  695. * happen, since we're never running in extended buffered
  696. * log mode.
  697. */
  698. return tape_34xx_erp_retry(request);
  699. case 0x52:
  700. /* End of Volume complete. Rewind unload completed ok. */
  701. if (request->op == TO_RUN) {
  702. tape_med_state_set(device, MS_UNLOADED);
  703. tape_34xx_delete_sbid_from(device, 0);
  704. return tape_34xx_erp_succeeded(request);
  705. }
  706. return tape_34xx_erp_bug(device, request, irb, sense[3]);
  707. case 0x53:
  708. /* Global command intercept. */
  709. return tape_34xx_erp_retry(request);
  710. case 0x54:
  711. /* Channel interface recovery (temporary). */
  712. return tape_34xx_erp_retry(request);
  713. case 0x55:
  714. /* Channel interface recovery (permanent). */
  715. dev_warn (&device->cdev->dev, "A channel interface error cannot be"
  716. " recovered\n");
  717. return tape_34xx_erp_failed(request, -EIO);
  718. case 0x56:
  719. /* Channel protocol error. */
  720. dev_warn (&device->cdev->dev, "A channel protocol error "
  721. "occurred\n");
  722. return tape_34xx_erp_failed(request, -EIO);
  723. case 0x57:
  724. /*
  725. * 3480: Attention intercept.
  726. * 3490: Global status intercept.
  727. */
  728. return tape_34xx_erp_retry(request);
  729. case 0x5a:
  730. /*
  731. * Tape length incompatible. The tape inserted is too long,
  732. * which could cause damage to the tape or the drive.
  733. */
  734. dev_warn (&device->cdev->dev, "The tape unit does not support "
  735. "the tape length\n");
  736. return tape_34xx_erp_failed(request, -EIO);
  737. case 0x5b:
  738. /* Format 3480 XF incompatible */
  739. if (sense[1] & SENSE_BEGINNING_OF_TAPE)
  740. /* The tape will get overwritten. */
  741. return tape_34xx_erp_retry(request);
  742. dev_warn (&device->cdev->dev, "The tape unit does not support"
  743. " format 3480 XF\n");
  744. return tape_34xx_erp_failed(request, -EIO);
  745. case 0x5c:
  746. /* Format 3480-2 XF incompatible */
  747. dev_warn (&device->cdev->dev, "The tape unit does not support tape "
  748. "format 3480-2 XF\n");
  749. return tape_34xx_erp_failed(request, -EIO);
  750. case 0x5d:
  751. /* Tape length violation. */
  752. dev_warn (&device->cdev->dev, "The tape unit does not support"
  753. " the current tape length\n");
  754. return tape_34xx_erp_failed(request, -EMEDIUMTYPE);
  755. case 0x5e:
  756. /* Compaction algorithm incompatible. */
  757. dev_warn (&device->cdev->dev, "The tape unit does not support"
  758. " the compaction algorithm\n");
  759. return tape_34xx_erp_failed(request, -EMEDIUMTYPE);
  760. /* The following erpas should have been covered earlier. */
  761. case 0x23: /* Read data check. */
  762. case 0x25: /* Write data check. */
  763. case 0x26: /* Data check (read opposite). */
  764. case 0x28: /* Write id mark check. */
  765. case 0x31: /* Tape void. */
  766. case 0x40: /* Overrun error. */
  767. case 0x41: /* Record sequence error. */
  768. /* All other erpas are reserved for future use. */
  769. default:
  770. return tape_34xx_erp_bug(device, request, irb, sense[3]);
  771. }
  772. }
  773. /*
  774. * 3480/3490 interrupt handler
  775. */
  776. static int
  777. tape_34xx_irq(struct tape_device *device, struct tape_request *request,
  778. struct irb *irb)
  779. {
  780. if (request == NULL)
  781. return tape_34xx_unsolicited_irq(device, irb);
  782. if ((irb->scsw.cmd.dstat & DEV_STAT_UNIT_EXCEP) &&
  783. (irb->scsw.cmd.dstat & DEV_STAT_DEV_END) &&
  784. (request->op == TO_WRI)) {
  785. /* Write at end of volume */
  786. return tape_34xx_erp_failed(request, -ENOSPC);
  787. }
  788. if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK)
  789. return tape_34xx_unit_check(device, request, irb);
  790. if (irb->scsw.cmd.dstat & DEV_STAT_DEV_END) {
  791. /*
  792. * A unit exception occurs on skipping over a tapemark block.
  793. */
  794. if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_EXCEP) {
  795. if (request->op == TO_BSB || request->op == TO_FSB)
  796. request->rescnt++;
  797. else
  798. DBF_EVENT(5, "Unit Exception!\n");
  799. }
  800. return tape_34xx_done(request);
  801. }
  802. DBF_EVENT(6, "xunknownirq\n");
  803. tape_dump_sense_dbf(device, request, irb);
  804. return TAPE_IO_STOP;
  805. }
  806. /*
  807. * ioctl_overload
  808. */
  809. static int
  810. tape_34xx_ioctl(struct tape_device *device, unsigned int cmd, unsigned long arg)
  811. {
  812. if (cmd == TAPE390_DISPLAY) {
  813. struct display_struct disp;
  814. if (copy_from_user(&disp, (char __user *) arg, sizeof(disp)) != 0)
  815. return -EFAULT;
  816. return tape_std_display(device, &disp);
  817. } else
  818. return -EINVAL;
  819. }
  820. static inline void
  821. tape_34xx_append_new_sbid(struct tape_34xx_block_id bid, struct list_head *l)
  822. {
  823. struct tape_34xx_sbid * new_sbid;
  824. new_sbid = kmalloc(sizeof(*new_sbid), GFP_ATOMIC);
  825. if (!new_sbid)
  826. return;
  827. new_sbid->bid = bid;
  828. list_add(&new_sbid->list, l);
  829. }
  830. /*
  831. * Build up the search block ID list. The block ID consists of a logical
  832. * block number and a hardware specific part. The hardware specific part
  833. * helps the tape drive to speed up searching for a specific block.
  834. */
  835. static void
  836. tape_34xx_add_sbid(struct tape_device *device, struct tape_34xx_block_id bid)
  837. {
  838. struct list_head * sbid_list;
  839. struct tape_34xx_sbid * sbid;
  840. struct list_head * l;
  841. /*
  842. * immediately return if there is no list at all or the block to add
  843. * is located in segment 1 of wrap 0 because this position is used
  844. * if no hardware position data is supplied.
  845. */
  846. sbid_list = (struct list_head *) device->discdata;
  847. if (!sbid_list || (bid.segment < 2 && bid.wrap == 0))
  848. return;
  849. /*
  850. * Search the position where to insert the new entry. Hardware
  851. * acceleration uses only the segment and wrap number. So we
  852. * need only one entry for a specific wrap/segment combination.
  853. * If there is a block with a lower number but the same hard-
  854. * ware position data we just update the block number in the
  855. * existing entry.
  856. */
  857. list_for_each(l, sbid_list) {
  858. sbid = list_entry(l, struct tape_34xx_sbid, list);
  859. if (
  860. (sbid->bid.segment == bid.segment) &&
  861. (sbid->bid.wrap == bid.wrap)
  862. ) {
  863. if (bid.block < sbid->bid.block)
  864. sbid->bid = bid;
  865. else return;
  866. break;
  867. }
  868. /* Sort in according to logical block number. */
  869. if (bid.block < sbid->bid.block) {
  870. tape_34xx_append_new_sbid(bid, l->prev);
  871. break;
  872. }
  873. }
  874. /* List empty or new block bigger than last entry. */
  875. if (l == sbid_list)
  876. tape_34xx_append_new_sbid(bid, l->prev);
  877. DBF_LH(4, "Current list is:\n");
  878. list_for_each(l, sbid_list) {
  879. sbid = list_entry(l, struct tape_34xx_sbid, list);
  880. DBF_LH(4, "%d:%03d@%05d\n",
  881. sbid->bid.wrap,
  882. sbid->bid.segment,
  883. sbid->bid.block
  884. );
  885. }
  886. }
  887. /*
  888. * Delete all entries from the search block ID list that belong to tape blocks
  889. * equal or higher than the given number.
  890. */
  891. static void
  892. tape_34xx_delete_sbid_from(struct tape_device *device, int from)
  893. {
  894. struct list_head * sbid_list;
  895. struct tape_34xx_sbid * sbid;
  896. struct list_head * l;
  897. struct list_head * n;
  898. sbid_list = (struct list_head *) device->discdata;
  899. if (!sbid_list)
  900. return;
  901. list_for_each_safe(l, n, sbid_list) {
  902. sbid = list_entry(l, struct tape_34xx_sbid, list);
  903. if (sbid->bid.block >= from) {
  904. DBF_LH(4, "Delete sbid %d:%03d@%05d\n",
  905. sbid->bid.wrap,
  906. sbid->bid.segment,
  907. sbid->bid.block
  908. );
  909. list_del(l);
  910. kfree(sbid);
  911. }
  912. }
  913. }
  914. /*
  915. * Merge hardware position data into a block id.
  916. */
  917. static void
  918. tape_34xx_merge_sbid(
  919. struct tape_device * device,
  920. struct tape_34xx_block_id * bid
  921. ) {
  922. struct tape_34xx_sbid * sbid;
  923. struct tape_34xx_sbid * sbid_to_use;
  924. struct list_head * sbid_list;
  925. struct list_head * l;
  926. sbid_list = (struct list_head *) device->discdata;
  927. bid->wrap = 0;
  928. bid->segment = 1;
  929. if (!sbid_list || list_empty(sbid_list))
  930. return;
  931. sbid_to_use = NULL;
  932. list_for_each(l, sbid_list) {
  933. sbid = list_entry(l, struct tape_34xx_sbid, list);
  934. if (sbid->bid.block >= bid->block)
  935. break;
  936. sbid_to_use = sbid;
  937. }
  938. if (sbid_to_use) {
  939. bid->wrap = sbid_to_use->bid.wrap;
  940. bid->segment = sbid_to_use->bid.segment;
  941. DBF_LH(4, "Use %d:%03d@%05d for %05d\n",
  942. sbid_to_use->bid.wrap,
  943. sbid_to_use->bid.segment,
  944. sbid_to_use->bid.block,
  945. bid->block
  946. );
  947. }
  948. }
  949. static int
  950. tape_34xx_setup_device(struct tape_device * device)
  951. {
  952. int rc;
  953. struct list_head * discdata;
  954. DBF_EVENT(6, "34xx device setup\n");
  955. if ((rc = tape_std_assign(device)) == 0) {
  956. if ((rc = tape_34xx_medium_sense(device)) != 0) {
  957. DBF_LH(3, "34xx medium sense returned %d\n", rc);
  958. }
  959. }
  960. discdata = kmalloc(sizeof(struct list_head), GFP_KERNEL);
  961. if (discdata) {
  962. INIT_LIST_HEAD(discdata);
  963. device->discdata = discdata;
  964. }
  965. return rc;
  966. }
  967. static void
  968. tape_34xx_cleanup_device(struct tape_device *device)
  969. {
  970. tape_std_unassign(device);
  971. if (device->discdata) {
  972. tape_34xx_delete_sbid_from(device, 0);
  973. kfree(device->discdata);
  974. device->discdata = NULL;
  975. }
  976. }
  977. /*
  978. * MTTELL: Tell block. Return the number of block relative to current file.
  979. */
  980. static int
  981. tape_34xx_mttell(struct tape_device *device, int mt_count)
  982. {
  983. struct {
  984. struct tape_34xx_block_id cbid;
  985. struct tape_34xx_block_id dbid;
  986. } __attribute__ ((packed)) block_id;
  987. int rc;
  988. rc = tape_std_read_block_id(device, (__u64 *) &block_id);
  989. if (rc)
  990. return rc;
  991. tape_34xx_add_sbid(device, block_id.cbid);
  992. return block_id.cbid.block;
  993. }
  994. /*
  995. * MTSEEK: seek to the specified block.
  996. */
  997. static int
  998. tape_34xx_mtseek(struct tape_device *device, int mt_count)
  999. {
  1000. struct tape_request *request;
  1001. struct tape_34xx_block_id * bid;
  1002. if (mt_count > 0x3fffff) {
  1003. DBF_EXCEPTION(6, "xsee parm\n");
  1004. return -EINVAL;
  1005. }
  1006. request = tape_alloc_request(3, 4);
  1007. if (IS_ERR(request))
  1008. return PTR_ERR(request);
  1009. /* setup ccws */
  1010. request->op = TO_LBL;
  1011. bid = (struct tape_34xx_block_id *) request->cpdata;
  1012. bid->format = (*device->modeset_byte & 0x08) ?
  1013. TAPE34XX_FMT_3480_XF : TAPE34XX_FMT_3480;
  1014. bid->block = mt_count;
  1015. tape_34xx_merge_sbid(device, bid);
  1016. tape_ccw_cc(request->cpaddr, MODE_SET_DB, 1, device->modeset_byte);
  1017. tape_ccw_cc(request->cpaddr + 1, LOCATE, 4, request->cpdata);
  1018. tape_ccw_end(request->cpaddr + 2, NOP, 0, NULL);
  1019. /* execute it */
  1020. return tape_do_io_free(device, request);
  1021. }
  1022. /*
  1023. * List of 3480/3490 magnetic tape commands.
  1024. */
  1025. static tape_mtop_fn tape_34xx_mtop[TAPE_NR_MTOPS] = {
  1026. [MTRESET] = tape_std_mtreset,
  1027. [MTFSF] = tape_std_mtfsf,
  1028. [MTBSF] = tape_std_mtbsf,
  1029. [MTFSR] = tape_std_mtfsr,
  1030. [MTBSR] = tape_std_mtbsr,
  1031. [MTWEOF] = tape_std_mtweof,
  1032. [MTREW] = tape_std_mtrew,
  1033. [MTOFFL] = tape_std_mtoffl,
  1034. [MTNOP] = tape_std_mtnop,
  1035. [MTRETEN] = tape_std_mtreten,
  1036. [MTBSFM] = tape_std_mtbsfm,
  1037. [MTFSFM] = tape_std_mtfsfm,
  1038. [MTEOM] = tape_std_mteom,
  1039. [MTERASE] = tape_std_mterase,
  1040. [MTRAS1] = NULL,
  1041. [MTRAS2] = NULL,
  1042. [MTRAS3] = NULL,
  1043. [MTSETBLK] = tape_std_mtsetblk,
  1044. [MTSETDENSITY] = NULL,
  1045. [MTSEEK] = tape_34xx_mtseek,
  1046. [MTTELL] = tape_34xx_mttell,
  1047. [MTSETDRVBUFFER] = NULL,
  1048. [MTFSS] = NULL,
  1049. [MTBSS] = NULL,
  1050. [MTWSM] = NULL,
  1051. [MTLOCK] = NULL,
  1052. [MTUNLOCK] = NULL,
  1053. [MTLOAD] = tape_std_mtload,
  1054. [MTUNLOAD] = tape_std_mtunload,
  1055. [MTCOMPRESSION] = tape_std_mtcompression,
  1056. [MTSETPART] = NULL,
  1057. [MTMKPART] = NULL
  1058. };
  1059. /*
  1060. * Tape discipline structure for 3480 and 3490.
  1061. */
  1062. static struct tape_discipline tape_discipline_34xx = {
  1063. .owner = THIS_MODULE,
  1064. .setup_device = tape_34xx_setup_device,
  1065. .cleanup_device = tape_34xx_cleanup_device,
  1066. .process_eov = tape_std_process_eov,
  1067. .irq = tape_34xx_irq,
  1068. .read_block = tape_std_read_block,
  1069. .write_block = tape_std_write_block,
  1070. .ioctl_fn = tape_34xx_ioctl,
  1071. .mtop_array = tape_34xx_mtop
  1072. };
  1073. static struct ccw_device_id tape_34xx_ids[] = {
  1074. { CCW_DEVICE_DEVTYPE(0x3480, 0, 0x3480, 0), .driver_info = tape_3480},
  1075. { CCW_DEVICE_DEVTYPE(0x3490, 0, 0x3490, 0), .driver_info = tape_3490},
  1076. { /* end of list */ },
  1077. };
  1078. static int
  1079. tape_34xx_online(struct ccw_device *cdev)
  1080. {
  1081. return tape_generic_online(
  1082. dev_get_drvdata(&cdev->dev),
  1083. &tape_discipline_34xx
  1084. );
  1085. }
  1086. static struct ccw_driver tape_34xx_driver = {
  1087. .driver = {
  1088. .name = "tape_34xx",
  1089. .owner = THIS_MODULE,
  1090. },
  1091. .ids = tape_34xx_ids,
  1092. .probe = tape_generic_probe,
  1093. .remove = tape_generic_remove,
  1094. .set_online = tape_34xx_online,
  1095. .set_offline = tape_generic_offline,
  1096. .freeze = tape_generic_pm_suspend,
  1097. .int_class = IRQIO_TAP,
  1098. };
  1099. static int
  1100. tape_34xx_init (void)
  1101. {
  1102. int rc;
  1103. TAPE_DBF_AREA = debug_register ( "tape_34xx", 2, 2, 4*sizeof(long));
  1104. debug_register_view(TAPE_DBF_AREA, &debug_sprintf_view);
  1105. #ifdef DBF_LIKE_HELL
  1106. debug_set_level(TAPE_DBF_AREA, 6);
  1107. #endif
  1108. DBF_EVENT(3, "34xx init\n");
  1109. /* Register driver for 3480/3490 tapes. */
  1110. rc = ccw_driver_register(&tape_34xx_driver);
  1111. if (rc)
  1112. DBF_EVENT(3, "34xx init failed\n");
  1113. else
  1114. DBF_EVENT(3, "34xx registered\n");
  1115. return rc;
  1116. }
  1117. static void
  1118. tape_34xx_exit(void)
  1119. {
  1120. ccw_driver_unregister(&tape_34xx_driver);
  1121. debug_unregister(TAPE_DBF_AREA);
  1122. }
  1123. MODULE_DEVICE_TABLE(ccw, tape_34xx_ids);
  1124. MODULE_AUTHOR("(C) 2001-2002 IBM Deutschland Entwicklung GmbH");
  1125. MODULE_DESCRIPTION("Linux on zSeries channel attached 3480 tape device driver");
  1126. MODULE_LICENSE("GPL");
  1127. module_init(tape_34xx_init);
  1128. module_exit(tape_34xx_exit);