Module Name: src Committed By: mrg Date: Mon Jul 18 00:31:13 UTC 2011
Modified Files: src/sys/arch/sparc/dev: bootbus.c cgsix_obio.c ebus.c rtc.c tctrl.c vme_machdep.c Log Message: convert the remaining sparc drivers to CFATTACH_DECL_NEW/cfdata_t/device_t. (cgsix_obio.c was only partially converted with the rest of the cgsix code when it was changed some time ago.) To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sparc/dev/bootbus.c cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sparc/dev/cgsix_obio.c cvs rdiff -u -r1.32 -r1.33 src/sys/arch/sparc/dev/ebus.c cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc/dev/rtc.c cvs rdiff -u -r1.52 -r1.53 src/sys/arch/sparc/dev/tctrl.c cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sparc/dev/vme_machdep.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/sparc/dev/bootbus.c diff -u src/sys/arch/sparc/dev/bootbus.c:1.18 src/sys/arch/sparc/dev/bootbus.c:1.19 --- src/sys/arch/sparc/dev/bootbus.c:1.18 Fri Jul 1 18:50:41 2011 +++ src/sys/arch/sparc/dev/bootbus.c Mon Jul 18 00:31:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: bootbus.c,v 1.18 2011/07/01 18:50:41 dyoung Exp $ */ +/* $NetBSD: bootbus.c,v 1.19 2011/07/18 00:31:13 mrg Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.18 2011/07/01 18:50:41 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bootbus.c,v 1.19 2011/07/18 00:31:13 mrg Exp $"); #include <sys/param.h> #include <sys/malloc.h> @@ -50,7 +50,6 @@ #include "locators.h" struct bootbus_softc { - struct device sc_dev; int sc_node; /* our OBP node */ bus_space_tag_t sc_st; /* ours */ @@ -60,11 +59,10 @@ static int bootbus_match(device_t, cfdata_t, void *); static void bootbus_attach(device_t, device_t, void *); -CFATTACH_DECL(bootbus, sizeof(struct bootbus_softc), +CFATTACH_DECL_NEW(bootbus, sizeof(struct bootbus_softc), bootbus_match, bootbus_attach, NULL, NULL); -static int bootbus_submatch(struct device *, struct cfdata *, - const int *, void *); +static int bootbus_submatch(device_t, cfdata_t, const int *, void *); static int bootbus_print(void *, const char *); static int bootbus_setup_attach_args(struct bootbus_softc *, bus_space_tag_t, Index: src/sys/arch/sparc/dev/cgsix_obio.c diff -u src/sys/arch/sparc/dev/cgsix_obio.c:1.24 src/sys/arch/sparc/dev/cgsix_obio.c:1.25 --- src/sys/arch/sparc/dev/cgsix_obio.c:1.24 Fri Jul 1 18:50:41 2011 +++ src/sys/arch/sparc/dev/cgsix_obio.c Mon Jul 18 00:31:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cgsix_obio.c,v 1.24 2011/07/01 18:50:41 dyoung Exp $ */ +/* $NetBSD: cgsix_obio.c,v 1.25 2011/07/18 00:31:13 mrg Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cgsix_obio.c,v 1.24 2011/07/01 18:50:41 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cgsix_obio.c,v 1.25 2011/07/18 00:31:13 mrg Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -68,7 +68,7 @@ static void cgsixattach(device_t, device_t, void *); static int cg6_pfour_probe(void *, void *); -CFATTACH_DECL(cgsix_obio, sizeof(struct cgsix_softc), +CFATTACH_DECL_NEW(cgsix_obio, sizeof(struct cgsix_softc), cgsixmatch, cgsixattach, NULL, NULL); /* Index: src/sys/arch/sparc/dev/ebus.c diff -u src/sys/arch/sparc/dev/ebus.c:1.32 src/sys/arch/sparc/dev/ebus.c:1.33 --- src/sys/arch/sparc/dev/ebus.c:1.32 Fri Jul 1 18:50:41 2011 +++ src/sys/arch/sparc/dev/ebus.c Mon Jul 18 00:31:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ebus.c,v 1.32 2011/07/01 18:50:41 dyoung Exp $ */ +/* $NetBSD: ebus.c,v 1.33 2011/07/18 00:31:13 mrg Exp $ */ /* * Copyright (c) 1999, 2000 Matthew R. Green @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.32 2011/07/01 18:50:41 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.33 2011/07/18 00:31:13 mrg Exp $"); #if defined(DEBUG) && !defined(EBUS_DEBUG) #define EBUS_DEBUG @@ -82,7 +82,7 @@ #endif struct ebus_softc { - struct device sc_dev; + device_t sc_dev; device_t sc_parent; /* PCI bus */ int sc_node; /* PROM node */ @@ -100,7 +100,7 @@ static int ebus_match(device_t, cfdata_t, void *); static void ebus_attach(device_t, device_t, void *); -CFATTACH_DECL(ebus, sizeof(struct ebus_softc), +CFATTACH_DECL_NEW(ebus, sizeof(struct ebus_softc), ebus_match, ebus_attach, NULL, NULL); static int ebus_setup_attach_args(struct ebus_softc *, bus_space_tag_t, @@ -212,7 +212,7 @@ if (wiring_map != NULL) { printf("%s: global ebus wiring map already initalized\n", - device_xname(&sc->sc_dev)); + device_xname(sc->sc_dev)); return (0); } @@ -250,6 +250,8 @@ int node, error; char devinfo[256]; + sc->sc_dev = self; + #ifdef BLINK callout_init(&ebus_blink_ch, 0); #endif Index: src/sys/arch/sparc/dev/rtc.c diff -u src/sys/arch/sparc/dev/rtc.c:1.17 src/sys/arch/sparc/dev/rtc.c:1.18 --- src/sys/arch/sparc/dev/rtc.c:1.17 Fri Jul 1 18:50:41 2011 +++ src/sys/arch/sparc/dev/rtc.c Mon Jul 18 00:31:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: rtc.c,v 1.17 2011/07/01 18:50:41 dyoung Exp $ */ +/* $NetBSD: rtc.c,v 1.18 2011/07/18 00:31:13 mrg Exp $ */ /* * Copyright (c) 2001 Valeriy E. Ushakov @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.17 2011/07/01 18:50:41 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.18 2011/07/18 00:31:13 mrg Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -55,8 +55,6 @@ #include <dev/ebus/ebusvar.h> struct rtc_ebus_softc { - struct device sc_dev; - bus_space_tag_t sc_bt; /* parent bus tag */ bus_space_handle_t sc_bh; /* handle for registers */ }; @@ -64,7 +62,7 @@ static int rtcmatch_ebus(device_t, cfdata_t, void *); static void rtcattach_ebus(device_t, device_t, void *); -CFATTACH_DECL(rtc_ebus, sizeof(struct rtc_ebus_softc), +CFATTACH_DECL_NEW(rtc_ebus, sizeof(struct rtc_ebus_softc), rtcmatch_ebus, rtcattach_ebus, NULL, NULL); /* XXX: global TOD clock handle (sparc/clock.c) */ Index: src/sys/arch/sparc/dev/tctrl.c diff -u src/sys/arch/sparc/dev/tctrl.c:1.52 src/sys/arch/sparc/dev/tctrl.c:1.53 --- src/sys/arch/sparc/dev/tctrl.c:1.52 Fri Jul 1 18:50:41 2011 +++ src/sys/arch/sparc/dev/tctrl.c Mon Jul 18 00:31:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: tctrl.c,v 1.52 2011/07/01 18:50:41 dyoung Exp $ */ +/* $NetBSD: tctrl.c,v 1.53 2011/07/18 00:31:13 mrg Exp $ */ /*- * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.52 2011/07/01 18:50:41 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.53 2011/07/18 00:31:13 mrg Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -107,7 +107,7 @@ }; struct tctrl_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_memt; bus_space_handle_t sc_memh; unsigned int sc_junk; @@ -170,8 +170,8 @@ #define TCTRL_STD_DEV 0 #define TCTRL_APMCTL_DEV 8 -static int tctrl_match(struct device *, struct cfdata *, void *); -static void tctrl_attach(struct device *, struct device *, void *); +static int tctrl_match(device_t, cfdata_t, void *); +static void tctrl_attach(device_t, device_t, void *); static void tctrl_write(struct tctrl_softc *, bus_size_t, uint8_t); static uint8_t tctrl_read(struct tctrl_softc *, bus_size_t); static void tctrl_write_data(struct tctrl_softc *, uint8_t); @@ -199,7 +199,7 @@ static void tctrl_lock(struct tctrl_softc *); static void tctrl_unlock(struct tctrl_softc *); -CFATTACH_DECL(tctrl, sizeof(struct tctrl_softc), +CFATTACH_DECL_NEW(tctrl, sizeof(struct tctrl_softc), tctrl_match, tctrl_attach, NULL, NULL); static int tadpole_request(struct tctrl_req *, int, int); @@ -208,7 +208,7 @@ int tctrl_apm_evindex; static int -tctrl_match(struct device *parent, struct cfdata *cf, void *aux) +tctrl_match(device_t parent, cfdata_t cf, void *aux) { union obio_attach_args *uoba = aux; struct sbus_attach_args *sa = &uoba->uoba_sbus; @@ -225,7 +225,7 @@ } static void -tctrl_attach(struct device *parent, struct device *self, void *aux) +tctrl_attach(device_t parent, device_t self, void *aux) { struct tctrl_softc *sc = device_private(self); union obio_attach_args *uoba = aux; @@ -235,6 +235,7 @@ /* We're living on a sbus slot that looks like an obio that * looks like an sbus slot. */ + sc->sc_dev = self; sc->sc_memt = sa->sa_bustag; if (sbus_bus_map(sc->sc_memt, sa->sa_slot, @@ -264,7 +265,7 @@ (void)bus_intr_establish(sc->sc_memt, sa->sa_pri, IPL_NONE, tctrl_intr, sc); evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL, - sc->sc_dev.dv_xname, "intr"); + device_xname(sc->sc_dev), "intr"); } /* See what the external status is */ @@ -273,7 +274,7 @@ if (sc->sc_ext_status != 0) { const char *sep; - printf("%s: ", sc->sc_dev.dv_xname); + printf("%s: ", device_xname(sc->sc_dev)); v = sc->sc_ext_status; for (i = 0, sep = ""; v != 0; i++, v >>= 1) { if (v & 1) { @@ -321,9 +322,9 @@ sc->sc_events = 0; if (kthread_create(PRI_NONE, 0, NULL, tctrl_event_thread, sc, - &sc->sc_thread, "%s", sc->sc_dev.dv_xname) != 0) { + &sc->sc_thread, "%s", device_xname(sc->sc_dev)) != 0) { printf("%s: unable to create event kthread", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); } } @@ -369,13 +370,13 @@ sc->sc_ext_pending = 1; } else { printf("%s: (op=0x%02x): unexpected data (0x%02x)\n", - sc->sc_dev.dv_xname, sc->sc_op, d); + device_xname(sc->sc_dev), sc->sc_op, d); } goto again; case TCTRL_ACK: if (d != 0xfe) { printf("%s: (op=0x%02x): unexpected ack value (0x%02x)\n", - sc->sc_dev.dv_xname, sc->sc_op, d); + device_xname(sc->sc_dev), sc->sc_op, d); } #ifdef TCTRLDEBUG printf(" ack=0x%02x", d); @@ -407,7 +408,7 @@ goto again; default: printf("%s: (op=0x%02x): unexpected data (0x%02x) in state %d\n", - sc->sc_dev.dv_xname, sc->sc_op, d, sc->sc_state); + device_xname(sc->sc_dev), sc->sc_op, d, sc->sc_state); goto again; } } @@ -429,7 +430,7 @@ tctrl_write_data(sc, sc->sc_cmdbuf[sc->sc_cmdoff++]); #ifdef TCTRLDEBUG if (sc->sc_cmdoff == 1) { - printf("%s: op=0x%02x(l=%u)", sc->sc_dev.dv_xname, + printf("%s: op=0x%02x(l=%u)", device_xname(sc->sc_dev), sc->sc_cmdbuf[0], sc->sc_rsplen); } else { printf(" [%d]=0x%02x", sc->sc_cmdoff-1, @@ -759,24 +760,24 @@ printf("event: %x\n",v); #endif if (v & TS102_EVENT_STATUS_POWERON_BTN_PRESSED) { - printf("%s: Power button pressed\n",sc->sc_dev.dv_xname); + printf("%s: Power button pressed\n",device_xname(sc->sc_dev)); tctrl_powerfail(sc); } if (v & TS102_EVENT_STATUS_SHUTDOWN_REQUEST) { - printf("%s: SHUTDOWN REQUEST!\n", sc->sc_dev.dv_xname); + printf("%s: SHUTDOWN REQUEST!\n", device_xname(sc->sc_dev)); tctrl_powerfail(sc); } if (v & TS102_EVENT_STATUS_VERY_LOW_POWER_WARNING) { -/*printf("%s: VERY LOW POWER WARNING!\n", sc->sc_dev.dv_xname);*/ +/*printf("%s: VERY LOW POWER WARNING!\n", device_xname(sc->sc_dev));*/ /* according to a tadpole header, and observation */ #ifdef TCTRLDEBUG printf("%s: Battery charge level change\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); #endif } if (v & TS102_EVENT_STATUS_LOW_POWER_WARNING) { if (tctrl_apm_record_event(sc, APM_BATTERY_LOW)) - printf("%s: LOW POWER WARNING!\n", sc->sc_dev.dv_xname); + printf("%s: LOW POWER WARNING!\n", device_xname(sc->sc_dev)); } if (v & TS102_EVENT_STATUS_DC_STATUS_CHANGE) { splx(s); @@ -784,7 +785,7 @@ tctrl_ac_state(sc); s = splts102(); if (tctrl_apm_record_event(sc, APM_POWER_CHANGE)) - printf("%s: main power %s\n", sc->sc_dev.dv_xname, + printf("%s: main power %s\n", device_xname(sc->sc_dev), (sc->sc_ext_status & TS102_EXT_STATUS_MAIN_POWER_AVAILABLE) ? "restored" : "removed"); @@ -795,7 +796,7 @@ tctrl_lid_state(sc); tctrl_setup_bitport(); #ifdef TCTRLDEBUG - printf("%s: lid %s\n", sc->sc_dev.dv_xname, + printf("%s: lid %s\n", device_xname(sc->sc_dev), (sc->sc_ext_status & TS102_EXT_STATUS_LID_DOWN) ? "closed" : "opened"); #endif @@ -1283,13 +1284,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 = tctrl_refresh; if ((error = sysmon_envsys_register(sc->sc_sme)) != 0) { printf("%s: couldn't register sensors (%d)\n", - sc->sc_dev.dv_xname, error); + device_xname(sc->sc_dev), error); sysmon_envsys_destroy(sc->sc_sme); return; } @@ -1300,25 +1301,25 @@ sc->sc_powerpressed = 0; memset(&sc->sc_sm_pbutton, 0, sizeof(struct sysmon_pswitch)); - sc->sc_sm_pbutton.smpsw_name = sc->sc_dev.dv_xname; + sc->sc_sm_pbutton.smpsw_name = device_xname(sc->sc_dev); sc->sc_sm_pbutton.smpsw_type = PSWITCH_TYPE_POWER; if (sysmon_pswitch_register(&sc->sc_sm_pbutton) != 0) printf("%s: unable to register power button with sysmon\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); memset(&sc->sc_sm_lid, 0, sizeof(struct sysmon_pswitch)); - sc->sc_sm_lid.smpsw_name = sc->sc_dev.dv_xname; + sc->sc_sm_lid.smpsw_name = device_xname(sc->sc_dev); sc->sc_sm_lid.smpsw_type = PSWITCH_TYPE_LID; if (sysmon_pswitch_register(&sc->sc_sm_lid) != 0) printf("%s: unable to register lid switch with sysmon\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); memset(&sc->sc_sm_ac, 0, sizeof(struct sysmon_pswitch)); - sc->sc_sm_ac.smpsw_name = sc->sc_dev.dv_xname; + sc->sc_sm_ac.smpsw_name = device_xname(sc->sc_dev); sc->sc_sm_ac.smpsw_type = PSWITCH_TYPE_ACADAPTER; if (sysmon_pswitch_register(&sc->sc_sm_ac) != 0) printf("%s: unable to register AC adaptor with sysmon\n", - sc->sc_dev.dv_xname); + device_xname(sc->sc_dev)); } static void Index: src/sys/arch/sparc/dev/vme_machdep.c diff -u src/sys/arch/sparc/dev/vme_machdep.c:1.64 src/sys/arch/sparc/dev/vme_machdep.c:1.65 --- src/sys/arch/sparc/dev/vme_machdep.c:1.64 Fri Jul 1 18:50:42 2011 +++ src/sys/arch/sparc/dev/vme_machdep.c Mon Jul 18 00:31:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vme_machdep.c,v 1.64 2011/07/01 18:50:42 dyoung Exp $ */ +/* $NetBSD: vme_machdep.c,v 1.65 2011/07/18 00:31:13 mrg Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.64 2011/07/01 18:50:42 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.65 2011/07/18 00:31:13 mrg Exp $"); #include <sys/param.h> #include <sys/extent.h> @@ -62,7 +62,6 @@ #include <sparc/dev/vmereg.h> struct sparcvme_softc { - struct device sc_dev; /* base device */ bus_space_tag_t sc_bustag; bus_dma_tag_t sc_dmatag; struct vmebusreg *sc_reg; /* VME control registers */ @@ -161,10 +160,10 @@ int sparc_vme_mmap_cookie(vme_addr_t, vme_am_t, bus_space_handle_t *); -CFATTACH_DECL(vme_mainbus, sizeof(struct sparcvme_softc), +CFATTACH_DECL_NEW(vme_mainbus, sizeof(struct sparcvme_softc), vmematch_mainbus, vmeattach_mainbus, NULL, NULL); -CFATTACH_DECL(vme_iommu, sizeof(struct sparcvme_softc), +CFATTACH_DECL_NEW(vme_iommu, sizeof(struct sparcvme_softc), vmematch_iommu, vmeattach_iommu, NULL, NULL); static int vme_attached;