Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/atari Split device_t/softc. No crash on TT030.



details:   https://anonhg.NetBSD.org/src/rev/311cd08c417d
branches:  trunk
changeset: 765757:311cd08c417d
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Jun 05 06:33:42 2011 +0000

description:
Split device_t/softc. No crash on TT030.

diffstat:

 sys/arch/atari/dev/atari5380.c  |  11 +++++------
 sys/arch/atari/dev/clock.c      |  34 ++++++++++++++++++----------------
 sys/arch/atari/dev/ncr5380.c    |  28 ++++++++++++++++------------
 sys/arch/atari/dev/ncr5380reg.h |   4 ++--
 sys/arch/atari/dev/nvram.c      |  35 ++++++++++++++++++-----------------
 sys/arch/atari/dev/nvramvar.h   |   6 +++---
 sys/arch/atari/vme/vme.c        |  24 ++++++++++++------------
 sys/arch/atari/vme/vmevar.h     |   4 ++--
 8 files changed, 76 insertions(+), 70 deletions(-)

diffs (truncated from 440 to 300 lines):

diff -r 2b02b2299e71 -r 311cd08c417d sys/arch/atari/dev/atari5380.c
--- a/sys/arch/atari/dev/atari5380.c    Sun Jun 05 06:31:41 2011 +0000
+++ b/sys/arch/atari/dev/atari5380.c    Sun Jun 05 06:33:42 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atari5380.c,v 1.56 2010/04/17 12:54:29 tsutsui Exp $   */
+/*     $NetBSD: atari5380.c,v 1.57 2011/06/05 06:33:42 tsutsui Exp $   */
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atari5380.c,v 1.56 2010/04/17 12:54:29 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atari5380.c,v 1.57 2011/06/05 06:33:42 tsutsui Exp $");
 
 #include "opt_atariscsi.h"
 
@@ -100,8 +100,7 @@
 
 static uint8_t *alloc_bounceb(u_long);
 static void    free_bounceb(uint8_t *);
-static int     machine_match(struct device *, void *, void *,
-                   struct cfdriver *);
+static int     machine_match(device_t, cfdata_t, void *, struct cfdriver *);
 
 void   scsi_ctrl(int);
 void   scsi_dma(int);
@@ -1102,11 +1101,11 @@
  * Our autoconfig matching function
  */
 static int
