summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/bs
diff options
context:
space:
mode:
authorkato <kato@FreeBSD.org>1997-02-28 08:34:06 +0000
committerkato <kato@FreeBSD.org>1997-02-28 08:34:06 +0000
commitebae6fad44b7bc81646650bb0d9d5a5b7df20434 (patch)
treeef3119be51f3124086c7da6367b241dc55ee25c3 /sys/i386/isa/bs
parent18a2196557356111014f162cb228d414282206c4 (diff)
downloadFreeBSD-src-ebae6fad44b7bc81646650bb0d9d5a5b7df20434.zip
FreeBSD-src-ebae6fad44b7bc81646650bb0d9d5a5b7df20434.tar.gz
Synchronize with NetBSD/pc98 patch level 81.
Submitted by: Naofumi Honda <honda@Kururu.math.hokudai.ac.jp> Obtained from: NetBSD/pc98 patch level 81
Diffstat (limited to 'sys/i386/isa/bs')
-rw-r--r--sys/i386/isa/bs/bs_pisa.c2
-rw-r--r--sys/i386/isa/bs/bsfunc.c4
-rw-r--r--sys/i386/isa/bs/bshw.h14
-rw-r--r--sys/i386/isa/bs/bshw_pdma.c12
-rw-r--r--sys/i386/isa/bs/bsif.h13
-rw-r--r--sys/i386/isa/bs/ccbque.h63
6 files changed, 62 insertions, 46 deletions
diff --git a/sys/i386/isa/bs/bs_pisa.c b/sys/i386/isa/bs/bs_pisa.c
index 2ca9277..62ae84b 100644
--- a/sys/i386/isa/bs/bs_pisa.c
+++ b/sys/i386/isa/bs/bs_pisa.c
@@ -83,6 +83,8 @@ bs_deactivate(arg)
struct bs_softc *bsc = arg->id;
bsc->sc_flags |= BSINACTIVE;
+ bshw_dmaabort(bsc, NULL);
+ bshw_smitabort(bsc);
bs_terminate_timeout(bsc);
return 0;
diff --git a/sys/i386/isa/bs/bsfunc.c b/sys/i386/isa/bs/bsfunc.c
index 89d4acc..3b99c7f 100644
--- a/sys/i386/isa/bs/bsfunc.c
+++ b/sys/i386/isa/bs/bsfunc.c
@@ -767,6 +767,10 @@ bs_setup_ctrl(ti, quirks, flags)
if (quirks & SDEV_AUTOSAVE)
flags |= BS_SCSI_SAVESP;
#endif
+#ifdef SD_Q_NO_SYNC
+ if (quirks & SD_Q_NO_SYNC)
+ flags &= ~BS_SCSI_SYNC;
+#endif
if ((flags & BS_SCSI_DISC) == 0 ||
(ti->targ_support & SID_Linked) == 0)
diff --git a/sys/i386/isa/bs/bshw.h b/sys/i386/isa/bs/bshw.h
index ac765ec..efca1cf 100644
--- a/sys/i386/isa/bs/bshw.h
+++ b/sys/i386/isa/bs/bshw.h
@@ -347,17 +347,3 @@ bshw_set_dma_trans(bsc, flags)
bshw_setup_ctrl_reg(bsc, flags);
}
}
-
-static BS_INLINE void memcopy __P((void *from, void *to, register size_t len));
-
-static BS_INLINE void
-memcopy(from, to, len)
- void *from, *to;
- register size_t len;
-{
-
- len >>= 2;
- __asm __volatile("cld\n\trep\n\tmovsl" : :
- "S" (from), "D" (to), "c" (len) :
- "%esi", "%edi", "%ecx");
-}
diff --git a/sys/i386/isa/bs/bshw_pdma.c b/sys/i386/isa/bs/bshw_pdma.c
index 612db73..f1f7d2b 100644
--- a/sys/i386/isa/bs/bshw_pdma.c
+++ b/sys/i386/isa/bs/bshw_pdma.c
@@ -209,7 +209,11 @@ bs_lc_smit_xfer(ti, direction)
break;
count = (datalen > LC_FSZ ? LC_FSZ : datalen);
+#ifdef FreeBSD
memcopy(ti->sm_vaddr, data, count);
+#else /* NetBSD */
+ bus_mem_read_multi_4(bsc->sc_bc, bsc->sc_memh, 0, data, count >> 2);
+#endif /* NetBSD */
data += count;
datalen -= count;
}
@@ -225,7 +229,11 @@ bs_lc_smit_xfer(ti, direction)
break;
count = (datalen > LC_SFSZ ? LC_SFSZ : datalen);
+#ifdef FreeBSD
memcopy(data, ti->sm_vaddr, count);
+#else /* NetBSD */
+ bus_mem_write_multi_4(bsc->sc_bc, bsc->sc_memh, 0, data, count >> 2);
+#endif /* NetBSD */
data += count;
datalen -= count;
@@ -233,7 +241,11 @@ bs_lc_smit_xfer(ti, direction)
break;
count = (datalen > LC_REST ? LC_REST : datalen);
+#ifdef FreeBSD
memcopy(data, ti->sm_vaddr + LC_SFSZ, count);
+#else /* NetBSD */
+ bus_mem_write_multi_4(bsc->sc_bc, bsc->sc_memh, LC_SFSZ, data, count >> 2);
+#endif /* NetBSD */
data += count;
datalen -= count;
}
diff --git a/sys/i386/isa/bs/bsif.h b/sys/i386/isa/bs/bsif.h
index 6a5286e..d5b8e71 100644
--- a/sys/i386/isa/bs/bsif.h
+++ b/sys/i386/isa/bs/bsif.h
@@ -194,8 +194,21 @@ void bsattach __P((struct device *, struct device *, void *));
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
+static BS_INLINE void memcopy __P((void *from, void *to, register size_t len));
u_int32_t bs_adapter_info __P((int));
#define delay(y) DELAY(y)
extern int dma_init_flag;
#define softintr(y) ipending |= (y)
+
+static BS_INLINE void
+memcopy(from, to, len)
+ void *from, *to;
+ register size_t len;
+{
+
+ len >>= 2;
+ __asm __volatile("cld\n\trep\n\tmovsl" : :
+ "S" (from), "D" (to), "c" (len) :
+ "%esi", "%edi", "%ecx");
+}
#endif /* __FreeBSD__ */
diff --git a/sys/i386/isa/bs/ccbque.h b/sys/i386/isa/bs/ccbque.h
index d2c4cfc..df80faf 100644
--- a/sys/i386/isa/bs/ccbque.h
+++ b/sys/i386/isa/bs/ccbque.h
@@ -35,6 +35,9 @@
#ifndef _CCBQUE_H_
#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) \
TAILQ_HEAD(CCBTYPE##tab, CCBTYPE); \
@@ -42,10 +45,12 @@ struct CCBTYPE##que { \
struct CCBTYPE##tab CCBTYPE##tab; \
int count; \
int maxccb; \
+ u_int flags; \
}; \
+ \
void DEV##_init_ccbque __P((int)); \
struct CCBTYPE *DEV##_get_ccb __P((int)); \
-void DEV##_free_ccb __P((struct CCBTYPE *));
+void DEV##_free_ccb __P((register struct CCBTYPE *));
/* (II) static allocated memory */
#define GENERIC_CCB_STATIC_ALLOC(DEV, CCBTYPE) \
@@ -67,64 +72,58 @@ struct CCBTYPE * \
DEV##_get_ccb(flags) \
int flags; \
{ \
- struct CCBTYPE *cb; \
+ register struct CCBTYPE *cb; \
int s = splbio(); \
\
- do \
+again: \
+ if (CCBTYPE##que.count < CCBTYPE##que.maxccb) \
{ \
- if (CCBTYPE##que.count > CCBTYPE##que.maxccb) \
- { \
- if (flags) \
- { \
- cb = NULL; \
- goto done; \
- } \
- else \
- { \
- tsleep((caddr_t) &CCBTYPE##que.count, \
- PRIBIO, "ccbwait", 0); \
- continue; \
- } \
- } \
- \
- if (cb = CCBTYPE##que.CCBTYPE##tab.tqh_first) \
+ CCBTYPE##que.count ++; \
+ cb = CCBTYPE##que.CCBTYPE##tab.tqh_first; \
+ if (cb != NULL) \
{ \
TAILQ_REMOVE(&CCBTYPE##que.CCBTYPE##tab, cb, CHAIN)\
- break; \
+ goto out; \
} \
else \
{ \
- if (cb = malloc(sizeof(*cb), M_DEVBUF, M_NOWAIT))\
+ cb = malloc(sizeof(*cb), M_DEVBUF, CCB_WOK(flags));\
+ if (cb != NULL) \
{ \
bzero(cb, sizeof(*cb)); \
- break; \
+ goto out; \
} \
- else if (flags) \
- goto done; \
- \
- tsleep((caddr_t) &CCBTYPE##que.count, \
- PRIBIO, "ccbwait", 0); \
} \
+ CCBTYPE##que.count --; \
+ } \
+ \
+ if (flags == 0) \
+ { \
+ CCBTYPE##que.flags |= CCB_MWANTED; \
+ tsleep((caddr_t) &CCBTYPE##que.count, PRIBIO, "ccbwait", 0);\
+ goto again; \
} \
- while (1); \
- CCBTYPE##que.count ++; \
+ cb = NULL; \
\
-done: \
+out: \
splx(s); \
return cb; \
} \
\
void \
DEV##_free_ccb(cb) \
- struct CCBTYPE *cb; \
+ register struct CCBTYPE *cb; \
{ \
int s = splbio(); \
\
TAILQ_INSERT_TAIL(&CCBTYPE##que.CCBTYPE##tab, cb, CHAIN) \
CCBTYPE##que.count --; \
\
- if (CCBTYPE##que.count == CCBTYPE##que.maxccb) \
+ if (CCBTYPE##que.flags & CCB_MWANTED) \
+ { \
+ CCBTYPE##que.flags &= ~CCB_MWANTED; \
wakeup ((caddr_t) &CCBTYPE##que.count); \
+ } \
splx(s); \
}
#endif /* !_CCBQUE_H_ */
OpenPOWER on IntegriCloud