ch.c revision 1.6 1 1.1 cgd /*
2 1.6 mycroft * Copyright (c) 1994 Charles Hannum. All rights reserved.
3 1.6 mycroft *
4 1.6 mycroft * Redistribution and use in source and binary forms, with or without
5 1.6 mycroft * modification, are permitted provided that the following conditions
6 1.6 mycroft * are met:
7 1.6 mycroft * 1. Redistributions of source code must retain the above copyright
8 1.6 mycroft * notice, this list of conditions and the following disclaimer.
9 1.6 mycroft * 2. Redistributions in binary form must reproduce the above copyright
10 1.6 mycroft * notice, this list of conditions and the following disclaimer in the
11 1.6 mycroft * documentation and/or other materials provided with the distribution.
12 1.6 mycroft * 3. All advertising materials mentioning features or use of this software
13 1.6 mycroft * must display the following acknowledgement:
14 1.6 mycroft * This product includes software developed by Charles Hannum.
15 1.6 mycroft * 4. The name of the author may not be used to endorse or promote products
16 1.6 mycroft * derived from this software without specific prior written permission.
17 1.6 mycroft *
18 1.6 mycroft * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 1.6 mycroft * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 1.6 mycroft * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 1.6 mycroft * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 1.6 mycroft * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 1.6 mycroft * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 1.6 mycroft * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 1.6 mycroft * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 1.6 mycroft * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 1.6 mycroft * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 1.6 mycroft *
29 1.6 mycroft * $Id: ch.c,v 1.6 1994/03/29 04:29:25 mycroft Exp $
30 1.1 cgd */
31 1.1 cgd
32 1.6 mycroft /*
33 1.6 mycroft * Originally written by grefen@?????
34 1.6 mycroft * Based on scsi drivers by Julian Elischer (julian (at) tfs.com)
35 1.6 mycroft */
36 1.1 cgd
37 1.5 mycroft #include <sys/types.h>
38 1.1 cgd #include <sys/param.h>
39 1.1 cgd #include <sys/systm.h>
40 1.1 cgd #include <sys/errno.h>
41 1.1 cgd #include <sys/ioctl.h>
42 1.1 cgd #include <sys/buf.h>
43 1.1 cgd #include <sys/proc.h>
44 1.1 cgd #include <sys/user.h>
45 1.1 cgd #include <sys/chio.h>
46 1.6 mycroft #include <sys/device.h>
47 1.1 cgd
48 1.1 cgd #include <scsi/scsi_all.h>
49 1.1 cgd #include <scsi/scsi_changer.h>
50 1.1 cgd #include <scsi/scsiconf.h>
51 1.1 cgd
52 1.6 mycroft #define CHRETRIES 2
53 1.1 cgd
54 1.6 mycroft #define CHMODE(z) (minor(z) & 0x0f)
55 1.6 mycroft #define CHUNIT(z) (minor(z) >> 4)
56 1.1 cgd
57 1.6 mycroft struct ch_data {
58 1.6 mycroft struct device sc_dev;
59 1.1 cgd
60 1.6 mycroft u_int32 flags;
61 1.6 mycroft #define CHINIT 0x01
62 1.6 mycroft #define CHOPEN 0x02
63 1.6 mycroft #define CHKNOWN 0x04
64 1.6 mycroft struct scsi_link *sc_link; /* all the inter level info */
65 1.6 mycroft u_int16 chmo; /* Offset of first CHM */
66 1.6 mycroft u_int16 chms; /* No. of CHM */
67 1.6 mycroft u_int16 slots; /* No. of Storage Elements */
68 1.6 mycroft u_int16 sloto; /* Offset of first SE */
69 1.6 mycroft u_int16 imexs; /* No. of Import/Export Slots */
70 1.6 mycroft u_int16 imexo; /* Offset of first IM/EX */
71 1.6 mycroft u_int16 drives; /* No. of CTS */
72 1.6 mycroft u_int16 driveo; /* Offset of first CTS */
73 1.6 mycroft u_int16 rot; /* CHM can rotate */
74 1.6 mycroft u_long op_matrix; /* possible opertaions */
75 1.6 mycroft u_int16 lsterr; /* details of lasterror */
76 1.6 mycroft u_char stor; /* posible Storage locations */
77 1.6 mycroft };
78 1.6 mycroft
79 1.6 mycroft void chattach __P((struct device *, struct device *, void *));
80 1.6 mycroft
81 1.6 mycroft struct cfdriver chcd = {
82 1.6 mycroft NULL, "ch", scsi_targmatch, chattach, DV_DULL, sizeof(struct ch_data)
83 1.6 mycroft };
84 1.1 cgd
85 1.6 mycroft /*
86 1.6 mycroft * This driver is so simple it uses all the default services
87 1.6 mycroft */
88 1.6 mycroft struct scsi_device ch_switch = {
89 1.6 mycroft NULL,
90 1.6 mycroft NULL,
91 1.6 mycroft NULL,
92 1.6 mycroft NULL,
93 1.6 mycroft "ch",
94 1.6 mycroft 0
95 1.6 mycroft };
96 1.6 mycroft
97 1.6 mycroft /*
98 1.6 mycroft * The routine called by the low level scsi routine when it discovers
99 1.6 mycroft * a device suitable for this driver.
100 1.6 mycroft */
101 1.6 mycroft void
102 1.6 mycroft chattach(parent, self, aux)
103 1.6 mycroft struct device *parent, *self;
104 1.6 mycroft void *aux;
105 1.1 cgd {
106 1.6 mycroft struct ch_data *ch = (void *)self;
107 1.6 mycroft struct scsi_link *sc_link = aux;
108 1.6 mycroft unsigned char *tbl;
109 1.1 cgd
110 1.6 mycroft SC_DEBUG(sc_link, SDEV_DB2, ("chattach: "));
111 1.1 cgd
112 1.6 mycroft /*
113 1.6 mycroft * Store information needed to contact our base driver
114 1.6 mycroft */
115 1.6 mycroft ch->sc_link = sc_link;
116 1.6 mycroft sc_link->device = &ch_switch;
117 1.6 mycroft sc_link->dev_unit = ch->sc_dev.dv_unit;
118 1.6 mycroft
119 1.6 mycroft /*
120 1.6 mycroft * Use the subdriver to request information regarding
121 1.6 mycroft * the drive. We cannot use interrupts yet, so the
122 1.6 mycroft * request must specify this.
123 1.6 mycroft */
124 1.6 mycroft if ((ch_mode_sense(ch, SCSI_NOSLEEP | SCSI_NOMASK))) {
125 1.6 mycroft printf(": offline\n");
126 1.6 mycroft /*stat = CHOPEN;*/
127 1.6 mycroft } else {
128 1.6 mycroft printf(": %d slot(s), %d drive(s), %d arm(s), %d i/e-slot(s)\n",
129 1.6 mycroft ch->slots, ch->drives, ch->chms, ch->imexs);
130 1.6 mycroft /*stat = CHKNOWN;*/
131 1.1 cgd }
132 1.1 cgd
133 1.6 mycroft ch->flags |= CHINIT;
134 1.1 cgd }
135 1.1 cgd
136 1.6 mycroft /*
137 1.6 mycroft * open the device.
138 1.6 mycroft */
139 1.6 mycroft int
140 1.1 cgd chopen(dev)
141 1.6 mycroft dev_t dev;
142 1.1 cgd {
143 1.6 mycroft int error = 0;
144 1.6 mycroft int unit, mode;
145 1.6 mycroft struct ch_data *ch;
146 1.6 mycroft struct scsi_link *sc_link;
147 1.6 mycroft
148 1.6 mycroft unit = CHUNIT(dev);
149 1.6 mycroft mode = CHMODE(dev);
150 1.6 mycroft
151 1.6 mycroft if (unit >= chcd.cd_ndevs)
152 1.6 mycroft return ENXIO;
153 1.6 mycroft ch = chcd.cd_devs[unit];
154 1.6 mycroft if (!ch || !(ch->flags & CHINIT))
155 1.6 mycroft return ENXIO;
156 1.6 mycroft
157 1.6 mycroft sc_link = ch->sc_link;
158 1.6 mycroft SC_DEBUG(sc_link, SDEV_DB1, ("chopen: dev=0x%x (unit %d (of %d))\n",
159 1.6 mycroft dev, unit, chcd.cd_ndevs));
160 1.6 mycroft
161 1.6 mycroft if (ch->flags & CHOPEN)
162 1.6 mycroft return EBUSY;
163 1.6 mycroft
164 1.6 mycroft /*
165 1.6 mycroft * Catch any unit attention errors.
166 1.6 mycroft */
167 1.6 mycroft scsi_test_unit_ready(sc_link, SCSI_SILENT);
168 1.6 mycroft
169 1.6 mycroft sc_link->flags |= SDEV_OPEN;
170 1.6 mycroft /*
171 1.6 mycroft * Check that it is still responding and ok.
172 1.6 mycroft */
173 1.6 mycroft if (error = (scsi_test_unit_ready(sc_link, 0))) {
174 1.6 mycroft printf("%s: not ready\n", ch->sc_dev.dv_xname);
175 1.6 mycroft sc_link->flags &= ~SDEV_OPEN;
176 1.6 mycroft return error;
177 1.6 mycroft }
178 1.6 mycroft
179 1.6 mycroft /*
180 1.6 mycroft * Make sure data is loaded
181 1.6 mycroft */
182 1.6 mycroft if (error = (ch_mode_sense(ch, SCSI_NOSLEEP | SCSI_NOMASK))) {
183 1.6 mycroft printf("%s: offline\n", ch->sc_dev.dv_xname);
184 1.6 mycroft sc_link->flags &= ~SDEV_OPEN;
185 1.6 mycroft return error;
186 1.6 mycroft }
187 1.6 mycroft
188 1.6 mycroft ch->flags |= CHOPEN;
189 1.6 mycroft return 0;
190 1.6 mycroft }
191 1.6 mycroft
192 1.6 mycroft /*
193 1.6 mycroft * close the device.. only called if we are the LAST
194 1.6 mycroft * occurence of an open device
195 1.6 mycroft */
196 1.6 mycroft int
197 1.1 cgd chclose(dev)
198 1.6 mycroft dev_t dev;
199 1.1 cgd {
200 1.6 mycroft int unit, mode;
201 1.6 mycroft struct ch_data *ch;
202 1.6 mycroft struct scsi_link *sc_link;
203 1.6 mycroft
204 1.6 mycroft unit = CHUNIT(dev);
205 1.6 mycroft mode = CHMODE(dev);
206 1.6 mycroft ch = chcd.cd_devs[unit];
207 1.6 mycroft sc_link = ch->sc_link;
208 1.6 mycroft
209 1.6 mycroft SC_DEBUG(sc_link, SDEV_DB1, ("closing"));
210 1.6 mycroft ch->flags &= ~CHOPEN;
211 1.6 mycroft sc_link->flags &= ~SDEV_OPEN;
212 1.6 mycroft return 0;
213 1.6 mycroft }
214 1.6 mycroft
215 1.6 mycroft /*
216 1.6 mycroft * Perform special action on behalf of the user
217 1.6 mycroft * Knows about the internals of this device
218 1.6 mycroft */
219 1.6 mycroft int
220 1.1 cgd chioctl(dev, cmd, arg, mode)
221 1.6 mycroft dev_t dev;
222 1.6 mycroft int cmd;
223 1.6 mycroft caddr_t arg;
224 1.6 mycroft int mode;
225 1.6 mycroft {
226 1.6 mycroft struct ch_data *ch = chcd.cd_devs[CHUNIT(dev)];
227 1.6 mycroft struct scsi_link *sc_link = ch->sc_link;
228 1.6 mycroft int number;
229 1.6 mycroft u_int flags;
230 1.6 mycroft
231 1.6 mycroft /*
232 1.6 mycroft * Find the device that the user is talking about
233 1.6 mycroft */
234 1.6 mycroft flags = 0; /* give error messages, act on errors etc. */
235 1.6 mycroft
236 1.6 mycroft switch (cmd) {
237 1.6 mycroft case CHIOOP: {
238 1.6 mycroft struct chop *chop = (struct chop *) arg;
239 1.6 mycroft SC_DEBUG(sc_link, SDEV_DB2, ("[chtape_chop: %x]\n",
240 1.6 mycroft chop->ch_op));
241 1.6 mycroft
242 1.6 mycroft switch (chop->ch_op) {
243 1.6 mycroft case CHGETPARAM:
244 1.6 mycroft chop->u.getparam.chmo = ch->chmo;
245 1.6 mycroft chop->u.getparam.chms = ch->chms;
246 1.6 mycroft chop->u.getparam.sloto = ch->sloto;
247 1.6 mycroft chop->u.getparam.slots = ch->slots;
248 1.6 mycroft chop->u.getparam.imexo = ch->imexo;
249 1.6 mycroft chop->u.getparam.imexs = ch->imexs;
250 1.6 mycroft chop->u.getparam.driveo = ch->driveo;
251 1.6 mycroft chop->u.getparam.drives = ch->drives;
252 1.6 mycroft chop->u.getparam.rot = ch->rot;
253 1.6 mycroft chop->result = 0;
254 1.6 mycroft return 0;
255 1.6 mycroft break;
256 1.6 mycroft case CHPOSITION:
257 1.6 mycroft return ch_position(ch, &chop->result,
258 1.6 mycroft chop->u.position.chm, chop->u.position.to, flags);
259 1.6 mycroft case CHMOVE:
260 1.6 mycroft return ch_move(ch, &chop->result, chop->u.position.chm,
261 1.6 mycroft chop->u.move.from, chop->u.move.to, flags);
262 1.6 mycroft case CHGETELEM:
263 1.6 mycroft return ch_getelem(ch, &chop->result,
264 1.6 mycroft chop->u.get_elem_stat.type,
265 1.6 mycroft chop->u.get_elem_stat.from,
266 1.6 mycroft &chop->u.get_elem_stat.elem_data, flags);
267 1.6 mycroft default:
268 1.6 mycroft return EINVAL;
269 1.1 cgd }
270 1.6 mycroft }
271 1.1 cgd default:
272 1.6 mycroft return scsi_do_ioctl(sc_link, cmd, arg, mode);
273 1.1 cgd }
274 1.6 mycroft #ifdef DIAGNOSTIC
275 1.6 mycroft panic("chioctl: impossible");
276 1.6 mycroft #endif
277 1.1 cgd }
278 1.1 cgd
279 1.6 mycroft int
280 1.6 mycroft ch_getelem(ch, stat, type, from, data, flags)
281 1.6 mycroft struct ch_data *ch;
282 1.6 mycroft short *stat;
283 1.6 mycroft int type, from;
284 1.6 mycroft char *data;
285 1.6 mycroft int flags;
286 1.1 cgd {
287 1.1 cgd struct scsi_read_element_status scsi_cmd;
288 1.1 cgd char elbuf[32];
289 1.6 mycroft int error;
290 1.1 cgd
291 1.1 cgd bzero(&scsi_cmd, sizeof(scsi_cmd));
292 1.1 cgd scsi_cmd.op_code = READ_ELEMENT_STATUS;
293 1.6 mycroft scsi_cmd.byte2 = type;
294 1.6 mycroft scsi_cmd.starting_element_addr[0] = (from >> 8) & 0xff;
295 1.6 mycroft scsi_cmd.starting_element_addr[1] = from & 0xff;
296 1.6 mycroft scsi_cmd.number_of_elements[1] = 1;
297 1.6 mycroft scsi_cmd.allocation_length[2] = 32;
298 1.6 mycroft
299 1.6 mycroft error = scsi_scsi_cmd(ch->sc_link, (struct scsi_generic *) &scsi_cmd,
300 1.6 mycroft sizeof(scsi_cmd), (u_char *) elbuf, 32, CHRETRIES, 100000, NULL,
301 1.6 mycroft SCSI_DATA_IN | flags);
302 1.6 mycroft if (error)
303 1.6 mycroft *stat = ch->lsterr;
304 1.6 mycroft else
305 1.6 mycroft *stat = 0;
306 1.6 mycroft bcopy(elbuf + 16, data, 16);
307 1.6 mycroft return error;
308 1.1 cgd }
309 1.1 cgd
310 1.6 mycroft int
311 1.6 mycroft ch_move(ch, stat, chm, from, to, flags)
312 1.6 mycroft struct ch_data *ch;
313 1.6 mycroft short *stat;
314 1.6 mycroft int chm, from, to, flags;
315 1.1 cgd {
316 1.1 cgd struct scsi_move_medium scsi_cmd;
317 1.6 mycroft int error;
318 1.1 cgd
319 1.1 cgd bzero(&scsi_cmd, sizeof(scsi_cmd));
320 1.1 cgd scsi_cmd.op_code = MOVE_MEDIUM;
321 1.6 mycroft scsi_cmd.transport_element_address[0] = (chm >> 8) & 0xff;
322 1.6 mycroft scsi_cmd.transport_element_address[1] = chm & 0xff;
323 1.6 mycroft scsi_cmd.source_address[0] = (from >> 8) & 0xff;
324 1.6 mycroft scsi_cmd.source_address[1] = from & 0xff;
325 1.6 mycroft scsi_cmd.destination_address[0] = (to >> 8) & 0xff;
326 1.6 mycroft scsi_cmd.destination_address[1] = to & 0xff;
327 1.6 mycroft scsi_cmd.invert = (chm & CH_INVERT) ? 1 : 0;
328 1.6 mycroft error = scsi_scsi_cmd(ch->sc_link, (struct scsi_generic *) &scsi_cmd,
329 1.6 mycroft sizeof(scsi_cmd), NULL, 0, CHRETRIES, 100000, NULL, flags);
330 1.6 mycroft if (error)
331 1.6 mycroft *stat = ch->lsterr;
332 1.6 mycroft else
333 1.6 mycroft *stat = 0;
334 1.6 mycroft return error;
335 1.1 cgd }
336 1.1 cgd
337 1.6 mycroft int
338 1.6 mycroft ch_position(ch, stat, chm, to, flags)
339 1.6 mycroft struct ch_data *ch;
340 1.6 mycroft short *stat;
341 1.6 mycroft int chm, to, flags;
342 1.1 cgd {
343 1.1 cgd struct scsi_position_to_element scsi_cmd;
344 1.6 mycroft int error;
345 1.1 cgd
346 1.1 cgd bzero(&scsi_cmd, sizeof(scsi_cmd));
347 1.1 cgd scsi_cmd.op_code = POSITION_TO_ELEMENT;
348 1.6 mycroft scsi_cmd.transport_element_address[0] = (chm >> 8) & 0xff;
349 1.6 mycroft scsi_cmd.transport_element_address[1] = chm & 0xff;
350 1.6 mycroft scsi_cmd.source_address[0] = (to >> 8) & 0xff;
351 1.6 mycroft scsi_cmd.source_address[1] = to & 0xff;
352 1.6 mycroft scsi_cmd.invert = (chm & CH_INVERT) ? 1 : 0;
353 1.6 mycroft error = scsi_scsi_cmd(ch->sc_link, (struct scsi_generic *) &scsi_cmd,
354 1.6 mycroft sizeof(scsi_cmd), NULL, 0, CHRETRIES, 100000, NULL, flags);
355 1.6 mycroft if (error)
356 1.6 mycroft *stat = ch->lsterr;
357 1.6 mycroft else
358 1.6 mycroft *stat = 0;
359 1.6 mycroft return error;
360 1.1 cgd }
361 1.1 cgd
362 1.1 cgd #ifdef __STDC__
363 1.6 mycroft #define b2tol(a) (((unsigned)(a##_1) << 8) | (unsigned)a##_0)
364 1.1 cgd #else
365 1.6 mycroft #define b2tol(a) (((unsigned)(a/**/_1) << 8) | (unsigned)a/**/_0)
366 1.1 cgd #endif
367 1.1 cgd
368 1.6 mycroft /*
369 1.6 mycroft * Get the scsi driver to send a full inquiry to the
370 1.6 mycroft * device and use the results to fill out the global
371 1.6 mycroft * parameter structure.
372 1.6 mycroft */
373 1.6 mycroft int
374 1.6 mycroft ch_mode_sense(ch, flags)
375 1.6 mycroft struct ch_data *ch;
376 1.6 mycroft int flags;
377 1.1 cgd {
378 1.1 cgd struct scsi_mode_sense scsi_cmd;
379 1.6 mycroft u_char scsi_sense[128]; /* Can't use scsi_mode_sense_data because of
380 1.6 mycroft * missing block descriptor.
381 1.6 mycroft */
382 1.1 cgd u_char *b;
383 1.6 mycroft int i, l;
384 1.6 mycroft int error;
385 1.6 mycroft struct scsi_link *sc_link = ch->sc_link;
386 1.6 mycroft
387 1.6 mycroft /*
388 1.6 mycroft * First check if we have it all loaded
389 1.6 mycroft */
390 1.6 mycroft if (sc_link->flags & SDEV_MEDIA_LOADED)
391 1.6 mycroft return 0;
392 1.6 mycroft
393 1.6 mycroft /*
394 1.6 mycroft * First do a mode sense
395 1.6 mycroft */
396 1.6 mycroft /* sc_link->flags &= ~SDEV_MEDIA_LOADED; *//*XXX */
397 1.6 mycroft bzero(&scsi_cmd, sizeof(scsi_cmd));
398 1.6 mycroft scsi_cmd.op_code = MODE_SENSE;
399 1.6 mycroft scsi_cmd.byte2 = SMS_DBD;
400 1.6 mycroft scsi_cmd.page = 0x3f; /* All Pages */
401 1.6 mycroft scsi_cmd.length = sizeof(scsi_sense);
402 1.6 mycroft
403 1.6 mycroft /*
404 1.6 mycroft * Read in the pages
405 1.6 mycroft */
406 1.6 mycroft error = scsi_scsi_cmd(sc_link, (struct scsi_generic *) &scsi_cmd,
407 1.6 mycroft sizeof(scsi_cmd), (u_char *) &scsi_sense, sizeof(scsi_sense),
408 1.6 mycroft CHRETRIES, 5000, NULL, flags | SCSI_DATA_IN);
409 1.6 mycroft if (error) {
410 1.6 mycroft if (!(flags & SCSI_SILENT))
411 1.6 mycroft printf("%s: could not mode sense\n",
412 1.6 mycroft ch->sc_dev.dv_xname);
413 1.6 mycroft return error;
414 1.6 mycroft }
415 1.6 mycroft
416 1.6 mycroft sc_link->flags |= SDEV_MEDIA_LOADED;
417 1.6 mycroft l = scsi_sense[0] - 3;
418 1.6 mycroft b = &scsi_sense[4];
419 1.6 mycroft
420 1.6 mycroft /*
421 1.6 mycroft * To avoid alignment problems
422 1.6 mycroft */
423 1.6 mycroft /* XXXX - FIX THIS FOR MSB */
424 1.6 mycroft #define p2copy(valp) (valp[1] | (valp[0]<<8)); valp+=2
425 1.6 mycroft #define p4copy(valp) (valp[3] | (valp[2]<<8) | (valp[1]<<16) | (valp[0]<<24)); valp+=4
426 1.1 cgd #if 0
427 1.6 mycroft printf("\nmode_sense %d\n", l);
428 1.6 mycroft for (i = 0; i < l + 4; i++)
429 1.6 mycroft printf("%x%c", scsi_sense[i], i % 8 == 7 ? '\n' : ':');
430 1.1 cgd printf("\n");
431 1.1 cgd #endif
432 1.6 mycroft for (i = 0; i < l;) {
433 1.6 mycroft u_char pc = (*b++) & 0x3f;
434 1.6 mycroft u_char pl = *b++;
435 1.6 mycroft u_char *bb = b;
436 1.6 mycroft switch (pc) {
437 1.6 mycroft case 0x1d:
438 1.6 mycroft ch->chmo = p2copy(bb);
439 1.6 mycroft ch->chms = p2copy(bb);
440 1.6 mycroft ch->sloto = p2copy(bb);
441 1.6 mycroft ch->slots = p2copy(bb);
442 1.6 mycroft ch->imexo = p2copy(bb);
443 1.6 mycroft ch->imexs = p2copy(bb);
444 1.6 mycroft ch->driveo = p2copy(bb);
445 1.6 mycroft ch->drives = p2copy(bb);
446 1.6 mycroft break;
447 1.6 mycroft case 0x1e:
448 1.6 mycroft ch->rot = *b & 0x1;
449 1.1 cgd break;
450 1.6 mycroft case 0x1f:
451 1.6 mycroft ch->stor = *b & 0xf;
452 1.6 mycroft bb += 2;
453 1.6 mycroft ch->stor = p4copy(bb);
454 1.1 cgd break;
455 1.1 cgd default:
456 1.6 mycroft break;
457 1.1 cgd }
458 1.6 mycroft b += pl;
459 1.6 mycroft i += pl + 2;
460 1.1 cgd }
461 1.6 mycroft SC_DEBUG(sc_link, SDEV_DB2,
462 1.6 mycroft (" cht(%d-%d)slot(%d-%d)imex(%d-%d)cts(%d-%d) %s rotate\n",
463 1.6 mycroft ch->chmo, ch->chms, ch->sloto, ch->slots, ch->imexo, ch->imexs,
464 1.6 mycroft ch->driveo, ch->drives, ch->rot ? "can" : "can't"));
465 1.6 mycroft return 0;
466 1.1 cgd }
467