Home | History | Annotate | Line # | Download | only in isa
ahc_isa.c revision 1.16
      1 /*	$NetBSD: ahc_isa.c,v 1.16 2002/01/07 21:47:01 thorpej Exp $	*/
      2 
      3 /*
      4  * Product specific probe and attach routines for:
      5  * 	AHA-284X VL-bus SCSI controllers
      6  *
      7  * Copyright (c) 1994, 1995, 1996, 1997, 1998 Justin T. Gibbs.
      8  * All rights reserved.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice immediately at the beginning of the file, without modification,
     15  *    this list of conditions, and the following disclaimer.
     16  * 2. The name of the author may not be used to endorse or promote products
     17  *    derived from this software without specific prior written permission.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
     23  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29  * SUCH DAMAGE.
     30  *
     31  * $FreeBSD: src/sys/dev/aic7xxx/ahc_eisa.c,v 1.15 2000/01/29 14:22:19 peter Exp $
     32  */
     33 
     34 /*-
     35  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
     36  * All rights reserved.
     37  *
     38  * This code is derived from software contributed to The NetBSD Foundation
     39  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
     40  * NASA Ames Research Center.
     41  *
     42  * Redistribution and use in source and binary forms, with or without
     43  * modification, are permitted provided that the following conditions
     44  * are met:
     45  * 1. Redistributions of source code must retain the above copyright
     46  *    notice, this list of conditions and the following disclaimer.
     47  * 2. Redistributions in binary form must reproduce the above copyright
     48  *    notice, this list of conditions and the following disclaimer in the
     49  *    documentation and/or other materials provided with the distribution.
     50  * 3. All advertising materials mentioning features or use of this software
     51  *    must display the following acknowledgement:
     52  *	This product includes software developed by the NetBSD
     53  *	Foundation, Inc. and its contributors.
     54  * 4. Neither the name of The NetBSD Foundation nor the names of its
     55  *    contributors may be used to endorse or promote products derived
     56  *    from this software without specific prior written permission.
     57  *
     58  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     59  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     60  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     61  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     62  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     63  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     64  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     65  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     66  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     67  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     68  * POSSIBILITY OF SUCH DAMAGE.
     69  */
     70 
     71 /*
     72  * Copyright (c) 1995, 1996 Christopher G. Demetriou
     73  * All rights reserved.
     74  *
     75  * Redistribution and use in source and binary forms, with or without
     76  * modification, are permitted provided that the following conditions
     77  * are met:
     78  * 1. Redistributions of source code must retain the above copyright
     79  *    notice, this list of conditions and the following disclaimer.
     80  * 2. Redistributions in binary form must reproduce the above copyright
     81  *    notice, this list of conditions and the following disclaimer in the
     82  *    documentation and/or other materials provided with the distribution.
     83  * 3. All advertising materials mentioning features or use of this software
     84  *    must display the following acknowledgement:
     85  *      This product includes software developed by Christopher G. Demetriou
     86  *      for the NetBSD Project.
     87  * 4. The name of the author may not be used to endorse or promote products
     88  *    derived from this software without specific prior written permission
     89  *
     90  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     91  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     92  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     93  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     94  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     95  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     96  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     97  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     98  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     99  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    100  */
    101 
    102 /*
    103  * This front-end driver is really sort of a hack.  The AHA-284X likes
    104  * to masquerade as an EISA device.  However, on VLbus machines with
    105  * no EISA signature in the BIOS, the EISA bus will never be scanned.
    106  * This is intended to catch the 284X controllers on those systems
    107  * by looking in "EISA i/o space" for 284X controllers.
    108  *
    109  * This relies heavily on i/o port accounting.  We also just use the
    110  * EISA macros for everything ... it's a real waste to redefine them.
    111  *
    112  * Note: there isn't any #ifdef for FreeBSD in this file, since the
    113  * FreeBSD EISA driver handles all cases of the 284X.
    114  *
    115  *	-- Jason R. Thorpe <thorpej (at) NetBSD.ORG>
    116  *	   July 12, 1996
    117  */
    118 
    119 #include <sys/cdefs.h>
    120 __KERNEL_RCSID(0, "$NetBSD: ahc_isa.c,v 1.16 2002/01/07 21:47:01 thorpej Exp $");
    121 
    122 #include <sys/param.h>
    123 #include <sys/systm.h>
    124 #include <sys/kernel.h>
    125 #include <sys/device.h>
    126 #include <sys/queue.h>
    127 #include <sys/malloc.h>
    128 #include <sys/reboot.h>
    129 
    130 #include <machine/bus.h>
    131 #include <machine/intr.h>
    132 
    133 #include <dev/scsipi/scsi_all.h>
    134 #include <dev/scsipi/scsipi_all.h>
    135 #include <dev/scsipi/scsiconf.h>
    136 
    137 #include <dev/isa/isavar.h>
    138 
    139 #include <dev/eisa/eisareg.h>
    140 #include <dev/eisa/eisavar.h>
    141 #include <dev/eisa/eisadevs.h>
    142 
    143 #include <dev/microcode/aic7xxx/aic7xxx_reg.h>
    144 #include <dev/ic/aic7xxxvar.h>
    145 #include <dev/ic/aic77xxreg.h>
    146 #include <dev/ic/aic77xxvar.h>
    147 #include <dev/ic/smc93cx6var.h>
    148 
    149 /* IO port address setting range as EISA slot number */
    150 #define AHC_ISA_MIN_SLOT	0x1	/* from iobase = 0x1c00 */
    151 #define AHC_ISA_MAX_SLOT	0xe	/* to   iobase = 0xec00 */
    152 
    153 #define AHC_ISA_SLOT_OFFSET	AHC_EISA_SLOT_OFFSET
    154 #define AHC_ISA_IOSIZE		AHC_EISA_IOSIZE
    155 
    156 /*
    157  * I/O port offsets
    158  */
    159 #define	AHC_ISA_VID		(EISA_SLOTOFF_VID - AHC_ISA_SLOT_OFFSET)
    160 #define	AHC_ISA_PID		(EISA_SLOTOFF_PID - AHC_ISA_SLOT_OFFSET)
    161 #define	AHC_ISA_PRIMING		AHC_ISA_VID	/* enable vendor/product ID */
    162 
    163 /*
    164  * AHC_ISA_PRIMING register values (write)
    165  */
    166 #define	AHC_ISA_PRIMING_VID(index)	(AHC_ISA_VID + (index))
    167 #define	AHC_ISA_PRIMING_PID(index)	(AHC_ISA_PID + (index))
    168 
    169 int	ahc_isa_idstring __P((bus_space_tag_t, bus_space_handle_t, char *));
    170 int	ahc_isa_match __P((struct isa_attach_args *, bus_addr_t));
    171 
    172 int	ahc_isa_probe __P((struct device *, struct cfdata *, void *));
    173 void	ahc_isa_attach __P((struct device *, struct device *, void *));
    174 void	aha2840_load_seeprom __P((struct ahc_softc *ahc));
    175 
    176 struct cfattach ahc_isa_ca = {
    177 	sizeof(struct ahc_softc), ahc_isa_probe, ahc_isa_attach
    178 };
    179 
    180 /*
    181  * This keeps track of which slots are to be checked next if the
    182  * iobase locator is a wildcard.  A simple static variable isn't enough,
    183  * since it's conceivable that a system might have more than one ISA
    184  * bus.
    185  *
    186  * The "bus" member is the unit number of the parent ISA bus, e.g. "0"
    187  * for "isa0".
    188  */
    189 struct ahc_isa_slot {
    190 	LIST_ENTRY(ahc_isa_slot)	link;
    191 	int				bus;
    192 	int				slot;
    193 };
    194 static LIST_HEAD(, ahc_isa_slot) ahc_isa_all_slots;
    195 static int ahc_isa_slot_initialized;
    196 
    197 int
    198 ahc_isa_idstring(iot, ioh, idstring)
    199 	bus_space_tag_t iot;
    200 	bus_space_handle_t ioh;
    201 	char *idstring;
    202 {
    203 	u_int8_t vid[EISA_NVIDREGS], pid[EISA_NPIDREGS];
    204 	int i;
    205 
    206 	/* Get the vendor ID bytes */
    207 	for (i = 0; i < EISA_NVIDREGS; i++) {
    208 		bus_space_write_1(iot, ioh, AHC_ISA_PRIMING,
    209 		    AHC_ISA_PRIMING_VID(i));
    210 		vid[i] = bus_space_read_1(iot, ioh, AHC_ISA_VID + i);
    211 	}
    212 
    213 	/* Check for device existence */
    214 	if (EISA_VENDID_NODEV(vid)) {
    215 #if 0
    216 		printf("ahc_isa_idstring: no device at 0x%lx\n",
    217 		    ioh); /* XXX knows about ioh guts */
    218 		printf("\t(0x%x, 0x%x)\n", vid[0], vid[1]);
    219 #endif
    220 		return (0);
    221 	}
    222 
    223 	/* And check that the firmware didn't biff something badly */
    224 	if (EISA_VENDID_IDDELAY(vid)) {
    225 		printf("ahc_isa_idstring: BIOS biffed it at 0x%lx\n",
    226 		    ioh);	/* XXX knows about ioh guts */
    227 		return (0);
    228 	}
    229 
    230 	/* Get the product ID bytes */
    231 	for (i = 0; i < EISA_NPIDREGS; i++) {
    232 		bus_space_write_1(iot, ioh, AHC_ISA_PRIMING,
    233 		    AHC_ISA_PRIMING_PID(i));
    234 		pid[i] = bus_space_read_1(iot, ioh, AHC_ISA_PID + i);
    235 	}
    236 
    237 	/* Create the ID string from the vendor and product IDs */
    238 	idstring[0] = EISA_VENDID_0(vid);
    239 	idstring[1] = EISA_VENDID_1(vid);
    240 	idstring[2] = EISA_VENDID_2(vid);
    241 	idstring[3] = EISA_PRODID_0(pid);
    242 	idstring[4] = EISA_PRODID_1(pid);
    243 	idstring[5] = EISA_PRODID_2(pid);
    244 	idstring[6] = EISA_PRODID_3(pid);
    245 	idstring[7] = '\0';		/* sanity */
    246 
    247 	return (1);
    248 }
    249 
    250 int
    251 ahc_isa_match(ia, iobase)
    252 	struct isa_attach_args *ia;
    253 	bus_addr_t iobase;
    254 {
    255 	bus_space_tag_t iot = ia->ia_iot;
    256 	bus_space_handle_t ioh;
    257 	int irq;
    258 	char idstring[EISA_IDSTRINGLEN];
    259 
    260 	/*
    261 	 * Get a mapping for the while slot-specific address
    262 	 * space.  If we can't, assume nothing's there, but
    263 	 * warn about it.
    264 	 */
    265 	if (bus_space_map(iot, iobase, AHC_ISA_IOSIZE, 0, &ioh)) {
    266 #if 0
    267 		/*
    268 		 * Don't print anything out here, since this could
    269 		 * be common on machines configured to look for
    270 		 * ahc_eisa and ahc_isa.
    271 		 */
    272 		printf("ahc_isa_match: can't map I/O space for 0x%x\n",
    273 		    iobase);
    274 #endif
    275 		return (0);
    276 	}
    277 
    278 	if (!ahc_isa_idstring(iot, ioh, idstring))
    279 		irq = -1;	/* cannot get the ID string */
    280 	else if (strcmp(idstring, "ADP7756") &&
    281 	    strcmp(idstring, "ADP7757"))
    282 		irq = -1;	/* unknown ID strings */
    283 	else
    284 		irq = ahc_aic77xx_irq(iot, ioh);
    285 
    286 	bus_space_unmap(iot, ioh, AHC_ISA_IOSIZE);
    287 
    288 	if (irq < 0)
    289 		return (0);
    290 
    291 	if (ia->ia_irq[0].ir_irq != ISACF_IRQ_DEFAULT &&
    292 	    ia->ia_irq[0].ir_irq != irq) {
    293 		printf("ahc_isa_match: irq mismatch (kernel %d, card %d)\n",
    294 		    ia->ia_irq[0].ir_irq, irq);
    295 		return (0);
    296 	}
    297 
    298 	/* We have a match */
    299 	ia->ia_nio = 1;
    300 	ia->ia_io[0].ir_addr = iobase;
    301 	ia->ia_io[0].ir_size = AHC_ISA_IOSIZE;
    302 
    303 	ia->ia_nirq = 1;
    304 	ia->ia_irq[0].ir_irq = irq;
    305 
    306 	ia->ia_ndrq = 0;
    307 	ia->ia_niomem = 0;
    308 
    309 	return (1);
    310 }
    311 
    312 /*
    313  * Check the slots looking for a board we recognise
    314  * If we find one, note it's address (slot) and call
    315  * the actual probe routine to check it out.
    316  */
    317 int
    318 ahc_isa_probe(parent, match, aux)
    319         struct device *parent;
    320         struct cfdata *match;
    321 	void *aux;
    322 {
    323 	struct isa_attach_args *ia = aux;
    324 	struct ahc_isa_slot *as;
    325 
    326 	if (ahc_isa_slot_initialized == 0) {
    327 		LIST_INIT(&ahc_isa_all_slots);
    328 		ahc_isa_slot_initialized = 1;
    329 	}
    330 
    331 	if (ia->ia_nio < 1)
    332 		return (0);
    333 	if (ia->ia_nirq < 1)
    334 		return (0);
    335 
    336 	if (ISA_DIRECT_CONFIG(ia))
    337 		return (0);
    338 
    339 	if (ia->ia_io[0].ir_addr != ISACF_PORT_DEFAULT)
    340 		return (ahc_isa_match(ia, ia->ia_io[0].ir_addr));
    341 
    342 	/*
    343 	 * Find this bus's state.  If we don't yet have a slot
    344 	 * marker, allocate and initialize one.
    345 	 */
    346 	for (as = ahc_isa_all_slots.lh_first; as != NULL;
    347 	    as = as->link.le_next)
    348 		if (as->bus == parent->dv_unit)
    349 			goto found_slot_marker;
    350 
    351 	/*
    352 	 * Don't have one, so make one.
    353 	 */
    354 	as = (struct ahc_isa_slot *)
    355 	    malloc(sizeof(struct ahc_isa_slot), M_DEVBUF, M_NOWAIT);
    356 	if (as == NULL)
    357 		panic("ahc_isa_probe: can't allocate slot marker");
    358 
    359 	as->bus = parent->dv_unit;
    360 	as->slot = AHC_ISA_MIN_SLOT;
    361 	LIST_INSERT_HEAD(&ahc_isa_all_slots, as, link);
    362 
    363  found_slot_marker:
    364 
    365 	for (; as->slot <= AHC_ISA_MAX_SLOT; as->slot++) {
    366 		if (ahc_isa_match(ia, EISA_SLOT_ADDR(as->slot) +
    367 		    AHC_ISA_SLOT_OFFSET)) {
    368 			as->slot++; /* next slot to search */
    369 			return (1);
    370 		}
    371 	}
    372 
    373 	/* No matching cards were found. */
    374 	return (0);
    375 }
    376 
    377 void
    378 ahc_isa_attach(parent, self, aux)
    379 	struct device *parent, *self;
    380 	void *aux;
    381 {
    382 	struct ahc_softc *ahc = (void *)self;
    383 	struct isa_attach_args *ia = aux;
    384 	bus_space_tag_t iot = ia->ia_iot;
    385 	bus_space_handle_t ioh;
    386 	int irq, intrtype;
    387 	const char *intrtypestr;
    388 	char idstring[EISA_IDSTRINGLEN];
    389 
    390 	if (bus_space_map(iot, ia->ia_io[0].ir_addr, ia->ia_io[0].ir_size,
    391 	    0, &ioh)) {
    392 		printf(": can't map i/o space\n");
    393 		return;
    394 	}
    395 	if (!ahc_isa_idstring(iot, ioh, idstring)) {
    396 		printf(": can't read ID string\n");
    397 		goto free_io;
    398 	}
    399 	if ((irq = ahc_aic77xx_irq(iot, ioh)) < 0) {
    400 		printf(": ahc_aic77xx_irq failed\n");
    401 		goto free_io;
    402 	}
    403 
    404 	if (strcmp(idstring, "ADP7756") == 0) {
    405 		printf(": %s\n", EISA_PRODUCT_ADP7756);
    406 	} else if (strcmp(idstring, "ADP7757") == 0) {
    407 		printf(": %s\n", EISA_PRODUCT_ADP7757);
    408 	} else {
    409 		printf(": unknown device type %s\n", idstring);
    410 		goto free_io;
    411 	}
    412 
    413 	if (ahc_alloc(ahc, ioh, iot, ia->ia_dmat,
    414 	    AHC_AIC7770|AHC_VL, AHC_AIC7770_FE, AHC_FNONE))
    415 		goto free_io;
    416 
    417 	/*
    418 	 * Tell the bus-dma interface that we can do 32bit dma
    419 	 * NOTE: this variable is first referenced in ahc_init().
    420 	 */
    421 	ahc->sc_dmaflags = ISABUS_DMA_32BIT;
    422 
    423 	ahc->channel = 'A';
    424 	ahc->channel_b = 'B';
    425 	if (ahc_reset(ahc) != 0)
    426 		goto free_ahc;
    427 
    428 	/*
    429 	 * The IRQMS bit enables level sensitive interrupts. Only allow
    430 	 * IRQ sharing if it's set.
    431 	 * NOTE: ahc->pause is initialized in ahc_alloc().
    432 	 */
    433 	if (ahc->pause & IRQMS) {
    434 		intrtype = IST_LEVEL;
    435 		intrtypestr = "level sensitive";
    436 	} else {
    437 		intrtype = IST_EDGE;
    438 		intrtypestr = "edge triggered";
    439 	}
    440 	ahc->ih = isa_intr_establish(ia->ia_ic, irq,
    441 	    intrtype, IPL_BIO, ahc_intr, ahc);
    442 	if (ahc->ih == NULL) {
    443 		printf("%s: couldn't establish %s interrupt\n",
    444 		       ahc->sc_dev.dv_xname, intrtypestr);
    445 		goto free_ahc;
    446 	}
    447 
    448 	/*
    449 	 * Tell the user what type of interrupts we're using.
    450 	 * usefull for debugging irq problems
    451 	 */
    452 	if (bootverbose) {
    453 		printf("%s: Using %s interrupts\n",
    454 		       ahc->sc_dev.dv_xname, intrtypestr);
    455 	}
    456 
    457 	/*
    458 	 * Now that we know we own the resources we need, do the
    459 	 * card initialization.
    460 	 */
    461 	aha2840_load_seeprom(ahc);
    462 
    463 	/* Attach sub-devices */
    464 	if (ahc_aic77xx_attach(ahc) == 0)
    465 		return; /* succeed */
    466 
    467 	/* failed */
    468 	isa_intr_disestablish(ia->ia_ic, ahc->ih);
    469 free_ahc:
    470 	ahc_free(ahc);
    471 free_io:
    472 	bus_space_unmap(iot, ioh, ia->ia_io[0].ir_size);
    473 }
    474 
    475 /*
    476  * Read the 284x SEEPROM.
    477  */
    478 void
    479 aha2840_load_seeprom(struct ahc_softc *ahc)
    480 {
    481 	struct	  seeprom_descriptor sd;
    482 	struct	  seeprom_config sc;
    483 	u_int16_t checksum = 0;
    484 	u_int8_t  scsi_conf;
    485 	int	  have_seeprom;
    486 
    487 	sd.sd_tag = ahc->tag;
    488 	sd.sd_bsh = ahc->bsh;
    489 	sd.sd_control_offset = SEECTL_2840;
    490 	sd.sd_status_offset = STATUS_2840;
    491 	sd.sd_dataout_offset = STATUS_2840;
    492 	sd.sd_chip = C46;
    493 	sd.sd_MS = 0;
    494 	sd.sd_RDY = EEPROM_TF;
    495 	sd.sd_CS = CS_2840;
    496 	sd.sd_CK = CK_2840;
    497 	sd.sd_DO = DO_2840;
    498 	sd.sd_DI = DI_2840;
    499 
    500 	if (bootverbose)
    501 		printf("%s: Reading SEEPROM...", ahc_name(ahc));
    502 	have_seeprom = read_seeprom(&sd,
    503 				    (u_int16_t *)&sc,
    504 				    /*start_addr*/0,
    505 				    sizeof(sc)/2);
    506 
    507 	if (have_seeprom) {
    508 		/* Check checksum */
    509 		int i;
    510 		int maxaddr = (sizeof(sc)/2) - 1;
    511 		u_int16_t *scarray = (u_int16_t *)&sc;
    512 
    513 		for (i = 0; i < maxaddr; i++)
    514 			checksum = checksum + scarray[i];
    515 		if (checksum != sc.checksum) {
    516 			if(bootverbose)
    517 				printf ("checksum error\n");
    518 			have_seeprom = 0;
    519 		} else if (bootverbose) {
    520 			printf("done.\n");
    521 		}
    522 	}
    523 
    524 	if (!have_seeprom) {
    525 		if (bootverbose)
    526 			printf("%s: No SEEPROM available\n", ahc_name(ahc));
    527 		ahc->flags |= AHC_USEDEFAULTS;
    528 	} else {
    529 		/*
    530 		 * Put the data we've collected down into SRAM
    531 		 * where ahc_init will find it.
    532 		 */
    533 		int i;
    534 		int max_targ = (ahc->features & AHC_WIDE) != 0 ? 16 : 8;
    535 		u_int16_t discenable;
    536 
    537 		discenable = 0;
    538 		for (i = 0; i < max_targ; i++){
    539 	                u_int8_t target_settings;
    540 			target_settings = (sc.device_flags[i] & CFXFER) << 4;
    541 			if (sc.device_flags[i] & CFSYNCH)
    542 				target_settings |= SOFS;
    543 			if (sc.device_flags[i] & CFWIDEB)
    544 				target_settings |= WIDEXFER;
    545 			if (sc.device_flags[i] & CFDISC)
    546 				discenable |= (0x01 << i);
    547 			ahc_outb(ahc, TARG_SCSIRATE + i, target_settings);
    548 		}
    549 		ahc_outb(ahc, DISC_DSB, ~(discenable & 0xff));
    550 		ahc_outb(ahc, DISC_DSB + 1, ~((discenable >> 8) & 0xff));
    551 
    552 		ahc->our_id = sc.brtime_id & CFSCSIID;
    553 
    554 		scsi_conf = (ahc->our_id & 0x7);
    555 		if (sc.adapter_control & CFSPARITY)
    556 			scsi_conf |= ENSPCHK;
    557 		if (sc.adapter_control & CFRESETB)
    558 			scsi_conf |= RESET_SCSI;
    559 
    560 		if (sc.bios_control & CF284XEXTEND)
    561 			ahc->flags |= AHC_EXTENDED_TRANS_A;
    562 		/* Set SCSICONF info */
    563 		ahc_outb(ahc, SCSICONF, scsi_conf);
    564 
    565 		if (sc.adapter_control & CF284XSTERM)
    566 			ahc->flags |= AHC_TERM_ENB_A;
    567 	}
    568 }
    569