2003-01-01 03:25:01 +03:00
|
|
|
/* $NetBSD: gvpbus.c,v 1.22 2003/01/01 00:28:58 thorpej Exp $ */
|
1994-10-26 05:01:24 +03:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1994 Christian E. Hopps
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Christian E. Hopps.
|
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
2002-01-28 12:56:43 +03:00
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
2003-01-01 03:25:01 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: gvpbus.c,v 1.22 2003/01/01 00:28:58 thorpej Exp $");
|
2002-01-28 12:56:43 +03:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/device.h>
|
1996-04-22 01:10:48 +04:00
|
|
|
#include <sys/systm.h>
|
1994-05-08 09:52:54 +04:00
|
|
|
#include <amiga/amiga/device.h>
|
1994-12-28 12:24:55 +03:00
|
|
|
#include <amiga/dev/zbusvar.h>
|
1994-05-08 09:52:54 +04:00
|
|
|
#include <amiga/dev/gvpbusvar.h>
|
|
|
|
|
2002-01-26 16:40:52 +03:00
|
|
|
void gvpbusattach(struct device *, struct device *, void *);
|
|
|
|
int gvpbusmatch(struct device *, struct cfdata *, void *);
|
|
|
|
int gvpbusprint(void *auxp, const char *);
|
1994-05-08 09:52:54 +04:00
|
|
|
|
1995-02-12 22:18:33 +03:00
|
|
|
extern int sbic_no_dma; /* Kludge for A1291 - mlh */
|
|
|
|
|
2002-10-02 08:55:47 +04:00
|
|
|
CFATTACH_DECL(gvpbus, sizeof(struct device),
|
|
|
|
gvpbusmatch, gvpbusattach, NULL, NULL);
|
1996-03-17 04:16:48 +03:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
int
|
2002-01-26 16:40:52 +03:00
|
|
|
gvpbusmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
|
1994-05-08 09:52:54 +04:00
|
|
|
{
|
1994-12-28 12:24:55 +03:00
|
|
|
struct zbus_args *zap;
|
1994-05-08 09:52:54 +04:00
|
|
|
|
|
|
|
zap = auxp;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check manufacturer and product id.
|
|
|
|
*/
|
1994-06-21 08:02:13 +04:00
|
|
|
#if 0
|
1994-05-26 01:55:04 +04:00
|
|
|
if (zap->manid == 2017 && (zap->prodid == 11 || zap->prodid == 2))
|
1994-06-21 08:02:13 +04:00
|
|
|
#else
|
|
|
|
if (zap->manid == 2017 && zap->prodid == 11)
|
|
|
|
#endif
|
1994-05-08 09:52:54 +04:00
|
|
|
return(1);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-01-26 16:40:52 +03:00
|
|
|
gvpbusattach(struct device *pdp, struct device *dp, void *auxp)
|
1994-05-08 09:52:54 +04:00
|
|
|
{
|
1994-12-28 12:24:55 +03:00
|
|
|
struct zbus_args *zap;
|
1994-05-08 09:52:54 +04:00
|
|
|
struct gvpbus_args ga;
|
2002-01-27 17:52:51 +03:00
|
|
|
int flags0, flags;
|
1994-05-08 09:52:54 +04:00
|
|
|
|
|
|
|
zap = auxp;
|
1994-12-28 12:24:55 +03:00
|
|
|
bcopy(zap, &ga.zargs, sizeof(struct zbus_args));
|
2002-01-27 17:52:51 +03:00
|
|
|
flags = 0;
|
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
/*
|
1994-05-26 01:55:04 +04:00
|
|
|
* grab secondary type (or fake it if we have a series I)
|
1994-05-08 09:52:54 +04:00
|
|
|
*/
|
1995-08-18 19:27:29 +04:00
|
|
|
if (zap->prodid != 9) {
|
1994-05-26 01:55:04 +04:00
|
|
|
ga.prod = *((u_char *)zap->va + 0x8001) & 0xf8;
|
1995-08-18 19:27:29 +04:00
|
|
|
if (*((u_char *)zap->va + 0x8001) & 0x01)
|
2002-01-27 17:52:51 +03:00
|
|
|
flags |= GVP_14MHZ;
|
|
|
|
printf(": subprod %02x flags %02x", *((u_char *)zap->va + 0x8001), flags);
|
1994-06-21 08:02:13 +04:00
|
|
|
#if 0
|
1995-08-18 19:27:29 +04:00
|
|
|
} else {
|
1994-05-26 01:55:04 +04:00
|
|
|
ga.prod = GVP_SERIESII; /* really a series I */
|
2002-01-27 17:52:51 +03:00
|
|
|
flags |= GVP_NOBANK;
|
1994-06-21 08:02:13 +04:00
|
|
|
#endif
|
1995-08-18 19:27:29 +04:00
|
|
|
}
|
2002-01-26 16:40:52 +03:00
|
|
|
|
1994-05-26 01:55:04 +04:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
switch (ga.prod) {
|
|
|
|
/* no scsi */
|
|
|
|
case GVP_GFORCE_040:
|
|
|
|
case GVP_GFORCE_030:
|
2002-01-27 17:52:51 +03:00
|
|
|
flags = GVP_IO;
|
1994-05-08 09:52:54 +04:00
|
|
|
/*FALLTHROUGH*/
|
|
|
|
case GVP_COMBO_R4:
|
|
|
|
case GVP_COMBO_R3:
|
2002-01-27 17:52:51 +03:00
|
|
|
flags |= GVP_ACCEL;
|
1994-05-08 09:52:54 +04:00
|
|
|
break;
|
|
|
|
/* scsi */
|
1995-02-12 22:18:33 +03:00
|
|
|
case GVP_A1291_SCSI:
|
2002-01-27 17:52:51 +03:00
|
|
|
flags |= GVP_SCSI | GVP_ACCEL;
|
1995-02-12 22:18:33 +03:00
|
|
|
sbic_no_dma = 1; /* Kludge !!!!!!! mlh */
|
|
|
|
break;
|
1994-05-08 09:52:54 +04:00
|
|
|
case GVP_GFORCE_040_SCSI:
|
2002-01-27 17:52:51 +03:00
|
|
|
flags |= GVP_SCSI | GVP_IO | GVP_ACCEL;
|
1994-05-08 09:52:54 +04:00
|
|
|
break;
|
|
|
|
case GVP_GFORCE_030_SCSI:
|
2002-01-27 17:52:51 +03:00
|
|
|
flags |= GVP_SCSI | GVP_IO | GVP_ACCEL | GVP_25BITDMA;
|
1994-05-08 09:52:54 +04:00
|
|
|
break;
|
1995-03-05 16:01:24 +03:00
|
|
|
case GVP_A530_SCSI:
|
1994-05-08 09:52:54 +04:00
|
|
|
case GVP_COMBO_R4_SCSI:
|
2002-01-27 17:52:51 +03:00
|
|
|
flags |= GVP_SCSI | GVP_ACCEL | GVP_25BITDMA;
|
1995-08-18 19:27:29 +04:00
|
|
|
if (ga.prod == GVP_COMBO_R4_SCSI)
|
2002-01-27 17:52:51 +03:00
|
|
|
flags ^= GVP_14MHZ;
|
1994-05-08 09:52:54 +04:00
|
|
|
break;
|
|
|
|
case GVP_COMBO_R3_SCSI:
|
2002-01-27 17:52:51 +03:00
|
|
|
flags |= GVP_SCSI | GVP_ACCEL | GVP_24BITDMA;
|
|
|
|
flags ^= GVP_14MHZ;
|
1994-05-08 09:52:54 +04:00
|
|
|
break;
|
|
|
|
case GVP_SERIESII:
|
2002-01-27 17:52:51 +03:00
|
|
|
flags |= GVP_SCSI | GVP_24BITDMA;
|
1994-05-08 09:52:54 +04:00
|
|
|
break;
|
|
|
|
/* misc */
|
|
|
|
case GVP_IOEXTEND:
|
2002-01-27 17:52:51 +03:00
|
|
|
flags |= GVP_IO;
|
1994-05-08 09:52:54 +04:00
|
|
|
break;
|
|
|
|
default:
|
1996-10-13 07:05:43 +04:00
|
|
|
printf(": unknown Series II %x", ga.prod);
|
1994-05-08 09:52:54 +04:00
|
|
|
}
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("\n");
|
1994-05-08 09:52:54 +04:00
|
|
|
/*
|
|
|
|
* attempt to configure the board.
|
|
|
|
*/
|
2002-01-27 17:52:51 +03:00
|
|
|
|
|
|
|
flags0 = flags & ~(GVP_IO|GVP_SCSI);
|
|
|
|
|
|
|
|
if (flags & GVP_SCSI) {
|
|
|
|
ga.flags = flags0 | GVP_SCSI;
|
|
|
|
config_found(dp, &ga, gvpbusprint);
|
|
|
|
}
|
|
|
|
if (flags & GVP_IO) {
|
|
|
|
ga.flags = flags0 | GVP_IO;
|
|
|
|
config_found(dp, &ga, gvpbusprint);
|
|
|
|
}
|
1994-05-08 09:52:54 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2002-01-26 16:40:52 +03:00
|
|
|
gvpbusprint(void *auxp, const char *pnp)
|
1994-05-08 09:52:54 +04:00
|
|
|
{
|
|
|
|
struct gvpbus_args *gap;
|
|
|
|
|
|
|
|
gap = auxp;
|
|
|
|
if (pnp == NULL)
|
|
|
|
return(QUIET);
|
|
|
|
/*
|
|
|
|
* doesn't support io yet.
|
|
|
|
*/
|
2002-01-26 16:40:52 +03:00
|
|
|
if (gap->prod == GVP_IOEXTEND)
|
2003-01-01 03:25:01 +03:00
|
|
|
aprint_normal("gio at %s", pnp);
|
1994-05-08 09:52:54 +04:00
|
|
|
else
|
2003-01-01 03:25:01 +03:00
|
|
|
aprint_normal("gtsc at %s", pnp);
|
1994-05-08 09:52:54 +04:00
|
|
|
return(UNCONF);
|
|
|
|
}
|
|
|
|
|