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