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



Hi Michael and Andrew,

Thanks for the quick reply.

Please bear with by obtuse knowledge of G5 PCI bus architecture.
What I understand from your notes is that G5 has 64-bit physical memory
addressing and
the PCI (or the PCI-X) bus on G5 is capable of 32 bit addressing only.
This is the reason why the DART (from technote 2090) and the
IOMemoryDescriptor->prepare() come into picture.
To convert systems 64 bit addresses to PCI-X devices 32 bit addresses for
DMA.

Is that correct?

What if the G5 PCI-X bus is capable of 64 bit addressing? Is that possible?
In that case is DART required?

Thanks,
Lalit.




-----Original Message-----
From: email@hidden
[mailto:email@hidden]On Behalf Of Michael
Cashwell
Sent: Friday, June 11, 2004 6:34 PM
To: Lalit Chandivade
Cc: email@hidden
Subject: 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.
_______________________________________________
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: 
 >Re: DMA buffer (From: Michael Cashwell <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.