tape_3590.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /*
  2. * tape device discipline for 3590 tapes.
  3. *
  4. * Copyright IBM Corp. 2001, 2006
  5. * Author(s): Stefan Bader <shbader@de.ibm.com>
  6. * Michael Holzheu <holzheu@de.ibm.com>
  7. * Martin Schwidefsky <schwidefsky@de.ibm.com>
  8. */
  9. #ifndef _TAPE_3590_H
  10. #define _TAPE_3590_H
  11. #define MEDIUM_SENSE 0xc2
  12. #define READ_PREVIOUS 0x0a
  13. #define MODE_SENSE 0xcf
  14. #define PERFORM_SS_FUNC 0x77
  15. #define READ_SS_DATA 0x3e
  16. #define PREP_RD_SS_DATA 0x18
  17. #define RD_ATTMSG 0x3
  18. #define SENSE_BRA_PER 0
  19. #define SENSE_BRA_CONT 1
  20. #define SENSE_BRA_RE 2
  21. #define SENSE_BRA_DRE 3
  22. #define SENSE_FMT_LIBRARY 0x23
  23. #define SENSE_FMT_UNSOLICITED 0x40
  24. #define SENSE_FMT_COMMAND_REJ 0x41
  25. #define SENSE_FMT_COMMAND_EXEC0 0x50
  26. #define SENSE_FMT_COMMAND_EXEC1 0x51
  27. #define SENSE_FMT_EVENT0 0x60
  28. #define SENSE_FMT_EVENT1 0x61
  29. #define SENSE_FMT_MIM 0x70
  30. #define SENSE_FMT_SIM 0x71
  31. #define MSENSE_UNASSOCIATED 0x00
  32. #define MSENSE_ASSOCIATED_MOUNT 0x01
  33. #define MSENSE_ASSOCIATED_UMOUNT 0x02
  34. #define MSENSE_CRYPT_MASK 0x00000010
  35. #define TAPE_3590_MAX_MSG 0xb0
  36. /* Datatypes */
  37. struct tape_3590_disc_data {
  38. struct tape390_crypt_info crypt_info;
  39. int read_back_op;
  40. };
  41. #define TAPE_3590_CRYPT_INFO(device) \
  42. ((struct tape_3590_disc_data*)(device->discdata))->crypt_info
  43. #define TAPE_3590_READ_BACK_OP(device) \
  44. ((struct tape_3590_disc_data*)(device->discdata))->read_back_op
  45. struct tape_3590_sense {
  46. unsigned int command_rej:1;
  47. unsigned int interv_req:1;
  48. unsigned int bus_out_check:1;
  49. unsigned int eq_check:1;
  50. unsigned int data_check:1;
  51. unsigned int overrun:1;
  52. unsigned int def_unit_check:1;
  53. unsigned int assgnd_elsew:1;
  54. unsigned int locate_fail:1;
  55. unsigned int inst_online:1;
  56. unsigned int reserved:1;
  57. unsigned int blk_seq_err:1;
  58. unsigned int begin_part:1;
  59. unsigned int wr_mode:1;
  60. unsigned int wr_prot:1;
  61. unsigned int not_cap:1;
  62. unsigned int bra:2;
  63. unsigned int lc:3;
  64. unsigned int vlf_active:1;
  65. unsigned int stm:1;
  66. unsigned int med_pos:1;
  67. unsigned int rac:8;
  68. unsigned int rc_rqc:16;
  69. unsigned int mc:8;
  70. unsigned int sense_fmt:8;
  71. union {
  72. struct {
  73. unsigned int emc:4;
  74. unsigned int smc:4;
  75. unsigned int sev:2;
  76. unsigned int reserved:6;
  77. unsigned int md:8;
  78. unsigned int refcode:8;
  79. unsigned int mid:16;
  80. unsigned int mp:16;
  81. unsigned char volid[6];
  82. unsigned int fid:8;
  83. } f70;
  84. struct {
  85. unsigned int emc:4;
  86. unsigned int smc:4;
  87. unsigned int sev:2;
  88. unsigned int reserved1:5;
  89. unsigned int mdf:1;
  90. unsigned char md[3];
  91. unsigned int simid:8;
  92. unsigned int uid:16;
  93. unsigned int refcode1:16;
  94. unsigned int refcode2:16;
  95. unsigned int refcode3:16;
  96. unsigned int reserved2:8;
  97. } f71;
  98. unsigned char data[14];
  99. } fmt;
  100. unsigned char pad[10];
  101. } __attribute__ ((packed));
  102. struct tape_3590_med_sense {
  103. unsigned int macst:4;
  104. unsigned int masst:4;
  105. char pad1[7];
  106. unsigned int flags;
  107. char pad2[116];
  108. } __attribute__ ((packed));
  109. struct tape_3590_rdc_data {
  110. char data[64];
  111. } __attribute__ ((packed));
  112. /* Datastructures for 3592 encryption support */
  113. struct tape3592_kekl {
  114. __u8 flags;
  115. char label[64];
  116. } __attribute__ ((packed));
  117. struct tape3592_kekl_pair {
  118. __u8 count;
  119. struct tape3592_kekl kekl[2];
  120. } __attribute__ ((packed));
  121. struct tape3592_kekl_query_data {
  122. __u16 len;
  123. __u8 fmt;
  124. __u8 mc;
  125. __u32 id;
  126. __u8 flags;
  127. struct tape3592_kekl_pair kekls;
  128. char reserved[116];
  129. } __attribute__ ((packed));
  130. struct tape3592_kekl_query_order {
  131. __u8 code;
  132. __u8 flags;
  133. char reserved1[2];
  134. __u8 max_count;
  135. char reserved2[35];
  136. } __attribute__ ((packed));
  137. struct tape3592_kekl_set_order {
  138. __u8 code;
  139. __u8 flags;
  140. char reserved1[2];
  141. __u8 op;
  142. struct tape3592_kekl_pair kekls;
  143. char reserved2[120];
  144. } __attribute__ ((packed));
  145. #endif /* _TAPE_3590_H */