Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: DMA buffer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DMA buffer



On Jun 11, 2004, at 8:39 AM, Lalit Chandivade wrote:

I am trying to write driver for a PCI X card which is DMA capable.
What I want to do is allocate some memory (a buffer ring) which would
contain data to be DMAed by the device.
For this I am following these steps

1) my_buffer =
my_buffer_t*)IOMallocContiguous( (vm_size_t)sizeof(my_buffer_t), PAGE_SIZE,
&phyAddr)
2) Set the device's DMA buffer registers with phyAddr from above.
3) Start the DMA

Reading through the mailing list it seems that I need to get a
IOMemoryDescriptor object after step 2) and call its prepare method before
doing the DMA start.

The question is IOMallocContiguous will create a wired down memory in the
kernel then why to call IOMemoryDescriptor's prepare()?

It's because the G5's have 64-bit physical memory addresses but PCI only has 32. So even though wired memory cannot be paged out or moved in terms of its virtual<->physical mapping, there is another layer of segmented mapping to make chunks of 64-bit-addressed memory accessible for DMA across the 32-bit-addressed PCI bus.

This mapping (being a limited resource) needs to be done and then undone when no longer needed. This is much of what prepare()/complete() do. The lack of any "complete" semantics _I think_ is why pmap_extract() had to go.

Take a read here for more info:

http://developer.apple.com/technotes/tn/tn2090.html

Best regards,
-Mike
_______________________________________________
darwin-drivers mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-drivers
Do not post admin requests to the list. They will be ignored.


References: 
 >DMA buffer (From: "Lalit Chandivade" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.