Home | History | Annotate | Line # | Download | only in dev
gvpbus.c revision 1.8
      1 /*	$NetBSD: gvpbus.c,v 1.8 1995/03/05 13:01:24 chopps Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1994 Christian E. Hopps
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. All advertising materials mentioning features or use of this software
     16  *    must display the following acknowledgement:
     17  *      This product includes software developed by Christian E. Hopps.
     18  * 4. The name of the author may not be used to endorse or promote products
     19  *    derived from this software without specific prior written permission
     20  *
     21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  */
     32 #include <sys/param.h>
     33 #include <sys/device.h>
     34 #include <amiga/amiga/device.h>
     35 #include <amiga/dev/zbusvar.h>
     36 #include <amiga/dev/gvpbusvar.h>
     37 
     38 void gvpbusattach __P((struct device *, struct device *, void *));
     39 int gvpbusmatch __P((struct device *, struct cfdata *, void *));
     40 int gvpbusprint __P((void *auxp, char *));
     41 
     42 extern int sbic_no_dma;		/* Kludge for A1291 - mlh */
     43 
     44 struct cfdriver gvpbuscd = {
     45 	NULL, "gvpbus", (cfmatch_t)gvpbusmatch, gvpbusattach,
     46 	DV_DULL, sizeof(struct device), NULL, 0 };
     47 
     48 int
     49 gvpbusmatch(pdp, cdp, auxp)
     50 	struct device *pdp;
     51 	struct cfdata *cdp;
     52 	void *auxp;
     53 {
     54 	struct zbus_args *zap;
     55 
     56 	zap = auxp;
     57 
     58 	/*
     59 	 * Check manufacturer and product id.
     60 	 */
     61 #if 0
     62 	if (zap->manid == 2017 && (zap->prodid == 11 || zap->prodid == 2))
     63 #else
     64 	if (zap->manid == 2017 && zap->prodid == 11)
     65 #endif
     66 		return(1);
     67 	return(0);
     68 }
     69 
     70 void
     71 gvpbusattach(pdp, dp, auxp)
     72 	struct device *pdp, *dp;
     73 	void *auxp;
     74 {
     75 	struct zbus_args *zap;
     76 	struct gvpbus_args ga;
     77 	u_char *idreg;
     78 
     79 	zap = auxp;
     80 	bcopy(zap, &ga.zargs, sizeof(struct zbus_args));
     81 	ga.flags = 0;
     82 
     83 	/*
     84 	 * grab secondary type (or fake it if we have a series I)
     85 	 */
     86 	if (zap->prodid != 9)
     87 		ga.prod = *((u_char *)zap->va + 0x8001) & 0xf8;
     88 #if 0
     89 	else {
     90 		ga.prod = GVP_SERIESII;		/* really a series I */
     91 		ga.flags |= GVP_NOBANK;
     92 	}
     93 #endif
     94 
     95 
     96 	switch (ga.prod) {
     97 	/* no scsi */
     98 	case GVP_GFORCE_040:
     99 	case GVP_GFORCE_030:
    100 		ga.flags = GVP_IO;
    101 		/*FALLTHROUGH*/
    102 	case GVP_COMBO_R4:
    103 	case GVP_COMBO_R3:
    104 		ga.flags |= GVP_ACCEL;
    105 		break;
    106 	/* scsi */
    107 	case GVP_A1291_SCSI:
    108 		ga.flags = GVP_SCSI | GVP_ACCEL;
    109 		sbic_no_dma = 1;	/* Kludge !!!!!!! mlh */
    110 		break;
    111 	case GVP_GFORCE_040_SCSI:
    112 		ga.flags = GVP_SCSI | GVP_IO | GVP_ACCEL;
    113 		break;
    114 	case GVP_GFORCE_030_SCSI:
    115 		ga.flags = GVP_SCSI | GVP_IO | GVP_ACCEL | GVP_25BITDMA;
    116 		break;
    117 	case GVP_A530_SCSI:
    118 	case GVP_COMBO_R4_SCSI:
    119 		ga.flags = GVP_SCSI | GVP_ACCEL | GVP_25BITDMA;
    120 		break;
    121 	case GVP_COMBO_R3_SCSI:
    122 		ga.flags = GVP_SCSI | GVP_ACCEL | GVP_24BITDMA;
    123 		break;
    124 	case GVP_SERIESII:
    125 		ga.flags |= GVP_SCSI | GVP_24BITDMA;
    126 		break;
    127 	/* misc */
    128 	case GVP_IOEXTEND:
    129 		ga.flags |= GVP_IO;
    130 		break;
    131 	default:
    132 		printf(": unknown Series II %x", ga.prod);
    133 	}
    134 	printf("\n");
    135 	/*
    136 	 * attempt to configure the board.
    137 	 */
    138 	config_found(dp, &ga, gvpbusprint);
    139 	/*
    140 	 * eventually when io support is added we need to
    141 	 * configure that too.
    142 	 */
    143 }
    144 
    145 int
    146 gvpbusprint(auxp, pnp)
    147 	void *auxp;
    148 	char *pnp;
    149 {
    150 	struct gvpbus_args *gap;
    151 
    152 	gap = auxp;
    153 	if (pnp == NULL)
    154 		return(QUIET);
    155 	/*
    156 	 * doesn't support io yet.
    157 	 */
    158 	if (gap->prod == GVP_IOEXTEND)
    159 		printf("gio at %s", pnp);
    160 	else
    161 		printf("gtsc at %s", pnp);
    162 	return(UNCONF);
    163 }
    164 
    165