/* * ioctl support. */ int fw_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, fw_proc *td) { struct firewire_comm *fc; struct fw_drv1 *d; 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_devinfo *devinfo; void *ptr; 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; struct fw_crom_buf *crom_buf = (struct fw_crom_buf *)data; if (DEV_FWMEM(dev)) return fwmem_ioctl(dev, cmd, data, flag, td); if (!data) return (EINVAL); d = dev->si_drv1; fc = d->fc; ir = d->ir; it = d->it; switch (cmd) { case FW_STSTREAM: if (it == NULL) { i = fw_open_isodma(fc, /* tx */1); if (i < 0) { err = EBUSY; break; } it = fc->it[i]; err = fwdev_allocbuf(fc, it, &d->bufreq.tx); if (err) { it->flag &= ~FWXFERQ_OPEN; break; } } it->flag &= ~0xff; it->flag |= (0x3f & ichreq->ch); it->flag |= ((0x3 & ichreq->tag) << 6); d->it = it; break; case FW_GTSTREAM: if (it != NULL) { ichreq->ch = it->flag & 0x3f; ichreq->tag = it->flag >> 2 & 0x3; } else
/* * ioctl support. */ int fw_ioctl (struct dev_ioctl_args *ap) { cdev_t dev = ap->a_head.a_dev; struct firewire_softc *sc; struct firewire_comm *fc; struct fw_drv1 *d; int unit = DEV2UNIT(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_devinfo *devinfo; void *ptr; struct fw_devlstreq *fwdevlst = (struct fw_devlstreq *)ap->a_data; struct fw_asyreq *asyreq = (struct fw_asyreq *)ap->a_data; struct fw_isochreq *ichreq = (struct fw_isochreq *)ap->a_data; struct fw_isobufreq *ibufreq = (struct fw_isobufreq *)ap->a_data; struct fw_asybindreq *bindreq = (struct fw_asybindreq *)ap->a_data; struct fw_crom_buf *crom_buf = (struct fw_crom_buf *)ap->a_data; if (DEV_FWMEM(dev)) return fwmem_ioctl(ap); if (!ap->a_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 (ap->a_cmd) { case FW_STSTREAM: 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; break; case FW_GTSTREAM: if (it != NULL) { ichreq->ch = it->flag & 0x3f; ichreq->tag = it->flag >> 2 & 0x3; } else