no XS_NO_CCB for vax/ncr(4) or sparc/si(4)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

no XS_NO_CCB for vax/ncr(4) or sparc/si(4)

David Gwynne-5
can anyone compile or even test this on a sparc or vax for me?

cheers,
dlg

Index: ncr5380sbc.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/ncr5380sbc.c,v
retrieving revision 1.30
diff -u -p -r1.30 ncr5380sbc.c
--- ncr5380sbc.c 17 Jul 2011 22:46:48 -0000 1.30
+++ ncr5380sbc.c 18 Jan 2014 01:14:57 -0000
@@ -88,6 +88,9 @@
 #include <dev/ic/ncr5380reg.h>
 #include <dev/ic/ncr5380var.h>
 
+static void * ncr5380_io_get(void *);
+static void ncr5380_io_put(void *, void *);
+
 static void ncr5380_sched(struct ncr5380_softc *);
 static void ncr5380_done(struct ncr5380_softc *);
 
@@ -362,14 +365,17 @@ ncr5380_init(sc)
 
  for (i = 0; i < SCI_OPENINGS; i++) {
  sr = &sc->sc_ring[i];
- sr->sr_xs = NULL;
+ sr->sr_flags = SR_FREE;
  timeout_set(&sr->sr_timeout, ncr5380_cmd_timeout, sr);
  }
  for (i = 0; i < 8; i++)
  for (j = 0; j < 8; j++)
  sc->sc_matrix[i][j] = NULL;
 
+ scsi_iopool_init(&sc->sc_iopool, sc, ncr5380_io_get, ncr5380_io_put);
+
  sc->sc_link.openings = 2; /* XXX - Not SCI_OPENINGS */
+ sc->sc_link.pool = &sc->sc_iopool;
  sc->sc_prevphase = PHASE_INVALID;
  sc->sc_state = NCR_IDLE;
 
@@ -585,6 +591,44 @@ out:
  *****************************************************************/
 
 
+void *
+ncr5380_io_get(void *xsc)
+{
+ struct ncr5380_softc *sc = xsc;
+ struct sci_req *sr = NULL;
+ int s;
+
+ /*
+ * Find lowest empty slot in ring buffer.
+ * XXX: What about "fairness" and cmd order?
+ */
+
+ s = splbio();
+ for (i = 0; i < SCI_OPENINGS; i++) {
+ if (sc->sc_ring[i].sr_flags == SR_FREE) {
+ sr = &sc->sc_ring[i];
+ sr->sr_flags = 0;
+ sc->sc_ncmds++;
+ break;
+ }
+ }
+ splx(s);
+
+ return (sr);
+}
+
+void
+ncr5380_io_put(void *xsc, void *xsr)
+{
+ struct ncr5380_softc *sc = xsc;
+ struct sci_req *sr = xsr;
+ int s;
+
+ s = splbio();
+ sr->sr_flags = SR_FREE;
+ splx(s);
+}
+
 /*
  * Enter a new SCSI command into the "issue" queue, and
  * if there is work to do, start it going.
@@ -622,22 +666,8 @@ ncr5380_scsi_cmd(xs)
  }
  }
 
- /*
- * Find lowest empty slot in ring buffer.
- * XXX: What about "fairness" and cmd order?
- */
- for (i = 0; i < SCI_OPENINGS; i++)
- if (sc->sc_ring[i].sr_xs == NULL)
- goto new;
-
- xs->error = XS_NO_CCB;
- scsi_done(xs);
- NCR_TRACE("scsi_cmd: no openings\n", 0);
- goto out;
-
-new:
  /* Create queue entry */
- sr = &sc->sc_ring[i];
+ sr = xs->io;
  sr->sr_xs = xs;
  sr->sr_target = xs->sc_link->target;
  sr->sr_lun = xs->sc_link->lun;
Index: ncr5380var.h
===================================================================
RCS file: /cvs/src/sys/dev/ic/ncr5380var.h,v
retrieving revision 1.12
diff -u -p -r1.12 ncr5380var.h
--- ncr5380var.h 25 Mar 2010 13:18:03 -0000 1.12
+++ ncr5380var.h 18 Jan 2014 01:14:57 -0000
@@ -71,6 +71,7 @@ struct sci_req {
 #define SR_SENSE 2 /* We are getting sense */
 #define SR_OVERDUE 4 /* Timeout while not current */
 #define SR_ERROR 8 /* Error occurred */
+#define SR_FREE 16 /* We are free */
  int sr_status; /* Status code from last cmd */
 
  struct timeout sr_timeout;
@@ -144,6 +145,8 @@ struct ncr5380_softc {
  /* Ring buffer of pending/active requests */
  struct sci_req sc_ring[SCI_OPENINGS];
  int sc_rr; /* Round-robin scan pointer */
+
+ struct scsi_iopool sc_iopool;
 
  /* Active requests, by target/LUN */
  struct sci_req *sc_matrix[8][8];