Synchronize with NetBSD/pc98 patch level 81.
Submitted by: Naofumi Honda <honda@Kururu.math.hokudai.ac.jp> Obtained from: NetBSD/pc98 patch level 81
This commit is contained in:
parent
c26d7157df
commit
75492a101b
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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__ */
|
||||
|
@ -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 --; \
|
||||
} \
|
||||
while (1); \
|
||||
CCBTYPE##que.count ++; \
|
||||
\
|
||||
done: \
|
||||
if (flags == 0) \
|
||||
{ \
|
||||
CCBTYPE##que.flags |= CCB_MWANTED; \
|
||||
tsleep((caddr_t) &CCBTYPE##que.count, PRIBIO, "ccbwait", 0);\
|
||||
goto again; \
|
||||
} \
|
||||
cb = NULL; \
|
||||
\
|
||||
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_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user