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
This commit is contained in:
parent
dd2eb48e68
commit
84fd1988a0
@ -616,7 +616,6 @@ softdma_channel_alloc(device_t dev, struct xdma_channel *xchan)
|
||||
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;
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -399,6 +399,7 @@ axidma_channel_alloc(device_t dev, struct xdma_channel *xchan)
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user