summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorcube <cube@NetBSD.org>2008-03-24 14:44:26 +0000
committercube <cube@NetBSD.org>2008-03-24 14:44:26 +0000
commitb1be269fbd6a5ce8dc0eedc74182fd4b677d4e4d (patch)
tree7b0f2e10be36e833996b95d6eb7cd2250789182b /sys
parentb2b4fb68be99bbf186593f9ff3914dc1059b8c2c (diff)
Split device_t and softc for atapibus(4).
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/ahcisata_core.c11
-rw-r--r--sys/dev/scsipi/atapi_wdc.c11
-rw-r--r--sys/dev/scsipi/atapiconf.c25
-rw-r--r--sys/dev/scsipi/atapiconf.h4
-rw-r--r--sys/dev/usb/umass_scsipi.c8
5 files changed, 30 insertions, 29 deletions
diff --git a/sys/dev/ic/ahcisata_core.c b/sys/dev/ic/ahcisata_core.c
index 2c3896fb560..c1078b0352c 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.13 2008/03/18 20:46:36 cube Exp $ */
+/* $NetBSD: ahcisata_core.c,v 1.14 2008/03/24 14:44:26 cube Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.13 2008/03/18 20:46:36 cube Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.14 2008/03/24 14:44:26 cube Exp $");
#include <sys/types.h>
#include <sys/malloc.h>
@@ -1519,14 +1519,15 @@ ahci_atapi_probe_device(struct atapibus_softc *sc, int target)
if (ata_get_params(drvp, AT_WAIT, id) == 0) {
#ifdef ATAPI_DEBUG_PROBE
printf("%s drive %d: cmdsz 0x%x drqtype 0x%x\n",
- AHCINAME(sc), target,
+ AHCINAME(ahcic), target,
id->atap_config & ATAPI_CFG_CMD_MASK,
id->atap_config & ATAPI_CFG_DRQ_MASK);
#endif
periph = scsipi_alloc_periph(M_NOWAIT);
if (periph == NULL) {
- printf("%s: unable to allocate periph for drive %d\n",
- device_xname(&sc->sc_dev), target);
+ aprint_error_dev(sc->sc_dev,
+ "unable to allocate periph for drive %d\n",
+ target);
return;
}
periph->periph_dev = NULL;
diff --git a/sys/dev/scsipi/atapi_wdc.c b/sys/dev/scsipi/atapi_wdc.c
index 2a4e0e36323..3565aa6dd2e 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.106 2008/03/18 20:46:37 cube Exp $ */
+/* $NetBSD: atapi_wdc.c,v 1.107 2008/03/24 14:44:26 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.106 2008/03/18 20:46:37 cube Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.107 2008/03/24 14:44:26 cube Exp $");
#ifndef ATADEBUG
#define ATADEBUG
@@ -266,14 +266,15 @@ wdc_atapi_probe_device(struct atapibus_softc *sc, int target)
if (wdc_atapi_get_params(chan, target, id) == 0) {
#ifdef ATAPI_DEBUG_PROBE
printf("%s drive %d: cmdsz 0x%x drqtype 0x%x\n",
- sc->sc_dev.dv_xname, target,
+ device_xname(sc->sc_dev), target,
id->atap_config & ATAPI_CFG_CMD_MASK,
id->atap_config & ATAPI_CFG_DRQ_MASK);
#endif
periph = scsipi_alloc_periph(M_NOWAIT);
if (periph == NULL) {
- printf("%s: unable to allocate periph for drive %d\n",
- device_xname(&sc->sc_dev), target);
+ aprint_error_dev(sc->sc_dev,
+ "unable to allocate periph for drive %d\n",
+ target);
return;
}
periph->periph_dev = NULL;
diff --git a/sys/dev/scsipi/atapiconf.c b/sys/dev/scsipi/atapiconf.c
index 2e383328109..102d48dacd3 100644
--- a/sys/dev/scsipi/atapiconf.c
+++ b/sys/dev/scsipi/atapiconf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: atapiconf.c,v 1.76 2008/03/08 10:31:52 yamt Exp $ */
+/* $NetBSD: atapiconf.c,v 1.77 2008/03/24 14:44:26 cube Exp $ */
/*
* Copyright (c) 1996, 2001 Manuel Bouyer. All rights reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.76 2008/03/08 10:31:52 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.77 2008/03/24 14:44:26 cube Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -56,20 +56,19 @@ const struct scsipi_periphsw atapi_probe_periphsw = {
NULL,
};
-static int atapibusmatch(device_t, struct cfdata *, void *);
+static int atapibusmatch(device_t, cfdata_t, void *);
static void atapibusattach(device_t, device_t, void *);
static int atapibusactivate(device_t, enum devact);
static int atapibusdetach(device_t, int flags);
static void atapibuschilddet(device_t, device_t);
-static int atapibussubmatch(device_t, struct cfdata *,
- const int *, void *);
+static int atapibussubmatch(device_t, cfdata_t, const int *, void *);
static int atapi_probe_bus(struct atapibus_softc *, int);
static int atapibusprint(void *, const char *);
-CFATTACH_DECL2(atapibus, sizeof(struct atapibus_softc),
+CFATTACH_DECL2_NEW(atapibus, sizeof(struct atapibus_softc),
atapibusmatch, atapibusattach, atapibusdetach, atapibusactivate, NULL,
atapibuschilddet);
@@ -117,7 +116,7 @@ atapiprint(void *aux, const char *pnp)
}
static int
-atapibusmatch(device_t parent, struct cfdata *cf, void *aux)
+atapibusmatch(device_t parent, cfdata_t cf, void *aux)
{
struct scsipi_channel *chan = aux;
@@ -131,8 +130,7 @@ atapibusmatch(device_t parent, struct cfdata *cf, void *aux)
}
static int
-atapibussubmatch(device_t parent, struct cfdata *cf,
- const int *ldesc, void *aux)
+atapibussubmatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
struct scsipibus_attach_args *sa = aux;
struct scsipi_periph *periph = sa->sa_periph;
@@ -150,8 +148,9 @@ atapibusattach(device_t parent, device_t self, void *aux)
struct scsipi_channel *chan = aux;
sc->sc_channel = chan;
+ sc->sc_dev = self;
- chan->chan_name = sc->sc_dev.dv_xname;
+ chan->chan_name = device_xname(sc->sc_dev);
/* ATAPI has no LUNs. */
chan->chan_nluns = 1;
@@ -297,7 +296,7 @@ atapi_probe_device(struct atapibus_softc *sc, int target,
*/
periph->periph_quirks |= quirks;
- if ((cf = config_search_ia(atapibussubmatch, &sc->sc_dev,
+ if ((cf = config_search_ia(atapibussubmatch, sc->sc_dev,
"atapibus", sa)) != 0) {
scsipi_insert_periph(chan, periph);
/*
@@ -305,10 +304,10 @@ atapi_probe_device(struct atapibus_softc *sc, int target,
* XXX need it before config_attach() returns. Must
* XXX assign it in periph driver.
*/
- return config_attach(&sc->sc_dev, cf, sa,
+ return config_attach(sc->sc_dev, cf, sa,
atapibusprint);
} else {
- atapibusprint(sa, sc->sc_dev.dv_xname);
+ atapibusprint(sa, device_xname(sc->sc_dev));
printf(" not configured\n");
free(periph, M_DEVBUF);
return NULL;
diff --git a/sys/dev/scsipi/atapiconf.h b/sys/dev/scsipi/atapiconf.h
index b569b717824..bd786f6147a 100644
--- a/sys/dev/scsipi/atapiconf.h
+++ b/sys/dev/scsipi/atapiconf.h
@@ -1,4 +1,4 @@
-/* $NetBSD: atapiconf.h,v 1.21 2006/11/23 08:44:42 he Exp $ */
+/* $NetBSD: atapiconf.h,v 1.22 2008/03/24 14:44:26 cube Exp $ */
/*
* Copyright (c) 1996, 2001 Manuel Bouyer. All rights reserved.
@@ -36,7 +36,7 @@
#include <dev/scsipi/scsipiconf.h>
struct atapibus_softc {
- struct device sc_dev;
+ device_t sc_dev;
struct scsipi_channel *sc_channel; /* our scsipi_channel */
};
diff --git a/sys/dev/usb/umass_scsipi.c b/sys/dev/usb/umass_scsipi.c
index 8058b6d1bbf..a7eb15143a4 100644
--- a/sys/dev/usb/umass_scsipi.c
+++ b/sys/dev/usb/umass_scsipi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: umass_scsipi.c,v 1.30 2007/03/04 06:02:49 christos Exp $ */
+/* $NetBSD: umass_scsipi.c,v 1.31 2008/03/24 14:44:26 cube Exp $ */
/*
* Copyright (c) 2001, 2003 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.30 2007/03/04 06:02:49 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_scsipi.c,v 1.31 2008/03/24 14:44:26 cube Exp $");
#include "atapibus.h"
#include "scsibus.h"
@@ -519,8 +519,8 @@ umass_atapi_probe_device(struct atapibus_softc *atapi, int target)
periph = scsipi_alloc_periph(M_NOWAIT);
if (periph == NULL) {
- printf("%s: can't allocate link for drive %d\n",
- atapi->sc_dev.dv_xname, target);
+ aprint_error_dev(atapi->sc_dev,
+ "can't allocate link for drive %d\n", target);
return;
}