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