Writing a 64-bit Windows driver for a 32-bit PCI device

I appreciate porting a device driver that I wrote a few years ago from 32 to 64 bits. The physical device is a 32-bit PCI card. That is, the device has 32 bits, but I need to access it from Win7x64. The device represents some registers in the Windows world, and then executes heavy bus master data, transferring memory allocated by the driver to a piece.

I read in the Microsoft documentation that you can indicate whether the driver supports 64-bit DMA or not. If this is not the case, then DMA will be double buffered. However, I am not sure if this is so. My driver will / may be full 64-bit, so it can support 64-bit addresses in the address space of the processor, but the actual physical device will NOT support it. In fact, the device’s BAR devices must be displayed under 4 GB, and the device must receive a PC-RAM address to run the bus master below 4 GB. Does this mean that my driver will always undergo double buffering? This is a very performance sensitive process, and double buffering can interfere with the entire system.

Of course, the development of a new 64-bit PCI (or PCI-E) card is out of the question.

Can anyone give me some resources for this process (other than MS pages)?

Thanks a lot!

+4
source share
1 answer

This is an old post, I hope the answer is still relevant ...

There are two parts: access to PCI and basic access to PCI.

PCI Target Access: The driver maps the PCI BAR to a 64-bit virtual address space, and the driver simply reads / writes through the pointer.

Basic PCI Access:. You need to create a DmaAdapter object by calling IoGetDmaAdapter () . When creating, you also describe that your device is 32-bit (see DEVICE_DESCRIPTION Parameter). Then you call the DmaAdapter :: AllocateCommonBuffer () method to place the adjacent DMA buffer in the PC RAM.

I'm not sure about double buffering. In my experience, double buffering is not used, instead DmaAdapter :: AllocateCommonBuffer () just fails if it cannot allocate a buffer that satisfies DEVICE_DESCRIPTION (in your case, 32-bit dma addressing).

0
source

All Articles