Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/xilinx/axidma.c
Show First 20 Lines • Show All 357 Lines • ▼ Show 20 Lines | axidma_desc_alloc(struct axidma_softc *sc, struct xdma_channel *xchan, | ||||
if (vmem_alloc(xchan->vmem, chan->mem_size, M_FIRSTFIT | M_NOWAIT, | if (vmem_alloc(xchan->vmem, chan->mem_size, M_FIRSTFIT | M_NOWAIT, | ||||
&chan->mem_paddr)) { | &chan->mem_paddr)) { | ||||
device_printf(sc->dev, "Failed to allocate memory.\n"); | device_printf(sc->dev, "Failed to allocate memory.\n"); | ||||
return (-1); | return (-1); | ||||
} | } | ||||
chan->mem_vaddr = kva_alloc(chan->mem_size); | chan->mem_vaddr = kva_alloc(chan->mem_size); | ||||
pmap_kenter_device(chan->mem_vaddr, chan->mem_size, chan->mem_paddr); | pmap_kenter_device(chan->mem_vaddr, chan->mem_size, chan->mem_paddr); | ||||
device_printf(sc->dev, "Allocated chunk %lx %d\n", | device_printf(sc->dev, "Allocated chunk %lx %lu\n", | ||||
chan->mem_paddr, chan->mem_size); | chan->mem_paddr, chan->mem_size); | ||||
for (i = 0; i < nsegments; i++) { | for (i = 0; i < nsegments; i++) { | ||||
chan->descs[i] = (struct axidma_desc *) | chan->descs[i] = (struct axidma_desc *) | ||||
((uint64_t)chan->mem_vaddr + desc_size * i); | ((uint64_t)chan->mem_vaddr + desc_size * i); | ||||
chan->descs_phys[i] = chan->mem_paddr + desc_size * i; | chan->descs_phys[i] = chan->mem_paddr + desc_size * i; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 275 Lines • Show Last 20 Lines |