summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>1996-03-07 15:00:07 +0000
committerchristos <christos@NetBSD.org>1996-03-07 15:00:07 +0000
commitd318abdbc471c916e89e2f7514dfd50b4b24c4ff (patch)
treef8371e2bb7fc2d84f5e9f75134519a1a8ab2b880 /sys/dev
parentbdc697d9103085fcf1db98dc6ef20cdcfbcce742 (diff)
prototypes for ccd audio and ncr5380
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/audio.c103
-rw-r--r--sys/dev/audio_if.h10
-rw-r--r--sys/dev/ccd.c98
-rw-r--r--sys/dev/dev_conf.h45
-rw-r--r--sys/dev/ic/ncr5380sbc.c26
5 files changed, 177 insertions, 105 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index 56126000492..6a3788a57bd 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.20 1996/02/20 11:47:22 mycroft Exp $ */
+/* $NetBSD: audio.c,v 1.21 1996/03/07 15:00:07 christos Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -138,18 +138,36 @@ void audio_init_record __P((struct audio_softc *));
void audio_init_play __P((struct audio_softc *));
void audiostartr __P((struct audio_softc *));
void audiostartp __P((struct audio_softc *));
-void audio_rint __P((struct audio_softc *));
-void audio_pint __P((struct audio_softc *));
-void audio_rpint __P((struct audio_softc *));
+void audio_rint __P((void *));
+void audio_pint __P((void *));
+void audio_rpint __P((void *));
int audio_calc_blksize __P((struct audio_softc *));
void audio_silence_fill __P((struct audio_softc *, u_char *, int));
int audio_silence_copyout __P((struct audio_softc *, int, struct uio *));
void audio_alloc_auzero __P((struct audio_softc *, int));
+void audio_printsc __P((struct audio_softc *));
+void audioattach __P((int));
+int audio_hardware_attach __P((struct audio_hw_if *, void *));
+int audioopen __P((dev_t, int, int, struct proc *));
+int audioclose __P((dev_t, int, int, struct proc *));
+int audioread __P((dev_t, struct uio *, int));
+int audiowrite __P((dev_t, struct uio *, int));
+int audioioctl __P((dev_t, int, caddr_t, int, struct proc *));
+int audioselect __P((dev_t, int, struct proc *));
+void audio_init_ring __P((struct audio_buffer *, int));
+void audio_initbufs __P((struct audio_softc *));
+static __inline int audio_sleep_timo __P((int *, char *, int));
+static __inline int audio_sleep __P((int *, char *));
+static __inline void audio_wakeup __P((int *));
+int audio_drain __P((struct audio_softc *));
+void audio_clear __P((struct audio_softc *));
+
#ifdef AUDIO_DEBUG
void
-audio_printsc(struct audio_softc *sc)
+audio_printsc(sc)
+ struct audio_softc *sc;
{
printf("hwhandle %x hw_if %x ", sc->hw_hdl, sc->hw_if);
printf("open %x mode %x\n", sc->sc_open, sc->sc_mode);
@@ -177,7 +195,6 @@ audio_hardware_attach(hwp, hdlp)
struct audio_hw_if *hwp;
void *hdlp;
{
- int *zp, i;
struct audio_softc *sc;
if (naudio >= NAUDIO) {
@@ -446,7 +463,7 @@ audio_initbufs(sc)
sc->sc_hiwat = nblk;
}
-static inline int
+static __inline int
audio_sleep_timo(chan, label, timo)
int *chan;
char *label;
@@ -466,7 +483,7 @@ audio_sleep_timo(chan, label, timo)
return (st);
}
-static inline int
+static __inline int
audio_sleep(chan, label)
int *chan;
char *label;
@@ -474,7 +491,7 @@ audio_sleep(chan, label)
return audio_sleep_timo(chan, label, 0);
}
-static inline void
+static __inline void
audio_wakeup(chan)
int *chan;
{
@@ -830,7 +847,6 @@ audio_silence_fill(sc, p, n)
int n;
{
struct audio_hw_if *hw = sc->hw_if;
- int i;
u_int auzero;
auzero = hw->get_silence(sc->sc_pencoding);
@@ -839,6 +855,7 @@ audio_silence_fill(sc, p, n)
*p++ = auzero;
}
+int
audio_silence_copyout(sc, n, uio)
struct audio_softc *sc;
int n;
@@ -994,7 +1011,7 @@ audio_write(dev, uio, ioflag)
if ((tp + towrite) > cb->ep) {
DPRINTF(("audio_write: overwrite tp=0x%x towrite=%d ep=0x%x bs=%d\n",
tp, towrite, cb->ep, blocksize));
- printf("audio_write: overwrite tp=0x%x towrite=%d ep=0x%x\n",
+ printf("audio_write: overwrite tp=%p towrite=%d ep=%p\n",
tp, towrite, cb->ep);
tp = cb->bp;
}
@@ -1220,13 +1237,14 @@ void
audiostartr(sc)
struct audio_softc *sc;
{
- int err;
+ int error;
DPRINTF(("audiostartr: tp=0x%x\n", sc->rr.tp));
- if (err = sc->hw_if->start_input(sc->hw_hdl, sc->rr.tp, sc->sc_blksize,
- audio_rint, (void *)sc)) {
- DPRINTF(("audiostartr failed: %d\n", err));
+ error = sc->hw_if->start_input(sc->hw_hdl, sc->rr.tp, sc->sc_blksize,
+ audio_rint, (void *)sc);
+ if (error) {
+ DPRINTF(("audiostartr failed: %d\n", error));
audio_clear(sc);
}
else
@@ -1237,15 +1255,16 @@ void
audiostartp(sc)
struct audio_softc *sc;
{
- int rval;
+ int error;
DPRINTF(("audiostartp: hp=0x%x nblk=%d\n", sc->pr.hp, sc->pr.nblk));
if (sc->pr.nblk > 0) {
u_char *hp = sc->pr.hp;
- if (rval = sc->hw_if->start_output(sc->hw_hdl, hp, sc->sc_blksize,
- audio_rpint, (void *)sc)) {
- DPRINTF(("audiostartp: failed: %d\n", rval));
+ error = sc->hw_if->start_output(sc->hw_hdl, hp, sc->sc_blksize,
+ audio_rpint, (void *)sc);
+ if (error) {
+ DPRINTF(("audiostartp: failed: %d\n", error));
}
else {
sc->sc_pbus = 1;
@@ -1262,12 +1281,12 @@ audiostartp(sc)
* account for user data and silence separately.
*/
void
-audio_rpint(sc)
- struct audio_softc *sc;
+audio_rpint(v)
+ void *v;
{
-
+ struct audio_softc *sc = v;
sc->pr.nblk--;
- audio_pint(sc); /* 'twas a real audio block */
+ audio_pint(v); /* 'twas a real audio block */
}
/*
@@ -1277,14 +1296,15 @@ audio_rpint(sc)
* Do a wakeup if necessary.
*/
void
-audio_pint(sc)
- struct audio_softc *sc;
+audio_pint(v)
+ void *v;
{
+ struct audio_softc *sc = v;
u_char *hp;
int cc = sc->sc_blksize;
struct audio_hw_if *hw = sc->hw_if;
struct audio_buffer *cb = &sc->pr;
- int err;
+ int error;
/*
* XXX
@@ -1307,9 +1327,10 @@ audio_pint(sc)
if (audiodebug > 1)
Dprintf("audio_pint: hp=0x%x cc=%d\n", hp, cc);
#endif
- if (err = hw->start_output(sc->hw_hdl, hp, cc,
- audio_rpint, (void *)sc)) {
- DPRINTF(("audio_pint restart failed: %d\n", err));
+ error = hw->start_output(sc->hw_hdl, hp, cc,
+ audio_rpint, (void *)sc);
+ if (error) {
+ DPRINTF(("audio_pint restart failed: %d\n", error));
audio_clear(sc);
}
else {
@@ -1330,10 +1351,11 @@ audio_pint(sc)
Dprintf("audio_pint: drops=%d auzero %d 0x%x\n", cb->cb_drops, cc, *(int *)auzero_block);
#endif
psilence:
- if (err = hw->start_output(sc->hw_hdl,
- auzero_block, cc,
- audio_pint, (void *)sc)) {
- DPRINTF(("audio_pint zero failed: %d\n", err));
+ error = hw->start_output(sc->hw_hdl,
+ auzero_block, cc,
+ audio_pint, (void *)sc);
+ if (error) {
+ DPRINTF(("audio_pint zero failed: %d\n", error));
audio_clear(sc);
} else
++sc->sc_wblks;
@@ -1371,14 +1393,15 @@ audio_pint(sc)
* Do a wakeup if necessary.
*/
void
-audio_rint(sc)
- struct audio_softc *sc;
+audio_rint(v)
+ void *v;
{
+ struct audio_softc *sc = v;
u_char *tp;
int cc = sc->sc_blksize;
struct audio_hw_if *hw = sc->hw_if;
struct audio_buffer *cb = &sc->rr;
- int err;
+ int error;
tp = cb->tp;
if (cb->cb_pause) {
@@ -1394,9 +1417,11 @@ audio_rint(sc)
if (audiodebug > 1)
Dprintf("audio_rint: tp=0x%x cc=%d\n", tp, cc);
#endif
- if (err = hw->start_input(sc->hw_hdl, tp, cc,
- audio_rint, (void *)sc)) {
- DPRINTF(("audio_rint: start failed: %d\n", err));
+ error = hw->start_input(sc->hw_hdl, tp, cc,
+ audio_rint, (void *)sc);
+ if (error) {
+ DPRINTF(("audio_rint: start failed: %d\n",
+ error));
audio_clear(sc);
}
cb->au_stamp += sc->sc_smpl_in_blk;
diff --git a/sys/dev/audio_if.h b/sys/dev/audio_if.h
index 5dd39a47db2..8aff0d5ab87 100644
--- a/sys/dev/audio_if.h
+++ b/sys/dev/audio_if.h
@@ -1,4 +1,4 @@
-/* $NetBSD: audio_if.h,v 1.6 1995/12/24 02:30:58 mycroft Exp $ */
+/* $NetBSD: audio_if.h,v 1.7 1996/03/07 15:00:10 christos Exp $ */
/*
* Copyright (c) 1994 Havard Eidnes.
@@ -38,6 +38,8 @@
* Generic interface to hardware driver.
*/
+struct audio_softc;
+
struct audio_hw_if {
int (*open)__P((dev_t, int)); /* open hardware */
void (*close)__P((void *)); /* close hardware */
@@ -91,8 +93,10 @@ struct audio_hw_if {
void (*sw_decode)__P((void *, int, u_char *, int));
/* Start input/output routines. These usually control DMA. */
- int (*start_output)__P((void *, void *, int, void (*)(), void *));
- int (*start_input)__P((void *, void *, int, void (*)(), void *));
+ int (*start_output)__P((void *, void *, int,
+ void (*)(void *), void *));
+ int (*start_input)__P((void *, void *, int,
+ void (*)(void *), void *));
int (*halt_output)__P((void *));
int (*halt_input)__P((void *));
int (*cont_output)__P((void *));
diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c
index 69662b440a2..355f36a62bd 100644
--- a/sys/dev/ccd.c
+++ b/sys/dev/ccd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ccd.c,v 1.28 1996/02/28 01:08:28 thorpej Exp $ */
+/* $NetBSD: ccd.c,v 1.29 1996/03/07 15:00:11 christos Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -99,7 +99,6 @@
#include <sys/buf.h>
#include <sys/malloc.h>
#include <sys/namei.h>
-#include <sys/conf.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/disklabel.h>
@@ -108,7 +107,9 @@
#include <sys/syslog.h>
#include <sys/fcntl.h>
#include <sys/vnode.h>
+#include <sys/cpu.h>
+#include <dev/dev_conf.h>
#include <dev/ccdvar.h>
#if defined(CCDDEBUG) && !defined(DEBUG)
@@ -144,19 +145,12 @@ struct ccdbuf {
#define CCDLABELDEV(dev) \
(MAKEDISKDEV(major((dev)), ccdunit((dev)), RAW_PART))
-/* {b,c}devsw[] function prototypes */
-dev_type_open(ccdopen);
-dev_type_close(ccdclose);
-dev_type_strategy(ccdstrategy);
-dev_type_ioctl(ccdioctl);
-dev_type_read(ccdread);
-dev_type_write(ccdwrite);
-
/* called by main() at boot time */
void ccdattach __P((int));
/* called by biodone() at interrupt time */
-void ccdiodone __P((struct ccdbuf *cbp));
+void ccdiodone __P((struct buf *));
+int ccdsize __P((dev_t));
static void ccdstart __P((struct ccd_softc *, struct buf *));
static void ccdinterleave __P((struct ccd_softc *, int));
@@ -187,8 +181,6 @@ void
ccdattach(num)
int num;
{
- int i;
-
if (num <= 0) {
#ifdef DIAGNOSTIC
panic("ccdattach: count <= 0");
@@ -220,7 +212,7 @@ ccdinit(ccd, cpaths, p)
struct proc *p;
{
register struct ccd_softc *cs = &ccd_softc[ccd->ccd_unit];
- register struct ccdcinfo *ci;
+ register struct ccdcinfo *ci = NULL;
register size_t size;
register int ix;
struct vnode *vp;
@@ -261,8 +253,9 @@ ccdinit(ccd, cpaths, p)
* Copy in the pathname of the component.
*/
bzero(tmppath, sizeof(tmppath)); /* sanity */
- if (error = copyinstr(cpaths[ix], tmppath,
- MAXPATHLEN, &ci->ci_pathlen)) {
+ error = copyinstr(cpaths[ix], tmppath,
+ MAXPATHLEN, &ci->ci_pathlen);
+ if (error) {
#ifdef DEBUG
if (ccddebug & (CCDB_FOLLOW|CCDB_INIT))
printf("%s: can't copy path, error = %d\n",
@@ -277,7 +270,7 @@ ccdinit(ccd, cpaths, p)
/*
* XXX: Cache the component's dev_t.
*/
- if (error = VOP_GETATTR(vp, &va, p->p_ucred, p)) {
+ if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p)) != 0) {
#ifdef DEBUG
if (ccddebug & (CCDB_FOLLOW|CCDB_INIT))
printf("%s: %s: getattr failed %s = %d\n",
@@ -293,8 +286,9 @@ ccdinit(ccd, cpaths, p)
/*
* Get partition information for the component.
*/
- if (error = VOP_IOCTL(vp, DIOCGPART, (caddr_t)&dpart,
- FREAD, p->p_ucred, p)) {
+ error = VOP_IOCTL(vp, DIOCGPART, (caddr_t)&dpart,
+ FREAD, p->p_ucred, p);
+ if (error) {
#ifdef DEBUG
if (ccddebug & (CCDB_FOLLOW|CCDB_INIT))
printf("%s: %s: ioctl failed, error = %d\n",
@@ -324,9 +318,6 @@ ccdinit(ccd, cpaths, p)
* Calculate the size, truncating to an interleave
* boundary if necessary.
*/
- if (size < 0)
- size = 0;
-
if (cs->sc_ileave > 1)
size -= size % cs->sc_ileave;
@@ -440,7 +431,7 @@ ccdinterleave(cs, unit)
#ifdef DEBUG
if (ccddebug & CCDB_INIT)
- printf("ccdinterleave(%x): ileave %d\n", cs, cs->sc_ileave);
+ printf("ccdinterleave(%p): ileave %d\n", cs, cs->sc_ileave);
#endif
/*
* Allocate an interleave table.
@@ -551,7 +542,7 @@ ccdopen(dev, flags, fmt, p)
return (ENXIO);
cs = &ccd_softc[unit];
- if (error = ccdlock(cs))
+ if ((error = ccdlock(cs)) != 0)
return (error);
lp = cs->sc_dkdev.dk_label;
@@ -615,7 +606,7 @@ ccdclose(dev, flags, fmt, p)
return (ENXIO);
cs = &ccd_softc[unit];
- if (error = ccdlock(cs))
+ if ((error = ccdlock(cs)) != 0)
return (error);
part = DISKPART(dev);
@@ -643,14 +634,13 @@ ccdstrategy(bp)
{
register int unit = ccdunit(bp->b_dev);
register struct ccd_softc *cs = &ccd_softc[unit];
- register daddr_t bn;
- register int sz, s;
+ register int s;
int wlabel;
struct disklabel *lp;
#ifdef DEBUG
if (ccddebug & CCDB_FOLLOW)
- printf("ccdstrategy(%x): unit %d\n", bp, unit);
+ printf("ccdstrategy(%p): unit %d\n", bp, unit);
#endif
if ((cs->sc_flags & CCDF_INITED) == 0) {
bp->b_error = ENXIO;
@@ -699,7 +689,7 @@ ccdstart(cs, bp)
#ifdef DEBUG
if (ccddebug & CCDB_FOLLOW)
- printf("ccdstart(%x, %x)\n", cs, bp);
+ printf("ccdstart(%p, %p)\n", cs, bp);
#endif
/* Instrumentation. */
@@ -751,13 +741,13 @@ ccdbuffer(cs, bp, bn, addr, bcount, cbpp)
long bcount;
struct ccdbuf **cbpp;
{
- register struct ccdcinfo *ci, *ci2;
+ register struct ccdcinfo *ci, *ci2 = NULL;
register struct ccdbuf *cbp;
register daddr_t cbn, cboff;
#ifdef DEBUG
if (ccddebug & CCDB_IO)
- printf("ccdbuffer(%x, %x, %d, %x, %d)\n",
+ printf("ccdbuffer(%p, %p, %d, %p, %d)\n",
cs, bp, bn, addr, bcount);
#endif
/*
@@ -819,7 +809,7 @@ ccdbuffer(cs, bp, bn, addr, bcount, cbpp)
cbp = getccdbuf();
cbp->cb_flags = 0;
cbp->cb_buf.b_flags = bp->b_flags | B_CALL;
- cbp->cb_buf.b_iodone = (void (*)())ccdiodone;
+ cbp->cb_buf.b_iodone = ccdiodone;
cbp->cb_buf.b_proc = bp->b_proc;
cbp->cb_buf.b_dev = ci->ci_dev; /* XXX */
cbp->cb_buf.b_blkno = cbn + cboff;
@@ -844,7 +834,7 @@ ccdbuffer(cs, bp, bn, addr, bcount, cbpp)
#ifdef DEBUG
if (ccddebug & CCDB_IO)
- printf(" dev %x(u%d): cbp %x bn %d addr %x bcnt %d\n",
+ printf(" dev %x(u%d): cbp %p bn %d addr %p bcnt %d\n",
ci->ci_dev, ci-cs->sc_cinfo, cbp, cbp->cb_buf.b_blkno,
cbp->cb_buf.b_data, cbp->cb_buf.b_bcount);
#endif
@@ -873,7 +863,7 @@ ccdintr(cs, bp)
#ifdef DEBUG
if (ccddebug & CCDB_FOLLOW)
- printf("ccdintr(%x, %x)\n", cs, bp);
+ printf("ccdintr(%p, %p)\n", cs, bp);
#endif
/*
* Request is done for better or worse, wakeup the top half.
@@ -890,9 +880,10 @@ ccdintr(cs, bp)
* take a ccd interrupt.
*/
void
-ccdiodone(cbp)
- struct ccdbuf *cbp;
+ccdiodone(vbp)
+ struct buf *vbp;
{
+ struct ccdbuf *cbp = (struct ccdbuf *) vbp;
register struct buf *bp = cbp->cb_obp;
register int unit = cbp->cb_unit;
struct ccd_softc *cs = &ccd_softc[unit];
@@ -902,14 +893,14 @@ ccdiodone(cbp)
s = splbio();
#ifdef DEBUG
if (ccddebug & CCDB_FOLLOW)
- printf("ccdiodone(%x)\n", cbp);
+ printf("ccdiodone(%p)\n", cbp);
if (ccddebug & CCDB_IO) {
if (cbp->cb_flags & CBF_MIRROR)
printf("ccdiodone: mirror component\n");
else
- printf("ccdiodone: bp %x bcount %d resid %d\n",
+ printf("ccdiodone: bp %p bcount %d resid %d\n",
bp, bp->b_bcount, bp->b_resid);
- printf(" dev %x(u%d), cbp %x bn %d addr %x bcnt %d\n",
+ printf(" dev %x(u%d), cbp %p bn %d addr %p bcnt %d\n",
cbp->cb_buf.b_dev, cbp->cb_comp, cbp,
cbp->cb_buf.b_blkno, cbp->cb_buf.b_data,
cbp->cb_buf.b_bcount);
@@ -961,7 +952,7 @@ ccdread(dev, uio, flags)
#ifdef DEBUG
if (ccddebug & CCDB_FOLLOW)
- printf("ccdread(%x, %x)\n", dev, uio);
+ printf("ccdread(%x, %p)\n", dev, uio);
#endif
if (unit >= numccd)
return (ENXIO);
@@ -990,7 +981,7 @@ ccdwrite(dev, uio, flags)
#ifdef DEBUG
if (ccddebug & CCDB_FOLLOW)
- printf("ccdwrite(%x, %x)\n", dev, uio);
+ printf("ccdwrite(%x, %p)\n", dev, uio);
#endif
if (unit >= numccd)
return (ENXIO);
@@ -1038,7 +1029,7 @@ ccdioctl(dev, cmd, data, flag, p)
if ((flag & FWRITE) == 0)
return (EBADF);
- if (error = ccdlock(cs))
+ if ((error = ccdlock(cs)) != 0)
return (error);
/* Fill in some important bits. */
@@ -1067,7 +1058,7 @@ ccdioctl(dev, cmd, data, flag, p)
#ifdef DEBUG
if (ccddebug & CCDB_INIT)
for (i = 0; i < ccio->ccio_ndisks; ++i)
- printf("ccdioctl: component %d: 0x%x\n",
+ printf("ccdioctl: component %d: 0x%p\n",
i, cpp[i]);
#endif
@@ -1076,7 +1067,7 @@ ccdioctl(dev, cmd, data, flag, p)
if (ccddebug & CCDB_INIT)
printf("ccdioctl: lookedup = %d\n", lookedup);
#endif
- if (error = ccdlookup(cpp[i], p, &vpp[i])) {
+ if ((error = ccdlookup(cpp[i], p, &vpp[i])) != 0) {
for (j = 0; j < lookedup; ++j)
(void)vn_close(vpp[j], FREAD|FWRITE,
p->p_ucred, p);
@@ -1094,7 +1085,7 @@ ccdioctl(dev, cmd, data, flag, p)
/*
* Initialize the ccd. Fills in the softc for us.
*/
- if (error = ccdinit(&ccd, cpp, p)) {
+ if ((error = ccdinit(&ccd, cpp, p)) != 0) {
for (j = 0; j < lookedup; ++j)
(void)vn_close(vpp[j], FREAD|FWRITE,
p->p_ucred, p);
@@ -1134,7 +1125,7 @@ ccdioctl(dev, cmd, data, flag, p)
if ((flag & FWRITE) == 0)
return (EBADF);
- if (error = ccdlock(cs))
+ if ((error = ccdlock(cs)) != 0)
return (error);
/*
@@ -1223,7 +1214,7 @@ ccdioctl(dev, cmd, data, flag, p)
if ((flag & FWRITE) == 0)
return (EBADF);
- if (error = ccdlock(cs))
+ if ((error = ccdlock(cs)) != 0)
return (error);
cs->sc_flags |= CCDF_LABELLING;
@@ -1320,9 +1311,9 @@ ccdlookup(path, p, vpp)
int error;
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, path, p);
- if (error = vn_open(&nd, FREAD|FWRITE, 0)) {
+ if ((error = vn_open(&nd, FREAD|FWRITE, 0)) != 0) {
#ifdef DEBUG
- if (ccddebug & CCDB_FOLLOW|CCDB_INIT)
+ if (ccddebug & (CCDB_FOLLOW|CCDB_INIT))
printf("ccdlookup: vn_open error = %d\n", error);
#endif
return (error);
@@ -1335,9 +1326,9 @@ ccdlookup(path, p, vpp)
return (EBUSY);
}
- if (error = VOP_GETATTR(vp, &va, p->p_ucred, p)) {
+ if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p)) != 0) {
#ifdef DEBUG
- if (ccddebug & CCDB_FOLLOW|CCDB_INIT)
+ if (ccddebug & (CCDB_FOLLOW|CCDB_INIT))
printf("ccdlookup: getattr error = %d\n", error);
#endif
VOP_UNLOCK(vp);
@@ -1406,8 +1397,9 @@ ccdgetdisklabel(dev)
/*
* Call the generic disklabel extraction routine.
*/
- if (errstring = readdisklabel(CCDLABELDEV(dev), ccdstrategy,
- cs->sc_dkdev.dk_label, cs->sc_dkdev.dk_cpulabel))
+ errstring = readdisklabel(CCDLABELDEV(dev), ccdstrategy,
+ cs->sc_dkdev.dk_label, cs->sc_dkdev.dk_cpulabel);
+ if (errstring)
ccdmakedisklabel(cs);
#ifdef DEBUG
diff --git a/sys/dev/dev_conf.h b/sys/dev/dev_conf.h
new file mode 100644
index 00000000000..785488697c3
--- /dev/null
+++ b/sys/dev/dev_conf.h
@@ -0,0 +1,45 @@
+/* $NetBSD: dev_conf.h,v 1.1 1996/03/07 15:00:13 christos Exp $ */
+
+/*
+ * Copyright (c) 1995 Christos Zoulas. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christos Zoulas.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/conf.h>
+
+#include "audio.h"
+cdev_decl(audio);
+
+cdev_decl(cn);
+
+#include "vnd.h"
+bdev_decl(vnd);
+cdev_decl(vnd);
+
+#include "ccd.h"
+bdev_decl(ccd);
+cdev_decl(ccd);
diff --git a/sys/dev/ic/ncr5380sbc.c b/sys/dev/ic/ncr5380sbc.c
index 06629f8913b..27d8c473787 100644
--- a/sys/dev/ic/ncr5380sbc.c
+++ b/sys/dev/ic/ncr5380sbc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ncr5380sbc.c,v 1.7 1996/03/01 01:42:04 gwr Exp $ */
+/* $NetBSD: ncr5380sbc.c,v 1.8 1996/03/07 15:00:17 christos Exp $ */
/*
* Copyright (c) 1995 David Jones, Gordon W. Ross
@@ -98,6 +98,8 @@ static int ncr5380_command __P((struct ncr5380_softc *));
static int ncr5380_status __P((struct ncr5380_softc *));
static void ncr5380_machine __P((struct ncr5380_softc *));
+void ncr5380_abort __P((struct ncr5380_softc *));
+void ncr5380_cmd_timeout __P((void *));
/*
* Action flags returned by the info_tranfer functions:
* (These determine what happens next.)
@@ -162,8 +164,12 @@ int ncr5380_wait_phase_timo = 1000 * 10 * 300; /* 5 min. */
int ncr5380_wait_req_timo = 1000 * 50; /* X2 = 100 mS. */
int ncr5380_wait_nrq_timo = 1000 * 25; /* X2 = 50 mS. */
+static __inline int ncr5380_wait_req __P((struct ncr5380_softc *));
+static __inline int ncr5380_wait_not_req __P((struct ncr5380_softc *));
+static __inline void ncr_sched_msgout __P((struct ncr5380_softc *, int));
+
/* Return zero on success. */
-static __inline__ int ncr5380_wait_req(sc)
+static __inline int ncr5380_wait_req(sc)
struct ncr5380_softc *sc;
{
register int timo = ncr5380_wait_req_timo;
@@ -180,7 +186,7 @@ static __inline__ int ncr5380_wait_req(sc)
}
/* Return zero on success. */
-static __inline__ int ncr5380_wait_not_req(sc)
+static __inline int ncr5380_wait_not_req(sc)
struct ncr5380_softc *sc;
{
register int timo = ncr5380_wait_nrq_timo;
@@ -197,7 +203,7 @@ static __inline__ int ncr5380_wait_not_req(sc)
}
/* Ask the target for a MSG_OUT phase. */
-static __inline__ void
+static __inline void
ncr_sched_msgout(sc, msg_code)
struct ncr5380_softc *sc;
int msg_code;
@@ -802,7 +808,7 @@ ncr5380_sched(sc)
{
struct sci_req *sr;
struct scsi_xfer *xs;
- int target, lun;
+ int target = 0, lun = 0;
int error, i;
/* Another hack (Er.. hook!) for the sun3 si: */
@@ -977,7 +983,8 @@ next_job:
#ifdef DIAGNOSTIC
if ((xs->flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) == 0) {
if (sc->sc_dataptr) {
- printf("%s: ptr but no data in/out flags?\n");
+ printf("%s: ptr but no data in/out flags?\n",
+ sc->sc_dev.dv_xname);
NCR_BREAK();
sc->sc_dataptr = NULL;
}
@@ -1273,7 +1280,7 @@ ncr5380_select(sc, sr)
struct sci_req *sr;
{
int timo, s;
- u_char bus, data, icmd;
+ u_char data, icmd;
/* Check for reselect */
ncr5380_reselect(sc);
@@ -1511,7 +1518,7 @@ ncr5380_msg_in(sc)
register struct ncr5380_softc *sc;
{
struct sci_req *sr = sc->sc_current;
- int n, phase, timo;
+ int n, phase;
int act_flags;
register u_char icmd;
@@ -2012,7 +2019,7 @@ ncr5380_data_xfer(sc, phase)
struct sci_req *sr = sc->sc_current;
struct scsi_xfer *xs = sr->sr_xs;
int expected_phase;
- int i, len;
+ int len;
if (sr->sr_flags & SR_SENSE) {
NCR_TRACE("data_xfer: get sense, sr=0x%x\n", (long)sr);
@@ -2103,7 +2110,6 @@ ncr5380_status(sc)
int len;
u_char status;
struct sci_req *sr = sc->sc_current;
- struct scsi_xfer *xs = sr->sr_xs;
/* acknowledge phase change */
*sc->sci_tcmd = PHASE_STATUS;