Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / amiga / dev / aster.c
blobda1c5071308309beac57d532f5656bc7e2ca4548
1 /* $NetBSD: aster.c,v 1.20 2003/01/01 00:28:57 thorpej Exp $ */
3 /*-
4 * Copyright (c) 1998,2001 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Ignatios Souvatzis.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: aster.c,v 1.20 2003/01/01 00:28:57 thorpej Exp $");
36 * zbus ISDN Blaster, ISDN Master driver.
39 #include <sys/types.h>
41 #include <sys/conf.h>
42 #include <sys/device.h>
43 #include <sys/systm.h>
44 #include <sys/param.h>
46 #include <machine/bus.h>
48 #include <amiga/include/cpu.h>
50 #include <amiga/amiga/device.h>
51 #include <amiga/amiga/drcustom.h>
53 #include <amiga/dev/supio.h>
54 #include <amiga/dev/zbusvar.h>
57 struct aster_softc {
58 struct device sc_dev;
59 struct bus_space_tag sc_bst;
62 int astermatch(struct device *, struct cfdata *, void *);
63 void asterattach(struct device *, struct device *, void *);
64 int asterprint(void *auxp, const char *);
66 CFATTACH_DECL(aster, sizeof(struct aster_softc),
67 astermatch, asterattach, NULL, NULL);
69 int
70 astermatch(struct device *parent, struct cfdata *cfp, void *auxp)
73 struct zbus_args *zap;
75 zap = auxp;
77 if (zap->manid == 5001 && zap->prodid == 1) /* VMC ISDN Blaster */
78 return (1);
80 if (zap->manid == 2092 && (zap->prodid == 64 || /* BSC ISDN Master */
81 zap->prodid == 65)) /* BSC ISDN Master II */
82 return (1);
84 if (zap->manid == 5000 && zap->prodid == 1) /* ITH ISDN Master II */
85 return (1);
87 if (zap->manid == 4626 && zap->prodid == 5 && zap->serno == 0)
88 return (1); /* Schoenfeld ISDN Surfer */
90 if (zap->manid == 2189 && zap->prodid == 3)
91 return (1); /* Zeus Dev. ? ISDN board */
93 return (0);
96 void
97 asterattach(struct device *parent, struct device *self, void *auxp)
99 struct aster_softc *astrsc;
100 struct zbus_args *zap;
101 struct supio_attach_args supa;
103 astrsc = (struct aster_softc *)self;
104 zap = auxp;
106 astrsc->sc_bst.base = (u_long)zap->va + 0;
107 astrsc->sc_bst.absm = &amiga_bus_stride_2;
108 supa.supio_ipl = 2; /* could be 6. isic_supio will decide. */
110 switch (zap->manid) {
111 case 5001:
112 supa.supio_name = "isic31VMC ISDN Blaster";
113 break;
114 case 2092:
115 supa.supio_name = "isic31BSC ISDN Master/Master II";
116 break;
117 case 5000:
118 supa.supio_name = "isic13ITH ISDN Master II";
119 break;
120 case 2189:
121 supa.supio_name = "isic@BZeus ISDN Link";
122 break;
123 case 4626:
124 if (zap->serno == 0) {
125 supa.supio_name =
126 "isic1CIndividual Comp. ISDN Surfer";
127 ((volatile u_int8_t *)zap->va)[0x00fe] = 0xff;
128 if (((volatile u_int8_t *)zap->va)[0x00fe] & 0x80)
129 supa.supio_ipl = 6;
130 break;
132 /* FALLTHROUGH */
135 if (parent)
136 printf(" IPL %d: %s\n", supa.supio_ipl, supa.supio_name+6);
138 supa.supio_iot = &astrsc->sc_bst;
140 supa.supio_iobase = 0;
141 supa.supio_arg = 0;
142 config_found(self, &supa, asterprint); /* XXX */
143 #ifdef __notyet__
144 hyper3i_attach_subr(self, &supa, asterprint);
145 #endif
149 asterprint(void *auxp, const char *pnp)
151 struct supio_attach_args *supa;
152 supa = auxp;
154 if (pnp == NULL)
155 return(QUIET);
157 aprint_normal("%s at %s port 0x%04x",
158 supa->supio_name, pnp, supa->supio_iobase);
160 return(UNCONF);