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