version 1.24, 2005/02/27 00:27:48 |
version 1.24.4.5, 2007/10/27 11:34:05 |
Line 54 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 54 __KERNEL_RCSID(0, "$NetBSD$"); |
|
#include <sys/errno.h> |
#include <sys/errno.h> |
#include <sys/device.h> |
#include <sys/device.h> |
|
|
#include <machine/bus.h> |
#include <sys/bus.h> |
#include <machine/intr.h> |
#include <sys/intr.h> |
#include <machine/autoconf.h> |
#include <machine/autoconf.h> |
|
|
#include <dev/ic/lsi64854reg.h> |
#include <dev/ic/lsi64854reg.h> |
Line 95 struct bpp_softc { |
|
Line 95 struct bpp_softc { |
|
struct sbusdev sc_sd; /* sbus device */ |
struct sbusdev sc_sd; /* sbus device */ |
|
|
size_t sc_bufsz; /* temp buffer */ |
size_t sc_bufsz; /* temp buffer */ |
caddr_t sc_buf; |
void * sc_buf; |
|
|
int sc_error; /* bottom-half error */ |
int sc_error; /* bottom-half error */ |
int sc_flags; |
int sc_flags; |
Line 133 dev_type_kqfilter(bppkqfilter); |
|
Line 133 dev_type_kqfilter(bppkqfilter); |
|
|
|
const struct cdevsw bpp_cdevsw = { |
const struct cdevsw bpp_cdevsw = { |
bppopen, bppclose, noread, bppwrite, bppioctl, |
bppopen, bppclose, noread, bppwrite, bppioctl, |
nostop, notty, bpppoll, nommap, bppkqfilter, |
nostop, notty, bpppoll, nommap, bppkqfilter, D_TTY |
}; |
}; |
|
|
#define BPPUNIT(dev) (minor(dev)) |
#define BPPUNIT(dev) (minor(dev)) |
Line 256 bpp_setparams(sc, hw) |
|
Line 256 bpp_setparams(sc, hw) |
|
} |
} |
|
|
int |
int |
bppopen(dev, flags, mode, p) |
bppopen(dev, flags, mode, l) |
dev_t dev; |
dev_t dev; |
int flags, mode; |
int flags, mode; |
struct proc *p; |
struct lwp *l; |
{ |
{ |
int unit = BPPUNIT(dev); |
int unit = BPPUNIT(dev); |
struct bpp_softc *sc; |
struct bpp_softc *sc; |
Line 290 bppopen(dev, flags, mode, p) |
|
Line 290 bppopen(dev, flags, mode, p) |
|
} |
} |
|
|
int |
int |
bppclose(dev, flags, mode, p) |
bppclose(dev, flags, mode, l) |
dev_t dev; |
dev_t dev; |
int flags, mode; |
int flags, mode; |
struct proc *p; |
struct lwp *l; |
{ |
{ |
struct bpp_softc *sc = bpp_cd.cd_devs[BPPUNIT(dev)]; |
struct bpp_softc *sc = bpp_cd.cd_devs[BPPUNIT(dev)]; |
struct lsi64854_softc *lsi = &sc->sc_lsi64854; |
struct lsi64854_softc *lsi = &sc->sc_lsi64854; |
Line 345 bppwrite(dev, uio, flags) |
|
Line 345 bppwrite(dev, uio, flags) |
|
* and start DMA. |
* and start DMA. |
*/ |
*/ |
while (uio->uio_resid > 0) { |
while (uio->uio_resid > 0) { |
caddr_t bp = sc->sc_buf; |
void *bp = sc->sc_buf; |
size_t len = min(sc->sc_bufsz, uio->uio_resid); |
size_t len = min(sc->sc_bufsz, uio->uio_resid); |
|
|
if ((error = uiomove(bp, len, uio)) != 0) |
if ((error = uiomove(bp, len, uio)) != 0) |
Line 359 bppwrite(dev, uio, flags) |
|
Line 359 bppwrite(dev, uio, flags) |
|
#ifdef DEBUG |
#ifdef DEBUG |
if (bppdebug) { |
if (bppdebug) { |
int i; |
int i; |
|
unsigned char *b = bp; |
printf("bpp: writing %ld : ", len); |
printf("bpp: writing %ld : ", len); |
for (i=0; i<len; i++) printf("%c(0x%x)", bp[i], bp[i]); |
for (i=0; i<len; i++) printf("%c(0x%x)", b[i], |
|
b[i]); |
printf("\n"); |
printf("\n"); |
} |
} |
#endif |
#endif |
|
|
#define BPPIOCGPARAM _IOR('P', 0x2, struct hwstate) |
#define BPPIOCGPARAM _IOR('P', 0x2, struct hwstate) |
|
|
int |
int |
bppioctl(dev, cmd, data, flag, p) |
bppioctl(dev, cmd, data, flag, l) |
dev_t dev; |
dev_t dev; |
u_long cmd; |
u_long cmd; |
caddr_t data; |
void * data; |
int flag; |
int flag; |
struct proc *p; |
struct lwp *l; |
{ |
{ |
struct bpp_softc *sc = bpp_cd.cd_devs[BPPUNIT(dev)]; |
struct bpp_softc *sc = bpp_cd.cd_devs[BPPUNIT(dev)]; |
|
struct proc *p = l->l_proc; |
struct hwstate *hw, *chw; |
struct hwstate *hw, *chw; |
int error = 0; |
int error = 0; |
int s; |
int s; |
Line 477 bppioctl(dev, cmd, data, flag, p) |
|
Line 480 bppioctl(dev, cmd, data, flag, p) |
|
} |
} |
|
|
int |
int |
bpppoll(dev, events, p) |
bpppoll(dev, events, l) |
dev_t dev; |
dev_t dev; |
int events; |
int events; |
struct proc *p; |
struct lwp *l; |
{ |
{ |
struct bpp_softc *sc = bpp_cd.cd_devs[BPPUNIT(dev)]; |
struct bpp_softc *sc = bpp_cd.cd_devs[BPPUNIT(dev)]; |
int revents = 0; |
int revents = 0; |
Line 496 bpppoll(dev, events, p) |
|
Line 499 bpppoll(dev, events, p) |
|
|
|
if (revents == 0) { |
if (revents == 0) { |
if (events & (POLLIN | POLLRDNORM)) |
if (events & (POLLIN | POLLRDNORM)) |
selrecord(p, &sc->sc_rsel); |
selrecord(l, &sc->sc_rsel); |
if (events & (POLLOUT | POLLWRNORM)) |
if (events & (POLLOUT | POLLWRNORM)) |
selrecord(p, &sc->sc_wsel); |
selrecord(l, &sc->sc_wsel); |
} |
} |
|
|
return (revents); |
return (revents); |
|
|
wakeup(sc->sc_buf); |
wakeup(sc->sc_buf); |
} else { |
} else { |
selnotify(&sc->sc_wsel, 0); |
selnotify(&sc->sc_wsel, 0); |
if (sc->sc_asyncproc != NULL) |
if (sc->sc_asyncproc != NULL) { |
|
mutex_enter(&proclist_mutex); |
psignal(sc->sc_asyncproc, SIGIO); |
psignal(sc->sc_asyncproc, SIGIO); |
|
mutex_exit(&proclist_mutex); |
|
} |
} |
} |
return (1); |
return (1); |
} |
} |