mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Start removing dead code and ReactOS specific structure fields (the NDIS structures are official, documented and contain all we need).
svn path=/trunk/; revision=17497
This commit is contained in:
parent
f68e4fcc28
commit
82af9fdaa8
9 changed files with 191 additions and 268 deletions
|
@ -14,7 +14,6 @@
|
|||
#define MID_TRACE 0x00000002
|
||||
#define MAX_TRACE 0x00000003
|
||||
|
||||
#define DEBUG_REFCOUNT 0x00000100
|
||||
#define DEBUG_MINIPORT 0x00000200
|
||||
#define DEBUG_PROTOCOL 0x00000400
|
||||
#define DEBUG_PACKET 0x00000800
|
||||
|
|
|
@ -19,16 +19,15 @@ typedef struct _HARDWARE_ADDRESS {
|
|||
} HARDWARE_ADDRESS, *PHARDWARE_ADDRESS;
|
||||
|
||||
/* Information about a miniport */
|
||||
typedef struct _MINIPORT_DRIVER {
|
||||
LIST_ENTRY ListEntry; /* Entry on global list */
|
||||
KSPIN_LOCK Lock; /* Protecting spin lock */
|
||||
ULONG RefCount; /* Reference count */
|
||||
NDIS_MINIPORT_CHARACTERISTICS Chars; /* Miniport characteristics */
|
||||
WORK_QUEUE_ITEM WorkItem; /* Work item */
|
||||
PDRIVER_OBJECT DriverObject; /* Driver object of miniport */
|
||||
LIST_ENTRY AdapterListHead; /* Adapters created by miniport */
|
||||
PUNICODE_STRING RegistryPath; /* SCM Registry key */
|
||||
} MINIPORT_DRIVER, *PMINIPORT_DRIVER;
|
||||
typedef struct _NDIS_M_DRIVER_BLOCK {
|
||||
LIST_ENTRY ListEntry; /* Entry on global list */
|
||||
KSPIN_LOCK Lock; /* Protecting spin lock */
|
||||
NDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics; /* Miniport characteristics */
|
||||
WORK_QUEUE_ITEM WorkItem; /* Work item */
|
||||
PDRIVER_OBJECT DriverObject; /* Driver object of miniport */
|
||||
LIST_ENTRY DeviceList; /* Adapters created by miniport */
|
||||
PUNICODE_STRING RegistryPath; /* SCM Registry key */
|
||||
} NDIS_M_DRIVER_BLOCK, *PNDIS_M_DRIVER_BLOCK;
|
||||
|
||||
/* resources allocated on behalf on the miniport */
|
||||
#define MINIPORT_RESOURCE_TYPE_MEMORY 0
|
||||
|
@ -69,25 +68,18 @@ typedef struct _NDIS_WRAPPER_CONTEXT {
|
|||
ULONG BusNumber;
|
||||
} NDIS_WRAPPER_CONTEXT, *PNDIS_WRAPPER_CONTEXT;
|
||||
|
||||
#define GET_MINIPORT_DRIVER(Handle)((PMINIPORT_DRIVER)Handle)
|
||||
#define GET_MINIPORT_DRIVER(Handle)((PNDIS_M_DRIVER_BLOCK)Handle)
|
||||
|
||||
/* Information about a logical adapter */
|
||||
typedef struct _LOGICAL_ADAPTER
|
||||
{
|
||||
NDIS_MINIPORT_BLOCK NdisMiniportBlock; /* NDIS defined fields */
|
||||
KDPC MiniportDpc; /* DPC routine for adapter */
|
||||
BOOLEAN MiniportBusy; /* A MiniportXxx routine is executing */
|
||||
ULONG WorkQueueLevel; /* Number of used work item buffers */
|
||||
INTERNAL_NDIS_MINIPORT_WORK_ITEM WorkQueue[NDIS_MINIPORT_WORK_QUEUE_SIZE];
|
||||
PINTERNAL_NDIS_MINIPORT_WORK_ITEM WorkQueueHead; /* Head of work queue */
|
||||
PINTERNAL_NDIS_MINIPORT_WORK_ITEM WorkQueueTail; /* Tail of work queue */
|
||||
PNDIS_MINIPORT_WORK_ITEM WorkQueueHead; /* Head of work queue */
|
||||
PNDIS_MINIPORT_WORK_ITEM WorkQueueTail; /* Tail of work queue */
|
||||
LIST_ENTRY ListEntry; /* Entry on global list */
|
||||
LIST_ENTRY MiniportListEntry; /* Entry on miniport driver list */
|
||||
LIST_ENTRY ProtocolListHead; /* List of bound protocols */
|
||||
ULONG RefCount; /* Reference count */
|
||||
PMINIPORT_DRIVER Miniport; /* Miniport owning this adapter */
|
||||
ULONG Attributes; /* Attributes of adapter */
|
||||
BOOLEAN AttributesSet; /* Whether NdisMSetAttributes(Ex) has been called */
|
||||
PVOID QueryBuffer; /* Buffer to use for queries */
|
||||
ULONG QueryBufferLength; /* Length of QueryBuffer */
|
||||
ULONG MediumHeaderSize; /* Size of medium header */
|
||||
|
@ -95,12 +87,7 @@ typedef struct _LOGICAL_ADAPTER
|
|||
ULONG AddressLength; /* Length of hardware address */
|
||||
PUCHAR LookaheadBuffer; /* Pointer to lookahead buffer */
|
||||
ULONG LookaheadLength; /* Length of lookahead buffer */
|
||||
PNDIS_PACKET PacketQueueHead; /* Head of packet queue */
|
||||
PNDIS_PACKET PacketQueueTail; /* Head of packet queue */
|
||||
PNDIS_PACKET LoopPacket; /* Current packet beeing looped */
|
||||
PMINIPORT_BUGCHECK_CONTEXT BugcheckContext; /* Adapter's shutdown handler */
|
||||
KEVENT DmaEvent; /* Event to support DMA register allocation */
|
||||
KSPIN_LOCK DmaLock; /* Spinlock to protect the dma list */
|
||||
} LOGICAL_ADAPTER, *PLOGICAL_ADAPTER;
|
||||
|
||||
#define GET_LOGICAL_ADAPTER(Handle)((PLOGICAL_ADAPTER)Handle)
|
||||
|
@ -146,7 +133,7 @@ MiniQueryInformation(
|
|||
NDIS_STATUS
|
||||
FASTCALL
|
||||
MiniQueueWorkItem(
|
||||
struct _ADAPTER_BINDING *AdapterBinding,
|
||||
PLOGICAL_ADAPTER Adapter,
|
||||
NDIS_WORK_ITEM_TYPE WorkItemType,
|
||||
PVOID WorkItemContext);
|
||||
|
||||
|
@ -154,13 +141,12 @@ NDIS_STATUS
|
|||
FASTCALL
|
||||
MiniDequeueWorkItem(
|
||||
PLOGICAL_ADAPTER Adapter,
|
||||
struct _ADAPTER_BINDING **AdapterBinding,
|
||||
NDIS_WORK_ITEM_TYPE *WorkItemType,
|
||||
PVOID *WorkItemContext);
|
||||
|
||||
NDIS_STATUS
|
||||
MiniDoRequest(
|
||||
struct _ADAPTER_BINDING *AdapterBinding,
|
||||
PNDIS_MINIPORT_BLOCK Adapter,
|
||||
PNDIS_REQUEST NdisRequest);
|
||||
|
||||
BOOLEAN
|
||||
|
|
|
@ -30,16 +30,8 @@ NTSTATUS NTAPI ZwDuplicateObject(IN HANDLE, IN HANDLE, IN HANDLE, OUT PHANDLE, I
|
|||
#include <ndk/ntndk.h>
|
||||
#endif
|
||||
|
||||
#define NDIS_MINIPORT_WORK_QUEUE_SIZE 10
|
||||
|
||||
struct _ADAPTER_BINDING;
|
||||
|
||||
typedef struct _INTERNAL_NDIS_MINIPORT_WORK_ITEM {
|
||||
SINGLE_LIST_ENTRY Link;
|
||||
struct _ADAPTER_BINDING *AdapterBinding;
|
||||
NDIS_MINIPORT_WORK_ITEM RealWorkItem;
|
||||
} INTERNAL_NDIS_MINIPORT_WORK_ITEM, *PINTERNAL_NDIS_MINIPORT_WORK_ITEM;
|
||||
|
||||
typedef struct _NDISI_PACKET_POOL {
|
||||
NDIS_SPIN_LOCK SpinLock;
|
||||
struct _NDIS_PACKET *FreeList;
|
||||
|
@ -60,50 +52,6 @@ typedef struct _NDISI_PACKET_POOL {
|
|||
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
|
||||
#define NDIS_TAG 0x4e4d4953
|
||||
|
||||
#ifdef DBG
|
||||
|
||||
#define DEBUG_REFCHECK(Object) { \
|
||||
if ((Object)->RefCount <= 0) { \
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Object at (0x%X) has invalid reference count (%d).\n", \
|
||||
(Object), (Object)->RefCount)); \
|
||||
} \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define DEBUG_REFCHECK(Object)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* VOID ReferenceObject(
|
||||
* PVOID Object)
|
||||
*/
|
||||
#define ReferenceObject(Object) \
|
||||
{ \
|
||||
DEBUG_REFCHECK(Object); \
|
||||
NDIS_DbgPrint(DEBUG_REFCOUNT, ("Referencing object at (0x%X). RefCount (%d).\n", \
|
||||
(Object), (Object)->RefCount)); \
|
||||
\
|
||||
InterlockedIncrement((PLONG)&((Object)->RefCount)); \
|
||||
}
|
||||
|
||||
/*
|
||||
* VOID DereferenceObject(
|
||||
* PVOID Object)
|
||||
*/
|
||||
#define DereferenceObject(Object) \
|
||||
{ \
|
||||
DEBUG_REFCHECK(Object); \
|
||||
NDIS_DbgPrint(DEBUG_REFCOUNT, ("Dereferencing object at (0x%X). RefCount (%d).\n", \
|
||||
(Object), (Object)->RefCount)); \
|
||||
\
|
||||
if (InterlockedDecrement((PLONG)&((Object)->RefCount)) == 0) \
|
||||
PoolFreeBuffer(Object); \
|
||||
}
|
||||
|
||||
|
||||
#define MIN(value1, value2) \
|
||||
((value1 < value2)? value1 : value2)
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
typedef struct _PROTOCOL_BINDING {
|
||||
LIST_ENTRY ListEntry; /* Entry on global list */
|
||||
KSPIN_LOCK Lock; /* Protecting spin lock */
|
||||
ULONG RefCount; /* Reference count */
|
||||
NDIS_PROTOCOL_CHARACTERISTICS Chars; /* Characteristics */
|
||||
WORK_QUEUE_ITEM WorkItem; /* Work item */
|
||||
LIST_ENTRY AdapterListHead; /* List of adapter bindings */
|
||||
|
@ -27,11 +26,17 @@ typedef struct _ADAPTER_BINDING {
|
|||
LIST_ENTRY ProtocolListEntry; /* Entry on protocol binding adapter list */
|
||||
LIST_ENTRY AdapterListEntry; /* Entry on logical adapter list */
|
||||
KSPIN_LOCK Lock; /* Protecting spin lock */
|
||||
ULONG RefCount; /* Reference count */
|
||||
PPROTOCOL_BINDING ProtocolBinding; /* Protocol that opened adapter */
|
||||
PLOGICAL_ADAPTER Adapter; /* Adapter opened by protocol */
|
||||
} ADAPTER_BINDING, *PADAPTER_BINDING;
|
||||
|
||||
typedef struct _NDIS_REQUEST_MAC_BLOCK {
|
||||
PVOID Unknown1;
|
||||
PNDIS_OPEN_BLOCK Binding;
|
||||
PVOID Unknown3;
|
||||
PVOID Unknown4;
|
||||
} NDIS_REQUEST_MAC_BLOCK, *PNDIS_REQUEST_MAC_BLOCK;
|
||||
|
||||
#define GET_ADAPTER_BINDING(Handle)((PADAPTER_BINDING)Handle)
|
||||
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ NdisMPciAssignResources(
|
|||
IN ULONG SlotNumber,
|
||||
OUT PNDIS_RESOURCE_LIST *AssignedResources)
|
||||
{
|
||||
PNDIS_MINIPORT_BLOCK MiniportBlock = &((PLOGICAL_ADAPTER)MiniportHandle)->NdisMiniportBlock;
|
||||
PNDIS_MINIPORT_BLOCK MiniportBlock = (PNDIS_MINIPORT_BLOCK)MiniportHandle;
|
||||
|
||||
if (MiniportBlock->BusType != PCIBus ||
|
||||
MiniportBlock->AllocatedResources == NULL)
|
||||
|
@ -196,11 +196,10 @@ NdisReadPciSlotInformation(
|
|||
IN PVOID Buffer,
|
||||
IN ULONG Length)
|
||||
{
|
||||
PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)NdisAdapterHandle;
|
||||
PNDIS_MINIPORT_BLOCK Adapter = (PNDIS_MINIPORT_BLOCK)NdisAdapterHandle;
|
||||
/* Slot number is ignored since W2K for all NDIS drivers. */
|
||||
return HalGetBusDataByOffset(PCIConfiguration,
|
||||
Adapter->NdisMiniportBlock.BusNumber,
|
||||
Adapter->NdisMiniportBlock.SlotNumber,
|
||||
Adapter->BusNumber, Adapter->SlotNumber,
|
||||
Buffer, Offset, Length);
|
||||
}
|
||||
|
||||
|
@ -217,11 +216,10 @@ NdisWritePciSlotInformation(
|
|||
IN PVOID Buffer,
|
||||
IN ULONG Length)
|
||||
{
|
||||
PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)NdisAdapterHandle;
|
||||
PNDIS_MINIPORT_BLOCK Adapter = (PNDIS_MINIPORT_BLOCK)NdisAdapterHandle;
|
||||
/* Slot number is ignored since W2K for all NDIS drivers. */
|
||||
return HalSetBusDataByOffset(PCIConfiguration,
|
||||
Adapter->NdisMiniportBlock.BusNumber,
|
||||
Adapter->NdisMiniportBlock.SlotNumber,
|
||||
Adapter->BusNumber, Adapter->SlotNumber,
|
||||
Buffer, Offset, Length);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,14 +44,14 @@ VOID NTAPI HandleDeferredProcessing(
|
|||
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
|
||||
/* Call the deferred interrupt service handler for this adapter */
|
||||
(*Adapter->Miniport->Chars.HandleInterruptHandler)(
|
||||
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.HandleInterruptHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext);
|
||||
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
{
|
||||
if ((!WasBusy) && (Adapter->WorkQueueHead))
|
||||
{
|
||||
KeInsertQueueDpc(&Adapter->MiniportDpc, NULL, NULL);
|
||||
KeInsertQueueDpc(&Adapter->NdisMiniportBlock.DeferredDpc, NULL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -62,8 +62,8 @@ VOID NTAPI HandleDeferredProcessing(
|
|||
|
||||
/* re-enable the interrupt */
|
||||
NDIS_DbgPrint(MAX_TRACE, ("re-enabling the interrupt\n"));
|
||||
if(Adapter->Miniport->Chars.EnableInterruptHandler)
|
||||
(*Adapter->Miniport->Chars.EnableInterruptHandler)(
|
||||
if(Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.EnableInterruptHandler)
|
||||
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.EnableInterruptHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext);
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
|
||||
|
@ -84,18 +84,19 @@ BOOLEAN NTAPI ServiceRoutine(
|
|||
{
|
||||
BOOLEAN InterruptRecognized;
|
||||
BOOLEAN QueueMiniportHandleInterrupt;
|
||||
PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(ServiceContext);
|
||||
PNDIS_MINIPORT_BLOCK Adapter = (PNDIS_MINIPORT_BLOCK)ServiceContext;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called. Adapter (0x%X)\n", Adapter));
|
||||
|
||||
(*Adapter->Miniport->Chars.ISRHandler)(&InterruptRecognized,
|
||||
(*Adapter->DriverHandle->MiniportCharacteristics.ISRHandler)(
|
||||
&InterruptRecognized,
|
||||
&QueueMiniportHandleInterrupt,
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext);
|
||||
Adapter->MiniportAdapterContext);
|
||||
|
||||
if (QueueMiniportHandleInterrupt)
|
||||
{
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Queueing DPC.\n"));
|
||||
KeInsertQueueDpc(&Adapter->NdisMiniportBlock.Interrupt->InterruptDpc, NULL, NULL);
|
||||
KeInsertQueueDpc(&Adapter->Interrupt->InterruptDpc, NULL, NULL);
|
||||
}
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
|
||||
|
@ -228,15 +229,15 @@ IO_ALLOCATION_ACTION NTAPI NdisMapRegisterCallback (
|
|||
* - Called at IRQL = DISPATCH_LEVEL
|
||||
*/
|
||||
{
|
||||
PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)Context;
|
||||
PNDIS_MINIPORT_BLOCK Adapter = (PNDIS_MINIPORT_BLOCK)Context;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
Adapter->NdisMiniportBlock.MapRegisters[Adapter->NdisMiniportBlock.CurrentMapRegister].MapRegister = MapRegisterBase;
|
||||
Adapter->MapRegisters[Adapter->CurrentMapRegister].MapRegister = MapRegisterBase;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("setting event and leaving.\n"));
|
||||
|
||||
KeSetEvent(&Adapter->DmaEvent, 0, FALSE);
|
||||
KeSetEvent(Adapter->AllocationEvent, 0, FALSE);
|
||||
|
||||
/* this is only the thing to do for busmaster NICs */
|
||||
return DeallocateObjectKeepRegisters;
|
||||
|
@ -284,33 +285,34 @@ NdisMAllocateMapRegisters(
|
|||
* map registers to 32.
|
||||
*/
|
||||
{
|
||||
DEVICE_DESCRIPTION Description;
|
||||
PDMA_ADAPTER AdapterObject = 0;
|
||||
UINT MapRegistersPerBaseRegister = 0;
|
||||
ULONG AvailableMapRegisters;
|
||||
NTSTATUS NtStatus;
|
||||
PLOGICAL_ADAPTER Adapter = 0;
|
||||
PDEVICE_OBJECT DeviceObject = 0;
|
||||
KIRQL OldIrql;
|
||||
DEVICE_DESCRIPTION Description;
|
||||
PDMA_ADAPTER AdapterObject = 0;
|
||||
UINT MapRegistersPerBaseRegister = 0;
|
||||
ULONG AvailableMapRegisters;
|
||||
NTSTATUS NtStatus;
|
||||
PNDIS_MINIPORT_BLOCK Adapter = 0;
|
||||
PDEVICE_OBJECT DeviceObject = 0;
|
||||
KEVENT AllocationEvent;
|
||||
KIRQL OldIrql;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("called: Handle 0x%x, DmaChannel 0x%x, DmaSize 0x%x, BaseMapRegsNeeded: 0x%x, MaxBuffer: 0x%x.\n",
|
||||
MiniportAdapterHandle, DmaChannel, DmaSize, BaseMapRegistersNeeded, MaximumBufferSize));
|
||||
|
||||
memset(&Description,0,sizeof(Description));
|
||||
|
||||
Adapter = (PLOGICAL_ADAPTER)MiniportAdapterHandle;
|
||||
Adapter = (PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle;
|
||||
|
||||
ASSERT(Adapter);
|
||||
|
||||
/* only bus masters may call this routine */
|
||||
ASSERT(Adapter->NdisMiniportBlock.Flags & NDIS_ATTRIBUTE_BUS_MASTER);
|
||||
if(!(Adapter->NdisMiniportBlock.Flags & NDIS_ATTRIBUTE_BUS_MASTER))
|
||||
ASSERT(Adapter->Flags & NDIS_ATTRIBUTE_BUS_MASTER);
|
||||
if(!(Adapter->Flags & NDIS_ATTRIBUTE_BUS_MASTER))
|
||||
return NDIS_STATUS_SUCCESS;
|
||||
|
||||
DeviceObject = Adapter->NdisMiniportBlock.DeviceObject;
|
||||
DeviceObject = Adapter->DeviceObject;
|
||||
|
||||
KeInitializeEvent(&Adapter->DmaEvent, NotificationEvent, FALSE);
|
||||
KeInitializeSpinLock(&Adapter->DmaLock);
|
||||
KeInitializeEvent(&AllocationEvent, NotificationEvent, FALSE);
|
||||
Adapter->AllocationEvent = &AllocationEvent;
|
||||
|
||||
/*
|
||||
* map registers correlate to physical pages. ndis documents a
|
||||
|
@ -330,12 +332,12 @@ NdisMAllocateMapRegisters(
|
|||
Description.Master = TRUE; /* implied by calling this function */
|
||||
Description.ScatterGather = TRUE; /* XXX UNTRUE: All BM DMA are S/G (ms seems to do this) */
|
||||
Description.Dma32BitAddresses = DmaSize;
|
||||
Description.BusNumber = Adapter->NdisMiniportBlock.BusNumber;
|
||||
Description.InterfaceType = Adapter->NdisMiniportBlock.BusType;
|
||||
Description.BusNumber = Adapter->BusNumber;
|
||||
Description.InterfaceType = Adapter->BusType;
|
||||
Description.DmaChannel = DmaChannel;
|
||||
Description.MaximumLength = MaximumBufferSize;
|
||||
|
||||
if(Adapter->NdisMiniportBlock.AdapterType == Isa)
|
||||
if(Adapter->AdapterType == Isa)
|
||||
{
|
||||
/* system dma */
|
||||
if(DmaChannel < 4)
|
||||
|
@ -345,7 +347,7 @@ NdisMAllocateMapRegisters(
|
|||
|
||||
Description.DmaSpeed = Compatible;
|
||||
}
|
||||
else if(Adapter->NdisMiniportBlock.AdapterType == PCIBus)
|
||||
else if(Adapter->AdapterType == PCIBus)
|
||||
{
|
||||
if(DmaSize == NDIS_DMA_64BITS)
|
||||
Description.Dma64BitAddresses = TRUE;
|
||||
|
@ -359,8 +361,7 @@ NdisMAllocateMapRegisters(
|
|||
}
|
||||
|
||||
AdapterObject = IoGetDmaAdapter(
|
||||
Adapter->NdisMiniportBlock.PhysicalDeviceObject,
|
||||
&Description, &AvailableMapRegisters);
|
||||
Adapter->PhysicalDeviceObject, &Description, &AvailableMapRegisters);
|
||||
|
||||
if(!AdapterObject)
|
||||
{
|
||||
|
@ -368,7 +369,7 @@ NdisMAllocateMapRegisters(
|
|||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
Adapter->NdisMiniportBlock.SystemAdapterObject = AdapterObject;
|
||||
Adapter->SystemAdapterObject = AdapterObject;
|
||||
|
||||
if(AvailableMapRegisters < MapRegistersPerBaseRegister)
|
||||
{
|
||||
|
@ -379,22 +380,22 @@ NdisMAllocateMapRegisters(
|
|||
}
|
||||
|
||||
/* allocate & zero space in the miniport block for the registers */
|
||||
Adapter->NdisMiniportBlock.MapRegisters = ExAllocatePool(NonPagedPool, BaseMapRegistersNeeded * sizeof(MAP_REGISTER_ENTRY));
|
||||
if(!Adapter->NdisMiniportBlock.MapRegisters)
|
||||
Adapter->MapRegisters = ExAllocatePool(NonPagedPool, BaseMapRegistersNeeded * sizeof(MAP_REGISTER_ENTRY));
|
||||
if(!Adapter->MapRegisters)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("insufficient resources.\n"));
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
memset(Adapter->NdisMiniportBlock.MapRegisters, 0, BaseMapRegistersNeeded * sizeof(MAP_REGISTER_ENTRY));
|
||||
Adapter->NdisMiniportBlock.BaseMapRegistersNeeded = (USHORT)BaseMapRegistersNeeded;
|
||||
memset(Adapter->MapRegisters, 0, BaseMapRegistersNeeded * sizeof(MAP_REGISTER_ENTRY));
|
||||
Adapter->BaseMapRegistersNeeded = (USHORT)BaseMapRegistersNeeded;
|
||||
|
||||
while(BaseMapRegistersNeeded)
|
||||
{
|
||||
NDIS_DbgPrint(MAX_TRACE, ("iterating, basemapregistersneeded = %d\n", BaseMapRegistersNeeded));
|
||||
|
||||
BaseMapRegistersNeeded--;
|
||||
Adapter->NdisMiniportBlock.CurrentMapRegister = (USHORT)BaseMapRegistersNeeded;
|
||||
Adapter->CurrentMapRegister = (USHORT)BaseMapRegistersNeeded;
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
{
|
||||
NtStatus = AdapterObject->DmaOperations->AllocateAdapterChannel(
|
||||
|
@ -411,7 +412,7 @@ NdisMAllocateMapRegisters(
|
|||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("waiting on event\n"));
|
||||
|
||||
NtStatus = KeWaitForSingleObject(&Adapter->DmaEvent, Executive, KernelMode, FALSE, 0);
|
||||
NtStatus = KeWaitForSingleObject(&AllocationEvent, Executive, KernelMode, FALSE, 0);
|
||||
|
||||
if(!NT_SUCCESS(NtStatus))
|
||||
{
|
||||
|
@ -421,7 +422,7 @@ NdisMAllocateMapRegisters(
|
|||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("resetting event\n"));
|
||||
|
||||
KeResetEvent(&Adapter->DmaEvent);
|
||||
KeResetEvent(&AllocationEvent);
|
||||
}
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("returning success\n"));
|
||||
|
@ -458,7 +459,7 @@ NdisMStartBufferPhysicalMapping(
|
|||
* - The caller supplies storage for the physical address array.
|
||||
*/
|
||||
{
|
||||
PLOGICAL_ADAPTER Adapter = 0;
|
||||
PNDIS_MINIPORT_BLOCK Adapter;
|
||||
PVOID CurrentVa;
|
||||
ULONG TotalLength;
|
||||
PHYSICAL_ADDRESS ReturnedAddress;
|
||||
|
@ -467,7 +468,7 @@ NdisMStartBufferPhysicalMapping(
|
|||
ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);
|
||||
ASSERT(MiniportAdapterHandle && Buffer && PhysicalAddressArray && ArraySize);
|
||||
|
||||
Adapter = (PLOGICAL_ADAPTER)MiniportAdapterHandle;
|
||||
Adapter = (PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle;
|
||||
CurrentVa = MmGetMdlVirtualAddress(Buffer);
|
||||
TotalLength = MmGetMdlByteCount(Buffer);
|
||||
|
||||
|
@ -475,12 +476,12 @@ NdisMStartBufferPhysicalMapping(
|
|||
{
|
||||
ULONG Length = TotalLength;
|
||||
|
||||
ReturnedAddress = Adapter->NdisMiniportBlock.SystemAdapterObject->DmaOperations->MapTransfer(
|
||||
Adapter->NdisMiniportBlock.SystemAdapterObject, Buffer,
|
||||
Adapter->NdisMiniportBlock.MapRegisters[PhysicalMapRegister].MapRegister,
|
||||
ReturnedAddress = Adapter->SystemAdapterObject->DmaOperations->MapTransfer(
|
||||
Adapter->SystemAdapterObject, Buffer,
|
||||
Adapter->MapRegisters[PhysicalMapRegister].MapRegister,
|
||||
CurrentVa, &Length, WriteToDevice);
|
||||
|
||||
Adapter->NdisMiniportBlock.MapRegisters[PhysicalMapRegister].WriteToDevice = WriteToDevice;
|
||||
Adapter->MapRegisters[PhysicalMapRegister].WriteToDevice = WriteToDevice;
|
||||
|
||||
PhysicalAddressArray[LoopCount].PhysicalAddress = ReturnedAddress;
|
||||
PhysicalAddressArray[LoopCount].Length = Length;
|
||||
|
@ -514,22 +515,22 @@ NdisMCompleteBufferPhysicalMapping(
|
|||
* - May be called at IRQL <= DISPATCH_LEVEL
|
||||
*/
|
||||
{
|
||||
PLOGICAL_ADAPTER Adapter = 0;
|
||||
PNDIS_MINIPORT_BLOCK Adapter;
|
||||
VOID *CurrentVa;
|
||||
ULONG Length;
|
||||
|
||||
ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);
|
||||
ASSERT(MiniportAdapterHandle && Buffer);
|
||||
|
||||
Adapter = (PLOGICAL_ADAPTER)MiniportAdapterHandle;
|
||||
Adapter = (PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle;
|
||||
CurrentVa = MmGetMdlVirtualAddress(Buffer);
|
||||
Length = MmGetMdlByteCount(Buffer);
|
||||
|
||||
Adapter->NdisMiniportBlock.SystemAdapterObject->DmaOperations->FlushAdapterBuffers(
|
||||
Adapter->NdisMiniportBlock.SystemAdapterObject, Buffer,
|
||||
Adapter->NdisMiniportBlock.MapRegisters[PhysicalMapRegister].MapRegister,
|
||||
Adapter->SystemAdapterObject->DmaOperations->FlushAdapterBuffers(
|
||||
Adapter->SystemAdapterObject, Buffer,
|
||||
Adapter->MapRegisters[PhysicalMapRegister].MapRegister,
|
||||
CurrentVa, Length,
|
||||
Adapter->NdisMiniportBlock.MapRegisters[PhysicalMapRegister].WriteToDevice);
|
||||
Adapter->MapRegisters[PhysicalMapRegister].WriteToDevice);
|
||||
}
|
||||
|
||||
|
||||
|
@ -600,42 +601,42 @@ NdisMFreeMapRegisters(
|
|||
* NOTES:
|
||||
*/
|
||||
{
|
||||
KIRQL OldIrql;
|
||||
PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)MiniportAdapterHandle;
|
||||
PDMA_ADAPTER AdapterObject;
|
||||
UINT MapRegistersPerBaseRegister;
|
||||
UINT i;
|
||||
KIRQL OldIrql;
|
||||
PNDIS_MINIPORT_BLOCK Adapter = (PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle;
|
||||
PDMA_ADAPTER AdapterObject;
|
||||
UINT MapRegistersPerBaseRegister;
|
||||
UINT i;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
ASSERT(Adapter);
|
||||
|
||||
/* only bus masters may call this routine */
|
||||
ASSERT(Adapter->NdisMiniportBlock.Flags & NDIS_ATTRIBUTE_BUS_MASTER);
|
||||
if(!(Adapter->NdisMiniportBlock.Flags & NDIS_ATTRIBUTE_BUS_MASTER) ||
|
||||
Adapter->NdisMiniportBlock.SystemAdapterObject == NULL)
|
||||
ASSERT(Adapter->Flags & NDIS_ATTRIBUTE_BUS_MASTER);
|
||||
if(!(Adapter->Flags & NDIS_ATTRIBUTE_BUS_MASTER) ||
|
||||
Adapter->SystemAdapterObject == NULL)
|
||||
return;
|
||||
|
||||
MapRegistersPerBaseRegister = ((Adapter->NdisMiniportBlock.MaximumPhysicalMapping - 2) / PAGE_SIZE) + 2;
|
||||
MapRegistersPerBaseRegister = ((Adapter->MaximumPhysicalMapping - 2) / PAGE_SIZE) + 2;
|
||||
|
||||
AdapterObject = Adapter->NdisMiniportBlock.SystemAdapterObject;
|
||||
AdapterObject = Adapter->SystemAdapterObject;
|
||||
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
{
|
||||
for(i = 0; i < Adapter->NdisMiniportBlock.BaseMapRegistersNeeded; i++)
|
||||
for(i = 0; i < Adapter->BaseMapRegistersNeeded; i++)
|
||||
{
|
||||
AdapterObject->DmaOperations->FreeMapRegisters(
|
||||
Adapter->NdisMiniportBlock.SystemAdapterObject,
|
||||
Adapter->NdisMiniportBlock.MapRegisters[i].MapRegister,
|
||||
Adapter->SystemAdapterObject,
|
||||
Adapter->MapRegisters[i].MapRegister,
|
||||
MapRegistersPerBaseRegister);
|
||||
}
|
||||
}
|
||||
KeLowerIrql(OldIrql);
|
||||
|
||||
AdapterObject->DmaOperations->PutDmaAdapter(AdapterObject);
|
||||
Adapter->NdisMiniportBlock.SystemAdapterObject = NULL;
|
||||
Adapter->SystemAdapterObject = NULL;
|
||||
|
||||
ExFreePool(Adapter->NdisMiniportBlock.MapRegisters);
|
||||
ExFreePool(Adapter->MapRegisters);
|
||||
}
|
||||
|
||||
|
||||
|
@ -771,7 +772,7 @@ NdisMRegisterInterrupt(
|
|||
ULONG MappedIRQ;
|
||||
KIRQL DIrql;
|
||||
KAFFINITY Affinity;
|
||||
PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(MiniportAdapterHandle);
|
||||
PNDIS_MINIPORT_BLOCK Adapter = (PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called. InterruptVector (0x%X) InterruptLevel (0x%X) "
|
||||
"SharedInterrupt (%d) InterruptMode (0x%X)\n",
|
||||
|
@ -787,10 +788,9 @@ NdisMRegisterInterrupt(
|
|||
|
||||
Interrupt->SharedInterrupt = SharedInterrupt;
|
||||
|
||||
Adapter->NdisMiniportBlock.Interrupt = Interrupt;
|
||||
Adapter->Interrupt = Interrupt;
|
||||
|
||||
MappedIRQ = HalGetInterruptVector(Adapter->NdisMiniportBlock.BusType,
|
||||
Adapter->NdisMiniportBlock.BusNumber,
|
||||
MappedIRQ = HalGetInterruptVector(Adapter->BusType, Adapter->BusNumber,
|
||||
InterruptLevel, InterruptVector, &DIrql,
|
||||
&Affinity);
|
||||
|
||||
|
@ -837,9 +837,9 @@ NdisMRegisterIoPortRange(
|
|||
* Status of operation
|
||||
*/
|
||||
{
|
||||
PHYSICAL_ADDRESS PortAddress, TranslatedAddress;
|
||||
PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(MiniportAdapterHandle);
|
||||
ULONG AddressSpace = 1; /* FIXME The HAL handles this wrong atm */
|
||||
PHYSICAL_ADDRESS PortAddress, TranslatedAddress;
|
||||
PNDIS_MINIPORT_BLOCK Adapter = (PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle;
|
||||
ULONG AddressSpace = 1; /* FIXME The HAL handles this wrong atm */
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called - InitialPort 0x%x, NumberOfPorts 0x%x\n", InitialPort, NumberOfPorts));
|
||||
|
||||
|
@ -858,8 +858,7 @@ NdisMRegisterIoPortRange(
|
|||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Translating address 0x%x 0x%x\n", PortAddress.u.HighPart, PortAddress.u.LowPart));
|
||||
|
||||
if(!HalTranslateBusAddress(Adapter->NdisMiniportBlock.BusType,
|
||||
Adapter->NdisMiniportBlock.BusNumber,
|
||||
if(!HalTranslateBusAddress(Adapter->BusType, Adapter->BusNumber,
|
||||
PortAddress, &AddressSpace, &TranslatedAddress))
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Unable to translate address\n"));
|
||||
|
|
|
@ -189,12 +189,12 @@ NdisMAllocateSharedMemory(
|
|||
* - Cached is ignored; we always allocate non-cached
|
||||
*/
|
||||
{
|
||||
PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)MiniportAdapterHandle;
|
||||
PNDIS_MINIPORT_BLOCK Adapter = (PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE,("Called.\n"));
|
||||
|
||||
*VirtualAddress = Adapter->NdisMiniportBlock.SystemAdapterObject->DmaOperations->AllocateCommonBuffer(
|
||||
Adapter->NdisMiniportBlock.SystemAdapterObject, Length, PhysicalAddress, Cached);
|
||||
*VirtualAddress = Adapter->SystemAdapterObject->DmaOperations->AllocateCommonBuffer(
|
||||
Adapter->SystemAdapterObject, Length, PhysicalAddress, Cached);
|
||||
}
|
||||
|
||||
|
||||
|
@ -267,7 +267,7 @@ NdisMFreeSharedMemory(
|
|||
*/
|
||||
{
|
||||
HANDLE ThreadHandle;
|
||||
PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)MiniportAdapterHandle;
|
||||
PNDIS_MINIPORT_BLOCK Adapter = (PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle;
|
||||
PMINIPORT_SHARED_MEMORY Memory;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE,("Called.\n"));
|
||||
|
@ -283,7 +283,7 @@ NdisMFreeSharedMemory(
|
|||
return;
|
||||
}
|
||||
|
||||
Memory->AdapterObject = Adapter->NdisMiniportBlock.SystemAdapterObject;
|
||||
Memory->AdapterObject = Adapter->SystemAdapterObject;
|
||||
Memory->Length = Length;
|
||||
Memory->PhysicalAddress = PhysicalAddress;
|
||||
Memory->VirtualAddress = VirtualAddress;
|
||||
|
|
|
@ -330,15 +330,17 @@ MiniResetComplete(
|
|||
|
||||
VOID NTAPI
|
||||
MiniRequestComplete(
|
||||
IN PADAPTER_BINDING AdapterBinding,
|
||||
IN PNDIS_MINIPORT_BLOCK Adapter,
|
||||
IN PNDIS_REQUEST Request,
|
||||
IN NDIS_STATUS Status)
|
||||
IN NDIS_STATUS Status)
|
||||
{
|
||||
PNDIS_REQUEST_MAC_BLOCK MacBlock = (PNDIS_REQUEST_MAC_BLOCK)Request->MacReserved;
|
||||
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
|
||||
|
||||
if( AdapterBinding->ProtocolBinding->Chars.RequestCompleteHandler ) {
|
||||
(*AdapterBinding->ProtocolBinding->Chars.RequestCompleteHandler)(
|
||||
AdapterBinding->NdisOpenBlock.ProtocolBindingContext,
|
||||
if( MacBlock->Binding->RequestCompleteHandler ) {
|
||||
(*MacBlock->Binding->RequestCompleteHandler)(
|
||||
MacBlock->Binding->ProtocolBindingContext,
|
||||
Request,
|
||||
Status);
|
||||
}
|
||||
|
@ -518,7 +520,6 @@ MiniLocateDevice(
|
|||
|
||||
if (RtlCompareUnicodeString(AdapterName, &Adapter->NdisMiniportBlock.MiniportName, TRUE) == 0)
|
||||
{
|
||||
ReferenceObject(Adapter);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -588,7 +589,7 @@ MiniQueryInformation(
|
|||
BytesNeeded = (Size == 0)? Adapter->QueryBufferLength : Size;
|
||||
|
||||
/* call the miniport's queryinfo handler */
|
||||
NdisStatus = (*Adapter->Miniport->Chars.QueryInformationHandler)(
|
||||
NdisStatus = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.QueryInformationHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
Oid,
|
||||
Adapter->QueryBuffer,
|
||||
|
@ -616,7 +617,7 @@ MiniQueryInformation(
|
|||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
NdisStatus = (*Adapter->Miniport->Chars.QueryInformationHandler)(
|
||||
NdisStatus = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.QueryInformationHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
Oid,
|
||||
Adapter->QueryBuffer,
|
||||
|
@ -632,9 +633,9 @@ MiniQueryInformation(
|
|||
NDIS_STATUS
|
||||
FASTCALL
|
||||
MiniQueueWorkItem(
|
||||
PADAPTER_BINDING AdapterBinding,
|
||||
NDIS_WORK_ITEM_TYPE WorkItemType,
|
||||
PVOID WorkItemContext)
|
||||
PLOGICAL_ADAPTER Adapter,
|
||||
NDIS_WORK_ITEM_TYPE WorkItemType,
|
||||
PVOID WorkItemContext)
|
||||
/*
|
||||
* FUNCTION: Queues a work item for execution at a later time
|
||||
* ARGUMENTS:
|
||||
|
@ -647,34 +648,22 @@ MiniQueueWorkItem(
|
|||
* Status of operation
|
||||
*/
|
||||
{
|
||||
PINTERNAL_NDIS_MINIPORT_WORK_ITEM Item;
|
||||
PLOGICAL_ADAPTER Adapter = AdapterBinding->Adapter;
|
||||
PNDIS_MINIPORT_WORK_ITEM Item;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
ASSERT(Adapter);
|
||||
ASSERT(KeGetCurrentIrql() >= DISPATCH_LEVEL);
|
||||
|
||||
#if 0
|
||||
if (Adapter->WorkQueueLevel < NDIS_MINIPORT_WORK_QUEUE_SIZE - 1)
|
||||
Item = ExAllocatePool(NonPagedPool, sizeof(NDIS_MINIPORT_WORK_ITEM));
|
||||
if (Item == NULL)
|
||||
{
|
||||
Item = &Adapter->WorkQueue[Adapter->WorkQueueLevel];
|
||||
Adapter->WorkQueueLevel++;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Item = ExAllocatePool(NonPagedPool, sizeof(INTERNAL_NDIS_MINIPORT_WORK_ITEM));
|
||||
if (Item == NULL)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
Item->AdapterBinding = AdapterBinding;
|
||||
Item->RealWorkItem.WorkItemType = WorkItemType;
|
||||
Item->RealWorkItem.WorkItemContext = WorkItemContext;
|
||||
Item->WorkItemType = WorkItemType;
|
||||
Item->WorkItemContext = WorkItemContext;
|
||||
|
||||
/* safe due to adapter lock held */
|
||||
Item->Link.Next = NULL;
|
||||
|
@ -689,7 +678,7 @@ MiniQueueWorkItem(
|
|||
Adapter->WorkQueueTail = Item;
|
||||
}
|
||||
|
||||
KeInsertQueueDpc(&Adapter->MiniportDpc, NULL, NULL);
|
||||
KeInsertQueueDpc(&Adapter->NdisMiniportBlock.DeferredDpc, NULL, NULL);
|
||||
|
||||
return NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -699,7 +688,6 @@ NDIS_STATUS
|
|||
FASTCALL
|
||||
MiniDequeueWorkItem(
|
||||
PLOGICAL_ADAPTER Adapter,
|
||||
PADAPTER_BINDING *AdapterBinding,
|
||||
NDIS_WORK_ITEM_TYPE *WorkItemType,
|
||||
PVOID *WorkItemContext)
|
||||
/*
|
||||
|
@ -715,7 +703,7 @@ MiniDequeueWorkItem(
|
|||
* Status of operation
|
||||
*/
|
||||
{
|
||||
PINTERNAL_NDIS_MINIPORT_WORK_ITEM Item;
|
||||
PNDIS_MINIPORT_WORK_ITEM Item;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
|
@ -724,14 +712,13 @@ MiniDequeueWorkItem(
|
|||
if (Item)
|
||||
{
|
||||
/* safe due to adapter lock held */
|
||||
Adapter->WorkQueueHead = (PINTERNAL_NDIS_MINIPORT_WORK_ITEM)Item->Link.Next;
|
||||
Adapter->WorkQueueHead = (PNDIS_MINIPORT_WORK_ITEM)Item->Link.Next;
|
||||
|
||||
if (Item == Adapter->WorkQueueTail)
|
||||
Adapter->WorkQueueTail = NULL;
|
||||
|
||||
*AdapterBinding = Item->AdapterBinding;
|
||||
*WorkItemType = Item->RealWorkItem.WorkItemType;
|
||||
*WorkItemContext = Item->RealWorkItem.WorkItemContext;
|
||||
*WorkItemType = Item->WorkItemType;
|
||||
*WorkItemContext = Item->WorkItemContext;
|
||||
|
||||
ExFreePool(Item);
|
||||
|
||||
|
@ -744,7 +731,7 @@ MiniDequeueWorkItem(
|
|||
|
||||
NDIS_STATUS
|
||||
MiniDoRequest(
|
||||
PADAPTER_BINDING AdapterBinding,
|
||||
PNDIS_MINIPORT_BLOCK Adapter,
|
||||
PNDIS_REQUEST NdisRequest)
|
||||
/*
|
||||
* FUNCTION: Sends a request to a miniport
|
||||
|
@ -755,17 +742,15 @@ MiniDoRequest(
|
|||
* Status of operation
|
||||
*/
|
||||
{
|
||||
PLOGICAL_ADAPTER Adapter = AdapterBinding->Adapter;
|
||||
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
|
||||
|
||||
Adapter->NdisMiniportBlock.MediaRequest = NdisRequest;
|
||||
Adapter->MediaRequest = NdisRequest;
|
||||
|
||||
switch (NdisRequest->RequestType)
|
||||
{
|
||||
case NdisRequestQueryInformation:
|
||||
return (*Adapter->Miniport->Chars.QueryInformationHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
return (*Adapter->DriverHandle->MiniportCharacteristics.QueryInformationHandler)(
|
||||
Adapter->MiniportAdapterContext,
|
||||
NdisRequest->DATA.QUERY_INFORMATION.Oid,
|
||||
NdisRequest->DATA.QUERY_INFORMATION.InformationBuffer,
|
||||
NdisRequest->DATA.QUERY_INFORMATION.InformationBufferLength,
|
||||
|
@ -774,8 +759,8 @@ MiniDoRequest(
|
|||
break;
|
||||
|
||||
case NdisRequestSetInformation:
|
||||
return (*Adapter->Miniport->Chars.SetInformationHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
return (*Adapter->DriverHandle->MiniportCharacteristics.SetInformationHandler)(
|
||||
Adapter->MiniportAdapterContext,
|
||||
NdisRequest->DATA.SET_INFORMATION.Oid,
|
||||
NdisRequest->DATA.SET_INFORMATION.InformationBuffer,
|
||||
NdisRequest->DATA.SET_INFORMATION.InformationBufferLength,
|
||||
|
@ -824,14 +809,13 @@ VOID NTAPI MiniportDpc(
|
|||
NDIS_STATUS NdisStatus;
|
||||
PVOID WorkItemContext;
|
||||
NDIS_WORK_ITEM_TYPE WorkItemType;
|
||||
PADAPTER_BINDING AdapterBinding;
|
||||
PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(DeferredContext);
|
||||
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
|
||||
|
||||
NdisStatus =
|
||||
MiniDequeueWorkItem
|
||||
(Adapter, &AdapterBinding, &WorkItemType, &WorkItemContext);
|
||||
(Adapter, &WorkItemType, &WorkItemContext);
|
||||
|
||||
if (NdisStatus == NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
|
@ -844,7 +828,7 @@ VOID NTAPI MiniportDpc(
|
|||
#ifdef DBG
|
||||
MiniDisplayPacket((PNDIS_PACKET)WorkItemContext);
|
||||
#endif
|
||||
if(Adapter->Miniport->Chars.SendPacketsHandler)
|
||||
if(Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)
|
||||
{
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's SendPackets handler\n"));
|
||||
|
||||
|
@ -852,7 +836,7 @@ VOID NTAPI MiniportDpc(
|
|||
* XXX assumes single-packet - prolly OK since we'll call something
|
||||
* different on multi-packet sends
|
||||
*/
|
||||
(*Adapter->Miniport->Chars.SendPacketsHandler)(
|
||||
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext, (PPNDIS_PACKET)&WorkItemContext, 1);
|
||||
NdisStatus =
|
||||
NDIS_GET_PACKET_STATUS((PNDIS_PACKET)WorkItemContext);
|
||||
|
@ -863,7 +847,7 @@ VOID NTAPI MiniportDpc(
|
|||
{
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's Send handler\n"));
|
||||
|
||||
NdisStatus = (*Adapter->Miniport->Chars.SendHandler)(
|
||||
NdisStatus = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext, (PNDIS_PACKET)WorkItemContext, 0);
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("back from miniport's Send handler\n"));
|
||||
|
@ -897,7 +881,7 @@ VOID NTAPI MiniportDpc(
|
|||
break;
|
||||
|
||||
case NdisWorkItemRequest:
|
||||
NdisStatus = MiniDoRequest(AdapterBinding, (PNDIS_REQUEST)WorkItemContext);
|
||||
NdisStatus = MiniDoRequest(&Adapter->NdisMiniportBlock, (PNDIS_REQUEST)WorkItemContext);
|
||||
|
||||
if (NdisStatus == NDIS_STATUS_PENDING)
|
||||
break;
|
||||
|
@ -906,12 +890,12 @@ VOID NTAPI MiniportDpc(
|
|||
{
|
||||
case NdisRequestQueryInformation:
|
||||
NdisMQueryInformationComplete((NDIS_HANDLE)Adapter, NdisStatus);
|
||||
MiniRequestComplete( AdapterBinding, (PNDIS_REQUEST)WorkItemContext, NdisStatus );
|
||||
MiniRequestComplete( &Adapter->NdisMiniportBlock, (PNDIS_REQUEST)WorkItemContext, NdisStatus );
|
||||
break;
|
||||
|
||||
case NdisRequestSetInformation:
|
||||
NdisMSetInformationComplete((NDIS_HANDLE)Adapter, NdisStatus);
|
||||
MiniRequestComplete( AdapterBinding, (PNDIS_REQUEST)WorkItemContext, NdisStatus );
|
||||
MiniRequestComplete( &Adapter->NdisMiniportBlock, (PNDIS_REQUEST)WorkItemContext, NdisStatus );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1037,7 +1021,7 @@ NdisInitializeWrapper(
|
|||
* - SystemSpecific2 goes invalid so we copy it
|
||||
*/
|
||||
{
|
||||
PMINIPORT_DRIVER Miniport;
|
||||
PNDIS_M_DRIVER_BLOCK Miniport;
|
||||
PUNICODE_STRING RegistryPath;
|
||||
WCHAR *RegistryBuffer;
|
||||
|
||||
|
@ -1051,7 +1035,7 @@ NdisInitializeWrapper(
|
|||
__asm__ ("int $3\n");
|
||||
#endif
|
||||
|
||||
Miniport = ExAllocatePool(NonPagedPool, sizeof(MINIPORT_DRIVER));
|
||||
Miniport = ExAllocatePool(NonPagedPool, sizeof(NDIS_M_DRIVER_BLOCK));
|
||||
|
||||
if (!Miniport)
|
||||
{
|
||||
|
@ -1059,12 +1043,10 @@ NdisInitializeWrapper(
|
|||
return;
|
||||
}
|
||||
|
||||
RtlZeroMemory(Miniport, sizeof(MINIPORT_DRIVER));
|
||||
RtlZeroMemory(Miniport, sizeof(NDIS_M_DRIVER_BLOCK));
|
||||
|
||||
KeInitializeSpinLock(&Miniport->Lock);
|
||||
|
||||
Miniport->RefCount = 1;
|
||||
|
||||
Miniport->DriverObject = (PDRIVER_OBJECT)SystemSpecific1;
|
||||
|
||||
/* set the miniport's driver registry path */
|
||||
|
@ -1091,7 +1073,7 @@ NdisInitializeWrapper(
|
|||
RegistryPath->Buffer = RegistryBuffer;
|
||||
Miniport->RegistryPath = RegistryPath;
|
||||
|
||||
InitializeListHead(&Miniport->AdapterListHead);
|
||||
InitializeListHead(&Miniport->DeviceList);
|
||||
|
||||
/* Put miniport in global miniport list */
|
||||
ExInterlockedInsertTailList(&MiniportListHead, &Miniport->ListEntry, &MiniportListLock);
|
||||
|
@ -1438,7 +1420,7 @@ NdisIPnPStartDevice(
|
|||
*/
|
||||
|
||||
NDIS_DbgPrint(MID_TRACE, ("calling MiniportInitialize\n"));
|
||||
NdisStatus = (*Adapter->Miniport->Chars.InitializeHandler)(
|
||||
NdisStatus = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.InitializeHandler)(
|
||||
&OpenErrorStatus, &SelectedMediumIndex, &MediaArray[0],
|
||||
MEDIA_ARRAY_SIZE, Adapter, (NDIS_HANDLE)&WrapperContext);
|
||||
|
||||
|
@ -1505,7 +1487,7 @@ NdisIPnPStartDevice(
|
|||
Adapter->NdisMiniportBlock.PnPDeviceState = NdisPnPDeviceStarted;
|
||||
|
||||
/* Put adapter in adapter list for this miniport */
|
||||
ExInterlockedInsertTailList(&Adapter->Miniport->AdapterListHead, &Adapter->MiniportListEntry, &Adapter->Miniport->Lock);
|
||||
ExInterlockedInsertTailList(&Adapter->NdisMiniportBlock.DriverHandle->DeviceList, &Adapter->MiniportListEntry, &Adapter->NdisMiniportBlock.DriverHandle->Lock);
|
||||
|
||||
/* Put adapter in global adapter list */
|
||||
ExInterlockedInsertTailList(&AdapterListHead, &Adapter->ListEntry, &AdapterListLock);
|
||||
|
@ -1532,16 +1514,16 @@ NdisIPnPStopDevice(
|
|||
KIRQL OldIrql;
|
||||
|
||||
/* Remove adapter from adapter list for this miniport */
|
||||
KeAcquireSpinLock(&Adapter->Miniport->Lock, &OldIrql);
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.DriverHandle->Lock, &OldIrql);
|
||||
RemoveEntryList(&Adapter->MiniportListEntry);
|
||||
KeReleaseSpinLock(&Adapter->Miniport->Lock, OldIrql);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.DriverHandle->Lock, OldIrql);
|
||||
|
||||
/* Remove adapter from global adapter list */
|
||||
KeAcquireSpinLock(&AdapterListLock, &OldIrql);
|
||||
RemoveEntryList(&Adapter->ListEntry);
|
||||
KeReleaseSpinLock(&AdapterListLock, OldIrql);
|
||||
|
||||
(*Adapter->Miniport->Chars.HaltHandler)(Adapter);
|
||||
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.HaltHandler)(Adapter);
|
||||
|
||||
if (Adapter->LookaheadBuffer)
|
||||
{
|
||||
|
@ -1625,8 +1607,8 @@ NdisIAddDevice(
|
|||
{
|
||||
static const WCHAR ClassKeyName[] = {'C','l','a','s','s','\\'};
|
||||
static const WCHAR LinkageKeyName[] = {'\\','L','i','n','k','a','g','e',0};
|
||||
PMINIPORT_DRIVER Miniport;
|
||||
PMINIPORT_DRIVER *MiniportPtr;
|
||||
PNDIS_M_DRIVER_BLOCK Miniport;
|
||||
PNDIS_M_DRIVER_BLOCK *MiniportPtr;
|
||||
WCHAR *LinkageKeyBuffer;
|
||||
ULONG DriverKeyLength;
|
||||
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
|
||||
|
@ -1732,8 +1714,7 @@ NdisIAddDevice(
|
|||
Adapter = (PLOGICAL_ADAPTER)DeviceObject->DeviceExtension;
|
||||
KeInitializeSpinLock(&Adapter->NdisMiniportBlock.Lock);
|
||||
InitializeListHead(&Adapter->ProtocolListHead);
|
||||
Adapter->RefCount = 1;
|
||||
Adapter->Miniport = Miniport;
|
||||
Adapter->NdisMiniportBlock.DriverHandle = Miniport;
|
||||
|
||||
Adapter->NdisMiniportBlock.MiniportName = ExportName;
|
||||
|
||||
|
@ -1746,7 +1727,7 @@ NdisIAddDevice(
|
|||
Adapter->NdisMiniportBlock.OldPnPDeviceState = 0;
|
||||
Adapter->NdisMiniportBlock.PnPDeviceState = NdisPnPDeviceAdded;
|
||||
|
||||
KeInitializeDpc(&Adapter->MiniportDpc, MiniportDpc, (PVOID)Adapter);
|
||||
KeInitializeDpc(&Adapter->NdisMiniportBlock.DeferredDpc, MiniportDpc, (PVOID)Adapter);
|
||||
|
||||
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
|
||||
|
@ -1774,8 +1755,8 @@ NdisMRegisterMiniport(
|
|||
*/
|
||||
{
|
||||
UINT MinSize;
|
||||
PMINIPORT_DRIVER Miniport = GET_MINIPORT_DRIVER(NdisWrapperHandle);
|
||||
PMINIPORT_DRIVER *MiniportPtr;
|
||||
PNDIS_M_DRIVER_BLOCK Miniport = GET_MINIPORT_DRIVER(NdisWrapperHandle);
|
||||
PNDIS_M_DRIVER_BLOCK *MiniportPtr;
|
||||
NTSTATUS Status;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
@ -1837,15 +1818,15 @@ NdisMRegisterMiniport(
|
|||
|
||||
/* TODO: verify NDIS5 and NDIS5.1 */
|
||||
|
||||
RtlCopyMemory(&Miniport->Chars, MiniportCharacteristics, MinSize);
|
||||
RtlCopyMemory(&Miniport->MiniportCharacteristics, MiniportCharacteristics, MinSize);
|
||||
|
||||
/*
|
||||
* NOTE: This is VERY unoptimal! Should we store the MINIPORT_DRIVER
|
||||
* struture in the driver extension or what?
|
||||
* NOTE: This is VERY unoptimal! Should we store the NDIS_M_DRIVER_BLOCK
|
||||
* structure in the driver extension or what?
|
||||
*/
|
||||
|
||||
Status = IoAllocateDriverObjectExtension(Miniport->DriverObject, (PVOID)TAG('D','I','M','N'),
|
||||
sizeof(PMINIPORT_DRIVER), (PVOID*)&MiniportPtr);
|
||||
sizeof(PNDIS_M_DRIVER_BLOCK), (PVOID*)&MiniportPtr);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Can't allocate driver object extension.\n"));
|
||||
|
@ -2000,7 +1981,6 @@ NdisMSetAttributesEx(
|
|||
Adapter->NdisMiniportBlock.MiniportAdapterContext = MiniportAdapterContext;
|
||||
Adapter->NdisMiniportBlock.Flags = AttributeFlags;
|
||||
Adapter->NdisMiniportBlock.AdapterType = AdapterType;
|
||||
Adapter->AttributesSet = TRUE;
|
||||
if (AttributeFlags & NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER)
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Intermediate drivers not supported yet.\n"));
|
||||
}
|
||||
|
@ -2077,11 +2057,11 @@ NdisTerminateWrapper(
|
|||
/*
|
||||
* FUNCTION: Releases resources allocated by a call to NdisInitializeWrapper
|
||||
* ARGUMENTS:
|
||||
* NdisWrapperHandle = Handle returned by NdisInitializeWrapper (MINIPORT_DRIVER)
|
||||
* NdisWrapperHandle = Handle returned by NdisInitializeWrapper (NDIS_M_DRIVER_BLOCK)
|
||||
* SystemSpecific = Always NULL
|
||||
*/
|
||||
{
|
||||
PMINIPORT_DRIVER Miniport = GET_MINIPORT_DRIVER(NdisWrapperHandle);
|
||||
PNDIS_M_DRIVER_BLOCK Miniport = GET_MINIPORT_DRIVER(NdisWrapperHandle);
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ ProIndicatePacket(
|
|||
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
{
|
||||
Adapter->LoopPacket = Packet;
|
||||
Adapter->NdisMiniportBlock.IndicatedPacket[KeGetCurrentProcessorNumber()] = Packet;
|
||||
BufferedLength = CopyPacketToBuffer(Adapter->LookaheadBuffer, Packet, 0, Adapter->NdisMiniportBlock.CurrentLookahead);
|
||||
}
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
|
@ -98,7 +98,7 @@ ProIndicatePacket(
|
|||
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
|
||||
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
|
||||
{
|
||||
Adapter->LoopPacket = NULL;
|
||||
Adapter->NdisMiniportBlock.IndicatedPacket[KeGetCurrentProcessorNumber()] = NULL;
|
||||
}
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
|
||||
|
@ -124,6 +124,7 @@ ProRequest(
|
|||
NDIS_STATUS NdisStatus;
|
||||
PADAPTER_BINDING AdapterBinding;
|
||||
PLOGICAL_ADAPTER Adapter;
|
||||
PNDIS_REQUEST_MAC_BLOCK MacBlock = (PNDIS_REQUEST_MAC_BLOCK)NdisRequest->MacReserved;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
|
@ -133,6 +134,8 @@ ProRequest(
|
|||
ASSERT(AdapterBinding->Adapter);
|
||||
Adapter = AdapterBinding->Adapter;
|
||||
|
||||
MacBlock->Binding = &AdapterBinding->NdisOpenBlock;
|
||||
|
||||
/*
|
||||
* If the miniport is already busy, queue a workitem
|
||||
*/
|
||||
|
@ -151,7 +154,7 @@ ProRequest(
|
|||
/* MiniQueueWorkItem must be called at IRQL >= DISPATCH_LEVEL */
|
||||
if (QueueWorkItem)
|
||||
{
|
||||
MiniQueueWorkItem(AdapterBinding, NdisWorkItemRequest, (PVOID)NdisRequest);
|
||||
MiniQueueWorkItem(Adapter, NdisWorkItemRequest, (PVOID)NdisRequest);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
return NDIS_STATUS_PENDING;
|
||||
}
|
||||
|
@ -162,7 +165,7 @@ ProRequest(
|
|||
/* TODO (?): move the irql raise into MiniDoRequest */
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
{
|
||||
NdisStatus = MiniDoRequest(AdapterBinding, NdisRequest);
|
||||
NdisStatus = MiniDoRequest(&Adapter->NdisMiniportBlock, NdisRequest);
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
|
@ -171,7 +174,7 @@ ProRequest(
|
|||
Adapter->MiniportBusy = FALSE;
|
||||
|
||||
if (Adapter->WorkQueueHead)
|
||||
KeInsertQueueDpc(&Adapter->MiniportDpc, NULL, NULL);
|
||||
KeInsertQueueDpc(&Adapter->NdisMiniportBlock.DeferredDpc, NULL, NULL);
|
||||
}
|
||||
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
}
|
||||
|
@ -271,7 +274,7 @@ ProSend(
|
|||
|
||||
if (QueueWorkItem)
|
||||
{
|
||||
MiniQueueWorkItem(AdapterBinding, NdisWorkItemSendLoopback, (PVOID)Packet);
|
||||
MiniQueueWorkItem(Adapter, NdisWorkItemSendLoopback, (PVOID)Packet);
|
||||
return NDIS_STATUS_PENDING;
|
||||
}
|
||||
|
||||
|
@ -292,7 +295,7 @@ ProSend(
|
|||
Adapter->MiniportBusy = FALSE;
|
||||
|
||||
if (Adapter->WorkQueueHead)
|
||||
KeInsertQueueDpc(&Adapter->MiniportDpc, NULL, NULL);
|
||||
KeInsertQueueDpc(&Adapter->NdisMiniportBlock.DeferredDpc, NULL, NULL);
|
||||
else
|
||||
NDIS_DbgPrint(MID_TRACE,("Failed to insert packet into work queue\n"));
|
||||
}
|
||||
|
@ -308,12 +311,12 @@ ProSend(
|
|||
/* This is a normal send packet, not a loopback packet. */
|
||||
if (QueueWorkItem)
|
||||
{
|
||||
MiniQueueWorkItem(AdapterBinding, NdisWorkItemSend, (PVOID)Packet);
|
||||
MiniQueueWorkItem(Adapter, NdisWorkItemSend, (PVOID)Packet);
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Queued a work item and returning\n"));
|
||||
return NDIS_STATUS_PENDING;
|
||||
}
|
||||
|
||||
ASSERT(Adapter->Miniport);
|
||||
ASSERT(Adapter->NdisMiniportBlock.DriverHandle);
|
||||
|
||||
/*
|
||||
* Call the appropriate send handler
|
||||
|
@ -321,12 +324,13 @@ ProSend(
|
|||
* If a miniport provides a SendPackets handler, we always call it. If not, we call the
|
||||
* Send handler.
|
||||
*/
|
||||
if(Adapter->Miniport->Chars.SendPacketsHandler)
|
||||
if(Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)
|
||||
{
|
||||
if(Adapter->NdisMiniportBlock.Flags & NDIS_ATTRIBUTE_DESERIALIZE)
|
||||
{
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's SendPackets handler\n"));
|
||||
(*Adapter->Miniport->Chars.SendPacketsHandler)(Adapter->NdisMiniportBlock.MiniportAdapterContext, &Packet, 1);
|
||||
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext, &Packet, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -334,7 +338,8 @@ ProSend(
|
|||
KeRaiseIrql(DISPATCH_LEVEL, &RaiseOldIrql);
|
||||
{
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's SendPackets handler\n"));
|
||||
(*Adapter->Miniport->Chars.SendPacketsHandler)(Adapter->NdisMiniportBlock.MiniportAdapterContext, &Packet, 1);
|
||||
(*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext, &Packet, 1);
|
||||
}
|
||||
KeLowerIrql(RaiseOldIrql);
|
||||
}
|
||||
|
@ -349,7 +354,8 @@ ProSend(
|
|||
if(Adapter->NdisMiniportBlock.Flags & NDIS_ATTRIBUTE_DESERIALIZE)
|
||||
{
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's Send handler\n"));
|
||||
NdisStatus = (*Adapter->Miniport->Chars.SendHandler)(Adapter->NdisMiniportBlock.MiniportAdapterContext, Packet, 0);
|
||||
NdisStatus = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext, Packet, 0);
|
||||
NDIS_DbgPrint(MAX_TRACE, ("back from miniport's send handler\n"));
|
||||
}
|
||||
else
|
||||
|
@ -358,7 +364,8 @@ ProSend(
|
|||
KeRaiseIrql(DISPATCH_LEVEL, &RaiseOldIrql);
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Calling miniport's Send handler\n"));
|
||||
NdisStatus = (*Adapter->Miniport->Chars.SendHandler)(Adapter->NdisMiniportBlock.MiniportAdapterContext, Packet, 0);
|
||||
NdisStatus = (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendHandler)(
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext, Packet, 0);
|
||||
NDIS_DbgPrint(MAX_TRACE, ("back from miniport's send handler\n"));
|
||||
if( NdisStatus != NDIS_STATUS_PENDING ) {
|
||||
Adapter->MiniportBusy = FALSE;
|
||||
|
@ -373,7 +380,7 @@ ProSend(
|
|||
{
|
||||
if (Adapter->WorkQueueHead)
|
||||
{
|
||||
KeInsertQueueDpc(&Adapter->MiniportDpc, NULL, NULL);
|
||||
KeInsertQueueDpc(&Adapter->NdisMiniportBlock.DeferredDpc, NULL, NULL);
|
||||
NDIS_DbgPrint(MAX_TRACE, ("MiniportDpc queued; returning NDIS_STATUS_SUCCESS\n"));
|
||||
}
|
||||
}
|
||||
|
@ -421,19 +428,19 @@ ProTransferData(
|
|||
/* FIXME: Interrupts must be disabled for adapter */
|
||||
/* XXX sd - why is that true? */
|
||||
|
||||
if (Packet == Adapter->LoopPacket) {
|
||||
if (Packet == Adapter->NdisMiniportBlock.IndicatedPacket[KeGetCurrentProcessorNumber()]) {
|
||||
NDIS_DbgPrint(MAX_TRACE, ("LoopPacket\n"));
|
||||
/* NDIS is responsible for looping this packet */
|
||||
NdisCopyFromPacketToPacket(Packet,
|
||||
ByteOffset,
|
||||
BytesToTransfer,
|
||||
Adapter->LoopPacket,
|
||||
Adapter->NdisMiniportBlock.IndicatedPacket[KeGetCurrentProcessorNumber()],
|
||||
0,
|
||||
BytesTransferred);
|
||||
return NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return (*Adapter->Miniport->Chars.TransferDataHandler)(
|
||||
return (*Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.TransferDataHandler)(
|
||||
Packet,
|
||||
BytesTransferred,
|
||||
Adapter->NdisMiniportBlock.MiniportAdapterContext,
|
||||
|
@ -616,6 +623,9 @@ NdisOpenAdapter(
|
|||
AdapterBinding->NdisOpenBlock.SendPacketsHandler = ProSendPackets;
|
||||
AdapterBinding->NdisOpenBlock.TransferDataHandler = ProTransferData;
|
||||
|
||||
AdapterBinding->NdisOpenBlock.RequestCompleteHandler =
|
||||
Protocol->Chars.RequestCompleteHandler;
|
||||
|
||||
#if 0
|
||||
/* XXX this looks fishy */
|
||||
/* OK, this really *is* fishy - it bugchecks */
|
||||
|
@ -723,8 +733,6 @@ NdisRegisterProtocol(
|
|||
|
||||
KeInitializeSpinLock(&Protocol->Lock);
|
||||
|
||||
Protocol->RefCount = 1;
|
||||
|
||||
InitializeListHead(&Protocol->AdapterListHead);
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue