Commit | Line | Data |
---|---|---|
bf9edb82 KB |
1 | /* |
2 | * Copyright (c) 1988 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * This code is derived from software contributed to Berkeley by | |
6 | * Computer Consoles Inc. | |
7 | * | |
b702c21d | 8 | * %sccs.include.redist.c% |
bf9edb82 | 9 | * |
b702c21d | 10 | * @(#)cyreg.h 7.8 (Berkeley) %G% |
bf9edb82 | 11 | */ |
d62077b1 SL |
12 | |
13 | /* | |
14 | * Tapemaster controller definitions. | |
15 | */ | |
16 | ||
7aefbaf7 MK |
17 | /* |
18 | * With 20-bit addressing, the intermediate buffer | |
19 | * must be allocated early in startup(). | |
20 | */ | |
29a6143e | 21 | #define CYMAXIO (64*1024) /* max i/o size + 1 */ |
7aefbaf7 MK |
22 | char *cybuf; |
23 | ||
d62077b1 | 24 | /* for byte swapping Multibus values */ |
0995dc78 | 25 | #define htoms(x) (u_short)((((x)>>8)&0xff) | (((x)<<8)&0xff00)) |
d62077b1 SL |
26 | |
27 | #define b_repcnt b_bcount | |
28 | #define b_command b_resid | |
29 | ||
82bc5dc5 MK |
30 | /* |
31 | * System configuration pointer. | |
32 | * Memory address is jumpered on controller. | |
33 | */ | |
34 | struct cyscp { | |
35 | char csp_buswidth; /* system bus width */ | |
36 | #define CSP_16BITS 1 /* 16-bit system bus */ | |
37 | #define CSP_8BITS 0 /* 8-bit system bus */ | |
38 | char csp_unused; | |
39 | u_char csp_scb[4]; /* point to system config block */ | |
40 | }; | |
41 | ||
42 | /* | |
43 | * System configuration block | |
44 | */ | |
45 | struct cyscb { | |
46 | char csb_fixed; /* fixed value code (must be 3) */ | |
47 | char csb_unused; /* unused */ | |
48 | u_char csb_ccb[4]; /* pointer to channel control block */ | |
49 | }; | |
50 | ||
51 | #define CSB_FIXED 0x3 | |
52 | ||
d62077b1 SL |
53 | /* |
54 | * Channel control block definitions | |
55 | */ | |
56 | struct cyccb { | |
57 | char cbcw; /* channel control word */ | |
58 | char cbgate; /* tpb access gate */ | |
82bc5dc5 | 59 | u_char cbtpb[4]; /* first tape parameter block */ |
d62077b1 SL |
60 | }; |
61 | ||
62 | #define GATE_OPEN (char)(0x00) | |
63 | #define GATE_CLOSED (char)(0xff) | |
64 | ||
65 | #define CY_GO(addr) movob((addr), 0xff) /* channel attention */ | |
66 | #define CY_RESET(addr) movob((addr)+1, 0xff) /* software controller reset */ | |
67 | ||
68 | #define CBCW_IE 0x11 /* interrupt on cmd completion */ | |
69 | #define CBCW_CLRINT 0x09 /* clear active interrupt */ | |
70 | ||
71 | /* | |
72 | * Tape parameter block definitions | |
73 | */ | |
74 | struct cytpb { | |
29a6143e MK |
75 | u_long tpcmd; /* command, see below */ |
76 | u_short tpcontrol; /* control word */ | |
77 | u_short tpcount; /* return count */ | |
78 | u_short tpsize; /* buffer size */ | |
79 | u_short tprec; /* records/overrun */ | |
82bc5dc5 | 80 | u_char tpdata[4]; /* pointer to source/dest */ |
29a6143e | 81 | u_short tpstatus; /* status */ |
82bc5dc5 | 82 | u_char tplink[4]; /* pointer to next parameter block */ |
d62077b1 SL |
83 | }; |
84 | ||
85 | /* control field bit definitions */ | |
86 | #define CYCW_UNIT (0x000c<<8) /* unit select mask, 2 bit field */ | |
87 | #define CYCW_IE (0x0020<<8) /* interrupt enable */ | |
88 | #define CYCW_LOCK (0x0080<<8) /* bus lock flag */ | |
89 | #define CYCW_REV (0x0400>>8) /* reverse flag */ | |
90 | #define CYCW_SPEED (0x0800>>8) /* speed/density */ | |
91 | #define CYCW_25IPS 0 | |
92 | #define CYCW_100IPS (0x0800>>8) | |
93 | #define CYCW_WIDTH (0x8000>>8) /* width */ | |
94 | #define CYCW_8BITS 0 | |
95 | #define CYCW_16BITS (0x8000>>8) | |
96 | ||
97 | #define CYCW_BITS "\20\3REV\005100IPS\00716BITS\16IE\20LOCK" | |
98 | ||
99 | /* | |
100 | * Controller commands | |
101 | */ | |
102 | ||
103 | /* control status/commands */ | |
104 | #define CY_CONFIG (0x00<<24) /* configure */ | |
105 | #define CY_NOP (0x20<<24) /* no operation */ | |
82bc5dc5 | 106 | #define CY_SETPAGE (0x08<<24) /* set page (addr bits 20-23) */ |
d62077b1 SL |
107 | #define CY_SENSE (0x28<<24) /* drive status */ |
108 | #define CY_CLRINT (0x9c<<24) /* clear Multibus interrupt */ | |
109 | ||
110 | /* tape position commands */ | |
111 | #define CY_REW (0x34<<24) /* rewind tape */ | |
112 | #define CY_OFFL (0x38<<24) /* off_line and unload */ | |
113 | #define CY_WEOF (0x40<<24) /* write end-of-file mark */ | |
114 | #define CY_SFORW (0x70<<24) /* space record forward */ | |
82bc5dc5 MK |
115 | #define CY_SREV (CY_SFORW|CYCW_REV) /* space record backwards */ |
116 | #define CY_FSF (0x44<<24) /* space file forward */ | |
117 | #define CY_BSF (CY_FSF|CYCW_REV) /* space file backwards */ | |
d62077b1 SL |
118 | #define CY_ERASE (0x4c<<24) /* erase record */ |
119 | ||
120 | /* data transfer commands */ | |
121 | #define CY_BRCOM (0x10<<24) /* read buffered */ | |
122 | #define CY_BWCOM (0x14<<24) /* write buffered */ | |
123 | #define CY_RCOM (0x2c<<24) /* read tape unbuffered */ | |
124 | #define CY_WCOM (0x30<<24) /* write tape unbuffered */ | |
125 | ||
126 | /* status field bit definitions */ | |
127 | #define CYS_WP (0x0002<<8) /* write protected, no write ring */ | |
128 | #define CYS_BSY (0x0004<<8) /* formatter busy */ | |
129 | #define CYS_RDY (0x0008<<8) /* drive ready */ | |
130 | #define CYS_EOT (0x0010<<8) /* end of tape detected */ | |
131 | #define CYS_BOT (0x0020<<8) /* tape is at load point */ | |
132 | #define CYS_OL (0x0040<<8) /* drive on_line */ | |
133 | #define CYS_FM (0x0080<<8) /* filemark detected */ | |
134 | #define CYS_ERR (0x1f00>>8) /* error value mask */ | |
135 | #define CYS_CR (0x2000>>8) /* controller executed retries */ | |
136 | #define CYS_CC (0x4000>>8) /* command completed successfully */ | |
137 | #define CYS_CE (0x8000>>8) /* command execution has begun */ | |
138 | ||
139 | #define CYS_BITS "\20\6CR\7CC\10CE\12WP\13BSY\14RDY\15EOT/BOT\16BOT\17OL\20FM" | |
140 | ||
141 | /* error codes for CYS_ERR */ | |
142 | #define CYER_TIMOUT 0x01 /* timed out data busy false */ | |
143 | #define CYER_TIMOUT1 0x02 /* data busy false,formatter,ready */ | |
144 | #define CYER_TIMOUT2 0x03 /* time out ready busy false */ | |
145 | #define CYER_TIMOUT3 0x04 /* time out ready busy true */ | |
146 | #define CYER_TIMOUT4 0x05 /* time out data busy true */ | |
147 | #define CYER_NXM 0x06 /* time out memory */ | |
148 | #define CYER_BLANK 0x07 /* blank tape */ | |
149 | #define CYER_DIAG 0x08 /* micro-diagnostic */ | |
150 | #define CYER_EOT 0x09 /* EOT forward, BOT rev. */ | |
151 | #define CYER_BOT 0x09 /* EOT forward, BOT rev. */ | |
152 | #define CYER_HERR 0x0a /* retry unsuccessful */ | |
153 | #define CYER_FIFO 0x0b /* FIFO over/under flow */ | |
154 | #define CYER_PARITY 0x0d /* drive to tapemaster parity error */ | |
155 | #define CYER_CKSUM 0x0e /* prom checksum */ | |
156 | #define CYER_STROBE 0x0f /* time out tape strobe */ | |
157 | #define CYER_NOTRDY 0x10 /* tape not ready */ | |
158 | #define CYER_PROT 0x11 /* write, no enable ring */ | |
159 | #define CYER_JUMPER 0x13 /* missing diagnostic jumper */ | |
160 | #define CYER_LINK 0x14 /* bad link, link inappropriate */ | |
161 | #define CYER_FM 0x15 /* unexpected filemark */ | |
162 | #define CYER_PARAM 0x16 /* bad parameter, byte count ? */ | |
163 | #define CYER_HDWERR 0x18 /* unidentified hardware error */ | |
164 | #define CYER_NOSTRM 0x19 /* streaming terminated */ | |
165 | ||
166 | #ifdef CYERROR | |
167 | char *cyerror[] = { | |
82bc5dc5 | 168 | "no error", |
d62077b1 SL |
169 | "timeout", |
170 | "timeout1", | |
171 | "timeout2", | |
172 | "timeout3", | |
173 | "timeout4", | |
82bc5dc5 | 174 | "non-existent memory", |
d62077b1 SL |
175 | "blank tape", |
176 | "micro-diagnostic", | |
177 | "eot/bot detected", | |
178 | "retry unsuccessful", | |
179 | "fifo over/under-flow", | |
82bc5dc5 | 180 | "#0xc", |
d62077b1 SL |
181 | "drive to controller parity error", |
182 | "prom checksum", | |
183 | "time out tape strobe (record length error)", | |
184 | "tape not ready", | |
185 | "write protected", | |
82bc5dc5 | 186 | "#0x12", |
d62077b1 SL |
187 | "missing diagnostic jumper", |
188 | "invalid link pointer", | |
189 | "unexpected file mark", | |
82bc5dc5 MK |
190 | "invalid byte count/parameter", |
191 | "#0x17", | |
d62077b1 SL |
192 | "unidentified hardware error", |
193 | "streaming terminated" | |
194 | }; | |
195 | #define NCYERROR (sizeof (cyerror) / sizeof (cyerror[0])) | |
196 | #endif | |
197 | ||
198 | /* | |
199 | * Masks defining hard and soft errors (must check against 1<<CYER_code). | |
200 | */ | |
0995dc78 | 201 | #define CYMASK(e) (1 << (e)) |
bf9edb82 KB |
202 | #define CYER_HARD (CYMASK(CYER_TIMOUT)|CYMASK(CYER_TIMOUT1)|\ |
203 | CYMASK(CYER_TIMOUT2)|CYMASK(CYER_TIMOUT3)|CYMASK(CYER_TIMOUT4)|\ | |
204 | CYMASK(CYER_NXM)|CYMASK(CYER_DIAG)|CYMASK(CYER_JUMPER)|\ | |
205 | CYMASK(CYER_STROBE)|CYMASK(CYER_PROT)|CYMASK(CYER_CKSUM)|\ | |
206 | CYMASK(CYER_HERR)|CYMASK(CYER_BLANK)) | |
207 | #define CYER_RSOFT (CYMASK(CYER_FIFO)|CYMASK(CYER_NOTRDY)|\ | |
208 | CYMASK(CYER_PARITY)) | |
209 | #define CYER_WSOFT (CYMASK(CYER_HERR)|CYMASK(CYER_FIFO)|\ | |
210 | CYMASK(CYER_NOTRDY)|CYMASK(CYER_PARITY)) |