Author: br Date: Thu Jul 4 14:04:08 2019 New Revision: 349727 URL: https://svnweb.freebsd.org/changeset/base/349727
Log: Negate the logic of XCHAN_CAP_NOBUFS macro and rename it to XCHAN_CAP_BOUNCE. The only application that uses bounce buffering for now is the Government Furnished Equipment (GFE) P2's dma core (AXIDMA) with its own dedicated cacheless bounce buffer. Sponsored by: DARPA, AFRL Modified: head/sys/dev/altera/softdma/softdma.c head/sys/dev/xdma/xdma.h head/sys/dev/xdma/xdma_sg.c head/sys/dev/xilinx/axidma.c Modified: head/sys/dev/altera/softdma/softdma.c ============================================================================== --- head/sys/dev/altera/softdma/softdma.c Thu Jul 4 13:23:18 2019 (r349726) +++ head/sys/dev/altera/softdma/softdma.c Thu Jul 4 14:04:08 2019 (r349727) @@ -616,7 +616,6 @@ softdma_channel_alloc(device_t dev, struct xdma_channe if (chan->used == 0) { chan->xchan = xchan; xchan->chan = (void *)chan; - xchan->caps |= XCHAN_CAP_NOBUFS; xchan->caps |= XCHAN_CAP_NOSEG; chan->index = i; chan->idx_head = 0; Modified: head/sys/dev/xdma/xdma.h ============================================================================== --- head/sys/dev/xdma/xdma.h Thu Jul 4 13:23:18 2019 (r349726) +++ head/sys/dev/xdma/xdma.h Thu Jul 4 14:04:08 2019 (r349727) @@ -137,7 +137,7 @@ struct xdma_channel { uint32_t caps; #define XCHAN_CAP_BUSDMA (1 << 0) #define XCHAN_CAP_NOSEG (1 << 1) -#define XCHAN_CAP_NOBUFS (1 << 2) +#define XCHAN_CAP_BOUNCE (1 << 2) /* A real hardware driver channel. */ void *chan; Modified: head/sys/dev/xdma/xdma_sg.c ============================================================================== --- head/sys/dev/xdma/xdma_sg.c Thu Jul 4 13:23:18 2019 (r349726) +++ head/sys/dev/xdma/xdma_sg.c Thu Jul 4 14:04:08 2019 (r349727) @@ -290,7 +290,7 @@ xdma_prep_sg(xdma_channel_t *xchan, uint32_t xr_num, } /* Allocate buffers if required. */ - if ((xchan->caps & XCHAN_CAP_NOBUFS) == 0) { + if (xchan->caps & (XCHAN_CAP_BUSDMA | XCHAN_CAP_BOUNCE)) { ret = xchan_bufs_alloc(xchan); if (ret != 0) { device_printf(xdma->dev, @@ -347,9 +347,8 @@ xchan_seg_done(xdma_channel_t *xchan, bus_dmamap_sync(xchan->dma_tag_bufs, b->map, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(xchan->dma_tag_bufs, b->map); - } else { - if ((xchan->caps & XCHAN_CAP_NOBUFS) == 0 && - xr->req_type == XR_TYPE_MBUF && + } else if (xchan->caps & XCHAN_CAP_BOUNCE) { + if (xr->req_type == XR_TYPE_MBUF && xr->direction == XDMA_DEV_TO_MEM) m_copyback(xr->m, 0, st->transferred, (void *)xr->buf.vaddr); @@ -494,13 +493,14 @@ _xdma_load_data(xdma_channel_t *xchan, struct xdma_req switch (xr->req_type) { case XR_TYPE_MBUF: - if ((xchan->caps & XCHAN_CAP_NOBUFS) == 0) { + if (xchan->caps & XCHAN_CAP_BUSDMA) + seg[0].ds_addr = mtod(m, bus_addr_t); + else if (xchan->caps & XCHAN_CAP_BOUNCE) { if (xr->direction == XDMA_MEM_TO_DEV) m_copydata(m, 0, m->m_pkthdr.len, (void *)xr->buf.vaddr); seg[0].ds_addr = (bus_addr_t)xr->buf.paddr; - } else - seg[0].ds_addr = mtod(m, bus_addr_t); + } seg[0].ds_len = m->m_pkthdr.len; break; case XR_TYPE_BIO: @@ -626,7 +626,7 @@ xdma_queue_submit_sg(xdma_channel_t *xchan) sg = xchan->sg; - if ((xchan->caps & XCHAN_CAP_NOBUFS) == 0 && + if ((xchan->caps & (XCHAN_CAP_BOUNCE | XCHAN_CAP_BUSDMA)) && (xchan->flags & XCHAN_BUFS_ALLOCATED) == 0) { device_printf(xdma->dev, "%s: Can't submit a transfer: no bufs\n", Modified: head/sys/dev/xilinx/axidma.c ============================================================================== --- head/sys/dev/xilinx/axidma.c Thu Jul 4 13:23:18 2019 (r349726) +++ head/sys/dev/xilinx/axidma.c Thu Jul 4 14:04:08 2019 (r349727) @@ -399,6 +399,7 @@ axidma_channel_alloc(device_t dev, struct xdma_channel if (axidma_reset(sc, data->id) != 0) return (-1); chan->xchan = xchan; + xchan->caps |= XCHAN_CAP_BOUNCE; xchan->chan = (void *)chan; chan->sc = sc; chan->used = true; _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"