Home | History | Annotate | Line # | Download | only in dev
gvpbus.c revision 1.17
      1 /*	$NetBSD: gvpbus.c,v 1.17 2002/01/26 13:40:56 aymeric 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 <sys/systm.h>
     35 #include <amiga/amiga/device.h>
     36 #include <amiga/dev/zbusvar.h>
     37 #include <amiga/dev/gvpbusvar.h>
     38 
     39 void gvpbusattach(struct device *, struct device *, void *);
     40 int gvpbusmatch(struct device *, struct cfdata *, void *);
     41 int gvpbusprint(void *auxp, const char *);
     42 
     43 extern int sbic_no_dma;		/* Kludge for A1291 - mlh */
     44 
     45 struct cfattach gvpbus_ca = {
     46 	sizeof(struct device), gvpbusmatch, gvpbusattach
     47 };
     48 
     49 int
     50 gvpbusmatch(struct device *pdp, struct cfdata *cfp, 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(struct device *pdp, struct device *dp, void *auxp)
     70 {
     71 	struct zbus_args *zap;
     72 	struct gvpbus_args ga;
     73 
     74 	zap = auxp;
     75 	bcopy(zap, &ga.zargs, sizeof(struct zbus_args));
     76 	ga.flags = 0;
     77 
     78 	/*
     79 	 * grab secondary type (or fake it if we have a series I)
     80 	 */
     81 	if (zap->prodid != 9) {
     82 		ga.prod = *((u_char *)zap->va + 0x8001) & 0xf8;
     83 		if (*((u_char *)zap->va + 0x8001) & 0x01)
     84 			ga.flags |= GVP_14MHZ;
     85 	printf(": subprod %02x flags %02x", *((u_char *)zap->va + 0x8001), ga.flags);
     86 #if 0
     87 	} else {
     88 		ga.prod = GVP_SERIESII;		/* really a series I */
     89 		ga.flags |= GVP_NOBANK;
     90 #endif
     91 	}
     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_A1291_SCSI:
    106 		ga.flags |= GVP_SCSI | GVP_ACCEL;
    107 		sbic_no_dma = 1;	/* Kludge !!!!!!! mlh */
    108 		break;
    109 	case GVP_GFORCE_040_SCSI:
    110 		ga.flags |= GVP_SCSI | GVP_IO | GVP_ACCEL;
    111 		break;
    112 	case GVP_GFORCE_030_SCSI:
    113 		ga.flags |= GVP_SCSI | GVP_IO | GVP_ACCEL | GVP_25BITDMA;
    114 		break;
    115 	case GVP_A530_SCSI:
    116 	case GVP_COMBO_R4_SCSI:
    117 		ga.flags |= GVP_SCSI | GVP_ACCEL | GVP_25BITDMA;
    118 		if (ga.prod == GVP_COMBO_R4_SCSI)
    119 			ga.flags ^= GVP_14MHZ;
    120 		break;
    121 	case GVP_COMBO_R3_SCSI:
    122 		ga.flags |= GVP_SCSI | GVP_ACCEL | GVP_24BITDMA;
    123 		ga.flags ^= GVP_14MHZ;
    124 		break;
    125 	case GVP_SERIESII:
    126 		ga.flags |= GVP_SCSI | GVP_24BITDMA;
    127 		break;
    128 	/* misc */
    129 	case GVP_IOEXTEND:
    130 		ga.flags |= GVP_IO;
    131 		break;
    132 	default:
    133 		printf(": unknown Series II %x", ga.prod);
    134 	}
    135 	printf("\n");
    136 	/*
    137 	 * attempt to configure the board.
    138 	 */
    139 	config_found(dp, &ga, gvpbusprint);
    140 	/*
    141 	 * eventually when io support is added we need to
    142 	 * configure that too.
    143 	 */
    144 }
    145 
    146 int
    147 gvpbusprint(void *auxp, const char *pnp)
    148 {
    149 	struct gvpbus_args *gap;
    150 
    151 	gap = auxp;
    152 	if (pnp == NULL)
    153 		return(QUIET);
    154 	/*
    155 	 * doesn't support io yet.
    156 	 */
    157 	if (gap->prod == GVP_IOEXTEND)
    158 		printf("gio at %s", pnp);
    159 	else
    160 		printf("gtsc at %s", pnp);
    161 	return(UNCONF);
    162 }
    163 
    164