ReactOS 0.4.17-dev-1190-g4c812f4
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
17static
18CODE_SEG("PAGE")
19VOID
22 _In_ PCWSTR EntryName,
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
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
58 }
59 }
60
61 NDIS_DbgPrint(MIN_TRACE, ("Set '%S' to %d\n", EntryName, *EntryContext));
62}
63
64static
65CODE_SEG("PAGE")
68 _Inout_ PNVNET_ADAPTER Adapter)
69{
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:
115 break;
116 case 3:
117 Adapter->Flags |= (NV_FORCE_SPEED_AND_DUPLEX | NV_USER_SPEED_100);
118 break;
119 case 4:
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"*LsoV1IPv4",
139 &GenericUlong,
140 0,
141 0,
142 1);
143 if (GenericUlong)
144 Adapter->Flags |= NV_SEND_LARGE_SEND;
145
147 L"*JumboPacket",
148 &GenericUlong,
152 Adapter->MaximumFrameSize = GenericUlong;
153
155 L"*PriorityVLANTag",
156 &GenericUlong,
157 3,
158 0,
159 3);
160 switch (GenericUlong)
161 {
162 case 0:
163 break;
164 case 1:
165 Adapter->Flags |= NV_PACKET_PRIORITY;
166 break;
167 case 2:
168 Adapter->Flags |= NV_VLAN_TAGGING;
169 break;
170 case 3:
171 Adapter->Flags |= NV_PACKET_PRIORITY | NV_VLAN_TAGGING;
172 break;
173
174 default:
175 ASSERT(FALSE);
177 }
178
180 L"VlanID",
181 &GenericUlong,
182 0,
183 0,
185 Adapter->VlanId = GenericUlong;
186
189 &Length,
192 {
195 {
196 NDIS_DbgPrint(MAX_TRACE, ("Invalid software MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
202 NetworkAddress[5]));
203 }
204 else
205 {
206 NDIS_DbgPrint(MIN_TRACE, ("Using software MAC\n"));
207
208 ETH_COPY_NETWORK_ADDRESS(Adapter->CurrentMacAddress, NetworkAddress);
209
210 Adapter->Flags |= NV_USE_SOFT_MAC_ADDRESS;
211 }
212 }
214
216
217 return Status;
218}
219
220static
221CODE_SEG("PAGE")
224 _Inout_ PNVNET_ADAPTER Adapter)
225{
227 PNDIS_RESOURCE_LIST AssignedResources = NULL;
228 UINT i, ResourceListSize = 0;
229
230 PAGED_CODE();
231
232 NDIS_DbgPrint(MIN_TRACE, ("()\n"));
233
235 Adapter->WrapperConfigurationHandle,
236 AssignedResources,
237 &ResourceListSize);
239 {
241 return NDIS_STATUS_FAILURE;
242 }
243
244 Status = NdisAllocateMemoryWithTag((PVOID*)&AssignedResources,
245 ResourceListSize,
246 NVNET_TAG);
248 {
250 return Status;
251 }
252
254 Adapter->WrapperConfigurationHandle,
255 AssignedResources,
256 &ResourceListSize);
258 {
260 goto Cleanup;
261 }
262
263 for (i = 0; i < AssignedResources->Count; ++i)
264 {
266
267 switch (Descriptor->Type)
268 {
270 {
271 Adapter->IoAddress = Descriptor->u.Memory.Start;
272 Adapter->IoLength = Descriptor->u.Memory.Length;
273 break;
274 }
275
277 {
278 Adapter->InterruptVector = Descriptor->u.Interrupt.Vector;
279 Adapter->InterruptLevel = Descriptor->u.Interrupt.Level;
280 Adapter->InterruptShared = (Descriptor->ShareDisposition == CmResourceShareShared);
281 Adapter->InterruptFlags = Descriptor->Flags;
282 break;
283 }
284
285 default:
286 break;
287 }
288 }
289
290 if (!Adapter->IoAddress.QuadPart || !Adapter->InterruptVector)
291 {
294 goto Cleanup;
295 }
296
297 NDIS_DbgPrint(MIN_TRACE, ("MEM at [%I64X-%I64X]\n",
298 Adapter->IoAddress.QuadPart,
299 Adapter->IoAddress.QuadPart + Adapter->IoLength));
300 NDIS_DbgPrint(MIN_TRACE, ("IRQ Vector %d Level %d\n",
301 Adapter->InterruptVector,
302 Adapter->InterruptLevel));
303
304 Status = NdisMMapIoSpace((PVOID*)&Adapter->IoBase,
305 Adapter->AdapterHandle,
306 Adapter->IoAddress,
307 Adapter->IoLength);
309 {
311 goto Cleanup;
312 }
313
314Cleanup:
315 NdisFreeMemory(AssignedResources, ResourceListSize, 0);
316
317 return Status;
318}
319
320static
321CODE_SEG("PAGE")
324 _In_ PNVNET_ADAPTER Adapter)
325{
326 ULONG i;
327 BOOLEAN HasBuffer = FALSE;
328 PNVNET_TX_BUFFER CoalesceBuffer;
330
331 PAGED_CODE();
332
333 Status = NdisAllocateMemoryWithTag((PVOID*)&CoalesceBuffer,
335 NVNET_TAG);
337 return Status;
338
339 NdisZeroMemory(CoalesceBuffer, NVNET_TRANSMIT_BUFFERS * sizeof(NVNET_TX_BUFFER));
340
341 Adapter->SendBuffer = CoalesceBuffer;
342
343 for (i = 0; i < NVNET_TRANSMIT_BUFFERS; ++i)
344 {
347
348 NdisMAllocateSharedMemory(Adapter->AdapterHandle,
349 Adapter->MaximumFrameSize + NVNET_ALIGNMENT,
350 TRUE, /* Cached */
353 if (!VirtualAddress)
354 continue;
355
357 CoalesceBuffer->PhysicalAddress.QuadPart =
359
360 Adapter->SendBufferAllocationData[i].PhysicalAddress.QuadPart = PhysicalAddress.QuadPart;
361 Adapter->SendBufferAllocationData[i].VirtualAddress = VirtualAddress;
362
363 PushEntryList(&Adapter->Send.BufferList, &CoalesceBuffer->Link);
364 ++CoalesceBuffer;
365
366 HasBuffer = TRUE;
367 }
368 if (!HasBuffer)
369 {
371 }
372
373 return NDIS_STATUS_SUCCESS;
374}
375
376static
377CODE_SEG("PAGE")
380 _In_ PNVNET_ADAPTER Adapter)
381{
382 PNVNET_TCB Tcb;
384
385 PAGED_CODE();
386
389 NVNET_TAG);
391 return Status;
392
394
395 Adapter->Send.TailTcb = Tcb + (NVNET_TRANSMIT_BLOCKS - 1);
396 Adapter->Send.HeadTcb = Tcb;
397 Adapter->Send.CurrentTcb = Tcb;
398 Adapter->Send.LastTcb = Tcb;
399
400 return NDIS_STATUS_SUCCESS;
401}
402
403static
404CODE_SEG("PAGE")
407 _In_ PNVNET_ADAPTER Adapter)
408{
409 NVNET_TBD Tbd;
410 ULONG Size;
411
412 PAGED_CODE();
413
414 if (Adapter->Features & DEV_HAS_HIGH_DMA)
415 {
416 Size = sizeof(NVNET_DESCRIPTOR_64);
417 }
418 else
419 {
420 Size = sizeof(NVNET_DESCRIPTOR_32);
421 }
422 NdisMAllocateSharedMemory(Adapter->AdapterHandle,
424 TRUE, /* Cached */
425 &Adapter->TbdOriginal,
426 &Adapter->TbdPhysOriginal);
427 if (!Adapter->TbdOriginal)
429
430 Tbd.Memory = ALIGN_UP_POINTER_BY(Adapter->TbdOriginal, NVNET_ALIGNMENT);
431 Adapter->TbdPhys.QuadPart = ALIGN_UP_BY(Adapter->TbdPhysOriginal.QuadPart, NVNET_ALIGNMENT);
432
433 Adapter->Send.HeadTbd = Tbd;
434 Adapter->Send.CurrentTbd = Tbd;
435
436 if (Adapter->Features & DEV_HAS_HIGH_DMA)
437 {
438 Adapter->Send.TailTbd.x64 = Tbd.x64 + (NVNET_TRANSMIT_DESCRIPTORS - 1);
439 }
440 else
441 {
442 Adapter->Send.TailTbd.x32 = Tbd.x32 + (NVNET_TRANSMIT_DESCRIPTORS - 1);
443 }
444
445 return NDIS_STATUS_SUCCESS;
446}
447
448static
449CODE_SEG("PAGE")
452 _In_ PNVNET_ADAPTER Adapter)
453{
454 ULONG Size;
455
456 PAGED_CODE();
457
458 if (Adapter->Features & DEV_HAS_HIGH_DMA)
459 {
460 Size = sizeof(NVNET_DESCRIPTOR_64);
461 }
462 else
463 {
464 Size = sizeof(NVNET_DESCRIPTOR_32);
465 }
466 NdisMAllocateSharedMemory(Adapter->AdapterHandle,
468 TRUE, /* Cached */
469 &Adapter->RbdOriginal,
470 &Adapter->RbdPhysOriginal);
471 if (!Adapter->RbdOriginal)
473
474 Adapter->Receive.NvRbd.Memory = ALIGN_UP_POINTER_BY(Adapter->RbdOriginal, NVNET_ALIGNMENT);
475 Adapter->RbdPhys.QuadPart = ALIGN_UP_BY(Adapter->RbdPhysOriginal.QuadPart, NVNET_ALIGNMENT);
476
477 return NDIS_STATUS_SUCCESS;
478}
479
480static
481CODE_SEG("PAGE")
484 _In_ PNVNET_ADAPTER Adapter)
485{
486 PAGED_CODE();
487
488 NdisMAllocateSharedMemory(Adapter->AdapterHandle,
490 TRUE, /* Cached */
491 (PVOID*)&Adapter->ReceiveBuffer,
492 &Adapter->ReceiveBufferPhys);
493 if (!Adapter->ReceiveBuffer)
494 {
496 }
497
498 return NDIS_STATUS_SUCCESS;
499}
500
501static
502CODE_SEG("PAGE")
505 _In_ PNVNET_ADAPTER Adapter)
506{
508
509 PAGED_CODE();
510
513 return Status;
514
517 return Status;
518
521 return Status;
522
525 return Status;
526
529 return Status;
530
531 NdisAllocateSpinLock(&Adapter->Send.Lock);
532 NdisAllocateSpinLock(&Adapter->Receive.Lock);
533 NdisAllocateSpinLock(&Adapter->Lock);
534
535 return NDIS_STATUS_SUCCESS;
536}
537
538CODE_SEG("PAGE")
539VOID
541 _In_ PNVNET_ADAPTER Adapter)
542{
543 PAGED_CODE();
544
545 Adapter->Send.TcbSlots = NVNET_TRANSMIT_BLOCKS;
546 Adapter->Send.TbdSlots = NVNET_TRANSMIT_DESCRIPTORS;
547
548 if (Adapter->Features & DEV_HAS_HIGH_DMA)
549 {
550 NdisZeroMemory(Adapter->Send.HeadTbd.x64,
552 }
553 else
554 {
555 NdisZeroMemory(Adapter->Send.HeadTbd.x32,
557 }
558}
559
560static
561CODE_SEG("PAGE")
562VOID
564 _In_ PNVNET_ADAPTER Adapter)
565{
566 NV_RBD NvRbd;
567 ULONG i;
568
569 PAGED_CODE();
570
571 Adapter->CurrentRx = 0;
572
573 if (Adapter->Features & DEV_HAS_HIGH_DMA)
574 {
575 for (i = 0; i < NVNET_RECEIVE_DESCRIPTORS; ++i)
576 {
577 NvRbd.x64 = &Adapter->Receive.NvRbd.x64[i];
578
579 NvRbd.x64->AddressHigh = NdisGetPhysicalAddressHigh(Adapter->ReceiveBufferPhys)
581 NvRbd.x64->AddressLow = NdisGetPhysicalAddressLow(Adapter->ReceiveBufferPhys)
583 NvRbd.x64->VlanTag = 0;
585 }
586 }
587 else
588 {
589 for (i = 0; i < NVNET_RECEIVE_DESCRIPTORS; ++i)
590 {
591 NvRbd.x32 = &Adapter->Receive.NvRbd.x32[i];
592
593 NvRbd.x32->Address = NdisGetPhysicalAddressLow(Adapter->ReceiveBufferPhys)
596 }
597 }
598}
599
600
601CODE_SEG("PAGE")
602VOID
604 _In_ PNVNET_ADAPTER Adapter)
605{
606 ULONG i;
608
609 PAGED_CODE();
610
611 NDIS_DbgPrint(MIN_TRACE, ("()\n"));
612
613 for (i = 0; i < RTL_NUMBER_OF(Adapter->WakeFrames); ++i)
614 {
615 PNVNET_WAKE_FRAME WakeFrame = Adapter->WakeFrames[i];
616
617 if (!WakeFrame)
618 continue;
619
620 NdisFreeMemory(WakeFrame, sizeof(*WakeFrame), 0);
621 }
622
623 if (Adapter->Interrupt.InterruptObject)
624 {
625 NdisMDeregisterInterrupt(&Adapter->Interrupt);
626 Adapter->Interrupt.InterruptObject = NULL;
627 }
628
629 if (Adapter->Features & DEV_HAS_HIGH_DMA)
630 {
632 }
633 else
634 {
636 }
637 if (Adapter->TbdOriginal)
638 {
639 NdisMFreeSharedMemory(Adapter->AdapterHandle,
641 FALSE,
642 Adapter->TbdOriginal,
643 Adapter->TbdPhysOriginal);
644 Adapter->TbdOriginal = NULL;
645 }
646 if (Adapter->RbdOriginal)
647 {
648 NdisMFreeSharedMemory(Adapter->AdapterHandle,
650 FALSE,
651 Adapter->RbdOriginal,
652 Adapter->RbdPhysOriginal);
653 Adapter->RbdOriginal = NULL;
654 }
655 if (Adapter->SendBuffer)
656 {
657 ULONG Length = ALIGN_UP_BY(Adapter->MaximumFrameSize, NVNET_ALIGNMENT);
658
659 for (i = 0; i < NVNET_TRANSMIT_BUFFERS; ++i)
660 {
661 PNVNET_TX_BUFFER_DATA SendBufferData = &Adapter->SendBufferAllocationData[i];
662
663 if (!SendBufferData->VirtualAddress)
664 continue;
665
666 NdisMFreeSharedMemory(Adapter->AdapterHandle,
667 Length,
668 TRUE,
669 SendBufferData->VirtualAddress,
670 SendBufferData->PhysicalAddress);
671 }
672
673 NdisFreeMemory(Adapter->SendBuffer, NVNET_TRANSMIT_BUFFERS * sizeof(NVNET_TX_BUFFER), 0);
674 Adapter->SendBuffer = NULL;
675 }
676
677 if (Adapter->ReceiveBuffer)
678 {
679 NdisMFreeSharedMemory(Adapter->AdapterHandle,
681 FALSE,
682 Adapter->ReceiveBuffer,
683 Adapter->ReceiveBufferPhys);
684 Adapter->ReceiveBuffer = NULL;
685 }
686
687 if (Adapter->IoBase)
688 {
689 NdisMUnmapIoSpace(Adapter->AdapterHandle,
690 Adapter->IoBase,
691 Adapter->IoLength);
692 Adapter->IoBase = NULL;
693 }
694
695 if (Adapter->Lock.SpinLock)
696 NdisFreeSpinLock(&Adapter->Lock);
697 if (Adapter->Send.Lock.SpinLock)
698 NdisFreeSpinLock(&Adapter->Send.Lock);
699 if (Adapter->Receive.Lock.SpinLock)
700 NdisFreeSpinLock(&Adapter->Receive.Lock);
701
702 NdisFreeMemory(Adapter->AdapterOriginal, sizeof(NVNET_ADAPTER), 0);
703}
704
705CODE_SEG("PAGE")
707NTAPI
711 _In_ PNDIS_MEDIUM MediumArray,
715{
716 UINT i;
717 ULONG Size;
718 PVOID UnalignedAdapter;
719 PNVNET_ADAPTER Adapter;
721
722 PAGED_CODE();
723
724 NDIS_DbgPrint(MIN_TRACE, ("()\n"));
725
726 for (i = 0; i < MediumArraySize; ++i)
727 {
728 if (MediumArray[i] == NdisMedium802_3)
729 {
731 break;
732 }
733 }
734 if (i == MediumArraySize)
735 {
736 NDIS_DbgPrint(MAX_TRACE, ("No supported media\n"));
738 }
739
741
742 Status = NdisAllocateMemoryWithTag((PVOID*)&UnalignedAdapter,
743 Size,
744 NVNET_TAG);
746 {
747 NDIS_DbgPrint(MAX_TRACE, ("Failed to allocate adapter\n"));
749 }
750
751 NdisZeroMemory(UnalignedAdapter, Size);
752 Adapter = ALIGN_UP_POINTER_BY(UnalignedAdapter, NdisGetSharedDataAlignment());
753 Adapter->AdapterOriginal = UnalignedAdapter;
756
759 {
760 goto Failure;
761 }
762
764 Adapter,
765 0,
767 // NDIS_ATTRIBUTE_DESERIALIZE | TODO
770
773 {
775 {
777 }
779 {
781 }
782
783 goto Failure;
784 }
785
788 {
789 goto Failure;
790 }
791
793 !!(Adapter->Features & DEV_HAS_HIGH_DMA),
795 // ^TODO: NVNET_MAX_DMA_TRANSFER);
797 {
799 goto Failure;
800 }
801
802 Status = AllocateAdapterMemory(Adapter);
804 {
805 NDIS_DbgPrint(MAX_TRACE, ("Failed to allocate adapter memory\n"));
806
808 goto Failure;
809 }
810
812 NvNetInitReceiveMemory(Adapter);
813
814 if (Adapter->Features & DEV_HAS_HIGH_DMA)
815 {
818 }
819 else
820 {
822
823 if (Adapter->Features & DEV_HAS_LARGEDESC)
824 {
826 }
827 else
828 {
830 }
831 }
832
835 {
837 goto Failure;
838 }
839
840 if (!(Adapter->Flags & NV_USE_SOFT_MAC_ADDRESS))
841 {
843 Adapter->PermanentMacAddress);
844 }
845
846 NvNetSetupMacAddress(Adapter, Adapter->CurrentMacAddress);
847
848 Status = NvNetInitNIC(Adapter, TRUE);
850 {
851 NDIS_DbgPrint(MAX_TRACE, ("Failed to initialize the NIC\n"));
852
854 goto Failure;
855 }
856
857 NvNetDisableInterrupts(Adapter);
860
861/* FIXME: Bug in the PIC HAL? */
862#if defined(SARCH_XBOX)
864 Adapter->AdapterHandle,
865 Adapter->InterruptVector,
866 Adapter->InterruptLevel,
867 TRUE, /* Request ISR calls */
868 FALSE,
870#else
872 Adapter->AdapterHandle,
873 Adapter->InterruptVector,
874 Adapter->InterruptLevel,
875 TRUE, /* Request ISR calls */
876 TRUE, /* Shared */
878#endif
880 {
882 goto Failure;
883 }
884
885 NvNetStartAdapter(Adapter);
886
887 return NDIS_STATUS_SUCCESS;
888
889Failure:
890 NvNetFreeAdapter(Adapter);
891
892 return Status;
893}
#define PAGED_CODE()
#define CODE_SEG(...)
#define ALIGN_UP_BY(size, align)
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
unsigned char BOOLEAN
Definition: actypes.h:127
#define MIN_TRACE
Definition: debug.h:14
#define MAX_TRACE
Definition: debug.h:16
_In_ ULONG _In_ MEMORY_CACHING_TYPE _Out_ PPHYSICAL_ADDRESS PhysicalAddress
Definition: dispmprt.h:714
_In_ ULONG _In_ MEMORY_CACHING_TYPE _Out_ PPHYSICAL_ADDRESS _Out_ PVOID * VirtualAddress
Definition: dispmprt.h:716
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const WCHAR Cleanup[]
Definition: register.c:80
#define L(x)
Definition: resources.c:13
#define ETH_IS_LOCALLY_ADMINISTERED(Address)
Definition: util.h:19
#define NDIS_DbgPrint(_t_, _x_)
Definition: debug.h:40
static NDIS_STATUS AllocateAdapterMemory(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:504
VOID NvNetFreeAdapter(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:603
static VOID NvNetInitReceiveMemory(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:563
VOID NvNetInitTransmitMemory(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:540
static NDIS_STATUS AllocateReceiveBuffers(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:483
static NDIS_STATUS AllocateReceiveDescriptors(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:451
static NDIS_STATUS AllocateTransmitDescriptors(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:406
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
static NDIS_STATUS AllocateTransmitBuffers(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:323
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:708
static NDIS_STATUS NvNetInitializeAdapterResources(_Inout_ PNVNET_ADAPTER Adapter)
Definition: init.c:223
static NDIS_STATUS AllocateTransmitBlocks(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:379
static NDIS_STATUS NvNetReadConfiguration(_Inout_ PNVNET_ADAPTER Adapter)
Definition: init.c:67
VOID EXPORT NdisCloseConfiguration(IN NDIS_HANDLE ConfigurationHandle)
Definition: config.c:136
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
VOID EXPORT NdisReadNetworkAddress(OUT PNDIS_STATUS Status, OUT PVOID *NetworkAddress, OUT PUINT NetworkAddressLength, IN NDIS_HANDLE ConfigurationHandle)
Definition: config.c:740
VOID EXPORT NdisOpenConfiguration(OUT PNDIS_STATUS Status, OUT PNDIS_HANDLE ConfigurationHandle, IN NDIS_HANDLE WrapperConfigurationContext)
Definition: config.c:197
VOID EXPORT NdisMQueryAdapterResources(OUT PNDIS_STATUS Status, IN NDIS_HANDLE WrapperConfigurationContext, OUT PNDIS_RESOURCE_LIST ResourceList, IN OUT PUINT BufferSize)
Definition: hardware.c:155
NDIS_STATUS EXPORT NdisMMapIoSpace(OUT PVOID *VirtualAddress, IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_PHYSICAL_ADDRESS PhysicalAddress, IN UINT Length)
Definition: io.c:774
VOID EXPORT NdisMDeregisterInterrupt(IN PNDIS_MINIPORT_INTERRUPT Interrupt)
Definition: io.c:700
VOID EXPORT NdisMUnmapIoSpace(IN NDIS_HANDLE MiniportAdapterHandle, IN PVOID VirtualAddress, IN UINT Length)
Definition: io.c:1138
NDIS_STATUS EXPORT NdisMInitializeScatterGatherDma(IN NDIS_HANDLE MiniportAdapterHandle, IN BOOLEAN Dma64BitAddresses, IN ULONG MaximumPhysicalMapping)
Definition: io.c:1168
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
VOID EXPORT NdisFreeMemory(IN PVOID VirtualAddress, IN UINT Length, IN UINT MemoryFlags)
Definition: memory.c:111
NDIS_STATUS EXPORT NdisAllocateMemoryWithTag(OUT PVOID *VirtualAddress, IN UINT Length, IN ULONG Tag)
Definition: memory.c:21
VOID EXPORT NdisMAllocateSharedMemory(IN NDIS_HANDLE MiniportAdapterHandle, IN ULONG Length, IN BOOLEAN Cached, OUT PVOID *VirtualAddress, OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress)
Definition: memory.c:149
VOID EXPORT NdisMFreeSharedMemory(IN NDIS_HANDLE MiniportAdapterHandle, IN ULONG Length, IN BOOLEAN Cached, IN PVOID VirtualAddress, IN NDIS_PHYSICAL_ADDRESS PhysicalAddress)
Definition: memory.c:216
ULONG EXPORT NdisGetSharedDataAlignment(VOID)
Definition: misc.c:551
VOID EXPORT NdisInitUnicodeString(IN OUT PNDIS_STRING DestinationString, IN PCWSTR SourceString)
Definition: string.c:130
#define ETH_LENGTH_OF_ADDRESS
Definition: efilter.h:16
Status
Definition: gdiplustypes.h:24
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
unsigned int UINT
Definition: sysinfo.c:13
#define ASSERT(a)
Definition: mode.c:44
_Must_inspect_result_ _Out_ PNDIS_STATUS _Outptr_result_bytebuffer_to_ NetworkAddressLength PVOID * NetworkAddress
Definition: ndis.h:3956
#define NDIS_STATUS_NOT_RECOGNIZED
Definition: ndis.h:348
@ NdisParameterInteger
Definition: ndis.h:926
#define NdisInterruptLatched
Definition: ndis.h:921
#define NdisZeroMemory(Destination, Length)
Definition: ndis.h:3926
unsigned int * PUINT
Definition: ndis.h:50
#define NDIS_ATTRIBUTE_BUS_MASTER
Definition: ndis.h:586
#define NDIS_ERROR_CODE_INTERRUPT_CONNECT
Definition: ndis.h:566
#define NdisInterruptLevelSensitive
Definition: ndis.h:920
#define NDIS_ERROR_CODE_OUT_OF_RESOURCES
Definition: ndis.h:563
#define NdisAllocateSpinLock(_SpinLock)
Definition: ndis.h:4088
#define NDIS_ERROR_CODE_NETWORK_ADDRESS
Definition: ndis.h:570
#define NDIS_ERROR_CODE_ADAPTER_NOT_FOUND
Definition: ndis.h:565
#define NDIS_ERROR_CODE_RESOURCE_CONFLICT
Definition: ndis.h:562
#define NDIS_ERROR_CODE_HARDWARE_FAILURE
Definition: ndis.h:564
#define NDIS_STATUS_FAILURE
Definition: ndis.h:465
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT SelectedMediumIndex
Definition: ndis.h:6011
#define NDIS_STATUS_SUCCESS
Definition: ndis.h:346
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _Out_ PUINT _In_ UINT MediumArraySize
Definition: ndis.h:6013
@ NdisInterfacePci
Definition: ndis.h:905
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE _In_ NDIS_HANDLE WrapperConfigurationContext
Definition: ndis.h:3946
#define NdisGetPhysicalAddressLow(PhysicalAddress)
Definition: ndis.h:3847
_In_ NDIS_HANDLE MiniportAdapterHandle
Definition: ndis.h:4668
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_HANDLE ConfigurationHandle
Definition: ndis.h:3945
#define NDIS_STATUS_UNSUPPORTED_MEDIA
Definition: ndis.h:490
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_CONFIGURATION_PARAMETER _In_ NDIS_HANDLE _In_ PNDIS_STRING Keyword
Definition: ndis.h:4416
_Must_inspect_result_ _Out_ PNDIS_STATUS _Out_ PNDIS_STATUS OpenErrorStatus
Definition: ndis.h:6009
#define NDIS_STATUS_ADAPTER_NOT_FOUND
Definition: ndis.h:470
#define NdisFreeSpinLock(_SpinLock)
Definition: ndis.h:4097
* PNDIS_STATUS
Definition: ndis.h:45
#define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS
Definition: ndis.h:592
#define NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION
Definition: ndis.h:571
#define NdisGetPhysicalAddressHigh(PhysicalAddress)
Definition: ndis.h:3830
#define NDIS_STATUS_RESOURCES
Definition: ndis.h:466
_In_ PCWSTR _Inout_ _At_ QueryTable EntryContext
Definition: rtlfuncs.h:4230
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:2968
NDIS_STATUS NvNetRecognizeHardware(_Inout_ PNVNET_ADAPTER Adapter)
Definition: nic.c:675
VOID NvNetSetupMacAddress(_In_ PNVNET_ADAPTER Adapter, _In_reads_bytes_(ETH_LENGTH_OF_ADDRESS) PUCHAR MacAddress)
Definition: nic.c:622
NDIS_STATUS NvNetInitNIC(_In_ PNVNET_ADAPTER Adapter, _In_ BOOLEAN InitPhy)
Definition: nic.c:401
NDIS_STATUS NvNetGetPermanentMacAddress(_Inout_ PNVNET_ADAPTER Adapter, _Out_writes_bytes_all_(ETH_LENGTH_OF_ADDRESS) PUCHAR MacAddress)
Definition: nic.c:541
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define UNREACHABLE
enum _NDIS_MEDIUM * PNDIS_MEDIUM
@ NdisMedium802_3
Definition: ntddndis.h:191
int NDIS_STATUS
Definition: ntddndis.h:496
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define NVREG_IRQSTAT_MASK
Definition: nic.h:53
#define DEV_HAS_LARGEDESC
Definition: nic.h:20
#define NVREG_MIISTAT_MASK_ALL
Definition: nic.h:229
#define NV_RX_AVAIL
Definition: nic.h:418
#define NV_RX2_AVAIL
Definition: nic.h:437
#define DEV_HAS_HIGH_DMA
Definition: nic.h:21
struct _NVNET_DESCRIPTOR_32 NVNET_DESCRIPTOR_32
struct _NVNET_DESCRIPTOR_64 NVNET_DESCRIPTOR_64
@ NvRegIrqStatus
Definition: nic.h:51
@ NvRegMIIStatus
Definition: nic.h:225
VOID NvNetStartAdapter(_In_ PNVNET_ADAPTER Adapter)
Definition: nvnet.c:74
#define NVNET_RECEIVE_DESCRIPTORS
Definition: nvnet.h:34
#define NVNET_TRANSMIT_BLOCKS
Definition: nvnet.h:31
NVNET_PROCESS_TRANSMIT ProcessTransmitDescriptorsLegacy
Definition: nvnet.h:392
NVNET_PROCESS_TRANSMIT ProcessTransmitDescriptors64
Definition: nvnet.h:394
NVNET_TRANSMIT_PACKET NvNetTransmitPacket64
Definition: nvnet.h:391
#define NVNET_ALIGNMENT
Definition: nvnet.h:37
@ NV_OPTIMIZATION_MODE_DYNAMIC
Definition: nvnet.h:80
@ NV_OPTIMIZATION_MODE_THROUGHPUT
Definition: nvnet.h:82
#define NVNET_MAXIMUM_FRAME_SIZE
Definition: nvnet.h:60
#define NvNetDisableInterrupts(Adapter)
Definition: nvnet.h:666
#define NV_PACKET_PRIORITY
Definition: nvnet.h:298
@ NV_FLOW_CONTROL_AUTO
Definition: nvnet.h:91
@ NV_FLOW_CONTROL_DISABLE
Definition: nvnet.h:87
@ NV_FLOW_CONTROL_RX_TX
Definition: nvnet.h:90
#define NvNetLogError(Adapter, ErrorCode)
Definition: nvnet.h:387
struct _NVNET_ADAPTER NVNET_ADAPTER
Definition: nvnet.h:259
#define NV_SEND_LARGE_SEND
Definition: nvnet.h:288
#define NVNET_RECEIVE_BUFFER_SIZE
Definition: nvnet.h:39
NVNET_PROCESS_TRANSMIT ProcessTransmitDescriptors32
Definition: nvnet.h:393
#define NV_SEND_CHECKSUM
Definition: nvnet.h:287
#define NV_VLAN_TAGGING
Definition: nvnet.h:299
#define NV_FORCE_SPEED_AND_DUPLEX
Definition: nvnet.h:295
#define NVNET_MAXIMUM_FRAME_SIZE_JUMBO
Definition: nvnet.h:61
#define NV_FORCE_FULL_DUPLEX
Definition: nvnet.h:296
#define NV_USE_SOFT_MAC_ADDRESS
Definition: nvnet.h:294
#define NVNET_MAXIMUM_VLAN_ID
Definition: nvnet.h:62
NVNET_TRANSMIT_PACKET NvNetTransmitPacket32
Definition: nvnet.h:390
FORCEINLINE VOID NV_WRITE(_In_ PNVNET_ADAPTER Adapter, _In_ NVNET_REGISTER Register, _In_ ULONG Value)
Definition: nvnet.h:646
#define NVNET_TRANSMIT_DESCRIPTORS
Definition: nvnet.h:32
#define NVNET_TAG
Definition: nvnet.h:22
#define NV_USER_SPEED_100
Definition: nvnet.h:297
#define NVNET_TRANSMIT_BUFFERS
Definition: nvnet.h:33
#define CmResourceTypeMemory
Definition: restypes.h:106
#define CmResourceTypeInterrupt
Definition: restypes.h:105
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: restypes.h:100
union _NDIS_CONFIGURATION_PARAMETER::@2548 ParameterData
UCHAR PermanentMacAddress[ETH_LENGTH_OF_ADDRESS]
Definition: nvnet.h:338
PNVNET_TRANSMIT_PACKET TransmitPacket
Definition: nvnet.h:316
ULONG Features
Definition: nvnet.h:284
ULONG Flags
Definition: nvnet.h:285
ULONG InterruptLevel
Definition: nvnet.h:371
PVOID AdapterOriginal
Definition: nvnet.h:381
NDIS_MINIPORT_INTERRUPT Interrupt
Definition: nvnet.h:369
ULONG InterruptVector
Definition: nvnet.h:370
NDIS_HANDLE AdapterHandle
Definition: nvnet.h:283
UCHAR CurrentMacAddress[ETH_LENGTH_OF_ADDRESS]
Definition: nvnet.h:339
NDIS_HANDLE WrapperConfigurationHandle
Definition: nvnet.h:351
PNVNET_PROCESS_TRANSMIT ProcessTransmit
Definition: nvnet.h:317
ULONG FlagsLength
Definition: nic.h:357
ULONG AddressHigh
Definition: nic.h:362
ULONG AddressLow
Definition: nic.h:363
ULONG FlagsLength
Definition: nic.h:365
NDIS_PHYSICAL_ADDRESS PhysicalAddress
Definition: nvnet.h:187
PVOID VirtualAddress
Definition: nvnet.h:186
PVOID VirtualAddress
Definition: nvnet.h:193
NDIS_PHYSICAL_ADDRESS PhysicalAddress
Definition: nvnet.h:194
SINGLE_LIST_ENTRY Link
Definition: nvnet.h:192
_In_ SIZE_T DescriptorSize
Definition: nls.c:40
uint32_t * PULONG
Definition: typedefs.h:59
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define NTAPI
Definition: typedefs.h:36
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define ALIGN_UP_POINTER_BY(ptr, align)
Definition: umtypes.h:85
LONGLONG QuadPart
Definition: typedefs.h:114
PVOID Memory
Definition: nvnet.h:201
PNVNET_DESCRIPTOR_32 x32
Definition: nvnet.h:199
PNVNET_DESCRIPTOR_64 x64
Definition: nvnet.h:200
Definition: nvnet.h:222
PNVNET_DESCRIPTOR_32 x32
Definition: nvnet.h:223
PNVNET_DESCRIPTOR_64 x64
Definition: nvnet.h:224
UCHAR DefaultValue
Definition: via.c:137
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
@ CmResourceShareShared
Definition: cmtypes.h:243
FORCEINLINE VOID PushEntryList(_Inout_ PSINGLE_LIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PSINGLE_LIST_ENTRY Entry)
Definition: rtlfuncs.h:256
#define ETH_IS_BROADCAST(Address)
Definition: xfilter.h:32
#define ETH_IS_MULTICAST(Address)
Definition: xfilter.h:37
#define ETH_COPY_NETWORK_ADDRESS(_D, _S)
Definition: xfilter.h:77