diff options
| author | xtraeme <xtraeme@NetBSD.org> | 2008-05-04 17:06:09 +0000 |
|---|---|---|
| committer | xtraeme <xtraeme@NetBSD.org> | 2008-05-04 17:06:09 +0000 |
| commit | 7db0e57765c5442d9c413d18d63f4c38df9fc014 (patch) | |
| tree | 4c66c2f55ecdc8abb402406cd5fe08edfa244b41 /sys/dev | |
| parent | 7f44567d7cbafd4e461583e15f0b2567765e42f2 (diff) | |
device_t/softc split for all mii(4) devices, and other related
cosmetic changes.
Diffstat (limited to 'sys/dev')
34 files changed, 302 insertions, 296 deletions
diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c index 072de978c7d..513009435bb 100644 --- a/sys/dev/ic/hme.c +++ b/sys/dev/ic/hme.c @@ -1,4 +1,4 @@ -/* $NetBSD: hme.c,v 1.65 2008/04/28 20:23:49 martin Exp $ */ +/* $NetBSD: hme.c,v 1.66 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.65 2008/04/28 20:23:49 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.66 2008/05/04 17:06:09 xtraeme Exp $"); /* #define HMEDEBUG */ @@ -285,7 +285,7 @@ hme_config(sc) if (child->mii_phy > 1 || child->mii_inst > 1) { aprint_error_dev(&sc->sc_dev, "cannot accommodate MII device %s" " at phy %d, instance %d\n", - device_xname(&child->mii_dev), + device_xname(child->mii_dev), child->mii_phy, child->mii_inst); continue; } diff --git a/sys/dev/mii/acphy.c b/sys/dev/mii/acphy.c index 497139a8b06..1d55f84a484 100644 --- a/sys/dev/mii/acphy.c +++ b/sys/dev/mii/acphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: acphy.c,v 1.21 2008/04/08 20:10:20 cegger Exp $ */ +/* $NetBSD: acphy.c,v 1.22 2008/05/04 17:06:09 xtraeme Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acphy.c,v 1.21 2008/04/08 20:10:20 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acphy.c,v 1.22 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -58,10 +58,10 @@ __KERNEL_RCSID(0, "$NetBSD: acphy.c,v 1.21 2008/04/08 20:10:20 cegger Exp $"); #include <dev/mii/acphyreg.h> -static int acphymatch(struct device *, struct cfdata *, void *); -static void acphyattach(struct device *, struct device *, void *); +static int acphymatch(device_t, cfdata_t, void *); +static void acphyattach(device_t, device_t, void *); -CFATTACH_DECL(acphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(acphy, sizeof(struct mii_softc), acphymatch, acphyattach, mii_phy_detach, mii_phy_activate); static int acphy_service(struct mii_softc *, struct mii_data *, int); @@ -90,8 +90,7 @@ static const struct mii_phydesc acphys[] = { }; static int -acphymatch(struct device *parent, struct cfdata *match, - void *aux) +acphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -102,7 +101,7 @@ acphymatch(struct device *parent, struct cfdata *match, } static void -acphyattach(struct device *parent, struct device *self, void *aux) +acphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -113,6 +112,7 @@ acphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &acphy_funcs; @@ -128,7 +128,7 @@ acphyattach(struct device *parent, struct device *self, void *aux) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(sc->mii_dev, ""); #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) if (sc->mii_flags & MIIF_HAVEFIBER) { diff --git a/sys/dev/mii/amhphy.c b/sys/dev/mii/amhphy.c index cfa2b099668..29f67095963 100644 --- a/sys/dev/mii/amhphy.c +++ b/sys/dev/mii/amhphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: amhphy.c,v 1.17 2008/04/08 20:10:20 cegger Exp $ */ +/* $NetBSD: amhphy.c,v 1.18 2008/05/04 17:06:09 xtraeme Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: amhphy.c,v 1.17 2008/04/08 20:10:20 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: amhphy.c,v 1.18 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -58,10 +58,10 @@ __KERNEL_RCSID(0, "$NetBSD: amhphy.c,v 1.17 2008/04/08 20:10:20 cegger Exp $"); #include <dev/mii/amhphyreg.h> -static int amhphymatch(struct device *, struct cfdata *, void *); -static void amhphyattach(struct device *, struct device *, void *); +static int amhphymatch(device_t, cfdata_t, void *); +static void amhphyattach(device_t, device_t, void *); -CFATTACH_DECL(amhphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(amhphy, sizeof(struct mii_softc), amhphymatch, amhphyattach, mii_phy_detach, mii_phy_activate); static int amhphy_service(struct mii_softc *, struct mii_data *, int); @@ -80,8 +80,7 @@ static const struct mii_phydesc amhphys[] = { }; static int -amhphymatch(struct device *parent, struct cfdata *match, - void *aux) +amhphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -92,7 +91,7 @@ amhphymatch(struct device *parent, struct cfdata *match, } static void -amhphyattach(struct device *parent, struct device *self, void *aux) +amhphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -103,6 +102,7 @@ amhphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &amhphy_funcs; @@ -114,7 +114,7 @@ amhphyattach(struct device *parent, struct device *self, void *aux) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) aprint_error("no media present"); else diff --git a/sys/dev/mii/bmtphy.c b/sys/dev/mii/bmtphy.c index a972216831a..ffc8c111c76 100644 --- a/sys/dev/mii/bmtphy.c +++ b/sys/dev/mii/bmtphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: bmtphy.c,v 1.26 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: bmtphy.c,v 1.27 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bmtphy.c,v 1.26 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bmtphy.c,v 1.27 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -84,10 +84,10 @@ __KERNEL_RCSID(0, "$NetBSD: bmtphy.c,v 1.26 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/bmtphyreg.h> -static int bmtphymatch(struct device *, struct cfdata *, void *); -static void bmtphyattach(struct device *, struct device *, void *); +static int bmtphymatch(device_t, cfdata_t, void *); +static void bmtphyattach(device_t, device_t, void *); -CFATTACH_DECL(bmtphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(bmtphy, sizeof(struct mii_softc), bmtphymatch, bmtphyattach, mii_phy_detach, mii_phy_activate); static int bmtphy_service(struct mii_softc *, struct mii_data *, int); @@ -119,8 +119,7 @@ static const struct mii_phydesc bmtphys[] = { }; static int -bmtphymatch(struct device *parent, struct cfdata *match, - void *aux) +bmtphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -131,7 +130,7 @@ bmtphymatch(struct device *parent, struct cfdata *match, } static void -bmtphyattach(struct device *parent, struct device *self, void *aux) +bmtphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -142,6 +141,7 @@ bmtphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_mpd_model = MII_MODEL(ma->mii_id2); sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; @@ -158,7 +158,7 @@ bmtphyattach(struct device *parent, struct device *self, void *aux) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) aprint_error("no media present"); else diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c index 2fc73df8d2b..b198812f10c 100644 --- a/sys/dev/mii/brgphy.c +++ b/sys/dev/mii/brgphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: brgphy.c,v 1.38 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: brgphy.c,v 1.39 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.38 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.39 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -85,10 +85,10 @@ __KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.38 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/brgphyreg.h> -static int brgphymatch(struct device *, struct cfdata *, void *); -static void brgphyattach(struct device *, struct device *, void *); +static int brgphymatch(device_t, cfdata_t, void *); +static void brgphyattach(device_t, device_t, void *); -CFATTACH_DECL(brgphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(brgphy, sizeof(struct mii_softc), brgphymatch, brgphyattach, mii_phy_detach, mii_phy_activate); static int brgphy_service(struct mii_softc *, struct mii_data *, int); @@ -218,6 +218,7 @@ brgphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_mpd_model = MII_MODEL(ma->mii_id2); @@ -228,32 +229,32 @@ brgphyattach(struct device *parent, struct device *self, void *aux) switch (MII_MODEL(ma->mii_id2)) { case MII_MODEL_BROADCOM_BCM5400: sc->mii_funcs = &brgphy_5401_funcs; - aprint_normal_dev(&sc->mii_dev, "using BCM5401 DSP patch\n"); + aprint_normal_dev(self, "using BCM5401 DSP patch\n"); break; case MII_MODEL_BROADCOM_BCM5401: if (MII_REV(ma->mii_id2) == 1 || MII_REV(ma->mii_id2) == 3) { sc->mii_funcs = &brgphy_5401_funcs; - aprint_normal_dev(&sc->mii_dev, "using BCM5401 DSP patch\n"); + aprint_normal_dev(self, "using BCM5401 DSP patch\n"); } else sc->mii_funcs = &brgphy_funcs; break; case MII_MODEL_BROADCOM_BCM5411: sc->mii_funcs = &brgphy_5411_funcs; - aprint_normal_dev(&sc->mii_dev, "using BCM5411 DSP patch\n"); + aprint_normal_dev(self, "using BCM5411 DSP patch\n"); break; #ifdef notyet /* unverified, untested */ case MII_MODEL_BROADCOM_BCM5703: sc->mii_funcs = &brgphy_5703_funcs; - aprint_normal_dev(&sc->mii_dev, "using BCM5703 DSP patch\n"); + aprint_normal_dev(self, "using BCM5703 DSP patch\n"); break; #endif case MII_MODEL_BROADCOM_BCM5704: sc->mii_funcs = &brgphy_5704_funcs; - aprint_normal_dev(&sc->mii_dev, "using BCM5704 DSP patch\n"); + aprint_normal_dev(self, "using BCM5704 DSP patch\n"); break; case MII_MODEL_BROADCOM_BCM5705: @@ -285,7 +286,7 @@ brgphyattach(struct device *parent, struct device *self, void *aux) if (sc->mii_capabilities & BMSR_EXTSTAT) sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 && (sc->mii_extcapabilities & EXTSR_MEDIAMASK) == 0) aprint_error("no media present"); diff --git a/sys/dev/mii/ciphy.c b/sys/dev/mii/ciphy.c index 00da39ebb7c..8e14efb45bd 100644 --- a/sys/dev/mii/ciphy.c +++ b/sys/dev/mii/ciphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: ciphy.c,v 1.14 2008/04/08 20:10:20 cegger Exp $ */ +/* $NetBSD: ciphy.c,v 1.15 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 2004 @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.14 2008/04/08 20:10:20 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.15 2008/05/04 17:06:09 xtraeme Exp $"); /* * Driver for the Cicada CS8201 10/100/1000 copper PHY. @@ -58,10 +58,10 @@ __KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.14 2008/04/08 20:10:20 cegger Exp $"); #include <dev/mii/ciphyreg.h> -static int ciphymatch(struct device *, struct cfdata *, void *); -static void ciphyattach(struct device *, struct device *, void *); +static int ciphymatch(device_t, cfdata_t, void *); +static void ciphyattach(device_t, device_t, void *); -CFATTACH_DECL(ciphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(ciphy, sizeof(struct mii_softc), ciphymatch, ciphyattach, mii_phy_detach, mii_phy_activate); static int ciphy_service(struct mii_softc *, struct mii_data *, int); @@ -120,6 +120,7 @@ ciphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &ciphy_funcs; @@ -135,7 +136,7 @@ ciphyattach(struct device *parent, struct device *self, void *aux) PHY_READ(sc, MII_BMSR) & ma->mii_capmask; if (sc->mii_capabilities & BMSR_EXTSTAT) sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) aprint_error("no media present"); else @@ -341,7 +342,7 @@ ciphy_status(sc) mii->mii_media_active |= IFM_1000_T; break; default: - aprint_error_dev(&sc->mii_dev, "unknown PHY speed %x\n", + aprint_error_dev(sc->mii_dev, "unknown PHY speed %x\n", bmsr & CIPHY_AUXCSR_SPEED); break; } @@ -376,7 +377,7 @@ ciphy_fixup(struct mii_softc *sc) status = PHY_READ(sc, CIPHY_MII_AUXCSR); speed = status & CIPHY_AUXCSR_SPEED; - if (device_is_a(device_parent(&sc->mii_dev), "nfe")) { + if (device_is_a(device_parent(sc->mii_dev), "nfe")) { /* need to set for 2.5V RGMII for NVIDIA adapters */ PHY_SETBIT(sc, CIPHY_MII_ECTL1, CIPHY_INTSEL_RGMII); PHY_SETBIT(sc, CIPHY_MII_ECTL1, CIPHY_IOVOL_2500MV); @@ -420,7 +421,7 @@ ciphy_fixup(struct mii_softc *sc) break; default: - aprint_error_dev(&sc->mii_dev, "unknown CICADA PHY model %x\n", + aprint_error_dev(sc->mii_dev, "unknown CICADA PHY model %x\n", model); break; } diff --git a/sys/dev/mii/dmphy.c b/sys/dev/mii/dmphy.c index 69326c069a9..d9b0f1ec9c1 100644 --- a/sys/dev/mii/dmphy.c +++ b/sys/dev/mii/dmphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: dmphy.c,v 1.31 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: dmphy.c,v 1.32 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dmphy.c,v 1.31 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dmphy.c,v 1.32 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -83,10 +83,10 @@ __KERNEL_RCSID(0, "$NetBSD: dmphy.c,v 1.31 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/dmphyreg.h> -static int dmphymatch(struct device *, struct cfdata *, void *); -static void dmphyattach(struct device *, struct device *, void *); +static int dmphymatch(device_t, cfdata_t, void *); +static void dmphyattach(device_t, device_t, void *); -CFATTACH_DECL(dmphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(dmphy, sizeof(struct mii_softc), dmphymatch, dmphyattach, mii_phy_detach, mii_phy_activate); static int dmphy_service(struct mii_softc *, struct mii_data *, int); @@ -111,8 +111,7 @@ static const struct mii_phydesc dmphys[] = { }; static int -dmphymatch(struct device *parent, struct cfdata *match, - void *aux) +dmphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -123,7 +122,7 @@ dmphymatch(struct device *parent, struct cfdata *match, } static void -dmphyattach(struct device *parent, struct device *self, void *aux) +dmphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -134,6 +133,7 @@ dmphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &dmphy_funcs; @@ -145,7 +145,7 @@ dmphyattach(struct device *parent, struct device *self, void *aux) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) aprint_error("no media present"); else diff --git a/sys/dev/mii/exphy.c b/sys/dev/mii/exphy.c index 128e9f036d1..dfb394eab42 100644 --- a/sys/dev/mii/exphy.c +++ b/sys/dev/mii/exphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: exphy.c,v 1.49 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: exphy.c,v 1.50 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: exphy.c,v 1.49 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exphy.c,v 1.50 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -79,10 +79,10 @@ __KERNEL_RCSID(0, "$NetBSD: exphy.c,v 1.49 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/miivar.h> #include <dev/mii/miidevs.h> -static int exphymatch(struct device *, struct cfdata *, void *); -static void exphyattach(struct device *, struct device *, void *); +static int exphymatch(device_t, cfdata_t, void *); +static void exphyattach(device_t, device_t, void *); -CFATTACH_DECL(exphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(exphy, sizeof(struct mii_softc), exphymatch, exphyattach, mii_phy_detach, mii_phy_activate); static int exphy_service(struct mii_softc *, struct mii_data *, int); @@ -93,7 +93,7 @@ static const struct mii_phy_funcs exphy_funcs = { }; static int -exphymatch(struct device *parent, struct cfdata *match, void *aux) +exphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -114,7 +114,7 @@ exphymatch(struct device *parent, struct cfdata *match, void *aux) } static void -exphyattach(struct device *parent, struct device *self, void *aux) +exphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -123,6 +123,7 @@ exphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": 3Com internal media interface\n"); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &exphy_funcs; diff --git a/sys/dev/mii/gentbi.c b/sys/dev/mii/gentbi.c index 55fbdc8e466..78cc552ea60 100644 --- a/sys/dev/mii/gentbi.c +++ b/sys/dev/mii/gentbi.c @@ -1,4 +1,4 @@ -/* $NetBSD: gentbi.c,v 1.21 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: gentbi.c,v 1.22 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: gentbi.c,v 1.21 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gentbi.c,v 1.22 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -83,10 +83,10 @@ __KERNEL_RCSID(0, "$NetBSD: gentbi.c,v 1.21 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/miivar.h> #include <dev/mii/miidevs.h> -static int gentbimatch(struct device *, struct cfdata *, void *); -static void gentbiattach(struct device *, struct device *, void *); +static int gentbimatch(device_t, cfdata_t, void *); +static void gentbiattach(device_t, device_t, void *); -CFATTACH_DECL(gentbi, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(gentbi, sizeof(struct mii_softc), gentbimatch, gentbiattach, mii_phy_detach, mii_phy_activate); static int gentbi_service(struct mii_softc *, struct mii_data *, int); @@ -97,7 +97,7 @@ static const struct mii_phy_funcs gentbi_funcs = { }; static int -gentbimatch(struct device *parent, struct cfdata *match, void *aux) +gentbimatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; struct mii_data *mii = ma->mii_data; @@ -130,7 +130,7 @@ gentbimatch(struct device *parent, struct cfdata *match, void *aux) } static void -gentbiattach(struct device *parent, struct device *self, void *aux) +gentbiattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -140,6 +140,7 @@ gentbiattach(struct device *parent, struct device *self, void *aux) aprint_normal(": Generic ten-bit interface, rev. %d\n", MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &gentbi_funcs; @@ -158,7 +159,7 @@ gentbiattach(struct device *parent, struct device *self, void *aux) if (sc->mii_capabilities & BMSR_EXTSTAT) sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 && (sc->mii_extcapabilities & EXTSR_MEDIAMASK) == 0) aprint_error("no media present"); diff --git a/sys/dev/mii/glxtphy.c b/sys/dev/mii/glxtphy.c index 95ebeaee870..a28d26c44f3 100644 --- a/sys/dev/mii/glxtphy.c +++ b/sys/dev/mii/glxtphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: glxtphy.c,v 1.20 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: glxtphy.c,v 1.21 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: glxtphy.c,v 1.20 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: glxtphy.c,v 1.21 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -82,10 +82,10 @@ __KERNEL_RCSID(0, "$NetBSD: glxtphy.c,v 1.20 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/glxtphyreg.h> -static int glxtphymatch(struct device *, struct cfdata *, void *); -static void glxtphyattach(struct device *, struct device *, void *); +static int glxtphymatch(device_t, cfdata_t, void *); +static void glxtphyattach(device_t, device_t, void *); -CFATTACH_DECL(glxtphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(glxtphy, sizeof(struct mii_softc), glxtphymatch, glxtphyattach, mii_phy_detach, mii_phy_activate); static int glxtphy_service(struct mii_softc *, struct mii_data *, int); @@ -107,7 +107,7 @@ static const struct mii_phydesc glxtphys[] = { }; static int -glxtphymatch(struct device *parent, struct cfdata *match, +glxtphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -119,7 +119,7 @@ glxtphymatch(struct device *parent, struct cfdata *match, } static void -glxtphyattach(struct device *parent, struct device *self, void *aux) +glxtphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -130,6 +130,7 @@ glxtphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &glxtphy_funcs; @@ -144,7 +145,7 @@ glxtphyattach(struct device *parent, struct device *self, void *aux) if (sc->mii_capabilities & BMSR_EXTSTAT) sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 && (sc->mii_extcapabilities & EXTSR_MEDIAMASK) == 0) aprint_error("no media present"); diff --git a/sys/dev/mii/gphyter.c b/sys/dev/mii/gphyter.c index b8e6496be7d..2856c4a2f63 100644 --- a/sys/dev/mii/gphyter.c +++ b/sys/dev/mii/gphyter.c @@ -1,4 +1,4 @@ -/* $NetBSD: gphyter.c,v 1.23 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: gphyter.c,v 1.24 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: gphyter.c,v 1.23 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gphyter.c,v 1.24 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -86,10 +86,10 @@ __KERNEL_RCSID(0, "$NetBSD: gphyter.c,v 1.23 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/gphyterreg.h> -static int gphytermatch(struct device *, struct cfdata *, void *); -static void gphyterattach(struct device *, struct device *, void *); +static int gphytermatch(device_t, cfdata_t, void *); +static void gphyterattach(device_t, device_t, void *); -CFATTACH_DECL(gphyter, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(gphyter, sizeof(struct mii_softc), gphytermatch, gphyterattach, mii_phy_detach, mii_phy_activate); static int gphyter_service(struct mii_softc *, struct mii_data *, int); @@ -112,8 +112,7 @@ static const struct mii_phydesc gphyters[] = { }; static int -gphytermatch(struct device *parent, struct cfdata *match, - void *aux) +gphytermatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -124,7 +123,7 @@ gphytermatch(struct device *parent, struct cfdata *match, } static void -gphyterattach(struct device *parent, struct device *self, void *aux) +gphyterattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = (struct mii_softc *)self; struct mii_attach_args *ma = aux; @@ -136,6 +135,7 @@ gphyterattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &gphyter_funcs; @@ -163,7 +163,7 @@ gphyterattach(struct device *parent, struct device *self, void *aux) if (anar & ANAR_10_FD) sc->mii_capabilities |= (BMSR_10TFDX & ma->mii_capmask); - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 && (sc->mii_extcapabilities & EXTSR_MEDIAMASK) == 0) aprint_error("no media present"); @@ -172,7 +172,7 @@ gphyterattach(struct device *parent, struct device *self, void *aux) aprint_normal("\n"); strap = PHY_READ(sc, MII_GPHYTER_STRAP); - aprint_normal_dev(&sc->mii_dev, "strapped to %s mode", + aprint_normal_dev(self, "strapped to %s mode", (strap & STRAP_MS_VAL) ? "master" : "slave"); if (strap & STRAP_NC_MODE) aprint_normal(", pre-C5 BCM5400 compat enabled"); diff --git a/sys/dev/mii/icsphy.c b/sys/dev/mii/icsphy.c index e1bb18b0ef0..32a4591a6ee 100644 --- a/sys/dev/mii/icsphy.c +++ b/sys/dev/mii/icsphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: icsphy.c,v 1.45 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: icsphy.c,v 1.46 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: icsphy.c,v 1.45 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: icsphy.c,v 1.46 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -82,10 +82,10 @@ __KERNEL_RCSID(0, "$NetBSD: icsphy.c,v 1.45 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/icsphyreg.h> -static int icsphymatch(struct device *, struct cfdata *, void *); -static void icsphyattach(struct device *, struct device *, void *); +static int icsphymatch(device_t, cfdata_t, void *); +static void icsphyattach(device_t, device_t, void *); -CFATTACH_DECL(icsphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(icsphy, sizeof(struct mii_softc), icsphymatch, icsphyattach, mii_phy_detach, mii_phy_activate); static int icsphy_service(struct mii_softc *, struct mii_data *, int); @@ -114,8 +114,7 @@ static const struct mii_phydesc icsphys[] = { }; static int -icsphymatch(struct device *parent, struct cfdata *match, - void *aux) +icsphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -126,7 +125,7 @@ icsphymatch(struct device *parent, struct cfdata *match, } static void -icsphyattach(struct device *parent, struct device *self, void *aux) +icsphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -137,6 +136,7 @@ icsphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_mpd_model = MII_MODEL(ma->mii_id2); sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; @@ -149,7 +149,7 @@ icsphyattach(struct device *parent, struct device *self, void *aux) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) aprint_error("no media present"); else diff --git a/sys/dev/mii/igphy.c b/sys/dev/mii/igphy.c index 8f395c70fea..ad37e92ea0e 100644 --- a/sys/dev/mii/igphy.c +++ b/sys/dev/mii/igphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: igphy.c,v 1.15 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: igphy.c,v 1.16 2008/05/04 17:06:09 xtraeme Exp $ */ /* * The Intel copyright applies to the analog register setup, and the @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.15 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.16 2008/05/04 17:06:09 xtraeme Exp $"); #include "opt_mii.h" @@ -99,10 +99,10 @@ static void igphy_reset(struct mii_softc *); static void igphy_load_dspcode(struct mii_softc *); static void igphy_smartspeed_workaround(struct mii_softc *sc); -static int igphymatch(struct device *, struct cfdata *, void *); -static void igphyattach(struct device *, struct device *, void *); +static int igphymatch(device_t, cfdata_t, void *); +static void igphyattach(device_t, device_t, void *); -CFATTACH_DECL(igphy, sizeof(struct igphy_softc), +CFATTACH_DECL_NEW(igphy, sizeof(struct igphy_softc), igphymatch, igphyattach, mii_phy_detach, mii_phy_activate); static int igphy_service(struct mii_softc *, struct mii_data *, int); @@ -124,8 +124,7 @@ static const struct mii_phydesc igphys[] = { }; static int -igphymatch(struct device *parent, struct cfdata *match, - void *aux) +igphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -136,7 +135,7 @@ igphymatch(struct device *parent, struct cfdata *match, } static void -igphyattach(struct device *parent, struct device *self, void *aux) +igphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -147,6 +146,7 @@ igphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &igphy_funcs; @@ -160,7 +160,7 @@ igphyattach(struct device *parent, struct device *self, void *aux) PHY_READ(sc, MII_BMSR) & ma->mii_capmask; if (sc->mii_capabilities & BMSR_EXTSTAT) sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 && (sc->mii_extcapabilities & EXTSR_MEDIAMASK) == 0) aprint_error("no media present"); diff --git a/sys/dev/mii/ikphy.c b/sys/dev/mii/ikphy.c index e23b3c87169..1f6551b98a2 100644 --- a/sys/dev/mii/ikphy.c +++ b/sys/dev/mii/ikphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: ikphy.c,v 1.6 2008/04/08 20:10:20 cegger Exp $ */ +/* $NetBSD: ikphy.c,v 1.7 2008/05/04 17:06:09 xtraeme Exp $ */ /******************************************************************************* Copyright (c) 2001-2005, Intel Corporation @@ -64,7 +64,7 @@ POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ikphy.c,v 1.6 2008/04/08 20:10:20 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ikphy.c,v 1.7 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -82,10 +82,10 @@ __KERNEL_RCSID(0, "$NetBSD: ikphy.c,v 1.6 2008/04/08 20:10:20 cegger Exp $"); #include <dev/mii/ikphyreg.h> -static int ikphymatch(struct device *, struct cfdata *, void *); -static void ikphyattach(struct device *, struct device *, void *); +static int ikphymatch(device_t, cfdata_t, void *); +static void ikphyattach(device_t, device_t, void *); -CFATTACH_DECL(ikphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(ikphy, sizeof(struct mii_softc), ikphymatch, ikphyattach, mii_phy_detach, mii_phy_activate); static int ikphy_service(struct mii_softc *, struct mii_data *, int); @@ -105,8 +105,7 @@ static const struct mii_phydesc ikphys[] = { }; static int -ikphymatch(struct device *parent, struct cfdata *match, - void *aux) +ikphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -117,7 +116,7 @@ ikphymatch(struct device *parent, struct cfdata *match, } static void -ikphyattach(struct device *parent, struct device *self, void *aux) +ikphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -128,6 +127,7 @@ ikphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &ikphy_funcs; @@ -141,7 +141,7 @@ ikphyattach(struct device *parent, struct device *self, void *aux) PHY_READ(sc, MII_BMSR) & ma->mii_capmask; if (sc->mii_capabilities & BMSR_EXTSTAT) sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 && (sc->mii_extcapabilities & EXTSR_MEDIAMASK) == 0) aprint_error("no media present"); diff --git a/sys/dev/mii/inphy.c b/sys/dev/mii/inphy.c index 701a8506936..1c1ef397e36 100644 --- a/sys/dev/mii/inphy.c +++ b/sys/dev/mii/inphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: inphy.c,v 1.47 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: inphy.c,v 1.48 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: inphy.c,v 1.47 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: inphy.c,v 1.48 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -83,10 +83,10 @@ __KERNEL_RCSID(0, "$NetBSD: inphy.c,v 1.47 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/inphyreg.h> -static int inphymatch(struct device *, struct cfdata *, void *); -static void inphyattach(struct device *, struct device *, void *); +static int inphymatch(device_t, cfdata_t, void *); +static void inphyattach(device_t, device_t, void *); -CFATTACH_DECL(inphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(inphy, sizeof(struct mii_softc), inphymatch, inphyattach, mii_phy_detach, mii_phy_activate); static int inphy_service(struct mii_softc *, struct mii_data *, int); @@ -117,8 +117,7 @@ static const struct mii_phydesc inphys[] = { }; static int -inphymatch(struct device *parent, struct cfdata *match, - void *aux) +inphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -129,7 +128,7 @@ inphymatch(struct device *parent, struct cfdata *match, } static void -inphyattach(struct device *parent, struct device *self, void *aux) +inphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -140,6 +139,7 @@ inphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &inphy_funcs; @@ -151,7 +151,7 @@ inphyattach(struct device *parent, struct device *self, void *aux) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) aprint_error("no media present"); else diff --git a/sys/dev/mii/iophy.c b/sys/dev/mii/iophy.c index 36b49e6c7ca..dc8cf0392a0 100644 --- a/sys/dev/mii/iophy.c +++ b/sys/dev/mii/iophy.c @@ -1,4 +1,4 @@ -/* $NetBSD: iophy.c,v 1.32 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: iophy.c,v 1.33 2008/05/04 17:06:09 xtraeme Exp $ */ /* * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: iophy.c,v 1.32 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: iophy.c,v 1.33 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -81,10 +81,10 @@ __KERNEL_RCSID(0, "$NetBSD: iophy.c,v 1.32 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/iophyreg.h> -static int iophymatch(struct device *, struct cfdata *, void *); -static void iophyattach(struct device *, struct device *, void *); +static int iophymatch(device_t, cfdata_t, void *); +static void iophyattach(device_t, device_t, void *); -CFATTACH_DECL(iophy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(iophy, sizeof(struct mii_softc), iophymatch, iophyattach, mii_phy_detach, mii_phy_activate); static int iophy_service(struct mii_softc *, struct mii_data *, int); @@ -106,8 +106,7 @@ static const struct mii_phydesc iophys[] = { }; static int -iophymatch(struct device *parent, struct cfdata *match, - void *aux) +iophymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -118,7 +117,7 @@ iophymatch(struct device *parent, struct cfdata *match, } static void -iophyattach(struct device *parent, struct device *self, void *aux) +iophyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -129,6 +128,7 @@ iophyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &iophy_funcs; @@ -140,7 +140,7 @@ iophyattach(struct device *parent, struct device *self, void *aux) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) aprint_error("no media present"); else diff --git a/sys/dev/mii/lxtphy.c b/sys/dev/mii/lxtphy.c index c8a18117f1d..f038b6cd46c 100644 --- a/sys/dev/mii/lxtphy.c +++ b/sys/dev/mii/lxtphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: lxtphy.c,v 1.45 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: lxtphy.c,v 1.46 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lxtphy.c,v 1.45 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lxtphy.c,v 1.46 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -83,10 +83,10 @@ __KERNEL_RCSID(0, "$NetBSD: lxtphy.c,v 1.45 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/lxtphyreg.h> -static int lxtphymatch(struct device *, struct cfdata *, void *); -static void lxtphyattach(struct device *, struct device *, void *); +static int lxtphymatch(device_t, cfdata_t, void *); +static void lxtphyattach(device_t, device_t, void *); -CFATTACH_DECL(lxtphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(lxtphy, sizeof(struct mii_softc), lxtphymatch, lxtphyattach, mii_phy_detach, mii_phy_activate); static int lxtphy_service(struct mii_softc *, struct mii_data *, int); @@ -116,8 +116,7 @@ static const struct mii_phydesc lxtphys[] = { }; static int -lxtphymatch(struct device *parent, struct cfdata *match, - void *aux) +lxtphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -128,7 +127,7 @@ lxtphymatch(struct device *parent, struct cfdata *match, } static void -lxtphyattach(struct device *parent, struct device *self, void *aux) +lxtphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -139,6 +138,7 @@ lxtphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; if (mpd->mpd_model == MII_MODEL_LEVEL1_LXT971) @@ -153,7 +153,7 @@ lxtphyattach(struct device *parent, struct device *self, void *aux) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if (sc->mii_flags & MIIF_HAVEFIBER) { #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) diff --git a/sys/dev/mii/makphy.c b/sys/dev/mii/makphy.c index 969d5d5c249..3f03c19687b 100644 --- a/sys/dev/mii/makphy.c +++ b/sys/dev/mii/makphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: makphy.c,v 1.27 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: makphy.c,v 1.28 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.27 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.28 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -82,10 +82,10 @@ __KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.27 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/makphyreg.h> -static int makphymatch(struct device *, struct cfdata *, void *); -static void makphyattach(struct device *, struct device *, void *); +static int makphymatch(device_t, cfdata_t, void *); +static void makphyattach(device_t, device_t, void *); -CFATTACH_DECL(makphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(makphy, sizeof(struct mii_softc), makphymatch, makphyattach, mii_phy_detach, mii_phy_activate); static int makphy_service(struct mii_softc *, struct mii_data *, int); @@ -117,8 +117,7 @@ static const struct mii_phydesc makphys[] = { }; static int -makphymatch(struct device *parent, struct cfdata *match, - void *aux) +makphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -129,7 +128,7 @@ makphymatch(struct device *parent, struct cfdata *match, } static void -makphyattach(struct device *parent, struct device *self, void *aux) +makphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -140,6 +139,7 @@ makphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &makphy_funcs; @@ -154,7 +154,7 @@ makphyattach(struct device *parent, struct device *self, void *aux) if (sc->mii_capabilities & BMSR_EXTSTAT) sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 && (sc->mii_extcapabilities & EXTSR_MEDIAMASK) == 0) aprint_error("no media present"); diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c index a76d636f1de..62e9c3f994c 100644 --- a/sys/dev/mii/mii.c +++ b/sys/dev/mii/mii.c @@ -1,4 +1,4 @@ -/* $NetBSD: mii.c,v 1.46 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: mii.c,v 1.47 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mii.c,v 1.46 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mii.c,v 1.47 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -58,7 +58,7 @@ static int mii_print(void *, const char *); * to the network interface driver parent. */ void -mii_attach(struct device *parent, struct mii_data *mii, int capmask, +mii_attach(device_t parent, struct mii_data *mii, int capmask, int phyloc, int offloc, int flags) { struct mii_attach_args ma; @@ -176,9 +176,9 @@ mii_activate(struct mii_data *mii, enum devact act, int phyloc, int offloc) break; case DVACT_DEACTIVATE: - if (config_deactivate(&child->mii_dev) != 0) + if (config_deactivate(child->mii_dev) != 0) panic("%s: config_activate(%d) failed", - device_xname(&child->mii_dev), act); + device_xname(child->mii_dev), act); } } } @@ -205,7 +205,7 @@ mii_detach(struct mii_data *mii, int phyloc, int offloc) offloc != child->mii_offset) continue; } - (void) config_detach(&child->mii_dev, DETACH_FORCE); + (void)config_detach(child->mii_dev, DETACH_FORCE); } } @@ -226,7 +226,7 @@ mii_print(void *aux, const char *pnp) static inline int phy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) { - if (!device_is_active(&sc->mii_dev)) + if (!device_is_active(sc->mii_dev)) return ENXIO; return PHY_SERVICE(sc, mii, cmd); } diff --git a/sys/dev/mii/mii_bitbang.c b/sys/dev/mii/mii_bitbang.c index 9644e20c3da..fe8b88db6b1 100644 --- a/sys/dev/mii/mii_bitbang.c +++ b/sys/dev/mii/mii_bitbang.c @@ -1,4 +1,4 @@ -/* $NetBSD: mii_bitbang.c,v 1.11 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: mii_bitbang.c,v 1.12 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mii_bitbang.c,v 1.11 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mii_bitbang.c,v 1.12 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -63,7 +63,7 @@ do { \ * Synchronize the MII. */ static void -mii_bitbang_sync(struct device *sc, mii_bitbang_ops_t ops) +mii_bitbang_sync(device_t sc, mii_bitbang_ops_t ops) { int i; u_int32_t v; @@ -83,7 +83,7 @@ mii_bitbang_sync(struct device *sc, mii_bitbang_ops_t ops) * Send a series of bits to the MII. */ static void -mii_bitbang_sendbits(struct device *sc, mii_bitbang_ops_t ops, uint32_t data, +mii_bitbang_sendbits(device_t sc, mii_bitbang_ops_t ops, uint32_t data, int nbits) { int i; @@ -109,7 +109,7 @@ mii_bitbang_sendbits(struct device *sc, mii_bitbang_ops_t ops, uint32_t data, * Read a PHY register by bit-bang'ing the MII. */ int -mii_bitbang_readreg(struct device *sc, mii_bitbang_ops_t ops, int phy, int reg) +mii_bitbang_readreg(device_t sc, mii_bitbang_ops_t ops, int phy, int reg) { int val = 0, err = 0, i; @@ -156,8 +156,8 @@ mii_bitbang_readreg(struct device *sc, mii_bitbang_ops_t ops, int phy, int reg) * Write a PHY register by bit-bang'ing the MII. */ void -mii_bitbang_writereg(struct device *sc, mii_bitbang_ops_t ops, int phy, -int reg, int val) +mii_bitbang_writereg(device_t sc, mii_bitbang_ops_t ops, int phy, + int reg, int val) { mii_bitbang_sync(sc, ops); diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c index 2b3edbee4f1..0f9609658bf 100644 --- a/sys/dev/mii/mii_physubr.c +++ b/sys/dev/mii/mii_physubr.c @@ -1,4 +1,4 @@ -/* $NetBSD: mii_physubr.c,v 1.59 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: mii_physubr.c,v 1.60 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.59 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.60 2008/05/04 17:06:09 xtraeme Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -259,7 +259,7 @@ mii_phy_auto_timeout(void *arg) struct mii_softc *sc = arg; int s; - if (!device_is_active(&sc->mii_dev)) + if (!device_is_active(sc->mii_dev)) return; s = splnet(); @@ -368,7 +368,7 @@ mii_phy_update(struct mii_softc *sc, int cmd) sc->mii_media_status != mii->mii_media_status || cmd == MII_MEDIACHG) { mii_phy_statusmsg(sc); - (*mii->mii_statchg)(device_parent(&sc->mii_dev)); + (*mii->mii_statchg)(device_parent(sc->mii_dev)); sc->mii_media_active = mii->mii_media_active; sc->mii_media_status = mii->mii_media_status; } diff --git a/sys/dev/mii/miivar.h b/sys/dev/mii/miivar.h index 8f4bd6657b0..dd80492d01e 100644 --- a/sys/dev/mii/miivar.h +++ b/sys/dev/mii/miivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: miivar.h,v 1.51 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: miivar.h,v 1.52 2008/05/04 17:06:09 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -106,7 +106,7 @@ struct mii_phy_funcs { * XXX BSDI used, and we would like to have the same interface. */ struct mii_softc { - struct device mii_dev; /* generic device glue */ + device_t mii_dev; /* generic device glue */ LIST_ENTRY(mii_softc) mii_list; /* entry on parent's PHY list */ @@ -206,11 +206,11 @@ struct mii_media { #ifdef _KERNEL #define PHY_READ(p, r) \ - (*(p)->mii_pdata->mii_readreg)(device_parent(&(p)->mii_dev), \ + (*(p)->mii_pdata->mii_readreg)(device_parent((p)->mii_dev), \ (p)->mii_phy, (r)) #define PHY_WRITE(p, r, v) \ - (*(p)->mii_pdata->mii_writereg)(device_parent(&(p)->mii_dev), \ + (*(p)->mii_pdata->mii_writereg)(device_parent((p)->mii_dev), \ (p)->mii_phy, (r), (v)) #define PHY_SERVICE(p, d, o) \ @@ -222,8 +222,7 @@ struct mii_media { #define PHY_RESET(p) \ (*(p)->mii_funcs->pf_reset)((p)) -void mii_attach(struct device *, struct mii_data *, int, int, - int, int); +void mii_attach(device_t, struct mii_data *, int, int, int, int); void mii_activate(struct mii_data *, enum devact, int, int); void mii_detach(struct mii_data *, int, int); bool mii_phy_resume(device_t PMF_FN_PROTO); @@ -235,8 +234,8 @@ void mii_down(struct mii_data *); int mii_ifmedia_change(struct mii_data *); -int mii_phy_activate(struct device *, enum devact); -int mii_phy_detach(struct device *, int); +int mii_phy_activate(device_t, enum devact); +int mii_phy_detach(device_t, int); const struct mii_phydesc *mii_phy_match(const struct mii_attach_args *, const struct mii_phydesc *); diff --git a/sys/dev/mii/mvphy.c b/sys/dev/mii/mvphy.c index 1068b8ceed7..bb3c48fcd4c 100644 --- a/sys/dev/mii/mvphy.c +++ b/sys/dev/mii/mvphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: mvphy.c,v 1.6 2008/04/08 20:10:20 cegger Exp $ */ +/* $NetBSD: mvphy.c,v 1.7 2008/05/04 17:06:10 xtraeme Exp $ */ /*- * Copyright (c) 2006 Sam Leffler, Errno Consulting @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mvphy.c,v 1.6 2008/04/08 20:10:20 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvphy.c,v 1.7 2008/05/04 17:06:10 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -71,10 +71,10 @@ __KERNEL_RCSID(0, "$NetBSD: mvphy.c,v 1.6 2008/04/08 20:10:20 cegger Exp $"); #define SM(_v, _f) (((_v) << _f##_S) & _f) #define MS(_v, _f) (((_v) & _f) >> _f##_S) -static int mvphymatch(struct device *, struct cfdata *, void *); -static void mvphyattach(struct device *, struct device *, void *); +static int mvphymatch(device_t, cfdata_t, void *); +static void mvphyattach(device_t, device_t, void *); -CFATTACH_DECL(mvphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(mvphy, sizeof(struct mii_softc), mvphymatch, mvphyattach, mii_phy_detach, mii_phy_activate); static int mvphy_service(struct mii_softc *, struct mii_data *, int); @@ -164,7 +164,7 @@ static void mvphy_switchconfig(struct mii_softc *, int); static void mvphy_flushatu(struct mii_softc *); static int -mvphymatch(struct device *parent, struct cfdata *match, void *aux) +mvphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -175,7 +175,7 @@ mvphymatch(struct device *parent, struct cfdata *match, void *aux) } static void -mvphyattach(struct device *parent, struct device *self, void *aux) +mvphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -186,6 +186,7 @@ mvphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &mvphy_funcs; @@ -206,7 +207,7 @@ mvphyattach(struct device *parent, struct device *self, void *aux) PHY_RESET(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) aprint_error("no media present"); else @@ -349,5 +350,5 @@ mvphy_flushatu(struct mii_softc *sc) MV_ATU_OP_FLUSH_ALL | MV_ATU_BUSY); } /*else printf("%s: timeout waiting for ATU flush\n", - device_xname(&sc->mii_dev));*/ + device_xname(sc->mii_dev));*/ } diff --git a/sys/dev/mii/nsphy.c b/sys/dev/mii/nsphy.c index addb6ed59bb..984fb60b708 100644 --- a/sys/dev/mii/nsphy.c +++ b/sys/dev/mii/nsphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: nsphy.c,v 1.53 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: nsphy.c,v 1.54 2008/05/04 17:06:10 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nsphy.c,v 1.53 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nsphy.c,v 1.54 2008/05/04 17:06:10 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -83,10 +83,10 @@ __KERNEL_RCSID(0, "$NetBSD: nsphy.c,v 1.53 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/nsphyreg.h> -static int nsphymatch(struct device *, struct cfdata *, void *); -static void nsphyattach(struct device *, struct device *, void *); +static int nsphymatch(device_t, cfdata_t, void *); +static void nsphyattach(device_t, device_t, void *); -CFATTACH_DECL(nsphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(nsphy, sizeof(struct mii_softc), nsphymatch, nsphyattach, mii_phy_detach, mii_phy_activate); static int nsphy_service(struct mii_softc *, struct mii_data *, int); @@ -106,8 +106,7 @@ static const struct mii_phydesc nsphys[] = { }; static int -nsphymatch(struct device *parent, struct cfdata *match, - void *aux) +nsphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -118,7 +117,7 @@ nsphymatch(struct device *parent, struct cfdata *match, } static void -nsphyattach(struct device *parent, struct device *self, void *aux) +nsphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -129,6 +128,7 @@ nsphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &nsphy_funcs; @@ -140,7 +140,7 @@ nsphyattach(struct device *parent, struct device *self, void *aux) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) aprint_error("no media present"); else diff --git a/sys/dev/mii/nsphyter.c b/sys/dev/mii/nsphyter.c index a3f3611e75e..6593a3aaacb 100644 --- a/sys/dev/mii/nsphyter.c +++ b/sys/dev/mii/nsphyter.c @@ -1,4 +1,4 @@ -/* $NetBSD: nsphyter.c,v 1.30 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: nsphyter.c,v 1.31 2008/05/04 17:06:10 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nsphyter.c,v 1.30 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nsphyter.c,v 1.31 2008/05/04 17:06:10 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -86,10 +86,10 @@ __KERNEL_RCSID(0, "$NetBSD: nsphyter.c,v 1.30 2008/04/28 20:23:53 martin Exp $") #include <dev/mii/nsphyterreg.h> -static int nsphytermatch(struct device *, struct cfdata *, void *); -static void nsphyterattach(struct device *, struct device *, void *); +static int nsphytermatch(device_t, cfdata_t, void *); +static void nsphyterattach(device_t, device_t, void *); -CFATTACH_DECL(nsphyter, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(nsphyter, sizeof(struct mii_softc), nsphytermatch, nsphyterattach, mii_phy_detach, mii_phy_activate); static int nsphyter_service(struct mii_softc *, struct mii_data *, int); @@ -115,8 +115,7 @@ static const struct mii_phydesc nsphyters[] = { }; static int -nsphytermatch(struct device *parent, struct cfdata *match, - void *aux) +nsphytermatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -127,7 +126,7 @@ nsphytermatch(struct device *parent, struct cfdata *match, } static void -nsphyterattach(struct device *parent, struct device *self, void *aux) +nsphyterattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = (struct mii_softc *)self; struct mii_attach_args *ma = aux; @@ -138,6 +137,7 @@ nsphyterattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &nsphyter_funcs; @@ -149,7 +149,7 @@ nsphyterattach(struct device *parent, struct device *self, void *aux) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) aprint_error("no media present"); else diff --git a/sys/dev/mii/pnaphy.c b/sys/dev/mii/pnaphy.c index 65df2940f24..8a85bacd4cd 100644 --- a/sys/dev/mii/pnaphy.c +++ b/sys/dev/mii/pnaphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: pnaphy.c,v 1.18 2008/04/08 20:10:20 cegger Exp $ */ +/* $NetBSD: pnaphy.c,v 1.19 2008/05/04 17:06:10 xtraeme Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -47,7 +47,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pnaphy.c,v 1.18 2008/04/08 20:10:20 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pnaphy.c,v 1.19 2008/05/04 17:06:10 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -63,10 +63,10 @@ __KERNEL_RCSID(0, "$NetBSD: pnaphy.c,v 1.18 2008/04/08 20:10:20 cegger Exp $"); #include <dev/mii/miivar.h> #include <dev/mii/miidevs.h> -static int pnaphymatch(struct device *, struct cfdata *, void *); -static void pnaphyattach(struct device *, struct device *, void *); +static int pnaphymatch(device_t, cfdata_t, void *); +static void pnaphyattach(device_t, device_t, void *); -CFATTACH_DECL(pnaphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(pnaphy, sizeof(struct mii_softc), pnaphymatch, pnaphyattach, mii_phy_detach, mii_phy_activate); static int pnaphy_service(struct mii_softc *, struct mii_data *, int); @@ -85,8 +85,7 @@ static const struct mii_phydesc pnaphys[] = { }; static int -pnaphymatch(struct device *parent, struct cfdata *match, - void *aux) +pnaphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -102,7 +101,7 @@ pnaphymatch(struct device *parent, struct cfdata *match, } static void -pnaphyattach(struct device *parent, struct device *self, void *aux) +pnaphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -113,6 +112,7 @@ pnaphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &pnaphy_funcs; @@ -124,7 +124,7 @@ pnaphyattach(struct device *parent, struct device *self, void *aux) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) aprint_error("no media present"); else diff --git a/sys/dev/mii/qsphy.c b/sys/dev/mii/qsphy.c index abdc558069b..7ad213bb2e8 100644 --- a/sys/dev/mii/qsphy.c +++ b/sys/dev/mii/qsphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: qsphy.c,v 1.44 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: qsphy.c,v 1.45 2008/05/04 17:06:10 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: qsphy.c,v 1.44 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: qsphy.c,v 1.45 2008/05/04 17:06:10 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -82,10 +82,10 @@ __KERNEL_RCSID(0, "$NetBSD: qsphy.c,v 1.44 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/qsphyreg.h> -static int qsphymatch(struct device *, struct cfdata *, void *); -static void qsphyattach(struct device *, struct device *, void *); +static int qsphymatch(device_t, cfdata_t, void *); +static void qsphyattach(device_t, device_t, void *); -CFATTACH_DECL(qsphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(qsphy, sizeof(struct mii_softc), qsphymatch, qsphyattach, mii_phy_detach, mii_phy_activate); static int qsphy_service(struct mii_softc *, struct mii_data *, int); @@ -105,8 +105,7 @@ static const struct mii_phydesc qsphys[] = { }; static int -qsphymatch(struct device *parent, struct cfdata *match, - void *aux) +qsphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -117,7 +116,7 @@ qsphymatch(struct device *parent, struct cfdata *match, } static void -qsphyattach(struct device *parent, struct device *self, void *aux) +qsphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -128,6 +127,7 @@ qsphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &qsphy_funcs; @@ -139,7 +139,7 @@ qsphyattach(struct device *parent, struct device *self, void *aux) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) aprint_error("no media present"); else diff --git a/sys/dev/mii/rgephy.c b/sys/dev/mii/rgephy.c index 770d9638179..a1681b9b7de 100644 --- a/sys/dev/mii/rgephy.c +++ b/sys/dev/mii/rgephy.c @@ -1,4 +1,4 @@ -/* $NetBSD: rgephy.c,v 1.20 2008/04/08 20:10:20 cegger Exp $ */ +/* $NetBSD: rgephy.c,v 1.21 2008/05/04 17:06:10 xtraeme Exp $ */ /* * Copyright (c) 2003 @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.20 2008/04/08 20:10:20 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.21 2008/05/04 17:06:10 xtraeme Exp $"); /* @@ -58,15 +58,15 @@ __KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.20 2008/04/08 20:10:20 cegger Exp $"); #include <dev/ic/rtl81x9reg.h> -static int rgephy_match(struct device *, struct cfdata *, void *); -static void rgephy_attach(struct device *, struct device *, void *); +static int rgephy_match(device_t, cfdata_t, void *); +static void rgephy_attach(device_t, device_t, void *); struct rgephy_softc { struct mii_softc mii_sc; int mii_revision; }; -CFATTACH_DECL(rgephy, sizeof(struct rgephy_softc), +CFATTACH_DECL_NEW(rgephy, sizeof(struct rgephy_softc), rgephy_match, rgephy_attach, mii_phy_detach, mii_phy_activate); @@ -93,7 +93,7 @@ static const struct mii_phydesc rgephys[] = { }; static int -rgephy_match(struct device *parent, struct cfdata *match, void *aux) +rgephy_match(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -104,7 +104,7 @@ rgephy_match(struct device *parent, struct cfdata *match, void *aux) } static void -rgephy_attach(struct device *parent, struct device *self, void *aux) +rgephy_attach(device_t parent, device_t self, void *aux) { struct rgephy_softc *rsc = device_private(self); struct mii_softc *sc = &rsc->mii_sc; @@ -114,8 +114,6 @@ rgephy_attach(struct device *parent, struct device *self, void *aux) int rev; const char *sep = ""; - rsc = device_private(self); - sc = &rsc->mii_sc; ma = aux; mii = ma->mii_data; @@ -126,6 +124,7 @@ rgephy_attach(struct device *parent, struct device *self, void *aux) rsc->mii_revision = rev; + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_pdata = mii; @@ -149,7 +148,7 @@ rgephy_attach(struct device *parent, struct device *self, void *aux) * FreeBSD does not check EXSTAT, but instead adds gigabit * media explicitly. Why? */ - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if (sc->mii_capabilities & BMSR_EXTSTAT) { sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); } diff --git a/sys/dev/mii/rlphy.c b/sys/dev/mii/rlphy.c index 69b095e0202..5f547689106 100644 --- a/sys/dev/mii/rlphy.c +++ b/sys/dev/mii/rlphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: rlphy.c,v 1.21 2008/04/08 20:10:20 cegger Exp $ */ +/* $NetBSD: rlphy.c,v 1.22 2008/05/04 17:06:10 xtraeme Exp $ */ /* $OpenBSD: rlphy.c,v 1.20 2005/07/31 05:27:30 pvalchev Exp $ */ /* @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.21 2008/04/08 20:10:20 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.22 2008/05/04 17:06:10 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -61,10 +61,10 @@ struct rlphy_softc { int sc_rtl8201l; }; -int rlphymatch(struct device *, struct cfdata *, void *); -void rlphyattach(struct device *, struct device *, void *); +int rlphymatch(device_t, cfdata_t, void *); +void rlphyattach(device_t, device_t, void *); -CFATTACH_DECL(rlphy, sizeof(struct rlphy_softc), +CFATTACH_DECL_NEW(rlphy, sizeof(struct rlphy_softc), rlphymatch, rlphyattach, mii_phy_detach, mii_phy_activate); int rlphy_service(struct mii_softc *, struct mii_data *, int); @@ -87,7 +87,7 @@ static const struct mii_phydesc rlphys[] = { }; int -rlphymatch(struct device *parent, struct cfdata *match, void *aux) +rlphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -109,7 +109,7 @@ rlphymatch(struct device *parent, struct cfdata *match, void *aux) } void -rlphyattach(struct device *parent, struct device *self, void *aux) +rlphyattach(device_t parent, device_t self, void *aux) { struct rlphy_softc *rsc = device_private(self); struct mii_softc *sc = &rsc->sc_mii; @@ -124,6 +124,7 @@ rlphyattach(struct device *parent, struct device *self, void *aux) } else aprint_normal(": Realtek internal PHY\n"); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &rlphy_funcs; @@ -134,7 +135,7 @@ rlphyattach(struct device *parent, struct device *self, void *aux) PHY_RESET(sc); - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; if (sc->mii_capabilities & BMSR_MEDIAMASK) diff --git a/sys/dev/mii/sqphy.c b/sys/dev/mii/sqphy.c index 686db4cdc87..055c9a7d9bc 100644 --- a/sys/dev/mii/sqphy.c +++ b/sys/dev/mii/sqphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: sqphy.c,v 1.46 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: sqphy.c,v 1.47 2008/05/04 17:06:10 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sqphy.c,v 1.46 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sqphy.c,v 1.47 2008/05/04 17:06:10 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -83,10 +83,10 @@ __KERNEL_RCSID(0, "$NetBSD: sqphy.c,v 1.46 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/sqphyreg.h> -static int sqphymatch(struct device *, struct cfdata *, void *); -static void sqphyattach(struct device *, struct device *, void *); +static int sqphymatch(device_t, cfdata_t, void *); +static void sqphyattach(device_t, device_t, void *); -CFATTACH_DECL(sqphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(sqphy, sizeof(struct mii_softc), sqphymatch, sqphyattach, mii_phy_detach, mii_phy_activate); static int sqphy_service(struct mii_softc *, struct mii_data *, int); @@ -116,8 +116,7 @@ static const struct mii_phydesc sqphys[] = { }; static int -sqphymatch(struct device *parent, struct cfdata *match, - void *aux) +sqphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -128,7 +127,7 @@ sqphymatch(struct device *parent, struct cfdata *match, } static void -sqphyattach(struct device *parent, struct device *self, void *aux) +sqphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -139,6 +138,7 @@ sqphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_pdata = mii; @@ -148,7 +148,7 @@ sqphyattach(struct device *parent, struct device *self, void *aux) switch (MII_MODEL(ma->mii_id2)) { case MII_MODEL_SEEQ_84220: sc->mii_funcs = &sqphy_84220_funcs; - aprint_normal_dev(&sc->mii_dev, "using Seeq 84220 isolate/reset hack\n"); + aprint_normal_dev(self, "using Seeq 84220 isolate/reset hack\n"); break; default: @@ -159,7 +159,7 @@ sqphyattach(struct device *parent, struct device *self, void *aux) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) aprint_error("no media present"); else diff --git a/sys/dev/mii/tlphy.c b/sys/dev/mii/tlphy.c index fb8e8692489..d87154eb4da 100644 --- a/sys/dev/mii/tlphy.c +++ b/sys/dev/mii/tlphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: tlphy.c,v 1.55 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: tlphy.c,v 1.56 2008/05/04 17:06:10 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tlphy.c,v 1.55 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tlphy.c,v 1.56 2008/05/04 17:06:10 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -96,10 +96,10 @@ struct tlphy_softc { int sc_need_acomp; }; -static int tlphymatch(struct device *, struct cfdata *, void *); -static void tlphyattach(struct device *, struct device *, void *); +static int tlphymatch(device_t, cfdata_t, void *); +static void tlphyattach(device_t, device_t, void *); -CFATTACH_DECL(tlphy, sizeof(struct tlphy_softc), +CFATTACH_DECL_NEW(tlphy, sizeof(struct tlphy_softc), tlphymatch, tlphyattach, mii_phy_detach, mii_phy_activate); static int tlphy_service(struct mii_softc *, struct mii_data *, int); @@ -120,8 +120,7 @@ static const struct mii_phydesc tlphys[] = { }; static int -tlphymatch(struct device *parent, struct cfdata *match, - void *aux) +tlphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -132,7 +131,7 @@ tlphymatch(struct device *parent, struct cfdata *match, } static void -tlphyattach(struct device *parent, struct device *self, void *aux) +tlphyattach(device_t parent, device_t self, void *aux) { struct tlphy_softc *sc = device_private(self); struct tl_softc *tlsc = device_private(device_parent(self)); @@ -145,6 +144,7 @@ tlphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->sc_mii.mii_dev = self; sc->sc_mii.mii_inst = mii->mii_instance; sc->sc_mii.mii_phy = ma->mii_phyno; sc->sc_mii.mii_funcs = &tlphy_funcs; @@ -172,7 +172,7 @@ tlphyattach(struct device *parent, struct device *self, void *aux) #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) #define PRINT(str) aprint_normal("%s%s", sep, str); sep = ", " - aprint_normal_dev(&sc->sc_mii.mii_dev, ""); + aprint_normal_dev(self, ""); if (sc->sc_tlphycap) { if (sc->sc_tlphycap & TLPHY_MEDIA_10_2) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_2, 0, @@ -321,7 +321,7 @@ tlphy_status(struct mii_softc *physc) mii->mii_media_active |= IFM_10_5; else printf("%s: AUI selected with no matching media !\n", - device_xname(&sc->sc_mii.mii_dev)); + device_xname(sc->sc_mii.mii_dev)); mii->mii_media_status |= IFM_ACTIVE; return; } diff --git a/sys/dev/mii/tqphy.c b/sys/dev/mii/tqphy.c index b48641737c0..530fed7e905 100644 --- a/sys/dev/mii/tqphy.c +++ b/sys/dev/mii/tqphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: tqphy.c,v 1.35 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: tqphy.c,v 1.36 2008/05/04 17:06:10 xtraeme Exp $ */ /* * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tqphy.c,v 1.35 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tqphy.c,v 1.36 2008/05/04 17:06:10 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -83,10 +83,10 @@ __KERNEL_RCSID(0, "$NetBSD: tqphy.c,v 1.35 2008/04/28 20:23:53 martin Exp $"); #include <dev/mii/tqphyreg.h> -static int tqphymatch(struct device *, struct cfdata *, void *); -static void tqphyattach(struct device *, struct device *, void *); +static int tqphymatch(device_t, cfdata_t, void *); +static void tqphyattach(device_t, device_t, void *); -CFATTACH_DECL(tqphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(tqphy, sizeof(struct mii_softc), tqphymatch, tqphyattach, mii_phy_detach, mii_phy_activate); static int tqphy_service(struct mii_softc *, struct mii_data *, int); @@ -108,8 +108,7 @@ static const struct mii_phydesc tqphys[] = { }; static int -tqphymatch(struct device *parent, struct cfdata *match, - void *aux) +tqphymatch(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -125,7 +124,7 @@ tqphymatch(struct device *parent, struct cfdata *match, } static void -tqphyattach(struct device *parent, struct device *self, void *aux) +tqphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -136,6 +135,7 @@ tqphyattach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &tqphy_funcs; diff --git a/sys/dev/mii/ukphy.c b/sys/dev/mii/ukphy.c index 0ba707c606e..868ed37ae89 100644 --- a/sys/dev/mii/ukphy.c +++ b/sys/dev/mii/ukphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: ukphy.c,v 1.34 2008/04/28 20:23:53 martin Exp $ */ +/* $NetBSD: ukphy.c,v 1.35 2008/05/04 17:06:10 xtraeme Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ukphy.c,v 1.34 2008/04/28 20:23:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ukphy.c,v 1.35 2008/05/04 17:06:10 xtraeme Exp $"); #include "opt_mii.h" @@ -91,10 +91,10 @@ struct mii_knowndev { #include <dev/mii/miidevs_data.h> #endif -static int ukphymatch(struct device *, struct cfdata *, void *); -static void ukphyattach(struct device *, struct device *, void *); +static int ukphymatch(device_t, cfdata_t, void *); +static void ukphyattach(device_t, device_t, void *); -CFATTACH_DECL(ukphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(ukphy, sizeof(struct mii_softc), ukphymatch, ukphyattach, mii_phy_detach, mii_phy_activate); static int ukphy_service(struct mii_softc *, struct mii_data *, int); @@ -104,8 +104,7 @@ static const struct mii_phy_funcs ukphy_funcs = { }; static int -ukphymatch(struct device *parent, struct cfdata *match, - void *aux) +ukphymatch(device_t parent, cfdata_t match, void *aux) { /* @@ -115,7 +114,7 @@ ukphymatch(struct device *parent, struct cfdata *match, } static void -ukphyattach(struct device *parent, struct device *self, void *aux) +ukphyattach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -135,14 +134,15 @@ ukphyattach(struct device *parent, struct device *self, void *aux) mii_knowndevs[i].model == model) break; if (mii_knowndevs[i].descr != NULL) - aprint_normal_dev(&sc->mii_dev, "%s (OUI 0x%06x, model 0x%04x), rev. %d\n", + aprint_normal_dev(self, "%s (OUI 0x%06x, model 0x%04x), rev. %d\n", mii_knowndevs[i].descr, oui, model, rev); else #endif - aprint_normal_dev(&sc->mii_dev, "OUI 0x%06x, model 0x%04x, rev. %d\n", + aprint_normal_dev(self, "OUI 0x%06x, model 0x%04x, rev. %d\n", oui, model, rev); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &ukphy_funcs; @@ -161,7 +161,7 @@ ukphyattach(struct device *parent, struct device *self, void *aux) PHY_READ(sc, MII_BMSR) & ma->mii_capmask; if (sc->mii_capabilities & BMSR_EXTSTAT) sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0 && (sc->mii_extcapabilities & EXTSR_MEDIAMASK) == 0) aprint_error("no media present"); diff --git a/sys/dev/mii/urlphy.c b/sys/dev/mii/urlphy.c index 3d72d0a095b..3431141f5f4 100644 --- a/sys/dev/mii/urlphy.c +++ b/sys/dev/mii/urlphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: urlphy.c,v 1.22 2008/04/08 20:10:20 cegger Exp $ */ +/* $NetBSD: urlphy.c,v 1.23 2008/05/04 17:06:10 xtraeme Exp $ */ /* * Copyright (c) 2001, 2002 * Shingo WATANABE <nabe@nabechan.org>. All rights reserved. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.22 2008/04/08 20:10:20 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.23 2008/05/04 17:06:10 xtraeme Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -59,10 +59,10 @@ int urlphydebug = URLPHY_DEBUG; #define DPRINTFN(n,x) #endif -static int urlphy_match(struct device *, struct cfdata *, void *); -static void urlphy_attach(struct device *, struct device *, void *); +static int urlphy_match(device_t, cfdata_t, void *); +static void urlphy_attach(device_t, device_t, void *); -CFATTACH_DECL(urlphy, sizeof(struct mii_softc), +CFATTACH_DECL_NEW(urlphy, sizeof(struct mii_softc), urlphy_match, urlphy_attach, mii_phy_detach, mii_phy_activate); static int urlphy_service(struct mii_softc *, struct mii_data *, int); @@ -73,7 +73,7 @@ static const struct mii_phy_funcs urlphy_funcs = { }; static int -urlphy_match(struct device *parent, struct cfdata *match, void *aux) +urlphy_match(device_t parent, cfdata_t match, void *aux) { struct mii_attach_args *ma = aux; @@ -94,7 +94,7 @@ urlphy_match(struct device *parent, struct cfdata *match, void *aux) } static void -urlphy_attach(struct device *parent, struct device *self, void *aux) +urlphy_attach(device_t parent, device_t self, void *aux) { struct mii_softc *sc = device_private(self); struct mii_attach_args *ma = aux; @@ -103,8 +103,9 @@ urlphy_attach(struct device *parent, struct device *self, void *aux) aprint_naive(": Media interface\n"); aprint_normal(": Realtek RTL8150L internal media interface\n"); - DPRINTF(("%s: %s: enter\n", device_xname(&sc->mii_dev), __func__)); + DPRINTF(("%s: %s: enter\n", device_xname(self), __func__)); + sc->mii_dev = self; sc->mii_inst = mii->mii_instance; sc->mii_phy = ma->mii_phyno; sc->mii_funcs = &urlphy_funcs; @@ -118,13 +119,13 @@ urlphy_attach(struct device *parent, struct device *self, void *aux) sc->mii_flags |= MIIF_NOISOLATE; if (mii->mii_instance != 0) { - aprint_error_dev(&sc->mii_dev, "ignoring this PHY, non-zero instance\n"); + aprint_error_dev(self, "ignoring this PHY, non-zero instance\n"); return; } PHY_RESET(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - aprint_normal_dev(&sc->mii_dev, ""); + aprint_normal_dev(self, ""); if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) aprint_error("no media present"); else @@ -141,7 +142,7 @@ urlphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) struct ifmedia_entry *ife = mii->mii_media.ifm_cur; int reg; - DPRINTF(("%s: %s: enter\n", device_xname(&sc->mii_dev), __func__)); + DPRINTF(("%s: %s: enter\n", device_xname(sc->mii_dev), __func__)); switch (cmd) { case MII_POLLSTAT: @@ -227,7 +228,7 @@ urlphy_status(struct mii_softc *sc) struct ifmedia_entry *ife = mii->mii_media.ifm_cur; int msr, bmsr, bmcr; - DPRINTF(("%s: %s: enter\n", device_xname(&sc->mii_dev), __func__)); + DPRINTF(("%s: %s: enter\n", device_xname(sc->mii_dev), __func__)); mii->mii_media_status = IFM_AVALID; mii->mii_media_active = IFM_ETHER; @@ -240,7 +241,7 @@ urlphy_status(struct mii_softc *sc) if (msr & URLPHY_MSR_LINK) mii->mii_media_status |= IFM_ACTIVE; - DPRINTF(("%s: %s: link %s\n", device_xname(&sc->mii_dev), __func__, + DPRINTF(("%s: %s: link %s\n", device_xname(sc->mii_dev), __func__, mii->mii_media_status & IFM_ACTIVE ? "up" : "down")); bmcr = PHY_READ(sc, MII_BMCR); |
