diff options
| author | matt <matt@NetBSD.org> | 2008-03-11 05:34:01 +0000 |
|---|---|---|
| committer | matt <matt@NetBSD.org> | 2008-03-11 05:34:01 +0000 |
| commit | dfba816635b288ffc525cb86146857ef1a9333c3 (patch) | |
| tree | 898fe10604ba10d8d2a1f5c5550d1440a5c64dae /sys/dev/xmi | |
| parent | 0e65dd74d1d276a3124e93332c1864e95151d7d1 (diff) | |
Rototill the vax code. Switch to devicet/PRIV_ALLOC. Cleanup vax autoconf
code. Move to prototype definitions. staticfy, constify, avoid casting.
Use device_* accessors.
Diffstat (limited to 'sys/dev/xmi')
| -rw-r--r-- | sys/dev/xmi/bi_xmi.c | 9 | ||||
| -rw-r--r-- | sys/dev/xmi/files.xmi | 4 | ||||
| -rw-r--r-- | sys/dev/xmi/xmi.c | 18 | ||||
| -rw-r--r-- | sys/dev/xmi/xmivar.h | 10 |
4 files changed, 21 insertions, 20 deletions
diff --git a/sys/dev/xmi/bi_xmi.c b/sys/dev/xmi/bi_xmi.c index ec1792f9983..e48991ec3b1 100644 --- a/sys/dev/xmi/bi_xmi.c +++ b/sys/dev/xmi/bi_xmi.c @@ -1,4 +1,4 @@ -/* $NetBSD: bi_xmi.c,v 1.6 2007/10/19 12:01:24 ad Exp $ */ +/* $NetBSD: bi_xmi.c,v 1.7 2008/03/11 05:34:02 matt Exp $ */ /* * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bi_xmi.c,v 1.6 2007/10/19 12:01:24 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bi_xmi.c,v 1.7 2008/03/11 05:34:02 matt Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -69,12 +69,13 @@ bi_xmi_match(struct device *parent, struct cfdata *cf, void *aux) static void bi_xmi_attach(struct device *parent, struct device *self, void *aux) { - struct bi_softc *sc = (void *)self; + struct bi_softc *sc = device_private(self); struct xmi_attach_args *xa = aux; /* * Fill in bus specific data. */ + sc->sc_dev = self; sc->sc_addr = (bus_addr_t)BI_BASE(xa->xa_nodenr, 0); sc->sc_iot = xa->xa_iot; /* No special I/O handling */ sc->sc_dmat = xa->xa_dmat; /* No special DMA handling either */ @@ -83,5 +84,5 @@ bi_xmi_attach(struct device *parent, struct device *self, void *aux) bi_attach(sc); } -CFATTACH_DECL(bi_xmi, sizeof(struct bi_softc), +CFATTACH_DECL_NEW(bi_xmi, sizeof(struct bi_softc), bi_xmi_match, bi_xmi_attach, NULL, NULL); diff --git a/sys/dev/xmi/files.xmi b/sys/dev/xmi/files.xmi index 603504820f3..89166865e14 100644 --- a/sys/dev/xmi/files.xmi +++ b/sys/dev/xmi/files.xmi @@ -1,10 +1,10 @@ -# $NetBSD: files.xmi,v 1.1 2000/06/15 19:01:33 ragge Exp $ +# $NetBSD: files.xmi,v 1.2 2008/03/11 05:34:02 matt Exp $ # # Config file and device description for machine-independent # code for devices Digital Equipment Corp. XMI bus. # Included by ports that need it. -device xmi { node=-1 } +device xmi { node=-1 }: bus file dev/xmi/xmi.c xmi diff --git a/sys/dev/xmi/xmi.c b/sys/dev/xmi/xmi.c index 8bcecdc0b5a..962cc2e49b0 100644 --- a/sys/dev/xmi/xmi.c +++ b/sys/dev/xmi/xmi.c @@ -1,4 +1,4 @@ -/* $NetBSD: xmi.c,v 1.9 2007/10/19 12:01:24 ad Exp $ */ +/* $NetBSD: xmi.c,v 1.10 2008/03/11 05:34:02 matt Exp $ */ /* * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved. @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xmi.c,v 1.9 2007/10/19 12:01:24 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xmi.c,v 1.10 2008/03/11 05:34:02 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: xmi.c,v 1.9 2007/10/19 12:01:24 ad Exp $"); static int xmi_print(void *, const char *); -struct xmi_list xmi_list[] = { +const struct xmi_list xmi_list[] = { {XMIDT_KA62, 0, "ka6200"}, {XMIDT_KA64, 1, "ka6400"}, {XMIDT_KA65, 0, "ka6500"}, @@ -64,8 +64,8 @@ struct xmi_list xmi_list[] = { int xmi_print(void *aux, const char *name) { - struct xmi_attach_args *xa = aux; - struct xmi_list *xl; + struct xmi_attach_args * const xa = aux; + const struct xmi_list *xl; for (xl = &xmi_list[0]; xl->xl_nr; xl++) if (xl->xl_nr == bus_space_read_2(xa->xa_iot, xa->xa_ioh, 0)) @@ -91,7 +91,7 @@ xmi_attach(struct xmi_softc *sc) struct xmi_attach_args xa; int nodenr; - printf("\n"); + aprint_normal("\n"); xa.xa_iot = sc->sc_iot; xa.xa_busnr = sc->sc_busnr; @@ -108,8 +108,8 @@ xmi_attach(struct xmi_softc *sc) for (nodenr = 0; nodenr < NNODEXMI; nodenr++) { if (bus_space_map(sc->sc_iot, sc->sc_addr + XMI_NODE(nodenr), PAGE_SIZE, 0, &xa.xa_ioh)) { - printf("xmi_attach: bus_space_map failed, node %d\n", - nodenr); + aprint_error_dev(sc->sc_dev, + "bus_space_map failed, node %d\n", nodenr); return; } if (badaddr((void *)xa.xa_ioh, 4)) { @@ -119,6 +119,6 @@ xmi_attach(struct xmi_softc *sc) xa.xa_nodenr = nodenr; xa.xa_ivec = 256 + lastiv; lastiv += 4; - config_found(&sc->sc_dev, &xa, xmi_print); + config_found(sc->sc_dev, &xa, xmi_print); } } diff --git a/sys/dev/xmi/xmivar.h b/sys/dev/xmi/xmivar.h index 634323f6ec1..817359c4388 100644 --- a/sys/dev/xmi/xmivar.h +++ b/sys/dev/xmi/xmivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: xmivar.h,v 1.1 2000/07/06 17:45:52 ragge Exp $ */ +/* $NetBSD: xmivar.h,v 1.2 2008/03/11 05:34:02 matt Exp $ */ /* * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved. @@ -34,7 +34,7 @@ * per-XMI-adapter state. */ struct xmi_softc { - struct device sc_dev; + struct device *sc_dev; bus_space_tag_t sc_iot; /* Space tag for the XMI bus */ bus_dma_tag_t sc_dmat; bus_addr_t sc_addr; /* Address base address for this bus */ @@ -61,9 +61,9 @@ struct xmi_attach_args { * XMI node list. */ struct xmi_list { - u_short xl_nr; /* Unit ID# */ - u_short xl_havedriver; /* Have device driver (informal) */ - char *xl_name; /* DEC name */ + uint16_t xl_nr; /* Unit ID# */ + uint16_t xl_havedriver; /* Have device driver (informal) */ + const char *xl_name; /* DEC name */ }; /* Prototype */ |
