xref: /netbsd-src/sys/dev/tc/tcds.c (revision 3b01aba77a7a698587faaae455bbfe740923c1f5)
1 /* $NetBSD: tcds.c,v 1.1 2000/07/04 02:22:19 nisimura Exp $ */
2 
3 /*-
4  * Copyright (c) 1998 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9  * NASA Ames Research Center.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. All advertising materials mentioning features or use of this software
20  *    must display the following acknowledgement:
21  *	This product includes software developed by the NetBSD
22  *	Foundation, Inc. and its contributors.
23  * 4. Neither the name of The NetBSD Foundation nor the names of its
24  *    contributors may be used to endorse or promote products derived
25  *    from this software without specific prior written permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37  * POSSIBILITY OF SUCH DAMAGE.
38  */
39 
40 /*
41  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
42  * All rights reserved.
43  *
44  * Author: Keith Bostic, Chris G. Demetriou
45  *
46  * Permission to use, copy, modify and distribute this software and
47  * its documentation is hereby granted, provided that both the copyright
48  * notice and this permission notice appear in all copies of the
49  * software, derivative works or modified versions, and any portions
50  * thereof, and that both notices appear in supporting documentation.
51  *
52  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
53  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
54  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
55  *
56  * Carnegie Mellon requests users of this software to return to
57  *
58  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
59  *  School of Computer Science
60  *  Carnegie Mellon University
61  *  Pittsburgh PA 15213-3890
62  *
63  * any improvements or extensions that they make and grant Carnegie the
64  * rights to redistribute these changes.
65  */
66 
67 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
68 
69 __KERNEL_RCSID(0, "$NetBSD: tcds.c,v 1.1 2000/07/04 02:22:19 nisimura Exp $");
70 
71 #include <sys/param.h>
72 #include <sys/kernel.h>
73 #include <sys/systm.h>
74 #include <sys/device.h>
75 #include <sys/malloc.h>
76 
77 #ifdef __alpha__
78 #include <machine/rpb.h>
79 #endif /* __alpha__ */
80 
81 #include <dev/scsipi/scsi_all.h>
82 #include <dev/scsipi/scsipi_all.h>
83 #include <dev/scsipi/scsiconf.h>
84 
85 #include <dev/ic/ncr53c9xvar.h>
86 
87 #include <machine/bus.h>
88 
89 #include <dev/tc/tcvar.h>
90 #include <dev/tc/tcdsreg.h>
91 #include <dev/tc/tcdsvar.h>
92 
93 #include "locators.h"
94 
95 struct tcds_softc {
96 	struct	device sc_dv;
97 	bus_space_tag_t sc_bst;
98 	bus_space_handle_t sc_bsh;
99 	bus_dma_tag_t sc_dmat;
100 	void	*sc_cookie;
101 	int	sc_flags;
102 	struct tcds_slotconfig sc_slots[2];
103 };
104 
105 /* sc_flags */
106 #define	TCDSF_BASEBOARD		0x01	/* baseboard on DEC 3000 */
107 #define	TCDSF_FASTSCSI		0x02	/* supports Fast SCSI */
108 
109 /* Definition of the driver for autoconfig. */
110 int	tcdsmatch __P((struct device *, struct cfdata *, void *));
111 void	tcdsattach __P((struct device *, struct device *, void *));
112 int     tcdsprint __P((void *, const char *));
113 int	tcdssubmatch __P((struct device *, struct cfdata *, void *));
114 
115 struct cfattach tcds_ca = {
116 	sizeof(struct tcds_softc), tcdsmatch, tcdsattach,
117 };
118 
119 /*static*/ int	tcds_intr __P((void *));
120 /*static*/ int	tcds_intrnull __P((void *));
121 
122 struct tcds_device {
123 	const char *td_name;
124 	int td_flags;
125 } tcds_devices[] = {
126 #ifdef __alpha__
127 	{ "PMAZ-DS ",	TCDSF_BASEBOARD },
128 	{ "PMAZ-FS ",	TCDSF_BASEBOARD|TCDSF_FASTSCSI },
129 #endif /* __alpha__ */
130 	{ "PMAZB-AA",	0 },
131 	{ "PMAZC-AA",	TCDSF_FASTSCSI },
132 	{ NULL,		0 },
133 };
134 
135 struct tcds_device *tcds_lookup __P((const char *));
136 void	tcds_params __P((struct tcds_softc *, int, int *, int *));
137 
138 struct tcds_device *
139 tcds_lookup(modname)
140 	const char *modname;
141 {
142 	struct tcds_device *td;
143 
144 	for (td = tcds_devices; td->td_name != NULL; td++)
145 		if (strncmp(td->td_name, modname, TC_ROM_LLEN) == 0)
146 			return (td);
147 
148 	return (NULL);
149 }
150 
151 int
152 tcdsmatch(parent, cfdata, aux)
153 	struct device *parent;
154 	struct cfdata *cfdata;
155 	void *aux;
156 {
157 	struct tc_attach_args *ta = aux;
158 
159 	return (tcds_lookup(ta->ta_modname) != NULL);
160 }
161 
162 void
163 tcdsattach(parent, self, aux)
164 	struct device *parent, *self;
165 	void *aux;
166 {
167 	struct tcds_softc *sc = (struct tcds_softc *)self;
168 	struct tc_attach_args *ta = aux;
169 	struct tcdsdev_attach_args tcdsdev;
170 	struct tcds_slotconfig *slotc;
171 	struct tcds_device *td;
172 	bus_space_handle_t sbsh[2];
173 	int i, gpi2;
174 	const struct evcnt *pevcnt;
175 	char *cp;
176 
177 	td = tcds_lookup(ta->ta_modname);
178 	if (td == NULL)
179 		panic("\ntcdsattach: impossible");
180 
181 	printf(": TurboChannel Dual SCSI");
182 	if (td->td_flags & TCDSF_BASEBOARD)
183 		printf(" (baseboard)");
184 	printf("\n");
185 
186 	sc->sc_flags = td->td_flags;
187 
188 	sc->sc_bst = ta->ta_memt;
189 	sc->sc_dmat = ta->ta_dmat;
190 
191 	/*
192 	 * Map the device.
193 	 */
194 	if (bus_space_map(sc->sc_bst, ta->ta_addr,
195 	    (TCDS_SCSI1_OFFSET + 0x100), 0, &sc->sc_bsh)) {
196 		printf("%s: unable to map device\n", sc->sc_dv.dv_xname);
197 		return;
198 	}
199 
200 	/*
201 	 * Now, slice off two subregions for the individual NCR SCSI chips.
202 	 */
203 	if (bus_space_subregion(sc->sc_bst, sc->sc_bsh, TCDS_SCSI0_OFFSET,
204 	    0x100, &sbsh[0]) ||
205 	    bus_space_subregion(sc->sc_bst, sc->sc_bsh, TCDS_SCSI1_OFFSET,
206 	    0x100, &sbsh[1])) {
207 		printf("%s: unable to subregion SCSI chip space\n",
208 		    sc->sc_dv.dv_xname);
209 		return;
210 	}
211 
212 	sc->sc_cookie = ta->ta_cookie;
213 
214 	pevcnt = tc_intr_evcnt(parent, sc->sc_cookie);
215 	tc_intr_establish(parent, sc->sc_cookie, TC_IPL_BIO, tcds_intr, sc);
216 
217 	/*
218 	 * XXX
219 	 * IMER apparently has some random (or, not so random, but still
220 	 * not useful) bits set in it when the system boots.  Clear it.
221 	 */
222 	bus_space_write_4(sc->sc_bst, sc->sc_bsh, TCDS_IMER, 0);
223 
224 	/* XXX Initial contents of CIR? */
225 
226 	/*
227 	 * Remember if GPI2 is set in the CIR; we'll need it later.
228 	 */
229 	gpi2 = (bus_space_read_4(sc->sc_bst, sc->sc_bsh, TCDS_CIR) &
230 	    TCDS_CIR_GPI_2) != 0;
231 
232 	/*
233 	 * Set up the per-slot defintions for later use.
234 	 */
235 
236 	/* fill in common information first */
237 	for (i = 0; i < 2; i++) {
238 		slotc = &sc->sc_slots[i];
239 
240 		bzero(slotc, sizeof *slotc);	/* clear everything */
241 
242 		cp = malloc(12, M_DEVBUF, M_NOWAIT);
243 		if (cp == NULL)
244 			panic("tcdsattach");
245 		sprintf(cp, "chip %d", i);
246 		evcnt_attach_dynamic(&slotc->sc_evcnt, EVCNT_TYPE_INTR,
247 		    pevcnt, sc->sc_dv.dv_xname, cp);
248 
249 		slotc->sc_slot = i;
250 		slotc->sc_bst = sc->sc_bst;
251 		slotc->sc_bsh = sc->sc_bsh;
252 		slotc->sc_intrhand = tcds_intrnull;
253 		slotc->sc_intrarg = (void *)(long)i;
254 	}
255 
256 	/* information for slot 0 */
257 	slotc = &sc->sc_slots[0];
258 	slotc->sc_resetbits = TCDS_CIR_SCSI0_RESET;
259 	slotc->sc_intrmaskbits =
260 	    TCDS_IMER_SCSI0_MASK | TCDS_IMER_SCSI0_ENB;
261 	slotc->sc_intrbits = TCDS_CIR_SCSI0_INT;
262 	slotc->sc_dmabits = TCDS_CIR_SCSI0_DMAENA;
263 	slotc->sc_errorbits = 0;				/* XXX */
264 	slotc->sc_sda = TCDS_SCSI0_DMA_ADDR;
265 	slotc->sc_dic = TCDS_SCSI0_DMA_INTR;
266 	slotc->sc_dud0 = TCDS_SCSI0_DMA_DUD0;
267 	slotc->sc_dud1 = TCDS_SCSI0_DMA_DUD1;
268 
269 	/* information for slot 1 */
270 	slotc = &sc->sc_slots[1];
271 	slotc->sc_resetbits = TCDS_CIR_SCSI1_RESET;
272 	slotc->sc_intrmaskbits =
273 	    TCDS_IMER_SCSI1_MASK | TCDS_IMER_SCSI1_ENB;
274 	slotc->sc_intrbits = TCDS_CIR_SCSI1_INT;
275 	slotc->sc_dmabits = TCDS_CIR_SCSI1_DMAENA;
276 	slotc->sc_errorbits = 0;				/* XXX */
277 	slotc->sc_sda = TCDS_SCSI1_DMA_ADDR;
278 	slotc->sc_dic = TCDS_SCSI1_DMA_INTR;
279 	slotc->sc_dud0 = TCDS_SCSI1_DMA_DUD0;
280 	slotc->sc_dud1 = TCDS_SCSI1_DMA_DUD1;
281 
282 	/* find the hardware attached to the TCDS ASIC */
283 	for (i = 0; i < 2; i++) {
284 		tcds_params(sc, i, &tcdsdev.tcdsda_id,
285 		    &tcdsdev.tcdsda_fast);
286 
287 		tcdsdev.tcdsda_bst = sc->sc_bst;
288 		tcdsdev.tcdsda_bsh = sbsh[i];
289 		tcdsdev.tcdsda_dmat = sc->sc_dmat;
290 		tcdsdev.tcdsda_chip = i;
291 		tcdsdev.tcdsda_sc = &sc->sc_slots[i];
292 		/*
293 		 * Determine the chip frequency.  TCDSF_FASTSCSI will be set
294 		 * for TC option cards.  For baseboard chips, GPI2 is set, for a
295 		 * 25MHz clock, else a 40MHz clock.
296 		 */
297 		if ((sc->sc_flags & TCDSF_BASEBOARD && gpi2 == 0) ||
298 		    sc->sc_flags & TCDSF_FASTSCSI) {
299 			tcdsdev.tcdsda_freq = 40000000;
300 			tcdsdev.tcdsda_period = tcdsdev.tcdsda_fast ? 4 : 8;
301 		} else {
302 			tcdsdev.tcdsda_freq = 25000000;
303 			tcdsdev.tcdsda_period = 5;
304 		}
305 		if (sc->sc_flags & TCDSF_BASEBOARD)
306 			tcdsdev.tcdsda_variant = NCR_VARIANT_NCR53C94;
307 		else
308 			tcdsdev.tcdsda_variant = NCR_VARIANT_NCR53C96;
309 
310 		tcds_scsi_reset(tcdsdev.tcdsda_sc);
311 
312 		config_found_sm(self, &tcdsdev, tcdsprint, tcdssubmatch);
313 #ifdef __alpha__
314 		/*
315 		 * The second SCSI chip isn't present on the baseboard TCDS
316 		 * on the DEC Alpha 3000/300 series.
317 		 */
318 		if (sc->sc_flags & TCDSF_BASEBOARD &&
319 		    cputype == ST_DEC_3000_300)
320 			break;
321 #endif /* __alpha__ */
322 	}
323 }
324 
325 int
326 tcdssubmatch(parent, cf, aux)
327 	struct device *parent;
328 	struct cfdata *cf;
329 	void *aux;
330 {
331 	struct tcdsdev_attach_args *tcdsdev = aux;
332 
333 	if (cf->cf_loc[TCDSCF_CHIP] != TCDSCF_CHIP_DEFAULT &&
334 	    cf->cf_loc[TCDSCF_CHIP] != tcdsdev->tcdsda_chip)
335 		return (0);
336 
337 	return ((*cf->cf_attach->ca_match)(parent, cf, aux));
338 }
339 
340 int
341 tcdsprint(aux, pnp)
342 	void *aux;
343 	const char *pnp;
344 {
345 	struct tcdsdev_attach_args *tcdsdev = aux;
346 
347 	/* Only ASCs can attach to TCDSs; easy. */
348 	if (pnp)
349 		printf("asc at %s", pnp);
350 
351 	printf(" chip %d", tcdsdev->tcdsda_chip);
352 
353 	return (UNCONF);
354 }
355 
356 void
357 tcds_intr_establish(tcds, slot, func, arg)
358 	struct device *tcds;
359 	int slot;
360 	int (*func) __P((void *));
361 	void *arg;
362 {
363 	struct tcds_softc *sc = (struct tcds_softc *)tcds;
364 
365 	if (sc->sc_slots[slot].sc_intrhand != tcds_intrnull)
366 		panic("tcds_intr_establish: chip %d twice", slot);
367 
368 	sc->sc_slots[slot].sc_intrhand = func;
369 	sc->sc_slots[slot].sc_intrarg = arg;
370 	tcds_scsi_reset(&sc->sc_slots[slot]);
371 }
372 
373 void
374 tcds_intr_disestablish(tcds, slot)
375 	struct device *tcds;
376 	int slot;
377 {
378 	struct tcds_softc *sc = (struct tcds_softc *)tcds;
379 
380 	if (sc->sc_slots[slot].sc_intrhand == tcds_intrnull)
381 		panic("tcds_intr_disestablish: chip %d missing intr",
382 		    slot);
383 
384 	sc->sc_slots[slot].sc_intrhand = tcds_intrnull;
385 	sc->sc_slots[slot].sc_intrarg = (void *)(u_long)slot;
386 
387 	tcds_dma_enable(&sc->sc_slots[slot], 0);
388 	tcds_scsi_enable(&sc->sc_slots[slot], 0);
389 }
390 
391 int
392 tcds_intrnull(val)
393 	void *val;
394 {
395 
396 	panic("tcds_intrnull: uncaught TCDS intr for chip %lu\n",
397 	    (u_long)val);
398 }
399 
400 void
401 tcds_scsi_reset(sc)
402 	struct tcds_slotconfig *sc;
403 {
404 	u_int32_t cir;
405 
406 	tcds_dma_enable(sc, 0);
407 	tcds_scsi_enable(sc, 0);
408 
409 	cir = bus_space_read_4(sc->sc_bst, sc->sc_bsh, TCDS_CIR);
410 	TCDS_CIR_CLR(cir, sc->sc_resetbits);
411 	bus_space_write_4(sc->sc_bst, sc->sc_bsh, TCDS_CIR, cir);
412 
413 	DELAY(1);
414 
415 	cir = bus_space_read_4(sc->sc_bst, sc->sc_bsh, TCDS_CIR);
416 	TCDS_CIR_SET(cir, sc->sc_resetbits);
417 	bus_space_write_4(sc->sc_bst, sc->sc_bsh, TCDS_CIR, cir);
418 
419 	tcds_scsi_enable(sc, 1);
420 	tcds_dma_enable(sc, 1);
421 }
422 
423 void
424 tcds_scsi_enable(sc, on)
425 	struct tcds_slotconfig *sc;
426 	int on;
427 {
428 	u_int32_t imer;
429 
430 	imer = bus_space_read_4(sc->sc_bst, sc->sc_bsh, TCDS_IMER);
431 
432 	if (on)
433 		imer |= sc->sc_intrmaskbits;
434 	else
435 		imer &= ~sc->sc_intrmaskbits;
436 
437 	bus_space_write_4(sc->sc_bst, sc->sc_bsh, TCDS_IMER, imer);
438 }
439 
440 void
441 tcds_dma_enable(sc, on)
442 	struct tcds_slotconfig *sc;
443 	int on;
444 {
445 	u_int32_t cir;
446 
447 	cir = bus_space_read_4(sc->sc_bst, sc->sc_bsh, TCDS_CIR);
448 
449 	/* XXX Clear/set IOSLOT/PBS bits. */
450 	if (on)
451 		TCDS_CIR_SET(cir, sc->sc_dmabits);
452 	else
453 		TCDS_CIR_CLR(cir, sc->sc_dmabits);
454 
455 	bus_space_write_4(sc->sc_bst, sc->sc_bsh, TCDS_CIR, cir);
456 }
457 
458 int
459 tcds_scsi_isintr(sc, clear)
460 	struct tcds_slotconfig *sc;
461 	int clear;
462 {
463 	u_int32_t cir;
464 
465 	cir = bus_space_read_4(sc->sc_bst, sc->sc_bsh, TCDS_CIR);
466 
467 	if ((cir & sc->sc_intrbits) != 0) {
468 		if (clear) {
469 			TCDS_CIR_CLR(cir, sc->sc_intrbits);
470 			bus_space_write_4(sc->sc_bst, sc->sc_bsh, TCDS_CIR,
471 			    cir);
472 		}
473 		return (1);
474 	} else
475 		return (0);
476 }
477 
478 int
479 tcds_scsi_iserr(sc)
480 	struct tcds_slotconfig *sc;
481 {
482 	u_int32_t cir;
483 
484 	cir = bus_space_read_4(sc->sc_bst, sc->sc_bsh, TCDS_CIR);
485 	return ((cir & sc->sc_errorbits) != 0);
486 }
487 
488 int
489 tcds_intr(arg)
490 	void *arg;
491 {
492 	struct tcds_softc *sc = arg;
493 	u_int32_t ir, ir0;
494 
495 	/*
496 	 * XXX
497 	 * Copy and clear (gag!) the interrupts.
498 	 */
499 	ir = ir0 = bus_space_read_4(sc->sc_bst, sc->sc_bsh, TCDS_CIR);
500 	TCDS_CIR_CLR(ir0, TCDS_CIR_ALLINTR);
501 	bus_space_write_4(sc->sc_bst, sc->sc_bsh, TCDS_CIR, ir0);
502 	tc_syncbus();
503 
504 #define	INCRINTRCNT(slot)	sc->sc_slots[slot].sc_evcnt.ev_count++
505 
506 #define	CHECKINTR(slot)							\
507 	if (ir & sc->sc_slots[slot].sc_intrbits) {			\
508 		INCRINTRCNT(slot);					\
509 		(void)(*sc->sc_slots[slot].sc_intrhand)			\
510 		    (sc->sc_slots[slot].sc_intrarg);			\
511 	}
512 	CHECKINTR(0);
513 	CHECKINTR(1);
514 #undef CHECKINTR
515 
516 #ifdef DIAGNOSTIC
517 	/*
518 	 * Interrupts not currently handled, but would like to know if they
519 	 * occur.
520 	 *
521 	 * XXX
522 	 * Don't know if we have to set the interrupt mask and enable bits
523 	 * in the IMER to allow some of them to happen?
524 	 */
525 #define	PRINTINTR(msg, bits)						\
526 	if (ir & bits)							\
527 		printf("%s: %s", sc->sc_dv.dv_xname, msg);
528 	PRINTINTR("SCSI0 DREQ interrupt.\n", TCDS_CIR_SCSI0_DREQ);
529 	PRINTINTR("SCSI1 DREQ interrupt.\n", TCDS_CIR_SCSI1_DREQ);
530 	PRINTINTR("SCSI0 prefetch interrupt.\n", TCDS_CIR_SCSI0_PREFETCH);
531 	PRINTINTR("SCSI1 prefetch interrupt.\n", TCDS_CIR_SCSI1_PREFETCH);
532 	PRINTINTR("SCSI0 DMA error.\n", TCDS_CIR_SCSI0_DMA);
533 	PRINTINTR("SCSI1 DMA error.\n", TCDS_CIR_SCSI1_DMA);
534 	PRINTINTR("SCSI0 DB parity error.\n", TCDS_CIR_SCSI0_DB);
535 	PRINTINTR("SCSI1 DB parity error.\n", TCDS_CIR_SCSI1_DB);
536 	PRINTINTR("SCSI0 DMA buffer parity error.\n", TCDS_CIR_SCSI0_DMAB_PAR);
537 	PRINTINTR("SCSI1 DMA buffer parity error.\n", TCDS_CIR_SCSI1_DMAB_PAR);
538 	PRINTINTR("SCSI0 DMA read parity error.\n", TCDS_CIR_SCSI0_DMAR_PAR);
539 	PRINTINTR("SCSI1 DMA read parity error.\n", TCDS_CIR_SCSI1_DMAR_PAR);
540 	PRINTINTR("TC write parity error.\n", TCDS_CIR_TCIOW_PAR);
541 	PRINTINTR("TC I/O address parity error.\n", TCDS_CIR_TCIOA_PAR);
542 #undef PRINTINTR
543 #endif
544 
545 	/*
546 	 * XXX
547 	 * The MACH source had this, with the comment:
548 	 *	This is wrong, but machine keeps dying.
549 	 */
550 	DELAY(1);
551 
552 	return (1);
553 }
554 
555 void
556 tcds_params(sc, chip, idp, fastp)
557 	struct tcds_softc *sc;
558 	int chip, *idp, *fastp;
559 {
560 	int id, fast;
561 	u_int32_t ids;
562 
563 #ifdef __alpha__
564 	if (sc->sc_flags & TCDSF_BASEBOARD) {
565 		extern u_int8_t dec_3000_scsiid[], dec_3000_scsifast[];
566 
567 		id = dec_3000_scsiid[chip];
568 		fast = dec_3000_scsifast[chip];
569 	} else
570 #endif /* __alpha__ */
571 	{
572 		/*
573 		 * SCSI IDs are stored in the EEPROM, along with whether or
574 		 * not the device is "fast".  Chip 0 is the high nibble,
575 		 * chip 1 the low nibble.
576 		 */
577 		ids = bus_space_read_4(sc->sc_bst, sc->sc_bsh, TCDS_EEPROM_IDS);
578 		if (chip == 0)
579 			ids >>= 4;
580 
581 		id = ids & 0x7;
582 		fast = ids & 0x8;
583 	}
584 
585 	if (id < 0 || id > 7) {
586 		printf("%s: WARNING: bad SCSI ID %d for chip %d, using 7\n",
587 		    sc->sc_dv.dv_xname, id, chip);
588 		id = 7;
589 	}
590 
591 	if (fast)
592 		printf("%s: fast mode set for chip %d\n",
593 		    sc->sc_dv.dv_xname, chip);
594 
595 	*idp = id;
596 	*fastp = fast;
597 }
598