Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Split device_t/softc. Tested on AHA-1520B at ISA and...



details:   https://anonhg.NetBSD.org/src/rev/054234435935
branches:  trunk
changeset: 747583:054234435935
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Tue Sep 22 12:56:06 2009 +0000

description:
Split device_t/softc. Tested on AHA-1520B at ISA and ISAPnP.

XXX: ISA attachment shouldn't match cards in ISAPnP mode.

diffstat:

 sys/dev/ic/aic6360.c        |  62 ++++++++++++++++++++++++--------------------
 sys/dev/ic/aic6360var.h     |   6 ++--
 sys/dev/isa/aic_isa.c       |  16 ++++++-----
 sys/dev/isapnp/aic_isapnp.c |  14 +++++----
 sys/dev/pcmcia/aic_pcmcia.c |  44 +++++++++++++++---------------
 5 files changed, 76 insertions(+), 66 deletions(-)

diffs (truncated from 525 to 300 lines):

diff -r cbd9e1f730ae -r 054234435935 sys/dev/ic/aic6360.c
--- a/sys/dev/ic/aic6360.c      Tue Sep 22 09:57:28 2009 +0000
+++ b/sys/dev/ic/aic6360.c      Tue Sep 22 12:56:06 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aic6360.c,v 1.96 2009/05/12 14:25:17 cegger Exp $      */
+/*     $NetBSD: aic6360.c,v 1.97 2009/09/22 12:56:06 tsutsui Exp $     */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Charles M. Hannum.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aic6360.c,v 1.96 2009/05/12 14:25:17 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic6360.c,v 1.97 2009/09/22 12:56:06 tsutsui Exp $");
 
 #include "opt_ddb.h"
 
@@ -261,7 +261,7 @@
        /*
         * Fill in the scsipi_adapter.
         */
-       adapt->adapt_dev = &sc->sc_dev;
+       adapt->adapt_dev = sc->sc_dev;
        adapt->adapt_nchannels = 1;
        adapt->adapt_openings = 8;
        adapt->adapt_max_periph = 1;
@@ -283,7 +283,7 @@
         * config_found() to make sure the adatper is disabled.
         */
        if (scsipi_adapter_addref(adapt) != 0) {
-               aprint_error_dev(&sc->sc_dev, "unable to enable controller\n");
+               aprint_error_dev(sc->sc_dev, "unable to enable controller\n");
                return;
        }
 
@@ -292,14 +292,14 @@
        /*
         * Ask the adapter what subunits are present
         */
