diff options
| author | cube <cube@NetBSD.org> | 2008-03-18 20:46:35 +0000 |
|---|---|---|
| committer | cube <cube@NetBSD.org> | 2008-03-18 20:46:35 +0000 |
| commit | 7aa6248cdfde8d80960cbcd5742d38e5423761de (patch) | |
| tree | 2eb35c7a40d288793365d11d66727bc210920b60 | |
| parent | 0db6a6b0230a7ce748cf08924d67ae6b109f4b0f (diff) | |
Split device_t and softc for ATA devices, as well as wd(4). Other
cosmetic changes where appropriate.
69 files changed, 1572 insertions, 1532 deletions
diff --git a/sys/arch/acorn32/eb7500atx/rside.c b/sys/arch/acorn32/eb7500atx/rside.c index 59398fe8fc9..35f36bc7139 100644 --- a/sys/arch/acorn32/eb7500atx/rside.c +++ b/sys/arch/acorn32/eb7500atx/rside.c @@ -1,4 +1,4 @@ -/* $NetBSD: rside.c,v 1.8 2006/01/16 20:30:18 bouyer Exp $ */ +/* $NetBSD: rside.c,v 1.9 2008/03/18 20:46:35 cube Exp $ */ /* * Copyright (c) 2004 Christopher Gilbert @@ -56,7 +56,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rside.c,v 1.8 2006/01/16 20:30:18 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rside.c,v 1.9 2008/03/18 20:46:35 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -121,10 +121,10 @@ struct rside_softc { struct wdc_regs sc_wdc_regs[2]; }; -static int rside_probe (struct device *, struct cfdata *, void *); -static void rside_attach (struct device *, struct device *, void *); +static int rside_probe (device_t, cfdata_t, void *); +static void rside_attach (device_t, device_t, void *); -CFATTACH_DECL(rside, sizeof(struct rside_softc), +CFATTACH_DECL_NEW(rside, sizeof(struct rside_softc), rside_probe, rside_attach, NULL, NULL); /* @@ -147,7 +147,7 @@ const struct { */ static int -rside_probe(struct device *parent, struct cfdata *cf, void *aux) +rside_probe(device_t parent, cfdata_t cf, void *aux) { /* if we're including this, then for now assume it exists */ return 1; @@ -159,16 +159,16 @@ rside_probe(struct device *parent, struct cfdata *cf, void *aux) */ static void -rside_attach(struct device *parent, struct device *self, void *aux) +rside_attach(device_t parent, device_t self, void *aux) { - struct rside_softc *sc = (void *)self; + struct rside_softc *sc = device_private(self); struct rsbus_attach_args *rs = aux; int channel, i; struct rside_channel *scp; struct ata_channel *cp; struct wdc_regs *wdr; - printf("\n"); + aprint_normal("\n"); /* * we need our own bus tag as the register spacing @@ -180,6 +180,7 @@ rside_attach(struct device *parent, struct device *self, void *aux) * cookie. */ + sc->sc_wdcdev.dev = self; sc->sc_wdcdev.regs = sc->sc_wdc_regs; sc->sc_tag = *rs->sa_iot; sc->sc_tag.bs_cookie = (void *) DRIVE_REGISTER_SPACING_SHIFT; @@ -233,7 +234,8 @@ rside_attach(struct device *parent, struct device *self, void *aux) if ((scp->rc_ih = intr_claim((channel == 0 ? IRQ_NEVENT1 : IRQ_NEVENT2), IPL_BIO, "rside", wdcintr, cp)) == NULL) panic("%s: Cannot claim interrupt %d\n", - self->dv_xname, (channel == 0 ? IRQ_NEVENT1 : IRQ_NEVENT2)); + device_xname(self), + (channel == 0 ? IRQ_NEVENT1 : IRQ_NEVENT2)); wdcattach(cp); } diff --git a/sys/arch/acorn32/mainbus/wdc_pioc.c b/sys/arch/acorn32/mainbus/wdc_pioc.c index a931d2f9f8c..39b04f1dbf3 100644 --- a/sys/arch/acorn32/mainbus/wdc_pioc.c +++ b/sys/arch/acorn32/mainbus/wdc_pioc.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_pioc.c,v 1.21 2006/01/16 20:30:18 bouyer Exp $ */ +/* $NetBSD: wdc_pioc.c,v 1.22 2008/03/18 20:46:35 cube Exp $ */ /* * Copyright (c) 1997-1998 Mark Brinicombe. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_pioc.c,v 1.21 2006/01/16 20:30:18 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_pioc.c,v 1.22 2008/03/18 20:46:35 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -66,11 +66,11 @@ struct wdc_pioc_softc { }; /* prototypes for functions */ -static int wdc_pioc_probe __P((struct device *, struct cfdata *, void *)); -static void wdc_pioc_attach __P((struct device *, struct device *, void *)); +static int wdc_pioc_probe (device_t, cfdata_t, void *); +static void wdc_pioc_attach (device_t, device_t, void *); /* device attach structure */ -CFATTACH_DECL(wdc_pioc, sizeof(struct wdc_pioc_softc), +CFATTACH_DECL_NEW(wdc_pioc, sizeof(struct wdc_pioc_softc), wdc_pioc_probe, wdc_pioc_attach, NULL, NULL); /* @@ -81,10 +81,7 @@ CFATTACH_DECL(wdc_pioc, sizeof(struct wdc_pioc_softc), */ static int -wdc_pioc_probe(parent, cf, aux) - struct device *parent; - struct cfdata *cf; - void *aux; +wdc_pioc_probe(device_t parent, cfdata_t cf, void *aux) { struct pioc_attach_args *pa = aux; struct ata_channel ch; @@ -146,17 +143,15 @@ wdc_pioc_probe(parent, cf, aux) */ static void -wdc_pioc_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +wdc_pioc_attach(device_t parent, device_t self, void *aux) { - struct wdc_pioc_softc *sc = (void *)self; + struct wdc_pioc_softc *sc = device_private(self); struct wdc_regs *wdr; struct pioc_attach_args *pa = aux; u_int iobase; int i; - printf("\n"); + aprint_normal("\n"); sc->sc_wdcdev.regs = wdr = &sc->sc_wdc_regs; iobase = pa->pa_iobase + pa->pa_offset; @@ -164,24 +159,25 @@ wdc_pioc_attach(parent, self, aux) wdr->ctl_iot = pa->pa_iot; if (bus_space_map(wdr->cmd_iot, iobase, WDC_PIOC_REG_NPORTS, 0, &wdr->cmd_baseioh)) - panic("%s: couldn't map drive registers", self->dv_xname); + panic("%s: couldn't map drive registers", device_xname(self)); for (i = 0; i < WDC_PIOC_REG_NPORTS; i++) { if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i, i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) panic("%s: couldn't submap drive registers", - self->dv_xname); + device_xname(self)); } if (bus_space_map(wdr->ctl_iot, iobase + WDC_PIOC_AUXREG_OFFSET, WDC_PIOC_AUXREG_NPORTS, 0, &wdr->ctl_ioh)) - panic("%s: couldn't map aux registers", self->dv_xname); + panic("%s: couldn't map aux registers", device_xname(self)); sc->sc_ih = intr_claim(pa->pa_irq, IPL_BIO, "wdc", wdcintr, &sc->sc_channel); if (!sc->sc_ih) - panic("%s: Cannot claim IRQ %d", self->dv_xname, pa->pa_irq); + panic("%s: Cannot claim IRQ %d", device_xname(self), + pa->pa_irq); sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA16; sc->sc_wdcdev.sc_atac.atac_pio_cap = 0; sc->sc_chanlist[0] = &sc->sc_channel; diff --git a/sys/arch/acorn32/podulebus/icside.c b/sys/arch/acorn32/podulebus/icside.c index 2e47fcf95b0..79ccdefeb37 100644 --- a/sys/arch/acorn32/podulebus/icside.c +++ b/sys/arch/acorn32/podulebus/icside.c @@ -1,4 +1,4 @@ -/* $NetBSD: icside.c,v 1.26 2006/10/09 21:12:44 bjh21 Exp $ */ +/* $NetBSD: icside.c,v 1.27 2008/03/18 20:46:35 cube Exp $ */ /* * Copyright (c) 1997-1998 Mark Brinicombe @@ -42,7 +42,7 @@ #include <sys/param.h> -__KERNEL_RCSID(0, "$NetBSD: icside.c,v 1.26 2006/10/09 21:12:44 bjh21 Exp $"); +__KERNEL_RCSID(0, "$NetBSD: icside.c,v 1.27 2008/03/18 20:46:35 cube Exp $"); #include <sys/systm.h> #include <sys/conf.h> @@ -97,12 +97,12 @@ struct icside_softc { struct wdc_regs sc_wdc_regs[ICSIDE_MAX_CHANNELS]; }; -int icside_probe(struct device *, struct cfdata *, void *); -void icside_attach(struct device *, struct device *, void *); +int icside_probe(device_t, cfdata_t, void *); +void icside_attach(device_t, device_t, void *); int icside_intr(void *); void icside_v6_shutdown(void *); -CFATTACH_DECL(icside, sizeof(struct icside_softc), +CFATTACH_DECL_NEW(icside, sizeof(struct icside_softc), icside_probe, icside_attach, NULL, NULL); /* @@ -155,7 +155,7 @@ struct ide_version { */ int -icside_probe(struct device *parent, struct cfdata *cf, void *aux) +icside_probe(device_t parent, cfdata_t cf, void *aux) { struct podule_attach_args *pa = (void *)aux; @@ -169,9 +169,9 @@ icside_probe(struct device *parent, struct cfdata *cf, void *aux) */ void -icside_attach(struct device *parent, struct device *self, void *aux) +icside_attach(device_t parent, device_t self, void *aux) { - struct icside_softc *sc = (void *)self; + struct icside_softc *sc = device_private(self); struct podule_attach_args *pa = (void *)aux; bus_space_tag_t iot; bus_space_handle_t ioh; @@ -189,6 +189,7 @@ icside_attach(struct device *parent, struct device *self, void *aux) if (pa->pa_podule_number == -1) panic("Podule has disappeared !"); + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_podule_number = pa->pa_podule_number; sc->sc_podule = pa->pa_podule; podules[sc->sc_podule_number].attached = 1; @@ -199,7 +200,7 @@ icside_attach(struct device *parent, struct device *self, void *aux) iot = pa->pa_iot; if (bus_space_map(iot, pa->pa_podule->fast_base + ID_REGISTER_OFFSET, ID_REGISTER_SPACE, 0, &ioh)) { - printf("%s: cannot map ID register\n", self->dv_xname); + aprint_error_dev(self, "cannot map ID register\n"); return; } @@ -217,17 +218,17 @@ icside_attach(struct device *parent, struct device *self, void *aux) /* Report the version and name */ if (ide == NULL || ide->name == NULL) { - printf(": rev %d is unsupported\n", id); + aprint_error(": rev %d is unsupported\n", id); return; } else - printf(": %s\n", ide->name); + aprint_normal(": %s\n", ide->name); if (ide->latchreg != -1) { sc->sc_latchiot = pa->pa_iot; if (bus_space_map(iot, pa->pa_podule->fast_base + ide->latchreg, 1, 0, &sc->sc_latchioh)) { - printf("%s: cannot map latch register\n", - self->dv_xname); + aprint_error_dev(self, + "cannot map latch register\n"); return; } sc->sc_shutdownhook = @@ -304,8 +305,7 @@ icside_attach(struct device *parent, struct device *self, void *aux) icp->ic_ih = podulebus_irq_establish(pa->pa_ih, IPL_BIO, icside_intr, icp, &icp->ic_intrcnt); if (icp->ic_ih == NULL) { - printf("%s: Cannot claim interrupt %d\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error_dev(self, "Cannot claim interrupt %d\n", pa->pa_podule->interrupt); continue; } diff --git a/sys/arch/acorn32/podulebus/rapide.c b/sys/arch/acorn32/podulebus/rapide.c index f23ac99be67..f1727aef844 100644 --- a/sys/arch/acorn32/podulebus/rapide.c +++ b/sys/arch/acorn32/podulebus/rapide.c @@ -1,4 +1,4 @@ -/* $NetBSD: rapide.c,v 1.25 2006/10/09 21:12:44 bjh21 Exp $ */ +/* $NetBSD: rapide.c,v 1.26 2008/03/18 20:46:35 cube Exp $ */ /* * Copyright (c) 1997-1998 Mark Brinicombe @@ -68,7 +68,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rapide.c,v 1.25 2006/10/09 21:12:44 bjh21 Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rapide.c,v 1.26 2008/03/18 20:46:35 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -126,12 +126,12 @@ struct rapide_softc { struct wdc_regs sc_wdc_regs[2]; }; -int rapide_probe __P((struct device *, struct cfdata *, void *)); -void rapide_attach __P((struct device *, struct device *, void *)); -void rapide_shutdown __P((void *arg)); -int rapide_intr __P((void *)); +int rapide_probe (device_t, struct cfdata *, void *); +void rapide_attach (device_t, device_t, void *); +void rapide_shutdown (void *arg); +int rapide_intr (void *); -CFATTACH_DECL(rapide, sizeof(struct rapide_softc), +CFATTACH_DECL_NEW(rapide, sizeof(struct rapide_softc), rapide_probe, rapide_attach, NULL, NULL); /* @@ -172,10 +172,7 @@ struct { */ int -rapide_probe(parent, cf, aux) - struct device *parent; - struct cfdata *cf; - void *aux; +rapide_probe(device_t parent, cfdata_t cf, void *aux) { struct podule_attach_args *pa = (void *)aux; @@ -190,11 +187,9 @@ rapide_probe(parent, cf, aux) */ void -rapide_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +rapide_attach(device_t parent, device_t self, void *aux) { - struct rapide_softc *sc = (void *)self; + struct rapide_softc *sc = device_private(self); struct podule_attach_args *pa = (void *)aux; bus_space_tag_t iot; bus_space_handle_t ctlioh; @@ -209,6 +204,7 @@ rapide_attach(parent, self, aux) if (pa->pa_podule_number == -1) panic("Podule has disappeared !"); + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_podule_number = pa->pa_podule_number; sc->sc_podule = pa->pa_podule; podules[sc->sc_podule_number].attached = 1; @@ -229,18 +225,18 @@ rapide_attach(parent, self, aux) if (bus_space_map(iot, pa->pa_podule->easi_base + CONTROL_REGISTERS_OFFSET, CONTROL_REGISTER_SPACE, 0, &ctlioh)) - panic("%s: Cannot map control registers", self->dv_xname); + panic("%s: Cannot map control registers", device_xname(self)); sc->sc_ctlioh = ctlioh; sc->sc_version = bus_space_read_1(iot, ctlioh, VERSION_REGISTER_OFFSET) & VERSION_REGISTER_MASK; /* bus_space_unmap(iot, ctl_ioh, CONTROL_REGISTER_SPACE);*/ - printf(": Issue %d\n", sc->sc_version + 1); + aprint_normal(": Issue %d\n", sc->sc_version + 1); if (sc->sc_version != VERSION_2_ID) return; if (shutdownhook_establish(rapide_shutdown, (void *)sc) == NULL) - panic("%s: Cannot install shutdown handler", self->dv_xname); + panic("%s: Cannot install shutdown handler", device_xname(self)); /* Set the interrupt info for this podule */ sc->sc_podule->irq_addr = pa->pa_podule->easi_base @@ -308,7 +304,7 @@ rapide_attach(parent, self, aux) ihp->ih_maskbits = rcp->rc_irqmask; if (irq_claim(sc->sc_podule->interrupt, ihp)) panic("%s: Cannot claim interrupt %d", - self->dv_xname, sc->sc_podule->interrupt); + device_xname(self), sc->sc_podule->interrupt); /* clear any pending interrupts and enable interrupts */ sc->sc_intr_enable_mask |= rcp->rc_irqmask; bus_space_write_1(iot, sc->sc_ctlioh, @@ -326,8 +322,7 @@ rapide_attach(parent, self, aux) */ void -rapide_shutdown(arg) - void *arg; +rapide_shutdown(void *arg) { struct rapide_softc *sc = arg; @@ -343,8 +338,7 @@ rapide_shutdown(arg) */ int -rapide_intr(arg) - void *arg; +rapide_intr(void *arg) { struct rapide_channel *rcp = arg; irqhandler_t *ihp = &rcp->rc_ih; diff --git a/sys/arch/acorn32/podulebus/simide.c b/sys/arch/acorn32/podulebus/simide.c index a907e882bdf..3a0094a8830 100644 --- a/sys/arch/acorn32/podulebus/simide.c +++ b/sys/arch/acorn32/podulebus/simide.c @@ -1,4 +1,4 @@ -/* $NetBSD: simide.c,v 1.24 2006/09/24 23:14:58 bjh21 Exp $ */ +/* $NetBSD: simide.c,v 1.25 2008/03/18 20:46:35 cube Exp $ */ /* * Copyright (c) 1997-1998 Mark Brinicombe @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: simide.c,v 1.24 2006/09/24 23:14:58 bjh21 Exp $"); +__KERNEL_RCSID(0, "$NetBSD: simide.c,v 1.25 2008/03/18 20:46:35 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -96,12 +96,12 @@ struct simide_softc { struct wdc_regs sc_wdc_regs[2]; }; -int simide_probe __P((struct device *, struct cfdata *, void *)); -void simide_attach __P((struct device *, struct device *, void *)); -void simide_shutdown __P((void *arg)); -int simide_intr __P((void *arg)); +int simide_probe (device_t, cfdata_t, void *); +void simide_attach (device_t, device_t, void *); +void simide_shutdown (void *arg); +int simide_intr (void *arg); -CFATTACH_DECL(simide, sizeof(struct simide_softc), +CFATTACH_DECL_NEW(simide, sizeof(struct simide_softc), simide_probe, simide_attach, NULL, NULL); @@ -137,10 +137,7 @@ struct { */ int -simide_probe(parent, cf, aux) - struct device *parent; - struct cfdata *cf; - void *aux; +simide_probe(device_t parent, cfdata_t cf, void *aux) { struct podule_attach_args *pa = (void *)aux; @@ -155,11 +152,9 @@ simide_probe(parent, cf, aux) */ void -simide_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +simide_attach(device_t parent, device_t self, void *aux) { - struct simide_softc *sc = (void *)self; + struct simide_softc *sc = device_private(self); struct podule_attach_args *pa = (void *)aux; int status; u_int iobase; @@ -173,6 +168,7 @@ simide_attach(parent, self, aux) if (pa->pa_podule_number == -1) panic("Podule has disappeared !"); + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_podule_number = pa->pa_podule_number; sc->sc_podule = pa->pa_podule; podules[sc->sc_podule_number].attached = 1; @@ -203,11 +199,12 @@ simide_attach(parent, self, aux) if (bus_space_map(sc->sc_ctliot, pa->pa_podule->mod_base + CONTROL_REGISTERS_POFFSET, CONTROL_REGISTER_SPACE, 0, &sc->sc_ctlioh)) - panic("%s: Cannot map control registers", self->dv_xname); + panic("%s: Cannot map control registers", device_xname(self)); /* Install a clean up handler to make sure IRQ's are disabled */ if (shutdownhook_establish(simide_shutdown, (void *)sc) == NULL) - panic("%s: Cannot install shutdown handler", self->dv_xname); + panic("%s: Cannot install shutdown handler", + device_xname(self)); /* Set the interrupt info for this podule */ sc->sc_podule->irq_addr = pa->pa_podule->mod_base @@ -219,21 +216,21 @@ simide_attach(parent, self, aux) status = bus_space_read_1(sc->sc_ctliot, sc->sc_ctlioh, STATUS_REGISTER_OFFSET); - printf(":"); + aprint_normal(":"); /* If any of the bits in STATUS_FAULT are zero then we have a fault. */ if ((status & STATUS_FAULT) != STATUS_FAULT) - printf(" card/cable fault (%02x) -", status); + aprint_normal(" card/cable fault (%02x) -", status); if (!(status & STATUS_RESET)) - printf(" (reset)"); + aprint_normal(" (reset)"); if (!(status & STATUS_ADDR_TEST)) - printf(" (addr)"); + aprint_normal(" (addr)"); if (!(status & STATUS_CS_TEST)) - printf(" (cs)"); + aprint_normal(" (cs)"); if (!(status & STATUS_RW_TEST)) - printf(" (rw)"); + aprint_normal(" (rw)"); - printf("\n"); + aprint_normal("\n"); /* Perhaps we should just abort at this point. */ /* if ((status & STATUS_FAULT) != STATUS_FAULT) @@ -297,7 +294,7 @@ simide_attach(parent, self, aux) ihp->ih_maskbits = scp->sc_irqmask; if (irq_claim(sc->sc_podule->interrupt, ihp)) panic("%s: Cannot claim interrupt %d", - self->dv_xname, sc->sc_podule->interrupt); + device_xname(self), sc->sc_podule->interrupt); /* clear any pending interrupts and enable interrupts */ sc->sc_ctl_reg |= scp->sc_irqmask; bus_space_write_1(sc->sc_ctliot, sc->sc_ctlioh, @@ -314,8 +311,7 @@ simide_attach(parent, self, aux) */ void -simide_shutdown(arg) - void *arg; +simide_shutdown(void *arg) { struct simide_softc *sc = arg; @@ -332,8 +328,7 @@ simide_shutdown(arg) * If the interrupt was from our card pass it on to the wdc interrupt handler */ int -simide_intr(arg) - void *arg; +simide_intr(void *arg) { struct simide_channel *scp = arg; irqhandler_t *ihp = &scp->sc_ih; diff --git a/sys/arch/algor/algor/algor_p5064_intr.c b/sys/arch/algor/algor/algor_p5064_intr.c index 010aec535d0..46813efeeef 100644 --- a/sys/arch/algor/algor/algor_p5064_intr.c +++ b/sys/arch/algor/algor/algor_p5064_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: algor_p5064_intr.c,v 1.20 2008/01/10 14:57:34 tsutsui Exp $ */ +/* $NetBSD: algor_p5064_intr.c,v 1.21 2008/03/18 20:46:35 cube Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: algor_p5064_intr.c,v 1.20 2008/01/10 14:57:34 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: algor_p5064_intr.c,v 1.21 2008/03/18 20:46:35 cube Exp $"); #include "opt_ddb.h" @@ -302,7 +302,7 @@ const struct evcnt *algor_p5064_pci_intr_evcnt(void *, pci_intr_handle_t); void *algor_p5064_pci_intr_establish(void *, pci_intr_handle_t, int, int (*)(void *), void *); void algor_p5064_pci_intr_disestablish(void *, void *); -void *algor_p5064_pciide_compat_intr_establish(void *, struct device *, +void *algor_p5064_pciide_compat_intr_establish(void *, device_t, struct pci_attach_args *, int, int (*)(void *), void *); void algor_p5064_pci_conf_interrupt(void *, int, int, int, int, int *); @@ -679,7 +679,7 @@ algor_p5064_pci_conf_interrupt(void *v, int bus, int dev, int pin, int swiz, } void * -algor_p5064_pciide_compat_intr_establish(void *v, struct device *dev, +algor_p5064_pciide_compat_intr_establish(void *v, device_t dev, struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg) { pci_chipset_tag_t pc = pa->pa_pc; @@ -697,9 +697,8 @@ algor_p5064_pciide_compat_intr_establish(void *v, struct device *dev, cookie = algor_p5064_intr_establish(P5064_IRQ_IDE0 + chan, func, arg); if (cookie == NULL) return (NULL); - printf("%s: %s channel interrupting at on-board %s IRQ\n", - dev->dv_xname, PCIIDE_CHANNEL_NAME(chan), - p5064_intrnames[P5064_IRQ_IDE0 + chan]); + aprint_normal_dev(dev, "%s channel interrupting at on-board %s IRQ\n", + PCIIDE_CHANNEL_NAME(chan), p5064_intrnames[P5064_IRQ_IDE0 + chan]); return (cookie); } diff --git a/sys/arch/algor/pci/pciide_machdep.c b/sys/arch/algor/pci/pciide_machdep.c index 3939f3b2472..f26df88d53e 100644 --- a/sys/arch/algor/pci/pciide_machdep.c +++ b/sys/arch/algor/pci/pciide_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: pciide_machdep.c,v 1.2 2001/06/22 01:42:20 thorpej Exp $ */ +/* $NetBSD: pciide_machdep.c,v 1.3 2008/03/18 20:46:35 cube Exp $ */ /* * Copyright (c) 1998 Christopher G. Demetriou. All rights reserved. @@ -42,7 +42,7 @@ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.2 2001/06/22 01:42:20 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.3 2008/03/18 20:46:35 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -56,7 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.2 2001/06/22 01:42:20 thorpej E #include <dev/isa/isavar.h> void * -pciide_machdep_compat_intr_establish(struct device *dev, +pciide_machdep_compat_intr_establish(device_t dev, struct pci_attach_args *pa, int chan, int (*func)(void *), void *arg) { pci_chipset_tag_t pc = pa->pa_pc; diff --git a/sys/arch/amiga/dev/wdc_amiga.c b/sys/arch/amiga/dev/wdc_amiga.c index 8770ed29453..baabef68703 100644 --- a/sys/arch/amiga/dev/wdc_amiga.c +++ b/sys/arch/amiga/dev/wdc_amiga.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_amiga.c,v 1.29 2006/03/27 19:35:33 aymeric Exp $ */ +/* $NetBSD: wdc_amiga.c,v 1.30 2008/03/18 20:46:35 cube Exp $ */ /*- * Copyright (c) 2000, 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_amiga.c,v 1.29 2006/03/27 19:35:33 aymeric Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_amiga.c,v 1.30 2008/03/18 20:46:35 cube Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -72,15 +72,15 @@ struct wdc_amiga_softc { char sc_a1200; }; -int wdc_amiga_probe(struct device *, struct cfdata *, void *); -void wdc_amiga_attach(struct device *, struct device *, void *); +int wdc_amiga_probe(device_t, cfdata_t, void *); +void wdc_amiga_attach(device_t, device_t, void *); int wdc_amiga_intr(void *); -CFATTACH_DECL(wdc_amiga, sizeof(struct wdc_amiga_softc), +CFATTACH_DECL_NEW(wdc_amiga, sizeof(struct wdc_amiga_softc), wdc_amiga_probe, wdc_amiga_attach, NULL, NULL); int -wdc_amiga_probe(struct device *parent, struct cfdata *cfp, void *aux) +wdc_amiga_probe(device_t parent, cfdata_t cfp, void *aux) { if ((!is_a4000() && !is_a1200()) || !matchname(aux, "wdc")) return(0); @@ -88,14 +88,15 @@ wdc_amiga_probe(struct device *parent, struct cfdata *cfp, void *aux) } void -wdc_amiga_attach(struct device *parent, struct device *self, void *aux) +wdc_amiga_attach(device_t parent, device_t self, void *aux) { - struct wdc_amiga_softc *sc = (void *)self; + struct wdc_amiga_softc *sc = device_private(self); struct wdc_regs *wdr; int i; - printf("\n"); + aprint_normal("\n"); + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_wdcdev.regs = wdr = &sc->sc_wdc_regs; if (is_a4000()) { @@ -114,8 +115,7 @@ wdc_amiga_attach(struct device *parent, struct device *self, void *aux) if (bus_space_map(wdr->cmd_iot, 0, 0x40, 0, &wdr->cmd_baseioh)) { - printf("%s: couldn't map registers\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(self, "couldn't map registers\n"); return; } @@ -126,8 +126,7 @@ wdc_amiga_attach(struct device *parent, struct device *self, void *aux) bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh, 0x40); - printf("%s: couldn't map registers\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(self, "couldn't map registers\n"); return; } } diff --git a/sys/arch/amiga/dev/wdc_buddha.c b/sys/arch/amiga/dev/wdc_buddha.c index 7636bd797c8..52155092272 100644 --- a/sys/arch/amiga/dev/wdc_buddha.c +++ b/sys/arch/amiga/dev/wdc_buddha.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_buddha.c,v 1.2 2007/08/21 06:51:09 is Exp $ */ +/* $NetBSD: wdc_buddha.c,v 1.3 2008/03/18 20:46:35 cube Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -66,15 +66,15 @@ struct wdc_buddha_softc { volatile char *ba; }; -int wdc_buddha_probe(struct device *, struct cfdata *, void *); -void wdc_buddha_attach(struct device *, struct device *, void *); +int wdc_buddha_probe(device_t, cfdata_t, void *); +void wdc_buddha_attach(device_t, device_t, void *); int wdc_buddha_intr(void *); -CFATTACH_DECL(wdc_buddha, sizeof(struct wdc_buddha_softc), +CFATTACH_DECL_NEW(wdc_buddha, sizeof(struct wdc_buddha_softc), wdc_buddha_probe, wdc_buddha_attach, NULL, NULL); int -wdc_buddha_probe(struct device *parent, struct cfdata *cfp, void *aux) +wdc_buddha_probe(device_t parent, cfdata_t cfp, void *aux) { struct zbus_args *zap; @@ -91,14 +91,15 @@ wdc_buddha_probe(struct device *parent, struct cfdata *cfp, void *aux) } void -wdc_buddha_attach(struct device *parent, struct device *self, void *aux) +wdc_buddha_attach(device_t parent, device_t self, void *aux) { struct wdc_buddha_softc *sc; struct zbus_args *zap; int nchannels; int ch; - sc = (void *)self; + sc = device_private(self); + sc->sc_wdcdev.sc_atac.atac_dev = self; zap = aux; sc->ba = zap->va; @@ -108,12 +109,12 @@ wdc_buddha_attach(struct device *parent, struct device *self, void *aux) nchannels = 2; if (zap->prodid == 42) { - printf(": Catweasel Z2\n"); + aprint_normal(": Catweasel Z2\n"); nchannels = 3; } else if (zap->serno == 0) - printf(": Buddha\n"); + aprint_normal(": Buddha\n"); else - printf(": Buddha Flash\n"); + aprint_normal(": Buddha Flash\n"); /* XXX pio mode setting not implemented yet. */ sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16; @@ -136,8 +137,8 @@ wdc_buddha_attach(struct device *parent, struct device *self, void *aux) cp->ch_queue = malloc(sizeof(struct ata_queue), M_DEVBUF, M_NOWAIT); if (cp->ch_queue == NULL) { - printf("%s: can't allocate memory for command queue\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(self, + "can't allocate memory for command queue\n"); return; } cp->ch_ndrive = 2; @@ -159,8 +160,7 @@ wdc_buddha_attach(struct device *parent, struct device *self, void *aux) wdr->cmd_iot = &sc->sc_iot; if (bus_space_map(wdr->cmd_iot, 0x210+ch*0x80, 8, 0, &wdr->cmd_baseioh)) { - printf("%s: couldn't map cmd registers\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(self, "couldn't map cmd registers\n"); return; } @@ -168,16 +168,15 @@ wdc_buddha_attach(struct device *parent, struct device *self, void *aux) if (bus_space_map(wdr->ctl_iot, 0x250+ch*0x80, 2, 0, &wdr->ctl_ioh)) { bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh, 8); - printf("%s: couldn't map ctl registers\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(self, "couldn't map ctl registers\n"); return; } for (i = 0; i < WDC_NREG; i++) { if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i, i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) { - printf("%s: couldn't subregion cmd regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(self, + "couldn't subregion cmd regs\n"); return; } } diff --git a/sys/arch/atari/dev/wdc_mb.c b/sys/arch/atari/dev/wdc_mb.c index 4f0166222c9..09430a59925 100644 --- a/sys/arch/atari/dev/wdc_mb.c +++ b/sys/arch/atari/dev/wdc_mb.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_mb.c,v 1.30 2007/12/04 16:36:54 tsutsui Exp $ */ +/* $NetBSD: wdc_mb.c,v 1.31 2008/03/18 20:46:35 cube Exp $ */ /*- * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_mb.c,v 1.30 2007/12/04 16:36:54 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_mb.c,v 1.31 2008/03/18 20:46:35 cube Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -68,12 +68,12 @@ __KERNEL_RCSID(0, "$NetBSD: wdc_mb.c,v 1.30 2007/12/04 16:36:54 tsutsui Exp $"); /* * XXX This code currently doesn't even try to allow 32-bit data port use. */ -static int claim_hw __P((struct ata_channel *, int)); -static void free_hw __P((struct ata_channel *)); -static void read_multi_2_swap __P((bus_space_tag_t, bus_space_handle_t, - bus_size_t, u_int16_t *, bus_size_t)); -static void write_multi_2_swap __P((bus_space_tag_t, bus_space_handle_t, - bus_size_t, const u_int16_t *, bus_size_t)); +static int claim_hw (struct ata_channel *, int); +static void free_hw (struct ata_channel *); +static void read_multi_2_swap (bus_space_tag_t, bus_space_handle_t, + bus_size_t, u_int16_t *, bus_size_t); +static void write_multi_2_swap (bus_space_tag_t, bus_space_handle_t, + bus_size_t, const u_int16_t *, bus_size_t); struct wdc_mb_softc { struct wdc_softc sc_wdcdev; @@ -84,17 +84,14 @@ struct wdc_mb_softc { void *sc_ih; }; -int wdc_mb_probe __P((struct device *, struct cfdata *, void *)); -void wdc_mb_attach __P((struct device *, struct device *, void *)); +int wdc_mb_probe (device_t, struct cfdata *, void *); +void wdc_mb_attach (device_t, device_t, void *); -CFATTACH_DECL(wdc_mb, sizeof(struct wdc_mb_softc), +CFATTACH_DECL_NEW(wdc_mb, sizeof(struct wdc_mb_softc), wdc_mb_probe, wdc_mb_attach, NULL, NULL); int -wdc_mb_probe(parent, cfp, aux) - struct device *parent; - struct cfdata *cfp; - void *aux; +wdc_mb_probe(device_t parent, cfdata_t cfp, void *aux) { static int wdc_matched = 0; struct ata_channel ch; @@ -160,16 +157,15 @@ wdc_mb_probe(parent, cfp, aux) } void -wdc_mb_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +wdc_mb_attach(device_t parent, device_t self, void *aux) { - struct wdc_mb_softc *sc = (void *)self; + struct wdc_mb_softc *sc = device_private(self); struct wdc_regs *wdr; int i; - printf("\n"); + aprint_normal("\n"); + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_wdcdev.regs = wdr = &sc->sc_wdc_regs; wdr->cmd_iot = wdr->ctl_iot = mb_alloc_bus_space_tag(); @@ -179,15 +175,14 @@ wdc_mb_attach(parent, self, aux) wdr->cmd_iot->abs_wms_2 = write_multi_2_swap; if (bus_space_map(wdr->cmd_iot, FALCON_WD_BASE, FALCON_WD_LEN, 0, &wdr->cmd_baseioh)) { - printf("%s: couldn't map registers\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(self, "couldn't map registers\n"); return; } for (i = 0; i < WDC_NREG; i++) { if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i * 4, 4, &wdr->cmd_iohs[i]) != 0) { - printf("%s: couldn't subregion cmd reg %i\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, i); + aprint_error_dev(self, + "couldn't subregion cmd reg %i\n", i); bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh, FALCON_WD_LEN); return; @@ -197,8 +192,7 @@ wdc_mb_attach(parent, self, aux) if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, FALCON_WD_AUX, 4, &wdr->ctl_ioh)) { bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh, FALCON_WD_LEN); - printf("%s: couldn't subregion aux reg\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(self, "couldn't subregion aux reg\n"); return; } diff --git a/sys/arch/evbarm/iq31244/wdc_obio.c b/sys/arch/evbarm/iq31244/wdc_obio.c index bc9f2666492..a1594758ca9 100644 --- a/sys/arch/evbarm/iq31244/wdc_obio.c +++ b/sys/arch/evbarm/iq31244/wdc_obio.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_obio.c,v 1.3 2006/01/16 20:30:19 bouyer Exp $ */ +/* $NetBSD: wdc_obio.c,v 1.4 2008/03/18 20:46:35 cube Exp $ */ /*- * Copyright (c) 1998, 2003, 2005 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.3 2006/01/16 20:30:19 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.4 2008/03/18 20:46:35 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -66,46 +66,47 @@ struct wdc_obio_softc { void *sc_ih; }; -static int wdc_obio_probe(struct device *, struct cfdata *, void *); -static void wdc_obio_attach(struct device *, struct device *, void *); +static int wdc_obio_probe(device_t, cfdata_t, void *); +static void wdc_obio_attach(device_t, device_t, void *); -CFATTACH_DECL(wdc_obio, sizeof(struct wdc_obio_softc), +CFATTACH_DECL_NEW(wdc_obio, sizeof(struct wdc_obio_softc), wdc_obio_probe, wdc_obio_attach, NULL, NULL); static int -wdc_obio_probe(struct device *parent, struct cfdata *match, void *aux) +wdc_obio_probe(device_t parent, cfdata_t match, void *aux) { return 1; } static void -wdc_obio_attach(struct device *parent, struct device *self, void *aux) +wdc_obio_attach(device_t parent, device_t self, void *aux) { - struct wdc_obio_softc *sc = (void *)self; + struct wdc_obio_softc *sc = device_private(self); struct wdc_regs *wdr; struct obio_attach_args *oba = aux; int i; + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_wdcdev.regs = wdr = &sc->wdc_regs; wdr->cmd_iot = oba->oba_st; wdr->ctl_iot = oba->oba_st; if (bus_space_map(wdr->cmd_iot, oba->oba_addr, IQ31244_CFLASH_SIZE, 0, &wdr->cmd_baseioh)) { - printf(": couldn't map registers\n"); + aprint_error(": couldn't map registers\n"); return; } for (i = 0; i < 8; i++) { if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, IQ31244_CFLASH_CMD_BASE + i, 1, &wdr->cmd_iohs[i]) != 0) { - printf(": couldn't subregion registers\n"); + aprint_error(": couldn't subregion registers\n"); return; } } if (bus_space_subregion(wdr->ctl_iot, wdr->cmd_baseioh, IQ31244_CFLASH_CTL_BASE, 1, &wdr->ctl_ioh) != 0) { - printf(": couldn't subregion registers\n"); + aprint_error(": couldn't subregion registers\n"); return; } @@ -121,7 +122,7 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux) sc->ata_channel.ch_ndrive = 2; wdc_init_shadow_regs(&sc->ata_channel); - printf("\n"); + aprint_normal("\n"); /* * The interrupt line is controlled by a jumper. We can't detect @@ -134,8 +135,7 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux) wdcintr, &sc->ata_channel); else { sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_NOIRQ; - printf("%s: Using polled I/O\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_normal_dev(self, "Using polled I/O\n"); } wdcattach(&sc->ata_channel); diff --git a/sys/arch/evbarm/tsarm/wdc_ts.c b/sys/arch/evbarm/tsarm/wdc_ts.c index e235b862fb5..2323c68c3a7 100644 --- a/sys/arch/evbarm/tsarm/wdc_ts.c +++ b/sys/arch/evbarm/tsarm/wdc_ts.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_ts.c,v 1.3 2006/01/16 20:30:19 bouyer Exp $ */ +/* $NetBSD: wdc_ts.c,v 1.4 2008/03/18 20:46:35 cube Exp $ */ /*- * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_ts.c,v 1.3 2006/01/16 20:30:19 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_ts.c,v 1.4 2008/03/18 20:46:35 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -63,46 +63,47 @@ struct wdc_ts_softc { void *sc_ih; }; -static int wdc_ts_probe(struct device *, struct cfdata *, void *); -static void wdc_ts_attach(struct device *, struct device *, void *); +static int wdc_ts_probe(device_t, cfdata_t, void *); +static void wdc_ts_attach(device_t, device_t, void *); -CFATTACH_DECL(wdc_ts, sizeof(struct wdc_ts_softc), +CFATTACH_DECL_NEW(wdc_ts, sizeof(struct wdc_ts_softc), wdc_ts_probe, wdc_ts_attach, NULL, NULL); static int -wdc_ts_probe(struct device *parent, struct cfdata *match, void *aux) +wdc_ts_probe(device_t parent, cfdata_t match, void *aux) { return 1; } static void -wdc_ts_attach(struct device *parent, struct device *self, void *aux) +wdc_ts_attach(device_t parent, device_t self, void *aux) { - struct wdc_ts_softc *sc = (void *)self; + struct wdc_ts_softc *sc = device_private(self); struct wdc_regs *wdr; struct tspld_attach_args *ta = aux; int i; + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_wdcdev.regs = wdr = &sc->wdc_regs; wdr->cmd_iot = ta->ta_iot; wdr->ctl_iot = ta->ta_iot; if (bus_space_map(wdr->cmd_iot, 0x11000000, 8, 0, &wdr->cmd_baseioh) || bus_space_map(wdr->ctl_iot, 0x10400006, 1, 0, &wdr->ctl_ioh)) { - printf(": couldn't map registers\n"); + aprint_error(": couldn't map registers\n"); return; } for (i = 0; i < 8; i++) { if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i, 1, &wdr->cmd_iohs[i]) != 0) { - printf(": couldn't subregion registers\n"); + aprint_error(": couldn't subregion registers\n"); return; } } if (bus_space_map(wdr->cmd_iot, 0x21000000, 2, 0, &wdr->cmd_iohs[0])) { - printf(": couldn't map registers\n"); + aprint_error(": couldn't map registers\n"); return; } @@ -119,7 +120,7 @@ wdc_ts_attach(struct device *parent, struct device *self, void *aux) sc->ata_channel.ch_ndrive = 2; wdc_init_shadow_regs(&sc->ata_channel); - printf("\n"); + aprint_normal("\n"); sc->sc_ih = ep93xx_intr_establish(32, IPL_BIO, wdcintr, &sc->ata_channel); diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index a1e68fea9bc..742a0af8506 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -1,16 +1,11 @@ -# $NetBSD: GENERIC,v 1.882 2008/02/29 14:42:32 jmmv Exp $ +# $NetBSD: GENERIC,v 1.883 2008/03/18 20:46:35 cube Exp $ +# From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp # -# GENERIC machine description file +# ALL machine description file # -# This machine description file is used to generate the default NetBSD -# kernel. The generic kernel does not include all options, subsystems -# and device drivers, but should be useful for most applications. -# -# The machine description file can be customised for your specific -# machine to reduce the kernel size and improve its performance. -# -# For further information on compiling NetBSD kernels, see the config(8) -# man page. +# This machine description includes all devices and options and it is +# used to compile-test the source and does not necessarily produce a +# bootable or useful kernel. # # For further information on hardware support for this architecture, see # the intro(4) man page. For further information about kernel options @@ -22,22 +17,19 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.882 $" +#ident "ALL-$Revision: 1.883 $" -maxusers 64 # estimated number of users - -makeoptions CPUFLAGS="-march=i486 -mtune=pentiumpro" # Assume at least 486, - # tune for more modern +maxusers 32 # estimated number of users # CPU-related options. options VM86 # virtual 8086 emulation options USER_LDT # user-settable LDT; used by WINE # insert delay no-ops in interrupts; recommended on very old machines -#options PIC_DELAY +options PIC_DELAY # Enhanced SpeedStep Technology in the Pentium M options ENHANCED_SPEEDSTEP -#options EST_FREQ_USERWRITE # any user can set frequency +options EST_FREQ_USERWRITE # any user can set frequency # AMD PowerNow! K7 options POWERNOW_K7 @@ -46,41 +38,37 @@ options POWERNOW_K7 options POWERNOW_K8 # VIA PadLock -#options VIA_PADLOCK +options VIA_PADLOCK # Intel(R) On Demand Clock Modulation (aka ODCM) -#options INTEL_ONDEMAND_CLOCKMOD +options INTEL_ONDEMAND_CLOCKMOD + +# XBOX support +options XBOX options MTRR # memory-type range register syscall support # doesn't work with MP just yet.. -#options PERFCTRS # performance-monitoring counters support +options PERFCTRS # performance-monitoring counters support options MULTIBOOT # Multiboot support (see multiboot(8)) # delay between "rebooting ..." message and hardware reset, in milliseconds -#options CPURESET_DELAY=2000 +options CPURESET_DELAY=2000 # This option allows you to force a serial console at the specified # I/O address. see console(4) for details. -#options CONSDEVNAME="\"com\"",CONADDR=0x2f8,CONSPEED=57600 +options CONSDEVNAME="\"com\"",CONADDR=0x2f8,CONSPEED=57600 # you don't want the option below ON iff you are using the # serial console option of the new boot strap code. -#options CONS_OVERRIDE # Always use above! independent of boot info +options CONS_OVERRIDE # Always use above! independent of boot info # The following options override the memory sizes passed in from the boot # block. Use them *only* if the boot block is unable to determine the correct # values. Note that the BIOS may *correctly* report less than 640k of base # memory if the extended BIOS data area is located at the top of base memory # (as is the case on most recent systems). -#options REALBASEMEM=639 # size of base memory (in KB) -#options REALEXTMEM=15360 # size of extended memory (in KB) - -# The following options limit the overall size of physical memory -# and/or the maximum address used by the system. -# Contrary to REALBASEMEM and REALEXTMEM, they still use the BIOS memory map -# and can deal with holes in the memory layout. -#options PHYSMEM_MAX_SIZE=64 # max size of physical memory (in MB) -#options PHYSMEM_MAX_ADDR=2048 # don't use memory above this (in MB) +options REALBASEMEM=639 # size of base memory (in KB) +options REALEXTMEM=15360 # size of extended memory (in KB) # Standard system options @@ -88,51 +76,54 @@ options INSECURE # disable kernel security levels - X needs this options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT options NTP # NTP phase/frequency locked loop -#options NO_TSC_TIME # Don't use TSC microtime, even if available. +options NO_TSC_TIME # Don't use TSC microtime, even if available. # Improves time behavior under VMware. options KTRACE # system call tracing via ktrace(1) options SYSVMSG # System V-like message queues options SYSVSEM # System V-like semaphores +options SEMMNI=10 # number of semaphore identifiers +options SEMMNS=60 # number of semaphores in system +options SEMUME=10 # max number of undo entries per process +options SEMMNU=30 # number of undo structures in system options SYSVSHM # System V-like memory sharing +options SHMMAXPGS=2048 # 2048 pages is the default options P1003_1B_SEMAPHORE # p1003.1b semaphore support options LKM # loadable kernel modules -options MULTIPROCESSOR # SMP -options APM_NO_IDLE # needed for SMP -options MPBIOS # configure CPUs and APICs using MPBIOS +options MODULAR # new modules framework options USERCONF # userconf(4) support -#options PIPE_SOCKETPAIR # smaller, but slower pipe(2) +options PIPE_SOCKETPAIR # smaller, but slower pipe(2) options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel # Beep when it is safe to power down the system (requires sysbeep) -#options BEEP_ONHALT +options BEEP_ONHALT # Some tunable details of the above feature (default values used below) -#options BEEP_ONHALT_COUNT=3 # Times to beep -#options BEEP_ONHALT_PITCH=1500 # Default frequency (in Hz) -#options BEEP_ONHALT_PERIOD=250 # Default duration (in msecs) +options BEEP_ONHALT_COUNT=3 # Times to beep +options BEEP_ONHALT_PITCH=1500 # Default frequency (in Hz) +options BEEP_ONHALT_PERIOD=250 # Default duration (in msecs) # Enable experimental buffer queue strategy for better responsiveness under # high disk I/O load. Likely stable but not yet the default. -#options BUFQ_READPRIO -#options BUFQ_PRIOCSCAN +options BUFQ_READPRIO +options BUFQ_PRIOCSCAN # Diagnostic/debugging support options -#options DIAGNOSTIC # expensive kernel consistency checks -#options DEBUG # expensive debugging checks/support -#options KMEMSTATS # kernel memory statistics (vmstat -m) +options DIAGNOSTIC # expensive kernel consistency checks +options DEBUG # expensive debugging checks/support +options KMEMSTATS # kernel memory statistics (vmstat -m) options DDB # in-kernel debugger -#options DDB_ONPANIC=1 # see also sysctl(8): `ddb.onpanic' +options DDB_ONPANIC=1 # see also sysctl(8): `ddb.onpanic' options DDB_HISTORY_SIZE=512 # enable history editing in DDB -#options DDB_VERBOSE_HELP -#options KGDB # remote debugger -#options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600 -#makeoptions DEBUG="-g" # compile full symbol table -#options SYSCALL_STATS # per syscall counts -#options SYSCALL_TIMES # per syscall times -#options SYSCALL_TIMES_HASCOUNTER # use 'broken' rdtsc (soekris) +options DDB_VERBOSE_HELP +options KGDB # remote debugger +options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600 +makeoptions DEBUG="-g" # compile full symbol table +options SYSCALL_STATS # per syscall counts +options SYSCALL_TIMES # per syscall times +options SYSCALL_TIMES_HASCOUNTER # use 'broken' rdtsc (soekris) # Compatibility options options COMPAT_NOMID # NetBSD 0.8, 386BSD, and BSDI @@ -148,27 +139,22 @@ options COMPAT_20 # NetBSD 2.0 options COMPAT_30 # NetBSD 3.0 options COMPAT_40 # NetBSD 4.0 options COMPAT_43 # 4.3BSD, 386BSD, and BSDI -#options COMPAT_386BSD_MBRPART # recognize old partition ID -#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended. +options COMPAT_386BSD_MBRPART # recognize old partition ID +options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended. options COMPAT_OSSAUDIO # OSS (Voxware) audio driver compatibility options COMPAT_SVR4 # binary compatibility with SVR4 options COMPAT_IBCS2 # binary compatibility with SCO and ISC options COMPAT_LINUX # binary compatibility with Linux options COMPAT_FREEBSD # binary compatibility with FreeBSD -#options COMPAT_MACH # binary compatibility with Mach binaries -#options COMPAT_DARWIN # binary compatibility with Darwin binaries -#options EXEC_MACHO # exec MACH-O binaries -#options COMPAT_NDIS # NDIS network driver -#options COMPAT_PECOFF # kernel support to run Win32 apps +options COMPAT_MACH # binary compatibility with Mach binaries +options COMPAT_DARWIN # binary compatibility with Darwin binaries +options EXEC_MACHO # exec MACH-O binaries +options COMPAT_NDIS # NDIS network driver +options COMPAT_PECOFF # kernel support to run Win32 apps options COMPAT_BSDPTY # /dev/[pt]ty?? ptys. -# Wedge support -options DKWEDGE_AUTODISCOVER # Automatically add dk(4) instances -options DKWEDGE_METHOD_GPT # Supports GPT partitions as wedges -# The following two options can break /etc/fstab, so handle with care -#options DKWEDGE_METHOD_BSDLABEL # Support disklabel entries as wedges -#options DKWEDGE_METHOD_MBR # Support MBR partitions as wedges +options X86EMU # 386 Real Mode emulator # File systems file-system FFS # UFS @@ -189,35 +175,42 @@ file-system UMAPFS # NULLFS + uid and gid remapping file-system UNION # union file system file-system CODA # Coda File System; also needs vcoda (below) file-system SMBFS # experimental - CIFS; also needs nsmb (below) +file-system SYSVBFS # System V boot file system file-system PTYFS # /dev/ptm support file-system TMPFS # Efficient memory file-system -#file-system UDF # experimental - OSTA UDF CD/DVD file-system -#file-system HFS # experimental - Apple HFS+ (read-only) +file-system UDF # experimental - OSTA UDF CD/DVD file-system +file-system PUFFS # experimental - Userspace file system support +file-system HFS # experimental - Apple HFS+ file system +file-system EFS # Silicon Graphics Extent File System +file-system FILECORE # Acorn filecore file system +file-system ADOSFS # AmigaDOS file system # File system options options QUOTA # UFS quotas -#options FFS_EI # FFS Endian Independent support +options FFS_EI # FFS Endian Independent support options SOFTDEP # FFS soft updates support. # Note that UFS_DIRHASH is suspected of causing kernel memory corruption. # It is not recommended for general use. -#options UFS_DIRHASH # UFS Large Directory Hashing - Experimental +options UFS_DIRHASH # UFS Large Directory Hashing - Experimental +options UFS_EXTATTR options NFSSERVER # Network File System server -#options FFS_NO_SNAPSHOT # No FFS snapshot support -#options EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and +options FFS_NO_SNAPSHOT # No FFS snapshot support +options EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and # immutable) behave as system flags. +options VNODE_LOCKDEBUG # Networking options -#options GATEWAY # packet forwarding +options GATEWAY # packet forwarding options INET # IP + ICMP + TCP + UDP options INET6 # IPV6 -#options IPSEC # IP security -#options IPSEC_ESP # IP security (encryption part; define w/IPSEC) -#options IPSEC_NAT_T # IPsec NAT traversal (NAT-T) +options IPSEC # IP security +options IPSEC_ESP # IP security (encryption part; define w/IPSEC) +options IPSEC_NAT_T # IPsec NAT traversal (NAT-T) #options IPSEC_DEBUG # debug for IP security -#options MROUTING # IP multicast routing -#options PIM # Protocol Independent Multicast -#options ISO,TPIP # OSI -#options EON # OSI tunneling over IP +options MROUTING # IP multicast routing +options PIM # Protocol Independent Multicast +options ISO,TPIP # OSI +options EON # OSI tunneling over IP options NETATALK # AppleTalk networking protocols options PPP_BSDCOMP # BSD-Compress compression support for PPP options PPP_DEFLATE # Deflate compression support for PPP @@ -225,21 +218,22 @@ options PPP_FILTER # Active filter support for PPP (requires bpf) options PFIL_HOOKS # pfil(9) packet filter hooks options IPFILTER_LOG # ipmon(8) log support options IPFILTER_LOOKUP # ippool(8) support -#options IPFILTER_DEFAULT_BLOCK # block all packets by default +options IPFILTER_DEFAULT_BLOCK # block all packets by default #options TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG - -#options ALTQ # Manipulate network interfaces' output queues -#options ALTQ_BLUE # Stochastic Fair Blue -#options ALTQ_CBQ # Class-Based Queueing -#options ALTQ_CDNR # Diffserv Traffic Conditioner -#options ALTQ_FIFOQ # First-In First-Out Queue -#options ALTQ_FLOWVALVE # RED/flow-valve (red-penalty-box) -#options ALTQ_HFSC # Hierarchical Fair Service Curve -#options ALTQ_LOCALQ # Local queueing discipline -#options ALTQ_PRIQ # Priority Queueing -#options ALTQ_RED # Random Early Detection -#options ALTQ_RIO # RED with IN/OUT -#options ALTQ_WFQ # Weighted Fair Queueing +options TCP_SIGNATURE # RFC2385 support, used with BGP + +options ALTQ # Manipulate network interfaces' output queues +options ALTQ_BLUE # Stochastic Fair Blue +options ALTQ_CBQ # Class-Based Queueing +options ALTQ_CDNR # Diffserv Traffic Conditioner +options ALTQ_FIFOQ # First-In First-Out Queue +options ALTQ_FLOWVALVE # RED/flow-valve (red-penalty-box) +options ALTQ_HFSC # Hierarchical Fair Service Curve +options ALTQ_LOCALQ # Local queueing discipline +options ALTQ_PRIQ # Priority Queueing +options ALTQ_RED # Random Early Detection +options ALTQ_RIO # RED with IN/OUT +options ALTQ_WFQ # Weighted Fair Queueing # These options enable verbose messages for several subsystems. # Warning, these may compile large string tables into the kernel! @@ -247,11 +241,11 @@ options ACPIVERBOSE # verbose ACPI device autoconfig messages options EISAVERBOSE # verbose EISA device autoconfig messages options MIIVERBOSE # verbose PHY autoconfig messages options PCIVERBOSE # verbose PCI device autoconfig messages -#options PCI_CONFIG_DUMP # verbosely dump PCI config space -#options PCMCIAVERBOSE # verbose PCMCIA configuration messages +options PCI_CONFIG_DUMP # verbosely dump PCI config space +options PCMCIAVERBOSE # verbose PCMCIA configuration messages options SCSIVERBOSE # human readable SCSI error messages options USBVERBOSE # verbose USB device autoconfig messages -#options PNPBIOSVERBOSE # verbose PnP BIOS messages +options PNPBIOSVERBOSE # verbose PnP BIOS messages #options PNPBIOSDEBUG # more fulsome PnP BIOS debugging messages options MCAVERBOSE # verbose MCA device autoconfig messages @@ -261,41 +255,43 @@ options NFS_BOOT_DHCP,NFS_BOOT_BOOTPARAM # wscons options # # builtin terminal emulations -#options WSEMUL_SUN # sun terminal emulation +options WSEMUL_SUN # sun terminal emulation options WSEMUL_VT100 # VT100 / VT220 emulation # customization of console and kernel output - see dev/wscons/wsdisplayvar.h options WSDISPLAY_CUSTOM_OUTPUT # color customization from wsconsctl(8) -#options WS_DEFAULT_FG=WSCOL_WHITE -#options WS_DEFAULT_BG=WSCOL_BLACK -#options WS_DEFAULT_COLATTR="(0)" -#options WS_DEFAULT_MONOATTR="(0)" +options WS_DEFAULT_FG=WSCOL_WHITE +options WS_DEFAULT_BG=WSCOL_BLACK +options WS_DEFAULT_COLATTR="(0)" +options WS_DEFAULT_MONOATTR="(0)" options WS_KERNEL_FG=WSCOL_GREEN -#options WS_KERNEL_BG=WSCOL_BLACK -#options WS_KERNEL_COLATTR="" -#options WS_KERNEL_MONOATTR="" +options WS_KERNEL_BG=WSCOL_BLACK +options WS_KERNEL_COLATTR="(0)" +options WS_KERNEL_MONOATTR="(0)" # customization of console border color options WSDISPLAY_CUSTOM_BORDER # custom border colors via wsconsctl(8) -#options WSDISPLAY_BORDER_COLOR=WSCOL_BLUE # default color +options WSDISPLAY_BORDER_COLOR=WSCOL_BLUE # default color # compatibility to other console drivers options WSDISPLAY_COMPAT_PCVT # emulate some ioctls options WSDISPLAY_COMPAT_SYSCONS # emulate some ioctls options WSDISPLAY_COMPAT_USL # VT handling options WSDISPLAY_COMPAT_RAWKBD # can get raw scancodes -#options WSKBD_EVENT_AUTOREPEAT # auto repeat in event mode +options WSKBD_EVENT_AUTOREPEAT # auto repeat in event mode #options WSKBD_USONLY # strip off non-US keymaps # don't attach pckbd as the console if no PS/2 keyboard is found options PCKBD_CNATTACH_MAY_FAIL # see dev/pckbport/wskbdmap_mfii.c for implemented layouts -#options PCKBD_LAYOUT="(KB_DE | KB_NODEAD)" # for pckbd driver -#options UKBD_LAYOUT="(KB_DE | KB_NODEAD)" # for ukbd driver +options PCKBD_LAYOUT="(KB_DE | KB_NODEAD)" # for pckbd driver +options UKBD_LAYOUT="(KB_DE | KB_NODEAD)" # for ukbd driver # allocate a number of virtual screens at autoconfiguration time -#options WSDISPLAY_DEFAULTSCREENS=4 +options WSDISPLAY_DEFAULTSCREENS=4 # use a large software cursor that doesn't blink options PCDISPLAY_SOFTCURSOR # modify the screen type of the console; defaults to "80x25" -#options VGA_CONSOLE_SCREENTYPE="\"80x24\"" +options VGA_CONSOLE_SCREENTYPE="\"80x24\"" # work around a hardware bug that loaded fonts don't work; found on ATI cards -#options VGA_CONSOLE_ATI_BROKEN_FONTSEL +options VGA_CONSOLE_ATI_BROKEN_FONTSEL +# issue VGA BIOS POST on resume +options VGA_POST # console scrolling support. options WSDISPLAY_SCROLLSUPPORT # enable VGA raster mode capable of displaying multilingual text on console @@ -319,7 +315,7 @@ cpu* at mainbus? ioapic* at mainbus? # Doesn't do anything yet. -#p64h2apic* at pci? dev? function? # P64H2 IOxAPIC +p64h2apic* at pci? dev? function? # P64H2 IOxAPIC #apm0 at mainbus0 # Advanced power management @@ -334,7 +330,7 @@ ioapic* at mainbus? # Basic Bus Support #IPMI support -#ipmi0 at mainbus? +ipmi0 at mainbus? # Advanced Configuration and Power Interface @@ -343,15 +339,14 @@ ioapic* at mainbus? # To use the I/O APIC(s), enable the ioapic line above. #options MPBIOS # configure CPUs and APICs using MPBIOS #options MPBIOS_SCANPCI # find PCI roots using MPBIOS -options ACPI_SCANPCI # find PCI roots using ACPI +#options ACPI_SCANPCI # find PCI roots using ACPI acpi0 at mainbus0 -#options ACPI_ACTIVATE_DEV # If set, activate inactive devices -#options ACPICA_PEDANTIC # force strict conformance to the Spec. +options ACPI_ACTIVATE_DEV # If set, activate inactive devices +options ACPICA_PEDANTIC # force strict conformance to the Spec. # ACPI devices -apm* at acpi? # ACPI apm emulation acpiacad* at acpi? # ACPI AC Adapter acpibat* at acpi? # ACPI Battery acpibut* at acpi? # ACPI Button @@ -364,13 +359,13 @@ acpilid* at acpi? # ACPI Lid Switch acpitz* at acpi? # ACPI Thermal Zone # Mainboard devices -aiboost* at acpi? # ASUS AI Booster Hardware Monitor +aiboost* at acpi? # ASUS AI Booster Hardware monitor attimer* at acpi? # AT Timer -#com* at acpi? # Serial communications interface -#fdc* at acpi? # Floppy disk controller +com* at acpi? # Serial communications interface +fdc* at acpi? # Floppy disk controller hpet* at acpi? # High Precision Event Timer joy* at acpi? # Joystick/Game port -#lpt* at acpi? # Parallel port +lpt* at acpi? # Parallel port mpu* at acpi? # Roland MPU-401 MIDI UART npx* at acpi? # Math coprocessor pckbc* at acpi? # PC keyboard controller @@ -392,32 +387,32 @@ vald* at acpi? # Plug-and-Play BIOS and attached devices -#pnpbios* at mainbus? +pnpbios* at mainbus? # mainboard audio chips -#ess* at pnpbios? index ? # ESS AudioDrive -#sb* at pnpbios? index ? # NeoMagic 256AV in sb mode -#wss* at pnpbios? index ? # NeoMagic 256AV in wss mode -#ym* at pnpbios? index ? # Yamaha OPL3-SA[23] audio +ess* at pnpbios? index ? # ESS AudioDrive +sb* at pnpbios? index ? # NeoMagic 256AV in sb mode +wss* at pnpbios? index ? # NeoMagic 256AV in wss mode +ym* at pnpbios? index ? # Yamaha OPL3-SA[23] audio # com port # If enabled, consider changing "com0", "com1", and "com2" under "ISA Serial # Interfaces" to "com*", otherwise com2 will attach at pnpbios? and there # will be no com0. A side effect is pcmcia (and other) com? previously # starting at com3 may attach as com1 or com2. -#com* at pnpbios? index ? # serial ports +com* at pnpbios? index ? # serial ports # parallel port # The above "com*" comments apply, cf. "lpt0" under "ISA parallel # "printer interfaces". -#lpt* at pnpbios? index ? # parallel ports +lpt* at pnpbios? index ? # parallel ports -#pckbc* at pnpbios? index ? # PC keyboard/mouse controller -#fdc* at pnpbios? index ? # floppy controller -#npx* at pnpbios? index ? # Math coprocessor +pckbc* at pnpbios? index ? # PC keyboard/mouse controller +fdc* at pnpbios? index ? # floppy controller +npx* at pnpbios? index ? # Math coprocessor # IDE controller on Toshiba Portege 3000 series (crippled PCI device) -#pciide* at pnpbios? index ? +pciide* at pnpbios? index ? # PCI bus support pci* at mainbus? bus ? @@ -425,39 +420,41 @@ pci* at pchb? bus ? pci* at ppb? bus ? # Configure PCI using BIOS information -#options PCIBIOS # PCI BIOS support -#options PCIBIOSVERBOSE # PCI BIOS verbose info -#options PCIBIOS_IRQS_HINT=0x0a00 # PCI interrupts hint. IRQ 9 or 11 -#options PCIBIOS_INTR_GUESS # see pcibios(4) -#options PCIBIOS_LIBRETTO_FIXUP # this code makes the Toshiba Libretto +options PCIBIOS # PCI BIOS support +options PCIBIOSVERBOSE # PCI BIOS verbose info +options PCIBIOS_IRQS_HINT=0x0a00 # PCI interrupts hint. IRQ 9 or 11 +options PCIBIOS_INTR_GUESS # see pcibios(4) +options PCIBIOS_LIBRETTO_FIXUP # this code makes the Toshiba Libretto # L2/L3 work, but should not be enabled # on anything else. -#options PCIBIOS_SHARP_MM20_FIXUP # this code makes the Sharp MM 20 +options PCIBIOS_SHARP_MM20_FIXUP # this code makes the Sharp MM 20 # work, but should not be enabled # on anything else. #options PCIINTR_DEBUG # super-verbose PCI interrupt fixup # PCI fixups, for both PCIBIOS and ACPI -#options PCI_ADDR_FIXUP # fixup PCI I/O addresses -#options PCI_BUS_FIXUP # fixup PCI bus numbering -#options PCI_INTR_FIXUP # fixup PCI interrupt routing +options PCI_ADDR_FIXUP # fixup PCI I/O addresses +options PCI_BUS_FIXUP # fixup PCI bus numbering +options PCI_INTR_FIXUP # fixup PCI interrupt routing # System Controllers elansc* at pci? dev ? function ? # AMD Elan SC520 System Controller gpio* at elansc? +elanpar* at elansc? +elanpex* at elansc? # PCI bridges -#amdpcib* at pci? dev ? function ? # AMD 8111 PCI-ISA w/ HPET -#hpet* at amdpcib? -#ichlpcib* at pci? dev ? function ? # Intel ICH PCI-ISA w/ timecounter, - # watchdog, SpeedStep and HPET -#hpet* at ichlpcib? +amdpcib* at pci? dev ? function ? # AMD 8111 PCI-ISA w/ HPET +hpet* at amdpcib? +ichlpcib* at pci? dev ? function ? # Intel ICH PCI-ISA w/ watchdog and + # SpeedStep support +hpet0 at ichlpcib? # High Precision Event Timer gcscpcib* at pci? dev ? function ? # AMD CS5535/CS5536 PCI-ISA w/ -gpio* at gcscpcib? # timecounter, watchdog and GPIO -#piixpcib* at pci? dev ? function ? # Intel PIIX4 PCI-ISA w/ SpeedStep -#gscpcib* at pci? dev ? function ? # NS Geode PCI-ISA w/ GPIO support -#viapcib* at pci? dev ? function ? # VIA VT8235 PCI-ISA w/ SMBus support -#iic* at viapcib? +gpio* at gcscpcib? # timecounter, watchdog and GPIO +piixpcib* at pci? dev ? function ? # Intel PIIX4 PCI-ISA w/ SpeedStep +gscpcib* at pci? dev ? function ? # NS Geode PCI-ISA w/ GPIO support +viapcib* at pci? dev ? function ? # VIA VT8235 PCI-ISA w/ SMBus support +iic* at viapcib? pchb* at pci? dev ? function ? # PCI-Host bridges pceb* at pci? dev ? function ? # PCI-EISA bridges pcib* at pci? dev ? function ? # PCI-ISA bridges @@ -474,12 +471,12 @@ eisa0 at mainbus? eisa0 at pceb? # ISA bus support -#isa0 at amdpcib? +isa0 at amdpcib? isa0 at gcscpcib? -#isa0 at ichlpcib? -#isa0 at piixpcib? -#isa0 at gscpcib? -#isa0 at viapcib? +isa0 at ichlpcib? +isa0 at piixpcib? +isa0 at gscpcib? +isa0 at viapcib? isa0 at mainbus? isa0 at pceb? isa0 at pcib? @@ -526,31 +523,45 @@ npx0 at isa? port 0xf0 irq 13 # x86 math coprocessor pckbc0 at isa? # pc keyboard controller pckbd* at pckbc? # PC keyboard pms* at pckbc? # PS/2 mouse for wsmouse -#options PMS_DISABLE_POWERHOOK # Disable PS/2 reset on resume +options PMS_DISABLE_POWERHOOK # Disable PS/2 reset on resume options PMS_SYNAPTICS_TOUCHPAD # Enable support for Synaptics Touchpads vga0 at isa? vga* at pci? dev ? function ? pcdisplay0 at isa? # CGA, MDA, EGA, HGA -#machfb* at pci? dev ? function ? # ATI Mach64 framebuffer driver +machfb* at pci? dev ? function ? # ATI Mach64 framebuffer driver wsdisplay* at vga? console ? wsdisplay* at pcdisplay? console ? -#wsdisplay* at machfb? console ? +wsdisplay* at machfb? console ? wskbd* at pckbd? console ? wsmouse* at pms? mux 0 # VESA framebuffer console -#options KVM86 # required for vesabios -#vesabios* at vesabiosbus? -#vesafb* at vesabios? -#options VESAFB_WIDTH=640 -#options VESAFB_HEIGHT=480 -#options VESAFB_DEPTH=8 -#options VESAFB_PM # power management support -#wsdisplay* at vesafb? console ? +options KVM86 # required for vesabios +vesabios* at vesabiosbus? +vesafb* at vesabios? +options VESAFB_WIDTH=640 +options VESAFB_HEIGHT=480 +options VESAFB_DEPTH=8 +options VESAFB_PM # power management support +wsdisplay* at vesafb? console ? # VIA Unichrome framebuffer console -#unichromefb* at pci? dev ? function ? -#wsdisplay* at unichromefb? +unichromefb* at pci? dev ? function ? +wsdisplay* at unichromefb? + +# XBOX framebuffer console +xboxfb0 at pci? dev ? function ? +wsdisplay* at xboxfb? console ? + +# DRI driver +i915drm* at vga? # Intel i915, i945 DRM driver +mach64drm* at vga? # mach64 (3D Rage Pro, Rage) DRM driver +mgadrm* at vga? # Matrox G[24]00, G[45]50 DRM driver +r128drm* at vga? # ATI Rage 128 DRM driver +radeondrm* at vga? # ATI Radeon DRM driver +savagedrm* at vga? # S3 Savage DRM driver +sisdrm* at vga? # SiS DRM driver +tdfxdrm* at vga? # 3dfx (voodoo) DRM driver attimer0 at isa? pcppi0 at isa? @@ -580,24 +591,24 @@ com* at cardbus? function ? # Modems and serial cards com0 at isa? port 0x3f8 irq 4 # Standard PC serial ports com1 at isa? port 0x2f8 irq 3 com2 at isa? port 0x3e8 irq 5 -#com3 at isa? port 0x2e8 irq 9 -#ast0 at isa? port 0x1a0 irq 5 # AST 4-port serial cards -#com* at ast? slave ? -#boca0 at isa? port 0x100 irq 5 # BOCA 8-port serial cards -#boca0 at isa? port 0x100 irq 5 # BOCA 16-port serial cards (BB2016) -#boca1 at isa? port 0x140 irq 5 # this line is also needed for BB2016 -#com* at boca? slave ? -#tcom0 at isa? port 0x100 irq 7 # TC-800 8-port serial cards -#com* at tcom? slave ? -#rtfps0 at isa? port 0x1230 irq 10 # RT 4-port serial cards -#com* at rtfps? slave ? -#cy0 at isa? iomem 0xd4000 irq 12 # Cyclades serial cards -#addcom0 at isa? port 0x108 irq 5 # Addonics FlexPort 8S -#com* at addcom? slave ? -#moxa0 at isa? port 0x100 irq 5 # MOXA C168H serial card (experimental) -#com* at moxa? slave ? -#ioat* at isa? port 0x220 irq 5 # BOCA IOAT66 6-port serial card -#com* at ioat? slave ? +com3 at isa? port 0x2e8 irq 9 +ast0 at isa? port 0x1a0 irq 5 # AST 4-port serial cards +com* at ast? slave ? +boca0 at isa? port 0x100 irq 5 # BOCA 8-port serial cards +boca0 at isa? port 0x100 irq 5 # BOCA 16-port serial cards (BB2016) +boca1 at isa? port 0x140 irq 5 # this line is also needed for BB2016 +com* at boca? slave ? +tcom0 at isa? port 0x100 irq 7 # TC-800 8-port serial cards +com* at tcom? slave ? +rtfps0 at isa? port 0x1230 irq 10 # RT 4-port serial cards +com* at rtfps? slave ? +cy0 at isa? iomem 0xd4000 irq 12 # Cyclades serial cards +addcom0 at isa? port 0x108 irq 5 # Addonics FlexPort 8S +com* at addcom? slave ? +moxa0 at isa? port 0x100 irq 5 # MOXA C168H serial card (experimental) +com* at moxa? slave ? +ioat* at isa? port 0x220 irq 5 # BOCA IOAT66 6-port serial card +com* at ioat? slave ? # MCA serial interfaces com* at mca? slot ? # 16x50s on comm boards @@ -616,7 +627,7 @@ lpt2 at isa? port 0x3bc # AMD 768 and 8111 power/ACPI controllers amdpm* at pci? dev ? function ? # RNG and SMBus 1.0 interface -#iic* at amdpm? # sensors below are on this bus +iic* at amdpm? # sensors below are on this bus # Intel Core's on-die Thermal sensor options INTEL_CORETEMP @@ -634,37 +645,37 @@ iic* at nfsmb? piixpm* at pci? dev ? function ? # PIIX4 compatible PM controller iic* at piixpm? # SMBus on PIIX4 -#adt7463c* at iic? addr 0x2C # Unknown other motherboard(s) -#adt7463c* at iic? addr 0x2D # Tyan S2881 -#adt7463c* at iic? addr 0x2E # Tyan S2882-D +adt7463c* at iic? addr 0x2C # Unknown other motherboard(s) +adt7463c* at iic? addr 0x2D # Tyan S2881 +adt7463c* at iic? addr 0x2E # Tyan S2882-D + +pic16lc* at iic? addr 0x10 # XBOX PIC16LC +xbseeprom* at iic? addr 0x54 # XBOX serial EEPROM # IBM Thinkpad Active Protection System -#aps0 at isa? port 0x1600 +aps0 at isa? port 0x1600 # iTE IT87xxF Super I/O with watchdog and sensors support -#itesio0 at isa? port 0x2e +itesio0 at isa? port 0x2e # LM7[89] and compatible hardware monitors -#lm0 at isa? port 0x290 # other common: 0x280, 0x310 +lm0 at isa? port 0x290 # other common: 0x280, 0x310 # SMSC LPC47B397 hardware monitor functions -#smsc0 at isa? port 0x02e +smsc0 at isa? port 0x02e # PC87366 hardware monitor -#nsclpcsio* at isa? -#gpio* at nsclpcsio? +nsclpcsio* at isa? +gpio* at nsclpcsio? # Abit uGuru Hardware system monitor -#ug0 at isa? port 0xe0 +ug0 at isa? port 0xe0 # VIA VT82C686A/VT8231 Hardware Monitor and Power Management Timer -#viaenv* at pci? dev ? function ? +viaenv* at pci? dev ? function ? # Serial Presence Detect capable memory modules -#spdmem* at iic? addr 0x50 -#spdmem* at iic? addr 0x51 -#spdmem* at iic? addr 0x52 -#spdmem* at iic? addr 0x53 +spdmem* at iic? addr 0x50 # I2O devices iop* at pci? dev ? function ? # I/O processor @@ -673,14 +684,14 @@ ld* at iop? tid ? # block devices dpti* at iop? tid 0 # DPT/Adaptec control interface # GPIO devices -#gpio* at gscpcib? +gpio* at gscpcib? # 1-Wire support -#gpioow* at gpio? offset 6 mask 0x1 # 1-wire bitbanging via gpio -#onewire* at gpioow? +gpioow* at gpio? offset 6 mask 0x1 # 1-wire bitbanging via gpio +onewire* at gpioow? # 1-Wire devices -#owtemp* at onewire? # Temperature sensors +owtemp* at onewire? # Temperature sensors # SCSI Controllers and Devices @@ -700,7 +711,7 @@ njs* at pci? dev ? function ? # Workbit NinjaSCSI-32 pcscp* at pci? dev ? function ? # AMD 53c974 PCscsi-PCI SCSI siop* at pci? dev ? function ? # Symbios 53c8xx SCSI esiop* at pci? dev ? function ? # Symbios 53c875 SCSI and newer -#options SIOP_SYMLED # drive the act. LED in software +options SIOP_SYMLED # drive the act. LED in software trm* at pci? dev ? function ? # Tekram DC-395U/UW/F, DC-315/U SCSI # EISA SCSI controllers @@ -728,9 +739,9 @@ aic0 at isa? port 0x340 irq 11 # Adaptec 152[02] SCSI bha0 at isa? port 0x330 irq ? drq ? # BusLogic [457]4X SCSI bha1 at isa? port 0x334 irq ? drq ? # The "nca" and "dpt" probes might give false hits or hang your machine. -#dpt0 at isa? port 0x170 irq ? drq ? # DPT SmartCache/SmartRAID -#nca0 at isa? port 0x360 irq 15 # Port-mapped NCR 53C80 controller -#nca1 at isa? iomem 0xd8000 irq 5 # Memory-mapped controller (T128, etc.) +dpt0 at isa? port 0x170 irq ? drq ? # DPT SmartCache/SmartRAID +nca0 at isa? port 0x360 irq 15 # Port-mapped NCR 53C80 controller +nca1 at isa? iomem 0xd8000 irq 5 # Memory-mapped controller (T128, etc.) sea0 at isa? iomem 0xc8000 irq 5 # Seagate/Future Domain SCSI uha0 at isa? port 0x330 irq ? drq ? # UltraStor [13]4f SCSI uha1 at isa? port 0x340 irq ? drq ? @@ -757,6 +768,8 @@ ses* at scsibus? target ? lun ? # SCSI Enclosure Services devices ss* at scsibus? target ? lun ? # SCSI scanners uk* at scsibus? target ? lun ? # SCSI unknown +# SCSI NIC +se* at scsibus? target ? lun ? # RAID controllers and devices aac* at pci? dev ? function ? # Adaptec AAC family @@ -798,7 +811,7 @@ geodeide* at pci? dev ? function ? # AMD Geode IDE controllers hptide* at pci? dev ? function ? # Triones/HighPoint IDE controllers iteide* at pci? dev ? function ? # IT Express IDE controllers ixpide* at pci? dev ? function ? # ATI IXP IDE controllers -jmide* at pci? dev ? function ? # JMicron PCI-e PATA/SATA controllers +jmide* at pci? dev ? function ? # JMicron PCI-e PATA/SATA controllers ahcisata* at jmide? optiide* at pci? dev ? function ? # Opti IDE controllers piixide* at pci? dev ? function ? # Intel IDE controllers @@ -867,16 +880,16 @@ fdc0 at isa? port 0x3f0 irq 6 drq 2 # standard PC floppy controllers #fdc1 at isa? port 0x370 irq ? drq ? fd* at fdc? drive ? # the drives themselves # some machines need you to do this instead of fd* -#fd0 at fdc0 drive 0 +fd0 at fdc0 drive 0 # ISA CD-ROM devices -#mcd0 at isa? port 0x300 irq 10 # Mitsumi CD-ROM drives +mcd0 at isa? port 0x300 irq 10 # Mitsumi CD-ROM drives # ISA tape devices # note: the wt driver conflicts unpleasantly with SMC boards at the # same I/O address. The probe reprograms their EEPROMs. Don't # uncomment it unless you are actually using it. -#wt0 at isa? port 0x308 irq 5 drq 1 # Archive and Wangtek QIC tape drives +wt0 at isa? port 0x308 irq 5 drq 1 # Archive and Wangtek QIC tape drives # MCA ESDI devices edc* at mca? slot ? # IBM ESDI Disk Controllers @@ -959,7 +972,7 @@ ne* at pcmcia? function ? # NE2000-compatible Ethernet ray* at pcmcia? function ? # Raytheon Raylink (802.11) sm* at pcmcia? function ? # Megahertz Ethernet # tr at pcmcia has problems with Cardbus bridges -#tr* at pcmcia? function ? # TROPIC based Token-Ring +tr* at pcmcia? function ? # TROPIC based Token-Ring wi* at pcmcia? function ? # Lucent/Intersil WaveLan IEEE (802.11) xirc* at pcmcia? function ? # Xircom CreditCard Ethernet com* at xirc? @@ -981,11 +994,11 @@ fmv0 at isa? port 0x2a0 irq ? # FMV-181/182 ix0 at isa? port 0x300 irq 10 # EtherExpress/16 iy0 at isa? port 0x360 irq ? # EtherExpress PRO 10 ISA lc0 at isa? port 0x320 iomem ? irq ? # DEC EtherWORKS III (LEMAC) -#depca0 at isa? port 0x300 iomem 0xc8000 iosiz 0x8000 irq 5 # DEPCA -#le* at depca? +depca0 at isa? port 0x300 iomem 0xc8000 iosiz 0x8000 irq 5 # DEPCA +le* at depca? nele0 at isa? port 0x320 irq 9 drq 7 # NE2100 le* at nele? -#ntwoc0 at isa? port 0x300 irq 5 iomem 0xc8000 flags 1 # Riscom/N2 sync serial +ntwoc0 at isa? port 0x300 irq 5 iomem 0xc8000 flags 1 # Riscom/N2 sync serial bicc0 at isa? port 0x320 irq 10 drq 7 # BICC IsoLan le* at bicc? ne0 at isa? port 0x280 irq 9 # NE[12]000 ethernet cards @@ -1002,9 +1015,9 @@ ath* at cardbus? function ? # Atheros 5210/5211/5212 802.11 atw* at cardbus? function ? # ADMtek ADM8211 (802.11) ex* at cardbus? function ? # 3Com 3C575TX fxp* at cardbus? function ? # Intel i8255x -ral* at cardbus? function ? # Ralink Technology RT25x0 802.11a/b/g re* at cardbus? function ? # Realtek 8139C+/8169/8169S/8110S rtk* at cardbus? function ? # Realtek 8129/8139 +ral* at cardbus? function ? # Ralink Technology rtw* at cardbus? function ? # Realtek 8180L (802.11) tlp* at cardbus? function ? # DECchip 21143 @@ -1058,12 +1071,12 @@ ohci* at pci? dev ? function ? # Open Host Controller uhci* at pci? dev ? function ? # Universal Host Controller (Intel) # CardBus USB controllers -ehci* at cardbus? function ? # Enhanced Host Controller -ohci* at cardbus? function ? # Open Host Controller -uhci* at cardbus? function ? # Universal Host Controller (Intel) +ehci* at cardbus? function ? # Enhanced Host Controller +ohci* at cardbus? function ? # Open Host Controller +uhci* at cardbus? function ? # Universal Host Controller (Intel) # ISA USB controllers -#slhci0 at isa? port 0x300 irq 5 # ScanLogic SL811HS +slhci0 at isa? port 0x300 irq 5 # ScanLogic SL811HS # PCMCIA USB controllers slhci* at pcmcia? function ? # ScanLogic SL811HS @@ -1126,9 +1139,6 @@ umidi* at uhub? port ? configuration ? uirda* at uhub? port ? configuration ? interface ? irframe* at uirda? -stuirda* at uhub? port ? configuration ? interface ? -irframe* at stuirda? - # SigmaTel STIr4200 USB/IrDA Bridge ustir* at uhub? port ? irframe* at ustir? @@ -1155,8 +1165,8 @@ upl* at uhub? port ? ubsa* at uhub? port ? # Belkin serial adapter ucom* at ubsa? portno ? -uchcom* at uhub? port ? # WinChipHead CH341/CH340 serial adapter -ucom* at uchcom? portno ? +uchcom* at uhub? port ? # WinChipHead CH341/CH340 serial adapter +ucom* at uchcom? portno ? uftdi* at uhub? port ? # FTDI FT8U100AX serial adapter ucom* at uftdi? portno ? @@ -1203,14 +1213,15 @@ uyap* at uhub? port ? udsbr* at uhub? port ? radio* at udsbr? +# XBOX controller +xboxcontroller* at uhub? port ? +wsmouse* at xboxcontroller? mux 0 + # USB Generic driver ugen* at uhub? port ? # On ugen bulk endpoints, perform read-ahead and write-behind. -options UGEN_BULK_RA_WB +options UGEN_BULK_RA_WB -# USB generic serial port (e.g., data over cellular) -ugensa* at uhub? port ? -ucom* at ugensa? # IrDA and Consumer Ir devices @@ -1261,22 +1272,22 @@ ym* at isapnp? # Yamaha OPL3-SA[23] audio # ISA audio devices # the "aria" probe might give false hits -#aria0 at isa? port 0x290 irq 10 # Aria -#ess0 at isa? port 0x220 irq 5 drq 1 drq2 5 # ESS 18XX +aria0 at isa? port 0x290 irq 10 # Aria +ess0 at isa? port 0x220 irq 5 drq 1 drq2 5 # ESS 18XX gus0 at isa? port 0x220 irq 7 drq 1 drq2 6 # Gravis Ultra Sound pas0 at isa? port 0x220 irq 7 drq 1 # ProAudio Spectrum sb0 at isa? port 0x220 irq 5 drq 1 drq2 5 # SoundBlaster wss0 at isa? port 0x530 irq 10 drq 0 drq2 1 # Windows Sound System # PCMCIA audio devices -#esl* at pcmcia? function ? # ESS 1688 AudioDrive +esl* at pcmcia? function ? # ESS 1688 AudioDrive -#cms0 at isa? port 0x220 # Creative Music System +cms0 at isa? port 0x220 # Creative Music System # OPL[23] FM synthesizers -#opl0 at isa? port 0x388 # use only if not attached to sound card +opl0 at isa? port 0x388 # use only if not attached to sound card opl* at cmpci? flags 1 -#opl* at esl? +opl* at esl? opl* at eso? opl* at ess? opl* at fms? @@ -1290,7 +1301,7 @@ opl* at ym? audio* at audiobus? # MPU 401 UARTs -#mpu* at isa? port 0x330 irq 9 # MPU401 or compatible card +mpu* at isa? port 0x330 irq 9 # MPU401 or compatible card mpu* at isapnp? mpu* at cmpci? mpu* at eso? @@ -1304,30 +1315,30 @@ midi* at midibus? midi* at pcppi? # MIDI interface to the PC speaker # The spkr driver provides a simple tone interface to the built in speaker. -#spkr0 at pcppi? # PC speaker +spkr0 at pcppi? # PC speaker # FM-Radio devices # ISA radio devices -#az0 at isa? port 0x350 # Aztech/PackardBell FM Radio Card -#az1 at isa? port 0x358 -#rt0 at isa? port 0x20c # AIMS Lab Radiotrack & compatible -#rt1 at isa? port 0x284 -#rt2 at isa? port 0x30c -#rt3 at isa? port 0x384 -#rtii0 at isa? port 0x20c # AIMS Lab Radiotrack II FM Radio Card -#rtii1 at isa? port 0x30c -#sf2r0 at isa? port 0x384 # SoundForte RadioLink SF16-FMR2 FM Radio Card +az0 at isa? port 0x350 # Aztech/PackardBell FM Radio Card +az1 at isa? port 0x358 +rt0 at isa? port 0x20c # AIMS Lab Radiotrack & compatible +rt1 at isa? port 0x284 +rt2 at isa? port 0x30c +rt3 at isa? port 0x384 +rtii0 at isa? port 0x20c # AIMS Lab Radiotrack II FM Radio Card +rtii1 at isa? port 0x30c +sf2r0 at isa? port 0x384 # SoundForte RadioLink SF16-FMR2 FM Radio Card # PCI radio devices -#gtp* at pci? dev ? function ? # Guillemot Maxi Radio FM 2000 Radio Card +gtp* at pci? dev ? function ? # Guillemot Maxi Radio FM 2000 Radio Card # Radio support -#radio* at az? -#radio* at gtp? -#radio* at rt? -#radio* at rtii? -#radio* at sf2r? +radio* at az? +radio* at gtp? +radio* at rt? +radio* at rtii? +radio* at sf2r? # TV cards @@ -1389,18 +1400,18 @@ ubsec* at pci? dev ? function ? # Broadcom 5501/5601/580x/582x # Joysticks -#joy* at pnpbios? index ? # Game port +joy* at pnpbios? index ? # Game port # ISA Plug-and-Play joysticks joy* at isapnp? # Game ports (usually on audio cards) # PCI joysticks joy* at pci? # Game ports (usually on audio cards) -#joy* at eap? # See CAVEATS in eap(4) before enabling +joy* at eap? # See CAVEATS in eap(4) before enabling joy* at eso? # ESS Solo-1 on-board joystick # ISA joysticks. Probe is a little strange; add only if you have one. -#joy0 at isa? port 0x201 +joy0 at isa? port 0x201 # Miscellaneous Devices @@ -1409,14 +1420,14 @@ geodewdog* at geodegcb? # AMD Geode SC1100 watchdog timer geodecntr* at geodegcb? # AMD Geode SC1100 high res. counter # Planetconnect Satellite receiver driver. -#satlink0 at isa? port 0x300 drq 1 +satlink0 at isa? port 0x300 drq 1 # Middle Digital, Inc. PCI-Weasel serial console board control # devices (watchdog timer, etc.) weasel* at pci? # Pull in optional local configuration -cinclude "arch/i386/conf/GENERIC.local" +#include "arch/i386/conf/ALL.local" # Pseudo-Devices @@ -1425,19 +1436,18 @@ pseudo-device crypto # /dev/crypto device pseudo-device swcrypto # software crypto implementation # disk/mass storage pseudo-devices -pseudo-device bio # RAID control device driver pseudo-device ccd 4 # concatenated/striped disk devices pseudo-device cgd 4 # cryptographic disk devices pseudo-device raid 8 # RAIDframe disk driver options RAID_AUTOCONFIG # auto-configuration of RAID components # Options to enable various other RAIDframe RAID types. -#options RF_INCLUDE_EVENODD=1 -#options RF_INCLUDE_RAID5_RS=1 -#options RF_INCLUDE_PARITYLOGGING=1 -#options RF_INCLUDE_CHAINDECLUSTER=1 -#options RF_INCLUDE_INTERDECLUSTER=1 -#options RF_INCLUDE_PARITY_DECLUSTERING=1 -#options RF_INCLUDE_PARITY_DECLUSTERING_DS=1 +options RF_INCLUDE_EVENODD=1 +options RF_INCLUDE_RAID5_RS=1 +options RF_INCLUDE_PARITYLOGGING=1 +options RF_INCLUDE_CHAINDECLUSTER=1 +options RF_INCLUDE_INTERDECLUSTER=1 +options RF_INCLUDE_PARITY_DECLUSTERING=1 +options RF_INCLUDE_PARITY_DECLUSTERING_DS=1 pseudo-device fss 4 # file system snapshot device pseudo-device md 1 # memory disk device (ramdisk) @@ -1445,8 +1455,9 @@ pseudo-device vnd # disk-like interface to files options VND_COMPRESSION # compressed vnd(4) # network pseudo-devices +pseudo-device agr # Link aggregation agr(4) pseudo-device bpfilter # Berkeley packet filter -#pseudo-device carp # Common Address Redundancy Protocol +pseudo-device carp # Common Address Redundancy Protocol pseudo-device ipfilter # IP filter (firewall) and NAT pseudo-device loop # network loopback pseudo-device ppp # Point-to-Point Protocol @@ -1458,26 +1469,26 @@ pseudo-device tap # virtual Ethernet pseudo-device tun # network tunneling over tty pseudo-device gre # generic L3 over IP tunnel pseudo-device gif # IPv[46] over IPv[46] tunnel (RFC1933) -#pseudo-device faith # IPv[46] tcp relay translation i/f +pseudo-device faith # IPv[46] tcp relay translation i/f pseudo-device stf # 6to4 IPv6 over IPv4 encapsulation pseudo-device vlan # IEEE 802.1q encapsulation pseudo-device bridge # simple inter-network bridging -#options BRIDGE_IPF # bridge uses IP/IPv6 pfil hooks too -pseudo-device agr # IEEE 802.3ad link aggregation -#pseudo-device pf # PF packet filter -#pseudo-device pflog # PF log if +options BRIDGE_IPF # bridge uses IP/IPv6 pfil hooks too +pseudo-device pf # PF packet filter +pseudo-device pflog # PF log if +pseudo-device kttcp +pseudo-device etherip # EtherIP # srt is EXPERIMENTAL -#pseudo-device srt # source-address-based routing +pseudo-device srt # source-address-based routing # miscellaneous pseudo-devices pseudo-device pty # pseudo-terminals pseudo-device sequencer 1 # MIDI sequencer # rnd works; RND_COM does not on port i386 yet. pseudo-device rnd # /dev/random and in-kernel generator -#options RND_COM # use "com" randomness as well (BROKEN) +options RND_COM # use "com" randomness as well (BROKEN) pseudo-device clockctl # user control of clock subsystem pseudo-device ksyms # /dev/ksyms -pseudo-device lockstat # lock profiling pseudo-device bcsp # BlueCore Serial Protocol pseudo-device btuart # Bluetooth HCI UART (H4) @@ -1491,17 +1502,32 @@ pseudo-device nsmb # experimental - SMB requester pseudo-device wsmux # mouse & keyboard multiplexor pseudo-device wsfont -# pseudo audio device driver -pseudo-device pad - -# userland interface to drivers, including autoconf and properties retrieval -pseudo-device drvctl - options FILEASSOC # fileassoc(9) - required for Veriexec # Veriexec pseudo-device veriexec -# + +# drvctl - needed to show device dictionary via drvctl(8) +pseudo-device drvctl + +# pseudo-device lockstat needed for lockstat(8) +pseudo-device lockstat + +# software watchdog driver - swwdog(4) +pseudo-device swwdog + +# cmos(4) pseudo-device +pseudo-device cmos + +# Pass-to-Userspace Transporter +pseudo-device putter + +# Userspace block/char drivers +pseudo-device pud + +# pseudo audio device driver +pseudo-device pad + # Uncomment the fingerprint methods below that are desired. Note that # removing fingerprint methods will have almost no impact on the kernel # code size. @@ -1513,5 +1539,6 @@ options VERIFIED_EXEC_FP_SHA512 options VERIFIED_EXEC_FP_SHA1 options VERIFIED_EXEC_FP_MD5 -options PAX_MPROTECT=0 # PaX mprotect(2) restrictions -options PAX_ASLR=0 # PaX Address Space Layout Randomization +options PAX_MPROTECT=0 # PaX mprotect(2) restrictions +options PAX_SEGVGUARD=0 # PaX Segmentation fault guard +options PAX_ASLR=0 # PaX Address Space Layout Randomization diff --git a/sys/arch/i386/pci/gcscide.c b/sys/arch/i386/pci/gcscide.c index fc00a607869..505e33e6a66 100644 --- a/sys/arch/i386/pci/gcscide.c +++ b/sys/arch/i386/pci/gcscide.c @@ -1,4 +1,4 @@ -/* $NetBSD: gcscide.c,v 1.6 2007/10/06 07:21:03 xtraeme Exp $ */ +/* $NetBSD: gcscide.c,v 1.7 2008/03/18 20:46:36 cube Exp $ */ /*- * Copyright (c) 2007 Juan Romero Pardines. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: gcscide.c,v 1.6 2007/10/06 07:21:03 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gcscide.c,v 1.7 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -82,8 +82,8 @@ __KERNEL_RCSID(0, "$NetBSD: gcscide.c,v 1.6 2007/10/06 07:21:03 xtraeme Exp $"); */ #define GCSCIDE_ATAC_DMA_SEL (1 << 20) -static int gcscide_match(struct device *, struct cfdata *, void *); -static void gcscide_attach(struct device *, struct device *, void *); +static int gcscide_match(device_t, cfdata_t, void *); +static void gcscide_attach(device_t, device_t, void *); static void gcscide_chip_map(struct pciide_softc *, struct pci_attach_args *); static void gcscide_setup_channel(struct ata_channel *); @@ -111,7 +111,7 @@ static const uint32_t gcscide_udma_timings[] = { 0x7f703061 /* Ultra DMA Mode 4 */ }; -CFATTACH_DECL(gcscide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(gcscide, sizeof(struct pciide_softc), gcscide_match, gcscide_attach, NULL, NULL); static const struct pciide_product_desc pciide_gcscide_products[] = { @@ -125,7 +125,7 @@ static const struct pciide_product_desc pciide_gcscide_products[] = { }; static int -gcscide_match(struct device *parent, struct cfdata *cfdata, void *aux) +gcscide_match(device_t parent, cfdata_t cfdata, void *aux) { struct pci_attach_args *pa = (struct pci_attach_args *)aux; @@ -138,10 +138,12 @@ gcscide_match(struct device *parent, struct cfdata *cfdata, void *aux) } static void -gcscide_attach(struct device *parent, struct device *self, void *aux) +gcscide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_gcscide_products)); @@ -156,8 +158,8 @@ gcscide_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); diff --git a/sys/arch/i386/pnpbios/pciide_pnpbios.c b/sys/arch/i386/pnpbios/pciide_pnpbios.c index c647b207e0f..6d418be105f 100644 --- a/sys/arch/i386/pnpbios/pciide_pnpbios.c +++ b/sys/arch/i386/pnpbios/pciide_pnpbios.c @@ -1,4 +1,4 @@ -/* $NetBSD: pciide_pnpbios.c,v 1.24 2006/11/16 01:32:39 christos Exp $ */ +/* $NetBSD: pciide_pnpbios.c,v 1.25 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 1999 Soren S. Jorvang. All rights reserved. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pciide_pnpbios.c,v 1.24 2006/11/16 01:32:39 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pciide_pnpbios.c,v 1.25 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -52,8 +52,8 @@ __KERNEL_RCSID(0, "$NetBSD: pciide_pnpbios.c,v 1.24 2006/11/16 01:32:39 christos #include <dev/pci/pciidereg.h> #include <dev/pci/pciidevar.h> -static int pciide_pnpbios_match(struct device *, struct cfdata *, void *); -static void pciide_pnpbios_attach(struct device *, struct device *, void *); +static int pciide_pnpbios_match(device_t, cfdata_t, void *); +static void pciide_pnpbios_attach(device_t, device_t, void *); extern void pciide_channel_dma_setup(struct pciide_channel *); extern int pciide_dma_init(void *, int, int, void *, size_t, int); @@ -61,12 +61,11 @@ extern void pciide_dma_start(void *, int, int); extern int pciide_dma_finish(void *, int, int, int); extern int pciide_compat_intr (void *); -CFATTACH_DECL(pciide_pnpbios, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(pciide_pnpbios, sizeof(struct pciide_softc), pciide_pnpbios_match, pciide_pnpbios_attach, NULL, NULL); int -pciide_pnpbios_match(struct device *parent, - struct cfdata *match, void *aux) +pciide_pnpbios_match(device_t parent, cfdata_t match, void *aux) { struct pnpbiosdev_attach_args *aa = aux; @@ -77,10 +76,9 @@ pciide_pnpbios_match(struct device *parent, } void -pciide_pnpbios_attach(struct device *parent, struct device *self, - void *aux) +pciide_pnpbios_attach(device_t parent, device_t self, void *aux) { - struct pciide_softc *sc = (void *)self; + struct pciide_softc *sc = device_private(self); struct pnpbiosdev_attach_args *aa = aux; struct pciide_channel *cp; struct ata_channel *wdc_cp; @@ -90,28 +88,27 @@ pciide_pnpbios_attach(struct device *parent, struct device *self, int i, drive, size; u_int8_t idedma_ctl; + sc->sc_wdcdev.sc_atac.atac_dev = self; + aprint_naive(": disk controller\n"); aprint_normal("\n"); pnpbios_print_devres(self, aa); - aprint_normal("%s: Toshiba Extended IDE Controller\n", self->dv_xname); + aprint_normal_dev(self, "Toshiba Extended IDE Controller\n"); if (pnpbios_io_map(aa->pbt, aa->resc, 2, &sc->sc_dma_iot, &sc->sc_dma_ioh) != 0) { - aprint_error("%s: unable to map DMA registers\n", - self->dv_xname); + aprint_error_dev(self, "unable to map DMA registers\n"); return; } if (pnpbios_io_map(aa->pbt, aa->resc, 0, &compat_iot, &cmd_baseioh) != 0) { - aprint_error("%s: unable to map command registers\n", - self->dv_xname); + aprint_error_dev(self, "unable to map command registers\n"); return; } if (pnpbios_io_map(aa->pbt, aa->resc, 1, &compat_iot, &ctl_ioh) != 0) { - aprint_error("%s: unable to map control register\n", - self->dv_xname); + aprint_error_dev(self, "unable to map control register\n"); return; } @@ -125,8 +122,8 @@ pciide_pnpbios_attach(struct device *parent, struct device *self, M_DEVBUF, M_NOWAIT); cp->ata_channel.ch_ndrive = 2; if (cp->ata_channel.ch_queue == NULL) { - aprint_error("%s: unable to allocate memory for command " - "queue\n", self->dv_xname); + aprint_error_dev(self, "unable to allocate memory for command " + "queue\n"); return; } @@ -137,8 +134,8 @@ pciide_pnpbios_attach(struct device *parent, struct device *self, size = IDEDMA_SCH_OFFSET - i; if (bus_space_subregion(sc->sc_dma_iot, sc->sc_dma_ioh, i, size, &cp->dma_iohs[i]) != 0) { - aprint_error("%s: can't subregion offset %d " - "size %lu", self->dv_xname, i, (u_long)size); + aprint_error_dev(self, "can't subregion offset %d " + "size %lu", i, (u_long)size); return; } } @@ -167,8 +164,8 @@ pciide_pnpbios_attach(struct device *parent, struct device *self, for (i = 0; i < WDC_NREG; i++) { if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i, i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) { - aprint_error("%s: unable to subregion control " - "register\n", self->dv_xname); + aprint_error_dev(self, "unable to subregion " + "control register\n"); return; } } @@ -195,8 +192,7 @@ pciide_pnpbios_attach(struct device *parent, struct device *self, aprint_error( "%s:%d:%d: can't allocate DMA maps, " "using PIO transfers\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - 0, drive); + device_xname(self), 0, drive); sc->sc_dma_ok = 0; sc->sc_wdcdev.sc_atac.atac_cap &= ~ATAC_CAP_DMA; sc->sc_wdcdev.irqack = NULL; diff --git a/sys/arch/landisk/dev/wdc_obio.c b/sys/arch/landisk/dev/wdc_obio.c index 9748620c822..a695ca5f006 100644 --- a/sys/arch/landisk/dev/wdc_obio.c +++ b/sys/arch/landisk/dev/wdc_obio.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_obio.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */ +/* $NetBSD: wdc_obio.c,v 1.2 2008/03/18 20:46:36 cube Exp $ */ /*- * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.1 2006/09/01 21:26:18 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.2 2008/03/18 20:46:36 cube Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -62,10 +62,10 @@ struct wdc_obio_softc { void *sc_ih; }; -static int wdc_obio_probe(struct device *, struct cfdata *, void *); -static void wdc_obio_attach(struct device *, struct device *, void *); +static int wdc_obio_probe(device_t, cfdata_t, void *); +static void wdc_obio_attach(device_t, device_t, void *); -CFATTACH_DECL(wdc_obio, sizeof(struct wdc_obio_softc), +CFATTACH_DECL_NEW(wdc_obio, sizeof(struct wdc_obio_softc), wdc_obio_probe, wdc_obio_attach, NULL, NULL); #define WDC_OBIO_REG_NPORTS WDC_NREG @@ -75,7 +75,7 @@ CFATTACH_DECL(wdc_obio, sizeof(struct wdc_obio_softc), #define WDC_OBIO_AUXREG_OFFSET 0x2c static int -wdc_obio_probe(struct device *parent, struct cfdata *cfp, void *aux) +wdc_obio_probe(device_t parent, cfdata_t cfp, void *aux) { struct obio_attach_args *oa = aux; struct ata_channel ch; @@ -135,15 +135,16 @@ out: } static void -wdc_obio_attach(struct device *parent, struct device *self, void *aux) +wdc_obio_attach(device_t parent, device_t self, void *aux) { - struct wdc_obio_softc *sc = (void *)self; + struct wdc_obio_softc *sc = device_private(self); struct obio_attach_args *oa = aux; struct wdc_regs *wdr; int i; - printf("\n"); + aprint_normal("\n"); + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_wdcdev.regs = wdr = &sc->sc_wdc_regs; wdr->cmd_iot = oa->oa_iot; @@ -153,7 +154,7 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux) || bus_space_map(wdr->ctl_iot, oa->oa_io[0].or_addr + WDC_OBIO_AUXREG_OFFSET, WDC_OBIO_AUXREG_SIZE, 0, &wdr->ctl_ioh)) { - printf(": couldn't map registers\n"); + aprint_error_dev(self, "couldn't map registers\n"); return; } @@ -161,7 +162,8 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux) if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i * 2, (i == 0) ? 2 : 1, &wdr->cmd_iohs[i]) != 0) { - printf(": couldn't subregion registers\n"); + aprint_error_dev(self, + "couldn't subregion registers\n"); return; } } diff --git a/sys/arch/mac68k/obio/wdc_obio.c b/sys/arch/mac68k/obio/wdc_obio.c index 618b8f78967..85af1f82243 100644 --- a/sys/arch/mac68k/obio/wdc_obio.c +++ b/sys/arch/mac68k/obio/wdc_obio.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_obio.c,v 1.22 2006/10/05 09:34:52 tsutsui Exp $ */ +/* $NetBSD: wdc_obio.c,v 1.23 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 2002 Takeshi Shibagaki All rights reserved. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.22 2006/10/05 09:34:52 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.23 2008/03/18 20:46:36 cube Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -73,11 +73,11 @@ struct wdc_obio_softc { void *sc_ih; }; -int wdc_obio_match(struct device *, struct cfdata *, void *); -void wdc_obio_attach(struct device *, struct device *, void *); +int wdc_obio_match(device_t, cfdata_t, void *); +void wdc_obio_attach(device_t, device_t, void *); void wdc_obio_intr(void *); -CFATTACH_DECL(wdc_obio, sizeof(struct wdc_obio_softc), +CFATTACH_DECL_NEW(wdc_obio, sizeof(struct wdc_obio_softc), wdc_obio_match, wdc_obio_attach, NULL, NULL); static bus_space_tag_t wdc_obio_isr_tag; @@ -85,7 +85,7 @@ static bus_space_handle_t wdc_obio_isr_hdl; static struct ata_channel *ch_sc; int -wdc_obio_match(struct device *parent, struct cfdata *match, void *aux) +wdc_obio_match(device_t parent, cfdata_t match, void *aux) { struct obio_attach_args *oa = (struct obio_attach_args *) aux; struct ata_channel ch; @@ -140,14 +140,15 @@ wdc_obio_match(struct device *parent, struct cfdata *match, void *aux) } void -wdc_obio_attach(struct device *parent, struct device *self, void *aux) +wdc_obio_attach(device_t parent, device_t self, void *aux) { - struct wdc_obio_softc *sc = (void *)self; + struct wdc_obio_softc *sc = device_private(self); struct wdc_regs *wdr; struct obio_attach_args *oa = aux; struct ata_channel *chp = &sc->sc_channel; int i; + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_wdcdev.regs = wdr = &sc->sc_wdc_regs; oa->oa_addr = IDEBase; @@ -155,8 +156,7 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux) if (bus_space_map(wdr->cmd_iot, oa->oa_addr, WDC_OBIO_REG_NPORTS, 0, &wdr->cmd_baseioh)) { - printf("%s: couldn't map registers\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(self, "couldn't map registers\n"); return; } @@ -167,8 +167,8 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux) if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, 4 * i, 4, &wdr->cmd_iohs[i]) != 0) { - printf("%s: unable to subregion control register\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(self, + "unable to subregion control register\n"); return; } } @@ -177,8 +177,7 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux) wdr->cmd_baseioh, WDC_OBIO_AUXREG_OFFSET, WDC_OBIO_AUXREG_NPORTS, &wdr->ctl_ioh)) { - printf("%s: unable to subregion aux register\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(self, "unable to subregion aux register\n"); return; } @@ -187,8 +186,7 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux) if (bus_space_map(wdc_obio_isr_tag, oa->oa_addr+WDC_OBIO_ISR_OFFSET, WDC_OBIO_ISR_NPORTS, 0, &wdc_obio_isr_hdl)) { - printf("%s: couldn't map intr status register\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(self, " couldn't map intr status register\n"); return; } @@ -198,7 +196,7 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux) /* * Quadra/Performa IDE generates pseudo Nubus intr at slot F */ - printf(" (Quadra/Performa series IDE interface)"); + aprint_normal(" (Quadra/Performa series IDE interface)"); add_nubus_intr(0xf, (void (*)(void*))wdc_obio_intr, (void *)sc); @@ -209,7 +207,7 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux) /* * PowerBook IDE generates pseudo NuBus intr at slot C */ - printf(" (PowerBook series IDE interface)"); + aprint_normal(" (PowerBook series IDE interface)"); add_nubus_intr(0xc, (void (*)(void*))wdc_obio_intr, (void *)sc); @@ -217,7 +215,7 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux) } ch_sc = chp; - if (device_cfdata(&sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & + if (device_cfdata(sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & ATAC_CAP_NOIRQ) sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_NOIRQ; sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA16; @@ -231,7 +229,7 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux) chp->ch_ndrive = 2; wdc_init_shadow_regs(chp); - printf("\n"); + aprint_normal("\n"); wdcattach(chp); } diff --git a/sys/arch/macppc/dev/kauai.c b/sys/arch/macppc/dev/kauai.c index 4ef73be706f..511c50d8b6f 100644 --- a/sys/arch/macppc/dev/kauai.c +++ b/sys/arch/macppc/dev/kauai.c @@ -1,4 +1,4 @@ -/* $NetBSD: kauai.c,v 1.22 2008/02/25 19:22:39 matt Exp $ */ +/* $NetBSD: kauai.c,v 1.23 2008/03/18 20:46:36 cube Exp $ */ /*- * Copyright (c) 2003 Tsubai Masanari. All rights reserved. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kauai.c,v 1.22 2008/02/25 19:22:39 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kauai.c,v 1.23 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -82,7 +82,7 @@ static void kauai_set_modes(struct ata_channel *); static void calc_timing_kauai(struct kauai_softc *, int); static int getnodebypci(pci_chipset_tag_t, pcitag_t); -CFATTACH_DECL(kauai, sizeof(struct kauai_softc), +CFATTACH_DECL_NEW(kauai, sizeof(struct kauai_softc), kauai_match, kauai_attach, NULL, wdcactivate); int @@ -113,6 +113,8 @@ kauai_attach(device_t parent, device_t self, void *aux) paddr_t regbase, dmabase; int node, reg[5], i; + sc->sc_wdcdev.sc_atac.atac_dev = self; + #ifdef DIAGNOSTIC if ((vaddr_t)sc->sc_dmacmd & 0x0f) { aprint_error(": bad dbdma alignment\n"); diff --git a/sys/arch/macppc/dev/wdc_obio.c b/sys/arch/macppc/dev/wdc_obio.c index 91f2794bb68..b3a78a22179 100644 --- a/sys/arch/macppc/dev/wdc_obio.c +++ b/sys/arch/macppc/dev/wdc_obio.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_obio.c,v 1.48 2008/02/25 19:22:39 matt Exp $ */ +/* $NetBSD: wdc_obio.c,v 1.49 2008/03/18 20:46:36 cube Exp $ */ /*- * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.48 2008/02/25 19:22:39 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.49 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -93,7 +93,7 @@ static void wdc_obio_select(struct ata_channel *, int); static void adjust_timing(struct ata_channel *); static void ata4_adjust_timing(struct ata_channel *); -CFATTACH_DECL(wdc_obio, sizeof(struct wdc_obio_softc), +CFATTACH_DECL_NEW(wdc_obio, sizeof(struct wdc_obio_softc), wdc_obio_match, wdc_obio_attach, wdc_obio_detach, wdcactivate); static const char * const ata_names[] = { @@ -132,7 +132,8 @@ wdc_obio_attach(device_t parent, device_t self, void *aux) int use_dma = 0; char path[80]; - if (device_cfdata(&sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & + sc->sc_wdcdev.sc_atac.atac_dev = self; + if (device_cfdata(sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & WDC_OPTIONS_DMA) { if (ca->ca_nreg >= 16 || ca->ca_nintr == -1) use_dma = 1; /* XXX Don't work yet. */ diff --git a/sys/arch/mips/adm5120/dev/wdc_extio.c b/sys/arch/mips/adm5120/dev/wdc_extio.c index 138c3a11213..7c59b4bb5ff 100644 --- a/sys/arch/mips/adm5120/dev/wdc_extio.c +++ b/sys/arch/mips/adm5120/dev/wdc_extio.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_extio.c,v 1.1 2007/03/20 08:52:02 dyoung Exp $ */ +/* $NetBSD: wdc_extio.c,v 1.2 2008/03/18 20:46:36 cube Exp $ */ /*- * Copyright (c) 2007 David Young. All rights reserved. @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_extio.c,v 1.1 2007/03/20 08:52:02 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_extio.c,v 1.2 2008/03/18 20:46:36 cube Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -111,10 +111,10 @@ struct wdc_extio_softc { struct gpio_pinmap sc_pinmap; }; -int wdc_extio_match(struct device *, struct cfdata *, void *); -void wdc_extio_attach(struct device *, struct device *, void *); +int wdc_extio_match(device_t, cfdata_t, void *); +void wdc_extio_attach(device_t, device_t, void *); -CFATTACH_DECL(wdc_extio, sizeof(struct wdc_extio_softc), +CFATTACH_DECL_NEW(wdc_extio, sizeof(struct wdc_extio_softc), wdc_extio_match, wdc_extio_attach, NULL, NULL); #if 0 @@ -178,7 +178,7 @@ wdc_extio_map(struct extio_attach_args *ea, struct wdc_regs *wdr, if (bus_space_map(wdr->cmd_iot, ea->ea_addr, WDC_OBIO_CF_WINSIZE, 0, &wdr->cmd_baseioh)) { - printf("%s: couldn't map registers\n", __func__); + aprint_error("%s: couldn't map registers\n", __func__); goto post_gpio_err; } @@ -186,7 +186,8 @@ wdc_extio_map(struct extio_attach_args *ea, struct wdc_regs *wdr, if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, WDC_OBIO_REG_OFFSET + i, 1, &wdr->cmd_iohs[i]) != 0) { - printf("%s: unable to subregion control register\n", + aprint_error( + "%s: unable to subregion control register\n", __func__); goto post_bus_err; } @@ -194,12 +195,14 @@ wdc_extio_map(struct extio_attach_args *ea, struct wdc_regs *wdr, if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, WDC_OBIO_DATA_OFFSET, 2, &wdr->cmd_iohs[wd_data]) != 0) { - printf("%s: unable to subregion data register\n", __func__); + aprint_error("%s: unable to subregion data register\n", + __func__); goto post_bus_err; } if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, WDC_OBIO_AUXREG_OFFSET, 1, &wdr->ctl_ioh)) { - printf("%s: unable to subregion aux register\n", __func__); + aprint_error("%s: unable to subregion aux register\n", + __func__); goto post_bus_err; } @@ -234,7 +237,7 @@ wdc_extio_datain(struct ata_channel *chp, int flags, void *bf, size_t len) } int -wdc_extio_match(struct device *parent, struct cfdata *cf, void *aux) +wdc_extio_match(device_t parent, cfdata_t cf, void *aux) { struct extio_attach_args *ea = (struct extio_attach_args *)aux; struct ata_channel ch; @@ -277,9 +280,9 @@ wdc_extio_match(struct device *parent, struct cfdata *cf, void *aux) } void -wdc_extio_attach(struct device *parent, struct device *self, void *aux) +wdc_extio_attach(device_t parent, device_t self, void *aux) { - struct wdc_extio_softc *sc = (void *)self; + struct wdc_extio_softc *sc = device_private(self); struct wdc_regs *wdr; struct extio_attach_args *ea = aux; struct ata_channel *chp = &sc->sc_channel; @@ -287,6 +290,7 @@ wdc_extio_attach(struct device *parent, struct device *self, void *aux) WDC_EXTIO_DPRINTF("%s: enter\n", __func__); + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_pinmap.pm_map = &sc->sc_map; sc->sc_wdcdev.regs = wdr = &sc->sc_wdc_regs; chp->ch_atac = &sc->sc_wdcdev.sc_atac; @@ -294,9 +298,9 @@ wdc_extio_attach(struct device *parent, struct device *self, void *aux) if (wdc_extio_map(ea, wdr, chp, &sc->sc_gpio, &sc->sc_pinmap) == -1) return; - cf = device_cfdata(&sc->sc_wdcdev.sc_atac.atac_dev); + cf = device_cfdata(sc->sc_wdcdev.sc_atac.atac_dev); if (cf->cf_flags != -1) { - printf(" flags %04x", cf->cf_flags); + aprint_normal(" flags %04x", cf->cf_flags); sc->sc_wdcdev.sc_atac.atac_cap |= cf->cf_flags & (ATAC_CAP_NOIRQ|ATAC_CAP_DATA32|ATAC_CAP_DATA16); sc->sc_wdcdev.cap |= cf->cf_flags & @@ -313,7 +317,7 @@ wdc_extio_attach(struct device *parent, struct device *self, void *aux) chp->ch_queue = &sc->sc_chqueue; chp->ch_ndrive = 2; - printf("\n"); + aprint_normal("\n"); wdcattach(chp); } diff --git a/sys/arch/playstation2/dev/wdc_spd.c b/sys/arch/playstation2/dev/wdc_spd.c index 04d8d142e7a..5577d78b739 100644 --- a/sys/arch/playstation2/dev/wdc_spd.c +++ b/sys/arch/playstation2/dev/wdc_spd.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_spd.c,v 1.22 2006/01/16 20:30:19 bouyer Exp $ */ +/* $NetBSD: wdc_spd.c,v 1.23 2008/03/18 20:46:36 cube Exp $ */ /*- * Copyright (c) 2001, 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_spd.c,v 1.22 2006/01/16 20:30:19 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_spd.c,v 1.23 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -88,10 +88,10 @@ struct wdc_spd_softc { #define STATIC static #endif -STATIC int wdc_spd_match(struct device *, struct cfdata *, void *); -STATIC void wdc_spd_attach(struct device *, struct device *, void *); +STATIC int wdc_spd_match(device_t, cfdata_t, void *); +STATIC void wdc_spd_attach(device_t, device_t, void *); -CFATTACH_DECL(wdc_spd, sizeof (struct wdc_spd_softc), +CFATTACH_DECL_NEW(wdc_spd, sizeof (struct wdc_spd_softc), wdc_spd_match, wdc_spd_attach, NULL, NULL); extern struct cfdriver wdc_cd; @@ -170,7 +170,7 @@ STATIC const struct playstation2_bus_space _wdc_spd_space = { }; int -wdc_spd_match(struct device *parent, struct cfdata *cf, void *aux) +wdc_spd_match(device_t parent, cfdata_t cf, void *aux) { struct spd_attach_args *spa = aux; struct ata_channel ch; @@ -198,15 +198,16 @@ wdc_spd_match(struct device *parent, struct cfdata *cf, void *aux) } void -wdc_spd_attach(struct device *parent, struct device *self, void *aux) +wdc_spd_attach(device_t parent, device_t self, void *aux) { struct spd_attach_args *spa = aux; - struct wdc_spd_softc *sc = (void *)self; + struct wdc_spd_softc *sc = device_private(self); struct wdc_softc *wdc = &sc->sc_wdcdev; struct ata_channel *ch = &sc->sc_channel; - printf(": %s\n", spa->spa_product_name); + aprint_normal(": %s\n", spa->spa_product_name); + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_wdcdev.regs = &sc->sc_wdc_regs; wdc->sc_atac.atac_cap = diff --git a/sys/arch/prep/pnpbus/wdc_pnpbus.c b/sys/arch/prep/pnpbus/wdc_pnpbus.c index 9f368b48450..093ff278c2b 100644 --- a/sys/arch/prep/pnpbus/wdc_pnpbus.c +++ b/sys/arch/prep/pnpbus/wdc_pnpbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_pnpbus.c,v 1.6 2007/03/20 05:58:40 garbled Exp $ */ +/* $NetBSD: wdc_pnpbus.c,v 1.7 2008/03/18 20:46:36 cube Exp $ */ /*- * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_pnpbus.c,v 1.6 2007/03/20 05:58:40 garbled Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_pnpbus.c,v 1.7 2008/03/18 20:46:36 cube Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -67,14 +67,14 @@ struct wdc_pnpbus_softc { void *sc_ih; }; -static int wdc_pnpbus_probe(struct device *, struct cfdata *, void *); -static void wdc_pnpbus_attach(struct device *, struct device *, void *); +static int wdc_pnpbus_probe(device_t, cfdata_t, void *); +static void wdc_pnpbus_attach(device_t, device_t, void *); -CFATTACH_DECL(wdc_pnpbus, sizeof(struct wdc_pnpbus_softc), +CFATTACH_DECL_NEW(wdc_pnpbus, sizeof(struct wdc_pnpbus_softc), wdc_pnpbus_probe, wdc_pnpbus_attach, NULL, NULL); static int -wdc_pnpbus_probe(struct device *parent, struct cfdata *match, void *aux) +wdc_pnpbus_probe(device_t parent, cfdata_t match, void *aux) { struct pnpbus_dev_attach_args *pna = aux; int ret = 0; @@ -103,13 +103,14 @@ wdc_pnpbus_probe(struct device *parent, struct cfdata *match, void *aux) } static void -wdc_pnpbus_attach(struct device *parent, struct device *self, void *aux) +wdc_pnpbus_attach(device_t parent, device_t self, void *aux) { - struct wdc_pnpbus_softc *sc = (void *)self; + struct wdc_pnpbus_softc *sc = device_private(self); struct wdc_regs *wdr; struct pnpbus_dev_attach_args *pna = aux; int cmd_iobase, cmd_len, aux_iobase, aux_len, i; + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_wdcdev.regs = wdr = &sc->sc_wdc_regs; wdr->cmd_iot = pna->pna_iot; @@ -119,8 +120,7 @@ wdc_pnpbus_attach(struct device *parent, struct device *self, void *aux) if (pnpbus_io_map(&pna->pna_res, 0, &wdr->cmd_iot, &wdr->cmd_baseioh) || pnpbus_io_map(&pna->pna_res, 1, &wdr->ctl_iot, &wdr->ctl_ioh)) { - aprint_error("%s: couldn't map registers\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(self, "couldn't map registers\n"); } for (i = 0; i < cmd_len; i++) { @@ -137,7 +137,7 @@ wdc_pnpbus_attach(struct device *parent, struct device *self, void *aux) sc->sc_wdcdev.cap |= WDC_CAPABILITY_PREATA; sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA16; - if (device_cfdata(&sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & + if (device_cfdata(sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & WDC_OPTIONS_32) sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA32; diff --git a/sys/dev/ata/ata.c b/sys/dev/ata/ata.c index c6296382bcc..2ee23429346 100644 --- a/sys/dev/ata/ata.c +++ b/sys/dev/ata/ata.c @@ -1,4 +1,4 @@ -/* $NetBSD: ata.c,v 1.97 2008/02/29 06:38:28 dyoung Exp $ */ +/* $NetBSD: ata.c,v 1.98 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.97 2008/02/29 06:38:28 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.98 2008/03/18 20:46:36 cube Exp $"); #include "opt_ata.h" @@ -165,7 +165,7 @@ ata_channel_attach(struct ata_channel *chp) chp->ch_queue->queue_flags = 0; chp->ch_queue->active_xfer = NULL; - chp->atabus = config_found_ia(&chp->ch_atac->atac_dev, "ata", chp, + chp->atabus = config_found_ia(chp->ch_atac->atac_dev, "ata", chp, atabusprint); } @@ -219,7 +219,7 @@ atabusconfig(struct atabus_softc *atabus_sc) * Fake the autoconfig "not configured" message */ aprint_normal("atapibus at %s not configured\n", - device_xname(&atac->atac_dev)); + device_xname(atac->atac_dev)); chp->atapibus = NULL; s = splbio(); for (i = 0; i < chp->ch_ndrive; i++) @@ -241,7 +241,7 @@ atabusconfig(struct atabus_softc *atabus_sc) adev.adev_channel = chp->ch_channel; adev.adev_openings = 1; adev.adev_drv_data = &chp->ch_drive[i]; - chp->ata_drives[i] = config_found_ia(&atabus_sc->sc_dev, + chp->ata_drives[i] = config_found_ia(atabus_sc->sc_dev, "ata_hl", &adev, ataprint); if (chp->ata_drives[i] != NULL) ata_probe_caps(&chp->ch_drive[i]); @@ -406,6 +406,8 @@ atabus_attach(device_t parent, device_t self, void *aux) aprint_normal("\n"); aprint_naive("\n"); + sc->sc_dev = self; + if (ata_addref(chp)) return; @@ -575,7 +577,7 @@ atabus_childdetached(device_t self, device_t child) aprint_error_dev(self, "unknown child %p", (const void *)child); } -CFATTACH_DECL2(atabus, sizeof(struct atabus_softc), +CFATTACH_DECL2_NEW(atabus, sizeof(struct atabus_softc), atabus_match, atabus_attach, atabus_detach, atabus_activate, NULL, atabus_childdetached); @@ -1018,7 +1020,7 @@ ata_addref(struct ata_channel *chp) s = splbio(); if (adapt->adapt_refcnt++ == 0 && adapt->adapt_enable != NULL) { - error = (*adapt->adapt_enable)(&atac->atac_dev, 1); + error = (*adapt->adapt_enable)(atac->atac_dev, 1); if (error) adapt->adapt_refcnt--; } @@ -1036,7 +1038,7 @@ ata_delref(struct ata_channel *chp) s = splbio(); if (adapt->adapt_refcnt-- == 1 && adapt->adapt_enable != NULL) - (void) (*adapt->adapt_enable)(&atac->atac_dev, 0); + (void) (*adapt->adapt_enable)(atac->atac_dev, 0); splx(s); } @@ -1053,7 +1055,7 @@ ata_print_modes(struct ata_channel *chp) continue; aprint_verbose("%s(%s:%d:%d): using PIO mode %d", device_xname(drvp->drv_softc), - device_xname(&atac->atac_dev), + device_xname(atac->atac_dev), chp->ch_channel, drvp->drive, drvp->PIO_mode); #if NATA_DMA if (drvp->drive_flags & DRIVE_DMA) @@ -1119,8 +1121,9 @@ ata_downgrade_mode(struct ata_drive_datas *drvp, int flags) */ if ((drvp->drive_flags & DRIVE_UDMA) && drvp->UDMA_mode >= 2) { drvp->UDMA_mode--; - printf("%s: transfer error, downgrading to Ultra-DMA mode %d\n", - device_xname(drv_dev), drvp->UDMA_mode); + aprint_error_dev(drv_dev, + "transfer error, downgrading to Ultra-DMA mode %d\n", + drvp->UDMA_mode); } #endif @@ -1130,8 +1133,9 @@ ata_downgrade_mode(struct ata_drive_datas *drvp, int flags) else if (drvp->drive_flags & (DRIVE_DMA | DRIVE_UDMA)) { drvp->drive_flags &= ~(DRIVE_DMA | DRIVE_UDMA); drvp->PIO_mode = drvp->PIO_cap; - printf("%s: transfer error, downgrading to PIO mode %d\n", - device_xname(drv_dev), drvp->PIO_mode); + aprint_error_dev(drv_dev, + "transfer error, downgrading to PIO mode %d\n", + drvp->PIO_mode); } else /* already using PIO, can't downgrade */ return 0; @@ -1179,8 +1183,7 @@ ata_probe_caps(struct ata_drive_datas *drvp) drvp->drive_flags &= ~DRIVE_CAP32; splx(s); } else { - aprint_verbose("%s: 32-bit data port\n", - device_xname(drv_dev)); + aprint_verbose_dev(drv_dev, "32-bit data port\n"); } } #if 0 /* Some ultra-DMA drives claims to only support ATA-3. sigh */ @@ -1188,8 +1191,8 @@ ata_probe_caps(struct ata_drive_datas *drvp) params.atap_ata_major != 0xffff) { for (i = 14; i > 0; i--) { if (params.atap_ata_major & (1 << i)) { - aprint_verbose("%s: ATA version %d\n", - device_xname(drv_dev), i); + aprint_verbose_dev(drv_dev, + "ATA version %d\n", i); drvp->ata_vers = i; break; } @@ -1234,8 +1237,8 @@ ata_probe_caps(struct ata_drive_datas *drvp) AT_WAIT) != CMD_OK) continue; if (!printed) { - aprint_verbose("%s: drive supports PIO mode %d", - device_xname(drv_dev), i + 3); + aprint_verbose_dev(drv_dev, + "drive supports PIO mode %d", i + 3); sep = ","; printed = 1; } @@ -1411,7 +1414,7 @@ atabusopen(dev_t dev, int flag, int fmt, int error, unit = minor(dev); if (unit >= atabus_cd.cd_ndevs || - (sc = atabus_cd.cd_devs[unit]) == NULL) + (sc = device_private(atabus_cd.cd_devs[unit])) == NULL) return (ENXIO); if (sc->sc_flags & ATABUSCF_OPEN) @@ -1430,7 +1433,8 @@ int atabusclose(dev_t dev, int flag, int fmt, struct lwp *l) { - struct atabus_softc *sc = atabus_cd.cd_devs[minor(dev)]; + struct atabus_softc *sc = + device_private(atabus_cd.cd_devs[minor(dev)]); ata_delref(sc->sc_chan); @@ -1443,7 +1447,8 @@ int atabusioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l) { - struct atabus_softc *sc = atabus_cd.cd_devs[minor(dev)]; + struct atabus_softc *sc = + device_private(atabus_cd.cd_devs[minor(dev)]); struct ata_channel *chp = sc->sc_chan; int min_drive, max_drive, drive; int error; diff --git a/sys/dev/ata/ata_raid_adaptec.c b/sys/dev/ata/ata_raid_adaptec.c index 7a1c54ba89f..1bb9cb11580 100644 --- a/sys/dev/ata/ata_raid_adaptec.c +++ b/sys/dev/ata/ata_raid_adaptec.c @@ -1,4 +1,4 @@ -/* $NetBSD: ata_raid_adaptec.c,v 1.7 2008/02/02 16:15:01 mjf Exp $ */ +/* $NetBSD: ata_raid_adaptec.c,v 1.8 2008/03/18 20:46:36 cube Exp $ */ /*- * Copyright (c) 2000,2001,2002 Søren Schmidt <sos@FreeBSD.org> @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ata_raid_adaptec.c,v 1.7 2008/02/02 16:15:01 mjf Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata_raid_adaptec.c,v 1.8 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/buf.h> @@ -78,10 +78,10 @@ ata_raid_read_config_adaptec(struct wd_softc *sc) info = malloc(sizeof(*info), M_DEVBUF, M_WAITOK); - bmajor = devsw_name2blk(sc->sc_dev.dv_xname, NULL, 0); + bmajor = devsw_name2blk(device_xname(sc->sc_dev), NULL, 0); /* Get a vnode for the raw partition of this disk. */ - dev = MAKEDISKDEV(bmajor, device_unit(&sc->sc_dev), RAW_PART); + dev = MAKEDISKDEV(bmajor, device_unit(sc->sc_dev), RAW_PART); error = bdevvp(dev, &vp); if (error) goto out; @@ -97,8 +97,8 @@ ata_raid_read_config_adaptec(struct wd_softc *sc) VOP_CLOSE(vp, FREAD, NOCRED); vput(vp); if (error) { - printf("%s: error %d reading Adaptec config block\n", - sc->sc_dev.dv_xname, error); + aprint_error_dev(sc->sc_dev, + "error %d reading Adaptec config block\n", error); goto out; } @@ -110,7 +110,7 @@ ata_raid_read_config_adaptec(struct wd_softc *sc) /* Check the signature. */ if (info->magic_0 != ADP_MAGIC_0 || info->magic_3 != ADP_MAGIC_3) { DPRINTF(("%s: Adaptec signature check failed\n", - sc->sc_dev.dv_xname)); + device_xname(sc->sc_dev))); error = ESRCH; goto out; } @@ -145,8 +145,9 @@ ata_raid_read_config_adaptec(struct wd_softc *sc) break; default: - aprint_error("%s: unknown Adaptec RAID type 0x%02x\n", - sc->sc_dev.dv_xname, info->configs[0].type); + aprint_error_dev(sc->sc_dev, + "unknown Adaptec RAID type 0x%02x\n", + info->configs[0].type); error = EINVAL; goto out; } @@ -165,18 +166,18 @@ ata_raid_read_config_adaptec(struct wd_softc *sc) aai->aai_interleave = aai->aai_capacity; } - atabus = (struct atabus_softc *) device_parent(&sc->sc_dev); + atabus = device_private(device_parent(sc->sc_dev)); drive = atabus->sc_chan->ch_channel; if (drive >= aai->aai_ndisks) { - aprint_error("%s: drive number %d doesn't make sense within " - "%d-disk array\n", - sc->sc_dev.dv_xname, drive, aai->aai_ndisks); + aprint_error_dev(sc->sc_dev, + "drive number %d doesn't make sense within %d-disk " + "array\n", drive, aai->aai_ndisks); error = EINVAL; goto out; } adi = &aai->aai_disks[drive]; - adi->adi_dev = &sc->sc_dev; + adi->adi_dev = sc->sc_dev; adi->adi_status = ADI_S_ONLINE | ADI_S_ASSIGNED; adi->adi_sectors = aai->aai_capacity; adi->adi_compsize = be32toh(info->configs[drive+1].sectors); diff --git a/sys/dev/ata/ata_raid_promise.c b/sys/dev/ata/ata_raid_promise.c index 7c06802bdee..a996bc6a0a7 100644 --- a/sys/dev/ata/ata_raid_promise.c +++ b/sys/dev/ata/ata_raid_promise.c @@ -1,4 +1,4 @@ -/* $NetBSD: ata_raid_promise.c,v 1.10 2008/02/02 16:15:02 mjf Exp $ */ +/* $NetBSD: ata_raid_promise.c,v 1.11 2008/03/18 20:46:36 cube Exp $ */ /*- * Copyright (c) 2000,2001,2002 Søren Schmidt <sos@FreeBSD.org> @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ata_raid_promise.c,v 1.10 2008/02/02 16:15:02 mjf Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata_raid_promise.c,v 1.11 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/buf.h> @@ -78,10 +78,10 @@ ata_raid_read_config_promise(struct wd_softc *sc) info = malloc(sizeof(*info), M_DEVBUF, M_WAITOK); - bmajor = devsw_name2blk(sc->sc_dev.dv_xname, NULL, 0); + bmajor = devsw_name2blk(device_xname(sc->sc_dev), NULL, 0); /* Get a vnode for the raw partition of this disk. */ - dev = MAKEDISKDEV(bmajor, device_unit(&sc->sc_dev), RAW_PART); + dev = MAKEDISKDEV(bmajor, device_unit(sc->sc_dev), RAW_PART); error = bdevvp(dev, &vp); if (error) goto out; @@ -97,15 +97,15 @@ ata_raid_read_config_promise(struct wd_softc *sc) VOP_CLOSE(vp, FREAD, NOCRED); vput(vp); if (error) { - printf("%s: error %d reading Promise config block\n", - sc->sc_dev.dv_xname, error); + aprint_error_dev(sc->sc_dev, + "error %d reading Promise config block\n", error); goto out; } /* Check the signature. */ if (strncmp(info->promise_id, PR_MAGIC, sizeof(PR_MAGIC)) != 0) { DPRINTF(("%s: Promise signature check failed\n", - sc->sc_dev.dv_xname)); + device_xname(sc->sc_dev))); error = ESRCH; goto out; } @@ -115,14 +115,15 @@ ata_raid_read_config_promise(struct wd_softc *sc) count++) cksum += *ckptr++; if (cksum != *ckptr) { - DPRINTF(("%s: Promise checksum failed\n", sc->sc_dev.dv_xname)); + DPRINTF(("%s: Promise checksum failed\n", + device_xname(sc->sc_dev))); error = ESRCH; goto out; } if (info->raid.integrity != PR_I_VALID) { DPRINTF(("%s: Promise config block marked invalid\n", - sc->sc_dev.dv_xname)); + device_xname(sc->sc_dev))); error = ESRCH; goto out; } @@ -163,8 +164,9 @@ ata_raid_read_config_promise(struct wd_softc *sc) break; default: - printf("%s: unknown Promise RAID type 0x%02x\n", - sc->sc_dev.dv_xname, info->raid.type); + aprint_error_dev(sc->sc_dev, + "unknown Promise RAID type 0x%02x\n", + info->raid.type); error = EINVAL; goto out; } @@ -197,7 +199,7 @@ ata_raid_read_config_promise(struct wd_softc *sc) } adi = &aai->aai_disks[info->raid.disk_number]; if (adi->adi_status) { - adi->adi_dev = &sc->sc_dev; + adi->adi_dev = sc->sc_dev; adi->adi_sectors = info->raid.disk_sectors; adi->adi_compsize = sc->sc_capacity - aai->aai_reserved; } diff --git a/sys/dev/ata/ata_raid_via.c b/sys/dev/ata/ata_raid_via.c index 86c12289314..51d8081af47 100644 --- a/sys/dev/ata/ata_raid_via.c +++ b/sys/dev/ata/ata_raid_via.c @@ -1,4 +1,4 @@ -/* $NetBSD: ata_raid_via.c,v 1.4 2008/02/07 13:48:33 xtraeme Exp $ */ +/* $NetBSD: ata_raid_via.c,v 1.5 2008/03/18 20:46:36 cube Exp $ */ /*- * Copyright (c) 2000,2001,2002 Søren Schmidt <sos@FreeBSD.org> @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ata_raid_via.c,v 1.4 2008/02/07 13:48:33 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata_raid_via.c,v 1.5 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/buf.h> @@ -127,10 +127,10 @@ ata_raid_read_config_via(struct wd_softc *sc) info = malloc(sizeof(*info), M_DEVBUF, M_WAITOK); - bmajor = devsw_name2blk(sc->sc_dev.dv_xname, NULL, 0); + bmajor = devsw_name2blk(device_xname(sc->sc_dev), NULL, 0); /* Get a vnode for the raw partition of this disk. */ - dev = MAKEDISKDEV(bmajor, device_unit(&sc->sc_dev), RAW_PART); + dev = MAKEDISKDEV(bmajor, device_unit(sc->sc_dev), RAW_PART); error = bdevvp(dev, &vp); if (error) goto out; @@ -146,8 +146,8 @@ ata_raid_read_config_via(struct wd_softc *sc) VOP_CLOSE(vp, FREAD, NOCRED); vput(vp); if (error) { - printf("%s: error %d reading VIA V-RAID config block\n", - sc->sc_dev.dv_xname, error); + aprint_error_dev(sc->sc_dev, + "error %d reading VIA V-RAID config block\n", error); goto out; } @@ -159,7 +159,7 @@ ata_raid_read_config_via(struct wd_softc *sc) /* Check the signature. */ if (info->magic != VIA_MAGIC) { DPRINTF(("%s: VIA V-RAID signature check failed\n", - sc->sc_dev.dv_xname)); + device_xname(sc->sc_dev))); error = ESRCH; goto out; } @@ -173,7 +173,7 @@ ata_raid_read_config_via(struct wd_softc *sc) checksum += *ptr++; if (checksum != info->checksum) { DPRINTF(("%s: VIA V-RAID checksum failed 0x%02x != 0x%02x\n", - sc->sc_dev.dv_xname, checksum, info->checksum)); + device_xname(sc->sc_dev), checksum, info->checksum)); error = ESRCH; goto out; } @@ -212,8 +212,8 @@ ata_raid_read_config_via(struct wd_softc *sc) break; default: - aprint_error("%s: unknown VIA V-RAID type 0x%02x\n", - sc->sc_dev.dv_xname, info->type); + aprint_error_dev(sc->sc_dev, + "unknown VIA V-RAID type 0x%02x\n", info->type); error = EINVAL; goto out; } @@ -235,18 +235,18 @@ ata_raid_read_config_via(struct wd_softc *sc) if (aai->aai_interleave == 0) aai->aai_interleave = aai->aai_capacity; - atabus = (struct atabus_softc *) device_parent(&sc->sc_dev); + atabus = device_private(device_parent(sc->sc_dev)); drive = atabus->sc_chan->ch_channel; if (drive >= aai->aai_ndisks) { - aprint_error("%s: drive number %d doesn't make sense within " - "%d-disk array\n", - sc->sc_dev.dv_xname, drive, aai->aai_ndisks); + aprint_error_dev(sc->sc_dev, + "drive number %d doesn't make sense within %d-disk " + "array\n", drive, aai->aai_ndisks); error = EINVAL; goto out; } adi = &aai->aai_disks[drive]; - adi->adi_dev = &sc->sc_dev; + adi->adi_dev = sc->sc_dev; adi->adi_status = ADI_S_ONLINE | ADI_S_ASSIGNED; adi->adi_sectors = aai->aai_capacity; adi->adi_compsize = info->disk_sectors; diff --git a/sys/dev/ata/ata_wdc.c b/sys/dev/ata/ata_wdc.c index 8b5ed667cf3..5d93d079498 100644 --- a/sys/dev/ata/ata_wdc.c +++ b/sys/dev/ata/ata_wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ata_wdc.c,v 1.87 2007/10/19 11:59:36 ad Exp $ */ +/* $NetBSD: ata_wdc.c,v 1.88 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 1998, 2001, 2003 Manuel Bouyer. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.87 2007/10/19 11:59:36 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.88 2008/03/18 20:46:36 cube Exp $"); #include "opt_ata.h" @@ -194,7 +194,7 @@ wdc_ata_bio_start(struct ata_channel *chp, struct ata_xfer *xfer) const char *errstring; ATADEBUG_PRINT(("wdc_ata_bio_start %s:%d:%d\n", - atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive), + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive), DEBUG_XFERS); /* Do control operations specially. */ @@ -302,13 +302,13 @@ ready: return; ctrltimeout: printf("%s:%d:%d: %s timed out\n", - atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive, + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, errstring); ata_bio->error = TIMEOUT; goto ctrldone; ctrlerror: printf("%s:%d:%d: %s ", - atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive, + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, errstring); if (chp->ch_status & WDCS_DWF) { printf("drive fault\n"); @@ -342,7 +342,7 @@ _wdc_ata_bio_start(struct ata_channel *chp, struct ata_xfer *xfer) #endif ATADEBUG_PRINT(("_wdc_ata_bio_start %s:%d:%d\n", - atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive), + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive), DEBUG_INTR | DEBUG_XFERS); #if NATA_DMA || NATA_PIOBM @@ -554,7 +554,7 @@ again: if (wdc_wait_for_drq(chp, ATA_DELAY, AT_POLL) != 0) { printf("%s:%d:%d: timeout waiting for DRQ, " "st=0x%02x, err=0x%02x\n", - atac->atac_dev.dv_xname, chp->ch_channel, + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, chp->ch_status, chp->ch_error); if (wdc_ata_err(drvp, ata_bio) != WDC_ATA_ERR) ata_bio->error = TIMEOUT; @@ -601,7 +601,7 @@ intr: return; timeout: printf("%s:%d:%d: not ready, st=0x%02x, err=0x%02x\n", - atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive, + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, chp->ch_status, chp->ch_error); if (wdc_ata_err(drvp, ata_bio) != WDC_ATA_ERR) ata_bio->error = TIMEOUT; @@ -619,14 +619,14 @@ wdc_ata_bio_intr(struct ata_channel *chp, struct ata_xfer *xfer, int irq) int drv_err; ATADEBUG_PRINT(("wdc_ata_bio_intr %s:%d:%d\n", - atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive), + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive), DEBUG_INTR | DEBUG_XFERS); /* Is it not a transfer, but a control operation? */ if (drvp->state < READY) { printf("%s:%d:%d: bad state %d in wdc_ata_bio_intr\n", - atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive, + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, drvp->state); panic("wdc_ata_bio_intr: bad state"); } @@ -654,7 +654,7 @@ wdc_ata_bio_intr(struct ata_channel *chp, struct ata_xfer *xfer, int irq) if (irq && (xfer->c_flags & C_TIMEOU) == 0) return 0; /* IRQ was not for us */ printf("%s:%d:%d: device timeout, c_bcount=%d, c_skip%d\n", - atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive, + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, xfer->c_bcount, xfer->c_skip); ata_bio->error = TIMEOUT; wdc_ata_bio_done(chp, xfer); @@ -678,7 +678,8 @@ wdc_ata_bio_intr(struct ata_channel *chp, struct ata_xfer *xfer, int irq) if (wdcwait(chp, WDCS_DRDY | WDCS_DRQ, WDCS_DRDY, ATA_DELAY, ATA_POLL) == WDCWAIT_TOUT) { printf("%s:%d:%d: polled transfer timed out " - "(st=0x%x)\n", atac->atac_dev.dv_xname, + "(st=0x%x)\n", + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, chp->ch_status); ata_bio->error = TIMEOUT; @@ -694,7 +695,8 @@ wdc_ata_bio_intr(struct ata_channel *chp, struct ata_xfer *xfer, int irq) if (chp->ch_status & WDCS_DRQ) { if (drv_err != WDC_ATA_ERR) { printf("%s:%d:%d: intr with DRQ (st=0x%x)\n", - atac->atac_dev.dv_xname, chp->ch_channel, + device_xname(atac->atac_dev), + chp->ch_channel, xfer->c_drive, chp->ch_status); ata_bio->error = TIMEOUT; drv_err = WDC_ATA_ERR; @@ -717,7 +719,7 @@ wdc_ata_bio_intr(struct ata_channel *chp, struct ata_xfer *xfer, int irq) if ((ata_bio->flags & ATA_READ) != 0) { if ((chp->ch_status & WDCS_DRQ) != WDCS_DRQ) { printf("%s:%d:%d: read intr before drq\n", - atac->atac_dev.dv_xname, chp->ch_channel, + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive); ata_bio->error = TIMEOUT; wdc_ata_bio_done(chp, xfer); @@ -795,8 +797,8 @@ wdc_ata_bio_done(struct ata_channel *chp, struct ata_xfer *xfer) int drive = xfer->c_drive; ATADEBUG_PRINT(("wdc_ata_bio_done %s:%d:%d: flags 0x%x\n", - chp->ch_atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive, - (u_int)xfer->c_flags), + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, + xfer->c_drive, (u_int)xfer->c_flags), DEBUG_XFERS); callout_stop(&chp->ch_callout); diff --git a/sys/dev/ata/atavar.h b/sys/dev/ata/atavar.h index b5e5bd0688b..8ac43f8055c 100644 --- a/sys/dev/ata/atavar.h +++ b/sys/dev/ata/atavar.h @@ -1,4 +1,4 @@ -/* $NetBSD: atavar.h,v 1.75 2007/12/09 20:27:54 jmcneill Exp $ */ +/* $NetBSD: atavar.h,v 1.76 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. @@ -98,7 +98,7 @@ struct ata_queue { /* ATA bus instance state information. */ struct atabus_softc { - struct device sc_dev; + device_t sc_dev; struct ata_channel *sc_chan; int sc_flags; #define ATABUSCF_OPEN 0x01 @@ -185,7 +185,7 @@ struct ata_drive_datas { /* Callbacks into the drive's driver. */ void (*drv_done)(void *); /* transfer is done */ - struct device *drv_softc; /* ATA drives softc, if any */ + device_t drv_softc; /* ATA drives softc, if any */ void *chnl_softc; /* channel softc */ }; @@ -380,7 +380,7 @@ struct ata_channel { * XXX There is still some lingering wdc-centricity here. */ struct atac_softc { - struct device atac_dev; /* generic device info */ + device_t atac_dev; /* generic device info */ int atac_cap; /* controller capabilities */ diff --git a/sys/dev/ata/sata_subr.c b/sys/dev/ata/sata_subr.c index 6cbfe781d02..91929662635 100644 --- a/sys/dev/ata/sata_subr.c +++ b/sys/dev/ata/sata_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: sata_subr.c,v 1.9 2007/12/11 11:38:15 lukem Exp $ */ +/* $NetBSD: sata_subr.c,v 1.10 2008/03/18 20:46:36 cube Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ * Common functions for Serial ATA. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sata_subr.c,v 1.9 2007/12/11 11:38:15 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sata_subr.c,v 1.10 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -121,22 +121,22 @@ sata_reset_interface(struct ata_channel *chp, bus_space_tag_t sata_t, case SStatus_DET_DEV_NE: aprint_error("%s port %d: device connected, but " "communication not established\n", - chp->ch_atac->atac_dev.dv_xname, chp->ch_channel); + device_xname(chp->ch_atac->atac_dev), chp->ch_channel); break; case SStatus_DET_OFFLINE: aprint_error("%s port %d: PHY offline\n", - chp->ch_atac->atac_dev.dv_xname, chp->ch_channel); + device_xname(chp->ch_atac->atac_dev), chp->ch_channel); break; case SStatus_DET_DEV: aprint_normal("%s port %d: device present, speed: %s\n", - chp->ch_atac->atac_dev.dv_xname, chp->ch_channel, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, sata_speed(sstatus)); break; default: aprint_error("%s port %d: unknown SStatus: 0x%08x\n", - chp->ch_atac->atac_dev.dv_xname, chp->ch_channel, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, sstatus); } return(sstatus & SStatus_DET_mask); diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index a8306c970f5..acf9286a1d0 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $NetBSD: wd.c,v 1.359 2008/02/29 21:51:38 bouyer Exp $ */ +/* $NetBSD: wd.c,v 1.360 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.359 2008/02/29 21:51:38 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.360 2008/03/18 20:46:36 cube Exp $"); #include "opt_ata.h" @@ -143,7 +143,7 @@ void wdperror(const struct wd_softc *); static bool wd_suspend(device_t PMF_FN_PROTO); static int wd_standby(struct wd_softc *, int); -CFATTACH_DECL(wd, sizeof(struct wd_softc), +CFATTACH_DECL_NEW(wd, sizeof(struct wd_softc), wdprobe, wdattach, wddetach, wdactivate); extern struct cfdriver wd_cd; @@ -299,12 +299,14 @@ wdprobe(struct device *parent, struct cfdata *match, void *aux) void wdattach(struct device *parent, struct device *self, void *aux) { - struct wd_softc *wd = (void *)self; + struct wd_softc *wd = device_private(self); struct ata_device *adev= aux; int i, blank; char tbuf[41], pbuf[9], c, *p, *q; const struct wd_quirk *wdq; + wd->sc_dev = self; + ATADEBUG_PRINT(("wdattach\n"), DEBUG_FUNCS | DEBUG_PROBE); callout_init(&wd->sc_restart_ch, 0); bufq_alloc(&wd->sc_q, BUFQ_DISK_DEFAULT_STRAT, BUFQ_SORT_RAWBLOCK); @@ -316,13 +318,13 @@ wdattach(struct device *parent, struct device *self, void *aux) wd->drvp = adev->adev_drv_data; wd->drvp->drv_done = wddone; - wd->drvp->drv_softc = &wd->sc_dev; + wd->drvp->drv_softc = wd->sc_dev; aprint_naive("\n"); /* read our drive info */ if (wd_get_params(wd, AT_WAIT, &wd->sc_params) != 0) { - aprint_error("\n%s: IDENTIFY failed\n", wd->sc_dev.dv_xname); + aprint_error("\n%s: IDENTIFY failed\n", device_xname(self)); return; } @@ -352,7 +354,7 @@ wdattach(struct device *parent, struct device *self, void *aux) char sbuf[sizeof(WD_QUIRK_FMT) + 64]; bitmask_snprintf(wd->sc_quirks, WD_QUIRK_FMT, sbuf, sizeof(sbuf)); - aprint_normal("%s: quirks %s\n", wd->sc_dev.dv_xname, sbuf); + aprint_normal_dev(self, "quirks %s\n", sbuf); } if ((wd->sc_params.atap_multi & 0xff) > 1) { @@ -361,8 +363,8 @@ wdattach(struct device *parent, struct device *self, void *aux) wd->sc_multi = 1; } - aprint_verbose("%s: drive supports %d-sector PIO transfers,", - wd->sc_dev.dv_xname, wd->sc_multi); + aprint_verbose_dev(self, "drive supports %d-sector PIO transfers,", + wd->sc_multi); /* 48-bit LBA addressing */ if ((wd->sc_params.atap_cmd2_en & ATA_CMD2_LBA48) != 0) @@ -398,9 +400,9 @@ wdattach(struct device *parent, struct device *self, void *aux) wd->sc_params.atap_sectors; } format_bytes(pbuf, sizeof(pbuf), wd->sc_capacity * DEV_BSIZE); - aprint_normal("%s: %s, %d cyl, %d head, %d sec, " + aprint_normal_dev(self, "%s, %d cyl, %d head, %d sec, " "%d bytes/sect x %llu sectors\n", - self->dv_xname, pbuf, + pbuf, (wd->sc_flags & WDF_LBA) ? (int)(wd->sc_capacity / (wd->sc_params.atap_heads * wd->sc_params.atap_sectors)) : wd->sc_params.atap_cylinders, @@ -408,17 +410,17 @@ wdattach(struct device *parent, struct device *self, void *aux) DEV_BSIZE, (unsigned long long)wd->sc_capacity); ATADEBUG_PRINT(("%s: atap_dmatiming_mimi=%d, atap_dmatiming_recom=%d\n", - self->dv_xname, wd->sc_params.atap_dmatiming_mimi, + device_xname(self), wd->sc_params.atap_dmatiming_mimi, wd->sc_params.atap_dmatiming_recom), DEBUG_PROBE); /* * Initialize and attach the disk structure. */ /* we fill in dk_info later */ - disk_init(&wd->sc_dk, wd->sc_dev.dv_xname, &wddkdriver); + disk_init(&wd->sc_dk, device_xname(wd->sc_dev), &wddkdriver); disk_attach(&wd->sc_dk); wd->sc_wdc_bio.lp = wd->sc_dk.dk_label; #if NRND > 0 - rnd_attach_source(&wd->rnd_source, wd->sc_dev.dv_xname, + rnd_attach_source(&wd->rnd_source, device_xname(wd->sc_dev), RND_TYPE_DISK, 0); #endif @@ -461,7 +463,7 @@ wdactivate(struct device *self, enum devact act) int wddetach(struct device *self, int flags) { - struct wd_softc *sc = (struct wd_softc *)self; + struct wd_softc *sc = device_private(self); int s, bmaj, cmaj, i, mn; /* locate the major number */ @@ -520,12 +522,13 @@ wddetach(struct device *self, int flags) void wdstrategy(struct buf *bp) { - struct wd_softc *wd = device_lookup(&wd_cd, WDUNIT(bp->b_dev)); + struct wd_softc *wd = + device_private(device_lookup(&wd_cd, WDUNIT(bp->b_dev))); struct disklabel *lp = wd->sc_dk.dk_label; daddr_t blkno; int s; - ATADEBUG_PRINT(("wdstrategy (%s)\n", wd->sc_dev.dv_xname), + ATADEBUG_PRINT(("wdstrategy (%s)\n", device_xname(wd->sc_dev)), DEBUG_XFERS); /* Valid request? */ @@ -617,7 +620,7 @@ wdstart(void *arg) struct wd_softc *wd = arg; struct buf *bp = NULL; - ATADEBUG_PRINT(("wdstart %s\n", wd->sc_dev.dv_xname), + ATADEBUG_PRINT(("wdstart %s\n", device_xname(wd->sc_dev)), DEBUG_XFERS); while (wd->openings > 0) { @@ -639,7 +642,8 @@ static void wd_split_mod15_write(struct buf *bp) { struct buf *obp = bp->b_private; - struct wd_softc *sc = wd_cd.cd_devs[DISKUNIT(obp->b_dev)]; + struct wd_softc *sc = + device_private(wd_cd.cd_devs[DISKUNIT(obp->b_dev)]); if (__predict_false(bp->b_error != 0)) { /* @@ -772,13 +776,13 @@ __wdstart(struct wd_softc *wd, struct buf *bp) void wddone(void *v) { - struct wd_softc *wd = v; + struct wd_softc *wd = device_private(v); struct buf *bp = wd->sc_bp; const char *errmsg; int do_perror = 0; int nblks; - ATADEBUG_PRINT(("wddone %s\n", wd->sc_dev.dv_xname), + ATADEBUG_PRINT(("wddone %s\n", device_xname(wd->sc_dev)), DEBUG_XFERS); if (bp == NULL) return; @@ -863,8 +867,8 @@ retry2: break; case NOERROR: noerror: if ((wd->sc_wdc_bio.flags & ATA_CORR) || wd->retries > 0) - printf("%s: soft error (corrected)\n", - wd->sc_dev.dv_xname); + aprint_error_dev(wd->sc_dev, + "soft error (corrected)\n"); break; case ERR_NODEV: bp->b_error = EIO; @@ -892,7 +896,7 @@ wdrestart(void *v) struct buf *bp = wd->sc_bp; int s; - ATADEBUG_PRINT(("wdrestart %s\n", wd->sc_dev.dv_xname), + ATADEBUG_PRINT(("wdrestart %s\n", device_xname(wd->sc_dev)), DEBUG_XFERS); s = splbio(); __wdstart(v, bp); @@ -922,11 +926,11 @@ wdopen(dev_t dev, int flag, int fmt, struct lwp *l) int part, error; ATADEBUG_PRINT(("wdopen\n"), DEBUG_FUNCS); - wd = device_lookup(&wd_cd, WDUNIT(dev)); + wd = device_private(device_lookup(&wd_cd, WDUNIT(dev))); if (wd == NULL) return (ENXIO); - if (! device_is_active(&wd->sc_dev)) + if (! device_is_active(wd->sc_dev)) return (ENODEV); part = WDPART(dev); @@ -1005,7 +1009,8 @@ wdopen(dev_t dev, int flag, int fmt, struct lwp *l) int wdclose(dev_t dev, int flag, int fmt, struct lwp *l) { - struct wd_softc *wd = device_lookup(&wd_cd, WDUNIT(dev)); + struct wd_softc *wd = + device_private(device_lookup(&wd_cd, WDUNIT(dev))); int part = WDPART(dev); ATADEBUG_PRINT(("wdclose\n"), DEBUG_FUNCS); @@ -1100,7 +1105,7 @@ wdgetdisklabel(struct wd_softc *wd) wd->drvp->drive_flags |= DRIVE_RESET; splx(s); } - errstring = readdisklabel(MAKEWDDEV(0, device_unit(&wd->sc_dev), + errstring = readdisklabel(MAKEWDDEV(0, device_unit(wd->sc_dev), RAW_PART), wdstrategy, lp, wd->sc_dk.dk_cpulabel); if (errstring) { @@ -1115,11 +1120,11 @@ wdgetdisklabel(struct wd_softc *wd) wd->drvp->drive_flags |= DRIVE_RESET; splx(s); } - errstring = readdisklabel(MAKEWDDEV(0, device_unit(&wd->sc_dev), + errstring = readdisklabel(MAKEWDDEV(0, device_unit(wd->sc_dev), RAW_PART), wdstrategy, lp, wd->sc_dk.dk_cpulabel); } if (errstring) { - printf("%s: %s\n", wd->sc_dev.dv_xname, errstring); + aprint_error_dev(wd->sc_dev, "%s\n", errstring); return; } @@ -1150,7 +1155,7 @@ wdperror(const struct wd_softc *wd) int i; const char *sep = ""; - const char *devname = wd->sc_dev.dv_xname; + const char *devname = device_xname(wd->sc_dev); struct ata_drive_datas *drvp = wd->drvp; int errno = wd->sc_wdc_bio.r_error; @@ -1176,7 +1181,8 @@ wdperror(const struct wd_softc *wd) int wdioctl(dev_t dev, u_long xfer, void *addr, int flag, struct lwp *l) { - struct wd_softc *wd = device_lookup(&wd_cd, WDUNIT(dev)); + struct wd_softc *wd = + device_private(device_lookup(&wd_cd, WDUNIT(dev))); int error = 0, s; #ifdef __HAVE_OLD_DISKLABEL struct disklabel *newlabel = NULL; @@ -1471,7 +1477,7 @@ wdioctl(dev_t dev, u_long xfer, void *addr, int flag, struct lwp *l) return (EBADF); /* If the ioctl happens here, the parent is us. */ - strcpy(dkw->dkw_parent, wd->sc_dev.dv_xname); + strcpy(dkw->dkw_parent, device_xname(wd->sc_dev)); return (dkwedge_add(dkw)); } @@ -1483,7 +1489,7 @@ wdioctl(dev_t dev, u_long xfer, void *addr, int flag, struct lwp *l) return (EBADF); /* If the ioctl happens here, the parent is us. */ - strcpy(dkw->dkw_parent, wd->sc_dev.dv_xname); + strcpy(dkw->dkw_parent, device_xname(wd->sc_dev)); return (dkwedge_del(dkw)); } @@ -1563,7 +1569,7 @@ wdsize(dev_t dev) ATADEBUG_PRINT(("wdsize\n"), DEBUG_FUNCS); - wd = device_lookup(&wd_cd, WDUNIT(dev)); + wd = device_private(device_lookup(&wd_cd, WDUNIT(dev))); if (wd == NULL) return (-1); @@ -1602,7 +1608,7 @@ wddump(dev_t dev, daddr_t blkno, void *va, size_t size) return EFAULT; wddoingadump = 1; - wd = device_lookup(&wd_cd, WDUNIT(dev)); + wd = device_private(device_lookup(&wd_cd, WDUNIT(dev))); if (wd == NULL) return (ENXIO); @@ -1758,7 +1764,7 @@ wd_params_to_properties(struct wd_softc *wd, struct ataparams *params) prop_dictionary_set(disk_info, "geometry", geom); prop_object_release(geom); - prop_dictionary_set(device_properties(&wd->sc_dev), + prop_dictionary_set(device_properties(wd->sc_dev), "disk-info", disk_info); /* @@ -1855,15 +1861,14 @@ wd_setcache(struct wd_softc *wd, int bits) else ata_c.r_features = WDSF_WRITE_CACHE_DS; if (wd->atabus->ata_exec_command(wd->drvp, &ata_c) != ATACMD_COMPLETE) { - printf("%s: wd_setcache command not complete\n", - wd->sc_dev.dv_xname); + aprint_error_dev(wd->sc_dev, + "wd_setcache command not complete\n"); return EIO; } if (ata_c.flags & (AT_ERROR | AT_TIMEOU | AT_DF)) { char sbuf[sizeof(at_errbits) + 64]; bitmask_snprintf(ata_c.flags, at_errbits, sbuf, sizeof(sbuf)); - printf("%s: wd_setcache: status=%s\n", wd->sc_dev.dv_xname, - sbuf); + aprint_error_dev(wd->sc_dev, "wd_setcache: status=%s\n", sbuf); return EIO; } return 0; @@ -1881,7 +1886,7 @@ wd_standby(struct wd_softc *wd, int flags) ata_c.flags = flags; ata_c.timeout = 30000; /* 30s timeout */ if (wd->atabus->ata_exec_command(wd->drvp, &ata_c) != ATACMD_COMPLETE) { - aprint_error_dev(&wd->sc_dev, + aprint_error_dev(wd->sc_dev, "standby immediate command didn't complete\n"); return EIO; } @@ -1892,7 +1897,7 @@ wd_standby(struct wd_softc *wd, int flags) if (ata_c.flags & (AT_ERROR | AT_TIMEOU | AT_DF)) { char sbuf[sizeof(at_errbits) + 64]; bitmask_snprintf(ata_c.flags, at_errbits, sbuf, sizeof(sbuf)); - aprint_error_dev(&wd->sc_dev, "wd_standby: status=%s\n", sbuf); + aprint_error_dev(wd->sc_dev, "wd_standby: status=%s\n", sbuf); return EIO; } return 0; @@ -1922,8 +1927,8 @@ wd_flushcache(struct wd_softc *wd, int flags) ata_c.flags = flags; ata_c.timeout = 30000; /* 30s timeout */ if (wd->atabus->ata_exec_command(wd->drvp, &ata_c) != ATACMD_COMPLETE) { - printf("%s: flush cache command didn't complete\n", - wd->sc_dev.dv_xname); + aprint_error_dev(wd->sc_dev, + "flush cache command didn't complete\n"); return EIO; } if (ata_c.flags & AT_ERROR) { @@ -1933,7 +1938,7 @@ wd_flushcache(struct wd_softc *wd, int flags) if (ata_c.flags & (AT_ERROR | AT_TIMEOU | AT_DF)) { char sbuf[sizeof(at_errbits) + 64]; bitmask_snprintf(ata_c.flags, at_errbits, sbuf, sizeof(sbuf)); - printf("%s: wd_flushcache: status=%s\n", wd->sc_dev.dv_xname, + aprint_error_dev(wd->sc_dev, "wd_flushcache: status=%s\n", sbuf); return EIO; } diff --git a/sys/dev/ata/wdvar.h b/sys/dev/ata/wdvar.h index cf214492d9d..93a2e9406eb 100644 --- a/sys/dev/ata/wdvar.h +++ b/sys/dev/ata/wdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: wdvar.h,v 1.35 2008/02/28 14:40:17 drochner Exp $ */ +/* $NetBSD: wdvar.h,v 1.36 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. @@ -38,7 +38,7 @@ struct wd_softc { /* General disk infos */ - struct device sc_dev; + device_t sc_dev; struct disk sc_dk; struct bufq_state *sc_q; struct callout sc_restart_ch; diff --git a/sys/dev/cardbus/njata_cardbus.c b/sys/dev/cardbus/njata_cardbus.c index 49c79ac3cc7..041014e356a 100644 --- a/sys/dev/cardbus/njata_cardbus.c +++ b/sys/dev/cardbus/njata_cardbus.c @@ -1,4 +1,4 @@ -/* $Id: njata_cardbus.c,v 1.5 2007/10/19 11:59:39 ad Exp $ */ +/* $Id: njata_cardbus.c,v 1.6 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 2006 ITOH Yasufumi <itohy@NetBSD.org>. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: njata_cardbus.c,v 1.5 2007/10/19 11:59:39 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: njata_cardbus.c,v 1.6 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -64,13 +64,11 @@ struct njata32_cardbus_softc { static const struct njata32_cardbus_product *njata_cardbus_lookup (const struct cardbus_attach_args *); -static int njata_cardbus_match(struct device *, struct cfdata *, - void *); -static void njata_cardbus_attach(struct device *, struct device *, - void *); +static int njata_cardbus_match(device_t, cfdata_t, void *); +static void njata_cardbus_attach(device_t, device_t, void *); static int njata_cardbus_detach(struct device *, int); -CFATTACH_DECL(njata_cardbus, sizeof(struct njata32_cardbus_softc), +CFATTACH_DECL_NEW(njata_cardbus, sizeof(struct njata32_cardbus_softc), njata_cardbus_match, njata_cardbus_attach, njata_cardbus_detach, NULL); static const struct njata32_cardbus_product { @@ -97,8 +95,7 @@ static const struct njata32_cardbus_product { }; static const struct njata32_cardbus_product * -njata_cardbus_lookup(ca) - const struct cardbus_attach_args *ca; +njata_cardbus_lookup(const struct cardbus_attach_args *ca) { const struct njata32_cardbus_product *p; @@ -113,8 +110,7 @@ njata_cardbus_lookup(ca) } static int -njata_cardbus_match(struct device *parent, - struct cfdata *match, void *aux) +njata_cardbus_match(device_t parent, cfdata_t match, void *aux) { struct cardbus_attach_args *ca = aux; @@ -125,11 +121,10 @@ njata_cardbus_match(struct device *parent, } static void -njata_cardbus_attach(struct device *parent, struct device *self, - void *aux) +njata_cardbus_attach(device_t parent, device_t self, void *aux) { struct cardbus_attach_args *ca = aux; - struct njata32_cardbus_softc *csc = (void *)self; + struct njata32_cardbus_softc *csc = device_private(self); struct njata32_softc *sc = &csc->sc_njata32; const struct njata32_cardbus_product *prod; cardbus_devfunc_t ct = ca->ca_ct; @@ -139,10 +134,11 @@ njata_cardbus_attach(struct device *parent, struct device *self, int csr; uint8_t latency = 0x20; + sc->sc_wdcdev.sc_atac.atac_dev = self; if ((prod = njata_cardbus_lookup(ca)) == NULL) panic("njata_cardbus_attach"); - printf(": Workbit NinjaATA-32 IDE controller\n"); + aprint_normal(": Workbit NinjaATA-32 IDE controller\n"); csc->sc_ct = ct; csc->sc_tag = ca->ca_tag; @@ -172,7 +168,7 @@ njata_cardbus_attach(struct device *parent, struct device *self, goto try_io; } #ifdef NJATA32_DEBUG - printf("%s: memory space mapped, size %u\n", + aprint_normal("%s: memory space mapped, size %u\n", NJATA32NAME(sc), (unsigned)csc->sc_regmap_size); #endif csr |= PCI_COMMAND_MEM_ENABLE; @@ -184,14 +180,14 @@ njata_cardbus_attach(struct device *parent, struct device *self, PCI_MAPREG_TYPE_IO, 0, &NJATA32_REGT(sc), &NJATA32_REGH(sc), NULL, &csc->sc_regmap_size) == 0) { #ifdef NJATA32_DEBUG - printf("%s: io space mapped, size %u\n", + aprint_normal("%s: io space mapped, size %u\n", NJATA32NAME(sc), (unsigned)csc->sc_regmap_size); #endif csr |= PCI_COMMAND_IO_ENABLE; sc->sc_flags = NJATA32_IO_MAPPED; (*ct->ct_cf->cardbus_ctrl)(cc, CARDBUS_IO_ENABLE); } else { - printf("%s: unable to map device registers\n", + aprint_error("%s: unable to map device registers\n", NJATA32NAME(sc)); return; } @@ -225,22 +221,21 @@ njata_cardbus_attach(struct device *parent, struct device *self, sc->sc_ih = cardbus_intr_establish(cc, cf, ca->ca_intrline, IPL_BIO, njata32_intr, sc); if (sc->sc_ih == NULL) { - printf("%s: unable to establish interrupt at %d\n", + aprint_error("%s: unable to establish interrupt at %d\n", NJATA32NAME(sc), ca->ca_intrline); return; } - printf("%s: interrupting at %d\n", NJATA32NAME(sc), ca->ca_intrline); + aprint_normal("%s: interrupting at %d\n", NJATA32NAME(sc), + ca->ca_intrline); /* attach */ njata32_attach(sc); } static int -njata_cardbus_detach(self, flags) - struct device *self; - int flags; +njata_cardbus_detach(device_t self, int flags) { - struct njata32_cardbus_softc *csc = (void *) self; + struct njata32_cardbus_softc *csc = device_private(self); struct njata32_softc *sc = &csc->sc_njata32; int rv; diff --git a/sys/dev/ic/ahcisata_core.c b/sys/dev/ic/ahcisata_core.c index 0602dd4b38e..2c3896fb560 100644 --- a/sys/dev/ic/ahcisata_core.c +++ b/sys/dev/ic/ahcisata_core.c @@ -1,4 +1,4 @@ -/* $NetBSD: ahcisata_core.c,v 1.12 2008/02/11 08:23:48 xtraeme Exp $ */ +/* $NetBSD: ahcisata_core.c,v 1.13 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.12 2008/02/11 08:23:48 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.13 2008/03/18 20:46:36 cube Exp $"); #include <sys/types.h> #include <sys/malloc.h> @@ -1204,7 +1204,7 @@ ahci_atapibus_attach(struct atabus_softc * ata_sc) /* * Fill in the scsipi_adapter. */ - adapt->adapt_dev = &atac->atac_dev; + adapt->adapt_dev = atac->atac_dev; adapt->adapt_nchannels = atac->atac_nchannels; adapt->adapt_request = ahci_atapi_scsipi_request; adapt->adapt_minphys = ahci_atapi_minphys; @@ -1222,7 +1222,7 @@ ahci_atapibus_attach(struct atabus_softc * ata_sc) chan->chan_max_periph = 1; chan->chan_ntargets = 1; chan->chan_nluns = 1; - chp->atapibus = config_found_ia(&ata_sc->sc_dev, "atapi", chan, + chp->atapibus = config_found_ia(ata_sc->sc_dev, "atapi", chan, atapiprint); } @@ -1243,7 +1243,7 @@ void ahci_atapi_kill_pending(struct scsipi_periph *periph) { struct atac_softc *atac = - (void *)periph->periph_channel->chan_adapter->adapt_dev; + device_private(periph->periph_channel->chan_adapter->adapt_dev); struct ata_channel *chp = atac->atac_channels[periph->periph_channel->chan_channel]; @@ -1257,7 +1257,7 @@ ahci_atapi_scsipi_request(struct scsipi_channel *chan, struct scsipi_adapter *adapt = chan->chan_adapter; struct scsipi_periph *periph; struct scsipi_xfer *sc_xfer; - struct ahci_softc *sc = (void *)adapt->adapt_dev; + struct ahci_softc *sc = device_private(adapt->adapt_dev); struct atac_softc *atac = &sc->sc_atac; struct ata_xfer *xfer; int channel = chan->chan_channel; @@ -1268,7 +1268,7 @@ ahci_atapi_scsipi_request(struct scsipi_channel *chan, sc_xfer = arg; periph = sc_xfer->xs_periph; drive = periph->periph_target; - if (!device_is_active(&atac->atac_dev)) { + if (!device_is_active(atac->atac_dev)) { sc_xfer->error = XS_DRIVER_STUFFUP; scsipi_done(sc_xfer); return; @@ -1494,7 +1494,8 @@ ahci_atapi_probe_device(struct atapibus_softc *sc, int target) struct scsipi_periph *periph; struct ataparams ids; struct ataparams *id = &ids; - struct ahci_softc *ahcic = (void *)chan->chan_adapter->adapt_dev; + struct ahci_softc *ahcic = + device_private(chan->chan_adapter->adapt_dev); struct atac_softc *atac = &ahcic->sc_atac; struct ata_channel *chp = atac->atac_channels[chan->chan_channel]; struct ata_drive_datas *drvp = &chp->ch_drive[target]; @@ -1525,7 +1526,7 @@ ahci_atapi_probe_device(struct atapibus_softc *sc, int target) periph = scsipi_alloc_periph(M_NOWAIT); if (periph == NULL) { printf("%s: unable to allocate periph for drive %d\n", - sc->sc_dev.dv_xname, target); + device_xname(&sc->sc_dev), target); return; } periph->periph_dev = NULL; diff --git a/sys/dev/ic/ahcisatavar.h b/sys/dev/ic/ahcisatavar.h index 52cc543c2ae..59917b0aa06 100644 --- a/sys/dev/ic/ahcisatavar.h +++ b/sys/dev/ic/ahcisatavar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ahcisatavar.h,v 1.3 2008/02/11 08:23:48 xtraeme Exp $ */ +/* $NetBSD: ahcisatavar.h,v 1.4 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -78,7 +78,7 @@ struct ahci_softc { } sc_channels[AHCI_MAX_PORTS]; }; -#define AHCINAME(sc) ((sc)->sc_atac.atac_dev.dv_xname) +#define AHCINAME(sc) (device_xname((sc)->sc_atac.atac_dev)) #define AHCI_CMDH_SYNC(sc, achp, cmd, op) bus_dmamap_sync((sc)->sc_dmat, \ (sc)->sc_cmd_hdrd, \ diff --git a/sys/dev/ic/ninjaata32.c b/sys/dev/ic/ninjaata32.c index e4b3fb9399d..6ec14b3054a 100644 --- a/sys/dev/ic/ninjaata32.c +++ b/sys/dev/ic/ninjaata32.c @@ -1,4 +1,4 @@ -/* $NetBSD: ninjaata32.c,v 1.9 2007/10/19 11:59:57 ad Exp $ */ +/* $NetBSD: ninjaata32.c,v 1.10 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 2006 ITOH Yasufumi <itohy@NetBSD.org>. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ninjaata32.c,v 1.9 2007/10/19 11:59:57 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ninjaata32.c,v 1.10 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -74,9 +74,7 @@ static const uint8_t njata32_timing_pio[NJATA32_MODE_MAX_PIO + 1] = { }; static void -njata32_init(sc, nosleep) - struct njata32_softc *sc; - int nosleep; /* can't sleep (during cold boot and in interrupt) */ +njata32_init(struct njata32_softc *sc, int nosleep) { /* disable interrupts */ @@ -107,8 +105,7 @@ njata32_init(sc, nosleep) } void -njata32_attach(sc) - struct njata32_softc *sc; +njata32_attach(struct njata32_softc *sc) { bus_addr_t dmaaddr; int i, devno, error; @@ -120,7 +117,7 @@ njata32_attach(sc) if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct njata32_dma_page), PAGE_SIZE, 0, &sc->sc_sgt_seg, 1, &sc->sc_sgt_nsegs, BUS_DMA_NOWAIT)) != 0) { - printf("%s: unable to allocate sgt page, error = %d\n", + aprint_error("%s: unable to allocate sgt page, error = %d\n", NJATA32NAME(sc), error); return; } @@ -128,7 +125,7 @@ njata32_attach(sc) sc->sc_sgt_nsegs, sizeof(struct njata32_dma_page), (void **)&sc->sc_sgtpg, BUS_DMA_NOWAIT | BUS_DMA_COHERENT)) != 0) { - printf("%s: unable to map sgt page, error = %d\n", + aprint_error("%s: unable to map sgt page, error = %d\n", NJATA32NAME(sc), error); goto fail1; } @@ -136,14 +133,14 @@ njata32_attach(sc) sizeof(struct njata32_dma_page), 1, sizeof(struct njata32_dma_page), 0, BUS_DMA_NOWAIT, &sc->sc_dmamap_sgt)) != 0) { - printf("%s: unable to create sgt DMA map, error = %d\n", + aprint_error("%s: unable to create sgt DMA map, error = %d\n", NJATA32NAME(sc), error); goto fail2; } if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap_sgt, sc->sc_sgtpg, sizeof(struct njata32_dma_page), NULL, BUS_DMA_NOWAIT)) != 0) { - printf("%s: unable to load sgt DMA map, error = %d\n", + aprint_error("%s: unable to load sgt DMA map, error = %d\n", NJATA32NAME(sc), error); goto fail3; } @@ -163,8 +160,8 @@ njata32_attach(sc) BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &sc->sc_dev[devno].d_dmamap_xfer); if (error) { - printf("%s: failed to create DMA map (error = %d)\n", - NJATA32NAME(sc), error); + aprint_error("%s: failed to create DMA map " + "(error = %d)\n", NJATA32NAME(sc), error); goto fail4; } } @@ -226,7 +223,7 @@ njata32_attach(sc) /* use flags value as busmaster wait */ if ((sc->sc_atawait = - (uint8_t)device_cfdata(&sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags)) + (uint8_t)device_cfdata(sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags)) aprint_normal("%s: ATA wait = %#x\n", NJATA32NAME(sc), sc->sc_atawait); @@ -251,14 +248,12 @@ fail1: bus_dmamem_free(sc->sc_dmat, &sc->sc_sgt_seg, sc->sc_sgt_nsegs); } int -njata32_detach(sc, flags) - struct njata32_softc *sc; - int flags; +njata32_detach(struct njata32_softc *sc, int flags) { int rv, devno; if (sc->sc_flags & NJATA32_CMDPG_MAPPED) { - if ((rv = wdcdetach(&sc->sc_wdcdev.sc_atac.atac_dev, flags))) + if ((rv = wdcdetach(sc->sc_wdcdev.sc_atac.atac_dev, flags))) return rv; /* free DMA resource */ @@ -277,8 +272,7 @@ njata32_detach(sc, flags) } static void -njata32_irqack(chp) - struct ata_channel *chp; +njata32_irqack(struct ata_channel *chp) { struct njata32_softc *sc = (void *)chp->ch_atac; @@ -288,13 +282,11 @@ njata32_irqack(chp) } static void -njata32_clearirq(chp, irq) - struct ata_channel *chp; - int irq; +njata32_clearirq(struct ata_channel *chp, int irq) { struct njata32_softc *sc = (void *)chp->ch_atac; - printf("%s: unhandled intr: irq %#x, bm %#x, ", + aprint_error("%s: unhandled intr: irq %#x, bm %#x, ", NJATA32NAME(sc), irq, bus_space_read_1(NJATA32_REGT(sc), NJATA32_REGH(sc), NJATA32_REG_BM)); @@ -303,7 +295,7 @@ njata32_clearirq(chp, irq) njata32_irqack(chp); /* clear device interrupt */ - printf("err %#x, seccnt %#x, cyl %#x, sdh %#x, ", + aprint_normal("err %#x, seccnt %#x, cyl %#x, sdh %#x, ", bus_space_read_1(NJATA32_REGT(sc), NJATA32_REGH(sc), NJATA32_REG_WD_ERROR), bus_space_read_1(NJATA32_REGT(sc), NJATA32_REGH(sc), @@ -314,14 +306,13 @@ njata32_clearirq(chp, irq) NJATA32_REG_WD_CYL_HI) << 8), bus_space_read_1(NJATA32_REGT(sc), NJATA32_REGH(sc), NJATA32_REG_WD_SDH)); - printf("status %#x\n", + aprint_normal("status %#x\n", bus_space_read_1(NJATA32_REGT(sc), NJATA32_REGH(sc), NJATA32_REG_WD_STATUS)); } static void -njata32_setup_channel(chp) - struct ata_channel *chp; +njata32_setup_channel(struct ata_channel *chp) { struct njata32_softc *sc = (void *)chp->ch_atac; struct ata_drive_datas *drvp; diff --git a/sys/dev/ic/ninjaata32var.h b/sys/dev/ic/ninjaata32var.h index e6c503f76ea..47119a43589 100644 --- a/sys/dev/ic/ninjaata32var.h +++ b/sys/dev/ic/ninjaata32var.h @@ -1,4 +1,4 @@ -/* $NetBSD: ninjaata32var.h,v 1.3 2006/10/01 12:11:52 itohy Exp $ */ +/* $NetBSD: ninjaata32var.h,v 1.4 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 2006 ITOH Yasufumi <itohy@NetBSD.org>. @@ -29,7 +29,7 @@ #ifndef _NJATA32VAR_H_ #define _NJATA32VAR_H_ -#define NJATA32NAME(sc) (sc->sc_wdcdev.sc_atac.atac_dev.dv_xname) +#define NJATA32NAME(sc) (device_xname(sc->sc_wdcdev.sc_atac.atac_dev)) /* ??? */ #define NJATA32_MAX_XFER (64 * 1024) diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c index 4492c328f98..9bfb150a358 100644 --- a/sys/dev/ic/wdc.c +++ b/sys/dev/ic/wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc.c,v 1.252 2008/01/28 18:17:05 dyoung Exp $ */ +/* $NetBSD: wdc.c,v 1.253 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 1998, 2001, 2003 Manuel Bouyer. All rights reserved. @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.252 2008/01/28 18:17:05 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.253 2008/03/18 20:46:36 cube Exp $"); #include "opt_ata.h" @@ -242,7 +242,7 @@ wdc_sataprobe(struct ata_channel *chp) wdr->cmd_iohs[wd_cyl_hi], 0); ATADEBUG_PRINT(("%s: port %d: scnt=0x%x sn=0x%x " "cl=0x%x ch=0x%x\n", - chp->ch_atac->atac_dev.dv_xname, chp->ch_channel, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, scnt, sn, cl, ch), DEBUG_PROBE); /* * scnt and sn are supposed to be 0x1 for ATAPI, but in some @@ -338,7 +338,7 @@ wdc_drvprobe(struct ata_channel *chp) splx(s); ATADEBUG_PRINT(("%s:%d: wait DRDY st0 0x%x st1 0x%x\n", - atac->atac_dev.dv_xname, + device_xname(atac->atac_dev), chp->ch_channel, st0, st1), DEBUG_PROBE); /* Wait a bit, some devices are weird just after a reset. */ @@ -401,7 +401,7 @@ wdc_drvprobe(struct ata_channel *chp) ~(DRIVE_ATA | DRIVE_ATAPI); splx(s); ATADEBUG_PRINT(("%s:%d:%d: IDENTIFY failed (%d)\n", - atac->atac_dev.dv_xname, + device_xname(atac->atac_dev), chp->ch_channel, i, error), DEBUG_PROBE); if ((chp->ch_drive[i].drive_flags & DRIVE_OLD) == 0) continue; @@ -425,7 +425,7 @@ wdc_drvprobe(struct ata_channel *chp) wdr->cmd_iohs[wd_cyl_lo], 0) != 0xa5) { ATADEBUG_PRINT(("%s:%d:%d: register " "writability failed\n", - atac->atac_dev.dv_xname, + device_xname(atac->atac_dev), chp->ch_channel, i), DEBUG_PROBE); s = splbio(); chp->ch_drive[i].drive_flags &= ~DRIVE_OLD; @@ -434,7 +434,7 @@ wdc_drvprobe(struct ata_channel *chp) } if (wdc_wait_for_ready(chp, 10000, 0) == WDCWAIT_TOUT) { ATADEBUG_PRINT(("%s:%d:%d: not ready\n", - atac->atac_dev.dv_xname, + device_xname(atac->atac_dev), chp->ch_channel, i), DEBUG_PROBE); s = splbio(); chp->ch_drive[i].drive_flags &= ~DRIVE_OLD; @@ -446,7 +446,7 @@ wdc_drvprobe(struct ata_channel *chp) delay(10); /* 400ns delay */ if (wdc_wait_for_ready(chp, 10000, 0) == WDCWAIT_TOUT) { ATADEBUG_PRINT(("%s:%d:%d: WDCC_RECAL failed\n", - atac->atac_dev.dv_xname, + device_xname(atac->atac_dev), chp->ch_channel, i), DEBUG_PROBE); s = splbio(); chp->ch_drive[i].drive_flags &= ~DRIVE_OLD; @@ -516,7 +516,7 @@ wdcprobe1(struct ata_channel *chp, int poll) } ATADEBUG_PRINT(("%s:%d: before reset, st0=0x%x, st1=0x%x\n", - chp->ch_atac->atac_dev.dv_xname, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, st0, st1), DEBUG_PROBE); if (st0 == 0xff || st0 == WDSD_IBM) @@ -536,7 +536,7 @@ wdcprobe1(struct ata_channel *chp, int poll) if (cl != 0x02) { ATADEBUG_PRINT(("%s:%d drive 0 wd_cyl_lo: " "got 0x%x != 0x02\n", - chp->ch_atac->atac_dev.dv_xname, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, cl), DEBUG_PROBE); ret_value &= ~0x01; @@ -548,7 +548,7 @@ wdcprobe1(struct ata_channel *chp, int poll) if (cl != 0x01) { ATADEBUG_PRINT(("%s:%d drive 0 wd_cyl_lo: " "got 0x%x != 0x01\n", - chp->ch_atac->atac_dev.dv_xname, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, cl), DEBUG_PROBE); ret_value &= ~0x01; @@ -560,7 +560,7 @@ wdcprobe1(struct ata_channel *chp, int poll) if (cl != 0x01) { ATADEBUG_PRINT(("%s:%d drive 0 wd_sector: " "got 0x%x != 0x01\n", - chp->ch_atac->atac_dev.dv_xname, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, cl), DEBUG_PROBE); ret_value &= ~0x01; @@ -572,7 +572,7 @@ wdcprobe1(struct ata_channel *chp, int poll) if (cl != 0x02) { ATADEBUG_PRINT(("%s:%d drive 0 wd_sector: " "got 0x%x != 0x02\n", - chp->ch_atac->atac_dev.dv_xname, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, cl), DEBUG_PROBE); ret_value &= ~0x01; @@ -582,7 +582,7 @@ wdcprobe1(struct ata_channel *chp, int poll) if (cl != 0x01) { ATADEBUG_PRINT(("%s:%d drive 0 wd_cyl_lo(2): " "got 0x%x != 0x01\n", - chp->ch_atac->atac_dev.dv_xname, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, cl), DEBUG_PROBE); ret_value &= ~0x01; @@ -601,7 +601,7 @@ wdcprobe1(struct ata_channel *chp, int poll) if (cl != 0x02) { ATADEBUG_PRINT(("%s:%d drive 1 wd_cyl_lo: " "got 0x%x != 0x02\n", - chp->ch_atac->atac_dev.dv_xname, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, cl), DEBUG_PROBE); ret_value &= ~0x02; @@ -613,7 +613,7 @@ wdcprobe1(struct ata_channel *chp, int poll) if (cl != 0x01) { ATADEBUG_PRINT(("%s:%d drive 1 wd_cyl_lo: " "got 0x%x != 0x01\n", - chp->ch_atac->atac_dev.dv_xname, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, cl), DEBUG_PROBE); ret_value &= ~0x02; @@ -625,7 +625,7 @@ wdcprobe1(struct ata_channel *chp, int poll) if (cl != 0x01) { ATADEBUG_PRINT(("%s:%d drive 1 wd_sector: " "got 0x%x != 0x01\n", - chp->ch_atac->atac_dev.dv_xname, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, cl), DEBUG_PROBE); ret_value &= ~0x02; @@ -637,7 +637,7 @@ wdcprobe1(struct ata_channel *chp, int poll) if (cl != 0x02) { ATADEBUG_PRINT(("%s:%d drive 1 wd_sector: " "got 0x%x != 0x02\n", - chp->ch_atac->atac_dev.dv_xname, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, cl), DEBUG_PROBE); ret_value &= ~0x02; @@ -647,7 +647,7 @@ wdcprobe1(struct ata_channel *chp, int poll) if (cl != 0x01) { ATADEBUG_PRINT(("%s:%d drive 1 wd_cyl_lo(2): " "got 0x%x != 0x01\n", - chp->ch_atac->atac_dev.dv_xname, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, cl), DEBUG_PROBE); ret_value &= ~0x02; @@ -694,7 +694,7 @@ wdcprobe1(struct ata_channel *chp, int poll) ret_value = __wdcwait_reset(chp, ret_value, poll); ATADEBUG_PRINT(("%s:%d: after reset, ret_value=0x%d\n", - chp->ch_atac->atac_dev.dv_xname, chp->ch_channel, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, ret_value), DEBUG_PROBE); /* if reset failed, there's nothing here */ @@ -727,7 +727,7 @@ wdcprobe1(struct ata_channel *chp, int poll) ATADEBUG_PRINT(("%s:%d:%d: after reset, sc=0x%x sn=0x%x " "cl=0x%x ch=0x%x\n", - chp->ch_atac->atac_dev.dv_xname, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, drive, sc, sn, cl, ch), DEBUG_PROBE); /* * sc & sn are supposted to be 0x1 for ATAPI but in some cases @@ -833,7 +833,7 @@ wdcdetach(device_t self, int flags) if (chp->atabus == NULL) continue; ATADEBUG_PRINT(("wdcdetach: %s: detaching %s\n", - atac->atac_dev.dv_xname, chp->atabus->dv_xname), + device_xname(atac->atac_dev), device_xname(chp->atabus)), DEBUG_DETACH); if ((error = config_detach(chp->atabus, flags)) != 0) return error; @@ -872,7 +872,7 @@ wdcintr(void *arg) struct ata_xfer *xfer; int ret; - if (!device_is_active(&atac->atac_dev)) { + if (!device_is_active(atac->atac_dev)) { ATADEBUG_PRINT(("wdcintr: deactivated controller\n"), DEBUG_INTR); return (0); @@ -922,8 +922,8 @@ wdc_reset_drive(struct ata_drive_datas *drvp, int flags) struct ata_channel *chp = drvp->chnl_softc; ATADEBUG_PRINT(("wdc_reset_drive %s:%d for drive %d\n", - chp->ch_atac->atac_dev.dv_xname, chp->ch_channel, drvp->drive), - DEBUG_FUNCS); + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, + drvp->drive), DEBUG_FUNCS); ata_reset_channel(chp, flags); } @@ -1041,13 +1041,13 @@ wdcreset(struct ata_channel *chp, int poll) drv_mask2 = __wdcwait_reset(chp, drv_mask1, (poll == RESET_SLEEP) ? 0 : 1); if (drv_mask2 != drv_mask1) { - printf("%s channel %d: reset failed for", - atac->atac_dev.dv_xname, chp->ch_channel); + aprint_error("%s channel %d: reset failed for", + device_xname(atac->atac_dev), chp->ch_channel); if ((drv_mask1 & 0x01) != 0 && (drv_mask2 & 0x01) == 0) - printf(" drive 0"); + aprint_normal(" drive 0"); if ((drv_mask1 & 0x02) != 0 && (drv_mask2 & 0x02) == 0) - printf(" drive 1"); - printf("\n"); + aprint_normal(" drive 1"); + aprint_normal("\n"); } bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, wd_aux_ctlr, WDCTL_4BIT); return (drv_mask1 != drv_mask2) ? 1 : 0; @@ -1175,15 +1175,15 @@ __wdcwait_reset(struct ata_channel *chp, int drv_mask, int poll) end: ATADEBUG_PRINT(("%s:%d:0: after reset, sc=0x%x sn=0x%x " "cl=0x%x ch=0x%x\n", - chp->ch_atac->atac_dev.dv_xname, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, sc0, sn0, cl0, ch0), DEBUG_PROBE); ATADEBUG_PRINT(("%s:%d:1: after reset, sc=0x%x sn=0x%x " "cl=0x%x ch=0x%x\n", - chp->ch_atac->atac_dev.dv_xname, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, sc1, sn1, cl1, ch1), DEBUG_PROBE); ATADEBUG_PRINT(("%s:%d: wdcwait_reset() end, st0=0x%x st1=0x%x\n", - chp->ch_atac->atac_dev.dv_xname, chp->ch_channel, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, st0, st1), DEBUG_PROBE); return drv_mask; @@ -1202,7 +1202,7 @@ __wdcwait(struct ata_channel *chp, int mask, int bits, int timeout) int xtime = 0; ATADEBUG_PRINT(("__wdcwait %s:%d\n", - chp->ch_atac->atac_dev.dv_xname, + device_xname(chp->ch_atac->atac_dev), chp->ch_channel), DEBUG_STATUS); chp->ch_error = 0; @@ -1237,12 +1237,12 @@ __wdcwait(struct ata_channel *chp, int mask, int bits, int timeout) struct ata_xfer *xfer = chp->ch_queue->active_xfer; if (xfer == NULL) printf("%s channel %d: warning: busy-wait took %dus\n", - chp->ch_atac->atac_dev.dv_xname, chp->ch_channel, - WDCDELAY * xtime); + device_xname(chp->ch_atac->atac_dev), + chp->ch_channel, WDCDELAY * xtime); else printf("%s:%d:%d: warning: busy-wait took %dus\n", - chp->ch_atac->atac_dev.dv_xname, chp->ch_channel, - xfer->c_drive, + device_xname(chp->ch_atac->atac_dev), + chp->ch_channel, xfer->c_drive, WDCDELAY * xtime); } #endif @@ -1375,8 +1375,8 @@ wdc_exec_command(struct ata_drive_datas *drvp, struct ata_command *ata_c) int s, ret; ATADEBUG_PRINT(("wdc_exec_command %s:%d:%d\n", - chp->ch_atac->atac_dev.dv_xname, chp->ch_channel, drvp->drive), - DEBUG_FUNCS); + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, + drvp->drive), DEBUG_FUNCS); /* set up an xfer and queue. Wait for completion */ xfer = ata_get_xfer(ata_c->flags & AT_WAIT ? ATAXF_CANSLEEP : @@ -1432,7 +1432,8 @@ __wdccommand_start(struct ata_channel *chp, struct ata_xfer *xfer) struct ata_command *ata_c = xfer->c_cmd; ATADEBUG_PRINT(("__wdccommand_start %s:%d:%d\n", - chp->ch_atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive), + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, + xfer->c_drive), DEBUG_FUNCS); if (wdc->select) @@ -1510,8 +1511,8 @@ __wdccommand_intr(struct ata_channel *chp, struct ata_xfer *xfer, int irq) again: ATADEBUG_PRINT(("__wdccommand_intr %s:%d:%d\n", - chp->ch_atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive), - DEBUG_INTR); + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, + xfer->c_drive), DEBUG_INTR); /* * after a ATAPI_SOFT_RESET, the device will have released the bus. * Reselect again, it doesn't hurt for others commands, and the time @@ -1585,7 +1586,7 @@ __wdccommand_done(struct ata_channel *chp, struct ata_xfer *xfer) struct ata_command *ata_c = xfer->c_cmd; ATADEBUG_PRINT(("__wdccommand_done %s:%d:%d flags 0x%x\n", - atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive, + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, ata_c->flags), DEBUG_FUNCS); @@ -1596,7 +1597,7 @@ __wdccommand_done(struct ata_channel *chp, struct ata_xfer *xfer) ata_c->r_error = chp->ch_error; } if ((ata_c->flags & AT_READREG) != 0 && - device_is_active(&atac->atac_dev) && + device_is_active(atac->atac_dev) && (ata_c->flags & (AT_ERROR | AT_DF)) == 0) { ata_c->r_head = bus_space_read_1(wdr->cmd_iot, wdr->cmd_iohs[wd_sdh], 0); @@ -1678,9 +1679,9 @@ wdccommand(struct ata_channel *chp, u_int8_t drive, u_int8_t command, struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; ATADEBUG_PRINT(("wdccommand %s:%d:%d: command=0x%x cylin=%d head=%d " - "sector=%d count=%d features=%d\n", chp->ch_atac->atac_dev.dv_xname, - chp->ch_channel, drive, command, cylin, head, sector, count, - features), DEBUG_FUNCS); + "sector=%d count=%d features=%d\n", + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, drive, + command, cylin, head, sector, count, features), DEBUG_FUNCS); if (wdc->select) wdc->select(chp,drive); @@ -1714,7 +1715,7 @@ wdccommandext(struct ata_channel *chp, u_int8_t drive, u_int8_t command, struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; ATADEBUG_PRINT(("wdccommandext %s:%d:%d: command=0x%x blkno=%d " - "count=%d\n", chp->ch_atac->atac_dev.dv_xname, + "count=%d\n", device_xname(chp->ch_atac->atac_dev), chp->ch_channel, drive, command, (u_int32_t) blkno, count), DEBUG_FUNCS); @@ -1778,8 +1779,8 @@ wdccommandshort(struct ata_channel *chp, int drive, int command) struct wdc_regs *wdr = &wdc->regs[chp->ch_channel]; ATADEBUG_PRINT(("wdccommandshort %s:%d:%d command 0x%x\n", - chp->ch_atac->atac_dev.dv_xname, chp->ch_channel, drive, command), - DEBUG_FUNCS); + device_xname(chp->ch_atac->atac_dev), chp->ch_channel, drive, + command), DEBUG_FUNCS); if (wdc->select) wdc->select(chp,drive); @@ -1798,10 +1799,10 @@ __wdcerror(struct ata_channel *chp, const char *msg) struct ata_xfer *xfer = chp->ch_queue->active_xfer; if (xfer == NULL) - printf("%s:%d: %s\n", atac->atac_dev.dv_xname, chp->ch_channel, - msg); + aprint_error("%s:%d: %s\n", device_xname(atac->atac_dev), + chp->ch_channel, msg); else - printf("%s:%d:%d: %s\n", atac->atac_dev.dv_xname, + aprint_error("%s:%d:%d: %s\n", device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, msg); } diff --git a/sys/dev/ic/wdc_upc.c b/sys/dev/ic/wdc_upc.c index 93d9babe8ec..d4926ef2624 100644 --- a/sys/dev/ic/wdc_upc.c +++ b/sys/dev/ic/wdc_upc.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_upc.c,v 1.24 2007/10/19 12:00:05 ad Exp $ */ +/* $NetBSD: wdc_upc.c,v 1.25 2008/03/18 20:46:36 cube Exp $ */ /*- * Copyright (c) 2000 Ben Harris * All rights reserved. @@ -28,7 +28,7 @@ /* This file is part of NetBSD/arm26 -- a port of NetBSD to ARM2/3 machines. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_upc.c,v 1.24 2007/10/19 12:00:05 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_upc.c,v 1.25 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -44,8 +44,8 @@ __KERNEL_RCSID(0, "$NetBSD: wdc_upc.c,v 1.24 2007/10/19 12:00:05 ad Exp $"); #include <dev/ic/wdcreg.h> #include <dev/ic/wdcvar.h> -static int wdc_upc_match(struct device *, struct cfdata *, void *); -static void wdc_upc_attach(struct device *, struct device *, void *); +static int wdc_upc_match(device_t, cfdata_t, void *); +static void wdc_upc_attach(device_t, device_t, void *); struct wdc_upc_softc { struct wdc_softc sc_wdc; @@ -55,11 +55,11 @@ struct wdc_upc_softc { struct wdc_regs sc_wdc_regs; }; -CFATTACH_DECL(wdc_upc, sizeof(struct wdc_upc_softc), +CFATTACH_DECL_NEW(wdc_upc, sizeof(struct wdc_upc_softc), wdc_upc_match, wdc_upc_attach, NULL, NULL); static int -wdc_upc_match(struct device *parent, struct cfdata *cf, void *aux) +wdc_upc_match(device_t parent, cfdata_t cf, void *aux) { /* upc_submatch does it all anyway */ @@ -67,13 +67,14 @@ wdc_upc_match(struct device *parent, struct cfdata *cf, void *aux) } static void -wdc_upc_attach(struct device *parent, struct device *self, void *aux) +wdc_upc_attach(device_t parent, device_t self, void *aux) { - struct wdc_upc_softc *sc = (struct wdc_upc_softc *)self; + struct wdc_upc_softc *sc = device_private(self); struct wdc_regs *wdr; struct upc_attach_args *ua = aux; int i; + sc->sc_wdc.sc_atac.atac_dev = self; sc->sc_wdc.regs = wdr = &sc->sc_wdc_regs; sc->sc_wdc.sc_atac.atac_cap = ATAC_CAP_DATA16; @@ -92,8 +93,8 @@ wdc_upc_attach(struct device *parent, struct device *self, void *aux) for (i = 0; i < WDC_NREG; i++) { if (bus_space_subregion(ua->ua_iot, ua->ua_ioh, i, i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) { - aprint_error("%s: can't subregion I/O space\n", - sc->sc_wdc.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdc.sc_atac.atac_dev, + "can't subregion I/O space\n"); return; } } diff --git a/sys/dev/isa/wdc_isa.c b/sys/dev/isa/wdc_isa.c index 2d1aa3ed059..857dd78b22e 100644 --- a/sys/dev/isa/wdc_isa.c +++ b/sys/dev/isa/wdc_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_isa.c,v 1.53 2008/01/10 07:44:08 dyoung Exp $ */ +/* $NetBSD: wdc_isa.c,v 1.54 2008/03/18 20:46:36 cube Exp $ */ /*- * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_isa.c,v 1.53 2008/01/10 07:44:08 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_isa.c,v 1.54 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -74,11 +74,11 @@ struct wdc_isa_softc { int sc_drq; }; -static int wdc_isa_probe(device_t , struct cfdata *, void *); +static int wdc_isa_probe(device_t , cfdata_t, void *); static void wdc_isa_attach(device_t, device_t, void *); static int wdc_isa_detach(device_t, int); -CFATTACH_DECL2(wdc_isa, sizeof(struct wdc_isa_softc), +CFATTACH_DECL2_NEW(wdc_isa, sizeof(struct wdc_isa_softc), wdc_isa_probe, wdc_isa_attach, wdc_isa_detach, NULL, NULL, wdc_childdetached); @@ -90,7 +90,7 @@ static int wdc_isa_dma_finish(void*, int, int, int); #endif static int -wdc_isa_probe(device_t parent, struct cfdata *match, void *aux) +wdc_isa_probe(device_t parent, cfdata_t match, void *aux) { struct ata_channel ch; struct isa_attach_args *ia = aux; @@ -180,6 +180,7 @@ wdc_isa_attach(device_t parent, device_t self, void *aux) int wdc_cf_flags = device_cfdata(self)->cf_flags; int i; + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_wdcdev.regs = wdr = &sc->wdc_regs; wdr->cmd_iot = ia->ia_iot; wdr->ctl_iot = ia->ia_iot; @@ -189,7 +190,7 @@ wdc_isa_attach(device_t parent, device_t self, void *aux) bus_space_map(wdr->ctl_iot, ia->ia_io[0].ir_addr + WDC_ISA_AUXREG_OFFSET, WDC_ISA_AUXREG_NPORTS, 0, &wdr->ctl_ioh)) { - printf(": couldn't map registers\n"); + aprint_error(": couldn't map registers\n"); return; } @@ -197,7 +198,7 @@ wdc_isa_attach(device_t parent, device_t self, void *aux) if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i, i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) { - printf(": couldn't subregion registers\n"); + aprint_error(": couldn't subregion registers\n"); return; } } @@ -236,7 +237,7 @@ wdc_isa_attach(device_t parent, device_t self, void *aux) sc->ata_channel.ch_ndrive = 2; wdc_init_shadow_regs(&sc->ata_channel); - printf("\n"); + aprint_normal("\n"); sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_BIO, wdcintr, &sc->ata_channel); @@ -251,23 +252,24 @@ wdc_isa_dma_setup(struct wdc_isa_softc *sc) bus_size_t maxsize; if ((maxsize = isa_dmamaxsize(sc->sc_ic, sc->sc_drq)) < MAXPHYS) { - printf("%s: max DMA size %lu is less than required %d\n", - sc->sc_wdcdev.sc_dev.dv_xname, (u_long)maxsize, MAXPHYS); + aprint_error_dev(sc_wdcdev.sc_atac.atac_dev, + "max DMA size %lu is less than required %d\n", + (u_long)maxsize, MAXPHYS); sc->sc_wdcdev.sc_atac.atac_cap &= ~ATAC_CAP_DMA; return; } if (isa_drq_alloc(sc->sc_ic, sc->sc_drq) != 0) { - printf("%s: can't reserve drq %d\n", - sc->sc_wdcdev.sc_dev.dv_xname, sc->sc_drq); + aprint_error_dev(sc_wdcdev.sc_atac.atac_dev, + "can't reserve drq %d\n", sc->sc_drq); sc->sc_wdcdev.sc_atac.atac_cap &= ~ATAC_CAP_DMA; return; } if (isa_dmamap_create(sc->sc_ic, sc->sc_drq, MAXPHYS, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW)) { - printf("%s: can't create map for drq %d\n", - sc->sc_wdcdev.sc_dev.dv_xname, sc->sc_drq); + aprint_error_dev(sc_wdcdev.sc_atac.atac_dev, + "can't create map for drq %d\n", sc->sc_drq); sc->sc_wdcdev.sc_atac.atac_cap &= ~ATAC_CAP_DMA; } } diff --git a/sys/dev/isapnp/wdc_isapnp.c b/sys/dev/isapnp/wdc_isapnp.c index a083aa37f7f..76a59f4371f 100644 --- a/sys/dev/isapnp/wdc_isapnp.c +++ b/sys/dev/isapnp/wdc_isapnp.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_isapnp.c,v 1.37 2007/10/19 12:00:33 ad Exp $ */ +/* $NetBSD: wdc_isapnp.c,v 1.38 2008/03/18 20:46:36 cube Exp $ */ /*- * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_isapnp.c,v 1.37 2007/10/19 12:00:33 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_isapnp.c,v 1.38 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -69,10 +69,10 @@ struct wdc_isapnp_softc { int sc_drq; }; -static int wdc_isapnp_probe(struct device *, struct cfdata *, void *); -static void wdc_isapnp_attach(struct device *, struct device *, void *); +static int wdc_isapnp_probe(device_t, cfdata_t, void *); +static void wdc_isapnp_attach(device_t, device_t, void *); -CFATTACH_DECL(wdc_isapnp, sizeof(struct wdc_isapnp_softc), +CFATTACH_DECL_NEW(wdc_isapnp, sizeof(struct wdc_isapnp_softc), wdc_isapnp_probe, wdc_isapnp_attach, NULL, NULL); #ifdef notyet @@ -82,8 +82,7 @@ static void wdc_isapnp_dma_finish(void *); #endif static int -wdc_isapnp_probe(struct device *parent, struct cfdata *match, - void *aux) +wdc_isapnp_probe(device_t parent, cfdata_t match, void *aux) { int pri, variant; @@ -94,8 +93,7 @@ wdc_isapnp_probe(struct device *parent, struct cfdata *match, } static void -wdc_isapnp_attach(struct device *parent, struct device *self, - void *aux) +wdc_isapnp_attach(device_t parent, device_t self, void *aux) { struct wdc_isapnp_softc *sc = device_private(self); struct wdc_regs *wdr; @@ -107,17 +105,18 @@ wdc_isapnp_attach(struct device *parent, struct device *self, ipa->ipa_nmem32 != 0 || ipa->ipa_nirq != 1 || ipa->ipa_ndrq > 1) { - printf(": unexpected configuration\n"); + aprint_error(": unexpected configuration\n"); return; } if (isapnp_config(ipa->ipa_iot, ipa->ipa_memt, ipa)) { - printf(": couldn't map registers\n"); + aprint_error(": couldn't map registers\n"); return; } - printf(": %s %s\n", ipa->ipa_devident, ipa->ipa_devclass); + aprint_normal(": %s %s\n", ipa->ipa_devident, ipa->ipa_devclass); + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_wdcdev.regs = wdr = &sc->wdc_regs; wdr->cmd_iot = ipa->ipa_iot; wdr->ctl_iot = ipa->ipa_iot; @@ -138,7 +137,7 @@ wdc_isapnp_attach(struct device *parent, struct device *self, if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i, i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) { - printf(": couldn't subregion registers\n"); + aprint_error(": couldn't subregion registers\n"); return; } } @@ -181,8 +180,8 @@ wdc_isapnp_dma_setup(struct wdc_isapnp_softc *sc) if (isa_dmamap_create(sc->sc_ic, sc->sc_drq, MAXPHYS, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW)) { - printf("%s: can't create map for drq %d\n", - sc->sc_wdcdev.sc_dev.dv_xname, sc->sc_drq); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "can't create map for drq %d\n", sc->sc_drq); sc->sc_wdcdev.sc_atac.atac_cap &= ~ATAC_CAP_DMA; } } diff --git a/sys/dev/ofisa/wdc_ofisa.c b/sys/dev/ofisa/wdc_ofisa.c index 1ee2424dc11..b41f3bd1f86 100644 --- a/sys/dev/ofisa/wdc_ofisa.c +++ b/sys/dev/ofisa/wdc_ofisa.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_ofisa.c,v 1.29 2007/10/19 12:00:38 ad Exp $ */ +/* $NetBSD: wdc_ofisa.c,v 1.30 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright 1997, 1998 @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_ofisa.c,v 1.29 2007/10/19 12:00:38 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_ofisa.c,v 1.30 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -66,14 +66,14 @@ struct wdc_ofisa_softc { void *sc_ih; }; -static int wdc_ofisa_probe(struct device *, struct cfdata *, void *); -static void wdc_ofisa_attach(struct device *, struct device *, void *); +static int wdc_ofisa_probe(device_t, cfdata_t, void *); +static void wdc_ofisa_attach(device_t, device_t, void *); -CFATTACH_DECL(wdc_ofisa, sizeof(struct wdc_ofisa_softc), +CFATTACH_DECL_NEW(wdc_ofisa, sizeof(struct wdc_ofisa_softc), wdc_ofisa_probe, wdc_ofisa_attach, NULL, NULL); static int -wdc_ofisa_probe(struct device *parent, struct cfdata *cf, void *aux) +wdc_ofisa_probe(device_t parent, cfdata_t cf, void *aux) { struct ofisa_attach_args *aa = aux; static const char *const compatible_strings[] = { "pnpPNP,600", NULL }; @@ -89,7 +89,7 @@ wdc_ofisa_probe(struct device *parent, struct cfdata *cf, void *aux) } static void -wdc_ofisa_attach(struct device *parent, struct device *self, void *aux) +wdc_ofisa_attach(device_t parent, device_t self, void *aux) { struct wdc_ofisa_softc *sc = device_private(self); struct wdc_regs *wdr; @@ -106,6 +106,7 @@ wdc_ofisa_attach(struct device *parent, struct device *self, void *aux) * We expect exactly two register regions and one interrupt. */ + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_wdcdev.regs = wdr = &sc->wdc_regs; n = ofisa_reg_get(aa->oba.oba_phandle, reg, 2); @@ -113,11 +114,11 @@ wdc_ofisa_attach(struct device *parent, struct device *self, void *aux) n = wdc_ofisa_md_reg_fixup(parent, self, aux, reg, 2, n); #endif if (n != 2) { - printf(": error getting register data\n"); + aprint_error(": error getting register data\n"); return; } if (reg[0].len != 8 || reg[1].len != 2) { - printf(": weird register size (%lu/%lu, expected 8/2)\n", + aprint_error(": weird register size (%lu/%lu, expected 8/2)\n", (unsigned long)reg[0].len, (unsigned long)reg[1].len); return; } @@ -127,7 +128,7 @@ wdc_ofisa_attach(struct device *parent, struct device *self, void *aux) n = wdc_ofisa_md_intr_fixup(parent, self, aux, &intr, 1, n); #endif if (n != 1) { - printf(": error getting interrupt data\n"); + aprint_error(": error getting interrupt data\n"); return; } @@ -136,7 +137,7 @@ wdc_ofisa_attach(struct device *parent, struct device *self, void *aux) if (bus_space_map(wdr->cmd_iot, reg[0].addr, 8, 0, &ioh) || bus_space_map(wdr->ctl_iot, reg[1].addr, 1, 0, &wdr->ctl_ioh)) { - printf(": can't map register spaces\n"); + aprint_error(": can't map register spaces\n"); return; } wdr->cmd_baseioh = ioh; @@ -144,7 +145,7 @@ wdc_ofisa_attach(struct device *parent, struct device *self, void *aux) for (n = 0; n < WDC_NREG; n++) { if (bus_space_subregion(wdr->cmd_iot, ioh, n, n == 0 ? 4 : 1, &wdr->cmd_iohs[n]) != 0) { - printf(": can't subregion register space\n"); + aprint_error(": can't subregion register space\n"); return; } } @@ -152,7 +153,7 @@ wdc_ofisa_attach(struct device *parent, struct device *self, void *aux) sc->sc_ih = isa_intr_establish(aa->ic, intr.irq, intr.share, IPL_BIO, wdcintr, &sc->sc_channel); - printf("\n"); + aprint_normal("\n"); sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA16; sc->sc_chanlist[0] = &sc->sc_channel; sc->sc_wdcdev.sc_atac.atac_channels = sc->sc_chanlist; @@ -167,11 +168,11 @@ wdc_ofisa_attach(struct device *parent, struct device *self, void *aux) wdcattach(&sc->sc_channel); #if 0 - printf("%s: registers: ", sc->sc_dev.dv_xname); + aprint_verbose_dev(self, "registers: "); ofisa_reg_print(reg, 2); - printf("\n"); - printf("%s: interrupts: ", sc->sc_dev.dv_xname); + aprint_verbose("\n"); + aprint_verbose_dev(self, "interrupts: "); ofisa_intr_print(&intr, 1); - printf("\n"); + aprint_verbose("\n"); #endif } diff --git a/sys/dev/pci/acardide.c b/sys/dev/pci/acardide.c index 5e734abef7a..f52e9033637 100644 --- a/sys/dev/pci/acardide.c +++ b/sys/dev/pci/acardide.c @@ -1,4 +1,4 @@ -/* $NetBSD: acardide.c,v 1.21 2007/02/09 21:55:27 ad Exp $ */ +/* $NetBSD: acardide.c,v 1.22 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 2001 Izumi Tsutsui. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acardide.c,v 1.21 2007/02/09 21:55:27 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acardide.c,v 1.22 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -44,10 +44,10 @@ static void acard_setup_channel(struct ata_channel*); static int acard_pci_intr(void *); #endif -static int acardide_match(struct device *, struct cfdata *, void *); -static void acardide_attach(struct device *, struct device *, void *); +static int acardide_match(device_t, cfdata_t, void *); +static void acardide_attach(device_t, device_t, void *); -CFATTACH_DECL(acardide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(acardide, sizeof(struct pciide_softc), acardide_match, acardide_attach, NULL, NULL); static const struct pciide_product_desc pciide_acard_products[] = { @@ -84,8 +84,7 @@ static const struct pciide_product_desc pciide_acard_products[] = { }; static int -acardide_match(struct device *parent, struct cfdata *match, - void *aux) +acardide_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -97,10 +96,12 @@ acardide_match(struct device *parent, struct cfdata *match, } static void -acardide_attach(struct device *parent, struct device *self, void *aux) +acardide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_acard_products)); @@ -132,8 +133,8 @@ acard_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) PCIIDE_INTERFACE_PCI(0) | PCIIDE_INTERFACE_PCI(1); } - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; @@ -321,7 +322,7 @@ acard_pci_intr(void *arg) crv = wdcintr(wdc_cp); if (crv == 0) { printf("%s:%d: bogus intr\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, i); + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), i); bus_space_write_1(sc->sc_dma_iot, cp->dma_iohs[IDEDMA_CTL], 0, dmastat); } else if (crv == 1) diff --git a/sys/dev/pci/aceride.c b/sys/dev/pci/aceride.c index 08e43c64ea6..3a34510acd3 100644 --- a/sys/dev/pci/aceride.c +++ b/sys/dev/pci/aceride.c @@ -1,4 +1,4 @@ -/* $NetBSD: aceride.c,v 1.24 2008/01/01 14:57:06 chris Exp $ */ +/* $NetBSD: aceride.c,v 1.25 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: aceride.c,v 1.24 2008/01/01 14:57:06 chris Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aceride.c,v 1.25 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -47,15 +47,15 @@ static void acer_chip_map(struct pciide_softc*, struct pci_attach_args*); static void acer_setup_channel(struct ata_channel*); static int acer_pci_intr(void *); -static int aceride_match(struct device *, struct cfdata *, void *); -static void aceride_attach(struct device *, struct device *, void *); +static int aceride_match(device_t, cfdata_t, void *); +static void aceride_attach(device_t, device_t, void *); struct aceride_softc { struct pciide_softc pciide_sc; struct pci_attach_args pcib_pa; }; -CFATTACH_DECL(aceride, sizeof(struct aceride_softc), +CFATTACH_DECL_NEW(aceride, sizeof(struct aceride_softc), aceride_match, aceride_attach, NULL, NULL); static const struct pciide_product_desc pciide_acer_products[] = { @@ -72,8 +72,7 @@ static const struct pciide_product_desc pciide_acer_products[] = { }; static int -aceride_match(struct device *parent, struct cfdata *match, - void *aux) +aceride_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -87,14 +86,15 @@ aceride_match(struct device *parent, struct cfdata *match, } static void -aceride_attach(struct device *parent, struct device *self, void *aux) +aceride_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_acer_products)); - } static int @@ -125,8 +125,8 @@ acer_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; @@ -177,7 +177,7 @@ acer_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) bool force_compat_mode; bool property_is_set; property_is_set = prop_dictionary_get_bool( - device_properties(&sc->sc_wdcdev.sc_atac.atac_dev), + device_properties(sc->sc_wdcdev.sc_atac.atac_dev), "ali1543-ide-force-compat-mode", &force_compat_mode); if (property_is_set && force_compat_mode) { @@ -203,8 +203,8 @@ acer_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (rev == 0xC3) { /* install reset bug workaround */ if (pci_find_device(&acer_sc->pcib_pa, acer_pcib_match) == 0) { - printf("%s: WARNING: can't find pci-isa bridge\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "WARNING: can't find pci-isa bridge\n"); } else sc->sc_wdcdev.reset = acer_do_reset; } @@ -215,8 +215,8 @@ acer_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chansetup(sc, channel, interface) == 0) continue; if ((interface & PCIIDE_CHAN_EN(channel)) == 0) { - aprint_normal("%s: %s channel ignored (disabled)\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "%s channel ignored (disabled)\n", cp->name); cp->ata_channel.ch_flags |= ATACH_DISABLED; continue; } @@ -365,8 +365,9 @@ acer_pci_intr(void *arg) if (chids & ACER_CHIDS_INT(i)) { crv = wdcintr(wdc_cp); if (crv == 0) { - printf("%s:%d: bogus intr\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, i); + aprint_error("%s:%d: bogus intr\n", + device_xname( + sc->sc_wdcdev.sc_atac.atac_dev), i); pciide_irqack(wdc_cp); } else rv = 1; diff --git a/sys/dev/pci/ahcisata_pci.c b/sys/dev/pci/ahcisata_pci.c index 0b87dd5e8dd..74e34615862 100644 --- a/sys/dev/pci/ahcisata_pci.c +++ b/sys/dev/pci/ahcisata_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: ahcisata_pci.c,v 1.8 2008/02/29 06:13:39 dyoung Exp $ */ +/* $NetBSD: ahcisata_pci.c,v 1.9 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.8 2008/02/29 06:13:39 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.9 2008/03/18 20:46:36 cube Exp $"); #include <sys/types.h> #include <sys/malloc.h> @@ -50,23 +50,22 @@ __KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.8 2008/02/29 06:13:39 dyoung Exp #include <dev/ic/ahcisatavar.h> struct ahci_pci_softc { - struct ahci_softc ah_sc; /* must come first, struct device */ + struct ahci_softc ah_sc; pci_chipset_tag_t sc_pc; pcitag_t sc_pcitag; }; -static int ahci_pci_match(struct device *, struct cfdata *, void *); -static void ahci_pci_attach(struct device *, struct device *, void *); +static int ahci_pci_match(device_t, cfdata_t, void *); +static void ahci_pci_attach(device_t, device_t, void *); static bool ahci_pci_resume(device_t PMF_FN_PROTO); -CFATTACH_DECL(ahcisata_pci, sizeof(struct ahci_pci_softc), +CFATTACH_DECL_NEW(ahcisata_pci, sizeof(struct ahci_pci_softc), ahci_pci_match, ahci_pci_attach, NULL, NULL); static int -ahci_pci_match(struct device *parent, struct cfdata *match, - void *aux) +ahci_pci_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; bus_space_tag_t regt; @@ -96,10 +95,10 @@ ahci_pci_match(struct device *parent, struct cfdata *match, } static void -ahci_pci_attach(struct device *parent, struct device *self, void *aux) +ahci_pci_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct ahci_pci_softc *psc = (struct ahci_pci_softc *)self; + struct ahci_pci_softc *psc = device_private(self); struct ahci_softc *sc = &psc->ah_sc; bus_size_t size; char devinfo[256]; @@ -110,7 +109,7 @@ ahci_pci_attach(struct device *parent, struct device *self, void *aux) if (pci_mapreg_map(pa, AHCI_PCI_ABAR, PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0, &sc->sc_ahcit, &sc->sc_ahcih, NULL, &size) != 0) { - aprint_error("%s: can't map ahci registers\n", AHCINAME(sc)); + aprint_error_dev(self, "can't map ahci registers\n"); return; } psc->sc_pc = pa->pa_pc; diff --git a/sys/dev/pci/artsata.c b/sys/dev/pci/artsata.c index b82d850fd29..c24e5d370e8 100644 --- a/sys/dev/pci/artsata.c +++ b/sys/dev/pci/artsata.c @@ -1,4 +1,4 @@ -/* $NetBSD: artsata.c,v 1.16 2007/07/19 21:53:15 dsl Exp $ */ +/* $NetBSD: artsata.c,v 1.17 2008/03/18 20:46:36 cube Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: artsata.c,v 1.16 2007/07/19 21:53:15 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: artsata.c,v 1.17 2008/03/18 20:46:36 cube Exp $"); #include "opt_pciide.h" @@ -58,8 +58,8 @@ __KERNEL_RCSID(0, "$NetBSD: artsata.c,v 1.16 2007/07/19 21:53:15 dsl Exp $"); static void artisea_chip_map(struct pciide_softc*, struct pci_attach_args *); -static int artsata_match(struct device *, struct cfdata *, void *); -static void artsata_attach(struct device *, struct device *, void *); +static int artsata_match(device_t, cfdata_t, void *); +static void artsata_attach(device_t, device_t, void *); static const struct pciide_product_desc pciide_artsata_products[] = { { PCI_PRODUCT_INTEL_31244, @@ -96,12 +96,11 @@ static const struct artisea_cmd_map artisea_dpa_cmd_map[] = #define ARTISEA_NUM_CHAN 4 -CFATTACH_DECL(artsata, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(artsata, sizeof(struct pciide_softc), artsata_match, artsata_attach, NULL, NULL); static int -artsata_match(struct device *parent, struct cfdata *match, - void *aux) +artsata_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -113,10 +112,12 @@ artsata_match(struct device *parent, struct cfdata *match, } static void -artsata_attach(struct device *parent, struct device *self, void *aux) +artsata_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_artsata_products)); @@ -139,21 +140,20 @@ artisea_mapregs(struct pci_attach_args *pa, struct pciide_channel *cp, if (sc->sc_pci_ih == NULL) { if (pci_intr_map(pa, &intrhandle) != 0) { - aprint_error("%s: couldn't map native-PCI interrupt\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map native-PCI interrupt\n"); goto bad; } intrstr = pci_intr_string(pa->pa_pc, intrhandle); sc->sc_pci_ih = pci_intr_establish(pa->pa_pc, intrhandle, IPL_BIO, pci_intr, sc); if (sc->sc_pci_ih != NULL) { - aprint_normal("%s: using %s for native-PCI interrupt\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "using %s for native-PCI interrupt\n", intrstr ? intrstr : "unknown interrupt"); } else { - aprint_error( - "%s: couldn't establish native-PCI interrupt", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't establish native-PCI interrupt"); if (intrstr != NULL) aprint_normal(" at %s", intrstr); aprint_normal("\n"); @@ -165,16 +165,16 @@ artisea_mapregs(struct pci_attach_args *pa, struct pciide_channel *cp, if (bus_space_subregion (sc->sc_ba5_st, sc->sc_ba5_sh, ARTISEA_DPA_PORT_BASE(wdc_cp->ch_channel), 0x200, &wdr->cmd_baseioh) != 0) { - aprint_error("%s: couldn't map %s channel cmd regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map %s channel cmd regs\n", cp->name); goto bad; } wdr->ctl_iot = sc->sc_ba5_st; if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, ARTISEA_SUPDDCTLR, 1, &cp->ctl_baseioh) != 0) { - aprint_error("%s: couldn't map %s channel ctl regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map %s channel ctl regs\n", cp->name); goto bad; } wdr->ctl_ioh = cp->ctl_baseioh; @@ -184,9 +184,9 @@ artisea_mapregs(struct pci_attach_args *pa, struct pciide_channel *cp, if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, artisea_dpa_cmd_map[i].offset, artisea_dpa_cmd_map[i].size, &wdr->cmd_iohs[i]) != 0) { - aprint_error("%s: couldn't subregion %s channel " - "cmd regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't subregion %s channel cmd regs\n", + cp->name); goto bad; } } @@ -199,27 +199,24 @@ artisea_mapregs(struct pci_attach_args *pa, struct pciide_channel *cp, if (bus_space_subregion(wdr->sata_iot, wdr->sata_baseioh, ARTISEA_SUPERSET_DPA_OFF + ARTISEA_SUPDSSSR, 1, &wdr->sata_status) != 0) { - aprint_error("%s: couldn't map channel %d " - "sata_status regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d sata_status regs\n", wdc_cp->ch_channel); goto bad; } if (bus_space_subregion(wdr->sata_iot, wdr->sata_baseioh, ARTISEA_SUPERSET_DPA_OFF + ARTISEA_SUPDSSER, 1, &wdr->sata_error) != 0) { - aprint_error("%s: couldn't map channel %d " - "sata_error regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d sata_error regs\n", wdc_cp->ch_channel); goto bad; } if (bus_space_subregion(wdr->sata_iot, wdr->sata_baseioh, ARTISEA_SUPERSET_DPA_OFF + ARTISEA_SUPDSSCR, 1, &wdr->sata_control) != 0) { - aprint_error("%s: couldn't map channel %d " - "sata_control regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d sata_control regs\n", wdc_cp->ch_channel); goto bad; } @@ -247,7 +244,7 @@ artisea_chansetup(struct pciide_softc *sc, int channel, if (cp->ata_channel.ch_queue == NULL) { aprint_error("%s %s channel: " "can't allocate memory for command queue", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), cp->name); return 0; } return 1; @@ -261,8 +258,8 @@ artisea_mapreg_dma(struct pciide_softc *sc, struct pci_attach_args *pa) u_int32_t dma_ctl; u_int32_t cacheline_len; - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); sc->sc_dma_ok = 1; @@ -293,7 +290,7 @@ artisea_mapreg_dma(struct pciide_softc *sc, struct pci_attach_args *pa) sc->sc_dma_iot = sc->sc_ba5_st; sc->sc_dmat = pa->pa_dmat; - if (device_cfdata(&sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & + if (device_cfdata(sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & PCIIDE_OPTIONS_NODMA) { aprint_verbose( ", but unused (forced off by config file)\n"); @@ -336,8 +333,8 @@ artisea_chip_map_dpa(struct pciide_softc *sc, struct pci_attach_args *pa) interface = PCI_INTERFACE(pa->pa_class); - aprint_normal("%s: interface wired in DPA mode\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "interface wired in DPA mode\n"); if (pci_mapreg_map(pa, ARTISEA_PCI_DPA_BASE, PCI_MAPREG_MEM_TYPE_64BIT, 0, &sc->sc_ba5_st, &sc->sc_ba5_sh, NULL, NULL) != 0) @@ -374,8 +371,8 @@ artisea_chip_map_dpa(struct pciide_softc *sc, struct pci_attach_args *pa) if ((bus_space_read_4 (sc->sc_ba5_st, sc->sc_ba5_sh, ARTISEA_DPA_PORT_BASE(0) + ARTISEA_SUPERSET_DPA_OFF + ARTISEA_SUPDPFR) & SUPDPFR_SSCEN) != 0) { - aprint_error("%s: Spread-specturm clocking not supported by device\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "Spread-specturm clocking not supported by device\n"); return; } @@ -412,8 +409,8 @@ artisea_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) return; } - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); #ifdef PCIIDE_I31244_DISABLEDMA if (sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_31244 && PCI_REVISION(pa->pa_class) == 0) { diff --git a/sys/dev/pci/cmdide.c b/sys/dev/pci/cmdide.c index 499edfc4d56..c91efcffcfd 100644 --- a/sys/dev/pci/cmdide.c +++ b/sys/dev/pci/cmdide.c @@ -1,4 +1,4 @@ -/* $NetBSD: cmdide.c,v 1.27 2007/02/09 21:55:27 ad Exp $ */ +/* $NetBSD: cmdide.c,v 1.28 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cmdide.c,v 1.27 2007/02/09 21:55:27 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cmdide.c,v 1.28 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -43,10 +43,10 @@ __KERNEL_RCSID(0, "$NetBSD: cmdide.c,v 1.27 2007/02/09 21:55:27 ad Exp $"); #include <dev/pci/pciide_cmd_reg.h> -static int cmdide_match(struct device *, struct cfdata *, void *); -static void cmdide_attach(struct device *, struct device *, void *); +static int cmdide_match(device_t, cfdata_t, void *); +static void cmdide_attach(device_t, device_t, void *); -CFATTACH_DECL(cmdide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(cmdide, sizeof(struct pciide_softc), cmdide_match, cmdide_attach, NULL, NULL); static void cmd_chip_map(struct pciide_softc*, struct pci_attach_args*); @@ -100,8 +100,7 @@ static const struct pciide_product_desc pciide_cmd_products[] = { }; static int -cmdide_match(struct device *parent, struct cfdata *match, - void *aux) +cmdide_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -113,10 +112,12 @@ cmdide_match(struct device *parent, struct cfdata *match, } static void -cmdide_attach(struct device *parent, struct device *self, void *aux) +cmdide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_cmd_products)); @@ -174,13 +175,13 @@ cmd_channel_map(struct pci_attach_args *pa, struct pciide_softc *sc, if (cp->ata_channel.ch_queue == NULL) { aprint_error("%s %s channel: " "can't allocate memory for command queue", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), cp->name); return; } cp->ata_channel.ch_ndrive = 2; - aprint_normal("%s: %s channel %s to %s mode\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name, + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "%s channel %s to %s mode\n", cp->name, (interface & PCIIDE_INTERFACE_SETTABLE(channel)) ? "configured" : "wired", (interface & PCIIDE_INTERFACE_PCI(channel)) ? @@ -192,8 +193,8 @@ cmd_channel_map(struct pci_attach_args *pa, struct pciide_softc *sc, * the whole device */ if (channel != 0 && (ctrl & CMD_CTRL_2PORT) == 0) { - aprint_normal("%s: %s channel ignored (disabled)\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "%s channel ignored (disabled)\n", cp->name); cp->ata_channel.ch_flags |= ATACH_DISABLED; return; } @@ -223,8 +224,9 @@ cmd_pci_intr(void *arg) (i == 1 && (secirq & CMD_ARTTIM23_IRQ))) { crv = wdcintr(wdc_cp); if (crv == 0) { - printf("%s:%d: bogus intr\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, i); + aprint_error("%s:%d: bogus intr\n", + device_xname( + sc->sc_wdcdev.sc_atac.atac_dev), i); sc->sc_wdcdev.irqack(wdc_cp); } else rv = 1; @@ -253,8 +255,8 @@ cmd_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) return; #endif - aprint_normal("%s: hardware does not support DMA\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "hardware does not support DMA\n"); sc->sc_dma_ok = 0; sc->sc_wdcdev.sc_atac.atac_channels = sc->wdc_chanarray; @@ -290,8 +292,8 @@ cmd0643_9_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) return; #endif - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; @@ -467,8 +469,8 @@ cmd680_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; @@ -527,7 +529,7 @@ cmd680_channel_map(struct pci_attach_args *pa, struct pciide_softc *sc, if (cp->ata_channel.ch_queue == NULL) { aprint_error("%s %s channel: " "can't allocate memory for command queue", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), cp->name); return; } cp->ata_channel.ch_ndrive = 2; @@ -537,8 +539,8 @@ cmd680_channel_map(struct pci_attach_args *pa, struct pciide_softc *sc, for (i = 0; i < sizeof(init_val); i++) pciide_pci_write(sc->sc_pc, sc->sc_tag, reg + i, init_val[i]); - aprint_normal("%s: %s channel %s to %s mode\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name, + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "%s channel %s to %s mode\n", cp->name, (interface & PCIIDE_INTERFACE_SETTABLE(channel)) ? "configured" : "wired", (interface & PCIIDE_INTERFACE_PCI(channel)) ? diff --git a/sys/dev/pci/cypide.c b/sys/dev/pci/cypide.c index f54c4417f23..a01edde5960 100644 --- a/sys/dev/pci/cypide.c +++ b/sys/dev/pci/cypide.c @@ -1,4 +1,4 @@ -/* $NetBSD: cypide.c,v 1.20 2007/02/09 21:55:27 ad Exp $ */ +/* $NetBSD: cypide.c,v 1.21 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cypide.c,v 1.20 2007/02/09 21:55:27 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cypide.c,v 1.21 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -47,10 +47,10 @@ __KERNEL_RCSID(0, "$NetBSD: cypide.c,v 1.20 2007/02/09 21:55:27 ad Exp $"); static void cy693_chip_map(struct pciide_softc*, struct pci_attach_args*); static void cy693_setup_channel(struct ata_channel*); -static int cypide_match(struct device *, struct cfdata *, void *); -static void cypide_attach(struct device *, struct device *, void *); +static int cypide_match(device_t, cfdata_t, void *); +static void cypide_attach(device_t, device_t, void *); -CFATTACH_DECL(cypide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(cypide, sizeof(struct pciide_softc), cypide_match, cypide_attach, NULL, NULL); static const struct pciide_product_desc pciide_cypress_products[] = { @@ -67,8 +67,7 @@ static const struct pciide_product_desc pciide_cypress_products[] = { }; static int -cypide_match(struct device *parent, struct cfdata *match, - void *aux) +cypide_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -82,10 +81,12 @@ cypide_match(struct device *parent, struct cfdata *match, } static void -cypide_attach(struct device *parent, struct device *self, void *aux) +cypide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_cypress_products)); @@ -112,24 +113,24 @@ cy693_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) } else if (pa->pa_function == 2) { sc->sc_cy_compatchan = 1; } else { - aprint_error("%s: unexpected PCI function %d\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, pa->pa_function); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "unexpected PCI function %d\n", pa->pa_function); return; } if (interface & PCIIDE_INTERFACE_BUS_MASTER_DMA) { - aprint_verbose("%s: bus-master DMA support present\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present\n"); pciide_mapreg_dma(sc, pa); } else { - aprint_normal("%s: hardware does not support DMA\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "hardware does not support DMA\n"); sc->sc_dma_ok = 0; } sc->sc_cy_handle = cy82c693_init(pa->pa_iot); if (sc->sc_cy_handle == NULL) { - aprint_error("%s: unable to map hyperCache control registers\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "unable to map hyperCache control registers\n"); sc->sc_dma_ok = 0; } @@ -159,11 +160,11 @@ cy693_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (cp->ata_channel.ch_queue == NULL) { aprint_error("%s primary channel: " "can't allocate memory for command queue", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + device_xname(sc->sc_wdcdev.sc_atac.atac_dev)); return; } - aprint_normal("%s: primary channel %s to ", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "primary channel %s to ", (interface & PCIIDE_INTERFACE_SETTABLE(0)) ? "configured" : "wired"); if (interface & PCIIDE_INTERFACE_PCI(0)) { diff --git a/sys/dev/pci/geodeide.c b/sys/dev/pci/geodeide.c index 484ebeb07e9..64bb9b1f569 100644 --- a/sys/dev/pci/geodeide.c +++ b/sys/dev/pci/geodeide.c @@ -1,4 +1,4 @@ -/* $NetBSD: geodeide.c,v 1.14 2007/02/09 21:55:27 ad Exp $ */ +/* $NetBSD: geodeide.c,v 1.15 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 2004 Manuel Bouyer. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: geodeide.c,v 1.14 2007/02/09 21:55:27 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: geodeide.c,v 1.15 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -56,10 +56,10 @@ static void geodeide_chip_map(struct pciide_softc *, static void geodeide_setup_channel(struct ata_channel *); static int geodeide_dma_init(void *, int, int, void *, size_t, int); -static int geodeide_match(struct device *, struct cfdata *, void *); -static void geodeide_attach(struct device *, struct device *, void *); +static int geodeide_match(device_t, cfdata_t, void *); +static void geodeide_attach(device_t, device_t, void *); -CFATTACH_DECL(geodeide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(geodeide, sizeof(struct pciide_softc), geodeide_match, geodeide_attach, NULL, NULL); static const struct pciide_product_desc pciide_geode_products[] = { @@ -81,8 +81,7 @@ static const struct pciide_product_desc pciide_geode_products[] = { }; static int -geodeide_match(struct device *parent, struct cfdata *match, - void *aux) +geodeide_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -96,10 +95,12 @@ geodeide_match(struct device *parent, struct cfdata *match, } static void -geodeide_attach(struct device *parent, struct device *self, void *aux) +geodeide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (void *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_geode_products)); @@ -115,8 +116,8 @@ geodeide_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); if (sc->sc_dma_ok) { diff --git a/sys/dev/pci/hptide.c b/sys/dev/pci/hptide.c index 25aa182a16a..970baecdc28 100644 --- a/sys/dev/pci/hptide.c +++ b/sys/dev/pci/hptide.c @@ -1,4 +1,4 @@ -/* $NetBSD: hptide.c,v 1.24 2007/02/09 21:55:27 ad Exp $ */ +/* $NetBSD: hptide.c,v 1.25 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hptide.c,v 1.24 2007/02/09 21:55:27 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hptide.c,v 1.25 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -45,10 +45,10 @@ static void hpt_chip_map(struct pciide_softc*, struct pci_attach_args*); static void hpt_setup_channel(struct ata_channel*); static int hpt_pci_intr(void *); -static int hptide_match(struct device *, struct cfdata *, void *); -static void hptide_attach(struct device *, struct device *, void *); +static int hptide_match(device_t, cfdata_t, void *); +static void hptide_attach(device_t, device_t, void *); -CFATTACH_DECL(hptide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(hptide, sizeof(struct pciide_softc), hptide_match, hptide_attach, NULL, NULL); static const struct pciide_product_desc pciide_triones_products[] = { @@ -85,8 +85,7 @@ static const struct pciide_product_desc pciide_triones_products[] = { }; static int -hptide_match(struct device *parent, struct cfdata *match, - void *aux) +hptide_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -98,10 +97,12 @@ hptide_match(struct device *parent, struct cfdata *match, } static void -hptide_attach(struct device *parent, struct device *self, void *aux) +hptide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_triones_products)); @@ -120,8 +121,8 @@ hpt_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) return; revision = PCI_REVISION(pa->pa_class); - aprint_normal("%s: Triones/Highpoint ", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "Triones/Highpoint "); switch (sc->sc_pp->ide_product) { case PCI_PRODUCT_TRIONES_HPT302: aprint_normal("HPT302 IDE Controller\n"); @@ -174,8 +175,8 @@ hpt_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) interface |= PCIIDE_INTERFACE_PCI(1); } - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; @@ -215,7 +216,9 @@ hpt_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) HPT370_CTRL1(i)) & HPT370_CTRL1_EN) == 0) { aprint_normal( "%s: %s channel ignored (disabled)\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + device_xname( + sc->sc_wdcdev.sc_atac.atac_dev), + cp->name); cp->ata_channel.ch_flags |= ATACH_DISABLED; continue; } @@ -230,8 +233,10 @@ hpt_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) else if (pa->pa_function == 1) compatchan = 1; else { - aprint_error("%s: unexpected PCI function %d\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, pa->pa_function); + aprint_error_dev( + sc->sc_wdcdev.sc_atac.atac_dev, + "unexpected PCI function %d\n", + pa->pa_function); return; } } @@ -375,7 +380,7 @@ hpt_setup_channel(struct ata_channel *chp) pci_conf_write(sc->sc_pc, sc->sc_tag, HPT_IDETIM(chp->ch_channel, drive), after); ATADEBUG_PRINT(("%s: bus speed register set to 0x%08x " - "(BIOS 0x%08x)\n", drvp->drv_softc->dv_xname, + "(BIOS 0x%08x)\n", device_xname(drvp->drv_softc), after, before), DEBUG_PROBE); } if (idedma_ctl != 0) { @@ -404,8 +409,8 @@ hpt_pci_intr(void *arg) wdc_cp = &cp->ata_channel; crv = wdcintr(wdc_cp); if (crv == 0) { - printf("%s:%d: bogus intr\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, i); + aprint_error("%s:%d: bogus intr\n", + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), i); bus_space_write_1(sc->sc_dma_iot, cp->dma_iohs[IDEDMA_CTL], 0, dmastat); } else diff --git a/sys/dev/pci/iteide.c b/sys/dev/pci/iteide.c index cc233c937bf..cdda9bc42c8 100644 --- a/sys/dev/pci/iteide.c +++ b/sys/dev/pci/iteide.c @@ -1,4 +1,4 @@ -/* $NetBSD: iteide.c,v 1.8 2007/02/09 21:55:27 ad Exp $ */ +/* $NetBSD: iteide.c,v 1.9 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: iteide.c,v 1.8 2007/02/09 21:55:27 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: iteide.c,v 1.9 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -45,10 +45,10 @@ __KERNEL_RCSID(0, "$NetBSD: iteide.c,v 1.8 2007/02/09 21:55:27 ad Exp $"); static void ite_chip_map(struct pciide_softc*, struct pci_attach_args*); static void ite_setup_channel(struct ata_channel*); -static int iteide_match(struct device *, struct cfdata *, void *); -static void iteide_attach(struct device *, struct device *, void *); +static int iteide_match(device_t, cfdata_t, void *); +static void iteide_attach(device_t, device_t, void *); -CFATTACH_DECL(iteide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(iteide, sizeof(struct pciide_softc), iteide_match, iteide_attach, NULL, NULL); static const struct pciide_product_desc pciide_ite_products[] = { @@ -70,8 +70,7 @@ static const struct pciide_product_desc pciide_ite_products[] = { }; static int -iteide_match(struct device *parent, struct cfdata *match, - void *aux) +iteide_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ITE && @@ -83,10 +82,12 @@ iteide_match(struct device *parent, struct cfdata *match, } static void -iteide_attach(struct device *parent, struct device *self, void *aux) +iteide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_ite_products)); @@ -108,14 +109,14 @@ ite_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) cfg = pci_conf_read(sc->sc_pc, sc->sc_tag, IT_CFG); modectl = pci_conf_read(sc->sc_pc, sc->sc_tag, IT_MODE); ATADEBUG_PRINT(("%s: cfg=0x%x, modectl=0x%x\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cfg & IT_CFG_MASK, + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), cfg & IT_CFG_MASK, modectl & IT_MODE_MASK), DEBUG_PROBE); if (pciide_chipen(sc, pa) == 0) return; - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); @@ -155,7 +156,7 @@ ite_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) cfg = pci_conf_read(sc->sc_pc, sc->sc_tag, IT_CFG); modectl = pci_conf_read(sc->sc_pc, sc->sc_tag, IT_MODE); ATADEBUG_PRINT(("%s: cfg=0x%x, modectl=0x%x\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cfg & IT_CFG_MASK, + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), cfg & IT_CFG_MASK, modectl & IT_MODE_MASK), DEBUG_PROBE); } @@ -175,7 +176,7 @@ ite_setup_channel(struct ata_channel *chp) modectl = pci_conf_read(sc->sc_pc, sc->sc_tag, IT_MODE); tim = pci_conf_read(sc->sc_pc, sc->sc_tag, IT_TIM(channel)); ATADEBUG_PRINT(("%s:%d: tim=0x%x\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), channel, tim), DEBUG_PROBE); /* Setup DMA if needed */ @@ -249,7 +250,7 @@ pio: } ATADEBUG_PRINT(("%s: tim=0x%x\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, tim), DEBUG_PROBE); + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), tim), DEBUG_PROBE); pci_conf_write(sc->sc_pc, sc->sc_tag, IT_CFG, cfg); pci_conf_write(sc->sc_pc, sc->sc_tag, IT_MODE, modectl); diff --git a/sys/dev/pci/ixpide.c b/sys/dev/pci/ixpide.c index d3419fc6a65..36446402dcc 100644 --- a/sys/dev/pci/ixpide.c +++ b/sys/dev/pci/ixpide.c @@ -1,4 +1,4 @@ -/* $NetBSD: ixpide.c,v 1.10 2007/09/10 10:35:54 cube Exp $ */ +/* $NetBSD: ixpide.c,v 1.11 2008/03/18 20:46:36 cube Exp $ */ /* * Copyright (c) 2004 The NetBSD Foundation. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixpide.c,v 1.10 2007/09/10 10:35:54 cube Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixpide.c,v 1.11 2008/03/18 20:46:36 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -41,13 +41,13 @@ __KERNEL_RCSID(0, "$NetBSD: ixpide.c,v 1.10 2007/09/10 10:35:54 cube Exp $"); #include <dev/pci/pciidevar.h> #include <dev/pci/pciide_ixp_reg.h> -static int ixpide_match(struct device *, struct cfdata *, void *); -static void ixpide_attach(struct device *, struct device *, void *); +static int ixpide_match(device_t, cfdata_t, void *); +static void ixpide_attach(device_t, device_t, void *); static void ixp_chip_map(struct pciide_softc *, struct pci_attach_args *); static void ixp_setup_channel(struct ata_channel *); -CFATTACH_DECL(ixpide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(ixpide, sizeof(struct pciide_softc), ixpide_match, ixpide_attach, NULL, NULL); static const char ixpdesc[] = "ATI Technologies IXP IDE Controller"; @@ -65,8 +65,7 @@ static const struct pciide_product_desc pciide_ixpide_products[] = { }; static int -ixpide_match(struct device *parent, struct cfdata *cfdata, - void *aux) +ixpide_match(device_t parent, cfdata_t cfdata, void *aux) { struct pci_attach_args *pa = (struct pci_attach_args *)aux; @@ -79,10 +78,12 @@ ixpide_match(struct device *parent, struct cfdata *cfdata, } static void -ixpide_attach(struct device *parent, struct device *self, void *aux) +ixpide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_ixpide_products)); @@ -99,8 +100,8 @@ ixp_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); diff --git a/sys/dev/pci/jmide.c b/sys/dev/pci/jmide.c index 27755e00593..5b0e471792e 100644 --- a/sys/dev/pci/jmide.c +++ b/sys/dev/pci/jmide.c @@ -1,4 +1,4 @@ -/* $NetBSD: jmide.c,v 1.3 2008/02/11 08:23:48 xtraeme Exp $ */ +/* $NetBSD: jmide.c,v 1.4 2008/03/18 20:46:37 cube Exp $ */ /* * Copyright (c) 2007 Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: jmide.c,v 1.3 2008/02/11 08:23:48 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: jmide.c,v 1.4 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -49,8 +49,8 @@ __KERNEL_RCSID(0, "$NetBSD: jmide.c,v 1.3 2008/02/11 08:23:48 xtraeme Exp $"); static const struct jmide_product *jmide_lookup(pcireg_t); -static int jmide_match(struct device *, struct cfdata *, void *); -static void jmide_attach(struct device *, struct device *, void *); +static int jmide_match(device_t, cfdata_t, void *); +static void jmide_attach(device_t, device_t, void *); static int jmide_intr(void *); static void jmpata_chip_map(struct pciide_softc*, struct pci_attach_args*); @@ -117,9 +117,9 @@ struct jmahci_attach_args { bus_space_handle_t jma_ahcih; }; -#define JM_NAME(sc) (sc->sc_pciide.sc_wdcdev.sc_atac.atac_dev.dv_xname) +#define JM_NAME(sc) (device_xname(sc->sc_pciide.sc_wdcdev.sc_atac.atac_dev)) -CFATTACH_DECL(jmide, sizeof(struct jmide_softc), +CFATTACH_DECL_NEW(jmide, sizeof(struct jmide_softc), jmide_match, jmide_attach, NULL, NULL); static const struct jmide_product * @@ -134,8 +134,7 @@ jmide_lookup(pcireg_t id) { } static int -jmide_match(struct device *parent, struct cfdata *match, - void *aux) +jmide_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -147,10 +146,10 @@ jmide_match(struct device *parent, struct cfdata *match, } static void -jmide_attach(struct device *parent, struct device *self, void *aux) +jmide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct jmide_softc *sc = (struct jmide_softc *)self; + struct jmide_softc *sc = device_private(self); const struct jmide_product *jp; char devinfo[256]; const char *intrstr; @@ -162,6 +161,8 @@ jmide_attach(struct device *parent, struct device *self, void *aux) struct pciide_product_desc *pp; int ahci_used = 0; + sc->sc_pciide.sc_wdcdev.sc_atac.atac_dev = self; + jp = jmide_lookup(pa->pa_id); if (jp == NULL) { printf("jmide_attach: WTF?\n"); @@ -224,7 +225,7 @@ jmide_attach(struct device *parent, struct device *self, void *aux) JM_NAME(sc)); } else { sc->sc_ahci = config_found_ia( - &sc->sc_pciide.sc_wdcdev.sc_atac.atac_dev, + sc->sc_pciide.sc_wdcdev.sc_atac.atac_dev, "jmide_hl", &jma, jmahci_print); } /* diff --git a/sys/dev/pci/optiide.c b/sys/dev/pci/optiide.c index 8178ebd731f..809e1119294 100644 --- a/sys/dev/pci/optiide.c +++ b/sys/dev/pci/optiide.c @@ -1,4 +1,4 @@ -/* $NetBSD: optiide.c,v 1.15 2007/02/09 21:55:27 ad Exp $ */ +/* $NetBSD: optiide.c,v 1.16 2008/03/18 20:46:37 cube Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: optiide.c,v 1.15 2007/02/09 21:55:27 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: optiide.c,v 1.16 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -51,10 +51,10 @@ __KERNEL_RCSID(0, "$NetBSD: optiide.c,v 1.15 2007/02/09 21:55:27 ad Exp $"); static void opti_chip_map(struct pciide_softc*, struct pci_attach_args*); static void opti_setup_channel(struct ata_channel*); -static int optiide_match(struct device *, struct cfdata *, void *); -static void optiide_attach(struct device *, struct device *, void *); +static int optiide_match(device_t, cfdata_t, void *); +static void optiide_attach(device_t, device_t, void *); -CFATTACH_DECL(optiide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(optiide, sizeof(struct pciide_softc), optiide_match, optiide_attach, NULL, NULL); static const struct pciide_product_desc pciide_opti_products[] = { @@ -81,8 +81,7 @@ static const struct pciide_product_desc pciide_opti_products[] = { }; static int -optiide_match(struct device *parent, struct cfdata *match, - void *aux) +optiide_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -96,10 +95,12 @@ optiide_match(struct device *parent, struct cfdata *match, } static void -optiide_attach(struct device *parent, struct device *self, void *aux) +optiide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_opti_products)); @@ -118,8 +119,8 @@ opti_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); /* * XXXSCW: @@ -163,8 +164,8 @@ opti_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) continue; if (channel == 1 && (init_ctrl & OPTI_INIT_CONTROL_CH2_DISABLE) != 0) { - aprint_normal("%s: %s channel ignored (disabled)\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "%s channel ignored (disabled)\n", cp->name); cp->ata_channel.ch_flags |= ATACH_DISABLED; continue; } diff --git a/sys/dev/pci/pciide.c b/sys/dev/pci/pciide.c index 207dbd6cc74..7669b4a39fe 100644 --- a/sys/dev/pci/pciide.c +++ b/sys/dev/pci/pciide.c @@ -1,4 +1,4 @@ -/* $NetBSD: pciide.c,v 1.215 2006/11/16 01:33:09 christos Exp $ */ +/* $NetBSD: pciide.c,v 1.216 2008/03/18 20:46:37 cube Exp $ */ /* @@ -75,7 +75,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pciide.c,v 1.215 2006/11/16 01:33:09 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pciide.c,v 1.216 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> @@ -83,15 +83,14 @@ __KERNEL_RCSID(0, "$NetBSD: pciide.c,v 1.215 2006/11/16 01:33:09 christos Exp $" #include <dev/pci/pciidereg.h> #include <dev/pci/pciidevar.h> -int pciide_match(struct device *, struct cfdata *, void *); -void pciide_attach(struct device *, struct device *, void *); +int pciide_match(device_t, cfdata_t, void *); +void pciide_attach(device_t, device_t, void *); -CFATTACH_DECL(pciide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(pciide, sizeof(struct pciide_softc), pciide_match, pciide_attach, NULL, NULL); int -pciide_match(struct device *parent, struct cfdata *match, - void *aux) +pciide_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -109,10 +108,12 @@ pciide_match(struct device *parent, struct cfdata *match, } void -pciide_attach(struct device *parent, struct device *self, void *aux) +pciide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, NULL); } diff --git a/sys/dev/pci/pciide_common.c b/sys/dev/pci/pciide_common.c index 3b05ff9dccf..f9883ac591d 100644 --- a/sys/dev/pci/pciide_common.c +++ b/sys/dev/pci/pciide_common.c @@ -1,4 +1,4 @@ -/* $NetBSD: pciide_common.c,v 1.37 2007/03/04 06:02:25 christos Exp $ */ +/* $NetBSD: pciide_common.c,v 1.38 2008/03/18 20:46:37 cube Exp $ */ /* @@ -76,7 +76,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.37 2007/03/04 06:02:25 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.38 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> #include <sys/malloc.h> @@ -152,8 +152,8 @@ pciide_common_attach(sc, pa, pp) /* if displaydev == NULL, printf is done in chip-specific map */ if (displaydev) - aprint_normal("%s: %s (rev. 0x%02x)\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, displaydev, + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "%s (rev. 0x%02x)\n", displaydev, PCI_REVISION(pa->pa_class)); sc->sc_pc = pa->pa_pc; @@ -193,8 +193,8 @@ pciide_chipen(sc, pa) if ((pa->pa_flags & PCI_FLAGS_IO_ENABLED) == 0) { csr = pci_conf_read(sc->sc_pc, sc->sc_tag, PCI_COMMAND_STATUS_REG); - aprint_normal("%s: device disabled (at %s)\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "device disabled (at %s)\n", (csr & PCI_COMMAND_IO_ENABLE) == 0 ? "device" : "bridge"); return 0; @@ -221,16 +221,16 @@ pciide_mapregs_compat(pa, cp, compatchan, cmdsizep, ctlsizep) wdr->cmd_iot = pa->pa_iot; if (bus_space_map(wdr->cmd_iot, PCIIDE_COMPAT_CMD_BASE(compatchan), PCIIDE_COMPAT_CMD_SIZE, 0, &wdr->cmd_baseioh) != 0) { - aprint_error("%s: couldn't map %s channel cmd regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map %s channel cmd regs\n", cp->name); goto bad; } wdr->ctl_iot = pa->pa_iot; if (bus_space_map(wdr->ctl_iot, PCIIDE_COMPAT_CTL_BASE(compatchan), PCIIDE_COMPAT_CTL_SIZE, 0, &wdr->ctl_ioh) != 0) { - aprint_error("%s: couldn't map %s channel ctl regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map %s channel ctl regs\n", cp->name); bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh, PCIIDE_COMPAT_CMD_SIZE); goto bad; @@ -239,9 +239,9 @@ pciide_mapregs_compat(pa, cp, compatchan, cmdsizep, ctlsizep) for (i = 0; i < WDC_NREG; i++) { if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i, i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) { - aprint_error("%s: couldn't subregion %s channel " - "cmd regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't subregion %s channel cmd regs\n", + cp->name); goto bad; } } @@ -273,24 +273,23 @@ pciide_mapregs_native(pa, cp, cmdsizep, ctlsizep, pci_intr) if (sc->sc_pci_ih == NULL) { if (pci_intr_map(pa, &intrhandle) != 0) { - aprint_error("%s: couldn't map native-PCI interrupt\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map native-PCI interrupt\n"); goto bad; } intrstr = pci_intr_string(pa->pa_pc, intrhandle); sc->sc_pci_ih = pci_intr_establish(pa->pa_pc, intrhandle, IPL_BIO, pci_intr, sc); if (sc->sc_pci_ih != NULL) { - aprint_normal("%s: using %s for native-PCI interrupt\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "using %s for native-PCI interrupt\n", intrstr ? intrstr : "unknown interrupt"); } else { - aprint_error( - "%s: couldn't establish native-PCI interrupt", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't establish native-PCI interrupt"); if (intrstr != NULL) - aprint_normal(" at %s", intrstr); - aprint_normal("\n"); + aprint_error(" at %s", intrstr); + aprint_error("\n"); goto bad; } } @@ -298,16 +297,16 @@ pciide_mapregs_native(pa, cp, cmdsizep, ctlsizep, pci_intr) if (pci_mapreg_map(pa, PCIIDE_REG_CMD_BASE(wdc_cp->ch_channel), PCI_MAPREG_TYPE_IO, 0, &wdr->cmd_iot, &wdr->cmd_baseioh, NULL, cmdsizep) != 0) { - aprint_error("%s: couldn't map %s channel cmd regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map %s channel cmd regs\n", cp->name); goto bad; } if (pci_mapreg_map(pa, PCIIDE_REG_CTL_BASE(wdc_cp->ch_channel), PCI_MAPREG_TYPE_IO, 0, &wdr->ctl_iot, &cp->ctl_baseioh, NULL, ctlsizep) != 0) { - aprint_error("%s: couldn't map %s channel ctl regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map %s channel ctl regs\n", cp->name); bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh, *cmdsizep); goto bad; @@ -319,8 +318,8 @@ pciide_mapregs_native(pa, cp, cmdsizep, ctlsizep, pci_intr) */ if (bus_space_subregion(wdr->ctl_iot, cp->ctl_baseioh, 2, 1, &wdr->ctl_ioh) != 0) { - aprint_error("%s: unable to subregion %s channel ctl regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "unable to subregion %s channel ctl regs\n", cp->name); bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh, *cmdsizep); bus_space_unmap(wdr->cmd_iot, cp->ctl_baseioh, *ctlsizep); @@ -330,9 +329,9 @@ pciide_mapregs_native(pa, cp, cmdsizep, ctlsizep, pci_intr) for (i = 0; i < WDC_NREG; i++) { if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i, i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) { - aprint_error("%s: couldn't subregion %s channel " - "cmd regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't subregion %s channel cmd regs\n", + cp->name); goto bad; } } @@ -410,7 +409,7 @@ pciide_mapreg_dma(sc, pa) sc->sc_wdcdev.dma_finish = pciide_dma_finish; } - if (device_cfdata(&sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & + if (device_cfdata(sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & PCIIDE_OPTIONS_NODMA) { aprint_verbose( ", but unused (forced off by config file)"); @@ -556,16 +555,18 @@ pciide_dma_table_setup(sc, channel, drive) if ((error = bus_dmamem_alloc(sc->sc_dmat, dma_table_size, IDEDMA_TBL_ALIGN, IDEDMA_TBL_ALIGN, &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) { - aprint_error(dmaerrfmt, sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - channel, "allocate", drive, error); + aprint_error(dmaerrfmt, + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), channel, + "allocate", drive, error); return error; } if ((error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, dma_table_size, (void **)&dma_maps->dma_table, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) { - aprint_error(dmaerrfmt, sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - channel, "map", drive, error); + aprint_error(dmaerrfmt, + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), channel, + "map", drive, error); return error; } ATADEBUG_PRINT(("pciide_dma_table_setup: table at %p len %lu, " @@ -575,16 +576,18 @@ pciide_dma_table_setup(sc, channel, drive) if ((error = bus_dmamap_create(sc->sc_dmat, dma_table_size, 1, dma_table_size, IDEDMA_TBL_ALIGN, BUS_DMA_NOWAIT, &dma_maps->dmamap_table)) != 0) { - aprint_error(dmaerrfmt, sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - channel, "create", drive, error); + aprint_error(dmaerrfmt, + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), channel, + "create", drive, error); return error; } if ((error = bus_dmamap_load(sc->sc_dmat, dma_maps->dmamap_table, dma_maps->dma_table, dma_table_size, NULL, BUS_DMA_NOWAIT)) != 0) { - aprint_error(dmaerrfmt, sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - channel, "load", drive, error); + aprint_error(dmaerrfmt, + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), channel, + "load", drive, error); return error; } ATADEBUG_PRINT(("pciide_dma_table_setup: phy addr of table 0x%lx\n", @@ -595,8 +598,9 @@ pciide_dma_table_setup(sc, channel, drive) NIDEDMA_TABLES(sc), sc->sc_dma_maxsegsz, sc->sc_dma_boundary, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &dma_maps->dmamap_xfer)) != 0) { - aprint_error(dmaerrfmt, sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - channel, "create xfer", drive, error); + aprint_error(dmaerrfmt, + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), channel, + "create xfer", drive, error); return error; } return 0; @@ -619,8 +623,9 @@ pciide_dma_dmamap_setup(sc, channel, drive, databuf, datalen, flags) databuf, datalen, NULL, BUS_DMA_NOWAIT | BUS_DMA_STREAMING | ((flags & WDC_DMA_READ) ? BUS_DMA_READ : BUS_DMA_WRITE)); if (error) { - printf(dmaerrfmt, sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - channel, "load xfer", drive, error); + aprint_error(dmaerrfmt, + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), channel, + "load xfer", drive, error); return error; } @@ -748,15 +753,16 @@ pciide_dma_finish(v, channel, drive, force) bus_dmamap_unload(sc->sc_dmat, dma_maps->dmamap_xfer); if ((status & IDEDMA_CTL_ERR) != 0 && force != WDC_DMAEND_ABRT_QUIET) { - printf("%s:%d:%d: bus-master DMA error: status=0x%x\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, channel, drive, - status); + aprint_error("%s:%d:%d: bus-master DMA error: status=0x%x\n", + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), channel, + drive, status); error |= WDC_DMAST_ERR; } if ((status & IDEDMA_CTL_INTR) == 0 && force != WDC_DMAEND_ABRT_QUIET) { - printf("%s:%d:%d: bus-master DMA error: missing interrupt, " - "status=0x%x\n", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error("%s:%d:%d: bus-master DMA error: missing " + "interrupt, status=0x%x\n", + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), channel, drive, status); error |= WDC_DMAST_NOIRQ; } @@ -798,12 +804,12 @@ pciide_chansetup(sc, channel, interface) if (cp->ata_channel.ch_queue == NULL) { aprint_error("%s %s channel: " "can't allocate memory for command queue", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), cp->name); return 0; } cp->ata_channel.ch_ndrive = 2; - aprint_verbose("%s: %s channel %s to %s mode\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name, + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "%s channel %s to %s mode\n", cp->name, (interface & PCIIDE_INTERFACE_SETTABLE(channel)) ? "configured" : "wired", (interface & PCIIDE_INTERFACE_PCI(channel)) ? @@ -846,13 +852,13 @@ pciide_map_compat_intr(pa, cp, compatchan) #ifdef __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH cp->ih = - pciide_machdep_compat_intr_establish(&sc->sc_wdcdev.sc_atac.atac_dev, + pciide_machdep_compat_intr_establish(sc->sc_wdcdev.sc_atac.atac_dev, pa, compatchan, pciide_compat_intr, cp); if (cp->ih == NULL) { #endif - aprint_error("%s: no compatibility interrupt for use by %s " - "channel\n", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "no compatibility interrupt for use by %s " + "channel\n", cp->name); cp->ata_channel.ch_flags |= ATACH_DISABLED; #ifdef __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH } @@ -881,10 +887,10 @@ default_chip_map(sc, pa) if (interface & PCIIDE_INTERFACE_BUS_MASTER_DMA) { #if NATA_DMA - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); if (sc->sc_pp == &default_product_desc && - (device_cfdata(&sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & + (device_cfdata(sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & PCIIDE_OPTIONS_DMA) == 0) { aprint_verbose(", but unused (no driver support)"); sc->sc_dma_ok = 0; @@ -895,12 +901,13 @@ default_chip_map(sc, pa) "support"); } #else - aprint_verbose("%s: bus-master DMA support present, but unused (no driver support)", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present, but unused (no driver " + "support)"); #endif /* NATA_DMA */ } else { - aprint_verbose("%s: hardware does not support DMA", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "hardware does not support DMA"); #if NATA_DMA sc->sc_dma_ok = 0; #endif @@ -971,9 +978,8 @@ default_chip_map(sc, pa) PCI_COMMAND_STATUS_REG, csr); next: if (failreason) { - aprint_error("%s: %s channel ignored (%s)\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name, - failreason); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "%s channel ignored (%s)\n", cp->name, failreason); cp->ata_channel.ch_flags |= ATACH_DISABLED; bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh, cmdsize); @@ -1004,7 +1010,8 @@ next: aprint_error( "%s:%d:%d: can't allocate DMA maps, " "using PIO transfers\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + device_xname( + sc->sc_wdcdev.sc_atac.atac_dev), channel, drive); sc->sc_dma_ok = 0; sc->sc_wdcdev.sc_atac.atac_cap &= ~ATAC_CAP_DMA; diff --git a/sys/dev/pci/pdcide.c b/sys/dev/pci/pdcide.c index 4899b21a369..c0c379ccb12 100644 --- a/sys/dev/pci/pdcide.c +++ b/sys/dev/pci/pdcide.c @@ -1,4 +1,4 @@ -/* $NetBSD: pdcide.c,v 1.25 2007/02/09 21:55:27 ad Exp $ */ +/* $NetBSD: pdcide.c,v 1.26 2008/03/18 20:46:37 cube Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pdcide.c,v 1.25 2007/02/09 21:55:27 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pdcide.c,v 1.26 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -49,10 +49,10 @@ static int pdc20265_pci_intr(void *); static void pdc20262_dma_start(void *, int, int); static int pdc20262_dma_finish(void *, int, int, int); -static int pdcide_match(struct device *, struct cfdata *, void *); -static void pdcide_attach(struct device *, struct device *, void *); +static int pdcide_match(device_t, cfdata_t, void *); +static void pdcide_attach(device_t, device_t, void *); -CFATTACH_DECL(pdcide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(pdcide, sizeof(struct pciide_softc), pdcide_match, pdcide_attach, NULL, NULL); static const struct pciide_product_desc pciide_promise_products[] = { @@ -119,8 +119,7 @@ static const struct pciide_product_desc pciide_promise_products[] = { }; static int -pdcide_match(struct device *parent, struct cfdata *match, - void *aux) +pdcide_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -132,10 +131,12 @@ pdcide_match(struct device *parent, struct cfdata *match, } static void -pdcide_attach(struct device *parent, struct device *self, void *aux) +pdcide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_promise_products)); @@ -211,8 +212,8 @@ pdc202xx_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (st & PDC2xx_STATE_NATIVE) interface |= PCIIDE_INTERFACE_PCI(0) | PCIIDE_INTERFACE_PCI(1); - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; @@ -312,8 +313,8 @@ pdc202xx_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) continue; if ((st & (PDC_IS_262(sc) ? PDC262_STATE_EN(channel):PDC246_STATE_EN(channel))) == 0) { - aprint_normal("%s: %s channel ignored (disabled)\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "%s channel ignored (disabled)\n", cp->name); cp->ata_channel.ch_flags |= ATACH_DISABLED; continue; } @@ -342,7 +343,7 @@ pdc202xx_setup_channel(struct ata_channel *chp) idedma_ctl = 0; ATADEBUG_PRINT(("pdc202xx_setup_channel %s: scr 0x%x\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), bus_space_read_1(sc->sc_dma_iot, sc->sc_dma_ioh, PDC262_U66)), DEBUG_PROBE); @@ -373,7 +374,7 @@ pdc202xx_setup_channel(struct ata_channel *chp) bus_space_write_1(sc->sc_dma_iot, sc->sc_dma_ioh, PDC262_U66, scr); ATADEBUG_PRINT(("pdc202xx_setup_channel %s:%d: ATAPI 0x%x\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, channel, + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), channel, bus_space_read_4(sc->sc_dma_iot, sc->sc_dma_ioh, PDC262_ATAPI(channel))), DEBUG_PROBE); if (chp->ch_drive[0].drive_flags & DRIVE_ATAPI || @@ -431,7 +432,7 @@ pdc202xx_setup_channel(struct ata_channel *chp) } ATADEBUG_PRINT(("pdc202xx_setup_channel: %s:%d:%d " "timings 0x%x\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), chp->ch_channel, drive, mode), DEBUG_PROBE); pci_conf_write(sc->sc_pc, sc->sc_tag, PDC2xx_TIM(chp->ch_channel, drive), mode); @@ -514,9 +515,9 @@ pdc202xx_pci_intr(void *arg) if (scr & PDC2xx_SCR_INT(i)) { crv = wdcintr(wdc_cp); if (crv == 0) - printf("%s:%d: bogus intr (reg 0x%x)\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - i, scr); + aprint_error("%s:%d: bogus intr (reg 0x%x)\n", + device_xname( + sc->sc_wdcdev.sc_atac.atac_dev), i, scr); else rv = 1; } @@ -557,8 +558,8 @@ pdc20265_pci_intr(void *arg) continue; crv = wdcintr(wdc_cp); if (crv == 0) - printf("%s:%d: bogus intr\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, i); + aprint_error("%s:%d: bogus intr\n", + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), i); else rv = 1; } diff --git a/sys/dev/pci/pdcsata.c b/sys/dev/pci/pdcsata.c index aee4f43fb08..4a9980c5a25 100644 --- a/sys/dev/pci/pdcsata.c +++ b/sys/dev/pci/pdcsata.c @@ -1,4 +1,4 @@ -/* $NetBSD: pdcsata.c,v 1.15 2007/02/09 21:55:27 ad Exp $ */ +/* $NetBSD: pdcsata.c,v 1.16 2008/03/18 20:46:37 cube Exp $ */ /* * Copyright (c) 2004, Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pdcsata.c,v 1.15 2007/02/09 21:55:27 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pdcsata.c,v 1.16 2008/03/18 20:46:37 cube Exp $"); #include <sys/types.h> #include <sys/malloc.h> @@ -71,10 +71,10 @@ static void pdc203xx_combo_probe(struct ata_channel *); static int pdcsata_pci_intr(void *); static void pdcsata_do_reset(struct ata_channel *, int); -static int pdcsata_match(struct device *, struct cfdata *, void *); -static void pdcsata_attach(struct device *, struct device *, void *); +static int pdcsata_match(device_t, cfdata_t, void *); +static void pdcsata_attach(device_t, device_t, void *); -CFATTACH_DECL(pdcsata, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(pdcsata, sizeof(struct pciide_softc), pdcsata_match, pdcsata_attach, NULL, NULL); static const struct pciide_product_desc pciide_pdcsata_products[] = { @@ -201,8 +201,7 @@ static const struct pciide_product_desc pciide_pdcsata_products[] = { }; static int -pdcsata_match(struct device *parent, struct cfdata *match, - void *aux) +pdcsata_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -214,10 +213,12 @@ pdcsata_match(struct device *parent, struct cfdata *match, } static void -pdcsata_attach(struct device *parent, struct device *self, void *aux) +pdcsata_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_pdcsata_products)); @@ -239,8 +240,8 @@ pdcsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) * the usual IDE registers are mapped in I/O space, with offsets. */ if (pci_intr_map(pa, &intrhandle) != 0) { - aprint_error("%s: couldn't map interrupt\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map interrupt\n"); return; } intrstr = pci_intr_string(pa->pa_pc, intrhandle); @@ -248,23 +249,23 @@ pdcsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) intrhandle, IPL_BIO, pdcsata_pci_intr, sc); if (sc->sc_pci_ih == NULL) { - aprint_error("%s: couldn't establish native-PCI interrupt", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't establish native-PCI interrupt"); if (intrstr != NULL) aprint_normal(" at %s", intrstr); aprint_normal("\n"); return; } - aprint_normal("%s: interrupting at %s\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - intrstr ? intrstr : "unknown interrupt"); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "interrupting at %s\n", + intrstr ? intrstr : "unknown interrupt"); sc->sc_dma_ok = (pci_mapreg_map(pa, PCIIDE_REG_BUS_MASTER_DMA, PCI_MAPREG_MEM_TYPE_32BIT, 0, &sc->sc_dma_iot, &sc->sc_dma_ioh, NULL, &dmasize) == 0); if (!sc->sc_dma_ok) { - aprint_error("%s: couldn't map bus-master DMA registers\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map bus-master DMA registers\n"); pci_intr_disestablish(pa->pa_pc, sc->sc_pci_ih); return; } @@ -274,15 +275,15 @@ pdcsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pci_mapreg_map(pa, PDC203xx_BAR_IDEREGS, PCI_MAPREG_MEM_TYPE_32BIT, 0, &sc->sc_ba5_st, &sc->sc_ba5_sh, NULL, NULL) != 0) { - aprint_error("%s: couldn't map IDE registers\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map IDE registers\n"); bus_space_unmap(sc->sc_dma_iot, sc->sc_dma_ioh, dmasize); pci_intr_disestablish(pa->pa_pc, sc->sc_pci_ih); return; } - aprint_verbose("%s: bus-master DMA support present\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16; if (sc->sc_dma_ok) { sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DMA | ATAC_CAP_UDMA; @@ -381,7 +382,8 @@ pdcsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (cp->ata_channel.ch_queue == NULL) { aprint_error("%s channel %d: " "can't allocate memory for command queue\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, channel); + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), + channel); goto next_channel; } wdc_cp = &cp->ata_channel; @@ -392,18 +394,16 @@ pdcsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (bus_space_subregion(sc->sc_ba5_st, sc->sc_ba5_sh, 0x0238 + (channel << 7), 1, &wdr->ctl_ioh) != 0) { - aprint_error("%s: couldn't map channel %d ctl regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - channel); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d ctl regs\n", channel); goto next_channel; } for (i = 0; i < WDC_NREG; i++) { if (bus_space_subregion(sc->sc_ba5_st, sc->sc_ba5_sh, 0x0200 + (i << 2) + (channel << 7), i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) { - aprint_error("%s: couldn't map channel %d cmd " - "regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d cmd regs\n", channel); goto next_channel; } @@ -421,7 +421,8 @@ pdcsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) &cp->dma_iohs[IDEDMA_CMD]) != 0) { aprint_normal("%s channel %d: can't subregion DMA " "registers\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, channel); + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), + channel); goto next_channel; } if (bus_space_subregion(sc->sc_ba5_st, sc->sc_ba5_sh, @@ -429,7 +430,8 @@ pdcsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) &cp->dma_iohs[IDEDMA_TBL]) != 0) { aprint_normal("%s channel %d: can't subregion DMA " "registers\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, channel); + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), + channel); goto next_channel; } @@ -442,27 +444,27 @@ pdcsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (bus_space_subregion(sc->sc_ba5_st, sc->sc_ba5_sh, PDC205_SSTATUS(channel), 1, &wdr->sata_status) != 0) { - aprint_error("%s: couldn't map channel %d " - "sata_status regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - channel); + aprint_error_dev( + sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d " + "sata_status regs\n", channel); goto next_channel; } if (bus_space_subregion(sc->sc_ba5_st, sc->sc_ba5_sh, PDC205_SERROR(channel), 1, &wdr->sata_error) != 0) { - aprint_error("%s: couldn't map channel %d " - "sata_error regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - channel); + aprint_error_dev( + sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d " + "sata_error regs\n", channel); goto next_channel; } if (bus_space_subregion(sc->sc_ba5_st, sc->sc_ba5_sh, PDC205_SCONTROL(channel), 1, &wdr->sata_control) != 0) { - aprint_error("%s: couldn't map channel %d " - "sata_control regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - channel); + aprint_error_dev( + sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d " + "sata_control regs\n", channel); goto next_channel; } } @@ -543,9 +545,9 @@ pdcsata_pci_intr(void *arg) } crv = wdcintr(wdc_cp); if (crv == 0) { - printf("%s:%d: bogus intr (reg 0x%x)\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - i, scr); + aprint_error("%s:%d: bogus intr (reg 0x%x)\n", + device_xname( + sc->sc_wdcdev.sc_atac.atac_dev), i, scr); } else rv = 1; } @@ -637,5 +639,4 @@ pdcsata_do_reset(struct ata_channel *chp, int poll) status = bus_space_read_4(sc->sc_ba5_st, sc->sc_ba5_sh, chanbase); wdc_do_reset(chp, poll); - } diff --git a/sys/dev/pci/piixide.c b/sys/dev/pci/piixide.c index 1278e534a93..2e9d608e3d9 100644 --- a/sys/dev/pci/piixide.c +++ b/sys/dev/pci/piixide.c @@ -1,4 +1,4 @@ -/* $NetBSD: piixide.c,v 1.45 2008/02/29 06:13:39 dyoung Exp $ */ +/* $NetBSD: piixide.c,v 1.46 2008/03/18 20:46:37 cube Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.45 2008/02/29 06:13:39 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.46 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -52,8 +52,8 @@ static int piix_dma_init(void *, int, int, void *, size_t, int); static bool piixide_resume(device_t PMF_FN_PROTO); static bool piixide_suspend(device_t PMF_FN_PROTO); -static int piixide_match(struct device *, struct cfdata *, void *); -static void piixide_attach(struct device *, struct device *, void *); +static int piixide_match(device_t, cfdata_t, void *); +static void piixide_attach(device_t, device_t, void *); static const struct pciide_product_desc pciide_intel_products[] = { { PCI_PRODUCT_INTEL_82092AA, @@ -253,12 +253,11 @@ static const struct pciide_product_desc pciide_intel_products[] = { } }; -CFATTACH_DECL(piixide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(piixide, sizeof(struct pciide_softc), piixide_match, piixide_attach, NULL, NULL); static int -piixide_match(struct device *parent, struct cfdata *match, - void *aux) +piixide_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -270,10 +269,12 @@ piixide_match(struct device *parent, struct cfdata *match, } static void -piixide_attach(struct device *parent, struct device *self, void *aux) +piixide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_intel_products)); @@ -320,8 +321,8 @@ piix_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA16 | ATAC_CAP_DATA32; @@ -422,8 +423,8 @@ piix_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if ((PIIX_IDETIM_READ(idetim, channel) & PIIX_IDETIM_IDE) == 0) { #if 1 - aprint_normal("%s: %s channel ignored (disabled)\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "%s channel ignored (disabled)\n", cp->name); cp->ata_channel.ch_flags |= ATACH_DISABLED; continue; #else @@ -824,8 +825,8 @@ piixsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); diff --git a/sys/dev/pci/rccide.c b/sys/dev/pci/rccide.c index d59024ee9aa..4b0901d5bcc 100644 --- a/sys/dev/pci/rccide.c +++ b/sys/dev/pci/rccide.c @@ -1,4 +1,4 @@ -/* $NetBSD: rccide.c,v 1.17 2007/10/24 23:08:07 xtraeme Exp $ */ +/* $NetBSD: rccide.c,v 1.18 2008/03/18 20:46:37 cube Exp $ */ /* * Copyright (c) 2003 By Noon Software, Inc. All rights reserved. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rccide.c,v 1.17 2007/10/24 23:08:07 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rccide.c,v 1.18 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -43,10 +43,10 @@ static void serverworks_setup_channel(struct ata_channel *); static int serverworks_pci_intr(void *); static int serverworkscsb6_pci_intr(void *); -static int rccide_match(struct device *, struct cfdata *, void *); -static void rccide_attach(struct device *, struct device *, void *); +static int rccide_match(device_t, cfdata_t, void *); +static void rccide_attach(device_t, device_t, void *); -CFATTACH_DECL(rccide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(rccide, sizeof(struct pciide_softc), rccide_match, rccide_attach, NULL, NULL); static const struct pciide_product_desc pciide_serverworks_products[] = { @@ -83,8 +83,7 @@ static const struct pciide_product_desc pciide_serverworks_products[] = { }; static int -rccide_match(struct device *parent, struct cfdata *match, - void *aux) +rccide_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -99,10 +98,12 @@ rccide_match(struct device *parent, struct cfdata *match, } static void -rccide_attach(struct device *parent, struct device *self, void *aux) +rccide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (void *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_serverworks_products)); @@ -120,8 +121,8 @@ serverworks_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; @@ -278,8 +279,8 @@ serverworks_pci_intr(arg) wdc_cp = &cp->ata_channel; crv = wdcintr(wdc_cp); if (crv == 0) { - printf("%s:%d: bogus intr\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, i); + aprint_error("%s:%d: bogus intr\n", + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), i); bus_space_write_1(sc->sc_dma_iot, cp->dma_iohs[IDEDMA_CTL], 0, dmastat); } else diff --git a/sys/dev/pci/satalink.c b/sys/dev/pci/satalink.c index dca52ba87ca..898b8e61fe0 100644 --- a/sys/dev/pci/satalink.c +++ b/sys/dev/pci/satalink.c @@ -1,4 +1,4 @@ -/* $NetBSD: satalink.c,v 1.35 2007/12/27 15:14:23 ws Exp $ */ +/* $NetBSD: satalink.c,v 1.36 2008/03/18 20:46:37 cube Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: satalink.c,v 1.35 2007/12/27 15:14:23 ws Exp $"); +__KERNEL_RCSID(0, "$NetBSD: satalink.c,v 1.36 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -263,10 +263,10 @@ static const struct { /* Interrupt steering bit in BA5[0x200]. */ #define IDEDMA_CMD_INT_STEER (1U << 1) -static int satalink_match(struct device *, struct cfdata *, void *); -static void satalink_attach(struct device *, struct device *, void *); +static int satalink_match(device_t, cfdata_t, void *); +static void satalink_attach(device_t, device_t, void *); -CFATTACH_DECL(satalink, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(satalink, sizeof(struct pciide_softc), satalink_match, satalink_attach, NULL, NULL); static void sii3112_chip_map(struct pciide_softc*, struct pci_attach_args*); @@ -303,8 +303,7 @@ static const struct pciide_product_desc pciide_satalink_products[] = { }; static int -satalink_match(struct device *parent, struct cfdata *match, - void *aux) +satalink_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -316,10 +315,12 @@ satalink_match(struct device *parent, struct cfdata *match, } static void -satalink_attach(struct device *parent, struct device *self, void *aux) +satalink_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_satalink_products)); @@ -443,20 +444,20 @@ sii3112_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) delay(50 * 1000); if (scs_cmd & SCS_CMD_BA5_EN) { - aprint_verbose("%s: SATALink BA5 register space enabled\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "SATALink BA5 register space enabled\n"); if (pci_mapreg_map(pa, PCI_MAPREG_START + 0x14, PCI_MAPREG_TYPE_MEM| PCI_MAPREG_MEM_TYPE_32BIT, 0, &sc->sc_ba5_st, &sc->sc_ba5_sh, NULL, NULL) != 0) - aprint_error("%s: unable to map SATALink BA5 " - "register space\n", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "unable to map SATALink BA5 register space\n"); else sc->sc_ba5_en = 1; } else { - aprint_verbose("%s: SATALink BA5 register space disabled\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "SATALink BA5 register space disabled\n"); cfgctl = pci_conf_read(pa->pa_pc, pa->pa_tag, SII3112_PCI_CFGCTL); @@ -464,8 +465,8 @@ sii3112_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) cfgctl | CFGCTL_BA5INDEN); } - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); @@ -534,7 +535,7 @@ sii3114_mapreg_dma(struct pciide_softc *sc, struct pci_attach_args *pa) sc->sc_wdcdev.dma_start = pciide_dma_start; sc->sc_wdcdev.dma_finish = pciide_dma_finish; - if (device_cfdata(&sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & + if (device_cfdata(sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & PCIIDE_OPTIONS_NODMA) { aprint_verbose( ", but unused (forced off by config file)"); @@ -603,7 +604,7 @@ sii3114_chansetup(struct pciide_softc *sc, int channel) if (cp->ata_channel.ch_queue == NULL) { aprint_error("%s %s channel: " "can't allocate memory for command queue", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + device_xname(sc->sc_wdcdev.sc_atac.atac_dev), cp->name); return (0); } return (1); @@ -624,8 +625,8 @@ sii3114_mapchan(struct pciide_channel *cp) if (bus_space_subregion(sc->sc_ba5_st, sc->sc_ba5_sh, satalink_ba5_regmap[wdc_cp->ch_channel].ba5_IDE_TF0, 9, &wdr->cmd_baseioh) != 0) { - aprint_error("%s: couldn't subregion %s cmd base\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't subregion %s cmd base\n", cp->name); goto bad; } @@ -633,8 +634,8 @@ sii3114_mapchan(struct pciide_channel *cp) if (bus_space_subregion(sc->sc_ba5_st, sc->sc_ba5_sh, satalink_ba5_regmap[wdc_cp->ch_channel].ba5_IDE_TF8, 1, &cp->ctl_baseioh) != 0) { - aprint_error("%s: couldn't subregion %s ctl base\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't subregion %s ctl base\n", cp->name); goto bad; } wdr->ctl_ioh = cp->ctl_baseioh; @@ -643,9 +644,9 @@ sii3114_mapchan(struct pciide_channel *cp) if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i, i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) { - aprint_error("%s: couldn't subregion %s channel " - "cmd regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't subregion %s channel cmd regs\n", + cp->name); goto bad; } } @@ -704,14 +705,14 @@ sii3114_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) PCI_MAPREG_MEM_TYPE_32BIT, 0, &sc->sc_ba5_st, &sc->sc_ba5_sh, NULL, NULL) != 0) { - aprint_error("%s: unable to map SATALink BA5 " - "register space\n", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "unable to map SATALink BA5 register space\n"); return; } sc->sc_ba5_en = 1; - aprint_verbose("%s: %dMHz PCI bus\n", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - (scs_cmd & SCS_CMD_M66EN) ? 66 : 33); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "%dMHz PCI bus\n", (scs_cmd & SCS_CMD_M66EN) ? 66 : 33); /* * Set the Interrupt Steering bit in the IDEDMA_CMD register of @@ -721,8 +722,8 @@ sii3114_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) */ BA5_WRITE_4(sc, 2, ba5_IDEDMA_CMD, IDEDMA_CMD_INT_STEER); - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); sii3114_mapreg_dma(sc, pa); aprint_verbose("\n"); @@ -748,8 +749,8 @@ sii3114_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) /* Map and establish the interrupt handler. */ if (pci_intr_map(pa, &intrhandle) != 0) { - aprint_error("%s: couldn't map native-PCI interrupt\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map native-PCI interrupt\n"); return; } intrstr = pci_intr_string(pa->pa_pc, intrhandle); @@ -757,12 +758,12 @@ sii3114_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) /* XXX */ pciide_pci_intr, sc); if (sc->sc_pci_ih != NULL) { - aprint_normal("%s: using %s for native-PCI interrupt\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - intrstr ? intrstr : "unknown interrupt"); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "using %s for native-PCI interrupt\n", + intrstr ? intrstr : "unknown interrupt"); } else { - aprint_error("%s: couldn't establish native-PCI interrupt", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't establish native-PCI interrupt"); if (intrstr != NULL) aprint_normal(" at %s", intrstr); aprint_normal("\n"); @@ -833,14 +834,14 @@ sii3112_drv_probe(struct ata_channel *chp) break; case SStatus_DET_DEV_NE: - aprint_error("%s: port %d: device connected, but " - "communication not established\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, chp->ch_channel); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "port %d: device connected, but " + "communication not established\n", chp->ch_channel); break; case SStatus_DET_OFFLINE: - aprint_error("%s: port %d: PHY offline\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, chp->ch_channel); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "port %d: PHY offline\n", chp->ch_channel); break; case SStatus_DET_DEV: @@ -878,14 +879,16 @@ sii3112_drv_probe(struct ata_channel *chp) chp->ch_drive[0].drive_flags |= DRIVE_ATA; splx(s); - aprint_normal("%s: port %d: device present, speed: %s\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, chp->ch_channel, + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "port %d: device present, speed: %s\n", + chp->ch_channel, sata_speed(sstatus)); break; default: - aprint_error("%s: port %d: unknown SStatus: 0x%08x\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, chp->ch_channel, sstatus); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "port %d: unknown SStatus: 0x%08x\n", + chp->ch_channel, sstatus); } } diff --git a/sys/dev/pci/siside.c b/sys/dev/pci/siside.c index 6bce4a3c057..cbe39b23334 100644 --- a/sys/dev/pci/siside.c +++ b/sys/dev/pci/siside.c @@ -1,4 +1,4 @@ -/* $NetBSD: siside.c,v 1.22 2007/02/09 21:55:27 ad Exp $ */ +/* $NetBSD: siside.c,v 1.23 2008/03/18 20:46:37 cube Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: siside.c,v 1.22 2007/02/09 21:55:27 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: siside.c,v 1.23 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -49,10 +49,10 @@ static void sis96x_setup_channel(struct ata_channel *); static int sis_hostbr_match(struct pci_attach_args *); static int sis_south_match(struct pci_attach_args *); -static int siside_match(struct device *, struct cfdata *, void *); -static void siside_attach(struct device *, struct device *, void *); +static int siside_match(device_t, cfdata_t, void *); +static void siside_attach(device_t, device_t, void *); -CFATTACH_DECL(siside, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(siside, sizeof(struct pciide_softc), siside_match, siside_attach, NULL, NULL); static const struct pciide_product_desc pciide_sis_products[] = { @@ -84,8 +84,7 @@ static const struct pciide_product_desc pciide_sis_products[] = { }; static int -siside_match(struct device *parent, struct cfdata *match, - void *aux) +siside_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -97,14 +96,15 @@ siside_match(struct device *parent, struct cfdata *match, } static void -siside_attach(struct device *parent, struct device *self, void *aux) +siside_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_sis_products)); - } static struct sis_hostbr_type { @@ -227,8 +227,8 @@ sis_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_normal("%s: Silicon Integrated Systems ", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "Silicon Integrated Systems "); pci_find_device(NULL, sis_hostbr_match); if (sis_hostbr_type_match) { if (sis_hostbr_type_match->type == SIS_TYPE_SOUTH) { @@ -271,8 +271,8 @@ sis_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) } aprint_normal(" IDE controller (rev. 0x%02x)\n", PCI_REVISION(pa->pa_class)); - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); @@ -322,8 +322,8 @@ sis_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) continue; if ((channel == 0 && (sis_ctr0 & SIS_CTRL0_CHAN0_EN) == 0) || (channel == 1 && (sis_ctr0 & SIS_CTRL0_CHAN1_EN) == 0)) { - aprint_normal("%s: %s channel ignored (disabled)\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "%s channel ignored (disabled)\n", cp->name); cp->ata_channel.ch_flags |= ATACH_DISABLED; continue; } @@ -521,12 +521,12 @@ sis_sata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) PCIIDE_INTERFACE_PCI(0) | PCIIDE_INTERFACE_PCI(1); } - aprint_normal("%s: Silicon Integrated Systems 180/96X SATA controller (rev. 0x%02x)\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - PCI_REVISION(pa->pa_class)); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "Silicon Integrated Systems 180/96X SATA controller " + "(rev. 0x%02x)\n", PCI_REVISION(pa->pa_class)); - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); diff --git a/sys/dev/pci/slide.c b/sys/dev/pci/slide.c index 0fe57cd21d6..d0f86bed97a 100644 --- a/sys/dev/pci/slide.c +++ b/sys/dev/pci/slide.c @@ -1,4 +1,4 @@ -/* $NetBSD: slide.c,v 1.18 2007/04/26 19:47:04 garbled Exp $ */ +/* $NetBSD: slide.c,v 1.19 2008/03/18 20:46:37 cube Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: slide.c,v 1.18 2007/04/26 19:47:04 garbled Exp $"); +__KERNEL_RCSID(0, "$NetBSD: slide.c,v 1.19 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -51,10 +51,10 @@ __KERNEL_RCSID(0, "$NetBSD: slide.c,v 1.18 2007/04/26 19:47:04 garbled Exp $"); static void sl82c105_chip_map(struct pciide_softc*, struct pci_attach_args*); static void sl82c105_setup_channel(struct ata_channel*); -static int slide_match(struct device *, struct cfdata *, void *); -static void slide_attach(struct device *, struct device *, void *); +static int slide_match(device_t, cfdata_t, void *); +static void slide_attach(device_t, device_t, void *); -CFATTACH_DECL(slide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(slide, sizeof(struct pciide_softc), slide_match, slide_attach, NULL, NULL); static const struct pciide_product_desc pciide_symphony_products[] = { @@ -84,8 +84,7 @@ static const struct pciide_product_desc pciide_winbond_products[] = { }; static int -slide_match(struct device *parent, struct cfdata *match, - void *aux) +slide_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -101,12 +100,14 @@ slide_match(struct device *parent, struct cfdata *match, } static void -slide_attach(struct device *parent, struct device *self, void *aux) +slide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); const struct pciide_product_desc *pp = NULL; + sc->sc_wdcdev.sc_atac.atac_dev = self; + if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_SYMPHONY) pp = pciide_lookup_product(pa->pa_id, pciide_symphony_products); if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_WINBOND) @@ -141,8 +142,8 @@ sl82c105_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); /* * Check to see if we're part of the Winbond 83c553 Southbridge. @@ -180,8 +181,8 @@ sl82c105_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) continue; if ((channel == 0 && (idecr & IDECR_P0EN) == 0) || (channel == 1 && (idecr & IDECR_P1EN) == 0)) { - aprint_normal("%s: %s channel ignored (disabled)\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "%s channel ignored (disabled)\n", cp->name); cp->ata_channel.ch_flags |= ATACH_DISABLED; continue; } diff --git a/sys/dev/pci/stpcide.c b/sys/dev/pci/stpcide.c index c9eba3bc700..f57f234db20 100644 --- a/sys/dev/pci/stpcide.c +++ b/sys/dev/pci/stpcide.c @@ -1,4 +1,4 @@ -/* $NetBSD: stpcide.c,v 1.17 2007/02/09 21:55:27 ad Exp $ */ +/* $NetBSD: stpcide.c,v 1.18 2008/03/18 20:46:37 cube Exp $ */ /* * Copyright (c) 2003 Tohru Nishimura @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: stpcide.c,v 1.17 2007/02/09 21:55:27 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: stpcide.c,v 1.18 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -43,8 +43,8 @@ __KERNEL_RCSID(0, "$NetBSD: stpcide.c,v 1.17 2007/02/09 21:55:27 ad Exp $"); static void stpc_chip_map(struct pciide_softc *, struct pci_attach_args *); static void stpc_setup_channel(struct ata_channel *); -static int stpcide_match(struct device *, struct cfdata *, void *); -static void stpcide_attach(struct device *, struct device *, void *); +static int stpcide_match(device_t, cfdata_t, void *); +static void stpcide_attach(device_t, device_t, void *); const struct pciide_product_desc pciide_stpc_products[] = { { 0x0228, @@ -55,12 +55,11 @@ const struct pciide_product_desc pciide_stpc_products[] = { { 0, 0, NULL, NULL }, }; -CFATTACH_DECL(stpcide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(stpcide, sizeof(struct pciide_softc), stpcide_match, stpcide_attach, NULL, NULL); static int -stpcide_match(struct device *parent, struct cfdata *match, - void *aux) +stpcide_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -72,10 +71,12 @@ stpcide_match(struct device *parent, struct cfdata *match, } static void -stpcide_attach(struct device *parent, struct device *self, void *aux) +stpcide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_stpc_products)); @@ -93,8 +94,8 @@ stpc_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return; - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA16 | ATAC_CAP_DATA32; diff --git a/sys/dev/pci/svwsata.c b/sys/dev/pci/svwsata.c index 49b6d1d0e30..711d9813bdf 100644 --- a/sys/dev/pci/svwsata.c +++ b/sys/dev/pci/svwsata.c @@ -1,4 +1,4 @@ -/* $NetBSD: svwsata.c,v 1.9 2008/02/05 07:02:00 simonb Exp $ */ +/* $NetBSD: svwsata.c,v 1.10 2008/03/18 20:46:37 cube Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -17,7 +17,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: svwsata.c,v 1.9 2008/02/05 07:02:00 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: svwsata.c,v 1.10 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -31,14 +31,14 @@ __KERNEL_RCSID(0, "$NetBSD: svwsata.c,v 1.9 2008/02/05 07:02:00 simonb Exp $"); #include <dev/pci/pciidevar.h> #include <dev/pci/pciide_svwsata_reg.h> -static int svwsata_match(struct device *, struct cfdata *, void *); -static void svwsata_attach(struct device *, struct device *, void *); +static int svwsata_match(device_t, cfdata_t, void *); +static void svwsata_attach(device_t, device_t, void *); static void svwsata_chip_map(struct pciide_softc *, struct pci_attach_args *); static void svwsata_mapreg_dma(struct pciide_softc *, struct pci_attach_args *); static void svwsata_mapchan(struct pciide_channel *); -CFATTACH_DECL(svwsata, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(svwsata, sizeof(struct pciide_softc), svwsata_match, svwsata_attach, NULL, NULL); static const struct pciide_product_desc pciide_svwsata_products[] = { @@ -75,8 +75,7 @@ static const struct pciide_product_desc pciide_svwsata_products[] = { }; static int -svwsata_match(struct device *parent, struct cfdata *match, - void *aux) +svwsata_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -89,10 +88,12 @@ svwsata_match(struct device *parent, struct cfdata *match, } static void -svwsata_attach(struct device *parent, struct device *self, void *aux) +svwsata_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (void *)self; + struct pciide_softc *sc = device_private(self); + + sc->sc_wdcdev.sc_atac.atac_dev = self; pciide_common_attach(sc, pa, pciide_lookup_product(pa->pa_id, pciide_svwsata_products)); @@ -126,8 +127,8 @@ svwsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) return; } - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); svwsata_mapreg_dma(sc, pa); aprint_verbose("\n"); @@ -153,20 +154,20 @@ svwsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) /* Map and establish the interrupt handler. */ if(pci_intr_map(pa, &intrhandle) != 0) { - aprint_error("%s: couldn't map native-PCI interrupt\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map native-PCI interrupt\n"); return; } intrstr = pci_intr_string(pa->pa_pc, intrhandle); sc->sc_pci_ih = pci_intr_establish(pa->pa_pc, intrhandle, IPL_BIO, pciide_pci_intr, sc); if (sc->sc_pci_ih != NULL) { - aprint_normal("%s: using %s for native-PCI interrupt\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "using %s for native-PCI interrupt\n", intrstr ? intrstr : "unknown interrupt"); } else { - aprint_error("%s: couldn't establish native-PCI interrupt", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't establish native-PCI interrupt"); if (intrstr != NULL) aprint_normal(" at %s", intrstr); aprint_normal("\n"); @@ -199,7 +200,7 @@ svwsata_mapreg_dma(struct pciide_softc *sc, struct pci_attach_args *pa) sc->sc_wdcdev.dma_start = pciide_dma_start; sc->sc_wdcdev.dma_finish = pciide_dma_finish; - if (device_cfdata(&sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & + if (device_cfdata(sc->sc_wdcdev.sc_atac.atac_dev)->cf_flags & PCIIDE_OPTIONS_NODMA) { aprint_normal( ", but unused (forced off by config file)"); @@ -253,8 +254,8 @@ svwsata_mapchan(struct pciide_channel *cp) if (bus_space_subregion(sc->sc_ba5_st, sc->sc_ba5_sh, (wdc_cp->ch_channel << 8) + SVWSATA_TF0, SVWSATA_TF8 - SVWSATA_TF0, &wdr->cmd_baseioh) != 0) { - aprint_error("%s: couldn't map %s cmd regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map %s cmd regs\n", cp->name); goto bad; } @@ -262,8 +263,8 @@ svwsata_mapchan(struct pciide_channel *cp) if (bus_space_subregion(sc->sc_ba5_st, sc->sc_ba5_sh, (wdc_cp->ch_channel << 8) + SVWSATA_TF8, 4, &cp->ctl_baseioh) != 0) { - aprint_error("%s: couldn't map %s ctl regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map %s ctl regs\n", cp->name); goto bad; } wdr->ctl_ioh = cp->ctl_baseioh; @@ -272,9 +273,9 @@ svwsata_mapchan(struct pciide_channel *cp) if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i << 2, i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) { - aprint_error("%s: couldn't subregion %s channel " - "cmd regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't subregion %s channel cmd regs\n", + cp->name); goto bad; } } @@ -288,27 +289,24 @@ svwsata_mapchan(struct pciide_channel *cp) if (bus_space_subregion(wdr->sata_iot, wdr->sata_baseioh, (wdc_cp->ch_channel << 8) + SVWSATA_SSTATUS, 1, &wdr->sata_status) != 0) { - aprint_error("%s: couldn't map channel %d " - "sata_status regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d sata_status regs\n", wdc_cp->ch_channel); goto bad; } if (bus_space_subregion(wdr->sata_iot, wdr->sata_baseioh, (wdc_cp->ch_channel << 8) + SVWSATA_SERROR, 1, &wdr->sata_error) != 0) { - aprint_error("%s: couldn't map channel %d " - "sata_error regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d sata_error regs\n", wdc_cp->ch_channel); goto bad; } if (bus_space_subregion(wdr->sata_iot, wdr->sata_baseioh, (wdc_cp->ch_channel << 8) + SVWSATA_SCONTROL, 1, &wdr->sata_control) != 0) { - aprint_error("%s: couldn't map channel %d " - "sata_control regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d sata_control regs\n", wdc_cp->ch_channel); goto bad; } diff --git a/sys/dev/pci/viaide.c b/sys/dev/pci/viaide.c index 26d10988d2f..42e9eb283c8 100644 --- a/sys/dev/pci/viaide.c +++ b/sys/dev/pci/viaide.c @@ -1,4 +1,4 @@ -/* $NetBSD: viaide.c,v 1.52 2008/02/29 06:13:39 dyoung Exp $ */ +/* $NetBSD: viaide.c,v 1.53 2008/03/18 20:46:37 cube Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.52 2008/02/29 06:13:39 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.53 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -63,14 +63,14 @@ static void via_sata_chip_map_new(struct pciide_softc *, struct pci_attach_args *); static void via_setup_channel(struct ata_channel *); -static int viaide_match(struct device *, struct cfdata *, void *); -static void viaide_attach(struct device *, struct device *, void *); +static int viaide_match(device_t, cfdata_t, void *); +static void viaide_attach(device_t, device_t, void *); static const struct pciide_product_desc * viaide_lookup(pcireg_t); static bool viaide_suspend(device_t PMF_FN_PROTO); static bool viaide_resume(device_t PMF_FN_PROTO); -CFATTACH_DECL(viaide, sizeof(struct pciide_softc), +CFATTACH_DECL_NEW(viaide, sizeof(struct pciide_softc), viaide_match, viaide_attach, NULL, NULL); static const struct pciide_product_desc pciide_amd_products[] = { @@ -355,8 +355,7 @@ viaide_lookup(pcireg_t id) } static int -viaide_match(struct device *parent, struct cfdata *match, - void *aux) +viaide_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -366,12 +365,14 @@ viaide_match(struct device *parent, struct cfdata *match, } static void -viaide_attach(struct device *parent, struct device *self, void *aux) +viaide_attach(device_t parent, device_t self, void *aux) { struct pci_attach_args *pa = aux; - struct pciide_softc *sc = (struct pciide_softc *)self; + struct pciide_softc *sc = device_private(self); const struct pciide_product_desc *pp; + sc->sc_wdcdev.sc_atac.atac_dev = self; + pp = viaide_lookup(pa->pa_id); if (pp == NULL) panic("viaide_attach"); @@ -448,8 +449,8 @@ via_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) goto unknown; pcib_id = pcib_pa.pa_id; pcib_class = pcib_pa.pa_class; - aprint_normal("%s: VIA Technologies ", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "VIA Technologies "); switch (PCI_PRODUCT(pcib_id)) { case PCI_PRODUCT_VIATECH_VT82C586_ISA: aprint_normal("VT82C586 (Apollo VP) "); @@ -558,8 +559,8 @@ unknown: panic("via_chip_map: unknown vendor"); } - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32; @@ -597,8 +598,8 @@ unknown: continue; if ((ideconf & APO_IDECONF_EN(channel)) == 0) { - aprint_normal("%s: %s channel ignored (disabled)\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "%s channel ignored (disabled)\n", cp->name); cp->ata_channel.ch_flags |= ATACH_DISABLED; continue; } @@ -619,7 +620,8 @@ via_mapchan(struct pci_attach_args *pa, struct pciide_channel *cp, wdc_cp = &cp->ata_channel; sc = CHAN_TO_PCIIDE(&cp->ata_channel); compat_nat_enable = prop_dictionary_get( - device_properties((struct device *)sc), "use-compat-native-irq"); + device_properties(sc->sc_wdcdev.sc_atac.atac_dev), + "use-compat-native-irq"); if (interface & PCIIDE_INTERFACE_PCI(wdc_cp->ch_channel)) { /* native mode with irq 14/15 requested? */ @@ -664,13 +666,13 @@ vt8231_mapregs_native(struct pci_attach_args *pa, struct pciide_channel *cp, if ((wdc_cp->ch_flags & ATACH_DISABLED) == 0) { #ifdef __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH cp->ih = pciide_machdep_compat_intr_establish( - &sc->sc_wdcdev.sc_atac.atac_dev, pa, wdc_cp->ch_channel, + sc->sc_wdcdev.sc_atac.atac_dev, pa, wdc_cp->ch_channel, pci_intr, sc); if (cp->ih == NULL) { #endif - aprint_error("%s: no compatibility interrupt for " - "use by %s channel\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "no compatibility interrupt for " + "use by %s channel\n", cp->name); wdc_cp->ch_flags |= ATACH_DISABLED; #ifdef __HAVE_PCIIDE_MACHDEP_COMPAT_INTR_ESTABLISH } @@ -779,7 +781,8 @@ via_setup_channel(struct ata_channel *chp) aprint_normal( "%s:%d:%d: multi-word DMA disabled due " "to chip revision\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + device_xname( + sc->sc_wdcdev.sc_atac.atac_dev), chp->ch_channel, drive); mode = drvp->PIO_mode; s = splbio(); @@ -832,8 +835,8 @@ via_sata_chip_map_common(struct pciide_softc *sc, struct pci_attach_args *pa) if (pciide_chipen(sc, pa) == 0) return 0; - aprint_verbose("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_verbose_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "bus-master DMA support present"); pciide_mapreg_dma(sc, pa); aprint_verbose("\n"); @@ -870,14 +873,14 @@ via_sata_chip_map_common(struct pciide_softc *sc, struct pci_attach_args *pa) NULL, &satasize); break; default: - aprint_error("%s: couldn't map sata regs, unsupported" - "maptype (0x%x)\n", sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map sata regs, unsupportedmaptype (0x%x)\n", maptype); return 0; } if (ret != 0) { - aprint_error("%s: couldn't map sata regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map sata regs\n"); return 0; } return 1; @@ -916,27 +919,24 @@ via_sata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa, if (bus_space_subregion(wdr->sata_iot, wdr->sata_baseioh, (wdc_cp->ch_channel << satareg_shift) + 0x0, 1, &wdr->sata_status) != 0) { - aprint_error("%s: couldn't map channel %d " - "sata_status regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d sata_status regs\n", wdc_cp->ch_channel); continue; } if (bus_space_subregion(wdr->sata_iot, wdr->sata_baseioh, (wdc_cp->ch_channel << satareg_shift) + 0x4, 1, &wdr->sata_error) != 0) { - aprint_error("%s: couldn't map channel %d " - "sata_error regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d sata_error regs\n", wdc_cp->ch_channel); continue; } if (bus_space_subregion(wdr->sata_iot, wdr->sata_baseioh, (wdc_cp->ch_channel << satareg_shift) + 0x8, 1, &wdr->sata_control) != 0) { - aprint_error("%s: couldn't map channel %d " - "sata_control regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d sata_control regs\n", wdc_cp->ch_channel); continue; } @@ -988,24 +988,23 @@ via_sata_chip_map_new(struct pciide_softc *sc, struct pci_attach_args *pa) } if (pci_intr_map(pa, &intrhandle) != 0) { - aprint_error("%s: couldn't map native-PCI interrupt\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map native-PCI interrupt\n"); return; } intrstr = pci_intr_string(pa->pa_pc, intrhandle); sc->sc_pci_ih = pci_intr_establish(pa->pa_pc, intrhandle, IPL_BIO, pciide_pci_intr, sc); if (sc->sc_pci_ih == NULL) { - aprint_error( - "%s: couldn't establish native-PCI interrupt", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't establish native-PCI interrupt"); if (intrstr != NULL) aprint_error(" at %s", intrstr); aprint_error("\n"); return; } - aprint_normal("%s: using %s for native-PCI interrupt\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "using %s for native-PCI interrupt\n", intrstr ? intrstr : "unknown interrupt"); for (channel = 0; channel < sc->sc_wdcdev.sc_atac.atac_nchannels; @@ -1022,27 +1021,24 @@ via_sata_chip_map_new(struct pciide_softc *sc, struct pci_attach_args *pa) if (bus_space_subregion(wdr->sata_iot, wdr->sata_baseioh, (wdc_cp->ch_channel << 6) + 0x0, 1, &wdr->sata_status) != 0) { - aprint_error("%s: couldn't map channel %d " - "sata_status regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d sata_status regs\n", wdc_cp->ch_channel); continue; } if (bus_space_subregion(wdr->sata_iot, wdr->sata_baseioh, (wdc_cp->ch_channel << 6) + 0x4, 1, &wdr->sata_error) != 0) { - aprint_error("%s: couldn't map channel %d " - "sata_error regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d sata_error regs\n", wdc_cp->ch_channel); continue; } if (bus_space_subregion(wdr->sata_iot, wdr->sata_baseioh, (wdc_cp->ch_channel << 6) + 0x8, 1, &wdr->sata_control) != 0) { - aprint_error("%s: couldn't map channel %d " - "sata_control regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d sata_control regs\n", wdc_cp->ch_channel); continue; } @@ -1051,26 +1047,25 @@ via_sata_chip_map_new(struct pciide_softc *sc, struct pci_attach_args *pa) if (pci_mapreg_map(pa, (0x10 + (4 * (channel))), PCI_MAPREG_TYPE_IO, 0, &wdr->cmd_iot, &wdr->cmd_baseioh, NULL, &cmdsize) != 0) { - aprint_error("%s: couldn't map %s channel regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - cp->name); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map %s channel regs\n", cp->name); } wdr->ctl_iot = wdr->cmd_iot; for (i = 0; i < WDC_NREG; i++) { if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i, i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) { - aprint_error("%s: couldn't subregion %s " - "channel cmd regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, - cp->name); + aprint_error_dev( + sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't subregion %s " + "channel cmd regs\n", cp->name); return; } } if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, WDC_NREG + 2, 1, &wdr->ctl_ioh) != 0) { - aprint_error("%s: couldn't map channel %d ctl regs\n", - sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, channel); + aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev, + "couldn't map channel %d ctl regs\n", channel); return; } wdc_init_shadow_regs(wdc_cp); diff --git a/sys/dev/pcmcia/wdc_pcmcia.c b/sys/dev/pcmcia/wdc_pcmcia.c index aea72b413d8..374e395d915 100644 --- a/sys/dev/pcmcia/wdc_pcmcia.c +++ b/sys/dev/pcmcia/wdc_pcmcia.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc_pcmcia.c,v 1.109 2007/10/19 12:01:06 ad Exp $ */ +/* $NetBSD: wdc_pcmcia.c,v 1.110 2008/03/18 20:46:37 cube Exp $ */ /*- * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.109 2007/10/19 12:01:06 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.110 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -89,13 +89,13 @@ struct wdc_pcmcia_softc { #define bus_space_write_region_stream_4 bus_space_write_region_4 #endif /* __BUS_SPACE_HAS_STREAM_METHODS */ -static int wdc_pcmcia_match(struct device *, struct cfdata *, void *); +static int wdc_pcmcia_match(device_t, cfdata_t, void *); static int wdc_pcmcia_validate_config_io(struct pcmcia_config_entry *); static int wdc_pcmcia_validate_config_memory(struct pcmcia_config_entry *); -static void wdc_pcmcia_attach(struct device *, struct device *, void *); -static int wdc_pcmcia_detach(struct device *, int); +static void wdc_pcmcia_attach(device_t, device_t, void *); +static int wdc_pcmcia_detach(device_t, int); -CFATTACH_DECL(wdc_pcmcia, sizeof(struct wdc_pcmcia_softc), +CFATTACH_DECL_NEW(wdc_pcmcia, sizeof(struct wdc_pcmcia_softc), wdc_pcmcia_match, wdc_pcmcia_attach, wdc_pcmcia_detach, wdcactivate); static const struct wdc_pcmcia_product { @@ -169,15 +169,14 @@ static const struct wdc_pcmcia_product { static const size_t wdc_pcmcia_nproducts = sizeof(wdc_pcmcia_products) / sizeof(wdc_pcmcia_products[0]); -static int wdc_pcmcia_enable(struct device *, int); +static int wdc_pcmcia_enable(device_t, int); static void wdc_pcmcia_datain_memory(struct ata_channel *, int, void *, size_t); static void wdc_pcmcia_dataout_memory(struct ata_channel *, int, void *, size_t); static int -wdc_pcmcia_match(struct device *parent, struct cfdata *match, - void *aux) +wdc_pcmcia_match(device_t parent, cfdata_t match, void *aux) { struct pcmcia_attach_args *pa = aux; @@ -212,10 +211,9 @@ wdc_pcmcia_validate_config_memory(struct pcmcia_config_entry *cfe) } static void -wdc_pcmcia_attach(struct device *parent, struct device *self, - void *aux) +wdc_pcmcia_attach(device_t parent, device_t self, void *aux) { - struct wdc_pcmcia_softc *sc = (void *)self; + struct wdc_pcmcia_softc *sc = device_private(self); struct pcmcia_attach_args *pa = aux; struct pcmcia_config_entry *cfe; struct wdc_regs *wdr; @@ -224,6 +222,7 @@ wdc_pcmcia_attach(struct device *parent, struct device *self, int i; int error; + sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_pf = pa->pf; error = pcmcia_function_configure(pa->pf, @@ -233,8 +232,7 @@ wdc_pcmcia_attach(struct device *parent, struct device *self, error = pcmcia_function_configure(pa->pf, wdc_pcmcia_validate_config_memory); if (error) { - aprint_error("%s: configure failed, error=%d\n", self->dv_xname, - error); + aprint_error_dev(self, "configure failed, error=%d\n", error); return; } @@ -275,14 +273,13 @@ wdc_pcmcia_attach(struct device *parent, struct device *self, wdr->cmd_baseioh, offset + i, i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) { - aprint_error("%s: can't subregion I/O space\n", - self->dv_xname); + aprint_error_dev(self, "can't subregion I/O space\n"); goto fail; } } if (cfe->iftype == PCMCIA_IFTYPE_MEMORY) { - aprint_normal("%s: memory mapped mode\n", self->dv_xname); + aprint_normal_dev(self, "memory mapped mode\n"); wdr->data32iot = cfe->memspace[0].handle.memt; if (bus_space_subregion(cfe->memspace[0].handle.memt, cfe->memspace[0].handle.memh, offset + 1024, 1024, @@ -292,7 +289,7 @@ wdc_pcmcia_attach(struct device *parent, struct device *self, sc->sc_wdcdev.dataout_pio = wdc_pcmcia_dataout_memory; sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_NOIRQ; } else { - aprint_normal("%s: i/o mapped mode\n", self->dv_xname); + aprint_normal_dev(self, "i/o mapped mode\n"); wdr->data32iot = wdr->cmd_iot; wdr->data32ioh = wdr->cmd_iohs[wd_data]; sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DATA32; @@ -338,9 +335,9 @@ fail: } static int -wdc_pcmcia_detach(struct device *self, int flags) +wdc_pcmcia_detach(device_t self, int flags) { - struct wdc_pcmcia_softc *sc = (struct wdc_pcmcia_softc *)self; + struct wdc_pcmcia_softc *sc = device_private(self); int error; if (sc->sc_state != WDC_PCMCIA_ATTACHED) @@ -357,7 +354,7 @@ wdc_pcmcia_detach(struct device *self, int flags) static int wdc_pcmcia_enable(struct device *self, int onoff) { - struct wdc_pcmcia_softc *sc = (void *)self; + struct wdc_pcmcia_softc *sc = device_private(self); int error; if (onoff) { diff --git a/sys/dev/podulebus/dtide.c b/sys/dev/podulebus/dtide.c index 9e3a7882a68..de882adf133 100644 --- a/sys/dev/podulebus/dtide.c +++ b/sys/dev/podulebus/dtide.c @@ -1,4 +1,4 @@ -/* $NetBSD: dtide.c,v 1.24 2007/10/19 12:01:07 ad Exp $ */ +/* $NetBSD: dtide.c,v 1.25 2008/03/18 20:46:37 cube Exp $ */ /*- * Copyright (c) 2000, 2001 Ben Harris @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dtide.c,v 1.24 2007/10/19 12:01:07 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dtide.c,v 1.25 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> @@ -59,17 +59,17 @@ struct dtide_softc { bus_space_handle_t sc_magich; }; -static int dtide_match(struct device *, struct cfdata *, void *); -static void dtide_attach(struct device *, struct device *, void *); +static int dtide_match(device_t, cfdata_t, void *); +static void dtide_attach(device_t, device_t, void *); -CFATTACH_DECL(dtide, sizeof(struct dtide_softc), +CFATTACH_DECL_NEW(dtide, sizeof(struct dtide_softc), dtide_match, dtide_attach, NULL, NULL); static const int dtide_cmdoffsets[] = { DTIDE_CMDBASE0, DTIDE_CMDBASE1 }; static const int dtide_ctloffsets[] = { DTIDE_CTLBASE0, DTIDE_CTLBASE1 }; static int -dtide_match(struct device *parent, struct cfdata *cf, void *aux) +dtide_match(device_t parent, cfdata_t cf, void *aux) { struct podulebus_attach_args *pa = aux; @@ -77,7 +77,7 @@ dtide_match(struct device *parent, struct cfdata *cf, void *aux) } static void -dtide_attach(struct device *parent, struct device *self, void *aux) +dtide_attach(device_t parent, device_t self, void *aux) { struct podulebus_attach_args *pa = aux; struct dtide_softc *sc = device_private(self); @@ -86,6 +86,7 @@ dtide_attach(struct device *parent, struct device *self, void *aux) int i, j; bus_space_tag_t bst; + sc->sc_wdc.sc_atac.atac_dev = self; sc->sc_wdc.regs = sc->sc_wdc_regs; sc->sc_wdc.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_NOIRQ; @@ -96,7 +97,7 @@ dtide_attach(struct device *parent, struct device *self, void *aux) bus_space_map(pa->pa_fast_t, pa->pa_fast_base + DTIDE_MAGICBASE, 0, 1, &sc->sc_magich); podulebus_shift_tag(pa->pa_fast_t, DTIDE_REGSHIFT, &bst); - printf("\n"); + aprint_normal("\n"); for (i = 0; i < DTIDE_NCHANNELS; i++) { ch = sc->sc_chp[i] = &sc->sc_chan[i]; wdr = &sc->sc_wdc_regs[i]; diff --git a/sys/dev/podulebus/hcide.c b/sys/dev/podulebus/hcide.c index 528dd2871cd..a7fd548a69b 100644 --- a/sys/dev/podulebus/hcide.c +++ b/sys/dev/podulebus/hcide.c @@ -1,4 +1,4 @@ -/* $NetBSD: hcide.c,v 1.21 2007/10/19 12:01:07 ad Exp $ */ +/* $NetBSD: hcide.c,v 1.22 2008/03/18 20:46:37 cube Exp $ */ /*- * Copyright (c) 2000, 2001 Ben Harris @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hcide.c,v 1.21 2007/10/19 12:01:07 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hcide.c,v 1.22 2008/03/18 20:46:37 cube Exp $"); #include <sys/param.h> @@ -56,17 +56,17 @@ struct hcide_softc { struct wdc_regs sc_wdc_regs[HCIDE_NCHANNELS]; }; -static int hcide_match (struct device *, struct cfdata *, void *); -static void hcide_attach (struct device *, struct device *, void *); +static int hcide_match (device_t, cfdata_t, void *); +static void hcide_attach (device_t, device_t, void *); -CFATTACH_DECL(hcide, sizeof(struct hcide_softc), +CFATTACH_DECL_NEW(hcide, sizeof(struct hcide_softc), hcide_match, hcide_attach, NULL, NULL); static const int hcide_cmdoffsets[] = { HCIDE_CMD0, HCIDE_CMD1, HCIDE_CMD2 }; static const int hcide_ctloffsets[] = { HCIDE_CTL, HCIDE_CTL, HCIDE_CTL }; static int -hcide_match(struct device *parent, struct cfdata *cf, void *aux) +hcide_match(device_t parent, cfdata_t cf, void *aux) { struct podulebus_attach_args *pa = aux; @@ -77,7 +77,7 @@ hcide_match(struct device *parent, struct cfdata *cf, void *aux) } static void -hcide_attach(struct device *parent, struct device *self, void *aux) +hcide_attach(device_t parent, device_t self, void *aux) { struct hcide_softc *sc = device_private(self); struct wdc_regs *wdr; @@ -85,13 +85,14 @@ hcide_attach(struct device *parent, struct device *self, void *aux) struct ata_channel *ch; int i, j; + sc->sc_wdc.sc_atac.atac_dev = self; sc->sc_wdc.regs = sc->sc_wdc_regs; sc->sc_wdc.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_NOIRQ; sc->sc_wdc.sc_atac.atac_pio_cap = 0; /* XXX correct? */ sc->sc_wdc.sc_atac.atac_nchannels = HCIDE_NCHANNELS; sc->sc_wdc.sc_atac.atac_channels = sc->sc_chp; - printf("\n"); + aprint_normal("\n"); for (i = 0; i < HCIDE_NCHANNELS; i++) { ch = sc->sc_chp[i] = &sc->sc_chan[i]; wdr = &sc->sc_wdc_regs[i]; diff --git a/sys/dev/scsipi/atapi_wdc.c b/sys/dev/scsipi/atapi_wdc.c index a1d1e22da2d..2a4e0e36323 100644 --- a/sys/dev/scsipi/atapi_wdc.c +++ b/sys/dev/scsipi/atapi_wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: atapi_wdc.c,v 1.105 2007/10/19 12:01:18 ad Exp $ */ +/* $NetBSD: atapi_wdc.c,v 1.106 2008/03/18 20:46:37 cube Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.105 2007/10/19 12:01:18 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.106 2008/03/18 20:46:37 cube Exp $"); #ifndef ATADEBUG #define ATADEBUG @@ -120,7 +120,7 @@ wdc_atapibus_attach(struct atabus_softc *ata_sc) /* * Fill in the scsipi_adapter. */ - adapt->adapt_dev = &atac->atac_dev; + adapt->adapt_dev = atac->atac_dev; adapt->adapt_nchannels = atac->atac_nchannels; adapt->adapt_request = wdc_atapi_scsipi_request; adapt->adapt_minphys = wdc_atapi_minphys; @@ -141,7 +141,7 @@ wdc_atapibus_attach(struct atabus_softc *ata_sc) chan->chan_ntargets = 2; chan->chan_nluns = 1; - chp->atapibus = config_found_ia(&ata_sc->sc_dev, "atapi", chan, + chp->atapibus = config_found_ia(ata_sc->sc_dev, "atapi", chan, atapiprint); } @@ -163,7 +163,7 @@ static void wdc_atapi_kill_pending(struct scsipi_periph *periph) { struct atac_softc *atac = - (void *)periph->periph_channel->chan_adapter->adapt_dev; + device_private(periph->periph_channel->chan_adapter->adapt_dev); struct ata_channel *chp = atac->atac_channels[periph->periph_channel->chan_channel]; @@ -196,7 +196,7 @@ static int wdc_atapi_get_params(struct scsipi_channel *chan, int drive, struct ataparams *id) { - struct wdc_softc *wdc = (void *)chan->chan_adapter->adapt_dev; + struct wdc_softc *wdc = device_private(chan->chan_adapter->adapt_dev); struct atac_softc *atac = &wdc->sc_atac; struct wdc_regs *wdr = &wdc->regs[chan->chan_channel]; struct ata_channel *chp = atac->atac_channels[chan->chan_channel]; @@ -218,13 +218,13 @@ wdc_atapi_get_params(struct scsipi_channel *chan, int drive, if (wdc_exec_command(&chp->ch_drive[drive], &ata_c) != ATACMD_COMPLETE) { printf("wdc_atapi_get_params: ATAPI_SOFT_RESET failed for" " drive %s:%d:%d: driver failed\n", - atac->atac_dev.dv_xname, chp->ch_channel, drive); + device_xname(atac->atac_dev), chp->ch_channel, drive); panic("wdc_atapi_get_params"); } if (ata_c.flags & (AT_ERROR | AT_TIMEOU | AT_DF)) { ATADEBUG_PRINT(("wdc_atapi_get_params: ATAPI_SOFT_RESET " "failed for drive %s:%d:%d: error 0x%x\n", - atac->atac_dev.dv_xname, chp->ch_channel, drive, + device_xname(atac->atac_dev), chp->ch_channel, drive, ata_c.r_error), DEBUG_PROBE); return -1; } @@ -237,7 +237,7 @@ wdc_atapi_get_params(struct scsipi_channel *chan, int drive, if (ata_get_params(&chp->ch_drive[drive], AT_WAIT, id) != 0) { ATADEBUG_PRINT(("wdc_atapi_get_params: ATAPI_IDENTIFY_DEVICE " "failed for drive %s:%d:%d: error 0x%x\n", - atac->atac_dev.dv_xname, chp->ch_channel, drive, + device_xname(atac->atac_dev), chp->ch_channel, drive, ata_c.r_error), DEBUG_PROBE); return -1; } @@ -251,7 +251,7 @@ wdc_atapi_probe_device(struct atapibus_softc *sc, int target) struct scsipi_periph *periph; struct ataparams ids; struct ataparams *id = &ids; - struct wdc_softc *wdc = (void *)chan->chan_adapter->adapt_dev; + struct wdc_softc *wdc = device_private(chan->chan_adapter->adapt_dev); struct atac_softc *atac = &wdc->sc_atac; struct ata_channel *chp = atac->atac_channels[chan->chan_channel]; struct ata_drive_datas *drvp = &chp->ch_drive[target]; @@ -273,7 +273,7 @@ wdc_atapi_probe_device(struct atapibus_softc *sc, int target) periph = scsipi_alloc_periph(M_NOWAIT); if (periph == NULL) { printf("%s: unable to allocate periph for drive %d\n", - sc->sc_dev.dv_xname, target); + device_xname(&sc->sc_dev), target); return; } periph->periph_dev = NULL; @@ -341,7 +341,7 @@ wdc_atapi_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, struct scsipi_adapter *adapt = chan->chan_adapter; struct scsipi_periph *periph; struct scsipi_xfer *sc_xfer; - struct wdc_softc *wdc = (void *)adapt->adapt_dev; + struct wdc_softc *wdc = device_private(adapt->adapt_dev); struct atac_softc *atac = &wdc->sc_atac; struct ata_xfer *xfer; int channel = chan->chan_channel; @@ -354,8 +354,9 @@ wdc_atapi_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, drive = periph->periph_target; ATADEBUG_PRINT(("wdc_atapi_scsipi_request %s:%d:%d\n", - atac->atac_dev.dv_xname, channel, drive), DEBUG_XFERS); - if (!device_is_active(&atac->atac_dev)) { + device_xname(atac->atac_dev), channel, drive), + DEBUG_XFERS); + if (!device_is_active(atac->atac_dev)) { sc_xfer->error = XS_DRIVER_STUFFUP; scsipi_done(sc_xfer); return; @@ -459,7 +460,7 @@ wdc_atapi_start(struct ata_channel *chp, struct ata_xfer *xfer) const char *errstring; ATADEBUG_PRINT(("wdc_atapi_start %s:%d:%d, scsi flags 0x%x \n", - atac->atac_dev.dv_xname, chp->ch_channel, drvp->drive, + device_xname(atac->atac_dev), chp->ch_channel, drvp->drive, sc_xfer->xs_control), DEBUG_XFERS); #if NATA_DMA if ((xfer->c_flags & C_DMA) && (drvp->n_xfers <= NXFER)) @@ -507,7 +508,7 @@ wdc_atapi_start(struct ata_channel *chp, struct ata_xfer *xfer) */ printf("%s:%d:%d: PIO mode %d rejected, " "falling back to PIO mode 3\n", - atac->atac_dev.dv_xname, + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, drvp->PIO_mode); if (drvp->PIO_mode > 3) @@ -545,7 +546,7 @@ wdc_atapi_start(struct ata_channel *chp, struct ata_xfer *xfer) */ printf("%s:%d:%d: DMA mode %d rejected, " "falling back to DMA mode 0\n", - atac->atac_dev.dv_xname, + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, drvp->DMA_mode); if (drvp->DMA_mode > 0) @@ -663,7 +664,7 @@ ready: return; timeout: printf("%s:%d:%d: %s timed out\n", - atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive, + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, errstring); sc_xfer->error = XS_TIMEOUT; bus_space_write_1(wdr->ctl_iot, wdr->ctl_ioh, wd_aux_ctlr, WDCTL_4BIT); @@ -672,7 +673,7 @@ timeout: return; error: printf("%s:%d:%d: %s ", - atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive, + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, errstring); printf("error (0x%x)\n", chp->ch_error); sc_xfer->error = XS_SHORTSENSE; @@ -702,14 +703,14 @@ wdc_atapi_intr(struct ata_channel *chp, struct ata_xfer *xfer, int irq) void *cmd; ATADEBUG_PRINT(("wdc_atapi_intr %s:%d:%d\n", - atac->atac_dev.dv_xname, chp->ch_channel, drvp->drive), + device_xname(atac->atac_dev), chp->ch_channel, drvp->drive), DEBUG_INTR); /* Is it not a transfer, but a control operation? */ if (drvp->state < READY) { printf("%s:%d:%d: bad state %d in wdc_atapi_intr\n", - atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive, - drvp->state); + device_xname(atac->atac_dev), chp->ch_channel, + xfer->c_drive, drvp->state); panic("wdc_atapi_intr: bad state"); } /* @@ -749,8 +750,8 @@ wdc_atapi_intr(struct ata_channel *chp, struct ata_xfer *xfer, int irq) if (irq && (xfer->c_flags & C_TIMEOU) == 0) return 0; /* IRQ was not for us */ printf("%s:%d:%d: device timeout, c_bcount=%d, c_skip=%d\n", - atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive, - xfer->c_bcount, xfer->c_skip); + device_xname(atac->atac_dev), chp->ch_channel, + xfer->c_drive, xfer->c_bcount, xfer->c_skip); #if NATA_DMA if (xfer->c_flags & C_DMA) { ata_dmaerr(drvp, @@ -999,7 +1000,8 @@ wdc_atapi_phase_complete(struct ata_xfer *xfer) /* wait for DSC if needed */ if (drvp->drive_flags & DRIVE_ATAPIST) { ATADEBUG_PRINT(("wdc_atapi_phase_complete(%s:%d:%d) " - "polldsc %d\n", atac->atac_dev.dv_xname, chp->ch_channel, + "polldsc %d\n", device_xname(atac->atac_dev), + chp->ch_channel, xfer->c_drive, xfer->c_dscpoll), DEBUG_XFERS); #if 1 if (cold) @@ -1012,7 +1014,7 @@ wdc_atapi_phase_complete(struct ata_xfer *xfer) mstohz(sc_xfer->timeout)) { printf("%s:%d:%d: wait_for_dsc " "failed\n", - atac->atac_dev.dv_xname, + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive); sc_xfer->error = XS_TIMEOUT; wdc_atapi_reset(chp, xfer); @@ -1079,7 +1081,7 @@ wdc_atapi_done(struct ata_channel *chp, struct ata_xfer *xfer) int drive = xfer->c_drive; ATADEBUG_PRINT(("wdc_atapi_done %s:%d:%d: flags 0x%x\n", - atac->atac_dev.dv_xname, chp->ch_channel, xfer->c_drive, + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive, (u_int)xfer->c_flags), DEBUG_XFERS); callout_stop(&chp->ch_callout); /* mark controller inactive and free the command */ @@ -1110,7 +1112,7 @@ wdc_atapi_reset(struct ata_channel *chp, struct ata_xfer *xfer) drvp->state = 0; if (wdc_wait_for_unbusy(chp, WDC_RESET_WAIT, AT_POLL) != 0) { printf("%s:%d:%d: reset failed\n", - atac->atac_dev.dv_xname, chp->ch_channel, + device_xname(atac->atac_dev), chp->ch_channel, xfer->c_drive); sc_xfer->error = XS_SELTIMEOUT; } |
