ReactOS 0.4.17-dev-573-g8315b8c
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"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 Adapter->VlanId = GenericUlong;
179
182 &Length,
185 {
188 {
189 NDIS_DbgPrint(MAX_TRACE, ("Invalid software MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
195 NetworkAddress[5]));
196 }
197 else
198 {
199 NDIS_DbgPrint(MIN_TRACE, ("Using software MAC\n"));
200
201 ETH_COPY_NETWORK_ADDRESS(Adapter->CurrentMacAddress, NetworkAddress);
202
203 Adapter->Flags |= NV_USE_SOFT_MAC_ADDRESS;
204 }
205 }
207
209
210 return Status;
211}
212
213static
214CODE_SEG("PAGE")
217 _Inout_ PNVNET_ADAPTER Adapter)
218{
220 PNDIS_RESOURCE_LIST AssignedResources = NULL;
221 UINT i, ResourceListSize = 0;
222
223 PAGED_CODE();
224
225 NDIS_DbgPrint(MIN_TRACE, ("()\n"));
226
228 Adapter->WrapperConfigurationHandle,
229 AssignedResources,
230 &ResourceListSize);
232 {
234 return NDIS_STATUS_FAILURE;
235 }
236
237 Status = NdisAllocateMemoryWithTag((PVOID*)&AssignedResources,
238 ResourceListSize,
239 NVNET_TAG);
241 {
243 return Status;
244 }
245
247 Adapter->WrapperConfigurationHandle,
248 AssignedResources,
249 &ResourceListSize);
251 {
253 goto Cleanup;
254 }
255
256 for (i = 0; i < AssignedResources->Count; ++i)
257 {
259
260 switch (Descriptor->Type)
261 {
263 {
264 Adapter->IoAddress = Descriptor->u.Memory.Start;
265 Adapter->IoLength = Descriptor->u.Memory.Length;
266 break;
267 }
268
270 {
271 Adapter->InterruptVector = Descriptor->u.Interrupt.Vector;
272 Adapter->InterruptLevel = Descriptor->u.Interrupt.Level;
273 Adapter->InterruptShared = (Descriptor->ShareDisposition == CmResourceShareShared);
274 Adapter->InterruptFlags = Descriptor->Flags;
275 break;
276 }
277
278 default:
279 break;
280 }
281 }
282
283 if (!Adapter->IoAddress.QuadPart || !Adapter->InterruptVector)
284 {
287 goto Cleanup;
288 }
289
290 NDIS_DbgPrint(MIN_TRACE, ("MEM at [%I64X-%I64X]\n",
291 Adapter->IoAddress.QuadPart,
292 Adapter->IoAddress.QuadPart + Adapter->IoLength));
293 NDIS_DbgPrint(MIN_TRACE, ("IRQ Vector %d Level %d\n",
294 Adapter->InterruptVector,
295 Adapter->InterruptLevel));
296
297 Status = NdisMMapIoSpace((PVOID*)&Adapter->IoBase,
298 Adapter->AdapterHandle,
299 Adapter->IoAddress,
300 Adapter->IoLength);
302 {
304 goto Cleanup;
305 }
306
307Cleanup:
308 NdisFreeMemory(AssignedResources, ResourceListSize, 0);
309
310 return Status;
311}
312
313static
314CODE_SEG("PAGE")
317 _In_ PNVNET_ADAPTER Adapter)
318{
319 ULONG i;
320 BOOLEAN HasBuffer = FALSE;
321 PNVNET_TX_BUFFER CoalesceBuffer;
323
324 PAGED_CODE();
325
326 Status = NdisAllocateMemoryWithTag((PVOID*)&CoalesceBuffer,
328 NVNET_TAG);
330 return Status;
331
332 NdisZeroMemory(CoalesceBuffer, NVNET_TRANSMIT_BUFFERS * sizeof(NVNET_TX_BUFFER));
333
334 Adapter->SendBuffer = CoalesceBuffer;
335
336 for (i = 0; i < NVNET_TRANSMIT_BUFFERS; ++i)
337 {
340
341 NdisMAllocateSharedMemory(Adapter->AdapterHandle,
342 Adapter->MaximumFrameSize + NVNET_ALIGNMENT,
343 TRUE, /* Cached */
346 if (!VirtualAddress)
347 continue;
348
350 CoalesceBuffer->PhysicalAddress.QuadPart =
352
353 Adapter->SendBufferAllocationData[i].PhysicalAddress.QuadPart = PhysicalAddress.QuadPart;
354 Adapter->SendBufferAllocationData[i].VirtualAddress = VirtualAddress;
355
356 PushEntryList(&Adapter->Send.BufferList, &CoalesceBuffer->Link);
357 ++CoalesceBuffer;
358
359 HasBuffer = TRUE;
360 }
361 if (!HasBuffer)
362 {
364 }
365
366 return NDIS_STATUS_SUCCESS;
367}
368
369static
370CODE_SEG("PAGE")
373 _In_ PNVNET_ADAPTER Adapter)
374{
375 PNVNET_TCB Tcb;
377
378 PAGED_CODE();
379
382 NVNET_TAG);
384 return Status;
385
387
388 Adapter->Send.TailTcb = Tcb + (NVNET_TRANSMIT_BLOCKS - 1);
389 Adapter->Send.HeadTcb = Tcb;
390 Adapter->Send.CurrentTcb = Tcb;
391 Adapter->Send.LastTcb = Tcb;
392
393 return NDIS_STATUS_SUCCESS;
394}
395
396static
397CODE_SEG("PAGE")
400 _In_ PNVNET_ADAPTER Adapter)
401{
402 NVNET_TBD Tbd;
403 ULONG Size;
404
405 PAGED_CODE();
406
407 if (Adapter->Features & DEV_HAS_HIGH_DMA)
408 {
409 Size = sizeof(NVNET_DESCRIPTOR_64);
410 }
411 else
412 {
413 Size = sizeof(NVNET_DESCRIPTOR_32);
414 }
415 NdisMAllocateSharedMemory(Adapter->AdapterHandle,
417 TRUE, /* Cached */
418 &Adapter->TbdOriginal,
419 &Adapter->TbdPhysOriginal);
420 if (!Adapter->TbdOriginal)
422
423 Tbd.Memory = ALIGN_UP_POINTER_BY(Adapter->TbdOriginal, NVNET_ALIGNMENT);
424 Adapter->TbdPhys.QuadPart = ALIGN_UP_BY(Adapter->TbdPhysOriginal.QuadPart, NVNET_ALIGNMENT);
425
426 Adapter->Send.HeadTbd = Tbd;
427 Adapter->Send.CurrentTbd = Tbd;
428
429 if (Adapter->Features & DEV_HAS_HIGH_DMA)
430 {
431 Adapter->Send.TailTbd.x64 = Tbd.x64 + (NVNET_TRANSMIT_DESCRIPTORS - 1);
432 }
433 else
434 {
435 Adapter->Send.TailTbd.x32 = Tbd.x32 + (NVNET_TRANSMIT_DESCRIPTORS - 1);
436 }
437
438 return NDIS_STATUS_SUCCESS;
439}
440
441static
442CODE_SEG("PAGE")
445 _In_ PNVNET_ADAPTER Adapter)
446{
447 ULONG Size;
448
449 PAGED_CODE();
450
451 if (Adapter->Features & DEV_HAS_HIGH_DMA)
452 {
453 Size = sizeof(NVNET_DESCRIPTOR_64);
454 }
455 else
456 {
457 Size = sizeof(NVNET_DESCRIPTOR_32);
458 }
459 NdisMAllocateSharedMemory(Adapter->AdapterHandle,
461 TRUE, /* Cached */
462 &Adapter->RbdOriginal,
463 &Adapter->RbdPhysOriginal);
464 if (!Adapter->RbdOriginal)
466
467 Adapter->Receive.NvRbd.Memory = ALIGN_UP_POINTER_BY(Adapter->RbdOriginal, NVNET_ALIGNMENT);
468 Adapter->RbdPhys.QuadPart = ALIGN_UP_BY(Adapter->RbdPhysOriginal.QuadPart, NVNET_ALIGNMENT);
469
470 return NDIS_STATUS_SUCCESS;
471}
472
473static
474CODE_SEG("PAGE")
477 _In_ PNVNET_ADAPTER Adapter)
478{
479 PAGED_CODE();
480
481 NdisMAllocateSharedMemory(Adapter->AdapterHandle,
483 TRUE, /* Cached */
484 (PVOID*)&Adapter->ReceiveBuffer,
485 &Adapter->ReceiveBufferPhys);
486 if (!Adapter->ReceiveBuffer)
487 {
489 }
490
491 return NDIS_STATUS_SUCCESS;
492}
493
494static
495CODE_SEG("PAGE")
498 _In_ PNVNET_ADAPTER Adapter)
499{
501
502 PAGED_CODE();
503
506 return Status;
507
510 return Status;
511
514 return Status;
515
518 return Status;
519
522 return Status;
523
524 NdisAllocateSpinLock(&Adapter->Send.Lock);
525 NdisAllocateSpinLock(&Adapter->Receive.Lock);
526 NdisAllocateSpinLock(&Adapter->Lock);
527
528 return NDIS_STATUS_SUCCESS;
529}
530
531CODE_SEG("PAGE")
532VOID
534 _In_ PNVNET_ADAPTER Adapter)
535{
536 PAGED_CODE();
537
538 Adapter->Send.TcbSlots = NVNET_TRANSMIT_BLOCKS;
539 Adapter->Send.TbdSlots = NVNET_TRANSMIT_DESCRIPTORS;
540
541 if (Adapter->Features & DEV_HAS_HIGH_DMA)
542 {
543 NdisZeroMemory(Adapter->Send.HeadTbd.x64,
545 }
546 else
547 {
548 NdisZeroMemory(Adapter->Send.HeadTbd.x32,
550 }
551}
552
553static
554CODE_SEG("PAGE")
555VOID
557 _In_ PNVNET_ADAPTER Adapter)
558{
559 NV_RBD NvRbd;
560 ULONG i;
561
562 PAGED_CODE();
563
564 Adapter->CurrentRx = 0;
565
566 if (Adapter->Features & DEV_HAS_HIGH_DMA)
567 {
568 for (i = 0; i < NVNET_RECEIVE_DESCRIPTORS; ++i)
569 {
570 NvRbd.x64 = &Adapter->Receive.NvRbd.x64[i];
571
572 NvRbd.x64->AddressHigh = NdisGetPhysicalAddressHigh(Adapter->ReceiveBufferPhys)
574 NvRbd.x64->AddressLow = NdisGetPhysicalAddressLow(Adapter->ReceiveBufferPhys)
576 NvRbd.x64->VlanTag = 0;
578 }
579 }
580 else
581 {
582 for (i = 0; i < NVNET_RECEIVE_DESCRIPTORS; ++i)
583 {
584 NvRbd.x32 = &Adapter->Receive.NvRbd.x32[i];
585
586 NvRbd.x32->Address = NdisGetPhysicalAddressLow(Adapter->ReceiveBufferPhys)
589 }
590 }
591}
592
593
594CODE_SEG("PAGE")
595VOID
597 _In_ PNVNET_ADAPTER Adapter)
598{
599 ULONG i;
601
602 PAGED_CODE();
603
604 NDIS_DbgPrint(MIN_TRACE, ("()\n"));
605
606 for (i = 0; i < RTL_NUMBER_OF(Adapter->WakeFrames); ++i)
607 {
608 PNVNET_WAKE_FRAME WakeFrame = Adapter->WakeFrames[i];
609
610 if (!WakeFrame)
611 continue;
612
613 NdisFreeMemory(WakeFrame, sizeof(*WakeFrame), 0);
614 }
615
616 if (Adapter->Interrupt.InterruptObject)
617 {
618 NdisMDeregisterInterrupt(&Adapter->Interrupt);
619 Adapter->Interrupt.InterruptObject = NULL;
620 }
621
622 if (Adapter->Features & DEV_HAS_HIGH_DMA)
623 {
625 }
626 else
627 {
629 }
630 if (Adapter->TbdOriginal)
631 {
632 NdisMFreeSharedMemory(Adapter->AdapterHandle,
634 FALSE,
635 Adapter->TbdOriginal,
636 Adapter->TbdPhysOriginal);
637 Adapter->TbdOriginal = NULL;
638 }
639 if (Adapter->RbdOriginal)
640 {
641 NdisMFreeSharedMemory(Adapter->AdapterHandle,
643 FALSE,
644 Adapter->RbdOriginal,
645 Adapter->RbdPhysOriginal);
646 Adapter->RbdOriginal = NULL;
647 }
648 if (Adapter->SendBuffer)
649 {
650 ULONG Length = ALIGN_UP_BY(Adapter->MaximumFrameSize, NVNET_ALIGNMENT);
651
652 for (i = 0; i < NVNET_TRANSMIT_BUFFERS; ++i)
653 {
654 PNVNET_TX_BUFFER_DATA SendBufferData = &Adapter->SendBufferAllocationData[i];
655
656 if (!SendBufferData->VirtualAddress)
657 continue;
658
659 NdisMFreeSharedMemory(Adapter->AdapterHandle,
660 Length,
661 TRUE,
662 SendBufferData->VirtualAddress,
663 SendBufferData->PhysicalAddress);
664 }
665
666 NdisFreeMemory(Adapter->SendBuffer, NVNET_TRANSMIT_BUFFERS * sizeof(NVNET_TX_BUFFER), 0);
667 Adapter->SendBuffer = NULL;
668 }
669
670 if (Adapter->ReceiveBuffer)
671 {
672 NdisMFreeSharedMemory(Adapter->AdapterHandle,
674 FALSE,
675 Adapter->ReceiveBuffer,
676 Adapter->ReceiveBufferPhys);
677 Adapter->ReceiveBuffer = NULL;
678 }
679
680 if (Adapter->IoBase)
681 {
682 NdisMUnmapIoSpace(Adapter->AdapterHandle,
683 Adapter->IoBase,
684 Adapter->IoLength);
685 Adapter->IoBase = NULL;
686 }
687
688 if (Adapter->Lock.SpinLock)
689 NdisFreeSpinLock(&Adapter->Lock);
690 if (Adapter->Send.Lock.SpinLock)
691 NdisFreeSpinLock(&Adapter->Send.Lock);
692 if (Adapter->Receive.Lock.SpinLock)
693 NdisFreeSpinLock(&Adapter->Receive.Lock);
694
695 NdisFreeMemory(Adapter->AdapterOriginal, sizeof(NVNET_ADAPTER), 0);
696}
697
698CODE_SEG("PAGE")
700NTAPI
704 _In_ PNDIS_MEDIUM MediumArray,
708{
709 UINT i;
710 ULONG Size;
711 PVOID UnalignedAdapter;
712 PNVNET_ADAPTER Adapter;
714
715 PAGED_CODE();
716
717 NDIS_DbgPrint(MIN_TRACE, ("()\n"));
718
719 for (i = 0; i < MediumArraySize; ++i)
720 {
721 if (MediumArray[i] == NdisMedium802_3)
722 {
724 break;
725 }
726 }
727 if (i == MediumArraySize)
728 {
729 NDIS_DbgPrint(MAX_TRACE, ("No supported media\n"));
731 }
732
734
735 Status = NdisAllocateMemoryWithTag((PVOID*)&UnalignedAdapter,
736 Size,
737 NVNET_TAG);
739 {
740 NDIS_DbgPrint(MAX_TRACE, ("Failed to allocate adapter\n"));
742 }
743
744 NdisZeroMemory(UnalignedAdapter, Size);
745 Adapter = ALIGN_UP_POINTER_BY(UnalignedAdapter, NdisGetSharedDataAlignment());
746 Adapter->AdapterOriginal = UnalignedAdapter;
749
752 {
753 goto Failure;
754 }
755
757 Adapter,
758 0,
760 // NDIS_ATTRIBUTE_DESERIALIZE | TODO
763
766 {
768 {
770 }
772 {
774 }
775
776 goto Failure;
777 }
778
781 {
782 goto Failure;
783 }
784
786 !!(Adapter->Features & DEV_HAS_HIGH_DMA),
788 // ^TODO: NVNET_MAX_DMA_TRANSFER);
790 {
792 goto Failure;
793 }
794
795 Status = AllocateAdapterMemory(Adapter);
797 {
798 NDIS_DbgPrint(MAX_TRACE, ("Failed to allocate adapter memory\n"));
799
801 goto Failure;
802 }
803
805 NvNetInitReceiveMemory(Adapter);
806
807 if (Adapter->Features & DEV_HAS_HIGH_DMA)
808 {
811 }
812 else
813 {
815
816 if (Adapter->Features & DEV_HAS_LARGEDESC)
817 {
819 }
820 else
821 {
823 }
824 }
825
828 {
830 goto Failure;
831 }
832
833 if (!(Adapter->Flags & NV_USE_SOFT_MAC_ADDRESS))
834 {
836 Adapter->PermanentMacAddress);
837 }
838
839 NvNetSetupMacAddress(Adapter, Adapter->CurrentMacAddress);
840
841 Status = NvNetInitNIC(Adapter, TRUE);
843 {
844 NDIS_DbgPrint(MAX_TRACE, ("Failed to initialize the NIC\n"));
845
847 goto Failure;
848 }
849
850 NvNetDisableInterrupts(Adapter);
853
854/* FIXME: Bug in the PIC HAL? */
855#if defined(SARCH_XBOX)
857 Adapter->AdapterHandle,
858 Adapter->InterruptVector,
859 Adapter->InterruptLevel,
860 TRUE, /* Request ISR calls */
861 FALSE,
863#else
865 Adapter->AdapterHandle,
866 Adapter->InterruptVector,
867 Adapter->InterruptLevel,
868 TRUE, /* Request ISR calls */
869 TRUE, /* Shared */
871#endif
873 {
875 goto Failure;
876 }
877
878 NvNetStartAdapter(Adapter);
879
880 return NDIS_STATUS_SUCCESS;
881
882Failure:
883 NvNetFreeAdapter(Adapter);
884
885 return Status;
886}
#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
#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:497
VOID NvNetFreeAdapter(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:596
static VOID NvNetInitReceiveMemory(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:556
VOID NvNetInitTransmitMemory(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:533
static NDIS_STATUS AllocateReceiveBuffers(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:476
static NDIS_STATUS AllocateReceiveDescriptors(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:444
static NDIS_STATUS AllocateTransmitDescriptors(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:399
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:316
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:701
static NDIS_STATUS NvNetInitializeAdapterResources(_Inout_ PNVNET_ADAPTER Adapter)
Definition: init.c:216
static NDIS_STATUS AllocateTransmitBlocks(_In_ PNVNET_ADAPTER Adapter)
Definition: init.c:372
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
_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:4210
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
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:88
@ NV_FLOW_CONTROL_DISABLE
Definition: nvnet.h:87
@ NV_FLOW_CONTROL_RX_TX
Definition: nvnet.h:91
#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::@2325 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_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
@ CmResourceShareShared
Definition: cmtypes.h:243
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
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