ReactOS 0.4.15-dev-7934-g1dc8d80
dc21x4.c File Reference
#include "dc21x4.h"
#include <debug.h>
Include dependency graph for dc21x4.c:

Go to the source code of this file.

Functions

ULONG DcEthernetCrc (_In_reads_bytes_(Size) const VOID *Buffer, _In_ ULONG Size)
 
static VOID DcFlushTransmitQueue (_In_ PDC21X4_ADAPTER Adapter)
 
static VOID DcStopReceivePath (_In_ PDC21X4_ADAPTER Adapter)
 
DECLSPEC_NOINLINE VOID DcStopAdapter (_In_ PDC21X4_ADAPTER Adapter, _In_ BOOLEAN WaitForPackets)
 
VOID DcStartAdapter (_In_ PDC21X4_ADAPTER Adapter)
 
VOID NTAPI DcResetWorker (_In_ PNDIS_WORK_ITEM WorkItem, _In_opt_ PVOID Context)
 
VOID NTAPI DcTransmitTimeoutRecoveryWorker (_In_ PNDIS_WORK_ITEM WorkItem, _In_opt_ PVOID Context)
 
static BOOLEAN NTAPI DcCheckForHang (_In_ NDIS_HANDLE MiniportAdapterContext)
 
static NDIS_STATUS NTAPI DcReset (_Out_ PBOOLEAN AddressingReset, _In_ NDIS_HANDLE MiniportAdapterContext)
 
static VOID NTAPI DcHalt (_In_ NDIS_HANDLE MiniportAdapterContext)
 
static VOID NTAPI DcShutdown (_In_ NDIS_HANDLE MiniportAdapterContext)
 
NTSTATUS NTAPI DriverEntry (_In_ PDRIVER_OBJECT DriverObject, _In_ PUNICODE_STRING RegistryPath)
 

Function Documentation

◆ DcCheckForHang()

static BOOLEAN NTAPI DcCheckForHang ( _In_ NDIS_HANDLE  MiniportAdapterContext)
static

Definition at line 272 of file dc21x4.c.

274{
275 PDC21X4_ADAPTER Adapter = (PDC21X4_ADAPTER)MiniportAdapterContext;
276 ULONG TcbCompleted;
277 BOOLEAN TxHang = FALSE;
278
279 if (!(Adapter->Flags & DC_ACTIVE))
280 return FALSE;
281
283
284 if (Adapter->TcbSlots != (DC_TRANSMIT_BLOCKS - DC_TCB_RESERVE))
285 {
286 TcbCompleted = Adapter->TcbCompleted;
287 TxHang = (TcbCompleted == Adapter->LastTcbCompleted);
288 Adapter->LastTcbCompleted = TcbCompleted;
289 }
290
292
293 if (TxHang)
294 {
295 WARN("Transmit timeout, CSR12 %08lx, CSR5 %08lx\n",
296 DC_READ(Adapter, DcCsr12_SiaStatus),
297 DC_READ(Adapter, DcCsr5_Status));
298
300 }
301
302 return FALSE;
303}
unsigned char BOOLEAN
#define WARN(fmt,...)
Definition: debug.h:112
#define DC_TCB_RESERVE
Definition: dc21x4.h:57
struct _DC21X4_ADAPTER * PDC21X4_ADAPTER
Definition: dc21x4.h:61
#define DC_ACTIVE
Definition: dc21x4.h:120
FORCEINLINE ULONG DC_READ(_In_ PDC21X4_ADAPTER Adapter, _In_ DC_CSR Register)
Definition: dc21x4.h:262
#define DC_TRANSMIT_BLOCKS
Definition: dc21x4.h:24
@ DcCsr5_Status
Definition: dc21x4hw.h:179
@ DcCsr12_SiaStatus
Definition: dc21x4hw.h:188
#define FALSE
Definition: types.h:117
NDIS_STATUS EXPORT NdisScheduleWorkItem(IN PNDIS_WORK_ITEM pWorkItem)
Definition: misc.c:467
#define NdisDprReleaseSpinLock(_SpinLock)
Definition: ndis.h:4133
#define NdisDprAcquireSpinLock(_SpinLock)
Definition: ndis.h:4124
ULONG TcbSlots
Definition: dc21x4.h:137
ULONG TcbCompleted
Definition: dc21x4.h:139
ULONG LastTcbCompleted
Definition: dc21x4.h:140
NDIS_WORK_ITEM TxRecoveryWorkItem
Definition: dc21x4.h:238
DECLSPEC_CACHEALIGN NDIS_SPIN_LOCK SendLock
Definition: dc21x4.h:129
ULONG Flags
Definition: dc21x4.h:119
uint32_t ULONG
Definition: typedefs.h:59

