summaryrefslogtreecommitdiff
path: root/sys/dev/pci/cmdide.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/pci/cmdide.c')
-rw-r--r--sys/dev/pci/cmdide.c52
1 files changed, 27 insertions, 25 deletions
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)) ?