Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/dev/ic Pull up revision 1.39 (requested by bouyer):



details:   https://anonhg.NetBSD.org/src/rev/184f319dfd15
branches:  netbsd-1-5
changeset: 490689:184f319dfd15
user:      he <he%NetBSD.org@localhost>
date:      Mon Feb 26 17:47:46 2001 +0000

description:
Pull up revision 1.39 (requested by bouyer):
  Don't queue new commands to a device which has sense pending.

diffstat:

 sys/dev/ic/siop.c |  61 +++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 44 insertions(+), 17 deletions(-)

diffs (114 lines):

diff -r 5fa6ed256e90 -r 184f319dfd15 sys/dev/ic/siop.c
--- a/sys/dev/ic/siop.c Mon Feb 26 17:47:30 2001 +0000
+++ b/sys/dev/ic/siop.c Mon Feb 26 17:47:46 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: siop.c,v 1.21.2.6 2001/02/04 18:56:39 he Exp $ */
+/*     $NetBSD: siop.c,v 1.21.2.7 2001/02/26 17:47:46 he Exp $ */
 
 /*
  * Copyright (c) 2000 Manuel Bouyer.
@@ -358,6 +358,7 @@
        bus_addr_t dsa;
        struct siop_cbd *cbdp;
        int freetarget = 0;
+       int restart = 0;
 
        istat = bus_space_read_1(sc->sc_rt, sc->sc_rh, SIOP_ISTAT);
        if ((istat & (ISTAT_INTF | ISTAT_DIP | ISTAT_SIP)) == 0)
@@ -945,7 +946,16 @@
        panic("siop_intr: I shouldn't be there !");
        return 1;
 end:
-       CALL_SCRIPT(Ent_script_sched);
+       /*
+        * restart the script now if command completed properly
+        * Otherwise wait for siop_scsicmd_end(), it may need to put
+        * a cmd in front of the queue
+        */
+       if (le32toh(siop_cmd->siop_tables.status) == SCSI_OK &&
+           TAILQ_FIRST(&sc->urgent_list) != NULL)
+               CALL_SCRIPT(Ent_script_sched);
+       else
+               restart = 1;
        siop_scsicmd_end(siop_cmd);
        siop_lun->siop_tag[tag].active = NULL;
        if (siop_cmd->status == CMDST_FREE) {
@@ -955,6 +965,8 @@
                        siop_del_dev(sc, target, lun);
        }
        siop_start(sc);
+       if (restart)
+               CALL_SCRIPT(Ent_script_sched);
        return 1;
 }
 
@@ -1382,11 +1394,12 @@
        /*
         * If the instruction is 0x80000000 (JUMP foo, IF FALSE) the slot is
         * free. As this is the last used slot, all previous slots are free,
-        * we can restart from 0.
+        * we can restart from 1.
+        * slot 0 is reserved for request sense commands.
         */
        if (siop_script_read(sc, (Ent_script_sched_slot0 / 4) + slot * 2) ==
            0x80000000) {
-               slot = sc->sc_currschedslot = 0;
+               slot = sc->sc_currschedslot = 1;
        } else {
                slot++;
        }
@@ -1425,20 +1438,31 @@
                        tag = 0;
                }
                siop_cmd->tag = tag;
-               /* find a free scheduler slot and load it */
-               for (; slot < SIOP_NSLOTS; slot++) {
-                       /*
-                        * If cmd if 0x80000000 the slot is free
-                        */
-                       if (siop_script_read(sc,
-                           (Ent_script_sched_slot0 / 4) + slot * 2) ==
-                           0x80000000)
-                               break;
+               /*
+                * find a free scheduler slot and load it. If it's a request
+                * sense we need to use slot 0.
+                */
+               if (siop_cmd->status != CMDST_SENSE) {
+                       for (; slot < SIOP_NSLOTS; slot++) {
+                               /*
+                                * If cmd if 0x80000000 the slot is free
+                                */
+                               if (siop_script_read(sc,
+                                   (Ent_script_sched_slot0 / 4) + slot * 2) ==
+                                   0x80000000)
+                                       break;
+                       }
+                       /* no more free slot, no need to continue */
+                       if (slot == SIOP_NSLOTS) {
+                               goto end;
+                       }
+               } else {
+                       slot = 0;
+                       if (siop_script_read(sc, Ent_script_sched_slot0 / 4)
+                           != 0x80000000) 
+                               goto end;
                }
-               /* no more free slot, no need to continue */
-               if (slot == SIOP_NSLOTS) {
-                       goto end;
-               }
+
 #ifdef SIOP_DEBUG_SCHED
                printf("using slot %d for DSA 0x%lx\n", slot,
                    (u_long)siop_cmd->dsa);
@@ -1512,6 +1536,9 @@
                 */
                siop_script_write(sc, (Ent_script_sched_slot0 / 4) + slot * 2,
                    0x80080000);
+               /* if we're using the request sense slot, stop here */
+               if (slot == 0)
+                       goto end;
                sc->sc_currschedslot = slot;
                slot++;
        }



Home | Main Index | Thread Index | Old Index