mirror of
https://github.com/reactos/reactos.git
synced 2024-09-06 10:52:52 +00:00
- Fix our DMA implementation to use documented structs
svn path=/trunk/; revision=41039
This commit is contained in:
parent
4db4705697
commit
13d610f832
|
@ -503,14 +503,17 @@ NdisMCompleteBufferPhysicalMapping(
|
||||||
VOID
|
VOID
|
||||||
EXPORT
|
EXPORT
|
||||||
NdisMDeregisterDmaChannel(
|
NdisMDeregisterDmaChannel(
|
||||||
IN PNDIS_HANDLE MiniportDmaHandle)
|
IN NDIS_HANDLE MiniportDmaHandle)
|
||||||
{
|
{
|
||||||
PNDIS_MINIPORT_BLOCK NdisMiniportBlock = (PNDIS_MINIPORT_BLOCK)MiniportDmaHandle;
|
PNDIS_DMA_BLOCK DmaBlock = MiniportDmaHandle;
|
||||||
PDMA_ADAPTER AdapterObject = NdisMiniportBlock->SystemAdapterObject;
|
PDMA_ADAPTER AdapterObject = (PDMA_ADAPTER)DmaBlock->SystemAdapterObject;
|
||||||
|
|
||||||
|
if (AdapterObject == ((PLOGICAL_ADAPTER)DmaBlock->Miniport)->NdisMiniportBlock.SystemAdapterObject)
|
||||||
|
((PLOGICAL_ADAPTER)DmaBlock->Miniport)->NdisMiniportBlock.SystemAdapterObject = NULL;
|
||||||
|
|
||||||
AdapterObject->DmaOperations->PutDmaAdapter(AdapterObject);
|
AdapterObject->DmaOperations->PutDmaAdapter(AdapterObject);
|
||||||
|
|
||||||
NdisMiniportBlock->SystemAdapterObject = NULL;
|
ExFreePool(DmaBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -650,14 +653,11 @@ EXPORT
|
||||||
NdisMReadDmaCounter(
|
NdisMReadDmaCounter(
|
||||||
IN NDIS_HANDLE MiniportDmaHandle)
|
IN NDIS_HANDLE MiniportDmaHandle)
|
||||||
{
|
{
|
||||||
PNDIS_MINIPORT_BLOCK MiniportBlock = (PNDIS_MINIPORT_BLOCK)MiniportDmaHandle;
|
PNDIS_DMA_BLOCK DmaBlock = MiniportDmaHandle;
|
||||||
PDMA_ADAPTER AdapterObject = MiniportBlock->SystemAdapterObject;
|
PDMA_ADAPTER AdapterObject = (PDMA_ADAPTER)DmaBlock->SystemAdapterObject;
|
||||||
|
|
||||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||||
|
|
||||||
if (AdapterObject == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return AdapterObject->DmaOperations->ReadDmaCounter(AdapterObject);
|
return AdapterObject->DmaOperations->ReadDmaCounter(AdapterObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,14 +670,11 @@ EXPORT
|
||||||
NdisMGetDmaAlignment(
|
NdisMGetDmaAlignment(
|
||||||
IN NDIS_HANDLE MiniportDmaHandle)
|
IN NDIS_HANDLE MiniportDmaHandle)
|
||||||
{
|
{
|
||||||
PNDIS_MINIPORT_BLOCK MiniportBlock = (PNDIS_MINIPORT_BLOCK)MiniportDmaHandle;
|
PNDIS_DMA_BLOCK DmaBlock = MiniportDmaHandle;
|
||||||
PDMA_ADAPTER AdapterObject = MiniportBlock->SystemAdapterObject;
|
PDMA_ADAPTER AdapterObject = (PDMA_ADAPTER)DmaBlock->SystemAdapterObject;
|
||||||
|
|
||||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||||
|
|
||||||
if (AdapterObject == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return AdapterObject->DmaOperations->GetDmaAlignment(AdapterObject);
|
return AdapterObject->DmaOperations->GetDmaAlignment(AdapterObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -698,16 +695,10 @@ NdisMRegisterDmaChannel(
|
||||||
PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)MiniportAdapterHandle;
|
PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)MiniportAdapterHandle;
|
||||||
DEVICE_DESCRIPTION DeviceDesc;
|
DEVICE_DESCRIPTION DeviceDesc;
|
||||||
ULONG MapRegisters;
|
ULONG MapRegisters;
|
||||||
|
PNDIS_DMA_BLOCK DmaBlock;
|
||||||
|
|
||||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||||
|
|
||||||
if (Adapter->NdisMiniportBlock.SystemAdapterObject)
|
|
||||||
{
|
|
||||||
NDIS_DbgPrint(MIN_TRACE,("Using existing DMA adapter\n"));
|
|
||||||
*MiniportDmaHandle = &Adapter->NdisMiniportBlock;
|
|
||||||
return NDIS_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlZeroMemory(&DeviceDesc, sizeof(DEVICE_DESCRIPTION));
|
RtlZeroMemory(&DeviceDesc, sizeof(DEVICE_DESCRIPTION));
|
||||||
|
|
||||||
DeviceDesc.Version = DEVICE_DESCRIPTION_VERSION;
|
DeviceDesc.Version = DEVICE_DESCRIPTION_VERSION;
|
||||||
|
@ -724,13 +715,23 @@ NdisMRegisterDmaChannel(
|
||||||
DeviceDesc.DmaSpeed = DmaDescription->DmaSpeed;
|
DeviceDesc.DmaSpeed = DmaDescription->DmaSpeed;
|
||||||
DeviceDesc.MaximumLength = MaximumLength;
|
DeviceDesc.MaximumLength = MaximumLength;
|
||||||
|
|
||||||
Adapter->NdisMiniportBlock.SystemAdapterObject =
|
|
||||||
IoGetDmaAdapter(Adapter->NdisMiniportBlock.PhysicalDeviceObject, &DeviceDesc, &MapRegisters);
|
|
||||||
|
|
||||||
if (!Adapter->NdisMiniportBlock.SystemAdapterObject)
|
DmaBlock = ExAllocatePool(NonPagedPool, sizeof(NDIS_DMA_BLOCK));
|
||||||
|
if (!DmaBlock)
|
||||||
return NDIS_STATUS_RESOURCES;
|
return NDIS_STATUS_RESOURCES;
|
||||||
|
|
||||||
*MiniportDmaHandle = &Adapter->NdisMiniportBlock;
|
DmaBlock->SystemAdapterObject = (PVOID)IoGetDmaAdapter(Adapter->NdisMiniportBlock.PhysicalDeviceObject, &DeviceDesc, &MapRegisters);
|
||||||
|
|
||||||
|
if (!DmaBlock->SystemAdapterObject) {
|
||||||
|
ExFreePool(DmaBlock);
|
||||||
|
return NDIS_STATUS_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
Adapter->NdisMiniportBlock.SystemAdapterObject = (PDMA_ADAPTER)DmaBlock->SystemAdapterObject;
|
||||||
|
|
||||||
|
DmaBlock->Miniport = Adapter;
|
||||||
|
|
||||||
|
*MiniportDmaHandle = DmaBlock;
|
||||||
|
|
||||||
return NDIS_STATUS_SUCCESS;
|
return NDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue