Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/iomd device_t/softc split



details:   https://anonhg.NetBSD.org/src/rev/1e807dfe696d
branches:  trunk
changeset: 779262:1e807dfe696d
user:      skrll <skrll%NetBSD.org@localhost>
date:      Mon May 14 10:38:08 2012 +0000

description:
device_t/softc split
struct device * -> device_t
struct cfdata * -> cfdata_t
Use aprint*

diffstat:

 sys/arch/arm/iomd/iomd.c       |  67 ++++++++++++++++++++---------------------
 sys/arch/arm/iomd/iomd_clock.c |  35 +++++++++++----------
 sys/arch/arm/iomd/iomdiic.c    |  22 ++++++++-----
 sys/arch/arm/iomd/iomdkbc.c    |  29 +++++++++--------
 sys/arch/arm/iomd/qms.c        |  25 ++++++++-------
 sys/arch/arm/iomd/vidc20.c     |  31 +++++++++----------
 sys/arch/arm/iomd/vidcaudio.c  |  22 ++++++------
 sys/arch/arm/iomd/vidcvideo.c  |  22 +++++++------
 8 files changed, 130 insertions(+), 123 deletions(-)

diffs (truncated from 833 to 300 lines):

diff -r 4cc07d26545a -r 1e807dfe696d sys/arch/arm/iomd/iomd.c
--- a/sys/arch/arm/iomd/iomd.c  Mon May 14 10:05:50 2012 +0000
+++ b/sys/arch/arm/iomd/iomd.c  Mon May 14 10:38:08 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iomd.c,v 1.18 2012/05/10 09:56:27 skrll Exp $  */
+/*     $NetBSD: iomd.c,v 1.19 2012/05/14 10:38:08 skrll Exp $  */
 
 /*
  * Copyright (c) 1996-1997 Mark Brinicombe.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iomd.c,v 1.18 2012/05/10 09:56:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iomd.c,v 1.19 2012/05/14 10:38:08 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -74,19 +74,17 @@
  */
 
 struct iomd_softc {
-       struct device           sc_dev; /* device node */
+       device_t                        sc_dev; /* device node */
        bus_space_tag_t         sc_iot; /* bus tag */
        bus_space_handle_t      sc_ioh; /* bus handle */
        int                     sc_id;  /* IOMD id */
 };
 
-static int iomdmatch(struct device *parent, struct cfdata *cf,
-                             void *aux);
-static void iomdattach(struct device *parent, struct device *self,
-                             void *aux);
+static int iomdmatch(device_t parent, cfdata_t cf, void *aux);
+static void iomdattach(device_t parent, device_t self, void *aux);
 static int iomdprint(void *aux, const char *iomdbus);
 
-CFATTACH_DECL(iomd, sizeof(struct iomd_softc),
+CFATTACH_DECL_NEW(iomd, sizeof(struct iomd_softc),
     iomdmatch, iomdattach, NULL, NULL);
 
 extern struct bus_space iomd_bs_tag;
@@ -115,13 +113,13 @@
 }
 
 /*
- * int iomdmatch(struct device *parent, struct cfdata *cf, void *aux)
+ * int iomdmatch(device_t parent, cfdata_t cf, void *aux)
  *
  * Just return ok for this if it is device 0
  */ 
  
 static int
