ReactOS  0.4.15-dev-506-ga3ec01c
ndis.c
Go to the documentation of this file.
1 /*
2  * ReactOS Realtek 8139 Driver
3  *
4  * Copyright (C) 2013 Cameron Gutman
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  *
20  */
21 
22 #include "nic.h"
23 
24 #define NDEBUG
25 #include <debug.h>
26 
28 
30 NTAPI
32  OUT PBOOLEAN AddressingReset,
33  IN NDIS_HANDLE MiniportAdapterContext
34  )
35 {
36  *AddressingReset = FALSE;
37  return NDIS_STATUS_FAILURE;
38 }
39 
41 NTAPI
43  IN NDIS_HANDLE MiniportAdapterContext,
45  IN UINT Flags
46  )
47 {
48  PRTL_ADAPTER adapter = (PRTL_ADAPTER)MiniportAdapterContext;
52  ULONG transmitLength;
53  ULONG transmitBuffer;
54  PNDIS_BUFFER firstBuffer;
55  PVOID firstBufferVa;
56  UINT firstBufferLength, totalBufferLength;
57  PUCHAR runtBuffer;
58 
59  ASSERT(sgList != NULL);
60 
61  ASSERT(sgList->NumberOfElements == 1);
62  ASSERT(sgList->Elements[0].Address.HighPart == 0);
63  ASSERT((sgList->Elements[0].Address.LowPart & 3) == 0);
64  ASSERT(sgList->Elements[0].Length <= MAXIMUM_FRAME_SIZE);
65 
66  NDIS_DbgPrint(MAX_TRACE, ("Sending %d byte packet\n", sgList->Elements[0].Length));
67 
68  NdisAcquireSpinLock(&adapter->Lock);
69 
70  if (adapter->TxFull)
71  {
72  NDIS_DbgPrint(MIN_TRACE, ("All TX descriptors are full\n"));
73  NdisReleaseSpinLock(&adapter->Lock);
74  return NDIS_STATUS_RESOURCES;
75  }
76 
77  NDIS_DbgPrint(MAX_TRACE, ("Sending packet on TX desc %d\n", adapter->CurrentTxDesc));
78 
79  //
80  // If this is a runt, we need to pad it manually for the RTL8139
81  //
82  if (sgList->Elements[0].Length < MINIMUM_FRAME_SIZE)
83  {
84  transmitLength = MINIMUM_FRAME_SIZE;
85  transmitBuffer = adapter->RuntTxBuffersPa.LowPart +
86  (MINIMUM_FRAME_SIZE * adapter->CurrentTxDesc);
87 
89  &firstBuffer,
90  &firstBufferVa,
91  &firstBufferLength,
92  &totalBufferLength,
94  if (firstBufferVa == NULL)
95  {
96  NDIS_DbgPrint(MIN_TRACE, ("Unable to get buffer from packet\n"));
97  NdisReleaseSpinLock(&adapter->Lock);
98  return NDIS_STATUS_RESOURCES;
99  }
100 
101  ASSERT(firstBufferLength == totalBufferLength);
102 
103  runtBuffer = adapter->RuntTxBuffers + (MINIMUM_FRAME_SIZE * adapter->CurrentTxDesc);
104  RtlCopyMemory(runtBuffer, firstBufferVa, firstBufferLength);
105  RtlFillMemory(runtBuffer + firstBufferLength, MINIMUM_FRAME_SIZE - firstBufferLength, 0x00);
106  }
107  else
108  {
109  transmitLength = sgList->Elements[0].Length;
110  transmitBuffer = sgList->Elements[0].Address.LowPart;
111  }
112 
113  status = NICTransmitPacket(adapter, adapter->CurrentTxDesc, transmitBuffer, transmitLength);
115  {
116  NDIS_DbgPrint(MIN_TRACE, ("Transmit packet failed\n"));
117  NdisReleaseSpinLock(&adapter->Lock);
118  return status;
119  }
120 
121  adapter->CurrentTxDesc++;
122  adapter->CurrentTxDesc %= TX_DESC_COUNT;
123 
124  if (adapter->CurrentTxDesc == adapter->DirtyTxDesc)
125  {
126  NDIS_DbgPrint(MID_TRACE, ("All TX descriptors are full now\n"));
127  adapter->TxFull = TRUE;
128  }
129 
130  NdisReleaseSpinLock(&adapter->Lock);
131 
132  return NDIS_STATUS_SUCCESS;
133 }
134 
135 VOID
136 NTAPI
138  IN NDIS_HANDLE MiniportAdapterContext
139  )
140 {
141  PRTL_ADAPTER adapter = (PRTL_ADAPTER)MiniportAdapterContext;
142 
143  ASSERT(adapter != NULL);
144 
145  //
146  // Interrupts need to stop first
147  //
148  if (adapter->InterruptRegistered != FALSE)
149  {
151  }
152 
153  //
154  // If we have a mapped IO port range, we can talk to the NIC
155  //
156  if (adapter->IoBase != NULL)
157  {
158  if (adapter->ReceiveBuffer != NULL)
159  {
160  //
161  // Disassociate our shared buffer before freeing it to avoid
162  // NIC-induced memory corruption
163  //
164  NICRemoveReceiveBuffer(adapter);
165 
167  adapter->ReceiveBufferLength,
168  FALSE,
169  adapter->ReceiveBuffer,
170  adapter->ReceiveBufferPa);
171  }
172 
173  if (adapter->RuntTxBuffers != NULL)
174  {
177  FALSE,
178  adapter->RuntTxBuffers,
179  adapter->RuntTxBuffersPa);
180  }
181 
182  //
183  // Unregister the IO range
184  //
186  adapter->IoRangeStart,
187  adapter->IoRangeLength,
188  adapter->IoBase);
189  }
190 
191  //
192  // Destroy the adapter context
193  //
194  NdisFreeMemory(adapter, sizeof(*adapter), 0);
195 }
196 
198 NTAPI
202  IN PNDIS_MEDIUM MediumArray,
206  )
207 {
208  PRTL_ADAPTER adapter;
210  UINT i;
211  PNDIS_RESOURCE_LIST resourceList;
212  UINT resourceListSize;
213 
214  //
215  // Make sure the medium is supported
216  //
217  for (i = 0; i < MediumArraySize; i++)
218  {
219  if (MediumArray[i] == NdisMedium802_3)
220  {
222  break;
223  }
224  }
225 
226  if (i == MediumArraySize)
227  {
228  NDIS_DbgPrint(MIN_TRACE, ("802.3 medium was not found in the medium array\n"));
230  }
231 
232  //
233  // Allocate our adapter context
234  //
236  sizeof(*adapter),
237  ADAPTER_TAG);
239  {
240  NDIS_DbgPrint(MIN_TRACE, ("Failed to allocate adapter context\n"));
241  return NDIS_STATUS_RESOURCES;
242  }
243 
244  RtlZeroMemory(adapter, sizeof(*adapter));
245  adapter->MiniportAdapterHandle = MiniportAdapterHandle;
246  NdisAllocateSpinLock(&adapter->Lock);
247 
248  //
249  // Notify NDIS of some characteristics of our NIC
250  //
252  adapter,
253  0,
256 
257  //
258  // Get our resources for IRQ and IO base information
259  //
260  resourceList = NULL;
261  resourceListSize = 0;
264  resourceList,
265  &resourceListSize);
267  {
268  NDIS_DbgPrint(MIN_TRACE, ("Unexpected failure of NdisMQueryAdapterResources #1\n"));
270  goto Cleanup;
271  }
272 
273  status = NdisAllocateMemoryWithTag((PVOID*)&resourceList,
274  resourceListSize,
277  {
278  NDIS_DbgPrint(MIN_TRACE, ("Failed to allocate resource list\n"));
279  goto Cleanup;
280  }
281 
284  resourceList,
285  &resourceListSize);
287  {
288  NDIS_DbgPrint(MIN_TRACE, ("Unexpected failure of NdisMQueryAdapterResources #2\n"));
289  goto Cleanup;
290  }
291 
292  ASSERT(resourceList->Version == 1);
293  ASSERT(resourceList->Revision == 1);
294 
295  for (i = 0; i < resourceList->Count; i++)
296  {
297  switch (resourceList->PartialDescriptors[i].Type)
298  {
299  case CmResourceTypePort:
300  ASSERT(adapter->IoRangeStart == 0);
301 
302  ASSERT(resourceList->PartialDescriptors[i].u.Port.Start.HighPart == 0);
303 
304  adapter->IoRangeStart = resourceList->PartialDescriptors[i].u.Port.Start.LowPart;
305  adapter->IoRangeLength = resourceList->PartialDescriptors[i].u.Port.Length;
306 
307  NDIS_DbgPrint(MID_TRACE, ("I/O port range is %p to %p\n",
308  adapter->IoRangeStart, adapter->IoRangeStart + adapter->IoRangeLength));
309  break;
310 
312  ASSERT(adapter->InterruptVector == 0);
313  ASSERT(adapter->InterruptLevel == 0);
314 
315  adapter->InterruptVector = resourceList->PartialDescriptors[i].u.Interrupt.Vector;
316  adapter->InterruptLevel = resourceList->PartialDescriptors[i].u.Interrupt.Level;
317  adapter->InterruptShared = (resourceList->PartialDescriptors[i].ShareDisposition == CmResourceShareShared);
318  adapter->InterruptFlags = resourceList->PartialDescriptors[i].Flags;
319 
320  NDIS_DbgPrint(MID_TRACE, ("IRQ vector is %d\n", adapter->InterruptVector));
321  break;
322 
323  default:
324  NDIS_DbgPrint(MIN_TRACE, ("Unrecognized resource type: 0x%x\n", resourceList->PartialDescriptors[i].Type));
325  break;
326  }
327  }
328 
329  NdisFreeMemory(resourceList, resourceListSize, 0);
330  resourceList = NULL;
331 
332  if (adapter->IoRangeStart == 0 || adapter->InterruptVector == 0)
333  {
334  NDIS_DbgPrint(MIN_TRACE, ("Adapter didn't receive enough resources\n"));
335  goto Cleanup;
336  }
337 
338  //
339  // Allocate the DMA resources
340  //
342  FALSE, // RTL8139 only supports 32-bit addresses
345  {
346  NDIS_DbgPrint(MIN_TRACE, ("Unable to configure DMA\n"));
347  goto Cleanup;
348  }
349 
350  adapter->ReceiveBufferLength = FULL_RECEIVE_BUFFER_SIZE;
352  adapter->ReceiveBufferLength,
353  FALSE,
354  (PVOID*)&adapter->ReceiveBuffer,
355  &adapter->ReceiveBufferPa);
356  if (adapter->ReceiveBuffer == NULL)
357  {
358  NDIS_DbgPrint(MIN_TRACE, ("Unable to allocate receive buffer\n"));
360  goto Cleanup;
361  }
362 
365  FALSE,
366  (PVOID*)&adapter->RuntTxBuffers,
367  &adapter->RuntTxBuffersPa);
368  if (adapter->RuntTxBuffers == NULL)
369  {
370  NDIS_DbgPrint(MIN_TRACE, ("Unable to allocate runt TX buffer\n"));
372  goto Cleanup;
373  }
374 
375  //
376  // Register the I/O port range and configure the NIC
377  //
378  status = NdisMRegisterIoPortRange((PVOID*)&adapter->IoBase,
380  adapter->IoRangeStart,
381  adapter->IoRangeLength);
383  {
384  NDIS_DbgPrint(MIN_TRACE, ("Unable to register IO port range (0x%x)\n", status));
385  goto Cleanup;
386  }
387 
388  //
389  // Adapter setup
390  //
391  status = NICPowerOn(adapter);
393  {
394  NDIS_DbgPrint(MIN_TRACE, ("Unable to power on NIC (0x%x)\n", status));
395  goto Cleanup;
396  }
397 
398  status = NICSoftReset(adapter);
400  {
401  NDIS_DbgPrint(MIN_TRACE, ("Unable to reset the NIC (0x%x)\n", status));
402  goto Cleanup;
403  }
404 
405  status = NICGetPermanentMacAddress(adapter, adapter->PermanentMacAddress);
407  {
408  NDIS_DbgPrint(MIN_TRACE, ("Unable to get the fixed MAC address (0x%x)\n", status));
409  goto Cleanup;
410  }
411 
412  RtlCopyMemory(adapter->CurrentMacAddress, adapter->PermanentMacAddress, IEEE_802_ADDR_LENGTH);
413 
414  //
415  // Update link state and speed
416  //
417  NICUpdateLinkStatus(adapter);
418 
419  status = NICRegisterReceiveBuffer(adapter);
421  {
422  NDIS_DbgPrint(MIN_TRACE, ("Unable to setup receive buffer (0x%x)\n", status));
423  goto Cleanup;
424  }
425 
426  //
427  // We're ready to handle interrupts now
428  //
429  status = NdisMRegisterInterrupt(&adapter->Interrupt,
431  adapter->InterruptVector,
432  adapter->InterruptLevel,
433  TRUE, // We always want ISR calls
434  adapter->InterruptShared,
435  (adapter->InterruptFlags & CM_RESOURCE_INTERRUPT_LATCHED) ?
438  {
439  NDIS_DbgPrint(MIN_TRACE, ("Unable to register interrupt (0x%x)\n", status));
440  goto Cleanup;
441  }
442 
443  adapter->InterruptRegistered = TRUE;
444 
445  //
446  // Enable interrupts on the NIC
447  //
448  adapter->InterruptMask = DEFAULT_INTERRUPT_MASK;
449  status = NICApplyInterruptMask(adapter);
451  {
452  NDIS_DbgPrint(MIN_TRACE, ("Unable to apply interrupt mask (0x%x)\n", status));
453  goto Cleanup;
454  }
455 
456  //
457  // Turn on TX and RX now
458  //
459  status = NICEnableTxRx(adapter);
461  {
462  NDIS_DbgPrint(MIN_TRACE, ("Unable to enable TX and RX (0x%x)\n", status));
463  goto Cleanup;
464  }
465 
466  return NDIS_STATUS_SUCCESS;
467 
468 Cleanup:
469  if (resourceList != NULL)
470  {
471  NdisFreeMemory(resourceList, resourceListSize, 0);
472  }
473  if (adapter != NULL)
474  {
475  MiniportHalt(adapter);
476  }
477 
478  return status;
479 }
480 
481 NTSTATUS
482 NTAPI
486  )
487 {
488  NDIS_HANDLE wrapperHandle;
489  NDIS_MINIPORT_CHARACTERISTICS characteristics;
491 
492  RtlZeroMemory(&characteristics, sizeof(characteristics));
493  characteristics.MajorNdisVersion = NDIS_MINIPORT_MAJOR_VERSION;
494  characteristics.MinorNdisVersion = NDIS_MINIPORT_MINOR_VERSION;
495  characteristics.CheckForHangHandler = NULL;
496  characteristics.DisableInterruptHandler = NULL;
497  characteristics.EnableInterruptHandler = NULL;
498  characteristics.HaltHandler = MiniportHalt;
499  characteristics.HandleInterruptHandler = MiniportHandleInterrupt;
500  characteristics.InitializeHandler = MiniportInitialize;
501  characteristics.ISRHandler = MiniportISR;
502  characteristics.QueryInformationHandler = MiniportQueryInformation;
503  characteristics.ReconfigureHandler = NULL;
504  characteristics.ResetHandler = MiniportReset;
505  characteristics.SendHandler = MiniportSend;
506  characteristics.SetInformationHandler = MiniportSetInformation;
507  characteristics.TransferDataHandler = NULL;
508  characteristics.ReturnPacketHandler = NULL;
509  characteristics.SendPacketsHandler = NULL;
510  characteristics.AllocateCompleteHandler = NULL;
511 
513  if (!wrapperHandle)
514  {
515  return NDIS_STATUS_FAILURE;
516  }
517 
518  status = NdisMRegisterMiniport(wrapperHandle, &characteristics, sizeof(characteristics));
520  {
521  NdisTerminateWrapper(wrapperHandle, 0);
522  return NDIS_STATUS_FAILURE;
523  }
524 
525  return NDIS_STATUS_SUCCESS;
526 }
VOID NTAPI MiniportISR(OUT PBOOLEAN InterruptRecognized, OUT PBOOLEAN QueueMiniportHandleInterrupt, IN NDIS_HANDLE MiniportAdapterContext)
Definition: interrupt.c:16
#define NdisInterruptLevelSensitive
Definition: ndis.h:920
NDIS_STATUS NTAPI NICSoftReset(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:562
#define IN
Definition: typedefs.h:39
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define MID_TRACE
Definition: debug.h:15
VOID EXPORT NdisAllocateSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:152
VOID EXPORT NdisMAllocateSharedMemory(IN NDIS_HANDLE MiniportAdapterHandle, IN ULONG Length, IN BOOLEAN Cached, OUT PVOID *VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress)
Definition: memory.c:148
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS OpenErrorStatus
Definition: ndis.h:6008
ULONG IoRangeStart
Definition: nic.h:40
VOID EXPORT NdisMQueryAdapterResources(OUT PNDIS_STATUS Status, IN NDIS_HANDLE WrapperConfigurationContext, OUT PNDIS_RESOURCE_LIST ResourceList, IN OUT PUINT BufferSize)
Definition: hardware.c:103
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1548
NDIS_STATUS NTAPI MiniportReset(OUT PBOOLEAN AddressingReset, IN NDIS_HANDLE MiniportAdapterContext)
Definition: ndis.c:17
NDIS_STATUS EXPORT NdisAllocateMemoryWithTag(OUT PVOID *VirtualAddress, IN UINT Length, IN ULONG Tag)
Definition: memory.c:21
#define RESOURCE_LIST_TAG
Definition: nic.h:16
#define FULL_RECEIVE_BUFFER_SIZE
Definition: nic.h:22
MDL * PNDIS_BUFFER
Definition: ndis.h:343
NDIS_STATUS EXPORT NdisMRegisterIoPortRange(OUT PVOID *PortOffset, IN NDIS_HANDLE MiniportAdapterHandle, IN UINT InitialPort, IN UINT NumberOfPorts)
Definition: io.c:1018
VOID EXPORT NdisReleaseSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:239
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
* PNDIS_STATUS
Definition: ndis.h:45
_In_ NDIS_HANDLE MiniportAdapterHandle
Definition: ndis.h:4668
NDIS_PHYSICAL_ADDRESS ReceiveBufferPa
Definition: nic.h:60
NDIS_STATUS NTAPI NICEnableTxRx(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:605
NDIS_STATUS EXPORT NdisMInitializeScatterGatherDma(IN NDIS_HANDLE MiniportAdapterHandle, IN BOOLEAN Dma64BitAddresses, IN ULONG MaximumPhysicalMapping)
Definition: io.c:1169
BOOLEAN InterruptRegistered
Definition: nic.h:50
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT SelectedMediumIndex
Definition: ndis.h:6008
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT _In_ UINT MediumArraySize
Definition: ndis.h:6013
#define NDIS_STATUS_UNSUPPORTED_MEDIA
Definition: ndis.h:490
NTSTATUS NTAPI DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: ndis.c:297
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _In_ NDIS_HANDLE WrapperConfigurationContext
Definition: ndis.h:3944
#define CmResourceTypePort
Definition: hwresource.cpp:123
int NDIS_STATUS
Definition: ntddndis.h:471
NDIS_MINIPORT_INTERRUPT Interrupt
Definition: nic.h:49
VOID EXPORT NdisMFreeSharedMemory(IN NDIS_HANDLE MiniportAdapterHandle, IN ULONG Length, IN BOOLEAN Cached, IN PVOID VirtualAddress, IN NDIS_PHYSICAL_ADDRESS PhysicalAddress)
Definition: memory.c:215
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
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
#define MINIMUM_FRAME_SIZE
Definition: nic.h:25
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
smooth NULL
Definition: ftsmooth.c:416
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
VOID NTAPI NICUpdateLinkStatus(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:808
UCHAR DirtyTxDesc
Definition: nic.h:72
ULONG IoRangeLength
Definition: nic.h:41
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)
Definition: io.c:941
ULONG DebugTraceLevel
Definition: ndis.c:13
VOID EXPORT NdisGetFirstBufferFromPacketSafe(IN PNDIS_PACKET _Packet, OUT PNDIS_BUFFER *_FirstBuffer, OUT PVOID *_FirstBufferVA, OUT PUINT _FirstBufferLength, OUT PUINT _TotalBufferLength, IN MM_PAGE_PRIORITY Priority)
Definition: buffer.c:916
UCHAR CurrentTxDesc
Definition: nic.h:73
VOID EXPORT NdisTerminateWrapper(IN NDIS_HANDLE NdisWrapperHandle, IN PVOID SystemSpecific)
Definition: miniport.c:3012
BOOLEAN TxFull
Definition: nic.h:74
#define NDIS_ATTRIBUTE_BUS_MASTER
Definition: ndis.h:586
#define NdisInterruptLatched
Definition: ndis.h:921
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
VOID NTAPI MiniportHandleInterrupt(IN NDIS_HANDLE MiniportAdapterContext)
Definition: interrupt.c:40
NDIS_STATUS NTAPI NICRemoveReceiveBuffer(IN PRTL_ADAPTER Adapter)
Definition: hardware.c:88
VOID EXPORT NdisAcquireSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:135
#define IEEE_802_ADDR_LENGTH
Definition: e1000hw.h:11
NDIS_SPIN_LOCK Lock
Definition: nic.h:38
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
#define ADAPTER_TAG
Definition: nic.h:15
NDIS_STATUS NTAPI NICPowerOn(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:540
char * PBOOLEAN
Definition: retypes.h:11
NDIS_PHYSICAL_ADDRESS RuntTxBuffersPa
Definition: nic.h:76
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)
Definition: ndis.c:88
enum _NDIS_MEDIUM * PNDIS_MEDIUM
ULONG LowPart
Definition: typedefs.h:105
PUCHAR IoBase
Definition: nic.h:48
NDIS_STATUS NTAPI MiniportSend(IN NDIS_HANDLE MiniportAdapterContext, IN PNDIS_PACKET Packet, IN UINT Flags)
Definition: ndis.c:28
VOID NTAPI MiniportHalt(IN NDIS_HANDLE MiniportAdapterContext)
Definition: ndis.c:66
NDIS_STATUS NTAPI NICApplyInterruptMask(IN PE1000_ADAPTER Adapter)
Definition: hardware.c:768
static const WCHAR Cleanup[]
Definition: register.c:80
NDIS_HANDLE MiniportAdapterHandle
Definition: nic.h:37
ULONG ReceiveBufferLength
Definition: nic.h:58
NDIS_STATUS NTAPI MiniportSetInformation(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesRead, OUT PULONG BytesNeeded)
Definition: info.c:232
#define TX_DESC_COUNT
Definition: rtlhw.h:14
struct _RTL_ADAPTER * PRTL_ADAPTER
NDIS_STATUS NTAPI NICRegisterReceiveBuffer(IN PRTL_ADAPTER Adapter)
Definition: hardware.c:75
NDIS_STATUS NTAPI NICTransmitPacket(IN PE1000_ADAPTER Adapter, IN PHYSICAL_ADDRESS PhysicalAddress, IN ULONG Length)
Definition: hardware.c:825
#define MAX_TRACE
Definition: debug.h:16
#define DEFAULT_INTERRUPT_MASK
Definition: nic.h:24
unsigned int UINT
Definition: ndis.h:50
VOID EXPORT NdisMDeregisterIoPortRange(IN NDIS_HANDLE MiniportAdapterHandle, IN UINT InitialPort, IN UINT NumberOfPorts, IN PVOID PortOffset)
Definition: io.c:1093
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
#define OUT
Definition: typedefs.h:40
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
struct _SCATTER_GATHER_LIST * PSCATTER_GATHER_LIST
Definition: iotypes.h:2098
#define NDIS_STATUS_RESOURCES
Definition: ndis.h:466
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define MIN_TRACE
Definition: debug.h:14
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:28
#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
#define MAXIMUM_FRAME_SIZE
Definition: nic.h:19
static SERVICE_STATUS status
Definition: service.c:31
#define NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, InfoType)
Definition: ndis.h:1351
NDIS_STATUS NTAPI NICGetPermanentMacAddress(IN PE1000_ADAPTER Adapter, OUT PUCHAR MacAddress)
Definition: hardware.c:692
VOID EXPORT NdisMDeregisterInterrupt(IN PNDIS_MINIPORT_INTERRUPT Interrupt)
Definition: io.c:700
#define NDIS_STATUS_FAILURE
Definition: ndis.h:465
VOID EXPORT NdisFreeMemory(IN PVOID VirtualAddress, IN UINT Length, IN UINT MemoryFlags)
Definition: memory.c:110
VOID EXPORT NdisMSetAttributesEx(IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_HANDLE MiniportAdapterContext, IN UINT CheckForHangTimeInSeconds OPTIONAL, IN ULONG AttributeFlags, IN NDIS_INTERFACE_TYPE AdapterType)
Definition: miniport.c:2883
unsigned int * PUINT
Definition: ndis.h:50
NDIS_STATUS NTAPI MiniportQueryInformation(IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesWritten, OUT PULONG BytesNeeded)
Definition: info.c:51
PUCHAR ReceiveBuffer
Definition: nic.h:59
Definition: ps.c:97
PUCHAR RuntTxBuffers
Definition: nic.h:75