Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci - Forget to report events from logical devices.



details:   https://anonhg.NetBSD.org/src/rev/895b42caadf4
branches:  trunk
changeset: 513422:895b42caadf4
user:      ad <ad%NetBSD.org@localhost>
date:      Mon Jul 30 23:46:28 2001 +0000

description:
- Forget to report events from logical devices.
- Cosmetic changes.

diffstat:

 sys/dev/pci/mly.c |  59 +++++++++++++++++++++++-------------------------------
 1 files changed, 25 insertions(+), 34 deletions(-)

diffs (146 lines):

diff -r af731d5b1b17 -r 895b42caadf4 sys/dev/pci/mly.c
--- a/sys/dev/pci/mly.c Mon Jul 30 23:29:08 2001 +0000
+++ b/sys/dev/pci/mly.c Mon Jul 30 23:46:28 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mly.c,v 1.2 2001/07/30 23:29:08 ad Exp $       */
+/*     $NetBSD: mly.c,v 1.3 2001/07/30 23:46:28 ad Exp $       */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -563,25 +563,16 @@
 static void
 mly_scan_channel(struct mly_softc *mly, int bus)
 {
-       int startbus, endbus, s, target;
-
-       if (bus == -1) {
-               startbus = 0;
-               endbus = mly->mly_nchans - 1;
-       } else {
-               startbus = bus;
-               endbus = bus;
-       }
+       int s, target;
 
-       for (bus = startbus; bus <= endbus; bus++)
-               for (target = 0; target < MLY_MAX_TARGETS; target++) {
-                       s = splbio();
-                       if (!mly_scan_btl(mly, bus, target)) {
-                               tsleep(&mly->mly_btl[bus][target], PRIBIO,
-                                   "mlyscan", 0);
-                       }
-                       splx(s);
+       for (target = 0; target < MLY_MAX_TARGETS; target++) {
+               s = splbio();
+               if (!mly_scan_btl(mly, bus, target)) {
+                       tsleep(&mly->mly_btl[bus][target], PRIBIO, "mlyscan",
+                           0);
                }
+               splx(s);
+       }
 }
 
 /*
@@ -691,16 +682,15 @@
        /*
         * Dispatch the command.
         */
-       if ((rv = mly_ccb_map(mly, mc)) != 0)
-               goto bad;
+       if ((rv = mly_ccb_map(mly, mc)) != 0) {
+               free(mc->mc_data, M_DEVBUF);
+               mly_ccb_free(mly, mc);
+               return(rv);
+       }
+
        mly->mly_btl[bus][target].mb_flags |= MLY_BTL_SCANNING;
        mly_ccb_enqueue(mly, mc);
        return (0);
-
- bad:
-       free(mc->mc_data, M_DEVBUF);
-       mly_ccb_free(mly, mc);
-       return(rv);
 }
 
 /*
@@ -735,7 +725,6 @@
                target = MLY_PHYADDR_TARGET(tmp);
        }
 
-       /* XXX Validate bus/target? */
        btlp = &mly->mly_btl[bus][target];
 
        /* The default result is 'no device'. */
@@ -752,7 +741,7 @@
 
                if (MLY_LOGDEV_BUS(mly, tmp) != bus ||
                    MLY_LOGDEV_TARGET(mly, tmp) != target) {
-#ifdef MLYDEBUG_OBNOXIOUS
+#ifdef MLYDEBUG
                        printf("%s: WARNING: BTL rescan (logical) for %d:%d "
                            "returned data for %d:%d instead\n", 
                           mly->mly_dv.dv_xname, bus, target,
@@ -769,7 +758,7 @@
                pdi = (struct mly_ioctl_getphysdevinfovalid *)mc->mc_data;
 
                if (pdi->channel != bus || pdi->target != target) {
-#ifdef MLYDEBUG_OBNOXIOUS
+#ifdef MLYDEBUG
                        printf("%s: WARNING: BTL rescan (physical) for %d:%d "
                            " returned data for %d:%d instead\n", 
                           mly->mly_dv.dv_xname,
@@ -852,7 +841,7 @@
 }
 
 /*
- * Enable the memory mailbox mode.
+ * Enable memory mailbox mode.
  */
 static int
 mly_enable_mmbox(struct mly_softc *mly)
@@ -912,10 +901,9 @@
 /*
  * Perform an ioctl command.
  *
- * If (data) is not NULL, the command requires data transfer.  If (*data) is
- * NULL the command requires data transfer from the controller, and we will
- * allocate a buffer for it.  If (*data) is not NULL, the command requires
- * data transfer to the controller.
+ * If (data) is not NULL, the command requires data transfer to the
+ * controller.  If (*data) is NULL the command requires data transfer from
+ * the controller, and we will allocate a buffer for it.
  */
 static int
 mly_ioctl(struct mly_softc *mly, struct mly_cmd_ioctl *ioctl, void **data,
@@ -1199,6 +1187,8 @@
                 */
                bus = MLY_LOGDEV_BUS(mly, me->lun);
                target = MLY_LOGDEV_TARGET(mly, me->lun);
+               printf("%s: logical device %d %s\n", mly->mly_dv.dv_xname,
+                   me->lun, tp);
                if (action == 'r')
                        mly->mly_btl[bus][target].mb_flags |= MLY_BTL_RESCAN;
                break;
@@ -1608,12 +1598,12 @@
        mc->mc_flags = 0;
        mc->mc_complete = NULL;
        mc->mc_private = NULL;
+       mc->mc_packet->generic.command_control = 0;
 
        /*
         * By default, we set up to overwrite the command packet with sense
         * information.
         */
-       mc->mc_packet->generic.command_control = 0;
        mc->mc_packet->generic.sense_buffer_address =
            htole64(mc->mc_packetphys);
        mc->mc_packet->generic.maximum_sense_size =
@@ -1893,6 +1883,7 @@
                 */
                ss->command_control |= MLY_CMDCTL_DISABLE_DISCONNECT;
 #endif
+
                if ((xs->xs_control & XS_CTL_DATA_OUT) != 0)
                        mc->mc_flags |= MLY_CCB_DATAOUT;
                else if ((xs->xs_control & XS_CTL_DATA_IN) != 0)



Home | Main Index | Thread Index | Old Index