#include "ndissys.h"
-\f
VOID NTAPI HandleDeferredProcessing(
IN PKDPC Dpc,
IN PVOID DeferredContext,
NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
}
-\f
BOOLEAN NTAPI ServiceRoutine(
IN PKINTERRUPT Interrupt,
IN PVOID ServiceContext)
BOOLEAN QueueMiniportHandleInterrupt = FALSE;
PNDIS_MINIPORT_INTERRUPT NdisInterrupt = ServiceContext;
PNDIS_MINIPORT_BLOCK NdisMiniportBlock = NdisInterrupt->Miniport;
+ BOOLEAN Initializing;
NDIS_DbgPrint(MAX_TRACE, ("Called. Interrupt (0x%X)\n", NdisInterrupt));
- if (NdisInterrupt->IsrRequested) {
+ /* Certain behavior differs if MiniportInitialize is executing when the interrupt is generated */
+ Initializing = (NdisMiniportBlock->PnPDeviceState != NdisPnPDeviceStarted);
+ NDIS_DbgPrint(MAX_TRACE, ("MiniportInitialize executing: %s\n", (Initializing ? "yes" : "no")));
+
+ /* MiniportISR is always called for interrupts during MiniportInitialize */
+ if ((Initializing) || (NdisInterrupt->IsrRequested) || (NdisInterrupt->SharedInterrupt)) {
NDIS_DbgPrint(MAX_TRACE, ("Calling MiniportISR\n"));
(*NdisMiniportBlock->DriverHandle->MiniportCharacteristics.ISRHandler)(
&InterruptRecognized,
InterruptRecognized = TRUE;
}
-
+ /* TODO: Figure out if we should call this or not if Initializing is true. It appears
+ * that calling it fixes some NICs, but documentation is contradictory on it. */
if (QueueMiniportHandleInterrupt)
{
NDIS_DbgPrint(MAX_TRACE, ("Queuing DPC.\n"));
return InterruptRecognized;
}
-\f
/*
* @implemented
*/
*Data = READ_PORT_UCHAR(UlongToPtr(Port)); // FIXME: What to do with WrapperConfigurationContext?
}
-\f
/*
* @implemented
*/
*Data = READ_PORT_ULONG(UlongToPtr(Port)); // FIXME: What to do with WrapperConfigurationContext?
}
-\f
/*
* @implemented
*/
*Data = READ_PORT_USHORT(UlongToPtr(Port)); // FIXME: What to do with WrapperConfigurationContext?
}
-\f
/*
* @implemented
*/
WRITE_PORT_UCHAR(UlongToPtr(Port), Data); // FIXME: What to do with WrapperConfigurationContext?
}
-\f
/*
* @implemented
*/
WRITE_PORT_ULONG(UlongToPtr(Port), Data); // FIXME: What to do with WrapperConfigurationContext?
}
-\f
/*
* @implemented
*/
/*
* FUNCTION: Called back during reservation of map registers
* ARGUMENTS:
- * DeviceObject: Device object of the deivce setting up DMA
+ * DeviceObject: Device object of the device setting up DMA
* Irp: Reserved; must be ignored
* MapRegisterBase: Map registers assigned for transfer
* Context: LOGICAL_ADAPTER object of the requesting miniport
/* We have to hold the object open to keep our lock on the system DMA controller */
return KeepObject;
-}\f
+}
+
IO_ALLOCATION_ACTION NTAPI NdisBusMasterMapRegisterCallback (
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
/*
* FUNCTION: Called back during reservation of map registers
* ARGUMENTS:
- * DeviceObject: Device object of the deivce setting up DMA
+ * DeviceObject: Device object of the device setting up DMA
* Irp: Reserved; must be ignored
* MapRegisterBase: Map registers assigned for transfer
* Context: LOGICAL_ADAPTER object of the requesting miniport
/* We're a bus master so we can go ahead and deallocate the object now */
return DeallocateObjectKeepRegisters;
-}\f
+}
+
/*
* @implemented
*/
NDIS_DbgPrint(MAX_TRACE, ("resetting event\n"));
- KeResetEvent(&AllocationEvent);
+ KeClearEvent(&AllocationEvent);
}
NDIS_DbgPrint(MAX_TRACE, ("returning success\n"));
* NOTES:
* - Must be called at IRQL <= DISPATCH_LEVEL
* - The basic idea: call IoMapTransfer() in a loop as many times as it takes
- * in order to map all of the virtual memory to physical memoroy readable
+ * in order to map all of the virtual memory to physical memory readable
* by the device
* - The caller supplies storage for the physical address array.
*/
*ArraySize = LoopCount;
}
-\f
/*
* @implemented
*/
* ARGUMENTS:
* - MiniportAdapterHandle: handle originally input to MiniportInitialize
* - Buffer: NDIS_BUFFER to complete the mapping on
- * - PhyscialMapRegister: the chosen map register
+ * - PhysicalMapRegister: the chosen map register
* NOTES:
* - May be called at IRQL <= DISPATCH_LEVEL
*/
Adapter->NdisMiniportBlock.MapRegisters[PhysicalMapRegister].WriteToDevice);
}
-\f
/*
* @implemented
*/
ExFreePool(DmaBlock);
}
-\f
/*
* @implemented
*/
Interrupt->Miniport->Interrupt = NULL;
}
-\f
/*
* @implemented
*/
ExFreePool(Adapter->NdisMiniportBlock.MapRegisters);
}
-\f
/*
* @implemented
*/
return NDIS_STATUS_SUCCESS;
}
-\f
/*
* @implemented
*/
return AdapterObject->DmaOperations->ReadDmaCounter(AdapterObject);
}
-\f
/*
* @implemented
*/
return AdapterObject->DmaOperations->GetDmaAlignment(AdapterObject);
}
-\f
/*
* @implemented
*/
FALSE,
DmaDescription,
MaximumLength);
-}\f
+}
+
/*
* @implemented
*/
return NDIS_STATUS_FAILURE;
}
-\f
/*
* @implemented
*/
DeviceDesc.Version = DEVICE_DESCRIPTION_VERSION;
DeviceDesc.Master = TRUE;
DeviceDesc.ScatterGather = TRUE;
- DeviceDesc.Dma32BitAddresses = !Dma64BitAddresses;
+ DeviceDesc.Dma32BitAddresses = TRUE; // All callers support 32-bit addresses
DeviceDesc.Dma64BitAddresses = Dma64BitAddresses;
DeviceDesc.BusNumber = Adapter->NdisMiniportBlock.BusNumber;
DeviceDesc.InterfaceType = Adapter->NdisMiniportBlock.BusType;
/* EOF */
-