Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ethernet drivers for Mac OS X



On May 17, 2005, at 3:35 PM, rsriram wrote:

I need a clarification..

For receive descriptors we need to provide 4k memory for our adapter.
I am given to understand that earlier mac implementation had 2k limitation.


Do we still have any such limitation in MAC OS. I am working on 10.3.9.

Is a "receive descriptor" scratch space for the device or are you asking here about the actual packet buffers? I haven't worked with large packets, so if you mean 4KB mbufs then I can't help.


If you mean just general memory for the device then you can certainly allocate 4KB, get its physical address and pass that to your adaptor for its bus-master DMA. I've done this and it's fine.

If you are only allocating 4KB then you won't need kIOMemoryPhysicallyContiguous as I did below since a 1-page allocation will be contiguous by definition. If you allocate more than 1 page then it can be an issue. And in that case bear in mind that the alignment only applies to the virtual address. There is no support for large-grain alignment of physical memory whether contiguous or not. (Those are 2 days of debugging I'll never get back...)

My code went something like this:

QmemDescriptor = IOBufferMemoryDescriptor::inTaskWithOptions(
kernel_task, kIOMemoryPhysicallyContiguous,
qsize, PAGE_SIZE);
if (QmemDescriptor) {
QmemMap = QmemDescriptor->map(kIOMapInhibitCache);
QmemDescriptor->prepare(kIODirectionInOut); // make ready for DMA
qVirt = QmemMap->getVirtualAddress();
qPhys = QmemMap->getPhysicalAddress();
} else {
IOLog("%s: Queue allocation failed.\n", fInstanceName);
return false;
}


and then to clean up:

if (QmemMap)
QmemMap->release(), QmemMap = 0;
if (QmemDescriptor)
QmemDescriptor->complete(), QmemDescriptor->release(), QmemDescriptor = 0;


Now, if you are asking about using the system's DMA engine and not a bus-master device then I'm less sure. I'd be surprised if it couldn't handle 4KB (since that's the VM page size) but I have no experience working with that.

Hope this helps.
-Mike

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-drivers/email@hidden

This email sent to email@hidden
References: 
 >Ethernet drivers for Mac OS X (From: "rsriram" <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.