Referenced by DriverEntry().

◆ DcEthernetCrc()

ULONG DcEthernetCrc ( _In_reads_bytes_(Size) const VOID Buffer,
_In_ ULONG  Size 
)

Definition at line 17 of file dc21x4.c.

20{
21 ULONG i, j, Crc;
22 const UCHAR* Data = Buffer;
23
24 Crc = 0xFFFFFFFF;
25 for (i = 0; i < Size; ++i)
26 {
27 Crc ^= Data[i];
28 for (j = 8; j > 0; j--)
29 {
30 /* CRC-32 polynomial little-endian */
31 Crc = (Crc >> 1) ^ (-(LONG)(Crc & 1) & 0xEDB88320);
32 }
33 }
34
35 return Crc;
36}
Definition: bufpool.h:45
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
Definition: glfuncs.h:248
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 GLint GLint j
Definition: glfuncs.h:250
long LONG
Definition: pedump.c:60
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by DcSetupFrameImperfectFiltering().

◆ DcFlushTransmitQueue()

static VOID DcFlushTransmitQueue ( _In_ PDC21X4_ADAPTER  Adapter)
static

Definition at line 40 of file dc21x4.c.

42{
43 LIST_ENTRY DoneList;
46 PDC_TCB Tcb;
47
48 InitializeListHead(&DoneList);
49
50 NdisAcquireSpinLock(&Adapter->SendLock);
51
52 /* Remove pending transmissions from the transmit ring */
53 for (Tcb = Adapter->LastTcb;
54 Tcb != Adapter->CurrentTcb;
55 Tcb = DC_NEXT_TCB(Adapter, Tcb))
56 {
57 Packet = Tcb->Packet;
58
59 if (!Packet)
60 continue;
61
63
64 DC_RELEASE_TCB(Adapter, Tcb);
65 }
66 Adapter->CurrentTcb = Tcb;
67
68 /* Remove pending transmissions from the internal queue */
69 while (!IsListEmpty(&Adapter->SendQueueList))
70 {
71 Entry = RemoveHeadList(&Adapter->SendQueueList);
72
73 InsertTailList(&DoneList, Entry);
74 }
75
76 NdisReleaseSpinLock(&Adapter->SendLock);
77
78 while (!IsListEmpty(&DoneList))
79 {
80 Entry = RemoveHeadList(&DoneList);
81
82 NdisMSendComplete(Adapter->AdapterHandle,
85 }
86}
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define NdisReleaseSpinLock(_SpinLock)
Definition: ndis.h:4115
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1549
#define NDIS_STATUS_FAILURE
Definition: ndis.h:465
#define NdisMSendComplete(MiniportAdapterHandle, Packet, Status)
Definition: ndis.h:5689
#define NdisAcquireSpinLock(_SpinLock)
Definition: ndis.h:4106
#define DC_PACKET_FROM_LIST_ENTRY(ListEntry)
Definition: sendrcv.h:13
FORCEINLINE PDC_TCB DC_NEXT_TCB(_In_ PDC21X4_ADAPTER Adapter, _In_ PDC_TCB Tcb)
Definition: sendrcv.h:74
FORCEINLINE VOID DC_RELEASE_TCB(_In_ PDC21X4_ADAPTER Adapter, _In_ PDC_TCB Tcb)
Definition: sendrcv.h:58
#define DC_LIST_ENTRY_FROM_PACKET(Packet)
Definition: sendrcv.h:10
base of all file and directory entries
Definition: entries.h:83
PNDIS_PACKET Packet
Definition: sendrcv.h:34
Definition: typedefs.h:120

Referenced by DcStopAdapter().

◆ DcHalt()

static VOID NTAPI DcHalt ( _In_ NDIS_HANDLE  MiniportAdapterContext)
static

Definition at line 330 of file dc21x4.c.

332{
333 PDC21X4_ADAPTER Adapter = (PDC21X4_ADAPTER)MiniportAdapterContext;
334
335 PAGED_CODE();
336
337 INFO("Called\n");
338
339 DcStopAdapter(Adapter, TRUE);
340
341 DcDisableHw(Adapter);
342
343 DcFreeAdapter(Adapter);
344}
#define PAGED_CODE()
DECLSPEC_NOINLINE VOID DcStopAdapter(_In_ PDC21X4_ADAPTER Adapter, _In_ BOOLEAN WaitForPackets)
Definition: dc21x4.c:123
VOID DcDisableHw(_In_ PDC21X4_ADAPTER Adapter)
Definition: hardware.c:17
VOID DcFreeAdapter(_In_ __drv_freesMem(Mem) PDC21X4_ADAPTER Adapter)
Definition: init.c:1022
#define TRUE
Definition: types.h:120
#define INFO
Definition: debug.h:89

Referenced by DriverEntry().

◆ DcReset()

static NDIS_STATUS NTAPI DcReset ( _Out_ PBOOLEAN  AddressingReset,
_In_ NDIS_HANDLE  MiniportAdapterContext 
)
static

Definition at line 308 of file dc21x4.c.

311{
312 PDC21X4_ADAPTER Adapter = (PDC21X4_ADAPTER)MiniportAdapterContext;
313
314 WARN("Called\n");
315
316 if (_InterlockedCompareExchange(&Adapter->ResetLock, 1, 0))
317 {
319 }
320
322
323 return NDIS_STATUS_PENDING;
324}
long __cdecl _InterlockedCompareExchange(_Interlocked_operand_ long volatile *_Destination, long _Exchange, long _Comparand)
#define NDIS_STATUS_PENDING
Definition: ndis.h:347
#define NDIS_STATUS_RESET_IN_PROGRESS
Definition: ndis.h:477
_Interlocked_ volatile LONG ResetLock
Definition: dc21x4.h:239
NDIS_WORK_ITEM ResetWorkItem
Definition: dc21x4.h:237

Referenced by DriverEntry().

◆ DcResetWorker()

VOID NTAPI DcResetWorker ( _In_ PNDIS_WORK_ITEM  WorkItem,
_In_opt_ PVOID  Context 
)

Definition at line 190 of file dc21x4.c.

193{
194 PDC21X4_ADAPTER Adapter = Context;
196 ULONG InterruptStatus;
197 LONG ResetReason;
198
200
201 PAGED_CODE();
202
204
205 /* Check if the device is present */
206 InterruptStatus = DC_READ(Adapter, DcCsr5_Status);
207 if (InterruptStatus == 0xFFFFFFFF)
208 {
209 ERR("Hardware is gone...\n");
210
211 /* Remove this adapter */
213
215 goto Done;
216 }
217
218 DcStopAdapter(Adapter, FALSE);
219
220 if (Adapter->LinkUp)
221 {
222 Adapter->LinkUp = FALSE;
223
226 NULL,
227 0);
229 }
230
231 DcSetupAdapter(Adapter);
232
233 DcStartAdapter(Adapter);
234
235Done:
236 ResetReason = _InterlockedExchange(&Adapter->ResetLock, 0);
237
238 /* Complete the pending reset request */
239 if (ResetReason == 1)
240 {
242 }
243}
NDIS_STATUS EXPORT NdisMRemoveMiniport(IN NDIS_HANDLE MiniportAdapterHandle)
Definition: 50stubs.c:376
#define ERR(fmt,...)
Definition: debug.h:110
VOID DcStartAdapter(_In_ PDC21X4_ADAPTER Adapter)
Definition: dc21x4.c:168
NDIS_STATUS DcSetupAdapter(_In_ PDC21X4_ADAPTER Adapter)
Definition: hardware.c:462
#define NULL
Definition: types.h:112
Status
Definition: gdiplustypes.h:25
long __cdecl _InterlockedExchange(_Interlocked_operand_ long volatile *_Target, long _Value)
#define NdisMIndicateStatusComplete(MiniportAdapterHandle)
Definition: ndis.h:5580
#define NdisMResetComplete(MiniportAdapterHandle, Status, AddressingReset)
Definition: ndis.h:5674
#define NDIS_STATUS_MEDIA_DISCONNECT
Definition: ndis.h:362
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define NDIS_STATUS_HARD_ERRORS
Definition: ndis.h:463
#define NdisMIndicateStatus(MiniportAdapterHandle, GeneralStatus, StatusBuffer, StatusBufferSize)
Definition: ndis.h:5570
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
int NDIS_STATUS
Definition: ntddndis.h:475
BOOLEAN LinkUp
Definition: dc21x4.h:176
NDIS_HANDLE AdapterHandle
Definition: dc21x4.h:158
_Must_inspect_result_ _In_ PWDF_WORKITEM_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWORKITEM * WorkItem
Definition: wdfworkitem.h:115

