Home | History | Annotate | Line # | Download | only in dev
gvpbus.c revision 1.6
      1 /*	$NetBSD: gvpbus.c,v 1.6 1994/12/28 09:25:22 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 struct cfdriver gvpbuscd = {
     43 	NULL, "gvpbus", (cfmatch_t)gvpbusmatch, gvpbusattach,
     44 	DV_DULL, sizeof(struct device), NULL, 0 };
     45 
     46 int
     47 gvpbusmatch(pdp, cdp, auxp)
     48 	struct device *pdp;
     49 	struct cfdata *cdp;
     50 	void *auxp;
     51 {
     52 	struct zbus_args *zap;
     53 
     54 	zap = auxp;
     55 
     56 	/*
     57 	 * Check manufacturer and product id.
     58 	 */
     59 #if 0
     60 	if (zap->manid == 2017 && (zap->prodid == 11 || zap->prodid == 2))
     61 #else
     62 	if (zap->manid == 2017 && zap->prodid == 11)
     63 #endif
     64 		return(1);
     65 	return(0);
     66 }
     67 
     68 void
     69 gvpbusattach(pdp, dp, auxp)
     70 	struct device *pdp, *dp;
     71 	void *auxp;
     72 {
     73 	struct zbus_args *zap;
     74 	struct gvpbus_args ga;
     75 	u_char *idreg;
     76 
     77 	zap = auxp;
     78 	bcopy(zap, &ga.zargs, sizeof(struct zbus_args));
     79 	ga.flags = 0;
     80 
     81 	/*
     82 	 * grab secondary type (or fake it if we have a series I)
     83 	 */
     84 	if (zap->prodid != 9)
     85 		ga.prod = *((u_char *)zap->va + 0x8001) & 0xf8;
     86 #if 0
     87 	else {
     88 		ga.prod = GVP_SERIESII;		/* really a series I */
     89 		ga.flags |= GVP_NOBANK;
     90 	}
     91 #endif
     92 
     93 
     94 	switch (ga.prod) {
     95 	/* no scsi */
     96 	case GVP_GFORCE_040:
     97 	case GVP_GFORCE_030:
     98 		ga.flags = GVP_IO;
     99 		/*FALLTHROUGH*/
    100 	case GVP_COMBO_R4:
    101 	case GVP_COMBO_R3:
    102 		ga.flags |= GVP_ACCEL;
    103 		break;
    104 	/* scsi */
    105 	case GVP_GFORCE_040_SCSI:
    106 		ga.flags = GVP_SCSI | GVP_IO | GVP_ACCEL;
    107 		break;
    108 	case GVP_GFORCE_030_SCSI:
    109 		ga.flags = GVP_SCSI | GVP_IO | GVP_ACCEL | GVP_25BITDMA;
    110 		break;
    111 	case GVP_COMBO_R4_SCSI:
    112 		ga.flags = GVP_SCSI | GVP_ACCEL | GVP_25BITDMA;
    113 		break;
    114 	case GVP_COMBO_R3_SCSI:
    115 		ga.flags = GVP_SCSI | GVP_ACCEL | GVP_24BITDMA;
    116 		break;
    117 	case GVP_SERIESII:
    118 		ga.flags |= GVP_SCSI | GVP_24BITDMA;
    119 		break;
    120 	/* misc */
    121 	case GVP_IOEXTEND:
    122 		ga.flags |= GVP_IO;
    123 		break;
    124 	default:
    125 		printf(": unknown Series II %x", ga.prod);
    126 	}
    127 	printf("\n");
    128 	/*
    129 	 * attempt to configure the board.
    130 	 */
    131 	config_found(dp, &ga, gvpbusprint);
    132 	/*
    133 	 * eventually when io support is added we need to
    134 	 * configure that too.
    135 	 */
    136 }
    137 
    138 int
    139 gvpbusprint(auxp, pnp)
    140 	void *auxp;
    141 	char *pnp;
    142 {
    143 	struct gvpbus_args *gap;
    144 
    145 	gap = auxp;
    146 	if (pnp == NULL)
    147 		return(QUIET);
    148 	/*
    149 	 * doesn't support io yet.
    150 	 */
    151 	if (gap->prod == GVP_IOEXTEND)
    152 		printf("gio at %s", pnp);
    153 	else
    154 		printf("gtsc at %s", pnp);
    155 	return(UNCONF);
    156 }
    157 
    158