mmap
I use the 'map_user_kiobuf' and 'lock_kiovec' kernel routines in a module for 'user space memory'. After that if I pass the '(iobuf->maplist[0])-mem_map) << PAGE_SHIFT)' to the hardware for DMA operations and it works fine for Intel platforms. Now how can I use the 'iobuf' struct obtained after lock_kiovec operation to get a PCI bus address that I can pass to hardware for DMA operations on my Apple machine.?
thanks,
Daljeet.
|--------+-----------------------> | | Gerd Knorr | | | <kraxel@bytes| | | ex.org> | | | | | | 05/15/01 | | | 01:03 PM | | | Please | | | respond to | | | Gerd Knorr | | | | |--------+----------------------->
Quoted 1 line
-----------------------------------------------------------------------|
| | | To: [email protected] | | cc: (bcc: Daljeet Maini/India/IBM) | | Subject: Re: mmap | >-----------------------------------------------------------------------|
Quoted 5 lines · [email protected] wrote:
I am doing the following:
malloc some memory is user space
pass its pointer to some kernel module
in the kernel module...do apci_alloc_consistentso that i get a
memory
Quoted 1 line
region for PCI DMA operations
Wrong approach, you can use kiobufs if you want DMA to the malloc()ed userspace memory:
* lock down the user memory using map_user_kiobuf() + lock_kiovec() (see linux/iobuf.h).
* translate the iobuf->maplist into a scatterlist [1]
* feed pci_map_sg() with the scatterlist to get DMA addresses. you can pass to the hardware.
And the reverse to free everything when you are done of course.
Gerd
[1] IMHO it would be more useful if iobufs would use a scatterlist instead of an struct page* array.
--
Gerd Knorr <[email protected]> -- SuSE Labs, Außenstelle Berlin -
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 2 lines · On Mon, Jul 02 2001, [email protected] wrote:
[1] IMHO it would be more useful if iobufs would use a scatterlist instead of an struct page* array.
No that would be horrible, at least with the current scatterlist. A page based scatterlist would be alright though -- but this boils down to the per-page offset debate again.
Signature · 1 line
Jens Axboe