1 /* pdp11_mscp.h: DEC MSCP and TMSCP definitionsn
2 
3    Copyright (c) 2001-2008, Robert M Supnik
4    Derived from work by Stephen F. Shirron
5 
6    Permission is hereby granted, free of charge, to any person obtaining a
7    copy of this software and associated documentation files (the "Software"),
8    to deal in the Software without restriction, including without limitation
9    the rights to use, copy, modify, merge, publish, distribute, sublicense,
10    and/or sell copies of the Software, and to permit persons to whom the
11    Software is furnished to do so, subject to the following conditions:
12 
13    The above copyright notice and this permission notice shall be included in
14    all copies or substantial portions of the Software.
15 
16    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19    ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20    IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21    CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 
23    Except as contained in this notice, the name of Robert M Supnik shall not be
24    used in advertising or otherwise to promote the sale, use or other dealings
25    in this Software without prior written authorization from Robert M Supnik.
26 
27    09-Jan-03    RMS     Tape read/write end pkt is longer than disk read/write
28    20-Sep-02    RMS     Merged TMSCP definitions
29 */
30 
31 #ifndef _PDP11_MSCP_H_
32 #define _PDP11_MSCP_H_  0
33 
34 /* Misc constants */
35 
36 #define UID_DISK        2                               /* disk class */
37 #define UID_TAPE        3                               /* tape class */
38 
39 /* Opcodes */
40 
41 #define OP_ABO          1                               /* b: abort */
42 #define OP_GCS          2                               /* b: get command status */
43 #define OP_GUS          3                               /* b: get unit status */
44 #define OP_SCC          4                               /* b: set controller char */
45 #define OP_AVL          8                               /* b: available */
46 #define OP_ONL          9                               /* b: online */
47 #define OP_SUC          10                              /* b: set unit char */
48 #define OP_DAP          11                              /* b: det acc paths - nop */
49 #define OP_ACC          16                              /* b: access */
50 #define OP_CCD          17                              /* d: compare - nop */
51 #define OP_ERS          18                              /* b: erase */
52 #define OP_FLU          19                              /* d: flush - nop */
53 #define OP_ERG          22                              /* t: erase gap */
54 #define OP_CMP          32                              /* b: compare */
55 #define OP_RD           33                              /* b: read */
56 #define OP_WR           34                              /* b: write */
57 #define OP_WTM          36                              /* t: write tape mark */
58 #define OP_POS          37                              /* t: reposition */
59 #define OP_FMT          47                              /* d: format */
60 #define OP_AVA          64                              /* b: unit now avail */
61 #define OP_END          0x80                            /* b: end flag */
62 
63 /* Modifiers */
64 
65 #define MD_EXP          0x8000                          /* d: express NI */
66 #define MD_CMP          0x4000                          /* b: compare NI */
67 #define MD_CSE          0x2000                          /* b: clr ser err */
68 #define MD_ERR          0x1000                          /* d: force error NI*/
69 #define MD_CDL          0x1000                          /* t: clr data lost NI*/
70 #define MD_SCH          0x0800                          /* t: supr cache NI */
71 #define MD_SEC          0x0200                          /* b: supr err corr NI */
72 #define MD_SER          0x0100                          /* b: supr err rec NI */
73 #define MD_DLE          0x0080                          /* t: detect LEOT */
74 #define MD_IMM          0x0040                          /* t: immediate NI */
75 #define MD_EXA          0x0020                          /* b: excl access NI */
76 #define MD_SHD          0x0010                          /* d: shadow NI */
77 #define MD_UNL          0x0010                          /* t avl: unload */
78 #define MD_ERW          0x0008                          /* t wr: enb rewrite */
79 #define MD_REV          0x0008                          /* t rd, pos: reverse */
80 #define MD_SWP          0x0004                          /* b suc: enb set wrp */
81 #define MD_OBC          0x0004                          /* t: pos: obj count */
82 #define MD_IMF          0x0002                          /* d onl: ign fmte NI */
83 #define MD_RWD          0x0002                          /* t pos: rewind */
84 #define MD_ACL          0x0002                          /* t avl: all class NI */
85 #define MD_NXU          0x0001                          /* b gus: next unit */
86 #define MD_RIP          0x0001                          /* d onl: allow rip NI */
87 
88 /* End flags */
89 
90 #define EF_LOG          0x0020                          /* b: error log */
91 #define EF_SXC          0x0010                          /* b: serious exc */
92 #define EF_EOT          0x0008                          /* end of tape */
93 #define EF_PLS          0x0004                          /* pos lost */
94 #define EF_DLS          0x0002                          /* cached data lost NI */
95 
96 /* Controller flags */
97 
98 #define CF_RPL          0x8000                          /* ctrl bad blk repl */
99 #define CF_ATN          0x0080                          /* enb attention */
100 #define CF_MSC          0x0040                          /* enb misc msgs */
101 #define CF_OTH          0x0020                          /* enb othr host msgs */
102 #define CF_THS          0x0010                          /* enb this host msgs */
103 #define CF_MSK          (CF_ATN|CF_MSC|CF_OTH|CF_THS)
104 
105 /* Unit flags */
106 
107 #define UF_RPL          0x8000                          /* d: ctrl bad blk repl */
108 #define UF_CAC          0x8000                          /* t: cache write back */
109 #define UF_WPH          0x2000                          /* b: wr prot hwre */
110 #define UF_WPS          0x1000                          /* b: wr prot swre */
111 #define UF_SCH          0x0800                          /* t: supr cache NI */
112 #define UF_EXA          0x0400                          /* b: exclusive NI */
113 #define UF_WPD          0x0100                          /* b: wr prot data NI */
114 #define UF_RMV          0x0080                          /* d: removable */
115 #define UF_WBN          0x0040                          /* t: write back NI */
116 #define UF_VSS          0x0020                          /* t: supr var speed NI */
117 #define UF_VSU          0x0010                          /* t: var speed unit NI */
118 #define UF_EWR          0x0008                          /* t: enh wr recovery NI */
119 #define UF_CMW          0x0002                          /* cmp writes NI */
120 #define UF_CMR          0x0001                          /* cmp reads NI */
121 
122 /* Error log flags */
123 
124 #define LF_SUC          0x0080                          /* b: successful */
125 #define LF_CON          0x0040                          /* b: continuing */
126 #define LF_BBR          0x0020                          /* d: bad blk repl NI */
127 #define LF_RCT          0x0010                          /* d: err in repl NI */
128 #define LF_SNR          0x0001                          /* b: seq # reset */
129 
130 /* Error log formats */
131 
132 #define FM_CNT          0                               /* b: port lf err */
133 #define FM_BAD          1                               /* b: bad host addr */
134 #define FM_DSK          2                               /* d: disk xfer */
135 #define FM_SDI          3                               /* d: SDI err */
136 #define FM_SDE          4                               /* d: sm disk err */
137 #define FM_TAP          5                               /* t: tape errors */
138 #define FM_RPL          9                               /* d: bad blk repl */
139 
140 /* Status codes */
141 
142 #define ST_SUC          0                               /* b: successful */
143 #define ST_CMD          1                               /* b: invalid cmd */
144 #define ST_ABO          2                               /* b: aborted cmd */
145 #define ST_OFL          3                               /* b: unit offline */
146 #define ST_AVL          4                               /* b: unit avail */
147 #define ST_MFE          5                               /* b: media fmt err */
148 #define ST_WPR          6                               /* b: write prot err */
149 #define ST_CMP          7                               /* b: compare err */
150 #define ST_DAT          8                               /* b: data err */
151 #define ST_HST          9                               /* b: host acc err */
152 #define ST_CNT          10                              /* b: ctrl err */
153 #define ST_DRV          11                              /* b: drive err */
154 #define ST_FMT          12                              /* t: formatter err */
155 #define ST_BOT          13                              /* t: BOT encountered */
156 #define ST_TMK          14                              /* t: tape mark */
157 #define ST_RDT          16                              /* t: record trunc */
158 #define ST_POL          17                              /* t: pos lost */
159 #define ST_SXC          18                              /* b: serious exc */
160 #define ST_LED          19                              /* t: LEOT detect */
161 #define ST_BBR          20                              /* d: bad block */
162 #define ST_DIA          31                              /* b: diagnostic */
163 #define ST_V_SUB        5                               /* subcode */
164 #define ST_V_INV        8                               /* invalid op */
165 
166 /* Status subcodes */
167 
168 #define SB_SUC_IGN      (1 << ST_V_SUB)                 /* t: unload ignored */
169 #define SB_SUC_ON       (8 << ST_V_SUB)                 /* b: already online */
170 #define SB_SUC_EOT      (32 << ST_V_SUB)                /* t: EOT encountered */
171 #define SB_SUC_RO       (128 << ST_V_SUB)               /* t: read only */
172 #define SB_OFL_NV       (1 << ST_V_SUB)                 /* b: no volume */
173 #define SB_OFL_INOP     (2 << ST_V_SUB)                 /* t: inoperative */
174 #define SB_AVL_INU      (32 << ST_V_SUB)                /* b: in use */
175 #define SB_WPR_SW       (128 << ST_V_SUB)               /* b: swre wlk */
176 #define SB_WPR_HW       (256 << ST_V_SUB)               /* b: hwre wlk */
177 #define SB_HST_OA       (1 << ST_V_SUB)                 /* b: odd addr */
178 #define SB_HST_OC       (2 << ST_V_SUB)                 /* d: odd count */
179 #define SB_HST_NXM      (3 << ST_V_SUB)                 /* b: nx memory */
180 #define SB_HST_PAR      (4 << ST_V_SUB)                 /* b: parity err */
181 #define SB_HST_PTE      (5 << ST_V_SUB)                 /* b: mapping err */
182 #define SB_DAT_RDE      (7 << ST_V_SUB)                 /* t: read err */
183 
184 /* Status invalid command subcodes */
185 
186 #define I_OPCD          (8 << ST_V_INV)                 /* inv opcode */
187 #define I_FLAG          (9 << ST_V_INV)                 /* inv flags */
188 #define I_MODF          (10 << ST_V_INV)                /* inv modifier */
189 #define I_BCNT          (12 << ST_V_INV)                /* inv byte cnt */
190 #define I_LBN           (28 << ST_V_INV)                /* inv LBN */
191 #define I_VRSN          (12 << ST_V_INV)                /* inv version */
192 #define I_FMTI          (28 << ST_V_INV)                /* inv format */
193 
194 /* Tape format flags */
195 
196 #define TF_9TK          0x0100                          /* 9 track */
197 #define TF_9TK_NRZ      0x0001                          /* 800 bpi */
198 #define TF_9TK_PE       0x0002                          /* 1600 bpi */
199 #define TF_9TK_GRP      0x0004                          /* 6250 bpi */
200 #define TF_CTP          0x0200                          /* TK50 */
201 #define TF_CTP_LO       0x0001                          /* low density */
202 #define TF_CTP_HI       0x0002                          /* hi density */
203 #define TF_3480         0x0300                          /* 3480 */
204 #define TF_WOD          0x0400                          /* RV80 */
205 
206 /* Packet formats - note that all packet lengths must be multiples of 4 bytes */
207 
208 /* Command packet header */
209 
210 #define CMD_REFL        2                               /* ref # */
211 #define CMD_REFH        3
212 #define CMD_UN          4                               /* unit # */
213 /*                      5                               /* reserved */
214 #define CMD_OPC         6                               /* opcode */
215 #define CMD_MOD         7                               /* modifier */
216 
217 #define CMD_OPC_V_OPC   0                               /* opcode */
218 #define CMD_OPC_M_OPC   0xFF
219 #define CMD_OPC_V_CAA   8                               /* cache NI */
220 #define CMD_OPC_M_CAA   0xFF
221 #define CMD_OPC_V_FLG   8                               /* flags */
222 #define CMD_OPC_M_FLG   0xFF
223 
224 /* Response packet header */
225 
226 #define RSP_LNT         12
227 #define RSP_REFL        2                               /* ref # */
228 #define RSP_REFH        3
229 #define RSP_UN          4                               /* unit # */
230 #define RSP_RSV         5                               /* reserved */
231 #define RSP_OPF         6                               /* opcd,flg */
232 #define RSP_STS         7                               /* modifiers */
233 
234 #define RSP_OPF_V_OPC   0                               /* opcode */
235 #define RSP_OPF_V_FLG   8                               /* flags */
236 
237 /* Abort packet - 2 W parameter, 2 W status  */
238 
239 #define ABO_LNT         16
240 #define ABO_REFL        8                               /* ref # */
241 #define ABO_REFH        9
242 
243 /* Avail packet - min size */
244 
245 #define AVL_LNT         12
246 
247 /* Erase packet - min size */
248 
249 #define ERS_LNT         12
250 
251 /* Erase gap - min size */
252 
253 #define ERG_LNT         12
254 
255 /* Flush - 10 W status (8 undefined) */
256 
257 #define FLU_LNT         32
258 /*                      8 - 15                          /* reserved */
259 #define FLU_POSL        16                              /* position */
260 #define FLU_POSH        17
261 
262 /* Write tape mark - 10W status (8 undefined) */
263 
264 #define WTM_LNT         32
265 /*                      8 - 15                          /* reserved */
266 #define WTM_POSL        16                              /* position */
267 #define WTM_POSH        17
268 
269 /* Get command status packet - 2 W parameter, 4 W status */
270 
271 #define GCS_LNT         20
272 #define GCS_REFL        8                               /* ref # */
273 #define GCS_REFH        9
274 #define GCS_STSL        10                              /* status */
275 #define GCS_STSH        11
276 
277 /* Format packet - 8 W parameters, none returned */
278 
279 #define FMT_LNT         12
280 #define FMT_IH          17                              /* magic bit */
281 
282 /* Get unit status packet - 18 W status (disk), 16W status (tape) */
283 
284 #define GUS_LNT_D       48
285 #define GUS_LNT_T       44
286 #define GUS_MLUN        8                               /* mlun */
287 #define GUS_UFL         9                               /* flags */
288 #define GUS_RSVL        10                              /* reserved */
289 #define GUS_RSVH        11
290 #define GUS_UIDA        12                              /* unit ID */
291 #define GUS_UIDB        13
292 #define GUS_UIDC        14
293 #define GUS_UIDD        15
294 #define GUS_MEDL        16                              /* media ID */
295 #define GUS_MEDH        17
296 #define GUS_UVER        23                              /* unit version */
297 
298 /* Disk specific status */
299 
300 #define GUS_SHUN        18                              /* shadowing */
301 #define GUS_SHST        19
302 #define GUS_TRK         20                              /* track */
303 #define GUS_GRP         21                              /* group */
304 #define GUS_CYL         22                              /* cylinder */
305 #define GUS_RCTS        24                              /* RCT size */
306 #define GUS_RBSC        25                              /* RBNs, copies */
307 
308 /* Tape specific status */
309 
310 #define GUS_FMT         18                              /* format */
311 #define GUS_SPEED       19                              /* speed */
312 #define GUS_MENU        20                              /* menu */
313 #define GUS_CAP         21                              /* capacity */
314 #define GUS_FVER        22                              /* fmtr version */
315 
316 #define GUS_UIDD_V_MOD  0                               /* unit model */
317 #define GUS_UIDD_V_CLS  8                               /* unit class */
318 #define GUS_RB_V_RBNS   0                               /* RBNs/track */
319 #define GUS_RB_V_RCTC   8                               /* RCT copies */
320 
321 /* Unit online - 2 W parameter, 16 W status (disk or tape) */
322 
323 #define ONL_LNT         44
324 #define ONL_MLUN        8                               /* mlun */
325 #define ONL_UFL         9                               /* flags */
326 #define ONL_RSVL        10                              /* reserved */
327 #define ONL_RSVH        11
328 #define ONL_UIDA        12                              /* unit ID */
329 #define ONL_UIDB        13
330 #define ONL_UIDC        14
331 #define ONL_UIDD        15
332 #define ONL_MEDL        16                              /* media ID */
333 #define ONL_MEDH        17
334 
335 /* Disk specific status */
336 
337 #define ONL_SHUN        18                              /* shadowing */
338 #define ONL_SHST        19
339 #define ONL_SIZL        20                              /* size */
340 #define ONL_SIZH        21
341 #define ONL_VSNL        22                              /* vol ser # */
342 #define ONL_VSNH        23
343 
344 /* Tape specific status */
345 
346 #define ONL_FMT         18                              /* format */
347 #define ONL_SPD         19                              /* speed */
348 #define ONL_MAXL        20                              /* max rec size */
349 #define ONL_MAXH        21
350 #define ONL_NREC        22                              /* noise rec */
351 #define ONL_RSVE        23                              /* reserved */
352 
353 #define ONL_UIDD_V_MOD  0                               /* unit model */
354 #define ONL_UIDD_V_CLS  8                               /* unit class */
355 
356 /* Set controller characteristics packet - 8 W parameters, 10 W status */
357 
358 #define SCC_LNT         32
359 #define SCC_MSV         8                               /* MSCP version */
360 #define SCC_CFL         9                               /* flags */
361 #define SCC_TMO         10                              /* timeout */
362 #define SCC_VER         11                              /* ctrl version */
363 #define SCC_CIDA        12                              /* ctrl ID */
364 #define SCC_CIDB        13
365 #define SCC_CIDC        14
366 #define SCC_CIDD        15
367 #define SCC_MBCL        16                              /* max byte count */
368 #define SCC_MBCH        17
369 
370 #define SCC_VER_V_SVER  0                               /* swre vrsn */
371 #define SCC_VER_V_HVER  8                               /* hwre vrsn */
372 #define SCC_CIDD_V_MOD  0                               /* ctrl model */
373 #define SCC_CIDD_V_CLS  8                               /* ctrl class */
374 
375 /* Set unit characteristics - 2 W parameter, 16 W status - same as ONL */
376 
377 #define SUC_LNT         44
378 
379 /* Reposition - 4 W parameters, 10 W status */
380 
381 #define POS_LNT         32
382 #define POS_RCL         8                               /* record cnt */
383 #define POS_RCH         9
384 #define POS_TMCL        10                              /* tape mk cnt */
385 #define POS_TMCH        11
386 /* reserved             12 - 15 */
387 #define POS_POSL        16                              /* position */
388 #define POS_POSH        17
389 
390 /* Data transfer packet - 10 W parameters (disk), 6W parameters (tape),
391    10 W status (disk), 12W status (tape) */
392 
393 #define RW_LNT_D        32
394 #define RW_LNT_T        36
395 #define RW_BCL          8                               /* byte count */
396 #define RW_BCH          9
397 #define RW_BAL          10                              /* buff desc */
398 #define RW_BAH          11
399 #define RW_MAPL         12                              /* map table */
400 #define RW_MAPH         13
401 /*                      14                              /* reserved */
402 /*                      15                              /* reserved */
403 
404 /* Disk specific parameters */
405 
406 #define RW_LBNL         16                              /* LBN */
407 #define RW_LBNH         17
408 #define RW_WBCL         18                              /* working bc */
409 #define RW_WBCH         19
410 #define RW_WBAL         20                              /* working ba */
411 #define RW_WBAH         21
412 #define RW_WBLL         22                              /* working lbn */
413 #define RW_WBLH         23
414 
415 /* Tape specific status */
416 
417 #define RW_POSL         16                              /* position */
418 #define RW_POSH         17
419 #define RW_RSZL         18                              /* record size */
420 #define RW_RSZH         19
421 
422 /* Error log packet header */
423 
424 #define ELP_REFL        2                               /* ref # */
425 #define ELP_REFH        3
426 #define ELP_UN          4                               /* unit */
427 #define ELP_SEQ         5
428 #define ELP_FF          6                               /* fmt,flg */
429 #define ELP_EVT         7                               /* event */
430 
431 #define ELP_EV_V_FMT    0                               /* format */
432 #define ELP_EV_V_FLG    8                               /* flag */
433 
434 /* Port last failure error log packet - 6 W status */
435 
436 #define PLF_LNT         24                              /* length */
437 #define PLF_CIDA        8                               /* ctrl ID */
438 #define PLF_CIDB        9
439 #define PLF_CIDC        10
440 #define PLF_CIDD        11
441 #define PLF_VER         12                              /* ctrl version */
442 #define PLF_ERR         13                              /* err */
443 
444 #define PLF_CIDD_V_MOD  0                               /* ctrl model */
445 #define PLF_CIDD_V_CLS  8                               /* ctrl class */
446 #define PLF_VER_V_SVER  0                               /* swre ver */
447 #define PLF_VER_V_HVER  8                               /* hwre ver */
448 
449 /* Disk transfer error log packet - 18 W status */
450 
451 #define DTE_LNT         48
452 #define DTE_CIDA        8                               /* ctrl ID */
453 #define DTE_CIDB        9
454 #define DTE_CIDC        10
455 #define DTE_CIDD        11
456 #define DTE_VER         12                              /* version */
457 #define DTE_MLUN        13                              /* mlun */
458 #define DTE_UIDA        14                              /* unit ID */
459 #define DTE_UIDB        15
460 #define DTE_UIDC        16
461 #define DTE_UIDD        17
462 #define DTE_UVER        18
463 #define DTE_D2          23
464 #define DTE_D3          24
465 #define DTE_D4          25
466 
467 /* Disk specific status */
468 
469 #define DTE_SCYL        19                              /* cylinder */
470 #define DTE_VSNL        20                              /* vol ser # */
471 #define DTE_VSNH        21
472 #define DTE_D1          22                              /* dev params */
473 
474 /* Tape specific status */
475 
476 #define DTE_RETR        19                              /* retry */
477 #define DTE_POSL        20                              /* position */
478 #define DTE_POSH        21
479 #define DTE_FVER        22                              /* formatter ver */
480 
481 #define DTE_CIDD_V_MOD  0                               /* ctrl model */
482 #define DTE_CIDD_V_CLS  8                               /* ctrl class */
483 #define DTE_VER_V_SVER  0                               /* ctrl swre ver */
484 #define DTE_VER_V_HVER  8                               /* ctrl hwre ver */
485 #define DTE_UIDD_V_MOD  0                               /* unit model */
486 #define DTE_UIDD_V_CLS  8                               /* unit class */
487 #define DTE_D2_V_SECT   8
488 #define DTE_D3_V_SURF   0
489 #define DTE_D3_V_CYL    8
490 
491 /* Host bus error log packet - 8 W status */
492 
493 #define HBE_LNT         28
494 #define HBE_CIDA        8                               /* ctrl ID */
495 #define HBE_CIDB        9
496 #define HBE_CIDC        10
497 #define HBE_CIDD        11
498 #define HBE_VER         12                              /* ctrl version */
499 #define HBE_RSV         13                              /* reserved */
500 #define HBE_BADL        14                              /* bad address */
501 #define HBE_BADH        15
502 
503 #define HBE_CIDD_V_MOD  0                               /* ctrl model */
504 #define HBE_CIDD_V_CLS  8                               /* ctrl class */
505 #define HBE_VER_V_SVER  0                               /* ctrl swre ver */
506 #define HBE_VER_V_HVER  8                               /* ctrl hwre ver */
507 
508 /* Unit now available attention message - 10 W status, same as
509    first 10 W of status from get unit status
510 */
511 
512 #define UNA_LNT         32
513 
514 #endif
515