mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
Bring in the good version of this file.
This commit is contained in:
parent
448434c3c9
commit
70359cf526
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=150893
@ -494,14 +494,10 @@ bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dma_segment_t *segs,
|
||||
} else {
|
||||
curaddr = (pte & L2_S_FRAME) |
|
||||
(vaddr & L2_S_OFFSET);
|
||||
pmap_uncache(ptep);
|
||||
map->flags |= DMAMAP_UNCACHED;
|
||||
#if 0
|
||||
if (pte & L2_S_CACHE_MASK) {
|
||||
map->flags &=
|
||||
~DMAMAP_COHERENT;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -774,43 +770,7 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, bus_dmamap_t map, struct uio *uio,
|
||||
*/
|
||||
void
|
||||
_bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map)
|
||||
{
|
||||
struct mbuf *m;
|
||||
struct uio *uio;
|
||||
int resid;
|
||||
struct iovec *iov;
|
||||
|
||||
if (map->flags & DMAMAP_UNCACHED) {
|
||||
switch(map->flags & DMAMAP_TYPE_MASK) {
|
||||
case DMAMAP_LINEAR:
|
||||
pmap_recache(map->buffer, len);
|
||||
break;
|
||||
case DMAMAP_MBUF:
|
||||
m = map->buffer;
|
||||
while (m) {
|
||||
if (m->m_len > 0)
|
||||
pmap_recache(m->m_data, len);
|
||||
m = m->m_next;
|
||||
}
|
||||
break;
|
||||
case DMAMAP_UIO:
|
||||
uio = map->buffer;
|
||||
iov = uio->uio_iov;
|
||||
resid = uio->uio_resid;
|
||||
for (int i = 0; i < uio->uio_iovcnt && resid != 0; i++) {
|
||||
bus_size_t minlen = resid < iov[i].iov_len ? resid :
|
||||
iov[i].iov_len;
|
||||
if (minlen > 0) {
|
||||
pmap_recache(iov[i].iov_base, minlen);
|
||||
resid -= minlen;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
map->flags &= ~DMAMAP_TYPE_MASK;
|
||||
return;
|
||||
}
|
||||
@ -840,10 +800,8 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op)
|
||||
|
||||
if (!(op & (BUS_DMASYNC_PREWRITE | BUS_DMASYNC_POSTREAD)))
|
||||
return;
|
||||
if (map->flags & DMAMAP_COHERENT) {
|
||||
printf("COHERENT\n");
|
||||
if (map->flags & DMAMAP_COHERENT)
|
||||
return;
|
||||
}
|
||||
if ((op && BUS_DMASYNC_POSTREAD) && (map->len >= 2 * PAGE_SIZE)) {
|
||||
cpu_dcache_wbinv_all();
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user