98 DPRINT(
"receive interrupt\n");
108 DPRINT(
"no more receive descriptors to process\n");
139 IndicatedData =
TRUE;
160 DPRINT(
"transmit interrupt\n");
167 DPRINT(
"buffer %d flags %x flags2 %x\n",
173 DPRINT(
"non-TXed buffer\n");
212 DPRINT(
"UNHANDLED INTERRUPT CSR0 0x%x\n",
Data);
249 DPRINT1(
"NdisReadPciSlotInformation failed\n");
256 DPRINT1(
"card in slot isn't our: 0x%x\n", 0, buf32);
270 DPRINT1(
"NdisReadPciSlotInformation failed\n");
276 DPRINT1(
"No base i/o address set\n");
282 DPRINT(
"detected io address 0x%x\n", buf32);
283 Adapter->IoBaseAddress = buf32;
290 DPRINT1(
"NdisReadPciSlotInformation failed\n");
294 DPRINT(
"interrupt: 0x%x\n", buf8);
295 Adapter->InterruptVector = buf8;
371 while (BufferCount != 0)
380 DPRINT1(
"insufficient resources\n");
398 DPRINT1(
"Backing off buffer count by %d buffers due to allocation failure\n", (BufferCount >> 1));
399 BufferCount = BufferCount >> 1;
420 DPRINT1(
"Backing off buffer count by %d buffers due to allocation failure\n", (BufferCount >> 1));
421 BufferCount = BufferCount >> 1;
442 DPRINT1(
"Backing off buffer count by %d buffers due to allocation failure\n", (BufferCount >> 1));
443 BufferCount = BufferCount >> 1;
464 DPRINT1(
"Backing off buffer count by %d buffers due to allocation failure\n", (BufferCount >> 1));
465 BufferCount = BufferCount >> 1;
485 DPRINT1(
"Failed to allocate adapter buffers\n");
494 for(
i = 0;
i < BufferCount;
i++)
501 DPRINT(
"transmit ring initialized\n");
505 for(
i = 0;
i < BufferCount;
i++)
512 DPRINT(
"receive ring initialized\n");
531 for(
i = 0;
i < 6;
i++)
533 DPRINT(
"MAC address: %02x-%02x-%02x-%02x-%02x-%02x\n",
630 DPRINT(
"MediaState: %d\n", MediaState);
735 DPRINT(
"programmed with init block\n");
772 Adapter->
Flags &= ~RESET_IN_PROGRESS;
801 for(
i = 0;
i < 6;
i++)
845 DPRINT(
"Stopping the chip\n");
886 UINT *RegNetworkAddress = 0;
887 UINT RegNetworkAddressLength = 0;
899 DPRINT1(
"unsupported media\n");
911 DPRINT1(
"Insufficient resources\n");
929 DPRINT1(
"MiQueryCard failed\n");
952 MapRegistersAllocated =
TRUE;
963 InterruptRegistered =
TRUE;
985 DPRINT(
"NdisReadNetworkAddress returned successfully, address %x:%x:%x:%x:%x:%x\n",
986 RegNetworkAddress[0], RegNetworkAddress[1], RegNetworkAddress[2], RegNetworkAddress[3],
987 RegNetworkAddress[4], RegNetworkAddress[5]);
989 for(
i = 0;
i < 6;
i++)
996 DPRINT(
"Interrupt registered successfully\n");
1009 DPRINT(
"Error; freeing stuff\n");
1013 if(MapRegistersAllocated)
1019 if(InterruptRegistered)
1039 if(!MiTestCard(Adapter))
1081 DPRINT(
"not our interrupt.\n");
1082 *InterruptRecognized =
FALSE;
1083 *QueueMiniportHandleInterrupt =
FALSE;
1087 DPRINT(
"detected our interrupt\n");
1093 *InterruptRecognized =
TRUE;
1094 *QueueMiniportHandleInterrupt =
TRUE;
1122 *AddressingReset =
FALSE;
1179 DPRINT1(
"No free space in circular buffer\n");
1189 DPRINT(
"TotalPacketLength: %x\n", TotalPacketLength);
1195 DPRINT(
"Buffer: %x Length: %x\n", SourceBuffer, SourceLength);
1199 SourceBuffer, SourceLength);
1224 Desc->
BCNT = 0xf000 | -(
INT)TotalPacketLength;
1348 Characteristics.MajorNdisVersion = NDIS_MINIPORT_MAJOR_VERSION;
1349 Characteristics.MinorNdisVersion = NDIS_MINIPORT_MINOR_VERSION;
DRIVER_INITIALIZE DriverEntry
#define ASSERT_IRQL_EQUAL(x)
NDIS_STATUS NTAPI MiniportSetInformation(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesRead, OUT PULONG BytesNeeded)
NDIS_STATUS NTAPI MiniportQueryInformation(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesWritten, OUT PULONG BytesNeeded)
VOID EXPORT NdisCloseConfiguration(IN NDIS_HANDLE ConfigurationHandle)
VOID EXPORT NdisReadNetworkAddress(OUT PNDIS_STATUS Status, OUT PVOID *NetworkAddress, OUT PUINT NetworkAddressLength, IN NDIS_HANDLE ConfigurationHandle)
VOID EXPORT NdisOpenConfiguration(OUT PNDIS_STATUS Status, OUT PNDIS_HANDLE ConfigurationHandle, IN NDIS_HANDLE WrapperConfigurationContext)
ULONG EXPORT NdisReadPciSlotInformation(IN NDIS_HANDLE NdisAdapterHandle, IN ULONG SlotNumber, IN ULONG Offset, IN PVOID Buffer, IN ULONG Length)
ULONG EXPORT NdisWritePciSlotInformation(IN NDIS_HANDLE NdisAdapterHandle, IN ULONG SlotNumber, IN ULONG Offset, IN PVOID Buffer, IN ULONG Length)
NDIS_STATUS EXPORT NdisMAllocateMapRegisters(IN NDIS_HANDLE MiniportAdapterHandle, IN UINT DmaChannel, IN NDIS_DMA_SIZE DmaSize, IN ULONG BaseMapRegistersNeeded, IN ULONG MaximumBufferSize)
VOID EXPORT NdisMDeregisterInterrupt(IN PNDIS_MINIPORT_INTERRUPT Interrupt)
VOID EXPORT NdisMDeregisterIoPortRange(IN NDIS_HANDLE MiniportAdapterHandle, IN UINT InitialPort, IN UINT NumberOfPorts, IN PVOID PortOffset)
VOID EXPORT NdisMFreeMapRegisters(IN NDIS_HANDLE MiniportAdapterHandle)
NDIS_STATUS EXPORT NdisMRegisterIoPortRange(OUT PVOID *PortOffset, IN NDIS_HANDLE MiniportAdapterHandle, IN UINT InitialPort, IN UINT NumberOfPorts)
NDIS_STATUS EXPORT NdisMRegisterInterrupt(OUT PNDIS_MINIPORT_INTERRUPT Interrupt, IN NDIS_HANDLE MiniportAdapterHandle, IN UINT InterruptVector, IN UINT InterruptLevel, IN BOOLEAN RequestIsr, IN BOOLEAN SharedInterrupt, IN NDIS_INTERRUPT_MODE InterruptMode)
VOID EXPORT NdisFreeMemory(IN PVOID VirtualAddress, IN UINT Length, IN UINT MemoryFlags)
NDIS_STATUS EXPORT NdisAllocateMemoryWithTag(OUT PVOID *VirtualAddress, IN UINT Length, IN ULONG Tag)
VOID EXPORT NdisMAllocateSharedMemory(IN NDIS_HANDLE MiniportAdapterHandle, IN ULONG Length, IN BOOLEAN Cached, OUT PVOID *VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress)
VOID EXPORT NdisMFreeSharedMemory(IN NDIS_HANDLE MiniportAdapterHandle, IN ULONG Length, IN BOOLEAN Cached, IN PVOID VirtualAddress, IN NDIS_PHYSICAL_ADDRESS PhysicalAddress)
VOID EXPORT NdisMCancelTimer(IN PNDIS_MINIPORT_TIMER Timer, OUT PBOOLEAN TimerCancelled)
VOID EXPORT NdisMSetPeriodicTimer(IN PNDIS_MINIPORT_TIMER Timer, IN UINT MillisecondsPeriod)
VOID EXPORT NdisMInitializeTimer(IN OUT PNDIS_MINIPORT_TIMER Timer, IN NDIS_HANDLE MiniportAdapterHandle, IN PNDIS_TIMER_FUNCTION TimerFunction, IN PVOID FunctionContext)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define NdisRawReadPortUshort(Port, Data)
#define NdisGetNextBuffer(CurrentBuffer, NextBuffer)
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
#define NDIS_STATUS_MEDIA_CONNECT
#define NdisMEthIndicateReceiveComplete(MiniportAdapterHandle)
#define NdisMIndicateStatusComplete(MiniportAdapterHandle)
_In_ PVOID _In_ PVOID SystemSpecific2
#define NdisZeroMemory(Destination, Length)
#define NdisMEthIndicateReceive(MiniportAdapterHandle, MiniportReceiveContext, HeaderBuffer, HeaderBufferSize, LookaheadBuffer, LookaheadBufferSize, PacketSize)
static __inline VOID NdisQueryPacket(IN PNDIS_PACKET Packet, OUT PUINT PhysicalBufferCount OPTIONAL, OUT PUINT BufferCount OPTIONAL, OUT PNDIS_BUFFER *FirstBuffer OPTIONAL, OUT PUINT TotalPacketLength OPTIONAL)
#define NDIS_ATTRIBUTE_BUS_MASTER
#define NdisMSendResourcesAvailable(MiniportAdapterHandle)
#define NdisDprReleaseSpinLock(_SpinLock)
#define NDIS_STATUS_MEDIA_DISCONNECT
#define NdisInterruptLevelSensitive
#define NdisRawReadPortUchar(Port, Data)
#define NdisAllocateSpinLock(_SpinLock)
_In_ PVOID FunctionContext
#define NDIS_STATUS_FAILURE
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT SelectedMediumIndex
#define NdisStallExecution
#define NDIS_STATUS_SUCCESS
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT _In_ UINT MediumArraySize
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _In_ NDIS_HANDLE WrapperConfigurationContext
#define NdisDprAcquireSpinLock(_SpinLock)
_In_ NDIS_HANDLE MiniportAdapterHandle
#define NdisQueryBuffer(_Buffer, _VirtualAddress, _Length)
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE ConfigurationHandle
#define NDIS_STATUS_UNSUPPORTED_MEDIA
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS OpenErrorStatus
#define NDIS_STATUS_ADAPTER_NOT_FOUND
#define NdisMInitializeWrapper(NdisWrapperHandle, SystemSpecific1, SystemSpecific2, SystemSpecific3)
#define NdisFreeSpinLock(_SpinLock)
#define NdisRawWritePortUshort(Port, Data)
#define NdisMIndicateStatus(MiniportAdapterHandle, GeneralStatus, StatusBuffer, StatusBufferSize)
#define NDIS_STATUS_RESOURCES
_Out_ _At_ TimerCancelled PBOOLEAN TimerCancelled
_In_ PVOID _In_ PVOID _In_ PVOID SystemSpecific3
VOID EXPORT NdisMDeregisterAdapterShutdownHandler(IN NDIS_HANDLE MiniportHandle)
VOID EXPORT NdisMSetAttributesEx(IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_HANDLE MiniportAdapterContext, IN UINT CheckForHangTimeInSeconds OPTIONAL, IN ULONG AttributeFlags, IN NDIS_INTERFACE_TYPE AdapterType)
VOID EXPORT NdisMRegisterAdapterShutdownHandler(IN NDIS_HANDLE MiniportHandle, IN PVOID ShutdownContext, IN ADAPTER_SHUTDOWN_HANDLER ShutdownHandler)
BOOLEAN EXPORT NdisMSynchronizeWithInterrupt(IN PNDIS_MINIPORT_INTERRUPT Interrupt, IN PVOID SynchronizeFunction, IN PVOID SynchronizeContext)
NDIS_STATUS EXPORT NdisMRegisterMiniport(IN NDIS_HANDLE NdisWrapperHandle, IN PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics, IN UINT CharacteristicsLength)
VOID EXPORT NdisTerminateWrapper(IN NDIS_HANDLE NdisWrapperHandle, IN PVOID SystemSpecific)
@ NdisMediaStateConnected
@ NdisMediaStateDisconnected
enum _NDIS_MEDIA_STATE NDIS_MEDIA_STATE
enum _NDIS_MEDIUM * PNDIS_MEDIUM
_In_ ULONG _In_ ULONG _In_ ULONG Length
NDIS_MEDIA_STATE NTAPI MiGetMediaState(PADAPTER Adapter)
static VOID MiPrepareInitializationBlock(PADAPTER Adapter)
VOID NTAPI MiniportShutdown(PVOID Context)
static ULONG NTAPI MiEthernetCrc(UCHAR *Address)
static BOOLEAN NTAPI MiSyncMediaDetection(IN PVOID SynchronizeContext)
static BOOLEAN NTAPI MiSyncStartTransmit(IN PVOID SynchronizeContext)
static NDIS_STATUS NTAPI MiniportInitialize(OUT PNDIS_STATUS OpenErrorStatus, OUT PUINT SelectedMediumIndex, IN PNDIS_MEDIUM MediumArray, IN UINT MediumArraySize, IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_HANDLE WrapperConfigurationContext)
static NDIS_STATUS MiAllocateSharedMemory(PADAPTER Adapter)
static VOID NTAPI MiniportMediaDetectionTimer(IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3)
static VOID NTAPI MiniportISR(OUT PBOOLEAN InterruptRecognized, OUT PBOOLEAN QueueMiniportHandleInterrupt, IN NDIS_HANDLE MiniportAdapterContext)
static VOID NTAPI MiniportHalt(IN NDIS_HANDLE MiniportAdapterContext)
static NDIS_STATUS MiQueryCard(IN PADAPTER Adapter)
static BOOLEAN NTAPI MiSyncStop(IN PVOID SynchronizeContext)
NDIS_STATUS NTAPI MiSetMulticast(PADAPTER Adapter, UCHAR *Addresses, UINT AddressCount)
static VOID MiInitChip(PADAPTER Adapter)
BOOLEAN NTAPI MiGetMediaDuplex(PADAPTER Adapter)
static NDIS_STATUS NTAPI MiniportReset(OUT PBOOLEAN AddressingReset, IN NDIS_HANDLE MiniportAdapterContext)
static NDIS_STATUS NTAPI MiniportSend(IN NDIS_HANDLE MiniportAdapterContext, IN PNDIS_PACKET Packet, IN UINT Flags)
static VOID NTAPI MiniportHandleInterrupt(IN NDIS_HANDLE MiniportAdapterContext)
UINT NTAPI MiGetMediaSpeed(PADAPTER Adapter)
static VOID MiFreeSharedMemory(PADAPTER Adapter)
#define MEDIA_DETECTION_INTERVAL
#define NUMBER_OF_BUFFERS
struct _ADAPTER * PADAPTER
#define LOG_NUMBER_OF_BUFFERS
struct _TRANSMIT_DESCRIPTOR TRANSMIT_DESCRIPTOR
struct _RECEIVE_DESCRIPTOR RECEIVE_DESCRIPTOR
struct _INITIALIZATION_BLOCK INITIALIZATION_BLOCK
ULONG XmtBufferUnderflows
ULONG XmtMoreThanOneRetry
ULONG XmtExcessiveDeferrals
PHYSICAL_ADDRESS ReceiveDescriptorRingPhys
PHYSICAL_ADDRESS TransmitDescriptorRingPhys
ULONG InitializationBlockLength
ULONG CurrentReceiveDescriptorIndex
NDIS_MINIPORT_TIMER MediaDetectionTimer
ULONG TransmitBufferLength
ULONG ReceiveDescriptorRingLength
ULONG ReceiveBufferLength
PRECEIVE_DESCRIPTOR ReceiveDescriptorRingVirt
NDIS_MINIPORT_INTERRUPT InterruptObject
PHYSICAL_ADDRESS InitializationBlockPhys
NDIS_MEDIA_STATE MediaState
PHYSICAL_ADDRESS ReceiveBufferPtrPhys
ULONG CurrentTransmitStartIndex
NDIS_HANDLE MiniportAdapterHandle
PHYSICAL_ADDRESS TransmitBufferPtrPhys
PINITIALIZATION_BLOCK InitializationBlockVirt
ULONG TransmitDescriptorRingLength
PTRANSMIT_DESCRIPTOR TransmitDescriptorRingVirt
ULONG CurrentTransmitEndIndex
PCHAR ReceiveBufferPtrVirt
PCHAR TransmitBufferPtrVirt
static LARGE_INTEGER Counter
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
_Must_inspect_result_ _In_ ULONG Flags
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
_In_ PKSYNCHRONIZE_ROUTINE _In_opt_ __drv_aliasesMem PVOID SynchronizeContext