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