|
|
1.1 root 1: /*
2: * DSA Mass Storage Control Protocol packet formats
3: */
4:
5: typedef union {
6: long SL_l;
7: short SL_s[2];
8: } _SL;
9:
10: /*
11: * arbitrary (port specific) buffer descriptor
12: * this is arranged for the convenience of non-buffer-using packets
13: * specific port drivers should cast it into whatever
14: * their particular addressing structure requires
15: */
16:
17: typedef union {
18: long BD_l[3];
19: short BD_s[6];
20: struct {
21: long BD_pl;
22: long BD_q[2]; /* quadword at the end */
23: } BD_x;
24: } BUFDESC;
25:
26: /*
27: * command packet
28: */
29:
30: struct mscmd {
31: long m_crf; /* reference number */
32: short m_unit; /* device unit number */
33: short m__r0;
34: char m_opcd; /* command opcode */
35: char m__r1;
36: short m_mod; /* modifiers to opcode */
37: _SL m__u0;
38: #define m_bcnt m__u0.SL_l /* byte count */
39: #define m_otrf m_bcnt /* or, outstanding reference number */
40: #define m_rbn m_bcnt /* or, replacement block number */
41: #define m_vrsn m__u0.SL_s[0] /* or, mscp version number */
42: #define m_cntf m__u0.SL_s[1] /* and controller flags */
43: #define m_rcnt m__u0.SL_l /* or, record count */
44: #define m_unfl m__u0.SL_s[1] /* unit flags */
45: BUFDESC m_buff; /* buffer descriptor */
46: #define m_htmo m_buff.BD_s[0] /* or, host timeout interval */
47: #define m_time m_buff.BD_x.BD_q /* and two longwords of time */
48: #define m_fcnt m_buff.BD_l[0] /* or, file count */
49: long m_lbn; /* block number */
50: #define m_dvpm m_lbn /* device dependent online parameters */
51: short m_fmt; /* tmscp device format */
52: };
53:
54: /*
55: * end/attn message
56: */
57:
58: struct msend {
59: long m_crf; /* reference number */
60: short m_unit; /* device unit number */
61: short m__r0;
62: char m_opcd; /* endcode */
63: char m_flgs; /* end message flags */
64: short m_sts; /* status bits */
65: _SL m__u0;
66: #define m_bcnt m__u0.SL_l /* byte count */
67: #define m_otfl m__u0.SL_l /* or, outstanding cmd ref number */
68: #define m_vrsn m__u0.SL_s[0] /* or, mscp version number */
69: #define m_cntf m__u0.SL_s[1] /* and controller flags */
70: #define m_mlun m__u0.SL_s[0] /* or, multi-unit code */
71: #define m_unfl m__u0.SL_s[1] /* and unit flags */
72: BUFDESC m_buff; /* buffer descriptor */
73: #define m_cmst m_buff.BD_l[0] /* or, command status */
74: #define m_unti m_buff.BD_x.BD_q /* and quadword unit id */
75: #define m_cnti m_buff.BD_x.BD_q /* or quadword controller id */
76: #define m_ctmo m_buff.BD_s[0] /* or, controller timeout */
77: long m_fbbk; /* first bad block encountered */
78: #define m_medi m_fbbk /* or, media type id */
79: short m_shun; /* shadow unit */
80: short m__r2;
81: _SL m__u1;
82: #define m_unsz m__u1.SL_l /* unit size */
83: #define m_trck m__u1.SL_s[0] /* or, track size */
84: #define m_grp m__u1.SL_s[1] /* and group size */
85: #define m_menu m__u1.SL_s[0] /* or, format menu (and group size?) */
86: _SL m__u2;
87: #define m_vser m__u2.SL_l /* volume serial number */
88: #define m_cyl m__u2.SL_s[0] /* or, cylinder size */
89: short m_rcts; /* size of RCT */
90: char m_rbns; /* replacement blocks per track */
91: char m_rctc; /* number of copies of replacement table */
92: };
93:
94: /*
95: * opcodes
96: */
97:
98: #define OPGUS 03 /* get unit status */
99: #define OPSCC 04 /* set controller characteristics */
100: #define OPSEX 07 /* serious exception */
101: #define OPAVL 010 /* available */
102: #define OPONL 011 /* online */
103: #define OPSUC 012 /* set unit characteristics */
104: #define OPFLS 023 /* flush cache ? */
105: #define OPRPL 024 /* replace bad block */
106: #define OPRD 041 /* read */
107: #define OPWR 042 /* write */
108: #define OPWRM 044 /* write tape mark */
109: #define OPPOS 045 /* reposition tape */
110: #define OPAVA 0100 /* available attn */
111: #define OPEND 0200 /* end flag */
112:
113: #define MDPRI 01 /* OPRPL: primary replacement block */
114: #define MDSPD 01 /* OPAVL: spin down */
115: #define MDREW 02 /* OPAVL: rewind */
116: #define MDOBJ 04 /* OPPOS: object count */
117: #define MDREV 010 /* OPPOS: reverse */
118: #define MDUNL 020 /* OPPOS: unload */
119: #define MDXCL 040 /* OPONL: exclusive access */
120: #define MDIMM 0100 /* some TMSCP: do it now */
121: #define MDCSX 020000 /* any: clear serious exception */
122: #define MDCDL 010000 /* many: clear cache data loss woe */
123:
124: /*
125: * status codes
126: */
127:
128: #define STMSK 037 /* mask for generic status code */
129: #define STSUC 0 /* success */
130: #define STCMD 1 /* invalid command */
131: #define STABO 2 /* aborted */
132: #define STOFL 3 /* unit offline */
133: #define STAVL 4 /* unit available */
134: #define STMFE 5 /* media format error */
135: #define STWPR 6 /* write protected */
136: #define STCMP 7 /* compare error */
137: #define STDAT 010 /* data error */
138: #define STHST 011 /* host data access error */
139: #define STCNT 012 /* controller error */
140: #define STDRV 013 /* drive error */
141: #define STTPM 016 /* tape mark encountered */
142: #define STRDT 020 /* tape record truncated */
143: #define STPL 021 /* tape position lost */
144: #define STSEX 022 /* serious exception */
145: #define STDIA 037 /* internal diagnostic message */
146:
147: #define STRST 0377 /* our software only -- controller reset */
148: #define STBCK STDAT /* us design optical disk: blank check */
149: #define STBK2 0x48 /* someone else's blank check */
150:
151: /*
152: * end message flags
153: */
154:
155: #define EFCDL 02 /* TMSCP: cached data lost */
156: #define EFEOT 010 /* TMSCP: encountered end-of-tape */
157:
158: #define MSCPVER 0 /* MSCP version number */
159:
160: /*
161: * controller flags
162: */
163:
164: #define CFATN 0200 /* enable attention messages */
165: #define CFMSC 0100 /* enable misc error log messages */
166: #define CFOTH 040 /* enable other hosts' errors */
167: #define CFTHS 020 /* enable this host's errors */
168:
169: /*
170: * unit flags
171: */
172:
173: #define UFWBK 0100 /* tape: enable write-back */
174: #define UFWPH 020000 /* write-protected in hardware */
175:
176: /*
177: * TMSCP densities
178: * m_fmt
179: */
180:
181: #define TFMASK 0377 /* mask for all tape format bits, without device type */
182:
183: /*
184: * error log packet
185: */
186:
187: struct mserl {
188: long l_crf; /* command reference number */
189: short l_unit; /* unit number */
190: short l_seq; /* error sequence number */
191: char l_fmt; /* format of packet */
192: char l_flgs;
193: short l_evnt; /* event code */
194: long l_cnti[2]; /* controller id */
195: char l_csvr; /* ctl software version */
196: char l_chvr; /* ctl hardware version */
197: short l_mlun; /* multi-unit code */
198: long l_unti[2]; /* unit id */
199: #define l_badr l_unti[0] /* or, bad memory address */
200: char l_usvr; /* unit software version */
201: char l_uhvr; /* unit hardware version */
202: char l_lvl; /* transfer error level */
203: char l_rtry; /* transfer error retry */
204: long l_vser; /* volume serial number */
205: long l_hdcd; /* header code */
206: long l_sdi[3]; /* sdi info */
207: };
208:
209: /*
210: * format codes (l_fmt)
211: */
212:
213: #define FMCNT 0 /* controller error */
214: #define FMBAD 1 /* host buffer address error */
215: #define FMDSK 2 /* disk transfer error */
216: #define FMSDI 3 /* SDI error */
217: #define FMSMD 4 /* small disk error */
218: #define FMTAPE 5 /* tape transfer error */
219: #define FMSTC 6 /* STI communication error */
220: #define FMSTD 7 /* STI drive error */
221: #define FMSTF 8 /* STI formatter error */
222: #define FMRPL 9 /* bad block replacement by controller */
223:
224: /*
225: * flags
226: */
227:
228: #define LFSUC 0200 /* operation successful */
229: #define LFCON 0100 /* operation continuing */
230: #define LFRPR 040 /* bad block replacement required */
231: #define LFRPE 020 /* error during bad block replacement */
232: #define LFSNR 01 /* sequence number reset */
233:
234: /*
235: * purely software things:
236: * table of entry points for a port driver
237: *
238: * the idea is
239: * call init at open time
240: * to do io, call get to get a packet; fill it in;
241: * call map to set up io mapping if it's a read or write;
242: * call send to send the mscp packet to the controller.
243: * if there's no map associated, that's it;
244: * the packet is freed when the controller takes it.
245: * if there's a map, the packet isn't freed until unmap is called
246: * to flush and free up the map too
247: */
248:
249: struct msportsw {
250: int (*mp_init)(); /* init the port, if needed */
251: struct mscmd *(*mp_get)(); /* get a packet */
252: int (*mp_map)(); /* store mapping into packet */
253: int (*mp_send)(); /* send packet */
254: int (*mp_unmap)(); /* free mapping resources and packet */
255: };
256:
257: #ifdef KERNEL
258: extern struct msportsw *msportsw[];
259: extern int nmsport;
260: #endif
261:
262: /*
263: * address token for class drivers;
264: * indexed by (minor device) unit number
265: */
266:
267: struct msaddr {
268: char ctl; /* which controller */
269: char ctype; /* type of controller */
270: short unit; /* MSCP unit number thereon */
271: };
272:
273: #define MSMAXID 2 /* number of connection IDs */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.