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 )
Oct ’23