Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic cac_cmd:



details:   https://anonhg.NetBSD.org/src/rev/2256cdbd5005
branches:  trunk
changeset: 555977:2256cdbd5005
user:      pk <pk%NetBSD.org@localhost>
date:      Fri Dec 05 10:23:00 2003 +0000

description:
cac_cmd:
  * don't let cac_ccb_alloc() sleep since it regularly runs in an
    interrupt context
  * return EAGAIN instead EBUSY (or -1), which is what the upper ld
    layer expects to get on transient resource shortages.
  * ignore error from cac_ccb_start(), since a `fifo full' condition is
    handled internally in the lower layer, i.e. the transaction started
    from ldstart() has been queued at the lower layer and must be taken
    off ld's disk queue.

diffstat:

 sys/dev/ic/cac.c |  15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diffs (58 lines):

diff -r 5aae44cade4f -r 2256cdbd5005 sys/dev/ic/cac.c
--- a/sys/dev/ic/cac.c  Fri Dec 05 10:16:16 2003 +0000
+++ b/sys/dev/ic/cac.c  Fri Dec 05 10:23:00 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cac.c,v 1.25 2003/01/31 00:26:28 thorpej Exp $ */
+/*     $NetBSD: cac.c,v 1.26 2003/12/05 10:23:00 pk Exp $      */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.25 2003/01/31 00:26:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.26 2003/12/05 10:23:00 pk Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -284,9 +284,9 @@
 
        size = 0;
 
-       if ((ccb = cac_ccb_alloc(sc, 0)) == NULL) {
+       if ((ccb = cac_ccb_alloc(sc, 1)) == NULL) {
                printf("%s: unable to alloc CCB", sc->sc_dv.dv_xname);
-               return (ENOMEM);
+               return (EAGAIN);
        }
 
        if ((flags & (CAC_CCB_DATA_IN | CAC_CCB_DATA_OUT)) != 0) {
@@ -333,7 +333,7 @@
                /* Synchronous commands musn't wait. */
                if ((*sc->sc_cl.cl_fifo_full)(sc)) {
                        cac_ccb_free(sc, ccb);
-                       rv = -1;
+                       rv = EAGAIN;
                } else {
 #ifdef DIAGNOSTIC
                        ccb->ccb_flags |= CAC_CCB_ACTIVE;
@@ -345,7 +345,8 @@
        } else {
                memcpy(&ccb->ccb_context, context, sizeof(struct cac_context));
                s = splbio();
-               rv = cac_ccb_start(sc, ccb);
+               (void)cac_ccb_start(sc, ccb);
+               rv = 0;
        }
        
        splx(s);
@@ -393,7 +394,7 @@
 
        while ((ccb = SIMPLEQ_FIRST(&sc->sc_ccb_queue)) != NULL) {
                if ((*sc->sc_cl.cl_fifo_full)(sc))
-                       return (EBUSY);
+                       return (EAGAIN);
                SIMPLEQ_REMOVE_HEAD(&sc->sc_ccb_queue, ccb_chain);
 #ifdef DIAGNOSTIC
                ccb->ccb_flags |= CAC_CCB_ACTIVE;



Home | Main Index | Thread Index | Old Index