Home | History | Annotate | Line # | Download | only in dev
gvpbus.c revision 1.1
      1 /*
      2  * Copyright (c) 1994 Christian E. Hopps
      3  * All rights reserved.
      4  *
      5  * Redistribution and use in source and binary forms, with or without
      6  * modification, are permitted provided that the following conditions
      7  * are met:
      8  * 1. Redistributions of source code must retain the above copyright
      9  *    notice, this list of conditions and the following disclaimer.
     10  * 2. Redistributions in binary form must reproduce the above copyright
     11  *    notice, this list of conditions and the following disclaimer in the
     12  *    documentation and/or other materials provided with the distribution.
     13  * 3. All advertising materials mentioning features or use of this software
     14  *    must display the following acknowledgement:
     15  *      This product includes software developed by Christian E. Hopps.
     16  * 4. 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 ``AS IS'' AND ANY EXPRESS OR
     20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     24  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29  *
     30  *	$Id: gvpbus.c,v 1.1 1994/05/08 05:53:15 chopps Exp $
     31  */
     32 #include <sys/param.h>
     33 #include <sys/device.h>
     34 #include <amiga/amiga/device.h>
     35 #include <amiga/dev/ztwobusvar.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", 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 ztwobus_args *zap;
     53 
     54 	zap = auxp;
     55 
     56 	/*
     57 	 * Check manufacturer and product id.
     58 	 */
     59 	if (zap->manid == 2017 && zap->prodid == 11)
     60 		return(1);
     61 	return(0);
     62 }
     63 
     64 void
     65 gvpbusattach(pdp, dp, auxp)
     66 	struct device *pdp, *dp;
     67 	void *auxp;
     68 {
     69 	struct ztwobus_args *zap;
     70 	struct gvpbus_args ga;
     71 	u_char *idreg;
     72 
     73 	zap = auxp;
     74 	bcopy(zap, &ga.zargs, sizeof(struct ztwobus_args));
     75 	ga.flags = 0;
     76 
     77 	/*
     78 	 * grab secondary type
     79 	 */
     80 	ga.prod = *((u_char *)zap->va + 0x8001) & 0xf8;
     81 	switch (ga.prod) {
     82 	/* no scsi */
     83 	case GVP_GFORCE_040:
     84 	case GVP_GFORCE_030:
     85 		ga.flags = GVP_IO;
     86 		/*FALLTHROUGH*/
     87 	case GVP_COMBO_R4:
     88 	case GVP_COMBO_R3:
     89 		ga.flags |= GVP_ACCEL;
     90 		break;
     91 	/* scsi */
     92 	case GVP_GFORCE_040_SCSI:
     93 		ga.flags = GVP_SCSI | GVP_IO | GVP_ACCEL;
     94 		break;
     95 	case GVP_GFORCE_030_SCSI:
     96 		ga.flags = GVP_SCSI | GVP_IO | GVP_ACCEL | GVP_25BITDMA;
     97 		break;
     98 	case GVP_COMBO_R4_SCSI:
     99 		ga.flags = GVP_SCSI | GVP_ACCEL | GVP_25BITDMA;
    100 		break;
    101 	case GVP_COMBO_R3_SCSI:
    102 		ga.flags = GVP_SCSI | GVP_ACCEL | GVP_24BITDMA;
    103 		break;
    104 	case GVP_SERIESII:
    105 		ga.flags = GVP_SCSI | GVP_24BITDMA;
    106 		break;
    107 	/* misc */
    108 	case GVP_IOEXTEND:
    109 		ga.flags |= GVP_IO;
    110 		break;
    111 	default:
    112 	}
    113 	printf("\n");
    114 	/*
    115 	 * attempt to configure the board.
    116 	 */
    117 	config_found(dp, &ga, gvpbusprint);
    118 	/*
    119 	 * eventually when io support is added we need to
    120 	 * configure that too.
    121 	 */
    122 }
    123 
    124 int
    125 gvpbusprint(auxp, pnp)
    126 	void *auxp;
    127 	char *pnp;
    128 {
    129 	struct gvpbus_args *gap;
    130 
    131 	gap = auxp;
    132 	if (pnp == NULL)
    133 		return(QUIET);
    134 	/*
    135 	 * doesn't support io yet.
    136 	 */
    137 	if (gap->prod == GVP_IOEXTEND)
    138 		printf("gio at %s", pnp);
    139 	else
    140 		printf("gtsc at %s", pnp);
    141 	return(UNCONF);
    142 }
    143 
    144