Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  *    tape device discipline for 3590 tapes.
0004  *
0005  *    Copyright IBM Corp. 2001, 2006
0006  *    Author(s): Stefan Bader <shbader@de.ibm.com>
0007  *       Michael Holzheu <holzheu@de.ibm.com>
0008  *       Martin Schwidefsky <schwidefsky@de.ibm.com>
0009  */
0010 
0011 #ifndef _TAPE_3590_H
0012 #define _TAPE_3590_H
0013 
0014 #define MEDIUM_SENSE    0xc2
0015 #define READ_PREVIOUS   0x0a
0016 #define MODE_SENSE  0xcf
0017 #define PERFORM_SS_FUNC 0x77
0018 #define READ_SS_DATA    0x3e
0019 
0020 #define PREP_RD_SS_DATA 0x18
0021 #define RD_ATTMSG   0x3
0022 
0023 #define SENSE_BRA_PER  0
0024 #define SENSE_BRA_CONT 1
0025 #define SENSE_BRA_RE   2
0026 #define SENSE_BRA_DRE  3
0027 
0028 #define SENSE_FMT_LIBRARY   0x23
0029 #define SENSE_FMT_UNSOLICITED   0x40
0030 #define SENSE_FMT_COMMAND_REJ   0x41
0031 #define SENSE_FMT_COMMAND_EXEC0 0x50
0032 #define SENSE_FMT_COMMAND_EXEC1 0x51
0033 #define SENSE_FMT_EVENT0    0x60
0034 #define SENSE_FMT_EVENT1    0x61
0035 #define SENSE_FMT_MIM       0x70
0036 #define SENSE_FMT_SIM       0x71
0037 
0038 #define MSENSE_UNASSOCIATED  0x00
0039 #define MSENSE_ASSOCIATED_MOUNT  0x01
0040 #define MSENSE_ASSOCIATED_UMOUNT 0x02
0041 #define MSENSE_CRYPT_MASK    0x00000010
0042 
0043 #define TAPE_3590_MAX_MSG    0xb0
0044 
0045 /* Datatypes */
0046 
0047 struct tape_3590_disc_data {
0048     struct tape390_crypt_info crypt_info;
0049     int read_back_op;
0050 };
0051 
0052 #define TAPE_3590_CRYPT_INFO(device) \
0053     ((struct tape_3590_disc_data*)(device->discdata))->crypt_info
0054 #define TAPE_3590_READ_BACK_OP(device) \
0055     ((struct tape_3590_disc_data*)(device->discdata))->read_back_op
0056 
0057 struct tape_3590_sense {
0058 
0059     unsigned int command_rej:1;
0060     unsigned int interv_req:1;
0061     unsigned int bus_out_check:1;
0062     unsigned int eq_check:1;
0063     unsigned int data_check:1;
0064     unsigned int overrun:1;
0065     unsigned int def_unit_check:1;
0066     unsigned int assgnd_elsew:1;
0067 
0068     unsigned int locate_fail:1;
0069     unsigned int inst_online:1;
0070     unsigned int reserved:1;
0071     unsigned int blk_seq_err:1;
0072     unsigned int begin_part:1;
0073     unsigned int wr_mode:1;
0074     unsigned int wr_prot:1;
0075     unsigned int not_cap:1;
0076 
0077     unsigned int bra:2;
0078     unsigned int lc:3;
0079     unsigned int vlf_active:1;
0080     unsigned int stm:1;
0081     unsigned int med_pos:1;
0082 
0083     unsigned int rac:8;
0084 
0085     unsigned int rc_rqc:16;
0086 
0087     unsigned int mc:8;
0088 
0089     unsigned int sense_fmt:8;
0090 
0091     union {
0092         struct {
0093             unsigned int emc:4;
0094             unsigned int smc:4;
0095             unsigned int sev:2;
0096             unsigned int reserved:6;
0097             unsigned int md:8;
0098             unsigned int refcode:8;
0099             unsigned int mid:16;
0100             unsigned int mp:16;
0101             unsigned char volid[6];
0102             unsigned int fid:8;
0103         } f70;
0104         struct {
0105             unsigned int emc:4;
0106             unsigned int smc:4;
0107             unsigned int sev:2;
0108             unsigned int reserved1:5;
0109             unsigned int mdf:1;
0110             unsigned char md[3];
0111             unsigned int simid:8;
0112             unsigned int uid:16;
0113             unsigned int refcode1:16;
0114             unsigned int refcode2:16;
0115             unsigned int refcode3:16;
0116             unsigned int reserved2:8;
0117         } f71;
0118         unsigned char data[14];
0119     } fmt;
0120     unsigned char pad[10];
0121 
0122 } __attribute__ ((packed));
0123 
0124 struct tape_3590_med_sense {
0125     unsigned int macst:4;
0126     unsigned int masst:4;
0127     char pad1[7];
0128     unsigned int flags;
0129     char pad2[116];
0130 } __attribute__ ((packed));
0131 
0132 struct tape_3590_rdc_data {
0133     char data[64];
0134 } __attribute__ ((packed));
0135 
0136 /* Datastructures for 3592 encryption support */
0137 
0138 struct tape3592_kekl {
0139     __u8 flags;
0140     char label[64];
0141 } __attribute__ ((packed));
0142 
0143 struct tape3592_kekl_pair {
0144     __u8 count;
0145     struct tape3592_kekl kekl[2];
0146 } __attribute__ ((packed));
0147 
0148 struct tape3592_kekl_query_data {
0149     __u16 len;
0150     __u8  fmt;
0151     __u8  mc;
0152     __u32 id;
0153     __u8  flags;
0154     struct tape3592_kekl_pair kekls;
0155     char reserved[116];
0156 } __attribute__ ((packed));
0157 
0158 struct tape3592_kekl_query_order {
0159     __u8 code;
0160     __u8 flags;
0161     char reserved1[2];
0162     __u8 max_count;
0163     char reserved2[35];
0164 } __attribute__ ((packed));
0165 
0166 struct tape3592_kekl_set_order {
0167     __u8 code;
0168     __u8 flags;
0169     char reserved1[2];
0170     __u8 op;
0171     struct tape3592_kekl_pair kekls;
0172     char reserved2[120];
0173 } __attribute__ ((packed));
0174 
0175 #endif /* _TAPE_3590_H */