tape_3590.h 3.7 KB

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