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