Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/macppc/dev Remove two panic conditions.



details:   https://anonhg.NetBSD.org/src/rev/efac803812dc
branches:  trunk
changeset: 479949:efac803812dc
user:      tsubai <tsubai%NetBSD.org@localhost>
date:      Tue Dec 28 13:49:20 1999 +0000

description:
Remove two panic conditions.
XXX untested.

diffstat:

 sys/arch/macppc/dev/mesh.c |  25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diffs (53 lines):

diff -r d06be928f724 -r efac803812dc sys/arch/macppc/dev/mesh.c
--- a/sys/arch/macppc/dev/mesh.c        Tue Dec 28 11:05:48 1999 +0000
+++ b/sys/arch/macppc/dev/mesh.c        Tue Dec 28 13:49:20 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mesh.c,v 1.2 1999/09/30 23:01:11 thorpej Exp $ */
+/*     $NetBSD: mesh.c,v 1.3 1999/12/28 13:49:20 tsubai Exp $  */
 
 /*-
  * Copyright (C) 1999  Internet Research Institute, Inc.
@@ -303,6 +303,7 @@
 {
        struct mesh_softc *sc = arg;
        struct mesh_scb *scb;
+       int fifocnt;
        u_char intr, exception, error, status0, status1;
        int i;
 
@@ -337,8 +338,16 @@
                sc->sc_flags &= ~MESH_DMA_ACTIVE;
                scb->resid = MESH_GET_XFER(sc);
 
-               if (mesh_read_reg(sc, MESH_FIFO_COUNT) != 0)
-                       panic("mesh: FIFO != 0");       /* XXX */
+               fifocnt = mesh_read_reg(sc, MESH_FIFO_COUNT);
+               if (fifocnt != 0 && (scb->flags & MESH_READ)) {
+                       char *cp = (char *)scb->daddr + scb->dlen - fifocnt;
+
+                       while (fifocnt > 0) {
+                               *cp++ = mesh_read_reg(sc, MESH_FIFO);
+                               fifocnt--;
+                       }
+               } else
+                       mesh_set_reg(sc, MESH_SEQUENCE, MESH_CMD_FLUSH_FIFO);
        }
 
        if (intr & MESH_INTR_ERROR) {
@@ -1026,8 +1035,14 @@
        }
 
        if (scb->status == SCSI_CHECK) {
-               if (scb->flags & MESH_SENSE)
-                       panic("SCSI_CHECK && MESH_SENSE?");
+               if (scb->flags & MESH_SENSE) {
+                       printf("mesh: SCSI_CHECK && MESH_SENSE?\n");
+                       xs->xs_status |= XS_STS_DONE;
+                       xs->error = XS_DRIVER_STUFFUP;
+                       scsipi_done(xs);
+                       mesh_free_scb(sc, scb);
+                       return;
+               }
                xs->resid = scb->resid;
                mesh_sense(sc, scb);
                return;



Home | Main Index | Thread Index | Old Index