From 17821895ee383dbae778270200482dfae619d5e0 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Tue, 12 Nov 2002 15:22:19 +0000 Subject: Split userland services to fwdev.c. --- sys/dev/firewire/fwdev.c | 916 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 916 insertions(+) create mode 100644 sys/dev/firewire/fwdev.c (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c new file mode 100644 index 000000000000..66286a2fd461 --- /dev/null +++ b/sys/dev/firewire/fwdev.c @@ -0,0 +1,916 @@ +/* + * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa + * 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 acknowledgement as bellow: + * + * This product includes software developed by K. Kobayashi and H. Shimokawa + * + * 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. + * + * $FreeBSD$ + * + */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include + +#define CDEV_MAJOR 127 +#define FWNODE_INVAL 0xffff + +static d_open_t fw_open; +static d_close_t fw_close; +static d_ioctl_t fw_ioctl; +static d_poll_t fw_poll; +static d_read_t fw_read; /* for Isochronous packet */ +static d_write_t fw_write; +static d_mmap_t fw_mmap; + +struct cdevsw firewire_cdevsw = +{ + fw_open, fw_close, fw_read, fw_write, fw_ioctl, + fw_poll, fw_mmap, nostrategy, "fw", CDEV_MAJOR, nodump, nopsize, D_MEM +}; + +static int +fw_open (dev_t dev, int flags, int fmt, fw_proc *td) +{ + struct firewire_softc *sc; + int unit = DEV2UNIT(dev); + int sub = DEV2DMACH(dev); + + int err = 0; + + if (DEV_FWMEM(dev)) + return fwmem_open(dev, flags, fmt, td); + + sc = devclass_get_softc(firewire_devclass, unit); + if(sc->fc->ir[sub]->flag & FWXFERQ_OPEN){ + err = EBUSY; + return err; + } + if(sc->fc->it[sub]->flag & FWXFERQ_OPEN){ + err = EBUSY; + return err; + } + if(sc->fc->ir[sub]->flag & FWXFERQ_MODEMASK){ + err = EBUSY; + return err; + } +/* Default is per packet mode */ + sc->fc->ir[sub]->flag |= FWXFERQ_OPEN; + sc->fc->it[sub]->flag |= FWXFERQ_OPEN; + sc->fc->ir[sub]->flag |= FWXFERQ_PACKET; + return err; +} + +static int +fw_close (dev_t dev, int flags, int fmt, fw_proc *td) +{ + struct firewire_softc *sc; + int unit = DEV2UNIT(dev); + int sub = DEV2DMACH(dev); + struct fw_xfer *xfer; + struct fw_dvbuf *dvbuf; + struct fw_bind *fwb; + int err = 0; + + if (DEV_FWMEM(dev)) + return fwmem_close(dev, flags, fmt, td); + + sc = devclass_get_softc(firewire_devclass, unit); + if(!(sc->fc->ir[sub]->flag & FWXFERQ_OPEN)){ + err = EINVAL; + return err; + } + sc->fc->ir[sub]->flag &= ~FWXFERQ_OPEN; + if(!(sc->fc->it[sub]->flag & FWXFERQ_OPEN)){ + err = EINVAL; + return err; + } + sc->fc->it[sub]->flag &= ~FWXFERQ_OPEN; + + if(sc->fc->ir[sub]->flag & FWXFERQ_RUNNING){ + sc->fc->irx_disable(sc->fc, sub); + } + if(sc->fc->it[sub]->flag & FWXFERQ_RUNNING){ + sc->fc->it[sub]->flag &= ~FWXFERQ_RUNNING; + sc->fc->itx_disable(sc->fc, sub); + } + if(sc->fc->it[sub]->flag & FWXFERQ_DV){ + if((dvbuf = sc->fc->it[sub]->dvproc) != NULL){ + free(dvbuf->buf, M_DEVBUF); + sc->fc->it[sub]->dvproc = NULL; + } + if((dvbuf = sc->fc->it[sub]->dvdma) != NULL){ + free(dvbuf->buf, M_DEVBUF); + sc->fc->it[sub]->dvdma = NULL; + } + while((dvbuf = STAILQ_FIRST(&sc->fc->it[sub]->dvvalid)) != NULL){ + STAILQ_REMOVE_HEAD(&sc->fc->it[sub]->dvvalid, link); + free(dvbuf->buf, M_DEVBUF); + } + while((dvbuf = STAILQ_FIRST(&sc->fc->it[sub]->dvfree)) != NULL){ + STAILQ_REMOVE_HEAD(&sc->fc->it[sub]->dvfree, link); + free(dvbuf->buf, M_DEVBUF); + } + free(sc->fc->it[sub]->dvbuf, M_DEVBUF); + sc->fc->it[sub]->dvbuf = NULL; + } + if(sc->fc->ir[sub]->flag & FWXFERQ_EXTBUF){ + free(sc->fc->ir[sub]->buf, M_DEVBUF); + sc->fc->ir[sub]->buf = NULL; + free(sc->fc->ir[sub]->bulkxfer, M_DEVBUF); + sc->fc->ir[sub]->bulkxfer = NULL; + sc->fc->ir[sub]->flag &= ~FWXFERQ_EXTBUF; + sc->fc->ir[sub]->psize = FWPMAX_S400; + sc->fc->ir[sub]->maxq = FWMAXQUEUE; + } + if(sc->fc->it[sub]->flag & FWXFERQ_EXTBUF){ + free(sc->fc->it[sub]->buf, M_DEVBUF); + sc->fc->it[sub]->buf = NULL; + free(sc->fc->it[sub]->bulkxfer, M_DEVBUF); + sc->fc->it[sub]->bulkxfer = NULL; + sc->fc->it[sub]->dvbuf = NULL; + sc->fc->it[sub]->flag &= ~FWXFERQ_EXTBUF; + sc->fc->it[sub]->psize = FWPMAX_S400; + sc->fc->it[sub]->maxq = FWMAXQUEUE; + } + for(xfer = STAILQ_FIRST(&sc->fc->ir[sub]->q); + xfer != NULL; xfer = STAILQ_FIRST(&sc->fc->ir[sub]->q)){ + sc->fc->ir[sub]->queued--; + STAILQ_REMOVE_HEAD(&sc->fc->ir[sub]->q, link); + + xfer->resp = 0; + switch(xfer->act_type){ + case FWACT_XFER: + fw_xfer_done(xfer); + break; + default: + break; + } + fw_xfer_free(xfer); + } + for(fwb = STAILQ_FIRST(&sc->fc->ir[sub]->binds); fwb != NULL; + fwb = STAILQ_FIRST(&sc->fc->ir[sub]->binds)){ + STAILQ_REMOVE(&sc->fc->binds, fwb, fw_bind, fclist); + STAILQ_REMOVE_HEAD(&sc->fc->ir[sub]->binds, chlist); + free(fwb, M_DEVBUF); + } + sc->fc->ir[sub]->flag &= ~FWXFERQ_MODEMASK; + sc->fc->it[sub]->flag &= ~FWXFERQ_MODEMASK; + return err; +} + +/* + * read request. + */ +static int +fw_read (dev_t dev, struct uio *uio, int ioflag) +{ + struct firewire_softc *sc; + struct fw_xferq *ir; + struct fw_xfer *xfer; + int err = 0, s, slept = 0; + int unit = DEV2UNIT(dev); + int sub = DEV2DMACH(dev); + struct fw_pkt *fp; + + if (DEV_FWMEM(dev)) + return fwmem_read(dev, uio, ioflag); + + sc = devclass_get_softc(firewire_devclass, unit); + + ir = sc->fc->ir[sub]; + + if(ir->flag & FWXFERQ_PACKET){ + ir->stproc = NULL; + } +readloop: + xfer = STAILQ_FIRST(&ir->q); + if(!(ir->flag & FWXFERQ_PACKET) && ir->stproc == NULL){ + ir->stproc = STAILQ_FIRST(&ir->stvalid); + if(ir->stproc != NULL){ + s = splfw(); + STAILQ_REMOVE_HEAD(&ir->stvalid, link); + splx(s); + ir->queued = 0; + } + } + + if(xfer == NULL && ir->stproc == NULL){ + if(slept == 0){ + slept = 1; + if(!(ir->flag & FWXFERQ_RUNNING) + && (ir->flag & FWXFERQ_PACKET)){ + err = sc->fc->irx_enable(sc->fc, sub); + } + if(err){ + return err; + } + ir->flag |= FWXFERQ_WAKEUP; + err = tsleep((caddr_t)ir, FWPRI, "fw_read", hz); + if(err){ + ir->flag &= ~FWXFERQ_WAKEUP; + return err; + } + goto readloop; + }else{ + err = EIO; + return err; + } + }else if(xfer != NULL){ + s = splfw(); + ir->queued --; + STAILQ_REMOVE_HEAD(&ir->q, link); + splx(s); + fp = (struct fw_pkt *)(xfer->recv.buf + xfer->recv.off); + if(sc->fc->irx_post != NULL) + sc->fc->irx_post(sc->fc, fp->mode.ld); + err = uiomove(xfer->recv.buf + xfer->recv.off, xfer->recv.len, uio); + fw_xfer_free( xfer); + }else if(ir->stproc != NULL){ + fp = (struct fw_pkt *)(ir->stproc->buf + ir->queued * ir->psize); + if(sc->fc->irx_post != NULL) + sc->fc->irx_post(sc->fc, fp->mode.ld); + if(ntohs(fp->mode.stream.len) == 0){ + err = EIO; + return err; + } + err = uiomove((caddr_t)fp, ntohs(fp->mode.stream.len) + sizeof(u_int32_t), uio); + fp->mode.stream.len = 0; + ir->queued ++; + if(ir->queued >= ir->bnpacket){ + s = splfw(); + ir->stproc->flag = 0; + STAILQ_INSERT_TAIL(&ir->stfree, ir->stproc, link); + splx(s); + ir->stproc = NULL; + } + } +#if 0 + if(STAILQ_FIRST(&ir->q) == NULL && + (ir->flag & FWXFERQ_RUNNING) && (ir->flag & FWXFERQ_PACKET)){ + err = sc->fc->irx_enable(sc->fc, sub); + } +#endif +#if 0 + if(STAILQ_FIRST(&ir->stvalid) == NULL && + (ir->flag & FWXFERQ_RUNNING) && !(ir->flag & FWXFERQ_PACKET)){ + err = sc->fc->irx_enable(sc->fc, sub); + } +#endif + return err; +} + +static int +fw_write (dev_t dev, struct uio *uio, int ioflag) +{ + int err = 0; + struct firewire_softc *sc; + int unit = DEV2UNIT(dev); + int sub = DEV2DMACH(dev); + int s, slept = 0; + struct fw_pkt *fp; + struct fw_xfer *xfer; + struct fw_xferq *xferq; + struct firewire_comm *fc; + struct fw_xferq *it; + + if (DEV_FWMEM(dev)) + return fwmem_write(dev, uio, ioflag); + + sc = devclass_get_softc(firewire_devclass, unit); + fc = sc->fc; + it = sc->fc->it[sub]; + + fp = (struct fw_pkt *)uio->uio_iov->iov_base; + switch(fp->mode.common.tcode){ + case FWTCODE_RREQQ: + case FWTCODE_RREQB: + case FWTCODE_LREQ: + err = EINVAL; + return err; + case FWTCODE_WREQQ: + case FWTCODE_WREQB: + xferq = fc->atq; + break; + case FWTCODE_STREAM: + if(it->flag & FWXFERQ_PACKET){ + xferq = fc->atq; + }else{ + xferq = NULL; + } + break; + case FWTCODE_WRES: + case FWTCODE_RRESQ: + case FWTCODE_RRESB: + case FWTCODE_LRES: + xferq = fc->ats; + break; + default: + err = EINVAL; + return err; + } + /* Discard unsent buffered stream packet, when sending Asyrequrst */ + if(xferq != NULL && it->stproc != NULL){ + s = splfw(); + it->stproc->flag = 0; + STAILQ_INSERT_TAIL(&it->stfree, it->stproc, link); + splx(s); + it->stproc = NULL; + } + if(xferq == NULL && !(it->flag & FWXFERQ_DV)){ +isoloop: + if(it->stproc == NULL){ + it->stproc = STAILQ_FIRST(&it->stfree); + if(it->stproc != NULL){ + s = splfw(); + STAILQ_REMOVE_HEAD(&it->stfree, link); + splx(s); + it->queued = 0; + }else if(slept == 0){ + slept = 1; + err = sc->fc->itx_enable(sc->fc, sub); + if(err){ + return err; + } + err = tsleep((caddr_t)it, FWPRI, "fw_write", hz); + if(err){ + return err; + } + goto isoloop; + }else{ + err = EIO; + return err; + } + } + fp = (struct fw_pkt *)(it->stproc->buf + it->queued * it->psize); + fp->mode.stream.len = htons(uio->uio_resid - sizeof(u_int32_t)); + err = uiomove(it->stproc->buf + it->queued * it->psize, + uio->uio_resid, uio); + it->queued ++; + if(it->queued >= it->btpacket){ + s = splfw(); + STAILQ_INSERT_TAIL(&it->stvalid, it->stproc, link); + splx(s); + it->stproc = NULL; + fw_tbuf_update(sc->fc, sub, 0); + err = sc->fc->itx_enable(sc->fc, sub); + } + return err; + } if(xferq == NULL && it->flag & FWXFERQ_DV){ +dvloop: + if(it->dvproc == NULL){ + it->dvproc = STAILQ_FIRST(&it->dvfree); + if(it->dvproc != NULL){ + s = splfw(); + STAILQ_REMOVE_HEAD(&it->dvfree, link); + splx(s); + it->dvptr = 0; + }else if(slept == 0){ + slept = 1; + err = sc->fc->itx_enable(sc->fc, sub); + if(err){ + return err; + } + err = tsleep((caddr_t)it, FWPRI, "fw_write", hz); + if(err){ + return err; + } + goto dvloop; + }else{ + err = EIO; + return err; + } + } + fp = (struct fw_pkt *)(it->dvproc->buf + it->queued * it->psize); + fp->mode.stream.len = htons(uio->uio_resid - sizeof(u_int32_t)); + err = uiomove(it->dvproc->buf + it->dvptr, + uio->uio_resid, uio); + it->dvptr += it->psize; + if(err){ + return err; + } + if(it->dvptr >= it->psize * it->dvpacket){ + s = splfw(); + STAILQ_INSERT_TAIL(&it->dvvalid, it->dvproc, link); + splx(s); + it->dvproc = NULL; + err = fw_tbuf_update(sc->fc, sub, 0); + if(err){ + return err; + } + err = sc->fc->itx_enable(sc->fc, sub); + } + return err; + } + if(xferq != NULL){ + xfer = fw_xfer_alloc(); + if(xfer == NULL){ + err = ENOMEM; + return err; + } + xfer->send.buf = malloc(uio->uio_resid, M_DEVBUF, M_NOWAIT); + if(xfer->send.buf == NULL){ + fw_xfer_free( xfer); + err = ENOBUFS; + return err; + } + xfer->dst = ntohs(fp->mode.hdr.dst); +#if 0 + switch(fp->mode.common.tcode){ + case FWTCODE_WREQQ: + case FWTCODE_WREQB: + if((tl = fw_get_tlabel(fc, xfer)) == -1 ){ + fw_xfer_free( xfer); + err = EAGAIN; + return err; + } + fp->mode.hdr.tlrt = tl << 2; + default: + break; + } + + xfer->tl = fp->mode.hdr.tlrt >> 2; + xfer->tcode = fp->mode.common.tcode; + xfer->fc = fc; + xfer->q = xferq; + xfer->act_type = FWACT_XFER; + xfer->retry_req = fw_asybusy; +#endif + xfer->send.len = uio->uio_resid; + xfer->send.off = 0; + xfer->spd = 0;/* XXX: how to setup it */ + xfer->act.hand = fw_asy_callback; + + err = uiomove(xfer->send.buf, uio->uio_resid, uio); + if(err){ + fw_xfer_free( xfer); + return err; + } +#if 0 + fw_asystart(xfer); +#else + fw_asyreq(fc, -1, xfer); +#endif + err = tsleep((caddr_t)xfer, FWPRI, "fw_write", hz); + if(xfer->resp == EBUSY) + return EBUSY; + fw_xfer_free( xfer); + return err; + } + return EINVAL; +} + +/* + * ioctl support. + */ +int +fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) +{ + struct firewire_softc *sc; + int unit = DEV2UNIT(dev); + int sub = DEV2DMACH(dev); + int i, len, err = 0; + struct fw_device *fwdev; + struct fw_bind *fwb; + struct fw_xferq *ir, *it; + struct fw_xfer *xfer; + struct fw_pkt *fp; + + struct fw_devlstreq *fwdevlst = (struct fw_devlstreq *)data; + struct fw_asyreq *asyreq = (struct fw_asyreq *)data; + struct fw_isochreq *ichreq = (struct fw_isochreq *)data; + struct fw_isobufreq *ibufreq = (struct fw_isobufreq *)data; + struct fw_asybindreq *bindreq = (struct fw_asybindreq *)data; +#if 0 + struct fw_map_buf *map_buf = (struct fw_map_buf *)data; +#endif + struct fw_crom_buf *crom_buf = (struct fw_crom_buf *)data; + + if (DEV_FWMEM(dev)) + return fwmem_ioctl(dev, cmd, data, flag, td); + + sc = devclass_get_softc(firewire_devclass, unit); + if (!data) + return(EINVAL); + + switch (cmd) { + case FW_STSTREAM: + sc->fc->it[sub]->flag &= ~0xff; + sc->fc->it[sub]->flag |= (0x3f & ichreq->ch); + sc->fc->it[sub]->flag |= ((0x3 & ichreq->tag) << 6); + err = 0; + break; + case FW_GTSTREAM: + ichreq->ch = sc->fc->it[sub]->flag & 0x3f; + ichreq->tag =(sc->fc->it[sub]->flag) >> 2 & 0x3; + err = 0; + break; + case FW_SRSTREAM: + sc->fc->ir[sub]->flag &= ~0xff; + sc->fc->ir[sub]->flag |= (0x3f & ichreq->ch); + sc->fc->ir[sub]->flag |= ((0x3 & ichreq->tag) << 6); + err = sc->fc->irx_enable(sc->fc, sub); + break; + case FW_GRSTREAM: + ichreq->ch = sc->fc->ir[sub]->flag & 0x3f; + ichreq->tag =(sc->fc->ir[sub]->flag) >> 2 & 0x3; + err = 0; + break; + case FW_SSTDV: + ibufreq = (struct fw_isobufreq *) + malloc(sizeof(struct fw_isobufreq), M_DEVBUF, M_NOWAIT); + if(ibufreq == NULL){ + err = ENOMEM; + break; + } +#define FWDVPACKET 250 +#define FWDVPMAX 512 + ibufreq->rx.nchunk = 8; + ibufreq->rx.npacket = 50; + ibufreq->rx.psize = FWDVPMAX; + + ibufreq->tx.nchunk = 5; + ibufreq->tx.npacket = 300; + ibufreq->tx.psize = FWDVPMAX; + + err = fw_ioctl(dev, FW_SSTBUF, (caddr_t)ibufreq, flag, td); + sc->fc->it[sub]->dvpacket = FWDVPACKET; + free(ibufreq, M_DEVBUF); +/* reserve a buffer space */ +#define NDVCHUNK 8 + sc->fc->it[sub]->dvproc = NULL; + sc->fc->it[sub]->dvdma = NULL; + sc->fc->it[sub]->flag |= FWXFERQ_DV; + sc->fc->it[sub]->dvbuf + = (struct fw_dvbuf *)malloc(sizeof(struct fw_dvbuf) * NDVCHUNK, M_DEVBUF, M_DONTWAIT); + STAILQ_INIT(&sc->fc->it[sub]->dvvalid); + STAILQ_INIT(&sc->fc->it[sub]->dvfree); + for( i = 0 ; i < NDVCHUNK ; i++){ + sc->fc->it[sub]->dvbuf[i].buf + = malloc(FWDVPMAX * sc->fc->it[sub]->dvpacket, M_DEVBUF, M_DONTWAIT); + STAILQ_INSERT_TAIL(&sc->fc->it[sub]->dvfree, + &sc->fc->it[sub]->dvbuf[i], link); + } + break; + case FW_SSTBUF: + ir = sc->fc->ir[sub]; + it = sc->fc->it[sub]; + + if(ir->flag & FWXFERQ_RUNNING || it->flag & FWXFERQ_RUNNING){ + return(EBUSY); + } + if((ir->flag & FWXFERQ_EXTBUF) || (it->flag & FWXFERQ_EXTBUF)){ + return(EBUSY); + } + if((ibufreq->rx.nchunk * + ibufreq->rx.psize * ibufreq->rx.npacket) + + (ibufreq->tx.nchunk * + ibufreq->tx.psize * ibufreq->tx.npacket) <= 0){ + return(EINVAL); + } + if(ibufreq->rx.nchunk > FWSTMAXCHUNK || + ibufreq->tx.nchunk > FWSTMAXCHUNK){ + return(EINVAL); + } + ir->bulkxfer + = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->rx.nchunk, M_DEVBUF, M_DONTWAIT); + if(ir->bulkxfer == NULL){ + return(ENOMEM); + } + it->bulkxfer + = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->tx.nchunk, M_DEVBUF, M_DONTWAIT); + if(it->bulkxfer == NULL){ + return(ENOMEM); + } + ir->buf = malloc( + ibufreq->rx.nchunk * ibufreq->rx.npacket + * ((ibufreq->rx.psize + 3) &~3), + M_DEVBUF, M_DONTWAIT); + if(ir->buf == NULL){ + free(ir->bulkxfer, M_DEVBUF); + free(it->bulkxfer, M_DEVBUF); + ir->bulkxfer = NULL; + it->bulkxfer = NULL; + it->buf = NULL; + return(ENOMEM); + } + it->buf = malloc( + ibufreq->tx.nchunk * ibufreq->tx.npacket + * ((ibufreq->tx.psize + 3) &~3), + M_DEVBUF, M_DONTWAIT); + if(it->buf == NULL){ + free(ir->bulkxfer, M_DEVBUF); + free(it->bulkxfer, M_DEVBUF); + free(ir->buf, M_DEVBUF); + ir->bulkxfer = NULL; + it->bulkxfer = NULL; + it->buf = NULL; + return(ENOMEM); + } + + ir->bnchunk = ibufreq->rx.nchunk; + ir->bnpacket = ibufreq->rx.npacket; + ir->btpacket = ibufreq->rx.npacket; + ir->psize = (ibufreq->rx.psize + 3) & ~3; + ir->queued = 0; + + it->bnchunk = ibufreq->tx.nchunk; + it->bnpacket = ibufreq->tx.npacket; + it->btpacket = ibufreq->tx.npacket; + it->psize = (ibufreq->tx.psize + 3) & ~3; + ir->queued = 0; + it->dvdbc = 0; + it->dvdiff = 0; + it->dvsync = 0; + + STAILQ_INIT(&ir->stvalid); + STAILQ_INIT(&ir->stfree); + ir->stdma = NULL; + ir->stdma2 = NULL; + ir->stproc = NULL; + + STAILQ_INIT(&it->stvalid); + STAILQ_INIT(&it->stfree); + it->stdma = NULL; + it->stdma2 = NULL; + it->stproc = NULL; + + for(i = 0 ; i < sc->fc->ir[sub]->bnchunk; i++){ + ir->bulkxfer[i].buf = + ir->buf + + i * sc->fc->ir[sub]->bnpacket * + sc->fc->ir[sub]->psize; + ir->bulkxfer[i].flag = 0; + STAILQ_INSERT_TAIL(&ir->stfree, + &ir->bulkxfer[i], link); + ir->bulkxfer[i].npacket = ir->bnpacket; + } + for(i = 0 ; i < sc->fc->it[sub]->bnchunk; i++){ + it->bulkxfer[i].buf = + it->buf + + i * sc->fc->it[sub]->bnpacket * + sc->fc->it[sub]->psize; + it->bulkxfer[i].flag = 0; + STAILQ_INSERT_TAIL(&it->stfree, + &it->bulkxfer[i], link); + it->bulkxfer[i].npacket = it->bnpacket; + } + ir->flag &= ~FWXFERQ_MODEMASK; + ir->flag |= FWXFERQ_STREAM; + ir->flag |= FWXFERQ_EXTBUF; + + it->flag &= ~FWXFERQ_MODEMASK; + it->flag |= FWXFERQ_STREAM; + it->flag |= FWXFERQ_EXTBUF; + err = 0; + break; + case FW_GSTBUF: + ibufreq->rx.nchunk = sc->fc->ir[sub]->bnchunk; + ibufreq->rx.npacket = sc->fc->ir[sub]->bnpacket; + ibufreq->rx.psize = sc->fc->ir[sub]->psize; + + ibufreq->tx.nchunk = sc->fc->it[sub]->bnchunk; + ibufreq->tx.npacket = sc->fc->it[sub]->bnpacket; + ibufreq->tx.psize = sc->fc->it[sub]->psize; + break; + case FW_ASYREQ: + xfer = fw_xfer_alloc(); + if(xfer == NULL){ + err = ENOMEM; + return err; + } + fp = &asyreq->pkt; + switch (asyreq->req.type) { + case FWASREQNODE: + xfer->dst = ntohs(fp->mode.hdr.dst); + break; + case FWASREQEUI: + fwdev = fw_noderesolve(sc->fc, asyreq->req.dst.eui); + if (fwdev == NULL) { + printf("%s:cannot found node\n", + device_get_nameunit(sc->fc->dev)); + err = EINVAL; + goto error; + } + xfer->dst = fwdev->dst; + fp->mode.hdr.dst = htons(FWLOCALBUS | xfer->dst); + break; + case FWASRESTL: + /* XXX what's this? */ + break; + case FWASREQSTREAM: + /* nothing to do */ + break; + } + xfer->spd = asyreq->req.sped; + xfer->send.len = asyreq->req.len; + xfer->send.buf = malloc(xfer->send.len, M_DEVBUF, M_NOWAIT); + if(xfer->send.buf == NULL){ + return ENOMEM; + } + xfer->send.off = 0; + bcopy(fp, xfer->send.buf, xfer->send.len); + xfer->act.hand = fw_asy_callback; + err = fw_asyreq(sc->fc, sub, xfer); + if(err){ + fw_xfer_free( xfer); + return err; + } + err = tsleep((caddr_t)xfer, FWPRI, "asyreq", hz); + if(err == 0){ + if(asyreq->req.len >= xfer->recv.len){ + asyreq->req.len = xfer->recv.len; + }else{ + err = EINVAL; + } + bcopy(xfer->recv.buf + xfer->recv.off, fp, asyreq->req.len); + } +error: + fw_xfer_free( xfer); + break; + case FW_IBUSRST: + sc->fc->ibr(sc->fc); + break; + case FW_CBINDADDR: + fwb = fw_bindlookup(sc->fc, + bindreq->start.hi, bindreq->start.lo); + if(fwb == NULL){ + err = EINVAL; + break; + } + STAILQ_REMOVE(&sc->fc->binds, fwb, fw_bind, fclist); + STAILQ_REMOVE(&sc->fc->ir[sub]->binds, fwb, fw_bind, chlist); + free(fwb, M_DEVBUF); + break; + case FW_SBINDADDR: + if(bindreq->len <= 0 ){ + err = EINVAL; + break; + } + if(bindreq->start.hi > 0xffff ){ + err = EINVAL; + break; + } + fwb = (struct fw_bind *)malloc(sizeof (struct fw_bind), M_DEVBUF, M_DONTWAIT); + if(fwb == NULL){ + err = ENOMEM; + break; + } + fwb->start_hi = bindreq->start.hi; + fwb->start_lo = bindreq->start.lo; + fwb->addrlen = bindreq->len; + + xfer = fw_xfer_alloc(); + if(xfer == NULL){ + err = ENOMEM; + return err; + } + xfer->act_type = FWACT_CH; + xfer->sub = sub; + xfer->fc = sc->fc; + + fwb->xfer = xfer; + err = fw_bindadd(sc->fc, fwb); + break; + case FW_GDEVLST: + i = 0; + for(fwdev = TAILQ_FIRST(&sc->fc->devices); fwdev != NULL; + fwdev = TAILQ_NEXT(fwdev, link)){ + if(i < fwdevlst->n){ + fwdevlst->dst[i] = fwdev->dst; + fwdevlst->status[i] = + (fwdev->status == FWDEVATTACHED)?1:0; + fwdevlst->eui[i].hi = fwdev->eui.hi; + fwdevlst->eui[i].lo = fwdev->eui.lo; + } + i++; + } + fwdevlst->n = i; + break; + case FW_GTPMAP: + bcopy(sc->fc->topology_map, data, + (sc->fc->topology_map->crc_len + 1) * 4); + break; + case FW_GSPMAP: + /* speed_map is larger than a page */ + err = copyout(sc->fc->speed_map, *(void **)data, + (sc->fc->speed_map->crc_len + 1) * 4); + break; + case FW_GCROM: + for (fwdev = TAILQ_FIRST(&sc->fc->devices); fwdev != NULL; + fwdev = TAILQ_NEXT(fwdev, link)) { + if (fwdev->eui.hi == crom_buf->eui.hi && + fwdev->eui.lo == crom_buf->eui.lo) + break; + } + if (fwdev == NULL) { + err = FWNODE_INVAL; + break; + } +#if 0 + if (fwdev->csrrom[0] >> 24 == 1) + len = 4; + else + len = (1 + ((fwdev->csrrom[0] >> 16) & 0xff)) * 4; +#else + if (fwdev->rommax < CSRROMOFF) + len = 0; + else + len = fwdev->rommax - CSRROMOFF + 4; +#endif + if (crom_buf->len < len) + len = crom_buf->len; + else + crom_buf->len = len; + err = copyout(&fwdev->csrrom[0], crom_buf->ptr, len); + break; + default: + sc->fc->ioctl (dev, cmd, data, flag, td); + break; + } + return err; +} +int +fw_poll(dev_t dev, int events, fw_proc *td) +{ + int revents; + int tmp; + int unit = DEV2UNIT(dev); + int sub = DEV2DMACH(dev); + struct firewire_softc *sc; + + if (DEV_FWMEM(dev)) + return fwmem_poll(dev, events, td); + + sc = devclass_get_softc(firewire_devclass, unit); + revents = 0; + tmp = POLLIN | POLLRDNORM; + if (events & tmp) { + if (STAILQ_FIRST(&sc->fc->ir[sub]->q) != NULL) + revents |= tmp; + else + selrecord(td, &sc->fc->ir[sub]->rsel); + } + tmp = POLLOUT | POLLWRNORM; + if (events & tmp) { + /* XXX should be fixed */ + revents |= tmp; + } + + return revents; +} + +static int +fw_mmap (dev_t dev, vm_offset_t offset, int nproto) +{ + struct firewire_softc *fc; + int unit = DEV2UNIT(dev); + + if (DEV_FWMEM(dev)) + return fwmem_mmap(dev, offset, nproto); + + fc = devclass_get_softc(firewire_devclass, unit); + + return EINVAL; +} -- cgit v1.3 From c57d646f997f14422b172500ea2fc94275a174ac Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Tue, 12 Nov 2002 17:11:32 +0000 Subject: fix wording. --- sys/dev/firewire/fwdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 66286a2fd461..ae8a7009450f 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -728,7 +728,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) case FWASREQEUI: fwdev = fw_noderesolve(sc->fc, asyreq->req.dst.eui); if (fwdev == NULL) { - printf("%s:cannot found node\n", + printf("%s:cannot find node\n", device_get_nameunit(sc->fc->dev)); err = EINVAL; goto error; -- cgit v1.3 From bce5729a9d3db5d19a442491719d1d52d35c7c11 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Sat, 4 Jan 2003 16:03:50 +0000 Subject: - Remove speed_map API because speed_map is obsoleted by 1394a. - Add definition of OHCI_HCC_BIBIV in fwohcireg.h. --- sys/dev/firewire/firewire.h | 1 - sys/dev/firewire/fwdev.c | 5 ----- sys/dev/firewire/fwohcireg.h | 15 ++++++++------- usr.sbin/fwcontrol/fwcontrol.8 | 4 +--- usr.sbin/fwcontrol/fwcontrol.c | 29 ++--------------------------- 5 files changed, 11 insertions(+), 43 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index 032e59be716a..656c5f479e71 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -544,7 +544,6 @@ struct fw_crom_buf { #define FW_SBINDADDR _IOWR('S', 3, struct fw_asybindreq) #define FW_CBINDADDR _IOWR('S', 4, struct fw_asybindreq) #define FW_GTPMAP _IOR('S', 5, struct fw_topology_map) -#define FW_GSPMAP _IOW('S', 6, struct fw_speed_map *) #define FW_GCROM _IOWR('S', 7, struct fw_crom_buf) #define FWOHCI_RDREG _IOWR('S', 80, struct fw_reg_req_t) diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index ae8a7009450f..1c9a70d705da 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -832,11 +832,6 @@ error: bcopy(sc->fc->topology_map, data, (sc->fc->topology_map->crc_len + 1) * 4); break; - case FW_GSPMAP: - /* speed_map is larger than a page */ - err = copyout(sc->fc->speed_map, *(void **)data, - (sc->fc->speed_map->crc_len + 1) * 4); - break; case FW_GCROM: for (fwdev = TAILQ_FIRST(&sc->fc->devices); fwdev != NULL; fwdev = TAILQ_NEXT(fwdev, link)) { diff --git a/sys/dev/firewire/fwohcireg.h b/sys/dev/firewire/fwohcireg.h index 1f874eedb9fb..572370d2f454 100644 --- a/sys/dev/firewire/fwohcireg.h +++ b/sys/dev/firewire/fwohcireg.h @@ -172,13 +172,14 @@ struct ohci_registers { fwohcireg_t dummy1[3]; /* dummy 0x44-0x4c */ fwohcireg_t hcc_cntl_set; /* HCC control set 0x50 */ fwohcireg_t hcc_cntl_clr; /* HCC control clr 0x54 */ -#define OHCI_HCC_BIGEND (1 << 30) -#define OHCI_HCC_PRPHY (1 << 23) -#define OHCI_HCC_PHYEN (1 << 22) -#define OHCI_HCC_LPS (1 << 19) -#define OHCI_HCC_POSTWR (1 << 18) -#define OHCI_HCC_LINKEN (1 << 17) -#define OHCI_HCC_RESET (1 << 16) +#define OHCI_HCC_BIBIV (1 << 31) /* BIBimage Valid */ +#define OHCI_HCC_BIGEND (1 << 30) /* noByteSwapData */ +#define OHCI_HCC_PRPHY (1 << 23) /* programPhyEnable */ +#define OHCI_HCC_PHYEN (1 << 22) /* aPhyEnhanceEnable */ +#define OHCI_HCC_LPS (1 << 19) /* LPS */ +#define OHCI_HCC_POSTWR (1 << 18) /* postedWriteEnable */ +#define OHCI_HCC_LINKEN (1 << 17) /* linkEnable */ +#define OHCI_HCC_RESET (1 << 16) /* softReset */ fwohcireg_t dummy2[2]; /* dummy 0x58-0x5c */ fwohcireg_t dummy3[1]; /* dummy 0x60 */ fwohcireg_t sid_buf; /* self id buffer 0x64 */ diff --git a/usr.sbin/fwcontrol/fwcontrol.8 b/usr.sbin/fwcontrol/fwcontrol.8 index 809389cff7d1..d29d2dd3cbd5 100644 --- a/usr.sbin/fwcontrol/fwcontrol.8 +++ b/usr.sbin/fwcontrol/fwcontrol.8 @@ -33,7 +33,7 @@ .Nd FireWire control utility .Sh SYNOPSIS .Nm -.Op Fl rts +.Op Fl rt .Op Fl c Ar node .Op Fl d Ar node .Op Fl l Ar file @@ -51,8 +51,6 @@ FireWire subsystem. Initiate bus reset. .It Fl t Show the topology map. -.It Fl s -Show the speed map. .It Fl c Ar node Show the configuration ROM on the node. .It Fl d Ar node diff --git a/usr.sbin/fwcontrol/fwcontrol.c b/usr.sbin/fwcontrol/fwcontrol.c index a7ed68cfafe2..c11ef4e86c20 100644 --- a/usr.sbin/fwcontrol/fwcontrol.c +++ b/usr.sbin/fwcontrol/fwcontrol.c @@ -54,13 +54,12 @@ static void usage(void) { printf("fwcontrol [-g gap_count] [-b pri_req] [-c node]" - " [-r] [-t] [-s] [-d node] [-l file]\n"); + " [-r] [-t] [-d node] [-l file]\n"); printf("\t-g: broadcast gap_count by phy_config packet\n"); printf("\t-b: set PRIORITY_BUDGET register on all supported nodes\n"); printf("\t-c: read configuration ROM\n"); printf("\t-r: bus reset\n"); printf("\t-t: read topology map\n"); - printf("\t-s: read speed map\n"); printf("\t-d: hex dump of configuration ROM\n"); printf("\t-l: load and parse hex dump file of configuration ROM\n"); exit(0); @@ -339,27 +338,6 @@ show_topology_map(int fd) free(tmap); } -static void -show_speed_map(int fd) -{ - struct fw_speed_map *smap; - int i,j; - - smap = malloc(sizeof(struct fw_speed_map)); - if (smap == NULL) - return; - if (ioctl(fd, FW_GSPMAP, &smap) < 0) { - err(1, "ioctl"); - } - printf("crc_len: %d generation:%d\n", smap->crc_len, smap->generation); - for (i = 0; i < 64; i ++) { - for (j = 0; j < 64; j ++) - printf("%d", smap->speed[i][j]); - printf("\n"); - } - free(smap); -} - int main(int argc, char **argv) { @@ -375,7 +353,7 @@ main(int argc, char **argv) usage(); } - while ((ch = getopt(argc, argv, "g:b:rtsc:d:l:")) != -1) + while ((ch = getopt(argc, argv, "g:b:rtc:d:l:")) != -1) switch(ch) { case 'g': /* gap count */ @@ -393,9 +371,6 @@ main(int argc, char **argv) case 't': show_topology_map(fd); break; - case 's': - show_speed_map(fd); - break; case 'c': tmp = strtol(optarg, NULL, 0); get_crom(fd, tmp, crom_buf, len); -- cgit v1.3 From 17faeefca6ed8711eba311873ba918eb1df61f9a Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Mon, 6 Jan 2003 08:07:20 +0000 Subject: Use device_printf() and s/fc->dev/fc->bdev/. --- sys/dev/firewire/fwdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 1c9a70d705da..c6e7c581e56b 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -728,8 +728,8 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) case FWASREQEUI: fwdev = fw_noderesolve(sc->fc, asyreq->req.dst.eui); if (fwdev == NULL) { - printf("%s:cannot find node\n", - device_get_nameunit(sc->fc->dev)); + device_printf(sc->fc->bdev, + "cannot find node\n"); err = EINVAL; goto error; } -- cgit v1.3 From 0aaa9a23cdb2f1df04df89bb0ad3f678b65d58eb Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Mon, 13 Jan 2003 16:08:09 +0000 Subject: Minimal fix for DV part. - Don't panic on contigmalloc failure. - Calculate timestamp by feedforward rather than feedback which depends on unreliable interrupt timing. - Overwrite timestamp in CIP header correctly. - Add debug code for timestamp synchronization. - Add comments. --- sys/dev/firewire/firewire.c | 42 ++++++++++++++-------------- sys/dev/firewire/firewirereg.h | 2 +- sys/dev/firewire/fwdev.c | 9 +++++- sys/dev/firewire/fwohci.c | 63 +++++++++++++++++++++++++++++++++++------- 4 files changed, 84 insertions(+), 32 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 7ed2fd139748..ec67f71f17a0 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -129,7 +129,7 @@ fw_tbuf_update(struct firewire_comm *fc, int sub, int flag){ struct fw_xferq *it; int s, err = 0, i, j, chtag; struct fw_pkt *fp; - u_int64_t tmpsync, dvsync; + u_int64_t cycle, dvsync; it = fc->it[sub]; @@ -193,17 +193,27 @@ dvloop: }else{ return err; } -/* - * Insert least significant 12 bits timestamp value by computation. - * Highest significant 4 bits is insert at just before packet sending. - */ - fp = (struct fw_pkt *)(it->stproc->buf); -/* XXX: Parameter relies on NTSC type DV video */ - tmpsync = (u_int64_t)3072 * 8000 * 100 / 2997; - tmpsync *= it->dvsync; - dvsync = tmpsync; - dvsync %= 0xc00; - fp->mode.ld[2] = htonl(0x80000000 | (dvsync % 0xc00)); +#if 1 +#define DVSEC 100 +#define DVFRAC 2997 /* NTSC: 29.97 Hz (2997 = 29.97 * 100) */ +#define DVDIFF 203 /* 203 = (8000/250 - 29.97) * 100 */ +#else +#define DVSEC 3 +#define DVFRAC 75 /* PAL: 25 Hz (1875 = 25 * 3) */ +#define DVDIFF 5 /* 125 = (8000/300 - 25) * 3 */ +#endif +#define CYCLEFRAC 0xc00 + cycle = (u_int64_t) 8000 * DVSEC * it->dvsync; + /* least significant 12 bits */ + dvsync = (cycle * CYCLEFRAC / DVFRAC) % CYCLEFRAC; + /* most significat 4 bits */ + cycle = (cycle / DVFRAC + it->dvoffset) & 0xf; + fp = (struct fw_pkt *)(it->dvdma->buf); +#if 1 + fp->mode.ld[2] = htonl(0x80000000 | (cycle << 12) | dvsync); +#else + fp->mode.ld[2] = htonl(0x80000000 | dvsync); +#endif it->dvsync ++; it->dvsync %= 2997; @@ -219,14 +229,6 @@ dvloop: it->dvdbc %= 256; it->queued ++; j++; -/* XXX: Parameter relies on NTSC type DV video */ -#if 1 -#define DVDIFF 203 -#define DVFRAC 2997 -#else -#define DVDIFF 127 -#define DVFRAC 1875 -#endif it->dvdiff += DVDIFF; if(it->dvdiff >= DVFRAC){ it->dvdiff %= DVFRAC; diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index bfa7256cbb7b..20ba3186cb57 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -176,7 +176,7 @@ struct firewire_comm{ struct fw_bulkxfer *stdma2; struct fw_bulkxfer *stproc; u_int procptr; - int dvdbc, dvdiff, dvsync; + int dvdbc, dvdiff, dvsync, dvoffset; struct fw_dvbuf *dvbuf; STAILQ_HEAD(, fw_dvbuf) dvvalid; STAILQ_HEAD(, fw_dvbuf) dvfree; diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index c6e7c581e56b..d0f6371ccd25 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -383,8 +383,10 @@ isoloop: return err; } } +#if 0 /* What's this for? (overwritten by the following uiomove)*/ fp = (struct fw_pkt *)(it->stproc->buf + it->queued * it->psize); fp->mode.stream.len = htons(uio->uio_resid - sizeof(u_int32_t)); +#endif err = uiomove(it->stproc->buf + it->queued * it->psize, uio->uio_resid, uio); it->queued ++; @@ -422,8 +424,10 @@ dvloop: return err; } } +#if 0 /* What's this for? (it->dvptr? overwritten by the following uiomove)*/ fp = (struct fw_pkt *)(it->dvproc->buf + it->queued * it->psize); fp->mode.stream.len = htons(uio->uio_resid - sizeof(u_int32_t)); +#endif err = uiomove(it->dvproc->buf + it->dvptr, uio->uio_resid, uio); it->dvptr += it->psize; @@ -564,7 +568,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) err = ENOMEM; break; } -#define FWDVPACKET 250 +#define FWDVPACKET 250 /* NTSC (300 for PAL) */ #define FWDVPMAX 512 ibufreq->rx.nchunk = 8; ibufreq->rx.npacket = 50; @@ -582,11 +586,13 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) sc->fc->it[sub]->dvproc = NULL; sc->fc->it[sub]->dvdma = NULL; sc->fc->it[sub]->flag |= FWXFERQ_DV; + /* XXX check malloc failure */ sc->fc->it[sub]->dvbuf = (struct fw_dvbuf *)malloc(sizeof(struct fw_dvbuf) * NDVCHUNK, M_DEVBUF, M_DONTWAIT); STAILQ_INIT(&sc->fc->it[sub]->dvvalid); STAILQ_INIT(&sc->fc->it[sub]->dvfree); for( i = 0 ; i < NDVCHUNK ; i++){ + /* XXX check malloc failure */ sc->fc->it[sub]->dvbuf[i].buf = malloc(FWDVPMAX * sc->fc->it[sub]->dvpacket, M_DEVBUF, M_DONTWAIT); STAILQ_INSERT_TAIL(&sc->fc->it[sub]->dvfree, @@ -663,6 +669,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) it->dvdbc = 0; it->dvdiff = 0; it->dvsync = 0; + it->dvoffset = 0; STAILQ_INIT(&ir->stvalid); STAILQ_INIT(&ir->stfree); diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 4fbdcad201c6..b4c1b2044ade 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -74,6 +74,8 @@ #include #include +#include + #undef OHCI_DEBUG static char dbcode[16][0x10]={"OUTM", "OUTL","INPM","INPL", @@ -1248,6 +1250,8 @@ fwohci_irxpp_enable(struct firewire_comm *fc, int dmach) sc->ir[dmach].xferq.psize = FWPMAX_S400; sc->ir[dmach].ndesc = 1; fwohci_db_init(&sc->ir[dmach]); + if ((sc->ir[dmach].flags & FWOHCI_DBCH_INIT) == 0) + return ENOMEM; err = fwohci_rx_enable(sc, &sc->ir[dmach]); } if(err){ @@ -1414,11 +1418,13 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach) tag = (sc->it[dmach].xferq.flag >> 6) & 3; ich = sc->it[dmach].xferq.flag & 0x3f; dbch = &sc->it[dmach]; - if(dbch->ndb == 0){ + if ((dbch->flags & FWOHCI_DBCH_INIT) == 0) { dbch->xferq.queued = 0; dbch->ndb = dbch->xferq.bnpacket * dbch->xferq.bnchunk; dbch->ndesc = 3; fwohci_db_init(dbch); + if ((dbch->flags & FWOHCI_DBCH_INIT) == 0) + return ENOMEM; err = fwohci_tx_enable(sc, dbch); } if(err) @@ -1469,8 +1475,12 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach) if(dbch->xferq.flag & FWXFERQ_DV){ db_tr = (struct fwohcidb_tr *)dbch->xferq.stdma->start; fp = (struct fw_pkt *)db_tr->buf; - fp->mode.ld[2] = htonl(0x80000000 + - ((fc->cyctimer(fc) + 0x3000) & 0xf000)); + dbch->xferq.dvoffset = + ((fc->cyctimer(fc) >> 12) + 4) & 0xf; +#if 0 + printf("dvoffset: %d\n", dbch->xferq.dvoffset); +#endif + fp->mode.ld[2] |= htonl(dbch->xferq.dvoffset << 12); } OWRITE(sc, OHCI_ITCTL(dmach), OHCI_CNTL_DMA_RUN); @@ -1503,6 +1513,8 @@ fwohci_irxbuf_enable(struct firewire_comm *fc, int dmach) } sc->ir[dmach].ndesc = 2; fwohci_db_init(&sc->ir[dmach]); + if ((sc->ir[dmach].flags & FWOHCI_DBCH_INIT) == 0) + return ENOMEM; err = fwohci_rx_enable(sc, &sc->ir[dmach]); } if(err) @@ -1890,40 +1902,71 @@ fwohci_tbuf_update(struct fwohci_softc *sc, int dmach) struct fwohcidb_tr *db_tr; dbch = &sc->it[dmach]; +#if 0 /* XXX OHCI interrupt before the last packet is really on the wire */ if((dbch->xferq.flag & FWXFERQ_DV) && (dbch->xferq.stdma2 != NULL)){ db_tr = (struct fwohcidb_tr *)dbch->xferq.stdma2->start; /* * Overwrite highest significant 4 bits timestamp information */ fp = (struct fw_pkt *)db_tr->buf; - fp->mode.ld[2] |= htonl(0x80000000 | - ((fc->cyctimer(fc) + 0x4000) & 0xf000)); + fp->mode.ld[2] &= htonl(0xffff0fff); + fp->mode.ld[2] |= htonl((fc->cyctimer(fc) + 0x4000) & 0xf000); } +#endif stat = OREAD(sc, OHCI_ITCTL(dmach)) & 0x1f; switch(stat){ case FWOHCIEV_ACKCOMPL: +#if 1 + if (dbch->xferq.flag & FWXFERQ_DV) { + struct ciphdr *ciph; + int timer, timestamp, cycl, diff; + static int last_timer=0; + + timer = (fc->cyctimer(fc) >> 12) & 0xffff; + db_tr = (struct fwohcidb_tr *)dbch->xferq.stdma->start; + fp = (struct fw_pkt *)db_tr->buf; + ciph = (struct ciphdr *) &fp->mode.ld[1]; + timestamp = db_tr->db[2].db.desc.count & 0xffff; + cycl = ntohs(ciph->fdf.dv.cyc) >> 12; + diff = cycl - (timestamp & 0xf) - 1; + if (diff < 0) + diff += 16; + if (diff > 8) + diff -= 16; + if (firewire_debug) + printf("dbc: %3d timer: 0x%04x packet: 0x%04x" + " cyc: 0x%x diff: %+1d\n", + ciph->dbc, last_timer, timestamp, cycl, diff); + last_timer = timer; + /* XXX adjust dbch->xferq.dvoffset if diff != 0 or 1 */ + } +#endif fw_tbuf_update(fc, dmach, 1); break; default: + device_printf(fc->dev, "Isochronous transmit err %02x\n", stat); fw_tbuf_update(fc, dmach, 0); break; } - fwohci_itxbuf_enable(&sc->fc, dmach); + fwohci_itxbuf_enable(fc, dmach); } static void fwohci_rbuf_update(struct fwohci_softc *sc, int dmach) { + struct firewire_comm *fc = &sc->fc; int stat; + stat = OREAD(sc, OHCI_IRCTL(dmach)) & 0x1f; switch(stat){ case FWOHCIEV_ACKCOMPL: - fw_rbuf_update(&sc->fc, dmach, 1); - wakeup(sc->fc.ir[dmach]); - fwohci_irx_enable(&sc->fc, dmach); + fw_rbuf_update(fc, dmach, 1); + wakeup(fc->ir[dmach]); + fwohci_irx_enable(fc, dmach); break; default: - device_printf(sc->fc.dev, "Isochronous receive err %02x\n", stat); + device_printf(fc->dev, "Isochronous receive err %02x\n", + stat); break; } } -- cgit v1.3 From 6d6f7f28913e78c7a714f8ba27f12843b9b11258 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Wed, 15 Jan 2003 05:26:23 +0000 Subject: Add DV_PAL for PAL users. --- sys/dev/firewire/firewire.c | 10 +++++----- sys/dev/firewire/fwdev.c | 9 +++++++-- sys/dev/firewire/iec68113.h | 2 ++ 3 files changed, 14 insertions(+), 7 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 4b674c43f2e0..89f45980cec4 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -184,14 +184,14 @@ dvloop: }else{ goto out; } -#if 1 -#define DVSEC 100 -#define DVFRAC 2997 /* NTSC: 29.97 Hz (2997 = 29.97 * 100) */ -#define DVDIFF 203 /* 203 = (8000/250 - 29.97) * 100 */ -#else +#if DV_PAL #define DVSEC 3 #define DVFRAC 75 /* PAL: 25 Hz (1875 = 25 * 3) */ #define DVDIFF 5 /* 125 = (8000/300 - 25) * 3 */ +#else +#define DVSEC 100 +#define DVFRAC 2997 /* NTSC: 29.97 Hz (2997 = 29.97 * 100) */ +#define DVDIFF 203 /* 203 = (8000/250 - 29.97) * 100 */ #endif #define CYCLEFRAC 0xc00 cycle = (u_int64_t) 8000 * DVSEC * it->dvsync; diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index d0f6371ccd25..672a452b1f28 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -52,6 +52,7 @@ #include #include #include +#include #define CDEV_MAJOR 127 #define FWNODE_INVAL 0xffff @@ -568,14 +569,18 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) err = ENOMEM; break; } -#define FWDVPACKET 250 /* NTSC (300 for PAL) */ +#if DV_PAL +#define FWDVPACKET 300 +#else +#define FWDVPACKET 250 +#endif #define FWDVPMAX 512 ibufreq->rx.nchunk = 8; ibufreq->rx.npacket = 50; ibufreq->rx.psize = FWDVPMAX; ibufreq->tx.nchunk = 5; - ibufreq->tx.npacket = 300; + ibufreq->tx.npacket = FWDVPACKET + 30; /* > 320 or 267 */ ibufreq->tx.psize = FWDVPMAX; err = fw_ioctl(dev, FW_SSTBUF, (caddr_t)ibufreq, flag, td); diff --git a/sys/dev/firewire/iec68113.h b/sys/dev/firewire/iec68113.h index ac202fab092e..2ee5d77b76cd 100644 --- a/sys/dev/firewire/iec68113.h +++ b/sys/dev/firewire/iec68113.h @@ -79,3 +79,5 @@ struct dvdbc{ u_int8_t payload[77]; #define DV_DSF_12 0x80 /* PAL: payload[0] in Header DIF */ }; + +#define DV_PAL 0 -- cgit v1.3 From e2ad5d6e8c940a925c6f6be9fc82dbb5fdc02314 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Thu, 16 Jan 2003 13:09:33 +0000 Subject: Improve memory allocation. - Don't use contigmalloc() and allocate page by page to avoid allocation failure. - allocate buffer by PAGE_SIZE. --- sys/dev/firewire/firewire.c | 8 +++---- sys/dev/firewire/fwdev.c | 4 ++-- sys/dev/firewire/fwohci.c | 57 ++++++++++++++++++++++++++------------------ sys/dev/firewire/fwohcivar.h | 3 +++ 4 files changed, 43 insertions(+), 29 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 89f45980cec4..e0dbad1fff36 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -698,10 +698,10 @@ void fw_init(struct firewire_comm *fc) fc->atq->queued = 0; fc->ats->queued = 0; - fc->arq->psize = FWPMAX_S400; - fc->ars->psize = FWPMAX_S400; - fc->atq->psize = FWPMAX_S400; - fc->ats->psize = FWPMAX_S400; + fc->arq->psize = PAGE_SIZE; + fc->ars->psize = PAGE_SIZE; + fc->atq->psize = 0; + fc->ats->psize = 0; fc->arq->buf = NULL; diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 672a452b1f28..93f4dbd09afa 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -162,7 +162,7 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) free(sc->fc->ir[sub]->bulkxfer, M_DEVBUF); sc->fc->ir[sub]->bulkxfer = NULL; sc->fc->ir[sub]->flag &= ~FWXFERQ_EXTBUF; - sc->fc->ir[sub]->psize = FWPMAX_S400; + sc->fc->ir[sub]->psize = PAGE_SIZE; sc->fc->ir[sub]->maxq = FWMAXQUEUE; } if(sc->fc->it[sub]->flag & FWXFERQ_EXTBUF){ @@ -172,7 +172,7 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) sc->fc->it[sub]->bulkxfer = NULL; sc->fc->it[sub]->dvbuf = NULL; sc->fc->it[sub]->flag &= ~FWXFERQ_EXTBUF; - sc->fc->it[sub]->psize = FWPMAX_S400; + sc->fc->it[sub]->psize = 0; sc->fc->it[sub]->maxq = FWMAXQUEUE; } for(xfer = STAILQ_FIRST(&sc->fc->ir[sub]->q); diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index cb5959e340c6..d8fab52c2699 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -634,8 +634,7 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) sc->fc.tcode = tinfo; - sc->cromptr = (u_int32_t *) - contigmalloc(CROMSIZE * 2, M_DEVBUF, M_NOWAIT, 0, ~0, 1<<10, 0); + sc->cromptr = (u_int32_t *) malloc(CROMSIZE * 2, M_DEVBUF, M_NOWAIT); if(sc->cromptr == NULL){ device_printf(dev, "cromptr alloc failed."); @@ -656,8 +655,7 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) /* SID recieve buffer must allign 2^11 */ #define OHCI_SIDSIZE (1 << 11) - sc->fc.sid_buf = (u_int32_t *) vm_page_alloc_contig( OHCI_SIDSIZE, - 0x10000, 0xffffffff, OHCI_SIDSIZE); + sc->fc.sid_buf = (u_int32_t *) malloc(OHCI_SIDSIZE, M_DEVBUF, M_NOWAIT); if (sc->fc.sid_buf == NULL) { device_printf(dev, "sid_buf alloc failed.\n"); return ENOMEM; @@ -737,10 +735,9 @@ fwohci_detach(struct fwohci_softc *sc, device_t dev) int i; if (sc->fc.sid_buf != NULL) - contigfree((void *)(uintptr_t)sc->fc.sid_buf, - OHCI_SIDSIZE, M_DEVBUF); + free((void *)(uintptr_t)sc->fc.sid_buf, M_DEVBUF); if (sc->cromptr != NULL) - contigfree((void *)sc->cromptr, CROMSIZE * 2, M_DEVBUF); + free((void *)sc->cromptr, M_DEVBUF); fwohci_db_free(&sc->arrq); fwohci_db_free(&sc->arrs); @@ -1105,7 +1102,7 @@ static void fwohci_db_free(struct fwohci_dbch *dbch) { struct fwohcidb_tr *db_tr; - int idb; + int idb, i; if ((dbch->flags & FWOHCI_DBCH_INIT) == 0) return; @@ -1122,8 +1119,8 @@ fwohci_db_free(struct fwohci_dbch *dbch) } dbch->ndb = 0; db_tr = STAILQ_FIRST(&dbch->db_trq); - contigfree((void *)(uintptr_t)(volatile void *)db_tr->db, - sizeof(struct fwohcidb) * dbch->ndesc * dbch->ndb, M_DEVBUF); + for (i = 0; i < dbch->npages; i++) + free(dbch->pages[i], M_DEVBUF); free(db_tr, M_DEVBUF); STAILQ_INIT(&dbch->db_trq); dbch->flags &= ~FWOHCI_DBCH_INIT; @@ -1133,9 +1130,8 @@ static void fwohci_db_init(struct fwohci_dbch *dbch) { int idb; - struct fwohcidb *db; struct fwohcidb_tr *db_tr; - + int ndbpp, i, j; if ((dbch->flags & FWOHCI_DBCH_INIT) != 0) goto out; @@ -1147,22 +1143,37 @@ fwohci_db_init(struct fwohci_dbch *dbch) malloc(sizeof(struct fwohcidb_tr) * dbch->ndb, M_DEVBUF, M_DONTWAIT | M_ZERO); if(db_tr == NULL){ - printf("fwohci_db_init: malloc failed\n"); + printf("fwohci_db_init: malloc(1) failed\n"); return; } - db = (struct fwohcidb *) - contigmalloc(sizeof (struct fwohcidb) * dbch->ndesc * dbch->ndb, - M_DEVBUF, M_DONTWAIT, 0x10000, 0xffffffff, PAGE_SIZE, 0ul); - if(db == NULL){ - printf("fwohci_db_init: contigmalloc failed\n"); - free(db_tr, M_DEVBUF); + + ndbpp = PAGE_SIZE / (sizeof(struct fwohcidb) * dbch->ndesc); + dbch->npages = (dbch->ndb + ndbpp - 1)/ ndbpp; +#if 0 + printf("ndesc: %d, ndbpp: %d, ndb: %d, npages: %d\n", + dbch->ndesc, ndbpp, dbch->ndb, dbch->npages); +#endif + if (dbch->npages > FWOHCI_DBCH_MAX_PAGES) { + printf("npages(%d) > DBCH_MAX_PAGES(%d)\n", + dbch->npages, FWOHCI_DBCH_MAX_PAGES); return; } - bzero(db, sizeof (struct fwohcidb) * dbch->ndesc * dbch->ndb); + for (i = 0; i < dbch->npages; i++) { + dbch->pages[i] = malloc(PAGE_SIZE, M_DEVBUF, + M_DONTWAIT | M_ZERO); + if (dbch->pages[i] == NULL) { + printf("fwohci_db_init: malloc(2) failed\n"); + for (j = 0; j < i; j ++) + free(dbch->pages[j], M_DEVBUF); + free(db_tr, M_DEVBUF); + return; + } + } /* Attach DB to DMA ch. */ for(idb = 0 ; idb < dbch->ndb ; idb++){ db_tr->dbcnt = 0; - db_tr->db = &db[idb * dbch->ndesc]; + db_tr->db = (struct fwohcidb *)dbch->pages[idb/ndbpp] + + dbch->ndesc * (idb % ndbpp); STAILQ_INSERT_TAIL(&dbch->db_trq, db_tr, link); if (!(dbch->xferq.flag & FWXFERQ_PACKET) && dbch->xferq.bnpacket != 0) { @@ -1245,7 +1256,7 @@ fwohci_irxpp_enable(struct firewire_comm *fc, int dmach) if(!(sc->ir[dmach].xferq.flag & FWXFERQ_RUNNING)){ sc->ir[dmach].xferq.queued = 0; sc->ir[dmach].ndb = NDB; - sc->ir[dmach].xferq.psize = FWPMAX_S400; + sc->ir[dmach].xferq.psize = PAGE_SIZE; sc->ir[dmach].ndesc = 1; fwohci_db_init(&sc->ir[dmach]); if ((sc->ir[dmach].flags & FWOHCI_DBCH_INIT) == 0) @@ -1809,7 +1820,7 @@ fwohci_intr_body(struct fwohci_softc *sc, u_int32_t stat, int count) plen = OREAD(sc, OHCI_SID_CNT) & OHCI_SID_CNT_MASK; plen -= 4; /* chop control info */ - buf = malloc( FWPMAX_S400, M_DEVBUF, M_NOWAIT); + buf = malloc(OHCI_SIDSIZE, M_DEVBUF, M_NOWAIT); if(buf == NULL) goto sidout; bcopy((void *)(uintptr_t)(volatile void *)(fc->sid_buf + 1), buf, plen); diff --git a/sys/dev/firewire/fwohcivar.h b/sys/dev/firewire/fwohcivar.h index 5e657cfe10c0..e3b50eac4e03 100644 --- a/sys/dev/firewire/fwohcivar.h +++ b/sys/dev/firewire/fwohcivar.h @@ -61,6 +61,9 @@ typedef struct fwohci_softc { #define FWOHCI_DBCH_INIT (1<<0) #define FWOHCI_DBCH_FULL (1<<1) int buf_offset; +#define FWOHCI_DBCH_MAX_PAGES 32 + int npages; + void *pages[FWOHCI_DBCH_MAX_PAGES]; } arrq, arrs, atrq, atrs, it[OHCI_DMA_ITCH], ir[OHCI_DMA_IRCH]; u_int maxrec; u_int32_t *cromptr; -- cgit v1.3 From 7643dc189d078e0512c5a3e24ec35522f7936a63 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Fri, 17 Jan 2003 03:52:48 +0000 Subject: Detect underrun of IT queue for debugging. Add some comments. --- sys/dev/firewire/fwdev.c | 4 +++ sys/dev/firewire/fwohci.c | 90 +++++++++++++++++++++++++++-------------------- 2 files changed, 56 insertions(+), 38 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 93f4dbd09afa..7e896f6b95de 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -636,6 +636,8 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) } ir->buf = malloc( ibufreq->rx.nchunk * ibufreq->rx.npacket + /* XXX psize must be 2^n and less or + equal to PAGE_SIZE */ * ((ibufreq->rx.psize + 3) &~3), M_DEVBUF, M_DONTWAIT); if(ir->buf == NULL){ @@ -648,6 +650,8 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) } it->buf = malloc( ibufreq->tx.nchunk * ibufreq->tx.npacket + /* XXX psize must be 2^n and less or + equal to PAGE_SIZE */ * ((ibufreq->tx.psize + 3) &~3), M_DEVBUF, M_DONTWAIT); if(it->buf == NULL){ diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index d8fab52c2699..7ce982aaabbf 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -1149,10 +1149,9 @@ fwohci_db_init(struct fwohci_dbch *dbch) ndbpp = PAGE_SIZE / (sizeof(struct fwohcidb) * dbch->ndesc); dbch->npages = (dbch->ndb + ndbpp - 1)/ ndbpp; -#if 0 - printf("ndesc: %d, ndbpp: %d, ndb: %d, npages: %d\n", - dbch->ndesc, ndbpp, dbch->ndb, dbch->npages); -#endif + if (firewire_debug) + printf("ndesc: %d, ndbpp: %d, ndb: %d, npages: %d\n", + dbch->ndesc, ndbpp, dbch->ndb, dbch->npages); if (dbch->npages > FWOHCI_DBCH_MAX_PAGES) { printf("npages(%d) > DBCH_MAX_PAGES(%d)\n", dbch->npages, FWOHCI_DBCH_MAX_PAGES); @@ -1457,41 +1456,42 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach) vtophys(((struct fwohcidb_tr *)(dbch->xferq.stdma2->start))->db) | dbch->ndesc; ((struct fwohcidb_tr *)(dbch->xferq.stdma2->end))->db[dbch->ndesc - 1].db.desc.depend &= ~0xf; ((struct fwohcidb_tr *)(dbch->xferq.stdma2->end))->db[0].db.desc.depend &= ~0xf; + } else { + if (firewire_debug) + device_printf(fc->dev, + "fwohci_itxbuf_enable: queue underrun\n"); } - } else if(!(stat & OHCI_CNTL_DMA_RUN)) { - if (firewire_debug) - printf("fwohci_itxbuf_enable: kick 0x%08x\n", - OREAD(sc, OHCI_ITCTL(dmach))); - fw_tbuf_update(&sc->fc, dmach, 0); - if(dbch->xferq.stdma == NULL){ - return err; - } -#if 0 - OWRITE(sc, OHCI_ITCTLCLR(dmach), OHCI_CNTL_DMA_RUN); -#endif - OWRITE(sc, OHCI_IT_MASKCLR, 1 << dmach); - OWRITE(sc, OHCI_IT_STATCLR, 1 << dmach); - OWRITE(sc, OHCI_IT_MASK, 1 << dmach); - fwohci_txbufdb(sc, dmach, dbch->xferq.stdma); - if(dbch->xferq.stdma2 != NULL){ - fwohci_txbufdb(sc, dmach, dbch->xferq.stdma2); - ((struct fwohcidb_tr *) + return err; + } + if (firewire_debug) + printf("fwohci_itxbuf_enable: kick 0x%08x\n", stat); + fw_tbuf_update(&sc->fc, dmach, 0); + if(dbch->xferq.stdma == NULL){ + return err; + } + if(dbch->xferq.stdma2 == NULL){ + /* wait until 2 chunks buffered */ + return err; + } + OWRITE(sc, OHCI_IT_MASKCLR, 1 << dmach); + OWRITE(sc, OHCI_IT_STATCLR, 1 << dmach); + OWRITE(sc, OHCI_IT_MASK, 1 << dmach); + fwohci_txbufdb(sc, dmach, dbch->xferq.stdma); + fwohci_txbufdb(sc, dmach, dbch->xferq.stdma2); + ((struct fwohcidb_tr *) (dbch->xferq.stdma->end))->db[dbch->ndesc - 1].db.desc.cmd |= OHCI_BRANCH_ALWAYS; - ((struct fwohcidb_tr *)(dbch->xferq.stdma->end))->db[dbch->ndesc - 1].db.desc.depend = + ((struct fwohcidb_tr *)(dbch->xferq.stdma->end))->db[dbch->ndesc - 1].db.desc.depend = vtophys(((struct fwohcidb_tr *)(dbch->xferq.stdma2->start))->db) | dbch->ndesc; - ((struct fwohcidb_tr *)(dbch->xferq.stdma->end))->db[0].db.desc.depend = + ((struct fwohcidb_tr *)(dbch->xferq.stdma->end))->db[0].db.desc.depend = vtophys(((struct fwohcidb_tr *)(dbch->xferq.stdma2->start))->db) | dbch->ndesc; - ((struct fwohcidb_tr *)(dbch->xferq.stdma2->end))->db[dbch->ndesc - 1].db.desc.depend &= ~0xf; - ((struct fwohcidb_tr *) (dbch->xferq.stdma2->end))->db[0].db.desc.depend &= ~0xf; - }else{ - ((struct fwohcidb_tr *) (dbch->xferq.stdma->end))->db[dbch->ndesc - 1].db.desc.depend &= ~0xf; - ((struct fwohcidb_tr *) (dbch->xferq.stdma->end))->db[0].db.desc.depend &= ~0xf; - } - OWRITE(sc, OHCI_ITCMD(dmach), - vtophys(((struct fwohcidb_tr *) - (dbch->xferq.stdma->start))->db) | dbch->ndesc); + ((struct fwohcidb_tr *)(dbch->xferq.stdma2->end))->db[dbch->ndesc - 1].db.desc.depend &= ~0xf; + ((struct fwohcidb_tr *) (dbch->xferq.stdma2->end))->db[0].db.desc.depend &= ~0xf; + OWRITE(sc, OHCI_ITCMD(dmach), + vtophys(((struct fwohcidb_tr *) + (dbch->xferq.stdma->start))->db) | dbch->ndesc); #define CYCLE_OFFSET 1 + if ((stat & OHCI_CNTL_DMA_RUN) == 0) { if(dbch->xferq.flag & FWXFERQ_DV){ db_tr = (struct fwohcidb_tr *)dbch->xferq.stdma->start; fp = (struct fw_pkt *)db_tr->buf; @@ -1518,17 +1518,20 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach) cycle = CYCLE_MOD; } cycle_match = ((sec << 13) | cycle) & 0x7ffff; - if (firewire_debug) - printf("cycle_match: 0x%04x->0x%04x\n", - cycle_now, cycle_match); /* Clear cycle match counter bits */ OWRITE(sc, OHCI_ITCTLCLR(dmach), 0xffff0000); OWRITE(sc, OHCI_ITCTL(dmach), OHCI_CNTL_CYCMATCH_S | (cycle_match << 16) | OHCI_CNTL_DMA_RUN); OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_DMA_IT); - } else { - OWRITE(sc, OHCI_ITCTL(dmach), OHCI_CNTL_DMA_WAKE); + if (firewire_debug) + printf("cycle_match: 0x%04x->0x%04x\n", + cycle_now, cycle_match); + } else if ((stat & OHCI_CNTL_CYCMATCH_S) == 0) { + if (firewire_debug) + printf("fwohci_itxbuf_enable: restart 0x%08x\n", stat); + OWRITE(sc, OHCI_ITCTLCLR(dmach), OHCI_CNTL_DMA_RUN); + OWRITE(sc, OHCI_ITCTL(dmach), OHCI_CNTL_DMA_RUN); } return err; } @@ -1957,6 +1960,17 @@ fwohci_tbuf_update(struct fwohci_softc *sc, int dmach) fp->mode.ld[2] |= htonl((fc->cyctimer(fc) + 0x4000) & 0xf000); } #endif + /* + * XXX interrupt could be missed. + * We have to check more than one buffer/chunk + */ + if (firewire_debug && dbch->xferq.stdma2 != NULL) { + db_tr = (struct fwohcidb_tr *)dbch->xferq.stdma2->end; + stat = db_tr->db[2].db.desc.status; + if (stat) + printf("XXX stdma2 already done stat:0x%x\n", stat); + } + stat = OREAD(sc, OHCI_ITCTL(dmach)) & 0x1f; switch(stat){ case FWOHCIEV_ACKCOMPL: -- cgit v1.3 From ae8c82bbe985cdf8cc7d42130b30bfad195e3496 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Fri, 17 Jan 2003 15:15:21 +0000 Subject: Replace M_DONTWAIT with M_NOWAIT for malloc(). Pointed out by: nate@root.org --- sys/dev/firewire/firewire.c | 24 ++++++++++++------------ sys/dev/firewire/fwdev.c | 14 +++++++------- sys/dev/firewire/fwohci.c | 6 +++--- sys/dev/firewire/sbp.c | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 2e925f6758be..bf40104cc035 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -749,10 +749,10 @@ void fw_init(struct firewire_comm *fc) /* Initialize csr registers */ fc->topology_map = (struct fw_topology_map *)malloc( sizeof(struct fw_topology_map), - M_DEVBUF, M_DONTWAIT | M_ZERO); + M_DEVBUF, M_NOWAIT | M_ZERO); fc->speed_map = (struct fw_speed_map *)malloc( sizeof(struct fw_speed_map), - M_DEVBUF, M_DONTWAIT | M_ZERO); + M_DEVBUF, M_NOWAIT | M_ZERO); CSRARC(fc, TOPO_MAP) = 0x3f1 << 16; CSRARC(fc, TOPO_MAP + 4) = 1; CSRARC(fc, SPED_MAP) = 0x3f1 << 16; @@ -765,7 +765,7 @@ void fw_init(struct firewire_comm *fc) SLIST_INIT(&fc->ongocsr); SLIST_INIT(&fc->csrfree); for( i = 0 ; i < FWMAXCSRDIR ; i++){ - csrd = (struct csrdir *) malloc(sizeof(struct csrdir), M_DEVBUF,M_DONTWAIT); + csrd = (struct csrdir *) malloc(sizeof(struct csrdir), M_DEVBUF,M_NOWAIT); if(csrd == NULL) break; SLIST_INSERT_HEAD(&fc->csrfree, csrd, link); } @@ -796,7 +796,7 @@ void fw_init(struct firewire_comm *fc) xfer = fw_xfer_alloc(); if(xfer == NULL) return; - fwb = (struct fw_bind *)malloc(sizeof (struct fw_bind), M_DEVBUF, M_DONTWAIT); + fwb = (struct fw_bind *)malloc(sizeof (struct fw_bind), M_DEVBUF, M_NOWAIT); if(fwb == NULL){ fw_xfer_free(xfer); } @@ -950,7 +950,7 @@ fw_xfer_alloc() { struct fw_xfer *xfer; - xfer = malloc(sizeof(struct fw_xfer), M_DEVBUF, M_DONTWAIT | M_ZERO); + xfer = malloc(sizeof(struct fw_xfer), M_DEVBUF, M_NOWAIT | M_ZERO); if (xfer == NULL) return xfer; @@ -1058,7 +1058,7 @@ fw_phy_config(struct firewire_comm *fc, int root_node, int gap_count) xfer->act.hand = fw_phy_config_callback; xfer->send.buf = malloc(sizeof(u_int32_t), - M_DEVBUF, M_DONTWAIT | M_ZERO); + M_DEVBUF, M_NOWAIT | M_ZERO); fp = (struct fw_pkt *)xfer->send.buf; fp->mode.ld[1] = 0; if (root_node >= 0) @@ -1316,7 +1316,7 @@ loop: fc->ongoeui.hi = 0xffffffff; fc->ongoeui.lo = 0xffffffff; goto loop; } - fwdev = malloc(sizeof(struct fw_device), M_DEVBUF, M_DONTWAIT); + fwdev = malloc(sizeof(struct fw_device), M_DEVBUF, M_NOWAIT); if(fwdev == NULL) return; fwdev->fc = fc; @@ -1366,7 +1366,7 @@ loop: } xfer->send.len = 16; xfer->spd = 0; - xfer->send.buf = malloc(16, M_DEVBUF, M_DONTWAIT); + xfer->send.buf = malloc(16, M_DEVBUF, M_NOWAIT); if(xfer->send.buf == NULL){ fw_xfer_free( xfer); return; @@ -1417,7 +1417,7 @@ asyreqq(struct firewire_comm *fc, u_int8_t spd, u_int8_t tl, u_int8_t rt, } xfer->send.len = 16; xfer->spd = spd; /* XXX:min(spd, fc->spd) */ - xfer->send.buf = malloc(16, M_DEVBUF, M_DONTWAIT); + xfer->send.buf = malloc(16, M_DEVBUF, M_NOWAIT); if(xfer->send.buf == NULL){ fw_xfer_free( xfer); return NULL; @@ -1747,7 +1747,7 @@ fw_get_tlabel(struct firewire_comm *fc, struct fw_xfer *xfer) if(tmptl->xfer->dst == xfer->dst) break; } if(tmptl == NULL) { - tl = malloc(sizeof(struct tlabel),M_DEVBUF,M_DONTWAIT); + tl = malloc(sizeof(struct tlabel),M_DEVBUF,M_NOWAIT); if (tl == NULL) { splx(s); return (-1); @@ -1862,7 +1862,7 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u return; } xfer->spd = spd; - xfer->send.buf = malloc(16, M_DEVBUF, M_DONTWAIT); + xfer->send.buf = malloc(16, M_DEVBUF, M_NOWAIT); resfp = (struct fw_pkt *)xfer->send.buf; switch(fp->mode.common.tcode){ case FWTCODE_WREQQ: @@ -2053,7 +2053,7 @@ fw_try_bmr(void *arg) } xfer->send.len = 24; xfer->spd = 0; - xfer->send.buf = malloc(24, M_DEVBUF, M_DONTWAIT); + xfer->send.buf = malloc(24, M_DEVBUF, M_NOWAIT); if(xfer->send.buf == NULL){ fw_xfer_free( xfer); return; diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 7e896f6b95de..6c61bd912a66 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -593,13 +593,13 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) sc->fc->it[sub]->flag |= FWXFERQ_DV; /* XXX check malloc failure */ sc->fc->it[sub]->dvbuf - = (struct fw_dvbuf *)malloc(sizeof(struct fw_dvbuf) * NDVCHUNK, M_DEVBUF, M_DONTWAIT); + = (struct fw_dvbuf *)malloc(sizeof(struct fw_dvbuf) * NDVCHUNK, M_DEVBUF, M_NOWAIT); STAILQ_INIT(&sc->fc->it[sub]->dvvalid); STAILQ_INIT(&sc->fc->it[sub]->dvfree); for( i = 0 ; i < NDVCHUNK ; i++){ /* XXX check malloc failure */ sc->fc->it[sub]->dvbuf[i].buf - = malloc(FWDVPMAX * sc->fc->it[sub]->dvpacket, M_DEVBUF, M_DONTWAIT); + = malloc(FWDVPMAX * sc->fc->it[sub]->dvpacket, M_DEVBUF, M_NOWAIT); STAILQ_INSERT_TAIL(&sc->fc->it[sub]->dvfree, &sc->fc->it[sub]->dvbuf[i], link); } @@ -625,12 +625,12 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) return(EINVAL); } ir->bulkxfer - = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->rx.nchunk, M_DEVBUF, M_DONTWAIT); + = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->rx.nchunk, M_DEVBUF, M_NOWAIT); if(ir->bulkxfer == NULL){ return(ENOMEM); } it->bulkxfer - = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->tx.nchunk, M_DEVBUF, M_DONTWAIT); + = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->tx.nchunk, M_DEVBUF, M_NOWAIT); if(it->bulkxfer == NULL){ return(ENOMEM); } @@ -639,7 +639,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) /* XXX psize must be 2^n and less or equal to PAGE_SIZE */ * ((ibufreq->rx.psize + 3) &~3), - M_DEVBUF, M_DONTWAIT); + M_DEVBUF, M_NOWAIT); if(ir->buf == NULL){ free(ir->bulkxfer, M_DEVBUF); free(it->bulkxfer, M_DEVBUF); @@ -653,7 +653,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) /* XXX psize must be 2^n and less or equal to PAGE_SIZE */ * ((ibufreq->tx.psize + 3) &~3), - M_DEVBUF, M_DONTWAIT); + M_DEVBUF, M_NOWAIT); if(it->buf == NULL){ free(ir->bulkxfer, M_DEVBUF); free(it->bulkxfer, M_DEVBUF); @@ -808,7 +808,7 @@ error: err = EINVAL; break; } - fwb = (struct fw_bind *)malloc(sizeof (struct fw_bind), M_DEVBUF, M_DONTWAIT); + fwb = (struct fw_bind *)malloc(sizeof (struct fw_bind), M_DEVBUF, M_NOWAIT); if(fwb == NULL){ err = ENOMEM; break; diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 8a9127255647..b07cf0804931 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -1141,7 +1141,7 @@ fwohci_db_init(struct fwohci_dbch *dbch) STAILQ_INIT(&dbch->db_trq); db_tr = (struct fwohcidb_tr *) malloc(sizeof(struct fwohcidb_tr) * dbch->ndb, - M_DEVBUF, M_DONTWAIT | M_ZERO); + M_DEVBUF, M_NOWAIT | M_ZERO); if(db_tr == NULL){ printf("fwohci_db_init: malloc(1) failed\n"); return; @@ -1159,7 +1159,7 @@ fwohci_db_init(struct fwohci_dbch *dbch) } for (i = 0; i < dbch->npages; i++) { dbch->pages[i] = malloc(PAGE_SIZE, M_DEVBUF, - M_DONTWAIT | M_ZERO); + M_NOWAIT | M_ZERO); if (dbch->pages[i] == NULL) { printf("fwohci_db_init: malloc(2) failed\n"); for (j = 0; j < i; j ++) @@ -1552,7 +1552,7 @@ fwohci_irxbuf_enable(struct firewire_comm *fc, int dmach) sc->ir[dmach].xferq.bnchunk; sc->ir[dmach].dummy = malloc(sizeof(u_int32_t) * sc->ir[dmach].ndb, - M_DEVBUF, M_DONTWAIT); + M_DEVBUF, M_NOWAIT); if(sc->ir[dmach].dummy == NULL){ err = ENOMEM; return err; diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index 41aeaab36b3a..a8ed4945aa89 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -1597,7 +1597,7 @@ END_DEBUG sbp->ocb = (struct sbp_ocb *) contigmalloc( sizeof (struct sbp_ocb) * SBP_NUM_OCB, - M_SBP, M_DONTWAIT, 0x10000, 0xffffffff, PAGE_SIZE, 0ul); + M_SBP, M_NOWAIT, 0x10000, 0xffffffff, PAGE_SIZE, 0ul); bzero(sbp->ocb, sizeof (struct sbp_ocb) * SBP_NUM_OCB); if (sbp->ocb == NULL) { -- cgit v1.3 From 9190691bd0de68630d5c546d647463450c40c06c Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Fri, 24 Jan 2003 13:03:19 +0000 Subject: Remove FW_SSTDV ioctl. It is not used anymore. --- sys/dev/firewire/firewire.c | 14 ++++++++++---- sys/dev/firewire/firewire.h | 2 ++ sys/dev/firewire/firewirereg.h | 2 ++ sys/dev/firewire/fwdev.c | 16 ++++++++++++++-- sys/dev/firewire/fwohci.c | 11 +++++++---- 5 files changed, 35 insertions(+), 10 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index eb31387c9970..7252cea30f99 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -127,11 +127,8 @@ static driver_t firewire_driver = { int fw_tbuf_update(struct firewire_comm *fc, int sub, int flag){ struct fw_bulkxfer *bulkxfer, *bulkxfer2 = NULL; - struct fw_dvbuf *dvbuf = NULL; struct fw_xferq *it; - int s, err = 0, i, j, chtag; - struct fw_pkt *fp; - u_int64_t cycle, dvsync; + int s, err = 0; it = fc->it[sub]; @@ -144,7 +141,9 @@ fw_tbuf_update(struct firewire_comm *fc, int sub, int flag){ STAILQ_REMOVE_HEAD(&it->stvalid, link); it->stdma->flag = 0; STAILQ_INSERT_TAIL(&it->stfree, it->stdma, link); +#ifdef FWXFERQ_DV if(!(it->flag & FWXFERQ_DV)) +#endif wakeup(it); } bulkxfer = STAILQ_FIRST(&it->stvalid); @@ -166,7 +165,13 @@ fw_tbuf_update(struct firewire_comm *fc, int sub, int flag){ it->stdma = bulkxfer; it->stdma2 = bulkxfer2; +#ifdef FWXFERQ_DV if(it->flag & FWXFERQ_DV){ + struct fw_dvbuf *dvbuf = NULL; + int i, j, chtag; + struct fw_pkt *fp; + u_int64_t cycle, dvsync; + chtag = it->flag & 0xff; dvloop: if(it->dvdma == NULL){ @@ -245,6 +250,7 @@ dvloop: } } out: +#endif splx(s); return err; } diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index f31496b1fff7..6ac583c73f06 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -445,7 +445,9 @@ struct fw_crom_buf { /* * FireWire specific system requests. */ +#if 0 #define FW_SSTDV _IOWR('S', 85, unsigned int) +#endif #define FW_SSTBUF _IOWR('S', 86, struct fw_isobufreq) #define FW_GSTBUF _IOWR('S', 87, struct fw_isobufreq) #define FW_SRSTREAM _IOWR('S', 88, struct fw_isochreq) diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 3b2b9290c723..05f6d3e27e1f 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -186,7 +186,9 @@ struct fw_xferq { #define FWXFERQ_PACKET (1 << 10) #define FWXFERQ_BULK (1 << 11) +#if 0 #define FWXFERQ_DV (1 << 12) +#endif #define FWXFERQ_MODEMASK (7 << 10) #define FWXFERQ_EXTBUF (1 << 13) diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 6c61bd912a66..d096ba13d9ef 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -110,7 +110,6 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) int unit = DEV2UNIT(dev); int sub = DEV2DMACH(dev); struct fw_xfer *xfer; - struct fw_dvbuf *dvbuf; struct fw_bind *fwb; int err = 0; @@ -136,7 +135,10 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) sc->fc->it[sub]->flag &= ~FWXFERQ_RUNNING; sc->fc->itx_disable(sc->fc, sub); } +#ifdef FWXFERQ_DV if(sc->fc->it[sub]->flag & FWXFERQ_DV){ + struct fw_dvbuf *dvbuf; + if((dvbuf = sc->fc->it[sub]->dvproc) != NULL){ free(dvbuf->buf, M_DEVBUF); sc->fc->it[sub]->dvproc = NULL; @@ -156,6 +158,7 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) free(sc->fc->it[sub]->dvbuf, M_DEVBUF); sc->fc->it[sub]->dvbuf = NULL; } +#endif if(sc->fc->ir[sub]->flag & FWXFERQ_EXTBUF){ free(sc->fc->ir[sub]->buf, M_DEVBUF); sc->fc->ir[sub]->buf = NULL; @@ -359,7 +362,11 @@ fw_write (dev_t dev, struct uio *uio, int ioflag) splx(s); it->stproc = NULL; } +#ifdef FWXFERQ_DV if(xferq == NULL && !(it->flag & FWXFERQ_DV)){ +#else + if (xferq == NULL) { +#endif isoloop: if(it->stproc == NULL){ it->stproc = STAILQ_FIRST(&it->stfree); @@ -400,7 +407,9 @@ isoloop: err = sc->fc->itx_enable(sc->fc, sub); } return err; - } if(xferq == NULL && it->flag & FWXFERQ_DV){ + } +#ifdef FWXFERQ_DV + if(xferq == NULL && it->flag & FWXFERQ_DV){ dvloop: if(it->dvproc == NULL){ it->dvproc = STAILQ_FIRST(&it->dvfree); @@ -448,6 +457,7 @@ dvloop: } return err; } +#endif if(xferq != NULL){ xfer = fw_xfer_alloc(); if(xfer == NULL){ @@ -562,6 +572,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) ichreq->tag =(sc->fc->ir[sub]->flag) >> 2 & 0x3; err = 0; break; +#ifdef FWXFERQ_DV case FW_SSTDV: ibufreq = (struct fw_isobufreq *) malloc(sizeof(struct fw_isobufreq), M_DEVBUF, M_NOWAIT); @@ -604,6 +615,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) &sc->fc->it[sub]->dvbuf[i], link); } break; +#endif case FW_SSTBUF: ir = sc->fc->ir[sub]; it = sc->fc->it[sub]; diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 4a292611ea07..94f763d7471c 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -1427,8 +1427,6 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach) int err = 0; unsigned short tag, ich; struct fwohci_dbch *dbch; - struct fw_pkt *fp; - struct fwohcidb_tr *db_tr; int cycle_now, sec, cycle, cycle_match; u_int32_t stat; @@ -1495,12 +1493,17 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach) (dbch->xferq.stdma->start))->db) | dbch->ndesc); #define CYCLE_OFFSET 1 if ((stat & OHCI_CNTL_DMA_RUN) == 0) { +#ifdef FWXFERQ_DV if(dbch->xferq.flag & FWXFERQ_DV){ + struct fw_pkt *fp; + struct fwohcidb_tr *db_tr; + db_tr = (struct fwohcidb_tr *)dbch->xferq.stdma->start; fp = (struct fw_pkt *)db_tr->buf; dbch->xferq.dvoffset = CYCLE_OFFSET; fp->mode.ld[2] |= htonl(dbch->xferq.dvoffset << 12); } +#endif /* 2bit second + 13bit cycle */ cycle_now = (fc->cyctimer(fc) >> 12) & 0x7fff; cycle = cycle_now & 0x1fff; @@ -1963,7 +1966,6 @@ fwohci_tbuf_update(struct fwohci_softc *sc, int dmach) { int stat; struct firewire_comm *fc = &sc->fc; - struct fw_pkt *fp; struct fwohci_dbch *dbch; struct fwohcidb_tr *db_tr; @@ -1994,11 +1996,12 @@ fwohci_tbuf_update(struct fwohci_softc *sc, int dmach) stat = OREAD(sc, OHCI_ITCTL(dmach)) & 0x1f; switch(stat){ case FWOHCIEV_ACKCOMPL: -#if 1 +#ifdef FWXFERQ_DV if (dbch->xferq.flag & FWXFERQ_DV) { struct ciphdr *ciph; int timer, timestamp, cycl, diff; static int last_timer=0; + struct fw_pkt *fp; timer = (fc->cyctimer(fc) >> 12) & 0xffff; db_tr = (struct fwohcidb_tr *)dbch->xferq.stdma->start; -- cgit v1.3 From c547b896f5bb72011400ccb2cb9a321b20b06596 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Sat, 25 Jan 2003 14:47:33 +0000 Subject: Change API of FW_GDEVLST ioctl. - include information about itself. - define struct fw_devinfo and use it in struct fw_devlstreq. - unify EUI64 representation using struct fw_eui64. --- sys/dev/firewire/firewire.h | 24 +++++++++------ sys/dev/firewire/firewirereg.h | 2 +- sys/dev/firewire/fwdev.c | 30 ++++++++++-------- sys/dev/firewire/fwohci.c | 19 +++++------- sys/dev/firewire/if_fwe.c | 15 +++++---- usr.sbin/fwcontrol/fwcontrol.c | 70 +++++++++++++++++++++++++----------------- 6 files changed, 92 insertions(+), 68 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index 6ac583c73f06..e07dfd7e768d 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -310,6 +310,11 @@ struct fw_pkt { struct fw_eui64 { u_int32_t hi, lo; }; +#define FW_EUI64_BYTE(eui, x) \ + ((((x)<4)? \ + ((eui)->hi >> (8*(3-(x)))): \ + ((eui)->lo >> (8*(7-(x)))) \ + ) & 0xff) struct fw_asyreq { struct fw_asyreq_t{ @@ -328,11 +333,17 @@ struct fw_asyreq { u_int32_t data[512]; }; +struct fw_devinfo { + struct fw_eui64 eui; + u_int16_t dst; + u_int16_t status; +}; + +#define FW_MAX_DEVLST 70 struct fw_devlstreq { - int n; - struct fw_eui64 eui[64]; - u_int16_t dst[64]; - u_int16_t status[64]; + u_int16_t n; + u_int16_t info_len; + struct fw_devinfo dev[FW_MAX_DEVLST]; }; #define FW_SELF_ID_PORT_CONNECTED_TO_CHILD 3 @@ -430,11 +441,6 @@ struct fw_speed_map { u_int8_t speed[64][64]; }; -struct fw_map_buf { - int len; - void *ptr; -}; - struct fw_crom_buf { struct fw_eui64 eui; int len; diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 05f6d3e27e1f..a2c994e6f40d 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -135,7 +135,7 @@ struct firewire_comm{ #define FWBUSEXPDONE 7 #define FWBUSCOMPLETION 10 int nisodma; - u_int8_t eui[8]; + struct fw_eui64 eui; STAILQ_HEAD(fw_queue, fw_xfer); struct fw_xferq *arq, *atq, *ars, *ats, *it[FW_MAX_DMACH],*ir[FW_MAX_DMACH]; diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index d096ba13d9ef..7233f353239d 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -531,15 +531,13 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) struct fw_xferq *ir, *it; struct fw_xfer *xfer; struct fw_pkt *fp; + struct fw_devinfo *devinfo; struct fw_devlstreq *fwdevlst = (struct fw_devlstreq *)data; struct fw_asyreq *asyreq = (struct fw_asyreq *)data; struct fw_isochreq *ichreq = (struct fw_isochreq *)data; struct fw_isobufreq *ibufreq = (struct fw_isobufreq *)data; struct fw_asybindreq *bindreq = (struct fw_asybindreq *)data; -#if 0 - struct fw_map_buf *map_buf = (struct fw_map_buf *)data; -#endif struct fw_crom_buf *crom_buf = (struct fw_crom_buf *)data; if (DEV_FWMEM(dev)) @@ -842,19 +840,27 @@ error: err = fw_bindadd(sc->fc, fwb); break; case FW_GDEVLST: - i = 0; - for(fwdev = TAILQ_FIRST(&sc->fc->devices); fwdev != NULL; - fwdev = TAILQ_NEXT(fwdev, link)){ - if(i < fwdevlst->n){ - fwdevlst->dst[i] = fwdev->dst; - fwdevlst->status[i] = - (fwdev->status == FWDEVATTACHED)?1:0; - fwdevlst->eui[i].hi = fwdev->eui.hi; - fwdevlst->eui[i].lo = fwdev->eui.lo; + i = len = 1; + /* myself */ + devinfo = &fwdevlst->dev[0]; + devinfo->dst = sc->fc->nodeid; + devinfo->status = 0; /* XXX */ + devinfo->eui.hi = sc->fc->eui.hi; + devinfo->eui.lo = sc->fc->eui.lo; + for (fwdev = TAILQ_FIRST(&sc->fc->devices); fwdev != NULL; + fwdev = TAILQ_NEXT(fwdev, link)) { + if(len < FW_MAX_DEVLST){ + devinfo = &fwdevlst->dev[len++]; + devinfo->dst = fwdev->dst; + devinfo->status = + (fwdev->status == FWDEVINVAL)?0:1; + devinfo->eui.hi = fwdev->eui.hi; + devinfo->eui.lo = fwdev->eui.lo; } i++; } fwdevlst->n = i; + fwdevlst->info_len = len; break; case FW_GTPMAP: bcopy(sc->fc->topology_map, data, diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 94f763d7471c..ea6e3d2be69e 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -579,6 +579,7 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) { int i; u_int32_t reg; + u_int8_t ui[8]; reg = OREAD(sc, OHCI_VERSION); device_printf(dev, "OHCI version %x.%x (ROM=%d)\n", @@ -682,19 +683,13 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) if ((sc->atrs.flags & FWOHCI_DBCH_INIT) == 0) return ENOMEM; - reg = OREAD(sc, FWOHCIGUID_H); - for( i = 0 ; i < 4 ; i ++){ - sc->fc.eui[3 - i] = reg & 0xff; - reg = reg >> 8; - } - reg = OREAD(sc, FWOHCIGUID_L); - for( i = 0 ; i < 4 ; i ++){ - sc->fc.eui[7 - i] = reg & 0xff; - reg = reg >> 8; - } + sc->fc.eui.hi = OREAD(sc, FWOHCIGUID_H); + sc->fc.eui.lo = OREAD(sc, FWOHCIGUID_L); + for( i = 0 ; i < 8 ; i ++) + ui[i] = FW_EUI64_BYTE(&sc->fc.eui,i); device_printf(dev, "EUI64 %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", - sc->fc.eui[0], sc->fc.eui[1], sc->fc.eui[2], sc->fc.eui[3], - sc->fc.eui[4], sc->fc.eui[5], sc->fc.eui[6], sc->fc.eui[7]); + ui[0], ui[1], ui[2], ui[3], ui[4], ui[5], ui[6], ui[7]); + sc->fc.ioctl = fwohci_ioctl; sc->fc.cyctimer = fwohci_cyctimer; sc->fc.set_bmr = fwohci_set_bus_manager; diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c index 5c777053163d..65658075fbae 100644 --- a/sys/dev/firewire/if_fwe.c +++ b/sys/dev/firewire/if_fwe.c @@ -146,6 +146,7 @@ fwe_attach(device_t dev) struct ifnet *ifp; int unit, s; u_char *eaddr; + struct fw_eui64 *eui; fwe = ((struct fwe_softc *)device_get_softc(dev)); unit = device_get_unit(dev); @@ -168,12 +169,14 @@ fwe_attach(device_t dev) #define LOCAL (0x02) #define GROUP (0x01) eaddr = &fwe->eth_softc.arpcom.ac_enaddr[0]; - eaddr[0] = (fwe->fd.fc->eui[0] | LOCAL) & ~GROUP; - eaddr[1] = fwe->fd.fc->eui[1]; - eaddr[2] = fwe->fd.fc->eui[2]; - eaddr[3] = fwe->fd.fc->eui[5]; - eaddr[4] = fwe->fd.fc->eui[6]; - eaddr[5] = fwe->fd.fc->eui[7]; + + eui = &fwe->fd.fc->eui; + eaddr[0] = (FW_EUI64_BYTE(eui, 0) | LOCAL) & ~GROUP; + eaddr[1] = FW_EUI64_BYTE(eui, 1); + eaddr[2] = FW_EUI64_BYTE(eui, 2); + eaddr[3] = FW_EUI64_BYTE(eui, 5); + eaddr[4] = FW_EUI64_BYTE(eui, 6); + eaddr[5] = FW_EUI64_BYTE(eui, 7); printf("if_fwe%d: Fake Ethernet address: " "%02x:%02x:%02x:%02x:%02x:%02x\n", unit, eaddr[0], eaddr[1], eaddr[2], eaddr[3], eaddr[4], eaddr[5]); diff --git a/usr.sbin/fwcontrol/fwcontrol.c b/usr.sbin/fwcontrol/fwcontrol.c index 08e0a5567a53..9783a57c71b3 100644 --- a/usr.sbin/fwcontrol/fwcontrol.c +++ b/usr.sbin/fwcontrol/fwcontrol.c @@ -72,32 +72,40 @@ usage(void) exit(0); } -static void -get_num_of_dev(int fd, struct fw_devlstreq *data) +static struct fw_devlstreq * +get_dev(int fd) { - data->n = 64; + struct fw_devlstreq *data; + + data = (struct fw_devlstreq *)malloc(sizeof(struct fw_devlstreq)); + if (data == NULL) + err(1, "malloc"); if( ioctl(fd, FW_GDEVLST, data) < 0) { err(1, "ioctl"); } + return data; } static void list_dev(int fd) { - struct fw_devlstreq data; + struct fw_devlstreq *data; + struct fw_devinfo *devinfo; int i; - get_num_of_dev(fd, &data); - printf("%d devices\n", data.n); - for (i = 0; i < data.n; i++) { + data = get_dev(fd); + printf("%d devices (info_len=%d)\n", data->n, data->info_len); + for (i = 0; i < data->info_len; i++) { + devinfo = &data->dev[i]; printf("%d node %d eui:%08x%08x status:%d\n", i, - data.dst[i], - data.eui[i].hi, - data.eui[i].lo, - data.status[i] + devinfo->dst, + devinfo->eui.hi, + devinfo->eui.lo, + devinfo->status ); } + free((void *)data); } static u_int32_t @@ -165,29 +173,32 @@ send_phy_config(int fd, int root_node, int gap_count) static void set_pri_req(int fd, int pri_req) { - struct fw_devlstreq data; + struct fw_devlstreq *data; + struct fw_devinfo *devinfo; u_int32_t max, reg, old; int i; - get_num_of_dev(fd, &data); + data = get_dev(fd); #define BUGET_REG 0xf0000218 - for (i = 0; i < data.n; i++) { - if (!data.status[i]) + for (i = 0; i < data->info_len; i++) { + devinfo = &data->dev[i]; + if (!devinfo->status) continue; - reg = read_write_quad(fd, data.eui[i], BUGET_REG, 1, 0); + reg = read_write_quad(fd, devinfo->eui, BUGET_REG, 1, 0); printf("%d %08x:%08x, %08x", - data.dst[i], data.eui[i].hi, data.eui[i].lo, reg); + devinfo->dst, devinfo->eui.hi, devinfo->eui.lo, reg); if (reg > 0 && pri_req >= 0) { old = (reg & 0x3f); max = (reg & 0x3f00) >> 8; if (pri_req > max) pri_req = max; printf(" 0x%x -> 0x%x\n", old, pri_req); - read_write_quad(fd, data.eui[i], BUGET_REG, 0, pri_req); + read_write_quad(fd, devinfo->eui, BUGET_REG, 0, pri_req); } else { printf("\n"); } } + free((void *)data); } static void @@ -204,26 +215,29 @@ static int get_crom(int fd, int node, void *crom_buf, int len) { struct fw_crom_buf buf; - int i, error; - struct fw_devlstreq data; + int i, n, error; + struct fw_devlstreq *data; - get_num_of_dev(fd, &data); + data = get_dev(fd); - for (i = 0; i < data.n; i++) { - if (data.dst[i] == node && data.eui[i].lo != 0) + for (i = 0; i < data->info_len; i++) { + if (data->dev[i].dst == node && data->dev[i].eui.lo != 0) break; } - if (i != data.n) { - buf.eui = data.eui[i]; - } else { - err(1, "no such node: %d\n", node); - } + if (i == data->info_len) + errx(1, "no such node %d.", node); + else if (i == 0) + errx(1, "node %d is myself.", node); + else + buf.eui = data->dev[i].eui; + free((void *)data); buf.len = len; buf.ptr = crom_buf; if ((error = ioctl(fd, FW_GCROM, &buf)) < 0) { err(1, "ioctl"); } + return error; } -- cgit v1.3 From 5a7ba74dc4e61390bc11a6cf7e078cc8ffdff2f4 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Sun, 26 Jan 2003 15:39:04 +0000 Subject: - Improve IT/IR DMA queue management. - Improve debug message for mbuf handling. - Wait 1 sec for DMA stop in fwohci_i{t,r}x_disable() before freeing buffers. --- sys/dev/firewire/firewire.c | 178 ----------------- sys/dev/firewire/firewirereg.h | 10 +- sys/dev/firewire/fwdev.c | 41 ++-- sys/dev/firewire/fwohci.c | 434 +++++++++++++++++++++-------------------- 4 files changed, 235 insertions(+), 428 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 7252cea30f99..e555266abbdf 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -121,184 +121,6 @@ static driver_t firewire_driver = { sizeof(struct firewire_softc), }; -/* - * transmitter buffer update. - */ -int -fw_tbuf_update(struct firewire_comm *fc, int sub, int flag){ - struct fw_bulkxfer *bulkxfer, *bulkxfer2 = NULL; - struct fw_xferq *it; - int s, err = 0; - - it = fc->it[sub]; - - s = splfw(); - if(it->stdma == NULL){ - bulkxfer = STAILQ_FIRST(&it->stvalid); - }else if(flag != 0){ - bulkxfer = STAILQ_FIRST(&it->stvalid); - if(bulkxfer == it->stdma){ - STAILQ_REMOVE_HEAD(&it->stvalid, link); - it->stdma->flag = 0; - STAILQ_INSERT_TAIL(&it->stfree, it->stdma, link); -#ifdef FWXFERQ_DV - if(!(it->flag & FWXFERQ_DV)) -#endif - wakeup(it); - } - bulkxfer = STAILQ_FIRST(&it->stvalid); - }else{ - bulkxfer = it->stdma; - } - if(bulkxfer != NULL){ - bulkxfer2 = STAILQ_NEXT(bulkxfer, link); -#if 0 - if(it->flag & FWXFERQ_DV && bulkxfer2 == NULL){ - bulkxfer2 = STAILQ_FIRST(&it->stfree); - STAILQ_REMOVE_HEAD(&it->stfree, link); - bcopy(bulkxfer->buf, bulkxfer2->buf, - it->psize * it->btpacket); - STAILQ_INSERT_TAIL(&it->stvalid, bulkxfer2, link); - } -#endif - } - it->stdma = bulkxfer; - it->stdma2 = bulkxfer2; - -#ifdef FWXFERQ_DV - if(it->flag & FWXFERQ_DV){ - struct fw_dvbuf *dvbuf = NULL; - int i, j, chtag; - struct fw_pkt *fp; - u_int64_t cycle, dvsync; - - chtag = it->flag & 0xff; -dvloop: - if(it->dvdma == NULL){ - dvbuf = STAILQ_FIRST(&it->dvvalid); - if(dvbuf != NULL){ - STAILQ_REMOVE_HEAD(&it->dvvalid, link); - it->dvdma = dvbuf; - it->queued = 0; - } - } - if(it->dvdma == NULL) - goto out; - - it->stproc = STAILQ_FIRST(&it->stfree); - if(it->stproc != NULL){ - STAILQ_REMOVE_HEAD(&it->stfree, link); - }else{ - goto out; - } -#if DV_PAL -#define DVSEC 3 -#define DVFRAC 75 /* PAL: 25 Hz (1875 = 25 * 3) */ -#define DVDIFF 5 /* 125 = (8000/300 - 25) * 3 */ -#else -#define DVSEC 100 -#define DVFRAC 2997 /* NTSC: 29.97 Hz (2997 = 29.97 * 100) */ -#define DVDIFF 203 /* 203 = (8000/250 - 29.97) * 100 */ -#endif -#define CYCLEFRAC 0xc00 - cycle = (u_int64_t) 8000 * DVSEC * it->dvsync; - /* least significant 12 bits */ - dvsync = (cycle * CYCLEFRAC / DVFRAC) % CYCLEFRAC; - /* most significat 4 bits */ - cycle = (cycle / DVFRAC + it->dvoffset) & 0xf; - fp = (struct fw_pkt *)(it->dvdma->buf); -#if 1 - fp->mode.ld[2] = htonl(0x80000000 | (cycle << 12) | dvsync); -#else - fp->mode.ld[2] = htonl(0x80000000 | dvsync); -#endif - it->dvsync ++; - it->dvsync %= 2997; - - for( i = 0, j = 0 ; i < it->dvpacket ; i++){ - bcopy(it->dvdma->buf + it->queued * it->psize, - it->stproc->buf + j * it->psize, it->psize); - fp = (struct fw_pkt *)(it->stproc->buf + j * it->psize); - fp->mode.stream.len = htons(488); - fp->mode.stream.chtag = chtag; - fp->mode.stream.tcode = FWTCODE_STREAM; - fp->mode.ld[1] = htonl((fc->nodeid << 24) | 0x00780000 | it->dvdbc); - it->dvdbc++; - it->dvdbc %= 256; - it->queued ++; - j++; - it->dvdiff += DVDIFF; - if(it->dvdiff >= DVFRAC){ - it->dvdiff %= DVFRAC; - fp = (struct fw_pkt *)(it->stproc->buf + j * it->psize); - - fp->mode.stream.len = htons(0x8); - fp->mode.stream.chtag = chtag; - fp->mode.stream.tcode = FWTCODE_STREAM; - fp->mode.ld[1] = htonl((fc->nodeid << 24) | - 0x00780000 | it->dvdbc); - j++; - } - } - it->stproc->npacket = j; - STAILQ_INSERT_TAIL(&it->stvalid, it->stproc, link); - if(it->queued >= it->dvpacket){ - STAILQ_INSERT_TAIL(&it->dvfree, it->dvdma, link); - it->dvdma = NULL; - wakeup(it); - goto dvloop; - } - } -out: -#endif - splx(s); - return err; -} -/* - * receving buffer update. - */ -int -fw_rbuf_update(struct firewire_comm *fc, int sub, int flag){ - struct fw_bulkxfer *bulkxfer, *bulkxfer2 = NULL; - struct fw_xferq *ir; - int s, err = 0; - - ir = fc->ir[sub]; - s = splfw(); - if(ir->stdma != NULL){ - if(flag != 0){ - STAILQ_INSERT_TAIL(&ir->stvalid, ir->stdma, link); - }else{ - ir->stdma->flag = 0; - STAILQ_INSERT_TAIL(&ir->stfree, ir->stdma, link); - } - } - if(ir->stdma2 != NULL){ - bulkxfer = ir->stdma2; - bulkxfer2 = STAILQ_FIRST(&ir->stfree); - if(bulkxfer2 != NULL){ - STAILQ_REMOVE_HEAD(&ir->stfree, link); - } - }else{ - bulkxfer = STAILQ_FIRST(&ir->stfree); - if(bulkxfer != NULL){ - STAILQ_REMOVE_HEAD(&ir->stfree, link); - bulkxfer2 = STAILQ_FIRST(&ir->stfree); - if(bulkxfer2 != NULL){ - STAILQ_REMOVE_HEAD(&ir->stfree, link); - } - }else{ - device_printf(fc->bdev, "no free chunk available\n"); - bulkxfer = STAILQ_FIRST(&ir->stvalid); - STAILQ_REMOVE_HEAD(&ir->stvalid, link); - } - } - splx(s); - ir->stdma = bulkxfer; - ir->stdma2 = bulkxfer2; - return err; -} - /* * To lookup node id. from EUI64. */ diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index a2c994e6f40d..ffdd8b73c90e 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -186,7 +186,7 @@ struct fw_xferq { #define FWXFERQ_PACKET (1 << 10) #define FWXFERQ_BULK (1 << 11) -#if 0 +#if 0 /* BROKEN */ #define FWXFERQ_DV (1 << 12) #endif #define FWXFERQ_MODEMASK (7 << 10) @@ -213,10 +213,9 @@ struct fw_xferq { struct fw_bulkxfer *bulkxfer; STAILQ_HEAD(, fw_bulkxfer) stvalid; STAILQ_HEAD(, fw_bulkxfer) stfree; - struct fw_bulkxfer *stdma; - struct fw_bulkxfer *stdma2; + STAILQ_HEAD(, fw_bulkxfer) stdma; struct fw_bulkxfer *stproc; - u_int procptr; +#ifdef FWXFERQ_DV int dvdbc, dvdiff, dvsync, dvoffset; struct fw_dvbuf *dvbuf; STAILQ_HEAD(, fw_dvbuf) dvvalid; @@ -225,14 +224,13 @@ struct fw_xferq { struct fw_dvbuf *dvproc; u_int dvptr; u_int dvpacket; - u_int need_wakeup; +#endif struct selinfo rsel; caddr_t sc; void (*hand) __P((struct fw_xferq *)); }; struct fw_bulkxfer{ - u_int32_t flag; caddr_t buf; STAILQ_ENTRY(fw_bulkxfer) link; caddr_t start; diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 7233f353239d..460e8b87d2f0 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -173,7 +173,9 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) sc->fc->it[sub]->buf = NULL; free(sc->fc->it[sub]->bulkxfer, M_DEVBUF); sc->fc->it[sub]->bulkxfer = NULL; +#ifdef FWXFERQ_DV sc->fc->it[sub]->dvbuf = NULL; +#endif sc->fc->it[sub]->flag &= ~FWXFERQ_EXTBUF; sc->fc->it[sub]->psize = 0; sc->fc->it[sub]->maxq = FWMAXQUEUE; @@ -284,24 +286,12 @@ readloop: ir->queued ++; if(ir->queued >= ir->bnpacket){ s = splfw(); - ir->stproc->flag = 0; STAILQ_INSERT_TAIL(&ir->stfree, ir->stproc, link); splx(s); + sc->fc->irx_enable(sc->fc, sub); ir->stproc = NULL; } } -#if 0 - if(STAILQ_FIRST(&ir->q) == NULL && - (ir->flag & FWXFERQ_RUNNING) && (ir->flag & FWXFERQ_PACKET)){ - err = sc->fc->irx_enable(sc->fc, sub); - } -#endif -#if 0 - if(STAILQ_FIRST(&ir->stvalid) == NULL && - (ir->flag & FWXFERQ_RUNNING) && !(ir->flag & FWXFERQ_PACKET)){ - err = sc->fc->irx_enable(sc->fc, sub); - } -#endif return err; } @@ -357,7 +347,6 @@ fw_write (dev_t dev, struct uio *uio, int ioflag) /* Discard unsent buffered stream packet, when sending Asyrequrst */ if(xferq != NULL && it->stproc != NULL){ s = splfw(); - it->stproc->flag = 0; STAILQ_INSERT_TAIL(&it->stfree, it->stproc, link); splx(s); it->stproc = NULL; @@ -368,14 +357,14 @@ fw_write (dev_t dev, struct uio *uio, int ioflag) if (xferq == NULL) { #endif isoloop: - if(it->stproc == NULL){ + if (it->stproc == NULL) { it->stproc = STAILQ_FIRST(&it->stfree); - if(it->stproc != NULL){ + if (it->stproc != NULL) { s = splfw(); STAILQ_REMOVE_HEAD(&it->stfree, link); splx(s); it->queued = 0; - }else if(slept == 0){ + } else if (slept == 0) { slept = 1; err = sc->fc->itx_enable(sc->fc, sub); if(err){ @@ -391,10 +380,6 @@ isoloop: return err; } } -#if 0 /* What's this for? (overwritten by the following uiomove)*/ - fp = (struct fw_pkt *)(it->stproc->buf + it->queued * it->psize); - fp->mode.stream.len = htons(uio->uio_resid - sizeof(u_int32_t)); -#endif err = uiomove(it->stproc->buf + it->queued * it->psize, uio->uio_resid, uio); it->queued ++; @@ -403,7 +388,6 @@ isoloop: STAILQ_INSERT_TAIL(&it->stvalid, it->stproc, link); splx(s); it->stproc = NULL; - fw_tbuf_update(sc->fc, sub, 0); err = sc->fc->itx_enable(sc->fc, sub); } return err; @@ -684,22 +668,23 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) it->bnpacket = ibufreq->tx.npacket; it->btpacket = ibufreq->tx.npacket; it->psize = (ibufreq->tx.psize + 3) & ~3; - ir->queued = 0; + it->queued = 0; + +#ifdef FWXFERQ_DV it->dvdbc = 0; it->dvdiff = 0; it->dvsync = 0; it->dvoffset = 0; +#endif STAILQ_INIT(&ir->stvalid); STAILQ_INIT(&ir->stfree); - ir->stdma = NULL; - ir->stdma2 = NULL; + STAILQ_INIT(&ir->stdma); ir->stproc = NULL; STAILQ_INIT(&it->stvalid); STAILQ_INIT(&it->stfree); - it->stdma = NULL; - it->stdma2 = NULL; + STAILQ_INIT(&it->stdma); it->stproc = NULL; for(i = 0 ; i < sc->fc->ir[sub]->bnchunk; i++){ @@ -707,7 +692,6 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) ir->buf + i * sc->fc->ir[sub]->bnpacket * sc->fc->ir[sub]->psize; - ir->bulkxfer[i].flag = 0; STAILQ_INSERT_TAIL(&ir->stfree, &ir->bulkxfer[i], link); ir->bulkxfer[i].npacket = ir->bnpacket; @@ -717,7 +701,6 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) it->buf + i * sc->fc->it[sub]->bnpacket * sc->fc->it[sub]->psize; - it->bulkxfer[i].flag = 0; STAILQ_INSERT_TAIL(&it->stfree, &it->bulkxfer[i], link); it->bulkxfer[i].npacket = it->bnpacket; diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index ea6e3d2be69e..78c238e97d7d 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -42,6 +42,7 @@ #define IRX_CH 0x24 #include +#include #include #include #include @@ -847,17 +848,15 @@ txloop: db_tr->dbcnt++; } else { + int mchain=0; /* XXX we assume mbuf chain is shorter than ndesc */ for (m = xfer->mbuf; m != NULL; m = m->m_next) { if (m->m_len == 0) - /* unrecoverable error could ocurre. */ + /* unrecoverable error could occur. */ + continue; + mchain++; + if (db_tr->dbcnt >= dbch->ndesc) continue; - if (db_tr->dbcnt >= dbch->ndesc) { - device_printf(sc->fc.dev, - "dbch->ndesc is too small" - ", trancated.\n"); - break; - } db->db.desc.addr = vtophys(mtod(m, caddr_t)); db->db.desc.cmd = OHCI_OUTPUT_MORE | m->m_len; @@ -865,6 +864,11 @@ txloop: db++; db_tr->dbcnt++; } + if (mchain > dbch->ndesc - 2) + device_printf(sc->fc.dev, + "dbch->ndesc(%d) is too small for" + " mbuf chain(%d), trancated.\n", + dbch->ndesc, mchain); } } if (maxdesc < db_tr->dbcnt) { @@ -1201,9 +1205,13 @@ static int fwohci_itx_disable(struct firewire_comm *fc, int dmach) { struct fwohci_softc *sc = (struct fwohci_softc *)fc; + int dummy; + OWRITE(sc, OHCI_ITCTLCLR(dmach), OHCI_CNTL_DMA_RUN); OWRITE(sc, OHCI_IT_MASKCLR, 1 << dmach); OWRITE(sc, OHCI_IT_STATCLR, 1 << dmach); + /* XXX we cannot free buffers until the DMA really stops */ + tsleep((void *)&dummy, FWPRI, "fwitxd", hz); fwohci_db_free(&sc->it[dmach]); sc->it[dmach].xferq.flag &= ~FWXFERQ_RUNNING; return 0; @@ -1213,10 +1221,13 @@ static int fwohci_irx_disable(struct firewire_comm *fc, int dmach) { struct fwohci_softc *sc = (struct fwohci_softc *)fc; + int dummy; OWRITE(sc, OHCI_IRCTLCLR(dmach), OHCI_CNTL_DMA_RUN); OWRITE(sc, OHCI_IR_MASKCLR, 1 << dmach); OWRITE(sc, OHCI_IR_STATCLR, 1 << dmach); + /* XXX we cannot free buffers until the DMA really stops */ + tsleep((void *)&dummy, FWPRI, "fwirxd", hz); if(sc->ir[dmach].dummy != NULL){ free(sc->ir[dmach].dummy, M_DEVBUF); } @@ -1415,6 +1426,33 @@ fwohci_rx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch) return err; } +static int +fwochi_next_cycle(struct firewire_comm *fc, int cycle_now) +{ + int sec, cycle, cycle_match; + + cycle = cycle_now & 0x1fff; + sec = cycle_now >> 13; +#define CYCLE_MOD 0x10 +#define CYCLE_DELAY 8 /* min delay to start DMA */ + cycle = cycle + CYCLE_DELAY; + if (cycle >= 8000) { + sec ++; + cycle -= 8000; + } + cycle = ((cycle + CYCLE_MOD - 1) / CYCLE_MOD) * CYCLE_MOD; + if (cycle >= 8000) { + sec ++; + if (cycle == 8000) + cycle = 0; + else + cycle = CYCLE_MOD; + } + cycle_match = ((sec << 13) | cycle) & 0x7ffff; + + return(cycle_match); +} + static int fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach) { @@ -1422,15 +1460,18 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach) int err = 0; unsigned short tag, ich; struct fwohci_dbch *dbch; - int cycle_now, sec, cycle, cycle_match; + int cycle_match, cycle_now, s, ldesc; u_int32_t stat; + struct fw_bulkxfer *first, *chunk, *prev; + struct fw_xferq *it; - tag = (sc->it[dmach].xferq.flag >> 6) & 3; - ich = sc->it[dmach].xferq.flag & 0x3f; dbch = &sc->it[dmach]; + it = &dbch->xferq; + + tag = (it->flag >> 6) & 3; + ich = it->flag & 0x3f; if ((dbch->flags & FWOHCI_DBCH_INIT) == 0) { - dbch->xferq.queued = 0; - dbch->ndb = dbch->xferq.bnpacket * dbch->xferq.bnchunk; + dbch->ndb = it->bnpacket * it->bnchunk; dbch->ndesc = 3; fwohci_db_init(dbch); if ((dbch->flags & FWOHCI_DBCH_INIT) == 0) @@ -1439,56 +1480,53 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach) } if(err) return err; - stat = OREAD(sc, OHCI_ITCTL(dmach)); - if (stat & OHCI_CNTL_DMA_ACTIVE) { - if(dbch->xferq.stdma2 != NULL){ - fwohci_txbufdb(sc, dmach, dbch->xferq.stdma2); - ((struct fwohcidb_tr *) - (dbch->xferq.stdma->end))->db[dbch->ndesc - 1].db.desc.cmd - |= OHCI_BRANCH_ALWAYS; - ((struct fwohcidb_tr *) - (dbch->xferq.stdma->end))->db[dbch->ndesc - 1].db.desc.depend = - vtophys(((struct fwohcidb_tr *)(dbch->xferq.stdma2->start))->db) | dbch->ndesc; - ((struct fwohcidb_tr *)(dbch->xferq.stdma->end))->db[0].db.desc.depend = - vtophys(((struct fwohcidb_tr *)(dbch->xferq.stdma2->start))->db) | dbch->ndesc; - ((struct fwohcidb_tr *)(dbch->xferq.stdma2->end))->db[dbch->ndesc - 1].db.desc.depend &= ~0xf; - ((struct fwohcidb_tr *)(dbch->xferq.stdma2->end))->db[0].db.desc.depend &= ~0xf; - } else { - device_printf(fc->dev, - "fwohci_itxbuf_enable: queue underrun\n"); + + s = splfw(); + prev = STAILQ_LAST(&it->stdma, fw_bulkxfer, link); + while ((chunk = STAILQ_FIRST(&it->stvalid)) != NULL) { + volatile struct fwohcidb *db; + + fwohci_txbufdb(sc, dmach, chunk); + ldesc = dbch->ndesc - 1; + db = ((struct fwohcidb_tr *)(chunk->end))->db; + db[ldesc].db.desc.status = db[0].db.desc.status = 0; + db[ldesc].db.desc.count = db[0].db.desc.count = 0; + db[ldesc].db.desc.depend &= ~0xf; + db[0].db.desc.depend &= ~0xf; + if (prev != NULL) { + db = ((struct fwohcidb_tr *)(prev->end))->db; + db[ldesc].db.desc.cmd |= OHCI_BRANCH_ALWAYS; + db[ldesc].db.desc.depend = db[0].db.desc.depend = + vtophys(((struct fwohcidb_tr *) + (chunk->start))->db) | dbch->ndesc; } - return err; - } - if (firewire_debug) - printf("fwohci_itxbuf_enable: kick 0x%08x\n", stat); - fw_tbuf_update(&sc->fc, dmach, 0); - if(dbch->xferq.stdma == NULL){ - return err; - } - if(dbch->xferq.stdma2 == NULL){ - /* wait until 2 chunks buffered */ - return err; + STAILQ_REMOVE_HEAD(&it->stvalid, link); + STAILQ_INSERT_TAIL(&it->stdma, chunk, link); + prev = chunk; } + splx(s); + stat = OREAD(sc, OHCI_ITCTL(dmach)); + if (stat & (OHCI_CNTL_DMA_ACTIVE | OHCI_CNTL_CYCMATCH_S)) + return 0; + + OWRITE(sc, OHCI_ITCTLCLR(dmach), OHCI_CNTL_DMA_RUN); OWRITE(sc, OHCI_IT_MASKCLR, 1 << dmach); OWRITE(sc, OHCI_IT_STATCLR, 1 << dmach); OWRITE(sc, OHCI_IT_MASK, 1 << dmach); - fwohci_txbufdb(sc, dmach, dbch->xferq.stdma); - fwohci_txbufdb(sc, dmach, dbch->xferq.stdma2); - ((struct fwohcidb_tr *) - (dbch->xferq.stdma->end))->db[dbch->ndesc - 1].db.desc.cmd - |= OHCI_BRANCH_ALWAYS; - ((struct fwohcidb_tr *)(dbch->xferq.stdma->end))->db[dbch->ndesc - 1].db.desc.depend = - vtophys(((struct fwohcidb_tr *)(dbch->xferq.stdma2->start))->db) | dbch->ndesc; - ((struct fwohcidb_tr *)(dbch->xferq.stdma->end))->db[0].db.desc.depend = - vtophys(((struct fwohcidb_tr *)(dbch->xferq.stdma2->start))->db) | dbch->ndesc; - ((struct fwohcidb_tr *)(dbch->xferq.stdma2->end))->db[dbch->ndesc - 1].db.desc.depend &= ~0xf; - ((struct fwohcidb_tr *) (dbch->xferq.stdma2->end))->db[0].db.desc.depend &= ~0xf; - OWRITE(sc, OHCI_ITCMD(dmach), - vtophys(((struct fwohcidb_tr *) - (dbch->xferq.stdma->start))->db) | dbch->ndesc); -#define CYCLE_OFFSET 1 + + first = STAILQ_FIRST(&it->stdma); + OWRITE(sc, OHCI_ITCMD(dmach), vtophys(((struct fwohcidb_tr *) + (first->start))->db) | dbch->ndesc); + if (firewire_debug) + printf("fwohci_itxbuf_enable: kick 0x%08x\n", stat); if ((stat & OHCI_CNTL_DMA_RUN) == 0) { +#if 1 + /* Don't start until all chunks are buffered */ + if (STAILQ_FIRST(&it->stfree) != NULL) + goto out; +#endif #ifdef FWXFERQ_DV +#define CYCLE_OFFSET 1 if(dbch->xferq.flag & FWXFERQ_DV){ struct fw_pkt *fp; struct fwohcidb_tr *db_tr; @@ -1499,41 +1537,26 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach) fp->mode.ld[2] |= htonl(dbch->xferq.dvoffset << 12); } #endif - /* 2bit second + 13bit cycle */ - cycle_now = (fc->cyctimer(fc) >> 12) & 0x7fff; - cycle = cycle_now & 0x1fff; - sec = cycle_now >> 13; -#define CYCLE_MOD 0x10 -#define CYCLE_DELAY 8 /* min delay to start DMA */ - cycle = cycle + CYCLE_DELAY; - if (cycle >= 8000) { - sec ++; - cycle -= 8000; - } - cycle = ((cycle + CYCLE_MOD - 1) / CYCLE_MOD) * CYCLE_MOD; - if (cycle >= 8000) { - sec ++; - if (cycle == 8000) - cycle = 0; - else - cycle = CYCLE_MOD; - } - cycle_match = ((sec << 13) | cycle) & 0x7ffff; /* Clear cycle match counter bits */ OWRITE(sc, OHCI_ITCTLCLR(dmach), 0xffff0000); + OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_DMA_IT); + + /* 2bit second + 13bit cycle */ + cycle_now = (fc->cyctimer(fc) >> 12) & 0x7fff; + cycle_match = fwochi_next_cycle(fc, cycle_now); + OWRITE(sc, OHCI_ITCTL(dmach), OHCI_CNTL_CYCMATCH_S | (cycle_match << 16) | OHCI_CNTL_DMA_RUN); - OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_DMA_IT); if (firewire_debug) printf("cycle_match: 0x%04x->0x%04x\n", cycle_now, cycle_match); } else if ((stat & OHCI_CNTL_CYCMATCH_S) == 0) { - if (firewire_debug) - printf("fwohci_itxbuf_enable: restart 0x%08x\n", stat); - OWRITE(sc, OHCI_ITCTLCLR(dmach), OHCI_CNTL_DMA_RUN); + device_printf(sc->fc.dev, + "IT DMA underrun (0x%08x)\n", stat); OWRITE(sc, OHCI_ITCTL(dmach), OHCI_CNTL_DMA_RUN); } +out: return err; } @@ -1541,71 +1564,84 @@ static int fwohci_irxbuf_enable(struct firewire_comm *fc, int dmach) { struct fwohci_softc *sc = (struct fwohci_softc *)fc; - int err = 0; + int err = 0, s, ldesc; unsigned short tag, ich; u_int32_t stat; + struct fwohci_dbch *dbch; + struct fw_bulkxfer *first, *prev, *chunk; + struct fw_xferq *ir; - if(!(sc->ir[dmach].xferq.flag & FWXFERQ_RUNNING)){ - tag = (sc->ir[dmach].xferq.flag >> 6) & 3; - ich = sc->ir[dmach].xferq.flag & 0x3f; + dbch = &sc->ir[dmach]; + ir = &dbch->xferq; + ldesc = dbch->ndesc - 1; + + if ((ir->flag & FWXFERQ_RUNNING) == 0) { + tag = (ir->flag >> 6) & 3; + ich = ir->flag & 0x3f; OWRITE(sc, OHCI_IRMATCH(dmach), tagbit[tag] | ich); - sc->ir[dmach].xferq.queued = 0; - sc->ir[dmach].ndb = sc->ir[dmach].xferq.bnpacket * - sc->ir[dmach].xferq.bnchunk; - sc->ir[dmach].dummy = - malloc(sizeof(u_int32_t) * sc->ir[dmach].ndb, - M_DEVBUF, M_NOWAIT); - if(sc->ir[dmach].dummy == NULL){ + ir->queued = 0; + dbch->ndb = ir->bnpacket * ir->bnchunk; + dbch->dummy = malloc(sizeof(u_int32_t) * dbch->ndb, + M_DEVBUF, M_NOWAIT); + if (dbch->dummy == NULL) { err = ENOMEM; return err; } - sc->ir[dmach].ndesc = 2; - fwohci_db_init(&sc->ir[dmach]); - if ((sc->ir[dmach].flags & FWOHCI_DBCH_INIT) == 0) + dbch->ndesc = 2; + fwohci_db_init(dbch); + if ((dbch->flags & FWOHCI_DBCH_INIT) == 0) return ENOMEM; - err = fwohci_rx_enable(sc, &sc->ir[dmach]); + err = fwohci_rx_enable(sc, dbch); } if(err) return err; - stat = OREAD(sc, OHCI_IRCTL(dmach)); - if (stat & OHCI_CNTL_DMA_ACTIVE) { - if(sc->ir[dmach].xferq.stdma2 != NULL){ - ((struct fwohcidb_tr *)(sc->ir[dmach].xferq.stdma->end))->db[sc->ir[dmach].ndesc - 1].db.desc.depend = - vtophys(((struct fwohcidb_tr *)(sc->ir[dmach].xferq.stdma2->start))->db) | sc->ir[dmach].ndesc; - ((struct fwohcidb_tr *)(sc->ir[dmach].xferq.stdma->end))->db[0].db.desc.depend = - vtophys(((struct fwohcidb_tr *)(sc->ir[dmach].xferq.stdma2->start))->db); - ((struct fwohcidb_tr *)(sc->ir[dmach].xferq.stdma2->end))->db[sc->ir[dmach].ndesc - 1].db.desc.depend &= ~0xf; - ((struct fwohcidb_tr *)(sc->ir[dmach].xferq.stdma2->end))->db[0].db.desc.depend &= ~0xf; - } - } else if (!(stat & OHCI_CNTL_DMA_ACTIVE) - && !(sc->ir[dmach].xferq.flag & FWXFERQ_PACKET)) { - if (firewire_debug) - device_printf(sc->fc.dev, "IR DMA stat %x\n", stat); - fw_rbuf_update(&sc->fc, dmach, 0); + s = splfw(); - OWRITE(sc, OHCI_IRCTLCLR(dmach), OHCI_CNTL_DMA_RUN); - OWRITE(sc, OHCI_IR_MASKCLR, 1 << dmach); - OWRITE(sc, OHCI_IR_STATCLR, 1 << dmach); - OWRITE(sc, OHCI_IR_MASK, 1 << dmach); - OWRITE(sc, OHCI_IRCTLCLR(dmach), 0xf0000000); - OWRITE(sc, OHCI_IRCTL(dmach), OHCI_CNTL_ISOHDR); - if(sc->ir[dmach].xferq.stdma2 != NULL){ - ((struct fwohcidb_tr *)(sc->ir[dmach].xferq.stdma->end))->db[sc->ir[dmach].ndesc - 1].db.desc.depend = - vtophys(((struct fwohcidb_tr *)(sc->ir[dmach].xferq.stdma2->start))->db) | sc->ir[dmach].ndesc; - ((struct fwohcidb_tr *)(sc->ir[dmach].xferq.stdma->end))->db[0].db.desc.depend = - vtophys(((struct fwohcidb_tr *)(sc->ir[dmach].xferq.stdma2->start))->db); - ((struct fwohcidb_tr *)(sc->ir[dmach].xferq.stdma2->end))->db[sc->ir[dmach].ndesc - 1].db.desc.depend &= ~0xf; - }else{ - ((struct fwohcidb_tr *)(sc->ir[dmach].xferq.stdma->end))->db[sc->ir[dmach].ndesc - 1].db.desc.depend &= ~0xf; - ((struct fwohcidb_tr *)(sc->ir[dmach].xferq.stdma->end))->db[0].db.desc.depend &= ~0xf; + first = STAILQ_FIRST(&ir->stfree); + if (first == NULL) { + device_printf(fc->dev, "IR DMA no free chunk\n"); + splx(s); + return 0; + } + + prev = STAILQ_LAST(&ir->stdma, fw_bulkxfer, link); + while ((chunk = STAILQ_FIRST(&ir->stfree)) != NULL) { + volatile struct fwohcidb *db; + + db = ((struct fwohcidb_tr *)(chunk->end))->db; + db[ldesc].db.desc.status = db[ldesc].db.desc.count = 0; + db[ldesc].db.desc.depend &= ~0xf; + if (prev != NULL) { + db = ((struct fwohcidb_tr *)(prev->end))->db; + db[ldesc].db.desc.depend = + vtophys(((struct fwohcidb_tr *) + (chunk->start))->db) | dbch->ndesc; } - OWRITE(sc, OHCI_IRCMD(dmach), - vtophys(((struct fwohcidb_tr *)(sc->ir[dmach].xferq.stdma->start))->db) | sc->ir[dmach].ndesc); - OWRITE(sc, OHCI_IRCTL(dmach), OHCI_CNTL_DMA_RUN); - OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_DMA_IR); + STAILQ_REMOVE_HEAD(&ir->stfree, link); + STAILQ_INSERT_TAIL(&ir->stdma, chunk, link); + prev = chunk; + } + splx(s); + stat = OREAD(sc, OHCI_IRCTL(dmach)); + if (stat & OHCI_CNTL_DMA_ACTIVE) + return 0; + if (stat & OHCI_CNTL_DMA_RUN) { + OWRITE(sc, OHCI_IRCTLCLR(dmach), OHCI_CNTL_DMA_RUN); + device_printf(sc->fc.dev, "IR DMA overrun (0x%08x)\n", stat); } + + OWRITE(sc, OHCI_IR_MASKCLR, 1 << dmach); + OWRITE(sc, OHCI_IR_STATCLR, 1 << dmach); + OWRITE(sc, OHCI_IR_MASK, 1 << dmach); + OWRITE(sc, OHCI_IRCTLCLR(dmach), 0xf0000000); + OWRITE(sc, OHCI_IRCTL(dmach), OHCI_CNTL_ISOHDR); + OWRITE(sc, OHCI_IRCMD(dmach), + vtophys(((struct fwohcidb_tr *)(first->start))->db) + | dbch->ndesc); + OWRITE(sc, OHCI_IRCTL(dmach), OHCI_CNTL_DMA_RUN); + OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_DMA_IR); return err; } @@ -1959,92 +1995,72 @@ fwohci_set_intr(struct firewire_comm *fc, int enable) static void fwohci_tbuf_update(struct fwohci_softc *sc, int dmach) { - int stat; struct firewire_comm *fc = &sc->fc; - struct fwohci_dbch *dbch; - struct fwohcidb_tr *db_tr; - - dbch = &sc->it[dmach]; -#if 0 /* XXX OHCI interrupt before the last packet is really on the wire */ - if((dbch->xferq.flag & FWXFERQ_DV) && (dbch->xferq.stdma2 != NULL)){ - db_tr = (struct fwohcidb_tr *)dbch->xferq.stdma2->start; -/* - * Overwrite highest significant 4 bits timestamp information - */ - fp = (struct fw_pkt *)db_tr->buf; - fp->mode.ld[2] &= htonl(0xffff0fff); - fp->mode.ld[2] |= htonl((fc->cyctimer(fc) + 0x4000) & 0xf000); - } + volatile struct fwohcidb *db; + struct fw_bulkxfer *chunk; + struct fw_xferq *it; + u_int32_t stat, count; + int s, w=0; + + it = fc->it[dmach]; + s = splfw(); /* unnecessary ? */ + while ((chunk = STAILQ_FIRST(&it->stdma)) != NULL) { + db = ((struct fwohcidb_tr *)(chunk->end))->db; + stat = db[sc->it[dmach].ndesc - 1].db.desc.status; + db = ((struct fwohcidb_tr *)(chunk->start))->db; + count = db[sc->it[dmach].ndesc - 1].db.desc.count; + if (stat == 0) + break; + STAILQ_REMOVE_HEAD(&it->stdma, link); + switch (stat & FWOHCIEV_MASK){ + case FWOHCIEV_ACKCOMPL: +#if 0 + device_printf(fc->dev, "0x%08x\n", count); #endif - /* - * XXX interrupt could be missed. - * We have to check more than one buffer/chunk - */ - if (firewire_debug && dbch->xferq.stdma2 != NULL) { - db_tr = (struct fwohcidb_tr *)dbch->xferq.stdma2->end; - stat = db_tr->db[2].db.desc.status; - if (stat) + break; + default: device_printf(fc->dev, - "stdma2 already done stat:0x%x\n", stat); - } - - stat = OREAD(sc, OHCI_ITCTL(dmach)) & 0x1f; - switch(stat){ - case FWOHCIEV_ACKCOMPL: -#ifdef FWXFERQ_DV - if (dbch->xferq.flag & FWXFERQ_DV) { - struct ciphdr *ciph; - int timer, timestamp, cycl, diff; - static int last_timer=0; - struct fw_pkt *fp; - - timer = (fc->cyctimer(fc) >> 12) & 0xffff; - db_tr = (struct fwohcidb_tr *)dbch->xferq.stdma->start; - fp = (struct fw_pkt *)db_tr->buf; - ciph = (struct ciphdr *) &fp->mode.ld[1]; - timestamp = db_tr->db[2].db.desc.count & 0xffff; - cycl = ntohs(ciph->fdf.dv.cyc) >> 12; - diff = cycl - (timestamp & 0xf) - CYCLE_OFFSET; - if (diff < 0) - diff += 16; - if (diff > 8) - diff -= 16; - if (firewire_debug || diff != 0) - printf("dbc: %3d timer: 0x%04x packet: 0x%04x" - " cyc: 0x%x diff: %+1d\n", - ciph->dbc, last_timer, timestamp, cycl, diff); - last_timer = timer; - /* XXX adjust dbch->xferq.dvoffset if diff != 0 or 1 */ - } -#endif - fw_tbuf_update(fc, dmach, 1); - break; - default: - device_printf(fc->dev, "Isochronous transmit err %02x\n", stat); - fw_tbuf_update(fc, dmach, 0); - break; + "Isochronous transmit err %02x\n", stat); + } + STAILQ_INSERT_TAIL(&it->stfree, chunk, link); + w++; } - fwohci_itxbuf_enable(fc, dmach); + splx(s); + if (w) + wakeup(it); } static void fwohci_rbuf_update(struct fwohci_softc *sc, int dmach) { struct firewire_comm *fc = &sc->fc; - int stat; + volatile struct fwohcidb *db; + struct fw_bulkxfer *chunk; + struct fw_xferq *ir; + u_int32_t stat; + int s, w=0; - stat = OREAD(sc, OHCI_IRCTL(dmach)) & 0x1f; - switch(stat){ - case FWOHCIEV_ACKCOMPL: - fw_rbuf_update(fc, dmach, 1); - wakeup(fc->ir[dmach]); - fwohci_irx_enable(fc, dmach); - break; - default: - device_printf(fc->dev, "Isochronous receive err %02x\n", - stat); - break; + ir = fc->ir[dmach]; + s = splfw(); + while ((chunk = STAILQ_FIRST(&ir->stdma)) != NULL) { + db = ((struct fwohcidb_tr *)(chunk->end))->db; + stat = db[sc->ir[dmach].ndesc - 1].db.desc.status; + if (stat == 0) + break; + STAILQ_REMOVE_HEAD(&ir->stdma, link); + STAILQ_INSERT_TAIL(&ir->stvalid, chunk, link); + switch (stat & FWOHCIEV_MASK) { + case FWOHCIEV_ACKCOMPL: + break; + default: + device_printf(fc->dev, + "Isochronous receive err %02x\n", stat); + } + w++; } + splx(s); + if (w) + wakeup(ir); } void @@ -2294,10 +2310,6 @@ fwohci_txbufdb(struct fwohci_softc *sc, int dmach, struct fw_bulkxfer *bulkxfer) /* device_printf(sc->fc.dev, "DB %08x %08x %08x\n", bulkxfer, vtophys(db_tr->db), vtophys(fdb_tr->db)); */ - if(bulkxfer->flag != 0){ - return; - } - bulkxfer->flag = 1; for( idb = 0 ; idb < bulkxfer->npacket ; idb ++){ db_tr->db[0].db.desc.cmd = OHCI_OUTPUT_MORE | OHCI_KEY_ST2 | 8; @@ -2308,9 +2320,7 @@ device_printf(sc->fc.dev, "DB %08x %08x %08x\n", bulkxfer, vtophys(db_tr->db), v ohcifp->mode.stream.len = ntohs(fp->mode.stream.len); ohcifp->mode.stream.chtag = chtag; ohcifp->mode.stream.tcode = 0xa; - ohcifp->mode.stream.spd = 4; - ohcifp->mode.ld[2] = ntohl(fp->mode.ld[1]); - ohcifp->mode.ld[3] = ntohl(fp->mode.ld[2]); + ohcifp->mode.stream.spd = 0; db_tr->db[2].db.desc.cmd = OHCI_OUTPUT_LAST @@ -2329,12 +2339,6 @@ device_printf(sc->fc.dev, "DB %08x %08x %08x\n", bulkxfer, vtophys(db_tr->db), v db_tr = (struct fwohcidb_tr *)bulkxfer->end; db_tr->db[0].db.desc.depend &= ~0xf; db_tr->db[dbch->ndesc - 1].db.desc.depend &= ~0xf; -#if 0 -/**/ - db_tr->db[dbch->ndesc - 1].db.desc.cmd &= ~OHCI_BRANCH_ALWAYS; - db_tr->db[dbch->ndesc - 1].db.desc.cmd |= OHCI_BRANCH_NEVER; -/**/ -#endif db_tr->db[dbch->ndesc - 1].db.desc.cmd |= OHCI_INTERRUPT_ALWAYS; /* OHCI 1.1 and above */ db_tr->db[0].db.desc.cmd |= OHCI_INTERRUPT_ALWAYS; -- cgit v1.3 From c3e9e255425de2028137d914716130a8b02d1669 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Tue, 28 Jan 2003 15:09:07 +0000 Subject: - Allow multiple packets read/write for IR/IT to reduce system call. - Remove unused variables. --- sys/dev/firewire/firewirereg.h | 2 -- sys/dev/firewire/fwdev.c | 76 ++++++++++++++++++++++++------------------ 2 files changed, 43 insertions(+), 35 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index ffdd8b73c90e..57fbfdf87a97 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -204,12 +204,10 @@ struct fw_xferq { u_int maxq; u_int psize; u_int packets; - u_int error; STAILQ_HEAD(, fw_bind) binds; caddr_t buf; u_int bnchunk; u_int bnpacket; - u_int btpacket; struct fw_bulkxfer *bulkxfer; STAILQ_HEAD(, fw_bulkxfer) stvalid; STAILQ_HEAD(, fw_bulkxfer) stfree; diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 460e8b87d2f0..847404903ebc 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -227,43 +227,41 @@ fw_read (dev_t dev, struct uio *uio, int ioflag) ir = sc->fc->ir[sub]; - if(ir->flag & FWXFERQ_PACKET){ + if (ir->flag & FWXFERQ_PACKET) { ir->stproc = NULL; } readloop: xfer = STAILQ_FIRST(&ir->q); - if(!(ir->flag & FWXFERQ_PACKET) && ir->stproc == NULL){ + if ((ir->flag & FWXFERQ_PACKET) == 0 && ir->stproc == NULL) { + /* iso bulkxfer */ ir->stproc = STAILQ_FIRST(&ir->stvalid); - if(ir->stproc != NULL){ + if (ir->stproc != NULL) { s = splfw(); STAILQ_REMOVE_HEAD(&ir->stvalid, link); splx(s); ir->queued = 0; } } - - if(xfer == NULL && ir->stproc == NULL){ - if(slept == 0){ + if (xfer == NULL && ir->stproc == NULL) { + /* no data avaliable */ + if (slept == 0) { slept = 1; - if(!(ir->flag & FWXFERQ_RUNNING) - && (ir->flag & FWXFERQ_PACKET)){ + if ((ir->flag & FWXFERQ_RUNNING) == 0 + && (ir->flag & FWXFERQ_PACKET)) { err = sc->fc->irx_enable(sc->fc, sub); - } - if(err){ - return err; + if (err) + return err; } ir->flag |= FWXFERQ_WAKEUP; err = tsleep((caddr_t)ir, FWPRI, "fw_read", hz); - if(err){ - ir->flag &= ~FWXFERQ_WAKEUP; - return err; - } - goto readloop; - }else{ + ir->flag &= ~FWXFERQ_WAKEUP; + if (err == 0) + goto readloop; + } else if (slept == 1) err = EIO; - return err; - } - }else if(xfer != NULL){ + return err; + } else if(xfer != NULL) { + /* per packet mode */ s = splfw(); ir->queued --; STAILQ_REMOVE_HEAD(&ir->q, link); @@ -273,7 +271,8 @@ readloop: sc->fc->irx_post(sc->fc, fp->mode.ld); err = uiomove(xfer->recv.buf + xfer->recv.off, xfer->recv.len, uio); fw_xfer_free( xfer); - }else if(ir->stproc != NULL){ + } else if(ir->stproc != NULL) { + /* iso bulkxfer */ fp = (struct fw_pkt *)(ir->stproc->buf + ir->queued * ir->psize); if(sc->fc->irx_post != NULL) sc->fc->irx_post(sc->fc, fp->mode.ld); @@ -281,8 +280,11 @@ readloop: err = EIO; return err; } - err = uiomove((caddr_t)fp, ntohs(fp->mode.stream.len) + sizeof(u_int32_t), uio); + err = uiomove((caddr_t)fp, + ntohs(fp->mode.stream.len) + sizeof(u_int32_t), uio); +#if 0 fp->mode.stream.len = 0; +#endif ir->queued ++; if(ir->queued >= ir->bnpacket){ s = splfw(); @@ -291,6 +293,10 @@ readloop: sc->fc->irx_enable(sc->fc, sub); ir->stproc = NULL; } + if (uio->uio_resid >= ir->psize) { + slept = -1; + goto readloop; + } } return err; } @@ -367,29 +373,35 @@ isoloop: } else if (slept == 0) { slept = 1; err = sc->fc->itx_enable(sc->fc, sub); - if(err){ + if (err) return err; - } - err = tsleep((caddr_t)it, FWPRI, "fw_write", hz); - if(err){ + err = tsleep((caddr_t)it, FWPRI, + "fw_write", hz); + if (err) return err; - } goto isoloop; - }else{ + } else { err = EIO; return err; } } - err = uiomove(it->stproc->buf + it->queued * it->psize, - uio->uio_resid, uio); + fp = (struct fw_pkt *) + (it->stproc->buf + it->queued * it->psize); + err = uiomove((caddr_t)fp, sizeof(struct fw_isohdr), uio); + err = uiomove((caddr_t)fp->mode.stream.payload, + ntohs(fp->mode.stream.len), uio); it->queued ++; - if(it->queued >= it->btpacket){ + if (it->queued >= it->bnpacket) { s = splfw(); STAILQ_INSERT_TAIL(&it->stvalid, it->stproc, link); splx(s); it->stproc = NULL; err = sc->fc->itx_enable(sc->fc, sub); } + if (uio->uio_resid >= sizeof(struct fw_isohdr)) { + slept = 0; + goto isoloop; + } return err; } #ifdef FWXFERQ_DV @@ -660,13 +672,11 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) ir->bnchunk = ibufreq->rx.nchunk; ir->bnpacket = ibufreq->rx.npacket; - ir->btpacket = ibufreq->rx.npacket; ir->psize = (ibufreq->rx.psize + 3) & ~3; ir->queued = 0; it->bnchunk = ibufreq->tx.nchunk; it->bnpacket = ibufreq->tx.npacket; - it->btpacket = ibufreq->tx.npacket; it->psize = (ibufreq->tx.psize + 3) & ~3; it->queued = 0; -- cgit v1.3 From 958c774916aea21673d8ec6d3fb47750dbc21701 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Thu, 30 Jan 2003 05:18:35 +0000 Subject: Restart cycle master after bus manager election. This should fix the IR(and maybe IT) problem when the host becames the bus manager. - rename fw_noderesolve() to fw_noderesolve_eui64() and add fw_noderesolve_nodeid(). --- sys/dev/firewire/firewire.c | 89 ++++++++++++++++++++++++++++++++---------- sys/dev/firewire/firewirereg.h | 3 +- sys/dev/firewire/fwdev.c | 3 +- sys/dev/firewire/fwmem.c | 4 +- 4 files changed, 74 insertions(+), 25 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 0b93285f8456..5158e120ccd9 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -54,6 +54,7 @@ #include #include +#include #include #include @@ -91,6 +92,7 @@ static void fw_vmaccess __P((struct fw_xfer *)); #endif struct fw_xfer *asyreqq __P((struct firewire_comm *, u_int8_t, u_int8_t, u_int8_t, u_int32_t, u_int32_t, void (*)__P((struct fw_xfer *)))); +static int fw_bmr __P((struct firewire_comm *)); static device_method_t firewire_methods[] = { /* Device interface */ @@ -122,18 +124,40 @@ static driver_t firewire_driver = { }; /* - * To lookup node id. from EUI64. + * Lookup fwdev by node id. */ struct fw_device * -fw_noderesolve(struct firewire_comm *fc, struct fw_eui64 eui) +fw_noderesolve_nodeid(struct firewire_comm *fc, int dst) { struct fw_device *fwdev; - for(fwdev = TAILQ_FIRST(&fc->devices); fwdev != NULL; - fwdev = TAILQ_NEXT(fwdev, link)){ - if(fwdev->eui.hi == eui.hi && fwdev->eui.lo == eui.lo){ + int s; + + s = splfw(); + TAILQ_FOREACH(fwdev, &fc->devices, link) + if (fwdev->dst == dst) break; - } - } + splx(s); + + if(fwdev == NULL) return NULL; + if(fwdev->status == FWDEVINVAL) return NULL; + return fwdev; +} + +/* + * Lookup fwdev by EUI64. + */ +struct fw_device * +fw_noderesolve_eui64(struct firewire_comm *fc, struct fw_eui64 eui) +{ + struct fw_device *fwdev; + int s; + + s = splfw(); + TAILQ_FOREACH(fwdev, &fc->devices, link) + if (fwdev->eui.hi == eui.hi && fwdev->eui.lo == eui.lo) + break; + splx(s); + if(fwdev == NULL) return NULL; if(fwdev->status == FWDEVINVAL) return NULL; return fwdev; @@ -851,19 +875,14 @@ fw_xfer_free( struct fw_xfer* xfer) free(xfer, M_DEVBUF); } -/* - * Callback for PHY configuration. - */ static void -fw_phy_config_callback(struct fw_xfer *xfer) +fw_asy_callback_free(struct fw_xfer *xfer) { #if 0 - printf("phy_config done state=%d resp=%d\n", + printf("asyreq done state=%d resp=%d\n", xfer->state, xfer->resp); #endif fw_xfer_free(xfer); - /* XXX need bus reset ?? */ - /* sc->fc->ibr(xfer->fc); LOOP */ } /* @@ -885,7 +904,7 @@ fw_phy_config(struct firewire_comm *fc, int root_node, int gap_count) xfer->send.off = 0; xfer->fc = fc; xfer->retry_req = fw_asybusy; - xfer->act.hand = fw_phy_config_callback; + xfer->act.hand = fw_asy_callback_free; xfer->send.buf = malloc(sizeof(u_int32_t), M_DEVBUF, M_NOWAIT | M_ZERO); @@ -1041,9 +1060,9 @@ void fw_sidrcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int off) #endif } free(buf, M_DEVBUF); - /* Optimize gap_count, if I am BMGR */ if(fc->irm == ((CSRARC(fc, NODE_IDS) >> 16 ) & 0x3f)){ - fw_phy_config(fc, -1, gap_cnt[fc->max_hop]); + /* I am BMGR */ + fw_bmr(fc); } callout_reset(&fc->busprobe_callout, hz/4, (void *)fw_bus_probe, (void *)fc); @@ -1851,10 +1870,7 @@ fw_try_bmr_callback(struct fw_xfer *xfer) CSRARC(fc, BUS_MGR_ID)); if(bmr == fc->nodeid){ printf("(me)\n"); -/* If I am bus manager, optimize gapcount */ - if(fc->max_hop <= MAX_GAPHOP ){ - fw_phy_config(fc, -1, gap_cnt[fc->max_hop]); - } + fw_bmr(fc); }else{ printf("\n"); } @@ -2008,5 +2024,36 @@ fw_crc16(u_int32_t *ptr, u_int32_t len){ return((u_int16_t) crc); } +int +fw_bmr(struct firewire_comm *fc) +{ + struct fw_device fwdev; + int cmstr; + + /* XXX Assume that the current root node is cycle master capable */ + cmstr = fc->max_node; + /* If I am the bus manager, optimize gapcount */ + if(fc->max_hop <= MAX_GAPHOP ){ + fw_phy_config(fc, (fc->max_node > 0)?cmstr:-1, + gap_cnt[fc->max_hop]); + } + /* If we are the cycle master, nothing to do */ + if (cmstr == fc->nodeid) + return 0; + /* Bus probe has not finished, make dummy fwdev for cmstr */ + bzero(&fwdev, sizeof(fwdev)); + fwdev.fc = fc; + fwdev.dst = cmstr; + fwdev.speed = 0; + fwdev.maxrec = 8; /* 512 */ + fwdev.status = FWDEVINIT; + /* Set cmstr bit on the cycle master */ + fwmem_write_quad(&fwdev, NULL, 0/*spd*/, + 0xffff, 0xf0000000 | STATE_SET, 1 << 16, + fw_asy_callback_free); + + return 0; +} + DRIVER_MODULE(firewire,fwohci,firewire_driver,firewire_devclass,0,0); MODULE_VERSION(firewire, 1); diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 57fbfdf87a97..1a7481111d8e 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -320,7 +320,8 @@ u_int16_t fw_crc16 __P((u_int32_t *, u_int32_t)); void fw_xfer_timeout __P((void *)); void fw_xfer_done __P((struct fw_xfer *)); void fw_asy_callback __P((struct fw_xfer *)); -struct fw_device *fw_noderesolve __P((struct firewire_comm *, struct fw_eui64)); +struct fw_device *fw_noderesolve_nodeid __P((struct firewire_comm *, int)); +struct fw_device *fw_noderesolve_eui64 __P((struct firewire_comm *, struct fw_eui64)); struct fw_bind *fw_bindlookup __P((struct firewire_comm *, u_int32_t, u_int32_t)); diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 847404903ebc..0a740180ba0e 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -745,7 +745,8 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) xfer->dst = ntohs(fp->mode.hdr.dst); break; case FWASREQEUI: - fwdev = fw_noderesolve(sc->fc, asyreq->req.dst.eui); + fwdev = fw_noderesolve_eui64(sc->fc, + asyreq->req.dst.eui); if (fwdev == NULL) { device_printf(sc->fc->bdev, "cannot find node\n"); diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index ed0eed909151..478bcbf33211 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -158,7 +158,7 @@ fwmem_write_quad( return NULL; fp = (struct fw_pkt *)xfer->send.buf; - fp->mode.wreqq.tcode = FWTCODE_RREQQ; + fp->mode.wreqq.tcode = FWTCODE_WREQQ; fp->mode.wreqq.dst = htons(xfer->dst); fp->mode.wreqq.dest_hi = htons(dst_hi); fp->mode.wreqq.dest_lo = htonl(dst_lo); @@ -240,7 +240,7 @@ fwmem_read (dev_t dev, struct uio *uio, int ioflag) int len; sc = devclass_get_softc(firewire_devclass, unit); - fwdev = fw_noderesolve(sc->fc, fwmem_eui64); + fwdev = fw_noderesolve_eui64(sc->fc, fwmem_eui64); if (fwdev == NULL) { printf("fwmem: no such device ID:%08x%08x\n", fwmem_eui64.hi, fwmem_eui64.lo); -- cgit v1.3 From 0981f5f00eda6efa19d9b68514345da7ff12ead8 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Sat, 1 Feb 2003 14:42:49 +0000 Subject: - replace timeout with callout_*. - replace TAILQ with STAILQ for device list. - some clean up. --- sys/dev/firewire/firewire.c | 65 ++++++++++++++++++++++-------------------- sys/dev/firewire/firewire.h | 2 ++ sys/dev/firewire/firewirereg.h | 10 +++---- sys/dev/firewire/fwdev.c | 10 ++----- sys/dev/firewire/fwohci.c | 4 +-- sys/dev/firewire/sbp.c | 13 ++++----- 6 files changed, 51 insertions(+), 53 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 5c9652d6585f..431164384f4c 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -133,7 +133,7 @@ fw_noderesolve_nodeid(struct firewire_comm *fc, int dst) int s; s = splfw(); - TAILQ_FOREACH(fwdev, &fc->devices, link) + STAILQ_FOREACH(fwdev, &fc->devices, link) if (fwdev->dst == dst) break; splx(s); @@ -153,8 +153,8 @@ fw_noderesolve_eui64(struct firewire_comm *fc, struct fw_eui64 eui) int s; s = splfw(); - TAILQ_FOREACH(fwdev, &fc->devices, link) - if (fwdev->eui.hi == eui.hi && fwdev->eui.lo == eui.lo) + STAILQ_FOREACH(fwdev, &fc->devices, link) + if (FW_EUI64_EQUAL(fwdev->eui, eui)) break; splx(s); @@ -366,14 +366,18 @@ firewire_attach( device_t dev ) #else sc->dev[i] = d; #endif - sc->fc->timeouthandle = timeout((timeout_t *)sc->fc->timeout, (void *)sc->fc, hz * 10); - - callout_init(&sc->fc->busprobe_callout #if __FreeBSD_version >= 500000 - , /* mpsafe? */ 0); +#define CALLOUT_INIT(x) callout_init(x, 0 /* mpsafe */) #else - ); +#define CALLOUT_INIT(x) callout_init(x) #endif + CALLOUT_INIT(&sc->fc->timeout_callout); + CALLOUT_INIT(&sc->fc->bmr_callout); + CALLOUT_INIT(&sc->fc->retry_probe_callout); + CALLOUT_INIT(&sc->fc->busprobe_callout); + + callout_reset(&sc->fc->timeout_callout, hz * 10, + (void *)sc->fc->timeout, (void *)sc->fc); /* Locate our children */ bus_generic_probe(dev); @@ -426,7 +430,10 @@ firewire_detach( device_t dev ) } #endif /* XXX xfree_free and untimeout on all xfers */ - untimeout((timeout_t *)sc->fc->timeout, sc->fc, sc->fc->timeouthandle); + callout_stop(&sc->fc->timeout_callout); + callout_stop(&sc->fc->bmr_callout); + callout_stop(&sc->fc->retry_probe_callout); + callout_stop(&sc->fc->busprobe_callout); free(sc->fc->topology_map, M_DEVBUF); free(sc->fc->speed_map, M_DEVBUF); bus_generic_detach(dev); @@ -451,7 +458,7 @@ fw_busreset(struct firewire_comm *fc) switch(fc->status){ case FWBUSMGRELECT: - untimeout((timeout_t *)fw_try_bmr, (void *)fc, fc->bmrhandle); + callout_stop(&fc->bmr_callout); break; default: break; @@ -612,7 +619,7 @@ void fw_init(struct firewire_comm *fc) CSRARC(fc, SPED_MAP) = 0x3f1 << 16; CSRARC(fc, SPED_MAP + 4) = 1; - TAILQ_INIT(&fc->devices); + STAILQ_INIT(&fc->devices); STAILQ_INIT(&fc->pending); /* Initialize csr ROM work space */ @@ -1049,8 +1056,8 @@ void fw_sidrcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int off) CSRARC(fc, BUS_MGR_ID) = fc->set_bmr(fc, fc->irm); } else { fc->status = FWBUSMGRELECT; - fc->bmrhandle = timeout((timeout_t *)fw_try_bmr, - (void *)fc, hz / 8); + callout_reset(&fc->bmr_callout, hz/8, + (void *)fw_try_bmr, (void *)fc); } } else { fc->status = FWBUSMGRDONE; @@ -1085,15 +1092,15 @@ fw_bus_probe(struct firewire_comm *fc) * Invalidate all devices, just after bus reset. Devices * to be removed has not been seen longer time. */ - for(fwdev = TAILQ_FIRST(&fc->devices); fwdev != NULL; fwdev = next) { - next = TAILQ_NEXT(fwdev, link); - if(fwdev->status != FWDEVINVAL){ + for (fwdev = STAILQ_FIRST(&fc->devices); fwdev != NULL; fwdev = next) { + next = STAILQ_NEXT(fwdev, link); + if (fwdev->status != FWDEVINVAL) { fwdev->status = FWDEVINVAL; fwdev->rcnt = 0; - }else if(fwdev->rcnt < FW_MAXDEVRCNT){ + } else if(fwdev->rcnt < FW_MAXDEVRCNT) { fwdev->rcnt ++; - }else{ - TAILQ_REMOVE(&fc->devices, fwdev, link); + } else { + STAILQ_REMOVE(&fc->devices, fwdev, fw_device, link); free(fwdev, M_DEVBUF); } } @@ -1146,12 +1153,9 @@ loop: fc->ongoaddr = CSRROMOFF + 0x10; addr = 0xf0000000 | fc->ongoaddr; }else if(fc->ongodev == NULL){ - for(fwdev = TAILQ_FIRST(&fc->devices); fwdev != NULL; - fwdev = TAILQ_NEXT(fwdev, link)){ - if(fwdev->eui.hi == fc->ongoeui.hi && fwdev->eui.lo == fc->ongoeui.lo){ + STAILQ_FOREACH(fwdev, &fc->devices, link) + if (FW_EUI64_EQUAL(fwdev->eui, fc->ongoeui)) break; - } - } if(fwdev != NULL){ fwdev->dst = fc->ongonode; fwdev->status = FWDEVATTACHED; @@ -1177,7 +1181,7 @@ loop: #endif pfwdev = NULL; - TAILQ_FOREACH(tfwdev, &fc->devices, link) { + STAILQ_FOREACH(tfwdev, &fc->devices, link) { if (tfwdev->eui.hi > fwdev->eui.hi || (tfwdev->eui.hi == fwdev->eui.hi && tfwdev->eui.lo > fwdev->eui.lo)) @@ -1185,9 +1189,9 @@ loop: pfwdev = tfwdev; } if (pfwdev == NULL) - TAILQ_INSERT_HEAD(&fc->devices, fwdev, link); + STAILQ_INSERT_HEAD(&fc->devices, fwdev, link); else - TAILQ_INSERT_AFTER(&fc->devices, pfwdev, fwdev, link); + STAILQ_INSERT_AFTER(&fc->devices, pfwdev, fwdev, link); device_printf(fc->bdev, "New %s device ID:%08x%08x\n", linkspeed[fwdev->speed], @@ -1479,8 +1483,7 @@ fw_attach_dev(struct firewire_comm *fc) struct firewire_dev_comm *fdc; u_int32_t spec, ver; - for(fwdev = TAILQ_FIRST(&fc->devices); fwdev != NULL; - fwdev = TAILQ_NEXT(fwdev, link)){ + STAILQ_FOREACH(fwdev, &fc->devices, link) { if(fwdev->status == FWDEVINIT){ spec = getcsrdata(fwdev, CSRKEY_SPEC); if(spec == 0) @@ -1567,8 +1570,8 @@ fw_attach_dev(struct firewire_comm *fc) printf("fw_attach_dev: %d pending handlers called\n", i); if (fc->retry_count > 0) { printf("retry_count = %d\n", fc->retry_count); - fc->retry_probe_handle = timeout((timeout_t *)fc->ibr, - (void *)fc, hz*2); + callout_reset(&fc->retry_probe_callout, hz*2, + (void *)fc->ibr, (void *)fc); } return; } diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index e07dfd7e768d..f96e331776e0 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -315,6 +315,8 @@ struct fw_eui64 { ((eui)->hi >> (8*(3-(x)))): \ ((eui)->lo >> (8*(7-(x)))) \ ) & 0xff) +#define FW_EUI64_EQUAL(x, y) \ + ((x).hi == (y).hi && (x).lo == (y).lo) struct fw_asyreq { struct fw_asyreq_t{ diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 568bff79dd43..1c71eca5094e 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -65,7 +65,7 @@ struct fw_device{ #define FWDEVINIT 1 #define FWDEVATTACHED 2 #define FWDEVINVAL 3 - TAILQ_ENTRY(fw_device) link; + STAILQ_ENTRY(fw_device) link; #if 0 LIST_HEAD(, fw_xfer) txqueue; LIST_HEAD(, fw_xfer) rxqueue; @@ -141,7 +141,7 @@ struct firewire_comm{ *arq, *atq, *ars, *ats, *it[FW_MAX_DMACH],*ir[FW_MAX_DMACH]; STAILQ_HEAD(, tlabel) tlabels[0x40]; STAILQ_HEAD(, fw_bind) binds; - TAILQ_HEAD(, fw_device) devices; + STAILQ_HEAD(, fw_device) devices; STAILQ_HEAD(, fw_xfer) pending; volatile u_int32_t *sid_buf; u_int sid_cnt; @@ -152,9 +152,9 @@ struct firewire_comm{ struct fw_topology_map *topology_map; struct fw_speed_map *speed_map; struct callout busprobe_callout; - struct callout_handle bmrhandle; - struct callout_handle timeouthandle; - struct callout_handle retry_probe_handle; + struct callout bmr_callout; + struct callout timeout_callout; + struct callout retry_probe_callout; u_int32_t (*cyctimer) __P((struct firewire_comm *)); void (*ibr) __P((struct firewire_comm *)); u_int32_t (*set_bmr) __P((struct firewire_comm *, u_int32_t)); diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 0a740180ba0e..4652eb653edd 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -841,8 +841,7 @@ error: devinfo->status = 0; /* XXX */ devinfo->eui.hi = sc->fc->eui.hi; devinfo->eui.lo = sc->fc->eui.lo; - for (fwdev = TAILQ_FIRST(&sc->fc->devices); fwdev != NULL; - fwdev = TAILQ_NEXT(fwdev, link)) { + STAILQ_FOREACH(fwdev, &sc->fc->devices, link) { if(len < FW_MAX_DEVLST){ devinfo = &fwdevlst->dev[len++]; devinfo->dst = fwdev->dst; @@ -861,12 +860,9 @@ error: (sc->fc->topology_map->crc_len + 1) * 4); break; case FW_GCROM: - for (fwdev = TAILQ_FIRST(&sc->fc->devices); fwdev != NULL; - fwdev = TAILQ_NEXT(fwdev, link)) { - if (fwdev->eui.hi == crom_buf->eui.hi && - fwdev->eui.lo == crom_buf->eui.lo) + STAILQ_FOREACH(fwdev, &sc->fc->devices, link) + if (FW_EUI64_EQUAL(fwdev->eui, crom_buf->eui)) break; - } if (fwdev == NULL) { err = FWNODE_INVAL; break; diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 2c0a267021b6..2f196dac236c 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -718,8 +718,8 @@ fwohci_timeout(void *arg) struct fwohci_softc *sc; sc = (struct fwohci_softc *)arg; - sc->fc.timeouthandle = timeout(fwohci_timeout, - (void *)sc, FW_XFERTIMEOUT * hz * 10); + callout_reset(&sc->fc.timeout_callout, FW_XFERTIMEOUT * hz * 10, + (void *)fwohci_timeout, (void *)sc); } u_int32_t diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index 1b630573742f..81d5711f14d7 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -669,11 +669,9 @@ END_DEBUG /* Gabage Collection */ for(i = 0 ; i < SBP_NUM_TARGETS ; i ++){ target = &sbp->targets[i]; - for( fwdev = TAILQ_FIRST(&sbp->fd.fc->devices); - fwdev != NULL; fwdev = TAILQ_NEXT(fwdev, link)){ - if(target->fwdev == NULL) break; - if(target->fwdev == fwdev) break; - } + STAILQ_FOREACH(fwdev, &sbp->fd.fc->devices, link) + if (target->fwdev == NULL || target->fwdev == fwdev) + break; if(fwdev == NULL){ /* device has removed in lower driver */ sbp_cam_detach_target(target); @@ -685,8 +683,7 @@ END_DEBUG } } /* traverse device list */ - for( fwdev = TAILQ_FIRST(&sbp->fd.fc->devices); - fwdev != NULL; fwdev = TAILQ_NEXT(fwdev, link)){ + STAILQ_FOREACH(fwdev, &sbp->fd.fc->devices, link) { SBP_DEBUG(0) printf("sbp_post_explore: EUI:%08x%08x ", fwdev->eui.hi, fwdev->eui.lo); @@ -1781,7 +1778,7 @@ sbp_cam_detach_target(struct sbp_target *target) SBP_DEBUG(0) printf("sbp_detach_target %d\n", target->target_id); END_DEBUG - for (i=0; i < target->num_lun; i++) { + for (i = 0; i < target->num_lun; i++) { sdev = &target->luns[i]; if (sdev->status == SBP_DEV_RESET || sdev->status == SBP_DEV_DEAD) -- cgit v1.3 From 5166f1df3910b29cd99efa1f3d43a5bf92dba70a Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Sat, 1 Feb 2003 15:04:33 +0000 Subject: Define new malloc type M_FW and use it. --- sys/dev/firewire/firewire.c | 52 +++++++++++++++++++++------------------- sys/dev/firewire/firewirereg.h | 2 ++ sys/dev/firewire/fwdev.c | 54 +++++++++++++++++++++--------------------- sys/dev/firewire/fwmem.c | 2 +- sys/dev/firewire/fwohci.c | 38 ++++++++++++++--------------- sys/dev/firewire/fwohci_pci.c | 1 + sys/dev/firewire/if_fwe.c | 4 ++-- sys/dev/firewire/sbp.c | 4 ++-- 8 files changed, 81 insertions(+), 76 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 431164384f4c..77c1ce67fee9 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -65,6 +65,8 @@ SYSCTL_NODE(_hw, OID_AUTO, firewire, CTLFLAG_RD, 0, "FireWire Subsystem"); SYSCTL_INT(_hw_firewire, OID_AUTO, try_bmr, CTLFLAG_RW, &try_bmr, 0, "Try to be a bus manager"); +MALLOC_DEFINE(M_FW, "firewire", "FireWire"); + #define FW_MAXASYRTY 4 #define FW_MAXDEVRCNT 4 @@ -434,8 +436,8 @@ firewire_detach( device_t dev ) callout_stop(&sc->fc->bmr_callout); callout_stop(&sc->fc->retry_probe_callout); callout_stop(&sc->fc->busprobe_callout); - free(sc->fc->topology_map, M_DEVBUF); - free(sc->fc->speed_map, M_DEVBUF); + free(sc->fc->topology_map, M_FW); + free(sc->fc->speed_map, M_FW); bus_generic_detach(dev); return(0); } @@ -610,10 +612,10 @@ void fw_init(struct firewire_comm *fc) /* Initialize csr registers */ fc->topology_map = (struct fw_topology_map *)malloc( sizeof(struct fw_topology_map), - M_DEVBUF, M_NOWAIT | M_ZERO); + M_FW, M_NOWAIT | M_ZERO); fc->speed_map = (struct fw_speed_map *)malloc( sizeof(struct fw_speed_map), - M_DEVBUF, M_NOWAIT | M_ZERO); + M_FW, M_NOWAIT | M_ZERO); CSRARC(fc, TOPO_MAP) = 0x3f1 << 16; CSRARC(fc, TOPO_MAP + 4) = 1; CSRARC(fc, SPED_MAP) = 0x3f1 << 16; @@ -626,7 +628,7 @@ void fw_init(struct firewire_comm *fc) SLIST_INIT(&fc->ongocsr); SLIST_INIT(&fc->csrfree); for( i = 0 ; i < FWMAXCSRDIR ; i++){ - csrd = (struct csrdir *) malloc(sizeof(struct csrdir), M_DEVBUF,M_NOWAIT); + csrd = (struct csrdir *) malloc(sizeof(struct csrdir), M_FW,M_NOWAIT); if(csrd == NULL) break; SLIST_INSERT_HEAD(&fc->csrfree, csrd, link); } @@ -657,7 +659,7 @@ void fw_init(struct firewire_comm *fc) xfer = fw_xfer_alloc(); if(xfer == NULL) return; - fwb = (struct fw_bind *)malloc(sizeof (struct fw_bind), M_DEVBUF, M_NOWAIT); + fwb = (struct fw_bind *)malloc(sizeof (struct fw_bind), M_FW, M_NOWAIT); if(fwb == NULL){ fw_xfer_free(xfer); } @@ -772,7 +774,7 @@ fw_tl_free(struct firewire_comm *fc, struct fw_xfer *xfer) tl = STAILQ_NEXT(tl, link)){ if(tl->xfer == xfer){ STAILQ_REMOVE(&fc->tlabels[xfer->tl], tl, tlabel, link); - free(tl, M_DEVBUF); + free(tl, M_FW); splx(s); return; } @@ -811,7 +813,7 @@ fw_xfer_alloc() { struct fw_xfer *xfer; - xfer = malloc(sizeof(struct fw_xfer), M_DEVBUF, M_NOWAIT | M_ZERO); + xfer = malloc(sizeof(struct fw_xfer), M_FW, M_NOWAIT | M_ZERO); if (xfer == NULL) return xfer; @@ -871,15 +873,15 @@ fw_xfer_free( struct fw_xfer* xfer) } } if(xfer->send.buf != NULL){ - free(xfer->send.buf, M_DEVBUF); + free(xfer->send.buf, M_FW); } if(xfer->recv.buf != NULL){ - free(xfer->recv.buf, M_DEVBUF); + free(xfer->recv.buf, M_FW); } if(xfer->fc != NULL){ fw_tl_free(xfer->fc, xfer); } - free(xfer, M_DEVBUF); + free(xfer, M_FW); } static void @@ -914,7 +916,7 @@ fw_phy_config(struct firewire_comm *fc, int root_node, int gap_count) xfer->act.hand = fw_asy_callback_free; xfer->send.buf = malloc(sizeof(u_int32_t), - M_DEVBUF, M_NOWAIT | M_ZERO); + M_FW, M_NOWAIT | M_ZERO); fp = (struct fw_pkt *)xfer->send.buf; fp->mode.ld[1] = 0; if (root_node >= 0) @@ -1066,7 +1068,7 @@ void fw_sidrcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int off) CSRARC(fc, BUS_MGR_ID)); #endif } - free(buf, M_DEVBUF); + free(buf, M_FW); if(fc->irm == ((CSRARC(fc, NODE_IDS) >> 16 ) & 0x3f)){ /* I am BMGR */ fw_bmr(fc); @@ -1101,7 +1103,7 @@ fw_bus_probe(struct firewire_comm *fc) fwdev->rcnt ++; } else { STAILQ_REMOVE(&fc->devices, fwdev, fw_device, link); - free(fwdev, M_DEVBUF); + free(fwdev, M_FW); } } fc->ongonode = 0; @@ -1165,7 +1167,7 @@ loop: fc->ongoeui.hi = 0xffffffff; fc->ongoeui.lo = 0xffffffff; goto loop; } - fwdev = malloc(sizeof(struct fw_device), M_DEVBUF, M_NOWAIT); + fwdev = malloc(sizeof(struct fw_device), M_FW, M_NOWAIT); if(fwdev == NULL) return; fwdev->fc = fc; @@ -1215,7 +1217,7 @@ loop: } xfer->send.len = 16; xfer->spd = 0; - xfer->send.buf = malloc(16, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(16, M_FW, M_NOWAIT); if(xfer->send.buf == NULL){ fw_xfer_free( xfer); return; @@ -1266,7 +1268,7 @@ asyreqq(struct firewire_comm *fc, u_int8_t spd, u_int8_t tl, u_int8_t rt, } xfer->send.len = 16; xfer->spd = spd; /* XXX:min(spd, fc->spd) */ - xfer->send.buf = malloc(16, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(16, M_FW, M_NOWAIT); if(xfer->send.buf == NULL){ fw_xfer_free( xfer); return NULL; @@ -1595,7 +1597,7 @@ fw_get_tlabel(struct firewire_comm *fc, struct fw_xfer *xfer) if(tmptl->xfer->dst == xfer->dst) break; } if(tmptl == NULL) { - tl = malloc(sizeof(struct tlabel),M_DEVBUF,M_NOWAIT); + tl = malloc(sizeof(struct tlabel),M_FW,M_NOWAIT); if (tl == NULL) { splx(s); return (-1); @@ -1710,7 +1712,7 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u return; } xfer->spd = spd; - xfer->send.buf = malloc(16, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(16, M_FW, M_NOWAIT); resfp = (struct fw_pkt *)xfer->send.buf; switch(fp->mode.common.tcode){ case FWTCODE_WREQQ: @@ -1838,7 +1840,7 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u break; } err: - free(buf, M_DEVBUF); + free(buf, M_FW); } /* @@ -1898,7 +1900,7 @@ fw_try_bmr(void *arg) } xfer->send.len = 24; xfer->spd = 0; - xfer->send.buf = malloc(24, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(24, M_FW, M_NOWAIT); if(xfer->send.buf == NULL){ fw_xfer_free( xfer); return; @@ -1956,7 +1958,7 @@ fw_vmaccess(struct fw_xfer *xfer){ switch(rfp->mode.hdr.tcode){ /* XXX need fix for 64bit arch */ case FWTCODE_WREQB: - xfer->send.buf = malloc(12, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(12, M_FW, M_NOWAIT); xfer->send.len = 12; sfp = (struct fw_pkt *)xfer->send.buf; bcopy(rfp->mode.wreqb.payload, @@ -1965,14 +1967,14 @@ fw_vmaccess(struct fw_xfer *xfer){ sfp->mode.wres.rtcode = 0; break; case FWTCODE_WREQQ: - xfer->send.buf = malloc(12, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(12, M_FW, M_NOWAIT); xfer->send.len = 12; sfp->mode.wres.tcode = FWTCODE_WRES; *((u_int32_t *)(ntohl(rfp->mode.wreqb.dest_lo))) = rfp->mode.wreqq.data; sfp->mode.wres.rtcode = 0; break; case FWTCODE_RREQB: - xfer->send.buf = malloc(16 + rfp->mode.rreqb.len, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(16 + rfp->mode.rreqb.len, M_FW, M_NOWAIT); xfer->send.len = 16 + ntohs(rfp->mode.rreqb.len); sfp = (struct fw_pkt *)xfer->send.buf; bcopy((caddr_t)ntohl(rfp->mode.rreqb.dest_lo), @@ -1983,7 +1985,7 @@ fw_vmaccess(struct fw_xfer *xfer){ sfp->mode.rresb.extcode = 0; break; case FWTCODE_RREQQ: - xfer->send.buf = malloc(16, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(16, M_FW, M_NOWAIT); xfer->send.len = 16; sfp = (struct fw_pkt *)xfer->send.buf; sfp->mode.rresq.data = *(u_int32_t *)(ntohl(rfp->mode.rreqq.dest_lo)); diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 1c71eca5094e..7eb9e024e99f 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -362,3 +362,5 @@ extern devclass_t firewire_devclass; #undef vtophys #define vtophys(va) alpha_XXX_dmamap((vm_offset_t)(va)) #endif /* __alpha__ */ + +MALLOC_DECLARE(M_FW); diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 4652eb653edd..1ef9ec4460bb 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -140,38 +140,38 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) struct fw_dvbuf *dvbuf; if((dvbuf = sc->fc->it[sub]->dvproc) != NULL){ - free(dvbuf->buf, M_DEVBUF); + free(dvbuf->buf, M_FW); sc->fc->it[sub]->dvproc = NULL; } if((dvbuf = sc->fc->it[sub]->dvdma) != NULL){ - free(dvbuf->buf, M_DEVBUF); + free(dvbuf->buf, M_FW); sc->fc->it[sub]->dvdma = NULL; } while((dvbuf = STAILQ_FIRST(&sc->fc->it[sub]->dvvalid)) != NULL){ STAILQ_REMOVE_HEAD(&sc->fc->it[sub]->dvvalid, link); - free(dvbuf->buf, M_DEVBUF); + free(dvbuf->buf, M_FW); } while((dvbuf = STAILQ_FIRST(&sc->fc->it[sub]->dvfree)) != NULL){ STAILQ_REMOVE_HEAD(&sc->fc->it[sub]->dvfree, link); - free(dvbuf->buf, M_DEVBUF); + free(dvbuf->buf, M_FW); } - free(sc->fc->it[sub]->dvbuf, M_DEVBUF); + free(sc->fc->it[sub]->dvbuf, M_FW); sc->fc->it[sub]->dvbuf = NULL; } #endif if(sc->fc->ir[sub]->flag & FWXFERQ_EXTBUF){ - free(sc->fc->ir[sub]->buf, M_DEVBUF); + free(sc->fc->ir[sub]->buf, M_FW); sc->fc->ir[sub]->buf = NULL; - free(sc->fc->ir[sub]->bulkxfer, M_DEVBUF); + free(sc->fc->ir[sub]->bulkxfer, M_FW); sc->fc->ir[sub]->bulkxfer = NULL; sc->fc->ir[sub]->flag &= ~FWXFERQ_EXTBUF; sc->fc->ir[sub]->psize = PAGE_SIZE; sc->fc->ir[sub]->maxq = FWMAXQUEUE; } if(sc->fc->it[sub]->flag & FWXFERQ_EXTBUF){ - free(sc->fc->it[sub]->buf, M_DEVBUF); + free(sc->fc->it[sub]->buf, M_FW); sc->fc->it[sub]->buf = NULL; - free(sc->fc->it[sub]->bulkxfer, M_DEVBUF); + free(sc->fc->it[sub]->bulkxfer, M_FW); sc->fc->it[sub]->bulkxfer = NULL; #ifdef FWXFERQ_DV sc->fc->it[sub]->dvbuf = NULL; @@ -199,7 +199,7 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) fwb = STAILQ_FIRST(&sc->fc->ir[sub]->binds)){ STAILQ_REMOVE(&sc->fc->binds, fwb, fw_bind, fclist); STAILQ_REMOVE_HEAD(&sc->fc->ir[sub]->binds, chlist); - free(fwb, M_DEVBUF); + free(fwb, M_FW); } sc->fc->ir[sub]->flag &= ~FWXFERQ_MODEMASK; sc->fc->it[sub]->flag &= ~FWXFERQ_MODEMASK; @@ -460,7 +460,7 @@ dvloop: err = ENOMEM; return err; } - xfer->send.buf = malloc(uio->uio_resid, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(uio->uio_resid, M_FW, M_NOWAIT); if(xfer->send.buf == NULL){ fw_xfer_free( xfer); err = ENOBUFS; @@ -569,7 +569,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) #ifdef FWXFERQ_DV case FW_SSTDV: ibufreq = (struct fw_isobufreq *) - malloc(sizeof(struct fw_isobufreq), M_DEVBUF, M_NOWAIT); + malloc(sizeof(struct fw_isobufreq), M_FW, M_NOWAIT); if(ibufreq == NULL){ err = ENOMEM; break; @@ -590,7 +590,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) err = fw_ioctl(dev, FW_SSTBUF, (caddr_t)ibufreq, flag, td); sc->fc->it[sub]->dvpacket = FWDVPACKET; - free(ibufreq, M_DEVBUF); + free(ibufreq, M_FW); /* reserve a buffer space */ #define NDVCHUNK 8 sc->fc->it[sub]->dvproc = NULL; @@ -598,13 +598,13 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) sc->fc->it[sub]->flag |= FWXFERQ_DV; /* XXX check malloc failure */ sc->fc->it[sub]->dvbuf - = (struct fw_dvbuf *)malloc(sizeof(struct fw_dvbuf) * NDVCHUNK, M_DEVBUF, M_NOWAIT); + = (struct fw_dvbuf *)malloc(sizeof(struct fw_dvbuf) * NDVCHUNK, M_FW, M_NOWAIT); STAILQ_INIT(&sc->fc->it[sub]->dvvalid); STAILQ_INIT(&sc->fc->it[sub]->dvfree); for( i = 0 ; i < NDVCHUNK ; i++){ /* XXX check malloc failure */ sc->fc->it[sub]->dvbuf[i].buf - = malloc(FWDVPMAX * sc->fc->it[sub]->dvpacket, M_DEVBUF, M_NOWAIT); + = malloc(FWDVPMAX * sc->fc->it[sub]->dvpacket, M_FW, M_NOWAIT); STAILQ_INSERT_TAIL(&sc->fc->it[sub]->dvfree, &sc->fc->it[sub]->dvbuf[i], link); } @@ -631,12 +631,12 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) return(EINVAL); } ir->bulkxfer - = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->rx.nchunk, M_DEVBUF, M_NOWAIT); + = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->rx.nchunk, M_FW, M_NOWAIT); if(ir->bulkxfer == NULL){ return(ENOMEM); } it->bulkxfer - = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->tx.nchunk, M_DEVBUF, M_NOWAIT); + = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->tx.nchunk, M_FW, M_NOWAIT); if(it->bulkxfer == NULL){ return(ENOMEM); } @@ -645,10 +645,10 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) /* XXX psize must be 2^n and less or equal to PAGE_SIZE */ * ((ibufreq->rx.psize + 3) &~3), - M_DEVBUF, M_NOWAIT); + M_FW, M_NOWAIT); if(ir->buf == NULL){ - free(ir->bulkxfer, M_DEVBUF); - free(it->bulkxfer, M_DEVBUF); + free(ir->bulkxfer, M_FW); + free(it->bulkxfer, M_FW); ir->bulkxfer = NULL; it->bulkxfer = NULL; it->buf = NULL; @@ -659,11 +659,11 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) /* XXX psize must be 2^n and less or equal to PAGE_SIZE */ * ((ibufreq->tx.psize + 3) &~3), - M_DEVBUF, M_NOWAIT); + M_FW, M_NOWAIT); if(it->buf == NULL){ - free(ir->bulkxfer, M_DEVBUF); - free(it->bulkxfer, M_DEVBUF); - free(ir->buf, M_DEVBUF); + free(ir->bulkxfer, M_FW); + free(it->bulkxfer, M_FW); + free(ir->buf, M_FW); ir->bulkxfer = NULL; it->bulkxfer = NULL; it->buf = NULL; @@ -765,7 +765,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) } xfer->spd = asyreq->req.sped; xfer->send.len = asyreq->req.len; - xfer->send.buf = malloc(xfer->send.len, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(xfer->send.len, M_FW, M_NOWAIT); if(xfer->send.buf == NULL){ return ENOMEM; } @@ -801,7 +801,7 @@ error: } STAILQ_REMOVE(&sc->fc->binds, fwb, fw_bind, fclist); STAILQ_REMOVE(&sc->fc->ir[sub]->binds, fwb, fw_bind, chlist); - free(fwb, M_DEVBUF); + free(fwb, M_FW); break; case FW_SBINDADDR: if(bindreq->len <= 0 ){ @@ -812,7 +812,7 @@ error: err = EINVAL; break; } - fwb = (struct fw_bind *)malloc(sizeof (struct fw_bind), M_DEVBUF, M_NOWAIT); + fwb = (struct fw_bind *)malloc(sizeof (struct fw_bind), M_FW, M_NOWAIT); if(fwb == NULL){ err = ENOMEM; break; diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index 478bcbf33211..2f59253d5c87 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -92,7 +92,7 @@ fwmem_xfer_req( else xfer->spd = min(spd, fwdev->speed); xfer->send.len = len; - xfer->send.buf = malloc(len, M_DEVBUF, M_NOWAIT | M_ZERO); + xfer->send.buf = malloc(len, M_FW, M_NOWAIT | M_ZERO); if (xfer->send.buf == NULL) { fw_xfer_free(xfer); diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 2f196dac236c..3889d2e90be6 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -636,7 +636,7 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) sc->fc.tcode = tinfo; - sc->cromptr = (u_int32_t *) malloc(CROMSIZE * 2, M_DEVBUF, M_NOWAIT); + sc->cromptr = (u_int32_t *) malloc(CROMSIZE * 2, M_FW, M_NOWAIT); if(sc->cromptr == NULL){ device_printf(dev, "cromptr alloc failed."); @@ -657,7 +657,7 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) /* SID recieve buffer must allign 2^11 */ #define OHCI_SIDSIZE (1 << 11) - sc->fc.sid_buf = (u_int32_t *) malloc(OHCI_SIDSIZE, M_DEVBUF, M_NOWAIT); + sc->fc.sid_buf = (u_int32_t *) malloc(OHCI_SIDSIZE, M_FW, M_NOWAIT); if (sc->fc.sid_buf == NULL) { device_printf(dev, "sid_buf alloc failed.\n"); return ENOMEM; @@ -735,9 +735,9 @@ fwohci_detach(struct fwohci_softc *sc, device_t dev) int i; if (sc->fc.sid_buf != NULL) - free((void *)(uintptr_t)sc->fc.sid_buf, M_DEVBUF); + free((void *)(uintptr_t)sc->fc.sid_buf, M_FW); if (sc->cromptr != NULL) - free((void *)sc->cromptr, M_DEVBUF); + free((void *)sc->cromptr, M_FW); fwohci_db_free(&sc->arrq); fwohci_db_free(&sc->arrs); @@ -1117,7 +1117,7 @@ fwohci_db_free(struct fwohci_dbch *dbch) idb < dbch->ndb; db_tr = STAILQ_NEXT(db_tr, link), idb++){ if (db_tr->buf != NULL) { - free(db_tr->buf, M_DEVBUF); + free(db_tr->buf, M_FW); db_tr->buf = NULL; } } @@ -1125,8 +1125,8 @@ fwohci_db_free(struct fwohci_dbch *dbch) dbch->ndb = 0; db_tr = STAILQ_FIRST(&dbch->db_trq); for (i = 0; i < dbch->npages; i++) - free(dbch->pages[i], M_DEVBUF); - free(db_tr, M_DEVBUF); + free(dbch->pages[i], M_FW); + free(db_tr, M_FW); STAILQ_INIT(&dbch->db_trq); dbch->flags &= ~FWOHCI_DBCH_INIT; } @@ -1146,7 +1146,7 @@ fwohci_db_init(struct fwohci_dbch *dbch) STAILQ_INIT(&dbch->db_trq); db_tr = (struct fwohcidb_tr *) malloc(sizeof(struct fwohcidb_tr) * dbch->ndb, - M_DEVBUF, M_NOWAIT | M_ZERO); + M_FW, M_NOWAIT | M_ZERO); if(db_tr == NULL){ printf("fwohci_db_init: malloc(1) failed\n"); return; @@ -1163,13 +1163,13 @@ fwohci_db_init(struct fwohci_dbch *dbch) return; } for (i = 0; i < dbch->npages; i++) { - dbch->pages[i] = malloc(PAGE_SIZE, M_DEVBUF, + dbch->pages[i] = malloc(PAGE_SIZE, M_FW, M_NOWAIT | M_ZERO); if (dbch->pages[i] == NULL) { printf("fwohci_db_init: malloc(2) failed\n"); for (j = 0; j < i; j ++) - free(dbch->pages[j], M_DEVBUF); - free(db_tr, M_DEVBUF); + free(dbch->pages[j], M_FW); + free(db_tr, M_FW); return; } } @@ -1231,7 +1231,7 @@ fwohci_irx_disable(struct firewire_comm *fc, int dmach) /* XXX we cannot free buffers until the DMA really stops */ tsleep((void *)&dummy, FWPRI, "fwirxd", hz); if(sc->ir[dmach].dummy != NULL){ - free(sc->ir[dmach].dummy, M_DEVBUF); + free(sc->ir[dmach].dummy, M_FW); } sc->ir[dmach].dummy = NULL; fwohci_db_free(&sc->ir[dmach]); @@ -1594,7 +1594,7 @@ fwohci_irxbuf_enable(struct firewire_comm *fc, int dmach) ir->queued = 0; dbch->ndb = ir->bnpacket * ir->bnchunk; dbch->dummy = malloc(sizeof(u_int32_t) * dbch->ndb, - M_DEVBUF, M_NOWAIT); + M_FW, M_NOWAIT); if (dbch->dummy == NULL) { err = ENOMEM; return err; @@ -1891,7 +1891,7 @@ fwohci_intr_body(struct fwohci_softc *sc, u_int32_t stat, int count) goto sidout; } plen -= 4; /* chop control info */ - buf = malloc(OHCI_SIDSIZE, M_DEVBUF, M_NOWAIT); + buf = malloc(OHCI_SIDSIZE, M_FW, M_NOWAIT); if(buf == NULL) goto sidout; bcopy((void *)(uintptr_t)(volatile void *)(fc->sid_buf + 1), buf, plen); @@ -2419,7 +2419,7 @@ fwohci_add_rx_buf(struct fwohcidb_tr *db_tr, unsigned short size, int mode, int dsiz[2]; if(buf == 0){ - buf = malloc(size, M_DEVBUF, M_NOWAIT); + buf = malloc(size, M_FW, M_NOWAIT); if(buf == NULL) return 0; db_tr->buf = buf; db_tr->dbcnt = 1; @@ -2528,7 +2528,7 @@ device_printf(sc->fc.dev, "%04x %2x 0x%08x 0x%08x 0x%08x 0x%08x\n", len, fw_rcv(&sc->fc, buf, plen - sizeof(u_int32_t), dmach, sizeof(u_int32_t), spd); break; default: - free(buf, M_DEVBUF); + free(buf, M_FW); device_printf(sc->fc.dev, "Isochronous receive err %02x\n", stat); break; } @@ -2697,10 +2697,10 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) } if(resCount > 0 || len > 0){ buf = malloc( dbch->xferq.psize, - M_DEVBUF, M_NOWAIT); + M_FW, M_NOWAIT); if(buf == NULL){ printf("cannot malloc!\n"); - free(db_tr->buf, M_DEVBUF); + free(db_tr->buf, M_FW); goto out; } bcopy(ld, buf, plen); @@ -2750,7 +2750,7 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) fw_rcv(&sc->fc, buf, plen - sizeof(struct fwohci_trailer), 0, 0, spd); break; case FWOHCIEV_BUSRST: - free(buf, M_DEVBUF); + free(buf, M_FW); if (sc->fc.status != FWBUSRESET) printf("got BUSRST packet!?\n"); break; diff --git a/sys/dev/firewire/fwohci_pci.c b/sys/dev/firewire/fwohci_pci.c index 7ace8b7b619d..45d264679351 100644 --- a/sys/dev/firewire/fwohci_pci.c +++ b/sys/dev/firewire/fwohci_pci.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c index 65658075fbae..1b7885db43fe 100644 --- a/sys/dev/firewire/if_fwe.c +++ b/sys/dev/firewire/if_fwe.c @@ -500,7 +500,7 @@ static void fwe_free(void *buf, void *args) { FWEDEBUG("fwe_free:\n"); - free(buf, M_DEVBUF); + free(buf, M_FW); } #else @@ -512,7 +512,7 @@ fwe_free(caddr_t buf, u_int size) p = (int *)buf; (*p) --; if (*p < 1) - free(buf, M_DEVBUF); + free(buf, M_FW); } static void diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index 81d5711f14d7..e37727b7aa87 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -1053,9 +1053,9 @@ sbp_write_cmd(struct sbp_dev *sdev, int tcode, int offset) else xfer->send.len = 24; - xfer->send.buf = malloc(xfer->send.len, M_DEVBUF, M_NOWAIT); + xfer->send.buf = malloc(xfer->send.len, M_FW, M_NOWAIT); if(xfer->send.buf == NULL){ - fw_xfer_free( xfer); + fw_xfer_free(xfer); return NULL; } -- cgit v1.3 From 48249fe0c8fa01065bd10c670795af4db458846c Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Mon, 3 Feb 2003 07:33:31 +0000 Subject: - Take malloc type as an argument in fw_xfer_alloc(). - Fix overwrite problem of freed buffers. It was rare but could happen when fwohci_arcv() is called before fwohci_txd() is called for the transcation. - Drain AT queues and pend AR queues on SID receive rather than BUS reset to make sure DMA actually stops. - Do agent reset in sbp_timeout(). --- sys/dev/firewire/firewire.c | 24 +++++++++++++----------- sys/dev/firewire/firewirereg.h | 4 +++- sys/dev/firewire/fwdev.c | 6 +++--- sys/dev/firewire/fwmem.c | 2 +- sys/dev/firewire/fwohci.c | 27 +++++++++++++++++---------- sys/dev/firewire/if_fwe.c | 2 +- sys/dev/firewire/sbp.c | 28 ++++++++++++++-------------- 7 files changed, 52 insertions(+), 41 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 77c1ce67fee9..60cc4873ee50 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -66,6 +66,7 @@ SYSCTL_INT(_hw_firewire, OID_AUTO, try_bmr, CTLFLAG_RW, &try_bmr, 0, "Try to be a bus manager"); MALLOC_DEFINE(M_FW, "firewire", "FireWire"); +MALLOC_DEFINE(M_FWXFER, "fw_xfer", "XFER/FireWire"); #define FW_MAXASYRTY 4 #define FW_MAXDEVRCNT 4 @@ -809,16 +810,17 @@ fw_tl2xfer(struct firewire_comm *fc, int node, int tlabel) * To allocate IEEE1394 XFER structure. */ struct fw_xfer * -fw_xfer_alloc() +fw_xfer_alloc(struct malloc_type *type) { struct fw_xfer *xfer; - xfer = malloc(sizeof(struct fw_xfer), M_FW, M_NOWAIT | M_ZERO); + xfer = malloc(sizeof(struct fw_xfer), type, M_NOWAIT | M_ZERO); if (xfer == NULL) return xfer; xfer->time = time_second; xfer->sub = -1; + xfer->malloc = type; return xfer; } @@ -881,7 +883,7 @@ fw_xfer_free( struct fw_xfer* xfer) if(xfer->fc != NULL){ fw_tl_free(xfer->fc, xfer); } - free(xfer, M_FW); + free(xfer, xfer->malloc); } static void @@ -908,7 +910,7 @@ fw_phy_config(struct firewire_comm *fc, int root_node, int gap_count) #if 0 DELAY(100000); #endif - xfer = fw_xfer_alloc(); + xfer = fw_xfer_alloc(M_FWXFER); xfer->send.len = 12; xfer->send.off = 0; xfer->fc = fc; @@ -1211,7 +1213,7 @@ loop: fw_bus_explore_callback); if(xfer == NULL) goto done; #else - xfer = fw_xfer_alloc(); + xfer = fw_xfer_alloc(M_FWXFER); if(xfer == NULL){ goto done; } @@ -1262,7 +1264,7 @@ asyreqq(struct firewire_comm *fc, u_int8_t spd, u_int8_t tl, u_int8_t rt, struct fw_pkt *fp; int err; - xfer = fw_xfer_alloc(); + xfer = fw_xfer_alloc(M_FWXFER); if(xfer == NULL){ return NULL; } @@ -1707,7 +1709,7 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u printf("fw_rcv: cannot response(bus reset)!\n"); goto err; } - xfer = fw_xfer_alloc(); + xfer = fw_xfer_alloc(M_FWXFER); if(xfer == NULL){ return; } @@ -1751,7 +1753,7 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u } switch(bind->xfer->act_type){ case FWACT_XFER: - xfer = fw_xfer_alloc(); + xfer = fw_xfer_alloc(M_FWXFER); if(xfer == NULL) goto err; xfer->fc = bind->xfer->fc; xfer->sc = bind->xfer->sc; @@ -1775,7 +1777,7 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u fc->ir[bind->xfer->sub]->queued); goto err; } - xfer = fw_xfer_alloc(); + xfer = fw_xfer_alloc(M_FWXFER); if(xfer == NULL) goto err; xfer->recv.buf = buf; xfer->recv.len = len; @@ -1808,7 +1810,7 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u printf("receive queue is full\n"); goto err; } - xfer = fw_xfer_alloc(); + xfer = fw_xfer_alloc(M_FWXFER); if(xfer == NULL) goto err; xfer->recv.buf = buf; xfer->recv.len = len; @@ -1894,7 +1896,7 @@ fw_try_bmr(void *arg) struct fw_pkt *fp; int err = 0; - xfer = fw_xfer_alloc(); + xfer = fw_xfer_alloc(M_FWXFER); if(xfer == NULL){ return; } diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 7eb9e024e99f..108f967ec231 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -298,11 +298,12 @@ struct fw_xfer{ } send, recv; struct mbuf *mbuf; STAILQ_ENTRY(fw_xfer) link; + struct malloc_type *malloc; }; void fw_sidrcv __P((struct firewire_comm *, caddr_t, u_int, u_int)); void fw_rcv __P((struct firewire_comm *, caddr_t, u_int, u_int, u_int, u_int)); void fw_xfer_free __P(( struct fw_xfer*)); -struct fw_xfer *fw_xfer_alloc __P((void)); +struct fw_xfer *fw_xfer_alloc __P((struct malloc_type *)); void fw_init __P((struct firewire_comm *)); int fw_tbuf_update __P((struct firewire_comm *, int, int)); int fw_rbuf_update __P((struct firewire_comm *, int, int)); @@ -364,3 +365,4 @@ extern devclass_t firewire_devclass; #endif /* __alpha__ */ MALLOC_DECLARE(M_FW); +MALLOC_DECLARE(M_FWXFER); diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 1ef9ec4460bb..13c84a3849fe 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -455,7 +455,7 @@ dvloop: } #endif if(xferq != NULL){ - xfer = fw_xfer_alloc(); + xfer = fw_xfer_alloc(M_FWXFER); if(xfer == NULL){ err = ENOMEM; return err; @@ -734,7 +734,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) ibufreq->tx.psize = sc->fc->it[sub]->psize; break; case FW_ASYREQ: - xfer = fw_xfer_alloc(); + xfer = fw_xfer_alloc(M_FWXFER); if(xfer == NULL){ err = ENOMEM; return err; @@ -821,7 +821,7 @@ error: fwb->start_lo = bindreq->start.lo; fwb->addrlen = bindreq->len; - xfer = fw_xfer_alloc(); + xfer = fw_xfer_alloc(M_FWXFER); if(xfer == NULL){ err = ENOMEM; return err; diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index 2f59253d5c87..b755dd2bb62b 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -81,7 +81,7 @@ fwmem_xfer_req( { struct fw_xfer *xfer; - xfer = fw_xfer_alloc(); + xfer = fw_xfer_alloc(M_FWXFER); if (xfer == NULL) return NULL; diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 3889d2e90be6..d3e100019a2d 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -1051,8 +1051,8 @@ fwohci_txd(struct fwohci_softc *sc, struct fwohci_dbch *dbch) break; } } - dbch->xferq.queued --; } + dbch->xferq.queued --; tr->xfer = NULL; packets ++; @@ -1071,35 +1071,35 @@ out: static void fwohci_drain(struct firewire_comm *fc, struct fw_xfer *xfer, struct fwohci_dbch *dbch) { - int i, s; + int i, s, found=0; struct fwohcidb_tr *tr; if(xfer->state != FWXF_START) return; s = splfw(); tr = dbch->bottom; - for( i = 0 ; i <= dbch->xferq.queued ; i ++){ + for (i = 0; i < dbch->xferq.queued; i ++) { if(tr->xfer == xfer){ - s = splfw(); tr->xfer = NULL; +#if 0 dbch->xferq.queued --; -#if 1 /* XXX */ if (tr == dbch->bottom) dbch->bottom = STAILQ_NEXT(tr, link); -#endif if (dbch->flags & FWOHCI_DBCH_FULL) { printf("fwohci_drain: make slot\n"); dbch->flags &= ~FWOHCI_DBCH_FULL; fwohci_start((struct fwohci_softc *)fc, dbch); } - - splx(s); +#endif + found ++; break; } tr = STAILQ_NEXT(tr, link); } splx(s); + if (!found) + device_printf(fc->dev, "fwochi_drain: xfer not found\n"); return; } @@ -1786,7 +1786,7 @@ fwohci_intr_body(struct fwohci_softc *sc, u_int32_t stat, int count) #ifndef ACK_ALL OWRITE(sc, FWOHCI_INTSTATCLR, OHCI_INT_PHY_BUS_R); #endif -#if 1 +#if 0 /* pending all pre-bus_reset packets */ fwohci_txd(sc, &sc->atrq); fwohci_txd(sc, &sc->atrs); @@ -1895,6 +1895,13 @@ fwohci_intr_body(struct fwohci_softc *sc, u_int32_t stat, int count) if(buf == NULL) goto sidout; bcopy((void *)(uintptr_t)(volatile void *)(fc->sid_buf + 1), buf, plen); +#if 1 + /* pending all pre-bus_reset packets */ + fwohci_txd(sc, &sc->atrq); + fwohci_txd(sc, &sc->atrs); + fwohci_arcv(sc, &sc->arrs, -1); + fwohci_arcv(sc, &sc->arrq, -1); +#endif fw_sidrcv(fc, buf, plen, 0); } sidout: @@ -2740,7 +2747,7 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) stat &= 0x1f; switch(stat){ case FWOHCIEV_ACKPEND: -#if 0 +#if 1 printf("fwohci_arcv: ack pending..\n"); #endif /* fall through */ diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c index 1b7885db43fe..3f428df45fde 100644 --- a/sys/dev/firewire/if_fwe.c +++ b/sys/dev/firewire/if_fwe.c @@ -450,7 +450,7 @@ fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp) IF_DEQUEUE(&ifp->if_snd, m); if (m == NULL) break; - xfer = fw_xfer_alloc(); + xfer = fw_xfer_alloc(M_FWXFER); if (xfer == NULL) { return; } diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index e37727b7aa87..096698d029d4 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -767,7 +767,7 @@ sbp_cam_callback(struct cam_periph *periph, union ccb *ccb) { struct sbp_dev *sdev; sdev = (struct sbp_dev *) ccb->ccb_h.ccb_sdev_ptr; -SBP_DEBUG(1) +SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); printf("sbp_cam_callback\n"); END_DEBUG @@ -800,7 +800,7 @@ sbp_ping_unit_callback(struct cam_periph *periph, union ccb *ccb) { struct sbp_dev *sdev; sdev = (struct sbp_dev *) ccb->ccb_h.ccb_sdev_ptr; -SBP_DEBUG(1) +SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); printf("sbp_ping_unit_callback\n"); END_DEBUG @@ -841,7 +841,7 @@ sbp_ping_unit(struct sbp_dev *sdev) inq_buf = (struct scsi_inquiry_data *) malloc(sizeof(*inq_buf), M_SBP, 0); -SBP_DEBUG(1) +SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); printf("sbp_ping_unit\n"); END_DEBUG @@ -1044,7 +1044,7 @@ sbp_write_cmd(struct sbp_dev *sdev, int tcode, int offset) struct fw_xfer *xfer; struct fw_pkt *fp; - xfer = fw_xfer_alloc(); + xfer = fw_xfer_alloc(M_SBP); if(xfer == NULL){ return NULL; } @@ -1444,8 +1444,6 @@ END_DEBUG if (sbp_status->dead) { if (sdev->path) xpt_freeze_devq(sdev->path, 1); - sbp_show_sdev_info(sdev, 2); - printf("reset agent\n"); sbp_agent_reset(sdev, 0); } @@ -1675,7 +1673,7 @@ END_DEBUG return (ENXIO); } - xfer = fw_xfer_alloc(); + xfer = fw_xfer_alloc(M_SBP); xfer->act.hand = sbp_recv; xfer->act_type = FWACT_XFER; #if NEED_RESPONSE @@ -1714,11 +1712,8 @@ END_DEBUG continue; for (j = 0; j < target->num_lun; j++) { sdev = &target->luns[j]; - if (sdev->status == SBP_DEV_ATTACHED) { - sbp_show_sdev_info(sdev, 2); - printf("logout\n"); + if (sdev->status == SBP_DEV_ATTACHED) sbp_mgm_orb(sdev, ORB_FUN_LGO); - } } } return 0; @@ -1797,16 +1792,21 @@ sbp_timeout(void *arg) { struct sbp_ocb *ocb = (struct sbp_ocb *)arg; struct sbp_dev *sdev = ocb->sdev; +#if 0 int s; +#endif sbp_show_sdev_info(sdev, 2); printf("request timeout ... requeue\n"); - /* XXX need reset? */ - + /* XXX need bus reset? */ +#if 0 s = splfw(); sbp_abort_all_ocbs(sdev, CAM_CMD_TIMEOUT); splx(s); +#else + sbp_agent_reset(sdev, 0); +#endif return; } @@ -2307,7 +2307,7 @@ sbp_abort_ocb(struct sbp_ocb *ocb, int status) struct sbp_dev *sdev; sdev = ocb->sdev; -SBP_DEBUG(0) +SBP_DEBUG(1) sbp_show_sdev_info(sdev, 2); printf("sbp_abort_ocb 0x%x\n", status); if (ocb->ccb != NULL) -- cgit v1.3 From beb19fc5dd8647a72bf5d1514cd1986a3ff26751 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Mon, 3 Feb 2003 09:41:42 +0000 Subject: Remove unnecessary M_NOWAIT. --- sys/dev/firewire/fwdev.c | 8 ++++---- sys/dev/firewire/fwohci.c | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 13c84a3849fe..7b7bc710ae45 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -631,12 +631,12 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) return(EINVAL); } ir->bulkxfer - = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->rx.nchunk, M_FW, M_NOWAIT); + = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->rx.nchunk, M_FW, 0); if(ir->bulkxfer == NULL){ return(ENOMEM); } it->bulkxfer - = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->tx.nchunk, M_FW, M_NOWAIT); + = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->tx.nchunk, M_FW, 0); if(it->bulkxfer == NULL){ return(ENOMEM); } @@ -645,7 +645,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) /* XXX psize must be 2^n and less or equal to PAGE_SIZE */ * ((ibufreq->rx.psize + 3) &~3), - M_FW, M_NOWAIT); + M_FW, 0); if(ir->buf == NULL){ free(ir->bulkxfer, M_FW); free(it->bulkxfer, M_FW); @@ -659,7 +659,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) /* XXX psize must be 2^n and less or equal to PAGE_SIZE */ * ((ibufreq->tx.psize + 3) &~3), - M_FW, M_NOWAIT); + M_FW, 0); if(it->buf == NULL){ free(ir->bulkxfer, M_FW); free(it->bulkxfer, M_FW); diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index d3e100019a2d..82dbdf5c6fe9 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -1146,7 +1146,7 @@ fwohci_db_init(struct fwohci_dbch *dbch) STAILQ_INIT(&dbch->db_trq); db_tr = (struct fwohcidb_tr *) malloc(sizeof(struct fwohcidb_tr) * dbch->ndb, - M_FW, M_NOWAIT | M_ZERO); + M_FW, M_ZERO); if(db_tr == NULL){ printf("fwohci_db_init: malloc(1) failed\n"); return; @@ -1163,8 +1163,7 @@ fwohci_db_init(struct fwohci_dbch *dbch) return; } for (i = 0; i < dbch->npages; i++) { - dbch->pages[i] = malloc(PAGE_SIZE, M_FW, - M_NOWAIT | M_ZERO); + dbch->pages[i] = malloc(PAGE_SIZE, M_FW, M_ZERO); if (dbch->pages[i] == NULL) { printf("fwohci_db_init: malloc(2) failed\n"); for (j = 0; j < i; j ++) @@ -1594,7 +1593,7 @@ fwohci_irxbuf_enable(struct firewire_comm *fc, int dmach) ir->queued = 0; dbch->ndb = ir->bnpacket * ir->bnchunk; dbch->dummy = malloc(sizeof(u_int32_t) * dbch->ndb, - M_FW, M_NOWAIT); + M_FW, 0); if (dbch->dummy == NULL) { err = ENOMEM; return err; -- cgit v1.3 From 233b1b978b878820081527d727b509834caf2a7a Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Sun, 9 Feb 2003 10:14:22 +0000 Subject: Add new ioctl to specify target EUI64 for fwmem. --- sys/dev/firewire/firewire.c | 4 ++-- sys/dev/firewire/firewire.h | 3 +++ sys/dev/firewire/firewirereg.h | 2 +- sys/dev/firewire/fwdev.c | 2 +- sys/dev/firewire/fwmem.c | 34 ++++++++++++++++++++++++++-------- 5 files changed, 33 insertions(+), 12 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index fba88e2e2ebd..861006f95153 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -150,14 +150,14 @@ fw_noderesolve_nodeid(struct firewire_comm *fc, int dst) * Lookup fwdev by EUI64. */ struct fw_device * -fw_noderesolve_eui64(struct firewire_comm *fc, struct fw_eui64 eui) +fw_noderesolve_eui64(struct firewire_comm *fc, struct fw_eui64 *eui) { struct fw_device *fwdev; int s; s = splfw(); STAILQ_FOREACH(fwdev, &fc->devices, link) - if (FW_EUI64_EQUAL(fwdev->eui, eui)) + if (FW_EUI64_EQUAL(fwdev->eui, *eui)) break; splx(s); diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index f96e331776e0..b10aa6c210e8 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -471,6 +471,9 @@ struct fw_crom_buf { #define FW_GTPMAP _IOR('S', 5, struct fw_topology_map) #define FW_GCROM _IOWR('S', 7, struct fw_crom_buf) +#define FW_SDEUI64 _IOW('S', 20, struct fw_eui64) +#define FW_GDEUI64 _IOR('S', 21, struct fw_eui64) + #define FWOHCI_RDREG _IOWR('S', 80, struct fw_reg_req_t) #define FWOHCI_WRREG _IOWR('S', 81, struct fw_reg_req_t) diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 64b7cca063f6..4631e0037047 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -324,7 +324,7 @@ void fw_xfer_timeout __P((void *)); void fw_xfer_done __P((struct fw_xfer *)); void fw_asy_callback __P((struct fw_xfer *)); struct fw_device *fw_noderesolve_nodeid __P((struct firewire_comm *, int)); -struct fw_device *fw_noderesolve_eui64 __P((struct firewire_comm *, struct fw_eui64)); +struct fw_device *fw_noderesolve_eui64 __P((struct firewire_comm *, struct fw_eui64 *)); struct fw_bind *fw_bindlookup __P((struct firewire_comm *, u_int32_t, u_int32_t)); diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 7b7bc710ae45..31b3a2c2f18b 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -746,7 +746,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) break; case FWASREQEUI: fwdev = fw_noderesolve_eui64(sc->fc, - asyreq->req.dst.eui); + &asyreq->req.dst.eui); if (fwdev == NULL) { device_printf(sc->fc->bdev, "cannot find node\n"); diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index 05571f2c8f2d..dd3a27a82a86 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -61,7 +61,7 @@ SYSCTL_NODE(_hw_firewire, OID_AUTO, fwmem, CTLFLAG_RD, 0, "FireWire Memory Access"); SYSCTL_UINT(_hw_firewire_fwmem, OID_AUTO, eui64_hi, CTLFLAG_RW, &fwmem_eui64.hi, 0, "Fwmem target EUI64 high"); -SYSCTL_UINT(_hw_firewire_fwmem, OID_AUTO, eui64_low, CTLFLAG_RW, +SYSCTL_UINT(_hw_firewire_fwmem, OID_AUTO, eui64_lo, CTLFLAG_RW, &fwmem_eui64.lo, 0, "Fwmem target EUI64 low"); SYSCTL_INT(_hw_firewire_fwmem, OID_AUTO, speed, CTLFLAG_RW, &fwmem_speed, 0, "Fwmem link speed"); @@ -250,15 +250,22 @@ fwmem_write_block( int fwmem_open (dev_t dev, int flags, int fmt, fw_proc *td) { - int err = 0; - return err; + struct fw_eui64 *eui; + + eui = (struct fw_eui64 *)malloc(sizeof(struct fw_eui64), M_FW, 0); + if (eui == NULL) + return ENOMEM; + bcopy(&fwmem_eui64, eui, sizeof(struct fw_eui64)); + dev->si_drv1 = (void *)eui; + + return (0); } int fwmem_close (dev_t dev, int flags, int fmt, fw_proc *td) { - int err = 0; - return err; + free(dev->si_drv1, M_FW); + return (0); } #define MAXLEN 2048 @@ -277,7 +284,7 @@ fwmem_read (dev_t dev, struct uio *uio, int ioflag) int len; sc = devclass_get_softc(firewire_devclass, unit); - fwdev = fw_noderesolve_eui64(sc->fc, fwmem_eui64); + fwdev = fw_noderesolve_eui64(sc->fc, (struct fw_eui64 *)dev->si_drv1); if (fwdev == NULL) { if (fwmem_debug) printf("fwmem: no such device ID:%08x%08x\n", @@ -340,7 +347,7 @@ fwmem_write (dev_t dev, struct uio *uio, int ioflag) int len; sc = devclass_get_softc(firewire_devclass, unit); - fwdev = fw_noderesolve_eui64(sc->fc, fwmem_eui64); + fwdev = fw_noderesolve_eui64(sc->fc, (struct fw_eui64 *)dev->si_drv1); if (fwdev == NULL) { if (fwmem_debug) printf("fwmem: no such device ID:%08x%08x\n", @@ -393,7 +400,18 @@ fwmem_write (dev_t dev, struct uio *uio, int ioflag) int fwmem_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) { - return EINVAL; + int err = 0; + switch (cmd) { + case FW_SDEUI64: + bcopy(data, dev->si_drv1, sizeof(struct fw_eui64)); + break; + case FW_GDEUI64: + bcopy(dev->si_drv1, data, sizeof(struct fw_eui64)); + break; + default: + err = EINVAL; + } + return(err); } int fwmem_poll (dev_t dev, int events, fw_proc *td) -- cgit v1.3 From 07159f9c56de91cb7d7bd6b6a795eebfee78133e Mon Sep 17 00:00:00 2001 From: Maxime Henrion Date: Tue, 25 Feb 2003 03:21:22 +0000 Subject: Cleanup of the d_mmap_t interface. - Get rid of the useless atop() / pmap_phys_address() detour. The device mmap handlers must now give back the physical address without atop()'ing it. - Don't borrow the physical address of the mapping in the returned int. Now we properly pass a vm_offset_t * and expect it to be filled by the mmap handler when the mapping was successful. The mmap handler must now return 0 when successful, any other value is considered as an error. Previously, returning -1 was the only way to fail. This change thus accidentally fixes some devices which were bogusly returning errno constants which would have been considered as addresses by the device pager. - Garbage collect the poorly named pmap_phys_address() now that it's no longer used. - Convert all the d_mmap_t consumers to the new API. I'm still not sure wheter we need a __FreeBSD_version bump for this, since and we didn't guarantee API/ABI stability until 5.1-RELEASE. Discussed with: alc, phk, jake Reviewed by: peter Compile-tested on: LINT (i386), GENERIC (alpha and sparc64) Runtime-tested on: i386 --- sys/alpha/alpha/mem.c | 5 +++-- sys/alpha/alpha/pmap.c | 7 ------- sys/amd64/amd64/mem.c | 9 ++++++--- sys/amd64/amd64/pmap.c | 7 ------- sys/dev/agp/agp.c | 5 +++-- sys/dev/bktr/bktr_os.c | 5 +++-- sys/dev/drm/drm_vm.h | 16 ++++++++++------ sys/dev/fb/fb.c | 8 ++++---- sys/dev/fb/fbreg.h | 5 +++-- sys/dev/fb/gfb.c | 16 +++++----------- sys/dev/fb/s3_pci.c | 5 +++-- sys/dev/fb/vga.c | 19 +++++++------------ sys/dev/fb/vgareg.h | 2 +- sys/dev/firewire/fwdev.c | 4 ++-- sys/dev/firewire/fwmem.c | 2 +- sys/dev/gfb/gfb_pci.c | 4 ++-- sys/dev/sound/pcm/dsp.c | 7 +++---- sys/dev/syscons/syscons.c | 4 ++-- sys/dev/tdfx/tdfx_pci.c | 9 ++++++--- sys/geom/geom_stats.c | 8 +++++--- sys/i386/i386/elan-mmcr.c | 5 +++-- sys/i386/i386/mem.c | 9 ++++++--- sys/i386/i386/pmap.c | 7 ------- sys/i386/isa/pcvt/pcvt_drv.c | 5 +++-- sys/i386/isa/spigot.c | 5 +++-- sys/i386/isa/vesa.c | 13 +++++-------- sys/ia64/ia64/mem.c | 5 +++-- sys/ia64/ia64/pmap.c | 6 ------ sys/isa/vga_isa.c | 4 ++-- sys/kern/subr_xxx.c | 3 ++- sys/pc98/cbus/gdc.c | 4 ++-- sys/pc98/pc98/pc98gdc.c | 4 ++-- sys/pc98/pc98/syscons.c | 4 ++-- sys/pci/agp.c | 5 +++-- sys/pci/meteor.c | 5 +++-- sys/pci/xrpu.c | 5 +++-- sys/powerpc/aim/mmu_oea.c | 7 ------- sys/powerpc/powerpc/mmu_oea.c | 7 ------- sys/powerpc/powerpc/pmap.c | 7 ------- sys/sparc64/sparc64/pmap.c | 7 ------- sys/sys/conf.h | 3 ++- sys/sys/linedisc.h | 3 ++- sys/vm/device_pager.c | 14 +++++++------- sys/vm/pmap.h | 1 - 44 files changed, 122 insertions(+), 163 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/alpha/alpha/mem.c b/sys/alpha/alpha/mem.c index 9aab3fc2f3d6..18fb05e9ffc3 100644 --- a/sys/alpha/alpha/mem.c +++ b/sys/alpha/alpha/mem.c @@ -222,7 +222,7 @@ kmemphys: * instead of going through read/write * \*******************************************************/ static int -memmmap(dev_t dev, vm_offset_t offset, int prot) +memmmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int prot) { /* * /dev/mem is the only one that makes sense through this @@ -238,7 +238,8 @@ memmmap(dev_t dev, vm_offset_t offset, int prot) */ if ((prot & alpha_pa_access(atop((vm_offset_t)offset))) != prot) return (-1); - return (alpha_btop(ALPHA_PHYS_TO_K0SEG(offset))); + *paddr = ALPHA_PHYS_TO_K0SEG(offset); + return (0); } static int diff --git a/sys/alpha/alpha/pmap.c b/sys/alpha/alpha/pmap.c index 3bf6bc108c37..06fb7caf0840 100644 --- a/sys/alpha/alpha/pmap.c +++ b/sys/alpha/alpha/pmap.c @@ -2807,13 +2807,6 @@ pmap_page_protect(vm_page_t m, vm_prot_t prot) } } -vm_offset_t -pmap_phys_address(ppn) - int ppn; -{ - return (alpha_ptob(ppn)); -} - /* * pmap_ts_referenced: * diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index 41fa63640b60..a045d962d2c2 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -215,22 +215,25 @@ mmrw(dev_t dev, struct uio *uio, int flags) * instead of going through read/write * \*******************************************************/ static int -memmmap(dev_t dev, vm_offset_t offset, int prot) +memmmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int prot) { switch (minor(dev)) { /* minor device 0 is physical memory */ case 0: - return (i386_btop(offset)); + *paddr = offset; + break; /* minor device 1 is kernel memory */ case 1: - return (i386_btop(vtophys(offset))); + *paddr = vtophys(offset); + break; default: return (-1); } + return (0); } /* diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 8d6df393648e..ca469aaeeb32 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -3124,13 +3124,6 @@ pmap_page_protect(vm_page_t m, vm_prot_t prot) } } -vm_offset_t -pmap_phys_address(ppn) - int ppn; -{ - return (i386_ptob(ppn)); -} - /* * pmap_ts_referenced: * diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index f8210267ccba..be2f7f88a356 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -722,14 +722,15 @@ agp_ioctl(dev_t kdev, u_long cmd, caddr_t data, int fflag, struct thread *td) } static int -agp_mmap(dev_t kdev, vm_offset_t offset, int prot) +agp_mmap(dev_t kdev, vm_offset_t offset, vm_offset_t *paddr, int prot) { device_t dev = KDEV2DEV(kdev); struct agp_softc *sc = device_get_softc(dev); if (offset > AGP_GET_APERTURE(dev)) return -1; - return atop(rman_get_start(sc->as_aperture) + offset); + *paddr = rman_get_start(sc->as_aperture) + offset; + return 0; } /* Implementation of the kernel api */ diff --git a/sys/dev/bktr/bktr_os.c b/sys/dev/bktr/bktr_os.c index 4aae13cdf35f..7c7f9a12f685 100644 --- a/sys/dev/bktr/bktr_os.c +++ b/sys/dev/bktr/bktr_os.c @@ -753,7 +753,7 @@ bktr_ioctl( dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct thread *td * */ static int -bktr_mmap( dev_t dev, vm_offset_t offset, int nprot ) +bktr_mmap( dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nprot ) { int unit; bktr_ptr_t bktr; @@ -779,7 +779,8 @@ bktr_mmap( dev_t dev, vm_offset_t offset, int nprot ) if (offset >= bktr->alloc_pages * PAGE_SIZE) return( -1 ); - return( atop(vtophys(bktr->bigbuf) + offset) ); + *paddr = vtophys(bktr->bigbuf) + offset; + return( 0 ); } static int diff --git a/sys/dev/drm/drm_vm.h b/sys/dev/drm/drm_vm.h index 5fd9a398b5e1..705ca480d89d 100644 --- a/sys/dev/drm/drm_vm.h +++ b/sys/dev/drm/drm_vm.h @@ -5,7 +5,8 @@ #include #include -static int DRM(dma_mmap)(dev_t kdev, vm_offset_t offset, int prot) +static int DRM(dma_mmap)(dev_t kdev, vm_offset_t offset, vm_offset_t *paddr, + int prot) { drm_device_t *dev = kdev->si_drv1; drm_device_dma_t *dma = dev->dma; @@ -19,10 +20,11 @@ static int DRM(dma_mmap)(dev_t kdev, vm_offset_t offset, int prot) physical = dma->pagelist[page]; DRM_DEBUG("0x%08x (page %lu) => 0x%08lx\n", offset, page, physical); - return atop(physical); + *paddr = physical; + return 0; } -int DRM(mmap)(dev_t kdev, vm_offset_t offset, int prot) +int DRM(mmap)(dev_t kdev, vm_offset_t offset, vm_offset_t *paddr, int prot) { drm_device_t *dev = kdev->si_drv1; drm_map_t *map = NULL; @@ -43,7 +45,7 @@ int DRM(mmap)(dev_t kdev, vm_offset_t offset, int prot) if (dev->dma && offset >= 0 && offset < ptoa(dev->dma->page_count)) - return DRM(dma_mmap)(kdev, offset, prot); + return DRM(dma_mmap)(kdev, offset, paddr, prot); /* A sequential search of a linked list is fine here because: 1) there will only be @@ -72,9 +74,11 @@ int DRM(mmap)(dev_t kdev, vm_offset_t offset, int prot) case _DRM_FRAME_BUFFER: case _DRM_REGISTERS: case _DRM_AGP: - return atop(offset); + *paddr = offset; + return 0; case _DRM_SHM: - return atop(vtophys(offset)); + *paddr = vtophys(offset); + return 0; default: return -1; /* This should never happen. */ } diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index 0dbb73bac830..6f8bab775f0a 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -501,7 +501,7 @@ fbioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) } static int -fbmmap(dev_t dev, vm_offset_t offset, int nprot) +fbmmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nprot) { int unit; @@ -509,7 +509,7 @@ fbmmap(dev_t dev, vm_offset_t offset, int nprot) if (vidcdevsw[unit] == NULL) return ENXIO; return (*vidcdevsw[unit]->d_mmap)(makedev(0, adapter[unit]->va_minor), - offset, nprot); + offset, paddr, nprot); } #if experimental @@ -591,9 +591,9 @@ int genfbioctl(genfb_softc_t *sc, video_adapter_t *adp, u_long cmd, } int genfbmmap(genfb_softc_t *sc, video_adapter_t *adp, vm_offset_t offset, - int prot) + vm_offset_t *paddr, int prot) { - return (*vidsw[adp->va_index]->mmap)(adp, offset, prot); + return (*vidsw[adp->va_index]->mmap)(adp, offset, paddr, prot); } #endif /* FB_INSTALL_CDEV */ diff --git a/sys/dev/fb/fbreg.h b/sys/dev/fb/fbreg.h index d55679134e68..ce9869ec639a 100644 --- a/sys/dev/fb/fbreg.h +++ b/sys/dev/fb/fbreg.h @@ -81,7 +81,8 @@ typedef int vi_blank_display_t(video_adapter_t *adp, int mode); #define V_DISPLAY_STAND_BY 2 #define V_DISPLAY_SUSPEND 3 */ -typedef int vi_mmap_t(video_adapter_t *adp, vm_offset_t offset, int prot); +typedef int vi_mmap_t(video_adapter_t *adp, vm_offset_t offset, + vm_offset_t *paddr, int prot); typedef int vi_ioctl_t(video_adapter_t *adp, u_long cmd, caddr_t data); typedef int vi_clear_t(video_adapter_t *adp); typedef int vi_fill_rect_t(video_adapter_t *adp, int val, int x, int y, @@ -212,7 +213,7 @@ int genfbwrite(genfb_softc_t *sc, video_adapter_t *adp, int genfbioctl(genfb_softc_t *sc, video_adapter_t *adp, u_long cmd, caddr_t arg, int flag, struct thread *td); int genfbmmap(genfb_softc_t *sc, video_adapter_t *adp, - vm_offset_t offset, int prot); + vm_offset_t offset, vm_offset_t *paddr, int prot); #endif /* FB_INSTALL_CDEV */ diff --git a/sys/dev/fb/gfb.c b/sys/dev/fb/gfb.c index fcb8aedb04c9..4e031692ee29 100644 --- a/sys/dev/fb/gfb.c +++ b/sys/dev/fb/gfb.c @@ -451,20 +451,14 @@ gfb_set_hw_cursor_shape(video_adapter_t *adp, int base, int height, } int -gfb_mmap(video_adapter_t *adp, vm_offset_t offset, int prot) +gfb_mmap(video_adapter_t *adp, vm_offset_t offset, vm_offset_t *paddr, int prot) { - int error; + /* XXX */ if(offset > adp->va_window_size - PAGE_SIZE) - error = ENXIO; -#ifdef __i386__ - error = i386_btop(adp->va_info.vi_window + offset); -#elsif defined(__alpha__) - error = alpha_btop(adp->va_info.vi_window + offset); -#else - error = ENXIO; -#endif - return(error); + return(ENXIO); + *paddr = adp->va_info.vi_window + offset; + return(0); } int diff --git a/sys/dev/fb/s3_pci.c b/sys/dev/fb/s3_pci.c index c7a1be8506af..69549db99adf 100644 --- a/sys/dev/fb/s3_pci.c +++ b/sys/dev/fb/s3_pci.c @@ -389,9 +389,10 @@ s3lfb_blank_display(video_adapter_t *adp, int mode) } static int -s3lfb_mmap(video_adapter_t *adp, vm_offset_t offset, int prot) +s3lfb_mmap(video_adapter_t *adp, vm_offset_t offset, vm_offset_t *paddr, + int prot) { - return (*prevvidsw->mmap)(adp, offset, prot); + return (*prevvidsw->mmap)(adp, offset, paddr, prot); } static int diff --git a/sys/dev/fb/vga.c b/sys/dev/fb/vga.c index 56e015ba1399..562f71611e47 100644 --- a/sys/dev/fb/vga.c +++ b/sys/dev/fb/vga.c @@ -133,9 +133,10 @@ vga_ioctl(dev_t dev, vga_softc_t *sc, u_long cmd, caddr_t arg, int flag, } int -vga_mmap(dev_t dev, vga_softc_t *sc, vm_offset_t offset, int prot) +vga_mmap(dev_t dev, vga_softc_t *sc, vm_offset_t offset, vm_offset_t *paddr, + int prot) { - return genfbmmap(&sc->gensc, sc->adp, offset, prot); + return genfbmmap(&sc->gensc, sc->adp, offset, paddr, prot); } #endif /* FB_INSTALL_CDEV */ @@ -2449,7 +2450,8 @@ vga_blank_display(video_adapter_t *adp, int mode) * all adapters */ static int -vga_mmap_buf(video_adapter_t *adp, vm_offset_t offset, int prot) +vga_mmap_buf(video_adapter_t *adp, vm_offset_t offset, vm_offset_t *paddr, + int prot) { if (adp->va_info.vi_flags & V_INFO_LINEAR) return -1; @@ -2463,15 +2465,8 @@ vga_mmap_buf(video_adapter_t *adp, vm_offset_t offset, int prot) if (offset > adp->va_window_size - PAGE_SIZE) return -1; -#ifdef __i386__ - return i386_btop(adp->va_info.vi_window + offset); -#endif -#ifdef __alpha__ - return alpha_btop(adp->va_info.vi_window + offset); -#endif -#ifdef __ia64__ - return ia64_btop(adp->va_info.vi_window + offset); -#endif + *paddr = adp->va_info.vi_window + offset; + return 0; } #ifndef VGA_NO_MODE_CHANGE diff --git a/sys/dev/fb/vgareg.h b/sys/dev/fb/vgareg.h index f59c7ee751a4..f3903182a59f 100644 --- a/sys/dev/fb/vgareg.h +++ b/sys/dev/fb/vgareg.h @@ -87,7 +87,7 @@ int vga_write(dev_t dev, vga_softc_t *sc, struct uio *uio, int flag); int vga_ioctl(dev_t dev, vga_softc_t *sc, u_long cmd, caddr_t arg, int flag, struct thread *td); int vga_mmap(dev_t dev, vga_softc_t *sc, vm_offset_t offset, - int prot); + vm_offset_t *paddr, int prot); #endif extern int (*vga_sub_configure)(int flags); diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 31b3a2c2f18b..a85db14ab8d4 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -921,13 +921,13 @@ fw_poll(dev_t dev, int events, fw_proc *td) } static int -fw_mmap (dev_t dev, vm_offset_t offset, int nproto) +fw_mmap (dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nproto) { struct firewire_softc *fc; int unit = DEV2UNIT(dev); if (DEV_FWMEM(dev)) - return fwmem_mmap(dev, offset, nproto); + return fwmem_mmap(dev, offset, paddr, nproto); fc = devclass_get_softc(firewire_devclass, unit); diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index dd3a27a82a86..9c64fdc3f835 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -419,7 +419,7 @@ fwmem_poll (dev_t dev, int events, fw_proc *td) return EINVAL; } int -fwmem_mmap (dev_t dev, vm_offset_t offset, int nproto) +fwmem_mmap (dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nproto) { return EINVAL; } diff --git a/sys/dev/gfb/gfb_pci.c b/sys/dev/gfb/gfb_pci.c index 3b3878146245..904f536a7cc0 100644 --- a/sys/dev/gfb/gfb_pci.c +++ b/sys/dev/gfb/gfb_pci.c @@ -313,12 +313,12 @@ pcigfb_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) } int -pcigfb_mmap(dev_t dev, vm_offset_t offset, int prot) +pcigfb_mmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int prot) { struct gfb_softc *sc; sc = (struct gfb_softc *)devclass_get_softc(gfb_devclass, minor(dev)); - return genfbmmap(&sc->gensc, sc->adp, offset, prot); + return genfbmmap(&sc->gensc, sc->adp, offset, paddr, prot); } #endif /*FB_INSTALL_CDEV*/ diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index f2d463c53e2f..cc3c8405cce4 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -990,11 +990,10 @@ dsp_poll(dev_t i_dev, int events, struct thread *td) } static int -dsp_mmap(dev_t i_dev, vm_offset_t offset, int nprot) +dsp_mmap(dev_t i_dev, vm_offset_t offset, vm_offset_t *paddr, int nprot) { struct pcm_channel *wrch = NULL, *rdch = NULL, *c; intrmask_t s; - int ret; if (nprot & PROT_EXEC) return -1; @@ -1034,11 +1033,11 @@ dsp_mmap(dev_t i_dev, vm_offset_t offset, int nprot) if (!(c->flags & CHN_F_MAPPED)) c->flags |= CHN_F_MAPPED; - ret = atop(vtophys(sndbuf_getbufofs(c->bufsoft, offset))); + *paddr = vtophys(sndbuf_getbufofs(c->bufsoft, offset)); relchns(i_dev, rdch, wrch, SD_F_PRIO_RD | SD_F_PRIO_WR); splx(s); - return ret; + return 0; } int diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index aeb80fa8c793..987e57ec682e 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -3364,14 +3364,14 @@ next_code: } static int -scmmap(dev_t dev, vm_offset_t offset, int nprot) +scmmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nprot) { scr_stat *scp; scp = SC_STAT(dev); if (scp != scp->sc->cur_scp) return -1; - return (*vidsw[scp->sc->adapter]->mmap)(scp->sc->adp, offset, nprot); + return (*vidsw[scp->sc->adapter]->mmap)(scp->sc->adp, offset, paddr, nprot); } static int diff --git a/sys/dev/tdfx/tdfx_pci.c b/sys/dev/tdfx/tdfx_pci.c index 40fcfadd4dca..33e0896f724f 100644 --- a/sys/dev/tdfx/tdfx_pci.c +++ b/sys/dev/tdfx/tdfx_pci.c @@ -441,7 +441,7 @@ tdfx_close(dev_t dev, int fflag, int devtype, struct thread *td) } static int -tdfx_mmap(dev_t dev, vm_offset_t offset, int nprot) +tdfx_mmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nprot) { /* * mmap(2) is called by a user process to request that an area of memory @@ -472,14 +472,17 @@ tdfx_mmap(dev_t dev, vm_offset_t offset, int nprot) /* We must stay within the bound of our address space */ if((offset & 0xff000000) == tdfx_info[0]->addr0) { offset &= 0xffffff; - return atop(rman_get_start(tdfx_info[0]->memrange) + offset); + *paddr = rman_get_start(tdfx_info[0]->memrange) + offset; + return 0; } if(tdfx_count > 1) { tdfx_info[1] = (struct tdfx_softc*)devclass_get_softc(tdfx_devclass, 1); if((offset & 0xff000000) == tdfx_info[1]->addr0) { offset &= 0xffffff; - return atop(rman_get_start(tdfx_info[1]->memrange) + offset); + *paddr = rman_get_start(tdfx_info[1]->memrange) + + offset; + return 0; } } diff --git a/sys/geom/geom_stats.c b/sys/geom/geom_stats.c index caf07803e263..2577b2abf75d 100644 --- a/sys/geom/geom_stats.c +++ b/sys/geom/geom_stats.c @@ -122,15 +122,17 @@ static struct cdevsw geom_stats_cdevsw = { }; static int -g_stat_mmap(dev_t dev, vm_offset_t offset, int nprot) +g_stat_mmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nprot) { struct statspage *spp; if (nprot != VM_PROT_READ) return (-1); TAILQ_FOREACH(spp, &pagelist, list) { - if (offset == 0) - return (vtophys(spp->stat) >> PAGE_SHIFT); + if (offset == 0) { + *paddr = vtophys(spp->stat); + return (0); + } offset -= PAGE_SIZE; } return (-1); diff --git a/sys/i386/i386/elan-mmcr.c b/sys/i386/i386/elan-mmcr.c index c36a154bb501..cf324d31090f 100644 --- a/sys/i386/i386/elan-mmcr.c +++ b/sys/i386/i386/elan-mmcr.c @@ -309,14 +309,15 @@ elan_write(dev_t dev, struct uio *uio, int ioflag) } static int -elan_mmap(dev_t dev, vm_offset_t offset, int nprot) +elan_mmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nprot) { if (minor(dev) != ELAN_MMCR) return (EOPNOTSUPP); if (offset >= 0x1000) return (-1); - return (i386_btop(0xfffef000)); + *paddr = 0xfffef000; + return (0); } static int diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index 41fa63640b60..a045d962d2c2 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -215,22 +215,25 @@ mmrw(dev_t dev, struct uio *uio, int flags) * instead of going through read/write * \*******************************************************/ static int -memmmap(dev_t dev, vm_offset_t offset, int prot) +memmmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int prot) { switch (minor(dev)) { /* minor device 0 is physical memory */ case 0: - return (i386_btop(offset)); + *paddr = offset; + break; /* minor device 1 is kernel memory */ case 1: - return (i386_btop(vtophys(offset))); + *paddr = vtophys(offset); + break; default: return (-1); } + return (0); } /* diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 8d6df393648e..ca469aaeeb32 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -3124,13 +3124,6 @@ pmap_page_protect(vm_page_t m, vm_prot_t prot) } } -vm_offset_t -pmap_phys_address(ppn) - int ppn; -{ - return (i386_ptob(ppn)); -} - /* * pmap_ts_referenced: * diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c index 45b74b38b6e9..72a23e0df2ba 100644 --- a/sys/i386/isa/pcvt/pcvt_drv.c +++ b/sys/i386/isa/pcvt/pcvt_drv.c @@ -420,11 +420,12 @@ pcvt_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) * driver mmap *---------------------------------------------------------------------------*/ static int -pcvt_mmap(dev_t dev, vm_offset_t offset, int nprot) +pcvt_mmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nprot) { if (offset > 0x20000 - PAGE_SIZE) return -1; - return i386_btop((0xa0000 + offset)); + *paddr = 0xa0000 + offset; + return 0; } /*---------------------------------------------------------------------------* diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c index bc6df6210daa..79ad930d7370 100644 --- a/sys/i386/isa/spigot.c +++ b/sys/i386/isa/spigot.c @@ -273,7 +273,7 @@ struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[unit]; } static int -spigot_mmap(dev_t dev, vm_offset_t offset, int nprot) +spigot_mmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nprot) { struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[0]; @@ -285,5 +285,6 @@ struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[0]; if(nprot & PROT_EXEC) return -1; - return i386_btop(ss->maddr); + *paddr = ss->maddr; + return 0; } diff --git a/sys/i386/isa/vesa.c b/sys/i386/isa/vesa.c index 5284cece0154..3c3f604ddc74 100644 --- a/sys/i386/isa/vesa.c +++ b/sys/i386/isa/vesa.c @@ -1278,7 +1278,8 @@ vesa_blank_display(video_adapter_t *adp, int mode) } static int -vesa_mmap(video_adapter_t *adp, vm_offset_t offset, int prot) +vesa_mmap(video_adapter_t *adp, vm_offset_t offset, vm_offset_t *paddr, + int prot) { #if VESA_DEBUG > 0 printf("vesa_mmap(): window:0x%x, buffer:0x%x, offset:0x%x\n", @@ -1290,14 +1291,10 @@ vesa_mmap(video_adapter_t *adp, vm_offset_t offset, int prot) /* XXX: is this correct? */ if (offset > adp->va_window_size - PAGE_SIZE) return -1; -#ifdef __i386__ - return i386_btop(adp->va_info.vi_buffer + offset); -#endif -#ifdef __alpha__ /* XXX */ - return alpha_btop(adp->va_info.vi_buffer + offset); -#endif + *paddr = adp->va_info.vi_buffer + offset; + return 0; } else { - return (*prevvidsw->mmap)(adp, offset, prot); + return (*prevvidsw->mmap)(adp, offset, paddr, prot); } } diff --git a/sys/ia64/ia64/mem.c b/sys/ia64/ia64/mem.c index 152f9b447710..146b68453a85 100644 --- a/sys/ia64/ia64/mem.c +++ b/sys/ia64/ia64/mem.c @@ -221,7 +221,7 @@ kmemphys: * instead of going through read/write * \*******************************************************/ static int -memmmap(dev_t dev, vm_offset_t offset, int prot) +memmmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int prot) { /* * /dev/mem is the only one that makes sense through this @@ -237,7 +237,8 @@ memmmap(dev_t dev, vm_offset_t offset, int prot) */ if ((prot & ia64_pa_access(atop((vm_offset_t)offset))) != prot) return (-1); - return (ia64_btop(IA64_PHYS_TO_RR7(offset))); + *paddr = IA64_PHYS_TO_RR7(offset); + return (0); } static int diff --git a/sys/ia64/ia64/pmap.c b/sys/ia64/ia64/pmap.c index 0be8b8335e86..738fefc6b974 100644 --- a/sys/ia64/ia64/pmap.c +++ b/sys/ia64/ia64/pmap.c @@ -2236,12 +2236,6 @@ pmap_page_protect(vm_page_t m, vm_prot_t prot) } } -vm_offset_t -pmap_phys_address(int ppn) -{ - return (ia64_ptob(ppn)); -} - /* * pmap_ts_referenced: * diff --git a/sys/isa/vga_isa.c b/sys/isa/vga_isa.c index 101dc5555587..9e7e61b344bf 100644 --- a/sys/isa/vga_isa.c +++ b/sys/isa/vga_isa.c @@ -196,9 +196,9 @@ isavga_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) } static int -isavga_mmap(dev_t dev, vm_offset_t offset, int prot) +isavga_mmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int prot) { - return vga_mmap(dev, VGA_SOFTC(VGA_UNIT(dev)), offset, prot); + return vga_mmap(dev, VGA_SOFTC(VGA_UNIT(dev)), offset, paddr, prot); } #endif /* FB_INSTALL_CDEV */ diff --git a/sys/kern/subr_xxx.c b/sys/kern/subr_xxx.c index 6730bc744dba..65e40965e2b9 100644 --- a/sys/kern/subr_xxx.c +++ b/sys/kern/subr_xxx.c @@ -132,9 +132,10 @@ nokqfilter(dev, kn) } int -nommap(dev, offset, nprot) +nommap(dev, offset, paddr, nprot) dev_t dev; vm_offset_t offset; + vm_offset_t *paddr; int nprot; { diff --git a/sys/pc98/cbus/gdc.c b/sys/pc98/cbus/gdc.c index 0f8aadfd0252..e5d07888422f 100644 --- a/sys/pc98/cbus/gdc.c +++ b/sys/pc98/cbus/gdc.c @@ -397,12 +397,12 @@ gdcioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) } static int -gdcmmap(dev_t dev, vm_offset_t offset, int prot) +gdcmmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int prot) { gdc_softc_t *sc; sc = GDC_SOFTC(GDC_UNIT(dev)); - return genfbmmap(&sc->gensc, sc->adp, offset, prot); + return genfbmmap(&sc->gensc, sc->adp, offset, paddr, prot); } #endif /* FB_INSTALL_CDEV */ diff --git a/sys/pc98/pc98/pc98gdc.c b/sys/pc98/pc98/pc98gdc.c index 0f8aadfd0252..e5d07888422f 100644 --- a/sys/pc98/pc98/pc98gdc.c +++ b/sys/pc98/pc98/pc98gdc.c @@ -397,12 +397,12 @@ gdcioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) } static int -gdcmmap(dev_t dev, vm_offset_t offset, int prot) +gdcmmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int prot) { gdc_softc_t *sc; sc = GDC_SOFTC(GDC_UNIT(dev)); - return genfbmmap(&sc->gensc, sc->adp, offset, prot); + return genfbmmap(&sc->gensc, sc->adp, offset, paddr, prot); } #endif /* FB_INSTALL_CDEV */ diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index e9fc96ed7665..0adbd5049cda 100644 --- a/sys/pc98/pc98/syscons.c +++ b/sys/pc98/pc98/syscons.c @@ -3383,14 +3383,14 @@ next_code: } static int -scmmap(dev_t dev, vm_offset_t offset, int nprot) +scmmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nprot) { scr_stat *scp; scp = SC_STAT(dev); if (scp != scp->sc->cur_scp) return -1; - return (*vidsw[scp->sc->adapter]->mmap)(scp->sc->adp, offset, nprot); + return (*vidsw[scp->sc->adapter]->mmap)(scp->sc->adp, offset, paddr, nprot); } static int diff --git a/sys/pci/agp.c b/sys/pci/agp.c index f8210267ccba..be2f7f88a356 100644 --- a/sys/pci/agp.c +++ b/sys/pci/agp.c @@ -722,14 +722,15 @@ agp_ioctl(dev_t kdev, u_long cmd, caddr_t data, int fflag, struct thread *td) } static int -agp_mmap(dev_t kdev, vm_offset_t offset, int prot) +agp_mmap(dev_t kdev, vm_offset_t offset, vm_offset_t *paddr, int prot) { device_t dev = KDEV2DEV(kdev); struct agp_softc *sc = device_get_softc(dev); if (offset > AGP_GET_APERTURE(dev)) return -1; - return atop(rman_get_start(sc->as_aperture) + offset); + *paddr = rman_get_start(sc->as_aperture) + offset; + return 0; } /* Implementation of the kernel api */ diff --git a/sys/pci/meteor.c b/sys/pci/meteor.c index 340c70969b86..fd1f7f64c3b8 100644 --- a/sys/pci/meteor.c +++ b/sys/pci/meteor.c @@ -2107,7 +2107,7 @@ meteor_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) } int -meteor_mmap(dev_t dev, vm_offset_t offset, int nprot) +meteor_mmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nprot) { int unit; @@ -2126,6 +2126,7 @@ meteor_mmap(dev_t dev, vm_offset_t offset, int nprot) if(offset >= mtr->alloc_pages * PAGE_SIZE) return -1; - return i386_btop(vtophys(mtr->bigbuf) + offset); + *paddr = vtophys(mtr->bigbuf) + offset; + return 0; } #endif diff --git a/sys/pci/xrpu.c b/sys/pci/xrpu.c index dc218965c189..379a749d0fb9 100644 --- a/sys/pci/xrpu.c +++ b/sys/pci/xrpu.c @@ -136,12 +136,13 @@ xrpu_close(dev_t dev, int flag, int mode, struct thread *td) } static int -xrpu_mmap(dev_t dev, vm_offset_t offset, int nprot) +xrpu_mmap(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nprot) { struct softc *sc = dev->si_drv1; if (offset >= 0x1000000) return (-1); - return (i386_btop(sc->physbase + offset)); + *paddr = sc->physbase + offset; + return (0); } static int diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index 77f3451548b5..318076896792 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -1452,13 +1452,6 @@ pmap_protect(pmap_t pm, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) } } -vm_offset_t -pmap_phys_address(int ppn) -{ - TODO; - return (0); -} - /* * Map a list of wired pages into kernel virtual address space. This is * intended for temporary mappings which do not need page modification or diff --git a/sys/powerpc/powerpc/mmu_oea.c b/sys/powerpc/powerpc/mmu_oea.c index 77f3451548b5..318076896792 100644 --- a/sys/powerpc/powerpc/mmu_oea.c +++ b/sys/powerpc/powerpc/mmu_oea.c @@ -1452,13 +1452,6 @@ pmap_protect(pmap_t pm, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) } } -vm_offset_t -pmap_phys_address(int ppn) -{ - TODO; - return (0); -} - /* * Map a list of wired pages into kernel virtual address space. This is * intended for temporary mappings which do not need page modification or diff --git a/sys/powerpc/powerpc/pmap.c b/sys/powerpc/powerpc/pmap.c index 77f3451548b5..318076896792 100644 --- a/sys/powerpc/powerpc/pmap.c +++ b/sys/powerpc/powerpc/pmap.c @@ -1452,13 +1452,6 @@ pmap_protect(pmap_t pm, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) } } -vm_offset_t -pmap_phys_address(int ppn) -{ - TODO; - return (0); -} - /* * Map a list of wired pages into kernel virtual address space. This is * intended for temporary mappings which do not need page modification or diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c index ec19d898c9f8..12372a19de91 100644 --- a/sys/sparc64/sparc64/pmap.c +++ b/sys/sparc64/sparc64/pmap.c @@ -1778,13 +1778,6 @@ pmap_page_protect(vm_page_t m, vm_prot_t prot) } } -vm_offset_t -pmap_phys_address(int ppn) -{ - - return (sparc64_ptob(ppn)); -} - /* * pmap_ts_referenced: * diff --git a/sys/sys/conf.h b/sys/sys/conf.h index 10d09d95b769..7be960f48b7d 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -157,7 +157,8 @@ typedef int d_read_t(dev_t dev, struct uio *uio, int ioflag); typedef int d_write_t(dev_t dev, struct uio *uio, int ioflag); typedef int d_poll_t(dev_t dev, int events, struct thread *td); typedef int d_kqfilter_t(dev_t dev, struct knote *kn); -typedef int d_mmap_t(dev_t dev, vm_offset_t offset, int nprot); +typedef int d_mmap_t(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, + int nprot); typedef int l_open_t(dev_t dev, struct tty *tp); typedef int l_close_t(struct tty *tp, int flag); diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h index 10d09d95b769..7be960f48b7d 100644 --- a/sys/sys/linedisc.h +++ b/sys/sys/linedisc.h @@ -157,7 +157,8 @@ typedef int d_read_t(dev_t dev, struct uio *uio, int ioflag); typedef int d_write_t(dev_t dev, struct uio *uio, int ioflag); typedef int d_poll_t(dev_t dev, int events, struct thread *td); typedef int d_kqfilter_t(dev_t dev, struct knote *kn); -typedef int d_mmap_t(dev_t dev, vm_offset_t offset, int nprot); +typedef int d_mmap_t(dev_t dev, vm_offset_t offset, vm_offset_t *paddr, + int nprot); typedef int l_open_t(dev_t dev, struct tty *tp); typedef int l_close_t(struct tty *tp, int flag); diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c index e7acedcdbfb1..85f29aeb6795 100644 --- a/sys/vm/device_pager.c +++ b/sys/vm/device_pager.c @@ -107,7 +107,7 @@ dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t fo d_mmap_t *mapfunc; vm_object_t object; unsigned int npages; - vm_offset_t off; + vm_offset_t off, paddr; /* * Offset should be page aligned. @@ -137,7 +137,7 @@ dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t fo */ npages = OFF_TO_IDX(size); for (off = foff; npages--; off += PAGE_SIZE) - if ((*mapfunc)(dev, off, (int) prot) == -1) { + if ((*mapfunc)(dev, off, &paddr, (int)prot) != 0) { mtx_unlock(&Giant); return (NULL); } @@ -205,7 +205,7 @@ dev_pager_getpages(object, m, count, reqpage) vm_offset_t paddr; vm_page_t page; dev_t dev; - int i; + int i, ret; d_mmap_t *mapfunc; int prot; @@ -218,11 +218,11 @@ dev_pager_getpages(object, m, count, reqpage) if (mapfunc == NULL || mapfunc == (d_mmap_t *)nullop) panic("dev_pager_getpage: no map function"); - paddr = pmap_phys_address((*mapfunc) (dev, (vm_offset_t) offset << PAGE_SHIFT, prot)); - KASSERT(paddr != -1,("dev_pager_getpage: map function returns error")); + ret = (*mapfunc)(dev, (vm_offset_t)offset << PAGE_SHIFT, &paddr, prot); + KASSERT(ret == 0, ("dev_pager_getpage: map function returns error")); /* - * Replace the passed in reqpage page with our own fake page and free up the - * all of the original pages. + * Replace the passed in reqpage page with our own fake page and + * free up the all of the original pages. */ page = dev_pager_getfake(paddr); TAILQ_INSERT_TAIL(&object->un_pager.devp.devp_pglist, page, pageq); diff --git a/sys/vm/pmap.h b/sys/vm/pmap.h index 20a5bd3ce41e..a403f6f7335e 100644 --- a/sys/vm/pmap.h +++ b/sys/vm/pmap.h @@ -119,7 +119,6 @@ void pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, int pagelimit); boolean_t pmap_page_exists_quick(pmap_t pmap, vm_page_t m); void pmap_page_protect(vm_page_t m, vm_prot_t prot); -vm_offset_t pmap_phys_address(int); void pmap_pinit(pmap_t); void pmap_pinit0(pmap_t); void pmap_pinit2(pmap_t); -- cgit v1.3 From 455454994f5f90c4b8da443410b2b0974c0471a3 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Thu, 27 Feb 2003 12:51:24 +0000 Subject: MFp4(simokawa_sbp branch) Improve SBP device probeing: - Wait 2 sec before issuing LOGIN ORB expecting the reconnection hold timer expires. - Serialize management ORB and scanning LUN by CAM on each target. This should fix the problem for devices which have multiple LUNs. Test device is donated by: Jaye Mathisen - Freeze SIM queue for 2 sec after BUS RESET. - Retry with LOGIN rather than RECONNECT after LOGIN is not completed for BUS RESET. - Use appropriate CAM status for BUS RESET and DEVICE RESET. - Let CAM to scan targets after BUS REST. - Implement CAM scan target function. - Keep our own devq freeze count. - Let CAM to know that SBP does tagged queuing. These should be merged to RELENG_4 before 4.8-RELEASE. --- sys/dev/firewire/firewire.c | 12 +- sys/dev/firewire/firewirereg.h | 6 + sys/dev/firewire/fwdev.c | 8 + sys/dev/firewire/fwmem.c | 4 + sys/dev/firewire/sbp.c | 388 ++++++++++++++++++++++++++++++----------- 5 files changed, 310 insertions(+), 108 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index b25ede69d6c1..afd65e54b5f1 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -422,11 +422,6 @@ firewire_attach( device_t dev ) dev_depends(sc->dev, d); #else sc->dev[i] = d; -#endif -#if __FreeBSD_version >= 500000 -#define CALLOUT_INIT(x) callout_init(x, 0 /* mpsafe */) -#else -#define CALLOUT_INIT(x) callout_init(x) #endif CALLOUT_INIT(&sc->fc->timeout_callout); CALLOUT_INIT(&sc->fc->bmr_callout); @@ -1787,13 +1782,14 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u ntohl(fp->mode.rreqq.dest_lo)); if(bind == NULL){ #if __FreeBSD_version >= 500000 - printf("Unknown service addr 0x%08x:0x%08x tcode=%x\n", + printf("Unknown service addr 0x%08x:0x%08x tcode=%x\n src=0x%x", #else - printf("Unknown service addr 0x%08x:0x%08lx tcode=%x\n", + printf("Unknown service addr 0x%08x:0x%08lx tcode=%x src=0x%x\n", #endif ntohs(fp->mode.rreqq.dest_hi), ntohl(fp->mode.rreqq.dest_lo), - fp->mode.common.tcode); + fp->mode.common.tcode, + fp->mode.hdr.src); if (fc->status == FWBUSRESET) { printf("fw_rcv: cannot respond(bus reset)!\n"); goto err; diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 0998575a3de5..9cbcadf97434 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -368,5 +368,11 @@ extern devclass_t firewire_devclass; #define vtophys(va) alpha_XXX_dmamap((vm_offset_t)(va)) #endif /* __alpha__ */ +#if __FreeBSD_version >= 500000 +#define CALLOUT_INIT(x) callout_init(x, 0 /* mpsafe */) +#else +#define CALLOUT_INIT(x) callout_init(x) +#endif + MALLOC_DECLARE(M_FW); MALLOC_DECLARE(M_FWXFER); diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index a85db14ab8d4..a25af1554dc5 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -921,13 +921,21 @@ fw_poll(dev_t dev, int events, fw_proc *td) } static int +#if __FreeBSD_version < 500000 +fw_mmap (dev_t dev, vm_offset_t offset, int nproto) +#else fw_mmap (dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nproto) +#endif { struct firewire_softc *fc; int unit = DEV2UNIT(dev); if (DEV_FWMEM(dev)) +#if __FreeBSD_version < 500000 + return fwmem_mmap(dev, offset, nproto); +#else return fwmem_mmap(dev, offset, paddr, nproto); +#endif fc = devclass_get_softc(firewire_devclass, unit); diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index 9c64fdc3f835..182ea6a5cf79 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -419,7 +419,11 @@ fwmem_poll (dev_t dev, int events, fw_proc *td) return EINVAL; } int +#if __FreeBSD_version < 500000 +fwmem_mmap (dev_t dev, vm_offset_t offset, int nproto) +#else fwmem_mmap (dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nproto) +#endif { return EINVAL; } diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index b4c157bd2d78..bc0bd395d229 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -68,20 +68,32 @@ #define ccb_sdev_ptr spriv_ptr0 #define ccb_sbp_ptr spriv_ptr1 -#define SBP_NUM_TARGETS 8 +#define SBP_NUM_TARGETS 8 /* MAX 64 */ #define SBP_NUM_LUNS 8 /* limited by CAM_SCSI2_MAXLUN in cam_xpt.c */ #define SBP_QUEUE_LEN 4 #define SBP_NUM_OCB (SBP_QUEUE_LEN * SBP_NUM_TARGETS) #define SBP_INITIATOR 7 -#define SBP_ESELECT_TIMEOUT 1 + +#define LOGIN_DELAY 2 + +/* + * STATUS FIFO addressing + * bit + * ----------------------- + * 0- 1( 2): 0 (alingment) + * 2- 7( 6): target + * 8-15( 8): lun + * 16-23( 8): unit + * 24-31( 8): reserved + * 32-47(16): SBP_BIND_HI + * 48-64(16): bus_id, node_id + */ #define SBP_BIND_HI 0x1 -#define SBP_DEV2ADDR(u, t, l) \ +#define SBP_DEV2ADDR(u, t, l) \ ((((u) & 0xff) << 16) | (((l) & 0xff) << 8) | (((t) & 0x3f) << 2)) #define SBP_ADDR2TRG(a) (((a) >> 2) & 0x3f) #define SBP_ADDR2LUN(a) (((a) >> 8) & 0xff) -#define MAX_FREEZE 10 - #define ORB_NOTIFY (1 << 31) #define ORB_FMT_STD (0 << 29) #define ORB_FMT_VED (2 << 29) @@ -106,6 +118,7 @@ #define ORB_FUN_LUR (0xe << 16) #define ORB_FUN_RST (0xf << 16) #define ORB_FUN_MSK (0xf << 16) +#define ORB_FUN_RUNQUEUE 0xffff static char *orb_fun_name[] = { /* 0 */ "LOGIN", @@ -168,8 +181,8 @@ struct sbp_ocb { #define OCB_ACT_MASK 3 #define OCB_RESERVED 0x10 #define OCB_DONE 0x20 +#define OCB_MATCH(o,s) (vtophys(&(o)->orb[0]) == ntohl((s)->orb_lo)) -#define SBP_RESOURCE_SHORTAGE 0x10 struct sbp_login_res{ u_int16_t len; @@ -225,9 +238,11 @@ struct sbp_dev{ flags:4; u_int8_t type; u_int16_t lun_id; + int freeze; struct cam_path *path; struct sbp_target *target; struct sbp_login_res login; + struct callout login_callout; STAILQ_HEAD(, sbp_ocb) ocbs; char vendor[32]; char product[32]; @@ -241,17 +256,24 @@ struct sbp_target { struct sbp_softc *sbp; struct fw_device *fwdev; u_int32_t mgm_hi, mgm_lo; + struct sbp_ocb *mgm_ocb_cur; + STAILQ_HEAD(, sbp_ocb) mgm_ocb_queue; + struct callout mgm_ocb_timeout; +#define SCAN_DELAY 2 + struct callout scan_callout; }; struct sbp_softc { struct firewire_dev_comm fd; - unsigned char flags; struct cam_sim *sim; + struct cam_path *path; struct sbp_target targets[SBP_NUM_TARGETS]; struct fw_bind fwb; STAILQ_HEAD(, sbp_ocb) free_ocbs; struct sbp_ocb *ocb; bus_dma_tag_t dmat; +#define SBP_RESOURCE_SHORTAGE 0x10 + unsigned char flags; }; static void sbp_post_explore __P((void *)); static void sbp_recv __P((struct fw_xfer *)); @@ -265,19 +287,21 @@ static void sbp_abort_all_ocbs __P((struct sbp_dev *, int)); static struct fw_xfer * sbp_write_cmd __P((struct sbp_dev *, int, int)); static struct sbp_ocb * sbp_get_ocb __P((struct sbp_softc *)); static struct sbp_ocb * sbp_enqueue_ocb __P((struct sbp_dev *, struct sbp_ocb *)); -static struct sbp_ocb * sbp_dequeue_ocb __P((struct sbp_dev *, u_int32_t)); +static struct sbp_ocb * sbp_dequeue_ocb __P((struct sbp_dev *, struct sbp_status *)); static void sbp_cam_detach_target __P((struct sbp_target *)); static void sbp_timeout __P((void *arg)); -static void sbp_mgm_orb __P((struct sbp_dev *, int, u_int16_t, u_int32_t)); +static void sbp_mgm_orb __P((struct sbp_dev *, int, struct sbp_ocb *)); +#define sbp_login(sdev) \ + callout_reset(&(sdev)->login_callout, LOGIN_DELAY * hz, \ + sbp_login_callout, (void *)(sdev)); MALLOC_DEFINE(M_SBP, "sbp", "SBP-II/FireWire"); /* cam related functions */ static void sbp_action(struct cam_sim *sim, union ccb *ccb); static void sbp_poll(struct cam_sim *sim); -static void sbp_cam_callback(struct cam_periph *periph, - union ccb *ccb); -static void sbp_cam_scan_lun(struct sbp_dev *sdev); +static void sbp_cam_scan_lun(struct cam_periph *, union ccb *); +static void sbp_cam_scan_target(void *arg); static char *orb_status0[] = { /* 0 */ "No additional information to report", @@ -352,6 +376,9 @@ END_DEBUG } device_set_desc(dev, "SBP2/SCSI over firewire"); + + if (bootverbose) + debug = bootverbose; return (0); } @@ -469,6 +496,11 @@ END_DEBUG } target->mgm_hi = 0xffff; target->mgm_lo = 0xf0000000 | target->mgm_lo << 2; + target->mgm_ocb_cur = NULL; + STAILQ_INIT(&target->mgm_ocb_queue); + CALLOUT_INIT(&target->mgm_ocb_timeout); + CALLOUT_INIT(&target->scan_callout); + /* XXX num_lun may be changed. realloc luns? */ crom_init_context(&cc, target->fwdev->csrrom); /* XXX shoud parse appropriate unit directories only */ @@ -498,6 +530,7 @@ END_DEBUG sdev->lun_id = i; sdev->target = target; STAILQ_INIT(&sdev->ocbs); + CALLOUT_INIT(&sdev->login_callout); sdev->status = SBP_DEV_DEAD; } crom_init_context(&cc, target->fwdev->csrrom); @@ -565,14 +598,30 @@ sbp_probe_lun(struct sbp_dev *sdev) rev = getcsrdata(sdev->target->fwdev, 0x3c); snprintf(sdev->revision, sizeof(sdev->revision), "%06x", rev); } + + +static void +sbp_login_callout(void *arg) +{ + struct sbp_dev *sdev = (struct sbp_dev *)arg; + sbp_mgm_orb(sdev, ORB_FUN_LGI, NULL); +} + +#define SBP_FWDEV_ALIVE(fwdev) \ + ((fwdev->status == FWDEVATTACHED) \ + && (getcsrdata(fwdev, CSRKEY_SPEC) == CSRVAL_ANSIT10) \ + && (getcsrdata(fwdev, CSRKEY_VER) == CSRVAL_T10SBP2)) + static void -sbp_probe_target(struct sbp_target *target, int alive) +sbp_probe_target(void *arg) { + struct sbp_target *target = (struct sbp_target *)arg; struct sbp_softc *sbp; struct sbp_dev *sdev; struct firewire_comm *fc; - int i; + int i, alive; + alive = SBP_FWDEV_ALIVE(target->fwdev); SBP_DEBUG(1) printf("sbp_probe_target %d\n", target->target_id); if (!alive) @@ -581,32 +630,43 @@ END_DEBUG sbp = target->sbp; fc = target->sbp->fd.fc; + /* XXX untimeout mgm_ocb and dequeue */ for (i=0; i < target->num_lun; i++) { sdev = &target->luns[i]; if (alive && (sdev->status != SBP_DEV_DEAD)) { if (sdev->path != NULL) { xpt_freeze_devq(sdev->path, 1); + sdev->freeze ++; } - sbp_abort_all_ocbs(sdev, CAM_REQUEUE_REQ); + sbp_probe_lun(sdev); +SBP_DEBUG(0) + sbp_show_sdev_info(sdev, +#if 0 + (sdev->status == SBP_DEV_TOATTACH)); +#else + (sdev->status == SBP_DEV_RESET)); +#endif +END_DEBUG + + sbp_abort_all_ocbs(sdev, CAM_SCSI_BUS_RESET); switch (sdev->status) { case SBP_DEV_RESET: /* new or revived target */ - sbp_probe_lun(sdev); if (auto_login) { +#if 0 sdev->status = SBP_DEV_TOATTACH; - sbp_mgm_orb(sdev, ORB_FUN_LGI, 0, 0); +#endif + sbp_login(sdev); } break; + case SBP_DEV_TOATTACH: + case SBP_DEV_PROBE: + case SBP_DEV_ATTACHED: case SBP_DEV_RETRY: - sbp_probe_lun(sdev); default: - sbp_mgm_orb(sdev, ORB_FUN_RCN, 0, 0); + sbp_mgm_orb(sdev, ORB_FUN_RCN, NULL); break; } -SBP_DEBUG(0) - sbp_show_sdev_info(sdev, - (sdev->status == SBP_DEV_TOATTACH)); -END_DEBUG } else { switch (sdev->status) { case SBP_DEV_ATTACHED: @@ -615,10 +675,12 @@ SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); printf("lost target\n"); END_DEBUG - if (sdev->path) + if (sdev->path) { xpt_freeze_devq(sdev->path, 1); + sdev->freeze ++; + } sdev->status = SBP_DEV_RETRY; - sbp_abort_all_ocbs(sdev, CAM_REQUEUE_REQ); + sbp_abort_all_ocbs(sdev, CAM_SCSI_BUS_RESET); break; case SBP_DEV_PROBE: case SBP_DEV_TOATTACH: @@ -644,11 +706,15 @@ sbp_post_explore(void *arg) SBP_DEBUG(0) printf("sbp_post_explore (sbp_cold=%d)\n", sbp_cold); END_DEBUG -#if 0 - xpt_freeze_simq(sbp->sim, /*count*/ 1); +#if 0 /* + * XXX don't let CAM the bus rest. CAM tries to do something with + * freezed (DEV_RETRY) devices + */ + xpt_async(AC_BUS_RESET, sbp->path, /*arg*/ NULL); #endif if (sbp_cold > 0) sbp_cold --; + /* Gabage Collection */ for(i = 0 ; i < SBP_NUM_TARGETS ; i ++){ target = &sbp->targets[i]; @@ -678,9 +744,7 @@ SBP_DEBUG(0) printf("not attached, state=%d.\n", fwdev->status); } END_DEBUG - alive = (fwdev->status == FWDEVATTACHED) - && (getcsrdata(fwdev, CSRKEY_SPEC) == CSRVAL_ANSIT10) - && (getcsrdata(fwdev, CSRKEY_VER) == CSRVAL_T10SBP2); + alive = SBP_FWDEV_ALIVE(fwdev); for(i = 0 ; i < SBP_NUM_TARGETS ; i ++){ target = &sbp->targets[i]; if(target->fwdev == fwdev ) { @@ -698,7 +762,7 @@ END_DEBUG continue; } } - sbp_probe_target(target, alive); + sbp_probe_target((void *)target); } #if 0 timeout(sbp_release_queue, (caddr_t)sbp, bus_reset_rest * hz / 1000); @@ -745,46 +809,91 @@ END_DEBUG return; } +static struct sbp_dev * +sbp_next_dev(struct sbp_target *target, int lun) +{ + struct sbp_dev *sdev; + int i; + + for (i = lun, sdev = &target->luns[lun]; + i < target->num_lun; i++, sdev++) { + if (sdev->status == SBP_DEV_PROBE) + break; + } + if (i >= target->num_lun) + return(NULL); + return(sdev); +} + +#define SCAN_PRI 1 static void -sbp_cam_callback(struct cam_periph *periph, union ccb *ccb) +sbp_cam_scan_lun(struct cam_periph *periph, union ccb *ccb) { + struct sbp_target *target; struct sbp_dev *sdev; + sdev = (struct sbp_dev *) ccb->ccb_h.ccb_sdev_ptr; + target = sdev->target; SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); - printf("sbp_cam_callback\n"); + printf("sbp_cam_scan_lun\n"); END_DEBUG - sdev->status = SBP_DEV_ATTACHED; - free(ccb, M_SBP); + if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + sdev->status = SBP_DEV_ATTACHED; + } else { + sbp_show_sdev_info(sdev, 2); + printf("scan failed\n"); + } + sdev = sbp_next_dev(target, sdev->lun_id + 1); + if (sdev == NULL) { + free(ccb, M_SBP); + return; + } + /* reuse ccb */ + xpt_setup_ccb(&ccb->ccb_h, sdev->path, SCAN_PRI); + ccb->ccb_h.ccb_sdev_ptr = sdev; + xpt_action(ccb); + xpt_release_devq(sdev->path, sdev->freeze, TRUE); + sdev->freeze = 1; } static void -sbp_cam_scan_lun(struct sbp_dev *sdev) +sbp_cam_scan_target(void *arg) { + struct sbp_target *target = (struct sbp_target *)arg; + struct sbp_dev *sdev; union ccb *ccb; - ccb = malloc(sizeof(union ccb), M_SBP, M_NOWAIT | M_ZERO); - if (ccb == NULL) { - printf("sbp_cam_scan_lun: malloc failed\n"); + sdev = sbp_next_dev(target, 0); + if (sdev == NULL) { + printf("sbp_cam_scan_target: nothing to do for target%d\n", + target->target_id); return; } - SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); - printf("sbp_cam_scan_lun\n"); + printf("sbp_cam_scan_target\n"); END_DEBUG - xpt_setup_ccb(&ccb->ccb_h, sdev->path, 5/*priority (low)*/); + ccb = malloc(sizeof(union ccb), M_SBP, M_NOWAIT | M_ZERO); + if (ccb == NULL) { + printf("sbp_cam_scan_target: malloc failed\n"); + return; + } + xpt_setup_ccb(&ccb->ccb_h, sdev->path, SCAN_PRI); ccb->ccb_h.func_code = XPT_SCAN_LUN; - ccb->ccb_h.cbfcnp = sbp_cam_callback; + ccb->ccb_h.cbfcnp = sbp_cam_scan_lun; + ccb->ccb_h.flags |= CAM_DEV_QFREEZE; ccb->crcn.flags = CAM_FLAG_NONE; ccb->ccb_h.ccb_sdev_ptr = sdev; /* The scan is in progress now. */ - sdev->status = SBP_DEV_PROBE; xpt_action(ccb); + xpt_release_devq(sdev->path, sdev->freeze, TRUE); + sdev->freeze = 1; } +#if 0 static void sbp_ping_unit_callback(struct cam_periph *periph, union ccb *ccb) { @@ -804,13 +913,15 @@ END_DEBUG } else { /* requeue */ xpt_action(ccb); - xpt_release_devq(sdev->path, MAX_FREEZE, TRUE); + xpt_release_devq(sdev->path, sdev->freeze, TRUE); + sdev->freeze = 1; /* we will freeze */ } } else { free(ccb->csio.data_ptr, M_SBP); free(ccb, M_SBP); sdev->status = SBP_DEV_ATTACHED; - xpt_release_devq(sdev->path, MAX_FREEZE, TRUE); + xpt_release_devq(sdev->path, sdev->freeze, TRUE); + sdev->freeze = 0; } } @@ -850,7 +961,7 @@ END_DEBUG /* * We need to execute this command before any other queued command. - * Make priority 0 and freeze queue after execution for retry. + * Make priority 0 and freeze the queue after execution for retry. * cam's scan_lun command doesn't provide this feature. */ xpt_setup_ccb(&ccb->ccb_h, sdev->path, 0/*priority (high)*/); @@ -867,16 +978,33 @@ END_DEBUG /*timeout*/60000 ); ccb->ccb_h.flags |= CAM_DEV_QFREEZE; + ccb->ccb_h.ccb_sdev_ptr = sdev; xpt_action(ccb); + if (sdev->status != SBP_DEV_ATTACHED) + sdev->status = SBP_DEV_PROBE; + xpt_release_devq(sdev->path, sdev->freeze, TRUE); + sdev->freeze = 1; /* We will freeze the queue */ +} +#endif + +static __inline void +sbp_scan_dev(struct sbp_dev *sdev) +{ sdev->status = SBP_DEV_PROBE; + callout_reset(&sdev->target->scan_callout, SCAN_DELAY * hz, + sbp_cam_scan_target, (void *)sdev->target); } static void sbp_do_attach(struct fw_xfer *xfer) { struct sbp_dev *sdev; + struct sbp_target *target; + struct sbp_softc *sbp; sdev = (struct sbp_dev *)xfer->sc; + target = sdev->target; + sbp = target->sbp; SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); printf("sbp_do_attach\n"); @@ -885,8 +1013,8 @@ END_DEBUG if (sdev->path == NULL) xpt_create_path(&sdev->path, xpt_periph, - cam_sim_path(sdev->target->sbp->sim), - sdev->target->target_id, sdev->lun_id); + cam_sim_path(target->sbp->sim), + target->target_id, sdev->lun_id); /* * Let CAM scan the bus if we are in the boot process. @@ -894,15 +1022,11 @@ END_DEBUG * if LUN 0 doesn't exists. */ if (sbp_cold > 0) { - sdev->status = SBP_DEV_PROBE; + sdev->status = SBP_DEV_ATTACHED; return; } - if (sdev->status == SBP_DEV_RETRY) - sbp_ping_unit(sdev); - else - sbp_cam_scan_lun(sdev); - xpt_release_devq(sdev->path, MAX_FREEZE, TRUE); + sbp_scan_dev(sdev); return; } @@ -917,9 +1041,10 @@ SBP_DEBUG(1) printf("sbp_cmd_callback\n"); END_DEBUG fw_xfer_free(xfer); - sbp_abort_all_ocbs(sdev, CAM_REQUEUE_REQ); - if (sdev->path) - xpt_release_devq(sdev->path, MAX_FREEZE, TRUE); + if (sdev->path) { + xpt_release_devq(sdev->path, sdev->freeze, TRUE); + sdev->freeze = 0; + } } static void @@ -942,6 +1067,7 @@ END_DEBUG fp = (struct fw_pkt *)xfer->send.buf; fp->mode.wreqq.data = htonl(0xf); fw_asyreq(xfer->fc, -1, xfer); + sbp_abort_all_ocbs(sdev, CAM_BDR_SENT); } static void @@ -1088,29 +1214,40 @@ sbp_write_cmd(struct sbp_dev *sdev, int tcode, int offset) } static void -sbp_mgm_orb(struct sbp_dev *sdev, int func, u_int16_t orb_hi, u_int32_t orb_lo) +sbp_mgm_orb(struct sbp_dev *sdev, int func, struct sbp_ocb *aocb) { struct fw_xfer *xfer; struct fw_pkt *fp; struct sbp_ocb *ocb; + struct sbp_target *target; int s, nid; - if ((ocb = sbp_get_ocb(sdev->target->sbp)) == NULL) { - s = splfw(); - sdev->target->sbp->flags |= SBP_RESOURCE_SHORTAGE; + target = sdev->target; + nid = target->sbp->fd.fc->nodeid | FWLOCALBUS; + + s = splfw(); + if (func == ORB_FUN_RUNQUEUE) { + ocb = STAILQ_FIRST(&target->mgm_ocb_queue); + if (target->mgm_ocb_cur != NULL || ocb == NULL) { + splx(s); + return; + } + STAILQ_REMOVE_HEAD(&target->mgm_ocb_queue, ocb); + goto start; + } + if ((ocb = sbp_get_ocb(target->sbp)) == NULL) { + target->sbp->flags |= SBP_RESOURCE_SHORTAGE; splx(s); return; } ocb->flags = OCB_ACT_MGM; ocb->sdev = sdev; - ocb->ccb = NULL; - nid = sdev->target->sbp->fd.fc->nodeid | FWLOCALBUS; bzero((void *)(uintptr_t)(volatile void *)ocb->orb, sizeof(ocb->orb)); ocb->orb[6] = htonl((nid << 16) | SBP_BIND_HI); ocb->orb[7] = htonl(SBP_DEV2ADDR( - device_get_unit(sdev->target->sbp->fd.dev), - sdev->target->target_id, + device_get_unit(target->sbp->fd.dev), + target->target_id, sdev->lun_id)); SBP_DEBUG(0) @@ -1125,8 +1262,8 @@ END_DEBUG ocb->orb[5] = htonl(sizeof(struct sbp_login_res)); break; case ORB_FUN_ATA: - ocb->orb[0] = htonl((0 << 16) | orb_hi); - ocb->orb[1] = htonl(orb_lo); + ocb->orb[0] = htonl((0 << 16) | 0); + ocb->orb[1] = htonl(vtophys(&aocb->orb[0])); /* fall through */ case ORB_FUN_RCN: case ORB_FUN_LGO: @@ -1137,6 +1274,18 @@ END_DEBUG break; } + if (target->mgm_ocb_cur != NULL) { + /* there is a standing ORB */ + STAILQ_INSERT_TAIL(&sdev->target->mgm_ocb_queue, ocb, ocb); + splx(s); + return; + } +start: + target->mgm_ocb_cur = ocb; + splx(s); + + callout_reset(&target->mgm_ocb_timeout, 5*hz, + sbp_timeout, (caddr_t)ocb); xfer = sbp_write_cmd(sdev, FWTCODE_WREQB, 0); if(xfer == NULL){ return; @@ -1150,7 +1299,6 @@ END_DEBUG fp->mode.wreqb.extcode = 0; fp->mode.wreqb.payload[0] = htonl(nid << 16); fp->mode.wreqb.payload[1] = htonl(vtophys(&ocb->orb[0])); - sbp_enqueue_ocb(sdev, ocb); fw_asyreq(xfer->fc, -1, xfer); } @@ -1314,15 +1462,19 @@ END_DEBUG #endif /* fall through */ case T_RBC: - /* disable tag queuing */ - inq->flags &= ~SID_CmdQue; + /* enable tag queuing */ +#if 1 + inq->flags |= SID_CmdQue; +#endif /* * Override vendor/product/revision information. * Some devices sometimes return strange strings. */ +#if 1 bcopy(sdev->vendor, inq->vendor, sizeof(inq->vendor)); bcopy(sdev->product, inq->product, sizeof(inq->product)); bcopy(sdev->revision+2, inq->revision, sizeof(inq->revision)); +#endif break; } } @@ -1339,7 +1491,7 @@ sbp_recv1(struct fw_xfer *xfer){ struct sbp_login_res *login_res = NULL; struct sbp_status *sbp_status; struct sbp_target *target; - int orb_fun, status_valid, t, l; + int orb_fun, status_valid0, status_valid, t, l; u_int32_t addr; /* u_int32_t *ld; @@ -1392,7 +1544,16 @@ END_DEBUG switch (sbp_status->src) { case 0: case 1: - ocb = sbp_dequeue_ocb(sdev, ntohl(sbp_status->orb_lo)); + /* check mgm_ocb_cur first */ + ocb = target->mgm_ocb_cur; + if (ocb != NULL) { + if (OCB_MATCH(ocb, sbp_status)) { + callout_stop(&target->mgm_ocb_timeout); + target->mgm_ocb_cur = NULL; + break; + } + } + ocb = sbp_dequeue_ocb(sdev, sbp_status); if (ocb == NULL) { sbp_show_sdev_info(sdev, 2); printf("No ocb on the queue\n"); @@ -1408,12 +1569,12 @@ END_DEBUG printf("unknown sbp_status->src\n"); } - status_valid = (sbp_status->src < 2 + status_valid0 = (sbp_status->src < 2 && sbp_status->resp == ORB_RES_CMPL - && sbp_status->dead == 0 - && sbp_status->status == 0); + && sbp_status->dead == 0); + status_valid = (status_valid0 && sbp_status->status == 0); - if (!status_valid || debug > 1){ + if (!status_valid0 || debug > 1){ int status; SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); @@ -1454,8 +1615,10 @@ END_DEBUG /* we have to reset the fetch agent if it's dead */ if (sbp_status->dead) { - if (sdev->path) + if (sdev->path) { xpt_freeze_devq(sdev->path, 1); + sdev->freeze ++; + } sbp_agent_reset(sdev); } @@ -1487,10 +1650,13 @@ SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); printf("login: len %d, ID %d, cmd %08x%08x, recon_hold %d\n", login_res->len, login_res->id, login_res->cmd_hi, login_res->cmd_lo, ntohs(login_res->recon_hold)); END_DEBUG +#if 0 + sdev->status = SBP_DEV_TOATTACH; +#endif #if 1 sbp_busy_timeout(sdev); #else - sbp_mgm_orb(sdev, ORB_FUN_ATS, 0, 0); + sbp_mgm_orb(sdev, ORB_FUN_ATS, NULL); #endif } else { /* forgot logout? */ @@ -1507,12 +1673,13 @@ sbp_show_sdev_info(sdev, 2); printf("reconnect: len %d, ID %d, cmd %08x%08x\n", login_res->len, login_res->id, login_res->cmd_hi, login_res->cmd_lo); END_DEBUG #if 1 - sbp_ping_unit(sdev); - xpt_release_devq(sdev->path, - MAX_FREEZE, TRUE); + if (sdev->status == SBP_DEV_ATTACHED) + sbp_scan_dev(sdev); + else + sbp_agent_reset(sdev); #else sdev->status = SBP_DEV_ATTACHED; - sbp_mgm_orb(sdev, ORB_FUN_ATS, 0, 0); + sbp_mgm_orb(sdev, ORB_FUN_ATS, NULL); #endif } else { /* reconnection hold time exceed? */ @@ -1520,7 +1687,7 @@ SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); printf("reconnect failed\n"); END_DEBUG - sbp_mgm_orb(sdev, ORB_FUN_LGI, 0, 0); + sbp_login(sdev); } break; case ORB_FUN_LGO: @@ -1539,6 +1706,7 @@ END_DEBUG printf("unknown function %d\n", orb_fun); break; } + sbp_mgm_orb(sdev, ORB_FUN_RUNQUEUE, NULL); break; case OCB_ACT_CMD: if(ocb->ccb != NULL){ @@ -1664,8 +1832,9 @@ END_DEBUG sbp->sim = cam_sim_alloc(sbp_action, sbp_poll, "sbp", sbp, device_get_unit(dev), - /*untagged*/ SBP_QUEUE_LEN, - /*tagged*/0, devq); + /*untagged*/ 1, + /*tagged*/ SBP_QUEUE_LEN, + devq); if (sbp->sim == NULL) { cam_simq_free(devq); @@ -1687,12 +1856,12 @@ END_DEBUG sbp_free_ocb(sbp, &sbp->ocb[i]); } - if (xpt_bus_register(sbp->sim, /*bus*/0) != CAM_SUCCESS) { - cam_sim_free(sbp->sim, /*free_devq*/TRUE); - contigfree(sbp->ocb, sizeof (struct sbp_ocb) * SBP_NUM_OCB, - M_SBP); - return (ENXIO); - } + if (xpt_bus_register(sbp->sim, /*bus*/0) != CAM_SUCCESS) + goto fail; + + if (xpt_create_path(&sbp->path, xpt_periph, cam_sim_path(sbp->sim), + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) + goto fail; xfer = fw_xfer_alloc(M_SBP); xfer->act.hand = sbp_recv; @@ -1718,6 +1887,10 @@ END_DEBUG } return (0); +fail: + cam_sim_free(sbp->sim, /*free_devq*/TRUE); + contigfree(sbp->ocb, sizeof (struct sbp_ocb) * SBP_NUM_OCB, M_SBP); + return (ENXIO); } static int @@ -1738,7 +1911,7 @@ END_DEBUG sdev = &target->luns[j]; if (sdev->status >= SBP_DEV_TOATTACH && sdev->status <= SBP_DEV_ATTACHED) - sbp_mgm_orb(sdev, ORB_FUN_LGO, 0, 0); + sbp_mgm_orb(sdev, ORB_FUN_LGO, NULL); } } return 0; @@ -1771,6 +1944,7 @@ END_DEBUG for (i = 0; i < SBP_NUM_TARGETS; i ++) sbp_cam_detach_target(&sbp->targets[i]); + xpt_free_path(sbp->path); xpt_bus_deregister(cam_sim_path(sbp->sim)); sbp_logout_all(sbp); @@ -1798,8 +1972,11 @@ sbp_cam_detach_target(struct sbp_target *target) SBP_DEBUG(0) printf("sbp_detach_target %d\n", target->target_id); END_DEBUG + callout_stop(&target->scan_callout); + callout_stop(&target->mgm_ocb_timeout); for (i = 0; i < target->num_lun; i++) { sdev = &target->luns[i]; + callout_stop(&sdev->login_callout); if (sdev->status == SBP_DEV_RESET || sdev->status == SBP_DEV_DEAD) continue; @@ -1822,7 +1999,16 @@ sbp_timeout(void *arg) sbp_show_sdev_info(sdev, 2); printf("request timeout ... "); + if (ocb->flags == OCB_ACT_MGM) { + printf("management ORB\n"); + /* XXX just ignore for now */ + sdev->target->mgm_ocb_cur = NULL; + sbp_mgm_orb(sdev, ORB_FUN_RUNQUEUE, NULL); + return; + } + xpt_freeze_devq(sdev->path, 1); + sdev->freeze ++; sbp_abort_all_ocbs(sdev, CAM_CMD_TIMEOUT); if (sdev->flags & SBP_DEV_TIMEOUT) { #if 0 @@ -1834,7 +2020,7 @@ sbp_timeout(void *arg) sdev->status == SBP_DEV_RETRY; #else printf("target reset\n"); - sbp_mgm_orb(sdev, ORB_FUN_RST, 0, 0); + sbp_mgm_orb(sdev, ORB_FUN_RST, NULL); #endif sdev->flags &= ~SBP_DEV_TIMEOUT; } else { @@ -2086,7 +2272,7 @@ SBP_DEBUG(1) ccb->ccb_h.target_id, ccb->ccb_h.target_lun); END_DEBUG cpi->version_num = 1; /* XXX??? */ - cpi->hba_inquiry = 0; + cpi->hba_inquiry = PI_TAG_ABLE; cpi->target_sprt = 0; cpi->hba_misc = PIM_NOBUSRESET; cpi->hba_eng_cnt = 0; @@ -2112,9 +2298,9 @@ SBP_DEBUG(1) device_get_nameunit(sbp->fd.dev), ccb->ccb_h.target_id, ccb->ccb_h.target_lun); END_DEBUG - /* Disable disconnect and tagged queuing */ + /* Enable disconnect and tagged queuing */ cts->valid = CCB_TRANS_DISC_VALID | CCB_TRANS_TQ_VALID; - cts->flags = 0; + cts->flags = CCB_TRANS_DISC_ENB | CCB_TRANS_TAG_ENB; cts->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); @@ -2124,6 +2310,8 @@ END_DEBUG ccb->ccb_h.status = CAM_UA_ABORT; xpt_done(ccb); break; + case XPT_SET_TRAN_SETTINGS: + /* XXX */ default: ccb->ccb_h.status = CAM_REQ_INVALID; xpt_done(ccb); @@ -2206,7 +2394,7 @@ sbp_poll(struct cam_sim *sim) return; } static struct sbp_ocb * -sbp_dequeue_ocb(struct sbp_dev *sdev, u_int32_t orb_lo) +sbp_dequeue_ocb(struct sbp_dev *sdev, struct sbp_status *sbp_status) { struct sbp_ocb *ocb; struct sbp_ocb *next; @@ -2225,7 +2413,7 @@ SBP_DEBUG(1) #endif vtophys(&ocb->orb[0]), ntohl(ocb->orb[1]), flags); END_DEBUG - if (vtophys(&ocb->orb[0]) == orb_lo) { + if (OCB_MATCH(ocb, sbp_status)) { /* found */ if (ocb->flags & OCB_RESERVED) ocb->flags |= OCB_DONE; @@ -2309,7 +2497,7 @@ sbp_get_ocb(struct sbp_softc *sbp) printf("ocb shortage!!!\n"); return NULL; } - STAILQ_REMOVE(&sbp->free_ocbs, ocb, sbp_ocb, ocb); + STAILQ_REMOVE_HEAD(&sbp->free_ocbs, ocb); splx(s); ocb->ccb = NULL; return (ocb); -- cgit v1.3 From 521f364b804158f257fdd8ad7cbf368a0efe5a44 Mon Sep 17 00:00:00 2001 From: Dag-Erling Smørgrav Date: Sun, 2 Mar 2003 16:54:40 +0000 Subject: More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9). --- sys/compat/svr4/svr4_misc.c | 2 +- sys/dev/asr/asr.c | 6 +++--- sys/dev/ata/ata-all.c | 4 ++-- sys/dev/ata/ata-chipset.c | 4 ++-- sys/dev/ata/atapi-all.c | 8 ++++---- sys/dev/atkbdc/psm.c | 6 +++--- sys/dev/dgb/dgb.c | 2 +- sys/dev/firewire/fwdev.c | 10 +++++----- sys/dev/hfa/fore_command.c | 4 ++-- sys/dev/ida/ida.c | 2 +- sys/dev/kbd/kbd.c | 6 +++--- sys/dev/mse/mse.c | 4 ++-- sys/dev/pcic/i82365.c | 2 +- sys/dev/ppbus/lpt.c | 12 ++++++------ sys/dev/ppc/ppc.c | 6 +++--- sys/dev/rc/rc.c | 2 +- sys/dev/si/si.c | 4 ++-- sys/dev/snp/snp.c | 6 +++--- sys/dev/speaker/spkr.c | 8 ++++---- sys/dev/syscons/syscons.c | 12 ++++++------ sys/dev/usb/ulpt.c | 2 +- sys/dev/usb/usbdi_util.c | 4 ++-- sys/fs/fdescfs/fdesc_vnops.c | 4 ++-- sys/fs/fifofs/fifo_vnops.c | 8 ++++---- sys/fs/nwfs/nwfs_io.c | 6 +++--- sys/fs/smbfs/smbfs_io.c | 6 +++--- sys/fs/unionfs/union_subr.c | 4 ++-- sys/i386/isa/asc.c | 16 ++++++++-------- sys/i386/isa/loran.c | 4 ++-- sys/i386/isa/mse.c | 4 ++-- sys/i386/isa/pcvt/pcvt_ext.c | 10 +++++----- sys/i386/isa/pcvt/pcvt_kbd.c | 2 +- sys/i386/isa/spic.c | 4 ++-- sys/i386/isa/spkr.c | 8 ++++---- sys/i386/isa/tw.c | 12 ++++++------ sys/i386/isa/wt.c | 14 +++++++------- sys/i4b/driver/i4b_rbch.c | 16 ++++++++-------- sys/i4b/driver/i4b_tel.c | 30 +++++++++++++++--------------- sys/i4b/driver/i4b_trace.c | 4 ++-- sys/i4b/layer4/i4b_i4bdrv.c | 6 +++--- sys/isa/ppc.c | 6 +++--- sys/isa/psm.c | 6 +++--- sys/kern/subr_log.c | 2 +- sys/net/bpf.c | 4 ++-- sys/net/if_tap.c | 4 ++-- sys/net/if_tun.c | 4 ++-- sys/netinet/tcp_subr.c | 2 +- sys/netinet/tcp_timewait.c | 2 +- sys/nfsclient/nfs_bio.c | 8 ++++---- sys/nfsclient/nfs_nfsiod.c | 4 ++-- sys/nfsclient/nfs_socket.c | 14 +++++++------- sys/nfsserver/nfs_srvcache.c | 12 ++++++------ sys/nfsserver/nfs_srvsock.c | 2 +- sys/nfsserver/nfs_syscalls.c | 10 +++++----- sys/pc98/cbus/olpt.c | 10 +++++----- sys/pc98/cbus/ppc.c | 6 +++--- sys/pc98/pc98/atapi.c | 8 ++++---- sys/pc98/pc98/mse.c | 4 ++-- sys/pc98/pc98/olpt.c | 10 +++++----- sys/pc98/pc98/ppc.c | 6 +++--- sys/pc98/pc98/spkr.c | 8 ++++---- sys/pc98/pc98/syscons.c | 12 ++++++------ sys/pci/meteor.c | 12 ++++++------ sys/sys/socketvar.h | 2 +- sys/ufs/ffs/ffs_softdep.c | 2 +- sys/ufs/ufs/ufs_quota.c | 18 +++++++++--------- 66 files changed, 226 insertions(+), 226 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c index 2db3c960ffed..9febd50281f1 100644 --- a/sys/compat/svr4/svr4_misc.c +++ b/sys/compat/svr4/svr4_misc.c @@ -1419,7 +1419,7 @@ loop: return 0; } - if ((error = tsleep((caddr_t)td->td_proc, PWAIT | PCATCH, "svr4_wait", 0)) != 0) + if ((error = tsleep(td->td_proc, PWAIT | PCATCH, "svr4_wait", 0)) != 0) return error; goto loop; } diff --git a/sys/dev/asr/asr.c b/sys/dev/asr/asr.c index ad02eb678848..78cf0a2c500e 100644 --- a/sys/dev/asr/asr.c +++ b/sys/dev/asr/asr.c @@ -1101,7 +1101,7 @@ ASR_failActiveCommands ( if (ccb->path) { xpt_done ((union ccb *)ccb); } else { - wakeup ((caddr_t)ccb); + wakeup (ccb); } } splx(s); @@ -3798,7 +3798,7 @@ asr_intr ( if (ccb->ccb_h.path) { xpt_done ((union ccb *)ccb); } else { - wakeup ((caddr_t)ccb); + wakeup (ccb); } } #ifdef ASR_MEASURE_PERFORMANCE @@ -4313,7 +4313,7 @@ ASR_queue_i( } /* Check every second for BlinkLed */ /* There is no PRICAM, but outwardly PRIBIO is functional */ - tsleep((caddr_t)ccb, PRIBIO, "asr", hz); + tsleep(ccb, PRIBIO, "asr", hz); } splx(s); diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 17bddd422e47..34cf1df07079 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -629,7 +629,7 @@ ata_intr(void *data) #endif default: if (ch->active & ATA_WAIT_INTR) - wakeup((caddr_t)ch); + wakeup(ch); } if (ch->active & ATA_CONTROL) { @@ -1113,7 +1113,7 @@ ata_command(struct ata_device *atadev, u_int8_t command, if (atadev->channel->flags & ATA_QUEUED) ATA_OUTB(atadev->channel->r_altio, ATA_ALTSTAT, ATA_A_4BIT); - if (tsleep((caddr_t)atadev->channel, PRIBIO, "atacmd", 10 * hz)) { + if (tsleep(atadev->channel, PRIBIO, "atacmd", 10 * hz)) { ata_prtdev(atadev, "timeout waiting for interrupt\n"); atadev->channel->active &= ~ATA_WAIT_INTR; error = -1; diff --git a/sys/dev/ata/ata-chipset.c b/sys/dev/ata/ata-chipset.c index 8078e211ada9..76142544b095 100644 --- a/sys/dev/ata/ata-chipset.c +++ b/sys/dev/ata/ata-chipset.c @@ -1865,14 +1865,14 @@ ata_pci_serialize(struct ata_channel *ch, int flags) if (scp->locked_ch == ch->unit) break; while (!atomic_cmpset_acq_int(&scp->locked_ch, -1, ch->unit)) - tsleep((caddr_t)ch->locking, PRIBIO, "atalck", 1); + tsleep(ch->locking, PRIBIO, "atalck", 1); break; case ATA_LF_UNLOCK: if (scp->locked_ch == -1 || scp->locked_ch != ch->unit) break; atomic_store_rel_int(&scp->locked_ch, -1); - wakeup((caddr_t)ch->locking); + wakeup(ch->locking); break; } return; diff --git a/sys/dev/ata/atapi-all.c b/sys/dev/ata/atapi-all.c index d39c69b6e4db..4bccf382bfe7 100644 --- a/sys/dev/ata/atapi-all.c +++ b/sys/dev/ata/atapi-all.c @@ -202,7 +202,7 @@ atapi_queue_cmd(struct ata_device *atadev, int8_t *ccb, caddr_t data, /* only sleep when command is in progress */ if (request->error == EINPROGRESS) - tsleep((caddr_t)request, PRIBIO, "atprq", 0); + tsleep(request, PRIBIO, "atprq", 0); splx(s); error = request->error; if (error) @@ -489,7 +489,7 @@ atapi_wait_dsc(struct ata_device *atadev, int timeout) error = atapi_queue_cmd(atadev, ccb, NULL, 0, 0, 0, NULL, NULL); if (error != EBUSY) break; - tsleep((caddr_t)&error, PRIBIO, "atpwt", hz / 2); + tsleep(&error, PRIBIO, "atpwt", hz / 2); timeout -= (hz / 2); } return error; @@ -577,7 +577,7 @@ atapi_finish(struct atapi_request *request) free(request, M_ATAPI); } else - wakeup((caddr_t)request); + wakeup(request); } static void @@ -608,7 +608,7 @@ atapi_timeout(struct atapi_request *request) else { /* retries all used up, return error */ request->error = EIO; - wakeup((caddr_t)request); + wakeup(request); } ata_reinit(atadev->channel); } diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index bec4448af385..5b4cc2007dab 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -1528,7 +1528,7 @@ psmread(dev_t dev, struct uio *uio, int flag) return EWOULDBLOCK; } sc->state |= PSM_ASLP; - error = tsleep((caddr_t) sc, PZERO | PCATCH, "psmrea", 0); + error = tsleep( sc, PZERO | PCATCH, "psmrea", 0); sc->state &= ~PSM_ASLP; if (error) { splx(s); @@ -2366,7 +2366,7 @@ psmintr(void *arg) if (sc->state & PSM_ASLP) { sc->state &= ~PSM_ASLP; - wakeup((caddr_t) sc); + wakeup( sc); } selwakeup(&sc->rsel); } @@ -2821,7 +2821,7 @@ psmresume(device_t dev) * cannot be accessed anymore. */ sc->state &= ~PSM_ASLP; - wakeup((caddr_t)sc); + wakeup(sc); } if (verbose >= 2) diff --git a/sys/dev/dgb/dgb.c b/sys/dev/dgb/dgb.c index 65d2a25f7530..1f103801c4cf 100644 --- a/sys/dev/dgb/dgb.c +++ b/sys/dev/dgb/dgb.c @@ -1231,7 +1231,7 @@ static void dgb_pause(chan) void *chan; { - wakeup((caddr_t)chan); + wakeup(chan); } static void diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index a25af1554dc5..36464ab475bb 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -253,7 +253,7 @@ readloop: return err; } ir->flag |= FWXFERQ_WAKEUP; - err = tsleep((caddr_t)ir, FWPRI, "fw_read", hz); + err = tsleep(ir, FWPRI, "fw_read", hz); ir->flag &= ~FWXFERQ_WAKEUP; if (err == 0) goto readloop; @@ -375,7 +375,7 @@ isoloop: err = sc->fc->itx_enable(sc->fc, sub); if (err) return err; - err = tsleep((caddr_t)it, FWPRI, + err = tsleep(it, FWPRI, "fw_write", hz); if (err) return err; @@ -420,7 +420,7 @@ dvloop: if(err){ return err; } - err = tsleep((caddr_t)it, FWPRI, "fw_write", hz); + err = tsleep(it, FWPRI, "fw_write", hz); if(err){ return err; } @@ -503,7 +503,7 @@ dvloop: #else fw_asyreq(fc, -1, xfer); #endif - err = tsleep((caddr_t)xfer, FWPRI, "fw_write", hz); + err = tsleep(xfer, FWPRI, "fw_write", hz); if(xfer->resp == EBUSY) return EBUSY; fw_xfer_free( xfer); @@ -777,7 +777,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) fw_xfer_free( xfer); return err; } - err = tsleep((caddr_t)xfer, FWPRI, "asyreq", hz); + err = tsleep(xfer, FWPRI, "asyreq", hz); if(err == 0){ if(asyreq->req.len >= xfer->recv.len){ asyreq->req.len = xfer->recv.len; diff --git a/sys/dev/hfa/fore_command.c b/sys/dev/hfa/fore_command.c index 861611272c89..e73091f87d18 100644 --- a/sys/dev/hfa/fore_command.c +++ b/sys/dev/hfa/fore_command.c @@ -329,7 +329,7 @@ fore_cmd_drain(fup) /* * Poke whoever is waiting on the stats */ - wakeup((caddr_t)&fup->fu_stats); + wakeup(&fup->fu_stats); break; case CMD_GET_PROM: @@ -416,7 +416,7 @@ fore_cmd_free(fup) * Just in case someone is sleeping on this */ fup->fu_stats_ret = EIO; - wakeup((caddr_t)&fup->fu_stats); + wakeup(&fup->fu_stats); break; } diff --git a/sys/dev/ida/ida.c b/sys/dev/ida/ida.c index f7c026f30ed1..2f725b16809e 100644 --- a/sys/dev/ida/ida.c +++ b/sys/dev/ida/ida.c @@ -445,7 +445,7 @@ ida_wait(struct ida_softc *ida, struct ida_qcb *qcb) int delay; if (ida->flags & IDA_INTERRUPTS) { - if (tsleep((caddr_t)qcb, PRIBIO, "idacmd", 5 * hz)) + if (tsleep(qcb, PRIBIO, "idacmd", 5 * hz)) return (ETIMEDOUT); return (0); } diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c index 6eef728733bc..aa4c3f7c56fa 100644 --- a/sys/dev/kbd/kbd.c +++ b/sys/dev/kbd/kbd.c @@ -578,7 +578,7 @@ genkbdread(dev_t dev, struct uio *uio, int flag) return EWOULDBLOCK; } sc->gkb_flags |= KB_ASLEEP; - error = tsleep((caddr_t)sc, PZERO | PCATCH, "kbdrea", 0); + error = tsleep(sc, PZERO | PCATCH, "kbdrea", 0); kbd = kbd_get_keyboard(KBD_INDEX(dev)); if ((kbd == NULL) || !KBD_IS_VALID(kbd)) { splx(s); @@ -677,7 +677,7 @@ genkbd_event(keyboard_t *kbd, int event, void *arg) kbd_release(kbd, (void *)sc); if (sc->gkb_flags & KB_ASLEEP) { sc->gkb_flags &= ~KB_ASLEEP; - wakeup((caddr_t)sc); + wakeup(sc); } selwakeup(&sc->gkb_rsel); return 0; @@ -748,7 +748,7 @@ genkbd_event(keyboard_t *kbd, int event, void *arg) if (sc->gkb_q.c_cc > 0) { if (sc->gkb_flags & KB_ASLEEP) { sc->gkb_flags &= ~KB_ASLEEP; - wakeup((caddr_t)sc); + wakeup(sc); } selwakeup(&sc->gkb_rsel); } diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c index 3887ba1f23f9..17622bd2eae2 100644 --- a/sys/dev/mse/mse.c +++ b/sys/dev/mse/mse.c @@ -474,7 +474,7 @@ mseread(dev, uio, ioflag) return (0); } sc->sc_flags |= MSESC_WANT; - error = tsleep((caddr_t)sc, MSEPRI | PCATCH, + error = tsleep(sc, MSEPRI | PCATCH, "mseread", 0); if (error) { splx(s); @@ -753,7 +753,7 @@ mseintr(arg) (sc->sc_obuttons ^ sc->sc_buttons) != 0) { if (sc->sc_flags & MSESC_WANT) { sc->sc_flags &= ~MSESC_WANT; - wakeup((caddr_t)sc); + wakeup(sc); } selwakeup(&sc->sc_selp); } diff --git a/sys/dev/pcic/i82365.c b/sys/dev/pcic/i82365.c index fc3c6232f9b8..3ca13f23687b 100644 --- a/sys/dev/pcic/i82365.c +++ b/sys/dev/pcic/i82365.c @@ -511,7 +511,7 @@ pcic_event_thread(void *arg) } else { splx(s); /* sleep .25s to be enqueued chatterling interrupts */ - (void) tsleep((caddr_t)pcic_event_thread, PWAIT, "pcicss", hz/4); + (void) tsleep(pcic_event_thread, PWAIT, "pcicss", hz/4); } s = splhigh(); STAILQ_REMOVE_HEAD_UNTIL(&h->events, pe, pe_q); diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c index 9364c5033659..43fda7eac0b7 100644 --- a/sys/dev/ppbus/lpt.c +++ b/sys/dev/ppbus/lpt.c @@ -444,7 +444,7 @@ lptout(void *arg) lptintr(dev); } else { sc->sc_state &= ~OBUSY; - wakeup((caddr_t)dev); + wakeup(dev); } } @@ -523,7 +523,7 @@ lptopen(dev_t dev, int flags, int fmt, struct thread *td) } /* wait 1/4 second, give up if we get a signal */ - if (tsleep((caddr_t)lptdev, LPPRI|PCATCH, "lptinit", hz/4) != + if (tsleep(lptdev, LPPRI|PCATCH, "lptinit", hz/4) != EWOULDBLOCK) { sc->sc_state = 0; splx(s); @@ -597,7 +597,7 @@ lptclose(dev_t dev, int flags, int fmt, struct thread *td) (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != (LPS_SEL|LPS_NBSY|LPS_NERR) || sc->sc_xfercnt) /* wait 1/4 second, give up if we get a signal */ - if (tsleep((caddr_t)lptdev, LPPRI|PCATCH, + if (tsleep(lptdev, LPPRI|PCATCH, "lpclose", hz) != EWOULDBLOCK) break; @@ -661,7 +661,7 @@ lpt_pushbytes(device_t dev) */ if (tic > MAX_SLEEP) tic = MAX_SLEEP; - err = tsleep((caddr_t)dev, LPPRI, + err = tsleep(dev, LPPRI, LPT_NAME "poll", tic); if (err != EWOULDBLOCK) { return (err); @@ -796,7 +796,7 @@ lptwrite(dev_t dev, struct uio *uio, int ioflag) } lprintf(("W ")); if (sc->sc_state & OBUSY) - if ((err = tsleep((caddr_t)lptdev, + if ((err = tsleep(lptdev, LPPRI|PCATCH, LPT_NAME "write", 0))) { sc->sc_state |= INTERRUPTED; return(err); @@ -872,7 +872,7 @@ lpt_intr(void *arg) sc->sc_state &= ~OBUSY; if(!(sc->sc_state & INTERRUPTED)) - wakeup((caddr_t)lptdev); + wakeup(lptdev); lprintf(("w ")); return; } else { /* check for error */ diff --git a/sys/dev/ppc/ppc.c b/sys/dev/ppc/ppc.c index 52c2f6ac5418..690d0cce37cd 100644 --- a/sys/dev/ppc/ppc.c +++ b/sys/dev/ppc/ppc.c @@ -1614,7 +1614,7 @@ ppcintr(void *arg) ppc->ppc_dmastat = PPC_DMA_COMPLETE; /* wakeup the waiting process */ - wakeup((caddr_t)ppc); + wakeup(ppc); } } } else if (ppc->ppc_irqstat & PPC_IRQ_FIFO) { @@ -1720,7 +1720,7 @@ ppc_write(device_t dev, char *buf, int len, int how) */ do { /* release CPU */ - error = tsleep((caddr_t)ppc, + error = tsleep(ppc, PPBPRI | PCATCH, "ppcdma", 0); } while (error == EWOULDBLOCK); @@ -1752,7 +1752,7 @@ ppc_write(device_t dev, char *buf, int len, int how) #ifdef PPC_DEBUG printf("Z"); #endif - error = tsleep((caddr_t)ppc, PPBPRI | PCATCH, "ppcfifo", hz/100); + error = tsleep(ppc, PPBPRI | PCATCH, "ppcfifo", hz/100); if (error != EWOULDBLOCK) { #ifdef PPC_DEBUG printf("I"); diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index 40178ecd97ee..1e4df7076c7e 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -1007,7 +1007,7 @@ rc_hardclose(struct rc_chans *rc) } } rc->rc_flags &= ~RC_ACTOUT; - wakeup((caddr_t) &rc->rc_rcb); /* wake bi */ + wakeup( &rc->rc_rcb); /* wake bi */ wakeup(TSA_CARR_ON(tp)); (void) splx(s); } diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index 84750bcaa4ef..b96d84f1305c 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -850,7 +850,7 @@ sihardclose(struct si_port *pp) } pp->sp_active_out = FALSE; - wakeup((caddr_t)&pp->sp_active_out); + wakeup(&pp->sp_active_out); wakeup(TSA_CARR_ON(tp)); splx(oldspl); @@ -1416,7 +1416,7 @@ si_write_enable(struct si_port *pp, int state) if (pp->sp_state & SS_WAITWRITE) { pp->sp_state &= ~SS_WAITWRITE; /* thunder away! */ - wakeup((caddr_t)pp); + wakeup(pp); } } else { pp->sp_state |= SS_BLOCKWRITE; diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index c68ca4a77182..797b8d8abd68 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -257,7 +257,7 @@ snpread(dev, uio, flag) if (flag & IO_NDELAY) return (EWOULDBLOCK); snp->snp_flags |= SNOOP_RWAIT; - error = tsleep((caddr_t)snp, (PZERO + 1) | PCATCH, + error = tsleep(snp, (PZERO + 1) | PCATCH, "snprd", 0); if (error != 0) return (error); @@ -351,7 +351,7 @@ snp_in(snp, buf, n) snp->snp_flags |= SNOOP_OFLOW; if (snp->snp_flags & SNOOP_RWAIT) { snp->snp_flags &= ~SNOOP_RWAIT; - wakeup((caddr_t)snp); + wakeup(snp); } splx(s); return (0); @@ -371,7 +371,7 @@ snp_in(snp, buf, n) if (snp->snp_flags & SNOOP_RWAIT) { snp->snp_flags &= ~SNOOP_RWAIT; - wakeup((caddr_t)snp); + wakeup(snp); } selwakeup(&snp->snp_sel); diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index de4c5cab33eb..22b6bf36c59b 100644 --- a/sys/dev/speaker/spkr.c +++ b/sys/dev/speaker/spkr.c @@ -140,7 +140,7 @@ tone(thz, ticks) * emitted. */ if (ticks > 0) - tsleep((caddr_t)&endtone, SPKRPRI | PCATCH, "spkrtn", ticks); + tsleep(&endtone, SPKRPRI | PCATCH, "spkrtn", ticks); SPEAKER_OFF; sps = splclock(); TIMER_RELEASE; @@ -161,7 +161,7 @@ rest(ticks) (void) printf("rest: %d\n", ticks); #endif /* DEBUG */ if (ticks > 0) - tsleep((caddr_t)&endrest, SPKRPRI | PCATCH, "spkrrs", ticks); + tsleep(&endrest, SPKRPRI | PCATCH, "spkrrs", ticks); } /**************** PLAY STRING INTERPRETER BEGINS HERE ********************** @@ -548,8 +548,8 @@ spkrclose(dev, flags, fmt, td) return(ENXIO); else { - wakeup((caddr_t)&endtone); - wakeup((caddr_t)&endrest); + wakeup(&endtone); + wakeup(&endrest); free(spkr_inbuf, M_SPKR); spkr_active = FALSE; return(0); diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 22294dbbc5b1..0edbc4920fe4 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -1012,7 +1012,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) scp = SC_STAT(SC_DEV(sc, i)); if (scp == scp->sc->cur_scp) return 0; - while ((error=tsleep((caddr_t)&scp->smode, PZERO|PCATCH, + while ((error=tsleep(&scp->smode, PZERO|PCATCH, "waitvt", 0)) == ERESTART) ; return error; @@ -2089,7 +2089,7 @@ stop_scrn_saver(sc_softc_t *sc, void (*saver)(sc_softc_t *, int)) if (sc->delayed_next_scr) sc_switch_scr(sc, sc->delayed_next_scr - 1); if (debugger == 0) - wakeup((caddr_t)&scrn_blanked); + wakeup(&scrn_blanked); } static int @@ -2103,7 +2103,7 @@ wait_scrn_saver_stop(sc_softc_t *sc) error = 0; break; } - error = tsleep((caddr_t)&scrn_blanked, PZERO | PCATCH, "scrsav", 0); + error = tsleep(&scrn_blanked, PZERO | PCATCH, "scrsav", 0); if ((error != 0) && (error != ERESTART)) break; } @@ -2302,7 +2302,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr) * be invoked at splhigh(). */ if (debugger == 0) - wakeup((caddr_t)&sc->new_scp->smode); + wakeup(&sc->new_scp->smode); splx(s); DPRINTF(5, ("switch done (new == old)\n")); return 0; @@ -2325,7 +2325,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr) /* wake up processes waiting for this vty */ if (debugger == 0) - wakeup((caddr_t)&sc->cur_scp->smode); + wakeup(&sc->cur_scp->smode); /* wait for the controlling process to acknowledge, if necessary */ if (signal_vt_acq(sc->cur_scp)) { @@ -2351,7 +2351,7 @@ do_switch_scr(sc_softc_t *sc, int s) exchange_scr(sc); s = spltty(); /* sc->cur_scp == sc->new_scp */ - wakeup((caddr_t)&sc->cur_scp->smode); + wakeup(&sc->cur_scp->smode); /* wait for the controlling process to acknowledge, if necessary */ if (!signal_vt_acq(sc->cur_scp)) { diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 726669a8b519..c4fd586ee0cf 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -547,7 +547,7 @@ ulptopen(dev_t dev, int flag, int mode, usb_proc_ptr p) } /* wait 1/4 second, give up if we get a signal */ - error = tsleep((caddr_t)sc, LPTPRI | PCATCH, "ulptop", STEP); + error = tsleep(sc, LPTPRI | PCATCH, "ulptop", STEP); if (error != EWOULDBLOCK) { sc->sc_state = 0; goto done; diff --git a/sys/dev/usb/usbdi_util.c b/sys/dev/usb/usbdi_util.c index 11980497f9ef..f793e6117e22 100644 --- a/sys/dev/usb/usbdi_util.c +++ b/sys/dev/usb/usbdi_util.c @@ -429,7 +429,7 @@ usbd_bulk_transfer(usbd_xfer_handle xfer, usbd_pipe_handle pipe, splx(s); return (err); } - error = tsleep((caddr_t)xfer, PZERO | PCATCH, lbl, 0); + error = tsleep(xfer, PZERO | PCATCH, lbl, 0); splx(s); if (error) { DPRINTF(("usbd_bulk_transfer: tsleep=%d\n", error)); @@ -471,7 +471,7 @@ usbd_intr_transfer(usbd_xfer_handle xfer, usbd_pipe_handle pipe, splx(s); return (err); } - error = tsleep((caddr_t)xfer, PZERO | PCATCH, lbl, 0); + error = tsleep(xfer, PZERO | PCATCH, lbl, 0); splx(s); if (error) { DPRINTF(("usbd_intr_transfer: tsleep=%d\n", error)); diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 152f8f7fe6dc..2a50da4b72ed 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -122,7 +122,7 @@ loop: */ if (fdcache_lock & FDL_LOCKED) { fdcache_lock |= FDL_WANT; - (void) tsleep((caddr_t) &fdcache_lock, PINOD, "fdalvp", 0); + (void) tsleep( &fdcache_lock, PINOD, "fdalvp", 0); goto loop; } fdcache_lock |= FDL_LOCKED; @@ -151,7 +151,7 @@ out: if (fdcache_lock & FDL_WANT) { fdcache_lock &= ~FDL_WANT; - wakeup((caddr_t) &fdcache_lock); + wakeup( &fdcache_lock); } return (error); diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index 64fee388c93c..441e9fd1eba6 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -210,7 +210,7 @@ fifo_open(ap) if (fip->fi_readers == 1) { fip->fi_writesock->so_state &= ~SS_CANTSENDMORE; if (fip->fi_writers > 0) { - wakeup((caddr_t)&fip->fi_writers); + wakeup(&fip->fi_writers); sowwakeup(fip->fi_writesock); } } @@ -220,7 +220,7 @@ fifo_open(ap) if (fip->fi_writers == 1) { fip->fi_readsock->so_state &= ~SS_CANTRCVMORE; if (fip->fi_readers > 0) { - wakeup((caddr_t)&fip->fi_readers); + wakeup(&fip->fi_readers); sorwakeup(fip->fi_writesock); } } @@ -228,7 +228,7 @@ fifo_open(ap) if ((ap->a_mode & FREAD) && (ap->a_mode & O_NONBLOCK) == 0) { while (fip->fi_writers == 0) { VOP_UNLOCK(vp, 0, td); - error = tsleep((caddr_t)&fip->fi_readers, + error = tsleep(&fip->fi_readers, PCATCH | PSOCK, "fifoor", 0); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); if (error) @@ -249,7 +249,7 @@ fifo_open(ap) * by timing out after a sec. Race seen when * sendmail hangs here during boot /phk */ - error = tsleep((caddr_t)&fip->fi_writers, + error = tsleep(&fip->fi_writers, PCATCH | PSOCK, "fifoow", hz); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); if (error) diff --git a/sys/fs/nwfs/nwfs_io.c b/sys/fs/nwfs/nwfs_io.c index c282f58df30f..0d03034c2391 100644 --- a/sys/fs/nwfs/nwfs_io.c +++ b/sys/fs/nwfs/nwfs_io.c @@ -617,7 +617,7 @@ nwfs_vinvalbuf(vp, flags, cred, td, intrflg) } while (np->n_flag & NFLUSHINPROG) { np->n_flag |= NFLUSHWANT; - error = tsleep((caddr_t)&np->n_flag, PRIBIO + 2, "nwfsvinv", slptimeo); + error = tsleep(&np->n_flag, PRIBIO + 2, "nwfsvinv", slptimeo); error = ncp_chkintr(NWFSTOCONN(VTONWFS(vp)), td); if (error == EINTR && intrflg) return EINTR; @@ -629,7 +629,7 @@ nwfs_vinvalbuf(vp, flags, cred, td, intrflg) np->n_flag &= ~NFLUSHINPROG; if (np->n_flag & NFLUSHWANT) { np->n_flag &= ~NFLUSHWANT; - wakeup((caddr_t)&np->n_flag); + wakeup(&np->n_flag); } return EINTR; } @@ -638,7 +638,7 @@ nwfs_vinvalbuf(vp, flags, cred, td, intrflg) np->n_flag &= ~(NMODIFIED | NFLUSHINPROG); if (np->n_flag & NFLUSHWANT) { np->n_flag &= ~NFLUSHWANT; - wakeup((caddr_t)&np->n_flag); + wakeup(&np->n_flag); } return (error); } diff --git a/sys/fs/smbfs/smbfs_io.c b/sys/fs/smbfs/smbfs_io.c index 6c69090bd109..a35932b53136 100644 --- a/sys/fs/smbfs/smbfs_io.c +++ b/sys/fs/smbfs/smbfs_io.c @@ -687,7 +687,7 @@ smbfs_vinvalbuf(vp, flags, cred, td, intrflg) } while (np->n_flag & NFLUSHINPROG) { np->n_flag |= NFLUSHWANT; - error = tsleep((caddr_t)&np->n_flag, PRIBIO + 2, "smfsvinv", slptimeo); + error = tsleep(&np->n_flag, PRIBIO + 2, "smfsvinv", slptimeo); error = smb_proc_intr(td->td_proc); if (error == EINTR && intrflg) return EINTR; @@ -699,7 +699,7 @@ smbfs_vinvalbuf(vp, flags, cred, td, intrflg) np->n_flag &= ~NFLUSHINPROG; if (np->n_flag & NFLUSHWANT) { np->n_flag &= ~NFLUSHWANT; - wakeup((caddr_t)&np->n_flag); + wakeup(&np->n_flag); } return EINTR; } @@ -708,7 +708,7 @@ smbfs_vinvalbuf(vp, flags, cred, td, intrflg) np->n_flag &= ~(NMODIFIED | NFLUSHINPROG); if (np->n_flag & NFLUSHWANT) { np->n_flag &= ~NFLUSHWANT; - wakeup((caddr_t)&np->n_flag); + wakeup(&np->n_flag); } return (error); } diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index e08b70a1ee96..643e1504fe88 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -112,7 +112,7 @@ union_list_lock(ix) { if (unvplock[ix] & UNVP_LOCKED) { unvplock[ix] |= UNVP_WANT; - (void) tsleep((caddr_t) &unvplock[ix], PINOD, "unllck", 0); + (void) tsleep( &unvplock[ix], PINOD, "unllck", 0); return (1); } unvplock[ix] |= UNVP_LOCKED; @@ -127,7 +127,7 @@ union_list_unlock(ix) if (unvplock[ix] & UNVP_WANT) { unvplock[ix] &= ~UNVP_WANT; - wakeup((caddr_t) &unvplock[ix]); + wakeup( &unvplock[ix]); } } diff --git a/sys/i386/isa/asc.c b/sys/i386/isa/asc.c index 292b6d50a036..875dc58c151e 100644 --- a/sys/i386/isa/asc.c +++ b/sys/i386/isa/asc.c @@ -232,10 +232,10 @@ get_resolution(struct asc_unit *scu) res=0; scu->cmd_byte = ASC_STANDBY; outb(ASC_CMD, scu->cmd_byte); - tsleep((caddr_t)scu, ASCPRI | PCATCH, "ascres", hz/10); + tsleep(scu, ASCPRI | PCATCH, "ascres", hz/10); for(delay= 100; (res=inb(ASC_STAT)) & ASC_RDY_FLAG; delay--) { - i = tsleep((caddr_t)scu, ASCPRI | PCATCH, "ascres0", 1); + i = tsleep(scu, ASCPRI | PCATCH, "ascres0", 1); if ( ( i == 0 ) || ( i == EWOULDBLOCK ) ) i = SUCCESS; else @@ -352,7 +352,7 @@ asc_reset(struct asc_unit *scu) outb(ASC_CFG,scu->cfg_byte); /* for safety, do this here */ outb(ASC_CMD,scu->cmd_byte); /* probably not needed */ - tsleep((caddr_t)scu, ASCPRI | PCATCH, "ascres", hz/10); /* sleep .1 sec */ + tsleep(scu, ASCPRI | PCATCH, "ascres", hz/10); /* sleep .1 sec */ scu->blen = DEFAULT_BLEN; scu->btime = TIMEOUT; @@ -525,7 +525,7 @@ ascintr(int unit) scu->sbuf.count += scu->linesize; if (scu->flags & SLEEPING) { scu->flags &= ~SLEEPING; - wakeup((caddr_t)scu); + wakeup(scu); } if (scu->sbuf.size - scu->sbuf.count >= scu->linesize) { dma_restart(scu); @@ -628,7 +628,7 @@ asc_startread(struct asc_unit *scu) /*** sub_28: light on etc...***/ scu->cmd_byte = ASC_STANDBY; outb(ASC_CMD, scu->cmd_byte); - tsleep((caddr_t)scu, ASCPRI | PCATCH, "ascstrd", hz/10); /* sleep .1 sec */ + tsleep(scu, ASCPRI | PCATCH, "ascstrd", hz/10); /* sleep .1 sec */ return SUCCESS; } @@ -658,7 +658,7 @@ ascclose(dev_t dev, int flags, int fmt, struct thread *td) outb(ASC_CFG, 0 ); /* don't save in CFG byte!!! */ scu->cmd_byte &= ~ASC_LIGHT_ON; outb(ASC_CMD, scu->cmd_byte);/* light off */ - tsleep((caddr_t)scu, ASCPRI | PCATCH, "ascclo", hz/2); /* sleep 1/2 sec */ + tsleep(scu, ASCPRI | PCATCH, "ascclo", hz/2); /* sleep 1/2 sec */ scu->cfg_byte &= ~ scu->dma_byte ; /* disable scanner dma */ scu->cfg_byte &= ~ scu->int_byte ; /* disable scanner int */ outb(ASC_CFG, scu->cfg_byte); @@ -734,13 +734,13 @@ ascread(dev_t dev, struct uio *uio, int ioflag) if ( scu->sbuf.count == 0 ) { /* no data avail., must wait */ if (!(scu->flags & DMA_ACTIVE)) dma_restart(scu); scu->flags |= SLEEPING; - res = tsleep((caddr_t)scu, ASCPRI | PCATCH, "ascread", 0); + res = tsleep(scu, ASCPRI | PCATCH, "ascread", 0); scu->flags &= ~SLEEPING; if ( res == 0 ) res = SUCCESS; } splx(sps); /* lower priority... */ if (scu->flags & FLAG_DEBUG) - tsleep((caddr_t)scu, ASCPRI | PCATCH, "ascdly",hz); + tsleep(scu, ASCPRI | PCATCH, "ascdly",hz); lprintf("asc%d.read(after): " "sz 0x%x, rptr 0x%x, wptr 0x%x, cnt 0x%x bcnt 0x%x flags 0x%x icnt %ld\n", unit, scu->sbuf.size, scu->sbuf.rptr, diff --git a/sys/i386/isa/loran.c b/sys/i386/isa/loran.c index ccd7ef63198d..f41338c9c695 100644 --- a/sys/i386/isa/loran.c +++ b/sys/i386/isa/loran.c @@ -358,7 +358,7 @@ loranread(dev_t dev, struct uio * uio, int ioflag) return(EIO); } if (TAILQ_EMPTY(&minors[idx])) - tsleep ((caddr_t)&minors[idx], (PZERO + 8) |PCATCH, "loranrd", hz*2); + tsleep (&minors[idx], (PZERO + 8) |PCATCH, "loranrd", hz*2); if (TAILQ_EMPTY(&minors[idx])) return(0); this = TAILQ_FIRST(&minors[idx]); @@ -563,7 +563,7 @@ loranintr(int unit) done->vco = vco_is; done->when = there; TAILQ_INSERT_TAIL(done->home, done, list); - wakeup((caddr_t)done->home); + wakeup(done->home); } ticker = first->scheduled; diff --git a/sys/i386/isa/mse.c b/sys/i386/isa/mse.c index 3887ba1f23f9..17622bd2eae2 100644 --- a/sys/i386/isa/mse.c +++ b/sys/i386/isa/mse.c @@ -474,7 +474,7 @@ mseread(dev, uio, ioflag) return (0); } sc->sc_flags |= MSESC_WANT; - error = tsleep((caddr_t)sc, MSEPRI | PCATCH, + error = tsleep(sc, MSEPRI | PCATCH, "mseread", 0); if (error) { splx(s); @@ -753,7 +753,7 @@ mseintr(arg) (sc->sc_obuttons ^ sc->sc_buttons) != 0) { if (sc->sc_flags & MSESC_WANT) { sc->sc_flags &= ~MSESC_WANT; - wakeup((caddr_t)sc); + wakeup(sc); } selwakeup(&sc->sc_selp); } diff --git a/sys/i386/isa/pcvt/pcvt_ext.c b/sys/i386/isa/pcvt/pcvt_ext.c index ad0ea3846234..e2897b51ab4e 100644 --- a/sys/i386/isa/pcvt/pcvt_ext.c +++ b/sys/i386/isa/pcvt/pcvt_ext.c @@ -2353,13 +2353,13 @@ vgapage(int new_screen) if(old_vsp->vt_status & VT_WAIT_ACT) { old_vsp->vt_status &= ~VT_WAIT_ACT; - wakeup((caddr_t)&old_vsp->smode); + wakeup(&old_vsp->smode); } if(vsp->vt_status & VT_WAIT_ACT) { vsp->vt_status &= ~VT_WAIT_ACT; - wakeup((caddr_t)&vsp->smode); + wakeup(&vsp->smode); } splx(x); @@ -2514,12 +2514,12 @@ usl_vt_ioctl(dev_t dev, int cmd, caddr_t data, int flag, struct thread *td) if(old_vsp->vt_status & VT_WAIT_ACT) { old_vsp->vt_status &= ~VT_WAIT_ACT; - wakeup((caddr_t)&old_vsp->smode); + wakeup(&old_vsp->smode); } if(vsp->vt_status & VT_WAIT_ACT) { vsp->vt_status &= ~VT_WAIT_ACT; - wakeup((caddr_t)&vsp->smode); + wakeup(&vsp->smode); } splx(opri); @@ -2606,7 +2606,7 @@ usl_vt_ioctl(dev_t dev, int cmd, caddr_t data, int flag, struct thread *td) (error == 0 || error == ERESTART)) { vs[i].vt_status |= VT_WAIT_ACT; - error = tsleep((caddr_t)&vs[i].smode, + error = tsleep(&vs[i].smode, PZERO | PCATCH, "waitvt", 0); } splx(x); diff --git a/sys/i386/isa/pcvt/pcvt_kbd.c b/sys/i386/isa/pcvt/pcvt_kbd.c index d1041964390f..d3f060a42085 100644 --- a/sys/i386/isa/pcvt/pcvt_kbd.c +++ b/sys/i386/isa/pcvt/pcvt_kbd.c @@ -1066,7 +1066,7 @@ scroll_reset: if(!(vsp->scroll_lock)) { /* someone may be sleeping */ - wakeup((caddr_t)&(vsp->scroll_lock)); + wakeup(&(vsp->scroll_lock)); } } break; diff --git a/sys/i386/isa/spic.c b/sys/i386/isa/spic.c index ce5b2dddd204..6bc5ac488c41 100644 --- a/sys/i386/isa/spic.c +++ b/sys/i386/isa/spic.c @@ -436,7 +436,7 @@ spictimeout(void *arg) if (sc->sc_count) { if (sc->sc_sleeping) { sc->sc_sleeping = 0; - wakeup((caddr_t) sc); + wakeup( sc); } selwakeup(&sc->sc_rsel); } @@ -491,7 +491,7 @@ spicread(dev_t dev, struct uio *uio, int flag) s = spltty(); while (!(sc->sc_count)) { sc->sc_sleeping=1; - error = tsleep((caddr_t) sc, PZERO | PCATCH, "jogrea", 0); + error = tsleep( sc, PZERO | PCATCH, "jogrea", 0); sc->sc_sleeping=0; if (error) { splx(s); diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c index de4c5cab33eb..22b6bf36c59b 100644 --- a/sys/i386/isa/spkr.c +++ b/sys/i386/isa/spkr.c @@ -140,7 +140,7 @@ tone(thz, ticks) * emitted. */ if (ticks > 0) - tsleep((caddr_t)&endtone, SPKRPRI | PCATCH, "spkrtn", ticks); + tsleep(&endtone, SPKRPRI | PCATCH, "spkrtn", ticks); SPEAKER_OFF; sps = splclock(); TIMER_RELEASE; @@ -161,7 +161,7 @@ rest(ticks) (void) printf("rest: %d\n", ticks); #endif /* DEBUG */ if (ticks > 0) - tsleep((caddr_t)&endrest, SPKRPRI | PCATCH, "spkrrs", ticks); + tsleep(&endrest, SPKRPRI | PCATCH, "spkrrs", ticks); } /**************** PLAY STRING INTERPRETER BEGINS HERE ********************** @@ -548,8 +548,8 @@ spkrclose(dev, flags, fmt, td) return(ENXIO); else { - wakeup((caddr_t)&endtone); - wakeup((caddr_t)&endrest); + wakeup(&endtone); + wakeup(&endrest); free(spkr_inbuf, M_SPKR); spkr_active = FALSE; return(0); diff --git a/sys/i386/isa/tw.c b/sys/i386/isa/tw.c index 9d5026232817..320082807773 100644 --- a/sys/i386/isa/tw.c +++ b/sys/i386/isa/tw.c @@ -520,7 +520,7 @@ twwrite(dev, uio, ioflag) * originated locally. */ while(sc->sc_state & (TWS_RCVING | TWS_XMITTING)) { - error = tsleep((caddr_t)sc, TWPRI|PCATCH, "twwrite", 0); + error = tsleep(sc, TWPRI|PCATCH, "twwrite", 0); if(error) { splx(s); return(error); @@ -534,7 +534,7 @@ twwrite(dev, uio, ioflag) error = twsend(sc, house, key, reps); s = spltty(); sc->sc_state &= ~TWS_XMITTING; - wakeup((caddr_t)sc); + wakeup(sc); splx(s); if(error) return(EIO); else return(0); @@ -852,7 +852,7 @@ u_char *p; } if(sc->sc_state & TWS_WANT) { sc->sc_state &= ~TWS_WANT; - wakeup((caddr_t)(&sc->sc_buf)); + wakeup((&sc->sc_buf)); } selwakeup(&sc->sc_selp); return(0); @@ -873,7 +873,7 @@ int cnt; while(cnt--) { while(sc->sc_nextin == sc->sc_nextout) { /* Buffer empty */ sc->sc_state |= TWS_WANT; - error = tsleep((caddr_t)(&sc->sc_buf), TWPRI|PCATCH, "twread", 0); + error = tsleep((&sc->sc_buf), TWPRI|PCATCH, "twread", 0); if(error) { return(error); } @@ -907,7 +907,7 @@ twabortrcv(arg) log(LOG_ERR, "TWRCV: aborting (%x, %d)\n", sc->sc_bits, sc->sc_rcount); twdebugtimes(sc); } - wakeup((caddr_t)sc); + wakeup(sc); splx(s); } @@ -1105,7 +1105,7 @@ int unit; sc->sc_rcount, sc->sc_bits, 'A' + pkt[1], X10_KEY_LABEL[pkt[2]]); */ } sc->sc_rcount = 0; - wakeup((caddr_t)sc); + wakeup(sc); } } diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c index ab5d4c3e1a57..64356e73dc2b 100644 --- a/sys/i386/isa/wt.c +++ b/sys/i386/isa/wt.c @@ -614,7 +614,7 @@ wtintr (int u) "rewind busy?\n" : "rewind finished\n")); t->flags &= ~TPREW; /* Rewind finished. */ wtsense (t, 1, TP_WRP); - wakeup ((caddr_t)t); + wakeup (t); return; } @@ -627,7 +627,7 @@ wtintr (int u) if (! (s & t->NOEXCEP)) /* operation failed */ wtsense (t, 1, (t->flags & TPRMARK) ? TP_WRP : 0); t->flags &= ~(TPRMARK | TPWMARK); /* operation finished */ - wakeup ((caddr_t)t); + wakeup (t); return; } @@ -664,7 +664,7 @@ wtintr (int u) t->flags |= TPVOL; /* end of file */ else t->flags |= TPEXCEP; /* i/o error */ - wakeup ((caddr_t)t); + wakeup (t); return; } @@ -675,7 +675,7 @@ wtintr (int u) } if (t->dmacount > t->dmatotal) /* short last block */ t->dmacount = t->dmatotal; - wakeup ((caddr_t)t); /* wake up user level */ + wakeup (t); /* wake up user level */ TRACE (("i/o finished, %d\n", t->dmacount)); } @@ -719,7 +719,7 @@ wtreadfm (wtinfo_t *t) static int wtwritefm (wtinfo_t *t) { - tsleep ((caddr_t)wtwritefm, WTPRI, "wtwfm", hz); /* timeout: 1 second */ + tsleep (wtwritefm, WTPRI, "wtwfm", hz); /* timeout: 1 second */ t->flags &= ~(TPRO | TPWO); if (! wtcmd (t, QIC_WRITEFM)) { wtsense (t, 1, 0); @@ -753,7 +753,7 @@ wtpoll (wtinfo_t *t, int mask, int bits) s = inb (t->STATPORT); if ((s & mask) != bits) return (s); - tsleep ((caddr_t)wtpoll, WTPRI, "wtpoll", 1); /* timeout: 1 tick */ + tsleep (wtpoll, WTPRI, "wtpoll", 1); /* timeout: 1 tick */ } } @@ -789,7 +789,7 @@ wtwait (wtinfo_t *t, int catch, char *msg) TRACE (("wtwait() `%s'\n", msg)); while (t->flags & (TPACTIVE | TPREW | TPRMARK | TPWMARK)) { - error = tsleep ((caddr_t)t, WTPRI | catch, msg, 0); + error = tsleep (t, WTPRI | catch, msg, 0); if (error) return (error); } diff --git a/sys/i4b/driver/i4b_rbch.c b/sys/i4b/driver/i4b_rbch.c index 10b9add3f70e..63b941dade44 100644 --- a/sys/i4b/driver/i4b_rbch.c +++ b/sys/i4b/driver/i4b_rbch.c @@ -260,7 +260,7 @@ i4brbchread(dev_t dev, struct uio *uio, int ioflag) { NDBGL4(L4_RBCHDBG, "unit %d, wait read init", unit); - if((error = tsleep((caddr_t) &rbch_softc[unit], + if((error = tsleep( &rbch_softc[unit], TTIPRI | PCATCH, "rrrbch", 0 )) != 0) { @@ -281,7 +281,7 @@ i4brbchread(dev_t dev, struct uio *uio, int ioflag) NDBGL4(L4_RBCHDBG, "unit %d, wait read data", unit); - if((error = tsleep((caddr_t) &isdn_linktab[unit]->rx_queue, + if((error = tsleep( &isdn_linktab[unit]->rx_queue, TTIPRI | PCATCH, "rrbch", 0 )) != 0) { @@ -355,7 +355,7 @@ i4brbchwrite(dev_t dev, struct uio * uio, int ioflag) { NDBGL4(L4_RBCHDBG, "unit %d, write wait init", unit); - error = tsleep((caddr_t) &rbch_softc[unit], + error = tsleep( &rbch_softc[unit], TTIPRI | PCATCH, "wrrbch", 0 ); if(error == ERESTART) { @@ -374,7 +374,7 @@ i4brbchwrite(dev_t dev, struct uio * uio, int ioflag) NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep init", unit, error); return(error); } - tsleep((caddr_t) &rbch_softc[unit], TTIPRI | PCATCH, "xrbch", (hz*1)); + tsleep( &rbch_softc[unit], TTIPRI | PCATCH, "xrbch", (hz*1)); } while(_IF_QFULL(isdn_linktab[unit]->tx_queue) && (sc->sc_devstate & ST_ISOPEN)) @@ -383,7 +383,7 @@ i4brbchwrite(dev_t dev, struct uio * uio, int ioflag) NDBGL4(L4_RBCHDBG, "unit %d, write queue full", unit); - if ((error = tsleep((caddr_t) &isdn_linktab[unit]->tx_queue, + if ((error = tsleep( &isdn_linktab[unit]->tx_queue, TTIPRI | PCATCH, "wrbch", 0)) != 0) { sc->sc_devstate &= ~ST_WRWAITEMPTY; @@ -655,7 +655,7 @@ rbch_connect(int unit, void *cdp) NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit); sc->sc_devstate |= ST_CONNECTED; sc->sc_cd = cdp; - wakeup((caddr_t)sc); + wakeup(sc); } } @@ -737,7 +737,7 @@ rbch_rx_data_rdy(int unit) { NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit); rbch_softc[unit].sc_devstate &= ~ST_RDWAITDATA; - wakeup((caddr_t) &isdn_linktab[unit]->rx_queue); + wakeup( &isdn_linktab[unit]->rx_queue); } else { @@ -758,7 +758,7 @@ rbch_tx_queue_empty(int unit) { NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit); rbch_softc[unit].sc_devstate &= ~ST_WRWAITEMPTY; - wakeup((caddr_t) &isdn_linktab[unit]->tx_queue); + wakeup( &isdn_linktab[unit]->tx_queue); } else { diff --git a/sys/i4b/driver/i4b_tel.c b/sys/i4b/driver/i4b_tel.c index b4e54d814a48..3792e866b454 100644 --- a/sys/i4b/driver/i4b_tel.c +++ b/sys/i4b/driver/i4b_tel.c @@ -254,7 +254,7 @@ i4btelclose(dev_t dev, int flag, int fmt, struct thread *td) { sc->devstate |= ST_WRWAITEMPTY; - if((error = tsleep((caddr_t) &sc->isdn_linktab->tx_queue, + if((error = tsleep( &sc->isdn_linktab->tx_queue, TTIPRI | PCATCH, "wtcl", 0)) != 0) { break; @@ -265,7 +265,7 @@ i4btelclose(dev_t dev, int flag, int fmt, struct thread *td) sc->devstate &= ~ST_ISOPEN; splx(x); - wakeup((caddr_t) &sc->tones); + wakeup( &sc->tones); return(error); } @@ -351,7 +351,7 @@ i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) s = splimp(); while ((sc->devstate & ST_TONE) && sc->tones.duration[sc->toneidx] != 0) { - if((error = tsleep((caddr_t) &sc->tones, + if((error = tsleep( &sc->tones, TTIPRI | PCATCH, "rtone", 0 )) != 0) { splx(s); return(error); @@ -423,7 +423,7 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag) NDBGL4(L4_TELDBG, "i4btel%d, queue empty!", unit); - if((error = msleep((caddr_t) &sc->isdn_linktab->rx_queue, + if((error = msleep( &sc->isdn_linktab->rx_queue, &sc->isdn_linktab->rx_queue->ifq_mtx, TTIPRI | PCATCH, "rtel", 0 )) != 0) @@ -490,7 +490,7 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag) NDBGL4(L4_TELDBG, "i4btel%d, wait for result!", unit); - if((error = tsleep((caddr_t) &sc->result, + if((error = tsleep( &sc->result, TTIPRI | PCATCH, "rtel1", 0 )) != 0) { @@ -559,7 +559,7 @@ i4btelwrite(dev_t dev, struct uio * uio, int ioflag) { sc->devstate |= ST_WRWAITEMPTY; - if((error = msleep((caddr_t) &sc->isdn_linktab->tx_queue, + if((error = msleep( &sc->isdn_linktab->tx_queue, &sc->isdn_linktab->tx_queue->ifq_mtx, TTIPRI | PCATCH, "wtel", 0)) != 0) { @@ -670,7 +670,7 @@ tel_tone(tel_sc_t *sc) sc->tonefreq = sc->tones.frequency[sc->toneidx]; } if (sc->tones.duration[sc->toneidx] == 0) { - wakeup((caddr_t) &sc->tones); + wakeup( &sc->tones); } } } @@ -795,7 +795,7 @@ tel_connect(int unit, void *cdp) if(sc->devstate & ST_RDWAITDATA) { sc->devstate &= ~ST_RDWAITDATA; - wakeup((caddr_t) &sc->result); + wakeup( &sc->result); } selwakeup(&sc->selp); } @@ -818,13 +818,13 @@ tel_disconnect(int unit, void *cdp) if(sc->devstate & ST_RDWAITDATA) { sc->devstate &= ~ST_RDWAITDATA; - wakeup((caddr_t) &sc->isdn_linktab->rx_queue); + wakeup( &sc->isdn_linktab->rx_queue); } if(sc->devstate & ST_WRWAITEMPTY) { sc->devstate &= ~ST_WRWAITEMPTY; - wakeup((caddr_t) &sc->isdn_linktab->tx_queue); + wakeup( &sc->isdn_linktab->tx_queue); } /* dialer device */ @@ -839,13 +839,13 @@ tel_disconnect(int unit, void *cdp) if(sc->devstate & ST_RDWAITDATA) { sc->devstate &= ~ST_RDWAITDATA; - wakeup((caddr_t) &sc->result); + wakeup( &sc->result); } selwakeup(&sc->selp); if (sc->devstate & ST_TONE) { sc->devstate &= ~ST_TONE; - wakeup((caddr_t) &sc->tones); + wakeup( &sc->tones); } } } @@ -868,7 +868,7 @@ tel_dialresponse(int unit, int status, cause_t cause) if(sc->devstate & ST_RDWAITDATA) { sc->devstate &= ~ST_RDWAITDATA; - wakeup((caddr_t) &sc->result); + wakeup( &sc->result); } selwakeup(&sc->selp); } @@ -895,7 +895,7 @@ tel_rx_data_rdy(int unit) if(sc->devstate & ST_RDWAITDATA) { sc->devstate &= ~ST_RDWAITDATA; - wakeup((caddr_t) &sc->isdn_linktab->rx_queue); + wakeup( &sc->isdn_linktab->rx_queue); } selwakeup(&sc->selp); } @@ -913,7 +913,7 @@ tel_tx_queue_empty(int unit) if(sc->devstate & ST_WRWAITEMPTY) { sc->devstate &= ~ST_WRWAITEMPTY; - wakeup((caddr_t) &sc->isdn_linktab->tx_queue); + wakeup( &sc->isdn_linktab->tx_queue); } if(sc->devstate & ST_TONE) { tel_tone(sc); diff --git a/sys/i4b/driver/i4b_trace.c b/sys/i4b/driver/i4b_trace.c index fe374d8c8165..a8201a4e7d3e 100644 --- a/sys/i4b/driver/i4b_trace.c +++ b/sys/i4b/driver/i4b_trace.c @@ -217,7 +217,7 @@ get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf) if(device_state[unit] & ST_WAITDATA) { device_state[unit] &= ~ST_WAITDATA; - wakeup((caddr_t) &trace_queue[unit]); + wakeup( &trace_queue[unit]); } splx(x); @@ -320,7 +320,7 @@ i4btrcread(dev_t dev, struct uio * uio, int ioflag) { device_state[unit] |= ST_WAITDATA; - if((error = msleep((caddr_t) &trace_queue[unit], + if((error = msleep( &trace_queue[unit], &trace_queue[unit].ifq_mtx, TTIPRI | PCATCH, "bitrc", 0 )) != 0) diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c index 2f31608509fe..6d4a107e2e35 100644 --- a/sys/i4b/layer4/i4b_i4bdrv.c +++ b/sys/i4b/layer4/i4b_i4bdrv.c @@ -168,7 +168,7 @@ i4bread(dev_t dev, struct uio *uio, int ioflag) { readflag = 1; - error = msleep((caddr_t) &i4b_rdqueue, &i4b_rdqueue.ifq_mtx, + error = msleep( &i4b_rdqueue, &i4b_rdqueue.ifq_mtx, (PZERO + 1) | PCATCH, "bird", 0); if (error != 0) { @@ -820,7 +820,7 @@ i4bputqueue(struct mbuf *m) if(readflag) { readflag = 0; - wakeup((caddr_t) &i4b_rdqueue); + wakeup( &i4b_rdqueue); } if(selflag) @@ -863,7 +863,7 @@ i4bputqueue_hipri(struct mbuf *m) if(readflag) { readflag = 0; - wakeup((caddr_t) &i4b_rdqueue); + wakeup( &i4b_rdqueue); } if(selflag) diff --git a/sys/isa/ppc.c b/sys/isa/ppc.c index 52c2f6ac5418..690d0cce37cd 100644 --- a/sys/isa/ppc.c +++ b/sys/isa/ppc.c @@ -1614,7 +1614,7 @@ ppcintr(void *arg) ppc->ppc_dmastat = PPC_DMA_COMPLETE; /* wakeup the waiting process */ - wakeup((caddr_t)ppc); + wakeup(ppc); } } } else if (ppc->ppc_irqstat & PPC_IRQ_FIFO) { @@ -1720,7 +1720,7 @@ ppc_write(device_t dev, char *buf, int len, int how) */ do { /* release CPU */ - error = tsleep((caddr_t)ppc, + error = tsleep(ppc, PPBPRI | PCATCH, "ppcdma", 0); } while (error == EWOULDBLOCK); @@ -1752,7 +1752,7 @@ ppc_write(device_t dev, char *buf, int len, int how) #ifdef PPC_DEBUG printf("Z"); #endif - error = tsleep((caddr_t)ppc, PPBPRI | PCATCH, "ppcfifo", hz/100); + error = tsleep(ppc, PPBPRI | PCATCH, "ppcfifo", hz/100); if (error != EWOULDBLOCK) { #ifdef PPC_DEBUG printf("I"); diff --git a/sys/isa/psm.c b/sys/isa/psm.c index bec4448af385..5b4cc2007dab 100644 --- a/sys/isa/psm.c +++ b/sys/isa/psm.c @@ -1528,7 +1528,7 @@ psmread(dev_t dev, struct uio *uio, int flag) return EWOULDBLOCK; } sc->state |= PSM_ASLP; - error = tsleep((caddr_t) sc, PZERO | PCATCH, "psmrea", 0); + error = tsleep( sc, PZERO | PCATCH, "psmrea", 0); sc->state &= ~PSM_ASLP; if (error) { splx(s); @@ -2366,7 +2366,7 @@ psmintr(void *arg) if (sc->state & PSM_ASLP) { sc->state &= ~PSM_ASLP; - wakeup((caddr_t) sc); + wakeup( sc); } selwakeup(&sc->rsel); } @@ -2821,7 +2821,7 @@ psmresume(device_t dev) * cannot be accessed anymore. */ sc->state &= ~PSM_ASLP; - wakeup((caddr_t)sc); + wakeup(sc); } if (verbose >= 2) diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index 9969fb1cb508..c506e9e35a67 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -197,7 +197,7 @@ logtimeout(void *arg) if ((logsoftc.sc_state & LOG_ASYNC) && logsoftc.sc_sigio != NULL) pgsigio(&logsoftc.sc_sigio, SIGIO, 0); if (logsoftc.sc_state & LOG_RDWAIT) { - wakeup((caddr_t)msgbufp); + wakeup(msgbufp); logsoftc.sc_state &= ~LOG_RDWAIT; } callout_reset(&logsoftc.sc_callout, hz / log_wakeups_per_second, diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 71c98aae4d9a..bc13b59440ee 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -457,7 +457,7 @@ bpfread(dev, uio, ioflag) BPFD_UNLOCK(d); return (EWOULDBLOCK); } - error = msleep((caddr_t)d, &d->bd_mtx, PRINET|PCATCH, + error = msleep(d, &d->bd_mtx, PRINET|PCATCH, "bpf", d->bd_rtout); if (error == EINTR || error == ERESTART) { BPFD_UNLOCK(d); @@ -518,7 +518,7 @@ bpf_wakeup(d) callout_stop(&d->bd_callout); d->bd_state = BPF_IDLE; } - wakeup((caddr_t)d); + wakeup(d); if (d->bd_async && d->bd_sig && d->bd_sigio) pgsigio(&d->bd_sigio, d->bd_sig, 0); diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index f35d57815b8a..388ca6017af9 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -607,7 +607,7 @@ tapifstart(ifp) if (ifp->if_snd.ifq_len != 0) { if (tp->tap_flags & TAP_RWAIT) { tp->tap_flags &= ~TAP_RWAIT; - wakeup((caddr_t)tp); + wakeup(tp); } if ((tp->tap_flags & TAP_ASYNC) && (tp->tap_sigio != NULL)) @@ -779,7 +779,7 @@ tapread(dev, uio, flag) return (EWOULDBLOCK); tp->tap_flags |= TAP_RWAIT; - error = tsleep((caddr_t)tp,PCATCH|(PZERO+1),"taprd",0); + error = tsleep(tp,PCATCH|(PZERO+1),"taprd",0); if (error) return (error); } diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 315fa77ceaba..1c7d61eb59a9 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -211,7 +211,7 @@ tunstart(struct ifnet *ifp) if (tp->tun_flags & TUN_RWAIT) { tp->tun_flags &= ~TUN_RWAIT; - wakeup((caddr_t)tp); + wakeup(tp); } if (tp->tun_flags & TUN_ASYNC && tp->tun_sigio) pgsigio(&tp->tun_sigio, SIGIO, 0); @@ -664,7 +664,7 @@ tunread(dev_t dev, struct uio *uio, int flag) return (EWOULDBLOCK); } tp->tun_flags |= TUN_RWAIT; - if((error = tsleep((caddr_t)tp, PCATCH | (PZERO + 1), + if((error = tsleep(tp, PCATCH | (PZERO + 1), "tunread", 0)) != 0) { splx(s); return (error); diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index d92cbf54a31d..f4d05abc5a01 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -872,7 +872,7 @@ tcp_notify(inp, error) return inp; } #if 0 - wakeup((caddr_t) &so->so_timeo); + wakeup( &so->so_timeo); sorwakeup(so); sowwakeup(so); #endif diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index d92cbf54a31d..f4d05abc5a01 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -872,7 +872,7 @@ tcp_notify(inp, error) return inp; } #if 0 - wakeup((caddr_t) &so->so_timeo); + wakeup( &so->so_timeo); sorwakeup(so); sowwakeup(so); #endif diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c index 1603946b52b2..c124e64d2207 100644 --- a/sys/nfsclient/nfs_bio.c +++ b/sys/nfsclient/nfs_bio.c @@ -1085,7 +1085,7 @@ nfs_vinvalbuf(struct vnode *vp, int flags, struct ucred *cred, */ while (np->n_flag & NFLUSHINPROG) { np->n_flag |= NFLUSHWANT; - error = tsleep((caddr_t)&np->n_flag, PRIBIO + 2, "nfsvinval", + error = tsleep(&np->n_flag, PRIBIO + 2, "nfsvinval", slptimeo); if (error && intrflg && nfs_sigintr(nmp, NULL, td)) @@ -1103,7 +1103,7 @@ nfs_vinvalbuf(struct vnode *vp, int flags, struct ucred *cred, np->n_flag &= ~NFLUSHINPROG; if (np->n_flag & NFLUSHWANT) { np->n_flag &= ~NFLUSHWANT; - wakeup((caddr_t)&np->n_flag); + wakeup(&np->n_flag); } return (EINTR); } @@ -1112,7 +1112,7 @@ nfs_vinvalbuf(struct vnode *vp, int flags, struct ucred *cred, np->n_flag &= ~(NMODIFIED | NFLUSHINPROG); if (np->n_flag & NFLUSHWANT) { np->n_flag &= ~NFLUSHWANT; - wakeup((caddr_t)&np->n_flag); + wakeup(&np->n_flag); } return (0); } @@ -1180,7 +1180,7 @@ again: nfs_iodwant[iod] = NULL; nfs_iodmount[iod] = nmp; nmp->nm_bufqiods++; - wakeup((caddr_t)&nfs_iodwant[iod]); + wakeup(&nfs_iodwant[iod]); } /* diff --git a/sys/nfsclient/nfs_nfsiod.c b/sys/nfsclient/nfs_nfsiod.c index 8762b16f1074..c244972b7b1e 100644 --- a/sys/nfsclient/nfs_nfsiod.c +++ b/sys/nfsclient/nfs_nfsiod.c @@ -144,7 +144,7 @@ sysctl_iodmax(SYSCTL_HANDLER_ARGS) iod = nfs_numasync - 1; for (i = 0; i < nfs_numasync - nfs_iodmax; i++) { if (nfs_iodwant[iod]) - wakeup((caddr_t)&nfs_iodwant[iod]); + wakeup(&nfs_iodwant[iod]); iod--; } return (0); @@ -244,7 +244,7 @@ nfssvc_iod(void *instance) * Always keep at least nfs_iodmin kthreads. */ timo = (myiod < nfs_iodmin) ? 0 : nfs_iodmaxidle * hz; - error = tsleep((caddr_t)&nfs_iodwant[myiod], PWAIT | PCATCH, + error = tsleep(&nfs_iodwant[myiod], PWAIT | PCATCH, "nfsidl", timo); } if (error) diff --git a/sys/nfsclient/nfs_socket.c b/sys/nfsclient/nfs_socket.c index 612ed3329a61..abb89d33f018 100644 --- a/sys/nfsclient/nfs_socket.c +++ b/sys/nfsclient/nfs_socket.c @@ -241,7 +241,7 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep) */ s = splnet(); while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) { - (void) tsleep((caddr_t)&so->so_timeo, + (void) tsleep(&so->so_timeo, PSOCK, "nfscon", 2 * hz); if ((so->so_state & SS_ISCONNECTING) && so->so_error == 0 && rep && @@ -353,7 +353,7 @@ nfs_reconnect(struct nfsreq *rep) while ((error = nfs_connect(nmp, rep)) != 0) { if (error == EINTR || error == ERESTART) return (EINTR); - (void) tsleep((caddr_t)&lbolt, PSOCK, "nfscon", 0); + (void) tsleep(&lbolt, PSOCK, "nfscon", 0); } /* @@ -1013,7 +1013,7 @@ tryagain: error = 0; waituntil = time_second + trylater_delay; while (time_second < waituntil) - (void) tsleep((caddr_t)&lbolt, + (void) tsleep(&lbolt, PSOCK, "nqnfstry", 0); trylater_delay *= nfs_backoff[trylater_cnt]; if (trylater_cnt < NFS_NBACKOFF - 1) @@ -1272,7 +1272,7 @@ nfs_sndlock(struct nfsreq *rep) if (nfs_sigintr(rep->r_nmp, rep, td)) return (EINTR); *statep |= NFSSTA_WANTSND; - (void) tsleep((caddr_t)statep, slpflag | (PZERO - 1), + (void) tsleep(statep, slpflag | (PZERO - 1), "nfsndlck", slptimeo); if (slpflag == PCATCH) { slpflag = 0; @@ -1296,7 +1296,7 @@ nfs_sndunlock(struct nfsreq *rep) *statep &= ~NFSSTA_SNDLOCK; if (*statep & NFSSTA_WANTSND) { *statep &= ~NFSSTA_WANTSND; - wakeup((caddr_t)statep); + wakeup(statep); } } @@ -1314,7 +1314,7 @@ nfs_rcvlock(struct nfsreq *rep) if (nfs_sigintr(rep->r_nmp, rep, rep->r_td)) return (EINTR); *statep |= NFSSTA_WANTRCV; - (void) tsleep((caddr_t)statep, slpflag | (PZERO - 1), "nfsrcvlk", + (void) tsleep(statep, slpflag | (PZERO - 1), "nfsrcvlk", slptimeo); /* * If our reply was recieved while we were sleeping, @@ -1349,7 +1349,7 @@ nfs_rcvunlock(struct nfsreq *rep) *statep &= ~NFSSTA_RCVLOCK; if (*statep & NFSSTA_WANTRCV) { *statep &= ~NFSSTA_WANTRCV; - wakeup((caddr_t)statep); + wakeup(statep); } } diff --git a/sys/nfsserver/nfs_srvcache.c b/sys/nfsserver/nfs_srvcache.c index 1986c0b62857..394fde752551 100644 --- a/sys/nfsserver/nfs_srvcache.c +++ b/sys/nfsserver/nfs_srvcache.c @@ -171,7 +171,7 @@ loop: NFS_DPF(RC, ("H%03x", rp->rc_xid & 0xfff)); if ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; - (void) tsleep((caddr_t)rp, PZERO-1, "nfsrc", 0); + (void) tsleep(rp, PZERO-1, "nfsrc", 0); goto loop; } rp->rc_flag |= RC_LOCKED; @@ -203,7 +203,7 @@ loop: rp->rc_flag &= ~RC_LOCKED; if (rp->rc_flag & RC_WANTED) { rp->rc_flag &= ~RC_WANTED; - wakeup((caddr_t)rp); + wakeup(rp); } return (ret); } @@ -219,7 +219,7 @@ loop: rp = TAILQ_FIRST(&nfsrvlruhead); while ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; - (void) tsleep((caddr_t)rp, PZERO-1, "nfsrc", 0); + (void) tsleep(rp, PZERO-1, "nfsrc", 0); rp = TAILQ_FIRST(&nfsrvlruhead); } rp->rc_flag |= RC_LOCKED; @@ -252,7 +252,7 @@ loop: rp->rc_flag &= ~RC_LOCKED; if (rp->rc_flag & RC_WANTED) { rp->rc_flag &= ~RC_WANTED; - wakeup((caddr_t)rp); + wakeup(rp); } return (RC_DOIT); } @@ -274,7 +274,7 @@ loop: NFS_DPF(RC, ("U%03x", rp->rc_xid & 0xfff)); if ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; - (void) tsleep((caddr_t)rp, PZERO-1, "nfsrc", 0); + (void) tsleep(rp, PZERO-1, "nfsrc", 0); goto loop; } rp->rc_flag |= RC_LOCKED; @@ -310,7 +310,7 @@ loop: rp->rc_flag &= ~RC_LOCKED; if (rp->rc_flag & RC_WANTED) { rp->rc_flag &= ~RC_WANTED; - wakeup((caddr_t)rp); + wakeup(rp); } return; } diff --git a/sys/nfsserver/nfs_srvsock.c b/sys/nfsserver/nfs_srvsock.c index 64833fd460a3..71ee5f2aaff0 100644 --- a/sys/nfsserver/nfs_srvsock.c +++ b/sys/nfsserver/nfs_srvsock.c @@ -705,7 +705,7 @@ nfsrv_wakenfsd(struct nfssvc_sock *slp) panic("nfsd wakeup"); slp->ns_sref++; nd->nfsd_slp = slp; - wakeup((caddr_t)nd); + wakeup(nd); return; } } diff --git a/sys/nfsserver/nfs_syscalls.c b/sys/nfsserver/nfs_syscalls.c index cf9bf90b5058..03737c39d3f3 100644 --- a/sys/nfsserver/nfs_syscalls.c +++ b/sys/nfsserver/nfs_syscalls.c @@ -150,7 +150,7 @@ nfssvc(struct thread *td, struct nfssvc_args *uap) mtx_lock(&Giant); while (nfssvc_sockhead_flag & SLP_INIT) { nfssvc_sockhead_flag |= SLP_WANTINIT; - (void) tsleep((caddr_t)&nfssvc_sockhead, PSOCK, "nfsd init", 0); + (void) tsleep(&nfssvc_sockhead, PSOCK, "nfsd init", 0); } if (uap->flag & NFSSVC_ADDSOCK) { error = copyin(uap->argp, (caddr_t)&nfsdarg, sizeof(nfsdarg)); @@ -316,7 +316,7 @@ nfssvc_nfsd(struct thread *td) (nfsd_head_flag & NFSD_CHECKSLP) == 0) { nfsd->nfsd_flag |= NFSD_WAITING; nfsd_waiting++; - error = tsleep((caddr_t)nfsd, PSOCK | PCATCH, + error = tsleep(nfsd, PSOCK | PCATCH, "nfsd", 0); nfsd_waiting--; if (error) @@ -611,7 +611,7 @@ nfs_slplock(struct nfssvc_sock *slp, int wait) return(0); /* already locked, fail */ while (*statep & NFSRV_SNDLOCK) { *statep |= NFSRV_WANTSND; - (void) tsleep((caddr_t)statep, PZERO - 1, "nfsslplck", 0); + (void) tsleep(statep, PZERO - 1, "nfsslplck", 0); } *statep |= NFSRV_SNDLOCK; return (1); @@ -630,7 +630,7 @@ nfs_slpunlock(struct nfssvc_sock *slp) *statep &= ~NFSRV_SNDLOCK; if (*statep & NFSRV_WANTSND) { *statep &= ~NFSRV_WANTSND; - wakeup((caddr_t)statep); + wakeup(statep); } } @@ -663,7 +663,7 @@ nfsrv_init(int terminating) nfssvc_sockhead_flag &= ~SLP_INIT; if (nfssvc_sockhead_flag & SLP_WANTINIT) { nfssvc_sockhead_flag &= ~SLP_WANTINIT; - wakeup((caddr_t)&nfssvc_sockhead); + wakeup(&nfssvc_sockhead); } TAILQ_INIT(&nfsd_head); diff --git a/sys/pc98/cbus/olpt.c b/sys/pc98/cbus/olpt.c index 5369e46a798b..6e41a420ec53 100644 --- a/sys/pc98/cbus/olpt.c +++ b/sys/pc98/cbus/olpt.c @@ -535,7 +535,7 @@ lptopen (dev_t dev, int flags, int fmt, struct thread *td) } /* wait 1/4 second, give up if we get a signal */ - if (tsleep ((caddr_t)sc, LPPRI|PCATCH, "lptinit", hz/4) != + if (tsleep (sc, LPPRI|PCATCH, "lptinit", hz/4) != EWOULDBLOCK) { sc->sc_state = 0; splx(s); @@ -601,7 +601,7 @@ lptout (void *arg) splx(pl); } else { sc->sc_state &= ~OBUSY; - wakeup((caddr_t)sc); + wakeup(sc); } } @@ -634,7 +634,7 @@ lptclose(dev_t dev, int flags, int fmt, struct thread *td) while ((inb(port+lpt_status) & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != (LPS_SEL|LPS_NBSY|LPS_NERR) || sc->sc_xfercnt) /* wait 1/4 second, give up if we get a signal */ - if (tsleep ((caddr_t)sc, LPPRI|PCATCH, + if (tsleep (sc, LPPRI|PCATCH, "lpclose", hz) != EWOULDBLOCK) break; @@ -692,7 +692,7 @@ pushbytes(struct lpt_softc * sc) */ if (tic > MAX_SLEEP) tic = MAX_SLEEP; - err = tsleep((caddr_t)sc, LPPRI, + err = tsleep(sc, LPPRI, "lptpoll", tic); if (err != EWOULDBLOCK) { return (err); @@ -754,7 +754,7 @@ lptwrite(dev_t dev, struct uio * uio, int ioflag) } lprintf(("W ")); if (sc->sc_state & OBUSY) - if ((err = tsleep ((caddr_t)sc, + if ((err = tsleep (sc, LPPRI|PCATCH, "lpwrite", 0))) { sc->sc_state |= INTERRUPTED; return(err); diff --git a/sys/pc98/cbus/ppc.c b/sys/pc98/cbus/ppc.c index b285fce0e391..d86793442d9d 100644 --- a/sys/pc98/cbus/ppc.c +++ b/sys/pc98/cbus/ppc.c @@ -1619,7 +1619,7 @@ ppcintr(void *arg) ppc->ppc_dmastat = PPC_DMA_COMPLETE; /* wakeup the waiting process */ - wakeup((caddr_t)ppc); + wakeup(ppc); } } } else if (ppc->ppc_irqstat & PPC_IRQ_FIFO) { @@ -1725,7 +1725,7 @@ ppc_write(device_t dev, char *buf, int len, int how) */ do { /* release CPU */ - error = tsleep((caddr_t)ppc, + error = tsleep(ppc, PPBPRI | PCATCH, "ppcdma", 0); } while (error == EWOULDBLOCK); @@ -1757,7 +1757,7 @@ ppc_write(device_t dev, char *buf, int len, int how) #ifdef PPC_DEBUG printf("Z"); #endif - error = tsleep((caddr_t)ppc, PPBPRI | PCATCH, "ppcfifo", hz/100); + error = tsleep(ppc, PPBPRI | PCATCH, "ppcfifo", hz/100); if (error != EWOULDBLOCK) { #ifdef PPC_DEBUG printf("I"); diff --git a/sys/pc98/pc98/atapi.c b/sys/pc98/pc98/atapi.c index 5c27dc277b01..d52fff5a6fea 100644 --- a/sys/pc98/pc98/atapi.c +++ b/sys/pc98/pc98/atapi.c @@ -509,7 +509,7 @@ static struct atapicmd *atapi_alloc (struct atapi *ata) struct atapicmd *ac; while (! ata->free) - tsleep ((caddr_t)ata, PRIBIO, "atacmd", 100); + tsleep (ata, PRIBIO, "atacmd", 100); ac = ata->free; ata->free = ac->next; ac->busy = 1; @@ -519,7 +519,7 @@ static struct atapicmd *atapi_alloc (struct atapi *ata) static void atapi_free (struct atapi *ata, struct atapicmd *ac) { if (! ata->free) - wakeup ((caddr_t)ata); + wakeup (ata); ac->busy = 0; ac->next = ata->free; ata->free = ac; @@ -553,7 +553,7 @@ static void atapi_done (struct atapi *ata) (*ac->callback) (ac->cbarg1, ac->cbarg2, ac->count, ac->result); atapi_free (ata, ac); } else - wakeup ((caddr_t)ac); + wakeup (ac); } /* @@ -899,7 +899,7 @@ struct atapires atapi_request_wait (struct atapi *ata, int unit, atapi_enqueue (ata, ac); wdstart (ata->ctrlr); if (ata->tail == ac) - tsleep ((caddr_t)ac, PRIBIO, "atareq", 0); + tsleep (ac, PRIBIO, "atareq", 0); result = ac->result; atapi_free (ata, ac); diff --git a/sys/pc98/pc98/mse.c b/sys/pc98/pc98/mse.c index 52bd373f712b..25035f5827f2 100644 --- a/sys/pc98/pc98/mse.c +++ b/sys/pc98/pc98/mse.c @@ -535,7 +535,7 @@ mseread(dev, uio, ioflag) return (0); } sc->sc_flags |= MSESC_WANT; - error = tsleep((caddr_t)sc, MSEPRI | PCATCH, + error = tsleep(sc, MSEPRI | PCATCH, "mseread", 0); if (error) { splx(s); @@ -814,7 +814,7 @@ mseintr(arg) (sc->sc_obuttons ^ sc->sc_buttons) != 0) { if (sc->sc_flags & MSESC_WANT) { sc->sc_flags &= ~MSESC_WANT; - wakeup((caddr_t)sc); + wakeup(sc); } selwakeup(&sc->sc_selp); } diff --git a/sys/pc98/pc98/olpt.c b/sys/pc98/pc98/olpt.c index 5369e46a798b..6e41a420ec53 100644 --- a/sys/pc98/pc98/olpt.c +++ b/sys/pc98/pc98/olpt.c @@ -535,7 +535,7 @@ lptopen (dev_t dev, int flags, int fmt, struct thread *td) } /* wait 1/4 second, give up if we get a signal */ - if (tsleep ((caddr_t)sc, LPPRI|PCATCH, "lptinit", hz/4) != + if (tsleep (sc, LPPRI|PCATCH, "lptinit", hz/4) != EWOULDBLOCK) { sc->sc_state = 0; splx(s); @@ -601,7 +601,7 @@ lptout (void *arg) splx(pl); } else { sc->sc_state &= ~OBUSY; - wakeup((caddr_t)sc); + wakeup(sc); } } @@ -634,7 +634,7 @@ lptclose(dev_t dev, int flags, int fmt, struct thread *td) while ((inb(port+lpt_status) & (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR)) != (LPS_SEL|LPS_NBSY|LPS_NERR) || sc->sc_xfercnt) /* wait 1/4 second, give up if we get a signal */ - if (tsleep ((caddr_t)sc, LPPRI|PCATCH, + if (tsleep (sc, LPPRI|PCATCH, "lpclose", hz) != EWOULDBLOCK) break; @@ -692,7 +692,7 @@ pushbytes(struct lpt_softc * sc) */ if (tic > MAX_SLEEP) tic = MAX_SLEEP; - err = tsleep((caddr_t)sc, LPPRI, + err = tsleep(sc, LPPRI, "lptpoll", tic); if (err != EWOULDBLOCK) { return (err); @@ -754,7 +754,7 @@ lptwrite(dev_t dev, struct uio * uio, int ioflag) } lprintf(("W ")); if (sc->sc_state & OBUSY) - if ((err = tsleep ((caddr_t)sc, + if ((err = tsleep (sc, LPPRI|PCATCH, "lpwrite", 0))) { sc->sc_state |= INTERRUPTED; return(err); diff --git a/sys/pc98/pc98/ppc.c b/sys/pc98/pc98/ppc.c index b285fce0e391..d86793442d9d 100644 --- a/sys/pc98/pc98/ppc.c +++ b/sys/pc98/pc98/ppc.c @@ -1619,7 +1619,7 @@ ppcintr(void *arg) ppc->ppc_dmastat = PPC_DMA_COMPLETE; /* wakeup the waiting process */ - wakeup((caddr_t)ppc); + wakeup(ppc); } } } else if (ppc->ppc_irqstat & PPC_IRQ_FIFO) { @@ -1725,7 +1725,7 @@ ppc_write(device_t dev, char *buf, int len, int how) */ do { /* release CPU */ - error = tsleep((caddr_t)ppc, + error = tsleep(ppc, PPBPRI | PCATCH, "ppcdma", 0); } while (error == EWOULDBLOCK); @@ -1757,7 +1757,7 @@ ppc_write(device_t dev, char *buf, int len, int how) #ifdef PPC_DEBUG printf("Z"); #endif - error = tsleep((caddr_t)ppc, PPBPRI | PCATCH, "ppcfifo", hz/100); + error = tsleep(ppc, PPBPRI | PCATCH, "ppcfifo", hz/100); if (error != EWOULDBLOCK) { #ifdef PPC_DEBUG printf("I"); diff --git a/sys/pc98/pc98/spkr.c b/sys/pc98/pc98/spkr.c index 3e3f43767dd3..a1fe003e388e 100644 --- a/sys/pc98/pc98/spkr.c +++ b/sys/pc98/pc98/spkr.c @@ -141,7 +141,7 @@ tone(thz, ticks) * emitted. */ if (ticks > 0) - tsleep((caddr_t)&endtone, SPKRPRI | PCATCH, "spkrtn", ticks); + tsleep(&endtone, SPKRPRI | PCATCH, "spkrtn", ticks); #ifdef PC98 outb(IO_PPI, inb(IO_PPI) | PPI_SPKR); sps = splclock(); @@ -169,7 +169,7 @@ rest(ticks) (void) printf("rest: %d\n", ticks); #endif /* DEBUG */ if (ticks > 0) - tsleep((caddr_t)&endrest, SPKRPRI | PCATCH, "spkrrs", ticks); + tsleep(&endrest, SPKRPRI | PCATCH, "spkrrs", ticks); } /**************** PLAY STRING INTERPRETER BEGINS HERE ********************** @@ -556,8 +556,8 @@ spkrclose(dev, flags, fmt, td) return(ENXIO); else { - wakeup((caddr_t)&endtone); - wakeup((caddr_t)&endrest); + wakeup(&endtone); + wakeup(&endrest); free(spkr_inbuf, M_SPKR); spkr_active = FALSE; return(0); diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index 0adbd5049cda..3d015f14c47a 100644 --- a/sys/pc98/pc98/syscons.c +++ b/sys/pc98/pc98/syscons.c @@ -1014,7 +1014,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) scp = SC_STAT(SC_DEV(sc, i)); if (scp == scp->sc->cur_scp) return 0; - while ((error=tsleep((caddr_t)&scp->smode, PZERO|PCATCH, + while ((error=tsleep(&scp->smode, PZERO|PCATCH, "waitvt", 0)) == ERESTART) ; return error; @@ -2100,7 +2100,7 @@ stop_scrn_saver(sc_softc_t *sc, void (*saver)(sc_softc_t *, int)) if (sc->delayed_next_scr) sc_switch_scr(sc, sc->delayed_next_scr - 1); if (debugger == 0) - wakeup((caddr_t)&scrn_blanked); + wakeup(&scrn_blanked); } static int @@ -2114,7 +2114,7 @@ wait_scrn_saver_stop(sc_softc_t *sc) error = 0; break; } - error = tsleep((caddr_t)&scrn_blanked, PZERO | PCATCH, "scrsav", 0); + error = tsleep(&scrn_blanked, PZERO | PCATCH, "scrsav", 0); if ((error != 0) && (error != ERESTART)) break; } @@ -2313,7 +2313,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr) * be invoked at splhigh(). */ if (debugger == 0) - wakeup((caddr_t)&sc->new_scp->smode); + wakeup(&sc->new_scp->smode); splx(s); DPRINTF(5, ("switch done (new == old)\n")); return 0; @@ -2336,7 +2336,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr) /* wake up processes waiting for this vty */ if (debugger == 0) - wakeup((caddr_t)&sc->cur_scp->smode); + wakeup(&sc->cur_scp->smode); /* wait for the controlling process to acknowledge, if necessary */ if (signal_vt_acq(sc->cur_scp)) { @@ -2362,7 +2362,7 @@ do_switch_scr(sc_softc_t *sc, int s) exchange_scr(sc); s = spltty(); /* sc->cur_scp == sc->new_scp */ - wakeup((caddr_t)&sc->cur_scp->smode); + wakeup(&sc->cur_scp->smode); /* wait for the controlling process to acknowledge, if necessary */ if (!signal_vt_acq(sc->cur_scp)) { diff --git a/sys/pci/meteor.c b/sys/pci/meteor.c index fd1f7f64c3b8..09bfbaed3878 100644 --- a/sys/pci/meteor.c +++ b/sys/pci/meteor.c @@ -692,7 +692,7 @@ meteor_intr(void *arg) * Wake up the user in single capture mode. */ if(mtr->flags & METEOR_SINGLE) - wakeup((caddr_t)mtr); + wakeup(mtr); /* * If the user requested to be notified via signal, * let them know the frame is complete. @@ -1145,12 +1145,12 @@ struct saa7116_regs *m; m = meteor[unit].base; m->cap_cntl = 0x0; - tsleep((caddr_t)m, METPRI, "Mreset", hz/50); + tsleep(m, METPRI, "Mreset", hz/50); m->cap_cntl = 0x8ff0; m->cap_cntl = 0x80c0; m->cap_cntl = 0x8040; - tsleep((caddr_t)m, METPRI, "Mreset", hz/10); + tsleep(m, METPRI, "Mreset", hz/10); m->cap_cntl = 0x80c0; return 0; @@ -1230,7 +1230,7 @@ meteor_close(dev_t dev, int flags, int fmt, struct thread *td) /* this should not happen, the read capture should have completed or in the very least recieved a signal before close is called. */ - wakeup((caddr_t)mtr); /* continue read */ + wakeup(mtr); /* continue read */ /* * Turn off capture mode. */ @@ -1316,7 +1316,7 @@ meteor_read(dev_t dev, struct uio *uio, int ioflag) /* Start capture */ start_capture(mtr, METEOR_SINGLE); - status=tsleep((caddr_t)mtr, METPRI, "capturing", 0); + status=tsleep(mtr, METPRI, "capturing", 0); if (!status) /* successful capture */ status = uiomove((caddr_t)mtr->bigbuf, count, uio); else @@ -1627,7 +1627,7 @@ meteor_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) start_capture(mtr, METEOR_SINGLE); /* wait for capture to complete */ - error=tsleep((caddr_t)mtr, METPRI, "capturing", 0); + error=tsleep(mtr, METPRI, "capturing", 0); if(error) printf("meteor%d: ioctl: tsleep error %d\n", unit, error); diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 6b22cfdf8413..a2e2ab62687f 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -261,7 +261,7 @@ struct xsocket { (sb)->sb_flags &= ~SB_LOCK; \ if ((sb)->sb_flags & SB_WANT) { \ (sb)->sb_flags &= ~SB_WANT; \ - wakeup((caddr_t)&(sb)->sb_flags); \ + wakeup(&(sb)->sb_flags); \ } \ } diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index c51b02a82785..367840470a84 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -388,7 +388,7 @@ sema_get(semap, interlock) semap->timo); FREE_LOCK(interlock); } else { - tsleep((caddr_t)semap, semap->prio, semap->name, + tsleep(semap, semap->prio, semap->name, semap->timo); } return (0); diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index 258241293e3f..f9db3c37967f 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -139,7 +139,7 @@ chkdq(ip, change, cred, flags) continue; while (dq->dq_flags & DQ_LOCK) { dq->dq_flags |= DQ_WANT; - (void) tsleep((caddr_t)dq, PINOD+1, "chkdq1", 0); + (void) tsleep(dq, PINOD+1, "chkdq1", 0); } ncurblocks = dq->dq_curblocks + change; if (ncurblocks >= 0) @@ -165,7 +165,7 @@ chkdq(ip, change, cred, flags) continue; while (dq->dq_flags & DQ_LOCK) { dq->dq_flags |= DQ_WANT; - (void) tsleep((caddr_t)dq, PINOD+1, "chkdq2", 0); + (void) tsleep(dq, PINOD+1, "chkdq2", 0); } /* Reset timer when crossing soft limit */ if (dq->dq_curblocks + change >= dq->dq_bsoftlimit && @@ -261,7 +261,7 @@ chkiq(ip, change, cred, flags) continue; while (dq->dq_flags & DQ_LOCK) { dq->dq_flags |= DQ_WANT; - (void) tsleep((caddr_t)dq, PINOD+1, "chkiq1", 0); + (void) tsleep(dq, PINOD+1, "chkiq1", 0); } ncurinodes = dq->dq_curinodes + change; /* XXX: ncurinodes is unsigned */ @@ -288,7 +288,7 @@ chkiq(ip, change, cred, flags) continue; while (dq->dq_flags & DQ_LOCK) { dq->dq_flags |= DQ_WANT; - (void) tsleep((caddr_t)dq, PINOD+1, "chkiq2", 0); + (void) tsleep(dq, PINOD+1, "chkiq2", 0); } /* Reset timer when crossing soft limit */ if (dq->dq_curinodes + change >= dq->dq_isoftlimit && @@ -586,7 +586,7 @@ setquota(mp, id, type, addr) dq = ndq; while (dq->dq_flags & DQ_LOCK) { dq->dq_flags |= DQ_WANT; - (void) tsleep((caddr_t)dq, PINOD+1, "setqta", 0); + (void) tsleep(dq, PINOD+1, "setqta", 0); } /* * Copy all but the current values. @@ -647,7 +647,7 @@ setuse(mp, id, type, addr) dq = ndq; while (dq->dq_flags & DQ_LOCK) { dq->dq_flags |= DQ_WANT; - (void) tsleep((caddr_t)dq, PINOD+1, "setuse", 0); + (void) tsleep(dq, PINOD+1, "setuse", 0); } /* * Reset time limit if have a soft limit and were @@ -862,7 +862,7 @@ dqget(vp, id, ump, type, dqp) if (vp != dqvp) VOP_UNLOCK(dqvp, 0, td); if (dq->dq_flags & DQ_WANT) - wakeup((caddr_t)dq); + wakeup(dq); dq->dq_flags = 0; /* * I/O error in reading quota file, release @@ -951,7 +951,7 @@ dqsync(vp, dq) vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY, td); while (dq->dq_flags & DQ_LOCK) { dq->dq_flags |= DQ_WANT; - (void) tsleep((caddr_t)dq, PINOD+2, "dqsync", 0); + (void) tsleep(dq, PINOD+2, "dqsync", 0); if ((dq->dq_flags & DQ_MOD) == 0) { if (vp != dqvp) VOP_UNLOCK(dqvp, 0, td); @@ -972,7 +972,7 @@ dqsync(vp, dq) if (auio.uio_resid && error == 0) error = EIO; if (dq->dq_flags & DQ_WANT) - wakeup((caddr_t)dq); + wakeup(dq); dq->dq_flags &= ~(DQ_MOD|DQ_LOCK|DQ_WANT); if (vp != dqvp) VOP_UNLOCK(dqvp, 0, td); -- cgit v1.3 From 95e4359c8eeb5f4679bc20a182e99c80274f45db Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sun, 2 Mar 2003 18:51:46 +0000 Subject: Use canonical format for cdevsw initialization. --- sys/dev/digi/digi.c | 28 ++++++++++++++-------------- sys/dev/firewire/fwdev.c | 15 +++++++++++++-- sys/dev/raidframe/rf_freebsdkintf.c | 26 +++++++++++++------------- sys/dev/twe/twe_freebsd.c | 26 +++++++++++++------------- sys/dev/usb/ufm.c | 17 +++++++++++++---- sys/dev/usb/urio.c | 17 +++++++++++++---- 6 files changed, 79 insertions(+), 50 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c index 57f60222dc24..ab86ad5922c9 100644 --- a/sys/dev/digi/digi.c +++ b/sys/dev/digi/digi.c @@ -143,20 +143,20 @@ const struct digi_control_signals digi_normal_signals = { }; static struct cdevsw digi_sw = { - digiopen, /* open */ - digiclose, /* close */ - digiread, /* read */ - digiwrite, /* write */ - digiioctl, /* ioctl */ - ttypoll, /* poll */ - nommap, /* mmap */ - nostrategy, /* strategy */ - driver_name, /* name */ - CDEV_MAJOR, /* maj */ - nodump, /* dump */ - nopsize, /* psize */ - D_TTY | D_KQFILTER, /* flags */ - ttykqfilter /* bmaj */ + /* open */ digiopen, + /* close */ digiclose, + /* read */ digiread, + /* write */ digiwrite, + /* ioctl */ digiioctl, + /* poll */ ttypoll, + /* mmap */ nommap, + /* strategy */ nostrategy, + /* name */ driver_name, + /* maj */ CDEV_MAJOR, + /* dump */ nodump, + /* psize */ nopsize, + /* flags */ D_TTY | D_KQFILTER, + /* kqfilter */ ttykqfilter }; static void diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 36464ab475bb..35f221c9efa9 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -67,8 +67,19 @@ static d_mmap_t fw_mmap; struct cdevsw firewire_cdevsw = { - fw_open, fw_close, fw_read, fw_write, fw_ioctl, - fw_poll, fw_mmap, nostrategy, "fw", CDEV_MAJOR, nodump, nopsize, D_MEM + /* open */ fw_open, + /* close */ fw_close, + /* read */ fw_read, + /* write */ fw_write, + /* ioctl */ fw_ioctl, + /* poll */ fw_poll, + /* mmap */ fw_mmap, + /* strategy */ nostrategy, + /* name */ "fw", + /* maj */ CDEV_MAJOR, + /* dump */ nodump, + /* psize */ nopsize, + /* flags */ D_MEM }; static int diff --git a/sys/dev/raidframe/rf_freebsdkintf.c b/sys/dev/raidframe/rf_freebsdkintf.c index 8af232a36847..754ab514f169 100644 --- a/sys/dev/raidframe/rf_freebsdkintf.c +++ b/sys/dev/raidframe/rf_freebsdkintf.c @@ -215,19 +215,19 @@ d_close_t raidctlclose; d_ioctl_t raidctlioctl; static struct cdevsw raidctl_cdevsw = { - raidctlopen, - raidctlclose, - noread, - nowrite, - raidctlioctl, - nopoll, - nommap, - nostrategy, - "raidctl", - 201, - nodump, - nopsize, - 0, + /* open */ raidctlopen, + /* close */ raidctlclose, + /* read */ noread, + /* write */ nowrite, + /* ioctl */ raidctlioctl, + /* poll */ nopoll, + /* mmap */ nommap, + /* strategy */ nostrategy, + /* name */ "raidctl", + /* maj */ 201, + /* dump */ nodump, + /* psize */ nopsize, + /* flags */ 0, }; /* diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c index 7acdbadcdae9..96c9d5ac1409 100644 --- a/sys/dev/twe/twe_freebsd.c +++ b/sys/dev/twe/twe_freebsd.c @@ -71,19 +71,19 @@ static d_ioctl_t twe_ioctl_wrapper; #define TWE_CDEV_MAJOR 146 static struct cdevsw twe_cdevsw = { - twe_open, - twe_close, - noread, - nowrite, - twe_ioctl_wrapper, - nopoll, - nommap, - nostrategy, - "twe", - TWE_CDEV_MAJOR, - nodump, - nopsize, - 0 + /* open */ twe_open, + /* close */ twe_close, + /* read */ noread, + /* write */ nowrite, + /* ioctl */ twe_ioctl_wrapper, + /* poll */ nopoll, + /* mmap */ nommap, + /* strategy */ nostrategy, + /* name */ "twe", + /* maj */ TWE_CDEV_MAJOR, + /* dump */ nodump, + /* psize */ nopsize, + /* flags */ 0 }; /******************************************************************************** diff --git a/sys/dev/usb/ufm.c b/sys/dev/usb/ufm.c index 5269a8dd867c..42c7a43fb9bc 100644 --- a/sys/dev/usb/ufm.c +++ b/sys/dev/usb/ufm.c @@ -90,10 +90,19 @@ d_ioctl_t ufmioctl; #define UFM_CDEV_MAJOR MAJOR_AUTO Static struct cdevsw ufm_cdevsw = { - ufmopen, ufmclose, noread, nowrite, - ufmioctl, nopoll, nommap, nostrategy, - "ufm", UFM_CDEV_MAJOR, nodump, nopsize, - 0, + /* open */ ufmopen, + /* close */ ufmclose, + /* read */ noread, + /* write */ nowrite, + /* ioctl */ ufmioctl, + /* poll */ nopoll, + /* mmap */ nommap, + /* strategy */ nostrategy, + /* name */ "ufm", + /* maj */ UFM_CDEV_MAJOR, + /* dump */ nodump, + /* psize */ nopsize, + /* flags */ 0, #if (__FreeBSD_version < 500014) -1 #endif diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index ba9ca84b96d2..e5f6cc75b01e 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -116,10 +116,19 @@ d_ioctl_t urioioctl; #define URIO_CDEV_MAJOR 143 Static struct cdevsw urio_cdevsw = { - urioopen, urioclose, urioread, uriowrite, - urioioctl, nopoll, nommap, nostrategy, - "urio", URIO_CDEV_MAJOR,nodump, nopsize, - 0, + /* open */ urioopen, + /* close */ urioclose, + /* read */ urioread, + /* write */ uriowrite, + /* ioctl */ urioioctl, + /* poll */ nopoll, + /* mmap */ nommap, + /* strategy */ nostrategy, + /* name */ "urio", + /* maj */ URIO_CDEV_MAJOR, + /* dump */ nodump, + /* psize */ nopsize, + /* flags */ 0, #if __FreeBSD_version < 500014 -1 #endif -- cgit v1.3 From 7ac40f5f59dea6e9ab4869e974bdd4026274e921 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Mon, 3 Mar 2003 12:15:54 +0000 Subject: Gigacommit to improve device-driver source compatibility between branches: Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values. This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386. Approved by: re(scottl) --- sys/alpha/alpha/mem.c | 22 +++++++-------- sys/alpha/alpha/promcons.c | 21 ++++++--------- sys/alpha/tlsb/zs_tlsb.c | 21 ++++++--------- sys/amd64/acpica/acpi_machdep.c | 20 +++++--------- sys/amd64/amd64/mem.c | 22 +++++++-------- sys/cam/cam_xpt.c | 18 ++++--------- sys/cam/scsi/scsi_cd.c | 22 +++++++-------- sys/cam/scsi/scsi_ch.c | 18 ++++--------- sys/cam/scsi/scsi_pass.c | 18 ++++--------- sys/cam/scsi/scsi_pt.c | 21 ++++++--------- sys/cam/scsi/scsi_sa.c | 22 +++++++-------- sys/cam/scsi/scsi_ses.c | 18 ++++--------- sys/cam/scsi/scsi_target.c | 24 +++++++---------- sys/coda/coda_fbsd.c | 21 ++++++--------- sys/contrib/ipfilter/netinet/mlfk_ipl.c | 19 +++++-------- sys/dev/aac/aac.c | 19 +++++-------- sys/dev/acpica/acpi.c | 18 ++++--------- sys/dev/agp/agp.c | 20 +++++--------- sys/dev/amr/amr.c | 18 ++++--------- sys/dev/asr/asr.c | 18 ++++--------- sys/dev/ata/ata-all.c | 18 ++++--------- sys/dev/ata/atapi-cd.c | 22 +++++++-------- sys/dev/ata/atapi-tape.c | 22 +++++++-------- sys/dev/atkbdc/psm.c | 20 +++++--------- sys/dev/bktr/bktr_os.c | 22 +++++++-------- sys/dev/ccd/ccd.c | 18 ++++--------- sys/dev/ciss/ciss.c | 19 ++++--------- sys/dev/cy/cy.c | 24 +++++++---------- sys/dev/cy/cy_isa.c | 24 +++++++---------- sys/dev/dgb/dgb.c | 24 +++++++---------- sys/dev/digi/digi.c | 24 +++++++---------- sys/dev/drm/drm_drv.h | 25 ++++++++--------- sys/dev/fb/fb.c | 21 ++++++--------- sys/dev/fdc/fdc.c | 22 +++++++-------- sys/dev/firewire/fwdev.c | 23 +++++++--------- sys/dev/hfa/fore_load.c | 14 +--------- sys/dev/iicbus/iic.c | 20 +++++--------- sys/dev/iir/iir_ctrl.c | 21 +++++---------- sys/dev/isp/isp_freebsd.c | 19 +++++-------- sys/dev/joy/joy.c | 19 +++++-------- sys/dev/kbd/kbd.c | 21 ++++++--------- sys/dev/mcd/mcd.c | 21 ++++++--------- sys/dev/md/md.c | 15 ++++------- sys/dev/mlx/mlx.c | 18 ++++--------- sys/dev/mly/mly.c | 18 ++++--------- sys/dev/mse/mse.c | 20 +++++--------- sys/dev/nmdm/nmdm.c | 22 +++++++-------- sys/dev/null/null.c | 42 ++++++++++------------------- sys/dev/ofw/ofw_console.c | 21 ++++++--------- sys/dev/ofw/openfirmio.c | 19 ++++--------- sys/dev/pci/pci_user.c | 18 ++++--------- sys/dev/ppbus/lpt.c | 20 +++++--------- sys/dev/ppbus/pcfclock.c | 18 ++++--------- sys/dev/ppbus/ppi.c | 20 +++++--------- sys/dev/ppbus/pps.c | 18 ++++--------- sys/dev/raidframe/rf_freebsdkintf.c | 18 ++++--------- sys/dev/random/randomdev.c | 22 ++++++--------- sys/dev/rc/rc.c | 24 +++++++---------- sys/dev/rp/rp.c | 22 +++++++-------- sys/dev/sab/sab.c | 24 +++++++---------- sys/dev/scd/scd.c | 21 ++++++--------- sys/dev/si/si.c | 24 +++++++---------- sys/dev/sio/sio.c | 24 +++++++---------- sys/dev/smbus/smb.c | 20 +++++--------- sys/dev/snp/snp.c | 21 ++++++--------- sys/dev/sound/midi/midi.c | 21 ++++++--------- sys/dev/sound/midi/sequencer.c | 21 ++++++--------- sys/dev/sound/pcm/dsp.c | 22 +++++++-------- sys/dev/sound/pcm/mixer.c | 18 ++++--------- sys/dev/sound/pcm/sndstat.c | 18 ++++--------- sys/dev/speaker/spkr.c | 19 +++++-------- sys/dev/streams/streams.c | 16 +++-------- sys/dev/syscons/syscons.c | 25 ++++++++--------- sys/dev/syscons/sysmouse.c | 21 ++++++--------- sys/dev/tdfx/tdfx_pci.c | 19 +++++-------- sys/dev/tga/tga_pci.c | 22 ++++++--------- sys/dev/ti/if_ti.c | 18 ++++--------- sys/dev/twe/twe_freebsd.c | 18 ++++--------- sys/dev/usb/ucom.c | 24 +++++++---------- sys/dev/usb/ufm.c | 18 ++++--------- sys/dev/usb/ugen.c | 21 ++++++--------- sys/dev/usb/uhid.c | 21 ++++++--------- sys/dev/usb/ulpt.c | 19 +++++-------- sys/dev/usb/ums.c | 20 +++++--------- sys/dev/usb/urio.c | 20 +++++--------- sys/dev/usb/usb.c | 20 +++++--------- sys/dev/usb/uscanner.c | 20 +++++--------- sys/dev/vinum/vinum.c | 22 +++++++-------- sys/dev/zs/zs.c | 24 +++++++---------- sys/fs/coda/coda_fbsd.c | 21 ++++++--------- sys/geom/geom_ccd.c | 18 ++++--------- sys/geom/geom_dev.c | 23 +++++++--------- sys/geom/geom_stats.c | 18 ++++--------- sys/i386/acpica/acpi_machdep.c | 20 +++++--------- sys/i386/apm/apm.c | 20 +++++--------- sys/i386/bios/apm.c | 20 +++++--------- sys/i386/bios/smapi.c | 20 +++++--------- sys/i386/i386/elan-mmcr.c | 20 +++++--------- sys/i386/i386/mem.c | 22 +++++++-------- sys/i386/i386/perfmon.c | 18 ++++--------- sys/i386/isa/asc.c | 20 +++++--------- sys/i386/isa/ctx.c | 20 +++++--------- sys/i386/isa/cx.c | 24 +++++++---------- sys/i386/isa/cy.c | 24 +++++++---------- sys/i386/isa/gpib.c | 19 +++++-------- sys/i386/isa/gsc.c | 19 +++++-------- sys/i386/isa/istallion.c | 24 +++++++---------- sys/i386/isa/loran.c | 19 +++++-------- sys/i386/isa/mse.c | 20 +++++--------- sys/i386/isa/pcaudio.c | 20 +++++--------- sys/i386/isa/pcvt/pcvt_drv.c | 25 ++++++++--------- sys/i386/isa/spic.c | 20 +++++--------- sys/i386/isa/spigot.c | 21 ++++++--------- sys/i386/isa/spkr.c | 19 +++++-------- sys/i386/isa/stallion.c | 24 +++++++---------- sys/i386/isa/tw.c | 20 +++++--------- sys/i386/isa/wt.c | 21 ++++++--------- sys/i386/smapi/smapi.c | 20 +++++--------- sys/i4b/driver/i4b_ctl.c | 19 +++++-------- sys/i4b/driver/i4b_rbch.c | 21 ++++++--------- sys/i4b/driver/i4b_tel.c | 21 ++++++--------- sys/i4b/driver/i4b_trace.c | 20 +++++--------- sys/i4b/layer4/i4b_i4bdrv.c | 20 +++++--------- sys/ia64/ia64/mem.c | 22 +++++++-------- sys/ia64/ia64/ssc.c | 21 ++++++--------- sys/isa/fd.c | 22 +++++++-------- sys/isa/psm.c | 20 +++++--------- sys/isa/vga_isa.c | 21 ++++++--------- sys/kern/kern_conf.c | 26 +++++++++--------- sys/kern/kern_descrip.c | 16 +++-------- sys/kern/subr_bus.c | 20 +++++--------- sys/kern/subr_log.c | 20 +++++--------- sys/kern/tty_cons.c | 24 +++++++---------- sys/kern/tty_pty.c | 48 ++++++++++++++------------------- sys/kern/tty_tty.c | 18 ++++--------- sys/net/bpf.c | 21 ++++++--------- sys/net/if.c | 21 +++++---------- sys/net/if_tap.c | 21 ++++++--------- sys/net/if_tun.c | 21 ++++++--------- sys/netgraph/ng_device.c | 21 ++++++--------- sys/netncp/ncp_mod.c | 18 ++++--------- sys/netsmb/smb_dev.c | 18 ++++--------- sys/opencrypto/cryptodev.c | 21 +++++---------- sys/pc98/apm/apm.c | 20 +++++--------- sys/pc98/cbus/fdc.c | 22 +++++++-------- sys/pc98/cbus/gdc.c | 21 ++++++--------- sys/pc98/cbus/olpt.c | 19 +++++-------- sys/pc98/cbus/sio.c | 24 +++++++---------- sys/pc98/pc98/fd.c | 22 +++++++-------- sys/pc98/pc98/mse.c | 20 +++++--------- sys/pc98/pc98/olpt.c | 19 +++++-------- sys/pc98/pc98/pc98gdc.c | 21 ++++++--------- sys/pc98/pc98/pcaudio.c | 20 +++++--------- sys/pc98/pc98/sio.c | 24 +++++++---------- sys/pc98/pc98/spkr.c | 19 +++++-------- sys/pc98/pc98/syscons.c | 25 ++++++++--------- sys/pc98/pc98/wd_cd.c | 22 +++++++-------- sys/pccard/pccard.c | 21 ++++++--------- sys/pci/agp.c | 20 +++++--------- sys/pci/if_ti.c | 18 ++++--------- sys/pci/meteor.c | 21 ++++++--------- sys/pci/xrpu.c | 19 +++++-------- sys/sparc64/sparc64/mem.c | 20 +++++--------- 163 files changed, 1217 insertions(+), 2179 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/alpha/alpha/mem.c b/sys/alpha/alpha/mem.c index 18fb05e9ffc3..48dd885135b4 100644 --- a/sys/alpha/alpha/mem.c +++ b/sys/alpha/alpha/mem.c @@ -80,19 +80,15 @@ static d_mmap_t memmmap; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { - /* open */ mmopen, - /* close */ mmclose, - /* read */ mmrw, - /* write */ mmrw, - /* ioctl */ mmioctl, - /* poll */ (d_poll_t *)seltrue, - /* mmap */ memmmap, - /* strategy */ nostrategy, - /* name */ "mem", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_MEM, + .d_open = mmopen, + .d_close = mmclose, + .d_read = mmrw, + .d_write = mmrw, + .d_ioctl = mmioctl, + .d_mmap = memmmap, + .d_name = "mem", + .d_maj = CDEV_MAJOR, + .d_flags = D_MEM, }; struct mem_range_softc mem_range_softc; diff --git a/sys/alpha/alpha/promcons.c b/sys/alpha/alpha/promcons.c index 6445625a90cd..64533819ca23 100644 --- a/sys/alpha/alpha/promcons.c +++ b/sys/alpha/alpha/promcons.c @@ -64,19 +64,14 @@ static d_ioctl_t promioctl; #define CDEV_MAJOR 97 static struct cdevsw prom_cdevsw = { - /* open */ promopen, - /* close */ promclose, - /* read */ ttyread, - /* write */ ttywrite, - /* ioctl */ promioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "prom", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = promopen, + .d_close = promclose, + .d_read = ttyread, + .d_write = ttywrite, + .d_ioctl = promioctl, + .d_poll = ttypoll, + .d_name = "prom", + .d_maj = CDEV_MAJOR, }; diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c index c22e4fc99f21..bc82c3c7de0a 100644 --- a/sys/alpha/tlsb/zs_tlsb.c +++ b/sys/alpha/tlsb/zs_tlsb.c @@ -69,19 +69,14 @@ static d_ioctl_t zsioctl; #define CDEV_MAJOR 135 static struct cdevsw zs_cdevsw = { - /* open */ zsopen, - /* close */ zsclose, - /* read */ ttyread, - /* write */ ttywrite, - /* ioctl */ zsioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "zs", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = zsopen, + .d_close = zsclose, + .d_read = ttyread, + .d_write = ttywrite, + .d_ioctl = zsioctl, + .d_poll = ttypoll, + .d_name = "zs", + .d_maj = CDEV_MAJOR, }; static void zsstart(struct tty *); diff --git a/sys/amd64/acpica/acpi_machdep.c b/sys/amd64/acpica/acpi_machdep.c index fbf649b4627a..c0d8b91dfa62 100644 --- a/sys/amd64/acpica/acpi_machdep.c +++ b/sys/amd64/acpica/acpi_machdep.c @@ -64,19 +64,13 @@ static d_poll_t apmpoll; #define CDEV_MAJOR 39 static struct cdevsw apm_cdevsw = { - /* open */ apmopen, - /* close */ apmclose, - /* read */ noread, - /* write */ apmwrite, - /* ioctl */ apmioctl, - /* poll */ apmpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "apm", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = apmopen, + .d_close = apmclose, + .d_write = apmwrite, + .d_ioctl = apmioctl, + .d_poll = apmpoll, + .d_name = "apm", + .d_maj = CDEV_MAJOR, }; static int diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index a045d962d2c2..cae4f6a0ce2d 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -78,19 +78,15 @@ static d_mmap_t memmmap; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { - /* open */ mmopen, - /* close */ mmclose, - /* read */ mmrw, - /* write */ mmrw, - /* ioctl */ mmioctl, - /* poll */ (d_poll_t *)seltrue, - /* mmap */ memmmap, - /* strategy */ nostrategy, - /* name */ "mem", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_MEM, + .d_open = mmopen, + .d_close = mmclose, + .d_read = mmrw, + .d_write = mmrw, + .d_ioctl = mmioctl, + .d_mmap = memmmap, + .d_name = "mem", + .d_maj = CDEV_MAJOR, + .d_flags = D_MEM, }; MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index e22357b4e636..0678380e1dc8 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -636,19 +636,11 @@ static d_close_t xptclose; static d_ioctl_t xptioctl; static struct cdevsw xpt_cdevsw = { - /* open */ xptopen, - /* close */ xptclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ xptioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "xpt", - /* maj */ XPT_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = xptopen, + .d_close = xptclose, + .d_ioctl = xptioctl, + .d_name = "xpt", + .d_maj = XPT_CDEV_MAJOR, }; static struct intr_config_hook *xpt_config_hook; diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index f785962786f2..a76ec02107c9 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -288,19 +288,15 @@ static struct periph_driver cddriver = PERIPHDRIVER_DECLARE(cd, cddriver); static struct cdevsw cd_cdevsw = { - /* open */ cdopen, - /* close */ cdclose, - /* read */ physread, - /* write */ physwrite, - /* ioctl */ cdioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ cdstrategy, - /* name */ "cd", - /* maj */ CD_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_DISK, + .d_open = cdopen, + .d_close = cdclose, + .d_read = physread, + .d_write = physwrite, + .d_ioctl = cdioctl, + .d_strategy = cdstrategy, + .d_name = "cd", + .d_maj = CD_CDEV_MAJOR, + .d_flags = D_DISK, }; static int num_changers; diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c index fcbb53bac37b..d64b78c6c2cc 100644 --- a/sys/cam/scsi/scsi_ch.c +++ b/sys/cam/scsi/scsi_ch.c @@ -211,19 +211,11 @@ static struct periph_driver chdriver = PERIPHDRIVER_DECLARE(ch, chdriver); static struct cdevsw ch_cdevsw = { - /* open */ chopen, - /* close */ chclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ chioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ch", - /* maj */ CH_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = chopen, + .d_close = chclose, + .d_ioctl = chioctl, + .d_name = "ch", + .d_maj = CH_CDEV_MAJOR, }; static void diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c index 13580a00ee4b..bbe9939ce02d 100644 --- a/sys/cam/scsi/scsi_pass.c +++ b/sys/cam/scsi/scsi_pass.c @@ -105,19 +105,11 @@ static struct periph_driver passdriver = PERIPHDRIVER_DECLARE(pass, passdriver); static struct cdevsw pass_cdevsw = { - /* open */ passopen, - /* close */ passclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ passioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "pass", - /* maj */ PASS_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = passopen, + .d_close = passclose, + .d_ioctl = passioctl, + .d_name = "pass", + .d_maj = PASS_CDEV_MAJOR, }; static void diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c index a7c29e7442dc..ec3409b6c3b5 100644 --- a/sys/cam/scsi/scsi_pt.c +++ b/sys/cam/scsi/scsi_pt.c @@ -118,19 +118,14 @@ PERIPHDRIVER_DECLARE(pt, ptdriver); #define PT_CDEV_MAJOR 61 static struct cdevsw pt_cdevsw = { - /* open */ ptopen, - /* close */ ptclose, - /* read */ physread, - /* write */ physwrite, - /* ioctl */ ptioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ ptstrategy, - /* name */ "pt", - /* maj */ PT_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = ptopen, + .d_close = ptclose, + .d_read = physread, + .d_write = physwrite, + .d_ioctl = ptioctl, + .d_strategy = ptstrategy, + .d_name = "pt", + .d_maj = PT_CDEV_MAJOR, }; #ifndef SCSI_PT_DEFAULT_TIMEOUT diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index e77865bee5e7..6ab3b5a438e6 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -426,19 +426,15 @@ PERIPHDRIVER_DECLARE(sa, sadriver); #define SA_CDEV_MAJOR 14 static struct cdevsw sa_cdevsw = { - /* open */ saopen, - /* close */ saclose, - /* read */ physread, - /* write */ physwrite, - /* ioctl */ saioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ sastrategy, - /* name */ "sa", - /* maj */ SA_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TAPE, + .d_open = saopen, + .d_close = saclose, + .d_read = physread, + .d_write = physwrite, + .d_ioctl = saioctl, + .d_strategy = sastrategy, + .d_name = "sa", + .d_maj = SA_CDEV_MAJOR, + .d_flags = D_TAPE, }; static int diff --git a/sys/cam/scsi/scsi_ses.c b/sys/cam/scsi/scsi_ses.c index 096c08bd245a..fcdb4507513f 100644 --- a/sys/cam/scsi/scsi_ses.c +++ b/sys/cam/scsi/scsi_ses.c @@ -176,19 +176,11 @@ PERIPHDRIVER_DECLARE(ses, sesdriver); static struct cdevsw ses_cdevsw = { - /* open */ sesopen, - /* close */ sesclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ sesioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ses", - /* maj */ SES_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = sesopen, + .d_close = sesclose, + .d_ioctl = sesioctl, + .d_name = "ses", + .d_maj = SES_CDEV_MAJOR, }; static void diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c index 4e95c06dd06b..de7e05cea617 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -105,20 +105,16 @@ static struct filterops targread_filtops = #define TARG_CDEV_MAJOR 65 static struct cdevsw targ_cdevsw = { - /* open */ targopen, - /* close */ targclose, - /* read */ targread, - /* write */ targwrite, - /* ioctl */ targioctl, - /* poll */ targpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "targ", - /* maj */ TARG_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_KQFILTER, - /* kqfilter */ targkqfilter + .d_open = targopen, + .d_close = targclose, + .d_read = targread, + .d_write = targwrite, + .d_ioctl = targioctl, + .d_poll = targpoll, + .d_name = "targ", + .d_maj = TARG_CDEV_MAJOR, + .d_flags = D_KQFILTER, + .d_kqfilter = targkqfilter }; static cam_status targendislun(struct cam_path *path, int enable, diff --git a/sys/coda/coda_fbsd.c b/sys/coda/coda_fbsd.c index 6907c63b58c9..23ce5e4f8a17 100644 --- a/sys/coda/coda_fbsd.c +++ b/sys/coda/coda_fbsd.c @@ -66,19 +66,14 @@ #define VC_DEV_NO 93 static struct cdevsw codadevsw = { - /* open */ vc_nb_open, - /* close */ vc_nb_close, - /* read */ vc_nb_read, - /* write */ vc_nb_write, - /* ioctl */ vc_nb_ioctl, - /* poll */ vc_nb_poll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "Coda", - /* maj */ VC_DEV_NO, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = vc_nb_open, + .d_close = vc_nb_close, + .d_read = vc_nb_read, + .d_write = vc_nb_write, + .d_ioctl = vc_nb_ioctl, + .d_poll = vc_nb_poll, + .d_name = "Coda", + .d_maj = VC_DEV_NO, }; int vcdebug = 1; diff --git a/sys/contrib/ipfilter/netinet/mlfk_ipl.c b/sys/contrib/ipfilter/netinet/mlfk_ipl.c index a9386c44e4e6..f1500039bb8f 100644 --- a/sys/contrib/ipfilter/netinet/mlfk_ipl.c +++ b/sys/contrib/ipfilter/netinet/mlfk_ipl.c @@ -105,19 +105,12 @@ SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_minttllog, CTLFLAG_RW, #define CDEV_MAJOR 79 static struct cdevsw ipl_cdevsw = { - /* open */ iplopen, - /* close */ iplclose, - /* read */ iplread, - /* write */ nowrite, - /* ioctl */ iplioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ipl", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = iplopen, + .d_close = iplclose, + .d_read = iplread, + .d_ioctl = iplioctl, + .d_name = "ipl", + .d_maj = CDEV_MAJOR, }; static int diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 619ffd413d15..0eb036cf26aa 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -182,19 +182,12 @@ static int aac_query_disk(struct aac_softc *sc, caddr_t uptr); #define AAC_CDEV_MAJOR 150 static struct cdevsw aac_cdevsw = { - aac_open, /* open */ - aac_close, /* close */ - noread, /* read */ - nowrite, /* write */ - aac_ioctl, /* ioctl */ - aac_poll, /* poll */ - nommap, /* mmap */ - nostrategy, /* strategy */ - "aac", /* name */ - AAC_CDEV_MAJOR, /* major */ - nodump, /* dump */ - nopsize, /* psize */ - 0, /* flags */ + .d_open = aac_open, + .d_close = aac_close, + .d_ioctl = aac_ioctl, + .d_poll = aac_poll, + .d_name = "aac", + .d_maj = AAC_CDEV_MAJOR, }; MALLOC_DEFINE(M_AACBUF, "aacbuf", "Buffers for the AAC driver"); diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 13b516ccaf52..ff4092a5c935 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -74,19 +74,11 @@ static d_ioctl_t acpiioctl; #define CDEV_MAJOR 152 static struct cdevsw acpi_cdevsw = { - /* open */ acpiopen, - /* close */ acpiclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ acpiioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "acpi", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0 + .d_open = acpiopen, + .d_close = acpiclose, + .d_ioctl = acpiioctl, + .d_name = "acpi", + .d_maj = CDEV_MAJOR, }; static const char* sleep_state_names[] = { diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index be2f7f88a356..8c599460f827 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -70,19 +70,13 @@ static d_ioctl_t agp_ioctl; static d_mmap_t agp_mmap; static struct cdevsw agp_cdevsw = { - /* open */ agp_open, - /* close */ agp_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ agp_ioctl, - /* poll */ nopoll, - /* mmap */ agp_mmap, - /* strategy */ nostrategy, - /* name */ "agp", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY, + .d_open = agp_open, + .d_close = agp_close, + .d_ioctl = agp_ioctl, + .d_mmap = agp_mmap, + .d_name = "agp", + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY, }; static devclass_t agp_devclass; diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c index bf81df399572..3b58af592d71 100644 --- a/sys/dev/amr/amr.c +++ b/sys/dev/amr/amr.c @@ -94,19 +94,11 @@ static d_close_t amr_close; static d_ioctl_t amr_ioctl; static struct cdevsw amr_cdevsw = { - /* open */ amr_open, - /* close */ amr_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ amr_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "amr", - /* maj */ AMR_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = amr_open, + .d_close = amr_close, + .d_ioctl = amr_ioctl, + .d_name = "amr", + .d_maj = AMR_CDEV_MAJOR, }; /* diff --git a/sys/dev/asr/asr.c b/sys/dev/asr/asr.c index 78cf0a2c500e..bb1f5ff486da 100644 --- a/sys/dev/asr/asr.c +++ b/sys/dev/asr/asr.c @@ -577,19 +577,11 @@ DATA_SET (mode0_pciset, mode0_pcidev); */ #define CDEV_MAJOR 154 /* preferred default character major */ STATIC struct cdevsw asr_cdevsw = { - asr_open, /* open */ - asr_close, /* close */ - noread, /* read */ - nowrite, /* write */ - asr_ioctl, /* ioctl */ - nopoll, /* poll */ - nommap, /* mmap */ - nostrategy, /* strategy */ - "asr", /* name */ - CDEV_MAJOR, /* maj */ - nodump, /* dump */ - nopsize, /* psize */ - 0, /* flags */ + .d_open = asr_open, + .d_close = asr_close, + .d_ioctl = asr_ioctl, + .d_name = "asr", + .d_maj = CDEV_MAJOR, }; #ifdef ASR_MEASURE_PERFORMANCE diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 34cf1df07079..fae76a5ddc74 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -57,19 +57,11 @@ /* device structures */ static d_ioctl_t ataioctl; static struct cdevsw ata_cdevsw = { - /* open */ nullopen, - /* close */ nullclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ ataioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ata", - /* maj */ 159, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = nullopen, + .d_close = nullclose, + .d_ioctl = ataioctl, + .d_name = "ata", + .d_maj = 159, }; /* prototypes */ diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 60d2302096b3..e7d98d6f83aa 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -55,19 +55,15 @@ static d_close_t acdclose; static d_ioctl_t acdioctl; static d_strategy_t acdstrategy; static struct cdevsw acd_cdevsw = { - /* open */ acdopen, - /* close */ acdclose, - /* read */ physread, - /* write */ physwrite, - /* ioctl */ acdioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ acdstrategy, - /* name */ "acd", - /* maj */ 117, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_DISK | D_TRACKCLOSE, + .d_open = acdopen, + .d_close = acdclose, + .d_read = physread, + .d_write = physwrite, + .d_ioctl = acdioctl, + .d_strategy = acdstrategy, + .d_name = "acd", + .d_maj = 117, + .d_flags = D_DISK | D_TRACKCLOSE, }; /* prototypes */ diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c index 76a5c463bcff..b81dd94c507c 100644 --- a/sys/dev/ata/atapi-tape.c +++ b/sys/dev/ata/atapi-tape.c @@ -52,19 +52,15 @@ static d_close_t astclose; static d_ioctl_t astioctl; static d_strategy_t aststrategy; static struct cdevsw ast_cdevsw = { - /* open */ astopen, - /* close */ astclose, - /* read */ physread, - /* write */ physwrite, - /* ioctl */ astioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ aststrategy, - /* name */ "ast", - /* maj */ 119, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TAPE | D_TRACKCLOSE, + .d_open = astopen, + .d_close = astclose, + .d_read = physread, + .d_write = physwrite, + .d_ioctl = astioctl, + .d_strategy = aststrategy, + .d_name = "ast", + .d_maj = 119, + .d_flags = D_TAPE | D_TRACKCLOSE, }; /* prototypes */ diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index 5b4cc2007dab..968491d346e4 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -326,19 +326,13 @@ static driver_t psm_driver = { #define CDEV_MAJOR 21 static struct cdevsw psm_cdevsw = { - /* open */ psmopen, - /* close */ psmclose, - /* read */ psmread, - /* write */ nowrite, - /* ioctl */ psmioctl, - /* poll */ psmpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ PSM_DRIVER_NAME, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = psmopen, + .d_close = psmclose, + .d_read = psmread, + .d_ioctl = psmioctl, + .d_poll = psmpoll, + .d_name = PSM_DRIVER_NAME, + .d_maj = CDEV_MAJOR, }; /* debug message level */ diff --git a/sys/dev/bktr/bktr_os.c b/sys/dev/bktr/bktr_os.c index 7c7f9a12f685..c088510eb4d2 100644 --- a/sys/dev/bktr/bktr_os.c +++ b/sys/dev/bktr/bktr_os.c @@ -247,19 +247,15 @@ static d_poll_t bktr_poll; #define CDEV_MAJOR 92 static struct cdevsw bktr_cdevsw = { - /* open */ bktr_open, - /* close */ bktr_close, - /* read */ bktr_read, - /* write */ bktr_write, - /* ioctl */ bktr_ioctl, - /* poll */ bktr_poll, - /* mmap */ bktr_mmap, - /* strategy */ nostrategy, - /* name */ "bktr", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = bktr_open, + .d_close = bktr_close, + .d_read = bktr_read, + .d_write = bktr_write, + .d_ioctl = bktr_ioctl, + .d_poll = bktr_poll, + .d_mmap = bktr_mmap, + .d_name = "bktr", + .d_maj = CDEV_MAJOR, }; DRIVER_MODULE(bktr, pci, bktr_driver, bktr_devclass, 0, 0); diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c index 4fe4f985ab02..ce4030b1e5ab 100644 --- a/sys/dev/ccd/ccd.c +++ b/sys/dev/ccd/ccd.c @@ -115,19 +115,11 @@ static d_ioctl_t ccdctlioctl; #define CDEV_MAJOR 74 static struct cdevsw ccdctl_cdevsw = { - /* open */ nullopen, - /* close */ nullclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ ccdctlioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ccdctl", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0 + .d_open = nullopen, + .d_close = nullclose, + .d_ioctl = ccdctlioctl, + .d_name = "ccdctl", + .d_maj = CDEV_MAJOR, }; static LIST_HEAD(, ccd_s) ccd_softc_list = diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c index 7c238954338c..5b4116224c4c 100644 --- a/sys/dev/ciss/ciss.c +++ b/sys/dev/ciss/ciss.c @@ -217,20 +217,11 @@ static d_ioctl_t ciss_ioctl; #define CISS_CDEV_MAJOR 166 static struct cdevsw ciss_cdevsw = { - /* open */ ciss_open, - /* close */ ciss_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ ciss_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ciss", - /* maj */ CISS_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, - /* kqfilter */ nokqfilter + .d_open = ciss_open, + .d_close = ciss_close, + .d_ioctl = ciss_ioctl, + .d_name = "ciss", + .d_maj = CISS_CDEV_MAJOR, }; /************************************************************************ diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index 0d5404395e67..53ea3bccd656 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -397,20 +397,16 @@ static d_ioctl_t sioioctl; #define CDEV_MAJOR 48 static struct cdevsw sio_cdevsw = { - /* open */ sioopen, - /* close */ sioclose, - /* read */ ttyread, - /* write */ siowrite, - /* ioctl */ sioioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ driver_name, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = sioopen, + .d_close = sioclose, + .d_read = ttyread, + .d_write = siowrite, + .d_ioctl = sioioctl, + .d_poll = ttypoll, + .d_name = driver_name, + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; static int comconsole = -1; diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index 0d5404395e67..53ea3bccd656 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -397,20 +397,16 @@ static d_ioctl_t sioioctl; #define CDEV_MAJOR 48 static struct cdevsw sio_cdevsw = { - /* open */ sioopen, - /* close */ sioclose, - /* read */ ttyread, - /* write */ siowrite, - /* ioctl */ sioioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ driver_name, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = sioopen, + .d_close = sioclose, + .d_read = ttyread, + .d_write = siowrite, + .d_ioctl = sioioctl, + .d_poll = ttypoll, + .d_name = driver_name, + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; static int comconsole = -1; diff --git a/sys/dev/dgb/dgb.c b/sys/dev/dgb/dgb.c index 1f103801c4cf..b702297f7921 100644 --- a/sys/dev/dgb/dgb.c +++ b/sys/dev/dgb/dgb.c @@ -242,20 +242,16 @@ static d_ioctl_t dgbioctl; #define CDEV_MAJOR 58 static struct cdevsw dgb_cdevsw = { - /* open */ dgbopen, - /* close */ dgbclose, - /* read */ ttyread, - /* write */ ttywrite, - /* ioctl */ dgbioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "dgb", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = dgbopen, + .d_close = dgbclose, + .d_read = ttyread, + .d_write = ttywrite, + .d_ioctl = dgbioctl, + .d_poll = ttypoll, + .d_name = "dgb", + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; static speed_t dgbdefaultrate = TTYDEF_SPEED; diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c index ab86ad5922c9..42c1b1ce4a6e 100644 --- a/sys/dev/digi/digi.c +++ b/sys/dev/digi/digi.c @@ -143,20 +143,16 @@ const struct digi_control_signals digi_normal_signals = { }; static struct cdevsw digi_sw = { - /* open */ digiopen, - /* close */ digiclose, - /* read */ digiread, - /* write */ digiwrite, - /* ioctl */ digiioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ driver_name, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter + .d_open = digiopen, + .d_close = digiclose, + .d_read = digiread, + .d_write = digiwrite, + .d_ioctl = digiioctl, + .d_poll = ttypoll, + .d_name = driver_name, + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter }; static void diff --git a/sys/dev/drm/drm_drv.h b/sys/dev/drm/drm_drv.h index 729b2f960c04..f24422eb13d1 100644 --- a/sys/dev/drm/drm_drv.h +++ b/sys/dev/drm/drm_drv.h @@ -316,21 +316,18 @@ static driver_t DRM(driver) = { static devclass_t DRM( devclass); static struct cdevsw DRM( cdevsw) = { - /* open */ DRM( open ), - /* close */ DRM( close ), - /* read */ DRM( read ), - /* write */ DRM( write ), - /* ioctl */ DRM( ioctl ), - /* poll */ DRM( poll ), - /* mmap */ DRM( mmap ), - /* strategy */ nostrategy, - /* name */ DRIVER_NAME, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_TRACKCLOSE, + .d_open = DRM( open ), + .d_close = DRM( close ), + .d_read = DRM( read ), + .d_write = DRM( write ), + .d_ioctl = DRM( ioctl ), + .d_poll = DRM( poll ), + .d_mmap = DRM( mmap ), + .d_name = DRIVER_NAME, + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_TRACKCLOSE, #if __FreeBSD_version >= 500000 - /* kqfilter */ 0 + .d_kqfilter = 0 #else /* bmaj */ -1 #endif diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index 839e9a4943ce..073ffd828452 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -363,19 +363,14 @@ static d_mmap_t fbmmap; #define CDEV_MAJOR 123 /* XXX */ static struct cdevsw fb_cdevsw = { - /* open */ fbopen, - /* close */ fbclose, - /* read */ fbread, - /* write */ fbwrite, - /* ioctl */ fbioctl, - /* poll */ nopoll, - /* mmap */ fbmmap, - /* strategy */ nostrategy, - /* name */ FB_DRIVER_NAME, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = fbopen, + .d_close = fbclose, + .d_read = fbread, + .d_write = fbwrite, + .d_ioctl = fbioctl, + .d_mmap = fbmmap, + .d_name = FB_DRIVER_NAME, + .d_maj = CDEV_MAJOR, }; #endif diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 917356495f9a..bb2cc86de2bb 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -477,19 +477,15 @@ fdin_rd(fdc_p fdc) #define CDEV_MAJOR 9 static struct cdevsw fd_cdevsw = { - /* open */ Fdopen, - /* close */ fdclose, - /* read */ physread, - /* write */ physwrite, - /* ioctl */ fdioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ fdstrategy, - /* name */ "fd", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_DISK, + .d_open = Fdopen, + .d_close = fdclose, + .d_read = physread, + .d_write = physwrite, + .d_ioctl = fdioctl, + .d_strategy = fdstrategy, + .d_name = "fd", + .d_maj = CDEV_MAJOR, + .d_flags = D_DISK, }; /* diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 35f221c9efa9..fe79bc70df31 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -67,19 +67,16 @@ static d_mmap_t fw_mmap; struct cdevsw firewire_cdevsw = { - /* open */ fw_open, - /* close */ fw_close, - /* read */ fw_read, - /* write */ fw_write, - /* ioctl */ fw_ioctl, - /* poll */ fw_poll, - /* mmap */ fw_mmap, - /* strategy */ nostrategy, - /* name */ "fw", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_MEM + .d_open = fw_open, + .d_close = fw_close, + .d_read = fw_read, + .d_write = fw_write, + .d_ioctl = fw_ioctl, + .d_poll = fw_poll, + .d_mmap = fw_mmap, + .d_name = "fw", + .d_maj = CDEV_MAJOR, + .d_flags = D_MEM }; static int diff --git a/sys/dev/hfa/fore_load.c b/sys/dev/hfa/fore_load.c index ab4de54f5f9d..334cb88cd6ec 100644 --- a/sys/dev/hfa/fore_load.c +++ b/sys/dev/hfa/fore_load.c @@ -507,19 +507,7 @@ fore_reset(fup) * Driver entry points */ static struct cdevsw fore_cdev = { - /* open */ noopen, - /* close */ noclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ noioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ noname, - /* maj */ -1, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_maj = -1, }; diff --git a/sys/dev/iicbus/iic.c b/sys/dev/iicbus/iic.c index 59317e21b7bf..cd33d2c557e4 100644 --- a/sys/dev/iicbus/iic.c +++ b/sys/dev/iicbus/iic.c @@ -94,19 +94,13 @@ static d_ioctl_t iicioctl; #define CDEV_MAJOR 105 static struct cdevsw iic_cdevsw = { - /* open */ iicopen, - /* close */ iicclose, - /* read */ iicread, - /* write */ iicwrite, - /* ioctl */ iicioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "iic", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = iicopen, + .d_close = iicclose, + .d_read = iicread, + .d_write = iicwrite, + .d_ioctl = iicioctl, + .d_name = "iic", + .d_maj = CDEV_MAJOR, }; static void diff --git a/sys/dev/iir/iir_ctrl.c b/sys/dev/iir/iir_ctrl.c index 29f4ea6122d8..80670e0b4ec0 100644 --- a/sys/dev/iir/iir_ctrl.c +++ b/sys/dev/iir/iir_ctrl.c @@ -69,20 +69,13 @@ static d_ioctl_t iir_ioctl; /* Normally, this is a static structure. But we need it in pci/iir_pci.c */ static struct cdevsw iir_cdevsw = { - /* open */ iir_open, - /* close */ iir_close, - /* read */ iir_read, - /* write */ iir_write, - /* ioctl */ iir_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "iir", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, - /* kqfilter */ nokqfilter + .d_open = iir_open, + .d_close = iir_close, + .d_read = iir_read, + .d_write = iir_write, + .d_ioctl = iir_ioctl, + .d_name = "iir", + .d_maj = CDEV_MAJOR, }; #ifndef SDEV_PER_HBA diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c index 5e1011de19bd..d425166cef6a 100644 --- a/sys/dev/isp/isp_freebsd.c +++ b/sys/dev/isp/isp_freebsd.c @@ -50,19 +50,12 @@ static void isp_action(struct cam_sim *, union ccb *); #define ISP_CDEV_MAJOR 248 static struct cdevsw isp_cdevsw = { - /* open */ nullopen, - /* close */ nullclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ ispioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "isp", - /* maj */ ISP_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TAPE, + .d_open = nullopen, + .d_close = nullclose, + .d_ioctl = ispioctl, + .d_name = "isp", + .d_maj = ISP_CDEV_MAJOR, + .d_flags = D_TAPE, }; static struct ispsoftc *isplist = NULL; diff --git a/sys/dev/joy/joy.c b/sys/dev/joy/joy.c index c00b81158e97..cc61edf6b72e 100644 --- a/sys/dev/joy/joy.c +++ b/sys/dev/joy/joy.c @@ -68,19 +68,12 @@ static d_read_t joyread; static d_ioctl_t joyioctl; static struct cdevsw joy_cdevsw = { - /* open */ joyopen, - /* close */ joyclose, - /* read */ joyread, - /* write */ nowrite, - /* ioctl */ joyioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "joy", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = joyopen, + .d_close = joyclose, + .d_read = joyread, + .d_ioctl = joyioctl, + .d_name = "joy", + .d_maj = CDEV_MAJOR, }; devclass_t joy_devclass; diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c index aa4c3f7c56fa..6a1fcaf2370d 100644 --- a/sys/dev/kbd/kbd.c +++ b/sys/dev/kbd/kbd.c @@ -425,19 +425,14 @@ static d_poll_t genkbdpoll; #define CDEV_MAJOR 112 static struct cdevsw kbd_cdevsw = { - /* open */ genkbdopen, - /* close */ genkbdclose, - /* read */ genkbdread, - /* write */ genkbdwrite, - /* ioctl */ genkbdioctl, - /* poll */ genkbdpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "kbd", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = genkbdopen, + .d_close = genkbdclose, + .d_read = genkbdread, + .d_write = genkbdwrite, + .d_ioctl = genkbdioctl, + .d_poll = genkbdpoll, + .d_name = "kbd", + .d_maj = CDEV_MAJOR, }; int diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c index 73197bd1d413..cdd6e93c69b3 100644 --- a/sys/dev/mcd/mcd.c +++ b/sys/dev/mcd/mcd.c @@ -161,19 +161,14 @@ static d_strategy_t mcdstrategy; #define CDEV_MAJOR 29 static struct cdevsw mcd_cdevsw = { - /* open */ mcdopen, - /* close */ mcdclose, - /* read */ physread, - /* write */ nowrite, - /* ioctl */ mcdioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ mcdstrategy, - /* name */ "mcd", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_DISK, + .d_open = mcdopen, + .d_close = mcdclose, + .d_read = physread, + .d_ioctl = mcdioctl, + .d_strategy = mcdstrategy, + .d_name = "mcd", + .d_maj = CDEV_MAJOR, + .d_flags = D_DISK, }; #define MCD_RETRYS 5 diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 591cd646a1dc..c03d10eeb6a5 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -119,16 +119,11 @@ static dev_t status_dev = 0; static d_ioctl_t mdctlioctl; static struct cdevsw mdctl_cdevsw = { - /* open */ nullopen, - /* close */ nullclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ mdctlioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ MD_NAME, - /* maj */ CDEV_MAJOR + .d_open = nullopen, + .d_close = nullclose, + .d_ioctl = mdctlioctl, + .d_name = MD_NAME, + .d_maj = CDEV_MAJOR }; diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c index aecd9dc34b80..df8c03d8a92a 100644 --- a/sys/dev/mlx/mlx.c +++ b/sys/dev/mlx/mlx.c @@ -56,19 +56,11 @@ #define MLX_CDEV_MAJOR 130 static struct cdevsw mlx_cdevsw = { - /* open */ mlx_open, - /* close */ mlx_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ mlx_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "mlx", - /* maj */ MLX_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = mlx_open, + .d_close = mlx_close, + .d_ioctl = mlx_ioctl, + .d_name = "mlx", + .d_maj = MLX_CDEV_MAJOR, }; devclass_t mlx_devclass; diff --git a/sys/dev/mly/mly.c b/sys/dev/mly/mly.c index b48af8063dc8..9a0edc46da5b 100644 --- a/sys/dev/mly/mly.c +++ b/sys/dev/mly/mly.c @@ -153,19 +153,11 @@ DRIVER_MODULE(mly, pci, mly_pci_driver, mly_devclass, 0, 0); #define MLY_CDEV_MAJOR 158 static struct cdevsw mly_cdevsw = { - /* open */ mly_user_open, - /* close */ mly_user_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ mly_user_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "mly", - /* maj */ MLY_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0 + .d_open = mly_user_open, + .d_close = mly_user_close, + .d_ioctl = mly_user_ioctl, + .d_name = "mly", + .d_maj = MLY_CDEV_MAJOR, }; /******************************************************************************** diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c index 17622bd2eae2..57b0e7b1f15c 100644 --- a/sys/dev/mse/mse.c +++ b/sys/dev/mse/mse.c @@ -139,19 +139,13 @@ static d_poll_t msepoll; #define CDEV_MAJOR 27 static struct cdevsw mse_cdevsw = { - /* open */ mseopen, - /* close */ mseclose, - /* read */ mseread, - /* write */ nowrite, - /* ioctl */ mseioctl, - /* poll */ msepoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "mse", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = mseopen, + .d_close = mseclose, + .d_read = mseread, + .d_ioctl = mseioctl, + .d_poll = msepoll, + .d_name = "mse", + .d_maj = CDEV_MAJOR, }; static void mseintr(void *); diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c index 6037451eeb67..8f5af4636df2 100644 --- a/sys/dev/nmdm/nmdm.c +++ b/sys/dev/nmdm/nmdm.c @@ -70,19 +70,15 @@ static d_ioctl_t nmdmioctl; #define CDEV_MAJOR 18 static struct cdevsw nmdm_cdevsw = { - /* open */ nmdmopen, - /* close */ nmdmclose, - /* read */ nmdmread, - /* write */ nmdmwrite, - /* ioctl */ nmdmioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "pts", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY, + .d_open = nmdmopen, + .d_close = nmdmclose, + .d_read = nmdmread, + .d_write = nmdmwrite, + .d_ioctl = nmdmioctl, + .d_poll = ttypoll, + .d_name = "pts", + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY, }; #define BUFSIZ 100 /* Chunk size iomoved to/from user */ diff --git a/sys/dev/null/null.c b/sys/dev/null/null.c index c96faf0cf8b2..75f9a90a8b3e 100644 --- a/sys/dev/null/null.c +++ b/sys/dev/null/null.c @@ -51,37 +51,23 @@ static d_read_t null_read; #define ZERO_MINOR 12 static struct cdevsw null_cdevsw = { - /* open */ nullopen, - /* close */ nullclose, - /* read */ null_read, - /* write */ null_write, - /* ioctl */ null_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "null", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, - /* kqfilter */ NULL + .d_open = nullopen, + .d_close = nullclose, + .d_read = null_read, + .d_write = null_write, + .d_ioctl = null_ioctl, + .d_name = "null", + .d_maj = CDEV_MAJOR, }; static struct cdevsw zero_cdevsw = { - /* open */ nullopen, - /* close */ nullclose, - /* read */ zero_read, - /* write */ null_write, - /* ioctl */ noioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "zero", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_MMAP_ANON, - /* kqfilter */ NULL + .d_open = nullopen, + .d_close = nullclose, + .d_read = zero_read, + .d_write = null_write, + .d_name = "zero", + .d_maj = CDEV_MAJOR, + .d_flags = D_MMAP_ANON, }; static void *zbuf; diff --git a/sys/dev/ofw/ofw_console.c b/sys/dev/ofw/ofw_console.c index 379a75322198..436dbc8d7fe6 100644 --- a/sys/dev/ofw/ofw_console.c +++ b/sys/dev/ofw/ofw_console.c @@ -53,19 +53,14 @@ static d_ioctl_t ofw_dev_ioctl; #define CDEV_MAJOR 97 static struct cdevsw ofw_cdevsw = { - /* open */ ofw_dev_open, - /* close */ ofw_dev_close, - /* read */ ttyread, - /* write */ ttywrite, - /* ioctl */ ofw_dev_ioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ofw", - /* major */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = ofw_dev_open, + .d_close = ofw_dev_close, + .d_read = ttyread, + .d_write = ttywrite, + .d_ioctl = ofw_dev_ioctl, + .d_poll = ttypoll, + .d_name = "ofw", + .d_maj = CDEV_MAJOR, }; static struct tty *ofw_tp = NULL; diff --git a/sys/dev/ofw/openfirmio.c b/sys/dev/ofw/openfirmio.c index 6f4061961818..c197eb82c801 100644 --- a/sys/dev/ofw/openfirmio.c +++ b/sys/dev/ofw/openfirmio.c @@ -66,20 +66,11 @@ static d_ioctl_t openfirm_ioctl; #define OPENFIRM_MINOR 0 static struct cdevsw openfirm_cdevsw = { - /* open */ nullopen, - /* close */ nullclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ openfirm_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "openfirm", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, - /* kqfilter */ nokqfilter + .d_open = nullopen, + .d_close = nullclose, + .d_ioctl = openfirm_ioctl, + .d_name = "openfirm", + .d_maj = CDEV_MAJOR, }; static phandle_t lastnode; /* speed hack */ diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index 0c6fe5181723..f39a89019877 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -74,19 +74,11 @@ static d_ioctl_t pci_ioctl; #endif struct cdevsw pcicdev = { - /* open */ pci_open, - /* close */ pci_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ pci_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "pci", - /* maj */ PCI_CDEV, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = pci_open, + .d_close = pci_close, + .d_ioctl = pci_ioctl, + .d_name = "pci", + .d_maj = PCI_CDEV, }; static int diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c index 43fda7eac0b7..54ba80e76680 100644 --- a/sys/dev/ppbus/lpt.c +++ b/sys/dev/ppbus/lpt.c @@ -189,19 +189,13 @@ static d_ioctl_t lptioctl; #define CDEV_MAJOR 16 static struct cdevsw lpt_cdevsw = { - /* open */ lptopen, - /* close */ lptclose, - /* read */ lptread, - /* write */ lptwrite, - /* ioctl */ lptioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ LPT_NAME, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = lptopen, + .d_close = lptclose, + .d_read = lptread, + .d_write = lptwrite, + .d_ioctl = lptioctl, + .d_name = LPT_NAME, + .d_maj = CDEV_MAJOR, }; static int diff --git a/sys/dev/ppbus/pcfclock.c b/sys/dev/ppbus/pcfclock.c index 014bd4df08af..940c02df2f98 100644 --- a/sys/dev/ppbus/pcfclock.c +++ b/sys/dev/ppbus/pcfclock.c @@ -67,19 +67,11 @@ static d_read_t pcfclock_read; #define CDEV_MAJOR 140 static struct cdevsw pcfclock_cdevsw = { - /* open */ pcfclock_open, - /* close */ pcfclock_close, - /* read */ pcfclock_read, - /* write */ nowrite, - /* ioctl */ noioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ PCFCLOCK_NAME, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = pcfclock_open, + .d_close = pcfclock_close, + .d_read = pcfclock_read, + .d_name = PCFCLOCK_NAME, + .d_maj = CDEV_MAJOR, }; #ifndef PCFCLOCK_MAX_RETRIES diff --git a/sys/dev/ppbus/ppi.c b/sys/dev/ppbus/ppi.c index e1bc241f4ec4..26bc5ce63dae 100644 --- a/sys/dev/ppbus/ppi.c +++ b/sys/dev/ppbus/ppi.c @@ -90,19 +90,13 @@ static d_read_t ppiread; #define CDEV_MAJOR 82 static struct cdevsw ppi_cdevsw = { - /* open */ ppiopen, - /* close */ ppiclose, - /* read */ ppiread, - /* write */ ppiwrite, - /* ioctl */ ppiioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ppi", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = ppiopen, + .d_close = ppiclose, + .d_read = ppiread, + .d_write = ppiwrite, + .d_ioctl = ppiioctl, + .d_name = "ppi", + .d_maj = CDEV_MAJOR, }; #ifdef PERIPH_1284 diff --git a/sys/dev/ppbus/pps.c b/sys/dev/ppbus/pps.c index a142e3b35991..b1192a5c775b 100644 --- a/sys/dev/ppbus/pps.c +++ b/sys/dev/ppbus/pps.c @@ -62,19 +62,11 @@ static d_ioctl_t ppsioctl; #define CDEV_MAJOR 89 static struct cdevsw pps_cdevsw = { - /* open */ ppsopen, - /* close */ ppsclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ ppsioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ PPS_NAME, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = ppsopen, + .d_close = ppsclose, + .d_ioctl = ppsioctl, + .d_name = PPS_NAME, + .d_maj = CDEV_MAJOR, }; static void diff --git a/sys/dev/raidframe/rf_freebsdkintf.c b/sys/dev/raidframe/rf_freebsdkintf.c index 754ab514f169..6e1f407b6e19 100644 --- a/sys/dev/raidframe/rf_freebsdkintf.c +++ b/sys/dev/raidframe/rf_freebsdkintf.c @@ -215,19 +215,11 @@ d_close_t raidctlclose; d_ioctl_t raidctlioctl; static struct cdevsw raidctl_cdevsw = { - /* open */ raidctlopen, - /* close */ raidctlclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ raidctlioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "raidctl", - /* maj */ 201, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = raidctlopen, + .d_close = raidctlclose, + .d_ioctl = raidctlioctl, + .d_name = "raidctl", + .d_maj = 201, }; /* diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c index d965cbc8d366..5350d01b647e 100644 --- a/sys/dev/random/randomdev.c +++ b/sys/dev/random/randomdev.c @@ -62,20 +62,14 @@ static d_poll_t random_poll; #define RANDOM_MINOR 3 static struct cdevsw random_cdevsw = { - /* open */ random_open, - /* close */ random_close, - /* read */ random_read, - /* write */ random_write, - /* ioctl */ random_ioctl, - /* poll */ random_poll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "random", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, - /* kqfilter */ NULL + .d_open = random_open, + .d_close = random_close, + .d_read = random_read, + .d_write = random_write, + .d_ioctl = random_ioctl, + .d_poll = random_poll, + .d_name = "random", + .d_maj = CDEV_MAJOR, }; static void random_kthread(void *); diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index 1e4df7076c7e..eb023d8ba38e 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -146,20 +146,16 @@ static d_ioctl_t rcioctl; #define CDEV_MAJOR 63 static struct cdevsw rc_cdevsw = { - /* open */ rcopen, - /* close */ rcclose, - /* read */ ttyread, - /* write */ ttywrite, - /* ioctl */ rcioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "rc", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = rcopen, + .d_close = rcclose, + .d_read = ttyread, + .d_write = ttywrite, + .d_ioctl = rcioctl, + .d_poll = ttypoll, + .d_name = "rc", + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; static devclass_t rc_devclass; diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c index 9c6dbe64a6a9..6927314d997b 100644 --- a/sys/dev/rp/rp.c +++ b/sys/dev/rp/rp.c @@ -571,19 +571,15 @@ static d_ioctl_t rpioctl; #define CDEV_MAJOR 81 struct cdevsw rp_cdevsw = { - /* open */ rpopen, - /* close */ rpclose, - /* read */ ttyread, - /* write */ rpwrite, - /* ioctl */ rpioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "rp", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY, + .d_open = rpopen, + .d_close = rpclose, + .d_read = ttyread, + .d_write = rpwrite, + .d_ioctl = rpioctl, + .d_poll = ttypoll, + .d_name = "rp", + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY, }; static int rp_num_ports_open = 0; diff --git a/sys/dev/sab/sab.c b/sys/dev/sab/sab.c index f77054f74e86..56fd6ea7b801 100644 --- a/sys/dev/sab/sab.c +++ b/sys/dev/sab/sab.c @@ -160,20 +160,16 @@ static void sabttystop(struct tty *tp, int rw); static int sabttyparam(struct tty *tp, struct termios *t); static struct cdevsw sabtty_cdevsw = { - /* open */ sabttyopen, - /* close */ sabttyclose, - /* read */ ttyread, - /* write */ ttywrite, - /* ioctl */ sabttyioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "sabtty", - /* major */ MAJOR_AUTO, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = sabttyopen, + .d_close = sabttyclose, + .d_read = ttyread, + .d_write = ttywrite, + .d_ioctl = sabttyioctl, + .d_poll = ttypoll, + .d_name = "sabtty", + .d_maj = MAJOR_AUTO, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; static device_method_t sab_methods[] = { diff --git a/sys/dev/scd/scd.c b/sys/dev/scd/scd.c index dfa13bbc44e7..88e4d07660b8 100644 --- a/sys/dev/scd/scd.c +++ b/sys/dev/scd/scd.c @@ -146,19 +146,14 @@ static d_strategy_t scdstrategy; #define CDEV_MAJOR 45 static struct cdevsw scd_cdevsw = { - /* open */ scdopen, - /* close */ scdclose, - /* read */ physread, - /* write */ nowrite, - /* ioctl */ scdioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ scdstrategy, - /* name */ "scd", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_DISK, + .d_open = scdopen, + .d_close = scdclose, + .d_read = physread, + .d_ioctl = scdioctl, + .d_strategy = scdstrategy, + .d_name = "scd", + .d_maj = CDEV_MAJOR, + .d_flags = D_DISK, }; int diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index b96d84f1305c..ef37bfdd675c 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -116,20 +116,16 @@ static d_ioctl_t siioctl; #define CDEV_MAJOR 68 static struct cdevsw si_cdevsw = { - /* open */ siopen, - /* close */ siclose, - /* read */ ttyread, - /* write */ siwrite, - /* ioctl */ siioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "si", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = siopen, + .d_close = siclose, + .d_read = ttyread, + .d_write = siwrite, + .d_ioctl = siioctl, + .d_poll = ttypoll, + .d_name = "si", + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; static int si_Nports; diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 32b3cd151d63..9f28b32199db 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -314,20 +314,16 @@ static d_ioctl_t sioioctl; #define CDEV_MAJOR 28 static struct cdevsw sio_cdevsw = { - /* open */ sioopen, - /* close */ sioclose, - /* read */ sioread, - /* write */ siowrite, - /* ioctl */ sioioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ sio_driver_name, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = sioopen, + .d_close = sioclose, + .d_read = sioread, + .d_write = siowrite, + .d_ioctl = sioioctl, + .d_poll = ttypoll, + .d_name = sio_driver_name, + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; int comconsole = -1; diff --git a/sys/dev/smbus/smb.c b/sys/dev/smbus/smb.c index 392594fad592..1272c13cbc4e 100644 --- a/sys/dev/smbus/smb.c +++ b/sys/dev/smbus/smb.c @@ -89,19 +89,13 @@ static d_ioctl_t smbioctl; #define CDEV_MAJOR 106 static struct cdevsw smb_cdevsw = { - /* open */ smbopen, - /* close */ smbclose, - /* read */ smbread, - /* write */ smbwrite, - /* ioctl */ smbioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "smb", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = smbopen, + .d_close = smbclose, + .d_read = smbread, + .d_write = smbwrite, + .d_ioctl = smbioctl, + .d_name = "smb", + .d_maj = CDEV_MAJOR, }; static void diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index 797b8d8abd68..9b67b604da89 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -38,19 +38,14 @@ static d_poll_t snppoll; #define CDEV_MAJOR 53 static struct cdevsw snp_cdevsw = { - /* open */ snpopen, - /* close */ snpclose, - /* read */ snpread, - /* write */ snpwrite, - /* ioctl */ snpioctl, - /* poll */ snppoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "snp", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = snpopen, + .d_close = snpclose, + .d_read = snpread, + .d_write = snpwrite, + .d_ioctl = snpioctl, + .d_poll = snppoll, + .d_name = "snp", + .d_maj = CDEV_MAJOR, }; static struct linesw snpdisc = { diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c index 07d26608fcb7..2da6415dee82 100644 --- a/sys/dev/sound/midi/midi.c +++ b/sys/dev/sound/midi/midi.c @@ -70,19 +70,14 @@ static int midi_readstatus(char *buf, int *ptr, struct uio *uio); #define CDEV_MAJOR MIDI_CDEV_MAJOR static struct cdevsw midi_cdevsw = { - /* open */ midiopen, - /* close */ midiclose, - /* read */ midiread, - /* write */ midiwrite, - /* ioctl */ midiioctl, - /* poll */ midipoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "midi", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = midiopen, + .d_close = midiclose, + .d_read = midiread, + .d_write = midiwrite, + .d_ioctl = midiioctl, + .d_poll = midipoll, + .d_name = "midi", + .d_maj = CDEV_MAJOR, }; /* diff --git a/sys/dev/sound/midi/sequencer.c b/sys/dev/sound/midi/sequencer.c index 5115cc9b6fc2..17c79efaaaf2 100644 --- a/sys/dev/sound/midi/sequencer.c +++ b/sys/dev/sound/midi/sequencer.c @@ -135,19 +135,14 @@ static d_poll_t seqpoll; #define CDEV_MAJOR SEQ_CDEV_MAJOR static struct cdevsw seq_cdevsw = { - /* open */ seqopen, - /* close */ seqclose, - /* read */ seqread, - /* write */ seqwrite, - /* ioctl */ seqioctl, - /* poll */ seqpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "midi", /* XXX */ - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = seqopen, + .d_close = seqclose, + .d_read = seqread, + .d_write = seqwrite, + .d_ioctl = seqioctl, + .d_poll = seqpoll, + .d_name = "midi", /* XXX */ + .d_maj = CDEV_MAJOR, }; diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index cc3c8405cce4..838028cd8c6b 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -42,19 +42,15 @@ static d_poll_t dsp_poll; static d_mmap_t dsp_mmap; static struct cdevsw dsp_cdevsw = { - /* open */ dsp_open, - /* close */ dsp_close, - /* read */ dsp_read, - /* write */ dsp_write, - /* ioctl */ dsp_ioctl, - /* poll */ dsp_poll, - /* mmap */ dsp_mmap, - /* strategy */ nostrategy, - /* name */ "dsp", - /* maj */ SND_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = dsp_open, + .d_close = dsp_close, + .d_read = dsp_read, + .d_write = dsp_write, + .d_ioctl = dsp_ioctl, + .d_poll = dsp_poll, + .d_mmap = dsp_mmap, + .d_name = "dsp", + .d_maj = SND_CDEV_MAJOR, }; #ifdef USING_DEVFS diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 182d2902385f..ab26016906e4 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -73,19 +73,11 @@ static d_open_t mixer_open; static d_close_t mixer_close; static struct cdevsw mixer_cdevsw = { - /* open */ mixer_open, - /* close */ mixer_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ mixer_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "mixer", - /* maj */ SND_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = mixer_open, + .d_close = mixer_close, + .d_ioctl = mixer_ioctl, + .d_name = "mixer", + .d_maj = SND_CDEV_MAJOR, }; #ifdef USING_DEVFS diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index bdaff2bc9968..a15e7f42f5f5 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -41,19 +41,11 @@ static d_close_t sndstat_close; static d_read_t sndstat_read; static struct cdevsw sndstat_cdevsw = { - /* open */ sndstat_open, - /* close */ sndstat_close, - /* read */ sndstat_read, - /* write */ nowrite, - /* ioctl */ noioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "sndstat", - /* maj */ SND_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = sndstat_open, + .d_close = sndstat_close, + .d_read = sndstat_read, + .d_name = "sndstat", + .d_maj = SND_CDEV_MAJOR, }; struct sndstat_entry { diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index 22b6bf36c59b..97fa4e6c41b0 100644 --- a/sys/dev/speaker/spkr.c +++ b/sys/dev/speaker/spkr.c @@ -34,19 +34,12 @@ static d_ioctl_t spkrioctl; #define CDEV_MAJOR 26 static struct cdevsw spkr_cdevsw = { - /* open */ spkropen, - /* close */ spkrclose, - /* read */ noread, - /* write */ spkrwrite, - /* ioctl */ spkrioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "spkr", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = spkropen, + .d_close = spkrclose, + .d_write = spkrwrite, + .d_ioctl = spkrioctl, + .d_name = "spkr", + .d_maj = CDEV_MAJOR, }; static MALLOC_DEFINE(M_SPKR, "spkr", "Speaker buffer"); diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index 4347d99b402d..bd0aab995fa8 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -105,19 +105,9 @@ static struct fileops svr4_netops = { #define CDEV_MAJOR 103 static struct cdevsw streams_cdevsw = { - /* open */ streamsopen, - /* close */ noclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ noioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "streams", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = streamsopen, + .d_name = "streams", + .d_maj = CDEV_MAJOR, }; struct streams_softc { diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 0edbc4920fe4..1cf572b32517 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -212,20 +212,17 @@ static d_ioctl_t scioctl; static d_mmap_t scmmap; static struct cdevsw sc_cdevsw = { - /* open */ scopen, - /* close */ scclose, - /* read */ scread, - /* write */ ttywrite, - /* ioctl */ scioctl, - /* poll */ ttypoll, - /* mmap */ scmmap, - /* strategy */ nostrategy, - /* name */ "sc", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter + .d_open = scopen, + .d_close = scclose, + .d_read = scread, + .d_write = ttywrite, + .d_ioctl = scioctl, + .d_poll = ttypoll, + .d_mmap = scmmap, + .d_name = "sc", + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter }; int diff --git a/sys/dev/syscons/sysmouse.c b/sys/dev/syscons/sysmouse.c index 310052a49eca..db9d2e8dcf77 100644 --- a/sys/dev/syscons/sysmouse.c +++ b/sys/dev/syscons/sysmouse.c @@ -48,19 +48,14 @@ static d_close_t smclose; static d_ioctl_t smioctl; static struct cdevsw sm_cdevsw = { - /* open */ smopen, - /* close */ smclose, - /* read */ ttyread, - /* write */ nowrite, - /* ioctl */ smioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "sysmouse", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY, + .d_open = smopen, + .d_close = smclose, + .d_read = ttyread, + .d_ioctl = smioctl, + .d_poll = ttypoll, + .d_name = "sysmouse", + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY, }; /* local variables */ diff --git a/sys/dev/tdfx/tdfx_pci.c b/sys/dev/tdfx/tdfx_pci.c index b8bd39af1387..634975182bb8 100644 --- a/sys/dev/tdfx/tdfx_pci.c +++ b/sys/dev/tdfx/tdfx_pci.c @@ -103,19 +103,12 @@ LINUX_IOCTL_SET(tdfx, LINUX_IOCTL_TDFX_MIN, LINUX_IOCTL_TDFX_MAX); /* Char. Dev. file operations structure */ static struct cdevsw tdfx_cdev = { - /* open */ tdfx_open, - /* close */ tdfx_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ tdfx_ioctl, - /* poll */ nopoll, - /* mmap */ tdfx_mmap, - /* strategy */ nostrategy, - /* name */ "tdfx", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = tdfx_open, + .d_close = tdfx_close, + .d_ioctl = tdfx_ioctl, + .d_mmap = tdfx_mmap, + .d_name = "tdfx", + .d_maj = CDEV_MAJOR, }; static int diff --git a/sys/dev/tga/tga_pci.c b/sys/dev/tga/tga_pci.c index 24cf4a953838..b6b57f04777e 100644 --- a/sys/dev/tga/tga_pci.c +++ b/sys/dev/tga/tga_pci.c @@ -97,20 +97,14 @@ static struct gfb_type tga_devs[] = { #ifdef FB_INSTALL_CDEV static struct cdevsw tga_cdevsw = { - /* open */ pcigfb_open, - /* close */ pcigfb_close, - /* read */ pcigfb_read, - /* write */ pcigfb_write, - /* ioctl */ pcigfb_ioctl, - /* poll */ nopoll, - /* mmap */ pcigfb_mmap, - /* strategy */ nostrategy, - /* name */ "tga", - /* maj */ -1, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, - /* kqfilter */ nokqfilter + .d_open = pcigfb_open, + .d_close = pcigfb_close, + .d_read = pcigfb_read, + .d_write = pcigfb_write, + .d_ioctl = pcigfb_ioctl, + .d_mmap = pcigfb_mmap, + .d_name = "tga", + .d_maj = -1, }; #endif /* FB_INSTALL_CDEV */ diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index e0ac1d16bd3d..be81f61ca3f5 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -192,19 +192,11 @@ static d_close_t ti_close; static d_ioctl_t ti_ioctl2; static struct cdevsw ti_cdevsw = { - /* open */ ti_open, - /* close */ ti_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ ti_ioctl2, - /* poll */ seltrue, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ti", - /* maj */ TI_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = ti_open, + .d_close = ti_close, + .d_ioctl = ti_ioctl2, + .d_name = "ti", + .d_maj = TI_CDEV_MAJOR, }; static int ti_probe (device_t); diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c index 96c9d5ac1409..a0b6db742801 100644 --- a/sys/dev/twe/twe_freebsd.c +++ b/sys/dev/twe/twe_freebsd.c @@ -71,19 +71,11 @@ static d_ioctl_t twe_ioctl_wrapper; #define TWE_CDEV_MAJOR 146 static struct cdevsw twe_cdevsw = { - /* open */ twe_open, - /* close */ twe_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ twe_ioctl_wrapper, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "twe", - /* maj */ TWE_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0 + .d_open = twe_open, + .d_close = twe_close, + .d_ioctl = twe_ioctl_wrapper, + .d_name = "twe", + .d_maj = TWE_CDEV_MAJOR, }; /******************************************************************************** diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 8ed19a6d15c2..5409913aaeff 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -128,23 +128,19 @@ Static d_ioctl_t ucomioctl; #define UCOM_CDEV_MAJOR 138 static struct cdevsw ucom_cdevsw = { - /* open */ ucomopen, - /* close */ ucomclose, - /* read */ ucomread, - /* write */ ucomwrite, - /* ioctl */ ucomioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ucom", - /* maj */ UCOM_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, + .d_open = ucomopen, + .d_close = ucomclose, + .d_read = ucomread, + .d_write = ucomwrite, + .d_ioctl = ucomioctl, + .d_poll = ttypoll, + .d_name = "ucom", + .d_maj = UCOM_CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, #if __FreeBSD_version < 500014 /* bmaj */ -1, #endif - /* kqfilter */ ttykqfilter, + .d_kqfilter = ttykqfilter, }; Static void ucom_cleanup(struct ucom_softc *); diff --git a/sys/dev/usb/ufm.c b/sys/dev/usb/ufm.c index 42c7a43fb9bc..4517d555fe5f 100644 --- a/sys/dev/usb/ufm.c +++ b/sys/dev/usb/ufm.c @@ -90,19 +90,11 @@ d_ioctl_t ufmioctl; #define UFM_CDEV_MAJOR MAJOR_AUTO Static struct cdevsw ufm_cdevsw = { - /* open */ ufmopen, - /* close */ ufmclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ ufmioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ufm", - /* maj */ UFM_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = ufmopen, + .d_close = ufmclose, + .d_ioctl = ufmioctl, + .d_name = "ufm", + .d_maj = UFM_CDEV_MAJOR, #if (__FreeBSD_version < 500014) -1 #endif diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 5f997dc23eae..ffecd1208f34 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -138,19 +138,14 @@ d_poll_t ugenpoll; #define UGEN_CDEV_MAJOR 114 Static struct cdevsw ugen_cdevsw = { - /* open */ ugenopen, - /* close */ ugenclose, - /* read */ ugenread, - /* write */ ugenwrite, - /* ioctl */ ugenioctl, - /* poll */ ugenpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ugen", - /* maj */ UGEN_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = ugenopen, + .d_close = ugenclose, + .d_read = ugenread, + .d_write = ugenwrite, + .d_ioctl = ugenioctl, + .d_poll = ugenpoll, + .d_name = "ugen", + .d_maj = UGEN_CDEV_MAJOR, #if __FreeBSD_version < 500014 /* bmaj */ -1 #endif diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index 2570aa19a8d4..68ee1d395580 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -149,19 +149,14 @@ d_poll_t uhidpoll; #define UHID_CDEV_MAJOR 122 Static struct cdevsw uhid_cdevsw = { - /* open */ uhidopen, - /* close */ uhidclose, - /* read */ uhidread, - /* write */ uhidwrite, - /* ioctl */ uhidioctl, - /* poll */ uhidpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "uhid", - /* maj */ UHID_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = uhidopen, + .d_close = uhidclose, + .d_read = uhidread, + .d_write = uhidwrite, + .d_ioctl = uhidioctl, + .d_poll = uhidpoll, + .d_name = "uhid", + .d_maj = UHID_CDEV_MAJOR, #if __FreeBSD_version < 500014 /* bmaj */ -1 #endif diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index c4fd586ee0cf..71f6326fde67 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -147,19 +147,12 @@ Static d_ioctl_t ulptioctl; #define ULPT_CDEV_MAJOR 113 Static struct cdevsw ulpt_cdevsw = { - /* open */ ulptopen, - /* close */ ulptclose, - /* read */ noread, - /* write */ ulptwrite, - /* ioctl */ ulptioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ulpt", - /* maj */ ULPT_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = ulptopen, + .d_close = ulptclose, + .d_write = ulptwrite, + .d_ioctl = ulptioctl, + .d_name = "ulpt", + .d_maj = ULPT_CDEV_MAJOR, #if __FreeBSD_version < 500014 /* bmaj */ -1 #endif diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index e313d3e0ba2d..642d7d595bc8 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -149,19 +149,13 @@ Static d_poll_t ums_poll; #define UMS_CDEV_MAJOR 111 Static struct cdevsw ums_cdevsw = { - /* open */ ums_open, - /* close */ ums_close, - /* read */ ums_read, - /* write */ nowrite, - /* ioctl */ ums_ioctl, - /* poll */ ums_poll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ums", - /* maj */ UMS_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = ums_open, + .d_close = ums_close, + .d_read = ums_read, + .d_ioctl = ums_ioctl, + .d_poll = ums_poll, + .d_name = "ums", + .d_maj = UMS_CDEV_MAJOR, #if __FreeBSD_version < 500014 /* bmaj */ -1 #endif diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index e5f6cc75b01e..3b45bb4b758f 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -116,19 +116,13 @@ d_ioctl_t urioioctl; #define URIO_CDEV_MAJOR 143 Static struct cdevsw urio_cdevsw = { - /* open */ urioopen, - /* close */ urioclose, - /* read */ urioread, - /* write */ uriowrite, - /* ioctl */ urioioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "urio", - /* maj */ URIO_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = urioopen, + .d_close = urioclose, + .d_read = urioread, + .d_write = uriowrite, + .d_ioctl = urioioctl, + .d_name = "urio", + .d_maj = URIO_CDEV_MAJOR, #if __FreeBSD_version < 500014 -1 #endif diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 21127d698383..74d024f07956 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -136,19 +136,13 @@ d_ioctl_t usbioctl; d_poll_t usbpoll; struct cdevsw usb_cdevsw = { - /* open */ usbopen, - /* close */ usbclose, - /* read */ usbread, - /* write */ nowrite, - /* ioctl */ usbioctl, - /* poll */ usbpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "usb", - /* maj */ USB_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = usbopen, + .d_close = usbclose, + .d_read = usbread, + .d_ioctl = usbioctl, + .d_poll = usbpoll, + .d_name = "usb", + .d_maj = USB_CDEV_MAJOR, #if __FreeBSD_version < 500014 /* bmaj */ -1 #endif diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index 80f79abeb3f7..13d287b949eb 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -249,19 +249,13 @@ d_poll_t uscannerpoll; #define USCANNER_CDEV_MAJOR 156 Static struct cdevsw uscanner_cdevsw = { - /* open */ uscanneropen, - /* close */ uscannerclose, - /* read */ uscannerread, - /* write */ uscannerwrite, - /* ioctl */ noioctl, - /* poll */ uscannerpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "uscanner", - /* maj */ USCANNER_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = uscanneropen, + .d_close = uscannerclose, + .d_read = uscannerread, + .d_write = uscannerwrite, + .d_poll = uscannerpoll, + .d_name = "uscanner", + .d_maj = USCANNER_CDEV_MAJOR, #if __FreeBSD_version < 500014 /* bmaj */ -1 #endif diff --git a/sys/dev/vinum/vinum.c b/sys/dev/vinum/vinum.c index 40162715d9c4..81d7a46de415 100644 --- a/sys/dev/vinum/vinum.c +++ b/sys/dev/vinum/vinum.c @@ -55,19 +55,15 @@ extern struct mc malloced[]; struct cdevsw vinum_cdevsw = { - /* open */ vinumopen, - /* close */ vinumclose, - /* read */ physread, - /* write */ physwrite, - /* ioctl */ vinumioctl, - /* poll */ seltrue, - /* mmap */ nommap, - /* strategy */ vinumstrategy, - /* name */ "vinum", - /* maj */ VINUM_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_DISK + .d_open = vinumopen, + .d_close = vinumclose, + .d_read = physread, + .d_write = physwrite, + .d_ioctl = vinumioctl, + .d_strategy = vinumstrategy, + .d_name = "vinum", + .d_maj = VINUM_CDEV_MAJOR, + .d_flags = D_DISK }; /* Called by main() during pseudo-device attachment. */ diff --git a/sys/dev/zs/zs.c b/sys/dev/zs/zs.c index 718652180d9b..9ee3cdf3cf93 100644 --- a/sys/dev/zs/zs.c +++ b/sys/dev/zs/zs.c @@ -150,20 +150,16 @@ static void zsttystop(struct tty *tp, int rw); static int zsttyparam(struct tty *tp, struct termios *t); static struct cdevsw zstty_cdevsw = { - /* open */ zsttyopen, - /* close */ zsttyclose, - /* read */ ttyread, - /* write */ ttywrite, - /* ioctl */ zsttyioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "zstty", - /* major */ MAJOR_AUTO, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = zsttyopen, + .d_close = zsttyclose, + .d_read = ttyread, + .d_write = ttywrite, + .d_ioctl = zsttyioctl, + .d_poll = ttypoll, + .d_name = "zstty", + .d_maj = MAJOR_AUTO, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; static struct zstty_softc *zstty_cons; diff --git a/sys/fs/coda/coda_fbsd.c b/sys/fs/coda/coda_fbsd.c index 6907c63b58c9..23ce5e4f8a17 100644 --- a/sys/fs/coda/coda_fbsd.c +++ b/sys/fs/coda/coda_fbsd.c @@ -66,19 +66,14 @@ #define VC_DEV_NO 93 static struct cdevsw codadevsw = { - /* open */ vc_nb_open, - /* close */ vc_nb_close, - /* read */ vc_nb_read, - /* write */ vc_nb_write, - /* ioctl */ vc_nb_ioctl, - /* poll */ vc_nb_poll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "Coda", - /* maj */ VC_DEV_NO, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = vc_nb_open, + .d_close = vc_nb_close, + .d_read = vc_nb_read, + .d_write = vc_nb_write, + .d_ioctl = vc_nb_ioctl, + .d_poll = vc_nb_poll, + .d_name = "Coda", + .d_maj = VC_DEV_NO, }; int vcdebug = 1; diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c index 4fe4f985ab02..ce4030b1e5ab 100644 --- a/sys/geom/geom_ccd.c +++ b/sys/geom/geom_ccd.c @@ -115,19 +115,11 @@ static d_ioctl_t ccdctlioctl; #define CDEV_MAJOR 74 static struct cdevsw ccdctl_cdevsw = { - /* open */ nullopen, - /* close */ nullclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ ccdctlioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ccdctl", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0 + .d_open = nullopen, + .d_close = nullclose, + .d_ioctl = ccdctlioctl, + .d_name = "ccdctl", + .d_maj = CDEV_MAJOR, }; static LIST_HEAD(, ccd_s) ccd_softc_list = diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c index 7889081aca44..bd855dc36528 100644 --- a/sys/geom/geom_dev.c +++ b/sys/geom/geom_dev.c @@ -59,20 +59,15 @@ static d_strategy_t g_dev_strategy; static d_ioctl_t g_dev_ioctl; static struct cdevsw g_dev_cdevsw = { - /* open */ g_dev_open, - /* close */ g_dev_close, - /* read */ physread, - /* write */ physwrite, - /* ioctl */ g_dev_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ g_dev_strategy, - /* name */ "g_dev", - /* maj */ GEOM_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_DISK | D_TRACKCLOSE, - /* kqfilter */ nokqfilter + .d_open = g_dev_open, + .d_close = g_dev_close, + .d_read = physread, + .d_write = physwrite, + .d_ioctl = g_dev_ioctl, + .d_strategy = g_dev_strategy, + .d_name = "g_dev", + .d_maj = GEOM_MAJOR, + .d_flags = D_DISK | D_TRACKCLOSE, }; static g_taste_t g_dev_taste; diff --git a/sys/geom/geom_stats.c b/sys/geom/geom_stats.c index 2577b2abf75d..20687d743dc3 100644 --- a/sys/geom/geom_stats.c +++ b/sys/geom/geom_stats.c @@ -106,19 +106,11 @@ g_stat_delete(struct g_stat *gsp) static d_mmap_t g_stat_mmap; static struct cdevsw geom_stats_cdevsw = { - /* open */ nullopen, - /* close */ nullclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ noioctl, - /* poll */ nopoll, - /* mmap */ g_stat_mmap, - /* strtegy */ nostrategy, - /* name */ "g_stats", - /* maj */ GEOM_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = nullopen, + .d_close = nullclose, + .d_mmap = g_stat_mmap, + .d_name = "g_stats", + .d_maj = GEOM_MAJOR, }; static int diff --git a/sys/i386/acpica/acpi_machdep.c b/sys/i386/acpica/acpi_machdep.c index fbf649b4627a..c0d8b91dfa62 100644 --- a/sys/i386/acpica/acpi_machdep.c +++ b/sys/i386/acpica/acpi_machdep.c @@ -64,19 +64,13 @@ static d_poll_t apmpoll; #define CDEV_MAJOR 39 static struct cdevsw apm_cdevsw = { - /* open */ apmopen, - /* close */ apmclose, - /* read */ noread, - /* write */ apmwrite, - /* ioctl */ apmioctl, - /* poll */ apmpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "apm", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = apmopen, + .d_close = apmclose, + .d_write = apmwrite, + .d_ioctl = apmioctl, + .d_poll = apmpoll, + .d_name = "apm", + .d_maj = CDEV_MAJOR, }; static int diff --git a/sys/i386/apm/apm.c b/sys/i386/apm/apm.c index 527987313df8..66bcdbe4bed2 100644 --- a/sys/i386/apm/apm.c +++ b/sys/i386/apm/apm.c @@ -90,19 +90,13 @@ static d_poll_t apmpoll; #define CDEV_MAJOR 39 static struct cdevsw apm_cdevsw = { - /* open */ apmopen, - /* close */ apmclose, - /* read */ noread, - /* write */ apmwrite, - /* ioctl */ apmioctl, - /* poll */ apmpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "apm", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = apmopen, + .d_close = apmclose, + .d_write = apmwrite, + .d_ioctl = apmioctl, + .d_poll = apmpoll, + .d_name = "apm", + .d_maj = CDEV_MAJOR, }; static int apm_suspend_delay = 1; diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index 527987313df8..66bcdbe4bed2 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -90,19 +90,13 @@ static d_poll_t apmpoll; #define CDEV_MAJOR 39 static struct cdevsw apm_cdevsw = { - /* open */ apmopen, - /* close */ apmclose, - /* read */ noread, - /* write */ apmwrite, - /* ioctl */ apmioctl, - /* poll */ apmpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "apm", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = apmopen, + .d_close = apmclose, + .d_write = apmwrite, + .d_ioctl = apmioctl, + .d_poll = apmpoll, + .d_name = "apm", + .d_maj = CDEV_MAJOR, }; static int apm_suspend_delay = 1; diff --git a/sys/i386/bios/smapi.c b/sys/i386/bios/smapi.c index 038a076d0843..80b8f4cc5d61 100644 --- a/sys/i386/bios/smapi.c +++ b/sys/i386/bios/smapi.c @@ -54,20 +54,12 @@ static d_ioctl_t smapi_ioctl; #define CDEV_MAJOR 183 static struct cdevsw smapi_cdevsw = { - /* open */ smapi_open, - /* close */ smapi_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ smapi_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "smapi", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_MEM, - /* kqfilter */ NULL, + .d_open = smapi_open, + .d_close = smapi_close, + .d_ioctl = smapi_ioctl, + .d_name = "smapi", + .d_maj = CDEV_MAJOR, + .d_flags = D_MEM, }; static int diff --git a/sys/i386/i386/elan-mmcr.c b/sys/i386/i386/elan-mmcr.c index bd68670dbd4b..e0492b50c126 100644 --- a/sys/i386/i386/elan-mmcr.c +++ b/sys/i386/i386/elan-mmcr.c @@ -171,19 +171,13 @@ static d_mmap_t elan_mmap; #define CDEV_MAJOR 100 /* Share with xrpu */ static struct cdevsw elan_cdevsw = { - /* open */ nullopen, - /* close */ nullclose, - /* read */ noread, - /* write */ elan_write, - /* ioctl */ elan_ioctl, - /* poll */ nopoll, - /* mmap */ elan_mmap, - /* strategy */ nostrategy, - /* name */ "elan", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = nullopen, + .d_close = nullclose, + .d_write = elan_write, + .d_ioctl = elan_ioctl, + .d_mmap = elan_mmap, + .d_name = "elan", + .d_maj = CDEV_MAJOR, }; static void diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index a045d962d2c2..cae4f6a0ce2d 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -78,19 +78,15 @@ static d_mmap_t memmmap; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { - /* open */ mmopen, - /* close */ mmclose, - /* read */ mmrw, - /* write */ mmrw, - /* ioctl */ mmioctl, - /* poll */ (d_poll_t *)seltrue, - /* mmap */ memmmap, - /* strategy */ nostrategy, - /* name */ "mem", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_MEM, + .d_open = mmopen, + .d_close = mmclose, + .d_read = mmrw, + .d_write = mmrw, + .d_ioctl = mmioctl, + .d_mmap = memmmap, + .d_name = "mem", + .d_maj = CDEV_MAJOR, + .d_flags = D_MEM, }; MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); diff --git a/sys/i386/i386/perfmon.c b/sys/i386/i386/perfmon.c index e4cca4fcdeb1..ab6db4150331 100644 --- a/sys/i386/i386/perfmon.c +++ b/sys/i386/i386/perfmon.c @@ -71,19 +71,11 @@ SYSINIT(cpu, SI_SUB_DRIVERS, SI_ORDER_ANY, perfmon_init_dev, NULL); #define CDEV_MAJOR 2 /* We're really a minor of mem.c */ static struct cdevsw perfmon_cdevsw = { - /* open */ perfmon_open, - /* close */ perfmon_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ perfmon_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "perfmon", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = perfmon_open, + .d_close = perfmon_close, + .d_ioctl = perfmon_ioctl, + .d_name = "perfmon", + .d_maj = CDEV_MAJOR, }; /* diff --git a/sys/i386/isa/asc.c b/sys/i386/isa/asc.c index 875dc58c151e..d231807b49e8 100644 --- a/sys/i386/isa/asc.c +++ b/sys/i386/isa/asc.c @@ -198,19 +198,13 @@ static d_poll_t ascpoll; #define CDEV_MAJOR 71 static struct cdevsw asc_cdevsw = { - /* open */ ascopen, - /* close */ ascclose, - /* read */ ascread, - /* write */ nowrite, - /* ioctl */ ascioctl, - /* poll */ ascpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "asc", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = ascopen, + .d_close = ascclose, + .d_read = ascread, + .d_ioctl = ascioctl, + .d_poll = ascpoll, + .d_name = "asc", + .d_maj = CDEV_MAJOR, }; #define STATIC static diff --git a/sys/i386/isa/ctx.c b/sys/i386/isa/ctx.c index e70c40ee5840..659c27b867bd 100644 --- a/sys/i386/isa/ctx.c +++ b/sys/i386/isa/ctx.c @@ -151,19 +151,13 @@ static d_ioctl_t ctxioctl; #define CDEV_MAJOR 40 static struct cdevsw ctx_cdevsw = { - /* open */ ctxopen, - /* close */ ctxclose, - /* read */ ctxread, - /* write */ ctxwrite, - /* ioctl */ ctxioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ctx", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = ctxopen, + .d_close = ctxclose, + .d_read = ctxread, + .d_write = ctxwrite, + .d_ioctl = ctxioctl, + .d_name = "ctx", + .d_maj = CDEV_MAJOR, }; diff --git a/sys/i386/isa/cx.c b/sys/i386/isa/cx.c index e8144151f971..0892a0fbfc53 100644 --- a/sys/i386/isa/cx.c +++ b/sys/i386/isa/cx.c @@ -73,20 +73,16 @@ static d_ioctl_t cxioctl; #define CDEV_MAJOR 42 /* Don't make this static, since if_cx.c uses it. */ struct cdevsw cx_cdevsw = { - /* open */ cxopen, - /* close */ cxclose, - /* read */ ttyread, - /* write */ ttywrite, - /* ioctl */ cxioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "cx", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = cxopen, + .d_close = cxclose, + .d_read = ttyread, + .d_write = ttywrite, + .d_ioctl = cxioctl, + .d_poll = ttypoll, + .d_name = "cx", + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; static void cxoproc (struct tty *tp); diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c index 0d5404395e67..53ea3bccd656 100644 --- a/sys/i386/isa/cy.c +++ b/sys/i386/isa/cy.c @@ -397,20 +397,16 @@ static d_ioctl_t sioioctl; #define CDEV_MAJOR 48 static struct cdevsw sio_cdevsw = { - /* open */ sioopen, - /* close */ sioclose, - /* read */ ttyread, - /* write */ siowrite, - /* ioctl */ sioioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ driver_name, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = sioopen, + .d_close = sioclose, + .d_read = ttyread, + .d_write = siowrite, + .d_ioctl = sioioctl, + .d_poll = ttypoll, + .d_name = driver_name, + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; static int comconsole = -1; diff --git a/sys/i386/isa/gpib.c b/sys/i386/isa/gpib.c index 0a5a0e054fbd..288775edab18 100644 --- a/sys/i386/isa/gpib.c +++ b/sys/i386/isa/gpib.c @@ -73,19 +73,12 @@ static d_ioctl_t gpioctl; #define CDEV_MAJOR 44 static struct cdevsw gp_cdevsw = { - /* open */ gpopen, - /* close */ gpclose, - /* read */ noread, - /* write */ gpwrite, - /* ioctl */ gpioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "gp", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = gpopen, + .d_close = gpclose, + .d_write = gpwrite, + .d_ioctl = gpioctl, + .d_name = "gp", + .d_maj = CDEV_MAJOR, }; #define BUFSIZE 1024 diff --git a/sys/i386/isa/gsc.c b/sys/i386/isa/gsc.c index 5a9483844e5a..b435ceda228b 100644 --- a/sys/i386/isa/gsc.c +++ b/sys/i386/isa/gsc.c @@ -193,19 +193,12 @@ static d_ioctl_t gscioctl; #define CDEV_MAJOR 47 static struct cdevsw gsc_cdevsw = { - /* open */ gscopen, - /* close */ gscclose, - /* read */ gscread, - /* write */ nowrite, - /* ioctl */ gscioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "gsc", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = gscopen, + .d_close = gscclose, + .d_read = gscread, + .d_ioctl = gscioctl, + .d_name = "gsc", + .d_maj = CDEV_MAJOR, }; diff --git a/sys/i386/isa/istallion.c b/sys/i386/isa/istallion.c index 35aa8363d8f1..d9886873a43f 100644 --- a/sys/i386/isa/istallion.c +++ b/sys/i386/isa/istallion.c @@ -642,20 +642,16 @@ COMPAT_ISA_DRIVER(stli, stlidriver); #define CDEV_MAJOR 75 static struct cdevsw stli_cdevsw = { - /* open */ stliopen, - /* close */ stliclose, - /* read */ stliread, - /* write */ stliwrite, - /* ioctl */ stliioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ stli_drvname, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = stliopen, + .d_close = stliclose, + .d_read = stliread, + .d_write = stliwrite, + .d_ioctl = stliioctl, + .d_poll = ttypoll, + .d_name = stli_drvname, + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; #endif diff --git a/sys/i386/isa/loran.c b/sys/i386/isa/loran.c index f41338c9c695..47b8b7db8d48 100644 --- a/sys/i386/isa/loran.c +++ b/sys/i386/isa/loran.c @@ -622,19 +622,12 @@ struct isa_driver lorandriver = { COMPAT_ISA_DRIVER(loran, lorandriver); static struct cdevsw loran_cdevsw = { - /* open */ loranopen, - /* close */ loranclose, - /* read */ loranread, - /* write */ loranwrite, - /* ioctl */ noioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "loran", - /* maj */ MAJOR_AUTO, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = loranopen, + .d_close = loranclose, + .d_read = loranread, + .d_write = loranwrite, + .d_name = "loran", + .d_maj = MAJOR_AUTO, }; #endif /* _KERNEL */ diff --git a/sys/i386/isa/mse.c b/sys/i386/isa/mse.c index 17622bd2eae2..57b0e7b1f15c 100644 --- a/sys/i386/isa/mse.c +++ b/sys/i386/isa/mse.c @@ -139,19 +139,13 @@ static d_poll_t msepoll; #define CDEV_MAJOR 27 static struct cdevsw mse_cdevsw = { - /* open */ mseopen, - /* close */ mseclose, - /* read */ mseread, - /* write */ nowrite, - /* ioctl */ mseioctl, - /* poll */ msepoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "mse", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = mseopen, + .d_close = mseclose, + .d_read = mseread, + .d_ioctl = mseioctl, + .d_poll = msepoll, + .d_name = "mse", + .d_maj = CDEV_MAJOR, }; static void mseintr(void *); diff --git a/sys/i386/isa/pcaudio.c b/sys/i386/isa/pcaudio.c index 2978471017d9..170407f39923 100644 --- a/sys/i386/isa/pcaudio.c +++ b/sys/i386/isa/pcaudio.c @@ -155,19 +155,13 @@ static d_poll_t pcapoll; #define CDEV_MAJOR 24 static struct cdevsw pca_cdevsw = { - /* open */ pcaopen, - /* close */ pcaclose, - /* read */ noread, - /* write */ pcawrite, - /* ioctl */ pcaioctl, - /* poll */ pcapoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "pca", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = pcaopen, + .d_close = pcaclose, + .d_write = pcawrite, + .d_ioctl = pcaioctl, + .d_poll = pcapoll, + .d_name = "pca", + .d_maj = CDEV_MAJOR, }; static void pca_continue(void); diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c index 72a23e0df2ba..55570ea51971 100644 --- a/sys/i386/isa/pcvt/pcvt_drv.c +++ b/sys/i386/isa/pcvt/pcvt_drv.c @@ -96,20 +96,17 @@ static d_mmap_t pcvt_mmap; #define CDEV_MAJOR 12 static struct cdevsw vt_cdevsw = { - /* open */ pcvt_open, - /* close */ pcvt_close, - /* read */ ttyread, - /* write */ ttywrite, - /* ioctl */ pcvt_ioctl, - /* poll */ ttypoll, - /* mmap */ pcvt_mmap, - /* strategy */ nostrategy, - /* name */ "vt", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = pcvt_open, + .d_close = pcvt_close, + .d_read = ttyread, + .d_write = ttywrite, + .d_ioctl = pcvt_ioctl, + .d_poll = ttypoll, + .d_mmap = pcvt_mmap, + .d_name = "vt", + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; static int pcvt_probe(device_t dev); diff --git a/sys/i386/isa/spic.c b/sys/i386/isa/spic.c index 6bc5ac488c41..7331f74d82c7 100644 --- a/sys/i386/isa/spic.c +++ b/sys/i386/isa/spic.c @@ -84,19 +84,13 @@ static d_ioctl_t spicioctl; static d_poll_t spicpoll; static struct cdevsw spic_cdevsw = { - /* open */ spicopen, - /* close */ spicclose, - /* read */ spicread, - /* write */ nowrite, - /* ioctl */ spicioctl, - /* poll */ spicpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "spic", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = spicopen, + .d_close = spicclose, + .d_read = spicread, + .d_ioctl = spicioctl, + .d_poll = spicpoll, + .d_name = "spic", + .d_maj = CDEV_MAJOR, }; #define SCBUFLEN 128 diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c index 79ad930d7370..1a7bfec96f76 100644 --- a/sys/i386/isa/spigot.c +++ b/sys/i386/isa/spigot.c @@ -106,19 +106,14 @@ static d_mmap_t spigot_mmap; #define CDEV_MAJOR 11 static struct cdevsw spigot_cdevsw = { - /* open */ spigot_open, - /* close */ spigot_close, - /* read */ spigot_read, - /* write */ spigot_write, - /* ioctl */ spigot_ioctl, - /* poll */ nopoll, - /* mmap */ spigot_mmap, - /* strategy */ nostrategy, - /* name */ "spigot", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = spigot_open, + .d_close = spigot_close, + .d_read = spigot_read, + .d_write = spigot_write, + .d_ioctl = spigot_ioctl, + .d_mmap = spigot_mmap, + .d_name = "spigot", + .d_maj = CDEV_MAJOR, }; static ointhand2_t spigintr; diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c index 22b6bf36c59b..97fa4e6c41b0 100644 --- a/sys/i386/isa/spkr.c +++ b/sys/i386/isa/spkr.c @@ -34,19 +34,12 @@ static d_ioctl_t spkrioctl; #define CDEV_MAJOR 26 static struct cdevsw spkr_cdevsw = { - /* open */ spkropen, - /* close */ spkrclose, - /* read */ noread, - /* write */ spkrwrite, - /* ioctl */ spkrioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "spkr", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = spkropen, + .d_close = spkrclose, + .d_write = spkrwrite, + .d_ioctl = spkrioctl, + .d_name = "spkr", + .d_maj = CDEV_MAJOR, }; static MALLOC_DEFINE(M_SPKR, "spkr", "Speaker buffer"); diff --git a/sys/i386/isa/stallion.c b/sys/i386/isa/stallion.c index 1d8c66614528..ebf3534db4b2 100644 --- a/sys/i386/isa/stallion.c +++ b/sys/i386/isa/stallion.c @@ -536,20 +536,16 @@ COMPAT_PCI_DRIVER (stlpci, stlpcidriver); #define CDEV_MAJOR 72 static struct cdevsw stl_cdevsw = { - /* open */ stlopen, - /* close */ stlclose, - /* read */ ttyread, - /* write */ ttywrite, - /* ioctl */ stlioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "stl", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = stlopen, + .d_close = stlclose, + .d_read = ttyread, + .d_write = ttywrite, + .d_ioctl = stlioctl, + .d_poll = ttypoll, + .d_name = "stl", + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; #endif diff --git a/sys/i386/isa/tw.c b/sys/i386/isa/tw.c index 320082807773..d0d0e65f8f6c 100644 --- a/sys/i386/isa/tw.c +++ b/sys/i386/isa/tw.c @@ -226,19 +226,13 @@ static d_poll_t twpoll; #define CDEV_MAJOR 19 static struct cdevsw tw_cdevsw = { - /* open */ twopen, - /* close */ twclose, - /* read */ twread, - /* write */ twwrite, - /* ioctl */ noioctl, - /* poll */ twpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "tw", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = twopen, + .d_close = twclose, + .d_read = twread, + .d_write = twwrite, + .d_poll = twpoll, + .d_name = "tw", + .d_maj = CDEV_MAJOR, }; /* diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c index 64356e73dc2b..e29664d30a27 100644 --- a/sys/i386/isa/wt.c +++ b/sys/i386/isa/wt.c @@ -186,19 +186,14 @@ static d_strategy_t wtstrategy; #define CDEV_MAJOR 10 static struct cdevsw wt_cdevsw = { - /* open */ wtopen, - /* close */ wtclose, - /* read */ physread, - /* write */ physwrite, - /* ioctl */ wtioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ wtstrategy, - /* name */ "wt", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = wtopen, + .d_close = wtclose, + .d_read = physread, + .d_write = physwrite, + .d_ioctl = wtioctl, + .d_strategy = wtstrategy, + .d_name = "wt", + .d_maj = CDEV_MAJOR, }; diff --git a/sys/i386/smapi/smapi.c b/sys/i386/smapi/smapi.c index 038a076d0843..80b8f4cc5d61 100644 --- a/sys/i386/smapi/smapi.c +++ b/sys/i386/smapi/smapi.c @@ -54,20 +54,12 @@ static d_ioctl_t smapi_ioctl; #define CDEV_MAJOR 183 static struct cdevsw smapi_cdevsw = { - /* open */ smapi_open, - /* close */ smapi_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ smapi_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "smapi", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_MEM, - /* kqfilter */ NULL, + .d_open = smapi_open, + .d_close = smapi_close, + .d_ioctl = smapi_ioctl, + .d_name = "smapi", + .d_maj = CDEV_MAJOR, + .d_flags = D_MEM, }; static int diff --git a/sys/i4b/driver/i4b_ctl.c b/sys/i4b/driver/i4b_ctl.c index 9a2b789bf97a..4eb03c30677e 100644 --- a/sys/i4b/driver/i4b_ctl.c +++ b/sys/i4b/driver/i4b_ctl.c @@ -59,19 +59,12 @@ static d_poll_t i4bctlpoll; #define CDEV_MAJOR 55 static struct cdevsw i4bctl_cdevsw = { - /* open */ i4bctlopen, - /* close */ i4bctlclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ i4bctlioctl, - /* poll */ i4bctlpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "i4bctl", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = i4bctlopen, + .d_close = i4bctlclose, + .d_ioctl = i4bctlioctl, + .d_poll = i4bctlpoll, + .d_name = "i4bctl", + .d_maj = CDEV_MAJOR, }; static void i4bctlattach(void *); diff --git a/sys/i4b/driver/i4b_rbch.c b/sys/i4b/driver/i4b_rbch.c index 63b941dade44..ebd48664e1be 100644 --- a/sys/i4b/driver/i4b_rbch.c +++ b/sys/i4b/driver/i4b_rbch.c @@ -113,19 +113,14 @@ static d_poll_t i4brbchpoll; #define CDEV_MAJOR 57 static struct cdevsw i4brbch_cdevsw = { - /* open */ i4brbchopen, - /* close */ i4brbchclose, - /* read */ i4brbchread, - /* write */ i4brbchwrite, - /* ioctl */ i4brbchioctl, - /* poll */ i4brbchpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "i4brbch", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = i4brbchopen, + .d_close = i4brbchclose, + .d_read = i4brbchread, + .d_write = i4brbchwrite, + .d_ioctl = i4brbchioctl, + .d_poll = i4brbchpoll, + .d_name = "i4brbch", + .d_maj = CDEV_MAJOR, }; static void i4brbchattach(void *); diff --git a/sys/i4b/driver/i4b_tel.c b/sys/i4b/driver/i4b_tel.c index 3792e866b454..231886d95765 100644 --- a/sys/i4b/driver/i4b_tel.c +++ b/sys/i4b/driver/i4b_tel.c @@ -136,19 +136,14 @@ static d_poll_t i4btelpoll; #define CDEV_MAJOR 56 static struct cdevsw i4btel_cdevsw = { - /* open */ i4btelopen, - /* close */ i4btelclose, - /* read */ i4btelread, - /* write */ i4btelwrite, - /* ioctl */ i4btelioctl, - /* poll */ i4btelpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "i4btel", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = i4btelopen, + .d_close = i4btelclose, + .d_read = i4btelread, + .d_write = i4btelwrite, + .d_ioctl = i4btelioctl, + .d_poll = i4btelpoll, + .d_name = "i4btel", + .d_maj = CDEV_MAJOR, }; static void i4btelattach(void *); diff --git a/sys/i4b/driver/i4b_trace.c b/sys/i4b/driver/i4b_trace.c index a8201a4e7d3e..d7c89e0eaf27 100644 --- a/sys/i4b/driver/i4b_trace.c +++ b/sys/i4b/driver/i4b_trace.c @@ -76,19 +76,13 @@ static d_poll_t i4btrcpoll; #define CDEV_MAJOR 59 static struct cdevsw i4btrc_cdevsw = { - /* open */ i4btrcopen, - /* close */ i4btrcclose, - /* read */ i4btrcread, - /* write */ nowrite, - /* ioctl */ i4btrcioctl, - /* poll */ i4btrcpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "i4btrc", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = i4btrcopen, + .d_close = i4btrcclose, + .d_read = i4btrcread, + .d_ioctl = i4btrcioctl, + .d_poll = i4btrcpoll, + .d_name = "i4btrc", + .d_maj = CDEV_MAJOR, }; static void i4btrcattach(void *); diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c index 6d4a107e2e35..24d896a82638 100644 --- a/sys/i4b/layer4/i4b_i4bdrv.c +++ b/sys/i4b/layer4/i4b_i4bdrv.c @@ -79,19 +79,13 @@ static d_poll_t i4bpoll; #define CDEV_MAJOR 60 static struct cdevsw i4b_cdevsw = { - /* open */ i4bopen, - /* close */ i4bclose, - /* read */ i4bread, - /* write */ nowrite, - /* ioctl */ i4bioctl, - /* poll */ i4bpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "i4b", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = i4bopen, + .d_close = i4bclose, + .d_read = i4bread, + .d_ioctl = i4bioctl, + .d_poll = i4bpoll, + .d_name = "i4b", + .d_maj = CDEV_MAJOR, }; static void i4battach(void *); diff --git a/sys/ia64/ia64/mem.c b/sys/ia64/ia64/mem.c index 146b68453a85..f83da088c052 100644 --- a/sys/ia64/ia64/mem.c +++ b/sys/ia64/ia64/mem.c @@ -82,19 +82,15 @@ static d_mmap_t memmmap; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { - /* open */ mmopen, - /* close */ mmclose, - /* read */ mmrw, - /* write */ mmrw, - /* ioctl */ mmioctl, - /* poll */ (d_poll_t *)seltrue, - /* mmap */ memmmap, - /* strategy */ nostrategy, - /* name */ "mem", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_MEM, + .d_open = mmopen, + .d_close = mmclose, + .d_read = mmrw, + .d_write = mmrw, + .d_ioctl = mmioctl, + .d_mmap = memmmap, + .d_name = "mem", + .d_maj = CDEV_MAJOR, + .d_flags = D_MEM, }; struct mem_range_softc mem_range_softc; diff --git a/sys/ia64/ia64/ssc.c b/sys/ia64/ia64/ssc.c index e552ffdbac9c..8bacab966244 100644 --- a/sys/ia64/ia64/ssc.c +++ b/sys/ia64/ia64/ssc.c @@ -59,19 +59,14 @@ static d_ioctl_t sscioctl; #define CDEV_MAJOR 97 static struct cdevsw ssc_cdevsw = { - /* open */ sscopen, - /* close */ sscclose, - /* read */ ttyread, - /* write */ ttywrite, - /* ioctl */ sscioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ssc", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = sscopen, + .d_close = sscclose, + .d_read = ttyread, + .d_write = ttywrite, + .d_ioctl = sscioctl, + .d_poll = ttypoll, + .d_name = "ssc", + .d_maj = CDEV_MAJOR, }; static struct tty *ssc_tp = NULL; diff --git a/sys/isa/fd.c b/sys/isa/fd.c index 917356495f9a..bb2cc86de2bb 100644 --- a/sys/isa/fd.c +++ b/sys/isa/fd.c @@ -477,19 +477,15 @@ fdin_rd(fdc_p fdc) #define CDEV_MAJOR 9 static struct cdevsw fd_cdevsw = { - /* open */ Fdopen, - /* close */ fdclose, - /* read */ physread, - /* write */ physwrite, - /* ioctl */ fdioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ fdstrategy, - /* name */ "fd", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_DISK, + .d_open = Fdopen, + .d_close = fdclose, + .d_read = physread, + .d_write = physwrite, + .d_ioctl = fdioctl, + .d_strategy = fdstrategy, + .d_name = "fd", + .d_maj = CDEV_MAJOR, + .d_flags = D_DISK, }; /* diff --git a/sys/isa/psm.c b/sys/isa/psm.c index 5b4cc2007dab..968491d346e4 100644 --- a/sys/isa/psm.c +++ b/sys/isa/psm.c @@ -326,19 +326,13 @@ static driver_t psm_driver = { #define CDEV_MAJOR 21 static struct cdevsw psm_cdevsw = { - /* open */ psmopen, - /* close */ psmclose, - /* read */ psmread, - /* write */ nowrite, - /* ioctl */ psmioctl, - /* poll */ psmpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ PSM_DRIVER_NAME, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = psmopen, + .d_close = psmclose, + .d_read = psmread, + .d_ioctl = psmioctl, + .d_poll = psmpoll, + .d_name = PSM_DRIVER_NAME, + .d_maj = CDEV_MAJOR, }; /* debug message level */ diff --git a/sys/isa/vga_isa.c b/sys/isa/vga_isa.c index 9e7e61b344bf..52844f31cfa7 100644 --- a/sys/isa/vga_isa.c +++ b/sys/isa/vga_isa.c @@ -69,19 +69,14 @@ static d_ioctl_t isavga_ioctl; static d_mmap_t isavga_mmap; static struct cdevsw isavga_cdevsw = { - /* open */ isavga_open, - /* close */ isavga_close, - /* read */ isavga_read, - /* write */ isavga_write, - /* ioctl */ isavga_ioctl, - /* poll */ nopoll, - /* mmap */ isavga_mmap, - /* strategy */ nostrategy, - /* name */ VGA_DRIVER_NAME, - /* maj */ -1, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = isavga_open, + .d_close = isavga_close, + .d_read = isavga_read, + .d_write = isavga_write, + .d_ioctl = isavga_ioctl, + .d_mmap = isavga_mmap, + .d_name = VGA_DRIVER_NAME, + .d_maj = -1, }; #endif /* FB_INSTALL_CDEV */ diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index d1794fa88f47..4606fd6c8e01 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -95,20 +95,18 @@ dead_strategy(struct bio *bp) #define dead_kqfilter (d_kqfilter_t *)enxio static struct cdevsw dead_cdevsw = { - /* open */ dead_open, - /* close */ dead_close, - /* read */ dead_read, - /* write */ dead_write, - /* ioctl */ dead_ioctl, - /* poll */ dead_poll, - /* mmap */ dead_mmap, - /* strategy */ dead_strategy, - /* name */ "dead", - /* maj */ 255, - /* dump */ dead_dump, - /* psize */ nopsize, - /* flags */ 0, - /* kqfilter */ dead_kqfilter + .d_open = dead_open, + .d_close = dead_close, + .d_read = dead_read, + .d_write = dead_write, + .d_ioctl = dead_ioctl, + .d_poll = dead_poll, + .d_mmap = dead_mmap, + .d_strategy = dead_strategy, + .d_name = "dead", + .d_maj = 255, + .d_dump = dead_dump, + .d_kqfilter = dead_kqfilter }; diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 109b8aedcf41..0d0297457047 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -83,19 +83,9 @@ static d_open_t fdopen; #define CDEV_MAJOR 22 static struct cdevsw fildesc_cdevsw = { - /* open */ fdopen, - /* close */ noclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ noioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "FD", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = fdopen, + .d_name = "FD", + .d_maj = CDEV_MAJOR, }; /* How to treat 'new' parameter when allocating a fd for do_dup(). */ diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 90b432bd1b6d..75529a0daaae 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -217,19 +217,13 @@ static d_poll_t devpoll; #define CDEV_MAJOR 173 static struct cdevsw dev_cdevsw = { - /* open */ devopen, - /* close */ devclose, - /* read */ devread, - /* write */ nowrite, - /* ioctl */ devioctl, - /* poll */ devpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "devctl", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = devopen, + .d_close = devclose, + .d_read = devread, + .d_ioctl = devioctl, + .d_poll = devpoll, + .d_name = "devctl", + .d_maj = CDEV_MAJOR, }; struct dev_event_info diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index c506e9e35a67..97644c138859 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -67,19 +67,13 @@ static void logtimeout(void *arg); #define CDEV_MAJOR 7 static struct cdevsw log_cdevsw = { - /* open */ logopen, - /* close */ logclose, - /* read */ logread, - /* write */ nowrite, - /* ioctl */ logioctl, - /* poll */ logpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "log", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = logopen, + .d_close = logclose, + .d_read = logread, + .d_ioctl = logioctl, + .d_poll = logpoll, + .d_name = "log", + .d_maj = CDEV_MAJOR, }; static struct logsoftc { diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index e672eac69db6..e536b45287bc 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -71,20 +71,16 @@ static d_kqfilter_t cnkqfilter; #define CDEV_MAJOR 0 static struct cdevsw cn_cdevsw = { - /* open */ cnopen, - /* close */ cnclose, - /* read */ cnread, - /* write */ cnwrite, - /* ioctl */ cnioctl, - /* poll */ cnpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "console", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ cnkqfilter, + .d_open = cnopen, + .d_close = cnclose, + .d_read = cnread, + .d_write = cnwrite, + .d_ioctl = cnioctl, + .d_poll = cnpoll, + .d_name = "console", + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = cnkqfilter, }; struct cn_device { diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index 83f2b9c06ad5..1561eb1155bd 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -77,38 +77,30 @@ static d_poll_t ptcpoll; #define CDEV_MAJOR_S 5 static struct cdevsw pts_cdevsw = { - /* open */ ptsopen, - /* close */ ptsclose, - /* read */ ptsread, - /* write */ ptswrite, - /* ioctl */ ptyioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "pts", - /* maj */ CDEV_MAJOR_S, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = ptsopen, + .d_close = ptsclose, + .d_read = ptsread, + .d_write = ptswrite, + .d_ioctl = ptyioctl, + .d_poll = ttypoll, + .d_name = "pts", + .d_maj = CDEV_MAJOR_S, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; #define CDEV_MAJOR_C 6 static struct cdevsw ptc_cdevsw = { - /* open */ ptcopen, - /* close */ ptcclose, - /* read */ ptcread, - /* write */ ptcwrite, - /* ioctl */ ptyioctl, - /* poll */ ptcpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ptc", - /* maj */ CDEV_MAJOR_C, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = ptcopen, + .d_close = ptcclose, + .d_read = ptcread, + .d_write = ptcwrite, + .d_ioctl = ptyioctl, + .d_poll = ptcpoll, + .d_name = "ptc", + .d_maj = CDEV_MAJOR_C, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; #define BUFSIZ 100 /* Chunk size iomoved to/from user */ diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index 52fc4dbfdfc4..cdeaa41a0fd5 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -37,19 +37,11 @@ static d_open_t cttyopen; #define CDEV_MAJOR 1 static struct cdevsw ctty_cdevsw = { - /* open */ cttyopen, - /* close */ nullclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ noioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ctty", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY, + .d_open = cttyopen, + .d_close = nullclose, + .d_name = "ctty", + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY, }; static dev_t ctty; diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 38ae86144837..a27cd3bf0cc2 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -121,19 +121,14 @@ static d_poll_t bpfpoll; #define CDEV_MAJOR 23 static struct cdevsw bpf_cdevsw = { - /* open */ bpfopen, - /* close */ bpfclose, - /* read */ bpfread, - /* write */ bpfwrite, - /* ioctl */ bpfioctl, - /* poll */ bpfpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "bpf", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = bpfopen, + .d_close = bpfclose, + .d_read = bpfread, + .d_write = bpfwrite, + .d_ioctl = bpfioctl, + .d_poll = bpfpoll, + .d_name = "bpf", + .d_maj = CDEV_MAJOR, }; diff --git a/sys/net/if.c b/sys/net/if.c index cdf5fd38c119..bad97806b467 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -131,20 +131,13 @@ static d_ioctl_t netioctl; static d_kqfilter_t netkqfilter; static struct cdevsw net_cdevsw = { - /* open */ netopen, - /* close */ netclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ netioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "net", - /* maj */ MAJOR_AUTO, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_KQFILTER, - /* kqfilter */ netkqfilter, + .d_open = netopen, + .d_close = netclose, + .d_ioctl = netioctl, + .d_name = "net", + .d_maj = MAJOR_AUTO, + .d_flags = D_KQFILTER, + .d_kqfilter = netkqfilter, }; static int diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index 388ca6017af9..3ac2be8e2487 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -101,19 +101,14 @@ static d_ioctl_t tapioctl; static d_poll_t tappoll; static struct cdevsw tap_cdevsw = { - /* open */ tapopen, - /* close */ tapclose, - /* read */ tapread, - /* write */ tapwrite, - /* ioctl */ tapioctl, - /* poll */ tappoll, - /* mmap */ nommap, - /* startegy */ nostrategy, - /* dev name */ CDEV_NAME, - /* dev major */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = tapopen, + .d_close = tapclose, + .d_read = tapread, + .d_write = tapwrite, + .d_ioctl = tapioctl, + .d_poll = tappoll, + .d_name = CDEV_NAME, + .d_maj = CDEV_MAJOR, }; static int tapdebug = 0; /* debug flag */ diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 1c7d61eb59a9..e0b3c9795a01 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -81,19 +81,14 @@ static d_poll_t tunpoll; #define CDEV_MAJOR 52 static struct cdevsw tun_cdevsw = { - /* open */ tunopen, - /* close */ tunclose, - /* read */ tunread, - /* write */ tunwrite, - /* ioctl */ tunioctl, - /* poll */ tunpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ TUNNAME, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = tunopen, + .d_close = tunclose, + .d_read = tunread, + .d_write = tunwrite, + .d_ioctl = tunioctl, + .d_poll = tunpoll, + .d_name = TUNNAME, + .d_maj = CDEV_MAJOR, }; static void diff --git a/sys/netgraph/ng_device.c b/sys/netgraph/ng_device.c index 956b7cfb3642..e679d4ed858d 100644 --- a/sys/netgraph/ng_device.c +++ b/sys/netgraph/ng_device.c @@ -114,19 +114,14 @@ static d_poll_t ngdpoll; #define NGD_CDEV_MAJOR 20 static struct cdevsw ngd_cdevsw = { - /* open */ ngdopen, - /* close */ ngdclose, - /* read */ ngdread, - /* write */ ngdwrite, - /* ioctl */ ngdioctl, - /* poll */ ngdpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ngd", - /* maj */ NGD_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = ngdopen, + .d_close = ngdclose, + .d_read = ngdread, + .d_write = ngdwrite, + .d_ioctl = ngdioctl, + .d_poll = ngdpoll, + .d_name = "ngd", + .d_maj = NGD_CDEV_MAJOR, }; /* diff --git a/sys/netncp/ncp_mod.c b/sys/netncp/ncp_mod.c index 877528c0d082..889d620cd322 100644 --- a/sys/netncp/ncp_mod.c +++ b/sys/netncp/ncp_mod.c @@ -64,19 +64,11 @@ static dev_t ncp_dev; static d_ioctl_t ncp_ioctl; static struct cdevsw ncp_cdevsw = { - /* open */ nullopen, - /* close */ nullclose, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ ncp_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ncp", - /* maj */ MAJOR_AUTO, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0 + .d_open = nullopen, + .d_close = nullclose, + .d_ioctl = ncp_ioctl, + .d_name = "ncp", + .d_maj = MAJOR_AUTO, }; static int ncp_conn_frag_rq(struct ncp_conn *, struct thread *, diff --git a/sys/netsmb/smb_dev.c b/sys/netsmb/smb_dev.c index 3ee11d2b3633..a22507cd5ea3 100644 --- a/sys/netsmb/smb_dev.c +++ b/sys/netsmb/smb_dev.c @@ -85,19 +85,11 @@ int smb_dev_queue(struct smb_dev *ndp, struct smb_rq *rqp, int prio); */ static struct cdevsw nsmb_cdevsw = { - /* open */ nsmb_dev_open, - /* close */ nsmb_dev_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ nsmb_dev_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ NSMB_NAME, - /* maj */ NSMB_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = nsmb_dev_open, + .d_close = nsmb_dev_close, + .d_ioctl = nsmb_dev_ioctl, + .d_name = NSMB_NAME, + .d_maj = NSMB_MAJOR, #ifndef FB_CURRENT /* bmaj */ -1 #endif diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index d8487f4b1bde..a40c85975397 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -747,20 +747,13 @@ cryptoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) #define CRYPTO_MAJOR 70 /* from openbsd */ static struct cdevsw crypto_cdevsw = { - /* open */ cryptoopen, - /* close */ nullclose, - /* read */ cryptoread, - /* write */ cryptowrite, - /* ioctl */ cryptoioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* dev name */ "crypto", - /* dev major */ CRYPTO_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, - /* kqfilter */ NULL + .d_open = cryptoopen, + .d_close = nullclose, + .d_read = cryptoread, + .d_write = cryptowrite, + .d_ioctl = cryptoioctl, + .d_name = "crypto", + .d_maj = CRYPTO_MAJOR, }; static dev_t crypto_dev; diff --git a/sys/pc98/apm/apm.c b/sys/pc98/apm/apm.c index 1eb910e86ccb..48b2ce793b79 100644 --- a/sys/pc98/apm/apm.c +++ b/sys/pc98/apm/apm.c @@ -107,19 +107,13 @@ static d_poll_t apmpoll; #define CDEV_MAJOR 39 static struct cdevsw apm_cdevsw = { - /* open */ apmopen, - /* close */ apmclose, - /* read */ noread, - /* write */ apmwrite, - /* ioctl */ apmioctl, - /* poll */ apmpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "apm", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = apmopen, + .d_close = apmclose, + .d_write = apmwrite, + .d_ioctl = apmioctl, + .d_poll = apmpoll, + .d_name = "apm", + .d_maj = CDEV_MAJOR, }; static int apm_suspend_delay = 1; diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c index 98b96229a7ae..05d6ab9cbf0e 100644 --- a/sys/pc98/cbus/fdc.c +++ b/sys/pc98/cbus/fdc.c @@ -620,19 +620,15 @@ fdin_rd(fdc_p fdc) #define CDEV_MAJOR 9 static struct cdevsw fd_cdevsw = { - /* open */ Fdopen, - /* close */ fdclose, - /* read */ physread, - /* write */ physwrite, - /* ioctl */ fdioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ fdstrategy, - /* name */ "fd", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_DISK, + .d_open = Fdopen, + .d_close = fdclose, + .d_read = physread, + .d_write = physwrite, + .d_ioctl = fdioctl, + .d_strategy = fdstrategy, + .d_name = "fd", + .d_maj = CDEV_MAJOR, + .d_flags = D_DISK, }; /* diff --git a/sys/pc98/cbus/gdc.c b/sys/pc98/cbus/gdc.c index 6525c5b2e7f6..01a63ad58ae8 100644 --- a/sys/pc98/cbus/gdc.c +++ b/sys/pc98/cbus/gdc.c @@ -102,19 +102,14 @@ static d_ioctl_t gdcioctl; static d_mmap_t gdcmmap; static struct cdevsw gdc_cdevsw = { - /* open */ gdcopen, - /* close */ gdcclose, - /* read */ gdcread, - /* write */ gdcwrite, - /* ioctl */ gdcioctl, - /* poll */ nopoll, - /* mmap */ gdcmmap, - /* strategy */ nostrategy, - /* name */ DRIVER_NAME, - /* maj */ -1, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = gdcopen, + .d_close = gdcclose, + .d_read = gdcread, + .d_write = gdcwrite, + .d_ioctl = gdcioctl, + .d_mmap = gdcmmap, + .d_name = DRIVER_NAME, + .d_maj = -1, }; #endif /* FB_INSTALL_CDEV */ diff --git a/sys/pc98/cbus/olpt.c b/sys/pc98/cbus/olpt.c index 6e41a420ec53..e54b1433e074 100644 --- a/sys/pc98/cbus/olpt.c +++ b/sys/pc98/cbus/olpt.c @@ -232,19 +232,12 @@ static d_ioctl_t lptioctl; #define CDEV_MAJOR 16 static struct cdevsw lpt_cdevsw = { - /* open */ lptopen, - /* close */ lptclose, - /* read */ noread, - /* write */ lptwrite, - /* ioctl */ lptioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "lpt", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = lptopen, + .d_close = lptclose, + .d_write = lptwrite, + .d_ioctl = lptioctl, + .d_name = "lpt", + .d_maj = CDEV_MAJOR, }; static bus_addr_t lpt_iat[] = {0, 2, 4, 6}; diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index 18f14831d74b..3ec2bee6010b 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -407,20 +407,16 @@ static d_ioctl_t sioioctl; #define CDEV_MAJOR 28 static struct cdevsw sio_cdevsw = { - /* open */ sioopen, - /* close */ sioclose, - /* read */ sioread, - /* write */ siowrite, - /* ioctl */ sioioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ sio_driver_name, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = sioopen, + .d_close = sioclose, + .d_read = sioread, + .d_write = siowrite, + .d_ioctl = sioioctl, + .d_poll = ttypoll, + .d_name = sio_driver_name, + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; int comconsole = -1; diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c index 98b96229a7ae..05d6ab9cbf0e 100644 --- a/sys/pc98/pc98/fd.c +++ b/sys/pc98/pc98/fd.c @@ -620,19 +620,15 @@ fdin_rd(fdc_p fdc) #define CDEV_MAJOR 9 static struct cdevsw fd_cdevsw = { - /* open */ Fdopen, - /* close */ fdclose, - /* read */ physread, - /* write */ physwrite, - /* ioctl */ fdioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ fdstrategy, - /* name */ "fd", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_DISK, + .d_open = Fdopen, + .d_close = fdclose, + .d_read = physread, + .d_write = physwrite, + .d_ioctl = fdioctl, + .d_strategy = fdstrategy, + .d_name = "fd", + .d_maj = CDEV_MAJOR, + .d_flags = D_DISK, }; /* diff --git a/sys/pc98/pc98/mse.c b/sys/pc98/pc98/mse.c index 25035f5827f2..406d8f344d58 100644 --- a/sys/pc98/pc98/mse.c +++ b/sys/pc98/pc98/mse.c @@ -138,19 +138,13 @@ static d_poll_t msepoll; #define CDEV_MAJOR 27 static struct cdevsw mse_cdevsw = { - /* open */ mseopen, - /* close */ mseclose, - /* read */ mseread, - /* write */ nowrite, - /* ioctl */ mseioctl, - /* poll */ msepoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "mse", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = mseopen, + .d_close = mseclose, + .d_read = mseread, + .d_ioctl = mseioctl, + .d_poll = msepoll, + .d_name = "mse", + .d_maj = CDEV_MAJOR, }; static void mseintr(void *); diff --git a/sys/pc98/pc98/olpt.c b/sys/pc98/pc98/olpt.c index 6e41a420ec53..e54b1433e074 100644 --- a/sys/pc98/pc98/olpt.c +++ b/sys/pc98/pc98/olpt.c @@ -232,19 +232,12 @@ static d_ioctl_t lptioctl; #define CDEV_MAJOR 16 static struct cdevsw lpt_cdevsw = { - /* open */ lptopen, - /* close */ lptclose, - /* read */ noread, - /* write */ lptwrite, - /* ioctl */ lptioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "lpt", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = lptopen, + .d_close = lptclose, + .d_write = lptwrite, + .d_ioctl = lptioctl, + .d_name = "lpt", + .d_maj = CDEV_MAJOR, }; static bus_addr_t lpt_iat[] = {0, 2, 4, 6}; diff --git a/sys/pc98/pc98/pc98gdc.c b/sys/pc98/pc98/pc98gdc.c index 6525c5b2e7f6..01a63ad58ae8 100644 --- a/sys/pc98/pc98/pc98gdc.c +++ b/sys/pc98/pc98/pc98gdc.c @@ -102,19 +102,14 @@ static d_ioctl_t gdcioctl; static d_mmap_t gdcmmap; static struct cdevsw gdc_cdevsw = { - /* open */ gdcopen, - /* close */ gdcclose, - /* read */ gdcread, - /* write */ gdcwrite, - /* ioctl */ gdcioctl, - /* poll */ nopoll, - /* mmap */ gdcmmap, - /* strategy */ nostrategy, - /* name */ DRIVER_NAME, - /* maj */ -1, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = gdcopen, + .d_close = gdcclose, + .d_read = gdcread, + .d_write = gdcwrite, + .d_ioctl = gdcioctl, + .d_mmap = gdcmmap, + .d_name = DRIVER_NAME, + .d_maj = -1, }; #endif /* FB_INSTALL_CDEV */ diff --git a/sys/pc98/pc98/pcaudio.c b/sys/pc98/pc98/pcaudio.c index 38f81a2a89a3..8bab0f329150 100644 --- a/sys/pc98/pc98/pcaudio.c +++ b/sys/pc98/pc98/pcaudio.c @@ -159,19 +159,13 @@ static d_poll_t pcapoll; #define CDEV_MAJOR 24 static struct cdevsw pca_cdevsw = { - /* open */ pcaopen, - /* close */ pcaclose, - /* read */ noread, - /* write */ pcawrite, - /* ioctl */ pcaioctl, - /* poll */ pcapoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "pca", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = pcaopen, + .d_close = pcaclose, + .d_write = pcawrite, + .d_ioctl = pcaioctl, + .d_poll = pcapoll, + .d_name = "pca", + .d_maj = CDEV_MAJOR, }; static void pca_continue(void); diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index 18f14831d74b..3ec2bee6010b 100644 --- a/sys/pc98/pc98/sio.c +++ b/sys/pc98/pc98/sio.c @@ -407,20 +407,16 @@ static d_ioctl_t sioioctl; #define CDEV_MAJOR 28 static struct cdevsw sio_cdevsw = { - /* open */ sioopen, - /* close */ sioclose, - /* read */ sioread, - /* write */ siowrite, - /* ioctl */ sioioctl, - /* poll */ ttypoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ sio_driver_name, - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter, + .d_open = sioopen, + .d_close = sioclose, + .d_read = sioread, + .d_write = siowrite, + .d_ioctl = sioioctl, + .d_poll = ttypoll, + .d_name = sio_driver_name, + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter, }; int comconsole = -1; diff --git a/sys/pc98/pc98/spkr.c b/sys/pc98/pc98/spkr.c index a1fe003e388e..208d2bbf6e11 100644 --- a/sys/pc98/pc98/spkr.c +++ b/sys/pc98/pc98/spkr.c @@ -38,19 +38,12 @@ static d_ioctl_t spkrioctl; #define CDEV_MAJOR 26 static struct cdevsw spkr_cdevsw = { - /* open */ spkropen, - /* close */ spkrclose, - /* read */ noread, - /* write */ spkrwrite, - /* ioctl */ spkrioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "spkr", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = spkropen, + .d_close = spkrclose, + .d_write = spkrwrite, + .d_ioctl = spkrioctl, + .d_name = "spkr", + .d_maj = CDEV_MAJOR, }; static MALLOC_DEFINE(M_SPKR, "spkr", "Speaker buffer"); diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c index 3d015f14c47a..7220f7057150 100644 --- a/sys/pc98/pc98/syscons.c +++ b/sys/pc98/pc98/syscons.c @@ -212,20 +212,17 @@ static d_ioctl_t scioctl; static d_mmap_t scmmap; static struct cdevsw sc_cdevsw = { - /* open */ scopen, - /* close */ scclose, - /* read */ scread, - /* write */ ttywrite, - /* ioctl */ scioctl, - /* poll */ ttypoll, - /* mmap */ scmmap, - /* strategy */ nostrategy, - /* name */ "sc", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY | D_KQFILTER, - /* kqfilter */ ttykqfilter + .d_open = scopen, + .d_close = scclose, + .d_read = scread, + .d_write = ttywrite, + .d_ioctl = scioctl, + .d_poll = ttypoll, + .d_mmap = scmmap, + .d_name = "sc", + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY | D_KQFILTER, + .d_kqfilter = ttykqfilter }; int diff --git a/sys/pc98/pc98/wd_cd.c b/sys/pc98/pc98/wd_cd.c index a9c07fe361a4..c784acd14d54 100644 --- a/sys/pc98/pc98/wd_cd.c +++ b/sys/pc98/pc98/wd_cd.c @@ -51,19 +51,15 @@ static d_strategy_t acdstrategy; #define CDEV_MAJOR 69 static struct cdevsw acd_cdevsw = { - /* open */ acdopen, - /* close */ acdclose, - /* read */ physread, - /* write */ physwrite, - /* ioctl */ acdioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ acdstrategy, - /* name */ "wcd", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_DISK, + .d_open = acdopen, + .d_close = acdclose, + .d_read = physread, + .d_write = physwrite, + .d_ioctl = acdioctl, + .d_strategy = acdstrategy, + .d_name = "wcd", + .d_maj = CDEV_MAJOR, + .d_flags = D_DISK, }; #define NUNIT 16 /* Max # of devices */ diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c index 8c6397cb9a52..3d3ad26e0b36 100644 --- a/sys/pccard/pccard.c +++ b/sys/pccard/pccard.c @@ -84,19 +84,14 @@ static d_poll_t crdpoll; #define CDEV_MAJOR MAJOR_AUTO #endif static struct cdevsw crd_cdevsw = { - /* open */ crdopen, - /* close */ crdclose, - /* read */ crdread, - /* write */ crdwrite, - /* ioctl */ crdioctl, - /* poll */ crdpoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "crd", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = crdopen, + .d_close = crdclose, + .d_read = crdread, + .d_write = crdwrite, + .d_ioctl = crdioctl, + .d_poll = crdpoll, + .d_name = "crd", + .d_maj = CDEV_MAJOR, }; /* diff --git a/sys/pci/agp.c b/sys/pci/agp.c index be2f7f88a356..8c599460f827 100644 --- a/sys/pci/agp.c +++ b/sys/pci/agp.c @@ -70,19 +70,13 @@ static d_ioctl_t agp_ioctl; static d_mmap_t agp_mmap; static struct cdevsw agp_cdevsw = { - /* open */ agp_open, - /* close */ agp_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ agp_ioctl, - /* poll */ nopoll, - /* mmap */ agp_mmap, - /* strategy */ nostrategy, - /* name */ "agp", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY, + .d_open = agp_open, + .d_close = agp_close, + .d_ioctl = agp_ioctl, + .d_mmap = agp_mmap, + .d_name = "agp", + .d_maj = CDEV_MAJOR, + .d_flags = D_TTY, }; static devclass_t agp_devclass; diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c index e0ac1d16bd3d..be81f61ca3f5 100644 --- a/sys/pci/if_ti.c +++ b/sys/pci/if_ti.c @@ -192,19 +192,11 @@ static d_close_t ti_close; static d_ioctl_t ti_ioctl2; static struct cdevsw ti_cdevsw = { - /* open */ ti_open, - /* close */ ti_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ ti_ioctl2, - /* poll */ seltrue, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "ti", - /* maj */ TI_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = ti_open, + .d_close = ti_close, + .d_ioctl = ti_ioctl2, + .d_name = "ti", + .d_maj = TI_CDEV_MAJOR, }; static int ti_probe (device_t); diff --git a/sys/pci/meteor.c b/sys/pci/meteor.c index 09bfbaed3878..96bc7d52d2f3 100644 --- a/sys/pci/meteor.c +++ b/sys/pci/meteor.c @@ -228,19 +228,14 @@ static d_mmap_t meteor_mmap; #define CDEV_MAJOR 67 static struct cdevsw meteor_cdevsw = { - /* open */ meteor_open, - /* close */ meteor_close, - /* read */ meteor_read, - /* write */ meteor_write, - /* ioctl */ meteor_ioctl, - /* poll */ nopoll, - /* mmap */ meteor_mmap, - /* strategy */ nostrategy, - /* name */ "meteor", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = meteor_open, + .d_close = meteor_close, + .d_read = meteor_read, + .d_write = meteor_write, + .d_ioctl = meteor_ioctl, + .d_mmap = meteor_mmap, + .d_name = "meteor", + .d_maj = CDEV_MAJOR, }; #endif diff --git a/sys/pci/xrpu.c b/sys/pci/xrpu.c index 379a749d0fb9..0c269d4b71cb 100644 --- a/sys/pci/xrpu.c +++ b/sys/pci/xrpu.c @@ -44,19 +44,12 @@ static d_mmap_t xrpu_mmap; #define CDEV_MAJOR 100 static struct cdevsw xrpu_cdevsw = { - /* open */ xrpu_open, - /* close */ xrpu_close, - /* read */ noread, - /* write */ nowrite, - /* ioctl */ xrpu_ioctl, - /* poll */ nopoll, - /* mmap */ xrpu_mmap, - /* strategy */ nostrategy, - /* name */ "xrpu", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ 0, + .d_open = xrpu_open, + .d_close = xrpu_close, + .d_ioctl = xrpu_ioctl, + .d_mmap = xrpu_mmap, + .d_name = "xrpu", + .d_maj = CDEV_MAJOR, }; static MALLOC_DEFINE(M_XRPU, "xrpu", "XRPU related"); diff --git a/sys/sparc64/sparc64/mem.c b/sys/sparc64/sparc64/mem.c index cb20e6a65450..6d9bda3229dc 100644 --- a/sys/sparc64/sparc64/mem.c +++ b/sys/sparc64/sparc64/mem.c @@ -79,19 +79,13 @@ static d_read_t mmrw; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { - /* open */ mmopen, - /* close */ mmclose, - /* read */ mmrw, - /* write */ mmrw, - /* ioctl */ noioctl, - /* poll */ (d_poll_t *)seltrue, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "mem", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_MEM, + .d_open = mmopen, + .d_close = mmclose, + .d_read = mmrw, + .d_write = mmrw, + .d_name = "mem", + .d_maj = CDEV_MAJOR, + .d_flags = D_MEM, }; static int -- cgit v1.3 From 2b4601d10b73f4e61d5a49b4e1e7883d9c96c646 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Thu, 6 Mar 2003 05:06:44 +0000 Subject: MFp4(simokawa_sbp) Improve if_fwe performance. - Simplify mbuf handling by using bulkxfer. Now, it uses mbuf clusters for RX buffer as usual ethernet drivers. - Recycle struct xfer buffer and don't call malloc at runtime. - Count input and output errors. - Handle a mbuf chain longer than 6 correctly. - Increase queue length. --- sys/dev/firewire/firewire.c | 1 + sys/dev/firewire/firewire.h | 2 +- sys/dev/firewire/firewirereg.h | 2 + sys/dev/firewire/fwdev.c | 13 +-- sys/dev/firewire/fwohci.c | 47 +++++++-- sys/dev/firewire/if_fwe.c | 227 ++++++++++++++++++++++++++--------------- sys/dev/firewire/if_fwevar.h | 3 +- 7 files changed, 193 insertions(+), 102 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index afd65e54b5f1..23de45a0a415 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -522,6 +522,7 @@ fw_xferq_drain(struct fw_xferq *xferq) while ((xfer = STAILQ_FIRST(&xferq->q)) != NULL) { STAILQ_REMOVE_HEAD(&xferq->q, link); + xferq->queued --; xfer->resp = EAGAIN; switch (xfer->act_type) { case FWACT_XFER: diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index b10aa6c210e8..1f1e07b7b71d 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -93,7 +93,7 @@ struct fw_reg_req_t { #define MAXREC(x) (2 << (x)) #define FWPMAX_S400 (2048 + 20) /* MAXREC plus space for control data */ -#define FWMAXQUEUE 128 +#define FWMAXQUEUE 256 #define FWLOCALBUS 0xffc0 diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 9cbcadf97434..709f80a4a310 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -230,10 +230,12 @@ struct fw_xferq { struct fw_bulkxfer{ caddr_t buf; + struct mbuf *mbuf; STAILQ_ENTRY(fw_bulkxfer) link; caddr_t start; caddr_t end; u_int npacket; + int resp; }; struct fw_dvbuf{ diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index fe79bc70df31..e590edc53a4a 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -67,6 +67,7 @@ static d_mmap_t fw_mmap; struct cdevsw firewire_cdevsw = { +#if __FreeBSD_version >= 500104 .d_open = fw_open, .d_close = fw_close, .d_read = fw_read, @@ -77,6 +78,10 @@ struct cdevsw firewire_cdevsw = .d_name = "fw", .d_maj = CDEV_MAJOR, .d_flags = D_MEM +#else + fw_open, fw_close, fw_read, fw_write, fw_ioctl, + fw_poll, fw_mmap, nostrategy, "fw", CDEV_MAJOR, nodump, nopsize, D_MEM +#endif }; static int @@ -707,18 +712,14 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) for(i = 0 ; i < sc->fc->ir[sub]->bnchunk; i++){ ir->bulkxfer[i].buf = - ir->buf + - i * sc->fc->ir[sub]->bnpacket * - sc->fc->ir[sub]->psize; + ir->buf + i * ir->bnpacket * ir->psize; STAILQ_INSERT_TAIL(&ir->stfree, &ir->bulkxfer[i], link); ir->bulkxfer[i].npacket = ir->bnpacket; } for(i = 0 ; i < sc->fc->it[sub]->bnchunk; i++){ it->bulkxfer[i].buf = - it->buf + - i * sc->fc->it[sub]->bnpacket * - sc->fc->it[sub]->psize; + it->buf + i * it->bnpacket * it->psize; STAILQ_INSERT_TAIL(&it->stfree, &it->bulkxfer[i], link); it->bulkxfer[i].npacket = it->bnpacket; diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 1821e50e3b22..aae968fd2ea4 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -835,6 +835,7 @@ txloop: = (OREAD(sc, OHCI_CYCLETIMER) >> 12) + (1 << 13); } +again: db_tr->dbcnt = 2; db = &db_tr->db[db_tr->dbcnt]; if(len > hdr_off){ @@ -848,7 +849,7 @@ txloop: db_tr->dbcnt++; } else { int mchain=0; - /* XXX we assume mbuf chain is shorter than ndesc */ + /* XXX we can handle only 6 (=8-2) mbuf chains */ for (m = xfer->mbuf; m != NULL; m = m->m_next) { if (m->m_len == 0) /* unrecoverable error could occur. */ @@ -864,11 +865,25 @@ txloop: db++; db_tr->dbcnt++; } - if (mchain > dbch->ndesc - 2) - device_printf(sc->fc.dev, - "dbch->ndesc(%d) is too small for" - " mbuf chain(%d), trancated.\n", - dbch->ndesc, mchain); + if (mchain > dbch->ndesc - 2) { + struct mbuf *m_new; + if (bootverbose) + device_printf(sc->fc.dev, + "too long mbuf chain(%d)\n", + mchain); + m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m_new != NULL) { + m_copydata(xfer->mbuf, 0, + xfer->mbuf->m_pkthdr.len, + mtod(m_new, caddr_t)); + m_new->m_pkthdr.len = m_new->m_len = + xfer->mbuf->m_pkthdr.len; + m_freem(xfer->mbuf); + xfer->mbuf = m_new; + goto again; + } + device_printf(sc->fc.dev, "m_getcl failed.\n"); + } } } if (maxdesc < db_tr->dbcnt) { @@ -1401,7 +1416,10 @@ fwohci_rx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch) }else{ fwohci_add_rx_buf(db_tr, dbch->xferq.psize, dbch->xferq.flag, - dbch->xferq.buf + dbch->xferq.psize * idb, + dbch->xferq.bulkxfer[idb + / dbch->xferq.bnpacket].buf + + dbch->xferq.psize * + (idb % dbch->xferq.bnpacket), dbch->dummy + sizeof(u_int32_t) * idb); } if(STAILQ_NEXT(db_tr, link) == NULL){ @@ -1611,7 +1629,6 @@ fwohci_irxbuf_enable(struct firewire_comm *fc, int dmach) first = STAILQ_FIRST(&ir->stfree); if (first == NULL) { device_printf(fc->dev, "IR DMA no free chunk\n"); - splx(s); return 0; } @@ -1621,6 +1638,10 @@ fwohci_irxbuf_enable(struct firewire_comm *fc, int dmach) while ((chunk = STAILQ_FIRST(&ir->stfree)) != NULL) { volatile struct fwohcidb *db; +#if 1 /* XXX for if_fwe */ + db = ((struct fwohcidb_tr *)(chunk->start))->db; + db[ldesc].db.desc.addr = vtophys(chunk->buf); +#endif db = ((struct fwohcidb_tr *)(chunk->end))->db; db[ldesc].db.desc.status = db[ldesc].db.desc.count = 0; db[ldesc].db.desc.depend &= ~0xf; @@ -2068,16 +2089,22 @@ fwohci_rbuf_update(struct fwohci_softc *sc, int dmach) STAILQ_INSERT_TAIL(&ir->stvalid, chunk, link); switch (stat & FWOHCIEV_MASK) { case FWOHCIEV_ACKCOMPL: + chunk->resp = 0; break; default: + chunk->resp = EINVAL; device_printf(fc->dev, "Isochronous receive err %02x\n", stat); } w++; } splx(s); - if (w) - wakeup(ir); + if (w) { + if (ir->flag & FWXFERQ_HANDLER) + ir->hand(ir); + else + wakeup(ir); + } } void diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c index ca9bd816bdb0..f3c7614e4f80 100644 --- a/sys/dev/firewire/if_fwe.c +++ b/sys/dev/firewire/if_fwe.c @@ -62,20 +62,21 @@ #include #define FWEDEBUG if (fwedebug) printf -#define MAX_QUEUED IFQ_MAXLEN /* 50 */ +#define TX_MAX_QUEUE (FWMAXQUEUE - 1) +#define RX_MAX_QUEUE FWMAXQUEUE /* network interface */ static void fwe_start __P((struct ifnet *)); static int fwe_ioctl __P((struct ifnet *, u_long, caddr_t)); static void fwe_init __P((void *)); +static void fwe_output_callback __P((struct fw_xfer *)); static void fwe_as_output __P((struct fwe_softc *, struct ifnet *)); static void fwe_as_input __P((struct fw_xferq *)); static int fwedebug = 0; static int stream_ch = 1; -MALLOC_DECLARE(M_FWE); MALLOC_DEFINE(M_FWE, "if_fwe", "Ethernet over FireWire interface"); SYSCTL_INT(_debug, OID_AUTO, if_fwe_debug, CTLFLAG_RW, &fwedebug, 0, ""); SYSCTL_DECL(_hw_firewire); @@ -193,7 +194,7 @@ fwe_attach(device_t dev) ifp->if_ioctl = fwe_ioctl; ifp->if_mtu = ETHERMTU; ifp->if_flags = (IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST); - ifp->if_snd.ifq_maxlen = FWMAXQUEUE - 1; + ifp->if_snd.ifq_maxlen = TX_MAX_QUEUE; s = splimp(); #if __FreeBSD_version >= 500000 @@ -209,7 +210,6 @@ fwe_attach(device_t dev) ifp->if_capabilities |= IFCAP_VLAN_MTU; #endif - ifp->if_snd.ifq_maxlen = MAX_QUEUED - 1; FWEDEBUG("interface %s%d created.\n", ifp->if_name, ifp->if_unit); return 0; @@ -221,6 +221,8 @@ fwe_stop(struct fwe_softc *fwe) struct firewire_comm *fc; struct fw_xferq *xferq; struct ifnet *ifp = &fwe->fwe_if; + struct fw_xfer *xfer, *next; + int i; fc = fwe->fd.fc; @@ -232,8 +234,22 @@ fwe_stop(struct fwe_softc *fwe) if (xferq->flag & FWXFERQ_RUNNING) fc->irx_disable(fc, fwe->dma_ch); xferq->flag &= - ~(FWXFERQ_MODEMASK | FWXFERQ_OPEN | FWXFERQ_HANDLER); - /* XXX dequeue xferq->q */ + ~(FWXFERQ_MODEMASK | FWXFERQ_OPEN | + FWXFERQ_EXTBUF | FWXFERQ_HANDLER); + xferq->hand = NULL; + + for (i = 0; i < xferq->bnchunk; i ++) + m_freem(xferq->bulkxfer[i].mbuf); + free(xferq->bulkxfer, M_FWE); + + for (xfer = STAILQ_FIRST(&fwe->xferlist); xfer != NULL; + xfer = next) { + next = STAILQ_NEXT(xfer, link); + fw_xfer_free(xfer); + } + STAILQ_INIT(&fwe->xferlist); + + xferq->bulkxfer = NULL; fwe->dma_ch = -1; } @@ -260,7 +276,6 @@ fwe_detach(device_t dev) return 0; } - static void fwe_init(void *arg) { @@ -268,6 +283,7 @@ fwe_init(void *arg) struct firewire_comm *fc; struct ifnet *ifp = &fwe->fwe_if; struct fw_xferq *xferq; + struct fw_xfer *xfer; int i; FWEDEBUG("initializing %s%d\n", ifp->if_name, ifp->if_unit); @@ -293,12 +309,51 @@ fwe_init(void *arg) fwe->stream_ch = stream_ch; fwe->pkt_hdr.mode.stream.chtag = fwe->stream_ch; /* allocate DMA channel and init packet mode */ - xferq->flag |= FWXFERQ_OPEN | FWXFERQ_PACKET; + xferq->flag |= FWXFERQ_OPEN | FWXFERQ_EXTBUF; xferq->flag |= fwe->stream_ch & 0xff; /* register fwe_input handler */ xferq->sc = (caddr_t) fwe; xferq->hand = fwe_as_input; xferq->flag |= FWXFERQ_HANDLER; + xferq->bnchunk = RX_MAX_QUEUE; + xferq->bnpacket = 1; + xferq->psize = MCLBYTES; + xferq->queued = 0; + xferq->bulkxfer = (struct fw_bulkxfer *) malloc( + sizeof(struct fw_bulkxfer) * xferq->bnchunk, M_FWE, 0); + if (xferq->bulkxfer == NULL) { + printf("if_fwe: malloc failed\n"); + return; + } + STAILQ_INIT(&xferq->stvalid); + STAILQ_INIT(&xferq->stfree); + STAILQ_INIT(&xferq->stdma); + xferq->stproc = NULL; + for (i = 0; i < xferq->bnchunk; i ++) { + xferq->bulkxfer[i].mbuf = +#if __FreeBSD_version >= 500000 + m_getcl(M_TRYWAIT, MT_DATA, M_PKTHDR); +#else + m_getcl(M_WAIT, MT_DATA, M_PKTHDR); +#endif + xferq->bulkxfer[i].buf = + mtod(xferq->bulkxfer[i].mbuf, char *); + STAILQ_INSERT_TAIL(&xferq->stfree, + &xferq->bulkxfer[i], link); + } + STAILQ_INIT(&fwe->xferlist); + for (i = 0; i < TX_MAX_QUEUE; i++) { + xfer = fw_xfer_alloc(M_FWE); + if (xfer == NULL) + break; + xfer->send.off = 0; + xfer->spd = 2; + xfer->fc = fwe->fd.fc; + xfer->retry_req = fw_asybusy; + xfer->sc = (caddr_t)fwe; + xfer->act.hand = fwe_output_callback; + STAILQ_INSERT_TAIL(&fwe->xferlist, xfer, link); + } } else xferq = fc->ir[fwe->dma_ch]; @@ -374,6 +429,39 @@ fwe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (0); } +static void +fwe_output_callback(struct fw_xfer *xfer) +{ + struct fwe_softc *fwe; + struct ifnet *ifp; + int s; + + fwe = (struct fwe_softc *)xfer->sc; + ifp = &fwe->fwe_if; + /* XXX error check */ + FWEDEBUG("resp = %d\n", xfer->resp); + if (xfer->resp != 0) + ifp->if_oerrors ++; + + m_freem(xfer->mbuf); + xfer->send.buf = NULL; +#if 0 + fw_xfer_unload(xfer); +#else + xfer->state = FWXF_INIT; + xfer->resp = 0; + xfer->retry = 0; +#endif + s = splimp(); + STAILQ_INSERT_TAIL(&fwe->xferlist, xfer, link); + splx(s); +#if 1 + /* XXX for queue full */ + if (ifp->if_snd.ifq_head != NULL) + fwe_start(ifp); +#endif +} + static void fwe_start(struct ifnet *ifp) { @@ -411,29 +499,10 @@ fwe_start(struct ifnet *ifp) splx(s); } - -static void -fwe_output_callback(struct fw_xfer *xfer) -{ - struct fwe_softc *fwe; - struct ifnet *ifp; - - fwe = (struct fwe_softc *)xfer->sc; - /* XXX error check */ - FWEDEBUG("resp = %d\n", xfer->resp); - m_freem(xfer->mbuf); - xfer->send.buf = NULL; - fw_xfer_free(xfer); -#if 1 - /* XXX for queue full */ - ifp = &fwe->fwe_if; - if (ifp->if_snd.ifq_head != NULL) - fwe_start(ifp); -#endif -} - #define HDR_LEN 4 -#define ALIGN_PAD 2 +#ifndef ETHER_ALIGN +#define ETHER_ALIGN 2 +#endif /* Async. stream output */ static void fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp) @@ -446,14 +515,16 @@ fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp) xfer = NULL; xferq = fwe->fd.fc->atq; - while (xferq->queued < xferq->maxq) { - IF_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) - break; - xfer = fw_xfer_alloc(M_FWXFER); + while (xferq->queued < xferq->maxq - 1) { + xfer = STAILQ_FIRST(&fwe->xferlist); if (xfer == NULL) { + printf("if_fwe: lack of xfer\n"); return; } + IF_DEQUEUE(&ifp->if_snd, m); + if (m == NULL) + break; + STAILQ_REMOVE_HEAD(&fwe->xferlist, link); #if __FreeBSD_version >= 500000 BPF_MTAP(ifp, m); #else @@ -461,15 +532,8 @@ fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp) bpf_mtap(ifp, m); #endif - xfer->send.off = 0; - xfer->spd = 2; - xfer->fc = fwe->fd.fc; - xfer->retry_req = fw_asybusy; - xfer->sc = (caddr_t)fwe; - xfer->act.hand = fwe_output_callback; - /* keep ip packet alignment for alpha */ - M_PREPEND(m, ALIGN_PAD, M_DONTWAIT); + M_PREPEND(m, ETHER_ALIGN, M_DONTWAIT); fp = (struct fw_pkt *)&xfer->dst; /* XXX */ xfer->dst = *((int32_t *)&fwe->pkt_hdr); fp->mode.stream.len = htons(m->m_pkthdr.len); @@ -477,24 +541,25 @@ fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp) xfer->mbuf = m; xfer->send.len = m->m_pkthdr.len + HDR_LEN; - i++; - if (fw_asyreq(xfer->fc, -1, xfer) != 0) { + if (fw_asyreq(fwe->fd.fc, -1, xfer) != 0) { /* error */ ifp->if_oerrors ++; /* XXX set error code */ fwe_output_callback(xfer); } else { ifp->if_opackets ++; + i++; } } #if 0 if (i > 1) printf("%d queued\n", i); #endif - if (xfer != NULL) - xferq->start(xfer->fc); + if (i > 0) + xferq->start(fwe->fd.fc); } +#if 0 #if __FreeBSD_version >= 500000 static void fwe_free(void *buf, void *args) @@ -525,59 +590,54 @@ fwe_ref(caddr_t buf, u_int size) (*p) ++; } #endif +#endif /* Async. stream output */ static void fwe_as_input(struct fw_xferq *xferq) { struct mbuf *m; - struct ether_header *eh; struct ifnet *ifp; - struct fw_xfer *xfer; struct fwe_softc *fwe; + struct fw_bulkxfer *sxfer; + struct fw_pkt *fp; u_char *c; - int len; - caddr_t p; +#if __FreeBSD_version < 500000 + struct ether_header *eh; +#endif fwe = (struct fwe_softc *)xferq->sc; ifp = &fwe->fwe_if; #if 0 FWE_POLL_REGISTER(fwe_poll, fwe, ifp); #endif - while ((xfer = STAILQ_FIRST(&xferq->q)) != NULL) { - STAILQ_REMOVE_HEAD(&xferq->q, link); + while ((sxfer = STAILQ_FIRST(&xferq->stvalid)) != NULL) { + STAILQ_REMOVE_HEAD(&xferq->stvalid, link); +#if 0 xferq->queued --; - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == NULL) { - printf("MGETHDR failed\n"); - fw_xfer_free(xfer); - return; - } - len = xfer->recv.off + xfer->recv.len; - FWEDEBUG("fwe_as_input len=%d\n", len); -#if __FreeBSD_version >= 500000 - MEXTADD(m, xfer->recv.buf, len, fwe_free, NULL, 0, EXT_NET_DRV); -#else - m->m_flags |= M_EXT; - m->m_ext.ext_buf = xfer->recv.buf; - m->m_ext.ext_size = len; - m->m_ext.ext_free = fwe_free; - m->m_ext.ext_ref = fwe_ref; - *((int *)m->m_ext.ext_buf) = 1; /* XXX refcount */ #endif - p = xfer->recv.buf + xfer->recv.off + HDR_LEN + ALIGN_PAD; - eh = (struct ether_header *)p; -#if __FreeBSD_version >= 500000 - len -= xfer->recv.off + HDR_LEN + ALIGN_PAD; -#else - p += sizeof(struct ether_header); - len -= xfer->recv.off + HDR_LEN + ALIGN_PAD - + sizeof(struct ether_header); + if (sxfer->resp != 0) + ifp->if_ierrors ++; + fp = (struct fw_pkt *)sxfer->buf; + /* XXX */ + if (fwe->fd.fc->irx_post != NULL) + fwe->fd.fc->irx_post(fwe->fd.fc, fp->mode.ld); + m = sxfer->mbuf; + + /* insert rbuf */ + sxfer->mbuf = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + sxfer->buf = mtod(sxfer->mbuf, char *); + STAILQ_INSERT_TAIL(&xferq->stfree, sxfer, link); + + m->m_data += HDR_LEN + ETHER_ALIGN; + c = mtod(m, char *); +#if __FreeBSD_version < 500000 + eh = (struct ether_header *)c; + m->m_data += sizeof(struct ether_header); #endif - m->m_data = p; - m->m_len = m->m_pkthdr.len = len; + m->m_len = m->m_pkthdr.len = + ntohs(fp->mode.stream.len) - ETHER_ALIGN; m->m_pkthdr.rcvif = ifp; - c = (char *)eh; #if 0 FWEDEBUG("%02x %02x %02x %02x %02x %02x\n" "%02x %02x %02x %02x %02x %02x\n" @@ -599,10 +659,9 @@ fwe_as_input(struct fw_xferq *xferq) ether_input(ifp, eh, m); #endif ifp->if_ipackets ++; - - xfer->recv.buf = NULL; - fw_xfer_free(xfer); } + if (STAILQ_FIRST(&xferq->stfree) != NULL) + fwe->fd.fc->irx_enable(fwe->fd.fc, fwe->dma_ch); } diff --git a/sys/dev/firewire/if_fwevar.h b/sys/dev/firewire/if_fwevar.h index afaa1aec447f..6eb6ff7f85f2 100644 --- a/sys/dev/firewire/if_fwevar.h +++ b/sys/dev/firewire/if_fwevar.h @@ -43,8 +43,9 @@ struct fwe_softc { short stream_ch; short dma_ch; struct fw_pkt pkt_hdr; + STAILQ_HEAD(, fw_xfer) xferlist; struct fwe_eth_softc { - /* XXX this must be first for if_ethersub.c */ + /* XXX this must be the first for if_ethersub.c */ struct arpcom arpcom; /* ethernet common data */ #define fwe_if eth_softc.arpcom.ac_if struct fwe_softc *fwe; -- cgit v1.3 From 77ee030b5fe6848e5c50ae2f0013bf43f6ad0c28 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Thu, 17 Apr 2003 03:38:03 +0000 Subject: MFp4(simokawa_firewire): Many internal structure changes for the FireWire driver. - Compute CRC in CROM parsing. - Add support for configuration ROM build. - Simplify dummy buffer handling. - busdma conversion - Use swi_taskqueue_giant for -current. Mark the interrupt routine as MPSAFE. - AR buffer handling. Don't reallocate AR buffer but just recycle it. Don't malloc and copy per packet in fwohci_arcv(). Pass packet to fw_rcv() using iovec. Application must prepare receiving buffer in advance. - Change fw_bind API so that application should pre-allocate xfer structure. - Add fw_xfer_unload() for recycling struct fw_xfer. - Add post_busreset hook - Remove unused 'sub' and 'act_type' in struct fw_xfer. - Remove npacket from struct fw_bulkxfer. - Don't call back handlers in fwochi_arcv() if the packet has not drained in AT queue - Make firewire works on big endian platform. - Use native endian for packet header and remove unnecessary ntohX/htonX. - Remove FWXFERQ_PACKET mode. We don't use it anymore. - Remove unnecessary restriction of FWSTMAXCHUNK. - Don't set root node for phy config packet if the root node is not cycle master capable but set myself for root node. We should be the root node after next bus reset. Spotted by: Yoshihiro Tabira - Improve self id handling Tested on: i386, sparc64 and i386 with forced bounce buffer --- sys/dev/firewire/firewire.c | 467 +++++----- sys/dev/firewire/firewire.h | 263 ++---- sys/dev/firewire/firewire_phy.h | 2 - sys/dev/firewire/firewirereg.h | 94 +- sys/dev/firewire/fwcrom.c | 265 +++++- sys/dev/firewire/fwdev.c | 377 ++------ sys/dev/firewire/fwdma.c | 208 +++++ sys/dev/firewire/fwdma.h | 116 +++ sys/dev/firewire/fwmem.c | 72 +- sys/dev/firewire/fwmem.h | 2 +- sys/dev/firewire/fwohci.c | 1565 ++++++++++++++++---------------- sys/dev/firewire/fwohci_pci.c | 77 +- sys/dev/firewire/fwohcireg.h | 155 ++-- sys/dev/firewire/fwohcivar.h | 39 +- sys/dev/firewire/iec13213.h | 130 ++- sys/dev/firewire/iec68113.h | 53 +- sys/dev/firewire/if_fwe.c | 97 +- sys/dev/firewire/if_fwevar.h | 2 +- sys/dev/firewire/sbp.c | 632 +++++++------ sys/modules/firewire/Makefile.inc | 1 + sys/modules/firewire/firewire/Makefile | 2 +- sys/modules/firewire/fwe/Makefile | 1 + usr.sbin/fwcontrol/fwcontrol.c | 26 +- usr.sbin/fwcontrol/fwcrom.c | 259 +++++- usr.sbin/fwcontrol/fwdv.c | 6 +- 25 files changed, 2755 insertions(+), 2156 deletions(-) create mode 100644 sys/dev/firewire/fwdma.c create mode 100644 sys/dev/firewire/fwdma.h (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index dc10d3b3c1c9..500ab512c1aa 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. * @@ -44,13 +45,13 @@ #include #include #include -#include #include #include /* for rdtsc proto for clock.h below */ #include #include /* used by smbus and newbus */ +#include #include #include @@ -71,8 +72,6 @@ MALLOC_DEFINE(M_FWXFER, "fw_xfer", "XFER/FireWire"); #define FW_MAXASYRTY 4 #define FW_MAXDEVRCNT 4 -#define XFER_TIMEOUT 0 - devclass_t firewire_devclass; static int firewire_match __P((device_t)); @@ -202,9 +201,9 @@ fw_asyreq(struct firewire_comm *fc, int sub, struct fw_xfer *xfer) xferq = fc->ats; len = info->hdr_len; if (info->flag & FWTI_BLOCK_STR) - len += ntohs(fp->mode.stream.len); + len += fp->mode.stream.len; else if (info->flag & FWTI_BLOCK_ASY) - len += ntohs(fp->mode.rresb.len); + len += fp->mode.rresb.len; if( len > xfer->send.len ){ printf("len(%d) > send.len(%d) (tcode=%d)\n", len, xfer->send.len, tcode); @@ -230,11 +229,9 @@ fw_asyreq(struct firewire_comm *fc, int sub, struct fw_xfer *xfer) } xfer->tl = tl; - xfer->tcode = tcode; xfer->resp = 0; xfer->fc = fc; xfer->q = xferq; - xfer->act_type = FWACT_XFER; xfer->retry_req = fw_asybusy; fw_asystart(xfer); @@ -252,12 +249,7 @@ fw_asy_callback(struct fw_xfer *xfer){ * Postpone to later retry. */ void fw_asybusy(struct fw_xfer *xfer){ -#if 1 printf("fw_asybusy\n"); -#endif -#if XFER_TIMEOUT - untimeout(fw_xfer_timeout, (void *)xfer, xfer->ch); -#endif /* xfer->ch = timeout((timeout_t *)fw_asystart, (void *)xfer, 20000); */ @@ -265,24 +257,7 @@ void fw_asybusy(struct fw_xfer *xfer){ fw_asystart(xfer); return; } -#if XFER_TIMEOUT -/* - * Post timeout for async. request. - */ -void -fw_xfer_timeout(void *arg) -{ - int s; - struct fw_xfer *xfer; - xfer = (struct fw_xfer *)arg; - printf("fw_xfer_timeout status=%d resp=%d\n", xfer->state, xfer->resp); - /* XXX set error code */ - s = splfw(); - xfer->act.hand(xfer); - splx(s); -} -#endif /* * Async. request with given xfer structure. */ @@ -292,6 +267,7 @@ fw_asystart(struct fw_xfer *xfer) struct firewire_comm *fc = xfer->fc; int s; if(xfer->retry++ >= fc->max_asyretry){ + device_printf(fc->bdev, "max_asyretry exceeded\n"); xfer->resp = EBUSY; xfer->state = FWXF_BUSY; xfer->act.hand(xfer); @@ -314,10 +290,6 @@ fw_asystart(struct fw_xfer *xfer) /* XXX just queue for mbuf */ if (xfer->mbuf == NULL) xfer->q->start(fc); -#if XFER_TIMEOUT - if (xfer->act.hand != NULL) - xfer->ch = timeout(fw_xfer_timeout, (void *)xfer, hz); -#endif return; } @@ -355,15 +327,7 @@ firewire_xfer_timeout(struct firewire_comm *fc) xfer->dst, i); xfer->resp = ETIMEDOUT; STAILQ_REMOVE_HEAD(&fc->tlabels[i], link); - switch (xfer->act_type) { - case FWACT_XFER: - fw_xfer_done(xfer); - break; - default: - /* ??? */ - fw_xfer_free(xfer); - break; - } + fw_xfer_done(xfer); } } splx(s); @@ -437,10 +401,8 @@ firewire_attach( device_t dev ) /* launch attachement of the added children */ bus_generic_attach(dev); -#if 1 /* bus_reset */ fc->ibr(fc); -#endif return 0; } @@ -524,15 +486,7 @@ fw_xferq_drain(struct fw_xferq *xferq) STAILQ_REMOVE_HEAD(&xferq->q, link); xferq->queued --; xfer->resp = EAGAIN; - switch (xfer->act_type) { - case FWACT_XFER: - fw_xfer_done(xfer); - break; - default: - /* ??? */ - fw_xfer_free(xfer); - break; - } + fw_xfer_done(xfer); } } @@ -553,6 +507,9 @@ fw_drain_txq(struct firewire_comm *fc) void fw_busreset(struct firewire_comm *fc) { + struct firewire_dev_comm *fdc; + device_t *devlistp; + int devcnt; int i; switch(fc->status){ @@ -601,6 +558,16 @@ fw_busreset(struct firewire_comm *fc) CSRARC(fc, STATE_CLEAR) &= ~(1 << 23 | 1 << 15 | 1 << 14 ); CSRARC(fc, STATE_SET) = CSRARC(fc, STATE_CLEAR); + + if (device_get_children(fc->bdev, &devlistp, &devcnt) == 0) { + for( i = 0 ; i < devcnt ; i++) + if (device_get_state(devlistp[i]) >= DS_ATTACHED) { + fdc = device_get_softc(devlistp[i]); + if (fdc->post_busreset != NULL) + fdc->post_busreset(fdc); + } + free(devlistp, M_TEMP); + } } /* Call once after reboot */ @@ -620,21 +587,15 @@ void fw_init(struct firewire_comm *fc) fc->atq->queued = 0; fc->ats->queued = 0; - fc->arq->psize = PAGE_SIZE; - fc->ars->psize = PAGE_SIZE; - fc->atq->psize = 0; - fc->ats->psize = 0; - - fc->arq->buf = NULL; fc->ars->buf = NULL; fc->atq->buf = NULL; fc->ats->buf = NULL; - fc->arq->flag = FWXFERQ_PACKET; - fc->ars->flag = FWXFERQ_PACKET; - fc->atq->flag = FWXFERQ_PACKET; - fc->ats->flag = FWXFERQ_PACKET; + fc->arq->flag = 0; + fc->ars->flag = 0; + fc->atq->flag = 0; + fc->ats->flag = 0; STAILQ_INIT(&fc->atq->q); STAILQ_INIT(&fc->ats->q); @@ -723,7 +684,6 @@ void fw_init(struct firewire_comm *fc) fw_xfer_free(xfer); } xfer->act.hand = fw_vmaccess; - xfer->act_type = FWACT_XFER; xfer->fc = fc; xfer->sc = NULL; @@ -744,7 +704,7 @@ fw_bindlookup(struct firewire_comm *fc, u_int32_t dest_hi, u_int32_t dest_lo) struct fw_bind *tfw; for(tfw = STAILQ_FIRST(&fc->binds) ; tfw != NULL ; tfw = STAILQ_NEXT(tfw, fclist)){ - if(tfw->xfer->act_type != FWACT_NULL && + if (tfw->act_type != FWACT_NULL && tfw->start_hi == dest_hi && tfw->start_lo <= dest_lo && (tfw->start_lo + tfw->addrlen) > dest_lo){ @@ -796,9 +756,8 @@ fw_bindadd(struct firewire_comm *fc, struct fw_bind *fwb) STAILQ_INSERT_TAIL(&fc->binds, fwb, fclist); } out: - if(!err && fwb->xfer->act_type == FWACT_CH){ - STAILQ_INSERT_HEAD(&fc->ir[fwb->xfer->sub]->binds, fwb, chlist); - } + if (!err && fwb->act_type == FWACT_CH) + STAILQ_INSERT_HEAD(&fc->ir[fwb->sub]->binds, fwb, chlist); return err; } @@ -809,14 +768,19 @@ int fw_bindremove(struct firewire_comm *fc, struct fw_bind *fwb) { int s; + struct fw_xfer *xfer, *next; s = splfw(); /* shall we check the existance? */ STAILQ_REMOVE(&fc->binds, fwb, fw_bind, fclist); - splx(s); - if (fwb->xfer) - fw_xfer_free(fwb->xfer); + /* shall we do this? */ + for (xfer = STAILQ_FIRST(&fwb->xferlist); xfer != NULL; xfer = next) { + next = STAILQ_NEXT(xfer, link); + fw_xfer_free(xfer); + } + STAILQ_INIT(&fwb->xferlist); + splx(s); return 0; } @@ -881,12 +845,40 @@ fw_xfer_alloc(struct malloc_type *type) return xfer; microtime(&xfer->tv); - xfer->sub = -1; xfer->malloc = type; return xfer; } +struct fw_xfer * +fw_xfer_alloc_buf(struct malloc_type *type, int send_len, int recv_len) +{ + struct fw_xfer *xfer; + + xfer = fw_xfer_alloc(type); + xfer->send.len = send_len; + xfer->recv.len = recv_len; + if (xfer == NULL) + return(NULL); + if (send_len) { + xfer->send.buf = malloc(send_len, type, M_NOWAIT | M_ZERO); + if (xfer->send.buf == NULL) { + fw_xfer_free(xfer); + return(NULL); + } + } + if (recv_len) { + xfer->recv.buf = malloc(recv_len, type, M_NOWAIT); + if (xfer->recv.buf == NULL) { + if (xfer->send.buf != NULL) + free(xfer->send.buf, type); + fw_xfer_free(xfer); + return(NULL); + } + } + return(xfer); +} + /* * IEEE1394 XFER post process. */ @@ -896,10 +888,6 @@ fw_xfer_done(struct fw_xfer *xfer) if (xfer->act.hand == NULL) return; -#if XFER_TIMEOUT - untimeout(fw_xfer_timeout, (void *)xfer, xfer->ch); -#endif - if (xfer->fc->status != FWBUSRESET) xfer->act.hand(xfer); else { @@ -911,13 +899,11 @@ fw_xfer_done(struct fw_xfer *xfer) } } -/* - * To free IEEE1394 XFER structure. - */ void -fw_xfer_free( struct fw_xfer* xfer) +fw_xfer_unload(struct fw_xfer* xfer) { int s; + if(xfer == NULL ) return; if(xfer->state == FWXF_INQ){ printf("fw_xfer_free FWXF_INQ\n"); @@ -926,24 +912,30 @@ fw_xfer_free( struct fw_xfer* xfer) xfer->q->queued --; splx(s); } - if(xfer->fc != NULL){ - if(xfer->state == FWXF_START){ -#if 0 /* this could happen if we call fwohci_arcv() before fwohci_txd() */ - printf("fw_xfer_free FWXF_START\n"); + if (xfer->fc != NULL) { +#if 1 /* this could happen if we call fwohci_arcv() before fwohci_txd() */ + if(xfer->state == FWXF_START) + panic("fw_xfer_free FWXF_START\n"); #endif - s = splfw(); - xfer->q->drain(xfer->fc, xfer); - splx(s); - } + fw_tl_free(xfer->fc, xfer); } + xfer->state = FWXF_INIT; + xfer->resp = 0; + xfer->retry = 0; +} +/* + * To free IEEE1394 XFER structure. + */ +void +fw_xfer_free( struct fw_xfer* xfer) +{ + if(xfer == NULL ) return; + fw_xfer_unload(xfer); if(xfer->send.buf != NULL){ - free(xfer->send.buf, M_FW); + free(xfer->send.buf, xfer->malloc); } if(xfer->recv.buf != NULL){ - free(xfer->recv.buf, M_FW); - } - if(xfer->fc != NULL){ - fw_tl_free(xfer->fc, xfer); + free(xfer->recv.buf, xfer->malloc); } free(xfer, xfer->malloc); } @@ -969,24 +961,19 @@ fw_phy_config(struct firewire_comm *fc, int root_node, int gap_count) fc->status = FWBUSPHYCONF; -#if 0 - DELAY(100000); -#endif - xfer = fw_xfer_alloc(M_FWXFER); - xfer->send.len = 12; - xfer->send.off = 0; + xfer = fw_xfer_alloc_buf(M_FWXFER, 12, 0); + if (xfer == NULL) + return; xfer->fc = fc; xfer->retry_req = fw_asybusy; xfer->act.hand = fw_asy_callback_free; - xfer->send.buf = malloc(sizeof(u_int32_t), - M_FW, M_NOWAIT | M_ZERO); fp = (struct fw_pkt *)xfer->send.buf; fp->mode.ld[1] = 0; if (root_node >= 0) - fp->mode.ld[1] |= htonl((root_node & 0x3f) << 24 | 1 << 23); + fp->mode.ld[1] |= (root_node & 0x3f) << 24 | 1 << 23; if (gap_count >= 0) - fp->mode.ld[1] |= htonl(1 << 22 | (gap_count & 0x3f) << 16); + fp->mode.ld[1] |= 1 << 22 | (gap_count & 0x3f) << 16; fp->mode.ld[2] = ~fp->mode.ld[1]; /* XXX Dangerous, how to pass PHY packet to device driver */ fp->mode.common.tcode |= FWTCODE_PHY; @@ -1018,9 +1005,9 @@ fw_print_sid(u_int32_t sid) /* * To receive self ID. */ -void fw_sidrcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int off) +void fw_sidrcv(struct firewire_comm* fc, u_int32_t *sid, u_int len) { - u_int32_t *p, *sid = (u_int32_t *)(buf + off); + u_int32_t *p; union fw_self_id *self_id; u_int i, j, node, c_port = 0, i_branch = 0; @@ -1103,9 +1090,7 @@ void fw_sidrcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int off) bcopy(p, &CSRARC(fc, SPED_MAP + 8), (fc->speed_map->crc_len - 1)*4); fc->max_hop = fc->max_node - i_branch; -#if 1 printf(", maxhop <= %d", fc->max_hop); -#endif if(fc->irm == -1 ){ printf(", Not found IRM capable node"); @@ -1132,7 +1117,6 @@ void fw_sidrcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int off) CSRARC(fc, BUS_MGR_ID)); #endif } - free(buf, M_FW); if(fc->irm == ((CSRARC(fc, NODE_IDS) >> 16 ) & 0x3f)){ /* I am BMGR */ fw_bmr(fc); @@ -1240,12 +1224,7 @@ loop: fwdev->dst = fc->ongonode; fwdev->eui.hi = fc->ongoeui.hi; fwdev->eui.lo = fc->ongoeui.lo; fwdev->status = FWDEVINIT; -#if 0 - fwdev->speed = CSRARC(fc, SPED_MAP + 8 + fc->ongonode / 4) - >> ((3 - (fc->ongonode % 4)) * 8); -#else fwdev->speed = fc->speed_map->speed[fc->nodeid][fc->ongonode]; -#endif pfwdev = NULL; STAILQ_FOREACH(tfwdev, &fc->devices, link) { @@ -1276,28 +1255,20 @@ loop: fw_bus_explore_callback); if(xfer == NULL) goto done; #else - xfer = fw_xfer_alloc(M_FWXFER); + xfer = fw_xfer_alloc_buf(M_FWXFER, 16, 16); if(xfer == NULL){ goto done; } - xfer->send.len = 16; xfer->spd = 0; - xfer->send.buf = malloc(16, M_FW, M_NOWAIT); - if(xfer->send.buf == NULL){ - fw_xfer_free( xfer); - return; - } - - xfer->send.off = 0; fp = (struct fw_pkt *)xfer->send.buf; - fp->mode.rreqq.dest_hi = htons(0xffff); + fp->mode.rreqq.dest_hi = 0xffff; fp->mode.rreqq.tlrt = 0; fp->mode.rreqq.tcode = FWTCODE_RREQQ; fp->mode.rreqq.pri = 0; fp->mode.rreqq.src = 0; xfer->dst = FWLOCALBUS | fc->ongonode; - fp->mode.rreqq.dst = htons(xfer->dst); - fp->mode.rreqq.dest_lo = htonl(addr); + fp->mode.rreqq.dst = xfer->dst; + fp->mode.rreqq.dest_lo = addr; xfer->act.hand = fw_bus_explore_callback; if (firewire_debug) @@ -1330,21 +1301,13 @@ asyreqq(struct firewire_comm *fc, u_int8_t spd, u_int8_t tl, u_int8_t rt, struct fw_pkt *fp; int err; - xfer = fw_xfer_alloc(M_FWXFER); - if(xfer == NULL){ - return NULL; - } - xfer->send.len = 16; - xfer->spd = spd; /* XXX:min(spd, fc->spd) */ - xfer->send.buf = malloc(16, M_FW, M_NOWAIT); - if(xfer->send.buf == NULL){ - fw_xfer_free( xfer); + xfer = fw_xfer_alloc_buf(M_FWXFER, 16, 16); + if (xfer == NULL) return NULL; - } - xfer->send.off = 0; + xfer->spd = spd; /* XXX:min(spd, fc->spd) */ fp = (struct fw_pkt *)xfer->send.buf; - fp->mode.rreqq.dest_hi = htons(addr_hi & 0xffff); + fp->mode.rreqq.dest_hi = addr_hi & 0xffff; if(tl & FWP_TL_VALID){ fp->mode.rreqq.tlrt = (tl & 0x3f) << 2; }else{ @@ -1355,8 +1318,8 @@ asyreqq(struct firewire_comm *fc, u_int8_t spd, u_int8_t tl, u_int8_t rt, fp->mode.rreqq.pri = 0; fp->mode.rreqq.src = 0; xfer->dst = addr_hi >> 16; - fp->mode.rreqq.dst = htons(xfer->dst); - fp->mode.rreqq.dest_lo = htonl(addr_lo); + fp->mode.rreqq.dst = xfer->dst; + fp->mode.rreqq.dest_lo = addr_lo; xfer->act.hand = hand; err = fw_asyreq(fc, -1, xfer); @@ -1420,14 +1383,14 @@ fw_bus_explore_callback(struct fw_xfer *xfer) qld = (u_int32_t *)xfer->recv.buf; printf("len:%d\n", xfer->recv.len); for( i = 0 ; i <= xfer->recv.len && i < 32; i+= 4){ - printf("0x%08x ", ntohl(rfp->mode.ld[i/4])); + printf("0x%08x ", rfp->mode.ld[i/4]); if((i % 16) == 15) printf("\n"); } if((i % 16) != 15) printf("\n"); } #endif if(fc->ongodev == NULL){ - if(sfp->mode.rreqq.dest_lo == htonl((0xf0000000 | CSRROMOFF))){ + if(sfp->mode.rreqq.dest_lo == (0xf0000000 | CSRROMOFF)){ rfp->mode.rresq.data = ntohl(rfp->mode.rresq.data); chdr = (struct csrhdr *)(&rfp->mode.rresq.data); /* If CSR is minimal confinguration, more investgation is not needed. */ @@ -1439,10 +1402,10 @@ fw_bus_explore_callback(struct fw_xfer *xfer) }else{ fc->ongoaddr = CSRROMOFF + 0xc; } - }else if(sfp->mode.rreqq.dest_lo == htonl((0xf0000000 |(CSRROMOFF + 0xc)))){ + }else if(sfp->mode.rreqq.dest_lo == (0xf0000000 |(CSRROMOFF + 0xc))){ fc->ongoeui.hi = ntohl(rfp->mode.rresq.data); fc->ongoaddr = CSRROMOFF + 0x10; - }else if(sfp->mode.rreqq.dest_lo == htonl((0xf0000000 |(CSRROMOFF + 0x10)))){ + }else if(sfp->mode.rreqq.dest_lo == (0xf0000000 |(CSRROMOFF + 0x10))){ fc->ongoeui.lo = ntohl(rfp->mode.rresq.data); if (fc->ongoeui.hi == 0 && fc->ongoeui.lo == 0) { if (firewire_debug) @@ -1701,17 +1664,42 @@ fw_get_tlabel(struct firewire_comm *fc, struct fw_xfer *xfer) return(-1); } +static void +fw_rcv_copy(struct fw_xfer *xfer, struct iovec *vec, int nvec) +{ + char *p; + int res, i, len; + + p = xfer->recv.buf; + res = xfer->recv.len; + for (i = 0; i < nvec; i++, vec++) { + len = vec->iov_len; + if (res < len) { + printf("rcv buffer(%d) is %d bytes short.\n", + xfer->recv.len, len - res); + len = res; + } + bcopy(vec->iov_base, p, len); + p += len; + res -= len; + if (res <= 0) + break; + } + xfer->recv.len -= res; +} + /* * Generic packet receving process. */ void -fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u_int spd) +fw_rcv(struct firewire_comm *fc, struct iovec *vec, int nvec, u_int sub, u_int spd) { struct fw_pkt *fp, *resfp; struct fw_xfer *xfer; struct fw_bind *bind; struct firewire_softc *sc; - int s; + int tcode, s; + int i, len, oldstate; #if 0 { u_int32_t *qld; @@ -1725,25 +1713,37 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u if((i % 16) != 15) printf("\n"); } #endif - fp = (struct fw_pkt *)(buf + off); - switch(fp->mode.common.tcode){ + fp = (struct fw_pkt *)vec[0].iov_base; + tcode = fp->mode.common.tcode; +#if 0 /* XXX this check is not valid for RRESQ and WREQQ */ + if (vec[0].iov_len < fc->tcode[tcode].hdr_len) { +#if __FreeBSD_version >= 500000 + printf("fw_rcv: iov_len(%zu) is less than" +#else + printf("fw_rcv: iov_len(%u) is less than" +#endif + " hdr_len(%d:tcode=%d)\n", vec[0].iov_len, + fc->tcode[tcode].hdr_len, tcode); + } +#endif + switch (tcode) { case FWTCODE_WRES: case FWTCODE_RRESQ: case FWTCODE_RRESB: case FWTCODE_LRES: - xfer = fw_tl2xfer(fc, ntohs(fp->mode.hdr.src), + xfer = fw_tl2xfer(fc, fp->mode.hdr.src, fp->mode.hdr.tlrt >> 2); if(xfer == NULL) { printf("fw_rcv: unknown response " "tcode=%d src=0x%x tl=0x%x rt=%d data=0x%x\n", - fp->mode.common.tcode, - ntohs(fp->mode.hdr.src), + tcode, + fp->mode.hdr.src, fp->mode.hdr.tlrt >> 2, fp->mode.hdr.tlrt & 3, fp->mode.rresq.data); #if 1 printf("try ad-hoc work around!!\n"); - xfer = fw_tl2xfer(fc, ntohs(fp->mode.hdr.src), + xfer = fw_tl2xfer(fc, fp->mode.hdr.src, (fp->mode.hdr.tlrt >> 2)^3); if (xfer == NULL) { printf("no use...\n"); @@ -1753,56 +1753,48 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u goto err; #endif } - switch(xfer->act_type){ - case FWACT_XFER: - if((xfer->sub >= 0) && - ((fc->ir[xfer->sub]->flag & FWXFERQ_MODEMASK ) == 0)){ - xfer->resp = EINVAL; - fw_xfer_done(xfer); - goto err; - } - xfer->recv.len = len; - xfer->recv.off = off; - xfer->recv.buf = buf; - xfer->resp = 0; + fw_rcv_copy(xfer, vec, nvec); + xfer->resp = 0; + /* make sure the packet is drained in AT queue */ + oldstate = xfer->state; + xfer->state = FWXF_RCVD; + switch (oldstate) { + case FWXF_SENT: fw_xfer_done(xfer); - return; break; - case FWACT_CH: - default: - goto err; + case FWXF_START: + if (firewire_debug) + printf("not sent yet\n"); break; + default: + printf("unexpected state %d\n", xfer->state); } - break; + return; case FWTCODE_WREQQ: case FWTCODE_WREQB: case FWTCODE_RREQQ: case FWTCODE_RREQB: case FWTCODE_LREQ: - bind = fw_bindlookup(fc, ntohs(fp->mode.rreqq.dest_hi), - ntohl(fp->mode.rreqq.dest_lo)); + bind = fw_bindlookup(fc, fp->mode.rreqq.dest_hi, + fp->mode.rreqq.dest_lo); if(bind == NULL){ -#if __FreeBSD_version >= 500000 - printf("Unknown service addr 0x%08x:0x%08x tcode=%x\n src=0x%x", -#else - printf("Unknown service addr 0x%08x:0x%08lx tcode=%x src=0x%x\n", -#endif - ntohs(fp->mode.rreqq.dest_hi), - ntohl(fp->mode.rreqq.dest_lo), - fp->mode.common.tcode, - fp->mode.hdr.src); + printf("Unknown service addr 0x%08x:0x%08x tcode=%x src=0x%x data=%x\n", + fp->mode.wreqq.dest_hi, + fp->mode.wreqq.dest_lo, + tcode, + fp->mode.hdr.src, + ntohl(fp->mode.wreqq.data)); if (fc->status == FWBUSRESET) { printf("fw_rcv: cannot respond(bus reset)!\n"); goto err; } - xfer = fw_xfer_alloc(M_FWXFER); + xfer = fw_xfer_alloc_buf(M_FWXFER, 16, 0); if(xfer == NULL){ return; } xfer->spd = spd; - xfer->send.buf = malloc(16, M_FW, M_NOWAIT); resfp = (struct fw_pkt *)xfer->send.buf; - switch(fp->mode.common.tcode){ + switch (tcode) { case FWTCODE_WREQQ: case FWTCODE_WREQB: resfp->mode.hdr.tcode = FWTCODE_WRES; @@ -1837,17 +1829,20 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u } goto err; } - switch(bind->xfer->act_type){ + len = 0; + for (i = 0; i < nvec; i ++) + len += vec[i].iov_len; + switch(bind->act_type){ case FWACT_XFER: - xfer = fw_xfer_alloc(M_FWXFER); - if(xfer == NULL) goto err; - xfer->fc = bind->xfer->fc; - xfer->sc = bind->xfer->sc; - xfer->recv.buf = buf; - xfer->recv.len = len; - xfer->recv.off = off; + /* splfw()?? */ + xfer = STAILQ_FIRST(&bind->xferlist); + if (xfer == NULL) { + printf("Discard a packet for this bind.\n"); + goto err; + } + STAILQ_REMOVE_HEAD(&bind->xferlist, link); + fw_rcv_copy(xfer, vec, nvec); xfer->spd = spd; - xfer->act.hand = bind->xfer->act.hand; if (fc->status != FWBUSRESET) xfer->act.hand(xfer); else @@ -1855,26 +1850,28 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u return; break; case FWACT_CH: - if(fc->ir[bind->xfer->sub]->queued >= - fc->ir[bind->xfer->sub]->maxq){ + if(fc->ir[bind->sub]->queued >= + fc->ir[bind->sub]->maxq){ device_printf(fc->bdev, "Discard a packet %x %d\n", - bind->xfer->sub, - fc->ir[bind->xfer->sub]->queued); + bind->sub, + fc->ir[bind->sub]->queued); goto err; } - xfer = fw_xfer_alloc(M_FWXFER); - if(xfer == NULL) goto err; - xfer->recv.buf = buf; - xfer->recv.len = len; - xfer->recv.off = off; + xfer = STAILQ_FIRST(&bind->xferlist); + if (xfer == NULL) { + printf("Discard packet for this bind\n"); + goto err; + } + STAILQ_REMOVE_HEAD(&bind->xferlist, link); + fw_rcv_copy(xfer, vec, nvec); xfer->spd = spd; s = splfw(); - fc->ir[bind->xfer->sub]->queued++; - STAILQ_INSERT_TAIL(&fc->ir[bind->xfer->sub]->q, xfer, link); + fc->ir[bind->sub]->queued++; + STAILQ_INSERT_TAIL(&fc->ir[bind->sub]->q, xfer, link); splx(s); - wakeup((caddr_t)fc->ir[bind->xfer->sub]); + wakeup((caddr_t)fc->ir[bind->sub]); return; break; @@ -1896,11 +1893,12 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u printf("receive queue is full\n"); goto err; } - xfer = fw_xfer_alloc(M_FWXFER); + /* XXX get xfer from xfer queue, we don't need copy for + per packet mode */ + xfer = fw_xfer_alloc_buf(M_FWXFER, 0, /* XXX */ + vec[0].iov_len); if(xfer == NULL) goto err; - xfer->recv.buf = buf; - xfer->recv.len = len; - xfer->recv.off = off; + fw_rcv_copy(xfer, vec, nvec); xfer->spd = spd; s = splfw(); xferq->queued++; @@ -1924,11 +1922,11 @@ fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u break; } default: - printf("fw_rcv: unknow tcode\n"); + printf("fw_rcv: unknow tcode %d\n", tcode); break; } err: - free(buf, M_FW); + return; } /* @@ -1971,6 +1969,7 @@ error: fw_xfer_free(xfer); } + /* * To candidate Bus Manager election process. */ @@ -1982,35 +1981,26 @@ fw_try_bmr(void *arg) struct fw_pkt *fp; int err = 0; - xfer = fw_xfer_alloc(M_FWXFER); + xfer = fw_xfer_alloc_buf(M_FWXFER, 24, 20); if(xfer == NULL){ return; } - xfer->send.len = 24; xfer->spd = 0; - xfer->send.buf = malloc(24, M_FW, M_NOWAIT); - if(xfer->send.buf == NULL){ - fw_xfer_free( xfer); - return; - } - fc->status = FWBUSMGRELECT; - xfer->send.off = 0; fp = (struct fw_pkt *)xfer->send.buf; - fp->mode.lreq.dest_hi = htons(0xffff); + fp->mode.lreq.dest_hi = 0xffff; fp->mode.lreq.tlrt = 0; fp->mode.lreq.tcode = FWTCODE_LREQ; fp->mode.lreq.pri = 0; fp->mode.lreq.src = 0; - fp->mode.lreq.len = htons(8); - fp->mode.lreq.extcode = htons(FW_LREQ_CMPSWAP); + fp->mode.lreq.len = 8; + fp->mode.lreq.extcode = FW_LREQ_CMPSWAP; xfer->dst = FWLOCALBUS | fc->irm; - fp->mode.lreq.dst = htons(xfer->dst); - fp->mode.lreq.dest_lo = htonl(0xf0000000 | BUS_MGR_ID); + fp->mode.lreq.dst = xfer->dst; + fp->mode.lreq.dest_lo = 0xf0000000 | BUS_MGR_ID; fp->mode.lreq.payload[0] = htonl(0x3f); fp->mode.lreq.payload[1] = htonl(fc->nodeid); - xfer->act_type = FWACT_XFER; xfer->act.hand = fw_try_bmr_callback; err = fw_asyreq(fc, -1, xfer); @@ -2029,10 +2019,10 @@ fw_try_bmr(void *arg) static void fw_vmaccess(struct fw_xfer *xfer){ struct fw_pkt *rfp, *sfp = NULL; - u_int32_t *ld = (u_int32_t *)(xfer->recv.buf + xfer->recv.off); + u_int32_t *ld = (u_int32_t *)xfer->recv.buf; - printf("vmaccess spd:%2x len:%03x %d data:%08x %08x %08x %08x\n", - xfer->spd, xfer->recv.len, xfer->recv.off, ntohl(ld[0]), ntohl(ld[1]), ntohl(ld[2]), ntohl(ld[3])); + printf("vmaccess spd:%2x len:%03x data:%08x %08x %08x %08x\n", + xfer->spd, xfer->recv.len, ntohl(ld[0]), ntohl(ld[1]), ntohl(ld[2]), ntohl(ld[3])); printf("vmaccess data:%08x %08x %08x %08x\n", ntohl(ld[4]), ntohl(ld[5]), ntohl(ld[6]), ntohl(ld[7])); if(xfer->resp != 0){ fw_xfer_free( xfer); @@ -2084,7 +2074,6 @@ fw_vmaccess(struct fw_xfer *xfer){ fw_xfer_free( xfer); return; } - xfer->send.off = 0; sfp->mode.hdr.dst = rfp->mode.hdr.src; xfer->dst = ntohs(rfp->mode.hdr.src); xfer->act.hand = fw_xfer_free; @@ -2121,17 +2110,25 @@ static int fw_bmr(struct firewire_comm *fc) { struct fw_device fwdev; + union fw_self_id *self_id; int cmstr; - /* XXX Assume that the current root node is cycle master capable */ - cmstr = fc->max_node; + /* Check to see if the current root node is cycle master capable */ + self_id = &fc->topology_map->self_id[fc->max_node]; + if (fc->max_node > 0) { + if (self_id->p0.contender) + cmstr = fc->max_node; + else + /* XXX shall we be cycle master? */ + cmstr = fc->nodeid; + /* XXX bus reset? */ + } else + cmstr = -1; /* If I am the bus manager, optimize gapcount */ - if(fc->max_hop <= MAX_GAPHOP ){ - fw_phy_config(fc, (fc->max_node > 0)?cmstr:-1, - gap_cnt[fc->max_hop]); - } + if(fc->max_hop <= MAX_GAPHOP ) + fw_phy_config(fc, cmstr, gap_cnt[fc->max_hop]); /* If we are the cycle master, nothing to do */ - if (cmstr == fc->nodeid) + if (cmstr == fc->nodeid || cmstr == -1) return 0; /* Bus probe has not finished, make dummy fwdev for cmstr */ bzero(&fwdev, sizeof(fwdev)); diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index 1f1e07b7b71d..f90596f83b74 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -1,4 +1,5 @@ /* + * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. * @@ -40,29 +41,6 @@ #define DEV_DEF 0 #define DEV_DV 2 -#if 0 -struct dv_data{ - u_int32_t n_write; - u_int32_t a_write; - u_int32_t k_write; - u_int32_t write_done; - u_int32_t write_len[16]; - u_int32_t write_off[16]; - u_int32_t n_read; - u_int32_t a_read; - u_int32_t k_read; - u_int32_t read_done; - u_int32_t read_len[16]; - u_int32_t read_off[16]; -}; - -struct dv_data_req_t { - unsigned long index; - unsigned long len; - unsigned long off; -}; -#endif - struct fw_isochreq { unsigned char ch:6, tag:2; @@ -93,7 +71,7 @@ struct fw_reg_req_t { #define MAXREC(x) (2 << (x)) #define FWPMAX_S400 (2048 + 20) /* MAXREC plus space for control data */ -#define FWMAXQUEUE 256 +#define FWMAXQUEUE 64 #define FWLOCALBUS 0xffc0 @@ -135,139 +113,83 @@ struct fw_asyhdr { u_int32_t hdr[4]; }; -#if 0 -#define FWPHYSIDSUBS(SID) (((SID) >> 23) & 1) -#define FWPHYSIDNODE(SID) (((SID) >> 24) & 0x3f) -#define FWPHYSIDLINK(SID) (((SID) >> 22) & 1) -#define FWPHYSIDGAP(SID) (((SID) >> 16) & 0x3f) -#define FWPHYSIDSPD(SID) (((SID) >> 14) & 0x3) -#define FWPHYSIDDEL(SID) (((SID) >> 12) & 0x3) -#define FWPHYSIDCON(SID) (((SID) >> 11) & 1) -#define FWPHYSIDPWR(SID) (((SID) >> 8) & 0x7) -#define FWPHYSIDP0(SID) (((SID) >> 6) & 0x3) -#define FWPHYSIDP1(SID) (((SID) >> 4) & 0x3) -#define FWPHYSIDP2(SID) (((SID) >> 2) & 0x3) -#define FWPHYSIDIR(SID) (((SID) >> 1) & 1) -#define FWPHYSIDMORE(SID) ((SID) & 1) -#define FWPHYSIDSEQ(SID) (((SID) >> 20) & 0x7) -#define FWPHYSIDPA(SID) (((SID) >> 16) & 0x3) -#define FWPHYSIDPB(SID) (((SID) >> 14) & 0x3) -#define FWPHYSIDPC(SID) (((SID) >> 12) & 0x3) -#define FWPHYSIDPD(SID) (((SID) >> 10) & 0x3) -#define FWPHYSIDPE(SID) (((SID) >> 8) & 0x3) -#define FWPHYSIDPF(SID) (((SID) >> 6) & 0x3) -#define FWPHYSIDPG(SID) (((SID) >> 4) & 0x3) -#define FWPHYSIDPH(SID) (((SID) >> 2) & 0x3) +#if BYTE_ORDER == BIG_ENDIAN +#define BIT4x2(x,y) u_int8_t x:4, y:4 +#define BIT16x2(x,y) u_int32_t x:16, y:16 +#else +#define BIT4x2(x,y) u_int8_t y:4, x:4 +#define BIT16x2(x,y) u_int32_t y:16, x:16 +#endif + + +#if BYTE_ORDER == BIG_ENDIAN +#define COMMON_HDR(a,b,c,d) u_int32_t a:16,b:8,c:4,d:4 +#define COMMON_RES(a,b,c,d) u_int32_t a:16,b:4,c:4,d:8 +#else +#define COMMON_HDR(a,b,c,d) u_int32_t d:4,c:4,b:8,a:16 +#define COMMON_RES(a,b,c,d) u_int32_t d:8,c:4,b:4,a:16 #endif struct fw_pkt { union { u_int32_t ld[0]; struct { - u_int16_t :16; - u_int8_t :8; - u_int8_t :4, - tcode:4; + COMMON_HDR(, , tcode, ); } common; struct { - u_int16_t len; - u_int8_t chtag; - u_int8_t sy:4, - tcode:4; + COMMON_HDR(len, chtag, tcode, sy); u_int32_t payload[0]; } stream; struct { - u_int16_t dst; - u_int8_t tlrt; - u_int8_t pri:4, - tcode:4; - u_int16_t src; + COMMON_HDR(dst, tlrt, tcode, pri); + BIT16x2(src, ); } hdr; struct { - u_int16_t dst; - u_int8_t tlrt; - u_int8_t pri:4, - tcode:4; - u_int16_t src; - u_int16_t dest_hi; + COMMON_HDR(dst, tlrt, tcode, pri); + BIT16x2(src, dest_hi); u_int32_t dest_lo; } rreqq; struct { - u_int16_t dst; - u_int8_t tlrt; - u_int8_t pri:4, - tcode:4; - u_int16_t src; - u_int8_t :4, - rtcode:4; - u_int8_t :8; + COMMON_HDR(dst, tlrt, tcode, pri); + COMMON_RES(src, rtcode, , ); u_int32_t :32; } wres; struct { - u_int16_t dst; - u_int8_t tlrt; - u_int8_t pri:4, - tcode:4; - u_int16_t src; - u_int16_t dest_hi; + COMMON_HDR(dst, tlrt, tcode, pri); + BIT16x2(src, dest_hi); u_int32_t dest_lo; - u_int16_t len; - u_int16_t extcode:16; + BIT16x2(len, extcode); } rreqb; struct { - u_int16_t dst; - u_int8_t tlrt; - u_int8_t pri:4, - tcode:4; - u_int16_t src; - u_int16_t dest_hi; + COMMON_HDR(dst, tlrt, tcode, pri); + BIT16x2(src, dest_hi); u_int32_t dest_lo; u_int32_t data; } wreqq; struct { - u_int16_t dst; - u_int8_t tlrt; - u_int8_t pri:4, - tcode:4; - u_int16_t src; - u_int16_t dest_hi; + COMMON_HDR(dst, tlrt, tcode, pri); + BIT16x2(src, dest_hi); u_int32_t dest_lo; u_int32_t data; } cyc; struct { - u_int16_t dst; - u_int8_t tlrt; - u_int8_t pri:4, - tcode:4; - u_int16_t src; - u_int8_t :4, - rtcode:4; - u_int8_t :8; + COMMON_HDR(dst, tlrt, tcode, pri); + COMMON_RES(src, rtcode, , ); u_int32_t :32; u_int32_t data; } rresq; struct { - u_int16_t dst; - u_int8_t tlrt; - u_int8_t pri:4, - tcode:4; - u_int16_t src; - u_int16_t dest_hi; + COMMON_HDR(dst, tlrt, tcode, pri); + BIT16x2(src, dest_hi); u_int32_t dest_lo; - u_int16_t len; - u_int16_t extcode; + BIT16x2(len, extcode); u_int32_t payload[0]; } wreqb; struct { - u_int16_t dst; - u_int8_t tlrt; - u_int8_t pri:4, - tcode:4; - u_int16_t src; - u_int16_t dest_hi; + COMMON_HDR(dst, tlrt, tcode, pri); + BIT16x2(src, dest_hi); u_int32_t dest_lo; - u_int16_t len; - u_int16_t extcode; + BIT16x2(len, extcode); #define FW_LREQ_MSKSWAP 1 #define FW_LREQ_CMPSWAP 2 #define FW_LREQ_FTADD 3 @@ -277,31 +199,17 @@ struct fw_pkt { u_int32_t payload[0]; } lreq; struct { - u_int16_t dst; - u_int8_t tlrt; - u_int8_t pri:4, - tcode:4; - u_int16_t src; - u_int8_t :4, - rtcode:4; - u_int8_t :8; + COMMON_HDR(dst, tlrt, tcode, pri); + COMMON_RES(src, rtcode, , ); u_int32_t :32; - u_int16_t len; - u_int16_t extcode; + BIT16x2(len, extcode); u_int32_t payload[0]; } rresb; struct { - u_int16_t dst; - u_int8_t tlrt; - u_int8_t pri:4, - tcode:4; - u_int16_t src; - u_int8_t :4, - rtcode:4; - u_int8_t :8; + COMMON_HDR(dst, tlrt, tcode, pri); + COMMON_RES(src, rtcode, , ); u_int32_t :32; - u_int16_t len; - u_int16_t extcode; + BIT16x2(len, extcode); u_int32_t payload[0]; } lres; } mode; @@ -352,7 +260,44 @@ struct fw_devlstreq { #define FW_SELF_ID_PORT_CONNECTED_TO_PARENT 2 #define FW_SELF_ID_PORT_NOT_CONNECTED 1 #define FW_SELF_ID_PORT_NOT_EXISTS 0 -#if 0 +#if BYTE_ORDER == BIG_ENDIAN +union fw_self_id { + struct { + u_int32_t id:2, + phy_id:6, + sequel:1, + link_active:1, + gap_count:6, + phy_speed:2, + phy_delay:2, + contender:1, + power_class:3, + port0:2, + port1:2, + port2:2, + initiated_reset:1, + more_packets:1; + } p0; + struct { + u_int32_t + id:2, + phy_id:6, + sequel:1, + sequence_num:3, + :2, + porta:2, + portb:2, + portc:2, + portd:2, + porte:2, + portf:2, + portg:2, + porth:2, + :1, + more_packets:1; + } p1; +}; +#else union fw_self_id { struct { u_int32_t more_packets:1, @@ -388,42 +333,6 @@ union fw_self_id { id:2; } p1; }; -#else -union fw_self_id { - struct { - u_int8_t more_packets:1, - initiated_reset:1, - port2:2, - port1:2, - port0:2; - u_int8_t power_class:3, - contender:1, - phy_delay:2, - phy_speed:2; - u_int8_t gap_count:6, - link_active:1, - sequel:1; - u_int8_t phy_id:6, - id:2; - } p0; - struct { - u_int8_t more_packets:1, - reserved1:1, - porth:2, - portg:2, - portf:2; - u_int8_t porte:2, - portd:2, - portc:2, - portb:2; - u_int8_t porta:2, - reserved2:2, - sequence_num:3, - sequel:1; - u_int8_t phy_id:6, - id:2; - } p1; -}; #endif @@ -449,13 +358,9 @@ struct fw_crom_buf { void *ptr; }; -#define FWSTMAXCHUNK 16 /* * FireWire specific system requests. */ -#if 0 -#define FW_SSTDV _IOWR('S', 85, unsigned int) -#endif #define FW_SSTBUF _IOWR('S', 86, struct fw_isobufreq) #define FW_GSTBUF _IOWR('S', 87, struct fw_isobufreq) #define FW_SRSTREAM _IOWR('S', 88, struct fw_isochreq) diff --git a/sys/dev/firewire/firewire_phy.h b/sys/dev/firewire/firewire_phy.h index de30b2269b3b..02cda696ea3f 100644 --- a/sys/dev/firewire/firewire_phy.h +++ b/sys/dev/firewire/firewire_phy.h @@ -83,5 +83,3 @@ #define FW_PHY_EDEL_REG 0x03 #define FW_PHY_EDEL 15<<0 - - diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 709f80a4a310..ebe74f1db512 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -1,4 +1,5 @@ /* + * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. * @@ -42,15 +43,13 @@ typedef struct proc fw_proc; #include #endif +#include + #define splfw splimp struct fw_device{ u_int16_t dst; struct fw_eui64 eui; -#if 0 - u_int32_t spec; - u_int32_t ver; -#endif u_int8_t speed; u_int8_t maxrec; u_int8_t nport; @@ -66,10 +65,6 @@ struct fw_device{ #define FWDEVATTACHED 2 #define FWDEVINVAL 3 STAILQ_ENTRY(fw_device) link; -#if 0 - LIST_HEAD(, fw_xfer) txqueue; - LIST_HEAD(, fw_xfer) rxqueue; -#endif }; struct firewire_softc { @@ -88,6 +83,7 @@ struct firewire_softc { struct firewire_dev_comm { device_t dev; struct firewire_comm *fc; + void (*post_busreset) __P((void *)); void (*post_explore) __P((void *)); }; @@ -136,14 +132,12 @@ struct firewire_comm{ #define FWBUSCOMPLETION 10 int nisodma; struct fw_eui64 eui; - STAILQ_HEAD(fw_queue, fw_xfer); struct fw_xferq *arq, *atq, *ars, *ats, *it[FW_MAX_DMACH],*ir[FW_MAX_DMACH]; STAILQ_HEAD(, tlabel) tlabels[0x40]; STAILQ_HEAD(, fw_bind) binds; STAILQ_HEAD(, fw_device) devices; STAILQ_HEAD(, fw_xfer) pending; - volatile u_int32_t *sid_buf; u_int sid_cnt; #define CSRSIZE 0x4000 u_int32_t csr_arc[CSRSIZE/4]; @@ -169,6 +163,7 @@ struct firewire_comm{ void (*irx_post) __P((struct firewire_comm *, u_int32_t *)); void (*itx_post) __P((struct firewire_comm *, u_int32_t *)); struct tcode_info *tcode; + bus_dma_tag_t dmat; }; #define CSRARC(sc, offset) ((sc)->csr_arc[(offset)/4]) @@ -184,11 +179,7 @@ struct fw_xferq { #define FWXFERQ_RUNNING (1 << 8) #define FWXFERQ_STREAM (1 << 9) -#define FWXFERQ_PACKET (1 << 10) #define FWXFERQ_BULK (1 << 11) -#if 0 /* BROKEN */ -#define FWXFERQ_DV (1 << 12) -#endif #define FWXFERQ_MODEMASK (7 << 10) #define FWXFERQ_EXTBUF (1 << 13) @@ -198,14 +189,12 @@ struct fw_xferq { #define FWXFERQ_WAKEUP (1 << 17) void (*start) __P((struct firewire_comm*)); - void (*drain) __P((struct firewire_comm*, struct fw_xfer*)); - struct fw_queue q; + STAILQ_HEAD(, fw_xfer) q; u_int queued; u_int maxq; u_int psize; - u_int packets; STAILQ_HEAD(, fw_bind) binds; - caddr_t buf; + struct fwdma_alloc_multi *buf; u_int bnchunk; u_int bnpacket; struct fw_bulkxfer *bulkxfer; @@ -213,36 +202,20 @@ struct fw_xferq { STAILQ_HEAD(, fw_bulkxfer) stfree; STAILQ_HEAD(, fw_bulkxfer) stdma; struct fw_bulkxfer *stproc; -#ifdef FWXFERQ_DV - int dvdbc, dvdiff, dvsync, dvoffset; - struct fw_dvbuf *dvbuf; - STAILQ_HEAD(, fw_dvbuf) dvvalid; - STAILQ_HEAD(, fw_dvbuf) dvfree; - struct fw_dvbuf *dvdma; - struct fw_dvbuf *dvproc; - u_int dvptr; - u_int dvpacket; -#endif struct selinfo rsel; caddr_t sc; void (*hand) __P((struct fw_xferq *)); }; struct fw_bulkxfer{ - caddr_t buf; + int poffset; struct mbuf *mbuf; STAILQ_ENTRY(fw_bulkxfer) link; caddr_t start; caddr_t end; - u_int npacket; int resp; }; -struct fw_dvbuf{ - caddr_t buf; - STAILQ_ENTRY(fw_dvbuf) link; -}; - struct tlabel{ struct fw_xfer *xfer; STAILQ_ENTRY(tlabel) link; @@ -250,23 +223,25 @@ struct tlabel{ struct fw_bind{ u_int32_t start_hi, start_lo, addrlen; - struct fw_xfer* xfer; + STAILQ_HEAD(, fw_xfer) xferlist; STAILQ_ENTRY(fw_bind) fclist; STAILQ_ENTRY(fw_bind) chlist; +#define FWACT_NULL 0 +#define FWACT_XFER 2 +#define FWACT_CH 3 + u_int8_t act_type; + u_int8_t sub; }; struct fw_xfer{ caddr_t sc; struct firewire_comm *fc; struct fw_xferq *q; -#ifdef XFER_TIMEOUT - struct callout_handle ch; -#endif struct timeval tv; - struct fw_tlabel *tlabel; + /* XXX should be removed */ + u_int32_t dst; /* XXX for if_fwe */ u_int8_t spd; - u_int8_t tcode; - int resp; + int8_t resp; #define FWXF_INIT 0 #define FWXF_INQ 1 #define FWXF_START 2 @@ -274,48 +249,30 @@ struct fw_xfer{ #define FWXF_SENTERR 4 #define FWXF_BUSY 8 #define FWXF_RCVD 10 - int state; + u_int8_t state; u_int8_t retry; u_int8_t tl; - int sub; - int32_t dst; - u_int8_t act_type; -#define FWACT_NULL 0 -#define FWACT_XFER 2 -#define FWACT_CH 3 void (*retry_req) __P((struct fw_xfer *)); union{ void (*hand) __P((struct fw_xfer *)); } act; -#if 0 - union{ - struct { - struct fw_device *device; - } req; - struct { - struct stch *channel; - } stream; - } mode; -#endif struct { - u_int16_t len, off; + int len; caddr_t buf; } send, recv; struct mbuf *mbuf; STAILQ_ENTRY(fw_xfer) link; struct malloc_type *malloc; }; -void fw_sidrcv __P((struct firewire_comm *, caddr_t, u_int, u_int)); -void fw_rcv __P((struct firewire_comm *, caddr_t, u_int, u_int, u_int, u_int)); +void fw_sidrcv __P((struct firewire_comm *, u_int32_t *, u_int)); +void fw_rcv __P((struct firewire_comm *, struct iovec *, int, u_int, u_int)); +void fw_xfer_unload __P(( struct fw_xfer*)); void fw_xfer_free __P(( struct fw_xfer*)); struct fw_xfer *fw_xfer_alloc __P((struct malloc_type *)); +struct fw_xfer *fw_xfer_alloc_buf __P((struct malloc_type *, int, int)); void fw_init __P((struct firewire_comm *)); int fw_tbuf_update __P((struct firewire_comm *, int, int)); int fw_rbuf_update __P((struct firewire_comm *, int, int)); -int fw_readreqq __P((struct firewire_comm *, u_int32_t, u_int32_t, u_int32_t *)); -int fw_writereqb __P((struct firewire_comm *, u_int32_t, u_int32_t, u_int32_t, u_int32_t *)); -int fw_readresb __P((struct firewire_comm *, u_int32_t, u_int32_t, u_int32_t, u_int32_t*)); -int fw_writeres __P((struct firewire_comm *, u_int32_t, u_int32_t)); u_int32_t getcsrdata __P((struct fw_device *, u_int8_t)); void fw_asybusy __P((struct fw_xfer *)); int fw_bindadd __P((struct firewire_comm *, struct fw_bind *)); @@ -365,11 +322,6 @@ extern devclass_t firewire_devclass; #define FWPRI ((PZERO+8)|PCATCH) -#ifdef __alpha__ -#undef vtophys -#define vtophys(va) alpha_XXX_dmamap((vm_offset_t)(va)) -#endif /* __alpha__ */ - #if __FreeBSD_version >= 500000 #define CALLOUT_INIT(x) callout_init(x, 0 /* mpsafe */) #else diff --git a/sys/dev/firewire/fwcrom.c b/sys/dev/firewire/fwcrom.c index d58be50f005d..282a7fdda772 100644 --- a/sys/dev/firewire/fwcrom.c +++ b/sys/dev/firewire/fwcrom.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 + * Copyright (c) 2002-2003 * Hidetoshi Shimokawa. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,8 +35,9 @@ */ #include -#include -#include +#if defined(_KERNEL) || defined(TEST) +#include +#endif #ifdef _KERNEL #include #include @@ -48,6 +49,8 @@ #include #include #endif +#include +#include void crom_init_context(struct crom_context *cc, u_int32_t *p) @@ -179,20 +182,28 @@ crom_desc(struct crom_context *cc, char *buf, int len) struct csrreg *reg; struct csrdirectory *dir; char *desc; + u_int16_t crc; reg = crom_get(cc); switch (reg->key & CSRTYPE_MASK) { case CSRTYPE_I: snprintf(buf, len, "%d", reg->val); break; - case CSRTYPE_L: case CSRTYPE_C: snprintf(buf, len, "offset=0x%04x(%d)", reg->val, reg->val); break; + case CSRTYPE_L: + /* XXX fall through */ case CSRTYPE_D: dir = (struct csrdirectory *) (reg + reg->val); - snprintf(buf, len, "len=0x%04x(%d) crc=0x%04x", - dir->crc_len, dir->crc_len, dir->crc); + crc = crom_crc((u_int32_t *)&dir->entry[0], dir->crc_len); + len -= snprintf(buf, len, "len=%d crc=0x%04x", + dir->crc_len, dir->crc); + if (crc == dir->crc) + strncat(buf, "(OK) ", len); + else + strncat(buf, "(NG) ", len); + len -= 5; } switch (reg->key) { case 0x03: @@ -239,7 +250,7 @@ crom_desc(struct crom_context *cc, char *buf, int len) break; case 0x81: desc = "text_leaf"; - crom_parse_text(cc, buf, len); + crom_parse_text(cc, buf + strlen(buf), len); break; case 0xd1: desc = "unit_directory"; @@ -253,3 +264,243 @@ crom_desc(struct crom_context *cc, char *buf, int len) return desc; } #endif + +#if defined(_KERNEL) || defined(TEST) + +int +crom_add_quad(struct crom_chunk *chunk, u_int32_t entry) +{ + int index; + + index = chunk->data.crc_len; + if (index >= CROM_MAX_CHUNK_LEN - 1) { + printf("too large chunk %d\n", index); + return(-1); + } + chunk->data.buf[index] = entry; + chunk->data.crc_len++; + return(index); +} + +int +crom_add_entry(struct crom_chunk *chunk, int key, int val) +{ + struct csrreg *reg; + u_int32_t i; + + reg = (struct csrreg *)&i; + reg->key = key; + reg->val = val; + return(crom_add_quad(chunk, (u_int32_t) i)); +} + +int +crom_add_chunk(struct crom_src *src, struct crom_chunk *parent, + struct crom_chunk *child, int key) +{ + int index; + + if (parent == NULL) { + STAILQ_INSERT_TAIL(&src->chunk_list, child, link); + return(0); + } + + index = crom_add_entry(parent, key, 0); + if (index < 0) { + return(-1); + } + child->ref_chunk = parent; + child->ref_index = index; + STAILQ_INSERT_TAIL(&src->chunk_list, child, link); + return(index); +} + +int +crom_add_simple_text(struct crom_src *src, struct crom_chunk *parent, + struct crom_chunk *chunk, char *buf) +{ + struct csrtext *tl; + u_int32_t *p; + int len, i; + + len = strlen(buf); +#define MAX_TEXT ((CROM_MAX_CHUNK_LEN + 1) * 4 - sizeof(struct csrtext)) + if (len > MAX_TEXT) { +#if __FreeBSD_version < 500000 + printf("text(%d) trancated to %d.\n", len, MAX_TEXT); +#else + printf("text(%d) trancated to %td.\n", len, MAX_TEXT); +#endif + len = MAX_TEXT; + } + + tl = (struct csrtext *) &chunk->data; + tl->crc_len = howmany(sizeof(struct csrtext) + len, sizeof(u_int32_t)); + tl->spec_id = 0; + tl->spec_type = 0; + tl->lang_id = 0; + p = (u_int32_t *) buf; + for (i = 0; i < howmany(len, sizeof(u_int32_t)) / 4; i ++) + tl->text[i] = ntohl(*p++); + return (crom_add_chunk(src, parent, chunk, CROM_TEXTLEAF)); +} + +static int +crom_copy(u_int32_t *src, u_int32_t *dst, int *offset, int len, int maxlen) +{ + if (*offset + len > maxlen) { + printf("Config. ROM is too large for the buffer\n"); + return(-1); + } + bcopy(src, (char *)(dst + *offset), len * sizeof(u_int32_t)); + *offset += len; + return(0); +} + +int +crom_load(struct crom_src *src, u_int32_t *buf, int maxlen) +{ + struct crom_chunk *chunk, *parent; + struct csrhdr *hdr; +#if 0 + u_int32_t *ptr; +#endif + int count, offset; + int len; + + offset = 0; + /* Determine offset */ + STAILQ_FOREACH(chunk, &src->chunk_list, link) { + chunk->offset = offset; + /* Assume the offset of the parent is already known */ + parent = chunk->ref_chunk; + if (parent != NULL) { + struct csrreg *reg; + reg = (struct csrreg *) + &parent->data.buf[chunk->ref_index]; + reg->val = offset - + (parent->offset + 1 + chunk->ref_index); + } + offset += 1 + chunk->data.crc_len; + } + + /* Calculate CRC and dump to the buffer */ + len = 1 + src->hdr.info_len; + count = 0; + if (crom_copy((u_int32_t *)&src->hdr, buf, &count, len, maxlen) < 0) + return(-1); + STAILQ_FOREACH(chunk, &src->chunk_list, link) { + chunk->data.crc = + crom_crc(&chunk->data.buf[0], chunk->data.crc_len); + + len = 1 + chunk->data.crc_len; + if (crom_copy((u_int32_t *)&chunk->data, buf, + &count, len, maxlen) < 0) + return(-1); + } + hdr = (struct csrhdr *)buf; + hdr->crc_len = count - 1; + hdr->crc = crom_crc(buf + 1, hdr->crc_len); + +#if 0 + /* byte swap */ + ptr = buf; + for (i = 0; i < count; i ++) { + *ptr = htonl(*ptr); + ptr++; + } +#endif + + return(count); +} +#endif + +#ifdef TEST +int +main () { + struct crom_src src; + struct crom_chunk root,unit1,unit2,unit3; + struct crom_chunk text1,text2,text3,text4,text5,text6,text7; + u_int32_t buf[256], *p; + int i; + + bzero(&src, sizeof(src)); + bzero(&root, sizeof(root)); + bzero(&unit1, sizeof(unit1)); + bzero(&unit2, sizeof(unit2)); + bzero(&unit3, sizeof(unit3)); + bzero(&text1, sizeof(text1)); + bzero(&text2, sizeof(text2)); + bzero(&text3, sizeof(text3)); + bzero(&text3, sizeof(text4)); + bzero(&text3, sizeof(text5)); + bzero(&text3, sizeof(text6)); + bzero(&text3, sizeof(text7)); + bzero(buf, sizeof(buf)); + + /* BUS info sample */ + src.hdr.info_len = 4; + src.businfo.bus_name = CSR_BUS_NAME_IEEE1394; + src.businfo.eui64.hi = 0x11223344; + src.businfo.eui64.lo = 0x55667788; + src.businfo.link_spd = FWSPD_S400; + src.businfo.generation = 0; + src.businfo.max_rom = MAXROM_4; + src.businfo.max_rec = 10; + src.businfo.cyc_clk_acc = 100; + src.businfo.pmc = 0; + src.businfo.bmc = 1; + src.businfo.isc = 1; + src.businfo.cmc = 1; + src.businfo.irmc = 1; + STAILQ_INIT(&src.chunk_list); + + /* Root directory */ + crom_add_chunk(&src, NULL, &root, 0); + crom_add_entry(&root, CSRKEY_NCAP, 0x123456); + /* private company_id */ + crom_add_entry(&root, CSRKEY_VENDOR, 0xacde48); + + crom_add_simple_text(&src, &root, &text1, "FreeBSD"); + crom_add_entry(&root, CSRKEY_HW, __FreeBSD_version); + crom_add_simple_text(&src, &root, &text2, "FreeBSD-5"); + + /* SBP unit directory */ + crom_add_chunk(&src, &root, &unit1, CROM_UDIR); + crom_add_entry(&unit1, CSRKEY_SPEC, CSRVAL_ANSIT10); + crom_add_entry(&unit1, CSRKEY_VER, CSRVAL_T10SBP2); + crom_add_entry(&unit1, CSRKEY_COM_SPEC, CSRVAL_ANSIT10); + crom_add_entry(&unit1, CSRKEY_COM_SET, CSRVAL_SCSI); + /* management_agent */ + crom_add_entry(&unit1, CROM_MGM, 0x1000); + crom_add_entry(&unit1, CSRKEY_UNIT_CH, (10<<8) | 8); + /* Device type and LUN */ + crom_add_entry(&unit1, CROM_LUN, 0); + crom_add_entry(&unit1, CSRKEY_MODEL, 1); + crom_add_simple_text(&src, &unit1, &text3, "scsi_target"); + + /* RFC2734 IPv4 over IEEE1394 */ + crom_add_chunk(&src, &root, &unit2, CROM_UDIR); + crom_add_entry(&unit2, CSRKEY_SPEC, CSRVAL_IETF); + crom_add_simple_text(&src, &unit2, &text4, "IANA"); + crom_add_entry(&unit2, CSRKEY_VER, 1); + crom_add_simple_text(&src, &unit2, &text5, "IPv4"); + + /* RFC3146 IPv6 over IEEE1394 */ + crom_add_chunk(&src, &root, &unit3, CROM_UDIR); + crom_add_entry(&unit3, CSRKEY_SPEC, CSRVAL_IETF); + crom_add_simple_text(&src, &unit3, &text6, "IANA"); + crom_add_entry(&unit3, CSRKEY_VER, 2); + crom_add_simple_text(&src, &unit3, &text7, "IPv6"); + + crom_load(&src, buf, 256); + p = buf; +#define DUMP_FORMAT "%08x %08x %08x %08x %08x %08x %08x %08x\n" + for (i = 0; i < 256/8; i ++) { + printf(DUMP_FORMAT, + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); + p += 8; + } + return(0); +} +#endif diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index e590edc53a4a..13168b6ffdf1 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. * @@ -42,15 +43,16 @@ #include #include #include -#include #include #include +#include #include #include #include +#include #include #include @@ -112,7 +114,6 @@ fw_open (dev_t dev, int flags, int fmt, fw_proc *td) /* Default is per packet mode */ sc->fc->ir[sub]->flag |= FWXFERQ_OPEN; sc->fc->it[sub]->flag |= FWXFERQ_OPEN; - sc->fc->ir[sub]->flag |= FWXFERQ_PACKET; return err; } @@ -148,32 +149,9 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) sc->fc->it[sub]->flag &= ~FWXFERQ_RUNNING; sc->fc->itx_disable(sc->fc, sub); } -#ifdef FWXFERQ_DV - if(sc->fc->it[sub]->flag & FWXFERQ_DV){ - struct fw_dvbuf *dvbuf; - - if((dvbuf = sc->fc->it[sub]->dvproc) != NULL){ - free(dvbuf->buf, M_FW); - sc->fc->it[sub]->dvproc = NULL; - } - if((dvbuf = sc->fc->it[sub]->dvdma) != NULL){ - free(dvbuf->buf, M_FW); - sc->fc->it[sub]->dvdma = NULL; - } - while((dvbuf = STAILQ_FIRST(&sc->fc->it[sub]->dvvalid)) != NULL){ - STAILQ_REMOVE_HEAD(&sc->fc->it[sub]->dvvalid, link); - free(dvbuf->buf, M_FW); - } - while((dvbuf = STAILQ_FIRST(&sc->fc->it[sub]->dvfree)) != NULL){ - STAILQ_REMOVE_HEAD(&sc->fc->it[sub]->dvfree, link); - free(dvbuf->buf, M_FW); - } - free(sc->fc->it[sub]->dvbuf, M_FW); - sc->fc->it[sub]->dvbuf = NULL; - } -#endif if(sc->fc->ir[sub]->flag & FWXFERQ_EXTBUF){ - free(sc->fc->ir[sub]->buf, M_FW); + if (sc->fc->ir[sub]->buf != NULL) + fwdma_free_multiseg(sc->fc->ir[sub]->buf); sc->fc->ir[sub]->buf = NULL; free(sc->fc->ir[sub]->bulkxfer, M_FW); sc->fc->ir[sub]->bulkxfer = NULL; @@ -182,13 +160,11 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) sc->fc->ir[sub]->maxq = FWMAXQUEUE; } if(sc->fc->it[sub]->flag & FWXFERQ_EXTBUF){ - free(sc->fc->it[sub]->buf, M_FW); + if (sc->fc->it[sub]->buf != NULL) + fwdma_free_multiseg(sc->fc->it[sub]->buf); sc->fc->it[sub]->buf = NULL; free(sc->fc->it[sub]->bulkxfer, M_FW); sc->fc->it[sub]->bulkxfer = NULL; -#ifdef FWXFERQ_DV - sc->fc->it[sub]->dvbuf = NULL; -#endif sc->fc->it[sub]->flag &= ~FWXFERQ_EXTBUF; sc->fc->it[sub]->psize = 0; sc->fc->it[sub]->maxq = FWMAXQUEUE; @@ -199,14 +175,7 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) STAILQ_REMOVE_HEAD(&sc->fc->ir[sub]->q, link); xfer->resp = 0; - switch(xfer->act_type){ - case FWACT_XFER: - fw_xfer_done(xfer); - break; - default: - break; - } - fw_xfer_free(xfer); + fw_xfer_done(xfer); } for(fwb = STAILQ_FIRST(&sc->fc->ir[sub]->binds); fwb != NULL; fwb = STAILQ_FIRST(&sc->fc->ir[sub]->binds)){ @@ -214,8 +183,8 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) STAILQ_REMOVE_HEAD(&sc->fc->ir[sub]->binds, chlist); free(fwb, M_FW); } - sc->fc->ir[sub]->flag &= ~FWXFERQ_MODEMASK; - sc->fc->it[sub]->flag &= ~FWXFERQ_MODEMASK; + sc->fc->ir[sub]->flag &= ~(FWXFERQ_MODEMASK | FWXFERQ_CHTAGMASK); + sc->fc->it[sub]->flag &= ~(FWXFERQ_MODEMASK | FWXFERQ_CHTAGMASK); return err; } @@ -240,12 +209,9 @@ fw_read (dev_t dev, struct uio *uio, int ioflag) ir = sc->fc->ir[sub]; - if (ir->flag & FWXFERQ_PACKET) { - ir->stproc = NULL; - } readloop: xfer = STAILQ_FIRST(&ir->q); - if ((ir->flag & FWXFERQ_PACKET) == 0 && ir->stproc == NULL) { + if (ir->stproc == NULL) { /* iso bulkxfer */ ir->stproc = STAILQ_FIRST(&ir->stvalid); if (ir->stproc != NULL) { @@ -259,12 +225,6 @@ readloop: /* no data avaliable */ if (slept == 0) { slept = 1; - if ((ir->flag & FWXFERQ_RUNNING) == 0 - && (ir->flag & FWXFERQ_PACKET)) { - err = sc->fc->irx_enable(sc->fc, sub); - if (err) - return err; - } ir->flag |= FWXFERQ_WAKEUP; err = tsleep(ir, FWPRI, "fw_read", hz); ir->flag &= ~FWXFERQ_WAKEUP; @@ -274,30 +234,29 @@ readloop: err = EIO; return err; } else if(xfer != NULL) { - /* per packet mode */ + /* per packet mode or FWACT_CH bind?*/ s = splfw(); ir->queued --; STAILQ_REMOVE_HEAD(&ir->q, link); splx(s); - fp = (struct fw_pkt *)(xfer->recv.buf + xfer->recv.off); + fp = (struct fw_pkt *)xfer->recv.buf; if(sc->fc->irx_post != NULL) sc->fc->irx_post(sc->fc, fp->mode.ld); - err = uiomove(xfer->recv.buf + xfer->recv.off, xfer->recv.len, uio); + err = uiomove(xfer->recv.buf, xfer->recv.len, uio); + /* XXX we should recycle this xfer */ fw_xfer_free( xfer); } else if(ir->stproc != NULL) { /* iso bulkxfer */ - fp = (struct fw_pkt *)(ir->stproc->buf + ir->queued * ir->psize); + fp = (struct fw_pkt *)fwdma_v_addr(ir->buf, + ir->stproc->poffset + ir->queued); if(sc->fc->irx_post != NULL) sc->fc->irx_post(sc->fc, fp->mode.ld); - if(ntohs(fp->mode.stream.len) == 0){ + if(fp->mode.stream.len == 0){ err = EIO; return err; } err = uiomove((caddr_t)fp, - ntohs(fp->mode.stream.len) + sizeof(u_int32_t), uio); -#if 0 - fp->mode.stream.len = 0; -#endif + fp->mode.stream.len + sizeof(u_int32_t), uio); ir->queued ++; if(ir->queued >= ir->bnpacket){ s = splfw(); @@ -335,34 +294,7 @@ fw_write (dev_t dev, struct uio *uio, int ioflag) fc = sc->fc; it = sc->fc->it[sub]; - fp = (struct fw_pkt *)uio->uio_iov->iov_base; - switch(fp->mode.common.tcode){ - case FWTCODE_RREQQ: - case FWTCODE_RREQB: - case FWTCODE_LREQ: - err = EINVAL; - return err; - case FWTCODE_WREQQ: - case FWTCODE_WREQB: - xferq = fc->atq; - break; - case FWTCODE_STREAM: - if(it->flag & FWXFERQ_PACKET){ - xferq = fc->atq; - }else{ - xferq = NULL; - } - break; - case FWTCODE_WRES: - case FWTCODE_RRESQ: - case FWTCODE_RRESB: - case FWTCODE_LRES: - xferq = fc->ats; - break; - default: - err = EINVAL; - return err; - } + xferq = NULL; /* Discard unsent buffered stream packet, when sending Asyrequrst */ if(xferq != NULL && it->stproc != NULL){ s = splfw(); @@ -370,11 +302,7 @@ fw_write (dev_t dev, struct uio *uio, int ioflag) splx(s); it->stproc = NULL; } -#ifdef FWXFERQ_DV - if(xferq == NULL && !(it->flag & FWXFERQ_DV)){ -#else if (xferq == NULL) { -#endif isoloop: if (it->stproc == NULL) { it->stproc = STAILQ_FIRST(&it->stfree); @@ -398,11 +326,11 @@ isoloop: return err; } } - fp = (struct fw_pkt *) - (it->stproc->buf + it->queued * it->psize); + fp = (struct fw_pkt *)fwdma_v_addr(it->buf, + it->stproc->poffset + it->queued); err = uiomove((caddr_t)fp, sizeof(struct fw_isohdr), uio); err = uiomove((caddr_t)fp->mode.stream.payload, - ntohs(fp->mode.stream.len), uio); + fp->mode.stream.len, uio); it->queued ++; if (it->queued >= it->bnpacket) { s = splfw(); @@ -417,92 +345,14 @@ isoloop: } return err; } -#ifdef FWXFERQ_DV - if(xferq == NULL && it->flag & FWXFERQ_DV){ -dvloop: - if(it->dvproc == NULL){ - it->dvproc = STAILQ_FIRST(&it->dvfree); - if(it->dvproc != NULL){ - s = splfw(); - STAILQ_REMOVE_HEAD(&it->dvfree, link); - splx(s); - it->dvptr = 0; - }else if(slept == 0){ - slept = 1; - err = sc->fc->itx_enable(sc->fc, sub); - if(err){ - return err; - } - err = tsleep(it, FWPRI, "fw_write", hz); - if(err){ - return err; - } - goto dvloop; - }else{ - err = EIO; - return err; - } - } -#if 0 /* What's this for? (it->dvptr? overwritten by the following uiomove)*/ - fp = (struct fw_pkt *)(it->dvproc->buf + it->queued * it->psize); - fp->mode.stream.len = htons(uio->uio_resid - sizeof(u_int32_t)); -#endif - err = uiomove(it->dvproc->buf + it->dvptr, - uio->uio_resid, uio); - it->dvptr += it->psize; - if(err){ - return err; - } - if(it->dvptr >= it->psize * it->dvpacket){ - s = splfw(); - STAILQ_INSERT_TAIL(&it->dvvalid, it->dvproc, link); - splx(s); - it->dvproc = NULL; - err = fw_tbuf_update(sc->fc, sub, 0); - if(err){ - return err; - } - err = sc->fc->itx_enable(sc->fc, sub); - } - return err; - } -#endif - if(xferq != NULL){ - xfer = fw_xfer_alloc(M_FWXFER); + if (xferq != NULL) { + xfer = fw_xfer_alloc_buf(M_FWXFER, uio->uio_resid, 12); if(xfer == NULL){ err = ENOMEM; return err; } - xfer->send.buf = malloc(uio->uio_resid, M_FW, M_NOWAIT); - if(xfer->send.buf == NULL){ - fw_xfer_free( xfer); - err = ENOBUFS; - return err; - } - xfer->dst = ntohs(fp->mode.hdr.dst); -#if 0 - switch(fp->mode.common.tcode){ - case FWTCODE_WREQQ: - case FWTCODE_WREQB: - if((tl = fw_get_tlabel(fc, xfer)) == -1 ){ - fw_xfer_free( xfer); - err = EAGAIN; - return err; - } - fp->mode.hdr.tlrt = tl << 2; - default: - break; - } - - xfer->tl = fp->mode.hdr.tlrt >> 2; - xfer->tcode = fp->mode.common.tcode; - xfer->fc = fc; - xfer->q = xferq; - xfer->act_type = FWACT_XFER; - xfer->retry_req = fw_asybusy; -#endif + xfer->dst = fp->mode.hdr.dst; xfer->send.len = uio->uio_resid; - xfer->send.off = 0; xfer->spd = 0;/* XXX: how to setup it */ xfer->act.hand = fw_asy_callback; @@ -511,11 +361,7 @@ dvloop: fw_xfer_free( xfer); return err; } -#if 0 - fw_asystart(xfer); -#else fw_asyreq(fc, -1, xfer); -#endif err = tsleep(xfer, FWPRI, "fw_write", hz); if(xfer->resp == EBUSY) return EBUSY; @@ -534,7 +380,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) struct firewire_softc *sc; int unit = DEV2UNIT(dev); int sub = DEV2DMACH(dev); - int i, len, err = 0; + int s, i, len, err = 0; struct fw_device *fwdev; struct fw_bind *fwb; struct fw_xferq *ir, *it; @@ -579,50 +425,6 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) ichreq->tag =(sc->fc->ir[sub]->flag) >> 2 & 0x3; err = 0; break; -#ifdef FWXFERQ_DV - case FW_SSTDV: - ibufreq = (struct fw_isobufreq *) - malloc(sizeof(struct fw_isobufreq), M_FW, M_NOWAIT); - if(ibufreq == NULL){ - err = ENOMEM; - break; - } -#if DV_PAL -#define FWDVPACKET 300 -#else -#define FWDVPACKET 250 -#endif -#define FWDVPMAX 512 - ibufreq->rx.nchunk = 8; - ibufreq->rx.npacket = 50; - ibufreq->rx.psize = FWDVPMAX; - - ibufreq->tx.nchunk = 5; - ibufreq->tx.npacket = FWDVPACKET + 30; /* > 320 or 267 */ - ibufreq->tx.psize = FWDVPMAX; - - err = fw_ioctl(dev, FW_SSTBUF, (caddr_t)ibufreq, flag, td); - sc->fc->it[sub]->dvpacket = FWDVPACKET; - free(ibufreq, M_FW); -/* reserve a buffer space */ -#define NDVCHUNK 8 - sc->fc->it[sub]->dvproc = NULL; - sc->fc->it[sub]->dvdma = NULL; - sc->fc->it[sub]->flag |= FWXFERQ_DV; - /* XXX check malloc failure */ - sc->fc->it[sub]->dvbuf - = (struct fw_dvbuf *)malloc(sizeof(struct fw_dvbuf) * NDVCHUNK, M_FW, M_NOWAIT); - STAILQ_INIT(&sc->fc->it[sub]->dvvalid); - STAILQ_INIT(&sc->fc->it[sub]->dvfree); - for( i = 0 ; i < NDVCHUNK ; i++){ - /* XXX check malloc failure */ - sc->fc->it[sub]->dvbuf[i].buf - = malloc(FWDVPMAX * sc->fc->it[sub]->dvpacket, M_FW, M_NOWAIT); - STAILQ_INSERT_TAIL(&sc->fc->it[sub]->dvfree, - &sc->fc->it[sub]->dvbuf[i], link); - } - break; -#endif case FW_SSTBUF: ir = sc->fc->ir[sub]; it = sc->fc->it[sub]; @@ -639,48 +441,52 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) ibufreq->tx.psize * ibufreq->tx.npacket) <= 0){ return(EINVAL); } - if(ibufreq->rx.nchunk > FWSTMAXCHUNK || - ibufreq->tx.nchunk > FWSTMAXCHUNK){ - return(EINVAL); - } ir->bulkxfer - = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->rx.nchunk, M_FW, 0); + = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->rx.nchunk, M_FW, M_WAITOK); if(ir->bulkxfer == NULL){ return(ENOMEM); } it->bulkxfer - = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->tx.nchunk, M_FW, 0); + = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->tx.nchunk, M_FW, M_WAITOK); if(it->bulkxfer == NULL){ return(ENOMEM); } - ir->buf = malloc( - ibufreq->rx.nchunk * ibufreq->rx.npacket - /* XXX psize must be 2^n and less or - equal to PAGE_SIZE */ - * ((ibufreq->rx.psize + 3) &~3), - M_FW, 0); - if(ir->buf == NULL){ - free(ir->bulkxfer, M_FW); - free(it->bulkxfer, M_FW); - ir->bulkxfer = NULL; - it->bulkxfer = NULL; - it->buf = NULL; - return(ENOMEM); + if (ibufreq->rx.psize > 0) { + ibufreq->rx.psize = roundup2(ibufreq->rx.psize, + sizeof(u_int32_t)); + ir->buf = fwdma_malloc_multiseg( + sc->fc, sizeof(u_int32_t), + ibufreq->rx.psize, + ibufreq->rx.nchunk * ibufreq->rx.npacket, + BUS_DMA_WAITOK); + + if(ir->buf == NULL){ + free(ir->bulkxfer, M_FW); + free(it->bulkxfer, M_FW); + ir->bulkxfer = NULL; + it->bulkxfer = NULL; + it->buf = NULL; + return(ENOMEM); + } } - it->buf = malloc( - ibufreq->tx.nchunk * ibufreq->tx.npacket - /* XXX psize must be 2^n and less or - equal to PAGE_SIZE */ - * ((ibufreq->tx.psize + 3) &~3), - M_FW, 0); - if(it->buf == NULL){ - free(ir->bulkxfer, M_FW); - free(it->bulkxfer, M_FW); - free(ir->buf, M_FW); - ir->bulkxfer = NULL; - it->bulkxfer = NULL; - it->buf = NULL; - return(ENOMEM); + if (ibufreq->tx.psize > 0) { + ibufreq->tx.psize = roundup2(ibufreq->tx.psize, + sizeof(u_int32_t)); + it->buf = fwdma_malloc_multiseg( + sc->fc, sizeof(u_int32_t), + ibufreq->tx.psize, + ibufreq->tx.nchunk * ibufreq->tx.npacket, + BUS_DMA_WAITOK); + + if(it->buf == NULL){ + free(ir->bulkxfer, M_FW); + free(it->bulkxfer, M_FW); + fwdma_free_multiseg(ir->buf); + ir->bulkxfer = NULL; + it->bulkxfer = NULL; + it->buf = NULL; + return(ENOMEM); + } } ir->bnchunk = ibufreq->rx.nchunk; @@ -693,13 +499,6 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) it->psize = (ibufreq->tx.psize + 3) & ~3; it->queued = 0; -#ifdef FWXFERQ_DV - it->dvdbc = 0; - it->dvdiff = 0; - it->dvsync = 0; - it->dvoffset = 0; -#endif - STAILQ_INIT(&ir->stvalid); STAILQ_INIT(&ir->stfree); STAILQ_INIT(&ir->stdma); @@ -711,18 +510,16 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) it->stproc = NULL; for(i = 0 ; i < sc->fc->ir[sub]->bnchunk; i++){ - ir->bulkxfer[i].buf = - ir->buf + i * ir->bnpacket * ir->psize; + ir->bulkxfer[i].poffset = i * ir->bnpacket; + ir->bulkxfer[i].mbuf = NULL; STAILQ_INSERT_TAIL(&ir->stfree, &ir->bulkxfer[i], link); - ir->bulkxfer[i].npacket = ir->bnpacket; } for(i = 0 ; i < sc->fc->it[sub]->bnchunk; i++){ - it->bulkxfer[i].buf = - it->buf + i * it->bnpacket * it->psize; + it->bulkxfer[i].poffset = i * it->bnpacket; + it->bulkxfer[i].mbuf = NULL; STAILQ_INSERT_TAIL(&it->stfree, &it->bulkxfer[i], link); - it->bulkxfer[i].npacket = it->bnpacket; } ir->flag &= ~FWXFERQ_MODEMASK; ir->flag |= FWXFERQ_STREAM; @@ -743,7 +540,8 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) ibufreq->tx.psize = sc->fc->it[sub]->psize; break; case FW_ASYREQ: - xfer = fw_xfer_alloc(M_FWXFER); + xfer = fw_xfer_alloc_buf(M_FWXFER, asyreq->req.len, + PAGE_SIZE /* XXX */); if(xfer == NULL){ err = ENOMEM; return err; @@ -751,7 +549,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) fp = &asyreq->pkt; switch (asyreq->req.type) { case FWASREQNODE: - xfer->dst = ntohs(fp->mode.hdr.dst); + xfer->dst = fp->mode.hdr.dst; break; case FWASREQEUI: fwdev = fw_noderesolve_eui64(sc->fc, @@ -763,7 +561,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) goto error; } xfer->dst = fwdev->dst; - fp->mode.hdr.dst = htons(FWLOCALBUS | xfer->dst); + fp->mode.hdr.dst = FWLOCALBUS | xfer->dst; break; case FWASRESTL: /* XXX what's this? */ @@ -773,12 +571,6 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) break; } xfer->spd = asyreq->req.sped; - xfer->send.len = asyreq->req.len; - xfer->send.buf = malloc(xfer->send.len, M_FW, M_NOWAIT); - if(xfer->send.buf == NULL){ - return ENOMEM; - } - xfer->send.off = 0; bcopy(fp, xfer->send.buf, xfer->send.len); xfer->act.hand = fw_asy_callback; err = fw_asyreq(sc->fc, sub, xfer); @@ -793,7 +585,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) }else{ err = EINVAL; } - bcopy(xfer->recv.buf + xfer->recv.off, fp, asyreq->req.len); + bcopy(xfer->recv.buf, fp, asyreq->req.len); } error: fw_xfer_free( xfer); @@ -829,17 +621,21 @@ error: fwb->start_hi = bindreq->start.hi; fwb->start_lo = bindreq->start.lo; fwb->addrlen = bindreq->len; + fwb->sub = sub; + fwb->act_type = FWACT_CH; xfer = fw_xfer_alloc(M_FWXFER); if(xfer == NULL){ err = ENOMEM; return err; } - xfer->act_type = FWACT_CH; - xfer->sub = sub; xfer->fc = sc->fc; - fwb->xfer = xfer; + s = splfw(); + /* XXX broken. need multiple xfer */ + STAILQ_INIT(&fwb->xferlist); + STAILQ_INSERT_TAIL(&fwb->xferlist, xfer, link); + splx(s); err = fw_bindadd(sc->fc, fwb); break; case FW_GDEVLST: @@ -876,17 +672,10 @@ error: err = FWNODE_INVAL; break; } -#if 0 - if (fwdev->csrrom[0] >> 24 == 1) - len = 4; - else - len = (1 + ((fwdev->csrrom[0] >> 16) & 0xff)) * 4; -#else if (fwdev->rommax < CSRROMOFF) len = 0; else len = fwdev->rommax - CSRROMOFF + 4; -#endif if (crom_buf->len < len) len = crom_buf->len; else @@ -930,17 +719,17 @@ fw_poll(dev_t dev, int events, fw_proc *td) } static int -#if __FreeBSD_version < 500000 +#if __FreeBSD_version < 500102 fw_mmap (dev_t dev, vm_offset_t offset, int nproto) #else -fw_mmap (dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nproto) +fw_mmap (dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) #endif { struct firewire_softc *fc; int unit = DEV2UNIT(dev); if (DEV_FWMEM(dev)) -#if __FreeBSD_version < 500000 +#if __FreeBSD_version < 500102 return fwmem_mmap(dev, offset, nproto); #else return fwmem_mmap(dev, offset, paddr, nproto); diff --git a/sys/dev/firewire/fwdma.c b/sys/dev/firewire/fwdma.c new file mode 100644 index 000000000000..14b49039e692 --- /dev/null +++ b/sys/dev/firewire/fwdma.c @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2003 + * Hidetoshi Shimokawa. 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 Hidetoshi Shimokawa. + * + * 4. Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. + * + * $FreeBSD$ + */ +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +static void +fwdma_map_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + bus_addr_t *baddr; + + if (error) + printf("fwdma_map_cb: error=%d\n", error); + baddr = (bus_addr_t *)arg; + *baddr = segs->ds_addr; +} + +void * +fwdma_malloc(struct firewire_comm *fc, int alignment, bus_size_t size, + struct fwdma_alloc *dma, int flag) +{ + int err; + + dma->v_addr = NULL; + err = bus_dma_tag_create( + /*parent*/ fc->dmat, + /*alignment*/ alignment, + /*boundary*/ 0, + /*lowaddr*/ BUS_SPACE_MAXADDR_32BIT, + /*highaddr*/ BUS_SPACE_MAXADDR, + /*filter*/NULL, /*filterarg*/NULL, + /*maxsize*/ size, + /*nsegments*/ 1, + /*maxsegsz*/ BUS_SPACE_MAXSIZE_32BIT, + /*flags*/ BUS_DMA_ALLOCNOW, &dma->dma_tag); + if (err) { + printf("fwdma_malloc: failed(1)\n"); + return(NULL); + } + + err = bus_dmamem_alloc(dma->dma_tag, &dma->v_addr, + flag, &dma->dma_map); + if (err) { + printf("fwdma_malloc: failed(2)\n"); + /* XXX destory tag */ + return(NULL); + } + + bus_dmamap_load(dma->dma_tag, dma->dma_map, dma->v_addr, + size, fwdma_map_cb, &dma->bus_addr, /*flags*/0); + + return(dma->v_addr); +} + +void +fwdma_free(struct firewire_comm *fc, struct fwdma_alloc *dma) +{ + bus_dmamap_unload(dma->dma_tag, dma->dma_map); + bus_dmamem_free(dma->dma_tag, dma->v_addr, dma->dma_map); + bus_dma_tag_destroy(dma->dma_tag); +} + + +void * +fwdma_malloc_size(bus_dma_tag_t dmat, bus_dmamap_t *dmamap, + bus_size_t size, bus_addr_t *bus_addr, int flag) +{ + void *v_addr; + + if (bus_dmamem_alloc(dmat, &v_addr, flag, dmamap)) { + printf("fwdma_malloc_size: failed(1)\n"); + return(NULL); + } + bus_dmamap_load(dmat, *dmamap, v_addr, size, + fwdma_map_cb, bus_addr, /*flags*/0); + return(v_addr); +} + +void +fwdma_free_size(bus_dma_tag_t dmat, bus_dmamap_t dmamap, + void *vaddr, bus_size_t size) +{ + bus_dmamap_unload(dmat, dmamap); + bus_dmamem_free(dmat, vaddr, dmamap); +} + +/* + * Allocate multisegment dma buffers + * each segment size is eqaul to ssize except last segment. + */ +struct fwdma_alloc_multi * +fwdma_malloc_multiseg(struct firewire_comm *fc, int alignment, + int esize, int n, int flag) +{ + struct fwdma_alloc_multi *am; + struct fwdma_seg *seg; + bus_size_t ssize; + int nseg; + + if (esize > PAGE_SIZE) { + /* round up to PAGE_SIZE */ + esize = ssize = roundup2(esize, PAGE_SIZE); + nseg = n; + } else { + /* allocate PAGE_SIZE segment for small elements */ + ssize = rounddown(PAGE_SIZE, esize); + nseg = howmany(n, ssize / esize); + } + am = (struct fwdma_alloc_multi *)malloc(sizeof(struct fwdma_alloc_multi) + + sizeof(struct fwdma_seg)*nseg, M_FW, M_WAITOK); + if (am == NULL) { + printf("fwdma_malloc_multiseg: malloc failed\n"); + return(NULL); + } + am->ssize = ssize; + am->esize = esize; + am->nseg = 0; + if (bus_dma_tag_create( + /*parent*/ fc->dmat, + /*alignment*/ alignment, + /*boundary*/ 0, + /*lowaddr*/ BUS_SPACE_MAXADDR_32BIT, + /*highaddr*/ BUS_SPACE_MAXADDR, + /*filter*/NULL, /*filterarg*/NULL, + /*maxsize*/ ssize, + /*nsegments*/ 1, + /*maxsegsz*/ BUS_SPACE_MAXSIZE_32BIT, + /*flags*/ BUS_DMA_ALLOCNOW, &am->dma_tag)) { + printf("fwdma_malloc_multiseg: tag_create failed\n"); + free(am, M_FW); + return(NULL); + } + +#if 0 +#if __FreeBSD_version < 500000 + printf("malloc_multi: ssize=%d nseg=%d\n", ssize, nseg); +#else + printf("malloc_multi: ssize=%td nseg=%d\n", ssize, nseg); +#endif +#endif + for (seg = &am->seg[0]; nseg --; seg ++) { + seg->v_addr = fwdma_malloc_size(am->dma_tag, &seg->dma_map, + ssize, &seg->bus_addr, flag); + if (seg->v_addr == NULL) { + printf("fwdma_malloc_multi: malloc_size failed %d\n", + am->nseg); + fwdma_free_multiseg(am); + return(NULL); + } + am->nseg++; + } + return(am); +} + +void +fwdma_free_multiseg(struct fwdma_alloc_multi *am) +{ + struct fwdma_seg *seg; + + for (seg = &am->seg[0]; am->nseg --; seg ++) { + fwdma_free_size(am->dma_tag, seg->dma_map, + seg->v_addr, am->ssize); + } + bus_dma_tag_destroy(am->dma_tag); + free(am, M_FW); +} diff --git a/sys/dev/firewire/fwdma.h b/sys/dev/firewire/fwdma.h new file mode 100644 index 000000000000..5d3375ab53cd --- /dev/null +++ b/sys/dev/firewire/fwdma.h @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2003 + * Hidetoshi Shimokawa. 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 Hidetoshi Shimokawa. + * + * 4. Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. + * + * $FreeBSD$ + */ + +#if __FreeBSD_version >= 500111 +typedef int bus_dmasync_op_t; +#endif + +struct fwdma_alloc { + bus_dma_tag_t dma_tag; + bus_dmamap_t dma_map; + void * v_addr; + bus_addr_t bus_addr; +}; + +struct fwdma_seg { + bus_dmamap_t dma_map; + void * v_addr; + bus_addr_t bus_addr; +}; + +struct fwdma_alloc_multi { + bus_size_t ssize; + bus_size_t esize; + int nseg; + bus_dma_tag_t dma_tag; + struct fwdma_seg seg[0]; +}; + +static __inline void * +fwdma_v_addr(struct fwdma_alloc_multi *am, int index) +{ + bus_size_t ssize = am->ssize; + int offset = am->esize * index; + + return ((caddr_t)am->seg[offset / ssize].v_addr + (offset % ssize)); +} + +static __inline bus_addr_t +fwdma_bus_addr(struct fwdma_alloc_multi *am, int index) +{ + bus_size_t ssize = am->ssize; + int offset = am->esize * index; + + return (am->seg[offset / ssize].bus_addr + (offset % ssize)); +} + +static __inline void +fwdma_sync(struct fwdma_alloc *dma, bus_dmasync_op_t op) +{ + bus_dmamap_sync(dma->dma_tag, dma->dma_map, op); +} + +static __inline void +fwdma_sync_multiseg(struct fwdma_alloc_multi *am, + int start, int end, bus_dmasync_op_t op) +{ + struct fwdma_seg *seg, *eseg; + + seg = &am->seg[am->esize * start / am->ssize]; + eseg = &am->seg[am->esize * end / am->ssize]; + for (; seg <= eseg; seg ++) + bus_dmamap_sync(am->dma_tag, seg->dma_map, op); +} + +static __inline void +fwdma_sync_multiseg_all(struct fwdma_alloc_multi *am, bus_dmasync_op_t op) +{ + struct fwdma_seg *seg; + int i; + + seg = &am->seg[0]; + for (i = 0; i < am->nseg; i++, seg++) + bus_dmamap_sync(am->dma_tag, seg->dma_map, op); +} + +void *fwdma_malloc(struct firewire_comm *, int, bus_size_t, struct fwdma_alloc *, int); +void fwdma_free(struct firewire_comm *, struct fwdma_alloc *); +void *fwdma_malloc_size(bus_dma_tag_t, bus_dmamap_t *, bus_size_t, bus_addr_t *, int); +void fwdma_free_size(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t); +struct fwdma_alloc_multi *fwdma_malloc_multiseg(struct firewire_comm *, + int, int, int, int); +void fwdma_free_multiseg(struct fwdma_alloc_multi *); + diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index 13bd092a9323..5471687e4265 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 + * Copyright (c) 2002-2003 * Hidetoshi Shimokawa. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,10 +41,10 @@ #include #include #include -#include #include #include +#include #include #include @@ -68,20 +68,18 @@ SYSCTL_INT(_hw_firewire_fwmem, OID_AUTO, speed, CTLFLAG_RW, &fwmem_speed, 0, SYSCTL_INT(_debug, OID_AUTO, fwmem_debug, CTLFLAG_RW, &fwmem_debug, 0, "Fwmem driver debug flag"); -static struct fw_xfer *fwmem_xfer_req(struct fw_device *, caddr_t, - int, int, void *); - static struct fw_xfer * fwmem_xfer_req( struct fw_device *fwdev, caddr_t sc, int spd, - int len, + int slen, + int rlen, void *hand) { struct fw_xfer *xfer; - xfer = fw_xfer_alloc(M_FWXFER); + xfer = fw_xfer_alloc_buf(M_FWXFER, slen, rlen); if (xfer == NULL) return NULL; @@ -91,15 +89,6 @@ fwmem_xfer_req( xfer->spd = fwdev->speed; else xfer->spd = min(spd, fwdev->speed); - xfer->send.len = len; - xfer->send.buf = malloc(len, M_FW, M_NOWAIT | M_ZERO); - - if (xfer->send.buf == NULL) { - fw_xfer_free(xfer); - return NULL; - } - - xfer->send.off = 0; xfer->act.hand = hand; xfer->retry_req = fw_asybusy; xfer->sc = sc; @@ -119,15 +108,15 @@ fwmem_read_quad( struct fw_xfer *xfer; struct fw_pkt *fp; - xfer = fwmem_xfer_req(fwdev, sc, spd, 12, hand); + xfer = fwmem_xfer_req(fwdev, sc, spd, 12, 16, hand); if (xfer == NULL) return NULL; fp = (struct fw_pkt *)xfer->send.buf; fp->mode.rreqq.tcode = FWTCODE_RREQQ; - fp->mode.rreqq.dst = htons(xfer->dst); - fp->mode.rreqq.dest_hi = htons(dst_hi); - fp->mode.rreqq.dest_lo = htonl(dst_lo); + fp->mode.rreqq.dst = xfer->dst; + fp->mode.rreqq.dest_hi = dst_hi; + fp->mode.rreqq.dest_lo = dst_lo; if (fwmem_debug) printf("fwmem_read_quad: %d %04x:%08x\n", fwdev->dst, @@ -153,15 +142,15 @@ fwmem_write_quad( struct fw_xfer *xfer; struct fw_pkt *fp; - xfer = fwmem_xfer_req(fwdev, sc, spd, 16, hand); + xfer = fwmem_xfer_req(fwdev, sc, spd, 16, 12, hand); if (xfer == NULL) return NULL; fp = (struct fw_pkt *)xfer->send.buf; fp->mode.wreqq.tcode = FWTCODE_WREQQ; - fp->mode.wreqq.dst = htons(xfer->dst); - fp->mode.wreqq.dest_hi = htons(dst_hi); - fp->mode.wreqq.dest_lo = htonl(dst_lo); + fp->mode.wreqq.dst = xfer->dst; + fp->mode.wreqq.dest_hi = dst_hi; + fp->mode.wreqq.dest_lo = dst_lo; fp->mode.wreqq.data = data; @@ -189,16 +178,16 @@ fwmem_read_block( struct fw_xfer *xfer; struct fw_pkt *fp; - xfer = fwmem_xfer_req(fwdev, sc, spd, 16, hand); + xfer = fwmem_xfer_req(fwdev, sc, spd, 16, roundup2(16+len,4), hand); if (xfer == NULL) return NULL; fp = (struct fw_pkt *)xfer->send.buf; fp->mode.rreqb.tcode = FWTCODE_RREQB; - fp->mode.rreqb.dst = htons(xfer->dst); - fp->mode.rreqb.dest_hi = htons(dst_hi); - fp->mode.rreqb.dest_lo = htonl(dst_lo); - fp->mode.rreqb.len = htons(len); + fp->mode.rreqb.dst = xfer->dst; + fp->mode.rreqb.dest_hi = dst_hi; + fp->mode.rreqb.dest_lo = dst_lo; + fp->mode.rreqb.len = len; if (fwmem_debug) printf("fwmem_read_block: %d %04x:%08x %d\n", fwdev->dst, @@ -224,16 +213,16 @@ fwmem_write_block( struct fw_xfer *xfer; struct fw_pkt *fp; - xfer = fwmem_xfer_req(fwdev, sc, spd, 16 + roundup(len, 4), hand); + xfer = fwmem_xfer_req(fwdev, sc, spd, roundup(16+len, 4), 12, hand); if (xfer == NULL) return NULL; fp = (struct fw_pkt *)xfer->send.buf; fp->mode.wreqb.tcode = FWTCODE_WREQB; - fp->mode.wreqb.dst = htons(xfer->dst); - fp->mode.wreqb.dest_hi = htons(dst_hi); - fp->mode.wreqb.dest_lo = htonl(dst_lo); - fp->mode.wreqb.len = htons(len); + fp->mode.wreqb.dst = xfer->dst; + fp->mode.wreqb.dest_hi = dst_hi; + fp->mode.wreqb.dest_lo = dst_lo; + fp->mode.wreqb.len = len; bcopy(data, &fp->mode.wreqb.payload[0], len); if (fwmem_debug) @@ -252,7 +241,8 @@ fwmem_open (dev_t dev, int flags, int fmt, fw_proc *td) { struct fw_eui64 *eui; - eui = (struct fw_eui64 *)malloc(sizeof(struct fw_eui64), M_FW, 0); + eui = (struct fw_eui64 *)malloc(sizeof(struct fw_eui64), + M_FW, M_WAITOK); if (eui == NULL) return ENOMEM; bcopy(&fwmem_eui64, eui, sizeof(struct fw_eui64)); @@ -310,8 +300,7 @@ fwmem_read (dev_t dev, struct uio *uio, int ioflag) else if (xfer->resp != 0) err = xfer->resp; else if (err == 0) - err = uiomove(xfer->recv.buf - + xfer->recv.off + 4*3, 4, uio); + err = uiomove(xfer->recv.buf + 4*3, 4, uio); } else { if (len > MAXLEN) len = MAXLEN; @@ -327,8 +316,7 @@ fwmem_read (dev_t dev, struct uio *uio, int ioflag) else if (xfer->resp != 0) err = xfer->resp; else if (err == 0) - err = uiomove(xfer->recv.buf - + xfer->recv.off + 4*4, len, uio); + err = uiomove(xfer->recv.buf + 4*4, len, uio); } fw_xfer_free(xfer); } @@ -357,7 +345,7 @@ fwmem_write (dev_t dev, struct uio *uio, int ioflag) return EINVAL; } - data = malloc(MAXLEN, M_FW, 0); + data = malloc(MAXLEN, M_FW, M_WAITOK); if (data == NULL) return ENOMEM; @@ -421,10 +409,10 @@ fwmem_poll (dev_t dev, int events, fw_proc *td) return EINVAL; } int -#if __FreeBSD_version < 500000 +#if __FreeBSD_version < 500102 fwmem_mmap (dev_t dev, vm_offset_t offset, int nproto) #else -fwmem_mmap (dev_t dev, vm_offset_t offset, vm_offset_t *paddr, int nproto) +fwmem_mmap (dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) #endif { return EINVAL; diff --git a/sys/dev/firewire/fwmem.h b/sys/dev/firewire/fwmem.h index 0e2e83cab34f..0567f81e9a65 100644 --- a/sys/dev/firewire/fwmem.h +++ b/sys/dev/firewire/fwmem.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 + * Copyright (C) 2002-2003 * Hidetoshi Shimokawa. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 1f45cb92438e..3d759f9859f5 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. * @@ -51,11 +52,11 @@ #include #include #include -#include #include #include #include #include +#include #include #include @@ -65,12 +66,10 @@ #include #include #include -#include -#include -#include /* for vtophys proto */ #include #include +#include #include #include #include @@ -81,8 +80,10 @@ static char dbcode[16][0x10]={"OUTM", "OUTL","INPM","INPL", "STOR","LOAD","NOP ","STOP",}; + static char dbkey[8][0x10]={"ST0", "ST1","ST2","ST3", "UNDEF","REG","SYS","DEV"}; +static char dbcond[4][0x10]={"NEV","C=1", "C=0", "ALL"}; char fwohcicode[32][0x20]={ "No stat","Undef","long","miss Ack err", "underrun","overrun","desc err", "data read err", @@ -92,9 +93,9 @@ char fwohcicode[32][0x20]={ "ack busy_X","ack busy_A","ack busy_B","Undef", "Undef","Undef","Undef","ack tardy", "Undef","ack data_err","ack type_err",""}; + #define MAX_SPEED 2 extern char linkspeed[MAX_SPEED+1][0x10]; -static char dbcond[4][0x10]={"NEV","C=1", "C=0", "ALL"}; u_int32_t tagbit[4] = { 1 << 28, 1 << 29, 1 << 30, 1 << 31}; static struct tcode_info tinfo[] = { @@ -124,40 +125,40 @@ static struct tcode_info tinfo[] = { #define OREAD(sc, r) bus_space_read_4((sc)->bst, (sc)->bsh, (r)) static void fwohci_ibr __P((struct firewire_comm *)); -static void fwohci_db_init __P((struct fwohci_dbch *)); +static void fwohci_db_init __P((struct fwohci_softc *, struct fwohci_dbch *)); static void fwohci_db_free __P((struct fwohci_dbch *)); static void fwohci_arcv __P((struct fwohci_softc *, struct fwohci_dbch *, int)); -static void fwohci_ircv __P((struct fwohci_softc *, struct fwohci_dbch *, int)); static void fwohci_txd __P((struct fwohci_softc *, struct fwohci_dbch *)); static void fwohci_start_atq __P((struct firewire_comm *)); static void fwohci_start_ats __P((struct firewire_comm *)); static void fwohci_start __P((struct fwohci_softc *, struct fwohci_dbch *)); -static void fwohci_drain_atq __P((struct firewire_comm *, struct fw_xfer *)); -static void fwohci_drain_ats __P((struct firewire_comm *, struct fw_xfer *)); -static void fwohci_drain __P((struct firewire_comm *, struct fw_xfer *, struct fwohci_dbch *)); static u_int32_t fwphy_wrdata __P(( struct fwohci_softc *, u_int32_t, u_int32_t)); static u_int32_t fwphy_rddata __P(( struct fwohci_softc *, u_int32_t)); static int fwohci_rx_enable __P((struct fwohci_softc *, struct fwohci_dbch *)); static int fwohci_tx_enable __P((struct fwohci_softc *, struct fwohci_dbch *)); static int fwohci_irx_enable __P((struct firewire_comm *, int)); -static int fwohci_irxpp_enable __P((struct firewire_comm *, int)); -static int fwohci_irxbuf_enable __P((struct firewire_comm *, int)); static int fwohci_irx_disable __P((struct firewire_comm *, int)); +#if BYTE_ORDER == BIG_ENDIAN static void fwohci_irx_post __P((struct firewire_comm *, u_int32_t *)); +#endif static int fwohci_itxbuf_enable __P((struct firewire_comm *, int)); static int fwohci_itx_disable __P((struct firewire_comm *, int)); static void fwohci_timeout __P((void *)); static void fwohci_poll __P((struct firewire_comm *, int, int)); static void fwohci_set_intr __P((struct firewire_comm *, int)); -static int fwohci_add_rx_buf __P((struct fwohcidb_tr *, unsigned short, int, void *, void *)); -static int fwohci_add_tx_buf __P((struct fwohcidb_tr *, unsigned short, int, void *)); + +static int fwohci_add_rx_buf __P((struct fwohci_dbch *, struct fwohcidb_tr *, int, struct fwdma_alloc *)); +static int fwohci_add_tx_buf __P((struct fwohci_dbch *, struct fwohcidb_tr *, int)); static void dump_db __P((struct fwohci_softc *, u_int32_t)); -static void print_db __P((volatile struct fwohcidb *, u_int32_t , u_int32_t)); +static void print_db __P((struct fwohcidb_tr *, volatile struct fwohcidb *, u_int32_t , u_int32_t)); static void dump_dma __P((struct fwohci_softc *, u_int32_t)); static u_int32_t fwohci_cyctimer __P((struct firewire_comm *)); static void fwohci_rbuf_update __P((struct fwohci_softc *, int)); static void fwohci_tbuf_update __P((struct fwohci_softc *, int)); void fwohci_txbufdb __P((struct fwohci_softc *, int , struct fw_bulkxfer *)); +#if FWOHCI_TASKQUEUE +static void fwohci_complete(void *, int); +#endif /* * memory allocated for DMA programs @@ -198,6 +199,7 @@ void fwohci_txbufdb __P((struct fwohci_softc *, int , struct fw_bulkxfer *)); #define OHCI_SID_BUF 0x64 #define OHCI_SID_CNT 0x68 +#define OHCI_SID_ERR (1 << 31) #define OHCI_SID_CNT_MASK 0xffc #define OHCI_IT_STAT 0x90 @@ -411,10 +413,6 @@ fwohci_probe_phy(struct fwohci_softc *sc, device_t dev) * It is not actually available port on your PC . */ OWRITE(sc, OHCI_HCCCTL, OHCI_HCC_LPS); -#if 0 - /* XXX wait for SCLK. */ - DELAY(100000); -#endif reg = fwphy_rddata(sc, FW_PHY_SPD_REG); if((reg >> 5) != 7 ){ @@ -533,10 +531,10 @@ fwohci_reset(struct fwohci_softc *sc, device_t dev) /* Initialize registers */ OWRITE(sc, OHCI_CROMHDR, sc->fc.config_rom[0]); - OWRITE(sc, OHCI_CROMPTR, vtophys(&sc->fc.config_rom[0])); + OWRITE(sc, OHCI_CROMPTR, sc->crom_dma.bus_addr); OWRITE(sc, OHCI_HCCCTLCLR, OHCI_HCC_BIGEND); OWRITE(sc, OHCI_HCCCTL, OHCI_HCC_POSTWR); - OWRITE(sc, OHCI_SID_BUF, vtophys(sc->fc.sid_buf)); + OWRITE(sc, OHCI_SID_BUF, sc->sid_dma.bus_addr); OWRITE(sc, OHCI_LNKCTL, OHCI_CNTL_SID); fw_busreset(&sc->fc); @@ -583,6 +581,10 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) u_int32_t reg; u_int8_t ui[8]; +#if FWOHCI_TASKQUEUE + TASK_INIT(&sc->fwohci_task_complete, 0, fwohci_complete, sc); +#endif + reg = OREAD(sc, OHCI_VERSION); device_printf(dev, "OHCI version %x.%x (ROM=%d)\n", (reg>>16) & 0xff, reg & 0xff, (reg>>24) & 1); @@ -604,15 +606,20 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) sc->fc.atq = &sc->atrq.xferq; sc->fc.ats = &sc->atrs.xferq; + sc->arrq.xferq.psize = roundup2(FWPMAX_S400, PAGE_SIZE); + sc->arrs.xferq.psize = roundup2(FWPMAX_S400, PAGE_SIZE); + sc->atrq.xferq.psize = roundup2(FWPMAX_S400, PAGE_SIZE); + sc->atrs.xferq.psize = roundup2(FWPMAX_S400, PAGE_SIZE); + sc->arrq.xferq.start = NULL; sc->arrs.xferq.start = NULL; sc->atrq.xferq.start = fwohci_start_atq; sc->atrs.xferq.start = fwohci_start_ats; - sc->arrq.xferq.drain = NULL; - sc->arrs.xferq.drain = NULL; - sc->atrq.xferq.drain = fwohci_drain_atq; - sc->atrs.xferq.drain = fwohci_drain_ats; + sc->arrq.xferq.buf = NULL; + sc->arrs.xferq.buf = NULL; + sc->atrq.xferq.buf = NULL; + sc->atrs.xferq.buf = NULL; sc->arrq.ndesc = 1; sc->arrs.ndesc = 1; @@ -624,10 +631,6 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) sc->atrq.ndb = NDB; sc->atrs.ndb = NDB / 2; - sc->arrq.dummy = NULL; - sc->arrs.dummy = NULL; - sc->atrq.dummy = NULL; - sc->atrs.dummy = NULL; for( i = 0 ; i < sc->fc.nisodma ; i ++ ){ sc->fc.it[i] = &sc->it[i].xferq; sc->fc.ir[i] = &sc->ir[i].xferq; @@ -636,16 +639,16 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) } sc->fc.tcode = tinfo; + sc->fc.dev = dev; - sc->cromptr = (u_int32_t *) malloc(CROMSIZE * 2, M_FW, M_NOWAIT); - - if(sc->cromptr == NULL){ - device_printf(dev, "cromptr alloc failed."); + sc->fc.config_rom = fwdma_malloc(&sc->fc, CROMSIZE, CROMSIZE, + &sc->crom_dma, BUS_DMA_WAITOK); + if(sc->fc.config_rom == NULL){ + device_printf(dev, "config_rom alloc failed."); return ENOMEM; } - sc->fc.dev = dev; - sc->fc.config_rom = &(sc->cromptr[CROMSIZE/4]); +#if 1 sc->fc.config_rom[1] = 0x31333934; sc->fc.config_rom[2] = 0xf000a002; sc->fc.config_rom[3] = OREAD(sc, OHCI_EUID_HI); @@ -654,34 +657,39 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) sc->fc.config_rom[0] = (4 << 24) | (5 << 16); sc->fc.config_rom[0] |= fw_crc16(&sc->fc.config_rom[1], 5*4); +#endif /* SID recieve buffer must allign 2^11 */ #define OHCI_SIDSIZE (1 << 11) - sc->fc.sid_buf = (u_int32_t *) malloc(OHCI_SIDSIZE, M_FW, M_NOWAIT); - if (sc->fc.sid_buf == NULL) { - device_printf(dev, "sid_buf alloc failed.\n"); + sc->sid_buf = fwdma_malloc(&sc->fc, OHCI_SIDSIZE, OHCI_SIDSIZE, + &sc->sid_dma, BUS_DMA_WAITOK); + if (sc->sid_buf == NULL) { + device_printf(dev, "sid_buf alloc failed."); return ENOMEM; } - if (((vm_offset_t) sc->fc.sid_buf & (OHCI_SIDSIZE - 1)) != 0) { - device_printf(dev, "sid_buf(%p) not aligned.\n", - sc->fc.sid_buf); + + fwdma_malloc(&sc->fc, sizeof(u_int32_t), sizeof(u_int32_t), + &sc->dummy_dma, BUS_DMA_WAITOK); + + if (sc->dummy_dma.v_addr == NULL) { + device_printf(dev, "dummy_dma alloc failed."); return ENOMEM; } - - fwohci_db_init(&sc->arrq); + + fwohci_db_init(sc, &sc->arrq); if ((sc->arrq.flags & FWOHCI_DBCH_INIT) == 0) return ENOMEM; - fwohci_db_init(&sc->arrs); + fwohci_db_init(sc, &sc->arrs); if ((sc->arrs.flags & FWOHCI_DBCH_INIT) == 0) return ENOMEM; - fwohci_db_init(&sc->atrq); + fwohci_db_init(sc, &sc->atrq); if ((sc->atrq.flags & FWOHCI_DBCH_INIT) == 0) return ENOMEM; - fwohci_db_init(&sc->atrs); + fwohci_db_init(sc, &sc->atrs); if ((sc->atrs.flags & FWOHCI_DBCH_INIT) == 0) return ENOMEM; @@ -701,12 +709,18 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) sc->fc.itx_enable = fwohci_itxbuf_enable; sc->fc.itx_disable = fwohci_itx_disable; +#if BYTE_ORDER == BIG_ENDIAN sc->fc.irx_post = fwohci_irx_post; +#else + sc->fc.irx_post = NULL; +#endif sc->fc.itx_post = NULL; sc->fc.timeout = fwohci_timeout; sc->fc.poll = fwohci_poll; sc->fc.set_intr = fwohci_set_intr; + sc->intmask = sc->irstat = sc->itstat = 0; + fw_init(&sc->fc); fwohci_reset(sc, dev); @@ -733,10 +747,10 @@ fwohci_detach(struct fwohci_softc *sc, device_t dev) { int i; - if (sc->fc.sid_buf != NULL) - free((void *)(uintptr_t)sc->fc.sid_buf, M_FW); - if (sc->cromptr != NULL) - free((void *)sc->cromptr, M_FW); + if (sc->sid_buf != NULL) + fwdma_free(&sc->fc, &sc->sid_dma); + if (sc->fc.config_rom != NULL) + fwdma_free(&sc->fc, &sc->crom_dma); fwohci_db_free(&sc->arrq); fwohci_db_free(&sc->arrs); @@ -758,11 +772,43 @@ fwohci_detach(struct fwohci_softc *sc, device_t dev) db = &_dbtr->db[ (_cnt > 2) ? (_cnt -1) : 0]; \ } while (0) +static void +fwohci_execute_db(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + struct fwohcidb_tr *db_tr; + volatile struct fwohcidb *db; + bus_dma_segment_t *s; + int i; + + db_tr = (struct fwohcidb_tr *)arg; + db = &db_tr->db[db_tr->dbcnt]; + if (error) { + if (firewire_debug || error != EFBIG) + printf("fwohci_execute_db: error=%d\n", error); + return; + } + for (i = 0; i < nseg; i++) { + s = &segs[i]; + FWOHCI_DMA_WRITE(db->db.desc.addr, s->ds_addr); + FWOHCI_DMA_WRITE(db->db.desc.cmd, s->ds_len); + FWOHCI_DMA_WRITE(db->db.desc.res, 0); + db++; + db_tr->dbcnt++; + } +} + +static void +fwohci_execute_db2(void *arg, bus_dma_segment_t *segs, int nseg, + bus_size_t size, int error) +{ + fwohci_execute_db(arg, segs, nseg, error); +} + static void fwohci_start(struct fwohci_softc *sc, struct fwohci_dbch *dbch) { int i, s; - int tcode, hdr_len, hdr_off, len; + int tcode, hdr_len, pl_off, pl_len; int fsegment = -1; u_int32_t off; struct fw_xfer *xfer; @@ -770,7 +816,6 @@ fwohci_start(struct fwohci_softc *sc, struct fwohci_dbch *dbch) volatile struct fwohci_txpkthdr *ohcifp; struct fwohcidb_tr *db_tr; volatile struct fwohcidb *db; - struct mbuf *m; struct tcode_info *info; static int maxdesc=0; @@ -798,98 +843,96 @@ txloop: STAILQ_REMOVE_HEAD(&dbch->xferq.q, link); db_tr->xfer = xfer; xfer->state = FWXF_START; - dbch->xferq.packets++; - fp = (struct fw_pkt *)(xfer->send.buf + xfer->send.off); + fp = (struct fw_pkt *)xfer->send.buf; tcode = fp->mode.common.tcode; ohcifp = (volatile struct fwohci_txpkthdr *) db_tr->db[1].db.immed; info = &tinfo[tcode]; - hdr_len = hdr_off = info->hdr_len; - /* fw_asyreq must pass valid send.len */ - len = xfer->send.len; - for( i = 0 ; i < hdr_off ; i+= 4){ - ohcifp->mode.ld[i/4] = ntohl(fp->mode.ld[i/4]); - } - /* XXX payload must be network byte order */ - if (tcode == FWTCODE_WREQQ || tcode == FWTCODE_RRESQ) { - ohcifp->mode.ld[3] = htonl(ohcifp->mode.ld[3]); + hdr_len = pl_off = info->hdr_len; + for( i = 0 ; i < pl_off ; i+= 4){ + ohcifp->mode.ld[i/4] = fp->mode.ld[i/4]; } ohcifp->mode.common.spd = xfer->spd; if (tcode == FWTCODE_STREAM ){ hdr_len = 8; - ohcifp->mode.stream.len = ntohs(fp->mode.stream.len); + ohcifp->mode.stream.len = fp->mode.stream.len; } else if (tcode == FWTCODE_PHY) { hdr_len = 12; - ohcifp->mode.ld[1] = ntohl(fp->mode.ld[1]); - ohcifp->mode.ld[2] = ntohl(fp->mode.ld[2]); + ohcifp->mode.ld[1] = fp->mode.ld[1]; + ohcifp->mode.ld[2] = fp->mode.ld[2]; ohcifp->mode.common.spd = 0; ohcifp->mode.common.tcode = FWOHCITCODE_PHY; } else { - ohcifp->mode.asycomm.dst = ntohs(fp->mode.hdr.dst); + ohcifp->mode.asycomm.dst = fp->mode.hdr.dst; ohcifp->mode.asycomm.srcbus = OHCI_ASYSRCBUS; ohcifp->mode.asycomm.tlrt |= FWRETRY_X; } db = &db_tr->db[0]; - db->db.desc.control = OHCI_OUTPUT_MORE | OHCI_KEY_ST2; - db->db.desc.reqcount = hdr_len; - db->db.desc.status = 0; + FWOHCI_DMA_WRITE(db->db.desc.cmd, + OHCI_OUTPUT_MORE | OHCI_KEY_ST2 | hdr_len); + FWOHCI_DMA_WRITE(db->db.desc.res, 0); /* Specify bound timer of asy. responce */ if(&sc->atrs == dbch){ - db->db.desc.count - = (OREAD(sc, OHCI_CYCLETIMER) >> 12) + (1 << 13); + FWOHCI_DMA_WRITE(db->db.desc.res, + (OREAD(sc, OHCI_CYCLETIMER) >> 12) + (1 << 13)); } +#if BYTE_ORDER == BIG_ENDIAN + if (tcode == FWTCODE_WREQQ || tcode == FWTCODE_RRESQ) + hdr_len = 12; + for (i = 0; i < hdr_len/4; i ++) + FWOHCI_DMA_WRITE(ohcifp->mode.ld[i], ohcifp->mode.ld[i]); +#endif again: db_tr->dbcnt = 2; db = &db_tr->db[db_tr->dbcnt]; - if(len > hdr_off){ + pl_len = xfer->send.len - pl_off; + if (pl_len > 0) { + int err; + /* handle payload */ if (xfer->mbuf == NULL) { - db->db.desc.addr - = vtophys(xfer->send.buf + xfer->send.off) + hdr_off; - db->db.desc.control = OHCI_OUTPUT_MORE; - db->db.desc.reqcount = len - hdr_off; - db->db.desc.status = 0; + caddr_t pl_addr; - db_tr->dbcnt++; + pl_addr = xfer->send.buf + pl_off; + err = bus_dmamap_load(dbch->dmat, db_tr->dma_map, + pl_addr, pl_len, + fwohci_execute_db, db_tr, + /*flags*/0); } else { - int mchain=0; /* XXX we can handle only 6 (=8-2) mbuf chains */ - for (m = xfer->mbuf; m != NULL; m = m->m_next) { - if (m->m_len == 0) - /* unrecoverable error could occur. */ - continue; - mchain++; - if (db_tr->dbcnt >= dbch->ndesc) - continue; - db->db.desc.addr - = vtophys(mtod(m, caddr_t)); - db->db.desc.control = OHCI_OUTPUT_MORE; - db->db.desc.reqcount = m->m_len; - db->db.desc.status = 0; - db++; - db_tr->dbcnt++; - } - if (mchain > dbch->ndesc - 2) { - struct mbuf *m_new; - if (bootverbose) - device_printf(sc->fc.dev, - "too long mbuf chain(%d)\n", - mchain); - m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - if (m_new != NULL) { + err = bus_dmamap_load_mbuf(dbch->dmat, db_tr->dma_map, + xfer->mbuf, + fwohci_execute_db2, db_tr, + /* flags */0); + if (err == EFBIG) { + struct mbuf *m0; + + if (firewire_debug) + device_printf(sc->fc.dev, "EFBIG.\n"); + m0 = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m0 != NULL) { m_copydata(xfer->mbuf, 0, xfer->mbuf->m_pkthdr.len, - mtod(m_new, caddr_t)); - m_new->m_pkthdr.len = m_new->m_len = + mtod(m0, caddr_t)); + m0->m_len = m0->m_pkthdr.len = xfer->mbuf->m_pkthdr.len; m_freem(xfer->mbuf); - xfer->mbuf = m_new; + xfer->mbuf = m0; goto again; } device_printf(sc->fc.dev, "m_getcl failed.\n"); } } + if (err) + printf("dmamap_load: err=%d\n", err); + bus_dmamap_sync(dbch->dmat, db_tr->dma_map, + BUS_DMASYNC_PREWRITE); +#if 0 /* OHCI_OUTPUT_MODE == 0 */ + for (i = 2; i < db_tr->dbcnt; i++) + FWOHCI_DMA_SET(db_tr->db[i].db.desc.cmd, + OHCI_OUTPUT_MORE); +#endif } if (maxdesc < db_tr->dbcnt) { maxdesc = db_tr->dbcnt; @@ -898,16 +941,16 @@ again: } /* last db */ LAST_DB(db_tr, db); - db->db.desc.control |= OHCI_OUTPUT_LAST - | OHCI_INTERRUPT_ALWAYS - | OHCI_BRANCH_ALWAYS; - db->db.desc.depend = vtophys(STAILQ_NEXT(db_tr, link)->db); + FWOHCI_DMA_SET(db->db.desc.cmd, + OHCI_OUTPUT_LAST | OHCI_INTERRUPT_ALWAYS | OHCI_BRANCH_ALWAYS); + FWOHCI_DMA_WRITE(db->db.desc.depend, + STAILQ_NEXT(db_tr, link)->bus_addr); if(fsegment == -1 ) fsegment = db_tr->dbcnt; if (dbch->pdb_tr != NULL) { LAST_DB(dbch->pdb_tr, db); - db->db.desc.depend |= db_tr->dbcnt; + FWOHCI_DMA_SET(db->db.desc.depend, db_tr->dbcnt); } dbch->pdb_tr = db_tr; db_tr = STAILQ_NEXT(db_tr, link); @@ -919,6 +962,8 @@ again: } kick: /* kick asy q */ + fwdma_sync_multiseg_all(dbch->am, BUS_DMASYNC_PREREAD); + fwdma_sync_multiseg_all(dbch->am, BUS_DMASYNC_PREWRITE); if(dbch->xferq.flag & FWXFERQ_RUNNING) { OWRITE(sc, OHCI_DMACTL(off), OHCI_CNTL_DMA_WAKE); @@ -926,7 +971,7 @@ kick: if (bootverbose) device_printf(sc->fc.dev, "start AT DMA status=%x\n", OREAD(sc, OHCI_DMACTL(off))); - OWRITE(sc, OHCI_DMACMD(off), vtophys(dbch->top->db) | fsegment); + OWRITE(sc, OHCI_DMACMD(off), dbch->top->bus_addr | fsegment); OWRITE(sc, OHCI_DMACTL(off), OHCI_CNTL_DMA_RUN); dbch->xferq.flag |= FWXFERQ_RUNNING; } @@ -936,22 +981,6 @@ kick: return; } -static void -fwohci_drain_atq(struct firewire_comm *fc, struct fw_xfer *xfer) -{ - struct fwohci_softc *sc = (struct fwohci_softc *)fc; - fwohci_drain(&sc->fc, xfer, &(sc->atrq)); - return; -} - -static void -fwohci_drain_ats(struct firewire_comm *fc, struct fw_xfer *xfer) -{ - struct fwohci_softc *sc = (struct fwohci_softc *)fc; - fwohci_drain(&sc->fc, xfer, &(sc->atrs)); - return; -} - static void fwohci_start_atq(struct firewire_comm *fc) { @@ -971,44 +1000,52 @@ fwohci_start_ats(struct firewire_comm *fc) void fwohci_txd(struct fwohci_softc *sc, struct fwohci_dbch *dbch) { - int s, err = 0; + int s, ch, err = 0; struct fwohcidb_tr *tr; volatile struct fwohcidb *db; struct fw_xfer *xfer; u_int32_t off; - u_int stat; + u_int stat, status; int packets; struct firewire_comm *fc = (struct firewire_comm *)sc; + if(&sc->atrq == dbch){ off = OHCI_ATQOFF; + ch = ATRQ_CH; }else if(&sc->atrs == dbch){ off = OHCI_ATSOFF; + ch = ATRS_CH; }else{ return; } s = splfw(); tr = dbch->bottom; packets = 0; + fwdma_sync_multiseg_all(dbch->am, BUS_DMASYNC_POSTREAD); + fwdma_sync_multiseg_all(dbch->am, BUS_DMASYNC_POSTWRITE); while(dbch->xferq.queued > 0){ LAST_DB(tr, db); - if(!(db->db.desc.status & OHCI_CNTL_DMA_ACTIVE)){ + status = FWOHCI_DMA_READ(db->db.desc.res) >> OHCI_STATUS_SHIFT; + if(!(status & OHCI_CNTL_DMA_ACTIVE)){ if (fc->status != FWBUSRESET) /* maybe out of order?? */ goto out; } - if(db->db.desc.status & OHCI_CNTL_DMA_DEAD) { -#ifdef OHCI_DEBUG - dump_dma(sc, ch); - dump_db(sc, ch); + bus_dmamap_sync(dbch->dmat, tr->dma_map, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(dbch->dmat, tr->dma_map); +#if 0 + dump_db(sc, ch); #endif -/* Stop DMA */ + if(status & OHCI_CNTL_DMA_DEAD) { + /* Stop DMA */ OWRITE(sc, OHCI_DMACTLCLR(off), OHCI_CNTL_DMA_RUN); device_printf(sc->fc.dev, "force reset AT FIFO\n"); OWRITE(sc, OHCI_HCCCTLCLR, OHCI_HCC_LINKEN); OWRITE(sc, OHCI_HCCCTL, OHCI_HCC_LPS | OHCI_HCC_LINKEN); OWRITE(sc, OHCI_DMACTLCLR(off), OHCI_CNTL_DMA_RUN); } - stat = db->db.desc.status & FWOHCIEV_MASK; + stat = status & FWOHCIEV_MASK; switch(stat){ case FWOHCIEV_ACKPEND: case FWOHCIEV_ACKCOMPL: @@ -1043,36 +1080,32 @@ fwohci_txd(struct fwohci_softc *sc, struct fwohci_dbch *dbch) } if (tr->xfer != NULL) { xfer = tr->xfer; + if (xfer->state == FWXF_RCVD) { + if (firewire_debug) + printf("already rcvd\n"); + fw_xfer_done(xfer); + } else { xfer->state = FWXF_SENT; if (err == EBUSY && fc->status != FWBUSRESET) { xfer->state = FWXF_BUSY; - switch (xfer->act_type) { - case FWACT_XFER: - xfer->resp = err; - if (xfer->retry_req != NULL) - xfer->retry_req(xfer); - else - fw_xfer_done(xfer); - break; - default: - break; - } + xfer->resp = err; + if (xfer->retry_req != NULL) + xfer->retry_req(xfer); + else + fw_xfer_done(xfer); } else if (stat != FWOHCIEV_ACKPEND) { if (stat != FWOHCIEV_ACKCOMPL) xfer->state = FWXF_SENTERR; xfer->resp = err; - switch (xfer->act_type) { - case FWACT_XFER: - fw_xfer_done(xfer); - break; - default: - break; - } + fw_xfer_done(xfer); + } } /* * The watchdog timer takes care of split * transcation timeout for ACKPEND case. */ + } else { + printf("this shouldn't happen\n"); } dbch->xferq.queued --; tr->xfer = NULL; @@ -1096,118 +1129,89 @@ out: splx(s); } -static void -fwohci_drain(struct firewire_comm *fc, struct fw_xfer *xfer, struct fwohci_dbch *dbch) -{ - int i, s, found=0; - struct fwohcidb_tr *tr; - - if(xfer->state != FWXF_START) return; - - s = splfw(); - tr = dbch->bottom; - for (i = 0; i < dbch->xferq.queued; i ++) { - if(tr->xfer == xfer){ - tr->xfer = NULL; -#if 0 - dbch->xferq.queued --; - /* XXX */ - if (tr == dbch->bottom) - dbch->bottom = STAILQ_NEXT(tr, link); - if (dbch->flags & FWOHCI_DBCH_FULL) { - printf("fwohci_drain: make slot\n"); - dbch->flags &= ~FWOHCI_DBCH_FULL; - fwohci_start((struct fwohci_softc *)fc, dbch); - } -#endif - found ++; - break; - } - tr = STAILQ_NEXT(tr, link); - } - splx(s); - if (!found) - device_printf(fc->dev, "fwochi_drain: xfer not found\n"); - return; -} - static void fwohci_db_free(struct fwohci_dbch *dbch) { struct fwohcidb_tr *db_tr; - int idb, i; + int idb; if ((dbch->flags & FWOHCI_DBCH_INIT) == 0) return; - if(!(dbch->xferq.flag & FWXFERQ_EXTBUF)){ - for(db_tr = STAILQ_FIRST(&dbch->db_trq), idb = 0; - idb < dbch->ndb; + for(db_tr = STAILQ_FIRST(&dbch->db_trq), idb = 0; idb < dbch->ndb; db_tr = STAILQ_NEXT(db_tr, link), idb++){ - if (db_tr->buf != NULL) { - free(db_tr->buf, M_FW); - db_tr->buf = NULL; - } - } + if ((dbch->xferq.flag & FWXFERQ_EXTBUF) == 0 && + db_tr->buf != NULL) { + fwdma_free_size(dbch->dmat, db_tr->dma_map, + db_tr->buf, dbch->xferq.psize); + db_tr->buf = NULL; + } else if (db_tr->dma_map != NULL) + bus_dmamap_destroy(dbch->dmat, db_tr->dma_map); } dbch->ndb = 0; db_tr = STAILQ_FIRST(&dbch->db_trq); - for (i = 0; i < dbch->npages; i++) - free(dbch->pages[i], M_FW); + fwdma_free_multiseg(dbch->am); free(db_tr, M_FW); STAILQ_INIT(&dbch->db_trq); dbch->flags &= ~FWOHCI_DBCH_INIT; } static void -fwohci_db_init(struct fwohci_dbch *dbch) +fwohci_db_init(struct fwohci_softc *sc, struct fwohci_dbch *dbch) { int idb; struct fwohcidb_tr *db_tr; - int ndbpp, i, j; if ((dbch->flags & FWOHCI_DBCH_INIT) != 0) goto out; + /* create dma_tag for buffers */ +#define MAX_REQCOUNT 0xffff + if (bus_dma_tag_create(/*parent*/ sc->fc.dmat, + /*alignment*/ 1, /*boundary*/ 0, + /*lowaddr*/ BUS_SPACE_MAXADDR_32BIT, + /*highaddr*/ BUS_SPACE_MAXADDR, + /*filter*/NULL, /*filterarg*/NULL, + /*maxsize*/ dbch->xferq.psize, + /*nsegments*/ dbch->ndesc > 3 ? dbch->ndesc - 2 : 1, + /*maxsegsz*/ MAX_REQCOUNT, + /*flags*/ 0, &dbch->dmat)) + return; + /* allocate DB entries and attach one to each DMA channels */ /* DB entry must start at 16 bytes bounary. */ STAILQ_INIT(&dbch->db_trq); db_tr = (struct fwohcidb_tr *) malloc(sizeof(struct fwohcidb_tr) * dbch->ndb, - M_FW, M_ZERO); + M_FW, M_WAITOK | M_ZERO); if(db_tr == NULL){ printf("fwohci_db_init: malloc(1) failed\n"); return; } - ndbpp = PAGE_SIZE / (sizeof(struct fwohcidb) * dbch->ndesc); - dbch->npages = (dbch->ndb + ndbpp - 1)/ ndbpp; - if (firewire_debug) - printf("ndesc: %d, ndbpp: %d, ndb: %d, npages: %d\n", - dbch->ndesc, ndbpp, dbch->ndb, dbch->npages); - if (dbch->npages > FWOHCI_DBCH_MAX_PAGES) { - printf("npages(%d) > DBCH_MAX_PAGES(%d)\n", - dbch->npages, FWOHCI_DBCH_MAX_PAGES); +#define DB_SIZE(x) (sizeof(struct fwohcidb) * (x)->ndesc) + dbch->am = fwdma_malloc_multiseg(&sc->fc, DB_SIZE(dbch), + DB_SIZE(dbch), dbch->ndb, BUS_DMA_WAITOK); + if (dbch->am == NULL) { + printf("fwohci_db_init: fwdma_malloc_multiseg failed\n"); return; } - for (i = 0; i < dbch->npages; i++) { - dbch->pages[i] = malloc(PAGE_SIZE, M_FW, M_ZERO); - if (dbch->pages[i] == NULL) { - printf("fwohci_db_init: malloc(2) failed\n"); - for (j = 0; j < i; j ++) - free(dbch->pages[j], M_FW); - free(db_tr, M_FW); - return; - } - } /* Attach DB to DMA ch. */ for(idb = 0 ; idb < dbch->ndb ; idb++){ db_tr->dbcnt = 0; - db_tr->db = (struct fwohcidb *)dbch->pages[idb/ndbpp] - + dbch->ndesc * (idb % ndbpp); + db_tr->db = (struct fwohcidb *)fwdma_v_addr(dbch->am, idb); + db_tr->bus_addr = fwdma_bus_addr(dbch->am, idb); + /* create dmamap for buffers */ + /* XXX do we need 4bytes alignment tag? */ + /* XXX don't alloc dma_map for AR */ + if (bus_dmamap_create(dbch->dmat, 0, &db_tr->dma_map) != 0) { + printf("bus_dmamap_create failed\n"); + dbch->flags = FWOHCI_DBCH_INIT; /* XXX fake */ + fwohci_db_free(dbch); + return; + } STAILQ_INSERT_TAIL(&dbch->db_trq, db_tr, link); - if (!(dbch->xferq.flag & FWXFERQ_PACKET) && - dbch->xferq.bnpacket != 0) { + if (dbch->xferq.flag & FWXFERQ_EXTBUF) { if (idb % dbch->xferq.bnpacket == 0) dbch->xferq.bulkxfer[idb / dbch->xferq.bnpacket ].start = (caddr_t)db_tr; @@ -1220,9 +1224,6 @@ fwohci_db_init(struct fwohci_dbch *dbch) STAILQ_LAST(&dbch->db_trq, fwohcidb_tr,link)->link.stqe_next = STAILQ_FIRST(&dbch->db_trq); out: - dbch->frag.buf = NULL; - dbch->frag.len = 0; - dbch->frag.plen = 0; dbch->xferq.queued = 0; dbch->pdb_tr = NULL; dbch->top = STAILQ_FIRST(&dbch->db_trq); @@ -1234,13 +1235,14 @@ static int fwohci_itx_disable(struct firewire_comm *fc, int dmach) { struct fwohci_softc *sc = (struct fwohci_softc *)fc; - int dummy; + int sleepch; - OWRITE(sc, OHCI_ITCTLCLR(dmach), OHCI_CNTL_DMA_RUN); + OWRITE(sc, OHCI_ITCTLCLR(dmach), + OHCI_CNTL_DMA_RUN | OHCI_CNTL_CYCMATCH_S); OWRITE(sc, OHCI_IT_MASKCLR, 1 << dmach); OWRITE(sc, OHCI_IT_STATCLR, 1 << dmach); /* XXX we cannot free buffers until the DMA really stops */ - tsleep((void *)&dummy, FWPRI, "fwitxd", hz); + tsleep((void *)&sleepch, FWPRI, "fwitxd", hz); fwohci_db_free(&sc->it[dmach]); sc->it[dmach].xferq.flag &= ~FWXFERQ_RUNNING; return 0; @@ -1250,81 +1252,32 @@ static int fwohci_irx_disable(struct firewire_comm *fc, int dmach) { struct fwohci_softc *sc = (struct fwohci_softc *)fc; - int dummy; + int sleepch; OWRITE(sc, OHCI_IRCTLCLR(dmach), OHCI_CNTL_DMA_RUN); OWRITE(sc, OHCI_IR_MASKCLR, 1 << dmach); OWRITE(sc, OHCI_IR_STATCLR, 1 << dmach); /* XXX we cannot free buffers until the DMA really stops */ - tsleep((void *)&dummy, FWPRI, "fwirxd", hz); - if(sc->ir[dmach].dummy != NULL){ - free(sc->ir[dmach].dummy, M_FW); - } - sc->ir[dmach].dummy = NULL; + tsleep((void *)&sleepch, FWPRI, "fwirxd", hz); fwohci_db_free(&sc->ir[dmach]); sc->ir[dmach].xferq.flag &= ~FWXFERQ_RUNNING; return 0; } +#if BYTE_ORDER == BIG_ENDIAN static void fwohci_irx_post (struct firewire_comm *fc , u_int32_t *qld) { - qld[0] = ntohl(qld[0]); + qld[0] = FWOHCI_DMA_READ(qld[0]); return; } - -static int -fwohci_irxpp_enable(struct firewire_comm *fc, int dmach) -{ - struct fwohci_softc *sc = (struct fwohci_softc *)fc; - int err = 0; - unsigned short tag, ich; - - tag = (sc->ir[dmach].xferq.flag >> 6) & 3; - ich = sc->ir[dmach].xferq.flag & 0x3f; - -#if 0 - if(STAILQ_FIRST(&fc->ir[dmach]->q) != NULL){ - wakeup(fc->ir[dmach]); - return err; - } #endif - OWRITE(sc, OHCI_IRMATCH(dmach), tagbit[tag] | ich); - if(!(sc->ir[dmach].xferq.flag & FWXFERQ_RUNNING)){ - sc->ir[dmach].xferq.queued = 0; - sc->ir[dmach].ndb = NDB; - sc->ir[dmach].xferq.psize = PAGE_SIZE; - sc->ir[dmach].ndesc = 1; - fwohci_db_init(&sc->ir[dmach]); - if ((sc->ir[dmach].flags & FWOHCI_DBCH_INIT) == 0) - return ENOMEM; - err = fwohci_rx_enable(sc, &sc->ir[dmach]); - } - if(err){ - device_printf(sc->fc.dev, "err in IRX setting\n"); - return err; - } - if(!(OREAD(sc, OHCI_IRCTL(dmach)) & OHCI_CNTL_DMA_ACTIVE)){ - OWRITE(sc, OHCI_IRCTLCLR(dmach), OHCI_CNTL_DMA_RUN); - OWRITE(sc, OHCI_IR_MASKCLR, 1 << dmach); - OWRITE(sc, OHCI_IR_STATCLR, 1 << dmach); - OWRITE(sc, OHCI_IR_MASK, 1 << dmach); - OWRITE(sc, OHCI_IRCTLCLR(dmach), 0xf8000000); - OWRITE(sc, OHCI_IRCTL(dmach), OHCI_CNTL_ISOHDR); - OWRITE(sc, OHCI_IRCMD(dmach), - vtophys(sc->ir[dmach].top->db) | 1); - OWRITE(sc, OHCI_IRCTL(dmach), OHCI_CNTL_DMA_RUN); - OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_DMA_IR); - } - return err; -} - static int fwohci_tx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch) { int err = 0; - int idb, z, i, dmach = 0; + int idb, z, i, dmach = 0, ldesc; u_int32_t off = NULL; struct fwohcidb_tr *db_tr; volatile struct fwohcidb *db; @@ -1351,31 +1304,31 @@ fwohci_tx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch) dbch->bottom = STAILQ_NEXT(dbch->bottom, link); } db_tr = dbch->top; - for( idb = 0 ; idb < dbch->ndb ; idb ++){ - fwohci_add_tx_buf(db_tr, - dbch->xferq.psize, dbch->xferq.flag, - dbch->xferq.buf + dbch->xferq.psize * idb); + for (idb = 0; idb < dbch->ndb; idb ++) { + fwohci_add_tx_buf(dbch, db_tr, idb); if(STAILQ_NEXT(db_tr, link) == NULL){ break; } db = db_tr->db; - db[0].db.desc.depend = db[db_tr->dbcnt - 1].db.desc.depend - = vtophys(STAILQ_NEXT(db_tr, link)->db) | z; + ldesc = db_tr->dbcnt - 1; + FWOHCI_DMA_WRITE(db[0].db.desc.depend, + STAILQ_NEXT(db_tr, link)->bus_addr | z); + db[ldesc].db.desc.depend = db[0].db.desc.depend; if(dbch->xferq.flag & FWXFERQ_EXTBUF){ if(((idb + 1 ) % dbch->xferq.bnpacket) == 0){ - db[db_tr->dbcnt - 1].db.desc.control - |= OHCI_INTERRUPT_ALWAYS; + FWOHCI_DMA_SET( + db[ldesc].db.desc.cmd, + OHCI_INTERRUPT_ALWAYS); /* OHCI 1.1 and above */ - db[0].db.desc.control |= OHCI_INTERRUPT_ALWAYS; -#if 0 - db[0].db.desc.depend &= ~0xf; - db[db_tr->dbcnt - 1].db.desc.depend &= ~0xf; -#endif + FWOHCI_DMA_SET( + db[0].db.desc.cmd, + OHCI_INTERRUPT_ALWAYS); } } db_tr = STAILQ_NEXT(db_tr, link); } - dbch->bottom->db[db_tr->dbcnt - 1].db.desc.depend &= 0xfffffff0; + FWOHCI_DMA_CLEAR( + dbch->bottom->db[dbch->bottom->dbcnt - 1].db.desc.depend, 0xf); return err; } @@ -1420,61 +1373,59 @@ fwohci_rx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch) dbch->bottom = STAILQ_NEXT(dbch->bottom, link); } db_tr = dbch->top; - for( idb = 0 ; idb < dbch->ndb ; idb ++){ - if(!(dbch->xferq.flag & FWXFERQ_EXTBUF)){ - fwohci_add_rx_buf(db_tr, - dbch->xferq.psize, dbch->xferq.flag, 0, NULL); - }else{ - fwohci_add_rx_buf(db_tr, - dbch->xferq.psize, dbch->xferq.flag, - dbch->xferq.bulkxfer[idb - / dbch->xferq.bnpacket].buf - + dbch->xferq.psize * - (idb % dbch->xferq.bnpacket), - dbch->dummy + sizeof(u_int32_t) * idb); - } - if(STAILQ_NEXT(db_tr, link) == NULL){ + for (idb = 0; idb < dbch->ndb; idb ++) { + fwohci_add_rx_buf(dbch, db_tr, idb, &sc->dummy_dma); + if (STAILQ_NEXT(db_tr, link) == NULL) break; - } db = db_tr->db; ldesc = db_tr->dbcnt - 1; - db[ldesc].db.desc.depend - = vtophys(STAILQ_NEXT(db_tr, link)->db) | z; + FWOHCI_DMA_WRITE(db[ldesc].db.desc.depend, + STAILQ_NEXT(db_tr, link)->bus_addr | z); if(dbch->xferq.flag & FWXFERQ_EXTBUF){ if(((idb + 1 ) % dbch->xferq.bnpacket) == 0){ - db[ldesc].db.desc.control - |= OHCI_INTERRUPT_ALWAYS; - db[ldesc].db.desc.depend &= ~0xf; + FWOHCI_DMA_SET( + db[ldesc].db.desc.cmd, + OHCI_INTERRUPT_ALWAYS); + FWOHCI_DMA_CLEAR( + db[ldesc].db.desc.depend, + 0xf); } } db_tr = STAILQ_NEXT(db_tr, link); } - dbch->bottom->db[db_tr->dbcnt - 1].db.desc.depend &= 0xfffffff0; + FWOHCI_DMA_CLEAR( + dbch->bottom->db[db_tr->dbcnt - 1].db.desc.depend, 0xf); dbch->buf_offset = 0; + fwdma_sync_multiseg_all(dbch->am, BUS_DMASYNC_PREREAD); + fwdma_sync_multiseg_all(dbch->am, BUS_DMASYNC_PREWRITE); if(dbch->xferq.flag & FWXFERQ_STREAM){ return err; }else{ - OWRITE(sc, OHCI_DMACMD(off), vtophys(dbch->top->db) | z); + OWRITE(sc, OHCI_DMACMD(off), dbch->top->bus_addr | z); } OWRITE(sc, OHCI_DMACTL(off), OHCI_CNTL_DMA_RUN); return err; } static int -fwochi_next_cycle(struct firewire_comm *fc, int cycle_now) +fwohci_next_cycle(struct firewire_comm *fc, int cycle_now) { int sec, cycle, cycle_match; cycle = cycle_now & 0x1fff; sec = cycle_now >> 13; #define CYCLE_MOD 0x10 +#if 1 #define CYCLE_DELAY 8 /* min delay to start DMA */ +#else +#define CYCLE_DELAY 7000 /* min delay to start DMA */ +#endif cycle = cycle + CYCLE_DELAY; if (cycle >= 8000) { sec ++; cycle -= 8000; } - cycle = ((cycle + CYCLE_MOD - 1) / CYCLE_MOD) * CYCLE_MOD; + cycle = roundup2(cycle, CYCLE_MOD); if (cycle >= 8000) { sec ++; if (cycle == 8000) @@ -1507,7 +1458,7 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach) if ((dbch->flags & FWOHCI_DBCH_INIT) == 0) { dbch->ndb = it->bnpacket * it->bnchunk; dbch->ndesc = 3; - fwohci_db_init(dbch); + fwohci_db_init(sc, dbch); if ((dbch->flags & FWOHCI_DBCH_INIT) == 0) return ENOMEM; err = fwohci_tx_enable(sc, dbch); @@ -1521,94 +1472,99 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach) while ((chunk = STAILQ_FIRST(&it->stvalid)) != NULL) { volatile struct fwohcidb *db; + fwdma_sync_multiseg(it->buf, chunk->poffset, it->bnpacket, + BUS_DMASYNC_PREWRITE); fwohci_txbufdb(sc, dmach, chunk); -#if 0 - db = ((struct fwohcidb_tr *)(chunk->end))->db; - db[ldesc].db.desc.status = db[0].db.desc.status = 0; - db[ldesc].db.desc.count = db[0].db.desc.count = 0; - db[ldesc].db.desc.depend &= ~0xf; - db[0].db.desc.depend &= ~0xf; -#endif if (prev != NULL) { db = ((struct fwohcidb_tr *)(prev->end))->db; - db[ldesc].db.desc.control |= OHCI_BRANCH_ALWAYS; +#if 0 /* XXX necessary? */ + FWOHCI_DMA_SET(db[ldesc].db.desc.cmd, + OHCI_BRANCH_ALWAYS); +#endif #if 0 /* if bulkxfer->npacket changes */ db[ldesc].db.desc.depend = db[0].db.desc.depend = - vtophys(((struct fwohcidb_tr *) - (chunk->start))->db) | dbch->ndesc; + ((struct fwohcidb_tr *) + (chunk->start))->bus_addr | dbch->ndesc; #else - db[0].db.desc.depend |= dbch->ndesc; - db[ldesc].db.desc.depend |= dbch->ndesc; + FWOHCI_DMA_SET(db[0].db.desc.depend, dbch->ndesc); + FWOHCI_DMA_SET(db[ldesc].db.desc.depend, dbch->ndesc); #endif } STAILQ_REMOVE_HEAD(&it->stvalid, link); STAILQ_INSERT_TAIL(&it->stdma, chunk, link); prev = chunk; } + fwdma_sync_multiseg_all(dbch->am, BUS_DMASYNC_PREWRITE); + fwdma_sync_multiseg_all(dbch->am, BUS_DMASYNC_PREREAD); splx(s); stat = OREAD(sc, OHCI_ITCTL(dmach)); + if (firewire_debug && (stat & OHCI_CNTL_CYCMATCH_S)) + printf("stat 0x%x\n", stat); + if (stat & (OHCI_CNTL_DMA_ACTIVE | OHCI_CNTL_CYCMATCH_S)) return 0; +#if 0 OWRITE(sc, OHCI_ITCTLCLR(dmach), OHCI_CNTL_DMA_RUN); +#endif OWRITE(sc, OHCI_IT_MASKCLR, 1 << dmach); OWRITE(sc, OHCI_IT_STATCLR, 1 << dmach); OWRITE(sc, OHCI_IT_MASK, 1 << dmach); + OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_DMA_IT); first = STAILQ_FIRST(&it->stdma); - OWRITE(sc, OHCI_ITCMD(dmach), vtophys(((struct fwohcidb_tr *) - (first->start))->db) | dbch->ndesc); - if (firewire_debug) + OWRITE(sc, OHCI_ITCMD(dmach), + ((struct fwohcidb_tr *)(first->start))->bus_addr | dbch->ndesc); + if (firewire_debug) { printf("fwohci_itxbuf_enable: kick 0x%08x\n", stat); +#if 1 + dump_dma(sc, ITX_CH + dmach); +#endif + } if ((stat & OHCI_CNTL_DMA_RUN) == 0) { #if 1 /* Don't start until all chunks are buffered */ if (STAILQ_FIRST(&it->stfree) != NULL) goto out; #endif -#ifdef FWXFERQ_DV -#define CYCLE_OFFSET 1 - if(dbch->xferq.flag & FWXFERQ_DV){ - struct fw_pkt *fp; - struct fwohcidb_tr *db_tr; - - db_tr = (struct fwohcidb_tr *)dbch->xferq.stdma->start; - fp = (struct fw_pkt *)db_tr->buf; - dbch->xferq.dvoffset = CYCLE_OFFSET; - fp->mode.ld[2] |= htonl(dbch->xferq.dvoffset << 12); - } -#endif +#if 1 /* Clear cycle match counter bits */ OWRITE(sc, OHCI_ITCTLCLR(dmach), 0xffff0000); - OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_DMA_IT); /* 2bit second + 13bit cycle */ cycle_now = (fc->cyctimer(fc) >> 12) & 0x7fff; - cycle_match = fwochi_next_cycle(fc, cycle_now); + cycle_match = fwohci_next_cycle(fc, cycle_now); OWRITE(sc, OHCI_ITCTL(dmach), OHCI_CNTL_CYCMATCH_S | (cycle_match << 16) | OHCI_CNTL_DMA_RUN); - if (firewire_debug) +#else + OWRITE(sc, OHCI_ITCTL(dmach), OHCI_CNTL_DMA_RUN); +#endif + if (firewire_debug) { printf("cycle_match: 0x%04x->0x%04x\n", cycle_now, cycle_match); + dump_dma(sc, ITX_CH + dmach); + dump_db(sc, ITX_CH + dmach); + } } else if ((stat & OHCI_CNTL_CYCMATCH_S) == 0) { device_printf(sc->fc.dev, "IT DMA underrun (0x%08x)\n", stat); - OWRITE(sc, OHCI_ITCTL(dmach), OHCI_CNTL_DMA_RUN); + OWRITE(sc, OHCI_ITCTL(dmach), OHCI_CNTL_DMA_WAKE); } out: return err; } static int -fwohci_irxbuf_enable(struct firewire_comm *fc, int dmach) +fwohci_irx_enable(struct firewire_comm *fc, int dmach) { struct fwohci_softc *sc = (struct fwohci_softc *)fc; int err = 0, s, ldesc; unsigned short tag, ich; u_int32_t stat; struct fwohci_dbch *dbch; + struct fwohcidb_tr *db_tr; struct fw_bulkxfer *first, *prev, *chunk; struct fw_xferq *ir; @@ -1622,14 +1578,8 @@ fwohci_irxbuf_enable(struct firewire_comm *fc, int dmach) ir->queued = 0; dbch->ndb = ir->bnpacket * ir->bnchunk; - dbch->dummy = malloc(sizeof(u_int32_t) * dbch->ndb, - M_FW, 0); - if (dbch->dummy == NULL) { - err = ENOMEM; - return err; - } dbch->ndesc = 2; - fwohci_db_init(dbch); + fwohci_db_init(sc, dbch); if ((dbch->flags & FWOHCI_DBCH_INIT) == 0) return ENOMEM; err = fwohci_rx_enable(sc, dbch); @@ -1650,26 +1600,30 @@ fwohci_irxbuf_enable(struct firewire_comm *fc, int dmach) volatile struct fwohcidb *db; #if 1 /* XXX for if_fwe */ - db = ((struct fwohcidb_tr *)(chunk->start))->db; - db[ldesc].db.desc.addr = vtophys(chunk->buf); + if (chunk->mbuf != NULL) { + db_tr = (struct fwohcidb_tr *)(chunk->start); + db_tr->dbcnt = 1; + err = bus_dmamap_load_mbuf(dbch->dmat, db_tr->dma_map, + chunk->mbuf, fwohci_execute_db2, db_tr, + /* flags */0); + FWOHCI_DMA_SET(db_tr->db[1].db.desc.cmd, + OHCI_UPDATE | OHCI_INPUT_LAST | + OHCI_INTERRUPT_ALWAYS | OHCI_BRANCH_ALWAYS); + } #endif db = ((struct fwohcidb_tr *)(chunk->end))->db; - db[ldesc].db.desc.status = db[ldesc].db.desc.count = 0; - db[ldesc].db.desc.depend &= ~0xf; + FWOHCI_DMA_WRITE(db[ldesc].db.desc.res, 0); + FWOHCI_DMA_CLEAR(db[ldesc].db.desc.depend, 0xf); if (prev != NULL) { db = ((struct fwohcidb_tr *)(prev->end))->db; -#if 0 - db[ldesc].db.desc.depend = - vtophys(((struct fwohcidb_tr *) - (chunk->start))->db) | dbch->ndesc; -#else - db[ldesc].db.desc.depend |= dbch->ndesc; -#endif + FWOHCI_DMA_SET(db[ldesc].db.desc.depend, dbch->ndesc); } STAILQ_REMOVE_HEAD(&ir->stfree, link); STAILQ_INSERT_TAIL(&ir->stdma, chunk, link); prev = chunk; } + fwdma_sync_multiseg_all(dbch->am, BUS_DMASYNC_PREWRITE); + fwdma_sync_multiseg_all(dbch->am, BUS_DMASYNC_PREREAD); splx(s); stat = OREAD(sc, OHCI_IRCTL(dmach)); if (stat & OHCI_CNTL_DMA_ACTIVE) @@ -1679,34 +1633,24 @@ fwohci_irxbuf_enable(struct firewire_comm *fc, int dmach) device_printf(sc->fc.dev, "IR DMA overrun (0x%08x)\n", stat); } + if (firewire_debug) + printf("start IR DMA 0x%x\n", stat); OWRITE(sc, OHCI_IR_MASKCLR, 1 << dmach); OWRITE(sc, OHCI_IR_STATCLR, 1 << dmach); OWRITE(sc, OHCI_IR_MASK, 1 << dmach); OWRITE(sc, OHCI_IRCTLCLR(dmach), 0xf0000000); OWRITE(sc, OHCI_IRCTL(dmach), OHCI_CNTL_ISOHDR); OWRITE(sc, OHCI_IRCMD(dmach), - vtophys(((struct fwohcidb_tr *)(first->start))->db) + ((struct fwohcidb_tr *)(first->start))->bus_addr | dbch->ndesc); OWRITE(sc, OHCI_IRCTL(dmach), OHCI_CNTL_DMA_RUN); OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_DMA_IR); +#if 0 + dump_db(sc, IRX_CH + dmach); +#endif return err; } -static int -fwohci_irx_enable(struct firewire_comm *fc, int dmach) -{ - struct fwohci_softc *sc = (struct fwohci_softc *)fc; - int err = 0; - - if(sc->ir[dmach].xferq.flag & FWXFERQ_PACKET){ - err = fwohci_irxpp_enable(fc, dmach); - return err; - }else{ - err = fwohci_irxbuf_enable(fc, dmach); - return err; - } -} - int fwohci_stop(struct fwohci_softc *sc, device_t dev) { @@ -1820,8 +1764,12 @@ busresetout: #ifndef ACK_ALL OWRITE(sc, FWOHCI_INTSTATCLR, OHCI_INT_DMA_IR); #endif - irstat = OREAD(sc, OHCI_IR_STAT); - OWRITE(sc, OHCI_IR_STATCLR, irstat); +#if __FreeBSD_version >= 500000 + irstat = atomic_readandclear_int(&sc->irstat); +#else + irstat = sc->irstat; + sc->irstat = 0; +#endif for(i = 0; i < fc->nisodma ; i++){ struct fwohci_dbch *dbch; @@ -1832,11 +1780,7 @@ busresetout: "dma(%d) not active\n", i); continue; } - if (dbch->xferq.flag & FWXFERQ_PACKET) { - fwohci_ircv(sc, dbch, count); - } else { - fwohci_rbuf_update(sc, i); - } + fwohci_rbuf_update(sc, i); } } } @@ -1844,8 +1788,12 @@ busresetout: #ifndef ACK_ALL OWRITE(sc, FWOHCI_INTSTATCLR, OHCI_INT_DMA_IT); #endif - itstat = OREAD(sc, OHCI_IT_STAT); - OWRITE(sc, OHCI_IT_STATCLR, itstat); +#if __FreeBSD_version >= 500000 + itstat = atomic_readandclear_int(&sc->itstat); +#else + itstat = sc->itstat; + sc->itstat = 0; +#endif for(i = 0; i < fc->nisodma ; i++){ if((itstat & (1 << i)) != 0){ fwohci_tbuf_update(sc, i); @@ -1873,7 +1821,7 @@ busresetout: fwohci_arcv(sc, &sc->arrq, count); } if(stat & OHCI_INT_PHY_SID){ - caddr_t buf; + u_int32_t *buf, node_id; int plen; #ifndef ACK_ALL @@ -1893,32 +1841,43 @@ busresetout: ** Checking whether the node is root or not. If root, turn on ** cycle master. */ - device_printf(fc->dev, "node_id = 0x%08x, ", OREAD(sc, FWOHCI_NODEID)); - if(!(OREAD(sc, FWOHCI_NODEID) & OHCI_NODE_VALID)){ + node_id = OREAD(sc, FWOHCI_NODEID); + plen = OREAD(sc, OHCI_SID_CNT); + + device_printf(fc->dev, "node_id=0x%08x, gen=%d, ", + node_id, (plen >> 16) & 0xff); + if (!(node_id & OHCI_NODE_VALID)) { printf("Bus reset failure\n"); goto sidout; } - if( OREAD(sc, FWOHCI_NODEID) & OHCI_NODE_ROOT ){ + if (node_id & OHCI_NODE_ROOT) { printf("CYCLEMASTER mode\n"); OWRITE(sc, OHCI_LNKCTL, OHCI_CNTL_CYCMTR | OHCI_CNTL_CYCTIMER); - }else{ + } else { printf("non CYCLEMASTER mode\n"); OWRITE(sc, OHCI_LNKCTLCLR, OHCI_CNTL_CYCMTR); OWRITE(sc, OHCI_LNKCTL, OHCI_CNTL_CYCTIMER); } - fc->nodeid = OREAD(sc, FWOHCI_NODEID) & 0x3f; + fc->nodeid = node_id & 0x3f; - plen = OREAD(sc, OHCI_SID_CNT) & OHCI_SID_CNT_MASK; + if (plen & OHCI_SID_ERR) { + device_printf(fc->dev, "SID Error\n"); + goto sidout; + } + plen &= OHCI_SID_CNT_MASK; if (plen < 4 || plen > OHCI_SIDSIZE) { device_printf(fc->dev, "invalid SID len = %d\n", plen); goto sidout; } plen -= 4; /* chop control info */ - buf = malloc(OHCI_SIDSIZE, M_FW, M_NOWAIT); - if(buf == NULL) goto sidout; - bcopy((void *)(uintptr_t)(volatile void *)(fc->sid_buf + 1), - buf, plen); + buf = (u_int32_t *)malloc(OHCI_SIDSIZE, M_FW, M_NOWAIT); + if (buf == NULL) { + device_printf(fc->dev, "malloc failed\n"); + goto sidout; + } + for (i = 0; i < plen / 4; i ++) + buf[i] = FWOHCI_DMA_READ(sc->sid_buf[i+1]); #if 1 /* pending all pre-bus_reset packets */ fwohci_txd(sc, &sc->atrq); @@ -1927,7 +1886,8 @@ busresetout: fwohci_arcv(sc, &sc->arrq, -1); fw_drain_txq(fc); #endif - fw_sidrcv(fc, buf, plen, 0); + fw_sidrcv(fc, buf, plen); + free(buf, M_FW); } sidout: if((stat & OHCI_INT_DMA_ATRQ )){ @@ -1964,32 +1924,84 @@ sidout: return; } +#if FWOHCI_TASKQUEUE +static void +fwohci_complete(void *arg, int pending) +{ + struct fwohci_softc *sc = (struct fwohci_softc *)arg; + u_int32_t stat; + +again: + stat = atomic_readandclear_int(&sc->intstat); + if (stat) + fwohci_intr_body(sc, stat, -1); + else + return; + goto again; +} +#endif + +static u_int32_t +fwochi_check_stat(struct fwohci_softc *sc) +{ + u_int32_t stat, irstat, itstat; + + stat = OREAD(sc, FWOHCI_INTSTAT); + if (stat == 0xffffffff) { + device_printf(sc->fc.dev, + "device physically ejected?\n"); + return(stat); + } +#ifdef ACK_ALL + if (stat) + OWRITE(sc, FWOHCI_INTSTATCLR, stat); +#endif + if (stat & OHCI_INT_DMA_IR) { + irstat = OREAD(sc, OHCI_IR_STAT); + OWRITE(sc, OHCI_IR_STATCLR, irstat); + atomic_set_int(&sc->irstat, irstat); + } + if (stat & OHCI_INT_DMA_IT) { + itstat = OREAD(sc, OHCI_IT_STAT); + OWRITE(sc, OHCI_IT_STATCLR, itstat); + atomic_set_int(&sc->itstat, itstat); + } + return(stat); +} + void fwohci_intr(void *arg) { struct fwohci_softc *sc = (struct fwohci_softc *)arg; - u_int32_t stat, bus_reset = 0; + u_int32_t stat; +#if !FWOHCI_TASKQUEUE + u_int32_t bus_reset = 0; +#endif if (!(sc->intmask & OHCI_INT_EN)) { /* polling mode */ return; } - while ((stat = OREAD(sc, FWOHCI_INTSTAT)) != 0) { - if (stat == 0xffffffff) { - device_printf(sc->fc.dev, - "device physically ejected?\n"); - return; - } -#ifdef ACK_ALL - OWRITE(sc, FWOHCI_INTSTATCLR, stat); +#if !FWOHCI_TASKQUEUE +again: +#endif + stat = fwochi_check_stat(sc); + if (stat == 0 || stat == 0xffffffff) + return; +#if FWOHCI_TASKQUEUE + atomic_set_int(&sc->intstat, stat); + /* XXX mask bus reset intr. during bus reset phase */ + if (stat) + taskqueue_enqueue(taskqueue_swi_giant, &sc->fwohci_task_complete); +#else + /* We cannot clear bus reset event during bus reset phase */ + if ((stat & ~bus_reset) == 0) + return; + bus_reset = stat & OHCI_INT_PHY_BUS_R; + fwohci_intr_body(sc, stat, -1); + goto again; #endif - /* We cannot clear bus reset event during bus reset phase */ - if ((stat & ~bus_reset) == 0) - return; - bus_reset = stat & OHCI_INT_PHY_BUS_R; - fwohci_intr_body(sc, stat, -1); - } } static void @@ -2009,17 +2021,9 @@ fwohci_poll(struct firewire_comm *fc, int quick, int count) #else if (1) { #endif - stat = OREAD(sc, FWOHCI_INTSTAT); - if (stat == 0) - return; - if (stat == 0xffffffff) { - device_printf(sc->fc.dev, - "device physically ejected?\n"); + stat = fwochi_check_stat(sc); + if (stat == 0 || stat == 0xffffffff) return; - } -#ifdef ACK_ALL - OWRITE(sc, FWOHCI_INTSTATCLR, stat); -#endif } s = splfw(); fwohci_intr_body(sc, stat, count); @@ -2051,15 +2055,19 @@ fwohci_tbuf_update(struct fwohci_softc *sc, int dmach) struct fw_bulkxfer *chunk; struct fw_xferq *it; u_int32_t stat, count; - int s, w=0; + int s, w=0, ldesc; it = fc->it[dmach]; + ldesc = sc->it[dmach].ndesc - 1; s = splfw(); /* unnecessary ? */ + fwdma_sync_multiseg_all(sc->it[dmach].am, BUS_DMASYNC_POSTREAD); while ((chunk = STAILQ_FIRST(&it->stdma)) != NULL) { db = ((struct fwohcidb_tr *)(chunk->end))->db; - stat = db[sc->it[dmach].ndesc - 1].db.desc.status; + stat = FWOHCI_DMA_READ(db[ldesc].db.desc.res) + >> OHCI_STATUS_SHIFT; db = ((struct fwohcidb_tr *)(chunk->start))->db; - count = db[sc->it[dmach].ndesc - 1].db.desc.count; + count = FWOHCI_DMA_READ(db[ldesc].db.desc.res) + & OHCI_COUNT_MASK; if (stat == 0) break; STAILQ_REMOVE_HEAD(&it->stdma, link); @@ -2071,7 +2079,8 @@ fwohci_tbuf_update(struct fwohci_softc *sc, int dmach) break; default: device_printf(fc->dev, - "Isochronous transmit err %02x\n", stat); + "Isochronous transmit err %02x(%s)\n", + stat, fwohcicode[stat & 0x1f]); } STAILQ_INSERT_TAIL(&it->stfree, chunk, link); w++; @@ -2085,19 +2094,38 @@ static void fwohci_rbuf_update(struct fwohci_softc *sc, int dmach) { struct firewire_comm *fc = &sc->fc; - volatile struct fwohcidb *db; + volatile struct fwohcidb_tr *db_tr; struct fw_bulkxfer *chunk; struct fw_xferq *ir; u_int32_t stat; - int s, w=0; + int s, w=0, ldesc; ir = fc->ir[dmach]; + ldesc = sc->ir[dmach].ndesc - 1; +#if 0 + dump_db(sc, dmach); +#endif s = splfw(); + fwdma_sync_multiseg_all(sc->ir[dmach].am, BUS_DMASYNC_POSTREAD); while ((chunk = STAILQ_FIRST(&ir->stdma)) != NULL) { - db = ((struct fwohcidb_tr *)(chunk->end))->db; - stat = db[sc->ir[dmach].ndesc - 1].db.desc.status; + db_tr = (struct fwohcidb_tr *)chunk->end; + stat = FWOHCI_DMA_READ(db_tr->db[ldesc].db.desc.res) + >> OHCI_STATUS_SHIFT; if (stat == 0) break; + + if (chunk->mbuf != NULL) { + bus_dmamap_sync(sc->ir[dmach].dmat, db_tr->dma_map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->ir[dmach].dmat, db_tr->dma_map); + } else if (ir->buf != NULL) { + fwdma_sync_multiseg(ir->buf, chunk->poffset, + ir->bnpacket, BUS_DMASYNC_POSTREAD); + } else { + /* XXX */ + printf("fwohci_rbuf_update: this shouldn't happend\n"); + } + STAILQ_REMOVE_HEAD(&ir->stdma, link); STAILQ_INSERT_TAIL(&ir->stvalid, chunk, link); switch (stat & FWOHCIEV_MASK) { @@ -2107,7 +2135,8 @@ fwohci_rbuf_update(struct fwohci_softc *sc, int dmach) default: chunk->resp = EINVAL; device_printf(fc->dev, - "Isochronous receive err %02x\n", stat); + "Isochronous receive err %02x(%s)\n", + stat, fwohcicode[stat & 0x1f]); } w++; } @@ -2142,14 +2171,13 @@ dump_dma(struct fwohci_softc *sc, u_int32_t ch) cmd = OREAD(sc, off + 0xc); match = OREAD(sc, off + 0x10); - device_printf(sc->fc.dev, "dma ch %1x:dma regs 0x%08x 0x%08x 0x%08x 0x%08x \n", + device_printf(sc->fc.dev, "ch %1x cntl:0x%08x cmd:0x%08x match:0x%08x\n", ch, cntl, - stat, cmd, match); stat &= 0xffff ; - if(stat & 0xff00){ + if (stat) { device_printf(sc->fc.dev, "dma %d ch:%s%s%s%s%s%s %s(%x)\n", ch, stat & OHCI_CNTL_DMA_RUN ? "RUN," : "", @@ -2170,7 +2198,7 @@ void dump_db(struct fwohci_softc *sc, u_int32_t ch) { struct fwohci_dbch *dbch; - struct fwohcidb_tr *cp = NULL, *pp, *np; + struct fwohcidb_tr *cp = NULL, *pp, *np = NULL; volatile struct fwohcidb *curr = NULL, *prev, *next = NULL; int idb, jdb; u_int32_t cmd, off; @@ -2212,10 +2240,8 @@ dump_db(struct fwohci_softc *sc, u_int32_t ch) goto outdb; } np = STAILQ_NEXT(cp, link); - if(cp == NULL) break; for(jdb = 0 ; jdb < dbch->ndesc ; jdb ++ ){ - if((cmd & 0xfffffff0) - == vtophys(&(cp->db[jdb]))){ + if ((cmd & 0xfffffff0) == cp->bus_addr) { curr = cp->db; if(np != NULL){ next = np->db; @@ -2230,12 +2256,16 @@ dump_db(struct fwohci_softc *sc, u_int32_t ch) } outdb: if( curr != NULL){ +#if 0 printf("Prev DB %d\n", ch); - print_db(prev, ch, dbch->ndesc); + print_db(pp, prev, ch, dbch->ndesc); +#endif printf("Current DB %d\n", ch); - print_db(curr, ch, dbch->ndesc); + print_db(cp, curr, ch, dbch->ndesc); +#if 0 printf("Next DB %d\n", ch); - print_db(next, ch, dbch->ndesc); + print_db(np, next, ch, dbch->ndesc); +#endif }else{ printf("dbdump err ch = %d cmd = 0x%08x\n", ch, cmd); } @@ -2243,10 +2273,12 @@ outdb: } void -print_db(volatile struct fwohcidb *db, u_int32_t ch, u_int32_t max) +print_db(struct fwohcidb_tr *db_tr, volatile struct fwohcidb *db, + u_int32_t ch, u_int32_t max) { fwohcireg_t stat; int i, key; + u_int32_t cmd, res; if(db == NULL){ printf("No Descriptor is found\n"); @@ -2266,23 +2298,25 @@ print_db(volatile struct fwohcidb *db, u_int32_t ch, u_int32_t max) "Stat", "Cnt"); for( i = 0 ; i <= max ; i ++){ - key = db[i].db.desc.control & OHCI_KEY_MASK; + cmd = FWOHCI_DMA_READ(db[i].db.desc.cmd); + res = FWOHCI_DMA_READ(db[i].db.desc.res); + key = cmd & OHCI_KEY_MASK; + stat = res >> OHCI_STATUS_SHIFT; #if __FreeBSD_version >= 500000 printf("%08tx %s %s %s %s %5d %08x %08x %04x:%04x", #else printf("%08x %s %s %s %s %5d %08x %08x %04x:%04x", #endif - vtophys(&db[i]), - dbcode[(db[i].db.desc.control >> 12) & 0xf], - dbkey[(db[i].db.desc.control >> 8) & 0x7], - dbcond[(db[i].db.desc.control >> 4) & 0x3], - dbcond[(db[i].db.desc.control >> 2) & 0x3], - db[i].db.desc.reqcount, - db[i].db.desc.addr, - db[i].db.desc.depend, - db[i].db.desc.status, - db[i].db.desc.count); - stat = db[i].db.desc.status; + db_tr->bus_addr, + dbcode[(cmd >> 28) & 0xf], + dbkey[(cmd >> 24) & 0x7], + dbcond[(cmd >> 20) & 0x3], + dbcond[(cmd >> 18) & 0x3], + cmd & OHCI_COUNT_MASK, + FWOHCI_DMA_READ(db[i].db.desc.addr), + FWOHCI_DMA_READ(db[i].db.desc.depend), + stat, + res & OHCI_COUNT_MASK); if(stat & 0xff00){ printf(" %s%s%s%s%s%s %s(%x)\n", stat & OHCI_CNTL_DMA_RUN ? "RUN," : "", @@ -2299,23 +2333,23 @@ print_db(volatile struct fwohcidb *db, u_int32_t ch, u_int32_t max) } if(key == OHCI_KEY_ST2 ){ printf("0x%08x 0x%08x 0x%08x 0x%08x\n", - db[i+1].db.immed[0], - db[i+1].db.immed[1], - db[i+1].db.immed[2], - db[i+1].db.immed[3]); + FWOHCI_DMA_READ(db[i+1].db.immed[0]), + FWOHCI_DMA_READ(db[i+1].db.immed[1]), + FWOHCI_DMA_READ(db[i+1].db.immed[2]), + FWOHCI_DMA_READ(db[i+1].db.immed[3])); } if(key == OHCI_KEY_DEVICE){ return; } - if((db[i].db.desc.control & OHCI_BRANCH_MASK) + if((cmd & OHCI_BRANCH_MASK) == OHCI_BRANCH_ALWAYS){ return; } - if((db[i].db.desc.control & OHCI_CMD_MASK) + if((cmd & OHCI_CMD_MASK) == OHCI_OUTPUT_LAST){ return; } - if((db[i].db.desc.control & OHCI_CMD_MASK) + if((cmd & OHCI_CMD_MASK) == OHCI_INPUT_LAST){ return; } @@ -2367,43 +2401,42 @@ fwohci_txbufdb(struct fwohci_softc *sc, int dmach, struct fw_bulkxfer *bulkxfer) db_tr = (struct fwohcidb_tr *)(bulkxfer->start); fdb_tr = (struct fwohcidb_tr *)(bulkxfer->end); /* -device_printf(sc->fc.dev, "DB %08x %08x %08x\n", bulkxfer, vtophys(db_tr->db), vtophys(fdb_tr->db)); +device_printf(sc->fc.dev, "DB %08x %08x %08x\n", bulkxfer, db_tr->bus_addr, fdb_tr->bus_addr); */ - for( idb = 0 ; idb < bulkxfer->npacket ; idb ++){ + for (idb = 0; idb < dbch->xferq.bnpacket; idb ++) { db = db_tr->db; -#if 0 - db[0].db.desc.control - = OHCI_OUTPUT_MORE | OHCI_KEY_ST2; - db[0].db.desc.reqcount = 8; -#endif fp = (struct fw_pkt *)db_tr->buf; ohcifp = (volatile struct fwohci_txpkthdr *) db[1].db.immed; - ohcifp->mode.ld[0] = ntohl(fp->mode.ld[0]); - ohcifp->mode.stream.len = ntohs(fp->mode.stream.len); + ohcifp->mode.ld[0] = fp->mode.ld[0]; + ohcifp->mode.stream.len = fp->mode.stream.len; ohcifp->mode.stream.chtag = chtag; ohcifp->mode.stream.tcode = 0xa; ohcifp->mode.stream.spd = 0; +#if BYTE_ORDER == BIG_ENDIAN + FWOHCI_DMA_WRITE(db[1].db.immed[0], db[1].db.immed[0]); + FWOHCI_DMA_WRITE(db[1].db.immed[1], db[1].db.immed[1]); +#endif - db[2].db.desc.reqcount = ntohs(fp->mode.stream.len); - db[2].db.desc.status = 0; - db[2].db.desc.count = 0; + FWOHCI_DMA_CLEAR(db[2].db.desc.cmd, OHCI_COUNT_MASK); + FWOHCI_DMA_SET(db[2].db.desc.cmd, fp->mode.stream.len); + FWOHCI_DMA_WRITE(db[2].db.desc.res, 0); #if 0 /* if bulkxfer->npackets changes */ - db[2].db.desc.control = OHCI_OUTPUT_LAST + db[2].db.desc.cmd = OHCI_OUTPUT_LAST | OHCI_UPDATE | OHCI_BRANCH_ALWAYS; db[0].db.desc.depend = = db[dbch->ndesc - 1].db.desc.depend - = vtophys(STAILQ_NEXT(db_tr, link)->db) | dbch->ndesc; + = STAILQ_NEXT(db_tr, link)->bus_addr | dbch->ndesc; #else - db[0].db.desc.depend |= dbch->ndesc; - db[dbch->ndesc - 1].db.desc.depend |= dbch->ndesc; + FWOHCI_DMA_SET(db[0].db.desc.depend, dbch->ndesc); + FWOHCI_DMA_SET(db[dbch->ndesc - 1].db.desc.depend, dbch->ndesc); #endif bulkxfer->end = (caddr_t)db_tr; db_tr = STAILQ_NEXT(db_tr, link); } db = ((struct fwohcidb_tr *)bulkxfer->end)->db; - db[0].db.desc.depend &= ~0xf; - db[dbch->ndesc - 1].db.desc.depend &= ~0xf; + FWOHCI_DMA_CLEAR(db[0].db.desc.depend, 0xf); + FWOHCI_DMA_CLEAR(db[dbch->ndesc - 1].db.desc.depend, 0xf); #if 0 /* if bulkxfer->npackets changes */ db[dbch->ndesc - 1].db.desc.control |= OHCI_INTERRUPT_ALWAYS; /* OHCI 1.1 and above */ @@ -2412,201 +2445,142 @@ device_printf(sc->fc.dev, "DB %08x %08x %08x\n", bulkxfer, vtophys(db_tr->db), v /* db_tr = (struct fwohcidb_tr *)bulkxfer->start; fdb_tr = (struct fwohcidb_tr *)bulkxfer->end; -device_printf(sc->fc.dev, "DB %08x %3d %08x %08x\n", bulkxfer, bulkxfer->npacket, vtophys(db_tr->db), vtophys(fdb_tr->db)); +device_printf(sc->fc.dev, "DB %08x %3d %08x %08x\n", bulkxfer, bulkxfer->npacket, db_tr->bus_addr, fdb_tr->bus_addr); */ return; } static int -fwohci_add_tx_buf(struct fwohcidb_tr *db_tr, unsigned short size, - int mode, void *buf) +fwohci_add_tx_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr, + int poffset) { volatile struct fwohcidb *db = db_tr->db; + struct fw_xferq *it; int err = 0; - if(buf == 0){ + + it = &dbch->xferq; + if(it->buf == 0){ err = EINVAL; return err; } - db_tr->buf = buf; + db_tr->buf = fwdma_v_addr(it->buf, poffset); db_tr->dbcnt = 3; - db_tr->dummy = NULL; - db[0].db.desc.control = OHCI_OUTPUT_MORE | OHCI_KEY_ST2; - db[0].db.desc.reqcount = 8; - db[2].db.desc.addr = vtophys(buf) + sizeof(u_int32_t); - db[2].db.desc.control = - OHCI_OUTPUT_LAST | OHCI_UPDATE | OHCI_BRANCH_ALWAYS; + FWOHCI_DMA_WRITE(db[0].db.desc.cmd, + OHCI_OUTPUT_MORE | OHCI_KEY_ST2 | 8); + FWOHCI_DMA_WRITE(db[2].db.desc.addr, + fwdma_bus_addr(it->buf, poffset) + sizeof(u_int32_t)); + + FWOHCI_DMA_WRITE(db[2].db.desc.cmd, + OHCI_OUTPUT_LAST | OHCI_UPDATE | OHCI_BRANCH_ALWAYS); #if 1 - db[0].db.desc.status = 0; - db[0].db.desc.count = 0; - db[2].db.desc.status = 0; - db[2].db.desc.count = 0; + FWOHCI_DMA_WRITE(db[0].db.desc.res, 0); + FWOHCI_DMA_WRITE(db[2].db.desc.res, 0); #endif - if( mode & FWXFERQ_STREAM ){ - if(mode & FWXFERQ_PACKET ){ - db[2].db.desc.control |= OHCI_INTERRUPT_ALWAYS; - } - } else { - printf("fwohci_add_tx_buf: who calls me?"); - } - return 1; + return 0; } int -fwohci_add_rx_buf(struct fwohcidb_tr *db_tr, unsigned short size, int mode, - void *buf, void *dummy) +fwohci_add_rx_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr, + int poffset, struct fwdma_alloc *dummy_dma) { volatile struct fwohcidb *db = db_tr->db; - int i; - void *dbuf[2]; + struct fw_xferq *ir; + int i, ldesc; + bus_addr_t dbuf[2]; int dsiz[2]; - if(buf == 0){ - buf = malloc(size, M_FW, M_NOWAIT); - if(buf == NULL) return 0; - db_tr->buf = buf; - db_tr->dbcnt = 1; - db_tr->dummy = NULL; - dsiz[0] = size; - dbuf[0] = buf; - }else if(dummy == NULL){ - db_tr->buf = buf; + ir = &dbch->xferq; + if (ir->buf == NULL && (dbch->xferq.flag & FWXFERQ_EXTBUF) == 0) { + db_tr->buf = fwdma_malloc_size(dbch->dmat, &db_tr->dma_map, + ir->psize, &dbuf[0], BUS_DMA_NOWAIT); + if (db_tr->buf == NULL) + return(ENOMEM); db_tr->dbcnt = 1; - db_tr->dummy = NULL; - dsiz[0] = size; - dbuf[0] = buf; - }else{ - db_tr->buf = buf; - db_tr->dbcnt = 2; - db_tr->dummy = dummy; - dsiz[0] = sizeof(u_int32_t); - dsiz[1] = size; - dbuf[0] = dummy; - dbuf[1] = buf; + dsiz[0] = ir->psize; + bus_dmamap_sync(dbch->dmat, db_tr->dma_map, + BUS_DMASYNC_PREREAD); + } else { + db_tr->dbcnt = 0; + if (dummy_dma != NULL) { + dsiz[db_tr->dbcnt] = sizeof(u_int32_t); + dbuf[db_tr->dbcnt++] = dummy_dma->bus_addr; + } + dsiz[db_tr->dbcnt] = ir->psize; + if (ir->buf != NULL) { + db_tr->buf = fwdma_v_addr(ir->buf, poffset); + dbuf[db_tr->dbcnt] = fwdma_bus_addr( ir->buf, poffset); + } + db_tr->dbcnt++; } for(i = 0 ; i < db_tr->dbcnt ; i++){ - db[i].db.desc.addr = vtophys(dbuf[i]) ; - db[i].db.desc.control = OHCI_INPUT_MORE; - db[i].db.desc.reqcount = dsiz[i]; - if( mode & FWXFERQ_STREAM ){ - db[i].db.desc.control |= OHCI_UPDATE; - } - db[i].db.desc.status = 0; - db[i].db.desc.count = dsiz[i]; - } - if( mode & FWXFERQ_STREAM ){ - db[db_tr->dbcnt - 1].db.desc.control |= OHCI_INPUT_LAST; - if(mode & FWXFERQ_PACKET ){ - db[db_tr->dbcnt - 1].db.desc.control - |= OHCI_INTERRUPT_ALWAYS; + FWOHCI_DMA_WRITE(db[i].db.desc.addr, dbuf[i]); + FWOHCI_DMA_WRITE(db[i].db.desc.cmd, OHCI_INPUT_MORE | dsiz[i]); + if (ir->flag & FWXFERQ_STREAM) { + FWOHCI_DMA_SET(db[i].db.desc.cmd, OHCI_UPDATE); } + FWOHCI_DMA_WRITE(db[i].db.desc.res, dsiz[i]); } - db[db_tr->dbcnt - 1].db.desc.control |= OHCI_BRANCH_ALWAYS; - return 1; + ldesc = db_tr->dbcnt - 1; + if (ir->flag & FWXFERQ_STREAM) { + FWOHCI_DMA_SET(db[ldesc].db.desc.cmd, OHCI_INPUT_LAST); + } + FWOHCI_DMA_SET(db[ldesc].db.desc.cmd, OHCI_BRANCH_ALWAYS); + return 0; } -static void -fwohci_ircv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) + +static int +fwohci_arcv_swap(struct fw_pkt *fp, int len) { - struct fwohcidb_tr *db_tr = dbch->top, *odb_tr; - struct firewire_comm *fc = (struct firewire_comm *)sc; - int z = 1; - struct fw_pkt *fp; - u_int8_t *ld; - u_int32_t off = NULL; - u_int32_t stat; - u_int32_t *qld; - u_int32_t reg; - u_int spd; - u_int dmach; - int len, i, plen; - caddr_t buf; + struct fw_pkt *fp0; + u_int32_t ld0; + int slen; +#if BYTE_ORDER == BIG_ENDIAN + int i; +#endif - for(dmach = 0 ; dmach < sc->fc.nisodma ; dmach++){ - if( &sc->ir[dmach] == dbch){ - off = OHCI_IROFF(dmach); - break; - } - } - if(off == NULL){ - return; - } - if(!(dbch->xferq.flag & FWXFERQ_RUNNING)){ - fwohci_irx_disable(&sc->fc, dmach); - return; + ld0 = FWOHCI_DMA_READ(fp->mode.ld[0]); +#if 0 + printf("ld0: x%08x\n", ld0); +#endif + fp0 = (struct fw_pkt *)&ld0; + switch (fp0->mode.common.tcode) { + case FWTCODE_RREQQ: + case FWTCODE_WRES: + case FWTCODE_WREQQ: + case FWTCODE_RRESQ: + case FWOHCITCODE_PHY: + slen = 12; + break; + case FWTCODE_RREQB: + case FWTCODE_WREQB: + case FWTCODE_LREQ: + case FWTCODE_RRESB: + case FWTCODE_LRES: + slen = 16; + break; + default: + printf("Unknown tcode %d\n", fp0->mode.common.tcode); + return(0); } - - odb_tr = NULL; - db_tr = dbch->top; - i = 0; - while ((reg = db_tr->db[0].db.desc.status) & 0x1f) { - if (count >= 0 && count-- == 0) - break; - ld = (u_int8_t *)db_tr->buf; - if (dbch->xferq.flag & FWXFERQ_PACKET) { - /* skip timeStamp */ - ld += sizeof(struct fwohci_trailer); - } - qld = (u_int32_t *)ld; - len = dbch->xferq.psize - (db_tr->db[0].db.desc.count); -/* -{ -device_printf(sc->fc.dev, "%04x %2x 0x%08x 0x%08x 0x%08x 0x%08x\n", len, - db_tr->db[0].db.desc.status & 0x1f, qld[0],qld[1],qld[2],qld[3]); -} -*/ - fp=(struct fw_pkt *)ld; - qld[0] = htonl(qld[0]); - plen = sizeof(struct fw_isohdr) - + ntohs(fp->mode.stream.len) + sizeof(u_int32_t); - ld += plen; - len -= plen; - buf = db_tr->buf; - db_tr->buf = NULL; - stat = reg & 0x1f; - spd = reg & 0x3; - switch(stat){ - case FWOHCIEV_ACKCOMPL: - case FWOHCIEV_ACKPEND: - fw_rcv(&sc->fc, buf, plen - sizeof(u_int32_t), dmach, sizeof(u_int32_t), spd); - break; - default: - free(buf, M_FW); - device_printf(sc->fc.dev, "Isochronous receive err %02x\n", stat); - break; - } - i++; - fwohci_add_rx_buf(db_tr, dbch->xferq.psize, - dbch->xferq.flag, 0, NULL); - db_tr->db[0].db.desc.depend &= ~0xf; - if(dbch->pdb_tr != NULL){ - dbch->pdb_tr->db[0].db.desc.depend |= z; - } else { - /* XXX should be rewritten in better way */ - dbch->bottom->db[0].db.desc.depend |= z; - } - dbch->pdb_tr = db_tr; - db_tr = STAILQ_NEXT(db_tr, link); + if (slen > len) { + if (firewire_debug) + printf("splitted header\n"); + return(-slen); } - dbch->top = db_tr; - reg = OREAD(sc, OHCI_DMACTL(off)); - if (reg & OHCI_CNTL_DMA_ACTIVE) - return; - device_printf(sc->fc.dev, "IR DMA %d stopped at %x status=%x (%d)\n", - dmach, OREAD(sc, OHCI_DMACMD(off)), reg, i); - dbch->top = db_tr; - fwohci_irx_enable(fc, dmach); +#if BYTE_ORDER == BIG_ENDIAN + for(i = 0; i < slen/4; i ++) + fp->mode.ld[i] = FWOHCI_DMA_READ(fp->mode.ld[i]); +#endif + return(slen); } -#define PLEN(x) roundup2(ntohs(x), sizeof(u_int32_t)) +#define PLEN(x) roundup2(x, sizeof(u_int32_t)) static int -fwohci_get_plen(struct fwohci_softc *sc, struct fwohci_dbch *dbch, struct fw_pkt *fp, int hlen) +fwohci_get_plen(struct fwohci_softc *sc, struct fwohci_dbch *dbch, struct fw_pkt *fp) { - int i, r; - - for( i = 4; i < hlen ; i+=4){ - fp->mode.ld[i/4] = htonl(fp->mode.ld[i/4]); - } + int r; switch(fp->mode.common.tcode){ case FWTCODE_RREQQ: @@ -2655,16 +2629,30 @@ fwohci_get_plen(struct fwohci_softc *sc, struct fwohci_dbch *dbch, struct fw_pkt return r; } +static void +fwohci_arcv_free_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr) +{ + volatile struct fwohcidb *db = &db_tr->db[0]; + + FWOHCI_DMA_CLEAR(db->db.desc.depend, 0xf); + FWOHCI_DMA_WRITE(db->db.desc.res, dbch->xferq.psize); + FWOHCI_DMA_SET(dbch->bottom->db[0].db.desc.depend, 1); + fwdma_sync_multiseg_all(dbch->am, BUS_DMASYNC_PREWRITE); + dbch->bottom = db_tr; +} + static void fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) { struct fwohcidb_tr *db_tr; - int z = 1; + struct iovec vec[2]; + struct fw_pkt pktbuf; + int nvec; struct fw_pkt *fp; u_int8_t *ld; - u_int32_t stat, off; + u_int32_t stat, off, status; u_int spd; - int len, plen, hlen, pcnt, poff = 0, rlen; + int len, plen, hlen, pcnt, offset; int s; caddr_t buf; int resCount; @@ -2681,160 +2669,169 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) db_tr = dbch->top; pcnt = 0; /* XXX we cannot handle a packet which lies in more than two buf */ - while (db_tr->db[0].db.desc.status & OHCI_CNTL_DMA_ACTIVE) { - ld = (u_int8_t *)db_tr->buf + dbch->buf_offset; - resCount = db_tr->db[0].db.desc.count; - len = dbch->xferq.psize - resCount - - dbch->buf_offset; + fwdma_sync_multiseg_all(dbch->am, BUS_DMASYNC_POSTREAD); + fwdma_sync_multiseg_all(dbch->am, BUS_DMASYNC_POSTWRITE); + status = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) >> OHCI_STATUS_SHIFT; + resCount = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) & OHCI_COUNT_MASK; +#if 0 + printf("status 0x%04x, resCount 0x%04x\n", status, resCount); +#endif + while (status & OHCI_CNTL_DMA_ACTIVE) { + len = dbch->xferq.psize - resCount; + ld = (u_int8_t *)db_tr->buf; + if (dbch->pdb_tr == NULL) { + len -= dbch->buf_offset; + ld += dbch->buf_offset; + } + if (len > 0) + bus_dmamap_sync(dbch->dmat, db_tr->dma_map, + BUS_DMASYNC_POSTREAD); while (len > 0 ) { if (count >= 0 && count-- == 0) goto out; - if(dbch->frag.buf != NULL){ - buf = dbch->frag.buf; - if (dbch->frag.plen < 0) { - /* incomplete header */ - int hlen; - - hlen = - dbch->frag.plen; - rlen = hlen - dbch->frag.len; - bcopy(ld, dbch->frag.buf + dbch->frag.len, rlen); + if(dbch->pdb_tr != NULL){ + /* we have a fragment in previous buffer */ + int rlen; + + offset = dbch->buf_offset; + if (offset < 0) + offset = - offset; + buf = dbch->pdb_tr->buf + offset; + rlen = dbch->xferq.psize - offset; + if (firewire_debug) + printf("rlen=%d, offset=%d\n", + rlen, dbch->buf_offset); + if (dbch->buf_offset < 0) { + /* splitted in header, pull up */ + char *p; + + p = (char *)&pktbuf; + bcopy(buf, p, rlen); + p += rlen; + /* this must be too long but harmless */ + rlen = sizeof(pktbuf) - rlen; + if (rlen < 0) + printf("why rlen < 0\n"); + bcopy(db_tr->buf, p, rlen); ld += rlen; len -= rlen; - dbch->frag.len += rlen; -#if 0 - printf("(1)frag.plen=%d frag.len=%d rlen=%d len=%d\n", dbch->frag.plen, dbch->frag.len, rlen, len); -#endif - fp=(struct fw_pkt *)dbch->frag.buf; - dbch->frag.plen - = fwohci_get_plen(sc, - dbch, fp, hlen); - if (dbch->frag.plen == 0) - goto out; + hlen = fwohci_arcv_swap(&pktbuf, sizeof(pktbuf)); + if (hlen < 0) { + printf("hlen < 0 shouldn't happen"); + } + offset = sizeof(pktbuf); + vec[0].iov_base = (char *)&pktbuf; + vec[0].iov_len = offset; + } else { + /* splitted in payload */ + offset = rlen; + vec[0].iov_base = buf; + vec[0].iov_len = rlen; } - rlen = dbch->frag.plen - dbch->frag.len; -#if 0 - printf("(2)frag.plen=%d frag.len=%d rlen=%d len=%d\n", dbch->frag.plen, dbch->frag.len, rlen, len); -#endif - bcopy(ld, dbch->frag.buf + dbch->frag.len, - rlen); - ld += rlen; - len -= rlen; - plen = dbch->frag.plen; - dbch->frag.buf = NULL; - dbch->frag.plen = 0; - dbch->frag.len = 0; - poff = 0; - }else{ + fp=(struct fw_pkt *)vec[0].iov_base; + nvec = 1; + } else { + /* no fragment in previous buffer */ fp=(struct fw_pkt *)ld; - fp->mode.ld[0] = htonl(fp->mode.ld[0]); - switch(fp->mode.common.tcode){ - case FWTCODE_RREQQ: - case FWTCODE_WRES: - case FWTCODE_WREQQ: - case FWTCODE_RRESQ: - case FWOHCITCODE_PHY: - hlen = 12; - break; - case FWTCODE_RREQB: - case FWTCODE_WREQB: - case FWTCODE_LREQ: - case FWTCODE_RRESB: - case FWTCODE_LRES: - hlen = 16; - break; - default: - device_printf(sc->fc.dev, "Unknown tcode %d\n", fp->mode.common.tcode); + hlen = fwohci_arcv_swap(fp, len); + if (hlen == 0) + /* XXX need reset */ + goto out; + if (hlen < 0) { + dbch->pdb_tr = db_tr; + dbch->buf_offset = - dbch->buf_offset; + /* sanity check */ + if (resCount != 0) + printf("resCount != 0 !?\n"); goto out; } - if (len >= hlen) { - plen = fwohci_get_plen(sc, - dbch, fp, hlen); - if (plen == 0) - goto out; - plen = (plen + 3) & ~3; - len -= plen; - } else { - plen = -hlen; - len -= hlen; - } - if(resCount > 0 || len > 0){ - buf = malloc(plen, M_FW, M_NOWAIT); - if(buf == NULL){ - printf("cannot malloc!\n"); - free(db_tr->buf, M_FW); - goto out; - } - bcopy(ld, buf, plen); - poff = 0; - dbch->frag.buf = NULL; - dbch->frag.plen = 0; - dbch->frag.len = 0; - }else if(len < 0){ - dbch->frag.buf = db_tr->buf; - if (plen < 0) { -#if 0 - printf("plen < 0:" - "hlen: %d len: %d\n", - hlen, len); -#endif - dbch->frag.len = hlen + len; - dbch->frag.plen = -hlen; - } else { - dbch->frag.len = plen + len; - dbch->frag.plen = plen; - } - bcopy(ld, db_tr->buf, dbch->frag.len); - buf = NULL; - }else{ - buf = db_tr->buf; - poff = ld - (u_int8_t *)buf; - dbch->frag.buf = NULL; - dbch->frag.plen = 0; - dbch->frag.len = 0; + offset = 0; + nvec = 0; + } + plen = fwohci_get_plen(sc, dbch, fp) - offset; + if (plen < 0) { + /* minimum header size + trailer + = sizeof(fw_pkt) so this shouldn't happens */ + printf("plen is negative! offset=%d\n", offset); + goto out; + } + if (plen > 0) { + len -= plen; + if (len < 0) { + dbch->pdb_tr = db_tr; + if (firewire_debug) + printf("splitted payload\n"); + /* sanity check */ + if (resCount != 0) + printf("resCount != 0 !?\n"); + goto out; } + vec[nvec].iov_base = ld; + vec[nvec].iov_len = plen; + nvec ++; ld += plen; } - if( buf != NULL){ + dbch->buf_offset = ld - (u_int8_t *)db_tr->buf; + if (nvec == 0) + printf("nvec == 0\n"); + /* DMA result-code will be written at the tail of packet */ - stat = ((struct fwohci_trailer *)(ld - sizeof(struct fwohci_trailer)))->stat; - spd = (stat >> 5) & 0x3; - stat &= 0x1f; - switch(stat){ - case FWOHCIEV_ACKPEND: +#if BYTE_ORDER == BIG_ENDIAN + stat = FWOHCI_DMA_READ(((struct fwohci_trailer *)(ld - sizeof(struct fwohci_trailer)))->stat) >> 16; +#else + stat = ((struct fwohci_trailer *)(ld - sizeof(struct fwohci_trailer)))->stat; +#endif #if 0 - printf("fwohci_arcv: ack pending tcode=0x%x..\n", fp->mode.common.tcode); + printf("plen: %d, stat %x\n", plen ,stat); #endif - /* fall through */ - case FWOHCIEV_ACKCOMPL: - if( poff != 0 ) - bcopy(buf+poff, buf, plen - 4); - fw_rcv(&sc->fc, buf, plen - sizeof(struct fwohci_trailer), 0, 0, spd); - break; - case FWOHCIEV_BUSRST: - free(buf, M_FW); - if (sc->fc.status != FWBUSRESET) - printf("got BUSRST packet!?\n"); + spd = (stat >> 5) & 0x3; + stat &= 0x1f; + switch(stat){ + case FWOHCIEV_ACKPEND: +#if 0 + printf("fwohci_arcv: ack pending tcode=0x%x..\n", fp->mode.common.tcode); +#endif + /* fall through */ + case FWOHCIEV_ACKCOMPL: + if ((vec[nvec-1].iov_len -= + sizeof(struct fwohci_trailer)) == 0) + nvec--; + fw_rcv(&sc->fc, vec, nvec, 0, spd); break; - default: - device_printf(sc->fc.dev, "Async DMA Receive error err = %02x %s\n", stat, fwohcicode[stat]); + case FWOHCIEV_BUSRST: + if (sc->fc.status != FWBUSRESET) + printf("got BUSRST packet!?\n"); + break; + default: + device_printf(sc->fc.dev, "Async DMA Receive error err = %02x %s\n", stat, fwohcicode[stat]); #if 0 /* XXX */ - goto out; + goto out; #endif - break; - } + break; } pcnt ++; - }; + if (dbch->pdb_tr != NULL) { + fwohci_arcv_free_buf(dbch, dbch->pdb_tr); + dbch->pdb_tr = NULL; + } + + } out: if (resCount == 0) { /* done on this buffer */ - fwohci_add_rx_buf(db_tr, dbch->xferq.psize, - dbch->xferq.flag, 0, NULL); - dbch->bottom->db[0].db.desc.depend |= z; - dbch->bottom = db_tr; + if (dbch->pdb_tr == NULL) { + fwohci_arcv_free_buf(dbch, db_tr); + dbch->buf_offset = 0; + } else + if (dbch->pdb_tr != db_tr) + printf("pdb_tr != db_tr\n"); db_tr = STAILQ_NEXT(db_tr, link); + status = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) + >> OHCI_STATUS_SHIFT; + resCount = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) + & OHCI_COUNT_MASK; + /* XXX check buffer overrun */ dbch->top = db_tr; - dbch->buf_offset = 0; } else { dbch->buf_offset = dbch->xferq.psize - resCount; break; diff --git a/sys/dev/firewire/fwohci_pci.c b/sys/dev/firewire/fwohci_pci.c index 24987207f1c2..14fb1ceee07e 100644 --- a/sys/dev/firewire/fwohci_pci.c +++ b/sys/dev/firewire/fwohci_pci.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. * @@ -33,6 +34,8 @@ * $FreeBSD$ */ +#define BOUNCE_BUFFER_TEST 0 + #include #include #include @@ -50,6 +53,7 @@ #include #include +#include #include #include @@ -103,7 +107,7 @@ fwohci_pci_probe( device_t dev ) return 0; } if (id == (FW_VENDORID_SONY | FW_DEVICE_CX3022)) { - device_set_desc(dev, "SONY CX3022"); + device_set_desc(dev, "Sony CX3022"); return 0; } if (id == (FW_VENDORID_VIA | FW_DEVICE_VT6306)) { @@ -150,7 +154,7 @@ fwohci_dummy_intr(void *arg) static int fwohci_pci_init(device_t self) { - int latency, cache_line; + int olatency, latency, ocache_line, cache_line; u_int16_t cmd; cmd = pci_read_config(self, PCIR_COMMAND, 2); @@ -161,25 +165,26 @@ fwohci_pci_init(device_t self) #endif pci_write_config(self, PCIR_COMMAND, cmd, 2); - latency = pci_read_config(self, PCIR_LATTIMER, 1); + latency = olatency = pci_read_config(self, PCIR_LATTIMER, 1); #define DEF_LATENCY 0x20 - if( latency < DEF_LATENCY ) { + if (olatency < DEF_LATENCY) { latency = DEF_LATENCY; - device_printf(self, "PCI bus latency was changing to"); - pci_write_config(self, PCIR_LATTIMER,latency, 1); - } else - { - device_printf(self, "PCI bus latency is"); + pci_write_config(self, PCIR_LATTIMER, latency, 1); + } + + cache_line = ocache_line = pci_read_config(self, PCIR_CACHELNSZ, 1); +#define DEF_CACHE_LINE 8 + if (ocache_line < DEF_CACHE_LINE) { + cache_line = DEF_CACHE_LINE; + pci_write_config(self, PCIR_CACHELNSZ, cache_line, 1); + } + + if (firewire_debug) { + device_printf(self, "latency timer %d -> %d.\n", + olatency, latency); + device_printf(self, "cache size %d -> %d.\n", + ocache_line, cache_line); } - printf(" %d.\n", (int) latency); - cache_line = pci_read_config(self, PCIR_CACHELNSZ, 1); -#if 0 -#define DEF_CACHE_LINE 0xc - cache_line = DEF_CACHE_LINE; - pci_write_config(self, PCIR_CACHELNSZ, cache_line, 1); -#endif - if (bootverbose) - device_printf(self, "cache size %d.\n", (int) cache_line); return 0; } @@ -198,13 +203,13 @@ fwohci_pci_attach(device_t self) device_printf(self, "Invalid irq %d\n", intr); #ifdef __i386__ device_printf(self, "Please switch PNP-OS to 'No' in BIOS\n"); -#endif -#if 0 - return ENXIO; #endif } #endif + if (bootverbose) + firewire_debug = bootverbose; + fwohci_pci_init(self); rid = PCI_CBMEM; @@ -235,7 +240,12 @@ fwohci_pci_attach(device_t self) } device_set_ivars(sc->fc.bdev, sc); - err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_NET, + err = bus_setup_intr(self, sc->irq_res, +#if FWOHCI_TASKQUEUE + INTR_TYPE_NET | INTR_MPSAFE, +#else + INTR_TYPE_NET, +#endif (driver_intr_t *) fwohci_intr, sc, &sc->ih); #if __FreeBSD_version < 500000 /* XXX splcam() should mask this irq for sbp.c*/ @@ -248,6 +258,26 @@ fwohci_pci_attach(device_t self) return ENXIO; } + err = bus_dma_tag_create(/*parent*/NULL, /*alignment*/1, + /*boundary*/0, +#if BOUNCE_BUFFER_TEST + /*lowaddr*/BUS_SPACE_MAXADDR_24BIT, +#else + /*lowaddr*/BUS_SPACE_MAXADDR_32BIT, +#endif + /*highaddr*/BUS_SPACE_MAXADDR, + /*filter*/NULL, /*filterarg*/NULL, + /*maxsize*/0x100000, + /*nsegments*/0x20, + /*maxsegsz*/0x8000, + /*flags*/BUS_DMA_ALLOCNOW, + &sc->fc.dmat); + if (err != 0) { + printf("fwohci_pci_attach: Could not allocate DMA tag " + "- error %d\n", err); + return (ENOMEM); + } + err = fwohci_init(sc, self); if (!err) @@ -263,9 +293,6 @@ fwohci_pci_attach(device_t self) * Clear the bus reset event flag to start transactions even when * interrupt is disabled during the boot process. */ -#if 0 - DELAY(100); -#endif s = splfw(); fwohci_intr((void *)sc); splx(s); diff --git a/sys/dev/firewire/fwohcireg.h b/sys/dev/firewire/fwohcireg.h index 58b342254cb5..4bb891c4bbbb 100644 --- a/sys/dev/firewire/fwohcireg.h +++ b/sys/dev/firewire/fwohcireg.h @@ -1,5 +1,6 @@ /* - * Copyright (c) 1998-2001 Katsushi Kobayashi and Hidetoshi Shimokawa + * Copyright (c) 2003 Hidetoshi Shimokawa + * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,55 +72,68 @@ typedef volatile u_int32_t fwohcireg_t; +/* for PCI */ +#if BYTE_ORDER == BIG_ENDIAN +#define FWOHCI_DMA_WRITE(x, y) ((x) = htole32(y)) +#define FWOHCI_DMA_READ(x) le32toh(x) +#define FWOHCI_DMA_SET(x, y) ((x) |= htole32(y)) +#define FWOHCI_DMA_CLEAR(x, y) ((x) &= htole32(~(y))) +#else +#define FWOHCI_DMA_WRITE(x, y) ((x) = (y)) +#define FWOHCI_DMA_READ(x) (x) +#define FWOHCI_DMA_SET(x, y) ((x) |= (y)) +#define FWOHCI_DMA_CLEAR(x, y) ((x) &= ~(y)) +#endif + struct fwohcidb { union { struct { - volatile u_int32_t reqcount:16, - control:16; + volatile u_int32_t cmd; volatile u_int32_t addr; volatile u_int32_t depend; - volatile u_int32_t count:16, - status:16; + volatile u_int32_t res; } desc; volatile u_int32_t immed[4]; } db; -#define OHCI_OUTPUT_MORE (0 << 12) -#define OHCI_OUTPUT_LAST (1 << 12) -#define OHCI_INPUT_MORE (2 << 12) -#define OHCI_INPUT_LAST (3 << 12) -#define OHCI_STORE_QUAD (4 << 12) -#define OHCI_LOAD_QUAD (5 << 12) -#define OHCI_NOP (6 << 12) -#define OHCI_STOP (7 << 12) -#define OHCI_STORE (8 << 12) -#define OHCI_CMD_MASK (0xf << 12) - -#define OHCI_UPDATE (1 << 11) - -#define OHCI_KEY_ST0 (0 << 8) -#define OHCI_KEY_ST1 (1 << 8) -#define OHCI_KEY_ST2 (2 << 8) -#define OHCI_KEY_ST3 (3 << 8) -#define OHCI_KEY_REGS (5 << 8) -#define OHCI_KEY_SYS (6 << 8) -#define OHCI_KEY_DEVICE (7 << 8) -#define OHCI_KEY_MASK (7 << 8) - -#define OHCI_INTERRUPT_NEVER (0 << 4) -#define OHCI_INTERRUPT_TRUE (1 << 4) -#define OHCI_INTERRUPT_FALSE (2 << 4) -#define OHCI_INTERRUPT_ALWAYS (3 << 4) - -#define OHCI_BRANCH_NEVER (0 << 2) -#define OHCI_BRANCH_TRUE (1 << 2) -#define OHCI_BRANCH_FALSE (2 << 2) -#define OHCI_BRANCH_ALWAYS (3 << 2) -#define OHCI_BRANCH_MASK (3 << 2) - -#define OHCI_WAIT_NEVER (0) -#define OHCI_WAIT_TRUE (1) -#define OHCI_WAIT_FALSE (2) -#define OHCI_WAIT_ALWAYS (3) +#define OHCI_STATUS_SHIFT 16 +#define OHCI_COUNT_MASK 0xffff +#define OHCI_OUTPUT_MORE (0 << 28) +#define OHCI_OUTPUT_LAST (1 << 28) +#define OHCI_INPUT_MORE (2 << 28) +#define OHCI_INPUT_LAST (3 << 28) +#define OHCI_STORE_QUAD (4 << 28) +#define OHCI_LOAD_QUAD (5 << 28) +#define OHCI_NOP (6 << 28) +#define OHCI_STOP (7 << 28) +#define OHCI_STORE (8 << 28) +#define OHCI_CMD_MASK (0xf << 28) + +#define OHCI_UPDATE (1 << 27) + +#define OHCI_KEY_ST0 (0 << 24) +#define OHCI_KEY_ST1 (1 << 24) +#define OHCI_KEY_ST2 (2 << 24) +#define OHCI_KEY_ST3 (3 << 24) +#define OHCI_KEY_REGS (5 << 24) +#define OHCI_KEY_SYS (6 << 24) +#define OHCI_KEY_DEVICE (7 << 24) +#define OHCI_KEY_MASK (7 << 24) + +#define OHCI_INTERRUPT_NEVER (0 << 20) +#define OHCI_INTERRUPT_TRUE (1 << 20) +#define OHCI_INTERRUPT_FALSE (2 << 20) +#define OHCI_INTERRUPT_ALWAYS (3 << 20) + +#define OHCI_BRANCH_NEVER (0 << 18) +#define OHCI_BRANCH_TRUE (1 << 18) +#define OHCI_BRANCH_FALSE (2 << 18) +#define OHCI_BRANCH_ALWAYS (3 << 18) +#define OHCI_BRANCH_MASK (3 << 18) + +#define OHCI_WAIT_NEVER (0 << 16) +#define OHCI_WAIT_TRUE (1 << 16) +#define OHCI_WAIT_FALSE (2 << 16) +#define OHCI_WAIT_ALWAYS (3 << 16) }; #define OHCI_SPD_S100 0x4 @@ -298,8 +312,9 @@ struct fwohcidb_tr{ STAILQ_ENTRY(fwohcidb_tr) link; struct fw_xfer *xfer; volatile struct fwohcidb *db; + bus_dmamap_t dma_map; caddr_t buf; - caddr_t dummy; + bus_addr_t bus_addr; int dbcnt; }; @@ -310,31 +325,55 @@ struct fwohci_txpkthdr{ union{ u_int32_t ld[4]; struct { - u_int32_t res3:4, +#if BYTE_ORDER == BIG_ENDIAN + u_int32_t :13, + spd:3, + :8, + tcode:4, + :4; +#else + u_int32_t :4, tcode:4, - res2:8, + :8, spd:3, - res1:13; + :13; +#endif }common; struct { - u_int32_t res3:4, - tcode:4, - tlrt:8, - spd:3, - res2:4, - srcbus:1, - res1:8; - u_int32_t res4:16, - dst:16; +#if BYTE_ORDER == BIG_ENDIAN + u_int32_t :8, + srcbus:1, + :4, + spd:3, + tlrt:8, + tcode:4, + :4; +#else + u_int32_t :4, + tcode:4, + tlrt:8, + spd:3, + :4, + srcbus:1, + :8; +#endif + BIT16x2(dst, ); }asycomm; struct { +#if BYTE_ORDER == BIG_ENDIAN + u_int32_t :13, + spd:3, + chtag:8, + tcode:4, + sy:4; +#else u_int32_t sy:4, tcode:4, chtag:8, spd:3, - res1:13; - u_int32_t res2:16, - len:16; + :13; +#endif + BIT16x2(len, ); }stream; }mode; }; diff --git a/sys/dev/firewire/fwohcivar.h b/sys/dev/firewire/fwohcivar.h index 643c0ded3b98..b68e9e24a20e 100644 --- a/sys/dev/firewire/fwohcivar.h +++ b/sys/dev/firewire/fwohcivar.h @@ -1,4 +1,5 @@ /* + * Copyright (c) 2003 Hidetoshi SHimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi SHimokawa * All rights reserved. * @@ -33,6 +34,16 @@ * $FreeBSD$ * */ + +#if __FreeBSD_version >= 500000 +#define FWOHCI_TASKQUEUE 1 +#else +#define FWOHCI_TASKQUEUE 0 +#endif +#if FWOHCI_TASKQUEUE +#include +#endif + typedef struct fwohci_softc { struct firewire_comm fc; bus_space_tag_t bst; @@ -41,34 +52,36 @@ typedef struct fwohci_softc { #if __FreeBSD_version < 500000 void *ih_cam; #endif - struct resource *bsr; struct resource *irq_res; struct fwohci_dbch{ u_int ndb; u_int ndesc; - caddr_t dummy; STAILQ_HEAD(, fwohcidb_tr) db_trq; struct fwohcidb_tr *top, *bottom, *pdb_tr; struct fw_xferq xferq; - struct { - int len; - int hlen; - int plen; - caddr_t buf; - } frag; int flags; #define FWOHCI_DBCH_INIT (1<<0) #define FWOHCI_DBCH_FULL (1<<1) - int buf_offset; + /* used only in receive context */ + int buf_offset; /* signed */ #define FWOHCI_DBCH_MAX_PAGES 32 - int npages; - void *pages[FWOHCI_DBCH_MAX_PAGES]; + /* Context programs buffer */ + struct fwdma_alloc_multi *am; + bus_dma_tag_t dmat; } arrq, arrs, atrq, atrs, it[OHCI_DMA_ITCH], ir[OHCI_DMA_IRCH]; u_int maxrec; - u_int32_t *cromptr; - u_int32_t intmask; + u_int32_t *sid_buf; + struct fwdma_alloc sid_dma; + struct fwdma_alloc crom_dma; + struct fwdma_alloc dummy_dma; + u_int32_t intmask, irstat, itstat; +#if FWOHCI_TASKQUEUE + u_int32_t intstat; + struct task fwohci_task_complete; +#endif } fwohci_softc_t; + void fwohci_intr __P((void *arg)); int fwohci_init __P((struct fwohci_softc *, device_t)); void fwohci_reset __P((struct fwohci_softc *, device_t)); diff --git a/sys/dev/firewire/iec13213.h b/sys/dev/firewire/iec13213.h index 1e4e8cd72289..efd51aabb8eb 100644 --- a/sys/dev/firewire/iec13213.h +++ b/sys/dev/firewire/iec13213.h @@ -1,4 +1,5 @@ /* + * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. * @@ -66,65 +67,90 @@ #define CSRKEY_DID 0x20 /* Directory_ID */ #define CSRKEY_REV 0x21 /* Revision */ -#define CROM_TEXTLEAF (CSRTYPE_L | CSRKEY_DESC) /* 0x81 */ -#define CROM_LUN (CSRTYPE_I | CSRKEY_DINFO) /* 0x14 */ +#define CSRKEY_FIRM_VER 0x3c /* Firemware version */ +#define CSRKEY_UNIT_CH 0x3a /* Unit characteristics */ +#define CSRKEY_COM_SPEC 0x38 /* Command set revision */ +#define CSRKEY_COM_SET 0x39 /* Command set */ -/* ??? -#define CSRKEY_MVID 0x3 -#define CSRKEY_NUNQ 0x8d -#define CSRKEY_NPWR 0x30 -*/ +#define CROM_UDIR (CSRTYPE_D | CSRKEY_UNIT) /* 0x81 Unit directory */ +#define CROM_TEXTLEAF (CSRTYPE_L | CSRKEY_DESC) /* 0x81 Text leaf */ +#define CROM_LUN (CSRTYPE_I | CSRKEY_DINFO) /* 0x14 Logical unit num. */ +#define CROM_MGM (CSRTYPE_C | CSRKEY_DINFO) /* 0x54 Management agent */ -#define CSRVAL_1394TA 0x00a02d -#define CSRVAL_ANSIT10 0x00609e -#define CSR_PROTAVC 0x010001 -#define CSR_PROTCAL 0x010002 -#define CSR_PROTEHS 0x010004 -#define CSR_PROTHAVI 0x010008 -#define CSR_PROTCAM104 0x000100 -#define CSR_PROTCAM120 0x000101 -#define CSR_PROTCAM130 0x000102 -#define CSR_PROTDPP 0x0a6be2 -#define CSR_PROTIICP 0x4b661f +#define CSRVAL_1394TA 0x00a02d +#define CSRVAL_ANSIT10 0x00609e +#define CSRVAL_IETF 0x00005e -#define CSRVAL_T10SBP2 0x010483 +#define CSR_PROTAVC 0x010001 +#define CSR_PROTCAL 0x010002 +#define CSR_PROTEHS 0x010004 +#define CSR_PROTHAVI 0x010008 +#define CSR_PROTCAM104 0x000100 +#define CSR_PROTCAM120 0x000101 +#define CSR_PROTCAM130 0x000102 +#define CSR_PROTDPP 0x0a6be2 +#define CSR_PROTIICP 0x4b661f + +#define CSRVAL_T10SBP2 0x010483 +#define CSRVAL_SCSI 0x0104d8 struct csrreg { +#if BYTE_ORDER == BIG_ENDIAN + u_int32_t key:8, + val:24; +#else u_int32_t val:24, key:8; +#endif }; struct csrhdr { +#if BYTE_ORDER == BIG_ENDIAN + u_int32_t info_len:8, + crc_len:8, + crc:16; +#else u_int32_t crc:16, crc_len:8, info_len:8; +#endif }; struct csrdirectory { - u_int32_t crc:16, - crc_len:16; + BIT16x2(crc_len, crc); struct csrreg entry[0]; }; struct csrtext { - u_int32_t crc:16, - crc_len:16; + BIT16x2(crc_len, crc); +#if BYTE_ORDER == BIG_ENDIAN + u_int32_t spec_type:8, + spec_id:24; +#else u_int32_t spec_id:24, spec_type:8; +#endif u_int32_t lang_id; u_int32_t text[0]; }; -struct businfo { - u_int32_t crc:16, - crc_len:8, - :12, - max_rec:4, - clk_acc:8, - :4, - bmc:1, - isc:1, - cmc:1, - irmc:1; - u_int32_t c_id_hi:8, - v_id:24; - u_int32_t c_id_lo; + +struct bus_info { +#define CSR_BUS_NAME_IEEE1394 0x31333934 + u_int32_t bus_name; + u_int32_t link_spd:3, + :1, + generation:4, +#define MAXROM_4 0 +#define MAXROM_64 1 +#define MAXROM_1024 2 + max_rom:2, + :2, + max_rec:4, /* (2 << max_rec) bytes */ + cyc_clk_acc:8, /* 0 <= ppm <= 100 */ + :3, + pmc:1, /* power manager capable */ + bmc:1, /* bus manager capable */ + isc:1, /* iso. operation support */ + cmc:1, /* cycle master capable */ + irmc:1; /* iso. resource manager capable */ + struct fw_eui64 eui64; }; #define CROM_MAX_DEPTH 10 @@ -147,3 +173,33 @@ struct csrreg *crom_search_key(struct crom_context *, u_int8_t); #ifndef _KERNEL char *crom_desc(struct crom_context *, char *, int); #endif + +/* For CROM build */ +#if defined(_KERNEL) || defined(TEST) +#define CROM_MAX_CHUNK_LEN 20 +struct crom_src { + struct csrhdr hdr; + struct bus_info businfo; + STAILQ_HEAD(, crom_chunk) chunk_list; +}; + +struct crom_chunk { + STAILQ_ENTRY(crom_chunk) link; + struct crom_chunk *ref_chunk; + int ref_index; + int offset; + struct { + u_int32_t crc:16, + crc_len:16; + u_int32_t buf[CROM_MAX_CHUNK_LEN]; + } data; +}; + +extern int crom_add_quad(struct crom_chunk *, u_int32_t); +extern int crom_add_entry(struct crom_chunk *, int, int); +extern int crom_add_chunk(struct crom_src *src, struct crom_chunk *, + struct crom_chunk *, int); +extern int crom_add_simple_text(struct crom_src *src, struct crom_chunk *, + struct crom_chunk *, char *); +extern int crom_load(struct crom_src *, u_int32_t *, int); +#endif diff --git a/sys/dev/firewire/iec68113.h b/sys/dev/firewire/iec68113.h index 52a427049b38..2e47aab2216a 100644 --- a/sys/dev/firewire/iec68113.h +++ b/sys/dev/firewire/iec68113.h @@ -1,5 +1,6 @@ /* - * Copyright (c) 1998-2001 Katsushi Kobayashi and Hidetoshi Shimokawa + * Copyright (c) 2003 Hidetoshi Shimokawa + * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,29 +35,55 @@ * */ struct ciphdr { +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t eoh0:1, /* 0 */ + form0:1, /* 0 */ + src:6; +#else u_int8_t src:6, form0:1, /* 0 */ eoh0:1; /* 0 */ +#endif u_int8_t len; +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t fn:2, + qpc:3, + sph:1, + :2; +#else u_int8_t :2, sph:1, qpc:3, fn:2; +#endif u_int8_t dbc; +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t eoh1:1, /* 1 */ + form1:1, /* 0 */ + fmt:6; +#else u_int8_t fmt:6, -#define CIP_FMT_DVCR 0 -#define CIP_FMT_MPEG (1<<5) form1:1, /* 0 */ eoh1:1; /* 1 */ +#endif +#define CIP_FMT_DVCR 0 +#define CIP_FMT_MPEG (1<<5) union { struct { - u_int8_t :2, - stype:5, +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t fs:1, /* 50/60 field system + NTSC/PAL */ + stype:5, + :2; +#else + u_int8_t :2, + stype:5, + fs:1; /* 50/60 field system + NTSC/PAL */ +#endif #define CIP_STYPE_SD 0 #define CIP_STYPE_SDL 1 #define CIP_STYPE_HD 2 - fs:1; /* 50/60 field system - NTSC/PAL */ u_int16_t cyc:16; /* take care of byte order! */ } __attribute__ ((packed)) dv; u_int8_t bytes[3]; @@ -64,17 +91,29 @@ struct ciphdr { }; struct dvdbc{ +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t sct:3, /* Section type */ + :1, /* Reserved */ + arb:4; /* Arbitrary bit */ +#else u_int8_t arb:4, /* Arbitrary bit */ :1, /* Reserved */ sct:3; /* Section type */ +#endif #define DV_SCT_HEADER 0 #define DV_SCT_SUBCODE 1 #define DV_SCT_VAUX 2 #define DV_SCT_AUDIO 3 #define DV_SCT_VIDEO 4 +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t dseq:4, /* DIF sequence number */ + fsc:1, /* ID of a DIF block in each channel */ + :3; +#else u_int8_t :3, fsc:1, /* ID of a DIF block in each channel */ dseq:4; /* DIF sequence number */ +#endif u_int8_t dbn; /* DIF block number */ u_int8_t payload[77]; #define DV_DSF_12 0x80 /* PAL: payload[0] in Header DIF */ diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c index 2f54addd49e7..92b27f30e2ad 100644 --- a/sys/dev/firewire/if_fwe.c +++ b/sys/dev/firewire/if_fwe.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 + * Copyright (c) 2002-2003 * Hidetoshi Shimokawa. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -234,8 +235,8 @@ fwe_stop(struct fwe_softc *fwe) if (xferq->flag & FWXFERQ_RUNNING) fc->irx_disable(fc, fwe->dma_ch); xferq->flag &= - ~(FWXFERQ_MODEMASK | FWXFERQ_OPEN | - FWXFERQ_EXTBUF | FWXFERQ_HANDLER); + ~(FWXFERQ_MODEMASK | FWXFERQ_OPEN | FWXFERQ_STREAM | + FWXFERQ_EXTBUF | FWXFERQ_HANDLER | FWXFERQ_CHTAGMASK); xferq->hand = NULL; for (i = 0; i < xferq->bnchunk; i ++) @@ -284,6 +285,7 @@ fwe_init(void *arg) struct ifnet *ifp = &fwe->fwe_if; struct fw_xferq *xferq; struct fw_xfer *xfer; + struct mbuf *m; int i; FWEDEBUG("initializing %s%d\n", ifp->if_name, ifp->if_unit); @@ -309,19 +311,21 @@ fwe_init(void *arg) fwe->stream_ch = stream_ch; fwe->pkt_hdr.mode.stream.chtag = fwe->stream_ch; /* allocate DMA channel and init packet mode */ - xferq->flag |= FWXFERQ_OPEN | FWXFERQ_EXTBUF; + xferq->flag |= FWXFERQ_OPEN | FWXFERQ_EXTBUF | + FWXFERQ_HANDLER | FWXFERQ_STREAM; xferq->flag &= ~0xff; xferq->flag |= fwe->stream_ch & 0xff; /* register fwe_input handler */ xferq->sc = (caddr_t) fwe; xferq->hand = fwe_as_input; - xferq->flag |= FWXFERQ_HANDLER; xferq->bnchunk = RX_MAX_QUEUE; xferq->bnpacket = 1; xferq->psize = MCLBYTES; xferq->queued = 0; + xferq->buf = NULL; xferq->bulkxfer = (struct fw_bulkxfer *) malloc( - sizeof(struct fw_bulkxfer) * xferq->bnchunk, M_FWE, 0); + sizeof(struct fw_bulkxfer) * xferq->bnchunk, + M_FWE, M_WAITOK); if (xferq->bulkxfer == NULL) { printf("if_fwe: malloc failed\n"); return; @@ -331,23 +335,25 @@ fwe_init(void *arg) STAILQ_INIT(&xferq->stdma); xferq->stproc = NULL; for (i = 0; i < xferq->bnchunk; i ++) { - xferq->bulkxfer[i].mbuf = + m = #if __FreeBSD_version >= 500000 m_getcl(M_TRYWAIT, MT_DATA, M_PKTHDR); #else m_getcl(M_WAIT, MT_DATA, M_PKTHDR); #endif - xferq->bulkxfer[i].buf = - mtod(xferq->bulkxfer[i].mbuf, char *); - STAILQ_INSERT_TAIL(&xferq->stfree, - &xferq->bulkxfer[i], link); + xferq->bulkxfer[i].mbuf = m; + if (m != NULL) { + m->m_len = m->m_pkthdr.len = m->m_ext.ext_size; + STAILQ_INSERT_TAIL(&xferq->stfree, + &xferq->bulkxfer[i], link); + } else + printf("fwe_as_input: m_getcl failed\n"); } STAILQ_INIT(&fwe->xferlist); for (i = 0; i < TX_MAX_QUEUE; i++) { xfer = fw_xfer_alloc(M_FWE); if (xfer == NULL) break; - xfer->send.off = 0; xfer->spd = 2; xfer->fc = fwe->fd.fc; xfer->retry_req = fw_asybusy; @@ -446,21 +452,15 @@ fwe_output_callback(struct fw_xfer *xfer) m_freem(xfer->mbuf); xfer->send.buf = NULL; -#if 0 fw_xfer_unload(xfer); -#else - xfer->state = FWXF_INIT; - xfer->resp = 0; - xfer->retry = 0; -#endif + s = splimp(); STAILQ_INSERT_TAIL(&fwe->xferlist, xfer, link); splx(s); -#if 1 - /* XXX for queue full */ + + /* for queue full */ if (ifp->if_snd.ifq_head != NULL) fwe_start(ifp); -#endif } static void @@ -469,7 +469,6 @@ fwe_start(struct ifnet *ifp) struct fwe_softc *fwe = ((struct fwe_eth_softc *)ifp->if_softc)->fwe; int s; -#if 1 FWEDEBUG("%s%d starting\n", ifp->if_name, ifp->if_unit); if (fwe->dma_ch < 0) { @@ -489,7 +488,6 @@ fwe_start(struct ifnet *ifp) return; } -#endif s = splimp(); ifp->if_flags |= IFF_OACTIVE; @@ -537,7 +535,7 @@ fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp) M_PREPEND(m, ETHER_ALIGN, M_DONTWAIT); fp = (struct fw_pkt *)&xfer->dst; /* XXX */ xfer->dst = *((int32_t *)&fwe->pkt_hdr); - fp->mode.stream.len = htons(m->m_pkthdr.len); + fp->mode.stream.len = m->m_pkthdr.len; xfer->send.buf = (caddr_t) fp; xfer->mbuf = m; xfer->send.len = m->m_pkthdr.len + HDR_LEN; @@ -560,44 +558,11 @@ fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp) xferq->start(fwe->fd.fc); } -#if 0 -#if __FreeBSD_version >= 500000 -static void -fwe_free(void *buf, void *args) -{ - FWEDEBUG("fwe_free:\n"); - free(buf, M_FW); -} - -#else -static void -fwe_free(caddr_t buf, u_int size) -{ - int *p; - FWEDEBUG("fwe_free:\n"); - p = (int *)buf; - (*p) --; - if (*p < 1) - free(buf, M_FW); -} - -static void -fwe_ref(caddr_t buf, u_int size) -{ - int *p; - - FWEDEBUG("fwe_ref: called\n"); - p = (int *)buf; - (*p) ++; -} -#endif -#endif - /* Async. stream output */ static void fwe_as_input(struct fw_xferq *xferq) { - struct mbuf *m; + struct mbuf *m, *m0; struct ifnet *ifp; struct fwe_softc *fwe; struct fw_bulkxfer *sxfer; @@ -614,21 +579,21 @@ fwe_as_input(struct fw_xferq *xferq) #endif while ((sxfer = STAILQ_FIRST(&xferq->stvalid)) != NULL) { STAILQ_REMOVE_HEAD(&xferq->stvalid, link); -#if 0 - xferq->queued --; -#endif if (sxfer->resp != 0) ifp->if_ierrors ++; - fp = (struct fw_pkt *)sxfer->buf; + fp = mtod(sxfer->mbuf, struct fw_pkt *); /* XXX */ if (fwe->fd.fc->irx_post != NULL) fwe->fd.fc->irx_post(fwe->fd.fc, fp->mode.ld); m = sxfer->mbuf; /* insert rbuf */ - sxfer->mbuf = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - sxfer->buf = mtod(sxfer->mbuf, char *); - STAILQ_INSERT_TAIL(&xferq->stfree, sxfer, link); + sxfer->mbuf = m0 = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m0 != NULL) { + m0->m_len = m0->m_pkthdr.len = m0->m_ext.ext_size; + STAILQ_INSERT_TAIL(&xferq->stfree, sxfer, link); + } else + printf("fwe_as_input: m_getcl failed\n"); m->m_data += HDR_LEN + ETHER_ALIGN; c = mtod(m, char *); @@ -637,7 +602,7 @@ fwe_as_input(struct fw_xferq *xferq) m->m_data += sizeof(struct ether_header); #endif m->m_len = m->m_pkthdr.len = - ntohs(fp->mode.stream.len) - ETHER_ALIGN; + fp->mode.stream.len - ETHER_ALIGN; m->m_pkthdr.rcvif = ifp; #if 0 FWEDEBUG("%02x %02x %02x %02x %02x %02x\n" diff --git a/sys/dev/firewire/if_fwevar.h b/sys/dev/firewire/if_fwevar.h index 6eb6ff7f85f2..97422168621b 100644 --- a/sys/dev/firewire/if_fwevar.h +++ b/sys/dev/firewire/if_fwevar.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002 + * Copyright (c) 2002-2003 * Hidetoshi Shimokawa. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index 307b46607022..90783cf88d9e 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -1,5 +1,6 @@ /* - * Copyright (c) 1998,1999,2000,2001 Katsushi Kobayashi and Hidetosh Shimokawa + * Copyright (c) 2003 Hidetosh Shimokawa + * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetosh Shimokawa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -60,11 +61,9 @@ #include -#include -#include - #include #include +#include #include #define ccb_sdev_ptr spriv_ptr0 @@ -72,8 +71,11 @@ #define SBP_NUM_TARGETS 8 /* MAX 64 */ #define SBP_NUM_LUNS 8 /* limited by CAM_SCSI2_MAXLUN in cam_xpt.c */ -#define SBP_QUEUE_LEN 4 +#define SBP_DMA_SIZE PAGE_SIZE +#define SBP_LOGIN_SIZE sizeof(struct sbp_login_res) +#define SBP_QUEUE_LEN ((SBP_DMA_SIZE - SBP_LOGIN_SIZE) / sizeof(struct sbp_ocb)) #define SBP_NUM_OCB (SBP_QUEUE_LEN * SBP_NUM_TARGETS) + #define SBP_INITIATOR 7 #define LOGIN_DELAY 2 @@ -168,20 +170,29 @@ SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, max_speed, CTLFLAG_RW, &max_speed, 0, struct ind_ptr { u_int32_t hi,lo; }; -#define SBP_IND_MAX 0x20 +#define SBP_SEG_MAX rounddown(0xffff, PAGE_SIZE) +#ifdef __sparc64__ /* iommu */ +#define SBP_IND_MAX howmany(MAXPHYS, SBP_SEG_MAX) +#else +#define SBP_IND_MAX howmany(MAXPHYS, PAGE_SIZE) +#endif struct sbp_ocb { STAILQ_ENTRY(sbp_ocb) ocb; union ccb *ccb; + bus_addr_t bus_addr; volatile u_int32_t orb[8]; +#define IND_PTR_OFFSET (8*sizeof(u_int32_t)) volatile struct ind_ptr ind_ptr[SBP_IND_MAX]; struct sbp_dev *sdev; - int flags; + int flags; /* XXX should be removed */ bus_dmamap_t dmamap; }; + #define OCB_ACT_MGM 0 #define OCB_ACT_CMD 1 -#define OCB_MATCH(o,s) (vtophys(&(o)->orb[0]) == ntohl((s)->orb_lo)) +#define OCB_MATCH(o,s) ((o)->bus_addr == ntohl((s)->orb_lo)) +#define SBP_RECV_LEN (16 + 32) /* header + payload */ struct sbp_login_res{ u_int16_t len; @@ -193,11 +204,18 @@ struct sbp_login_res{ u_int16_t recon_hold; }; struct sbp_status{ +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t src:2, + resp:2, + dead:1, + len:3; +#else u_int8_t len:3, dead:1, resp:2, src:2; - u_int8_t status:8; +#endif + u_int8_t status; u_int16_t orb_hi; u_int32_t orb_lo; u_int32_t data[6]; @@ -205,6 +223,15 @@ struct sbp_status{ struct sbp_cmd_status{ #define SBP_SFMT_CURR 0 #define SBP_SFMT_DEFER 1 +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t sfmt:2, + status:6; + u_int8_t valid:1, + mark:1, + eom:1, + ill_len:1, + s_key:4; +#else u_int8_t status:6, sfmt:2; u_int8_t s_key:4, @@ -212,13 +239,21 @@ struct sbp_cmd_status{ eom:1, mark:1, valid:1; +#endif u_int8_t s_code; u_int8_t s_qlfr; u_int32_t info; u_int32_t cdb; + +#if BYTE_ORDER == BIG_ENDIAN + u_int32_t s_keydep:24, + fru:8; +#else u_int32_t fru:8, s_keydep:24; +#endif u_int32_t vend[2]; + }; struct sbp_dev{ @@ -240,9 +275,12 @@ struct sbp_dev{ int freeze; struct cam_path *path; struct sbp_target *target; - struct sbp_login_res login; + struct fwdma_alloc dma; + struct sbp_login_res *login; struct callout login_callout; + struct sbp_ocb *ocb; STAILQ_HEAD(, sbp_ocb) ocbs; + STAILQ_HEAD(, sbp_ocb) free_ocbs; char vendor[32]; char product[32]; char revision[10]; @@ -260,6 +298,8 @@ struct sbp_target { struct callout mgm_ocb_timeout; #define SCAN_DELAY 2 struct callout scan_callout; + STAILQ_HEAD(, fw_xfer) xferlist; + int n_xfer; }; struct sbp_softc { @@ -268,8 +308,6 @@ struct sbp_softc { struct cam_path *path; struct sbp_target targets[SBP_NUM_TARGETS]; struct fw_bind fwb; - STAILQ_HEAD(, sbp_ocb) free_ocbs; - struct sbp_ocb *ocb; bus_dma_tag_t dmat; #define SBP_RESOURCE_SHORTAGE 0x10 unsigned char flags; @@ -280,11 +318,11 @@ static void sbp_login_callback __P((struct fw_xfer *)); static void sbp_cmd_callback __P((struct fw_xfer *)); static void sbp_orb_pointer __P((struct sbp_dev *, struct sbp_ocb *)); static void sbp_execute_ocb __P((void *, bus_dma_segment_t *, int, int)); -static void sbp_free_ocb __P((struct sbp_softc *, struct sbp_ocb *)); +static void sbp_free_ocb __P((struct sbp_dev *, struct sbp_ocb *)); static void sbp_abort_ocb __P((struct sbp_ocb *, int)); static void sbp_abort_all_ocbs __P((struct sbp_dev *, int)); static struct fw_xfer * sbp_write_cmd __P((struct sbp_dev *, int, int)); -static struct sbp_ocb * sbp_get_ocb __P((struct sbp_softc *)); +static struct sbp_ocb * sbp_get_ocb __P((struct sbp_dev *)); static struct sbp_ocb * sbp_enqueue_ocb __P((struct sbp_dev *, struct sbp_ocb *)); static struct sbp_ocb * sbp_dequeue_ocb __P((struct sbp_dev *, struct sbp_status *)); static void sbp_cam_detach_target __P((struct sbp_target *)); @@ -500,6 +538,8 @@ END_DEBUG SBP_DEBUG(1) printf("target:%d mgm_port: %x\n", i, target->mgm_lo); END_DEBUG + STAILQ_INIT(&target->xferlist); + target->n_xfer = 0; STAILQ_INIT(&target->mgm_ocb_queue); CALLOUT_INIT(&target->mgm_ocb_timeout); CALLOUT_INIT(&target->scan_callout); @@ -546,8 +586,38 @@ END_DEBUG printf("too large lun %d\n", lun); continue; } - target->luns[lun].status = SBP_DEV_RESET; - target->luns[lun].type = (reg->val & 0xf0000) >> 16; + sdev = &target->luns[lun]; + sdev->status = SBP_DEV_RESET; + sdev->type = (reg->val & 0xf0000) >> 16; + + fwdma_malloc(sbp->fd.fc, + /* alignment */ sizeof(u_int32_t), + SBP_DMA_SIZE, &sdev->dma, BUS_DMA_NOWAIT); + if (sdev->dma.v_addr == NULL) { + printf("%s: dma space allocation failed\n", + __FUNCTION__); + return (NULL); + } + sdev->login = (struct sbp_login_res *) sdev->dma.v_addr; + sdev->ocb = (struct sbp_ocb *) + ((char *)sdev->dma.v_addr + SBP_LOGIN_SIZE); + bzero((char *)sdev->ocb, + sizeof (struct sbp_ocb) * SBP_QUEUE_LEN); + + STAILQ_INIT(&sdev->free_ocbs); + for (i = 0; i < SBP_QUEUE_LEN; i++) { + struct sbp_ocb *ocb; + ocb = &sdev->ocb[i]; + ocb->bus_addr = sdev->dma.bus_addr + + SBP_LOGIN_SIZE + + sizeof(struct sbp_ocb) * i + + offsetof(struct sbp_ocb, orb[0]); + if (bus_dmamap_create(sbp->dmat, 0, &ocb->dmamap)) { + printf("sbp_attach: cannot create dmamap\n"); + return (NULL); + } + sbp_free_ocb(sdev, ocb); + } crom_next(&cc); } return target; @@ -644,23 +714,15 @@ END_DEBUG sbp_probe_lun(sdev); SBP_DEBUG(0) sbp_show_sdev_info(sdev, -#if 0 - (sdev->status == SBP_DEV_TOATTACH)); -#else (sdev->status == SBP_DEV_RESET)); -#endif END_DEBUG sbp_abort_all_ocbs(sdev, CAM_SCSI_BUS_RESET); switch (sdev->status) { case SBP_DEV_RESET: /* new or revived target */ - if (auto_login) { -#if 0 - sdev->status = SBP_DEV_TOATTACH; -#endif + if (auto_login) sbp_login(sdev); - } break; case SBP_DEV_TOATTACH: case SBP_DEV_PROBE: @@ -698,6 +760,17 @@ END_DEBUG } } +static void +sbp_post_busreset(void *arg) +{ + struct sbp_softc *sbp; + + sbp = (struct sbp_softc *)arg; +SBP_DEBUG(0) + printf("sbp_post_busreset\n"); +END_DEBUG +} + static void sbp_post_explore(void *arg) { @@ -767,25 +840,39 @@ END_DEBUG } sbp_probe_target((void *)target); } -#if 0 - timeout(sbp_release_queue, (caddr_t)sbp, bus_reset_rest * hz / 1000); -#endif } #if NEED_RESPONSE static void sbp_loginres_callback(struct fw_xfer *xfer){ -SBP_DEBUG(1) + int s; struct sbp_dev *sdev; sdev = (struct sbp_dev *)xfer->sc; +SBP_DEBUG(1) sbp_show_sdev_info(sdev, 2); printf("sbp_loginres_callback\n"); END_DEBUG - fw_xfer_free(xfer); + /* recycle */ + s = splfw(); + STAILQ_INSERT_TAIL(&sdev->target->sbp->fwb.xferlist, xfer, link); + splx(s); return; } #endif +static __inline void +sbp_xfer_free(struct fw_xfer *xfer) +{ + struct sbp_dev *sdev; + int s; + + sdev = (struct sbp_dev *)xfer->sc; + fw_xfer_unload(xfer); + s = splfw(); + STAILQ_INSERT_TAIL(&sdev->target->xferlist, xfer, link); + splx(s); +} + static void sbp_login_callback(struct fw_xfer *xfer) { @@ -795,7 +882,7 @@ SBP_DEBUG(1) sbp_show_sdev_info(sdev, 2); printf("sbp_login_callback\n"); END_DEBUG - fw_xfer_free(xfer); + sbp_xfer_free(xfer); return; } @@ -808,7 +895,7 @@ SBP_DEBUG(2) sbp_show_sdev_info(sdev, 2); printf("sbp_cmd_callback\n"); END_DEBUG - fw_xfer_free(xfer); + sbp_xfer_free(xfer); return; } @@ -895,101 +982,6 @@ END_DEBUG sdev->freeze = 1; } - -#if 0 -static void -sbp_ping_unit_callback(struct cam_periph *periph, union ccb *ccb) -{ - struct sbp_dev *sdev; - sdev = (struct sbp_dev *) ccb->ccb_h.ccb_sdev_ptr; -SBP_DEBUG(0) - sbp_show_sdev_info(sdev, 2); - printf("sbp_ping_unit_callback\n"); -END_DEBUG - if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - if (--ccb->ccb_h.retry_count == 0) { - sbp_show_sdev_info(sdev, 2); - printf("sbp_ping_unit_callback: " - "retry count exceeded\n"); - sdev->status = SBP_DEV_RETRY; - free(ccb, M_SBP); - } else { - /* requeue */ - xpt_action(ccb); - xpt_release_devq(sdev->path, sdev->freeze, TRUE); - sdev->freeze = 1; /* we will freeze */ - } - } else { - free(ccb->csio.data_ptr, M_SBP); - free(ccb, M_SBP); - sdev->status = SBP_DEV_ATTACHED; - xpt_release_devq(sdev->path, sdev->freeze, TRUE); - sdev->freeze = 0; - } -} - -/* - * XXX Some devices need to execute inquiry or read_capacity - * after bus_rest during busy transfer. - * Otherwise they return incorrect result for READ(and WRITE?) - * command without any SBP-II/SCSI error. - * - * e.g. Maxtor 3000XT, Yano A-dish. - */ -static void -sbp_ping_unit(struct sbp_dev *sdev) -{ - union ccb *ccb; - struct scsi_inquiry_data *inq_buf; - - - ccb = malloc(sizeof(union ccb), M_SBP, M_NOWAIT | M_ZERO); - if (ccb == NULL) { - printf("sbp_ping_unit: malloc failed\n"); - return; - } - - inq_buf = (struct scsi_inquiry_data *) - malloc(sizeof(*inq_buf), M_SBP, M_NOWAIT); - if (inq_buf == NULL) { - free(ccb, M_SBP); - printf("sbp_ping_unit: malloc failed\n"); - return; - } - -SBP_DEBUG(0) - sbp_show_sdev_info(sdev, 2); - printf("sbp_ping_unit\n"); -END_DEBUG - - /* - * We need to execute this command before any other queued command. - * Make priority 0 and freeze the queue after execution for retry. - * cam's scan_lun command doesn't provide this feature. - */ - xpt_setup_ccb(&ccb->ccb_h, sdev->path, 0/*priority (high)*/); - scsi_inquiry( - &ccb->csio, - /*retries*/ 5, - sbp_ping_unit_callback, - MSG_SIMPLE_Q_TAG, - (u_int8_t *)inq_buf, - SHORT_INQUIRY_LENGTH, - /*evpd*/FALSE, - /*page_code*/0, - SSD_MIN_SIZE, - /*timeout*/60000 - ); - ccb->ccb_h.flags |= CAM_DEV_QFREEZE; - ccb->ccb_h.ccb_sdev_ptr = sdev; - xpt_action(ccb); - if (sdev->status != SBP_DEV_ATTACHED) - sdev->status = SBP_DEV_PROBE; - xpt_release_devq(sdev->path, sdev->freeze, TRUE); - sdev->freeze = 1; /* We will freeze the queue */ -} -#endif - static __inline void sbp_scan_dev(struct sbp_dev *sdev) { @@ -1012,7 +1004,7 @@ SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); printf("sbp_do_attach\n"); END_DEBUG - fw_xfer_free(xfer); + sbp_xfer_free(xfer); if (sdev->path == NULL) xpt_create_path(&sdev->path, xpt_periph, @@ -1043,7 +1035,7 @@ SBP_DEBUG(1) sbp_show_sdev_info(sdev, 2); printf("sbp_cmd_callback\n"); END_DEBUG - fw_xfer_free(xfer); + sbp_xfer_free(xfer); if (sdev->path) { xpt_release_devq(sdev->path, sdev->freeze, TRUE); sdev->freeze = 0; @@ -1083,7 +1075,7 @@ SBP_DEBUG(1) sbp_show_sdev_info(sdev, 2); printf("sbp_busy_timeout_callback\n"); END_DEBUG - fw_xfer_free(xfer); + sbp_xfer_free(xfer); sbp_agent_reset(sdev); } @@ -1100,8 +1092,8 @@ END_DEBUG xfer->act.hand = sbp_busy_timeout_callback; fp = (struct fw_pkt *)xfer->send.buf; - fp->mode.wreqq.dest_hi = htons(0xffff); - fp->mode.wreqq.dest_lo = htonl(0xf0000000 | BUSY_TIMEOUT); + fp->mode.wreqq.dest_hi = 0xffff; + fp->mode.wreqq.dest_lo = 0xf0000000 | BUSY_TIMEOUT; fp->mode.wreqq.data = htonl((1 << (13+12)) | 0xf); fw_asyreq(xfer->fc, -1, xfer); } @@ -1121,8 +1113,8 @@ END_DEBUG xfer->act.hand = sbp_busy_timeout; fp = (struct fw_pkt *)xfer->send.buf; - fp->mode.wreqq.dest_hi = htons(0xffff); - fp->mode.wreqq.dest_lo = htonl(0xf0000000 | RESET_START); + fp->mode.wreqq.dest_hi = 0xffff; + fp->mode.wreqq.dest_lo = 0xf0000000 | RESET_START; fp->mode.wreqq.data = htonl(0xf); fw_asyreq(xfer->fc, -1, xfer); } @@ -1144,14 +1136,14 @@ END_DEBUG xfer->act.hand = sbp_cmd_callback; fp = (struct fw_pkt *)xfer->send.buf; - fp->mode.wreqb.len = htons(8); + fp->mode.wreqb.len = 8; fp->mode.wreqb.extcode = 0; fp->mode.wreqb.payload[0] = htonl(((sdev->target->sbp->fd.fc->nodeid | FWLOCALBUS )<< 16)); - fp->mode.wreqb.payload[1] = htonl(vtophys(&ocb->orb[0])); + fp->mode.wreqb.payload[1] = htonl(ocb->bus_addr); if(fw_asyreq(xfer->fc, -1, xfer) != 0){ - fw_xfer_free(xfer); + sbp_xfer_free(xfer); ocb->ccb->ccb_h.status = CAM_REQ_INVALID; xpt_done(ocb->ccb); } @@ -1183,36 +1175,55 @@ sbp_write_cmd(struct sbp_dev *sdev, int tcode, int offset) { struct fw_xfer *xfer; struct fw_pkt *fp; + struct sbp_target *target; + int s, new = 0; - xfer = fw_xfer_alloc(M_SBP); - if(xfer == NULL){ - return NULL; + target = sdev->target; + s = splfw(); + xfer = STAILQ_FIRST(&target->xferlist); + if (xfer == NULL) { + if (target->n_xfer > 5 /* XXX */) { + printf("sbp: no more xfer for this target\n"); + splx(s); + return(NULL); + } + xfer = fw_xfer_alloc_buf(M_SBP, 24, 12); + if(xfer == NULL){ + printf("sbp: fw_xfer_alloc_buf failed\n"); + splx(s); + return NULL; + } + target->n_xfer ++; + if (debug) + printf("sbp: alloc %d xfer\n", target->n_xfer); + new = 1; + } else { + STAILQ_REMOVE_HEAD(&target->xferlist, link); } + splx(s); + + microtime(&xfer->tv); + if (tcode == FWTCODE_WREQQ) xfer->send.len = 16; else xfer->send.len = 24; + xfer->recv.len = 12; - xfer->send.buf = malloc(xfer->send.len, M_FW, M_NOWAIT); - if(xfer->send.buf == NULL){ - fw_xfer_free(xfer); - return NULL; + if (new) { + xfer->spd = min(sdev->target->fwdev->speed, max_speed); + xfer->fc = sdev->target->sbp->fd.fc; + xfer->retry_req = fw_asybusy; } - - xfer->send.off = 0; - xfer->spd = min(sdev->target->fwdev->speed, max_speed); xfer->sc = (caddr_t)sdev; - xfer->fc = sdev->target->sbp->fd.fc; - xfer->retry_req = fw_asybusy; - fp = (struct fw_pkt *)xfer->send.buf; - fp->mode.wreqq.dest_hi = htons(sdev->login.cmd_hi); - fp->mode.wreqq.dest_lo = htonl(sdev->login.cmd_lo + offset); + fp->mode.wreqq.dest_hi = sdev->login->cmd_hi; + fp->mode.wreqq.dest_lo = sdev->login->cmd_lo + offset; fp->mode.wreqq.tlrt = 0; fp->mode.wreqq.tcode = tcode; fp->mode.wreqq.pri = 0; xfer->dst = FWLOCALBUS | sdev->target->fwdev->dst; - fp->mode.wreqq.dst = htons(xfer->dst); + fp->mode.wreqq.dst = xfer->dst; return xfer; @@ -1240,8 +1251,7 @@ sbp_mgm_orb(struct sbp_dev *sdev, int func, struct sbp_ocb *aocb) STAILQ_REMOVE_HEAD(&target->mgm_ocb_queue, ocb); goto start; } - if ((ocb = sbp_get_ocb(target->sbp)) == NULL) { - target->sbp->flags |= SBP_RESOURCE_SHORTAGE; + if ((ocb = sbp_get_ocb(sdev)) == NULL) { splx(s); return; } @@ -1262,20 +1272,21 @@ END_DEBUG switch (func) { case ORB_FUN_LGI: ocb->orb[2] = htonl(nid << 16); - ocb->orb[3] = htonl(vtophys(&sdev->login)); + ocb->orb[3] = htonl(sdev->dma.bus_addr); ocb->orb[4] = htonl(ORB_NOTIFY | ORB_EXV | sdev->lun_id); - ocb->orb[5] = htonl(sizeof(struct sbp_login_res)); + ocb->orb[5] = htonl(SBP_LOGIN_SIZE); + fwdma_sync(&sdev->dma, BUS_DMASYNC_PREREAD); break; case ORB_FUN_ATA: ocb->orb[0] = htonl((0 << 16) | 0); - ocb->orb[1] = htonl(vtophys(&aocb->orb[0])); + ocb->orb[1] = htonl(aocb->bus_addr & 0xffffffff); /* fall through */ case ORB_FUN_RCN: case ORB_FUN_LGO: case ORB_FUN_LUR: case ORB_FUN_RST: case ORB_FUN_ATS: - ocb->orb[4] = htonl(ORB_NOTIFY | func | sdev->login.id); + ocb->orb[4] = htonl(ORB_NOTIFY | func | sdev->login->id); break; } @@ -1298,12 +1309,12 @@ start: xfer->act.hand = sbp_login_callback; fp = (struct fw_pkt *)xfer->send.buf; - fp->mode.wreqb.dest_hi = htons(sdev->target->mgm_hi); - fp->mode.wreqb.dest_lo = htonl(sdev->target->mgm_lo); - fp->mode.wreqb.len = htons(8); + fp->mode.wreqb.dest_hi = sdev->target->mgm_hi; + fp->mode.wreqb.dest_lo = sdev->target->mgm_lo; + fp->mode.wreqb.len = 8; fp->mode.wreqb.extcode = 0; fp->mode.wreqb.payload[0] = htonl(nid << 16); - fp->mode.wreqb.payload[1] = htonl(vtophys(&ocb->orb[0])); + fp->mode.wreqb.payload[1] = htonl(ocb->bus_addr); fw_asyreq(xfer->fc, -1, xfer); } @@ -1348,7 +1359,7 @@ SBP_DEBUG(0) sbp_print_scsi_cmd(ocb); /* XXX need decode status */ sbp_show_sdev_info(ocb->sdev, 2); - printf("SCSI status %x sfmt %x valid %x key %x code %x qlfr %x len %d", + printf("SCSI status %x sfmt %x valid %x key %x code %x qlfr %x len %d\n", sbp_cmd_status->status, sbp_cmd_status->sfmt, sbp_cmd_status->valid, @@ -1357,20 +1368,6 @@ SBP_DEBUG(0) sbp_cmd_status->s_qlfr, sbp_status->len ); -#if 0 /* XXX */ - if (sbp_cmd_status->status == SCSI_STATUS_CHECK_COND) { - printf(" %s\n", scsi_sense_key_text[sbp_cmd_status->s_key]); - scsi_sense_desc( - sbp_cmd_status->s_code, - sbp_cmd_status->s_qlfr, - ocb->ccb->ccb_h.path->device->inq_data - ) - } else { - printf("\n"); - } -#else - printf("\n"); -#endif END_DEBUG switch (sbp_cmd_status->status) { @@ -1485,7 +1482,8 @@ END_DEBUG } static void -sbp_recv1(struct fw_xfer *xfer){ +sbp_recv1(struct fw_xfer *xfer) +{ struct fw_pkt *rfp; #if NEED_RESPONSE struct fw_pkt *sfp; @@ -1506,25 +1504,24 @@ printf("sbp %x %d %d %08x %08x %08x %08x\n", printf("sbp %08x %08x %08x %08x\n", ntohl(ld[4]), ntohl(ld[5]), ntohl(ld[6]), ntohl(ld[7])); printf("sbp %08x %08x %08x %08x\n", ntohl(ld[8]), ntohl(ld[9]), ntohl(ld[10]), ntohl(ld[11])); */ + + sbp = (struct sbp_softc *)xfer->sc; if(xfer->resp != 0){ printf("sbp_recv: xfer->resp != 0\n"); - fw_xfer_free( xfer); - return; + goto done0; } if(xfer->recv.buf == NULL){ printf("sbp_recv: xfer->recv.buf == NULL\n"); - fw_xfer_free( xfer); - return; + goto done0; } sbp = (struct sbp_softc *)xfer->sc; rfp = (struct fw_pkt *)xfer->recv.buf; if(rfp->mode.wreqb.tcode != FWTCODE_WREQB){ printf("sbp_recv: tcode = %d\n", rfp->mode.wreqb.tcode); - fw_xfer_free( xfer); - return; + goto done0; } sbp_status = (struct sbp_status *)rfp->mode.wreqb.payload; - addr = ntohl(rfp->mode.wreqb.dest_lo); + addr = rfp->mode.wreqb.dest_lo; SBP_DEBUG(2) printf("received address 0x%x\n", addr); END_DEBUG @@ -1532,16 +1529,14 @@ END_DEBUG if (t >= SBP_NUM_TARGETS) { device_printf(sbp->fd.dev, "sbp_recv1: invalid target %d\n", t); - fw_xfer_free(xfer); - return; + goto done0; } target = &sbp->targets[t]; l = SBP_ADDR2LUN(addr); if (l >= target->num_lun) { device_printf(sbp->fd.dev, "sbp_recv1: invalid lun %d (target=%d)\n", l, t); - fw_xfer_free(xfer); - return; + goto done0; } sdev = &target->luns[l]; @@ -1648,7 +1643,8 @@ END_DEBUG orb_fun = ntohl(ocb->orb[4]) & ORB_FUN_MSK; switch(orb_fun) { case ORB_FUN_LGI: - login_res = &sdev->login; + fwdma_sync(&sdev->dma, BUS_DMASYNC_POSTREAD); + login_res = sdev->login; login_res->len = ntohs(login_res->len); login_res->id = ntohs(login_res->id); login_res->cmd_hi = ntohs(login_res->cmd_hi); @@ -1658,14 +1654,7 @@ SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); printf("login: len %d, ID %d, cmd %08x%08x, recon_hold %d\n", login_res->len, login_res->id, login_res->cmd_hi, login_res->cmd_lo, ntohs(login_res->recon_hold)); END_DEBUG -#if 0 - sdev->status = SBP_DEV_TOATTACH; -#endif -#if 1 sbp_busy_timeout(sdev); -#else - sbp_mgm_orb(sdev, ORB_FUN_ATS, NULL); -#endif } else { /* forgot logout? */ sbp_show_sdev_info(sdev, 2); @@ -1674,7 +1663,7 @@ END_DEBUG } break; case ORB_FUN_RCN: - login_res = &sdev->login; + login_res = sdev->login; if (status_valid) { SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); @@ -1749,11 +1738,12 @@ printf("len %d\n", sbp_status->len); } } - sbp_free_ocb(sbp, ocb); + sbp_free_ocb(sdev, ocb); done: if (reset_agent) sbp_agent_reset(sdev); +done0: /* The received packet is usually small enough to be stored within * the buffer. In that case, the controller return ack_complete and * no respose is necessary. @@ -1762,12 +1752,10 @@ done: * ack_complete or ack_pending to upper driver. */ #if NEED_RESPONSE - xfer->send.buf = malloc(12, M_SBP, M_NOWAIT | M_ZERO); - xfer->send.len = 12; xfer->send.off = 0; sfp = (struct fw_pkt *)xfer->send.buf; sfp->mode.wres.dst = rfp->mode.wreqb.src; - xfer->dst = ntohs(sfp->mode.wres.dst); + xfer->dst = sfp->mode.wres.dst; xfer->spd = min(sdev->target->fwdev->speed, max_speed); xfer->act.hand = sbp_loginres_callback; xfer->retry_req = fw_asybusy; @@ -1779,7 +1767,9 @@ done: fw_asyreq(xfer->fc, -1, xfer); #else - fw_xfer_free(xfer); + /* recycle */ + xfer->recv.len = SBP_RECV_LEN; + STAILQ_INSERT_TAIL(&sbp->fwb.xferlist, xfer, link); #endif return; @@ -1816,8 +1806,9 @@ END_DEBUG bzero(sbp, sizeof(struct sbp_softc)); sbp->fd.dev = dev; sbp->fd.fc = device_get_ivars(dev); -#define SBP_SEG_MAX 0x8000 - error = bus_dma_tag_create(/*parent*/NULL, /*alignment*/1, + error = bus_dma_tag_create(/*parent*/sbp->fd.fc->dmat, + /* XXX shoud be 4 for sane backend? */ + /*alignment*/1, /*boundary*/0, /*lowaddr*/BUS_SPACE_MAXADDR_32BIT, /*highaddr*/BUS_SPACE_MAXADDR, @@ -1852,20 +1843,6 @@ END_DEBUG return (ENXIO); } - sbp->ocb = (struct sbp_ocb *) contigmalloc( - sizeof (struct sbp_ocb) * SBP_NUM_OCB, - M_SBP, M_NOWAIT, 0x10000, 0xffffffff, PAGE_SIZE, 0ul); - bzero(sbp->ocb, sizeof (struct sbp_ocb) * SBP_NUM_OCB); - - if (sbp->ocb == NULL) { - printf("sbp0: ocb alloction failure\n"); - return (ENOMEM); - } - - STAILQ_INIT(&sbp->free_ocbs); - for (i = 0; i < SBP_NUM_OCB; i++) { - sbp_free_ocb(sbp, &sbp->ocb[i]); - } if (xpt_bus_register(sbp->sim, /*bus*/0) != CAM_SUCCESS) goto fail; @@ -1874,21 +1851,31 @@ END_DEBUG CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) goto fail; - xfer = fw_xfer_alloc(M_SBP); - xfer->act.hand = sbp_recv; - xfer->act_type = FWACT_XFER; -#if NEED_RESPONSE - xfer->fc = sbp->fd.fc; -#endif - xfer->sc = (caddr_t)sbp; - sbp->fwb.start_hi = SBP_BIND_HI; sbp->fwb.start_lo = SBP_DEV2ADDR(device_get_unit(sbp->fd.dev), 0, 0); /* We reserve 16 bit space (4 bytes X 64 targets X 256 luns) */ sbp->fwb.addrlen = 0xffff; - sbp->fwb.xfer = xfer; + sbp->fwb.act_type = FWACT_XFER; + /* pre-allocate xfer */ + STAILQ_INIT(&sbp->fwb.xferlist); + for (i = 0; i < SBP_NUM_OCB/2; i ++) { + xfer = fw_xfer_alloc_buf(M_SBP, +#if NEED_RESPONSE + /* send */12, +#else + /* send */0, +#endif + /* recv */SBP_RECV_LEN); + xfer->act.hand = sbp_recv; +#if NEED_RESPONSE + xfer->fc = sbp->fd.fc; +#endif + xfer->sc = (caddr_t)sbp; + STAILQ_INSERT_TAIL(&sbp->fwb.xferlist, xfer, link); + } fw_bindadd(sbp->fd.fc, &sbp->fwb); + sbp->fd.post_busreset = sbp_post_busreset; sbp->fd.post_explore = sbp_post_explore; if (sbp->fd.fc->status != -1) { @@ -1900,7 +1887,6 @@ END_DEBUG return (0); fail: cam_sim_free(sbp->sim, /*free_devq*/TRUE); - contigfree(sbp->ocb, sizeof (struct sbp_ocb) * SBP_NUM_OCB, M_SBP); return (ENXIO); } @@ -1920,11 +1906,13 @@ END_DEBUG continue; for (j = 0; j < target->num_lun; j++) { sdev = &target->luns[j]; + callout_stop(&sdev->login_callout); if (sdev->status >= SBP_DEV_TOATTACH && sdev->status <= SBP_DEV_ATTACHED) sbp_mgm_orb(sdev, ORB_FUN_LGO, NULL); } } + return 0; } @@ -1942,33 +1930,56 @@ sbp_detach(device_t dev) { struct sbp_softc *sbp = ((struct sbp_softc *)device_get_softc(dev)); struct firewire_comm *fc = sbp->fd.fc; - int i; + struct sbp_target *target; + struct sbp_dev *sdev; + struct fw_xfer *xfer, *next; + int i, j; SBP_DEBUG(0) printf("sbp_detach\n"); END_DEBUG -#if 0 - /* bus reset for logout */ - sbp->fd.post_explore = NULL; - fc->ibr(fc); -#endif - + for (i = 0; i < SBP_NUM_TARGETS; i ++) sbp_cam_detach_target(&sbp->targets[i]); xpt_free_path(sbp->path); xpt_bus_deregister(cam_sim_path(sbp->sim)); sbp_logout_all(sbp); + /* XXX wait for logout completion */ tsleep(&i, FWPRI, "sbpdtc", hz/2); + for (i = 0 ; i < SBP_NUM_TARGETS ; i ++) { + target = &sbp->targets[i]; + if (target->luns == NULL) + continue; + callout_stop(&target->mgm_ocb_timeout); + for (j = 0; j < target->num_lun; j++) { + sdev = &target->luns[j]; + if (sdev->status != SBP_DEV_DEAD) { + for (i = 0; i < SBP_QUEUE_LEN; i++) + bus_dmamap_destroy(sbp->dmat, + sdev->ocb[i].dmamap); + fwdma_free(sbp->fd.fc, &sdev->dma); + } + } + for (xfer = STAILQ_FIRST(&target->xferlist); + xfer != NULL; xfer = next) { + next = STAILQ_NEXT(xfer, link); + fw_xfer_free(xfer); + } + free(target->luns, M_SBP); + } + + for (xfer = STAILQ_FIRST(&sbp->fwb.xferlist); + xfer != NULL; xfer = next) { + next = STAILQ_NEXT(xfer, link); + fw_xfer_free(xfer); + } + STAILQ_INIT(&sbp->fwb.xferlist); fw_bindremove(fc, &sbp->fwb); - contigfree(sbp->ocb, sizeof (struct sbp_ocb) * SBP_NUM_OCB, M_SBP); - bus_dma_tag_destroy(sbp->dmat); - for (i = 0; i < SBP_NUM_TARGETS; i ++) - if (sbp->targets[i].luns != NULL) - free(sbp->targets[i].luns, M_SBP); + bus_dma_tag_destroy(sbp->dmat); return (0); } @@ -1976,20 +1987,19 @@ END_DEBUG static void sbp_cam_detach_target(struct sbp_target *target) { - int i; struct sbp_dev *sdev; + int i; if (target->luns != NULL) { SBP_DEBUG(0) printf("sbp_detach_target %d\n", target->target_id); END_DEBUG callout_stop(&target->scan_callout); - callout_stop(&target->mgm_ocb_timeout); for (i = 0; i < target->num_lun; i++) { sdev = &target->luns[i]; - callout_stop(&sdev->login_callout); - if (sdev->status == SBP_DEV_RESET || - sdev->status == SBP_DEV_DEAD) + if (sdev->status == SBP_DEV_DEAD) + continue; + if (sdev->status == SBP_DEV_RESET) continue; if (sdev->path) { xpt_async(AC_LOST_DEVICE, sdev->path, NULL); @@ -2014,7 +2024,7 @@ sbp_timeout(void *arg) printf("management ORB\n"); /* XXX just ignore for now */ sdev->target->mgm_ocb_cur = NULL; - sbp_free_ocb(sdev->target->sbp, ocb); + sbp_free_ocb(sdev, ocb); sbp_mgm_orb(sdev, ORB_FUN_RUNQUEUE, NULL); return; } @@ -2023,17 +2033,8 @@ sbp_timeout(void *arg) sdev->freeze ++; sbp_abort_all_ocbs(sdev, CAM_CMD_TIMEOUT); if (sdev->flags & SBP_DEV_TIMEOUT) { -#if 0 - struct firewire_comm *fc; - - printf("bus reset\n"); - fc = sdev->target->sbp->fd.fc; - fc->ibr(fc); - sdev->status == SBP_DEV_RETRY; -#else printf("target reset\n"); sbp_mgm_orb(sdev, ORB_FUN_RST, NULL); -#endif sdev->flags &= ~SBP_DEV_TIMEOUT; } else { printf("agent reset\n"); @@ -2122,7 +2123,7 @@ END_DEBUG { struct ccb_scsiio *csio; struct sbp_ocb *ocb; - int s, speed; + int speed; void *cdb; csio = &ccb->csio; @@ -2166,12 +2167,9 @@ END_DEBUG } } #endif - if ((ocb = sbp_get_ocb(sbp)) == NULL) { - s = splfw(); - sbp->flags |= SBP_RESOURCE_SHORTAGE; - splx(s); + if ((ocb = sbp_get_ocb(sdev)) == NULL) return; - } + ocb->flags = OCB_ACT_CMD; ocb->sdev = sdev; ocb->ccb = ccb; @@ -2179,7 +2177,7 @@ END_DEBUG ocb->orb[0] = htonl(1 << 31); ocb->orb[1] = 0; ocb->orb[2] = htonl(((sbp->fd.fc->nodeid | FWLOCALBUS )<< 16) ); - ocb->orb[3] = htonl(vtophys(ocb->ind_ptr)); + ocb->orb[3] = htonl(ocb->bus_addr + IND_PTR_OFFSET); speed = min(target->fwdev->speed, max_speed); ocb->orb[4] = htonl(ORB_NOTIFY | ORB_CMD_SPD(speed) | ORB_CMD_MAXP(speed + 7)); @@ -2204,15 +2202,10 @@ printf("ORB %08x %08x %08x %08x\n", ntohl(ocb->orb[0]), ntohl(ocb->orb[1]), ntoh printf("ORB %08x %08x %08x %08x\n", ntohl(ocb->orb[4]), ntohl(ocb->orb[5]), ntohl(ocb->orb[6]), ntohl(ocb->orb[7])); */ if (ccb->csio.dxfer_len > 0) { - int s; - - if (bus_dmamap_create(sbp->dmat, 0, &ocb->dmamap)) { - printf("sbp_action1: cannot create dmamap\n"); - break; - } + int s, error; s = splsoftvm(); - bus_dmamap_load(/*dma tag*/sbp->dmat, + error = bus_dmamap_load(/*dma tag*/sbp->dmat, /*dma map*/ocb->dmamap, ccb->csio.data_ptr, ccb->csio.dxfer_len, @@ -2220,6 +2213,8 @@ printf("ORB %08x %08x %08x %08x\n", ntohl(ocb->orb[4]), ntohl(ocb->orb[5]), ntoh ocb, /*flags*/0); splx(s); + if (error) + printf("sbp: bus_dmamap_load error %d\n", error); } else sbp_execute_ocb(ocb, NULL, 0, 0); break; @@ -2348,13 +2343,25 @@ sbp_execute_ocb(void *arg, bus_dma_segment_t *segments, int seg, int error) int i; struct sbp_ocb *ocb; struct sbp_ocb *prev; - union ccb *ccb; bus_dma_segment_t *s; if (error) printf("sbp_execute_ocb: error=%d\n", error); ocb = (struct sbp_ocb *)arg; + +SBP_DEBUG(1) + printf("sbp_execute_ocb: seg %d", seg); + for (i = 0; i < seg; i++) +#if __FreeBSD_version >= 500000 + printf(", %tx:%zd", segments[i].ds_addr, +#else + printf(", %x:%d", segments[i].ds_addr, +#endif + segments[i].ds_len); + printf("\n"); +END_DEBUG + if (seg == 1) { /* direct pointer */ s = &segments[0]; @@ -2364,17 +2371,6 @@ sbp_execute_ocb(void *arg, bus_dma_segment_t *segments, int seg, int error) ocb->orb[4] |= htonl(s->ds_len); } else if(seg > 1) { /* page table */ -SBP_DEBUG(1) - printf("sbp_execute_ocb: seg %d", seg); - for (i = 0; i < seg; i++) -#if __FreeBSD_version >= 500000 - printf(", %tx:%zd", segments[i].ds_addr, -#else - printf(", %x:%d", segments[i].ds_addr, -#endif - segments[i].ds_len); - printf("\n"); -END_DEBUG for (i = 0; i < seg; i++) { s = &segments[i]; SBP_DEBUG(0) @@ -2396,8 +2392,12 @@ END_DEBUG ocb->orb[4] |= htonl(ORB_CMD_PTBL | seg); } - ccb = ocb->ccb; + if (seg > 0) + bus_dmamap_sync(ocb->sdev->target->sbp->dmat, ocb->dmamap, + (ntohl(ocb->orb[4]) & ORB_CMD_IN) ? + BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); prev = sbp_enqueue_ocb(ocb->sdev, ocb); + fwdma_sync(&ocb->sdev->dma, BUS_DMASYNC_PREWRITE); if (prev == NULL) sbp_orb_pointer(ocb->sdev, ocb); } @@ -2426,7 +2426,7 @@ SBP_DEBUG(1) #else printf("orb: 0x%x next: 0x%lx, flags %x\n", #endif - vtophys(&ocb->orb[0]), ntohl(ocb->orb[1]), flags); + ocb->bus_addr, ntohl(ocb->orb[1]), flags); END_DEBUG if (OCB_MATCH(ocb, sbp_status)) { /* found */ @@ -2434,10 +2434,14 @@ END_DEBUG if (ocb->ccb != NULL) untimeout(sbp_timeout, (caddr_t)ocb, ocb->ccb->ccb_h.timeout_ch); - if (ocb->dmamap != NULL) { - bus_dmamap_destroy(sdev->target->sbp->dmat, - ocb->dmamap); - ocb->dmamap = NULL; + if (ntohl(ocb->orb[4]) & 0xffff) { + bus_dmamap_sync(sdev->target->sbp->dmat, + ocb->dmamap, + (ntohl(ocb->orb[4]) & ORB_CMD_IN) ? + BUS_DMASYNC_POSTREAD : + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sdev->target->sbp->dmat, + ocb->dmamap); } if (next != NULL && sbp_status->src == 1) sbp_orb_pointer(sdev, next); @@ -2464,9 +2468,9 @@ sbp_enqueue_ocb(struct sbp_dev *sdev, struct sbp_ocb *ocb) SBP_DEBUG(2) sbp_show_sdev_info(sdev, 2); #if __FreeBSD_version >= 500000 - printf("sbp_enqueue_ocb orb=0x%tx in physical memory\n", vtophys(&ocb->orb[0])); + printf("sbp_enqueue_ocb orb=0x%tx in physical memory\n", ocb->bus_addr); #else - printf("sbp_enqueue_ocb orb=0x%x in physical memory\n", vtophys(&ocb->orb[0])); + printf("sbp_enqueue_ocb orb=0x%x in physical memory\n", ocb->bus_addr); #endif END_DEBUG prev = STAILQ_LAST(&sdev->ocbs, sbp_ocb, ocb); @@ -2479,13 +2483,13 @@ END_DEBUG if (prev != NULL ) { SBP_DEBUG(1) #if __FreeBSD_version >= 500000 - printf("linking chain 0x%tx -> 0x%tx\n", vtophys(&prev->orb[0]), + printf("linking chain 0x%tx -> 0x%tx\n", prev->bus_addr, #else - printf("linking chain 0x%x -> 0x%x\n", vtophys(&prev->orb[0]), + printf("linking chain 0x%x -> 0x%x\n", prev->bus_addr, #endif - vtophys(&ocb->orb[0])); + ocb->bus_addr); END_DEBUG - prev->orb[1] = htonl(vtophys(&ocb->orb[0])); + prev->orb[1] = htonl(ocb->bus_addr); prev->orb[0] = 0; } splx(s); @@ -2494,37 +2498,27 @@ END_DEBUG } static struct sbp_ocb * -sbp_get_ocb(struct sbp_softc *sbp) +sbp_get_ocb(struct sbp_dev *sdev) { struct sbp_ocb *ocb; int s = splfw(); - ocb = STAILQ_FIRST(&sbp->free_ocbs); + ocb = STAILQ_FIRST(&sdev->free_ocbs); if (ocb == NULL) { printf("ocb shortage!!!\n"); return NULL; } - STAILQ_REMOVE_HEAD(&sbp->free_ocbs, ocb); + STAILQ_REMOVE_HEAD(&sdev->free_ocbs, ocb); splx(s); ocb->ccb = NULL; return (ocb); } static void -sbp_free_ocb(struct sbp_softc *sbp, struct sbp_ocb *ocb) +sbp_free_ocb(struct sbp_dev *sdev, struct sbp_ocb *ocb) { -#if 0 /* XXX make sure that ocb has ccb */ - if ((sbp->flags & SBP_RESOURCE_SHORTAGE) != 0 && - (ocb->ccb->ccb_h.status & CAM_RELEASE_SIMQ) == 0) { - ocb->ccb->ccb_h.status |= CAM_RELEASE_SIMQ; - sbp->flags &= ~SBP_RESOURCE_SHORTAGE; - } -#else - if ((sbp->flags & SBP_RESOURCE_SHORTAGE) != 0) - sbp->flags &= ~SBP_RESOURCE_SHORTAGE; -#endif ocb->flags = 0; ocb->ccb = NULL; - STAILQ_INSERT_TAIL(&sbp->free_ocbs, ocb, ocb); + STAILQ_INSERT_TAIL(&sdev->free_ocbs, ocb, ocb); } static void @@ -2533,28 +2527,32 @@ sbp_abort_ocb(struct sbp_ocb *ocb, int status) struct sbp_dev *sdev; sdev = ocb->sdev; -SBP_DEBUG(1) +SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); #if __FreeBSD_version >= 500000 printf("sbp_abort_ocb 0x%tx\n", #else printf("sbp_abort_ocb 0x%x\n", #endif - vtophys(&ocb->orb[0])); + ocb->bus_addr); +END_DEBUG +SBP_DEBUG(1) if (ocb->ccb != NULL) sbp_print_scsi_cmd(ocb); END_DEBUG + if (ntohl(ocb->orb[4]) & 0xffff) { + bus_dmamap_sync(sdev->target->sbp->dmat, ocb->dmamap, + (ntohl(ocb->orb[4]) & ORB_CMD_IN) ? + BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sdev->target->sbp->dmat, ocb->dmamap); + } if (ocb->ccb != NULL) { untimeout(sbp_timeout, (caddr_t)ocb, ocb->ccb->ccb_h.timeout_ch); ocb->ccb->ccb_h.status = status; xpt_done(ocb->ccb); } - if (ocb->dmamap != NULL) { - bus_dmamap_destroy(sdev->target->sbp->dmat, ocb->dmamap); - ocb->dmamap = NULL; - } - sbp_free_ocb(sdev->target->sbp, ocb); + sbp_free_ocb(sdev, ocb); } static void diff --git a/sys/modules/firewire/Makefile.inc b/sys/modules/firewire/Makefile.inc index 265f86d1ed55..4b82370a7160 100644 --- a/sys/modules/firewire/Makefile.inc +++ b/sys/modules/firewire/Makefile.inc @@ -1,3 +1,4 @@ # $FreeBSD$ +#CFLAGS+=-g .include "../Makefile.inc" diff --git a/sys/modules/firewire/firewire/Makefile b/sys/modules/firewire/firewire/Makefile index 5d7661551da2..8e4e06f0fc91 100644 --- a/sys/modules/firewire/firewire/Makefile +++ b/sys/modules/firewire/firewire/Makefile @@ -9,7 +9,7 @@ SRCS = bus_if.h device_if.h pci_if.h \ firewire.c firewire.h firewire_phy.h firewirereg.h \ fwohci.c fwohci_pci.c fwohcireg.h fwohcivar.h \ iec13213.h iec68113.h \ - fwcrom.c fwdev.c fwmem.c fwmem.h + fwcrom.c fwdev.c fwmem.c fwmem.h fwdma.c fwdma.h .include diff --git a/sys/modules/firewire/fwe/Makefile b/sys/modules/firewire/fwe/Makefile index d3e163037fd8..6b26606b04e0 100644 --- a/sys/modules/firewire/fwe/Makefile +++ b/sys/modules/firewire/fwe/Makefile @@ -9,6 +9,7 @@ SRCS = bus_if.h device_if.h \ opt_inet.h \ if_fwe.c if_fwevar.h \ firewire.h firewirereg.h +#CFLAGS += -DDEVICE_POLLING .include diff --git a/usr.sbin/fwcontrol/fwcontrol.c b/usr.sbin/fwcontrol/fwcontrol.c index 6044ece7c6d3..3ac3814d8386 100644 --- a/usr.sbin/fwcontrol/fwcontrol.c +++ b/usr.sbin/fwcontrol/fwcontrol.c @@ -127,8 +127,8 @@ read_write_quad(int fd, struct fw_eui64 eui, u_int32_t addr_lo, int read, u_int3 else asyreq->pkt.mode.rreqq.tcode = FWTCODE_WREQQ; - asyreq->pkt.mode.rreqq.dest_hi = htons(0xffff); - asyreq->pkt.mode.rreqq.dest_lo = htonl(addr_lo); + asyreq->pkt.mode.rreqq.dest_hi = 0xffff; + asyreq->pkt.mode.rreqq.dest_lo = addr_lo; qld = (u_int32_t *)&asyreq->pkt; if (!read) @@ -157,9 +157,9 @@ send_phy_config(int fd, int root_node, int gap_count) asyreq->pkt.mode.ld[1] = 0; asyreq->pkt.mode.common.tcode = FWTCODE_PHY; if (root_node >= 0) - asyreq->pkt.mode.ld[1] |= htonl((root_node & 0x3f) << 24 | 1 << 23); + asyreq->pkt.mode.ld[1] |= (root_node & 0x3f) << 24 | 1 << 23; if (gap_count >= 0) - asyreq->pkt.mode.ld[1] |= htonl(1 << 22 | (gap_count & 0x3f) << 16); + asyreq->pkt.mode.ld[1] |= 1 << 22 | (gap_count & 0x3f) << 16; asyreq->pkt.mode.ld[2] = ~asyreq->pkt.mode.ld[1]; printf("send phy_config root_node=%d gap_count=%d\n", @@ -251,8 +251,9 @@ show_crom(u_int32_t *crom_buf) struct csrreg *reg; struct csrdirectory *dir; struct csrhdr *hdr; + u_int16_t crc; - printf("first quad: 0x%08x\n", *crom_buf); + printf("first quad: 0x%08x ", *crom_buf); hdr = (struct csrhdr *)crom_buf; if (hdr->info_len == 1) { /* minimum ROM */ @@ -261,13 +262,24 @@ show_crom(u_int32_t *crom_buf) printf("verndor ID: 0x%06x\n", reg->val); return; } - printf("len: %d\n", hdr->crc_len); + printf("info_len=%d crc_len=%d crc=0x%04x", + hdr->info_len, hdr->crc_len, hdr->crc); + crc = crom_crc(crom_buf+1, hdr->crc_len); + if (crc == hdr->crc) + printf("(OK)\n"); + else + printf("(NG)\n"); parse_bus_info_block(crom_buf+1, hdr->info_len); crom_init_context(&cc, crom_buf); dir = cc.stack[0].dir; - printf("root_directory: len=0x%04x(%d) crc=0x%04x\n", + printf("root_directory: len=0x%04x(%d) crc=0x%04x", dir->crc_len, dir->crc_len, dir->crc); + crc = crom_crc((u_int32_t *)&dir->entry[0], dir->crc_len); + if (crc == dir->crc) + printf("(OK)\n"); + else + printf("(NG)\n"); if (dir->crc_len < 1) return; while (cc.depth >= 0) { diff --git a/usr.sbin/fwcontrol/fwcrom.c b/usr.sbin/fwcontrol/fwcrom.c index d58be50f005d..af57c8e964ff 100644 --- a/usr.sbin/fwcontrol/fwcrom.c +++ b/usr.sbin/fwcontrol/fwcrom.c @@ -35,8 +35,9 @@ */ #include -#include -#include +#if defined(_KERNEL) || defined(TEST) +#include +#endif #ifdef _KERNEL #include #include @@ -48,6 +49,8 @@ #include #include #endif +#include +#include void crom_init_context(struct crom_context *cc, u_int32_t *p) @@ -179,20 +182,28 @@ crom_desc(struct crom_context *cc, char *buf, int len) struct csrreg *reg; struct csrdirectory *dir; char *desc; + u_int16_t crc; reg = crom_get(cc); switch (reg->key & CSRTYPE_MASK) { case CSRTYPE_I: snprintf(buf, len, "%d", reg->val); break; - case CSRTYPE_L: case CSRTYPE_C: snprintf(buf, len, "offset=0x%04x(%d)", reg->val, reg->val); break; + case CSRTYPE_L: + /* XXX fall through */ case CSRTYPE_D: dir = (struct csrdirectory *) (reg + reg->val); - snprintf(buf, len, "len=0x%04x(%d) crc=0x%04x", - dir->crc_len, dir->crc_len, dir->crc); + crc = crom_crc((u_int32_t *)&dir->entry[0], dir->crc_len); + len -= snprintf(buf, len, "len=%d crc=0x%04x", + dir->crc_len, dir->crc); + if (crc == dir->crc) + strncat(buf, "(OK) ", len); + else + strncat(buf, "(NG) ", len); + len -= 5; } switch (reg->key) { case 0x03: @@ -239,7 +250,7 @@ crom_desc(struct crom_context *cc, char *buf, int len) break; case 0x81: desc = "text_leaf"; - crom_parse_text(cc, buf, len); + crom_parse_text(cc, buf + strlen(buf), len); break; case 0xd1: desc = "unit_directory"; @@ -253,3 +264,239 @@ crom_desc(struct crom_context *cc, char *buf, int len) return desc; } #endif + +#if defined(_KERNEL) || defined(TEST) + +int +crom_add_quad(struct crom_chunk *chunk, u_int32_t entry) +{ + int index; + + index = chunk->data.crc_len; + if (index >= CROM_MAX_CHUNK_LEN - 1) { + printf("too large chunk %d\n", index); + return(-1); + } + chunk->data.buf[index] = entry; + chunk->data.crc_len++; + return(index); +} + +int +crom_add_entry(struct crom_chunk *chunk, int key, int val) +{ + struct csrreg *reg; + u_int32_t i; + + reg = (struct csrreg *)&i; + reg->key = key; + reg->val = val; + return(crom_add_quad(chunk, (u_int32_t) i)); +} + +int +crom_add_chunk(struct crom_src *src, struct crom_chunk *parent, + struct crom_chunk *child, int key) +{ + int index; + + if (parent == NULL) { + STAILQ_INSERT_TAIL(&src->chunk_list, child, link); + return(0); + } + + index = crom_add_entry(parent, key, 0); + if (index < 0) { + return(-1); + } + child->ref_chunk = parent; + child->ref_index = index; + STAILQ_INSERT_TAIL(&src->chunk_list, child, link); + return(index); +} + +int +crom_add_simple_text(struct crom_src *src, struct crom_chunk *parent, + struct crom_chunk *chunk, char *buf) +{ + struct csrtext *tl; + u_int32_t *p; + int len, i; + + len = strlen(buf); +#define MAX_TEXT ((CROM_MAX_CHUNK_LEN + 1) * 4 - sizeof(struct csrtext)) + if (len > MAX_TEXT) { + printf("text(%d) trancated to %d.\n", len, MAX_TEXT); + len = MAX_TEXT; + } + + tl = (struct csrtext *) &chunk->data; + tl->crc_len = roundup2(sizeof(struct csrtext) + len, 4) / 4; + tl->spec_id = 0; + tl->spec_type = 0; + tl->lang_id = 0; + p = (u_int32_t *) buf; + for (i = 0; i < roundup2(len, 4) / 4; i ++) + tl->text[i] = ntohl(*p++); + return (crom_add_chunk(src, parent, chunk, CROM_TEXTLEAF)); +} + +static int +crom_copy(u_int32_t *src, u_int32_t *dst, int *offset, int len, int maxlen) +{ + if (*offset + len > maxlen) { + printf("Config. ROM is too large for the buffer\n"); + return(-1); + } + bcopy(src, (char *)(dst + *offset), len * sizeof(u_int32_t)); + *offset += len; + return(0); +} + +int +crom_load(struct crom_src *src, u_int32_t *buf, int maxlen) +{ + struct crom_chunk *chunk, *parent; + struct csrhdr *hdr; +#if 0 + u_int32_t *ptr; +#endif + int count, offset; + int len; + + offset = 0; + /* Determine offset */ + STAILQ_FOREACH(chunk, &src->chunk_list, link) { + chunk->offset = offset; + /* Assume the offset of the parent is already known */ + parent = chunk->ref_chunk; + if (parent != NULL) { + struct csrreg *reg; + reg = (struct csrreg *) + &parent->data.buf[chunk->ref_index]; + reg->val = offset - + (parent->offset + 1 + chunk->ref_index); + } + offset += 1 + chunk->data.crc_len; + } + + /* Calculate CRC and dump to the buffer */ + len = 1 + src->hdr.info_len; + count = 0; + if (crom_copy((u_int32_t *)&src->hdr, buf, &count, len, maxlen) < 0) + return(-1); + STAILQ_FOREACH(chunk, &src->chunk_list, link) { + chunk->data.crc = + crom_crc(&chunk->data.buf[0], chunk->data.crc_len); + + len = 1 + chunk->data.crc_len; + if (crom_copy((u_int32_t *)&chunk->data, buf, + &count, len, maxlen) < 0) + return(-1); + } + hdr = (struct csrhdr *)buf; + hdr->crc_len = count - 1; + hdr->crc = crom_crc(buf + 1, hdr->crc_len); + +#if 0 + /* byte swap */ + ptr = buf; + for (i = 0; i < count; i ++) { + *ptr = htonl(*ptr); + ptr++; + } +#endif + + return(count); +} +#endif + +#ifdef TEST +int +main () { + struct crom_src src; + struct crom_chunk root,unit1,unit2,unit3; + struct crom_chunk text1,text2,text3,text4,text5,text6,text7; + u_int32_t buf[256], *p; + int i; + + bzero(&src, sizeof(src)); + bzero(&root, sizeof(root)); + bzero(&unit1, sizeof(unit1)); + bzero(&unit2, sizeof(unit2)); + bzero(&unit3, sizeof(unit3)); + bzero(&text1, sizeof(text1)); + bzero(&text2, sizeof(text2)); + bzero(&text3, sizeof(text3)); + bzero(&text3, sizeof(text4)); + bzero(&text3, sizeof(text5)); + bzero(&text3, sizeof(text6)); + bzero(&text3, sizeof(text7)); + bzero(buf, sizeof(buf)); + + /* BUS info sample */ + src.hdr.info_len = 4; + src.businfo.bus_name = CSR_BUS_NAME_IEEE1394; + src.businfo.eui64.hi = 0x11223344; + src.businfo.eui64.lo = 0x55667788; + src.businfo.link_spd = FWSPD_S400; + src.businfo.generation = 0; + src.businfo.max_rom = MAXROM_4; + src.businfo.max_rec = 10; + src.businfo.cyc_clk_acc = 100; + src.businfo.pmc = 0; + src.businfo.bmc = 1; + src.businfo.isc = 1; + src.businfo.cmc = 1; + src.businfo.irmc = 1; + STAILQ_INIT(&src.chunk_list); + + /* Root directory */ + crom_add_chunk(&src, NULL, &root, 0); + crom_add_entry(&root, CSRKEY_NCAP, 0x123456); + /* private company_id */ + crom_add_entry(&root, CSRKEY_VENDOR, 0xacde48); + + crom_add_simple_text(&src, &root, &text1, "FreeBSD"); + crom_add_entry(&root, CSRKEY_HW, __FreeBSD_version); + crom_add_simple_text(&src, &root, &text2, "FreeBSD-5"); + + /* SBP unit directory */ + crom_add_chunk(&src, &root, &unit1, CROM_UDIR); + crom_add_entry(&unit1, CSRKEY_SPEC, CSRVAL_ANSIT10); + crom_add_entry(&unit1, CSRKEY_VER, CSRVAL_T10SBP2); + crom_add_entry(&unit1, CSRKEY_COM_SPEC, CSRVAL_ANSIT10); + crom_add_entry(&unit1, CSRKEY_COM_SET, CSRVAL_SCSI); + /* management_agent */ + crom_add_entry(&unit1, CROM_MGM, 0x1000); + crom_add_entry(&unit1, CSRKEY_UNIT_CH, (10<<8) | 8); + /* Device type and LUN */ + crom_add_entry(&unit1, CROM_LUN, 0); + crom_add_entry(&unit1, CSRKEY_MODEL, 1); + crom_add_simple_text(&src, &unit1, &text3, "scsi_target"); + + /* RFC2734 IPv4 over IEEE1394 */ + crom_add_chunk(&src, &root, &unit2, CROM_UDIR); + crom_add_entry(&unit2, CSRKEY_SPEC, CSRVAL_IETF); + crom_add_simple_text(&src, &unit2, &text4, "IANA"); + crom_add_entry(&unit2, CSRKEY_VER, 1); + crom_add_simple_text(&src, &unit2, &text5, "IPv4"); + + /* RFC3146 IPv6 over IEEE1394 */ + crom_add_chunk(&src, &root, &unit3, CROM_UDIR); + crom_add_entry(&unit3, CSRKEY_SPEC, CSRVAL_IETF); + crom_add_simple_text(&src, &unit3, &text6, "IANA"); + crom_add_entry(&unit3, CSRKEY_VER, 2); + crom_add_simple_text(&src, &unit3, &text7, "IPv6"); + + crom_load(&src, buf, 256); + p = buf; +#define DUMP_FORMAT "%08x %08x %08x %08x %08x %08x %08x %08x\n" + for (i = 0; i < 256/8; i ++) { + printf(DUMP_FORMAT, + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); + p += 8; + } + return(0); +} +#endif diff --git a/usr.sbin/fwcontrol/fwdv.c b/usr.sbin/fwcontrol/fwdv.c index 432625afc93c..43f5a98ff80e 100644 --- a/usr.sbin/fwcontrol/fwdv.c +++ b/usr.sbin/fwcontrol/fwdv.c @@ -173,7 +173,7 @@ again: fprintf(stderr, "0x%04x\n", ntohs(ciph->fdf.dv.cyc)); } #endif - if (ntohs(pkt->mode.stream.len) <= sizeof(struct ciphdr)) + if (pkt->mode.stream.len <= sizeof(struct ciphdr)) /* no payload */ goto next; for (dv = (struct dvdbc *)ptr; @@ -281,13 +281,13 @@ dvsend(int d, char *filename, char ich, int count) iso_data = 0; pkt = (struct fw_pkt *) &iso_data; - pkt->mode.stream.len = htons(DSIZE + sizeof(struct ciphdr)); + pkt->mode.stream.len = DSIZE + sizeof(struct ciphdr); pkt->mode.stream.sy = 0; pkt->mode.stream.tcode = FWTCODE_STREAM; pkt->mode.stream.chtag = ich; iso_empty = iso_data; pkt = (struct fw_pkt *) &iso_empty; - pkt->mode.stream.len = htons(sizeof(struct ciphdr)); + pkt->mode.stream.len = sizeof(struct ciphdr); bzero(hdr[0], sizeof(hdr[0])); hdr[0][0] = iso_data; -- cgit v1.3 From e863fbcdb0d54eb53ddd490ea3356cc03240ce91 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Mon, 21 Apr 2003 16:41:20 +0000 Subject: Remove unused code. --- sys/dev/firewire/fwdev.c | 102 +++++++++++++++-------------------------------- 1 file changed, 32 insertions(+), 70 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 13168b6ffdf1..9e4673e3ddbf 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -282,8 +282,6 @@ fw_write (dev_t dev, struct uio *uio, int ioflag) int sub = DEV2DMACH(dev); int s, slept = 0; struct fw_pkt *fp; - struct fw_xfer *xfer; - struct fw_xferq *xferq; struct firewire_comm *fc; struct fw_xferq *it; @@ -293,82 +291,46 @@ fw_write (dev_t dev, struct uio *uio, int ioflag) sc = devclass_get_softc(firewire_devclass, unit); fc = sc->fc; it = sc->fc->it[sub]; - - xferq = NULL; - /* Discard unsent buffered stream packet, when sending Asyrequrst */ - if(xferq != NULL && it->stproc != NULL){ - s = splfw(); - STAILQ_INSERT_TAIL(&it->stfree, it->stproc, link); - splx(s); - it->stproc = NULL; - } - if (xferq == NULL) { isoloop: - if (it->stproc == NULL) { - it->stproc = STAILQ_FIRST(&it->stfree); - if (it->stproc != NULL) { - s = splfw(); - STAILQ_REMOVE_HEAD(&it->stfree, link); - splx(s); - it->queued = 0; - } else if (slept == 0) { - slept = 1; - err = sc->fc->itx_enable(sc->fc, sub); - if (err) - return err; - err = tsleep(it, FWPRI, - "fw_write", hz); - if (err) - return err; - goto isoloop; - } else { - err = EIO; - return err; - } - } - fp = (struct fw_pkt *)fwdma_v_addr(it->buf, - it->stproc->poffset + it->queued); - err = uiomove((caddr_t)fp, sizeof(struct fw_isohdr), uio); - err = uiomove((caddr_t)fp->mode.stream.payload, - fp->mode.stream.len, uio); - it->queued ++; - if (it->queued >= it->bnpacket) { + if (it->stproc == NULL) { + it->stproc = STAILQ_FIRST(&it->stfree); + if (it->stproc != NULL) { s = splfw(); - STAILQ_INSERT_TAIL(&it->stvalid, it->stproc, link); + STAILQ_REMOVE_HEAD(&it->stfree, link); splx(s); - it->stproc = NULL; + it->queued = 0; + } else if (slept == 0) { + slept = 1; err = sc->fc->itx_enable(sc->fc, sub); - } - if (uio->uio_resid >= sizeof(struct fw_isohdr)) { - slept = 0; + if (err) + return err; + err = tsleep(it, FWPRI, "fw_write", hz); + if (err) + return err; goto isoloop; - } - return err; - } - if (xferq != NULL) { - xfer = fw_xfer_alloc_buf(M_FWXFER, uio->uio_resid, 12); - if(xfer == NULL){ - err = ENOMEM; - return err; - } - xfer->dst = fp->mode.hdr.dst; - xfer->send.len = uio->uio_resid; - xfer->spd = 0;/* XXX: how to setup it */ - xfer->act.hand = fw_asy_callback; - - err = uiomove(xfer->send.buf, uio->uio_resid, uio); - if(err){ - fw_xfer_free( xfer); + } else { + err = EIO; return err; } - fw_asyreq(fc, -1, xfer); - err = tsleep(xfer, FWPRI, "fw_write", hz); - if(xfer->resp == EBUSY) - return EBUSY; - fw_xfer_free( xfer); - return err; } - return EINVAL; + fp = (struct fw_pkt *)fwdma_v_addr(it->buf, + it->stproc->poffset + it->queued); + err = uiomove((caddr_t)fp, sizeof(struct fw_isohdr), uio); + err = uiomove((caddr_t)fp->mode.stream.payload, + fp->mode.stream.len, uio); + it->queued ++; + if (it->queued >= it->bnpacket) { + s = splfw(); + STAILQ_INSERT_TAIL(&it->stvalid, it->stproc, link); + splx(s); + it->stproc = NULL; + err = sc->fc->itx_enable(sc->fc, sub); + } + if (uio->uio_resid >= sizeof(struct fw_isohdr)) { + slept = 0; + goto isoloop; + } + return err; } /* -- cgit v1.3 From 85b2d114c06968ba3412d6fa0a39cb6b364101ca Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Tue, 22 Apr 2003 02:31:31 +0000 Subject: Set the local bus address in xfer->dst. Submitted by: Buzz Slye --- sys/dev/firewire/fwdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 9e4673e3ddbf..02b927e96223 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -522,8 +522,8 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) err = EINVAL; goto error; } - xfer->dst = fwdev->dst; - fp->mode.hdr.dst = FWLOCALBUS | xfer->dst; + xfer->dst = FWLOCALBUS | fwdev->dst; + fp->mode.hdr.dst = xfer->dst; break; case FWASRESTL: /* XXX what's this? */ -- cgit v1.3 From d7e486b41da82f5fdfd1763b102255ab36b69fe2 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Sat, 12 Jul 2003 09:34:44 +0000 Subject: Allow retrieval of local Configuration ROM. --- sys/dev/firewire/fwdev.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 02b927e96223..eeb9aac0f46a 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -349,6 +349,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) struct fw_xfer *xfer; struct fw_pkt *fp; struct fw_devinfo *devinfo; + void *ptr; struct fw_devlstreq *fwdevlst = (struct fw_devlstreq *)data; struct fw_asyreq *asyreq = (struct fw_asyreq *)data; @@ -631,18 +632,32 @@ error: if (FW_EUI64_EQUAL(fwdev->eui, crom_buf->eui)) break; if (fwdev == NULL) { - err = FWNODE_INVAL; - break; + if (!FW_EUI64_EQUAL(sc->fc->eui, crom_buf->eui)) { + err = FWNODE_INVAL; + break; + } + /* myself */ + ptr = malloc(CROMSIZE, M_FW, M_WAITOK); + len = CROMSIZE; + for (i = 0; i < CROMSIZE/4; i++) + ((u_int32_t *)ptr)[i] + = ntohl(sc->fc->config_rom[i]); + } else { + /* found */ + ptr = (void *)&fwdev->csrrom[0]; + if (fwdev->rommax < CSRROMOFF) + len = 0; + else + len = fwdev->rommax - CSRROMOFF + 4; } - if (fwdev->rommax < CSRROMOFF) - len = 0; - else - len = fwdev->rommax - CSRROMOFF + 4; if (crom_buf->len < len) len = crom_buf->len; else crom_buf->len = len; - err = copyout(&fwdev->csrrom[0], crom_buf->ptr, len); + err = copyout(ptr, crom_buf->ptr, len); + if (fwdev == NULL) + /* myself */ + free(ptr, M_FW); break; default: sc->fc->ioctl (dev, cmd, data, flag, td); -- cgit v1.3 From 6cada79a783680135494229dfd9ba6c63ff6e0f0 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Fri, 1 Aug 2003 04:51:21 +0000 Subject: Clean up fwdev. Allocate iso DMA channel dynamically. This allows us to have more /dev/fw* than number of DMA channels for asyn. transactions and etc. --- sys/dev/firewire/firewire.h | 4 +- sys/dev/firewire/firewirereg.h | 2 +- sys/dev/firewire/fwdev.c | 432 +++++++++++++++++++++-------------------- sys/dev/firewire/fwohci.c | 7 + 4 files changed, 234 insertions(+), 211 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index f90596f83b74..b3ff16928ca0 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -47,7 +47,7 @@ struct fw_isochreq { }; struct fw_isobufreq { - struct { + struct fw_bufspec { unsigned int nchunk; unsigned int npacket; unsigned int psize; @@ -395,7 +395,7 @@ struct fw_crom_buf { #define UNIT2MIN(x) (((x) & 0xff) << 8) #define DEV2UNIT(x) ((dev2unit(x) & 0xff00) >> 8) -#define DEV2DMACH(x) (dev2unit(x) & 0xff) +#define DEV2SUB(x) (dev2unit(x) & 0xff) #define FWMEM_FLAG 0x10000 #define DEV_FWMEM(x) (dev2unit(x) & FWMEM_FLAG) diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 6a462c295bc5..3a69e4eb8921 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -191,8 +191,8 @@ struct fw_xferq { #define FWXFERQ_HANDLER (1 << 16) #define FWXFERQ_WAKEUP (1 << 17) - void (*start) __P((struct firewire_comm*)); + int dmach; STAILQ_HEAD(, fw_xfer) q; u_int queued; u_int maxq; diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index eeb9aac0f46a..abf0e476d8d3 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -86,34 +86,99 @@ struct cdevsw firewire_cdevsw = #endif }; +struct fw_drv1 { + struct fw_xferq *ir; + struct fw_xferq *it; + struct fw_isobufreq bufreq; +}; + +static int +fwdev_allocbuf(struct firewire_comm *fc, struct fw_xferq *q, + struct fw_bufspec *b) +{ + int i; + + if (q->flag & (FWXFERQ_RUNNING | FWXFERQ_EXTBUF)) + return(EBUSY); + + q->bulkxfer = (struct fw_bulkxfer *) malloc( + sizeof(struct fw_bulkxfer) * b->nchunk, + M_FW, M_WAITOK); + if (q->bulkxfer == NULL) + return(ENOMEM); + + b->psize = roundup2(b->psize, sizeof(u_int32_t)); + q->buf = fwdma_malloc_multiseg(fc, sizeof(u_int32_t), + b->psize, b->nchunk * b->npacket, BUS_DMA_WAITOK); + + if (q->buf == NULL) { + free(q->bulkxfer, M_FW); + q->bulkxfer = NULL; + return(ENOMEM); + } + q->bnchunk = b->nchunk; + q->bnpacket = b->npacket; + q->psize = (b->psize + 3) & ~3; + q->queued = 0; + + STAILQ_INIT(&q->stvalid); + STAILQ_INIT(&q->stfree); + STAILQ_INIT(&q->stdma); + q->stproc = NULL; + + for(i = 0 ; i < q->bnchunk; i++){ + q->bulkxfer[i].poffset = i * q->bnpacket; + q->bulkxfer[i].mbuf = NULL; + STAILQ_INSERT_TAIL(&q->stfree, &q->bulkxfer[i], link); + } + + q->flag &= ~FWXFERQ_MODEMASK; + q->flag |= FWXFERQ_STREAM; + q->flag |= FWXFERQ_EXTBUF; + + return (0); +} + +static int +fwdev_freebuf(struct fw_xferq *q) +{ + if (q->flag & FWXFERQ_EXTBUF) { + if (q->buf != NULL) + fwdma_free_multiseg(q->buf); + q->buf = NULL; + free(q->bulkxfer, M_FW); + q->bulkxfer = NULL; + q->flag &= ~FWXFERQ_EXTBUF; + q->psize = 0; + q->maxq = FWMAXQUEUE; + } + return (0); +} + + static int fw_open (dev_t dev, int flags, int fmt, fw_proc *td) { - struct firewire_softc *sc; int unit = DEV2UNIT(dev); - int sub = DEV2DMACH(dev); + int sub = DEV2SUB(dev); int err = 0; + if (dev->si_drv1 != NULL) + return (EBUSY); + if (DEV_FWMEM(dev)) return fwmem_open(dev, flags, fmt, td); - sc = devclass_get_softc(firewire_devclass, unit); - if(sc->fc->ir[sub]->flag & FWXFERQ_OPEN){ - err = EBUSY; - return err; - } - if(sc->fc->it[sub]->flag & FWXFERQ_OPEN){ - err = EBUSY; - return err; - } - if(sc->fc->ir[sub]->flag & FWXFERQ_MODEMASK){ - err = EBUSY; - return err; - } -/* Default is per packet mode */ - sc->fc->ir[sub]->flag |= FWXFERQ_OPEN; - sc->fc->it[sub]->flag |= FWXFERQ_OPEN; +#if __FreeBSD_version >= 500000 + if ((dev->si_flags & SI_NAMED) == 0) +#endif + make_dev(&firewire_cdevsw, minor(dev), + UID_ROOT, GID_OPERATOR, 0660, + "fw%d.%d", unit, sub); + + dev->si_drv1 = malloc(sizeof(struct fw_drv1), M_FW, M_WAITOK | M_ZERO); + return err; } @@ -121,8 +186,9 @@ static int fw_close (dev_t dev, int flags, int fmt, fw_proc *td) { struct firewire_softc *sc; + struct firewire_comm *fc; + struct fw_drv1 *d; int unit = DEV2UNIT(dev); - int sub = DEV2DMACH(dev); struct fw_xfer *xfer; struct fw_bind *fwb; int err = 0; @@ -131,60 +197,59 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) return fwmem_close(dev, flags, fmt, td); sc = devclass_get_softc(firewire_devclass, unit); - if(!(sc->fc->ir[sub]->flag & FWXFERQ_OPEN)){ - err = EINVAL; - return err; - } - sc->fc->ir[sub]->flag &= ~FWXFERQ_OPEN; - if(!(sc->fc->it[sub]->flag & FWXFERQ_OPEN)){ - err = EINVAL; - return err; - } - sc->fc->it[sub]->flag &= ~FWXFERQ_OPEN; + fc = sc->fc; + d = (struct fw_drv1 *)dev->si_drv1; - if(sc->fc->ir[sub]->flag & FWXFERQ_RUNNING){ - sc->fc->irx_disable(sc->fc, sub); - } - if(sc->fc->it[sub]->flag & FWXFERQ_RUNNING){ - sc->fc->it[sub]->flag &= ~FWXFERQ_RUNNING; - sc->fc->itx_disable(sc->fc, sub); - } - if(sc->fc->ir[sub]->flag & FWXFERQ_EXTBUF){ - if (sc->fc->ir[sub]->buf != NULL) - fwdma_free_multiseg(sc->fc->ir[sub]->buf); - sc->fc->ir[sub]->buf = NULL; - free(sc->fc->ir[sub]->bulkxfer, M_FW); - sc->fc->ir[sub]->bulkxfer = NULL; - sc->fc->ir[sub]->flag &= ~FWXFERQ_EXTBUF; - sc->fc->ir[sub]->psize = PAGE_SIZE; - sc->fc->ir[sub]->maxq = FWMAXQUEUE; - } - if(sc->fc->it[sub]->flag & FWXFERQ_EXTBUF){ - if (sc->fc->it[sub]->buf != NULL) - fwdma_free_multiseg(sc->fc->it[sub]->buf); - sc->fc->it[sub]->buf = NULL; - free(sc->fc->it[sub]->bulkxfer, M_FW); - sc->fc->it[sub]->bulkxfer = NULL; - sc->fc->it[sub]->flag &= ~FWXFERQ_EXTBUF; - sc->fc->it[sub]->psize = 0; - sc->fc->it[sub]->maxq = FWMAXQUEUE; - } - for(xfer = STAILQ_FIRST(&sc->fc->ir[sub]->q); - xfer != NULL; xfer = STAILQ_FIRST(&sc->fc->ir[sub]->q)){ - sc->fc->ir[sub]->queued--; - STAILQ_REMOVE_HEAD(&sc->fc->ir[sub]->q, link); + if (d->ir != NULL) { + struct fw_xferq *ir = d->ir; + + if ((ir->flag & FWXFERQ_OPEN) == 0) + return (EINVAL); + if (ir->flag & FWXFERQ_RUNNING) { + ir->flag &= ~FWXFERQ_RUNNING; + fc->irx_disable(fc, ir->dmach); + } + /* free extbuf */ + fwdev_freebuf(ir); + /* drain receiving buffer */ + for (xfer = STAILQ_FIRST(&ir->q); + xfer != NULL; xfer = STAILQ_FIRST(&ir->q)) { + ir->queued --; + STAILQ_REMOVE_HEAD(&ir->q, link); + + xfer->resp = 0; + fw_xfer_done(xfer); + } + /* remove binding */ + for (fwb = STAILQ_FIRST(&ir->binds); fwb != NULL; + fwb = STAILQ_FIRST(&ir->binds)) { + STAILQ_REMOVE(&fc->binds, fwb, fw_bind, fclist); + STAILQ_REMOVE_HEAD(&ir->binds, chlist); + free(fwb, M_FW); + } + ir->flag &= ~(FWXFERQ_OPEN | + FWXFERQ_MODEMASK | FWXFERQ_CHTAGMASK); + d->ir = NULL; - xfer->resp = 0; - fw_xfer_done(xfer); } - for(fwb = STAILQ_FIRST(&sc->fc->ir[sub]->binds); fwb != NULL; - fwb = STAILQ_FIRST(&sc->fc->ir[sub]->binds)){ - STAILQ_REMOVE(&sc->fc->binds, fwb, fw_bind, fclist); - STAILQ_REMOVE_HEAD(&sc->fc->ir[sub]->binds, chlist); - free(fwb, M_FW); + if (d->it != NULL) { + struct fw_xferq *it = d->it; + + if ((it->flag & FWXFERQ_OPEN) == 0) + return (EINVAL); + if (it->flag & FWXFERQ_RUNNING) { + it->flag &= ~FWXFERQ_RUNNING; + fc->itx_disable(fc, it->dmach); + } + /* free extbuf */ + fwdev_freebuf(it); + it->flag &= ~(FWXFERQ_OPEN | + FWXFERQ_MODEMASK | FWXFERQ_CHTAGMASK); + d->it = NULL; } - sc->fc->ir[sub]->flag &= ~(FWXFERQ_MODEMASK | FWXFERQ_CHTAGMASK); - sc->fc->it[sub]->flag &= ~(FWXFERQ_MODEMASK | FWXFERQ_CHTAGMASK); + free(dev->si_drv1, M_FW); + dev->si_drv1 = NULL; + return err; } @@ -199,7 +264,6 @@ fw_read (dev_t dev, struct uio *uio, int ioflag) struct fw_xfer *xfer; int err = 0, s, slept = 0; int unit = DEV2UNIT(dev); - int sub = DEV2DMACH(dev); struct fw_pkt *fp; if (DEV_FWMEM(dev)) @@ -207,7 +271,9 @@ fw_read (dev_t dev, struct uio *uio, int ioflag) sc = devclass_get_softc(firewire_devclass, unit); - ir = sc->fc->ir[sub]; + ir = ((struct fw_drv1 *)dev->si_drv1)->ir; + if (ir == NULL || ir->buf == NULL) + return (EIO); readloop: xfer = STAILQ_FIRST(&ir->q); @@ -262,7 +328,7 @@ readloop: s = splfw(); STAILQ_INSERT_TAIL(&ir->stfree, ir->stproc, link); splx(s); - sc->fc->irx_enable(sc->fc, sub); + sc->fc->irx_enable(sc->fc, ir->dmach); ir->stproc = NULL; } if (uio->uio_resid >= ir->psize) { @@ -279,7 +345,6 @@ fw_write (dev_t dev, struct uio *uio, int ioflag) int err = 0; struct firewire_softc *sc; int unit = DEV2UNIT(dev); - int sub = DEV2DMACH(dev); int s, slept = 0; struct fw_pkt *fp; struct firewire_comm *fc; @@ -290,7 +355,9 @@ fw_write (dev_t dev, struct uio *uio, int ioflag) sc = devclass_get_softc(firewire_devclass, unit); fc = sc->fc; - it = sc->fc->it[sub]; + it = ((struct fw_drv1 *)dev->si_drv1)->it; + if (it == NULL || it->buf == NULL) + return (EIO); isoloop: if (it->stproc == NULL) { it->stproc = STAILQ_FIRST(&it->stfree); @@ -301,7 +368,7 @@ isoloop: it->queued = 0; } else if (slept == 0) { slept = 1; - err = sc->fc->itx_enable(sc->fc, sub); + err = sc->fc->itx_enable(sc->fc, it->dmach); if (err) return err; err = tsleep(it, FWPRI, "fw_write", hz); @@ -324,7 +391,7 @@ isoloop: STAILQ_INSERT_TAIL(&it->stvalid, it->stproc, link); splx(s); it->stproc = NULL; - err = sc->fc->itx_enable(sc->fc, sub); + err = sc->fc->itx_enable(sc->fc, it->dmach); } if (uio->uio_resid >= sizeof(struct fw_isohdr)) { slept = 0; @@ -332,7 +399,6 @@ isoloop: } return err; } - /* * ioctl support. */ @@ -340,8 +406,9 @@ int fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) { struct firewire_softc *sc; + struct firewire_comm *fc; + struct fw_drv1 *d; int unit = DEV2UNIT(dev); - int sub = DEV2DMACH(dev); int s, i, len, err = 0; struct fw_device *fwdev; struct fw_bind *fwb; @@ -361,146 +428,93 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) if (DEV_FWMEM(dev)) return fwmem_ioctl(dev, cmd, data, flag, td); - sc = devclass_get_softc(firewire_devclass, unit); if (!data) return(EINVAL); + sc = devclass_get_softc(firewire_devclass, unit); + fc = sc->fc; + d = (struct fw_drv1 *)dev->si_drv1; + ir = d->ir; + it = d->it; + switch (cmd) { case FW_STSTREAM: - sc->fc->it[sub]->flag &= ~0xff; - sc->fc->it[sub]->flag |= (0x3f & ichreq->ch); - sc->fc->it[sub]->flag |= ((0x3 & ichreq->tag) << 6); + if (it == NULL) { + for (i = 0; i < fc->nisodma; i ++) { + it = fc->it[i]; + if ((it->flag & FWXFERQ_OPEN) == 0) + break; + } + if (i >= fc->nisodma) { + err = EBUSY; + break; + } + err = fwdev_allocbuf(fc, it, &d->bufreq.tx); + if (err) + break; + it->flag |= FWXFERQ_OPEN; + } + it->flag &= ~0xff; + it->flag |= (0x3f & ichreq->ch); + it->flag |= ((0x3 & ichreq->tag) << 6); + d->it = it; err = 0; break; case FW_GTSTREAM: - ichreq->ch = sc->fc->it[sub]->flag & 0x3f; - ichreq->tag =(sc->fc->it[sub]->flag) >> 2 & 0x3; - err = 0; + if (it != NULL) { + ichreq->ch = it->flag & 0x3f; + ichreq->tag = it->flag >> 2 & 0x3; + err = 0; + } else + err = EINVAL; break; case FW_SRSTREAM: - sc->fc->ir[sub]->flag &= ~0xff; - sc->fc->ir[sub]->flag |= (0x3f & ichreq->ch); - sc->fc->ir[sub]->flag |= ((0x3 & ichreq->tag) << 6); - err = sc->fc->irx_enable(sc->fc, sub); + if (ir == NULL) { + for (i = 0; i < fc->nisodma; i ++) { + ir = fc->ir[i]; + if ((ir->flag & FWXFERQ_OPEN) == 0) + break; + } + if (i >= fc->nisodma) { + err = EBUSY; + break; + } + err = fwdev_allocbuf(fc, ir, &d->bufreq.rx); + if (err) + break; + ir->flag |= FWXFERQ_OPEN; + } + ir->flag &= ~0xff; + ir->flag |= (0x3f & ichreq->ch); + ir->flag |= ((0x3 & ichreq->tag) << 6); + d->ir = ir; + err = fc->irx_enable(fc, ir->dmach); break; case FW_GRSTREAM: - ichreq->ch = sc->fc->ir[sub]->flag & 0x3f; - ichreq->tag =(sc->fc->ir[sub]->flag) >> 2 & 0x3; - err = 0; + if (d->ir != NULL) { + ichreq->ch = ir->flag & 0x3f; + ichreq->tag = ir->flag >> 2 & 0x3; + err = 0; + } else + err = EINVAL; break; case FW_SSTBUF: - ir = sc->fc->ir[sub]; - it = sc->fc->it[sub]; - - if(ir->flag & FWXFERQ_RUNNING || it->flag & FWXFERQ_RUNNING){ - return(EBUSY); - } - if((ir->flag & FWXFERQ_EXTBUF) || (it->flag & FWXFERQ_EXTBUF)){ - return(EBUSY); - } - if((ibufreq->rx.nchunk * - ibufreq->rx.psize * ibufreq->rx.npacket) + - (ibufreq->tx.nchunk * - ibufreq->tx.psize * ibufreq->tx.npacket) <= 0){ - return(EINVAL); - } - ir->bulkxfer - = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->rx.nchunk, M_FW, M_WAITOK); - if(ir->bulkxfer == NULL){ - return(ENOMEM); - } - it->bulkxfer - = (struct fw_bulkxfer *)malloc(sizeof(struct fw_bulkxfer) * ibufreq->tx.nchunk, M_FW, M_WAITOK); - if(it->bulkxfer == NULL){ - return(ENOMEM); - } - if (ibufreq->rx.psize > 0) { - ibufreq->rx.psize = roundup2(ibufreq->rx.psize, - sizeof(u_int32_t)); - ir->buf = fwdma_malloc_multiseg( - sc->fc, sizeof(u_int32_t), - ibufreq->rx.psize, - ibufreq->rx.nchunk * ibufreq->rx.npacket, - BUS_DMA_WAITOK); - - if(ir->buf == NULL){ - free(ir->bulkxfer, M_FW); - free(it->bulkxfer, M_FW); - ir->bulkxfer = NULL; - it->bulkxfer = NULL; - it->buf = NULL; - return(ENOMEM); - } - } - if (ibufreq->tx.psize > 0) { - ibufreq->tx.psize = roundup2(ibufreq->tx.psize, - sizeof(u_int32_t)); - it->buf = fwdma_malloc_multiseg( - sc->fc, sizeof(u_int32_t), - ibufreq->tx.psize, - ibufreq->tx.nchunk * ibufreq->tx.npacket, - BUS_DMA_WAITOK); - - if(it->buf == NULL){ - free(ir->bulkxfer, M_FW); - free(it->bulkxfer, M_FW); - fwdma_free_multiseg(ir->buf); - ir->bulkxfer = NULL; - it->bulkxfer = NULL; - it->buf = NULL; - return(ENOMEM); - } - } - - ir->bnchunk = ibufreq->rx.nchunk; - ir->bnpacket = ibufreq->rx.npacket; - ir->psize = (ibufreq->rx.psize + 3) & ~3; - ir->queued = 0; - - it->bnchunk = ibufreq->tx.nchunk; - it->bnpacket = ibufreq->tx.npacket; - it->psize = (ibufreq->tx.psize + 3) & ~3; - it->queued = 0; - - STAILQ_INIT(&ir->stvalid); - STAILQ_INIT(&ir->stfree); - STAILQ_INIT(&ir->stdma); - ir->stproc = NULL; - - STAILQ_INIT(&it->stvalid); - STAILQ_INIT(&it->stfree); - STAILQ_INIT(&it->stdma); - it->stproc = NULL; - - for(i = 0 ; i < sc->fc->ir[sub]->bnchunk; i++){ - ir->bulkxfer[i].poffset = i * ir->bnpacket; - ir->bulkxfer[i].mbuf = NULL; - STAILQ_INSERT_TAIL(&ir->stfree, - &ir->bulkxfer[i], link); - } - for(i = 0 ; i < sc->fc->it[sub]->bnchunk; i++){ - it->bulkxfer[i].poffset = i * it->bnpacket; - it->bulkxfer[i].mbuf = NULL; - STAILQ_INSERT_TAIL(&it->stfree, - &it->bulkxfer[i], link); - } - ir->flag &= ~FWXFERQ_MODEMASK; - ir->flag |= FWXFERQ_STREAM; - ir->flag |= FWXFERQ_EXTBUF; - - it->flag &= ~FWXFERQ_MODEMASK; - it->flag |= FWXFERQ_STREAM; - it->flag |= FWXFERQ_EXTBUF; + bcopy(ibufreq, &d->bufreq, sizeof(d->bufreq)); err = 0; break; case FW_GSTBUF: - ibufreq->rx.nchunk = sc->fc->ir[sub]->bnchunk; - ibufreq->rx.npacket = sc->fc->ir[sub]->bnpacket; - ibufreq->rx.psize = sc->fc->ir[sub]->psize; - - ibufreq->tx.nchunk = sc->fc->it[sub]->bnchunk; - ibufreq->tx.npacket = sc->fc->it[sub]->bnpacket; - ibufreq->tx.psize = sc->fc->it[sub]->psize; + bzero(&ibufreq->rx, sizeof(ibufreq->rx)); + if (ir != NULL) { + ibufreq->rx.nchunk = ir->bnchunk; + ibufreq->rx.npacket = ir->bnpacket; + ibufreq->rx.psize = ir->psize; + } + bzero(&ibufreq->tx, sizeof(ibufreq->tx)); + if (it != NULL) { + ibufreq->tx.nchunk = it->bnchunk; + ibufreq->tx.npacket = it->bnpacket; + ibufreq->tx.psize = it->psize; + } break; case FW_ASYREQ: xfer = fw_xfer_alloc_buf(M_FWXFER, asyreq->req.len, @@ -536,7 +550,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) xfer->spd = asyreq->req.sped; bcopy(fp, xfer->send.buf, xfer->send.len); xfer->act.hand = fw_asy_callback; - err = fw_asyreq(sc->fc, sub, xfer); + err = fw_asyreq(sc->fc, -1, xfer); if(err){ fw_xfer_free( xfer); return err; @@ -564,7 +578,7 @@ error: break; } STAILQ_REMOVE(&sc->fc->binds, fwb, fw_bind, fclist); - STAILQ_REMOVE(&sc->fc->ir[sub]->binds, fwb, fw_bind, chlist); + STAILQ_REMOVE(&ir->binds, fwb, fw_bind, chlist); free(fwb, M_FW); break; case FW_SBINDADDR: @@ -584,7 +598,8 @@ error: fwb->start_hi = bindreq->start.hi; fwb->start_lo = bindreq->start.lo; fwb->addrlen = bindreq->len; - fwb->sub = sub; + /* XXX */ + fwb->sub = ir->dmach; fwb->act_type = FWACT_CH; xfer = fw_xfer_alloc(M_FWXFER); @@ -668,23 +683,24 @@ error: int fw_poll(dev_t dev, int events, fw_proc *td) { + struct firewire_softc *sc; + struct fw_xferq *ir; int revents; int tmp; int unit = DEV2UNIT(dev); - int sub = DEV2DMACH(dev); - struct firewire_softc *sc; if (DEV_FWMEM(dev)) return fwmem_poll(dev, events, td); sc = devclass_get_softc(firewire_devclass, unit); + ir = ((struct fw_drv1 *)dev->si_drv1)->ir; revents = 0; tmp = POLLIN | POLLRDNORM; if (events & tmp) { - if (STAILQ_FIRST(&sc->fc->ir[sub]->q) != NULL) + if (STAILQ_FIRST(&ir->q) != NULL) revents |= tmp; else - selrecord(td, &sc->fc->ir[sub]->rsel); + selrecord(td, &ir->rsel); } tmp = POLLOUT | POLLWRNORM; if (events & tmp) { diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 5cfb32851c7c..f3ca25679a1c 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -616,6 +616,11 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) sc->atrq.xferq.buf = NULL; sc->atrs.xferq.buf = NULL; + sc->arrq.xferq.dmach = -1; + sc->arrs.xferq.dmach = -1; + sc->atrq.xferq.dmach = -1; + sc->atrs.xferq.dmach = -1; + sc->arrq.ndesc = 1; sc->arrs.ndesc = 1; sc->atrq.ndesc = 8; /* equal to maximum of mbuf chains */ @@ -629,6 +634,8 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) for( i = 0 ; i < sc->fc.nisodma ; i ++ ){ sc->fc.it[i] = &sc->it[i].xferq; sc->fc.ir[i] = &sc->ir[i].xferq; + sc->it[i].xferq.dmach = i; + sc->ir[i].xferq.dmach = i; sc->it[i].ndb = 0; sc->ir[i].ndb = 0; } -- cgit v1.3 From a160e00e41cea0bee365630583cd5d2a8ce38f84 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Tue, 5 Aug 2003 03:11:39 +0000 Subject: Change device name notation. - /dev/fw{,mem}X.Y represents the Y'th unit on the X'th bus. - /dev/fw{,mem}X is an alias of fw{,mem}X.0 for compatibility. - Clone devices. --- sys/dev/firewire/firewire.c | 83 ++++++++++++++++----------------- sys/dev/firewire/firewire.h | 3 +- sys/dev/firewire/firewirereg.h | 6 +-- sys/dev/firewire/fwdev.c | 103 +++++++++++++++++++++++++++++++++++++---- 4 files changed, 141 insertions(+), 54 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 0d474c7dd7c9..11919df857b3 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -124,8 +124,6 @@ char linkspeed[7][0x10]={"S100","S200","S400","S800","S1600","S3200","Unknown"}; u_int gap_cnt[] = { 5, 5, 7, 8, 10, 13, 16, 18, 21, 24, 26, 29, 32, 35, 37, 40}; -extern struct cdevsw firewire_cdevsw; - static driver_t firewire_driver = { "firewire", firewire_methods, @@ -356,44 +354,22 @@ firewire_watchdog(void *arg) * The attach routine. */ static int -firewire_attach( device_t dev ) +firewire_attach(device_t dev) { - int i, unitmask, mn; + int unit; struct firewire_softc *sc = device_get_softc(dev); device_t pa = device_get_parent(dev); struct firewire_comm *fc; - dev_t d; fc = (struct firewire_comm *)device_get_softc(pa); sc->fc = fc; fc->status = FWBUSNOTREADY; - unitmask = UNIT2MIN(device_get_unit(dev)); - + unit = device_get_unit(dev); if( fc->nisodma > FWMAXNDMA) fc->nisodma = FWMAXNDMA; - for ( i = 0 ; i < fc->nisodma ; i++ ){ - mn = unitmask | i; - /* XXX device name should be improved */ - d = make_dev(&firewire_cdevsw, unit2minor(mn), - UID_ROOT, GID_OPERATOR, 0660, - "fw%x", mn); -#if __FreeBSD_version >= 500000 - if (i == 0) - sc->dev = d; - else - dev_depends(sc->dev, d); -#else - sc->dev[i] = d; -#endif - } - d = make_dev(&firewire_cdevsw, unit2minor(unitmask | FWMEM_FLAG), - UID_ROOT, GID_OPERATOR, 0660, - "fwmem%d", device_get_unit(dev)); -#if __FreeBSD_version >= 500000 - dev_depends(sc->dev, d); -#else - sc->dev[i] = d; -#endif + + fwdev_makedev(sc); + CALLOUT_INIT(&sc->fc->timeout_callout); CALLOUT_INIT(&sc->fc->bmr_callout); CALLOUT_INIT(&sc->fc->retry_probe_callout); @@ -450,30 +426,25 @@ firewire_resume(device_t dev) * Dettach it. */ static int -firewire_detach( device_t dev ) +firewire_detach(device_t dev) { struct firewire_softc *sc; struct csrdir *csrd, *next; struct fw_device *fwdev, *fwdev_next; + int err; sc = (struct firewire_softc *)device_get_softc(dev); + if ((err = fwdev_destroydev(sc)) != 0) + return err; - bus_generic_detach(dev); + if ((err = bus_generic_detach(dev)) != 0) + return err; callout_stop(&sc->fc->timeout_callout); callout_stop(&sc->fc->bmr_callout); callout_stop(&sc->fc->retry_probe_callout); callout_stop(&sc->fc->busprobe_callout); -#if __FreeBSD_version >= 500000 - destroy_dev(sc->dev); -#else - { - int j; - for (j = 0 ; j < sc->fc->nisodma + 1; j++) - destroy_dev(sc->dev[j]); - } -#endif /* XXX xfree_free and untimeout on all xfers */ for (fwdev = STAILQ_FIRST(&sc->fc->devices); fwdev != NULL; fwdev = fwdev_next) { @@ -2197,5 +2168,33 @@ fw_bmr(struct firewire_comm *fc) return 0; } -DRIVER_MODULE(firewire,fwohci,firewire_driver,firewire_devclass,0,0); +static int +fw_modevent(module_t mode, int type, void *data) +{ + int err = 0; +#if __FreeBSD_version >= 500000 + static eventhandler_tag fwdev_ehtag = NULL; +#endif + + switch (type) { + case MOD_LOAD: +#if __FreeBSD_version >= 500000 + fwdev_ehtag = EVENTHANDLER_REGISTER(dev_clone, + fwdev_clone, 0, 1000); +#endif + break; + case MOD_UNLOAD: +#if __FreeBSD_version >= 500000 + if (fwdev_ehtag != NULL) + EVENTHANDLER_DEREGISTER(dev_clone, fwdev_ehtag); +#endif + break; + case MOD_SHUTDOWN: + break; + } + return (err); +} + + +DRIVER_MODULE(firewire,fwohci,firewire_driver,firewire_devclass,fw_modevent,0); MODULE_VERSION(firewire, 1); diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index b3ff16928ca0..b5f6573d6623 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -393,7 +393,8 @@ struct fw_crom_buf { #define unit2minor(x) (((x) & 0xff) | (((x) << 8) & ~0xffff)) #endif -#define UNIT2MIN(x) (((x) & 0xff) << 8) +#define MAKEMINOR(f, u, s) \ + unit2minor((f) | (((u) & 0xff) << 8) | (s & 0xff)) #define DEV2UNIT(x) ((dev2unit(x) & 0xff00) >> 8) #define DEV2SUB(x) (dev2unit(x) & 0xff) diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 3a69e4eb8921..e90f0c07f526 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -70,8 +70,6 @@ struct fw_device{ struct firewire_softc { #if __FreeBSD_version >= 500000 dev_t dev; -#else - dev_t dev[FWMAXNDMA+1]; #endif struct firewire_comm *fc; }; @@ -290,7 +288,9 @@ struct fw_device *fw_noderesolve_nodeid __P((struct firewire_comm *, int)); struct fw_device *fw_noderesolve_eui64 __P((struct firewire_comm *, struct fw_eui64 *)); struct fw_bind *fw_bindlookup __P((struct firewire_comm *, u_int32_t, u_int32_t)); void fw_drain_txq __P((struct firewire_comm *)); - +int fwdev_makedev __P((struct firewire_softc *)); +int fwdev_destroydev __P((struct firewire_softc *)); +void fwdev_clone __P((void *, char *, int, dev_t *)); extern int firewire_debug; extern devclass_t firewire_devclass; diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index abf0e476d8d3..0d61fb7867e7 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -46,6 +46,7 @@ #include #include +#include #include #include @@ -82,7 +83,8 @@ struct cdevsw firewire_cdevsw = .d_flags = D_MEM #else fw_open, fw_close, fw_read, fw_write, fw_ioctl, - fw_poll, fw_mmap, nostrategy, "fw", CDEV_MAJOR, nodump, nopsize, D_MEM + fw_poll, fw_mmap, nostrategy, "fw", CDEV_MAJOR, + nodump, nopsize, D_MEM, -1 #endif }; @@ -159,9 +161,6 @@ fwdev_freebuf(struct fw_xferq *q) static int fw_open (dev_t dev, int flags, int fmt, fw_proc *td) { - int unit = DEV2UNIT(dev); - int sub = DEV2SUB(dev); - int err = 0; if (dev->si_drv1 != NULL) @@ -171,11 +170,15 @@ fw_open (dev_t dev, int flags, int fmt, fw_proc *td) return fwmem_open(dev, flags, fmt, td); #if __FreeBSD_version >= 500000 - if ((dev->si_flags & SI_NAMED) == 0) -#endif + if ((dev->si_flags & SI_NAMED) == 0) { + int unit = DEV2UNIT(dev); + int sub = DEV2SUB(dev); + make_dev(&firewire_cdevsw, minor(dev), UID_ROOT, GID_OPERATOR, 0660, "fw%d.%d", unit, sub); + } +#endif dev->si_drv1 = malloc(sizeof(struct fw_drv1), M_FW, M_WAITOK | M_ZERO); @@ -718,7 +721,7 @@ fw_mmap (dev_t dev, vm_offset_t offset, int nproto) fw_mmap (dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) #endif { - struct firewire_softc *fc; + struct firewire_softc *sc; int unit = DEV2UNIT(dev); if (DEV_FWMEM(dev)) @@ -728,7 +731,91 @@ fw_mmap (dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) return fwmem_mmap(dev, offset, paddr, nproto); #endif - fc = devclass_get_softc(firewire_devclass, unit); + sc = devclass_get_softc(firewire_devclass, unit); return EINVAL; } + +int +fwdev_makedev(struct firewire_softc *sc) +{ + int err = 0; + +#if __FreeBSD_version >= 500000 + dev_t d; + int unit; + + unit = device_get_unit(sc->fc->bdev); + sc->dev = make_dev(&firewire_cdevsw, MAKEMINOR(0, unit, 0), + UID_ROOT, GID_OPERATOR, 0660, + "fw%d.%d", unit, 0); + d = make_dev(&firewire_cdevsw, + MAKEMINOR(FWMEM_FLAG, unit, 0), + UID_ROOT, GID_OPERATOR, 0660, + "fwmem%d.%d", unit, 0); + dev_depends(sc->dev, d); + make_dev_alias(sc->dev, "fw%d", unit); + make_dev_alias(d, "fwmem%d", unit); +#else + cdevsw_add(&firewire_cdevsw); +#endif + + return (err); +} + +int +fwdev_destroydev(struct firewire_softc *sc) +{ + int err = 0; + +#if __FreeBSD_version >= 500000 + destroy_dev(sc->dev); +#else + cdevsw_remove(&firewire_cdevsw); +#endif + return (err); +} + +#if __FreeBSD_version >= 500000 +#define NDEVTYPE 2 +void +fwdev_clone(void *arg, char *name, int namelen, dev_t *dev) +{ + struct firewire_softc *sc; + char *devnames[NDEVTYPE] = {"fw", "fwmem"}; + char *subp = NULL; + int devflag[NDEVTYPE] = {0, FWMEM_FLAG}; + int i, unit = 0, sub = 0; + + if (*dev != NODEV) + return; + + for (i = 0; i < NDEVTYPE; i++) + if (dev_stdclone(name, &subp, devnames[i], &unit) != 1) + goto found; + /* not match */ + return; +found: + + if (subp == NULL || *subp++ != '.') + return; + + /* /dev/fwU.S */ + while (isdigit(*subp)) { + sub *= 10; + sub += *subp++ - '0'; + } + if (*subp != '\0') + return; + + sc = devclass_get_softc(firewire_devclass, unit); + if (sc == NULL) + return; + *dev = make_dev(&firewire_cdevsw, MAKEMINOR(devflag[i], unit, sub), + UID_ROOT, GID_OPERATOR, 0660, + "%s%d.%d", devnames[i], unit, sub); + (*dev)->si_flags |= SI_CHEAPCLONE; + dev_depends(sc->dev, *dev); + return; +} +#endif -- cgit v1.3 From c727011a76a1101328e51b565a8db69b8221916c Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Wed, 1 Oct 2003 06:04:30 +0000 Subject: Fix a bug in fwdev_clone(). Spotted by: grog --- sys/dev/firewire/fwdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 0d61fb7867e7..545f1cd18666 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -791,7 +791,7 @@ fwdev_clone(void *arg, char *name, int namelen, dev_t *dev) return; for (i = 0; i < NDEVTYPE; i++) - if (dev_stdclone(name, &subp, devnames[i], &unit) != 1) + if (dev_stdclone(name, &subp, devnames[i], &unit) == 2) goto found; /* not match */ return; -- cgit v1.3 From c4778b5d1c8715bc45e1c54b783cc7c719104db0 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Thu, 2 Oct 2003 04:06:56 +0000 Subject: MFp4: Change struct fw_xfer to reduce memory copy in fwmem_*() functions. And many changes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * all - Major change of struct fw_xfer. o {send,recv}.buf is splitted into hdr and payload. o Remove unnecessary fields. o spd is moved under send and recv. - Remove unnecessary 'volatile' keyword. - Add definition of rtcode and extcode. * firewire.c - Ignore FWDEVINVAL devices in fw_noderesolve_nodeid(). - Check the existance of the bind before call STAILQ_REMOVE(). - Fix bug in the fw_bindadd(). - Change element of struct fw_bind for simplicity. - Check rtcode of response packet. - Reduce split transaction timeout to 200 msec. (100msec is the default value in the spec.) - Set watchdog timer cycle to 10 Hz. - Set xfer->tv just before calling fw_get_tlabel(). * fwohci.c - Simplifies fwohci_get_plen(). * sbp.c - Fix byte order of multibyte scsi_status informations. - Split sbp.c and sbp.h. - Unit number is not necessary for FIFO¤ address. - Reduce LOGIN_DELAY and SCAN_DELAY to 1 sec. - Add some constants defineded in SBP-2 spec. * fwmem.c - Introduce fwmem_strategy() and reduce memory copy. --- sys/dev/firewire/firewire.c | 437 ++++++++++++++++++++------------------ sys/dev/firewire/firewire.h | 33 ++- sys/dev/firewire/firewirereg.h | 45 +++- sys/dev/firewire/fwcrom.c | 7 +- sys/dev/firewire/fwdev.c | 86 ++++++-- sys/dev/firewire/fwmem.c | 251 ++++++++++------------ sys/dev/firewire/fwmem.h | 9 +- sys/dev/firewire/fwohci.c | 140 +++++------- sys/dev/firewire/fwohcireg.h | 14 +- sys/dev/firewire/if_fwe.c | 10 +- sys/dev/firewire/sbp.c | 225 +++++--------------- sys/dev/firewire/sbp.h | 202 ++++++++++++++++++ sys/modules/firewire/sbp/Makefile | 2 +- 13 files changed, 804 insertions(+), 657 deletions(-) create mode 100644 sys/dev/firewire/sbp.h (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 2775b0f84ed9..1fe238961cfa 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -141,12 +141,10 @@ fw_noderesolve_nodeid(struct firewire_comm *fc, int dst) s = splfw(); STAILQ_FOREACH(fwdev, &fc->devices, link) - if (fwdev->dst == dst) + if (fwdev->dst == dst && fwdev->status != FWDEVINVAL) break; splx(s); - if(fwdev == NULL) return NULL; - if(fwdev->status == FWDEVINVAL) return NULL; return fwdev; } @@ -184,15 +182,11 @@ fw_asyreq(struct firewire_comm *fc, int sub, struct fw_xfer *xfer) struct tcode_info *info; if(xfer == NULL) return EINVAL; - if(xfer->send.len > MAXREC(fc->maxrec)){ - printf("send.len > maxrec\n"); - return EINVAL; - } if(xfer->act.hand == NULL){ printf("act.hand == NULL\n"); return EINVAL; } - fp = (struct fw_pkt *)xfer->send.buf; + fp = &xfer->send.hdr; tcode = fp->mode.common.tcode & 0xf; info = &fc->tcode[tcode]; @@ -205,16 +199,21 @@ fw_asyreq(struct firewire_comm *fc, int sub, struct fw_xfer *xfer) else xferq = fc->ats; len = info->hdr_len; + if (xfer->send.pay_len > MAXREC(fc->maxrec)) { + printf("send.pay_len > maxrec\n"); + return EINVAL; + } if (info->flag & FWTI_BLOCK_STR) - len += fp->mode.stream.len; + len = fp->mode.stream.len; else if (info->flag & FWTI_BLOCK_ASY) - len += fp->mode.rresb.len; - if( len > xfer->send.len ){ - printf("len(%d) > send.len(%d) (tcode=%d)\n", - len, xfer->send.len, tcode); + len = fp->mode.rresb.len; + else + len = 0; + if (len != xfer->send.pay_len){ + printf("len(%d) != send.pay_len(%d) (tcode=%d)\n", + len, xfer->send.pay_len, tcode); return EINVAL; } - xfer->send.len = len; if(xferq->start == NULL){ printf("xferq->start == NULL\n"); @@ -226,7 +225,7 @@ fw_asyreq(struct firewire_comm *fc, int sub, struct fw_xfer *xfer) return EINVAL; } - + microtime(&xfer->tv); if (info->flag & FWTI_TLABEL) { if((tl = fw_get_tlabel(fc, xfer)) == -1 ) return EIO; @@ -314,8 +313,8 @@ firewire_xfer_timeout(struct firewire_comm *fc) struct timeval split_timeout; int i, s; - split_timeout.tv_sec = 6; - split_timeout.tv_usec = 0; + split_timeout.tv_sec = 0; + split_timeout.tv_usec = 200 * 1000; /* 200 msec */ microtime(&tv); timevalsub(&tv, &split_timeout); @@ -329,7 +328,7 @@ firewire_xfer_timeout(struct firewire_comm *fc) break; device_printf(fc->bdev, "split transaction timeout dst=0x%x tl=0x%x state=%d\n", - xfer->dst, i, xfer->state); + xfer->send.hdr.mode.hdr.dst, i, xfer->state); xfer->resp = ETIMEDOUT; STAILQ_REMOVE_HEAD(&fc->tlabels[i], link); fw_xfer_done(xfer); @@ -346,7 +345,7 @@ firewire_watchdog(void *arg) fc = (struct firewire_comm *)arg; firewire_xfer_timeout(fc); fc->timeout(fc); - callout_reset(&fc->timeout_callout, hz, + callout_reset(&fc->timeout_callout, hz / 10, (void *)firewire_watchdog, (void *)fc); } @@ -776,22 +775,22 @@ void fw_init(struct firewire_comm *fc) #endif } +#define BIND_CMP(addr, fwb) (((addr) < (fwb)->start)?-1:\ + ((fwb)->end < (addr))?1:0) + /* * To lookup binded process from IEEE1394 address. */ struct fw_bind * -fw_bindlookup(struct firewire_comm *fc, u_int32_t dest_hi, u_int32_t dest_lo) +fw_bindlookup(struct firewire_comm *fc, u_int16_t dest_hi, u_int32_t dest_lo) { + u_int64_t addr; struct fw_bind *tfw; - for(tfw = STAILQ_FIRST(&fc->binds) ; tfw != NULL ; - tfw = STAILQ_NEXT(tfw, fclist)){ - if (tfw->act_type != FWACT_NULL && - tfw->start_hi == dest_hi && - tfw->start_lo <= dest_lo && - (tfw->start_lo + tfw->addrlen) > dest_lo){ + + addr = ((u_int64_t)dest_hi << 32) | dest_lo; + STAILQ_FOREACH(tfw, &fc->binds, fclist) + if (tfw->act_type != FWACT_NULL && BIND_CMP(addr, tfw) == 0) return(tfw); - } - } return(NULL); } @@ -801,45 +800,34 @@ fw_bindlookup(struct firewire_comm *fc, u_int32_t dest_hi, u_int32_t dest_lo) int fw_bindadd(struct firewire_comm *fc, struct fw_bind *fwb) { - struct fw_bind *tfw, *tfw2 = NULL; - int err = 0; - tfw = STAILQ_FIRST(&fc->binds); - if(tfw == NULL){ - STAILQ_INSERT_HEAD(&fc->binds, fwb, fclist); - goto out; + struct fw_bind *tfw, *prev = NULL; + + if (fwb->start > fwb->end) { + printf("%s: invalid range\n", __FUNCTION__); + return EINVAL; } - if((tfw->start_hi > fwb->start_hi) || - (tfw->start_hi == fwb->start_hi && - (tfw->start_lo > (fwb->start_lo + fwb->addrlen)))){ + + STAILQ_FOREACH(tfw, &fc->binds, fclist) { + if (fwb->end < tfw->start) + break; + prev = tfw; + } + if (prev == NULL) { STAILQ_INSERT_HEAD(&fc->binds, fwb, fclist); goto out; } - for(; tfw != NULL; tfw = STAILQ_NEXT(tfw, fclist)){ - if((tfw->start_hi < fwb->start_hi) || - (tfw->start_hi == fwb->start_hi && - (tfw->start_lo + tfw->addrlen) < fwb->start_lo)){ - tfw2 = STAILQ_NEXT(tfw, fclist); - if(tfw2 == NULL) - break; - if((tfw2->start_hi > fwb->start_hi) || - (tfw2->start_hi == fwb->start_hi && - tfw2->start_lo > (fwb->start_lo + fwb->addrlen))){ - break; - }else{ - err = EBUSY; - goto out; - } - } - } - if(tfw != NULL){ - STAILQ_INSERT_AFTER(&fc->binds, tfw, fwb, fclist); - }else{ - STAILQ_INSERT_TAIL(&fc->binds, fwb, fclist); + if (prev->end < fwb->start) { + STAILQ_INSERT_AFTER(&fc->binds, prev, fwb, fclist); + goto out; } + + printf("%s: bind failed\n", __FUNCTION__); + return (EBUSY); + out: - if (!err && fwb->act_type == FWACT_CH) + if (fwb->act_type == FWACT_CH) STAILQ_INSERT_HEAD(&fc->ir[fwb->sub]->binds, fwb, chlist); - return err; + return (0); } /* @@ -848,18 +836,31 @@ out: int fw_bindremove(struct firewire_comm *fc, struct fw_bind *fwb) { - int s; +#if 0 struct fw_xfer *xfer, *next; +#endif + struct fw_bind *tfw; + int s; s = splfw(); - /* shall we check the existance? */ - STAILQ_REMOVE(&fc->binds, fwb, fw_bind, fclist); + STAILQ_FOREACH(tfw, &fc->binds, fclist) + if (tfw == fwb) { + STAILQ_REMOVE(&fc->binds, fwb, fw_bind, fclist); + goto found; + } + + printf("%s: no such bind\n", __FUNCTION__); + splx(s); + return (1); +found: +#if 0 /* shall we do this? */ for (xfer = STAILQ_FIRST(&fwb->xferlist); xfer != NULL; xfer = next) { next = STAILQ_NEXT(xfer, link); fw_xfer_free(xfer); } STAILQ_INIT(&fwb->xferlist); +#endif splx(s); return 0; @@ -899,7 +900,7 @@ fw_tl2xfer(struct firewire_comm *fc, int node, int tlabel) for( tl = STAILQ_FIRST(&fc->tlabels[tlabel]); tl != NULL; tl = STAILQ_NEXT(tl, link)){ - if(tl->xfer->dst == node){ + if(tl->xfer->send.hdr.mode.hdr.dst == node){ xfer = tl->xfer; splx(s); if (firewire_debug > 2) @@ -925,7 +926,6 @@ fw_xfer_alloc(struct malloc_type *type) if (xfer == NULL) return xfer; - microtime(&xfer->tv); xfer->malloc = type; return xfer; @@ -937,22 +937,22 @@ fw_xfer_alloc_buf(struct malloc_type *type, int send_len, int recv_len) struct fw_xfer *xfer; xfer = fw_xfer_alloc(type); - xfer->send.len = send_len; - xfer->recv.len = recv_len; + xfer->send.pay_len = send_len; + xfer->recv.pay_len = recv_len; if (xfer == NULL) return(NULL); - if (send_len) { - xfer->send.buf = malloc(send_len, type, M_NOWAIT | M_ZERO); - if (xfer->send.buf == NULL) { + if (send_len > 0) { + xfer->send.payload = malloc(send_len, type, M_NOWAIT | M_ZERO); + if (xfer->send.payload == NULL) { fw_xfer_free(xfer); return(NULL); } } - if (recv_len) { - xfer->recv.buf = malloc(recv_len, type, M_NOWAIT); - if (xfer->recv.buf == NULL) { - if (xfer->send.buf != NULL) - free(xfer->send.buf, type); + if (recv_len > 0) { + xfer->recv.payload = malloc(recv_len, type, M_NOWAIT); + if (xfer->recv.payload == NULL) { + if (xfer->send.payload != NULL) + free(xfer->send.payload, type); fw_xfer_free(xfer); return(NULL); } @@ -1015,20 +1015,34 @@ fw_xfer_unload(struct fw_xfer* xfer) * To free IEEE1394 XFER structure. */ void -fw_xfer_free( struct fw_xfer* xfer) +fw_xfer_free_buf( struct fw_xfer* xfer) { - if(xfer == NULL ) return; + if (xfer == NULL) { + printf("%s: xfer == NULL\n", __FUNCTION__); + return; + } fw_xfer_unload(xfer); - if(xfer->send.buf != NULL){ - free(xfer->send.buf, xfer->malloc); + if(xfer->send.payload != NULL){ + free(xfer->send.payload, xfer->malloc); } - if(xfer->recv.buf != NULL){ - free(xfer->recv.buf, xfer->malloc); + if(xfer->recv.payload != NULL){ + free(xfer->recv.payload, xfer->malloc); } free(xfer, xfer->malloc); } -static void +void +fw_xfer_free( struct fw_xfer* xfer) +{ + if (xfer == NULL) { + printf("%s: xfer == NULL\n", __FUNCTION__); + return; + } + fw_xfer_unload(xfer); + free(xfer, xfer->malloc); +} + +void fw_asy_callback_free(struct fw_xfer *xfer) { #if 0 @@ -1049,14 +1063,14 @@ fw_phy_config(struct firewire_comm *fc, int root_node, int gap_count) fc->status = FWBUSPHYCONF; - xfer = fw_xfer_alloc_buf(M_FWXFER, 12, 0); + xfer = fw_xfer_alloc(M_FWXFER); if (xfer == NULL) return; xfer->fc = fc; xfer->retry_req = fw_asybusy; xfer->act.hand = fw_asy_callback_free; - fp = (struct fw_pkt *)xfer->send.buf; + fp = &xfer->send.hdr; fp->mode.ld[1] = 0; if (root_node >= 0) fp->mode.ld[1] |= (root_node & 0x3f) << 24 | 1 << 23; @@ -1337,19 +1351,18 @@ dorequest: fw_bus_explore_callback); if(xfer == NULL) goto done; #else - xfer = fw_xfer_alloc_buf(M_FWXFER, 16, 16); + xfer = fw_xfer_alloc(M_FWXFER); if(xfer == NULL){ goto done; } - xfer->spd = 0; - fp = (struct fw_pkt *)xfer->send.buf; + xfer->send.spd = 0; + fp = &xfer->send.hdr; fp->mode.rreqq.dest_hi = 0xffff; fp->mode.rreqq.tlrt = 0; fp->mode.rreqq.tcode = FWTCODE_RREQQ; fp->mode.rreqq.pri = 0; fp->mode.rreqq.src = 0; - xfer->dst = FWLOCALBUS | fc->ongonode; - fp->mode.rreqq.dst = xfer->dst; + fp->mode.rreqq.dst = FWLOCALBUS | fc->ongonode; fp->mode.rreqq.dest_lo = addr; xfer->act.hand = fw_bus_explore_callback; @@ -1383,12 +1396,12 @@ asyreqq(struct firewire_comm *fc, u_int8_t spd, u_int8_t tl, u_int8_t rt, struct fw_pkt *fp; int err; - xfer = fw_xfer_alloc_buf(M_FWXFER, 16, 16); + xfer = fw_xfer_alloc(M_FWXFER); if (xfer == NULL) return NULL; - xfer->spd = spd; /* XXX:min(spd, fc->spd) */ - fp = (struct fw_pkt *)xfer->send.buf; + xfer->send.spd = spd; /* XXX:min(spd, fc->spd) */ + fp = &xfer->send.hdr; fp->mode.rreqq.dest_hi = addr_hi & 0xffff; if(tl & FWP_TL_VALID){ fp->mode.rreqq.tlrt = (tl & 0x3f) << 2; @@ -1399,8 +1412,7 @@ asyreqq(struct firewire_comm *fc, u_int8_t spd, u_int8_t tl, u_int8_t rt, fp->mode.rreqq.tcode = FWTCODE_RREQQ; fp->mode.rreqq.pri = 0; fp->mode.rreqq.src = 0; - xfer->dst = addr_hi >> 16; - fp->mode.rreqq.dst = xfer->dst; + fp->mode.rreqq.dst = addr_hi >> 16; fp->mode.rreqq.dest_lo = addr_lo; xfer->act.hand = hand; @@ -1442,19 +1454,8 @@ fw_bus_explore_callback(struct fw_xfer *xfer) goto errnode; } - if(xfer->send.buf == NULL){ - printf("node%d: send.buf=NULL addr=0x%x\n", - fc->ongonode, fc->ongoaddr); - goto errnode; - } - sfp = (struct fw_pkt *)xfer->send.buf; - - if(xfer->recv.buf == NULL){ - printf("node%d: recv.buf=NULL addr=0x%x\n", - fc->ongonode, fc->ongoaddr); - goto errnode; - } - rfp = (struct fw_pkt *)xfer->recv.buf; + sfp = &xfer->send.hdr; + rfp = &xfer->recv.hdr; #if 0 { u_int32_t *qld; @@ -1650,7 +1651,9 @@ fw_get_tlabel(struct firewire_comm *fc, struct fw_xfer *xfer) label = (label + 1) & 0x3f; for(tmptl = STAILQ_FIRST(&fc->tlabels[label]); tmptl != NULL; tmptl = STAILQ_NEXT(tmptl, link)){ - if(tmptl->xfer->dst == xfer->dst) break; + if (tmptl->xfer->send.hdr.mode.hdr.dst == + xfer->send.hdr.mode.hdr.dst) + break; } if(tmptl == NULL) { tl = malloc(sizeof(struct tlabel),M_FW,M_NOWAIT); @@ -1663,7 +1666,7 @@ fw_get_tlabel(struct firewire_comm *fc, struct fw_xfer *xfer) splx(s); if (firewire_debug > 1) printf("fw_get_tlabel: dst=%d tl=%d\n", - xfer->dst, label); + xfer->send.hdr.mode.hdr.dst, label); return(label); } } @@ -1674,39 +1677,67 @@ fw_get_tlabel(struct firewire_comm *fc, struct fw_xfer *xfer) } static void -fw_rcv_copy(struct fw_xfer *xfer, struct iovec *vec, int nvec) +fw_rcv_copy(struct fw_rcv_buf *rb) { - char *p; - int res, i, len; + struct fw_pkt *pkt; + u_char *p; + struct tcode_info *tinfo; + u_int res, i, len, plen; + + rb->xfer->recv.spd -= rb->spd; + + pkt = (struct fw_pkt *)rb->vec->iov_base; + tinfo = &rb->fc->tcode[pkt->mode.hdr.tcode]; + + /* Copy header */ + p = (u_char *)&rb->xfer->recv.hdr; + bcopy(rb->vec->iov_base, p, tinfo->hdr_len); + (u_char *)rb->vec->iov_base += tinfo->hdr_len; + rb->vec->iov_len -= tinfo->hdr_len; + + /* Copy payload */ + p = (u_char *)rb->xfer->recv.payload; + res = rb->xfer->recv.pay_len; + + /* special handling for RRESQ */ + if (pkt->mode.hdr.tcode == FWTCODE_RRESQ && + p != NULL && res >= sizeof(u_int32_t)) { + *(u_int32_t *)p = pkt->mode.rresq.data; + rb->xfer->recv.pay_len = sizeof(u_int32_t); + return; + } + + if ((tinfo->flag & FWTI_BLOCK_ASY) == 0) + return; + + plen = pkt->mode.rresb.len; - p = xfer->recv.buf; - res = xfer->recv.len; - for (i = 0; i < nvec; i++, vec++) { - len = vec->iov_len; + for (i = 0; i < rb->nvec; i++, rb->vec++) { + len = MIN(rb->vec->iov_len, plen); if (res < len) { printf("rcv buffer(%d) is %d bytes short.\n", - xfer->recv.len, len - res); + rb->xfer->recv.pay_len, len - res); len = res; } - bcopy(vec->iov_base, p, len); + bcopy(rb->vec->iov_base, p, len); p += len; res -= len; - if (res <= 0) + plen -= len; + if (res == 0 || plen == 0) break; } - xfer->recv.len -= res; + rb->xfer->recv.pay_len -= res; + } /* * Generic packet receving process. */ void -fw_rcv(struct firewire_comm *fc, struct iovec *vec, int nvec, u_int sub, u_int spd) +fw_rcv(struct fw_rcv_buf *rb) { struct fw_pkt *fp, *resfp; - struct fw_xfer *xfer; struct fw_bind *bind; - struct firewire_softc *sc; int tcode, s; int i, len, oldstate; #if 0 @@ -1722,27 +1753,16 @@ fw_rcv(struct firewire_comm *fc, struct iovec *vec, int nvec, u_int sub, u_int s if((i % 16) != 15) printf("\n"); } #endif - fp = (struct fw_pkt *)vec[0].iov_base; + fp = (struct fw_pkt *)rb->vec[0].iov_base; tcode = fp->mode.common.tcode; -#if 0 /* XXX this check is not valid for RRESQ and WREQQ */ - if (vec[0].iov_len < fc->tcode[tcode].hdr_len) { -#if __FreeBSD_version >= 500000 - printf("fw_rcv: iov_len(%zu) is less than" -#else - printf("fw_rcv: iov_len(%u) is less than" -#endif - " hdr_len(%d:tcode=%d)\n", vec[0].iov_len, - fc->tcode[tcode].hdr_len, tcode); - } -#endif switch (tcode) { case FWTCODE_WRES: case FWTCODE_RRESQ: case FWTCODE_RRESB: case FWTCODE_LRES: - xfer = fw_tl2xfer(fc, fp->mode.hdr.src, + rb->xfer = fw_tl2xfer(rb->fc, fp->mode.hdr.src, fp->mode.hdr.tlrt >> 2); - if(xfer == NULL) { + if(rb->xfer == NULL) { printf("fw_rcv: unknown response " "tcode=%d src=0x%x tl=0x%x rt=%d data=0x%x\n", tcode, @@ -1752,9 +1772,9 @@ fw_rcv(struct firewire_comm *fc, struct iovec *vec, int nvec, u_int sub, u_int s fp->mode.rresq.data); #if 1 printf("try ad-hoc work around!!\n"); - xfer = fw_tl2xfer(fc, fp->mode.hdr.src, + rb->xfer = fw_tl2xfer(rb->fc, fp->mode.hdr.src, (fp->mode.hdr.tlrt >> 2)^3); - if (xfer == NULL) { + if (rb->xfer == NULL) { printf("no use...\n"); goto err; } @@ -1762,23 +1782,26 @@ fw_rcv(struct firewire_comm *fc, struct iovec *vec, int nvec, u_int sub, u_int s goto err; #endif } - fw_rcv_copy(xfer, vec, nvec); - xfer->resp = 0; + fw_rcv_copy(rb); + if (rb->xfer->recv.hdr.mode.wres.rtcode != RESP_CMP) + rb->xfer->resp = EIO; + else + rb->xfer->resp = 0; /* make sure the packet is drained in AT queue */ - oldstate = xfer->state; - xfer->state = FWXF_RCVD; + oldstate = rb->xfer->state; + rb->xfer->state = FWXF_RCVD; switch (oldstate) { case FWXF_SENT: - fw_xfer_done(xfer); + fw_xfer_done(rb->xfer); break; case FWXF_START: #if 0 if (firewire_debug) - printf("not sent yet tl=%x\n", xfer->tl); + printf("not sent yet tl=%x\n", rb->xfer->tl); #endif break; default: - printf("unexpected state %d\n", xfer->state); + printf("unexpected state %d\n", rb->xfer->state); } return; case FWTCODE_WREQQ: @@ -1786,107 +1809,104 @@ fw_rcv(struct firewire_comm *fc, struct iovec *vec, int nvec, u_int sub, u_int s case FWTCODE_RREQQ: case FWTCODE_RREQB: case FWTCODE_LREQ: - bind = fw_bindlookup(fc, fp->mode.rreqq.dest_hi, + bind = fw_bindlookup(rb->fc, fp->mode.rreqq.dest_hi, fp->mode.rreqq.dest_lo); if(bind == NULL){ #if __FreeBSD_version >= 500000 - printf("Unknown service addr 0x%08x:0x%08x tcode=%x src=0x%x data=%x\n", + printf("Unknown service addr 0x%04x:0x%08x tcode=%x src=0x%x data=%x\n", #else - printf("Unknown service addr 0x%08x:0x%08x tcode=%x src=0x%x data=%lx\n", + printf("Unknown service addr 0x%04x:0x%08x tcode=%x src=0x%x data=%lx\n", #endif fp->mode.wreqq.dest_hi, fp->mode.wreqq.dest_lo, tcode, fp->mode.hdr.src, ntohl(fp->mode.wreqq.data)); - if (fc->status == FWBUSRESET) { + if (rb->fc->status == FWBUSRESET) { printf("fw_rcv: cannot respond(bus reset)!\n"); goto err; } - xfer = fw_xfer_alloc_buf(M_FWXFER, 16, 0); - if(xfer == NULL){ + rb->xfer = fw_xfer_alloc(M_FWXFER); + if(rb->xfer == NULL){ return; } - xfer->spd = spd; - resfp = (struct fw_pkt *)xfer->send.buf; + rb->xfer->send.spd = rb->spd; + rb->xfer->send.pay_len = 0; + resfp = &rb->xfer->send.hdr; switch (tcode) { case FWTCODE_WREQQ: case FWTCODE_WREQB: resfp->mode.hdr.tcode = FWTCODE_WRES; - xfer->send.len = 12; break; case FWTCODE_RREQQ: resfp->mode.hdr.tcode = FWTCODE_RRESQ; - xfer->send.len = 16; break; case FWTCODE_RREQB: resfp->mode.hdr.tcode = FWTCODE_RRESB; - xfer->send.len = 16; break; case FWTCODE_LREQ: resfp->mode.hdr.tcode = FWTCODE_LRES; - xfer->send.len = 16; break; } resfp->mode.hdr.dst = fp->mode.hdr.src; resfp->mode.hdr.tlrt = fp->mode.hdr.tlrt; resfp->mode.hdr.pri = fp->mode.hdr.pri; - resfp->mode.rresb.rtcode = 7; + resfp->mode.rresb.rtcode = RESP_ADDRESS_ERROR; resfp->mode.rresb.extcode = 0; resfp->mode.rresb.len = 0; /* - xfer->act.hand = fw_asy_callback; + rb->xfer->act.hand = fw_asy_callback; */ - xfer->act.hand = fw_xfer_free; - if(fw_asyreq(fc, -1, xfer)){ - fw_xfer_free( xfer); + rb->xfer->act.hand = fw_xfer_free; + if(fw_asyreq(rb->fc, -1, rb->xfer)){ + fw_xfer_free(rb->xfer); return; } goto err; } len = 0; - for (i = 0; i < nvec; i ++) - len += vec[i].iov_len; + for (i = 0; i < rb->nvec; i ++) + len += rb->vec[i].iov_len; switch(bind->act_type){ case FWACT_XFER: /* splfw()?? */ - xfer = STAILQ_FIRST(&bind->xferlist); - if (xfer == NULL) { + rb->xfer = STAILQ_FIRST(&bind->xferlist); + if (rb->xfer == NULL) { printf("Discard a packet for this bind.\n"); goto err; } STAILQ_REMOVE_HEAD(&bind->xferlist, link); - fw_rcv_copy(xfer, vec, nvec); - xfer->spd = spd; - if (fc->status != FWBUSRESET) - xfer->act.hand(xfer); + fw_rcv_copy(rb); + if (rb->fc->status != FWBUSRESET) + rb->xfer->act.hand(rb->xfer); else - STAILQ_INSERT_TAIL(&fc->pending, xfer, link); + STAILQ_INSERT_TAIL(&rb->fc->pending, + rb->xfer, link); return; break; case FWACT_CH: - if(fc->ir[bind->sub]->queued >= - fc->ir[bind->sub]->maxq){ - device_printf(fc->bdev, + if(rb->fc->ir[bind->sub]->queued >= + rb->fc->ir[bind->sub]->maxq){ + device_printf(rb->fc->bdev, "Discard a packet %x %d\n", bind->sub, - fc->ir[bind->sub]->queued); + rb->fc->ir[bind->sub]->queued); goto err; } - xfer = STAILQ_FIRST(&bind->xferlist); - if (xfer == NULL) { + rb->xfer = STAILQ_FIRST(&bind->xferlist); + if (rb->xfer == NULL) { printf("Discard packet for this bind\n"); goto err; } STAILQ_REMOVE_HEAD(&bind->xferlist, link); - fw_rcv_copy(xfer, vec, nvec); - xfer->spd = spd; + fw_rcv_copy(rb); s = splfw(); - fc->ir[bind->sub]->queued++; - STAILQ_INSERT_TAIL(&fc->ir[bind->sub]->q, xfer, link); + rb->fc->ir[bind->sub]->queued++; + STAILQ_INSERT_TAIL(&rb->fc->ir[bind->sub]->q, + rb->xfer, link); splx(s); - wakeup((caddr_t)fc->ir[bind->sub]); + wakeup((caddr_t)rb->fc->ir[bind->sub]); return; break; @@ -1895,11 +1915,12 @@ fw_rcv(struct firewire_comm *fc, struct iovec *vec, int nvec, u_int sub, u_int s break; } break; +#if 0 /* shouldn't happen ?? or for GASP */ case FWTCODE_STREAM: { struct fw_xferq *xferq; - xferq = fc->ir[sub]; + xferq = rb->fc->ir[sub]; #if 0 printf("stream rcv dma %d len %d off %d spd %d\n", sub, len, off, spd); @@ -1910,16 +1931,15 @@ fw_rcv(struct firewire_comm *fc, struct iovec *vec, int nvec, u_int sub, u_int s } /* XXX get xfer from xfer queue, we don't need copy for per packet mode */ - xfer = fw_xfer_alloc_buf(M_FWXFER, 0, /* XXX */ + rb->xfer = fw_xfer_alloc_buf(M_FWXFER, 0, /* XXX */ vec[0].iov_len); - if(xfer == NULL) goto err; - fw_rcv_copy(xfer, vec, nvec); - xfer->spd = spd; + if (rb->xfer == NULL) goto err; + fw_rcv_copy(rb) s = splfw(); xferq->queued++; - STAILQ_INSERT_TAIL(&xferq->q, xfer, link); + STAILQ_INSERT_TAIL(&xferq->q, rb->xfer, link); splx(s); - sc = device_get_softc(fc->bdev); + sc = device_get_softc(rb->fc->bdev); #if __FreeBSD_version >= 500000 if (SEL_WAITING(&xferq->rsel)) #else @@ -1936,6 +1956,7 @@ fw_rcv(struct firewire_comm *fc, struct iovec *vec, int nvec, u_int sub, u_int s return; break; } +#endif default: printf("fw_rcv: unknow tcode %d\n", tcode); break; @@ -1950,7 +1971,6 @@ err: static void fw_try_bmr_callback(struct fw_xfer *xfer) { - struct fw_pkt *rfp; struct firewire_comm *fc; int bmr; @@ -1959,26 +1979,23 @@ fw_try_bmr_callback(struct fw_xfer *xfer) fc = xfer->fc; if (xfer->resp != 0) goto error; - if (xfer->send.buf == NULL) + if (xfer->recv.payload == NULL) goto error; - if (xfer->recv.buf == NULL) - goto error; - rfp = (struct fw_pkt *)xfer->recv.buf; - if (rfp->mode.lres.rtcode != FWRCODE_COMPLETE) + if (xfer->recv.hdr.mode.lres.rtcode != FWRCODE_COMPLETE) goto error; - bmr = ntohl(rfp->mode.lres.payload[0]); + bmr = ntohl(xfer->recv.payload[0]); if (bmr == 0x3f) bmr = fc->nodeid; CSRARC(fc, BUS_MGR_ID) = fc->set_bmr(fc, bmr & 0x3f); - fw_xfer_free(xfer); + fw_xfer_free_buf(xfer); fw_bmr(fc); return; error: device_printf(fc->bdev, "bus manager election failed\n"); - fw_xfer_free(xfer); + fw_xfer_free_buf(xfer); } @@ -1993,31 +2010,30 @@ fw_try_bmr(void *arg) struct fw_pkt *fp; int err = 0; - xfer = fw_xfer_alloc_buf(M_FWXFER, 24, 20); + xfer = fw_xfer_alloc_buf(M_FWXFER, 8, 4); if(xfer == NULL){ return; } - xfer->spd = 0; + xfer->send.spd = 0; fc->status = FWBUSMGRELECT; - fp = (struct fw_pkt *)xfer->send.buf; + fp = &xfer->send.hdr; fp->mode.lreq.dest_hi = 0xffff; fp->mode.lreq.tlrt = 0; fp->mode.lreq.tcode = FWTCODE_LREQ; fp->mode.lreq.pri = 0; fp->mode.lreq.src = 0; fp->mode.lreq.len = 8; - fp->mode.lreq.extcode = FW_LREQ_CMPSWAP; - xfer->dst = FWLOCALBUS | fc->irm; - fp->mode.lreq.dst = xfer->dst; + fp->mode.lreq.extcode = EXTCODE_CMP_SWAP; + fp->mode.lreq.dst = FWLOCALBUS | fc->irm; fp->mode.lreq.dest_lo = 0xf0000000 | BUS_MGR_ID; - fp->mode.lreq.payload[0] = htonl(0x3f); - fp->mode.lreq.payload[1] = htonl(fc->nodeid); + xfer->send.payload[0] = htonl(0x3f); + xfer->send.payload[1] = htonl(fc->nodeid); xfer->act.hand = fw_try_bmr_callback; err = fw_asyreq(fc, -1, xfer); if(err){ - fw_xfer_free( xfer); + fw_xfer_free_buf(xfer); return; } return; @@ -2124,6 +2140,7 @@ fw_bmr(struct firewire_comm *fc) struct fw_device fwdev; union fw_self_id *self_id; int cmstr; + u_int32_t quad; /* Check to see if the current root node is cycle master capable */ self_id = &fc->topology_map->self_id[fc->max_node]; @@ -2163,9 +2180,9 @@ fw_bmr(struct firewire_comm *fc) fwdev.maxrec = 8; /* 512 */ fwdev.status = FWDEVINIT; /* Set cmstr bit on the cycle master */ + quad = htonl(1 << 8); fwmem_write_quad(&fwdev, NULL, 0/*spd*/, - 0xffff, 0xf0000000 | STATE_SET, htonl(1 << 8), - fw_asy_callback_free); + 0xffff, 0xf0000000 | STATE_SET, &quad, fw_asy_callback_free); return 0; } diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index ca9cbac245c7..0063f47baf83 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -190,12 +190,6 @@ struct fw_pkt { BIT16x2(src, dest_hi); u_int32_t dest_lo; BIT16x2(len, extcode); -#define FW_LREQ_MSKSWAP 1 -#define FW_LREQ_CMPSWAP 2 -#define FW_LREQ_FTADD 3 -#define FW_LREQ_LTADD 4 -#define FW_LREQ_BDADD 5 -#define FW_LREQ_WRADD 6 u_int32_t payload[0]; } lreq; struct { @@ -215,6 +209,33 @@ struct fw_pkt { } mode; }; +/* + * Response code (rtcode) + */ +/* The node has successfully completed the command. */ +#define RESP_CMP 0 +/* A resource conflict was detected. The request may be retried. */ +#define RESP_CONFLICT_ERROR 4 +/* Hardware error, data is unavailable. */ +#define RESP_DATA_ERROR 5 +/* A field in the request packet header was set to an unsupported or incorrect + * value, or an invalid transaction was attempted (e.g., a write to a read-only + * address). */ +#define RESP_TYPE_ERROR 6 +/* The destination offset field in the request was set to an address not + * accessible in the destination node. */ +#define RESP_ADDRESS_ERROR 7 + +/* + * Extended transaction code (extcode) + */ +#define EXTCODE_MASK_SWAP 1 +#define EXTCODE_CMP_SWAP 2 +#define EXTCODE_FETCH_ADD 3 +#define EXTCODE_LITTLE_ADD 4 +#define EXTCODE_BOUNDED_ADD 5 +#define EXTCODE_WRAP_ADD 6 + struct fw_eui64 { u_int32_t hi, lo; }; diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index e90f0c07f526..0f97574f542e 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -224,7 +224,8 @@ struct tlabel{ }; struct fw_bind{ - u_int32_t start_hi, start_lo, addrlen; + u_int64_t start; + u_int64_t end; STAILQ_HEAD(, fw_xfer) xferlist; STAILQ_ENTRY(fw_bind) fclist; STAILQ_ENTRY(fw_bind) chlist; @@ -240,9 +241,6 @@ struct fw_xfer{ struct firewire_comm *fc; struct fw_xferq *q; struct timeval tv; - /* XXX should be removed */ - u_int32_t dst; /* XXX for if_fwe */ - u_int8_t spd; int8_t resp; #define FWXF_INIT 0 #define FWXF_INQ 1 @@ -259,16 +257,28 @@ struct fw_xfer{ void (*hand) __P((struct fw_xfer *)); } act; struct { - int len; - caddr_t buf; + struct fw_pkt hdr; + u_int32_t *payload; + u_int16_t pay_len; + u_int8_t spd; } send, recv; struct mbuf *mbuf; STAILQ_ENTRY(fw_xfer) link; struct malloc_type *malloc; }; + +struct fw_rcv_buf { + struct firewire_comm *fc; + struct fw_xfer *xfer; + struct iovec *vec; + u_int nvec; + u_int8_t spd; +}; + void fw_sidrcv __P((struct firewire_comm *, u_int32_t *, u_int)); -void fw_rcv __P((struct firewire_comm *, struct iovec *, int, u_int, u_int)); +void fw_rcv __P((struct fw_rcv_buf *)); void fw_xfer_unload __P(( struct fw_xfer*)); +void fw_xfer_free_buf __P(( struct fw_xfer*)); void fw_xfer_free __P(( struct fw_xfer*)); struct fw_xfer *fw_xfer_alloc __P((struct malloc_type *)); struct fw_xfer *fw_xfer_alloc_buf __P((struct malloc_type *, int, int)); @@ -284,9 +294,10 @@ u_int16_t fw_crc16 __P((u_int32_t *, u_int32_t)); void fw_xfer_timeout __P((void *)); void fw_xfer_done __P((struct fw_xfer *)); void fw_asy_callback __P((struct fw_xfer *)); +void fw_asy_callback_free __P((struct fw_xfer *)); struct fw_device *fw_noderesolve_nodeid __P((struct firewire_comm *, int)); struct fw_device *fw_noderesolve_eui64 __P((struct firewire_comm *, struct fw_eui64 *)); -struct fw_bind *fw_bindlookup __P((struct firewire_comm *, u_int32_t, u_int32_t)); +struct fw_bind *fw_bindlookup __P((struct firewire_comm *, u_int16_t, u_int32_t)); void fw_drain_txq __P((struct firewire_comm *)); int fwdev_makedev __P((struct firewire_softc *)); int fwdev_destroydev __P((struct firewire_softc *)); @@ -303,5 +314,23 @@ extern devclass_t firewire_devclass; #define CALLOUT_INIT(x) callout_init(x) #endif +#if __FreeBSD_version < 500000 +/* compatibility shim for 4.X */ +#define bio buf +#define bio_bcount b_bcount +#define bio_cmd b_flags +#define bio_count b_count +#define bio_data b_data +#define bio_dev b_dev +#define bio_error b_error +#define bio_flags b_flags +#define bio_offset b_offset +#define bio_resid b_resid +#define BIO_ERROR B_ERROR +#define BIO_READ B_READ +#define BIO_WRITE B_WRITE +#define MIN(a,b) (((a)<(b))?(a):(b)) +#endif + MALLOC_DECLARE(M_FW); MALLOC_DECLARE(M_FWXFER); diff --git a/sys/dev/firewire/fwcrom.c b/sys/dev/firewire/fwcrom.c index ce7dfd3d1c28..15dd818e2728 100644 --- a/sys/dev/firewire/fwcrom.c +++ b/sys/dev/firewire/fwcrom.c @@ -424,6 +424,7 @@ crom_add_chunk(struct crom_src *src, struct crom_chunk *parent, return(index); } +#define MAX_TEXT ((CROM_MAX_CHUNK_LEN + 1) * 4 - sizeof(struct csrtext)) int crom_add_simple_text(struct crom_src *src, struct crom_chunk *parent, struct crom_chunk *chunk, char *buf) @@ -431,9 +432,9 @@ crom_add_simple_text(struct crom_src *src, struct crom_chunk *parent, struct csrtext *tl; u_int32_t *p; int len, i; + char t[MAX_TEXT]; len = strlen(buf); -#define MAX_TEXT ((CROM_MAX_CHUNK_LEN + 1) * 4 - sizeof(struct csrtext)) if (len > MAX_TEXT) { #if __FreeBSD_version < 500000 printf("text(%d) trancated to %d.\n", len, MAX_TEXT); @@ -448,7 +449,9 @@ crom_add_simple_text(struct crom_src *src, struct crom_chunk *parent, tl->spec_id = 0; tl->spec_type = 0; tl->lang_id = 0; - p = (u_int32_t *) buf; + bzero(&t[0], roundup2(len, sizeof(u_int32_t))); + bcopy(buf, &t[0], len); + p = (u_int32_t *)&t[0]; for (i = 0; i < howmany(len, sizeof(u_int32_t)); i ++) tl->text[i] = ntohl(*p++); return (crom_add_chunk(src, parent, chunk, CROM_TEXTLEAF)); diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 545f1cd18666..29af3b2a57c2 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -39,6 +39,11 @@ #include #include #include +#if __FreeBSD_version < 500000 +#include +#else +#include +#endif #include #include @@ -67,6 +72,7 @@ static d_poll_t fw_poll; static d_read_t fw_read; /* for Isochronous packet */ static d_write_t fw_write; static d_mmap_t fw_mmap; +static d_strategy_t fw_strategy; struct cdevsw firewire_cdevsw = { @@ -78,12 +84,13 @@ struct cdevsw firewire_cdevsw = .d_ioctl = fw_ioctl, .d_poll = fw_poll, .d_mmap = fw_mmap, + .d_strategy = fw_strategy, .d_name = "fw", .d_maj = CDEV_MAJOR, .d_flags = D_MEM #else fw_open, fw_close, fw_read, fw_write, fw_ioctl, - fw_poll, fw_mmap, nostrategy, "fw", CDEV_MAJOR, + fw_poll, fw_mmap, fw_strategy, "fw", CDEV_MAJOR, nodump, nopsize, D_MEM, -1 #endif }; @@ -270,7 +277,7 @@ fw_read (dev_t dev, struct uio *uio, int ioflag) struct fw_pkt *fp; if (DEV_FWMEM(dev)) - return fwmem_read(dev, uio, ioflag); + return physio(dev, uio, ioflag); sc = devclass_get_softc(firewire_devclass, unit); @@ -303,16 +310,19 @@ readloop: err = EIO; return err; } else if(xfer != NULL) { +#if 0 /* XXX broken */ /* per packet mode or FWACT_CH bind?*/ s = splfw(); ir->queued --; STAILQ_REMOVE_HEAD(&ir->q, link); splx(s); - fp = (struct fw_pkt *)xfer->recv.buf; - if(sc->fc->irx_post != NULL) + fp = &xfer->recv.hdr; + if (sc->fc->irx_post != NULL) sc->fc->irx_post(sc->fc, fp->mode.ld); - err = uiomove(xfer->recv.buf, xfer->recv.len, uio); + err = uiomove((void *)fp, 1 /* XXX header size */, uio); + /* XXX copy payload too */ /* XXX we should recycle this xfer */ +#endif fw_xfer_free( xfer); } else if(ir->stproc != NULL) { /* iso bulkxfer */ @@ -354,7 +364,7 @@ fw_write (dev_t dev, struct uio *uio, int ioflag) struct fw_xferq *it; if (DEV_FWMEM(dev)) - return fwmem_write(dev, uio, ioflag); + return physio(dev, uio, ioflag); sc = devclass_get_softc(firewire_devclass, unit); fc = sc->fc; @@ -520,8 +530,11 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) } break; case FW_ASYREQ: + { + struct tcode_info *tinfo; + xfer = fw_xfer_alloc_buf(M_FWXFER, asyreq->req.len, - PAGE_SIZE /* XXX */); + PAGE_SIZE/*XXX*/); if(xfer == NULL){ err = ENOMEM; return err; @@ -529,7 +542,6 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) fp = &asyreq->pkt; switch (asyreq->req.type) { case FWASREQNODE: - xfer->dst = fp->mode.hdr.dst; break; case FWASREQEUI: fwdev = fw_noderesolve_eui64(sc->fc, @@ -540,8 +552,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) err = EINVAL; goto error; } - xfer->dst = FWLOCALBUS | fwdev->dst; - fp->mode.hdr.dst = xfer->dst; + fp->mode.hdr.dst = FWLOCALBUS | fwdev->dst; break; case FWASRESTL: /* XXX what's this? */ @@ -550,26 +561,41 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) /* nothing to do */ break; } - xfer->spd = asyreq->req.sped; - bcopy(fp, xfer->send.buf, xfer->send.len); + xfer->send.spd = asyreq->req.sped; + tinfo = &sc->fc->tcode[fp->mode.hdr.tcode]; + bcopy(fp, (void *)&xfer->send.hdr, tinfo->hdr_len); + if ((tinfo->flag & FWTI_BLOCK_ASY) != 0) + bcopy((char *)fp + tinfo->hdr_len, + (void *)&xfer->send.payload, + asyreq->req.len - tinfo->hdr_len); xfer->act.hand = fw_asy_callback; err = fw_asyreq(sc->fc, -1, xfer); if(err){ - fw_xfer_free( xfer); + fw_xfer_free_buf(xfer); return err; } err = tsleep(xfer, FWPRI, "asyreq", hz); - if(err == 0){ - if(asyreq->req.len >= xfer->recv.len){ - asyreq->req.len = xfer->recv.len; + if (err == 0) { + if (xfer->resp != 0) { + err = EIO; + goto error; + } + tinfo = &sc->fc->tcode[xfer->recv.hdr.mode.hdr.tcode]; + if (asyreq->req.len >= xfer->recv.pay_len + + tinfo->hdr_len) { + asyreq->req.len = xfer->recv.pay_len; }else{ err = EINVAL; } - bcopy(xfer->recv.buf, fp, asyreq->req.len); + bcopy(&xfer->recv.hdr, fp, tinfo->hdr_len); + bcopy(xfer->recv.payload, + (char *)fp + tinfo->hdr_len, + asyreq->req.len - tinfo->hdr_len); } error: - fw_xfer_free( xfer); + fw_xfer_free_buf(xfer); break; + } case FW_IBUSRST: sc->fc->ibr(sc->fc); break; @@ -598,13 +624,14 @@ error: err = ENOMEM; break; } - fwb->start_hi = bindreq->start.hi; - fwb->start_lo = bindreq->start.lo; - fwb->addrlen = bindreq->len; + fwb->start = ((u_int64_t)bindreq->start.hi << 32) | + bindreq->start.lo; + fwb->end = fwb->start + bindreq->len; /* XXX */ fwb->sub = ir->dmach; fwb->act_type = FWACT_CH; + /* XXX alloc buf */ xfer = fw_xfer_alloc(M_FWXFER); if(xfer == NULL){ err = ENOMEM; @@ -736,6 +763,23 @@ fw_mmap (dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) return EINVAL; } +static void +fw_strategy(struct bio *bp) +{ + dev_t dev; + + dev = bp->bio_dev; + if (DEV_FWMEM(dev)) { + fwmem_strategy(bp); + return; + } + + bp->bio_error = EOPNOTSUPP; + bp->bio_flags |= BIO_ERROR; + bp->bio_resid = bp->bio_bcount; + biodone(bp); +} + int fwdev_makedev(struct firewire_softc *sc) { diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index daaf68a34a0d..35915cc8cc8c 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -44,6 +44,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#if __FreeBSD_version < 500000 +#include +#else +#include +#endif #include #include @@ -70,6 +75,8 @@ SYSCTL_INT(_hw_firewire_fwmem, OID_AUTO, speed, CTLFLAG_RW, &fwmem_speed, 0, SYSCTL_INT(_debug, OID_AUTO, fwmem_debug, CTLFLAG_RW, &fwmem_debug, 0, "Fwmem driver debug flag"); +#define MAXLEN (512 << fwmem_speed) + static struct fw_xfer * fwmem_xfer_req( struct fw_device *fwdev, @@ -81,19 +88,21 @@ fwmem_xfer_req( { struct fw_xfer *xfer; - xfer = fw_xfer_alloc_buf(M_FWXFER, slen, rlen); + xfer = fw_xfer_alloc(M_FWXFER); if (xfer == NULL) return NULL; xfer->fc = fwdev->fc; - xfer->dst = FWLOCALBUS | fwdev->dst; + xfer->send.hdr.mode.hdr.dst = FWLOCALBUS | fwdev->dst; if (spd < 0) - xfer->spd = fwdev->speed; + xfer->send.spd = fwdev->speed; else - xfer->spd = min(spd, fwdev->speed); + xfer->send.spd = min(spd, fwdev->speed); xfer->act.hand = hand; xfer->retry_req = fw_asybusy; xfer->sc = sc; + xfer->send.pay_len = slen; + xfer->recv.pay_len = rlen; return xfer; } @@ -105,21 +114,25 @@ fwmem_read_quad( u_int8_t spd, u_int16_t dst_hi, u_int32_t dst_lo, + void *data, void (*hand)(struct fw_xfer *)) { struct fw_xfer *xfer; struct fw_pkt *fp; - xfer = fwmem_xfer_req(fwdev, sc, spd, 12, 16, hand); - if (xfer == NULL) + xfer = fwmem_xfer_req(fwdev, (void *)sc, spd, 0, 4, hand); + if (xfer == NULL) { return NULL; + } - fp = (struct fw_pkt *)xfer->send.buf; + fp = &xfer->send.hdr; fp->mode.rreqq.tcode = FWTCODE_RREQQ; - fp->mode.rreqq.dst = xfer->dst; fp->mode.rreqq.dest_hi = dst_hi; fp->mode.rreqq.dest_lo = dst_lo; + xfer->send.payload = NULL; + xfer->recv.payload = (u_int32_t *)data; + if (fwmem_debug) printf("fwmem_read_quad: %d %04x:%08x\n", fwdev->dst, dst_hi, dst_lo); @@ -138,27 +151,27 @@ fwmem_write_quad( u_int8_t spd, u_int16_t dst_hi, u_int32_t dst_lo, - u_int32_t data, + void *data, void (*hand)(struct fw_xfer *)) { struct fw_xfer *xfer; struct fw_pkt *fp; - xfer = fwmem_xfer_req(fwdev, sc, spd, 16, 12, hand); + xfer = fwmem_xfer_req(fwdev, sc, spd, 0, 0, hand); if (xfer == NULL) return NULL; - fp = (struct fw_pkt *)xfer->send.buf; + fp = &xfer->send.hdr; fp->mode.wreqq.tcode = FWTCODE_WREQQ; - fp->mode.wreqq.dst = xfer->dst; fp->mode.wreqq.dest_hi = dst_hi; fp->mode.wreqq.dest_lo = dst_lo; + fp->mode.wreqq.data = *(u_int32_t *)data; - fp->mode.wreqq.data = data; + xfer->send.payload = xfer->recv.payload = NULL; if (fwmem_debug) printf("fwmem_write_quad: %d %04x:%08x %08x\n", fwdev->dst, - dst_hi, dst_lo, data); + dst_hi, dst_lo, *(u_int32_t *)data); if (fw_asyreq(xfer->fc, -1, xfer) == 0) return xfer; @@ -175,21 +188,25 @@ fwmem_read_block( u_int16_t dst_hi, u_int32_t dst_lo, int len, + void *data, void (*hand)(struct fw_xfer *)) { struct fw_xfer *xfer; struct fw_pkt *fp; - - xfer = fwmem_xfer_req(fwdev, sc, spd, 16, roundup2(16+len,4), hand); + + xfer = fwmem_xfer_req(fwdev, sc, spd, 0, roundup2(len, 4), hand); if (xfer == NULL) return NULL; - fp = (struct fw_pkt *)xfer->send.buf; + fp = &xfer->send.hdr; fp->mode.rreqb.tcode = FWTCODE_RREQB; - fp->mode.rreqb.dst = xfer->dst; fp->mode.rreqb.dest_hi = dst_hi; fp->mode.rreqb.dest_lo = dst_lo; fp->mode.rreqb.len = len; + fp->mode.rreqb.extcode = 0; + + xfer->send.payload = NULL; + xfer->recv.payload = data; if (fwmem_debug) printf("fwmem_read_block: %d %04x:%08x %d\n", fwdev->dst, @@ -209,23 +226,25 @@ fwmem_write_block( u_int16_t dst_hi, u_int32_t dst_lo, int len, - char *data, + void *data, void (*hand)(struct fw_xfer *)) { struct fw_xfer *xfer; struct fw_pkt *fp; - xfer = fwmem_xfer_req(fwdev, sc, spd, roundup(16+len, 4), 12, hand); + xfer = fwmem_xfer_req(fwdev, sc, spd, len, 0, hand); if (xfer == NULL) return NULL; - fp = (struct fw_pkt *)xfer->send.buf; + fp = &xfer->send.hdr; fp->mode.wreqb.tcode = FWTCODE_WREQB; - fp->mode.wreqb.dst = xfer->dst; fp->mode.wreqb.dest_hi = dst_hi; fp->mode.wreqb.dest_lo = dst_lo; fp->mode.wreqb.len = len; - bcopy(data, &fp->mode.wreqb.payload[0], len); + fp->mode.wreqb.extcode = 0; + + xfer->send.payload = data; + xfer->recv.payload = NULL; if (fwmem_debug) printf("fwmem_write_block: %d %04x:%08x %d\n", fwdev->dst, @@ -252,6 +271,7 @@ fwmem_open (dev_t dev, int flags, int fmt, fw_proc *td) return ENOMEM; bcopy(&fwmem_eui64, eui, sizeof(struct fw_eui64)); dev->si_drv1 = (void *)eui; + dev->si_iosize_max = DFLTPHYS; return (0); } @@ -265,145 +285,90 @@ fwmem_close (dev_t dev, int flags, int fmt, fw_proc *td) return (0); } -#define MAXLEN 2048 -#define USE_QUAD 0 -int -fwmem_read (dev_t dev, struct uio *uio, int ioflag) + +static void +fwmem_biodone(struct fw_xfer *xfer) { - struct firewire_softc *sc; - struct fw_device *fwdev; - struct fw_xfer *xfer; - int err = 0; - int unit = DEV2UNIT(dev); - u_int16_t dst_hi; - u_int32_t dst_lo; - off_t offset; - int len, s; + struct bio *bp; - sc = devclass_get_softc(firewire_devclass, unit); - fwdev = fw_noderesolve_eui64(sc->fc, (struct fw_eui64 *)dev->si_drv1); - if (fwdev == NULL) { - if (fwmem_debug) - printf("fwmem: no such device ID:%08x%08x\n", - fwmem_eui64.hi, fwmem_eui64.lo); - return EINVAL; - } + bp = (struct bio *)xfer->sc; + bp->bio_error = xfer->resp; - while(uio->uio_resid > 0 && !err) { - offset = uio->uio_offset; - dst_hi = (offset >> 32) & 0xffff; - dst_lo = offset & 0xffffffff; - len = uio->uio_resid; - if (len == 4 && (dst_lo & 3) == 0) { - s = splfw(); - xfer = fwmem_read_quad(fwdev, NULL, fwmem_speed, - dst_hi, dst_lo, fw_asy_callback); - if (xfer == NULL) { - err = EINVAL; - splx(s); - break; - } - err = tsleep((caddr_t)xfer, FWPRI, "fwmrq", 0); - splx(s); - if (xfer->recv.buf == NULL) - err = EIO; - else if (xfer->resp != 0) - err = xfer->resp; - else if (err == 0) - err = uiomove(xfer->recv.buf + 4*3, 4, uio); - } else { - if (len > MAXLEN) - len = MAXLEN; - s = splfw(); - xfer = fwmem_read_block(fwdev, NULL, fwmem_speed, - dst_hi, dst_lo, len, fw_asy_callback); - if (xfer == NULL) { - err = EINVAL; - splx(s); - break; - } - err = tsleep((caddr_t)xfer, FWPRI, "fwmrb", 0); - splx(s); - if (xfer->recv.buf == NULL) - err = EIO; - else if (xfer->resp != 0) - err = xfer->resp; - else if (err == 0) - err = uiomove(xfer->recv.buf + 4*4, len, uio); - } - fw_xfer_free(xfer); + if (bp->bio_error != 0) { + printf("%s: err=%d\n", __FUNCTION__, bp->bio_error); + bp->bio_flags |= BIO_ERROR; + bp->bio_resid = bp->bio_bcount; } - return err; + + fw_xfer_free(xfer); + biodone(bp); } -int -fwmem_write (dev_t dev, struct uio *uio, int ioflag) + +void +fwmem_strategy(struct bio *bp) { struct firewire_softc *sc; struct fw_device *fwdev; struct fw_xfer *xfer; - int err = 0; - int unit = DEV2UNIT(dev); - u_int16_t dst_hi; - u_int32_t dst_lo, quad; - char *data; - off_t offset; - int len, s; + dev_t dev; + int unit, err=0, s, iolen; + + KASSERT(BUF_REFCNT(bp) > 0, ("fwmem_strategy: bp %p not busy %d", bp, BUF_REFCNT(bp))); + dev = bp->bio_dev; + /* XXX check request length */ + unit = DEV2UNIT(dev); sc = devclass_get_softc(firewire_devclass, unit); + + s = splfw(); fwdev = fw_noderesolve_eui64(sc->fc, (struct fw_eui64 *)dev->si_drv1); if (fwdev == NULL) { if (fwmem_debug) printf("fwmem: no such device ID:%08x%08x\n", fwmem_eui64.hi, fwmem_eui64.lo); - return EINVAL; + err = EINVAL; + goto error; } - data = malloc(MAXLEN, M_FW, M_WAITOK); - if (data == NULL) - return ENOMEM; - - while(uio->uio_resid > 0 && !err) { - offset = uio->uio_offset; - dst_hi = (offset >> 32) & 0xffff; - dst_lo = offset & 0xffffffff; - len = uio->uio_resid; - if (len == 4 && (dst_lo & 3) == 0) { - err = uiomove((char *)&quad, sizeof(quad), uio); - s = splfw(); - xfer = fwmem_write_quad(fwdev, NULL, fwmem_speed, - dst_hi, dst_lo, quad, fw_asy_callback); - if (xfer == NULL) { - err = EINVAL; - splx(s); - break; - } - err = tsleep((caddr_t)xfer, FWPRI, "fwmwq", 0); - splx(s); - if (xfer->resp != 0) - err = xfer->resp; - } else { - if (len > MAXLEN) - len = MAXLEN; - err = uiomove(data, len, uio); - if (err) - break; - s = splfw(); - xfer = fwmem_write_block(fwdev, NULL, fwmem_speed, - dst_hi, dst_lo, len, data, fw_asy_callback); - if (xfer == NULL) { - err = EINVAL; - splx(s); - break; - } - err = tsleep((caddr_t)xfer, FWPRI, "fwmwb", 0); - splx(s); - if (xfer->resp != 0) - err = xfer->resp; - } - fw_xfer_free(xfer); + iolen = MIN(bp->bio_bcount, MAXLEN); + if ((bp->bio_cmd & BIO_READ) == BIO_READ) { + if (iolen == 4 && (bp->bio_offset & 3) == 0) + xfer = fwmem_read_quad(fwdev, + (void *) bp, fwmem_speed, + bp->bio_offset >> 32, bp->bio_offset & 0xffffffff, + bp->bio_data, fwmem_biodone); + else + xfer = fwmem_read_block(fwdev, + (void *) bp, fwmem_speed, + bp->bio_offset >> 32, bp->bio_offset & 0xffffffff, + iolen, bp->bio_data, fwmem_biodone); + } else { + if (iolen == 4 && (bp->bio_offset & 3) == 0) + xfer = fwmem_write_quad(fwdev, + (void *)bp, fwmem_speed, + bp->bio_offset >> 32, bp->bio_offset & 0xffffffff, + bp->bio_data, fwmem_biodone); + else + xfer = fwmem_write_block(fwdev, + (void *)bp, fwmem_speed, + bp->bio_offset >> 32, bp->bio_offset & 0xffffffff, + iolen, bp->bio_data, fwmem_biodone); + } + if (xfer == NULL) { + err = EIO; + goto error; + } + /* XXX */ + bp->bio_resid = bp->bio_bcount - iolen; +error: + splx(s); + if (err != 0) { + printf("%s: err=%d\n", __FUNCTION__, err); + bp->bio_error = err; + bp->bio_flags |= BIO_ERROR; + bp->bio_resid = bp->bio_bcount; + biodone(bp); } - free(data, M_FW); - return err; } int diff --git a/sys/dev/firewire/fwmem.h b/sys/dev/firewire/fwmem.h index 0567f81e9a65..f9442bb9123b 100644 --- a/sys/dev/firewire/fwmem.h +++ b/sys/dev/firewire/fwmem.h @@ -35,13 +35,13 @@ */ struct fw_xfer *fwmem_read_quad(struct fw_device *, caddr_t, u_int8_t, - u_int16_t, u_int32_t, void (*)(struct fw_xfer *)); + u_int16_t, u_int32_t, void *, void (*)(struct fw_xfer *)); struct fw_xfer *fwmem_write_quad(struct fw_device *, caddr_t, u_int8_t, - u_int16_t, u_int32_t, u_int32_t, void (*)(struct fw_xfer *)); + u_int16_t, u_int32_t, void *, void (*)(struct fw_xfer *)); struct fw_xfer *fwmem_read_block(struct fw_device *, caddr_t, u_int8_t, - u_int16_t, u_int32_t, int, void (*)(struct fw_xfer *)); + u_int16_t, u_int32_t, int, void *, void (*)(struct fw_xfer *)); struct fw_xfer *fwmem_write_block(struct fw_device *, caddr_t, u_int8_t, - u_int16_t, u_int32_t, int, char *, void (*)(struct fw_xfer *)); + u_int16_t, u_int32_t, int, void *, void (*)(struct fw_xfer *)); d_open_t fwmem_open; d_close_t fwmem_close; @@ -50,3 +50,4 @@ d_read_t fwmem_read; d_write_t fwmem_write; d_poll_t fwmem_poll; d_mmap_t fwmem_mmap; +d_strategy_t fwmem_strategy; diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 3b71c47c54f6..20d72c9e0464 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -138,7 +138,7 @@ static void fwohci_set_intr __P((struct firewire_comm *, int)); static int fwohci_add_rx_buf __P((struct fwohci_dbch *, struct fwohcidb_tr *, int, struct fwdma_alloc *)); static int fwohci_add_tx_buf __P((struct fwohci_dbch *, struct fwohcidb_tr *, int)); static void dump_db __P((struct fwohci_softc *, u_int32_t)); -static void print_db __P((struct fwohcidb_tr *, volatile struct fwohcidb *, u_int32_t , u_int32_t)); +static void print_db __P((struct fwohcidb_tr *, struct fwohcidb *, u_int32_t , u_int32_t)); static void dump_dma __P((struct fwohci_softc *, u_int32_t)); static u_int32_t fwohci_cyctimer __P((struct firewire_comm *)); static void fwohci_rbuf_update __P((struct fwohci_softc *, int)); @@ -799,7 +799,7 @@ static void fwohci_execute_db(void *arg, bus_dma_segment_t *segs, int nseg, int error) { struct fwohcidb_tr *db_tr; - volatile struct fwohcidb *db; + struct fwohcidb *db; bus_dma_segment_t *s; int i; @@ -831,15 +831,15 @@ static void fwohci_start(struct fwohci_softc *sc, struct fwohci_dbch *dbch) { int i, s; - int tcode, hdr_len, pl_off, pl_len; + int tcode, hdr_len, pl_off; int fsegment = -1; u_int32_t off; struct fw_xfer *xfer; struct fw_pkt *fp; - volatile struct fwohci_txpkthdr *ohcifp; + struct fwohci_txpkthdr *ohcifp; struct fwohcidb_tr *db_tr; - volatile struct fwohcidb *db; - volatile u_int32_t *ld; + struct fwohcidb *db; + u_int32_t *ld; struct tcode_info *info; static int maxdesc=0; @@ -868,10 +868,10 @@ txloop: db_tr->xfer = xfer; xfer->state = FWXF_START; - fp = (struct fw_pkt *)xfer->send.buf; + fp = &xfer->send.hdr; tcode = fp->mode.common.tcode; - ohcifp = (volatile struct fwohci_txpkthdr *) db_tr->db[1].db.immed; + ohcifp = (struct fwohci_txpkthdr *) db_tr->db[1].db.immed; info = &tinfo[tcode]; hdr_len = pl_off = info->hdr_len; @@ -880,7 +880,7 @@ txloop: for( i = 0 ; i < pl_off ; i+= 4) ld[i/4] = fp->mode.ld[i/4]; - ohcifp->mode.common.spd = xfer->spd & 0x7; + ohcifp->mode.common.spd = xfer->send.spd & 0x7; if (tcode == FWTCODE_STREAM ){ hdr_len = 8; ohcifp->mode.stream.len = fp->mode.stream.len; @@ -915,16 +915,12 @@ txloop: again: db_tr->dbcnt = 2; db = &db_tr->db[db_tr->dbcnt]; - pl_len = xfer->send.len - pl_off; - if (pl_len > 0) { + if (xfer->send.pay_len > 0) { int err; /* handle payload */ if (xfer->mbuf == NULL) { - caddr_t pl_addr; - - pl_addr = xfer->send.buf + pl_off; err = bus_dmamap_load(dbch->dmat, db_tr->dma_map, - pl_addr, pl_len, + &xfer->send.payload[0], xfer->send.pay_len, fwohci_execute_db, db_tr, /*flags*/0); } else { @@ -1030,7 +1026,7 @@ fwohci_txd(struct fwohci_softc *sc, struct fwohci_dbch *dbch) { int s, ch, err = 0; struct fwohcidb_tr *tr; - volatile struct fwohcidb *db; + struct fwohcidb *db; struct fw_xfer *xfer; u_int32_t off; u_int stat, status; @@ -1123,14 +1119,14 @@ fwohci_txd(struct fwohci_softc *sc, struct fwohci_dbch *dbch) if (xfer->retry_req != NULL) xfer->retry_req(xfer); else { - xfer->recv.len = 0; + xfer->recv.pay_len = 0; fw_xfer_done(xfer); } } else if (stat != FWOHCIEV_ACKPEND) { if (stat != FWOHCIEV_ACKCOMPL) xfer->state = FWXF_SENTERR; xfer->resp = err; - xfer->recv.len = 0; + xfer->recv.pay_len = 0; fw_xfer_done(xfer); } } @@ -1319,7 +1315,7 @@ fwohci_tx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch) int idb, z, i, dmach = 0, ldesc; u_int32_t off = NULL; struct fwohcidb_tr *db_tr; - volatile struct fwohcidb *db; + struct fwohcidb *db; if(!(dbch->xferq.flag & FWXFERQ_EXTBUF)){ err = EINVAL; @@ -1378,7 +1374,7 @@ fwohci_rx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch) int idb, z, i, dmach = 0, ldesc; u_int32_t off = NULL; struct fwohcidb_tr *db_tr; - volatile struct fwohcidb *db; + struct fwohcidb *db; z = dbch->ndesc; if(&sc->arrq == dbch){ @@ -1509,7 +1505,7 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach) s = splfw(); prev = STAILQ_LAST(&it->stdma, fw_bulkxfer, link); while ((chunk = STAILQ_FIRST(&it->stvalid)) != NULL) { - volatile struct fwohcidb *db; + struct fwohcidb *db; fwdma_sync_multiseg(it->buf, chunk->poffset, it->bnpacket, BUS_DMASYNC_PREWRITE); @@ -1636,7 +1632,7 @@ fwohci_irx_enable(struct firewire_comm *fc, int dmach) s = splfw(); prev = STAILQ_LAST(&ir->stdma, fw_bulkxfer, link); while ((chunk = STAILQ_FIRST(&ir->stfree)) != NULL) { - volatile struct fwohcidb *db; + struct fwohcidb *db; #if 1 /* XXX for if_fwe */ if (chunk->mbuf != NULL) { @@ -2104,7 +2100,7 @@ static void fwohci_tbuf_update(struct fwohci_softc *sc, int dmach) { struct firewire_comm *fc = &sc->fc; - volatile struct fwohcidb *db; + struct fwohcidb *db; struct fw_bulkxfer *chunk; struct fw_xferq *it; u_int32_t stat, count; @@ -2150,7 +2146,7 @@ static void fwohci_rbuf_update(struct fwohci_softc *sc, int dmach) { struct firewire_comm *fc = &sc->fc; - volatile struct fwohcidb_tr *db_tr; + struct fwohcidb_tr *db_tr; struct fw_bulkxfer *chunk; struct fw_xferq *ir; u_int32_t stat; @@ -2255,7 +2251,7 @@ dump_db(struct fwohci_softc *sc, u_int32_t ch) { struct fwohci_dbch *dbch; struct fwohcidb_tr *cp = NULL, *pp, *np = NULL; - volatile struct fwohcidb *curr = NULL, *prev, *next = NULL; + struct fwohcidb *curr = NULL, *prev, *next = NULL; int idb, jdb; u_int32_t cmd, off; if(ch == 0){ @@ -2329,7 +2325,7 @@ outdb: } void -print_db(struct fwohcidb_tr *db_tr, volatile struct fwohcidb *db, +print_db(struct fwohcidb_tr *db_tr, struct fwohcidb *db, u_int32_t ch, u_int32_t max) { fwohcireg_t stat; @@ -2446,9 +2442,9 @@ fwohci_txbufdb(struct fwohci_softc *sc, int dmach, struct fw_bulkxfer *bulkxfer) { struct fwohcidb_tr *db_tr, *fdb_tr; struct fwohci_dbch *dbch; - volatile struct fwohcidb *db; + struct fwohcidb *db; struct fw_pkt *fp; - volatile struct fwohci_txpkthdr *ohcifp; + struct fwohci_txpkthdr *ohcifp; unsigned short chtag; int idb; @@ -2463,7 +2459,7 @@ device_printf(sc->fc.dev, "DB %08x %08x %08x\n", bulkxfer, db_tr->bus_addr, fdb_ for (idb = 0; idb < dbch->xferq.bnpacket; idb ++) { db = db_tr->db; fp = (struct fw_pkt *)db_tr->buf; - ohcifp = (volatile struct fwohci_txpkthdr *) db[1].db.immed; + ohcifp = (struct fwohci_txpkthdr *) db[1].db.immed; ohcifp->mode.ld[0] = fp->mode.ld[0]; ohcifp->mode.common.spd = 0 & 0x7; ohcifp->mode.stream.len = fp->mode.stream.len; @@ -2511,7 +2507,7 @@ static int fwohci_add_tx_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr, int poffset) { - volatile struct fwohcidb *db = db_tr->db; + struct fwohcidb *db = db_tr->db; struct fw_xferq *it; int err = 0; @@ -2526,8 +2522,7 @@ fwohci_add_tx_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr, FWOHCI_DMA_WRITE(db[0].db.desc.cmd, OHCI_OUTPUT_MORE | OHCI_KEY_ST2 | 8); FWOHCI_DMA_WRITE(db[0].db.desc.addr, 0); - bzero((void *)(uintptr_t)(volatile void *) - &db[1].db.immed[0], sizeof(db[1].db.immed)); + bzero((void *)&db[1].db.immed[0], sizeof(db[1].db.immed)); FWOHCI_DMA_WRITE(db[2].db.desc.addr, fwdma_bus_addr(it->buf, poffset) + sizeof(u_int32_t)); @@ -2544,7 +2539,7 @@ int fwohci_add_rx_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr, int poffset, struct fwdma_alloc *dummy_dma) { - volatile struct fwohcidb *db = db_tr->db; + struct fwohcidb *db = db_tr->db; struct fw_xferq *ir; int i, ldesc; bus_addr_t dbuf[2]; @@ -2595,7 +2590,7 @@ fwohci_arcv_swap(struct fw_pkt *fp, int len) { struct fw_pkt *fp0; u_int32_t ld0; - int slen; + int slen, hlen; #if BYTE_ORDER == BIG_ENDIAN int i; #endif @@ -2605,6 +2600,7 @@ fwohci_arcv_swap(struct fw_pkt *fp, int len) printf("ld0: x%08x\n", ld0); #endif fp0 = (struct fw_pkt *)&ld0; + /* determine length to swap */ switch (fp0->mode.common.tcode) { case FWTCODE_RREQQ: case FWTCODE_WRES: @@ -2624,75 +2620,47 @@ fwohci_arcv_swap(struct fw_pkt *fp, int len) printf("Unknown tcode %d\n", fp0->mode.common.tcode); return(0); } - if (slen > len) { + hlen = tinfo[fp0->mode.common.tcode].hdr_len; + if (hlen > len) { if (firewire_debug) printf("splitted header\n"); - return(-slen); + return(-hlen); } #if BYTE_ORDER == BIG_ENDIAN for(i = 0; i < slen/4; i ++) fp->mode.ld[i] = FWOHCI_DMA_READ(fp->mode.ld[i]); #endif - return(slen); + return(hlen); } -#define PLEN(x) roundup2(x, sizeof(u_int32_t)) static int fwohci_get_plen(struct fwohci_softc *sc, struct fwohci_dbch *dbch, struct fw_pkt *fp) { + struct tcode_info *info; int r; - switch(fp->mode.common.tcode){ - case FWTCODE_RREQQ: - r = sizeof(fp->mode.rreqq) + sizeof(u_int32_t); - break; - case FWTCODE_WRES: - r = sizeof(fp->mode.wres) + sizeof(u_int32_t); - break; - case FWTCODE_WREQQ: - r = sizeof(fp->mode.wreqq) + sizeof(u_int32_t); - break; - case FWTCODE_RREQB: - r = sizeof(fp->mode.rreqb) + sizeof(u_int32_t); - break; - case FWTCODE_RRESQ: - r = sizeof(fp->mode.rresq) + sizeof(u_int32_t); - break; - case FWTCODE_WREQB: - r = sizeof(struct fw_asyhdr) + PLEN(fp->mode.wreqb.len) - + sizeof(u_int32_t); - break; - case FWTCODE_LREQ: - r = sizeof(struct fw_asyhdr) + PLEN(fp->mode.lreq.len) - + sizeof(u_int32_t); - break; - case FWTCODE_RRESB: - r = sizeof(struct fw_asyhdr) + PLEN(fp->mode.rresb.len) - + sizeof(u_int32_t); - break; - case FWTCODE_LRES: - r = sizeof(struct fw_asyhdr) + PLEN(fp->mode.lres.len) - + sizeof(u_int32_t); - break; - case FWOHCITCODE_PHY: - r = 16; - break; - default: + info = &tinfo[fp->mode.common.tcode]; + r = info->hdr_len + sizeof(u_int32_t); + if ((info->flag & FWTI_BLOCK_ASY) != 0) + r += roundup2(fp->mode.wreqb.len, sizeof(u_int32_t)); + + if (r == sizeof(u_int32_t)) + /* XXX */ device_printf(sc->fc.dev, "Unknown tcode %d\n", fp->mode.common.tcode); - r = 0; - } + if (r > dbch->xferq.psize) { device_printf(sc->fc.dev, "Invalid packet length %d\n", r); /* panic ? */ } + return r; } static void fwohci_arcv_free_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr) { - volatile struct fwohcidb *db = &db_tr->db[0]; + struct fwohcidb *db = &db_tr->db[0]; FWOHCI_DMA_CLEAR(db->db.desc.depend, 0xf); FWOHCI_DMA_WRITE(db->db.desc.res, dbch->xferq.psize); @@ -2812,7 +2780,8 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) if (plen < 0) { /* minimum header size + trailer = sizeof(fw_pkt) so this shouldn't happens */ - printf("plen is negative! offset=%d\n", offset); + printf("plen(%d) is negative! offset=%d\n", + plen, offset); goto out; } if (plen > 0) { @@ -2842,7 +2811,8 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) stat = ((struct fwohci_trailer *)(ld - sizeof(struct fwohci_trailer)))->stat; #endif #if 0 - printf("plen: %d, stat %x\n", plen ,stat); + printf("plen: %d, stat %x\n", + plen ,stat); #endif spd = (stat >> 5) & 0x3; stat &= 0x1f; @@ -2853,11 +2823,19 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) #endif /* fall through */ case FWOHCIEV_ACKCOMPL: + { + struct fw_rcv_buf rb; + if ((vec[nvec-1].iov_len -= sizeof(struct fwohci_trailer)) == 0) nvec--; - fw_rcv(&sc->fc, vec, nvec, 0, spd); - break; + rb.fc = &sc->fc; + rb.vec = vec; + rb.nvec = nvec; + rb.spd = spd; + fw_rcv(&rb); + break; + } case FWOHCIEV_BUSRST: if (sc->fc.status != FWBUSRESET) printf("got BUSRST packet!?\n"); diff --git a/sys/dev/firewire/fwohcireg.h b/sys/dev/firewire/fwohcireg.h index 9b1e703e1717..5295cd53fed0 100644 --- a/sys/dev/firewire/fwohcireg.h +++ b/sys/dev/firewire/fwohcireg.h @@ -76,7 +76,7 @@ #define OHCI_MAX_DMA_CH (0x4 + OHCI_DMA_ITCH + OHCI_DMA_IRCH) -typedef volatile u_int32_t fwohcireg_t; +typedef u_int32_t fwohcireg_t; /* for PCI */ #if BYTE_ORDER == BIG_ENDIAN @@ -94,12 +94,12 @@ typedef volatile u_int32_t fwohcireg_t; struct fwohcidb { union { struct { - volatile u_int32_t cmd; - volatile u_int32_t addr; - volatile u_int32_t depend; - volatile u_int32_t res; + u_int32_t cmd; + u_int32_t addr; + u_int32_t depend; + u_int32_t res; } desc; - volatile u_int32_t immed[4]; + u_int32_t immed[4]; } db; #define OHCI_STATUS_SHIFT 16 #define OHCI_COUNT_MASK 0xffff @@ -317,7 +317,7 @@ struct ohci_registers { struct fwohcidb_tr{ STAILQ_ENTRY(fwohcidb_tr) link; struct fw_xfer *xfer; - volatile struct fwohcidb *db; + struct fwohcidb *db; bus_dmamap_t dma_map; caddr_t buf; bus_addr_t bus_addr; diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c index 3eddef71ac4a..b076497098e8 100644 --- a/sys/dev/firewire/if_fwe.c +++ b/sys/dev/firewire/if_fwe.c @@ -350,7 +350,7 @@ found: xfer = fw_xfer_alloc(M_FWE); if (xfer == NULL) break; - xfer->spd = tx_speed; + xfer->send.spd = tx_speed; xfer->fc = fwe->fd.fc; xfer->retry_req = fw_asybusy; xfer->sc = (caddr_t)fwe; @@ -447,7 +447,6 @@ fwe_output_callback(struct fw_xfer *xfer) ifp->if_oerrors ++; m_freem(xfer->mbuf); - xfer->send.buf = NULL; fw_xfer_unload(xfer); s = splimp(); @@ -529,12 +528,11 @@ fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp) /* keep ip packet alignment for alpha */ M_PREPEND(m, ETHER_ALIGN, M_DONTWAIT); - fp = (struct fw_pkt *)&xfer->dst; /* XXX */ - xfer->dst = *((int32_t *)&fwe->pkt_hdr); + fp = &xfer->send.hdr; + *(u_int32_t *)&xfer->send.hdr = *(int32_t *)&fwe->pkt_hdr; fp->mode.stream.len = m->m_pkthdr.len; - xfer->send.buf = (caddr_t) fp; xfer->mbuf = m; - xfer->send.len = m->m_pkthdr.len + HDR_LEN; + xfer->send.pay_len = m->m_pkthdr.len; if (fw_asyreq(fwe->fd.fc, -1, xfer) != 0) { /* error */ diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index 1c8b377f0f82..53c0241844cc 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -66,6 +66,7 @@ #include #include #include +#include #define ccb_sdev_ptr spriv_ptr0 #define ccb_sbp_ptr spriv_ptr1 @@ -77,10 +78,6 @@ #define SBP_QUEUE_LEN ((SBP_DMA_SIZE - SBP_LOGIN_SIZE) / sizeof(struct sbp_ocb)) #define SBP_NUM_OCB (SBP_QUEUE_LEN * SBP_NUM_TARGETS) -#define SBP_INITIATOR 7 - -#define LOGIN_DELAY 2 - /* * STATUS FIFO addressing * bit @@ -88,67 +85,25 @@ * 0- 1( 2): 0 (alingment) * 2- 7( 6): target * 8-15( 8): lun - * 16-23( 8): unit - * 24-31( 8): reserved + * 16-31( 8): reserved * 32-47(16): SBP_BIND_HI * 48-64(16): bus_id, node_id */ #define SBP_BIND_HI 0x1 -#define SBP_DEV2ADDR(u, t, l) \ - ((((u) & 0xff) << 16) | (((l) & 0xff) << 8) | (((t) & 0x3f) << 2)) +#define SBP_DEV2ADDR(t, l) \ + (((u_int64_t)SBP_BIND_HI << 32) \ + | (((l) & 0xff) << 8) \ + | (((t) & 0x3f) << 2)) #define SBP_ADDR2TRG(a) (((a) >> 2) & 0x3f) #define SBP_ADDR2LUN(a) (((a) >> 8) & 0xff) +#define SBP_INITIATOR 7 -#define ORB_NOTIFY (1 << 31) -#define ORB_FMT_STD (0 << 29) -#define ORB_FMT_VED (2 << 29) -#define ORB_FMT_NOP (3 << 29) -#define ORB_FMT_MSK (3 << 29) -#define ORB_EXV (1 << 28) -/* */ -#define ORB_CMD_IN (1 << 27) -/* */ -#define ORB_CMD_SPD(x) ((x) << 24) -#define ORB_CMD_MAXP(x) ((x) << 20) -#define ORB_RCN_TMO(x) ((x) << 20) -#define ORB_CMD_PTBL (1 << 19) -#define ORB_CMD_PSZ(x) ((x) << 16) - -#define ORB_FUN_LGI (0 << 16) -#define ORB_FUN_QLG (1 << 16) -#define ORB_FUN_RCN (3 << 16) -#define ORB_FUN_LGO (7 << 16) -#define ORB_FUN_ATA (0xb << 16) -#define ORB_FUN_ATS (0xc << 16) -#define ORB_FUN_LUR (0xe << 16) -#define ORB_FUN_RST (0xf << 16) -#define ORB_FUN_MSK (0xf << 16) -#define ORB_FUN_RUNQUEUE 0xffff +#define LOGIN_DELAY 1 static char *orb_fun_name[] = { - /* 0 */ "LOGIN", - /* 1 */ "QUERY LOGINS", - /* 2 */ "Reserved", - /* 3 */ "RECONNECT", - /* 4 */ "SET PASSWORD", - /* 5 */ "Reserved", - /* 6 */ "Reserved", - /* 7 */ "LOGOUT", - /* 8 */ "Reserved", - /* 9 */ "Reserved", - /* A */ "Reserved", - /* B */ "ABORT TASK", - /* C */ "ABORT TASK SET", - /* D */ "Reserved", - /* E */ "LOGICAL UNIT RESET", - /* F */ "TARGET RESET" + ORB_FUN_NAMES }; -#define ORB_RES_CMPL 0 -#define ORB_RES_FAIL 1 -#define ORB_RES_ILLE 2 -#define ORB_RES_VEND 3 - static int debug = 0; static int auto_login = 1; static int max_speed = 2; @@ -163,14 +118,8 @@ SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, auto_login, CTLFLAG_RW, &auto_login, 0, SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, max_speed, CTLFLAG_RW, &max_speed, 0, "SBP transfer max speed"); -#define SBP_DEBUG(x) if (debug > x) { -#define END_DEBUG } - #define NEED_RESPONSE 0 -struct ind_ptr { - u_int32_t hi,lo; -}; #define SBP_SEG_MAX rounddown(0xffff, PAGE_SIZE) #ifdef __sparc64__ /* iommu */ #define SBP_IND_MAX howmany(MAXPHYS, SBP_SEG_MAX) @@ -181,9 +130,9 @@ struct sbp_ocb { STAILQ_ENTRY(sbp_ocb) ocb; union ccb *ccb; bus_addr_t bus_addr; - volatile u_int32_t orb[8]; + u_int32_t orb[8]; #define IND_PTR_OFFSET (8*sizeof(u_int32_t)) - volatile struct ind_ptr ind_ptr[SBP_IND_MAX]; + struct ind_ptr ind_ptr[SBP_IND_MAX]; struct sbp_dev *sdev; int flags; /* XXX should be removed */ bus_dmamap_t dmamap; @@ -193,63 +142,6 @@ struct sbp_ocb { #define OCB_ACT_CMD 1 #define OCB_MATCH(o,s) ((o)->bus_addr == ntohl((s)->orb_lo)) -#define SBP_RECV_LEN (16 + 32) /* header + payload */ - -struct sbp_login_res{ - u_int16_t len; - u_int16_t id; - u_int16_t res0; - u_int16_t cmd_hi; - u_int32_t cmd_lo; - u_int16_t res1; - u_int16_t recon_hold; -}; -struct sbp_status{ -#if BYTE_ORDER == BIG_ENDIAN - u_int8_t src:2, - resp:2, - dead:1, - len:3; -#else - u_int8_t len:3, - dead:1, - resp:2, - src:2; -#endif - u_int8_t status; - u_int16_t orb_hi; - u_int32_t orb_lo; - u_int32_t data[6]; -}; -struct sbp_cmd_status{ -#define SBP_SFMT_CURR 0 -#define SBP_SFMT_DEFER 1 -#if BYTE_ORDER == BIG_ENDIAN - u_int8_t sfmt:2, - status:6; - u_int8_t valid:1, - mark:1, - eom:1, - ill_len:1, - s_key:4; -#else - u_int8_t status:6, - sfmt:2; - u_int8_t s_key:4, - ill_len:1, - eom:1, - mark:1, - valid:1; -#endif - u_int8_t s_code; - u_int8_t s_qlfr; - u_int32_t info; - u_int32_t cdb; - u_int8_t fru; - u_int8_t s_keydep[3]; - u_int32_t vend[2]; -}; - struct sbp_dev{ #define SBP_DEV_RESET 0 /* accept login */ #define SBP_DEV_LOGIN 1 /* to login */ @@ -289,7 +181,7 @@ struct sbp_target { struct sbp_ocb *mgm_ocb_cur; STAILQ_HEAD(, sbp_ocb) mgm_ocb_queue; struct callout mgm_ocb_timeout; -#define SCAN_DELAY 2 +#define SCAN_DELAY 1 struct callout scan_callout; STAILQ_HEAD(, fw_xfer) xferlist; int n_xfer; @@ -406,7 +298,7 @@ END_DEBUG return(ENXIO); } - device_set_desc(dev, "SBP2/SCSI over firewire"); + device_set_desc(dev, "SBP-2/SCSI over FireWire"); if (bootverbose) debug = bootverbose; @@ -879,7 +771,7 @@ END_DEBUG xfer = sbp_write_cmd(sdev, FWTCODE_WREQQ, 0); xfer->act.hand = sbp_reset_start_callback; - fp = (struct fw_pkt *)xfer->send.buf; + fp = &xfer->send.hdr; fp->mode.wreqq.dest_hi = 0xffff; fp->mode.wreqq.dest_lo = 0xf0000000 | RESET_START; fp->mode.wreqq.data = htonl(0xf); @@ -1057,7 +949,7 @@ sbp_agent_reset_callback(struct fw_xfer *xfer) sdev = (struct sbp_dev *)xfer->sc; SBP_DEBUG(1) sbp_show_sdev_info(sdev, 2); - printf("sbp_cmd_callback\n"); + printf("%s\n", __FUNCTION__); END_DEBUG if (xfer->resp != 0) { sbp_show_sdev_info(sdev, 2); @@ -1088,7 +980,7 @@ END_DEBUG xfer->act.hand = sbp_agent_reset_callback; else xfer->act.hand = sbp_do_attach; - fp = (struct fw_pkt *)xfer->send.buf; + fp = &xfer->send.hdr; fp->mode.wreqq.data = htonl(0xf); fw_asyreq(xfer->fc, -1, xfer); sbp_abort_all_ocbs(sdev, CAM_BDR_SENT); @@ -1120,7 +1012,7 @@ END_DEBUG xfer = sbp_write_cmd(sdev, FWTCODE_WREQQ, 0); xfer->act.hand = sbp_busy_timeout_callback; - fp = (struct fw_pkt *)xfer->send.buf; + fp = &xfer->send.hdr; fp->mode.wreqq.dest_hi = 0xffff; fp->mode.wreqq.dest_lo = 0xf0000000 | BUSY_TIMEOUT; fp->mode.wreqq.data = htonl((1 << (13+12)) | 0xf); @@ -1142,12 +1034,12 @@ END_DEBUG return; xfer->act.hand = sbp_cmd_callback; - fp = (struct fw_pkt *)xfer->send.buf; + fp = &xfer->send.hdr; fp->mode.wreqb.len = 8; fp->mode.wreqb.extcode = 0; - fp->mode.wreqb.payload[0] = + xfer->send.payload[0] = htonl(((sdev->target->sbp->fd.fc->nodeid | FWLOCALBUS )<< 16)); - fp->mode.wreqb.payload[1] = htonl(ocb->bus_addr); + xfer->send.payload[1] = htonl(ocb->bus_addr); if(fw_asyreq(xfer->fc, -1, xfer) != 0){ sbp_xfer_free(xfer); @@ -1194,7 +1086,7 @@ sbp_write_cmd(struct sbp_dev *sdev, int tcode, int offset) splx(s); return(NULL); } - xfer = fw_xfer_alloc_buf(M_SBP, 24, 12); + xfer = fw_xfer_alloc_buf(M_SBP, 8, 0); if(xfer == NULL){ printf("sbp: fw_xfer_alloc_buf failed\n"); splx(s); @@ -1211,26 +1103,26 @@ sbp_write_cmd(struct sbp_dev *sdev, int tcode, int offset) microtime(&xfer->tv); - if (tcode == FWTCODE_WREQQ) - xfer->send.len = 16; - else - xfer->send.len = 24; - xfer->recv.len = 12; - if (new) { - xfer->spd = min(sdev->target->fwdev->speed, max_speed); + xfer->recv.pay_len = 0; + xfer->send.spd = min(sdev->target->fwdev->speed, max_speed); xfer->fc = sdev->target->sbp->fd.fc; xfer->retry_req = fw_asybusy; } + + if (tcode == FWTCODE_WREQB) + xfer->send.pay_len = 8; + else + xfer->send.pay_len = 0; + xfer->sc = (caddr_t)sdev; - fp = (struct fw_pkt *)xfer->send.buf; + fp = &xfer->send.hdr; fp->mode.wreqq.dest_hi = sdev->login->cmd_hi; fp->mode.wreqq.dest_lo = sdev->login->cmd_lo + offset; fp->mode.wreqq.tlrt = 0; fp->mode.wreqq.tcode = tcode; fp->mode.wreqq.pri = 0; - xfer->dst = FWLOCALBUS | sdev->target->fwdev->dst; - fp->mode.wreqq.dst = xfer->dst; + fp->mode.wreqq.dst = FWLOCALBUS | sdev->target->fwdev->dst; return xfer; @@ -1265,12 +1157,9 @@ sbp_mgm_orb(struct sbp_dev *sdev, int func, struct sbp_ocb *aocb) ocb->flags = OCB_ACT_MGM; ocb->sdev = sdev; - bzero((void *)(uintptr_t)(volatile void *)ocb->orb, sizeof(ocb->orb)); + bzero((void *)ocb->orb, sizeof(ocb->orb)); ocb->orb[6] = htonl((nid << 16) | SBP_BIND_HI); - ocb->orb[7] = htonl(SBP_DEV2ADDR( - device_get_unit(target->sbp->fd.dev), - target->target_id, - sdev->lun_id)); + ocb->orb[7] = htonl(SBP_DEV2ADDR(target->target_id, sdev->lun_id)); SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); @@ -1278,6 +1167,7 @@ SBP_DEBUG(0) END_DEBUG switch (func) { case ORB_FUN_LGI: + ocb->orb[0] = ocb->orb[1] = 0; /* password */ ocb->orb[2] = htonl(nid << 16); ocb->orb[3] = htonl(sdev->dma.bus_addr); ocb->orb[4] = htonl(ORB_NOTIFY | ORB_EXV | sdev->lun_id); @@ -1315,13 +1205,17 @@ start: } xfer->act.hand = sbp_mgm_callback; - fp = (struct fw_pkt *)xfer->send.buf; + fp = &xfer->send.hdr; fp->mode.wreqb.dest_hi = sdev->target->mgm_hi; fp->mode.wreqb.dest_lo = sdev->target->mgm_lo; fp->mode.wreqb.len = 8; fp->mode.wreqb.extcode = 0; - fp->mode.wreqb.payload[0] = htonl(nid << 16); - fp->mode.wreqb.payload[1] = htonl(ocb->bus_addr); + xfer->send.payload[0] = htonl(nid << 16); + xfer->send.payload[1] = htonl(ocb->bus_addr & 0xffffffff); +SBP_DEBUG(0) + sbp_show_sdev_info(sdev, 2); + printf("mgm orb: %08x\n", (u_int32_t)ocb->bus_addr); +END_DEBUG fw_asyreq(xfer->fc, -1, xfer); } @@ -1509,23 +1403,21 @@ printf("sbp %x %d %d %08x %08x %08x %08x\n", printf("sbp %08x %08x %08x %08x\n", ntohl(ld[4]), ntohl(ld[5]), ntohl(ld[6]), ntohl(ld[7])); printf("sbp %08x %08x %08x %08x\n", ntohl(ld[8]), ntohl(ld[9]), ntohl(ld[10]), ntohl(ld[11])); */ - sbp = (struct sbp_softc *)xfer->sc; - if(xfer->resp != 0){ + if (xfer->resp != 0){ printf("sbp_recv: xfer->resp != 0\n"); goto done0; } - if(xfer->recv.buf == NULL){ - printf("sbp_recv: xfer->recv.buf == NULL\n"); + if (xfer->recv.payload == NULL){ + printf("sbp_recv: xfer->recv.payload == NULL\n"); goto done0; } - sbp = (struct sbp_softc *)xfer->sc; - rfp = (struct fw_pkt *)xfer->recv.buf; + rfp = &xfer->recv.hdr; if(rfp->mode.wreqb.tcode != FWTCODE_WREQB){ printf("sbp_recv: tcode = %d\n", rfp->mode.wreqb.tcode); goto done0; } - sbp_status = (struct sbp_status *)rfp->mode.wreqb.payload; + sbp_status = (struct sbp_status *)xfer->recv.payload; addr = rfp->mode.wreqb.dest_lo; SBP_DEBUG(2) printf("received address 0x%x\n", addr); @@ -1748,6 +1640,7 @@ done: sbp_agent_reset(sdev); done0: + xfer->recv.pay_len = SBP_RECV_LEN; /* The received packet is usually small enough to be stored within * the buffer. In that case, the controller return ack_complete and * no respose is necessary. @@ -1772,7 +1665,6 @@ done0: fw_asyreq(xfer->fc, -1, xfer); #else /* recycle */ - xfer->recv.len = SBP_RECV_LEN; STAILQ_INSERT_TAIL(&sbp->fwb.xferlist, xfer, link); #endif @@ -1856,23 +1748,20 @@ END_DEBUG goto fail; if (xpt_create_path(&sbp->path, xpt_periph, cam_sim_path(sbp->sim), - CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { + xpt_bus_deregister(cam_sim_path(sbp->sim)); goto fail; + } - sbp->fwb.start_hi = SBP_BIND_HI; - sbp->fwb.start_lo = SBP_DEV2ADDR(device_get_unit(sbp->fd.dev), 0, 0); /* We reserve 16 bit space (4 bytes X 64 targets X 256 luns) */ - sbp->fwb.addrlen = 0xffff; + sbp->fwb.start = ((u_int64_t)SBP_BIND_HI << 32) | SBP_DEV2ADDR(0, 0); + sbp->fwb.end = sbp->fwb.start + 0xffff; sbp->fwb.act_type = FWACT_XFER; /* pre-allocate xfer */ STAILQ_INIT(&sbp->fwb.xferlist); for (i = 0; i < SBP_NUM_OCB/2; i ++) { xfer = fw_xfer_alloc_buf(M_SBP, -#if NEED_RESPONSE - /* send */12, -#else /* send */0, -#endif /* recv */SBP_RECV_LEN); xfer->act.hand = sbp_recv; #if NEED_RESPONSE @@ -1949,8 +1838,10 @@ END_DEBUG for (i = 0; i < SBP_NUM_TARGETS; i ++) sbp_cam_detach_target(&sbp->targets[i]); + xpt_async(AC_LOST_DEVICE, sbp->path, NULL); xpt_free_path(sbp->path); xpt_bus_deregister(cam_sim_path(sbp->sim)); + cam_sim_free(sbp->sim, /*free_devq*/ TRUE), sbp_logout_all(sbp); @@ -1974,7 +1865,7 @@ END_DEBUG for (xfer = STAILQ_FIRST(&target->xferlist); xfer != NULL; xfer = next) { next = STAILQ_NEXT(xfer, link); - fw_xfer_free(xfer); + fw_xfer_free_buf(xfer); } free(target->luns, M_SBP); } @@ -1982,7 +1873,7 @@ END_DEBUG for (xfer = STAILQ_FIRST(&sbp->fwb.xferlist); xfer != NULL; xfer = next) { next = STAILQ_NEXT(xfer, link); - fw_xfer_free(xfer); + fw_xfer_free_buf(xfer); } STAILQ_INIT(&sbp->fwb.xferlist); fw_bindremove(fc, &sbp->fwb); @@ -2259,9 +2150,7 @@ END_DEBUG cdb = (void *)csio->cdb_io.cdb_ptr; else cdb = (void *)&csio->cdb_io.cdb_bytes; - bcopy(cdb, - (void *)(uintptr_t)(volatile void *)&ocb->orb[5], - csio->cdb_len); + bcopy(cdb, (void *)&ocb->orb[5], csio->cdb_len); /* printf("ORB %08x %08x %08x %08x\n", ntohl(ocb->orb[0]), ntohl(ocb->orb[1]), ntohl(ocb->orb[2]), ntohl(ocb->orb[3])); printf("ORB %08x %08x %08x %08x\n", ntohl(ocb->orb[4]), ntohl(ocb->orb[5]), ntohl(ocb->orb[6]), ntohl(ocb->orb[7])); diff --git a/sys/dev/firewire/sbp.h b/sys/dev/firewire/sbp.h new file mode 100644 index 000000000000..0949049cfac3 --- /dev/null +++ b/sys/dev/firewire/sbp.h @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2003 Hidetosh Shimokawa + * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetosh Shimokawa + * 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 acknowledgement as bellow: + * + * This product includes software developed by K. Kobayashi and H. Shimokawa + * + * 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. + * + * $FreeBSD$ + * + */ + +#define ORB_NOTIFY (1 << 31) +#define ORB_FMT_STD (0 << 29) +#define ORB_FMT_VED (2 << 29) +#define ORB_FMT_NOP (3 << 29) +#define ORB_FMT_MSK (3 << 29) +#define ORB_EXV (1 << 28) +/* */ +#define ORB_CMD_IN (1 << 27) +/* */ +#define ORB_CMD_SPD(x) ((x) << 24) +#define ORB_CMD_MAXP(x) ((x) << 20) +#define ORB_RCN_TMO(x) ((x) << 20) +#define ORB_CMD_PTBL (1 << 19) +#define ORB_CMD_PSZ(x) ((x) << 16) + +#define ORB_FUN_LGI (0 << 16) +#define ORB_FUN_QLG (1 << 16) +#define ORB_FUN_RCN (3 << 16) +#define ORB_FUN_LGO (7 << 16) +#define ORB_FUN_ATA (0xb << 16) +#define ORB_FUN_ATS (0xc << 16) +#define ORB_FUN_LUR (0xe << 16) +#define ORB_FUN_RST (0xf << 16) +#define ORB_FUN_MSK (0xf << 16) +#define ORB_FUN_RUNQUEUE 0xffff + +#define ORB_RES_CMPL 0 +#define ORB_RES_FAIL 1 +#define ORB_RES_ILLE 2 +#define ORB_RES_VEND 3 + +#define SBP_DEBUG(x) if (debug > x) { +#define END_DEBUG } + +struct ind_ptr { + u_int32_t hi,lo; +}; + + +#define SBP_RECV_LEN 32 + +struct sbp_login_res{ + u_int16_t len; + u_int16_t id; + u_int16_t res0; + u_int16_t cmd_hi; + u_int32_t cmd_lo; + u_int16_t res1; + u_int16_t recon_hold; +}; + +struct sbp_status{ +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t src:2, + resp:2, + dead:1, + len:3; +#else + u_int8_t len:3, + dead:1, + resp:2, + src:2; +#endif + u_int8_t status; + u_int16_t orb_hi; + u_int32_t orb_lo; + u_int32_t data[6]; +}; +/* src */ +#define SRC_NEXT_EXISTS 0 +#define SRC_NO_NEXT 1 +#define SRC_UNSOL 2 + +/* resp */ +#define SBP_REQ_CMP 0 /* request complete */ +#define SBP_TRANS_FAIL 1 /* transport failure */ +#define SBP_ILLE_REQ 2 /* illegal request */ +#define SBP_VEND_DEP 3 /* vendor dependent */ + +/* status (resp == 0) */ +/* 0: No additional Information to report */ +/* 1: Request Type not supported */ +/* 2: Speed not supported */ +/* 3: Page size not supported */ +/* 4: Access denied */ +#define STATUS_ACCESS_DENY 4 +/* 5: Logical unit not supported */ +/* 6: Maximum payload too small */ +/* 7: Reserved for future standardization */ +/* 8: Resource unavailabe */ +/* 9: Function Rejected */ +/* 10: Login ID not recognized */ +/* 11: Dummy ORB completed */ +/* 12: Request aborted */ +/* 255: Unspecified error */ + +/* status (resp == 1) */ +/* Referenced object */ +#define OBJ_ORB (0 << 6) /* 0: ORB */ +#define OBJ_DATA (1 << 6) /* 1: Data buffer */ +#define OBJ_PT (2 << 6) /* 2: Page table */ +#define OBJ_UNSPEC (3 << 6) /* 3: Unable to specify */ +/* Serial bus error */ +/* 0: Missing acknowledge */ +/* 1: Reserved; not to be used */ +/* 2: Time-out error */ +#define SBE_TIMEOUT 2 +/* 3: Reserved; not to be used */ +/* 4: Busy retry limit exceeded: ack_busy_X */ +/* 5: Busy retry limit exceeded: ack_busy_A */ +/* 6: Busy retry limit exceeded: ack_busy_B */ +/* 7-A: Reserved for future standardization */ +/* B: Tardy retry limit exceeded */ +/* C: Confilict error */ +/* D: Data error */ +/* E: Type error */ +/* F: Address error */ + + +struct sbp_cmd_status{ +#define SBP_SFMT_CURR 0 +#define SBP_SFMT_DEFER 1 +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t sfmt:2, + status:6; + u_int8_t valid:1, + mark:1, + eom:1, + ill_len:1, + s_key:4; +#else + u_int8_t status:6, + sfmt:2; + u_int8_t s_key:4, + ill_len:1, + eom:1, + mark:1, + valid:1; +#endif + u_int8_t s_code; + u_int8_t s_qlfr; + u_int32_t info; + u_int32_t cdb; + u_int8_t fru; + u_int8_t s_keydep[3]; + u_int32_t vend[2]; +}; + +#define ORB_FUN_NAMES \ + /* 0 */ "LOGIN", \ + /* 1 */ "QUERY LOGINS", \ + /* 2 */ "Reserved", \ + /* 3 */ "RECONNECT", \ + /* 4 */ "SET PASSWORD", \ + /* 5 */ "Reserved", \ + /* 6 */ "Reserved", \ + /* 7 */ "LOGOUT", \ + /* 8 */ "Reserved", \ + /* 9 */ "Reserved", \ + /* A */ "Reserved", \ + /* B */ "ABORT TASK", \ + /* C */ "ABORT TASK SET", \ + /* D */ "Reserved", \ + /* E */ "LOGICAL UNIT RESET", \ + /* F */ "TARGET RESET" diff --git a/sys/modules/firewire/sbp/Makefile b/sys/modules/firewire/sbp/Makefile index e114dbb4dbac..7acf1a39fb32 100644 --- a/sys/modules/firewire/sbp/Makefile +++ b/sys/modules/firewire/sbp/Makefile @@ -7,7 +7,7 @@ KMOD = sbp SRCS = bus_if.h device_if.h \ opt_cam.h opt_scsi.h \ - sbp.c \ + sbp.c sbp.h \ firewire.h firewirereg.h \ iec13213.h -- cgit v1.3 From 102ebc1f95d8cfea17dea62b9ea10119c661b41e Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Fri, 24 Oct 2003 13:55:51 +0000 Subject: Fix for FW_ASYREQ. - set send.pay_len correctly. - copy response only if needed. - remove unnecessary 'err = 0'. --- sys/dev/firewire/fwdev.c | 75 +++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 39 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 29af3b2a57c2..56ff4c5fa955 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -471,13 +471,11 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) it->flag |= (0x3f & ichreq->ch); it->flag |= ((0x3 & ichreq->tag) << 6); d->it = it; - err = 0; break; case FW_GTSTREAM: if (it != NULL) { ichreq->ch = it->flag & 0x3f; ichreq->tag = it->flag >> 2 & 0x3; - err = 0; } else err = EINVAL; break; @@ -507,13 +505,11 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) if (d->ir != NULL) { ichreq->ch = ir->flag & 0x3f; ichreq->tag = ir->flag >> 2 & 0x3; - err = 0; } else err = EINVAL; break; case FW_SSTBUF: bcopy(ibufreq, &d->bufreq, sizeof(d->bufreq)); - err = 0; break; case FW_GSTBUF: bzero(&ibufreq->rx, sizeof(ibufreq->rx)); @@ -532,14 +528,18 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) case FW_ASYREQ: { struct tcode_info *tinfo; + int pay_len = 0; - xfer = fw_xfer_alloc_buf(M_FWXFER, asyreq->req.len, - PAGE_SIZE/*XXX*/); - if(xfer == NULL){ - err = ENOMEM; - return err; - } fp = &asyreq->pkt; + tinfo = &sc->fc->tcode[fp->mode.hdr.tcode]; + + if ((tinfo->flag & FWTI_BLOCK_ASY) != 0) + pay_len = MAX(0, asyreq->req.len - tinfo->hdr_len); + + xfer = fw_xfer_alloc_buf(M_FWXFER, pay_len, PAGE_SIZE/*XXX*/); + if (xfer == NULL) + return (ENOMEM); + switch (asyreq->req.type) { case FWASREQNODE: break; @@ -550,7 +550,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) device_printf(sc->fc->bdev, "cannot find node\n"); err = EINVAL; - goto error; + goto out; } fp->mode.hdr.dst = FWLOCALBUS | fwdev->dst; break; @@ -561,38 +561,35 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) /* nothing to do */ break; } - xfer->send.spd = asyreq->req.sped; - tinfo = &sc->fc->tcode[fp->mode.hdr.tcode]; + bcopy(fp, (void *)&xfer->send.hdr, tinfo->hdr_len); - if ((tinfo->flag & FWTI_BLOCK_ASY) != 0) + if (pay_len > 0) bcopy((char *)fp + tinfo->hdr_len, - (void *)&xfer->send.payload, - asyreq->req.len - tinfo->hdr_len); + (void *)&xfer->send.payload, pay_len); + xfer->send.spd = asyreq->req.sped; xfer->act.hand = fw_asy_callback; - err = fw_asyreq(sc->fc, -1, xfer); - if(err){ - fw_xfer_free_buf(xfer); - return err; - } - err = tsleep(xfer, FWPRI, "asyreq", hz); - if (err == 0) { - if (xfer->resp != 0) { - err = EIO; - goto error; - } - tinfo = &sc->fc->tcode[xfer->recv.hdr.mode.hdr.tcode]; - if (asyreq->req.len >= xfer->recv.pay_len + - tinfo->hdr_len) { - asyreq->req.len = xfer->recv.pay_len; - }else{ - err = EINVAL; - } - bcopy(&xfer->recv.hdr, fp, tinfo->hdr_len); - bcopy(xfer->recv.payload, - (char *)fp + tinfo->hdr_len, - asyreq->req.len - tinfo->hdr_len); + + if ((err = fw_asyreq(sc->fc, -1, xfer)) != 0) + goto out; + if ((err = tsleep(xfer, FWPRI, "asyreq", hz)) != 0) + goto out; + if (xfer->resp != 0) { + err = EIO; + goto out; } -error: + if ((tinfo->flag & FWTI_TLABEL) == 0) + goto out; + + /* copy response */ + tinfo = &sc->fc->tcode[xfer->recv.hdr.mode.hdr.tcode]; + if (asyreq->req.len >= xfer->recv.pay_len + tinfo->hdr_len) + asyreq->req.len = xfer->recv.pay_len; + else + err = EINVAL; + bcopy(&xfer->recv.hdr, fp, tinfo->hdr_len); + bcopy(xfer->recv.payload, (char *)fp + tinfo->hdr_len, + MAX(0, asyreq->req.len - tinfo->hdr_len)); +out: fw_xfer_free_buf(xfer); break; } -- cgit v1.3 From 3a927c871a81f2dff58f52d96feefb7239ac76c3 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Fri, 7 Nov 2003 12:30:57 +0000 Subject: Respect a return code of fwmem_open(). --- sys/dev/firewire/fwdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 56ff4c5fa955..3337080bb1c1 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -170,12 +170,12 @@ fw_open (dev_t dev, int flags, int fmt, fw_proc *td) { int err = 0; - if (dev->si_drv1 != NULL) - return (EBUSY); - if (DEV_FWMEM(dev)) return fwmem_open(dev, flags, fmt, td); + if (dev->si_drv1 != NULL) + return (EBUSY); + #if __FreeBSD_version >= 500000 if ((dev->si_flags & SI_NAMED) == 0) { int unit = DEV2UNIT(dev); -- cgit v1.3 From 4c790222f6af8f9fa2768f50e2321ae51751dda1 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Thu, 22 Jan 2004 14:41:17 +0000 Subject: Add missing free() in exception handlers. Reported by: Stanford Metacompilation research group --- sys/dev/firewire/fwdev.c | 4 ++-- sys/dev/firewire/fwohci.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 3337080bb1c1..b3ecc8acccd5 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -631,8 +631,8 @@ out: /* XXX alloc buf */ xfer = fw_xfer_alloc(M_FWXFER); if(xfer == NULL){ - err = ENOMEM; - return err; + free(fwb, M_FW); + return (ENOMEM); } xfer->fc = sc->fc; diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 7f6b3bfdaa87..8cf9cf8d3b81 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -1230,6 +1230,7 @@ fwohci_db_init(struct fwohci_softc *sc, struct fwohci_dbch *dbch) DB_SIZE(dbch), dbch->ndb, BUS_DMA_WAITOK); if (dbch->am == NULL) { printf("fwohci_db_init: fwdma_malloc_multiseg failed\n"); + free(db_tr, M_FW); return; } /* Attach DB to DMA ch. */ -- cgit v1.3 From c9c7976f7ffdd0ed81e12d8930651a9a858defa1 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sat, 21 Feb 2004 19:42:58 +0000 Subject: Device megapatch 1/6: Free approx 86 major numbers with a mostly automatically generated patch. A number of strategic drivers have been left behind by caution, and a few because they still (ab)use their major number. --- sys/alpha/alpha/promcons.c | 2 - sys/alpha/tlsb/zs_tlsb.c | 2 - sys/cam/cam_xpt.c | 2 - sys/cam/scsi/scsi_ch.c | 2 - sys/cam/scsi/scsi_pass.c | 2 - sys/cam/scsi/scsi_pt.c | 2 - sys/cam/scsi/scsi_sa.c | 2 - sys/cam/scsi/scsi_ses.c | 5 +- sys/cam/scsi/scsi_target.c | 2 - sys/conf/majors | 73 ---------------------- sys/dev/acpica/acpi.c | 2 - sys/dev/agp/agp.c | 2 - sys/dev/atkbdc/psm.c | 2 - sys/dev/bktr/bktr_os.c | 2 - sys/dev/ciss/ciss.c | 2 - sys/dev/cy/cy.c | 2 - sys/dev/cy/cy_isa.c | 2 - sys/dev/dcons/dcons.c | 2 - sys/dev/digi/digi.c | 2 - sys/dev/dpt/dpt.h | 1 - sys/dev/drm/drm_drv.h | 1 - sys/dev/drm/drm_os_freebsd.h | 1 - sys/dev/fb/fb.c | 2 - sys/dev/fdc/fdc.c | 2 - sys/dev/firewire/fwdev.c | 2 - sys/dev/iicbus/iic.c | 2 - sys/dev/isp/isp_freebsd.c | 2 - sys/dev/joy/joy.c | 2 - sys/dev/kbd/kbd.c | 2 - sys/dev/mcd/mcd.c | 2 - sys/dev/mlx/mlx.c | 2 - sys/dev/mly/mly.c | 2 - sys/dev/mse/mse.c | 2 - sys/dev/ofw/ofw_console.c | 4 +- sys/dev/ppbus/lpt.c | 2 - sys/dev/ppbus/pcfclock.c | 2 - sys/dev/ppbus/ppi.c | 2 - sys/dev/ppbus/pps.c | 2 - sys/dev/rc/rc.c | 2 - sys/dev/rp/rp.c | 2 - sys/dev/scd/scd.c | 2 - sys/dev/si/si.c | 2 - sys/dev/sio/sio.c | 2 - sys/dev/smbus/smb.c | 2 - sys/dev/speaker/spkr.c | 2 - sys/dev/streams/streams.c | 2 - sys/dev/syscons/sysmouse.c | 5 +- sys/dev/tdfx/tdfx_pci.c | 1 - sys/dev/tdfx/tdfx_vars.h | 1 - sys/dev/ti/if_ti.c | 2 - sys/dev/twe/twe_freebsd.c | 1 - sys/dev/twe/twevar.h | 2 - sys/dev/usb/ucom.c | 2 - sys/dev/usb/ufm.c | 7 --- sys/dev/usb/ugen.c | 2 - sys/dev/usb/uhid.c | 2 - sys/dev/usb/ulpt.c | 2 - sys/dev/usb/ums.c | 2 - sys/dev/usb/urio.c | 2 - sys/dev/usb/usb.c | 1 - sys/dev/usb/usbdi.h | 1 - sys/dev/usb/uscanner.c | 2 - sys/i386/acpica/acpi_machdep.c | 2 - sys/i386/bios/apm.c | 2 - sys/i386/bios/smapi.c | 1 - sys/i386/i386/perfmon.c | 2 - sys/i386/isa/asc.c | 2 - sys/i386/isa/ctx.c | 2 - sys/i386/isa/cy.c | 2 - sys/i386/isa/gpib.c | 2 - sys/i386/isa/gsc.c | 2 - sys/i386/isa/istallion.c | 2 - sys/i386/isa/mse.c | 2 - sys/i386/isa/pcvt/pcvt_drv.c | 2 - sys/i386/isa/spic.c | 1 - sys/i386/isa/spicreg.h | 1 - sys/i386/isa/spigot.c | 2 - sys/i386/isa/spkr.c | 2 - sys/i386/isa/stallion.c | 2 - sys/i386/isa/wt.c | 2 - sys/i4b/driver/i4b_ctl.c | 2 - sys/i4b/driver/i4b_rbch.c | 2 - sys/i4b/driver/i4b_tel.c | 2 - sys/i4b/driver/i4b_trace.c | 2 - sys/i4b/layer4/i4b_i4bdrv.c | 2 - sys/ia64/ia64/ssc.c | 2 - sys/isa/fd.c | 2 - sys/isa/psm.c | 2 - sys/net/bpf.c | 4 +- sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c | 7 --- sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c | 7 --- sys/netgraph/ng_device.c | 2 - sys/pc98/cbus/fdc.c | 2 - sys/pc98/cbus/olpt.c | 2 - sys/pc98/cbus/sio.c | 2 - sys/pc98/pc98/fd.c | 2 - sys/pc98/pc98/mse.c | 2 - sys/pc98/pc98/olpt.c | 2 - sys/pc98/pc98/sio.c | 2 - sys/pc98/pc98/wd_cd.c | 2 - sys/pccard/pccard.c | 6 -- sys/pci/agp.c | 2 - sys/pci/if_ti.c | 2 - 103 files changed, 4 insertions(+), 291 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/alpha/alpha/promcons.c b/sys/alpha/alpha/promcons.c index 68bf6bfc252c..1800de6e624c 100644 --- a/sys/alpha/alpha/promcons.c +++ b/sys/alpha/alpha/promcons.c @@ -63,7 +63,6 @@ static d_open_t promopen; static d_close_t promclose; static d_ioctl_t promioctl; -#define CDEV_MAJOR 97 static struct cdevsw prom_cdevsw = { .d_open = promopen, .d_close = promclose, @@ -72,7 +71,6 @@ static struct cdevsw prom_cdevsw = { .d_ioctl = promioctl, .d_poll = ttypoll, .d_name = "prom", - .d_maj = CDEV_MAJOR, }; diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c index 0852724f0d3e..55065e1f786f 100644 --- a/sys/alpha/tlsb/zs_tlsb.c +++ b/sys/alpha/tlsb/zs_tlsb.c @@ -70,7 +70,6 @@ static d_open_t zsopen; static d_close_t zsclose; static d_ioctl_t zsioctl; -#define CDEV_MAJOR 135 static struct cdevsw zs_cdevsw = { .d_open = zsopen, .d_close = zsclose, @@ -79,7 +78,6 @@ static struct cdevsw zs_cdevsw = { .d_ioctl = zsioctl, .d_poll = ttypoll, .d_name = "zs", - .d_maj = CDEV_MAJOR, }; static void zsstart(struct tty *); diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 3b9961368d63..03eaf544439e 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -630,7 +630,6 @@ static struct periph_driver probe_driver = PERIPHDRIVER_DECLARE(xpt, xpt_driver); PERIPHDRIVER_DECLARE(probe, probe_driver); -#define XPT_CDEV_MAJOR 104 static d_open_t xptopen; static d_close_t xptclose; @@ -641,7 +640,6 @@ static struct cdevsw xpt_cdevsw = { .d_close = xptclose, .d_ioctl = xptioctl, .d_name = "xpt", - .d_maj = XPT_CDEV_MAJOR, }; static struct intr_config_hook *xpt_config_hook; diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c index 1ece680c54eb..a9ed37376c23 100644 --- a/sys/cam/scsi/scsi_ch.c +++ b/sys/cam/scsi/scsi_ch.c @@ -174,7 +174,6 @@ struct ch_softc { }; #define CHUNIT(x) (minor((x))) -#define CH_CDEV_MAJOR 17 static d_open_t chopen; static d_close_t chclose; @@ -217,7 +216,6 @@ static struct cdevsw ch_cdevsw = { .d_close = chclose, .d_ioctl = chioctl, .d_name = "ch", - .d_maj = CH_CDEV_MAJOR, }; static void diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c index 6aa75684393c..13c1017e5ca1 100644 --- a/sys/cam/scsi/scsi_pass.c +++ b/sys/cam/scsi/scsi_pass.c @@ -77,7 +77,6 @@ struct pass_softc { dev_t dev; }; -#define PASS_CDEV_MAJOR 31 static d_open_t passopen; static d_close_t passclose; @@ -110,7 +109,6 @@ static struct cdevsw pass_cdevsw = { .d_close = passclose, .d_ioctl = passioctl, .d_name = "pass", - .d_maj = PASS_CDEV_MAJOR, }; static void diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c index 72e529013c2e..cc3afa6ce58c 100644 --- a/sys/cam/scsi/scsi_pt.c +++ b/sys/cam/scsi/scsi_pt.c @@ -116,7 +116,6 @@ static struct periph_driver ptdriver = PERIPHDRIVER_DECLARE(pt, ptdriver); -#define PT_CDEV_MAJOR 61 static struct cdevsw pt_cdevsw = { .d_open = ptopen, @@ -126,7 +125,6 @@ static struct cdevsw pt_cdevsw = { .d_ioctl = ptioctl, .d_strategy = ptstrategy, .d_name = "pt", - .d_maj = PT_CDEV_MAJOR, }; #ifndef SCSI_PT_DEFAULT_TIMEOUT diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index adb22f846ccf..c41e4166ef91 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -423,7 +423,6 @@ PERIPHDRIVER_DECLARE(sa, sadriver); #define D_TAPE 0 #endif -#define SA_CDEV_MAJOR 14 static struct cdevsw sa_cdevsw = { .d_open = saopen, @@ -433,7 +432,6 @@ static struct cdevsw sa_cdevsw = { .d_ioctl = saioctl, .d_strategy = sastrategy, .d_name = "sa", - .d_maj = SA_CDEV_MAJOR, .d_flags = D_TAPE, }; diff --git a/sys/cam/scsi/scsi_ses.c b/sys/cam/scsi/scsi_ses.c index 738178714f35..8f594ae2bcd5 100644 --- a/sys/cam/scsi/scsi_ses.c +++ b/sys/cam/scsi/scsi_ses.c @@ -153,7 +153,6 @@ struct ses_softc { #define SES_FLAG_INITIALIZED 0x04 #define SESUNIT(x) (minor((x))) -#define SES_CDEV_MAJOR 110 static d_open_t sesopen; static d_close_t sesclose; @@ -175,13 +174,11 @@ static struct periph_driver sesdriver = { PERIPHDRIVER_DECLARE(ses, sesdriver); -static struct cdevsw ses_cdevsw = -{ +static struct cdevsw ses_cdevsw = { .d_open = sesopen, .d_close = sesclose, .d_ioctl = sesioctl, .d_name = "ses", - .d_maj = SES_CDEV_MAJOR, }; static void diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c index 749447fb9fd0..7e0d28fbd83b 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -104,7 +104,6 @@ static int targreadfilt(struct knote *kn, long hint); static struct filterops targread_filtops = { 1, NULL, targreadfiltdetach, targreadfilt }; -#define TARG_CDEV_MAJOR 65 static struct cdevsw targ_cdevsw = { .d_open = targopen, .d_close = targclose, @@ -113,7 +112,6 @@ static struct cdevsw targ_cdevsw = { .d_ioctl = targioctl, .d_poll = targpoll, .d_name = "targ", - .d_maj = TARG_CDEV_MAJOR, .d_kqfilter = targkqfilter }; diff --git a/sys/conf/majors b/sys/conf/majors index 60c0727a4379..62f5264e8a36 100644 --- a/sys/conf/majors +++ b/sys/conf/majors @@ -23,25 +23,10 @@ 5 *pts pseudo tty "tty" half 6 *ptc pseudo tty "master" half 7 *log system log -9 *fd floppy disk -10 *wt i386/isa/wt.c -11 *spigot Video capture? -12 *sc syscons/pcvt virtual consoles -14 *sa SCSI "sequential access devices" -16 *lpt PC parallel printer port -17 *ch SCSI changer 18 *nmdm nullmodem back-to-back tty ports 19 *tw X-10 power interface -20 *ng_device Netgraph -21 *psm PS/2 Mouse 22 *fd (/dev/stdin etc) -23 *bpf Berkeley Packet Filter -26 *spkr PC speaker (/dev/spkr) -27 *mse Microsoft bus-mouse -28 *sio 16450/16550 serial -29 *mcd Mitsumi CDROM interface 30 *snd sound driver system -31 *pass SCSI "Application Pass-Thru" 32 lkmc Loadable Kernel Module Controller 33 lkm assigned to Loadable Kernel Modules 34 lkm assigned to Loadable Kernel Modules @@ -49,110 +34,55 @@ 36 lkm assigned to Loadable Kernel Modules 37 lkm assigned to Loadable Kernel Modules 38 lkm assigned to Loadable Kernel Modules -39 *apm Advanced Power Management also ACPI -40 *ctx Cortex 42 *cx Cronyx/Sigma serial adapter 43 vn vnode "disk" device (retired) -44 *gp GPIB -45 *scd Sony CDROM interface 46 - - -47 *gsc Genius Scanner -48 *cy Cyclades -51 *joy joystick 52 *tun IP tunnel device -53 *snp tty snoop 54 OLDnic ISDN system -55 *i4b_ctl ISDN4BSD -56 *i4b_tel ISDN4BSD -57 *i4b_rbch ISDN4BSD 58 - Was dgb: Digiboard PC/Xe -59 *i4b_trace ISDN4BSD -60 *i4b_i4bdrv ISDN4BSD -61 *pt SCSI "processor target" 62 worm SCSI "worm type" -63 *rc Riscom/8 driver 64 ?? Talisman -65 *targ SCSI target sample driver 66 labpc National Instruments LabPC 67 - was meteor Matrox Meteor video capture -68 *si Specialix SI/XIO (peter@freebsd.org) -69 *wcd ATAPI CDROM client of "wd" 70 crypto Device-independent crypto interface (from openbsd) -71 *asc AmiScan driver -72 *stl Stallion (cd1400 based) (gerg@stallion.oz.au) 74 *ccd concatenated disk -75 *stli Stallion (intelligent cdk based) (gerg@stallion.oz.au) 76 scc IBM Smart Capture Card (ohashi@mickey.ai.kyutech.ac.jp) 77 cyy Cyclades Ye/PCI serial card 78 pci PCI bus 79 *ipl IP Filter 80 xdcp Assigned to Chris Ficklin -81 *rp RocketPort/Steve Gericke -82 *ppi Generic Parallel I/O 83 can CAN16-2 CAN-PC Interface 84 dtfp Datum Time and Frequency processor (louie@UU.NET) 85 vesa VESA support device (j_mini@efn.org) 86 alog Industrial Computer Source AIO8-P driver (deprecated) 87 wfd ATAPI floppy client of "wd" -88 *dpt DPT RAID Controller -89 *pps Pulse-Per-Second timing interface 90 wst ATAPI tape client of "wd" 91 *vinum Volume manager 92 *bktr Bt848 video capture driver (hasty@star-gate.com) 93 *coda CODA filesystem. 96 altq alternate queueing (including cbq, red, wfq) -97 *prom Alpha PROM console 98 loe Loopback pseudo-ethernet (sbabkin@dcn.att.com) 99 ct Cronyx/Tau serial adaptor -103 *streams SVR4 Streams emulation -104 *xpt CAM Transport Layer Services -105 *iic I2C bus generic i/o -106 *smb System Management Bus generic i/o -107 *3dfx 3Dfx driver -108 *usb Universal Serial Bus -110 *ses SCSI Environmental Services driver (mjacob@feral.com) -111 *ums USB Mouse -112 *kbd keyboard -113 *ulpt USB Printer -114 *ugen USB Generic device 115 dag University of Waikato DAG network capture boards 117 *acd ATAPI CDROM 119 *ast ATAPI tape 121 onew Dallas Semiconductor One-Wire bus -122 *uhid USB HID devices -123 *fb frame buffer 124 ucdc USB Communication Class Driver 125 digio Advantech PCI-1750 IO card jen@vulture.dmem.strath.ac.uk 126 sync Generic sync port support , -127 *fire Firewire driver 128 arla Arla (AFS-clone) driver -130 *mlx Mylex DAC960 RAID (control device) 134 taupci Cronyx Tau-PCI card -135 *zsc TurboLaser console uart 136 ipr Iprobe on-chip perf. counters (gallatin@freebsd.org) 137 nfp nFast PCI crypto accelerator (support@ncipher.com) -138 *ucom USB Serial support 139 wanrouter Sangoma Technologies Inc. (al.feldman@sangoma.com) -140 *pcfclock PCFCLOCK 141 pcdmx PCDMX theatre lighting controller 142 skip SKIP port (security/skip) control device -143 *urio USB Rio 500 -145 *dri DRI Graphics for OpenGL -146 *twe 3ware Escalade ATA RAID (controller) -148 *agp AGP 149 *tap Ethernet tunneling device -152 *acpi ACPI bios support (Takanori Watanabe takawata@shidahara1.planet.sci.kobe-u.ac.jp) -153 *ti Tigon Gigabit Ethernet driver (ken@FreeBSD.ORG) 154 *asr Adaptec SCSI RAID 155 phone Quicknet PhoneJACK and LineJACK cards for VoIP -156 *uscanner USB Scanners -158 *mly Mylex RAID control device 159 *ata ATA control device -160 *spic Sony Programmable I/O Controller (jogdial) 161 swdoc Sitara networks watchdog device -162 *digi Digiboard 163 - - -166 *ciss Compaq SmartArray 5* adapter 168 XXX used by pst in RELENG_4 170 pst Promise SuperTrak (uses 168 in RELENG_4) 171 mide LSI MegaRAID IDE (control device) @@ -162,12 +92,9 @@ 180 nvidia NVIDIA (nvidiaN/nvidiactl) 181 casm HP/Compaq ProLiant Advanced Server Management 183 *smapi SMAPI BIOS interface -184 dcons Dumb console driver 185 ce Cronyx Tau-32 E1 adapter 186 sx Specialix I/O8+ driver 187 twa 3ware Apache ATA RAID (controller) -200 ?? entries from 200-252 are reserved for local use -248 *isp dev/isp/isp_freebsd.c 252 ?? entries from 200-252 are reserved for local use 254 internal Used internally by the kernel 255 bad_choice -1 is 255 which has magic meanings internally diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index a92659a34674..3c7b038e9a85 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -66,13 +66,11 @@ static d_open_t acpiopen; static d_close_t acpiclose; static d_ioctl_t acpiioctl; -#define CDEV_MAJOR 152 static struct cdevsw acpi_cdevsw = { .d_open = acpiopen, .d_close = acpiclose, .d_ioctl = acpiioctl, .d_name = "acpi", - .d_maj = CDEV_MAJOR, }; static const char* sleep_state_names[] = { diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index 2ae2b72e20ad..6f09660fad6a 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -63,7 +63,6 @@ MODULE_VERSION(agp, 1); MALLOC_DEFINE(M_AGP, "agp", "AGP data structures"); -#define CDEV_MAJOR 148 /* agp_drv.c */ static d_open_t agp_open; static d_close_t agp_close; @@ -76,7 +75,6 @@ static struct cdevsw agp_cdevsw = { .d_ioctl = agp_ioctl, .d_mmap = agp_mmap, .d_name = "agp", - .d_maj = CDEV_MAJOR, }; static devclass_t agp_devclass; diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index 4b1277632024..e886e8cc9e4b 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -346,7 +346,6 @@ static driver_t psm_driver = { sizeof(struct psm_softc), }; -#define CDEV_MAJOR 21 static struct cdevsw psm_cdevsw = { .d_open = psmopen, @@ -355,7 +354,6 @@ static struct cdevsw psm_cdevsw = { .d_ioctl = psmioctl, .d_poll = psmpoll, .d_name = PSM_DRIVER_NAME, - .d_maj = CDEV_MAJOR, }; /* debug message level */ diff --git a/sys/dev/bktr/bktr_os.c b/sys/dev/bktr/bktr_os.c index b074962f472d..92c7fbea8d74 100644 --- a/sys/dev/bktr/bktr_os.c +++ b/sys/dev/bktr/bktr_os.c @@ -257,7 +257,6 @@ static d_ioctl_t bktr_ioctl; static d_mmap_t bktr_mmap; static d_poll_t bktr_poll; -#define CDEV_MAJOR 92 static struct cdevsw bktr_cdevsw = { .d_open = bktr_open, .d_close = bktr_close, @@ -267,7 +266,6 @@ static struct cdevsw bktr_cdevsw = { .d_poll = bktr_poll, .d_mmap = bktr_mmap, .d_name = "bktr", - .d_maj = CDEV_MAJOR, }; DRIVER_MODULE(bktr, pci, bktr_driver, bktr_devclass, 0, 0); diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c index e3deb352b487..843577de431d 100644 --- a/sys/dev/ciss/ciss.c +++ b/sys/dev/ciss/ciss.c @@ -212,14 +212,12 @@ static d_open_t ciss_open; static d_close_t ciss_close; static d_ioctl_t ciss_ioctl; -#define CISS_CDEV_MAJOR 166 static struct cdevsw ciss_cdevsw = { .d_open = ciss_open, .d_close = ciss_close, .d_ioctl = ciss_ioctl, .d_name = "ciss", - .d_maj = CISS_CDEV_MAJOR, }; /************************************************************************ diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index 203ed94c60e5..4351a3051de8 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -385,7 +385,6 @@ static d_close_t sioclose; static d_write_t siowrite; static d_ioctl_t sioioctl; -#define CDEV_MAJOR 48 static struct cdevsw sio_cdevsw = { .d_open = sioopen, .d_close = sioclose, @@ -394,7 +393,6 @@ static struct cdevsw sio_cdevsw = { .d_ioctl = sioioctl, .d_poll = ttypoll, .d_name = driver_name, - .d_maj = CDEV_MAJOR, .d_flags = D_TTY, .d_kqfilter = ttykqfilter, }; diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index 203ed94c60e5..4351a3051de8 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -385,7 +385,6 @@ static d_close_t sioclose; static d_write_t siowrite; static d_ioctl_t sioioctl; -#define CDEV_MAJOR 48 static struct cdevsw sio_cdevsw = { .d_open = sioopen, .d_close = sioclose, @@ -394,7 +393,6 @@ static struct cdevsw sio_cdevsw = { .d_ioctl = sioioctl, .d_poll = ttypoll, .d_name = driver_name, - .d_maj = CDEV_MAJOR, .d_flags = D_TTY, .d_kqfilter = ttykqfilter, }; diff --git a/sys/dev/dcons/dcons.c b/sys/dev/dcons/dcons.c index 6fd284486e37..04d75494f1c6 100644 --- a/sys/dev/dcons/dcons.c +++ b/sys/dev/dcons/dcons.c @@ -81,7 +81,6 @@ static struct consdev gdbconsdev; #endif -#define CDEV_MAJOR 184 static d_open_t dcons_open; static d_close_t dcons_close; @@ -96,7 +95,6 @@ static struct cdevsw dcons_cdevsw = { .d_ioctl = dcons_ioctl, .d_poll = ttypoll, .d_name = "dcons", - .d_maj = CDEV_MAJOR, #else /* open */ dcons_open, /* close */ dcons_close, diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c index d36694727b48..f1bc67019e2a 100644 --- a/sys/dev/digi/digi.c +++ b/sys/dev/digi/digi.c @@ -58,7 +58,6 @@ #include #include -#define CDEV_MAJOR 162 #define CTRL_DEV 0x800000 #define CALLOUT_MASK 0x400000 @@ -150,7 +149,6 @@ static struct cdevsw digi_sw = { .d_ioctl = digiioctl, .d_poll = ttypoll, .d_name = driver_name, - .d_maj = CDEV_MAJOR, .d_flags = D_TTY, .d_kqfilter = ttykqfilter }; diff --git a/sys/dev/dpt/dpt.h b/sys/dev/dpt/dpt.h index 6b909a9dc416..d04c95a3b8bb 100644 --- a/sys/dev/dpt/dpt.h +++ b/sys/dev/dpt/dpt.h @@ -47,7 +47,6 @@ #include -#define DPT_CDEV_MAJOR 88 #undef DPT_USE_DLM_SWI diff --git a/sys/dev/drm/drm_drv.h b/sys/dev/drm/drm_drv.h index b6b8c6111ff4..e0dfbccf5257 100644 --- a/sys/dev/drm/drm_drv.h +++ b/sys/dev/drm/drm_drv.h @@ -219,7 +219,6 @@ static struct cdevsw DRM(cdevsw) = { .d_poll = DRM( poll ), .d_mmap = DRM( mmap ), .d_name = DRIVER_NAME, - .d_maj = CDEV_MAJOR, .d_flags = D_TRACKCLOSE, #if __FreeBSD_version < 500000 .d_bmaj = -1 diff --git a/sys/dev/drm/drm_os_freebsd.h b/sys/dev/drm/drm_os_freebsd.h index 43b6524935de..43f630927cd3 100644 --- a/sys/dev/drm/drm_os_freebsd.h +++ b/sys/dev/drm/drm_os_freebsd.h @@ -114,7 +114,6 @@ #define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) #define DRM_DEV_UID 0 #define DRM_DEV_GID 0 -#define CDEV_MAJOR 145 #if __FreeBSD_version >= 500000 #define DRM_CURPROC curthread diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index c47bd128a519..5ce670841029 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -361,7 +361,6 @@ static d_write_t fbwrite; static d_ioctl_t fbioctl; static d_mmap_t fbmmap; -#define CDEV_MAJOR 123 /* XXX */ static struct cdevsw fb_cdevsw = { .d_open = fbopen, @@ -371,7 +370,6 @@ static struct cdevsw fb_cdevsw = { .d_ioctl = fbioctl, .d_mmap = fbmmap, .d_name = FB_DRIVER_NAME, - .d_maj = CDEV_MAJOR, }; #endif diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 5cc94086bcb5..5a506334d5c4 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -481,7 +481,6 @@ fdin_rd(fdc_p fdc) return bus_space_read_1(fdc->portt, fdc->porth, FDIN); } -#define CDEV_MAJOR 9 static struct cdevsw fd_cdevsw = { .d_open = fdopen, .d_close = fdclose, @@ -490,7 +489,6 @@ static struct cdevsw fd_cdevsw = { .d_ioctl = fdioctl, .d_strategy = fdstrategy, .d_name = "fd", - .d_maj = CDEV_MAJOR, .d_flags = D_DISK, }; diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index b3ecc8acccd5..9a34ff95fd3c 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -62,7 +62,6 @@ #include #include -#define CDEV_MAJOR 127 #define FWNODE_INVAL 0xffff static d_open_t fw_open; @@ -86,7 +85,6 @@ struct cdevsw firewire_cdevsw = .d_mmap = fw_mmap, .d_strategy = fw_strategy, .d_name = "fw", - .d_maj = CDEV_MAJOR, .d_flags = D_MEM #else fw_open, fw_close, fw_read, fw_write, fw_ioctl, diff --git a/sys/dev/iicbus/iic.c b/sys/dev/iicbus/iic.c index d6410c7e8824..0951f1f5847d 100644 --- a/sys/dev/iicbus/iic.c +++ b/sys/dev/iicbus/iic.c @@ -92,7 +92,6 @@ static d_write_t iicwrite; static d_read_t iicread; static d_ioctl_t iicioctl; -#define CDEV_MAJOR 105 static struct cdevsw iic_cdevsw = { .d_open = iicopen, .d_close = iicclose, @@ -100,7 +99,6 @@ static struct cdevsw iic_cdevsw = { .d_write = iicwrite, .d_ioctl = iicioctl, .d_name = "iic", - .d_maj = CDEV_MAJOR, }; static void diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c index 2e70f53532fa..e7526ab94207 100644 --- a/sys/dev/isp/isp_freebsd.c +++ b/sys/dev/isp/isp_freebsd.c @@ -52,11 +52,9 @@ static void isp_kthread(void *); static void isp_action(struct cam_sim *, union ccb *); -#define ISP_CDEV_MAJOR 248 static struct cdevsw isp_cdevsw = { .d_ioctl = ispioctl, .d_name = "isp", - .d_maj = ISP_CDEV_MAJOR, }; static struct ispsoftc *isplist = NULL; diff --git a/sys/dev/joy/joy.c b/sys/dev/joy/joy.c index 9f6ff51d308f..2ef286bebef9 100644 --- a/sys/dev/joy/joy.c +++ b/sys/dev/joy/joy.c @@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$"); #define JOY_SOFTC(unit) (struct joy_softc *) \ devclass_get_softc(joy_devclass,(unit)) -#define CDEV_MAJOR 51 static d_open_t joyopen; static d_close_t joyclose; static d_read_t joyread; @@ -75,7 +74,6 @@ static struct cdevsw joy_cdevsw = { .d_read = joyread, .d_ioctl = joyioctl, .d_name = "joy", - .d_maj = CDEV_MAJOR, }; devclass_t joy_devclass; diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c index f4910e1ef34c..e7a67db70957 100644 --- a/sys/dev/kbd/kbd.c +++ b/sys/dev/kbd/kbd.c @@ -431,7 +431,6 @@ static d_write_t genkbdwrite; static d_ioctl_t genkbdioctl; static d_poll_t genkbdpoll; -#define CDEV_MAJOR 112 static struct cdevsw kbd_cdevsw = { .d_open = genkbdopen, @@ -441,7 +440,6 @@ static struct cdevsw kbd_cdevsw = { .d_ioctl = genkbdioctl, .d_poll = genkbdpoll, .d_name = "kbd", - .d_maj = CDEV_MAJOR, }; int diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c index 21c160e513cd..285d57dcbf24 100644 --- a/sys/dev/mcd/mcd.c +++ b/sys/dev/mcd/mcd.c @@ -160,7 +160,6 @@ static d_close_t mcdclose; static d_ioctl_t mcdioctl; static d_strategy_t mcdstrategy; -#define CDEV_MAJOR 29 static struct cdevsw mcd_cdevsw = { .d_open = mcdopen, @@ -169,7 +168,6 @@ static struct cdevsw mcd_cdevsw = { .d_ioctl = mcdioctl, .d_strategy = mcdstrategy, .d_name = "mcd", - .d_maj = CDEV_MAJOR, .d_flags = D_DISK, }; diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c index 7c450249913f..bf9412c1e989 100644 --- a/sys/dev/mlx/mlx.c +++ b/sys/dev/mlx/mlx.c @@ -53,14 +53,12 @@ #include #include -#define MLX_CDEV_MAJOR 130 static struct cdevsw mlx_cdevsw = { .d_open = mlx_open, .d_close = mlx_close, .d_ioctl = mlx_ioctl, .d_name = "mlx", - .d_maj = MLX_CDEV_MAJOR, }; devclass_t mlx_devclass; diff --git a/sys/dev/mly/mly.c b/sys/dev/mly/mly.c index 48e8f25fea74..6dacf2778fd7 100644 --- a/sys/dev/mly/mly.c +++ b/sys/dev/mly/mly.c @@ -149,14 +149,12 @@ static driver_t mly_pci_driver = { static devclass_t mly_devclass; DRIVER_MODULE(mly, pci, mly_pci_driver, mly_devclass, 0, 0); -#define MLY_CDEV_MAJOR 158 static struct cdevsw mly_cdevsw = { .d_open = mly_user_open, .d_close = mly_user_close, .d_ioctl = mly_user_ioctl, .d_name = "mly", - .d_maj = MLY_CDEV_MAJOR, }; /******************************************************************************** diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c index 408bbf77c0b0..b2c821b59154 100644 --- a/sys/dev/mse/mse.c +++ b/sys/dev/mse/mse.c @@ -139,7 +139,6 @@ static d_read_t mseread; static d_ioctl_t mseioctl; static d_poll_t msepoll; -#define CDEV_MAJOR 27 static struct cdevsw mse_cdevsw = { .d_open = mseopen, .d_close = mseclose, @@ -147,7 +146,6 @@ static struct cdevsw mse_cdevsw = { .d_ioctl = mseioctl, .d_poll = msepoll, .d_name = "mse", - .d_maj = CDEV_MAJOR, }; static void mseintr(void *); diff --git a/sys/dev/ofw/ofw_console.c b/sys/dev/ofw/ofw_console.c index a0e29ea8d92d..a4b5c8f98902 100644 --- a/sys/dev/ofw/ofw_console.c +++ b/sys/dev/ofw/ofw_console.c @@ -51,7 +51,6 @@ static d_open_t ofw_dev_open; static d_close_t ofw_dev_close; static d_ioctl_t ofw_dev_ioctl; -#define CDEV_MAJOR 97 static struct cdevsw ofw_cdevsw = { .d_open = ofw_dev_open, @@ -61,7 +60,6 @@ static struct cdevsw ofw_cdevsw = { .d_ioctl = ofw_dev_ioctl, .d_poll = ttypoll, .d_name = "ofw", - .d_maj = CDEV_MAJOR, }; static struct tty *ofw_tp = NULL; @@ -106,7 +104,7 @@ cn_drvinit(void *unused) } } -SYSINIT(cndev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE + CDEV_MAJOR, cn_drvinit, NULL) +SYSINIT(cndev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, cn_drvinit, NULL) static int stdin; static int stdout; diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c index 1914c95c5af3..687e7ade284f 100644 --- a/sys/dev/ppbus/lpt.c +++ b/sys/dev/ppbus/lpt.c @@ -189,7 +189,6 @@ static d_write_t lptwrite; static d_read_t lptread; static d_ioctl_t lptioctl; -#define CDEV_MAJOR 16 static struct cdevsw lpt_cdevsw = { .d_open = lptopen, .d_close = lptclose, @@ -197,7 +196,6 @@ static struct cdevsw lpt_cdevsw = { .d_write = lptwrite, .d_ioctl = lptioctl, .d_name = LPT_NAME, - .d_maj = CDEV_MAJOR, }; static int diff --git a/sys/dev/ppbus/pcfclock.c b/sys/dev/ppbus/pcfclock.c index 35dce7171ca7..bf0a01d64430 100644 --- a/sys/dev/ppbus/pcfclock.c +++ b/sys/dev/ppbus/pcfclock.c @@ -67,13 +67,11 @@ static d_open_t pcfclock_open; static d_close_t pcfclock_close; static d_read_t pcfclock_read; -#define CDEV_MAJOR 140 static struct cdevsw pcfclock_cdevsw = { .d_open = pcfclock_open, .d_close = pcfclock_close, .d_read = pcfclock_read, .d_name = PCFCLOCK_NAME, - .d_maj = CDEV_MAJOR, }; #ifndef PCFCLOCK_MAX_RETRIES diff --git a/sys/dev/ppbus/ppi.c b/sys/dev/ppbus/ppi.c index bccccf8688dd..c2783a66ea71 100644 --- a/sys/dev/ppbus/ppi.c +++ b/sys/dev/ppbus/ppi.c @@ -90,7 +90,6 @@ static d_ioctl_t ppiioctl; static d_write_t ppiwrite; static d_read_t ppiread; -#define CDEV_MAJOR 82 static struct cdevsw ppi_cdevsw = { .d_open = ppiopen, .d_close = ppiclose, @@ -98,7 +97,6 @@ static struct cdevsw ppi_cdevsw = { .d_write = ppiwrite, .d_ioctl = ppiioctl, .d_name = "ppi", - .d_maj = CDEV_MAJOR, }; #ifdef PERIPH_1284 diff --git a/sys/dev/ppbus/pps.c b/sys/dev/ppbus/pps.c index 08646bcba9af..e7e1373ed3cd 100644 --- a/sys/dev/ppbus/pps.c +++ b/sys/dev/ppbus/pps.c @@ -62,13 +62,11 @@ static d_open_t ppsopen; static d_close_t ppsclose; static d_ioctl_t ppsioctl; -#define CDEV_MAJOR 89 static struct cdevsw pps_cdevsw = { .d_open = ppsopen, .d_close = ppsclose, .d_ioctl = ppsioctl, .d_name = PPS_NAME, - .d_maj = CDEV_MAJOR, }; static void diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index 6817d02ce6da..f11537c4c82c 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -146,7 +146,6 @@ static d_open_t rcopen; static d_close_t rcclose; static d_ioctl_t rcioctl; -#define CDEV_MAJOR 63 static struct cdevsw rc_cdevsw = { .d_open = rcopen, .d_close = rcclose, @@ -155,7 +154,6 @@ static struct cdevsw rc_cdevsw = { .d_ioctl = rcioctl, .d_poll = ttypoll, .d_name = "rc", - .d_maj = CDEV_MAJOR, .d_flags = D_TTY, .d_kqfilter = ttykqfilter, }; diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c index 8e96f5bae324..98ae4a738bd3 100644 --- a/sys/dev/rp/rp.c +++ b/sys/dev/rp/rp.c @@ -571,7 +571,6 @@ static d_close_t rpclose; static d_write_t rpwrite; static d_ioctl_t rpioctl; -#define CDEV_MAJOR 81 struct cdevsw rp_cdevsw = { .d_open = rpopen, .d_close = rpclose, @@ -580,7 +579,6 @@ struct cdevsw rp_cdevsw = { .d_ioctl = rpioctl, .d_poll = ttypoll, .d_name = "rp", - .d_maj = CDEV_MAJOR, .d_flags = D_TTY, }; diff --git a/sys/dev/scd/scd.c b/sys/dev/scd/scd.c index 89850b3705b8..d455e095902f 100644 --- a/sys/dev/scd/scd.c +++ b/sys/dev/scd/scd.c @@ -145,7 +145,6 @@ static d_close_t scdclose; static d_ioctl_t scdioctl; static d_strategy_t scdstrategy; -#define CDEV_MAJOR 45 static struct cdevsw scd_cdevsw = { .d_open = scdopen, @@ -154,7 +153,6 @@ static struct cdevsw scd_cdevsw = { .d_ioctl = scdioctl, .d_strategy = scdstrategy, .d_name = "scd", - .d_maj = CDEV_MAJOR, .d_flags = D_DISK, }; diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index 148182a46d0d..a3fd213f0e65 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -117,7 +117,6 @@ static d_close_t siclose; static d_write_t siwrite; static d_ioctl_t siioctl; -#define CDEV_MAJOR 68 static struct cdevsw si_cdevsw = { .d_open = siopen, .d_close = siclose, @@ -126,7 +125,6 @@ static struct cdevsw si_cdevsw = { .d_ioctl = siioctl, .d_poll = ttypoll, .d_name = "si", - .d_maj = CDEV_MAJOR, .d_flags = D_TTY, .d_kqfilter = ttykqfilter, }; diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index be51ac329e6b..571265ddc65b 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -322,7 +322,6 @@ static d_read_t sioread; static d_write_t siowrite; static d_ioctl_t sioioctl; -#define CDEV_MAJOR 28 static struct cdevsw sio_cdevsw = { .d_open = sioopen, .d_close = sioclose, @@ -331,7 +330,6 @@ static struct cdevsw sio_cdevsw = { .d_ioctl = sioioctl, .d_poll = ttypoll, .d_name = sio_driver_name, - .d_maj = CDEV_MAJOR, .d_flags = D_TTY, .d_kqfilter = ttykqfilter, }; diff --git a/sys/dev/smbus/smb.c b/sys/dev/smbus/smb.c index b7cfff991afc..280bda52da49 100644 --- a/sys/dev/smbus/smb.c +++ b/sys/dev/smbus/smb.c @@ -87,7 +87,6 @@ static d_write_t smbwrite; static d_read_t smbread; static d_ioctl_t smbioctl; -#define CDEV_MAJOR 106 static struct cdevsw smb_cdevsw = { .d_open = smbopen, .d_close = smbclose, @@ -95,7 +94,6 @@ static struct cdevsw smb_cdevsw = { .d_write = smbwrite, .d_ioctl = smbioctl, .d_name = "smb", - .d_maj = CDEV_MAJOR, }; static void diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index be3ad4209310..e82ef46c9f40 100644 --- a/sys/dev/speaker/spkr.c +++ b/sys/dev/speaker/spkr.c @@ -33,14 +33,12 @@ static d_close_t spkrclose; static d_write_t spkrwrite; static d_ioctl_t spkrioctl; -#define CDEV_MAJOR 26 static struct cdevsw spkr_cdevsw = { .d_open = spkropen, .d_close = spkrclose, .d_write = spkrwrite, .d_ioctl = spkrioctl, .d_name = "spkr", - .d_maj = CDEV_MAJOR, }; static MALLOC_DEFINE(M_SPKR, "spkr", "Speaker buffer"); diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index cc50c3b8e854..8e5ac5713bbd 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -101,11 +101,9 @@ static struct fileops svr4_netops = { .fo_close = svr4_soo_close }; -#define CDEV_MAJOR 103 static struct cdevsw streams_cdevsw = { .d_open = streamsopen, .d_name = "streams", - .d_maj = CDEV_MAJOR, }; struct streams_softc { diff --git a/sys/dev/syscons/sysmouse.c b/sys/dev/syscons/sysmouse.c index 738431002053..a7cff80c6bfe 100644 --- a/sys/dev/syscons/sysmouse.c +++ b/sys/dev/syscons/sysmouse.c @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #ifndef SC_NO_SYSMOUSE -#define CDEV_MAJOR 12 /* major number, shared with syscons */ #define SC_MOUSE 128 /* minor number */ static d_open_t smopen; @@ -56,7 +55,6 @@ static struct cdevsw sm_cdevsw = { .d_ioctl = smioctl, .d_poll = ttypoll, .d_name = "sysmouse", - .d_maj = CDEV_MAJOR, .d_flags = D_TTY, }; @@ -255,8 +253,7 @@ sm_attach_mouse(void *unused) /* sysmouse doesn't have scr_stat */ } -SYSINIT(sysmouse, SI_SUB_DRIVERS, SI_ORDER_MIDDLE + CDEV_MAJOR, - sm_attach_mouse, NULL) +SYSINIT(sysmouse, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, sm_attach_mouse, NULL) int sysmouse_event(mouse_info_t *info) diff --git a/sys/dev/tdfx/tdfx_pci.c b/sys/dev/tdfx/tdfx_pci.c index b57a596f8efe..dda1eb5a27eb 100644 --- a/sys/dev/tdfx/tdfx_pci.c +++ b/sys/dev/tdfx/tdfx_pci.c @@ -109,7 +109,6 @@ static struct cdevsw tdfx_cdev = { .d_ioctl = tdfx_ioctl, .d_mmap = tdfx_mmap, .d_name = "tdfx", - .d_maj = CDEV_MAJOR, }; static int diff --git a/sys/dev/tdfx/tdfx_vars.h b/sys/dev/tdfx/tdfx_vars.h index 55bb060ea0df..67ce1319cee8 100644 --- a/sys/dev/tdfx/tdfx_vars.h +++ b/sys/dev/tdfx/tdfx_vars.h @@ -42,7 +42,6 @@ #include #include -#define CDEV_MAJOR 107 #define PCI_DEVICE_ALLIANCE_AT3D 0x643d1142 #define PCI_DEVICE_3DFX_VOODOO1 0x0001121a #define PCI_DEVICE_3DFX_VOODOO2 0x0002121a diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index c5f3fc032ea2..9e8c8f1165e7 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -180,7 +180,6 @@ static struct ti_type ti_devs[] = { { 0, 0, NULL } }; -#define TI_CDEV_MAJOR 153 static d_open_t ti_open; static d_close_t ti_close; @@ -191,7 +190,6 @@ static struct cdevsw ti_cdevsw = { .d_close = ti_close, .d_ioctl = ti_ioctl2, .d_name = "ti", - .d_maj = TI_CDEV_MAJOR, }; static int ti_probe (device_t); diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c index 6f3f02bbe9ec..6a3a8ff09db3 100644 --- a/sys/dev/twe/twe_freebsd.c +++ b/sys/dev/twe/twe_freebsd.c @@ -71,7 +71,6 @@ static struct cdevsw twe_cdevsw = { .d_close = twe_close, .d_ioctl = twe_ioctl_wrapper, .d_name = "twe", - .d_maj = TWE_CDEV_MAJOR, }; /******************************************************************************** diff --git a/sys/dev/twe/twevar.h b/sys/dev/twe/twevar.h index 63700daf6425..e39c88e7d75c 100644 --- a/sys/dev/twe/twevar.h +++ b/sys/dev/twe/twevar.h @@ -32,8 +32,6 @@ * ..<3ware internal release>. */ #define TWE_DRIVER_VERSION_STRING "1.50.00.000" -#define TWE_CDEV_MAJOR 146 -#define TWED_CDEV_MAJOR 147 #ifdef TWE_DEBUG #define debug(level, fmt, args...) \ diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index e42657c6f465..9298d087c18c 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -126,7 +126,6 @@ Static d_read_t ucomread; Static d_write_t ucomwrite; Static d_ioctl_t ucomioctl; -#define UCOM_CDEV_MAJOR 138 static struct cdevsw ucom_cdevsw = { .d_open = ucomopen, @@ -136,7 +135,6 @@ static struct cdevsw ucom_cdevsw = { .d_ioctl = ucomioctl, .d_poll = ttypoll, .d_name = "ucom", - .d_maj = UCOM_CDEV_MAJOR, .d_flags = D_TTY, #if __FreeBSD_version < 500014 .d_bmaj = -1, diff --git a/sys/dev/usb/ufm.c b/sys/dev/usb/ufm.c index 7fcecfdbd9e4..26916f1f4f39 100644 --- a/sys/dev/usb/ufm.c +++ b/sys/dev/usb/ufm.c @@ -88,18 +88,11 @@ d_open_t ufmopen; d_close_t ufmclose; d_ioctl_t ufmioctl; -#if __FreeBSD_version >= 500000 -#define UFM_CDEV_MAJOR MAJOR_AUTO -#else -#define UFM_CDEV_MAJOR 200 -#endif - Static struct cdevsw ufm_cdevsw = { .d_open = ufmopen, .d_close = ufmclose, .d_ioctl = ufmioctl, .d_name = "ufm", - .d_maj = UFM_CDEV_MAJOR, #if (__FreeBSD_version < 500014) .d_bmaj = -1 #endif diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 8740c3d7fef0..408d14b06bdc 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -149,7 +149,6 @@ d_write_t ugenwrite; d_ioctl_t ugenioctl; d_poll_t ugenpoll; -#define UGEN_CDEV_MAJOR 114 Static struct cdevsw ugen_cdevsw = { .d_open = ugenopen, @@ -159,7 +158,6 @@ Static struct cdevsw ugen_cdevsw = { .d_ioctl = ugenioctl, .d_poll = ugenpoll, .d_name = "ugen", - .d_maj = UGEN_CDEV_MAJOR, #if __FreeBSD_version < 500014 .d_bmaj -1 #endif diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index 2451542f7946..ec46474a1c0b 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -154,7 +154,6 @@ d_write_t uhidwrite; d_ioctl_t uhidioctl; d_poll_t uhidpoll; -#define UHID_CDEV_MAJOR 122 Static struct cdevsw uhid_cdevsw = { .d_open = uhidopen, @@ -164,7 +163,6 @@ Static struct cdevsw uhid_cdevsw = { .d_ioctl = uhidioctl, .d_poll = uhidpoll, .d_name = "uhid", - .d_maj = UHID_CDEV_MAJOR, #if __FreeBSD_version < 500014 .d_bmaj -1 #endif diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 6df5ff3a2fe3..3dadd00633f2 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -145,7 +145,6 @@ Static d_close_t ulptclose; Static d_write_t ulptwrite; Static d_ioctl_t ulptioctl; -#define ULPT_CDEV_MAJOR 113 Static struct cdevsw ulpt_cdevsw = { .d_open = ulptopen, @@ -153,7 +152,6 @@ Static struct cdevsw ulpt_cdevsw = { .d_write = ulptwrite, .d_ioctl = ulptioctl, .d_name = "ulpt", - .d_maj = ULPT_CDEV_MAJOR, #if __FreeBSD_version < 500014 .d_bmaj -1 #endif diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index dea1e0b8f827..4c0d598045da 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -152,7 +152,6 @@ Static d_read_t ums_read; Static d_ioctl_t ums_ioctl; Static d_poll_t ums_poll; -#define UMS_CDEV_MAJOR 111 Static struct cdevsw ums_cdevsw = { .d_open = ums_open, @@ -161,7 +160,6 @@ Static struct cdevsw ums_cdevsw = { .d_ioctl = ums_ioctl, .d_poll = ums_poll, .d_name = "ums", - .d_maj = UMS_CDEV_MAJOR, #if __FreeBSD_version < 500014 .d_bmaj -1 #endif diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index 6614a33eb93e..57979cdf3f38 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -115,7 +115,6 @@ d_read_t urioread; d_write_t uriowrite; d_ioctl_t urioioctl; -#define URIO_CDEV_MAJOR 143 Static struct cdevsw urio_cdevsw = { .d_open = urioopen, @@ -124,7 +123,6 @@ Static struct cdevsw urio_cdevsw = { .d_write = uriowrite, .d_ioctl = urioioctl, .d_name = "urio", - .d_maj = URIO_CDEV_MAJOR, #if __FreeBSD_version < 500014 .d_bmaj = -1 #endif diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 4f9034a226ca..6ff8ed3e81e8 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -152,7 +152,6 @@ struct cdevsw usb_cdevsw = { .d_ioctl = usbioctl, .d_poll = usbpoll, .d_name = "usb", - .d_maj = USB_CDEV_MAJOR, #if __FreeBSD_version < 500014 .d_bmaj = -1 #endif diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index 146f8caa878f..b9e1c1e19423 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -89,7 +89,6 @@ typedef void (*usbd_callback)(usbd_xfer_handle, usbd_private_handle, #define USBD_DEFAULT_TIMEOUT 5000 /* ms = 5 s */ #if defined(__FreeBSD__) -#define USB_CDEV_MAJOR 108 #endif usbd_status usbd_open_pipe(usbd_interface_handle iface, u_int8_t address, diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index 7d83f570f4cf..ab46721c113a 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -266,7 +266,6 @@ d_read_t uscannerread; d_write_t uscannerwrite; d_poll_t uscannerpoll; -#define USCANNER_CDEV_MAJOR 156 Static struct cdevsw uscanner_cdevsw = { .d_open = uscanneropen, @@ -275,7 +274,6 @@ Static struct cdevsw uscanner_cdevsw = { .d_write = uscannerwrite, .d_poll = uscannerpoll, .d_name = "uscanner", - .d_maj = USCANNER_CDEV_MAJOR, #if __FreeBSD_version < 500014 .d_bmaj -1 #endif diff --git a/sys/i386/acpica/acpi_machdep.c b/sys/i386/acpica/acpi_machdep.c index d382bc6410ad..a6c186a9a610 100644 --- a/sys/i386/acpica/acpi_machdep.c +++ b/sys/i386/acpica/acpi_machdep.c @@ -72,7 +72,6 @@ static d_write_t apmwrite; static d_ioctl_t apmioctl; static d_poll_t apmpoll; -#define CDEV_MAJOR 39 static struct cdevsw apm_cdevsw = { .d_open = apmopen, .d_close = apmclose, @@ -80,7 +79,6 @@ static struct cdevsw apm_cdevsw = { .d_ioctl = apmioctl, .d_poll = apmpoll, .d_name = "apm", - .d_maj = CDEV_MAJOR, }; static int intr_model = ACPI_INTR_PIC; diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index 64337c4c9d3d..1e2371fef54a 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -107,7 +107,6 @@ static d_write_t apmwrite; static d_ioctl_t apmioctl; static d_poll_t apmpoll; -#define CDEV_MAJOR 39 static struct cdevsw apm_cdevsw = { .d_open = apmopen, .d_close = apmclose, @@ -115,7 +114,6 @@ static struct cdevsw apm_cdevsw = { .d_ioctl = apmioctl, .d_poll = apmpoll, .d_name = "apm", - .d_maj = CDEV_MAJOR, }; static int apm_suspend_delay = 1; diff --git a/sys/i386/bios/smapi.c b/sys/i386/bios/smapi.c index ed1267eed6ca..200bcfc760fb 100644 --- a/sys/i386/bios/smapi.c +++ b/sys/i386/bios/smapi.c @@ -77,7 +77,6 @@ static d_ioctl_t smapi_ioctl; static struct cdevsw smapi_cdevsw = { .d_ioctl = smapi_ioctl, .d_name = "smapi", - .d_maj = MAJOR_AUTO, .d_flags = D_MEM, }; diff --git a/sys/i386/i386/perfmon.c b/sys/i386/i386/perfmon.c index a5cd307b55ed..3b765f49223a 100644 --- a/sys/i386/i386/perfmon.c +++ b/sys/i386/i386/perfmon.c @@ -71,13 +71,11 @@ static d_ioctl_t perfmon_ioctl; static void perfmon_init_dev(void *); SYSINIT(cpu, SI_SUB_DRIVERS, SI_ORDER_ANY, perfmon_init_dev, NULL); -#define CDEV_MAJOR 2 /* We're really a minor of mem.c */ static struct cdevsw perfmon_cdevsw = { .d_open = perfmon_open, .d_close = perfmon_close, .d_ioctl = perfmon_ioctl, .d_name = "perfmon", - .d_maj = CDEV_MAJOR, }; /* diff --git a/sys/i386/isa/asc.c b/sys/i386/isa/asc.c index 23a9801da66e..8aff8c105f62 100644 --- a/sys/i386/isa/asc.c +++ b/sys/i386/isa/asc.c @@ -195,7 +195,6 @@ static d_read_t ascread; static d_ioctl_t ascioctl; static d_poll_t ascpoll; -#define CDEV_MAJOR 71 static struct cdevsw asc_cdevsw = { .d_open = ascopen, @@ -204,7 +203,6 @@ static struct cdevsw asc_cdevsw = { .d_ioctl = ascioctl, .d_poll = ascpoll, .d_name = "asc", - .d_maj = CDEV_MAJOR, }; #define STATIC static diff --git a/sys/i386/isa/ctx.c b/sys/i386/isa/ctx.c index db26c40ba7b2..28adedc60f48 100644 --- a/sys/i386/isa/ctx.c +++ b/sys/i386/isa/ctx.c @@ -141,7 +141,6 @@ static d_close_t ctxclose; static d_read_t ctxread; static d_write_t ctxwrite; static d_ioctl_t ctxioctl; -#define CDEV_MAJOR 40 static struct cdevsw ctx_cdevsw = { .d_open = ctxopen, @@ -150,7 +149,6 @@ static struct cdevsw ctx_cdevsw = { .d_write = ctxwrite, .d_ioctl = ctxioctl, .d_name = "ctx", - .d_maj = CDEV_MAJOR, }; diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c index 203ed94c60e5..4351a3051de8 100644 --- a/sys/i386/isa/cy.c +++ b/sys/i386/isa/cy.c @@ -385,7 +385,6 @@ static d_close_t sioclose; static d_write_t siowrite; static d_ioctl_t sioioctl; -#define CDEV_MAJOR 48 static struct cdevsw sio_cdevsw = { .d_open = sioopen, .d_close = sioclose, @@ -394,7 +393,6 @@ static struct cdevsw sio_cdevsw = { .d_ioctl = sioioctl, .d_poll = ttypoll, .d_name = driver_name, - .d_maj = CDEV_MAJOR, .d_flags = D_TTY, .d_kqfilter = ttykqfilter, }; diff --git a/sys/i386/isa/gpib.c b/sys/i386/isa/gpib.c index 26102df178b3..480448a14071 100644 --- a/sys/i386/isa/gpib.c +++ b/sys/i386/isa/gpib.c @@ -72,14 +72,12 @@ static d_close_t gpclose; static d_write_t gpwrite; static d_ioctl_t gpioctl; -#define CDEV_MAJOR 44 static struct cdevsw gp_cdevsw = { .d_open = gpopen, .d_close = gpclose, .d_write = gpwrite, .d_ioctl = gpioctl, .d_name = "gp", - .d_maj = CDEV_MAJOR, }; #define BUFSIZE 1024 diff --git a/sys/i386/isa/gsc.c b/sys/i386/isa/gsc.c index a59f49345e33..d4dff76327a8 100644 --- a/sys/i386/isa/gsc.c +++ b/sys/i386/isa/gsc.c @@ -191,14 +191,12 @@ static d_close_t gscclose; static d_read_t gscread; static d_ioctl_t gscioctl; -#define CDEV_MAJOR 47 static struct cdevsw gsc_cdevsw = { .d_open = gscopen, .d_close = gscclose, .d_read = gscread, .d_ioctl = gscioctl, .d_name = "gsc", - .d_maj = CDEV_MAJOR, }; diff --git a/sys/i386/isa/istallion.c b/sys/i386/isa/istallion.c index 7f27ad7e8865..e44400dc48a9 100644 --- a/sys/i386/isa/istallion.c +++ b/sys/i386/isa/istallion.c @@ -642,7 +642,6 @@ COMPAT_ISA_DRIVER(stli, stlidriver); * FreeBSD-2.2+ kernel linkage. */ -#define CDEV_MAJOR 75 static struct cdevsw stli_cdevsw = { .d_open = stliopen, .d_close = stliclose, @@ -651,7 +650,6 @@ static struct cdevsw stli_cdevsw = { .d_ioctl = stliioctl, .d_poll = ttypoll, .d_name = stli_drvname, - .d_maj = CDEV_MAJOR, .d_flags = D_TTY, .d_kqfilter = ttykqfilter, }; diff --git a/sys/i386/isa/mse.c b/sys/i386/isa/mse.c index 408bbf77c0b0..b2c821b59154 100644 --- a/sys/i386/isa/mse.c +++ b/sys/i386/isa/mse.c @@ -139,7 +139,6 @@ static d_read_t mseread; static d_ioctl_t mseioctl; static d_poll_t msepoll; -#define CDEV_MAJOR 27 static struct cdevsw mse_cdevsw = { .d_open = mseopen, .d_close = mseclose, @@ -147,7 +146,6 @@ static struct cdevsw mse_cdevsw = { .d_ioctl = mseioctl, .d_poll = msepoll, .d_name = "mse", - .d_maj = CDEV_MAJOR, }; static void mseintr(void *); diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c index 38c1ced77314..351048020351 100644 --- a/sys/i386/isa/pcvt/pcvt_drv.c +++ b/sys/i386/isa/pcvt/pcvt_drv.c @@ -93,7 +93,6 @@ static d_close_t pcvt_close; static d_ioctl_t pcvt_ioctl; static d_mmap_t pcvt_mmap; -#define CDEV_MAJOR 12 static struct cdevsw vt_cdevsw = { .d_open = pcvt_open, @@ -104,7 +103,6 @@ static struct cdevsw vt_cdevsw = { .d_poll = ttypoll, .d_mmap = pcvt_mmap, .d_name = "vt", - .d_maj = CDEV_MAJOR, .d_flags = D_TTY, .d_kqfilter = ttykqfilter, }; diff --git a/sys/i386/isa/spic.c b/sys/i386/isa/spic.c index 93985e411445..e73b8b6dbc05 100644 --- a/sys/i386/isa/spic.c +++ b/sys/i386/isa/spic.c @@ -91,7 +91,6 @@ static struct cdevsw spic_cdevsw = { .d_ioctl = spicioctl, .d_poll = spicpoll, .d_name = "spic", - .d_maj = CDEV_MAJOR, }; #define SCBUFLEN 128 diff --git a/sys/i386/isa/spicreg.h b/sys/i386/isa/spicreg.h index 62a12abb761b..7657f3ea7729 100644 --- a/sys/i386/isa/spicreg.h +++ b/sys/i386/isa/spicreg.h @@ -27,7 +27,6 @@ * */ -#define CDEV_MAJOR 160 /* * Find the PCI device that holds the G10 register needed to map in the SPIC diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c index 0b568f312bd0..dd23abd690d2 100644 --- a/sys/i386/isa/spigot.c +++ b/sys/i386/isa/spigot.c @@ -104,7 +104,6 @@ static d_write_t spigot_write; static d_ioctl_t spigot_ioctl; static d_mmap_t spigot_mmap; -#define CDEV_MAJOR 11 static struct cdevsw spigot_cdevsw = { .d_open = spigot_open, .d_close = spigot_close, @@ -113,7 +112,6 @@ static struct cdevsw spigot_cdevsw = { .d_ioctl = spigot_ioctl, .d_mmap = spigot_mmap, .d_name = "spigot", - .d_maj = CDEV_MAJOR, }; static ointhand2_t spigintr; diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c index be3ad4209310..e82ef46c9f40 100644 --- a/sys/i386/isa/spkr.c +++ b/sys/i386/isa/spkr.c @@ -33,14 +33,12 @@ static d_close_t spkrclose; static d_write_t spkrwrite; static d_ioctl_t spkrioctl; -#define CDEV_MAJOR 26 static struct cdevsw spkr_cdevsw = { .d_open = spkropen, .d_close = spkrclose, .d_write = spkrwrite, .d_ioctl = spkrioctl, .d_name = "spkr", - .d_maj = CDEV_MAJOR, }; static MALLOC_DEFINE(M_SPKR, "spkr", "Speaker buffer"); diff --git a/sys/i386/isa/stallion.c b/sys/i386/isa/stallion.c index 54d186d09ca4..4665491dd57d 100644 --- a/sys/i386/isa/stallion.c +++ b/sys/i386/isa/stallion.c @@ -536,7 +536,6 @@ COMPAT_PCI_DRIVER (stlpci, stlpcidriver); * FreeBSD-2.2+ kernel linkage. */ -#define CDEV_MAJOR 72 static struct cdevsw stl_cdevsw = { .d_open = stlopen, .d_close = stlclose, @@ -545,7 +544,6 @@ static struct cdevsw stl_cdevsw = { .d_ioctl = stlioctl, .d_poll = ttypoll, .d_name = "stl", - .d_maj = CDEV_MAJOR, .d_flags = D_TTY, .d_kqfilter = ttykqfilter, }; diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c index 22257f7eb030..941fc082f403 100644 --- a/sys/i386/isa/wt.c +++ b/sys/i386/isa/wt.c @@ -184,7 +184,6 @@ static d_close_t wtclose; static d_ioctl_t wtioctl; static d_strategy_t wtstrategy; -#define CDEV_MAJOR 10 static struct cdevsw wt_cdevsw = { .d_open = wtopen, @@ -194,7 +193,6 @@ static struct cdevsw wt_cdevsw = { .d_ioctl = wtioctl, .d_strategy = wtstrategy, .d_name = "wt", - .d_maj = CDEV_MAJOR, }; diff --git a/sys/i4b/driver/i4b_ctl.c b/sys/i4b/driver/i4b_ctl.c index f71ae632fbf4..79cd1ab57fa6 100644 --- a/sys/i4b/driver/i4b_ctl.c +++ b/sys/i4b/driver/i4b_ctl.c @@ -56,7 +56,6 @@ static d_close_t i4bctlclose; static d_ioctl_t i4bctlioctl; static d_poll_t i4bctlpoll; -#define CDEV_MAJOR 55 static struct cdevsw i4bctl_cdevsw = { .d_open = i4bctlopen, @@ -64,7 +63,6 @@ static struct cdevsw i4bctl_cdevsw = { .d_ioctl = i4bctlioctl, .d_poll = i4bctlpoll, .d_name = "i4bctl", - .d_maj = CDEV_MAJOR, }; static void i4bctlattach(void *); diff --git a/sys/i4b/driver/i4b_rbch.c b/sys/i4b/driver/i4b_rbch.c index cb68c6cd53cb..f632186d4c28 100644 --- a/sys/i4b/driver/i4b_rbch.c +++ b/sys/i4b/driver/i4b_rbch.c @@ -110,7 +110,6 @@ static d_read_t i4brbchwrite; static d_ioctl_t i4brbchioctl; static d_poll_t i4brbchpoll; -#define CDEV_MAJOR 57 static struct cdevsw i4brbch_cdevsw = { .d_open = i4brbchopen, @@ -120,7 +119,6 @@ static struct cdevsw i4brbch_cdevsw = { .d_ioctl = i4brbchioctl, .d_poll = i4brbchpoll, .d_name = "i4brbch", - .d_maj = CDEV_MAJOR, }; static void i4brbchattach(void *); diff --git a/sys/i4b/driver/i4b_tel.c b/sys/i4b/driver/i4b_tel.c index de0833dac5c5..5acce731a376 100644 --- a/sys/i4b/driver/i4b_tel.c +++ b/sys/i4b/driver/i4b_tel.c @@ -132,7 +132,6 @@ static d_read_t i4btelwrite; static d_ioctl_t i4btelioctl; static d_poll_t i4btelpoll; -#define CDEV_MAJOR 56 static struct cdevsw i4btel_cdevsw = { .d_open = i4btelopen, @@ -142,7 +141,6 @@ static struct cdevsw i4btel_cdevsw = { .d_ioctl = i4btelioctl, .d_poll = i4btelpoll, .d_name = "i4btel", - .d_maj = CDEV_MAJOR, }; static void i4btelattach(void *); diff --git a/sys/i4b/driver/i4b_trace.c b/sys/i4b/driver/i4b_trace.c index ea92b18884ab..348c6dd49b22 100644 --- a/sys/i4b/driver/i4b_trace.c +++ b/sys/i4b/driver/i4b_trace.c @@ -73,7 +73,6 @@ static d_read_t i4btrcread; static d_ioctl_t i4btrcioctl; static d_poll_t i4btrcpoll; -#define CDEV_MAJOR 59 static struct cdevsw i4btrc_cdevsw = { .d_open = i4btrcopen, @@ -82,7 +81,6 @@ static struct cdevsw i4btrc_cdevsw = { .d_ioctl = i4btrcioctl, .d_poll = i4btrcpoll, .d_name = "i4btrc", - .d_maj = CDEV_MAJOR, }; static void i4btrcattach(void *); diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c index e17ad85e3dfe..42330efdc729 100644 --- a/sys/i4b/layer4/i4b_i4bdrv.c +++ b/sys/i4b/layer4/i4b_i4bdrv.c @@ -76,7 +76,6 @@ static d_read_t i4bread; static d_ioctl_t i4bioctl; static d_poll_t i4bpoll; -#define CDEV_MAJOR 60 static struct cdevsw i4b_cdevsw = { .d_open = i4bopen, @@ -85,7 +84,6 @@ static struct cdevsw i4b_cdevsw = { .d_ioctl = i4bioctl, .d_poll = i4bpoll, .d_name = "i4b", - .d_maj = CDEV_MAJOR, }; static void i4battach(void *); diff --git a/sys/ia64/ia64/ssc.c b/sys/ia64/ia64/ssc.c index be746a184cb6..551ff0b55288 100644 --- a/sys/ia64/ia64/ssc.c +++ b/sys/ia64/ia64/ssc.c @@ -57,7 +57,6 @@ static d_open_t sscopen; static d_close_t sscclose; static d_ioctl_t sscioctl; -#define CDEV_MAJOR 97 static struct cdevsw ssc_cdevsw = { .d_open = sscopen, .d_close = sscclose, @@ -66,7 +65,6 @@ static struct cdevsw ssc_cdevsw = { .d_ioctl = sscioctl, .d_poll = ttypoll, .d_name = "ssc", - .d_maj = CDEV_MAJOR, }; static struct tty *ssc_tp = NULL; diff --git a/sys/isa/fd.c b/sys/isa/fd.c index 5cc94086bcb5..5a506334d5c4 100644 --- a/sys/isa/fd.c +++ b/sys/isa/fd.c @@ -481,7 +481,6 @@ fdin_rd(fdc_p fdc) return bus_space_read_1(fdc->portt, fdc->porth, FDIN); } -#define CDEV_MAJOR 9 static struct cdevsw fd_cdevsw = { .d_open = fdopen, .d_close = fdclose, @@ -490,7 +489,6 @@ static struct cdevsw fd_cdevsw = { .d_ioctl = fdioctl, .d_strategy = fdstrategy, .d_name = "fd", - .d_maj = CDEV_MAJOR, .d_flags = D_DISK, }; diff --git a/sys/isa/psm.c b/sys/isa/psm.c index 4b1277632024..e886e8cc9e4b 100644 --- a/sys/isa/psm.c +++ b/sys/isa/psm.c @@ -346,7 +346,6 @@ static driver_t psm_driver = { sizeof(struct psm_softc), }; -#define CDEV_MAJOR 21 static struct cdevsw psm_cdevsw = { .d_open = psmopen, @@ -355,7 +354,6 @@ static struct cdevsw psm_cdevsw = { .d_ioctl = psmioctl, .d_poll = psmpoll, .d_name = PSM_DRIVER_NAME, - .d_maj = CDEV_MAJOR, }; /* debug message level */ diff --git a/sys/net/bpf.c b/sys/net/bpf.c index f829e6260330..9a8d35a9e83d 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -126,7 +126,6 @@ static d_ioctl_t bpfioctl; static d_poll_t bpfpoll; static d_kqfilter_t bpfkqfilter; -#define CDEV_MAJOR 23 static struct cdevsw bpf_cdevsw = { .d_open = bpfopen, .d_close = bpfclose, @@ -135,7 +134,6 @@ static struct cdevsw bpf_cdevsw = { .d_ioctl = bpfioctl, .d_poll = bpfpoll, .d_name = "bpf", - .d_maj = CDEV_MAJOR, .d_kqfilter = bpfkqfilter, }; @@ -1598,7 +1596,7 @@ bpf_drvinit(unused) EVENTHANDLER_REGISTER(dev_clone, bpf_clone, 0, 1000); } -SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bpf_drvinit,NULL) +SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE,bpf_drvinit,NULL) #else /* !DEV_BPF && !NETGRAPH_BPF */ /* diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c index dd5ef6568f48..e353caf007fa 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c @@ -225,12 +225,6 @@ Static d_poll_t ubt_poll; Static void ubt_create_device_nodes (ubt_softc_p); Static void ubt_destroy_device_nodes (ubt_softc_p); -#if __FreeBSD_version < 500104 -#define CDEV_MAJOR 222 -#else -#define CDEV_MAJOR MAJOR_AUTO -#endif - Static struct cdevsw ubt_cdevsw = { .d_open = ubt_open, .d_close = ubt_close, @@ -239,7 +233,6 @@ Static struct cdevsw ubt_cdevsw = { .d_ioctl = ubt_ioctl, .d_poll = ubt_poll, .d_name = "ubt", - .d_maj = CDEV_MAJOR, }; /* diff --git a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c index 8e4eeb2491d5..44e763fe73a8 100644 --- a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c +++ b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c @@ -91,12 +91,6 @@ Static d_write_t ubtbcmfw_write; Static d_ioctl_t ubtbcmfw_ioctl; Static d_poll_t ubtbcmfw_poll; -#if __FreeBSD_version < 500104 -#define CDEV_MAJOR 223 -#else -#define CDEV_MAJOR MAJOR_AUTO -#endif - Static struct cdevsw ubtbcmfw_cdevsw = { .d_open = ubtbcmfw_open, .d_close = ubtbcmfw_close, @@ -105,7 +99,6 @@ Static struct cdevsw ubtbcmfw_cdevsw = { .d_ioctl = ubtbcmfw_ioctl, .d_poll = ubtbcmfw_poll, .d_name = "ubtbcmfw", - .d_maj = CDEV_MAJOR, }; /* diff --git a/sys/netgraph/ng_device.c b/sys/netgraph/ng_device.c index b05c515b5c4b..ae3237fa33da 100644 --- a/sys/netgraph/ng_device.c +++ b/sys/netgraph/ng_device.c @@ -112,7 +112,6 @@ static d_write_t ngdwrite; static d_ioctl_t ngdioctl; static d_poll_t ngdpoll; -#define NGD_CDEV_MAJOR 20 static struct cdevsw ngd_cdevsw = { .d_open = ngdopen, .d_close = ngdclose, @@ -121,7 +120,6 @@ static struct cdevsw ngd_cdevsw = { .d_ioctl = ngdioctl, .d_poll = ngdpoll, .d_name = "ngd", - .d_maj = NGD_CDEV_MAJOR, }; /* diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c index 77961b3d8368..a2ebaa4ce381 100644 --- a/sys/pc98/cbus/fdc.c +++ b/sys/pc98/cbus/fdc.c @@ -622,7 +622,6 @@ fdin_rd(fdc_p fdc) } #endif /* PC98 */ -#define CDEV_MAJOR 9 static struct cdevsw fd_cdevsw = { .d_open = fdopen, .d_close = fdclose, @@ -631,7 +630,6 @@ static struct cdevsw fd_cdevsw = { .d_ioctl = fdioctl, .d_strategy = fdstrategy, .d_name = "fd", - .d_maj = CDEV_MAJOR, .d_flags = D_DISK, }; diff --git a/sys/pc98/cbus/olpt.c b/sys/pc98/cbus/olpt.c index e21e35400834..f17604617487 100644 --- a/sys/pc98/cbus/olpt.c +++ b/sys/pc98/cbus/olpt.c @@ -229,14 +229,12 @@ static d_close_t lptclose; static d_write_t lptwrite; static d_ioctl_t lptioctl; -#define CDEV_MAJOR 16 static struct cdevsw lpt_cdevsw = { .d_open = lptopen, .d_close = lptclose, .d_write = lptwrite, .d_ioctl = lptioctl, .d_name = "lpt", - .d_maj = CDEV_MAJOR, }; static bus_addr_t lpt_iat[] = {0, 2, 4, 6}; diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index 4e3467110e1c..6c865853ddb5 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -415,7 +415,6 @@ static d_read_t sioread; static d_write_t siowrite; static d_ioctl_t sioioctl; -#define CDEV_MAJOR 28 static struct cdevsw sio_cdevsw = { .d_open = sioopen, .d_close = sioclose, @@ -424,7 +423,6 @@ static struct cdevsw sio_cdevsw = { .d_ioctl = sioioctl, .d_poll = ttypoll, .d_name = sio_driver_name, - .d_maj = CDEV_MAJOR, .d_flags = D_TTY, .d_kqfilter = ttykqfilter, }; diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c index 77961b3d8368..a2ebaa4ce381 100644 --- a/sys/pc98/pc98/fd.c +++ b/sys/pc98/pc98/fd.c @@ -622,7 +622,6 @@ fdin_rd(fdc_p fdc) } #endif /* PC98 */ -#define CDEV_MAJOR 9 static struct cdevsw fd_cdevsw = { .d_open = fdopen, .d_close = fdclose, @@ -631,7 +630,6 @@ static struct cdevsw fd_cdevsw = { .d_ioctl = fdioctl, .d_strategy = fdstrategy, .d_name = "fd", - .d_maj = CDEV_MAJOR, .d_flags = D_DISK, }; diff --git a/sys/pc98/pc98/mse.c b/sys/pc98/pc98/mse.c index fe55e7f9a6b5..cc439a0b17ff 100644 --- a/sys/pc98/pc98/mse.c +++ b/sys/pc98/pc98/mse.c @@ -136,7 +136,6 @@ static d_read_t mseread; static d_ioctl_t mseioctl; static d_poll_t msepoll; -#define CDEV_MAJOR 27 static struct cdevsw mse_cdevsw = { .d_open = mseopen, .d_close = mseclose, @@ -144,7 +143,6 @@ static struct cdevsw mse_cdevsw = { .d_ioctl = mseioctl, .d_poll = msepoll, .d_name = "mse", - .d_maj = CDEV_MAJOR, }; static void mseintr(void *); diff --git a/sys/pc98/pc98/olpt.c b/sys/pc98/pc98/olpt.c index e21e35400834..f17604617487 100644 --- a/sys/pc98/pc98/olpt.c +++ b/sys/pc98/pc98/olpt.c @@ -229,14 +229,12 @@ static d_close_t lptclose; static d_write_t lptwrite; static d_ioctl_t lptioctl; -#define CDEV_MAJOR 16 static struct cdevsw lpt_cdevsw = { .d_open = lptopen, .d_close = lptclose, .d_write = lptwrite, .d_ioctl = lptioctl, .d_name = "lpt", - .d_maj = CDEV_MAJOR, }; static bus_addr_t lpt_iat[] = {0, 2, 4, 6}; diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index 4e3467110e1c..6c865853ddb5 100644 --- a/sys/pc98/pc98/sio.c +++ b/sys/pc98/pc98/sio.c @@ -415,7 +415,6 @@ static d_read_t sioread; static d_write_t siowrite; static d_ioctl_t sioioctl; -#define CDEV_MAJOR 28 static struct cdevsw sio_cdevsw = { .d_open = sioopen, .d_close = sioclose, @@ -424,7 +423,6 @@ static struct cdevsw sio_cdevsw = { .d_ioctl = sioioctl, .d_poll = ttypoll, .d_name = sio_driver_name, - .d_maj = CDEV_MAJOR, .d_flags = D_TTY, .d_kqfilter = ttykqfilter, }; diff --git a/sys/pc98/pc98/wd_cd.c b/sys/pc98/pc98/wd_cd.c index 31a25d2633ca..878091716967 100644 --- a/sys/pc98/pc98/wd_cd.c +++ b/sys/pc98/pc98/wd_cd.c @@ -47,7 +47,6 @@ static d_close_t acdclose; static d_ioctl_t acdioctl; static d_strategy_t acdstrategy; -#define CDEV_MAJOR 69 static struct cdevsw acd_cdevsw = { .d_open = acdopen, @@ -57,7 +56,6 @@ static struct cdevsw acd_cdevsw = { .d_ioctl = acdioctl, .d_strategy = acdstrategy, .d_name = "wcd", - .d_maj = CDEV_MAJOR, .d_flags = D_DISK, }; diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c index b1ef84a9692d..bc5f240c0ae1 100644 --- a/sys/pccard/pccard.c +++ b/sys/pccard/pccard.c @@ -80,11 +80,6 @@ static d_write_t crdwrite; static d_ioctl_t crdioctl; static d_poll_t crdpoll; -#if __FreeBSD_version < 500000 -#define CDEV_MAJOR 50 -#else -#define CDEV_MAJOR MAJOR_AUTO -#endif static struct cdevsw crd_cdevsw = { .d_open = crdopen, .d_close = crdclose, @@ -93,7 +88,6 @@ static struct cdevsw crd_cdevsw = { .d_ioctl = crdioctl, .d_poll = crdpoll, .d_name = "crd", - .d_maj = CDEV_MAJOR, }; /* diff --git a/sys/pci/agp.c b/sys/pci/agp.c index 2ae2b72e20ad..6f09660fad6a 100644 --- a/sys/pci/agp.c +++ b/sys/pci/agp.c @@ -63,7 +63,6 @@ MODULE_VERSION(agp, 1); MALLOC_DEFINE(M_AGP, "agp", "AGP data structures"); -#define CDEV_MAJOR 148 /* agp_drv.c */ static d_open_t agp_open; static d_close_t agp_close; @@ -76,7 +75,6 @@ static struct cdevsw agp_cdevsw = { .d_ioctl = agp_ioctl, .d_mmap = agp_mmap, .d_name = "agp", - .d_maj = CDEV_MAJOR, }; static devclass_t agp_devclass; diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c index c5f3fc032ea2..9e8c8f1165e7 100644 --- a/sys/pci/if_ti.c +++ b/sys/pci/if_ti.c @@ -180,7 +180,6 @@ static struct ti_type ti_devs[] = { { 0, 0, NULL } }; -#define TI_CDEV_MAJOR 153 static d_open_t ti_open; static d_close_t ti_close; @@ -191,7 +190,6 @@ static struct cdevsw ti_cdevsw = { .d_close = ti_close, .d_ioctl = ti_ioctl2, .d_name = "ti", - .d_maj = TI_CDEV_MAJOR, }; static int ti_probe (device_t); -- cgit v1.3 From dc08ffec870569914f44bcf26aa838310e343764 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sat, 21 Feb 2004 21:10:55 +0000 Subject: Device megapatch 4/6: Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags. --- sys/alpha/alpha/mem.c | 3 ++- sys/alpha/alpha/promcons.c | 3 ++- sys/alpha/tlsb/zs_tlsb.c | 3 ++- sys/amd64/amd64/mem.c | 3 ++- sys/cam/cam_xpt.c | 2 ++ sys/cam/scsi/scsi_ch.c | 2 ++ sys/cam/scsi/scsi_pass.c | 2 ++ sys/cam/scsi/scsi_pt.c | 2 ++ sys/cam/scsi/scsi_sa.c | 3 ++- sys/cam/scsi/scsi_ses.c | 2 ++ sys/cam/scsi/scsi_target.c | 2 ++ sys/coda/coda_fbsd.c | 2 ++ sys/contrib/ipfilter/netinet/ip_fil.c | 2 ++ sys/contrib/ipfilter/netinet/mlfk_ipl.c | 2 ++ sys/dev/aac/aac.c | 2 ++ sys/dev/acpica/acpi.c | 2 ++ sys/dev/adlink/adlink.c | 2 ++ sys/dev/agp/agp.c | 2 ++ sys/dev/amr/amr.c | 2 ++ sys/dev/asr/asr.c | 2 ++ sys/dev/ata/ata-all.c | 2 ++ sys/dev/ata/atapi-tape.c | 3 ++- sys/dev/atkbdc/psm.c | 2 ++ sys/dev/bktr/bktr_os.c | 2 ++ sys/dev/ciss/ciss.c | 3 ++- sys/dev/cx/if_cx.c | 3 ++- sys/dev/cy/cy.c | 3 ++- sys/dev/cy/cy_isa.c | 3 ++- sys/dev/dcons/dcons.c | 3 ++- sys/dev/digi/digi.c | 3 ++- sys/dev/drm/drm_drv.h | 3 ++- sys/dev/fb/fb.c | 2 ++ sys/dev/fdc/fdc.c | 3 ++- sys/dev/firewire/fwdev.c | 6 +++--- sys/dev/hfa/fore_load.c | 2 ++ sys/dev/ida/ida.c | 2 ++ sys/dev/iicbus/iic.c | 2 ++ sys/dev/iir/iir_ctrl.c | 2 ++ sys/dev/ips/ips.c | 2 ++ sys/dev/isp/isp_freebsd.c | 2 ++ sys/dev/joy/joy.c | 2 ++ sys/dev/kbd/kbd.c | 2 ++ sys/dev/led/led.c | 2 ++ sys/dev/matcd/matcd.c | 3 ++- sys/dev/mcd/mcd.c | 4 ++-- sys/dev/md/md.c | 2 ++ sys/dev/mlx/mlx.c | 3 ++- sys/dev/mly/mly.c | 3 ++- sys/dev/mse/mse.c | 2 ++ sys/dev/nmdm/nmdm.c | 5 +++-- sys/dev/null/null.c | 5 +++-- sys/dev/ofw/ofw_console.c | 4 ++-- sys/dev/ofw/openfirmio.c | 2 ++ sys/dev/ofw/openpromio.c | 2 ++ sys/dev/pci/pci_user.c | 2 ++ sys/dev/ppbus/lpt.c | 2 ++ sys/dev/ppbus/pcfclock.c | 2 ++ sys/dev/ppbus/ppi.c | 2 ++ sys/dev/ppbus/pps.c | 2 ++ sys/dev/raidframe/rf_freebsdkintf.c | 2 ++ sys/dev/random/randomdev.c | 2 ++ sys/dev/rc/rc.c | 3 ++- sys/dev/rp/rp.c | 3 ++- sys/dev/sab/sab.c | 3 ++- sys/dev/scd/scd.c | 3 ++- sys/dev/si/si.c | 3 ++- sys/dev/sio/sio.c | 3 ++- sys/dev/smbus/smb.c | 2 ++ sys/dev/snp/snp.c | 2 ++ sys/dev/sound/midi/midi.c | 2 ++ sys/dev/sound/midi/sequencer.c | 2 ++ sys/dev/sound/pcm/dsp.c | 2 ++ sys/dev/sound/pcm/mixer.c | 2 ++ sys/dev/sound/pcm/sndstat.c | 2 ++ sys/dev/speaker/spkr.c | 2 ++ sys/dev/streams/streams.c | 2 ++ sys/dev/syscons/syscons.c | 6 ++---- sys/dev/syscons/sysmouse.c | 3 ++- sys/dev/tdfx/tdfx_pci.c | 2 ++ sys/dev/tga/tga_pci.c | 2 ++ sys/dev/ti/if_ti.c | 2 ++ sys/dev/twe/twe_freebsd.c | 2 ++ sys/dev/uart/uart_tty.c | 3 ++- sys/dev/usb/ucom.c | 3 ++- sys/dev/usb/ufm.c | 2 ++ sys/dev/usb/ugen.c | 2 ++ sys/dev/usb/uhid.c | 2 ++ sys/dev/usb/ulpt.c | 2 ++ sys/dev/usb/ums.c | 2 ++ sys/dev/usb/urio.c | 2 ++ sys/dev/usb/usb.c | 2 ++ sys/dev/usb/uscanner.c | 2 ++ sys/dev/zs/zs.c | 3 ++- sys/fs/coda/coda_fbsd.c | 2 ++ sys/fs/specfs/spec_vnops.c | 16 ++++++++-------- sys/geom/geom_ctl.c | 2 ++ sys/geom/geom_dev.c | 3 ++- sys/i386/acpica/acpi_machdep.c | 2 ++ sys/i386/bios/apm.c | 2 ++ sys/i386/bios/smapi.c | 3 ++- sys/i386/i386/elan-mmcr.c | 2 ++ sys/i386/i386/mem.c | 3 ++- sys/i386/i386/perfmon.c | 2 ++ sys/i386/isa/asc.c | 2 ++ sys/i386/isa/ctx.c | 2 ++ sys/i386/isa/cy.c | 3 ++- sys/i386/isa/gpib.c | 2 ++ sys/i386/isa/gsc.c | 2 ++ sys/i386/isa/istallion.c | 3 ++- sys/i386/isa/mse.c | 2 ++ sys/i386/isa/pcvt/pcvt_drv.c | 4 ++-- sys/i386/isa/spic.c | 2 ++ sys/i386/isa/spigot.c | 2 ++ sys/i386/isa/spkr.c | 2 ++ sys/i386/isa/stallion.c | 3 ++- sys/i386/isa/wt.c | 2 ++ sys/i4b/driver/i4b_ctl.c | 2 ++ sys/i4b/driver/i4b_rbch.c | 2 ++ sys/i4b/driver/i4b_tel.c | 2 ++ sys/i4b/driver/i4b_trace.c | 2 ++ sys/i4b/layer4/i4b_i4bdrv.c | 2 ++ sys/ia64/ia64/mem.c | 3 ++- sys/ia64/ia64/ssc.c | 3 ++- sys/isa/fd.c | 3 ++- sys/isa/psm.c | 2 ++ sys/isa/vga_isa.c | 2 ++ sys/kern/kern_conf.c | 2 ++ sys/kern/kern_descrip.c | 2 ++ sys/kern/subr_bus.c | 2 ++ sys/kern/subr_devstat.c | 2 ++ sys/kern/subr_log.c | 2 ++ sys/kern/tty_cons.c | 3 ++- sys/kern/tty_pty.c | 6 ++++-- sys/kern/tty_tty.c | 3 ++- sys/net/bpf.c | 2 ++ sys/net/if.c | 2 ++ sys/net/if_tap.c | 2 ++ sys/net/if_tun.c | 2 ++ sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c | 2 ++ sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c | 2 ++ sys/netgraph/ng_device.c | 2 ++ sys/netncp/ncp_mod.c | 2 ++ sys/netsmb/smb_dev.c | 2 ++ sys/nfs4client/nfs4_dev.c | 2 ++ sys/opencrypto/cryptodev.c | 2 ++ sys/pc98/cbus/fdc.c | 3 ++- sys/pc98/cbus/gdc.c | 2 ++ sys/pc98/cbus/olpt.c | 2 ++ sys/pc98/cbus/sio.c | 3 ++- sys/pc98/pc98/fd.c | 3 ++- sys/pc98/pc98/mse.c | 2 ++ sys/pc98/pc98/olpt.c | 2 ++ sys/pc98/pc98/pc98gdc.c | 2 ++ sys/pc98/pc98/sio.c | 3 ++- sys/pc98/pc98/wd_cd.c | 3 ++- sys/pccard/pccard.c | 2 ++ sys/pci/agp.c | 2 ++ sys/pci/if_ti.c | 2 ++ sys/pci/xrpu.c | 2 ++ sys/sparc64/creator/creator_upa.c | 2 ++ sys/sparc64/sparc64/mem.c | 3 ++- sys/sys/conf.h | 9 ++++++++- sys/sys/linedisc.h | 9 ++++++++- 163 files changed, 349 insertions(+), 73 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/alpha/alpha/mem.c b/sys/alpha/alpha/mem.c index 7edc6f13dd92..6c30c9796603 100644 --- a/sys/alpha/alpha/mem.c +++ b/sys/alpha/alpha/mem.c @@ -83,6 +83,7 @@ static d_mmap_t memmmap; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { + .d_version = D_VERSION, .d_open = mmopen, .d_close = mmclose, .d_read = mmrw, @@ -91,7 +92,7 @@ static struct cdevsw mem_cdevsw = { .d_mmap = memmmap, .d_name = "mem", .d_maj = CDEV_MAJOR, - .d_flags = D_MEM, + .d_flags = D_MEM | D_NEEDGIANT, }; struct mem_range_softc mem_range_softc; diff --git a/sys/alpha/alpha/promcons.c b/sys/alpha/alpha/promcons.c index 473f0fc515e5..4d41abced4f0 100644 --- a/sys/alpha/alpha/promcons.c +++ b/sys/alpha/alpha/promcons.c @@ -64,11 +64,12 @@ static d_close_t promclose; static d_ioctl_t promioctl; static struct cdevsw prom_cdevsw = { + .d_version = D_VERSION, .d_open = promopen, .d_close = promclose, .d_ioctl = promioctl, .d_name = "prom", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c index 035ac45678c7..749dd6da5eb8 100644 --- a/sys/alpha/tlsb/zs_tlsb.c +++ b/sys/alpha/tlsb/zs_tlsb.c @@ -71,11 +71,12 @@ static d_close_t zsclose; static d_ioctl_t zsioctl; static struct cdevsw zs_cdevsw = { + .d_version = D_VERSION, .d_open = zsopen, .d_close = zsclose, .d_ioctl = zsioctl, .d_name = "zs", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static void zsstart(struct tty *); diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index c2c702f0b464..74c6e10c1135 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -81,6 +81,7 @@ static d_mmap_t memmmap; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { + .d_version = D_VERSION, .d_open = mmopen, .d_close = mmclose, .d_read = mmrw, @@ -89,7 +90,7 @@ static struct cdevsw mem_cdevsw = { .d_mmap = memmmap, .d_name = "mem", .d_maj = CDEV_MAJOR, - .d_flags = D_MEM, + .d_flags = D_MEM | D_NEEDGIANT, }; MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 03eaf544439e..7e3bfce96196 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -636,6 +636,8 @@ static d_close_t xptclose; static d_ioctl_t xptioctl; static struct cdevsw xpt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = xptopen, .d_close = xptclose, .d_ioctl = xptioctl, diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c index a9ed37376c23..7caaf0a2d2a2 100644 --- a/sys/cam/scsi/scsi_ch.c +++ b/sys/cam/scsi/scsi_ch.c @@ -212,6 +212,8 @@ static struct periph_driver chdriver = PERIPHDRIVER_DECLARE(ch, chdriver); static struct cdevsw ch_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = chopen, .d_close = chclose, .d_ioctl = chioctl, diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c index 13c1017e5ca1..67c73d9216c2 100644 --- a/sys/cam/scsi/scsi_pass.c +++ b/sys/cam/scsi/scsi_pass.c @@ -105,6 +105,8 @@ static struct periph_driver passdriver = PERIPHDRIVER_DECLARE(pass, passdriver); static struct cdevsw pass_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = passopen, .d_close = passclose, .d_ioctl = passioctl, diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c index cc3afa6ce58c..9e053f88d09a 100644 --- a/sys/cam/scsi/scsi_pt.c +++ b/sys/cam/scsi/scsi_pt.c @@ -118,6 +118,8 @@ PERIPHDRIVER_DECLARE(pt, ptdriver); static struct cdevsw pt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ptopen, .d_close = ptclose, .d_read = physread, diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index c41e4166ef91..b1fbd225a74e 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -425,6 +425,7 @@ PERIPHDRIVER_DECLARE(sa, sadriver); static struct cdevsw sa_cdevsw = { + .d_version = D_VERSION, .d_open = saopen, .d_close = saclose, .d_read = physread, @@ -432,7 +433,7 @@ static struct cdevsw sa_cdevsw = { .d_ioctl = saioctl, .d_strategy = sastrategy, .d_name = "sa", - .d_flags = D_TAPE, + .d_flags = D_TAPE | D_NEEDGIANT, }; static int diff --git a/sys/cam/scsi/scsi_ses.c b/sys/cam/scsi/scsi_ses.c index 8f594ae2bcd5..a0a2f14b3802 100644 --- a/sys/cam/scsi/scsi_ses.c +++ b/sys/cam/scsi/scsi_ses.c @@ -175,10 +175,12 @@ static struct periph_driver sesdriver = { PERIPHDRIVER_DECLARE(ses, sesdriver); static struct cdevsw ses_cdevsw = { + .d_version = D_VERSION, .d_open = sesopen, .d_close = sesclose, .d_ioctl = sesioctl, .d_name = "ses", + .d_flags = D_NEEDGIANT, }; static void diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c index 7e0d28fbd83b..9310efe434aa 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -105,6 +105,8 @@ static struct filterops targread_filtops = { 1, NULL, targreadfiltdetach, targreadfilt }; static struct cdevsw targ_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = targopen, .d_close = targclose, .d_read = targread, diff --git a/sys/coda/coda_fbsd.c b/sys/coda/coda_fbsd.c index 1c061b1ae6ef..9dc260c04ee5 100644 --- a/sys/coda/coda_fbsd.c +++ b/sys/coda/coda_fbsd.c @@ -66,6 +66,8 @@ __FBSDID("$FreeBSD$"); #define VC_DEV_NO 93 static struct cdevsw codadevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = vc_nb_open, .d_close = vc_nb_close, .d_read = vc_nb_read, diff --git a/sys/contrib/ipfilter/netinet/ip_fil.c b/sys/contrib/ipfilter/netinet/ip_fil.c index 6b9bafb053da..8a36dc3aae5e 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil.c +++ b/sys/contrib/ipfilter/netinet/ip_fil.c @@ -206,6 +206,8 @@ toid_t ipfr_slowtimer_ch; defined(_KERNEL) # include const struct cdevsw ipl_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, iplopen, iplclose, iplread, nowrite, iplioctl, nostop, notty, nopoll, nommap, }; diff --git a/sys/contrib/ipfilter/netinet/mlfk_ipl.c b/sys/contrib/ipfilter/netinet/mlfk_ipl.c index f1500039bb8f..df1bb75a2cfe 100644 --- a/sys/contrib/ipfilter/netinet/mlfk_ipl.c +++ b/sys/contrib/ipfilter/netinet/mlfk_ipl.c @@ -105,6 +105,8 @@ SYSCTL_INT(_net_inet_ipf, OID_AUTO, fr_minttllog, CTLFLAG_RW, #define CDEV_MAJOR 79 static struct cdevsw ipl_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = iplopen, .d_close = iplclose, .d_read = iplread, diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 0d08883e26e8..77e18c8345ee 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -181,6 +181,8 @@ static int aac_return_aif(struct aac_softc *sc, caddr_t uptr); static int aac_query_disk(struct aac_softc *sc, caddr_t uptr); static struct cdevsw aac_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = aac_open, .d_close = aac_close, .d_ioctl = aac_ioctl, diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 3c7b038e9a85..aefd7e925dd8 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -67,6 +67,8 @@ static d_close_t acpiclose; static d_ioctl_t acpiioctl; static struct cdevsw acpi_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = acpiopen, .d_close = acpiclose, .d_ioctl = acpiioctl, diff --git a/sys/dev/adlink/adlink.c b/sys/dev/adlink/adlink.c index 909f2ba9a28c..f8a7253f6cc3 100644 --- a/sys/dev/adlink/adlink.c +++ b/sys/dev/adlink/adlink.c @@ -393,6 +393,8 @@ adlink_intr(void *arg) } static struct cdevsw adlink_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = adlink_open, .d_ioctl = adlink_ioctl, .d_mmap = adlink_mmap, diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index 6f09660fad6a..6a01e20565ed 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -70,6 +70,8 @@ static d_ioctl_t agp_ioctl; static d_mmap_t agp_mmap; static struct cdevsw agp_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = agp_open, .d_close = agp_close, .d_ioctl = agp_ioctl, diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c index 8eece8e05b6f..0fce75505c24 100644 --- a/sys/dev/amr/amr.c +++ b/sys/dev/amr/amr.c @@ -91,6 +91,8 @@ static d_close_t amr_close; static d_ioctl_t amr_ioctl; static struct cdevsw amr_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = amr_open, .d_close = amr_close, .d_ioctl = amr_ioctl, diff --git a/sys/dev/asr/asr.c b/sys/dev/asr/asr.c index 481ff305d882..2d2ba205d153 100644 --- a/sys/dev/asr/asr.c +++ b/sys/dev/asr/asr.c @@ -578,6 +578,8 @@ DATA_SET (mode0_pciset, mode0_pcidev); */ #define CDEV_MAJOR 154 /* preferred default character major */ STATIC struct cdevsw asr_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = asr_open, .d_close = asr_close, .d_ioctl = asr_ioctl, diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index bd59faf2b44f..27c2c1360b3e 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -59,6 +59,8 @@ __FBSDID("$FreeBSD$"); /* device structures */ static d_ioctl_t ata_ioctl; static struct cdevsw ata_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = ata_ioctl, .d_name = "ata", }; diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c index cd45cd0000ea..aef27a688325 100644 --- a/sys/dev/ata/atapi-tape.c +++ b/sys/dev/ata/atapi-tape.c @@ -53,6 +53,7 @@ static d_close_t ast_close; static d_ioctl_t ast_ioctl; static d_strategy_t ast_strategy; static struct cdevsw ast_cdevsw = { + .d_version = D_VERSION, .d_open = ast_open, .d_close = ast_close, .d_read = physread, @@ -61,7 +62,7 @@ static struct cdevsw ast_cdevsw = { .d_strategy = ast_strategy, .d_name = "ast", .d_maj = 119, - .d_flags = D_TAPE | D_TRACKCLOSE | D_NOGIANT, + .d_flags = D_TAPE | D_TRACKCLOSE, }; /* prototypes */ diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index e886e8cc9e4b..dd2fd7e2cc89 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -348,6 +348,8 @@ static driver_t psm_driver = { static struct cdevsw psm_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = psmopen, .d_close = psmclose, .d_read = psmread, diff --git a/sys/dev/bktr/bktr_os.c b/sys/dev/bktr/bktr_os.c index 92c7fbea8d74..be2ed086d391 100644 --- a/sys/dev/bktr/bktr_os.c +++ b/sys/dev/bktr/bktr_os.c @@ -258,6 +258,8 @@ static d_mmap_t bktr_mmap; static d_poll_t bktr_poll; static struct cdevsw bktr_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = bktr_open, .d_close = bktr_close, .d_read = bktr_read, diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c index 843577de431d..9a4603c95e14 100644 --- a/sys/dev/ciss/ciss.c +++ b/sys/dev/ciss/ciss.c @@ -212,8 +212,9 @@ static d_open_t ciss_open; static d_close_t ciss_close; static d_ioctl_t ciss_ioctl; - static struct cdevsw ciss_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ciss_open, .d_close = ciss_close, .d_ioctl = ciss_ioctl, diff --git a/sys/dev/cx/if_cx.c b/sys/dev/cx/if_cx.c index 52fc80dcbce6..842348eb1f72 100644 --- a/sys/dev/cx/if_cx.c +++ b/sys/dev/cx/if_cx.c @@ -2550,6 +2550,7 @@ static struct cdevsw cx_cdevsw = { }; #else /* __FreeBSD_version > 501000 */ static struct cdevsw cx_cdevsw = { + .d_version = D_VERSION, .d_open = cx_open, .d_close = cx_close, .d_read = cx_read, @@ -2557,7 +2558,7 @@ static struct cdevsw cx_cdevsw = { .d_ioctl = cx_ioctl, .d_name = "cx", .d_maj = CDEV_MAJOR, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; #endif diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index 2a715c03046b..7207846b6380 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -386,12 +386,13 @@ static d_write_t siowrite; static d_ioctl_t sioioctl; static struct cdevsw sio_cdevsw = { + .d_version = D_VERSION, .d_open = sioopen, .d_close = sioclose, .d_write = siowrite, .d_ioctl = sioioctl, .d_name = driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static int comconsole = -1; diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index 2a715c03046b..7207846b6380 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -386,12 +386,13 @@ static d_write_t siowrite; static d_ioctl_t sioioctl; static struct cdevsw sio_cdevsw = { + .d_version = D_VERSION, .d_open = sioopen, .d_close = sioclose, .d_write = siowrite, .d_ioctl = sioioctl, .d_name = driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static int comconsole = -1; diff --git a/sys/dev/dcons/dcons.c b/sys/dev/dcons/dcons.c index 8e6732626c09..d798f84f8f11 100644 --- a/sys/dev/dcons/dcons.c +++ b/sys/dev/dcons/dcons.c @@ -88,11 +88,12 @@ static d_ioctl_t dcons_ioctl; static struct cdevsw dcons_cdevsw = { #if __FreeBSD_version >= 500104 + .d_version = D_VERSION, .d_open = dcons_open, .d_close = dcons_close, .d_ioctl = dcons_ioctl, .d_name = "dcons", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, #else /* open */ dcons_open, /* close */ dcons_close, diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c index 87ebbef528c0..e2cb568fe1dd 100644 --- a/sys/dev/digi/digi.c +++ b/sys/dev/digi/digi.c @@ -142,13 +142,14 @@ const struct digi_control_signals digi_normal_signals = { }; static struct cdevsw digi_sw = { + .d_version = D_VERSION, .d_open = digiopen, .d_close = digiclose, .d_read = digiread, .d_write = digiwrite, .d_ioctl = digiioctl, .d_name = driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static void diff --git a/sys/dev/drm/drm_drv.h b/sys/dev/drm/drm_drv.h index e0dfbccf5257..848794ae1cfc 100644 --- a/sys/dev/drm/drm_drv.h +++ b/sys/dev/drm/drm_drv.h @@ -212,6 +212,7 @@ const char *DRM(find_description)(int vendor, int device); #ifdef __FreeBSD__ static struct cdevsw DRM(cdevsw) = { + .d_version = D_VERSION, .d_open = DRM( open ), .d_close = DRM( close ), .d_read = DRM( read ), @@ -219,7 +220,7 @@ static struct cdevsw DRM(cdevsw) = { .d_poll = DRM( poll ), .d_mmap = DRM( mmap ), .d_name = DRIVER_NAME, - .d_flags = D_TRACKCLOSE, + .d_flags = D_TRACKCLOSE | D_NEEDGIANT, #if __FreeBSD_version < 500000 .d_bmaj = -1 #endif diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index 5ce670841029..38b967092795 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -363,6 +363,8 @@ static d_mmap_t fbmmap; static struct cdevsw fb_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = fbopen, .d_close = fbclose, .d_read = fbread, diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 5a506334d5c4..808c537e3f0f 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -482,6 +482,7 @@ fdin_rd(fdc_p fdc) } static struct cdevsw fd_cdevsw = { + .d_version = D_VERSION, .d_open = fdopen, .d_close = fdclose, .d_read = physread, @@ -489,7 +490,7 @@ static struct cdevsw fd_cdevsw = { .d_ioctl = fdioctl, .d_strategy = fdstrategy, .d_name = "fd", - .d_flags = D_DISK, + .d_flags = D_DISK | D_NEEDGIANT, }; /* diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 9a34ff95fd3c..b5a7d5d03c41 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -73,9 +73,9 @@ static d_write_t fw_write; static d_mmap_t fw_mmap; static d_strategy_t fw_strategy; -struct cdevsw firewire_cdevsw = -{ +struct cdevsw firewire_cdevsw = { #if __FreeBSD_version >= 500104 + .d_version = D_VERSION, .d_open = fw_open, .d_close = fw_close, .d_read = fw_read, @@ -85,7 +85,7 @@ struct cdevsw firewire_cdevsw = .d_mmap = fw_mmap, .d_strategy = fw_strategy, .d_name = "fw", - .d_flags = D_MEM + .d_flags = D_MEM | D_NEEDGIANT #else fw_open, fw_close, fw_read, fw_write, fw_ioctl, fw_poll, fw_mmap, fw_strategy, "fw", CDEV_MAJOR, diff --git a/sys/dev/hfa/fore_load.c b/sys/dev/hfa/fore_load.c index fffdf654632e..77ddaaeabd4d 100644 --- a/sys/dev/hfa/fore_load.c +++ b/sys/dev/hfa/fore_load.c @@ -505,6 +505,8 @@ fore_reset(fup) * Driver entry points */ static struct cdevsw fore_cdev = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_maj = -1, }; diff --git a/sys/dev/ida/ida.c b/sys/dev/ida/ida.c index db4813eecdfb..47f27a78bd4c 100644 --- a/sys/dev/ida/ida.c +++ b/sys/dev/ida/ida.c @@ -66,6 +66,8 @@ static int ida_wait(struct ida_softc *ida, struct ida_qcb *qcb); static d_ioctl_t ida_ioctl; static struct cdevsw ida_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = ida_ioctl, .d_name = "ida", }; diff --git a/sys/dev/iicbus/iic.c b/sys/dev/iicbus/iic.c index 0951f1f5847d..7f4221a60dd5 100644 --- a/sys/dev/iicbus/iic.c +++ b/sys/dev/iicbus/iic.c @@ -93,6 +93,8 @@ static d_read_t iicread; static d_ioctl_t iicioctl; static struct cdevsw iic_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = iicopen, .d_close = iicclose, .d_read = iicread, diff --git a/sys/dev/iir/iir_ctrl.c b/sys/dev/iir/iir_ctrl.c index 8417595ef427..9aeb099ecc67 100644 --- a/sys/dev/iir/iir_ctrl.c +++ b/sys/dev/iir/iir_ctrl.c @@ -70,6 +70,8 @@ static d_ioctl_t iir_ioctl; /* Normally, this is a static structure. But we need it in pci/iir_pci.c */ static struct cdevsw iir_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = iir_open, .d_close = iir_close, .d_read = iir_read, diff --git a/sys/dev/ips/ips.c b/sys/dev/ips/ips.c index 9b076d299d11..d735f83be97f 100644 --- a/sys/dev/ips/ips.c +++ b/sys/dev/ips/ips.c @@ -38,6 +38,8 @@ static d_close_t ips_close; static d_ioctl_t ips_ioctl; static struct cdevsw ips_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ips_open, .d_close = ips_close, .d_ioctl = ips_ioctl, diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c index e7526ab94207..460d43001468 100644 --- a/sys/dev/isp/isp_freebsd.c +++ b/sys/dev/isp/isp_freebsd.c @@ -53,6 +53,8 @@ static void isp_action(struct cam_sim *, union ccb *); static struct cdevsw isp_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = ispioctl, .d_name = "isp", }; diff --git a/sys/dev/joy/joy.c b/sys/dev/joy/joy.c index 2ef286bebef9..4746e77b49a0 100644 --- a/sys/dev/joy/joy.c +++ b/sys/dev/joy/joy.c @@ -69,6 +69,8 @@ static d_read_t joyread; static d_ioctl_t joyioctl; static struct cdevsw joy_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = joyopen, .d_close = joyclose, .d_read = joyread, diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c index e7a67db70957..485ce709d6b8 100644 --- a/sys/dev/kbd/kbd.c +++ b/sys/dev/kbd/kbd.c @@ -433,6 +433,8 @@ static d_poll_t genkbdpoll; static struct cdevsw kbd_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = genkbdopen, .d_close = genkbdclose, .d_read = genkbdread, diff --git a/sys/dev/led/led.c b/sys/dev/led/led.c index 77c68efe9ca6..7177547c39d0 100644 --- a/sys/dev/led/led.c +++ b/sys/dev/led/led.c @@ -211,6 +211,8 @@ led_write(dev_t dev, struct uio *uio, int ioflag) } static struct cdevsw led_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_write = led_write, .d_name = "LED", }; diff --git a/sys/dev/matcd/matcd.c b/sys/dev/matcd/matcd.c index bc57012c93dc..9e28d25c7013 100644 --- a/sys/dev/matcd/matcd.c +++ b/sys/dev/matcd/matcd.c @@ -740,6 +740,7 @@ static int matcd_pitch(int ldrive, int cdrive, int controller, ---------------------------------------------------------------------------*/ static struct cdevsw matcd_cdevsw = { + .d_version = D_VERSION, .d_open = matcdopen, /* open */ .d_close = matcdclose, /* close */ .d_read = physread, /* read */ @@ -750,7 +751,7 @@ static struct cdevsw matcd_cdevsw = { .d_strategy = matcdstrategy, /* strategy */ .d_name = "matcd", /* name */ .d_maj = RAW_DEVICE, /* maj */ - .d_flags = D_DISK, /* flags */ + .d_flags = D_DISK | D_NEEDGIANT, }; diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c index 285d57dcbf24..ebc233e89002 100644 --- a/sys/dev/mcd/mcd.c +++ b/sys/dev/mcd/mcd.c @@ -160,15 +160,15 @@ static d_close_t mcdclose; static d_ioctl_t mcdioctl; static d_strategy_t mcdstrategy; - static struct cdevsw mcd_cdevsw = { + .d_version = D_VERSION, .d_open = mcdopen, .d_close = mcdclose, .d_read = physread, .d_ioctl = mcdioctl, .d_strategy = mcdstrategy, .d_name = "mcd", - .d_flags = D_DISK, + .d_flags = D_DISK | D_NEEDGIANT, }; #define MCD_RETRYS 5 diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index b0f179504d83..9b68ce291148 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -116,6 +116,8 @@ static dev_t status_dev = 0; static d_ioctl_t mdctlioctl; static struct cdevsw mdctl_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = mdctlioctl, .d_name = MD_NAME, }; diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c index bf9412c1e989..67d1b2b49f80 100644 --- a/sys/dev/mlx/mlx.c +++ b/sys/dev/mlx/mlx.c @@ -53,8 +53,9 @@ #include #include - static struct cdevsw mlx_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = mlx_open, .d_close = mlx_close, .d_ioctl = mlx_ioctl, diff --git a/sys/dev/mly/mly.c b/sys/dev/mly/mly.c index 6dacf2778fd7..5f4c1eca06bb 100644 --- a/sys/dev/mly/mly.c +++ b/sys/dev/mly/mly.c @@ -149,8 +149,9 @@ static driver_t mly_pci_driver = { static devclass_t mly_devclass; DRIVER_MODULE(mly, pci, mly_pci_driver, mly_devclass, 0, 0); - static struct cdevsw mly_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = mly_user_open, .d_close = mly_user_close, .d_ioctl = mly_user_ioctl, diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c index b2c821b59154..8cd40f1bbd03 100644 --- a/sys/dev/mse/mse.c +++ b/sys/dev/mse/mse.c @@ -140,6 +140,8 @@ static d_ioctl_t mseioctl; static d_poll_t msepoll; static struct cdevsw mse_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = mseopen, .d_close = mseclose, .d_read = mseread, diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c index 27625068a08a..22b9b51fb768 100644 --- a/sys/dev/nmdm/nmdm.c +++ b/sys/dev/nmdm/nmdm.c @@ -72,13 +72,14 @@ static d_write_t nmdmwrite; static d_ioctl_t nmdmioctl; static struct cdevsw nmdm_cdevsw = { + .d_version = D_VERSION, .d_open = nmdmopen, .d_close = nmdmclose, .d_read = nmdmread, .d_write = nmdmwrite, .d_ioctl = nmdmioctl, - .d_name = "nmdm", - .d_flags = D_TTY | D_PSEUDO, + .d_name = "nmdn", + .d_flags = D_TTY | D_PSEUDO | D_NEEDGIANT, }; #define BUFSIZ 100 /* Chunk size iomoved to/from user */ diff --git a/sys/dev/null/null.c b/sys/dev/null/null.c index 84dae3010ddf..314f460fe544 100644 --- a/sys/dev/null/null.c +++ b/sys/dev/null/null.c @@ -52,20 +52,21 @@ static d_read_t zero_read; #define ZERO_MINOR 12 static struct cdevsw null_cdevsw = { + .d_version = D_VERSION, .d_read = (d_read_t *)nullop, .d_write = null_write, .d_ioctl = null_ioctl, .d_name = "null", .d_maj = CDEV_MAJOR, - .d_flags = D_NOGIANT, }; static struct cdevsw zero_cdevsw = { + .d_version = D_VERSION, .d_read = zero_read, .d_write = null_write, .d_name = "zero", .d_maj = CDEV_MAJOR, - .d_flags = D_MMAP_ANON | D_NOGIANT, + .d_flags = D_MMAP_ANON, }; static void *zbuf; diff --git a/sys/dev/ofw/ofw_console.c b/sys/dev/ofw/ofw_console.c index dd5537661e5e..506b894aeacf 100644 --- a/sys/dev/ofw/ofw_console.c +++ b/sys/dev/ofw/ofw_console.c @@ -51,13 +51,13 @@ static d_open_t ofw_dev_open; static d_close_t ofw_dev_close; static d_ioctl_t ofw_dev_ioctl; - static struct cdevsw ofw_cdevsw = { + .d_version = D_VERSION, .d_open = ofw_dev_open, .d_close = ofw_dev_close, .d_ioctl = ofw_dev_ioctl, .d_name = "ofw", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static struct tty *ofw_tp = NULL; diff --git a/sys/dev/ofw/openfirmio.c b/sys/dev/ofw/openfirmio.c index 37f10b5202a9..8d8302249c9f 100644 --- a/sys/dev/ofw/openfirmio.c +++ b/sys/dev/ofw/openfirmio.c @@ -67,6 +67,8 @@ static d_ioctl_t openfirm_ioctl; #define OPENFIRM_MINOR 0 static struct cdevsw openfirm_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = openfirm_ioctl, .d_name = "openfirm", }; diff --git a/sys/dev/ofw/openpromio.c b/sys/dev/ofw/openpromio.c index d4c98518b4ab..5bf5e698d1c6 100644 --- a/sys/dev/ofw/openpromio.c +++ b/sys/dev/ofw/openpromio.c @@ -58,6 +58,8 @@ static int openprom_node_valid(phandle_t node); static int openprom_node_search(phandle_t root, phandle_t node); static struct cdevsw openprom_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = openprom_open, .d_close = openprom_close, .d_ioctl = openprom_ioctl, diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index 3c279781ed54..0ce8da9e3f4e 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -74,6 +74,8 @@ static d_ioctl_t pci_ioctl; #endif struct cdevsw pcicdev = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = pci_open, .d_close = pci_close, .d_ioctl = pci_ioctl, diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c index 687e7ade284f..f0bdea72e3d0 100644 --- a/sys/dev/ppbus/lpt.c +++ b/sys/dev/ppbus/lpt.c @@ -190,6 +190,8 @@ static d_read_t lptread; static d_ioctl_t lptioctl; static struct cdevsw lpt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = lptopen, .d_close = lptclose, .d_read = lptread, diff --git a/sys/dev/ppbus/pcfclock.c b/sys/dev/ppbus/pcfclock.c index bf0a01d64430..fd4c010d66f2 100644 --- a/sys/dev/ppbus/pcfclock.c +++ b/sys/dev/ppbus/pcfclock.c @@ -68,6 +68,8 @@ static d_close_t pcfclock_close; static d_read_t pcfclock_read; static struct cdevsw pcfclock_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = pcfclock_open, .d_close = pcfclock_close, .d_read = pcfclock_read, diff --git a/sys/dev/ppbus/ppi.c b/sys/dev/ppbus/ppi.c index c2783a66ea71..7df5851ca03a 100644 --- a/sys/dev/ppbus/ppi.c +++ b/sys/dev/ppbus/ppi.c @@ -91,6 +91,8 @@ static d_write_t ppiwrite; static d_read_t ppiread; static struct cdevsw ppi_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ppiopen, .d_close = ppiclose, .d_read = ppiread, diff --git a/sys/dev/ppbus/pps.c b/sys/dev/ppbus/pps.c index e7e1373ed3cd..20a8b02e7054 100644 --- a/sys/dev/ppbus/pps.c +++ b/sys/dev/ppbus/pps.c @@ -63,6 +63,8 @@ static d_close_t ppsclose; static d_ioctl_t ppsioctl; static struct cdevsw pps_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ppsopen, .d_close = ppsclose, .d_ioctl = ppsioctl, diff --git a/sys/dev/raidframe/rf_freebsdkintf.c b/sys/dev/raidframe/rf_freebsdkintf.c index 78490f8266f3..0dfc43623e01 100644 --- a/sys/dev/raidframe/rf_freebsdkintf.c +++ b/sys/dev/raidframe/rf_freebsdkintf.c @@ -215,6 +215,8 @@ d_close_t raidctlclose; d_ioctl_t raidctlioctl; static struct cdevsw raidctl_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = raidctlopen, .d_close = raidctlclose, .d_ioctl = raidctlioctl, diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c index d0e272eea48b..bc5f1666b1ad 100644 --- a/sys/dev/random/randomdev.c +++ b/sys/dev/random/randomdev.c @@ -64,6 +64,8 @@ static d_poll_t random_poll; #define RANDOM_FIFO_MAX 256 /* How many events to queue up */ static struct cdevsw random_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_close = random_close, .d_read = random_read, .d_write = random_write, diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index e519177db935..b7a8e12298f5 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -147,11 +147,12 @@ static d_close_t rcclose; static d_ioctl_t rcioctl; static struct cdevsw rc_cdevsw = { + .d_version = D_VERSION, .d_open = rcopen, .d_close = rcclose, .d_ioctl = rcioctl, .d_name = "rc", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static devclass_t rc_devclass; diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c index 1088de23496f..3f9f49f33ac8 100644 --- a/sys/dev/rp/rp.c +++ b/sys/dev/rp/rp.c @@ -572,12 +572,13 @@ static d_write_t rpwrite; static d_ioctl_t rpioctl; struct cdevsw rp_cdevsw = { + .d_version = D_VERSION, .d_open = rpopen, .d_close = rpclose, .d_write = rpwrite, .d_ioctl = rpioctl, .d_name = "rp", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static int rp_num_ports_open = 0; diff --git a/sys/dev/sab/sab.c b/sys/dev/sab/sab.c index 36b6c1f9c53f..af1bf131278d 100644 --- a/sys/dev/sab/sab.c +++ b/sys/dev/sab/sab.c @@ -161,11 +161,12 @@ static void sabttystop(struct tty *tp, int rw); static int sabttyparam(struct tty *tp, struct termios *t); static struct cdevsw sabtty_cdevsw = { + .d_version = D_VERSION, .d_open = sabttyopen, .d_close = sabttyclose, .d_ioctl = sabttyioctl, .d_name = "sabtty", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static device_method_t sab_methods[] = { diff --git a/sys/dev/scd/scd.c b/sys/dev/scd/scd.c index d455e095902f..2a66a00189c7 100644 --- a/sys/dev/scd/scd.c +++ b/sys/dev/scd/scd.c @@ -147,13 +147,14 @@ static d_strategy_t scdstrategy; static struct cdevsw scd_cdevsw = { + .d_version = D_VERSION, .d_open = scdopen, .d_close = scdclose, .d_read = physread, .d_ioctl = scdioctl, .d_strategy = scdstrategy, .d_name = "scd", - .d_flags = D_DISK, + .d_flags = D_DISK | D_NEEDGIANT, }; int diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index fa0d9dba4f6d..1b76ad07abcc 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -118,12 +118,13 @@ static d_write_t siwrite; static d_ioctl_t siioctl; static struct cdevsw si_cdevsw = { + .d_version = D_VERSION, .d_open = siopen, .d_close = siclose, .d_write = siwrite, .d_ioctl = siioctl, .d_name = "si", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static int si_Nports; diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 42c78b6fd587..93ed290e076d 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -323,13 +323,14 @@ static d_write_t siowrite; static d_ioctl_t sioioctl; static struct cdevsw sio_cdevsw = { + .d_version = D_VERSION, .d_open = sioopen, .d_close = sioclose, .d_read = sioread, .d_write = siowrite, .d_ioctl = sioioctl, .d_name = sio_driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; int comconsole = -1; diff --git a/sys/dev/smbus/smb.c b/sys/dev/smbus/smb.c index 280bda52da49..85ab273b8b6a 100644 --- a/sys/dev/smbus/smb.c +++ b/sys/dev/smbus/smb.c @@ -88,6 +88,8 @@ static d_read_t smbread; static d_ioctl_t smbioctl; static struct cdevsw smb_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = smbopen, .d_close = smbclose, .d_read = smbread, diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index 2c1c3c6fd6ba..543a7242b2b4 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -39,6 +39,8 @@ static d_ioctl_t snpioctl; static d_poll_t snppoll; static struct cdevsw snp_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = snpopen, .d_close = snpclose, .d_read = snpread, diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c index 2da6415dee82..a9d018496bd7 100644 --- a/sys/dev/sound/midi/midi.c +++ b/sys/dev/sound/midi/midi.c @@ -70,6 +70,8 @@ static int midi_readstatus(char *buf, int *ptr, struct uio *uio); #define CDEV_MAJOR MIDI_CDEV_MAJOR static struct cdevsw midi_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = midiopen, .d_close = midiclose, .d_read = midiread, diff --git a/sys/dev/sound/midi/sequencer.c b/sys/dev/sound/midi/sequencer.c index 17c79efaaaf2..bea493616d40 100644 --- a/sys/dev/sound/midi/sequencer.c +++ b/sys/dev/sound/midi/sequencer.c @@ -135,6 +135,8 @@ static d_poll_t seqpoll; #define CDEV_MAJOR SEQ_CDEV_MAJOR static struct cdevsw seq_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = seqopen, .d_close = seqclose, .d_read = seqread, diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index cffbe6bb1640..ac00603b8d48 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -42,6 +42,8 @@ static d_poll_t dsp_poll; static d_mmap_t dsp_mmap; struct cdevsw dsp_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = dsp_open, .d_close = dsp_close, .d_read = dsp_read, diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 61d6c09003f6..b5a67edfc61f 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -73,6 +73,8 @@ static d_open_t mixer_open; static d_close_t mixer_close; static struct cdevsw mixer_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = mixer_open, .d_close = mixer_close, .d_ioctl = mixer_ioctl, diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index 77c63f3eb78b..e96a8025fde5 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -41,6 +41,8 @@ static d_close_t sndstat_close; static d_read_t sndstat_read; static struct cdevsw sndstat_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = sndstat_open, .d_close = sndstat_close, .d_read = sndstat_read, diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index e82ef46c9f40..e73ab8d73324 100644 --- a/sys/dev/speaker/spkr.c +++ b/sys/dev/speaker/spkr.c @@ -34,6 +34,8 @@ static d_write_t spkrwrite; static d_ioctl_t spkrioctl; static struct cdevsw spkr_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = spkropen, .d_close = spkrclose, .d_write = spkrwrite, diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index 8e5ac5713bbd..b67e39b83862 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -102,6 +102,8 @@ static struct fileops svr4_netops = { }; static struct cdevsw streams_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = streamsopen, .d_name = "streams", }; diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index f05de849f341..69ab21ff412e 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -194,8 +194,6 @@ static int update_kbd_state(scr_stat *scp, int state, int mask); static int update_kbd_leds(scr_stat *scp, int which); static timeout_t blink_screen; -#define CDEV_MAJOR 12 - static cn_probe_t sccnprobe; static cn_init_t sccninit; static cn_getc_t sccngetc; @@ -218,14 +216,14 @@ static d_ioctl_t scioctl; static d_mmap_t scmmap; static struct cdevsw sc_cdevsw = { + .d_version = D_VERSION, .d_open = scopen, .d_close = scclose, .d_read = scread, .d_ioctl = scioctl, .d_mmap = scmmap, .d_name = "sc", - .d_maj = CDEV_MAJOR, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; int diff --git a/sys/dev/syscons/sysmouse.c b/sys/dev/syscons/sysmouse.c index 08847a0dad5e..7aa72cffd31c 100644 --- a/sys/dev/syscons/sysmouse.c +++ b/sys/dev/syscons/sysmouse.c @@ -49,11 +49,12 @@ static d_close_t smclose; static d_ioctl_t smioctl; static struct cdevsw sm_cdevsw = { + .d_version = D_VERSION, .d_open = smopen, .d_close = smclose, .d_ioctl = smioctl, .d_name = "sysmouse", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; /* local variables */ diff --git a/sys/dev/tdfx/tdfx_pci.c b/sys/dev/tdfx/tdfx_pci.c index dda1eb5a27eb..ac07d80b27cf 100644 --- a/sys/dev/tdfx/tdfx_pci.c +++ b/sys/dev/tdfx/tdfx_pci.c @@ -104,6 +104,8 @@ LINUX_IOCTL_SET(tdfx, LINUX_IOCTL_TDFX_MIN, LINUX_IOCTL_TDFX_MAX); /* Char. Dev. file operations structure */ static struct cdevsw tdfx_cdev = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = tdfx_open, .d_close = tdfx_close, .d_ioctl = tdfx_ioctl, diff --git a/sys/dev/tga/tga_pci.c b/sys/dev/tga/tga_pci.c index f6f336dfa73c..902b7daea3ae 100644 --- a/sys/dev/tga/tga_pci.c +++ b/sys/dev/tga/tga_pci.c @@ -100,6 +100,8 @@ static struct gfb_type tga_devs[] = { #ifdef FB_INSTALL_CDEV static struct cdevsw tga_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = pcigfb_open, .d_close = pcigfb_close, .d_read = pcigfb_read, diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index 9e8c8f1165e7..b0118d63d982 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -186,6 +186,8 @@ static d_close_t ti_close; static d_ioctl_t ti_ioctl2; static struct cdevsw ti_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ti_open, .d_close = ti_close, .d_ioctl = ti_ioctl2, diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c index 6a3a8ff09db3..32175c13a379 100644 --- a/sys/dev/twe/twe_freebsd.c +++ b/sys/dev/twe/twe_freebsd.c @@ -67,6 +67,8 @@ static d_close_t twe_close; static d_ioctl_t twe_ioctl_wrapper; static struct cdevsw twe_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = twe_open, .d_close = twe_close, .d_ioctl = twe_ioctl_wrapper, diff --git a/sys/dev/uart/uart_tty.c b/sys/dev/uart/uart_tty.c index 66ce71658e25..94ddb953052b 100644 --- a/sys/dev/uart/uart_tty.c +++ b/sys/dev/uart/uart_tty.c @@ -67,11 +67,12 @@ static d_close_t uart_tty_close; static d_ioctl_t uart_tty_ioctl; static struct cdevsw uart_cdevsw = { + .d_version = D_VERSION, .d_open = uart_tty_open, .d_close = uart_tty_close, .d_ioctl = uart_tty_ioctl, .d_name = uart_driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static struct uart_devinfo uart_console; diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index ad0a3d1ec099..4bea235f68a9 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -128,13 +128,14 @@ Static d_ioctl_t ucomioctl; static struct cdevsw ucom_cdevsw = { + .d_version = D_VERSION, .d_open = ucomopen, .d_close = ucomclose, .d_read = ucomread, .d_write = ucomwrite, .d_ioctl = ucomioctl, .d_name = "ucom", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, #if __FreeBSD_version < 500014 .d_bmaj = -1, #endif diff --git a/sys/dev/usb/ufm.c b/sys/dev/usb/ufm.c index 26916f1f4f39..db008ea91eb4 100644 --- a/sys/dev/usb/ufm.c +++ b/sys/dev/usb/ufm.c @@ -89,6 +89,8 @@ d_close_t ufmclose; d_ioctl_t ufmioctl; Static struct cdevsw ufm_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ufmopen, .d_close = ufmclose, .d_ioctl = ufmioctl, diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 408d14b06bdc..a9074235254b 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -151,6 +151,8 @@ d_poll_t ugenpoll; Static struct cdevsw ugen_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ugenopen, .d_close = ugenclose, .d_read = ugenread, diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index ec46474a1c0b..a574d1f0279f 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -156,6 +156,8 @@ d_poll_t uhidpoll; Static struct cdevsw uhid_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = uhidopen, .d_close = uhidclose, .d_read = uhidread, diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 3dadd00633f2..48aeb0956edc 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -147,6 +147,8 @@ Static d_ioctl_t ulptioctl; Static struct cdevsw ulpt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ulptopen, .d_close = ulptclose, .d_write = ulptwrite, diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index 4c0d598045da..2104ee3b1d70 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -154,6 +154,8 @@ Static d_poll_t ums_poll; Static struct cdevsw ums_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ums_open, .d_close = ums_close, .d_read = ums_read, diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index 57979cdf3f38..eaec4e5b1007 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -117,6 +117,8 @@ d_ioctl_t urioioctl; Static struct cdevsw urio_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = urioopen, .d_close = urioclose, .d_read = urioread, diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 6ff8ed3e81e8..44a554449b51 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -146,6 +146,8 @@ d_ioctl_t usbioctl; d_poll_t usbpoll; struct cdevsw usb_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = usbopen, .d_close = usbclose, .d_read = usbread, diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index ab46721c113a..02b8e0e5e786 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -268,6 +268,8 @@ d_poll_t uscannerpoll; Static struct cdevsw uscanner_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = uscanneropen, .d_close = uscannerclose, .d_read = uscannerread, diff --git a/sys/dev/zs/zs.c b/sys/dev/zs/zs.c index c3895a6457f2..5f5ceb88b5af 100644 --- a/sys/dev/zs/zs.c +++ b/sys/dev/zs/zs.c @@ -152,11 +152,12 @@ static void zsttystop(struct tty *tp, int rw); static int zsttyparam(struct tty *tp, struct termios *t); static struct cdevsw zstty_cdevsw = { + .d_version = D_VERSION, .d_open = zsttyopen, .d_close = zsttyclose, .d_ioctl = zsttyioctl, .d_name = "zstty", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static struct zstty_softc *zstty_cons; diff --git a/sys/fs/coda/coda_fbsd.c b/sys/fs/coda/coda_fbsd.c index 1c061b1ae6ef..9dc260c04ee5 100644 --- a/sys/fs/coda/coda_fbsd.c +++ b/sys/fs/coda/coda_fbsd.c @@ -66,6 +66,8 @@ __FBSDID("$FreeBSD$"); #define VC_DEV_NO 93 static struct cdevsw codadevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = vc_nb_open, .d_close = vc_nb_close, .d_read = vc_nb_read, diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c index 31d9bfe9f578..4682b5df6190 100644 --- a/sys/fs/specfs/spec_vnops.c +++ b/sys/fs/specfs/spec_vnops.c @@ -194,7 +194,7 @@ spec_open(ap) vp->v_vflag |= VV_ISTTY; VOP_UNLOCK(vp, 0, td); - if(dsw->d_flags & D_NOGIANT) { + if(!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); if (dsw->d_fdopen != NULL) error = dsw->d_fdopen(dev, ap->a_mode, td, ap->a_fdidx); @@ -267,7 +267,7 @@ spec_read(ap) dsw = devsw(dev); VOP_UNLOCK(vp, 0, td); - if (dsw->d_flags & D_NOGIANT) { + if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); error = dsw->d_read(dev, uio, ap->a_ioflag); PICKUP_GIANT(); @@ -307,7 +307,7 @@ spec_write(ap) resid = uio->uio_resid; VOP_UNLOCK(vp, 0, td); - if (dsw->d_flags & D_NOGIANT) { + if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); error = dsw->d_write(dev, uio, ap->a_ioflag); PICKUP_GIANT(); @@ -342,7 +342,7 @@ spec_ioctl(ap) dev = ap->a_vp->v_rdev; dsw = devsw(dev); - if (dsw->d_flags & D_NOGIANT) { + if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); error = dsw->d_ioctl(dev, ap->a_command, ap->a_data, ap->a_fflag, ap->a_td); @@ -371,7 +371,7 @@ spec_poll(ap) dev = ap->a_vp->v_rdev; dsw = devsw(dev); - if (dsw->d_flags & D_NOGIANT) { + if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); error = dsw->d_poll(dev, ap->a_events, ap->a_td); PICKUP_GIANT(); @@ -394,7 +394,7 @@ spec_kqfilter(ap) dev = ap->a_vp->v_rdev; dsw = devsw(dev); - if (dsw->d_flags & D_NOGIANT) { + if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); error = dsw->d_kqfilter(dev, ap->a_kn); PICKUP_GIANT(); @@ -509,7 +509,7 @@ spec_xstrategy(struct vnode *vp, struct buf *bp) ("No strategy on dev %s responsible for buffer %p\n", devtoname(bp->b_dev), bp)); - if (dsw->d_flags & D_NOGIANT) { + if (!(dsw->d_flags & D_NEEDGIANT)) { /* XXX: notyet DROP_GIANT(); */ DEV_STRATEGY(bp); /* XXX: notyet PICKUP_GIANT(); */ @@ -631,7 +631,7 @@ spec_close(ap) return (0); } VI_UNLOCK(vp); - if (dsw->d_flags & D_NOGIANT) { + if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); error = dsw->d_close(dev, ap->a_fflag, S_IFCHR, td); PICKUP_GIANT(); diff --git a/sys/geom/geom_ctl.c b/sys/geom/geom_ctl.c index 43a03135cd30..3e50eb350889 100644 --- a/sys/geom/geom_ctl.c +++ b/sys/geom/geom_ctl.c @@ -65,6 +65,8 @@ __FBSDID("$FreeBSD$"); static d_ioctl_t g_ctl_ioctl; static struct cdevsw g_ctl_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = g_ctl_ioctl, .d_name = "g_ctl", }; diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c index 97abc2a893d9..9ad3f70b0f0e 100644 --- a/sys/geom/geom_dev.c +++ b/sys/geom/geom_dev.c @@ -58,6 +58,7 @@ static d_strategy_t g_dev_strategy; static d_ioctl_t g_dev_ioctl; static struct cdevsw g_dev_cdevsw = { + .d_version = D_VERSION, .d_open = g_dev_open, .d_close = g_dev_close, .d_read = physread, @@ -66,7 +67,7 @@ static struct cdevsw g_dev_cdevsw = { .d_strategy = g_dev_strategy, .d_name = "g_dev", .d_maj = GEOM_MAJOR, - .d_flags = D_DISK | D_TRACKCLOSE | D_NOGIANT, + .d_flags = D_DISK | D_TRACKCLOSE, }; static g_taste_t g_dev_taste; diff --git a/sys/i386/acpica/acpi_machdep.c b/sys/i386/acpica/acpi_machdep.c index a6c186a9a610..5d4f0a4eb400 100644 --- a/sys/i386/acpica/acpi_machdep.c +++ b/sys/i386/acpica/acpi_machdep.c @@ -73,6 +73,8 @@ static d_ioctl_t apmioctl; static d_poll_t apmpoll; static struct cdevsw apm_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = apmopen, .d_close = apmclose, .d_write = apmwrite, diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index 1e2371fef54a..6145d9f71e98 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -108,6 +108,8 @@ static d_ioctl_t apmioctl; static d_poll_t apmpoll; static struct cdevsw apm_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = apmopen, .d_close = apmclose, .d_write = apmwrite, diff --git a/sys/i386/bios/smapi.c b/sys/i386/bios/smapi.c index 200bcfc760fb..3e9aab8189f7 100644 --- a/sys/i386/bios/smapi.c +++ b/sys/i386/bios/smapi.c @@ -75,9 +75,10 @@ devclass_t smapi_devclass; static d_ioctl_t smapi_ioctl; static struct cdevsw smapi_cdevsw = { + .d_version = D_VERSION, .d_ioctl = smapi_ioctl, .d_name = "smapi", - .d_flags = D_MEM, + .d_flags = D_MEM | D_NEEDGIANT, }; static void smapi_identify (driver_t *, device_t); diff --git a/sys/i386/i386/elan-mmcr.c b/sys/i386/i386/elan-mmcr.c index 9e3de8f5ef41..80d8759b3cce 100644 --- a/sys/i386/i386/elan-mmcr.c +++ b/sys/i386/i386/elan-mmcr.c @@ -327,6 +327,8 @@ static d_ioctl_t elan_ioctl; static d_mmap_t elan_mmap; static struct cdevsw elan_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = elan_ioctl, .d_mmap = elan_mmap, .d_name = "elan", diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index 85011671e288..342ced5fad7e 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -80,6 +80,7 @@ static d_mmap_t memmmap; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { + .d_version = D_VERSION, .d_open = mmopen, .d_close = mmclose, .d_read = mmrw, @@ -88,7 +89,7 @@ static struct cdevsw mem_cdevsw = { .d_mmap = memmmap, .d_name = "mem", .d_maj = CDEV_MAJOR, - .d_flags = D_MEM, + .d_flags = D_MEM | D_NEEDGIANT, }; MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); diff --git a/sys/i386/i386/perfmon.c b/sys/i386/i386/perfmon.c index 3b765f49223a..eaccb5a6ba1b 100644 --- a/sys/i386/i386/perfmon.c +++ b/sys/i386/i386/perfmon.c @@ -72,6 +72,8 @@ static void perfmon_init_dev(void *); SYSINIT(cpu, SI_SUB_DRIVERS, SI_ORDER_ANY, perfmon_init_dev, NULL); static struct cdevsw perfmon_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = perfmon_open, .d_close = perfmon_close, .d_ioctl = perfmon_ioctl, diff --git a/sys/i386/isa/asc.c b/sys/i386/isa/asc.c index 8aff8c105f62..140ae5a060e1 100644 --- a/sys/i386/isa/asc.c +++ b/sys/i386/isa/asc.c @@ -197,6 +197,8 @@ static d_poll_t ascpoll; static struct cdevsw asc_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ascopen, .d_close = ascclose, .d_read = ascread, diff --git a/sys/i386/isa/ctx.c b/sys/i386/isa/ctx.c index 28adedc60f48..5d18a7beed9e 100644 --- a/sys/i386/isa/ctx.c +++ b/sys/i386/isa/ctx.c @@ -143,6 +143,8 @@ static d_write_t ctxwrite; static d_ioctl_t ctxioctl; static struct cdevsw ctx_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ctxopen, .d_close = ctxclose, .d_read = ctxread, diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c index 2a715c03046b..7207846b6380 100644 --- a/sys/i386/isa/cy.c +++ b/sys/i386/isa/cy.c @@ -386,12 +386,13 @@ static d_write_t siowrite; static d_ioctl_t sioioctl; static struct cdevsw sio_cdevsw = { + .d_version = D_VERSION, .d_open = sioopen, .d_close = sioclose, .d_write = siowrite, .d_ioctl = sioioctl, .d_name = driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static int comconsole = -1; diff --git a/sys/i386/isa/gpib.c b/sys/i386/isa/gpib.c index 480448a14071..0a653fe1c239 100644 --- a/sys/i386/isa/gpib.c +++ b/sys/i386/isa/gpib.c @@ -73,6 +73,8 @@ static d_write_t gpwrite; static d_ioctl_t gpioctl; static struct cdevsw gp_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = gpopen, .d_close = gpclose, .d_write = gpwrite, diff --git a/sys/i386/isa/gsc.c b/sys/i386/isa/gsc.c index d4dff76327a8..6cd11227914e 100644 --- a/sys/i386/isa/gsc.c +++ b/sys/i386/isa/gsc.c @@ -192,6 +192,8 @@ static d_read_t gscread; static d_ioctl_t gscioctl; static struct cdevsw gsc_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = gscopen, .d_close = gscclose, .d_read = gscread, diff --git a/sys/i386/isa/istallion.c b/sys/i386/isa/istallion.c index ee82892b6f14..f6f10b180eb4 100644 --- a/sys/i386/isa/istallion.c +++ b/sys/i386/isa/istallion.c @@ -643,13 +643,14 @@ COMPAT_ISA_DRIVER(stli, stlidriver); */ static struct cdevsw stli_cdevsw = { + .d_version = D_VERSION, .d_open = stliopen, .d_close = stliclose, .d_read = stliread, .d_write = stliwrite, .d_ioctl = stliioctl, .d_name = stli_drvname, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; #endif diff --git a/sys/i386/isa/mse.c b/sys/i386/isa/mse.c index b2c821b59154..8cd40f1bbd03 100644 --- a/sys/i386/isa/mse.c +++ b/sys/i386/isa/mse.c @@ -140,6 +140,8 @@ static d_ioctl_t mseioctl; static d_poll_t msepoll; static struct cdevsw mse_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = mseopen, .d_close = mseclose, .d_read = mseread, diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c index af16af93b75c..0b4fdc04d0fd 100644 --- a/sys/i386/isa/pcvt/pcvt_drv.c +++ b/sys/i386/isa/pcvt/pcvt_drv.c @@ -93,14 +93,14 @@ static d_close_t pcvt_close; static d_ioctl_t pcvt_ioctl; static d_mmap_t pcvt_mmap; - static struct cdevsw vt_cdevsw = { + .d_version = D_VERSION, .d_open = pcvt_open, .d_close = pcvt_close, .d_ioctl = pcvt_ioctl, .d_mmap = pcvt_mmap, .d_name = "vt", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static int pcvt_probe(device_t dev); diff --git a/sys/i386/isa/spic.c b/sys/i386/isa/spic.c index e73b8b6dbc05..a649f13e1003 100644 --- a/sys/i386/isa/spic.c +++ b/sys/i386/isa/spic.c @@ -85,6 +85,8 @@ static d_ioctl_t spicioctl; static d_poll_t spicpoll; static struct cdevsw spic_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = spicopen, .d_close = spicclose, .d_read = spicread, diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c index dd23abd690d2..b94233a92a2a 100644 --- a/sys/i386/isa/spigot.c +++ b/sys/i386/isa/spigot.c @@ -105,6 +105,8 @@ static d_ioctl_t spigot_ioctl; static d_mmap_t spigot_mmap; static struct cdevsw spigot_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = spigot_open, .d_close = spigot_close, .d_read = spigot_read, diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c index e82ef46c9f40..e73ab8d73324 100644 --- a/sys/i386/isa/spkr.c +++ b/sys/i386/isa/spkr.c @@ -34,6 +34,8 @@ static d_write_t spkrwrite; static d_ioctl_t spkrioctl; static struct cdevsw spkr_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = spkropen, .d_close = spkrclose, .d_write = spkrwrite, diff --git a/sys/i386/isa/stallion.c b/sys/i386/isa/stallion.c index de0b2ccc9301..9a99f74aec03 100644 --- a/sys/i386/isa/stallion.c +++ b/sys/i386/isa/stallion.c @@ -537,11 +537,12 @@ COMPAT_PCI_DRIVER (stlpci, stlpcidriver); */ static struct cdevsw stl_cdevsw = { + .d_version = D_VERSION, .d_open = stlopen, .d_close = stlclose, .d_ioctl = stlioctl, .d_name = "stl", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; #endif diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c index 941fc082f403..9ca1e2535d15 100644 --- a/sys/i386/isa/wt.c +++ b/sys/i386/isa/wt.c @@ -186,6 +186,8 @@ static d_strategy_t wtstrategy; static struct cdevsw wt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = wtopen, .d_close = wtclose, .d_read = physread, diff --git a/sys/i4b/driver/i4b_ctl.c b/sys/i4b/driver/i4b_ctl.c index 79cd1ab57fa6..630c064f537a 100644 --- a/sys/i4b/driver/i4b_ctl.c +++ b/sys/i4b/driver/i4b_ctl.c @@ -58,6 +58,8 @@ static d_poll_t i4bctlpoll; static struct cdevsw i4bctl_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = i4bctlopen, .d_close = i4bctlclose, .d_ioctl = i4bctlioctl, diff --git a/sys/i4b/driver/i4b_rbch.c b/sys/i4b/driver/i4b_rbch.c index f632186d4c28..5738335e3ddb 100644 --- a/sys/i4b/driver/i4b_rbch.c +++ b/sys/i4b/driver/i4b_rbch.c @@ -112,6 +112,8 @@ static d_poll_t i4brbchpoll; static struct cdevsw i4brbch_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = i4brbchopen, .d_close = i4brbchclose, .d_read = i4brbchread, diff --git a/sys/i4b/driver/i4b_tel.c b/sys/i4b/driver/i4b_tel.c index 5acce731a376..703bfc1688b2 100644 --- a/sys/i4b/driver/i4b_tel.c +++ b/sys/i4b/driver/i4b_tel.c @@ -134,6 +134,8 @@ static d_poll_t i4btelpoll; static struct cdevsw i4btel_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = i4btelopen, .d_close = i4btelclose, .d_read = i4btelread, diff --git a/sys/i4b/driver/i4b_trace.c b/sys/i4b/driver/i4b_trace.c index 348c6dd49b22..c5c3832d116a 100644 --- a/sys/i4b/driver/i4b_trace.c +++ b/sys/i4b/driver/i4b_trace.c @@ -75,6 +75,8 @@ static d_poll_t i4btrcpoll; static struct cdevsw i4btrc_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = i4btrcopen, .d_close = i4btrcclose, .d_read = i4btrcread, diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c index 42330efdc729..7b19aec6a460 100644 --- a/sys/i4b/layer4/i4b_i4bdrv.c +++ b/sys/i4b/layer4/i4b_i4bdrv.c @@ -78,6 +78,8 @@ static d_poll_t i4bpoll; static struct cdevsw i4b_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = i4bopen, .d_close = i4bclose, .d_read = i4bread, diff --git a/sys/ia64/ia64/mem.c b/sys/ia64/ia64/mem.c index a904172bb14c..c1a2872fb497 100644 --- a/sys/ia64/ia64/mem.c +++ b/sys/ia64/ia64/mem.c @@ -82,6 +82,7 @@ static d_mmap_t memmmap; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { + .d_version = D_VERSION, .d_open = mmopen, .d_close = mmclose, .d_read = mmrw, @@ -90,7 +91,7 @@ static struct cdevsw mem_cdevsw = { .d_mmap = memmmap, .d_name = "mem", .d_maj = CDEV_MAJOR, - .d_flags = D_MEM, + .d_flags = D_MEM | D_NEEDGIANT, }; struct mem_range_softc mem_range_softc; diff --git a/sys/ia64/ia64/ssc.c b/sys/ia64/ia64/ssc.c index 1f21be121773..68f4727efe42 100644 --- a/sys/ia64/ia64/ssc.c +++ b/sys/ia64/ia64/ssc.c @@ -58,11 +58,12 @@ static d_close_t sscclose; static d_ioctl_t sscioctl; static struct cdevsw ssc_cdevsw = { + .d_version = D_VERSION, .d_open = sscopen, .d_close = sscclose, .d_ioctl = sscioctl, .d_name = "ssc", - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static struct tty *ssc_tp = NULL; diff --git a/sys/isa/fd.c b/sys/isa/fd.c index 5a506334d5c4..808c537e3f0f 100644 --- a/sys/isa/fd.c +++ b/sys/isa/fd.c @@ -482,6 +482,7 @@ fdin_rd(fdc_p fdc) } static struct cdevsw fd_cdevsw = { + .d_version = D_VERSION, .d_open = fdopen, .d_close = fdclose, .d_read = physread, @@ -489,7 +490,7 @@ static struct cdevsw fd_cdevsw = { .d_ioctl = fdioctl, .d_strategy = fdstrategy, .d_name = "fd", - .d_flags = D_DISK, + .d_flags = D_DISK | D_NEEDGIANT, }; /* diff --git a/sys/isa/psm.c b/sys/isa/psm.c index e886e8cc9e4b..dd2fd7e2cc89 100644 --- a/sys/isa/psm.c +++ b/sys/isa/psm.c @@ -348,6 +348,8 @@ static driver_t psm_driver = { static struct cdevsw psm_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = psmopen, .d_close = psmclose, .d_read = psmread, diff --git a/sys/isa/vga_isa.c b/sys/isa/vga_isa.c index c820be21ce55..ce330f8ec919 100644 --- a/sys/isa/vga_isa.c +++ b/sys/isa/vga_isa.c @@ -72,6 +72,8 @@ static d_ioctl_t isavga_ioctl; static d_mmap_t isavga_mmap; static struct cdevsw isavga_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = isavga_open, .d_close = isavga_close, .d_read = isavga_read, diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 19592ad56017..85f5ba27ec42 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -115,6 +115,8 @@ dead_strategy(struct bio *bp) #define dead_kqfilter (d_kqfilter_t *)enxio static struct cdevsw dead_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, /* XXX: does dead_strategy need this ? */ .d_open = dead_open, .d_close = dead_close, .d_read = dead_read, diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index c5e005bc2a15..3b534730e108 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -87,6 +87,8 @@ static d_open_t fdopen; #define CDEV_MAJOR 22 static struct cdevsw fildesc_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = fdopen, .d_name = "FD", .d_maj = CDEV_MAJOR, diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 092f410d4d0f..4f2f836414a2 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -220,6 +220,8 @@ static d_poll_t devpoll; #define CDEV_MAJOR 173 static struct cdevsw dev_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = devopen, .d_close = devclose, .d_read = devread, diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c index f33aeb03d40f..04abe89494c3 100644 --- a/sys/kern/subr_devstat.c +++ b/sys/kern/subr_devstat.c @@ -437,6 +437,8 @@ SYSCTL_INT(_kern_devstat, OID_AUTO, version, CTLFLAG_RD, static d_mmap_t devstat_mmap; static struct cdevsw devstat_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_mmap = devstat_mmap, .d_name = "devstat", }; diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index b2ece2d3e9e7..48b4d58178a3 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -69,6 +69,8 @@ static void logtimeout(void *arg); #define CDEV_MAJOR 7 static struct cdevsw log_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = logopen, .d_close = logclose, .d_read = logread, diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index 272cc4aed4bf..5791978e21ba 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -78,6 +78,7 @@ static d_kqfilter_t cnkqfilter; * XXX: kern_conf.c knows what to do when it sees 256. */ static struct cdevsw cn_cdevsw = { + .d_version = D_VERSION, .d_open = cnopen, .d_close = cnclose, .d_read = cnread, @@ -86,7 +87,7 @@ static struct cdevsw cn_cdevsw = { .d_poll = cnpoll, .d_name = "console", .d_maj = 256, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, .d_kqfilter = cnkqfilter, }; diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index ab3ef5dbf1e4..5648e7218836 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -80,6 +80,7 @@ static d_poll_t ptcpoll; #define CDEV_MAJOR_S 5 static struct cdevsw pts_cdevsw = { + .d_version = D_VERSION, .d_open = ptsopen, .d_close = ptsclose, .d_read = ptsread, @@ -87,11 +88,12 @@ static struct cdevsw pts_cdevsw = { .d_ioctl = ptyioctl, .d_name = "pts", .d_maj = CDEV_MAJOR_S, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; #define CDEV_MAJOR_C 6 static struct cdevsw ptc_cdevsw = { + .d_version = D_VERSION, .d_open = ptcopen, .d_close = ptcclose, .d_read = ptcread, @@ -100,7 +102,7 @@ static struct cdevsw ptc_cdevsw = { .d_poll = ptcpoll, .d_name = "ptc", .d_maj = CDEV_MAJOR_C, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; #define BUFSIZ 100 /* Chunk size iomoved to/from user */ diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index 985a87750a71..96fa84ba27fb 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -38,10 +38,11 @@ static d_open_t cttyopen; #define CDEV_MAJOR 1 static struct cdevsw ctty_cdevsw = { + .d_version = D_VERSION, .d_open = cttyopen, .d_name = "ctty", .d_maj = CDEV_MAJOR, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; static dev_t ctty; diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 9a8d35a9e83d..a24cce97ac4b 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -127,6 +127,8 @@ static d_poll_t bpfpoll; static d_kqfilter_t bpfkqfilter; static struct cdevsw bpf_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = bpfopen, .d_close = bpfclose, .d_read = bpfread, diff --git a/sys/net/if.c b/sys/net/if.c index 303166181136..8cea0c4fe5d4 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -134,6 +134,8 @@ static d_ioctl_t netioctl; static d_kqfilter_t netkqfilter; static struct cdevsw net_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = netopen, .d_close = netclose, .d_ioctl = netioctl, diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index f83243b39998..c7d380ec1c40 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -97,6 +97,8 @@ static d_ioctl_t tapioctl; static d_poll_t tappoll; static struct cdevsw tap_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = tapopen, .d_close = tapclose, .d_read = tapread, diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 4a64da456072..3c297c6a13a4 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -104,6 +104,8 @@ static d_ioctl_t tunioctl; static d_poll_t tunpoll; static struct cdevsw tun_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = tunopen, .d_close = tunclose, .d_read = tunread, diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c index e353caf007fa..1e2013247fc3 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c @@ -226,6 +226,8 @@ Static void ubt_create_device_nodes (ubt_softc_p); Static void ubt_destroy_device_nodes (ubt_softc_p); Static struct cdevsw ubt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ubt_open, .d_close = ubt_close, .d_read = ubt_read, diff --git a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c index 44e763fe73a8..7f6b6c16d852 100644 --- a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c +++ b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c @@ -92,6 +92,8 @@ Static d_ioctl_t ubtbcmfw_ioctl; Static d_poll_t ubtbcmfw_poll; Static struct cdevsw ubtbcmfw_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ubtbcmfw_open, .d_close = ubtbcmfw_close, .d_read = ubtbcmfw_read, diff --git a/sys/netgraph/ng_device.c b/sys/netgraph/ng_device.c index ae3237fa33da..7bd1ed0be6b0 100644 --- a/sys/netgraph/ng_device.c +++ b/sys/netgraph/ng_device.c @@ -113,6 +113,8 @@ static d_ioctl_t ngdioctl; static d_poll_t ngdpoll; static struct cdevsw ngd_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ngdopen, .d_close = ngdclose, .d_read = ngdread, diff --git a/sys/netncp/ncp_mod.c b/sys/netncp/ncp_mod.c index e56495d6a2c8..6594b52e5a5b 100644 --- a/sys/netncp/ncp_mod.c +++ b/sys/netncp/ncp_mod.c @@ -66,6 +66,8 @@ static dev_t ncp_dev; static d_ioctl_t ncp_ioctl; static struct cdevsw ncp_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_ioctl = ncp_ioctl, .d_name = "ncp", }; diff --git a/sys/netsmb/smb_dev.c b/sys/netsmb/smb_dev.c index debf080ff58e..258a37a9cdc5 100644 --- a/sys/netsmb/smb_dev.c +++ b/sys/netsmb/smb_dev.c @@ -87,6 +87,8 @@ int smb_dev_queue(struct smb_dev *ndp, struct smb_rq *rqp, int prio); */ static struct cdevsw nsmb_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = nsmb_dev_open, .d_close = nsmb_dev_close, .d_ioctl = nsmb_dev_ioctl, diff --git a/sys/nfs4client/nfs4_dev.c b/sys/nfs4client/nfs4_dev.c index f9a84d879031..4a318e2fb5fc 100644 --- a/sys/nfs4client/nfs4_dev.c +++ b/sys/nfs4client/nfs4_dev.c @@ -94,6 +94,8 @@ static d_ioctl_t nfs4dev_ioctl; static d_poll_t nfs4dev_poll; static struct cdevsw nfs4dev_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = nfs4dev_open, .d_close = nfs4dev_close, .d_ioctl = nfs4dev_ioctl, diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 1d2398f1a31f..4ad2797c1a8c 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -765,6 +765,8 @@ cryptoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) #define CRYPTO_MAJOR 70 /* from openbsd */ static struct cdevsw crypto_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = cryptoopen, .d_read = cryptoread, .d_write = cryptowrite, diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c index a2ebaa4ce381..df37273b74c0 100644 --- a/sys/pc98/cbus/fdc.c +++ b/sys/pc98/cbus/fdc.c @@ -623,6 +623,7 @@ fdin_rd(fdc_p fdc) #endif /* PC98 */ static struct cdevsw fd_cdevsw = { + .d_version = D_VERSION, .d_open = fdopen, .d_close = fdclose, .d_read = physread, @@ -630,7 +631,7 @@ static struct cdevsw fd_cdevsw = { .d_ioctl = fdioctl, .d_strategy = fdstrategy, .d_name = "fd", - .d_flags = D_DISK, + .d_flags = D_DISK | D_NEEDGIANT, }; /* diff --git a/sys/pc98/cbus/gdc.c b/sys/pc98/cbus/gdc.c index 5a232829c604..0307f6cf8ae2 100644 --- a/sys/pc98/cbus/gdc.c +++ b/sys/pc98/cbus/gdc.c @@ -102,6 +102,8 @@ static d_ioctl_t gdcioctl; static d_mmap_t gdcmmap; static struct cdevsw gdc_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = gdcopen, .d_close = gdcclose, .d_read = gdcread, diff --git a/sys/pc98/cbus/olpt.c b/sys/pc98/cbus/olpt.c index f17604617487..0ebd84c479ce 100644 --- a/sys/pc98/cbus/olpt.c +++ b/sys/pc98/cbus/olpt.c @@ -230,6 +230,8 @@ static d_write_t lptwrite; static d_ioctl_t lptioctl; static struct cdevsw lpt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = lptopen, .d_close = lptclose, .d_write = lptwrite, diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index 3c309c00a7ea..39269ea261b5 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -416,13 +416,14 @@ static d_write_t siowrite; static d_ioctl_t sioioctl; static struct cdevsw sio_cdevsw = { + .d_version = D_VERSION, .d_open = sioopen, .d_close = sioclose, .d_read = sioread, .d_write = siowrite, .d_ioctl = sioioctl, .d_name = sio_driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; int comconsole = -1; diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c index a2ebaa4ce381..df37273b74c0 100644 --- a/sys/pc98/pc98/fd.c +++ b/sys/pc98/pc98/fd.c @@ -623,6 +623,7 @@ fdin_rd(fdc_p fdc) #endif /* PC98 */ static struct cdevsw fd_cdevsw = { + .d_version = D_VERSION, .d_open = fdopen, .d_close = fdclose, .d_read = physread, @@ -630,7 +631,7 @@ static struct cdevsw fd_cdevsw = { .d_ioctl = fdioctl, .d_strategy = fdstrategy, .d_name = "fd", - .d_flags = D_DISK, + .d_flags = D_DISK | D_NEEDGIANT, }; /* diff --git a/sys/pc98/pc98/mse.c b/sys/pc98/pc98/mse.c index cc439a0b17ff..4ddeb63b8d9b 100644 --- a/sys/pc98/pc98/mse.c +++ b/sys/pc98/pc98/mse.c @@ -137,6 +137,8 @@ static d_ioctl_t mseioctl; static d_poll_t msepoll; static struct cdevsw mse_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = mseopen, .d_close = mseclose, .d_read = mseread, diff --git a/sys/pc98/pc98/olpt.c b/sys/pc98/pc98/olpt.c index f17604617487..0ebd84c479ce 100644 --- a/sys/pc98/pc98/olpt.c +++ b/sys/pc98/pc98/olpt.c @@ -230,6 +230,8 @@ static d_write_t lptwrite; static d_ioctl_t lptioctl; static struct cdevsw lpt_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = lptopen, .d_close = lptclose, .d_write = lptwrite, diff --git a/sys/pc98/pc98/pc98gdc.c b/sys/pc98/pc98/pc98gdc.c index 5a232829c604..0307f6cf8ae2 100644 --- a/sys/pc98/pc98/pc98gdc.c +++ b/sys/pc98/pc98/pc98gdc.c @@ -102,6 +102,8 @@ static d_ioctl_t gdcioctl; static d_mmap_t gdcmmap; static struct cdevsw gdc_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = gdcopen, .d_close = gdcclose, .d_read = gdcread, diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index 3c309c00a7ea..39269ea261b5 100644 --- a/sys/pc98/pc98/sio.c +++ b/sys/pc98/pc98/sio.c @@ -416,13 +416,14 @@ static d_write_t siowrite; static d_ioctl_t sioioctl; static struct cdevsw sio_cdevsw = { + .d_version = D_VERSION, .d_open = sioopen, .d_close = sioclose, .d_read = sioread, .d_write = siowrite, .d_ioctl = sioioctl, .d_name = sio_driver_name, - .d_flags = D_TTY, + .d_flags = D_TTY | D_NEEDGIANT, }; int comconsole = -1; diff --git a/sys/pc98/pc98/wd_cd.c b/sys/pc98/pc98/wd_cd.c index 878091716967..ef508c0394e8 100644 --- a/sys/pc98/pc98/wd_cd.c +++ b/sys/pc98/pc98/wd_cd.c @@ -49,6 +49,7 @@ static d_strategy_t acdstrategy; static struct cdevsw acd_cdevsw = { + .d_version = D_VERSION, .d_open = acdopen, .d_close = acdclose, .d_read = physread, @@ -56,7 +57,7 @@ static struct cdevsw acd_cdevsw = { .d_ioctl = acdioctl, .d_strategy = acdstrategy, .d_name = "wcd", - .d_flags = D_DISK, + .d_flags = D_DISK | D_NEEDGIANT, }; #define NUNIT 16 /* Max # of devices */ diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c index bc5f240c0ae1..b4d15ffdd23f 100644 --- a/sys/pccard/pccard.c +++ b/sys/pccard/pccard.c @@ -81,6 +81,8 @@ static d_ioctl_t crdioctl; static d_poll_t crdpoll; static struct cdevsw crd_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = crdopen, .d_close = crdclose, .d_read = crdread, diff --git a/sys/pci/agp.c b/sys/pci/agp.c index 6f09660fad6a..6a01e20565ed 100644 --- a/sys/pci/agp.c +++ b/sys/pci/agp.c @@ -70,6 +70,8 @@ static d_ioctl_t agp_ioctl; static d_mmap_t agp_mmap; static struct cdevsw agp_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = agp_open, .d_close = agp_close, .d_ioctl = agp_ioctl, diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c index 9e8c8f1165e7..b0118d63d982 100644 --- a/sys/pci/if_ti.c +++ b/sys/pci/if_ti.c @@ -186,6 +186,8 @@ static d_close_t ti_close; static d_ioctl_t ti_ioctl2; static struct cdevsw ti_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = ti_open, .d_close = ti_close, .d_ioctl = ti_ioctl2, diff --git a/sys/pci/xrpu.c b/sys/pci/xrpu.c index d6c6cd336ef0..6c1d8fda2837 100644 --- a/sys/pci/xrpu.c +++ b/sys/pci/xrpu.c @@ -43,6 +43,8 @@ static d_ioctl_t xrpu_ioctl; static d_mmap_t xrpu_mmap; static struct cdevsw xrpu_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = xrpu_open, .d_close = xrpu_close, .d_ioctl = xrpu_ioctl, diff --git a/sys/sparc64/creator/creator_upa.c b/sys/sparc64/creator/creator_upa.c index cb4762d09d06..ee7384214587 100644 --- a/sys/sparc64/creator/creator_upa.c +++ b/sys/sparc64/creator/creator_upa.c @@ -74,6 +74,8 @@ static driver_t creator_upa_driver = { static devclass_t creator_upa_devclass; static struct cdevsw creator_devsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, .d_open = creator_open, .d_close = creator_close, .d_ioctl = creator_ioctl, diff --git a/sys/sparc64/sparc64/mem.c b/sys/sparc64/sparc64/mem.c index a099f4ada326..cee4c0fd645e 100644 --- a/sys/sparc64/sparc64/mem.c +++ b/sys/sparc64/sparc64/mem.c @@ -83,13 +83,14 @@ static d_read_t mmrw; #define CDEV_MAJOR 2 static struct cdevsw mem_cdevsw = { + .d_version = D_VERSION, .d_open = mmopen, .d_close = mmclose, .d_read = mmrw, .d_write = mmrw, .d_name = "mem", .d_maj = CDEV_MAJOR, - .d_flags = D_MEM, + .d_flags = D_MEM | D_NEEDGIANT, }; static int diff --git a/sys/sys/conf.h b/sys/sys/conf.h index a203c11fd0c8..2a2b984f4e94 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -202,12 +202,19 @@ typedef int dumper_t( #define D_TRACKCLOSE 0x00080000 /* track all closes */ #define D_MMAP_ANON 0x00100000 /* special treatment in vm_mmap.c */ #define D_PSEUDO 0x00200000 /* make_dev() can return NULL */ -#define D_NOGIANT 0x00400000 /* Doesn't want Giant */ +#define D_NEEDGIANT 0x00400000 /* driver want Giant */ + +/* + * Version numbers. + */ +#define D_VERSION_00 0x20011966 +#define D_VERSION D_VERSION_00 /* * Character device switch table */ struct cdevsw { + int d_version; int d_maj; u_int d_flags; const char *d_name; diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h index a203c11fd0c8..2a2b984f4e94 100644 --- a/sys/sys/linedisc.h +++ b/sys/sys/linedisc.h @@ -202,12 +202,19 @@ typedef int dumper_t( #define D_TRACKCLOSE 0x00080000 /* track all closes */ #define D_MMAP_ANON 0x00100000 /* special treatment in vm_mmap.c */ #define D_PSEUDO 0x00200000 /* make_dev() can return NULL */ -#define D_NOGIANT 0x00400000 /* Doesn't want Giant */ +#define D_NEEDGIANT 0x00400000 /* driver want Giant */ + +/* + * Version numbers. + */ +#define D_VERSION_00 0x20011966 +#define D_VERSION D_VERSION_00 /* * Character device switch table */ struct cdevsw { + int d_version; int d_maj; u_int d_flags; const char *d_name; -- cgit v1.3 From a832f947f31dc28e93152c17e8fe823ab84b2171 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Wed, 24 Mar 2004 01:29:08 +0000 Subject: Fix a bug introduced in rev 1.33(mega API change). Because xfer->send.payload is a pointer to the buffer, '&' shouldn't be there. Submitted by: John Weisgerber PR: misc/64623 --- sys/dev/firewire/fwdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index b5a7d5d03c41..c07be112e085 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -563,7 +563,7 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) bcopy(fp, (void *)&xfer->send.hdr, tinfo->hdr_len); if (pay_len > 0) bcopy((char *)fp + tinfo->hdr_len, - (void *)&xfer->send.payload, pay_len); + (void *)xfer->send.payload, pay_len); xfer->send.spd = asyreq->req.sped; xfer->act.hand = fw_asy_callback; -- cgit v1.3 From 10d3ed645940a41ec5505ae38b6522471207e913 Mon Sep 17 00:00:00 2001 From: Hidetoshi Shimokawa Date: Fri, 26 Mar 2004 23:17:10 +0000 Subject: MFp4: FireWire * all - s/__FUNCTION__/__func__/. Submitted by: Stefan Farfeleder - Compatibility for RELENG_4 and DragonFly. * firewire - Timestamp just before queuing. - Retry bus probe if it fails. - Use device_printf() for debug message. - Invalidiate CROM while update. - Don't process minimum/invalid CROM. * sbp - Add ORB_SHORTAGE flag. - Add sbp.tags tunable. - Revive doorbell support. It's not enabled by default. --- sys/dev/firewire/firewire.c | 65 +++++++---- sys/dev/firewire/firewire.h | 2 +- sys/dev/firewire/firewirereg.h | 19 +++- sys/dev/firewire/fwcrom.c | 21 +++- sys/dev/firewire/fwdev.c | 38 +++++-- sys/dev/firewire/fwdma.c | 17 ++- sys/dev/firewire/fwmem.c | 20 +++- sys/dev/firewire/fwohci.c | 35 +++--- sys/dev/firewire/fwohci_pci.c | 38 +++++-- sys/dev/firewire/fwohcivar.h | 8 +- sys/dev/firewire/if_fwe.c | 52 +++++---- sys/dev/firewire/sbp.c | 247 ++++++++++++++++++++++++++++------------- sys/dev/firewire/sbp_targ.c | 130 +++++++++++----------- 13 files changed, 449 insertions(+), 243 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index db9d5a86e499..29c65b56c89d 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -44,18 +44,26 @@ #include #include -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 #include /* for DELAY() */ #endif #include /* used by smbus and newbus */ #include +#ifdef __DragonFly__ +#include "firewire.h" +#include "firewirereg.h" +#include "fwmem.h" +#include "iec13213.h" +#include "iec68113.h" +#else #include #include #include #include #include +#endif struct crom_src_buf { struct crom_src src; @@ -238,7 +246,6 @@ fw_asyreq(struct firewire_comm *fc, int sub, struct fw_xfer *xfer) return EINVAL; } - microtime(&xfer->tv); if (info->flag & FWTI_TLABEL) { if((tl = fw_get_tlabel(fc, xfer)) == -1 ) return EIO; @@ -301,6 +308,7 @@ fw_asystart(struct fw_xfer *xfer) return; } #endif + microtime(&xfer->tv); s = splfw(); xfer->state = FWXF_INQ; STAILQ_INSERT_TAIL(&xfer->q->q, xfer, link); @@ -633,8 +641,13 @@ fw_reset_crom(struct firewire_comm *fc) crom_add_entry(root, CSRKEY_NCAP, 0x0083c0); /* XXX */ /* private company_id */ crom_add_entry(root, CSRKEY_VENDOR, CSRVAL_VENDOR_PRIVATE); +#ifdef __DragonFly__ + crom_add_simple_text(src, root, &buf->vendor, "DragonFly Project"); + crom_add_entry(root, CSRKEY_HW, __DragonFly_cc_version); +#else crom_add_simple_text(src, root, &buf->vendor, "FreeBSD Project"); crom_add_entry(root, CSRKEY_HW, __FreeBSD_version); +#endif crom_add_simple_text(src, root, &buf->hw, hostname); } @@ -839,7 +852,7 @@ fw_bindadd(struct firewire_comm *fc, struct fw_bind *fwb) struct fw_bind *tfw, *prev = NULL; if (fwb->start > fwb->end) { - printf("%s: invalid range\n", __FUNCTION__); + printf("%s: invalid range\n", __func__); return EINVAL; } @@ -857,7 +870,7 @@ fw_bindadd(struct firewire_comm *fc, struct fw_bind *fwb) goto out; } - printf("%s: bind failed\n", __FUNCTION__); + printf("%s: bind failed\n", __func__); return (EBUSY); out: @@ -885,7 +898,7 @@ fw_bindremove(struct firewire_comm *fc, struct fw_bind *fwb) goto found; } - printf("%s: no such bind\n", __FUNCTION__); + printf("%s: no such bind\n", __func__); splx(s); return (1); found: @@ -1049,7 +1062,7 @@ void fw_xfer_free_buf( struct fw_xfer* xfer) { if (xfer == NULL) { - printf("%s: xfer == NULL\n", __FUNCTION__); + printf("%s: xfer == NULL\n", __func__); return; } fw_xfer_unload(xfer); @@ -1066,7 +1079,7 @@ void fw_xfer_free( struct fw_xfer* xfer) { if (xfer == NULL) { - printf("%s: xfer == NULL\n", __FUNCTION__); + printf("%s: xfer == NULL\n", __func__); return; } fw_xfer_unload(xfer); @@ -1471,8 +1484,13 @@ fw_bus_explore_callback(struct fw_xfer *xfer) fc->ongonode, fc->ongoaddr); if(xfer->resp != 0){ - printf("node%d: resp=%d addr=0x%x\n", - fc->ongonode, xfer->resp, fc->ongoaddr); + device_printf(fc->bdev, + "bus_explore node=%d addr=0x%x resp=%d retry=%d\n", + fc->ongonode, fc->ongoaddr, xfer->resp, xfer->retry); + if (xfer->retry < fc->max_asyretry) { + fw_asystart(xfer); + return; + } goto errnode; } @@ -1591,8 +1609,11 @@ nextaddr: return; errnode: fc->retry_count++; - if (fc->ongodev != NULL) + if (fc->ongodev != NULL) { fc->ongodev->status = FWDEVINVAL; + /* Invalidate ROM */ + fc->ongodev->csrrom[0] = 0; + } nextnode: fw_xfer_free( xfer); fc->ongonode++; @@ -1651,7 +1672,8 @@ fw_attach_dev(struct firewire_comm *fc) free(devlistp, M_TEMP); if (fc->retry_count > 0) { - printf("probe failed for %d node\n", fc->retry_count); + device_printf(fc->bdev, "bus_explore failed for %d nodes\n", + fc->retry_count); #if 0 callout_reset(&fc->retry_probe_callout, hz*2, (void *)fc->ibr, (void *)fc); @@ -1838,10 +1860,10 @@ fw_rcv(struct fw_rcv_buf *rb) fp->mode.rreqq.dest_lo); if(bind == NULL){ printf("Unknown service addr 0x%04x:0x%08x %s(%x)" -#if __FreeBSD_version >= 500000 - " src=0x%x data=%x\n", -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 " src=0x%x data=%lx\n", +#else + " src=0x%x data=%x\n", #endif fp->mode.wreqq.dest_hi, fp->mode.wreqq.dest_lo, tcode_str[tcode], tcode, @@ -1960,10 +1982,10 @@ fw_rcv(struct fw_rcv_buf *rb) STAILQ_INSERT_TAIL(&xferq->q, rb->xfer, link); splx(s); sc = device_get_softc(rb->fc->bdev); -#if __FreeBSD_version >= 500000 - if (SEL_WAITING(&xferq->rsel)) -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 if (&xferq->rsel.si_pid != 0) +#else + if (SEL_WAITING(&xferq->rsel)) #endif selwakeuppri(&xferq->rsel, FWPRI); if (xferq->flag & FWXFERQ_WAKEUP) { @@ -2211,19 +2233,19 @@ static int fw_modevent(module_t mode, int type, void *data) { int err = 0; -#if __FreeBSD_version >= 500000 +#if defined(__FreeBSD__) && __FreeBSD_version >= 500000 static eventhandler_tag fwdev_ehtag = NULL; #endif switch (type) { case MOD_LOAD: -#if __FreeBSD_version >= 500000 +#if defined(__FreeBSD__) && __FreeBSD_version >= 500000 fwdev_ehtag = EVENTHANDLER_REGISTER(dev_clone, fwdev_clone, 0, 1000); #endif break; case MOD_UNLOAD: -#if __FreeBSD_version >= 500000 +#if defined(__FreeBSD__) && __FreeBSD_version >= 500000 if (fwdev_ehtag != NULL) EVENTHANDLER_DEREGISTER(dev_clone, fwdev_ehtag); #endif @@ -2235,5 +2257,8 @@ fw_modevent(module_t mode, int type, void *data) } +#ifdef __DragonFly__ +DECLARE_DUMMY_MODULE(firewire); +#endif DRIVER_MODULE(firewire,fwohci,firewire_driver,firewire_devclass,fw_modevent,0); MODULE_VERSION(firewire, 1); diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index 2e115f7a9bd1..f00d696153b9 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -411,7 +411,7 @@ struct fw_crom_buf { #define FWMAXNDMA 0x100 /* 8 bits DMA channel id. in device No. */ -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 #define dev2unit(x) ((minor(x) & 0xff) | (minor(x) >> 8)) #define unit2minor(x) (((x) & 0xff) | (((x) << 8) & ~0xffff)) #endif diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index bea218bbec2e..7253798fef99 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -35,7 +35,10 @@ * */ -#if __FreeBSD_version >= 500000 +#ifdef __DragonFly__ +typedef d_thread_t fw_proc; +#include +#elif __FreeBSD_version >= 500000 typedef struct thread fw_proc; #include #else @@ -68,7 +71,7 @@ struct fw_device{ }; struct firewire_softc { -#if __FreeBSD_version >= 500000 +#if defined(__FreeBSD__) && __FreeBSD_version >= 500000 dev_t dev; #endif struct firewire_comm *fc; @@ -305,15 +308,19 @@ void fwdev_clone (void *, char *, int, dev_t *); extern int firewire_debug; extern devclass_t firewire_devclass; +#ifdef __DragonFly__ +#define FWPRI PCATCH +#else #define FWPRI ((PZERO+8)|PCATCH) +#endif -#if __FreeBSD_version >= 500000 -#define CALLOUT_INIT(x) callout_init(x, 0 /* mpsafe */) -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 #define CALLOUT_INIT(x) callout_init(x) +#else +#define CALLOUT_INIT(x) callout_init(x, 0 /* mpsafe */) #endif -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 /* compatibility shim for 4.X */ #define bio buf #define bio_bcount b_bcount diff --git a/sys/dev/firewire/fwcrom.c b/sys/dev/firewire/fwcrom.c index 15dd818e2728..25524c0f209c 100644 --- a/sys/dev/firewire/fwcrom.c +++ b/sys/dev/firewire/fwcrom.c @@ -32,8 +32,10 @@ * SUCH DAMAGE. */ +#ifdef __FreeBSD__ #include __FBSDID("$FreeBSD$"); +#endif #include #if defined(_KERNEL) || defined(TEST) @@ -50,8 +52,14 @@ __FBSDID("$FreeBSD$"); #include #include #endif + +#ifdef __DragonFly__ +#include "firewire.h" +#include "iec13213.h" +#else #include #include +#endif #define MAX_ROM (1024 - sizeof(u_int32_t) * 5) #define CROM_END(cc) ((vm_offset_t)(cc)->stack[0].dir + MAX_ROM - 1) @@ -62,9 +70,10 @@ crom_init_context(struct crom_context *cc, u_int32_t *p) struct csrhdr *hdr; hdr = (struct csrhdr *)p; - if (hdr->info_len == 1) { - /* minimum ROM */ + if (hdr->info_len <= 1) { + /* minimum or invalid ROM */ cc->depth = -1; + return; } p += 1 + hdr->info_len; @@ -436,7 +445,7 @@ crom_add_simple_text(struct crom_src *src, struct crom_chunk *parent, len = strlen(buf); if (len > MAX_TEXT) { -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 printf("text(%d) trancated to %d.\n", len, MAX_TEXT); #else printf("text(%d) trancated to %td.\n", len, MAX_TEXT); @@ -574,9 +583,15 @@ main () { /* private company_id */ crom_add_entry(&root, CSRKEY_VENDOR, 0xacde48); +#ifdef __DragonFly__ + crom_add_simple_text(&src, &root, &text1, "DragonFly"); + crom_add_entry(&root, CSRKEY_HW, __DragonFly_cc_version); + crom_add_simple_text(&src, &root, &text2, "DragonFly-1"); +#else crom_add_simple_text(&src, &root, &text1, "FreeBSD"); crom_add_entry(&root, CSRKEY_HW, __FreeBSD_version); crom_add_simple_text(&src, &root, &text2, "FreeBSD-5"); +#endif /* SBP unit directory */ crom_add_chunk(&src, &root, &unit1, CROM_UDIR); diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index c07be112e085..ae736c2969ba 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -39,7 +39,7 @@ #include #include #include -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 #include #else #include @@ -56,11 +56,19 @@ #include +#ifdef __DragonFly__ +#include "firewire.h" +#include "firewirereg.h" +#include "fwdma.h" +#include "fwmem.h" +#include "iec68113.h" +#else #include #include #include #include #include +#endif #define FWNODE_INVAL 0xffff @@ -74,7 +82,12 @@ static d_mmap_t fw_mmap; static d_strategy_t fw_strategy; struct cdevsw firewire_cdevsw = { -#if __FreeBSD_version >= 500104 +#ifdef __DragonFly__ +#define CDEV_MAJOR 127 + "fw", CDEV_MAJOR, D_MEM, NULL, 0, + fw_open, fw_close, fw_read, fw_write, fw_ioctl, + fw_poll, fw_mmap, fw_strategy, nodump, nopsize, +#elif __FreeBSD_version >= 500104 .d_version = D_VERSION, .d_open = fw_open, .d_close = fw_close, @@ -87,6 +100,7 @@ struct cdevsw firewire_cdevsw = { .d_name = "fw", .d_flags = D_MEM | D_NEEDGIANT #else +#define CDEV_MAJOR 127 fw_open, fw_close, fw_read, fw_write, fw_ioctl, fw_poll, fw_mmap, fw_strategy, "fw", CDEV_MAJOR, nodump, nopsize, D_MEM, -1 @@ -174,7 +188,7 @@ fw_open (dev_t dev, int flags, int fmt, fw_proc *td) if (dev->si_drv1 != NULL) return (EBUSY); -#if __FreeBSD_version >= 500000 +#if defined(__FreeBSD__) && __FreeBSD_version >= 500000 if ((dev->si_flags & SI_NAMED) == 0) { int unit = DEV2UNIT(dev); int sub = DEV2SUB(dev); @@ -737,7 +751,7 @@ fw_poll(dev_t dev, int events, fw_proc *td) } static int -#if __FreeBSD_version < 500102 +#if defined(__DragonFly__) || __FreeBSD_version < 500102 fw_mmap (dev_t dev, vm_offset_t offset, int nproto) #else fw_mmap (dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) @@ -747,7 +761,7 @@ fw_mmap (dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) int unit = DEV2UNIT(dev); if (DEV_FWMEM(dev)) -#if __FreeBSD_version < 500102 +#if defined(__DragonFly__) || __FreeBSD_version < 500102 return fwmem_mmap(dev, offset, nproto); #else return fwmem_mmap(dev, offset, paddr, nproto); @@ -780,7 +794,9 @@ fwdev_makedev(struct firewire_softc *sc) { int err = 0; -#if __FreeBSD_version >= 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 + cdevsw_add(&firewire_cdevsw); +#else dev_t d; int unit; @@ -795,8 +811,6 @@ fwdev_makedev(struct firewire_softc *sc) dev_depends(sc->dev, d); make_dev_alias(sc->dev, "fw%d", unit); make_dev_alias(d, "fwmem%d", unit); -#else - cdevsw_add(&firewire_cdevsw); #endif return (err); @@ -807,15 +821,15 @@ fwdev_destroydev(struct firewire_softc *sc) { int err = 0; -#if __FreeBSD_version >= 500000 - destroy_dev(sc->dev); -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 cdevsw_remove(&firewire_cdevsw); +#else + destroy_dev(sc->dev); #endif return (err); } -#if __FreeBSD_version >= 500000 +#if defined(__FreeBSD__) && __FreeBSD_version >= 500000 #define NDEVTYPE 2 void fwdev_clone(void *arg, char *name, int namelen, dev_t *dev) diff --git a/sys/dev/firewire/fwdma.c b/sys/dev/firewire/fwdma.c index 95420c0a4f45..afb1a09b1155 100644 --- a/sys/dev/firewire/fwdma.c +++ b/sys/dev/firewire/fwdma.c @@ -33,14 +33,17 @@ * */ +#ifdef __FreeBSD__ #include __FBSDID("$FreeBSD$"); +#endif + #include #include #include #include #include -#if __FreeBSD_version >= 501102 +#if defined(__FreeBSD__) && __FreeBSD_version >= 501102 #include #include #endif @@ -48,9 +51,15 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef __DragonFly__ +#include +#include +#include +#else #include #include #include +#endif static void fwdma_map_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) @@ -81,7 +90,7 @@ fwdma_malloc(struct firewire_comm *fc, int alignment, bus_size_t size, /*nsegments*/ 1, /*maxsegsz*/ BUS_SPACE_MAXSIZE_32BIT, /*flags*/ BUS_DMA_ALLOCNOW, -#if __FreeBSD_version >= 501102 +#if defined(__FreeBSD__) && __FreeBSD_version >= 501102 /*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant, #endif @@ -179,7 +188,7 @@ fwdma_malloc_multiseg(struct firewire_comm *fc, int alignment, /*nsegments*/ 1, /*maxsegsz*/ BUS_SPACE_MAXSIZE_32BIT, /*flags*/ BUS_DMA_ALLOCNOW, -#if __FreeBSD_version >= 501102 +#if defined(__FreeBSD__) && __FreeBSD_version >= 501102 /*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant, #endif @@ -190,7 +199,7 @@ fwdma_malloc_multiseg(struct firewire_comm *fc, int alignment, } #if 0 -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 printf("malloc_multi: ssize=%d nseg=%d\n", ssize, nseg); #else printf("malloc_multi: ssize=%td nseg=%d\n", ssize, nseg); diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index 4feb8f3d3055..a6c81a2449fa 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -33,8 +33,10 @@ * */ +#ifdef __FreeBSD__ #include __FBSDID("$FreeBSD$"); +#endif #include #include @@ -44,7 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 #include #else #include @@ -58,9 +60,15 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef __DragonFly__ +#include "firewire.h" +#include "firewirereg.h" +#include "fwmem.h" +#else #include #include #include +#endif static int fwmem_speed=2, fwmem_debug=0; static struct fw_eui64 fwmem_eui64; @@ -286,7 +294,7 @@ fwmem_open (dev_t dev, int flags, int fmt, fw_proc *td) fms->refcount = 1; } if (fwmem_debug) - printf("%s: refcount=%d\n", __FUNCTION__, fms->refcount); + printf("%s: refcount=%d\n", __func__, fms->refcount); return (0); } @@ -299,7 +307,7 @@ fwmem_close (dev_t dev, int flags, int fmt, fw_proc *td) fms = (struct fwmem_softc *)dev->si_drv1; fms->refcount --; if (fwmem_debug) - printf("%s: refcount=%d\n", __FUNCTION__, fms->refcount); + printf("%s: refcount=%d\n", __func__, fms->refcount); if (fms->refcount < 1) { free(dev->si_drv1, M_FW); dev->si_drv1 = NULL; @@ -319,7 +327,7 @@ fwmem_biodone(struct fw_xfer *xfer) if (bp->bio_error != 0) { if (fwmem_debug) - printf("%s: err=%d\n", __FUNCTION__, bp->bio_error); + printf("%s: err=%d\n", __func__, bp->bio_error); bp->bio_flags |= BIO_ERROR; bp->bio_resid = bp->bio_bcount; } @@ -389,7 +397,7 @@ error: splx(s); if (err != 0) { if (fwmem_debug) - printf("%s: err=%d\n", __FUNCTION__, err); + printf("%s: err=%d\n", __func__, err); bp->bio_error = err; bp->bio_flags |= BIO_ERROR; bp->bio_resid = bp->bio_bcount; @@ -422,7 +430,7 @@ fwmem_poll (dev_t dev, int events, fw_proc *td) return EINVAL; } int -#if __FreeBSD_version < 500102 +#if defined(__DragonFly__) || __FreeBSD_version < 500102 fwmem_mmap (dev_t dev, vm_offset_t offset, int nproto) #else fwmem_mmap (dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 147285ea1fbc..afc58d5b8be0 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -54,16 +54,25 @@ #include -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 #include /* for DELAY() */ #endif +#ifdef __DragonFly__ +#include "firewire.h" +#include "firewirereg.h" +#include "fwdma.h" +#include "fwohcireg.h" +#include "fwohcivar.h" +#include "firewire_phy.h" +#else #include #include #include #include #include #include +#endif #undef OHCI_DEBUG @@ -1206,7 +1215,7 @@ fwohci_db_init(struct fwohci_softc *sc, struct fwohci_dbch *dbch) /*nsegments*/ dbch->ndesc > 3 ? dbch->ndesc - 2 : 1, /*maxsegsz*/ MAX_REQCOUNT, /*flags*/ 0, -#if __FreeBSD_version >= 501102 +#if defined(__FreeBSD__) && __FreeBSD_version >= 501102 /*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant, #endif @@ -1814,11 +1823,11 @@ busresetout: #ifndef ACK_ALL OWRITE(sc, FWOHCI_INTSTATCLR, OHCI_INT_DMA_IR); #endif -#if __FreeBSD_version >= 500000 - irstat = atomic_readandclear_int(&sc->irstat); -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 irstat = sc->irstat; sc->irstat = 0; +#else + irstat = atomic_readandclear_int(&sc->irstat); #endif for(i = 0; i < fc->nisodma ; i++){ struct fwohci_dbch *dbch; @@ -1838,11 +1847,11 @@ busresetout: #ifndef ACK_ALL OWRITE(sc, FWOHCI_INTSTATCLR, OHCI_INT_DMA_IT); #endif -#if __FreeBSD_version >= 500000 - itstat = atomic_readandclear_int(&sc->itstat); -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 itstat = sc->itstat; sc->itstat = 0; +#else + itstat = atomic_readandclear_int(&sc->itstat); #endif for(i = 0; i < fc->nisodma ; i++){ if((itstat & (1 << i)) != 0){ @@ -1928,7 +1937,7 @@ busresetout: } for (i = 0; i < plen / 4; i ++) buf[i] = FWOHCI_DMA_READ(sc->sid_buf[i+1]); -#if 1 +#if 1 /* XXX needed?? */ /* pending all pre-bus_reset packets */ fwohci_txd(sc, &sc->atrq); fwohci_txd(sc, &sc->atrs); @@ -2355,12 +2364,12 @@ print_db(struct fwohcidb_tr *db_tr, struct fwohcidb *db, res = FWOHCI_DMA_READ(db[i].db.desc.res); key = cmd & OHCI_KEY_MASK; stat = res >> OHCI_STATUS_SHIFT; -#if __FreeBSD_version >= 500000 - printf("%08jx %s %s %s %s %5d %08x %08x %04x:%04x", - (uintmax_t)db_tr->bus_addr, -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 printf("%08x %s %s %s %s %5d %08x %08x %04x:%04x", db_tr->bus_addr, +#else + printf("%08jx %s %s %s %s %5d %08x %08x %04x:%04x", + (uintmax_t)db_tr->bus_addr, #endif dbcode[(cmd >> 28) & 0xf], dbkey[(cmd >> 24) & 0x7], diff --git a/sys/dev/firewire/fwohci_pci.c b/sys/dev/firewire/fwohci_pci.c index 59086dd0a564..a9ad26ee2146 100644 --- a/sys/dev/firewire/fwohci_pci.c +++ b/sys/dev/firewire/fwohci_pci.c @@ -45,16 +45,27 @@ #include #include #include -#if __FreeBSD_version >= 501102 +#if defined(__FreeBSD__) && __FreeBSD_version >= 501102 #include #include #endif #include -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 #include /* for DELAY() */ #endif +#ifdef __DragonFly__ +#include +#include + +#include "firewire.h" +#include "firewirereg.h" + +#include "fwdma.h" +#include "fwohcireg.h" +#include "fwohcivar.h" +#else #if __FreeBSD_version < 500000 #include #include @@ -69,6 +80,7 @@ #include #include #include +#endif static int fwohci_pci_attach(device_t self); static int fwohci_pci_detach(device_t self); @@ -184,7 +196,7 @@ fwohci_pci_probe( device_t dev ) return ENXIO; } -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 static void fwohci_dummy_intr(void *arg) { @@ -236,7 +248,7 @@ fwohci_pci_attach(device_t self) fwohci_softc_t *sc = device_get_softc(self); int err; int rid; -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 int intr; /* For the moment, put in a message stating what is wrong */ intr = pci_read_config(self, PCIR_INTLINE, 1); @@ -254,7 +266,12 @@ fwohci_pci_attach(device_t self) fwohci_pci_init(self); rid = PCI_CBMEM; +#if __FreeBSD_version >= 502109 sc->bsr = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE); +#else + sc->bsr = bus_alloc_resource(self, SYS_RES_MEMORY, &rid, + 0, ~0, 1, RF_ACTIVE); +#endif if (!sc->bsr) { device_printf(self, "Could not map memory\n"); return ENXIO; @@ -264,8 +281,13 @@ fwohci_pci_attach(device_t self) sc->bsh = rman_get_bushandle(sc->bsr); rid = 0; +#if __FreeBSD_version >= 502109 sc->irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); +#else + sc->irq_res = bus_alloc_resource(self, SYS_RES_IRQ, &rid, 0, ~0, 1, + RF_SHAREABLE | RF_ACTIVE); +#endif if (sc->irq_res == NULL) { device_printf(self, "Could not allocate irq\n"); fwohci_pci_detach(self); @@ -280,7 +302,7 @@ fwohci_pci_attach(device_t self) INTR_TYPE_NET, #endif (driver_intr_t *) fwohci_intr, sc, &sc->ih); -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 /* XXX splcam() should mask this irq for sbp.c*/ err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_CAM, (driver_intr_t *) fwohci_dummy_intr, sc, &sc->ih_cam); @@ -307,7 +329,7 @@ fwohci_pci_attach(device_t self) /*nsegments*/0x20, /*maxsegsz*/0x8000, /*flags*/BUS_DMA_ALLOCNOW, -#if __FreeBSD_version >= 501102 +#if defined(__FreeBSD__) && __FreeBSD_version >= 501102 /*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant, #endif @@ -362,7 +384,7 @@ fwohci_pci_detach(device_t self) /* XXX or should we panic? */ device_printf(self, "Could not tear down irq, %d\n", err); -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 bus_teardown_intr(self, sc->irq_res, sc->ih_cam); bus_teardown_intr(self, sc->irq_res, sc->ih_bio); #endif @@ -486,7 +508,7 @@ static driver_t fwohci_driver = { static devclass_t fwohci_devclass; -#ifdef FWOHCI_MODULE +#ifdef FWOHCI_MODULE MODULE_DEPEND(fwohci, firewire, 1, 1, 1); #endif DRIVER_MODULE(fwohci, pci, fwohci_driver, fwohci_devclass, 0, 0); diff --git a/sys/dev/firewire/fwohcivar.h b/sys/dev/firewire/fwohcivar.h index 76c755234309..a3fd1e71c964 100644 --- a/sys/dev/firewire/fwohcivar.h +++ b/sys/dev/firewire/fwohcivar.h @@ -35,10 +35,10 @@ * */ -#if __FreeBSD_version >= 500000 -#define FWOHCI_TASKQUEUE 1 -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 #define FWOHCI_TASKQUEUE 0 +#else +#define FWOHCI_TASKQUEUE 1 #endif #if FWOHCI_TASKQUEUE #include @@ -49,7 +49,7 @@ typedef struct fwohci_softc { bus_space_tag_t bst; bus_space_handle_t bsh; void *ih; -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 void *ih_cam; void *ih_bio; #endif diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c index 9764ec95a1e6..cc52d2bea6c7 100644 --- a/sys/dev/firewire/if_fwe.c +++ b/sys/dev/firewire/if_fwe.c @@ -52,11 +52,18 @@ #include #include #include +#ifdef __DragonFly__ +#include +#include +#include +#include "if_fwevar.h" +#else #include #include #include #include +#endif #define FWEDEBUG if (fwedebug) if_printf #define TX_MAX_QUEUE (FWMAXQUEUE - 1) @@ -195,7 +202,7 @@ fwe_attach(device_t dev) ifp = &fwe->fwe_if; ifp->if_softc = &fwe->eth_softc; -#if __FreeBSD_version >= 501113 +#if __FreeBSD_version >= 501113 || defined(__DragonFly__) if_initname(ifp, device_get_name(dev), unit); #else ifp->if_unit = unit; @@ -210,16 +217,16 @@ fwe_attach(device_t dev) ifp->if_snd.ifq_maxlen = TX_MAX_QUEUE; s = splimp(); -#if __FreeBSD_version >= 500000 - ether_ifattach(ifp, eaddr); -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 ether_ifattach(ifp, 1); +#else + ether_ifattach(ifp, eaddr); #endif splx(s); /* Tell the upper layer(s) we support long frames. */ ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); -#if __FreeBSD_version >= 500000 +#if defined(__FreeBSD__) && __FreeBSD_version >= 500000 ifp->if_capabilities |= IFCAP_VLAN_MTU; #endif @@ -279,10 +286,10 @@ fwe_detach(device_t dev) s = splimp(); fwe_stop(fwe); -#if __FreeBSD_version >= 500000 - ether_ifdetach(&fwe->fwe_if); -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 ether_ifdetach(&fwe->fwe_if, 1); +#else + ether_ifdetach(&fwe->fwe_if); #endif splx(s); @@ -345,10 +352,10 @@ found: xferq->stproc = NULL; for (i = 0; i < xferq->bnchunk; i ++) { m = -#if __FreeBSD_version >= 500000 - m_getcl(M_TRYWAIT, MT_DATA, M_PKTHDR); -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 m_getcl(M_WAIT, MT_DATA, M_PKTHDR); +#else + m_getcl(M_TRYWAIT, MT_DATA, M_PKTHDR); #endif xferq->bulkxfer[i].mbuf = m; if (m != NULL) { @@ -425,7 +432,7 @@ fwe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) fwe->stream_ch, fwe->dma_ch); splx(s); break; -#if __FreeBSD_version >= 500000 +#if defined(__FreeBSD__) && __FreeBSD_version >= 500000 default: #else case SIOCSIFADDR: @@ -436,7 +443,7 @@ fwe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, cmd, data); splx(s); return (error); -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 default: return (EINVAL); #endif @@ -532,11 +539,11 @@ fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp) if (m == NULL) break; STAILQ_REMOVE_HEAD(&fwe->xferlist, link); -#if __FreeBSD_version >= 500000 - BPF_MTAP(ifp, m); -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 if (ifp->if_bpf != NULL) bpf_mtap(ifp, m); +#else + BPF_MTAP(ifp, m); #endif /* keep ip packet alignment for alpha */ @@ -575,7 +582,7 @@ fwe_as_input(struct fw_xferq *xferq) struct fw_bulkxfer *sxfer; struct fw_pkt *fp; u_char *c; -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 struct ether_header *eh; #endif @@ -608,7 +615,7 @@ fwe_as_input(struct fw_xferq *xferq) m->m_data += HDR_LEN + ETHER_ALIGN; c = mtod(m, char *); -#if __FreeBSD_version < 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 eh = (struct ether_header *)c; m->m_data += sizeof(struct ether_header); #endif @@ -630,10 +637,10 @@ fwe_as_input(struct fw_xferq *xferq) c[20], c[21], c[22], c[23] ); #endif -#if __FreeBSD_version >= 500000 - (*ifp->if_input)(ifp, m); -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 ether_input(ifp, eh, m); +#else + (*ifp->if_input)(ifp, m); #endif ifp->if_ipackets ++; } @@ -660,6 +667,9 @@ static driver_t fwe_driver = { }; +#ifdef __DragonFly__ +DECLARE_DUMMY_MODULE(fwe); +#endif DRIVER_MODULE(fwe, firewire, fwe_driver, fwe_devclass, 0, 0); MODULE_VERSION(fwe, 1); MODULE_DEPEND(fwe, firewire, 1, 1, 1); diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index 13b9aa12e79e..59f3d87ff308 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -39,34 +39,48 @@ #include #include #include +#include #include #include #include -#if __FreeBSD_version >= 501102 +#if defined(__FreeBSD__) && __FreeBSD_version >= 501102 #include #include #endif -#if __FreeBSD_version < 500106 +#if defined(__DragonFly__) || __FreeBSD_version < 500106 #include /* for struct devstat */ #endif +#ifdef __DragonFly__ +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include "sbp.h" +#else #include #include #include #include #include #include - #include -#include - #include #include #include #include #include +#endif #define ccb_sdev_ptr spriv_ptr0 #define ccb_sbp_ptr spriv_ptr1 @@ -113,6 +127,8 @@ static int sbp_cold = 1; static int ex_login = 1; static int login_delay = 1000; /* msec */ static int scan_delay = 500; /* msec */ +static int use_doorbell = 0; +static int sbp_tags = 0; SYSCTL_DECL(_hw_firewire); SYSCTL_NODE(_hw_firewire, OID_AUTO, sbp, CTLFLAG_RD, 0, "SBP-II Subsystem"); @@ -128,12 +144,18 @@ SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, login_delay, CTLFLAG_RW, &login_delay, 0, "SBP login delay in msec"); SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, scan_delay, CTLFLAG_RW, &scan_delay, 0, "SBP scan delay in msec"); +SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, use_doorbell, CTLFLAG_RW, + &use_doorbell, 0, "SBP use doorbell request"); +SYSCTL_INT(_hw_firewire_sbp, OID_AUTO, tags, CTLFLAG_RW, &sbp_tags, 0, + "SBP tagged queuing support"); TUNABLE_INT("hw.firewire.sbp.auto_login", &auto_login); TUNABLE_INT("hw.firewire.sbp.max_speed", &max_speed); TUNABLE_INT("hw.firewire.sbp.exclusive_login", &ex_login); TUNABLE_INT("hw.firewire.sbp.login_delay", &login_delay); TUNABLE_INT("hw.firewire.sbp.scan_delay", &scan_delay); +TUNABLE_INT("hw.firewire.sbp.use_doorbell", &use_doorbell); +TUNABLE_INT("hw.firewire.sbp.tags", &sbp_tags); #define NEED_RESPONSE 0 @@ -179,6 +201,9 @@ struct sbp_dev{ #define VALID_LUN (1 << 1) #define ORB_POINTER_ACTIVE (1 << 2) #define ORB_POINTER_NEED (1 << 3) +#define ORB_DOORBELL_ACTIVE (1 << 4) +#define ORB_DOORBELL_NEED (1 << 5) +#define ORB_SHORTAGE (1 << 6) u_int16_t flags; struct cam_path *path; struct sbp_target *target; @@ -188,6 +213,7 @@ struct sbp_dev{ struct sbp_ocb *ocb; STAILQ_HEAD(, sbp_ocb) ocbs; STAILQ_HEAD(, sbp_ocb) free_ocbs; + struct sbp_ocb *last_ocb; char vendor[32]; char product[32]; char revision[10]; @@ -227,6 +253,7 @@ static void sbp_mgm_callback (struct fw_xfer *); static void sbp_cmd_callback (struct fw_xfer *); #endif static void sbp_orb_pointer (struct sbp_dev *, struct sbp_ocb *); +static void sbp_doorbell(struct sbp_dev *); static void sbp_execute_ocb (void *, bus_dma_segment_t *, int, int); static void sbp_free_ocb (struct sbp_dev *, struct sbp_ocb *); static void sbp_abort_ocb (struct sbp_ocb *, int); @@ -468,7 +495,7 @@ END_DEBUG M_SBP, M_NOWAIT | M_ZERO); if (newluns == NULL) { - printf("%s: realloc failed\n", __FUNCTION__); + printf("%s: realloc failed\n", __func__); newluns = target->luns; maxlun = target->num_lun; } @@ -504,7 +531,7 @@ END_DEBUG sdev = malloc(sizeof(struct sbp_dev), M_SBP, M_NOWAIT | M_ZERO); if (sdev == NULL) { - printf("%s: malloc failed\n", __FUNCTION__); + printf("%s: malloc failed\n", __func__); goto next; } target->luns[lun] = sdev; @@ -526,7 +553,7 @@ END_DEBUG SBP_DMA_SIZE, &sdev->dma, BUS_DMA_NOWAIT); if (sdev->dma.v_addr == NULL) { printf("%s: dma space allocation failed\n", - __FUNCTION__); + __func__); free(sdev, M_SBP); target->luns[lun] = NULL; goto next; @@ -668,7 +695,7 @@ sbp_login(struct sbp_dev *sdev) if (t.tv_sec >= 0 && t.tv_usec > 0) ticks = (t.tv_sec * 1000 + t.tv_usec / 1000) * hz / 1000; SBP_DEBUG(0) - printf("%s: sec = %ld usec = %ld ticks = %d\n", __FUNCTION__, + printf("%s: sec = %ld usec = %ld ticks = %d\n", __func__, t.tv_sec, t.tv_usec, ticks); END_DEBUG callout_reset(&sdev->login_callout, ticks, @@ -1068,11 +1095,11 @@ sbp_agent_reset_callback(struct fw_xfer *xfer) sdev = (struct sbp_dev *)xfer->sc; SBP_DEBUG(1) sbp_show_sdev_info(sdev, 2); - printf("%s\n", __FUNCTION__); + printf("%s\n", __func__); END_DEBUG if (xfer->resp != 0) { sbp_show_sdev_info(sdev, 2); - printf("%s: resp=%d\n", __FUNCTION__, xfer->resp); + printf("%s: resp=%d\n", __func__, xfer->resp); } sbp_xfer_free(xfer); @@ -1146,11 +1173,11 @@ sbp_orb_pointer_callback(struct fw_xfer *xfer) SBP_DEBUG(1) sbp_show_sdev_info(sdev, 2); - printf("%s\n", __FUNCTION__); + printf("%s\n", __func__); END_DEBUG if (xfer->resp != 0) { /* XXX */ - printf("%s: xfer->resp = %d\n", __FUNCTION__, xfer->resp); + printf("%s: xfer->resp = %d\n", __func__, xfer->resp); } sbp_xfer_free(xfer); sdev->flags &= ~ORB_POINTER_ACTIVE; @@ -1173,12 +1200,12 @@ sbp_orb_pointer(struct sbp_dev *sdev, struct sbp_ocb *ocb) struct fw_pkt *fp; SBP_DEBUG(1) sbp_show_sdev_info(sdev, 2); - printf("%s: 0x%08x\n", __FUNCTION__, (u_int32_t)ocb->bus_addr); + printf("%s: 0x%08x\n", __func__, (u_int32_t)ocb->bus_addr); END_DEBUG if ((sdev->flags & ORB_POINTER_ACTIVE) != 0) { SBP_DEBUG(0) - printf("%s: orb pointer active\n", __FUNCTION__); + printf("%s: orb pointer active\n", __func__); END_DEBUG sdev->flags |= ORB_POINTER_NEED; return; @@ -1204,21 +1231,26 @@ END_DEBUG } } -#if 0 static void -sbp_cmd_callback(struct fw_xfer *xfer) +sbp_doorbell_callback(struct fw_xfer *xfer) { -SBP_DEBUG(1) struct sbp_dev *sdev; sdev = (struct sbp_dev *)xfer->sc; + +SBP_DEBUG(1) sbp_show_sdev_info(sdev, 2); - printf("sbp_cmd_callback\n"); + printf("sbp_doorbell_callback\n"); END_DEBUG if (xfer->resp != 0) { /* XXX */ - printf("%s: xfer->resp = %d\n", __FUNCTION__, xfer->resp); + printf("%s: xfer->resp = %d\n", __func__, xfer->resp); } sbp_xfer_free(xfer); + sdev->flags &= ~ORB_DOORBELL_ACTIVE; + if ((sdev->flags & ORB_DOORBELL_NEED) != 0) { + sdev->flags &= ~ORB_DOORBELL_NEED; + sbp_doorbell(sdev); + } return; } @@ -1232,15 +1264,19 @@ SBP_DEBUG(1) printf("sbp_doorbell\n"); END_DEBUG + if ((sdev->flags & ORB_DOORBELL_ACTIVE) != 0) { + sdev->flags |= ORB_DOORBELL_NEED; + return; + } + sdev->flags |= ORB_DOORBELL_ACTIVE; xfer = sbp_write_cmd(sdev, FWTCODE_WREQQ, 0x10); if (xfer == NULL) return; - xfer->act.hand = sbp_cmd_callback; - fp = (struct fw_pkt *)xfer->send.buf; + xfer->act.hand = sbp_doorbell_callback; + fp = &xfer->send.hdr; fp->mode.wreqq.data = htonl(0xf); fw_asyreq(xfer->fc, -1, xfer); } -#endif static struct fw_xfer * sbp_write_cmd(struct sbp_dev *sdev, int tcode, int offset) @@ -1539,10 +1575,6 @@ END_DEBUG #endif /* fall through */ case T_RBC: - /* enable tagged queuing */ -#if 1 - inq->flags |= SID_CmdQue; -#endif /* * Override vendor/product/revision information. * Some devices sometimes return strange strings. @@ -1554,6 +1586,15 @@ END_DEBUG #endif break; } + /* + * Force to enable/disable tagged queuing. + * XXX CAM also checks SCP_QUEUE_DQUE flag in the control mode page. + */ + if (sbp_tags > 0) + inq->flags |= SID_CmdQue; + else if (sbp_tags < 0) + inq->flags &= ~SID_CmdQue; + } static void @@ -1629,10 +1670,10 @@ END_DEBUG ocb = sbp_dequeue_ocb(sdev, sbp_status); if (ocb == NULL) { sbp_show_sdev_info(sdev, 2); -#if __FreeBSD_version >= 500000 - printf("No ocb(%x) on the queue\n", -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 printf("No ocb(%lx) on the queue\n", +#else + printf("No ocb(%x) on the queue\n", #endif ntohl(sbp_status->orb_lo)); } @@ -1657,10 +1698,10 @@ END_DEBUG SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); printf("ORB status src:%x resp:%x dead:%x" -#if __FreeBSD_version >= 500000 - " len:%x stat:%x orb:%x%08x\n", -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 " len:%x stat:%x orb:%x%08lx\n", +#else + " len:%x stat:%x orb:%x%08x\n", #endif sbp_status->src, sbp_status->resp, sbp_status->dead, sbp_status->len, sbp_status->status, @@ -1811,7 +1852,8 @@ printf("len %d\n", sbp_status->len); } } - sbp_free_ocb(sdev, ocb); + if (!use_doorbell) + sbp_free_ocb(sdev, ocb); done: if (reset_agent) sbp_agent_reset(sdev); @@ -1893,7 +1935,7 @@ END_DEBUG /*maxsize*/0x100000, /*nsegments*/SBP_IND_MAX, /*maxsegsz*/SBP_SEG_MAX, /*flags*/BUS_DMA_ALLOCNOW, -#if __FreeBSD_version >= 501102 +#if defined(__FreeBSD__) && __FreeBSD_version >= 501102 /*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant, #endif @@ -2340,6 +2382,10 @@ END_DEBUG #endif if ((ocb = sbp_get_ocb(sdev)) == NULL) { ccb->ccb_h.status = CAM_REQUEUE_REQ; + if (sdev->freeze == 0) { + xpt_freeze_devq(sdev->path, 1); + sdev->freeze ++; + } xpt_done(ccb); return; } @@ -2394,7 +2440,7 @@ printf("ORB %08x %08x %08x %08x\n", ntohl(ocb->orb[4]), ntohl(ocb->orb[5]), ntoh case XPT_CALC_GEOMETRY: { struct ccb_calc_geometry *ccg; -#if __FreeBSD_version < 501100 +#if defined(__DragonFly__) || __FreeBSD_version < 501100 u_int32_t size_mb; u_int32_t secs_per_cylinder; int extended = 1; @@ -2409,21 +2455,21 @@ printf("ORB %08x %08x %08x %08x\n", ntohl(ocb->orb[4]), ntohl(ocb->orb[5]), ntoh } SBP_DEBUG(1) printf("%s:%d:%d:%d:XPT_CALC_GEOMETRY: " -#if __FreeBSD_version >= 500000 - "Volume size = %jd\n", -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 "Volume size = %d\n", +#else + "Volume size = %jd\n", #endif device_get_nameunit(sbp->fd.dev), cam_sim_path(sbp->sim), ccb->ccb_h.target_id, ccb->ccb_h.target_lun, -#if __FreeBSD_version >= 500000 +#if defined(__FreeBSD__) && __FreeBSD_version >= 500000 (uintmax_t) #endif ccg->volume_size); END_DEBUG -#if __FreeBSD_version < 501100 +#if defined(__DragonFly__) || __FreeBSD_version < 501100 size_mb = ccg->volume_size / ((1024L * 1024L) / ccg->block_size); @@ -2539,11 +2585,11 @@ sbp_execute_ocb(void *arg, bus_dma_segment_t *segments, int seg, int error) SBP_DEBUG(2) printf("sbp_execute_ocb: seg %d", seg); for (i = 0; i < seg; i++) -#if __FreeBSD_version >= 500000 +#if defined(__DragonFly__) || __FreeBSD_version < 500000 + printf(", %x:%d", segments[i].ds_addr, segments[i].ds_len); +#else printf(", %jx:%jd", (uintmax_t)segments[i].ds_addr, (uintmax_t)segments[i].ds_len); -#else - printf(", %x:%d", segments[i].ds_addr, segments[i].ds_len); #endif printf("\n"); END_DEBUG @@ -2563,10 +2609,10 @@ SBP_DEBUG(0) /* XXX LSI Logic "< 16 byte" bug might be hit */ if (s->ds_len < 16) printf("sbp_execute_ocb: warning, " -#if __FreeBSD_version >= 500000 - "segment length(%zd) is less than 16." -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 "segment length(%d) is less than 16." +#else + "segment length(%zd) is less than 16." #endif "(seg=%d/%d)\n", s->ds_len, i+1, seg); END_DEBUG @@ -2584,9 +2630,18 @@ END_DEBUG BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); prev = sbp_enqueue_ocb(ocb->sdev, ocb); fwdma_sync(&ocb->sdev->dma, BUS_DMASYNC_PREWRITE); - if (prev == NULL || (ocb->sdev->flags & ORB_LINK_DEAD) != 0) { - ocb->sdev->flags &= ~ORB_LINK_DEAD; - sbp_orb_pointer(ocb->sdev, ocb); + if (use_doorbell) { + if (prev == NULL) { + if (ocb->sdev->last_ocb != NULL) + sbp_doorbell(ocb->sdev); + else + sbp_orb_pointer(ocb->sdev, ocb); + } + } else { + if (prev == NULL || (ocb->sdev->flags & ORB_LINK_DEAD) != 0) { + ocb->sdev->flags &= ~ORB_LINK_DEAD; + sbp_orb_pointer(ocb->sdev, ocb); + } } } @@ -2614,12 +2669,12 @@ sbp_dequeue_ocb(struct sbp_dev *sdev, struct sbp_status *sbp_status) SBP_DEBUG(1) sbp_show_sdev_info(sdev, 2); -#if __FreeBSD_version >= 500000 - printf("%s: 0x%08x src %d\n", -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 printf("%s: 0x%08lx src %d\n", +#else + printf("%s: 0x%08x src %d\n", #endif - __FUNCTION__, ntohl(sbp_status->orb_lo), sbp_status->src); + __func__, ntohl(sbp_status->orb_lo), sbp_status->src); END_DEBUG for (ocb = STAILQ_FIRST(&sdev->ocbs); ocb != NULL; ocb = next) { next = STAILQ_NEXT(ocb, ocb); @@ -2639,17 +2694,30 @@ END_DEBUG bus_dmamap_unload(sdev->target->sbp->dmat, ocb->dmamap); } - if (sbp_status->src == SRC_NO_NEXT) { - if (next != NULL) - sbp_orb_pointer(sdev, next); - else if (order > 0) { - /* - * Unordered execution - * We need to send pointer for - * next ORB - */ - sdev->flags |= ORB_LINK_DEAD; + if (!use_doorbell) { + if (sbp_status->src == SRC_NO_NEXT) { + if (next != NULL) + sbp_orb_pointer(sdev, next); + else if (order > 0) { + /* + * Unordered execution + * We need to send pointer for + * next ORB + */ + sdev->flags |= ORB_LINK_DEAD; + } } + } else { + /* + * XXX this is not correct for unordered + * execution. + */ + if (sdev->last_ocb != NULL) + sbp_free_ocb(sdev, sdev->last_ocb); + sdev->last_ocb = ocb; + if (next != NULL && + sbp_status->src == SRC_NO_NEXT) + sbp_doorbell(sdev); } break; } else @@ -2669,35 +2737,38 @@ static struct sbp_ocb * sbp_enqueue_ocb(struct sbp_dev *sdev, struct sbp_ocb *ocb) { int s = splfw(); - struct sbp_ocb *prev; + struct sbp_ocb *prev, *prev2; SBP_DEBUG(1) sbp_show_sdev_info(sdev, 2); -#if __FreeBSD_version >= 500000 - printf("%s: 0x%08jx\n", __FUNCTION__, (uintmax_t)ocb->bus_addr); +#if defined(__DragonFly__) || __FreeBSD_version < 500000 + printf("%s: 0x%08x\n", __func__, ocb->bus_addr); #else - printf("%s: 0x%08x\n", __FUNCTION__, ocb->bus_addr); + printf("%s: 0x%08jx\n", __func__, (uintmax_t)ocb->bus_addr); #endif END_DEBUG - prev = STAILQ_LAST(&sdev->ocbs, sbp_ocb, ocb); + prev2 = prev = STAILQ_LAST(&sdev->ocbs, sbp_ocb, ocb); STAILQ_INSERT_TAIL(&sdev->ocbs, ocb, ocb); if (ocb->ccb != NULL) ocb->ccb->ccb_h.timeout_ch = timeout(sbp_timeout, (caddr_t)ocb, (ocb->ccb->ccb_h.timeout * hz) / 1000); - if (prev != NULL) { + if (use_doorbell && prev == NULL) + prev2 = sdev->last_ocb; + + if (prev2 != NULL) { SBP_DEBUG(2) -#if __FreeBSD_version >= 500000 - printf("linking chain 0x%jx -> 0x%jx\n", - (uintmax_t)prev->bus_addr, (uintmax_t)ocb->bus_addr); -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 printf("linking chain 0x%x -> 0x%x\n", - prev->bus_addr, ocb->bus_addr); + prev2->bus_addr, ocb->bus_addr); +#else + printf("linking chain 0x%jx -> 0x%jx\n", + (uintmax_t)prev2->bus_addr, (uintmax_t)ocb->bus_addr); #endif END_DEBUG - prev->orb[1] = htonl(ocb->bus_addr); - prev->orb[0] = 0; + prev2->orb[1] = htonl(ocb->bus_addr); + prev2->orb[0] = 0; } splx(s); @@ -2711,6 +2782,7 @@ sbp_get_ocb(struct sbp_dev *sdev) int s = splfw(); ocb = STAILQ_FIRST(&sdev->free_ocbs); if (ocb == NULL) { + sdev->flags |= ORB_SHORTAGE; printf("ocb shortage!!!\n"); return NULL; } @@ -2726,6 +2798,14 @@ sbp_free_ocb(struct sbp_dev *sdev, struct sbp_ocb *ocb) ocb->flags = 0; ocb->ccb = NULL; STAILQ_INSERT_TAIL(&sdev->free_ocbs, ocb, ocb); + if ((sdev->flags & ORB_SHORTAGE) != 0) { + int count; + + sdev->flags &= ~ORB_SHORTAGE; + count = sdev->freeze; + sdev->freeze = 0; + xpt_release_devq(sdev->path, count, TRUE); + } } static void @@ -2736,10 +2816,10 @@ sbp_abort_ocb(struct sbp_ocb *ocb, int status) sdev = ocb->sdev; SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); -#if __FreeBSD_version >= 500000 - printf("sbp_abort_ocb 0x%jx\n", (uintmax_t)ocb->bus_addr); -#else +#if defined(__DragonFly__) || __FreeBSD_version < 500000 printf("sbp_abort_ocb 0x%x\n", ocb->bus_addr); +#else + printf("sbp_abort_ocb 0x%jx\n", (uintmax_t)ocb->bus_addr); #endif END_DEBUG SBP_DEBUG(1) @@ -2776,6 +2856,10 @@ sbp_abort_all_ocbs(struct sbp_dev *sdev, int status) next = STAILQ_NEXT(ocb, ocb); sbp_abort_ocb(ocb, status); } + if (sdev->last_ocb != NULL) { + sbp_free_ocb(sdev, sdev->last_ocb); + sdev->last_ocb = NULL; + } splx(s); } @@ -2798,6 +2882,9 @@ static driver_t sbp_driver = { sbp_methods, sizeof(struct sbp_softc), }; +#ifdef __DragonFly__ +DECLARE_DUMMY_MODULE(sbp); +#endif DRIVER_MODULE(sbp, firewire, sbp_driver, sbp_devclass, 0, 0); MODULE_VERSION(sbp, 1); MODULE_DEPEND(sbp, firewire, 1, 1, 1); diff --git a/sys/dev/firewire/sbp_targ.c b/sys/dev/firewire/sbp_targ.c index 5f7c7bea8878..119ecd2069ba 100644 --- a/sys/dev/firewire/sbp_targ.c +++ b/sys/dev/firewire/sbp_targ.c @@ -242,7 +242,7 @@ sbp_targ_dealloc_login(struct sbp_targ_login *login) struct orb_info *orbi, *next; if (login == NULL) { - printf("%s: login = NULL\n", __FUNCTION__); + printf("%s: login = NULL\n", __func__); return; } for (orbi = STAILQ_FIRST(&login->orbs); orbi != NULL; orbi = next) { @@ -264,10 +264,10 @@ sbp_targ_hold_expire(void *arg) login = (struct sbp_targ_login *)arg; if (login->flags & F_HOLD) { - printf("%s: login_id=%d expired\n", __FUNCTION__, login->id); + printf("%s: login_id=%d expired\n", __func__, login->id); sbp_targ_dealloc_login(login); } else { - printf("%s: login_id=%d not hold\n", __FUNCTION__, login->id); + printf("%s: login_id=%d not hold\n", __func__, login->id); } } @@ -292,7 +292,7 @@ sbp_targ_post_busreset(void *arg) sc->flags |= F_FREEZED; xpt_freeze_simq(sc->sim, /*count*/1); } else { - printf("%s: already freezed\n", __FUNCTION__); + printf("%s: already freezed\n", __func__); } bzero(unit, sizeof(struct crom_chunk)); @@ -480,7 +480,7 @@ sbp_targ_send_lstate_events(struct sbp_targ_softc *sc, struct ccb_hdr *ccbh; struct ccb_immed_notify *inot; - printf("%s: not implemented yet\n", __FUNCTION__); + printf("%s: not implemented yet\n", __func__); #endif } @@ -512,13 +512,13 @@ sbp_targ_get_orb_info(struct sbp_targ_lstate *lstate, login = lstate->sc->logins[init_id]; if (login == NULL) { - printf("%s: no such login\n", __FUNCTION__); + printf("%s: no such login\n", __func__); return (NULL); } STAILQ_FOREACH(orbi, &login->orbs, link) if (orbi->orb_lo == tag_id) goto found; - printf("%s: orb not found tag_id=0x%08x\n", __FUNCTION__, tag_id); + printf("%s: orb not found tag_id=0x%08x\n", __func__, tag_id); return (NULL); found: return (orbi); @@ -530,7 +530,7 @@ sbp_targ_abort(struct orb_info *orbi) struct orb_info *norbi; for (; orbi != NULL; orbi = norbi) { - printf("%s: status=%d\n", __FUNCTION__, orbi->state); + printf("%s: status=%d\n", __func__, orbi->state); norbi = STAILQ_NEXT(orbi, link); if (orbi->state != ORBI_STATUS_ABORTED) { if (orbi->ccb != NULL) { @@ -555,7 +555,7 @@ sbp_targ_free_orbi(struct fw_xfer *xfer) orbi = (struct orb_info *)xfer->sc; if (xfer->resp != 0) { /* XXX */ - printf("%s: xfer->resp = %d\n", __FUNCTION__, xfer->resp); + printf("%s: xfer->resp = %d\n", __func__, xfer->resp); } free(orbi, M_SBP_TARG); fw_xfer_free(xfer); @@ -577,7 +577,7 @@ sbp_targ_status_FIFO(struct orb_info *orbi, if (xfer == NULL) { /* XXX */ - printf("%s: xfer == NULL\n", __FUNCTION__); + printf("%s: xfer == NULL\n", __func__); } } @@ -597,7 +597,7 @@ sbp_targ_send_status(struct orb_info *orbi, union ccb *ccb) switch (ccb->csio.scsi_status) { case SCSI_STATUS_OK: if (debug) - printf("%s: STATUS_OK\n", __FUNCTION__); + printf("%s: STATUS_OK\n", __func__); sbp_status->len = 1; break; case SCSI_STATUS_CHECK_COND: @@ -608,7 +608,7 @@ sbp_targ_send_status(struct orb_info *orbi, union ccb *ccb) struct scsi_sense_data *sense; if (debug) - printf("%s: STATUS %d\n", __FUNCTION__, + printf("%s: STATUS %d\n", __func__, ccb->csio.scsi_status); sbp_cmd_status = (struct sbp_cmd_status *)&sbp_status->data[0]; sbp_cmd_status->status = ccb->csio.scsi_status; @@ -649,7 +649,7 @@ sbp_targ_send_status(struct orb_info *orbi, union ccb *ccb) break; } default: - printf("%s: unknown scsi status 0x%x\n", __FUNCTION__, + printf("%s: unknown scsi status 0x%x\n", __func__, sbp_status->status); } @@ -669,11 +669,11 @@ sbp_targ_cam_done(struct fw_xfer *xfer) orbi = (struct orb_info *)xfer->sc; if (debug > 1) - printf("%s: resp=%d refcount=%d\n", __FUNCTION__, + printf("%s: resp=%d refcount=%d\n", __func__, xfer->resp, orbi->refcount); if (xfer->resp != 0) { - printf("%s: xfer->resp = %d\n", __FUNCTION__, xfer->resp); + printf("%s: xfer->resp = %d\n", __func__, xfer->resp); orbi->status.resp = SBP_TRANS_FAIL; orbi->status.status = OBJ_DATA | SBE_TIMEOUT/*XXX*/; orbi->status.dead = 1; @@ -686,7 +686,7 @@ sbp_targ_cam_done(struct fw_xfer *xfer) if (orbi->refcount == 0) { if (orbi->state == ORBI_STATUS_ABORTED) { if (debug) - printf("%s: orbi aborted\n", __FUNCTION__); + printf("%s: orbi aborted\n", __func__); sbp_targ_remove_orb_info(orbi->login, orbi); if (orbi->page_table != NULL) free(orbi->page_table, M_SBP_TARG); @@ -756,7 +756,7 @@ sbp_targ_abort_ccb(struct sbp_targ_softc *sc, union ccb *ccb) xpt_done(accb); return (CAM_REQ_CMP); } - printf("%s: not found\n", __FUNCTION__); + printf("%s: not found\n", __func__); return (CAM_PATH_INVALID); } @@ -770,7 +770,7 @@ sbp_targ_xfer_buf(struct orb_info *orbi, u_int offset, char *ptr; if (debug > 1) - printf("%s: offset=%d size=%d\n", __FUNCTION__, offset, size); + printf("%s: offset=%d size=%d\n", __func__, offset, size); ccb_dir = orbi->ccb->ccb_h.flags & CAM_DIR_MASK; ptr = (char *)orbi->ccb->csio.data_ptr + offset; @@ -790,7 +790,7 @@ sbp_targ_xfer_buf(struct orb_info *orbi, u_int offset, dst_hi, dst_lo + off, len, ptr + off, hand); if (xfer == NULL) { - printf("%s: xfer == NULL", __FUNCTION__); + printf("%s: xfer == NULL", __func__); /* XXX what should we do?? */ orbi->refcount --; } @@ -810,7 +810,7 @@ sbp_targ_pt_done(struct fw_xfer *xfer) ccb = orbi->ccb; if (orbi->state == ORBI_STATUS_ABORTED) { if (debug) - printf("%s: orbi aborted\n", __FUNCTION__); + printf("%s: orbi aborted\n", __func__); sbp_targ_remove_orb_info(orbi->login, orbi); free(orbi->page_table, M_SBP_TARG); free(orbi, M_SBP_TARG); @@ -818,7 +818,7 @@ sbp_targ_pt_done(struct fw_xfer *xfer) return; } if (xfer->resp != 0) { - printf("%s: xfer->resp = %d\n", __FUNCTION__, xfer->resp); + printf("%s: xfer->resp = %d\n", __func__, xfer->resp); orbi->status.resp = SBP_TRANS_FAIL; orbi->status.status = OBJ_PT | SBE_TIMEOUT/*XXX*/; orbi->status.dead = 1; @@ -834,7 +834,7 @@ sbp_targ_pt_done(struct fw_xfer *xfer) res = ccb->csio.dxfer_len; offset = 0; if (debug) - printf("%s: dxfer_len=%d\n", __FUNCTION__, res); + printf("%s: dxfer_len=%d\n", __func__, res); orbi->refcount ++; for (p = orbi->page_table, i = orbi->orb4.data_size; i > 0; i --) { t1 = ntohl(*p++); @@ -852,10 +852,10 @@ sbp_targ_pt_done(struct fw_xfer *xfer) } orbi->refcount --; if (orbi->refcount == 0) - printf("%s: refcount == 0\n", __FUNCTION__); + printf("%s: refcount == 0\n", __func__); if (res !=0) /* XXX handle res != 0 case */ - printf("%s: page table is too small(%d)\n", __FUNCTION__, res); + printf("%s: page table is too small(%d)\n", __func__, res); fw_xfer_free(xfer); return; @@ -868,7 +868,7 @@ sbp_targ_fetch_pt(struct orb_info *orbi) if (debug) printf("%s: page_table_size=%d\n", - __FUNCTION__, orbi->orb4.data_size); + __func__, orbi->orb4.data_size); orbi->page_table = malloc(orbi->orb4.data_size*8, M_SBP_TARG, M_NOWAIT); if (orbi->page_table == NULL) goto error; @@ -901,7 +901,7 @@ sbp_targ_action1(struct cam_sim *sim, union ccb *ccb) struct orb_info *orbi; if (debug) - printf("%s: XPT_CONT_TARGET_IO\n", __FUNCTION__); + printf("%s: XPT_CONT_TARGET_IO\n", __func__); if (status != CAM_REQ_CMP) { ccb->ccb_h.status = status; @@ -918,7 +918,7 @@ sbp_targ_action1(struct cam_sim *sim, union ccb *ccb) } if (orbi->state == ORBI_STATUS_ABORTED) { if (debug) - printf("%s: ctio aborted\n", __FUNCTION__); + printf("%s: ctio aborted\n", __func__); sbp_targ_remove_orb_info(orbi->login, orbi); free(orbi, M_SBP_TARG); break; @@ -934,16 +934,16 @@ sbp_targ_action1(struct cam_sim *sim, union ccb *ccb) /* Sanity check */ if (ccb_dir == CAM_DIR_IN && orbi->orb4.dir == 0) - printf("%s: direction mismatch\n", __FUNCTION__); + printf("%s: direction mismatch\n", __func__); /* check page table */ if (ccb_dir != CAM_DIR_NONE && orbi->orb4.page_table_present) { if (debug) printf("%s: page_table_present\n", - __FUNCTION__); + __func__); if (orbi->orb4.page_size != 0) { printf("%s: unsupported pagesize %d != 0\n", - __FUNCTION__, orbi->orb4.page_size); + __func__, orbi->orb4.page_size); ccb->ccb_h.status = CAM_REQ_INVALID; xpt_done(ccb); break; @@ -956,7 +956,7 @@ sbp_targ_action1(struct cam_sim *sim, union ccb *ccb) if (ccb_dir != CAM_DIR_NONE && orbi->orb4.data_size != ccb->csio.dxfer_len) printf("%s: data_size(%d) != dxfer_len(%d)\n", - __FUNCTION__, orbi->orb4.data_size, + __func__, orbi->orb4.data_size, ccb->csio.dxfer_len); if (ccb_dir != CAM_DIR_NONE) @@ -986,7 +986,7 @@ sbp_targ_action1(struct cam_sim *sim, union ccb *ccb) struct sbp_targ_login *login; if (debug) - printf("%s: new atio arrived\n", __FUNCTION__); + printf("%s: new atio arrived\n", __func__); lstate->flags &= ~F_ATIO_STARVED; STAILQ_FOREACH(login, &lstate->logins, link) if ((login->flags & F_ATIO_STARVED) != 0) { @@ -1054,7 +1054,7 @@ sbp_targ_action1(struct cam_sim *sim, union ccb *ccb) break; default: printf("%s: aborting unknown function %d\n", - __FUNCTION__, accb->ccb_h.func_code); + __func__, accb->ccb_h.func_code); ccb->ccb_h.status = CAM_REQ_INVALID; break; } @@ -1063,7 +1063,7 @@ sbp_targ_action1(struct cam_sim *sim, union ccb *ccb) } default: printf("%s: unknown function %d\n", - __FUNCTION__, ccb->ccb_h.func_code); + __func__, ccb->ccb_h.func_code); ccb->ccb_h.status = CAM_REQ_INVALID; xpt_done(ccb); break; @@ -1101,7 +1101,7 @@ sbp_targ_cmd_handler(struct fw_xfer *xfer) orbi = (struct orb_info *)xfer->sc; if (xfer->resp != 0) { - printf("%s: xfer->resp = %d\n", __FUNCTION__, xfer->resp); + printf("%s: xfer->resp = %d\n", __func__, xfer->resp); orbi->status.resp = SBP_TRANS_FAIL; orbi->status.status = OBJ_ORB | SBE_TIMEOUT/*XXX*/; orbi->status.dead = 1; @@ -1116,7 +1116,7 @@ sbp_targ_cmd_handler(struct fw_xfer *xfer) fp = &xfer->recv.hdr; if (orbi->state == ORBI_STATUS_ABORTED) { - printf("%s: aborted\n", __FUNCTION__); + printf("%s: aborted\n", __func__); sbp_targ_remove_orb_info(orbi->login, orbi); free(orbi, M_SBP_TARG); goto done0; @@ -1131,7 +1131,7 @@ sbp_targ_cmd_handler(struct fw_xfer *xfer) orb4 = (struct corb4 *)&orb[4]; if (orb4->rq_fmt != 0) { /* XXX */ - printf("%s: rq_fmt(%d) != 0\n", __FUNCTION__, orb4->rq_fmt); + printf("%s: rq_fmt(%d) != 0\n", __func__, orb4->rq_fmt); } atio = orbi->atio; @@ -1146,7 +1146,7 @@ sbp_targ_cmd_handler(struct fw_xfer *xfer) bytes = (char *)&orb[5]; if (debug) printf("%s: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", - __FUNCTION__, + __func__, bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], bytes[8], bytes[9]); switch (bytes[0] >> 5) { @@ -1178,7 +1178,7 @@ sbp_targ_cmd_handler(struct fw_xfer *xfer) /* next ORB */ if ((orb[0] & (1<<31)) == 0) { if (debug) - printf("%s: fetch next orb\n", __FUNCTION__); + printf("%s: fetch next orb\n", __func__); orbi->status.src = SRC_NEXT_EXISTS; sbp_targ_fetch_orb(orbi->sc, orbi->fwdev, orb[0], orb[1], orbi->login, FETCH_CMD); @@ -1214,7 +1214,7 @@ sbp_targ_get_login(struct sbp_targ_softc *sc, struct fw_device *fwdev, int lun) if (sc->logins[i] == NULL) goto found; - printf("%s: increase MAX_LOGIN\n", __FUNCTION__); + printf("%s: increase MAX_LOGIN\n", __func__); return (NULL); found: @@ -1222,7 +1222,7 @@ found: sizeof(struct sbp_targ_login), M_SBP_TARG, M_NOWAIT | M_ZERO); if (login == NULL) { - printf("%s: malloc failed\n", __FUNCTION__); + printf("%s: malloc failed\n", __func__); return (NULL); } @@ -1250,7 +1250,7 @@ sbp_targ_mgm_handler(struct fw_xfer *xfer) orbi = (struct orb_info *)xfer->sc; if (xfer->resp != 0) { - printf("%s: xfer->resp = %d\n", __FUNCTION__, xfer->resp); + printf("%s: xfer->resp = %d\n", __func__, xfer->resp); orbi->status.resp = SBP_TRANS_FAIL; orbi->status.status = OBJ_ORB | SBE_TIMEOUT/*XXX*/; orbi->status.dead = 1; @@ -1271,7 +1271,7 @@ sbp_targ_mgm_handler(struct fw_xfer *xfer) } orb4 = (struct morb4 *)&orb[4]; if (debug) - printf("%s: %s\n", __FUNCTION__, orb_fun_name[orb4->fun]); + printf("%s: %s\n", __func__, orb_fun_name[orb4->fun]); orbi->status.src = SRC_NO_NEXT; @@ -1302,7 +1302,7 @@ sbp_targ_mgm_handler(struct fw_xfer *xfer) login = sbp_targ_get_login(orbi->sc, orbi->fwdev, lun); if (login == NULL) { printf("%s: sbp_targ_get_login failed\n", - __FUNCTION__); + __func__); orbi->status.dead = 1; orbi->status.status = STATUS_RES_UNAVAIL; orbi->status.len = 1; @@ -1330,25 +1330,25 @@ sbp_targ_mgm_handler(struct fw_xfer *xfer) login->flags &= ~F_HOLD; callout_stop(&login->hold_callout); printf("%s: reconnected id=%d\n", - __FUNCTION__, login->id); + __func__, login->id); } else { orbi->status.dead = 1; orbi->status.status = STATUS_ACCESS_DENY; printf("%s: reconnection faild id=%d\n", - __FUNCTION__, orb4->id); + __func__, orb4->id); } break; case ORB_FUN_LGO: login = orbi->sc->logins[orb4->id]; if (login->fwdev != orbi->fwdev) { - printf("%s: wrong initiator\n", __FUNCTION__); + printf("%s: wrong initiator\n", __func__); break; } sbp_targ_dealloc_login(login); break; default: printf("%s: %s not implemented yet\n", - __FUNCTION__, orb_fun_name[orb4->fun]); + __func__, orb_fun_name[orb4->fun]); break; } orbi->status.len = 1; @@ -1365,14 +1365,14 @@ sbp_targ_pointer_handler(struct fw_xfer *xfer) orbi = (struct orb_info *)xfer->sc; if (xfer->resp != 0) { - printf("%s: xfer->resp = %d\n", __FUNCTION__, xfer->resp); + printf("%s: xfer->resp = %d\n", __func__, xfer->resp); goto done; } orb0 = ntohl(orbi->orb[0]); orb1 = ntohl(orbi->orb[1]); if ((orb0 & (1 << 31)) != 0) { - printf("%s: invalid pointer\n", __FUNCTION__); + printf("%s: invalid pointer\n", __func__); goto done; } sbp_targ_fetch_orb(orbi->login->lstate->sc, orbi->fwdev, @@ -1391,10 +1391,10 @@ sbp_targ_fetch_orb(struct sbp_targ_softc *sc, struct fw_device *fwdev, struct orb_info *orbi; if (debug) - printf("%s: fetch orb %04x:%08x\n", __FUNCTION__, orb_hi, orb_lo); + printf("%s: fetch orb %04x:%08x\n", __func__, orb_hi, orb_lo); orbi = malloc(sizeof(struct orb_info), M_SBP_TARG, M_NOWAIT | M_ZERO); if (orbi == NULL) { - printf("%s: malloc failed\n", __FUNCTION__); + printf("%s: malloc failed\n", __func__); return; } orbi->sc = sc; @@ -1420,7 +1420,7 @@ sbp_targ_fetch_orb(struct sbp_targ_softc *sc, struct fw_device *fwdev, orbi->atio = (struct ccb_accept_tio *) SLIST_FIRST(&login->lstate->accept_tios); if (orbi->atio == NULL) { - printf("%s: no free atio\n", __FUNCTION__); + printf("%s: no free atio\n", __func__); login->lstate->flags |= F_ATIO_STARVED; login->flags |= F_ATIO_STARVED; #if 0 @@ -1443,7 +1443,7 @@ sbp_targ_fetch_orb(struct sbp_targ_softc *sc, struct fw_device *fwdev, sbp_targ_pointer_handler); break; default: - printf("%s: invalid mode %d\n", __FUNCTION__, mode); + printf("%s: invalid mode %d\n", __func__, mode); } } @@ -1454,7 +1454,7 @@ sbp_targ_resp_callback(struct fw_xfer *xfer) int s; if (debug) - printf("%s: xfer=%p\n", __FUNCTION__, xfer); + printf("%s: xfer=%p\n", __func__, xfer); sc = (struct sbp_targ_softc *)xfer->sc; fw_xfer_unload(xfer); xfer->recv.pay_len = SBP_TARG_RECV_LEN; @@ -1488,7 +1488,7 @@ sbp_targ_cmd(struct fw_xfer *xfer, struct fw_device *fwdev, int login_id, switch (reg) { case 0x08: /* ORB_POINTER */ if (debug) - printf("%s: ORB_POINTER\n", __FUNCTION__); + printf("%s: ORB_POINTER\n", __func__); if ((login->flags & F_LINK_ACTIVE) != 0) { if (debug) printf("link active (ORB_POINTER)\n"); @@ -1501,18 +1501,18 @@ sbp_targ_cmd(struct fw_xfer *xfer, struct fw_device *fwdev, int login_id, break; case 0x04: /* AGENT_RESET */ if (debug) - printf("%s: AGENT RESET\n", __FUNCTION__); + printf("%s: AGENT RESET\n", __func__); login->last_hi = 0xffff; login->last_lo = 0xffffffff; sbp_targ_abort(STAILQ_FIRST(&login->orbs)); break; case 0x10: /* DOORBELL */ if (debug) - printf("%s: DOORBELL\n", __FUNCTION__); + printf("%s: DOORBELL\n", __func__); if (login->last_hi == 0xffff && login->last_lo == 0xffffffff) { printf("%s: no previous pointer(DOORBELL)\n", - __FUNCTION__); + __func__); break; } if ((login->flags & F_LINK_ACTIVE) != 0) { @@ -1525,13 +1525,13 @@ sbp_targ_cmd(struct fw_xfer *xfer, struct fw_device *fwdev, int login_id, login, FETCH_POINTER); break; case 0x00: /* AGENT_STATE */ - printf("%s: AGENT_STATE (ignore)\n", __FUNCTION__); + printf("%s: AGENT_STATE (ignore)\n", __func__); break; case 0x14: /* UNSOLICITED_STATE_ENABLE */ - printf("%s: UNSOLICITED_STATE_ENABLE (ignore)\n", __FUNCTION__); + printf("%s: UNSOLICITED_STATE_ENABLE (ignore)\n", __func__); break; default: - printf("%s: invalid register %d\n", __FUNCTION__, reg); + printf("%s: invalid register %d\n", __func__, reg); rtcode = RESP_ADDRESS_ERROR; } @@ -1548,7 +1548,7 @@ sbp_targ_mgm(struct fw_xfer *xfer, struct fw_device *fwdev) fp = &xfer->recv.hdr; if (fp->mode.wreqb.tcode != FWTCODE_WREQB){ - printf("%s: tcode = %d\n", __FUNCTION__, fp->mode.wreqb.tcode); + printf("%s: tcode = %d\n", __func__, fp->mode.wreqb.tcode); return(RESP_TYPE_ERROR); } @@ -1576,7 +1576,7 @@ sbp_targ_recv(struct fw_xfer *xfer) fwdev = fw_noderesolve_nodeid(sc->fd.fc, fp->mode.wreqb.src & 0x3f); if (fwdev == NULL) { printf("%s: cannot resolve nodeid=%d\n", - __FUNCTION__, fp->mode.wreqb.src & 0x3f); + __func__, fp->mode.wreqb.src & 0x3f); rtcode = RESP_TYPE_ERROR; /* XXX */ goto done; } @@ -1591,7 +1591,7 @@ sbp_targ_recv(struct fw_xfer *xfer) done: if (rtcode != 0) - printf("%s: rtcode = %d\n", __FUNCTION__, rtcode); + printf("%s: rtcode = %d\n", __func__, rtcode); sfp = &xfer->send.hdr; xfer->send.spd = 2; /* XXX */ xfer->act.hand = sbp_targ_resp_callback; -- cgit v1.3 From 03161bbcf639dca1600a75bb7cc893dbae0e9483 Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Sat, 22 May 2004 16:14:17 +0000 Subject: Change u_intXX_t to uintXX_t. Change a couple of 'unsigned long's to uint32_t where appropriate. --- sys/dev/firewire/firewire.c | 72 ++++++------- sys/dev/firewire/firewire.h | 106 +++++++++--------- sys/dev/firewire/firewirereg.h | 60 +++++------ sys/dev/firewire/fwcrom.c | 56 +++++----- sys/dev/firewire/fwdev.c | 8 +- sys/dev/firewire/fwmem.c | 30 +++--- sys/dev/firewire/fwmem.h | 16 +-- sys/dev/firewire/fwohci.c | 118 ++++++++++----------- sys/dev/firewire/fwohci_pci.c | 4 +- sys/dev/firewire/fwohcireg.h | 80 +++++++------- sys/dev/firewire/fwohcivar.h | 6 +- sys/dev/firewire/fwphyreg.h | 236 ++++++++++++++++++++--------------------- sys/dev/firewire/iec13213.h | 100 ++++++++--------- sys/dev/firewire/iec68113.h | 88 +++++++-------- sys/dev/firewire/if_fwe.c | 2 +- sys/dev/firewire/sbp.c | 40 +++---- sys/dev/firewire/sbp.h | 50 ++++----- sys/dev/firewire/sbp_targ.c | 74 ++++++------- 18 files changed, 573 insertions(+), 573 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index a16c71cba8d1..89ada479a572 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -108,8 +108,8 @@ static void fw_attach_dev (struct firewire_comm *); #ifdef FW_VMACCESS static void fw_vmaccess (struct fw_xfer *); #endif -struct fw_xfer *asyreqq (struct firewire_comm *, u_int8_t, u_int8_t, u_int8_t, - u_int32_t, u_int32_t, void (*)(struct fw_xfer *)); +struct fw_xfer *asyreqq (struct firewire_comm *, uint8_t, uint8_t, uint8_t, + uint32_t, uint32_t, void (*)(struct fw_xfer *)); static int fw_bmr (struct firewire_comm *); static device_method_t firewire_methods[] = { @@ -686,14 +686,14 @@ fw_busreset(struct firewire_comm *fc) newrom = malloc(CROMSIZE, M_FW, M_NOWAIT | M_ZERO); src = &fc->crom_src_buf->src; - crom_load(src, (u_int32_t *)newrom, CROMSIZE); + crom_load(src, (uint32_t *)newrom, CROMSIZE); if (bcmp(newrom, fc->config_rom, CROMSIZE) != 0) { /* bump generation and reload */ src->businfo.generation ++; /* generation must be between 0x2 and 0xF */ if (src->businfo.generation < 2) src->businfo.generation ++; - crom_load(src, (u_int32_t *)newrom, CROMSIZE); + crom_load(src, (uint32_t *)newrom, CROMSIZE); bcopy(newrom, (void *)fc->config_rom, CROMSIZE); } free(newrom, M_FW); @@ -831,7 +831,7 @@ void fw_init(struct firewire_comm *fc) * To lookup bound process from IEEE1394 address. */ struct fw_bind * -fw_bindlookup(struct firewire_comm *fc, u_int16_t dest_hi, u_int32_t dest_lo) +fw_bindlookup(struct firewire_comm *fc, uint16_t dest_hi, uint32_t dest_lo) { u_int64_t addr; struct fw_bind *tfw; @@ -1135,7 +1135,7 @@ fw_phy_config(struct firewire_comm *fc, int root_node, int gap_count) * Dump self ID. */ static void -fw_print_sid(u_int32_t sid) +fw_print_sid(uint32_t sid) { union fw_self_id *s; s = (union fw_self_id *) &sid; @@ -1151,16 +1151,16 @@ fw_print_sid(u_int32_t sid) /* * To receive self ID. */ -void fw_sidrcv(struct firewire_comm* fc, u_int32_t *sid, u_int len) +void fw_sidrcv(struct firewire_comm* fc, uint32_t *sid, u_int len) { - u_int32_t *p; + uint32_t *p; union fw_self_id *self_id; u_int i, j, node, c_port = 0, i_branch = 0; - fc->sid_cnt = len /(sizeof(u_int32_t) * 2); + fc->sid_cnt = len /(sizeof(uint32_t) * 2); fc->status = FWBUSINIT; fc->max_node = fc->nodeid & 0x3f; - CSRARC(fc, NODE_IDS) = ((u_int32_t)fc->nodeid) << 16; + CSRARC(fc, NODE_IDS) = ((uint32_t)fc->nodeid) << 16; fc->status = FWBUSCYMELECT; fc->topology_map->crc_len = 2; fc->topology_map->generation ++; @@ -1220,19 +1220,19 @@ void fw_sidrcv(struct firewire_comm* fc, u_int32_t *sid, u_int len) device_printf(fc->bdev, "%d nodes", fc->max_node + 1); /* CRC */ fc->topology_map->crc = fw_crc16( - (u_int32_t *)&fc->topology_map->generation, + (uint32_t *)&fc->topology_map->generation, fc->topology_map->crc_len * 4); fc->speed_map->crc = fw_crc16( - (u_int32_t *)&fc->speed_map->generation, + (uint32_t *)&fc->speed_map->generation, fc->speed_map->crc_len * 4); /* byteswap and copy to CSR */ - p = (u_int32_t *)fc->topology_map; + p = (uint32_t *)fc->topology_map; for (i = 0; i <= fc->topology_map->crc_len; i++) CSRARC(fc, TOPO_MAP + i * 4) = htonl(*p++); - p = (u_int32_t *)fc->speed_map; + p = (uint32_t *)fc->speed_map; CSRARC(fc, SPED_MAP) = htonl(*p++); CSRARC(fc, SPED_MAP + 4) = htonl(*p++); - /* don't byte-swap u_int8_t array */ + /* don't byte-swap uint8_t array */ bcopy(p, &CSRARC(fc, SPED_MAP + 8), (fc->speed_map->crc_len - 1)*4); fc->max_hop = fc->max_node - i_branch; @@ -1319,7 +1319,7 @@ fw_bus_explore(struct firewire_comm *fc ) { int err = 0; struct fw_device *fwdev, *pfwdev, *tfwdev; - u_int32_t addr; + uint32_t addr; struct fw_xfer *xfer; struct fw_pkt *fp; @@ -1442,8 +1442,8 @@ done: /* Portable Async. request read quad */ struct fw_xfer * -asyreqq(struct firewire_comm *fc, u_int8_t spd, u_int8_t tl, u_int8_t rt, - u_int32_t addr_hi, u_int32_t addr_lo, +asyreqq(struct firewire_comm *fc, uint8_t spd, uint8_t tl, uint8_t rt, + uint32_t addr_hi, uint32_t addr_lo, void (*hand) (struct fw_xfer*)) { struct fw_xfer *xfer; @@ -1489,7 +1489,7 @@ fw_bus_explore_callback(struct fw_xfer *xfer) struct csrhdr *chdr; struct csrdir *csrd; struct csrreg *csrreg; - u_int32_t offset; + uint32_t offset; if(xfer == NULL) { @@ -1517,9 +1517,9 @@ fw_bus_explore_callback(struct fw_xfer *xfer) rfp = &xfer->recv.hdr; #if 0 { - u_int32_t *qld; + uint32_t *qld; int i; - qld = (u_int32_t *)xfer->recv.buf; + qld = (uint32_t *)xfer->recv.buf; printf("len:%d\n", xfer->recv.len); for( i = 0 ; i <= xfer->recv.len && i < 32; i+= 4){ printf("0x%08x ", rfp->mode.ld[i/4]); @@ -1710,7 +1710,7 @@ fw_get_tlabel(struct firewire_comm *fc, struct fw_xfer *xfer) u_int i; struct tlabel *tl, *tmptl; int s; - static u_int32_t label = 0; + static uint32_t label = 0; s = splfw(); for( i = 0 ; i < 0x40 ; i ++){ @@ -1767,9 +1767,9 @@ fw_rcv_copy(struct fw_rcv_buf *rb) /* special handling for RRESQ */ if (pkt->mode.hdr.tcode == FWTCODE_RRESQ && - p != NULL && res >= sizeof(u_int32_t)) { - *(u_int32_t *)p = pkt->mode.rresq.data; - rb->xfer->recv.pay_len = sizeof(u_int32_t); + p != NULL && res >= sizeof(uint32_t)) { + *(uint32_t *)p = pkt->mode.rresq.data; + rb->xfer->recv.pay_len = sizeof(uint32_t); return; } @@ -1808,9 +1808,9 @@ fw_rcv(struct fw_rcv_buf *rb) int i, len, oldstate; #if 0 { - u_int32_t *qld; + uint32_t *qld; int i; - qld = (u_int32_t *)buf; + qld = (uint32_t *)buf; printf("spd %d len:%d\n", spd, len); for( i = 0 ; i <= len && i < 32; i+= 4){ printf("0x%08x ", ntohl(qld[i/4])); @@ -2108,7 +2108,7 @@ fw_try_bmr(void *arg) static void fw_vmaccess(struct fw_xfer *xfer){ struct fw_pkt *rfp, *sfp = NULL; - u_int32_t *ld = (u_int32_t *)xfer->recv.buf; + uint32_t *ld = (uint32_t *)xfer->recv.buf; printf("vmaccess spd:%2x len:%03x data:%08x %08x %08x %08x\n", xfer->spd, xfer->recv.len, ntohl(ld[0]), ntohl(ld[1]), ntohl(ld[2]), ntohl(ld[3])); @@ -2137,7 +2137,7 @@ fw_vmaccess(struct fw_xfer *xfer){ xfer->send.buf = malloc(12, M_FW, M_NOWAIT); xfer->send.len = 12; sfp->mode.wres.tcode = FWTCODE_WRES; - *((u_int32_t *)(ntohl(rfp->mode.wreqb.dest_lo))) = rfp->mode.wreqq.data; + *((uint32_t *)(ntohl(rfp->mode.wreqb.dest_lo))) = rfp->mode.wreqq.data; sfp->mode.wres.rtcode = 0; break; case FWTCODE_RREQB: @@ -2145,7 +2145,7 @@ fw_vmaccess(struct fw_xfer *xfer){ xfer->send.len = 16 + ntohs(rfp->mode.rreqb.len); sfp = (struct fw_pkt *)xfer->send.buf; bcopy((caddr_t)ntohl(rfp->mode.rreqb.dest_lo), - sfp->mode.rresb.payload, (u_int16_t)ntohs(rfp->mode.rreqb.len)); + sfp->mode.rresb.payload, (uint16_t)ntohs(rfp->mode.rreqb.len)); sfp->mode.rresb.tcode = FWTCODE_RRESB; sfp->mode.rresb.len = rfp->mode.rreqb.len; sfp->mode.rresb.rtcode = 0; @@ -2155,7 +2155,7 @@ fw_vmaccess(struct fw_xfer *xfer){ xfer->send.buf = malloc(16, M_FW, M_NOWAIT); xfer->send.len = 16; sfp = (struct fw_pkt *)xfer->send.buf; - sfp->mode.rresq.data = *(u_int32_t *)(ntohl(rfp->mode.rreqq.dest_lo)); + sfp->mode.rresq.data = *(uint32_t *)(ntohl(rfp->mode.rreqq.dest_lo)); sfp->mode.wres.tcode = FWTCODE_RRESQ; sfp->mode.rresb.rtcode = 0; break; @@ -2180,9 +2180,9 @@ fw_vmaccess(struct fw_xfer *xfer){ /* * CRC16 check-sum for IEEE1394 register blocks. */ -u_int16_t -fw_crc16(u_int32_t *ptr, u_int32_t len){ - u_int32_t i, sum, crc = 0; +uint16_t +fw_crc16(uint32_t *ptr, uint32_t len){ + uint32_t i, sum, crc = 0; int shift; len = (len + 3) & ~3; for(i = 0 ; i < len ; i+= 4){ @@ -2192,7 +2192,7 @@ fw_crc16(u_int32_t *ptr, u_int32_t len){ } crc &= 0xffff; } - return((u_int16_t) crc); + return((uint16_t) crc); } static int @@ -2201,7 +2201,7 @@ fw_bmr(struct firewire_comm *fc) struct fw_device fwdev; union fw_self_id *self_id; int cmstr; - u_int32_t quad; + uint32_t quad; /* Check to see if the current root node is cycle master capable */ self_id = fw_find_self_id(fc, fc->max_node); diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index f00d696153b9..04c62873730e 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -55,8 +55,8 @@ struct fw_isobufreq { }; struct fw_addr { - unsigned long hi; - unsigned long lo; + uint32_t hi; + uint32_t lo; }; struct fw_asybindreq { @@ -65,8 +65,8 @@ struct fw_asybindreq { }; struct fw_reg_req_t { - unsigned long addr; - unsigned long data; + uint32_t addr; + uint32_t data; }; #define MAXREC(x) (2 << (x)) @@ -106,39 +106,39 @@ struct fw_reg_req_t { #define FWP_TL_VALID (1 << 7) struct fw_isohdr { - u_int32_t hdr[1]; + uint32_t hdr[1]; }; struct fw_asyhdr { - u_int32_t hdr[4]; + uint32_t hdr[4]; }; #if BYTE_ORDER == BIG_ENDIAN -#define BIT4x2(x,y) u_int8_t x:4, y:4 -#define BIT16x2(x,y) u_int32_t x:16, y:16 +#define BIT4x2(x,y) uint8_t x:4, y:4 +#define BIT16x2(x,y) uint32_t x:16, y:16 #else -#define BIT4x2(x,y) u_int8_t y:4, x:4 -#define BIT16x2(x,y) u_int32_t y:16, x:16 +#define BIT4x2(x,y) uint8_t y:4, x:4 +#define BIT16x2(x,y) uint32_t y:16, x:16 #endif #if BYTE_ORDER == BIG_ENDIAN -#define COMMON_HDR(a,b,c,d) u_int32_t a:16,b:8,c:4,d:4 -#define COMMON_RES(a,b,c,d) u_int32_t a:16,b:4,c:4,d:8 +#define COMMON_HDR(a,b,c,d) uint32_t a:16,b:8,c:4,d:4 +#define COMMON_RES(a,b,c,d) uint32_t a:16,b:4,c:4,d:8 #else -#define COMMON_HDR(a,b,c,d) u_int32_t d:4,c:4,b:8,a:16 -#define COMMON_RES(a,b,c,d) u_int32_t d:8,c:4,b:4,a:16 +#define COMMON_HDR(a,b,c,d) uint32_t d:4,c:4,b:8,a:16 +#define COMMON_RES(a,b,c,d) uint32_t d:8,c:4,b:4,a:16 #endif struct fw_pkt { union { - u_int32_t ld[0]; + uint32_t ld[0]; struct { COMMON_HDR(, , tcode, ); } common; struct { COMMON_HDR(len, chtag, tcode, sy); - u_int32_t payload[0]; + uint32_t payload[0]; } stream; struct { COMMON_HDR(dst, tlrt, tcode, pri); @@ -147,64 +147,64 @@ struct fw_pkt { struct { COMMON_HDR(dst, tlrt, tcode, pri); BIT16x2(src, dest_hi); - u_int32_t dest_lo; + uint32_t dest_lo; } rreqq; struct { COMMON_HDR(dst, tlrt, tcode, pri); COMMON_RES(src, rtcode, , ); - u_int32_t :32; + uint32_t :32; } wres; struct { COMMON_HDR(dst, tlrt, tcode, pri); BIT16x2(src, dest_hi); - u_int32_t dest_lo; + uint32_t dest_lo; BIT16x2(len, extcode); } rreqb; struct { COMMON_HDR(dst, tlrt, tcode, pri); BIT16x2(src, dest_hi); - u_int32_t dest_lo; - u_int32_t data; + uint32_t dest_lo; + uint32_t data; } wreqq; struct { COMMON_HDR(dst, tlrt, tcode, pri); BIT16x2(src, dest_hi); - u_int32_t dest_lo; - u_int32_t data; + uint32_t dest_lo; + uint32_t data; } cyc; struct { COMMON_HDR(dst, tlrt, tcode, pri); COMMON_RES(src, rtcode, , ); - u_int32_t :32; - u_int32_t data; + uint32_t :32; + uint32_t data; } rresq; struct { COMMON_HDR(dst, tlrt, tcode, pri); BIT16x2(src, dest_hi); - u_int32_t dest_lo; + uint32_t dest_lo; BIT16x2(len, extcode); - u_int32_t payload[0]; + uint32_t payload[0]; } wreqb; struct { COMMON_HDR(dst, tlrt, tcode, pri); BIT16x2(src, dest_hi); - u_int32_t dest_lo; + uint32_t dest_lo; BIT16x2(len, extcode); - u_int32_t payload[0]; + uint32_t payload[0]; } lreq; struct { COMMON_HDR(dst, tlrt, tcode, pri); COMMON_RES(src, rtcode, , ); - u_int32_t :32; + uint32_t :32; BIT16x2(len, extcode); - u_int32_t payload[0]; + uint32_t payload[0]; } rresb; struct { COMMON_HDR(dst, tlrt, tcode, pri); COMMON_RES(src, rtcode, , ); - u_int32_t :32; + uint32_t :32; BIT16x2(len, extcode); - u_int32_t payload[0]; + uint32_t payload[0]; } lres; } mode; }; @@ -237,7 +237,7 @@ struct fw_pkt { #define EXTCODE_WRAP_ADD 6 struct fw_eui64 { - u_int32_t hi, lo; + uint32_t hi, lo; }; #define FW_EUI64_BYTE(eui, x) \ ((((x)<4)? \ @@ -261,19 +261,19 @@ struct fw_asyreq { }dst; }req; struct fw_pkt pkt; - u_int32_t data[512]; + uint32_t data[512]; }; struct fw_devinfo { struct fw_eui64 eui; - u_int16_t dst; - u_int16_t status; + uint16_t dst; + uint16_t status; }; #define FW_MAX_DEVLST 70 struct fw_devlstreq { - u_int16_t n; - u_int16_t info_len; + uint16_t n; + uint16_t info_len; struct fw_devinfo dev[FW_MAX_DEVLST]; }; @@ -284,7 +284,7 @@ struct fw_devlstreq { #if BYTE_ORDER == BIG_ENDIAN union fw_self_id { struct { - u_int32_t id:2, + uint32_t id:2, phy_id:6, sequel:1, link_active:1, @@ -300,7 +300,7 @@ union fw_self_id { more_packets:1; } p0; struct { - u_int32_t + uint32_t id:2, phy_id:6, sequel:1, @@ -321,7 +321,7 @@ union fw_self_id { #else union fw_self_id { struct { - u_int32_t more_packets:1, + uint32_t more_packets:1, initiated_reset:1, port2:2, port1:2, @@ -337,7 +337,7 @@ union fw_self_id { id:2; } p0; struct { - u_int32_t more_packets:1, + uint32_t more_packets:1, reserved1:1, porth:2, portg:2, @@ -358,19 +358,19 @@ union fw_self_id { struct fw_topology_map { - u_int32_t crc:16, - crc_len:16; - u_int32_t generation; - u_int32_t self_id_count:16, - node_count:16; + uint32_t crc:16, + crc_len:16; + uint32_t generation; + uint32_t self_id_count:16, + node_count:16; union fw_self_id self_id[4*64]; }; struct fw_speed_map { - u_int32_t crc:16, - crc_len:16; - u_int32_t generation; - u_int8_t speed[64][64]; + uint32_t crc:16, + crc_len:16; + uint32_t generation; + uint8_t speed[64][64]; }; struct fw_crom_buf { @@ -405,7 +405,7 @@ struct fw_crom_buf { #define FWOHCI_RDPHYREG _IOWR('S', 82, struct fw_reg_req_t) #define FWOHCI_WRPHYREG _IOWR('S', 83, struct fw_reg_req_t) -#define DUMPDMA _IOWR('S', 82, u_int32_t) +#define DUMPDMA _IOWR('S', 82, uint32_t) #ifdef _KERNEL diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 7253798fef99..5b433879e268 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -51,19 +51,19 @@ typedef struct proc fw_proc; #define splfw splimp struct fw_device{ - u_int16_t dst; + uint16_t dst; struct fw_eui64 eui; - u_int8_t speed; - u_int8_t maxrec; - u_int8_t nport; - u_int8_t power; + uint8_t speed; + uint8_t maxrec; + uint8_t nport; + uint8_t power; #define CSRROMOFF 0x400 #define CSRROMSIZE 0x400 int rommax; /* offset from 0xffff f000 0000 */ - u_int32_t csrrom[CSRROMSIZE/4]; + uint32_t csrrom[CSRROMSIZE/4]; int rcnt; struct firewire_comm *fc; - u_int32_t status; + uint32_t status; #define FWDEVINIT 1 #define FWDEVATTACHED 2 #define FWDEVINVAL 3 @@ -101,7 +101,7 @@ struct tcode_info { struct firewire_comm{ device_t dev; device_t bdev; - u_int16_t busid:10, + uint16_t busid:10, nodeid:6; u_int mode; u_int nport; @@ -113,7 +113,7 @@ struct firewire_comm{ u_int max_asyretry; #define FWPHYASYST (1 << 0) u_int retry_count; - u_int32_t ongobus:10, + uint32_t ongobus:10, ongonode:6, ongoaddr:16; struct fw_device *ongodev; @@ -121,7 +121,7 @@ struct firewire_comm{ #define FWMAXCSRDIR 16 SLIST_HEAD(, csrdir) ongocsr; SLIST_HEAD(, csrdir) csrfree; - u_int32_t status; + uint32_t status; #define FWBUSNOTREADY (-1) #define FWBUSRESET 0 #define FWBUSINIT 1 @@ -141,9 +141,9 @@ struct firewire_comm{ STAILQ_HEAD(, fw_device) devices; u_int sid_cnt; #define CSRSIZE 0x4000 - u_int32_t csr_arc[CSRSIZE/4]; + uint32_t csr_arc[CSRSIZE/4]; #define CROMSIZE 0x400 - u_int32_t *config_rom; + uint32_t *config_rom; struct crom_src_buf *crom_src_buf; struct crom_src *crom_src; struct crom_chunk *crom_root; @@ -153,9 +153,9 @@ struct firewire_comm{ struct callout bmr_callout; struct callout timeout_callout; struct callout retry_probe_callout; - u_int32_t (*cyctimer) (struct firewire_comm *); + uint32_t (*cyctimer) (struct firewire_comm *); void (*ibr) (struct firewire_comm *); - u_int32_t (*set_bmr) (struct firewire_comm *, u_int32_t); + uint32_t (*set_bmr) (struct firewire_comm *, uint32_t); int (*ioctl) (dev_t, u_long, caddr_t, int, fw_proc *); int (*irx_enable) (struct firewire_comm *, int); int (*irx_disable) (struct firewire_comm *, int); @@ -164,16 +164,16 @@ struct firewire_comm{ void (*timeout) (void *); void (*poll) (struct firewire_comm *, int, int); void (*set_intr) (struct firewire_comm *, int); - void (*irx_post) (struct firewire_comm *, u_int32_t *); - void (*itx_post) (struct firewire_comm *, u_int32_t *); + void (*irx_post) (struct firewire_comm *, uint32_t *); + void (*itx_post) (struct firewire_comm *, uint32_t *); struct tcode_info *tcode; bus_dma_tag_t dmat; }; #define CSRARC(sc, offset) ((sc)->csr_arc[(offset)/4]) struct csrdir{ - u_int32_t ongoaddr; - u_int32_t off; + uint32_t ongoaddr; + uint32_t off; SLIST_ENTRY(csrdir) link; }; @@ -234,8 +234,8 @@ struct fw_bind{ #define FWACT_NULL 0 #define FWACT_XFER 2 #define FWACT_CH 3 - u_int8_t act_type; - u_int8_t sub; + uint8_t act_type; + uint8_t sub; }; struct fw_xfer{ @@ -251,18 +251,18 @@ struct fw_xfer{ #define FWXF_SENTERR 4 #define FWXF_BUSY 8 #define FWXF_RCVD 10 - u_int8_t state; - u_int8_t retry; - u_int8_t tl; + uint8_t state; + uint8_t retry; + uint8_t tl; void (*retry_req) (struct fw_xfer *); union{ void (*hand) (struct fw_xfer *); } act; struct { struct fw_pkt hdr; - u_int32_t *payload; - u_int16_t pay_len; - u_int8_t spd; + uint32_t *payload; + uint16_t pay_len; + uint8_t spd; } send, recv; struct mbuf *mbuf; STAILQ_ENTRY(fw_xfer) link; @@ -274,10 +274,10 @@ struct fw_rcv_buf { struct fw_xfer *xfer; struct iovec *vec; u_int nvec; - u_int8_t spd; + uint8_t spd; }; -void fw_sidrcv (struct firewire_comm *, u_int32_t *, u_int); +void fw_sidrcv (struct firewire_comm *, uint32_t *, u_int); void fw_rcv (struct fw_rcv_buf *); void fw_xfer_unload ( struct fw_xfer*); void fw_xfer_free_buf ( struct fw_xfer*); @@ -292,14 +292,14 @@ int fw_bindadd (struct firewire_comm *, struct fw_bind *); int fw_bindremove (struct firewire_comm *, struct fw_bind *); int fw_asyreq (struct firewire_comm *, int, struct fw_xfer*); void fw_busreset (struct firewire_comm *); -u_int16_t fw_crc16 (u_int32_t *, u_int32_t); +uint16_t fw_crc16 (uint32_t *, uint32_t); void fw_xfer_timeout (void *); void fw_xfer_done (struct fw_xfer *); void fw_asy_callback (struct fw_xfer *); void fw_asy_callback_free (struct fw_xfer *); struct fw_device *fw_noderesolve_nodeid (struct firewire_comm *, int); struct fw_device *fw_noderesolve_eui64 (struct firewire_comm *, struct fw_eui64 *); -struct fw_bind *fw_bindlookup (struct firewire_comm *, u_int16_t, u_int32_t); +struct fw_bind *fw_bindlookup (struct firewire_comm *, uint16_t, uint32_t); void fw_drain_txq (struct firewire_comm *); int fwdev_makedev (struct firewire_softc *); int fwdev_destroydev (struct firewire_softc *); diff --git a/sys/dev/firewire/fwcrom.c b/sys/dev/firewire/fwcrom.c index 25524c0f209c..4c09075a936f 100644 --- a/sys/dev/firewire/fwcrom.c +++ b/sys/dev/firewire/fwcrom.c @@ -61,11 +61,11 @@ __FBSDID("$FreeBSD$"); #include #endif -#define MAX_ROM (1024 - sizeof(u_int32_t) * 5) +#define MAX_ROM (1024 - sizeof(uint32_t) * 5) #define CROM_END(cc) ((vm_offset_t)(cc)->stack[0].dir + MAX_ROM - 1) void -crom_init_context(struct crom_context *cc, u_int32_t *p) +crom_init_context(struct crom_context *cc, uint32_t *p) { struct csrhdr *hdr; @@ -138,7 +138,7 @@ check: struct csrreg * -crom_search_key(struct crom_context *cc, u_int8_t key) +crom_search_key(struct crom_context *cc, uint8_t key) { struct csrreg *reg; @@ -152,7 +152,7 @@ crom_search_key(struct crom_context *cc, u_int8_t key) } int -crom_has_specver(u_int32_t *p, u_int32_t spec, u_int32_t ver) +crom_has_specver(uint32_t *p, uint32_t spec, uint32_t ver) { struct csrreg *reg; struct crom_context c, *cc; @@ -183,7 +183,7 @@ crom_parse_text(struct crom_context *cc, char *buf, int len) { struct csrreg *reg; struct csrtext *textleaf; - u_int32_t *bp; + uint32_t *bp; int i, qlen; static char *nullstr = "(null)"; @@ -205,7 +205,7 @@ crom_parse_text(struct crom_context *cc, char *buf, int len) /* XXX should check spec and type */ - bp = (u_int32_t *)&buf[0]; + bp = (uint32_t *)&buf[0]; qlen = textleaf->crc_len - 2; if (len < qlen * 4) qlen = len/4; @@ -218,11 +218,11 @@ crom_parse_text(struct crom_context *cc, char *buf, int len) buf[qlen * 4] = 0; } -u_int16_t -crom_crc(u_int32_t *ptr, int len) +uint16_t +crom_crc(uint32_t *ptr, int len) { int i, shift; - u_int32_t data, sum, crc = 0; + uint32_t data, sum, crc = 0; for (i = 0; i < len; i++) { data = ptr[i]; @@ -232,12 +232,12 @@ crom_crc(u_int32_t *ptr, int len) } crc &= 0xffff; } - return((u_int16_t) crc); + return((uint16_t) crc); } #ifndef _KERNEL static void -crom_desc_specver(u_int32_t spec, u_int32_t ver, char *buf, int len) +crom_desc_specver(uint32_t spec, uint32_t ver, char *buf, int len) { char *s = NULL; @@ -295,7 +295,7 @@ crom_desc(struct crom_context *cc, char *buf, int len) struct csrreg *reg; struct csrdirectory *dir; char *desc, st; - u_int16_t crc; + uint16_t crc; reg = crom_get(cc); switch (reg->key & CSRTYPE_MASK) { @@ -316,7 +316,7 @@ crom_desc(struct crom_context *cc, char *buf, int len) /* XXX fall through */ case CSRTYPE_D: dir = (struct csrdirectory *) (reg + reg->val); - crc = crom_crc((u_int32_t *)&dir->entry[0], dir->crc_len); + crc = crom_crc((uint32_t *)&dir->entry[0], dir->crc_len); len -= snprintf(buf, len, "len=%d crc=0x%04x(%s) ", dir->crc_len, dir->crc, (crc == dir->crc) ? "OK" : "NG"); @@ -386,7 +386,7 @@ crom_desc(struct crom_context *cc, char *buf, int len) #if defined(_KERNEL) || defined(TEST) int -crom_add_quad(struct crom_chunk *chunk, u_int32_t entry) +crom_add_quad(struct crom_chunk *chunk, uint32_t entry) { int index; @@ -404,12 +404,12 @@ int crom_add_entry(struct crom_chunk *chunk, int key, int val) { struct csrreg *reg; - u_int32_t i; + uint32_t i; reg = (struct csrreg *)&i; reg->key = key; reg->val = val; - return(crom_add_quad(chunk, (u_int32_t) i)); + return(crom_add_quad(chunk, (uint32_t) i)); } int @@ -439,7 +439,7 @@ crom_add_simple_text(struct crom_src *src, struct crom_chunk *parent, struct crom_chunk *chunk, char *buf) { struct csrtext *tl; - u_int32_t *p; + uint32_t *p; int len, i; char t[MAX_TEXT]; @@ -454,37 +454,37 @@ crom_add_simple_text(struct crom_src *src, struct crom_chunk *parent, } tl = (struct csrtext *) &chunk->data; - tl->crc_len = howmany(sizeof(struct csrtext) + len, sizeof(u_int32_t)); + tl->crc_len = howmany(sizeof(struct csrtext) + len, sizeof(uint32_t)); tl->spec_id = 0; tl->spec_type = 0; tl->lang_id = 0; - bzero(&t[0], roundup2(len, sizeof(u_int32_t))); + bzero(&t[0], roundup2(len, sizeof(uint32_t))); bcopy(buf, &t[0], len); - p = (u_int32_t *)&t[0]; - for (i = 0; i < howmany(len, sizeof(u_int32_t)); i ++) + p = (uint32_t *)&t[0]; + for (i = 0; i < howmany(len, sizeof(uint32_t)); i ++) tl->text[i] = ntohl(*p++); return (crom_add_chunk(src, parent, chunk, CROM_TEXTLEAF)); } static int -crom_copy(u_int32_t *src, u_int32_t *dst, int *offset, int len, int maxlen) +crom_copy(uint32_t *src, uint32_t *dst, int *offset, int len, int maxlen) { if (*offset + len > maxlen) { printf("Config. ROM is too large for the buffer\n"); return(-1); } - bcopy(src, (char *)(dst + *offset), len * sizeof(u_int32_t)); + bcopy(src, (char *)(dst + *offset), len * sizeof(uint32_t)); *offset += len; return(0); } int -crom_load(struct crom_src *src, u_int32_t *buf, int maxlen) +crom_load(struct crom_src *src, uint32_t *buf, int maxlen) { struct crom_chunk *chunk, *parent; struct csrhdr *hdr; #ifdef _KERNEL - u_int32_t *ptr; + uint32_t *ptr; int i; #endif int count, offset; @@ -509,14 +509,14 @@ crom_load(struct crom_src *src, u_int32_t *buf, int maxlen) /* Calculate CRC and dump to the buffer */ len = 1 + src->hdr.info_len; count = 0; - if (crom_copy((u_int32_t *)&src->hdr, buf, &count, len, maxlen) < 0) + if (crom_copy((uint32_t *)&src->hdr, buf, &count, len, maxlen) < 0) return(-1); STAILQ_FOREACH(chunk, &src->chunk_list, link) { chunk->data.crc = crom_crc(&chunk->data.buf[0], chunk->data.crc_len); len = 1 + chunk->data.crc_len; - if (crom_copy((u_int32_t *)&chunk->data, buf, + if (crom_copy((uint32_t *)&chunk->data, buf, &count, len, maxlen) < 0) return(-1); } @@ -543,7 +543,7 @@ main () { struct crom_src src; struct crom_chunk root,unit1,unit2,unit3; struct crom_chunk text1,text2,text3,text4,text5,text6,text7; - u_int32_t buf[256], *p; + uint32_t buf[256], *p; int i; bzero(&src, sizeof(src)); diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index ae736c2969ba..29c025b83da7 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -128,8 +128,8 @@ fwdev_allocbuf(struct firewire_comm *fc, struct fw_xferq *q, if (q->bulkxfer == NULL) return(ENOMEM); - b->psize = roundup2(b->psize, sizeof(u_int32_t)); - q->buf = fwdma_malloc_multiseg(fc, sizeof(u_int32_t), + b->psize = roundup2(b->psize, sizeof(uint32_t)); + q->buf = fwdma_malloc_multiseg(fc, sizeof(uint32_t), b->psize, b->nchunk * b->npacket, BUS_DMA_WAITOK); if (q->buf == NULL) { @@ -347,7 +347,7 @@ readloop: return err; } err = uiomove((caddr_t)fp, - fp->mode.stream.len + sizeof(u_int32_t), uio); + fp->mode.stream.len + sizeof(uint32_t), uio); ir->queued ++; if(ir->queued >= ir->bnpacket){ s = splfw(); @@ -694,7 +694,7 @@ out: ptr = malloc(CROMSIZE, M_FW, M_WAITOK); len = CROMSIZE; for (i = 0; i < CROMSIZE/4; i++) - ((u_int32_t *)ptr)[i] + ((uint32_t *)ptr)[i] = ntohl(sc->fc->config_rom[i]); } else { /* found */ diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index a6c81a2449fa..c10a07893342 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -127,9 +127,9 @@ struct fw_xfer * fwmem_read_quad( struct fw_device *fwdev, caddr_t sc, - u_int8_t spd, - u_int16_t dst_hi, - u_int32_t dst_lo, + uint8_t spd, + uint16_t dst_hi, + uint32_t dst_lo, void *data, void (*hand)(struct fw_xfer *)) { @@ -147,7 +147,7 @@ fwmem_read_quad( fp->mode.rreqq.dest_lo = dst_lo; xfer->send.payload = NULL; - xfer->recv.payload = (u_int32_t *)data; + xfer->recv.payload = (uint32_t *)data; if (fwmem_debug) printf("fwmem_read_quad: %d %04x:%08x\n", fwdev->dst, @@ -164,9 +164,9 @@ struct fw_xfer * fwmem_write_quad( struct fw_device *fwdev, caddr_t sc, - u_int8_t spd, - u_int16_t dst_hi, - u_int32_t dst_lo, + uint8_t spd, + uint16_t dst_hi, + uint32_t dst_lo, void *data, void (*hand)(struct fw_xfer *)) { @@ -181,13 +181,13 @@ fwmem_write_quad( fp->mode.wreqq.tcode = FWTCODE_WREQQ; fp->mode.wreqq.dest_hi = dst_hi; fp->mode.wreqq.dest_lo = dst_lo; - fp->mode.wreqq.data = *(u_int32_t *)data; + fp->mode.wreqq.data = *(uint32_t *)data; xfer->send.payload = xfer->recv.payload = NULL; if (fwmem_debug) printf("fwmem_write_quad: %d %04x:%08x %08x\n", fwdev->dst, - dst_hi, dst_lo, *(u_int32_t *)data); + dst_hi, dst_lo, *(uint32_t *)data); if (fw_asyreq(xfer->fc, -1, xfer) == 0) return xfer; @@ -200,9 +200,9 @@ struct fw_xfer * fwmem_read_block( struct fw_device *fwdev, caddr_t sc, - u_int8_t spd, - u_int16_t dst_hi, - u_int32_t dst_lo, + uint8_t spd, + uint16_t dst_hi, + uint32_t dst_lo, int len, void *data, void (*hand)(struct fw_xfer *)) @@ -238,9 +238,9 @@ struct fw_xfer * fwmem_write_block( struct fw_device *fwdev, caddr_t sc, - u_int8_t spd, - u_int16_t dst_hi, - u_int32_t dst_lo, + uint8_t spd, + uint16_t dst_hi, + uint32_t dst_lo, int len, void *data, void (*hand)(struct fw_xfer *)) diff --git a/sys/dev/firewire/fwmem.h b/sys/dev/firewire/fwmem.h index f9442bb9123b..f8188d10aa25 100644 --- a/sys/dev/firewire/fwmem.h +++ b/sys/dev/firewire/fwmem.h @@ -34,14 +34,14 @@ * $FreeBSD$ */ -struct fw_xfer *fwmem_read_quad(struct fw_device *, caddr_t, u_int8_t, - u_int16_t, u_int32_t, void *, void (*)(struct fw_xfer *)); -struct fw_xfer *fwmem_write_quad(struct fw_device *, caddr_t, u_int8_t, - u_int16_t, u_int32_t, void *, void (*)(struct fw_xfer *)); -struct fw_xfer *fwmem_read_block(struct fw_device *, caddr_t, u_int8_t, - u_int16_t, u_int32_t, int, void *, void (*)(struct fw_xfer *)); -struct fw_xfer *fwmem_write_block(struct fw_device *, caddr_t, u_int8_t, - u_int16_t, u_int32_t, int, void *, void (*)(struct fw_xfer *)); +struct fw_xfer *fwmem_read_quad(struct fw_device *, caddr_t, uint8_t, + uint16_t, uint32_t, void *, void (*)(struct fw_xfer *)); +struct fw_xfer *fwmem_write_quad(struct fw_device *, caddr_t, uint8_t, + uint16_t, uint32_t, void *, void (*)(struct fw_xfer *)); +struct fw_xfer *fwmem_read_block(struct fw_device *, caddr_t, uint8_t, + uint16_t, uint32_t, int, void *, void (*)(struct fw_xfer *)); +struct fw_xfer *fwmem_write_block(struct fw_device *, caddr_t, uint8_t, + uint16_t, uint32_t, int, void *, void (*)(struct fw_xfer *)); d_open_t fwmem_open; d_close_t fwmem_close; diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index ee9a3581a1f2..8915d72e1687 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -94,7 +94,7 @@ char fwohcicode[32][0x20]={ #define MAX_SPEED 3 extern char *linkspeed[]; -u_int32_t tagbit[4] = { 1 << 28, 1 << 29, 1 << 30, 1 << 31}; +uint32_t tagbit[4] = { 1 << 28, 1 << 29, 1 << 30, 1 << 31}; static struct tcode_info tinfo[] = { /* hdr_len block flag*/ @@ -130,14 +130,14 @@ static void fwohci_txd (struct fwohci_softc *, struct fwohci_dbch *); static void fwohci_start_atq (struct firewire_comm *); static void fwohci_start_ats (struct firewire_comm *); static void fwohci_start (struct fwohci_softc *, struct fwohci_dbch *); -static u_int32_t fwphy_wrdata ( struct fwohci_softc *, u_int32_t, u_int32_t); -static u_int32_t fwphy_rddata ( struct fwohci_softc *, u_int32_t); +static uint32_t fwphy_wrdata ( struct fwohci_softc *, uint32_t, uint32_t); +static uint32_t fwphy_rddata ( struct fwohci_softc *, uint32_t); static int fwohci_rx_enable (struct fwohci_softc *, struct fwohci_dbch *); static int fwohci_tx_enable (struct fwohci_softc *, struct fwohci_dbch *); static int fwohci_irx_enable (struct firewire_comm *, int); static int fwohci_irx_disable (struct firewire_comm *, int); #if BYTE_ORDER == BIG_ENDIAN -static void fwohci_irx_post (struct firewire_comm *, u_int32_t *); +static void fwohci_irx_post (struct firewire_comm *, uint32_t *); #endif static int fwohci_itxbuf_enable (struct firewire_comm *, int); static int fwohci_itx_disable (struct firewire_comm *, int); @@ -146,10 +146,10 @@ static void fwohci_set_intr (struct firewire_comm *, int); static int fwohci_add_rx_buf (struct fwohci_dbch *, struct fwohcidb_tr *, int, struct fwdma_alloc *); static int fwohci_add_tx_buf (struct fwohci_dbch *, struct fwohcidb_tr *, int); -static void dump_db (struct fwohci_softc *, u_int32_t); -static void print_db (struct fwohcidb_tr *, struct fwohcidb *, u_int32_t , u_int32_t); -static void dump_dma (struct fwohci_softc *, u_int32_t); -static u_int32_t fwohci_cyctimer (struct firewire_comm *); +static void dump_db (struct fwohci_softc *, uint32_t); +static void print_db (struct fwohcidb_tr *, struct fwohcidb *, uint32_t , uint32_t); +static void dump_dma (struct fwohci_softc *, uint32_t); +static uint32_t fwohci_cyctimer (struct firewire_comm *); static void fwohci_rbuf_update (struct fwohci_softc *, int); static void fwohci_tbuf_update (struct fwohci_softc *, int); void fwohci_txbufdb (struct fwohci_softc *, int , struct fw_bulkxfer *); @@ -258,10 +258,10 @@ d_ioctl_t fwohci_ioctl; /* * Communication with PHY device */ -static u_int32_t -fwphy_wrdata( struct fwohci_softc *sc, u_int32_t addr, u_int32_t data) +static uint32_t +fwphy_wrdata( struct fwohci_softc *sc, uint32_t addr, uint32_t data) { - u_int32_t fun; + uint32_t fun; addr &= 0xf; data &= 0xff; @@ -273,12 +273,12 @@ fwphy_wrdata( struct fwohci_softc *sc, u_int32_t addr, u_int32_t data) return(fwphy_rddata( sc, addr)); } -static u_int32_t +static uint32_t fwohci_set_bus_manager(struct firewire_comm *fc, u_int node) { struct fwohci_softc *sc = (struct fwohci_softc *)fc; int i; - u_int32_t bm; + uint32_t bm; #define OHCI_CSR_DATA 0x0c #define OHCI_CSR_COMP 0x10 @@ -300,10 +300,10 @@ fwohci_set_bus_manager(struct firewire_comm *fc, u_int node) return(bm); } -static u_int32_t +static uint32_t fwphy_rddata(struct fwohci_softc *sc, u_int addr) { - u_int32_t fun, stat; + uint32_t fun, stat; u_int i, retry = 0; addr &= 0xf; @@ -352,7 +352,7 @@ fwohci_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) int unit = DEV2UNIT(dev); int err = 0; struct fw_reg_req_t *reg = (struct fw_reg_req_t *) data; - u_int32_t *dmach = (u_int32_t *) data; + uint32_t *dmach = (uint32_t *) data; sc = devclass_get_softc(firewire_devclass, unit); if(sc == NULL){ @@ -413,7 +413,7 @@ fwohci_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) static int fwohci_probe_phy(struct fwohci_softc *sc, device_t dev) { - u_int32_t reg, reg2; + uint32_t reg, reg2; int e1394a = 1; /* * probe PHY parameters @@ -488,7 +488,7 @@ void fwohci_reset(struct fwohci_softc *sc, device_t dev) { int i, max_rec, speed; - u_int32_t reg, reg2; + uint32_t reg, reg2; struct fwohcidb_tr *db_tr; /* Disable interrupts */ @@ -594,8 +594,8 @@ int fwohci_init(struct fwohci_softc *sc, device_t dev) { int i, mver; - u_int32_t reg; - u_int8_t ui[8]; + uint32_t reg; + uint8_t ui[8]; #if FWOHCI_TASKQUEUE TASK_INIT(&sc->fwohci_task_complete, 0, fwohci_complete, sc); @@ -701,7 +701,7 @@ fwohci_init(struct fwohci_softc *sc, device_t dev) return ENOMEM; } - fwdma_malloc(&sc->fc, sizeof(u_int32_t), sizeof(u_int32_t), + fwdma_malloc(&sc->fc, sizeof(uint32_t), sizeof(uint32_t), &sc->dummy_dma, BUS_DMA_WAITOK); if (sc->dummy_dma.v_addr == NULL) { @@ -767,7 +767,7 @@ fwohci_timeout(void *arg) sc = (struct fwohci_softc *)arg; } -u_int32_t +uint32_t fwohci_cyctimer(struct firewire_comm *fc) { struct fwohci_softc *sc = (struct fwohci_softc *)fc; @@ -842,13 +842,13 @@ fwohci_start(struct fwohci_softc *sc, struct fwohci_dbch *dbch) int i, s; int tcode, hdr_len, pl_off; int fsegment = -1; - u_int32_t off; + uint32_t off; struct fw_xfer *xfer; struct fw_pkt *fp; struct fwohci_txpkthdr *ohcifp; struct fwohcidb_tr *db_tr; struct fwohcidb *db; - u_int32_t *ld; + uint32_t *ld; struct tcode_info *info; static int maxdesc=0; @@ -1037,7 +1037,7 @@ fwohci_txd(struct fwohci_softc *sc, struct fwohci_dbch *dbch) struct fwohcidb_tr *tr; struct fwohcidb *db; struct fw_xfer *xfer; - u_int32_t off; + uint32_t off; u_int stat, status; int packets; struct firewire_comm *fc = (struct firewire_comm *)sc; @@ -1311,7 +1311,7 @@ fwohci_irx_disable(struct firewire_comm *fc, int dmach) #if BYTE_ORDER == BIG_ENDIAN static void -fwohci_irx_post (struct firewire_comm *fc , u_int32_t *qld) +fwohci_irx_post (struct firewire_comm *fc , uint32_t *qld) { qld[0] = FWOHCI_DMA_READ(qld[0]); return; @@ -1323,7 +1323,7 @@ fwohci_tx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch) { int err = 0; int idb, z, i, dmach = 0, ldesc; - u_int32_t off = 0; + uint32_t off = 0; struct fwohcidb_tr *db_tr; struct fwohcidb *db; @@ -1382,7 +1382,7 @@ fwohci_rx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch) { int err = 0; int idb, z, i, dmach = 0, ldesc; - u_int32_t off = 0; + uint32_t off = 0; struct fwohcidb_tr *db_tr; struct fwohcidb *db; @@ -1491,7 +1491,7 @@ fwohci_itxbuf_enable(struct firewire_comm *fc, int dmach) unsigned short tag, ich; struct fwohci_dbch *dbch; int cycle_match, cycle_now, s, ldesc; - u_int32_t stat; + uint32_t stat; struct fw_bulkxfer *first, *chunk, *prev; struct fw_xferq *it; @@ -1607,7 +1607,7 @@ fwohci_irx_enable(struct firewire_comm *fc, int dmach) struct fwohci_softc *sc = (struct fwohci_softc *)fc; int err = 0, s, ldesc; unsigned short tag, ich; - u_int32_t stat; + uint32_t stat; struct fwohci_dbch *dbch; struct fwohcidb_tr *db_tr; struct fw_bulkxfer *first, *prev, *chunk; @@ -1762,9 +1762,9 @@ fwohci_resume(struct fwohci_softc *sc, device_t dev) #define ACK_ALL static void -fwohci_intr_body(struct fwohci_softc *sc, u_int32_t stat, int count) +fwohci_intr_body(struct fwohci_softc *sc, uint32_t stat, int count) { - u_int32_t irstat, itstat; + uint32_t irstat, itstat; u_int i; struct firewire_comm *fc = (struct firewire_comm *)sc; @@ -1880,7 +1880,7 @@ busresetout: fwohci_arcv(sc, &sc->arrq, count); } if(stat & OHCI_INT_PHY_SID){ - u_int32_t *buf, node_id; + uint32_t *buf, node_id; int plen; #ifndef ACK_ALL @@ -1930,7 +1930,7 @@ busresetout: goto sidout; } plen -= 4; /* chop control info */ - buf = (u_int32_t *)malloc(OHCI_SIDSIZE, M_FW, M_NOWAIT); + buf = (uint32_t *)malloc(OHCI_SIDSIZE, M_FW, M_NOWAIT); if (buf == NULL) { device_printf(fc->dev, "malloc failed\n"); goto sidout; @@ -1988,7 +1988,7 @@ static void fwohci_complete(void *arg, int pending) { struct fwohci_softc *sc = (struct fwohci_softc *)arg; - u_int32_t stat; + uint32_t stat; again: stat = atomic_readandclear_int(&sc->intstat); @@ -2000,10 +2000,10 @@ again: } #endif -static u_int32_t +static uint32_t fwochi_check_stat(struct fwohci_softc *sc) { - u_int32_t stat, irstat, itstat; + uint32_t stat, irstat, itstat; stat = OREAD(sc, FWOHCI_INTSTAT); if (stat == 0xffffffff) { @@ -2032,9 +2032,9 @@ void fwohci_intr(void *arg) { struct fwohci_softc *sc = (struct fwohci_softc *)arg; - u_int32_t stat; + uint32_t stat; #if !FWOHCI_TASKQUEUE - u_int32_t bus_reset = 0; + uint32_t bus_reset = 0; #endif if (!(sc->intmask & OHCI_INT_EN)) { @@ -2067,7 +2067,7 @@ void fwohci_poll(struct firewire_comm *fc, int quick, int count) { int s; - u_int32_t stat; + uint32_t stat; struct fwohci_softc *sc; @@ -2113,7 +2113,7 @@ fwohci_tbuf_update(struct fwohci_softc *sc, int dmach) struct fwohcidb *db; struct fw_bulkxfer *chunk; struct fw_xferq *it; - u_int32_t stat, count; + uint32_t stat, count; int s, w=0, ldesc; it = fc->it[dmach]; @@ -2159,7 +2159,7 @@ fwohci_rbuf_update(struct fwohci_softc *sc, int dmach) struct fwohcidb_tr *db_tr; struct fw_bulkxfer *chunk; struct fw_xferq *ir; - u_int32_t stat; + uint32_t stat; int s, w=0, ldesc; ir = fc->ir[dmach]; @@ -2212,9 +2212,9 @@ fwohci_rbuf_update(struct fwohci_softc *sc, int dmach) } void -dump_dma(struct fwohci_softc *sc, u_int32_t ch) +dump_dma(struct fwohci_softc *sc, uint32_t ch) { - u_int32_t off, cntl, stat, cmd, match; + uint32_t off, cntl, stat, cmd, match; if(ch == 0){ off = OHCI_ATQOFF; @@ -2257,13 +2257,13 @@ dump_dma(struct fwohci_softc *sc, u_int32_t ch) } void -dump_db(struct fwohci_softc *sc, u_int32_t ch) +dump_db(struct fwohci_softc *sc, uint32_t ch) { struct fwohci_dbch *dbch; struct fwohcidb_tr *cp = NULL, *pp, *np = NULL; struct fwohcidb *curr = NULL, *prev, *next = NULL; int idb, jdb; - u_int32_t cmd, off; + uint32_t cmd, off; if(ch == 0){ off = OHCI_ATQOFF; dbch = &sc->atrq; @@ -2336,11 +2336,11 @@ outdb: void print_db(struct fwohcidb_tr *db_tr, struct fwohcidb *db, - u_int32_t ch, u_int32_t max) + uint32_t ch, uint32_t max) { fwohcireg_t stat; int i, key; - u_int32_t cmd, res; + uint32_t cmd, res; if(db == NULL){ printf("No Descriptor is found\n"); @@ -2427,7 +2427,7 @@ void fwohci_ibr(struct firewire_comm *fc) { struct fwohci_softc *sc; - u_int32_t fun; + uint32_t fun; device_printf(fc->dev, "Initiate bus reset\n"); sc = (struct fwohci_softc *)fc; @@ -2534,7 +2534,7 @@ fwohci_add_tx_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr, FWOHCI_DMA_WRITE(db[0].db.desc.addr, 0); bzero((void *)&db[1].db.immed[0], sizeof(db[1].db.immed)); FWOHCI_DMA_WRITE(db[2].db.desc.addr, - fwdma_bus_addr(it->buf, poffset) + sizeof(u_int32_t)); + fwdma_bus_addr(it->buf, poffset) + sizeof(uint32_t)); FWOHCI_DMA_WRITE(db[2].db.desc.cmd, OHCI_OUTPUT_LAST | OHCI_UPDATE | OHCI_BRANCH_ALWAYS); @@ -2568,7 +2568,7 @@ fwohci_add_rx_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr, } else { db_tr->dbcnt = 0; if (dummy_dma != NULL) { - dsiz[db_tr->dbcnt] = sizeof(u_int32_t); + dsiz[db_tr->dbcnt] = sizeof(uint32_t); dbuf[db_tr->dbcnt++] = dummy_dma->bus_addr; } dsiz[db_tr->dbcnt] = ir->psize; @@ -2599,7 +2599,7 @@ static int fwohci_arcv_swap(struct fw_pkt *fp, int len) { struct fw_pkt *fp0; - u_int32_t ld0; + uint32_t ld0; int slen, hlen; #if BYTE_ORDER == BIG_ENDIAN int i; @@ -2650,11 +2650,11 @@ fwohci_get_plen(struct fwohci_softc *sc, struct fwohci_dbch *dbch, struct fw_pkt int r; info = &tinfo[fp->mode.common.tcode]; - r = info->hdr_len + sizeof(u_int32_t); + r = info->hdr_len + sizeof(uint32_t); if ((info->flag & FWTI_BLOCK_ASY) != 0) - r += roundup2(fp->mode.wreqb.len, sizeof(u_int32_t)); + r += roundup2(fp->mode.wreqb.len, sizeof(uint32_t)); - if (r == sizeof(u_int32_t)) + if (r == sizeof(uint32_t)) /* XXX */ device_printf(sc->fc.dev, "Unknown tcode %d\n", fp->mode.common.tcode); @@ -2687,8 +2687,8 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) struct fw_pkt pktbuf; int nvec; struct fw_pkt *fp; - u_int8_t *ld; - u_int32_t stat, off, status; + uint8_t *ld; + uint32_t stat, off, status; u_int spd; int len, plen, hlen, pcnt, offset; int s; @@ -2716,7 +2716,7 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) #endif while (status & OHCI_CNTL_DMA_ACTIVE) { len = dbch->xferq.psize - resCount; - ld = (u_int8_t *)db_tr->buf; + ld = (uint8_t *)db_tr->buf; if (dbch->pdb_tr == NULL) { len -= dbch->buf_offset; ld += dbch->buf_offset; @@ -2815,7 +2815,7 @@ fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) nvec ++; ld += plen; } - dbch->buf_offset = ld - (u_int8_t *)db_tr->buf; + dbch->buf_offset = ld - (uint8_t *)db_tr->buf; if (nvec == 0) printf("nvec == 0\n"); diff --git a/sys/dev/firewire/fwohci_pci.c b/sys/dev/firewire/fwohci_pci.c index a9ad26ee2146..962c45b97dd4 100644 --- a/sys/dev/firewire/fwohci_pci.c +++ b/sys/dev/firewire/fwohci_pci.c @@ -92,7 +92,7 @@ static int fwohci_pci_probe( device_t dev ) { #if 1 - u_int32_t id; + uint32_t id; id = pci_get_devid(dev); if (id == (FW_VENDORID_NEC | FW_DEVICE_UPD861)) { @@ -208,7 +208,7 @@ static int fwohci_pci_init(device_t self) { int olatency, latency, ocache_line, cache_line; - u_int16_t cmd; + uint16_t cmd; cmd = pci_read_config(self, PCIR_COMMAND, 2); cmd |= PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN | PCIM_CMD_MWRICEN | diff --git a/sys/dev/firewire/fwohcireg.h b/sys/dev/firewire/fwohcireg.h index 9f13a2cfd2e9..8884698ce6e2 100644 --- a/sys/dev/firewire/fwohcireg.h +++ b/sys/dev/firewire/fwohcireg.h @@ -77,7 +77,7 @@ #define OHCI_MAX_DMA_CH (0x4 + OHCI_DMA_ITCH + OHCI_DMA_IRCH) -typedef u_int32_t fwohcireg_t; +typedef uint32_t fwohcireg_t; /* for PCI */ #if BYTE_ORDER == BIG_ENDIAN @@ -95,12 +95,12 @@ typedef u_int32_t fwohcireg_t; struct fwohcidb { union { struct { - u_int32_t cmd; - u_int32_t addr; - u_int32_t depend; - u_int32_t res; + uint32_t cmd; + uint32_t addr; + uint32_t depend; + uint32_t res; } desc; - u_int32_t immed[4]; + uint32_t immed[4]; } db; #define OHCI_STATUS_SHIFT 16 #define OHCI_COUNT_MASK 0xffff @@ -331,60 +331,60 @@ struct fwohcidb_tr{ */ struct fwohci_txpkthdr{ union{ - u_int32_t ld[4]; + uint32_t ld[4]; struct { #if BYTE_ORDER == BIG_ENDIAN - u_int32_t spd:16, /* XXX include reserved field */ - :8, - tcode:4, - :4; + uint32_t spd:16, /* XXX include reserved field */ + :8, + tcode:4, + :4; #else - u_int32_t :4, - tcode:4, - :8, - spd:16; /* XXX include reserved fields */ + uint32_t :4, + tcode:4, + :8, + spd:16; /* XXX include reserved fields */ #endif }common; struct { #if BYTE_ORDER == BIG_ENDIAN - u_int32_t :8, - srcbus:1, - :4, - spd:3, - tlrt:8, - tcode:4, - :4; + uint32_t :8, + srcbus:1, + :4, + spd:3, + tlrt:8, + tcode:4, + :4; #else - u_int32_t :4, - tcode:4, - tlrt:8, - spd:3, - :4, - srcbus:1, - :8; + uint32_t :4, + tcode:4, + tlrt:8, + spd:3, + :4, + srcbus:1, + :8; #endif BIT16x2(dst, ); }asycomm; struct { #if BYTE_ORDER == BIG_ENDIAN - u_int32_t :13, - spd:3, - chtag:8, - tcode:4, - sy:4; + uint32_t :13, + spd:3, + chtag:8, + tcode:4, + sy:4; #else - u_int32_t sy:4, - tcode:4, - chtag:8, - spd:3, - :13; + uint32_t sy:4, + tcode:4, + chtag:8, + spd:3, + :13; #endif BIT16x2(len, ); }stream; }mode; }; struct fwohci_trailer{ - u_int32_t time:16, + uint32_t time:16, stat:16; }; diff --git a/sys/dev/firewire/fwohcivar.h b/sys/dev/firewire/fwohcivar.h index a3fd1e71c964..014335a1d992 100644 --- a/sys/dev/firewire/fwohcivar.h +++ b/sys/dev/firewire/fwohcivar.h @@ -72,13 +72,13 @@ typedef struct fwohci_softc { bus_dma_tag_t dmat; } arrq, arrs, atrq, atrs, it[OHCI_DMA_ITCH], ir[OHCI_DMA_IRCH]; u_int maxrec; - u_int32_t *sid_buf; + uint32_t *sid_buf; struct fwdma_alloc sid_dma; struct fwdma_alloc crom_dma; struct fwdma_alloc dummy_dma; - u_int32_t intmask, irstat, itstat; + uint32_t intmask, irstat, itstat; #if FWOHCI_TASKQUEUE - u_int32_t intstat; + uint32_t intstat; struct task fwohci_task_complete; #endif } fwohci_softc_t; diff --git a/sys/dev/firewire/fwphyreg.h b/sys/dev/firewire/fwphyreg.h index f1c1ed7a2d3b..f2e77768adf7 100644 --- a/sys/dev/firewire/fwphyreg.h +++ b/sys/dev/firewire/fwphyreg.h @@ -36,133 +36,133 @@ struct phyreg_base { #if BYTE_ORDER == BIG_ENDIAN - u_int8_t phy_id:6, - r:1, - cps:1; - u_int8_t rhb:1, - ibr:1, - gap_count:6; - u_int8_t extended:3, - num_ports:5; - u_int8_t phy_speed:3, - :1, - delay:4; - u_int8_t lctrl:1, - c:1, - jitter:3, - pwr_class:3; - u_int8_t wdie:1, - isbr:1, - ctoi:1, - cpsi:1, - stoi:1, - pei:1, - eaa:1, - emc:1; - u_int8_t legacy_spd:3, - blink:1, - bridge:2, - :2; - u_int8_t page_select:3, - :1, - port_select:4; + uint8_t phy_id:6, + r:1, + cps:1; + uint8_t rhb:1, + ibr:1, + gap_count:6; + uint8_t extended:3, + num_ports:5; + uint8_t phy_speed:3, + :1, + delay:4; + uint8_t lctrl:1, + c:1, + jitter:3, + pwr_class:3; + uint8_t wdie:1, + isbr:1, + ctoi:1, + cpsi:1, + stoi:1, + pei:1, + eaa:1, + emc:1; + uint8_t legacy_spd:3, + blink:1, + bridge:2, + :2; + uint8_t page_select:3, + :1, + port_select:4; #else - u_int8_t cps:1, - r:1, - phy_id:6; - u_int8_t gap_count:6, - ibr:1, - rhb:1; - u_int8_t num_ports:5, - extended:3; - u_int8_t delay:4, - :1, - phy_speed:3; - u_int8_t pwr_class:3, - jitter:3, - c:1, - lctrl:1; - u_int8_t emc:1, - eaa:1, - pei:1, - stoi:1, - cpsi:1, - ctoi:1, - isbr:1, - wdie:1; - u_int8_t :2, - bridge:2, - blink:1, - legacy_spd:3; - u_int8_t port_select:4, - :1, - page_select:3; + uint8_t cps:1, + r:1, + phy_id:6; + uint8_t gap_count:6, + ibr:1, + rhb:1; + uint8_t num_ports:5, + extended:3; + uint8_t delay:4, + :1, + phy_speed:3; + uint8_t pwr_class:3, + jitter:3, + c:1, + lctrl:1; + uint8_t emc:1, + eaa:1, + pei:1, + stoi:1, + cpsi:1, + ctoi:1, + isbr:1, + wdie:1; + uint8_t :2, + bridge:2, + blink:1, + legacy_spd:3; + uint8_t port_select:4, + :1, + page_select:3; #endif }; struct phyreg_page0 { #if BYTE_ORDER == BIG_ENDIAN - u_int8_t astat:2, - bstat:2, - ch:1, - con:1, - rxok:1, - dis:1; - u_int8_t negotiated_speed:3, - pie:1, - fault:1, - stanby_fault:1, - disscrm:1, - b_only:1; - u_int8_t dc_connected:1, - max_port_speed:3, - lpp:1, - cable_speed:3; - u_int8_t connection_unreliable:1, - :3, - beta_mode:1, - :3; - u_int8_t port_error; - u_int8_t :5, - loop_disable:1, - in_standby:1, - hard_disable:1; - u_int8_t :8; - u_int8_t :8; + uint8_t astat:2, + bstat:2, + ch:1, + con:1, + rxok:1, + dis:1; + uint8_t negotiated_speed:3, + pie:1, + fault:1, + stanby_fault:1, + disscrm:1, + b_only:1; + uint8_t dc_connected:1, + max_port_speed:3, + lpp:1, + cable_speed:3; + uint8_t connection_unreliable:1, + :3, + beta_mode:1, + :3; + uint8_t port_error; + uint8_t :5, + loop_disable:1, + in_standby:1, + hard_disable:1; + uint8_t :8; + uint8_t :8; #else - u_int8_t dis:1, - rxok:1, - con:1, - ch:1, - bstat:2, - astat:2; - u_int8_t b_only:1, - disscrm:1, - stanby_fault:1, - fault:1, - pie:1, - negotiated_speed:3; - u_int8_t cable_speed:3, - lpp:1, - max_port_speed:3, - dc_connected:1; - u_int8_t :3, - beta_mode:1, - :3, - connection_unreliable:1; - u_int8_t port_error; - u_int8_t hard_disable:1, - in_standby:1, - loop_disable:1, - :5; - u_int8_t :8; - u_int8_t :8; + uint8_t dis:1, + rxok:1, + con:1, + ch:1, + bstat:2, + astat:2; + uint8_t b_only:1, + disscrm:1, + stanby_fault:1, + fault:1, + pie:1, + negotiated_speed:3; + uint8_t cable_speed:3, + lpp:1, + max_port_speed:3, + dc_connected:1; + uint8_t :3, + beta_mode:1, + :3, + connection_unreliable:1; + uint8_t port_error; + uint8_t hard_disable:1, + in_standby:1, + loop_disable:1, + :5; + uint8_t :8; + uint8_t :8; #endif }; struct phyreg_page1 { - u_int8_t compliance; - u_int8_t :8; - u_int8_t vendor_id[3]; - u_int8_t product_id[3]; + uint8_t compliance; + uint8_t :8; + uint8_t vendor_id[3]; + uint8_t product_id[3]; }; diff --git a/sys/dev/firewire/iec13213.h b/sys/dev/firewire/iec13213.h index d4bba82150a6..744172563e09 100644 --- a/sys/dev/firewire/iec13213.h +++ b/sys/dev/firewire/iec13213.h @@ -124,22 +124,22 @@ struct csrreg { #if BYTE_ORDER == BIG_ENDIAN - u_int32_t key:8, - val:24; + uint32_t key:8, + val:24; #else - u_int32_t val:24, - key:8; + uint32_t val:24, + key:8; #endif }; struct csrhdr { #if BYTE_ORDER == BIG_ENDIAN - u_int32_t info_len:8, - crc_len:8, - crc:16; + uint32_t info_len:8, + crc_len:8, + crc:16; #else - u_int32_t crc:16, - crc_len:8, - info_len:8; + uint32_t crc:16, + crc_len:8, + info_len:8; #endif }; struct csrdirectory { @@ -149,47 +149,47 @@ struct csrdirectory { struct csrtext { BIT16x2(crc_len, crc); #if BYTE_ORDER == BIG_ENDIAN - u_int32_t spec_type:8, - spec_id:24; + uint32_t spec_type:8, + spec_id:24; #else - u_int32_t spec_id:24, - spec_type:8; + uint32_t spec_id:24, + spec_type:8; #endif - u_int32_t lang_id; - u_int32_t text[0]; + uint32_t lang_id; + uint32_t text[0]; }; struct bus_info { #define CSR_BUS_NAME_IEEE1394 0x31333934 - u_int32_t bus_name; + uint32_t bus_name; #if BYTE_ORDER == BIG_ENDIAN - u_int32_t irmc:1, /* iso. resource manager capable */ - cmc:1, /* cycle master capable */ - isc:1, /* iso. operation support */ - bmc:1, /* bus manager capable */ - pmc:1, /* power manager capable */ - :3, - cyc_clk_acc:8, /* 0 <= ppm <= 100 */ - max_rec:4, /* (2 << max_rec) bytes */ - :2, - max_rom:2, - generation:4, - :1, - link_spd:3; + uint32_t irmc:1, /* iso. resource manager capable */ + cmc:1, /* cycle master capable */ + isc:1, /* iso. operation support */ + bmc:1, /* bus manager capable */ + pmc:1, /* power manager capable */ + :3, + cyc_clk_acc:8, /* 0 <= ppm <= 100 */ + max_rec:4, /* (2 << max_rec) bytes */ + :2, + max_rom:2, + generation:4, + :1, + link_spd:3; #else - u_int32_t link_spd:3, - :1, - generation:4, - max_rom:2, - :2, - max_rec:4, /* (2 << max_rec) bytes */ - cyc_clk_acc:8, /* 0 <= ppm <= 100 */ - :3, - pmc:1, /* power manager capable */ - bmc:1, /* bus manager capable */ - isc:1, /* iso. operation support */ - cmc:1, /* cycle master capable */ - irmc:1; /* iso. resource manager capable */ + uint32_t link_spd:3, + :1, + generation:4, + max_rom:2, + :2, + max_rec:4, /* (2 << max_rec) bytes */ + cyc_clk_acc:8, /* 0 <= ppm <= 100 */ + :3, + pmc:1, /* power manager capable */ + bmc:1, /* bus manager capable */ + isc:1, /* iso. operation support */ + cmc:1, /* cycle master capable */ + irmc:1; /* iso. resource manager capable */ #endif struct fw_eui64 eui64; }; @@ -209,13 +209,13 @@ struct crom_context { struct crom_ptr stack[CROM_MAX_DEPTH]; }; -void crom_init_context(struct crom_context *, u_int32_t *); +void crom_init_context(struct crom_context *, uint32_t *); struct csrreg *crom_get(struct crom_context *); void crom_next(struct crom_context *); void crom_parse_text(struct crom_context *, char *, int); -u_int16_t crom_crc(u_int32_t *r, int); -struct csrreg *crom_search_key(struct crom_context *, u_int8_t); -int crom_has_specver(u_int32_t *, u_int32_t, u_int32_t); +uint16_t crom_crc(uint32_t *r, int); +struct csrreg *crom_search_key(struct crom_context *, uint8_t); +int crom_has_specver(uint32_t *, uint32_t, uint32_t); #ifndef _KERNEL char *crom_desc(struct crom_context *, char *, int); @@ -237,15 +237,15 @@ struct crom_chunk { int offset; struct { BIT16x2(crc_len, crc); - u_int32_t buf[CROM_MAX_CHUNK_LEN]; + uint32_t buf[CROM_MAX_CHUNK_LEN]; } data; }; -extern int crom_add_quad(struct crom_chunk *, u_int32_t); +extern int crom_add_quad(struct crom_chunk *, uint32_t); extern int crom_add_entry(struct crom_chunk *, int, int); extern int crom_add_chunk(struct crom_src *src, struct crom_chunk *, struct crom_chunk *, int); extern int crom_add_simple_text(struct crom_src *src, struct crom_chunk *, struct crom_chunk *, char *); -extern int crom_load(struct crom_src *, u_int32_t *, int); +extern int crom_load(struct crom_src *, uint32_t *, int); #endif diff --git a/sys/dev/firewire/iec68113.h b/sys/dev/firewire/iec68113.h index 7b7c1884fe78..58a8cfe7d9eb 100644 --- a/sys/dev/firewire/iec68113.h +++ b/sys/dev/firewire/iec68113.h @@ -43,69 +43,69 @@ struct ciphdr { #if BYTE_ORDER == BIG_ENDIAN - u_int8_t eoh0:1, /* 0 */ - form0:1, /* 0 */ - src:6; + uint8_t eoh0:1, /* 0 */ + form0:1, /* 0 */ + src:6; #else - u_int8_t src:6, - form0:1, /* 0 */ - eoh0:1; /* 0 */ + uint8_t src:6, + form0:1, /* 0 */ + eoh0:1; /* 0 */ #endif - u_int8_t len; + uint8_t len; #if BYTE_ORDER == BIG_ENDIAN - u_int8_t fn:2, - qpc:3, - sph:1, - :2; + uint8_t fn:2, + qpc:3, + sph:1, + :2; #else - u_int8_t :2, - sph:1, - qpc:3, - fn:2; + uint8_t :2, + sph:1, + qpc:3, + fn:2; #endif - u_int8_t dbc; + uint8_t dbc; #if BYTE_ORDER == BIG_ENDIAN - u_int8_t eoh1:1, /* 1 */ - form1:1, /* 0 */ - fmt:6; + uint8_t eoh1:1, /* 1 */ + form1:1, /* 0 */ + fmt:6; #else - u_int8_t fmt:6, - form1:1, /* 0 */ - eoh1:1; /* 1 */ + uint8_t fmt:6, + form1:1, /* 0 */ + eoh1:1; /* 1 */ #endif #define CIP_FMT_DVCR 0 #define CIP_FMT_MPEG (1<<5) union { struct { #if BYTE_ORDER == BIG_ENDIAN - u_int8_t fs:1, /* 50/60 field system + uint8_t fs:1, /* 50/60 field system NTSC/PAL */ - stype:5, - :2; + stype:5, + :2; #else - u_int8_t :2, - stype:5, - fs:1; /* 50/60 field system + uint8_t :2, + stype:5, + fs:1; /* 50/60 field system NTSC/PAL */ #endif #define CIP_STYPE_SD 0 #define CIP_STYPE_SDL 1 #define CIP_STYPE_HD 2 - u_int16_t cyc:16; /* take care of byte order! */ + uint16_t cyc:16; /* take care of byte order! */ } __attribute__ ((packed)) dv; - u_int8_t bytes[3]; + uint8_t bytes[3]; } fdf; }; struct dvdbc{ #if BYTE_ORDER == BIG_ENDIAN - u_int8_t sct:3, /* Section type */ - :1, /* Reserved */ - arb:4; /* Arbitrary bit */ + uint8_t sct:3, /* Section type */ + :1, /* Reserved */ + arb:4; /* Arbitrary bit */ #else - u_int8_t arb:4, /* Arbitrary bit */ - :1, /* Reserved */ - sct:3; /* Section type */ + uint8_t arb:4, /* Arbitrary bit */ + :1, /* Reserved */ + sct:3; /* Section type */ #endif #define DV_SCT_HEADER 0 #define DV_SCT_SUBCODE 1 @@ -113,15 +113,15 @@ struct dvdbc{ #define DV_SCT_AUDIO 3 #define DV_SCT_VIDEO 4 #if BYTE_ORDER == BIG_ENDIAN - u_int8_t dseq:4, /* DIF sequence number */ - fsc:1, /* ID of a DIF block in each channel */ - :3; + uint8_t dseq:4, /* DIF sequence number */ + fsc:1, /* ID of a DIF block in each channel */ + :3; #else - u_int8_t :3, - fsc:1, /* ID of a DIF block in each channel */ - dseq:4; /* DIF sequence number */ + uint8_t :3, + fsc:1, /* ID of a DIF block in each channel */ + dseq:4; /* DIF sequence number */ #endif - u_int8_t dbn; /* DIF block number */ - u_int8_t payload[77]; + uint8_t dbn; /* DIF block number */ + uint8_t payload[77]; #define DV_DSF_12 0x80 /* PAL: payload[0] in Header DIF */ }; diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c index 17e741aa6c95..a0fb83c342d4 100644 --- a/sys/dev/firewire/if_fwe.c +++ b/sys/dev/firewire/if_fwe.c @@ -550,7 +550,7 @@ fwe_as_output(struct fwe_softc *fwe, struct ifnet *ifp) /* keep ip packet alignment for alpha */ M_PREPEND(m, ETHER_ALIGN, M_DONTWAIT); fp = &xfer->send.hdr; - *(u_int32_t *)&xfer->send.hdr = *(int32_t *)&fwe->pkt_hdr; + *(uint32_t *)&xfer->send.hdr = *(int32_t *)&fwe->pkt_hdr; fp->mode.stream.len = m->m_pkthdr.len; xfer->mbuf = m; xfer->send.pay_len = m->m_pkthdr.len; diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index 59f3d87ff308..ecfe1417169b 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -169,8 +169,8 @@ struct sbp_ocb { STAILQ_ENTRY(sbp_ocb) ocb; union ccb *ccb; bus_addr_t bus_addr; - u_int32_t orb[8]; -#define IND_PTR_OFFSET (8*sizeof(u_int32_t)) + uint32_t orb[8]; +#define IND_PTR_OFFSET (8*sizeof(uint32_t)) struct ind_ptr ind_ptr[SBP_IND_MAX]; struct sbp_dev *sdev; int flags; /* XXX should be removed */ @@ -192,11 +192,11 @@ struct sbp_dev{ #define SBP_DEV_ATTACHED 5 /* in operation */ #define SBP_DEV_DEAD 6 /* unavailable unit */ #define SBP_DEV_RETRY 7 /* unavailable unit */ - u_int8_t status:4, + uint8_t status:4, timeout:4; - u_int8_t type; - u_int16_t lun_id; - u_int16_t freeze; + uint8_t type; + uint16_t lun_id; + uint16_t freeze; #define ORB_LINK_DEAD (1 << 0) #define VALID_LUN (1 << 1) #define ORB_POINTER_ACTIVE (1 << 2) @@ -204,7 +204,7 @@ struct sbp_dev{ #define ORB_DOORBELL_ACTIVE (1 << 4) #define ORB_DOORBELL_NEED (1 << 5) #define ORB_SHORTAGE (1 << 6) - u_int16_t flags; + uint16_t flags; struct cam_path *path; struct sbp_target *target; struct fwdma_alloc dma; @@ -225,7 +225,7 @@ struct sbp_target { struct sbp_dev **luns; struct sbp_softc *sbp; struct fw_device *fwdev; - u_int32_t mgm_hi, mgm_lo; + uint32_t mgm_hi, mgm_lo; struct sbp_ocb *mgm_ocb_cur; STAILQ_HEAD(, sbp_ocb) mgm_ocb_queue; struct callout mgm_ocb_timeout; @@ -549,7 +549,7 @@ END_DEBUG goto next; fwdma_malloc(sbp->fd.fc, - /* alignment */ sizeof(u_int32_t), + /* alignment */ sizeof(uint32_t), SBP_DMA_SIZE, &sdev->dma, BUS_DMA_NOWAIT); if (sdev->dma.v_addr == NULL) { printf("%s: dma space allocation failed\n", @@ -1200,7 +1200,7 @@ sbp_orb_pointer(struct sbp_dev *sdev, struct sbp_ocb *ocb) struct fw_pkt *fp; SBP_DEBUG(1) sbp_show_sdev_info(sdev, 2); - printf("%s: 0x%08x\n", __func__, (u_int32_t)ocb->bus_addr); + printf("%s: 0x%08x\n", __func__, (uint32_t)ocb->bus_addr); END_DEBUG if ((sdev->flags & ORB_POINTER_ACTIVE) != 0) { @@ -1222,7 +1222,7 @@ END_DEBUG fp->mode.wreqb.extcode = 0; xfer->send.payload[0] = htonl(((sdev->target->sbp->fd.fc->nodeid | FWLOCALBUS )<< 16)); - xfer->send.payload[1] = htonl((u_int32_t)ocb->bus_addr); + xfer->send.payload[1] = htonl((uint32_t)ocb->bus_addr); if(fw_asyreq(xfer->fc, -1, xfer) != 0){ sbp_xfer_free(xfer); @@ -1426,7 +1426,7 @@ start: xfer->send.payload[1] = htonl(ocb->bus_addr & 0xffffffff); SBP_DEBUG(0) sbp_show_sdev_info(sdev, 2); - printf("mgm orb: %08x\n", (u_int32_t)ocb->bus_addr); + printf("mgm orb: %08x\n", (uint32_t)ocb->bus_addr); END_DEBUG fw_asyreq(xfer->fc, -1, xfer); @@ -1528,7 +1528,7 @@ END_DEBUG | CAM_AUTOSNS_VALID; /* { - u_int8_t j, *tmp; + uint8_t j, *tmp; tmp = sense; for( j = 0 ; j < 32 ; j+=8){ printf("sense %02x%02x %02x%02x %02x%02x %02x%02x\n", @@ -1611,9 +1611,9 @@ sbp_recv1(struct fw_xfer *xfer) struct sbp_status *sbp_status; struct sbp_target *target; int orb_fun, status_valid0, status_valid, t, l, reset_agent = 0; - u_int32_t addr; + uint32_t addr; /* - u_int32_t *ld; + uint32_t *ld; ld = xfer->recv.buf; printf("sbp %x %d %d %08x %08x %08x %08x\n", xfer->resp, xfer->recv.len, xfer->recv.off, ntohl(ld[0]), ntohl(ld[1]), ntohl(ld[2]), ntohl(ld[3])); @@ -1823,7 +1823,7 @@ END_DEBUG if(ocb->ccb != NULL){ union ccb *ccb; /* - u_int32_t *ld; + uint32_t *ld; ld = ocb->ccb->csio.data_ptr; if(ld != NULL && ocb->ccb->csio.dxfer_len != 0) printf("ptr %08x %08x %08x %08x\n", ld[0], ld[1], ld[2], ld[3]); @@ -2207,7 +2207,7 @@ sbp_mgm_timeout(void *arg) sbp_show_sdev_info(sdev, 2); printf("request timeout(mgm orb:0x%08x) ... ", - (u_int32_t)ocb->bus_addr); + (uint32_t)ocb->bus_addr); target->mgm_ocb_cur = NULL; sbp_free_ocb(sdev, ocb); #if 0 @@ -2229,7 +2229,7 @@ sbp_timeout(void *arg) sbp_show_sdev_info(sdev, 2); printf("request timeout(cmd orb:0x%08x) ... ", - (u_int32_t)ocb->bus_addr); + (uint32_t)ocb->bus_addr); sdev->timeout ++; switch(sdev->timeout) { @@ -2441,8 +2441,8 @@ printf("ORB %08x %08x %08x %08x\n", ntohl(ocb->orb[4]), ntohl(ocb->orb[5]), ntoh { struct ccb_calc_geometry *ccg; #if defined(__DragonFly__) || __FreeBSD_version < 501100 - u_int32_t size_mb; - u_int32_t secs_per_cylinder; + uint32_t size_mb; + uint32_t secs_per_cylinder; int extended = 1; #endif diff --git a/sys/dev/firewire/sbp.h b/sys/dev/firewire/sbp.h index c4b5e0aefcaf..49ec97e0caeb 100644 --- a/sys/dev/firewire/sbp.h +++ b/sys/dev/firewire/sbp.h @@ -70,38 +70,38 @@ #define END_DEBUG } struct ind_ptr { - u_int32_t hi,lo; + uint32_t hi,lo; }; #define SBP_RECV_LEN 32 struct sbp_login_res{ - u_int16_t len; - u_int16_t id; - u_int16_t res0; - u_int16_t cmd_hi; - u_int32_t cmd_lo; - u_int16_t res1; - u_int16_t recon_hold; + uint16_t len; + uint16_t id; + uint16_t res0; + uint16_t cmd_hi; + uint32_t cmd_lo; + uint16_t res1; + uint16_t recon_hold; }; struct sbp_status{ #if BYTE_ORDER == BIG_ENDIAN - u_int8_t src:2, + uint8_t src:2, resp:2, dead:1, len:3; #else - u_int8_t len:3, + uint8_t len:3, dead:1, resp:2, src:2; #endif - u_int8_t status; - u_int16_t orb_hi; - u_int32_t orb_lo; - u_int32_t data[6]; + uint8_t status; + uint16_t orb_hi; + uint32_t orb_lo; + uint32_t data[6]; }; /* src */ #define SRC_NEXT_EXISTS 0 @@ -159,29 +159,29 @@ struct sbp_cmd_status{ #define SBP_SFMT_CURR 0 #define SBP_SFMT_DEFER 1 #if BYTE_ORDER == BIG_ENDIAN - u_int8_t sfmt:2, + uint8_t sfmt:2, status:6; - u_int8_t valid:1, + uint8_t valid:1, mark:1, eom:1, ill_len:1, s_key:4; #else - u_int8_t status:6, + uint8_t status:6, sfmt:2; - u_int8_t s_key:4, + uint8_t s_key:4, ill_len:1, eom:1, mark:1, valid:1; #endif - u_int8_t s_code; - u_int8_t s_qlfr; - u_int32_t info; - u_int32_t cdb; - u_int8_t fru; - u_int8_t s_keydep[3]; - u_int32_t vend[2]; + uint8_t s_code; + uint8_t s_qlfr; + uint32_t info; + uint32_t cdb; + uint8_t fru; + uint8_t s_keydep[3]; + uint32_t vend[2]; }; #define ORB_FUN_NAMES \ diff --git a/sys/dev/firewire/sbp_targ.c b/sys/dev/firewire/sbp_targ.c index 119ecd2069ba..c6fea6bcbe50 100644 --- a/sys/dev/firewire/sbp_targ.c +++ b/sys/dev/firewire/sbp_targ.c @@ -105,27 +105,27 @@ struct sbp_targ_login { struct sbp_targ_lstate *lstate; struct fw_device *fwdev; struct sbp_login_res loginres; - u_int16_t fifo_hi; - u_int16_t last_hi; - u_int32_t fifo_lo; - u_int32_t last_lo; + uint16_t fifo_hi; + uint16_t last_hi; + uint32_t fifo_lo; + uint32_t last_lo; STAILQ_HEAD(, orb_info) orbs; STAILQ_ENTRY(sbp_targ_login) link; - u_int16_t hold_sec; - u_int16_t id; - u_int8_t flags; - u_int8_t spd; + uint16_t hold_sec; + uint16_t id; + uint8_t flags; + uint8_t spd; struct callout hold_callout; }; struct sbp_targ_lstate { - u_int16_t lun; + uint16_t lun; struct sbp_targ_softc *sc; struct cam_path *path; struct ccb_hdr_slist accept_tios; struct ccb_hdr_slist immed_notifies; struct crom_chunk model; - u_int32_t flags; + uint32_t flags; STAILQ_HEAD(, sbp_targ_login) logins; }; @@ -144,7 +144,7 @@ struct sbp_targ_softc { struct corb4 { #if BYTE_ORDER == BIG_ENDIAN - u_int32_t n:1, + uint32_t n:1, rq_fmt:2, :1, dir:1, @@ -154,7 +154,7 @@ struct corb4 { page_size:3, data_size:16; #else - u_int32_t data_size:16, + uint32_t data_size:16, page_size:3, page_table_present:1, max_payload:4, @@ -168,13 +168,13 @@ struct corb4 { struct morb4 { #if BYTE_ORDER == BIG_ENDIAN - u_int32_t n:1, + uint32_t n:1, rq_fmt:2, :9, fun:4, id:16; #else - u_int32_t id:16, + uint32_t id:16, fun:4, :9, rq_fmt:2, @@ -188,7 +188,7 @@ struct orb_info { struct sbp_targ_login *login; union ccb *ccb; struct ccb_accept_tio *atio; - u_int8_t state; + uint8_t state; #define ORBI_STATUS_NONE 0 #define ORBI_STATUS_FETCH 1 #define ORBI_STATUS_ATIO 2 @@ -196,15 +196,15 @@ struct orb_info { #define ORBI_STATUS_STATUS 4 #define ORBI_STATUS_POINTER 5 #define ORBI_STATUS_ABORTED 7 - u_int8_t refcount; - u_int16_t orb_hi; - u_int32_t orb_lo; - u_int32_t data_hi; - u_int32_t data_lo; + uint8_t refcount; + uint16_t orb_hi; + uint32_t orb_lo; + uint32_t data_hi; + uint32_t data_lo; struct corb4 orb4; STAILQ_ENTRY(orb_info) link; - u_int32_t orb[8]; - u_int32_t *page_table; + uint32_t orb[8]; + uint32_t *page_table; struct sbp_status status; }; @@ -214,7 +214,7 @@ static char *orb_fun_name[] = { static void sbp_targ_recv(struct fw_xfer *); static void sbp_targ_fetch_orb(struct sbp_targ_softc *, struct fw_device *, - u_int16_t, u_int32_t, struct sbp_targ_login *, int); + uint16_t, uint32_t, struct sbp_targ_login *, int); static void sbp_targ_identify(driver_t *driver, device_t parent) @@ -563,7 +563,7 @@ sbp_targ_free_orbi(struct fw_xfer *xfer) static void sbp_targ_status_FIFO(struct orb_info *orbi, - u_int32_t fifo_hi, u_int32_t fifo_lo, int dequeue) + uint32_t fifo_hi, uint32_t fifo_lo, int dequeue) { struct fw_xfer *xfer; @@ -572,7 +572,7 @@ sbp_targ_status_FIFO(struct orb_info *orbi, xfer = fwmem_write_block(orbi->fwdev, (void *)orbi, /*spd*/2, fifo_hi, fifo_lo, - sizeof(u_int32_t) * (orbi->status.len + 1), (char *)&orbi->status, + sizeof(uint32_t) * (orbi->status.len + 1), (char *)&orbi->status, sbp_targ_free_orbi); if (xfer == NULL) { @@ -762,7 +762,7 @@ sbp_targ_abort_ccb(struct sbp_targ_softc *sc, union ccb *ccb) static void sbp_targ_xfer_buf(struct orb_info *orbi, u_int offset, - u_int16_t dst_hi, u_int32_t dst_lo, u_int size, + uint16_t dst_hi, uint32_t dst_lo, u_int size, void (*hand)(struct fw_xfer *)) { struct fw_xfer *xfer; @@ -804,7 +804,7 @@ sbp_targ_pt_done(struct fw_xfer *xfer) struct orb_info *orbi; union ccb *ccb; u_int i, offset, res, len; - u_int32_t t1, t2, *p; + uint32_t t1, t2, *p; orbi = (struct orb_info *)xfer->sc; ccb = orbi->ccb; @@ -1092,7 +1092,7 @@ static void sbp_targ_cmd_handler(struct fw_xfer *xfer) { struct fw_pkt *fp; - u_int32_t *orb; + uint32_t *orb; struct corb4 *orb4; struct orb_info *orbi; struct ccb_accept_tio *atio; @@ -1243,7 +1243,7 @@ sbp_targ_mgm_handler(struct fw_xfer *xfer) struct sbp_targ_lstate *lstate; struct sbp_targ_login *login; struct fw_pkt *fp; - u_int32_t *orb; + uint32_t *orb; struct morb4 *orb4; struct orb_info *orbi; int i; @@ -1311,7 +1311,7 @@ sbp_targ_mgm_handler(struct fw_xfer *xfer) login->fifo_hi = orb[6]; login->fifo_lo = orb[7]; - login->loginres.len = htons(sizeof(u_int32_t) * 4); + login->loginres.len = htons(sizeof(uint32_t) * 4); login->loginres.id = htons(login->id); login->loginres.cmd_hi = htons(SBP_TARG_BIND_HI); login->loginres.cmd_lo = htonl(SBP_TARG_BIND_LO(login->id)); @@ -1361,7 +1361,7 @@ static void sbp_targ_pointer_handler(struct fw_xfer *xfer) { struct orb_info *orbi; - u_int32_t orb0, orb1; + uint32_t orb0, orb1; orbi = (struct orb_info *)xfer->sc; if (xfer->resp != 0) { @@ -1376,7 +1376,7 @@ sbp_targ_pointer_handler(struct fw_xfer *xfer) goto done; } sbp_targ_fetch_orb(orbi->login->lstate->sc, orbi->fwdev, - (u_int16_t)orb0, orb1, orbi->login, FETCH_CMD); + (uint16_t)orb0, orb1, orbi->login, FETCH_CMD); done: free(orbi, M_SBP_TARG); fw_xfer_free(xfer); @@ -1385,7 +1385,7 @@ done: static void sbp_targ_fetch_orb(struct sbp_targ_softc *sc, struct fw_device *fwdev, - u_int16_t orb_hi, u_int32_t orb_lo, struct sbp_targ_login *login, + uint16_t orb_hi, uint32_t orb_lo, struct sbp_targ_login *login, int mode) { struct orb_info *orbi; @@ -1408,7 +1408,7 @@ sbp_targ_fetch_orb(struct sbp_targ_softc *sc, struct fw_device *fwdev, switch (mode) { case FETCH_MGM: fwmem_read_block(fwdev, (void *)orbi, /*spd*/2, orb_hi, orb_lo, - sizeof(u_int32_t) * 8, &orbi->orb[0], + sizeof(uint32_t) * 8, &orbi->orb[0], sbp_targ_mgm_handler); break; case FETCH_CMD: @@ -1431,7 +1431,7 @@ sbp_targ_fetch_orb(struct sbp_targ_softc *sc, struct fw_device *fwdev, } SLIST_REMOVE_HEAD(&login->lstate->accept_tios, sim_links.sle); fwmem_read_block(fwdev, (void *)orbi, /*spd*/2, orb_hi, orb_lo, - sizeof(u_int32_t) * 8, &orbi->orb[0], + sizeof(uint32_t) * 8, &orbi->orb[0], sbp_targ_cmd_handler); STAILQ_INSERT_TAIL(&login->orbs, orbi, link); break; @@ -1439,7 +1439,7 @@ sbp_targ_fetch_orb(struct sbp_targ_softc *sc, struct fw_device *fwdev, orbi->state = ORBI_STATUS_POINTER; login->flags |= F_LINK_ACTIVE; fwmem_read_block(fwdev, (void *)orbi, /*spd*/2, orb_hi, orb_lo, - sizeof(u_int32_t) * 2, &orbi->orb[0], + sizeof(uint32_t) * 2, &orbi->orb[0], sbp_targ_pointer_handler); break; default: @@ -1566,7 +1566,7 @@ sbp_targ_recv(struct fw_xfer *xfer) { struct fw_pkt *fp, *sfp; struct fw_device *fwdev; - u_int32_t lo; + uint32_t lo; int s, rtcode; struct sbp_targ_softc *sc; -- cgit v1.3 From 7b1f62860646317ac3f9d39056a1b450ea8e3692 Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Sun, 23 May 2004 18:43:44 +0000 Subject: Don't try to copy out the result payload if there isn't one. This ioctl interface really needs changing to split out the various async request types. --- sys/dev/firewire/fwdev.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 29c025b83da7..7cf7dc91a103 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -594,13 +594,21 @@ fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) /* copy response */ tinfo = &sc->fc->tcode[xfer->recv.hdr.mode.hdr.tcode]; - if (asyreq->req.len >= xfer->recv.pay_len + tinfo->hdr_len) - asyreq->req.len = xfer->recv.pay_len; - else - err = EINVAL; + if (xfer->recv.hdr.mode.hdr.tcode == FWTCODE_RRESB || + xfer->recv.hdr.mode.hdr.tcode == FWTCODE_LRES) { + pay_len = xfer->recv.pay_len; + if (asyreq->req.len >= xfer->recv.pay_len + tinfo->hdr_len) { + asyreq->req.len = xfer->recv.pay_len + + tinfo->hdr_len; + } else { + err = EINVAL; + pay_len = 0; + } + } else { + pay_len = 0; + } bcopy(&xfer->recv.hdr, fp, tinfo->hdr_len); - bcopy(xfer->recv.payload, (char *)fp + tinfo->hdr_len, - MAX(0, asyreq->req.len - tinfo->hdr_len)); + bcopy(xfer->recv.payload, (char *)fp + tinfo->hdr_len, pay_len); out: fw_xfer_free_buf(xfer); break; -- cgit v1.3 From 89c9c53da05197f657dfe8e0bdda6941a2e9a0d4 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Wed, 16 Jun 2004 09:47:26 +0000 Subject: Do the dreaded s/dev_t/struct cdev */ Bump __FreeBSD_version accordingly. --- sys/alpha/alpha/mem.c | 14 ++-- sys/alpha/alpha/promcons.c | 4 +- sys/alpha/include/cpu.h | 2 +- sys/alpha/tlsb/zs_tlsb.c | 4 +- sys/amd64/amd64/mem.c | 12 ++-- sys/amd64/include/cpu.h | 2 +- sys/arm/arm/nexus_io.c | 2 +- sys/arm/include/bus.h | 4 +- sys/arm/sa11x0/sa11x0_io.c | 2 +- sys/boot/i386/libi386/bioscd.c | 4 +- sys/boot/i386/libi386/biosdisk.c | 2 +- sys/boot/i386/libi386/libi386.h | 4 +- sys/boot/pc98/boot2/dinode.h | 2 +- sys/boot/pc98/boot2/inode.h | 2 +- sys/boot/pc98/libpc98/biosdisk.c | 2 +- sys/cam/cam_xpt.c | 6 +- sys/cam/scsi/scsi_ch.c | 8 +-- sys/cam/scsi/scsi_pass.c | 8 +-- sys/cam/scsi/scsi_pt.c | 8 +-- sys/cam/scsi/scsi_sa.c | 20 +++--- sys/cam/scsi/scsi_ses.c | 8 +-- sys/cam/scsi/scsi_target.c | 18 ++--- sys/coda/cnode.h | 6 +- sys/coda/coda.h | 2 +- sys/coda/coda_fbsd.c | 4 +- sys/coda/coda_psdev.c | 12 ++-- sys/coda/coda_psdev.h | 12 ++-- sys/coda/coda_venus.c | 2 +- sys/coda/coda_venus.h | 2 +- sys/coda/coda_vfsops.c | 6 +- sys/coda/coda_vnops.c | 4 +- sys/coda/coda_vnops.h | 2 +- sys/compat/linux/linux_stats.c | 12 ++-- sys/contrib/dev/fla/fla.c | 2 +- sys/contrib/ipfilter/netinet/ip_fil.c | 10 ++- sys/contrib/ipfilter/netinet/ip_fil.h | 8 +-- sys/contrib/ipfilter/netinet/mlfk_ipl.c | 2 +- sys/contrib/pf/net/pf_ioctl.c | 18 ++--- sys/dev/aac/aac.c | 8 +-- sys/dev/aac/aacvar.h | 2 +- sys/dev/acpi_support/acpi_asus.c | 6 +- sys/dev/acpica/acpi.c | 6 +- sys/dev/acpica/acpivar.h | 2 +- sys/dev/adlink/adlink.c | 8 +-- sys/dev/agp/agp.c | 8 +-- sys/dev/agp/agppriv.h | 2 +- sys/dev/amr/amr.c | 8 +-- sys/dev/amr/amrvar.h | 2 +- sys/dev/asr/asr.c | 14 ++-- sys/dev/ata/ata-all.c | 2 +- sys/dev/ata/atapi-tape.c | 8 +-- sys/dev/ata/atapi-tape.h | 2 +- sys/dev/atkbdc/psm.c | 14 ++-- sys/dev/bktr/bktr_core.c | 2 +- sys/dev/bktr/bktr_core.h | 2 +- sys/dev/bktr/bktr_os.c | 14 ++-- sys/dev/bktr/bktr_reg.h | 12 ++-- sys/dev/ciss/ciss.c | 6 +- sys/dev/ciss/cissvar.h | 2 +- sys/dev/cp/if_cp.c | 10 +-- sys/dev/ctau/if_ct.c | 10 +-- sys/dev/cx/if_cx.c | 14 ++-- sys/dev/cy/cy.c | 8 +-- sys/dev/dcons/dcons.c | 12 ++-- sys/dev/digi/digi.c | 10 +-- sys/dev/digi/digi.h | 4 +- sys/dev/drm/drmP.h | 2 +- sys/dev/drm/drm_drv.h | 6 +- sys/dev/drm/drm_fops.h | 6 +- sys/dev/drm/drm_os_freebsd.h | 4 +- sys/dev/drm/drm_vm.h | 4 +- sys/dev/fb/creatorreg.h | 2 +- sys/dev/fb/gfb.h | 2 +- sys/dev/fb/vga.c | 12 ++-- sys/dev/fb/vgareg.h | 12 ++-- sys/dev/fdc/fdc.c | 16 ++--- sys/dev/firewire/firewirereg.h | 6 +- sys/dev/firewire/fwdev.c | 22 +++---- sys/dev/firewire/fwmem.c | 14 ++-- sys/dev/firewire/fwohci.c | 2 +- sys/dev/gfb/gfb_pci.c | 12 ++-- sys/dev/ida/ida.c | 2 +- sys/dev/ida/idavar.h | 2 +- sys/dev/iicbus/iic.c | 12 ++-- sys/dev/iir/iir.h | 6 +- sys/dev/iir/iir_ctrl.c | 16 ++--- sys/dev/ips/ips.c | 6 +- sys/dev/ips/ips.h | 2 +- sys/dev/isp/isp_freebsd.c | 2 +- sys/dev/joy/joy.c | 8 +-- sys/dev/joy/joyvar.h | 2 +- sys/dev/kbd/kbd.c | 12 ++-- sys/dev/kbd/kbdreg.h | 2 +- sys/dev/led/led.c | 8 +-- sys/dev/led/led.h | 4 +- sys/dev/matcd/matcd.c | 18 ++--- sys/dev/matcd/matcd_data.h | 2 +- sys/dev/mcd/mcd.c | 10 +-- sys/dev/mcd/mcdvar.h | 2 +- sys/dev/md/md.c | 6 +- sys/dev/mlx/mlx.c | 8 +-- sys/dev/mlx/mlxvar.h | 2 +- sys/dev/mly/mly.c | 6 +- sys/dev/mly/mlyvar.h | 2 +- sys/dev/mse/mse.c | 18 ++--- sys/dev/nmdm/nmdm.c | 16 ++--- sys/dev/null/null.c | 10 +-- sys/dev/ofw/ofw_console.c | 6 +- sys/dev/ofw/openfirmio.c | 4 +- sys/dev/ofw/openpromio.c | 8 +-- sys/dev/pci/pci.c | 2 +- sys/dev/pci/pci_user.c | 6 +- sys/dev/ppbus/lpt.c | 10 +-- sys/dev/ppbus/pcfclock.c | 14 ++-- sys/dev/ppbus/ppi.c | 10 +-- sys/dev/ppbus/pps.c | 10 +-- sys/dev/random/randomdev.c | 12 ++-- sys/dev/rc/rc.c | 12 ++-- sys/dev/rp/rp.c | 10 +-- sys/dev/rp/rpreg.h | 2 +- sys/dev/sab/sab.c | 8 +-- sys/dev/scd/scd.c | 6 +- sys/dev/scd/scdvar.h | 2 +- sys/dev/si/si.c | 12 ++-- sys/dev/sio/sio.c | 12 ++-- sys/dev/smbus/smb.c | 8 +-- sys/dev/snp/snp.c | 24 +++---- sys/dev/sound/pcm/dsp.c | 30 ++++----- sys/dev/sound/pcm/mixer.c | 22 +++---- sys/dev/sound/pcm/mixer.h | 2 +- sys/dev/sound/pcm/sndstat.c | 8 +-- sys/dev/sound/pcm/sound.h | 10 +-- sys/dev/speaker/spkr.c | 10 +-- sys/dev/streams/streams.c | 6 +- sys/dev/sx/sx.c | 8 +-- sys/dev/syscons/scvesactl.c | 2 +- sys/dev/syscons/syscons.c | 26 ++++---- sys/dev/syscons/syscons.h | 4 +- sys/dev/syscons/sysmouse.c | 8 +-- sys/dev/tdfx/tdfx_pci.c | 8 +-- sys/dev/tdfx/tdfx_vars.h | 2 +- sys/dev/ti/if_ti.c | 6 +- sys/dev/ti/if_tireg.h | 2 +- sys/dev/twa/twa.h | 2 +- sys/dev/twa/twa_freebsd.c | 8 +-- sys/dev/twe/twe_compat.h | 2 +- sys/dev/twe/twe_freebsd.c | 8 +-- sys/dev/uart/uart_bus.h | 2 +- sys/dev/uart/uart_tty.c | 6 +- sys/dev/usb/ubser.c | 12 ++-- sys/dev/usb/ucom.c | 10 +-- sys/dev/usb/ucomvar.h | 2 +- sys/dev/usb/ufm.c | 8 +-- sys/dev/usb/ugen.c | 20 +++--- sys/dev/usb/uhid.c | 14 ++-- sys/dev/usb/ulpt.c | 12 ++-- sys/dev/usb/ums.c | 12 ++-- sys/dev/usb/urio.c | 14 ++-- sys/dev/usb/usb.c | 10 +-- sys/dev/usb/uscanner.c | 12 ++-- sys/dev/vinum/vinum.c | 12 ++-- sys/dev/vinum/vinumext.h | 10 +-- sys/dev/vinum/vinumioctl.c | 4 +- sys/dev/vinum/vinumobj.h | 8 +-- sys/dev/vinum/vinumutil.c | 11 +++- sys/dev/watchdog/watchdog.c | 4 +- sys/dev/zs/z8530var.h | 2 +- sys/dev/zs/zs.c | 6 +- sys/fs/cd9660/cd9660_node.c | 2 +- sys/fs/cd9660/cd9660_node.h | 2 +- sys/fs/cd9660/cd9660_vfsops.c | 8 +-- sys/fs/cd9660/iso.h | 2 +- sys/fs/coda/cnode.h | 6 +- sys/fs/coda/coda.h | 2 +- sys/fs/coda/coda_fbsd.c | 4 +- sys/fs/coda/coda_psdev.c | 12 ++-- sys/fs/coda/coda_psdev.h | 12 ++-- sys/fs/coda/coda_venus.c | 2 +- sys/fs/coda/coda_venus.h | 2 +- sys/fs/coda/coda_vfsops.c | 6 +- sys/fs/coda/coda_vnops.c | 4 +- sys/fs/coda/coda_vnops.h | 2 +- sys/fs/devfs/devfs.h | 2 +- sys/fs/devfs/devfs_devs.c | 22 +++---- sys/fs/devfs/devfs_rule.c | 20 +++--- sys/fs/devfs/devfs_vnops.c | 6 +- sys/fs/hpfs/hpfs.h | 10 +-- sys/fs/hpfs/hpfs_hash.c | 6 +- sys/fs/hpfs/hpfs_vfsops.c | 2 +- sys/fs/msdosfs/msdosfs_denode.c | 6 +- sys/fs/msdosfs/msdosfs_vfsops.c | 2 +- sys/fs/msdosfs/msdosfsmount.h | 2 +- sys/fs/ntfs/ntfs.h | 2 +- sys/fs/ntfs/ntfs_ihash.c | 2 +- sys/fs/ntfs/ntfs_ihash.h | 4 +- sys/fs/ntfs/ntfs_inode.h | 2 +- sys/fs/ntfs/ntfs_vfsops.c | 2 +- sys/fs/specfs/spec_vnops.c | 26 ++++---- sys/fs/udf/udf.h | 4 +- sys/geom/gate/g_gate.c | 4 +- sys/geom/geom.h | 3 +- sys/geom/geom_ctl.c | 4 +- sys/geom/geom_dev.c | 20 +++--- sys/gnu/ext2fs/ext2_extern.h | 4 +- sys/gnu/ext2fs/ext2_ihash.c | 4 +- sys/gnu/ext2fs/ext2_mount.h | 2 +- sys/gnu/ext2fs/ext2_vfsops.c | 8 +-- sys/gnu/ext2fs/inode.h | 4 +- sys/gnu/fs/ext2fs/ext2_extern.h | 4 +- sys/gnu/fs/ext2fs/ext2_mount.h | 2 +- sys/gnu/fs/ext2fs/ext2_vfsops.c | 8 +-- sys/gnu/fs/ext2fs/inode.h | 4 +- sys/i386/acpica/acpi_asus.c | 6 +- sys/i386/acpica/acpi_machdep.c | 10 +-- sys/i386/bios/apm.c | 10 +-- sys/i386/bios/smapi.c | 4 +- sys/i386/i386/elan-mmcr.c | 6 +- sys/i386/i386/geode.c | 2 +- sys/i386/i386/machdep.c | 4 +- sys/i386/i386/mem.c | 12 ++-- sys/i386/i386/perfmon.c | 6 +- sys/i386/include/cpu.h | 2 +- sys/i386/isa/mse.c | 18 ++--- sys/i386/isa/pcvt/pcvt_drv.c | 8 +-- sys/i386/isa/pcvt/pcvt_ext.c | 2 +- sys/i386/isa/pcvt/pcvt_hdr.h | 6 +- sys/i386/isa/pcvt/pcvt_kbd.c | 2 +- sys/i386/isa/pcvt/pcvt_sup.c | 18 ++--- sys/i386/isa/spic.c | 10 +-- sys/i386/isa/spkr.c | 10 +-- sys/i4b/driver/i4b_ctl.c | 8 +-- sys/i4b/driver/i4b_rbch.c | 12 ++-- sys/i4b/driver/i4b_tel.c | 12 ++-- sys/i4b/driver/i4b_trace.c | 10 +-- sys/i4b/layer4/i4b_i4bdrv.c | 10 +-- sys/ia64/ia64/mem.c | 14 ++-- sys/ia64/ia64/ssc.c | 4 +- sys/ia64/ia64/sscdisk.c | 2 +- sys/ia64/include/cpu.h | 2 +- sys/isa/psm.c | 14 ++-- sys/isa/vga_isa.c | 12 ++-- sys/isofs/cd9660/cd9660_node.c | 2 +- sys/isofs/cd9660/cd9660_node.h | 2 +- sys/isofs/cd9660/cd9660_vfsops.c | 8 +-- sys/isofs/cd9660/iso.h | 2 +- sys/kern/kern_conf.c | 76 +++++++++++----------- sys/kern/kern_descrip.c | 4 +- sys/kern/kern_physio.c | 2 +- sys/kern/subr_bus.c | 12 ++-- sys/kern/subr_devstat.c | 2 +- sys/kern/subr_log.c | 10 +-- sys/kern/tty.c | 22 +++---- sys/kern/tty_conf.c | 2 +- sys/kern/tty_cons.c | 18 ++--- sys/kern/tty_pty.c | 32 ++++----- sys/kern/tty_tty.c | 6 +- sys/kern/vfs_bio.c | 2 +- sys/kern/vfs_mount.c | 16 ++--- sys/kern/vfs_subr.c | 24 +++---- sys/net/bpf.c | 18 ++--- sys/net/if.c | 8 +-- sys/net/if_sl.c | 4 +- sys/net/if_tap.c | 20 +++--- sys/net/if_tapvar.h | 2 +- sys/net/if_tun.c | 26 ++++---- sys/net/if_var.h | 2 +- sys/net/ppp_tty.c | 4 +- sys/netgraph/bluetooth/drivers/h4/ng_h4.c | 4 +- sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c | 12 ++-- sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h | 6 +- sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c | 18 ++--- sys/netgraph/ng_device.c | 14 ++-- sys/netgraph/ng_tty.c | 4 +- sys/netncp/ncp_mod.c | 4 +- sys/netsmb/smb_dev.c | 10 +-- sys/nfs4client/nfs4_dev.c | 10 +-- sys/opencrypto/cryptodev.c | 10 +-- sys/pc98/cbus/fdc.c | 16 ++--- sys/pc98/cbus/gdc.c | 12 ++-- sys/pc98/cbus/olpt.c | 8 +-- sys/pc98/cbus/sio.c | 24 +++---- sys/pc98/i386/machdep.c | 4 +- sys/pc98/pc98/fd.c | 16 ++--- sys/pc98/pc98/machdep.c | 4 +- sys/pc98/pc98/mse.c | 18 ++--- sys/pc98/pc98/olpt.c | 8 +-- sys/pc98/pc98/pc98gdc.c | 12 ++-- sys/pc98/pc98/sio.c | 24 +++---- sys/pc98/pc98/wd_cd.c | 8 +-- sys/pccard/pccard.c | 12 ++-- sys/pccard/slot.h | 2 +- sys/pci/agp.c | 8 +-- sys/pci/agppriv.h | 2 +- sys/pci/if_ti.c | 6 +- sys/pci/if_tireg.h | 2 +- sys/pci/xrpu.c | 8 +-- sys/powerpc/ofw/ofw_syscons.h | 2 +- sys/security/mac/mac_framework.h | 3 +- sys/security/mac/mac_policy.h | 2 +- sys/security/mac/mac_vfs.c | 2 +- sys/security/mac_biba/mac_biba.c | 2 +- sys/security/mac_lomac/mac_lomac.c | 2 +- sys/security/mac_mls/mac_mls.c | 2 +- sys/security/mac_stub/mac_stub.c | 2 +- sys/security/mac_test/mac_test.c | 2 +- sys/sparc64/creator/creator.h | 2 +- sys/sparc64/creator/creator_upa.c | 8 +-- sys/sparc64/include/cpu.h | 2 +- sys/sparc64/sparc64/mem.c | 8 +-- sys/sys/_types.h | 7 +- sys/sys/bio.h | 4 +- sys/sys/conf.h | 56 ++++++++-------- sys/sys/linedisc.h | 4 +- sys/sys/mac.h | 3 +- sys/sys/mac_policy.h | 2 +- sys/sys/mount.h | 2 +- sys/sys/param.h | 2 +- sys/sys/stat.h | 2 + sys/sys/sysctl.h | 2 +- sys/sys/systm.h | 14 ++-- sys/sys/tty.h | 4 +- sys/sys/types.h | 2 + sys/sys/vnode.h | 6 +- sys/ufs/ffs/ffs_alloc.c | 4 +- sys/ufs/ffs/ffs_vfsops.c | 4 +- sys/ufs/ufs/dinode.h | 2 +- sys/ufs/ufs/ufs_extern.h | 4 +- sys/ufs/ufs/ufs_ihash.c | 4 +- sys/ufs/ufs/ufsmount.h | 2 +- sys/vm/device_pager.c | 4 +- sys/vm/swap_pager.c | 2 +- 331 files changed, 1290 insertions(+), 1279 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/alpha/alpha/mem.c b/sys/alpha/alpha/mem.c index 4cd0bdb7b58a..a64ea2aadf4a 100644 --- a/sys/alpha/alpha/mem.c +++ b/sys/alpha/alpha/mem.c @@ -67,9 +67,9 @@ __FBSDID("$FreeBSD$"); #include #include -static dev_t memdev, kmemdev; +static struct cdev *memdev, *kmemdev; #ifdef PERFMON -static dev_t perfdev; +static struct cdev *perfdev; #endif /* PERFMON */ static d_open_t mmopen; @@ -95,7 +95,7 @@ static struct cdevsw mem_cdevsw = { struct mem_range_softc mem_range_softc; static int -mmclose(dev_t dev, int flags, int fmt, struct thread *td) +mmclose(struct cdev *dev, int flags, int fmt, struct thread *td) { switch (minor(dev)) { #ifdef PERFMON @@ -109,7 +109,7 @@ mmclose(dev_t dev, int flags, int fmt, struct thread *td) } static int -mmopen(dev_t dev, int flags, int fmt, struct thread *td) +mmopen(struct cdev *dev, int flags, int fmt, struct thread *td) { int error; @@ -136,7 +136,7 @@ mmopen(dev_t dev, int flags, int fmt, struct thread *td) /*ARGSUSED*/ static int -mmrw(dev_t dev, struct uio *uio, int flags) +mmrw(struct cdev *dev, struct uio *uio, int flags) { vm_offset_t o, v; int c = 0; @@ -219,7 +219,7 @@ kmemphys: * instead of going through read/write * \*******************************************************/ static int -memmmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) { /* * /dev/mem is the only one that makes sense through this @@ -240,7 +240,7 @@ memmmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) } static int -mmioctl(dev_t dev, u_long cmd, caddr_t cmdarg, int flags, struct thread *td) +mmioctl(struct cdev *dev, u_long cmd, caddr_t cmdarg, int flags, struct thread *td) { switch(minor(dev)) { #ifdef PERFMON diff --git a/sys/alpha/alpha/promcons.c b/sys/alpha/alpha/promcons.c index 3a127ead0490..6ced298effd4 100644 --- a/sys/alpha/alpha/promcons.c +++ b/sys/alpha/alpha/promcons.c @@ -86,7 +86,7 @@ void promcons_delayed_makedev(void); int promopen(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag, mode; struct thread *td; { @@ -137,7 +137,7 @@ promopen(dev, flag, mode, td) int promclose(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag, mode; struct thread *td; { diff --git a/sys/alpha/include/cpu.h b/sys/alpha/include/cpu.h index 9db2b9aad497..1edf6bebab64 100644 --- a/sys/alpha/include/cpu.h +++ b/sys/alpha/include/cpu.h @@ -66,7 +66,7 @@ struct clockframe { /* * CTL_MACHDEP definitions. */ -#define CPU_CONSDEV 1 /* dev_t: console terminal device */ +#define CPU_CONSDEV 1 /* struct cdev *: console terminal device */ #define CPU_ROOT_DEVICE 2 /* string: root device name */ #define CPU_UNALIGNED_PRINT 3 /* int: print unaligned accesses */ #define CPU_UNALIGNED_FIX 4 /* int: fix unaligned accesses */ diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c index 1387f9713949..d4504d330d70 100644 --- a/sys/alpha/tlsb/zs_tlsb.c +++ b/sys/alpha/tlsb/zs_tlsb.c @@ -258,7 +258,7 @@ zs_cnputc(struct consdev *cp, int c) static int -zsopen(dev_t dev, int flag, int mode, struct thread *td) +zsopen(struct cdev *dev, int flag, int mode, struct thread *td) { struct zs_softc *sc = ZS_SOFTC(minor(dev)); struct tty *tp; @@ -305,7 +305,7 @@ zsopen(dev_t dev, int flag, int mode, struct thread *td) } static int -zsclose(dev_t dev, int flag, int mode, struct thread *td) +zsclose(struct cdev *dev, int flag, int mode, struct thread *td) { struct zs_softc *sc = ZS_SOFTC(minor(dev)); struct tty *tp; diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index d4cf7823caeb..739ae6deb655 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include -static dev_t memdev, kmemdev, iodev; +static struct cdev *memdev, *kmemdev, *iodev; static d_open_t mmopen; static d_close_t mmclose; @@ -95,7 +95,7 @@ MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); struct mem_range_softc mem_range_softc; static int -mmclose(dev_t dev, int flags, int fmt, struct thread *td) +mmclose(struct cdev *dev, int flags, int fmt, struct thread *td) { switch (minor(dev)) { case 14: @@ -105,7 +105,7 @@ mmclose(dev_t dev, int flags, int fmt, struct thread *td) } static int -mmopen(dev_t dev, int flags, int fmt, struct thread *td) +mmopen(struct cdev *dev, int flags, int fmt, struct thread *td) { int error; @@ -133,7 +133,7 @@ mmopen(dev_t dev, int flags, int fmt, struct thread *td) /*ARGSUSED*/ static int -mmrw(dev_t dev, struct uio *uio, int flags) +mmrw(struct cdev *dev, struct uio *uio, int flags) { int o; u_long c = 0, v; @@ -214,7 +214,7 @@ kmemphys: * instead of going through read/write * \*******************************************************/ static int -memmmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) { switch (minor(dev)) { @@ -242,7 +242,7 @@ memmmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) * and mem_range_attr_set. */ static int -mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) +mmioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { int nd, error = 0; struct mem_range_op *mo = (struct mem_range_op *)data; diff --git a/sys/amd64/include/cpu.h b/sys/amd64/include/cpu.h index f8a2ee3fef0e..2aeda85bccab 100644 --- a/sys/amd64/include/cpu.h +++ b/sys/amd64/include/cpu.h @@ -65,7 +65,7 @@ /* * CTL_MACHDEP definitions. */ -#define CPU_CONSDEV 1 /* dev_t: console terminal device */ +#define CPU_CONSDEV 1 /* struct cdev *: console terminal device */ #define CPU_ADJKERNTZ 2 /* int: timezone offset (seconds) */ #define CPU_DISRTCSET 3 /* int: disable resettodr() call */ #define CPU_WALLCLOCK 5 /* int: indicates wall CMOS clock */ diff --git a/sys/arm/arm/nexus_io.c b/sys/arm/arm/nexus_io.c index 0a93a75b68b8..969c30e95baf 100644 --- a/sys/arm/arm/nexus_io.c +++ b/sys/arm/arm/nexus_io.c @@ -190,7 +190,7 @@ nexus_bs_subregion(t, bsh, offset, size, nbshp) } int -nexus_bs_mmap(dev_t dev, vm_offset_t off, vm_paddr_t *addr, int prot) +nexus_bs_mmap(struct cdev *dev, vm_offset_t off, vm_paddr_t *addr, int prot) { *addr = off; return (0); diff --git a/sys/arm/include/bus.h b/sys/arm/include/bus.h index 798f42539e87..60660506e77a 100644 --- a/sys/arm/include/bus.h +++ b/sys/arm/include/bus.h @@ -118,7 +118,7 @@ struct bus_space { void * (*bs_vaddr) (void *, bus_space_handle_t); /* mmap bus space for user */ - int (*bs_mmap) (dev_t, vm_offset_t, vm_paddr_t *, int); + int (*bs_mmap) (struct cdev *, vm_offset_t, vm_paddr_t *, int); /* barrier */ void (*bs_barrier) (void *, bus_space_handle_t, @@ -411,7 +411,7 @@ void __bs_c(f,_bs_free) (void *t, bus_space_handle_t bsh, \ void * __bs_c(f,_bs_vaddr) (void *t, bus_space_handle_t bsh); #define bs_mmap_proto(f) \ -int __bs_c(f,_bs_mmap) (dev_t, vm_offset_t, vm_paddr_t *, int); +int __bs_c(f,_bs_mmap) (struct cdev *, vm_offset_t, vm_paddr_t *, int); #define bs_barrier_proto(f) \ void __bs_c(f,_bs_barrier) (void *t, bus_space_handle_t bsh, \ diff --git a/sys/arm/sa11x0/sa11x0_io.c b/sys/arm/sa11x0/sa11x0_io.c index 7b91d5f94ee0..0fe03751d674 100644 --- a/sys/arm/sa11x0/sa11x0_io.c +++ b/sys/arm/sa11x0/sa11x0_io.c @@ -225,7 +225,7 @@ sa11x0_bs_subregion(t, bsh, offset, size, nbshp) } int -sa11x0_bs_mmap(dev_t t, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +sa11x0_bs_mmap(struct cdev *t, vm_offset_t offset, vm_paddr_t *paddr, int nprot) { *paddr = offset; return (0); diff --git a/sys/boot/i386/libi386/bioscd.c b/sys/boot/i386/libi386/bioscd.c index 7259ff59ec04..ad0d40987744 100644 --- a/sys/boot/i386/libi386/bioscd.c +++ b/sys/boot/i386/libi386/bioscd.c @@ -325,7 +325,7 @@ bc_read(int unit, daddr_t dblk, int blks, caddr_t dest) } /* - * Return a suitable dev_t value for (dev). + * Return a suitable struct cdev *value for (dev). */ int bc_getdev(struct i386_devdesc *dev) @@ -344,7 +344,7 @@ bc_getdev(struct i386_devdesc *dev) * XXX: Need to examine device spec here to figure out if SCSI or * ATAPI. No idea on how to figure out device number. All we can * really pass to the kernel is what bus and device on which bus we - * were booted from, which dev_t isn't well suited to since those + * were booted from, which struct cdev *isn't well suited to since those * number don't match to unit numbers very well. We may just need * to engage in a hack where we pass -C to the boot args if we are * the boot device. diff --git a/sys/boot/i386/libi386/biosdisk.c b/sys/boot/i386/libi386/biosdisk.c index aeac2e38904c..42906ba45269 100644 --- a/sys/boot/i386/libi386/biosdisk.c +++ b/sys/boot/i386/libi386/biosdisk.c @@ -1165,7 +1165,7 @@ bd_getbigeom(int bunit) } /* - * Return a suitable dev_t value for (dev). + * Return a suitable struct cdev *value for (dev). * * In the case where it looks like (dev) is a SCSI disk, we allow the number of * IDE disks to be specified in $num_ide_disks. There should be a Better Way. diff --git a/sys/boot/i386/libi386/libi386.h b/sys/boot/i386/libi386/libi386.h index f2696e0a360d..b3feaccc20ba 100644 --- a/sys/boot/i386/libi386/libi386.h +++ b/sys/boot/i386/libi386/libi386.h @@ -72,13 +72,13 @@ extern struct devsw pxedisk; extern struct fs_ops pxe_fsops; int bc_add(int biosdev); /* Register CD booted from. */ -int bc_getdev(struct i386_devdesc *dev); /* return dev_t for (dev) */ +int bc_getdev(struct i386_devdesc *dev); /* return struct cdev *for (dev) */ int bc_bios2unit(int biosdev); /* xlate BIOS device -> bioscd unit */ int bc_unit2bios(int unit); /* xlate bioscd unit -> BIOS device */ u_int32_t bd_getbigeom(int bunit); /* return geometry in bootinfo format */ int bd_bios2unit(int biosdev); /* xlate BIOS device -> biosdisk unit */ int bd_unit2bios(int unit); /* xlate biosdisk unit -> BIOS device */ -int bd_getdev(struct i386_devdesc *dev); /* return dev_t for (dev) */ +int bd_getdev(struct i386_devdesc *dev); /* return struct cdev *for (dev) */ ssize_t i386_copyin(const void *src, vm_offset_t dest, const size_t len); ssize_t i386_copyout(const vm_offset_t src, void *dest, const size_t len); diff --git a/sys/boot/pc98/boot2/dinode.h b/sys/boot/pc98/boot2/dinode.h index 2a78f344d40c..e5fa7e6a4f89 100644 --- a/sys/boot/pc98/boot2/dinode.h +++ b/sys/boot/pc98/boot2/dinode.h @@ -94,7 +94,7 @@ struct dinode { * The di_db fields may be overlaid with other information for * file types that do not have associated disk storage. Block * and character devices overlay the first data block with their - * dev_t value. Short symbolic links place their path in the + * struct cdev *value. Short symbolic links place their path in the * di_db area. */ #define di_inumber di_u.inumber diff --git a/sys/boot/pc98/boot2/inode.h b/sys/boot/pc98/boot2/inode.h index 9a59f99bc77b..facc1222217e 100644 --- a/sys/boot/pc98/boot2/inode.h +++ b/sys/boot/pc98/boot2/inode.h @@ -69,7 +69,7 @@ struct inode { struct vnode *i_vnode;/* Vnode associated with this inode. */ struct vnode *i_devvp;/* Vnode for block I/O. */ u_int32_t i_flag; /* flags, see below */ - dev_t i_dev; /* Device associated with the inode. */ + struct cdev *i_dev; /* Device associated with the inode. */ ino_t i_number; /* The identity of the inode. */ int i_effnlink; /* i_nlink when I/O completes */ diff --git a/sys/boot/pc98/libpc98/biosdisk.c b/sys/boot/pc98/libpc98/biosdisk.c index 9b2a535055f0..ec0dffa135a1 100644 --- a/sys/boot/pc98/libpc98/biosdisk.c +++ b/sys/boot/pc98/libpc98/biosdisk.c @@ -1481,7 +1481,7 @@ bd_getbigeom(int bunit) } /* - * Return a suitable dev_t value for (dev). + * Return a suitable struct cdev *value for (dev). * * In the case where it looks like (dev) is a SCSI disk, we allow the number of * IDE disks to be specified in $num_ide_disks. There should be a Better Way. diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 3cd6a8bc7c88..592809f19b0e 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -936,7 +936,7 @@ xptdone(struct cam_periph *periph, union ccb *done_ccb) } static int -xptopen(dev_t dev, int flags, int fmt, struct thread *td) +xptopen(struct cdev *dev, int flags, int fmt, struct thread *td) { int unit; @@ -973,7 +973,7 @@ xptopen(dev_t dev, int flags, int fmt, struct thread *td) } static int -xptclose(dev_t dev, int flag, int fmt, struct thread *td) +xptclose(struct cdev *dev, int flag, int fmt, struct thread *td) { int unit; @@ -996,7 +996,7 @@ xptclose(dev_t dev, int flag, int fmt, struct thread *td) } static int -xptioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +xptioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { int unit, error; diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c index 7caaf0a2d2a2..1cf3b1fb5c72 100644 --- a/sys/cam/scsi/scsi_ch.c +++ b/sys/cam/scsi/scsi_ch.c @@ -145,7 +145,7 @@ struct ch_softc { ch_quirks quirks; union ccb saved_ccb; struct devstat *device_stats; - dev_t dev; + struct cdev *dev; int sc_picker; /* current picker */ @@ -405,7 +405,7 @@ chregister(struct cam_periph *periph, void *arg) } static int -chopen(dev_t dev, int flags, int fmt, struct thread *td) +chopen(struct cdev *dev, int flags, int fmt, struct thread *td) { struct cam_periph *periph; struct ch_softc *softc; @@ -453,7 +453,7 @@ chopen(dev_t dev, int flags, int fmt, struct thread *td) } static int -chclose(dev_t dev, int flag, int fmt, struct thread *td) +chclose(struct cdev *dev, int flag, int fmt, struct thread *td) { struct cam_periph *periph; struct ch_softc *softc; @@ -702,7 +702,7 @@ cherror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags) } static int -chioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +chioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct cam_periph *periph; struct ch_softc *softc; diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c index 67c73d9216c2..ec98f42591ac 100644 --- a/sys/cam/scsi/scsi_pass.c +++ b/sys/cam/scsi/scsi_pass.c @@ -74,7 +74,7 @@ struct pass_softc { u_int8_t pd_type; union ccb saved_ccb; struct devstat *device_stats; - dev_t dev; + struct cdev *dev; }; @@ -317,7 +317,7 @@ passregister(struct cam_periph *periph, void *arg) } static int -passopen(dev_t dev, int flags, int fmt, struct thread *td) +passopen(struct cdev *dev, int flags, int fmt, struct thread *td) { struct cam_periph *periph; struct pass_softc *softc; @@ -384,7 +384,7 @@ passopen(dev_t dev, int flags, int fmt, struct thread *td) } static int -passclose(dev_t dev, int flag, int fmt, struct thread *td) +passclose(struct cdev *dev, int flag, int fmt, struct thread *td) { struct cam_periph *periph; struct pass_softc *softc; @@ -446,7 +446,7 @@ passdone(struct cam_periph *periph, union ccb *done_ccb) } static int -passioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +passioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct cam_periph *periph; struct pass_softc *softc; diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c index 9e053f88d09a..94653b524c96 100644 --- a/sys/cam/scsi/scsi_pt.c +++ b/sys/cam/scsi/scsi_pt.c @@ -83,7 +83,7 @@ struct pt_softc { pt_flags flags; union ccb saved_ccb; int io_timeout; - dev_t dev; + struct cdev *dev; }; static d_open_t ptopen; @@ -134,7 +134,7 @@ static struct cdevsw pt_cdevsw = { #endif static int -ptopen(dev_t dev, int flags, int fmt, struct thread *td) +ptopen(struct cdev *dev, int flags, int fmt, struct thread *td) { struct cam_periph *periph; struct pt_softc *softc; @@ -178,7 +178,7 @@ ptopen(dev_t dev, int flags, int fmt, struct thread *td) } static int -ptclose(dev_t dev, int flag, int fmt, struct thread *td) +ptclose(struct cdev *dev, int flag, int fmt, struct thread *td) { struct cam_periph *periph; struct pt_softc *softc; @@ -645,7 +645,7 @@ pterror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags) } static int -ptioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +ptioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct cam_periph *periph; struct pt_softc *softc; diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index b1fbd225a74e..4836b8ade116 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -192,11 +192,11 @@ typedef enum { #define SA_NUM_MODES 4 struct sa_devs { - dev_t ctl_dev; + struct cdev *ctl_dev; struct sa_mode_devs { - dev_t r_dev; - dev_t nr_dev; - dev_t er_dev; + struct cdev *r_dev; + struct cdev *nr_dev; + struct cdev *er_dev; } mode_devs[SA_NUM_MODES]; }; @@ -398,7 +398,7 @@ static void saprevent(struct cam_periph *periph, int action); static int sarewind(struct cam_periph *periph); static int saspace(struct cam_periph *periph, int count, scsi_space_code code); -static int samount(struct cam_periph *, int, dev_t); +static int samount(struct cam_periph *, int, struct cdev *); static int saretension(struct cam_periph *periph); static int sareservereleaseunit(struct cam_periph *periph, int reserve); @@ -437,7 +437,7 @@ static struct cdevsw sa_cdevsw = { }; static int -saopen(dev_t dev, int flags, int fmt, struct thread *td) +saopen(struct cdev *dev, int flags, int fmt, struct thread *td) { struct cam_periph *periph; struct sa_softc *softc; @@ -497,7 +497,7 @@ saopen(dev_t dev, int flags, int fmt, struct thread *td) } static int -saclose(dev_t dev, int flag, int fmt, struct thread *td) +saclose(struct cdev *dev, int flag, int fmt, struct thread *td) { struct cam_periph *periph; struct sa_softc *softc; @@ -756,7 +756,7 @@ sastrategy(struct bio *bp) } static int -saioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) +saioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) { struct cam_periph *periph; struct sa_softc *softc; @@ -1473,7 +1473,7 @@ saregister(struct cam_periph *periph, void *arg) * Make the (well known) aliases for the first mode. */ if (i == 0) { - dev_t alias; + struct cdev *alias; alias = make_dev_alias(softc->devs.mode_devs[i].r_dev, "%s%d", periph->periph_name, periph->unit_number); @@ -1777,7 +1777,7 @@ sadone(struct cam_periph *periph, union ccb *done_ccb) * Mount the tape (make sure it's ready for I/O). */ static int -samount(struct cam_periph *periph, int oflags, dev_t dev) +samount(struct cam_periph *periph, int oflags, struct cdev *dev) { struct sa_softc *softc; union ccb *ccb; diff --git a/sys/cam/scsi/scsi_ses.c b/sys/cam/scsi/scsi_ses.c index a0a2f14b3802..25b94892ae16 100644 --- a/sys/cam/scsi/scsi_ses.c +++ b/sys/cam/scsi/scsi_ses.c @@ -145,7 +145,7 @@ struct ses_softc { ses_encstat ses_encstat; /* overall status */ u_int8_t ses_flags; union ccb ses_saved_ccb; - dev_t ses_dev; + struct cdev *ses_dev; struct cam_periph *periph; }; #define SES_FLAG_INVALID 0x01 @@ -405,7 +405,7 @@ sesregister(struct cam_periph *periph, void *arg) } static int -sesopen(dev_t dev, int flags, int fmt, struct thread *td) +sesopen(struct cdev *dev, int flags, int fmt, struct thread *td) { struct cam_periph *periph; struct ses_softc *softc; @@ -461,7 +461,7 @@ out: } static int -sesclose(dev_t dev, int flag, int fmt, struct thread *td) +sesclose(struct cdev *dev, int flag, int fmt, struct thread *td) { struct cam_periph *periph; struct ses_softc *softc; @@ -517,7 +517,7 @@ seserror(union ccb *ccb, u_int32_t cflags, u_int32_t sflags) } static int -sesioctl(dev_t dev, u_long cmd, caddr_t arg_addr, int flag, struct thread *td) +sesioctl(struct cdev *dev, u_long cmd, caddr_t arg_addr, int flag, struct thread *td) { struct cam_periph *periph; ses_encstat tmp; diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c index 9310efe434aa..f3739ea4b4ea 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -142,7 +142,7 @@ static struct targ_cmd_descr * targgetdescr(struct targ_softc *softc); static periph_init_t targinit; static void targclone(void *arg, char *name, int namelen, - dev_t *dev); + struct cdev **dev); static void targasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg); static void abort_all_pending(struct targ_softc *softc); @@ -165,7 +165,7 @@ static MALLOC_DEFINE(M_TARG, "TARG", "TARG data"); /* Create softc and initialize it. Only one proc can open each targ device. */ static int -targopen(dev_t dev, int flags, int fmt, struct thread *td) +targopen(struct cdev *dev, int flags, int fmt, struct thread *td) { struct targ_softc *softc; @@ -202,7 +202,7 @@ targopen(dev_t dev, int flags, int fmt, struct thread *td) /* Disable LUN if enabled and teardown softc */ static int -targclose(dev_t dev, int flag, int fmt, struct thread *td) +targclose(struct cdev *dev, int flag, int fmt, struct thread *td) { struct targ_softc *softc; int error; @@ -230,7 +230,7 @@ targclose(dev_t dev, int flag, int fmt, struct thread *td) /* Enable/disable LUNs, set debugging level */ static int -targioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +targioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct targ_softc *softc; cam_status status; @@ -303,7 +303,7 @@ targioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) /* Writes are always ready, reads wait for user_ccb_queue or abort_queue */ static int -targpoll(dev_t dev, int poll_events, struct thread *td) +targpoll(struct cdev *dev, int poll_events, struct thread *td) { struct targ_softc *softc; int revents; @@ -329,7 +329,7 @@ targpoll(dev_t dev, int poll_events, struct thread *td) } static int -targkqfilter(dev_t dev, struct knote *kn) +targkqfilter(struct cdev *dev, struct knote *kn) { struct targ_softc *softc; @@ -534,7 +534,7 @@ targdtor(struct cam_periph *periph) /* Receive CCBs from user mode proc and send them to the HBA */ static int -targwrite(dev_t dev, struct uio *uio, int ioflag) +targwrite(struct cdev *dev, struct uio *uio, int ioflag) { union ccb *user_ccb; struct targ_softc *softc; @@ -835,7 +835,7 @@ targdone(struct cam_periph *periph, union ccb *done_ccb) /* Return CCBs to the user from the user queue and abort queue */ static int -targread(dev_t dev, struct uio *uio, int ioflag) +targread(struct cdev *dev, struct uio *uio, int ioflag) { struct descr_queue *abort_queue; struct targ_cmd_descr *user_descr; @@ -1031,7 +1031,7 @@ targinit(void) } static void -targclone(void *arg, char *name, int namelen, dev_t *dev) +targclone(void *arg, char *name, int namelen, struct cdev **dev) { int u; diff --git a/sys/coda/cnode.h b/sys/coda/cnode.h index 540831c719b0..be7e848bbea6 100644 --- a/sys/coda/cnode.h +++ b/sys/coda/cnode.h @@ -109,7 +109,7 @@ struct cnode { struct vattr c_vattr; /* attributes */ char *c_symlink; /* pointer to symbolic link */ u_short c_symlen; /* length of symbolic link */ - dev_t c_device; /* associated vnode device */ + struct cdev *c_device; /* associated vnode device */ ino_t c_inode; /* associated vnode inode */ struct cnode *c_next; /* links if on NetBSD machine */ }; @@ -153,7 +153,7 @@ struct coda_mntinfo { struct vnode *mi_rootvp; struct mount *mi_vfsp; struct vcomm mi_vcomm; - dev_t dev; + struct cdev *dev; int mi_started; }; extern struct coda_mntinfo coda_mnttbl[]; /* indexed by minor device number */ @@ -201,7 +201,7 @@ extern struct cnode *make_coda_node(CodaFid *fid, struct mount *vfsp, short type extern int coda_vnodeopstats_init(void); /* coda_vfsops.h */ -extern struct mount *devtomp(dev_t dev); +extern struct mount *devtomp(struct cdev *dev); /* sigh */ #define CODA_RDWR ((u_long) 31) diff --git a/sys/coda/coda.h b/sys/coda/coda.h index e7f1e0d2566b..90e7e2ae7202 100644 --- a/sys/coda/coda.h +++ b/sys/coda/coda.h @@ -58,7 +58,7 @@ typedef unsigned long u_long; typedef unsigned int u_int; typedef unsigned short u_short; typedef u_long ino_t; -typedef u_long dev_t; +typedef u_long struct cdev *; typedef void * caddr_t; #ifdef DOS typedef unsigned __int64 u_quad_t; diff --git a/sys/coda/coda_fbsd.c b/sys/coda/coda_fbsd.c index 784962c19e66..0ce6e466e87e 100644 --- a/sys/coda/coda_fbsd.c +++ b/sys/coda/coda_fbsd.c @@ -174,7 +174,7 @@ printf("error = %d\n", error); /* for DEVFS, using bpf & tun drivers as examples*/ static void coda_fbsd_drvinit(void *unused); static void coda_fbsd_drvuninit(void *unused); -static void coda_fbsd_clone(void *arg, char *name, int namelen, dev_t *dev); +static void coda_fbsd_clone(void *arg, char *name, int namelen, struct cdev **dev); static eventhandler_tag clonetag; @@ -182,7 +182,7 @@ static void coda_fbsd_clone(arg, name, namelen, dev) void *arg; char *name; int namelen; - dev_t *dev; + struct cdev **dev; { int u; diff --git a/sys/coda/coda_psdev.c b/sys/coda/coda_psdev.c index 133d0fdb1579..03e408da63d6 100644 --- a/sys/coda/coda_psdev.c +++ b/sys/coda/coda_psdev.c @@ -117,7 +117,7 @@ vcodaattach(n) int vc_nb_open(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag; int mode; struct thread *td; /* NetBSD only */ @@ -149,7 +149,7 @@ vc_nb_open(dev, flag, mode, td) int vc_nb_close (dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag; int mode; struct thread *td; @@ -233,7 +233,7 @@ vc_nb_close (dev, flag, mode, td) int vc_nb_read(dev, uiop, flag) - dev_t dev; + struct cdev *dev; struct uio *uiop; int flag; { @@ -287,7 +287,7 @@ vc_nb_read(dev, uiop, flag) int vc_nb_write(dev, uiop, flag) - dev_t dev; + struct cdev *dev; struct uio *uiop; int flag; { @@ -387,7 +387,7 @@ vc_nb_write(dev, uiop, flag) int vc_nb_ioctl(dev, cmd, addr, flag, td) - dev_t dev; + struct cdev *dev; u_long cmd; caddr_t addr; int flag; @@ -441,7 +441,7 @@ vc_nb_ioctl(dev, cmd, addr, flag, td) int vc_nb_poll(dev, events, td) - dev_t dev; + struct cdev *dev; int events; struct thread *td; { diff --git a/sys/coda/coda_psdev.h b/sys/coda/coda_psdev.h index c6ecf7f435e2..f135b3441208 100644 --- a/sys/coda/coda_psdev.h +++ b/sys/coda/coda_psdev.h @@ -31,9 +31,9 @@ * */ -int vc_nb_open(dev_t dev, int flag, int mode, struct thread *p); -int vc_nb_close (dev_t dev, int flag, int mode, struct thread *p); -int vc_nb_read(dev_t dev, struct uio *uiop, int flag); -int vc_nb_write(dev_t dev, struct uio *uiop, int flag); -int vc_nb_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *p); -int vc_nb_poll(dev_t dev, int events, struct thread *p); +int vc_nb_open(struct cdev *dev, int flag, int mode, struct thread *p); +int vc_nb_close (struct cdev *dev, int flag, int mode, struct thread *p); +int vc_nb_read(struct cdev *dev, struct uio *uiop, int flag); +int vc_nb_write(struct cdev *dev, struct uio *uiop, int flag); +int vc_nb_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *p); +int vc_nb_poll(struct cdev *dev, int events, struct thread *p); diff --git a/sys/coda/coda_venus.c b/sys/coda/coda_venus.c index 5105c0b882bc..f0bc3c296bdf 100644 --- a/sys/coda/coda_venus.c +++ b/sys/coda/coda_venus.c @@ -198,7 +198,7 @@ venus_root(void *mdp, int venus_open(void *mdp, CodaFid *fid, int flag, struct ucred *cred, struct proc *p, -/*out*/ dev_t *dev, ino_t *inode) +/*out*/ struct cdev **dev, ino_t *inode) { int cflag; DECL(coda_open); /* sets Isize & Osize */ diff --git a/sys/coda/coda_venus.h b/sys/coda/coda_venus.h index b506b5ba0277..473b84d30092 100644 --- a/sys/coda/coda_venus.h +++ b/sys/coda/coda_venus.h @@ -39,7 +39,7 @@ venus_root(void *mdp, int venus_open(void *mdp, CodaFid *fid, int flag, struct ucred *cred, struct proc *p, -/*out*/ dev_t *dev, ino_t *inode); +/*out*/ struct cdev **dev, ino_t *inode); int venus_close(void *mdp, CodaFid *fid, int flag, diff --git a/sys/coda/coda_vfsops.c b/sys/coda/coda_vfsops.c index ff6442932037..e7290e770807 100644 --- a/sys/coda/coda_vfsops.c +++ b/sys/coda/coda_vfsops.c @@ -81,7 +81,7 @@ struct coda_op_stats coda_vfsopstats[CODA_VFSOPS_SIZE]; #define MRAK_INT_GEN(op) (coda_vfsopstats[op].gen_intrn++) extern int coda_nc_initialized; /* Set if cache has been initialized */ -extern int vc_nb_open(dev_t, int, int, struct thread *); +extern int vc_nb_open(struct cdev *, int, int, struct thread *); int coda_vfsopstats_init(void) @@ -114,7 +114,7 @@ coda_mount(vfsp, path, data, ndp, td) { struct vnode *dvp; struct cnode *cp; - dev_t dev; + struct cdev *dev; struct coda_mntinfo *mi; struct vnode *rootvp; CodaFid rootfid = INVAL_FID; @@ -528,7 +528,7 @@ getNewVnode(vpp) * device corresponds to a UFS. Return NULL if no device is found. */ struct mount *devtomp(dev) - dev_t dev; + struct cdev *dev; { struct mount *mp; diff --git a/sys/coda/coda_vnops.c b/sys/coda/coda_vnops.c index a1d24e930f77..a8666cc6f2f7 100644 --- a/sys/coda/coda_vnops.c +++ b/sys/coda/coda_vnops.c @@ -238,7 +238,7 @@ coda_open(v) /* locals */ int error; struct vnode *vp; - dev_t dev; + struct cdev *dev; ino_t inode; MARK_ENTRY(CODA_OPEN_STATS); @@ -1806,7 +1806,7 @@ coda_islocked(v) /* How one looks up a vnode given a device/inode pair: */ int -coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp) +coda_grab_vnode(struct cdev *dev, ino_t ino, struct vnode **vpp) { /* This is like VFS_VGET() or igetinode()! */ int error; diff --git a/sys/coda/coda_vnops.h b/sys/coda/coda_vnops.h index 8a3184b83c99..88a398e8cd6c 100644 --- a/sys/coda/coda_vnops.h +++ b/sys/coda/coda_vnops.h @@ -82,6 +82,6 @@ int coda_pathconf(void *); int coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, int ioflag, struct ucred *cred, struct thread *td); -int coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp); +int coda_grab_vnode(struct cdev *dev, ino_t ino, struct vnode **vpp); void print_vattr(struct vattr *attr); void print_cred(struct ucred *cred); diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c index eaf6da07e648..4a02042ddc5f 100644 --- a/sys/compat/linux/linux_stats.c +++ b/sys/compat/linux/linux_stats.c @@ -55,7 +55,7 @@ newstat_copyout(struct stat *buf, void *ubuf) { struct l_newstat tbuf; struct cdevsw *cdevsw; - dev_t dev; + struct cdev *dev; bzero(&tbuf, sizeof(tbuf)); tbuf.st_dev = uminor(buf->st_dev) | (umajor(buf->st_dev) << 8); @@ -342,7 +342,7 @@ int linux_ustat(struct thread *td, struct linux_ustat_args *args) { struct l_ustat lu; - dev_t dev; + struct cdev *dev; struct vnode *vp; struct statfs *stat; int error; @@ -360,9 +360,9 @@ linux_ustat(struct thread *td, struct linux_ustat_args *args) /* * XXX - Don't return an error if we can't find a vnode for the - * device. Our dev_t is 32-bits whereas Linux only has a 16-bits - * dev_t. The dev_t that is used now may as well be a truncated - * dev_t returned from previous syscalls. Just return a bzeroed + * device. Our struct cdev *is 32-bits whereas Linux only has a 16-bits + * struct cdev *. The struct cdev *that is used now may as well be a truncated + * struct cdev *returned from previous syscalls. Just return a bzeroed * ustat in that case. */ dev = udev2dev(makeudev(args->dev >> 8, args->dev & 0xFF)); @@ -393,7 +393,7 @@ stat64_copyout(struct stat *buf, void *ubuf) { struct l_stat64 lbuf; struct cdevsw *cdevsw; - dev_t dev; + struct cdev *dev; bzero(&lbuf, sizeof(lbuf)); lbuf.st_dev = uminor(buf->st_dev) | (umajor(buf->st_dev) << 8); diff --git a/sys/contrib/dev/fla/fla.c b/sys/contrib/dev/fla/fla.c index 845befc0aa7a..afd5a0a27633 100644 --- a/sys/contrib/dev/fla/fla.c +++ b/sys/contrib/dev/fla/fla.c @@ -79,7 +79,7 @@ static struct fla_s { struct doc2k_stat ds; struct bio_queue_head bio_queue; struct disk *disk; - dev_t dev; + struct cdev *dev; } softc[8]; static int diff --git a/sys/contrib/ipfilter/netinet/ip_fil.c b/sys/contrib/ipfilter/netinet/ip_fil.c index 8a36dc3aae5e..b6b9dd758f8d 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil.c +++ b/sys/contrib/ipfilter/netinet/ip_fil.c @@ -665,7 +665,11 @@ struct thread *td; # else ) # endif +#ifdef _KERNEL +struct cdev *dev; +#else dev_t dev; +#endif # if defined(__NetBSD__) || defined(__OpenBSD__) || \ (_BSDI_VERSION >= 199701) || (__FreeBSD_version >= 300000) u_long cmd; @@ -1135,7 +1139,7 @@ struct thread *td; # else ) # endif -dev_t dev; +struct cdev *dev; int flags; # endif /* __sgi */ { @@ -1165,7 +1169,7 @@ struct thread *td; # else ) # endif -dev_t dev; +struct cdev *dev; int flags; # endif /* __sgi */ { @@ -1193,7 +1197,7 @@ int ioflag; # else int IPL_EXTERN(read)(dev, uio) # endif -dev_t dev; +struct cdev *dev; register struct uio *uio; # endif /* __sgi */ { diff --git a/sys/contrib/ipfilter/netinet/ip_fil.h b/sys/contrib/ipfilter/netinet/ip_fil.h index bf407c27af61..75e434c46344 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil.h +++ b/sys/contrib/ipfilter/netinet/ip_fil.h @@ -574,12 +574,12 @@ extern int iplidentify __P((char *)); (NetBSD >= 199511) || defined(__OpenBSD__) # if defined(__NetBSD__) || (_BSDI_VERSION >= 199701) || \ defined(__OpenBSD__) || (__FreeBSD_version >= 300000) -extern int iplioctl __P((dev_t, u_long, caddr_t, int, struct thread *)); +extern int iplioctl __P((struct cdev *, u_long, caddr_t, int, struct thread *)); # else extern int iplioctl __P((dev_t, int, caddr_t, int, struct thread *)); # endif -extern int iplopen __P((dev_t, int, int, struct thread *)); -extern int iplclose __P((dev_t, int, int, struct thread *)); +extern int iplopen __P((struct cdev *, int, int, struct thread *)); +extern int iplclose __P((struct cdev *, int, int, struct thread *)); # else # ifndef linux extern int iplopen __P((dev_t, int)); @@ -592,7 +592,7 @@ extern void iplclose __P((struct inode *, struct file *)); # endif /* !linux */ # endif /* (_BSDI_VERSION >= 199510) */ # if BSD >= 199306 -extern int iplread __P((dev_t, struct uio *, int)); +extern int iplread __P((struct cdev *, struct uio *, int)); # else # ifndef linux extern int iplread __P((dev_t, struct uio *)); diff --git a/sys/contrib/ipfilter/netinet/mlfk_ipl.c b/sys/contrib/ipfilter/netinet/mlfk_ipl.c index df1bb75a2cfe..c06b7199a20c 100644 --- a/sys/contrib/ipfilter/netinet/mlfk_ipl.c +++ b/sys/contrib/ipfilter/netinet/mlfk_ipl.c @@ -55,7 +55,7 @@ #include #include -static dev_t ipf_devs[IPL_LOGMAX + 1]; +static struct cdev *ipf_devs[IPL_LOGMAX + 1]; SYSCTL_DECL(_net_inet); SYSCTL_NODE(_net_inet, OID_AUTO, ipf, CTLFLAG_RW, 0, "IPF"); diff --git a/sys/contrib/pf/net/pf_ioctl.c b/sys/contrib/pf/net/pf_ioctl.c index bb83ac1a7cfd..3053de38d88a 100644 --- a/sys/contrib/pf/net/pf_ioctl.c +++ b/sys/contrib/pf/net/pf_ioctl.c @@ -103,8 +103,8 @@ void cleanup_pf_zone(void); int pfattach(void); #else void pfattach(int); -int pfopen(dev_t, int, int, struct proc *); -int pfclose(dev_t, int, int, struct proc *); +int pfopen(struct cdev *, int, int, struct proc *); +int pfclose(struct cdev *, int, int, struct proc *); #endif struct pf_pool *pf_get_pool(char *, char *, u_int32_t, u_int8_t, u_int32_t, u_int8_t, u_int8_t, u_int8_t); @@ -113,9 +113,9 @@ void pf_init_ruleset(struct pf_ruleset *); void pf_mv_pool(struct pf_palist *, struct pf_palist *); void pf_empty_pool(struct pf_palist *); #ifdef __FreeBSD__ -int pfioctl(dev_t, u_long, caddr_t, int, struct thread *); +int pfioctl(struct cdev *, u_long, caddr_t, int, struct thread *); #else -int pfioctl(dev_t, u_long, caddr_t, int, struct proc *); +int pfioctl(struct cdev *, u_long, caddr_t, int, struct proc *); #endif #ifdef __FreeBSD__ @@ -139,7 +139,7 @@ TAILQ_HEAD(pf_tags, pf_tagname) pf_tags = TAILQ_HEAD_INITIALIZER(pf_tags); #ifdef __FreeBSD__ -static dev_t pf_dev; +static struct cdev *pf_dev; /* * XXX - These are new and need to be checked when moveing to a new version @@ -421,7 +421,7 @@ pfattach(int num) } int -pfopen(dev_t dev, int flags, int fmt, struct proc *p) +pfopen(struct cdev *dev, int flags, int fmt, struct proc *p) { if (minor(dev) >= 1) return (ENXIO); @@ -429,7 +429,7 @@ pfopen(dev_t dev, int flags, int fmt, struct proc *p) } int -pfclose(dev_t dev, int flags, int fmt, struct proc *p) +pfclose(struct cdev *dev, int flags, int fmt, struct proc *p) { if (minor(dev) >= 1) return (ENXIO); @@ -771,10 +771,10 @@ pf_tag_unref(u_int16_t tag) #ifdef __FreeBSD__ int -pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) +pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) #else int -pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) +pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct proc *p) #endif { struct pf_pooladdr *pa = NULL; diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 9a09cf8dab4e..03978abf27dd 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -2301,7 +2301,7 @@ aac_describe_code(struct aac_code_lookup *table, u_int32_t code) */ static int -aac_open(dev_t dev, int flags, int fmt, d_thread_t *td) +aac_open(struct cdev *dev, int flags, int fmt, d_thread_t *td) { struct aac_softc *sc; @@ -2319,7 +2319,7 @@ aac_open(dev_t dev, int flags, int fmt, d_thread_t *td) } static int -aac_close(dev_t dev, int flags, int fmt, d_thread_t *td) +aac_close(struct cdev *dev, int flags, int fmt, d_thread_t *td) { struct aac_softc *sc; @@ -2334,7 +2334,7 @@ aac_close(dev_t dev, int flags, int fmt, d_thread_t *td) } static int -aac_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, d_thread_t *td) +aac_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, d_thread_t *td) { union aac_statrequest *as; struct aac_softc *sc; @@ -2433,7 +2433,7 @@ aac_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, d_thread_t *td) } static int -aac_poll(dev_t dev, int poll_events, d_thread_t *td) +aac_poll(struct cdev *dev, int poll_events, d_thread_t *td) { struct aac_softc *sc; int revents; diff --git a/sys/dev/aac/aacvar.h b/sys/dev/aac/aacvar.h index bedc6b0c147d..6a8b04fd9c1b 100644 --- a/sys/dev/aac/aacvar.h +++ b/sys/dev/aac/aacvar.h @@ -344,7 +344,7 @@ struct aac_softc struct intr_config_hook aac_ich; /* management interface */ - dev_t aac_dev_t; + struct cdev *aac_dev_t; aac_lock_t aac_aifq_lock; struct aac_aif_command aac_aifq[AAC_AIFQ_LENGTH]; int aac_aifq_head; diff --git a/sys/dev/acpi_support/acpi_asus.c b/sys/dev/acpi_support/acpi_asus.c index f16121b5c1db..10d97e48edd4 100644 --- a/sys/dev/acpi_support/acpi_asus.c +++ b/sys/dev/acpi_support/acpi_asus.c @@ -83,9 +83,9 @@ struct acpi_asus_softc { struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; - dev_t s_mled; - dev_t s_tled; - dev_t s_wled; + struct cdev *s_mled; + struct cdev *s_tled; + struct cdev *s_wled; int s_brn; int s_disp; diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 0f0712be0203..ffc66d2c3386 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -2455,19 +2455,19 @@ acpi_deregister_ioctl(u_long cmd, acpi_ioctl_fn fn) } static int -acpiopen(dev_t dev, int flag, int fmt, d_thread_t *td) +acpiopen(struct cdev *dev, int flag, int fmt, d_thread_t *td) { return (0); } static int -acpiclose(dev_t dev, int flag, int fmt, d_thread_t *td) +acpiclose(struct cdev *dev, int flag, int fmt, d_thread_t *td) { return (0); } static int -acpiioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td) +acpiioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td) { struct acpi_softc *sc; struct acpi_ioctl_hook *hp; diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index 959681d5826d..c0bc481950c9 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -45,7 +45,7 @@ typedef vm_offset_t vm_paddr_t; struct acpi_softc { device_t acpi_dev; - dev_t acpi_dev_t; + struct cdev *acpi_dev_t; struct resource *acpi_irq; int acpi_irq_rid; diff --git a/sys/dev/adlink/adlink.c b/sys/dev/adlink/adlink.c index 1d6b86115bec..b32ef3daa502 100644 --- a/sys/dev/adlink/adlink.c +++ b/sys/dev/adlink/adlink.c @@ -104,7 +104,7 @@ struct softc { struct resource *r0, *r1, *ri; bus_space_tag_t t0, t1; bus_space_handle_t h0, h1; - dev_t dev; + struct cdev *dev; off_t mapvir; struct proc *procp; @@ -241,7 +241,7 @@ adlink_loran(void *arg) } static int -adlink_open(dev_t dev, int oflags, int devtype, struct thread *td) +adlink_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { static int once; struct softc *sc; @@ -307,7 +307,7 @@ adlink_open(dev_t dev, int oflags, int devtype, struct thread *td) } static int -adlink_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td) +adlink_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { struct softc *sc; struct wave *wp; @@ -341,7 +341,7 @@ adlink_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td) } static int -adlink_mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +adlink_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) { struct softc *sc; struct wave *wp; diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index 46f10a3c5c54..239b5bff93d0 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -762,7 +762,7 @@ agp_unbind_user(device_t dev, agp_unbind *unbind) } static int -agp_open(dev_t kdev, int oflags, int devtype, struct thread *td) +agp_open(struct cdev *kdev, int oflags, int devtype, struct thread *td) { device_t dev = KDEV2DEV(kdev); struct agp_softc *sc = device_get_softc(dev); @@ -776,7 +776,7 @@ agp_open(dev_t kdev, int oflags, int devtype, struct thread *td) } static int -agp_close(dev_t kdev, int fflag, int devtype, struct thread *td) +agp_close(struct cdev *kdev, int fflag, int devtype, struct thread *td) { device_t dev = KDEV2DEV(kdev); struct agp_softc *sc = device_get_softc(dev); @@ -799,7 +799,7 @@ agp_close(dev_t kdev, int fflag, int devtype, struct thread *td) } static int -agp_ioctl(dev_t kdev, u_long cmd, caddr_t data, int fflag, struct thread *td) +agp_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int fflag, struct thread *td) { device_t dev = KDEV2DEV(kdev); @@ -834,7 +834,7 @@ agp_ioctl(dev_t kdev, u_long cmd, caddr_t data, int fflag, struct thread *td) } static int -agp_mmap(dev_t kdev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +agp_mmap(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr, int prot) { device_t dev = KDEV2DEV(kdev); struct agp_softc *sc = device_get_softc(dev); diff --git a/sys/dev/agp/agppriv.h b/sys/dev/agp/agppriv.h index 6ba4ed60b4af..7e846d17cdff 100644 --- a/sys/dev/agp/agppriv.h +++ b/sys/dev/agp/agppriv.h @@ -75,7 +75,7 @@ struct agp_softc { struct agp_memory_list as_memory; /* list of allocated memory */ int as_nextid; /* next memory block id */ int as_isopen; /* user device is open */ - dev_t as_devnode; /* from make_dev */ + struct cdev *as_devnode; /* from make_dev */ struct mtx as_lock; /* lock for access to GATT */ }; diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c index 0fce75505c24..f206b02bb8ef 100644 --- a/sys/dev/amr/amr.c +++ b/sys/dev/amr/amr.c @@ -343,7 +343,7 @@ amr_free(struct amr_softc *sc) } /* destroy control device */ - if( sc->amr_dev_t != (dev_t)NULL) + if( sc->amr_dev_t != (struct cdev *)NULL) destroy_dev(sc->amr_dev_t); } @@ -365,7 +365,7 @@ amr_submit_bio(struct amr_softc *sc, struct bio *bio) * Accept an open operation on the control device. */ static int -amr_open(dev_t dev, int flags, int fmt, d_thread_t *td) +amr_open(struct cdev *dev, int flags, int fmt, d_thread_t *td) { int unit = minor(dev); struct amr_softc *sc = devclass_get_softc(devclass_find("amr"), unit); @@ -380,7 +380,7 @@ amr_open(dev_t dev, int flags, int fmt, d_thread_t *td) * Accept the last close on the control device. */ static int -amr_close(dev_t dev, int flags, int fmt, d_thread_t *td) +amr_close(struct cdev *dev, int flags, int fmt, d_thread_t *td) { int unit = minor(dev); struct amr_softc *sc = devclass_get_softc(devclass_find("amr"), unit); @@ -395,7 +395,7 @@ amr_close(dev_t dev, int flags, int fmt, d_thread_t *td) * Handle controller-specific control operations. */ static int -amr_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, d_thread_t *td) +amr_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, d_thread_t *td) { struct amr_softc *sc = (struct amr_softc *)dev->si_drv1; int *arg = (int *)addr; diff --git a/sys/dev/amr/amrvar.h b/sys/dev/amr/amrvar.h index 2378c97dd8ad..fcfb39727eb7 100644 --- a/sys/dev/amr/amrvar.h +++ b/sys/dev/amr/amrvar.h @@ -202,7 +202,7 @@ struct amr_softc TAILQ_HEAD(, ccb_hdr) amr_cam_ccbq; /* control device */ - dev_t amr_dev_t; + struct cdev *amr_dev_t; /* controller type-specific support */ int amr_type; diff --git a/sys/dev/asr/asr.c b/sys/dev/asr/asr.c index fa29dd8fa8f6..8b403473c8ea 100644 --- a/sys/dev/asr/asr.c +++ b/sys/dev/asr/asr.c @@ -358,7 +358,7 @@ typedef struct Asr_softc { /* Links into other parents and HBAs */ struct Asr_softc * ha_next; /* HBA list */ - dev_t ha_devt; + struct cdev *ha_devt; } Asr_softc_t; static Asr_softc_t * Asr_softc; @@ -371,11 +371,11 @@ static Asr_softc_t * Asr_softc; static int asr_probe(device_t tag); static int asr_attach(device_t tag); -static int asr_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, +static int asr_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td); -static int asr_open(dev_t dev, int32_t flags, int32_t ifmt, +static int asr_open(struct cdev *dev, int32_t flags, int32_t ifmt, struct thread *td); -static int asr_close(dev_t dev, int flags, int ifmt, struct thread *td); +static int asr_close(struct cdev *dev, int flags, int ifmt, struct thread *td); static int asr_intr(Asr_softc_t *sc); static void asr_timeout(void *arg); static int ASR_init(Asr_softc_t *sc); @@ -2999,7 +2999,7 @@ typedef U32 DPT_RTN_T; static u_int8_t ASR_ctlr_held; static int -asr_open(dev_t dev, int32_t flags, int32_t ifmt, struct thread *td) +asr_open(struct cdev *dev, int32_t flags, int32_t ifmt, struct thread *td) { int s; int error; @@ -3018,7 +3018,7 @@ asr_open(dev_t dev, int32_t flags, int32_t ifmt, struct thread *td) } /* asr_open */ static int -asr_close(dev_t dev, int flags, int ifmt, struct thread *td) +asr_close(struct cdev *dev, int flags, int ifmt, struct thread *td) { ASR_ctlr_held = 0; @@ -3495,7 +3495,7 @@ ASR_queue_i(Asr_softc_t *sc, PI2O_MESSAGE_FRAME Packet) /*----------------------------------------------------------------------*/ static int -asr_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +asr_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { Asr_softc_t *sc = dev->si_drv1; int i, error = 0; diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 9a319731b840..b0d78934b315 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -359,7 +359,7 @@ ata_shutdown(void *arg, int howto) * device related interfaces */ static int -ata_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td) +ata_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td) { struct ata_cmd *iocmd = (struct ata_cmd *)addr; device_t device = devclass_get_device(ata_devclass, iocmd->channel); diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c index c6ae4b792475..19e6100cbcb9 100644 --- a/sys/dev/ata/atapi-tape.c +++ b/sys/dev/ata/atapi-tape.c @@ -94,7 +94,7 @@ ast_attach(struct ata_device *atadev) { struct ast_softc *stp; struct ast_readposition position; - dev_t dev; + struct cdev *dev; stp = malloc(sizeof(struct ast_softc), M_AST, M_NOWAIT | M_ZERO); if (!stp) { @@ -265,7 +265,7 @@ ast_describe(struct ast_softc *stp) } static int -ast_open(dev_t dev, int flags, int fmt, struct thread *td) +ast_open(struct cdev *dev, int flags, int fmt, struct thread *td) { struct ast_softc *stp = dev->si_drv1; @@ -290,7 +290,7 @@ ast_open(dev_t dev, int flags, int fmt, struct thread *td) } static int -ast_close(dev_t dev, int flags, int fmt, struct thread *td) +ast_close(struct cdev *dev, int flags, int fmt, struct thread *td) { struct ast_softc *stp = dev->si_drv1; @@ -319,7 +319,7 @@ ast_close(dev_t dev, int flags, int fmt, struct thread *td) } static int -ast_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +ast_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct ast_softc *stp = dev->si_drv1; int error = 0; diff --git a/sys/dev/ata/atapi-tape.h b/sys/dev/ata/atapi-tape.h index 15e3cbbc1ffb..f34328d255fa 100644 --- a/sys/dev/ata/atapi-tape.h +++ b/sys/dev/ata/atapi-tape.h @@ -159,5 +159,5 @@ struct ast_softc { struct atapi_params *param; /* drive parameters table */ struct ast_cappage cap; /* capabilities page info */ struct devstat *stats; /* devstat entry */ - dev_t dev1, dev2; /* device place holders */ + struct cdev *dev1, *dev2; /* device place holders */ }; diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index 376c0dcfe17d..2d30d657670e 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -176,8 +176,8 @@ struct psm_softc { /* Driver status information */ int watchdog; /* watchdog timer flag */ struct callout_handle callout; /* watchdog timer call out */ struct callout_handle softcallout; /* buffer timer call out */ - dev_t dev; - dev_t bdev; + struct cdev *dev; + struct cdev *bdev; int lasterr; int cmdcount; }; @@ -1307,7 +1307,7 @@ psmdetach(device_t dev) } static int -psmopen(dev_t dev, int flag, int fmt, struct thread *td) +psmopen(struct cdev *dev, int flag, int fmt, struct thread *td) { int unit = PSM_UNIT(dev); struct psm_softc *sc; @@ -1391,7 +1391,7 @@ psmopen(dev_t dev, int flag, int fmt, struct thread *td) } static int -psmclose(dev_t dev, int flag, int fmt, struct thread *td) +psmclose(struct cdev *dev, int flag, int fmt, struct thread *td) { int unit = PSM_UNIT(dev); struct psm_softc *sc = PSM_SOFTC(unit); @@ -1533,7 +1533,7 @@ tame_mouse(struct psm_softc *sc, packetbuf_t *pb, mousestatus_t *status, unsigne } static int -psmread(dev_t dev, struct uio *uio, int flag) +psmread(struct cdev *dev, struct uio *uio, int flag) { register struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); unsigned char buf[PSM_SMALLBUFSIZE]; @@ -1681,7 +1681,7 @@ unblock_mouse_data(struct psm_softc *sc, int c) } static int -psmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +psmioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); mousemode_t mode; @@ -2506,7 +2506,7 @@ psmsoftintr(void *arg) } static int -psmpoll(dev_t dev, int events, struct thread *td) +psmpoll(struct cdev *dev, int events, struct thread *td) { struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); int s; diff --git a/sys/dev/bktr/bktr_core.c b/sys/dev/bktr/bktr_core.c index a71d70803d15..d8b381fdf86b 100644 --- a/sys/dev/bktr/bktr_core.c +++ b/sys/dev/bktr/bktr_core.c @@ -1191,7 +1191,7 @@ vbi_close( bktr_ptr_t bktr ) * */ int -video_read(bktr_ptr_t bktr, int unit, dev_t dev, struct uio *uio) +video_read(bktr_ptr_t bktr, int unit, struct cdev *dev, struct uio *uio) { int status; int count; diff --git a/sys/dev/bktr/bktr_core.h b/sys/dev/bktr/bktr_core.h index 5948ab686872..315566f31a40 100644 --- a/sys/dev/bktr/bktr_core.h +++ b/sys/dev/bktr/bktr_core.h @@ -80,7 +80,7 @@ int common_bktr_intr( void *arg ); /* Prototypes for open, close, read, mmap and ioctl calls */ int video_open( bktr_ptr_t bktr ); int video_close( bktr_ptr_t bktr ); -int video_read( bktr_ptr_t bktr, int unit, dev_t dev, struct uio *uio ); +int video_read( bktr_ptr_t bktr, int unit, struct cdev *dev, struct uio *uio ); int video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct thread* pr ); diff --git a/sys/dev/bktr/bktr_os.c b/sys/dev/bktr/bktr_os.c index d7bd9ba6d146..87d4ed97d73e 100644 --- a/sys/dev/bktr/bktr_os.c +++ b/sys/dev/bktr/bktr_os.c @@ -580,7 +580,7 @@ get_bktr_mem( int unit, unsigned size ) * */ static int -bktr_open( dev_t dev, int flags, int fmt, struct thread *td ) +bktr_open( struct cdev *dev, int flags, int fmt, struct thread *td ) { bktr_ptr_t bktr; int unit; @@ -680,7 +680,7 @@ bktr_open( dev_t dev, int flags, int fmt, struct thread *td ) * */ static int -bktr_close( dev_t dev, int flags, int fmt, struct thread *td ) +bktr_close( struct cdev *dev, int flags, int fmt, struct thread *td ) { bktr_ptr_t bktr; int unit; @@ -719,7 +719,7 @@ bktr_close( dev_t dev, int flags, int fmt, struct thread *td ) * */ static int -bktr_read( dev_t dev, struct uio *uio, int ioflag ) +bktr_read( struct cdev *dev, struct uio *uio, int ioflag ) { bktr_ptr_t bktr; int unit; @@ -747,7 +747,7 @@ bktr_read( dev_t dev, struct uio *uio, int ioflag ) * */ static int -bktr_write( dev_t dev, struct uio *uio, int ioflag ) +bktr_write( struct cdev *dev, struct uio *uio, int ioflag ) { return( EINVAL ); /* XXX or ENXIO ? */ } @@ -757,7 +757,7 @@ bktr_write( dev_t dev, struct uio *uio, int ioflag ) * */ static int -bktr_ioctl( dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct thread *td ) +bktr_ioctl( struct cdev *dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct thread *td ) { bktr_ptr_t bktr; int unit; @@ -789,7 +789,7 @@ bktr_ioctl( dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct thread *td * */ static int -bktr_mmap( dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot ) +bktr_mmap( struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot ) { int unit; bktr_ptr_t bktr; @@ -820,7 +820,7 @@ bktr_mmap( dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot ) } static int -bktr_poll( dev_t dev, int events, struct thread *td) +bktr_poll( struct cdev *dev, int events, struct thread *td) { int unit; bktr_ptr_t bktr; diff --git a/sys/dev/bktr/bktr_reg.h b/sys/dev/bktr/bktr_reg.h index a7c3ef5dc947..c8fc4d4bc7ea 100644 --- a/sys/dev/bktr/bktr_reg.h +++ b/sys/dev/bktr/bktr_reg.h @@ -535,12 +535,12 @@ struct bktr_softc { int irq_rid; /* 4.x resource id */ struct resource *res_irq; /* 4.x resource descriptor for interrupt */ void *res_ih; /* 4.x newbus interrupt handler cookie */ - dev_t bktrdev; /* 4.x device entry for /dev/bktrN */ - dev_t tunerdev; /* 4.x device entry for /dev/tunerN */ - dev_t vbidev; /* 4.x device entry for /dev/vbiN */ - dev_t bktrdev_alias; /* alias /dev/bktr to /dev/bktr0 */ - dev_t tunerdev_alias; /* alias /dev/tuner to /dev/tuner0 */ - dev_t vbidev_alias; /* alias /dev/vbi to /dev/vbi0 */ + struct cdev *bktrdev; /* 4.x device entry for /dev/bktrN */ + struct cdev *tunerdev; /* 4.x device entry for /dev/tunerN */ + struct cdev *vbidev; /* 4.x device entry for /dev/vbiN */ + struct cdev *bktrdev_alias; /* alias /dev/bktr to /dev/bktr0 */ + struct cdev *tunerdev_alias; /* alias /dev/tuner to /dev/tuner0 */ + struct cdev *vbidev_alias; /* alias /dev/vbi to /dev/vbi0 */ #endif #if (__FreeBSD_version >= 500000) struct mtx vbimutex; /* Mutex protecting vbi buffer */ diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c index 6e328e6ad4bf..c04136d1b3f9 100644 --- a/sys/dev/ciss/ciss.c +++ b/sys/dev/ciss/ciss.c @@ -3738,7 +3738,7 @@ ciss_name_command_status(int status) * Handle an open on the control device. */ static int -ciss_open(dev_t dev, int flags, int fmt, d_thread_t *p) +ciss_open(struct cdev *dev, int flags, int fmt, d_thread_t *p) { struct ciss_softc *sc; @@ -3756,7 +3756,7 @@ ciss_open(dev_t dev, int flags, int fmt, d_thread_t *p) * Handle the last close on the control device. */ static int -ciss_close(dev_t dev, int flags, int fmt, d_thread_t *p) +ciss_close(struct cdev *dev, int flags, int fmt, d_thread_t *p) { struct ciss_softc *sc; @@ -3775,7 +3775,7 @@ ciss_close(dev_t dev, int flags, int fmt, d_thread_t *p) * simplify the porting of Compaq's userland tools. */ static int -ciss_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, d_thread_t *p) +ciss_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, d_thread_t *p) { struct ciss_softc *sc; int error; diff --git a/sys/dev/ciss/cissvar.h b/sys/dev/ciss/cissvar.h index 717351fb654a..b1bdd4219607 100644 --- a/sys/dev/ciss/cissvar.h +++ b/sys/dev/ciss/cissvar.h @@ -173,7 +173,7 @@ struct ciss_softc { /* bus connections */ device_t ciss_dev; /* bus attachment */ - dev_t ciss_dev_t; /* control device */ + struct cdev *ciss_dev_t; /* control device */ struct resource *ciss_regs_resource; /* register interface window */ int ciss_regs_rid; /* resource ID */ diff --git a/sys/dev/cp/if_cp.c b/sys/dev/cp/if_cp.c index 945c8634e28c..04427c3bfd03 100644 --- a/sys/dev/cp/if_cp.c +++ b/sys/dev/cp/if_cp.c @@ -161,7 +161,7 @@ typedef struct _drv_t { struct sppp pp; #endif #if __FreeBSD_version >= 400000 - dev_t devt; + struct cdev *devt; #endif } drv_t; @@ -967,7 +967,7 @@ static void cp_error (cp_chan_t *c, int data) #if __FreeBSD_version < 500000 static int cp_open (dev_t dev, int oflags, int devtype, struct proc *p) #else -static int cp_open (dev_t dev, int oflags, int devtype, struct thread *td) +static int cp_open (struct cdev *dev, int oflags, int devtype, struct thread *td) #endif { int unit = minor (dev); @@ -985,7 +985,7 @@ static int cp_open (dev_t dev, int oflags, int devtype, struct thread *td) #if __FreeBSD_version < 500000 static int cp_close (dev_t dev, int fflag, int devtype, struct proc *p) #else -static int cp_close (dev_t dev, int fflag, int devtype, struct thread *td) +static int cp_close (struct cdev *dev, int fflag, int devtype, struct thread *td) #endif { drv_t *d = channel [minor (dev)]; @@ -1013,7 +1013,7 @@ static int cp_modem_status (cp_chan_t *c) #if __FreeBSD_version < 500000 static int cp_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) #else -static int cp_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +static int cp_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) #endif { drv_t *d = channel [minor (dev)]; @@ -2652,7 +2652,7 @@ static int cp_modevent (module_t mod, int type, void *unused) #else /* __FreeBSD_version >= 400000 */ static int cp_modevent (module_t mod, int type, void *unused) { - dev_t dev; + struct cdev *dev; static int load_count = 0; struct cdevsw *cdsw; diff --git a/sys/dev/ctau/if_ct.c b/sys/dev/ctau/if_ct.c index cc5887adc922..a7462ab2f4fd 100644 --- a/sys/dev/ctau/if_ct.c +++ b/sys/dev/ctau/if_ct.c @@ -172,7 +172,7 @@ typedef struct _drv_t { struct sppp pp; #endif #if __FreeBSD_version >= 400000 - dev_t devt; + struct cdev *devt; #endif } drv_t; @@ -1261,7 +1261,7 @@ static void ct_error (ct_chan_t *c, int data) #if __FreeBSD_version < 500000 static int ct_open (dev_t dev, int oflags, int devtype, struct proc *p) #else -static int ct_open (dev_t dev, int oflags, int devtype, struct thread *td) +static int ct_open (struct cdev *dev, int oflags, int devtype, struct thread *td) #endif { drv_t *d; @@ -1276,7 +1276,7 @@ static int ct_open (dev_t dev, int oflags, int devtype, struct thread *td) #if __FreeBSD_version < 500000 static int ct_close (dev_t dev, int fflag, int devtype, struct proc *p) #else -static int ct_close (dev_t dev, int fflag, int devtype, struct thread *td) +static int ct_close (struct cdev *dev, int fflag, int devtype, struct thread *td) #endif { drv_t *d = channel [minor(dev)]; @@ -1313,7 +1313,7 @@ static int ct_modem_status (ct_chan_t *c) #if __FreeBSD_version < 500000 static int ct_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) #else -static int ct_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +static int ct_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) #endif { drv_t *d = channel [minor (dev)]; @@ -2624,7 +2624,7 @@ static int ct_modevent (module_t mod, int type, void *unused) #else /* __FreeBSD_version >= 400000 */ static int ct_modevent (module_t mod, int type, void *unused) { - dev_t dev; + struct cdev *dev; static int load_count = 0; struct cdevsw *cdsw; diff --git a/sys/dev/cx/if_cx.c b/sys/dev/cx/if_cx.c index 726de528f135..45c7f9efc1ee 100644 --- a/sys/dev/cx/if_cx.c +++ b/sys/dev/cx/if_cx.c @@ -212,7 +212,7 @@ typedef struct _drv_t { struct sppp pp; #endif #if __FreeBSD_version >= 400000 - dev_t devt[3]; + struct cdev *devt[3]; #endif async_q aqueue; #define CX_READ 1 @@ -1570,7 +1570,7 @@ static void cx_error (cx_chan_t *c, int data) #if __FreeBSD_version < 500000 static int cx_open (dev_t dev, int flag, int mode, struct proc *p) #else -static int cx_open (dev_t dev, int flag, int mode, struct thread *td) +static int cx_open (struct cdev *dev, int flag, int mode, struct thread *td) #endif { int unit = UNIT (dev); @@ -1710,7 +1710,7 @@ failed: if (! (d->tty->t_state & TS_ISOPEN)) { #if __FreeBSD_version < 500000 static int cx_close (dev_t dev, int flag, int mode, struct proc *p) #else -static int cx_close (dev_t dev, int flag, int mode, struct thread *td) +static int cx_close (struct cdev *dev, int flag, int mode, struct thread *td) #endif { drv_t *d = channel [UNIT (dev)]; @@ -1756,7 +1756,7 @@ static int cx_close (dev_t dev, int flag, int mode, struct thread *td) return 0; } -static int cx_read (dev_t dev, struct uio *uio, int flag) +static int cx_read (struct cdev *dev, struct uio *uio, int flag) { drv_t *d = channel [UNIT (dev)]; @@ -1767,7 +1767,7 @@ static int cx_read (dev_t dev, struct uio *uio, int flag) return ttyld_read (d->tty, uio, flag); } -static int cx_write (dev_t dev, struct uio *uio, int flag) +static int cx_write (struct cdev *dev, struct uio *uio, int flag) { drv_t *d = channel [UNIT (dev)]; @@ -1798,7 +1798,7 @@ static int cx_modem_status (drv_t *d) #if __FreeBSD_version < 500000 static int cx_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) #else -static int cx_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +static int cx_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) #endif { drv_t *d = channel [UNIT (dev)]; @@ -3172,7 +3172,7 @@ static int cx_modevent (module_t mod, int type, void *unused) #else /* __FreeBSD_version >= 400000 */ static int cx_modevent (module_t mod, int type, void *unused) { - dev_t dev; + struct cdev *dev; static int load_count = 0; struct cdevsw *cdsw; diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index 706532732688..7808ecbf40f1 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -592,7 +592,7 @@ cyattach_common(cy_iobase, cy_align) static int sioopen(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag; int mode; struct thread *td; @@ -776,7 +776,7 @@ out: static int sioclose(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag; int mode; struct thread *td; @@ -891,7 +891,7 @@ comhardclose(com) static int siowrite(dev, uio, flag) - dev_t dev; + struct cdev *dev; struct uio *uio; int flag; { @@ -1528,7 +1528,7 @@ terminate_tx_service: static int sioioctl(dev, cmd, data, flag, td) - dev_t dev; + struct cdev *dev; u_long cmd; caddr_t data; int flag; diff --git a/sys/dev/dcons/dcons.c b/sys/dev/dcons/dcons.c index 3a5e302c7843..5bdbbfbaff7a 100644 --- a/sys/dev/dcons/dcons.c +++ b/sys/dev/dcons/dcons.c @@ -129,7 +129,7 @@ struct dcons_buf *dcons_buf; /* for local dconschat */ /* per device data */ static struct dcons_softc { - dev_t dev; + struct cdev *dev; struct dcons_ch o, i; int brk_state; #define DC_GDB 1 @@ -159,7 +159,7 @@ CONS_DRIVER(dcons, dcons_cnprobe, dcons_cninit, NULL, dcons_cngetc, #endif static int -dcons_open(dev_t dev, int flag, int mode, struct THREAD *td) +dcons_open(struct cdev *dev, int flag, int mode, struct THREAD *td) { struct tty *tp; int unit, error, s; @@ -198,7 +198,7 @@ dcons_open(dev_t dev, int flag, int mode, struct THREAD *td) } static int -dcons_close(dev_t dev, int flag, int mode, struct THREAD *td) +dcons_close(struct cdev *dev, int flag, int mode, struct THREAD *td) { int unit; struct tty *tp; @@ -312,17 +312,17 @@ dcons_cnputc(struct consdev *cp, int c) } #else static int -dcons_cngetc(dev_t dev) +dcons_cngetc(struct cdev *dev) { return(dcons_getc((struct dcons_softc *)dev->si_drv1)); } static int -dcons_cncheckc(dev_t dev) +dcons_cncheckc(struct cdev *dev) { return(dcons_checkc((struct dcons_softc *)dev->si_drv1)); } static void -dcons_cnputc(dev_t dev, int c) +dcons_cnputc(struct cdev *dev, int c) { dcons_putc((struct dcons_softc *)dev->si_drv1, c); } diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c index c6b6b2c18e23..c330290d2ed8 100644 --- a/sys/dev/digi/digi.c +++ b/sys/dev/digi/digi.c @@ -694,7 +694,7 @@ digimctl(struct digi_p *port, int bits, int how) } static int -digiopen(dev_t dev, int flag, int mode, struct thread *td) +digiopen(struct cdev *dev, int flag, int mode, struct thread *td) { struct digi_softc *sc; struct tty *tp; @@ -859,7 +859,7 @@ out: } static int -digiclose(dev_t dev, int flag, int mode, struct thread *td) +digiclose(struct cdev *dev, int flag, int mode, struct thread *td) { int mynor; struct tty *tp; @@ -938,7 +938,7 @@ digihardclose(struct digi_p *port) } static int -digiread(dev_t dev, struct uio *uio, int flag) +digiread(struct cdev *dev, struct uio *uio, int flag) { int mynor; struct tty *tp; @@ -964,7 +964,7 @@ digiread(dev_t dev, struct uio *uio, int flag) } static int -digiwrite(dev_t dev, struct uio *uio, int flag) +digiwrite(struct cdev *dev, struct uio *uio, int flag) { int mynor; struct tty *tp; @@ -1066,7 +1066,7 @@ digi_loadmoduledata(struct digi_softc *sc) } static int -digiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +digiioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int unit, pnum, mynor, error, s; struct digi_softc *sc; diff --git a/sys/dev/digi/digi.h b/sys/dev/digi/digi.h index f0c9f0e59cef..8459d60f1816 100644 --- a/sys/dev/digi/digi.h +++ b/sys/dev/digi/digi.h @@ -72,7 +72,7 @@ struct digi_p { volatile struct board_chan *bc; struct tty *tp; - dev_t dev[6]; + struct cdev *dev[6]; u_char *txbuf; u_char *rxbuf; @@ -164,7 +164,7 @@ struct digi_softc { int iorid; void *irqHandler; int unit; - dev_t ctldev; + struct cdev *ctldev; } res; u_char *vmem; /* virtual memory address */ diff --git a/sys/dev/drm/drmP.h b/sys/dev/drm/drmP.h index 7753b1966f76..e45bad4fda9a 100644 --- a/sys/dev/drm/drmP.h +++ b/sys/dev/drm/drmP.h @@ -313,7 +313,7 @@ struct drm_device { #ifdef __FreeBSD__ device_t device; /* Device instance from newbus */ #endif - dev_t devnode; /* Device number for mknod */ + struct cdev *devnode; /* Device number for mknod */ int if_version; /* Highest interface version set */ int flags; /* Flags to open(2) */ diff --git a/sys/dev/drm/drm_drv.h b/sys/dev/drm/drm_drv.h index d005ec4cdb8b..642cc7413668 100644 --- a/sys/dev/drm/drm_drv.h +++ b/sys/dev/drm/drm_drv.h @@ -808,7 +808,7 @@ int DRM(version)( DRM_IOCTL_ARGS ) return 0; } -int DRM(open)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p) +int DRM(open)(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p) { drm_device_t *dev = NULL; int retcode = 0; @@ -833,7 +833,7 @@ int DRM(open)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p) return retcode; } -int DRM(close)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p) +int DRM(close)(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p) { drm_file_t *priv; DRM_DEVICE; @@ -951,7 +951,7 @@ int DRM(close)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p) /* DRM(ioctl) is called whenever a process performs an ioctl on /dev/drm. */ -int DRM(ioctl)(dev_t kdev, u_long cmd, caddr_t data, int flags, +int DRM(ioctl)(struct cdev *kdev, u_long cmd, caddr_t data, int flags, DRM_STRUCTPROC *p) { DRM_DEVICE; diff --git a/sys/dev/drm/drm_fops.h b/sys/dev/drm/drm_fops.h index 190b708e3d7a..4c79fe117237 100644 --- a/sys/dev/drm/drm_fops.h +++ b/sys/dev/drm/drm_fops.h @@ -54,7 +54,7 @@ drm_file_t *DRM(find_file_by_proc)(drm_device_t *dev, DRM_STRUCTPROC *p) } /* DRM(open_helper) is called whenever a process opens /dev/drm. */ -int DRM(open_helper)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p, +int DRM(open_helper)(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p, drm_device_t *dev) { int m = minor(kdev); @@ -106,12 +106,12 @@ int DRM(open_helper)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p, /* The DRM(read) and DRM(poll) are stubs to prevent spurious errors * on older X Servers (4.3.0 and earlier) */ -int DRM(read)(dev_t kdev, struct uio *uio, int ioflag) +int DRM(read)(struct cdev *kdev, struct uio *uio, int ioflag) { return 0; } -int DRM(poll)(dev_t kdev, int events, DRM_STRUCTPROC *p) +int DRM(poll)(struct cdev *kdev, int events, DRM_STRUCTPROC *p) { return 0; } diff --git a/sys/dev/drm/drm_os_freebsd.h b/sys/dev/drm/drm_os_freebsd.h index 24dcd10200b5..750e6ec3f93c 100644 --- a/sys/dev/drm/drm_os_freebsd.h +++ b/sys/dev/drm/drm_os_freebsd.h @@ -151,7 +151,7 @@ * of the current process. It should be a per-open unique pointer, but * code for that is not yet written */ #define DRMFILE void * -#define DRM_IOCTL_ARGS dev_t kdev, u_long cmd, caddr_t data, int flags, DRM_STRUCTPROC *p, DRMFILE filp +#define DRM_IOCTL_ARGS struct cdev *kdev, u_long cmd, caddr_t data, int flags, DRM_STRUCTPROC *p, DRMFILE filp #define DRM_SUSER(p) suser(p) #define DRM_TASKQUEUE_ARGS void *arg, int pending #define DRM_IRQ_ARGS void *arg @@ -473,7 +473,7 @@ extern d_close_t DRM(close); extern d_read_t DRM(read); extern d_poll_t DRM(poll); extern d_mmap_t DRM(mmap); -extern int DRM(open_helper)(dev_t kdev, int flags, int fmt, +extern int DRM(open_helper)(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p, drm_device_t *dev); extern drm_file_t *DRM(find_file_by_proc)(drm_device_t *dev, DRM_STRUCTPROC *p); diff --git a/sys/dev/drm/drm_vm.h b/sys/dev/drm/drm_vm.h index ab79d03b22d1..2637a83998ed 100644 --- a/sys/dev/drm/drm_vm.h +++ b/sys/dev/drm/drm_vm.h @@ -26,7 +26,7 @@ */ #if defined(__FreeBSD__) && __FreeBSD_version >= 500102 -static int DRM(dma_mmap)(dev_t kdev, vm_offset_t offset, vm_paddr_t *paddr, +static int DRM(dma_mmap)(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr, int prot) #elif defined(__FreeBSD__) static int DRM(dma_mmap)(dev_t kdev, vm_offset_t offset, int prot) @@ -55,7 +55,7 @@ static paddr_t DRM(dma_mmap)(dev_t kdev, vm_offset_t offset, int prot) } #if defined(__FreeBSD__) && __FreeBSD_version >= 500102 -int DRM(mmap)(dev_t kdev, vm_offset_t offset, vm_paddr_t *paddr, +int DRM(mmap)(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr, int prot) #elif defined(__FreeBSD__) int DRM(mmap)(dev_t kdev, vm_offset_t offset, int prot) diff --git a/sys/dev/fb/creatorreg.h b/sys/dev/fb/creatorreg.h index 6fa42f731525..b3be9e2ae5d3 100644 --- a/sys/dev/fb/creatorreg.h +++ b/sys/dev/fb/creatorreg.h @@ -142,7 +142,7 @@ struct creator_softc { video_adapter_t sc_va; /* XXX must be first */ - dev_t sc_si; + struct cdev *sc_si; struct resource *sc_reg[FFB_NREG]; bus_space_tag_t sc_bt[FFB_NREG]; diff --git a/sys/dev/fb/gfb.h b/sys/dev/fb/gfb.h index 07ee5c97afb1..470dfc268864 100644 --- a/sys/dev/fb/gfb.h +++ b/sys/dev/fb/gfb.h @@ -166,7 +166,7 @@ typedef struct gfb_softc { int type; int model; struct cdevsw *cdevsw; - dev_t devt; + struct cdev *devt; } *gfb_softc_t; #endif /* _FB_GFB_H_ */ diff --git a/sys/dev/fb/vga.c b/sys/dev/fb/vga.c index 9f128135af4b..3af5fda458dc 100644 --- a/sys/dev/fb/vga.c +++ b/sys/dev/fb/vga.c @@ -109,7 +109,7 @@ vga_attach_unit(int unit, vga_softc_t *sc, int flags) #ifdef FB_INSTALL_CDEV int -vga_open(dev_t dev, vga_softc_t *sc, int flag, int mode, struct thread *td) +vga_open(struct cdev *dev, vga_softc_t *sc, int flag, int mode, struct thread *td) { if (sc == NULL) return ENXIO; @@ -120,32 +120,32 @@ vga_open(dev_t dev, vga_softc_t *sc, int flag, int mode, struct thread *td) } int -vga_close(dev_t dev, vga_softc_t *sc, int flag, int mode, struct thread *td) +vga_close(struct cdev *dev, vga_softc_t *sc, int flag, int mode, struct thread *td) { return genfbclose(&sc->gensc, sc->adp, flag, mode, td); } int -vga_read(dev_t dev, vga_softc_t *sc, struct uio *uio, int flag) +vga_read(struct cdev *dev, vga_softc_t *sc, struct uio *uio, int flag) { return genfbread(&sc->gensc, sc->adp, uio, flag); } int -vga_write(dev_t dev, vga_softc_t *sc, struct uio *uio, int flag) +vga_write(struct cdev *dev, vga_softc_t *sc, struct uio *uio, int flag) { return genfbread(&sc->gensc, sc->adp, uio, flag); } int -vga_ioctl(dev_t dev, vga_softc_t *sc, u_long cmd, caddr_t arg, int flag, +vga_ioctl(struct cdev *dev, vga_softc_t *sc, u_long cmd, caddr_t arg, int flag, struct thread *td) { return genfbioctl(&sc->gensc, sc->adp, cmd, arg, flag, td); } int -vga_mmap(dev_t dev, vga_softc_t *sc, vm_offset_t offset, vm_offset_t *paddr, +vga_mmap(struct cdev *dev, vga_softc_t *sc, vm_offset_t offset, vm_offset_t *paddr, int prot) { return genfbmmap(&sc->gensc, sc->adp, offset, paddr, prot); diff --git a/sys/dev/fb/vgareg.h b/sys/dev/fb/vgareg.h index f3903182a59f..e26c214e21c5 100644 --- a/sys/dev/fb/vgareg.h +++ b/sys/dev/fb/vgareg.h @@ -78,15 +78,15 @@ int vga_probe_unit(int unit, struct video_adapter *adp, int flags); int vga_attach_unit(int unit, vga_softc_t *sc, int flags); #ifdef FB_INSTALL_CDEV -int vga_open(dev_t dev, vga_softc_t *sc, int flag, int mode, +int vga_open(struct cdev *dev, vga_softc_t *sc, int flag, int mode, struct thread *td); -int vga_close(dev_t dev, vga_softc_t *sc, int flag, int mode, +int vga_close(struct cdev *dev, vga_softc_t *sc, int flag, int mode, struct thread *td); -int vga_read(dev_t dev, vga_softc_t *sc, struct uio *uio, int flag); -int vga_write(dev_t dev, vga_softc_t *sc, struct uio *uio, int flag); -int vga_ioctl(dev_t dev, vga_softc_t *sc, u_long cmd, caddr_t arg, +int vga_read(struct cdev *dev, vga_softc_t *sc, struct uio *uio, int flag); +int vga_write(struct cdev *dev, vga_softc_t *sc, struct uio *uio, int flag); +int vga_ioctl(struct cdev *dev, vga_softc_t *sc, u_long cmd, caddr_t arg, int flag, struct thread *td); -int vga_mmap(dev_t dev, vga_softc_t *sc, vm_offset_t offset, +int vga_mmap(struct cdev *dev, vga_softc_t *sc, vm_offset_t offset, vm_offset_t *paddr, int prot); #endif diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 916df7088992..f61b11fbf98e 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -301,7 +301,7 @@ struct fd_data { struct callout_handle toffhandle; struct callout_handle tohandle; struct devstat *device_stats; - dev_t masterdev; + struct cdev *masterdev; device_t dev; fdu_t fdu; }; @@ -393,11 +393,11 @@ static timeout_t fd_iotimeout; static timeout_t fd_pseudointr; static driver_intr_t fdc_intr; static int fdcpio(fdc_p, long, caddr_t, u_int); -static int fdautoselect(dev_t); +static int fdautoselect(struct cdev *); static int fdstate(struct fdc_data *); static int retrier(struct fdc_data *); static void fdbiodone(struct bio *); -static int fdmisccmd(dev_t, u_int, void *); +static int fdmisccmd(struct cdev *, u_int, void *); static d_ioctl_t fdioctl; static int fifo_threshold = 8; /* XXX: should be accessible via sysctl */ @@ -1496,7 +1496,7 @@ out_fdc(struct fdc_data *fdc, int x) * auxiliary functions). */ static int -fdopen(dev_t dev, int flags, int mode, struct thread *td) +fdopen(struct cdev *dev, int flags, int mode, struct thread *td) { fd_p fd; fdc_p fdc; @@ -1591,7 +1591,7 @@ fdopen(dev_t dev, int flags, int mode, struct thread *td) } static int -fdclose(dev_t dev, int flags, int mode, struct thread *td) +fdclose(struct cdev *dev, int flags, int mode, struct thread *td) { struct fd_data *fd; @@ -1795,7 +1795,7 @@ fdcpio(fdc_p fdc, long flags, caddr_t addr, u_int count) * Try figuring out the density of the media present in our device. */ static int -fdautoselect(dev_t dev) +fdautoselect(struct cdev *dev) { fd_p fd; struct fd_type *fdtp; @@ -2492,7 +2492,7 @@ fdbiodone(struct bio *bp) } static int -fdmisccmd(dev_t dev, u_int cmd, void *data) +fdmisccmd(struct cdev *dev, u_int cmd, void *data) { fdu_t fdu; fd_p fd; @@ -2543,7 +2543,7 @@ fdmisccmd(dev_t dev, u_int cmd, void *data) } static int -fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +fdioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { fdu_t fdu; fd_p fd; diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 5b433879e268..3c44a553adeb 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -72,7 +72,7 @@ struct fw_device{ struct firewire_softc { #if defined(__FreeBSD__) && __FreeBSD_version >= 500000 - dev_t dev; + struct cdev *dev; #endif struct firewire_comm *fc; }; @@ -156,7 +156,7 @@ struct firewire_comm{ uint32_t (*cyctimer) (struct firewire_comm *); void (*ibr) (struct firewire_comm *); uint32_t (*set_bmr) (struct firewire_comm *, uint32_t); - int (*ioctl) (dev_t, u_long, caddr_t, int, fw_proc *); + int (*ioctl) (struct cdev *, u_long, caddr_t, int, fw_proc *); int (*irx_enable) (struct firewire_comm *, int); int (*irx_disable) (struct firewire_comm *, int); int (*itx_enable) (struct firewire_comm *, int); @@ -303,7 +303,7 @@ struct fw_bind *fw_bindlookup (struct firewire_comm *, uint16_t, uint32_t); void fw_drain_txq (struct firewire_comm *); int fwdev_makedev (struct firewire_softc *); int fwdev_destroydev (struct firewire_softc *); -void fwdev_clone (void *, char *, int, dev_t *); +void fwdev_clone (void *, char *, int, struct cdev **); extern int firewire_debug; extern devclass_t firewire_devclass; diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 7cf7dc91a103..5d104156ba03 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -178,7 +178,7 @@ fwdev_freebuf(struct fw_xferq *q) static int -fw_open (dev_t dev, int flags, int fmt, fw_proc *td) +fw_open (struct cdev *dev, int flags, int fmt, fw_proc *td) { int err = 0; @@ -205,7 +205,7 @@ fw_open (dev_t dev, int flags, int fmt, fw_proc *td) } static int -fw_close (dev_t dev, int flags, int fmt, fw_proc *td) +fw_close (struct cdev *dev, int flags, int fmt, fw_proc *td) { struct firewire_softc *sc; struct firewire_comm *fc; @@ -279,7 +279,7 @@ fw_close (dev_t dev, int flags, int fmt, fw_proc *td) * read request. */ static int -fw_read (dev_t dev, struct uio *uio, int ioflag) +fw_read (struct cdev *dev, struct uio *uio, int ioflag) { struct firewire_softc *sc; struct fw_xferq *ir; @@ -365,7 +365,7 @@ readloop: } static int -fw_write (dev_t dev, struct uio *uio, int ioflag) +fw_write (struct cdev *dev, struct uio *uio, int ioflag) { int err = 0; struct firewire_softc *sc; @@ -428,7 +428,7 @@ isoloop: * ioctl support. */ int -fw_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) +fw_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, fw_proc *td) { struct firewire_softc *sc; struct firewire_comm *fc; @@ -728,7 +728,7 @@ out: return err; } int -fw_poll(dev_t dev, int events, fw_proc *td) +fw_poll(struct cdev *dev, int events, fw_proc *td) { struct firewire_softc *sc; struct fw_xferq *ir; @@ -760,9 +760,9 @@ fw_poll(dev_t dev, int events, fw_proc *td) static int #if defined(__DragonFly__) || __FreeBSD_version < 500102 -fw_mmap (dev_t dev, vm_offset_t offset, int nproto) +fw_mmap (struct cdev *dev, vm_offset_t offset, int nproto) #else -fw_mmap (dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) +fw_mmap (struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) #endif { struct firewire_softc *sc; @@ -783,7 +783,7 @@ fw_mmap (dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) static void fw_strategy(struct bio *bp) { - dev_t dev; + struct cdev *dev; dev = bp->bio_dev; if (DEV_FWMEM(dev)) { @@ -805,7 +805,7 @@ fwdev_makedev(struct firewire_softc *sc) #if defined(__DragonFly__) || __FreeBSD_version < 500000 cdevsw_add(&firewire_cdevsw); #else - dev_t d; + struct cdev *d; int unit; unit = device_get_unit(sc->fc->bdev); @@ -840,7 +840,7 @@ fwdev_destroydev(struct firewire_softc *sc) #if defined(__FreeBSD__) && __FreeBSD_version >= 500000 #define NDEVTYPE 2 void -fwdev_clone(void *arg, char *name, int namelen, dev_t *dev) +fwdev_clone(void *arg, char *name, int namelen, struct cdev **dev) { struct firewire_softc *sc; char *devnames[NDEVTYPE] = {"fw", "fwmem"}; diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index c10a07893342..a2e81e3c448f 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -274,7 +274,7 @@ fwmem_write_block( int -fwmem_open (dev_t dev, int flags, int fmt, fw_proc *td) +fwmem_open (struct cdev *dev, int flags, int fmt, fw_proc *td) { struct fwmem_softc *fms; @@ -300,7 +300,7 @@ fwmem_open (dev_t dev, int flags, int fmt, fw_proc *td) } int -fwmem_close (dev_t dev, int flags, int fmt, fw_proc *td) +fwmem_close (struct cdev *dev, int flags, int fmt, fw_proc *td) { struct fwmem_softc *fms; @@ -343,7 +343,7 @@ fwmem_strategy(struct bio *bp) struct fwmem_softc *fms; struct fw_device *fwdev; struct fw_xfer *xfer; - dev_t dev; + struct cdev *dev; int unit, err=0, s, iolen; dev = bp->bio_dev; @@ -406,7 +406,7 @@ error: } int -fwmem_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) +fwmem_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, fw_proc *td) { struct fwmem_softc *fms; int err = 0; @@ -425,15 +425,15 @@ fwmem_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) return(err); } int -fwmem_poll (dev_t dev, int events, fw_proc *td) +fwmem_poll (struct cdev *dev, int events, fw_proc *td) { return EINVAL; } int #if defined(__DragonFly__) || __FreeBSD_version < 500102 -fwmem_mmap (dev_t dev, vm_offset_t offset, int nproto) +fwmem_mmap (struct cdev *dev, vm_offset_t offset, int nproto) #else -fwmem_mmap (dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) +fwmem_mmap (struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nproto) #endif { return EINVAL; diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index c6e58c55b360..6c9990934a25 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -345,7 +345,7 @@ again: } /* Device specific ioctl. */ int -fwohci_ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, fw_proc *td) +fwohci_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, fw_proc *td) { struct firewire_softc *sc; struct fwohci_softc *fc; diff --git a/sys/dev/gfb/gfb_pci.c b/sys/dev/gfb/gfb_pci.c index 7fb3878c580c..3e229786c106 100644 --- a/sys/dev/gfb/gfb_pci.c +++ b/sys/dev/gfb/gfb_pci.c @@ -260,7 +260,7 @@ pcigfb_detach(device_t dev) #ifdef FB_INSTALL_CDEV int -pcigfb_open(dev_t dev, int flag, int mode, struct thread *td) +pcigfb_open(struct cdev *dev, int flag, int mode, struct thread *td) { struct gfb_softc *sc; int error; @@ -277,7 +277,7 @@ pcigfb_open(dev_t dev, int flag, int mode, struct thread *td) } int -pcigfb_close(dev_t dev, int flag, int mode, struct thread *td) +pcigfb_close(struct cdev *dev, int flag, int mode, struct thread *td) { struct gfb_softc *sc; @@ -286,7 +286,7 @@ pcigfb_close(dev_t dev, int flag, int mode, struct thread *td) } int -pcigfb_read(dev_t dev, struct uio *uio, int flag) +pcigfb_read(struct cdev *dev, struct uio *uio, int flag) { struct gfb_softc *sc; @@ -295,7 +295,7 @@ pcigfb_read(dev_t dev, struct uio *uio, int flag) } int -pcigfb_write(dev_t dev, struct uio *uio, int flag) +pcigfb_write(struct cdev *dev, struct uio *uio, int flag) { struct gfb_softc *sc; @@ -304,7 +304,7 @@ pcigfb_write(dev_t dev, struct uio *uio, int flag) } int -pcigfb_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) +pcigfb_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) { struct gfb_softc *sc; @@ -313,7 +313,7 @@ pcigfb_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) } int -pcigfb_mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +pcigfb_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) { struct gfb_softc *sc; diff --git a/sys/dev/ida/ida.c b/sys/dev/ida/ida.c index 47f27a78bd4c..c9682ef674b5 100644 --- a/sys/dev/ida/ida.c +++ b/sys/dev/ida/ida.c @@ -575,7 +575,7 @@ struct cmd_info { static struct cmd_info *ida_cmd_lookup(int); static int -ida_ioctl (dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td) +ida_ioctl (struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td) { struct ida_softc *sc; struct ida_user_command *uc; diff --git a/sys/dev/ida/idavar.h b/sys/dev/ida/idavar.h index 78993cb3ea48..118e680427f7 100644 --- a/sys/dev/ida/idavar.h +++ b/sys/dev/ida/idavar.h @@ -126,7 +126,7 @@ struct ida_access { struct ida_softc { device_t dev; int unit; - dev_t ida_dev_t; + struct cdev *ida_dev_t; int regs_res_type; int regs_res_id; diff --git a/sys/dev/iicbus/iic.c b/sys/dev/iicbus/iic.c index 37c2b6186d0c..3a879d8d0d37 100644 --- a/sys/dev/iicbus/iic.c +++ b/sys/dev/iicbus/iic.c @@ -52,7 +52,7 @@ struct iic_softc { char sc_buffer[BUFSIZE]; /* output buffer */ char sc_inbuf[BUFSIZE]; /* input buffer */ - dev_t sc_devnode; + struct cdev *sc_devnode; }; #define IIC_SOFTC(unit) \ @@ -146,7 +146,7 @@ iic_detach(device_t dev) } static int -iicopen (dev_t dev, int flags, int fmt, struct thread *td) +iicopen (struct cdev *dev, int flags, int fmt, struct thread *td) { struct iic_softc *sc = IIC_SOFTC(minor(dev)); @@ -162,7 +162,7 @@ iicopen (dev_t dev, int flags, int fmt, struct thread *td) } static int -iicclose(dev_t dev, int flags, int fmt, struct thread *td) +iicclose(struct cdev *dev, int flags, int fmt, struct thread *td) { struct iic_softc *sc = IIC_SOFTC(minor(dev)); @@ -181,7 +181,7 @@ iicclose(dev_t dev, int flags, int fmt, struct thread *td) } static int -iicwrite(dev_t dev, struct uio * uio, int ioflag) +iicwrite(struct cdev *dev, struct uio * uio, int ioflag) { device_t iicdev = IIC_DEVICE(minor(dev)); struct iic_softc *sc = IIC_SOFTC(minor(dev)); @@ -208,7 +208,7 @@ iicwrite(dev_t dev, struct uio * uio, int ioflag) } static int -iicread(dev_t dev, struct uio * uio, int ioflag) +iicread(struct cdev *dev, struct uio * uio, int ioflag) { device_t iicdev = IIC_DEVICE(minor(dev)); struct iic_softc *sc = IIC_SOFTC(minor(dev)); @@ -240,7 +240,7 @@ iicread(dev_t dev, struct uio * uio, int ioflag) } static int -iicioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) +iicioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { device_t iicdev = IIC_DEVICE(minor(dev)); struct iic_softc *sc = IIC_SOFTC(minor(dev)); diff --git a/sys/dev/iir/iir.h b/sys/dev/iir/iir.h index 44c4cf57f7c8..688cf634d153 100644 --- a/sys/dev/iir/iir.h +++ b/sys/dev/iir/iir.h @@ -602,7 +602,7 @@ struct gdt_softc { #define GDT_POLLING 0x01 #define GDT_SHUTDOWN 0x02 #define GDT_POLL_WAIT 0x80 - dev_t sc_dev; + struct cdev *sc_dev; bus_space_tag_t sc_dpmemt; bus_space_handle_t sc_dpmemh; bus_addr_t sc_dpmembase; @@ -746,8 +746,8 @@ gdt_dec32(addr) extern TAILQ_HEAD(gdt_softc_list, gdt_softc) gdt_softcs; extern u_int8_t gdt_polling; -dev_t gdt_make_dev(int unit); -void gdt_destroy_dev(dev_t dev); +struct cdev *gdt_make_dev(int unit); +void gdt_destroy_dev(struct cdev *dev); void gdt_next(struct gdt_softc *gdt); void gdt_free_ccb(struct gdt_softc *gdt, struct gdt_ccb *gccb); diff --git a/sys/dev/iir/iir_ctrl.c b/sys/dev/iir/iir_ctrl.c index 87275b5a640c..4d976b3e9e81 100644 --- a/sys/dev/iir/iir_ctrl.c +++ b/sys/dev/iir/iir_ctrl.c @@ -95,10 +95,10 @@ extern gdt_statist_t gdt_stat; * Given a controller number, * make a special device and return the dev_t */ -dev_t +struct cdev * gdt_make_dev(int unit) { - dev_t dev; + struct cdev *dev; #ifdef SDEV_PER_HBA dev = make_dev(&iir_cdevsw, hba2minor(unit), UID_ROOT, GID_OPERATOR, @@ -114,7 +114,7 @@ gdt_make_dev(int unit) } void -gdt_destroy_dev(dev_t dev) +gdt_destroy_dev(struct cdev *dev) { if (dev != NULL) destroy_dev(dev); @@ -144,7 +144,7 @@ gdt_minor2softc(int minor_no) } static int -iir_open(dev_t dev, int flags, int fmt, d_thread_t * p) +iir_open(struct cdev *dev, int flags, int fmt, d_thread_t * p) { GDT_DPRINTF(GDT_D_DEBUG, ("iir_open()\n")); @@ -162,7 +162,7 @@ iir_open(dev_t dev, int flags, int fmt, d_thread_t * p) } static int -iir_close(dev_t dev, int flags, int fmt, d_thread_t * p) +iir_close(struct cdev *dev, int flags, int fmt, d_thread_t * p) { GDT_DPRINTF(GDT_D_DEBUG, ("iir_close()\n")); @@ -180,7 +180,7 @@ iir_close(dev_t dev, int flags, int fmt, d_thread_t * p) } static int -iir_write(dev_t dev, struct uio * uio, int ioflag) +iir_write(struct cdev *dev, struct uio * uio, int ioflag) { GDT_DPRINTF(GDT_D_DEBUG, ("iir_write()\n")); @@ -198,7 +198,7 @@ iir_write(dev_t dev, struct uio * uio, int ioflag) } static int -iir_read(dev_t dev, struct uio * uio, int ioflag) +iir_read(struct cdev *dev, struct uio * uio, int ioflag) { GDT_DPRINTF(GDT_D_DEBUG, ("iir_read()\n")); @@ -222,7 +222,7 @@ iir_read(dev_t dev, struct uio * uio, int ioflag) */ static int -iir_ioctl(dev_t dev, u_long cmd, caddr_t cmdarg, int flags, d_thread_t * p) +iir_ioctl(struct cdev *dev, u_long cmd, caddr_t cmdarg, int flags, d_thread_t * p) { GDT_DPRINTF(GDT_D_DEBUG, ("iir_ioctl() cmd 0x%lx\n",cmd)); diff --git a/sys/dev/ips/ips.c b/sys/dev/ips/ips.c index b2532e95b684..b1a829738901 100644 --- a/sys/dev/ips/ips.c +++ b/sys/dev/ips/ips.c @@ -68,14 +68,14 @@ static const char* ips_adapter_name[] = { }; -static int ips_open(dev_t dev, int flags, int fmt, struct thread *td) +static int ips_open(struct cdev *dev, int flags, int fmt, struct thread *td) { ips_softc_t *sc = dev->si_drv1; sc->state |= IPS_DEV_OPEN; return 0; } -static int ips_close(dev_t dev, int flags, int fmt, struct thread *td) +static int ips_close(struct cdev *dev, int flags, int fmt, struct thread *td) { ips_softc_t *sc = dev->si_drv1; sc->state &= ~IPS_DEV_OPEN; @@ -83,7 +83,7 @@ static int ips_close(dev_t dev, int flags, int fmt, struct thread *td) return 0; } -static int ips_ioctl(dev_t dev, u_long command, caddr_t addr, int32_t flags, struct thread *td) +static int ips_ioctl(struct cdev *dev, u_long command, caddr_t addr, int32_t flags, struct thread *td) { ips_softc_t *sc; diff --git a/sys/dev/ips/ips.h b/sys/dev/ips/ips.h index 5fd7514956b5..9c26a7af746d 100644 --- a/sys/dev/ips/ips.h +++ b/sys/dev/ips/ips.h @@ -414,7 +414,7 @@ typedef struct ips_softc{ bus_dma_tag_t command_dmatag; bus_dma_tag_t sg_dmatag; device_t dev; - dev_t device_file; + struct cdev *device_file; struct callout_handle timer; u_int16_t adapter_type; ips_adapter_info_t adapter_info; diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c index c7f908f315cb..9845078ac64f 100644 --- a/sys/dev/isp/isp_freebsd.c +++ b/sys/dev/isp/isp_freebsd.c @@ -238,7 +238,7 @@ isp_freeze_loopdown(struct ispsoftc *isp, char *msg) } static int -ispioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) +ispioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { struct ispsoftc *isp; int nr, retval = ENOTTY; diff --git a/sys/dev/joy/joy.c b/sys/dev/joy/joy.c index 0b4efe7a27ac..0568febed341 100644 --- a/sys/dev/joy/joy.c +++ b/sys/dev/joy/joy.c @@ -128,7 +128,7 @@ joy_detach(device_t dev) static int -joyopen(dev_t dev, int flags, int fmt, struct thread *td) +joyopen(struct cdev *dev, int flags, int fmt, struct thread *td) { int i = joypart (dev); struct joy_softc *joy = JOY_SOFTC(UNIT(dev)); @@ -141,7 +141,7 @@ joyopen(dev_t dev, int flags, int fmt, struct thread *td) } static int -joyclose(dev_t dev, int flags, int fmt, struct thread *td) +joyclose(struct cdev *dev, int flags, int fmt, struct thread *td) { int i = joypart (dev); struct joy_softc *joy = JOY_SOFTC(UNIT(dev)); @@ -151,7 +151,7 @@ joyclose(dev_t dev, int flags, int fmt, struct thread *td) } static int -joyread(dev_t dev, struct uio *uio, int flag) +joyread(struct cdev *dev, struct uio *uio, int flag) { struct joy_softc *joy = JOY_SOFTC(UNIT(dev)); bus_space_handle_t port = joy->port; @@ -209,7 +209,7 @@ joyread(dev_t dev, struct uio *uio, int flag) } static int -joyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +joyioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct joy_softc *joy = JOY_SOFTC(UNIT(dev)); int i = joypart (dev); diff --git a/sys/dev/joy/joyvar.h b/sys/dev/joy/joyvar.h index 7fd1c133efe9..966fe78abb60 100644 --- a/sys/dev/joy/joyvar.h +++ b/sys/dev/joy/joyvar.h @@ -35,7 +35,7 @@ struct joy_softc { int timeout[2]; struct resource *res; int rid; - dev_t d; + struct cdev *d; }; int joy_probe(device_t); diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c index 0f1f5715b0c6..b7694c50d0a4 100644 --- a/sys/dev/kbd/kbd.c +++ b/sys/dev/kbd/kbd.c @@ -489,7 +489,7 @@ kbd_detach(keyboard_t *kbd) static kbd_callback_func_t genkbd_event; static int -genkbdopen(dev_t dev, int mode, int flag, struct thread *td) +genkbdopen(struct cdev *dev, int mode, int flag, struct thread *td) { keyboard_t *kbd; genkbd_softc_t *sc; @@ -527,7 +527,7 @@ genkbdopen(dev_t dev, int mode, int flag, struct thread *td) } static int -genkbdclose(dev_t dev, int mode, int flag, struct thread *td) +genkbdclose(struct cdev *dev, int mode, int flag, struct thread *td) { keyboard_t *kbd; genkbd_softc_t *sc; @@ -553,7 +553,7 @@ genkbdclose(dev_t dev, int mode, int flag, struct thread *td) } static int -genkbdread(dev_t dev, struct uio *uio, int flag) +genkbdread(struct cdev *dev, struct uio *uio, int flag) { keyboard_t *kbd; genkbd_softc_t *sc; @@ -606,7 +606,7 @@ genkbdread(dev_t dev, struct uio *uio, int flag) } static int -genkbdwrite(dev_t dev, struct uio *uio, int flag) +genkbdwrite(struct cdev *dev, struct uio *uio, int flag) { keyboard_t *kbd; @@ -617,7 +617,7 @@ genkbdwrite(dev_t dev, struct uio *uio, int flag) } static int -genkbdioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) +genkbdioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) { keyboard_t *kbd; int error; @@ -632,7 +632,7 @@ genkbdioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) } static int -genkbdpoll(dev_t dev, int events, struct thread *td) +genkbdpoll(struct cdev *dev, int events, struct thread *td) { keyboard_t *kbd; genkbd_softc_t *sc; diff --git a/sys/dev/kbd/kbdreg.h b/sys/dev/kbd/kbdreg.h index 05fb8956369e..78a5af420881 100644 --- a/sys/dev/kbd/kbdreg.h +++ b/sys/dev/kbd/kbdreg.h @@ -90,7 +90,7 @@ struct keyboard { #define KB_DELAY2 100 unsigned long kb_count; /* # of processed key strokes */ u_char kb_lastact[NUM_KEYS/2]; - dev_t kb_dev; + struct cdev *kb_dev; }; #define KBD_IS_VALID(k) ((k)->kb_flags & KB_VALID) diff --git a/sys/dev/led/led.c b/sys/dev/led/led.c index 5160a05ec9e3..4c19e274daf3 100644 --- a/sys/dev/led/led.c +++ b/sys/dev/led/led.c @@ -26,7 +26,7 @@ struct ledsc { LIST_ENTRY(ledsc) list; void *private; led_t *func; - dev_t dev; + struct cdev *dev; struct sbuf *spec; char *str; char *ptr; @@ -72,7 +72,7 @@ led_timeout(void *p) } static int -led_write(dev_t dev, struct uio *uio, int ioflag) +led_write(struct cdev *dev, struct uio *uio, int ioflag) { int error; char *s, *s2; @@ -221,7 +221,7 @@ static struct cdevsw led_cdevsw = { .d_name = "LED", }; -dev_t +struct cdev * led_create(led_t *func, void *priv, char const *name) { struct ledsc *sc; @@ -259,7 +259,7 @@ led_create(led_t *func, void *priv, char const *name) } void -led_destroy(dev_t dev) +led_destroy(struct cdev *dev) { struct ledsc *sc; diff --git a/sys/dev/led/led.h b/sys/dev/led/led.h index 6880efd73989..866311b9809a 100644 --- a/sys/dev/led/led.h +++ b/sys/dev/led/led.h @@ -14,7 +14,7 @@ typedef void led_t(void *, int); -dev_t led_create(led_t *, void *, char const *); -void led_destroy(dev_t); +struct cdev *led_create(led_t *, void *, char const *); +void led_destroy(struct cdev *); #endif diff --git a/sys/dev/matcd/matcd.c b/sys/dev/matcd/matcd.c index 9e28d25c7013..aead16c72ef5 100644 --- a/sys/dev/matcd/matcd.c +++ b/sys/dev/matcd/matcd.c @@ -624,7 +624,7 @@ struct matcd_mbx { static struct matcd_data { device_t dev; - dev_t matcd_dev_t; + struct cdev *matcd_dev_t; short config; short drivemode; /*Last state drive was set to*/ short flags; @@ -657,8 +657,8 @@ static unsigned char if_state[4]={0,0,0,0}; /*State of host I/F and bus*/ int matcd_probe(struct matcd_softc *sc); int matcd_attach(struct matcd_softc *sc); -static int matcdopen(dev_t dev, int flags, int fmt, struct thread *ptx); -static int matcdclose(dev_t dev, int flags, int fmt, struct thread *ptx); +static int matcdopen(struct cdev *dev, int flags, int fmt, struct thread *ptx); +static int matcdclose(struct cdev *dev, int flags, int fmt, struct thread *ptx); static void matcdstrategy(struct bio *bp); static d_ioctl_t matcdioctl; static timeout_t matcd_timeout; @@ -668,7 +668,7 @@ static timeout_t matcd_timeout; Internal function declarations ---------------------------------------------------------------------------*/ -static int matcdsize(dev_t dev); +static int matcdsize(struct cdev *dev); static void matcd_start(struct bio_queue_head *dp); static void zero_cmd(char *); static void matcd_pread(int port, int count, unsigned char * data); @@ -772,7 +772,7 @@ int matcd_attach(struct matcd_softc *sc) unsigned char data[12]; struct matcd_data *cd; int port = sc->port_bsh; /*Take port ID selected in probe()*/ - dev_t d; + struct cdev *d; int unit=0; printf("matcdc%d: Host interface type %d port %x\n", @@ -864,7 +864,7 @@ int matcd_attach(struct matcd_softc *sc) <15> If LOCKDRIVE is enabled, additional minor number devices allow <15> the drive to be locked while being accessed. ---------------------------------------------------------------------------*/ -static int matcdopen(dev_t dev, int flags, int fmt, +static int matcdopen(struct cdev *dev, int flags, int fmt, struct thread *ptx) { int cdrive,ldrive,partition,controller,lock; @@ -1051,7 +1051,7 @@ static int matcdopen(dev_t dev, int flags, int fmt, the drive. See Edit 15 in Edit History. ---------------------------------------------------------------------------*/ -static int matcdclose(dev_t dev, int flags, int fmt,struct thread *ptx) +static int matcdclose(struct cdev *dev, int flags, int fmt,struct thread *ptx) { int ldrive,cdrive,port,partition,controller,lock; struct matcd_data *cd; @@ -1910,7 +1910,7 @@ static void matcd_start(struct bio_queue_head *dp) things that don't fit into the block read scheme of things. ---------------------------------------------------------------------------*/ -static int matcdioctl(dev_t dev, unsigned long command, +static int matcdioctl(struct cdev *dev, unsigned long command, caddr_t addr, int flags, struct thread *td) { @@ -2051,7 +2051,7 @@ static int matcdioctl(dev_t dev, unsigned long command, matcdsize - Reports how many blocks exist on the disc. ---------------------------------------------------------------------------*/ -static int matcdsize(dev_t dev) +static int matcdsize(struct cdev *dev) { int size,blksize; int ldrive,part; diff --git a/sys/dev/matcd/matcd_data.h b/sys/dev/matcd/matcd_data.h index 381599a09bb7..1923cec4cbcc 100644 --- a/sys/dev/matcd/matcd_data.h +++ b/sys/dev/matcd/matcd_data.h @@ -50,7 +50,7 @@ See matcd.c for Edit History struct matcd_softc { device_t dev; - dev_t matcd_dev_t; + struct cdev *matcd_dev_t; struct resource * port; int port_rid; int port_type; diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c index ebc233e89002..4f09744c5287 100644 --- a/sys/dev/mcd/mcd.c +++ b/sys/dev/mcd/mcd.c @@ -153,7 +153,7 @@ static int mcd_pause(struct mcd_softc *); static int mcd_resume(struct mcd_softc *); static int mcd_lock_door(struct mcd_softc *, int lock); static int mcd_close_tray(struct mcd_softc *); -static int mcd_size(dev_t dev); +static int mcd_size(struct cdev *dev); static d_open_t mcdopen; static d_close_t mcdclose; @@ -211,7 +211,7 @@ mcd_attach(struct mcd_softc *sc) } static int -mcdopen(dev_t dev, int flags, int fmt, struct thread *td) +mcdopen(struct cdev *dev, int flags, int fmt, struct thread *td) { struct mcd_softc *sc; int r,retry; @@ -271,7 +271,7 @@ mcdopen(dev_t dev, int flags, int fmt, struct thread *td) } static int -mcdclose(dev_t dev, int flags, int fmt, struct thread *td) +mcdclose(struct cdev *dev, int flags, int fmt, struct thread *td) { struct mcd_softc *sc; @@ -368,7 +368,7 @@ mcd_start(struct mcd_softc *sc) } static int -mcdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) +mcdioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { struct mcd_softc *sc; int retry,r; @@ -466,7 +466,7 @@ MCD_TRACE("ioctl called 0x%lx\n", cmd); } static int -mcd_size(dev_t dev) +mcd_size(struct cdev *dev) { struct mcd_softc *sc; int size; diff --git a/sys/dev/mcd/mcdvar.h b/sys/dev/mcd/mcdvar.h index 9f81ced88560..adfd4a4f4191 100644 --- a/sys/dev/mcd/mcdvar.h +++ b/sys/dev/mcd/mcdvar.h @@ -35,7 +35,7 @@ struct mcd_data { struct mcd_softc { device_t dev; - dev_t mcd_dev_t; + struct cdev *mcd_dev_t; int debug; struct resource * port; diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 4b680d7ce03c..295d8d279997 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -107,7 +107,7 @@ static u_char end_mfs_root[] __unused = "MFS Filesystem had better STOP here"; static g_init_t md_drvinit; static int mdunits; -static dev_t status_dev = 0; +static struct cdev *status_dev = 0; static d_ioctl_t mdctlioctl; @@ -137,7 +137,7 @@ struct md_s { LIST_ENTRY(md_s) list; struct bio_queue_head bio_queue; struct mtx queue_mtx; - dev_t dev; + struct cdev *dev; enum md_types type; unsigned nsect; unsigned opencount; @@ -1078,7 +1078,7 @@ mddetach(int unit, struct thread *td) } static int -mdctlioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) +mdctlioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { struct md_ioctl *mdio; struct md_s *sc; diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c index bf7b8cd06492..f026175f91ed 100644 --- a/sys/dev/mlx/mlx.c +++ b/sys/dev/mlx/mlx.c @@ -204,7 +204,7 @@ mlx_free(struct mlx_softc *sc) free(sc->mlx_enq2, M_DEVBUF); /* destroy control device */ - if (sc->mlx_dev_t != (dev_t)NULL) + if (sc->mlx_dev_t != (struct cdev *)NULL) destroy_dev(sc->mlx_dev_t); } @@ -721,7 +721,7 @@ mlx_submit_buf(struct mlx_softc *sc, mlx_bio *bp) * Accept an open operation on the control device. */ int -mlx_open(dev_t dev, int flags, int fmt, struct thread *td) +mlx_open(struct cdev *dev, int flags, int fmt, struct thread *td) { int unit = minor(dev); struct mlx_softc *sc = devclass_get_softc(mlx_devclass, unit); @@ -734,7 +734,7 @@ mlx_open(dev_t dev, int flags, int fmt, struct thread *td) * Accept the last close on the control device. */ int -mlx_close(dev_t dev, int flags, int fmt, struct thread *td) +mlx_close(struct cdev *dev, int flags, int fmt, struct thread *td) { int unit = minor(dev); struct mlx_softc *sc = devclass_get_softc(mlx_devclass, unit); @@ -747,7 +747,7 @@ mlx_close(dev_t dev, int flags, int fmt, struct thread *td) * Handle controller-specific control operations. */ int -mlx_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td) +mlx_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td) { int unit = minor(dev); struct mlx_softc *sc = devclass_get_softc(mlx_devclass, unit); diff --git a/sys/dev/mlx/mlxvar.h b/sys/dev/mlx/mlxvar.h index e499569d279f..345cf9933c22 100644 --- a/sys/dev/mlx/mlxvar.h +++ b/sys/dev/mlx/mlxvar.h @@ -108,7 +108,7 @@ struct mlx_softc { /* bus connections */ device_t mlx_dev; - dev_t mlx_dev_t; + struct cdev *mlx_dev_t; struct resource *mlx_mem; /* mailbox interface window */ int mlx_mem_rid; int mlx_mem_type; diff --git a/sys/dev/mly/mly.c b/sys/dev/mly/mly.c index eb035d00979b..2e368164b604 100644 --- a/sys/dev/mly/mly.c +++ b/sys/dev/mly/mly.c @@ -2826,7 +2826,7 @@ mly_print_controller(int controller) * Accept an open operation on the control device. */ static int -mly_user_open(dev_t dev, int flags, int fmt, struct thread *td) +mly_user_open(struct cdev *dev, int flags, int fmt, struct thread *td) { int unit = minor(dev); struct mly_softc *sc = devclass_get_softc(devclass_find("mly"), unit); @@ -2839,7 +2839,7 @@ mly_user_open(dev_t dev, int flags, int fmt, struct thread *td) * Accept the last close on the control device. */ static int -mly_user_close(dev_t dev, int flags, int fmt, struct thread *td) +mly_user_close(struct cdev *dev, int flags, int fmt, struct thread *td) { int unit = minor(dev); struct mly_softc *sc = devclass_get_softc(devclass_find("mly"), unit); @@ -2852,7 +2852,7 @@ mly_user_close(dev_t dev, int flags, int fmt, struct thread *td) * Handle controller-specific control operations. */ static int -mly_user_ioctl(dev_t dev, u_long cmd, caddr_t addr, +mly_user_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td) { struct mly_softc *sc = (struct mly_softc *)dev->si_drv1; diff --git a/sys/dev/mly/mlyvar.h b/sys/dev/mly/mlyvar.h index c994d429233a..e1c7a50e9167 100644 --- a/sys/dev/mly/mlyvar.h +++ b/sys/dev/mly/mlyvar.h @@ -165,7 +165,7 @@ struct mly_command { struct mly_softc { /* bus connections */ device_t mly_dev; - dev_t mly_dev_t; + struct cdev *mly_dev_t; struct resource *mly_regs_resource; /* register interface window */ int mly_regs_rid; /* resource ID */ bus_space_handle_t mly_bhandle; /* bus space handle */ diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c index ddc0742db232..31c85f89f108 100644 --- a/sys/dev/mse/mse.c +++ b/sys/dev/mse/mse.c @@ -96,8 +96,8 @@ typedef struct mse_softc { u_char sc_bytes[MOUSE_SYS_PACKETSIZE]; struct callout_handle sc_callout; int sc_watchdog; - dev_t sc_dev; - dev_t sc_ndev; + struct cdev *sc_dev; + struct cdev *sc_ndev; mousehw_t hw; mousemode_t mode; mousestatus_t status; @@ -386,7 +386,7 @@ mse_detach(dev) */ static int mseopen(dev, flags, fmt, td) - dev_t dev; + struct cdev *dev; int flags; int fmt; struct thread *td; @@ -426,7 +426,7 @@ mseopen(dev, flags, fmt, td) */ static int mseclose(dev, flags, fmt, td) - dev_t dev; + struct cdev *dev; int flags; int fmt; struct thread *td; @@ -450,7 +450,7 @@ mseclose(dev, flags, fmt, td) */ static int mseread(dev, uio, ioflag) - dev_t dev; + struct cdev *dev; struct uio *uio; int ioflag; { @@ -517,7 +517,7 @@ mseread(dev, uio, ioflag) */ static int mseioctl(dev, cmd, addr, flag, td) - dev_t dev; + struct cdev *dev; u_long cmd; caddr_t addr; int flag; @@ -634,7 +634,7 @@ mseioctl(dev, cmd, addr, flag, td) */ static int msepoll(dev, events, td) - dev_t dev; + struct cdev *dev; int events; struct thread *td; { @@ -667,10 +667,10 @@ static void msetimeout(arg) void *arg; { - dev_t dev; + struct cdev *dev; mse_softc_t *sc; - dev = (dev_t)arg; + dev = (struct cdev *)arg; sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); if (sc->sc_watchdog) { if (bootverbose) diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c index cb25ecb0b694..683d06be2c85 100644 --- a/sys/dev/nmdm/nmdm.c +++ b/sys/dev/nmdm/nmdm.c @@ -57,7 +57,7 @@ MALLOC_DEFINE(M_NLMDM, "nullmodem", "nullmodem data structures"); static void nmdmstart(struct tty *tp); static void nmdmstop(struct tty *tp, int rw); -static void nmdminit(dev_t dev); +static void nmdminit(struct cdev *dev); static d_open_t nmdmopen; static d_close_t nmdmclose; @@ -77,7 +77,7 @@ static struct cdevsw nmdm_cdevsw = { struct softpart { struct tty *nm_tty; - dev_t dev; + struct cdev *dev; int dcd; struct task pt_task; struct softpart *other; @@ -94,11 +94,11 @@ static struct clonedevs *nmdmclones; static TAILQ_HEAD(,nm_softc) nmdmhead = TAILQ_HEAD_INITIALIZER(nmdmhead); static void -nmdm_clone(void *arg, char *name, int nameen, dev_t *dev) +nmdm_clone(void *arg, char *name, int nameen, struct cdev **dev) { int i, unit; char *p; - dev_t d1, d2; + struct cdev *d1, *d2; if (*dev != NODEV) return; @@ -179,9 +179,9 @@ nmdm_task_tty(void *arg, int pending __unused) * This function creates and initializes a pair of ttys. */ static void -nmdminit(dev_t dev1) +nmdminit(struct cdev *dev1) { - dev_t dev2; + struct cdev *dev2; struct nm_softc *pt; dev2 = dev1->si_drv2; @@ -225,7 +225,7 @@ nmdminit(dev_t dev1) * Device opened from userland */ static int -nmdmopen(dev_t dev, int flag, int devtype, struct thread *td) +nmdmopen(struct cdev *dev, int flag, int devtype, struct thread *td) { struct tty *tp, *tp2; int error; @@ -260,7 +260,7 @@ nmdmopen(dev_t dev, int flag, int devtype, struct thread *td) } static int -nmdmclose(dev_t dev, int flag, int mode, struct thread *td) +nmdmclose(struct cdev *dev, int flag, int mode, struct thread *td) { return (ttyclose(dev->si_tty)); diff --git a/sys/dev/null/null.c b/sys/dev/null/null.c index 314f460fe544..710d4b1c9a57 100644 --- a/sys/dev/null/null.c +++ b/sys/dev/null/null.c @@ -40,8 +40,8 @@ __FBSDID("$FreeBSD$"); #include /* For use with destroy_dev(9). */ -static dev_t null_dev; -static dev_t zero_dev; +static struct cdev *null_dev; +static struct cdev *zero_dev; static d_write_t null_write; static d_ioctl_t null_ioctl; @@ -73,7 +73,7 @@ static void *zbuf; /* ARGSUSED */ static int -null_write(dev_t dev __unused, struct uio *uio, int flags __unused) +null_write(struct cdev *dev __unused, struct uio *uio, int flags __unused) { uio->uio_resid = 0; return 0; @@ -81,7 +81,7 @@ null_write(dev_t dev __unused, struct uio *uio, int flags __unused) /* ARGSUSED */ static int -null_ioctl(dev_t dev __unused, u_long cmd, caddr_t data __unused, +null_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data __unused, int flags __unused, struct thread *td) { int error; @@ -96,7 +96,7 @@ null_ioctl(dev_t dev __unused, u_long cmd, caddr_t data __unused, /* ARGSUSED */ static int -zero_read(dev_t dev __unused, struct uio *uio, int flags __unused) +zero_read(struct cdev *dev __unused, struct uio *uio, int flags __unused) { int c; int error = 0; diff --git a/sys/dev/ofw/ofw_console.c b/sys/dev/ofw/ofw_console.c index a16f58da2d8d..5ee59147e593 100644 --- a/sys/dev/ofw/ofw_console.c +++ b/sys/dev/ofw/ofw_console.c @@ -83,7 +83,7 @@ cn_drvinit(void *unused) { phandle_t options; char output[32]; - dev_t dev; + struct cdev *dev; if (ofw_consdev.cn_pri != CN_DEAD && ofw_consdev.cn_name[0] != '\0') { @@ -103,7 +103,7 @@ static int stdin; static int stdout; static int -ofw_dev_open(dev_t dev, int flag, int mode, struct thread *td) +ofw_dev_open(struct cdev *dev, int flag, int mode, struct thread *td) { struct tty *tp; int unit; @@ -150,7 +150,7 @@ ofw_dev_open(dev_t dev, int flag, int mode, struct thread *td) } static int -ofw_dev_close(dev_t dev, int flag, int mode, struct thread *td) +ofw_dev_close(struct cdev *dev, int flag, int mode, struct thread *td) { int unit; struct tty *tp; diff --git a/sys/dev/ofw/openfirmio.c b/sys/dev/ofw/openfirmio.c index adb39296ab71..483942831275 100644 --- a/sys/dev/ofw/openfirmio.c +++ b/sys/dev/ofw/openfirmio.c @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); #include -static dev_t openfirm_dev; +static struct cdev *openfirm_dev; static d_ioctl_t openfirm_ioctl; @@ -108,7 +108,7 @@ openfirm_getstr(int len, const char *user, char **cpp) } int -openfirm_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, +openfirm_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { struct ofiocdesc *of; diff --git a/sys/dev/ofw/openpromio.c b/sys/dev/ofw/openpromio.c index 5bf5e698d1c6..3182bffd3345 100644 --- a/sys/dev/ofw/openpromio.c +++ b/sys/dev/ofw/openpromio.c @@ -67,11 +67,11 @@ static struct cdevsw openprom_cdevsw = { }; static int openprom_is_open; -static dev_t openprom_dev; +static struct cdev *openprom_dev; static phandle_t openprom_node; static int -openprom_open(dev_t dev, int oflags, int devtype, struct thread *td) +openprom_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { if (openprom_is_open != 0) @@ -81,7 +81,7 @@ openprom_open(dev_t dev, int oflags, int devtype, struct thread *td) } static int -openprom_close(dev_t dev, int fflag, int devtype, struct thread *td) +openprom_close(struct cdev *dev, int fflag, int devtype, struct thread *td) { openprom_is_open = 0; @@ -89,7 +89,7 @@ openprom_close(dev_t dev, int fflag, int devtype, struct thread *td) } static int -openprom_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, +openprom_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { struct openpromio *oprom; diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index f993135c8389..0917ac5cbab6 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1783,7 +1783,7 @@ pci_assign_interrupt_method(device_t dev, device_t child) static int pci_modevent(module_t mod, int what, void *arg) { - static dev_t pci_cdev; + static struct cdev *pci_cdev; switch (what) { case MOD_LOAD: diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index 0ce8da9e3f4e..b14abe13b3fb 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -84,7 +84,7 @@ struct cdevsw pcicdev = { }; static int -pci_open(dev_t dev, int oflags, int devtype, struct thread *td) +pci_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { int error; @@ -98,7 +98,7 @@ pci_open(dev_t dev, int oflags, int devtype, struct thread *td) } static int -pci_close(dev_t dev, int flag, int devtype, struct thread *td) +pci_close(struct cdev *dev, int flag, int devtype, struct thread *td) { return 0; } @@ -171,7 +171,7 @@ pci_conf_match(struct pci_match_conf *matches, int num_matches, } static int -pci_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { device_t pci, pcib; struct pci_io *io; diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c index 7855e364cc18..f3f2c1d9e8a8 100644 --- a/sys/dev/ppbus/lpt.c +++ b/sys/dev/ppbus/lpt.c @@ -455,7 +455,7 @@ lptout(void *arg) */ static int -lptopen(dev_t dev, int flags, int fmt, struct thread *td) +lptopen(struct cdev *dev, int flags, int fmt, struct thread *td) { int s; int trys, err; @@ -575,7 +575,7 @@ lptopen(dev_t dev, int flags, int fmt, struct thread *td) */ static int -lptclose(dev_t dev, int flags, int fmt, struct thread *td) +lptclose(struct cdev *dev, int flags, int fmt, struct thread *td) { u_int unit = LPTUNIT(minor(dev)); struct lpt_data *sc = UNITOSOFTC(unit); @@ -684,7 +684,7 @@ lpt_pushbytes(device_t dev) */ static int -lptread(dev_t dev, struct uio *uio, int ioflag) +lptread(struct cdev *dev, struct uio *uio, int ioflag) { u_int unit = LPTUNIT(minor(dev)); struct lpt_data *sc = UNITOSOFTC(unit); @@ -729,7 +729,7 @@ error: */ static int -lptwrite(dev_t dev, struct uio *uio, int ioflag) +lptwrite(struct cdev *dev, struct uio *uio, int ioflag) { register unsigned n; int err; @@ -897,7 +897,7 @@ lptintr(device_t dev) } static int -lptioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) +lptioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { int error = 0; u_int unit = LPTUNIT(minor(dev)); diff --git a/sys/dev/ppbus/pcfclock.c b/sys/dev/ppbus/pcfclock.c index 599d2554ed5f..0219220bd971 100644 --- a/sys/dev/ppbus/pcfclock.c +++ b/sys/dev/ppbus/pcfclock.c @@ -152,7 +152,7 @@ pcfclock_attach(device_t dev) } static int -pcfclock_open(dev_t dev, int flag, int fms, struct thread *td) +pcfclock_open(struct cdev *dev, int flag, int fms, struct thread *td) { u_int unit = minor(dev); struct pcfclock_data *sc = UNITOSOFTC(unit); @@ -173,7 +173,7 @@ pcfclock_open(dev_t dev, int flag, int fms, struct thread *td) } static int -pcfclock_close(dev_t dev, int flags, int fmt, struct thread *td) +pcfclock_close(struct cdev *dev, int flags, int fmt, struct thread *td) { u_int unit = minor(dev); struct pcfclock_data *sc = UNITOSOFTC(unit); @@ -188,7 +188,7 @@ pcfclock_close(dev_t dev, int flags, int fmt, struct thread *td) } static void -pcfclock_write_cmd(dev_t dev, unsigned char command) +pcfclock_write_cmd(struct cdev *dev, unsigned char command) { u_int unit = minor(dev); device_t ppidev = UNITODEVICE(unit); @@ -208,7 +208,7 @@ pcfclock_write_cmd(dev_t dev, unsigned char command) } static void -pcfclock_display_data(dev_t dev, char buf[18]) +pcfclock_display_data(struct cdev *dev, char buf[18]) { u_int unit = minor(dev); #ifdef PCFCLOCK_VERBOSE @@ -232,7 +232,7 @@ pcfclock_display_data(dev_t dev, char buf[18]) } static int -pcfclock_read_data(dev_t dev, char *buf, ssize_t bits) +pcfclock_read_data(struct cdev *dev, char *buf, ssize_t bits) { u_int unit = minor(dev); device_t ppidev = UNITODEVICE(unit); @@ -271,7 +271,7 @@ pcfclock_read_data(dev_t dev, char *buf, ssize_t bits) } static int -pcfclock_read_dev(dev_t dev, char *buf, int maxretries) +pcfclock_read_dev(struct cdev *dev, char *buf, int maxretries) { u_int unit = minor(dev); device_t ppidev = UNITODEVICE(unit); @@ -301,7 +301,7 @@ pcfclock_read_dev(dev_t dev, char *buf, int maxretries) } static int -pcfclock_read(dev_t dev, struct uio *uio, int ioflag) +pcfclock_read(struct cdev *dev, struct uio *uio, int ioflag) { u_int unit = minor(dev); char buf[18]; diff --git a/sys/dev/ppbus/ppi.c b/sys/dev/ppbus/ppi.c index 113448db5129..b537c8809b1a 100644 --- a/sys/dev/ppbus/ppi.c +++ b/sys/dev/ppbus/ppi.c @@ -255,7 +255,7 @@ ppiintr(void *arg) #endif /* PERIPH_1284 */ static int -ppiopen(dev_t dev, int flags, int fmt, struct thread *td) +ppiopen(struct cdev *dev, int flags, int fmt, struct thread *td) { u_int unit = minor(dev); struct ppi_data *ppi = UNITOSOFTC(unit); @@ -288,7 +288,7 @@ ppiopen(dev_t dev, int flags, int fmt, struct thread *td) } static int -ppiclose(dev_t dev, int flags, int fmt, struct thread *td) +ppiclose(struct cdev *dev, int flags, int fmt, struct thread *td) { u_int unit = minor(dev); struct ppi_data *ppi = UNITOSOFTC(unit); @@ -330,7 +330,7 @@ ppiclose(dev_t dev, int flags, int fmt, struct thread *td) * If no data is available, wait for it otherwise transfer as much as possible */ static int -ppiread(dev_t dev, struct uio *uio, int ioflag) +ppiread(struct cdev *dev, struct uio *uio, int ioflag) { #ifdef PERIPH_1284 u_int unit = minor(dev); @@ -414,7 +414,7 @@ error: * Once negotiation done, transfer data */ static int -ppiwrite(dev_t dev, struct uio *uio, int ioflag) +ppiwrite(struct cdev *dev, struct uio *uio, int ioflag) { #ifdef PERIPH_1284 u_int unit = minor(dev); @@ -501,7 +501,7 @@ error: } static int -ppiioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) +ppiioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { u_int unit = minor(dev); device_t ppidev = UNITODEVICE(unit); diff --git a/sys/dev/ppbus/pps.c b/sys/dev/ppbus/pps.c index fef615769ea2..2b86cd7e2498 100644 --- a/sys/dev/ppbus/pps.c +++ b/sys/dev/ppbus/pps.c @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); struct pps_data { struct ppb_device pps_dev; struct pps_state pps[9]; - dev_t devs[9]; + struct cdev *devs[9]; device_t ppsdev; device_t ppbus; int busy; @@ -106,7 +106,7 @@ ppsattach(device_t dev) { struct pps_data *sc = DEVTOSOFTC(dev); device_t ppbus = device_get_parent(dev); - dev_t d; + struct cdev *d; intptr_t irq; int i, unit, zero = 0; @@ -191,7 +191,7 @@ ppsattach(device_t dev) } static int -ppsopen(dev_t dev, int flags, int fmt, struct thread *td) +ppsopen(struct cdev *dev, int flags, int fmt, struct thread *td) { struct pps_data *sc = dev->si_drv1; int subdev = (intptr_t)dev->si_drv2; @@ -227,7 +227,7 @@ ppsopen(dev_t dev, int flags, int fmt, struct thread *td) } static int -ppsclose(dev_t dev, int flags, int fmt, struct thread *td) +ppsclose(struct cdev *dev, int flags, int fmt, struct thread *td) { struct pps_data *sc = dev->si_drv1; int subdev = (intptr_t)dev->si_drv2; @@ -293,7 +293,7 @@ ppsintr(void *arg) } static int -ppsioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) +ppsioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { struct pps_data *sc = dev->si_drv1; int subdev = (intptr_t)dev->si_drv2; diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c index e6727ee760cf..a88e4a913b91 100644 --- a/sys/dev/random/randomdev.c +++ b/sys/dev/random/randomdev.c @@ -74,7 +74,7 @@ static struct cdevsw random_cdevsw = { struct random_systat random_systat; /* For use with make_dev(9)/destroy_dev(9). */ -static dev_t random_dev; +static struct cdev *random_dev; /* Used to fake out unused random calls in random_systat */ void @@ -84,7 +84,7 @@ random_null_func(void) /* ARGSUSED */ static int -random_close(dev_t dev __unused, int flags, int fmt __unused, +random_close(struct cdev *dev __unused, int flags, int fmt __unused, struct thread *td) { if ((flags & FWRITE) && (suser(td) == 0) @@ -98,7 +98,7 @@ random_close(dev_t dev __unused, int flags, int fmt __unused, /* ARGSUSED */ static int -random_read(dev_t dev __unused, struct uio *uio, int flag) +random_read(struct cdev *dev __unused, struct uio *uio, int flag) { int c, error = 0; void *random_buf; @@ -136,7 +136,7 @@ random_read(dev_t dev __unused, struct uio *uio, int flag) /* ARGSUSED */ static int -random_write(dev_t dev __unused, struct uio *uio, int flag __unused) +random_write(struct cdev *dev __unused, struct uio *uio, int flag __unused) { int c, error = 0; void *random_buf; @@ -158,7 +158,7 @@ random_write(dev_t dev __unused, struct uio *uio, int flag __unused) /* ARGSUSED */ static int -random_ioctl(dev_t dev __unused, u_long cmd, caddr_t addr __unused, +random_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t addr __unused, int flags __unused, struct thread *td __unused) { int error = 0; @@ -176,7 +176,7 @@ random_ioctl(dev_t dev __unused, u_long cmd, caddr_t addr __unused, /* ARGSUSED */ static int -random_poll(dev_t dev __unused, int events, struct thread *td) +random_poll(struct cdev *dev __unused, int events, struct thread *td) { int revents = 0; diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index 1135faf8ec48..d9b8e37787ab 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -84,8 +84,8 @@ /* Per-channel structure */ struct rc_chans { struct rc_softc *rc_rcb; /* back ptr */ - dev_t rc_dev; /* non-callout device */ - dev_t rc_cdev; /* callout device */ + struct cdev *rc_dev; /* non-callout device */ + struct cdev *rc_cdev; /* callout device */ u_short rc_flags; /* Misc. flags */ int rc_chan; /* Channel # */ u_char rc_ier; /* intr. enable reg */ @@ -234,7 +234,7 @@ rc_attach(device_t dev) struct rc_softc *sc; u_int port; int base, chan, error, i, x; - dev_t cdev; + struct cdev *cdev; sc = device_get_softc(dev); sc->sc_dev = dev; @@ -853,7 +853,7 @@ rc_stop(struct tty *tp, int rw) } static int -rcopen(dev_t dev, int flag, int mode, d_thread_t *td) +rcopen(struct cdev *dev, int flag, int mode, d_thread_t *td) { struct rc_softc *sc; struct rc_chans *rc; @@ -944,7 +944,7 @@ out: } static int -rcclose(dev_t dev, int flag, int mode, d_thread_t *td) +rcclose(struct cdev *dev, int flag, int mode, d_thread_t *td) { struct rc_softc *sc; struct rc_chans *rc; @@ -1198,7 +1198,7 @@ rc_reinit(struct rc_softc *sc) } static int -rcioctl(dev_t dev, u_long cmd, caddr_t data, int flag, d_thread_t *td) +rcioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, d_thread_t *td) { struct rc_chans *rc; struct tty *tp; diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c index fc5241d87dc3..3c092f5c422b 100644 --- a/sys/dev/rp/rp.c +++ b/sys/dev/rp/rp.c @@ -802,7 +802,7 @@ rp_attachcommon(CONTROLLER_T *ctlp, int num_aiops, int num_ports) int retval; struct rp_port *rp; struct tty *tty; - dev_t *dev_nodes; + struct cdev **dev_nodes; unit = device_get_unit(ctlp->dev); @@ -949,7 +949,7 @@ rp_releaseresource(CONTROLLER_t *ctlp) static int rpopen(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag, mode; struct thread *td; { @@ -1108,7 +1108,7 @@ out2: static int rpclose(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag, mode; struct thread *td; { @@ -1182,7 +1182,7 @@ rphardclose(struct rp_port *rp) static int rpwrite(dev, uio, flag) - dev_t dev; + struct cdev *dev; struct uio *uio; int flag; { @@ -1222,7 +1222,7 @@ rpdtrwakeup(void *chan) static int rpioctl(dev, cmd, data, flag, td) - dev_t dev; + struct cdev *dev; u_long cmd; caddr_t data; int flag; diff --git a/sys/dev/rp/rpreg.h b/sys/dev/rp/rpreg.h index a7cde1b03a25..6852f7cf6ab8 100644 --- a/sys/dev/rp/rpreg.h +++ b/sys/dev/rp/rpreg.h @@ -371,7 +371,7 @@ struct CONTROLLER_str struct tty *tty; /* tty */ /* Device nodes */ - dev_t *dev_nodes; + struct cdev **dev_nodes; /* Bus-specific properties */ void *bus_ctlp; diff --git a/sys/dev/sab/sab.c b/sys/dev/sab/sab.c index 083b85a818d5..58a705694d53 100644 --- a/sys/dev/sab/sab.c +++ b/sys/dev/sab/sab.c @@ -83,7 +83,7 @@ struct sabtty_softc { struct sab_softc *sc_parent; bus_space_tag_t sc_bt; bus_space_handle_t sc_bh; - dev_t sc_si; + struct cdev *sc_si; struct tty *sc_tty; int sc_channel; int sc_icnt; @@ -639,7 +639,7 @@ sabtty_softintr(struct sabtty_softc *sc) } static int -sabttyopen(dev_t dev, int flags, int mode, struct thread *td) +sabttyopen(struct cdev *dev, int flags, int mode, struct thread *td) { struct sabtty_softc *sc; struct tty *tp; @@ -717,7 +717,7 @@ sabttyopen(dev_t dev, int flags, int mode, struct thread *td) } static int -sabttyclose(dev_t dev, int flags, int mode, struct thread *td) +sabttyclose(struct cdev *dev, int flags, int mode, struct thread *td) { struct tty *tp; @@ -733,7 +733,7 @@ sabttyclose(dev_t dev, int flags, int mode, struct thread *td) } static int -sabttyioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) +sabttyioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { struct sabtty_softc *sc; struct tty *tp; diff --git a/sys/dev/scd/scd.c b/sys/dev/scd/scd.c index 2a66a00189c7..93332e2a6893 100644 --- a/sys/dev/scd/scd.c +++ b/sys/dev/scd/scd.c @@ -178,7 +178,7 @@ scd_attach(struct scd_softc *sc) } static int -scdopen(dev_t dev, int flags, int fmt, struct thread *td) +scdopen(struct cdev *dev, int flags, int fmt, struct thread *td) { struct scd_softc *sc; int rc; @@ -225,7 +225,7 @@ scdopen(dev_t dev, int flags, int fmt, struct thread *td) } static int -scdclose(dev_t dev, int flags, int fmt, struct thread *td) +scdclose(struct cdev *dev, int flags, int fmt, struct thread *td) { struct scd_softc *sc; @@ -327,7 +327,7 @@ scd_start(struct scd_softc *sc) } static int -scdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) +scdioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { struct scd_softc *sc; diff --git a/sys/dev/scd/scdvar.h b/sys/dev/scd/scdvar.h index 9eb0199df19a..773a78be1fb6 100644 --- a/sys/dev/scd/scdvar.h +++ b/sys/dev/scd/scdvar.h @@ -34,7 +34,7 @@ struct scd_data { struct scd_softc { device_t dev; - dev_t scd_dev_t; + struct cdev *scd_dev_t; int debug; struct resource * port; diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index 2a3601f41061..97321088cd81 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -95,7 +95,7 @@ enum si_mctl { GET, SET, BIS, BIC }; static void si_command(struct si_port *, int, int); static int si_modem(struct si_port *, enum si_mctl, int); static void si_write_enable(struct si_port *, int); -static int si_Sioctl(dev_t, u_long, caddr_t, int, struct thread *); +static int si_Sioctl(struct cdev *, u_long, caddr_t, int, struct thread *); static void si_start(struct tty *); static void si_stop(struct tty *, int); static timeout_t si_lstart; @@ -589,7 +589,7 @@ try_next2: } static int -siopen(dev_t dev, int flag, int mode, struct thread *td) +siopen(struct cdev *dev, int flag, int mode, struct thread *td) { int oldspl, error; int card, port; @@ -758,7 +758,7 @@ out: } static int -siclose(dev_t dev, int flag, int mode, struct thread *td) +siclose(struct cdev *dev, int flag, int mode, struct thread *td) { struct si_port *pp; struct tty *tp; @@ -868,7 +868,7 @@ sidtrwakeup(void *chan) } static int -siwrite(dev_t dev, struct uio *uio, int flag) +siwrite(struct cdev *dev, struct uio *uio, int flag) { struct si_port *pp; struct tty *tp; @@ -907,7 +907,7 @@ out: static int -siioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +siioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct si_port *pp; struct tty *tp; @@ -1073,7 +1073,7 @@ out: * Handle the Specialix ioctls. All MUST be called via the CONTROL device */ static int -si_Sioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +si_Sioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct si_softc *xsc; struct si_port *xpp; diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 740cd26b5672..328142800454 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -271,7 +271,7 @@ struct com_s { struct resource *ioportres; int ioportrid; void *cookie; - dev_t devs[6]; + struct cdev *devs[6]; /* * Data area for output buffers. Someday we should build the output @@ -1180,7 +1180,7 @@ determined_type: ; static int sioopen(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag; int mode; struct thread *td; @@ -1363,7 +1363,7 @@ out: static int sioclose(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag; int mode; struct thread *td; @@ -1460,7 +1460,7 @@ comhardclose(com) static int sioread(dev, uio, flag) - dev_t dev; + struct cdev *dev; struct uio *uio; int flag; { @@ -1478,7 +1478,7 @@ sioread(dev, uio, flag) static int siowrite(dev, uio, flag) - dev_t dev; + struct cdev *dev; struct uio *uio; int flag; { @@ -1961,7 +1961,7 @@ txrdy: static int sioioctl(dev, cmd, data, flag, td) - dev_t dev; + struct cdev *dev; u_long cmd; caddr_t data; int flag; diff --git a/sys/dev/smbus/smb.c b/sys/dev/smbus/smb.c index c8edb9386056..4c1c5b199f91 100644 --- a/sys/dev/smbus/smb.c +++ b/sys/dev/smbus/smb.c @@ -46,7 +46,7 @@ struct smb_softc { int sc_count; /* >0 if device opened */ - dev_t sc_devnode; + struct cdev *sc_devnode; }; #define IIC_SOFTC(unit) \ @@ -137,7 +137,7 @@ smb_detach(device_t dev) } static int -smbopen (dev_t dev, int flags, int fmt, struct thread *td) +smbopen (struct cdev *dev, int flags, int fmt, struct thread *td) { struct smb_softc *sc = IIC_SOFTC(minor(dev)); @@ -153,7 +153,7 @@ smbopen (dev_t dev, int flags, int fmt, struct thread *td) } static int -smbclose(dev_t dev, int flags, int fmt, struct thread *td) +smbclose(struct cdev *dev, int flags, int fmt, struct thread *td) { struct smb_softc *sc = IIC_SOFTC(minor(dev)); @@ -170,7 +170,7 @@ smbclose(dev_t dev, int flags, int fmt, struct thread *td) } static int -smbioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) +smbioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { char buf[SMB_MAXBLOCKSIZE]; device_t parent; diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index 7288a56744cd..752dc421eaf7 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -62,7 +62,7 @@ static struct linesw snpdisc = { struct snoop { LIST_ENTRY(snoop) snp_list; /* List glue. */ int snp_unit; /* Device number. */ - dev_t snp_target; /* Target tty device. */ + struct cdev *snp_target; /* Target tty device. */ struct tty *snp_tty; /* Target tty pointer. */ u_long snp_len; /* Possible length. */ u_long snp_base; /* Data base. */ @@ -106,9 +106,9 @@ static int snooplinedisc; static LIST_HEAD(, snoop) snp_sclist = LIST_HEAD_INITIALIZER(&snp_sclist); static struct clonedevs *snpclones; -static struct tty *snpdevtotty(dev_t dev); +static struct tty *snpdevtotty(struct cdev *dev); static void snp_clone(void *arg, char *name, - int namelen, dev_t *dev); + int namelen, struct cdev **dev); static int snp_detach(struct snoop *snp); static int snp_down(struct snoop *snp); static int snp_in(struct snoop *snp, char *buf, int n); @@ -175,7 +175,7 @@ snplwrite(tp, uio, flag) static struct tty * snpdevtotty(dev) - dev_t dev; + struct cdev *dev; { struct cdevsw *cdp; @@ -192,7 +192,7 @@ snpdevtotty(dev) static int snpwrite(dev, uio, flag) - dev_t dev; + struct cdev *dev; struct uio *uio; int flag; { @@ -231,7 +231,7 @@ tty_input: static int snpread(dev, uio, flag) - dev_t dev; + struct cdev *dev; struct uio *uio; int flag; { @@ -377,7 +377,7 @@ snp_in(snp, buf, n) static int snpopen(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag, mode; struct thread *td; { @@ -451,7 +451,7 @@ detach_notty: static int snpclose(dev, flags, fmt, td) - dev_t dev; + struct cdev *dev; int flags; int fmt; struct thread *td; @@ -486,7 +486,7 @@ snp_down(snp) static int snpioctl(dev, cmd, data, flags, td) - dev_t dev; + struct cdev *dev; u_long cmd; caddr_t data; int flags; @@ -494,7 +494,7 @@ snpioctl(dev, cmd, data, flags, td) { struct snoop *snp; struct tty *tp, *tpo; - dev_t tdev; + struct cdev *tdev; int s; snp = dev->si_drv1; @@ -577,7 +577,7 @@ snpioctl(dev, cmd, data, flags, td) static int snppoll(dev, events, td) - dev_t dev; + struct cdev *dev; int events; struct thread *td; { @@ -605,7 +605,7 @@ snp_clone(arg, name, namelen, dev) void *arg; char *name; int namelen; - dev_t *dev; + struct cdev **dev; { int u, i; diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 3b910c731ee9..92009414c076 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -60,7 +60,7 @@ static eventhandler_tag dsp_ehtag; #endif static struct snddev_info * -dsp_get_info(dev_t dev) +dsp_get_info(struct cdev *dev) { struct snddev_info *d; int unit; @@ -74,7 +74,7 @@ dsp_get_info(dev_t dev) } static u_int32_t -dsp_get_flags(dev_t dev) +dsp_get_flags(struct cdev *dev) { device_t bdev; int unit; @@ -88,7 +88,7 @@ dsp_get_flags(dev_t dev) } static void -dsp_set_flags(dev_t dev, u_int32_t flags) +dsp_set_flags(struct cdev *dev, u_int32_t flags) { device_t bdev; int unit; @@ -108,7 +108,7 @@ dsp_set_flags(dev_t dev, u_int32_t flags) * lock channels specified. */ static int -getchns(dev_t dev, struct pcm_channel **rdch, struct pcm_channel **wrch, u_int32_t prio) +getchns(struct cdev *dev, struct pcm_channel **rdch, struct pcm_channel **wrch, u_int32_t prio) { struct snddev_info *d; u_int32_t flags; @@ -152,7 +152,7 @@ getchns(dev_t dev, struct pcm_channel **rdch, struct pcm_channel **wrch, u_int32 /* unlock specified channels */ static void -relchns(dev_t dev, struct pcm_channel *rdch, struct pcm_channel *wrch, u_int32_t prio) +relchns(struct cdev *dev, struct pcm_channel *rdch, struct pcm_channel *wrch, u_int32_t prio) { struct snddev_info *d; @@ -165,7 +165,7 @@ relchns(dev_t dev, struct pcm_channel *rdch, struct pcm_channel *wrch, u_int32_t } static int -dsp_open(dev_t i_dev, int flags, int mode, struct thread *td) +dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td) { struct pcm_channel *rdch, *wrch; struct snddev_info *d; @@ -319,7 +319,7 @@ dsp_open(dev_t i_dev, int flags, int mode, struct thread *td) } static int -dsp_close(dev_t i_dev, int flags, int mode, struct thread *td) +dsp_close(struct cdev *i_dev, int flags, int mode, struct thread *td) { struct pcm_channel *rdch, *wrch; struct snddev_info *d; @@ -388,7 +388,7 @@ dsp_close(dev_t i_dev, int flags, int mode, struct thread *td) } static int -dsp_read(dev_t i_dev, struct uio *buf, int flag) +dsp_read(struct cdev *i_dev, struct uio *buf, int flag) { struct pcm_channel *rdch, *wrch; intrmask_t s; @@ -415,7 +415,7 @@ dsp_read(dev_t i_dev, struct uio *buf, int flag) } static int -dsp_write(dev_t i_dev, struct uio *buf, int flag) +dsp_write(struct cdev *i_dev, struct uio *buf, int flag) { struct pcm_channel *rdch, *wrch; intrmask_t s; @@ -442,7 +442,7 @@ dsp_write(dev_t i_dev, struct uio *buf, int flag) } static int -dsp_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) +dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) { struct pcm_channel *chn, *rdch, *wrch; struct snddev_info *d; @@ -567,7 +567,7 @@ dsp_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) { snd_capabilities *p = (snd_capabilities *)arg; struct pcmchan_caps *pcaps = NULL, *rcaps = NULL; - dev_t pdev; + struct cdev *pdev; if (rdch) { CHN_LOCK(rdch); @@ -1026,7 +1026,7 @@ dsp_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) } static int -dsp_poll(dev_t i_dev, int events, struct thread *td) +dsp_poll(struct cdev *i_dev, int events, struct thread *td) { struct pcm_channel *wrch = NULL, *rdch = NULL; intrmask_t s; @@ -1053,7 +1053,7 @@ dsp_poll(dev_t i_dev, int events, struct thread *td) } static int -dsp_mmap(dev_t i_dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +dsp_mmap(struct cdev *i_dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) { struct pcm_channel *wrch = NULL, *rdch = NULL, *c; intrmask_t s; @@ -1114,9 +1114,9 @@ dsp_mmap(dev_t i_dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) * if xN.i isn't busy, return its dev_t */ static void -dsp_clone(void *arg, char *name, int namelen, dev_t *dev) +dsp_clone(void *arg, char *name, int namelen, struct cdev **dev) { - dev_t pdev; + struct cdev *pdev; struct snddev_info *pcm_dev; struct snddev_channel *pcm_chan; int i, unit, devtype; diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index b5a67edfc61f..47812fe5a046 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -86,7 +86,7 @@ static struct cdevsw mixer_cdevsw = { static eventhandler_tag mixer_ehtag; #endif -static dev_t +static struct cdev * mixer_get_devt(device_t dev) { struct snddev_info *snddev; @@ -190,7 +190,7 @@ mixer_init(device_t dev, kobj_class_t cls, void *devinfo) struct snddev_info *snddev; struct snd_mixer *m; u_int16_t v; - dev_t pdev; + struct cdev *pdev; int i, unit; m = (struct snd_mixer *)kobj_create(cls, M_MIXER, M_WAITOK | M_ZERO); @@ -231,7 +231,7 @@ mixer_uninit(device_t dev) { int i; struct snd_mixer *m; - dev_t pdev; + struct cdev *pdev; pdev = mixer_get_devt(dev); m = pdev->si_drv1; @@ -262,7 +262,7 @@ int mixer_reinit(device_t dev) { struct snd_mixer *m; - dev_t pdev; + struct cdev *pdev; int i; pdev = mixer_get_devt(dev); @@ -318,7 +318,7 @@ int mixer_hwvol_init(device_t dev) { struct snd_mixer *m; - dev_t pdev; + struct cdev *pdev; pdev = mixer_get_devt(dev); m = pdev->si_drv1; @@ -339,7 +339,7 @@ void mixer_hwvol_mute(device_t dev) { struct snd_mixer *m; - dev_t pdev; + struct cdev *pdev; pdev = mixer_get_devt(dev); m = pdev->si_drv1; @@ -360,7 +360,7 @@ mixer_hwvol_step(device_t dev, int left_step, int right_step) { struct snd_mixer *m; int level, left, right; - dev_t pdev; + struct cdev *pdev; pdev = mixer_get_devt(dev); m = pdev->si_drv1; @@ -387,7 +387,7 @@ mixer_hwvol_step(device_t dev, int left_step, int right_step) /* ----------------------------------------------------------------------- */ static int -mixer_open(dev_t i_dev, int flags, int mode, struct thread *td) +mixer_open(struct cdev *i_dev, int flags, int mode, struct thread *td) { struct snd_mixer *m; intrmask_t s; @@ -404,7 +404,7 @@ mixer_open(dev_t i_dev, int flags, int mode, struct thread *td) } static int -mixer_close(dev_t i_dev, int flags, int mode, struct thread *td) +mixer_close(struct cdev *i_dev, int flags, int mode, struct thread *td) { struct snd_mixer *m; intrmask_t s; @@ -426,7 +426,7 @@ mixer_close(dev_t i_dev, int flags, int mode, struct thread *td) } int -mixer_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) +mixer_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) { struct snd_mixer *m; intrmask_t s; @@ -479,7 +479,7 @@ mixer_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) #ifdef USING_DEVFS static void -mixer_clone(void *arg, char *name, int namelen, dev_t *dev) +mixer_clone(void *arg, char *name, int namelen, struct cdev **dev) { struct snddev_info *sd; diff --git a/sys/dev/sound/pcm/mixer.h b/sys/dev/sound/pcm/mixer.h index ff4c22c37a65..22bd22aa6c3f 100644 --- a/sys/dev/sound/pcm/mixer.h +++ b/sys/dev/sound/pcm/mixer.h @@ -29,7 +29,7 @@ int mixer_init(device_t dev, kobj_class_t cls, void *devinfo); int mixer_uninit(device_t dev); int mixer_reinit(device_t dev); -int mixer_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td); +int mixer_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td); int mixer_hwvol_init(device_t dev); void mixer_hwvol_mute(device_t dev); diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index e96a8025fde5..0b391a72e354 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -62,7 +62,7 @@ struct sndstat_entry { static struct mtx sndstat_lock; #endif static struct sbuf sndstat_sbuf; -static dev_t sndstat_dev = 0; +static struct cdev *sndstat_dev = 0; static int sndstat_isopen = 0; static int sndstat_bufptr; static int sndstat_maxunit = -1; @@ -103,7 +103,7 @@ SYSCTL_PROC(_hw_snd, OID_AUTO, verbose, CTLTYPE_INT | CTLFLAG_RW, 0, sizeof(int), sysctl_hw_sndverbose, "I", ""); static int -sndstat_open(dev_t i_dev, int flags, int mode, struct thread *td) +sndstat_open(struct cdev *i_dev, int flags, int mode, struct thread *td) { intrmask_t s; int error; @@ -136,7 +136,7 @@ out: } static int -sndstat_close(dev_t i_dev, int flags, int mode, struct thread *td) +sndstat_close(struct cdev *i_dev, int flags, int mode, struct thread *td) { intrmask_t s; @@ -156,7 +156,7 @@ sndstat_close(dev_t i_dev, int flags, int mode, struct thread *td) } static int -sndstat_read(dev_t i_dev, struct uio *buf, int flag) +sndstat_read(struct cdev *i_dev, struct uio *buf, int flag) { intrmask_t s; int l, err; diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index 7acdfc89fc44..5eae8e3406e6 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -278,10 +278,10 @@ struct snddev_channel { SLIST_ENTRY(snddev_channel) link; struct pcm_channel *channel; int chan_num; - dev_t dsp_devt; - dev_t dspW_devt; - dev_t audio_devt; - dev_t dspr_devt; + struct cdev *dsp_devt; + struct cdev *dspW_devt; + struct cdev *audio_devt; + struct cdev *dspr_devt; }; struct snddev_info { @@ -297,7 +297,7 @@ struct snddev_info { struct sysctl_ctx_list sysctl_tree; struct sysctl_oid *sysctl_tree_top; struct mtx *lock; - dev_t mixer_dev; + struct cdev *mixer_dev; }; diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index e73ab8d73324..2dc74e37682b 100644 --- a/sys/dev/speaker/spkr.c +++ b/sys/dev/speaker/spkr.c @@ -472,7 +472,7 @@ static char *spkr_inbuf; /* incoming buf */ static int spkropen(dev, flags, fmt, td) - dev_t dev; + struct cdev *dev; int flags; int fmt; struct thread *td; @@ -499,7 +499,7 @@ spkropen(dev, flags, fmt, td) static int spkrwrite(dev, uio, ioflag) - dev_t dev; + struct cdev *dev; struct uio *uio; int ioflag; { @@ -531,7 +531,7 @@ spkrwrite(dev, uio, ioflag) static int spkrclose(dev, flags, fmt, td) - dev_t dev; + struct cdev *dev; int flags; int fmt; struct thread *td; @@ -554,7 +554,7 @@ spkrclose(dev, flags, fmt, td) static int spkrioctl(dev, cmd, cmdarg, flags, td) - dev_t dev; + struct cdev *dev; unsigned long cmd; caddr_t cmdarg; int flags; @@ -610,7 +610,7 @@ static struct isa_pnp_id speaker_ids[] = { { 0 } }; -static dev_t speaker_dev; +static struct cdev *speaker_dev; static int speaker_probe(device_t dev) diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index b67e39b83862..8ef790d3ddc3 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -88,8 +88,8 @@ enum { dev_unix_ord_stream = 40 }; -static dev_t dt_ptm, dt_arp, dt_icmp, dt_ip, dt_tcp, dt_udp, dt_rawip, - dt_unix_dgram, dt_unix_stream, dt_unix_ord_stream; +static struct cdev *dt_ptm, *dt_arp, *dt_icmp, *dt_ip, *dt_tcp, *dt_udp, *dt_rawip, + *dt_unix_dgram, *dt_unix_stream, *dt_unix_ord_stream; static struct fileops svr4_netops = { .fo_read = soo_read, @@ -186,7 +186,7 @@ MODULE_VERSION(streams, 1); * routine. */ static int -streamsopen(dev_t dev, int oflags, int devtype, struct thread *td) +streamsopen(struct cdev *dev, int oflags, int devtype, struct thread *td) { int type, protocol; int fd, extraref; diff --git a/sys/dev/sx/sx.c b/sys/dev/sx/sx.c index 5588ab75d41e..0e0687e63f8a 100644 --- a/sys/dev/sx/sx.c +++ b/sys/dev/sx/sx.c @@ -332,7 +332,7 @@ sxattach( */ static int sxopen( - dev_t dev, + struct cdev *dev, int flag, int mode, d_thread_t *p) @@ -501,7 +501,7 @@ out: */ static int sxclose( - dev_t dev, + struct cdev *dev, int flag, int mode, d_thread_t *p) @@ -641,7 +641,7 @@ sxdtrwakeup(void *chan) */ static int sxwrite( - dev_t dev, + struct cdev *dev, struct uio *uio, int flag) { @@ -690,7 +690,7 @@ out: splx(oldspl); */ static int sxioctl( - dev_t dev, + struct cdev *dev, u_long cmd, caddr_t data, int flag, diff --git a/sys/dev/syscons/scvesactl.c b/sys/dev/syscons/scvesactl.c index f2ba28357f4e..dbc0dfc3fe88 100644 --- a/sys/dev/syscons/scvesactl.c +++ b/sys/dev/syscons/scvesactl.c @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); static d_ioctl_t *prev_user_ioctl; static int -vesa_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +vesa_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { scr_stat *scp; struct tty *tp; diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 0608ce5df25d..12f0739300ee 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -100,7 +100,7 @@ static struct tty *sc_console_tty; static struct consdev *sc_consptr; static void *kernel_console_ts; static scr_stat main_console; -static dev_t main_devs[MAXCONS]; +static struct cdev *main_devs[MAXCONS]; static char init_done = COLD; static char shutdown_in_progress = FALSE; @@ -148,12 +148,12 @@ static int debugger; static int scvidprobe(int unit, int flags, int cons); static int sckbdprobe(int unit, int flags, int cons); static void scmeminit(void *arg); -static int scdevtounit(dev_t dev); +static int scdevtounit(struct cdev *dev); static kbd_callback_func_t sckbdevent; static int scparam(struct tty *tp, struct termios *t); static void scstart(struct tty *tp); static void scinit(int unit, int flags); -static scr_stat *sc_get_stat(dev_t devptr); +static scr_stat *sc_get_stat(struct cdev *devptr); #if !__alpha__ static void scterm(int unit, int flags); #endif @@ -303,7 +303,7 @@ sc_attach_unit(int unit, int flags) video_info_t info; #endif int vc; - dev_t dev; + struct cdev *dev; flags &= ~SC_KERNEL_CONSOLE; @@ -442,7 +442,7 @@ scmeminit(void *arg) SYSINIT(sc_mem, SI_SUB_KMEM, SI_ORDER_ANY, scmeminit, NULL); static int -scdevtounit(dev_t dev) +scdevtounit(struct cdev *dev) { int vty = SC_VTY(dev); @@ -455,7 +455,7 @@ scdevtounit(dev_t dev) } static int -scopen(dev_t dev, int flag, int mode, struct thread *td) +scopen(struct cdev *dev, int flag, int mode, struct thread *td) { int unit = scdevtounit(dev); sc_softc_t *sc; @@ -518,7 +518,7 @@ scopen(dev_t dev, int flag, int mode, struct thread *td) } static int -scclose(dev_t dev, int flag, int mode, struct thread *td) +scclose(struct cdev *dev, int flag, int mode, struct thread *td) { struct tty *tp = dev->si_tty; scr_stat *scp; @@ -568,7 +568,7 @@ scclose(dev_t dev, int flag, int mode, struct thread *td) } static int -scread(dev_t dev, struct uio *uio, int flag) +scread(struct cdev *dev, struct uio *uio, int flag) { if (!sc_saver_keyb_only) sc_touch_scrn_saver(); @@ -654,7 +654,7 @@ scparam(struct tty *tp, struct termios *t) } static int -scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +scioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int error; int i; @@ -2596,7 +2596,7 @@ void sc_change_cursor_shape(scr_stat *scp, int flags, int base, int height) { sc_softc_t *sc; - dev_t dev; + struct cdev *dev; int s; int i; @@ -2741,7 +2741,7 @@ scinit(int unit, int flags) kernel_default.rev_color); } else { /* assert(sc_malloc) */ - sc->dev = malloc(sizeof(dev_t)*sc->vtys, M_DEVBUF, M_WAITOK|M_ZERO); + sc->dev = malloc(sizeof(struct cdev *)*sc->vtys, M_DEVBUF, M_WAITOK|M_ZERO); sc->dev[0] = make_dev(&sc_cdevsw, unit * MAXCONS, UID_ROOT, GID_WHEEL, 0600, "ttyv%r", unit * MAXCONS); sc->dev[0]->si_tty = ttymalloc(sc->dev[0]->si_tty); @@ -3406,7 +3406,7 @@ next_code: } static int -scmmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +scmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) { scr_stat *scp; @@ -3630,7 +3630,7 @@ blink_screen(void *arg) */ static scr_stat * -sc_get_stat(dev_t devptr) +sc_get_stat(struct cdev *devptr) { if (devptr == NULL) return (&main_console); diff --git a/sys/dev/syscons/syscons.h b/sys/dev/syscons/syscons.h index 217e50c9794c..1651ad8e1c76 100644 --- a/sys/dev/syscons/syscons.h +++ b/sys/dev/syscons/syscons.h @@ -208,7 +208,7 @@ typedef struct sc_softc { int first_vty; int vtys; - dev_t *dev; + struct cdev **dev; struct scr_stat *cur_scp; struct scr_stat *new_scp; struct scr_stat *old_scp; @@ -518,7 +518,7 @@ typedef struct { (*kbdsw[(kbd)->kb_index]->poll)((kbd), (on)) /* syscons.c */ -extern int (*sc_user_ioctl)(dev_t dev, u_long cmd, caddr_t data, +extern int (*sc_user_ioctl)(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td); int sc_probe_unit(int unit, int flags); diff --git a/sys/dev/syscons/sysmouse.c b/sys/dev/syscons/sysmouse.c index ab1cd850e41f..db2487d11f65 100644 --- a/sys/dev/syscons/sysmouse.c +++ b/sys/dev/syscons/sysmouse.c @@ -66,7 +66,7 @@ static void smstart(struct tty *tp); static int smparam(struct tty *tp, struct termios *t); static int -smopen(dev_t dev, int flag, int mode, struct thread *td) +smopen(struct cdev *dev, int flag, int mode, struct thread *td) { struct tty *tp; @@ -101,7 +101,7 @@ smopen(dev_t dev, int flag, int mode, struct thread *td) } static int -smclose(dev_t dev, int flag, int mode, struct thread *td) +smclose(struct cdev *dev, int flag, int mode, struct thread *td) { struct tty *tp; int s; @@ -145,7 +145,7 @@ smparam(struct tty *tp, struct termios *t) } static int -smioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +smioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct tty *tp; mousehw_t *hw; @@ -238,7 +238,7 @@ smioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) static void sm_attach_mouse(void *unused) { - dev_t dev; + struct cdev *dev; dev = make_dev(&sm_cdevsw, SC_MOUSE, UID_ROOT, GID_WHEEL, 0600, "sysmouse"); diff --git a/sys/dev/tdfx/tdfx_pci.c b/sys/dev/tdfx/tdfx_pci.c index 1ba4ed7394cc..351411aee2d6 100644 --- a/sys/dev/tdfx/tdfx_pci.c +++ b/sys/dev/tdfx/tdfx_pci.c @@ -402,7 +402,7 @@ tdfx_setmtrr(device_t dev) { } static int -tdfx_open(dev_t dev, int flags, int fmt, struct thread *td) +tdfx_open(struct cdev *dev, int flags, int fmt, struct thread *td) { /* * The open cdev method handles open(2) calls to /dev/3dfx[n] @@ -420,7 +420,7 @@ tdfx_open(dev_t dev, int flags, int fmt, struct thread *td) } static int -tdfx_close(dev_t dev, int fflag, int devtype, struct thread *td) +tdfx_close(struct cdev *dev, int fflag, int devtype, struct thread *td) { /* * The close cdev method handles close(2) calls to /dev/3dfx[n] @@ -437,7 +437,7 @@ tdfx_close(dev_t dev, int fflag, int devtype, struct thread *td) } static int -tdfx_mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +tdfx_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) { /* * mmap(2) is called by a user process to request that an area of memory @@ -793,7 +793,7 @@ tdfx_do_pio(u_int cmd, struct tdfx_pio_data *piod) * can return -retval and the error should be properly handled. */ static int -tdfx_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +tdfx_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int retval = 0; struct tdfx_pio_data *piod = (struct tdfx_pio_data*)data; diff --git a/sys/dev/tdfx/tdfx_vars.h b/sys/dev/tdfx/tdfx_vars.h index 67ce1319cee8..95a9bbf9c165 100644 --- a/sys/dev/tdfx/tdfx_vars.h +++ b/sys/dev/tdfx/tdfx_vars.h @@ -92,7 +92,7 @@ struct tdfx_softc { unsigned char dv; struct file *curFile; device_t dev; - dev_t devt; + struct cdev *devt; struct mem_range_desc mrdesc; int busy; }; diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index ad5366e8aebc..b80191657260 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -3121,7 +3121,7 @@ ti_ioctl(ifp, command, data) } static int -ti_open(dev_t dev, int flags, int fmt, struct thread *td) +ti_open(struct cdev *dev, int flags, int fmt, struct thread *td) { struct ti_softc *sc; @@ -3137,7 +3137,7 @@ ti_open(dev_t dev, int flags, int fmt, struct thread *td) } static int -ti_close(dev_t dev, int flag, int fmt, struct thread *td) +ti_close(struct cdev *dev, int flag, int fmt, struct thread *td) { struct ti_softc *sc; @@ -3156,7 +3156,7 @@ ti_close(dev_t dev, int flag, int fmt, struct thread *td) * This ioctl routine goes along with the Tigon character device. */ static int -ti_ioctl2(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +ti_ioctl2(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { int error; struct ti_softc *sc; diff --git a/sys/dev/ti/if_tireg.h b/sys/dev/ti/if_tireg.h index 71d9661a5eb0..35525149996f 100644 --- a/sys/dev/ti/if_tireg.h +++ b/sys/dev/ti/if_tireg.h @@ -1025,7 +1025,7 @@ struct ti_softc { int ti_txcnt; struct mtx ti_mtx; ti_flag_vals ti_flags; - dev_t dev; + struct cdev *dev; }; #define TI_LOCK(_sc) mtx_lock(&(_sc)->ti_mtx) diff --git a/sys/dev/twa/twa.h b/sys/dev/twa/twa.h index 5f49b496c0c5..812f326d991b 100644 --- a/sys/dev/twa/twa.h +++ b/sys/dev/twa/twa.h @@ -174,7 +174,7 @@ struct twa_softc { between ioctl calls */ device_t twa_bus_dev; /* bus device */ - dev_t twa_ctrl_dev; /* control device */ + struct cdev *twa_ctrl_dev; /* control device */ struct resource *twa_io_res; /* register interface window */ bus_space_handle_t twa_bus_handle; /* bus space handle */ bus_space_tag_t twa_bus_tag; /* bus space tag */ diff --git a/sys/dev/twa/twa_freebsd.c b/sys/dev/twa/twa_freebsd.c index 9879448f9441..09642c11454b 100644 --- a/sys/dev/twa/twa_freebsd.c +++ b/sys/dev/twa/twa_freebsd.c @@ -75,7 +75,7 @@ static devclass_t twa_devclass; * non-zero-- failure */ static int -twa_open(dev_t dev, int flags, int fmt, d_thread_t *proc) +twa_open(struct cdev *dev, int flags, int fmt, d_thread_t *proc) { int unit = minor(dev); struct twa_softc *sc = devclass_get_softc(twa_devclass, unit); @@ -100,7 +100,7 @@ twa_open(dev_t dev, int flags, int fmt, d_thread_t *proc) * non-zero-- failure */ static int -twa_close(dev_t dev, int flags, int fmt, d_thread_t *proc) +twa_close(struct cdev *dev, int flags, int fmt, d_thread_t *proc) { int unit = minor(dev); struct twa_softc *sc = devclass_get_softc(twa_devclass, unit); @@ -128,7 +128,7 @@ twa_close(dev_t dev, int flags, int fmt, d_thread_t *proc) * non-zero-- failure */ static int -twa_ioctl_wrapper(dev_t dev, u_long cmd, caddr_t buf, +twa_ioctl_wrapper(struct cdev *dev, u_long cmd, caddr_t buf, int flags, d_thread_t *proc) { struct twa_softc *sc = (struct twa_softc *)(dev->si_drv1); @@ -367,7 +367,7 @@ twa_free(struct twa_softc *sc) TWA_IO_CONFIG_REG, sc->twa_io_res); /* Destroy the control device. */ - if (sc->twa_ctrl_dev != (dev_t)NULL) + if (sc->twa_ctrl_dev != (struct cdev *)NULL) destroy_dev(sc->twa_ctrl_dev); sysctl_ctx_free(&sc->twa_sysctl_ctx); diff --git a/sys/dev/twe/twe_compat.h b/sys/dev/twe/twe_compat.h index 5cdad8384c3a..372910041131 100644 --- a/sys/dev/twe/twe_compat.h +++ b/sys/dev/twe/twe_compat.h @@ -78,7 +78,7 @@ bus_dmamap_t twe_cmdmap; /* DMA map for command */ \ u_int32_t twe_cmdphys; /* address of command in controller space */ \ device_t twe_dev; /* bus device */ \ - dev_t twe_dev_t; /* control device */ \ + struct cdev *twe_dev_t; /* control device */ \ struct resource *twe_io; /* register interface window */ \ bus_space_handle_t twe_bhandle; /* bus space handle */ \ bus_space_tag_t twe_btag; /* bus space tag */ \ diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c index 2415ca53fc00..a29b3ddb76a3 100644 --- a/sys/dev/twe/twe_freebsd.c +++ b/sys/dev/twe/twe_freebsd.c @@ -79,7 +79,7 @@ static struct cdevsw twe_cdevsw = { * Accept an open operation on the control device. */ static int -twe_open(dev_t dev, int flags, int fmt, d_thread_t *td) +twe_open(struct cdev *dev, int flags, int fmt, d_thread_t *td) { int unit = minor(dev); struct twe_softc *sc = devclass_get_softc(twe_devclass, unit); @@ -92,7 +92,7 @@ twe_open(dev_t dev, int flags, int fmt, d_thread_t *td) * Accept the last close on the control device. */ static int -twe_close(dev_t dev, int flags, int fmt, d_thread_t *td) +twe_close(struct cdev *dev, int flags, int fmt, d_thread_t *td) { int unit = minor(dev); struct twe_softc *sc = devclass_get_softc(twe_devclass, unit); @@ -105,7 +105,7 @@ twe_close(dev_t dev, int flags, int fmt, d_thread_t *td) * Handle controller-specific control operations. */ static int -twe_ioctl_wrapper(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, d_thread_t *td) +twe_ioctl_wrapper(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, d_thread_t *td) { struct twe_softc *sc = (struct twe_softc *)dev->si_drv1; @@ -423,7 +423,7 @@ twe_free(struct twe_softc *sc) bus_release_resource(sc->twe_dev, SYS_RES_IOPORT, TWE_IO_CONFIG_REG, sc->twe_io); /* destroy control device */ - if (sc->twe_dev_t != (dev_t)NULL) + if (sc->twe_dev_t != (struct cdev *)NULL) destroy_dev(sc->twe_dev_t); sysctl_ctx_free(&sc->sysctl_ctx); diff --git a/sys/dev/uart/uart_bus.h b/sys/dev/uart/uart_bus.h index 3c45199d980d..1ea7779946f2 100644 --- a/sys/dev/uart/uart_bus.h +++ b/sys/dev/uart/uart_bus.h @@ -158,7 +158,7 @@ struct uart_softc { union { /* TTY specific data. */ struct { - dev_t si[2]; /* We have 2 device special files. */ + struct cdev *si[2]; /* We have 2 device special files. */ struct tty *tp; } u_tty; /* Keyboard specific data. */ diff --git a/sys/dev/uart/uart_tty.c b/sys/dev/uart/uart_tty.c index f42a7dc16f59..ec1069666641 100644 --- a/sys/dev/uart/uart_tty.c +++ b/sys/dev/uart/uart_tty.c @@ -361,7 +361,7 @@ int uart_tty_detach(struct uart_softc *sc) } static int -uart_tty_open(dev_t dev, int flags, int mode, struct thread *td) +uart_tty_open(struct cdev *dev, int flags, int mode, struct thread *td) { struct uart_softc *sc; struct tty *tp; @@ -450,7 +450,7 @@ uart_tty_open(dev_t dev, int flags, int mode, struct thread *td) } static int -uart_tty_close(dev_t dev, int flags, int mode, struct thread *td) +uart_tty_close(struct cdev *dev, int flags, int mode, struct thread *td) { struct uart_softc *sc; struct tty *tp; @@ -485,7 +485,7 @@ uart_tty_close(dev_t dev, int flags, int mode, struct thread *td) } static int -uart_tty_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, +uart_tty_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { struct uart_softc *sc; diff --git a/sys/dev/usb/ubser.c b/sys/dev/usb/ubser.c index 62d20b1fb553..d6404944969a 100644 --- a/sys/dev/usb/ubser.c +++ b/sys/dev/usb/ubser.c @@ -158,7 +158,7 @@ struct ubser_softc { u_int sc_opkthdrlen; /* header length of output packet */ - dev_t dev[8]; + struct cdev *dev[8]; }; Static d_open_t ubser_open; @@ -853,7 +853,7 @@ ubser_cleanup(struct ubser_softc *sc) } static int -ubser_open(dev_t dev, int flag, int mode, usb_proc_ptr p) +ubser_open(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { struct ubser_softc *sc; struct tty *tp; @@ -929,7 +929,7 @@ bad: } static int -ubser_close(dev_t dev, int flag, int mode, usb_proc_ptr p) +ubser_close(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { struct ubser_softc *sc; struct tty *tp; @@ -952,7 +952,7 @@ quit: } static int -ubser_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) +ubser_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) { usb_device_request_t req; struct ubser_softc *sc; @@ -997,7 +997,7 @@ ubser_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) } static int -ubser_read(dev_t dev, struct uio *uio, int flag) +ubser_read(struct cdev *dev, struct uio *uio, int flag) { struct ubser_softc *sc; struct tty *tp; @@ -1019,7 +1019,7 @@ ubser_read(dev_t dev, struct uio *uio, int flag) } static int -ubser_write(dev_t dev, struct uio *uio, int flag) +ubser_write(struct cdev *dev, struct uio *uio, int flag) { struct ubser_softc *sc; struct tty *tp; diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 82ab31b47805..82245b790899 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -249,7 +249,7 @@ ucom_shutdown(struct ucom_softc *sc) } Static int -ucomopen(dev_t dev, int flag, int mode, usb_proc_ptr p) +ucomopen(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { int unit = UCOMUNIT(dev); struct ucom_softc *sc; @@ -443,7 +443,7 @@ bad: } static int -ucomclose(dev_t dev, int flag, int mode, usb_proc_ptr p) +ucomclose(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { struct ucom_softc *sc; struct tty *tp; @@ -488,7 +488,7 @@ ucomclose(dev_t dev, int flag, int mode, usb_proc_ptr p) } static int -ucomread(dev_t dev, struct uio *uio, int flag) +ucomread(struct cdev *dev, struct uio *uio, int flag) { struct ucom_softc *sc; struct tty *tp; @@ -510,7 +510,7 @@ ucomread(dev_t dev, struct uio *uio, int flag) } static int -ucomwrite(dev_t dev, struct uio *uio, int flag) +ucomwrite(struct cdev *dev, struct uio *uio, int flag) { struct ucom_softc *sc; struct tty *tp; @@ -532,7 +532,7 @@ ucomwrite(dev_t dev, struct uio *uio, int flag) } static int -ucomioctl(dev_t dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) +ucomioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) { struct ucom_softc *sc; struct tty *tp; diff --git a/sys/dev/usb/ucomvar.h b/sys/dev/usb/ucomvar.h index ba008560c60c..63146b9721ee 100644 --- a/sys/dev/usb/ucomvar.h +++ b/sys/dev/usb/ucomvar.h @@ -173,7 +173,7 @@ struct ucom_softc { int sc_refcnt; u_char sc_dying; /* disconnecting */ - dev_t dev; /* special device node */ + struct cdev *dev; /* special device node */ }; extern devclass_t ucom_devclass; diff --git a/sys/dev/usb/ufm.c b/sys/dev/usb/ufm.c index db008ea91eb4..f8d640b3b93b 100644 --- a/sys/dev/usb/ufm.c +++ b/sys/dev/usb/ufm.c @@ -204,7 +204,7 @@ USB_ATTACH(ufm) sc->sc_epaddr = edesc->bEndpointAddress; #if defined(__FreeBSD__) - /* XXX no error trapping, no storing of dev_t */ + /* XXX no error trapping, no storing of struct cdev **/ (void) make_dev(&ufm_cdevsw, device_get_unit(self), UID_ROOT, GID_OPERATOR, 0644, "ufm%d", device_get_unit(self)); @@ -224,7 +224,7 @@ USB_ATTACH(ufm) int -ufmopen(dev_t dev, int flag, int mode, usb_proc_ptr td) +ufmopen(struct cdev *dev, int flag, int mode, usb_proc_ptr td) { struct ufm_softc *sc; @@ -245,7 +245,7 @@ ufmopen(dev_t dev, int flag, int mode, usb_proc_ptr td) } int -ufmclose(dev_t dev, int flag, int mode, usb_proc_ptr td) +ufmclose(struct cdev *dev, int flag, int mode, usb_proc_ptr td) { struct ufm_softc *sc; @@ -368,7 +368,7 @@ ufm_get_stat(struct ufm_softc *sc, caddr_t addr) } int -ufmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr td) +ufmioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr td) { struct ufm_softc *sc; diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index a9074235254b..81ae5f2fd8d4 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -100,7 +100,7 @@ SYSCTL_INT(_hw_usb_ugen, OID_AUTO, debug, CTLFLAG_RW, struct ugen_endpoint { struct ugen_softc *sc; #if defined(__FreeBSD__) - dev_t dev; + struct cdev *dev; #endif usb_endpoint_descriptor_t *edesc; usbd_interface_handle iface; @@ -127,7 +127,7 @@ struct ugen_softc { USBBASEDEVICE sc_dev; /* base device */ usbd_device_handle sc_udev; #if defined(__FreeBSD__) - dev_t dev; + struct cdev *dev; #endif char sc_is_open[USB_MAX_ENDPOINTS]; @@ -253,7 +253,7 @@ Static void ugen_make_devnodes(struct ugen_softc *sc) { int endptno; - dev_t dev; + struct cdev *dev; for (endptno = 1; endptno < USB_MAX_ENDPOINTS; endptno++) { if (sc->sc_endpoints[endptno][IN].sc != NULL || @@ -283,7 +283,7 @@ Static void ugen_destroy_devnodes(struct ugen_softc *sc) { int endptno; - dev_t dev; + struct cdev *dev; /* destroy all devices for the other (existing) endpoints as well */ for (endptno = 1; endptno < USB_MAX_ENDPOINTS; endptno++) { @@ -379,7 +379,7 @@ ugen_set_config(struct ugen_softc *sc, int configno) } int -ugenopen(dev_t dev, int flag, int mode, usb_proc_ptr p) +ugenopen(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { struct ugen_softc *sc; int unit = UGENUNIT(dev); @@ -519,7 +519,7 @@ ugenopen(dev_t dev, int flag, int mode, usb_proc_ptr p) } int -ugenclose(dev_t dev, int flag, int mode, usb_proc_ptr p) +ugenclose(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { int endpt = UGENENDPOINT(dev); struct ugen_softc *sc; @@ -725,7 +725,7 @@ ugen_do_read(struct ugen_softc *sc, int endpt, struct uio *uio, int flag) } int -ugenread(dev_t dev, struct uio *uio, int flag) +ugenread(struct cdev *dev, struct uio *uio, int flag) { int endpt = UGENENDPOINT(dev); struct ugen_softc *sc; @@ -825,7 +825,7 @@ ugen_do_write(struct ugen_softc *sc, int endpt, struct uio *uio, int flag) } int -ugenwrite(dev_t dev, struct uio *uio, int flag) +ugenwrite(struct cdev *dev, struct uio *uio, int flag) { int endpt = UGENENDPOINT(dev); struct ugen_softc *sc; @@ -1390,7 +1390,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, } int -ugenioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p) +ugenioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p) { int endpt = UGENENDPOINT(dev); struct ugen_softc *sc; @@ -1406,7 +1406,7 @@ ugenioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p) } int -ugenpoll(dev_t dev, int events, usb_proc_ptr p) +ugenpoll(struct cdev *dev, int events, usb_proc_ptr p) { struct ugen_softc *sc; struct ugen_endpoint *sce; diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index 461d35cbb29b..f19424bc5337 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -136,7 +136,7 @@ struct uhid_softc { u_char sc_dying; #if defined(__FreeBSD__) - dev_t dev; + struct cdev *dev; #endif }; @@ -393,7 +393,7 @@ uhid_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status) } int -uhidopen(dev_t dev, int flag, int mode, usb_proc_ptr p) +uhidopen(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { struct uhid_softc *sc; usbd_status err; @@ -440,7 +440,7 @@ uhidopen(dev_t dev, int flag, int mode, usb_proc_ptr p) } int -uhidclose(dev_t dev, int flag, int mode, usb_proc_ptr p) +uhidclose(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { struct uhid_softc *sc; @@ -530,7 +530,7 @@ uhid_do_read(struct uhid_softc *sc, struct uio *uio, int flag) } int -uhidread(dev_t dev, struct uio *uio, int flag) +uhidread(struct cdev *dev, struct uio *uio, int flag) { struct uhid_softc *sc; int error; @@ -576,7 +576,7 @@ uhid_do_write(struct uhid_softc *sc, struct uio *uio, int flag) } int -uhidwrite(dev_t dev, struct uio *uio, int flag) +uhidwrite(struct cdev *dev, struct uio *uio, int flag) { struct uhid_softc *sc; int error; @@ -710,7 +710,7 @@ uhid_do_ioctl(struct uhid_softc *sc, u_long cmd, caddr_t addr, int flag, } int -uhidioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p) +uhidioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p) { struct uhid_softc *sc; int error; @@ -725,7 +725,7 @@ uhidioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p) } int -uhidpoll(dev_t dev, int events, usb_proc_ptr p) +uhidpoll(struct cdev *dev, int events, usb_proc_ptr p) { struct uhid_softc *sc; int revents = 0; diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 48aeb0956edc..e8f38d8b5b79 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -122,8 +122,8 @@ struct ulpt_softc { u_char sc_dying; #if defined(__FreeBSD__) - dev_t dev; - dev_t dev_noprime; + struct cdev *dev; + struct cdev *dev_noprime; #endif }; @@ -490,7 +490,7 @@ int ulptusein = 1; * Reset the printer, then wait until it's selected and not busy. */ int -ulptopen(dev_t dev, int flag, int mode, usb_proc_ptr p) +ulptopen(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { u_char flags = ULPTFLAGS(dev); struct ulpt_softc *sc; @@ -625,7 +625,7 @@ ulpt_statusmsg(u_char status, struct ulpt_softc *sc) } int -ulptclose(dev_t dev, int flag, int mode, usb_proc_ptr p) +ulptclose(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { struct ulpt_softc *sc; @@ -697,7 +697,7 @@ ulpt_do_write(struct ulpt_softc *sc, struct uio *uio, int flags) } int -ulptwrite(dev_t dev, struct uio *uio, int flags) +ulptwrite(struct cdev *dev, struct uio *uio, int flags) { struct ulpt_softc *sc; int error; @@ -715,7 +715,7 @@ ulptwrite(dev_t dev, struct uio *uio, int flags) } int -ulptioctl(dev_t dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) +ulptioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) { int error = 0; diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index 1bb82ea000ba..708f3013066b 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -130,7 +130,7 @@ struct ums_softc { # define UMS_SELECT 0x02 /* select is waiting */ struct selinfo rsel; /* process waiting in select */ - dev_t dev; /* specfs */ + struct cdev *dev; /* specfs */ }; #define MOUSE_FLAGS_MASK (HIO_CONST|HIO_RELATIVE) @@ -589,7 +589,7 @@ ums_disable(priv) } Static int -ums_open(dev_t dev, int flag, int fmt, usb_proc_ptr p) +ums_open(struct cdev *dev, int flag, int fmt, usb_proc_ptr p) { struct ums_softc *sc; @@ -599,7 +599,7 @@ ums_open(dev_t dev, int flag, int fmt, usb_proc_ptr p) } Static int -ums_close(dev_t dev, int flag, int fmt, usb_proc_ptr p) +ums_close(struct cdev *dev, int flag, int fmt, usb_proc_ptr p) { struct ums_softc *sc; @@ -615,7 +615,7 @@ ums_close(dev_t dev, int flag, int fmt, usb_proc_ptr p) } Static int -ums_read(dev_t dev, struct uio *uio, int flag) +ums_read(struct cdev *dev, struct uio *uio, int flag) { struct ums_softc *sc; int s; @@ -685,7 +685,7 @@ ums_read(dev_t dev, struct uio *uio, int flag) } Static int -ums_poll(dev_t dev, int events, usb_proc_ptr p) +ums_poll(struct cdev *dev, int events, usb_proc_ptr p) { struct ums_softc *sc; int revents = 0; @@ -711,7 +711,7 @@ ums_poll(dev_t dev, int events, usb_proc_ptr p) } int -ums_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p) +ums_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p) { struct ums_softc *sc; int error = 0; diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index eaec4e5b1007..8685f0daea33 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -148,7 +148,7 @@ struct urio_softc { int sc_refcnt; #if defined(__FreeBSD__) - dev_t sc_dev_t; + struct cdev *sc_dev_t; #endif /* defined(__FreeBSD__) */ #if defined(__NetBSD__) || defined(__OpenBSD__) u_char sc_dying; @@ -262,7 +262,7 @@ USB_ATTACH(urio) } #if defined(__FreeBSD__) - /* XXX no error trapping, no storing of dev_t */ + /* XXX no error trapping, no storing of struct cdev **/ sc->sc_dev_t = make_dev(&urio_cdevsw, device_get_unit(self), UID_ROOT, GID_OPERATOR, 0644, "urio%d", device_get_unit(self)); @@ -282,7 +282,7 @@ USB_ATTACH(urio) int -urioopen(dev_t dev, int flag, int mode, usb_proc_ptr p) +urioopen(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { #if (USBDI >= 1) struct urio_softc * sc; @@ -322,7 +322,7 @@ urioopen(dev_t dev, int flag, int mode, usb_proc_ptr p) } int -urioclose(dev_t dev, int flag, int mode, usb_proc_ptr p) +urioclose(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { #if (USBDI >= 1) struct urio_softc * sc; @@ -345,7 +345,7 @@ urioclose(dev_t dev, int flag, int mode, usb_proc_ptr p) } int -urioread(dev_t dev, struct uio *uio, int flag) +urioread(struct cdev *dev, struct uio *uio, int flag) { #if (USBDI >= 1) struct urio_softc * sc; @@ -419,7 +419,7 @@ urioread(dev_t dev, struct uio *uio, int flag) } int -uriowrite(dev_t dev, struct uio *uio, int flag) +uriowrite(struct cdev *dev, struct uio *uio, int flag) { #if (USBDI >= 1) struct urio_softc * sc; @@ -486,7 +486,7 @@ uriowrite(dev_t dev, struct uio *uio, int flag) int -urioioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p) +urioioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p) { #if (USBDI >= 1) struct urio_softc * sc; diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index d2ce30ff3079..d934491eb1f8 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -470,7 +470,7 @@ usbctlprint(void *aux, const char *pnp) #endif /* defined(__NetBSD__) || defined(__OpenBSD__) */ int -usbopen(dev_t dev, int flag, int mode, usb_proc_ptr p) +usbopen(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { int unit = USBUNIT(dev); struct usb_softc *sc; @@ -492,7 +492,7 @@ usbopen(dev_t dev, int flag, int mode, usb_proc_ptr p) } int -usbread(dev_t dev, struct uio *uio, int flag) +usbread(struct cdev *dev, struct uio *uio, int flag) { struct usb_event ue; int unit = USBUNIT(dev); @@ -526,7 +526,7 @@ usbread(dev_t dev, struct uio *uio, int flag) } int -usbclose(dev_t dev, int flag, int mode, usb_proc_ptr p) +usbclose(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { int unit = USBUNIT(dev); @@ -539,7 +539,7 @@ usbclose(dev_t dev, int flag, int mode, usb_proc_ptr p) } int -usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) +usbioctl(struct cdev *devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) { struct usb_softc *sc; int unit = USBUNIT(devt); @@ -659,7 +659,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) } int -usbpoll(dev_t dev, int events, usb_proc_ptr p) +usbpoll(struct cdev *dev, int events, usb_proc_ptr p) { int revents, mask, s; int unit = USBUNIT(dev); diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index f1a37002c176..e085c69a62ea 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -232,7 +232,7 @@ struct uscanner_softc { usbd_device_handle sc_udev; usbd_interface_handle sc_iface; #if defined(__FreeBSD__) - dev_t dev; + struct cdev *dev; #endif u_int sc_dev_flags; @@ -380,7 +380,7 @@ USB_ATTACH(uscanner) } int -uscanneropen(dev_t dev, int flag, int mode, usb_proc_ptr p) +uscanneropen(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { struct uscanner_softc *sc; int unit = USCANNERUNIT(dev); @@ -443,7 +443,7 @@ uscanneropen(dev_t dev, int flag, int mode, usb_proc_ptr p) } int -uscannerclose(dev_t dev, int flag, int mode, usb_proc_ptr p) +uscannerclose(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { struct uscanner_softc *sc; @@ -541,7 +541,7 @@ uscanner_do_read(struct uscanner_softc *sc, struct uio *uio, int flag) } int -uscannerread(dev_t dev, struct uio *uio, int flag) +uscannerread(struct cdev *dev, struct uio *uio, int flag) { struct uscanner_softc *sc; int error; @@ -591,7 +591,7 @@ uscanner_do_write(struct uscanner_softc *sc, struct uio *uio, int flag) } int -uscannerwrite(dev_t dev, struct uio *uio, int flag) +uscannerwrite(struct cdev *dev, struct uio *uio, int flag) { struct uscanner_softc *sc; int error; @@ -674,7 +674,7 @@ USB_DETACH(uscanner) } int -uscannerpoll(dev_t dev, int events, usb_proc_ptr p) +uscannerpoll(struct cdev *dev, int events, usb_proc_ptr p) { struct uscanner_softc *sc; int revents = 0; diff --git a/sys/dev/vinum/vinum.c b/sys/dev/vinum/vinum.c index 8e1bf36c484a..3306c96ed222 100644 --- a/sys/dev/vinum/vinum.c +++ b/sys/dev/vinum/vinum.c @@ -69,12 +69,12 @@ struct cdevsw vinum_cdevsw = { /* Called by main() during pseudo-device attachment. */ void vinumattach(void *); STATIC int vinum_modevent(module_t mod, modeventtype_t type, void *unused); -STATIC void vinum_clone(void *arg, char *name, int namelen, dev_t * dev); +STATIC void vinum_clone(void *arg, char *name, int namelen, struct cdev ** dev); struct _vinum_conf vinum_conf; /* configuration information */ -dev_t vinum_daemon_dev; -dev_t vinum_super_dev; +struct cdev *vinum_daemon_dev; +struct cdev *vinum_super_dev; static eventhandler_tag dev_clone_tag; @@ -334,7 +334,7 @@ DECLARE_MODULE(vinum, vinum_mod, SI_SUB_RAID, SI_ORDER_MIDDLE); /* ARGSUSED */ /* Open a vinum object */ int -vinumopen(dev_t dev, +vinumopen(struct cdev *dev, int flags, int fmt, struct thread *td) @@ -437,7 +437,7 @@ vinumopen(dev_t dev, /* ARGSUSED */ int -vinumclose(dev_t dev, +vinumclose(struct cdev *dev, int flags, int fmt, struct thread *td) @@ -517,7 +517,7 @@ vinumclose(dev_t dev, } void -vinum_clone(void *arg, char *name, int namelen, dev_t * dev) +vinum_clone(void *arg, char *name, int namelen, struct cdev ** dev) { struct volume *vol; int i; diff --git a/sys/dev/vinum/vinumext.h b/sys/dev/vinum/vinumext.h index 86319f0afff1..e60356cae36c 100644 --- a/sys/dev/vinum/vinumext.h +++ b/sys/dev/vinum/vinumext.h @@ -141,13 +141,13 @@ d_close_t vinumclose; d_strategy_t vinumstrategy; d_ioctl_t vinumioctl; -int vinum_super_ioctl(dev_t, u_long, caddr_t); +int vinum_super_ioctl(struct cdev *, u_long, caddr_t); int vinumstart(struct buf *bp, int reviveok); int launch_requests(struct request *rq, int reviveok); void sdio(struct buf *bp); /* XXX Do we need this? */ -int vinumpart(dev_t); +int vinumpart(struct cdev *); extern jmp_buf command_fail; /* return here if config fails */ @@ -172,9 +172,9 @@ struct rqgroup *allocrqg(struct request *rq, int elements); void deallocrqg(struct rqgroup *rqg); /* Device number decoding */ -int Volno(dev_t x); -int Plexno(dev_t x); -int Sdno(dev_t x); +int Volno(struct cdev *x); +int Plexno(struct cdev *x); +int Sdno(struct cdev *x); /* State transitions */ int set_drive_state(int driveno, enum drivestate state, enum setstateflags flags); diff --git a/sys/dev/vinum/vinumioctl.c b/sys/dev/vinum/vinumioctl.c index f38017f89d53..1783c9234505 100644 --- a/sys/dev/vinum/vinumioctl.c +++ b/sys/dev/vinum/vinumioctl.c @@ -65,7 +65,7 @@ jmp_buf command_fail; /* return on a failed command */ /* ioctl routine */ int -vinumioctl(dev_t dev, +vinumioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, @@ -178,7 +178,7 @@ vinumioctl(dev_t dev, /* Handle ioctls for the super device */ int -vinum_super_ioctl(dev_t dev, +vinum_super_ioctl(struct cdev *dev, u_long cmd, caddr_t data) { diff --git a/sys/dev/vinum/vinumobj.h b/sys/dev/vinum/vinumobj.h index 0d5b800f3d2e..d6a4d873d225 100644 --- a/sys/dev/vinum/vinumobj.h +++ b/sys/dev/vinum/vinumobj.h @@ -184,7 +184,7 @@ struct _drive #ifdef _KERNEL u_int sectorsize; off_t mediasize; - dev_t dev; /* device information */ + struct cdev *dev; /* device information */ #ifdef VINUMDEBUG char lockfilename[16]; /* name of file from which we were locked */ int lockline; /* and the line number */ @@ -234,7 +234,7 @@ struct _sd int init_interval; /* and time to wait between transfers */ #ifdef _KERNEL struct request *waitlist; /* list of requests waiting on revive op */ - dev_t dev; /* associated device */ + struct cdev *dev; /* associated device */ #endif }; @@ -276,7 +276,7 @@ struct _plex struct rangelock *lock; /* ranges of locked addresses */ struct mtx *lockmtx; /* lock mutex, one of plexmutex [] */ daddr_t last_addr; /* last address read from this plex */ - dev_t dev; /* associated device */ + struct cdev *dev; /* associated device */ #endif }; @@ -316,6 +316,6 @@ struct _volume */ int plex[MAXPLEX]; /* index of plexes */ #ifdef _KERNEL - dev_t dev; /* associated device */ + struct cdev *dev; /* associated device */ #endif }; diff --git a/sys/dev/vinum/vinumutil.c b/sys/dev/vinum/vinumutil.c index f597cd72c06c..f63bbd7f308f 100644 --- a/sys/dev/vinum/vinumutil.c +++ b/sys/dev/vinum/vinumutil.c @@ -243,12 +243,17 @@ sizespec(char *spec) return -1; } +#ifdef _KERNEL +#define FOOTYPE struct cdev * +#else +#define FOOTYPE dev_t +#endif /* * Extract the volume number from a device number. Check that it's * the correct type, and that it isn't one of the superdevs. */ int -Volno(dev_t dev) +Volno(FOOTYPE dev) { int volno = minor(dev); @@ -269,7 +274,7 @@ Volno(dev_t dev) * type. Return -1 for invalid types. */ int -Plexno(dev_t dev) +Plexno(FOOTYPE dev) { int plexno = minor(dev); @@ -285,7 +290,7 @@ Plexno(dev_t dev) * type. Return -1 for invalid types. */ int -Sdno(dev_t dev) +Sdno(FOOTYPE dev) { int sdno = minor(dev); diff --git a/sys/dev/watchdog/watchdog.c b/sys/dev/watchdog/watchdog.c index a76e3ef2830b..782388588089 100644 --- a/sys/dev/watchdog/watchdog.c +++ b/sys/dev/watchdog/watchdog.c @@ -39,10 +39,10 @@ __FBSDID("$FreeBSD$"); #include #include -static dev_t wd_dev; +static struct cdev *wd_dev; static int -wd_ioctl(dev_t dev __unused, u_long cmd, caddr_t data, +wd_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t data, int flags __unused, struct thread *td) { int error; diff --git a/sys/dev/zs/z8530var.h b/sys/dev/zs/z8530var.h index 89a246a80c90..1e5fef7d3282 100644 --- a/sys/dev/zs/z8530var.h +++ b/sys/dev/zs/z8530var.h @@ -43,7 +43,7 @@ struct zstty_softc { bus_space_tag_t sc_bt; bus_space_handle_t sc_csr; bus_space_handle_t sc_data; - dev_t sc_si; + struct cdev *sc_si; struct tty *sc_tty; int sc_icnt; uint8_t *sc_iput; diff --git a/sys/dev/zs/zs.c b/sys/dev/zs/zs.c index 46955261771b..bc848fb369bd 100644 --- a/sys/dev/zs/zs.c +++ b/sys/dev/zs/zs.c @@ -447,7 +447,7 @@ zstty_softintr(struct zstty_softc *sc) } static int -zsttyopen(dev_t dev, int flags, int mode, struct thread *td) +zsttyopen(struct cdev *dev, int flags, int mode, struct thread *td) { struct zstty_softc *sc; struct tty *tp; @@ -503,7 +503,7 @@ zsttyopen(dev_t dev, int flags, int mode, struct thread *td) } static int -zsttyclose(dev_t dev, int flags, int mode, struct thread *td) +zsttyclose(struct cdev *dev, int flags, int mode, struct thread *td) { struct tty *tp; @@ -519,7 +519,7 @@ zsttyclose(dev_t dev, int flags, int mode, struct thread *td) } static int -zsttyioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) +zsttyioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { struct zstty_softc *sc; struct tty *tp; diff --git a/sys/fs/cd9660/cd9660_node.c b/sys/fs/cd9660/cd9660_node.c index b51f15dc4c26..687ec66515cf 100644 --- a/sys/fs/cd9660/cd9660_node.c +++ b/sys/fs/cd9660/cd9660_node.c @@ -92,7 +92,7 @@ cd9660_uninit(vfsp) */ int cd9660_ihashget(dev, inum, flags, vpp) - dev_t dev; + struct cdev *dev; ino_t inum; int flags; struct vnode **vpp; diff --git a/sys/fs/cd9660/cd9660_node.h b/sys/fs/cd9660/cd9660_node.h index 8e7d6c12d8e5..a5b228c45f06 100644 --- a/sys/fs/cd9660/cd9660_node.h +++ b/sys/fs/cd9660/cd9660_node.h @@ -113,7 +113,7 @@ void cd9660_defattr(struct iso_directory_record *, struct iso_node *, struct buf *, enum ISO_FTYPE); void cd9660_deftstamp(struct iso_directory_record *, struct iso_node *, struct buf *, enum ISO_FTYPE); -int cd9660_ihashget(dev_t, ino_t, int, struct vnode **); +int cd9660_ihashget(struct cdev *, ino_t, int, struct vnode **); void cd9660_ihashins(struct iso_node *); int cd9660_tstamp_conv7(u_char *, struct timespec *, enum ISO_FTYPE); int cd9660_tstamp_conv17(u_char *, struct timespec *); diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index ceb60f90e1c2..dc0b240dff23 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -92,7 +92,7 @@ MODULE_VERSION(cd9660, 1); * Called by vfs_mountroot when iso is going to be mounted as root. */ -static int iso_get_ssector(dev_t dev, struct thread *td); +static int iso_get_ssector(struct cdev *dev, struct thread *td); static int iso_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td, struct iso_args *argp); @@ -103,7 +103,7 @@ static int iso_mountfs(struct vnode *devvp, struct mount *mp, */ static int iso_get_ssector(dev, td) - dev_t dev; + struct cdev *dev; struct thread *td; { struct ioc_toc_header h; @@ -272,7 +272,7 @@ iso_mountfs(devvp, mp, td, argp) register struct iso_mnt *isomp = (struct iso_mnt *)0; struct buf *bp = NULL; struct buf *pribp = NULL, *supbp = NULL; - dev_t dev = devvp->v_rdev; + struct cdev *dev = devvp->v_rdev; int error = EINVAL; int needclose = 0; int high_sierra = 0; @@ -707,7 +707,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) struct iso_node *ip; struct buf *bp; struct vnode *vp; - dev_t dev; + struct cdev *dev; int error; imp = VFSTOISOFS(mp); diff --git a/sys/fs/cd9660/iso.h b/sys/fs/cd9660/iso.h index 4789e50c296f..412f130b1f62 100644 --- a/sys/fs/cd9660/iso.h +++ b/sys/fs/cd9660/iso.h @@ -223,7 +223,7 @@ struct iso_mnt { int im_flags; struct mount *im_mountp; - dev_t im_dev; + struct cdev *im_dev; struct vnode *im_devvp; int logical_block_size; diff --git a/sys/fs/coda/cnode.h b/sys/fs/coda/cnode.h index 540831c719b0..be7e848bbea6 100644 --- a/sys/fs/coda/cnode.h +++ b/sys/fs/coda/cnode.h @@ -109,7 +109,7 @@ struct cnode { struct vattr c_vattr; /* attributes */ char *c_symlink; /* pointer to symbolic link */ u_short c_symlen; /* length of symbolic link */ - dev_t c_device; /* associated vnode device */ + struct cdev *c_device; /* associated vnode device */ ino_t c_inode; /* associated vnode inode */ struct cnode *c_next; /* links if on NetBSD machine */ }; @@ -153,7 +153,7 @@ struct coda_mntinfo { struct vnode *mi_rootvp; struct mount *mi_vfsp; struct vcomm mi_vcomm; - dev_t dev; + struct cdev *dev; int mi_started; }; extern struct coda_mntinfo coda_mnttbl[]; /* indexed by minor device number */ @@ -201,7 +201,7 @@ extern struct cnode *make_coda_node(CodaFid *fid, struct mount *vfsp, short type extern int coda_vnodeopstats_init(void); /* coda_vfsops.h */ -extern struct mount *devtomp(dev_t dev); +extern struct mount *devtomp(struct cdev *dev); /* sigh */ #define CODA_RDWR ((u_long) 31) diff --git a/sys/fs/coda/coda.h b/sys/fs/coda/coda.h index e7f1e0d2566b..90e7e2ae7202 100644 --- a/sys/fs/coda/coda.h +++ b/sys/fs/coda/coda.h @@ -58,7 +58,7 @@ typedef unsigned long u_long; typedef unsigned int u_int; typedef unsigned short u_short; typedef u_long ino_t; -typedef u_long dev_t; +typedef u_long struct cdev *; typedef void * caddr_t; #ifdef DOS typedef unsigned __int64 u_quad_t; diff --git a/sys/fs/coda/coda_fbsd.c b/sys/fs/coda/coda_fbsd.c index 784962c19e66..0ce6e466e87e 100644 --- a/sys/fs/coda/coda_fbsd.c +++ b/sys/fs/coda/coda_fbsd.c @@ -174,7 +174,7 @@ printf("error = %d\n", error); /* for DEVFS, using bpf & tun drivers as examples*/ static void coda_fbsd_drvinit(void *unused); static void coda_fbsd_drvuninit(void *unused); -static void coda_fbsd_clone(void *arg, char *name, int namelen, dev_t *dev); +static void coda_fbsd_clone(void *arg, char *name, int namelen, struct cdev **dev); static eventhandler_tag clonetag; @@ -182,7 +182,7 @@ static void coda_fbsd_clone(arg, name, namelen, dev) void *arg; char *name; int namelen; - dev_t *dev; + struct cdev **dev; { int u; diff --git a/sys/fs/coda/coda_psdev.c b/sys/fs/coda/coda_psdev.c index 133d0fdb1579..03e408da63d6 100644 --- a/sys/fs/coda/coda_psdev.c +++ b/sys/fs/coda/coda_psdev.c @@ -117,7 +117,7 @@ vcodaattach(n) int vc_nb_open(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag; int mode; struct thread *td; /* NetBSD only */ @@ -149,7 +149,7 @@ vc_nb_open(dev, flag, mode, td) int vc_nb_close (dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag; int mode; struct thread *td; @@ -233,7 +233,7 @@ vc_nb_close (dev, flag, mode, td) int vc_nb_read(dev, uiop, flag) - dev_t dev; + struct cdev *dev; struct uio *uiop; int flag; { @@ -287,7 +287,7 @@ vc_nb_read(dev, uiop, flag) int vc_nb_write(dev, uiop, flag) - dev_t dev; + struct cdev *dev; struct uio *uiop; int flag; { @@ -387,7 +387,7 @@ vc_nb_write(dev, uiop, flag) int vc_nb_ioctl(dev, cmd, addr, flag, td) - dev_t dev; + struct cdev *dev; u_long cmd; caddr_t addr; int flag; @@ -441,7 +441,7 @@ vc_nb_ioctl(dev, cmd, addr, flag, td) int vc_nb_poll(dev, events, td) - dev_t dev; + struct cdev *dev; int events; struct thread *td; { diff --git a/sys/fs/coda/coda_psdev.h b/sys/fs/coda/coda_psdev.h index c6ecf7f435e2..f135b3441208 100644 --- a/sys/fs/coda/coda_psdev.h +++ b/sys/fs/coda/coda_psdev.h @@ -31,9 +31,9 @@ * */ -int vc_nb_open(dev_t dev, int flag, int mode, struct thread *p); -int vc_nb_close (dev_t dev, int flag, int mode, struct thread *p); -int vc_nb_read(dev_t dev, struct uio *uiop, int flag); -int vc_nb_write(dev_t dev, struct uio *uiop, int flag); -int vc_nb_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *p); -int vc_nb_poll(dev_t dev, int events, struct thread *p); +int vc_nb_open(struct cdev *dev, int flag, int mode, struct thread *p); +int vc_nb_close (struct cdev *dev, int flag, int mode, struct thread *p); +int vc_nb_read(struct cdev *dev, struct uio *uiop, int flag); +int vc_nb_write(struct cdev *dev, struct uio *uiop, int flag); +int vc_nb_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *p); +int vc_nb_poll(struct cdev *dev, int events, struct thread *p); diff --git a/sys/fs/coda/coda_venus.c b/sys/fs/coda/coda_venus.c index 5105c0b882bc..f0bc3c296bdf 100644 --- a/sys/fs/coda/coda_venus.c +++ b/sys/fs/coda/coda_venus.c @@ -198,7 +198,7 @@ venus_root(void *mdp, int venus_open(void *mdp, CodaFid *fid, int flag, struct ucred *cred, struct proc *p, -/*out*/ dev_t *dev, ino_t *inode) +/*out*/ struct cdev **dev, ino_t *inode) { int cflag; DECL(coda_open); /* sets Isize & Osize */ diff --git a/sys/fs/coda/coda_venus.h b/sys/fs/coda/coda_venus.h index b506b5ba0277..473b84d30092 100644 --- a/sys/fs/coda/coda_venus.h +++ b/sys/fs/coda/coda_venus.h @@ -39,7 +39,7 @@ venus_root(void *mdp, int venus_open(void *mdp, CodaFid *fid, int flag, struct ucred *cred, struct proc *p, -/*out*/ dev_t *dev, ino_t *inode); +/*out*/ struct cdev **dev, ino_t *inode); int venus_close(void *mdp, CodaFid *fid, int flag, diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c index ff6442932037..e7290e770807 100644 --- a/sys/fs/coda/coda_vfsops.c +++ b/sys/fs/coda/coda_vfsops.c @@ -81,7 +81,7 @@ struct coda_op_stats coda_vfsopstats[CODA_VFSOPS_SIZE]; #define MRAK_INT_GEN(op) (coda_vfsopstats[op].gen_intrn++) extern int coda_nc_initialized; /* Set if cache has been initialized */ -extern int vc_nb_open(dev_t, int, int, struct thread *); +extern int vc_nb_open(struct cdev *, int, int, struct thread *); int coda_vfsopstats_init(void) @@ -114,7 +114,7 @@ coda_mount(vfsp, path, data, ndp, td) { struct vnode *dvp; struct cnode *cp; - dev_t dev; + struct cdev *dev; struct coda_mntinfo *mi; struct vnode *rootvp; CodaFid rootfid = INVAL_FID; @@ -528,7 +528,7 @@ getNewVnode(vpp) * device corresponds to a UFS. Return NULL if no device is found. */ struct mount *devtomp(dev) - dev_t dev; + struct cdev *dev; { struct mount *mp; diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c index a1d24e930f77..a8666cc6f2f7 100644 --- a/sys/fs/coda/coda_vnops.c +++ b/sys/fs/coda/coda_vnops.c @@ -238,7 +238,7 @@ coda_open(v) /* locals */ int error; struct vnode *vp; - dev_t dev; + struct cdev *dev; ino_t inode; MARK_ENTRY(CODA_OPEN_STATS); @@ -1806,7 +1806,7 @@ coda_islocked(v) /* How one looks up a vnode given a device/inode pair: */ int -coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp) +coda_grab_vnode(struct cdev *dev, ino_t ino, struct vnode **vpp) { /* This is like VFS_VGET() or igetinode()! */ int error; diff --git a/sys/fs/coda/coda_vnops.h b/sys/fs/coda/coda_vnops.h index 8a3184b83c99..88a398e8cd6c 100644 --- a/sys/fs/coda/coda_vnops.h +++ b/sys/fs/coda/coda_vnops.h @@ -82,6 +82,6 @@ int coda_pathconf(void *); int coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, int ioflag, struct ucred *cred, struct thread *td); -int coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp); +int coda_grab_vnode(struct cdev *dev, ino_t ino, struct vnode **vpp); void print_vattr(struct vattr *attr); void print_cred(struct ucred *cred); diff --git a/sys/fs/devfs/devfs.h b/sys/fs/devfs/devfs.h index c12a4d6e99a3..ba8bbf02a4be 100644 --- a/sys/fs/devfs/devfs.h +++ b/sys/fs/devfs/devfs.h @@ -190,7 +190,7 @@ void devfs_rules_apply(struct devfs_mount *dm, struct devfs_dirent *de); int devfs_rules_ioctl(struct mount *mp, u_long cmd, caddr_t data, struct thread *td); void devfs_rules_newmount(struct devfs_mount *dm, struct thread *td); int devfs_allocv (struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, struct thread *td); -dev_t *devfs_itod (int inode); +struct cdev **devfs_itod (int inode); struct devfs_dirent **devfs_itode (struct devfs_mount *dm, int inode); int devfs_populate (struct devfs_mount *dm); struct devfs_dirent *devfs_newdirent (char *name, int namelen); diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c index eb394d88c824..732a23d8d711 100644 --- a/sys/fs/devfs/devfs_devs.c +++ b/sys/fs/devfs/devfs_devs.c @@ -47,8 +47,8 @@ #include -static dev_t devfs_inot[NDEVFSINO]; -static dev_t *devfs_overflow; +static struct cdev *devfs_inot[NDEVFSINO]; +static struct cdev **devfs_overflow; static int devfs_ref[NDEVFSINO]; static int *devfs_refoverflow; static int devfs_nextino = 3; @@ -95,7 +95,7 @@ static int devfs_getref(int inode) { int *ip, i, j; - dev_t *dp; + struct cdev **dp; ip = devfs_itor(inode); dp = devfs_itod(inode); @@ -124,7 +124,7 @@ devfs_itode (struct devfs_mount *dm, int inode) return (NULL); } -dev_t * +struct cdev ** devfs_itod (int inode) { @@ -140,7 +140,7 @@ devfs_itod (int inode) static void devfs_attemptoverflow(int insist) { - dev_t **ot; + struct cdev ***ot; int *or; int n, nb; @@ -150,8 +150,8 @@ devfs_attemptoverflow(int insist) ot = NULL; or = NULL; n = devfs_noverflowwant; - nb = sizeof (dev_t *) * n; - MALLOC(ot, dev_t **, nb, M_DEVFS, (insist ? M_WAITOK : M_NOWAIT) | M_ZERO); + nb = sizeof (struct cdev **) * n; + MALLOC(ot, struct cdev ***, nb, M_DEVFS, (insist ? M_WAITOK : M_NOWAIT) | M_ZERO); if (ot == NULL) goto bail; nb = sizeof (int) * n; @@ -282,7 +282,7 @@ int devfs_populate(struct devfs_mount *dm) { int i, j; - dev_t dev, pdev; + struct cdev *dev, *pdev; struct devfs_dirent *dd; struct devfs_dirent *de, **dep; char *q, *s; @@ -377,10 +377,10 @@ devfs_populate(struct devfs_mount *dm) } void -devfs_create(dev_t dev) +devfs_create(struct cdev *dev) { int ino, i, *ip; - dev_t *dp; + struct cdev **dp; for (;;) { /* Grab the next inode number */ @@ -426,7 +426,7 @@ devfs_create(dev_t dev) } void -devfs_destroy(dev_t dev) +devfs_destroy(struct cdev *dev) { int ino, i; diff --git a/sys/fs/devfs/devfs_rule.c b/sys/fs/devfs/devfs_rule.c index 366fd848d039..b73ac7729e5b 100644 --- a/sys/fs/devfs/devfs_rule.c +++ b/sys/fs/devfs/devfs_rule.c @@ -108,7 +108,7 @@ static void devfs_rule_applydm(struct devfs_krule *dk, struct devfs_mount *dm); static int devfs_rule_autonumber(struct devfs_ruleset *ds, devfs_rnum *rnp); static struct devfs_krule *devfs_rule_byid(devfs_rid rid); static int devfs_rule_delete(struct devfs_krule **dkp); -static dev_t devfs_rule_getdev(struct devfs_dirent *de); +static struct cdev *devfs_rule_getdev(struct devfs_dirent *de); static int devfs_rule_input(struct devfs_rule *dr, struct devfs_mount *dm); static int devfs_rule_insert(struct devfs_rule *dr); static int devfs_rule_match(struct devfs_krule *dk, struct devfs_dirent *de); @@ -480,26 +480,26 @@ devfs_rule_delete(struct devfs_krule **dkp) } /* - * Get a dev_t corresponding to de so we can try to match rules based - * on it. If this routine returns NULL, there is no dev_t associated + * Get a struct cdev *corresponding to de so we can try to match rules based + * on it. If this routine returns NULL, there is no struct cdev *associated * with the dirent (symlinks and directories don't have dev_ts), and * the caller should assume that any critera dependent on a dev_t * don't match. */ -static dev_t +static struct cdev * devfs_rule_getdev(struct devfs_dirent *de) { - dev_t *devp, dev; + struct cdev **devp, *dev; devp = devfs_itod(de->de_inode); if (devp != NULL) dev = *devp; else dev = NULL; - /* If we think this dirent should have a dev_t, alert the user. */ + /* If we think this dirent should have a struct cdev *, alert the user. */ if (dev == NULL && de->de_dirent->d_type != DT_LNK && de->de_dirent->d_type != DT_DIR) - printf("Warning: no dev_t for %s\n", de->de_dirent->d_name); + printf("Warning: no struct cdev *for %s\n", de->de_dirent->d_name); return (dev); } @@ -590,7 +590,7 @@ static int devfs_rule_match(struct devfs_krule *dk, struct devfs_dirent *de) { struct devfs_rule *dr = &dk->dk_rule; - dev_t dev; + struct cdev *dev; dev = devfs_rule_getdev(de); /* @@ -598,7 +598,7 @@ devfs_rule_match(struct devfs_krule *dk, struct devfs_dirent *de) * criteria that depend on it don't match. We should *not* * just ignore them (i.e., act like they weren't specified), * since that makes a rule that only has criteria dependent on - * the dev_t match all symlinks and directories. + * the struct cdev *match all symlinks and directories. * * Note also that the following tests are somewhat reversed: * They're actually testing to see whether the condition does @@ -630,7 +630,7 @@ devfs_rule_matchpath(struct devfs_krule *dk, struct devfs_dirent *de) { struct devfs_rule *dr = &dk->dk_rule; char *pname; - dev_t dev; + struct cdev *dev; dev = devfs_rule_getdev(de); if (dev != NULL) diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index e0f192ffdb8c..cbc836a22d02 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -123,7 +123,7 @@ devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, stru { int error; struct vnode *vp; - dev_t dev; + struct cdev *dev; if (td == NULL) td = curthread; /* XXX */ @@ -213,7 +213,7 @@ devfs_getattr(ap) struct vattr *vap = ap->a_vap; int error = 0; struct devfs_dirent *de; - dev_t dev; + struct cdev *dev; de = vp->v_data; if (vp->v_type == VDIR) @@ -304,7 +304,7 @@ devfs_lookupx(ap) struct devfs_dirent *de, *dd; struct devfs_dirent **dde; struct devfs_mount *dmp; - dev_t cdev; + struct cdev *cdev; int error, flags, nameiop; char specname[SPECNAMELEN + 1], *pname; diff --git a/sys/fs/hpfs/hpfs.h b/sys/fs/hpfs/hpfs.h index 9b4fd1dfef34..c02862b094bd 100644 --- a/sys/fs/hpfs/hpfs.h +++ b/sys/fs/hpfs/hpfs.h @@ -312,7 +312,7 @@ struct hpfsmount { struct spblock hpm_sp; struct mount * hpm_mp; struct vnode * hpm_devvp; - dev_t hpm_dev; + struct cdev *hpm_dev; uid_t hpm_uid; gid_t hpm_gid; mode_t hpm_mode; @@ -341,7 +341,7 @@ struct hpfsnode { struct fnode h_fn; struct vnode * h_vp; struct vnode * h_devvp; - dev_t h_dev; + struct cdev *h_dev; lsn_t h_no; uid_t h_uid; gid_t h_gid; @@ -390,9 +390,9 @@ extern vop_t ** hpfs_vnodeop_p; /* Hash routines, too small to be separate header */ void hpfs_hphashinit(void); void hpfs_hphashdestroy(void); -struct hpfsnode *hpfs_hphashlookup(dev_t, lsn_t); -struct hpfsnode *hpfs_hphashget(dev_t, lsn_t); -int hpfs_hphashvget(dev_t, lsn_t, int, struct vnode **, struct thread *); +struct hpfsnode *hpfs_hphashlookup(struct cdev *, lsn_t); +struct hpfsnode *hpfs_hphashget(struct cdev *, lsn_t); +int hpfs_hphashvget(struct cdev *, lsn_t, int, struct vnode **, struct thread *); void hpfs_hphashins(register struct hpfsnode *); void hpfs_hphashrem(register struct hpfsnode *); extern struct lock hpfs_hphash_lock; diff --git a/sys/fs/hpfs/hpfs_hash.c b/sys/fs/hpfs/hpfs_hash.c index e76eaf70558b..e1cd079ee281 100644 --- a/sys/fs/hpfs/hpfs_hash.c +++ b/sys/fs/hpfs/hpfs_hash.c @@ -82,7 +82,7 @@ hpfs_hphashdestroy(void) */ struct hpfsnode * hpfs_hphashlookup(dev, ino) - dev_t dev; + struct cdev *dev; lsn_t ino; { struct hpfsnode *hp; @@ -99,7 +99,7 @@ hpfs_hphashlookup(dev, ino) #if 0 struct hpfsnode * hpfs_hphashget(dev, ino) - dev_t dev; + struct cdev *dev; lsn_t ino; { struct hpfsnode *hp; @@ -120,7 +120,7 @@ loop: int hpfs_hphashvget(dev, ino, flags, vpp, td) - dev_t dev; + struct cdev *dev; lsn_t ino; int flags; struct vnode **vpp; diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c index 86e8bc64ec13..e9059d4e6413 100644 --- a/sys/fs/hpfs/hpfs_vfsops.c +++ b/sys/fs/hpfs/hpfs_vfsops.c @@ -217,7 +217,7 @@ hpfs_mountfs(devvp, mp, argsp, td) struct hpfsmount *hpmp; struct buf *bp = NULL; struct vnode *vp; - dev_t dev = devvp->v_rdev; + struct cdev *dev = devvp->v_rdev; dprintf(("hpfs_mountfs():\n")); /* diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index ebf13192122b..6fa69bd01e3a 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -94,7 +94,7 @@ union _qcvt { } static struct denode * - msdosfs_hashget(dev_t dev, u_long dirclust, u_long diroff); + msdosfs_hashget(struct cdev *dev, u_long dirclust, u_long diroff); static void msdosfs_hashins(struct denode *dep); static void msdosfs_hashrem(struct denode *dep); @@ -133,7 +133,7 @@ msdosfs_uninit(vfsp) static struct denode * msdosfs_hashget(dev, dirclust, diroff) - dev_t dev; + struct cdev *dev; u_long dirclust; u_long diroff; { @@ -215,7 +215,7 @@ deget(pmp, dirclust, diroffset, depp) struct denode **depp; /* returns the addr of the gotten denode */ { int error; - dev_t dev = pmp->pm_dev; + struct cdev *dev = pmp->pm_dev; struct mount *mntp = pmp->pm_mountp; struct direntry *direntptr; struct denode *ldep; diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index dd4512ab241b..3ac0fb6877c3 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -301,7 +301,7 @@ mountmsdosfs(devvp, mp, td, argp) { struct msdosfsmount *pmp; struct buf *bp; - dev_t dev = devvp->v_rdev; + struct cdev *dev = devvp->v_rdev; union bootsector *bsp; struct byte_bpb33 *b33; struct byte_bpb50 *b50; diff --git a/sys/fs/msdosfs/msdosfsmount.h b/sys/fs/msdosfs/msdosfsmount.h index 2f35ecc4d347..0ff712f63ed0 100644 --- a/sys/fs/msdosfs/msdosfsmount.h +++ b/sys/fs/msdosfs/msdosfsmount.h @@ -62,7 +62,7 @@ MALLOC_DECLARE(M_MSDOSFSMNT); */ struct msdosfsmount { struct mount *pm_mountp;/* vfs mount struct for this fs */ - dev_t pm_dev; /* block special device mounted */ + struct cdev *pm_dev; /* block special device mounted */ uid_t pm_uid; /* uid to set as owner of the files */ gid_t pm_gid; /* gid to set as owner of the files */ mode_t pm_mask; /* mask to and with file protection bits diff --git a/sys/fs/ntfs/ntfs.h b/sys/fs/ntfs/ntfs.h index 6e19029ade46..1940ee9deea0 100644 --- a/sys/fs/ntfs/ntfs.h +++ b/sys/fs/ntfs/ntfs.h @@ -241,7 +241,7 @@ struct bootfile { struct ntfsmount { struct mount *ntm_mountp; /* filesystem vfs structure */ struct bootfile ntm_bootfile; - dev_t ntm_dev; /* device mounted */ + struct cdev *ntm_dev; /* device mounted */ struct vnode *ntm_devvp; /* block device mounted vnode */ struct vnode *ntm_sysvn[NTFS_SYSNODESNUM]; u_int32_t ntm_bpmftrec; diff --git a/sys/fs/ntfs/ntfs_ihash.c b/sys/fs/ntfs/ntfs_ihash.c index e434eafb0fc0..dd9ec2d4f386 100644 --- a/sys/fs/ntfs/ntfs_ihash.c +++ b/sys/fs/ntfs/ntfs_ihash.c @@ -83,7 +83,7 @@ ntfs_nthashdestroy(void) */ struct ntnode * ntfs_nthashlookup(dev, inum) - dev_t dev; + struct cdev *dev; ino_t inum; { struct ntnode *ip; diff --git a/sys/fs/ntfs/ntfs_ihash.h b/sys/fs/ntfs/ntfs_ihash.h index eb3befd39180..7df7495c770a 100644 --- a/sys/fs/ntfs/ntfs_ihash.h +++ b/sys/fs/ntfs/ntfs_ihash.h @@ -31,7 +31,7 @@ extern struct lock ntfs_hashlock; void ntfs_nthashinit(void); void ntfs_nthashdestroy(void); -struct ntnode *ntfs_nthashlookup(dev_t, ino_t); -struct ntnode *ntfs_nthashget(dev_t, ino_t); +struct ntnode *ntfs_nthashlookup(struct cdev *, ino_t); +struct ntnode *ntfs_nthashget(struct cdev *, ino_t); void ntfs_nthashins(struct ntnode *); void ntfs_nthashrem(register struct ntnode *); diff --git a/sys/fs/ntfs/ntfs_inode.h b/sys/fs/ntfs/ntfs_inode.h index 13ed4431da6c..c11cfa1f6317 100644 --- a/sys/fs/ntfs/ntfs_inode.h +++ b/sys/fs/ntfs/ntfs_inode.h @@ -43,7 +43,7 @@ struct ntnode { struct vnode *i_devvp; /* vnode of blk dev we live on */ - dev_t i_dev; /* Device associated with the inode. */ + struct cdev *i_dev; /* Device associated with the inode. */ LIST_ENTRY(ntnode) i_hash; struct ntnode *i_next; diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index a959e8c189e4..924f06f319da 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -273,7 +273,7 @@ ntfs_mountfs(devvp, mp, argsp, td) { struct buf *bp; struct ntfsmount *ntmp; - dev_t dev = devvp->v_rdev; + struct cdev *dev = devvp->v_rdev; int error, ronly, ncount, i; struct vnode *vp; diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c index a90233ee4a7d..7d12a58587a8 100644 --- a/sys/fs/specfs/spec_vnops.c +++ b/sys/fs/specfs/spec_vnops.c @@ -133,7 +133,7 @@ spec_open(ap) { struct thread *td = ap->a_td; struct vnode *vp = ap->a_vp; - dev_t dev = vp->v_rdev; + struct cdev *dev = vp->v_rdev; int error; struct cdevsw *dsw; @@ -247,7 +247,7 @@ spec_read(ap) struct vnode *vp; struct thread *td; struct uio *uio; - dev_t dev; + struct cdev *dev; int error, resid; struct cdevsw *dsw; @@ -263,7 +263,7 @@ spec_read(ap) dsw = devsw(dev); VOP_UNLOCK(vp, 0, td); KASSERT(dev->si_refcount > 0, - ("specread() on un-referenced dev_t (%s)", devtoname(dev))); + ("specread() on un-referenced struct cdev *(%s)", devtoname(dev))); cdevsw_ref(dsw); if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); @@ -294,7 +294,7 @@ spec_write(ap) struct vnode *vp; struct thread *td; struct uio *uio; - dev_t dev; + struct cdev *dev; int error, resid; struct cdevsw *dsw; @@ -307,7 +307,7 @@ spec_write(ap) VOP_UNLOCK(vp, 0, td); KASSERT(dev->si_refcount > 0, - ("spec_write() on un-referenced dev_t (%s)", devtoname(dev))); + ("spec_write() on un-referenced struct cdev *(%s)", devtoname(dev))); cdevsw_ref(dsw); if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); @@ -339,14 +339,14 @@ spec_ioctl(ap) struct thread *a_td; } */ *ap; { - dev_t dev; + struct cdev *dev; int error; struct cdevsw *dsw; dev = ap->a_vp->v_rdev; dsw = devsw(dev); KASSERT(dev->si_refcount > 0, - ("spec_ioctl() on un-referenced dev_t (%s)", devtoname(dev))); + ("spec_ioctl() on un-referenced struct cdev *(%s)", devtoname(dev))); cdevsw_ref(dsw); if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); @@ -372,14 +372,14 @@ spec_poll(ap) struct thread *a_td; } */ *ap; { - dev_t dev; + struct cdev *dev; struct cdevsw *dsw; int error; dev = ap->a_vp->v_rdev; dsw = devsw(dev); KASSERT(dev->si_refcount > 0, - ("spec_poll() on un-referenced dev_t (%s)", devtoname(dev))); + ("spec_poll() on un-referenced struct cdev *(%s)", devtoname(dev))); cdevsw_ref(dsw); if (!(dsw->d_flags & D_NEEDGIANT)) { /* XXX: not yet DROP_GIANT(); */ @@ -399,14 +399,14 @@ spec_kqfilter(ap) struct knote *a_kn; } */ *ap; { - dev_t dev; + struct cdev *dev; struct cdevsw *dsw; int error; dev = ap->a_vp->v_rdev; dsw = devsw(dev); KASSERT(dev->si_refcount > 0, - ("spec_kqfilter() on un-referenced dev_t (%s)", devtoname(dev))); + ("spec_kqfilter() on un-referenced struct cdev *(%s)", devtoname(dev))); cdevsw_ref(dsw); if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); @@ -572,7 +572,7 @@ spec_close(ap) { struct vnode *vp = ap->a_vp, *oldvp; struct thread *td = ap->a_td; - dev_t dev = vp->v_rdev; + struct cdev *dev = vp->v_rdev; struct cdevsw *dsw; int error; @@ -627,7 +627,7 @@ spec_close(ap) } VI_UNLOCK(vp); KASSERT(dev->si_refcount > 0, - ("spec_close() on un-referenced dev_t (%s)", devtoname(dev))); + ("spec_close() on un-referenced struct cdev *(%s)", devtoname(dev))); cdevsw_ref(dsw); if (!(dsw->d_flags & D_NEEDGIANT)) { DROP_GIANT(); diff --git a/sys/fs/udf/udf.h b/sys/fs/udf/udf.h index 540a3a678057..449c9117ffa1 100644 --- a/sys/fs/udf/udf.h +++ b/sys/fs/udf/udf.h @@ -33,7 +33,7 @@ struct udf_node { struct vnode *i_vnode; struct vnode *i_devvp; struct udf_mnt *udfmp; - dev_t i_dev; + struct cdev *i_dev; ino_t hash_id; long diroff; struct file_entry *fentry; @@ -42,7 +42,7 @@ struct udf_node { struct udf_mnt { int im_flags; struct mount *im_mountp; - dev_t im_dev; + struct cdev *im_dev; struct vnode *im_devvp; int bsize; int bshift; diff --git a/sys/geom/gate/g_gate.c b/sys/geom/gate/g_gate.c index ce084d6aaf81..aae2d0eae83f 100644 --- a/sys/geom/gate/g_gate.c +++ b/sys/geom/gate/g_gate.c @@ -63,7 +63,7 @@ struct g_class g_gate_class = { .destroy_geom = g_gate_destroy_geom }; -static dev_t status_dev; +static struct cdev *status_dev; static d_ioctl_t g_gate_ioctl; static struct cdevsw g_gate_cdevsw = { .d_version = D_VERSION, @@ -437,7 +437,7 @@ g_gate_create(struct g_gate_ctl_create *ggio) return (EINVAL); \ } while (0) static int -g_gate_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) +g_gate_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { struct g_gate_softc *sc; struct bio *bp; diff --git a/sys/geom/geom.h b/sys/geom/geom.h index 31002fe33481..07189bdbe578 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -182,8 +182,9 @@ struct g_provider { }; /* geom_dev.c */ +struct cdev; void g_dev_print(void); -struct g_provider *g_dev_getprovider(dev_t dev); +struct g_provider *g_dev_getprovider(struct cdev *dev); /* geom_dump.c */ void g_trace(int level, const char *, ...); diff --git a/sys/geom/geom_ctl.c b/sys/geom/geom_ctl.c index 3e50eb350889..ce000f3168da 100644 --- a/sys/geom/geom_ctl.c +++ b/sys/geom/geom_ctl.c @@ -444,7 +444,7 @@ g_ctl_req(void *arg, int flag __unused) static int -g_ctl_ioctl_ctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td) +g_ctl_ioctl_ctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { struct gctl_req *req; @@ -479,7 +479,7 @@ g_ctl_ioctl_ctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *t } static int -g_ctl_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td) +g_ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { int error; diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c index 9ad3f70b0f0e..54f585e03aa1 100644 --- a/sys/geom/geom_dev.c +++ b/sys/geom/geom_dev.c @@ -99,7 +99,7 @@ g_dev_print(void) * XXX: eliminating the need for this hack. */ static void -g_dev_clone(void *arg __unused, char *name, int namelen __unused, dev_t *dev) +g_dev_clone(void *arg __unused, char *name, int namelen __unused, struct cdev **dev) { struct g_geom *gp; @@ -135,7 +135,7 @@ g_dev_register_cloner(void *foo __unused) SYSINIT(geomdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE,g_dev_register_cloner,NULL); struct g_provider * -g_dev_getprovider(dev_t dev) +g_dev_getprovider(struct cdev *dev) { struct g_consumer *cp; @@ -155,7 +155,7 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused) struct g_consumer *cp; static int unit = GEOM_MINOR_PROVIDERS; int error; - dev_t dev; + struct cdev *dev; g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name); g_topology_assert(); @@ -190,7 +190,7 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused) } static int -g_dev_open(dev_t dev, int flags, int fmt, struct thread *td) +g_dev_open(struct cdev *dev, int flags, int fmt, struct thread *td) { struct g_geom *gp; struct g_consumer *cp; @@ -223,7 +223,7 @@ g_dev_open(dev_t dev, int flags, int fmt, struct thread *td) } static int -g_dev_close(dev_t dev, int flags, int fmt, struct thread *td) +g_dev_close(struct cdev *dev, int flags, int fmt, struct thread *td) { struct g_geom *gp; struct g_consumer *cp; @@ -273,7 +273,7 @@ g_dev_close(dev_t dev, int flags, int fmt, struct thread *td) * XXX: will break (actually: stall) the BSD disklabel hacks. */ static int -g_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td) +g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { struct g_geom *gp; struct g_consumer *cp; @@ -365,7 +365,7 @@ g_dev_strategy(struct bio *bp) { struct g_consumer *cp; struct bio *bp2; - dev_t dev; + struct cdev *dev; KASSERT(bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE || @@ -404,7 +404,7 @@ g_dev_strategy(struct bio *bp) * * Called from below when the provider orphaned us. * - Clear any dump settings. - * - Destroy the dev_t to prevent any more request from coming in. The + * - Destroy the struct cdev *to prevent any more request from coming in. The * provider is already marked with an error, so anything which comes in * in the interrim will be returned immediately. * - Wait for any outstanding I/O to finish. @@ -416,7 +416,7 @@ static void g_dev_orphan(struct g_consumer *cp) { struct g_geom *gp; - dev_t dev; + struct cdev *dev; g_topology_assert(); gp = cp->geom; @@ -427,7 +427,7 @@ g_dev_orphan(struct g_consumer *cp) if (dev->si_flags & SI_DUMPDEV) set_dumper(NULL); - /* Destroy the dev_t so we get no more requests */ + /* Destroy the struct cdev *so we get no more requests */ destroy_dev(dev); /* Wait for the cows to come home */ diff --git a/sys/gnu/ext2fs/ext2_extern.h b/sys/gnu/ext2fs/ext2_extern.h index 12ec52476840..45ba6b32c76c 100644 --- a/sys/gnu/ext2fs/ext2_extern.h +++ b/sys/gnu/ext2fs/ext2_extern.h @@ -59,11 +59,11 @@ void ext2_dirbad(struct inode *ip, doff_t offset, char *how); void ext2_ei2i(struct ext2_inode *, struct inode *); int ext2_getlbns(struct vnode *, int32_t, struct indir *, int *); void ext2_i2ei(struct inode *, struct ext2_inode *); -int ext2_ihashget(dev_t, ino_t, int, struct vnode **); +int ext2_ihashget(struct cdev *, ino_t, int, struct vnode **); void ext2_ihashinit(void); void ext2_ihashins(struct inode *); struct vnode * - ext2_ihashlookup(dev_t, ino_t); + ext2_ihashlookup(struct cdev *, ino_t); void ext2_ihashrem(struct inode *); void ext2_ihashuninit(void); void ext2_itimes(struct vnode *vp); diff --git a/sys/gnu/ext2fs/ext2_ihash.c b/sys/gnu/ext2fs/ext2_ihash.c index 09da05697f30..fca9a0d84830 100644 --- a/sys/gnu/ext2fs/ext2_ihash.c +++ b/sys/gnu/ext2fs/ext2_ihash.c @@ -80,7 +80,7 @@ ext2_ihashuninit() */ struct vnode * ext2_ihashlookup(dev, inum) - dev_t dev; + struct cdev *dev; ino_t inum; { struct inode *ip; @@ -102,7 +102,7 @@ ext2_ihashlookup(dev, inum) */ int ext2_ihashget(dev, inum, flags, vpp) - dev_t dev; + struct cdev *dev; ino_t inum; int flags; struct vnode **vpp; diff --git a/sys/gnu/ext2fs/ext2_mount.h b/sys/gnu/ext2fs/ext2_mount.h index e1ca44d3056f..407ca8a3c257 100644 --- a/sys/gnu/ext2fs/ext2_mount.h +++ b/sys/gnu/ext2fs/ext2_mount.h @@ -44,7 +44,7 @@ struct vnode; /* This structure describes the ext2fs specific mount structure data. */ struct ext2mount { struct mount *um_mountp; /* filesystem vfs structure */ - dev_t um_dev; /* device mounted */ + struct cdev *um_dev; /* device mounted */ struct vnode *um_devvp; /* block device mounted vnode */ struct ext2_sb_info *um_e2fs; /* EXT2FS */ diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c index c91eaacd2f05..a745e6a7bc38 100644 --- a/sys/gnu/ext2fs/ext2_vfsops.c +++ b/sys/gnu/ext2fs/ext2_vfsops.c @@ -97,7 +97,7 @@ VFS_SET(ext2fs_vfsops, ext2fs, 0); static int ext2fs_inode_hash_lock; -static int ext2_check_sb_compat(struct ext2_super_block *es, dev_t dev, +static int ext2_check_sb_compat(struct ext2_super_block *es, struct cdev *dev, int ronly); static int compute_sb_data(struct vnode * devvp, struct ext2_super_block * es, struct ext2_sb_info * fs); @@ -378,7 +378,7 @@ static int ext2_check_descriptors (struct ext2_sb_info * sb) static int ext2_check_sb_compat(es, dev, ronly) struct ext2_super_block *es; - dev_t dev; + struct cdev *dev; int ronly; { @@ -635,7 +635,7 @@ ext2_mountfs(devvp, mp, td) struct buf *bp; struct ext2_sb_info *fs; struct ext2_super_block * es; - dev_t dev = devvp->v_rdev; + struct cdev *dev = devvp->v_rdev; int error; int ronly; @@ -1000,7 +1000,7 @@ ext2_vget(mp, ino, flags, vpp) struct ext2mount *ump; struct buf *bp; struct vnode *vp; - dev_t dev; + struct cdev *dev; int i, error; int used_blocks; diff --git a/sys/gnu/ext2fs/inode.h b/sys/gnu/ext2fs/inode.h index b0f1625cd4d1..cf5288a5a99f 100644 --- a/sys/gnu/ext2fs/inode.h +++ b/sys/gnu/ext2fs/inode.h @@ -65,7 +65,7 @@ struct inode { struct vnode *i_vnode;/* Vnode associated with this inode. */ struct vnode *i_devvp;/* Vnode for block I/O. */ u_int32_t i_flag; /* flags, see below */ - dev_t i_dev; /* Device associated with the inode. */ + struct cdev *i_dev; /* Device associated with the inode. */ ino_t i_number; /* The identity of the inode. */ struct ext2_sb_info *i_e2fs; /* EXT2FS */ @@ -110,7 +110,7 @@ struct inode { * The di_db fields may be overlaid with other information for * file types that do not have associated disk storage. Block * and character devices overlay the first data block with their - * dev_t value. Short symbolic links place their path in the + * struct cdev *value. Short symbolic links place their path in the * di_db area. */ #define i_shortlink i_db diff --git a/sys/gnu/fs/ext2fs/ext2_extern.h b/sys/gnu/fs/ext2fs/ext2_extern.h index 12ec52476840..45ba6b32c76c 100644 --- a/sys/gnu/fs/ext2fs/ext2_extern.h +++ b/sys/gnu/fs/ext2fs/ext2_extern.h @@ -59,11 +59,11 @@ void ext2_dirbad(struct inode *ip, doff_t offset, char *how); void ext2_ei2i(struct ext2_inode *, struct inode *); int ext2_getlbns(struct vnode *, int32_t, struct indir *, int *); void ext2_i2ei(struct inode *, struct ext2_inode *); -int ext2_ihashget(dev_t, ino_t, int, struct vnode **); +int ext2_ihashget(struct cdev *, ino_t, int, struct vnode **); void ext2_ihashinit(void); void ext2_ihashins(struct inode *); struct vnode * - ext2_ihashlookup(dev_t, ino_t); + ext2_ihashlookup(struct cdev *, ino_t); void ext2_ihashrem(struct inode *); void ext2_ihashuninit(void); void ext2_itimes(struct vnode *vp); diff --git a/sys/gnu/fs/ext2fs/ext2_mount.h b/sys/gnu/fs/ext2fs/ext2_mount.h index e1ca44d3056f..407ca8a3c257 100644 --- a/sys/gnu/fs/ext2fs/ext2_mount.h +++ b/sys/gnu/fs/ext2fs/ext2_mount.h @@ -44,7 +44,7 @@ struct vnode; /* This structure describes the ext2fs specific mount structure data. */ struct ext2mount { struct mount *um_mountp; /* filesystem vfs structure */ - dev_t um_dev; /* device mounted */ + struct cdev *um_dev; /* device mounted */ struct vnode *um_devvp; /* block device mounted vnode */ struct ext2_sb_info *um_e2fs; /* EXT2FS */ diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index c91eaacd2f05..a745e6a7bc38 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -97,7 +97,7 @@ VFS_SET(ext2fs_vfsops, ext2fs, 0); static int ext2fs_inode_hash_lock; -static int ext2_check_sb_compat(struct ext2_super_block *es, dev_t dev, +static int ext2_check_sb_compat(struct ext2_super_block *es, struct cdev *dev, int ronly); static int compute_sb_data(struct vnode * devvp, struct ext2_super_block * es, struct ext2_sb_info * fs); @@ -378,7 +378,7 @@ static int ext2_check_descriptors (struct ext2_sb_info * sb) static int ext2_check_sb_compat(es, dev, ronly) struct ext2_super_block *es; - dev_t dev; + struct cdev *dev; int ronly; { @@ -635,7 +635,7 @@ ext2_mountfs(devvp, mp, td) struct buf *bp; struct ext2_sb_info *fs; struct ext2_super_block * es; - dev_t dev = devvp->v_rdev; + struct cdev *dev = devvp->v_rdev; int error; int ronly; @@ -1000,7 +1000,7 @@ ext2_vget(mp, ino, flags, vpp) struct ext2mount *ump; struct buf *bp; struct vnode *vp; - dev_t dev; + struct cdev *dev; int i, error; int used_blocks; diff --git a/sys/gnu/fs/ext2fs/inode.h b/sys/gnu/fs/ext2fs/inode.h index b0f1625cd4d1..cf5288a5a99f 100644 --- a/sys/gnu/fs/ext2fs/inode.h +++ b/sys/gnu/fs/ext2fs/inode.h @@ -65,7 +65,7 @@ struct inode { struct vnode *i_vnode;/* Vnode associated with this inode. */ struct vnode *i_devvp;/* Vnode for block I/O. */ u_int32_t i_flag; /* flags, see below */ - dev_t i_dev; /* Device associated with the inode. */ + struct cdev *i_dev; /* Device associated with the inode. */ ino_t i_number; /* The identity of the inode. */ struct ext2_sb_info *i_e2fs; /* EXT2FS */ @@ -110,7 +110,7 @@ struct inode { * The di_db fields may be overlaid with other information for * file types that do not have associated disk storage. Block * and character devices overlay the first data block with their - * dev_t value. Short symbolic links place their path in the + * struct cdev *value. Short symbolic links place their path in the * di_db area. */ #define i_shortlink i_db diff --git a/sys/i386/acpica/acpi_asus.c b/sys/i386/acpica/acpi_asus.c index f16121b5c1db..10d97e48edd4 100644 --- a/sys/i386/acpica/acpi_asus.c +++ b/sys/i386/acpica/acpi_asus.c @@ -83,9 +83,9 @@ struct acpi_asus_softc { struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; - dev_t s_mled; - dev_t s_tled; - dev_t s_wled; + struct cdev *s_mled; + struct cdev *s_tled; + struct cdev *s_wled; int s_brn; int s_disp; diff --git a/sys/i386/acpica/acpi_machdep.c b/sys/i386/acpica/acpi_machdep.c index 79ba3cf08080..e0ad71ec7540 100644 --- a/sys/i386/acpica/acpi_machdep.c +++ b/sys/i386/acpica/acpi_machdep.c @@ -192,19 +192,19 @@ acpi_capm_get_pwstatus(apm_pwstatus_t app) } static int -apmopen(dev_t dev, int flag, int fmt, d_thread_t *td) +apmopen(struct cdev *dev, int flag, int fmt, d_thread_t *td) { return (0); } static int -apmclose(dev_t dev, int flag, int fmt, d_thread_t *td) +apmclose(struct cdev *dev, int flag, int fmt, d_thread_t *td) { return (0); } static int -apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td) +apmioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td) { int error = 0; struct acpi_softc *acpi_sc; @@ -281,13 +281,13 @@ apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td) } static int -apmwrite(dev_t dev, struct uio *uio, int ioflag) +apmwrite(struct cdev *dev, struct uio *uio, int ioflag) { return (uio->uio_resid); } static int -apmpoll(dev_t dev, int events, d_thread_t *td) +apmpoll(struct cdev *dev, int events, d_thread_t *td) { return (0); } diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index 4f3adca4da2b..768bd06fa0e7 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -1229,7 +1229,7 @@ apm_attach(device_t dev) } static int -apmopen(dev_t dev, int flag, int fmt, struct thread *td) +apmopen(struct cdev *dev, int flag, int fmt, struct thread *td) { struct apm_softc *sc = &apm_softc; int ctl = APMDEV(dev); @@ -1257,7 +1257,7 @@ apmopen(dev_t dev, int flag, int fmt, struct thread *td) } static int -apmclose(dev_t dev, int flag, int fmt, struct thread *td) +apmclose(struct cdev *dev, int flag, int fmt, struct thread *td) { struct apm_softc *sc = &apm_softc; int ctl = APMDEV(dev); @@ -1280,7 +1280,7 @@ apmclose(dev_t dev, int flag, int fmt, struct thread *td) } static int -apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +apmioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct apm_softc *sc = &apm_softc; struct apm_bios_arg *args; @@ -1434,7 +1434,7 @@ apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) } static int -apmwrite(dev_t dev, struct uio *uio, int ioflag) +apmwrite(struct cdev *dev, struct uio *uio, int ioflag) { struct apm_softc *sc = &apm_softc; u_int event_type; @@ -1464,7 +1464,7 @@ apmwrite(dev_t dev, struct uio *uio, int ioflag) } static int -apmpoll(dev_t dev, int events, struct thread *td) +apmpoll(struct cdev *dev, int events, struct thread *td) { struct apm_softc *sc = &apm_softc; int revents = 0; diff --git a/sys/i386/bios/smapi.c b/sys/i386/bios/smapi.c index 883676cc3a6e..9879c90334de 100644 --- a/sys/i386/bios/smapi.c +++ b/sys/i386/bios/smapi.c @@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$"); #define ADDR2HDR(addr) ((struct smapi_bios_header *)BIOS_PADDRTOVADDR(addr)) struct smapi_softc { - dev_t cdev; + struct cdev *cdev; device_t dev; struct resource * res; int rid; @@ -98,7 +98,7 @@ extern int smapi32_new (u_long, u_short, static int smapi_ioctl (dev, cmd, data, fflag, td) - dev_t dev; + struct cdev *dev; u_long cmd; caddr_t data; int fflag; diff --git a/sys/i386/i386/elan-mmcr.c b/sys/i386/i386/elan-mmcr.c index 70670eb1e327..2bda626d7f65 100644 --- a/sys/i386/i386/elan-mmcr.c +++ b/sys/i386/i386/elan-mmcr.c @@ -78,7 +78,7 @@ static u_int echo_a, echo_d; #endif /* CPU_ELAN_PPS */ static u_int led_cookie[32]; -static dev_t led_dev[32]; +static struct cdev *led_dev[32]; static void gpio_led(void *cookie, int state) @@ -405,7 +405,7 @@ elan_watchdog(void *foo __unused, u_int spec, int *error) } static int -elan_mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +elan_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) { if (offset >= 0x1000) @@ -414,7 +414,7 @@ elan_mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) return (0); } static int -elan_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *tdr) +elan_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *tdr) { int error; diff --git a/sys/i386/i386/geode.c b/sys/i386/i386/geode.c index 6896686d2a37..2702f21eb25a 100644 --- a/sys/i386/i386/geode.c +++ b/sys/i386/i386/geode.c @@ -43,7 +43,7 @@ static unsigned cba; static unsigned gpio; static unsigned geode_counter; -static dev_t led1, led2, led3; +static struct cdev *led1, *led2, *led3; static int led1b, led2b, led3b; static void diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 3a41bbedfb1b..d1eb5c091fab 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -1215,9 +1215,9 @@ SYSCTL_STRUCT(_machdep, CPU_BOOTINFO, bootinfo, SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock, CTLFLAG_RW, &wall_cmos_clock, 0, ""); -u_long bootdev; /* not a dev_t - encoding is different */ +u_long bootdev; /* not a struct cdev *- encoding is different */ SYSCTL_ULONG(_machdep, OID_AUTO, guessed_bootdev, - CTLFLAG_RD, &bootdev, 0, "Maybe the Boot device (not in dev_t format)"); + CTLFLAG_RD, &bootdev, 0, "Maybe the Boot device (not in struct cdev *format)"); /* * Initialize 386 and configure to run kernel diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index f296d6860384..379b59c88919 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -67,7 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include -static dev_t memdev, kmemdev, iodev; +static struct cdev *memdev, *kmemdev, *iodev; static d_open_t mmopen; static d_close_t mmclose; @@ -94,7 +94,7 @@ MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); struct mem_range_softc mem_range_softc; static int -mmclose(dev_t dev, int flags, int fmt, struct thread *td) +mmclose(struct cdev *dev, int flags, int fmt, struct thread *td) { switch (minor(dev)) { case 14: @@ -104,7 +104,7 @@ mmclose(dev_t dev, int flags, int fmt, struct thread *td) } static int -mmopen(dev_t dev, int flags, int fmt, struct thread *td) +mmopen(struct cdev *dev, int flags, int fmt, struct thread *td) { int error; @@ -132,7 +132,7 @@ mmopen(dev_t dev, int flags, int fmt, struct thread *td) /*ARGSUSED*/ static int -mmrw(dev_t dev, struct uio *uio, int flags) +mmrw(struct cdev *dev, struct uio *uio, int flags) { int o; u_int c = 0, v; @@ -209,7 +209,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) * instead of going through read/write * \*******************************************************/ static int -memmmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) { switch (minor(dev)) { @@ -237,7 +237,7 @@ memmmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) * and mem_range_attr_set. */ static int -mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) +mmioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { int nd, error = 0; struct mem_range_op *mo = (struct mem_range_op *)data; diff --git a/sys/i386/i386/perfmon.c b/sys/i386/i386/perfmon.c index eaccb5a6ba1b..d085261547c2 100644 --- a/sys/i386/i386/perfmon.c +++ b/sys/i386/i386/perfmon.c @@ -299,7 +299,7 @@ static int writer; static int writerpmc; static int -perfmon_open(dev_t dev, int flags, int fmt, struct thread *td) +perfmon_open(struct cdev *dev, int flags, int fmt, struct thread *td) { if (!perfmon_cpuok) return ENXIO; @@ -316,7 +316,7 @@ perfmon_open(dev_t dev, int flags, int fmt, struct thread *td) } static int -perfmon_close(dev_t dev, int flags, int fmt, struct thread *td) +perfmon_close(struct cdev *dev, int flags, int fmt, struct thread *td) { if (flags & FWRITE) { int i; @@ -331,7 +331,7 @@ perfmon_close(dev_t dev, int flags, int fmt, struct thread *td) } static int -perfmon_ioctl(dev_t dev, u_long cmd, caddr_t param, int flags, struct thread *td) +perfmon_ioctl(struct cdev *dev, u_long cmd, caddr_t param, int flags, struct thread *td) { struct pmc *pmc; struct pmc_data *pmcd; diff --git a/sys/i386/include/cpu.h b/sys/i386/include/cpu.h index ad5665b27b7d..0702b06d3c86 100644 --- a/sys/i386/include/cpu.h +++ b/sys/i386/include/cpu.h @@ -65,7 +65,7 @@ /* * CTL_MACHDEP definitions. */ -#define CPU_CONSDEV 1 /* dev_t: console terminal device */ +#define CPU_CONSDEV 1 /* struct cdev *: console terminal device */ #define CPU_ADJKERNTZ 2 /* int: timezone offset (seconds) */ #define CPU_DISRTCSET 3 /* int: disable resettodr() call */ #define CPU_BOOTINFO 4 /* struct: bootinfo */ diff --git a/sys/i386/isa/mse.c b/sys/i386/isa/mse.c index ddc0742db232..31c85f89f108 100644 --- a/sys/i386/isa/mse.c +++ b/sys/i386/isa/mse.c @@ -96,8 +96,8 @@ typedef struct mse_softc { u_char sc_bytes[MOUSE_SYS_PACKETSIZE]; struct callout_handle sc_callout; int sc_watchdog; - dev_t sc_dev; - dev_t sc_ndev; + struct cdev *sc_dev; + struct cdev *sc_ndev; mousehw_t hw; mousemode_t mode; mousestatus_t status; @@ -386,7 +386,7 @@ mse_detach(dev) */ static int mseopen(dev, flags, fmt, td) - dev_t dev; + struct cdev *dev; int flags; int fmt; struct thread *td; @@ -426,7 +426,7 @@ mseopen(dev, flags, fmt, td) */ static int mseclose(dev, flags, fmt, td) - dev_t dev; + struct cdev *dev; int flags; int fmt; struct thread *td; @@ -450,7 +450,7 @@ mseclose(dev, flags, fmt, td) */ static int mseread(dev, uio, ioflag) - dev_t dev; + struct cdev *dev; struct uio *uio; int ioflag; { @@ -517,7 +517,7 @@ mseread(dev, uio, ioflag) */ static int mseioctl(dev, cmd, addr, flag, td) - dev_t dev; + struct cdev *dev; u_long cmd; caddr_t addr; int flag; @@ -634,7 +634,7 @@ mseioctl(dev, cmd, addr, flag, td) */ static int msepoll(dev, events, td) - dev_t dev; + struct cdev *dev; int events; struct thread *td; { @@ -667,10 +667,10 @@ static void msetimeout(arg) void *arg; { - dev_t dev; + struct cdev *dev; mse_softc_t *sc; - dev = (dev_t)arg; + dev = (struct cdev *)arg; sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); if (sc->sc_watchdog) { if (bootverbose) diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c index 39c7b837ebdc..ac387332654d 100644 --- a/sys/i386/isa/pcvt/pcvt_drv.c +++ b/sys/i386/isa/pcvt/pcvt_drv.c @@ -271,7 +271,7 @@ pcvt_attach(device_t dev) * driver open *---------------------------------------------------------------------------*/ static int -pcvt_open(dev_t dev, int flag, int mode, struct thread *td) +pcvt_open(struct cdev *dev, int flag, int mode, struct thread *td) { register struct tty *tp; register struct video_state *vsx; @@ -339,7 +339,7 @@ pcvt_open(dev_t dev, int flag, int mode, struct thread *td) * driver close *---------------------------------------------------------------------------*/ static int -pcvt_close(dev_t dev, int flag, int mode, struct thread *td) +pcvt_close(struct cdev *dev, int flag, int mode, struct thread *td) { register struct tty *tp; register struct video_state *vsx; @@ -369,7 +369,7 @@ pcvt_close(dev_t dev, int flag, int mode, struct thread *td) * driver ioctl *---------------------------------------------------------------------------*/ static int -pcvt_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +pcvt_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { register int error; register struct tty *tp; @@ -404,7 +404,7 @@ pcvt_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) * driver mmap *---------------------------------------------------------------------------*/ static int -pcvt_mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +pcvt_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) { if (offset > 0x20000 - PAGE_SIZE) return -1; diff --git a/sys/i386/isa/pcvt/pcvt_ext.c b/sys/i386/isa/pcvt/pcvt_ext.c index 639c50cdf9bb..035c2af37a15 100644 --- a/sys/i386/isa/pcvt/pcvt_ext.c +++ b/sys/i386/isa/pcvt/pcvt_ext.c @@ -2393,7 +2393,7 @@ vgapage(int new_screen) * ioctl handling for VT_USL mode *---------------------------------------------------------------------------*/ int -usl_vt_ioctl(dev_t dev, int cmd, caddr_t data, int flag, struct thread *td) +usl_vt_ioctl(struct cdev *dev, int cmd, caddr_t data, int flag, struct thread *td) { struct proc *p; int i, j, error, opri; diff --git a/sys/i386/isa/pcvt/pcvt_hdr.h b/sys/i386/isa/pcvt/pcvt_hdr.h index 44b65a4f0eec..a100de78799c 100644 --- a/sys/i386/isa/pcvt/pcvt_hdr.h +++ b/sys/i386/isa/pcvt/pcvt_hdr.h @@ -948,7 +948,7 @@ void get_usl_keymap( keymap_t *map ); void init_sfkl ( struct video_state *svsp ); void init_ufkl ( struct video_state *svsp ); -int kbdioctl ( dev_t dev, int cmd, caddr_t data, int flag ); +int kbdioctl ( struct cdev *dev, int cmd, caddr_t data, int flag ); void kbd_code_init ( void ); void kbd_code_init1 ( void ); @@ -1001,14 +1001,14 @@ void update_hp ( struct video_state *svsp ); void update_led ( void ); #ifdef XSERVER -int usl_vt_ioctl (dev_t dev, int cmd, caddr_t data, int flag, struct thread *); +int usl_vt_ioctl (struct cdev *dev, int cmd, caddr_t data, int flag, struct thread *); #endif void vga10_vga10 ( u_char *invga, u_char *outvga ); void vga10_vga14 ( u_char *invga, u_char *outvga ); void vga10_vga16 ( u_char *invga, u_char *outvga ); void vga10_vga8 ( u_char *invga, u_char *outvga ); -int vgaioctl ( dev_t dev, int cmd, caddr_t data, int flag ); +int vgaioctl ( struct cdev *dev, int cmd, caddr_t data, int flag ); #ifdef XSERVER int vgapage ( int n ); diff --git a/sys/i386/isa/pcvt/pcvt_kbd.c b/sys/i386/isa/pcvt/pcvt_kbd.c index d3f060a42085..343f38508e27 100644 --- a/sys/i386/isa/pcvt/pcvt_kbd.c +++ b/sys/i386/isa/pcvt/pcvt_kbd.c @@ -1199,7 +1199,7 @@ setkeydef(Ovl_tbl *data) * keyboard ioctl's entry *---------------------------------------------------------------------------*/ int -kbdioctl(dev_t dev, int cmd, caddr_t data, int flag) +kbdioctl(struct cdev *dev, int cmd, caddr_t data, int flag) { int key; diff --git a/sys/i386/isa/pcvt/pcvt_sup.c b/sys/i386/isa/pcvt/pcvt_sup.c index 49fe2892adf3..16d5f603c28c 100644 --- a/sys/i386/isa/pcvt/pcvt_sup.c +++ b/sys/i386/isa/pcvt/pcvt_sup.c @@ -58,13 +58,13 @@ static void vid_cursor ( struct cursorshape *data ); static void vgasetfontattr ( struct vgafontattr *data ); static void vgagetfontattr ( struct vgafontattr *data ); static void vgaloadchar ( struct vgaloadchar *data ); -static void vid_getscreen ( struct screeninfo *data, dev_t dev ); -static void vid_setscreen ( struct screeninfo *data, dev_t dev ); +static void vid_getscreen ( struct screeninfo *data, struct cdev *dev ); +static void vid_setscreen ( struct screeninfo *data, struct cdev *dev ); static void setchargen ( void ); static void setchargen3 ( void ); static void resetchargen ( void ); -static void vgareadpel ( struct vgapel *data, dev_t dev ); -static void vgawritepel ( struct vgapel *data, dev_t dev ); +static void vgareadpel ( struct vgapel *data, struct cdev *dev ); +static void vgawritepel ( struct vgapel *data, struct cdev *dev ); static void vgapcvtid ( struct pcvtid *data ); static void vgapcvtinfo ( struct pcvtinfo *data ); @@ -102,7 +102,7 @@ static u_short getrand ( void ); * execute vga ioctls *---------------------------------------------------------------------------*/ int -vgaioctl(dev_t dev, int cmd, caddr_t data, int flag) +vgaioctl(struct cdev *dev, int cmd, caddr_t data, int flag) { if(minor(dev) >= PCVT_NSCREENS) return -1; @@ -553,7 +553,7 @@ vgaloadchar(struct vgaloadchar *data) * video ioctl - get screen information *---------------------------------------------------------------------------*/ static void -vid_getscreen(struct screeninfo *data, dev_t dev) +vid_getscreen(struct screeninfo *data, struct cdev *dev) { int device = minor(dev); data->adaptor_type = adaptor_type; /* video adapter installed */ @@ -576,7 +576,7 @@ vid_getscreen(struct screeninfo *data, dev_t dev) * video ioctl - set screen information *---------------------------------------------------------------------------*/ static void -vid_setscreen(struct screeninfo *data, dev_t dev) +vid_setscreen(struct screeninfo *data, struct cdev *dev) { int screen; @@ -770,7 +770,7 @@ reallocate_scrollbuffer(struct video_state *svsp, int pages) * VGA ioctl - read DAC palette entry *---------------------------------------------------------------------------*/ static void -vgareadpel(struct vgapel *data, dev_t dev) +vgareadpel(struct vgapel *data, struct cdev *dev) { register unsigned vpage = minor(dev); register unsigned idx = data->idx; @@ -788,7 +788,7 @@ vgareadpel(struct vgapel *data, dev_t dev) * VGA ioctl - write DAC palette entry *---------------------------------------------------------------------------*/ static void -vgawritepel(struct vgapel *data, dev_t dev) +vgawritepel(struct vgapel *data, struct cdev *dev) { register unsigned vpage = minor(dev); register unsigned idx = data->idx; diff --git a/sys/i386/isa/spic.c b/sys/i386/isa/spic.c index 3b0a4199c1e2..1ded09c429be 100644 --- a/sys/i386/isa/spic.c +++ b/sys/i386/isa/spic.c @@ -443,7 +443,7 @@ spictimeout(void *arg) } static int -spicopen(dev_t dev, int flag, int fmt, struct thread *td) +spicopen(struct cdev *dev, int flag, int fmt, struct thread *td) { struct spic_softc *sc; @@ -461,7 +461,7 @@ spicopen(dev_t dev, int flag, int fmt, struct thread *td) } static int -spicclose(dev_t dev, int flag, int fmt, struct thread *td) +spicclose(struct cdev *dev, int flag, int fmt, struct thread *td) { struct spic_softc *sc; @@ -474,7 +474,7 @@ spicclose(dev_t dev, int flag, int fmt, struct thread *td) } static int -spicread(dev_t dev, struct uio *uio, int flag) +spicread(struct cdev *dev, struct uio *uio, int flag) { struct spic_softc *sc; int l, s, error; @@ -508,7 +508,7 @@ spicread(dev_t dev, struct uio *uio, int flag) } static int -spicioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +spicioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct spic_softc *sc; @@ -518,7 +518,7 @@ spicioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) } static int -spicpoll(dev_t dev, int events, struct thread *td) +spicpoll(struct cdev *dev, int events, struct thread *td) { struct spic_softc *sc; int revents = 0, s; diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c index e73ab8d73324..2dc74e37682b 100644 --- a/sys/i386/isa/spkr.c +++ b/sys/i386/isa/spkr.c @@ -472,7 +472,7 @@ static char *spkr_inbuf; /* incoming buf */ static int spkropen(dev, flags, fmt, td) - dev_t dev; + struct cdev *dev; int flags; int fmt; struct thread *td; @@ -499,7 +499,7 @@ spkropen(dev, flags, fmt, td) static int spkrwrite(dev, uio, ioflag) - dev_t dev; + struct cdev *dev; struct uio *uio; int ioflag; { @@ -531,7 +531,7 @@ spkrwrite(dev, uio, ioflag) static int spkrclose(dev, flags, fmt, td) - dev_t dev; + struct cdev *dev; int flags; int fmt; struct thread *td; @@ -554,7 +554,7 @@ spkrclose(dev, flags, fmt, td) static int spkrioctl(dev, cmd, cmdarg, flags, td) - dev_t dev; + struct cdev *dev; unsigned long cmd; caddr_t cmdarg; int flags; @@ -610,7 +610,7 @@ static struct isa_pnp_id speaker_ids[] = { { 0 } }; -static dev_t speaker_dev; +static struct cdev *speaker_dev; static int speaker_probe(device_t dev) diff --git a/sys/i4b/driver/i4b_ctl.c b/sys/i4b/driver/i4b_ctl.c index 630c064f537a..4ba3e0582eac 100644 --- a/sys/i4b/driver/i4b_ctl.c +++ b/sys/i4b/driver/i4b_ctl.c @@ -84,7 +84,7 @@ i4bctlattach(void *dummy) * i4bctlopen - device driver open routine *---------------------------------------------------------------------------*/ static int -i4bctlopen(dev_t dev, int flag, int fmt, struct thread *td) +i4bctlopen(struct cdev *dev, int flag, int fmt, struct thread *td) { if(minor(dev)) return (ENXIO); @@ -101,7 +101,7 @@ i4bctlopen(dev_t dev, int flag, int fmt, struct thread *td) * i4bctlclose - device driver close routine *---------------------------------------------------------------------------*/ static int -i4bctlclose(dev_t dev, int flag, int fmt, struct thread *td) +i4bctlclose(struct cdev *dev, int flag, int fmt, struct thread *td) { openflag = 0; return (0); @@ -111,7 +111,7 @@ i4bctlclose(dev_t dev, int flag, int fmt, struct thread *td) * i4bctlioctl - device driver ioctl routine *---------------------------------------------------------------------------*/ static int -i4bctlioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +i4bctlioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { #if DO_I4B_DEBUG ctl_debug_t *cdbg; @@ -206,7 +206,7 @@ i4bctlioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) * i4bctlpoll - device driver poll routine *---------------------------------------------------------------------------*/ static int -i4bctlpoll (dev_t dev, int events, struct thread *td) +i4bctlpoll (struct cdev *dev, int events, struct thread *td) { return (ENODEV); } diff --git a/sys/i4b/driver/i4b_rbch.c b/sys/i4b/driver/i4b_rbch.c index 5738335e3ddb..f44dcaf7f03d 100644 --- a/sys/i4b/driver/i4b_rbch.c +++ b/sys/i4b/driver/i4b_rbch.c @@ -166,7 +166,7 @@ i4brbchattach(void *dummy) * open rbch device *---------------------------------------------------------------------------*/ static int -i4brbchopen(dev_t dev, int flag, int fmt, struct thread *td) +i4brbchopen(struct cdev *dev, int flag, int fmt, struct thread *td) { int unit = minor(dev); @@ -191,7 +191,7 @@ i4brbchopen(dev_t dev, int flag, int fmt, struct thread *td) * close rbch device *---------------------------------------------------------------------------*/ static int -i4brbchclose(dev_t dev, int flag, int fmt, struct thread *td) +i4brbchclose(struct cdev *dev, int flag, int fmt, struct thread *td) { int unit = minor(dev); struct rbch_softc *sc = &rbch_softc[unit]; @@ -212,7 +212,7 @@ i4brbchclose(dev_t dev, int flag, int fmt, struct thread *td) * read from rbch device *---------------------------------------------------------------------------*/ static int -i4brbchread(dev_t dev, struct uio *uio, int ioflag) +i4brbchread(struct cdev *dev, struct uio *uio, int ioflag) { struct mbuf *m; int error = 0; @@ -314,7 +314,7 @@ i4brbchread(dev_t dev, struct uio *uio, int ioflag) * write to rbch device *---------------------------------------------------------------------------*/ static int -i4brbchwrite(dev_t dev, struct uio * uio, int ioflag) +i4brbchwrite(struct cdev *dev, struct uio * uio, int ioflag) { struct mbuf *m; int error = 0; @@ -432,7 +432,7 @@ i4brbchwrite(dev_t dev, struct uio * uio, int ioflag) * rbch device ioctl handlibg *---------------------------------------------------------------------------*/ static int -i4brbchioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +i4brbchioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int error = 0; int unit = minor(dev); @@ -529,7 +529,7 @@ i4brbchioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) * device driver poll *---------------------------------------------------------------------------*/ static int -i4brbchpoll(dev_t dev, int events, struct thread *td) +i4brbchpoll(struct cdev *dev, int events, struct thread *td) { int revents = 0; /* Events we found */ int s; diff --git a/sys/i4b/driver/i4b_tel.c b/sys/i4b/driver/i4b_tel.c index 703bfc1688b2..c4fc0e35b3cd 100644 --- a/sys/i4b/driver/i4b_tel.c +++ b/sys/i4b/driver/i4b_tel.c @@ -196,7 +196,7 @@ i4btelattach(void *dummy) * open tel device *---------------------------------------------------------------------------*/ static int -i4btelopen(dev_t dev, int flag, int fmt, struct thread *td) +i4btelopen(struct cdev *dev, int flag, int fmt, struct thread *td) { int unit = UNIT(dev); int func = FUNC(dev); @@ -225,7 +225,7 @@ i4btelopen(dev_t dev, int flag, int fmt, struct thread *td) * close tel device *---------------------------------------------------------------------------*/ static int -i4btelclose(dev_t dev, int flag, int fmt, struct thread *td) +i4btelclose(struct cdev *dev, int flag, int fmt, struct thread *td) { int unit = UNIT(dev); int func = FUNC(dev); @@ -268,7 +268,7 @@ i4btelclose(dev_t dev, int flag, int fmt, struct thread *td) * i4btelioctl - device driver ioctl routine *---------------------------------------------------------------------------*/ static int -i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +i4btelioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int unit = UNIT(dev); int func = FUNC(dev); @@ -390,7 +390,7 @@ i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) * read from tel device *---------------------------------------------------------------------------*/ static int -i4btelread(dev_t dev, struct uio *uio, int ioflag) +i4btelread(struct cdev *dev, struct uio *uio, int ioflag) { int unit = UNIT(dev); int func = FUNC(dev); @@ -523,7 +523,7 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag) * write to tel device *---------------------------------------------------------------------------*/ static int -i4btelwrite(dev_t dev, struct uio * uio, int ioflag) +i4btelwrite(struct cdev *dev, struct uio * uio, int ioflag) { int unit = UNIT(dev); int func = FUNC(dev); @@ -683,7 +683,7 @@ tel_tone(tel_sc_t *sc) * device driver poll *---------------------------------------------------------------------------*/ static int -i4btelpoll(dev_t dev, int events, struct thread *td) +i4btelpoll(struct cdev *dev, int events, struct thread *td) { int revents = 0; /* Events we found */ int s; diff --git a/sys/i4b/driver/i4b_trace.c b/sys/i4b/driver/i4b_trace.c index c5c3832d116a..e165d960f452 100644 --- a/sys/i4b/driver/i4b_trace.c +++ b/sys/i4b/driver/i4b_trace.c @@ -223,7 +223,7 @@ get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf) * open trace device *---------------------------------------------------------------------------*/ static int -i4btrcopen(dev_t dev, int flag, int fmt, struct thread *td) +i4btrcopen(struct cdev *dev, int flag, int fmt, struct thread *td) { int x; int unit = minor(dev); @@ -250,7 +250,7 @@ i4btrcopen(dev_t dev, int flag, int fmt, struct thread *td) * close trace device *---------------------------------------------------------------------------*/ static int -i4btrcclose(dev_t dev, int flag, int fmt, struct thread *td) +i4btrcclose(struct cdev *dev, int flag, int fmt, struct thread *td) { int unit = minor(dev); int i, x; @@ -296,7 +296,7 @@ i4btrcclose(dev_t dev, int flag, int fmt, struct thread *td) * read from trace device *---------------------------------------------------------------------------*/ static int -i4btrcread(dev_t dev, struct uio * uio, int ioflag) +i4btrcread(struct cdev *dev, struct uio * uio, int ioflag) { struct mbuf *m; int x; @@ -346,7 +346,7 @@ i4btrcread(dev_t dev, struct uio * uio, int ioflag) * poll device *---------------------------------------------------------------------------*/ static int -i4btrcpoll(dev_t dev, int events, struct thread *td) +i4btrcpoll(struct cdev *dev, int events, struct thread *td) { return(ENODEV); } @@ -355,7 +355,7 @@ i4btrcpoll(dev_t dev, int events, struct thread *td) * device driver ioctl routine *---------------------------------------------------------------------------*/ static int -i4btrcioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +i4btrcioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int error = 0; int unit = minor(dev); diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c index 7b19aec6a460..671cba40bd27 100644 --- a/sys/i4b/layer4/i4b_i4bdrv.c +++ b/sys/i4b/layer4/i4b_i4bdrv.c @@ -111,7 +111,7 @@ i4battach(void *dummy) * i4bopen - device driver open routine *---------------------------------------------------------------------------*/ static int -i4bopen(dev_t dev, int flag, int fmt, struct thread *td) +i4bopen(struct cdev *dev, int flag, int fmt, struct thread *td) { int x; @@ -133,7 +133,7 @@ i4bopen(dev_t dev, int flag, int fmt, struct thread *td) * i4bclose - device driver close routine *---------------------------------------------------------------------------*/ static int -i4bclose(dev_t dev, int flag, int fmt, struct thread *td) +i4bclose(struct cdev *dev, int flag, int fmt, struct thread *td) { int x = splimp(); openflag = 0; @@ -147,7 +147,7 @@ i4bclose(dev_t dev, int flag, int fmt, struct thread *td) * i4bread - device driver read routine *---------------------------------------------------------------------------*/ static int -i4bread(dev_t dev, struct uio *uio, int ioflag) +i4bread(struct cdev *dev, struct uio *uio, int ioflag) { struct mbuf *m; int x; @@ -192,7 +192,7 @@ i4bread(dev_t dev, struct uio *uio, int ioflag) * i4bioctl - device driver ioctl routine *---------------------------------------------------------------------------*/ static int -i4bioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +i4bioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { call_desc_t *cd; int error = 0; @@ -755,7 +755,7 @@ diag_done: * i4bpoll - device driver poll routine *---------------------------------------------------------------------------*/ static int -i4bpoll(dev_t dev, int events, struct thread *td) +i4bpoll(struct cdev *dev, int events, struct thread *td) { int x; diff --git a/sys/ia64/ia64/mem.c b/sys/ia64/ia64/mem.c index 3d48bfd40fa4..d03051f58e99 100644 --- a/sys/ia64/ia64/mem.c +++ b/sys/ia64/ia64/mem.c @@ -66,9 +66,9 @@ #include #include -static dev_t memdev, kmemdev; +static struct cdev *memdev, *kmemdev; #ifdef PERFMON -static dev_t perfdev; +static struct cdev *perfdev; #endif /* PERFMON */ static d_open_t mmopen; @@ -100,7 +100,7 @@ ia64_pa_access(vm_offset_t pa) } static int -mmclose(dev_t dev, int flags, int fmt, struct thread *td) +mmclose(struct cdev *dev, int flags, int fmt, struct thread *td) { switch (minor(dev)) { #ifdef PERFMON @@ -114,7 +114,7 @@ mmclose(dev_t dev, int flags, int fmt, struct thread *td) } static int -mmopen(dev_t dev, int flags, int fmt, struct thread *td) +mmopen(struct cdev *dev, int flags, int fmt, struct thread *td) { int error; @@ -141,7 +141,7 @@ mmopen(dev_t dev, int flags, int fmt, struct thread *td) /*ARGSUSED*/ static int -mmrw(dev_t dev, struct uio *uio, int flags) +mmrw(struct cdev *dev, struct uio *uio, int flags) { struct iovec *iov; vm_offset_t addr, eaddr, o, v; @@ -225,7 +225,7 @@ kmemphys: * instead of going through read/write * \*******************************************************/ static int -memmmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) { /* * /dev/mem is the only one that makes sense through this @@ -246,7 +246,7 @@ memmmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) } static int -mmioctl(dev_t dev, u_long cmd, caddr_t cmdarg, int flags, struct thread *td) +mmioctl(struct cdev *dev, u_long cmd, caddr_t cmdarg, int flags, struct thread *td) { switch(minor(dev)) { #ifdef PERFMON diff --git a/sys/ia64/ia64/ssc.c b/sys/ia64/ia64/ssc.c index d87aa7609448..eb035929b8af 100644 --- a/sys/ia64/ia64/ssc.c +++ b/sys/ia64/ia64/ssc.c @@ -133,7 +133,7 @@ ssccncheckc(struct consdev *cp) } static int -sscopen(dev_t dev, int flag, int mode, struct thread *td) +sscopen(struct cdev *dev, int flag, int mode, struct thread *td) { struct tty *tp; int s; @@ -176,7 +176,7 @@ sscopen(dev_t dev, int flag, int mode, struct thread *td) } static int -sscclose(dev_t dev, int flag, int mode, struct thread *td) +sscclose(struct cdev *dev, int flag, int mode, struct thread *td) { int unit = minor(dev); struct tty *tp = ssc_tp; diff --git a/sys/ia64/ia64/sscdisk.c b/sys/ia64/ia64/sscdisk.c index d831ab99db0e..726fec4140c2 100644 --- a/sys/ia64/ia64/sscdisk.c +++ b/sys/ia64/ia64/sscdisk.c @@ -85,7 +85,7 @@ struct ssc_s { LIST_ENTRY(ssc_s) list; struct bio_queue_head bio_queue; struct disk *disk; - dev_t dev; + struct cdev *dev; int busy; int fd; }; diff --git a/sys/ia64/include/cpu.h b/sys/ia64/include/cpu.h index f6f6b5cba430..b2bffe8a7acc 100644 --- a/sys/ia64/include/cpu.h +++ b/sys/ia64/include/cpu.h @@ -62,7 +62,7 @@ struct clockframe { /* * CTL_MACHDEP definitions. */ -#define CPU_CONSDEV 1 /* dev_t: console terminal device */ +#define CPU_CONSDEV 1 /* struct cdev *: console terminal device */ #define CPU_ADJKERNTZ 2 /* int: timezone offset (seconds) */ #define CPU_DISRTCSET 3 /* int: disable resettodr() call */ #define CPU_WALLCLOCK 4 /* int: indicates wall CMOS clock */ diff --git a/sys/isa/psm.c b/sys/isa/psm.c index 376c0dcfe17d..2d30d657670e 100644 --- a/sys/isa/psm.c +++ b/sys/isa/psm.c @@ -176,8 +176,8 @@ struct psm_softc { /* Driver status information */ int watchdog; /* watchdog timer flag */ struct callout_handle callout; /* watchdog timer call out */ struct callout_handle softcallout; /* buffer timer call out */ - dev_t dev; - dev_t bdev; + struct cdev *dev; + struct cdev *bdev; int lasterr; int cmdcount; }; @@ -1307,7 +1307,7 @@ psmdetach(device_t dev) } static int -psmopen(dev_t dev, int flag, int fmt, struct thread *td) +psmopen(struct cdev *dev, int flag, int fmt, struct thread *td) { int unit = PSM_UNIT(dev); struct psm_softc *sc; @@ -1391,7 +1391,7 @@ psmopen(dev_t dev, int flag, int fmt, struct thread *td) } static int -psmclose(dev_t dev, int flag, int fmt, struct thread *td) +psmclose(struct cdev *dev, int flag, int fmt, struct thread *td) { int unit = PSM_UNIT(dev); struct psm_softc *sc = PSM_SOFTC(unit); @@ -1533,7 +1533,7 @@ tame_mouse(struct psm_softc *sc, packetbuf_t *pb, mousestatus_t *status, unsigne } static int -psmread(dev_t dev, struct uio *uio, int flag) +psmread(struct cdev *dev, struct uio *uio, int flag) { register struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); unsigned char buf[PSM_SMALLBUFSIZE]; @@ -1681,7 +1681,7 @@ unblock_mouse_data(struct psm_softc *sc, int c) } static int -psmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +psmioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); mousemode_t mode; @@ -2506,7 +2506,7 @@ psmsoftintr(void *arg) } static int -psmpoll(dev_t dev, int events, struct thread *td) +psmpoll(struct cdev *dev, int events, struct thread *td) { struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); int s; diff --git a/sys/isa/vga_isa.c b/sys/isa/vga_isa.c index fb6520416221..e1538f810e1a 100644 --- a/sys/isa/vga_isa.c +++ b/sys/isa/vga_isa.c @@ -163,37 +163,37 @@ isavga_attach(device_t dev) #ifdef FB_INSTALL_CDEV static int -isavga_open(dev_t dev, int flag, int mode, struct thread *td) +isavga_open(struct cdev *dev, int flag, int mode, struct thread *td) { return vga_open(dev, VGA_SOFTC(VGA_UNIT(dev)), flag, mode, td); } static int -isavga_close(dev_t dev, int flag, int mode, struct thread *td) +isavga_close(struct cdev *dev, int flag, int mode, struct thread *td) { return vga_close(dev, VGA_SOFTC(VGA_UNIT(dev)), flag, mode, td); } static int -isavga_read(dev_t dev, struct uio *uio, int flag) +isavga_read(struct cdev *dev, struct uio *uio, int flag) { return vga_read(dev, VGA_SOFTC(VGA_UNIT(dev)), uio, flag); } static int -isavga_write(dev_t dev, struct uio *uio, int flag) +isavga_write(struct cdev *dev, struct uio *uio, int flag) { return vga_write(dev, VGA_SOFTC(VGA_UNIT(dev)), uio, flag); } static int -isavga_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) +isavga_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) { return vga_ioctl(dev, VGA_SOFTC(VGA_UNIT(dev)), cmd, arg, flag, td); } static int -isavga_mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +isavga_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) { return vga_mmap(dev, VGA_SOFTC(VGA_UNIT(dev)), offset, paddr, prot); } diff --git a/sys/isofs/cd9660/cd9660_node.c b/sys/isofs/cd9660/cd9660_node.c index b51f15dc4c26..687ec66515cf 100644 --- a/sys/isofs/cd9660/cd9660_node.c +++ b/sys/isofs/cd9660/cd9660_node.c @@ -92,7 +92,7 @@ cd9660_uninit(vfsp) */ int cd9660_ihashget(dev, inum, flags, vpp) - dev_t dev; + struct cdev *dev; ino_t inum; int flags; struct vnode **vpp; diff --git a/sys/isofs/cd9660/cd9660_node.h b/sys/isofs/cd9660/cd9660_node.h index 8e7d6c12d8e5..a5b228c45f06 100644 --- a/sys/isofs/cd9660/cd9660_node.h +++ b/sys/isofs/cd9660/cd9660_node.h @@ -113,7 +113,7 @@ void cd9660_defattr(struct iso_directory_record *, struct iso_node *, struct buf *, enum ISO_FTYPE); void cd9660_deftstamp(struct iso_directory_record *, struct iso_node *, struct buf *, enum ISO_FTYPE); -int cd9660_ihashget(dev_t, ino_t, int, struct vnode **); +int cd9660_ihashget(struct cdev *, ino_t, int, struct vnode **); void cd9660_ihashins(struct iso_node *); int cd9660_tstamp_conv7(u_char *, struct timespec *, enum ISO_FTYPE); int cd9660_tstamp_conv17(u_char *, struct timespec *); diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index ceb60f90e1c2..dc0b240dff23 100644 --- a/sys/isofs/cd9660/cd9660_vfsops.c +++ b/sys/isofs/cd9660/cd9660_vfsops.c @@ -92,7 +92,7 @@ MODULE_VERSION(cd9660, 1); * Called by vfs_mountroot when iso is going to be mounted as root. */ -static int iso_get_ssector(dev_t dev, struct thread *td); +static int iso_get_ssector(struct cdev *dev, struct thread *td); static int iso_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td, struct iso_args *argp); @@ -103,7 +103,7 @@ static int iso_mountfs(struct vnode *devvp, struct mount *mp, */ static int iso_get_ssector(dev, td) - dev_t dev; + struct cdev *dev; struct thread *td; { struct ioc_toc_header h; @@ -272,7 +272,7 @@ iso_mountfs(devvp, mp, td, argp) register struct iso_mnt *isomp = (struct iso_mnt *)0; struct buf *bp = NULL; struct buf *pribp = NULL, *supbp = NULL; - dev_t dev = devvp->v_rdev; + struct cdev *dev = devvp->v_rdev; int error = EINVAL; int needclose = 0; int high_sierra = 0; @@ -707,7 +707,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) struct iso_node *ip; struct buf *bp; struct vnode *vp; - dev_t dev; + struct cdev *dev; int error; imp = VFSTOISOFS(mp); diff --git a/sys/isofs/cd9660/iso.h b/sys/isofs/cd9660/iso.h index 4789e50c296f..412f130b1f62 100644 --- a/sys/isofs/cd9660/iso.h +++ b/sys/isofs/cd9660/iso.h @@ -223,7 +223,7 @@ struct iso_mnt { int im_flags; struct mount *im_mountp; - dev_t im_dev; + struct cdev *im_dev; struct vnode *im_devvp; int logical_block_size; diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 18ede10cbabe..216a7772c543 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include -static MALLOC_DEFINE(M_DEVT, "dev_t", "dev_t storage"); +static MALLOC_DEFINE(M_DEVT, "struct cdev *", "struct cdev *storage"); /* Built at compile time from sys/conf/majors */ extern unsigned char reserved_majors[256]; @@ -56,7 +56,7 @@ extern unsigned char reserved_majors[256]; */ #define DEVT_HASH 83 -/* The number of dev_t's we can create before malloc(9) kick in. */ +/* The number of struct cdev *'s we can create before malloc(9) kick in. */ #define DEVT_STASH 50 static struct cdev devt_stash[DEVT_STASH]; @@ -69,13 +69,13 @@ static int free_devt; SYSCTL_INT(_debug, OID_AUTO, free_devt, CTLFLAG_RW, &free_devt, 0, ""); static struct mtx devmtx; -static void freedev(dev_t dev); +static void freedev(struct cdev *dev); static void devlock(void) { if (!mtx_initialized(&devmtx)) - mtx_init(&devmtx, "dev_t", NULL, MTX_DEF); + mtx_init(&devmtx, "struct cdev *", NULL, MTX_DEF); mtx_lock(&devmtx); } @@ -86,7 +86,7 @@ devunlock(void) } void -dev_ref(dev_t dev) +dev_ref(struct cdev *dev) { devlock(); dev->si_refcount++; @@ -94,7 +94,7 @@ dev_ref(dev_t dev) } void -dev_rel(dev_t dev) +dev_rel(struct cdev *dev) { devlock(); dev->si_refcount--; @@ -125,7 +125,7 @@ cdevsw_rel(struct cdevsw *csw) devunlock(); } -static dev_t makedev(int x, int y); +static struct cdev *makedev(int x, int y); int nullop(void) @@ -200,7 +200,7 @@ static struct cdevsw dead_cdevsw = { #define no_mmap (d_mmap_t *)enodev static int -no_kqfilter(dev_t dev __unused, struct knote *kn __unused) +no_kqfilter(struct cdev *dev __unused, struct knote *kn __unused) { return (1); @@ -214,7 +214,7 @@ no_strategy(struct bio *bp) } static int -no_poll(dev_t dev __unused, int events, struct thread *td __unused) +no_poll(struct cdev *dev __unused, int events, struct thread *td __unused) { /* * Return true for read/write. If the user asked for something @@ -233,7 +233,7 @@ no_poll(dev_t dev __unused, int events, struct thread *td __unused) #define no_dump (dumper_t *)enodev struct cdevsw * -devsw(dev_t dev) +devsw(struct cdev *dev) { if (dev->si_devsw != NULL) return (dev->si_devsw); @@ -241,11 +241,11 @@ devsw(dev_t dev) } /* - * dev_t and u_dev_t primitives + * struct cdev *and u_dev_t primitives */ int -major(dev_t x) +major(struct cdev *x) { if (x == NODEV) return NOUDEV; @@ -253,7 +253,7 @@ major(dev_t x) } int -minor(dev_t x) +minor(struct cdev *x) { if (x == NODEV) return NOUDEV; @@ -261,7 +261,7 @@ minor(dev_t x) } int -dev2unit(dev_t x) +dev2unit(struct cdev *x) { int i; @@ -279,7 +279,7 @@ unit2minor(int unit) return ((unit & 0xff) | ((unit << 8) & ~0xffff)); } -static dev_t +static struct cdev * allocdev(void) { static int stashed; @@ -303,7 +303,7 @@ allocdev(void) return (si); } -static dev_t +static struct cdev * makedev(int x, int y) { struct cdev *si; @@ -325,7 +325,7 @@ makedev(int x, int y) } static void -freedev(dev_t dev) +freedev(struct cdev *dev) { if (dev->si_flags & SI_STASHED) { @@ -338,14 +338,14 @@ freedev(dev_t dev) } udev_t -dev2udev(dev_t x) +dev2udev(struct cdev *x) { if (x == NODEV) return (NOUDEV); return (x->si_udev); } -dev_t +struct cdev * udev2dev(udev_t udev) { struct cdev *si; @@ -467,10 +467,10 @@ prep_cdevsw(struct cdevsw *devsw) devunlock(); } -dev_t +struct cdev * make_dev(struct cdevsw *devsw, int minornr, uid_t uid, gid_t gid, int perms, const char *fmt, ...) { - dev_t dev; + struct cdev *dev; va_list ap; int i; @@ -515,9 +515,9 @@ make_dev(struct cdevsw *devsw, int minornr, uid_t uid, gid_t gid, int perms, con } int -dev_named(dev_t pdev, const char *name) +dev_named(struct cdev *pdev, const char *name) { - dev_t cdev; + struct cdev *cdev; if (strcmp(devtoname(pdev), name) == 0) return (1); @@ -528,7 +528,7 @@ dev_named(dev_t pdev, const char *name) } void -dev_depends(dev_t pdev, dev_t cdev) +dev_depends(struct cdev *pdev, struct cdev *cdev) { devlock(); @@ -538,10 +538,10 @@ dev_depends(dev_t pdev, dev_t cdev) devunlock(); } -dev_t -make_dev_alias(dev_t pdev, const char *fmt, ...) +struct cdev * +make_dev_alias(struct cdev *pdev, const char *fmt, ...) { - dev_t dev; + struct cdev *dev; va_list ap; int i; @@ -564,7 +564,7 @@ make_dev_alias(dev_t pdev, const char *fmt, ...) } static void -idestroy_dev(dev_t dev) +idestroy_dev(struct cdev *dev) { if (!(dev->si_flags & SI_NAMED)) { printf( "WARNING: Driver mistake: destroy_dev on %d/%d\n", @@ -597,7 +597,7 @@ idestroy_dev(dev_t dev) /* Remove from cdevsw list */ LIST_REMOVE(dev, si_list); - /* If cdevsw has no dev_t's, clean it */ + /* If cdevsw has no struct cdev *'s, clean it */ if (LIST_EMPTY(&dev->si_devsw->d_devs)) fini_cdevsw(dev->si_devsw); @@ -616,7 +616,7 @@ idestroy_dev(dev_t dev) } void -destroy_dev(dev_t dev) +destroy_dev(struct cdev *dev) { devlock(); @@ -625,7 +625,7 @@ destroy_dev(dev_t dev) } const char * -devtoname(dev_t dev) +devtoname(struct cdev *dev) { char *p; int mynor; @@ -681,7 +681,7 @@ dev_stdclone(char *name, char **namep, const char *stem, int *unit) * we do "on-demand" devices, using rman or other "private" methods * will be very tricky to lock down properly once we lock down this file. * - * Instead we give the drivers these routines which puts the dev_t's that + * Instead we give the drivers these routines which puts the struct cdev *'s that * are to be managed on their own list, and gives the driver the ability * to ask for the first free unit number or a given specified unit number. * @@ -703,10 +703,10 @@ clone_setup(struct clonedevs **cdp) } int -clone_create(struct clonedevs **cdp, struct cdevsw *csw, int *up, dev_t *dp, u_int extra) +clone_create(struct clonedevs **cdp, struct cdevsw *csw, int *up, struct cdev **dp, u_int extra) { struct clonedevs *cd; - dev_t dev, dl, de; + struct cdev *dev, *dl, *de; int unit, low, u; KASSERT(*cdp != NULL, @@ -766,12 +766,12 @@ clone_create(struct clonedevs **cdp, struct cdevsw *csw, int *up, dev_t *dp, u_i /* * Kill everything still on the list. The driver should already have - * disposed of any softc hung of the dev_t's at this time. + * disposed of any softc hung of the struct cdev *'s at this time. */ void clone_cleanup(struct clonedevs **cdp) { - dev_t dev, tdev; + struct cdev *dev, *tdev; struct clonedevs *cd; cd = *cdp; @@ -787,7 +787,7 @@ clone_cleanup(struct clonedevs **cdp) } /* - * Helper sysctl for devname(3). We're given a {u}dev_t and return + * Helper sysctl for devname(3). We're given a {u}struct cdev *and return * the name, if any, registered by the device driver. */ static int @@ -795,7 +795,7 @@ sysctl_devname(SYSCTL_HANDLER_ARGS) { int error; udev_t ud; - dev_t dev; + struct cdev *dev; error = SYSCTL_IN(req, &ud, sizeof (ud)); if (error) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 8e955ca72c1f..c61e0ed457bb 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2153,7 +2153,7 @@ done2: /* ARGSUSED */ static int fdopen(dev, mode, type, td) - dev_t dev; + struct cdev *dev; int mode, type; struct thread *td; { @@ -2393,7 +2393,7 @@ SYSCTL_INT(_kern, OID_AUTO, openfiles, CTLFLAG_RD, static void fildesc_drvinit(void *unused) { - dev_t dev; + struct cdev *dev; dev = make_dev(&fildesc_cdevsw, 0, UID_ROOT, GID_WHEEL, 0666, "fd/0"); make_dev_alias(dev, "stdin"); diff --git a/sys/kern/kern_physio.c b/sys/kern/kern_physio.c index 83b7b822922f..c2c9b3f198b9 100644 --- a/sys/kern/kern_physio.c +++ b/sys/kern/kern_physio.c @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #include int -physio(dev_t dev, struct uio *uio, int ioflag) +physio(struct cdev *dev, struct uio *uio, int ioflag) { int i; int error; diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index b0271f9cca8e..fd2e9d4b2068 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -390,7 +390,7 @@ static struct dev_softc struct proc *async_proc; } devsoftc; -static dev_t devctl_dev; +static struct cdev *devctl_dev; static void devinit(void) @@ -403,7 +403,7 @@ devinit(void) } static int -devopen(dev_t dev, int oflags, int devtype, d_thread_t *td) +devopen(struct cdev *dev, int oflags, int devtype, d_thread_t *td) { if (devsoftc.inuse) return (EBUSY); @@ -415,7 +415,7 @@ devopen(dev_t dev, int oflags, int devtype, d_thread_t *td) } static int -devclose(dev_t dev, int fflag, int devtype, d_thread_t *td) +devclose(struct cdev *dev, int fflag, int devtype, d_thread_t *td) { devsoftc.inuse = 0; mtx_lock(&devsoftc.mtx); @@ -434,7 +434,7 @@ devclose(dev_t dev, int fflag, int devtype, d_thread_t *td) * programs are expected to cope. */ static int -devread(dev_t dev, struct uio *uio, int ioflag) +devread(struct cdev *dev, struct uio *uio, int ioflag) { struct dev_event_info *n1; int rv; @@ -464,7 +464,7 @@ devread(dev_t dev, struct uio *uio, int ioflag) } static int -devioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, d_thread_t *td) +devioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, d_thread_t *td) { switch (cmd) { @@ -494,7 +494,7 @@ devioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, d_thread_t *td) } static int -devpoll(dev_t dev, int events, d_thread_t *td) +devpoll(struct cdev *dev, int events, d_thread_t *td) { int revents = 0; diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c index 04abe89494c3..f7fda10fefce 100644 --- a/sys/kern/subr_devstat.c +++ b/sys/kern/subr_devstat.c @@ -453,7 +453,7 @@ static TAILQ_HEAD(, statspage) pagelist = TAILQ_HEAD_INITIALIZER(pagelist); static MALLOC_DEFINE(M_DEVSTAT, "devstat", "Device statistics"); static int -devstat_mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +devstat_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) { struct statspage *spp; diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index a2323357141c..bdb18fdabf14 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -92,7 +92,7 @@ SYSCTL_INT(_kern, OID_AUTO, log_wakeups_per_second, CTLFLAG_RW, /*ARGSUSED*/ static int -logopen(dev_t dev, int flags, int mode, struct thread *td) +logopen(struct cdev *dev, int flags, int mode, struct thread *td) { if (log_open) return (EBUSY); @@ -110,7 +110,7 @@ logopen(dev_t dev, int flags, int mode, struct thread *td) /*ARGSUSED*/ static int -logclose(dev_t dev, int flag, int mode, struct thread *td) +logclose(struct cdev *dev, int flag, int mode, struct thread *td) { log_open = 0; @@ -122,7 +122,7 @@ logclose(dev_t dev, int flag, int mode, struct thread *td) /*ARGSUSED*/ static int -logread(dev_t dev, struct uio *uio, int flag) +logread(struct cdev *dev, struct uio *uio, int flag) { char buf[128]; struct msgbuf *mbp = msgbufp; @@ -157,7 +157,7 @@ logread(dev_t dev, struct uio *uio, int flag) /*ARGSUSED*/ static int -logpoll(dev_t dev, int events, struct thread *td) +logpoll(struct cdev *dev, int events, struct thread *td) { int s; int revents = 0; @@ -203,7 +203,7 @@ logtimeout(void *arg) /*ARGSUSED*/ static int -logioctl(dev_t dev, u_long com, caddr_t data, int flag, struct thread *td) +logioctl(struct cdev *dev, u_long com, caddr_t data, int flag, struct thread *td) { switch (com) { diff --git a/sys/kern/tty.c b/sys/kern/tty.c index aeecbb848669..6c5f4d5714d5 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -227,7 +227,7 @@ SYSCTL_INT(_kern, OID_AUTO, drainwait, CTLFLAG_RW, &drainwait, * Initial open of tty, or (re)entry to standard tty line discipline. */ int -ttyopen(dev_t device, struct tty *tp) +ttyopen(struct cdev *device, struct tty *tp) { int s; @@ -1015,7 +1015,7 @@ ttioctl(struct tty *tp, u_long cmd, void *data, int flag) } case TIOCSETD: { /* set line discipline */ int t = *(int *)data; - dev_t device = tp->t_dev; + struct cdev *device = tp->t_dev; if ((u_int)t >= nlinesw) return (ENXIO); @@ -1140,7 +1140,7 @@ ttioctl(struct tty *tp, u_long cmd, void *data, int flag) } int -ttypoll(dev_t dev, int events, struct thread *td) +ttypoll(struct cdev *dev, int events, struct thread *td) { int s; int revents = 0; @@ -1180,7 +1180,7 @@ static struct filterops ttywrite_filtops = { 1, NULL, filt_ttywdetach, filt_ttywrite }; int -ttykqfilter(dev_t dev, struct knote *kn) +ttykqfilter(struct cdev *dev, struct knote *kn) { struct tty *tp; struct klist *klist; @@ -1216,7 +1216,7 @@ ttykqfilter(dev_t dev, struct knote *kn) static void filt_ttyrdetach(struct knote *kn) { - struct tty *tp = ((dev_t)kn->kn_hook)->si_tty; + struct tty *tp = ((struct cdev *)kn->kn_hook)->si_tty; int s = spltty(); SLIST_REMOVE(&tp->t_rsel.si_note, kn, knote, kn_selnext); @@ -1226,7 +1226,7 @@ filt_ttyrdetach(struct knote *kn) static int filt_ttyread(struct knote *kn, long hint) { - struct tty *tp = ((dev_t)kn->kn_hook)->si_tty; + struct tty *tp = ((struct cdev *)kn->kn_hook)->si_tty; kn->kn_data = ttnread(tp); if (ISSET(tp->t_state, TS_ZOMBIE)) { @@ -1239,7 +1239,7 @@ filt_ttyread(struct knote *kn, long hint) static void filt_ttywdetach(struct knote *kn) { - struct tty *tp = ((dev_t)kn->kn_hook)->si_tty; + struct tty *tp = ((struct cdev *)kn->kn_hook)->si_tty; int s = spltty(); SLIST_REMOVE(&tp->t_wsel.si_note, kn, knote, kn_selnext); @@ -1249,7 +1249,7 @@ filt_ttywdetach(struct knote *kn) static int filt_ttywrite(struct knote *kn, long hint) { - struct tty *tp = ((dev_t)kn->kn_hook)->si_tty; + struct tty *tp = ((struct cdev *)kn->kn_hook)->si_tty; kn->kn_data = tp->t_outq.c_cc; if (ISSET(tp->t_state, TS_ZOMBIE)) @@ -2789,7 +2789,7 @@ nottystop(struct tty *tp, int rw) } int -ttyread(dev_t dev, struct uio *uio, int flag) +ttyread(struct cdev *dev, struct uio *uio, int flag) { struct tty *tp; @@ -2804,7 +2804,7 @@ ttyread(dev_t dev, struct uio *uio, int flag) } int -ttywrite(dev_t dev, struct uio *uio, int flag) +ttywrite(struct cdev *dev, struct uio *uio, int flag) { struct tty *tp; @@ -2819,7 +2819,7 @@ ttywrite(dev_t dev, struct uio *uio, int flag) } int -ttyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +ttyioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct tty *tp; int error; diff --git a/sys/kern/tty_conf.c b/sys/kern/tty_conf.c index 827fe424a8c3..488e383d4ae1 100644 --- a/sys/kern/tty_conf.c +++ b/sys/kern/tty_conf.c @@ -156,7 +156,7 @@ ldisc_deregister(int discipline) */ static int -l_noopen(dev_t dev, struct tty *tp) +l_noopen(struct cdev *dev, struct tty *tp) { return (ENODEV); diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index 2c38d56e479a..a9bea7cea674 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -105,7 +105,7 @@ static STAILQ_HEAD(, cn_device) cn_devlist = static udev_t cn_udev_t; SYSCTL_OPAQUE(_machdep, CPU_CONSDEV, consdev, CTLFLAG_RD, - &cn_udev_t, sizeof cn_udev_t, "T,dev_t", ""); + &cn_udev_t, sizeof cn_udev_t, "T,struct cdev *", ""); int cons_avail_mask = 0; /* Bit mask. Each registered low level console * which is currently unavailable for inpit @@ -388,7 +388,7 @@ cn_devopen(struct cn_device *cnd, struct thread *td, int forceopen) char path[CNDEVPATHMAX]; struct nameidata nd; struct vnode *vp; - dev_t dev; + struct cdev *dev; int error; if ((vp = cnd->cnd_vp) != NULL) { @@ -414,7 +414,7 @@ cn_devopen(struct cn_device *cnd, struct thread *td, int forceopen) } static int -cnopen(dev_t dev, int flag, int mode, struct thread *td) +cnopen(struct cdev *dev, int flag, int mode, struct thread *td) { struct cn_device *cnd; @@ -428,7 +428,7 @@ cnopen(dev_t dev, int flag, int mode, struct thread *td) } static int -cnclose(dev_t dev, int flag, int mode, struct thread *td) +cnclose(struct cdev *dev, int flag, int mode, struct thread *td) { struct cn_device *cnd; struct vnode *vp; @@ -444,7 +444,7 @@ cnclose(dev_t dev, int flag, int mode, struct thread *td) } static int -cnread(dev_t dev, struct uio *uio, int flag) +cnread(struct cdev *dev, struct uio *uio, int flag) { struct cn_device *cnd; @@ -456,7 +456,7 @@ cnread(dev_t dev, struct uio *uio, int flag) } static int -cnwrite(dev_t dev, struct uio *uio, int flag) +cnwrite(struct cdev *dev, struct uio *uio, int flag) { struct cn_device *cnd; @@ -477,7 +477,7 @@ done: } static int -cnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +cnioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct cn_device *cnd; int error; @@ -507,7 +507,7 @@ cnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) * poll/kqfilter do not appear to be correct */ static int -cnpoll(dev_t dev, int events, struct thread *td) +cnpoll(struct cdev *dev, int events, struct thread *td) { struct cn_device *cnd; @@ -521,7 +521,7 @@ cnpoll(dev_t dev, int events, struct thread *td) } static int -cnkqfilter(dev_t dev, struct knote *kn) +cnkqfilter(struct cdev *dev, struct knote *kn) { struct cn_device *cnd; diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index 96ccbf482bc3..b4082a384690 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -61,7 +61,7 @@ static MALLOC_DEFINE(M_PTY, "ptys", "pty data structures"); static void ptsstart(struct tty *tp); static void ptsstop(struct tty *tp, int rw); static void ptcwakeup(struct tty *tp, int flag); -static dev_t ptyinit(dev_t cdev); +static struct cdev *ptyinit(struct cdev *cdev); static d_open_t ptsopen; static d_close_t ptsclose; @@ -109,7 +109,7 @@ struct ptsc { u_char pt_send; u_char pt_ucntl; struct tty *pt_tty; - dev_t devs, devc; + struct cdev *devs, *devc; struct prison *pt_prison; }; @@ -133,10 +133,10 @@ static char *names = "pqrsPQRS"; * XXX: define and add mapping of upper minor bits to allow more * than 256 ptys. */ -static dev_t -ptyinit(dev_t devc) +static struct cdev * +ptyinit(struct cdev *devc) { - dev_t devs; + struct cdev *devs; struct ptsc *pt; int n; @@ -161,7 +161,7 @@ ptyinit(dev_t devc) /*ARGSUSED*/ static int -ptsopen(dev_t dev, int flag, int devtype, struct thread *td) +ptsopen(struct cdev *dev, int flag, int devtype, struct thread *td) { struct tty *tp; int error; @@ -199,7 +199,7 @@ ptsopen(dev_t dev, int flag, int devtype, struct thread *td) } static int -ptsclose(dev_t dev, int flag, int mode, struct thread *td) +ptsclose(struct cdev *dev, int flag, int mode, struct thread *td) { struct tty *tp; int err; @@ -211,7 +211,7 @@ ptsclose(dev_t dev, int flag, int mode, struct thread *td) } static int -ptsread(dev_t dev, struct uio *uio, int flag) +ptsread(struct cdev *dev, struct uio *uio, int flag) { struct thread *td = curthread; struct proc *p = td->td_proc; @@ -274,7 +274,7 @@ again: * indirectly, when tty driver calls ptsstart. */ static int -ptswrite(dev_t dev, struct uio *uio, int flag) +ptswrite(struct cdev *dev, struct uio *uio, int flag) { struct tty *tp; @@ -318,7 +318,7 @@ ptcwakeup(struct tty *tp, int flag) } static int -ptcopen(dev_t dev, int flag, int devtype, struct thread *td) +ptcopen(struct cdev *dev, int flag, int devtype, struct thread *td) { struct tty *tp; struct ptsc *pt; @@ -344,7 +344,7 @@ ptcopen(dev_t dev, int flag, int devtype, struct thread *td) } static int -ptcclose(dev_t dev, int flags, int fmt, struct thread *td) +ptcclose(struct cdev *dev, int flags, int fmt, struct thread *td) { struct tty *tp; @@ -370,7 +370,7 @@ ptcclose(dev_t dev, int flags, int fmt, struct thread *td) } static int -ptcread(dev_t dev, struct uio *uio, int flag) +ptcread(struct cdev *dev, struct uio *uio, int flag) { struct tty *tp = dev->si_tty; struct ptsc *pt = dev->si_drv1; @@ -450,7 +450,7 @@ ptsstop(struct tty *tp, int flush) } static int -ptcpoll(dev_t dev, int events, struct thread *td) +ptcpoll(struct cdev *dev, int events, struct thread *td) { struct tty *tp = dev->si_tty; struct ptsc *pt = dev->si_drv1; @@ -498,7 +498,7 @@ ptcpoll(dev_t dev, int events, struct thread *td) } static int -ptcwrite(dev_t dev, struct uio *uio, int flag) +ptcwrite(struct cdev *dev, struct uio *uio, int flag) { struct tty *tp = dev->si_tty; u_char *cp = 0; @@ -606,7 +606,7 @@ block: /*ARGSUSED*/ static int -ptyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +ptyioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct tty *tp = dev->si_tty; struct ptsc *pt = dev->si_drv1; @@ -773,7 +773,7 @@ ptyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) } static void -pty_clone(void *arg, char *name, int namelen, dev_t *dev) +pty_clone(void *arg, char *name, int namelen, struct cdev **dev) { int u; diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index 96fa84ba27fb..85b0eacba66e 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -45,17 +45,17 @@ static struct cdevsw ctty_cdevsw = { .d_flags = D_TTY | D_NEEDGIANT, }; -static dev_t ctty; +static struct cdev *ctty; static int -cttyopen(dev_t dev, int flag, int mode, struct thread *td) +cttyopen(struct cdev *dev, int flag, int mode, struct thread *td) { return (ENXIO); } static void -ctty_clone(void *arg, char *name, int namelen, dev_t *dev) +ctty_clone(void *arg, char *name, int namelen, struct cdev **dev) { if (*dev != NODEV) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 30daba78c71e..19b672621857 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -3083,7 +3083,7 @@ dev_strategy(struct buf *bp) bp->b_io.bio_caller2 = bp; csw = devsw(bp->b_io.bio_dev); KASSERT(bp->b_io.bio_dev->si_refcount > 0, - ("dev_strategy on un-referenced dev_t (%s)", + ("dev_strategy on un-referenced struct cdev *(%s)", devtoname(bp->b_io.bio_dev))); cdevsw_ref(csw); (*devsw(bp->b_io.bio_dev)->d_strategy)(&bp->b_io); diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 229309dd44fe..8eaa6e9ce8b9 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -147,7 +147,7 @@ static char *cdrom_rootdevnames[] = { /* legacy find-root code */ char *rootdevnames[2] = {NULL, NULL}; static int setrootbyname(char *name); -dev_t rootdev = NODEV; +struct cdev *rootdev = NODEV; /* * Has to be dynamic as the value of rootdev can change; however, it can't @@ -1445,13 +1445,13 @@ gets(char *cp) } /* - * Convert a given name to the dev_t of the disk-like device + * Convert a given name to the struct cdev *of the disk-like device * it refers to. */ -dev_t +struct cdev * getdiskbyname(char *name) { char *cp; - dev_t dev; + struct cdev *dev; cp = name; if (!bcmp(cp, "/dev/", 5)) @@ -1469,7 +1469,7 @@ getdiskbyname(char *name) { static int setrootbyname(char *name) { - dev_t diskdev; + struct cdev *diskdev; diskdev = getdiskbyname(name); if (diskdev != NODEV) { @@ -1480,11 +1480,11 @@ setrootbyname(char *name) return (1); } -/* Show the dev_t for a disk specified by name */ +/* Show the struct cdev *for a disk specified by name */ #ifdef DDB DB_SHOW_COMMAND(disk, db_getdiskbyname) { - dev_t dev; + struct cdev *dev; if (modif[0] == '\0') { db_error("usage: show disk/devicename"); @@ -1492,7 +1492,7 @@ DB_SHOW_COMMAND(disk, db_getdiskbyname) } dev = getdiskbyname(modif); if (dev != NODEV) - db_printf("dev_t = %p\n", dev); + db_printf("struct cdev *= %p\n", dev); else db_printf("No disk device matched.\n"); } diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 2caad255e853..0346fa2130d1 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_NETADDR, "Export Host", "Export host address structure"); -static void addalias(struct vnode *vp, dev_t nvp_rdev); +static void addalias(struct vnode *vp, struct cdev *nvp_rdev); static void insmntque(struct vnode *vp, struct mount *mp); static void vclean(struct vnode *vp, int flags, struct thread *td); static void vlruvp(struct vnode *vp); @@ -1737,7 +1737,7 @@ reassignbuf(bp, newvp) */ int bdevvp(dev, vpp) - dev_t dev; + struct cdev *dev; struct vnode **vpp; { register struct vnode *vp; @@ -1776,7 +1776,7 @@ v_incr_usecount(struct vnode *vp, int delta) } /* - * Add vnode to the alias list hung off the dev_t. + * Add vnode to the alias list hung off the struct cdev *. * * The reason for this gunk is that multiple vnodes can reference * the same physical device, so checking vp->v_usecount to see @@ -1790,7 +1790,7 @@ addaliasu(nvp, nvp_rdev) { struct vnode *ovp; vop_t **ops; - dev_t dev; + struct cdev *dev; if (nvp->v_type == VBLK) return (nvp); @@ -1836,11 +1836,11 @@ addaliasu(nvp, nvp_rdev) } /* This is a local helper function that do the same as addaliasu, but for a - * dev_t instead of an udev_t. */ + * struct cdev *instead of an udev_t. */ static void addalias(nvp, dev) struct vnode *nvp; - dev_t dev; + struct cdev *dev; { KASSERT(nvp->v_type == VCHR, ("addalias on non-special vnode")); @@ -2440,7 +2440,7 @@ vop_revoke(ap) } */ *ap; { struct vnode *vp, *vq; - dev_t dev; + struct cdev *dev; KASSERT((ap->a_flags & REVOKEALL) != 0, ("vop_revoke")); vp = ap->a_vp; @@ -2622,7 +2622,7 @@ vgonel(vp, td) */ int vfinddev(dev, vpp) - dev_t dev; + struct cdev *dev; struct vnode **vpp; { struct vnode *vp; @@ -2653,11 +2653,11 @@ vcount(vp) } /* - * Same as above, but using the dev_t as argument + * Same as above, but using the struct cdev *as argument */ int count_dev(dev) - dev_t dev; + struct cdev *dev; { int count; @@ -3399,9 +3399,9 @@ sync_reclaim(ap) } /* - * extract the dev_t from a VCHR + * extract the struct cdev *from a VCHR */ -dev_t +struct cdev * vn_todev(vp) struct vnode *vp; { diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 8bb0fe5481fe..4b3cf45fa9d0 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -319,7 +319,7 @@ bpf_detachd(d) /* ARGSUSED */ static int bpfopen(dev, flags, fmt, td) - dev_t dev; + struct cdev *dev; int flags; int fmt; struct thread *td; @@ -364,7 +364,7 @@ bpfopen(dev, flags, fmt, td) /* ARGSUSED */ static int bpfclose(dev, flags, fmt, td) - dev_t dev; + struct cdev *dev; int flags; int fmt; struct thread *td; @@ -408,7 +408,7 @@ bpfclose(dev, flags, fmt, td) */ static int bpfread(dev, uio, ioflag) - dev_t dev; + struct cdev *dev; struct uio *uio; int ioflag; { @@ -545,7 +545,7 @@ bpf_timed_out(arg) static int bpfwrite(dev, uio, ioflag) - dev_t dev; + struct cdev *dev; struct uio *uio; int ioflag; { @@ -633,7 +633,7 @@ reset_d(d) /* ARGSUSED */ static int bpfioctl(dev, cmd, addr, flags, td) - dev_t dev; + struct cdev *dev; u_long cmd; caddr_t addr; int flags; @@ -1043,7 +1043,7 @@ bpf_setif(d, ifr) */ static int bpfpoll(dev, events, td) - dev_t dev; + struct cdev *dev; int events; struct thread *td; { @@ -1079,7 +1079,7 @@ bpfpoll(dev, events, td) */ int bpfkqfilter(dev, kn) - dev_t dev; + struct cdev *dev; struct knote *kn; { struct bpf_d *d = (struct bpf_d *)dev->si_drv1; @@ -1567,14 +1567,14 @@ bpf_setdlt(d, dlt) static void bpf_drvinit(void *unused); -static void bpf_clone(void *arg, char *name, int namelen, dev_t *dev); +static void bpf_clone(void *arg, char *name, int namelen, struct cdev **dev); static void bpf_clone(arg, name, namelen, dev) void *arg; char *name; int namelen; - dev_t *dev; + struct cdev **dev; { int u; diff --git a/sys/net/if.c b/sys/net/if.c index 79420656abc1..2b3805e1fe3a 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -144,19 +144,19 @@ static struct cdevsw net_cdevsw = { }; static int -netopen(dev_t dev, int flag, int mode, struct thread *td) +netopen(struct cdev *dev, int flag, int mode, struct thread *td) { return (0); } static int -netclose(dev_t dev, int flags, int fmt, struct thread *td) +netclose(struct cdev *dev, int flags, int fmt, struct thread *td) { return (0); } static int -netioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +netioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct ifnet *ifp; int error, idx; @@ -185,7 +185,7 @@ netioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) } static int -netkqfilter(dev_t dev, struct knote *kn) +netkqfilter(struct cdev *dev, struct knote *kn) { struct klist *klist; struct ifnet *ifp; diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index 5037742ae596..c05ecd02c2d6 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -179,7 +179,7 @@ static l_close_t slclose; static l_rint_t slinput; static l_ioctl_t sltioctl; static int slioctl(struct ifnet *, u_long, caddr_t); -static int slopen(dev_t, struct tty *); +static int slopen(struct cdev *, struct tty *); static int sloutput(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); static int slstart(struct tty *); @@ -340,7 +340,7 @@ slcreate() /* ARGSUSED */ static int slopen(dev, tp) - dev_t dev; + struct cdev *dev; register struct tty *tp; { register struct sl_softc *sc; diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index a9ea72553b6d..7f2f8564277e 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -81,8 +81,8 @@ static int tapmodevent(module_t, int, void *); /* device */ -static void tapclone(void *, char *, int, dev_t *); -static void tapcreate(dev_t); +static void tapclone(void *, char *, int, struct cdev **); +static void tapcreate(struct cdev *); /* network interface */ static void tapifstart(struct ifnet *); @@ -222,7 +222,7 @@ tapclone(arg, name, namelen, dev) void *arg; char *name; int namelen; - dev_t *dev; + struct cdev **dev; { u_int extra; int i, unit; @@ -264,7 +264,7 @@ tapclone(arg, name, namelen, dev) */ static void tapcreate(dev) - dev_t dev; + struct cdev *dev; { struct ifnet *ifp = NULL; struct tap_softc *tp = NULL; @@ -334,7 +334,7 @@ tapcreate(dev) */ static int tapopen(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag; int mode; struct thread *td; @@ -384,7 +384,7 @@ tapopen(dev, flag, mode, td) */ static int tapclose(dev, foo, bar, td) - dev_t dev; + struct cdev *dev; int foo; int bar; struct thread *td; @@ -588,7 +588,7 @@ tapifstart(ifp) */ static int tapioctl(dev, cmd, data, flag, td) - dev_t dev; + struct cdev *dev; u_long cmd; caddr_t data; int flag; @@ -712,7 +712,7 @@ tapioctl(dev, cmd, data, flag, td) */ static int tapread(dev, uio, flag) - dev_t dev; + struct cdev *dev; struct uio *uio; int flag; { @@ -786,7 +786,7 @@ tapread(dev, uio, flag) */ static int tapwrite(dev, uio, flag) - dev_t dev; + struct cdev *dev; struct uio *uio; int flag; { @@ -858,7 +858,7 @@ tapwrite(dev, uio, flag) */ static int tappoll(dev, events, td) - dev_t dev; + struct cdev *dev; int events; struct thread *td; { diff --git a/sys/net/if_tapvar.h b/sys/net/if_tapvar.h index acd4528e166b..512a33d7e95c 100644 --- a/sys/net/if_tapvar.h +++ b/sys/net/if_tapvar.h @@ -63,7 +63,7 @@ struct tap_softc { struct selinfo tap_rsel; /* read select */ SLIST_ENTRY(tap_softc) tap_next; /* next device in chain */ - dev_t tap_dev; + struct cdev *tap_dev; struct mtx tap_mtx; /* per-softc mutex */ }; diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 90eafeb3af76..975b1c0474d0 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -62,7 +62,7 @@ */ struct tun_softc { TAILQ_ENTRY(tun_softc) tun_list; - dev_t tun_dev; + struct cdev *tun_dev; u_short tun_flags; /* misc flags */ #define TUN_OPEN 0x0001 #define TUN_INITED 0x0002 @@ -105,8 +105,8 @@ static struct clonedevs *tunclones; static TAILQ_HEAD(,tun_softc) tunhead = TAILQ_HEAD_INITIALIZER(tunhead); SYSCTL_INT(_debug, OID_AUTO, if_tun_debug, CTLFLAG_RW, &tundebug, 0, ""); -static void tunclone(void *arg, char *name, int namelen, dev_t *dev); -static void tuncreate(dev_t dev); +static void tunclone(void *arg, char *name, int namelen, struct cdev **dev); +static void tuncreate(struct cdev *dev); static int tunifioctl(struct ifnet *, u_long, caddr_t); static int tuninit(struct ifnet *); static int tunmodevent(module_t, int, void *); @@ -134,7 +134,7 @@ static struct cdevsw tun_cdevsw = { }; static void -tunclone(void *arg, char *name, int namelen, dev_t *dev) +tunclone(void *arg, char *name, int namelen, struct cdev **dev) { int u, i; @@ -151,7 +151,7 @@ tunclone(void *arg, char *name, int namelen, dev_t *dev) /* find any existing device, or allocate new unit number */ i = clone_create(&tunclones, &tun_cdevsw, &u, dev, 0); if (i) { - /* No preexisting dev_t, create one */ + /* No preexisting struct cdev *, create one */ *dev = make_dev(&tun_cdevsw, unit2minor(u), UID_UUCP, GID_DIALER, 0600, "tun%d", u); if (*dev != NULL) @@ -162,7 +162,7 @@ tunclone(void *arg, char *name, int namelen, dev_t *dev) static void tun_destroy(struct tun_softc *tp) { - dev_t dev; + struct cdev *dev; /* Unlocked read. */ KASSERT((tp->tun_flags & TUN_OPEN) == 0, @@ -235,7 +235,7 @@ tunstart(struct ifnet *ifp) } static void -tuncreate(dev_t dev) +tuncreate(struct cdev *dev) { struct tun_softc *sc; struct ifnet *ifp; @@ -266,7 +266,7 @@ tuncreate(dev_t dev) } static int -tunopen(dev_t dev, int flag, int mode, struct thread *td) +tunopen(struct cdev *dev, int flag, int mode, struct thread *td) { struct ifnet *ifp; struct tun_softc *tp; @@ -307,7 +307,7 @@ tunopen(dev_t dev, int flag, int mode, struct thread *td) * routing info */ static int -tunclose(dev_t dev, int foo, int bar, struct thread *td) +tunclose(struct cdev *dev, int foo, int bar, struct thread *td) { struct tun_softc *tp; struct ifnet *ifp; @@ -535,7 +535,7 @@ tunoutput( * the cdevsw interface is now pretty minimal. */ static int -tunioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int s; int error; @@ -658,7 +658,7 @@ tunioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) * least as much of a packet as can be read. */ static int -tunread(dev_t dev, struct uio *uio, int flag) +tunread(struct cdev *dev, struct uio *uio, int flag) { struct tun_softc *tp = dev->si_drv1; struct ifnet *ifp = &tp->tun_if; @@ -714,7 +714,7 @@ tunread(dev_t dev, struct uio *uio, int flag) * the cdevsw write interface - an atomic write is a packet - or else! */ static int -tunwrite(dev_t dev, struct uio *uio, int flag) +tunwrite(struct cdev *dev, struct uio *uio, int flag) { struct tun_softc *tp = dev->si_drv1; struct ifnet *ifp = &tp->tun_if; @@ -829,7 +829,7 @@ tunwrite(dev_t dev, struct uio *uio, int flag) * anyway, it either accepts the packet or drops it. */ static int -tunpoll(dev_t dev, int events, struct thread *td) +tunpoll(struct cdev *dev, int events, struct thread *td) { int s; struct tun_softc *tp = dev->si_drv1; diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 68cebe6f1837..9fd82c7aa0c6 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -643,7 +643,7 @@ extern struct mtx ifnet_lock; struct ifindex_entry { struct ifnet *ife_ifnet; struct ifaddr *ife_ifnet_addr; - dev_t ife_dev; + struct cdev *ife_dev; }; #define ifnet_byindex(idx) ifindex_table[(idx)].ife_ifnet diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c index 135ddebe0358..0270acbb95bf 100644 --- a/sys/net/ppp_tty.c +++ b/sys/net/ppp_tty.c @@ -93,7 +93,7 @@ #include #include -static int pppopen(dev_t dev, struct tty *tp); +static int pppopen(struct cdev *dev, struct tty *tp); static int pppclose(struct tty *tp, int flag); static int pppread(struct tty *tp, struct uio *uio, int flag); static int pppwrite(struct tty *tp, struct uio *uio, int flag); @@ -173,7 +173,7 @@ pppasyncdetach() /* ARGSUSED */ static int pppopen(dev, tp) - dev_t dev; + struct cdev *dev; register struct tty *tp; { struct thread *td = curthread; /* XXX */ diff --git a/sys/netgraph/bluetooth/drivers/h4/ng_h4.c b/sys/netgraph/bluetooth/drivers/h4/ng_h4.c index 3aeb21a58520..27b66414a9f7 100644 --- a/sys/netgraph/bluetooth/drivers/h4/ng_h4.c +++ b/sys/netgraph/bluetooth/drivers/h4/ng_h4.c @@ -78,7 +78,7 @@ MALLOC_DEFINE(M_NETGRAPH_H4, "netgraph_h4", "Netgraph Bluetooth H4 node"); #endif /* NG_SEPARATE_MALLOC */ /* Line discipline methods */ -static int ng_h4_open (dev_t, struct tty *); +static int ng_h4_open (struct cdev *, struct tty *); static int ng_h4_close (struct tty *, int); static int ng_h4_read (struct tty *, struct uio *, int); static int ng_h4_write (struct tty *, struct uio *, int); @@ -147,7 +147,7 @@ static int ng_h4_node = 0; */ static int -ng_h4_open(dev_t dev, struct tty *tp) +ng_h4_open(struct cdev *dev, struct tty *tp) { char name[NG_NODESIZ]; ng_h4_info_p sc = NULL; diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c index 5c48c53734cb..c28e772351a1 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c @@ -2291,7 +2291,7 @@ done: */ Static int -ubt_open(dev_t dev, int flag, int mode, usb_proc_ptr p) +ubt_open(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { ubt_softc_p sc = NULL; int ep = UBT_ENDPOINT(dev); @@ -2331,7 +2331,7 @@ ubt_open(dev_t dev, int flag, int mode, usb_proc_ptr p) */ Static int -ubt_close(dev_t dev, int flag, int mode, usb_proc_ptr p) +ubt_close(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { ubt_softc_p sc = NULL; int ep = UBT_ENDPOINT(dev); @@ -2368,7 +2368,7 @@ ubt_close(dev_t dev, int flag, int mode, usb_proc_ptr p) */ Static int -ubt_read(dev_t dev, struct uio *uio, int flag) +ubt_read(struct cdev *dev, struct uio *uio, int flag) { ubt_softc_p sc = NULL; int error = 0, n, tn, ep = UBT_ENDPOINT(dev); @@ -2436,7 +2436,7 @@ ubt_read(dev_t dev, struct uio *uio, int flag) */ Static int -ubt_write(dev_t dev, struct uio *uio, int flag) +ubt_write(struct cdev *dev, struct uio *uio, int flag) { ubt_softc_p sc = NULL; int error = 0, n, ep = UBT_ENDPOINT(dev); @@ -2495,7 +2495,7 @@ ubt_write(dev_t dev, struct uio *uio, int flag) */ Static int -ubt_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) +ubt_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) { ubt_softc_p sc = NULL; int len, error = 0, ep = UBT_ENDPOINT(dev); @@ -2613,7 +2613,7 @@ ret: */ Static int -ubt_poll(dev_t dev, int events, usb_proc_ptr p) +ubt_poll(struct cdev *dev, int events, usb_proc_ptr p) { ubt_softc_p sc = NULL; int revents = 0, ep = UBT_ENDPOINT(dev); diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h index 3fc33227d463..fef818977ef0 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h @@ -139,9 +139,9 @@ struct ubt_softc { hook_p sc_hook; /* upstream hook */ /* Device specific */ - dev_t sc_ctrl_dev; /* control device */ - dev_t sc_intr_dev; /* interrupt device */ - dev_t sc_bulk_dev; /* bulk device */ + struct cdev *sc_ctrl_dev; /* control device */ + struct cdev *sc_intr_dev; /* interrupt device */ + struct cdev *sc_bulk_dev; /* bulk device */ int sc_refcnt; /* device ref. count */ int sc_dying; diff --git a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c index 19e18014c0ae..f957cf52e8ed 100644 --- a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c +++ b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c @@ -61,9 +61,9 @@ struct ubtbcmfw_softc { USBBASEDEVICE sc_dev; /* base device */ usbd_device_handle sc_udev; /* USB device handle */ - dev_t sc_ctrl_dev; /* control device */ - dev_t sc_intr_in_dev; /* interrupt device */ - dev_t sc_bulk_out_dev; /* bulk device */ + struct cdev *sc_ctrl_dev; /* control device */ + struct cdev *sc_intr_in_dev; /* interrupt device */ + struct cdev *sc_bulk_out_dev; /* bulk device */ usbd_pipe_handle sc_intr_in_pipe; /* interrupt pipe */ usbd_pipe_handle sc_bulk_out_pipe; /* bulk out pipe */ int sc_flags; @@ -264,7 +264,7 @@ USB_DETACH(ubtbcmfw) */ Static int -ubtbcmfw_open(dev_t dev, int flag, int mode, usb_proc_ptr p) +ubtbcmfw_open(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { ubtbcmfw_softc_p sc = NULL; int error = 0; @@ -316,7 +316,7 @@ ubtbcmfw_open(dev_t dev, int flag, int mode, usb_proc_ptr p) */ Static int -ubtbcmfw_close(dev_t dev, int flag, int mode, usb_proc_ptr p) +ubtbcmfw_close(struct cdev *dev, int flag, int mode, usb_proc_ptr p) { ubtbcmfw_softc_p sc = NULL; @@ -353,7 +353,7 @@ ubtbcmfw_close(dev_t dev, int flag, int mode, usb_proc_ptr p) */ Static int -ubtbcmfw_read(dev_t dev, struct uio *uio, int flag) +ubtbcmfw_read(struct cdev *dev, struct uio *uio, int flag) { ubtbcmfw_softc_p sc = NULL; u_int8_t buf[UBTBCMFW_BSIZE]; @@ -417,7 +417,7 @@ ubtbcmfw_read(dev_t dev, struct uio *uio, int flag) */ Static int -ubtbcmfw_write(dev_t dev, struct uio *uio, int flag) +ubtbcmfw_write(struct cdev *dev, struct uio *uio, int flag) { ubtbcmfw_softc_p sc = NULL; u_int8_t buf[UBTBCMFW_BSIZE]; @@ -482,7 +482,7 @@ ubtbcmfw_write(dev_t dev, struct uio *uio, int flag) */ Static int -ubtbcmfw_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) +ubtbcmfw_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) { ubtbcmfw_softc_p sc = NULL; int error = 0; @@ -519,7 +519,7 @@ ubtbcmfw_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) */ Static int -ubtbcmfw_poll(dev_t dev, int events, usb_proc_ptr p) +ubtbcmfw_poll(struct cdev *dev, int events, usb_proc_ptr p) { ubtbcmfw_softc_p sc = NULL; int revents = 0; diff --git a/sys/netgraph/ng_device.c b/sys/netgraph/ng_device.c index c0666b996502..49d86b9ebbf8 100644 --- a/sys/netgraph/ng_device.c +++ b/sys/netgraph/ng_device.c @@ -81,7 +81,7 @@ NETGRAPH_INIT(device, &typestruct); struct ngd_connection { SLIST_ENTRY(ngd_connection) links; - dev_t ngddev; + struct cdev *ngddev; struct ng_hook *active_hook; char *readq; int loc; @@ -412,7 +412,7 @@ ng_device_disconnect(hook_p hook) * the device is opened */ static int -ngdopen(dev_t dev, int flag, int mode, struct thread *td) +ngdopen(struct cdev *dev, int flag, int mode, struct thread *td) { #ifdef NGD_DEBUG @@ -426,7 +426,7 @@ ngdopen(dev_t dev, int flag, int mode, struct thread *td) * the device is closed */ static int -ngdclose(dev_t dev, int flag, int mode, struct thread *td) +ngdclose(struct cdev *dev, int flag, int mode, struct thread *td) { #ifdef NGD_DEBUG @@ -444,7 +444,7 @@ ngdclose(dev_t dev, int flag, int mode, struct thread *td) * */ static int -ngdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +ngdioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct ngd_softc *sc = &ngd_softc; struct ngd_connection * connection = NULL; @@ -496,7 +496,7 @@ nomsg: * uiomove. */ static int -ngdread(dev_t dev, struct uio *uio, int flag) +ngdread(struct cdev *dev, struct uio *uio, int flag) { int ret = 0, amnt; char buffer[uio->uio_resid+1]; @@ -547,7 +547,7 @@ error: * */ static int -ngdwrite(dev_t dev, struct uio *uio, int flag) +ngdwrite(struct cdev *dev, struct uio *uio, int flag) { int ret; int error = 0; @@ -597,7 +597,7 @@ error: * check if there is data available for read */ static int -ngdpoll(dev_t dev, int events, struct thread *td) +ngdpoll(struct cdev *dev, int events, struct thread *td) { int revents = 0; struct ngd_softc *sc = &ngd_softc; diff --git a/sys/netgraph/ng_tty.c b/sys/netgraph/ng_tty.c index 186cad6c5e1c..0ce67a58c3b2 100644 --- a/sys/netgraph/ng_tty.c +++ b/sys/netgraph/ng_tty.c @@ -115,7 +115,7 @@ typedef struct ngt_sc *sc_p; #endif /* Line discipline methods */ -static int ngt_open(dev_t dev, struct tty *tp); +static int ngt_open(struct cdev *dev, struct tty *tp); static int ngt_close(struct tty *tp, int flag); static int ngt_read(struct tty *tp, struct uio *uio, int flag); static int ngt_write(struct tty *tp, struct uio *uio, int flag); @@ -180,7 +180,7 @@ static int ngt_ldisc; * Called from device open routine or ttioctl() at >= splsofttty() */ static int -ngt_open(dev_t dev, struct tty *tp) +ngt_open(struct cdev *dev, struct tty *tp) { struct thread *const td = curthread; /* XXX */ char name[sizeof(NG_TTY_NODE_TYPE) + 8]; diff --git a/sys/netncp/ncp_mod.c b/sys/netncp/ncp_mod.c index 497e203f0247..83e970868a3c 100644 --- a/sys/netncp/ncp_mod.c +++ b/sys/netncp/ncp_mod.c @@ -62,7 +62,7 @@ SYSCTL_INT(_net_ncp, OID_AUTO, version, CTLFLAG_RD, &ncp_version, 0, ""); MODULE_VERSION(ncp, 1); MODULE_DEPEND(ncp, libmchain, 1, 1, 1); -static dev_t ncp_dev; +static struct cdev *ncp_dev; static d_ioctl_t ncp_ioctl; @@ -82,7 +82,7 @@ static int sncp_connect(struct thread *, struct ncpioc_connect *); static int sncp_request(struct thread *, struct ncpioc_request *); static int -ncp_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +ncp_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { switch (cmd) { diff --git a/sys/netsmb/smb_dev.c b/sys/netsmb/smb_dev.c index 16e4819225cb..78a60680f925 100644 --- a/sys/netsmb/smb_dev.c +++ b/sys/netsmb/smb_dev.c @@ -99,7 +99,7 @@ static struct cdevsw nsmb_cdevsw = { static eventhandler_tag nsmb_dev_tag; static void -nsmb_dev_clone(void *arg, char *name, int namelen, dev_t *dev) +nsmb_dev_clone(void *arg, char *name, int namelen, struct cdev **dev) { int u; @@ -112,7 +112,7 @@ nsmb_dev_clone(void *arg, char *name, int namelen, dev_t *dev) } static int -nsmb_dev_open(dev_t dev, int oflags, int devtype, struct thread *td) +nsmb_dev_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { struct smb_dev *sdp; struct ucred *cred = td->td_ucred; @@ -146,7 +146,7 @@ nsmb_dev_open(dev_t dev, int oflags, int devtype, struct thread *td) } static int -nsmb_dev_close(dev_t dev, int flag, int fmt, struct thread *td) +nsmb_dev_close(struct cdev *dev, int flag, int fmt, struct thread *td) { struct smb_dev *sdp; struct smb_vc *vcp; @@ -180,7 +180,7 @@ nsmb_dev_close(dev_t dev, int flag, int fmt, struct thread *td) static int -nsmb_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +nsmb_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct smb_dev *sdp; struct smb_vc *vcp; @@ -385,7 +385,7 @@ smb_dev2share(int fd, int mode, struct smb_cred *scred, struct vnode *vp; struct smb_dev *sdp; struct smb_share *ssp; - dev_t dev; + struct cdev *dev; int error; fp = nsmb_getfp(scred->scr_td->td_proc->p_fd, fd, FREAD | FWRITE); diff --git a/sys/nfs4client/nfs4_dev.c b/sys/nfs4client/nfs4_dev.c index 645c4ea2e138..b675e5508b27 100644 --- a/sys/nfs4client/nfs4_dev.c +++ b/sys/nfs4client/nfs4_dev.c @@ -75,7 +75,7 @@ struct nfs4dev_upcall { static int nfs4dev_nopen = 0; static struct thread * nfs4dev_reader = NULL; -static dev_t nfs4device = 0; +static struct cdev *nfs4device = 0; static struct mtx nfs4dev_daemon_mtx; static int nfs4dev_xid = 0; @@ -252,7 +252,7 @@ nfs4dev_uninit(void) /* device interface functions */ static int -nfs4dev_open(dev_t dev, int flags, int fmt, d_thread_t *td) +nfs4dev_open(struct cdev *dev, int flags, int fmt, d_thread_t *td) { if (dev != nfs4device) return ENODEV; @@ -271,7 +271,7 @@ nfs4dev_open(dev_t dev, int flags, int fmt, d_thread_t *td) } static int -nfs4dev_close(dev_t dev, int flags, int fmt, d_thread_t *td) +nfs4dev_close(struct cdev *dev, int flags, int fmt, d_thread_t *td) { struct nfs4dev_upcall * u; @@ -303,7 +303,7 @@ nfs4dev_close(dev_t dev, int flags, int fmt, d_thread_t *td) } static int -nfs4dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td) +nfs4dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { int error; @@ -333,7 +333,7 @@ nfs4dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td) } static int -nfs4dev_poll(dev_t dev, int events, struct thread *td) +nfs4dev_poll(struct cdev *dev, int events, struct thread *td) { int revents; diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 9feb48b7a6c8..9b0da7ce3026 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -712,25 +712,25 @@ csefree(struct csession *cse) } static int -cryptoopen(dev_t dev, int oflags, int devtype, struct thread *td) +cryptoopen(struct cdev *dev, int oflags, int devtype, struct thread *td) { return (0); } static int -cryptoread(dev_t dev, struct uio *uio, int ioflag) +cryptoread(struct cdev *dev, struct uio *uio, int ioflag) { return (EIO); } static int -cryptowrite(dev_t dev, struct uio *uio, int ioflag) +cryptowrite(struct cdev *dev, struct uio *uio, int ioflag) { return (EIO); } static int -cryptoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +cryptoioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct file *f; struct fcrypt *fcr; @@ -775,7 +775,7 @@ static struct cdevsw crypto_cdevsw = { .d_name = "crypto", .d_maj = CRYPTO_MAJOR, }; -static dev_t crypto_dev; +static struct cdev *crypto_dev; /* * Initialization code, both for static and dynamic loading. diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c index dc6668aab656..a8ed55660b9d 100644 --- a/sys/pc98/cbus/fdc.c +++ b/sys/pc98/cbus/fdc.c @@ -379,7 +379,7 @@ struct fd_data { struct callout_handle toffhandle; struct callout_handle tohandle; struct devstat *device_stats; - dev_t masterdev; + struct cdev *masterdev; device_t dev; fdu_t fdu; #ifdef PC98 @@ -532,11 +532,11 @@ static timeout_t fd_iotimeout; static timeout_t fd_pseudointr; static driver_intr_t fdc_intr; static int fdcpio(fdc_p, long, caddr_t, u_int); -static int fdautoselect(dev_t); +static int fdautoselect(struct cdev *); static int fdstate(struct fdc_data *); static int retrier(struct fdc_data *); static void fdbiodone(struct bio *); -static int fdmisccmd(dev_t, u_int, void *); +static int fdmisccmd(struct cdev *, u_int, void *); static d_ioctl_t fdioctl; static int fifo_threshold = 8; /* XXX: should be accessible via sysctl */ @@ -1881,7 +1881,7 @@ out_fdc(struct fdc_data *fdc, int x) * auxiliary functions). */ static int -fdopen(dev_t dev, int flags, int mode, struct thread *td) +fdopen(struct cdev *dev, int flags, int mode, struct thread *td) { fd_p fd; fdc_p fdc; @@ -1985,7 +1985,7 @@ fdopen(dev_t dev, int flags, int mode, struct thread *td) } static int -fdclose(dev_t dev, int flags, int mode, struct thread *td) +fdclose(struct cdev *dev, int flags, int mode, struct thread *td) { struct fd_data *fd; @@ -2184,7 +2184,7 @@ fdcpio(fdc_p fdc, long flags, caddr_t addr, u_int count) * Try figuring out the density of the media present in our device. */ static int -fdautoselect(dev_t dev) +fdautoselect(struct cdev *dev) { fd_p fd; struct fd_type *fdtp; @@ -2993,7 +2993,7 @@ fdbiodone(struct bio *bp) } static int -fdmisccmd(dev_t dev, u_int cmd, void *data) +fdmisccmd(struct cdev *dev, u_int cmd, void *data) { fdu_t fdu; fd_p fd; @@ -3044,7 +3044,7 @@ fdmisccmd(dev_t dev, u_int cmd, void *data) } static int -fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +fdioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { fdu_t fdu; fd_p fd; diff --git a/sys/pc98/cbus/gdc.c b/sys/pc98/cbus/gdc.c index eca0454dca2e..a22ad992f56c 100644 --- a/sys/pc98/cbus/gdc.c +++ b/sys/pc98/cbus/gdc.c @@ -346,7 +346,7 @@ gdc_release_resource(device_t dev) #ifdef FB_INSTALL_CDEV static int -gdcopen(dev_t dev, int flag, int mode, struct thread *td) +gdcopen(struct cdev *dev, int flag, int mode, struct thread *td) { gdc_softc_t *sc; @@ -360,7 +360,7 @@ gdcopen(dev_t dev, int flag, int mode, struct thread *td) } static int -gdcclose(dev_t dev, int flag, int mode, struct thread *td) +gdcclose(struct cdev *dev, int flag, int mode, struct thread *td) { gdc_softc_t *sc; @@ -369,7 +369,7 @@ gdcclose(dev_t dev, int flag, int mode, struct thread *td) } static int -gdcread(dev_t dev, struct uio *uio, int flag) +gdcread(struct cdev *dev, struct uio *uio, int flag) { gdc_softc_t *sc; @@ -378,7 +378,7 @@ gdcread(dev_t dev, struct uio *uio, int flag) } static int -gdcwrite(dev_t dev, struct uio *uio, int flag) +gdcwrite(struct cdev *dev, struct uio *uio, int flag) { gdc_softc_t *sc; @@ -387,7 +387,7 @@ gdcwrite(dev_t dev, struct uio *uio, int flag) } static int -gdcioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) +gdcioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) { gdc_softc_t *sc; @@ -396,7 +396,7 @@ gdcioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) } static int -gdcmmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +gdcmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) { gdc_softc_t *sc; diff --git a/sys/pc98/cbus/olpt.c b/sys/pc98/cbus/olpt.c index 49e78e01fa05..dc523db8db4b 100644 --- a/sys/pc98/cbus/olpt.c +++ b/sys/pc98/cbus/olpt.c @@ -466,7 +466,7 @@ lpt_attach(device_t dev) */ static int -lptopen (dev_t dev, int flags, int fmt, struct thread *td) +lptopen (struct cdev *dev, int flags, int fmt, struct thread *td) { struct lpt_softc *sc; int s; @@ -605,7 +605,7 @@ lptout (void *arg) */ static int -lptclose(dev_t dev, int flags, int fmt, struct thread *td) +lptclose(struct cdev *dev, int flags, int fmt, struct thread *td) { struct lpt_softc *sc; #ifndef PC98 @@ -718,7 +718,7 @@ pushbytes(struct lpt_softc * sc) */ static int -lptwrite(dev_t dev, struct uio * uio, int ioflag) +lptwrite(struct cdev *dev, struct uio * uio, int ioflag) { register unsigned n; int pl, err; @@ -776,7 +776,7 @@ lpt_intr(void *arg) } static int -lptioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) +lptioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { int error = 0; struct lpt_softc *sc; diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index 708c4a7534ee..9a98b65fe60e 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -351,7 +351,7 @@ struct com_s { struct resource *ioportres; int ioportrid; void *cookie; - dev_t devs[6]; + struct cdev *devs[6]; /* * Data area for output buffers. Someday we should build the output @@ -452,13 +452,13 @@ static int sysclock; #define IS_8251(if_type) (!(if_type & 0x10)) #define COM1_EXT_CLOCK 0x40000 -static void commint(dev_t dev); +static void commint(struct cdev *dev); static void com_tiocm_set(struct com_s *com, int msr); static void com_tiocm_bis(struct com_s *com, int msr); static void com_tiocm_bic(struct com_s *com, int msr); static int com_tiocm_get(struct com_s *com); static int com_tiocm_get_delta(struct com_s *com); -static void pc98_msrint_start(dev_t dev); +static void pc98_msrint_start(struct cdev *dev); static void com_cflag_and_speed_set(struct com_s *com, int cflag, int speed); static int pc98_ttspeedtab(struct com_s *com, int speed, u_int *divisor); static int pc98_get_modem_status(struct com_s *com); @@ -1847,7 +1847,7 @@ determined_type: ; static int sioopen(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag; int mode; struct thread *td; @@ -2080,7 +2080,7 @@ out: static int sioclose(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag; int mode; struct thread *td; @@ -2221,7 +2221,7 @@ comhardclose(com) static int sioread(dev, uio, flag) - dev_t dev; + struct cdev *dev; struct uio *uio; int flag; { @@ -2239,7 +2239,7 @@ sioread(dev, uio, flag) static int siowrite(dev, uio, flag) - dev_t dev; + struct cdev *dev; struct uio *uio; int flag; { @@ -2934,7 +2934,7 @@ txrdy: static int sioioctl(dev, cmd, data, flag, td) - dev_t dev; + struct cdev *dev; u_long cmd; caddr_t data; int flag; @@ -3861,7 +3861,7 @@ comwakeup(chan) #ifdef PC98 /* commint is called when modem control line changes */ static void -commint(dev_t dev) +commint(struct cdev *dev) { register struct tty *tp; int stat,delta; @@ -4551,9 +4551,9 @@ pc98_check_msr(void* chan) struct com_s *com; int mynor; int unit; - dev_t dev; + struct cdev *dev; - dev=(dev_t)chan; + dev=(struct cdev *)chan; mynor = minor(dev); unit = MINOR_TO_UNIT(mynor); com = com_addr(unit); @@ -4591,7 +4591,7 @@ pc98_check_msr(void* chan) } static void -pc98_msrint_start(dev_t dev) +pc98_msrint_start(struct cdev *dev) { struct com_s *com; int mynor; diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index a3a0b9720c88..315b4d3eca7c 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -1232,9 +1232,9 @@ SYSCTL_STRUCT(_machdep, CPU_BOOTINFO, bootinfo, SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock, CTLFLAG_RW, &wall_cmos_clock, 0, ""); -u_long bootdev; /* not a dev_t - encoding is different */ +u_long bootdev; /* not a struct cdev *- encoding is different */ SYSCTL_ULONG(_machdep, OID_AUTO, guessed_bootdev, - CTLFLAG_RD, &bootdev, 0, "Maybe the Boot device (not in dev_t format)"); + CTLFLAG_RD, &bootdev, 0, "Maybe the Boot device (not in struct cdev *format)"); /* * Initialize 386 and configure to run kernel diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c index dc6668aab656..a8ed55660b9d 100644 --- a/sys/pc98/pc98/fd.c +++ b/sys/pc98/pc98/fd.c @@ -379,7 +379,7 @@ struct fd_data { struct callout_handle toffhandle; struct callout_handle tohandle; struct devstat *device_stats; - dev_t masterdev; + struct cdev *masterdev; device_t dev; fdu_t fdu; #ifdef PC98 @@ -532,11 +532,11 @@ static timeout_t fd_iotimeout; static timeout_t fd_pseudointr; static driver_intr_t fdc_intr; static int fdcpio(fdc_p, long, caddr_t, u_int); -static int fdautoselect(dev_t); +static int fdautoselect(struct cdev *); static int fdstate(struct fdc_data *); static int retrier(struct fdc_data *); static void fdbiodone(struct bio *); -static int fdmisccmd(dev_t, u_int, void *); +static int fdmisccmd(struct cdev *, u_int, void *); static d_ioctl_t fdioctl; static int fifo_threshold = 8; /* XXX: should be accessible via sysctl */ @@ -1881,7 +1881,7 @@ out_fdc(struct fdc_data *fdc, int x) * auxiliary functions). */ static int -fdopen(dev_t dev, int flags, int mode, struct thread *td) +fdopen(struct cdev *dev, int flags, int mode, struct thread *td) { fd_p fd; fdc_p fdc; @@ -1985,7 +1985,7 @@ fdopen(dev_t dev, int flags, int mode, struct thread *td) } static int -fdclose(dev_t dev, int flags, int mode, struct thread *td) +fdclose(struct cdev *dev, int flags, int mode, struct thread *td) { struct fd_data *fd; @@ -2184,7 +2184,7 @@ fdcpio(fdc_p fdc, long flags, caddr_t addr, u_int count) * Try figuring out the density of the media present in our device. */ static int -fdautoselect(dev_t dev) +fdautoselect(struct cdev *dev) { fd_p fd; struct fd_type *fdtp; @@ -2993,7 +2993,7 @@ fdbiodone(struct bio *bp) } static int -fdmisccmd(dev_t dev, u_int cmd, void *data) +fdmisccmd(struct cdev *dev, u_int cmd, void *data) { fdu_t fdu; fd_p fd; @@ -3044,7 +3044,7 @@ fdmisccmd(dev_t dev, u_int cmd, void *data) } static int -fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +fdioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { fdu_t fdu; fd_p fd; diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index a3a0b9720c88..315b4d3eca7c 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -1232,9 +1232,9 @@ SYSCTL_STRUCT(_machdep, CPU_BOOTINFO, bootinfo, SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock, CTLFLAG_RW, &wall_cmos_clock, 0, ""); -u_long bootdev; /* not a dev_t - encoding is different */ +u_long bootdev; /* not a struct cdev *- encoding is different */ SYSCTL_ULONG(_machdep, OID_AUTO, guessed_bootdev, - CTLFLAG_RD, &bootdev, 0, "Maybe the Boot device (not in dev_t format)"); + CTLFLAG_RD, &bootdev, 0, "Maybe the Boot device (not in struct cdev *format)"); /* * Initialize 386 and configure to run kernel diff --git a/sys/pc98/pc98/mse.c b/sys/pc98/pc98/mse.c index 163931460245..9b8b83bcc12e 100644 --- a/sys/pc98/pc98/mse.c +++ b/sys/pc98/pc98/mse.c @@ -93,8 +93,8 @@ typedef struct mse_softc { u_char sc_bytes[MOUSE_SYS_PACKETSIZE]; struct callout_handle sc_callout; int sc_watchdog; - dev_t sc_dev; - dev_t sc_ndev; + struct cdev *sc_dev; + struct cdev *sc_ndev; mousehw_t hw; mousemode_t mode; mousestatus_t status; @@ -446,7 +446,7 @@ mse_detach(dev) */ static int mseopen(dev, flags, fmt, td) - dev_t dev; + struct cdev *dev; int flags; int fmt; struct thread *td; @@ -486,7 +486,7 @@ mseopen(dev, flags, fmt, td) */ static int mseclose(dev, flags, fmt, td) - dev_t dev; + struct cdev *dev; int flags; int fmt; struct thread *td; @@ -510,7 +510,7 @@ mseclose(dev, flags, fmt, td) */ static int mseread(dev, uio, ioflag) - dev_t dev; + struct cdev *dev; struct uio *uio; int ioflag; { @@ -577,7 +577,7 @@ mseread(dev, uio, ioflag) */ static int mseioctl(dev, cmd, addr, flag, td) - dev_t dev; + struct cdev *dev; u_long cmd; caddr_t addr; int flag; @@ -694,7 +694,7 @@ mseioctl(dev, cmd, addr, flag, td) */ static int msepoll(dev, events, td) - dev_t dev; + struct cdev *dev; int events; struct thread *td; { @@ -727,10 +727,10 @@ static void msetimeout(arg) void *arg; { - dev_t dev; + struct cdev *dev; mse_softc_t *sc; - dev = (dev_t)arg; + dev = (struct cdev *)arg; sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); if (sc->sc_watchdog) { if (bootverbose) diff --git a/sys/pc98/pc98/olpt.c b/sys/pc98/pc98/olpt.c index 49e78e01fa05..dc523db8db4b 100644 --- a/sys/pc98/pc98/olpt.c +++ b/sys/pc98/pc98/olpt.c @@ -466,7 +466,7 @@ lpt_attach(device_t dev) */ static int -lptopen (dev_t dev, int flags, int fmt, struct thread *td) +lptopen (struct cdev *dev, int flags, int fmt, struct thread *td) { struct lpt_softc *sc; int s; @@ -605,7 +605,7 @@ lptout (void *arg) */ static int -lptclose(dev_t dev, int flags, int fmt, struct thread *td) +lptclose(struct cdev *dev, int flags, int fmt, struct thread *td) { struct lpt_softc *sc; #ifndef PC98 @@ -718,7 +718,7 @@ pushbytes(struct lpt_softc * sc) */ static int -lptwrite(dev_t dev, struct uio * uio, int ioflag) +lptwrite(struct cdev *dev, struct uio * uio, int ioflag) { register unsigned n; int pl, err; @@ -776,7 +776,7 @@ lpt_intr(void *arg) } static int -lptioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) +lptioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { int error = 0; struct lpt_softc *sc; diff --git a/sys/pc98/pc98/pc98gdc.c b/sys/pc98/pc98/pc98gdc.c index eca0454dca2e..a22ad992f56c 100644 --- a/sys/pc98/pc98/pc98gdc.c +++ b/sys/pc98/pc98/pc98gdc.c @@ -346,7 +346,7 @@ gdc_release_resource(device_t dev) #ifdef FB_INSTALL_CDEV static int -gdcopen(dev_t dev, int flag, int mode, struct thread *td) +gdcopen(struct cdev *dev, int flag, int mode, struct thread *td) { gdc_softc_t *sc; @@ -360,7 +360,7 @@ gdcopen(dev_t dev, int flag, int mode, struct thread *td) } static int -gdcclose(dev_t dev, int flag, int mode, struct thread *td) +gdcclose(struct cdev *dev, int flag, int mode, struct thread *td) { gdc_softc_t *sc; @@ -369,7 +369,7 @@ gdcclose(dev_t dev, int flag, int mode, struct thread *td) } static int -gdcread(dev_t dev, struct uio *uio, int flag) +gdcread(struct cdev *dev, struct uio *uio, int flag) { gdc_softc_t *sc; @@ -378,7 +378,7 @@ gdcread(dev_t dev, struct uio *uio, int flag) } static int -gdcwrite(dev_t dev, struct uio *uio, int flag) +gdcwrite(struct cdev *dev, struct uio *uio, int flag) { gdc_softc_t *sc; @@ -387,7 +387,7 @@ gdcwrite(dev_t dev, struct uio *uio, int flag) } static int -gdcioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) +gdcioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) { gdc_softc_t *sc; @@ -396,7 +396,7 @@ gdcioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) } static int -gdcmmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +gdcmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) { gdc_softc_t *sc; diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c index 708c4a7534ee..9a98b65fe60e 100644 --- a/sys/pc98/pc98/sio.c +++ b/sys/pc98/pc98/sio.c @@ -351,7 +351,7 @@ struct com_s { struct resource *ioportres; int ioportrid; void *cookie; - dev_t devs[6]; + struct cdev *devs[6]; /* * Data area for output buffers. Someday we should build the output @@ -452,13 +452,13 @@ static int sysclock; #define IS_8251(if_type) (!(if_type & 0x10)) #define COM1_EXT_CLOCK 0x40000 -static void commint(dev_t dev); +static void commint(struct cdev *dev); static void com_tiocm_set(struct com_s *com, int msr); static void com_tiocm_bis(struct com_s *com, int msr); static void com_tiocm_bic(struct com_s *com, int msr); static int com_tiocm_get(struct com_s *com); static int com_tiocm_get_delta(struct com_s *com); -static void pc98_msrint_start(dev_t dev); +static void pc98_msrint_start(struct cdev *dev); static void com_cflag_and_speed_set(struct com_s *com, int cflag, int speed); static int pc98_ttspeedtab(struct com_s *com, int speed, u_int *divisor); static int pc98_get_modem_status(struct com_s *com); @@ -1847,7 +1847,7 @@ determined_type: ; static int sioopen(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag; int mode; struct thread *td; @@ -2080,7 +2080,7 @@ out: static int sioclose(dev, flag, mode, td) - dev_t dev; + struct cdev *dev; int flag; int mode; struct thread *td; @@ -2221,7 +2221,7 @@ comhardclose(com) static int sioread(dev, uio, flag) - dev_t dev; + struct cdev *dev; struct uio *uio; int flag; { @@ -2239,7 +2239,7 @@ sioread(dev, uio, flag) static int siowrite(dev, uio, flag) - dev_t dev; + struct cdev *dev; struct uio *uio; int flag; { @@ -2934,7 +2934,7 @@ txrdy: static int sioioctl(dev, cmd, data, flag, td) - dev_t dev; + struct cdev *dev; u_long cmd; caddr_t data; int flag; @@ -3861,7 +3861,7 @@ comwakeup(chan) #ifdef PC98 /* commint is called when modem control line changes */ static void -commint(dev_t dev) +commint(struct cdev *dev) { register struct tty *tp; int stat,delta; @@ -4551,9 +4551,9 @@ pc98_check_msr(void* chan) struct com_s *com; int mynor; int unit; - dev_t dev; + struct cdev *dev; - dev=(dev_t)chan; + dev=(struct cdev *)chan; mynor = minor(dev); unit = MINOR_TO_UNIT(mynor); com = com_addr(unit); @@ -4591,7 +4591,7 @@ pc98_check_msr(void* chan) } static void -pc98_msrint_start(dev_t dev) +pc98_msrint_start(struct cdev *dev) { struct com_s *com; int mynor; diff --git a/sys/pc98/pc98/wd_cd.c b/sys/pc98/pc98/wd_cd.c index ef508c0394e8..5ac001ea018d 100644 --- a/sys/pc98/pc98/wd_cd.c +++ b/sys/pc98/pc98/wd_cd.c @@ -97,7 +97,7 @@ struct acd * acd_init_lun(struct atapi *ata, int unit, struct atapi_params *ap, int lun) { struct acd *ptr; - dev_t pdev; + struct cdev *pdev; if (!(ptr = malloc(sizeof(struct acd), M_TEMP, M_NOWAIT | M_ZERO))) return NULL; @@ -360,7 +360,7 @@ acd_describe(struct acd *cdp) } static int -acdopen(dev_t dev, int flags, int fmt, struct thread *td) +acdopen(struct cdev *dev, int flags, int fmt, struct thread *td) { struct acd *cdp; @@ -385,7 +385,7 @@ acdopen(dev_t dev, int flags, int fmt, struct thread *td) } int -acdclose(dev_t dev, int flags, int fmt, struct thread *td) +acdclose(struct cdev *dev, int flags, int fmt, struct thread *td) { struct acd *cdp = dev->si_drv1; @@ -550,7 +550,7 @@ msf2lba(u_char m, u_char s, u_char f) } int -acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +acdioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct acd *cdp = dev->si_drv1; int error = 0; diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c index b4d15ffdd23f..876c2414f10e 100644 --- a/sys/pccard/pccard.c +++ b/sys/pccard/pccard.c @@ -349,7 +349,7 @@ pccard_event(struct slot *slt, enum card_event event) * Device driver interface. */ static int -crdopen(dev_t dev, int oflags, int devtype, d_thread_t *td) +crdopen(struct cdev *dev, int oflags, int devtype, d_thread_t *td) { struct slot *slt = PCCARD_DEV2SOFTC(dev); @@ -365,7 +365,7 @@ crdopen(dev_t dev, int oflags, int devtype, d_thread_t *td) * slots may be assigned to drivers already. */ static int -crdclose(dev_t dev, int fflag, int devtype, d_thread_t *td) +crdclose(struct cdev *dev, int fflag, int devtype, d_thread_t *td) { return (0); } @@ -375,7 +375,7 @@ crdclose(dev_t dev, int fflag, int devtype, d_thread_t *td) * then transfer to user space. */ static int -crdread(dev_t dev, struct uio *uio, int ioflag) +crdread(struct cdev *dev, struct uio *uio, int ioflag) { struct slot *slt = PCCARD_DEV2SOFTC(dev); struct mem_desc *mp, oldmap; @@ -421,7 +421,7 @@ crdread(dev_t dev, struct uio *uio, int ioflag) * window is used. */ static int -crdwrite(dev_t dev, struct uio *uio, int ioflag) +crdwrite(struct cdev *dev, struct uio *uio, int ioflag) { struct slot *slt = PCCARD_DEV2SOFTC(dev); struct mem_desc *mp, oldmap; @@ -466,7 +466,7 @@ crdwrite(dev_t dev, struct uio *uio, int ioflag) * descriptors, and assignment of drivers. */ static int -crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, d_thread_t *td) +crdioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, d_thread_t *td) { u_int32_t addr; int err; @@ -667,7 +667,7 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, d_thread_t *td) * when a change in card status occurs. */ static int -crdpoll(dev_t dev, int events, d_thread_t *td) +crdpoll(struct cdev *dev, int events, d_thread_t *td) { int revents = 0; int s; diff --git a/sys/pccard/slot.h b/sys/pccard/slot.h index ff248aef77a0..a91098328553 100644 --- a/sys/pccard/slot.h +++ b/sys/pccard/slot.h @@ -125,7 +125,7 @@ struct slot { void *cdata; /* Controller specific data */ int pwr_off_pending;/* Power status of slot */ device_t dev; /* Config system device. */ - dev_t d; /* fs device */ + struct cdev *d; /* fs device */ }; #define PCCARD_DEVICE2SOFTC(d) ((struct slot *) device_get_softc(d)) diff --git a/sys/pci/agp.c b/sys/pci/agp.c index 46f10a3c5c54..239b5bff93d0 100644 --- a/sys/pci/agp.c +++ b/sys/pci/agp.c @@ -762,7 +762,7 @@ agp_unbind_user(device_t dev, agp_unbind *unbind) } static int -agp_open(dev_t kdev, int oflags, int devtype, struct thread *td) +agp_open(struct cdev *kdev, int oflags, int devtype, struct thread *td) { device_t dev = KDEV2DEV(kdev); struct agp_softc *sc = device_get_softc(dev); @@ -776,7 +776,7 @@ agp_open(dev_t kdev, int oflags, int devtype, struct thread *td) } static int -agp_close(dev_t kdev, int fflag, int devtype, struct thread *td) +agp_close(struct cdev *kdev, int fflag, int devtype, struct thread *td) { device_t dev = KDEV2DEV(kdev); struct agp_softc *sc = device_get_softc(dev); @@ -799,7 +799,7 @@ agp_close(dev_t kdev, int fflag, int devtype, struct thread *td) } static int -agp_ioctl(dev_t kdev, u_long cmd, caddr_t data, int fflag, struct thread *td) +agp_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int fflag, struct thread *td) { device_t dev = KDEV2DEV(kdev); @@ -834,7 +834,7 @@ agp_ioctl(dev_t kdev, u_long cmd, caddr_t data, int fflag, struct thread *td) } static int -agp_mmap(dev_t kdev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +agp_mmap(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr, int prot) { device_t dev = KDEV2DEV(kdev); struct agp_softc *sc = device_get_softc(dev); diff --git a/sys/pci/agppriv.h b/sys/pci/agppriv.h index 6ba4ed60b4af..7e846d17cdff 100644 --- a/sys/pci/agppriv.h +++ b/sys/pci/agppriv.h @@ -75,7 +75,7 @@ struct agp_softc { struct agp_memory_list as_memory; /* list of allocated memory */ int as_nextid; /* next memory block id */ int as_isopen; /* user device is open */ - dev_t as_devnode; /* from make_dev */ + struct cdev *as_devnode; /* from make_dev */ struct mtx as_lock; /* lock for access to GATT */ }; diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c index ad5366e8aebc..b80191657260 100644 --- a/sys/pci/if_ti.c +++ b/sys/pci/if_ti.c @@ -3121,7 +3121,7 @@ ti_ioctl(ifp, command, data) } static int -ti_open(dev_t dev, int flags, int fmt, struct thread *td) +ti_open(struct cdev *dev, int flags, int fmt, struct thread *td) { struct ti_softc *sc; @@ -3137,7 +3137,7 @@ ti_open(dev_t dev, int flags, int fmt, struct thread *td) } static int -ti_close(dev_t dev, int flag, int fmt, struct thread *td) +ti_close(struct cdev *dev, int flag, int fmt, struct thread *td) { struct ti_softc *sc; @@ -3156,7 +3156,7 @@ ti_close(dev_t dev, int flag, int fmt, struct thread *td) * This ioctl routine goes along with the Tigon character device. */ static int -ti_ioctl2(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) +ti_ioctl2(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { int error; struct ti_softc *sc; diff --git a/sys/pci/if_tireg.h b/sys/pci/if_tireg.h index 71d9661a5eb0..35525149996f 100644 --- a/sys/pci/if_tireg.h +++ b/sys/pci/if_tireg.h @@ -1025,7 +1025,7 @@ struct ti_softc { int ti_txcnt; struct mtx ti_mtx; ti_flag_vals ti_flags; - dev_t dev; + struct cdev *dev; }; #define TI_LOCK(_sc) mtx_lock(&(_sc)->ti_mtx) diff --git a/sys/pci/xrpu.c b/sys/pci/xrpu.c index 38014a3f8911..7ec18a5c6124 100644 --- a/sys/pci/xrpu.c +++ b/sys/pci/xrpu.c @@ -113,7 +113,7 @@ xrpu_poll_pps(struct timecounter *tc) } static int -xrpu_open(dev_t dev, int flag, int mode, struct thread *td) +xrpu_open(struct cdev *dev, int flag, int mode, struct thread *td) { struct softc *sc = devclass_get_softc(xrpu_devclass, dev2unit(dev)); @@ -124,13 +124,13 @@ xrpu_open(dev_t dev, int flag, int mode, struct thread *td) } static int -xrpu_close(dev_t dev, int flag, int mode, struct thread *td) +xrpu_close(struct cdev *dev, int flag, int mode, struct thread *td) { return (0); } static int -xrpu_mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +xrpu_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) { struct softc *sc = dev->si_drv1; if (offset >= 0x1000000) @@ -140,7 +140,7 @@ xrpu_mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) } static int -xrpu_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *tdr) +xrpu_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *tdr) { struct softc *sc = dev->si_drv1; int i, error; diff --git a/sys/powerpc/ofw/ofw_syscons.h b/sys/powerpc/ofw/ofw_syscons.h index de7308e856ad..5c7f46d077d9 100644 --- a/sys/powerpc/ofw/ofw_syscons.h +++ b/sys/powerpc/ofw/ofw_syscons.h @@ -31,7 +31,7 @@ struct ofwfb_softc { video_adapter_t sc_va; - dev_t sc_si; + struct cdev *sc_si; phandle_t sc_node; int sc_console; diff --git a/sys/security/mac/mac_framework.h b/sys/security/mac/mac_framework.h index 45abe171eccf..172c8c2eb21e 100644 --- a/sys/security/mac/mac_framework.h +++ b/sys/security/mac/mac_framework.h @@ -106,6 +106,7 @@ __END_DECLS * Kernel functions to manage and evaluate labels. */ struct bpf_d; +struct cdev; struct componentname; struct devfs_dirent; struct ifnet; @@ -178,7 +179,7 @@ void mac_associate_vnode_devfs(struct mount *mp, struct devfs_dirent *de, struct vnode *vp); int mac_associate_vnode_extattr(struct mount *mp, struct vnode *vp); void mac_associate_vnode_singlelabel(struct mount *mp, struct vnode *vp); -void mac_create_devfs_device(struct mount *mp, dev_t dev, +void mac_create_devfs_device(struct mount *mp, struct cdev *dev, struct devfs_dirent *de); void mac_create_devfs_directory(struct mount *mp, char *dirname, int dirnamelen, struct devfs_dirent *de); diff --git a/sys/security/mac/mac_policy.h b/sys/security/mac/mac_policy.h index 8bcc1beee358..1748a40d8ed3 100644 --- a/sys/security/mac/mac_policy.h +++ b/sys/security/mac/mac_policy.h @@ -167,7 +167,7 @@ struct mac_policy_ops { void (*mpo_associate_vnode_singlelabel)(struct mount *mp, struct label *fslabel, struct vnode *vp, struct label *vlabel); - void (*mpo_create_devfs_device)(struct mount *mp, dev_t dev, + void (*mpo_create_devfs_device)(struct mount *mp, struct cdev *dev, struct devfs_dirent *de, struct label *label); void (*mpo_create_devfs_directory)(struct mount *mp, char *dirname, int dirnamelen, struct devfs_dirent *de, diff --git a/sys/security/mac/mac_vfs.c b/sys/security/mac/mac_vfs.c index efcb7105e67e..647260733e5c 100644 --- a/sys/security/mac/mac_vfs.c +++ b/sys/security/mac/mac_vfs.c @@ -938,7 +938,7 @@ mac_check_mount_stat(struct ucred *cred, struct mount *mount) } void -mac_create_devfs_device(struct mount *mp, dev_t dev, struct devfs_dirent *de) +mac_create_devfs_device(struct mount *mp, struct cdev *dev, struct devfs_dirent *de) { MAC_PERFORM(create_devfs_device, mp, dev, de, de->de_label); diff --git a/sys/security/mac_biba/mac_biba.c b/sys/security/mac_biba/mac_biba.c index 545ba43bed03..005c967775a3 100644 --- a/sys/security/mac_biba/mac_biba.c +++ b/sys/security/mac_biba/mac_biba.c @@ -772,7 +772,7 @@ mac_biba_copy_label(struct label *src, struct label *dest) * a lot like file system objects. */ static void -mac_biba_create_devfs_device(struct mount *mp, dev_t dev, +mac_biba_create_devfs_device(struct mount *mp, struct cdev *dev, struct devfs_dirent *devfs_dirent, struct label *label) { struct mac_biba *mac_biba; diff --git a/sys/security/mac_lomac/mac_lomac.c b/sys/security/mac_lomac/mac_lomac.c index 9502c05bcf09..9d4ef7b8a032 100644 --- a/sys/security/mac_lomac/mac_lomac.c +++ b/sys/security/mac_lomac/mac_lomac.c @@ -897,7 +897,7 @@ mac_lomac_copy_label(struct label *src, struct label *dest) * a lot like file system objects. */ static void -mac_lomac_create_devfs_device(struct mount *mp, dev_t dev, +mac_lomac_create_devfs_device(struct mount *mp, struct cdev *dev, struct devfs_dirent *devfs_dirent, struct label *label) { struct mac_lomac *mac_lomac; diff --git a/sys/security/mac_mls/mac_mls.c b/sys/security/mac_mls/mac_mls.c index 3e883ee3f6c8..e683790e9986 100644 --- a/sys/security/mac_mls/mac_mls.c +++ b/sys/security/mac_mls/mac_mls.c @@ -739,7 +739,7 @@ mac_mls_copy_label(struct label *src, struct label *dest) * a lot like file system objects. */ static void -mac_mls_create_devfs_device(struct mount *mp, dev_t dev, +mac_mls_create_devfs_device(struct mount *mp, struct cdev *dev, struct devfs_dirent *devfs_dirent, struct label *label) { struct mac_mls *mac_mls; diff --git a/sys/security/mac_stub/mac_stub.c b/sys/security/mac_stub/mac_stub.c index ea113e126b5a..f6874880d4f8 100644 --- a/sys/security/mac_stub/mac_stub.c +++ b/sys/security/mac_stub/mac_stub.c @@ -178,7 +178,7 @@ stub_associate_vnode_singlelabel(struct mount *mp, } static void -stub_create_devfs_device(struct mount *mp, dev_t dev, +stub_create_devfs_device(struct mount *mp, struct cdev *dev, struct devfs_dirent *devfs_dirent, struct label *label) { diff --git a/sys/security/mac_test/mac_test.c b/sys/security/mac_test/mac_test.c index 16f1a98f4b4b..21be15533060 100644 --- a/sys/security/mac_test/mac_test.c +++ b/sys/security/mac_test/mac_test.c @@ -692,7 +692,7 @@ mac_test_associate_vnode_singlelabel(struct mount *mp, } static void -mac_test_create_devfs_device(struct mount *mp, dev_t dev, +mac_test_create_devfs_device(struct mount *mp, struct cdev *dev, struct devfs_dirent *devfs_dirent, struct label *label) { diff --git a/sys/sparc64/creator/creator.h b/sys/sparc64/creator/creator.h index 6fa42f731525..b3be9e2ae5d3 100644 --- a/sys/sparc64/creator/creator.h +++ b/sys/sparc64/creator/creator.h @@ -142,7 +142,7 @@ struct creator_softc { video_adapter_t sc_va; /* XXX must be first */ - dev_t sc_si; + struct cdev *sc_si; struct resource *sc_reg[FFB_NREG]; bus_space_tag_t sc_bt[FFB_NREG]; diff --git a/sys/sparc64/creator/creator_upa.c b/sys/sparc64/creator/creator_upa.c index 255d70160211..864f0b8f2c33 100644 --- a/sys/sparc64/creator/creator_upa.c +++ b/sys/sparc64/creator/creator_upa.c @@ -212,19 +212,19 @@ creator_upa_attach(device_t dev) } static int -creator_open(dev_t dev, int flags, int mode, struct thread *td) +creator_open(struct cdev *dev, int flags, int mode, struct thread *td) { return (0); } static int -creator_close(dev_t dev, int flags, int mode, struct thread *td) +creator_close(struct cdev *dev, int flags, int mode, struct thread *td) { return (0); } static int -creator_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, +creator_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) { struct creator_softc *sc; @@ -262,7 +262,7 @@ creator_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, } static int -creator_mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) +creator_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) { struct creator_softc *sc; struct ffb_map *fm; diff --git a/sys/sparc64/include/cpu.h b/sys/sparc64/include/cpu.h index b00280d7edcf..6778d0447593 100644 --- a/sys/sparc64/include/cpu.h +++ b/sys/sparc64/include/cpu.h @@ -52,7 +52,7 @@ /* * CTL_MACHDEP definitions. */ -#define CPU_CONSDEV 1 /* dev_t: console terminal device */ +#define CPU_CONSDEV 1 /* struct cdev *: console terminal device */ #define CPU_ADJKERNTZ 2 /* int: timezone offset (seconds) */ #define CPU_DISRTCSET 3 /* int: disable resettodr() call */ #define CPU_BOOTINFO 4 /* struct: bootinfo */ diff --git a/sys/sparc64/sparc64/mem.c b/sys/sparc64/sparc64/mem.c index fca7c49eaa8f..d7a18185341f 100644 --- a/sys/sparc64/sparc64/mem.c +++ b/sys/sparc64/sparc64/mem.c @@ -73,7 +73,7 @@ #include #include -static dev_t memdev, kmemdev; +static struct cdev *memdev, *kmemdev; static d_open_t mmopen; static d_close_t mmclose; @@ -92,14 +92,14 @@ static struct cdevsw mem_cdevsw = { }; static int -mmclose(dev_t dev, int flags, int fmt, struct thread *td) +mmclose(struct cdev *dev, int flags, int fmt, struct thread *td) { return (0); } static int -mmopen(dev_t dev, int flags, int fmt, struct thread *td) +mmopen(struct cdev *dev, int flags, int fmt, struct thread *td) { int error; @@ -120,7 +120,7 @@ mmopen(dev_t dev, int flags, int fmt, struct thread *td) /*ARGSUSED*/ static int -mmrw(dev_t dev, struct uio *uio, int flags) +mmrw(struct cdev *dev, struct uio *uio, int flags) { struct iovec *iov; vm_offset_t eva; diff --git a/sys/sys/_types.h b/sys/sys/_types.h index f233c7005e9d..478fd419543d 100644 --- a/sys/sys/_types.h +++ b/sys/sys/_types.h @@ -80,12 +80,7 @@ typedef __ct_rune_t __rune_t; /* rune_t (see above) */ typedef __ct_rune_t __wchar_t; /* wchar_t (see above) */ typedef __ct_rune_t __wint_t; /* wint_t (see above) */ -/* - * dev_t has differing meanings in userland and the kernel. - */ -#ifdef _KERNEL -typedef struct cdev *__dev_t; -#else +#ifndef _KERNEL typedef __udev_t __dev_t; /* device number */ #endif diff --git a/sys/sys/bio.h b/sys/sys/bio.h index 12a9c0e59ccb..be9b20e02053 100644 --- a/sys/sys/bio.h +++ b/sys/sys/bio.h @@ -50,7 +50,7 @@ typedef void bio_task_t(void *); */ struct bio { u_int bio_cmd; /* I/O operation. */ - dev_t bio_dev; /* Device to do I/O on. */ + struct cdev *bio_dev; /* Device to do I/O on. */ struct disk *bio_disk; /* Valid below geom_disk.c only */ off_t bio_offset; /* Offset into file. */ long bio_bcount; /* Valid bytes in buffer. */ @@ -120,7 +120,7 @@ void bioq_remove(struct bio_queue_head *head, struct bio *bp); void bio_taskqueue(struct bio *bp, bio_task_t *fund, void *arg); -int physio(dev_t dev, struct uio *uio, int ioflag); +int physio(struct cdev *dev, struct uio *uio, int ioflag); #define physread physio #define physwrite physio diff --git a/sys/sys/conf.h b/sys/sys/conf.h index acbd04b2e05e..d97db9350a93 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -55,7 +55,7 @@ struct cdev { #define SI_ALIAS 0x0002 /* carrier of alias name */ #define SI_NAMED 0x0004 /* make_dev{_alias} has been called */ #define SI_CHEAPCLONE 0x0008 /* can be removed_dev'ed when vnode reclaims */ -#define SI_CHILD 0x0010 /* child of another dev_t */ +#define SI_CHILD 0x0010 /* child of another struct cdev **/ #define SI_DEVOPEN 0x0020 /* opened by device */ #define SI_CONSOPEN 0x0040 /* opened by console */ #define SI_DUMPDEV 0x0080 /* is kernel dumpdev */ @@ -72,7 +72,7 @@ struct cdev { SLIST_HEAD(, vnode) si_hlist; LIST_HEAD(, cdev) si_children; LIST_ENTRY(cdev) si_siblings; - dev_t si_parent; + struct cdev *si_parent; u_int si_inode; char *si_name; void *si_drv1, *si_drv2; @@ -145,18 +145,18 @@ struct clonedevs; typedef struct thread d_thread_t; -typedef int d_open_t(dev_t dev, int oflags, int devtype, struct thread *td); -typedef int d_fdopen_t(dev_t dev, int oflags, struct thread *td, int fdidx); -typedef int d_close_t(dev_t dev, int fflag, int devtype, struct thread *td); +typedef int d_open_t(struct cdev *dev, int oflags, int devtype, struct thread *td); +typedef int d_fdopen_t(struct cdev *dev, int oflags, struct thread *td, int fdidx); +typedef int d_close_t(struct cdev *dev, int fflag, int devtype, struct thread *td); typedef void d_strategy_t(struct bio *bp); -typedef int d_ioctl_t(dev_t dev, u_long cmd, caddr_t data, +typedef int d_ioctl_t(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td); -typedef int d_read_t(dev_t dev, struct uio *uio, int ioflag); -typedef int d_write_t(dev_t dev, struct uio *uio, int ioflag); -typedef int d_poll_t(dev_t dev, int events, struct thread *td); -typedef int d_kqfilter_t(dev_t dev, struct knote *kn); -typedef int d_mmap_t(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, +typedef int d_read_t(struct cdev *dev, struct uio *uio, int ioflag); +typedef int d_write_t(struct cdev *dev, struct uio *uio, int ioflag); +typedef int d_poll_t(struct cdev *dev, int events, struct thread *td); +typedef int d_kqfilter_t(struct cdev *dev, struct knote *kn); +typedef int d_mmap_t(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot); typedef int dumper_t( @@ -262,30 +262,30 @@ void clone_setup(struct clonedevs **cdp); void clone_cleanup(struct clonedevs **); #define CLONE_UNITMASK 0xfffff #define CLONE_FLAG0 (CLONE_UNITMASK + 1) -int clone_create(struct clonedevs **, struct cdevsw *, int *unit, dev_t *dev, u_int extra); +int clone_create(struct clonedevs **, struct cdevsw *, int *unit, struct cdev **dev, u_int extra); -int count_dev(dev_t _dev); -void destroy_dev(dev_t _dev); -struct cdevsw *devsw(dev_t _dev); +int count_dev(struct cdev *_dev); +void destroy_dev(struct cdev *_dev); +struct cdevsw *devsw(struct cdev *_dev); void cdevsw_ref(struct cdevsw *); void cdevsw_rel(struct cdevsw *); -const char *devtoname(dev_t _dev); -int dev_named(dev_t _pdev, const char *_name); -void dev_depends(dev_t _pdev, dev_t _cdev); -void dev_ref(dev_t dev); -void dev_rel(dev_t dev); +const char *devtoname(struct cdev *_dev); +int dev_named(struct cdev *_pdev, const char *_name); +void dev_depends(struct cdev *_pdev, struct cdev *_cdev); +void dev_ref(struct cdev *dev); +void dev_rel(struct cdev *dev); void dev_strategy(struct buf *bp); -dev_t makebdev(int _maj, int _min); -dev_t make_dev(struct cdevsw *_devsw, int _minor, uid_t _uid, gid_t _gid, +struct cdev *makebdev(int _maj, int _min); +struct cdev *make_dev(struct cdevsw *_devsw, int _minor, uid_t _uid, gid_t _gid, int _perms, const char *_fmt, ...) __printflike(6, 7); -dev_t make_dev_alias(dev_t _pdev, const char *_fmt, ...) __printflike(2, 3); -int dev2unit(dev_t _dev); +struct cdev *make_dev_alias(struct cdev *_pdev, const char *_fmt, ...) __printflike(2, 3); +int dev2unit(struct cdev *_dev); int unit2minor(int _unit); void setconf(void); -dev_t getdiskbyname(char *_name); +struct cdev *getdiskbyname(char *_name); -void devfs_create(dev_t dev); -void devfs_destroy(dev_t dev); +void devfs_create(struct cdev *dev); +void devfs_destroy(struct cdev *dev); #define UID_ROOT 0 #define UID_BIN 3 @@ -298,7 +298,7 @@ void devfs_destroy(dev_t dev); #define GID_GAMES 13 #define GID_DIALER 68 -typedef void (*dev_clone_fn)(void *arg, char *name, int namelen, dev_t *result); +typedef void (*dev_clone_fn)(void *arg, char *name, int namelen, struct cdev **result); int dev_stdclone(char *_name, char **_namep, const char *_stem, int *_unit); EVENTHANDLER_DECLARE(dev_clone, dev_clone_fn); diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h index c24194d48cc6..5c378f782d83 100644 --- a/sys/sys/linedisc.h +++ b/sys/sys/linedisc.h @@ -44,7 +44,7 @@ struct tty; -typedef int l_open_t(dev_t dev, struct tty *tp); +typedef int l_open_t(struct cdev *dev, struct tty *tp); typedef int l_close_t(struct tty *tp, int flag); typedef int l_read_t(struct tty *tp, struct uio *uio, int flag); typedef int l_write_t(struct tty *tp, struct uio *uio, int flag); @@ -81,7 +81,7 @@ l_write_t l_nowrite; l_ioctl_t l_nullioctl; static __inline int -ttyld_open(struct tty *tp, dev_t dev) +ttyld_open(struct tty *tp, struct cdev *dev) { return ((*linesw[tp->t_line]->l_open)(dev, tp)); diff --git a/sys/sys/mac.h b/sys/sys/mac.h index 45abe171eccf..172c8c2eb21e 100644 --- a/sys/sys/mac.h +++ b/sys/sys/mac.h @@ -106,6 +106,7 @@ __END_DECLS * Kernel functions to manage and evaluate labels. */ struct bpf_d; +struct cdev; struct componentname; struct devfs_dirent; struct ifnet; @@ -178,7 +179,7 @@ void mac_associate_vnode_devfs(struct mount *mp, struct devfs_dirent *de, struct vnode *vp); int mac_associate_vnode_extattr(struct mount *mp, struct vnode *vp); void mac_associate_vnode_singlelabel(struct mount *mp, struct vnode *vp); -void mac_create_devfs_device(struct mount *mp, dev_t dev, +void mac_create_devfs_device(struct mount *mp, struct cdev *dev, struct devfs_dirent *de); void mac_create_devfs_directory(struct mount *mp, char *dirname, int dirnamelen, struct devfs_dirent *de); diff --git a/sys/sys/mac_policy.h b/sys/sys/mac_policy.h index 8bcc1beee358..1748a40d8ed3 100644 --- a/sys/sys/mac_policy.h +++ b/sys/sys/mac_policy.h @@ -167,7 +167,7 @@ struct mac_policy_ops { void (*mpo_associate_vnode_singlelabel)(struct mount *mp, struct label *fslabel, struct vnode *vp, struct label *vlabel); - void (*mpo_create_devfs_device)(struct mount *mp, dev_t dev, + void (*mpo_create_devfs_device)(struct mount *mp, struct cdev *dev, struct devfs_dirent *de, struct label *label); void (*mpo_create_devfs_directory)(struct mount *mp, char *dirname, int dirnamelen, struct devfs_dirent *de, diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 07d8d5906023..e1ab3ce084c4 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -496,7 +496,7 @@ struct netcred *vfs_export_lookup /* lookup host in fs export list */ (struct mount *, struct sockaddr *); int vfs_allocate_syncvnode(struct mount *); void vfs_getnewfsid(struct mount *); -dev_t vfs_getrootfsid(struct mount *); +struct cdev *vfs_getrootfsid(struct mount *); struct mount *vfs_getvfs(fsid_t *); /* return vfs given fsid */ int vfs_modevent(module_t, int, void *); int vfs_mountedon(struct vnode *); /* is a vfs mounted on vp */ diff --git a/sys/sys/param.h b/sys/sys/param.h index ad72535c1b7d..67a8e9831ae0 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -55,7 +55,7 @@ * scheme is: <0 if release branch, otherwise 1>xx */ #undef __FreeBSD_version -#define __FreeBSD_version 502115 /* Master, propagated to newvers */ +#define __FreeBSD_version 502116 /* Master, propagated to newvers */ #ifndef LOCORE #include diff --git a/sys/sys/stat.h b/sys/sys/stat.h index c4376da8eee9..0f7f4a33d8c0 100644 --- a/sys/sys/stat.h +++ b/sys/sys/stat.h @@ -44,7 +44,9 @@ /* XXX missing blkcnt_t, blksize_t. */ #ifndef _DEV_T_DECLARED +#ifndef _KERNEL typedef __dev_t dev_t; +#endif #define _DEV_T_DECLARED #endif diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index 4ebbc715606e..2165c63832d0 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -351,7 +351,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); #define KERN_BOOTFILE 26 /* string: name of booted kernel */ #define KERN_MAXFILESPERPROC 27 /* int: max open files per proc */ #define KERN_MAXPROCPERUID 28 /* int: max processes per uid */ -#define KERN_DUMPDEV 29 /* dev_t: device to dump on */ +#define KERN_DUMPDEV 29 /* struct cdev *: device to dump on */ #define KERN_IPC 30 /* node: anything related to IPC */ #define KERN_DUMMY 31 /* unused */ #define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */ diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 44c57034d008..1a06d821ca22 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -63,8 +63,8 @@ extern struct cv selwait; /* select conditional variable */ extern long physmem; /* physical memory */ -extern dev_t rootdev; /* root device */ -extern dev_t rootdevs[2]; /* possible root devices */ +extern struct cdev *rootdev; /* root device */ +extern struct cdev *rootdevs[2]; /* possible root devices */ extern char *rootdevnames[2]; /* names of possible root devices */ extern struct vnode *rootvp; /* vnode equivalent to above */ @@ -311,13 +311,13 @@ void wakeup(void *chan) __nonnull(1); void wakeup_one(void *chan) __nonnull(1); /* - * Common `dev_t' stuff are declared here to avoid #include poisoning + * Common `struct cdev *' stuff are declared here to avoid #include poisoning */ -int major(dev_t x); -int minor(dev_t x); -udev_t dev2udev(dev_t x); -dev_t udev2dev(udev_t x); +int major(struct cdev *x); +int minor(struct cdev *x); +udev_t dev2udev(struct cdev *x); +struct cdev *udev2dev(udev_t x); int uminor(udev_t dev); int umajor(udev_t dev); udev_t makeudev(int x, int y); diff --git a/sys/sys/tty.h b/sys/sys/tty.h index 3dada47dd6dc..1b8958bd6f35 100644 --- a/sys/sys/tty.h +++ b/sys/sys/tty.h @@ -81,7 +81,7 @@ struct tty { long t_outcc; /* Output queue statistics. */ int t_line; /* Interface to device drivers. */ union { - dev_t t_kdev; /* Device. */ + struct cdev *t_kdev; /* Device. */ udev_t t_udev; /* Userland (sysctl) instance. */ void *t_devp; /* Keep user/kernel size in sync. */ } ttyu; @@ -307,7 +307,7 @@ int ttylclose(struct tty *tp, int flag); int ttyldoptim(struct tty *tp); struct tty *ttymalloc(struct tty *tp); int ttymodem(struct tty *tp, int flag); -int ttyopen(dev_t device, struct tty *tp); +int ttyopen(struct cdev *device, struct tty *tp); int ttyref(struct tty *tp); int ttyrel(struct tty *tp); int ttysleep(struct tty *tp, void *chan, int pri, char *wmesg, int timo); diff --git a/sys/sys/types.h b/sys/sys/types.h index 1cabc3f95c71..87d03d92d291 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -131,7 +131,9 @@ typedef __critical_t critical_t; /* Critical section value */ typedef __int64_t daddr_t; /* disk address */ #ifndef _DEV_T_DECLARED +#ifndef _KERNEL typedef __dev_t dev_t; /* device number or struct cdev */ +#endif #define _DEV_T_DECLARED #endif diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 9d5c2db079ec..10df935c595f 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -594,7 +594,7 @@ extern int (*softdep_fsync_hook)(struct vnode *); extern int (*softdep_process_worklist_hook)(struct mount *); struct vnode *addaliasu(struct vnode *vp, udev_t nvp_rdev); -int bdevvp(dev_t dev, struct vnode **vpp); +int bdevvp(struct cdev *dev, struct vnode **vpp); /* cache_* may belong in namei.h. */ void cache_enter(struct vnode *dvp, struct vnode *vp, struct componentname *cnp); @@ -625,7 +625,7 @@ void vattr_null(struct vattr *vap); int vcount(struct vnode *vp); void vdrop(struct vnode *); void vdropl(struct vnode *); -int vfinddev(dev_t dev, struct vnode **vpp); +int vfinddev(struct cdev *dev, struct vnode **vpp); void vfs_add_vnodeops(const void *); void vfs_rm_vnodeops(const void *); int vflush(struct mount *mp, int rootrefs, int flags); @@ -668,7 +668,7 @@ int vn_rdwr_inchunks(enum uio_rw rw, struct vnode *vp, caddr_t base, int vn_stat(struct vnode *vp, struct stat *sb, struct ucred *active_cred, struct ucred *file_cred, struct thread *td); int vn_start_write(struct vnode *vp, struct mount **mpp, int flags); -dev_t vn_todev(struct vnode *vp); +struct cdev *vn_todev(struct vnode *vp); int vn_write_suspend_wait(struct vnode *vp, struct mount *mp, int flags); int vn_writechk(struct vnode *vp); diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 3974be4f7b5c..a48ea7859fbc 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -1690,7 +1690,7 @@ ffs_blkfree(fs, devvp, bno, size, inum) ufs2_daddr_t cgblkno; int i, cg, blk, frags, bbase; u_int8_t *blksfree; - dev_t dev; + struct cdev *dev; cg = dtog(fs, bno); if (devvp->v_type != VCHR) { @@ -1886,7 +1886,7 @@ ffs_freefile(fs, devvp, ino, mode) ufs2_daddr_t cgbno; int error, cg; u_int8_t *inosused; - dev_t dev; + struct cdev *dev; cg = ino_to_cg(fs, ino); if (devvp->v_type != VCHR) { diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 8f205db74d32..f6de659bb48b 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -556,7 +556,7 @@ ffs_mountfs(devvp, mp, td) struct ufsmount *ump; struct buf *bp; struct fs *fs; - dev_t dev; + struct cdev *dev; void *space; ufs2_daddr_t sblockloc; int error, i, blks, size, ronly; @@ -1222,7 +1222,7 @@ ffs_vget(mp, ino, flags, vpp) struct ufsmount *ump; struct buf *bp; struct vnode *vp; - dev_t dev; + struct cdev *dev; int error; ump = VFSTOUFS(mp); diff --git a/sys/ufs/ufs/dinode.h b/sys/ufs/ufs/dinode.h index cedecd9f7cd5..78e7e2a1501f 100644 --- a/sys/ufs/ufs/dinode.h +++ b/sys/ufs/ufs/dinode.h @@ -131,7 +131,7 @@ struct ufs2_dinode { * The di_db fields may be overlaid with other information for * file types that do not have associated disk storage. Block * and character devices overlay the first data block with their - * dev_t value. Short symbolic links place their path in the + * struct cdev *value. Short symbolic links place their path in the * di_db area. */ #define di_rdev di_db[0] diff --git a/sys/ufs/ufs/ufs_extern.h b/sys/ufs/ufs/ufs_extern.h index cabad78dcf0a..56b48f284efc 100644 --- a/sys/ufs/ufs/ufs_extern.h +++ b/sys/ufs/ufs/ufs_extern.h @@ -72,11 +72,11 @@ int ufs_direnter(struct vnode *, struct vnode *, struct direct *, int ufs_dirremove(struct vnode *, struct inode *, int, int); int ufs_dirrewrite(struct inode *, struct inode *, ino_t, int, int); int ufs_getlbns(struct vnode *, ufs2_daddr_t, struct indir *, int *); -int ufs_ihashget(dev_t, ino_t, int, struct vnode **); +int ufs_ihashget(struct cdev *, ino_t, int, struct vnode **); void ufs_ihashinit(void); int ufs_ihashins(struct inode *, int, struct vnode **); struct vnode * - ufs_ihashlookup(dev_t, ino_t); + ufs_ihashlookup(struct cdev *, ino_t); void ufs_ihashrem(struct inode *); void ufs_ihashuninit(void); int ufs_inactive(struct vop_inactive_args *); diff --git a/sys/ufs/ufs/ufs_ihash.c b/sys/ufs/ufs/ufs_ihash.c index 6e6f7437e48d..ceaae673ceff 100644 --- a/sys/ufs/ufs/ufs_ihash.c +++ b/sys/ufs/ufs/ufs_ihash.c @@ -83,7 +83,7 @@ ufs_ihashuninit() */ struct vnode * ufs_ihashlookup(dev, inum) - dev_t dev; + struct cdev *dev; ino_t inum; { struct inode *ip; @@ -105,7 +105,7 @@ ufs_ihashlookup(dev, inum) */ int ufs_ihashget(dev, inum, flags, vpp) - dev_t dev; + struct cdev *dev; ino_t inum; int flags; struct vnode **vpp; diff --git a/sys/ufs/ufs/ufsmount.h b/sys/ufs/ufs/ufsmount.h index 43c22548d7ea..6d5352c22f89 100644 --- a/sys/ufs/ufs/ufsmount.h +++ b/sys/ufs/ufs/ufsmount.h @@ -59,7 +59,7 @@ struct ufs_extattr_per_mount; /* This structure describes the UFS specific mount structure data. */ struct ufsmount { struct mount *um_mountp; /* filesystem vfs structure */ - dev_t um_dev; /* device mounted */ + struct cdev *um_dev; /* device mounted */ struct vnode *um_devvp; /* block device mounted vnode */ u_long um_fstype; /* type of filesystem */ struct fs *um_fs; /* pointer to superblock */ diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c index 4a4c34ad65f5..e52d416cdd37 100644 --- a/sys/vm/device_pager.c +++ b/sys/vm/device_pager.c @@ -101,7 +101,7 @@ dev_pager_init() static vm_object_t dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff) { - dev_t dev; + struct cdev *dev; d_mmap_t *mapfunc; vm_object_t object; vm_pindex_t pindex; @@ -204,7 +204,7 @@ dev_pager_getpages(object, m, count, reqpage) vm_pindex_t offset; vm_paddr_t paddr; vm_page_t page; - dev_t dev; + struct cdev *dev; int i, ret; d_mmap_t *mapfunc; int prot; diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 258ee4dda2f3..586ec82117d9 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -2441,7 +2441,7 @@ swapgeom_close(struct thread *td, struct swdevt *sw) struct swh0h0 { - dev_t dev; + struct cdev *dev; struct vnode *vp; int error; }; -- cgit v1.3 From f3732fd15b5a493a090a0453f937a78949c65f7d Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Thu, 17 Jun 2004 17:16:53 +0000 Subject: Second half of the dev_t cleanup. The big lines are: NODEV -> NULL NOUDEV -> NODEV udev_t -> dev_t udev2dev() -> findcdev() Various minor adjustments including handling of userland access to kernel space struct cdev etc. --- lib/libkvm/kvm_proc.c | 2 +- sys/cam/scsi/scsi_target.c | 2 +- sys/coda/coda.h | 2 +- sys/coda/coda_fbsd.c | 2 +- sys/coda/coda_venus.c | 2 +- sys/compat/freebsd32/freebsd32_misc.c | 4 +- sys/compat/linux/linux_stats.c | 8 +-- sys/compat/svr4/svr4_socket.c | 2 +- sys/compat/svr4/svr4_socket.h | 4 +- sys/compat/svr4/svr4_stream.c | 2 +- sys/compat/svr4/svr4_types.h | 4 +- sys/dev/cp/if_cp.c | 4 +- sys/dev/ctau/if_ct.c | 4 +- sys/dev/cx/if_cx.c | 4 +- sys/dev/cy/cy.c | 2 +- sys/dev/dcons/dcons.c | 2 +- sys/dev/digi/digi.c | 2 +- sys/dev/firewire/fwdev.c | 2 +- sys/dev/led/led.c | 4 +- sys/dev/nmdm/nmdm.c | 2 +- sys/dev/snp/snp.c | 14 ++--- sys/dev/sound/pcm/dsp.c | 2 +- sys/dev/sound/pcm/mixer.c | 2 +- sys/dev/syscons/syscons.c | 2 +- sys/dev/vinum/vinum.c | 2 +- sys/dev/vinum/vinumconfig.c | 4 +- sys/dev/vinum/vinumio.c | 2 +- sys/fs/cd9660/cd9660_node.h | 2 +- sys/fs/cd9660/cd9660_rrip.c | 4 +- sys/fs/coda/coda.h | 2 +- sys/fs/coda/coda_fbsd.c | 2 +- sys/fs/coda/coda_venus.c | 2 +- sys/fs/devfs/devfs_vnops.c | 8 +-- sys/fs/specfs/spec_vnops.c | 2 +- sys/geom/geom_dev.c | 2 +- sys/isofs/cd9660/cd9660_node.h | 2 +- sys/isofs/cd9660/cd9660_rrip.c | 4 +- sys/kern/kern_acct.c | 2 +- sys/kern/kern_conf.c | 62 ++++++++++------------ sys/kern/kern_proc.c | 4 +- sys/kern/kern_shutdown.c | 2 +- sys/kern/tty_cons.c | 6 +-- sys/kern/tty_pty.c | 4 +- sys/kern/tty_tty.c | 2 +- sys/kern/uipc_usrreq.c | 2 +- sys/kern/vfs_bio.c | 8 +-- sys/kern/vfs_mount.c | 12 ++--- sys/kern/vfs_subr.c | 16 +++--- sys/net/bpf.c | 2 +- sys/net/if_tap.c | 2 +- sys/net/if_tun.c | 2 +- sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c | 28 +++++----- sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c | 14 ++--- sys/netsmb/smb_dev.c | 4 +- sys/nfs4client/nfs4_vn_subs.c | 2 +- sys/nfsclient/nfs_subs.c | 2 +- sys/nfsserver/nfs_serv.c | 2 +- sys/sys/_types.h | 5 +- sys/sys/acct.h | 2 +- sys/sys/conf.h | 2 +- sys/sys/param.h | 9 +--- sys/sys/snoop.h | 4 +- sys/sys/stat.h | 10 ++-- sys/sys/systm.h | 9 ++-- sys/sys/tty.h | 4 +- sys/sys/types.h | 6 +-- sys/sys/user.h | 2 +- sys/sys/vnode.h | 12 ++--- sys/vm/swap_pager.c | 12 ++--- sys/vm/vm_param.h | 2 +- usr.bin/fstat/fstat.c | 12 ++--- usr.bin/fstat/fstat.h | 2 +- usr.bin/pkill/pkill.c | 2 +- 73 files changed, 186 insertions(+), 205 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c index 1fc196c9ce69..5f846f61938f 100644 --- a/lib/libkvm/kvm_proc.c +++ b/lib/libkvm/kvm_proc.c @@ -251,7 +251,7 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt) "can't read tty at %x", sess.s_ttyp); return (-1); } - kp->ki_tdev = tty.t_dev; + kp->ki_tdev = tty.t_dev; /* XXX: wrong */ if (tty.t_pgrp != NULL) { if (KREAD(kd, (u_long)tty.t_pgrp, &pgrp)) { _kvm_err(kd, kd->program, diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c index f3739ea4b4ea..198a70d66c60 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -1035,7 +1035,7 @@ targclone(void *arg, char *name, int namelen, struct cdev **dev) { int u; - if (*dev != NODEV) + if (*dev != NULL) return; if (dev_stdclone(name, NULL, "targ", &u) != 1) return; diff --git a/sys/coda/coda.h b/sys/coda/coda.h index 90e7e2ae7202..5fb352effb82 100644 --- a/sys/coda/coda.h +++ b/sys/coda/coda.h @@ -87,7 +87,7 @@ typedef unsigned long long u_quad_t; typedef unsigned long long u_quad_t; #endif #else -#define cdev_t udev_t +#define cdev_t dev_t #endif #ifdef __CYGWIN32__ diff --git a/sys/coda/coda_fbsd.c b/sys/coda/coda_fbsd.c index 0ce6e466e87e..89d4de05dead 100644 --- a/sys/coda/coda_fbsd.c +++ b/sys/coda/coda_fbsd.c @@ -186,7 +186,7 @@ static void coda_fbsd_clone(arg, name, namelen, dev) { int u; - if (*dev != NODEV) + if (*dev != NULL) return; if (dev_stdclone(name,NULL,"cfs",&u) != 1) return; diff --git a/sys/coda/coda_venus.c b/sys/coda/coda_venus.c index f0bc3c296bdf..7e4d32109045 100644 --- a/sys/coda/coda_venus.c +++ b/sys/coda/coda_venus.c @@ -212,7 +212,7 @@ venus_open(void *mdp, CodaFid *fid, int flag, error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { - *dev = udev2dev(outp->dev); + *dev = findcdev(outp->dev); *inode = outp->inode; } diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 999af87d7594..6ff5910c7ebf 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -1083,13 +1083,13 @@ freebsd32_sendfile(struct thread *td, struct freebsd32_sendfile_args *uap) } struct stat32 { - udev_t st_dev; + dev_t st_dev; ino_t st_ino; mode_t st_mode; nlink_t st_nlink; uid_t st_uid; gid_t st_gid; - udev_t st_rdev; + dev_t st_rdev; struct timespec32 st_atimespec; struct timespec32 st_mtimespec; struct timespec32 st_ctimespec; diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c index 4a02042ddc5f..a9545fda7e6d 100644 --- a/sys/compat/linux/linux_stats.c +++ b/sys/compat/linux/linux_stats.c @@ -76,7 +76,7 @@ newstat_copyout(struct stat *buf, void *ubuf) * in FreeBSD but block devices under Linux. */ if (S_ISCHR(tbuf.st_mode) && - (dev = udev2dev(buf->st_rdev)) != NODEV) { + (dev = findcdev(buf->st_rdev)) != NULL) { cdevsw = devsw(dev); if (cdevsw != NULL && (cdevsw->d_flags & D_DISK)) { tbuf.st_mode &= ~S_IFMT; @@ -365,8 +365,8 @@ linux_ustat(struct thread *td, struct linux_ustat_args *args) * struct cdev *returned from previous syscalls. Just return a bzeroed * ustat in that case. */ - dev = udev2dev(makeudev(args->dev >> 8, args->dev & 0xFF)); - if (dev != NODEV && vfinddev(dev, &vp)) { + dev = findcdev(makedev(args->dev >> 8, args->dev & 0xFF)); + if (dev != NULL && vfinddev(dev, &vp)) { if (vp->v_mount == NULL) return (EINVAL); #ifdef MAC @@ -414,7 +414,7 @@ stat64_copyout(struct stat *buf, void *ubuf) * in FreeBSD but block devices under Linux. */ if (S_ISCHR(lbuf.st_mode) && - (dev = udev2dev(buf->st_rdev)) != NODEV) { + (dev = findcdev(buf->st_rdev)) != NULL) { cdevsw = devsw(dev); if (cdevsw != NULL && (cdevsw->d_flags & D_DISK)) { lbuf.st_mode &= ~S_IFMT; diff --git a/sys/compat/svr4/svr4_socket.c b/sys/compat/svr4/svr4_socket.c index 95014e019a32..65126d76cdf6 100644 --- a/sys/compat/svr4/svr4_socket.c +++ b/sys/compat/svr4/svr4_socket.c @@ -67,7 +67,7 @@ struct sockaddr_un * svr4_find_socket(td, fp, dev, ino) struct thread *td; struct file *fp; - udev_t dev; + dev_t dev; ino_t ino; { struct svr4_sockcache_entry *e; diff --git a/sys/compat/svr4/svr4_socket.h b/sys/compat/svr4/svr4_socket.h index b4b38f90e40a..1df1e43d7685 100644 --- a/sys/compat/svr4/svr4_socket.h +++ b/sys/compat/svr4/svr4_socket.h @@ -49,7 +49,7 @@ struct svr4_sockaddr_in { }; struct sockaddr_un *svr4_find_socket(struct thread *, struct file *, - udev_t, ino_t); + dev_t, ino_t); void svr4_delete_socket(struct proc *, struct file *); int svr4_add_socket(struct thread *, const char *, struct stat *); @@ -57,7 +57,7 @@ struct svr4_sockcache_entry { struct proc *p; /* Process for the socket */ void *cookie; /* Internal cookie used for matching */ struct sockaddr_un sock;/* Pathname for the socket */ - udev_t dev; /* Device where the socket lives on */ + dev_t dev; /* Device where the socket lives on */ ino_t ino; /* Inode where the socket lives on */ TAILQ_ENTRY(svr4_sockcache_entry) entries; }; diff --git a/sys/compat/svr4/svr4_stream.c b/sys/compat/svr4/svr4_stream.c index db7eabcd67af..853a2722aa8c 100644 --- a/sys/compat/svr4/svr4_stream.c +++ b/sys/compat/svr4/svr4_stream.c @@ -1873,7 +1873,7 @@ svr4_do_putmsg(td, uap, fp) } else { /* Maybe we've been given a device/inode pair */ - udev_t *dev = SVR4_ADDROF(&sc); + dev_t *dev = SVR4_ADDROF(&sc); ino_t *ino = (ino_t *) &dev[1]; skp = svr4_find_socket(td, fp, *dev, *ino); if (skp == NULL) { diff --git a/sys/compat/svr4/svr4_types.h b/sys/compat/svr4/svr4_types.h index 3421647793f9..410746b6adc9 100644 --- a/sys/compat/svr4/svr4_types.h +++ b/sys/compat/svr4/svr4_types.h @@ -68,14 +68,14 @@ typedef struct timespec svr4_timestruc_t; #define svr4_omakedev(x,y) ((svr4_o_dev_t)((((x) << 8) & 0x7f00) | \ (((y) << 0) & 0x00ff))) -#define svr4_to_bsd_odev_t(d) makeudev(svr4_omajor(d), svr4_ominor(d)) +#define svr4_to_bsd_odev_t(d) makedev(svr4_omajor(d), svr4_ominor(d)) #define bsd_to_svr4_odev_t(d) svr4_omakedev(umajor(d), uminor(d)) #define svr4_major(x) ((int32_t)((((x) & 0xfffc0000) >> 18))) #define svr4_minor(x) ((int32_t)((((x) & 0x0003ffff) >> 0))) #define svr4_makedev(x,y) ((svr4_dev_t)((((x) << 18) & 0xfffc0000) | \ (((y) << 0) & 0x0003ffff))) -#define svr4_to_bsd_dev_t(d) makeudev(svr4_major(d), svr4_minor(d)) +#define svr4_to_bsd_dev_t(d) makedev(svr4_major(d), svr4_minor(d)) #define bsd_to_svr4_dev_t(d) svr4_makedev(umajor(d), uminor(d)) #endif /* !_SVR4_TYPES_H_ */ diff --git a/sys/dev/cp/if_cp.c b/sys/dev/cp/if_cp.c index 04427c3bfd03..13b3019d207f 100644 --- a/sys/dev/cp/if_cp.c +++ b/sys/dev/cp/if_cp.c @@ -2657,13 +2657,13 @@ static int cp_modevent (module_t mod, int type, void *unused) struct cdevsw *cdsw; #if __FreeBSD_version >= 502103 - dev = udev2dev (makeudev(CDEV_MAJOR, 0)); + dev = findcdev (makedev(CDEV_MAJOR, 0)); #else dev = makedev (CDEV_MAJOR, 0); #endif switch (type) { case MOD_LOAD: - if (dev != NODEV && + if (dev != NULL && (cdsw = devsw (dev)) && cdsw->d_maj == CDEV_MAJOR) { printf ("Tau-PCI driver is already in system\n"); diff --git a/sys/dev/ctau/if_ct.c b/sys/dev/ctau/if_ct.c index a7462ab2f4fd..de07c716e846 100644 --- a/sys/dev/ctau/if_ct.c +++ b/sys/dev/ctau/if_ct.c @@ -2629,13 +2629,13 @@ static int ct_modevent (module_t mod, int type, void *unused) struct cdevsw *cdsw; #if __FreeBSD_version >= 502103 - dev = udev2dev (makeudev(CDEV_MAJOR, 0)); + dev = findcdev (makedev(CDEV_MAJOR, 0)); #else dev = makedev (CDEV_MAJOR, 0); #endif switch (type) { case MOD_LOAD: - if (dev != NODEV && + if (dev != NULL && (cdsw = devsw (dev)) && cdsw->d_maj == CDEV_MAJOR) { printf ("Tau-ISA driver is already in system\n"); diff --git a/sys/dev/cx/if_cx.c b/sys/dev/cx/if_cx.c index 45c7f9efc1ee..b6b55c7d3ba4 100644 --- a/sys/dev/cx/if_cx.c +++ b/sys/dev/cx/if_cx.c @@ -3177,13 +3177,13 @@ static int cx_modevent (module_t mod, int type, void *unused) struct cdevsw *cdsw; #if __FreeBSD_version >= 502103 - dev = udev2dev (makeudev(CDEV_MAJOR, 0)); + dev = findcdev (makedev(CDEV_MAJOR, 0)); #else dev = makedev (CDEV_MAJOR, 0); #endif switch (type) { case MOD_LOAD: - if (dev != NODEV && + if (dev != NULL && (cdsw = devsw (dev)) && cdsw->d_maj == CDEV_MAJOR) { printf ("Sigma driver is already in system\n"); diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index 7808ecbf40f1..53e038dad14b 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -162,7 +162,7 @@ __FBSDID("$FreeBSD$"); #define MINOR_MAGIC_MASK (CALLOUT_MASK | CONTROL_MASK) /* * Not all of the magic is parametrized in the following macros. 16 and - * 0xff are related to the bitfields in a udev_t. CY_MAX_PORTS must be + * 0xff are related to the bitfields in a dev_t. CY_MAX_PORTS must be * ((0xff & ~MINOR_MAGIC_MASK) + 1) for things to work. */ #define MINOR_TO_UNIT(mynor) (((mynor) >> 16) * CY_MAX_PORTS \ diff --git a/sys/dev/dcons/dcons.c b/sys/dev/dcons/dcons.c index 5bdbbfbaff7a..c1b320d797a8 100644 --- a/sys/dev/dcons/dcons.c +++ b/sys/dev/dcons/dcons.c @@ -598,7 +598,7 @@ dcons_modevent(module_t mode, int type, void *data) #if CONS_NODEV gdb_arg = NULL; #else - gdbdev = NODEV; + gdbdev = NULL; #endif #endif #if __FreeBSD_version >= 500000 diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c index c330290d2ed8..2d9184cda597 100644 --- a/sys/dev/digi/digi.c +++ b/sys/dev/digi/digi.c @@ -1017,7 +1017,7 @@ digi_loadmoduledata(struct digi_softc *sc) modfile = malloc(modlen + 6, M_TEMP, M_WAITOK); snprintf(modfile, modlen + 6, "digi_%s", sc->module); if ((res = linker_reference_module(modfile, NULL, &lf)) != 0) { - if (res == ENOENT && rootdev == NODEV) + if (res == ENOENT && rootdev == NULL) printf("%s: Failed to autoload module: No filesystem\n", modfile); else diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 5d104156ba03..cffb6369b747 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -848,7 +848,7 @@ fwdev_clone(void *arg, char *name, int namelen, struct cdev **dev) int devflag[NDEVTYPE] = {0, FWMEM_FLAG}; int i, unit = 0, sub = 0; - if (*dev != NODEV) + if (*dev != NULL) return; for (i = 0; i < NDEVTYPE; i++) diff --git a/sys/dev/led/led.c b/sys/dev/led/led.c index 4c19e274daf3..df9f27e1efe4 100644 --- a/sys/dev/led/led.c +++ b/sys/dev/led/led.c @@ -234,13 +234,13 @@ led_create(led_t *func, void *priv, char const *name) sb = sbuf_new(NULL, NULL, SPECNAMELEN, SBUF_FIXEDLEN); if (sb == NULL) - return (NODEV); + return (NULL); sbuf_cpy(sb, "led/"); sbuf_cat(sb, name); sbuf_finish(sb); if (sbuf_overflowed(sb)) { sbuf_delete(sb); - return (NODEV); + return (NULL); } sc = malloc(sizeof *sc, M_LED, M_WAITOK | M_ZERO); diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c index 683d06be2c85..e27347b5433e 100644 --- a/sys/dev/nmdm/nmdm.c +++ b/sys/dev/nmdm/nmdm.c @@ -100,7 +100,7 @@ nmdm_clone(void *arg, char *name, int nameen, struct cdev **dev) char *p; struct cdev *d1, *d2; - if (*dev != NODEV) + if (*dev != NULL) return; if (strcmp(name, "nmdm") == 0) { p = NULL; diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index 752dc421eaf7..65448107565f 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -406,7 +406,7 @@ snpopen(dev, flag, mode, td) * snp_tty == NULL is for inactive snoop devices. */ snp->snp_tty = NULL; - snp->snp_target = NODEV; + snp->snp_target = NULL; LIST_INSERT_HEAD(&snp_sclist, snp, snp_list); return (0); @@ -439,7 +439,7 @@ snp_detach(snp) printf("snp%d: bad attached tty data\n", snp->snp_unit); snp->snp_tty = NULL; - snp->snp_target = NODEV; + snp->snp_target = NULL; detach_notty: selwakeuppri(&snp->snp_sel, PZERO + 1); @@ -500,8 +500,8 @@ snpioctl(dev, cmd, data, flags, td) snp = dev->si_drv1; switch (cmd) { case SNPSTTY: - tdev = udev2dev(*((udev_t *)data)); - if (tdev == NODEV) + tdev = findcdev(*((dev_t *)data)); + if (tdev == NULL) return (snp_down(snp)); tp = snpdevtotty(tdev); @@ -512,7 +512,7 @@ snpioctl(dev, cmd, data, flags, td) s = spltty(); - if (snp->snp_target == NODEV) { + if (snp->snp_target == NULL) { tpo = snp->snp_tty; if (tpo) tpo->t_state &= ~TS_SNOOP; @@ -540,7 +540,7 @@ snpioctl(dev, cmd, data, flags, td) * SNPGTTY happy, else we can't know what is device * major/minor for tty. */ - *((udev_t *)data) = dev2udev(snp->snp_target); + *((dev_t *)data) = dev2udev(snp->snp_target); break; case FIONBIO: @@ -609,7 +609,7 @@ snp_clone(arg, name, namelen, dev) { int u, i; - if (*dev != NODEV) + if (*dev != NULL) return; if (dev_stdclone(name, NULL, "snp", &u) != 1) return; diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 92009414c076..29fe27f94637 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -1123,7 +1123,7 @@ dsp_clone(void *arg, char *name, int namelen, struct cdev **dev) int devtypes[3] = {SND_DEV_DSP, SND_DEV_DSP16, SND_DEV_AUDIO}; char *devnames[3] = {"dsp", "dspW", "audio"}; - if (*dev != NODEV) + if (*dev != NULL) return; if (pcm_devclass == NULL) return; diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 47812fe5a046..135a6281d40b 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -483,7 +483,7 @@ mixer_clone(void *arg, char *name, int namelen, struct cdev **dev) { struct snddev_info *sd; - if (*dev != NODEV) + if (*dev != NULL) return; if (strcmp(name, "mixer") == 0) { sd = devclass_get_softc(pcm_devclass, snd_unit); diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 12f0739300ee..6c1a5497c8be 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -2622,7 +2622,7 @@ sc_change_cursor_shape(scr_stat *scp, int flags, int base, int height) } for (i = sc->first_vty; i < sc->first_vty + sc->vtys; ++i) { - if ((dev = SC_DEV(sc, i)) == NODEV) + if ((dev = SC_DEV(sc, i)) == NULL) continue; if ((scp = sc_get_stat(dev)) == NULL) continue; diff --git a/sys/dev/vinum/vinum.c b/sys/dev/vinum/vinum.c index 3306c96ed222..062176b4ab40 100644 --- a/sys/dev/vinum/vinum.c +++ b/sys/dev/vinum/vinum.c @@ -522,7 +522,7 @@ vinum_clone(void *arg, char *name, int namelen, struct cdev ** dev) struct volume *vol; int i; - if (*dev != NODEV) + if (*dev != NULL) return; if (strncmp(name, "vinum/", sizeof("vinum/") - 1) != 0) return; diff --git a/sys/dev/vinum/vinumconfig.c b/sys/dev/vinum/vinumconfig.c index 8c7e0386ce97..989af8888924 100644 --- a/sys/dev/vinum/vinumconfig.c +++ b/sys/dev/vinum/vinumconfig.c @@ -476,7 +476,7 @@ get_empty_drive(void) bzero(drive, sizeof(struct drive)); drive->driveno = driveno; /* put number in structure */ drive->flags |= VF_NEWBORN; /* newly born drive */ - drive->dev = NODEV; + drive->dev = NULL; strcpy(drive->devicename, "unknown"); /* and make the name ``unknown'' */ return driveno; /* return the index */ } @@ -595,7 +595,7 @@ free_drive(struct drive *drive) close_locked_drive(drive); /* close it */ if (drive->freelist) Free(drive->freelist); - if (drive->dev != NODEV) + if (drive->dev != NULL) dev_rel(drive->dev); bzero(drive, sizeof(struct drive)); /* this also sets drive_unallocated */ unlockdrive(drive); diff --git a/sys/dev/vinum/vinumio.c b/sys/dev/vinum/vinumio.c index e77291e32e9b..7edde1db8767 100644 --- a/sys/dev/vinum/vinumio.c +++ b/sys/dev/vinum/vinumio.c @@ -56,7 +56,7 @@ open_drive(struct drive *drive, struct thread *td, int verbose) return EBUSY; /* don't do it again */ drive->dev = getdiskbyname(drive->devicename); - if (drive->dev == NODEV) /* didn't find anything */ + if (drive->dev == NULL) /* didn't find anything */ return ENOENT; dev_ref(drive->dev); diff --git a/sys/fs/cd9660/cd9660_node.h b/sys/fs/cd9660/cd9660_node.h index a5b228c45f06..fb74f3998483 100644 --- a/sys/fs/cd9660/cd9660_node.h +++ b/sys/fs/cd9660/cd9660_node.h @@ -52,7 +52,7 @@ typedef struct { uid_t iso_uid; /* owner user id */ gid_t iso_gid; /* owner group id */ short iso_links; /* links of file */ - udev_t iso_rdev; /* Major/Minor number for special */ + dev_t iso_rdev; /* Major/Minor number for special */ } ISO_RRIP_INODE; diff --git a/sys/fs/cd9660/cd9660_rrip.c b/sys/fs/cd9660/cd9660_rrip.c index 48eac6d2a3b1..f20b4db10516 100644 --- a/sys/fs/cd9660/cd9660_rrip.c +++ b/sys/fs/cd9660/cd9660_rrip.c @@ -413,9 +413,9 @@ cd9660_rrip_device(p,ana) low = isonum_733(p->dev_t_low); if (high == 0) - ana->inop->inode.iso_rdev = makeudev(umajor(low), uminor(low)); + ana->inop->inode.iso_rdev = makedev(umajor(low), uminor(low)); else - ana->inop->inode.iso_rdev = makeudev(high, uminor(low)); + ana->inop->inode.iso_rdev = makedev(high, uminor(low)); ana->fields &= ~ISO_SUSP_DEVICE; return ISO_SUSP_DEVICE; } diff --git a/sys/fs/coda/coda.h b/sys/fs/coda/coda.h index 90e7e2ae7202..5fb352effb82 100644 --- a/sys/fs/coda/coda.h +++ b/sys/fs/coda/coda.h @@ -87,7 +87,7 @@ typedef unsigned long long u_quad_t; typedef unsigned long long u_quad_t; #endif #else -#define cdev_t udev_t +#define cdev_t dev_t #endif #ifdef __CYGWIN32__ diff --git a/sys/fs/coda/coda_fbsd.c b/sys/fs/coda/coda_fbsd.c index 0ce6e466e87e..89d4de05dead 100644 --- a/sys/fs/coda/coda_fbsd.c +++ b/sys/fs/coda/coda_fbsd.c @@ -186,7 +186,7 @@ static void coda_fbsd_clone(arg, name, namelen, dev) { int u; - if (*dev != NODEV) + if (*dev != NULL) return; if (dev_stdclone(name,NULL,"cfs",&u) != 1) return; diff --git a/sys/fs/coda/coda_venus.c b/sys/fs/coda/coda_venus.c index f0bc3c296bdf..7e4d32109045 100644 --- a/sys/fs/coda/coda_venus.c +++ b/sys/fs/coda/coda_venus.c @@ -212,7 +212,7 @@ venus_open(void *mdp, CodaFid *fid, int flag, error = coda_call(mdp, Isize, &Osize, (char *)inp); if (!error) { - *dev = udev2dev(outp->dev); + *dev = findcdev(outp->dev); *inode = outp->inode; } diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index cbc836a22d02..2d7468a12718 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -140,7 +140,7 @@ loop: if (dev == NULL) return (ENOENT); } else { - dev = NODEV; + dev = NULL; } error = getnewvnode("devfs", mp, devfs_vnodeop_p, &vp); if (error != 0) { @@ -382,9 +382,9 @@ devfs_lookupx(ap) if (pname == NULL) goto notfound; - cdev = NODEV; + cdev = NULL; EVENTHANDLER_INVOKE(dev_clone, pname, strlen(pname), &cdev); - if (cdev == NODEV) + if (cdev == NULL) goto notfound; devfs_populate(dmp); @@ -660,7 +660,7 @@ devfs_reclaim(ap) if (de != NULL) de->de_vnode = NULL; vp->v_data = NULL; - if (vp->v_rdev != NODEV && vp->v_rdev != NULL) { + if (vp->v_rdev != NULL && vp->v_rdev != NULL) { i = vcount(vp); if ((vp->v_rdev->si_flags & SI_CHEAPCLONE) && i == 0 && (vp->v_rdev->si_flags & SI_NAMED)) diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c index 7d12a58587a8..ec58af649ac8 100644 --- a/sys/fs/specfs/spec_vnops.c +++ b/sys/fs/specfs/spec_vnops.c @@ -144,7 +144,7 @@ spec_open(ap) if (vp->v_mount && (vp->v_mount->mnt_flag & MNT_NODEV)) return (ENXIO); - if (dev == NODEV) + if (dev == NULL) return (ENXIO); dsw = devsw(dev); diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c index 54f585e03aa1..5c16763c659e 100644 --- a/sys/geom/geom_dev.c +++ b/sys/geom/geom_dev.c @@ -103,7 +103,7 @@ g_dev_clone(void *arg __unused, char *name, int namelen __unused, struct cdev ** { struct g_geom *gp; - if (*dev != NODEV) + if (*dev != NULL) return; g_waitidle(); diff --git a/sys/isofs/cd9660/cd9660_node.h b/sys/isofs/cd9660/cd9660_node.h index a5b228c45f06..fb74f3998483 100644 --- a/sys/isofs/cd9660/cd9660_node.h +++ b/sys/isofs/cd9660/cd9660_node.h @@ -52,7 +52,7 @@ typedef struct { uid_t iso_uid; /* owner user id */ gid_t iso_gid; /* owner group id */ short iso_links; /* links of file */ - udev_t iso_rdev; /* Major/Minor number for special */ + dev_t iso_rdev; /* Major/Minor number for special */ } ISO_RRIP_INODE; diff --git a/sys/isofs/cd9660/cd9660_rrip.c b/sys/isofs/cd9660/cd9660_rrip.c index 48eac6d2a3b1..f20b4db10516 100644 --- a/sys/isofs/cd9660/cd9660_rrip.c +++ b/sys/isofs/cd9660/cd9660_rrip.c @@ -413,9 +413,9 @@ cd9660_rrip_device(p,ana) low = isonum_733(p->dev_t_low); if (high == 0) - ana->inop->inode.iso_rdev = makeudev(umajor(low), uminor(low)); + ana->inop->inode.iso_rdev = makedev(umajor(low), uminor(low)); else - ana->inop->inode.iso_rdev = makeudev(high, uminor(low)); + ana->inop->inode.iso_rdev = makedev(high, uminor(low)); ana->fields &= ~ISO_SUSP_DEVICE; return ISO_SUSP_DEVICE; } diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index 63d7891c74b7..5dca0f60dd13 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -285,7 +285,7 @@ acct_process(td) if ((p->p_flag & P_CONTROLT) && p->p_pgrp->pg_session->s_ttyp) acct.ac_tty = dev2udev(p->p_pgrp->pg_session->s_ttyp->t_dev); else - acct.ac_tty = NOUDEV; + acct.ac_tty = NODEV; SESS_UNLOCK(p->p_session); /* (8) The boolean flags that tell how the process terminated, etc. */ diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 216a7772c543..b417b730adfb 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -51,7 +51,7 @@ extern unsigned char reserved_majors[256]; /* * This is the number of hash-buckets. Experiements with 'real-life' - * udev_t's show that a prime halfway between two powers of two works + * dev_t's show that a prime halfway between two powers of two works * best. */ #define DEVT_HASH 83 @@ -70,6 +70,8 @@ SYSCTL_INT(_debug, OID_AUTO, free_devt, CTLFLAG_RW, &free_devt, 0, ""); static struct mtx devmtx; static void freedev(struct cdev *dev); +static struct cdev *newdev(int x, int y); + static void devlock(void) @@ -125,8 +127,6 @@ cdevsw_rel(struct cdevsw *csw) devunlock(); } -static struct cdev *makedev(int x, int y); - int nullop(void) { @@ -247,16 +247,16 @@ devsw(struct cdev *dev) int major(struct cdev *x) { - if (x == NODEV) - return NOUDEV; + if (x == NULL) + return NODEV; return((x->si_udev >> 8) & 0xff); } int minor(struct cdev *x) { - if (x == NODEV) - return NOUDEV; + if (x == NULL) + return NODEV; return(x->si_udev & 0xffff00ff); } @@ -265,8 +265,8 @@ dev2unit(struct cdev *x) { int i; - if (x == NODEV) - return NOUDEV; + if (x == NULL) + return NODEV; i = minor(x); return ((i & 0xff) | (i >> 8)); } @@ -304,14 +304,14 @@ allocdev(void) } static struct cdev * -makedev(int x, int y) +newdev(int x, int y) { struct cdev *si; - udev_t udev; + dev_t udev; int hash; - if (x == umajor(NOUDEV) && y == uminor(NOUDEV)) - panic("makedev of NOUDEV"); + if (x == umajor(NODEV) && y == uminor(NODEV)) + panic("newdev of NODEV"); udev = (x << 8) | y; hash = udev % DEVT_HASH; LIST_FOREACH(si, &dev_hash[hash], si_hash) { @@ -337,48 +337,42 @@ freedev(struct cdev *dev) } } -udev_t +dev_t dev2udev(struct cdev *x) { - if (x == NODEV) - return (NOUDEV); + if (x == NULL) + return (NODEV); return (x->si_udev); } struct cdev * -udev2dev(udev_t udev) +findcdev(dev_t udev) { struct cdev *si; int hash; - if (udev == NOUDEV) - return (NODEV); + if (udev == NODEV) + return (NULL); hash = udev % DEVT_HASH; LIST_FOREACH(si, &dev_hash[hash], si_hash) { if (si->si_udev == udev) return (si); } - return (NODEV); + return (NULL); } int -uminor(udev_t dev) +uminor(dev_t dev) { return (dev & 0xffff00ff); } int -umajor(udev_t dev) +umajor(dev_t dev) { return ((dev & 0xff00) >> 8); } -udev_t -makeudev(int x, int y) -{ - return ((x << 8) | y); -} - static void find_major(struct cdevsw *devsw) { @@ -479,7 +473,7 @@ make_dev(struct cdevsw *devsw, int minornr, uid_t uid, gid_t gid, int perms, con if (!(devsw->d_flags & D_INIT)) prep_cdevsw(devsw); - dev = makedev(devsw->d_maj, minornr); + dev = newdev(devsw->d_maj, minornr); if (dev->si_flags & SI_CHEAPCLONE && dev->si_flags & SI_NAMED && dev->si_devsw == devsw) { @@ -750,7 +744,7 @@ clone_create(struct clonedevs **cdp, struct cdevsw *csw, int *up, struct cdev ** } if (unit == -1) unit = low & CLONE_UNITMASK; - dev = makedev(csw->d_maj, unit2minor(unit | extra)); + dev = newdev(csw->d_maj, unit2minor(unit | extra)); KASSERT(!(dev->si_flags & SI_CLONELIST), ("Dev %p should not be on clonelist", dev)); if (dl != NULL) @@ -794,16 +788,16 @@ static int sysctl_devname(SYSCTL_HANDLER_ARGS) { int error; - udev_t ud; + dev_t ud; struct cdev *dev; error = SYSCTL_IN(req, &ud, sizeof (ud)); if (error) return (error); - if (ud == NOUDEV) + if (ud == NODEV) return(EINVAL); - dev = udev2dev(ud); - if (dev == NODEV) + dev = findcdev(ud); + if (dev == NULL) error = ENOENT; else error = SYSCTL_OUT(req, dev->si_name, strlen(dev->si_name) + 1); diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index daf51b034fbf..c7571245a247 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -800,7 +800,7 @@ fill_kinfo_thread(struct thread *td, struct kinfo_proc *kp) if (tp->t_session) kp->ki_tsid = tp->t_session->s_sid; } else - kp->ki_tdev = NOUDEV; + kp->ki_tdev = NODEV; if (p->p_comm[0] != '\0') { strlcpy(kp->ki_comm, p->p_comm, sizeof(kp->ki_comm)); strlcpy(kp->ki_ocomm, p->p_comm, sizeof(kp->ki_ocomm)); @@ -1012,7 +1012,7 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) SESS_LOCK(p->p_session); if (p->p_session->s_ttyp == NULL || dev2udev(p->p_session->s_ttyp->t_dev) != - (udev_t)name[0]) { + (dev_t)name[0]) { SESS_UNLOCK(p->p_session); PROC_UNLOCK(p); continue; diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 49c6a4131350..491bc9ec183e 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -324,7 +324,7 @@ boot(int howto) for (bp = &buf[nbuf]; --bp >= buf; ) { if (((bp->b_flags&B_INVAL) == 0 && BUF_REFCNT(bp)) || ((bp->b_flags & (B_DELWRI|B_INVAL)) == B_DELWRI)) { - if (bp->b_dev == NODEV) { + if (bp->b_dev == NULL) { TAILQ_REMOVE(&mountlist, bp->b_vp->v_mount, mnt_list); continue; diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index a9bea7cea674..e44ea5f9dd05 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -103,7 +103,7 @@ static STAILQ_HEAD(, cn_device) cn_devlist = (cnd == NULL || cnd->cnd_vp == NULL || \ (cnd->cnd_vp->v_type == VBAD && !cn_devopen(cnd, td, 1))) -static udev_t cn_udev_t; +static dev_t cn_udev_t; SYSCTL_OPAQUE(_machdep, CPU_CONSDEV, consdev, CTLFLAG_RD, &cn_udev_t, sizeof cn_udev_t, "T,struct cdev *", ""); @@ -371,9 +371,9 @@ sysctl_kern_consmute(SYSCTL_HANDLER_ARGS) if (error != 0 || req->newptr == NULL) return (error); if (ocn_mute && !cn_mute && cn_is_open) - error = cnopen(NODEV, openflag, 0, curthread); + error = cnopen(NULL, openflag, 0, curthread); else if (!ocn_mute && cn_mute && cn_is_open) { - error = cnclose(NODEV, openflag, 0, curthread); + error = cnclose(NULL, openflag, 0, curthread); cn_is_open = 1; /* XXX hack */ } return (error); diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index b4082a384690..1e5d20228a52 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -143,7 +143,7 @@ ptyinit(struct cdev *devc) n = minor(devc); /* For now we only map the lower 8 bits of the minor */ if (n & ~0xff) - return (NODEV); + return (NULL); devc->si_flags &= ~SI_CHEAPCLONE; @@ -777,7 +777,7 @@ pty_clone(void *arg, char *name, int namelen, struct cdev **dev) { int u; - if (*dev != NODEV) + if (*dev != NULL) return; if (bcmp(name, "pty", 3) != 0) return; diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index 85b0eacba66e..e467dd304364 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -58,7 +58,7 @@ static void ctty_clone(void *arg, char *name, int namelen, struct cdev **dev) { - if (*dev != NODEV) + if (*dev != NULL) return; if (strcmp(name, "tty")) return; diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 18a4274c336f..16d80b43dd56 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -447,7 +447,7 @@ uipc_sense(struct socket *so, struct stat *sb) so2 = unp->unp_conn->unp_socket; sb->st_blksize += so2->so_rcv.sb_cc; } - sb->st_dev = NOUDEV; + sb->st_dev = NODEV; if (unp->unp_ino == 0) unp->unp_ino = (++unp_ino == 0) ? ++unp_ino : unp_ino; sb->st_ino = unp->unp_ino; diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 19b672621857..1bfb331a1fb6 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -517,7 +517,7 @@ bufinit(void) bp = &buf[i]; bzero(bp, sizeof *bp); bp->b_flags = B_INVAL; /* we're just an empty header */ - bp->b_dev = NODEV; + bp->b_dev = NULL; bp->b_rcred = NOCRED; bp->b_wcred = NOCRED; bp->b_qindex = QUEUE_EMPTY; @@ -1413,7 +1413,7 @@ brelse(struct buf * bp) bp->b_qindex = QUEUE_EMPTY; } TAILQ_INSERT_HEAD(&bufqueues[bp->b_qindex], bp, b_freelist); - bp->b_dev = NODEV; + bp->b_dev = NULL; /* buffers with junk contents */ } else if (bp->b_flags & (B_INVAL | B_NOCACHE | B_RELBUF) || (bp->b_ioflags & BIO_ERROR)) { @@ -1423,7 +1423,7 @@ brelse(struct buf * bp) panic("losing buffer 2"); bp->b_qindex = QUEUE_CLEAN; TAILQ_INSERT_HEAD(&bufqueues[QUEUE_CLEAN], bp, b_freelist); - bp->b_dev = NODEV; + bp->b_dev = NULL; /* remaining buffers */ } else { if (bp->b_flags & B_DELWRI) @@ -1917,7 +1917,7 @@ restart: bp->b_ioflags = 0; bp->b_xflags = 0; bp->b_vflags = 0; - bp->b_dev = NODEV; + bp->b_dev = NULL; bp->b_vp = NULL; bp->b_blkno = bp->b_lblkno = 0; bp->b_offset = NOOFFSET; diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 8eaa6e9ce8b9..82086ad5b4bf 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -147,7 +147,7 @@ static char *cdrom_rootdevnames[] = { /* legacy find-root code */ char *rootdevnames[2] = {NULL, NULL}; static int setrootbyname(char *name); -struct cdev *rootdev = NODEV; +struct cdev *rootdev = NULL; /* * Has to be dynamic as the value of rootdev can change; however, it can't @@ -162,7 +162,7 @@ sysctl_rootdev(SYSCTL_HANDLER_ARGS) /* _RD prevents this from happening. */ KASSERT(req->newptr == NULL, ("Attempt to change root device name")); - if (rootdev != NODEV) + if (rootdev != NULL) error = sysctl_handle_string(oidp, rootdev->si_name, 0, req); else error = sysctl_handle_string(oidp, "", 0, req); @@ -1339,7 +1339,7 @@ vfs_mountroot_try(char *mountfrom) printf("setrootbyname failed\n"); /* If the root device is a type "memory disk", mount RW */ - if (rootdev != NODEV && devsw(rootdev) != NULL) { + if (rootdev != NULL && devsw(rootdev) != NULL) { devname = devtoname(rootdev); if (devname[0] == 'm' && devname[1] == 'd') mp->mnt_flag &= ~MNT_RDONLY; @@ -1457,7 +1457,7 @@ getdiskbyname(char *name) { if (!bcmp(cp, "/dev/", 5)) cp += 5; - dev = NODEV; + dev = NULL; EVENTHANDLER_INVOKE(dev_clone, cp, strlen(cp), &dev); return (dev); } @@ -1472,7 +1472,7 @@ setrootbyname(char *name) struct cdev *diskdev; diskdev = getdiskbyname(name); - if (diskdev != NODEV) { + if (diskdev != NULL) { rootdev = diskdev; return (0); } @@ -1491,7 +1491,7 @@ DB_SHOW_COMMAND(disk, db_getdiskbyname) return; } dev = getdiskbyname(modif); - if (dev != NODEV) + if (dev != NULL) db_printf("struct cdev *= %p\n", dev); else db_printf("No disk device matched.\n"); diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 0346fa2130d1..96fdaab59f45 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -367,7 +367,7 @@ vfs_getnewfsid(mp) tfsid.val[1] = mtype; mtype = (mtype & 0xFF) << 24; for (;;) { - tfsid.val[0] = makeudev(255, + tfsid.val[0] = makedev(255, mtype | ((mntid_base & 0xFF00) << 8) | (mntid_base & 0xFF)); mntid_base++; if (vfs_getvfs(&tfsid) == NULL) @@ -1744,7 +1744,7 @@ bdevvp(dev, vpp) struct vnode *nvp; int error; - if (dev == NODEV) { + if (dev == NULL) { *vpp = NULLVP; return (ENXIO); } @@ -1786,7 +1786,7 @@ v_incr_usecount(struct vnode *vp, int delta) struct vnode * addaliasu(nvp, nvp_rdev) struct vnode *nvp; - udev_t nvp_rdev; + dev_t nvp_rdev; { struct vnode *ovp; vop_t **ops; @@ -1796,8 +1796,8 @@ addaliasu(nvp, nvp_rdev) return (nvp); if (nvp->v_type != VCHR) panic("addaliasu on non-special vnode"); - dev = udev2dev(nvp_rdev); - if (dev == NODEV) + dev = findcdev(nvp_rdev); + if (dev == NULL) return (nvp); /* * Check to see if we have a bdevvp vnode with no associated @@ -1836,7 +1836,7 @@ addaliasu(nvp, nvp_rdev) } /* This is a local helper function that do the same as addaliasu, but for a - * struct cdev *instead of an udev_t. */ + * struct cdev *instead of an dev_t. */ static void addalias(nvp, dev) struct vnode *nvp; @@ -2581,7 +2581,7 @@ vgonel(vp, td) * if it is on one. */ VI_LOCK(vp); - if (vp->v_type == VCHR && vp->v_rdev != NODEV) { + if (vp->v_type == VCHR && vp->v_rdev != NULL) { mtx_lock(&spechash_mtx); SLIST_REMOVE(&vp->v_rdev->si_hlist, vp, vnode, v_specnext); vp->v_rdev->si_usecount -= vp->v_usecount; @@ -3407,7 +3407,7 @@ vn_todev(vp) { if (vp->v_type != VCHR) - return (NODEV); + return (NULL); return (vp->v_rdev); } diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 4b3cf45fa9d0..189b72fe4ffd 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1578,7 +1578,7 @@ bpf_clone(arg, name, namelen, dev) { int u; - if (*dev != NODEV) + if (*dev != NULL) return; if (dev_stdclone(name, NULL, "bpf", &u) != 1) return; diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index 7f2f8564277e..7eb4ac0c86bf 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -228,7 +228,7 @@ tapclone(arg, name, namelen, dev) int i, unit; char *device_name = name; - if (*dev != NODEV) + if (*dev != NULL) return; device_name = TAP; diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 975b1c0474d0..b5b32987f1c5 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -138,7 +138,7 @@ tunclone(void *arg, char *name, int namelen, struct cdev **dev) { int u, i; - if (*dev != NODEV) + if (*dev != NULL) return; if (strcmp(name, TUNNAME) == 0) { diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c index c28e772351a1..1068dad9a390 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c @@ -408,7 +408,7 @@ USB_ATTACH(ubt) sc->sc_hook = NULL; /* Device part */ - sc->sc_ctrl_dev = sc->sc_intr_dev = sc->sc_bulk_dev = NODEV; + sc->sc_ctrl_dev = sc->sc_intr_dev = sc->sc_bulk_dev = NULL; sc->sc_refcnt = sc->sc_dying = 0; /* @@ -1903,8 +1903,8 @@ ng_ubt_newhook(node_p node, hook_p hook, char const *name) ubt_softc_p sc = (ubt_softc_p) NG_NODE_PRIVATE(node); /* Refuse to create new hook if device interface is active */ - if (sc->sc_ctrl_dev != NODEV || sc->sc_intr_dev != NODEV || - sc->sc_bulk_dev != NODEV) + if (sc->sc_ctrl_dev != NULL || sc->sc_intr_dev != NULL || + sc->sc_bulk_dev != NULL) return (EBUSY); if (strcmp(name, NG_UBT_HOOK) != 0) @@ -1929,8 +1929,8 @@ ng_ubt_connect(hook_p hook) usbd_status status; /* Refuse to connect hook if device interface is active */ - if (sc->sc_ctrl_dev != NODEV || sc->sc_intr_dev != NODEV || - sc->sc_bulk_dev != NODEV) + if (sc->sc_ctrl_dev != NULL || sc->sc_intr_dev != NULL || + sc->sc_bulk_dev != NULL) return (EBUSY); NG_HOOK_FORCE_QUEUE(NG_HOOK_PEER(hook)); @@ -2658,14 +2658,14 @@ ubt_create_device_nodes(ubt_softc_p sc) "%s: %s - hook != NULL!\n", __func__, USBDEVNAME(sc->sc_dev))); /* Control device */ - if (sc->sc_ctrl_dev == NODEV) + if (sc->sc_ctrl_dev == NULL) sc->sc_ctrl_dev = make_dev(&ubt_cdevsw, UBT_MINOR(USBDEVUNIT(sc->sc_dev), 0), UID_ROOT, GID_OPERATOR, 0644, "%s", USBDEVNAME(sc->sc_dev)); /* Interrupt device */ - if (sc->sc_intr_dev == NODEV && sc->sc_intr_ep != -1) { + if (sc->sc_intr_dev == NULL && sc->sc_intr_ep != -1) { ep = UE_GET_ADDR(sc->sc_intr_ep); sc->sc_intr_dev = make_dev(&ubt_cdevsw, UBT_MINOR(USBDEVUNIT(sc->sc_dev), ep), @@ -2679,7 +2679,7 @@ ubt_create_device_nodes(ubt_softc_p sc) * XXX note that address of the in and out endpoint should be the same */ - if (sc->sc_bulk_dev == NODEV && + if (sc->sc_bulk_dev == NULL && sc->sc_bulk_in_ep != -1 && sc->sc_bulk_out_ep != -1 && UE_GET_ADDR(sc->sc_bulk_in_ep) == UE_GET_ADDR(sc->sc_bulk_out_ep)) { ep = UE_GET_ADDR(sc->sc_bulk_in_ep); @@ -2712,19 +2712,19 @@ ubt_destroy_device_nodes(ubt_softc_p sc) sc->sc_refcnt = 0; /* Destroy device nodes */ - if (sc->sc_bulk_dev != NODEV) { + if (sc->sc_bulk_dev != NULL) { destroy_dev(sc->sc_bulk_dev); - sc->sc_bulk_dev = NODEV; + sc->sc_bulk_dev = NULL; } - if (sc->sc_intr_dev != NODEV) { + if (sc->sc_intr_dev != NULL) { destroy_dev(sc->sc_intr_dev); - sc->sc_intr_dev = NODEV; + sc->sc_intr_dev = NULL; } - if (sc->sc_ctrl_dev != NODEV) { + if (sc->sc_ctrl_dev != NULL) { destroy_dev(sc->sc_ctrl_dev); - sc->sc_ctrl_dev = NODEV; + sc->sc_ctrl_dev = NULL; } } /* ubt_destroy_device_nodes */ diff --git a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c index f957cf52e8ed..53f367eb3e05 100644 --- a/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c +++ b/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c @@ -149,7 +149,7 @@ USB_ATTACH(ubtbcmfw) USB_ATTACH_SETUP; printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo); - sc->sc_ctrl_dev = sc->sc_intr_in_dev = sc->sc_bulk_out_dev = NODEV; + sc->sc_ctrl_dev = sc->sc_intr_in_dev = sc->sc_bulk_out_dev = NULL; sc->sc_intr_in_pipe = sc->sc_bulk_out_pipe = NULL; sc->sc_flags = sc->sc_refcnt = sc->sc_dying = 0; @@ -229,19 +229,19 @@ USB_DETACH(ubtbcmfw) } /* Destroy device nodes */ - if (sc->sc_bulk_out_dev != NODEV) { + if (sc->sc_bulk_out_dev != NULL) { destroy_dev(sc->sc_bulk_out_dev); - sc->sc_bulk_out_dev = NODEV; + sc->sc_bulk_out_dev = NULL; } - if (sc->sc_intr_in_dev != NODEV) { + if (sc->sc_intr_in_dev != NULL) { destroy_dev(sc->sc_intr_in_dev); - sc->sc_intr_in_dev = NODEV; + sc->sc_intr_in_dev = NULL; } - if (sc->sc_ctrl_dev != NODEV) { + if (sc->sc_ctrl_dev != NULL) { destroy_dev(sc->sc_ctrl_dev); - sc->sc_ctrl_dev = NODEV; + sc->sc_ctrl_dev = NULL; } /* Close pipes */ diff --git a/sys/netsmb/smb_dev.c b/sys/netsmb/smb_dev.c index 78a60680f925..a69d0f0d100b 100644 --- a/sys/netsmb/smb_dev.c +++ b/sys/netsmb/smb_dev.c @@ -103,7 +103,7 @@ nsmb_dev_clone(void *arg, char *name, int namelen, struct cdev **dev) { int u; - if (*dev != NODEV) + if (*dev != NULL) return; if (dev_stdclone(name, NULL, NSMB_NAME, &u) != 1) return; @@ -397,7 +397,7 @@ smb_dev2share(int fd, int mode, struct smb_cred *scred, return EBADF; } dev = vn_todev(vp); - if (dev == NODEV) { + if (dev == NULL) { fdrop(fp, curthread); return EBADF; } diff --git a/sys/nfs4client/nfs4_vn_subs.c b/sys/nfs4client/nfs4_vn_subs.c index 28eb52d88a40..cded7f57a5de 100644 --- a/sys/nfs4client/nfs4_vn_subs.c +++ b/sys/nfs4client/nfs4_vn_subs.c @@ -83,7 +83,7 @@ nfs4_vnop_loadattrcache(struct vnode *vp, struct nfsv4_fattr *fap, vtyp = nv3tov_type[fap->fa4_type & 0x7]; vmode = (fap->fa4_valid & FA4V_MODE) ? fap->fa4_mode : 0777; rdev = (fap->fa4_valid & FA4V_RDEV) ? - makeudev(fap->fa4_rdev_major, fap->fa4_rdev_minor) : 0; + makedev(fap->fa4_rdev_major, fap->fa4_rdev_minor) : 0; if (fap->fa4_valid & FA4V_MTIME) mtime = fap->fa4_mtime; else diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c index 6a3fea3d7cff..af8f3c312e8f 100644 --- a/sys/nfsclient/nfs_subs.c +++ b/sys/nfsclient/nfs_subs.c @@ -495,7 +495,7 @@ nfs_loadattrcache(struct vnode **vpp, struct mbuf **mdp, caddr_t *dposp, if (v3) { vtyp = nfsv3tov_type(fp->fa_type); vmode = fxdr_unsigned(u_short, fp->fa_mode); - rdev = makeudev(fxdr_unsigned(int, fp->fa3_rdev.specdata1), + rdev = makedev(fxdr_unsigned(int, fp->fa3_rdev.specdata1), fxdr_unsigned(int, fp->fa3_rdev.specdata2)); fxdr_nfsv3time(&fp->fa3_mtime, &mtime); } else { diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c index e57840159e8e..a861c3946f01 100644 --- a/sys/nfsserver/nfs_serv.c +++ b/sys/nfsserver/nfs_serv.c @@ -2060,7 +2060,7 @@ nfsrv_mknod(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, tl = nfsm_dissect(u_int32_t *, 2 * NFSX_UNSIGNED); major = fxdr_unsigned(u_int32_t, *tl++); minor = fxdr_unsigned(u_int32_t, *tl); - vap->va_rdev = makeudev(major, minor); + vap->va_rdev = makedev(major, minor); } /* diff --git a/sys/sys/_types.h b/sys/sys/_types.h index 478fd419543d..0b3467d266ed 100644 --- a/sys/sys/_types.h +++ b/sys/sys/_types.h @@ -53,7 +53,6 @@ typedef __uint8_t __sa_family_t; typedef __uint32_t __socklen_t; typedef long __suseconds_t; /* microseconds (signed) */ typedef __int32_t __timer_t; /* timer_gettime()... */ -typedef __uint32_t __udev_t; /* device number */ typedef __uint32_t __uid_t; typedef unsigned int __useconds_t; /* microseconds (unsigned) */ @@ -80,9 +79,7 @@ typedef __ct_rune_t __rune_t; /* rune_t (see above) */ typedef __ct_rune_t __wchar_t; /* wchar_t (see above) */ typedef __ct_rune_t __wint_t; /* wint_t (see above) */ -#ifndef _KERNEL -typedef __udev_t __dev_t; /* device number */ -#endif +typedef __uint32_t __dev_t; /* device number */ typedef __uint32_t __fixpt_t; /* fixed point number */ diff --git a/sys/sys/acct.h b/sys/sys/acct.h index ecd6a5d505a1..167a90ccb922 100644 --- a/sys/sys/acct.h +++ b/sys/sys/acct.h @@ -56,7 +56,7 @@ struct acct { gid_t ac_gid; /* group id */ u_int16_t ac_mem; /* average memory usage */ comp_t ac_io; /* count of IO blocks */ - __udev_t ac_tty; /* controlling tty */ + __dev_t ac_tty; /* controlling tty */ #define AFORK 0x01 /* forked but not exec'ed */ /* ASU is no longer supported */ diff --git a/sys/sys/conf.h b/sys/sys/conf.h index d97db9350a93..e90713db213c 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -64,7 +64,7 @@ struct cdev { struct timespec si_atime; struct timespec si_ctime; struct timespec si_mtime; - udev_t si_udev; + dev_t si_udev; int si_refcount; LIST_ENTRY(cdev) si_list; LIST_ENTRY(cdev) si_clone; diff --git a/sys/sys/param.h b/sys/sys/param.h index 67a8e9831ae0..08fe7e85de55 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -55,7 +55,7 @@ * scheme is: <0 if release branch, otherwise 1>xx */ #undef __FreeBSD_version -#define __FreeBSD_version 502116 /* Master, propagated to newvers */ +#define __FreeBSD_version 502117 /* Master, propagated to newvers */ #ifndef LOCORE #include @@ -185,13 +185,8 @@ #define NBPW sizeof(int) /* number of bytes per word (integer) */ #define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */ -#ifdef _KERNEL -#define NOUDEV (udev_t)(-1) /* non-existent device */ -#define NOMAJ 256 /* non-existent device */ -#define NODEV NULL /* non-existent device */ -#else + #define NODEV (dev_t)(-1) /* non-existent device */ -#endif #define CBLOCK 128 /* Clist block size, must be a power of 2. */ #define CBQSIZE (CBLOCK/NBBY) /* Quote bytes/cblock - can do better. */ diff --git a/sys/sys/snoop.h b/sys/sys/snoop.h index 026dd7aa1eab..992be9b43aad 100644 --- a/sys/sys/snoop.h +++ b/sys/sys/snoop.h @@ -30,8 +30,8 @@ * detached from its current tty. */ -#define SNPSTTY _IOW('T', 90, udev_t) -#define SNPGTTY _IOR('T', 89, udev_t) +#define SNPSTTY _IOW('T', 90, dev_t) +#define SNPGTTY _IOR('T', 89, dev_t) /* * These values would be returned by FIONREAD ioctl diff --git a/sys/sys/stat.h b/sys/sys/stat.h index 0f7f4a33d8c0..0f7e349404b5 100644 --- a/sys/sys/stat.h +++ b/sys/sys/stat.h @@ -44,9 +44,7 @@ /* XXX missing blkcnt_t, blksize_t. */ #ifndef _DEV_T_DECLARED -#ifndef _KERNEL typedef __dev_t dev_t; -#endif #define _DEV_T_DECLARED #endif @@ -123,13 +121,13 @@ struct ostat { #endif /* __BSD_VISIBLE */ struct stat { - __udev_t st_dev; /* inode's device */ + __dev_t st_dev; /* inode's device */ ino_t st_ino; /* inode's number */ mode_t st_mode; /* inode protection mode */ nlink_t st_nlink; /* number of hard links */ uid_t st_uid; /* user ID of the file's owner */ gid_t st_gid; /* group ID of the file's group */ - __udev_t st_rdev; /* device type */ + __dev_t st_rdev; /* device type */ #if __BSD_VISIBLE struct timespec st_atimespec; /* time of last access */ struct timespec st_mtimespec; /* time of last data modification */ @@ -170,13 +168,13 @@ struct stat { #if __BSD_VISIBLE struct nstat { - __udev_t st_dev; /* inode's device */ + __dev_t st_dev; /* inode's device */ ino_t st_ino; /* inode's number */ __uint32_t st_mode; /* inode protection mode */ __uint32_t st_nlink; /* number of hard links */ uid_t st_uid; /* user ID of the file's owner */ gid_t st_gid; /* group ID of the file's group */ - __udev_t st_rdev; /* device type */ + __dev_t st_rdev; /* device type */ struct timespec st_atimespec; /* time of last access */ struct timespec st_mtimespec; /* time of last data modification */ struct timespec st_ctimespec; /* time of last file status change */ diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 1a06d821ca22..a1f67bb07302 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -316,11 +316,10 @@ void wakeup_one(void *chan) __nonnull(1); int major(struct cdev *x); int minor(struct cdev *x); -udev_t dev2udev(struct cdev *x); -struct cdev *udev2dev(udev_t x); -int uminor(udev_t dev); -int umajor(udev_t dev); -udev_t makeudev(int x, int y); +dev_t dev2udev(struct cdev *x); +struct cdev *findcdev(dev_t x); +int uminor(dev_t dev); +int umajor(dev_t dev); /* XXX: Should be void nanodelay(u_int nsec); */ void DELAY(int usec); diff --git a/sys/sys/tty.h b/sys/sys/tty.h index 1b8958bd6f35..a51a6e4b8692 100644 --- a/sys/sys/tty.h +++ b/sys/sys/tty.h @@ -82,7 +82,7 @@ struct tty { int t_line; /* Interface to device drivers. */ union { struct cdev *t_kdev; /* Device. */ - udev_t t_udev; /* Userland (sysctl) instance. */ + dev_t t_udev; /* Userland (sysctl) instance. */ void *t_devp; /* Keep user/kernel size in sync. */ } ttyu; int t_state; /* Device and driver (TS*) state. */ @@ -141,7 +141,7 @@ struct xtty { long xt_cancc; /* Canonical queue statistics. */ long xt_outcc; /* Output queue statistics. */ int xt_line; /* Interface to device drivers. */ - udev_t xt_dev; /* Userland (sysctl) instance. */ + dev_t xt_dev; /* Userland (sysctl) instance. */ int xt_state; /* Device and driver (TS*) state. */ int xt_flags; /* Tty flags. */ int xt_timeout; /* Timeout for ttywait(). */ diff --git a/sys/sys/types.h b/sys/sys/types.h index 87d03d92d291..6de77ac53b67 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -131,9 +131,7 @@ typedef __critical_t critical_t; /* Critical section value */ typedef __int64_t daddr_t; /* disk address */ #ifndef _DEV_T_DECLARED -#ifndef _KERNEL typedef __dev_t dev_t; /* device number or struct cdev */ -#endif #define _DEV_T_DECLARED #endif @@ -235,7 +233,6 @@ typedef __timer_t timer_t; #endif typedef __u_register_t u_register_t; -typedef __udev_t udev_t; /* device number */ #ifndef _UID_T_DECLARED typedef __uid_t uid_t; /* user id */ @@ -292,9 +289,10 @@ typedef struct vm_page *vm_page_t; */ #define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */ #define minor(x) ((int)((x)&0xffff00ff)) /* minor number */ -#define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */ #endif /* !_KERNEL */ +#define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */ + /* * These declarations belong elsewhere, but are repeated here and in * to give broken programs a better chance of working with diff --git a/sys/sys/user.h b/sys/sys/user.h index 0c1d00543423..c6fc22da2aa4 100644 --- a/sys/sys/user.h +++ b/sys/sys/user.h @@ -108,7 +108,7 @@ struct kinfo_proc { pid_t ki_sid; /* Process session ID */ pid_t ki_tsid; /* Terminal session ID */ short ki_jobc; /* job control counter */ - udev_t ki_tdev; /* controlling tty dev */ + dev_t ki_tdev; /* controlling tty dev */ sigset_t ki_siglist; /* Signals arrived but not delivered */ sigset_t ki_sigmask; /* Current signal mask */ sigset_t ki_sigignore; /* Signals being ignored */ diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 10df935c595f..3fc66c4ee913 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -153,7 +153,7 @@ struct vnode { const char *filename; /* Source file doing locking */ int line; /* Line number doing locking */ #endif - udev_t v_cachedfs; /* cached fs id */ + dev_t v_cachedfs; /* cached fs id */ ino_t v_cachedid; /* cached file id */ }; #define v_mountedhere v_un.vu_mountedhere @@ -179,9 +179,9 @@ struct xvnode { union { void *xvu_socket; /* socket, if VSOCK */ void *xvu_fifo; /* fifo, if VFIFO */ - udev_t xvu_rdev; /* maj/min, if VBLK/VCHR */ + dev_t xvu_rdev; /* maj/min, if VBLK/VCHR */ struct { - udev_t xvu_dev; /* device, if VDIR/VREG/VLNK */ + dev_t xvu_dev; /* device, if VDIR/VREG/VLNK */ ino_t xvu_ino; /* id, if VDIR/VREG/VLNK */ } xv_uns; } xv_un; @@ -247,7 +247,7 @@ struct vattr { short va_nlink; /* number of references to file */ uid_t va_uid; /* owner user id */ gid_t va_gid; /* owner group id */ - udev_t va_fsid; /* filesystem id */ + dev_t va_fsid; /* filesystem id */ long va_fileid; /* file id */ u_quad_t va_size; /* file size in bytes */ long va_blocksize; /* blocksize preferred for i/o */ @@ -257,7 +257,7 @@ struct vattr { struct timespec va_birthtime; /* time file created */ u_long va_gen; /* generation number of file */ u_long va_flags; /* flags defined for file */ - udev_t va_rdev; /* device the special file represents */ + dev_t va_rdev; /* device the special file represents */ u_quad_t va_bytes; /* bytes of disk space held by file */ u_quad_t va_filerev; /* file modification number */ u_int va_vaflags; /* operations flags, see below */ @@ -593,7 +593,7 @@ extern int (*lease_check_hook)(struct vop_lease_args *); extern int (*softdep_fsync_hook)(struct vnode *); extern int (*softdep_process_worklist_hook)(struct mount *); -struct vnode *addaliasu(struct vnode *vp, udev_t nvp_rdev); +struct vnode *addaliasu(struct vnode *vp, dev_t nvp_rdev); int bdevvp(struct cdev *dev, struct vnode **vpp); /* cache_* may belong in namei.h. */ void cache_enter(struct vnode *dvp, struct vnode *vp, diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 586ec82117d9..66483e69c199 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -154,7 +154,7 @@ struct swdevt { int sw_flags; int sw_nblks; int sw_used; - udev_t sw_udev; + dev_t sw_dev; struct vnode *sw_vp; void *sw_id; swblk_t sw_first; @@ -2079,7 +2079,7 @@ done2: } static void -swaponsomething(struct vnode *vp, void *id, u_long nblks, sw_strategy_t *strategy, sw_close_t *close, udev_t udev) +swaponsomething(struct vnode *vp, void *id, u_long nblks, sw_strategy_t *strategy, sw_close_t *close, dev_t dev) { struct swdevt *sp, *tsp; swblk_t dvbase; @@ -2107,7 +2107,7 @@ swaponsomething(struct vnode *vp, void *id, u_long nblks, sw_strategy_t *strateg sp = malloc(sizeof *sp, M_VMPGDATA, M_WAITOK | M_ZERO); sp->sw_vp = vp; sp->sw_id = id; - sp->sw_udev = udev; + sp->sw_dev = dev; sp->sw_flags = 0; sp->sw_nblks = nblks; sp->sw_used = 0; @@ -2293,7 +2293,7 @@ sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) if (n == *name) { mtx_unlock(&sw_dev_mtx); xs.xsw_version = XSWDEV_VERSION; - xs.xsw_dev = sp->sw_udev; + xs.xsw_dev = sp->sw_dev; xs.xsw_flags = sp->sw_flags; xs.xsw_nblks = sp->sw_nblks; xs.xsw_used = sp->sw_used; @@ -2533,7 +2533,7 @@ swapdev_strategy(struct buf *bp, struct swdevt *sp) int s; struct vnode *vp, *vp2; - bp->b_dev = NODEV; + bp->b_dev = NULL; bp->b_blkno = ctodb(bp->b_blkno - sp->sw_first); vp2 = sp->sw_id; @@ -2598,6 +2598,6 @@ swaponvp(struct thread *td, struct vnode *vp, u_long nblks) return (error); swaponsomething(vp, vp, nblks, swapdev_strategy, swapdev_close, - NOUDEV); + NODEV); return (0); } diff --git a/sys/vm/vm_param.h b/sys/vm/vm_param.h index 46827ce545ac..dab1245f4f7a 100644 --- a/sys/vm/vm_param.h +++ b/sys/vm/vm_param.h @@ -107,7 +107,7 @@ #define XSWDEV_VERSION 1 struct xswdev { u_int xsw_version; - udev_t xsw_dev; + dev_t xsw_dev; int xsw_flags; int xsw_nblks; int xsw_used; diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index 1578dd3ca44c..b329ec83bfc1 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -585,8 +585,8 @@ ufs_filestat(vp, fsp) return 0; } /* - * The st_dev from stat(2) is a udev_t. These kernel structures - * contain dev_t structures. We need to convert to udev to make + * The st_dev from stat(2) is a dev_t. These kernel structures + * contain cdev pointers. We need to convert to dev_t to make * comparisons */ fsp->fsid = dev2udev(inode.i_dev); @@ -875,10 +875,10 @@ bad: /* - * Read the cdev structure in the kernel (as pointed to by a dev_t) - * in order to work out the associated udev_t + * Read the cdev structure in the kernel in order to work out the + * associated dev_t */ -udev_t +dev_t dev2udev(dev) struct cdev *dev; { @@ -887,7 +887,7 @@ dev2udev(dev) if (KVM_READ(dev, &si, sizeof si)) { return si.si_udev; } else { - dprintf(stderr, "can't convert dev_t %x to a udev_t\n", dev); + dprintf(stderr, "can't convert cdev *%x to a dev_t\n", dev); return -1; } } diff --git a/usr.bin/fstat/fstat.h b/usr.bin/fstat/fstat.h index 9cfbd6298b45..cf4e15aede00 100644 --- a/usr.bin/fstat/fstat.h +++ b/usr.bin/fstat/fstat.h @@ -64,7 +64,7 @@ extern kvm_t *kd; extern int vflg; extern int Pid; -udev_t dev2udev(struct cdev *dev); +dev_t dev2udev(struct cdev *dev); /* Additional filesystem types */ int isofs_filestat(struct vnode *vp, struct filestat *fsp); diff --git a/usr.bin/pkill/pkill.c b/usr.bin/pkill/pkill.c index 565dc3cf1f41..fa17d6e2aa66 100644 --- a/usr.bin/pkill/pkill.c +++ b/usr.bin/pkill/pkill.c @@ -383,7 +383,7 @@ main(int argc, char **argv) if (li->li_number == -1 && (kp->ki_flag & P_CONTROLT) == 0) break; - if (kp->ki_tdev == (udev_t)li->li_number) + if (kp->ki_tdev == (dev_t)li->li_number) break; } if (SLIST_FIRST(&tdevlist) != NULL && li == NULL) { -- cgit v1.3 From 098ca2bda93c701c5331d4e6aace072495b4caaa Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 6 Jan 2005 01:43:34 +0000 Subject: Start each of the license/copyright comments with /*-, minor shuffle of lines --- sys/dev/aac/aac_cam.c | 2 +- sys/dev/acpica/acpi_ec.c | 3 +- sys/dev/acpica/acpi_if.m | 2 +- sys/dev/acpica/acpi_pci.c | 2 +- sys/dev/advansys/adv_eisa.c | 2 +- sys/dev/advansys/adv_isa.c | 2 +- sys/dev/advansys/adv_pci.c | 2 +- sys/dev/advansys/advansys.c | 4 +-- sys/dev/advansys/advansys.h | 2 +- sys/dev/advansys/advlib.c | 4 +-- sys/dev/advansys/advlib.h | 4 +-- sys/dev/advansys/advmcode.c | 2 +- sys/dev/advansys/advmcode.h | 2 +- sys/dev/advansys/adw_pci.c | 2 +- sys/dev/advansys/adwcam.c | 2 +- sys/dev/advansys/adwlib.c | 4 +-- sys/dev/advansys/adwlib.h | 2 +- sys/dev/advansys/adwmcode.c | 2 +- sys/dev/advansys/adwmcode.h | 2 +- sys/dev/advansys/adwvar.h | 2 +- sys/dev/aha/aha.c | 2 +- sys/dev/aha/aha_isa.c | 2 +- sys/dev/aha/ahareg.h | 2 +- sys/dev/ahb/ahb.c | 2 +- sys/dev/ahb/ahbreg.h | 2 +- sys/dev/aic/aic6360reg.h | 2 +- sys/dev/aic7xxx/ahc_eisa.c | 2 +- sys/dev/aic7xxx/ahc_isa.c | 2 +- sys/dev/aic7xxx/ahc_pci.c | 2 +- sys/dev/aic7xxx/ahd_pci.c | 2 +- sys/dev/aic7xxx/aic7770.c | 2 +- sys/dev/aic7xxx/aic79xx.c | 2 +- sys/dev/aic7xxx/aic79xx.h | 2 +- sys/dev/aic7xxx/aic79xx.reg | 2 +- sys/dev/aic7xxx/aic79xx.seq | 2 +- sys/dev/aic7xxx/aic79xx_inline.h | 2 +- sys/dev/aic7xxx/aic79xx_osm.c | 2 +- sys/dev/aic7xxx/aic79xx_osm.h | 2 +- sys/dev/aic7xxx/aic79xx_pci.c | 2 +- sys/dev/aic7xxx/aic7xxx.c | 2 +- sys/dev/aic7xxx/aic7xxx.h | 2 +- sys/dev/aic7xxx/aic7xxx.reg | 2 +- sys/dev/aic7xxx/aic7xxx.seq | 2 +- sys/dev/aic7xxx/aic7xxx_93cx6.c | 2 +- sys/dev/aic7xxx/aic7xxx_93cx6.h | 2 +- sys/dev/aic7xxx/aic7xxx_inline.h | 2 +- sys/dev/aic7xxx/aic7xxx_osm.c | 2 +- sys/dev/aic7xxx/aic7xxx_osm.h | 2 +- sys/dev/aic7xxx/aic7xxx_pci.c | 2 +- sys/dev/aic7xxx/aic_osm_lib.c | 2 +- sys/dev/aic7xxx/aic_osm_lib.h | 2 +- sys/dev/aic7xxx/aicasm/aicasm.c | 2 +- sys/dev/aic7xxx/aicasm/aicasm.h | 2 +- sys/dev/aic7xxx/aicasm/aicasm_gram.y | 2 +- sys/dev/aic7xxx/aicasm/aicasm_insformat.h | 2 +- sys/dev/aic7xxx/aicasm/aicasm_macro_gram.y | 2 +- sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l | 2 +- sys/dev/aic7xxx/aicasm/aicasm_scan.l | 2 +- sys/dev/aic7xxx/aicasm/aicasm_symbol.c | 2 +- sys/dev/aic7xxx/aicasm/aicasm_symbol.h | 2 +- sys/dev/amd/amd.c | 2 +- sys/dev/amd/amd.h | 2 +- sys/dev/amr/amr.c | 2 +- sys/dev/amr/amr_cam.c | 2 +- sys/dev/amr/amr_disk.c | 2 +- sys/dev/amr/amr_pci.c | 2 +- sys/dev/an/if_aironet_ieee.h | 2 +- sys/dev/an/if_an.c | 2 +- sys/dev/an/if_an_isa.c | 2 +- sys/dev/an/if_an_pccard.c | 2 +- sys/dev/an/if_anreg.h | 2 +- sys/dev/ar/if_ar.c | 2 +- sys/dev/ar/if_ar.h | 2 +- sys/dev/ar/if_ar_isa.c | 2 +- sys/dev/ar/if_arregs.h | 2 +- sys/dev/asr/dptalign.h | 2 +- sys/dev/asr/dptsig.h | 2 +- sys/dev/asr/i2oadptr.h | 3 +- sys/dev/asr/i2obscsi.h | 3 +- sys/dev/asr/i2odep.h | 3 +- sys/dev/asr/i2odpt.h | 3 +- sys/dev/asr/i2oexec.h | 3 +- sys/dev/asr/i2omsg.h | 3 +- sys/dev/asr/i2otypes.h | 3 +- sys/dev/asr/i2outil.h | 3 +- sys/dev/asr/osd_defs.h | 2 +- sys/dev/asr/osd_unix.h | 2 +- sys/dev/asr/osd_util.h | 2 +- sys/dev/asr/sys_info.h | 2 +- sys/dev/auxio/auxio.c | 2 +- sys/dev/auxio/auxioreg.h | 2 +- sys/dev/awi/if_awi_pccard.c | 2 +- sys/dev/bfe/if_bfe.c | 6 ++-- sys/dev/bfe/if_bfereg.h | 5 +-- sys/dev/bge/if_bge.c | 2 +- sys/dev/bge/if_bgereg.h | 2 +- sys/dev/bktr/bktr_audio.h | 2 +- sys/dev/bktr/bktr_card.h | 2 +- sys/dev/bktr/bktr_core.h | 2 +- sys/dev/bktr/bktr_mem.c | 2 +- sys/dev/bktr/bktr_mem.h | 2 +- sys/dev/bktr/bktr_os.h | 2 +- sys/dev/bktr/bktr_reg.h | 2 +- sys/dev/bktr/bktr_tuner.h | 2 +- sys/dev/bktr/ioctl_meteor.h | 2 +- sys/dev/buslogic/bt.c | 2 +- sys/dev/buslogic/bt_eisa.c | 2 +- sys/dev/buslogic/bt_isa.c | 2 +- sys/dev/buslogic/btreg.h | 2 +- sys/dev/cardbus/cardbus.c | 2 +- sys/dev/cardbus/cardbus_cis.c | 2 +- sys/dev/cardbus/cardbus_cis.h | 2 +- sys/dev/cardbus/cardbusreg.h | 2 +- sys/dev/cardbus/cardbusvar.h | 2 +- sys/dev/cnw/if_cnwioctl.h | 2 +- sys/dev/cp/cpddk.c | 2 +- sys/dev/cp/cpddk.h | 2 +- sys/dev/cp/if_cp.c | 2 +- sys/dev/cp/ng_cp.h | 2 +- sys/dev/cs/if_cs.c | 2 +- sys/dev/cs/if_cs_isa.c | 2 +- sys/dev/cs/if_cs_pccard.c | 2 +- sys/dev/cs/if_csreg.h | 2 +- sys/dev/cs/if_csvar.h | 2 +- sys/dev/ct/bshw_machdep.c | 2 +- sys/dev/ct/bshwvar.h | 2 +- sys/dev/ct/ct.c | 2 +- sys/dev/ct/ct_isa.c | 2 +- sys/dev/ct/ct_machdep.h | 2 +- sys/dev/ct/ctvar.h | 2 +- sys/dev/ctau/am8530.h | 2 +- sys/dev/ctau/ctau.c | 2 +- sys/dev/ctau/ctaureg.h | 2 +- sys/dev/ctau/ctddk.c | 2 +- sys/dev/ctau/ctddk.h | 2 +- sys/dev/ctau/ds2153.h | 2 +- sys/dev/ctau/hdc64570.h | 2 +- sys/dev/ctau/if_ct.c | 2 +- sys/dev/ctau/lxt318.h | 2 +- sys/dev/ctau/ng_ct.h | 2 +- sys/dev/cx/cronyxfw.h | 2 +- sys/dev/cx/csigma.c | 2 +- sys/dev/cx/cxddk.c | 2 +- sys/dev/cx/cxddk.h | 2 +- sys/dev/cx/cxreg.h | 2 +- sys/dev/cx/if_cx.c | 2 +- sys/dev/cx/machdep.h | 2 +- sys/dev/cx/ng_cx.h | 2 +- sys/dev/cy/cy_pci.c | 2 +- sys/dev/dc/dcphy.c | 2 +- sys/dev/dcons/dcons.c | 2 +- sys/dev/dcons/dcons.h | 2 +- sys/dev/dcons/dcons_crom.c | 2 +- sys/dev/dcons/dcons_os.c | 2 +- sys/dev/dcons/dcons_os.h | 2 +- sys/dev/dec/mc146818reg.h | 2 +- sys/dev/dec/mcclock.c | 2 +- sys/dev/dec/mcclock_if.m | 2 +- sys/dev/dec/mcclockvar.h | 2 +- sys/dev/dpt/dpt.h | 2 +- sys/dev/dpt/dpt_scsi.c | 2 +- sys/dev/drm/ati_pcigart.h | 4 +-- sys/dev/drm/drm.h | 2 +- sys/dev/drm/drmP.h | 4 +-- sys/dev/drm/drm_agpsupport.h | 4 +-- sys/dev/drm/drm_auth.h | 4 +-- sys/dev/drm/drm_bufs.h | 4 +-- sys/dev/drm/drm_context.h | 4 +-- sys/dev/drm/drm_dma.h | 4 +-- sys/dev/drm/drm_drawable.h | 4 +-- sys/dev/drm/drm_drv.h | 4 +-- sys/dev/drm/drm_fops.h | 4 +-- sys/dev/drm/drm_ioctl.h | 4 +-- sys/dev/drm/drm_irq.h | 4 +-- sys/dev/drm/drm_linux_list.h | 4 +-- sys/dev/drm/drm_lock.h | 4 +-- sys/dev/drm/drm_memory.h | 4 +-- sys/dev/drm/drm_memory_debug.h | 4 +-- sys/dev/drm/drm_os_freebsd.h | 2 +- sys/dev/drm/drm_pci.h | 2 +- sys/dev/drm/drm_sarea.h | 2 +- sys/dev/drm/drm_scatter.h | 4 +-- sys/dev/drm/drm_sysctl.h | 2 +- sys/dev/drm/drm_vm.h | 2 +- sys/dev/drm/mga.h | 4 +-- sys/dev/drm/mga_dma.c | 4 +-- sys/dev/drm/mga_drm.h | 4 +-- sys/dev/drm/mga_drv.c | 4 +-- sys/dev/drm/mga_drv.h | 4 +-- sys/dev/drm/mga_irq.c | 4 +-- sys/dev/drm/mga_state.c | 4 +-- sys/dev/drm/mga_ucode.h | 4 +-- sys/dev/drm/mga_warp.c | 4 +-- sys/dev/drm/r128.h | 4 +-- sys/dev/drm/r128_cce.c | 4 +-- sys/dev/drm/r128_drm.h | 4 +-- sys/dev/drm/r128_drv.c | 4 +-- sys/dev/drm/r128_drv.h | 4 +-- sys/dev/drm/r128_irq.c | 4 +-- sys/dev/drm/r128_state.c | 4 +-- sys/dev/drm/radeon.h | 4 +-- sys/dev/drm/radeon_cp.c | 4 +-- sys/dev/drm/radeon_drm.h | 4 +-- sys/dev/drm/radeon_drv.c | 4 +-- sys/dev/drm/radeon_drv.h | 4 +-- sys/dev/drm/radeon_irq.c | 4 +-- sys/dev/drm/radeon_mem.c | 4 +-- sys/dev/drm/radeon_state.c | 2 +- sys/dev/drm/sis.h | 4 +-- sys/dev/drm/sis_drv.c | 4 +-- sys/dev/drm/sis_drv.h | 4 +-- sys/dev/drm/sis_ds.c | 4 +-- sys/dev/drm/sis_ds.h | 4 +-- sys/dev/drm/sis_mm.c | 4 +-- sys/dev/drm/tdfx.h | 4 +-- sys/dev/drm/tdfx_drv.c | 4 +-- sys/dev/ed/if_ed.c | 2 +- sys/dev/ed/if_ed98.h | 2 +- sys/dev/ed/if_ed_cbus.c | 2 +- sys/dev/ed/if_ed_isa.c | 2 +- sys/dev/ed/if_ed_pccard.c | 2 +- sys/dev/ed/if_edreg.h | 2 +- sys/dev/ed/if_edvar.h | 2 +- sys/dev/eisa/eisa_if.m | 2 +- sys/dev/eisa/eisaconf.c | 2 +- sys/dev/eisa/eisaconf.h | 2 +- sys/dev/em/LICENSE | 2 ++ sys/dev/en/if_en_pci.c | 3 +- sys/dev/en/midway.c | 3 +- sys/dev/en/midwayvar.h | 3 +- sys/dev/ep/if_ep.c | 2 +- sys/dev/ep/if_ep_eisa.c | 2 +- sys/dev/ep/if_ep_isa.c | 2 +- sys/dev/ep/if_ep_pccard.c | 2 +- sys/dev/ep/if_epreg.h | 2 +- sys/dev/ep/if_epvar.h | 2 +- sys/dev/esp/ncr53c9x.c | 2 +- sys/dev/esp/ncr53c9xreg.h | 2 +- sys/dev/esp/ncr53c9xvar.h | 2 +- sys/dev/ex/if_ex.c | 2 +- sys/dev/ex/if_exreg.h | 2 +- sys/dev/exca/exca.c | 2 +- sys/dev/exca/excareg.h | 2 +- sys/dev/exca/excavar.h | 2 +- sys/dev/fatm/firmware.h | 2 +- sys/dev/fatm/if_fatm.c | 2 +- sys/dev/fatm/if_fatm_rate.h | 2 +- sys/dev/fatm/if_fatmreg.h | 2 +- sys/dev/fatm/if_fatmvar.h | 2 +- sys/dev/fb/gallant12x22.c | 2 +- sys/dev/fb/gallant12x22.h | 2 +- sys/dev/fb/gfb.h | 2 +- sys/dev/fb/tga.h | 2 +- sys/dev/fe/if_fe.c | 2 +- sys/dev/fe/if_fe_cbus.c | 2 +- sys/dev/fe/if_fe_isa.c | 2 +- sys/dev/fe/if_fe_pccard.c | 2 +- sys/dev/fe/if_fereg.h | 2 +- sys/dev/fe/if_fevar.h | 2 +- sys/dev/firewire/firewire.c | 2 +- sys/dev/firewire/firewire.h | 2 +- sys/dev/firewire/firewire_phy.h | 2 +- sys/dev/firewire/firewirereg.h | 2 +- sys/dev/firewire/fwdev.c | 2 +- sys/dev/firewire/fwdma.c | 2 +- sys/dev/firewire/fwdma.h | 2 +- sys/dev/firewire/fwmem.c | 2 +- sys/dev/firewire/fwmem.h | 2 +- sys/dev/firewire/fwohci.c | 2 +- sys/dev/firewire/fwohci_pci.c | 2 +- sys/dev/firewire/fwohcireg.h | 2 +- sys/dev/firewire/fwohcivar.h | 2 +- sys/dev/firewire/fwphyreg.h | 2 +- sys/dev/firewire/iec13213.h | 2 +- sys/dev/firewire/iec68113.h | 2 +- sys/dev/firewire/if_fwe.c | 2 +- sys/dev/firewire/if_fwevar.h | 2 +- sys/dev/firewire/if_fwip.c | 2 +- sys/dev/firewire/if_fwipvar.h | 2 +- sys/dev/firewire/sbp.c | 2 +- sys/dev/firewire/sbp.h | 2 +- sys/dev/firewire/sbp_targ.c | 2 +- sys/dev/fxp/if_fxpreg.h | 2 +- sys/dev/fxp/if_fxpvar.h | 2 +- sys/dev/fxp/rcvbundl.h | 2 +- sys/dev/gem/if_gem_pci.c | 2 +- sys/dev/gem/if_gemreg.h | 2 +- sys/dev/gem/if_gemvar.h | 2 +- sys/dev/gfb/gfb_pci.c | 2 +- sys/dev/gfb/gfb_pci.h | 2 +- sys/dev/harp/if_harp.c | 2 +- sys/dev/hatm/if_hatm.c | 2 +- sys/dev/hatm/if_hatm_intr.c | 2 +- sys/dev/hatm/if_hatm_ioctl.c | 2 +- sys/dev/hatm/if_hatm_rx.c | 2 +- sys/dev/hatm/if_hatm_tx.c | 2 +- sys/dev/hatm/if_hatmconf.h | 2 +- sys/dev/hatm/if_hatmreg.h | 2 +- sys/dev/hatm/if_hatmvar.h | 2 +- sys/dev/hfa/fore.h | 2 +- sys/dev/hfa/fore_aali.h | 2 +- sys/dev/hfa/fore_command.c | 2 +- sys/dev/hfa/fore_if.c | 2 +- sys/dev/hfa/fore_include.h | 2 +- sys/dev/hfa/fore_init.c | 2 +- sys/dev/hfa/fore_intr.c | 2 +- sys/dev/hfa/fore_output.c | 2 +- sys/dev/hfa/fore_slave.h | 2 +- sys/dev/hfa/fore_stats.c | 2 +- sys/dev/hfa/fore_stats.h | 2 +- sys/dev/hfa/fore_var.h | 2 +- sys/dev/hfa/fore_vcm.c | 2 +- sys/dev/hifn/hifn7751.c | 2 +- sys/dev/hifn/hifn7751reg.h | 2 +- sys/dev/hifn/hifn7751var.h | 2 +- sys/dev/hptmv/entry.c | 2 +- sys/dev/hptmv/global.h | 2 +- sys/dev/hptmv/hptintf.h | 2 +- sys/dev/hptmv/mv.c | 2 +- sys/dev/hptmv/mvOs.h | 2 +- sys/dev/hptmv/osbsd.h | 2 +- sys/dev/ic/cd180.h | 2 +- sys/dev/ic/hd64570.h | 2 +- sys/dev/ic/sab82532.h | 2 +- sys/dev/ic/wd33c93reg.h | 2 +- sys/dev/ic/z8530.h | 2 +- sys/dev/ichsmb/ichsmb.c | 3 +- sys/dev/ichsmb/ichsmb_reg.h | 3 +- sys/dev/ichsmb/ichsmb_var.h | 3 +- sys/dev/ichwd/ichwd.c | 2 +- sys/dev/ichwd/ichwd.h | 2 +- sys/dev/ida/ida_eisa.c | 2 +- sys/dev/idt/idt.c | 2 +- sys/dev/idt/idt_harp.c | 2 +- sys/dev/idt/idt_pci.c | 2 +- sys/dev/idt/idtreg.h | 2 +- sys/dev/idt/idtvar.h | 2 +- sys/dev/ie/if_iee16.h | 2 +- sys/dev/if_ndis/if_ndis.c | 2 +- sys/dev/if_ndis/if_ndis_pccard.c | 2 +- sys/dev/if_ndis/if_ndis_pci.c | 2 +- sys/dev/if_ndis/if_ndisvar.h | 2 +- sys/dev/iicbus/iicbb_if.m | 2 +- sys/dev/iicbus/iicbus_if.m | 2 +- sys/dev/iir/iir.c | 2 +- sys/dev/iir/iir.h | 2 +- sys/dev/iir/iir_ctrl.c | 2 +- sys/dev/isp/isp.c | 2 +- sys/dev/isp/isp_freebsd.c | 2 +- sys/dev/isp/isp_freebsd.h | 2 +- sys/dev/isp/isp_inline.h | 2 +- sys/dev/isp/isp_ioctl.h | 2 +- sys/dev/isp/isp_target.c | 2 +- sys/dev/isp/isp_target.h | 2 +- sys/dev/isp/isp_tpublic.h | 2 +- sys/dev/isp/ispmbox.h | 2 +- sys/dev/isp/ispreg.h | 2 +- sys/dev/isp/ispvar.h | 2 +- sys/dev/ispfw/asm_1000.h | 2 +- sys/dev/ispfw/asm_1040.h | 2 +- sys/dev/ispfw/asm_1080.h | 2 +- sys/dev/ispfw/asm_12160.h | 2 +- sys/dev/ispfw/asm_2100.h | 2 +- sys/dev/ispfw/asm_2200.h | 2 +- sys/dev/ispfw/asm_2300.h | 2 +- sys/dev/ixgb/LICENSE | 4 +++ sys/dev/ixgb/if_ixgb.c | 2 +- sys/dev/ixgb/if_ixgb.h | 2 +- sys/dev/ixgb/if_ixgb_osdep.h | 2 +- sys/dev/lge/if_lge.c | 2 +- sys/dev/lge/if_lgereg.h | 2 +- sys/dev/lnc/if_lnc_cbus.c | 2 +- sys/dev/lnc/if_lnc_isa.c | 2 +- sys/dev/matcd/creativeif.h | 3 +- sys/dev/matcd/matcd.c | 3 +- sys/dev/matcd/matcd_data.h | 3 +- sys/dev/matcd/matcd_isa.c | 3 +- sys/dev/matcd/matcddrv.h | 3 +- sys/dev/matcd/options.h | 3 +- sys/dev/mc146818/mc146818.c | 2 +- sys/dev/mc146818/mc146818reg.h | 2 +- sys/dev/mc146818/mc146818var.h | 2 +- sys/dev/mcd/mcd.c | 2 +- sys/dev/mcd/mcdreg.h | 2 +- sys/dev/md/md.c | 4 +-- sys/dev/mii/acphy.c | 2 +- sys/dev/mii/amphy.c | 2 +- sys/dev/mii/amphyreg.h | 2 +- sys/dev/mii/bmtphy.c | 2 +- sys/dev/mii/bmtphyreg.h | 1 - sys/dev/mii/brgphy.c | 2 +- sys/dev/mii/brgphyreg.h | 2 +- sys/dev/mii/ciphy.c | 2 +- sys/dev/mii/ciphyreg.h | 2 +- sys/dev/mii/dcphy.c | 2 +- sys/dev/mii/e1000phy.c | 2 +- sys/dev/mii/e1000phyreg.h | 4 +-- sys/dev/mii/exphy.c | 2 +- sys/dev/mii/lxtphy.c | 2 +- sys/dev/mii/mii.h | 2 +- sys/dev/mii/mlphy.c | 2 +- sys/dev/mii/nsgphy.c | 2 +- sys/dev/mii/nsgphyreg.h | 2 +- sys/dev/mii/nsphy.c | 2 +- sys/dev/mii/pnaphy.c | 2 +- sys/dev/mii/qsphy.c | 2 +- sys/dev/mii/rgephy.c | 2 +- sys/dev/mii/rgephyreg.h | 2 +- sys/dev/mii/rlphy.c | 2 +- sys/dev/mii/tdkphy.c | 2 +- sys/dev/mii/tdkphyreg.h | 2 +- sys/dev/mii/tlphy.c | 2 +- sys/dev/mii/tlphyreg.h | 2 +- sys/dev/mii/ukphy.c | 2 +- sys/dev/mii/xmphy.c | 2 +- sys/dev/mii/xmphyreg.h | 2 +- sys/dev/mpt/mpilib/fc_log.h | 2 +- sys/dev/mpt/mpilib/mpi.h | 2 +- sys/dev/mpt/mpilib/mpi_cnfg.h | 2 +- sys/dev/mpt/mpilib/mpi_fc.h | 2 +- sys/dev/mpt/mpilib/mpi_init.h | 2 +- sys/dev/mpt/mpilib/mpi_ioc.h | 2 +- sys/dev/mpt/mpilib/mpi_lan.h | 2 +- sys/dev/mpt/mpilib/mpi_raid.h | 2 +- sys/dev/mpt/mpilib/mpi_targ.h | 2 +- sys/dev/mpt/mpilib/mpi_type.h | 2 +- sys/dev/mpt/mpt.c | 2 +- sys/dev/mpt/mpt.h | 2 +- sys/dev/mpt/mpt_debug.c | 2 +- sys/dev/mpt/mpt_freebsd.c | 2 +- sys/dev/mpt/mpt_freebsd.h | 2 +- sys/dev/mse/mse.c | 2 +- sys/dev/mse/mse_cbus.c | 2 +- sys/dev/mse/mse_isa.c | 2 +- sys/dev/mse/msevar.h | 2 +- sys/dev/my/if_myreg.h | 2 +- sys/dev/ncv/ncr53c500.c | 2 +- sys/dev/ncv/ncr53c500_pccard.c | 2 +- sys/dev/ncv/ncr53c500hw.h | 2 +- sys/dev/ncv/ncr53c500hwtab.h | 2 +- sys/dev/ncv/ncr53c500reg.h | 2 +- sys/dev/ncv/ncr53c500var.h | 2 +- sys/dev/nge/if_nge.c | 2 +- sys/dev/nge/if_ngereg.h | 2 +- sys/dev/nmdm/nmdm.c | 2 +- sys/dev/nsp/nsp.c | 2 +- sys/dev/nsp/nsp_pccard.c | 2 +- sys/dev/nsp/nspreg.h | 2 +- sys/dev/nsp/nspvar.h | 2 +- sys/dev/ofw/ofw_bus_if.m | 1 + sys/dev/ofw/ofw_console.c | 2 +- sys/dev/ofw/ofw_disk.c | 2 +- sys/dev/ofw/openfirm.c | 4 +-- sys/dev/ofw/openfirm.h | 2 +- sys/dev/ofw/openfirmio.c | 2 +- sys/dev/ofw/openfirmio.h | 2 +- sys/dev/owi/if_owi.c | 2 +- sys/dev/owi/if_owi_pccard.c | 2 +- sys/dev/owi/if_wireg.h | 2 +- sys/dev/owi/if_wivar.h | 2 +- sys/dev/patm/genrtab/genrtab.c | 2 +- sys/dev/patm/idt77252reg.h | 2 +- sys/dev/patm/if_patm.c | 2 +- sys/dev/patm/if_patm_attach.c | 2 +- sys/dev/patm/if_patm_intr.c | 2 +- sys/dev/patm/if_patm_ioctl.c | 2 +- sys/dev/patm/if_patm_rx.c | 2 +- sys/dev/patm/if_patm_tx.c | 2 +- sys/dev/patm/if_patmvar.h | 2 +- sys/dev/pbio/pbio.c | 2 +- sys/dev/pbio/pbioio.h | 2 +- sys/dev/pccard/card_if.m | 2 +- sys/dev/pccard/pccard.c | 2 +- sys/dev/pccard/pccard_cis.c | 2 +- sys/dev/pccard/pccard_cis.h | 2 +- sys/dev/pccard/pccard_cis_quirks.c | 2 +- sys/dev/pccard/pccardreg.h | 2 +- sys/dev/pccard/pccardvar.h | 2 +- sys/dev/pccard/power_if.m | 2 +- sys/dev/pccbb/pccbb.c | 2 +- sys/dev/pccbb/pccbb_isa.c | 2 +- sys/dev/pccbb/pccbb_pci.c | 2 +- sys/dev/pccbb/pccbbdevid.h | 2 +- sys/dev/pccbb/pccbbreg.h | 2 +- sys/dev/pccbb/pccbbvar.h | 2 +- sys/dev/pci/pci.c | 2 +- sys/dev/pci/pci_if.m | 2 +- sys/dev/pci/pci_private.h | 2 +- sys/dev/pci/pcib_if.m | 2 +- sys/dev/pci/pcireg.h | 2 +- sys/dev/pci/pcivar.h | 2 +- sys/dev/ppbus/lpt.c | 2 +- sys/dev/ppbus/lptio.h | 2 +- sys/dev/ppbus/pcfclock.c | 2 +- sys/dev/ppbus/ppbus_if.m | 2 +- sys/dev/ppbus/pps.c | 2 +- sys/dev/ppc/ppcvar.h | 1 - sys/dev/puc/puc.c | 2 +- sys/dev/puc/puc_ebus.c | 2 +- sys/dev/puc/puc_pci.c | 2 +- sys/dev/puc/puc_sbus.c | 2 +- sys/dev/puc/pucdata.c | 2 +- sys/dev/puc/pucvar.h | 2 +- sys/dev/ray/if_ray.c | 2 +- sys/dev/ray/if_raydbg.h | 2 +- sys/dev/ray/if_raymib.h | 2 +- sys/dev/ray/if_rayreg.h | 2 +- sys/dev/ray/if_rayvar.h | 2 +- sys/dev/rc/rc.c | 2 +- sys/dev/rc/rcreg.h | 2 +- sys/dev/re/if_re.c | 2 +- sys/dev/rndtest/rndtest.c | 2 +- sys/dev/rndtest/rndtest.h | 2 +- sys/dev/rp/rp.c | 2 +- sys/dev/rp/rp_isa.c | 2 +- sys/dev/rp/rpreg.h | 2 +- sys/dev/rp/rpvar.h | 2 +- sys/dev/sab/sab.c | 2 +- sys/dev/sab/sab82532reg.h | 2 +- sys/dev/sbni/if_sbni.c | 2 +- sys/dev/sbni/if_sbni_isa.c | 2 +- sys/dev/sbni/if_sbnireg.h | 2 +- sys/dev/sbni/if_sbnivar.h | 2 +- sys/dev/sbsh/if_sbshreg.h | 2 +- sys/dev/si/si.c | 2 +- sys/dev/si/si.h | 2 +- sys/dev/si/si2_z280.c | 2 +- sys/dev/si/si3_t225.c | 2 +- sys/dev/si/si_eisa.c | 2 +- sys/dev/si/si_isa.c | 2 +- sys/dev/si/sireg.h | 2 +- sys/dev/si/sivar.h | 2 +- sys/dev/sio/sio_isa.c | 2 +- sys/dev/sio/sio_pccard.c | 2 +- sys/dev/smbus/smbus_if.m | 2 +- sys/dev/sn/if_sn.c | 2 +- sys/dev/sn/if_sn_isa.c | 2 +- sys/dev/sn/if_snreg.h | 2 +- sys/dev/sn/if_snvar.h | 2 +- sys/dev/snc/dp83932.c | 4 +-- sys/dev/snc/dp83932reg.h | 2 +- sys/dev/snc/dp83932subr.c | 2 +- sys/dev/snc/dp83932subr.h | 4 +-- sys/dev/snc/dp83932var.h | 5 ++- sys/dev/snc/if_snc.c | 2 +- sys/dev/snc/if_snc_cbus.c | 2 +- sys/dev/snc/if_snc_pccard.c | 2 +- sys/dev/snc/if_sncreg.h | 2 +- sys/dev/snc/if_sncvar.h | 2 +- sys/dev/snp/snp.c | 2 +- sys/dev/sound/driver.c | 2 +- sys/dev/sound/isa/ad1816.c | 2 +- sys/dev/sound/isa/ad1816.h | 2 +- sys/dev/sound/isa/es1888.c | 2 +- sys/dev/sound/isa/ess.c | 2 +- sys/dev/sound/isa/gusc.c | 2 +- sys/dev/sound/isa/mss.c | 2 +- sys/dev/sound/isa/mss.h | 58 +++++++++++++++--------------- sys/dev/sound/isa/sb16.c | 2 +- sys/dev/sound/isa/sb8.c | 2 +- sys/dev/sound/isa/sbc.c | 2 +- sys/dev/sound/isa/sndbuf_dma.c | 2 +- sys/dev/sound/pci/als4000.c | 2 +- sys/dev/sound/pci/als4000.h | 2 +- sys/dev/sound/pci/aureal.c | 2 +- sys/dev/sound/pci/aureal.h | 2 +- sys/dev/sound/pci/cmi.c | 2 +- sys/dev/sound/pci/cmireg.h | 2 +- sys/dev/sound/pci/cs4281.c | 2 +- sys/dev/sound/pci/cs4281.h | 2 +- sys/dev/sound/pci/csa.c | 2 +- sys/dev/sound/pci/csapcm.c | 2 +- sys/dev/sound/pci/ds1-fw.h | 3 +- sys/dev/sound/pci/ds1.c | 2 +- sys/dev/sound/pci/emu10k1.c | 2 +- sys/dev/sound/pci/es137x.c | 2 +- sys/dev/sound/pci/es137x.h | 2 +- sys/dev/sound/pci/fm801.c | 2 +- sys/dev/sound/pci/ich.c | 2 +- sys/dev/sound/pci/ich.h | 2 +- sys/dev/sound/pci/neomagic-coeff.h | 2 +- sys/dev/sound/pci/neomagic.c | 2 +- sys/dev/sound/pci/neomagic.h | 2 +- sys/dev/sound/pci/solo.c | 2 +- sys/dev/sound/pci/t4dwave.c | 2 +- sys/dev/sound/pci/t4dwave.h | 2 +- sys/dev/sound/pci/via8233.c | 2 +- sys/dev/sound/pci/via8233.h | 2 +- sys/dev/sound/pci/via82c686.c | 2 +- sys/dev/sound/pci/vibes.c | 2 +- sys/dev/sound/pci/vibes.h | 2 +- sys/dev/sound/pcm/ac97.c | 2 +- sys/dev/sound/pcm/ac97.h | 2 +- sys/dev/sound/pcm/ac97_if.m | 1 + sys/dev/sound/pcm/ac97_patch.c | 2 +- sys/dev/sound/pcm/ac97_patch.h | 2 +- sys/dev/sound/pcm/buffer.c | 2 +- sys/dev/sound/pcm/buffer.h | 2 +- sys/dev/sound/pcm/channel.c | 2 +- sys/dev/sound/pcm/channel.h | 2 +- sys/dev/sound/pcm/channel_if.m | 1 + sys/dev/sound/pcm/dsp.c | 2 +- sys/dev/sound/pcm/dsp.h | 2 +- sys/dev/sound/pcm/fake.c | 2 +- sys/dev/sound/pcm/feeder.c | 2 +- sys/dev/sound/pcm/feeder.h | 2 +- sys/dev/sound/pcm/feeder_fmt.c | 2 +- sys/dev/sound/pcm/feeder_if.m | 1 + sys/dev/sound/pcm/feeder_rate.c | 2 +- sys/dev/sound/pcm/mixer.c | 2 +- sys/dev/sound/pcm/mixer.h | 2 +- sys/dev/sound/pcm/mixer_if.m | 1 + sys/dev/sound/pcm/sndstat.c | 2 +- sys/dev/sound/pcm/sound.c | 2 +- sys/dev/sound/pcm/sound.h | 2 +- sys/dev/sound/pcm/vchan.c | 2 +- sys/dev/sound/pcm/vchan.h | 2 +- sys/dev/sound/sbus/apcdmareg.h | 2 +- sys/dev/sound/sbus/cs4231.c | 2 +- sys/dev/sound/sbus/cs4231.h | 2 +- sys/dev/sound/usb/uaudio.c | 2 +- sys/dev/sound/usb/uaudio.h | 2 +- sys/dev/sound/usb/uaudio_pcm.c | 2 +- sys/dev/sound/usb/uaudioreg.h | 2 +- sys/dev/sr/if_sr.c | 2 +- sys/dev/sr/if_sr.h | 2 +- sys/dev/sr/if_sr_isa.c | 2 +- sys/dev/sr/if_sr_pci.c | 2 +- sys/dev/sr/if_srregs.h | 2 +- sys/dev/stg/tmc18c30.c | 2 +- sys/dev/stg/tmc18c30_isa.c | 2 +- sys/dev/stg/tmc18c30_pccard.c | 2 +- sys/dev/stg/tmc18c30_subr.c | 2 +- sys/dev/stg/tmc18c30reg.h | 2 +- sys/dev/stg/tmc18c30var.h | 2 +- sys/dev/streams/streams.c | 2 +- sys/dev/sx/cd1865.h | 2 +- sys/dev/sx/sx.c | 2 +- sys/dev/sx/sx.h | 2 +- sys/dev/sx/sx_pci.c | 2 +- sys/dev/sx/sx_util.c | 2 +- sys/dev/sx/sx_util.h | 2 +- sys/dev/sx/sxvar.h | 2 +- sys/dev/sym/README.sym | 2 +- sys/dev/sym/sym_conf.h | 2 +- sys/dev/sym/sym_defs.h | 2 +- sys/dev/sym/sym_fw.h | 2 +- sys/dev/sym/sym_fw1.h | 2 +- sys/dev/sym/sym_fw2.h | 2 +- sys/dev/tdfx/tdfx_io.h | 2 +- sys/dev/tdfx/tdfx_linux.h | 2 +- sys/dev/tdfx/tdfx_pci.h | 2 +- sys/dev/tdfx/tdfx_vars.h | 2 +- sys/dev/tga/tga_pci.c | 2 +- sys/dev/tga/tga_pci.h | 2 +- sys/dev/trm/trm.c | 5 ++- sys/dev/trm/trm.h | 4 ++- sys/dev/txp/3c990img.h | 2 +- sys/dev/txp/if_txp.c | 2 +- sys/dev/txp/if_txpreg.h | 2 +- sys/dev/uart/uart.h | 2 +- sys/dev/uart/uart_bus.h | 2 +- sys/dev/uart/uart_bus_acpi.c | 2 +- sys/dev/uart/uart_bus_isa.c | 2 +- sys/dev/uart/uart_bus_pccard.c | 2 +- sys/dev/uart/uart_bus_pci.c | 2 +- sys/dev/uart/uart_core.c | 2 +- sys/dev/uart/uart_cpu.h | 2 +- sys/dev/uart/uart_cpu_alpha.c | 2 +- sys/dev/uart/uart_cpu_amd64.c | 2 +- sys/dev/uart/uart_cpu_i386.c | 2 +- sys/dev/uart/uart_cpu_ia64.c | 2 +- sys/dev/uart/uart_cpu_pc98.c | 2 +- sys/dev/uart/uart_cpu_sparc64.c | 2 +- sys/dev/uart/uart_dbg.c | 2 +- sys/dev/uart/uart_dev_ns8250.c | 2 +- sys/dev/uart/uart_dev_sab82532.c | 2 +- sys/dev/uart/uart_dev_z8530.c | 2 +- sys/dev/uart/uart_if.m | 1 + sys/dev/uart/uart_kbd_sun.h | 2 +- sys/dev/uart/uart_subr.c | 2 +- sys/dev/uart/uart_tty.c | 2 +- sys/dev/ubsec/ubsec.c | 2 +- sys/dev/ubsec/ubsecreg.h | 2 +- sys/dev/ubsec/ubsecvar.h | 2 +- sys/dev/usb/ehci.c | 2 +- sys/dev/usb/ehcireg.h | 2 +- sys/dev/usb/ehcivar.h | 2 +- sys/dev/usb/hid.c | 2 +- sys/dev/usb/hid.h | 2 +- sys/dev/usb/if_auereg.h | 2 +- sys/dev/usb/if_axe.c | 2 +- sys/dev/usb/if_axereg.h | 2 +- sys/dev/usb/if_cue.c | 2 +- sys/dev/usb/if_cuereg.h | 2 +- sys/dev/usb/if_kue.c | 2 +- sys/dev/usb/if_kuereg.h | 2 +- sys/dev/usb/if_udav.c | 2 +- sys/dev/usb/if_udavreg.h | 2 +- sys/dev/usb/kue_fw.h | 2 +- sys/dev/usb/ohci.c | 2 +- sys/dev/usb/ohcireg.h | 2 +- sys/dev/usb/ohcivar.h | 2 +- sys/dev/usb/rio500_usb.h | 3 +- sys/dev/usb/ubsa.c | 2 +- sys/dev/usb/ubser.c | 4 +-- sys/dev/usb/ubser.h | 2 +- sys/dev/usb/ucom.c | 2 +- sys/dev/usb/ucomvar.h | 2 +- sys/dev/usb/udbp.c | 2 +- sys/dev/usb/udbp.h | 2 +- sys/dev/usb/ufm.c | 2 +- sys/dev/usb/uftdi.c | 2 +- sys/dev/usb/ugen.c | 2 +- sys/dev/usb/ugraphire_rdesc.h | 2 +- sys/dev/usb/uhci.c | 2 +- sys/dev/usb/uhcireg.h | 2 +- sys/dev/usb/uhcivar.h | 2 +- sys/dev/usb/uhid.c | 2 +- sys/dev/usb/uhub.c | 2 +- sys/dev/usb/ukbd.c | 3 +- sys/dev/usb/ulpt.c | 2 +- sys/dev/usb/umodem.c | 2 +- sys/dev/usb/ums.c | 3 +- sys/dev/usb/uplcom.c | 2 +- sys/dev/usb/urio.c | 2 +- sys/dev/usb/usb.c | 2 +- sys/dev/usb/usb.h | 2 +- sys/dev/usb/usb_ethersubr.c | 2 +- sys/dev/usb/usb_ethersubr.h | 2 +- sys/dev/usb/usb_if.m | 2 +- sys/dev/usb/usb_mem.c | 2 +- sys/dev/usb/usb_mem.h | 2 +- sys/dev/usb/usb_port.h | 2 +- sys/dev/usb/usb_quirks.c | 2 +- sys/dev/usb/usb_quirks.h | 2 +- sys/dev/usb/usb_subr.c | 2 +- sys/dev/usb/usbcdc.h | 2 +- sys/dev/usb/usbdevs | 2 +- sys/dev/usb/usbdi.c | 2 +- sys/dev/usb/usbdi.h | 2 +- sys/dev/usb/usbdi_util.c | 2 +- sys/dev/usb/usbdi_util.h | 2 +- sys/dev/usb/usbdivar.h | 2 +- sys/dev/usb/usbhid.h | 2 +- sys/dev/usb/uscanner.c | 2 +- sys/dev/usb/uvisor.c | 2 +- sys/dev/utopia/idtphy.h | 2 +- sys/dev/utopia/suni.h | 2 +- sys/dev/utopia/utopia.c | 2 +- sys/dev/utopia/utopia.h | 2 +- sys/dev/vge/if_vge.c | 2 +- sys/dev/vge/if_vgereg.h | 2 +- sys/dev/vge/if_vgevar.h | 2 +- sys/dev/vkbd/vkbd.c | 2 +- sys/dev/vkbd/vkbd_var.h | 2 +- sys/dev/vx/if_vx.c | 2 +- sys/dev/vx/if_vx_eisa.c | 2 +- sys/dev/vx/if_vx_pci.c | 2 +- sys/dev/vx/if_vxreg.h | 2 +- sys/dev/vx/if_vxvar.h | 2 +- sys/dev/wds/wd7000.c | 2 +- sys/dev/wi/if_wavelan_ieee.h | 2 +- sys/dev/wi/if_wi.c | 2 +- sys/dev/wi/if_wi_pccard.c | 2 +- sys/dev/wi/if_wi_pci.c | 2 +- sys/dev/wi/if_wireg.h | 2 +- sys/dev/wi/if_wivar.h | 2 +- sys/dev/wi/spectrum24t_cf.h | 2 +- sys/dev/wl/if_wl.c | 2 +- sys/dev/wl/if_wl.h | 2 +- sys/dev/xe/if_xe.c | 2 +- sys/dev/xe/if_xe_pccard.c | 2 +- sys/dev/zs/z8530reg.h | 2 +- 774 files changed, 886 insertions(+), 868 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/dev/aac/aac_cam.c b/sys/dev/aac/aac_cam.c index 946855425f70..3755e58de742 100644 --- a/sys/dev/aac/aac_cam.c +++ b/sys/dev/aac/aac_cam.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2002 Adaptec, Inc. * All rights reserved. * diff --git a/sys/dev/acpica/acpi_ec.c b/sys/dev/acpica/acpi_ec.c index 17a9d6f14b0c..50cb84761bf7 100644 --- a/sys/dev/acpica/acpi_ec.c +++ b/sys/dev/acpica/acpi_ec.c @@ -25,7 +25,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/****************************************************************************** +/*- + ****************************************************************************** * * 1. Copyright Notice * diff --git a/sys/dev/acpica/acpi_if.m b/sys/dev/acpica/acpi_if.m index 48a060ab92a2..9c63b3e49fb1 100644 --- a/sys/dev/acpica/acpi_if.m +++ b/sys/dev/acpica/acpi_if.m @@ -1,4 +1,4 @@ -# +#- # Copyright (c) 2004 Nate Lawson # All rights reserved. # diff --git a/sys/dev/acpica/acpi_pci.c b/sys/dev/acpica/acpi_pci.c index ad51129d7f4b..c935ae8ffd45 100644 --- a/sys/dev/acpica/acpi_pci.c +++ b/sys/dev/acpica/acpi_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, Stefan Esser * Copyright (c) 2000, Michael Smith * Copyright (c) 2000, BSDi diff --git a/sys/dev/advansys/adv_eisa.c b/sys/dev/advansys/adv_eisa.c index d71893861d57..e56cf29653f0 100644 --- a/sys/dev/advansys/adv_eisa.c +++ b/sys/dev/advansys/adv_eisa.c @@ -1,4 +1,4 @@ -/* +/*- * Device probe and attach routines for the following * Advanced Systems Inc. SCSI controllers: * diff --git a/sys/dev/advansys/adv_isa.c b/sys/dev/advansys/adv_isa.c index 96bdc7c77ea7..8a3a0790843b 100644 --- a/sys/dev/advansys/adv_isa.c +++ b/sys/dev/advansys/adv_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Device probe and attach routines for the following * Advanced Systems Inc. SCSI controllers: * diff --git a/sys/dev/advansys/adv_pci.c b/sys/dev/advansys/adv_pci.c index 9ac61f394fa9..aa97f1ba0712 100644 --- a/sys/dev/advansys/adv_pci.c +++ b/sys/dev/advansys/adv_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Device probe and attach routines for the following * Advanced Systems Inc. SCSI controllers: * diff --git a/sys/dev/advansys/advansys.c b/sys/dev/advansys/advansys.c index 1c2d645a3fb0..7b9cfb1e3fb8 100644 --- a/sys/dev/advansys/advansys.c +++ b/sys/dev/advansys/advansys.c @@ -1,4 +1,4 @@ -/* +/*- * Generic driver for the Advanced Systems Inc. SCSI controllers * Product specific probe and attach routines can be found in: * @@ -32,7 +32,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* +/*- * Ported from: * advansys.c - Linux Host Driver for AdvanSys SCSI Adapters * diff --git a/sys/dev/advansys/advansys.h b/sys/dev/advansys/advansys.h index ab4e550a9afe..a8c560472860 100644 --- a/sys/dev/advansys/advansys.h +++ b/sys/dev/advansys/advansys.h @@ -1,4 +1,4 @@ -/* +/*- * Generic driver definitions and exported functions for the Advanced * Systems Inc. SCSI controllers * diff --git a/sys/dev/advansys/advlib.c b/sys/dev/advansys/advlib.c index 7b9b149d1fc5..4604571da52f 100644 --- a/sys/dev/advansys/advlib.c +++ b/sys/dev/advansys/advlib.c @@ -1,4 +1,4 @@ -/* +/*- * Low level routines for the Advanced Systems Inc. SCSI controllers chips * * Copyright (c) 1996-1997, 1999-2000 Justin Gibbs. @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* +/*- * Ported from: * advansys.c - Linux Host Driver for AdvanSys SCSI Adapters * diff --git a/sys/dev/advansys/advlib.h b/sys/dev/advansys/advlib.h index ba9703db1b6d..f7a3acb633b5 100644 --- a/sys/dev/advansys/advlib.h +++ b/sys/dev/advansys/advlib.h @@ -1,4 +1,4 @@ -/* +/*- * Definitions for low level routines and data structures * for the Advanced Systems Inc. SCSI controllers chips. * @@ -31,7 +31,7 @@ * * $FreeBSD$ */ -/* +/*- * Ported from: * advansys.c - Linux Host Driver for AdvanSys SCSI Adapters * diff --git a/sys/dev/advansys/advmcode.c b/sys/dev/advansys/advmcode.c index 730f161f31f9..d5e7bba9634a 100644 --- a/sys/dev/advansys/advmcode.c +++ b/sys/dev/advansys/advmcode.c @@ -1,4 +1,4 @@ -/* +/*- * Downloadable microcode for Advanced Systems Inc. SCSI controllers * * diff --git a/sys/dev/advansys/advmcode.h b/sys/dev/advansys/advmcode.h index 128efc4c9715..60b4e03cdb1a 100644 --- a/sys/dev/advansys/advmcode.h +++ b/sys/dev/advansys/advmcode.h @@ -1,4 +1,4 @@ -/* +/*- * Exported interface to downloadable microcode for AdvanSys SCSI Adapters * * $FreeBSD$ diff --git a/sys/dev/advansys/adw_pci.c b/sys/dev/advansys/adw_pci.c index e6050b885d7c..1f88d772a79e 100644 --- a/sys/dev/advansys/adw_pci.c +++ b/sys/dev/advansys/adw_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Device probe and attach routines for the following * Advanced Systems Inc. SCSI controllers: * diff --git a/sys/dev/advansys/adwcam.c b/sys/dev/advansys/adwcam.c index 400c0fca5271..c6c14fd99cc0 100644 --- a/sys/dev/advansys/adwcam.c +++ b/sys/dev/advansys/adwcam.c @@ -1,4 +1,4 @@ -/* +/*- * CAM SCSI interface for the the Advanced Systems Inc. * Second Generation SCSI controllers. * diff --git a/sys/dev/advansys/adwlib.c b/sys/dev/advansys/adwlib.c index d36ca351b977..9dbf21eb41a6 100644 --- a/sys/dev/advansys/adwlib.c +++ b/sys/dev/advansys/adwlib.c @@ -1,4 +1,4 @@ -/* +/*- * Low level routines for Second Generation * Advanced Systems Inc. SCSI controllers chips * @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* +/*- * Ported from: * advansys.c - Linux Host Driver for AdvanSys SCSI Adapters * diff --git a/sys/dev/advansys/adwlib.h b/sys/dev/advansys/adwlib.h index 53834474e464..919622205a06 100644 --- a/sys/dev/advansys/adwlib.h +++ b/sys/dev/advansys/adwlib.h @@ -1,4 +1,4 @@ -/* +/*- * Definitions for low level routines and data structures * for the Advanced Systems Inc. SCSI controllers chips. * diff --git a/sys/dev/advansys/adwmcode.c b/sys/dev/advansys/adwmcode.c index 2b643291453f..a43720c423dd 100644 --- a/sys/dev/advansys/adwmcode.c +++ b/sys/dev/advansys/adwmcode.c @@ -1,4 +1,4 @@ -/* +/*- * Downloadable microcode for Second Generation * Advanced Systems Inc. SCSI controllers * diff --git a/sys/dev/advansys/adwmcode.h b/sys/dev/advansys/adwmcode.h index 221845489867..e3ab3f47a0ec 100644 --- a/sys/dev/advansys/adwmcode.h +++ b/sys/dev/advansys/adwmcode.h @@ -1,4 +1,4 @@ -/* +/*- * Exported interface to downloadable microcode for AdvanSys SCSI Adapters * * $FreeBSD$ diff --git a/sys/dev/advansys/adwvar.h b/sys/dev/advansys/adwvar.h index f4244f98a484..0510ab0185c3 100644 --- a/sys/dev/advansys/adwvar.h +++ b/sys/dev/advansys/adwvar.h @@ -1,4 +1,4 @@ -/* +/*- * Generic driver definitions and exported functions for the Advanced * Systems Inc. Second Generation SCSI controllers * diff --git a/sys/dev/aha/aha.c b/sys/dev/aha/aha.c index 919b1ecd6764..9a2232859c3a 100644 --- a/sys/dev/aha/aha.c +++ b/sys/dev/aha/aha.c @@ -1,4 +1,4 @@ -/* +/*- * Generic register and struct definitions for the Adaptech 154x/164x * SCSI host adapters. Product specific probe and attach routines can * be found in: diff --git a/sys/dev/aha/aha_isa.c b/sys/dev/aha/aha_isa.c index c43a428dda17..ba27bc5a20c0 100644 --- a/sys/dev/aha/aha_isa.c +++ b/sys/dev/aha/aha_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Product specific probe and attach routines for: * Adaptec 154x. * diff --git a/sys/dev/aha/ahareg.h b/sys/dev/aha/ahareg.h index c64d8ea06a73..c5b61f813977 100644 --- a/sys/dev/aha/ahareg.h +++ b/sys/dev/aha/ahareg.h @@ -1,4 +1,4 @@ -/* +/*- * Generic register and struct definitions for the Adaptech 1540, 1542, * 1640, 1642 SCSI host adapters. Product specific probe and attach * routines can be found in: diff --git a/sys/dev/ahb/ahb.c b/sys/dev/ahb/ahb.c index 34b16afd3791..4d7249c5aaa6 100644 --- a/sys/dev/ahb/ahb.c +++ b/sys/dev/ahb/ahb.c @@ -1,4 +1,4 @@ -/* +/*- * CAM SCSI device driver for the Adaptec 174X SCSI Host adapter * * Copyright (c) 1998 Justin T. Gibbs diff --git a/sys/dev/ahb/ahbreg.h b/sys/dev/ahb/ahbreg.h index c72f068aa3b9..d4544434eadb 100644 --- a/sys/dev/ahb/ahbreg.h +++ b/sys/dev/ahb/ahbreg.h @@ -1,4 +1,4 @@ -/* +/*- * Hardware structure definitions for the Adaptec 174X CAM SCSI device driver. * * Copyright (c) 1998 Justin T. Gibbs diff --git a/sys/dev/aic/aic6360reg.h b/sys/dev/aic/aic6360reg.h index d08a66514228..53962aed9d35 100644 --- a/sys/dev/aic/aic6360reg.h +++ b/sys/dev/aic/aic6360reg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1994 Charles Hannum. * Copyright (c) 1994 Jarle Greipsland. * All rights reserved. diff --git a/sys/dev/aic7xxx/ahc_eisa.c b/sys/dev/aic7xxx/ahc_eisa.c index b3fa8e3782a4..f98059f69016 100644 --- a/sys/dev/aic7xxx/ahc_eisa.c +++ b/sys/dev/aic7xxx/ahc_eisa.c @@ -1,4 +1,4 @@ -/* +/*- * FreeBSD, EISA product support functions * * diff --git a/sys/dev/aic7xxx/ahc_isa.c b/sys/dev/aic7xxx/ahc_isa.c index 1515a68d60b9..d01ffc96d3f8 100644 --- a/sys/dev/aic7xxx/ahc_isa.c +++ b/sys/dev/aic7xxx/ahc_isa.c @@ -1,4 +1,4 @@ -/* +/*- * FreeBSD, VLB/ISA product support functions * * Copyright (c) 2004 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/ahc_pci.c b/sys/dev/aic7xxx/ahc_pci.c index ba6ab22aa8ee..a9d4478420af 100644 --- a/sys/dev/aic7xxx/ahc_pci.c +++ b/sys/dev/aic7xxx/ahc_pci.c @@ -1,4 +1,4 @@ -/* +/*- * FreeBSD, PCI product support functions * * Copyright (c) 1995-2001 Justin T. Gibbs diff --git a/sys/dev/aic7xxx/ahd_pci.c b/sys/dev/aic7xxx/ahd_pci.c index 18ac5f3225e9..01439442b7cf 100644 --- a/sys/dev/aic7xxx/ahd_pci.c +++ b/sys/dev/aic7xxx/ahd_pci.c @@ -1,4 +1,4 @@ -/* +/*- * FreeBSD, PCI product support functions * * Copyright (c) 1995-2001 Justin T. Gibbs diff --git a/sys/dev/aic7xxx/aic7770.c b/sys/dev/aic7xxx/aic7770.c index d6b35a04f731..1ce48f9b8df9 100644 --- a/sys/dev/aic7xxx/aic7770.c +++ b/sys/dev/aic7xxx/aic7770.c @@ -1,4 +1,4 @@ -/* +/*- * Product specific probe and attach routines for: * 27/284X and aic7770 motherboard SCSI controllers * diff --git a/sys/dev/aic7xxx/aic79xx.c b/sys/dev/aic7xxx/aic79xx.c index 16b30463566b..9e73b6406bf4 100644 --- a/sys/dev/aic7xxx/aic79xx.c +++ b/sys/dev/aic7xxx/aic79xx.c @@ -1,4 +1,4 @@ -/* +/*- * Core routines and tables shareable across OS platforms. * * Copyright (c) 1994-2002, 2004 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aic79xx.h b/sys/dev/aic7xxx/aic79xx.h index cecb691c0c1d..c8de9b776dfe 100644 --- a/sys/dev/aic7xxx/aic79xx.h +++ b/sys/dev/aic7xxx/aic79xx.h @@ -1,4 +1,4 @@ -/* +/*- * Core definitions and data structures shareable across OS platforms. * * Copyright (c) 1994-2002 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aic79xx.reg b/sys/dev/aic7xxx/aic79xx.reg index e3cc7c5deff2..e856b6236eae 100644 --- a/sys/dev/aic7xxx/aic79xx.reg +++ b/sys/dev/aic7xxx/aic79xx.reg @@ -1,4 +1,4 @@ -/* +/*- * Aic79xx register and scratch ram definitions. * * Copyright (c) 1994-2001, 2004 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aic79xx.seq b/sys/dev/aic7xxx/aic79xx.seq index 56ac75505a09..d8d4f921380c 100644 --- a/sys/dev/aic7xxx/aic79xx.seq +++ b/sys/dev/aic7xxx/aic79xx.seq @@ -1,4 +1,4 @@ -/* +/*- * Adaptec U320 device driver firmware for Linux and FreeBSD. * * Copyright (c) 1994-2001, 2004 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aic79xx_inline.h b/sys/dev/aic7xxx/aic79xx_inline.h index 0498ab312940..064a5e8ddd7f 100644 --- a/sys/dev/aic7xxx/aic79xx_inline.h +++ b/sys/dev/aic7xxx/aic79xx_inline.h @@ -1,4 +1,4 @@ -/* +/*- * Inline routines shareable across OS platforms. * * Copyright (c) 1994-2001 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aic79xx_osm.c b/sys/dev/aic7xxx/aic79xx_osm.c index 458f634727d3..2319da871a7f 100644 --- a/sys/dev/aic7xxx/aic79xx_osm.c +++ b/sys/dev/aic7xxx/aic79xx_osm.c @@ -1,4 +1,4 @@ -/* +/*- * Bus independent FreeBSD shim for the aic79xx based Adaptec SCSI controllers * * Copyright (c) 1994-2002, 2004 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aic79xx_osm.h b/sys/dev/aic7xxx/aic79xx_osm.h index 924ef1bb4689..c6f36f1d8700 100644 --- a/sys/dev/aic7xxx/aic79xx_osm.h +++ b/sys/dev/aic7xxx/aic79xx_osm.h @@ -1,4 +1,4 @@ -/* +/*- * FreeBSD platform specific driver option settings, data structures, * function declarations and includes. * diff --git a/sys/dev/aic7xxx/aic79xx_pci.c b/sys/dev/aic7xxx/aic79xx_pci.c index 6f917b90da24..7c8adde6a9f7 100644 --- a/sys/dev/aic7xxx/aic79xx_pci.c +++ b/sys/dev/aic7xxx/aic79xx_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Product specific probe and attach routines for: * aic7901 and aic7902 SCSI controllers * diff --git a/sys/dev/aic7xxx/aic7xxx.c b/sys/dev/aic7xxx/aic7xxx.c index c60a770ccab0..c48b850e98e3 100644 --- a/sys/dev/aic7xxx/aic7xxx.c +++ b/sys/dev/aic7xxx/aic7xxx.c @@ -1,4 +1,4 @@ -/* +/*- * Core routines and tables shareable across OS platforms. * * Copyright (c) 1994-2002 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aic7xxx.h b/sys/dev/aic7xxx/aic7xxx.h index d1f7cbabca47..0ac10be92752 100644 --- a/sys/dev/aic7xxx/aic7xxx.h +++ b/sys/dev/aic7xxx/aic7xxx.h @@ -1,4 +1,4 @@ -/* +/*- * Core definitions and data structures shareable across OS platforms. * * Copyright (c) 1994-2001 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aic7xxx.reg b/sys/dev/aic7xxx/aic7xxx.reg index e196d83b93c7..076c2ba49f92 100644 --- a/sys/dev/aic7xxx/aic7xxx.reg +++ b/sys/dev/aic7xxx/aic7xxx.reg @@ -1,4 +1,4 @@ -/* +/*- * Aic7xxx register and scratch ram definitions. * * Copyright (c) 1994-2001 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aic7xxx.seq b/sys/dev/aic7xxx/aic7xxx.seq index 810d766beeaf..0eefaaa41b79 100644 --- a/sys/dev/aic7xxx/aic7xxx.seq +++ b/sys/dev/aic7xxx/aic7xxx.seq @@ -1,4 +1,4 @@ -/* +/*- * Adaptec 274x/284x/294x device driver firmware for Linux and FreeBSD. * * Copyright (c) 1994-2001 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aic7xxx_93cx6.c b/sys/dev/aic7xxx/aic7xxx_93cx6.c index 6d08d2563848..b9738bb5302c 100644 --- a/sys/dev/aic7xxx/aic7xxx_93cx6.c +++ b/sys/dev/aic7xxx/aic7xxx_93cx6.c @@ -1,4 +1,4 @@ -/* +-e/* * Interface for the 93C66/56/46/26/06 serial eeprom parts. * * Copyright (c) 1995, 1996 Daniel M. Eischen diff --git a/sys/dev/aic7xxx/aic7xxx_93cx6.h b/sys/dev/aic7xxx/aic7xxx_93cx6.h index 859c43ccdd46..3827015edcbb 100644 --- a/sys/dev/aic7xxx/aic7xxx_93cx6.h +++ b/sys/dev/aic7xxx/aic7xxx_93cx6.h @@ -1,4 +1,4 @@ -/* +/*- * Interface to the 93C46/56 serial EEPROM that is used to store BIOS * settings for the aic7xxx based adaptec SCSI controllers. It can * also be used for 93C26 and 93C06 serial EEPROMS. diff --git a/sys/dev/aic7xxx/aic7xxx_inline.h b/sys/dev/aic7xxx/aic7xxx_inline.h index e25e1049df2a..989ac79dfc24 100644 --- a/sys/dev/aic7xxx/aic7xxx_inline.h +++ b/sys/dev/aic7xxx/aic7xxx_inline.h @@ -1,4 +1,4 @@ -/* +/*- * Inline routines shareable across OS platforms. * * Copyright (c) 1994-2001 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aic7xxx_osm.c b/sys/dev/aic7xxx/aic7xxx_osm.c index ba1eca22cd97..a1b65bb860f3 100644 --- a/sys/dev/aic7xxx/aic7xxx_osm.c +++ b/sys/dev/aic7xxx/aic7xxx_osm.c @@ -1,4 +1,4 @@ -/* +/*- * Bus independent FreeBSD shim for the aic7xxx based Adaptec SCSI controllers * * Copyright (c) 1994-2001 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aic7xxx_osm.h b/sys/dev/aic7xxx/aic7xxx_osm.h index 55d9697b6588..07752a3b5bc4 100644 --- a/sys/dev/aic7xxx/aic7xxx_osm.h +++ b/sys/dev/aic7xxx/aic7xxx_osm.h @@ -1,4 +1,4 @@ -/* +/*- * FreeBSD platform specific driver option settings, data structures, * function declarations and includes. * diff --git a/sys/dev/aic7xxx/aic7xxx_pci.c b/sys/dev/aic7xxx/aic7xxx_pci.c index fcb90b92174f..d37607daadd5 100644 --- a/sys/dev/aic7xxx/aic7xxx_pci.c +++ b/sys/dev/aic7xxx/aic7xxx_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Product specific probe and attach routines for: * 3940, 2940, aic7895, aic7890, aic7880, * aic7870, aic7860 and aic7850 SCSI controllers diff --git a/sys/dev/aic7xxx/aic_osm_lib.c b/sys/dev/aic7xxx/aic_osm_lib.c index 525fdcc2c00d..8919789c6db0 100644 --- a/sys/dev/aic7xxx/aic_osm_lib.c +++ b/sys/dev/aic7xxx/aic_osm_lib.c @@ -1,4 +1,4 @@ -/* +/*- * FreeBSD OSM Library for the aic7xxx aic79xx based Adaptec SCSI controllers * * Copyright (c) 1994-2002 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aic_osm_lib.h b/sys/dev/aic7xxx/aic_osm_lib.h index 86a2db45d0a8..1c8678b58bf7 100644 --- a/sys/dev/aic7xxx/aic_osm_lib.h +++ b/sys/dev/aic7xxx/aic_osm_lib.h @@ -1,4 +1,4 @@ -/* +/*- * FreeBSD platform specific, shared driver option settings, data structures, * function declarations and includes. * diff --git a/sys/dev/aic7xxx/aicasm/aicasm.c b/sys/dev/aic7xxx/aicasm/aicasm.c index 0c780f9065be..ad010649c8b5 100644 --- a/sys/dev/aic7xxx/aicasm/aicasm.c +++ b/sys/dev/aic7xxx/aicasm/aicasm.c @@ -1,4 +1,4 @@ -/* +/*- * Aic7xxx SCSI host adapter firmware asssembler * * Copyright (c) 1997, 1998, 2000, 2001 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aicasm/aicasm.h b/sys/dev/aic7xxx/aicasm/aicasm.h index 51678dd46ff7..440cb495f955 100644 --- a/sys/dev/aic7xxx/aicasm/aicasm.h +++ b/sys/dev/aic7xxx/aicasm/aicasm.h @@ -1,4 +1,4 @@ -/* +/*- * Assembler for the sequencer program downloaded to Aic7xxx SCSI host adapters * * Copyright (c) 1997 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aicasm/aicasm_gram.y b/sys/dev/aic7xxx/aicasm/aicasm_gram.y index 67e046d96625..f96116d0f9cb 100644 --- a/sys/dev/aic7xxx/aicasm/aicasm_gram.y +++ b/sys/dev/aic7xxx/aicasm/aicasm_gram.y @@ -1,5 +1,5 @@ %{ -/* +/*- * Parser for the Aic7xxx SCSI Host adapter sequencer assembler. * * Copyright (c) 1997, 1998, 2000 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aicasm/aicasm_insformat.h b/sys/dev/aic7xxx/aicasm/aicasm_insformat.h index 3e80f07df49c..820310b469cd 100644 --- a/sys/dev/aic7xxx/aicasm/aicasm_insformat.h +++ b/sys/dev/aic7xxx/aicasm/aicasm_insformat.h @@ -1,4 +1,4 @@ -/* +/*- * Instruction formats for the sequencer program downloaded to * Aic7xxx SCSI host adapters * diff --git a/sys/dev/aic7xxx/aicasm/aicasm_macro_gram.y b/sys/dev/aic7xxx/aicasm/aicasm_macro_gram.y index 439f760b34b5..48551c6b0f84 100644 --- a/sys/dev/aic7xxx/aicasm/aicasm_macro_gram.y +++ b/sys/dev/aic7xxx/aicasm/aicasm_macro_gram.y @@ -1,5 +1,5 @@ %{ -/* +/*- * Sub-parser for macro invocation in the Aic7xxx SCSI * Host adapter sequencer assembler. * diff --git a/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l b/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l index f06e7035cb35..49557a8837f8 100644 --- a/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l +++ b/sys/dev/aic7xxx/aicasm/aicasm_macro_scan.l @@ -1,5 +1,5 @@ %{ -/* +/*- * Sub-Lexical Analyzer for macro invokation in * the Aic7xxx SCSI Host adapter sequencer assembler. * diff --git a/sys/dev/aic7xxx/aicasm/aicasm_scan.l b/sys/dev/aic7xxx/aicasm/aicasm_scan.l index 45c0b233d0bc..ced09dc2b12b 100644 --- a/sys/dev/aic7xxx/aicasm/aicasm_scan.l +++ b/sys/dev/aic7xxx/aicasm/aicasm_scan.l @@ -1,5 +1,5 @@ %{ -/* +/*- * Lexical Analyzer for the Aic7xxx SCSI Host adapter sequencer assembler. * * Copyright (c) 1997, 1998, 2000 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aicasm/aicasm_symbol.c b/sys/dev/aic7xxx/aicasm/aicasm_symbol.c index f1f448dff569..9770a71b8d09 100644 --- a/sys/dev/aic7xxx/aicasm/aicasm_symbol.c +++ b/sys/dev/aic7xxx/aicasm/aicasm_symbol.c @@ -1,4 +1,4 @@ -/* +/*- * Aic7xxx SCSI host adapter firmware asssembler symbol table implementation * * Copyright (c) 1997 Justin T. Gibbs. diff --git a/sys/dev/aic7xxx/aicasm/aicasm_symbol.h b/sys/dev/aic7xxx/aicasm/aicasm_symbol.h index afc22e8b4903..1496c3768c81 100644 --- a/sys/dev/aic7xxx/aicasm/aicasm_symbol.h +++ b/sys/dev/aic7xxx/aicasm/aicasm_symbol.h @@ -1,4 +1,4 @@ -/* +/*- * Aic7xxx SCSI host adapter firmware asssembler symbol table definitions * * Copyright (c) 1997 Justin T. Gibbs. diff --git a/sys/dev/amd/amd.c b/sys/dev/amd/amd.c index b885bf44464e..0c9f28979f36 100644 --- a/sys/dev/amd/amd.c +++ b/sys/dev/amd/amd.c @@ -1,4 +1,4 @@ -/* +/*- ********************************************************************* * FILE NAME : amd.c * BY : C.L. Huang (ching@tekram.com.tw) diff --git a/sys/dev/amd/amd.h b/sys/dev/amd/amd.h index 6171bcfe322a..d9b8cd209b34 100644 --- a/sys/dev/amd/amd.h +++ b/sys/dev/amd/amd.h @@ -1,4 +1,4 @@ -/* +/*- ********************************************************************* * FILE NAME : amd.h * BY : C.L. Huang (ching@tekram.com.tw) diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c index 8762a019159a..62ce551d3b6e 100644 --- a/sys/dev/amr/amr.c +++ b/sys/dev/amr/amr.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* +/*- * Copyright (c) 2002 Eric Moore * Copyright (c) 2002 LSI Logic Corporation * All rights reserved. diff --git a/sys/dev/amr/amr_cam.c b/sys/dev/amr/amr_cam.c index bd4cdb99c4fd..17cd8356f7f1 100644 --- a/sys/dev/amr/amr_cam.c +++ b/sys/dev/amr/amr_cam.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* +/*- * Copyright (c) 2002 Eric Moore * Copyright (c) 2002 LSI Logic Corporation * All rights reserved. diff --git a/sys/dev/amr/amr_disk.c b/sys/dev/amr/amr_disk.c index 8c520adc5a47..da7e94eb8a43 100644 --- a/sys/dev/amr/amr_disk.c +++ b/sys/dev/amr/amr_disk.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* +/*- * Copyright (c) 2002 Eric Moore * Copyright (c) 2002 LSI Logic Corporation * All rights reserved. diff --git a/sys/dev/amr/amr_pci.c b/sys/dev/amr/amr_pci.c index f4cf4ac4356e..8f3ef11b1b2e 100644 --- a/sys/dev/amr/amr_pci.c +++ b/sys/dev/amr/amr_pci.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* +/*- * Copyright (c) 2002 Eric Moore * Copyright (c) 2002 LSI Logic Corporation * All rights reserved. diff --git a/sys/dev/an/if_aironet_ieee.h b/sys/dev/an/if_aironet_ieee.h index a838424f5a81..28e4f72148e9 100644 --- a/sys/dev/an/if_aironet_ieee.h +++ b/sys/dev/an/if_aironet_ieee.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/an/if_an.c b/sys/dev/an/if_an.c index c3487386e14f..29b0adb571c8 100644 --- a/sys/dev/an/if_an.c +++ b/sys/dev/an/if_an.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/an/if_an_isa.c b/sys/dev/an/if_an_isa.c index 92b9d1c379eb..7144cc8778ad 100644 --- a/sys/dev/an/if_an_isa.c +++ b/sys/dev/an/if_an_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/an/if_an_pccard.c b/sys/dev/an/if_an_pccard.c index 7b22eace94ad..ad37b67de5a2 100644 --- a/sys/dev/an/if_an_pccard.c +++ b/sys/dev/an/if_an_pccard.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/an/if_anreg.h b/sys/dev/an/if_anreg.h index 47db1be4e98f..12a03f004ade 100644 --- a/sys/dev/an/if_anreg.h +++ b/sys/dev/an/if_anreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/ar/if_ar.c b/sys/dev/ar/if_ar.c index 7777e89348b7..70abc1d04b0c 100644 --- a/sys/dev/ar/if_ar.c +++ b/sys/dev/ar/if_ar.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995 - 2001 John Hay. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ar/if_ar.h b/sys/dev/ar/if_ar.h index 875e42a6745c..a6fc8cf088ec 100644 --- a/sys/dev/ar/if_ar.h +++ b/sys/dev/ar/if_ar.h @@ -1,4 +1,4 @@ -/* +/*- * if_ar.h * * Copyright (C) 1997-1999 Whistle Communications Inc. diff --git a/sys/dev/ar/if_ar_isa.c b/sys/dev/ar/if_ar_isa.c index fe07afb8d5b7..81c001f35e8a 100644 --- a/sys/dev/ar/if_ar_isa.c +++ b/sys/dev/ar/if_ar_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995 - 2001 John Hay. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ar/if_arregs.h b/sys/dev/ar/if_arregs.h index f73543522760..d643cafee44c 100644 --- a/sys/dev/ar/if_arregs.h +++ b/sys/dev/ar/if_arregs.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995 - 2001 John Hay. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/asr/dptalign.h b/sys/dev/asr/dptalign.h index bb72c5b67fb4..038dc6f4b5bb 100644 --- a/sys/dev/asr/dptalign.h +++ b/sys/dev/asr/dptalign.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996-1999 Distributed Processing Technology Corporation * All rights reserved. * diff --git a/sys/dev/asr/dptsig.h b/sys/dev/asr/dptsig.h index 94c0810ae3a1..a70ad114bdc3 100644 --- a/sys/dev/asr/dptsig.h +++ b/sys/dev/asr/dptsig.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996-2000 Distributed Processing Technology Corporation * Copyright (c) 2000-2001 Adaptec Corporation. * All rights reserved. diff --git a/sys/dev/asr/i2oadptr.h b/sys/dev/asr/i2oadptr.h index d880e4793a30..c189d8d658d9 100644 --- a/sys/dev/asr/i2oadptr.h +++ b/sys/dev/asr/i2oadptr.h @@ -1,4 +1,5 @@ -/**************************************************************** +/*- + **************************************************************** * Copyright (c) 1996-2000 Distributed Processing Technology Corporation * Copyright (c) 2000 Adaptec Corproation. * All rights reserved. diff --git a/sys/dev/asr/i2obscsi.h b/sys/dev/asr/i2obscsi.h index 06ee30ce662c..a6666feb661b 100644 --- a/sys/dev/asr/i2obscsi.h +++ b/sys/dev/asr/i2obscsi.h @@ -1,4 +1,5 @@ -/**************************************************************** +/*- + **************************************************************** * Copyright (c) 1996-2000 Distributed Processing Technology Corporation * Copyright (c) 2000 Adaptec Corporation. * All rights reserved. diff --git a/sys/dev/asr/i2odep.h b/sys/dev/asr/i2odep.h index 6b2fe5c5ee60..c1e6e5067ce2 100644 --- a/sys/dev/asr/i2odep.h +++ b/sys/dev/asr/i2odep.h @@ -1,4 +1,5 @@ -/**************************************************************************** +/*- + **************************************************************************** * * Copyright (c) 1996-2000 Distributed Processing Technology Corporation * Copyright (c) 2000 Adaptec Corporation. diff --git a/sys/dev/asr/i2odpt.h b/sys/dev/asr/i2odpt.h index 9435b7cf19a5..4c9a9d462318 100644 --- a/sys/dev/asr/i2odpt.h +++ b/sys/dev/asr/i2odpt.h @@ -1,4 +1,5 @@ -/**************************************************************** +/*- + ***************************************************************** * Copyright (c) 1996-2000 Distributed Processing Technology Corporation * Copyright (c) 2000 Adaptec Corporation. * All rights reserved. diff --git a/sys/dev/asr/i2oexec.h b/sys/dev/asr/i2oexec.h index e80030576568..ae4327a6cb80 100644 --- a/sys/dev/asr/i2oexec.h +++ b/sys/dev/asr/i2oexec.h @@ -1,4 +1,5 @@ -/**************************************************************** +/*- + **************************************************************** * Copyright (c) 1996-2000 Distributed Processing Technology Corporation * Copyright (c) 2000 Adaptec Corporation. * All rights reserved. diff --git a/sys/dev/asr/i2omsg.h b/sys/dev/asr/i2omsg.h index 23f2791aa3a3..833bd9173d38 100644 --- a/sys/dev/asr/i2omsg.h +++ b/sys/dev/asr/i2omsg.h @@ -1,4 +1,5 @@ -/**************************************************************** +/*- + **************************************************************** * Copyright (c) 1996-2000 Distributed Processing Technology Corporation * Copyright (c) 2000 Adaptec Corporation. * All rights reserved. diff --git a/sys/dev/asr/i2otypes.h b/sys/dev/asr/i2otypes.h index eaa97c71342f..c85d92dd2c32 100644 --- a/sys/dev/asr/i2otypes.h +++ b/sys/dev/asr/i2otypes.h @@ -1,4 +1,5 @@ -/**************************************************************** +/*- + **************************************************************** * Copyright (c) 1996-2000 Distributed Processing Technology Corporation * Copyright (c) 2000 Adaptec Corporation. * All rights reserved. diff --git a/sys/dev/asr/i2outil.h b/sys/dev/asr/i2outil.h index 3262dcda5244..c7e3061dbb28 100644 --- a/sys/dev/asr/i2outil.h +++ b/sys/dev/asr/i2outil.h @@ -1,4 +1,5 @@ -/**************************************************************** +/*- + **************************************************************** * Copyright (c) 1996-2000 Distributed Processing Technology Corporation * Copyright (c) 2000 Adaptec Corporation. * All rights reserved. diff --git a/sys/dev/asr/osd_defs.h b/sys/dev/asr/osd_defs.h index 871d8f92c1ca..c954be9816b1 100644 --- a/sys/dev/asr/osd_defs.h +++ b/sys/dev/asr/osd_defs.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996-1999 Distributed Processing Technology Corporation * All rights reserved. * diff --git a/sys/dev/asr/osd_unix.h b/sys/dev/asr/osd_unix.h index e1309e4f0ddc..04f7a29b6969 100644 --- a/sys/dev/asr/osd_unix.h +++ b/sys/dev/asr/osd_unix.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996-1999 Distributed Processing Technology Corporation * All rights reserved. * diff --git a/sys/dev/asr/osd_util.h b/sys/dev/asr/osd_util.h index a243c04d1edb..baa233804a3f 100644 --- a/sys/dev/asr/osd_util.h +++ b/sys/dev/asr/osd_util.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996-1999 Distributed Processing Technology Corporation * All rights reserved. * diff --git a/sys/dev/asr/sys_info.h b/sys/dev/asr/sys_info.h index 80da928e7cbb..b4c78fe819fd 100644 --- a/sys/dev/asr/sys_info.h +++ b/sys/dev/asr/sys_info.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996-1999 Distributed Processing Technology Corporation * All rights reserved. * diff --git a/sys/dev/auxio/auxio.c b/sys/dev/auxio/auxio.c index 74d68808b743..ebd0e254b18e 100644 --- a/sys/dev/auxio/auxio.c +++ b/sys/dev/auxio/auxio.c @@ -27,7 +27,7 @@ /* $NetBSD: auxio.c,v 1.11 2003/07/15 03:36:04 lukem Exp $ */ -/* +/*- * Copyright (c) 2000, 2001 Matthew R. Green * All rights reserved. * diff --git a/sys/dev/auxio/auxioreg.h b/sys/dev/auxio/auxioreg.h index 439bf3487434..0c9ce8e9fa93 100644 --- a/sys/dev/auxio/auxioreg.h +++ b/sys/dev/auxio/auxioreg.h @@ -1,7 +1,7 @@ /* $FreeBSD$ */ /* $NetBSD: auxioreg.h,v 1.4 2001/10/22 07:31:41 mrg Exp $ */ -/* +/*- * Copyright (c) 2000 Matthew R. Green * All rights reserved. * diff --git a/sys/dev/awi/if_awi_pccard.c b/sys/dev/awi/if_awi_pccard.c index 683790a5cb80..1f00ff7a51a1 100644 --- a/sys/dev/awi/if_awi_pccard.c +++ b/sys/dev/awi/if_awi_pccard.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 Atsushi Onoe * All rights reserved. * diff --git a/sys/dev/bfe/if_bfe.c b/sys/dev/bfe/if_bfe.c index 4d9a4627f8d2..c6e93a26b517 100644 --- a/sys/dev/bfe/if_bfe.c +++ b/sys/dev/bfe/if_bfe.c @@ -1,9 +1,7 @@ -/* +/*- * Copyright (c) 2003 Stuart Walsh * and Duncan Barclay - */ - -/* + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: diff --git a/sys/dev/bfe/if_bfereg.h b/sys/dev/bfe/if_bfereg.h index 383154f22db7..c76779a91a93 100644 --- a/sys/dev/bfe/if_bfereg.h +++ b/sys/dev/bfe/if_bfereg.h @@ -1,5 +1,6 @@ -/* Copyright (c) 2003 Stuart Walsh */ -/* +/*- + * Copyright (c) 2003 Stuart Walsh + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index 4563f32b15dc..9c5e4b5f10ec 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2001 * Bill Paul . All rights reserved. diff --git a/sys/dev/bge/if_bgereg.h b/sys/dev/bge/if_bgereg.h index 026ec81280ac..c95265597ed5 100644 --- a/sys/dev/bge/if_bgereg.h +++ b/sys/dev/bge/if_bgereg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2001 * Bill Paul . All rights reserved. diff --git a/sys/dev/bktr/bktr_audio.h b/sys/dev/bktr/bktr_audio.h index 9b7500703b24..c05e40c31ea3 100644 --- a/sys/dev/bktr/bktr_audio.h +++ b/sys/dev/bktr/bktr_audio.h @@ -13,7 +13,7 @@ * */ -/* +/*- * 1. Redistributions of source code must retain the * Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman * All rights reserved. diff --git a/sys/dev/bktr/bktr_card.h b/sys/dev/bktr/bktr_card.h index 720a798f4982..77ccaf44ab0a 100644 --- a/sys/dev/bktr/bktr_card.h +++ b/sys/dev/bktr/bktr_card.h @@ -14,7 +14,7 @@ * */ -/* +/*- * 1. Redistributions of source code must retain the * Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman * All rights reserved. diff --git a/sys/dev/bktr/bktr_core.h b/sys/dev/bktr/bktr_core.h index 315566f31a40..980ced76621a 100644 --- a/sys/dev/bktr/bktr_core.h +++ b/sys/dev/bktr/bktr_core.h @@ -15,7 +15,7 @@ * */ -/* +/*- * 1. Redistributions of source code must retain the * Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman * All rights reserved. diff --git a/sys/dev/bktr/bktr_mem.c b/sys/dev/bktr/bktr_mem.c index 3adacce803a9..5683410db415 100644 --- a/sys/dev/bktr/bktr_mem.c +++ b/sys/dev/bktr/bktr_mem.c @@ -11,7 +11,7 @@ * time the bktr driver is loaded. */ -/* +/*- * 1. Redistributions of source code must retain the * Copyright (c) 2000 Roger Hardiman * All rights reserved. diff --git a/sys/dev/bktr/bktr_mem.h b/sys/dev/bktr/bktr_mem.h index 4c6d7a508ac7..8feb55206c11 100644 --- a/sys/dev/bktr/bktr_mem.h +++ b/sys/dev/bktr/bktr_mem.h @@ -13,7 +13,7 @@ * time the bktr driver is loaded. */ -/* +/*- * 1. Redistributions of source code must retain the * Copyright (c) 2000 Roger Hardiman * All rights reserved. diff --git a/sys/dev/bktr/bktr_os.h b/sys/dev/bktr/bktr_os.h index d2826022a94d..1cd708df3c6a 100644 --- a/sys/dev/bktr/bktr_os.h +++ b/sys/dev/bktr/bktr_os.h @@ -10,7 +10,7 @@ * */ -/* +/*- * 1. Redistributions of source code must retain the * Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman * All rights reserved. diff --git a/sys/dev/bktr/bktr_reg.h b/sys/dev/bktr/bktr_reg.h index c8fc4d4bc7ea..e03b99a96e3d 100644 --- a/sys/dev/bktr/bktr_reg.h +++ b/sys/dev/bktr/bktr_reg.h @@ -1,4 +1,4 @@ -/* +/*- * $FreeBSD$ * * Copyright (c) 1999 Roger Hardiman diff --git a/sys/dev/bktr/bktr_tuner.h b/sys/dev/bktr/bktr_tuner.h index 338d1168f543..a1aa64a28d4a 100644 --- a/sys/dev/bktr/bktr_tuner.h +++ b/sys/dev/bktr/bktr_tuner.h @@ -10,7 +10,7 @@ * */ -/* +/*- * 1. Redistributions of source code must retain the * Copyright (c) 1997 Amancio Hasty, 1999 Roger Hardiman * All rights reserved. diff --git a/sys/dev/bktr/ioctl_meteor.h b/sys/dev/bktr/ioctl_meteor.h index 5f70a4b87ecd..681990aa03c0 100644 --- a/sys/dev/bktr/ioctl_meteor.h +++ b/sys/dev/bktr/ioctl_meteor.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995 Mark Tinguely and Jim Lowe * All rights reserved. * diff --git a/sys/dev/buslogic/bt.c b/sys/dev/buslogic/bt.c index 4920cdb351dc..74ad13b81875 100644 --- a/sys/dev/buslogic/bt.c +++ b/sys/dev/buslogic/bt.c @@ -1,4 +1,4 @@ -/* +/*- * Generic driver for the BusLogic MultiMaster SCSI host adapters * Product specific probe and attach routines can be found in: * sys/dev/buslogic/bt_isa.c BT-54X, BT-445 cards diff --git a/sys/dev/buslogic/bt_eisa.c b/sys/dev/buslogic/bt_eisa.c index 3157503513a3..b1c40107aa78 100644 --- a/sys/dev/buslogic/bt_eisa.c +++ b/sys/dev/buslogic/bt_eisa.c @@ -1,4 +1,4 @@ -/* +/*- * Product specific probe and attach routines for: * Buslogic BT74x SCSI controllers * diff --git a/sys/dev/buslogic/bt_isa.c b/sys/dev/buslogic/bt_isa.c index 3241abdb00c0..78f4b2e1133b 100644 --- a/sys/dev/buslogic/bt_isa.c +++ b/sys/dev/buslogic/bt_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Product specific probe and attach routines for: * Buslogic BT-54X and BT-445 cards * diff --git a/sys/dev/buslogic/btreg.h b/sys/dev/buslogic/btreg.h index 4a796f2a5813..be6e74f90ebe 100644 --- a/sys/dev/buslogic/btreg.h +++ b/sys/dev/buslogic/btreg.h @@ -1,4 +1,4 @@ -/* +/*- * Generic register and struct definitions for the BusLogic * MultiMaster SCSI host adapters. Product specific probe and * attach routines can be found in: diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c index 29557d20fb13..ba3f1ca42d3e 100644 --- a/sys/dev/cardbus/cardbus.c +++ b/sys/dev/cardbus/cardbus.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 M. Warner Losh. All Rights Reserved. * Copyright (c) 2000,2001 Jonathan Chen. All rights reserved. * diff --git a/sys/dev/cardbus/cardbus_cis.c b/sys/dev/cardbus/cardbus_cis.c index e17b935aed2d..6c4a3727a49e 100644 --- a/sys/dev/cardbus/cardbus_cis.c +++ b/sys/dev/cardbus/cardbus_cis.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000,2001 Jonathan Chen. * All rights reserved. * diff --git a/sys/dev/cardbus/cardbus_cis.h b/sys/dev/cardbus/cardbus_cis.h index a56d13b9df97..43adcfa01ce1 100644 --- a/sys/dev/cardbus/cardbus_cis.h +++ b/sys/dev/cardbus/cardbus_cis.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000,2001 Jonathan Chen. * All rights reserved. * diff --git a/sys/dev/cardbus/cardbusreg.h b/sys/dev/cardbus/cardbusreg.h index c356323d2125..56171aad3982 100644 --- a/sys/dev/cardbus/cardbusreg.h +++ b/sys/dev/cardbus/cardbusreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000,2001 Jonathan Chen. * All rights reserved. * diff --git a/sys/dev/cardbus/cardbusvar.h b/sys/dev/cardbus/cardbusvar.h index b8276894912d..d200f59e539e 100644 --- a/sys/dev/cardbus/cardbusvar.h +++ b/sys/dev/cardbus/cardbusvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000,2001 Jonathan Chen. * All rights reserved. * diff --git a/sys/dev/cnw/if_cnwioctl.h b/sys/dev/cnw/if_cnwioctl.h index 04e8c3b23727..cc1b54890a99 100644 --- a/sys/dev/cnw/if_cnwioctl.h +++ b/sys/dev/cnw/if_cnwioctl.h @@ -1,7 +1,7 @@ /* $NetBSD: if_cnwioctl.h,v 1.2 1999/11/29 12:54:00 itojun Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1996, 1997 Berkeley Software Design, Inc. * All rights reserved. * diff --git a/sys/dev/cp/cpddk.c b/sys/dev/cp/cpddk.c index 1fbd22d57fea..7c82f9b85208 100644 --- a/sys/dev/cp/cpddk.c +++ b/sys/dev/cp/cpddk.c @@ -1,4 +1,4 @@ -/* +/*- * Low-level subroutines for Cronyx Tau-PCI adapter. * * Copyright (C) 1999-2003 Cronyx Engineering. diff --git a/sys/dev/cp/cpddk.h b/sys/dev/cp/cpddk.h index 69d0512d66cb..3ff40bbd68d1 100644 --- a/sys/dev/cp/cpddk.h +++ b/sys/dev/cp/cpddk.h @@ -1,4 +1,4 @@ -/* +/*- * Cronyx Tau-PCI DDK definitions. * * Copyright (C) 1999-2003 Cronyx Engineering. diff --git a/sys/dev/cp/if_cp.c b/sys/dev/cp/if_cp.c index 2674c90ba391..bcc818f53bdd 100644 --- a/sys/dev/cp/if_cp.c +++ b/sys/dev/cp/if_cp.c @@ -1,4 +1,4 @@ -/* +/*- * Cronyx-Tau-PCI adapter driver for FreeBSD. * Supports PPP/HDLC, Cisco/HDLC and FrameRelay protocol in synchronous mode, * and asyncronous channels with full modem control. diff --git a/sys/dev/cp/ng_cp.h b/sys/dev/cp/ng_cp.h index 0dd65618cce3..f35d81760499 100644 --- a/sys/dev/cp/ng_cp.h +++ b/sys/dev/cp/ng_cp.h @@ -1,4 +1,4 @@ -/* +/*- * Defines for Cronyx-Tau-PCI adapter driver. * * Copyright (C) 1999-2004 Cronyx Engineering. diff --git a/sys/dev/cs/if_cs.c b/sys/dev/cs/if_cs.c index 939c2080c815..a8f058068f53 100644 --- a/sys/dev/cs/if_cs.c +++ b/sys/dev/cs/if_cs.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997,1998 Maxim Bolotin and Oleg Sharoiko. * All rights reserved. * diff --git a/sys/dev/cs/if_cs_isa.c b/sys/dev/cs/if_cs_isa.c index dcbd02f06869..8064f4b3a7a4 100644 --- a/sys/dev/cs/if_cs_isa.c +++ b/sys/dev/cs/if_cs_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997,1998 Maxim Bolotin and Oleg Sharoiko. * All rights reserved. * diff --git a/sys/dev/cs/if_cs_pccard.c b/sys/dev/cs/if_cs_pccard.c index 721a49a9de91..dbd3e54aad14 100644 --- a/sys/dev/cs/if_cs_pccard.c +++ b/sys/dev/cs/if_cs_pccard.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 M. Warner Losh * All rights reserved. * diff --git a/sys/dev/cs/if_csreg.h b/sys/dev/cs/if_csreg.h index 5a93643591d5..dc844c8cc810 100644 --- a/sys/dev/cs/if_csreg.h +++ b/sys/dev/cs/if_csreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997,1998 Maxim Bolotin and Oleg Sharoiko. * All rights reserved. * diff --git a/sys/dev/cs/if_csvar.h b/sys/dev/cs/if_csvar.h index 0f62c62d934d..0222841fcf08 100644 --- a/sys/dev/cs/if_csvar.h +++ b/sys/dev/cs/if_csvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 M. Warner Losh * All rights reserved. * diff --git a/sys/dev/ct/bshw_machdep.c b/sys/dev/ct/bshw_machdep.c index 5528f439f1ce..0e48f77ad286 100644 --- a/sys/dev/ct/bshw_machdep.c +++ b/sys/dev/ct/bshw_machdep.c @@ -4,7 +4,7 @@ __FBSDID("$FreeBSD$"); /* $NetBSD$ */ -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/ct/bshwvar.h b/sys/dev/ct/bshwvar.h index 9e2259c94c76..ba42a7206979 100644 --- a/sys/dev/ct/bshwvar.h +++ b/sys/dev/ct/bshwvar.h @@ -2,7 +2,7 @@ /* $NecBSD: bshwvar.h,v 1.3.14.3 2001/06/21 04:07:37 honda Exp $ */ /* $NetBSD$ */ -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1994, 1995, 1996, 1997, 1998 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/ct/ct.c b/sys/dev/ct/ct.c index eb87dbfb7e55..602e094509ca 100644 --- a/sys/dev/ct/ct.c +++ b/sys/dev/ct/ct.c @@ -7,7 +7,7 @@ __FBSDID("$FreeBSD$"); #define CT_DEBUG #define CT_IO_CONTROL_FLAGS (CT_USE_CCSEQ | CT_FAST_INTR) -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/ct/ct_isa.c b/sys/dev/ct/ct_isa.c index 15173e23a550..b16b1d872f0e 100644 --- a/sys/dev/ct/ct_isa.c +++ b/sys/dev/ct/ct_isa.c @@ -4,7 +4,7 @@ __FBSDID("$FreeBSD$"); /* $NetBSD$ */ -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1995, 1996, 1997, 1998 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/ct/ct_machdep.h b/sys/dev/ct/ct_machdep.h index 18a9ec86673c..2e069f5d33a1 100644 --- a/sys/dev/ct/ct_machdep.h +++ b/sys/dev/ct/ct_machdep.h @@ -2,7 +2,7 @@ /* $NecBSD: ct_machdep.h,v 1.4.12.2 2001/06/20 06:13:34 honda Exp $ */ /* $NetBSD$ */ -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/ct/ctvar.h b/sys/dev/ct/ctvar.h index 4e7ba1569edc..8c63445e0200 100644 --- a/sys/dev/ct/ctvar.h +++ b/sys/dev/ct/ctvar.h @@ -2,7 +2,7 @@ /* $NecBSD: ctvar.h,v 1.4.14.3 2001/06/20 06:13:34 honda Exp $ */ /* $NetBSD$ */ -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/ctau/am8530.h b/sys/dev/ctau/am8530.h index 0ab2d4eaeb45..09831c624ed7 100644 --- a/sys/dev/ctau/am8530.h +++ b/sys/dev/ctau/am8530.h @@ -1,4 +1,4 @@ -/* +/*- * AMD Am83C30 serial communication controller registers. * * Copyright (C) 1996 Cronyx Engineering. diff --git a/sys/dev/ctau/ctau.c b/sys/dev/ctau/ctau.c index 37cbd4698caa..9b4f40475af3 100644 --- a/sys/dev/ctau/ctau.c +++ b/sys/dev/ctau/ctau.c @@ -1,4 +1,4 @@ -/* +/*- * Low-level subroutines for Cronyx-Tau adapter. * * Copyright (C) 1994-2001 Cronyx Engineering. diff --git a/sys/dev/ctau/ctaureg.h b/sys/dev/ctau/ctaureg.h index 9097a5522a1e..3cd2ce21cedd 100644 --- a/sys/dev/ctau/ctaureg.h +++ b/sys/dev/ctau/ctaureg.h @@ -1,4 +1,4 @@ -/* +/*- * Defines for Cronyx-Tau adapter, based on Hitachi HD64570 controller. * * Copyright (C) 1996 Cronyx Engineering. diff --git a/sys/dev/ctau/ctddk.c b/sys/dev/ctau/ctddk.c index 92f98056697f..0a9dbd2fd46b 100644 --- a/sys/dev/ctau/ctddk.c +++ b/sys/dev/ctau/ctddk.c @@ -1,4 +1,4 @@ -/* +/*- * DDK library for Cronyx-Tau adapters. * * Copyright (C) 1998-1999 Cronyx Engineering. diff --git a/sys/dev/ctau/ctddk.h b/sys/dev/ctau/ctddk.h index d48e1092319a..99620902fc96 100644 --- a/sys/dev/ctau/ctddk.h +++ b/sys/dev/ctau/ctddk.h @@ -1,4 +1,4 @@ -/* +/*- * Defines for Cronyx-Tau adapter driver. * * Copyright (C) 1994-2003 Cronyx Engineering. diff --git a/sys/dev/ctau/ds2153.h b/sys/dev/ctau/ds2153.h index bb0241464a55..44ab02d41fe9 100644 --- a/sys/dev/ctau/ds2153.h +++ b/sys/dev/ctau/ds2153.h @@ -1,4 +1,4 @@ -/* +/*- * Dallas DS2153, DS21x54 single-chip E1 tranceiver registers. * * Copyright (C) 1996 Cronyx Engineering. diff --git a/sys/dev/ctau/hdc64570.h b/sys/dev/ctau/hdc64570.h index 978ff6ab20c5..29d28cddb04c 100644 --- a/sys/dev/ctau/hdc64570.h +++ b/sys/dev/ctau/hdc64570.h @@ -1,4 +1,4 @@ -/* +/*- * Hitachi HD64570 serial communications adaptor registers. * * Copyright (C) 1996 Cronyx Engineering. diff --git a/sys/dev/ctau/if_ct.c b/sys/dev/ctau/if_ct.c index 0292be058fb3..b18dc9497b4a 100644 --- a/sys/dev/ctau/if_ct.c +++ b/sys/dev/ctau/if_ct.c @@ -1,4 +1,4 @@ -/* +/*- * Cronyx-Tau adapter driver for FreeBSD. * Supports PPP/HDLC and Cisco/HDLC protocol in synchronous mode, * and asyncronous channels with full modem control. diff --git a/sys/dev/ctau/lxt318.h b/sys/dev/ctau/lxt318.h index f194b7bda03b..a1064afca67c 100644 --- a/sys/dev/ctau/lxt318.h +++ b/sys/dev/ctau/lxt318.h @@ -1,4 +1,4 @@ -/* +/*- * Level One LXT318 E1 transceiver registers. * Crystal CS61318 E1 Line Interface Unit registers. * Crystal CS61581 T1/E1 Line Interface Unit registers. diff --git a/sys/dev/ctau/ng_ct.h b/sys/dev/ctau/ng_ct.h index 5fba87812cda..bd4d208e1204 100644 --- a/sys/dev/ctau/ng_ct.h +++ b/sys/dev/ctau/ng_ct.h @@ -1,4 +1,4 @@ -/* +/*- * Defines for Cronyx-Tau adapter driver. * * Copyright (C) 1999-2004 Cronyx Engineering. diff --git a/sys/dev/cx/cronyxfw.h b/sys/dev/cx/cronyxfw.h index 70264136ec14..56b2033b09ab 100644 --- a/sys/dev/cx/cronyxfw.h +++ b/sys/dev/cx/cronyxfw.h @@ -1,4 +1,4 @@ -/* +/*- * Cronyx firmware definitions. * * Copyright (C) 1996 Cronyx Engineering. diff --git a/sys/dev/cx/csigma.c b/sys/dev/cx/csigma.c index db2c1380c264..e880b88cbef0 100644 --- a/sys/dev/cx/csigma.c +++ b/sys/dev/cx/csigma.c @@ -1,4 +1,4 @@ -/* +/*- * Low-level subroutines for Cronyx-Sigma adapter. * * Copyright (C) 1994-2000 Cronyx Engineering. diff --git a/sys/dev/cx/cxddk.c b/sys/dev/cx/cxddk.c index e4328b59b127..bbcc904051e8 100644 --- a/sys/dev/cx/cxddk.c +++ b/sys/dev/cx/cxddk.c @@ -1,4 +1,4 @@ -/* +/*- * Cronyx-Sigma Driver Development Kit. * * Copyright (C) 1998 Cronyx Engineering. diff --git a/sys/dev/cx/cxddk.h b/sys/dev/cx/cxddk.h index 75b40c04884d..bd95aa6e254c 100644 --- a/sys/dev/cx/cxddk.h +++ b/sys/dev/cx/cxddk.h @@ -1,4 +1,4 @@ -/* +/*- * Defines for Cronyx-Sigma adapter driver. * * Copyright (C) 1994-2001 Cronyx Engineering. diff --git a/sys/dev/cx/cxreg.h b/sys/dev/cx/cxreg.h index 0cfc6b0f101a..70a937d11280 100644 --- a/sys/dev/cx/cxreg.h +++ b/sys/dev/cx/cxreg.h @@ -1,4 +1,4 @@ -/* +/*- * Defines for Cronyx-Sigma adapter, based on Cirrus Logic multiprotocol * controller RISC processor CL-CD2400/2401. * diff --git a/sys/dev/cx/if_cx.c b/sys/dev/cx/if_cx.c index c7f667344c04..8ff12c029dc2 100644 --- a/sys/dev/cx/if_cx.c +++ b/sys/dev/cx/if_cx.c @@ -1,4 +1,4 @@ -/* +/*- * Cronyx-Sigma adapter driver for FreeBSD. * Supports PPP/HDLC and Cisco/HDLC protocol in synchronous mode, * and asyncronous channels with full modem control. diff --git a/sys/dev/cx/machdep.h b/sys/dev/cx/machdep.h index 0a622f1e8cc7..c4affc46923a 100644 --- a/sys/dev/cx/machdep.h +++ b/sys/dev/cx/machdep.h @@ -1,4 +1,4 @@ -/* +/*- * Cronyx DDK: platform dependent definitions. * * Copyright (C) 1998-1999 Cronyx Engineering diff --git a/sys/dev/cx/ng_cx.h b/sys/dev/cx/ng_cx.h index a878e9872dfa..30b3c14daa4e 100644 --- a/sys/dev/cx/ng_cx.h +++ b/sys/dev/cx/ng_cx.h @@ -1,4 +1,4 @@ -/* +/*- * Defines for Cronyx-Tau adapter driver. * * Copyright (C) 1999-2004 Cronyx Engineering. diff --git a/sys/dev/cy/cy_pci.c b/sys/dev/cy/cy_pci.c index 98c21973b3a2..dd119e9145a2 100644 --- a/sys/dev/cy/cy_pci.c +++ b/sys/dev/cy/cy_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996, David Greenman * All rights reserved. * diff --git a/sys/dev/dc/dcphy.c b/sys/dev/dc/dcphy.c index 28affb81063c..ddf9b7e2a605 100644 --- a/sys/dev/dc/dcphy.c +++ b/sys/dev/dc/dcphy.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/dcons/dcons.c b/sys/dev/dcons/dcons.c index b48a5040d24e..0bfbbe2fce8a 100644 --- a/sys/dev/dcons/dcons.c +++ b/sys/dev/dcons/dcons.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2003,2004 * Hidetoshi Shimokawa. All rights reserved. * diff --git a/sys/dev/dcons/dcons.h b/sys/dev/dcons/dcons.h index 988c81f2722c..daf9cb4e3b0e 100644 --- a/sys/dev/dcons/dcons.h +++ b/sys/dev/dcons/dcons.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2002-2004 * Hidetoshi Shimokawa. All rights reserved. * diff --git a/sys/dev/dcons/dcons_crom.c b/sys/dev/dcons/dcons_crom.c index 32ae15a01be9..bfa91464a834 100644 --- a/sys/dev/dcons/dcons_crom.c +++ b/sys/dev/dcons/dcons_crom.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2003 * Hidetoshi Shimokawa. All rights reserved. * diff --git a/sys/dev/dcons/dcons_os.c b/sys/dev/dcons/dcons_os.c index 3bdbb69039da..8ca20aa272f3 100644 --- a/sys/dev/dcons/dcons_os.c +++ b/sys/dev/dcons/dcons_os.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2003,2004 * Hidetoshi Shimokawa. All rights reserved. * diff --git a/sys/dev/dcons/dcons_os.h b/sys/dev/dcons/dcons_os.h index f88738b5b221..b1d1c627589c 100644 --- a/sys/dev/dcons/dcons_os.h +++ b/sys/dev/dcons/dcons_os.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2002-2004 * Hidetoshi Shimokawa. All rights reserved. * diff --git a/sys/dev/dec/mc146818reg.h b/sys/dev/dec/mc146818reg.h index e60d043f13dd..4a3df1c117b0 100644 --- a/sys/dev/dec/mc146818reg.h +++ b/sys/dev/dec/mc146818reg.h @@ -1,7 +1,7 @@ /* $FreeBSD$ */ /* $NetBSD: mc146818reg.h,v 1.2 1997/03/12 06:53:42 cgd Exp $ */ -/* +/*- * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. * diff --git a/sys/dev/dec/mcclock.c b/sys/dev/dec/mcclock.c index 5c1472cb1975..da8664e007af 100644 --- a/sys/dev/dec/mcclock.c +++ b/sys/dev/dec/mcclock.c @@ -3,7 +3,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. * All rights reserved. * diff --git a/sys/dev/dec/mcclock_if.m b/sys/dev/dec/mcclock_if.m index a67caca2604e..89bc6c481194 100644 --- a/sys/dev/dec/mcclock_if.m +++ b/sys/dev/dec/mcclock_if.m @@ -1,4 +1,4 @@ -# +#- # Copyright (c) 1998 Doug Rabson # All rights reserved. # diff --git a/sys/dev/dec/mcclockvar.h b/sys/dev/dec/mcclockvar.h index 196209be3bce..b0df9d2eff2c 100644 --- a/sys/dev/dec/mcclockvar.h +++ b/sys/dev/dec/mcclockvar.h @@ -1,7 +1,7 @@ /* $FreeBSD$ */ /* $NetBSD: mcclockvar.h,v 1.4 1997/06/22 08:02:19 jonathan Exp $ */ -/* +/*- * Copyright (c) 1996 Carnegie-Mellon University. * All rights reserved. * diff --git a/sys/dev/dpt/dpt.h b/sys/dev/dpt/dpt.h index d04c95a3b8bb..39171950f414 100644 --- a/sys/dev/dpt/dpt.h +++ b/sys/dev/dpt/dpt.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997 by Simon Shapiro * All Rights Reserved * diff --git a/sys/dev/dpt/dpt_scsi.c b/sys/dev/dpt/dpt_scsi.c index 59256872916f..db2f7b06603c 100644 --- a/sys/dev/dpt/dpt_scsi.c +++ b/sys/dev/dpt/dpt_scsi.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997 by Simon Shapiro * All Rights Reserved * diff --git a/sys/dev/drm/ati_pcigart.h b/sys/dev/drm/ati_pcigart.h index dd1141f5303a..0bdb3363313b 100644 --- a/sys/dev/drm/ati_pcigart.h +++ b/sys/dev/drm/ati_pcigart.h @@ -1,6 +1,6 @@ /* ati_pcigart.h -- ATI PCI GART support -*- linux-c -*- - * Created: Wed Dec 13 21:52:19 2000 by gareth@valinux.com - * + * Created: Wed Dec 13 21:52:19 2000 by gareth@valinux.com */ +/*- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * diff --git a/sys/dev/drm/drm.h b/sys/dev/drm/drm.h index 36e86b364e1a..167578308eb3 100644 --- a/sys/dev/drm/drm.h +++ b/sys/dev/drm/drm.h @@ -8,7 +8,7 @@ * Dec 1999, Richard Henderson , move to generic \c cmpxchg. */ -/* +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. diff --git a/sys/dev/drm/drmP.h b/sys/dev/drm/drmP.h index e45bad4fda9a..c30ab875a8b8 100644 --- a/sys/dev/drm/drmP.h +++ b/sys/dev/drm/drmP.h @@ -1,6 +1,6 @@ /* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*- - * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com - * + * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. diff --git a/sys/dev/drm/drm_agpsupport.h b/sys/dev/drm/drm_agpsupport.h index fc2f4d1e5663..4758a88e9d3c 100644 --- a/sys/dev/drm/drm_agpsupport.h +++ b/sys/dev/drm/drm_agpsupport.h @@ -1,6 +1,6 @@ /* drm_agpsupport.h -- DRM support for AGP/GART backend -*- linux-c -*- - * Created: Mon Dec 13 09:56:45 1999 by faith@precisioninsight.com - * + * Created: Mon Dec 13 09:56:45 1999 by faith@precisioninsight.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/drm_auth.h b/sys/dev/drm/drm_auth.h index 9141d5778b06..faa3ffcb0234 100644 --- a/sys/dev/drm/drm_auth.h +++ b/sys/dev/drm/drm_auth.h @@ -1,6 +1,6 @@ /* drm_auth.h -- IOCTLs for authentication -*- linux-c -*- - * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com - * + * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/drm_bufs.h b/sys/dev/drm/drm_bufs.h index 8b40f9847430..841fb1360da0 100644 --- a/sys/dev/drm/drm_bufs.h +++ b/sys/dev/drm/drm_bufs.h @@ -1,6 +1,6 @@ /* drm_bufs.h -- Generic buffer template -*- linux-c -*- - * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com - * + * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com */ +/*- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/drm_context.h b/sys/dev/drm/drm_context.h index 9d832641fb7d..177bd5967399 100644 --- a/sys/dev/drm/drm_context.h +++ b/sys/dev/drm/drm_context.h @@ -1,6 +1,6 @@ /* drm_context.h -- IOCTLs for generic contexts -*- linux-c -*- - * Created: Fri Nov 24 18:31:37 2000 by gareth@valinux.com - * + * Created: Fri Nov 24 18:31:37 2000 by gareth@valinux.com */ +/*- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/drm_dma.h b/sys/dev/drm/drm_dma.h index 7cf3d174653d..9a0f2aa27062 100644 --- a/sys/dev/drm/drm_dma.h +++ b/sys/dev/drm/drm_dma.h @@ -1,6 +1,6 @@ /* drm_dma.c -- DMA IOCTL and function support -*- linux-c -*- - * Created: Fri Mar 19 14:30:16 1999 by faith@valinux.com - * + * Created: Fri Mar 19 14:30:16 1999 by faith@valinux.com */ +/*- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/drm_drawable.h b/sys/dev/drm/drm_drawable.h index 7f3938d62090..d7381f17b110 100644 --- a/sys/dev/drm/drm_drawable.h +++ b/sys/dev/drm/drm_drawable.h @@ -1,6 +1,6 @@ /* drm_drawable.h -- IOCTLs for drawables -*- linux-c -*- - * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com - * + * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/drm_drv.h b/sys/dev/drm/drm_drv.h index 1227296eb6ac..59bf0c83dc6c 100644 --- a/sys/dev/drm/drm_drv.h +++ b/sys/dev/drm/drm_drv.h @@ -1,6 +1,6 @@ /* drm_drv.h -- Generic driver template -*- linux-c -*- - * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com - * + * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com */ +/*- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/drm_fops.h b/sys/dev/drm/drm_fops.h index 4c79fe117237..0e4b24c97297 100644 --- a/sys/dev/drm/drm_fops.h +++ b/sys/dev/drm/drm_fops.h @@ -1,6 +1,6 @@ /* drm_fops.h -- File operations for DRM -*- linux-c -*- - * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com - * + * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/drm_ioctl.h b/sys/dev/drm/drm_ioctl.h index d34851937721..e04e47bd0609 100644 --- a/sys/dev/drm/drm_ioctl.h +++ b/sys/dev/drm/drm_ioctl.h @@ -1,6 +1,6 @@ /* drm_ioctl.h -- IOCTL processing for DRM -*- linux-c -*- - * Created: Fri Jan 8 09:01:26 1999 by faith@valinux.com - * + * Created: Fri Jan 8 09:01:26 1999 by faith@valinux.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/drm_irq.h b/sys/dev/drm/drm_irq.h index 8f7d747f4799..89f5cda6b745 100644 --- a/sys/dev/drm/drm_irq.h +++ b/sys/dev/drm/drm_irq.h @@ -1,6 +1,6 @@ /* drm_dma.c -- DMA IOCTL and function support - * Created: Fri Oct 18 2003 by anholt@FreeBSD.org - * + * Created: Fri Oct 18 2003 by anholt@FreeBSD.org */ +/*- * Copyright 2003 Eric Anholt * All Rights Reserved. * diff --git a/sys/dev/drm/drm_linux_list.h b/sys/dev/drm/drm_linux_list.h index 4fef61c528b6..12de8233f150 100644 --- a/sys/dev/drm/drm_linux_list.h +++ b/sys/dev/drm/drm_linux_list.h @@ -1,6 +1,6 @@ /* drm_linux_list.h -- linux list functions for the BSDs. - * Created: Mon Apr 7 14:30:16 1999 by anholt@FreeBSD.org - * + * Created: Mon Apr 7 14:30:16 1999 by anholt@FreeBSD.org */ +/*- * Copyright 2003 Eric Anholt * All Rights Reserved. * diff --git a/sys/dev/drm/drm_lock.h b/sys/dev/drm/drm_lock.h index f0937076e552..bcdcbfe3dc05 100644 --- a/sys/dev/drm/drm_lock.h +++ b/sys/dev/drm/drm_lock.h @@ -1,6 +1,6 @@ /* lock.c -- IOCTLs for locking -*- linux-c -*- - * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com - * + * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/drm_memory.h b/sys/dev/drm/drm_memory.h index 917cb1e15e7a..1bf0e8e1470f 100644 --- a/sys/dev/drm/drm_memory.h +++ b/sys/dev/drm/drm_memory.h @@ -1,6 +1,6 @@ /* drm_memory.h -- Memory management wrappers for DRM -*- linux-c -*- - * Created: Thu Feb 4 14:00:34 1999 by faith@valinux.com - * + * Created: Thu Feb 4 14:00:34 1999 by faith@valinux.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/drm_memory_debug.h b/sys/dev/drm/drm_memory_debug.h index a627fb4281de..1ce7ffe403c6 100644 --- a/sys/dev/drm/drm_memory_debug.h +++ b/sys/dev/drm/drm_memory_debug.h @@ -1,6 +1,6 @@ /* drm_memory.h -- Memory management wrappers for DRM -*- linux-c -*- - * Created: Thu Feb 4 14:00:34 1999 by faith@valinux.com - * + * Created: Thu Feb 4 14:00:34 1999 by faith@valinux.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/drm_os_freebsd.h b/sys/dev/drm/drm_os_freebsd.h index a9a7308ccd3d..c2fafad2fc32 100644 --- a/sys/dev/drm/drm_os_freebsd.h +++ b/sys/dev/drm/drm_os_freebsd.h @@ -5,7 +5,7 @@ * \author Eric Anholt */ -/* +/*- * Copyright 2003 Eric Anholt * All Rights Reserved. * diff --git a/sys/dev/drm/drm_pci.h b/sys/dev/drm/drm_pci.h index 2a0569d06d0c..12add61778e5 100644 --- a/sys/dev/drm/drm_pci.h +++ b/sys/dev/drm/drm_pci.h @@ -5,7 +5,7 @@ * \author Eric Anholt */ -/* +/*- * Copyright 2003 Eric Anholt. * All Rights Reserved. * diff --git a/sys/dev/drm/drm_sarea.h b/sys/dev/drm/drm_sarea.h index 45bef824e7cc..cee32192f0b3 100644 --- a/sys/dev/drm/drm_sarea.h +++ b/sys/dev/drm/drm_sarea.h @@ -5,7 +5,7 @@ * \author Michel D�zer */ -/* +/*- * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * diff --git a/sys/dev/drm/drm_scatter.h b/sys/dev/drm/drm_scatter.h index 4da0a1b6f1ca..a67f1c62d95c 100644 --- a/sys/dev/drm/drm_scatter.h +++ b/sys/dev/drm/drm_scatter.h @@ -1,6 +1,6 @@ /* drm_scatter.h -- IOCTLs to manage scatter/gather memory -*- linux-c -*- - * Created: Mon Dec 18 23:20:54 2000 by gareth@valinux.com - * + * Created: Mon Dec 18 23:20:54 2000 by gareth@valinux.com */ +/*- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * diff --git a/sys/dev/drm/drm_sysctl.h b/sys/dev/drm/drm_sysctl.h index c7e6eef980a1..64b3408e9ca1 100644 --- a/sys/dev/drm/drm_sysctl.h +++ b/sys/dev/drm/drm_sysctl.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright 2003 Eric Anholt * All Rights Reserved. * diff --git a/sys/dev/drm/drm_vm.h b/sys/dev/drm/drm_vm.h index 2637a83998ed..23a6de74a47a 100644 --- a/sys/dev/drm/drm_vm.h +++ b/sys/dev/drm/drm_vm.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright 2003 Eric Anholt * All Rights Reserved. * diff --git a/sys/dev/drm/mga.h b/sys/dev/drm/mga.h index 74a98ac40ef4..6f463c31c8b4 100644 --- a/sys/dev/drm/mga.h +++ b/sys/dev/drm/mga.h @@ -1,6 +1,6 @@ /* mga.h -- Matrox G200/G400 DRM template customization -*- linux-c -*- - * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com - * + * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com */ +/*- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * diff --git a/sys/dev/drm/mga_dma.c b/sys/dev/drm/mga_dma.c index 3f75d7663f2a..57db72d6dad6 100644 --- a/sys/dev/drm/mga_dma.c +++ b/sys/dev/drm/mga_dma.c @@ -1,6 +1,6 @@ /* mga_dma.c -- DMA support for mga g200/g400 -*- linux-c -*- - * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com - * + * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/mga_drm.h b/sys/dev/drm/mga_drm.h index 57ecc16c5719..fb851a9890bc 100644 --- a/sys/dev/drm/mga_drm.h +++ b/sys/dev/drm/mga_drm.h @@ -1,6 +1,6 @@ /* mga_drm.h -- Public header for the Matrox g200/g400 driver -*- linux-c -*- - * Created: Tue Jan 25 01:50:01 1999 by jhartmann@precisioninsight.com - * + * Created: Tue Jan 25 01:50:01 1999 by jhartmann@precisioninsight.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. diff --git a/sys/dev/drm/mga_drv.c b/sys/dev/drm/mga_drv.c index cbec2999beb5..6de110a04e98 100644 --- a/sys/dev/drm/mga_drv.c +++ b/sys/dev/drm/mga_drv.c @@ -1,6 +1,6 @@ /* mga_drv.c -- Matrox G200/G400 driver -*- linux-c -*- - * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com - * + * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/mga_drv.h b/sys/dev/drm/mga_drv.h index c84c9ea5b963..b4f333a6c09d 100644 --- a/sys/dev/drm/mga_drv.h +++ b/sys/dev/drm/mga_drv.h @@ -1,6 +1,6 @@ /* mga_drv.h -- Private header for the Matrox G200/G400 driver -*- linux-c -*- - * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com - * + * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. diff --git a/sys/dev/drm/mga_irq.c b/sys/dev/drm/mga_irq.c index 1c9a93f5940a..82a2705add19 100644 --- a/sys/dev/drm/mga_irq.c +++ b/sys/dev/drm/mga_irq.c @@ -1,5 +1,5 @@ -/* mga_irq.c -- IRQ handling for radeon -*- linux-c -*- - * +/* mga_irq.c -- IRQ handling for radeon -*- linux-c -*- */ +/*- * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. * * The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/sys/dev/drm/mga_state.c b/sys/dev/drm/mga_state.c index b4a7d6f07d9f..8e72f2200f67 100644 --- a/sys/dev/drm/mga_state.c +++ b/sys/dev/drm/mga_state.c @@ -1,6 +1,6 @@ /* mga_state.c -- State support for MGA G200/G400 -*- linux-c -*- - * Created: Thu Jan 27 02:53:43 2000 by jhartmann@precisioninsight.com - * + * Created: Thu Jan 27 02:53:43 2000 by jhartmann@precisioninsight.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/mga_ucode.h b/sys/dev/drm/mga_ucode.h index 3dd85e3bea2f..575166e96d24 100644 --- a/sys/dev/drm/mga_ucode.h +++ b/sys/dev/drm/mga_ucode.h @@ -1,6 +1,6 @@ /* mga_ucode.h -- Matrox G200/G400 WARP engine microcode -*- linux-c -*- - * Created: Thu Jan 11 21:20:43 2001 by gareth@valinux.com - * + * Created: Thu Jan 11 21:20:43 2001 by gareth@valinux.com */ +/*- * Copyright 1999 Matrox Graphics Inc. * All Rights Reserved. * diff --git a/sys/dev/drm/mga_warp.c b/sys/dev/drm/mga_warp.c index 035d04589add..db292dd69bdd 100644 --- a/sys/dev/drm/mga_warp.c +++ b/sys/dev/drm/mga_warp.c @@ -1,6 +1,6 @@ /* mga_warp.c -- Matrox G200/G400 WARP engine management -*- linux-c -*- - * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com - * + * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com */ +/*- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * diff --git a/sys/dev/drm/r128.h b/sys/dev/drm/r128.h index 3a22671f3724..0b0fc928b181 100644 --- a/sys/dev/drm/r128.h +++ b/sys/dev/drm/r128.h @@ -1,6 +1,6 @@ /* r128.h -- ATI Rage 128 DRM template customization -*- linux-c -*- - * Created: Wed Feb 14 16:07:10 2001 by gareth@valinux.com - * + * Created: Wed Feb 14 16:07:10 2001 by gareth@valinux.com */ +/*- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * diff --git a/sys/dev/drm/r128_cce.c b/sys/dev/drm/r128_cce.c index e7160bd9a5da..75a3c3015337 100644 --- a/sys/dev/drm/r128_cce.c +++ b/sys/dev/drm/r128_cce.c @@ -1,6 +1,6 @@ /* r128_cce.c -- ATI Rage 128 driver -*- linux-c -*- - * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com - * + * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com */ +/*- * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/r128_drm.h b/sys/dev/drm/r128_drm.h index 30b8b3eaf548..32a58daa13b0 100644 --- a/sys/dev/drm/r128_drm.h +++ b/sys/dev/drm/r128_drm.h @@ -1,6 +1,6 @@ /* r128_drm.h -- Public header for the r128 driver -*- linux-c -*- - * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com - * + * Created: Wed Apr 5 19:24:19 2000 by kevin@precisioninsight.com */ +/*- * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. diff --git a/sys/dev/drm/r128_drv.c b/sys/dev/drm/r128_drv.c index b9df5ecf9708..16035fccd747 100644 --- a/sys/dev/drm/r128_drv.c +++ b/sys/dev/drm/r128_drv.c @@ -1,6 +1,6 @@ /* r128_drv.c -- ATI Rage 128 driver -*- linux-c -*- - * Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com - * + * Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/r128_drv.h b/sys/dev/drm/r128_drv.h index 0695684c1db2..8d8f87794330 100644 --- a/sys/dev/drm/r128_drv.h +++ b/sys/dev/drm/r128_drv.h @@ -1,6 +1,6 @@ /* r128_drv.h -- Private header for r128 driver -*- linux-c -*- - * Created: Mon Dec 13 09:51:11 1999 by faith@precisioninsight.com - * + * Created: Mon Dec 13 09:51:11 1999 by faith@precisioninsight.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. diff --git a/sys/dev/drm/r128_irq.c b/sys/dev/drm/r128_irq.c index 2da58d61b4bf..fa3fb43f3cfe 100644 --- a/sys/dev/drm/r128_irq.c +++ b/sys/dev/drm/r128_irq.c @@ -1,5 +1,5 @@ -/* r128_irq.c -- IRQ handling for radeon -*- linux-c -*- - * +/* r128_irq.c -- IRQ handling for radeon -*- linux-c -*- */ +/*- * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. * * The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/sys/dev/drm/r128_state.c b/sys/dev/drm/r128_state.c index 703d5508e42e..5286e29c606f 100644 --- a/sys/dev/drm/r128_state.c +++ b/sys/dev/drm/r128_state.c @@ -1,6 +1,6 @@ /* r128_state.c -- State support for r128 -*- linux-c -*- - * Created: Thu Jan 27 02:53:43 2000 by gareth@valinux.com - * + * Created: Thu Jan 27 02:53:43 2000 by gareth@valinux.com */ +/*- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * diff --git a/sys/dev/drm/radeon.h b/sys/dev/drm/radeon.h index 517d9d27cccf..f7f9708c07b4 100644 --- a/sys/dev/drm/radeon.h +++ b/sys/dev/drm/radeon.h @@ -1,6 +1,6 @@ /* radeon.h -- ATI Radeon DRM template customization -*- linux-c -*- - * Created: Wed Feb 14 17:07:34 2001 by gareth@valinux.com - * + * Created: Wed Feb 14 17:07:34 2001 by gareth@valinux.com */ +/*- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * diff --git a/sys/dev/drm/radeon_cp.c b/sys/dev/drm/radeon_cp.c index 59cd9ff58b01..2418f803a871 100644 --- a/sys/dev/drm/radeon_cp.c +++ b/sys/dev/drm/radeon_cp.c @@ -1,5 +1,5 @@ -/* radeon_cp.c -- CP support for Radeon -*- linux-c -*- - * +/* radeon_cp.c -- CP support for Radeon -*- linux-c -*- */ +/*- * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Fremont, California. * All Rights Reserved. diff --git a/sys/dev/drm/radeon_drm.h b/sys/dev/drm/radeon_drm.h index 51bbacfbf424..b0e59aa620a8 100644 --- a/sys/dev/drm/radeon_drm.h +++ b/sys/dev/drm/radeon_drm.h @@ -1,5 +1,5 @@ -/* radeon_drm.h -- Public header for the radeon driver -*- linux-c -*- - * +/* radeon_drm.h -- Public header for the radeon driver -*- linux-c -*- */ +/*- * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Fremont, California. * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas. diff --git a/sys/dev/drm/radeon_drv.c b/sys/dev/drm/radeon_drv.c index 37dcc2bcf7ac..ca94080d2696 100644 --- a/sys/dev/drm/radeon_drv.c +++ b/sys/dev/drm/radeon_drv.c @@ -1,6 +1,6 @@ /* radeon_drv.c -- ATI Radeon driver -*- linux-c -*- - * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com - * + * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com */ +/*- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * diff --git a/sys/dev/drm/radeon_drv.h b/sys/dev/drm/radeon_drv.h index d14d34204afd..ab694dec9f8a 100644 --- a/sys/dev/drm/radeon_drv.h +++ b/sys/dev/drm/radeon_drv.h @@ -1,5 +1,5 @@ -/* radeon_drv.h -- Private header for radeon driver -*- linux-c -*- - * +/* radeon_drv.h -- Private header for radeon driver -*- linux-c -*- */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Fremont, California. * All rights reserved. diff --git a/sys/dev/drm/radeon_irq.c b/sys/dev/drm/radeon_irq.c index 636653c2ae1e..2d600a4e51c1 100644 --- a/sys/dev/drm/radeon_irq.c +++ b/sys/dev/drm/radeon_irq.c @@ -1,5 +1,5 @@ -/* radeon_irq.c -- IRQ handling for radeon -*- linux-c -*- - * +/* radeon_irq.c -- IRQ handling for radeon -*- linux-c -*- */ +/*- * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. * * The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/sys/dev/drm/radeon_mem.c b/sys/dev/drm/radeon_mem.c index 3238c2717a27..472b21f1e92c 100644 --- a/sys/dev/drm/radeon_mem.c +++ b/sys/dev/drm/radeon_mem.c @@ -1,5 +1,5 @@ -/* radeon_mem.c -- Simple GART/fb memory manager for radeon -*- linux-c -*- - * +/* radeon_mem.c -- Simple GART/fb memory manager for radeon -*- linux-c -*- */ +/*- * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. * * The Weather Channel (TM) funded Tungsten Graphics to develop the diff --git a/sys/dev/drm/radeon_state.c b/sys/dev/drm/radeon_state.c index 950a8eec2df2..e1227705e6a6 100644 --- a/sys/dev/drm/radeon_state.c +++ b/sys/dev/drm/radeon_state.c @@ -1,5 +1,5 @@ /* radeon_state.c -- State support for Radeon -*- linux-c -*- - * +/*- * Copyright 2000 VA Linux Systems, Inc., Fremont, California. * All Rights Reserved. * diff --git a/sys/dev/drm/sis.h b/sys/dev/drm/sis.h index 03498183f2e7..dde5d9555195 100644 --- a/sys/dev/drm/sis.h +++ b/sys/dev/drm/sis.h @@ -1,5 +1,5 @@ -/* sis_drv.h -- Private header for sis driver -*- linux-c -*- - * +/* sis_drv.h -- Private header for sis driver -*- linux-c -*- */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. diff --git a/sys/dev/drm/sis_drv.c b/sys/dev/drm/sis_drv.c index ae6615b912aa..5009f9d940bf 100644 --- a/sys/dev/drm/sis_drv.c +++ b/sys/dev/drm/sis_drv.c @@ -1,5 +1,5 @@ -/* sis.c -- sis driver -*- linux-c -*- - * +/* sis.c -- sis driver -*- linux-c -*- */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/drm/sis_drv.h b/sys/dev/drm/sis_drv.h index 3f80901bb171..156e2b24787e 100644 --- a/sys/dev/drm/sis_drv.h +++ b/sys/dev/drm/sis_drv.h @@ -1,5 +1,5 @@ -/* sis_drv.h -- Private header for sis driver -*- linux-c -*- - * +/* sis_drv.h -- Private header for sis driver -*- linux-c -*- */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. diff --git a/sys/dev/drm/sis_ds.c b/sys/dev/drm/sis_ds.c index 74b111e33750..cf837a7e504c 100644 --- a/sys/dev/drm/sis_ds.c +++ b/sys/dev/drm/sis_ds.c @@ -1,6 +1,6 @@ /* sis_ds.c -- Private header for Direct Rendering Manager -*- linux-c -*- - * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw - * + * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw */ +/*- * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. * All rights reserved. * diff --git a/sys/dev/drm/sis_ds.h b/sys/dev/drm/sis_ds.h index d5cdbc27800a..ce9535bf926d 100644 --- a/sys/dev/drm/sis_ds.h +++ b/sys/dev/drm/sis_ds.h @@ -1,6 +1,6 @@ /* sis_ds.h -- Private header for Direct Rendering Manager -*- linux-c -*- - * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw - * + * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw */ +/*- * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. * All rights reserved. * diff --git a/sys/dev/drm/sis_mm.c b/sys/dev/drm/sis_mm.c index 6f29974ee082..6ff18e5d8c09 100644 --- a/sys/dev/drm/sis_mm.c +++ b/sys/dev/drm/sis_mm.c @@ -1,6 +1,6 @@ /* sis_mm.c -- Private header for Direct Rendering Manager -*- linux-c -*- - * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw - * + * Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw * +/*- * Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. * All rights reserved. * diff --git a/sys/dev/drm/tdfx.h b/sys/dev/drm/tdfx.h index cc2b72035c8b..9a8cf720e851 100644 --- a/sys/dev/drm/tdfx.h +++ b/sys/dev/drm/tdfx.h @@ -1,6 +1,6 @@ /* tdfx.h -- 3dfx DRM template customization -*- linux-c -*- - * Created: Wed Feb 14 12:32:32 2001 by gareth@valinux.com - * + * Created: Wed Feb 14 12:32:32 2001 by gareth@valinux.com */ +/*- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * diff --git a/sys/dev/drm/tdfx_drv.c b/sys/dev/drm/tdfx_drv.c index 93083fdeea23..4985ee05762b 100644 --- a/sys/dev/drm/tdfx_drv.c +++ b/sys/dev/drm/tdfx_drv.c @@ -1,6 +1,6 @@ /* tdfx_drv.c -- tdfx driver -*- linux-c -*- - * Created: Thu Oct 7 10:38:32 1999 by faith@precisioninsight.com - * + * Created: Thu Oct 7 10:38:32 1999 by faith@precisioninsight.com */ +/*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index 5f441e6a97c2..28fe83779964 100644 --- a/sys/dev/ed/if_ed.c +++ b/sys/dev/ed/if_ed.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, David Greenman * All rights reserved. * diff --git a/sys/dev/ed/if_ed98.h b/sys/dev/ed/if_ed98.h index 22bbf78be0e6..2a2af0498cca 100644 --- a/sys/dev/ed/if_ed98.h +++ b/sys/dev/ed/if_ed98.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) KATO Takenori, 1996. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ed/if_ed_cbus.c b/sys/dev/ed/if_ed_cbus.c index 0b9a1220b9c7..1f8424355c1f 100644 --- a/sys/dev/ed/if_ed_cbus.c +++ b/sys/dev/ed/if_ed_cbus.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, David Greenman * All rights reserved. * diff --git a/sys/dev/ed/if_ed_isa.c b/sys/dev/ed/if_ed_isa.c index 69da715f2646..3a5804c8dcdd 100644 --- a/sys/dev/ed/if_ed_isa.c +++ b/sys/dev/ed/if_ed_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, David Greenman * All rights reserved. * diff --git a/sys/dev/ed/if_ed_pccard.c b/sys/dev/ed/if_ed_pccard.c index dfe71fa12de6..b9f75e77dcb2 100644 --- a/sys/dev/ed/if_ed_pccard.c +++ b/sys/dev/ed/if_ed_pccard.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, David Greenman * All rights reserved. * diff --git a/sys/dev/ed/if_edreg.h b/sys/dev/ed/if_edreg.h index 4b0857894ce9..cfe5b7053142 100644 --- a/sys/dev/ed/if_edreg.h +++ b/sys/dev/ed/if_edreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 1993, David Greenman. This software may be used, modified, * copied, distributed, and sold, in both source and binary form provided * that the above copyright and these terms are retained. Under no diff --git a/sys/dev/ed/if_edvar.h b/sys/dev/ed/if_edvar.h index fd3bcf1cf169..d8da2fcc816d 100644 --- a/sys/dev/ed/if_edvar.h +++ b/sys/dev/ed/if_edvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, David Greenman * All rights reserved. * diff --git a/sys/dev/eisa/eisa_if.m b/sys/dev/eisa/eisa_if.m index 9bf7e56bb542..72c8184cdce5 100644 --- a/sys/dev/eisa/eisa_if.m +++ b/sys/dev/eisa/eisa_if.m @@ -1,4 +1,4 @@ -# +#- # Copyright (c) 2004 M. Warner Losh # All rights reserved. # diff --git a/sys/dev/eisa/eisaconf.c b/sys/dev/eisa/eisaconf.c index 2ef026561aeb..b9c77f5b5c60 100644 --- a/sys/dev/eisa/eisaconf.c +++ b/sys/dev/eisa/eisaconf.c @@ -1,4 +1,4 @@ -/* +/*- * EISA bus probe and attach routines * * Copyright (c) 1995, 1996 Justin T. Gibbs. diff --git a/sys/dev/eisa/eisaconf.h b/sys/dev/eisa/eisaconf.h index ebdee5a6cdd6..522cd5db59e1 100644 --- a/sys/dev/eisa/eisaconf.h +++ b/sys/dev/eisa/eisaconf.h @@ -1,4 +1,4 @@ -/* +/*- * EISA bus device definitions * * Copyright (c) 1995, 1996 Justin T. Gibbs. diff --git a/sys/dev/em/LICENSE b/sys/dev/em/LICENSE index de8145e47a90..42545ca85f97 100644 --- a/sys/dev/em/LICENSE +++ b/sys/dev/em/LICENSE @@ -1,4 +1,5 @@ $FreeBSD$ +/*- Copyright (c) 2001-2003, Intel Corporation All rights reserved. @@ -27,3 +28,4 @@ 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. +*/ diff --git a/sys/dev/en/if_en_pci.c b/sys/dev/en/if_en_pci.c index 1ca6e35a2ed0..1aaf76108b82 100644 --- a/sys/dev/en/if_en_pci.c +++ b/sys/dev/en/if_en_pci.c @@ -1,6 +1,5 @@ /* $NetBSD: if_en_pci.c,v 1.1 1996/06/22 02:00:31 chuck Exp $ */ -/* - * +/*- * Copyright (c) 1996 Charles D. Cranor and Washington University. * All rights reserved. * diff --git a/sys/dev/en/midway.c b/sys/dev/en/midway.c index 33108381ec81..265b60ea7833 100644 --- a/sys/dev/en/midway.c +++ b/sys/dev/en/midway.c @@ -1,8 +1,7 @@ /* $NetBSD: midway.c,v 1.30 1997/09/29 17:40:38 chuck Exp $ */ /* (sync'd to midway.c 1.68) */ -/* - * +/*- * Copyright (c) 1996 Charles D. Cranor and Washington University. * All rights reserved. * diff --git a/sys/dev/en/midwayvar.h b/sys/dev/en/midwayvar.h index 27da2f57aed2..27e047deffef 100644 --- a/sys/dev/en/midwayvar.h +++ b/sys/dev/en/midwayvar.h @@ -1,7 +1,6 @@ /* $NetBSD: midwayvar.h,v 1.10 1997/03/20 21:34:46 chuck Exp $ */ -/* - * +/*- * Copyright (c) 1996 Charles D. Cranor and Washington University. * All rights reserved. * diff --git a/sys/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c index 60197577cafe..7cb257321e9d 100644 --- a/sys/dev/ep/if_ep.c +++ b/sys/dev/ep/if_ep.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1994 Herb Peyerl * All rights reserved. * diff --git a/sys/dev/ep/if_ep_eisa.c b/sys/dev/ep/if_ep_eisa.c index 9d1e6030d3f7..efe49cf25751 100644 --- a/sys/dev/ep/if_ep_eisa.c +++ b/sys/dev/ep/if_ep_eisa.c @@ -1,4 +1,4 @@ -/* +/*- * Product specific probe and attach routines for: * 3COM 3C579 and 3C509(in eisa config mode) ethernet controllers * diff --git a/sys/dev/ep/if_ep_isa.c b/sys/dev/ep/if_ep_isa.c index 5bc38bc5d1f3..bd9c5c25a313 100644 --- a/sys/dev/ep/if_ep_isa.c +++ b/sys/dev/ep/if_ep_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1994 Herb Peyerl * All rights reserved. * diff --git a/sys/dev/ep/if_ep_pccard.c b/sys/dev/ep/if_ep_pccard.c index 021b504e1761..5101a176a105 100644 --- a/sys/dev/ep/if_ep_pccard.c +++ b/sys/dev/ep/if_ep_pccard.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1994 Herb Peyerl * All rights reserved. * diff --git a/sys/dev/ep/if_epreg.h b/sys/dev/ep/if_epreg.h index acc8f79f0fd0..6f8e968802bd 100644 --- a/sys/dev/ep/if_epreg.h +++ b/sys/dev/ep/if_epreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ep/if_epvar.h b/sys/dev/ep/if_epvar.h index 242ccd46569d..6ba7bf4c6af6 100644 --- a/sys/dev/ep/if_epvar.h +++ b/sys/dev/ep/if_epvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/esp/ncr53c9x.c b/sys/dev/esp/ncr53c9x.c index 48686110f30c..a222f3e366a8 100644 --- a/sys/dev/esp/ncr53c9x.c +++ b/sys/dev/esp/ncr53c9x.c @@ -63,7 +63,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Copyright (c) 1994 Peter Galbavy * Copyright (c) 1995 Paul Kranenburg * All rights reserved. diff --git a/sys/dev/esp/ncr53c9xreg.h b/sys/dev/esp/ncr53c9xreg.h index b4ba1e81f5e3..d85cb452a46a 100644 --- a/sys/dev/esp/ncr53c9xreg.h +++ b/sys/dev/esp/ncr53c9xreg.h @@ -1,6 +1,6 @@ /* $NetBSD: ncr53c9xreg.h,v 1.11 2003/02/21 17:14:05 tsutsui Exp $ */ -/* +/*- * Copyright (c) 1994 Peter Galbavy. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/esp/ncr53c9xvar.h b/sys/dev/esp/ncr53c9xvar.h index 7bf6b2d737de..f8be39edd40e 100644 --- a/sys/dev/esp/ncr53c9xvar.h +++ b/sys/dev/esp/ncr53c9xvar.h @@ -37,7 +37,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Copyright (c) 1994 Peter Galbavy. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ex/if_ex.c b/sys/dev/ex/if_ex.c index 7218529b4ffb..33598ba0a155 100644 --- a/sys/dev/ex/if_ex.c +++ b/sys/dev/ex/if_ex.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996, Javier Martín Rueda (jmrueda@diatel.upm.es) * All rights reserved. * diff --git a/sys/dev/ex/if_exreg.h b/sys/dev/ex/if_exreg.h index a924c2822efa..157eda37298c 100644 --- a/sys/dev/ex/if_exreg.h +++ b/sys/dev/ex/if_exreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996, Javier Martín Rueda (jmrueda@diatel.upm.es) * All rights reserved. * diff --git a/sys/dev/exca/exca.c b/sys/dev/exca/exca.c index 5c0e8a4b82d1..2ef4f89681d8 100644 --- a/sys/dev/exca/exca.c +++ b/sys/dev/exca/exca.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2002 M Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/exca/excareg.h b/sys/dev/exca/excareg.h index e2f092aac4dd..094379e79c77 100644 --- a/sys/dev/exca/excareg.h +++ b/sys/dev/exca/excareg.h @@ -1,7 +1,7 @@ /* $NetBSD: i82365reg.h,v 1.3 1998/12/20 17:53:28 nathanw Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2002 M Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/exca/excavar.h b/sys/dev/exca/excavar.h index 147cf1562229..bc29c81a0990 100644 --- a/sys/dev/exca/excavar.h +++ b/sys/dev/exca/excavar.h @@ -1,6 +1,6 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2002 M Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/fatm/firmware.h b/sys/dev/fatm/firmware.h index 6e9caf28deb6..24c7bc8e8865 100644 --- a/sys/dev/fatm/firmware.h +++ b/sys/dev/fatm/firmware.h @@ -1,4 +1,4 @@ -/* +/*- * (Copyright Notice) * * Copyright (c) 1995-2000 FORE Systems, Inc., as an unpublished work. diff --git a/sys/dev/fatm/if_fatm.c b/sys/dev/fatm/if_fatm.c index 8335e929ff7a..35ef8b9fffaf 100644 --- a/sys/dev/fatm/if_fatm.c +++ b/sys/dev/fatm/if_fatm.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001-2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/fatm/if_fatm_rate.h b/sys/dev/fatm/if_fatm_rate.h index 45b885a4f1bf..5cfd38a9c28c 100644 --- a/sys/dev/fatm/if_fatm_rate.h +++ b/sys/dev/fatm/if_fatm_rate.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001-2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/fatm/if_fatmreg.h b/sys/dev/fatm/if_fatmreg.h index 0b4a403d39f9..d488dbfda5bf 100644 --- a/sys/dev/fatm/if_fatmreg.h +++ b/sys/dev/fatm/if_fatmreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001-2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/fatm/if_fatmvar.h b/sys/dev/fatm/if_fatmvar.h index 8919d24b0712..8c550fefdd1d 100644 --- a/sys/dev/fatm/if_fatmvar.h +++ b/sys/dev/fatm/if_fatmvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001-2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/fb/gallant12x22.c b/sys/dev/fb/gallant12x22.c index b26ad34f873c..a089f6a2ec46 100644 --- a/sys/dev/fb/gallant12x22.c +++ b/sys/dev/fb/gallant12x22.c @@ -1,7 +1,7 @@ /* $OpenBSD: gallant12x22.h,v 1.2 2002/05/09 08:59:03 maja Exp $ */ /* $NetBSD: gallant12x22.h,v 1.2 1999/05/18 21:51:58 ad Exp $ */ -/* +/*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/sys/dev/fb/gallant12x22.h b/sys/dev/fb/gallant12x22.h index b26ad34f873c..a089f6a2ec46 100644 --- a/sys/dev/fb/gallant12x22.h +++ b/sys/dev/fb/gallant12x22.h @@ -1,7 +1,7 @@ /* $OpenBSD: gallant12x22.h,v 1.2 2002/05/09 08:59:03 maja Exp $ */ /* $NetBSD: gallant12x22.h,v 1.2 1999/05/18 21:51:58 ad Exp $ */ -/* +/*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/sys/dev/fb/gfb.h b/sys/dev/fb/gfb.h index 470dfc268864..89ead2e3a225 100644 --- a/sys/dev/fb/gfb.h +++ b/sys/dev/fb/gfb.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, 1996 Carnegie-Mellon University. * All rights reserved. * diff --git a/sys/dev/fb/tga.h b/sys/dev/fb/tga.h index 28302485ac54..3616b61bd04c 100644 --- a/sys/dev/fb/tga.h +++ b/sys/dev/fb/tga.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, 1996 Carnegie-Mellon University. * All rights reserved. * diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c index 4713ef4a4356..4cb7da08549a 100644 --- a/sys/dev/fe/if_fe.c +++ b/sys/dev/fe/if_fe.c @@ -1,4 +1,4 @@ -/* +/*- * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 * * This software may be used, modified, copied, distributed, and sold, in diff --git a/sys/dev/fe/if_fe_cbus.c b/sys/dev/fe/if_fe_cbus.c index 6df70ae92eac..b92cc3df9a97 100644 --- a/sys/dev/fe/if_fe_cbus.c +++ b/sys/dev/fe/if_fe_cbus.c @@ -1,4 +1,4 @@ -/* +/*- * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 * * This software may be used, modified, copied, distributed, and sold, in diff --git a/sys/dev/fe/if_fe_isa.c b/sys/dev/fe/if_fe_isa.c index 1856951b4874..b1fa3e01d41c 100644 --- a/sys/dev/fe/if_fe_isa.c +++ b/sys/dev/fe/if_fe_isa.c @@ -1,4 +1,4 @@ -/* +/*- * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 * * This software may be used, modified, copied, distributed, and sold, in diff --git a/sys/dev/fe/if_fe_pccard.c b/sys/dev/fe/if_fe_pccard.c index 49266deeacea..37c600e51370 100644 --- a/sys/dev/fe/if_fe_pccard.c +++ b/sys/dev/fe/if_fe_pccard.c @@ -1,4 +1,4 @@ -/* +/*- * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 * * This software may be used, modified, copied, distributed, and sold, in diff --git a/sys/dev/fe/if_fereg.h b/sys/dev/fe/if_fereg.h index 21da37ab0d26..afc9c5704c58 100644 --- a/sys/dev/fe/if_fereg.h +++ b/sys/dev/fe/if_fereg.h @@ -1,4 +1,4 @@ -/* +/*- * Hardware specification of various 8696x based Ethernet cards. * Contributed by M. Sekiguchi * diff --git a/sys/dev/fe/if_fevar.h b/sys/dev/fe/if_fevar.h index c8fd35579625..99f7184a4a51 100644 --- a/sys/dev/fe/if_fevar.h +++ b/sys/dev/fe/if_fevar.h @@ -1,4 +1,4 @@ -/* +/*- * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 * * This software may be used, modified, copied, distributed, and sold, in diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index 0a4a0dde5734..9636b12ad6e3 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. diff --git a/sys/dev/firewire/firewire.h b/sys/dev/firewire/firewire.h index 04c62873730e..ab34748bec25 100644 --- a/sys/dev/firewire/firewire.h +++ b/sys/dev/firewire/firewire.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. diff --git a/sys/dev/firewire/firewire_phy.h b/sys/dev/firewire/firewire_phy.h index 02cda696ea3f..42feff2d27c8 100644 --- a/sys/dev/firewire/firewire_phy.h +++ b/sys/dev/firewire/firewire_phy.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. * diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 3c44a553adeb..3b991ea65236 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index cffb6369b747..79c74af9fe84 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. diff --git a/sys/dev/firewire/fwdma.c b/sys/dev/firewire/fwdma.c index afb1a09b1155..c64dbe66731a 100644 --- a/sys/dev/firewire/fwdma.c +++ b/sys/dev/firewire/fwdma.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Hidetoshi Shimokawa. All rights reserved. * diff --git a/sys/dev/firewire/fwdma.h b/sys/dev/firewire/fwdma.h index 6bf66c702d6f..3a8278c1c709 100644 --- a/sys/dev/firewire/fwdma.h +++ b/sys/dev/firewire/fwdma.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2003 * Hidetoshi Shimokawa. All rights reserved. * diff --git a/sys/dev/firewire/fwmem.c b/sys/dev/firewire/fwmem.c index 1674405f44f8..4fac8dd06b4d 100644 --- a/sys/dev/firewire/fwmem.c +++ b/sys/dev/firewire/fwmem.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2002-2003 * Hidetoshi Shimokawa. All rights reserved. * diff --git a/sys/dev/firewire/fwmem.h b/sys/dev/firewire/fwmem.h index f8188d10aa25..de717947e844 100644 --- a/sys/dev/firewire/fwmem.h +++ b/sys/dev/firewire/fwmem.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2002-2003 * Hidetoshi Shimokawa. All rights reserved. * diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index ad20edcce359..ddcd05d0bccf 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. diff --git a/sys/dev/firewire/fwohci_pci.c b/sys/dev/firewire/fwohci_pci.c index c3660a6e8305..b38f38bd1721 100644 --- a/sys/dev/firewire/fwohci_pci.c +++ b/sys/dev/firewire/fwohci_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. diff --git a/sys/dev/firewire/fwohcireg.h b/sys/dev/firewire/fwohcireg.h index 9abcb417bc41..39986223c4bf 100644 --- a/sys/dev/firewire/fwohcireg.h +++ b/sys/dev/firewire/fwohcireg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. diff --git a/sys/dev/firewire/fwohcivar.h b/sys/dev/firewire/fwohcivar.h index 014335a1d992..3002b63c0ce4 100644 --- a/sys/dev/firewire/fwohcivar.h +++ b/sys/dev/firewire/fwohcivar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Hidetoshi SHimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi SHimokawa * All rights reserved. diff --git a/sys/dev/firewire/fwphyreg.h b/sys/dev/firewire/fwphyreg.h index f2e77768adf7..77a006ed3c54 100644 --- a/sys/dev/firewire/fwphyreg.h +++ b/sys/dev/firewire/fwphyreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2003 * Hidetoshi Shimokawa. All rights reserved. * diff --git a/sys/dev/firewire/iec13213.h b/sys/dev/firewire/iec13213.h index 5cafc8de34e6..058649fc0cc4 100644 --- a/sys/dev/firewire/iec13213.h +++ b/sys/dev/firewire/iec13213.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. diff --git a/sys/dev/firewire/iec68113.h b/sys/dev/firewire/iec68113.h index 58a8cfe7d9eb..11f3042ff9b0 100644 --- a/sys/dev/firewire/iec68113.h +++ b/sys/dev/firewire/iec68113.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. diff --git a/sys/dev/firewire/if_fwe.c b/sys/dev/firewire/if_fwe.c index a5bdb5b7baf6..34e540b877c9 100644 --- a/sys/dev/firewire/if_fwe.c +++ b/sys/dev/firewire/if_fwe.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2002-2003 * Hidetoshi Shimokawa. All rights reserved. * diff --git a/sys/dev/firewire/if_fwevar.h b/sys/dev/firewire/if_fwevar.h index 97422168621b..805301a1be1e 100644 --- a/sys/dev/firewire/if_fwevar.h +++ b/sys/dev/firewire/if_fwevar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2002-2003 * Hidetoshi Shimokawa. All rights reserved. * diff --git a/sys/dev/firewire/if_fwip.c b/sys/dev/firewire/if_fwip.c index 2c11a253ecbe..23e812a2e76d 100644 --- a/sys/dev/firewire/if_fwip.c +++ b/sys/dev/firewire/if_fwip.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 * Doug Rabson * Copyright (c) 2002-2003 diff --git a/sys/dev/firewire/if_fwipvar.h b/sys/dev/firewire/if_fwipvar.h index fe202180a274..0a9ef244752e 100644 --- a/sys/dev/firewire/if_fwipvar.h +++ b/sys/dev/firewire/if_fwipvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 * Doug Rabson * Copyright (c) 2002-2003 diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index df40877b849f..c2f8e4f23a57 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. diff --git a/sys/dev/firewire/sbp.h b/sys/dev/firewire/sbp.h index 49ec97e0caeb..9f85fab38de5 100644 --- a/sys/dev/firewire/sbp.h +++ b/sys/dev/firewire/sbp.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. diff --git a/sys/dev/firewire/sbp_targ.c b/sys/dev/firewire/sbp_targ.c index c6fea6bcbe50..5267ea3b3532 100644 --- a/sys/dev/firewire/sbp_targ.c +++ b/sys/dev/firewire/sbp_targ.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2003 * Hidetoshi Shimokawa. All rights reserved. * diff --git a/sys/dev/fxp/if_fxpreg.h b/sys/dev/fxp/if_fxpreg.h index 1e8d660e4c6e..b1c8407adabe 100644 --- a/sys/dev/fxp/if_fxpreg.h +++ b/sys/dev/fxp/if_fxpreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, David Greenman * Copyright (c) 2001 Jonathan Lemon * All rights reserved. diff --git a/sys/dev/fxp/if_fxpvar.h b/sys/dev/fxp/if_fxpvar.h index 8168bd308f53..906fea6cb9a4 100644 --- a/sys/dev/fxp/if_fxpvar.h +++ b/sys/dev/fxp/if_fxpvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, David Greenman * All rights reserved. * diff --git a/sys/dev/fxp/rcvbundl.h b/sys/dev/fxp/rcvbundl.h index e97e9aaf5b38..ec9b99bd33aa 100644 --- a/sys/dev/fxp/rcvbundl.h +++ b/sys/dev/fxp/rcvbundl.h @@ -1,4 +1,4 @@ -/* +/*- Copyright (c) 1999-2001, Intel Corporation All rights reserved. diff --git a/sys/dev/gem/if_gem_pci.c b/sys/dev/gem/if_gem_pci.c index 19c0de2628ec..58988900e86f 100644 --- a/sys/dev/gem/if_gem_pci.c +++ b/sys/dev/gem/if_gem_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2001 Eduardo Horvath. * All rights reserved. * diff --git a/sys/dev/gem/if_gemreg.h b/sys/dev/gem/if_gemreg.h index 700c732d0ebc..fecfb152eddd 100644 --- a/sys/dev/gem/if_gemreg.h +++ b/sys/dev/gem/if_gemreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2001 Eduardo Horvath. * All rights reserved. * diff --git a/sys/dev/gem/if_gemvar.h b/sys/dev/gem/if_gemvar.h index d93728e225f9..07d71e11f02e 100644 --- a/sys/dev/gem/if_gemvar.h +++ b/sys/dev/gem/if_gemvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2001 Eduardo Horvath. * All rights reserved. * diff --git a/sys/dev/gfb/gfb_pci.c b/sys/dev/gfb/gfb_pci.c index ba57878d8d04..c58ae0e021e1 100644 --- a/sys/dev/gfb/gfb_pci.c +++ b/sys/dev/gfb/gfb_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, 1996 Carnegie-Mellon University. * All rights reserved. * diff --git a/sys/dev/gfb/gfb_pci.h b/sys/dev/gfb/gfb_pci.h index e0f517e7331a..263b3980c5b8 100644 --- a/sys/dev/gfb/gfb_pci.h +++ b/sys/dev/gfb/gfb_pci.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, 1996 Carnegie-Mellon University. * All rights reserved. * diff --git a/sys/dev/harp/if_harp.c b/sys/dev/harp/if_harp.c index 435b64e293e8..7a0352036e45 100644 --- a/sys/dev/harp/if_harp.c +++ b/sys/dev/harp/if_harp.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/hatm/if_hatm.c b/sys/dev/hatm/if_hatm.c index 823801781bd2..cf5b182cfd2f 100644 --- a/sys/dev/hatm/if_hatm.c +++ b/sys/dev/hatm/if_hatm.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001-2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/hatm/if_hatm_intr.c b/sys/dev/hatm/if_hatm_intr.c index 2dbfc693e038..70bbde89a531 100644 --- a/sys/dev/hatm/if_hatm_intr.c +++ b/sys/dev/hatm/if_hatm_intr.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001-2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/hatm/if_hatm_ioctl.c b/sys/dev/hatm/if_hatm_ioctl.c index 410be9db4733..c81027911505 100644 --- a/sys/dev/hatm/if_hatm_ioctl.c +++ b/sys/dev/hatm/if_hatm_ioctl.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001-2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/hatm/if_hatm_rx.c b/sys/dev/hatm/if_hatm_rx.c index fb80f81bb673..1b3ee8d437cc 100644 --- a/sys/dev/hatm/if_hatm_rx.c +++ b/sys/dev/hatm/if_hatm_rx.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001-2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/hatm/if_hatm_tx.c b/sys/dev/hatm/if_hatm_tx.c index a7c2452431ff..b084b9e17ecf 100644 --- a/sys/dev/hatm/if_hatm_tx.c +++ b/sys/dev/hatm/if_hatm_tx.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001-2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/hatm/if_hatmconf.h b/sys/dev/hatm/if_hatmconf.h index 9d2d794c1339..5402697410d7 100644 --- a/sys/dev/hatm/if_hatmconf.h +++ b/sys/dev/hatm/if_hatmconf.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001-2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/hatm/if_hatmreg.h b/sys/dev/hatm/if_hatmreg.h index 7e88a5c61e5a..9085f07f5a4b 100644 --- a/sys/dev/hatm/if_hatmreg.h +++ b/sys/dev/hatm/if_hatmreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001-2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/hatm/if_hatmvar.h b/sys/dev/hatm/if_hatmvar.h index 2ca6f9473031..acddaa1e3555 100644 --- a/sys/dev/hatm/if_hatmvar.h +++ b/sys/dev/hatm/if_hatmvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001-2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/hfa/fore.h b/sys/dev/hfa/fore.h index 5b64c31864ae..8f0a17f58a9c 100644 --- a/sys/dev/hfa/fore.h +++ b/sys/dev/hfa/fore.h @@ -1,4 +1,4 @@ -/* +/*- * * =================================== * HARP | Host ATM Research Platform diff --git a/sys/dev/hfa/fore_aali.h b/sys/dev/hfa/fore_aali.h index 3e00a941072f..93fbf5d587e2 100644 --- a/sys/dev/hfa/fore_aali.h +++ b/sys/dev/hfa/fore_aali.h @@ -1,4 +1,4 @@ -/* +/*- * * =================================== * HARP | Host ATM Research Platform diff --git a/sys/dev/hfa/fore_command.c b/sys/dev/hfa/fore_command.c index 84b36808445e..c7e38892e460 100644 --- a/sys/dev/hfa/fore_command.c +++ b/sys/dev/hfa/fore_command.c @@ -1,4 +1,4 @@ -/* +/*- * * =================================== * HARP | Host ATM Research Platform diff --git a/sys/dev/hfa/fore_if.c b/sys/dev/hfa/fore_if.c index f4f796ffa435..51bbd0fb6933 100644 --- a/sys/dev/hfa/fore_if.c +++ b/sys/dev/hfa/fore_if.c @@ -1,4 +1,4 @@ -/* +/*- * * =================================== * HARP | Host ATM Research Platform diff --git a/sys/dev/hfa/fore_include.h b/sys/dev/hfa/fore_include.h index c23e0cb294f0..93062f451f63 100644 --- a/sys/dev/hfa/fore_include.h +++ b/sys/dev/hfa/fore_include.h @@ -1,4 +1,4 @@ -/* +/*- * * =================================== * HARP | Host ATM Research Platform diff --git a/sys/dev/hfa/fore_init.c b/sys/dev/hfa/fore_init.c index 6124bdaaefd3..ccaed3f0e085 100644 --- a/sys/dev/hfa/fore_init.c +++ b/sys/dev/hfa/fore_init.c @@ -1,4 +1,4 @@ -/* +/*- * * =================================== * HARP | Host ATM Research Platform diff --git a/sys/dev/hfa/fore_intr.c b/sys/dev/hfa/fore_intr.c index 9c0f29dabba7..8454b93f2464 100644 --- a/sys/dev/hfa/fore_intr.c +++ b/sys/dev/hfa/fore_intr.c @@ -1,4 +1,4 @@ -/* +/*- * * =================================== * HARP | Host ATM Research Platform diff --git a/sys/dev/hfa/fore_output.c b/sys/dev/hfa/fore_output.c index a37e2ecb0cba..d4ab4dd921ba 100644 --- a/sys/dev/hfa/fore_output.c +++ b/sys/dev/hfa/fore_output.c @@ -1,4 +1,4 @@ -/* +/*- * * =================================== * HARP | Host ATM Research Platform diff --git a/sys/dev/hfa/fore_slave.h b/sys/dev/hfa/fore_slave.h index 83960d977e4b..33d73c21dced 100644 --- a/sys/dev/hfa/fore_slave.h +++ b/sys/dev/hfa/fore_slave.h @@ -1,4 +1,4 @@ -/* +/*- * * =================================== * HARP | Host ATM Research Platform diff --git a/sys/dev/hfa/fore_stats.c b/sys/dev/hfa/fore_stats.c index 17f165724387..4126c1f0635c 100644 --- a/sys/dev/hfa/fore_stats.c +++ b/sys/dev/hfa/fore_stats.c @@ -1,4 +1,4 @@ -/* +/*- * =================================== * HARP | Host ATM Research Platform * =================================== diff --git a/sys/dev/hfa/fore_stats.h b/sys/dev/hfa/fore_stats.h index 53b568f69ebd..32095164d8e4 100644 --- a/sys/dev/hfa/fore_stats.h +++ b/sys/dev/hfa/fore_stats.h @@ -1,4 +1,4 @@ -/* +/*- * * =================================== * HARP | Host ATM Research Platform diff --git a/sys/dev/hfa/fore_var.h b/sys/dev/hfa/fore_var.h index d0f05b8de114..57cedb3a761f 100644 --- a/sys/dev/hfa/fore_var.h +++ b/sys/dev/hfa/fore_var.h @@ -1,4 +1,4 @@ -/* +/*- * * =================================== * HARP | Host ATM Research Platform diff --git a/sys/dev/hfa/fore_vcm.c b/sys/dev/hfa/fore_vcm.c index cd0dd3c495df..95bc6524be99 100644 --- a/sys/dev/hfa/fore_vcm.c +++ b/sys/dev/hfa/fore_vcm.c @@ -1,4 +1,4 @@ -/* +/*- * * =================================== * HARP | Host ATM Research Platform diff --git a/sys/dev/hifn/hifn7751.c b/sys/dev/hifn/hifn7751.c index 2f3bebc60bee..2df4de7dca7e 100644 --- a/sys/dev/hifn/hifn7751.c +++ b/sys/dev/hifn/hifn7751.c @@ -1,6 +1,6 @@ /* $OpenBSD: hifn7751.c,v 1.120 2002/05/17 00:33:34 deraadt Exp $ */ -/* +/*- * Invertex AEON / Hifn 7751 driver * Copyright (c) 1999 Invertex Inc. All rights reserved. * Copyright (c) 1999 Theo de Raadt diff --git a/sys/dev/hifn/hifn7751reg.h b/sys/dev/hifn/hifn7751reg.h index 5f7099aa0668..8114f3f9d06c 100644 --- a/sys/dev/hifn/hifn7751reg.h +++ b/sys/dev/hifn/hifn7751reg.h @@ -1,7 +1,7 @@ /* $FreeBSD$ */ /* $OpenBSD: hifn7751reg.h,v 1.35 2002/04/08 17:49:42 jason Exp $ */ -/* +/*- * Invertex AEON / Hifn 7751 driver * Copyright (c) 1999 Invertex Inc. All rights reserved. * Copyright (c) 1999 Theo de Raadt diff --git a/sys/dev/hifn/hifn7751var.h b/sys/dev/hifn/hifn7751var.h index e3bd2f66e3d1..a92d77ba45d7 100644 --- a/sys/dev/hifn/hifn7751var.h +++ b/sys/dev/hifn/hifn7751var.h @@ -1,7 +1,7 @@ /* $FreeBSD$ */ /* $OpenBSD: hifn7751var.h,v 1.42 2002/04/08 17:49:42 jason Exp $ */ -/* +/*- * Invertex AEON / Hifn 7751 driver * Copyright (c) 1999 Invertex Inc. All rights reserved. * Copyright (c) 1999 Theo de Raadt diff --git a/sys/dev/hptmv/entry.c b/sys/dev/hptmv/entry.c index 16f8fb0c17ef..b5766d659bd4 100644 --- a/sys/dev/hptmv/entry.c +++ b/sys/dev/hptmv/entry.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003-2004 HighPoint Technologies, Inc. * All rights reserved. * diff --git a/sys/dev/hptmv/global.h b/sys/dev/hptmv/global.h index 3b8d99c5dfbb..3f8d4dd7ae3b 100644 --- a/sys/dev/hptmv/global.h +++ b/sys/dev/hptmv/global.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003-2004 HighPoint Technologies, Inc. * All rights reserved. * diff --git a/sys/dev/hptmv/hptintf.h b/sys/dev/hptmv/hptintf.h index 5b54475593e7..9839a6718271 100644 --- a/sys/dev/hptmv/hptintf.h +++ b/sys/dev/hptmv/hptintf.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003-2004 HighPoint Technologies, Inc. * All rights reserved. * diff --git a/sys/dev/hptmv/mv.c b/sys/dev/hptmv/mv.c index b135bfa2215c..474b3d5ddb23 100644 --- a/sys/dev/hptmv/mv.c +++ b/sys/dev/hptmv/mv.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003-2004 HighPoint Technologies, Inc. * All rights reserved. * diff --git a/sys/dev/hptmv/mvOs.h b/sys/dev/hptmv/mvOs.h index 3325d14c7cc1..2c0a5f4b1c66 100644 --- a/sys/dev/hptmv/mvOs.h +++ b/sys/dev/hptmv/mvOs.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003-2004 HighPoint Technologies, Inc. * All rights reserved. * diff --git a/sys/dev/hptmv/osbsd.h b/sys/dev/hptmv/osbsd.h index f9a41fcb73a4..5637c44c5e9a 100644 --- a/sys/dev/hptmv/osbsd.h +++ b/sys/dev/hptmv/osbsd.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003-2004 HighPoint Technologies, Inc. * All rights reserved. * diff --git a/sys/dev/ic/cd180.h b/sys/dev/ic/cd180.h index a9a5a83348e0..ae46a4809b68 100644 --- a/sys/dev/ic/cd180.h +++ b/sys/dev/ic/cd180.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 1995 by Pavel Antonov, Moscow, Russia. * Copyright (C) 1995 by Andrey A. Chernov, Moscow, Russia. * All rights reserved. diff --git a/sys/dev/ic/hd64570.h b/sys/dev/ic/hd64570.h index b676e25a9cd5..3399e0a0de57 100644 --- a/sys/dev/ic/hd64570.h +++ b/sys/dev/ic/hd64570.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995 John Hay. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ic/sab82532.h b/sys/dev/ic/sab82532.h index 1dd33bd52d7a..e570c6a9ae5f 100644 --- a/sys/dev/ic/sab82532.h +++ b/sys/dev/ic/sab82532.h @@ -1,6 +1,6 @@ /* $OpenBSD: sab82532reg.h,v 1.2 2002/04/08 17:49:42 jason Exp $ */ -/* +/*- * Copyright (c) 2001 Jason L. Wright (jason@thought.net) * All rights reserved. * diff --git a/sys/dev/ic/wd33c93reg.h b/sys/dev/ic/wd33c93reg.h index c286c65a16eb..8e536cd1d32d 100644 --- a/sys/dev/ic/wd33c93reg.h +++ b/sys/dev/ic/wd33c93reg.h @@ -1,7 +1,7 @@ /* $FreeBSD$ */ /* $NecBSD: wd33c93reg.h,v 1.21.24.1 2001/06/13 05:52:05 honda Exp $ */ /* $NetBSD$ */ -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1996, 1997, 1998 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/ic/z8530.h b/sys/dev/ic/z8530.h index d6db68d80ec0..d86a662a1d0b 100644 --- a/sys/dev/ic/z8530.h +++ b/sys/dev/ic/z8530.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/ichsmb/ichsmb.c b/sys/dev/ichsmb/ichsmb.c index 0d8dd59b07a3..2d92a65f9fe5 100644 --- a/sys/dev/ichsmb/ichsmb.c +++ b/sys/dev/ichsmb/ichsmb.c @@ -1,5 +1,4 @@ - -/* +/*- * ichsmb.c * * Author: Archie Cobbs diff --git a/sys/dev/ichsmb/ichsmb_reg.h b/sys/dev/ichsmb/ichsmb_reg.h index ca0577c7d178..a031607f4fdc 100644 --- a/sys/dev/ichsmb/ichsmb_reg.h +++ b/sys/dev/ichsmb/ichsmb_reg.h @@ -1,5 +1,4 @@ - -/* +/*- * ichsmb_reg.h * * Copyright (c) 2000 Whistle Communications, Inc. diff --git a/sys/dev/ichsmb/ichsmb_var.h b/sys/dev/ichsmb/ichsmb_var.h index 99abbe55afbe..d8def6de9c48 100644 --- a/sys/dev/ichsmb/ichsmb_var.h +++ b/sys/dev/ichsmb/ichsmb_var.h @@ -1,5 +1,4 @@ - -/* +/*- * ichsmb_var.h * * Copyright (c) 2000 Whistle Communications, Inc. diff --git a/sys/dev/ichwd/ichwd.c b/sys/dev/ichwd/ichwd.c index 73f871990c2f..893efbd722d4 100644 --- a/sys/dev/ichwd/ichwd.c +++ b/sys/dev/ichwd/ichwd.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 Texas A&M University * All rights reserved. * diff --git a/sys/dev/ichwd/ichwd.h b/sys/dev/ichwd/ichwd.h index ab0e117fbdf8..ef08b2ff7ef5 100644 --- a/sys/dev/ichwd/ichwd.h +++ b/sys/dev/ichwd/ichwd.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 Texas A&M University * All rights reserved. * diff --git a/sys/dev/ida/ida_eisa.c b/sys/dev/ida/ida_eisa.c index be247864ab96..a4f8cd535522 100644 --- a/sys/dev/ida/ida_eisa.c +++ b/sys/dev/ida/ida_eisa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 Jonathan Lemon * Copyright (c) 1999 by Matthew N. Dodd * All Rights Reserved. diff --git a/sys/dev/idt/idt.c b/sys/dev/idt/idt.c index 0edceeb9bb10..fbcd9161ab04 100644 --- a/sys/dev/idt/idt.c +++ b/sys/dev/idt/idt.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000, 2001 Richard Hodges and Matriplex, inc. * All rights reserved. * diff --git a/sys/dev/idt/idt_harp.c b/sys/dev/idt/idt_harp.c index 61cbdf9d1a7c..4659c4689037 100644 --- a/sys/dev/idt/idt_harp.c +++ b/sys/dev/idt/idt_harp.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000, 2001 Richard Hodges and Matriplex, inc. * All rights reserved. * diff --git a/sys/dev/idt/idt_pci.c b/sys/dev/idt/idt_pci.c index 1112d31d48ae..035b68f96f4c 100644 --- a/sys/dev/idt/idt_pci.c +++ b/sys/dev/idt/idt_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000, 2001 Richard Hodges and Matriplex, inc. * All rights reserved. * diff --git a/sys/dev/idt/idtreg.h b/sys/dev/idt/idtreg.h index 43ede7e292da..230bbbb1c78c 100644 --- a/sys/dev/idt/idtreg.h +++ b/sys/dev/idt/idtreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000, 2001 Richard Hodges and Matriplex, inc. * All rights reserved. * diff --git a/sys/dev/idt/idtvar.h b/sys/dev/idt/idtvar.h index 6761a00ee4df..b98ee1af2dad 100644 --- a/sys/dev/idt/idtvar.h +++ b/sys/dev/idt/idtvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000, 2001 Richard Hodges and Matriplex, inc. * All rights reserved. * diff --git a/sys/dev/ie/if_iee16.h b/sys/dev/ie/if_iee16.h index dcd8bae8155a..1196676cfed2 100644 --- a/sys/dev/ie/if_iee16.h +++ b/sys/dev/ie/if_iee16.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1993, 1994, 1995 * Rodney W. Grimes, Milwaukie, Oregon 97222. All rights reserved. * diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c index 5a6578d48942..f075a27c7c2c 100644 --- a/sys/dev/if_ndis/if_ndis.c +++ b/sys/dev/if_ndis/if_ndis.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Bill Paul . All rights reserved. * diff --git a/sys/dev/if_ndis/if_ndis_pccard.c b/sys/dev/if_ndis/if_ndis_pccard.c index 8f26eaca8552..0786b016020b 100644 --- a/sys/dev/if_ndis/if_ndis_pccard.c +++ b/sys/dev/if_ndis/if_ndis_pccard.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Bill Paul . All rights reserved. * diff --git a/sys/dev/if_ndis/if_ndis_pci.c b/sys/dev/if_ndis/if_ndis_pci.c index 00f4086ab157..8af48f4a0304 100644 --- a/sys/dev/if_ndis/if_ndis_pci.c +++ b/sys/dev/if_ndis/if_ndis_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Bill Paul . All rights reserved. * diff --git a/sys/dev/if_ndis/if_ndisvar.h b/sys/dev/if_ndis/if_ndisvar.h index 339d965a8195..8da9b39fc00d 100644 --- a/sys/dev/if_ndis/if_ndisvar.h +++ b/sys/dev/if_ndis/if_ndisvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Bill Paul . All rights reserved. * diff --git a/sys/dev/iicbus/iicbb_if.m b/sys/dev/iicbus/iicbb_if.m index 564274166968..7d10fe748b22 100644 --- a/sys/dev/iicbus/iicbb_if.m +++ b/sys/dev/iicbus/iicbb_if.m @@ -1,4 +1,4 @@ -# +#- # Copyright (c) 1998 Nicolas Souchu # All rights reserved. # diff --git a/sys/dev/iicbus/iicbus_if.m b/sys/dev/iicbus/iicbus_if.m index eddc022b97d7..068cf4d86ff3 100644 --- a/sys/dev/iicbus/iicbus_if.m +++ b/sys/dev/iicbus/iicbus_if.m @@ -1,4 +1,4 @@ -# +#- # Copyright (c) 1998 Nicolas Souchu # All rights reserved. # diff --git a/sys/dev/iir/iir.c b/sys/dev/iir/iir.c index b1c9992827c5..60b2962e64fd 100644 --- a/sys/dev/iir/iir.c +++ b/sys/dev/iir/iir.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000-04 ICP vortex GmbH * Copyright (c) 2002-04 Intel Corporation * Copyright (c) 2003-04 Adaptec Inc. diff --git a/sys/dev/iir/iir.h b/sys/dev/iir/iir.h index 688cf634d153..830cf087e9c5 100644 --- a/sys/dev/iir/iir.h +++ b/sys/dev/iir/iir.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2000-04 ICP vortex GmbH * Copyright (c) 2002-04 Intel Corporation * Copyright (c) 2003-04 Adaptec Inc. diff --git a/sys/dev/iir/iir_ctrl.c b/sys/dev/iir/iir_ctrl.c index 4d976b3e9e81..172d85bd22ba 100644 --- a/sys/dev/iir/iir_ctrl.c +++ b/sys/dev/iir/iir_ctrl.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000-03 ICP vortex GmbH * Copyright (c) 2002-03 Intel Corporation * Copyright (c) 2003 Adaptec Inc. diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c index a12c3d4472b9..704acb9f3e46 100644 --- a/sys/dev/isp/isp.c +++ b/sys/dev/isp/isp.c @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Machine and OS Independent (well, as best as possible) * code for the Qlogic ISP SCSI adapters. * diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c index 986fc8d6cb9f..8a9642a259ff 100644 --- a/sys/dev/isp/isp_freebsd.c +++ b/sys/dev/isp/isp_freebsd.c @@ -1,4 +1,4 @@ -/* +/*- * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. * * Copyright (c) 1997, 1998, 1999, 2000, 2001 by Matthew Jacob diff --git a/sys/dev/isp/isp_freebsd.h b/sys/dev/isp/isp_freebsd.h index 3f60a948a3b6..4b1586c1b295 100644 --- a/sys/dev/isp/isp_freebsd.h +++ b/sys/dev/isp/isp_freebsd.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002 by Matthew Jacob * diff --git a/sys/dev/isp/isp_inline.h b/sys/dev/isp/isp_inline.h index 6bc54fbf08e7..e78eb7621c1b 100644 --- a/sys/dev/isp/isp_inline.h +++ b/sys/dev/isp/isp_inline.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Qlogic Host Adapter Inline Functions * * Copyright (c) 1999, 2000, 2001 by Matthew Jacob diff --git a/sys/dev/isp/isp_ioctl.h b/sys/dev/isp/isp_ioctl.h index 93ccc53f9ceb..921272aa2490 100644 --- a/sys/dev/isp/isp_ioctl.h +++ b/sys/dev/isp/isp_ioctl.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2001 by Matthew Jacob * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/isp/isp_target.c b/sys/dev/isp/isp_target.c index d26d1e35d427..1d4dc6bd86e5 100644 --- a/sys/dev/isp/isp_target.c +++ b/sys/dev/isp/isp_target.c @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Machine and OS Independent Target Mode Code for the Qlogic SCSI/FC adapters. * * Copyright (c) 1999, 2000, 2001 by Matthew Jacob diff --git a/sys/dev/isp/isp_target.h b/sys/dev/isp/isp_target.h index c0bbc89fb11e..2156da118789 100644 --- a/sys/dev/isp/isp_target.h +++ b/sys/dev/isp/isp_target.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Qlogic Target Mode Structure and Flag Definitions * * Copyright (c) 1997, 1998 diff --git a/sys/dev/isp/isp_tpublic.h b/sys/dev/isp/isp_tpublic.h index 358e956036d9..a2773323d68e 100644 --- a/sys/dev/isp/isp_tpublic.h +++ b/sys/dev/isp/isp_tpublic.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Qlogic ISP Host Adapter Public Target Interface Structures && Routines *--------------------------------------- * Copyright (c) 2000 by Matthew Jacob diff --git a/sys/dev/isp/ispmbox.h b/sys/dev/isp/ispmbox.h index 77aeb00c5ec9..4834fd32c79b 100644 --- a/sys/dev/isp/ispmbox.h +++ b/sys/dev/isp/ispmbox.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Mailbox and Queue Entry Definitions for for Qlogic ISP SCSI adapters. * * Copyright (c) 1997, 1998, 1999, 2000 by Matthew Jacob diff --git a/sys/dev/isp/ispreg.h b/sys/dev/isp/ispreg.h index 2f51790819e2..163ac9894d90 100644 --- a/sys/dev/isp/ispreg.h +++ b/sys/dev/isp/ispreg.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Machine Independent (well, as best as possible) register * definitions for Qlogic ISP SCSI adapters. * diff --git a/sys/dev/isp/ispvar.h b/sys/dev/isp/ispvar.h index 1e99dc9b5c4b..d4bdb0d4648d 100644 --- a/sys/dev/isp/ispvar.h +++ b/sys/dev/isp/ispvar.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Soft Definitions for for Qlogic ISP SCSI adapters. * * Copyright (c) 1997, 1998, 1999, 2000 by Matthew Jacob diff --git a/sys/dev/ispfw/asm_1000.h b/sys/dev/ispfw/asm_1000.h index 965d0b084d7c..fb064094d30b 100644 --- a/sys/dev/ispfw/asm_1000.h +++ b/sys/dev/ispfw/asm_1000.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Qlogic, Inc. * All rights reserved. * diff --git a/sys/dev/ispfw/asm_1040.h b/sys/dev/ispfw/asm_1040.h index dbb3992e67e8..9e78a56e5c11 100644 --- a/sys/dev/ispfw/asm_1040.h +++ b/sys/dev/ispfw/asm_1040.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Qlogic, Inc. * All rights reserved. * diff --git a/sys/dev/ispfw/asm_1080.h b/sys/dev/ispfw/asm_1080.h index de896a08b5df..edb0ad711a28 100644 --- a/sys/dev/ispfw/asm_1080.h +++ b/sys/dev/ispfw/asm_1080.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Qlogic, Inc. * All rights reserved. * diff --git a/sys/dev/ispfw/asm_12160.h b/sys/dev/ispfw/asm_12160.h index 7279007f29b1..bc1d42089853 100644 --- a/sys/dev/ispfw/asm_12160.h +++ b/sys/dev/ispfw/asm_12160.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Qlogic, Inc. * All rights reserved. * diff --git a/sys/dev/ispfw/asm_2100.h b/sys/dev/ispfw/asm_2100.h index f593ec3f45cf..399707d57543 100644 --- a/sys/dev/ispfw/asm_2100.h +++ b/sys/dev/ispfw/asm_2100.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Qlogic, Inc. * All rights reserved. * diff --git a/sys/dev/ispfw/asm_2200.h b/sys/dev/ispfw/asm_2200.h index 8bd389f236c8..3d92bf7c99e4 100644 --- a/sys/dev/ispfw/asm_2200.h +++ b/sys/dev/ispfw/asm_2200.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Qlogic, Inc. * All rights reserved. * diff --git a/sys/dev/ispfw/asm_2300.h b/sys/dev/ispfw/asm_2300.h index 152b05700639..7a553b01ce0d 100644 --- a/sys/dev/ispfw/asm_2300.h +++ b/sys/dev/ispfw/asm_2300.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (C) 2001 Qlogic, Inc. * All rights reserved. * diff --git a/sys/dev/ixgb/LICENSE b/sys/dev/ixgb/LICENSE index 35e396476bb9..501764514696 100644 --- a/sys/dev/ixgb/LICENSE +++ b/sys/dev/ixgb/LICENSE @@ -1,4 +1,6 @@ /*$FreeBSD$*/ +/*- + Copyright (c) 2001-2004, Intel Corporation All rights reserved. @@ -27,3 +29,5 @@ 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. + +*/ diff --git a/sys/dev/ixgb/if_ixgb.c b/sys/dev/ixgb/if_ixgb.c index cc4739199f9f..6e58eea97b7a 100644 --- a/sys/dev/ixgb/if_ixgb.c +++ b/sys/dev/ixgb/if_ixgb.c @@ -1,4 +1,4 @@ -/************************************************************************** +/******************************************************************************* Copyright (c) 2001-2004, Intel Corporation All rights reserved. diff --git a/sys/dev/ixgb/if_ixgb.h b/sys/dev/ixgb/if_ixgb.h index a8a7a580664b..f0be0062ee52 100644 --- a/sys/dev/ixgb/if_ixgb.h +++ b/sys/dev/ixgb/if_ixgb.h @@ -1,4 +1,4 @@ -/************************************************************************** +/******************************************************************************* Copyright (c) 2001-2004, Intel Corporation All rights reserved. diff --git a/sys/dev/ixgb/if_ixgb_osdep.h b/sys/dev/ixgb/if_ixgb_osdep.h index 999863cc59a7..31ba6846abab 100644 --- a/sys/dev/ixgb/if_ixgb_osdep.h +++ b/sys/dev/ixgb/if_ixgb_osdep.h @@ -1,4 +1,4 @@ -/************************************************************************** +/******************************************************************************* Copyright (c) 2001-2004, Intel Corporation All rights reserved. diff --git a/sys/dev/lge/if_lge.c b/sys/dev/lge/if_lge.c index 12912f2298d0..6a8ab86f8b77 100644 --- a/sys/dev/lge/if_lge.c +++ b/sys/dev/lge/if_lge.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 * Bill Paul . All rights reserved. diff --git a/sys/dev/lge/if_lgereg.h b/sys/dev/lge/if_lgereg.h index 28a6aec85f41..7c552b03f2e0 100644 --- a/sys/dev/lge/if_lgereg.h +++ b/sys/dev/lge/if_lgereg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 * Bill Paul . All rights reserved. diff --git a/sys/dev/lnc/if_lnc_cbus.c b/sys/dev/lnc/if_lnc_cbus.c index c03afc6b4ddb..c52d56ecc3f5 100644 --- a/sys/dev/lnc/if_lnc_cbus.c +++ b/sys/dev/lnc/if_lnc_cbus.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1994-2000 * Paul Richards. All rights reserved. * diff --git a/sys/dev/lnc/if_lnc_isa.c b/sys/dev/lnc/if_lnc_isa.c index 5f6ed66abb36..f53fd4629fd3 100644 --- a/sys/dev/lnc/if_lnc_isa.c +++ b/sys/dev/lnc/if_lnc_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1994-2000 * Paul Richards. All rights reserved. * diff --git a/sys/dev/matcd/creativeif.h b/sys/dev/matcd/creativeif.h index 739550b27c84..adf5b005ab4b 100644 --- a/sys/dev/matcd/creativeif.h +++ b/sys/dev/matcd/creativeif.h @@ -2,7 +2,8 @@ Matsushita(Panasonic) / Creative CD-ROM Driver (matcd) Authored by Frank Durda IV - +*/ +/*- Copyright 1994, 1995, 2002, 2003 Frank Durda IV. All rights reserved. "FDIV" is a trademark of Frank Durda IV. diff --git a/sys/dev/matcd/matcd.c b/sys/dev/matcd/matcd.c index aead16c72ef5..b73112de7f76 100644 --- a/sys/dev/matcd/matcd.c +++ b/sys/dev/matcd/matcd.c @@ -2,7 +2,8 @@ Matsushita(Panasonic) / Creative CD-ROM Driver (matcd) Authored by Frank Durda IV - +*/ +/*- Copyright 1994, 1995, 2002, 2003 Frank Durda IV. All rights reserved. "FDIV" is a trademark of Frank Durda IV. diff --git a/sys/dev/matcd/matcd_data.h b/sys/dev/matcd/matcd_data.h index 1923cec4cbcc..08983cf71d30 100644 --- a/sys/dev/matcd/matcd_data.h +++ b/sys/dev/matcd/matcd_data.h @@ -2,7 +2,8 @@ Matsushita(Panasonic) / Creative CD-ROM Driver (matcd) Authored by Frank Durda IV - +*/ +/*- Copyright 1994, 1995, 2002, 2003 Frank Durda IV. All rights reserved. "FDIV" is a trademark of Frank Durda IV. diff --git a/sys/dev/matcd/matcd_isa.c b/sys/dev/matcd/matcd_isa.c index 48d01dd23788..978ede8c2a7f 100644 --- a/sys/dev/matcd/matcd_isa.c +++ b/sys/dev/matcd/matcd_isa.c @@ -2,7 +2,8 @@ Matsushita(Panasonic) / Creative CD-ROM Driver (matcd) Authored by Frank Durda IV - +*/ +/*- Copyright 1994, 1995, 2002, 2003 Frank Durda IV. All rights reserved. "FDIV" is a trademark of Frank Durda IV. diff --git a/sys/dev/matcd/matcddrv.h b/sys/dev/matcd/matcddrv.h index b2f069e0bec1..e7ffd5dc3ea7 100644 --- a/sys/dev/matcd/matcddrv.h +++ b/sys/dev/matcd/matcddrv.h @@ -2,7 +2,8 @@ Matsushita(Panasonic) / Creative CD-ROM Driver (matcd) Authored by Frank Durda IV - +*/ +/*- Copyright 1994, 1995, 2002, 2003 Frank Durda IV. All rights reserved. "FDIV" is a trademark of Frank Durda IV. diff --git a/sys/dev/matcd/options.h b/sys/dev/matcd/options.h index fe0c8f2adc03..3abf958de6cc 100644 --- a/sys/dev/matcd/options.h +++ b/sys/dev/matcd/options.h @@ -2,7 +2,8 @@ Matsushita(Panasonic) / Creative CD-ROM Driver (matcd) Authored by Frank Durda IV - +*/ +/*- Copyright 1994, 1995, 2002, 2003 Frank Durda IV. All rights reserved. "FDIV" is a trademark of Frank Durda IV. diff --git a/sys/dev/mc146818/mc146818.c b/sys/dev/mc146818/mc146818.c index 48d36a729a92..4d0919341487 100644 --- a/sys/dev/mc146818/mc146818.c +++ b/sys/dev/mc146818/mc146818.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Izumi Tsutsui. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mc146818/mc146818reg.h b/sys/dev/mc146818/mc146818reg.h index 48d558cc78d4..3aab55f56a5a 100644 --- a/sys/dev/mc146818/mc146818reg.h +++ b/sys/dev/mc146818/mc146818reg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. * diff --git a/sys/dev/mc146818/mc146818var.h b/sys/dev/mc146818/mc146818var.h index 78d9945f686f..4e8600cd04e1 100644 --- a/sys/dev/mc146818/mc146818var.h +++ b/sys/dev/mc146818/mc146818var.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Izumi Tsutsui. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c index 0af98c887d68..db351909c652 100644 --- a/sys/dev/mcd/mcd.c +++ b/sys/dev/mcd/mcd.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright 1993 by Holger Veit (data part) * Copyright 1993 by Brian Moore (audio part) * Changes Copyright 1993 by Gary Clark II diff --git a/sys/dev/mcd/mcdreg.h b/sys/dev/mcd/mcdreg.h index cc8a3ab7163a..7a255afa04df 100644 --- a/sys/dev/mcd/mcdreg.h +++ b/sys/dev/mcd/mcdreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright 1993 by Holger Veit (data part) * Copyright 1993 by Brian Moore (audio part) * Changes Copyright 1993 by Gary Clark II diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index f9c72b2917fa..a152f67d778e 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -1,4 +1,4 @@ -/* +/*- * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * wrote this file. As long as you retain this notice you @@ -10,7 +10,7 @@ * */ -/* +/*- * The following functions are based in the vn(4) driver: mdstart_swap(), * mdstart_vnode(), mdcreate_swap(), mdcreate_vnode() and mddestroy(), * and as such under the following copyright: diff --git a/sys/dev/mii/acphy.c b/sys/dev/mii/acphy.c index 78aa5561b7f6..aba0b26f9bdf 100644 --- a/sys/dev/mii/acphy.c +++ b/sys/dev/mii/acphy.c @@ -35,7 +35,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Copyright (c) 1997 Manuel Bouyer. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mii/amphy.c b/sys/dev/mii/amphy.c index ca13a844892d..dac0938ec1ba 100644 --- a/sys/dev/mii/amphy.c +++ b/sys/dev/mii/amphy.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/mii/amphyreg.h b/sys/dev/mii/amphyreg.h index ffc362a8c7b1..6cdbc95647b5 100644 --- a/sys/dev/mii/amphyreg.h +++ b/sys/dev/mii/amphyreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/mii/bmtphy.c b/sys/dev/mii/bmtphy.c index c180b5ef5928..b086c8680ef3 100644 --- a/sys/dev/mii/bmtphy.c +++ b/sys/dev/mii/bmtphy.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/mii/bmtphyreg.h b/sys/dev/mii/bmtphyreg.h index 7f2956ad0b75..223d631a54d5 100644 --- a/sys/dev/mii/bmtphyreg.h +++ b/sys/dev/mii/bmtphyreg.h @@ -1,4 +1,3 @@ - /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c index 85cf768b2263..9e62df19ac1f 100644 --- a/sys/dev/mii/brgphy.c +++ b/sys/dev/mii/brgphy.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 * Bill Paul . All rights reserved. * diff --git a/sys/dev/mii/brgphyreg.h b/sys/dev/mii/brgphyreg.h index 786f49dae8d5..bb9636d882fb 100644 --- a/sys/dev/mii/brgphyreg.h +++ b/sys/dev/mii/brgphyreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 * Bill Paul . All rights reserved. * diff --git a/sys/dev/mii/ciphy.c b/sys/dev/mii/ciphy.c index 03a71d528349..86567c004715 100644 --- a/sys/dev/mii/ciphy.c +++ b/sys/dev/mii/ciphy.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 * Bill Paul . All rights reserved. * diff --git a/sys/dev/mii/ciphyreg.h b/sys/dev/mii/ciphyreg.h index 2822ac18704c..8c0a8a46cc61 100644 --- a/sys/dev/mii/ciphyreg.h +++ b/sys/dev/mii/ciphyreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 * Bill Paul . All rights reserved. * diff --git a/sys/dev/mii/dcphy.c b/sys/dev/mii/dcphy.c index 28affb81063c..ddf9b7e2a605 100644 --- a/sys/dev/mii/dcphy.c +++ b/sys/dev/mii/dcphy.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/mii/e1000phy.c b/sys/dev/mii/e1000phy.c index 2dc1448988a0..7894e95f06be 100644 --- a/sys/dev/mii/e1000phy.c +++ b/sys/dev/mii/e1000phy.c @@ -1,4 +1,4 @@ -/* +/*- * Principal Author: Parag Patel * Copyright (c) 2001 * All rights reserved. diff --git a/sys/dev/mii/e1000phyreg.h b/sys/dev/mii/e1000phyreg.h index bdfc665f8901..14bf6124e69a 100644 --- a/sys/dev/mii/e1000phyreg.h +++ b/sys/dev/mii/e1000phyreg.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Principal Author: Parag Patel * Copyright (c) 2001 * All rights reserved. @@ -30,7 +30,7 @@ * Secondary Author: Matthew Jacob */ -/* +/*- * Derived by information released by Intel under the following license: * * Copyright (c) 1999 - 2001, Intel Corporation diff --git a/sys/dev/mii/exphy.c b/sys/dev/mii/exphy.c index 914577289fd9..afb90137388b 100644 --- a/sys/dev/mii/exphy.c +++ b/sys/dev/mii/exphy.c @@ -37,7 +37,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Copyright (c) 1997 Manuel Bouyer. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mii/lxtphy.c b/sys/dev/mii/lxtphy.c index db5c1002d757..e4d0c1916748 100644 --- a/sys/dev/mii/lxtphy.c +++ b/sys/dev/mii/lxtphy.c @@ -38,7 +38,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Copyright (c) 1997 Manuel Bouyer. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mii/mii.h b/sys/dev/mii/mii.h index 963c22617722..0f1a4426e6fe 100644 --- a/sys/dev/mii/mii.h +++ b/sys/dev/mii/mii.h @@ -1,6 +1,6 @@ /* $NetBSD: mii.h,v 1.9 2001/05/31 03:07:14 thorpej Exp $ */ -/* +/*- * Copyright (c) 1997 Manuel Bouyer. All rights reserved. * * Modification to match BSD/OS 3.0 MII interface by Jason R. Thorpe, diff --git a/sys/dev/mii/mlphy.c b/sys/dev/mii/mlphy.c index ecb84f776979..9b2693314ba5 100644 --- a/sys/dev/mii/mlphy.c +++ b/sys/dev/mii/mlphy.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/mii/nsgphy.c b/sys/dev/mii/nsgphy.c index 8c74a39bb4e7..259739e15a81 100644 --- a/sys/dev/mii/nsgphy.c +++ b/sys/dev/mii/nsgphy.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Wind River Systems * Copyright (c) 2001 * Bill Paul . All rights reserved. diff --git a/sys/dev/mii/nsgphyreg.h b/sys/dev/mii/nsgphyreg.h index c7680f1e8a3c..44899191715e 100644 --- a/sys/dev/mii/nsgphyreg.h +++ b/sys/dev/mii/nsgphyreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Wind River Systems * Copyright (c) 2001 * Bill Paul . All rights reserved. diff --git a/sys/dev/mii/nsphy.c b/sys/dev/mii/nsphy.c index 70676ddc1e4f..05941492947d 100644 --- a/sys/dev/mii/nsphy.c +++ b/sys/dev/mii/nsphy.c @@ -37,7 +37,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Copyright (c) 1997 Manuel Bouyer. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mii/pnaphy.c b/sys/dev/mii/pnaphy.c index 50986dc52f5c..6f3ab65a9deb 100644 --- a/sys/dev/mii/pnaphy.c +++ b/sys/dev/mii/pnaphy.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 Berkeley Software Design, Inc. * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul . All rights reserved. diff --git a/sys/dev/mii/qsphy.c b/sys/dev/mii/qsphy.c index 2f09eeb3d09b..9c92ed8a5de3 100644 --- a/sys/dev/mii/qsphy.c +++ b/sys/dev/mii/qsphy.c @@ -38,7 +38,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Copyright (c) 1997 Manuel Bouyer. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mii/rgephy.c b/sys/dev/mii/rgephy.c index 98609db14d26..ad384a93e82e 100644 --- a/sys/dev/mii/rgephy.c +++ b/sys/dev/mii/rgephy.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Bill Paul . All rights reserved. * diff --git a/sys/dev/mii/rgephyreg.h b/sys/dev/mii/rgephyreg.h index 1adecf4611cb..0ce44dfcd9ac 100644 --- a/sys/dev/mii/rgephyreg.h +++ b/sys/dev/mii/rgephyreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Bill Paul . All rights reserved. * diff --git a/sys/dev/mii/rlphy.c b/sys/dev/mii/rlphy.c index 2e93373d84bf..f9c9b5e3102c 100644 --- a/sys/dev/mii/rlphy.c +++ b/sys/dev/mii/rlphy.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/mii/tdkphy.c b/sys/dev/mii/tdkphy.c index c5efb691683b..8ae7b0506d01 100644 --- a/sys/dev/mii/tdkphy.c +++ b/sys/dev/mii/tdkphy.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000,2001 Jonathan Chen. * All rights reserved. * diff --git a/sys/dev/mii/tdkphyreg.h b/sys/dev/mii/tdkphyreg.h index 1f106251b607..4429c9481ec7 100644 --- a/sys/dev/mii/tdkphyreg.h +++ b/sys/dev/mii/tdkphyreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000,2001 Jonathan Chen. * All rights reserved. * diff --git a/sys/dev/mii/tlphy.c b/sys/dev/mii/tlphy.c index ff00a4708312..f07e33e16c43 100644 --- a/sys/dev/mii/tlphy.c +++ b/sys/dev/mii/tlphy.c @@ -37,7 +37,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Copyright (c) 1997 Manuel Bouyer. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mii/tlphyreg.h b/sys/dev/mii/tlphyreg.h index 77e4a45700bd..a016f4cc6910 100644 --- a/sys/dev/mii/tlphyreg.h +++ b/sys/dev/mii/tlphyreg.h @@ -1,6 +1,6 @@ /* $NetBSD: tlphyreg.h,v 1.1 1998/08/10 23:59:58 thorpej Exp $ */ -/* +/*- * Copyright (c) 1997 Manuel Bouyer. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mii/ukphy.c b/sys/dev/mii/ukphy.c index c75bd6cfa820..2d87b565c241 100644 --- a/sys/dev/mii/ukphy.c +++ b/sys/dev/mii/ukphy.c @@ -37,7 +37,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Copyright (c) 1997 Manuel Bouyer. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mii/xmphy.c b/sys/dev/mii/xmphy.c index 1270c42c154a..c6d2ee9b383a 100644 --- a/sys/dev/mii/xmphy.c +++ b/sys/dev/mii/xmphy.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 * Bill Paul . All rights reserved. * diff --git a/sys/dev/mii/xmphyreg.h b/sys/dev/mii/xmphyreg.h index e06b1970831e..1e828e1681a1 100644 --- a/sys/dev/mii/xmphyreg.h +++ b/sys/dev/mii/xmphyreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 * Bill Paul . All rights reserved. * diff --git a/sys/dev/mpt/mpilib/fc_log.h b/sys/dev/mpt/mpilib/fc_log.h index 2b02a9ac95b3..fd68bf645931 100644 --- a/sys/dev/mpt/mpilib/fc_log.h +++ b/sys/dev/mpt/mpilib/fc_log.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2000, 2001 by LSI Logic Corporation * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mpt/mpilib/mpi.h b/sys/dev/mpt/mpilib/mpi.h index a3fab3c2aeb9..1044d8205ca7 100644 --- a/sys/dev/mpt/mpilib/mpi.h +++ b/sys/dev/mpt/mpilib/mpi.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2000, 2001 by LSI Logic Corporation * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mpt/mpilib/mpi_cnfg.h b/sys/dev/mpt/mpilib/mpi_cnfg.h index 6008f4227771..356aee748696 100644 --- a/sys/dev/mpt/mpilib/mpi_cnfg.h +++ b/sys/dev/mpt/mpilib/mpi_cnfg.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2000, 2001 by LSI Logic Corporation * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mpt/mpilib/mpi_fc.h b/sys/dev/mpt/mpilib/mpi_fc.h index 60487e139d69..470d385ed5ab 100644 --- a/sys/dev/mpt/mpilib/mpi_fc.h +++ b/sys/dev/mpt/mpilib/mpi_fc.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2000, 2001 by LSI Logic Corporation * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mpt/mpilib/mpi_init.h b/sys/dev/mpt/mpilib/mpi_init.h index 78545889f819..527b1f9ab7e5 100644 --- a/sys/dev/mpt/mpilib/mpi_init.h +++ b/sys/dev/mpt/mpilib/mpi_init.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2000, 2001 by LSI Logic Corporation * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mpt/mpilib/mpi_ioc.h b/sys/dev/mpt/mpilib/mpi_ioc.h index e2e8f43fe81e..a8f8d3e1bc7e 100644 --- a/sys/dev/mpt/mpilib/mpi_ioc.h +++ b/sys/dev/mpt/mpilib/mpi_ioc.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2000, 2001 by LSI Logic Corporation * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mpt/mpilib/mpi_lan.h b/sys/dev/mpt/mpilib/mpi_lan.h index 0c2a137b3517..ceaf353a54e7 100644 --- a/sys/dev/mpt/mpilib/mpi_lan.h +++ b/sys/dev/mpt/mpilib/mpi_lan.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2000, 2001 by LSI Logic Corporation * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mpt/mpilib/mpi_raid.h b/sys/dev/mpt/mpilib/mpi_raid.h index c78a600b64a5..196f1ba00d6a 100644 --- a/sys/dev/mpt/mpilib/mpi_raid.h +++ b/sys/dev/mpt/mpilib/mpi_raid.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2000, 2001 by LSI Logic Corporation * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mpt/mpilib/mpi_targ.h b/sys/dev/mpt/mpilib/mpi_targ.h index f212c62d13dc..ba8b2ca7b553 100644 --- a/sys/dev/mpt/mpilib/mpi_targ.h +++ b/sys/dev/mpt/mpilib/mpi_targ.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2000, 2001 by LSI Logic Corporation * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mpt/mpilib/mpi_type.h b/sys/dev/mpt/mpilib/mpi_type.h index becf1a0747c4..c10cb92bbc8d 100644 --- a/sys/dev/mpt/mpilib/mpi_type.h +++ b/sys/dev/mpt/mpilib/mpi_type.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2000, 2001 by LSI Logic Corporation * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/mpt/mpt.c b/sys/dev/mpt/mpt.c index 99c0faf37cc7..9e6e144678f9 100644 --- a/sys/dev/mpt/mpt.c +++ b/sys/dev/mpt/mpt.c @@ -1,4 +1,4 @@ -/* +/*- * Generic routines for LSI '909 FC adapters. * FreeBSD Version. * diff --git a/sys/dev/mpt/mpt.h b/sys/dev/mpt/mpt.h index 82e8cf518752..8161d2412575 100644 --- a/sys/dev/mpt/mpt.h +++ b/sys/dev/mpt/mpt.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * Generic defines for LSI '909 FC adapters. * FreeBSD Version. * diff --git a/sys/dev/mpt/mpt_debug.c b/sys/dev/mpt/mpt_debug.c index d7ec166aee36..84ea8ddd27ad 100644 --- a/sys/dev/mpt/mpt_debug.c +++ b/sys/dev/mpt/mpt_debug.c @@ -1,4 +1,4 @@ -/* +/*- * Debug routines for LSI '909 FC adapters. * FreeBSD Version. * diff --git a/sys/dev/mpt/mpt_freebsd.c b/sys/dev/mpt/mpt_freebsd.c index 58e147db1806..d7bb43055066 100644 --- a/sys/dev/mpt/mpt_freebsd.c +++ b/sys/dev/mpt/mpt_freebsd.c @@ -1,4 +1,4 @@ -/* +/*- * FreeBSD/CAM specific routines for LSI '909 FC adapters. * FreeBSD Version. * diff --git a/sys/dev/mpt/mpt_freebsd.h b/sys/dev/mpt/mpt_freebsd.h index 991e56e5e6bd..49e6f4e0c371 100644 --- a/sys/dev/mpt/mpt_freebsd.h +++ b/sys/dev/mpt/mpt_freebsd.h @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* +/*- * LSI MPT Host Adapter FreeBSD Wrapper Definitions (CAM version) * * Copyright (c) 2000, 2001 by Greg Ansley, Adam Prewett diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c index 8a827d1eb30d..6847f16e589d 100644 --- a/sys/dev/mse/mse.c +++ b/sys/dev/mse/mse.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 M. Warner Losh * All rights reserved. * diff --git a/sys/dev/mse/mse_cbus.c b/sys/dev/mse/mse_cbus.c index 8fd99559e1d3..60129e7842ae 100644 --- a/sys/dev/mse/mse_cbus.c +++ b/sys/dev/mse/mse_cbus.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 M. Warner Losh * All rights reserved. * diff --git a/sys/dev/mse/mse_isa.c b/sys/dev/mse/mse_isa.c index d06bfa80999c..1bf0669b57d8 100644 --- a/sys/dev/mse/mse_isa.c +++ b/sys/dev/mse/mse_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 M. Warner Losh * All rights reserved. * diff --git a/sys/dev/mse/msevar.h b/sys/dev/mse/msevar.h index edbb482a77a3..37ca728cfc90 100644 --- a/sys/dev/mse/msevar.h +++ b/sys/dev/mse/msevar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 M. Warner Losh * All rights reserved. * diff --git a/sys/dev/my/if_myreg.h b/sys/dev/my/if_myreg.h index ccc7338a9eb7..9d889d12acef 100644 --- a/sys/dev/my/if_myreg.h +++ b/sys/dev/my/if_myreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2002 Myson Technology Inc. * All rights reserved. * diff --git a/sys/dev/ncv/ncr53c500.c b/sys/dev/ncv/ncr53c500.c index dbb8ea9df3a7..346c09aebda8 100644 --- a/sys/dev/ncv/ncr53c500.c +++ b/sys/dev/ncv/ncr53c500.c @@ -5,7 +5,7 @@ #define NCV_STATICS #define NCV_IO_CONTROL_FLAGS (0) -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/ncv/ncr53c500_pccard.c b/sys/dev/ncv/ncr53c500_pccard.c index 1e97372aa263..fddb9e2fe04d 100644 --- a/sys/dev/ncv/ncr53c500_pccard.c +++ b/sys/dev/ncv/ncr53c500_pccard.c @@ -1,7 +1,7 @@ /* $NecBSD: ncr53c500_pisa.c,v 1.28 1998/11/26 01:59:11 honda Exp $ */ /* $NetBSD$ */ -/* +/*- * [Ported for FreeBSD] * Copyright (c) 2000 * Noriaki Mitsunaga, Mitsuru Iwasaki and Takanori Watanabe. diff --git a/sys/dev/ncv/ncr53c500hw.h b/sys/dev/ncv/ncr53c500hw.h index cf1228855515..7a4b337b8985 100644 --- a/sys/dev/ncv/ncr53c500hw.h +++ b/sys/dev/ncv/ncr53c500hw.h @@ -2,7 +2,7 @@ /* $NecBSD: ncr53c500hw.h,v 1.6.18.1 2001/06/08 06:27:44 honda Exp $ */ /* $NetBSD$ */ -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1996, 1997, 1998 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/ncv/ncr53c500hwtab.h b/sys/dev/ncv/ncr53c500hwtab.h index 7e16b9e72fbd..47406b1947e4 100644 --- a/sys/dev/ncv/ncr53c500hwtab.h +++ b/sys/dev/ncv/ncr53c500hwtab.h @@ -2,7 +2,7 @@ /* $NecBSD: ncr53c500hwtab.h,v 1.2.18.1 2001/06/08 06:27:44 honda Exp $ */ /* $NetBSD$ */ -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1996, 1997, 1998 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/ncv/ncr53c500reg.h b/sys/dev/ncv/ncr53c500reg.h index 0296c5eae004..2a9906e44cdf 100644 --- a/sys/dev/ncv/ncr53c500reg.h +++ b/sys/dev/ncv/ncr53c500reg.h @@ -2,7 +2,7 @@ /* $NecBSD: ncr53c500reg.h,v 1.5.14.1 2001/06/08 06:27:44 honda Exp $ */ /* $NetBSD$ */ -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1995, 1996, 1997, 1998 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/ncv/ncr53c500var.h b/sys/dev/ncv/ncr53c500var.h index 6d5edce9cae7..b3aff4660f0d 100644 --- a/sys/dev/ncv/ncr53c500var.h +++ b/sys/dev/ncv/ncr53c500var.h @@ -2,7 +2,7 @@ /* $NecBSD: ncr53c500var.h,v 1.11.18.1 2001/06/08 06:27:45 honda Exp $ */ /* $NetBSD$ */ -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/nge/if_nge.c b/sys/dev/nge/if_nge.c index 070e177482a2..1958301546be 100644 --- a/sys/dev/nge/if_nge.c +++ b/sys/dev/nge/if_nge.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 * Bill Paul . All rights reserved. diff --git a/sys/dev/nge/if_ngereg.h b/sys/dev/nge/if_ngereg.h index e27359fc8645..5a46aa64038a 100644 --- a/sys/dev/nge/if_ngereg.h +++ b/sys/dev/nge/if_ngereg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 * Bill Paul . All rights reserved. diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c index a408d10ad20d..ccb34673f7b2 100644 --- a/sys/dev/nmdm/nmdm.c +++ b/sys/dev/nmdm/nmdm.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/sys/dev/nsp/nsp.c b/sys/dev/nsp/nsp.c index 954d1bb98898..d955ff2938b2 100644 --- a/sys/dev/nsp/nsp.c +++ b/sys/dev/nsp/nsp.c @@ -8,7 +8,7 @@ NSP_READ_FIFO_INTERRUPTS | NSP_WRITE_FIFO_INTERRUPTS | \ NSP_USE_MEMIO | NSP_WAIT_FOR_SELECT) -/* +/*- * Copyright (c) 1998, 1999, 2000, 2001 * NetBSD/pc98 porting staff. All rights reserved. * diff --git a/sys/dev/nsp/nsp_pccard.c b/sys/dev/nsp/nsp_pccard.c index 4c61b07d122d..3be1cdbba059 100644 --- a/sys/dev/nsp/nsp_pccard.c +++ b/sys/dev/nsp/nsp_pccard.c @@ -1,7 +1,7 @@ /* $NecBSD: nsp_pisa.c,v 1.4 1999/04/15 01:35:54 kmatsuda Exp $ */ /* $NetBSD$ */ -/* +/*- * [Ported for FreeBSD] * Copyright (c) 2000 * Noriaki Mitsunaga, Mitsuru Iwasaki and Takanori Watanabe. diff --git a/sys/dev/nsp/nspreg.h b/sys/dev/nsp/nspreg.h index 3bfcd9696bcf..81512c91a609 100644 --- a/sys/dev/nsp/nspreg.h +++ b/sys/dev/nsp/nspreg.h @@ -2,7 +2,7 @@ /* $NecBSD: nspreg.h,v 1.4.14.3 2001/06/29 06:27:53 honda Exp $ */ /* $NetBSD$ */ -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1998 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/nsp/nspvar.h b/sys/dev/nsp/nspvar.h index 57614084834f..59af783ade02 100644 --- a/sys/dev/nsp/nspvar.h +++ b/sys/dev/nsp/nspvar.h @@ -2,7 +2,7 @@ /* $NecBSD: nspvar.h,v 1.7.14.5 2001/06/29 06:27:54 honda Exp $ */ /* $NetBSD$ */ -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1998, 1999, 2000, 2001 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/ofw/ofw_bus_if.m b/sys/dev/ofw/ofw_bus_if.m index 87e4fcc41e28..edeee5f655b0 100644 --- a/sys/dev/ofw/ofw_bus_if.m +++ b/sys/dev/ofw/ofw_bus_if.m @@ -1,3 +1,4 @@ +#- # Copyright (c) 2001, 2003 by Thomas Moestl # Copyright (c) 2004 by Marius Strobl # All rights reserved. diff --git a/sys/dev/ofw/ofw_console.c b/sys/dev/ofw/ofw_console.c index 40ac7dc7ca7b..08609944190e 100644 --- a/sys/dev/ofw/ofw_console.c +++ b/sys/dev/ofw/ofw_console.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2001 Benno Rice. * All rights reserved. * diff --git a/sys/dev/ofw/ofw_disk.c b/sys/dev/ofw/ofw_disk.c index 67a9451d94db..5c759d1cee68 100644 --- a/sys/dev/ofw/ofw_disk.c +++ b/sys/dev/ofw/ofw_disk.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2002 Benno Rice * All rights reserved. * diff --git a/sys/dev/ofw/openfirm.c b/sys/dev/ofw/openfirm.c index db87a4a2da5c..f7ef330597b3 100644 --- a/sys/dev/ofw/openfirm.c +++ b/sys/dev/ofw/openfirm.c @@ -1,6 +1,6 @@ /* $NetBSD: Locore.c,v 1.7 2000/08/20 07:04:59 tsubai Exp $ */ -/* +/*- * Copyright (C) 1995, 1996 Wolfgang Solfrank. * Copyright (C) 1995, 1996 TooLs GmbH. * All rights reserved. @@ -33,7 +33,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (C) 2000 Benno Rice. * All rights reserved. * diff --git a/sys/dev/ofw/openfirm.h b/sys/dev/ofw/openfirm.h index acbaad741564..28b95b339761 100644 --- a/sys/dev/ofw/openfirm.h +++ b/sys/dev/ofw/openfirm.h @@ -1,6 +1,6 @@ /* $NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $ */ -/* +/*- * Copyright (C) 1995, 1996 Wolfgang Solfrank. * Copyright (C) 1995, 1996 TooLs GmbH. * All rights reserved. diff --git a/sys/dev/ofw/openfirmio.c b/sys/dev/ofw/openfirmio.c index b67a1f8fb015..d9272d1145d3 100644 --- a/sys/dev/ofw/openfirmio.c +++ b/sys/dev/ofw/openfirmio.c @@ -3,7 +3,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/sys/dev/ofw/openfirmio.h b/sys/dev/ofw/openfirmio.h index c4f21d2897a4..bb020262ccba 100644 --- a/sys/dev/ofw/openfirmio.h +++ b/sys/dev/ofw/openfirmio.h @@ -1,6 +1,6 @@ /* $NetBSD: openfirmio.h,v 1.4 2002/09/06 13:23:19 gehenna Exp $ */ -/* +/*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * diff --git a/sys/dev/owi/if_owi.c b/sys/dev/owi/if_owi.c index c8a1aa8693dd..b33da65059cf 100644 --- a/sys/dev/owi/if_owi.c +++ b/sys/dev/owi/if_owi.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/owi/if_owi_pccard.c b/sys/dev/owi/if_owi_pccard.c index 1720820a453d..e51bda006144 100644 --- a/sys/dev/owi/if_owi_pccard.c +++ b/sys/dev/owi/if_owi_pccard.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/owi/if_wireg.h b/sys/dev/owi/if_wireg.h index 04de3b3538ce..697463fffcad 100644 --- a/sys/dev/owi/if_wireg.h +++ b/sys/dev/owi/if_wireg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/owi/if_wivar.h b/sys/dev/owi/if_wivar.h index 98f197069fd1..a439949e5916 100644 --- a/sys/dev/owi/if_wivar.h +++ b/sys/dev/owi/if_wivar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2002 * M Warner Losh . All rights reserved. * Copyright (c) 1997, 1998, 1999 diff --git a/sys/dev/patm/genrtab/genrtab.c b/sys/dev/patm/genrtab/genrtab.c index eef0749fc8c4..8d696cfa8ef6 100644 --- a/sys/dev/patm/genrtab/genrtab.c +++ b/sys/dev/patm/genrtab/genrtab.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/patm/idt77252reg.h b/sys/dev/patm/idt77252reg.h index c970568f6ac3..13013a2f1056 100644 --- a/sys/dev/patm/idt77252reg.h +++ b/sys/dev/patm/idt77252reg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/patm/if_patm.c b/sys/dev/patm/if_patm.c index 900d1fa7161a..ac01b9586e54 100644 --- a/sys/dev/patm/if_patm.c +++ b/sys/dev/patm/if_patm.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/patm/if_patm_attach.c b/sys/dev/patm/if_patm_attach.c index dd4a52d0e335..f7847250d2ae 100644 --- a/sys/dev/patm/if_patm_attach.c +++ b/sys/dev/patm/if_patm_attach.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/patm/if_patm_intr.c b/sys/dev/patm/if_patm_intr.c index a8f1c3b0a8a7..f17725395d85 100644 --- a/sys/dev/patm/if_patm_intr.c +++ b/sys/dev/patm/if_patm_intr.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/patm/if_patm_ioctl.c b/sys/dev/patm/if_patm_ioctl.c index 359d447cec48..6dc669d99ff3 100644 --- a/sys/dev/patm/if_patm_ioctl.c +++ b/sys/dev/patm/if_patm_ioctl.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/patm/if_patm_rx.c b/sys/dev/patm/if_patm_rx.c index a008b3563a59..01c32435fb7f 100644 --- a/sys/dev/patm/if_patm_rx.c +++ b/sys/dev/patm/if_patm_rx.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/patm/if_patm_tx.c b/sys/dev/patm/if_patm_tx.c index 112251627f56..0c6a99e185a9 100644 --- a/sys/dev/patm/if_patm_tx.c +++ b/sys/dev/patm/if_patm_tx.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/patm/if_patmvar.h b/sys/dev/patm/if_patmvar.h index f26cf17132e5..5cadbc3522da 100644 --- a/sys/dev/patm/if_patmvar.h +++ b/sys/dev/patm/if_patmvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/pbio/pbio.c b/sys/dev/pbio/pbio.c index 14b21f3957e4..84b883da1bc6 100644 --- a/sys/dev/pbio/pbio.c +++ b/sys/dev/pbio/pbio.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000-2004 * Diomidis D. Spinellis, Athens, Greece * All rights reserved. diff --git a/sys/dev/pbio/pbioio.h b/sys/dev/pbio/pbioio.h index a2b6c7e615ae..9a08bfab0254 100644 --- a/sys/dev/pbio/pbioio.h +++ b/sys/dev/pbio/pbioio.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000-2004 * Diomidis D. Spinellis, Athens, Greece * All rights reserved. diff --git a/sys/dev/pccard/card_if.m b/sys/dev/pccard/card_if.m index 40c429eac148..5328bc6daf0f 100644 --- a/sys/dev/pccard/card_if.m +++ b/sys/dev/pccard/card_if.m @@ -1,4 +1,4 @@ -# +#- # Copyright (c) 1999 M. Warner Losh. # All rights reserved. # diff --git a/sys/dev/pccard/pccard.c b/sys/dev/pccard/pccard.c index 3509a8c0690c..020f89494f12 100644 --- a/sys/dev/pccard/pccard.c +++ b/sys/dev/pccard/pccard.c @@ -1,6 +1,6 @@ /* $NetBSD: pcmcia.c,v 1.23 2000/07/28 19:17:02 drochner Exp $ */ -/* +/*- * Copyright (c) 1997 Marc Horowitz. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/pccard/pccard_cis.c b/sys/dev/pccard/pccard_cis.c index 99ec42780503..2fa88efd17cb 100644 --- a/sys/dev/pccard/pccard_cis.c +++ b/sys/dev/pccard/pccard_cis.c @@ -1,7 +1,7 @@ /* $NetBSD: pcmcia_cis.c,v 1.17 2000/02/10 09:01:52 chopps Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1997 Marc Horowitz. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/pccard/pccard_cis.h b/sys/dev/pccard/pccard_cis.h index 9c8221cacbe1..d6b9c3899f86 100644 --- a/sys/dev/pccard/pccard_cis.h +++ b/sys/dev/pccard/pccard_cis.h @@ -1,6 +1,6 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1997 Marc Horowitz. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/pccard/pccard_cis_quirks.c b/sys/dev/pccard/pccard_cis_quirks.c index 7e7bf519fa35..e465e381c741 100644 --- a/sys/dev/pccard/pccard_cis_quirks.c +++ b/sys/dev/pccard/pccard_cis_quirks.c @@ -5,7 +5,7 @@ __FBSDID("$FreeBSD$"); #define PCCARDDEBUG -/* +/*- * Copyright (c) 1998 Marc Horowitz. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/pccard/pccardreg.h b/sys/dev/pccard/pccardreg.h index f6f67f8dba80..e0f6647771bc 100644 --- a/sys/dev/pccard/pccardreg.h +++ b/sys/dev/pccard/pccardreg.h @@ -1,7 +1,7 @@ /* $NetBSD: pcmciareg.h,v 1.7 1998/10/29 09:45:52 enami Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1997 Marc Horowitz. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/pccard/pccardvar.h b/sys/dev/pccard/pccardvar.h index e6aa22f6b383..37835e2bbebb 100644 --- a/sys/dev/pccard/pccardvar.h +++ b/sys/dev/pccard/pccardvar.h @@ -1,7 +1,7 @@ /* $NetBSD: pcmciavar.h,v 1.12 2000/02/08 12:51:31 enami Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1997 Marc Horowitz. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/pccard/power_if.m b/sys/dev/pccard/power_if.m index d661d5c5ccd9..a85fd01e50e0 100644 --- a/sys/dev/pccard/power_if.m +++ b/sys/dev/pccard/power_if.m @@ -1,4 +1,4 @@ -# +#- # Copyright (c) 1999 M. Warner Losh. # All rights reserved. # diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c index 418696e2bc2a..363515637519 100644 --- a/sys/dev/pccbb/pccbb.c +++ b/sys/dev/pccbb/pccbb.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2002-2004 M. Warner Losh. * Copyright (c) 2000-2001 Jonathan Chen. * All rights reserved. diff --git a/sys/dev/pccbb/pccbb_isa.c b/sys/dev/pccbb/pccbb_isa.c index 9d5818e25865..e173ab29352f 100644 --- a/sys/dev/pccbb/pccbb_isa.c +++ b/sys/dev/pccbb/pccbb_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2002-2004 M. Warner Losh. * All rights reserved. * diff --git a/sys/dev/pccbb/pccbb_pci.c b/sys/dev/pccbb/pccbb_pci.c index 280141584222..461a85f329d1 100644 --- a/sys/dev/pccbb/pccbb_pci.c +++ b/sys/dev/pccbb/pccbb_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2002-2004 M. Warner Losh. * Copyright (c) 2000-2001 Jonathan Chen. * All rights reserved. diff --git a/sys/dev/pccbb/pccbbdevid.h b/sys/dev/pccbb/pccbbdevid.h index 85df56a61f83..0e3ab5b25e6b 100644 --- a/sys/dev/pccbb/pccbbdevid.h +++ b/sys/dev/pccbb/pccbbdevid.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001-2004 M. Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/pccbb/pccbbreg.h b/sys/dev/pccbb/pccbbreg.h index fddf46739cf6..5c892ff499a4 100644 --- a/sys/dev/pccbb/pccbbreg.h +++ b/sys/dev/pccbb/pccbbreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000,2001 Jonathan Chen. * All rights reserved. * diff --git a/sys/dev/pccbb/pccbbvar.h b/sys/dev/pccbb/pccbbvar.h index 75458af7398b..61dc600cb0c7 100644 --- a/sys/dev/pccbb/pccbbvar.h +++ b/sys/dev/pccbb/pccbbvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003-2004 Warner Losh. * Copyright (c) 2000,2001 Jonathan Chen. * All rights reserved. diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 5fc6f233b76a..0ef7dd1a0dd8 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, Stefan Esser * Copyright (c) 2000, Michael Smith * Copyright (c) 2000, BSDi diff --git a/sys/dev/pci/pci_if.m b/sys/dev/pci/pci_if.m index 635005dc1bcb..107746b25f0a 100644 --- a/sys/dev/pci/pci_if.m +++ b/sys/dev/pci/pci_if.m @@ -1,4 +1,4 @@ -# +#- # Copyright (c) 1998 Doug Rabson # All rights reserved. # diff --git a/sys/dev/pci/pci_private.h b/sys/dev/pci/pci_private.h index 041e8e306d14..fdeeaaab2bae 100644 --- a/sys/dev/pci/pci_private.h +++ b/sys/dev/pci/pci_private.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, Stefan Esser * Copyright (c) 2000, Michael Smith * Copyright (c) 2000, BSDi diff --git a/sys/dev/pci/pcib_if.m b/sys/dev/pci/pcib_if.m index 1ea253800563..c9f480e701a3 100644 --- a/sys/dev/pci/pcib_if.m +++ b/sys/dev/pci/pcib_if.m @@ -1,4 +1,4 @@ -# +#- # Copyright (c) 2000 Doug Rabson # All rights reserved. # diff --git a/sys/dev/pci/pcireg.h b/sys/dev/pci/pcireg.h index 9f0f612848ec..b4de6fd741c5 100644 --- a/sys/dev/pci/pcireg.h +++ b/sys/dev/pci/pcireg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, Stefan Esser * All rights reserved. * diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h index 38eaa1d8c2cc..75bc8d3f9e4d 100644 --- a/sys/dev/pci/pcivar.h +++ b/sys/dev/pci/pcivar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, Stefan Esser * All rights reserved. * diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c index 3b978d7a9873..251f56e594fb 100644 --- a/sys/dev/ppbus/lpt.c +++ b/sys/dev/ppbus/lpt.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1990 William F. Jolitz, TeleMuse * All rights reserved. * diff --git a/sys/dev/ppbus/lptio.h b/sys/dev/ppbus/lptio.h index 8458bc6bd357..e8471d396d20 100644 --- a/sys/dev/ppbus/lptio.h +++ b/sys/dev/ppbus/lptio.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 1994 Geoffrey M. Rehmet * * This program is free software; you may redistribute it and/or diff --git a/sys/dev/ppbus/pcfclock.c b/sys/dev/ppbus/pcfclock.c index 58bbf2c36e0a..0a650552aece 100644 --- a/sys/dev/ppbus/pcfclock.c +++ b/sys/dev/ppbus/pcfclock.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 Sascha Schumann. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ppbus/ppbus_if.m b/sys/dev/ppbus/ppbus_if.m index f21dd837568b..ccc308d23f36 100644 --- a/sys/dev/ppbus/ppbus_if.m +++ b/sys/dev/ppbus/ppbus_if.m @@ -1,4 +1,4 @@ -# +#- # Copyright (c) 1999 Nicolas Souchu # All rights reserved. # diff --git a/sys/dev/ppbus/pps.c b/sys/dev/ppbus/pps.c index 033d1fef0a56..bf7c08b41ece 100644 --- a/sys/dev/ppbus/pps.c +++ b/sys/dev/ppbus/pps.c @@ -1,4 +1,4 @@ -/* +/*- * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * wrote this file. As long as you retain this notice you diff --git a/sys/dev/ppc/ppcvar.h b/sys/dev/ppc/ppcvar.h index ad3f74cd316f..9bef9080aa7a 100644 --- a/sys/dev/ppc/ppcvar.h +++ b/sys/dev/ppc/ppcvar.h @@ -1,4 +1,3 @@ - /*- * Copyright (c) 1997-2000 Nicolas Souchu * Copyright (c) 2001 Alcove - Nicolas Souchu diff --git a/sys/dev/puc/puc.c b/sys/dev/puc/puc.c index e3f192c4dbc4..d078ad18095f 100644 --- a/sys/dev/puc/puc.c +++ b/sys/dev/puc/puc.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Copyright (c) 1996, 1998, 1999 * Christopher G. Demetriou. All rights reserved. * diff --git a/sys/dev/puc/puc_ebus.c b/sys/dev/puc/puc_ebus.c index c7ddeb40153e..12ac8766c8b8 100644 --- a/sys/dev/puc/puc_ebus.c +++ b/sys/dev/puc/puc_ebus.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/puc/puc_pci.c b/sys/dev/puc/puc_pci.c index b4c0cf4ecc69..7d876de81e60 100644 --- a/sys/dev/puc/puc_pci.c +++ b/sys/dev/puc/puc_pci.c @@ -29,7 +29,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (c) 1996, 1998, 1999 * Christopher G. Demetriou. All rights reserved. * diff --git a/sys/dev/puc/puc_sbus.c b/sys/dev/puc/puc_sbus.c index 3d2e7d67a81a..44abd0bccd95 100644 --- a/sys/dev/puc/puc_sbus.c +++ b/sys/dev/puc/puc_sbus.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/puc/pucdata.c b/sys/dev/puc/pucdata.c index 24cfcc199e32..ebfbe3952cbc 100644 --- a/sys/dev/puc/pucdata.c +++ b/sys/dev/puc/pucdata.c @@ -1,6 +1,6 @@ /* $NetBSD: pucdata.c,v 1.25 2001/12/16 22:23:01 thorpej Exp $ */ -/* +/*- * Copyright (c) 1998, 1999 Christopher G. Demetriou. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/puc/pucvar.h b/sys/dev/puc/pucvar.h index f0dbe585f813..e6c390d6d0a8 100644 --- a/sys/dev/puc/pucvar.h +++ b/sys/dev/puc/pucvar.h @@ -27,7 +27,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Copyright (c) 1998, 1999 Christopher G. Demetriou. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ray/if_ray.c b/sys/dev/ray/if_ray.c index 2a6c7415eb21..bed18b256324 100644 --- a/sys/dev/ray/if_ray.c +++ b/sys/dev/ray/if_ray.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2000 * Dr. Duncan McLennan Barclay, dmlb@ragnet.demon.co.uk. * diff --git a/sys/dev/ray/if_raydbg.h b/sys/dev/ray/if_raydbg.h index 2ab5310c91d9..4981da6b85fe 100644 --- a/sys/dev/ray/if_raydbg.h +++ b/sys/dev/ray/if_raydbg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2000 * Dr. Duncan McLennan Barclay, dmlb@ragnet.demon.co.uk. * diff --git a/sys/dev/ray/if_raymib.h b/sys/dev/ray/if_raymib.h index c8ce2551f240..de3bb1641131 100644 --- a/sys/dev/ray/if_raymib.h +++ b/sys/dev/ray/if_raymib.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2000 * Dr. Duncan McLennan Barclay, dmlb@ragnet.demon.co.uk. * diff --git a/sys/dev/ray/if_rayreg.h b/sys/dev/ray/if_rayreg.h index cff653f6d0fb..562279f7aa3d 100644 --- a/sys/dev/ray/if_rayreg.h +++ b/sys/dev/ray/if_rayreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2000 * Dr. Duncan McLennan Barclay, dmlb@ragnet.demon.co.uk. * diff --git a/sys/dev/ray/if_rayvar.h b/sys/dev/ray/if_rayvar.h index 0f9ed5c830c6..0a91859ebf67 100644 --- a/sys/dev/ray/if_rayvar.h +++ b/sys/dev/ray/if_rayvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 2000 * Dr. Duncan McLennan Barclay, dmlb@ragnet.demon.co.uk. * diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index 8a7e49c4ff4f..071dbc777efc 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 1995 by Pavel Antonov, Moscow, Russia. * Copyright (C) 1995 by Andrey A. Chernov, Moscow, Russia. * Copyright (C) 2002 by John Baldwin diff --git a/sys/dev/rc/rcreg.h b/sys/dev/rc/rcreg.h index 321222ed26de..8ba287e7251c 100644 --- a/sys/dev/rc/rcreg.h +++ b/sys/dev/rc/rcreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 1995 by Pavel Antonov, Moscow, Russia. * Copyright (C) 1995 by Andrey A. Chernov, Moscow, Russia. * Copyright (C) 2002 by John Baldwin diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index 35cbd815e933..8440331da711 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998-2003 * Bill Paul . All rights reserved. * diff --git a/sys/dev/rndtest/rndtest.c b/sys/dev/rndtest/rndtest.c index 1912f92262d4..15ddcceeb59c 100644 --- a/sys/dev/rndtest/rndtest.c +++ b/sys/dev/rndtest/rndtest.c @@ -1,6 +1,6 @@ /* $OpenBSD$ */ -/* +/*- * Copyright (c) 2002 Jason L. Wright (jason@thought.net) * All rights reserved. * diff --git a/sys/dev/rndtest/rndtest.h b/sys/dev/rndtest/rndtest.h index 93b7eb8f1291..5a284e9a91de 100644 --- a/sys/dev/rndtest/rndtest.h +++ b/sys/dev/rndtest/rndtest.h @@ -1,7 +1,7 @@ /* $FreeBSD$ */ /* $OpenBSD$ */ -/* +/*- * Copyright (c) 2002 Jason L. Wright (jason@thought.net) * All rights reserved. * diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c index 7bf0669f0cb9..e336bca461d1 100644 --- a/sys/dev/rp/rp.c +++ b/sys/dev/rp/rp.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) Comtrol Corporation * All rights reserved. * diff --git a/sys/dev/rp/rp_isa.c b/sys/dev/rp/rp_isa.c index 9cb567786afb..ebefe4f8b3ad 100644 --- a/sys/dev/rp/rp_isa.c +++ b/sys/dev/rp/rp_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) Comtrol Corporation * All rights reserved. * diff --git a/sys/dev/rp/rpreg.h b/sys/dev/rp/rpreg.h index 1122ace5fb9a..7ab041d3ccb8 100644 --- a/sys/dev/rp/rpreg.h +++ b/sys/dev/rp/rpreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) Comtrol Corporation * All rights reserved. * diff --git a/sys/dev/rp/rpvar.h b/sys/dev/rp/rpvar.h index 9a4a98108972..66aa21966c7b 100644 --- a/sys/dev/rp/rpvar.h +++ b/sys/dev/rp/rpvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) Comtrol Corporation * All rights reserved. * diff --git a/sys/dev/sab/sab.c b/sys/dev/sab/sab.c index dbce512c243a..230fde55bcf5 100644 --- a/sys/dev/sab/sab.c +++ b/sys/dev/sab/sab.c @@ -1,6 +1,6 @@ /* $OpenBSD: sab.c,v 1.7 2002/04/08 17:49:42 jason Exp $ */ -/* +/*- * Copyright (c) 2001 Jason L. Wright (jason@thought.net) * All rights reserved. * diff --git a/sys/dev/sab/sab82532reg.h b/sys/dev/sab/sab82532reg.h index 8b53371972de..77e48216357f 100644 --- a/sys/dev/sab/sab82532reg.h +++ b/sys/dev/sab/sab82532reg.h @@ -1,6 +1,6 @@ /* $OpenBSD: sab82532reg.h,v 1.2 2002/04/08 17:49:42 jason Exp $ */ -/* +/*- * Copyright (c) 2001 Jason L. Wright (jason@thought.net) * All rights reserved. * diff --git a/sys/dev/sbni/if_sbni.c b/sys/dev/sbni/if_sbni.c index 27ebcae4ca27..c5228b318484 100644 --- a/sys/dev/sbni/if_sbni.c +++ b/sys/dev/sbni/if_sbni.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997-2001 Granch, Ltd. All rights reserved. * Author: Denis I.Timofeev * diff --git a/sys/dev/sbni/if_sbni_isa.c b/sys/dev/sbni/if_sbni_isa.c index 0cd88ba696be..956882aeaf99 100644 --- a/sys/dev/sbni/if_sbni_isa.c +++ b/sys/dev/sbni/if_sbni_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997-2001 Granch, Ltd. All rights reserved. * Author: Denis I.Timofeev * diff --git a/sys/dev/sbni/if_sbnireg.h b/sys/dev/sbni/if_sbnireg.h index 70fca443051b..4fec30c62f1f 100644 --- a/sys/dev/sbni/if_sbnireg.h +++ b/sys/dev/sbni/if_sbnireg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997-2001 Granch, Ltd. All rights reserved. * Author: Denis I.Timofeev * diff --git a/sys/dev/sbni/if_sbnivar.h b/sys/dev/sbni/if_sbnivar.h index 8668a6050870..0fe2f09568b9 100644 --- a/sys/dev/sbni/if_sbnivar.h +++ b/sys/dev/sbni/if_sbnivar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997-2001 Granch, Ltd. All rights reserved. * Author: Denis I.Timofeev * diff --git a/sys/dev/sbsh/if_sbshreg.h b/sys/dev/sbsh/if_sbshreg.h index 44404712a952..94cb0aac46c9 100644 --- a/sys/dev/sbsh/if_sbshreg.h +++ b/sys/dev/sbsh/if_sbshreg.h @@ -1,4 +1,4 @@ -/** +/*- * Granch SBNI16 G.SHDSL Modem driver definitions * Written by Denis I. Timofeev, 2002-2003. * diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index ddd3c0f9f3a0..2f9f872668c8 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -1,4 +1,4 @@ -/* +/*- * Device driver for Specialix range (SI/XIO) of serial line multiplexors. * * Copyright (C) 1990, 1992, 1998 Specialix International, diff --git a/sys/dev/si/si.h b/sys/dev/si/si.h index 32f4ab55df5a..c9adefb788e9 100644 --- a/sys/dev/si/si.h +++ b/sys/dev/si/si.h @@ -1,4 +1,4 @@ -/* +/*- * Device driver for Specialix range (SI/XIO) of serial line multiplexors. * 'C' definitions for Specialix serial multiplex driver. * diff --git a/sys/dev/si/si2_z280.c b/sys/dev/si/si2_z280.c index 84179dd8d1ab..6caaf3d577a3 100644 --- a/sys/dev/si/si2_z280.c +++ b/sys/dev/si/si2_z280.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 1998 Specialix International. * * Download code for SI/XIO/SX host cards. diff --git a/sys/dev/si/si3_t225.c b/sys/dev/si/si3_t225.c index 16a928902a98..17980075a658 100644 --- a/sys/dev/si/si3_t225.c +++ b/sys/dev/si/si3_t225.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 1998 Specialix International. * * Download code for SI/XIO/SX host cards. diff --git a/sys/dev/si/si_eisa.c b/sys/dev/si/si_eisa.c index 6be3c87af6be..edb0a8ef0359 100644 --- a/sys/dev/si/si_eisa.c +++ b/sys/dev/si/si_eisa.c @@ -1,4 +1,4 @@ -/* +/*- * Device driver for Specialix range (SI/XIO) of serial line multiplexors. * * Copyright (C) 2000, Peter Wemm diff --git a/sys/dev/si/si_isa.c b/sys/dev/si/si_isa.c index 91cc6e869a9c..5758a8391d4b 100644 --- a/sys/dev/si/si_isa.c +++ b/sys/dev/si/si_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Device driver for Specialix range (SI/XIO) of serial line multiplexors. * * Copyright (C) 2000, Peter Wemm diff --git a/sys/dev/si/sireg.h b/sys/dev/si/sireg.h index 0d59ea9fff62..4b4ef6ad6063 100644 --- a/sys/dev/si/sireg.h +++ b/sys/dev/si/sireg.h @@ -1,4 +1,4 @@ -/* +/*- * Device driver for Specialix range (SI/XIO) of serial line multiplexors. * 'C' definitions for Specialix serial multiplex driver. * diff --git a/sys/dev/si/sivar.h b/sys/dev/si/sivar.h index 8e28344b6b14..e479f470faf4 100644 --- a/sys/dev/si/sivar.h +++ b/sys/dev/si/sivar.h @@ -1,4 +1,4 @@ -/* +/*- * Device driver for Specialix range (SI/XIO) of serial line multiplexors. * * Copyright (C) 2000, Peter Wemm diff --git a/sys/dev/sio/sio_isa.c b/sys/dev/sio/sio_isa.c index 137f47ecde5f..40541e662521 100644 --- a/sys/dev/sio/sio_isa.c +++ b/sys/dev/sio/sio_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 M. Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/sio/sio_pccard.c b/sys/dev/sio/sio_pccard.c index cafb143eddd7..713393a87097 100644 --- a/sys/dev/sio/sio_pccard.c +++ b/sys/dev/sio/sio_pccard.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 M. Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/smbus/smbus_if.m b/sys/dev/smbus/smbus_if.m index 781a15961292..6b213e1f4c23 100644 --- a/sys/dev/smbus/smbus_if.m +++ b/sys/dev/smbus/smbus_if.m @@ -1,4 +1,4 @@ -# +#- # Copyright (c) 1998 Nicolas Souchu # All rights reserved. # diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c index ed8fcbb8dc8b..07cefd566776 100644 --- a/sys/dev/sn/if_sn.c +++ b/sys/dev/sn/if_sn.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996 Gardner Buchanan * All rights reserved. * diff --git a/sys/dev/sn/if_sn_isa.c b/sys/dev/sn/if_sn_isa.c index f88f3385d28b..7907f744764c 100644 --- a/sys/dev/sn/if_sn_isa.c +++ b/sys/dev/sn/if_sn_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 M. Warner Losh * All rights reserved. * diff --git a/sys/dev/sn/if_snreg.h b/sys/dev/sn/if_snreg.h index 55dba1def772..3f5efd01f5a7 100644 --- a/sys/dev/sn/if_snreg.h +++ b/sys/dev/sn/if_snreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996 Gardner Buchanan * All rights reserved. * diff --git a/sys/dev/sn/if_snvar.h b/sys/dev/sn/if_snvar.h index 284b43f85dbf..91c6d8a5b596 100644 --- a/sys/dev/sn/if_snvar.h +++ b/sys/dev/sn/if_snvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 M. Warner Losh * All rights reserved. * diff --git a/sys/dev/snc/dp83932.c b/sys/dev/snc/dp83932.c index 582b77094db0..1ffd4f15cd9c 100644 --- a/sys/dev/snc/dp83932.c +++ b/sys/dev/snc/dp83932.c @@ -2,7 +2,7 @@ /* $NecBSD: dp83932.c,v 1.5 1999/07/29 05:08:44 kmatsuda Exp $ */ /* $NetBSD: if_snc.c,v 1.18 1998/04/25 21:27:40 scottr Exp $ */ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Kouichi Matsuda. All rights reserved. * @@ -45,7 +45,7 @@ * (64 * 16 bits) Microwire Serial EEPROM. */ -/* +/*- * National Semiconductor DP8393X SONIC Driver * Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk) * You may use, copy, and modify this program so long as you retain the diff --git a/sys/dev/snc/dp83932reg.h b/sys/dev/snc/dp83932reg.h index b72fe86afc6b..31ab550b83ca 100644 --- a/sys/dev/snc/dp83932reg.h +++ b/sys/dev/snc/dp83932reg.h @@ -2,7 +2,7 @@ /* $NecBSD: dp83932reg.h,v 1.2 1999/02/12 05:50:13 kmatsuda Exp $ */ /* $NetBSD: if_snreg.h,v 1.4 1997/06/15 20:20:12 scottr Exp $ */ -/* +/*- * Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk) * You may use, copy, and modify this program so long as you retain the * copyright line. diff --git a/sys/dev/snc/dp83932subr.c b/sys/dev/snc/dp83932subr.c index 7e4b1d75df54..064cb2c3d614 100644 --- a/sys/dev/snc/dp83932subr.c +++ b/sys/dev/snc/dp83932subr.c @@ -1,7 +1,7 @@ /* $NecBSD: dp83932subr.c,v 1.5.6.2 1999/10/09 05:47:23 kmatsuda Exp $ */ /* $NetBSD$ */ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Kouichi Matsuda. All rights reserved. * diff --git a/sys/dev/snc/dp83932subr.h b/sys/dev/snc/dp83932subr.h index 78fa636cc890..f5df4f97970f 100644 --- a/sys/dev/snc/dp83932subr.h +++ b/sys/dev/snc/dp83932subr.h @@ -1,8 +1,8 @@ /* $FreeBSD$ */ /* $NecBSD: dp83932subr.h,v 1.5 1999/02/02 00:47:25 kmatsuda Exp $ */ /* $NetBSD$ */ - -/* + +/*- * Copyright (c) 1997, 1998, 1999 * Kouichi Matsuda. All rights reserved. * diff --git a/sys/dev/snc/dp83932var.h b/sys/dev/snc/dp83932var.h index fcc6a2245284..f621397b930d 100644 --- a/sys/dev/snc/dp83932var.h +++ b/sys/dev/snc/dp83932var.h @@ -2,12 +2,11 @@ /* $NecBSD: dp83932var.h,v 1.3 1999/01/24 01:39:51 kmatsuda Exp $ */ /* $NetBSD: if_snvar.h,v 1.12 1998/05/01 03:42:47 scottr Exp $ */ -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1997, 1998, 1999 * Kouichi Matsuda. All rights reserved. - */ -/* + * * Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk) * You may use, copy, and modify this program so long as you retain the * copyright line. diff --git a/sys/dev/snc/if_snc.c b/sys/dev/snc/if_snc.c index 69a6ca60315e..7cbdd804f7ba 100644 --- a/sys/dev/snc/if_snc.c +++ b/sys/dev/snc/if_snc.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, David Greenman * All rights reserved. * diff --git a/sys/dev/snc/if_snc_cbus.c b/sys/dev/snc/if_snc_cbus.c index 19a0505ded4f..1b9ef3ef5655 100644 --- a/sys/dev/snc/if_snc_cbus.c +++ b/sys/dev/snc/if_snc_cbus.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, David Greenman * All rights reserved. * diff --git a/sys/dev/snc/if_snc_pccard.c b/sys/dev/snc/if_snc_pccard.c index 1478d26bd307..c22fa756e42f 100644 --- a/sys/dev/snc/if_snc_pccard.c +++ b/sys/dev/snc/if_snc_pccard.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, David Greenman * All rights reserved. * diff --git a/sys/dev/snc/if_sncreg.h b/sys/dev/snc/if_sncreg.h index 30b0bb755992..888aa4f3ceb3 100644 --- a/sys/dev/snc/if_sncreg.h +++ b/sys/dev/snc/if_sncreg.h @@ -2,7 +2,7 @@ /* $NecBSD: if_snreg.h,v 1.3 1999/01/24 01:39:52 kmatsuda Exp $ */ /* $NetBSD$ */ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Kouichi Matsuda. All rights reserved. * diff --git a/sys/dev/snc/if_sncvar.h b/sys/dev/snc/if_sncvar.h index 33e39f32a3bf..8b6a75b99812 100644 --- a/sys/dev/snc/if_sncvar.h +++ b/sys/dev/snc/if_sncvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, David Greenman * All rights reserved. * diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index c6d8c32eeae0..643c6e7ba2cb 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995 Ugen J.S.Antsilevich * * Redistribution and use in source forms, with and without modification, diff --git a/sys/dev/sound/driver.c b/sys/dev/sound/driver.c index f9952665b71b..7da109923b16 100644 --- a/sys/dev/sound/driver.c +++ b/sys/dev/sound/driver.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/isa/ad1816.c b/sys/dev/sound/isa/ad1816.c index 40e006b36636..f34a5c623f65 100644 --- a/sys/dev/sound/isa/ad1816.c +++ b/sys/dev/sound/isa/ad1816.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * Copyright Luigi Rizzo, 1997,1998 * Copyright by Hannu Savolainen 1994, 1995 diff --git a/sys/dev/sound/isa/ad1816.h b/sys/dev/sound/isa/ad1816.h index 078523f1d12e..3fe4a3dc3ff1 100644 --- a/sys/dev/sound/isa/ad1816.h +++ b/sys/dev/sound/isa/ad1816.h @@ -1,4 +1,4 @@ -/* +/*- * (C) 1997 Luigi Rizzo (luigi@iet.unipi.it) * * This file contains information and macro definitions for diff --git a/sys/dev/sound/isa/es1888.c b/sys/dev/sound/isa/es1888.c index 24830a258edc..bc89ca4b3bba 100644 --- a/sys/dev/sound/isa/es1888.c +++ b/sys/dev/sound/isa/es1888.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Doug Rabson * All rights reserved. * diff --git a/sys/dev/sound/isa/ess.c b/sys/dev/sound/isa/ess.c index 1cf756a28aa5..248aebe833ba 100644 --- a/sys/dev/sound/isa/ess.c +++ b/sys/dev/sound/isa/ess.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * Copyright 1997,1998 Luigi Rizzo. * diff --git a/sys/dev/sound/isa/gusc.c b/sys/dev/sound/isa/gusc.c index bd88322f484d..cb1b1ade4e9a 100644 --- a/sys/dev/sound/isa/gusc.c +++ b/sys/dev/sound/isa/gusc.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Seigo Tanimura * Copyright (c) 1999 Ville-Pertti Keinonen * All rights reserved. diff --git a/sys/dev/sound/isa/mss.c b/sys/dev/sound/isa/mss.c index 3a39569954b9..60b1927380a5 100644 --- a/sys/dev/sound/isa/mss.c +++ b/sys/dev/sound/isa/mss.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 George Reid * Copyright (c) 1999 Cameron Grant * Copyright Luigi Rizzo, 1997,1998 diff --git a/sys/dev/sound/isa/mss.h b/sys/dev/sound/isa/mss.h index d97c70a14cf2..d9247f93b7e6 100644 --- a/sys/dev/sound/isa/mss.h +++ b/sys/dev/sound/isa/mss.h @@ -1,4 +1,4 @@ -/* +/*- * file: mss.h * * (C) 1997 Luigi Rizzo (luigi@iet.unipi.it) @@ -8,6 +8,34 @@ * */ +/*- + * Copyright (c) 1999 Doug Rabson + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. + * + * $FreeBSD$ + */ + /* * @@ -278,34 +306,6 @@ MIX_NONE(SOUND_MIXER_LINE3), SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD | \ SOUND_MASK_IGAIN | SOUND_MASK_LINE1 ) -/*- - * Copyright (c) 1999 Doug Rabson - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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. - * - * $FreeBSD$ - */ - /* * Register definitions for the Yamaha OPL3-SA[23x]. */ diff --git a/sys/dev/sound/isa/sb16.c b/sys/dev/sound/isa/sb16.c index 25ad11c25b7a..58cb46ff5def 100644 --- a/sys/dev/sound/isa/sb16.c +++ b/sys/dev/sound/isa/sb16.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * Copyright 1997,1998 Luigi Rizzo. * diff --git a/sys/dev/sound/isa/sb8.c b/sys/dev/sound/isa/sb8.c index 53e508c728d1..eefe02544536 100644 --- a/sys/dev/sound/isa/sb8.c +++ b/sys/dev/sound/isa/sb8.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * Copyright 1997,1998 Luigi Rizzo. * diff --git a/sys/dev/sound/isa/sbc.c b/sys/dev/sound/isa/sbc.c index 7783c084db9c..d41cf1029307 100644 --- a/sys/dev/sound/isa/sbc.c +++ b/sys/dev/sound/isa/sbc.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Seigo Tanimura * All rights reserved. * diff --git a/sys/dev/sound/isa/sndbuf_dma.c b/sys/dev/sound/isa/sndbuf_dma.c index 2b980807245e..9e45cde9636d 100644 --- a/sys/dev/sound/isa/sndbuf_dma.c +++ b/sys/dev/sound/isa/sndbuf_dma.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pci/als4000.c b/sys/dev/sound/pci/als4000.c index edfb55b97c1c..6f909ccbb0ed 100644 --- a/sys/dev/sound/pci/als4000.c +++ b/sys/dev/sound/pci/als4000.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Orion Hodson * All rights reserved. * diff --git a/sys/dev/sound/pci/als4000.h b/sys/dev/sound/pci/als4000.h index a6a67df786bc..00661a039b45 100644 --- a/sys/dev/sound/pci/als4000.h +++ b/sys/dev/sound/pci/als4000.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Orion Hodson * All rights reserved. * diff --git a/sys/dev/sound/pci/aureal.c b/sys/dev/sound/pci/aureal.c index 68bebb30469d..8ff1b4057696 100644 --- a/sys/dev/sound/pci/aureal.c +++ b/sys/dev/sound/pci/aureal.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pci/aureal.h b/sys/dev/sound/pci/aureal.h index d710b2e0ba85..e835c7119fcb 100644 --- a/sys/dev/sound/pci/aureal.h +++ b/sys/dev/sound/pci/aureal.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pci/cmi.c b/sys/dev/sound/pci/cmi.c index 857592af000d..196fb69353dc 100644 --- a/sys/dev/sound/pci/cmi.c +++ b/sys/dev/sound/pci/cmi.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 Orion Hodson * All rights reserved. * diff --git a/sys/dev/sound/pci/cmireg.h b/sys/dev/sound/pci/cmireg.h index 9e838a6faad3..5c468b55ed8b 100644 --- a/sys/dev/sound/pci/cmireg.h +++ b/sys/dev/sound/pci/cmireg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/sound/pci/cs4281.c b/sys/dev/sound/pci/cs4281.c index ea9e0fcd33ba..f8da280cb43a 100644 --- a/sys/dev/sound/pci/cs4281.c +++ b/sys/dev/sound/pci/cs4281.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 Orion Hodson * All rights reserved. * diff --git a/sys/dev/sound/pci/cs4281.h b/sys/dev/sound/pci/cs4281.h index 68a71e7b7f0a..c7b3799ab89d 100644 --- a/sys/dev/sound/pci/cs4281.h +++ b/sys/dev/sound/pci/cs4281.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 Orion Hodson * All rights reserved. * diff --git a/sys/dev/sound/pci/csa.c b/sys/dev/sound/pci/csa.c index 5cc205abfcb9..d9823d732e25 100644 --- a/sys/dev/sound/pci/csa.c +++ b/sys/dev/sound/pci/csa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Seigo Tanimura * All rights reserved. * diff --git a/sys/dev/sound/pci/csapcm.c b/sys/dev/sound/pci/csapcm.c index c53647db2dd5..753f518e2502 100644 --- a/sys/dev/sound/pci/csapcm.c +++ b/sys/dev/sound/pci/csapcm.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Seigo Tanimura * All rights reserved. * diff --git a/sys/dev/sound/pci/ds1-fw.h b/sys/dev/sound/pci/ds1-fw.h index 72a052a2b9bc..a34d2338954c 100644 --- a/sys/dev/sound/pci/ds1-fw.h +++ b/sys/dev/sound/pci/ds1-fw.h @@ -1,4 +1,5 @@ -/* ============================================================================= +/*- + * ============================================================================= * Copyright (c) 1997-1999 Yamaha Corporation. All Rights Reserved. * * Title: diff --git a/sys/dev/sound/pci/ds1.c b/sys/dev/sound/pci/ds1.c index 59890d7fc5fc..fa70de1d149e 100644 --- a/sys/dev/sound/pci/ds1.c +++ b/sys/dev/sound/pci/ds1.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pci/emu10k1.c b/sys/dev/sound/pci/emu10k1.c index aeeba4dac1b9..3716cc07ff29 100644 --- a/sys/dev/sound/pci/emu10k1.c +++ b/sys/dev/sound/pci/emu10k1.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 David O'Brien * Copyright (c) 2003 Orlando Bassotto * Copyright (c) 1999 Cameron Grant diff --git a/sys/dev/sound/pci/es137x.c b/sys/dev/sound/pci/es137x.c index 7b9797312065..b23245e9328f 100644 --- a/sys/dev/sound/pci/es137x.c +++ b/sys/dev/sound/pci/es137x.c @@ -1,4 +1,4 @@ -/* +/*- * Support the ENSONIQ AudioPCI board and Creative Labs SoundBlaster PCI * boards based on the ES1370, ES1371 and ES1373 chips. * diff --git a/sys/dev/sound/pci/es137x.h b/sys/dev/sound/pci/es137x.h index 076fe3c01a1b..8d9b9915050a 100644 --- a/sys/dev/sound/pci/es137x.h +++ b/sys/dev/sound/pci/es137x.h @@ -1,4 +1,4 @@ -/* +/*- * This supports the ENSONIQ AudioPCI board based on the ES1370. * * Copyright (c) 1998 Joachim Kuebart diff --git a/sys/dev/sound/pci/fm801.c b/sys/dev/sound/pci/fm801.c index 1bc52e96553e..9875e0e4b2cd 100644 --- a/sys/dev/sound/pci/fm801.c +++ b/sys/dev/sound/pci/fm801.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 Dmitry Dicky diwil@dataart.com * All rights reserved. * diff --git a/sys/dev/sound/pci/ich.c b/sys/dev/sound/pci/ich.c index 8756993d2438..af27f810b8a3 100644 --- a/sys/dev/sound/pci/ich.c +++ b/sys/dev/sound/pci/ich.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 Katsurajima Naoto * Copyright (c) 2001 Cameron Grant * All rights reserved. diff --git a/sys/dev/sound/pci/ich.h b/sys/dev/sound/pci/ich.h index 8f6cf68bcb48..be3f3fca3b4a 100644 --- a/sys/dev/sound/pci/ich.h +++ b/sys/dev/sound/pci/ich.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 Katsurajima Naoto * Copyright (c) 2001 Cameron Grant * All rights reserved. diff --git a/sys/dev/sound/pci/neomagic-coeff.h b/sys/dev/sound/pci/neomagic-coeff.h index f6cdecfd2f02..2fec6427ae14 100644 --- a/sys/dev/sound/pci/neomagic-coeff.h +++ b/sys/dev/sound/pci/neomagic-coeff.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pci/neomagic.c b/sys/dev/sound/pci/neomagic.c index 5c4619b8c862..3ed79e5cfb88 100644 --- a/sys/dev/sound/pci/neomagic.c +++ b/sys/dev/sound/pci/neomagic.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pci/neomagic.h b/sys/dev/sound/pci/neomagic.h index be5e7e296498..0b87f99cbf97 100644 --- a/sys/dev/sound/pci/neomagic.h +++ b/sys/dev/sound/pci/neomagic.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pci/solo.c b/sys/dev/sound/pci/solo.c index 5cb0c1395ea8..ed102753c1b8 100644 --- a/sys/dev/sound/pci/solo.c +++ b/sys/dev/sound/pci/solo.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/sound/pci/t4dwave.c b/sys/dev/sound/pci/t4dwave.c index 8bcc588f3958..f570f0773472 100644 --- a/sys/dev/sound/pci/t4dwave.c +++ b/sys/dev/sound/pci/t4dwave.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pci/t4dwave.h b/sys/dev/sound/pci/t4dwave.h index 67e3e4993501..4a2ec626c508 100644 --- a/sys/dev/sound/pci/t4dwave.h +++ b/sys/dev/sound/pci/t4dwave.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pci/via8233.c b/sys/dev/sound/pci/via8233.c index 851d7725b45d..2c338685837f 100644 --- a/sys/dev/sound/pci/via8233.c +++ b/sys/dev/sound/pci/via8233.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2002 Orion Hodson * Portions of this code derived from via82c686.c: * Copyright (c) 2000 David Jones diff --git a/sys/dev/sound/pci/via8233.h b/sys/dev/sound/pci/via8233.h index bc6f57aa6208..a38afc96255c 100644 --- a/sys/dev/sound/pci/via8233.h +++ b/sys/dev/sound/pci/via8233.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2002 Orion Hodson * All rights reserved. * diff --git a/sys/dev/sound/pci/via82c686.c b/sys/dev/sound/pci/via82c686.c index 9ed693b1e9b2..6a94a1992fe7 100644 --- a/sys/dev/sound/pci/via82c686.c +++ b/sys/dev/sound/pci/via82c686.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 David Jones * All rights reserved. * diff --git a/sys/dev/sound/pci/vibes.c b/sys/dev/sound/pci/vibes.c index 6fd1f8fa1462..801a2edaab63 100644 --- a/sys/dev/sound/pci/vibes.c +++ b/sys/dev/sound/pci/vibes.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Orion Hodson * All rights reserved. * diff --git a/sys/dev/sound/pci/vibes.h b/sys/dev/sound/pci/vibes.h index 36cbadd66781..d1eac407efbe 100644 --- a/sys/dev/sound/pci/vibes.h +++ b/sys/dev/sound/pci/vibes.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Orion Hodson * All rights reserved. * diff --git a/sys/dev/sound/pcm/ac97.c b/sys/dev/sound/pcm/ac97.c index a6303f93c2fd..e2313661aeef 100644 --- a/sys/dev/sound/pcm/ac97.c +++ b/sys/dev/sound/pcm/ac97.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pcm/ac97.h b/sys/dev/sound/pcm/ac97.h index 933281cb8a9e..2d2db4b22f5e 100644 --- a/sys/dev/sound/pcm/ac97.h +++ b/sys/dev/sound/pcm/ac97.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pcm/ac97_if.m b/sys/dev/sound/pcm/ac97_if.m index 36c5c19091a6..19f7378d1c6d 100644 --- a/sys/dev/sound/pcm/ac97_if.m +++ b/sys/dev/sound/pcm/ac97_if.m @@ -1,3 +1,4 @@ +#- # KOBJ # # Copyright (c) 2000 Cameron Grant diff --git a/sys/dev/sound/pcm/ac97_patch.c b/sys/dev/sound/pcm/ac97_patch.c index e5e728f8b314..05c73d7553a7 100644 --- a/sys/dev/sound/pcm/ac97_patch.c +++ b/sys/dev/sound/pcm/ac97_patch.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright 2002 FreeBSD, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/sound/pcm/ac97_patch.h b/sys/dev/sound/pcm/ac97_patch.h index 740031d2ed3a..d0184c4c6be2 100644 --- a/sys/dev/sound/pcm/ac97_patch.h +++ b/sys/dev/sound/pcm/ac97_patch.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright 2003 FreeBSD, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/sound/pcm/buffer.c b/sys/dev/sound/pcm/buffer.c index 096262c2ccf3..9ca6a3238441 100644 --- a/sys/dev/sound/pcm/buffer.c +++ b/sys/dev/sound/pcm/buffer.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pcm/buffer.h b/sys/dev/sound/pcm/buffer.h index 48981b5c4078..7b2bffbe127b 100644 --- a/sys/dev/sound/pcm/buffer.h +++ b/sys/dev/sound/pcm/buffer.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index cf970c7132a7..2948e41c9d2d 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * Portions Copyright by Luigi Rizzo - 1997-99 * All rights reserved. diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h index f2fb5957ae1d..23cd7199f58b 100644 --- a/sys/dev/sound/pcm/channel.h +++ b/sys/dev/sound/pcm/channel.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pcm/channel_if.m b/sys/dev/sound/pcm/channel_if.m index 9d8e289509c2..cdc6a3b6f2b3 100644 --- a/sys/dev/sound/pcm/channel_if.m +++ b/sys/dev/sound/pcm/channel_if.m @@ -1,3 +1,4 @@ +#- # KOBJ # # Copyright (c) 2000 Cameron Grant diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 64088f95117c..1adc6ceed341 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pcm/dsp.h b/sys/dev/sound/pcm/dsp.h index 0a42e74ef1c1..0d067ededb1a 100644 --- a/sys/dev/sound/pcm/dsp.h +++ b/sys/dev/sound/pcm/dsp.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pcm/fake.c b/sys/dev/sound/pcm/fake.c index 1fd0900bff9f..ba9c4b641303 100644 --- a/sys/dev/sound/pcm/fake.c +++ b/sys/dev/sound/pcm/fake.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pcm/feeder.c b/sys/dev/sound/pcm/feeder.c index 0ec36df6f80a..5bc7b81ae2b9 100644 --- a/sys/dev/sound/pcm/feeder.c +++ b/sys/dev/sound/pcm/feeder.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pcm/feeder.h b/sys/dev/sound/pcm/feeder.h index 61d42255d966..1a9c37b751aa 100644 --- a/sys/dev/sound/pcm/feeder.h +++ b/sys/dev/sound/pcm/feeder.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pcm/feeder_fmt.c b/sys/dev/sound/pcm/feeder_fmt.c index 59d7edc485f5..7eb66f515fd1 100644 --- a/sys/dev/sound/pcm/feeder_fmt.c +++ b/sys/dev/sound/pcm/feeder_fmt.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pcm/feeder_if.m b/sys/dev/sound/pcm/feeder_if.m index a100a6dbf0ea..83c0fb073b53 100644 --- a/sys/dev/sound/pcm/feeder_if.m +++ b/sys/dev/sound/pcm/feeder_if.m @@ -1,3 +1,4 @@ +#- # KOBJ # # Copyright (c) 2000 Cameron Grant diff --git a/sys/dev/sound/pcm/feeder_rate.c b/sys/dev/sound/pcm/feeder_rate.c index c3752a0ad7b1..55d51fc1e2dc 100644 --- a/sys/dev/sound/pcm/feeder_rate.c +++ b/sys/dev/sound/pcm/feeder_rate.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Orion Hodson * All rights reserved. * diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index f40b4301abd5..fed0fc5a3be5 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pcm/mixer.h b/sys/dev/sound/pcm/mixer.h index 22bd22aa6c3f..2c8dff753e36 100644 --- a/sys/dev/sound/pcm/mixer.h +++ b/sys/dev/sound/pcm/mixer.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pcm/mixer_if.m b/sys/dev/sound/pcm/mixer_if.m index 38d99fbd05df..9bd974ce7d9e 100644 --- a/sys/dev/sound/pcm/mixer_if.m +++ b/sys/dev/sound/pcm/mixer_if.m @@ -1,3 +1,4 @@ +#- # KOBJ # # Copyright (c) 2000 Cameron Grant diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index c8e63877394c..7113bf1e6d24 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 4446b3241e9e..fd4ce76bf80f 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * (C) 1997 Luigi Rizzo (luigi@iet.unipi.it) * All rights reserved. diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h index f1fd6df23d3e..e4cac240247d 100644 --- a/sys/dev/sound/pcm/sound.h +++ b/sys/dev/sound/pcm/sound.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Cameron Grant * Copyright by Hannu Savolainen 1995 * All rights reserved. diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index ce67fb1559c4..91a114e65706 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/pcm/vchan.h b/sys/dev/sound/pcm/vchan.h index 99b0d41399a5..cb9e1c8ea17c 100644 --- a/sys/dev/sound/pcm/vchan.h +++ b/sys/dev/sound/pcm/vchan.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 Cameron Grant * All rights reserved. * diff --git a/sys/dev/sound/sbus/apcdmareg.h b/sys/dev/sound/sbus/apcdmareg.h index 28abd8b16dc6..d4296adbe9fe 100644 --- a/sys/dev/sound/sbus/apcdmareg.h +++ b/sys/dev/sound/sbus/apcdmareg.h @@ -1,7 +1,7 @@ /* $FreeBSD$ */ /* $OpenBSD: apcdmareg.h,v 1.2 2003/06/02 18:53:18 jason Exp $ */ -/* +/*- * Copyright (c) 2001 Jason L. Wright (jason@thought.net) * All rights reserved. * diff --git a/sys/dev/sound/sbus/cs4231.c b/sys/dev/sound/sbus/cs4231.c index 5a236a6b5f0a..11f6b0806bb2 100644 --- a/sys/dev/sound/sbus/cs4231.c +++ b/sys/dev/sound/sbus/cs4231.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1999 Jason L. Wright (jason@thought.net) * Copyright (c) 2004 Pyun YongHyeon * All rights reserved. diff --git a/sys/dev/sound/sbus/cs4231.h b/sys/dev/sound/sbus/cs4231.h index 2b160c178da6..26ca399a0fe0 100644 --- a/sys/dev/sound/sbus/cs4231.h +++ b/sys/dev/sound/sbus/cs4231.h @@ -35,7 +35,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* +/** * Register defs for Crystal Semiconductor CS4231 Audio Codec/mixer * chip, used on Gravis UltraSound MAX cards. * diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 18b5bfb4072f..a9c38e404b8f 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -1,7 +1,7 @@ /* $NetBSD: uaudio.c,v 1.91 2004/11/05 17:46:14 kent Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/sound/usb/uaudio.h b/sys/dev/sound/usb/uaudio.h index 9ba8d97d10c8..ff748368d294 100644 --- a/sys/dev/sound/usb/uaudio.h +++ b/sys/dev/sound/usb/uaudio.h @@ -1,6 +1,6 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2000-2002 Hiroyuki Aizu * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/sound/usb/uaudio_pcm.c b/sys/dev/sound/usb/uaudio_pcm.c index 34412759eeb0..c71e58095d0e 100644 --- a/sys/dev/sound/usb/uaudio_pcm.c +++ b/sys/dev/sound/usb/uaudio_pcm.c @@ -1,6 +1,6 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2000-2002 Hiroyuki Aizu * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/sound/usb/uaudioreg.h b/sys/dev/sound/usb/uaudioreg.h index dd402e297041..3cc09ba5ae45 100644 --- a/sys/dev/sound/usb/uaudioreg.h +++ b/sys/dev/sound/usb/uaudioreg.h @@ -1,7 +1,7 @@ /* $NetBSD: uaudioreg.h,v 1.12 2004/11/05 19:08:29 kent Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/sr/if_sr.c b/sys/dev/sr/if_sr.c index 88668a7cb370..033b3393145f 100644 --- a/sys/dev/sr/if_sr.c +++ b/sys/dev/sr/if_sr.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996 - 2001 John Hay. * Copyright (c) 1996 SDL Communications, Inc. * All rights reserved. diff --git a/sys/dev/sr/if_sr.h b/sys/dev/sr/if_sr.h index a55a6d3f6b56..c66f667f0023 100644 --- a/sys/dev/sr/if_sr.h +++ b/sys/dev/sr/if_sr.h @@ -1,4 +1,4 @@ -/* +/*- * if_sr.h * * Copyright (C) 1997-1999 Whistle Communications Inc. diff --git a/sys/dev/sr/if_sr_isa.c b/sys/dev/sr/if_sr_isa.c index e9a00764f5ee..510a32b74196 100644 --- a/sys/dev/sr/if_sr_isa.c +++ b/sys/dev/sr/if_sr_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996 - 2001 John Hay. * Copyright (c) 1996 SDL Communications, Inc. * All rights reserved. diff --git a/sys/dev/sr/if_sr_pci.c b/sys/dev/sr/if_sr_pci.c index dd41d74bcf58..389476126660 100644 --- a/sys/dev/sr/if_sr_pci.c +++ b/sys/dev/sr/if_sr_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996 - 2001 John Hay. * Copyright (c) 1996 SDL Communications, Inc. * All rights reserved. diff --git a/sys/dev/sr/if_srregs.h b/sys/dev/sr/if_srregs.h index 3d80b22ea184..16925e6e581e 100644 --- a/sys/dev/sr/if_srregs.h +++ b/sys/dev/sr/if_srregs.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995 - 2001 John Hay. * Copyright (c) 1996 SDL Communications, Inc. * All rights reserved. diff --git a/sys/dev/stg/tmc18c30.c b/sys/dev/stg/tmc18c30.c index 223ed53d6051..c07c4c8b516d 100644 --- a/sys/dev/stg/tmc18c30.c +++ b/sys/dev/stg/tmc18c30.c @@ -5,7 +5,7 @@ #define STG_STATICS #define STG_IO_CONTROL_FLAGS (STG_FIFO_INTERRUPTS | STG_WAIT_FOR_SELECT) -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/stg/tmc18c30_isa.c b/sys/dev/stg/tmc18c30_isa.c index b674c2eefc07..40966697dc43 100644 --- a/sys/dev/stg/tmc18c30_isa.c +++ b/sys/dev/stg/tmc18c30_isa.c @@ -1,7 +1,7 @@ /* $NecBSD: tmc18c30_pisa.c,v 1.22 1998/11/26 01:59:21 honda Exp $ */ /* $NetBSD$ */ -/* +/*- * [Ported for FreeBSD] * Copyright (c) 2000 * Noriaki Mitsunaga, Mitsuru Iwasaki and Takanori Watanabe. diff --git a/sys/dev/stg/tmc18c30_pccard.c b/sys/dev/stg/tmc18c30_pccard.c index 0ea2df0f91b1..67bffd3f40c2 100644 --- a/sys/dev/stg/tmc18c30_pccard.c +++ b/sys/dev/stg/tmc18c30_pccard.c @@ -1,7 +1,7 @@ /* $NecBSD: tmc18c30_pisa.c,v 1.22 1998/11/26 01:59:21 honda Exp $ */ /* $NetBSD$ */ -/* +/*- * [Ported for FreeBSD] * Copyright (c) 2000 * Noriaki Mitsunaga, Mitsuru Iwasaki and Takanori Watanabe. diff --git a/sys/dev/stg/tmc18c30_subr.c b/sys/dev/stg/tmc18c30_subr.c index 7ffd4d39d349..c2cfd44b42ac 100644 --- a/sys/dev/stg/tmc18c30_subr.c +++ b/sys/dev/stg/tmc18c30_subr.c @@ -1,4 +1,4 @@ -/* +/*- * [Ported for FreeBSD] * Copyright (c) 2000 * Noriaki Mitsunaga, Mitsuru Iwasaki and Takanori Watanabe. diff --git a/sys/dev/stg/tmc18c30reg.h b/sys/dev/stg/tmc18c30reg.h index 9c84d89bc3a3..93c9940ba649 100644 --- a/sys/dev/stg/tmc18c30reg.h +++ b/sys/dev/stg/tmc18c30reg.h @@ -2,7 +2,7 @@ /* $NecBSD: tmc18c30reg.h,v 1.4.24.1 2001/06/08 06:27:50 honda Exp $ */ /* $NetBSD$ */ -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1996, 1997, 1998 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/stg/tmc18c30var.h b/sys/dev/stg/tmc18c30var.h index d6bc4ac4cc49..69e837fc6786 100644 --- a/sys/dev/stg/tmc18c30var.h +++ b/sys/dev/stg/tmc18c30var.h @@ -2,7 +2,7 @@ /* $NecBSD: tmc18c30var.h,v 1.12.18.2 2001/06/13 05:51:23 honda Exp $ */ /* $NetBSD$ */ -/* +/*- * [NetBSD for NEC PC-98 series] * Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001 * NetBSD/pc98 porting staff. All rights reserved. diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index 28a77c8906a8..0a15c86dad3d 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1998 Mark Newton * Copyright (c) 1994 Christos Zoulas * Copyright (c) 1997 Todd Vierling diff --git a/sys/dev/sx/cd1865.h b/sys/dev/sx/cd1865.h index 5056deaeecab..297a415ff698 100644 --- a/sys/dev/sx/cd1865.h +++ b/sys/dev/sx/cd1865.h @@ -1,4 +1,4 @@ -/* +/*- * Device driver for Specialix I/O8+ multiport serial card. * * Copyright 2003 Frank Mayhar diff --git a/sys/dev/sx/sx.c b/sys/dev/sx/sx.c index 25a967b84def..8821c374af87 100644 --- a/sys/dev/sx/sx.c +++ b/sys/dev/sx/sx.c @@ -1,4 +1,4 @@ -/* +/*- * Device tsfsdriver for Specialix I/O8+ multiport serial card. * * Copyright 2003 Frank Mayhar diff --git a/sys/dev/sx/sx.h b/sys/dev/sx/sx.h index 2c06028dd3c7..0e035ddbfb16 100644 --- a/sys/dev/sx/sx.h +++ b/sys/dev/sx/sx.h @@ -1,4 +1,4 @@ -/* +/*- * Device driver for Specialix I/O8+ multiport serial card. * * Copyright 2003 Frank Mayhar diff --git a/sys/dev/sx/sx_pci.c b/sys/dev/sx/sx_pci.c index 3187caf682ca..49052947791f 100644 --- a/sys/dev/sx/sx_pci.c +++ b/sys/dev/sx/sx_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Device driver for Specialix I/O8+ multiport serial card. * * Copyright 2003 Frank Mayhar diff --git a/sys/dev/sx/sx_util.c b/sys/dev/sx/sx_util.c index d9409254d322..0eeb8aeb7549 100644 --- a/sys/dev/sx/sx_util.c +++ b/sys/dev/sx/sx_util.c @@ -1,4 +1,4 @@ -/* +/*- * Device driver for Specialix I/O8+ multiport serial card. * * Copyright 2003 Frank Mayhar diff --git a/sys/dev/sx/sx_util.h b/sys/dev/sx/sx_util.h index 582e73be1bb1..57f42c9f7517 100644 --- a/sys/dev/sx/sx_util.h +++ b/sys/dev/sx/sx_util.h @@ -1,4 +1,4 @@ -/* +/*- * Device driver for Specialix I/O8+ multiport serial card. * * Copyright 2003 Frank Mayhar diff --git a/sys/dev/sx/sxvar.h b/sys/dev/sx/sxvar.h index 7eea73337abe..fa33e371ec90 100644 --- a/sys/dev/sx/sxvar.h +++ b/sys/dev/sx/sxvar.h @@ -1,4 +1,4 @@ -/* +/*- * Device driver for Specialix I/O8+ multiport serial card. * * Copyright 2003 Frank Mayhar diff --git a/sys/dev/sym/README.sym b/sys/dev/sym/README.sym index b4612237e7bf..d310cd4d150f 100644 --- a/sys/dev/sym/README.sym +++ b/sys/dev/sym/README.sym @@ -1,4 +1,4 @@ -/* +/*- * Device driver optimized for the Symbios/LSI 53C896/53C895A/53C1010 * PCI-SCSI controllers. * diff --git a/sys/dev/sym/sym_conf.h b/sys/dev/sym/sym_conf.h index 4154b6c33bf7..768baa7b10a5 100644 --- a/sys/dev/sym/sym_conf.h +++ b/sys/dev/sym/sym_conf.h @@ -1,4 +1,4 @@ -/* +/*- * Device driver optimized for the Symbios/LSI 53C896/53C895A/53C1010 * PCI-SCSI controllers. * diff --git a/sys/dev/sym/sym_defs.h b/sys/dev/sym/sym_defs.h index 61caabddc0ae..ad1481f71af3 100644 --- a/sys/dev/sym/sym_defs.h +++ b/sys/dev/sym/sym_defs.h @@ -1,4 +1,4 @@ -/* +/*- * Device driver optimized for the Symbios/LSI 53C896/53C895A/53C1010 * PCI-SCSI controllers. * diff --git a/sys/dev/sym/sym_fw.h b/sys/dev/sym/sym_fw.h index 65b2838bb3d6..a274bbcee430 100644 --- a/sys/dev/sym/sym_fw.h +++ b/sys/dev/sym/sym_fw.h @@ -1,4 +1,4 @@ -/* +/*- * Device driver optimized for the Symbios/LSI 53C896/53C895A/53C1010 * PCI-SCSI controllers. * diff --git a/sys/dev/sym/sym_fw1.h b/sys/dev/sym/sym_fw1.h index 96ae523ddc1d..9a43dc431f0d 100644 --- a/sys/dev/sym/sym_fw1.h +++ b/sys/dev/sym/sym_fw1.h @@ -1,4 +1,4 @@ -/* +/*- * Device driver optimized for the Symbios/LSI 53C896/53C895A/53C1010 * PCI-SCSI controllers. * diff --git a/sys/dev/sym/sym_fw2.h b/sys/dev/sym/sym_fw2.h index 77f8df32d7ec..5ff740aa3cd9 100644 --- a/sys/dev/sym/sym_fw2.h +++ b/sys/dev/sym/sym_fw2.h @@ -1,4 +1,4 @@ -/* +/*- * Device driver optimized for the Symbios/LSI 53C896/53C895A/53C1010 * PCI-SCSI controllers. * diff --git a/sys/dev/tdfx/tdfx_io.h b/sys/dev/tdfx/tdfx_io.h index 8742fd7341cd..faec61e11771 100644 --- a/sys/dev/tdfx/tdfx_io.h +++ b/sys/dev/tdfx/tdfx_io.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000-2001 by Coleman Kane * All rights reserved. * diff --git a/sys/dev/tdfx/tdfx_linux.h b/sys/dev/tdfx/tdfx_linux.h index fa4351de226f..a3235cc8ba02 100644 --- a/sys/dev/tdfx/tdfx_linux.h +++ b/sys/dev/tdfx/tdfx_linux.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000-2001 by Coleman Kane * All rights reserved. * diff --git a/sys/dev/tdfx/tdfx_pci.h b/sys/dev/tdfx/tdfx_pci.h index 1ecc554e8edc..0c60e5a2b6c1 100644 --- a/sys/dev/tdfx/tdfx_pci.h +++ b/sys/dev/tdfx/tdfx_pci.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000-2001 by Coleman Kane * All rights reserved. * diff --git a/sys/dev/tdfx/tdfx_vars.h b/sys/dev/tdfx/tdfx_vars.h index 95a9bbf9c165..1e10e3c3a669 100644 --- a/sys/dev/tdfx/tdfx_vars.h +++ b/sys/dev/tdfx/tdfx_vars.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000-2001 by Coleman Kane * All rights reserved. * diff --git a/sys/dev/tga/tga_pci.c b/sys/dev/tga/tga_pci.c index 1477a7c4210a..63f9c5a32b92 100644 --- a/sys/dev/tga/tga_pci.c +++ b/sys/dev/tga/tga_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, 1996 Carnegie-Mellon University. * All rights reserved. * diff --git a/sys/dev/tga/tga_pci.h b/sys/dev/tga/tga_pci.h index 269913104493..21dc74e37417 100644 --- a/sys/dev/tga/tga_pci.h +++ b/sys/dev/tga/tga_pci.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1995, 1996 Carnegie-Mellon University. * All rights reserved. * diff --git a/sys/dev/trm/trm.c b/sys/dev/trm/trm.c index 2319828b8d0c..fac2c90dec9b 100644 --- a/sys/dev/trm/trm.c +++ b/sys/dev/trm/trm.c @@ -8,7 +8,6 @@ * DC395U2D/U2W(TRM-S2080) * PCI SCSI Bus Master Host Adapter * (SCSI chip set used Tekram ASIC TRM-S1040,TRM-S2080) - *(C)Copyright 1995-2001 Tekram Technology Co.,Ltd. */ #include @@ -27,8 +26,8 @@ __FBSDID("$FreeBSD$"); * 1.11 10/13/2001 Oscar Feng Fixed wrong Async speed display bug. */ -/* - * +/*- + * (C)Copyright 1995-2001 Tekram Technology Co.,Ltd. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/sys/dev/trm/trm.h b/sys/dev/trm/trm.h index e9eadbea8181..21248835a510 100644 --- a/sys/dev/trm/trm.h +++ b/sys/dev/trm/trm.h @@ -1,10 +1,12 @@ -/* +/*- * File Name : trm.h * * Tekram DC395U/UW/F ,DC315/U * PCI SCSI Bus Master Host Adapter Device Driver * (SCSI chip set used Tekram ASIC TRM-S1040) * + * (C)Copyright 1995-2001 Tekram Technology Co.,Ltd. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: diff --git a/sys/dev/txp/3c990img.h b/sys/dev/txp/3c990img.h index a14441d3ed3c..6e75f5d83cf0 100644 --- a/sys/dev/txp/3c990img.h +++ b/sys/dev/txp/3c990img.h @@ -1,7 +1,7 @@ /* $OpenBSD: 3c990img.h,v 1.2 2001/06/05 02:15:17 jason Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (C) 1999-2001 3Com, Inc. * All rights reserved. * diff --git a/sys/dev/txp/if_txp.c b/sys/dev/txp/if_txp.c index 2a7221de4f9f..a2805324ea76 100644 --- a/sys/dev/txp/if_txp.c +++ b/sys/dev/txp/if_txp.c @@ -1,6 +1,6 @@ /* $OpenBSD: if_txp.c,v 1.48 2001/06/27 06:34:50 kjc Exp $ */ -/* +/*- * Copyright (c) 2001 * Jason L. Wright , Theo de Raadt, and * Aaron Campbell . All rights reserved. diff --git a/sys/dev/txp/if_txpreg.h b/sys/dev/txp/if_txpreg.h index 634c29f07f7e..2d88fc9fd053 100644 --- a/sys/dev/txp/if_txpreg.h +++ b/sys/dev/txp/if_txpreg.h @@ -1,7 +1,7 @@ /* $OpenBSD: if_txpreg.h,v 1.30 2001/06/23 04:18:02 jason Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2001 Aaron Campbell . * All rights reserved. * diff --git a/sys/dev/uart/uart.h b/sys/dev/uart/uart.h index 5de4d420ac5c..101304ed6871 100644 --- a/sys/dev/uart/uart.h +++ b/sys/dev/uart/uart.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/uart/uart_bus.h b/sys/dev/uart/uart_bus.h index cc9ce4df5a75..9fd84e9eca6c 100644 --- a/sys/dev/uart/uart_bus.h +++ b/sys/dev/uart/uart_bus.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/uart/uart_bus_acpi.c b/sys/dev/uart/uart_bus_acpi.c index a26357132d04..042dfef5d219 100644 --- a/sys/dev/uart/uart_bus_acpi.c +++ b/sys/dev/uart/uart_bus_acpi.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 M. Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/uart/uart_bus_isa.c b/sys/dev/uart/uart_bus_isa.c index e70c3e029ce2..51713ad25a62 100644 --- a/sys/dev/uart/uart_bus_isa.c +++ b/sys/dev/uart/uart_bus_isa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 M. Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/uart/uart_bus_pccard.c b/sys/dev/uart/uart_bus_pccard.c index 5f0e02b26bab..a1ca4c2e292c 100644 --- a/sys/dev/uart/uart_bus_pccard.c +++ b/sys/dev/uart/uart_bus_pccard.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 M. Warner Losh. All rights reserved. * Copyright (c) 2003 Norikatsu Shigemura, Takenori Watanabe All rights reserved. * diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c index 2e4573d4e26b..fb2fc6d1bfe1 100644 --- a/sys/dev/uart/uart_bus_pci.c +++ b/sys/dev/uart/uart_bus_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 M. Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c index ca89c5cfd0e3..00fdf1610a39 100644 --- a/sys/dev/uart/uart_core.c +++ b/sys/dev/uart/uart_core.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/uart/uart_cpu.h b/sys/dev/uart/uart_cpu.h index 462eb59b1e83..702ee5ec5d93 100644 --- a/sys/dev/uart/uart_cpu.h +++ b/sys/dev/uart/uart_cpu.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003, 2004 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/uart/uart_cpu_alpha.c b/sys/dev/uart/uart_cpu_alpha.c index a3a132f6aa2b..438bc3c691c9 100644 --- a/sys/dev/uart/uart_cpu_alpha.c +++ b/sys/dev/uart/uart_cpu_alpha.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003, 2004 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/uart/uart_cpu_amd64.c b/sys/dev/uart/uart_cpu_amd64.c index c0270ae6a2cb..498496b86b90 100644 --- a/sys/dev/uart/uart_cpu_amd64.c +++ b/sys/dev/uart/uart_cpu_amd64.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003, 2004 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/uart/uart_cpu_i386.c b/sys/dev/uart/uart_cpu_i386.c index 93ca77079459..673dde54b25a 100644 --- a/sys/dev/uart/uart_cpu_i386.c +++ b/sys/dev/uart/uart_cpu_i386.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003, 2004 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/uart/uart_cpu_ia64.c b/sys/dev/uart/uart_cpu_ia64.c index 74a9300663ea..cf1e7e178e98 100644 --- a/sys/dev/uart/uart_cpu_ia64.c +++ b/sys/dev/uart/uart_cpu_ia64.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003, 2004 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/uart/uart_cpu_pc98.c b/sys/dev/uart/uart_cpu_pc98.c index 3664096b6c93..0ae255967727 100644 --- a/sys/dev/uart/uart_cpu_pc98.c +++ b/sys/dev/uart/uart_cpu_pc98.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 M. Warner Losh, Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/uart/uart_cpu_sparc64.c b/sys/dev/uart/uart_cpu_sparc64.c index fcc2f1d24fcc..efb8ba7dea2b 100644 --- a/sys/dev/uart/uart_cpu_sparc64.c +++ b/sys/dev/uart/uart_cpu_sparc64.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003, 2004 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/uart/uart_dbg.c b/sys/dev/uart/uart_dbg.c index 71938b961827..51d9ec59bdde 100644 --- a/sys/dev/uart/uart_dbg.c +++ b/sys/dev/uart/uart_dbg.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index f39d29cce482..5b53a8999fd1 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/uart/uart_dev_sab82532.c b/sys/dev/uart/uart_dev_sab82532.c index 04dbe8c10afa..0da08911f1d7 100644 --- a/sys/dev/uart/uart_dev_sab82532.c +++ b/sys/dev/uart/uart_dev_sab82532.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/uart/uart_dev_z8530.c b/sys/dev/uart/uart_dev_z8530.c index 8da64d7caa63..4454bf5c9064 100644 --- a/sys/dev/uart/uart_dev_z8530.c +++ b/sys/dev/uart/uart_dev_z8530.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/uart/uart_if.m b/sys/dev/uart/uart_if.m index 762c16eaa143..0bb145490ed4 100644 --- a/sys/dev/uart/uart_if.m +++ b/sys/dev/uart/uart_if.m @@ -1,3 +1,4 @@ +#- # Copyright (c) 2003 Marcel Moolenaar # All rights reserved. # diff --git a/sys/dev/uart/uart_kbd_sun.h b/sys/dev/uart/uart_kbd_sun.h index 574e966b7040..603d257432df 100644 --- a/sys/dev/uart/uart_kbd_sun.h +++ b/sys/dev/uart/uart_kbd_sun.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2002 Jason L. Wright (jason@thought.net) * All rights reserved. * diff --git a/sys/dev/uart/uart_subr.c b/sys/dev/uart/uart_subr.c index 27dfd41b0735..14ce64b1b84f 100644 --- a/sys/dev/uart/uart_subr.c +++ b/sys/dev/uart/uart_subr.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/uart/uart_tty.c b/sys/dev/uart/uart_tty.c index 73ff7f292289..8f3c3c5d64fe 100644 --- a/sys/dev/uart/uart_tty.c +++ b/sys/dev/uart/uart_tty.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Marcel Moolenaar * All rights reserved. * diff --git a/sys/dev/ubsec/ubsec.c b/sys/dev/ubsec/ubsec.c index db3e96c0b2c2..39da78c9f3c8 100644 --- a/sys/dev/ubsec/ubsec.c +++ b/sys/dev/ubsec/ubsec.c @@ -1,6 +1,6 @@ /* $OpenBSD: ubsec.c,v 1.115 2002/09/24 18:33:26 jason Exp $ */ -/* +/*- * Copyright (c) 2000 Jason L. Wright (jason@thought.net) * Copyright (c) 2000 Theo de Raadt (deraadt@openbsd.org) * Copyright (c) 2001 Patrik Lindergren (patrik@ipunplugged.com) diff --git a/sys/dev/ubsec/ubsecreg.h b/sys/dev/ubsec/ubsecreg.h index 4be530a02296..2ba1f937d06e 100644 --- a/sys/dev/ubsec/ubsecreg.h +++ b/sys/dev/ubsec/ubsecreg.h @@ -1,7 +1,7 @@ /* $FreeBSD$ */ /* $OpenBSD: ubsecreg.h,v 1.27 2002/09/11 22:40:31 jason Exp $ */ -/* +/*- * Copyright (c) 2000 Theo de Raadt * Copyright (c) 2001 Patrik Lindergren (patrik@ipunplugged.com) * diff --git a/sys/dev/ubsec/ubsecvar.h b/sys/dev/ubsec/ubsecvar.h index 965a0d90181d..448403b14c01 100644 --- a/sys/dev/ubsec/ubsecvar.h +++ b/sys/dev/ubsec/ubsecvar.h @@ -1,7 +1,7 @@ /* $FreeBSD$ */ /* $OpenBSD: ubsecvar.h,v 1.35 2002/09/24 18:33:26 jason Exp $ */ -/* +/*- * Copyright (c) 2000 Theo de Raadt * Copyright (c) 2001 Patrik Lindergren (patrik@ipunplugged.com) * diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c index b8d26a450fcd..31d60dc77fb4 100644 --- a/sys/dev/usb/ehci.c +++ b/sys/dev/usb/ehci.c @@ -1,6 +1,6 @@ /* $NetBSD: ehci.c,v 1.89 2004/12/03 08:51:31 augustss Exp $ */ -/* +/*- * Copyright (c) 2004 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/ehcireg.h b/sys/dev/usb/ehcireg.h index 2aaa4c8107ad..304b4ae2d92a 100644 --- a/sys/dev/usb/ehcireg.h +++ b/sys/dev/usb/ehcireg.h @@ -1,7 +1,7 @@ /* $NetBSD: ehcireg.h,v 1.17 2004/06/23 06:45:56 mycroft Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/ehcivar.h b/sys/dev/usb/ehcivar.h index 0fec5a761cd7..7859646080c8 100644 --- a/sys/dev/usb/ehcivar.h +++ b/sys/dev/usb/ehcivar.h @@ -1,7 +1,7 @@ /* $NetBSD: ehcivar.h,v 1.12 2001/12/31 12:16:57 augustss Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/hid.c b/sys/dev/usb/hid.c index f083a17cf681..1c1fcbdbbc9d 100644 --- a/sys/dev/usb/hid.c +++ b/sys/dev/usb/hid.c @@ -3,7 +3,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/hid.h b/sys/dev/usb/hid.h index 590e7cb585c6..a4ab7d2b2969 100644 --- a/sys/dev/usb/hid.h +++ b/sys/dev/usb/hid.h @@ -1,7 +1,7 @@ /* $NetBSD: hid.h,v 1.6 2000/06/01 14:28:57 augustss Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/if_auereg.h b/sys/dev/usb/if_auereg.h index 478ceced0c22..eaa587a6fefc 100644 --- a/sys/dev/usb/if_auereg.h +++ b/sys/dev/usb/if_auereg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c index ef477d8cc7c4..ad9fdea16e60 100644 --- a/sys/dev/usb/if_axe.c +++ b/sys/dev/usb/if_axe.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999, 2000-2003 * Bill Paul . All rights reserved. * diff --git a/sys/dev/usb/if_axereg.h b/sys/dev/usb/if_axereg.h index 04fa92df8e51..cea2f46f5b44 100644 --- a/sys/dev/usb/if_axereg.h +++ b/sys/dev/usb/if_axereg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999, 2000-2003 * Bill Paul . All rights reserved. * diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index b7e715a25539..e379428519a0 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul . All rights reserved. * diff --git a/sys/dev/usb/if_cuereg.h b/sys/dev/usb/if_cuereg.h index beaf1d5a39d1..85fc71e8b45c 100644 --- a/sys/dev/usb/if_cuereg.h +++ b/sys/dev/usb/if_cuereg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul . All rights reserved. * diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index 1e21d9cc66bf..9a4258bd72c1 100644 --- a/sys/dev/usb/if_kue.c +++ b/sys/dev/usb/if_kue.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul . All rights reserved. * diff --git a/sys/dev/usb/if_kuereg.h b/sys/dev/usb/if_kuereg.h index 4fa829516fb9..5ea0226518cd 100644 --- a/sys/dev/usb/if_kuereg.h +++ b/sys/dev/usb/if_kuereg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul . All rights reserved. * diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c index c7d3c45c784d..96ef08ffa762 100644 --- a/sys/dev/usb/if_udav.c +++ b/sys/dev/usb/if_udav.c @@ -1,7 +1,7 @@ /* $NetBSD: if_udav.c,v 1.2 2003/09/04 15:17:38 tsutsui Exp $ */ /* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2003 * Shingo WATANABE . All rights reserved. * diff --git a/sys/dev/usb/if_udavreg.h b/sys/dev/usb/if_udavreg.h index 7680422a65e3..965cbdc7cb57 100644 --- a/sys/dev/usb/if_udavreg.h +++ b/sys/dev/usb/if_udavreg.h @@ -1,7 +1,7 @@ /* $NetBSD: if_udavreg.h,v 1.2 2003/09/04 15:17:39 tsutsui Exp $ */ /* $nabe: if_udavreg.h,v 1.2 2003/08/21 16:26:40 nabe Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2003 * Shingo WATANABE . All rights reserved. * diff --git a/sys/dev/usb/kue_fw.h b/sys/dev/usb/kue_fw.h index 8d8c1e1f2f0c..659dc6bb78f3 100644 --- a/sys/dev/usb/kue_fw.h +++ b/sys/dev/usb/kue_fw.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul . All rights reserved. * diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index 3cafad713ef1..47e8b3fa01dd 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -15,7 +15,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/ohcireg.h b/sys/dev/usb/ohcireg.h index 4c0a6c260703..c255a4b28f34 100644 --- a/sys/dev/usb/ohcireg.h +++ b/sys/dev/usb/ohcireg.h @@ -2,7 +2,7 @@ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/ohcivar.h b/sys/dev/usb/ohcivar.h index 19ec182009c2..f9b05176e0f0 100644 --- a/sys/dev/usb/ohcivar.h +++ b/sys/dev/usb/ohcivar.h @@ -1,7 +1,7 @@ /* $NetBSD: ohcivar.h,v 1.30 2001/12/31 12:20:35 augustss Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/rio500_usb.h b/sys/dev/usb/rio500_usb.h index c2da72e91b11..f2c2081ccc9d 100644 --- a/sys/dev/usb/rio500_usb.h +++ b/sys/dev/usb/rio500_usb.h @@ -1,4 +1,5 @@ -/* ---------------------------------------------------------------------- +/*- + ---------------------------------------------------------------------- Copyright (C) 2000 Cesar Miquel (miquel@df.uba.ar) diff --git a/sys/dev/usb/ubsa.c b/sys/dev/usb/ubsa.c index 0efc57773712..271c1729b511 100644 --- a/sys/dev/usb/ubsa.c +++ b/sys/dev/usb/ubsa.c @@ -26,7 +26,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/ubser.c b/sys/dev/usb/ubser.c index 601af2a0e125..ab2017be1b10 100644 --- a/sys/dev/usb/ubser.c +++ b/sys/dev/usb/ubser.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 Bernd Walter * * $URL: https://devel.bwct.de/svn/projects/ubser/ubser.c $ @@ -33,7 +33,7 @@ * SUCH DAMAGE. */ -/* +/*- * Copyright (c) 2000 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/ubser.h b/sys/dev/usb/ubser.h index d1cc2c6b5969..45c7ec558eaa 100644 --- a/sys/dev/usb/ubser.h +++ b/sys/dev/usb/ubser.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 Bernd Walter * * $URL: https://devel.bwct.de/svn/projects/ubser/ubser.h $ diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 98856b5add29..30cf93059eb3 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -29,7 +29,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/ucomvar.h b/sys/dev/usb/ucomvar.h index 3c6a487f18fc..e8a51fe3fd21 100644 --- a/sys/dev/usb/ucomvar.h +++ b/sys/dev/usb/ucomvar.h @@ -27,7 +27,7 @@ * SUCH DAMAGE. */ -/* +/*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/udbp.c b/sys/dev/usb/udbp.c index 2bedbbe092d8..1ad11bccfb56 100644 --- a/sys/dev/usb/udbp.c +++ b/sys/dev/usb/udbp.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996-2000 Whistle Communications, Inc. * All rights reserved. * diff --git a/sys/dev/usb/udbp.h b/sys/dev/usb/udbp.h index 0b7b4eeae7e0..97ef9455b664 100644 --- a/sys/dev/usb/udbp.h +++ b/sys/dev/usb/udbp.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1996-2000 Whistle Communications, Inc. * All rights reserved. * diff --git a/sys/dev/usb/ufm.c b/sys/dev/usb/ufm.c index 66b7376c43f3..8439abb2cad2 100644 --- a/sys/dev/usb/ufm.c +++ b/sys/dev/usb/ufm.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2001 M. Warner Losh * All rights reserved. * diff --git a/sys/dev/usb/uftdi.c b/sys/dev/usb/uftdi.c index a053a4d2c05d..5532e72b5a11 100644 --- a/sys/dev/usb/uftdi.c +++ b/sys/dev/usb/uftdi.c @@ -1,6 +1,6 @@ /* $NetBSD: uftdi.c,v 1.13 2002/09/23 05:51:23 simonb Exp $ */ -/* +/*- * Copyright (c) 2000 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 2606d8e1bbcd..7d0131b8c410 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -10,7 +10,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/ugraphire_rdesc.h b/sys/dev/usb/ugraphire_rdesc.h index 9dd6988ab907..295f2a0db785 100644 --- a/sys/dev/usb/ugraphire_rdesc.h +++ b/sys/dev/usb/ugraphire_rdesc.h @@ -1,6 +1,6 @@ /* $NetBSD: usb/ugraphire_rdesc.h,v 1.1 2000/12/29 01:47:49 augustss Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2000 Nick Hibma * All rights reserved. * diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index bc424d7fcf28..213c6b3d2a67 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -14,7 +14,7 @@ __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/uhcireg.h b/sys/dev/usb/uhcireg.h index b640e9f9e8aa..512dd2d7d3c0 100644 --- a/sys/dev/usb/uhcireg.h +++ b/sys/dev/usb/uhcireg.h @@ -1,7 +1,7 @@ /* $NetBSD: uhcireg.h,v 1.15 2002/02/11 11:41:30 augustss Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/uhcivar.h b/sys/dev/usb/uhcivar.h index 56709803c788..2ba9d6f06464 100644 --- a/sys/dev/usb/uhcivar.h +++ b/sys/dev/usb/uhcivar.h @@ -1,7 +1,7 @@ /* $NetBSD: uhcivar.h,v 1.33 2002/02/11 11:41:30 augustss Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index 705fd9b68423..634d0e0f5efe 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -7,7 +7,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c index 0c07211a659b..88927568362a 100644 --- a/sys/dev/usb/uhub.c +++ b/sys/dev/usb/uhub.c @@ -1,6 +1,6 @@ /* $NetBSD: uhub.c,v 1.68 2004/06/29 06:30:05 mycroft Exp $ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c index be072f8123ac..599370ca02ea 100644 --- a/sys/dev/usb/ukbd.c +++ b/sys/dev/usb/ukbd.c @@ -1,5 +1,4 @@ - -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 4be53b3dae8d..9716b65ea9ff 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -1,6 +1,6 @@ /* $NetBSD: ulpt.c,v 1.60 2003/10/04 21:19:50 augustss Exp $ */ -/* +/*- * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/umodem.c b/sys/dev/usb/umodem.c index 4aa7d915ff7d..7b8e12f5b857 100644 --- a/sys/dev/usb/umodem.c +++ b/sys/dev/usb/umodem.c @@ -29,7 +29,7 @@ __FBSDID("$FreeBSD$"); * SUCH DAMAGE. */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index 98f7543704e1..3e4c47beb091 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -1,5 +1,4 @@ - -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/uplcom.c b/sys/dev/usb/uplcom.c index 6e978a8a99f6..246c394bba0c 100644 --- a/sys/dev/usb/uplcom.c +++ b/sys/dev/usb/uplcom.c @@ -29,7 +29,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index 33e04e9194d6..68efc9c19e54 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2000 Iwasa Kazmi * All rights reserved. * diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 640ac7250ad5..d10eb4accc53 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -10,7 +10,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h index e5278596f3ce..f4559c1ea633 100644 --- a/sys/dev/usb/usb.h +++ b/sys/dev/usb/usb.h @@ -1,7 +1,7 @@ /* $NetBSD: usb.h,v 1.69 2002/09/22 23:20:50 augustss Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/usb_ethersubr.c b/sys/dev/usb/usb_ethersubr.c index 325f3db48eea..642f94a24119 100644 --- a/sys/dev/usb/usb_ethersubr.c +++ b/sys/dev/usb/usb_ethersubr.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul . All rights reserved. * diff --git a/sys/dev/usb/usb_ethersubr.h b/sys/dev/usb/usb_ethersubr.h index c8a40108ef5c..9cd6c7915e7b 100644 --- a/sys/dev/usb/usb_ethersubr.h +++ b/sys/dev/usb/usb_ethersubr.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul . All rights reserved. * diff --git a/sys/dev/usb/usb_if.m b/sys/dev/usb/usb_if.m index c1b27c8a4bec..b04c8a45a4c4 100644 --- a/sys/dev/usb/usb_if.m +++ b/sys/dev/usb/usb_if.m @@ -1,4 +1,4 @@ -# +#- # Copyright (c) 1992-1998 Nick Hibma # All rights reserved. # diff --git a/sys/dev/usb/usb_mem.c b/sys/dev/usb/usb_mem.c index 82b678e82b5c..f9a59eb3c6d9 100644 --- a/sys/dev/usb/usb_mem.c +++ b/sys/dev/usb/usb_mem.c @@ -1,7 +1,7 @@ /* $NetBSD: usb_mem.c,v 1.26 2003/02/01 06:23:40 thorpej Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/usb_mem.h b/sys/dev/usb/usb_mem.h index bba88d582082..6fe63f3e3385 100644 --- a/sys/dev/usb/usb_mem.h +++ b/sys/dev/usb/usb_mem.h @@ -1,7 +1,7 @@ /* $NetBSD: usb_mem.h,v 1.18 2002/05/28 17:45:17 augustss Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h index 38dd65e5aa2e..270a2ad1262d 100644 --- a/sys/dev/usb/usb_port.h +++ b/sys/dev/usb/usb_port.h @@ -7,7 +7,7 @@ * $NetBSD: usb_port.h,v 1.58 2002/10/01 01:25:26 thorpej Exp $ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/usb_quirks.c b/sys/dev/usb/usb_quirks.c index 895d7d6c1be0..01c155f753cb 100644 --- a/sys/dev/usb/usb_quirks.c +++ b/sys/dev/usb/usb_quirks.c @@ -1,6 +1,6 @@ /* $NetBSD: usb_quirks.c,v 1.50 2004/06/23 02:30:52 mycroft Exp $ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/usb_quirks.h b/sys/dev/usb/usb_quirks.h index 2a36a0649bab..4977bf605b40 100644 --- a/sys/dev/usb/usb_quirks.h +++ b/sys/dev/usb/usb_quirks.h @@ -1,7 +1,7 @@ /* $NetBSD: usb_quirks.h,v 1.20 2001/04/15 09:38:01 augustss Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index fa21645137a0..e6fa74ac1dd4 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -12,7 +12,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/usbcdc.h b/sys/dev/usb/usbcdc.h index 45266e44302c..305c53cf634a 100644 --- a/sys/dev/usb/usbcdc.h +++ b/sys/dev/usb/usbcdc.h @@ -1,7 +1,7 @@ /* $NetBSD: usbcdc.h,v 1.6 2000/04/27 15:26:50 augustss Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index f55332216bc2..43a73cfa38b3 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -1,7 +1,7 @@ $FreeBSD$ /* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */ -/* +/*- * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index b313d8f7c8f8..e5e4fd05c535 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -3,7 +3,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index 4bb41829d5ec..d3dac2e987d6 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -1,7 +1,7 @@ /* $NetBSD: usbdi.h,v 1.64 2004/10/23 13:26:34 augustss Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/usbdi_util.c b/sys/dev/usb/usbdi_util.c index 8fdd1cc8f7a9..e18c6d38e9f9 100644 --- a/sys/dev/usb/usbdi_util.c +++ b/sys/dev/usb/usbdi_util.c @@ -1,6 +1,6 @@ /* $NetBSD: usbdi_util.c,v 1.36 2001/11/13 06:24:57 lukem Exp $ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/usbdi_util.h b/sys/dev/usb/usbdi_util.h index a6a3646b13a4..51e052f712f8 100644 --- a/sys/dev/usb/usbdi_util.h +++ b/sys/dev/usb/usbdi_util.h @@ -1,7 +1,7 @@ /* $NetBSD: usbdi_util.h,v 1.29 2004/06/23 02:30:52 mycroft Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/usbdivar.h b/sys/dev/usb/usbdivar.h index 4be8d648561e..69f236638b1a 100644 --- a/sys/dev/usb/usbdivar.h +++ b/sys/dev/usb/usbdivar.h @@ -1,7 +1,7 @@ /* $NetBSD: usbdivar.h,v 1.70 2002/07/11 21:14:36 augustss Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/usbhid.h b/sys/dev/usb/usbhid.h index 416aec3f2e56..8e0ecd579907 100644 --- a/sys/dev/usb/usbhid.h +++ b/sys/dev/usb/usbhid.h @@ -1,7 +1,7 @@ /* $NetBSD: usbhid.h,v 1.9 2000/09/03 19:09:14 augustss Exp $ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 1998 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index 0c729262fc3f..aaabaf630a22 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -7,7 +7,7 @@ #include __FBSDID("$FreeBSD$"); -/* +/*- * Copyright (c) 2000 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/usb/uvisor.c b/sys/dev/usb/uvisor.c index 68214e775d46..fcce25057543 100644 --- a/sys/dev/usb/uvisor.c +++ b/sys/dev/usb/uvisor.c @@ -14,7 +14,7 @@ */ -/* +/*- * Copyright (c) 2000 The NetBSD Foundation, Inc. * All rights reserved. * diff --git a/sys/dev/utopia/idtphy.h b/sys/dev/utopia/idtphy.h index dacb2afedef3..1451d0561fa3 100644 --- a/sys/dev/utopia/idtphy.h +++ b/sys/dev/utopia/idtphy.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/utopia/suni.h b/sys/dev/utopia/suni.h index ac8e9978fc9c..fd1be7e13e39 100644 --- a/sys/dev/utopia/suni.h +++ b/sys/dev/utopia/suni.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/utopia/utopia.c b/sys/dev/utopia/utopia.c index 263f4b9f20e4..e4a7c01b358f 100644 --- a/sys/dev/utopia/utopia.c +++ b/sys/dev/utopia/utopia.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/utopia/utopia.h b/sys/dev/utopia/utopia.h index ae044f98f08d..0c95aa344d4f 100644 --- a/sys/dev/utopia/utopia.h +++ b/sys/dev/utopia/utopia.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2003 * Fraunhofer Institute for Open Communication Systems (FhG Fokus). * All rights reserved. diff --git a/sys/dev/vge/if_vge.c b/sys/dev/vge/if_vge.c index 14c5efc620be..0bac802238a0 100644 --- a/sys/dev/vge/if_vge.c +++ b/sys/dev/vge/if_vge.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 * Bill Paul . All rights reserved. * diff --git a/sys/dev/vge/if_vgereg.h b/sys/dev/vge/if_vgereg.h index 9b7e5869e107..8d11a9c3e1f6 100644 --- a/sys/dev/vge/if_vgereg.h +++ b/sys/dev/vge/if_vgereg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 * Bill Paul . All rights reserved. * diff --git a/sys/dev/vge/if_vgevar.h b/sys/dev/vge/if_vgevar.h index ad298c49d850..f8003744a7cb 100644 --- a/sys/dev/vge/if_vgevar.h +++ b/sys/dev/vge/if_vgevar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2004 * Bill Paul . All rights reserved. * diff --git a/sys/dev/vkbd/vkbd.c b/sys/dev/vkbd/vkbd.c index b5c0c713f88a..e66aaca4b0c9 100644 --- a/sys/dev/vkbd/vkbd.c +++ b/sys/dev/vkbd/vkbd.c @@ -1,4 +1,4 @@ -/* +/*- * vkbd.c * * Copyright (c) 2004 Maksim Yevmenkin diff --git a/sys/dev/vkbd/vkbd_var.h b/sys/dev/vkbd/vkbd_var.h index 20c5100fcdfa..51e7ff467d17 100644 --- a/sys/dev/vkbd/vkbd_var.h +++ b/sys/dev/vkbd/vkbd_var.h @@ -1,4 +1,4 @@ -/* +/*- * vkbd_var.h * * Copyright (c) 2004 Maksim Yevmenkin diff --git a/sys/dev/vx/if_vx.c b/sys/dev/vx/if_vx.c index e9d8699a4396..5b049bf61c68 100644 --- a/sys/dev/vx/if_vx.c +++ b/sys/dev/vx/if_vx.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1994 Herb Peyerl * All rights reserved. * diff --git a/sys/dev/vx/if_vx_eisa.c b/sys/dev/vx/if_vx_eisa.c index 28c92f095e55..bbccb5ba1077 100644 --- a/sys/dev/vx/if_vx_eisa.c +++ b/sys/dev/vx/if_vx_eisa.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 1996 Naoki Hamada * All rights reserved. * diff --git a/sys/dev/vx/if_vx_pci.c b/sys/dev/vx/if_vx_pci.c index f8b716ffba70..220da32e7d51 100644 --- a/sys/dev/vx/if_vx_pci.c +++ b/sys/dev/vx/if_vx_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (C) 1996 Naoki Hamada * All rights reserved. * diff --git a/sys/dev/vx/if_vxreg.h b/sys/dev/vx/if_vxreg.h index 8a8e5ae43dd2..b876782ca8cb 100644 --- a/sys/dev/vx/if_vxreg.h +++ b/sys/dev/vx/if_vxreg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/vx/if_vxvar.h b/sys/dev/vx/if_vxvar.h index 3607afe50977..8b3a27cdc35a 100644 --- a/sys/dev/vx/if_vxvar.h +++ b/sys/dev/vx/if_vxvar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1993 Herb Peyerl (hpeyerl@novatel.ca) All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/wds/wd7000.c b/sys/dev/wds/wd7000.c index cf0ad21bf3fc..384dd08be1c3 100644 --- a/sys/dev/wds/wd7000.c +++ b/sys/dev/wds/wd7000.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1994 Ludd, University of Lule}, Sweden. * Copyright (c) 2000 Sergey A. Babkin * All rights reserved. diff --git a/sys/dev/wi/if_wavelan_ieee.h b/sys/dev/wi/if_wavelan_ieee.h index d48ba6e6b864..585edaa237fa 100644 --- a/sys/dev/wi/if_wavelan_ieee.h +++ b/sys/dev/wi/if_wavelan_ieee.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c index 06973d204be2..4c77f9ef7a13 100644 --- a/sys/dev/wi/if_wi.c +++ b/sys/dev/wi/if_wi.c @@ -1,6 +1,6 @@ /* $NetBSD: wi.c,v 1.109 2003/01/09 08:52:19 dyoung Exp $ */ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/wi/if_wi_pccard.c b/sys/dev/wi/if_wi_pccard.c index 549825b72be3..75355a233613 100644 --- a/sys/dev/wi/if_wi_pccard.c +++ b/sys/dev/wi/if_wi_pccard.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/wi/if_wi_pci.c b/sys/dev/wi/if_wi_pci.c index 5d11d4d20aa7..932a0c34bec6 100644 --- a/sys/dev/wi/if_wi_pci.c +++ b/sys/dev/wi/if_wi_pci.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/wi/if_wireg.h b/sys/dev/wi/if_wireg.h index 03c6e22de150..7992f891c481 100644 --- a/sys/dev/wi/if_wireg.h +++ b/sys/dev/wi/if_wireg.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. * diff --git a/sys/dev/wi/if_wivar.h b/sys/dev/wi/if_wivar.h index facc42ba38ee..0cb26e959400 100644 --- a/sys/dev/wi/if_wivar.h +++ b/sys/dev/wi/if_wivar.h @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2002 * M Warner Losh . All rights reserved. * Copyright (c) 1997, 1998, 1999 diff --git a/sys/dev/wi/spectrum24t_cf.h b/sys/dev/wi/spectrum24t_cf.h index 7f1d2b023272..ce053fa1930c 100644 --- a/sys/dev/wi/spectrum24t_cf.h +++ b/sys/dev/wi/spectrum24t_cf.h @@ -1,7 +1,7 @@ /* $NetBSD$ */ /* $FreeBSD$ */ -/* +/*- * Copyright (c) 2001 Symbol Technologies Inc. -- http://www.symbol.com * All rights reserved. * diff --git a/sys/dev/wl/if_wl.c b/sys/dev/wl/if_wl.c index 25296b5968c1..113a985d4a75 100644 --- a/sys/dev/wl/if_wl.c +++ b/sys/dev/wl/if_wl.c @@ -1,4 +1,4 @@ -/* +/*- * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: diff --git a/sys/dev/wl/if_wl.h b/sys/dev/wl/if_wl.h index 7f9c2270ed0e..e883b782b046 100644 --- a/sys/dev/wl/if_wl.h +++ b/sys/dev/wl/if_wl.h @@ -1,4 +1,4 @@ -/* +/*- * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: diff --git a/sys/dev/xe/if_xe.c b/sys/dev/xe/if_xe.c index c60fa0a60399..a1db1029a61e 100644 --- a/sys/dev/xe/if_xe.c +++ b/sys/dev/xe/if_xe.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* +/*- * Portions of this software were derived from Werner Koch's xirc2ps driver * for Linux under the terms of the following license (from v1.30 of the * xirc2ps driver): diff --git a/sys/dev/xe/if_xe_pccard.c b/sys/dev/xe/if_xe_pccard.c index af014b94027f..8d9f7672b7fc 100644 --- a/sys/dev/xe/if_xe_pccard.c +++ b/sys/dev/xe/if_xe_pccard.c @@ -1,4 +1,4 @@ -/* +/*- * Copyright (c) 2002 Takeshi Shibagaki * All rights reserved. * diff --git a/sys/dev/zs/z8530reg.h b/sys/dev/zs/z8530reg.h index 9b191d28ba90..b471c9c4deb5 100644 --- a/sys/dev/zs/z8530reg.h +++ b/sys/dev/zs/z8530reg.h @@ -1,6 +1,6 @@ /* $NetBSD: z8530reg.h,v 1.8 1996/12/13 21:02:39 gwr Exp $ */ -/* +/*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * -- cgit v1.3 From f4f6abcb4ea1f4c91714febe157d0eaaf3e236ec Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Thu, 31 Mar 2005 12:19:44 +0000 Subject: Explicitly hold a reference to the cdev we have just cloned. This closes the race where the cdev was reclaimed before it ever made it back to devfs lookup. --- sys/cam/scsi/scsi_target.c | 1 + sys/coda/coda_fbsd.c | 1 + sys/dev/firewire/fwdev.c | 1 + sys/dev/nmdm/nmdm.c | 1 + sys/dev/snp/snp.c | 4 +++- sys/dev/sound/pcm/dsp.c | 1 + sys/dev/sound/pcm/mixer.c | 4 +++- sys/dev/vkbd/vkbd.c | 4 +++- sys/fs/coda/coda_fbsd.c | 1 + sys/fs/devfs/devfs_vnops.c | 1 + sys/kern/tty_pty.c | 1 + sys/kern/tty_tty.c | 1 + sys/net/bpf.c | 1 + sys/net/if_tap.c | 4 +++- sys/net/if_tun.c | 4 +++- sys/netsmb/smb_dev.c | 1 + 16 files changed, 26 insertions(+), 5 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c index 6b0742527948..b60c805f6892 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -1035,6 +1035,7 @@ targclone(void *arg, char *name, int namelen, struct cdev **dev) return; *dev = make_dev(&targ_cdevsw, unit2minor(u), UID_ROOT, GID_WHEEL, 0600, "targ%d", u); + dev_ref(*dev); (*dev)->si_flags |= SI_CHEAPCLONE; } diff --git a/sys/coda/coda_fbsd.c b/sys/coda/coda_fbsd.c index d68b63fb83ea..ac6ad48e8599 100644 --- a/sys/coda/coda_fbsd.c +++ b/sys/coda/coda_fbsd.c @@ -120,6 +120,7 @@ static void coda_fbsd_clone(arg, name, namelen, dev) return; *dev = make_dev(&codadevsw,unit2minor(u),UID_ROOT,GID_WHEEL,0600,"cfs%d",u); + dev_ref(*dev); mnt = malloc(sizeof(struct coda_mntinfo), M_CODA, M_WAITOK|M_ZERO); LIST_INSERT_HEAD(&coda_mnttbl, mnt, mi_list); } diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index 79c74af9fe84..ecd56c414c6d 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -875,6 +875,7 @@ found: *dev = make_dev(&firewire_cdevsw, MAKEMINOR(devflag[i], unit, sub), UID_ROOT, GID_OPERATOR, 0660, "%s%d.%d", devnames[i], unit, sub); + dev_ref(*dev); (*dev)->si_flags |= SI_CHEAPCLONE; dev_depends(sc->dev, *dev); return; diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c index cd3b5f372b5a..e61a05f5fa0f 100644 --- a/sys/dev/nmdm/nmdm.c +++ b/sys/dev/nmdm/nmdm.c @@ -147,6 +147,7 @@ nmdm_clone(void *arg, char *name, int nameen, struct cdev **dev) *dev = d1->si_drv2; else *dev = d1; + dev_ref(*dev); } static void diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index bd4bcac7375c..8be2b199e8b8 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -643,8 +643,10 @@ snp_clone(arg, name, namelen, dev) if (i) *dev = make_dev(&snp_cdevsw, unit2minor(u), UID_ROOT, GID_WHEEL, 0600, "snp%d", u); - if (*dev != NULL) + if (*dev != NULL) { + dev_ref(*dev); (*dev)->si_flags |= SI_CHEAPCLONE; + } } static int diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 5d3aa5256e74..689bec609e30 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -1174,6 +1174,7 @@ dsp_clone(void *arg, char *name, int namelen, struct cdev **dev) if ((pdev->si_drv1 == NULL) && (pdev->si_drv2 == NULL)) { *dev = pdev; + dev_ref(*dev); return; } } diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 58468477af41..9feccf64ea45 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -494,8 +494,10 @@ mixer_clone(void *arg, char *name, int namelen, struct cdev **dev) return; if (strcmp(name, "mixer") == 0) { sd = devclass_get_softc(pcm_devclass, snd_unit); - if (sd != NULL) + if (sd != NULL) { *dev = sd->mixer_dev; + dev_ref(*dev); + } } } diff --git a/sys/dev/vkbd/vkbd.c b/sys/dev/vkbd/vkbd.c index 57a40eddf7c1..a02dd3ad03af 100644 --- a/sys/dev/vkbd/vkbd.c +++ b/sys/dev/vkbd/vkbd.c @@ -168,8 +168,10 @@ vkbd_dev_clone(void *arg, char *name, int namelen, struct cdev **dev) if (clone_create(&vkbd_dev_clones, &vkbd_dev_cdevsw, &unit, dev, 0)) { *dev = make_dev(&vkbd_dev_cdevsw, unit2minor(unit), UID_ROOT, GID_WHEEL, 0600, DEVICE_NAME "%d", unit); - if (*dev != NULL) + if (*dev != NULL) { + dev_ref(*dev); (*dev)->si_flags |= SI_CHEAPCLONE; + } } } diff --git a/sys/fs/coda/coda_fbsd.c b/sys/fs/coda/coda_fbsd.c index d68b63fb83ea..ac6ad48e8599 100644 --- a/sys/fs/coda/coda_fbsd.c +++ b/sys/fs/coda/coda_fbsd.c @@ -120,6 +120,7 @@ static void coda_fbsd_clone(arg, name, namelen, dev) return; *dev = make_dev(&codadevsw,unit2minor(u),UID_ROOT,GID_WHEEL,0600,"cfs%d",u); + dev_ref(*dev); mnt = malloc(sizeof(struct coda_mntinfo), M_CODA, M_WAITOK|M_ZERO); LIST_INSERT_HEAD(&coda_mnttbl, mnt, mi_list); } diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 8c100effa319..90139c2272ee 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -655,6 +655,7 @@ devfs_lookupx(ap) devfs_populate(dmp); dde = devfs_itode(dmp, cdev->si_inode); + dev_rel(cdev); if (dde == NULL || *dde == NULL || *dde == DE_DELETED) goto notfound; diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index 21d47e27a845..3a53294a735d 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -710,6 +710,7 @@ pty_clone(void *arg, char *name, int namelen, struct cdev **dev) return; *dev = make_dev(&ptc_cdevsw, u, UID_ROOT, GID_WHEEL, 0666, "pty%c%r", names[u / 32], u % 32); + dev_ref(*dev); (*dev)->si_flags |= SI_CHEAPCLONE; return; } diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index c813211ee8ed..8951e99b263b 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -65,6 +65,7 @@ ctty_clone(void *arg, char *name, int namelen, struct cdev **dev) *dev = ctty; else *dev = curthread->td_proc->p_session->s_ttyvp->v_rdev; + dev_ref(*dev); } static void diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 7708504b31a1..3cce6e8871c1 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -1605,6 +1605,7 @@ bpf_clone(arg, name, namelen, dev) return; *dev = make_dev(&bpf_cdevsw, unit2minor(u), UID_ROOT, GID_WHEEL, 0600, "bpf%d", u); + dev_ref(*dev); (*dev)->si_flags |= SI_CHEAPCLONE; return; } diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index 46fd2762fadf..601b95d73023 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -253,8 +253,10 @@ tapclone(arg, name, namelen, dev) if (i) { *dev = make_dev(&tap_cdevsw, unit2minor(unit | extra), UID_ROOT, GID_WHEEL, 0600, "%s%d", device_name, unit); - if (*dev != NULL) + if (*dev != NULL) { + dev_ref(*dev); (*dev)->si_flags |= SI_CHEAPCLONE; + } } } /* tapclone */ diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 8936110ee8e0..6fe7b10c96b3 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -155,8 +155,10 @@ tunclone(void *arg, char *name, int namelen, struct cdev **dev) /* No preexisting struct cdev *, create one */ *dev = make_dev(&tun_cdevsw, unit2minor(u), UID_UUCP, GID_DIALER, 0600, "tun%d", u); - if (*dev != NULL) + if (*dev != NULL) { + dev_ref(*dev); (*dev)->si_flags |= SI_CHEAPCLONE; + } } } diff --git a/sys/netsmb/smb_dev.c b/sys/netsmb/smb_dev.c index 5a3dbf70a40c..89a167666ca2 100644 --- a/sys/netsmb/smb_dev.c +++ b/sys/netsmb/smb_dev.c @@ -109,6 +109,7 @@ nsmb_dev_clone(void *arg, char *name, int namelen, struct cdev **dev) return; *dev = make_dev(&nsmb_cdevsw, unit2minor(u), 0, 0, 0600, NSMB_NAME"%d", u); + dev_ref(*dev); } static int -- cgit v1.3 From 7e993ff3bc9140ccccc23d520316c214cdad4ac2 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Sat, 13 Aug 2005 21:24:18 +0000 Subject: Merge two sets of changes relating to devfs device node cloning from HEAD to RELENG_6: changes to introduce a credentialed version of the clone event handler, and then changes to merge the regular and credentialed versions into a single interface (along with updates to existing consumers). With this merge, 6.x and 7.x are in sync. First batch merges devfs_devs.c:1.37, devfs_vnops.c:1.115, kern_conf.c:1.187, tty_pty.c:1.138, mac_vfs.c:1.109, mac_biba.c:1.36, mac_lomac.c:1.36, mac_mls.c:1.73, mac_stub.c:1.53, mac_test.c:1.61, conf.h:1.223, mac.h:1.68, mac_policy.h:1.67 from HEAD to RELENG_6: When devfs cloning takes place, provide access to the credential of the process that caused the clone event to take place for the device driver creating the device. This allows cloned device drivers to adapt the device node based on security aspects of the process, such as the uid, gid, and MAC label. - Add a cred reference to struct cdev, so that when a device node is instantiated as a vnode, the cloning credential can be exposed to MAC. - Add make_dev_cred(), a version of make_dev() that additionally accepts the credential to stick in the struct cdev. Implement it and make_dev() in terms of a back-end make_dev_credv(). - Add a new event handler, dev_clone_cred, which can be registered to receive the credential instead of dev_clone, if desired. - Modify the MAC entry point mac_create_devfs_device() to accept an optional credential pointer (may be NULL), so that MAC policies can inspect and act on the label or other elements of the credential when initializing the skeleton device protections. - Modify tty_pty.c to register clone_dev_cred and invoke make_dev_cred(), so that the pty clone credential is exposed to the MAC Framework. While currently primarily focussed on MAC policies, this change is also a prerequisite for changes to allow ptys to be instantiated with the UID of the process looking up the pty. This requires further changes to the pty driver -- in particular, to immediately recycle pty nodes on last close so that the credential-related state can be recreated on next lookup. Submitted by: Andrew Reisse Obtained from: TrustedBSD Project Sponsored by: SPAWAR, SPARTA Second batch merges scsi_target.c:1.68, coda_fbsd.c:1.43, firewirereg.h:1.38, fwdev.c:1.47, nmdm.c:1.36, snp.c:1.100, dsp.c:1.82, mixer.c:1.45, vkbd.c:1.9, devfs_vnops.c:1.117, tty_pty.c:1.139, tty_tty.c:1.57, bpf.c:1.156, if_tap.c:1.56, if_tun.c:1.153, smb_dev.c:1.28, conf.h:1.224 from HEAD to RELENG_6: Merge the dev_clone and dev_clone_cred event handlers into a single event handler, dev_clone, which accepts a credential argument. Implementors of the event can ignore it if they're not interested, and most do. This avoids having multiple event handler types and fall-back/precedence logic in devfs. This changes the kernel API for /dev cloning, and may affect third party packages containg cloning kernel modules. Requested by: phk These changes modifies the kernel device driver API for device cloning, and might require minor modifications to third party device drivers that make use of devfs cloning. It will not be merged to RELENG_5. Approved by: re (scottl) --- sys/cam/scsi/scsi_target.c | 7 +++--- sys/coda/coda_fbsd.c | 7 +++--- sys/dev/firewire/firewirereg.h | 2 +- sys/dev/firewire/fwdev.c | 3 ++- sys/dev/nmdm/nmdm.c | 3 ++- sys/dev/snp/snp.c | 5 +++-- sys/dev/sound/pcm/dsp.c | 3 ++- sys/dev/sound/pcm/mixer.c | 3 ++- sys/dev/vkbd/vkbd.c | 6 +++-- sys/fs/devfs/devfs_devs.c | 3 ++- sys/fs/devfs/devfs_vnops.c | 3 ++- sys/kern/kern_conf.c | 45 +++++++++++++++++++++++++++++++++----- sys/kern/tty_pty.c | 13 ++++++----- sys/kern/tty_tty.c | 3 ++- sys/net/bpf.c | 5 +++-- sys/net/if_tap.c | 6 +++-- sys/net/if_tun.c | 6 +++-- sys/netsmb/smb_dev.c | 3 ++- sys/security/mac/mac_vfs.c | 9 ++++++-- sys/security/mac_biba/mac_biba.c | 4 ++-- sys/security/mac_lomac/mac_lomac.c | 4 ++-- sys/security/mac_mls/mac_mls.c | 4 ++-- sys/security/mac_stub/mac_stub.c | 4 ++-- sys/security/mac_test/mac_test.c | 7 ++++-- sys/sys/conf.h | 7 +++++- sys/sys/mac.h | 4 ++-- sys/sys/mac_policy.h | 6 ++++- 27 files changed, 123 insertions(+), 52 deletions(-) (limited to 'sys/dev/firewire/fwdev.c') diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c index 0b7caac831c3..1e3d893fbbbf 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -141,8 +141,8 @@ static void targfreeccb(struct targ_softc *softc, union ccb *ccb); static struct targ_cmd_descr * targgetdescr(struct targ_softc *softc); static periph_init_t targinit; -static void targclone(void *arg, char *name, int namelen, - struct cdev **dev); +static void targclone(void *arg, struct ucred *cred, char *name, + int namelen, struct cdev **dev); static void targasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg); static void abort_all_pending(struct targ_softc *softc); @@ -1025,7 +1025,8 @@ targinit(void) } static void -targclone(void *arg, char *name, int namelen, struct cdev **dev) +targclone(void *arg, struct ucred *cred, char *name, int namelen, + struct cdev **dev) { int u; diff --git a/sys/coda/coda_fbsd.c b/sys/coda/coda_fbsd.c index ac6ad48e8599..dd379d7a4664 100644 --- a/sys/coda/coda_fbsd.c +++ b/sys/coda/coda_fbsd.c @@ -70,8 +70,8 @@ int vcdebug = 1; #define VCDEBUG if (vcdebug) printf /* for DEVFS, using bpf & tun drivers as examples*/ -static void coda_fbsd_clone(void *arg, char *name, int namelen, - struct cdev **dev); +static void coda_fbsd_clone(void *arg, struct ucred *cred, char *name, + int namelen, struct cdev **dev); static int codadev_modevent(module_t mod, int type, void *data) @@ -105,8 +105,9 @@ static moduledata_t codadev_mod = { }; DECLARE_MODULE(codadev, codadev_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE); -static void coda_fbsd_clone(arg, name, namelen, dev) +static void coda_fbsd_clone(arg, cred, name, namelen, dev) void *arg; + struct ucred *cred; char *name; int namelen; struct cdev **dev; diff --git a/sys/dev/firewire/firewirereg.h b/sys/dev/firewire/firewirereg.h index 3b991ea65236..4061b8be41f2 100644 --- a/sys/dev/firewire/firewirereg.h +++ b/sys/dev/firewire/firewirereg.h @@ -303,7 +303,7 @@ struct fw_bind *fw_bindlookup (struct firewire_comm *, uint16_t, uint32_t); void fw_drain_txq (struct firewire_comm *); int fwdev_makedev (struct firewire_softc *); int fwdev_destroydev (struct firewire_softc *); -void fwdev_clone (void *, char *, int, struct cdev **); +void fwdev_clone (void *, struct ucred *, char *, int, struct cdev **); extern int firewire_debug; extern devclass_t firewire_devclass; diff --git a/sys/dev/firewire/fwdev.c b/sys/dev/firewire/fwdev.c index ecd56c414c6d..e42c30a78c97 100644 --- a/sys/dev/firewire/fwdev.c +++ b/sys/dev/firewire/fwdev.c @@ -840,7 +840,8 @@ fwdev_destroydev(struct firewire_softc *sc) #if defined(__FreeBSD__) && __FreeBSD_version >= 500000 #define NDEVTYPE 2 void -fwdev_clone(void *arg, char *name, int namelen, struct cdev **dev) +fwdev_clone(void *arg, struct ucred *cred, char *name, int namelen, + struct cdev **dev) { struct firewire_softc *sc; char *devnames[NDEVTYPE] = {"fw", "fwmem"}; diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c index e61a05f5fa0f..1c118d2960f6 100644 --- a/sys/dev/nmdm/nmdm.c +++ b/sys/dev/nmdm/nmdm.c @@ -104,7 +104,8 @@ static struct clonedevs *nmdmclones; static TAILQ_HEAD(,nm_softc) nmdmhead = TAILQ_HEAD_INITIALIZER(nmdmhead); static void -nmdm_clone(void *arg, char *name, int nameen, struct cdev **dev) +nmdm_clone(void *arg, struct ucred *cred, char *name, int nameen, + struct cdev **dev) { int i, unit; char *p; diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index 8be2b199e8b8..3e190c70909a 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -114,7 +114,7 @@ static LIST_HEAD(, snoop) snp_sclist = LIST_HEAD_INITIALIZER(&snp_sclist); static struct clonedevs *snpclones; static struct tty *snpdevtotty(struct cdev *dev); -static void snp_clone(void *arg, char *name, +static void snp_clone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev); static int snp_detach(struct snoop *snp); static int snp_down(struct snoop *snp); @@ -627,8 +627,9 @@ snppoll(dev, events, td) } static void -snp_clone(arg, name, namelen, dev) +snp_clone(arg, cred, name, namelen, dev) void *arg; + struct ucred *cred; char *name; int namelen; struct cdev **dev; diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 689bec609e30..689e598c62c9 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -1123,7 +1123,8 @@ dsp_mmap(struct cdev *i_dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) * if xN.i isn't busy, return its dev_t */ static void -dsp_clone(void *arg, char *name, int namelen, struct cdev **dev) +dsp_clone(void *arg, struct ucred *cred, char *name, int namelen, + struct cdev **dev) { struct cdev *pdev; struct snddev_info *pcm_dev; diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 9feccf64ea45..dd5c55473f0e 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -486,7 +486,8 @@ mixer_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct thread #ifdef USING_DEVFS static void -mixer_clone(void *arg, char *name, int namelen, struct cdev **dev) +mixer_clone(void *arg, struct ucred *cred, char *name, int namelen, + struct cdev **dev) { struct snddev_info *sd; diff --git a/sys/dev/vkbd/vkbd.c b/sys/dev/vkbd/vkbd.c index ed39007bc959..b399726cb202 100644 --- a/sys/dev/vkbd/vkbd.c +++ b/sys/dev/vkbd/vkbd.c @@ -124,7 +124,8 @@ typedef struct vkbd_state vkbd_state_t; ***************************************************************************** *****************************************************************************/ -static void vkbd_dev_clone(void *, char *, int, struct cdev **); +static void vkbd_dev_clone(void *, struct ucred *, char *, int, + struct cdev **); static d_open_t vkbd_dev_open; static d_close_t vkbd_dev_close; static d_read_t vkbd_dev_read; @@ -152,7 +153,8 @@ static struct clonedevs *vkbd_dev_clones = NULL; /* Clone device */ static void -vkbd_dev_clone(void *arg, char *name, int namelen, struct cdev **dev) +vkbd_dev_clone(void *arg, struct ucred *cred, char *name, int namelen, + struct cdev **dev) { int unit; diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c index 761caa5e8cbf..172a63c8902a 100644 --- a/sys/fs/devfs/devfs_devs.c +++ b/sys/fs/devfs/devfs_devs.c @@ -324,7 +324,8 @@ devfs_populate(struct devfs_mount *dm) de->de_dirent->d_type = DT_CHR; } #ifdef MAC - mac_create_devfs_device(dm->dm_mount, dev, de); + mac_create_devfs_device(dev->si_cred, dm->dm_mount, + dev, de); #endif *dep = de; de->de_dir = dd; diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 8cc9770cdca5..8f14bcf4bb44 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -705,7 +705,8 @@ devfs_lookupx(ap) goto notfound; cdev = NULL; - EVENTHANDLER_INVOKE(dev_clone, pname, strlen(pname), &cdev); + EVENTHANDLER_INVOKE(dev_clone, td->td_ucred, pname, strlen(pname), + &cdev); if (cdev == NULL) goto notfound; diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index e4d44ba027ad..3c4ab29274fd 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include static MALLOC_DEFINE(M_DEVT, "cdev", "cdev storage"); @@ -51,6 +52,9 @@ static MALLOC_DEFINE(M_DEVT, "cdev", "cdev storage"); static struct mtx devmtx; static void freedev(struct cdev *dev); static void destroy_devl(struct cdev *dev); +static struct cdev *make_dev_credv(struct cdevsw *devsw, int minornr, + struct ucred *cr, uid_t uid, gid_t gid, int mode, const char *fmt, + va_list ap); void dev_lock(void) @@ -300,6 +304,8 @@ static void freedev(struct cdev *dev) { + if (dev->si_cred != NULL) + crfree(dev->si_cred); free(dev, M_DEVT); } @@ -370,11 +376,11 @@ prep_cdevsw(struct cdevsw *devsw) dev_unlock(); } -struct cdev * -make_dev(struct cdevsw *devsw, int minornr, uid_t uid, gid_t gid, int mode, const char *fmt, ...) +static struct cdev * +make_dev_credv(struct cdevsw *devsw, int minornr, struct ucred *cr, uid_t uid, + gid_t gid, int mode, const char *fmt, va_list ap) { struct cdev *dev; - va_list ap; int i; KASSERT((minornr & ~MAXMINOR) == 0, @@ -400,16 +406,18 @@ make_dev(struct cdevsw *devsw, int minornr, uid_t uid, gid_t gid, int mode, cons ("make_dev() by driver %s on pre-existing device (min=%x, name=%s)", devsw->d_name, minor(dev), devtoname(dev))); - va_start(ap, fmt); i = vsnrprintf(dev->__si_namebuf, sizeof dev->__si_namebuf, 32, fmt, ap); if (i > (sizeof dev->__si_namebuf - 1)) { printf("WARNING: Device name truncated! (%s)\n", dev->__si_namebuf); } - va_end(ap); dev->si_devsw = devsw; dev->si_flags |= SI_NAMED; + if (cr != NULL) + dev->si_cred = crhold(cr); + else + dev->si_cred = NULL; dev->si_uid = uid; dev->si_gid = gid; dev->si_mode = mode; @@ -419,6 +427,33 @@ make_dev(struct cdevsw *devsw, int minornr, uid_t uid, gid_t gid, int mode, cons return (dev); } +struct cdev * +make_dev(struct cdevsw *devsw, int minornr, uid_t uid, gid_t gid, int mode, + const char *fmt, ...) +{ + struct cdev *dev; + va_list ap; + + va_start(ap, fmt); + dev = make_dev_credv(devsw, minornr, NULL, uid, gid, mode, fmt, ap); + va_end(ap); + return (dev); +} + +struct cdev * +make_dev_cred(struct cdevsw *devsw, int minornr, struct ucred *cr, uid_t uid, + gid_t gid, int mode, const char *fmt, ...) +{ + struct cdev *dev; + va_list ap; + + va_start(ap, fmt); + dev = make_dev_credv(devsw, minornr, cr, uid, gid, mode, fmt, ap); + va_end(ap); + + return (dev); +} + int dev_named(struct cdev *pdev, const char *name) { diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index 3a53294a735d..d38660146bcb 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -63,7 +63,7 @@ static MALLOC_DEFINE(M_PTY, "ptys", "pty data structures"); static void ptsstart(struct tty *tp); static void ptsstop(struct tty *tp, int rw); static void ptcwakeup(struct tty *tp, int flag); -static struct cdev *ptyinit(struct cdev *cdev); +static struct cdev *ptyinit(struct cdev *cdev, struct thread *td); static d_open_t ptsopen; static d_close_t ptsclose; @@ -132,7 +132,7 @@ static char *names = "pqrsPQRS"; * than 256 ptys. */ static struct cdev * -ptyinit(struct cdev *devc) +ptyinit(struct cdev *devc, struct thread *td) { struct cdev *devs; struct ptsc *pt; @@ -146,7 +146,7 @@ ptyinit(struct cdev *devc) devc->si_flags &= ~SI_CHEAPCLONE; pt = malloc(sizeof(*pt), M_PTY, M_WAITOK | M_ZERO); - pt->devs = devs = make_dev(&pts_cdevsw, n, + pt->devs = devs = make_dev_cred(&pts_cdevsw, n, td->td_ucred, UID_ROOT, GID_WHEEL, 0666, "tty%c%r", names[n / 32], n % 32); pt->devc = devc; @@ -272,7 +272,7 @@ ptcopen(struct cdev *dev, int flag, int devtype, struct thread *td) struct ptsc *pt; if (!dev->si_drv1) - ptyinit(dev); + ptyinit(dev, td); if (!dev->si_drv1) return(ENXIO); tp = dev->si_tty; @@ -681,7 +681,8 @@ ptsioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td } static void -pty_clone(void *arg, char *name, int namelen, struct cdev **dev) +pty_clone(void *arg, struct ucred *cr, char *name, int namelen, + struct cdev **dev) { int u; @@ -708,7 +709,7 @@ pty_clone(void *arg, char *name, int namelen, struct cdev **dev) u += name[4] - 'a' + 10; else return; - *dev = make_dev(&ptc_cdevsw, u, + *dev = make_dev_cred(&ptc_cdevsw, u, cr, UID_ROOT, GID_WHEEL, 0666, "pty%c%r", names[u / 32], u % 32); dev_ref(*dev); (*dev)->si_flags |= SI_CHEAPCLONE; diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index 8951e99b263b..5a99d2534ed2 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -52,7 +52,8 @@ cttyopen(struct cdev *dev, int flag, int mode, struct thread *td) } static void -ctty_clone(void *arg, char *name, int namelen, struct cdev **dev) +ctty_clone(void *arg, struct ucred *cred, char *name, int namelen, + struct cdev **dev) { if (*dev != NULL) diff --git a/sys/net/bpf.c b/sys/net/bpf.c index c42ea8178364..9ae3a96a9ea1 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -108,7 +108,7 @@ static int bpf_setdlt(struct bpf_d *, u_int); static void filt_bpfdetach(struct knote *); static int filt_bpfread(struct knote *, long); static void bpf_drvinit(void *); -static void bpf_clone(void *, char *, int, struct cdev **); +static void bpf_clone(void *, struct ucred *, char *, int, struct cdev **); static int bpf_stats_sysctl(SYSCTL_HANDLER_ARGS); /* @@ -1614,8 +1614,9 @@ bpf_setdlt(d, dlt) } static void -bpf_clone(arg, name, namelen, dev) +bpf_clone(arg, cred, name, namelen, dev) void *arg; + struct ucred *cred; char *name; int namelen; struct cdev **dev; diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index f6ee9b0a2928..f631c09fccac 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -82,7 +82,8 @@ static int tapmodevent(module_t, int, void *); /* device */ -static void tapclone(void *, char *, int, struct cdev **); +static void tapclone(void *, struct ucred *, char *, int, + struct cdev **); static void tapcreate(struct cdev *); /* network interface */ @@ -231,8 +232,9 @@ tapmodevent(mod, type, data) * We need to support two kind of devices - tap and vmnet */ static void -tapclone(arg, name, namelen, dev) +tapclone(arg, cred, name, namelen, dev) void *arg; + struct ucred *cred; char *name; int namelen; struct cdev **dev; diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 4c23fa8150da..d9c31e2ed11b 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -107,7 +107,8 @@ static struct clonedevs *tunclones; static TAILQ_HEAD(,tun_softc) tunhead = TAILQ_HEAD_INITIALIZER(tunhead); SYSCTL_INT(_debug, OID_AUTO, if_tun_debug, CTLFLAG_RW, &tundebug, 0, ""); -static void tunclone(void *arg, char *name, int namelen, struct cdev **dev); +static void tunclone(void *arg, struct ucred *cred, char *name, + int namelen, struct cdev **dev); static void tuncreate(struct cdev *dev); static int tunifioctl(struct ifnet *, u_long, caddr_t); static int tuninit(struct ifnet *); @@ -136,7 +137,8 @@ static struct cdevsw tun_cdevsw = { }; static void -tunclone(void *arg, char *name, int namelen, struct cdev **dev) +tunclone(void *arg, struct ucred *cred, char *name, int namelen, + struct cdev **dev) { int u, i; diff --git a/sys/netsmb/smb_dev.c b/sys/netsmb/smb_dev.c index 89a167666ca2..17994cff67a2 100644 --- a/sys/netsmb/smb_dev.c +++ b/sys/netsmb/smb_dev.c @@ -99,7 +99,8 @@ static struct cdevsw nsmb_cdevsw = { static eventhandler_tag nsmb_dev_tag; static void -nsmb_dev_clone(void *arg, char *name, int namelen, struct cdev **dev) +nsmb_dev_clone(void *arg, struct ucred *cred, char *name, int namelen, + struct cdev **dev) { int u; diff --git a/sys/security/mac/mac_vfs.c b/sys/security/mac/mac_vfs.c index acf21a5dbace..647697b0055c 100644 --- a/sys/security/mac/mac_vfs.c +++ b/sys/security/mac/mac_vfs.c @@ -2,6 +2,7 @@ * Copyright (c) 1999-2002 Robert N. M. Watson * Copyright (c) 2001 Ilmar S. Habibulin * Copyright (c) 2001-2005 McAfee, Inc. + * Copyright (c) 2005 SPARTA, Inc. * All rights reserved. * * This software was developed by Robert Watson and Ilmar Habibulin for the @@ -12,6 +13,9 @@ * DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA * CHATS research program. * + * This software was enhanced by SPARTA ISSO under SPAWAR contract + * N66001-04-C-6019 ("SEFOS"). + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -939,10 +943,11 @@ mac_check_mount_stat(struct ucred *cred, struct mount *mount) } void -mac_create_devfs_device(struct mount *mp, struct cdev *dev, struct devfs_dirent *de) +mac_create_devfs_device(struct ucred *cred, struct mount *mp, + struct cdev *dev, struct devfs_dirent *de) { - MAC_PERFORM(create_devfs_device, mp, dev, de, de->de_label); + MAC_PERFORM(create_devfs_device, cred, mp, dev, de, de->de_label); } void diff --git a/sys/security/mac_biba/mac_biba.c b/sys/security/mac_biba/mac_biba.c index 8faf806fab54..8d5e9db8da36 100644 --- a/sys/security/mac_biba/mac_biba.c +++ b/sys/security/mac_biba/mac_biba.c @@ -780,8 +780,8 @@ mac_biba_copy_label(struct label *src, struct label *dest) * a lot like file system objects. */ static void -mac_biba_create_devfs_device(struct mount *mp, struct cdev *dev, - struct devfs_dirent *devfs_dirent, struct label *label) +mac_biba_create_devfs_device(struct ucred *cred, struct mount *mp, + struct cdev *dev, struct devfs_dirent *devfs_dirent, struct label *label) { struct mac_biba *mac_biba; int biba_type; diff --git a/sys/security/mac_lomac/mac_lomac.c b/sys/security/mac_lomac/mac_lomac.c index 1a090ec6a1e6..cb2ebdfc421b 100644 --- a/sys/security/mac_lomac/mac_lomac.c +++ b/sys/security/mac_lomac/mac_lomac.c @@ -900,8 +900,8 @@ mac_lomac_copy_label(struct label *src, struct label *dest) * a lot like file system objects. */ static void -mac_lomac_create_devfs_device(struct mount *mp, struct cdev *dev, - struct devfs_dirent *devfs_dirent, struct label *label) +mac_lomac_create_devfs_device(struct ucred *cred, struct mount *mp, + struct cdev *dev, struct devfs_dirent *devfs_dirent, struct label *label) { struct mac_lomac *mac_lomac; int lomac_type; diff --git a/sys/security/mac_mls/mac_mls.c b/sys/security/mac_mls/mac_mls.c index a6c15115bd32..1599cc0a4c58 100644 --- a/sys/security/mac_mls/mac_mls.c +++ b/sys/security/mac_mls/mac_mls.c @@ -746,8 +746,8 @@ mac_mls_copy_label(struct label *src, struct label *dest) * a lot like file system objects. */ static void -mac_mls_create_devfs_device(struct mount *mp, struct cdev *dev, - struct devfs_dirent *devfs_dirent, struct label *label) +mac_mls_create_devfs_device(struct ucred *cred, struct mount *mp, + struct cdev *dev, struct devfs_dirent *devfs_dirent, struct label *label) { struct mac_mls *mac_mls; int mls_type; diff --git a/sys/security/mac_stub/mac_stub.c b/sys/security/mac_stub/mac_stub.c index 56ee74687bd8..8ab11e976bd6 100644 --- a/sys/security/mac_stub/mac_stub.c +++ b/sys/security/mac_stub/mac_stub.c @@ -187,8 +187,8 @@ stub_associate_vnode_singlelabel(struct mount *mp, } static void -stub_create_devfs_device(struct mount *mp, struct cdev *dev, - struct devfs_dirent *devfs_dirent, struct label *label) +stub_create_devfs_device(struct ucred *cred, struct mount *mp, + struct cdev *dev, struct devfs_dirent *devfs_dirent, struct label *label) { } diff --git a/sys/security/mac_test/mac_test.c b/sys/security/mac_test/mac_test.c index 312287eb358f..3c51215518e4 100644 --- a/sys/security/mac_test/mac_test.c +++ b/sys/security/mac_test/mac_test.c @@ -865,10 +865,13 @@ mac_test_associate_vnode_singlelabel(struct mount *mp, } static void -mac_test_create_devfs_device(struct mount *mp, struct cdev *dev, - struct devfs_dirent *devfs_dirent, struct label *label) +mac_test_create_devfs_device(struct ucred *cred, struct mount *mp, + struct cdev *dev, struct devfs_dirent *devfs_dirent, struct label *label) { + if (cred != NULL) { + ASSERT_CRED_LABEL(cred->cr_label); + } ASSERT_DEVFS_LABEL(label); } diff --git a/sys/sys/conf.h b/sys/sys/conf.h index 12cad57bbd2c..2dfa9561dee8 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -68,6 +68,7 @@ struct cdev { uid_t si_uid; gid_t si_gid; mode_t si_mode; + struct ucred *si_cred; /* cached clone-time credential */ u_int si_drv0; int si_refcount; LIST_ENTRY(cdev) si_list; @@ -253,6 +254,9 @@ void dev_rel(struct cdev *dev); void dev_strategy(struct cdev *dev, struct buf *bp); struct cdev *make_dev(struct cdevsw *_devsw, int _minor, uid_t _uid, gid_t _gid, int _perms, const char *_fmt, ...) __printflike(6, 7); +struct cdev *make_dev_cred(struct cdevsw *_devsw, int _minor, + struct ucred *_cr, uid_t _uid, gid_t _gid, int _perms, + const char *_fmt, ...) __printflike(7, 8); struct cdev *make_dev_alias(struct cdev *_pdev, const char *_fmt, ...) __printflike(2, 3); int dev2unit(struct cdev *_dev); void dev_lock(void); @@ -275,7 +279,8 @@ void devfs_destroy(struct cdev *dev); #define GID_GAMES 13 #define GID_DIALER 68 -typedef void (*dev_clone_fn)(void *arg, char *name, int namelen, struct cdev **result); +typedef void (*dev_clone_fn)(void *arg, struct ucred *cred, char *name, + int namelen, struct cdev **result); int dev_stdclone(char *_name, char **_namep, const char *_stem, int *_unit); EVENTHANDLER_DECLARE(dev_clone, dev_clone_fn); diff --git a/sys/sys/mac.h b/sys/sys/mac.h index 810c32074c9c..e21edec84eec 100644 --- a/sys/sys/mac.h +++ b/sys/sys/mac.h @@ -200,8 +200,8 @@ void mac_associate_vnode_devfs(struct mount *mp, struct devfs_dirent *de, struct vnode *vp); int mac_associate_vnode_extattr(struct mount *mp, struct vnode *vp); void mac_associate_vnode_singlelabel(struct mount *mp, struct vnode *vp); -void mac_create_devfs_device(struct mount *mp, struct cdev *dev, - struct devfs_dirent *de); +void mac_create_devfs_device(struct ucred *cred, struct mount *mp, + struct cdev *dev, struct devfs_dirent *de); void mac_create_devfs_directory(struct mount *mp, char *dirname, int dirnamelen, struct devfs_dirent *de); void mac_create_devfs_symlink(struct ucred *cred, struct mount *mp, diff --git a/sys/sys/mac_policy.h b/sys/sys/mac_policy.h index 6f10638b8d23..506f7d0f9749 100644 --- a/sys/sys/mac_policy.h +++ b/sys/sys/mac_policy.h @@ -11,6 +11,9 @@ * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), * as part of the DARPA CHATS research program. * + * This software was enhanced by SPARTA ISSO under SPAWAR contract + * N66001-04-C-6019 ("SEFOS"). + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -191,7 +194,8 @@ struct mac_policy_ops { void (*mpo_associate_vnode_singlelabel)(struct mount *mp, struct label *fslabel, struct vnode *vp, struct label *vlabel); - void (*mpo_create_devfs_device)(struct mount *mp, struct cdev *dev, + void (*mpo_create_devfs_device)(struct ucred *cred, + struct mount *mp, struct cdev *dev, struct devfs_dirent *de, struct label *label); void (*mpo_create_devfs_directory)(struct mount *mp, char *dirname, int dirnamelen, struct devfs_dirent *de, -- cgit v1.3