-machine_match(struct device *pdp, void *match, void *auxp, struct cfdriver *cd)
+machine_match(device_t parent, cfdata_t cf, void *aux, struct cfdriver *cd)
 {
        static int we_matched = 0; /* Only one unit     */
 
-       if (strcmp(auxp, cd->cd_name) || we_matched)
+       if (strcmp(aux, cd->cd_name) || we_matched)
                return 0;
 
        we_matched = 1;
diff -r 2b02b2299e71 -r 311cd08c417d sys/arch/atari/dev/clock.c
--- a/sys/arch/atari/dev/clock.c        Sun Jun 05 06:31:41 2011 +0000
+++ b/sys/arch/atari/dev/clock.c        Sun Jun 05 06:33:42 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock.c,v 1.52 2011/02/08 20:20:10 rmind Exp $ */
+/*     $NetBSD: clock.c,v 1.53 2011/06/05 06:33:42 tsutsui Exp $       */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.52 2011/02/08 20:20:10 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.53 2011/06/05 06:33:42 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -100,8 +100,9 @@
  */
 
 struct clock_softc {
-       struct device   sc_dev;
+       device_t        sc_dev;
        int             sc_flags;
+       struct todr_chip_handle sc_handle;
 };
 
 /*
@@ -114,10 +115,10 @@
 dev_type_read(rtcread);
 dev_type_write(rtcwrite);
 
-static void    clockattach(struct device *, struct device *, void *);
-static int     clockmatch(struct device *, struct cfdata *, void *);
+static void    clockattach(device_t, device_t, void *);
+static int     clockmatch(device_t, cfdata_t, void *);
 
-CFATTACH_DECL(clock, sizeof(struct clock_softc),
+CFATTACH_DECL_NEW(clock, sizeof(struct clock_softc),
     clockmatch, clockattach, NULL, NULL);
 
 const struct cdevsw rtc_cdevsw = {
@@ -147,10 +148,10 @@
 #endif
 
 int
-clockmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+clockmatch(device_t parent, cfdata_t cf, void *aux)
 {
 
-       if (!strcmp("clock", auxp))
+       if (!strcmp("clock", aux))
                return 1;
        return 0;
 }
@@ -158,17 +159,18 @@
 /*
  * Start the real-time clock.
  */
-void clockattach(struct device *pdp, struct device *dp, void *auxp)
+void clockattach(device_t parent, device_t self, void *aux)
 {
-
-       struct clock_softc *sc = (void *)dp;
-       static struct todr_chip_handle  tch;
+       struct clock_softc *sc = device_private(self);
+       struct todr_chip_handle *tch;
 
-       tch.todr_gettime_ymdhms = atari_rtc_get;
-       tch.todr_settime_ymdhms = atari_rtc_set;
-       tch.todr_setwen = NULL;
+       sc->sc_dev = self;
+       tch = &sc->sc_handle;
+       tch->todr_gettime_ymdhms = atari_rtc_get;
+       tch->todr_settime_ymdhms = atari_rtc_set;
+       tch->todr_setwen = NULL;
 
-       todr_attach(&tch);
+       todr_attach(tch);
 
        sc->sc_flags = 0;
 
diff -r 2b02b2299e71 -r 311cd08c417d sys/arch/atari/dev/ncr5380.c
--- a/sys/arch/atari/dev/ncr5380.c      Sun Jun 05 06:31:41 2011 +0000
+++ b/sys/arch/atari/dev/ncr5380.c      Sun Jun 05 06:33:42 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ncr5380.c,v 1.68 2010/04/17 12:54:29 tsutsui Exp $     */
+/*     $NetBSD: ncr5380.c,v 1.69 2011/06/05 06:33:42 tsutsui Exp $     */
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ncr5380.c,v 1.68 2010/04/17 12:54:29 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ncr5380.c,v 1.69 2011/06/05 06:33:42 tsutsui Exp $");
 
 /*
  * Bit mask of targets you want debugging to be shown
@@ -182,27 +182,28 @@
 #define CFSTRING(n)    __STRING(n)
 #define        CFDRNAME(n)     n
 
-CFATTACH_DECL(CFDRNAME(DRNAME), sizeof(struct ncr_softc),
+CFATTACH_DECL_NEW(CFDRNAME(DRNAME), sizeof(struct ncr_softc),
     ncr_match, ncr_attach, NULL, NULL);
 
 extern struct cfdriver CFNAME(DRNAME);
 
 int
-ncr_match(struct device *pdp, struct cfdata *cfp, void *auxp)
+ncr_match(device_t parent, cfdata_t cf, void *aux)
 {
 
-       return machine_match(pdp, cfp, auxp, &CFNAME(DRNAME));
+       return machine_match(parent, cf, aux, &CFNAME(DRNAME));
 }
 
 void
-ncr_attach(struct device *pdp, struct device *dp, void *auxp)
+ncr_attach(device_t parent, device_t self, void *aux)
 {
        struct ncr_softc        *sc;
        int                     i;
 
-       sc = (struct ncr_softc *)dp;
+       sc = device_private(self);
+       sc->sc_dev = self;
 
-       sc->sc_adapter.adapt_dev = &sc->sc_dev;
+       sc->sc_adapter.adapt_dev = self;
        sc->sc_adapter.adapt_openings = 7;
        sc->sc_adapter.adapt_max_periph = 1;
        sc->sc_adapter.adapt_ioctl = NULL;
@@ -250,7 +251,7 @@
        /*
         * attach all scsi units on us
         */
-       config_found(dp, &sc->sc_channel, scsiprint);
+       config_found(self, &sc->sc_channel, scsiprint);
 }
 
 /*
@@ -266,11 +267,13 @@
 {
        struct scsipi_xfer *xs;
        struct scsipi_periph *periph;
-       struct ncr_softc *sc = (void *)chan->chan_adapter->adapt_dev;
+       struct ncr_softc *sc;
        int     sps;
        SC_REQ  *reqp, *link, *tmp;
        int     flags;
 
+       sc = device_private(chan->chan_adapter->adapt_dev);
+
        switch (req) {
        case ADAPTER_REQ_RUN_XFER:
                xs = arg;
@@ -714,7 +717,8 @@
        uint8_t                 targ_bit;
        struct ncr_softc        *sc;
 
-       sc = (void *)reqp->xs->xs_periph->periph_channel->chan_adapter->adapt_dev;
+       sc = device_private(
+           reqp->xs->xs_periph->periph_channel->chan_adapter->adapt_dev);
        DBG_SELPRINT ("Starting arbitration\n", 0);
        PID("scsi_select1");
 
@@ -1958,7 +1962,7 @@
        vsnprintf(buf, sizeof(buf), fmt, ap);
        va_end(ap);
 
-       printf("%s: %s", sc->sc_dev.dv_xname, buf);
+       printf("%s: %s", device_xname(sc->sc_dev), buf);
 }
 /****************************************************************************
  *             Start Debugging Functions                                   *
diff -r 2b02b2299e71 -r 311cd08c417d sys/arch/atari/dev/ncr5380reg.h
--- a/sys/arch/atari/dev/ncr5380reg.h   Sun Jun 05 06:31:41 2011 +0000
+++ b/sys/arch/atari/dev/ncr5380reg.h   Sun Jun 05 06:33:42 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ncr5380reg.h,v 1.22 2010/04/13 13:30:37 tsutsui Exp $  */
+/*     $NetBSD: ncr5380reg.h,v 1.23 2011/06/05 06:33:42 tsutsui Exp $  */
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -152,7 +152,7 @@
 #define        INTR_DMA        3
 
 struct ncr_softc {
-       struct  device          sc_dev;
+       device_t                sc_dev;
        struct  scsipi_channel  sc_channel;
        struct  scsipi_adapter  sc_adapter;
 
diff -r 2b02b2299e71 -r 311cd08c417d sys/arch/atari/dev/nvram.c
--- a/sys/arch/atari/dev/nvram.c        Sun Jun 05 06:31:41 2011 +0000
+++ b/sys/arch/atari/dev/nvram.c        Sun Jun 05 06:33:42 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nvram.c,v 1.18 2010/04/13 09:51:07 tsutsui Exp $       */
+/*     $NetBSD: nvram.c,v 1.19 2011/06/05 06:33:43 tsutsui Exp $       */
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvram.c,v 1.18 2010/04/13 09:51:07 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvram.c,v 1.19 2011/06/05 06:33:43 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -61,26 +61,26 @@
 /*
  * Auto config stuff....
  */
-static void    nvr_attach(struct device *, struct device *, void *);
-static int     nvr_match(struct device *, struct cfdata *, void *);
+static void    nvr_attach(device_t, device_t, void *);
+static int     nvr_match(device_t, cfdata_t, void *);
 
-CFATTACH_DECL(nvr, sizeof(struct nvr_softc),
+CFATTACH_DECL_NEW(nvr, sizeof(struct nvr_softc),
     nvr_match, nvr_attach, NULL, NULL);
 
 /*ARGSUSED*/
 static int
-nvr_match(struct device *pdp, struct cfdata *cfp, void *auxp)
+nvr_match(device_t parent, cfdata_t cf, void *aux)
 {
-       if (!strcmp((char *)auxp, "nvr"))
+       if (!strcmp((char *)aux, "nvr"))
                return (1);
        return (0);
 }
 
 /*ARGSUSED*/
 static void
-nvr_attach(device_t pdp, device_t dp, void *auxp)
+nvr_attach(device_t parent, device_t self, void *aux)
 {
-       struct nvr_softc        *nvr_soft;
+       struct nvr_softc        *sc;
        int                     nreg;
        
        /*
@@ -92,8 +92,9 @@
                        mc146818_write(RTC, nreg, 0);
                nvram_set_csum(nvram_csum());
        }
-       nvr_soft = device_lookup_private(&nvr_cd, 0);
-       nvr_soft->nvr_flags = NVR_CONFIGURED;
+       sc = device_private(self);
+       sc->sc_dev = self;
+       sc->sc_flags = NVR_CONFIGURED;



Home | Main Index | Thread Index | Old Index