-       sc->sc_child = config_found(&sc->sc_dev, &sc->sc_channel, scsiprint);
+       sc->sc_child = config_found(sc->sc_dev, &sc->sc_channel, scsiprint);
        scsipi_adapter_delref(adapt);
 }
 
 int
 aic_activate(device_t self, enum devact act)
 {
-       struct aic_softc *sc = (struct aic_softc *) self;
+       struct aic_softc *sc = device_private(self);
        int s, rv = 0;
 
        s = splhigh();
@@ -321,7 +321,7 @@
 int
 aic_detach(device_t self, int flags)
 {
-       struct aic_softc *sc = (struct aic_softc *) self;
+       struct aic_softc *sc = device_private(self);
        int rv = 0;
 
        if (sc->sc_child != NULL)
@@ -506,7 +506,7 @@
 {
        struct scsipi_xfer *xs;
        struct scsipi_periph *periph;
-       struct aic_softc *sc = (void *)chan->chan_adapter->adapt_dev;
+       struct aic_softc *sc = device_private(chan->chan_adapter->adapt_dev);
        struct aic_acb *acb;
        int s, flags;
 
@@ -520,7 +520,7 @@
                AIC_CMDS(("[0x%x, %d]->%d ", (int)xs->cmd->opcode, xs->cmdlen,
                    periph->periph_target));
 
-               if (! device_is_active(&sc->sc_dev)) {
+               if (!device_is_active(sc->sc_dev)) {
                        xs->error = XS_DRIVER_STUFFUP;
                        scsipi_done(xs);
                        return;
@@ -756,7 +756,8 @@
         */
        selid = sc->sc_selid & ~(1 << sc->sc_initiator);
        if (selid & (selid - 1)) {
-               aprint_error_dev(&sc->sc_dev, "reselect with invalid selid %02x; "
+               aprint_error_dev(sc->sc_dev,
+                   "reselect with invalid selid %02x; "
                    "sending DEVICE RESET\n", selid);
                AIC_BREAK();
                goto reset;
@@ -778,7 +779,7 @@
        }
        if (acb == NULL) {
                printf("%s: reselect from target %d lun %d with no nexus; "
-                   "sending ABORT\n", device_xname(&sc->sc_dev), target, lun);
+                   "sending ABORT\n", device_xname(sc->sc_dev), target, lun);
                AIC_BREAK();
                goto abort;
        }
@@ -828,7 +829,7 @@
        bus_space_tag_t iot = sc->sc_iot;
        bus_space_handle_t ioh = sc->sc_ioh;
 
-       if (! device_is_active(&sc->sc_dev))
+       if (!device_is_active(sc->sc_dev))
                return;
 
        /*
@@ -1084,7 +1085,8 @@
                        if (sc->sc_dleft < 0) {
                                periph = acb->xs->xs_periph;
                                printf("%s: %ld extra bytes from %d:%d\n",
-                                   device_xname(&sc->sc_dev), (long)-sc->sc_dleft,
+                                   device_xname(sc->sc_dev),
+                                   (long)-sc->sc_dleft,
                                    periph->periph_target, periph->periph_lun);
                                sc->sc_dleft = 0;
                        }
@@ -1194,7 +1196,8 @@
 
                        default:
                                printf("%s: unrecognized MESSAGE EXTENDED; "
-                                   "sending REJECT\n", device_xname(&sc->sc_dev));
+                                   "sending REJECT\n",
+                                   device_xname(sc->sc_dev));
                                AIC_BREAK();
                                goto reject;
                        }
@@ -1202,7 +1205,7 @@
 
                default:
                        printf("%s: unrecognized MESSAGE; sending REJECT\n",
-                           device_xname(&sc->sc_dev));
+                           device_xname(sc->sc_dev));
                        AIC_BREAK();
                reject:
                        aic_sched_msgout(sc, SEND_REJECT);
@@ -1213,7 +1216,7 @@
        case AIC_RESELECTED:
                if (!MSG_ISIDENTIFY(sc->sc_imess[0])) {
                        printf("%s: reselect without IDENTIFY; "
-                           "sending DEVICE RESET\n", device_xname(&sc->sc_dev));
+                           "sending DEVICE RESET\n", device_xname(sc->sc_dev));
                        AIC_BREAK();
                        goto reset;
                }
@@ -1222,7 +1225,8 @@
                break;
 
        default:
-               aprint_error_dev(&sc->sc_dev, "unexpected MESSAGE IN; sending DEVICE RESET\n");
+               aprint_error_dev(sc->sc_dev,
+                   "unexpected MESSAGE IN; sending DEVICE RESET\n");
                AIC_BREAK();
        reset:
                aic_sched_msgout(sc, SEND_DEV_RESET);
@@ -1369,7 +1373,8 @@
                break;
 
        default:
-               aprint_error_dev(&sc->sc_dev, "unexpected MESSAGE OUT; sending NOOP\n");
+               aprint_error_dev(sc->sc_dev,
+                   "unexpected MESSAGE OUT; sending NOOP\n");
                AIC_BREAK();
                sc->sc_omess[0] = MSG_NOOP;
                n = 1;
@@ -1720,7 +1725,7 @@
        struct aic_tinfo *ti;
        int n;
 
-       if (! device_is_active(&sc->sc_dev))
+       if (!device_is_active(sc->sc_dev))
                return (0);
 
        /*
@@ -1739,7 +1744,7 @@
        AIC_MISC(("sstat1:0x%02x ", sstat1));
 
        if ((sstat1 & SCSIRSTI) != 0) {
-               printf("%s: SCSI bus reset\n", device_xname(&sc->sc_dev));
+               printf("%s: SCSI bus reset\n", device_xname(sc->sc_dev));
                goto reset;
        }
 
@@ -1747,7 +1752,7 @@
         * Check for less serious errors.
         */
        if ((sstat1 & SCSIPERR) != 0) {
-               printf("%s: SCSI bus parity error\n", device_xname(&sc->sc_dev));
+               printf("%s: SCSI bus parity error\n", device_xname(sc->sc_dev));
                bus_space_write_1(iot, ioh, CLRSINT1, CLRSCSIPERR);
                if (sc->sc_prevphase == PH_MSGIN) {
                        sc->sc_flags |= AIC_DROP_MSGIN;
@@ -1777,7 +1782,7 @@
                         * We don't currently support target mode.
                         */
                        printf("%s: target mode selected; going to BUS FREE\n",
-                           device_xname(&sc->sc_dev));
+                           device_xname(sc->sc_dev));
                        bus_space_write_1(iot, ioh, SCSISIG, 0);
 
                        goto sched;
@@ -1810,7 +1815,7 @@
                         */
                        if (sc->sc_state != AIC_SELECTING) {
                                printf("%s: selection out while idle; "
-                                   "resetting\n", device_xname(&sc->sc_dev));
+                                   "resetting\n", device_xname(sc->sc_dev));
                                AIC_BREAK();
                                goto reset;
                        }
@@ -1855,7 +1860,7 @@
 
                        if (sc->sc_state != AIC_SELECTING) {
                                printf("%s: selection timeout while idle; "
-                                   "resetting\n", device_xname(&sc->sc_dev));
+                                   "resetting\n", device_xname(sc->sc_dev));
                                AIC_BREAK();
                                goto reset;
                        }
@@ -1873,7 +1878,7 @@
                        if (sc->sc_state != AIC_IDLE) {
                                printf("%s: BUS FREE while not idle; "
                                    "state=%d\n",
-                                   device_xname(&sc->sc_dev), sc->sc_state);
+                                   device_xname(sc->sc_dev), sc->sc_state);
                                AIC_BREAK();
                                goto out;
                        }
@@ -1949,7 +1954,8 @@
                                 * disconnecting, and this is necessary to
                                 * clean up their state.
                                 */
-                               aprint_error_dev(&sc->sc_dev, "unexpected disconnect; "
+                               aprint_error_dev(sc->sc_dev,
+                                   "unexpected disconnect; "
                                    "sending REQUEST SENSE\n");
                                AIC_BREAK();
                                aic_sense(sc, acb);
@@ -2055,7 +2061,7 @@
                goto loop;
        }
 
-       aprint_error_dev(&sc->sc_dev, "unexpected bus phase; resetting\n");
+       aprint_error_dev(sc->sc_dev, "unexpected bus phase; resetting\n");
        AIC_BREAK();
 reset:
        aic_init(sc, 1);
@@ -2106,7 +2112,7 @@
        struct scsipi_xfer *xs = acb->xs;
        struct scsipi_periph *periph = xs->xs_periph;
        struct aic_softc *sc =
-           (void *)periph->periph_channel->chan_adapter->adapt_dev;
+           device_private(periph->periph_channel->chan_adapter->adapt_dev);
        int s;
 
        scsipi_printaddr(periph);
diff -r cbd9e1f730ae -r 054234435935 sys/dev/ic/aic6360var.h
--- a/sys/dev/ic/aic6360var.h   Tue Sep 22 09:57:28 2009 +0000
+++ b/sys/dev/ic/aic6360var.h   Tue Sep 22 12:56:06 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aic6360var.h,v 1.14 2009/05/12 14:25:17 cegger Exp $   */
+/*     $NetBSD: aic6360var.h,v 1.15 2009/09/22 12:56:06 tsutsui Exp $  */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Charles M. Hannum.  All rights reserved.
@@ -115,7 +115,7 @@
 };
 
 struct aic_softc {
-       struct device sc_dev;
+       device_t sc_dev;
 
        bus_space_tag_t sc_iot;
        bus_space_handle_t sc_ioh;
@@ -199,7 +199,7 @@
 #define        AIC_ASSERT(x)   do { \
                        if (! (x)) { \
                                printf("%s at line %d: assertion failed\n", \
-                                   device_xname(&sc->sc_dev), __LINE__); \
+                                   device_xname(sc->sc_dev), __LINE__); \
                                Debugger(); \
                        } } while (/* CONSTCOND */ 0)
 #else
diff -r cbd9e1f730ae -r 054234435935 sys/dev/isa/aic_isa.c
--- a/sys/dev/isa/aic_isa.c     Tue Sep 22 09:57:28 2009 +0000
+++ b/sys/dev/isa/aic_isa.c     Tue Sep 22 12:56:06 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aic_isa.c,v 1.23 2009/05/12 09:10:15 cegger Exp $      */
+/*     $NetBSD: aic_isa.c,v 1.24 2009/09/22 12:56:06 tsutsui Exp $     */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Charles M. Hannum.  All rights reserved.
@@ -51,7 +51,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aic_isa.c,v 1.23 2009/05/12 09:10:15 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic_isa.c,v 1.24 2009/09/22 12:56:06 tsutsui Exp $");
 



Home | Main Index | Thread Index | Old Index