NdisMRegisterScatterGatherDMA fails on 64 bit

Any idea why this fails in the 64 bit version of my driver? It works without problems under the 32 bit version. NIC_MAX_RECV_FRAME_SIZE = 1514

static NDIS_STATUS init_DMA_resources(IN PSEL_ETHLITE_ADAPTER adapter)
{
NDIS_STATUS status;
NDIS_SG_DMA_DESCRIPTION DMA_description;

NdisZeroMemory(&DMA_description, sizeof(DMA_description));

DMA_description.Header.Type = NDIS_OBJECT_TYPE_SG_DMA_DESCRIPTION;
DMA_description.Header.Revision = NDIS_SG_DMA_DESCRIPTION_REVISION_1;
DMA_description.Header.Size = NDIS_SIZEOF_SG_DMA_DESCRIPTION_REVISION_1;

// Max bytes in single DMA operation
DMA_description.MaximumPhysicalMapping = NIC_MAX_RECV_FRAME_SIZE;
DMA_description.ProcessSGListHandler = process_sglist_handler;

// Set if using NdisMAllocateSharedMemoryAsyncEx, which is used when the
// number of available buffers reaches a driver-determined low
DMA_description.SharedMemAllocateCompleteHandler = NULL;

status = NdisMRegisterScatterGatherDma(
adapter->adapter_handle,
&DMA_description,
&adapter->DMA_handle);

if (status == NDIS_STATUS_SUCCESS)
{
adapter->scatter_gather_list_size =
DMA_description.ScatterGatherListSize;
MP_SET_FLAG(adapter, fMP_ADAPTER_SCATTER_GATHER);
}

return status;
}

It fails with NDIS_STATUS_RESOURCES by the way…

How about setting DMA_descriotion.Flags?

Flags only needs to be set when your device supports 64 bit DMA. Mine only does 32 bit DMA.

At what time do you call ths function, and when do you call NdisMDeregisterScatterGatherDma?

I call NdisMRegisterScatterGatherDMA during the driver initialization, and call NdisMDeregisterScatterGatherDma whenever a driver init error occurs, or during driver halt.

As I said, I have no problem in 32 bit windows, however, when I run 64 bit windows and install the 64 bit driver, this function fails.

Since MaximumPhysicalMapping and ProcessSGListHandler are the only attributes I am changing, it makes no sense for this function to fail.

I’m afraid this is a deliberate decision by NDIS 6.0+ to not support SG for devices not able to do 64 bit addressing.

Where is this change stated? Is there an MSDN document somewhere that states this?

Is your miniport NDIS 6.0+?

my miniport is a 6.2 driver.

even when I set Flags = NDIS_SG_DMA_64_BIT_ADDRESS, the function call ‘NdisMRegisterScatterGatherDma’ still fails with NDIS_STATUS_RESOURCES

As I stated before, it works under 32 bit Win7, but fails for 64 bit Win7. This is an NDIS 6.2 miniport driver.

Has anyone had a similar problem? How did you resolve this issue? I’ve seen similar threads throughout the internet and on here (http://www.osronline.com/showThread.cfm?link=97322), but no solution has been provided.

What’s in your INF file?

as far as interesting items in my INF…

*IfType = 117 ; IF_TYPE_GIGABITETHERNET
*MediaType = 0 ; NdisMedium802_3
*PhysicalMediaType = 14 ; NdisPhysicalMedium802_3
Characteristics = 0x81 ; NCF_HAS_UI,NCF_VIRTUAL
BusType = 15 ; PNPBus
AddReg = selethlite.Reg ; Standard Registry Items
AddReg = selethliteui.Reg ; User Accessible Registry Items
CopyFiles = selethlite.CopyFiles

Who enumerates it? Why does it need DMA if it’s a virtual adapter on non-PCI bus?

the bus driver (that i created) enumerates it. It needs DMA because I am handling all interrupts for receive and transmit in the miniport driver itself. Usually people have the bus driver handling this, but it was too much to change to require this. I am just using the bus driver to handle shared registers among all the ports (miniport drivers).

You need to change BusType to PCIBus (5) and Characteristics to 0x84.

That did not fix the problem. Still unsure…

Have you reinstalled the driver? You could modify these values manually in the registry, though.

Is your bus driver a PCI-enumerated device?