Referenced by DcInitialize().

◆ DcShutdown()

static VOID NTAPI DcShutdown ( _In_ NDIS_HANDLE  MiniportAdapterContext)
static

Definition at line 349 of file dc21x4.c.

351{
352 PDC21X4_ADAPTER Adapter = (PDC21X4_ADAPTER)MiniportAdapterContext;
353
354 INFO("Called\n");
355
356 DcDisableHw(Adapter);
357}

Referenced by DriverEntry().

◆ DcStartAdapter()

VOID DcStartAdapter ( _In_ PDC21X4_ADAPTER  Adapter)

Definition at line 168 of file dc21x4.c.

170{
171 PAGED_CODE();
172
173 /* Enable interrupts */
174 _InterlockedExchange((PLONG)&Adapter->CurrentInterruptMask, Adapter->InterruptMask);
175 DC_WRITE(Adapter, DcCsr7_IrqMask, Adapter->InterruptMask);
176
177 Adapter->Flags |= DC_ACTIVE;
178
179 /* Start the RX process */
180 Adapter->OpMode |= DC_OPMODE_RX_ENABLE;
181 DC_WRITE(Adapter, DcCsr6_OpMode, Adapter->OpMode);
182
183 /* Start the media monitor, wait the selected media to become ready */
184 NdisMSetTimer(&Adapter->MediaMonitorTimer, 2400);
185}
#define DC_WRITE(Adapter, Register, Value)
Definition: dc21x4.h:272
@ DcCsr6_OpMode
Definition: dc21x4hw.h:180
@ DcCsr7_IrqMask
Definition: dc21x4hw.h:181
#define DC_OPMODE_RX_ENABLE
Definition: dc21x4hw.h:319
VOID EXPORT NdisMSetTimer(IN PNDIS_MINIPORT_TIMER Timer, IN UINT MillisecondsToDelay)
Definition: time.c:272
int32_t * PLONG
Definition: typedefs.h:58

