1 /* $NetBSD: gvpbus.c,v 1.23 2009/03/18 17:06:42 cegger Exp $ */
4 * Copyright (c) 1994 Christian E. Hopps
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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.
33 #include <sys/cdefs.h>
34 __KERNEL_RCSID(0, "$NetBSD: gvpbus.c,v 1.23 2009/03/18 17:06:42 cegger Exp $");
36 #include <sys/param.h>
37 #include <sys/device.h>
38 #include <sys/systm.h>
39 #include <amiga/amiga/device.h>
40 #include <amiga/dev/zbusvar.h>
41 #include <amiga/dev/gvpbusvar.h>
43 void gvpbusattach(struct device
*, struct device
*, void *);
44 int gvpbusmatch(struct device
*, struct cfdata
*, void *);
45 int gvpbusprint(void *auxp
, const char *);
47 extern int sbic_no_dma
; /* Kludge for A1291 - mlh */
49 CFATTACH_DECL(gvpbus
, sizeof(struct device
),
50 gvpbusmatch
, gvpbusattach
, NULL
, NULL
);
53 gvpbusmatch(struct device
*pdp
, struct cfdata
*cfp
, void *auxp
)
55 struct zbus_args
*zap
;
60 * Check manufacturer and product id.
63 if (zap
->manid
== 2017 && (zap
->prodid
== 11 || zap
->prodid
== 2))
65 if (zap
->manid
== 2017 && zap
->prodid
== 11)
72 gvpbusattach(struct device
*pdp
, struct device
*dp
, void *auxp
)
74 struct zbus_args
*zap
;
75 struct gvpbus_args ga
;
79 memcpy(&ga
.zargs
, zap
, sizeof(struct zbus_args
));
83 * grab secondary type (or fake it if we have a series I)
85 if (zap
->prodid
!= 9) {
86 ga
.prod
= *((u_char
*)zap
->va
+ 0x8001) & 0xf8;
87 if (*((u_char
*)zap
->va
+ 0x8001) & 0x01)
89 printf(": subprod %02x flags %02x", *((u_char
*)zap
->va
+ 0x8001), flags
);
92 ga
.prod
= GVP_SERIESII
; /* really a series I */
110 flags
|= GVP_SCSI
| GVP_ACCEL
;
111 sbic_no_dma
= 1; /* Kludge !!!!!!! mlh */
113 case GVP_GFORCE_040_SCSI
:
114 flags
|= GVP_SCSI
| GVP_IO
| GVP_ACCEL
;
116 case GVP_GFORCE_030_SCSI
:
117 flags
|= GVP_SCSI
| GVP_IO
| GVP_ACCEL
| GVP_25BITDMA
;
120 case GVP_COMBO_R4_SCSI
:
121 flags
|= GVP_SCSI
| GVP_ACCEL
| GVP_25BITDMA
;
122 if (ga
.prod
== GVP_COMBO_R4_SCSI
)
125 case GVP_COMBO_R3_SCSI
:
126 flags
|= GVP_SCSI
| GVP_ACCEL
| GVP_24BITDMA
;
130 flags
|= GVP_SCSI
| GVP_24BITDMA
;
137 printf(": unknown Series II %x", ga
.prod
);
141 * attempt to configure the board.
144 flags0
= flags
& ~(GVP_IO
|GVP_SCSI
);
146 if (flags
& GVP_SCSI
) {
147 ga
.flags
= flags0
| GVP_SCSI
;
148 config_found(dp
, &ga
, gvpbusprint
);
150 if (flags
& GVP_IO
) {
151 ga
.flags
= flags0
| GVP_IO
;
152 config_found(dp
, &ga
, gvpbusprint
);
157 gvpbusprint(void *auxp
, const char *pnp
)
159 struct gvpbus_args
*gap
;
165 * doesn't support io yet.
167 if (gap
->prod
== GVP_IOEXTEND
)
168 aprint_normal("gio at %s", pnp
);
170 aprint_normal("gtsc at %s", pnp
);