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