Referenced by DcInitialize(), DcPowerUp(), and DcResetWorker().

◆ DcStopAdapter()

DECLSPEC_NOINLINE VOID DcStopAdapter ( _In_ PDC21X4_ADAPTER  Adapter,
_In_ BOOLEAN  WaitForPackets 
)

Definition at line 123 of file dc21x4.c.

126{
128
129 /* Attempt to disable interrupts to complete more quickly */
130 DC_WRITE(Adapter, DcCsr7_IrqMask, 0);
131
132 /* Prevent DPCs from executing and stop accepting incoming packets */
133 NdisAcquireSpinLock(&Adapter->SendLock);
134 Adapter->Flags &= ~DC_ACTIVE;
135 NdisReleaseSpinLock(&Adapter->SendLock);
136
137 NdisMCancelTimer(&Adapter->MediaMonitorTimer, &TimerCancelled);
138
139 /* Wait for any DPCs to complete */
141
142 /* Disable interrupts */
143 DC_WRITE(Adapter, DcCsr7_IrqMask, 0);
144
145 /* Wait for completion of TX/RX and stop the DMA engine inside the NIC */
146 DcStopTxRxProcess(Adapter);
147 Adapter->OpMode &= ~(DC_OPMODE_RX_ENABLE | DC_OPMODE_TX_ENABLE);
148
149 DcFlushTransmitQueue(Adapter);
150
151 /* Wait for the packets to be returned to the driver */
152 if (WaitForPackets)
153 {
154 DcStopReceivePath(Adapter);
155 }
156
157 /* Make sure there is no pending OID request */
158 if (Adapter->OidPending)
159 {
160 NdisMSetInformationComplete(Adapter->AdapterHandle, NDIS_STATUS_SUCCESS);
161
162 Adapter->OidPending = FALSE;
163 }
164}
static VOID DcFlushTransmitQueue(_In_ PDC21X4_ADAPTER Adapter)
Definition: dc21x4.c:40
static VOID DcStopReceivePath(_In_ PDC21X4_ADAPTER Adapter)
Definition: dc21x4.c:90
VOID DcStopTxRxProcess(_In_ PDC21X4_ADAPTER Adapter)
Definition: hardware.c:38
#define DC_OPMODE_TX_ENABLE
Definition: dc21x4hw.h:330
VOID NTAPI KeFlushQueuedDpcs(VOID)
Definition: dpc.c:919
VOID EXPORT NdisMCancelTimer(IN PNDIS_MINIPORT_TIMER Timer, OUT PBOOLEAN TimerCancelled)
Definition: time.c:131
#define NdisMSetInformationComplete(MiniportAdapterHandle, Status)
Definition: ndis.h:5762
_Out_ _At_ TimerCancelled PBOOLEAN TimerCancelled
Definition: ndis.h:2820

