tape_34xx.c 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232
  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);