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