From 51a2be5067a138a00a7a8e38709ecf5718f9f3a5 Mon Sep 17 00:00:00 2001 From: matt Date: Sat, 18 Jun 2011 06:44:25 +0000 Subject: [PATCH] split device/softc (CFATTACH_DECL_NEW) struct device * -> device_t struct cfdata * -> cfdata_t Use instead of if exists Explicitly include when needed. --- sys/arch/evbppc/ev64260/autoconf.c | 15 +- sys/arch/evbppc/explora/autoconf.c | 11 +- sys/arch/evbppc/explora/dev/fb_elb.c | 22 +-- sys/arch/evbppc/explora/machdep.c | 9 +- sys/arch/evbppc/include/cpu.h | 11 +- sys/arch/evbppc/include/obs405.h | 4 +- sys/arch/evbppc/obs405/dev/century_bios.c | 8 +- sys/arch/evbppc/obs405/dev/obsled.c | 23 ++-- sys/arch/evbppc/obs405/obs200_autoconf.c | 7 +- sys/arch/evbppc/obs405/obs200_machdep.c | 11 +- sys/arch/evbppc/obs405/obs266_autoconf.c | 12 +- sys/arch/evbppc/obs405/obs266_machdep.c | 13 +- sys/arch/evbppc/obs405/obs405_autoconf.c | 12 +- sys/arch/evbppc/obs405/obs405_machdep.c | 10 +- sys/arch/evbppc/obs405/obs600_autoconf.c | 10 +- sys/arch/evbppc/obs405/obs600_machdep.c | 12 +- sys/arch/evbppc/obs405/rbus_machdep.c | 7 +- sys/arch/evbppc/pmppc/autoconf.c | 6 +- sys/arch/evbppc/pmppc/dev/cpc_mainbus.c | 6 +- sys/arch/evbppc/pmppc/dev/flash.c | 24 ++-- sys/arch/evbppc/pmppc/dev/if_cs_mainbus.c | 8 +- sys/arch/evbppc/virtex/autoconf.c | 12 +- sys/arch/evbppc/virtex/design_gsrd1.c | 14 +- sys/arch/evbppc/virtex/design_gsrd2.c | 13 +- sys/arch/evbppc/virtex/dev/if_temac.c | 159 +++++++++++----------- sys/arch/evbppc/virtex/dev/pstwo.c | 22 +-- sys/arch/evbppc/virtex/dev/tft_ll.c | 43 +++--- sys/arch/evbppc/virtex/dev/tft_plb.c | 32 ++--- sys/arch/evbppc/virtex/dev/tftvar.h | 6 +- sys/arch/evbppc/virtex/dev/xlcom.c | 36 ++--- sys/arch/evbppc/virtex/machdep.c | 8 +- sys/arch/evbppc/walnut/autoconf.c | 15 +- sys/arch/evbppc/walnut/machdep.c | 8 +- sys/arch/evbppc/walnut/pci/pchb.c | 8 +- 34 files changed, 312 insertions(+), 305 deletions(-) diff --git a/sys/arch/evbppc/ev64260/autoconf.c b/sys/arch/evbppc/ev64260/autoconf.c index e4187683765f..dae9422bafd3 100644 --- a/sys/arch/evbppc/ev64260/autoconf.c +++ b/sys/arch/evbppc/ev64260/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.14 2010/06/02 06:44:33 kiyohara Exp $ */ +/* $NetBSD: autoconf.c,v 1.15 2011/06/18 06:44:25 matt Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -44,13 +44,13 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.14 2010/06/02 06:44:33 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.15 2011/06/18 06:44:25 matt Exp $"); #include #include +#include #include #include -#include #include #include @@ -77,11 +77,6 @@ cpu_configure(void) if (config_rootfound("mainbus", NULL) == NULL) panic("configure: mainbus not configured"); - aprint_normal("biomask %jx netmask %jx ttymask %jx\n", - imask[IPL_BIO] & 0x3fffffffffffffff, - imask[IPL_NET] & 0x3fffffffffffffff, - imask[IPL_TTY] & 0x3fffffffffffffff); - spl0(); } @@ -91,7 +86,7 @@ cpu_rootconf(void) findroot(); printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); setroot(booted_device, booted_partition); } @@ -128,7 +123,7 @@ findroot(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { prop_dictionary_t dict = device_properties(dev); diff --git a/sys/arch/evbppc/explora/autoconf.c b/sys/arch/evbppc/explora/autoconf.c index 1d0e8e870b28..0c7028c888d7 100644 --- a/sys/arch/evbppc/explora/autoconf.c +++ b/sys/arch/evbppc/explora/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.10 2008/04/28 20:23:17 martin Exp $ */ +/* $NetBSD: autoconf.c,v 1.11 2011/06/18 06:44:25 matt Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -30,12 +30,15 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.10 2008/04/28 20:23:17 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.11 2011/06/18 06:44:25 matt Exp $"); #include #include -#include +#include #include +#include + +#include void cpu_configure(void) @@ -63,6 +66,6 @@ cpu_rootconf(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { } diff --git a/sys/arch/evbppc/explora/dev/fb_elb.c b/sys/arch/evbppc/explora/dev/fb_elb.c index dff1f25d098c..7c7bf59d0122 100644 --- a/sys/arch/evbppc/explora/dev/fb_elb.c +++ b/sys/arch/evbppc/explora/dev/fb_elb.c @@ -1,4 +1,4 @@ -/* $NetBSD: fb_elb.c,v 1.11 2010/05/15 08:53:26 tsutsui Exp $ */ +/* $NetBSD: fb_elb.c,v 1.12 2011/06/18 06:44:25 matt Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fb_elb.c,v 1.11 2010/05/15 08:53:26 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fb_elb.c,v 1.12 2011/06/18 06:44:25 matt Exp $"); #include #include @@ -58,13 +58,13 @@ struct fb_dev { }; struct fb_elb_softc { - struct device sc_dev; + device_t sc_dev; struct fb_dev *sc_fb; int sc_nscreens; }; -static int fb_elb_probe(struct device *, struct cfdata *, void *); -static void fb_elb_attach(struct device *, struct device *, void *); +static int fb_elb_probe(device_t, cfdata_t, void *); +static void fb_elb_attach(device_t, device_t, void *); void fb_cnattach(bus_space_tag_t, bus_addr_t, void *); static void fb_init(struct fb_dev *, int); static int fb_ioctl(void *, void *, u_long, void *, int, struct lwp *); @@ -108,14 +108,14 @@ static const struct wsscreen_descr *scrlist[] = { }; static struct wsscreen_list screenlist = { - sizeof(scrlist)/sizeof(scrlist[0]), scrlist + __arraycount(scrlist), scrlist }; -CFATTACH_DECL(fb_elb, sizeof(struct fb_elb_softc), +CFATTACH_DECL_NEW(fb_elb, sizeof(struct fb_elb_softc), fb_elb_probe, fb_elb_attach, NULL, NULL); static int -fb_elb_probe(struct device *parent, struct cfdata *cf, void *aux) +fb_elb_probe(device_t parent, cfdata_t cf, void *aux) { struct elb_attach_args *oaa = aux; @@ -126,15 +126,17 @@ fb_elb_probe(struct device *parent, struct cfdata *cf, void *aux) } static void -fb_elb_attach(struct device *parent, struct device *self, void *aux) +fb_elb_attach(device_t parent, device_t self, void *aux) { - struct fb_elb_softc *sc = (void *)self; + struct fb_elb_softc *sc = device_private(self); struct elb_attach_args *eaa = aux; struct wsemuldisplaydev_attach_args waa; struct rasops_info *ri; bus_space_handle_t ioh; int is_console; + sc->sc_dev = self; + is_console = ((void *)eaa->elb_base == console_dev.fb_vram); if (is_console) { diff --git a/sys/arch/evbppc/explora/machdep.c b/sys/arch/evbppc/explora/machdep.c index 81d9f1b6600b..00b15d613abe 100644 --- a/sys/arch/evbppc/explora/machdep.c +++ b/sys/arch/evbppc/explora/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.34 2011/06/15 05:50:48 matt Exp $ */ +/* $NetBSD: machdep.c,v 1.35 2011/06/18 06:44:25 matt Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.34 2011/06/15 05:50:48 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.35 2011/06/18 06:44:25 matt Exp $"); #include "opt_explora.h" #include "opt_modular.h" @@ -47,13 +47,14 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.34 2011/06/15 05:50:48 matt Exp $"); #include #include #include +#include +#include #include #include #include -#include #include #include #include @@ -61,6 +62,8 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.34 2011/06/15 05:50:48 matt Exp $"); #include #include + +#include #include #if NKSYMS || defined(DDB) || defined(MODULAR) diff --git a/sys/arch/evbppc/include/cpu.h b/sys/arch/evbppc/include/cpu.h index 07a8fd2516a6..5636b7831e2b 100644 --- a/sys/arch/evbppc/include/cpu.h +++ b/sys/arch/evbppc/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.5 2011/06/12 03:42:41 mrg Exp $ */ +/* $NetBSD: cpu.h,v 1.6 2011/06/18 06:44:26 matt Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -43,21 +43,22 @@ #include "opt_multiprocessor.h" #endif -#ifdef PPC_IBM4XX -#include #ifdef _KERNEL +#ifdef PPC_IBM4XX extern int fake_mapiodev; #endif -#else + #ifdef MULTIPROCESSOR #define CPU_MAXNUM 2 #else #define CPU_MAXNUM 1 #endif + #include -#endif extern char module_machine_booke[]; extern char module_machine_ibm4xx[]; +#endif /* _KERNEL */ + #endif /* _MACHINE_CPU_H_ */ diff --git a/sys/arch/evbppc/include/obs405.h b/sys/arch/evbppc/include/obs405.h index 3fee6b64fde0..c78f2b33b2c9 100644 --- a/sys/arch/evbppc/include/obs405.h +++ b/sys/arch/evbppc/include/obs405.h @@ -1,4 +1,4 @@ -/* $NetBSD: obs405.h,v 1.7 2010/03/18 14:15:38 kiyohara Exp $ */ +/* $NetBSD: obs405.h,v 1.8 2011/06/18 06:44:26 matt Exp $ */ /* * Copyright 2004 Shigeyuki Fukushima. @@ -39,6 +39,6 @@ /* * extern variables and functions */ -extern void obs405_device_register(struct device *dev, void *aux, int com_freq); +extern void obs405_device_register(device_t dev, void *aux, int com_freq); #endif /* _EVBPPC_OBS405_H_ */ diff --git a/sys/arch/evbppc/obs405/dev/century_bios.c b/sys/arch/evbppc/obs405/dev/century_bios.c index f3e0a2b814d9..d72c0eb61b9c 100644 --- a/sys/arch/evbppc/obs405/dev/century_bios.c +++ b/sys/arch/evbppc/obs405/dev/century_bios.c @@ -1,4 +1,4 @@ -/* $NetBSD: century_bios.c,v 1.4 2007/02/22 05:27:47 thorpej Exp $ */ +/* $NetBSD: century_bios.c,v 1.5 2011/06/18 06:44:26 matt Exp $ */ /* * Copyright (c) 2004 Shigeyuki Fukushima. @@ -31,12 +31,14 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: century_bios.c,v 1.4 2007/02/22 05:27:47 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: century_bios.c,v 1.5 2011/06/18 06:44:26 matt Exp $"); #include #include +#include + +#include -#include #include /* diff --git a/sys/arch/evbppc/obs405/dev/obsled.c b/sys/arch/evbppc/obs405/dev/obsled.c index 5426ab3af1a0..c3efc176d093 100644 --- a/sys/arch/evbppc/obs405/dev/obsled.c +++ b/sys/arch/evbppc/obs405/dev/obsled.c @@ -1,4 +1,4 @@ -/* $NetBSD: obsled.c,v 1.7 2009/11/05 18:16:00 dyoung Exp $ */ +/* $NetBSD: obsled.c,v 1.8 2011/06/18 06:44:27 matt Exp $ */ /* * Copyright (c) 2004 Shigeyuki Fukushima. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: obsled.c,v 1.7 2009/11/05 18:16:00 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obsled.c,v 1.8 2011/06/18 06:44:27 matt Exp $"); #include #include @@ -44,23 +44,23 @@ __KERNEL_RCSID(0, "$NetBSD: obsled.c,v 1.7 2009/11/05 18:16:00 dyoung Exp $"); #include struct obsled_softc { - struct device sc_dev; + device_t sc_dev; gpio_tag_t sc_tag; int sc_addr; int sc_led_state; /* LED status (ON=1/OFF=0) */ int sc_led_state_mib; }; -static void obsled_attach(struct device *, struct device *, void *); -static int obsled_match(struct device *, struct cfdata *, void *); +static void obsled_attach(device_t, device_t, void *); +static int obsled_match(device_t, cfdata_t, void *); static int obsled_sysctl_verify(SYSCTLFN_PROTO); static void obsled_set_state(struct obsled_softc *); -CFATTACH_DECL(obsled, sizeof(struct obsled_softc), +CFATTACH_DECL_NEW(obsled, sizeof(struct obsled_softc), obsled_match, obsled_attach, NULL, NULL); static int -obsled_match(struct device *parent, struct cfdata *cf, void *aux) +obsled_match(device_t parent, cfdata_t cf, void *aux) { struct gpio_attach_args *ga = aux; @@ -76,20 +76,21 @@ obsled_match(struct device *parent, struct cfdata *cf, void *aux) } static void -obsled_attach(struct device *parent, struct device *self, void *aux) +obsled_attach(device_t parent, device_t self, void *aux) { - struct obsled_softc *sc = (struct obsled_softc *)self; + struct obsled_softc *sc = device_private(self); struct gpio_attach_args *ga = aux; struct sysctlnode *node; int err, node_mib; char led_name[5]; - /* int led = (1 << device_unit(&sc->sc_dev)); */ + /* int led = (1 << device_unit(sc->sc_dev)); */ snprintf(led_name, sizeof(led_name), - "led%d", (1 << device_unit(&sc->sc_dev)) & 0x7); + "led%d", (1 << device_unit(sc->sc_dev)) & 0x7); aprint_naive(": OpenBlockS %s\n", led_name); aprint_normal(": OpenBlockS %s\n", led_name); + sc->sc_dev = self; sc->sc_tag = ga->ga_tag; sc->sc_addr = ga->ga_addr; sc->sc_led_state = 0; diff --git a/sys/arch/evbppc/obs405/obs200_autoconf.c b/sys/arch/evbppc/obs405/obs200_autoconf.c index 2901a0b41c63..47a7e101edfa 100644 --- a/sys/arch/evbppc/obs405/obs200_autoconf.c +++ b/sys/arch/evbppc/obs405/obs200_autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: obs200_autoconf.c,v 1.5 2010/03/18 13:47:04 kiyohara Exp $ */ +/* $NetBSD: obs200_autoconf.c,v 1.6 2011/06/18 06:44:26 matt Exp $ */ /* * Copyright 2004 Shigeyuki Fukushima. @@ -33,10 +33,11 @@ * DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: obs200_autoconf.c,v 1.5 2010/03/18 13:47:04 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obs200_autoconf.c,v 1.6 2011/06/18 06:44:26 matt Exp $"); #include #include +#include #include @@ -73,7 +74,7 @@ cpu_configure(void) __asm volatile ("wrteei 1"); } -void device_register(struct device *dev, void *aux) +void device_register(device_t dev, void *aux) { obs405_device_register(dev, aux, OBS200_COM_FREQ); diff --git a/sys/arch/evbppc/obs405/obs200_machdep.c b/sys/arch/evbppc/obs405/obs200_machdep.c index d0e3d7d081d8..00cf39e93462 100644 --- a/sys/arch/evbppc/obs405/obs200_machdep.c +++ b/sys/arch/evbppc/obs405/obs200_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: obs200_machdep.c,v 1.16 2011/06/15 05:50:49 matt Exp $ */ +/* $NetBSD: obs200_machdep.c,v 1.17 2011/06/18 06:44:26 matt Exp $ */ /* Original: machdep.c,v 1.3 2005/01/17 17:24:09 shige Exp */ /* @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: obs200_machdep.c,v 1.16 2011/06/15 05:50:49 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obs200_machdep.c,v 1.17 2011/06/18 06:44:26 matt Exp $"); #include "opt_compat_netbsd.h" #include "opt_ddb.h" @@ -83,15 +83,18 @@ __KERNEL_RCSID(0, "$NetBSD: obs200_machdep.c,v 1.16 2011/06/15 05:50:49 matt Exp #include #include #include +#include +#include #include -#include -#include #include #include + #include #include + +#include #include #include #include diff --git a/sys/arch/evbppc/obs405/obs266_autoconf.c b/sys/arch/evbppc/obs405/obs266_autoconf.c index cf9829eb93ef..d3fe8f5b730b 100644 --- a/sys/arch/evbppc/obs405/obs266_autoconf.c +++ b/sys/arch/evbppc/obs405/obs266_autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: obs266_autoconf.c,v 1.5 2010/03/18 14:04:07 kiyohara Exp $ */ +/* $NetBSD: obs266_autoconf.c,v 1.6 2011/06/18 06:44:26 matt Exp $ */ /* * Copyright 2004 Shigeyuki Fukushima. @@ -33,10 +33,11 @@ * DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: obs266_autoconf.c,v 1.5 2010/03/18 14:04:07 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obs266_autoconf.c,v 1.6 2011/06/18 06:44:26 matt Exp $"); #include #include +#include #include @@ -45,7 +46,6 @@ __KERNEL_RCSID(0, "$NetBSD: obs266_autoconf.c,v 1.5 2010/03/18 14:04:07 kiyohara #include - /* * Determine device configuration for a machine. */ @@ -62,9 +62,6 @@ cpu_configure(void) if (config_rootfound("plb", NULL) == NULL) panic("configure: mainbus not configured"); - printf("biomask %x netmask %x ttymask %x\n", - imask[IPL_BIO], imask[IPL_NET], imask[IPL_TTY]); - (void)spl0(); /* @@ -73,7 +70,8 @@ cpu_configure(void) __asm volatile ("wrteei 1"); } -void device_register(struct device *dev, void *aux) +void +device_register(device_t dev, void *aux) { obs405_device_register(dev, aux, OBS266_COM_FREQ); diff --git a/sys/arch/evbppc/obs405/obs266_machdep.c b/sys/arch/evbppc/obs405/obs266_machdep.c index 01b27dc3e9ff..1b72a93be6b7 100644 --- a/sys/arch/evbppc/obs405/obs266_machdep.c +++ b/sys/arch/evbppc/obs405/obs266_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: obs266_machdep.c,v 1.17 2011/06/15 05:50:49 matt Exp $ */ +/* $NetBSD: obs266_machdep.c,v 1.18 2011/06/18 06:44:26 matt Exp $ */ /* Original: md_machdep.c,v 1.3 2005/01/24 18:47:37 shige Exp $ */ /* @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: obs266_machdep.c,v 1.17 2011/06/15 05:50:49 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obs266_machdep.c,v 1.18 2011/06/18 06:44:26 matt Exp $"); #include "opt_compat_netbsd.h" #include "opt_ddb.h" @@ -83,17 +83,20 @@ __KERNEL_RCSID(0, "$NetBSD: obs266_machdep.c,v 1.17 2011/06/15 05:50:49 matt Exp #include #include #include +#include +#include #include -#include -#include #include -#include + #include +#include #include #include #include + +#include #include #include diff --git a/sys/arch/evbppc/obs405/obs405_autoconf.c b/sys/arch/evbppc/obs405/obs405_autoconf.c index 7457cd72c1bb..c0d3c7cdd76f 100644 --- a/sys/arch/evbppc/obs405/obs405_autoconf.c +++ b/sys/arch/evbppc/obs405/obs405_autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: obs405_autoconf.c,v 1.4 2006/02/26 05:24:52 thorpej Exp $ */ +/* $NetBSD: obs405_autoconf.c,v 1.5 2011/06/18 06:44:26 matt Exp $ */ /* * Copyright 2004 Shigeyuki Fukushima. @@ -33,15 +33,17 @@ * DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: obs405_autoconf.c,v 1.4 2006/02/26 05:24:52 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obs405_autoconf.c,v 1.5 2011/06/18 06:44:26 matt Exp $"); #include #include #include -#include +#include +#include #include +#include #include @@ -53,9 +55,9 @@ cpu_rootconf(void) } void -obs405_device_register(struct device *dev, void *aux, int com_freq) +obs405_device_register(device_t dev, void *aux, int com_freq) { - struct device *parent = device_parent(dev); + device_t parent = device_parent(dev); /* register "com" device */ if (device_is_a(dev, "com") && device_is_a(parent, "opb")) { diff --git a/sys/arch/evbppc/obs405/obs405_machdep.c b/sys/arch/evbppc/obs405/obs405_machdep.c index feb7d7282e42..8db00c5dd75e 100644 --- a/sys/arch/evbppc/obs405/obs405_machdep.c +++ b/sys/arch/evbppc/obs405/obs405_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: obs405_machdep.c,v 1.5 2010/02/08 19:02:28 joerg Exp $ */ +/* $NetBSD: obs405_machdep.c,v 1.6 2011/06/18 06:44:26 matt Exp $ */ /* * Copyright (c) 2004 Shigeyuki Fukushima. @@ -31,16 +31,10 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: obs405_machdep.c,v 1.5 2010/02/08 19:02:28 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obs405_machdep.c,v 1.6 2011/06/18 06:44:26 matt Exp $"); #include -#include - -#include - -#include - /* * Machine-dependent global variables * phys_map: sys/uvm/uvm_extern.h diff --git a/sys/arch/evbppc/obs405/obs600_autoconf.c b/sys/arch/evbppc/obs405/obs600_autoconf.c index 714a071c8f08..611e6ae52395 100644 --- a/sys/arch/evbppc/obs405/obs600_autoconf.c +++ b/sys/arch/evbppc/obs405/obs600_autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: obs600_autoconf.c,v 1.2 2011/02/25 10:16:59 kiyohara Exp $ */ +/* $NetBSD: obs600_autoconf.c,v 1.3 2011/06/18 06:44:26 matt Exp $ */ /* * Copyright 2004 Shigeyuki Fukushima. @@ -33,12 +33,13 @@ * DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: obs600_autoconf.c,v 1.2 2011/02/25 10:16:59 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obs600_autoconf.c,v 1.3 2011/06/18 06:44:26 matt Exp $"); #include #include +#include +#include -#include #include #include @@ -78,7 +79,8 @@ cpu_configure(void) __asm volatile ("wrteei 1"); } -void device_register(struct device *dev, void *aux) +void +device_register(device_t dev, void *aux) { obs405_device_register(dev, aux, OBS600_COM_FREQ); diff --git a/sys/arch/evbppc/obs405/obs600_machdep.c b/sys/arch/evbppc/obs405/obs600_machdep.c index 414d0495607b..bfc38164a554 100644 --- a/sys/arch/evbppc/obs405/obs600_machdep.c +++ b/sys/arch/evbppc/obs405/obs600_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: obs600_machdep.c,v 1.5 2011/06/15 05:50:49 matt Exp $ */ +/* $NetBSD: obs600_machdep.c,v 1.6 2011/06/18 06:44:26 matt Exp $ */ /* Original: md_machdep.c,v 1.3 2005/01/24 18:47:37 shige Exp $ */ /* @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: obs600_machdep.c,v 1.5 2011/06/15 05:50:49 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: obs600_machdep.c,v 1.6 2011/06/18 06:44:26 matt Exp $"); #include "opt_compat_netbsd.h" #include "opt_ddb.h" @@ -85,20 +85,22 @@ __KERNEL_RCSID(0, "$NetBSD: obs600_machdep.c,v 1.5 2011/06/15 05:50:49 matt Exp #include #include #include +#include +#include #include -#include -#include #include #include +#include #include #include #include #include -#include + #include +#include #include diff --git a/sys/arch/evbppc/obs405/rbus_machdep.c b/sys/arch/evbppc/obs405/rbus_machdep.c index e0f327e6cb67..353138017ab6 100644 --- a/sys/arch/evbppc/obs405/rbus_machdep.c +++ b/sys/arch/evbppc/obs405/rbus_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: rbus_machdep.c,v 1.6 2011/01/18 01:08:55 matt Exp $ */ +/* $NetBSD: rbus_machdep.c,v 1.7 2011/06/18 06:44:26 matt Exp $ */ /* * Copyright (c) 2003 @@ -30,13 +30,12 @@ #include #include #include - #include +#include + #include -#include - #include #include #include diff --git a/sys/arch/evbppc/pmppc/autoconf.c b/sys/arch/evbppc/pmppc/autoconf.c index 28305767fee7..174dbc536413 100644 --- a/sys/arch/evbppc/pmppc/autoconf.c +++ b/sys/arch/evbppc/pmppc/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.5 2009/03/18 10:22:28 cegger Exp $ */ +/* $NetBSD: autoconf.c,v 1.6 2011/06/18 06:44:27 matt Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -44,7 +44,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.5 2009/03/18 10:22:28 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.6 2011/06/18 06:44:27 matt Exp $"); #include #include @@ -79,7 +79,7 @@ cpu_rootconf(void) findroot(); printf("boot device: %s\n", - booted_device ? booted_device->dv_xname : ""); + booted_device ? device_xname(booted_device) : ""); setroot(booted_device, booted_partition); } diff --git a/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c b/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c index 20caf4f08ee5..0c6cd206c0d8 100644 --- a/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c +++ b/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpc_mainbus.c,v 1.4 2011/06/06 16:42:17 matt Exp $ */ +/* $NetBSD: cpc_mainbus.c,v 1.5 2011/06/18 06:44:27 matt Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpc_mainbus.c,v 1.4 2011/06/06 16:42:17 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpc_mainbus.c,v 1.5 2011/06/18 06:44:27 matt Exp $"); #include #include @@ -94,5 +94,5 @@ cpc_mainbus_attach(device_t parent, device_t self, void *aux) a_config.a_bus_freq); if (!a_config.a_is_monarch) - printf("%s: not Monarch, pci not attached\n", self->dv_xname); + aprint_error_dev(self, "not Monarch, pci not attached\n"); } diff --git a/sys/arch/evbppc/pmppc/dev/flash.c b/sys/arch/evbppc/pmppc/dev/flash.c index 5f77c15abef6..2068199ecb0e 100644 --- a/sys/arch/evbppc/pmppc/dev/flash.c +++ b/sys/arch/evbppc/pmppc/dev/flash.c @@ -1,4 +1,4 @@ -/* $NetBSD: flash.c,v 1.3 2008/04/28 20:23:17 martin Exp $ */ +/* $NetBSD: flash.c,v 1.4 2011/06/18 06:44:27 matt Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.3 2008/04/28 20:23:17 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.4 2011/06/18 06:44:27 matt Exp $"); #include #include @@ -40,7 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: flash.c,v 1.3 2008/04/28 20:23:17 martin Exp $"); #include struct flash_softc { - struct device sc_dev; + device_t sc_dev; bus_space_tag_t sc_tag; bus_space_handle_t sc_handle; u_int32_t sc_addr; @@ -48,14 +48,14 @@ struct flash_softc { u_int32_t sc_width; }; -static int flash_match(struct device *, struct cfdata *, void *); -static void flash_attach(struct device *, struct device *, void *); +static int flash_match(device_t, cfdata_t, void *); +static void flash_attach(device_t, device_t, void *); -CFATTACH_DECL(flash, sizeof(struct flash_softc), +CFATTACH_DECL_NEW(flash, sizeof(struct flash_softc), flash_match, flash_attach, NULL, NULL); int -flash_match(struct device *parent, struct cfdata *cf, void *aux) +flash_match(device_t parent, cfdata_t cf, void *aux) { struct mainbus_attach_args *maa = aux; @@ -63,26 +63,26 @@ flash_match(struct device *parent, struct cfdata *cf, void *aux) } void -flash_attach(struct device *parent, struct device *self, void *aux) +flash_attach(device_t parent, device_t self, void *aux) { struct mainbus_attach_args *maa = aux; - struct flash_softc *sc = (struct flash_softc *)self; + struct flash_softc *sc = device_private(self); sc->sc_tag = maa->mb_bt; sc->sc_addr = maa->mb_addr; sc->sc_size = maa->u.mb_flash.size / 8; /* bytes */ sc->sc_width = maa->u.mb_flash.width; - printf(": %d Mbyte, %d bits wide\n", sc->sc_size / (1024*1024), + aprint_normal(": %d Mbyte, %d bits wide\n", sc->sc_size / (1024*1024), sc->sc_width); #if 0 /* The extend map doesn't cover this area. */ if (bus_space_map(sc->sc_tag, sc->sc_addr, sc->sc_size, 0, &sc->sc_handle)) { - printf("%s: can't map i/o space\n", self->dv_xname); + aprint_error_dev(self, "can't map i/o space\n"); return; } #endif - printf("%s: driver not implemented\n", self->dv_xname); + aprint_error_dev(self, "driver not implemented\n"); } diff --git a/sys/arch/evbppc/pmppc/dev/if_cs_mainbus.c b/sys/arch/evbppc/pmppc/dev/if_cs_mainbus.c index 12af93ac4e12..5a612bd00841 100644 --- a/sys/arch/evbppc/pmppc/dev/if_cs_mainbus.c +++ b/sys/arch/evbppc/pmppc/dev/if_cs_mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cs_mainbus.c,v 1.4 2009/09/22 14:55:19 tsutsui Exp $ */ +/* $NetBSD: if_cs_mainbus.c,v 1.5 2011/06/18 06:44:27 matt Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_cs_mainbus.c,v 1.4 2009/09/22 14:55:19 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cs_mainbus.c,v 1.5 2011/06/18 06:44:27 matt Exp $"); #include #include @@ -65,8 +65,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_cs_mainbus.c,v 1.4 2009/09/22 14:55:19 tsutsui Ex static void cs_check_eeprom(struct cs_softc *sc); -static int cs_mainbus_match(struct device *, struct cfdata *, void *); -static void cs_mainbus_attach(struct device *, struct device *, void *); +static int cs_mainbus_match(device_t, cfdata_t, void *); +static void cs_mainbus_attach(device_t, device_t, void *); CFATTACH_DECL_NEW(cs_mainbus, sizeof(struct cs_softc), cs_mainbus_match, cs_mainbus_attach, NULL, NULL); diff --git a/sys/arch/evbppc/virtex/autoconf.c b/sys/arch/evbppc/virtex/autoconf.c index a0229c189038..b766716d0ada 100644 --- a/sys/arch/evbppc/virtex/autoconf.c +++ b/sys/arch/evbppc/virtex/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.2 2010/03/18 14:04:07 kiyohara Exp $ */ +/* $NetBSD: autoconf.c,v 1.3 2011/06/18 06:44:27 matt Exp $ */ /* * Copyright (c) 2006 Jachym Holecek @@ -61,14 +61,17 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2 2010/03/18 14:04:07 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.3 2011/06/18 06:44:27 matt Exp $"); #include #include -#include +#include +#include #include #include + +#include #include @@ -90,9 +93,6 @@ cpu_configure(void) if (config_rootfound("plb", &local_plb_devs) == NULL) panic("configure: plb not configured"); - printf("biomask %#08x netmask %#08x ttymask %#08x\n", - imask[IPL_BIO], imask[IPL_NET], imask[IPL_TTY]); - (void)spl0(); /* Now allow hardware interrupts. */ diff --git a/sys/arch/evbppc/virtex/design_gsrd1.c b/sys/arch/evbppc/virtex/design_gsrd1.c index 0a13b682315e..772caebfd722 100644 --- a/sys/arch/evbppc/virtex/design_gsrd1.c +++ b/sys/arch/evbppc/virtex/design_gsrd1.c @@ -1,4 +1,4 @@ -/* $NetBSD: design_gsrd1.c,v 1.2 2007/10/17 19:54:20 garbled Exp $ */ +/* $NetBSD: design_gsrd1.c,v 1.3 2011/06/18 06:44:27 matt Exp $ */ /* * Copyright (c) 2006 Jachym Holecek @@ -30,18 +30,18 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: design_gsrd1.c,v 1.2 2007/10/17 19:54:20 garbled Exp $"); +__KERNEL_RCSID(0, "$NetBSD: design_gsrd1.c,v 1.3 2011/06/18 06:44:27 matt Exp $"); #include #include #include #include #include +#include +#include +#include -#include -#include -#include - +#include #include #include @@ -418,7 +418,7 @@ virtex_machdep_init(vaddr_t endva, vsize_t maxsz, struct mem_region *phys, } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { /* Nothing to do -- no property hacks needed. */ } diff --git a/sys/arch/evbppc/virtex/design_gsrd2.c b/sys/arch/evbppc/virtex/design_gsrd2.c index 08fea9ec01b6..b15f23a9e021 100644 --- a/sys/arch/evbppc/virtex/design_gsrd2.c +++ b/sys/arch/evbppc/virtex/design_gsrd2.c @@ -1,4 +1,4 @@ -/* $NetBSD: design_gsrd2.c,v 1.3 2007/10/17 19:54:20 garbled Exp $ */ +/* $NetBSD: design_gsrd2.c,v 1.4 2011/06/18 06:44:27 matt Exp $ */ /* * Copyright (c) 2006 Jachym Holecek @@ -32,7 +32,7 @@ #include "opt_virtex.h" #include -__KERNEL_RCSID(0, "$NetBSD: design_gsrd2.c,v 1.3 2007/10/17 19:54:20 garbled Exp $"); +__KERNEL_RCSID(0, "$NetBSD: design_gsrd2.c,v 1.4 2011/06/18 06:44:27 matt Exp $"); #include #include @@ -40,13 +40,14 @@ __KERNEL_RCSID(0, "$NetBSD: design_gsrd2.c,v 1.3 2007/10/17 19:54:20 garbled Exp #include #include #include +#include +#include +#include -#include -#include -#include #include #include +#include #include #include @@ -476,7 +477,7 @@ virtex_machdep_init(vaddr_t endva, vsize_t maxsz, struct mem_region *phys, } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { prop_number_t pn; void *fb; diff --git a/sys/arch/evbppc/virtex/dev/if_temac.c b/sys/arch/evbppc/virtex/dev/if_temac.c index 67c31fae2fe4..8510683b85a4 100644 --- a/sys/arch/evbppc/virtex/dev/if_temac.c +++ b/sys/arch/evbppc/virtex/dev/if_temac.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_temac.c,v 1.7 2010/04/05 07:19:30 joerg Exp $ */ +/* $NetBSD: if_temac.c,v 1.8 2011/06/18 06:44:27 matt Exp $ */ /* * Copyright (c) 2006 Jachym Holecek @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_temac.c,v 1.7 2010/04/05 07:19:30 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_temac.c,v 1.8 2011/06/18 06:44:27 matt Exp $"); #include @@ -50,6 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_temac.c,v 1.7 2010/04/05 07:19:30 joerg Exp $"); #include #include #include +#include +#include #include @@ -60,7 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_temac.c,v 1.7 2010/04/05 07:19:30 joerg Exp $"); #include -#include +#include #include #include @@ -136,7 +138,7 @@ struct temac_rxsoft { }; struct temac_softc { - struct device sc_dev; + device_t sc_dev; struct ethercom sc_ec; #define sc_if sc_ec.ec_if @@ -193,7 +195,7 @@ struct temac_softc { }; /* Device interface. */ -static void temac_attach(struct device *, struct device *, void *); +static void temac_attach(device_t, device_t, void *); /* Ifnet interface. */ static int temac_init(struct ifnet *); @@ -202,10 +204,10 @@ static void temac_start(struct ifnet *); static void temac_stop(struct ifnet *, int); /* Media management. */ -static int temac_mii_readreg(struct device *, int, int); -static void temac_mii_statchg(struct device *); +static int temac_mii_readreg(device_t, int, int); +static void temac_mii_statchg(device_t); static void temac_mii_tick(void *); -static void temac_mii_writereg(struct device *, int, int, int); +static void temac_mii_writereg(device_t, int, int, int); /* Indirect hooks. */ static void temac_shutdown(void *); @@ -249,7 +251,7 @@ static inline void hif_wait_stat(uint32_t); bus_space_write_4((sc)->sc_dma_txt, (sc)->sc_dma_txh, CDMAC_CURDESC, (val)) -CFATTACH_DECL(temac, sizeof(struct temac_softc), +CFATTACH_DECL_NEW(temac, sizeof(struct temac_softc), xcvbus_child_match, temac_attach, NULL, NULL); @@ -314,23 +316,25 @@ gmi_read_4(uint32_t addr) * Generic device. */ static void -temac_attach(struct device *parent, struct device *self, void *aux) +temac_attach(device_t parent, device_t self, void *aux) { struct xcvbus_attach_args *vaa = aux; struct ll_dmac *rx = vaa->vaa_rx_dmac; struct ll_dmac *tx = vaa->vaa_tx_dmac; - struct temac_softc *sc = (struct temac_softc *)self; + struct temac_softc *sc = device_private(self); struct ifnet *ifp = &sc->sc_if; struct mii_data *mii = &sc->sc_mii; uint8_t enaddr[ETHER_ADDR_LEN]; bus_dma_segment_t seg; int error, nseg, i; + const char * const xname = device_xname(self); - printf(": TEMAC\n"); /* XXX will be LL_TEMAC, PLB_TEMAC */ + aprint_normal(": TEMAC\n"); /* XXX will be LL_TEMAC, PLB_TEMAC */ KASSERT(rx); KASSERT(tx); + sc->sc_dev = self; sc->sc_dmat = vaa->vaa_dmat; sc->sc_dead = 0; sc->sc_rx_drained = 1; @@ -344,33 +348,29 @@ temac_attach(struct device *parent, struct device *self, void *aux) */ if ((error = bus_space_map(vaa->vaa_iot, vaa->vaa_addr, TEMAC_SIZE, 0, &sc->sc_ioh)) != 0) { - printf("%s: could not map registers\n", device_xname(self)); + aprint_error_dev(self, "could not map registers\n"); goto fail_0; } if ((error = bus_space_map(sc->sc_dma_rxt, rx->dmac_ctrl_addr, CDMAC_CTRL_SIZE, 0, &sc->sc_dma_rxh)) != 0) { - printf("%s: could not map Rx control registers\n", - device_xname(self)); + aprint_error_dev(self, "could not map Rx control registers\n"); goto fail_0; } if ((error = bus_space_map(sc->sc_dma_rxt, rx->dmac_stat_addr, CDMAC_STAT_SIZE, 0, &sc->sc_dma_rsh)) != 0) { - printf("%s: could not map Rx status register\n", - device_xname(self)); + aprint_error_dev(self, "could not map Rx status register\n"); goto fail_0; } if ((error = bus_space_map(sc->sc_dma_txt, tx->dmac_ctrl_addr, CDMAC_CTRL_SIZE, 0, &sc->sc_dma_txh)) != 0) { - printf("%s: could not map Tx control registers\n", - device_xname(self)); + aprint_error_dev(self, "could not map Tx control registers\n"); goto fail_0; } if ((error = bus_space_map(sc->sc_dma_txt, tx->dmac_stat_addr, CDMAC_STAT_SIZE, 0, &sc->sc_dma_tsh)) != 0) { - printf("%s: could not map Tx status register\n", - device_xname(self)); + aprint_error_dev(self, "could not map Tx status register\n"); goto fail_0; } @@ -379,31 +379,28 @@ temac_attach(struct device *parent, struct device *self, void *aux) */ if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct temac_control), 8, 0, &seg, 1, &nseg, 0)) != 0) { - printf("%s: could not allocate control data\n", - sc->sc_dev.dv_xname); + aprint_error_dev(self, "could not allocate control data\n"); goto fail_0; } if ((error = bus_dmamem_map(sc->sc_dmat, &seg, nseg, sizeof(struct temac_control), (void **)&sc->sc_control_data, BUS_DMA_COHERENT)) != 0) { - printf("%s: could not map control data\n", - sc->sc_dev.dv_xname); + aprint_error_dev(self, "could not map control data\n"); goto fail_1; } if ((error = bus_dmamap_create(sc->sc_dmat, sizeof(struct temac_control), 1, sizeof(struct temac_control), 0, 0, &sc->sc_control_dmap)) != 0) { - printf("%s: could not create control data DMA map\n", - sc->sc_dev.dv_xname); + aprint_error_dev(self, + "could not create control data DMA map\n"); goto fail_2; } if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_control_dmap, sc->sc_control_data, sizeof(struct temac_control), NULL, 0)) != 0) { - printf("%s: could not load control data DMA map\n", - sc->sc_dev.dv_xname); + aprint_error_dev(self, "could not load control data DMA map\n"); goto fail_3; } @@ -434,8 +431,9 @@ temac_attach(struct device *parent, struct device *self, void *aux) if ((error = bus_dmamap_create(sc->sc_dmat, ETHER_MAX_LEN_JUMBO, TEMAC_NTXSEG, ETHER_MAX_LEN_JUMBO, 0, 0, &sc->sc_txsoft[i].txs_dmap)) != 0) { - printf("%s: could not create Tx DMA map %d\n", - sc->sc_dev.dv_xname, i); + aprint_error_dev(self, + "could not create Tx DMA map %d\n", + i); goto fail_4; } sc->sc_txsoft[i].txs_mbuf = NULL; @@ -446,8 +444,8 @@ temac_attach(struct device *parent, struct device *self, void *aux) if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, TEMAC_NRXSEG, MCLBYTES, 0, 0, &sc->sc_rxsoft[i].rxs_dmap)) != 0) { - printf("%s: could not create Rx DMA map %d\n", - sc->sc_dev.dv_xname, i); + aprint_error_dev(self, + "could not create Rx DMA map %d\n", i); goto fail_5; } sc->sc_rxsoft[i].rxs_mbuf = NULL; @@ -461,16 +459,14 @@ temac_attach(struct device *parent, struct device *self, void *aux) sc->sc_rx_ih = ll_dmac_intr_establish(rx->dmac_chan, temac_rx_intr, sc); if (sc->sc_rx_ih == NULL) { - printf("%s: could not establish Rx interrupt\n", - device_xname(self)); + aprint_error_dev(self, "could not establish Rx interrupt\n"); goto fail_5; } sc->sc_tx_ih = ll_dmac_intr_establish(tx->dmac_chan, temac_tx_intr, sc); if (sc->sc_tx_ih == NULL) { - printf("%s: could not establish Tx interrupt\n", - device_xname(self)); + aprint_error_dev(self, "could not establish Tx interrupt\n"); goto fail_6; } @@ -498,7 +494,7 @@ temac_attach(struct device *parent, struct device *self, void *aux) sc->sc_ec.ec_mii = mii; ifmedia_init(&mii->mii_media, 0, ether_mediachange, ether_mediastatus); - mii_attach(&sc->sc_dev, mii, 0xffffffff, MII_PHY_ANY, + mii_attach(sc->sc_dev, mii, 0xffffffff, MII_PHY_ANY, MII_OFFSET_ANY, 0); if (LIST_FIRST(&mii->mii_phys) == NULL) { ifmedia_add(&mii->mii_media, IFM_ETHER|IFM_NONE, 0, NULL); @@ -526,7 +522,7 @@ temac_attach(struct device *parent, struct device *self, void *aux) /* * Hook up with network stack. */ - strcpy(ifp->if_xname, sc->sc_dev.dv_xname); + strcpy(ifp->if_xname, xname); ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = temac_ioctl; @@ -544,8 +540,8 @@ temac_attach(struct device *parent, struct device *self, void *aux) sc->sc_sdhook = shutdownhook_establish(temac_shutdown, sc); if (sc->sc_sdhook == NULL) - printf("%s: WARNING: unable to establish shutdown hook\n", - device_xname(self)); + aprint_error_dev(self, + "WARNING: unable to establish shutdown hook\n"); callout_setfunc(&sc->sc_mii_tick, temac_mii_tick, sc); callout_setfunc(&sc->sc_rx_timo, temac_rxtimo, sc); @@ -570,7 +566,7 @@ temac_attach(struct device *parent, struct device *self, void *aux) fail_1: bus_dmamem_free(sc->sc_dmat, &seg, nseg); fail_0: - printf("%s: error = %d\n", device_xname(self), error); + aprint_error_dev(self, "error = %d\n", error); } /* @@ -621,10 +617,9 @@ temac_init(struct ifnet *ifp) if (sc->sc_rx_drained) { for (i = 0; i < TEMAC_NRXDESC; i++) { if ((error = temac_rxalloc(sc, i, 1)) != 0) { - printf("%s: failed to allocate Rx " - "descriptor %d\n", - sc->sc_dev.dv_xname, i); - + aprint_error_dev(sc->sc_dev, + "failed to allocate Rx descriptor %d\n", + i); temac_rxdrain(sc); return (error); } @@ -707,14 +702,14 @@ temac_start(struct ifnet *ifp) if ((error = bus_dmamap_load_mbuf(sc->sc_dmat, dmap, m, BUS_DMA_WRITE | BUS_DMA_NOWAIT)) != 0) { if (error == EFBIG) { - printf("%s: Tx consumes too many segments, " - "dropped\n", sc->sc_dev.dv_xname); + aprint_error_dev(sc->sc_dev, + "Tx consumes too many segments, dropped\n"); IFQ_DEQUEUE(&ifp->if_snd, m); m_freem(m); continue; } else { - printf("%s: Tx stall due to resource " - "shortage\n", sc->sc_dev.dv_xname); + aprint_debug_dev(sc->sc_dev, + "Tx stall due to resource shortage\n"); break; } } @@ -781,8 +776,9 @@ temac_start(struct ifnet *ifp) temac_txkick(sc); #if TEMAC_TXDEBUG > 0 - printf("%s: start: txcur %03d -> %03d, nseg %03d\n", - sc->sc_dev.dv_xname, head, sc->sc_txcur, nsegs); + aprint_debug_dev(sc->sc_dev, + "start: txcur %03d -> %03d, nseg %03d\n", + head, sc->sc_txcur, nsegs); #endif } } @@ -795,7 +791,7 @@ temac_stop(struct ifnet *ifp, int disable) int i; #if TEMAC_DEBUG > 0 - printf("%s: stop\n", device_xname(&sc->sc_dev)); + aprint_debug_dev(sc->sc_dev, "stop\n"); #endif /* Down the MII. */ @@ -825,7 +821,7 @@ temac_stop(struct ifnet *ifp, int disable) } static int -temac_mii_readreg(struct device *self, int phy, int reg) +temac_mii_readreg(device_t self, int phy, int reg) { mtidcr(IDCR_HIF_ARG0, (phy << 5) | reg); mtidcr(IDCR_HIF_CTRL, TEMAC_GMI_MII_ADDR); @@ -835,7 +831,7 @@ temac_mii_readreg(struct device *self, int phy, int reg) } static void -temac_mii_writereg(struct device *self, int phy, int reg, int val) +temac_mii_writereg(device_t self, int phy, int reg, int val) { mtidcr(IDCR_HIF_ARG0, val); mtidcr(IDCR_HIF_CTRL, TEMAC_GMI_MII_WRVAL | HIF_CTRL_WRITE); @@ -845,9 +841,9 @@ temac_mii_writereg(struct device *self, int phy, int reg, int val) } static void -temac_mii_statchg(struct device *self) +temac_mii_statchg(device_t self) { - struct temac_softc *sc = (struct temac_softc *)self; + struct temac_softc *sc = device_private(self); uint32_t rcf, tcf, mmc; /* Full/half duplex link. */ @@ -891,7 +887,7 @@ temac_mii_tick(void *arg) struct temac_softc *sc = (struct temac_softc *)arg; int s; - if (!device_is_active(&sc->sc_dev)) + if (!device_is_active(sc->sc_dev)) return; s = splnet(); @@ -921,8 +917,9 @@ temac_tx_intr(void *arg) /* XXX: We may need to splnet() here if cdmac(4) changes. */ if ((stat = cdmac_tx_stat(sc)) & CDMAC_STAT_ERROR) { - printf("%s: transmit DMA is toast (%#08x), halted!\n", - sc->sc_dev.dv_xname, stat); + aprint_error_dev(sc->sc_dev, + "transmit DMA is toast (%#08x), halted!\n", + stat); /* XXXFreza: how to signal this upstream? */ temac_stop(&sc->sc_if, 1); @@ -930,7 +927,7 @@ temac_tx_intr(void *arg) } #if TEMAC_DEBUG > 0 - printf("%s: tx intr 0x%08x\n", device_xname(&sc->sc_dev), stat); + aprint_debug_dev(sc->sc_dev, "tx intr 0x%08x\n", stat); #endif temac_txreap(sc); } @@ -944,8 +941,9 @@ temac_rx_intr(void *arg) /* XXX: We may need to splnet() here if cdmac(4) changes. */ if ((stat = cdmac_rx_stat(sc)) & CDMAC_STAT_ERROR) { - printf("%s: receive DMA is toast (%#08x), halted!\n", - sc->sc_dev.dv_xname, stat); + aprint_error_dev(sc->sc_dev, + "receive DMA is toast (%#08x), halted!\n", + stat); /* XXXFreza: how to signal this upstream? */ temac_stop(&sc->sc_if, 1); @@ -953,7 +951,7 @@ temac_rx_intr(void *arg) } #if TEMAC_DEBUG > 0 - printf("%s: rx intr 0x%08x\n", device_xname(&sc->sc_dev), stat); + aprint_debug_dev(sc->sc_dev, "rx intr 0x%08x\n", stat); #endif temac_rxreap(sc); } @@ -1071,8 +1069,8 @@ temac_rxalloc(struct temac_softc *sc, int which, int verbose) MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { if (verbose) - printf("%s: out of Rx header mbufs\n", - sc->sc_dev.dv_xname); + aprint_debug_dev(sc->sc_dev, + "out of Rx header mbufs\n"); return (ENOBUFS); } MCLAIM(m, &sc->sc_ec.ec_rx_mowner); @@ -1080,8 +1078,8 @@ temac_rxalloc(struct temac_softc *sc, int which, int verbose) MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { if (verbose) - printf("%s: out of Rx cluster mbufs\n", - sc->sc_dev.dv_xname); + aprint_debug_dev(sc->sc_dev, + "out of Rx cluster mbufs\n"); m_freem(m); return (ENOBUFS); } @@ -1096,8 +1094,9 @@ temac_rxalloc(struct temac_softc *sc, int which, int verbose) BUS_DMA_NOWAIT); if (error) { if (verbose) - printf("%s: could not map Rx descriptor %d, " - "error = %d\n", sc->sc_dev.dv_xname, which, error); + aprint_debug_dev(sc->sc_dev, + "could not map Rx descriptor %d, error = %d\n", + which, error); rxs->rxs_mbuf = NULL; m_freem(m); @@ -1105,7 +1104,7 @@ temac_rxalloc(struct temac_softc *sc, int which, int verbose) return (error); } - stat = \ + stat = (TEMAC_ISINTR(which) ? CDMAC_STAT_INTR : 0) | (TEMAC_ISLAST(which) ? CDMAC_STAT_STOP : 0); @@ -1165,9 +1164,9 @@ temac_rxreap(struct temac_softc *sc) if ((stat & (CDMAC_STAT_EOP | CDMAC_STAT_SOP)) != (CDMAC_STAT_EOP | CDMAC_STAT_SOP)) { - printf("%s: Rx packet doesn't fit in " - "one descriptor, stat = %#08x\n", - sc->sc_dev.dv_xname, stat); + aprint_error_dev(sc->sc_dev, + "Rx packet doesn't fit in one descriptor, " + "stat = %#08x\n", stat); goto badframe; } @@ -1178,8 +1177,9 @@ temac_rxreap(struct temac_softc *sc) if ((rxstat & RXSTAT_GOOD) == 0 || (rxstat & RXSTAT_SICK) != 0) { - printf("%s: corrupt Rx packet, rxstat = %#08x\n", - sc->sc_dev.dv_xname, rxstat); + aprint_error_dev(sc->sc_dev, + "corrupt Rx packet, rxstat = %#08x\n", + rxstat); goto badframe; } @@ -1216,7 +1216,7 @@ temac_rxreap(struct temac_softc *sc) /* Refresh descriptor, bail out if we're out of buffers. */ if (temac_rxalloc(sc, tail, 1) != 0) { sc->sc_rxreap = TEMAC_RXINC(sc->sc_rxreap, -1); - printf("%s: Rx give up for now\n", sc->sc_dev.dv_xname); + aprint_error_dev(sc->sc_dev, "Rx give up for now\n"); break; } } @@ -1224,8 +1224,9 @@ temac_rxreap(struct temac_softc *sc) /* We may now have a contiguous ready-to-go chunk of descriptors. */ if (nseg > 0) { #if TEMAC_RXDEBUG > 0 - printf("%s: rxreap: rxreap %03d -> %03d, nseg %03d\n", - sc->sc_dev.dv_xname, head, sc->sc_rxreap, nseg); + aprint_debug_dev(sc->sc_dev, + "rxreap: rxreap %03d -> %03d, nseg %03d\n", + head, sc->sc_rxreap, nseg); #endif temac_rxcdsync(sc, head, nseg, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); diff --git a/sys/arch/evbppc/virtex/dev/pstwo.c b/sys/arch/evbppc/virtex/dev/pstwo.c index 6eb34a976958..a6efd582b320 100644 --- a/sys/arch/evbppc/virtex/dev/pstwo.c +++ b/sys/arch/evbppc/virtex/dev/pstwo.c @@ -1,4 +1,4 @@ -/* $NetBSD: pstwo.c,v 1.2 2007/02/21 22:59:40 thorpej Exp $ */ +/* $NetBSD: pstwo.c,v 1.3 2011/06/18 06:44:27 matt Exp $ */ /* * Copyright (c) 2006 Jachym Holecek @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pstwo.c,v 1.2 2007/02/21 22:59:40 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pstwo.c,v 1.3 2011/06/18 06:44:27 matt Exp $"); #include #include @@ -57,7 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: pstwo.c,v 1.2 2007/02/21 22:59:40 thorpej Exp $"); #define NEXT(idx) (void)((idx) = ((idx) + 1) % PSTWO_RXBUF_SIZE) struct pstwo_softc { - struct device sc_dev; + device_t sc_dev; void *sc_ih; bus_space_tag_t sc_iot; @@ -82,9 +82,9 @@ static void pstwo_intr_establish(void *, pckbport_slot_t); static void pstwo_set_poll(void *, pckbport_slot_t, int); /* Generic device. */ -static void pstwo_attach(struct device *, struct device *, void *); +static void pstwo_attach(device_t, device_t, void *); -CFATTACH_DECL(pstwo, sizeof(struct pstwo_softc), +CFATTACH_DECL_NEW(pstwo, sizeof(struct pstwo_softc), xcvbus_child_match, pstwo_attach, NULL, NULL); static struct pckbport_accessops pstwo_ops = { @@ -97,26 +97,26 @@ static struct pckbport_accessops pstwo_ops = { }; static void -pstwo_attach(struct device *parent, struct device *self, void *aux) +pstwo_attach(device_t parent, device_t self, void *aux) { struct xcvbus_attach_args *vaa = aux; struct pstwo_softc *sc = device_private(self); int i; - printf(": PS2 port\n"); + aprint_normal(": PS2 port\n"); if ((sc->sc_ih = intr_establish(vaa->vaa_intr, IST_LEVEL, IPL_TTY, pstwo_intr, sc)) == NULL) { - printf("%s: could not establish interrupt\n", - device_xname(self)); - return ; + aprint_error_dev(self, "could not establish interrupt\n"); + return; } + sc->sc_dev = self; sc->sc_iot = vaa->vaa_iot; if (bus_space_map(vaa->vaa_iot, vaa->vaa_addr, PSTWO_SIZE, 0, &sc->sc_ioh) != 0) { - printf("%s: could not map registers\n", device_xname(self)); + aprint_error_dev(self, "could not map registers\n"); return ; } diff --git a/sys/arch/evbppc/virtex/dev/tft_ll.c b/sys/arch/evbppc/virtex/dev/tft_ll.c index 934ea073b077..f8de64b49d9c 100644 --- a/sys/arch/evbppc/virtex/dev/tft_ll.c +++ b/sys/arch/evbppc/virtex/dev/tft_ll.c @@ -1,4 +1,4 @@ -/* $NetBSD: tft_ll.c,v 1.2 2007/03/04 05:59:46 christos Exp $ */ +/* $NetBSD: tft_ll.c,v 1.3 2011/06/18 06:44:27 matt Exp $ */ /* * Copyright (c) 2006 Jachym Holecek @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tft_ll.c,v 1.2 2007/03/04 05:59:46 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tft_ll.c,v 1.3 2011/06/18 06:44:27 matt Exp $"); #include #include @@ -75,11 +75,11 @@ struct ll_tft_softc { bus_dma_segment_t lsc_seg; }; -static void ll_tft_attach(struct device *, struct device *, void *); +static void ll_tft_attach(device_t, device_t, void *); static paddr_t ll_tft_mmap(void *, void *, off_t, int); static void ll_tft_shutdown(void *); -CFATTACH_DECL(ll_tft, sizeof(struct ll_tft_softc), +CFATTACH_DECL_NEW(ll_tft, sizeof(struct ll_tft_softc), xcvbus_child_match, ll_tft_attach, NULL, NULL); @@ -89,11 +89,11 @@ static struct wsdisplay_accessops ll_tft_accessops = { static void -ll_tft_attach(struct device *parent, struct device *self, void *aux) +ll_tft_attach(device_t parent, device_t self, void *aux) { struct xcvbus_attach_args *vaa = aux; struct ll_dmac *tx = vaa->vaa_tx_dmac; - struct ll_tft_softc *lsc = (struct ll_tft_softc *)self; + struct ll_tft_softc *lsc = device_private(self); struct tft_softc *sc = &lsc->lsc_sc; int nseg, error; @@ -102,52 +102,47 @@ ll_tft_attach(struct device *parent, struct device *self, void *aux) lsc->lsc_dma_iot = tx->dmac_iot; lsc->lsc_dmat = vaa->vaa_dmat; sc->sc_iot = vaa->vaa_iot; + sc->sc_dev = self; - printf(": LL_TFT\n"); + aprint_normal(": LL_TFT\n"); if ((error = bus_space_map(sc->sc_iot, vaa->vaa_addr, TFT_SIZE, 0, &sc->sc_ioh)) != 0) { - printf("%s: could not map device registers\n", - device_xname(self)); + aprint_error_dev(self, "could not map device registers\n"); goto fail_0; } if ((error = bus_space_map(lsc->lsc_dma_iot, tx->dmac_ctrl_addr, CDMAC_CTRL_SIZE, 0, &lsc->lsc_dma_ioh)) != 0) { - printf("%s: could not map dmac registers\n", - device_xname(self)); + aprint_error_dev(self, "could not map dmac registers\n"); goto fail_1; } /* Fill in resolution, depth, size. */ - tft_mode(&sc->sc_dev); + tft_mode(sc->sc_dev); /* Allocate and map framebuffer control data. */ if ((error = bus_dmamem_alloc(lsc->lsc_dmat, sizeof(struct ll_tft_control) + sc->sc_size, 8, 0, &lsc->lsc_seg, 1, &nseg, 0)) != 0) { - printf("%s: could not allocate framebuffer\n", - device_xname(self)); + aprint_error_dev(self, "could not allocate framebuffer\n"); goto fail_2; } if ((error = bus_dmamem_map(lsc->lsc_dmat, &lsc->lsc_seg, nseg, sizeof(struct ll_tft_control) + sc->sc_size, (void **)&lsc->lsc_cd, BUS_DMA_COHERENT)) != 0) { - printf("%s: could not map framebuffer\n", - device_xname(self)); + aprint_error_dev(self, "could not map framebuffer\n"); goto fail_3; } if ((error = bus_dmamap_create(lsc->lsc_dmat, sizeof(struct ll_tft_control) + sc->sc_size, 1, sizeof(struct ll_tft_control) + sc->sc_size, 0, 0, &lsc->lsc_dmap)) != 0) { - printf("%s: could not create framebuffer DMA map\n", - device_xname(self)); + aprint_error_dev(self, "could not create framebuffer DMA map\n"); goto fail_4; } if ((error = bus_dmamap_load(lsc->lsc_dmat, lsc->lsc_dmap, lsc->lsc_cd, sizeof(struct ll_tft_control) + sc->sc_size, NULL, 0)) != 0) { - printf("%s: could not load framebuffer DMA map\n", - device_xname(self)); + aprint_error_dev(self, "could not load framebuffer DMA map\n"); goto fail_5; } @@ -167,12 +162,12 @@ ll_tft_attach(struct device *parent, struct device *self, void *aux) sc->sc_sdhook = shutdownhook_establish(ll_tft_shutdown, sc); if (sc->sc_sdhook == NULL) - printf("%s: WARNING: unable to establish shutdown hook\n", - device_xname(self)); + aprint_error_dev(self, + "WARNING: unable to establish shutdown hook\n"); tft_attach(self, &ll_tft_accessops); - printf("%s: video memory pa 0x%08x\n", device_xname(self), + aprint_normal_dev(self, "video memory pa 0x%08x\n", (uint32_t)lsc->lsc_cd->cd_dsc.desc_addr); /* Timing sensitive... */ @@ -195,7 +190,7 @@ ll_tft_attach(struct device *parent, struct device *self, void *aux) fail_1: bus_space_unmap(sc->sc_iot, sc->sc_ioh, TFT_SIZE); fail_0: - printf("%s: error %d\n", device_xname(self), error); + aprint_error_dev(self, "error %d\n", error); } static paddr_t diff --git a/sys/arch/evbppc/virtex/dev/tft_plb.c b/sys/arch/evbppc/virtex/dev/tft_plb.c index 2c0304e259fe..41cafbac0bf3 100644 --- a/sys/arch/evbppc/virtex/dev/tft_plb.c +++ b/sys/arch/evbppc/virtex/dev/tft_plb.c @@ -1,4 +1,4 @@ -/* $NetBSD: tft_plb.c,v 1.3 2009/10/25 09:32:25 ahoka Exp $ */ +/* $NetBSD: tft_plb.c,v 1.4 2011/06/18 06:44:27 matt Exp $ */ /* * Copyright (c) 2006 Jachym Holecek @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tft_plb.c,v 1.3 2009/10/25 09:32:25 ahoka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tft_plb.c,v 1.4 2011/06/18 06:44:27 matt Exp $"); #include #include @@ -65,10 +65,10 @@ struct plb_tft_softc { void *sc_sdhook; /* stop DMA */ }; -static void plb_tft_attach(struct device *, struct device *, void *); +static void plb_tft_attach(device_t, device_t, void *); static paddr_t plb_tft_mmap(void *, void *, off_t, int); -CFATTACH_DECL(plb_tft, sizeof(struct plb_tft_softc), +CFATTACH_DECL_NEW(plb_tft, sizeof(struct plb_tft_softc), xcvbus_child_match, plb_tft_attach, NULL, NULL); @@ -82,7 +82,7 @@ static struct wsdisplay_accessops plb_tft_accessops = { * Generic device. */ static void -plb_tft_attach(struct device *parent, struct device *self, void *aux) +plb_tft_attach(device_t parent, device_t self, void *aux) { struct xcvbus_attach_args *vaa = aux; struct plb_tft_softc *psc = device_private(self); @@ -91,13 +91,13 @@ plb_tft_attach(struct device *parent, struct device *self, void *aux) psc->psc_dmat = vaa->vaa_dmat; sc->sc_iot = vaa->vaa_iot; + sc->sc_dev = self; - printf(": PLB_TFT\n"); + aprint_normal(": PLB_TFT\n"); if ((error = bus_space_map(sc->sc_iot, vaa->vaa_addr, TFT_SIZE, 0, &sc->sc_ioh)) != 0) { - printf("%s: could not map device registers\n", - device_xname(self)); + aprint_error_dev(self, "could not map device registers\n"); goto fail_0; } @@ -107,26 +107,22 @@ plb_tft_attach(struct device *parent, struct device *self, void *aux) /* Allocate and map framebuffer control data. */ if ((error = bus_dmamem_alloc(psc->psc_dmat, sc->sc_size, ADDR_ALIGN, 0, &psc->psc_seg, 1, &nseg, 0)) != 0) { - printf("%s: could not allocate framebuffer\n", - device_xname(self)); + aprint_error_dev(self, "could not allocate framebuffer\n"); goto fail_1; } if ((error = bus_dmamem_map(psc->psc_dmat, &psc->psc_seg, nseg, sc->sc_size, &sc->sc_image, BUS_DMA_COHERENT)) != 0) { - printf("%s: could not map framebuffer\n", - device_xname(self)); + aprint_error_dev(self, "could not map framebuffer\n"); goto fail_2; } if ((error = bus_dmamap_create(psc->psc_dmat, sc->sc_size, 1, sc->sc_size, 0, 0, &psc->psc_dmap)) != 0) { - printf("%s: could not create framebuffer DMA map\n", - device_xname(self)); + aprint_error_dev(self, "could not create framebuffer DMA map\n"); goto fail_3; } if ((error = bus_dmamap_load(psc->psc_dmat, psc->psc_dmap, sc->sc_image, sc->sc_size, NULL, 0)) != 0) { - printf("%s: could not load framebuffer DMA map\n", - device_xname(self)); + aprint_error_dev(self, "could not load framebuffer DMA map\n"); goto fail_4; } /* XXX hack, we linear map whole RAM and we have single segment */ @@ -138,7 +134,7 @@ plb_tft_attach(struct device *parent, struct device *self, void *aux) tft_attach(self, &plb_tft_accessops); - printf("%s: video memory pa 0x%08x\n", device_xname(self), + aprint_normal_dev(self, "video memory pa 0x%08x\n", (uint32_t)psc->psc_dmap->dm_segs[0].ds_addr); #if 0 @@ -169,7 +165,7 @@ plb_tft_attach(struct device *parent, struct device *self, void *aux) fail_1: bus_space_unmap(sc->sc_iot, sc->sc_ioh, TFT_SIZE); fail_0: - printf("%s: error %d\n", device_xname(self), error); + aprint_error_dev(self, "error %d\n", error); } static paddr_t diff --git a/sys/arch/evbppc/virtex/dev/tftvar.h b/sys/arch/evbppc/virtex/dev/tftvar.h index d5fb12925412..faf6102b2c73 100644 --- a/sys/arch/evbppc/virtex/dev/tftvar.h +++ b/sys/arch/evbppc/virtex/dev/tftvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: tftvar.h,v 1.3 2011/02/06 23:25:17 jmcneill Exp $ */ +/* $NetBSD: tftvar.h,v 1.4 2011/06/18 06:44:27 matt Exp $ */ /* * Copyright (c) 2006 Jachym Holecek @@ -33,9 +33,9 @@ #define _VIRTEX_DEV_TFTVAR_H_ struct tft_softc { - struct device sc_dev; + device_t sc_dev; - void * sc_image; + void * sc_image; size_t sc_size; bus_space_tag_t sc_iot; diff --git a/sys/arch/evbppc/virtex/dev/xlcom.c b/sys/arch/evbppc/virtex/dev/xlcom.c index 95659af25cef..4a08fb308fa6 100644 --- a/sys/arch/evbppc/virtex/dev/xlcom.c +++ b/sys/arch/evbppc/virtex/dev/xlcom.c @@ -1,4 +1,4 @@ -/* $NetBSD: xlcom.c,v 1.8 2011/04/24 16:26:55 rmind Exp $ */ +/* $NetBSD: xlcom.c,v 1.9 2011/06/18 06:44:27 matt Exp $ */ /* * Copyright (c) 2006 Jachym Holecek @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xlcom.c,v 1.8 2011/04/24 16:26:55 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xlcom.c,v 1.9 2011/06/18 06:44:27 matt Exp $"); #include "opt_kgdb.h" @@ -73,7 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: xlcom.c,v 1.8 2011/04/24 16:26:55 rmind Exp $"); #define XLCOM_RXBUF_SIZE 1024 struct xlcom_softc { - struct device sc_dev; + device_t sc_dev; struct tty *sc_tty; void *sc_ih; @@ -149,34 +149,35 @@ static int xlcom_param(struct tty *, struct termios *); static void xlcom_start(struct tty *); /* Generic device. */ -static void xlcom_attach(struct device *, struct device *, void *); +static void xlcom_attach(device_t, device_t, void *); -CFATTACH_DECL(xlcom, sizeof(struct xlcom_softc), +CFATTACH_DECL_NEW(xlcom, sizeof(struct xlcom_softc), xcvbus_child_match, xlcom_attach, NULL, NULL); static void -xlcom_attach(struct device *parent, struct device *self, void *aux) +xlcom_attach(device_t parent, device_t self, void *aux) { struct xcvbus_attach_args *vaa = aux; - struct xlcom_softc *sc = (struct xlcom_softc *)self; + struct xlcom_softc *sc = device_private(self); struct tty *tp; dev_t dev; - printf(": UartLite serial port\n"); + aprint_normal(": UartLite serial port\n"); + + sc->sc_dev = self; #if defined(KGDB) /* We don't want to share kgdb port with the user. */ if (sc->sc_iot == kgdb_iot && sc->sc_ioh == kgdb_ioh) { - printf("%s: already in use by kgdb\n", device_xname(self)); + aprint_error_dev(self, "already in use by kgdb\n"); return; } #endif /* KGDB */ if ((sc->sc_ih = intr_establish(vaa->vaa_intr, IST_LEVEL, IPL_SERIAL, xlcom_intr, sc)) == NULL) { - printf("%s: could not establish interrupt\n", - device_xname(self)); + aprint_error_dev(self, "could not establish interrupt\n"); return ; } @@ -189,15 +190,14 @@ xlcom_attach(struct device *parent, struct device *self, void *aux) sc->sc_iot = consdev_iot; sc->sc_ioh = consdev_ioh; - printf("%s: console\n", sc->sc_dev.dv_xname); + aprint_normal_dev(self, "console\n"); } else { sc->sc_iot = vaa->vaa_iot; if (bus_space_map(vaa->vaa_iot, vaa->vaa_addr, XLCOM_SIZE, 0, &sc->sc_ioh) != 0) { - printf("%s: could not map registers\n", - device_xname(self)); - return ; + aprint_error_dev(self, "could not map registers\n"); + return; } /* Reset FIFOs. */ @@ -214,9 +214,9 @@ xlcom_attach(struct device *parent, struct device *self, void *aux) sc->sc_tx_soft = softint_establish(SOFTINT_SERIAL, xlcom_tx_soft, sc); if (sc->sc_rx_soft == NULL || sc->sc_tx_soft == NULL) { - printf("%s: could not establish Rx or Tx softintr\n", - sc->sc_dev.dv_xname); - return ; + aprint_error_dev(self, + "could not establish Rx or Tx softintr\n"); + return; } tp = tty_alloc(); diff --git a/sys/arch/evbppc/virtex/machdep.c b/sys/arch/evbppc/virtex/machdep.c index 7787ed438cf2..093fef203b00 100644 --- a/sys/arch/evbppc/virtex/machdep.c +++ b/sys/arch/evbppc/virtex/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.17 2011/06/15 05:50:49 matt Exp $ */ +/* $NetBSD: machdep.c,v 1.18 2011/06/18 06:44:27 matt Exp $ */ /* * Copyright (c) 2006 Jachym Holecek @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.17 2011/06/15 05:50:49 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.18 2011/06/18 06:44:27 matt Exp $"); #include "opt_compat_netbsd.h" #include "opt_ddb.h" @@ -60,6 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.17 2011/06/15 05:50:49 matt Exp $"); #include #include #include +#include #include @@ -67,7 +68,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.17 2011/06/15 05:50:49 matt Exp $"); #include -#include #include #include #include @@ -75,6 +75,8 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.17 2011/06/15 05:50:49 matt Exp $"); #include #include +#include + #include #include diff --git a/sys/arch/evbppc/walnut/autoconf.c b/sys/arch/evbppc/walnut/autoconf.c index be5248a3683e..79ccbd3ee25b 100644 --- a/sys/arch/evbppc/walnut/autoconf.c +++ b/sys/arch/evbppc/walnut/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.18 2010/03/18 14:04:07 kiyohara Exp $ */ +/* $NetBSD: autoconf.c,v 1.19 2011/06/18 06:44:28 matt Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,15 +32,17 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.18 2010/03/18 14:04:07 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.19 2011/06/18 06:44:28 matt Exp $"); #include #include #include #include +#include #include /* For COM_FREQ */ +#include #include #include #include @@ -69,9 +71,6 @@ cpu_configure(void) if (config_rootfound("plb", &local_plb_devs) == NULL) panic("configure: plb not configured"); - printf("biomask %x netmask %x ttymask %x\n", - imask[IPL_BIO], imask[IPL_NET], imask[IPL_TTY]); - (void)spl0(); /* @@ -92,9 +91,9 @@ cpu_rootconf(void) } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { - struct device *parent = device_parent(dev); + device_t parent = device_parent(dev); if (device_is_a(dev, "com") && device_is_a(parent, "opb")) { /* Set the frequency of the on-chip UART. */ @@ -104,7 +103,7 @@ device_register(struct device *dev, void *aux) if (prop_dictionary_set(device_properties(dev), "clock-frequency", pn) == false) { printf("WARNING: unable to set clock-frequency " - "property for %s\n", dev->dv_xname); + "property for %s\n", device_xname(dev)); } prop_object_release(pn); return; diff --git a/sys/arch/evbppc/walnut/machdep.c b/sys/arch/evbppc/walnut/machdep.c index 851d82a84afc..704200f71604 100644 --- a/sys/arch/evbppc/walnut/machdep.c +++ b/sys/arch/evbppc/walnut/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.50 2011/06/15 05:50:49 matt Exp $ */ +/* $NetBSD: machdep.c,v 1.51 2011/06/18 06:44:28 matt Exp $ */ /* * Copyright 2001, 2002 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.50 2011/06/15 05:50:49 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.51 2011/06/18 06:44:28 matt Exp $"); #include "opt_compat_netbsd.h" #include "opt_ddb.h" @@ -91,6 +91,8 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.50 2011/06/15 05:50:49 matt Exp $"); #include #include #include +#include +#include #include @@ -98,7 +100,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.50 2011/06/15 05:50:49 matt Exp $"); #include -#include #include #include #include @@ -106,6 +107,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.50 2011/06/15 05:50:49 matt Exp $"); #include #include +#include #include #include diff --git a/sys/arch/evbppc/walnut/pci/pchb.c b/sys/arch/evbppc/walnut/pci/pchb.c index 20098bf04894..e34148665598 100644 --- a/sys/arch/evbppc/walnut/pci/pchb.c +++ b/sys/arch/evbppc/walnut/pci/pchb.c @@ -1,4 +1,4 @@ -/* $NetBSD: pchb.c,v 1.11 2011/06/06 17:13:06 matt Exp $ */ +/* $NetBSD: pchb.c,v 1.12 2011/06/18 06:44:28 matt Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.11 2011/06/06 17:13:06 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.12 2011/06/18 06:44:28 matt Exp $"); #include "pci.h" #include "opt_pci.h" @@ -138,7 +138,7 @@ pchbattach(device_t parent, device_t self, void *aux) class = pci_conf_read(pc, tag, PCI_CLASS_REG); id = pci_conf_read(pc, tag, PCI_ID_REG); - printf("\n"); + aprint_normal("\n"); pcifound = true; /* * All we do is print out a description. Eventually, we @@ -147,7 +147,7 @@ pchbattach(device_t parent, device_t self, void *aux) */ pci_devinfo(id, class, 0, devinfo, sizeof(devinfo)); - printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo, + aprprint_normal_dev(self, "%s (rev. 0x%02x)\n", devinfo, PCI_REVISION(class)); pci_machdep_init(); /* Redundant... */