diff options
| author | Ruslan Bukin <br@FreeBSD.org> | 2019-07-04 14:04:08 +0000 |
|---|---|---|
| committer | Ruslan Bukin <br@FreeBSD.org> | 2019-07-04 14:04:08 +0000 |
| commit | 0c340d7ed9072218c10e52a40b500befe2bafe58 (patch) | |
| tree | efa46ff5dd23948533b3423c4b8080c2a98fff68 /sys/dev/xdma | |
| parent | 57d0d4a271b13a912dfa2ba3321a4a0a75d0bff8 (diff) | |
Notes
Diffstat (limited to 'sys/dev/xdma')
| -rw-r--r-- | sys/dev/xdma/xdma.h | 2 | ||||
| -rw-r--r-- | sys/dev/xdma/xdma_sg.c | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/sys/dev/xdma/xdma.h b/sys/dev/xdma/xdma.h index 583ad63e4e0f8..b645bd50adb38 100644 --- a/sys/dev/xdma/xdma.h +++ b/sys/dev/xdma/xdma.h @@ -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; diff --git a/sys/dev/xdma/xdma_sg.c b/sys/dev/xdma/xdma_sg.c index e6c593c7c47a8..2dff9761e8dd6 100644 --- a/sys/dev/xdma/xdma_sg.c +++ b/sys/dev/xdma/xdma_sg.c @@ -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_request *xr, 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", |