-iomdmatch(struct device *parent, struct cfdata *cf, void *aux)
+iomdmatch(device_t parent, cfdata_t cf, void *aux)
 {
 
        if (iomd_found)
@@ -131,16 +129,16 @@
 
 
 /*
- * void iomdattach(struct device *parent, struct device *dev, void *aux)
+ * void iomdattach(device_t parent, device_t dev, void *aux)
  *
  * Map the IOMD and identify it.
  * Then configure the child devices based on the IOMD ID.
  */
   
 static void
-iomdattach(struct device *parent, struct device *self, void *aux)
+iomdattach(device_t parent, device_t self, void *aux)
 {
-       struct iomd_softc *sc = (struct iomd_softc *)self;
+       struct iomd_softc *sc = device_private(self);
 /*     struct mainbus_attach_args *mb = aux;*/
        int refresh;
 #if 0
@@ -153,6 +151,7 @@
        /* There can be only 1 IOMD. */
        iomd_found = 1;
 
+       sc->sc_dev = self;
        iot = sc->sc_iot = &iomd_bs_tag;
 
        /* Map the IOMD */
@@ -164,75 +163,75 @@
        /* Get the ID */
        sc->sc_id = bus_space_read_1(iot, ioh, IOMD_ID0)
                  | (bus_space_read_1(iot, ioh, IOMD_ID1) << 8);
-       printf(": ");
+       aprint_normal(": ");
 
        /* Identify it and get the DRAM refresh rate */
        switch (sc->sc_id) {
        case ARM7500_IOC_ID:
-               printf("ARM7500 IOMD ");
+               aprint_normal("ARM7500 IOMD ");
                refresh = bus_space_read_1(iot, ioh, IOMD_REFCR) & 0x0f;
                arm7500_ioc_found = 1;
                break;
        case ARM7500FE_IOC_ID:
-               printf("ARM7500FE IOMD ");
+               aprint_normal("ARM7500FE IOMD ");
                refresh = bus_space_read_1(iot, ioh, IOMD_REFCR) & 0x0f;
                arm7500_ioc_found = 1;
                break;
        case RPC600_IOMD_ID:
-               printf("IOMD20 ");
+               aprint_normal("IOMD20 ");
                refresh = bus_space_read_1(iot, ioh, IOMD_VREFCR) & 0x09;
                arm7500_ioc_found = 0;
                break;
        default:
-               printf("Unknown IOMD ID=%04x ", sc->sc_id);
+               aprint_normal("Unknown IOMD ID=%04x ", sc->sc_id);
                refresh = -1;
                arm7500_ioc_found = 0;          /* just in case */
                break;
        }
-       printf("version %d\n", bus_space_read_1(iot, ioh, IOMD_VERSION));
+       aprint_normal("version %d\n", bus_space_read_1(iot, ioh, IOMD_VERSION));
 
        /* Report the DRAM refresh rate */
-       printf("%s: ", self->dv_xname);
-       printf("DRAM refresh=");
+       aprint_normal("%s: ", self->dv_xname);
+       aprint_normal("DRAM refresh=");
        switch (refresh) {
        case 0x0:
-               printf("off");
+               aprint_normal("off");
                break;
        case 0x1:
-               printf("16us");
+               aprint_normal("16us");
                break;
        case 0x2:
-               printf("32us");
+               aprint_normal("32us");
                break;
        case 0x4:
-               printf("64us");
+               aprint_normal("64us");
                break;
        case 0x8:
-               printf("128us");
+               aprint_normal("128us");
                break;
        default:
-               printf("unknown [%02x]", refresh);
+               aprint_normal("unknown [%02x]", refresh);
                break;
        }
 
-       printf("\n");
+       aprint_normal("\n");
 #if 0
        /*
         * No point in reporting this as it may get changed when devices are
         * attached
         */
        tmp = bus_space_read_1(iot, ioh, IOMD_IOTCR);
-       printf("%s: I/O timings: combo %c, NPCCS1/2 %c", self->dv_xname,
+       aprint_normal("%s: I/O timings: combo %c, NPCCS1/2 %c", self->dv_xname,
            'A' + ((tmp >>2) & 3), 'A' + (tmp & 3));
        tmp = bus_space_read_1(iot, ioh, IOMD_ECTCR);
-       printf(", EASI ");
+       aprint_normal(", EASI ");
        for (i = 0; i < 8; i++, tmp >>= 1)
-               printf("%c", 'A' + ((tmp & 1) << 2));
+               aprint_normal("%c", 'A' + ((tmp & 1) << 2));
        tmp = bus_space_read_1(iot, ioh, IOMD_DMATCR);
-       printf(", DMA ");
+       aprint_normal(", DMA ");
        for (i = 0; i < 4; i++, tmp >>= 2)
-               printf("%c", 'A' + (tmp & 3));  
-       printf("\n");
+               aprint_normal("%c", 'A' + (tmp & 3));   
+       aprint_normal("\n");
 #endif
 
        /* Set up the external DMA channels */
diff -r 4cc07d26545a -r 1e807dfe696d sys/arch/arm/iomd/iomd_clock.c
--- a/sys/arch/arm/iomd/iomd_clock.c    Mon May 14 10:05:50 2012 +0000
+++ b/sys/arch/arm/iomd/iomd_clock.c    Mon May 14 10:38:08 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iomd_clock.c,v 1.26 2012/02/18 23:51:27 rmind Exp $    */
+/*     $NetBSD: iomd_clock.c,v 1.27 2012/05/14 10:38:08 skrll Exp $    */
 
 /*
  * Copyright (c) 1994-1997 Mark Brinicombe.
@@ -47,7 +47,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: iomd_clock.c,v 1.26 2012/02/18 23:51:27 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iomd_clock.c,v 1.27 2012/05/14 10:38:08 skrll Exp $");
 
 #include <sys/systm.h>
 #include <sys/types.h>
@@ -65,7 +65,7 @@
 #include <arm/iomd/iomdreg.h>
 
 struct clock_softc {
-       struct device           sc_dev;
+       device_t                sc_dev;
        bus_space_tag_t         sc_iot;
        bus_space_handle_t      sc_ioh;
 };
@@ -78,8 +78,8 @@
 static struct clock_softc *clock_sc;
 static int timer0_count;
 
-static int clockmatch(struct device *parent, struct cfdata *cf, void *aux);
-static void clockattach(struct device *parent, struct device *self, void *aux);
+static int clockmatch(device_t parent, cfdata_t cf, void *aux);
+static void clockattach(device_t parent, device_t self, void *aux);
 #ifdef DIAGNOSTIC
 static void checkdelay(void);
 #endif
@@ -106,17 +106,17 @@
 int clockhandler(void *);
 int statclockhandler(void *);
 
-CFATTACH_DECL(clock, sizeof(struct clock_softc),
+CFATTACH_DECL_NEW(clock, sizeof(struct clock_softc),
     clockmatch, clockattach, NULL, NULL);
 
 /*
- * int clockmatch(struct device *parent, void *match, void *aux)
+ * int clockmatch(device_t parent, void *match, void *aux)
  *
  * Just return ok for this if it is device 0
  */ 
  
 static int
-clockmatch(struct device *parent, struct cfdata *cf, void *aux)
+clockmatch(device_t parent, cfdata_t cf, void *aux)
 {
        struct clk_attach_args *ca = aux;
 
@@ -127,18 +127,19 @@
 
 
 /*
- * void clockattach(struct device *parent, struct device *dev, void *aux)
+ * void clockattach(device_t parent, device_t dev, void *aux)
  *
  * Map the IOMD and identify it.
  * Then configure the child devices based on the IOMD ID.
  */
   
 static void
-clockattach(struct device *parent, struct device *self,        void *aux)
+clockattach(device_t parent, device_t self, void *aux)
 {
-       struct clock_softc *sc = (struct clock_softc *)self;
+       struct clock_softc *sc = device_private(self);
        struct clk_attach_args *ca = aux;
 
+       sc->sc_dev = self;
        sc->sc_iot = ca->ca_iot;
        sc->sc_ioh = ca->ca_ioh; /* This is a handle for the whole IOMD */
 
@@ -146,7 +147,7 @@
 
        /* Cannot do anything until cpu_initclocks() has been called */
        
-       printf("\n");
+       aprint_normal("\n");
 }
 
 
@@ -218,7 +219,7 @@
     
        count = TIMER_FREQUENCY / newhz;
 
-       printf("Setting statclock to %dHz (%d ticks)\n", newhz, count);
+       aprint_normal("Setting statclock to %dHz (%d ticks)\n", newhz, count);
 
        bus_space_write_1(clock_sc->sc_iot, clock_sc->sc_ioh,
            IOMD_T1LOW, (count >> 0) & 0xff);
@@ -246,7 +247,7 @@
                return;
        if (diff.tv_usec > 10000)
                return;
-       printf("WARNING: delay(10000) took %d us\n", diff.tv_usec);
+       aprint_normal("WARNING: delay(10000) took %d us\n", diff.tv_usec);
 }
 #endif
 
@@ -267,7 +268,7 @@
         * This timer generates 100Hz interrupts for the system clock
         */
 
-       printf("clock: hz=%d stathz = %d profhz = %d\n", hz, stathz, profhz);
+       aprint_normal("clock: hz=%d stathz = %d profhz = %d\n", hz, stathz, profhz);
 
        timer0_count = TIMER_FREQUENCY / hz;



Home | Main Index | Thread Index | Old Index