Referenced by DcHalt(), DcPowerDown(), and DcResetWorker().

◆ DcStopReceivePath()

static VOID DcStopReceivePath ( _In_ PDC21X4_ADAPTER  Adapter)
static

Definition at line 90 of file dc21x4.c.

92{
93 BOOLEAN RxStopped;
94
96
97#if DBG
98 NdisAcquireSpinLock(&Adapter->ReceiveLock);
99 if (Adapter->RcbFree != Adapter->RcbCount)
100 {
101 INFO("RX packets: %u/%u\n", Adapter->RcbFree, Adapter->RcbCount);
102 }
103 NdisReleaseSpinLock(&Adapter->ReceiveLock);
104#endif
105
106 while (TRUE)
107 {
108 NdisAcquireSpinLock(&Adapter->ReceiveLock);
109
110 RxStopped = (Adapter->RcbFree == Adapter->RcbCount);
111
112 NdisReleaseSpinLock(&Adapter->ReceiveLock);
113
114 if (RxStopped)
115 break;
116
117 NdisMSleep(10);
118 }
119}
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define ASSERT(a)
Definition: mode.c:44
VOID EXPORT NdisMSleep(IN ULONG MicrosecondsToSleep)
Definition: miniport.c:2928

Referenced by DcStopAdapter().

◆ DcTransmitTimeoutRecoveryWorker()

VOID NTAPI DcTransmitTimeoutRecoveryWorker ( _In_ PNDIS_WORK_ITEM  WorkItem,
_In_opt_ PVOID  Context 
)

Definition at line 247 of file dc21x4.c.

250{
251 PDC21X4_ADAPTER Adapter = Context;
252
254
255 NdisAcquireSpinLock(&Adapter->ModeLock);
256
257 DcStopTxRxProcess(Adapter);
258 DC_WRITE(Adapter, DcCsr6_OpMode, Adapter->OpMode);
259
261
263
265
266 NdisReleaseSpinLock(&Adapter->ModeLock);
267}
@ DcCsr1_TxPoll
Definition: dc21x4hw.h:173
#define DC_TX_POLL_DOORBELL
Definition: dc21x4hw.h:244
DECLSPEC_CACHEALIGN NDIS_SPIN_LOCK ModeLock
Definition: dc21x4.h:161
ULONG OpMode
Definition: dc21x4.h:173

Referenced by DcInitialize().

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( _In_ PDRIVER_OBJECT  DriverObject,
_In_ PUNICODE_STRING  RegistryPath 
)

Definition at line 362 of file dc21x4.c.

