xref: /original-bsd/sys/vax/vax/mscp.h (revision f0fd5f8a)
1 /*	mscp.h	4.3	82/11/13	*/
2 /*
3  * Definitions for the Mass Storage Control Protocol
4  */
5 
6 
7 /*
8  * Control message opcodes
9  */
10 #define	M_OP_ABORT	0001	/* Abort command */
11 #define	M_OP_GTCMD	0002	/* Get command status command */
12 #define	M_OP_GTUNT	0003	/* Get unit status command */
13 #define	M_OP_STCON	0004	/* Set controller characteristics command */
14 #define	M_OP_SEREX	0007	/* Serious exception end message */
15 #define	M_OP_AVAIL	0010	/* Available command */
16 #define	M_OP_ONLIN	0011	/* Online command */
17 #define	M_OP_STUNT	0012	/* Set unit characteristics command */
18 #define	M_OP_DTACP	0013	/* Determine access paths command */
19 #define	M_OP_ACCES	0020	/* Access command */
20 #define	M_OP_CMPCD	0021	/* Compare controller data command */
21 #define	M_OP_ERASE	0022	/* Erase command */
22 #define	M_OP_FLUSH	0023	/* Flush command */
23 #define	M_OP_REPLC	0024	/* Replace command */
24 #define	M_OP_COMP	0040	/* Compare host data command */
25 #define	M_OP_READ	0041	/* Read command */
26 #define	M_OP_WRITE	0042	/* Write command */
27 #define	M_OP_AVATN	0100	/* Available attention message */
28 #define	M_OP_DUPUN	0101	/* Duplicate unit number attention message */
29 #define	M_OP_ACPTH	0102	/* Access path attention message */
30 #define	M_OP_END	0200	/* End message flag */
31 
32 
33 /*
34  * Generic command modifiers
35  */
36 #define	M_MD_EXPRS	0100000		/* Express request */
37 #define	M_MD_COMP	0040000		/* Compare */
38 #define	M_MD_CLSEX	0020000		/* Clear serious exception */
39 #define	M_MD_ERROR	0010000		/* Force error */
40 #define	M_MD_SCCHH	0004000		/* Suppress caching (high speed) */
41 #define	M_MD_SCCHL	0002000		/* Suppress caching (low speed) */
42 #define	M_MD_SECOR	0001000		/* Suppress error correction */
43 #define	M_MD_SEREC	0000400		/* Suppress error recovery */
44 #define	M_MD_SSHDW	0000200		/* Suppress shadowing */
45 #define	M_MD_WBKNV	0000100		/* Write back (non-volatile) */
46 #define	M_MD_WBKVL	0000040		/* Write back (volatile) */
47 #define	M_MD_WRSEQ	0000020		/* Write shadow set one unit at a time */
48 
49 /*
50  * AVAILABLE command modifiers
51  */
52 #define	M_MD_ALLCD	0000002		/* All class drivers */
53 #define	M_MD_SPNDW	0000001		/* Spin down */
54 
55 /*
56  * FLUSH command modifiers
57  */
58 #define	M_MD_FLENU	0000001		/* Flush entire unit */
59 #define	M_MD_VOLTL	0000002		/* Volatile only */
60 
61 /*
62  * GET UNIT STATUS command modifiers
63  */
64 #define	M_MD_NXUNT	0000001		/* Next unit */
65 
66 /*
67  * ONLINE command modifiers
68  */
69 #define	M_MD_RIP	0000001		/* Allow self destruction */
70 #define	M_MD_IGNMF	0000002		/* Ignore media format error */
71 
72 /*
73  * ONLINE and SET UNIT CHARACTERISTICS command modifiers
74  */
75 #define	M_MD_ALTHI	0000040		/* Alter host identifier */
76 #define	M_MD_SHDSP	0000020		/* Shadow unit specified */
77 #define	M_MD_CLWBL	0000010		/* Clear write-back data lost */
78 #define	M_MD_STWRP	0000004		/* Set write protect */
79 
80 /*
81  * REPLACE command modifiers
82  */
83 #define	M_MD_PRIMR	0000001		/* Primary replacement block */
84 
85 
86 /*
87  * End message flags
88  */
89 #define	M_EF_BBLKR	0200	/* Bad block reported */
90 #define	M_EF_BBLKU	0100	/* Bad block unreported */
91 #define	M_EF_ERLOG	0040	/* Error log generated */
92 #define	M_EF_SEREX	0020	/* Serious exception */
93 
94 
95 /*
96  * Controller flags
97  */
98 #define	M_CF_ATTN	0200	/* Enable attention messages */
99 #define	M_CF_MISC	0100	/* Enable miscellaneous error log messages */
100 #define	M_CF_OTHER	0040	/* Enable other host's error log messages */
101 #define	M_CF_THIS	0020	/* Enable this host's error log messages */
102 #define	M_CF_MLTHS	0004	/* Multi-host */
103 #define	M_CF_SHADW	0002	/* Shadowing */
104 #define	M_CF_576	0001	/* 576 byte sectors */
105 
106 
107 /*
108  * Unit flags
109  */
110 #define	M_UF_REPLC	0100000		/* Controller initiated bad block replacement */
111 #define	M_UF_INACT	0040000		/* Inactive shadow set unit */
112 #define	M_UF_WRTPH	0020000		/* Write protect (hardware) */
113 #define	M_UF_WRTPS	0010000		/* Write protect (software or volume) */
114 #define	M_UF_SCCHH	0004000		/* Suppress caching (high speed) */
115 #define	M_UF_SCCHL	0002000		/* Suppress caching (low speed) */
116 #define	M_UF_RMVBL	0000200		/* Removable media */
117 #define	M_UF_WBKNV	0000100		/* Write back (non-volatile) */
118 #define	M_UF_576	0000004		/* 576 byte sectors */
119 #define	M_UF_CMPWR	0000002		/* Compare writes */
120 #define	M_UF_CMPRD	0000001		/* Compare reads */
121 
122 
123 /*
124  * Status codes
125  */
126 #define	M_ST_MASK	037		/* Status code mask */
127 #define	M_ST_SUCC	000		/* Success */
128 #define	M_ST_ICMD	001		/* Invalid command */
129 #define	M_ST_ABRTD	002		/* Command aborted */
130 #define	M_ST_OFFLN	003		/* Unit offline */
131 #define	M_ST_AVLBL	004		/* Unit available */
132 #define	M_ST_MFMTE	005		/* Media format error */
133 #define	M_ST_WRTPR	006		/* Write protected */
134 #define	M_ST_COMP	007		/* Compare error */
135 #define	M_ST_DATA	010		/* Data error */
136 #define	M_ST_HSTBF	011		/* Host buffer access error */
137 #define	M_ST_CNTLR	012		/* Controller error */
138 #define	M_ST_DRIVE	013		/* Drive error */
139 #define	M_ST_DIAG	037		/* Message from an internal diagnostic */
140 
141 /*
142  * An MSCP packet
143  */
144 
145 struct mscp {
146 	struct	mscp_header mscp_header;/* device specific header */
147 	long	mscp_cmdref;		/* command reference number */
148 	short	mscp_unit;		/* unit number */
149 	short	mscp_xxx1;		/* unused */
150 	u_char	mscp_opcode;		/* opcode */
151 	u_char	mscp_flags;		/* end message flags */
152 	short	mscp_modifier;		/* modifiers */
153 	union {
154 	struct {
155 		long	Mscp_bytecnt;	/* byte count */
156 		long	Mscp_buffer;	/* buffer descriptor */
157 		long	Mscp_xxx2[2];	/* unused */
158 		long	Mscp_lbn;	/* logical block number */
159 		long	Mscp_xxx4;	/* unused */
160 		long	*Mscp_dscptr;	/* pointer to descriptor (software) */
161 		long	Mscp_sftwds[4];	/* software words, padding */
162 	} mscp_generic;
163 	struct {
164 		short	Mscp_version;	/* MSCP version */
165 		short	Mscp_cntflgs;	/* controller flags */
166 		short	Mscp_hsttmo;	/* host timeout */
167 		short	Mscp_usefrac;	/* use fraction */
168 		long	Mscp_time;	/* time and date */
169 	} mscp_setcntchar;
170 	struct {
171 		short	Mscp_multunt;	/* multi-unit code */
172 		short	Mscp_unitflgs;	/* unit flags */
173 		long	Mscp_hostid;	/* host identifier */
174 		quad	Mscp_unitid;	/* unit identifier */
175 		long	Mscp_mediaid;	/* media type identifier */
176 		short	Mscp_shdwunt;	/* shadow unit */
177 		short	Mscp_shdwsts;	/* shadow status */
178 		short	Mscp_track;	/* track size */
179 		short	Mscp_group;	/* group size */
180 		short	Mscp_cylinder;	/* cylinder size */
181 		short	Mscp_xxx3;	/* reserved */
182 		short	Mscp_rctsize;	/* RCT table size */
183 		char	Mscp_rbns;	/* RBNs / track */
184 		char	Mscp_rctcpys;	/* RCT copies */
185 	} mscp_getunitsts;
186 	} mscp_un;
187 };
188 
189 /*
190  * generic packet
191  */
192 
193 #define	mscp_bytecnt	mscp_un.mscp_generic.Mscp_bytecnt
194 #define	mscp_buffer	mscp_un.mscp_generic.Mscp_buffer
195 #define	mscp_lbn	mscp_un.mscp_generic.Mscp_lbn
196 #define	mscp_dscptr	mscp_un.mscp_generic.Mscp_dscptr
197 #define	mscp_sftwds	mscp_un.mscp_generic.Mscp_sftwds
198 #define	mscp_status	mscp_modifier
199 
200 /*
201  * Abort / Get Command Status packet
202  */
203 
204 #define	mscp_outref	mscp_bytecnt
205 
206 /*
207  * Online / Set Unit Characteristics packet
208  */
209 
210 #define	mscp_errlgfl	mscp_lbn
211 #define	mscp_copyspd	mscp_shdwsts
212 
213 /*
214  * Replace packet
215  */
216 
217 #define	mscp_rbn	mscp_bytecnt
218 
219 /*
220  * Set Controller Characteristics packet
221  */
222 
223 #define	mscp_version	mscp_un.mscp_setcntchar.Mscp_version
224 #define	mscp_cntflgs	mscp_un.mscp_setcntchar.Mscp_cntflgs
225 #define	mscp_hsttmo	mscp_un.mscp_setcntchar.Mscp_hsttmo
226 #define	mscp_usefrac	mscp_un.mscp_setcntchar.Mscp_usefrac
227 #define	mscp_time	mscp_un.mscp_setcntchar.Mscp_time
228 
229 /*
230  * Get Unit Status end packet
231  */
232 
233 #define	mscp_multunt	mscp_un.mscp_getunitsts.Mscp_multunt
234 #define	mscp_unitflgs	mscp_un.mscp_getunitsts.Mscp_unitflgs
235 #define	mscp_hostid	mscp_un.mscp_getunitsts.Mscp_hostid
236 #define	mscp_unitid	mscp_un.mscp_getunitsts.Mscp_unitid
237 #define	mscp_mediaid	mscp_un.mscp_getunitsts.Mscp_mediaid
238 #define	mscp_shdwunt	mscp_un.mscp_getunitsts.Mscp_shdwunt
239 #define	mscp_shdwsts	mscp_un.mscp_getunitsts.Mscp_shdwsts
240 #define	mscp_track	mscp_un.mscp_getunitsts.Mscp_track
241 #define	mscp_group	mscp_un.mscp_getunitsts.Mscp_group
242 #define	mscp_cylinder	mscp_un.mscp_getunitsts.Mscp_cylinder
243 #define	mscp_rctsize	mscp_un.mscp_getunitsts.Mscp_rctsize
244 #define	mscp_rbns	mscp_un.mscp_getunitsts.Mscp_rbns
245 #define	mscp_rctcpys	mscp_un.mscp_getunitsts.Mscp_rctcpys
246 
247 /*
248  * Online / Set Unit Characteristics end packet
249  */
250 
251 #define	mscp_untsize	mscp_dscptr
252 #define	mscp_volser	mscp_sftwds[0]
253 
254 /*
255  * Set Controller Characteristics end packet
256  */
257 
258 #define	mscp_cnttmo	mscp_hsttmo
259 #define	mscp_cntcmdl	mscp_usefrac
260 #define	mscp_cntid	mscp_unitid
261 
262 
263 /*
264  * Error Log message format codes
265  */
266 #define	M_FM_CNTERR	0	/* Controller error */
267 #define	M_FM_BUSADDR	1	/* Host memory access error */
268 #define	M_FM_DISKTRN	2	/* Disk transfer error */
269 #define	M_FM_SDI	3	/* SDI error */
270 #define	M_FM_SMLDSK	4	/* Small disk error */
271 
272 /*
273  * Error Log message flags
274  */
275 #define	M_LF_SUCC	0200	/* Operation successful */
276 #define	M_LF_CONT	0100	/* Operation continuing */
277 #define	M_LF_SQNRS	0001	/* Sequence number reset */
278 
279 /*
280  * MSCP Error Log packet
281  *
282  *	NOTE: MSCP packet must be padded to this size.
283  */
284 
285 struct mslg {
286 	struct	mscp_header mslg_header;/* device specific header */
287 	long	mslg_cmdref;		/* command reference number */
288 	short	mslg_unit;		/* unit number */
289 	short	mslg_seqnum;		/* sequence number */
290 	u_char	mslg_format;		/* format */
291 	u_char	mslg_flags;		/* error log message flags */
292 	short	mslg_event;		/* event code */
293 	quad	mslg_cntid;		/* controller id */
294 	u_char	mslg_cntsvr;		/* controller software version */
295 	u_char	mslg_cnthvr;		/* controller hardware version */
296 	short	mslg_multunt;		/* multi-unit code */
297 	quad	mslg_unitid;		/* unit id */
298 	u_char	mslg_unitsvr;		/* unit software version */
299 	u_char	mslg_unithvr;		/* unit hardware version */
300 	short	mslg_group;		/* group; retry + level */
301 	long	mslg_volser;		/* volume serial number */
302 	long	mslg_hdr;		/* header */
303 	char	mslg_sdistat[12];	/* SDI status information */
304 };
305 
306 #define	mslg_busaddr	mslg_unitid.val[0]
307 #define	mslg_sdecyl	mslg_group
308