Post

Replies

Boosts

Views

Activity

Reply to PCI dext: scatter-gather DMA to application buffer
Hi, I had similar struggles when I was porting my KEXT PCIE driver to DEXT driver. I especially had a hard time porting DMA functionality. The problem was DriverKit has some restrictions about memory management API. And I also couldn't useIOMemoryDescriptor::withAddressRange like @Benoit55 said and I didn't want to copy the user space buffer like @erich-areca so I came up with two solutions. You can choose to allocate a buffer in DEXT address space using IOBufferMemoryDescriptor::Create and map it to the user space using functions IOConnectMapMemory64and CopyClientMemoryForTypefunctions You can use the feature of IOConnectCallStructMethod that creates IOMemoryDescriptor when the structure size (or buffer size ) exceeds the size of a page ( 4096 byte ) and you may need to map that descriptor to DEXT space using CreateMapping instance method. And rest is same as usual ( usingIODMACommand to prepare and create bus address segments )
Topic: App & System Services SubTopic: Drivers Tags:
Oct ’23
Reply to PCI dext: scatter-gather DMA to application buffer
Hi, I had similar struggles when I was porting my KEXT PCIE driver to DEXT driver. I especially had a hard time porting DMA functionality. The problem was DriverKit has some restrictions about memory management API. And I also couldn't useIOMemoryDescriptor::withAddressRange like @Benoit55 said and I didn't want to copy the user space buffer like @erich-areca so I came up with two solutions. You can choose to allocate a buffer in DEXT address space using IOBufferMemoryDescriptor::Create and map it to the user space using functions IOConnectMapMemory64and CopyClientMemoryForTypefunctions You can use the feature of IOConnectCallStructMethod that creates IOMemoryDescriptor when the structure size (or buffer size ) exceeds the size of a page ( 4096 byte ) and you may need to map that descriptor to DEXT space using CreateMapping instance method. And rest is same as usual ( usingIODMACommand to prepare and create bus address segments )
Topic: App & System Services SubTopic: Drivers Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Driver(dext) interface maximum data size
I had a similar problem but I believe your problem is not related to IOConnectCallStructMethod because I've recently checked the size limit and works ok for my case. Do you still have a similar problem or is it solved ? You can try to allocate same space from heap and check if it is working ok.
Topic: App & System Services SubTopic: Drivers Tags:
Replies
Boosts
Views
Activity
Oct ’23