Module Name: src Committed By: macallan Date: Tue Jul 26 08:36:02 UTC 2011
Modified Files: src/sys/arch/macppc/dev: am79c950.c if_mc.c if_mcvar.h ki2c.c ki2cvar.h mediabay.c obio.c smartbat.c Log Message: finish device_t-ification To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/arch/macppc/dev/am79c950.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/macppc/dev/if_mc.c \ src/sys/arch/macppc/dev/mediabay.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/macppc/dev/if_mcvar.h cvs rdiff -u -r1.17 -r1.18 src/sys/arch/macppc/dev/ki2c.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/macppc/dev/ki2cvar.h cvs rdiff -u -r1.33 -r1.34 src/sys/arch/macppc/dev/obio.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/macppc/dev/smartbat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/macppc/dev/am79c950.c diff -u src/sys/arch/macppc/dev/am79c950.c:1.31 src/sys/arch/macppc/dev/am79c950.c:1.32 --- src/sys/arch/macppc/dev/am79c950.c:1.31 Fri Jul 1 18:41:51 2011 +++ src/sys/arch/macppc/dev/am79c950.c Tue Jul 26 08:36:02 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: am79c950.c,v 1.31 2011/07/01 18:41:51 dyoung Exp $ */ +/* $NetBSD: am79c950.c,v 1.32 2011/07/26 08:36:02 macallan Exp $ */ /*- * Copyright (c) 1997 David Huang <k...@bga.com> @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.31 2011/07/01 18:41:51 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.32 2011/07/26 08:36:02 macallan Exp $"); #include "opt_inet.h" @@ -149,7 +149,7 @@ memcpy(sc->sc_enaddr, lladdr, ETHER_ADDR_LEN); printf(": address %s\n", ether_sprintf(lladdr)); - memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ); + memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); ifp->if_softc = sc; ifp->if_ioctl = mcioctl; ifp->if_start = mcstart; @@ -421,7 +421,7 @@ } if (totlen > PAGE_SIZE) - panic("%s: maceput: packet overflow", sc->sc_dev.dv_xname); + panic("%s: maceput: packet overflow", device_xname(sc->sc_dev)); #if 0 if (totlen < ETHERMIN + sizeof(struct ether_header)) { @@ -449,20 +449,20 @@ if (ir & JAB) { #ifdef MCDEBUG - printf("%s: jabber error\n", sc->sc_dev.dv_xname); + printf("%s: jabber error\n", device_xname(sc->sc_dev)); #endif sc->sc_if.if_oerrors++; } if (ir & BABL) { #ifdef MCDEBUG - printf("%s: babble\n", sc->sc_dev.dv_xname); + printf("%s: babble\n", device_xname(sc->sc_dev)); #endif sc->sc_if.if_oerrors++; } if (ir & CERR) { - printf("%s: collision error\n", sc->sc_dev.dv_xname); + printf("%s: collision error\n", device_xname(sc->sc_dev)); sc->sc_if.if_collisions++; } @@ -493,13 +493,13 @@ return; if (xmtfs & UFLO) { - printf("%s: underflow\n", sc->sc_dev.dv_xname); + printf("%s: underflow\n", device_xname(sc->sc_dev)); mcreset(sc); return; } if (xmtfs & LCOL) { - printf("%s: late collision\n", sc->sc_dev.dv_xname); + printf("%s: late collision\n", device_xname(sc->sc_dev)); sc->sc_if.if_oerrors++; sc->sc_if.if_collisions++; } @@ -516,7 +516,7 @@ if (xmtfs & LCAR) { sc->sc_havecarrier = 0; - printf("%s: lost carrier\n", sc->sc_dev.dv_xname); + printf("%s: lost carrier\n", device_xname(sc->sc_dev)); sc->sc_if.if_oerrors++; } @@ -536,12 +536,12 @@ #ifdef MCDEBUG if (rxf.rx_rcvsts & 0xf0) printf("%s: rcvcnt %02x rcvsts %02x rntpc 0x%02x rcvcc 0x%02x\n", - sc->sc_dev.dv_xname, rxf.rx_rcvcnt, rxf.rx_rcvsts, + device_xname(sc->sc_dev), rxf.rx_rcvcnt, rxf.rx_rcvsts, rxf.rx_rntpc, rxf.rx_rcvcc); #endif if (rxf.rx_rcvsts & OFLO) { - printf("%s: receive FIFO overflow\n", sc->sc_dev.dv_xname); + printf("%s: receive FIFO overflow\n", device_xname(sc->sc_dev)); sc->sc_if.if_ierrors++; return; } @@ -551,7 +551,7 @@ if (rxf.rx_rcvsts & FRAM) { #ifdef MCDEBUG - printf("%s: framing error\n", sc->sc_dev.dv_xname); + printf("%s: framing error\n", device_xname(sc->sc_dev)); #endif sc->sc_if.if_ierrors++; return; @@ -559,7 +559,7 @@ if (rxf.rx_rcvsts & FCS) { #ifdef MCDEBUG - printf("%s: frame control checksum error\n", sc->sc_dev.dv_xname); + printf("%s: frame control checksum error\n", device_xname(sc->sc_dev)); #endif sc->sc_if.if_ierrors++; return; @@ -579,7 +579,7 @@ len > ETHERMTU + sizeof(struct ether_header)) { #ifdef MCDEBUG printf("%s: invalid packet size %d; dropping\n", - sc->sc_dev.dv_xname, len); + device_xname(sc->sc_dev), len); #endif ifp->if_ierrors++; return; Index: src/sys/arch/macppc/dev/if_mc.c diff -u src/sys/arch/macppc/dev/if_mc.c:1.21 src/sys/arch/macppc/dev/if_mc.c:1.22 --- src/sys/arch/macppc/dev/if_mc.c:1.21 Fri Jul 1 18:41:52 2011 +++ src/sys/arch/macppc/dev/if_mc.c Tue Jul 26 08:36:02 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mc.c,v 1.21 2011/07/01 18:41:52 dyoung Exp $ */ +/* $NetBSD: if_mc.c,v 1.22 2011/07/26 08:36:02 macallan Exp $ */ /*- * Copyright (c) 1997 David Huang <k...@bga.com> @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.21 2011/07/01 18:41:52 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.22 2011/07/26 08:36:02 macallan Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -79,7 +79,7 @@ #define N_SUPMEDIA (sizeof(mc_supmedia) / sizeof(int)); -CFATTACH_DECL(mc, sizeof(struct mc_softc), +CFATTACH_DECL_NEW(mc, sizeof(struct mc_softc), mc_match, mc_attach, NULL, NULL); hide int @@ -109,6 +109,7 @@ u_int8_t myaddr[ETHER_ADDR_LEN]; u_int *reg; + sc->sc_dev = self; sc->sc_node = ca->ca_node; sc->sc_regt = ca->ca_tag; Index: src/sys/arch/macppc/dev/mediabay.c diff -u src/sys/arch/macppc/dev/mediabay.c:1.21 src/sys/arch/macppc/dev/mediabay.c:1.22 --- src/sys/arch/macppc/dev/mediabay.c:1.21 Thu Jun 30 00:52:57 2011 +++ src/sys/arch/macppc/dev/mediabay.c Tue Jul 26 08:36:02 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: mediabay.c,v 1.21 2011/06/30 00:52:57 matt Exp $ */ +/* $NetBSD: mediabay.c,v 1.22 2011/07/26 08:36:02 macallan Exp $ */ /*- * Copyright (C) 1999 Tsubai Masanari. All rights reserved. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mediabay.c,v 1.21 2011/06/30 00:52:57 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mediabay.c,v 1.22 2011/07/26 08:36:02 macallan Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -46,7 +46,7 @@ }; struct mediabay_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_tag; int sc_node; u_int *sc_addr; @@ -69,7 +69,7 @@ int mediabay_intr(void *); void mediabay_kthread(void *); -CFATTACH_DECL(mediabay, sizeof(struct mediabay_softc), +CFATTACH_DECL_NEW(mediabay, sizeof(struct mediabay_softc), mediabay_match, mediabay_attach, NULL, NULL); #ifdef MEDIABAY_DEBUG @@ -122,6 +122,7 @@ struct confargs *ca = aux; int irq, itype; + sc->sc_dev = self; ca->ca_reg[0] += ca->ca_baseaddr; sc->sc_addr = mapiodev(ca->ca_reg[0], PAGE_SIZE, false); @@ -186,11 +187,11 @@ fcr |= FCR_MEDIABAY_IDE_ENABLE | FCR_MEDIABAY_CD_POWER; out32rb(sc->sc_fcr, fcr); delay(50000); - printf("%s: powering up...\n", sc->sc_dev.dv_xname); + printf("%s: powering up...\n", device_xname(sc->sc_dev)); delay(2000000); } } else { - printf("%s: powering up keylargo-media-bay..", sc->sc_dev.dv_xname); + printf("%s: powering up keylargo-media-bay..", device_xname(sc->sc_dev)); out32rb(sc->sc_addr, in32rb(sc->sc_addr) & ~MBCR_MEDIABAY0_RESET); out32rb(sc->sc_addr, in32rb(sc->sc_addr) & ~MBCR_MEDIABAY0_POWER); @@ -241,7 +242,7 @@ ca.ca_reg = reg; ca.ca_intr = intr; - content = config_found(&sc->sc_dev, &ca, mediabay_print); + content = config_found(sc->sc_dev, &ca, mediabay_print); if (content) { sc->sc_content = content; return; @@ -289,7 +290,7 @@ /* sleep 0.25 sec */ tsleep(mediabay_kthread, PRIBIO, "mbayev", hz/4); - DPRINTF("%s: ", sc->sc_dev.dv_xname); + DPRINTF("%s: ", device_xname(sc->sc_dev)); x = in32rb(sc->sc_addr); switch (MEDIABAY_ID(sc, x)) { @@ -298,7 +299,7 @@ if (sc->sc_content != NULL) { config_detach(sc->sc_content, DETACH_FORCE); DPRINTF("%s: detach done\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); sc->sc_content = NULL; if (sc->sc_type != MB_CONTROLLER_KEYLARGO) { Index: src/sys/arch/macppc/dev/if_mcvar.h diff -u src/sys/arch/macppc/dev/if_mcvar.h:1.12 src/sys/arch/macppc/dev/if_mcvar.h:1.13 --- src/sys/arch/macppc/dev/if_mcvar.h:1.12 Sat Mar 14 14:46:01 2009 +++ src/sys/arch/macppc/dev/if_mcvar.h Tue Jul 26 08:36:02 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mcvar.h,v 1.12 2009/03/14 14:46:01 dsl Exp $ */ +/* $NetBSD: if_mcvar.h,v 1.13 2011/07/26 08:36:02 macallan Exp $ */ /*- * Copyright (c) 1997 David Huang <k...@bga.com> @@ -62,7 +62,7 @@ }; struct mc_softc { - struct device sc_dev; /* base device glue */ + device_t sc_dev; /* base device glue */ struct ethercom sc_ethercom; /* Ethernet common part */ #define sc_if sc_ethercom.ec_if struct ifmedia sc_media; Index: src/sys/arch/macppc/dev/ki2c.c diff -u src/sys/arch/macppc/dev/ki2c.c:1.17 src/sys/arch/macppc/dev/ki2c.c:1.18 --- src/sys/arch/macppc/dev/ki2c.c:1.17 Sat Jun 18 08:08:28 2011 +++ src/sys/arch/macppc/dev/ki2c.c Tue Jul 26 08:36:02 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ki2c.c,v 1.17 2011/06/18 08:08:28 matt Exp $ */ +/* $NetBSD: ki2c.c,v 1.18 2011/07/26 08:36:02 macallan Exp $ */ /* Id: ki2c.c,v 1.7 2002/10/05 09:56:05 tsubai Exp */ /*- @@ -59,7 +59,7 @@ void *, size_t, int); -CFATTACH_DECL(ki2c, sizeof(struct ki2c_softc), ki2c_match, ki2c_attach, +CFATTACH_DECL_NEW(ki2c, sizeof(struct ki2c_softc), ki2c_match, ki2c_attach, NULL, NULL); int @@ -85,7 +85,8 @@ char name[32]; u_int reg[20]; - + + sc->sc_dev = self; ca->ca_reg[0] += ca->ca_baseaddr; if (OF_getprop(node, "AAPL,i2c-rate", &rate, 4) != 4) { @@ -125,7 +126,7 @@ sc->sc_i2c.ic_exec = ki2c_i2c_exec; iba.iba_tag = &sc->sc_i2c; - (void) config_found_ia(&sc->sc_dev, "i2cbus", &iba, iicbus_print); + (void) config_found_ia(sc->sc_dev, "i2cbus", &iba, iicbus_print); /* * newer OF puts I2C devices under 'i2c-bus' instead of attaching them @@ -167,7 +168,7 @@ #ifdef DIAGNOSTIC else { printf("%s: device (%s) has no reg or i2c-address property.\n", - sc->sc_dev.dv_xname, name); + device_xname(sc->sc_dev), name); } #endif } Index: src/sys/arch/macppc/dev/ki2cvar.h diff -u src/sys/arch/macppc/dev/ki2cvar.h:1.3 src/sys/arch/macppc/dev/ki2cvar.h:1.4 --- src/sys/arch/macppc/dev/ki2cvar.h:1.3 Fri Dec 7 16:01:19 2007 +++ src/sys/arch/macppc/dev/ki2cvar.h Tue Jul 26 08:36:02 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ki2cvar.h,v 1.3 2007/12/07 16:01:19 macallan Exp $ */ +/* $NetBSD: ki2cvar.h,v 1.4 2011/07/26 08:36:02 macallan Exp $ */ /* Id: ki2c.c,v 1.7 2002/10/05 09:56:05 tsubai Exp */ /*- @@ -83,7 +83,7 @@ #define I2C_ERROR 0x04 struct ki2c_softc { - struct device sc_dev; + device_t sc_dev; u_char *sc_reg; int sc_regstep; Index: src/sys/arch/macppc/dev/obio.c diff -u src/sys/arch/macppc/dev/obio.c:1.33 src/sys/arch/macppc/dev/obio.c:1.34 --- src/sys/arch/macppc/dev/obio.c:1.33 Sat Jun 18 08:08:28 2011 +++ src/sys/arch/macppc/dev/obio.c Tue Jul 26 08:36:02 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: obio.c,v 1.33 2011/06/18 08:08:28 matt Exp $ */ +/* $NetBSD: obio.c,v 1.34 2011/07/26 08:36:02 macallan Exp $ */ /*- * Copyright (C) 1998 Internet Research Institute, Inc. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.33 2011/06/18 08:08:28 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.34 2011/07/26 08:36:02 macallan Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -64,7 +64,7 @@ static int obio_print(void *, const char *); struct obio_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_tag; bus_space_handle_t sc_bh; int sc_node; @@ -91,7 +91,7 @@ #endif -CFATTACH_DECL(obio, sizeof(struct obio_softc), +CFATTACH_DECL_NEW(obio, sizeof(struct obio_softc), obio_match, obio_attach, NULL, NULL); int @@ -131,6 +131,7 @@ char name[32]; char compat[32]; + sc->sc_dev = self; #ifdef OBIO_SPEED_CONTROL sc->sc_voltage = -1; sc->sc_busspeed = -1; @@ -387,7 +388,7 @@ return; printf("%s: enabling Intrepid CPU speed control\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); sc->sc_spd_lo = curcpu()->ci_khz / 1000; hiclock = 0; Index: src/sys/arch/macppc/dev/smartbat.c diff -u src/sys/arch/macppc/dev/smartbat.c:1.7 src/sys/arch/macppc/dev/smartbat.c:1.8 --- src/sys/arch/macppc/dev/smartbat.c:1.7 Sun Jul 10 14:41:34 2011 +++ src/sys/arch/macppc/dev/smartbat.c Tue Jul 26 08:36:02 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: smartbat.c,v 1.7 2011/07/10 14:41:34 pgoyette Exp $ */ +/* $NetBSD: smartbat.c,v 1.8 2011/07/26 08:36:02 macallan Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: smartbat.c,v 1.7 2011/07/10 14:41:34 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: smartbat.c,v 1.8 2011/07/26 08:36:02 macallan Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -61,7 +61,7 @@ #define BAT_NSENSORS 8 /* number of sensors */ struct smartbat_softc { - struct device sc_dev; + device_t sc_dev; struct pmu_ops *sc_pmu_ops; int sc_num; @@ -88,7 +88,7 @@ static void smartbat_poll(void *); static int smartbat_update(struct smartbat_softc *, int); -CFATTACH_DECL(smartbat, sizeof(struct smartbat_softc), +CFATTACH_DECL_NEW(smartbat, sizeof(struct smartbat_softc), smartbat_match, smartbat_attach, NULL, NULL); static int @@ -108,6 +108,7 @@ struct battery_attach_args *baa = aux; struct smartbat_softc *sc = device_private(self); + sc->sc_dev = self; sc->sc_pmu_ops = baa->baa_pmu_ops; sc->sc_num = baa->baa_num; @@ -126,7 +127,7 @@ sc->sc_sm_acpower.smpsw_type = PSWITCH_TYPE_ACADAPTER; if (sysmon_pswitch_register(&sc->sc_sm_acpower) != 0) printf("%s: unable to register AC power status with sysmon\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); } #define INITDATA(index, unit, string) \ @@ -160,13 +161,13 @@ } } - sc->sc_sme->sme_name = sc->sc_dev.dv_xname; + sc->sc_sme->sme_name = device_xname(sc->sc_dev); sc->sc_sme->sme_cookie = sc; sc->sc_sme->sme_refresh = smartbat_refresh; if (sysmon_envsys_register(sc->sc_sme)) { aprint_error("%s: unable to register with sysmon\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); sysmon_envsys_destroy(sc->sc_sme); } } @@ -254,7 +255,7 @@ 16, buf); if (len < 0) { - DPRINTF("%s: couldn't get battery data\n", sc->sc_dev.dv_xname); + DPRINTF("%s: couldn't get battery data\n", device_xname(sc->sc_dev)); /* XXX: the return value is never checked */ return -1; } @@ -295,7 +296,7 @@ break; default: /* XXX - Error condition */ - DPRINTF("%s: why is buf[1] %x?\n", sc->sc_dev.dv_xname, buf[1]); + DPRINTF("%s: why is buf[1] %x?\n", device_xname(sc->sc_dev), buf[1]); sc->sc_charge = 0; sc->sc_max_charge = 0; sc->sc_draw = 0;