ReactOS  0.4.15-dev-5112-g22d8c0f
init.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS nVidia nForce Ethernet Controller Driver
3  * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE: Miniport initialization helper routines
5  * COPYRIGHT: Copyright 2021-2022 Dmitry Borisov <di.sean@protonmail.com>
6  */
7 
8 /* INCLUDES *******************************************************************/
9 
10 #include "nvnet.h"
11 
12 #define NDEBUG
13 #include "debug.h"
14 
15 /* FUNCTIONS ******************************************************************/
16 
17 static
18 CODE_SEG("PAGE")
19 VOID
22  _In_ PCWSTR EntryName,
24  _In_ ULONG DefaultValue,
25  _In_ ULONG Minimum,
26  _In_ ULONG Maximum)
27 {
30  PNDIS_CONFIGURATION_PARAMETER ConfigurationParameter;
31 
32  PAGED_CODE();
33 
34  NdisInitUnicodeString(&Keyword, EntryName);
36  &ConfigurationParameter,
38  &Keyword,
41  {
42  NDIS_DbgPrint(MIN_TRACE, ("'%S' request failed\n", EntryName));
43 
44  *EntryContext = DefaultValue;
45  }
46  else
47  {
48  if (ConfigurationParameter->ParameterData.IntegerData >= Minimum &&
49  ConfigurationParameter->ParameterData.IntegerData <= Maximum)
50  {
51  *EntryContext = ConfigurationParameter->ParameterData.IntegerData;
52  }
53  else
54  {
55  NDIS_DbgPrint(MAX_TRACE, ("'%S' value out of range\n", EntryName));
56 
57  *EntryContext = DefaultValue;
58  }
59  }
60 
61  NDIS_DbgPrint(MIN_TRACE, ("Set '%S' to %d\n", EntryName, *EntryContext));
62 }
63 
64 static
65 CODE_SEG("PAGE")
68  _Inout_ PNVNET_ADAPTER Adapter)
69 {
73  UINT Length;
74  ULONG GenericUlong;
75 
76  PAGED_CODE();
77 
78  NDIS_DbgPrint(MIN_TRACE, ("()\n"));
79 
82  Adapter->WrapperConfigurationHandle);
84  return Status;
85 
87  L"OptimizationMode",
88  &GenericUlong,
92  Adapter->OptimizationMode = GenericUlong;
93 
95  L"FlowControl",
96  &GenericUlong,
100  Adapter->FlowControlMode = GenericUlong;
101 
103  L"SpeedDuplex",
104  &GenericUlong,
105  0,
106  0,
107  4);
108  switch (GenericUlong)
109  {
110  case 1:
111  Adapter->Flags |= NV_FORCE_SPEED_AND_DUPLEX;
112  break;
113  case 2:
114  Adapter->Flags |= (NV_FORCE_SPEED_AND_DUPLEX | NV_FORCE_FULL_DUPLEX);
115  break;
116  case 3:
117  Adapter->Flags |= (NV_FORCE_SPEED_AND_DUPLEX | NV_USER_SPEED_100);
118  break;
119  case 4:
120  Adapter->Flags |= (NV_FORCE_SPEED_AND_DUPLEX | NV_FORCE_FULL_DUPLEX |
122  break;
123 
124  default:
125  break;
126  }
127 
129  L"ChecksumOffload",
130  &GenericUlong,
131  0,
132  0,
133  1);
134  if (GenericUlong)
135  Adapter->Flags |= NV_SEND_CHECKSUM;
136 
138  L"LargeSendOffload",
139  &GenericUlong,
140  0,
141  0,
142  1);
143  if (GenericUlong)
144  Adapter->Flags |= NV_SEND_LARGE_SEND;
145 
147  L"JumboSize",
148  &GenericUlong,
152  Adapter->MaximumFrameSize = GenericUlong;
153 
155  L"Priority",
156  &GenericUlong,
157  0,
158  0,
159  1);
160  if (GenericUlong)
161  Adapter->Flags |= NV_PACKET_PRIORITY;
162 
164  L"VlanTag",
165  &GenericUlong,
166  0,
167  0,
168  1);
169  if (GenericUlong)
170  Adapter->Flags |= NV_VLAN_TAGGING;
171 
173  L"VlanID",
174  &GenericUlong,
175  0,
176  0,
178 
181  &Length,
184  {
187  {
188  NDIS_DbgPrint(MAX_TRACE, ("Invalid software MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
189  NetworkAddress[0],
190  NetworkAddress[1],
191  NetworkAddress[2],
192  NetworkAddress[3],
193  NetworkAddress[4],
194  NetworkAddress[5]));
195  }
196  else
197  {
198  NDIS_DbgPrint(MIN_TRACE, ("Using software MAC\n"));
199 
200  ETH_COPY_NETWORK_ADDRESS(Adapter->CurrentMacAddress, NetworkAddress);
201 
202  Adapter->Flags |= NV_USE_SOFT_MAC_ADDRESS;
203  }
204  }
206 
208 
209  return Status;
210 }
211 
212 static
213 CODE_SEG("PAGE")
216  _Inout_ PNVNET_ADAPTER Adapter)
217 {
219  PNDIS_RESOURCE_LIST AssignedResources = NULL;
220  UINT i, ResourceListSize = 0;
221 
222  PAGED_CODE();
223 
224  NDIS_DbgPrint(MIN_TRACE, ("()\n"));
225 
227  Adapter->WrapperConfigurationHandle,
228  AssignedResources,
229  &ResourceListSize);
231  {
233  return NDIS_STATUS_FAILURE;
234  }
235 
236  Status = NdisAllocateMemoryWithTag((PVOID*)&AssignedResources,
237  ResourceListSize,
238  NVNET_TAG);
240  {
242  return Status;
243  }
244 
246  Adapter->WrapperConfigurationHandle,
247  AssignedResources,
248  &ResourceListSize);
250  {
252  goto Cleanup;
253  }
254 
255  for (i = 0; i < AssignedResources->Count; ++i)
256  {
257  PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor = &AssignedResources->PartialDescriptors[i];
258 
259  switch (Descriptor->Type)
260  {
262  {
263  Adapter->IoAddress = Descriptor->u.Memory.Start;
264  Adapter->IoLength = Descriptor->u.Memory.Length;
265  break;
266  }
267 
269  {
270  Adapter->InterruptVector = Descriptor->u.Interrupt.Vector;
271  Adapter->InterruptLevel = Descriptor->u.Interrupt.Level;
272  Adapter->InterruptShared = (Descriptor->ShareDisposition == CmResourceShareShared);
273  Adapter->InterruptFlags = Descriptor->Flags;
274  break;
275  }
276 
277  default:
278  break;
279  }
280  }
281 
282  if (!Adapter->IoAddress.QuadPart || !Adapter->InterruptVector)
283  {
286  goto Cleanup;
287  }
288 
289  NDIS_DbgPrint(MIN_TRACE, ("MEM at [%I64X-%I64X]\n",
290  Adapter->IoAddress.QuadPart,
291  Adapter->IoAddress.QuadPart + Adapter->IoLength));
292  NDIS_DbgPrint(MIN_TRACE, ("IRQ Vector %d Level %d\n",
293  Adapter->InterruptVector,
294  Adapter->InterruptLevel));
295 
296  Status = NdisMMapIoSpace((PVOID*)&Adapter->IoBase,
297  Adapter->AdapterHandle,
298  Adapter->IoAddress,
299  Adapter->IoLength);
301  {
303  goto Cleanup;
304  }
305 
306 Cleanup:
307  NdisFreeMemory(AssignedResources, ResourceListSize, 0);
308 
309  return Status;
310 }
311 
312 static
313 CODE_SEG("PAGE")
316  _In_ PNVNET_ADAPTER Adapter)
317 {
318  ULONG i;
319  BOOLEAN HasBuffer = FALSE;
320  PNVNET_TX_BUFFER CoalesceBuffer;
322 
323  PAGED_CODE();
324 
325  Status = NdisAllocateMemoryWithTag((PVOID*)&CoalesceBuffer,
327  NVNET_TAG);
329  return Status;
330 
331  NdisZeroMemory(CoalesceBuffer, NVNET_TRANSMIT_BUFFERS * sizeof(NVNET_TX_BUFFER));
332 
333  Adapter->SendBuffer = CoalesceBuffer;
334 
335  for (i = 0; i < NVNET_TRANSMIT_BUFFERS; ++i)
336  {
339 
340  NdisMAllocateSharedMemory(Adapter->AdapterHandle,
341  Adapter->MaximumFrameSize + NVNET_ALIGNMENT,
342  TRUE, /* Cached */
344  &PhysicalAddress);
345  if (!VirtualAddress)
346  continue;
347 
348  CoalesceBuffer->VirtualAddress = ALIGN_UP_POINTER_BY(VirtualAddress, NVNET_ALIGNMENT);
349  CoalesceBuffer->PhysicalAddress.QuadPart =
351 
352  Adapter->SendBufferAllocationData[i].PhysicalAddress.QuadPart = PhysicalAddress.QuadPart;
353  Adapter->SendBufferAllocationData[i].VirtualAddress = VirtualAddress;
354 
355  PushEntryList(&Adapter->Send.BufferList, &CoalesceBuffer->Link);
356  ++CoalesceBuffer;
357 
358  HasBuffer = TRUE;
359  }
360  if (!HasBuffer)
361  {
362  return NDIS_STATUS_RESOURCES;
363  }
364 
365  return NDIS_STATUS_SUCCESS;
366 }
367 
368 static
369 CODE_SEG("PAGE")
372  _In_ PNVNET_ADAPTER Adapter)
373 {
374  PNVNET_TCB Tcb;
376 
377  PAGED_CODE();
378 
381  NVNET_TAG);
383  return Status;
384 
386 
387  Adapter->Send.TailTcb = Tcb + (NVNET_TRANSMIT_BLOCKS - 1);
388  Adapter->Send.HeadTcb = Tcb;
389  Adapter->Send.CurrentTcb = Tcb;
390  Adapter->Send.LastTcb = Tcb;
391 
392  return NDIS_STATUS_SUCCESS;
393 }
394 
395 static
396 CODE_SEG("PAGE")
399  _In_ PNVNET_ADAPTER Adapter)
400 {
401  NVNET_TBD Tbd;
402  ULONG Size;
403 
404  PAGED_CODE();
405 
406  if (Adapter->Features & DEV_HAS_HIGH_DMA)
407  {
408  Size = sizeof(NVNET_DESCRIPTOR_64);
409  }
410  else
411  {
412  Size = sizeof(NVNET_DESCRIPTOR_32);
413  }
414  NdisMAllocateSharedMemory(Adapter->AdapterHandle,
416  TRUE, /* Cached */
417  &Adapter->TbdOriginal,
418  &Adapter->TbdPhysOriginal);
419  if (!Adapter->TbdOriginal)
420  return NDIS_STATUS_RESOURCES;
421 
422  Tbd.Memory = ALIGN_UP_POINTER_BY(Adapter->TbdOriginal, NVNET_ALIGNMENT);
423  Adapter->TbdPhys.QuadPart = ALIGN_UP_BY(Adapter->TbdPhysOriginal.QuadPart, NVNET_ALIGNMENT);
424 
425  Adapter->Send.HeadTbd = Tbd;
426  Adapter->Send.CurrentTbd = Tbd;
427 
428  if (Adapter->Features & DEV_HAS_HIGH_DMA)
429  {
430  Adapter->Send.TailTbd.x64 = Tbd.x64 + (NVNET_TRANSMIT_DESCRIPTORS - 1);
431  }
432  else
433  {
434  Adapter->Send.TailTbd.x32 = Tbd.x32 + (NVNET_TRANSMIT_DESCRIPTORS - 1);
435  }
436 
437  return NDIS_STATUS_SUCCESS;
438 }
439 
440 static
441 CODE_SEG("PAGE")
444  _In_ PNVNET_ADAPTER Adapter)
445 {
446  ULONG Size;
447 
448  PAGED_CODE();
449 
450  if (Adapter->Features & DEV_HAS_HIGH_DMA)
451  {
452  Size = sizeof(NVNET_DESCRIPTOR_64);
453  }
454  else
455  {
456  Size = sizeof(NVNET_DESCRIPTOR_32);
457  }
458  NdisMAllocateSharedMemory(Adapter->AdapterHandle,
460  TRUE, /* Cached */
461  &Adapter->RbdOriginal,
462  &Adapter->RbdPhysOriginal);
463  if (!Adapter->RbdOriginal)
464  return NDIS_STATUS_RESOURCES;
465 
466  Adapter->Receive.NvRbd.Memory = ALIGN_UP_POINTER_BY(Adapter->RbdOriginal, NVNET_ALIGNMENT);
467  Adapter->RbdPhys.QuadPart = ALIGN_UP_BY(Adapter->RbdPhysOriginal.QuadPart, NVNET_ALIGNMENT);
468 
469  return NDIS_STATUS_SUCCESS;
470 }
471 
472 static
473 CODE_SEG("PAGE")
476  _In_ PNVNET_ADAPTER Adapter)
477 {
478  PAGED_CODE();
479 
480  NdisMAllocateSharedMemory(Adapter->AdapterHandle,
482  TRUE, /* Cached */
483  (PVOID*)&Adapter->ReceiveBuffer,
484  &Adapter->ReceiveBufferPhys);
485  if (!Adapter->ReceiveBuffer)
486  {
487  return NDIS_STATUS_RESOURCES;
488  }
489 
490  return NDIS_STATUS_SUCCESS;
491 }
492 
493 static
494 CODE_SEG("PAGE")
497  _In_ PNVNET_ADAPTER Adapter)
498 {
500 
501  PAGED_CODE();
502 
503  Status = AllocateTransmitBuffers(Adapter);
505  return Status;
506 
507  Status = AllocateTransmitBlocks(Adapter);
509  return Status;
510 
513  return Status;
514 
517  return Status;
518 
519  Status = AllocateReceiveBuffers(Adapter);
521  return Status;
522 
523  NdisAllocateSpinLock(&Adapter->Send.Lock);
524  NdisAllocateSpinLock(&Adapter->Receive.Lock);
525  NdisAllocateSpinLock(&Adapter->Lock);
526 
527  return NDIS_STATUS_SUCCESS;
528 }
529 
530 CODE_SEG("PAGE")
531 VOID
533  _In_ PNVNET_ADAPTER Adapter)
534 {
535  PAGED_CODE();
536 
537  Adapter->Send.TcbSlots = NVNET_TRANSMIT_BLOCKS;
538  Adapter->Send.TbdSlots = NVNET_TRANSMIT_DESCRIPTORS;
539 
540  if (Adapter->Features & DEV_HAS_HIGH_DMA)
541  {
542  NdisZeroMemory(Adapter->Send.HeadTbd.x64,
544  }
545  else
546  {
547  NdisZeroMemory(Adapter->Send.HeadTbd.x32,
549  }
550 }
551 
552 static
553 CODE_SEG("PAGE")
554 VOID
556  _In_ PNVNET_ADAPTER Adapter)
557 {
558  NV_RBD NvRbd;
559  ULONG i;
560 
561  PAGED_CODE();
562 
563  Adapter->CurrentRx = 0;
564 
565  if (Adapter->Features & DEV_HAS_HIGH_DMA)
566  {
567  for (i = 0; i < NVNET_RECEIVE_DESCRIPTORS; ++i)
568  {
569  NvRbd.x64 = &Adapter->Receive.NvRbd.x64[i];
570 
571  NvRbd.x64->AddressHigh = NdisGetPhysicalAddressHigh(Adapter->ReceiveBufferPhys)
573  NvRbd.x64->AddressLow = NdisGetPhysicalAddressLow(Adapter->ReceiveBufferPhys)
575  NvRbd.x64->VlanTag = 0;
577  }
578  }
579  else
580  {
581  for (i = 0; i < NVNET_RECEIVE_DESCRIPTORS; ++i)
582  {
583  NvRbd.x32 = &Adapter->Receive.NvRbd.x32[i];
584 
585  NvRbd.x32->Address = NdisGetPhysicalAddressLow(Adapter->ReceiveBufferPhys)
588  }
589  }
590 }
591 
592 
593 CODE_SEG("PAGE")
594 VOID
596  _In_ PNVNET_ADAPTER Adapter)
597 {
598  ULONG i;
599  ULONG DescriptorSize;
600 
601  PAGED_CODE();
602 
603  NDIS_DbgPrint(MIN_TRACE, ("()\n"));
604 
605  for (i = 0; i < RTL_NUMBER_OF(Adapter->WakeFrames); ++i)
606  {
607  PNVNET_WAKE_FRAME WakeFrame = Adapter->WakeFrames[i];
608 
609  if (!WakeFrame)
610  continue;
611 
612  NdisFreeMemory(WakeFrame, sizeof(*WakeFrame), 0);
613  }
614 
615  if (Adapter->Interrupt.InterruptObject)
616  {
617  NdisMDeregisterInterrupt(&Adapter->Interrupt);
618  Adapter->Interrupt.InterruptObject = NULL;
619  }
620 
621  if (Adapter->Features & DEV_HAS_HIGH_DMA)
622  {
623  DescriptorSize = sizeof(NVNET_DESCRIPTOR_64);
624  }
625  else
626  {
627  DescriptorSize = sizeof(NVNET_DESCRIPTOR_32);
628  }
629  if (Adapter->TbdOriginal)
630  {
631  NdisMFreeSharedMemory(Adapter->AdapterHandle,
632  DescriptorSize * NVNET_TRANSMIT_DESCRIPTORS,
633  FALSE,
634  Adapter->TbdOriginal,
635  Adapter->TbdPhysOriginal);
636  Adapter->TbdOriginal = NULL;
637  }
638  if (Adapter->RbdOriginal)
639  {
640  NdisMFreeSharedMemory(Adapter->AdapterHandle,
641  DescriptorSize * NVNET_RECEIVE_DESCRIPTORS,
642  FALSE,
643  Adapter->RbdOriginal,
644  Adapter->RbdPhysOriginal);
645  Adapter->RbdOriginal = NULL;
646  }
647  if (Adapter->SendBuffer)
648  {
649  ULONG Length = ALIGN_UP_BY(Adapter->MaximumFrameSize, NVNET_ALIGNMENT);
650 
651  for (i = 0; i < NVNET_TRANSMIT_BUFFERS; ++i)
652  {
653  PNVNET_TX_BUFFER_DATA SendBufferData = &Adapter->SendBufferAllocationData[i];
654 
655  if (!SendBufferData->VirtualAddress)
656  continue;
657 
658  NdisMFreeSharedMemory(Adapter->AdapterHandle,
659  Length,
660  TRUE,
661  SendBufferData->VirtualAddress,
662  SendBufferData->PhysicalAddress);
663  }
664 
665  NdisFreeMemory(Adapter->SendBuffer, NVNET_TRANSMIT_BUFFERS * sizeof(NVNET_TX_BUFFER), 0);
666  Adapter->SendBuffer = NULL;
667  }
668 
669  if (Adapter->ReceiveBuffer)
670  {
671  NdisMFreeSharedMemory(Adapter->AdapterHandle,
673  FALSE,
674  Adapter->ReceiveBuffer,
675  Adapter->ReceiveBufferPhys);
676  Adapter->ReceiveBuffer = NULL;
677  }
678 
679  if (Adapter->IoBase)
680  {
681  NdisMUnmapIoSpace(Adapter->AdapterHandle,
682  Adapter->IoBase,
683  Adapter->IoLength);
684  Adapter->IoBase = NULL;
685  }
686 
687  if (Adapter->Lock.SpinLock)
688  NdisFreeSpinLock(&Adapter->Lock);
689  if (Adapter->Send.Lock.SpinLock)
690  NdisFreeSpinLock(&Adapter->Send.Lock);
691  if (Adapter->Receive.Lock.SpinLock)
692  NdisFreeSpinLock(&Adapter->Receive.Lock);
693 
694  NdisFreeMemory(Adapter->AdapterOriginal, sizeof(NVNET_ADAPTER), 0);
695 }
696 
697 CODE_SEG("PAGE")
699 NTAPI
703  _In_ PNDIS_MEDIUM MediumArray,
707 {
708  UINT i;
709  ULONG Size;
710  PVOID UnalignedAdapter;
711  PNVNET_ADAPTER Adapter;
713 
714  PAGED_CODE();
715 
716  NDIS_DbgPrint(MIN_TRACE, ("()\n"));
717 
718  for (i = 0; i < MediumArraySize; ++i)
719  {
720  if (MediumArray[i] == NdisMedium802_3)
721  {
723  break;
724  }
725  }
726  if (i == MediumArraySize)
727  {
728  NDIS_DbgPrint(MAX_TRACE, ("No supported media\n"));
730  }
731 
733 
734  Status = NdisAllocateMemoryWithTag((PVOID*)&UnalignedAdapter,
735  Size,
736  NVNET_TAG);
738  {
739  NDIS_DbgPrint(MAX_TRACE, ("Failed to allocate adapter\n"));
740  return NDIS_STATUS_RESOURCES;
741  }
742 
743  NdisZeroMemory(UnalignedAdapter, Size);
744  Adapter = ALIGN_UP_POINTER_BY(UnalignedAdapter, NdisGetSharedDataAlignment());
745  Adapter->AdapterOriginal = UnalignedAdapter;
748 
749  Status = NvNetReadConfiguration(Adapter);
751  {
752  goto Failure;
753  }
754 
756  Adapter,
757  0,
759  // NDIS_ATTRIBUTE_DESERIALIZE | TODO
762 
763  Status = NvNetRecognizeHardware(Adapter);
765  {
767  {
769  }
771  {
773  }
774 
775  goto Failure;
776  }
777 
780  {
781  goto Failure;
782  }
783 
785  !!(Adapter->Features & DEV_HAS_HIGH_DMA),
787  // ^TODO: NVNET_MAX_DMA_TRANSFER);
789  {
791  goto Failure;
792  }
793 
794  Status = AllocateAdapterMemory(Adapter);
796  {
797  NDIS_DbgPrint(MAX_TRACE, ("Failed to allocate adapter memory\n"));
798 
800  goto Failure;
801  }
802 
803  NvNetInitTransmitMemory(Adapter);
804  NvNetInitReceiveMemory(Adapter);
805 
806  if (Adapter->Features & DEV_HAS_HIGH_DMA)
807  {
810  }
811  else
812  {
814 
815  if (Adapter->Features & DEV_HAS_LARGEDESC)
816  {
818  }
819  else
820  {
822  }
823  }
824 
827  {
829  goto Failure;
830  }
831 
832  if (!(Adapter->Flags & NV_USE_SOFT_MAC_ADDRESS))
833  {
835  Adapter->PermanentMacAddress);
836  }
837 
838  NvNetSetupMacAddress(Adapter, Adapter->CurrentMacAddress);
839 
840  Status = NvNetInitNIC(Adapter, TRUE);
842  {
843  NDIS_DbgPrint(MAX_TRACE, ("Failed to initialize the NIC\n"));
844 
846  goto Failure;
847  }
848 
849  NvNetDisableInterrupts(Adapter);
852 
853 /* FIXME: Bug in the PIC HAL? */
854 #if defined(SARCH_XBOX)
856  Adapter->AdapterHandle,
857  Adapter->InterruptVector,
858  Adapter->InterruptLevel,
859  TRUE, /* Request ISR calls */
860  FALSE,
862 #else
864  Adapter->AdapterHandle,
865  Adapter->InterruptVector,
866  Adapter->InterruptLevel,
867  TRUE, /* Request ISR calls */
868  TRUE, /* Shared */
870 #endif
872  {
874  goto Failure;
875  }
876 
877  NvNetStartAdapter(Adapter);
878 
879  return NDIS_STATUS_SUCCESS;
880 
881 Failure:
882  NvNetFreeAdapter(Adapter);
883 
884  return Status;
885 }
ULONG AddressLow
Definition: nic.h:364
struct _NVNET_DESCRIPTOR_32 NVNET_DESCRIPTOR_32
static VOID QueryInteger(_In_ NDIS_HANDLE ConfigurationHandle, _In_ PCWSTR EntryName, _Out_ PULONG EntryContext, _In_ ULONG DefaultValue, _In_ ULONG Minimum, _In_ ULONG Maximum)
Definition: init.c:20
#define ETH_IS_LOCALLY_ADMINISTERED(Address)
Definition: ethernetutils.h:35
#define NV_SEND_LARGE_SEND
Definition: nvnet.h:288
#define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS
Definition: ndis.h:592
#define ETH_IS_BROADCAST(Address)
Definition: xfilter.h:32
#define NdisInterruptLevelSensitive
Definition: ndis.h:920
VOID NvNetInitTransmitMemory(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:532
const uint16_t * PCWSTR
Definition: typedefs.h:57
struct _NVNET_ADAPTER NVNET_ADAPTER
Definition: nvnet.h:259
#define NVREG_IRQSTAT_MASK
Definition: nic.h:54
NDIS_STATUS NvNetRecognizeHardware(_Inout_ PNVNET_ADAPTER Adapter)
Definition: nic.c:675
static NDIS_STATUS AllocateReceiveBuffers(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:475
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
VOID EXPORT NdisAllocateSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:152
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
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
PVOID AdapterOriginal
Definition: nvnet.h:381
VOID EXPORT NdisMQueryAdapterResources(OUT PNDIS_STATUS Status, IN NDIS_HANDLE WrapperConfigurationContext, OUT PNDIS_RESOURCE_LIST ResourceList, IN OUT PUINT BufferSize)
Definition: hardware.c:103
#define _Inout_
Definition: ms_sal.h:378
ULONG FlagsLength
Definition: nic.h:358
ULONG Flags
Definition: nvnet.h:285
NDIS_STATUS NvNetInitNIC(_In_ PNVNET_ADAPTER Adapter, _In_ BOOLEAN InitPhy)
Definition: nic.c:401
NDIS_STATUS EXPORT NdisAllocateMemoryWithTag(OUT PVOID *VirtualAddress, IN UINT Length, IN ULONG Tag)
Definition: memory.c:21
#define _Out_
Definition: ms_sal.h:345
PVOID VirtualAddress
Definition: nvnet.h:186
VOID NvNetFreeAdapter(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:595
#define NDIS_ERROR_CODE_RESOURCE_CONFLICT
Definition: ndis.h:562
#define NDIS_ERROR_CODE_HARDWARE_FAILURE
Definition: ndis.h:564
#define TRUE
Definition: types.h:120
VOID EXPORT NdisOpenConfiguration(OUT PNDIS_STATUS Status, OUT PNDIS_HANDLE ConfigurationHandle, IN NDIS_HANDLE WrapperConfigurationContext)
Definition: config.c:197
#define NVREG_MIISTAT_MASK_ALL
Definition: nic.h:230
ULONG AddressHigh
Definition: nic.h:363
unsigned char * PUCHAR
Definition: retypes.h:3
ULONG InterruptLevel
Definition: nvnet.h:371
#define NV_FORCE_SPEED_AND_DUPLEX
Definition: nvnet.h:295
* PNDIS_STATUS
Definition: ndis.h:45
struct _NVNET_DESCRIPTOR_64 NVNET_DESCRIPTOR_64
_In_ NDIS_HANDLE MiniportAdapterHandle
Definition: ndis.h:4668
#define NDIS_ERROR_CODE_NETWORK_ADDRESS
Definition: ndis.h:570
VOID EXPORT NdisMUnmapIoSpace(IN NDIS_HANDLE MiniportAdapterHandle, IN PVOID VirtualAddress, IN UINT Length)
Definition: io.c:1139
#define NvNetLogError(Adapter, ErrorCode)
Definition: nvnet.h:387
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
ULONG InterruptVector
Definition: nvnet.h:370
NDIS_STATUS EXPORT NdisMInitializeScatterGatherDma(IN NDIS_HANDLE MiniportAdapterHandle, IN BOOLEAN Dma64BitAddresses, IN ULONG MaximumPhysicalMapping)
Definition: io.c:1169
static NDIS_STATUS AllocateTransmitBlocks(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:371
NDIS_HANDLE WrapperConfigurationHandle
Definition: nvnet.h:351
_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 NVNET_TRANSMIT_BLOCKS
Definition: nvnet.h:31
#define NDIS_STATUS_UNSUPPORTED_MEDIA
Definition: ndis.h:490
#define NVNET_ALIGNMENT
Definition: nvnet.h:37
union _NDIS_CONFIGURATION_PARAMETER::@2051 ParameterData
#define NVNET_TAG
Definition: nvnet.h:22
NVNET_TRANSMIT_PACKET NvNetTransmitPacket64
Definition: nvnet.h:391
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _In_ NDIS_HANDLE WrapperConfigurationContext
Definition: ndis.h:3944
PNVNET_DESCRIPTOR_32 x32
Definition: nvnet.h:223
ULONG Features
Definition: nvnet.h:284
int NDIS_STATUS
Definition: ntddndis.h:475
FORCEINLINE VOID PushEntryList(_Inout_ PSINGLE_LIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PSINGLE_LIST_ENTRY Entry)
Definition: rtlfuncs.h:253
PNVNET_TRANSMIT_PACKET TransmitPacket
Definition: nvnet.h:316
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
#define NDIS_STATUS_NOT_RECOGNIZED
Definition: ndis.h:348
#define NDIS_ERROR_CODE_ADAPTER_NOT_FOUND
Definition: ndis.h:565
#define L(x)
Definition: ntvdm.h:50
VOID EXPORT NdisReadConfiguration(OUT PNDIS_STATUS Status, OUT PNDIS_CONFIGURATION_PARAMETER *ParameterValue, IN NDIS_HANDLE ConfigurationHandle, IN PNDIS_STRING Keyword, IN NDIS_PARAMETER_TYPE ParameterType)
Definition: config.c:414
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define NdisGetPhysicalAddressHigh(PhysicalAddress)
Definition: ndis.h:3830
#define FALSE
Definition: types.h:117
#define NVNET_MAXIMUM_VLAN_ID
Definition: nvnet.h:62
NVNET_PROCESS_TRANSMIT ProcessTransmitDescriptors64
Definition: nvnet.h:394
static NDIS_STATUS NvNetInitializeAdapterResources(_Inout_ PNVNET_ADAPTER Adapter)
Definition: init.c:215
#define ETH_COPY_NETWORK_ADDRESS(_D, _S)
Definition: xfilter.h:75
UCHAR PermanentMacAddress[ETH_LENGTH_OF_ADDRESS]
Definition: nvnet.h:338
NDIS_PHYSICAL_ADDRESS PhysicalAddress
Definition: nvnet.h:187
unsigned char BOOLEAN
#define NV_USE_SOFT_MAC_ADDRESS
Definition: nvnet.h:294
_In_ PCWSTR _Inout_ _At_ QueryTable EntryContext
Definition: rtlfuncs.h:4182
VOID EXPORT NdisFreeSpinLock(IN PNDIS_SPIN_LOCK SpinLock)
Definition: control.c:204
#define _In_
Definition: ms_sal.h:308
FORCEINLINE VOID NV_WRITE(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_REGISTER Register, _In_ ULONG Value)
Definition: nvnet.h:646
#define DEV_HAS_HIGH_DMA
Definition: nic.h:22
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
ULONG EXPORT NdisGetSharedDataAlignment(VOID)
Definition: misc.c:502
VOID EXPORT NdisCloseConfiguration(IN NDIS_HANDLE ConfigurationHandle)
Definition: config.c:136
struct Keyword Keyword
Definition: tokenize.c:32
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
#define NV_RX2_AVAIL
Definition: nic.h:438
Status
Definition: gdiplustypes.h:24
#define NV_SEND_CHECKSUM
Definition: nvnet.h:287
#define NVNET_TRANSMIT_BUFFERS
Definition: nvnet.h:33
static NDIS_STATUS NvNetReadConfiguration(_Inout_ PNVNET_ADAPTER Adapter)
Definition: init.c:67
#define NVNET_TRANSMIT_DESCRIPTORS
Definition: nvnet.h:32
#define NV_USER_SPEED_100
Definition: nvnet.h:297
PNVNET_DESCRIPTOR_64 x64
Definition: nvnet.h:200
#define NDIS_ATTRIBUTE_BUS_MASTER
Definition: ndis.h:586
#define NdisInterruptLatched
Definition: ndis.h:921
VOID NvNetStartAdapter(_In_ PNVNET_ADAPTER Adapter)
Definition: nvnet.c:74
static NDIS_STATUS AllocateReceiveDescriptors(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:443
_Must_inspect_result_ _Out_ PNDIS_STATUS _Outptr_result_bytebuffer_to_ NetworkAddressLength PVOID * NetworkAddress
Definition: ndis.h:3956
NVNET_TRANSMIT_PACKET NvNetTransmitPacket32
Definition: nvnet.h:390
#define NDIS_STATUS_ADAPTER_NOT_FOUND
Definition: ndis.h:470
NDIS_STATUS NvNetGetPermanentMacAddress(_Inout_ PNVNET_ADAPTER Adapter, _Out_writes_bytes_all_(ETH_LENGTH_OF_ADDRESS) PUCHAR MacAddress)
Definition: nic.c:541
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE ConfigurationHandle
Definition: ndis.h:3944
VOID EXPORT NdisReadNetworkAddress(OUT PNDIS_STATUS Status, OUT PVOID *NetworkAddress, OUT PUINT NetworkAddressLength, IN NDIS_HANDLE ConfigurationHandle)
Definition: config.c:740
VOID EXPORT NdisInitUnicodeString(IN OUT PNDIS_STRING DestinationString, IN PCWSTR SourceString)
Definition: string.c:130
static NDIS_STATUS AllocateTransmitDescriptors(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:398
#define NVNET_MAXIMUM_FRAME_SIZE_JUMBO
Definition: nvnet.h:61
#define ALIGN_UP_POINTER_BY(ptr, align)
Definition: umtypes.h:85
enum _NDIS_MEDIUM * PNDIS_MEDIUM
UCHAR CurrentMacAddress[ETH_LENGTH_OF_ADDRESS]
Definition: nvnet.h:339
static const WCHAR Cleanup[]
Definition: register.c:80
PNVNET_PROCESS_TRANSMIT ProcessTransmit
Definition: nvnet.h:317
#define NDIS_ERROR_CODE_OUT_OF_RESOURCES
Definition: ndis.h:563
#define NVNET_MAXIMUM_FRAME_SIZE
Definition: nvnet.h:60
#define NV_RX_AVAIL
Definition: nic.h:419
PNVNET_DESCRIPTOR_32 x32
Definition: nvnet.h:199
NDIS_HANDLE AdapterHandle
Definition: nvnet.h:283
#define NV_PACKET_PRIORITY
Definition: nvnet.h:298
#define MAX_TRACE
Definition: debug.h:16
VOID NvNetSetupMacAddress(_In_ PNVNET_ADAPTER Adapter, _In_reads_bytes_(ETH_LENGTH_OF_ADDRESS) PUCHAR MacAddress)
Definition: nic.c:622
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 ETH_IS_MULTICAST(Address)
Definition: xfilter.h:35
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define NDIS_ERROR_CODE_INTERRUPT_CONNECT
Definition: ndis.h:566
NVNET_PROCESS_TRANSMIT ProcessTransmitDescriptorsLegacy
Definition: nvnet.h:392
#define NVNET_RECEIVE_BUFFER_SIZE
Definition: nvnet.h:39
PNVNET_DESCRIPTOR_64 x64
Definition: nvnet.h:224
unsigned int * PULONG
Definition: retypes.h:1
#define ETH_LENGTH_OF_ADDRESS
Definition: efilter.h:16
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define NV_VLAN_TAGGING
Definition: nvnet.h:299
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
#define NdisZeroMemory(Destination, Length)
Definition: ndis.h:3926
#define NVNET_RECEIVE_DESCRIPTORS
Definition: nvnet.h:34
ULONG FlagsLength
Definition: nic.h:366
NVNET_PROCESS_TRANSMIT ProcessTransmitDescriptors32
Definition: nvnet.h:393
PVOID Memory
Definition: nvnet.h:201
#define NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION
Definition: ndis.h:571
#define NDIS_STATUS_RESOURCES
Definition: ndis.h:466
unsigned int ULONG
Definition: retypes.h:1
#define MIN_TRACE
Definition: debug.h:14
#define DEV_HAS_LARGEDESC
Definition: nic.h:20
NDIS_STATUS EXPORT NdisMMapIoSpace(OUT PVOID *VirtualAddress, IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, IN UINT Length)
Definition: io.c:774
static NDIS_STATUS AllocateAdapterMemory(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:496
#define ALIGN_UP_BY(size, align)
NDIS_MINIPORT_INTERRUPT Interrupt
Definition: nvnet.h:369
static VOID NvNetInitReceiveMemory(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:555
#define NdisGetPhysicalAddressLow(PhysicalAddress)
Definition: ndis.h:3847
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
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: init.c:700
static CODE_SEG("PAGE")
Definition: isapnp.c:1482
VOID EXPORT NdisMDeregisterInterrupt(IN PNDIS_MINIPORT_INTERRUPT Interrupt)
Definition: io.c:700
static NDIS_STATUS AllocateTransmitBuffers(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:315
#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
Definition: nvnet.h:221
LONGLONG QuadPart
Definition: typedefs.h:114
#define PAGED_CODE()
#define NvNetDisableInterrupts(Adapter)
Definition: nvnet.h:666
#define NV_FORCE_FULL_DUPLEX
Definition: nvnet.h:296