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