365{
366 NDIS_HANDLE WrapperHandle;
368 NDIS_MINIPORT_CHARACTERISTICS Characteristics = { 0 };
369
370 INFO("Called\n");
371
373 if (!WrapperHandle)
374 return NDIS_STATUS_FAILURE;
375
376 Characteristics.MajorNdisVersion = NDIS_MINIPORT_MAJOR_VERSION;
377 Characteristics.MinorNdisVersion = NDIS_MINIPORT_MINOR_VERSION;
378 Characteristics.CheckForHangHandler = DcCheckForHang;
379 Characteristics.HaltHandler = DcHalt;
380 Characteristics.HandleInterruptHandler = DcHandleInterrupt;
381 Characteristics.InitializeHandler = DcInitialize;
382 Characteristics.ISRHandler = DcIsr;
383 Characteristics.QueryInformationHandler = DcQueryInformation;
384 Characteristics.ResetHandler = DcReset;
385 Characteristics.SetInformationHandler = DcSetInformation;
386 Characteristics.ReturnPacketHandler = DcReturnPacket;
387 Characteristics.SendPacketsHandler = DcSendPackets;
388 Characteristics.CancelSendPacketsHandler = DcCancelSendPackets;
389 Characteristics.AdapterShutdownHandler = DcShutdown;
390
391 Status = NdisMRegisterMiniport(WrapperHandle, &Characteristics, sizeof(Characteristics));
393 {
394 NdisTerminateWrapper(WrapperHandle, NULL);
395 return Status;
396 }
397
399
400 return NDIS_STATUS_SUCCESS;
401}
static VOID NTAPI DcShutdown(_In_ NDIS_HANDLE MiniportAdapterContext)
Definition: dc21x4.c:349
static VOID NTAPI DcHalt(_In_ NDIS_HANDLE MiniportAdapterContext)
Definition: dc21x4.c:330
static NDIS_STATUS NTAPI DcReset(_Out_ PBOOLEAN AddressingReset, _In_ NDIS_HANDLE MiniportAdapterContext)
Definition: dc21x4.c:308
static BOOLEAN NTAPI DcCheckForHang(_In_ NDIS_HANDLE MiniportAdapterContext)
Definition: dc21x4.c:272
VOID NTAPI DcReturnPacket(_In_ NDIS_HANDLE MiniportAdapterContext, _In_ PNDIS_PACKET Packet)
Definition: interrupt.c:244
LIST_ENTRY SRompAdapterList
Definition: eeprom.c:30
VOID NTAPI DcCancelSendPackets(_In_ NDIS_HANDLE MiniportAdapterContext, _In_ PVOID CancelId)
Definition: send.c:271
VOID NTAPI DcIsr(_Out_ PBOOLEAN InterruptRecognized, _Out_ PBOOLEAN QueueMiniportHandleInterrupt, _In_ NDIS_HANDLE MiniportAdapterContext)
Definition: interrupt.c:594
VOID NTAPI DcHandleInterrupt(_In_ NDIS_HANDLE MiniportAdapterContext)
Definition: interrupt.c:514
NDIS_STATUS NTAPI DcInitialize(_Out_ PNDIS_STATUS OpenErrorStatus, _Out_ PUINT SelectedMediumIndex, _In_ PNDIS_MEDIUM MediumArray, _In_ UINT MediumArraySize, _In_ NDIS_HANDLE MiniportAdapterHandle, _In_ NDIS_HANDLE WrapperConfigurationContext)
Definition: init.c:1125
NDIS_STATUS NTAPI DcSetInformation(_In_ NDIS_HANDLE MiniportAdapterContext, _In_ NDIS_OID Oid, _In_ PVOID InformationBuffer, _In_ ULONG InformationBufferLength, _Out_ PULONG BytesRead, _Out_ PULONG BytesNeeded)
Definition: requests.c:483
NDIS_STATUS NTAPI DcQueryInformation(_In_ NDIS_HANDLE MiniportAdapterContext, _In_ NDIS_OID Oid, _In_ PVOID InformationBuffer, _In_ ULONG InformationBufferLength, _Out_ PULONG BytesWritten, _Out_ PULONG BytesNeeded)
Definition: requests.c:208
VOID NTAPI DcSendPackets(_In_ NDIS_HANDLE MiniportAdapterContext, _In_ PPNDIS_PACKET PacketArray, _In_ UINT NumberOfPackets)
Definition: send.c:228
#define NdisMInitializeWrapper(NdisWrapperHandle, SystemSpecific1, SystemSpecific2, SystemSpecific3)
Definition: ndis.h:5592
NDIS_STATUS EXPORT NdisMRegisterMiniport(IN NDIS_HANDLE NdisWrapperHandle, IN PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics, IN UINT CharacteristicsLength)
Definition: miniport.c:2637
VOID EXPORT NdisTerminateWrapper(IN NDIS_HANDLE NdisWrapperHandle, IN PVOID SystemSpecific)
Definition: miniport.c:3012
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213