2 /***************************************************************************
4 * drivers/s390/char/tape34xx.h
5 * common tape device discipline for 34xx tapes.
7 * S390 and zSeries version
8 * Copyright (C) 2001 IBM Corporation
9 * Author(s): Carsten Otte <cotte@de.ibm.com>
10 * Tuan Ngo-Anh <ngoanh@de.ibm.com>
12 ****************************************************************************
20 * The CCW commands for the Tape type of command.
23 #define INVALID_00 0x00 /* Invalid cmd */
24 #define BACKSPACEBLOCK 0x27 /* Back Space block */
25 #define BACKSPACEFILE 0x2f /* Back Space file */
26 #define DATA_SEC_ERASE 0x97 /* Data security erase */
27 #define ERASE_GAP 0x17 /* Erase Gap */
28 #define FORSPACEBLOCK 0x37 /* Forward space block */
29 #define FORSPACEFILE 0x3F /* Forward Space file */
30 #define FORCE_STREAM_CNT 0xEB /* Forced streaming count # */
31 #define NOP 0x03 /* No operation */
32 #define READ_FORWARD 0x02 /* Read forward */
33 #define REWIND 0x07 /* Rewind */
34 #define REWIND_UNLOAD 0x0F /* Rewind and Unload */
35 #define SENSE 0x04 /* Sense */
36 #define NEW_MODE_SET 0xEB /* Guess it is Mode set */
37 #define WRITE_CMD 0x01 /* Write */
38 #define WRITETAPEMARK 0x1F /* Write Tape Mark */
40 #define ASSIGN 0xB7 /* 3420 REJECT,3480 OK */
41 #define CONTROL_ACCESS 0xE3 /* Set high speed */
42 #define DIAG_MODE_SET 0x0B /* 3420 NOP, 3480 REJECT*/
43 #define LOAD_DISPLAY 0x9F /* 3420 REJECT,3480 OK */
44 #define LOCATE 0x4F /* 3420 REJ, 3480 NOP */
45 #define LOOP_WRITE_TO_READ 0x8B /* 3480 REJECT */
46 #define MODE_SET_DB 0xDB /* 3420 REJECT,3480 OK */
47 #define MODE_SET_C3 0xC3 /* for 3420 */
48 #define MODE_SET_CB 0xCB /* for 3420 */
49 #define MODE_SET_D3 0xD3 /* for 3420 */
50 #define READ_BACKWARD 0x0C /* */
51 #define READ_BLOCK_ID 0x22 /* 3420 REJECT,3480 OK */
52 #define READ_BUFFER 0x12 /* 3420 REJECT,3480 OK */
53 #define READ_BUFF_LOG 0x24 /* 3420 REJECT,3480 OK */
54 #define RELEASE 0xD4 /* 3420 NOP, 3480 REJECT*/
55 #define REQ_TRK_IN_ERROR 0x1B /* 3420 NOP, 3480 REJECT*/
56 #define RESERVE 0xF4 /* 3420 NOP, 3480 REJECT*/
57 #define SENSE_GROUP_ID 0x34 /* 3420 REJECT,3480 OK */
58 #define SENSE_ID 0xE4 /* 3420 REJECT,3480 OK */
59 #define READ_DEV_CHAR 0x64 /* Read device characteristics */
60 #define SET_DIAGNOSE 0x4B /* 3420 NOP, 3480 REJECT*/
61 #define SET_GROUP_ID 0xAF /* 3420 REJECT,3480 OK */
62 #define SET_TAPE_WRITE_IMMED 0xC3 /* for 3480 */
63 #define SUSPEND 0x5B /* 3420 REJ, 3480 NOP */
64 #define SYNC 0x43 /* Synchronize (flush buffer) */
65 #define UNASSIGN 0xC7 /* 3420 REJECT,3480 OK */
66 #define PERF_SUBSYS_FUNC 0x77 /* 3490 CMD */
67 #define READ_CONFIG_DATA 0xFA /* 3490 CMD */
68 #define READ_MESSAGE_ID 0x4E /* 3490 CMD */
69 #define READ_SUBSYS_DATA 0x3E /* 3490 CMD */
70 #define SET_INTERFACE_ID 0x73 /* 3490 CMD */
73 #define MIN(a,b) ( (a) < (b) ? (a) : (b) )
77 #define BLOCKSIZE 4096 /* size of the tape rcds */
79 #define COMMAND_CHAIN CCW_FLAG_CC /* redefine from irq.h */
80 #define CHANNEL_END DEV_STAT_CHN_END /* redefine from irq.h */
81 #define DEVICE_END DEV_STAT_DEV_END /* redefine from irq.h */
82 #define UNIT_CHECK DEV_STAT_UNIT_CHECK /* redefine from irq.h */
83 #define UNIT_EXCEPTION DEV_STAT_UNIT_EXCEP /* redefine from irq.h */
84 #define CONTROL_UNIT_END DEV_STAT_CU_END /* redefine from irq.h */
85 #define INCORR_LEN SCHN_STAT_INCORR_LEN /* redefine from irq.h */
87 #define SENSE_COMMAND_REJECT 0x80
88 #define SENSE_INTERVENTION_REQUIRED 0x40
89 #define SENSE_BUS_OUT_CHECK 0x20
90 #define SENSE_EQUIPMENT_CHECK 0x10
91 #define SENSE_DATA_CHECK 0x08
92 #define SENSE_OVERRUN 0x04
93 #define SENSE_DEFERRED_UNIT_CHECK 0x02
94 #define SENSE_ASSIGNED_ELSEWHERE 0x01
96 #define SENSE_LOCATE_FAILURE 0x80
97 #define SENSE_DRIVE_ONLINE 0x40
98 #define SENSE_RESERVED 0x20
99 #define SENSE_RECORD_SEQUENCE_ERR 0x10
100 #define SENSE_BEGINNING_OF_TAPE 0x08
101 #define SENSE_WRITE_MODE 0x04
102 #define SENSE_WRITE_PROTECT 0x02
103 #define SENSE_NOT_CAPABLE 0x01
105 #define SENSE_CHANNEL_ADAPTER_CODE 0xE0
106 #define SENSE_CHANNEL_ADAPTER_LOC 0x10
107 #define SENSE_REPORTING_CU 0x08
108 #define SENSE_AUTOMATIC_LOADER 0x04
109 #define SENSE_TAPE_SYNC_MODE 0x02
110 #define SENSE_TAPE_POSITIONING 0x01
112 typedef struct _tape34xx_disc_data_t {
114 } tape34xx_disc_data_t __attribute__ ((packed, aligned(8)));
116 /* discipline functions */
117 int tape34xx_ioctl_overload (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);
118 ccw_req_t * tape34xx_write_block (const char *data, size_t count, tape_info_t * ti);
119 void tape34xx_free_write_block (ccw_req_t * cqr, tape_info_t * ti);
120 ccw_req_t * tape34xx_read_block (const char *data, size_t count, tape_info_t * ti);
121 void tape34xx_free_read_block (ccw_req_t * cqr, tape_info_t * ti);
122 void tape34xx_clear_read_block (ccw_req_t * cqr, tape_info_t * ti);
123 ccw_req_t * tape34xx_mtfsf (tape_info_t * ti, int count);
124 ccw_req_t * tape34xx_mtbsf (tape_info_t * ti, int count);
125 ccw_req_t * tape34xx_mtfsr (tape_info_t * ti, int count);
126 ccw_req_t * tape34xx_mtbsr (tape_info_t * ti, int count);
127 ccw_req_t * tape34xx_mtweof (tape_info_t * ti, int count);
128 ccw_req_t * tape34xx_mtrew (tape_info_t * ti, int count);
129 ccw_req_t * tape34xx_mtoffl (tape_info_t * ti, int count);
130 ccw_req_t * tape34xx_mtnop (tape_info_t * ti, int count);
131 ccw_req_t * tape34xx_mtbsfm (tape_info_t * ti, int count);
132 ccw_req_t * tape34xx_mtfsfm (tape_info_t * ti, int count);
133 ccw_req_t * tape34xx_mteom (tape_info_t * ti, int count);
134 ccw_req_t * tape34xx_mterase (tape_info_t * ti, int count);
135 ccw_req_t * tape34xx_mtsetdensity (tape_info_t * ti, int count);
136 ccw_req_t * tape34xx_mtseek (tape_info_t * ti, int count);
137 ccw_req_t * tape34xx_mttell (tape_info_t * ti, int count);
138 ccw_req_t * tape34xx_mtsetdrvbuffer (tape_info_t * ti, int count);
139 ccw_req_t * tape34xx_mtlock (tape_info_t * ti, int count);
140 ccw_req_t * tape34xx_mtunlock (tape_info_t * ti, int count);
141 ccw_req_t * tape34xx_mtload (tape_info_t * ti, int count);
142 ccw_req_t * tape34xx_mtunload (tape_info_t * ti, int count);
143 ccw_req_t * tape34xx_mtcompression (tape_info_t * ti, int count);
144 ccw_req_t * tape34xx_mtsetpart (tape_info_t * ti, int count);
145 ccw_req_t * tape34xx_mtmkpart (tape_info_t * ti, int count);
146 ccw_req_t * tape34xx_mtiocget (tape_info_t * ti, int count);
147 ccw_req_t * tape34xx_mtiocpos (tape_info_t * ti, int count);
148 ccw_req_t * tape34xx_bread (struct request *req, tape_info_t* ti,int tapeblock_major);
149 ccw_req_t * tape34xx_bwrite (struct request *req, tape_info_t* ti,int tapeblock_major);
150 void tape34xx_free_bread (ccw_req_t*,struct _tape_info_t*);
151 void tape34xx_free_bwrite (ccw_req_t*,struct _tape_info_t*);
154 void tape34xx_default_handler (tape_info_t * ti);
155 void tape34xx_unexpect_uchk_handler (tape_info_t * ti);
156 void tape34xx_unused_done(tape_info_t* ti);
157 void tape34xx_idle_done(tape_info_t* ti);
158 void tape34xx_block_done(tape_info_t* ti);
159 void tape34xx_bsf_init_done(tape_info_t* ti);
160 void tape34xx_dse_init_done(tape_info_t* ti);
161 void tape34xx_fsf_init_done(tape_info_t* ti);
162 void tape34xx_bsb_init_done(tape_info_t* ti);
163 void tape34xx_fsb_init_done(tape_info_t* ti);
164 void tape34xx_lbl_init_done(tape_info_t* ti);
165 void tape34xx_nop_init_done(tape_info_t* ti);
166 void tape34xx_rfo_init_done(tape_info_t* ti);
167 void tape34xx_rbi_init_done(tape_info_t* ti);
168 void tape34xx_rew_init_done(tape_info_t* ti);
169 void tape34xx_rew_release_init_done(tape_info_t* ti);
170 void tape34xx_run_init_done(tape_info_t* ti);
171 void tape34xx_wri_init_done(tape_info_t* ti);
172 void tape34xx_wtm_init_done(tape_info_t* ti);
174 extern void schedule_tapeblock_exec_IO (tape_info_t *ti);
176 // the error recovery stuff:
177 void tape34xx_error_recovery (tape_info_t* ti);
178 void tape34xx_error_recovery_has_failed (tape_info_t* ti,int error_id);
179 void tape34xx_error_recovery_succeded(tape_info_t* ti);
180 void tape34xx_error_recovery_do_retry(tape_info_t* ti);
181 void tape34xx_error_recovery_read_opposite (tape_info_t* ti);
182 void tape34xx_error_recovery_HWBUG (tape_info_t* ti,int condno);
183 #endif // _TAPE34XX_H