1 /* $NetBSD: ioasic_subr.c,v 1.11 2005/12/11 12:24:00 christos Exp $ */
4 * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
7 * Author: Keith Bostic, Chris G. Demetriou
9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation.
15 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 * Carnegie Mellon requests users of this software to return to
21 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
31 #include <sys/cdefs.h>
32 __KERNEL_RCSID(0, "$NetBSD: ioasic_subr.c,v 1.11 2005/12/11 12:24:00 christos Exp $");
34 #include <sys/param.h>
35 #include <sys/systm.h>
36 #include <sys/device.h>
37 #include <dev/tc/tcvar.h>
38 #include <dev/tc/ioasicvar.h>
42 int ioasicprint(void *, const char *);
45 ioasicprint(void *aux
, const char *pnp
)
47 struct ioasicdev_attach_args
*d
= aux
;
50 aprint_normal("%s at %s", d
->iada_modname
, pnp
);
51 aprint_normal(" offset 0x%x", d
->iada_offset
);
56 ioasic_attach_devs(struct ioasic_softc
*sc
, struct ioasic_dev
*ioasic_devs
,
59 struct ioasicdev_attach_args idev
;
61 int locs
[IOASICCF_NLOCS
];
64 * Try to configure each device.
66 for (i
= 0; i
< ioasic_ndevs
; i
++) {
67 strlcpy(idev
.iada_modname
, ioasic_devs
[i
].iad_modname
,
68 sizeof(idev
.iada_modname
));
69 idev
.iada_offset
= ioasic_devs
[i
].iad_offset
;
70 idev
.iada_addr
= sc
->sc_base
+ ioasic_devs
[i
].iad_offset
;
71 idev
.iada_cookie
= ioasic_devs
[i
].iad_cookie
;
73 /* Tell the autoconfig machinery we've found the hardware. */
74 locs
[IOASICCF_OFFSET
] = ioasic_devs
[i
].iad_offset
;
75 config_found_sm_loc(&sc
->sc_dv
, "ioasic", locs
, &idev
,
76 ioasicprint
, config_stdsubmatch
);