summaryrefslogtreecommitdiff
path: root/sys/i386/isa/ccbque.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/i386/isa/ccbque.h')
-rw-r--r--sys/i386/isa/ccbque.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/i386/isa/ccbque.h b/sys/i386/isa/ccbque.h
index 0d9eeecb9f550..7530068d13954 100644
--- a/sys/i386/isa/ccbque.h
+++ b/sys/i386/isa/ccbque.h
@@ -36,6 +36,7 @@
#define _CCBQUE_H_
#define CCB_MWANTED 0x01
+#define CCB_WOK(fl) (((fl) == 0) ? M_WAITOK : M_NOWAIT)
/* (I) structure and prototype */
#define GENERIC_CCB_ASSERT(DEV, CCBTYPE) \
@@ -48,7 +49,7 @@ struct CCBTYPE##que { \
}; \
\
void DEV##_init_ccbque __P((int)); \
-struct CCBTYPE *DEV##_get_ccb __P((void)); \
+struct CCBTYPE *DEV##_get_ccb __P((int)); \
void DEV##_free_ccb __P((register struct CCBTYPE *));
/* (II) static allocated memory */
@@ -68,7 +69,8 @@ DEV##_init_ccbque(count) \
} \
\
struct CCBTYPE * \
-DEV##_get_ccb() \
+DEV##_get_ccb(flags) \
+ int flags; \
{ \
register struct CCBTYPE *cb; \
int s = splbio(); \
@@ -85,7 +87,7 @@ again: \
} \
else \
{ \
- cb = malloc(sizeof(*cb), M_DEVBUF, M_NOWAIT); \
+ cb = malloc(sizeof(*cb), M_DEVBUF, CCB_WOK(flags));\
if (cb != NULL) \
{ \
bzero(cb, sizeof(*cb)); \
@@ -95,6 +97,12 @@ again: \
CCBTYPE##que.count --; \
} \
\
+ if (flags == 0) \
+ { \
+ CCBTYPE##que.flags |= CCB_MWANTED; \
+ tsleep((caddr_t) &CCBTYPE##que.count, PRIBIO, "ccbwait", 0);\
+ goto again; \
+ } \
cb = NULL; \
\
out: \