Subject: Re: bus_dmamap_load: struct proc *p: finding process p
To: Jachym Holecek <freza@liberouter.org>
From: Sam Thigpen <sthigpen@sdf.lonestar.org>
List: tech-kern
Date: 10/05/2004 00:23:03
On Mon, 4 Oct 2004, Jachym Holecek wrote:
>> NetBSD in this case as well..
>>
>> ath.c uses the same rx/tx descriptor, so for NetBSD acx(100)():
>>
>> error = bus_dmamap_load(sc->sc_dmat, sc->sc_ddmamap,
>> sc->sc_desc, sc->sc_desc_len,
>> NULL, &sc->sc_desc_paddr,
>> // ^^^^ assuming this is not shared with userland
>
> Minor clarification: even in this situation, you could still share those
> pages with userland if you needed to. What matters to bus_dmamap_load()
> is "in whose address space does the buf live" - since it's capable of
> mapping both kernel and user memory. So, if that memory comes from
> bus_dmamem_alloc(), then it's kernel --> NULL proc pointer.
I'm also looking to trace through cases where is DOES use user memory..
I see instances in sys/device/ic/dpt.c & sys/dev/ic/rrunner.c:
dpt.c:
rv = bus_dmamap_load(sc->sc_dmat, xfer,
ucp->ucp_dataaddr, ucp->ucp_datalen, proc,
BUS_DMA_WAITOK | BUS_DMA_STREAMING |
(datain ? BUS_DMA_READ : BUS_DMA_WRITE));
if (rv != 0) {
DPRINTF(("%s: map failed; %d\n", sc->sc_dv.dv_xname,
rv));
dpt_ccb_free(sc, ccb);
return (rv);
}
This appears to passthrough the page proc structure labelled in dptioctl
via cwdevsw dpt_cdevsw call.(????)
rrunner.c:
error = bus_dmamap_load(sc->sc_dmat, di->ed_dma,
bp->b_data, bp->b_bcount,
bp->b_proc,
BUS_DMA_READ|BUS_DMA_WAITOK);
bp is from the *buf (sys/buf.h) structure,
Looking through for more detail.
Thanks,
-sa.
sthigpen@freeshell.org
http://sthigpen.freeshell.org/code/acx/netbsd