Support for VMWare NIC, and some general clean-up and other minor changes:

- default to full maps
 - switched ndis (temporarily) back to system-start
 - enabled the pcnet driver in the registry (temporary - awaiting PnP support)
 - fixed the version number in the ndis version resource
 - implemented packet array indications
 - added a missing enum member to kedef
 - added PAGED_CODE() to ndis.h
 - added IRQL checking, assertions, and some comments to ndis
 - did some re-formatting to bring into code standard
 - other minor/cosmetic changes

svn path=/trunk/; revision=6295
This commit is contained in:
Vizzini 2003-10-12 16:39:52 +00:00
parent b635a41ae9
commit 74be14122f
17 changed files with 1257 additions and 1013 deletions

View file

@ -55,8 +55,9 @@ HKLM,"SYSTEM\CurrentControlSet\Control\ServiceGroupOrder","List",0x00010000, \
"Video", \ "Video", \
"File System", \ "File System", \
"Event log", \ "Event log", \
"NDIS", \ "NDIS Wrapper" \
"PNP_TDI", \ "PNP_TDI", \
"NDIS", \
"TDI", \ "TDI", \
"Extended Base" "Extended Base"
@ -219,28 +220,28 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Msfs","Type",0x00010001,0x00000002
; NDIS driver - the only boot-start network driver ; NDIS driver - the only boot-start network driver
HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","ErrorControl",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","Group",0x00000000,"NDIS" HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","Group",0x00000000,"NDIS Wrapper"
HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","ImagePath",0x00020000,"system32\drivers\ndis.sys" HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","ImagePath",0x00020000,"system32\drivers\ndis.sys"
HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","Start",0x00010001,0x00000000 HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","Start",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","Type",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","Type",0x00010001,0x00000001
; NIC drivers are like any other drivers - but no card-specific info here. bind/route/export ; NIC drivers are like any other drivers - but no card-specific info here. bind/route/export
; should have one entry per child device object. ; should have one entry per child device object.
; Comment the networking stuff out if you don't have hte card and don't want to see errors ; Comment the networking stuff out if you don't have hte card and don't want to see errors
; NE2000 NIC driver ; NE2000 NIC driver
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","ErrorControl",0x00010001,0x00000001 ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","ErrorControl",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Group",0x00000000,"NDIS" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Group",0x00000000,"NDIS"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","ImagePath",0x00020000,"system32\drivers\ne2000.sys" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","ImagePath",0x00020000,"system32\drivers\ne2000.sys"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Start",0x00010001,0x00000003 ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Start",0x00010001,0x00000003
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Type",0x00010001,0x00000001 ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Type",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Test",0x00010001,0xbaadf00d ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Test",0x00010001,0xbaadf00d
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Route",0x00000000,"Ne20001" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Route",0x00000000,"Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Linkage","Bind",0x00010000,"\Device\Ne20001" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Linkage","Bind",0x00010000,"\Device\Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Linkage","Export",0x00010000,"\Device\Ne20001" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Linkage","Export",0x00010000,"\Device\Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Linkage","Route",0x00010000,"Ne20001" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Linkage","Route",0x00010000,"Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Enum","0",0x00000000,"Root\POSVPN\0000" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Enum","0",0x00000000,"Root\POSVPN\0000"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Enum","Count",0x00010001,0x00000001 ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Enum","Count",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Enum","NextInstance",0x00010001,0x00000001 ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Enum","NextInstance",0x00010001,0x00000001
; one day this will happen automatically; until then we need this since ndis5 drivers ; one day this will happen automatically; until then we need this since ndis5 drivers
; rely on the fact that their resources are handed to them by ndis, so we have to find ; rely on the fact that their resources are handed to them by ndis, so we have to find
@ -254,60 +255,60 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Enum","NextInstance",0x00010001,0
; for the parent driver plus a globally-increasing serial number (i.e. across all ndis miniports) ; for the parent driver plus a globally-increasing serial number (i.e. across all ndis miniports)
; TODO: create this with NDI ; TODO: create this with NDI
; NE2000 Adapter 1 ; NE2000 Adapter 1
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001","ErrorControl",0x00010001,0x00000001 ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001","ErrorControl",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001","Start",0x00010001,0x00000003 ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001","Start",0x00010001,0x00000003
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001","Type",0x00010001,0x00000004 ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001","Type",0x00010001,0x00000004
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Linkage","Bind",0x00010000,"\Device\Ne20001" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Linkage","Bind",0x00010000,"\Device\Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Linkage","Export",0x00010000,"\Device\Ne20001" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Linkage","Export",0x00010000,"\Device\Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Linkage","Route",0x00010000,"Ne20001" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Linkage","Route",0x00010000,"Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","Port",0x00000000,"280" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","Port",0x00000000,"280"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","Irq",0x00000000,"9" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","Irq",0x00000000,"9"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","DwordTest",0x00000000,"baadf00d" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","DwordTest",0x00000000,"baadf00d"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","StringTest",0x00000000,"StringTest" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","StringTest",0x00000000,"StringTest"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","NetworkAddress",0x00000000,"001122334455" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","NetworkAddress",0x00000000,"001122334455"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","DefaultGateway",0x00010000,"10.0.0.1" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","DefaultGateway",0x00010000,"10.0.0.1"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","IPAddress",0x00010000,"10.0.0.100" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","IPAddress",0x00010000,"10.0.0.100"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0" ;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0"
; AMD PCNet NIC driver ; AMD PCNet NIC driver
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","ErrorControl",0x00010001,0x00000001
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","Group",0x00000000,"NDIS" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","Group",0x00000000,"NDIS"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","ImagePath",0x00020000,"system32\drivers\pcntn5m.sys" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","ImagePath",0x00020000,"system32\drivers\pcntn5m.sys"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","Start",0x00010001,0x00000003 HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","Start",0x00010001,0x00000001
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","Type",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","Type",0x00010001,0x00000001
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet\Linkage","Bind",0x00010000,"\Device\PCNet1" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet\Linkage","Bind",0x00010000,"\Device\PCNet1"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet\Linkage","Export",0x00010000,"\Device\PCNet1" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet\Linkage","Export",0x00010000,"\Device\PCNet1"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet\Linkage","Route",0x00010000,"PCNet1" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet\Linkage","Route",0x00010000,"PCNet1"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet\Enum","0",0x00000000,"PCI\VEN_1022&DEV_2000\0000" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet\Enum","0",0x00000000,"PCI\VEN_1022&DEV_2000\0000"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet\Enum","Count",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\PCNet\Enum","Count",0x00010001,0x00000001
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet\Enum","NextInstance",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\PCNet\Enum","NextInstance",0x00010001,0x00000001
;HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\0000","Service",0x00000000,"PCNet" HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\0000","Service",0x00000000,"PCNet"
;HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\0000","Class",0x00000000,"Net" HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\0000","Class",0x00000000,"Net"
;HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\0000","ClassGUID",0x00000000,"{4D36E972-E325-11CE-BFC1-08002BE10318}" HKLM,"SYSTEM\CurrentControlSet\Enum\PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\0000","ClassGUID",0x00000000,"{4D36E972-E325-11CE-BFC1-08002BE10318}"
; AMD PCNet Adapter 1 ; AMD PCNet Adapter 1
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1","ErrorControl",0x00010001,0x00000001
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1","Start",0x00010001,0x00000003 HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1","Start",0x00010001,0x00000003
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1","Type",0x00010001,0x00000004 HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1","Type",0x00010001,0x00000004
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Linkage","Bind",0x00010000,"\Device\PCNet1" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Linkage","Bind",0x00010000,"\Device\PCNet1"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Linkage","Export",0x00010000,"\Device\PCNet1" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Linkage","Export",0x00010000,"\Device\PCNet1"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Linkage","Route",0x00010000,"PCNet1" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Linkage","Route",0x00010000,"PCNet1"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","BUS_TO_SCAN",0x00000000,"ALL" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","BUS_TO_SCAN",0x00000000,"ALL"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","BUSTIMER",0x00000000,"0" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","BUSTIMER",0x00000000,"0"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","BUSTYPE",0x00000000,"5" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","BUSTYPE",0x00000000,"5"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","EXTPHY",0x00000000,"0" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","EXTPHY",0x00000000,"0"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","FDUP",0x00000000,"0" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","FDUP",0x00000000,"0"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","LED0",0x00000000,"10000" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","LED0",0x00000000,"10000"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","LED1",0x00000000,"10000" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","LED1",0x00000000,"10000"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","LED2",0x00000000,"10000" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","LED2",0x00000000,"10000"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","LED3",0x00000000,"10000" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","LED3",0x00000000,"10000"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","MPMODE",0x00000000,"0" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","MPMODE",0x00000000,"0"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","TP",0x00000000,"1" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","TP",0x00000000,"1"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","SlotNumber",0x00000000,"10" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","SlotNumber",0x00000000,"10"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","BusNumber",0x00000000,"0" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","BusNumber",0x00000000,"0"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","DefaultGateway",0x00010000,"10.1.0.1" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","DefaultGateway",0x00010000,"10.1.0.1"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","IPAddress",0x00010000,"10.1.0.100" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","IPAddress",0x00010000,"10.1.0.100"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0" HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0"
; ReactOS PCNet Driver ; ReactOS PCNet Driver
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","ErrorControl",0x00010001,0x00000001 ;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","ErrorControl",0x00010001,0x00000001
@ -428,12 +429,12 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip","Type",0x00010001,0x00000001
; These bindings are of the windows 2000 type, and will probably need to be ; These bindings are of the windows 2000 type, and will probably need to be
; twiddled to get 3rd-party network-related software to work. ; twiddled to get 3rd-party network-related software to work.
; NT4 puts additional stuff in the Bind, Export, and Route values. ; NT4 puts additional stuff in the Bind, Export, and Route values.
;HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Bind",0x00010000,"\Device\PCNet1", "\Device\Ne20001", "\Device\PCNet1" ;HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Bind",0x00010000,"\Device\PCNet1", "\Device\Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Bind",0x00010000, "\Device\Ne20001" HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Bind",0x00010000, "\Device\PCNet1"
;HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Export",0x00010000,"\Device\Tcpip_PCNet1", "\Device\Tcpip_Ne20001", "\Device\Tcpip_PCNet1" ;HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Export",0x00010000,"\Device\Tcpip_PCNet1", "\Device\Tcpip_Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Export",0x00010000, "\Device\Tcpip_Ne20001" HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Export",0x00010000, "\Device\Tcpip_PCNet1"
;HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Route",0x00010000,"PCNet1", "Ne20001", "PCNet1" ;HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Route",0x00010000,"PCNet1", "Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Route",0x00010000,"Ne20001" HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Route",0x00010000,"PCNet1"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","DataBasePath",0x00000000,"DataBasePath" HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","DataBasePath",0x00000000,"DataBasePath"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","Domain",0x00000000,"" HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","Domain",0x00000000,""
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","Hostname",0x00000000,"ROSHost" HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","Hostname",0x00000000,"ROSHost"

View file

@ -79,9 +79,9 @@ typedef struct _ORPHAN_ADATER {
} ORPHAN_ADAPTER, *PORPHAN_ADAPTER; } ORPHAN_ADAPTER, *PORPHAN_ADAPTER;
/* 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 */ KDPC MiniportDpc; /* DPC routine for adapter */
BOOLEAN MiniportBusy; /* A MiniportXxx routine is executing */ BOOLEAN MiniportBusy; /* A MiniportXxx routine is executing */
NDIS_HANDLE MiniportAdapterBinding; /* Binding handle for current caller */ NDIS_HANDLE MiniportAdapterBinding; /* Binding handle for current caller */
@ -89,7 +89,6 @@ typedef struct _LOGICAL_ADAPTER {
NDIS_MINIPORT_WORK_ITEM WorkQueue[NDIS_MINIPORT_WORK_QUEUE_SIZE]; NDIS_MINIPORT_WORK_ITEM WorkQueue[NDIS_MINIPORT_WORK_QUEUE_SIZE];
PNDIS_MINIPORT_WORK_ITEM WorkQueueHead; /* Head of work queue */ PNDIS_MINIPORT_WORK_ITEM WorkQueueHead; /* Head of work queue */
PNDIS_MINIPORT_WORK_ITEM WorkQueueTail; /* Tail of work queue */ PNDIS_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 */
@ -97,8 +96,7 @@ typedef struct _LOGICAL_ADAPTER {
PMINIPORT_DRIVER Miniport; /* Miniport owning this adapter */ PMINIPORT_DRIVER Miniport; /* Miniport owning this adapter */
UNICODE_STRING DeviceName; /* Device name of this adapter */ UNICODE_STRING DeviceName; /* Device name of this adapter */
ULONG Attributes; /* Attributes of adapter */ ULONG Attributes; /* Attributes of adapter */
/* TRUE if the miniport has called NdisSetAttributes(Ex) for this adapter */ BOOLEAN AttributesSet; /* Whether NdisMSetAttributes(Ex) has been called */
BOOLEAN AttributesSet;
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 */
@ -108,10 +106,8 @@ typedef struct _LOGICAL_ADAPTER {
ULONG LookaheadLength; /* Length of lookahead buffer */ ULONG LookaheadLength; /* Length of lookahead buffer */
ULONG CurLookaheadLength; /* Current (selected) length of lookahead buffer */ ULONG CurLookaheadLength; /* Current (selected) length of lookahead buffer */
ULONG MaxLookaheadLength; /* Maximum length of lookahead buffer */ ULONG MaxLookaheadLength; /* Maximum length of lookahead buffer */
PNDIS_PACKET PacketQueueHead; /* Head of packet queue */ PNDIS_PACKET PacketQueueHead; /* Head of packet queue */
PNDIS_PACKET PacketQueueTail; /* Head of packet queue */ PNDIS_PACKET PacketQueueTail; /* Head of packet queue */
PNDIS_PACKET LoopPacket; /* Current packet beeing looped */ PNDIS_PACKET LoopPacket; /* Current packet beeing looped */
PMINIPORT_BUGCHECK_CONTEXT BugcheckContext; /* Adapter's shutdown handler */ PMINIPORT_BUGCHECK_CONTEXT BugcheckContext; /* Adapter's shutdown handler */
UINT MapRegistersRequested; /* Number of outstanding map registers requested */ UINT MapRegistersRequested; /* Number of outstanding map registers requested */
@ -119,17 +115,17 @@ typedef struct _LOGICAL_ADAPTER {
ADAPTER_MAP_REGISTER_LIST MapRegisterList; /* List of allocated map registers */ ADAPTER_MAP_REGISTER_LIST MapRegisterList; /* List of allocated map registers */
KEVENT DmaEvent; /* Event to support DMA register allocation */ KEVENT DmaEvent; /* Event to support DMA register allocation */
KSPIN_LOCK DmaLock; /* Spinlock to protect the dma list */ KSPIN_LOCK DmaLock; /* Spinlock to protect the dma list */
UINT BusNumber; UINT BusNumber; /* The bus number of the adapter */
INTERFACE_TYPE BusType; INTERFACE_TYPE BusType; /* The bus type of the adapter */
UINT SlotNumber; UINT SlotNumber; /* The slot number of the adapter*/
ULONG Irql; ULONG Irql; /* The Irql assigned to the adapter */
ULONG Vector; ULONG Vector; /* The interrupt vector assigned to the adapter */
KAFFINITY Affinity; KAFFINITY Affinity; /* The processor affinity of the adapter */
PHYSICAL_ADDRESS BaseIoAddress; PHYSICAL_ADDRESS BaseIoAddress; /* The base IO address of the adapter */
PHYSICAL_ADDRESS BaseMemoryAddress; /* multiple ranges? */ PHYSICAL_ADDRESS BaseMemoryAddress; /* The base memory address of mapped memory for the adapter */
ULONG DmaChannel; ULONG DmaChannel; /* The DMA channel number of the adapter */
ULONG DmaPort; ULONG DmaPort; /* The DMA port number of the adapter */
PNDIS_MINIPORT_TIMER Timer; PNDIS_MINIPORT_TIMER Timer; /* The timer object of the adapter */
} LOGICAL_ADAPTER, *PLOGICAL_ADAPTER; } LOGICAL_ADAPTER, *PLOGICAL_ADAPTER;
#define GET_LOGICAL_ADAPTER(Handle)((PLOGICAL_ADAPTER)Handle) #define GET_LOGICAL_ADAPTER(Handle)((PLOGICAL_ADAPTER)Handle)
@ -206,3 +202,4 @@ NdisStartDevices();
#endif /* __MINIPORT_H */ #endif /* __MINIPORT_H */
/* EOF */ /* EOF */

View file

@ -10,7 +10,7 @@
#include <ndissys.h> #include <ndissys.h>
#include <net/ndis.h> #include <net/ndis.h>
#include "../include/miniport.h" #include "miniport.h"
typedef struct _PROTOCOL_BINDING { typedef struct _PROTOCOL_BINDING {
@ -52,3 +52,4 @@ ProIndicatePacket(
#endif /* __PROTOCOL_H */ #endif /* __PROTOCOL_H */
/* EOF */ /* EOF */

View file

@ -21,8 +21,8 @@ BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "CompanyName", RES_STR_COMPANY_NAME VALUE "CompanyName", RES_STR_COMPANY_NAME
VALUE "FileDescription", "NDIS library\0" VALUE "FileDescription", "NDIS Library\0"
VALUE "FileVersion", "0.0.0\0" VALUE "FileVersion", "0.1.4\0"
VALUE "InternalName", "ndis\0" VALUE "InternalName", "ndis\0"
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
VALUE "OriginalFilename", "ndis.sys\0" VALUE "OriginalFilename", "ndis.sys\0"

View file

@ -4,11 +4,14 @@
* FILE: ndis/control.c * FILE: ndis/control.c
* PURPOSE: Program control routines * PURPOSE: Program control routines
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
* Vizzini (vizzini@plasmic.com)
* REVISIONS: * REVISIONS:
* CSH 01/08-2000 Created * CSH 01/08-2000 Created
* 3 Oct 2003 Vizzini - Formatting and minor bugfixes
*/ */
#include <ndissys.h> #include <ndissys.h>
/* /*
* @implemented * @implemented
*/ */
@ -17,11 +20,11 @@ EXPORT
NdisReinitializePacket( NdisReinitializePacket(
IN OUT PNDIS_PACKET Packet) IN OUT PNDIS_PACKET Packet)
{ {
(Packet)->Private.Head = (PNDIS_BUFFER)NULL; (Packet)->Private.Head = (PNDIS_BUFFER)NULL;
(Packet)->Private.ValidCounts = FALSE; (Packet)->Private.ValidCounts = FALSE;
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -41,7 +44,7 @@ NdisAcquireReadWriteLock(
UNIMPLEMENTED UNIMPLEMENTED
} }
/* /*
* @implemented * @implemented
*/ */
@ -55,10 +58,10 @@ NdisAcquireSpinLock(
* SpinLock = Pointer to the initialized NDIS spin lock to be acquired * SpinLock = Pointer to the initialized NDIS spin lock to be acquired
*/ */
{ {
KeAcquireSpinLock(&SpinLock->SpinLock, &SpinLock->OldIrql); KeAcquireSpinLock(&SpinLock->SpinLock, &SpinLock->OldIrql);
} }
/* /*
* @implemented * @implemented
*/ */
@ -72,10 +75,10 @@ NdisAllocateSpinLock(
* SpinLock = Pointer to an NDIS spin lock structure * SpinLock = Pointer to an NDIS spin lock structure
*/ */
{ {
KeInitializeSpinLock(&SpinLock->SpinLock); KeInitializeSpinLock(&SpinLock->SpinLock);
} }
/* /*
* @implemented * @implemented
*/ */
@ -89,11 +92,11 @@ NdisDprAcquireSpinLock(
* SpinLock = Pointer to the initialized NDIS spin lock to be acquired * SpinLock = Pointer to the initialized NDIS spin lock to be acquired
*/ */
{ {
KeAcquireSpinLockAtDpcLevel(&SpinLock->SpinLock); KeAcquireSpinLockAtDpcLevel(&SpinLock->SpinLock);
SpinLock->OldIrql = DISPATCH_LEVEL; SpinLock->OldIrql = DISPATCH_LEVEL;
} }
/* /*
* @implemented * @implemented
*/ */
@ -107,10 +110,10 @@ NdisDprReleaseSpinLock(
* SpinLock = Pointer to the acquired NDIS spin lock to be released * SpinLock = Pointer to the acquired NDIS spin lock to be released
*/ */
{ {
KeReleaseSpinLockFromDpcLevel(&SpinLock->SpinLock); KeReleaseSpinLockFromDpcLevel(&SpinLock->SpinLock);
} }
/* /*
* @implemented * @implemented
*/ */
@ -124,10 +127,10 @@ NdisFreeSpinLock(
* SpinLock = Pointer to an initialized NDIS spin lock * SpinLock = Pointer to an initialized NDIS spin lock
*/ */
{ {
/* Nothing to do here! */ /* Nothing to do here! */
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -158,7 +161,7 @@ NdisInitializeEvent(
* Event = Pointer to an NDIS event structure to be initialized * Event = Pointer to an NDIS event structure to be initialized
*/ */
{ {
KeInitializeEvent(&Event->Event, NotificationEvent, FALSE); KeInitializeEvent(&Event->Event, NotificationEvent, FALSE);
} }
@ -175,7 +178,7 @@ NdisReleaseSpinLock(
* SpinLock = Pointer to the acquired NDIS spin lock to be released * SpinLock = Pointer to the acquired NDIS spin lock to be released
*/ */
{ {
KeReleaseSpinLock(&SpinLock->SpinLock, SpinLock->OldIrql); KeReleaseSpinLock(&SpinLock->SpinLock, SpinLock->OldIrql);
} }
@ -192,7 +195,7 @@ NdisResetEvent(
* Event = Pointer to the initialized event object to be reset * Event = Pointer to the initialized event object to be reset
*/ */
{ {
KeResetEvent(&Event->Event); KeResetEvent(&Event->Event);
} }
@ -209,7 +212,7 @@ NdisSetEvent(
* Event = Pointer to the initialized event object to be set * Event = Pointer to the initialized event object to be set
*/ */
{ {
KeSetEvent(&Event->Event, IO_NO_INCREMENT, FALSE); KeSetEvent(&Event->Event, IO_NO_INCREMENT, FALSE);
} }
@ -230,18 +233,15 @@ NdisWaitEvent(
* TRUE if the event is in the signaled state * TRUE if the event is in the signaled state
*/ */
{ {
LARGE_INTEGER Timeout; LARGE_INTEGER Timeout;
NTSTATUS Status; NTSTATUS Status;
Timeout.QuadPart = MsToWait * -10000LL; Timeout.QuadPart = MsToWait * -10000LL;
Status = KeWaitForSingleObject(&Event->Event, Status = KeWaitForSingleObject(&Event->Event, Executive, KernelMode, TRUE, &Timeout);
Executive,
KernelMode,
TRUE,
&Timeout);
return (Status == STATUS_SUCCESS); return (Status == STATUS_SUCCESS);
} }
/* EOF */ /* EOF */

View file

@ -7,12 +7,16 @@
* Vizzini (vizzini@plasmic.com) * Vizzini (vizzini@plasmic.com)
* REVISIONS: * REVISIONS:
* CSH 01/08-2000 Created * CSH 01/08-2000 Created
* 8/25/2003 Vizzini - NDIS4/5 and PnP additions * 25 Aug 2003 Vizzini - NDIS4/5 and PnP additions
* 3 Oct 2003 Vizzini - formatting and minor bugfixes
*
* TODO:
* - Fix HalGetBusDataByOffset() param 2 in most calls below
*/ */
#include <ndissys.h> #include <ndissys.h>
#include <miniport.h> #include <miniport.h>
/* /*
* @implemented * @implemented
*/ */
@ -25,15 +29,10 @@ NdisImmediateReadPciSlotInformation(
IN PVOID Buffer, IN PVOID Buffer,
IN ULONG Length) IN ULONG Length)
{ {
return HalGetBusDataByOffset (PCIConfiguration, return HalGetBusDataByOffset (PCIConfiguration, 0, SlotNumber, Buffer, Offset, Length);
0, /* FIXME */
SlotNumber,
Buffer,
Offset,
Length);
} }
/* /*
* @implemented * @implemented
*/ */
@ -46,15 +45,10 @@ NdisImmediateWritePciSlotInformation(
IN PVOID Buffer, IN PVOID Buffer,
IN ULONG Length) IN ULONG Length)
{ {
return HalSetBusDataByOffset (PCIConfiguration, return HalSetBusDataByOffset (PCIConfiguration, 0, SlotNumber, Buffer, Offset, Length);
0, /* FIXME */
SlotNumber,
Buffer,
Offset,
Length);
} }
/* /*
* @implemented * @implemented
*/ */
@ -88,13 +82,12 @@ NdisMPciAssignResources(
return NDIS_STATUS_FAILURE; return NDIS_STATUS_FAILURE;
} }
*AssignedResources = *AssignedResources = (PNDIS_RESOURCE_LIST)&ResourceList->List[0].PartialResourceList;
(PNDIS_RESOURCE_LIST)&ResourceList->List[0].PartialResourceList;
return NDIS_STATUS_SUCCESS; return NDIS_STATUS_SUCCESS;
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -124,10 +117,10 @@ NdisQueryMapRegisterCount(
* As such, we do what microsoft does on the x86 hals and return as follows * As such, we do what microsoft does on the x86 hals and return as follows
*/ */
{ {
return NDIS_STATUS_NOT_SUPPORTED; return NDIS_STATUS_NOT_SUPPORTED;
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -171,15 +164,10 @@ NdisReadPciSlotInformation(
IN PVOID Buffer, IN PVOID Buffer,
IN ULONG Length) IN ULONG Length)
{ {
return HalGetBusDataByOffset (PCIConfiguration, return HalGetBusDataByOffset (PCIConfiguration, 0, SlotNumber, Buffer, Offset, Length);
0, /* FIXME */
SlotNumber,
Buffer,
Offset,
Length);
} }
/* /*
* @implemented * @implemented
*/ */
@ -192,12 +180,8 @@ NdisWritePciSlotInformation(
IN PVOID Buffer, IN PVOID Buffer,
IN ULONG Length) IN ULONG Length)
{ {
return HalSetBusDataByOffset (PCIConfiguration, return HalSetBusDataByOffset (PCIConfiguration, 0, SlotNumber, Buffer, Offset, Length);
0, /* FIXME */
SlotNumber,
Buffer,
Offset,
Length);
} }
/* EOF */ /* EOF */

View file

@ -7,11 +7,13 @@
* Vizzini (vizzini@plasmic.com) * Vizzini (vizzini@plasmic.com)
* REVISIONS: * REVISIONS:
* CSH 01/08-2000 Created * CSH 01/08-2000 Created
* 8-20-2003 Vizzini - DMA support * 20 Aug 2003 Vizzini - DMA support
* 3 Oct 2003 Vizzini - Formatting and minor bugfixes
*/ */
#include <ndissys.h> #include <ndissys.h>
#include <miniport.h> #include <miniport.h>
VOID STDCALL HandleDeferredProcessing( VOID STDCALL HandleDeferredProcessing(
IN PKDPC Dpc, IN PKDPC Dpc,
IN PVOID DeferredContext, IN PVOID DeferredContext,
@ -26,32 +28,48 @@ VOID STDCALL HandleDeferredProcessing(
* SystemArgument2 = Unused * SystemArgument2 = Unused
*/ */
{ {
BOOLEAN WasBusy; BOOLEAN WasBusy;
PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(DeferredContext); PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(DeferredContext);
NDIS_DbgPrint(MAX_TRACE, ("Called.\n")); NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock); ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
WasBusy = Adapter->MiniportBusy;
Adapter->MiniportBusy = TRUE;
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
/* Call the deferred interrupt service handler for this adapter */ /* XXX try to grok WasBusy */
(*Adapter->Miniport->Chars.HandleInterruptHandler)( KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
{
WasBusy = Adapter->MiniportBusy;
Adapter->MiniportBusy = TRUE;
}
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
/* Call the deferred interrupt service handler for this adapter */
(*Adapter->Miniport->Chars.HandleInterruptHandler)(
Adapter->NdisMiniportBlock.MiniportAdapterContext);
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
{
if ((!WasBusy) && (Adapter->WorkQueueHead))
{
KeInsertQueueDpc(&Adapter->MiniportDpc, NULL, NULL);
}
else
{
Adapter->MiniportBusy = WasBusy;
}
}
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
/* re-enable the interrupt */
NDIS_DbgPrint(MAX_TRACE, ("re-enabling the interrupt\n"));
if(Adapter->Miniport->Chars.EnableInterruptHandler)
(*Adapter->Miniport->Chars.EnableInterruptHandler)(
Adapter->NdisMiniportBlock.MiniportAdapterContext); Adapter->NdisMiniportBlock.MiniportAdapterContext);
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock); NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
if ((!WasBusy) && (Adapter->WorkQueueHead)) {
KeInsertQueueDpc(&Adapter->MiniportDpc, NULL, NULL);
} else {
Adapter->MiniportBusy = WasBusy;
}
KeReleaseSpinLockFromDpcLevel(&Adapter->NdisMiniportBlock.Lock);
NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
} }
BOOLEAN STDCALL ServiceRoutine( BOOLEAN STDCALL ServiceRoutine(
IN PKINTERRUPT Interrupt, IN PKINTERRUPT Interrupt,
IN PVOID ServiceContext) IN PVOID ServiceContext)
@ -64,27 +82,28 @@ BOOLEAN STDCALL ServiceRoutine(
* TRUE if a miniport controlled device generated the interrupt * TRUE if a miniport controlled device generated the interrupt
*/ */
{ {
BOOLEAN InterruptRecognized; BOOLEAN InterruptRecognized;
BOOLEAN QueueMiniportHandleInterrupt; BOOLEAN QueueMiniportHandleInterrupt;
PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(ServiceContext); PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(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->Miniport->Chars.ISRHandler)(&InterruptRecognized,
&QueueMiniportHandleInterrupt, &QueueMiniportHandleInterrupt,
Adapter->NdisMiniportBlock.MiniportAdapterContext); Adapter->NdisMiniportBlock.MiniportAdapterContext);
if (QueueMiniportHandleInterrupt) { if (QueueMiniportHandleInterrupt)
NDIS_DbgPrint(MAX_TRACE, ("Queueing DPC.\n")); {
KeInsertQueueDpc(&Adapter->NdisMiniportBlock.Interrupt->InterruptDpc, NULL, NULL); NDIS_DbgPrint(MAX_TRACE, ("Queueing DPC.\n"));
KeInsertQueueDpc(&Adapter->NdisMiniportBlock.Interrupt->InterruptDpc, NULL, NULL);
} }
NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n")); NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
return InterruptRecognized; return InterruptRecognized;
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -101,7 +120,7 @@ NdisCompleteDmaTransfer(
UNIMPLEMENTED UNIMPLEMENTED
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -114,7 +133,7 @@ NdisFlushBuffer(
UNIMPLEMENTED UNIMPLEMENTED
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -125,10 +144,10 @@ NdisGetCacheFillSize(
{ {
UNIMPLEMENTED UNIMPLEMENTED
return 0; return 0;
} }
/* /*
* @implemented * @implemented
*/ */
@ -139,11 +158,11 @@ NdisImmediateReadPortUchar(
IN ULONG Port, IN ULONG Port,
OUT PUCHAR Data) OUT PUCHAR Data)
{ {
NDIS_DbgPrint(MAX_TRACE, ("Called.\n")); NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
*Data = READ_PORT_UCHAR((PUCHAR)Port); // FIXME: What to do with WrapperConfigurationContext? *Data = READ_PORT_UCHAR((PUCHAR)Port); // FIXME: What to do with WrapperConfigurationContext?
} }
/* /*
* @implemented * @implemented
*/ */
@ -154,11 +173,11 @@ NdisImmediateReadPortUlong(
IN ULONG Port, IN ULONG Port,
OUT PULONG Data) OUT PULONG Data)
{ {
NDIS_DbgPrint(MAX_TRACE, ("Called.\n")); NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
*Data = READ_PORT_ULONG((PULONG)Port); // FIXME: What to do with WrapperConfigurationContext? *Data = READ_PORT_ULONG((PULONG)Port); // FIXME: What to do with WrapperConfigurationContext?
} }
/* /*
* @implemented * @implemented
*/ */
@ -169,11 +188,11 @@ NdisImmediateReadPortUshort(
IN ULONG Port, IN ULONG Port,
OUT PUSHORT Data) OUT PUSHORT Data)
{ {
NDIS_DbgPrint(MAX_TRACE, ("Called.\n")); NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
*Data = READ_PORT_USHORT((PUSHORT)Port); // FIXME: What to do with WrapperConfigurationContext? *Data = READ_PORT_USHORT((PUSHORT)Port); // FIXME: What to do with WrapperConfigurationContext?
} }
/* /*
* @implemented * @implemented
*/ */
@ -184,11 +203,11 @@ NdisImmediateWritePortUchar(
IN ULONG Port, IN ULONG Port,
IN UCHAR Data) IN UCHAR Data)
{ {
NDIS_DbgPrint(MAX_TRACE, ("Called.\n")); NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
WRITE_PORT_UCHAR((PUCHAR)Port, Data); // FIXME: What to do with WrapperConfigurationContext? WRITE_PORT_UCHAR((PUCHAR)Port, Data); // FIXME: What to do with WrapperConfigurationContext?
} }
/* /*
* @implemented * @implemented
*/ */
@ -199,11 +218,11 @@ NdisImmediateWritePortUlong(
IN ULONG Port, IN ULONG Port,
IN ULONG Data) IN ULONG Data)
{ {
NDIS_DbgPrint(MAX_TRACE, ("Called.\n")); NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
WRITE_PORT_ULONG((PULONG)Port, Data); // FIXME: What to do with WrapperConfigurationContext? WRITE_PORT_ULONG((PULONG)Port, Data); // FIXME: What to do with WrapperConfigurationContext?
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -214,11 +233,11 @@ NdisImmediateWritePortUshort(
IN ULONG Port, IN ULONG Port,
IN USHORT Data) IN USHORT Data)
{ {
NDIS_DbgPrint(MAX_TRACE, ("Called.\n")); NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
WRITE_PORT_USHORT((PUSHORT)Port, Data); // FIXME: What to do with WrapperConfigurationContext? WRITE_PORT_USHORT((PUSHORT)Port, Data); // FIXME: What to do with WrapperConfigurationContext?
} }
IO_ALLOCATION_ACTION NdisMapRegisterCallback ( IO_ALLOCATION_ACTION NdisMapRegisterCallback (
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp, IN PIRP Irp,
@ -383,7 +402,7 @@ NdisMAllocateMapRegisters(
return NDIS_STATUS_SUCCESS; return NDIS_STATUS_SUCCESS;
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -400,7 +419,7 @@ NdisMCompleteDmaTransfer(
UNIMPLEMENTED UNIMPLEMENTED
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -412,7 +431,7 @@ NdisMDeregisterDmaChannel(
UNIMPLEMENTED UNIMPLEMENTED
} }
/* /*
* @implemented * @implemented
*/ */
@ -430,7 +449,7 @@ NdisMDeregisterInterrupt(
IoDisconnectInterrupt(Interrupt->InterruptObject); IoDisconnectInterrupt(Interrupt->InterruptObject);
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -450,10 +469,10 @@ NdisMDeregisterIoPortRange(
* PortOffset = Pointer to mapped base port address * PortOffset = Pointer to mapped base port address
*/ */
{ {
NDIS_DbgPrint(MAX_TRACE, ("Called.\n")); NDIS_DbgPrint(MAX_TRACE, ("called - IMPLEMENT ME.\n"));
} }
/* /*
* @implemented * @implemented
*/ */
@ -491,7 +510,7 @@ NdisMFreeMapRegisters(
KeLowerIrql(OldIrql); KeLowerIrql(OldIrql);
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -505,10 +524,10 @@ NdisMMapIoSpace(
{ {
UNIMPLEMENTED UNIMPLEMENTED
return NDIS_STATUS_FAILURE; return NDIS_STATUS_FAILURE;
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -519,10 +538,10 @@ NdisMReadDmaCounter(
{ {
UNIMPLEMENTED UNIMPLEMENTED
return 0; return 0;
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -538,9 +557,10 @@ NdisMRegisterDmaChannel(
{ {
UNIMPLEMENTED UNIMPLEMENTED
return NDIS_STATUS_FAILURE; return NDIS_STATUS_FAILURE;
} }
/* /*
* @implemented * @implemented
*/ */
@ -568,67 +588,52 @@ NdisMRegisterInterrupt(
* Status of operation * Status of operation
*/ */
{ {
NTSTATUS Status; NTSTATUS Status;
ULONG MappedIRQ; ULONG MappedIRQ;
KIRQL DIrql; KIRQL DIrql;
KAFFINITY Affinity; KAFFINITY Affinity;
PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(MiniportAdapterHandle); PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(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",
InterruptVector, InterruptLevel, SharedInterrupt, InterruptMode)); InterruptVector, InterruptLevel, SharedInterrupt, InterruptMode));
RtlZeroMemory(Interrupt, sizeof(NDIS_MINIPORT_INTERRUPT)); RtlZeroMemory(Interrupt, sizeof(NDIS_MINIPORT_INTERRUPT));
KeInitializeSpinLock(&Interrupt->DpcCountLock); KeInitializeSpinLock(&Interrupt->DpcCountLock);
KeInitializeDpc(&Interrupt->InterruptDpc, KeInitializeDpc(&Interrupt->InterruptDpc, HandleDeferredProcessing, Adapter);
HandleDeferredProcessing,
Adapter);
KeInitializeEvent(&Interrupt->DpcsCompletedEvent, KeInitializeEvent(&Interrupt->DpcsCompletedEvent, NotificationEvent, FALSE);
NotificationEvent,
FALSE);
Interrupt->SharedInterrupt = SharedInterrupt; Interrupt->SharedInterrupt = SharedInterrupt;
Adapter->NdisMiniportBlock.Interrupt = Interrupt; Adapter->NdisMiniportBlock.Interrupt = Interrupt;
MappedIRQ = HalGetInterruptVector(Adapter->BusType, MappedIRQ = HalGetInterruptVector(Adapter->BusType, Adapter->BusNumber, InterruptLevel, InterruptVector, &DIrql, &Affinity);
Adapter->BusNumber,
InterruptLevel,
InterruptVector,
&DIrql,
&Affinity);
NDIS_DbgPrint(MAX_TRACE, ("Connecting to interrupt vector (0x%X) Affinity (0x%X).\n", MappedIRQ, Affinity)); NDIS_DbgPrint(MAX_TRACE, ("Connecting to interrupt vector (0x%X) Affinity (0x%X).\n", MappedIRQ, Affinity));
Status = IoConnectInterrupt(&Interrupt->InterruptObject, Status = IoConnectInterrupt(&Interrupt->InterruptObject, ServiceRoutine, Adapter, &Interrupt->DpcCountLock, MappedIRQ,
ServiceRoutine, DIrql, DIrql, InterruptMode, SharedInterrupt, Affinity, FALSE);
Adapter,
&Interrupt->DpcCountLock,
MappedIRQ,
DIrql,
DIrql,
InterruptMode,
SharedInterrupt,
Affinity,
FALSE);
NDIS_DbgPrint(MAX_TRACE, ("Leaving. Status (0x%X).\n", Status)); NDIS_DbgPrint(MAX_TRACE, ("Leaving. Status (0x%X).\n", Status));
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
return NDIS_STATUS_SUCCESS; return NDIS_STATUS_SUCCESS;
if (Status == STATUS_INSUFFICIENT_RESOURCES) { if (Status == STATUS_INSUFFICIENT_RESOURCES)
{
/* FIXME: Log error */ /* FIXME: Log error */
return NDIS_STATUS_RESOURCE_CONFLICT; NDIS_DbgPrint(MIN_TRACE, ("Resource conflict!\n"));
return NDIS_STATUS_RESOURCE_CONFLICT;
} }
return NDIS_STATUS_FAILURE; NDIS_DbgPrint(MIN_TRACE, ("Function failed\n"));
return NDIS_STATUS_FAILURE;
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -727,3 +732,4 @@ NdisMUnmapIoSpace(
} }
/* EOF */ /* EOF */

View file

@ -7,7 +7,8 @@
* Vizzini (vizzini@plasmic.com) * Vizzini (vizzini@plasmic.com)
* REVISIONS: * REVISIONS:
* CSH 01/08-2000 Created * CSH 01/08-2000 Created
* 8/20/2003 Vizzini - NDIS4/5 revisions * 20 Aug 2003 Vizzini - NDIS4/5 revisions
* 3 Oct 2003 Vizzini - formatting and minor bugfixing
*/ */
#include <ndissys.h> #include <ndissys.h>
#include <protocol.h> #include <protocol.h>
@ -25,6 +26,7 @@ DWORD DebugTraceLevel = MIN_TRACE;
extern KSPIN_LOCK OrphanAdapterListLock; extern KSPIN_LOCK OrphanAdapterListLock;
extern LIST_ENTRY OrphanAdapterListHead; extern LIST_ENTRY OrphanAdapterListHead;
VOID MainUnload( VOID MainUnload(
PDRIVER_OBJECT DriverObject) PDRIVER_OBJECT DriverObject)
/* /*
@ -33,9 +35,10 @@ VOID MainUnload(
* DriverObject = Pointer to driver object created by the system * DriverObject = Pointer to driver object created by the system
*/ */
{ {
NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n")); NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
} }
NTSTATUS NTSTATUS
STDCALL STDCALL
DriverEntry( DriverEntry(
@ -76,6 +79,7 @@ DriverEntry(
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
/* /*
* @implemented * @implemented
*/ */
@ -103,13 +107,10 @@ NdisWriteErrorLogEntry(
*/ */
{ {
NDIS_DbgPrint(MIN_TRACE, ("ERROR: ErrorCode 0x%x\n", ErrorCode)); NDIS_DbgPrint(MIN_TRACE, ("ERROR: ErrorCode 0x%x\n", ErrorCode));
ASSERT(0);
#if DBG
/* break into a debugger so we can see what's up */
__asm__("int $3\n");
#endif
} }
/* /*
* @implemented * @implemented
*/ */
@ -128,6 +129,7 @@ NdisInitializeReadWriteLock(
memset(Lock,0,sizeof(NDIS_RW_LOCK)); memset(Lock,0,sizeof(NDIS_RW_LOCK));
} }
/* /*
* @implemented * @implemented
*/ */

View file

@ -7,11 +7,13 @@
* Vizzini (vizzini@plasmic.com) * Vizzini (vizzini@plasmic.com)
* REVISIONS: * REVISIONS:
* CSH 01/08-2000 Created * CSH 01/08-2000 Created
* 8/15/2003 Vizzini - DMA support * 15 Aug 2003 Vizzini - DMA support
* 3 Oct 2003 Vizzini - formatting and minor bugfixing
*/ */
#include <ndissys.h> #include <ndissys.h>
#include <miniport.h> #include <miniport.h>
/* /*
* @implemented * @implemented
*/ */
@ -45,7 +47,7 @@ NdisAllocateMemoryWithTag(
return NDIS_STATUS_SUCCESS; return NDIS_STATUS_SUCCESS;
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -59,7 +61,7 @@ NdisCreateLookaheadBufferFromSharedMemory(
UNIMPLEMENTED UNIMPLEMENTED
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -71,7 +73,7 @@ NdisDestroyLookaheadBufferFromSharedMemory(
UNIMPLEMENTED UNIMPLEMENTED
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -85,7 +87,7 @@ NdisMoveFromMappedMemory(
UNIMPLEMENTED UNIMPLEMENTED
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -99,7 +101,7 @@ NdisMoveMappedMemory(
RtlCopyMemory(Destination,Source,Length); RtlCopyMemory(Destination,Source,Length);
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -113,7 +115,7 @@ NdisMoveToMappedMemory(
UNIMPLEMENTED UNIMPLEMENTED
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -128,7 +130,7 @@ NdisMUpdateSharedMemory(
UNIMPLEMENTED UNIMPLEMENTED
} }
/* /*
* @implemented * @implemented
*/ */
@ -180,7 +182,7 @@ NdisAllocateMemory(
return NDIS_STATUS_SUCCESS; return NDIS_STATUS_SUCCESS;
} }
/* /*
* @implemented * @implemented
*/ */
@ -215,7 +217,7 @@ NdisFreeMemory(
ExFreePool(VirtualAddress); ExFreePool(VirtualAddress);
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -230,7 +232,7 @@ NdisImmediateReadSharedMemory(
UNIMPLEMENTED UNIMPLEMENTED
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -245,7 +247,7 @@ NdisImmediateWriteSharedMemory(
UNIMPLEMENTED UNIMPLEMENTED
} }
/* /*
* @implemented * @implemented
*/ */
@ -276,7 +278,7 @@ NdisMAllocateSharedMemory(
*VirtualAddress = HalAllocateCommonBuffer(Adapter->AdapterObject, Length, PhysicalAddress, Cached); *VirtualAddress = HalAllocateCommonBuffer(Adapter->AdapterObject, Length, PhysicalAddress, Cached);
} }
/* /*
* @unimplemented * @unimplemented
*/ */
@ -291,9 +293,10 @@ NdisMAllocateSharedMemoryAsync(
NDIS_DbgPrint(MAX_TRACE, ("Called.\n")); NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
UNIMPLEMENTED UNIMPLEMENTED
return NDIS_STATUS_FAILURE; return NDIS_STATUS_FAILURE;
} }
/* /*
* @implemented * @implemented
*/ */
@ -321,7 +324,7 @@ NdisMFreeSharedMemoryPassive(
ExFreePool(Memory); ExFreePool(Memory);
} }
/* /*
* @implemented * @implemented
*/ */

File diff suppressed because it is too large Load diff

View file

@ -76,6 +76,7 @@ ProIndicatePacket(
NdisQueryPacket(Packet, NULL, NULL, NULL, &PacketLength); NdisQueryPacket(Packet, NULL, NULL, NULL, &PacketLength);
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql); KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
{ {
Adapter->LoopPacket = Packet; Adapter->LoopPacket = Packet;
@ -95,6 +96,7 @@ ProIndicatePacket(
MiniIndicateData(Adapter, NULL, Adapter->LookaheadBuffer, Adapter->MediumHeaderSize, NULL, 0, 0); MiniIndicateData(Adapter, NULL, Adapter->LookaheadBuffer, Adapter->MediumHeaderSize, NULL, 0, 0);
} }
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql); KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
{ {
Adapter->LoopPacket = NULL; Adapter->LoopPacket = NULL;
@ -119,7 +121,7 @@ ProRequest(
*/ */
{ {
KIRQL OldIrql; KIRQL OldIrql;
BOOLEAN QueueWorkItem; BOOLEAN QueueWorkItem = FALSE;
NDIS_STATUS NdisStatus; NDIS_STATUS NdisStatus;
PADAPTER_BINDING AdapterBinding; PADAPTER_BINDING AdapterBinding;
PLOGICAL_ADAPTER Adapter; PLOGICAL_ADAPTER Adapter;
@ -135,12 +137,16 @@ ProRequest(
/* /*
* If the miniport is already busy, queue a workitem * If the miniport is already busy, queue a workitem
*/ */
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql); KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
{ {
if(Adapter->MiniportBusy) if(Adapter->MiniportBusy)
QueueWorkItem = TRUE; QueueWorkItem = TRUE;
else else
Adapter->MiniportBusy = TRUE; {
NDIS_DbgPrint(MAX_TRACE, ("Setting adapter 0x%x to busy\n"));
Adapter->MiniportBusy = TRUE;
}
} }
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql); KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
@ -156,8 +162,10 @@ ProRequest(
{ {
NdisStatus = MiniDoRequest(Adapter, NdisRequest); NdisStatus = MiniDoRequest(Adapter, NdisRequest);
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock); KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
{ {
NDIS_DbgPrint(MAX_TRACE, ("Setting adapter 0x%x to free\n"));
Adapter->MiniportBusy = FALSE; Adapter->MiniportBusy = FALSE;
if (Adapter->WorkQueueHead) if (Adapter->WorkQueueHead)
@ -202,7 +210,7 @@ ProSend(
*/ */
{ {
KIRQL RaiseOldIrql, SpinOldIrql; KIRQL RaiseOldIrql, SpinOldIrql;
BOOLEAN QueueWorkItem; BOOLEAN QueueWorkItem = FALSE;
NDIS_STATUS NdisStatus; NDIS_STATUS NdisStatus;
PADAPTER_BINDING AdapterBinding; PADAPTER_BINDING AdapterBinding;
PLOGICAL_ADAPTER Adapter; PLOGICAL_ADAPTER Adapter;
@ -229,6 +237,7 @@ ProSend(
* Else we don't do anything because we have to queue a workitem * Else we don't do anything because we have to queue a workitem
* anyway. * anyway.
*/ */
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &SpinOldIrql); KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &SpinOldIrql);
{ {
/* /*
@ -239,7 +248,10 @@ ProSend(
if (Adapter->MiniportBusy) if (Adapter->MiniportBusy)
QueueWorkItem = TRUE; QueueWorkItem = TRUE;
else else
Adapter->MiniportBusy = TRUE; {
NDIS_DbgPrint(MAX_TRACE, ("Setting adapter 0x%x to busy\n"));
Adapter->MiniportBusy = TRUE;
}
} }
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, SpinOldIrql); KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, SpinOldIrql);
@ -271,8 +283,10 @@ ProSend(
*/ */
NdisStatus = ProIndicatePacket(Adapter, Packet); NdisStatus = ProIndicatePacket(Adapter, Packet);
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock); KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
{ {
NDIS_DbgPrint(MAX_TRACE, ("Setting adapter 0x%x to free\n"));
Adapter->MiniportBusy = FALSE; Adapter->MiniportBusy = FALSE;
if (Adapter->WorkQueueHead) if (Adapter->WorkQueueHead)
@ -317,6 +331,7 @@ ProSend(
KeLowerIrql(RaiseOldIrql); KeLowerIrql(RaiseOldIrql);
/* XXX why the hell do we do this? */ /* XXX why the hell do we do this? */
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &SpinOldIrql); KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &SpinOldIrql);
{ {
if (Adapter->WorkQueueHead) if (Adapter->WorkQueueHead)
@ -342,6 +357,7 @@ ProSend(
NDIS_DbgPrint(MAX_TRACE, ("back from miniport's send handler\n")); NDIS_DbgPrint(MAX_TRACE, ("back from miniport's send handler\n"));
/* XXX why the hell do we do this? */ /* XXX why the hell do we do this? */
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock); KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
{ {
if (Adapter->WorkQueueHead) if (Adapter->WorkQueueHead)
@ -442,6 +458,7 @@ NdisCloseAdapter(
KeReleaseSpinLock(&AdapterBinding->ProtocolBinding->Lock, OldIrql); KeReleaseSpinLock(&AdapterBinding->ProtocolBinding->Lock, OldIrql);
/* Remove protocol from adapter's bound protocols list */ /* Remove protocol from adapter's bound protocols list */
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLock(&AdapterBinding->Adapter->NdisMiniportBlock.Lock, &OldIrql); KeAcquireSpinLock(&AdapterBinding->Adapter->NdisMiniportBlock.Lock, &OldIrql);
RemoveEntryList(&AdapterBinding->AdapterListEntry); RemoveEntryList(&AdapterBinding->AdapterListEntry);
KeReleaseSpinLock(&AdapterBinding->Adapter->NdisMiniportBlock.Lock, OldIrql); KeReleaseSpinLock(&AdapterBinding->Adapter->NdisMiniportBlock.Lock, OldIrql);
@ -518,85 +535,90 @@ NdisOpenAdapter(
* AddressingInformation = Optional pointer to buffer with NIC specific information * AddressingInformation = Optional pointer to buffer with NIC specific information
*/ */
{ {
UINT i; UINT i;
BOOLEAN Found; BOOLEAN Found;
PLOGICAL_ADAPTER Adapter; PLOGICAL_ADAPTER Adapter;
PADAPTER_BINDING AdapterBinding; PADAPTER_BINDING AdapterBinding;
PPROTOCOL_BINDING Protocol = GET_PROTOCOL_BINDING(NdisProtocolHandle); PPROTOCOL_BINDING Protocol = GET_PROTOCOL_BINDING(NdisProtocolHandle);
NDIS_DbgPrint(MAX_TRACE, ("Called.\n")); NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
if(!NdisProtocolHandle) if(!NdisProtocolHandle)
{ {
NDIS_DbgPrint(MAX_TRACE, ("NdisProtocolHandle is NULL\n")); NDIS_DbgPrint(MAX_TRACE, ("NdisProtocolHandle is NULL\n"));
*OpenErrorStatus = *Status = NDIS_STATUS_FAILURE; *OpenErrorStatus = *Status = NDIS_STATUS_FAILURE;
return; return;
}
Adapter = MiniLocateDevice(AdapterName);
if (!Adapter) {
NDIS_DbgPrint(MIN_TRACE, ("Adapter not found.\n"));
*Status = NDIS_STATUS_ADAPTER_NOT_FOUND;
return;
} }
/* Find the media type in the list provided by the protocol driver */ Adapter = MiniLocateDevice(AdapterName);
Found = FALSE; if (!Adapter)
for (i = 0; i < MediumArraySize; i++) { {
if (Adapter->NdisMiniportBlock.MediaType == MediumArray[i]) { NDIS_DbgPrint(MIN_TRACE, ("Adapter not found.\n"));
*SelectedMediumIndex = i; *Status = NDIS_STATUS_ADAPTER_NOT_FOUND;
Found = TRUE; return;
break; }
/* Find the media type in the list provided by the protocol driver */
Found = FALSE;
for (i = 0; i < MediumArraySize; i++)
{
if (Adapter->NdisMiniportBlock.MediaType == MediumArray[i])
{
*SelectedMediumIndex = i;
Found = TRUE;
break;
} }
} }
if (!Found) { if (!Found)
NDIS_DbgPrint(MIN_TRACE, ("Medium is not supported.\n")); {
*Status = NDIS_STATUS_UNSUPPORTED_MEDIA; NDIS_DbgPrint(MIN_TRACE, ("Medium is not supported.\n"));
return; *Status = NDIS_STATUS_UNSUPPORTED_MEDIA;
return;
} }
AdapterBinding = ExAllocatePool(NonPagedPool, sizeof(ADAPTER_BINDING)); /* Now that we have confirmed that the adapter can be opened, create a binding */
if (!AdapterBinding) {
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n")); AdapterBinding = ExAllocatePool(NonPagedPool, sizeof(ADAPTER_BINDING));
*Status = NDIS_STATUS_RESOURCES; if (!AdapterBinding)
return; {
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
*Status = NDIS_STATUS_RESOURCES;
return;
} }
RtlZeroMemory(AdapterBinding, sizeof(ADAPTER_BINDING)); RtlZeroMemory(AdapterBinding, sizeof(ADAPTER_BINDING));
AdapterBinding->ProtocolBinding = Protocol; AdapterBinding->ProtocolBinding = Protocol;
AdapterBinding->Adapter = Adapter; AdapterBinding->Adapter = Adapter;
AdapterBinding->NdisOpenBlock.ProtocolBindingContext = ProtocolBindingContext; AdapterBinding->NdisOpenBlock.ProtocolBindingContext = ProtocolBindingContext;
/* Set fields required by some NDIS macros */ /* Set fields required by some NDIS macros */
AdapterBinding->NdisOpenBlock.MacBindingHandle = (NDIS_HANDLE)AdapterBinding; AdapterBinding->NdisOpenBlock.MacBindingHandle = (NDIS_HANDLE)AdapterBinding;
/* Set handlers (some NDIS macros require these) */ /* Set handlers (some NDIS macros require these) */
AdapterBinding->NdisOpenBlock.RequestHandler = ProRequest; AdapterBinding->NdisOpenBlock.RequestHandler = ProRequest;
AdapterBinding->NdisOpenBlock.ResetHandler = ProReset; AdapterBinding->NdisOpenBlock.ResetHandler = ProReset;
AdapterBinding->NdisOpenBlock.u1.SendHandler = ProSend; AdapterBinding->NdisOpenBlock.u1.SendHandler = ProSend;
AdapterBinding->NdisOpenBlock.SendPacketsHandler = ProSendPackets; AdapterBinding->NdisOpenBlock.SendPacketsHandler = ProSendPackets;
AdapterBinding->NdisOpenBlock.TransferDataHandler = ProTransferData; AdapterBinding->NdisOpenBlock.TransferDataHandler = ProTransferData;
#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 */
/* Put on protocol's bound adapters list */ /* Put on protocol's bound adapters list */
ExInterlockedInsertTailList(&Protocol->AdapterListHead, ExInterlockedInsertTailList(&Protocol->AdapterListHead, &AdapterBinding->ProtocolListEntry, &Protocol->Lock);
&AdapterBinding->ProtocolListEntry,
&Protocol->Lock);
#endif #endif
/* XXX so does this */
/* Put protocol on adapter's bound protocols list */
ExInterlockedInsertTailList(&Adapter->ProtocolListHead,
&AdapterBinding->AdapterListEntry,
&Adapter->NdisMiniportBlock.Lock);
*NdisBindingHandle = (NDIS_HANDLE)AdapterBinding; /* XXX so does this */
/* Put protocol on adapter's bound protocols list */
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
ExInterlockedInsertTailList(&Adapter->ProtocolListHead, &AdapterBinding->AdapterListEntry, &Adapter->NdisMiniportBlock.Lock);
*Status = NDIS_STATUS_SUCCESS; *NdisBindingHandle = (NDIS_HANDLE)AdapterBinding;
*Status = NDIS_STATUS_SUCCESS;
} }

View file

@ -4,33 +4,41 @@
* FILE: ndis/string.c * FILE: ndis/string.c
* PURPOSE: String management routines * PURPOSE: String management routines
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
* Vizzini (vizzini@plasmic.com)
* REVISIONS: * REVISIONS:
* CSH 01/08-2000 Created * CSH 01/08-2000 Created
* Vizzini 08-Oct-2003 Error checking, documentation, and formatting
*/ */
#include <ndissys.h> #include <ndissys.h>
/* /*
* @implemented * @implemented
*/ */
NDIS_STATUS NDIS_STATUS
EXPORT EXPORT
NdisAnsiStringToUnicodeString( NdisAnsiStringToUnicodeString(
IN OUT PNDIS_STRING DestinationString, IN OUT PNDIS_STRING DestinationString,
IN PANSI_STRING SourceString) IN PANSI_STRING SourceString)
/* /*
* FUNCTION: Converts an ANSI string to an NDIS (unicode) string * FUNCTION: Converts an ANSI string to an NDIS (unicode) string
* ARGUMENTS: * ARGUMENTS:
* DestinationString = Address of buffer to place converted string in * DestinationString = Address of buffer to place converted string in
* SourceString = Pointer to ANSI string to be converted * SourceString = Pointer to ANSI string to be converted
* NOTES:
* - caller must be running at IRQL = PASSIVE_LEVEL
*/ */
{ {
return (NDIS_STATUS)RtlAnsiStringToUnicodeString( PAGED_CODE();
(PUNICODE_STRING)DestinationString, ASSERT(DestinationString);
(PANSI_STRING)SourceString, FALSE); ASSERT(SourceString);
return (NDIS_STATUS)RtlAnsiStringToUnicodeString(
(PUNICODE_STRING)DestinationString,
(PANSI_STRING)SourceString, FALSE);
} }
/* /*
* @implemented * @implemented
*/ */
@ -46,15 +54,20 @@ NdisEqualString(
* String1 = Pointer to first string * String1 = Pointer to first string
* String2 = Pointer to second string * String2 = Pointer to second string
* CaseInsensitive = TRUE if the compare should be case insensitive * CaseInsensitive = TRUE if the compare should be case insensitive
* NOTES:
* - caller must be at IRQL = PASSIVE_LEVEL
*/ */
{ {
return RtlEqualUnicodeString( PAGED_CODE();
(PUNICODE_STRING)String1, ASSERT(String1);
(PUNICODE_STRING)String2, ASSERT(String2);
CaseInsensitive);
return RtlEqualUnicodeString((PUNICODE_STRING)String1,
(PUNICODE_STRING)String2,
CaseInsensitive);
} }
/* /*
* @implemented * @implemented
*/ */
@ -62,20 +75,23 @@ VOID
EXPORT EXPORT
NdisInitAnsiString( NdisInitAnsiString(
IN OUT PANSI_STRING DestinationString, IN OUT PANSI_STRING DestinationString,
IN PCSTR SourceString) IN PCSTR SourceString)
/* /*
* FUNCTION: Initializes an ANSI string * FUNCTION: Initializes an ANSI string
* ARGUMENTS: * ARGUMENTS:
* DestinationString = Address of buffer to place string in * DestinationString = Address of buffer to place string in
* SourceString = Pointer to null terminated ANSI string * SourceString = Pointer to null terminated ANSI string
* NOTES:
* - Caller must be at IRQL <= DISPATCH_LEVEL
*/ */
{ {
RtlInitString( ASSERT(DestinationString);
(PANSI_STRING)DestinationString, ASSERT(SourceString);
(PCSZ)SourceString);
RtlInitString((PANSI_STRING)DestinationString, (PCSZ)SourceString);
} }
/* /*
* @implemented * @implemented
*/ */
@ -89,21 +105,22 @@ NdisInitializeString(
* ARGUMENTS: * ARGUMENTS:
* DestinationString = Address of buffer to place string in * DestinationString = Address of buffer to place string in
* SourceString = Pointer to null terminated ANSI string * SourceString = Pointer to null terminated ANSI string
* NOTES:
* - Must be called at IRQL = PASSIVE_LEVEL
*/ */
{ {
ANSI_STRING AnsiString; ANSI_STRING AnsiString;
RtlInitAnsiString( PAGED_CODE();
&AnsiString, ASSERT(DestinationString);
(PCSZ)SourceString); ASSERT(SourceString);
RtlAnsiStringToUnicodeString( RtlInitAnsiString(&AnsiString, (PCSZ)SourceString);
(PUNICODE_STRING)DestinationString,
&AnsiString, RtlAnsiStringToUnicodeString((PUNICODE_STRING)DestinationString, &AnsiString, TRUE);
TRUE);
} }
/* /*
* @implemented * @implemented
*/ */
@ -117,14 +134,17 @@ NdisInitUnicodeString(
* ARGUMENTS: * ARGUMENTS:
* DestinationString = Address of buffer to place string in * DestinationString = Address of buffer to place string in
* SourceString = Pointer to null terminated unicode string * SourceString = Pointer to null terminated unicode string
* NOTES:
* - call with IRQL <= DISPATCH_LEVEL
*/ */
{ {
RtlInitUnicodeString( ASSERT(DestinationString);
(PUNICODE_STRING)DestinationString, ASSERT(SourceString);
SourceString);
RtlInitUnicodeString((PUNICODE_STRING)DestinationString, SourceString);
} }
/* /*
* @implemented * @implemented
*/ */
@ -132,21 +152,27 @@ NDIS_STATUS
EXPORT EXPORT
NdisUnicodeStringToAnsiString( NdisUnicodeStringToAnsiString(
IN OUT PANSI_STRING DestinationString, IN OUT PANSI_STRING DestinationString,
IN PNDIS_STRING SourceString) IN PNDIS_STRING SourceString)
/* /*
* FUNCTION: Converts an NDIS (unicode) string to an ANSI string * FUNCTION: Converts an NDIS (unicode) string to an ANSI string
* ARGUMENTS: * ARGUMENTS:
* DestinationString = Address of buffer to place converted string in * DestinationString = Address of buffer to place converted string in
* SourceString = Pointer to unicode string to be converted * SourceString = Pointer to unicode string to be converted
* NOTES:
* - must be called at IRQL = PASSIVE_LEVEL
*/ */
{ {
return (NDIS_STATUS)RtlUnicodeStringToAnsiString( PAGED_CODE();
(PANSI_STRING)DestinationString, ASSERT(DestinationString);
(PUNICODE_STRING)SourceString, ASSERT(SourceString);
FALSE);
return (NDIS_STATUS)RtlUnicodeStringToAnsiString(
(PANSI_STRING)DestinationString,
(PUNICODE_STRING)SourceString,
FALSE);
} }
/* /*
* @implemented * @implemented
*/ */
@ -156,15 +182,21 @@ NdisUpcaseUnicodeString(
OUT PUNICODE_STRING DestinationString, OUT PUNICODE_STRING DestinationString,
IN PUNICODE_STRING SourceString) IN PUNICODE_STRING SourceString)
/* /*
* FUNCTION: * FUNCTION: Uppercase a UNICODE string
* ARGUMENTS: * ARGUMENTS:
* DestinationString: caller-allocated space for the uppercased string
* SourceString: string to be uppercased
* NOTES: * NOTES:
* NDIS 5.0 * - Currently requires caller to allocate destination string - XXX is this right?
* - callers must be running at IRQL = PASSIVE_LEVEL
*/ */
{ {
ASSERT_IRQL(PASSIVE_LEVEL); PAGED_CODE();
// FIXME - not sure if 3rd param should be TRUE or FALSE ASSERT(SourceString);
return RtlUpcaseUnicodeString ( DestinationString, SourceString, FALSE ); ASSERT(DestinationString);
return RtlUpcaseUnicodeString (DestinationString, SourceString, FALSE );
} }
/* EOF */ /* EOF */

View file

@ -4,27 +4,50 @@
* FILE: ndis/time.c * FILE: ndis/time.c
* PURPOSE: Time related routines * PURPOSE: Time related routines
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
* Vizzini (vizzini@plasmic.com)
* REVISIONS: * REVISIONS:
* CSH 01/08-2000 Created * CSH 01/08-2000 Created
* Vizzini 08-Oct-2003 Formatting, commenting, and ASSERTs
*
* NOTES:
* - Although the standard kernel-mode M.O. is to trust the caller
* to not provide bad arguments, we have added lots of argument
* validation to assist in the effort to get third-party binaries
* working. It is easiest to track bugs when things break quickly
* and badly.
* - Nearly this entire file is PAGED_CODE (with the exception of the
* MiniportTimerDpc() function)
*/ */
#include <ndissys.h> #include <ndissys.h>
VOID STDCALL VOID STDCALL
MiniportTimerDpc( MiniportTimerDpc(
PKDPC Dpc, PKDPC Dpc,
PVOID DeferredContext, PVOID DeferredContext,
PVOID SystemArgument1, PVOID SystemArgument1,
PVOID SystemArgument2) PVOID SystemArgument2)
/*
* FUNCTION: Scheduled by the SetTimer family of functions
* ARGUMENTS:
* Dpc: Pointer to the DPC Object being executed
* DeferredContext: Pointer to a NDIS_MINIPORT_TIMER object
* SystemArgument1: Unused.
* SystemArgument2: Unused.
* NOTES:
* - runs at IRQL = DISPATCH_LEVEL
*/
{ {
PNDIS_MINIPORT_TIMER Timer; PNDIS_MINIPORT_TIMER Timer;
Timer = (PNDIS_MINIPORT_TIMER)DeferredContext; Timer = (PNDIS_MINIPORT_TIMER)DeferredContext;
Timer->MiniportTimerFunction (NULL, Timer->MiniportTimerContext, NULL, NULL); ASSERT(Timer->MiniportTimerFunction);
Timer->MiniportTimerFunction (NULL, Timer->MiniportTimerContext, NULL, NULL);
} }
/* /*
* @implemented * @implemented
*/ */
@ -33,11 +56,22 @@ EXPORT
NdisCancelTimer( NdisCancelTimer(
IN PNDIS_TIMER Timer, IN PNDIS_TIMER Timer,
OUT PBOOLEAN TimerCancelled) OUT PBOOLEAN TimerCancelled)
/*
* FUNCTION: Cancels a scheduled NDIS timer
* ARGUMENTS:
* Timer: pointer to an NDIS_TIMER object to cancel
* TimerCancelled: boolean that returns cancellation status
* NOTES:
* - call at IRQL <= DISPATCH_LEVEL
*/
{ {
*TimerCancelled = KeCancelTimer (&Timer->Timer); PAGED_CODE();
ASSERT(Timer);
*TimerCancelled = KeCancelTimer (&Timer->Timer);
} }
/* /*
* @implemented * @implemented
*/ */
@ -45,11 +79,21 @@ VOID
EXPORT EXPORT
NdisGetCurrentSystemTime ( NdisGetCurrentSystemTime (
IN OUT PLARGE_INTEGER pSystemTime) IN OUT PLARGE_INTEGER pSystemTime)
/*
* FUNCTION: Retrieve the current system time
* ARGUMENTS:
* pSystemTime: pointer to the returned system time
* NOTES:
* - call at IRQL <= DISPATCH_LEVEL
*/
{ {
KeQuerySystemTime (pSystemTime); PAGED_CODE();
ASSERT(pSystemTime);
KeQuerySystemTime (pSystemTime);
} }
/* /*
* @implemented * @implemented
*/ */
@ -59,13 +103,26 @@ NdisInitializeTimer(
IN OUT PNDIS_TIMER Timer, IN OUT PNDIS_TIMER Timer,
IN PNDIS_TIMER_FUNCTION TimerFunction, IN PNDIS_TIMER_FUNCTION TimerFunction,
IN PVOID FunctionContext) IN PVOID FunctionContext)
/*
* FUNCTION: Set up an NDIS_TIMER for later use
* ARGUMENTS:
* Timer: pointer to caller-allocated storage to receive an NDIS_TIMER
* TimerFunction: function pointer to routine to run when timer expires
* FunctionContext: context (param 2) to be passed to the timer function when it runs
* NOTES:
* - TimerFunction will be called at DISPATCH_LEVEL
* - call at IRQL = PASSIVE_LEVEL
*/
{ {
KeInitializeTimer (&Timer->Timer); PAGED_CODE();
ASSERT(Timer);
KeInitializeDpc (&Timer->Dpc, (PKDEFERRED_ROUTINE)TimerFunction, FunctionContext); KeInitializeTimer (&Timer->Timer);
KeInitializeDpc (&Timer->Dpc, (PKDEFERRED_ROUTINE)TimerFunction, FunctionContext);
} }
/* /*
* @implemented * @implemented
*/ */
@ -74,11 +131,23 @@ EXPORT
NdisMCancelTimer( NdisMCancelTimer(
IN PNDIS_MINIPORT_TIMER Timer, IN PNDIS_MINIPORT_TIMER Timer,
OUT PBOOLEAN TimerCancelled) OUT PBOOLEAN TimerCancelled)
/*
* FUNCTION: cancel a scheduled NDIS_MINIPORT_TIMER
* ARGUMENTS:
* Timer: timer object to cancel
* TimerCancelled: status of cancel operation
* NOTES:
* - call at IRQL <= DISPATCH_LEVEL
*/
{ {
*TimerCancelled = KeCancelTimer (&Timer->Timer); PAGED_CODE();
ASSERT(TimerCancelled);
ASSERT(Timer);
*TimerCancelled = KeCancelTimer (&Timer->Timer);
} }
/* /*
* @implemented * @implemented
*/ */
@ -89,17 +158,30 @@ NdisMInitializeTimer(
IN NDIS_HANDLE MiniportAdapterHandle, IN NDIS_HANDLE MiniportAdapterHandle,
IN PNDIS_TIMER_FUNCTION TimerFunction, IN PNDIS_TIMER_FUNCTION TimerFunction,
IN PVOID FunctionContext) IN PVOID FunctionContext)
/*
* FUNCTION: Initialize an NDIS_MINIPORT_TIMER
* ARGUMENTS:
* Timer: Timer object to initialize
* MiniportAdapterHandle: Handle to the miniport, passed in to MiniportInitialize
* TimerFunction: function to be executed when the timer expires
* FunctionContext: argument passed to TimerFunction when it is called
* NOTES:
* - TimerFunction is called at IRQL = DISPATCH_LEVEL
* - call at IRQL = PASSIVE_LEVEL
*/
{ {
KeInitializeTimer (&Timer->Timer); PAGED_CODE();
ASSERT(Timer);
KeInitializeTimer (&Timer->Timer);
KeInitializeDpc (&Timer->Dpc, MiniportTimerDpc, (PVOID) Timer); KeInitializeDpc (&Timer->Dpc, MiniportTimerDpc, (PVOID) Timer);
Timer->MiniportTimerFunction = TimerFunction; Timer->MiniportTimerFunction = TimerFunction;
Timer->MiniportTimerContext = FunctionContext; Timer->MiniportTimerContext = FunctionContext;
Timer->Miniport = MiniportAdapterHandle; Timer->Miniport = MiniportAdapterHandle;
} }
/* /*
* @implemented * @implemented
*/ */
@ -108,15 +190,28 @@ EXPORT
NdisMSetPeriodicTimer( NdisMSetPeriodicTimer(
IN PNDIS_MINIPORT_TIMER Timer, IN PNDIS_MINIPORT_TIMER Timer,
IN UINT MillisecondsPeriod) IN UINT MillisecondsPeriod)
/*
* FUNCTION: Set a timer to go off periodically
* ARGUMENTS:
* Timer: pointer to the timer object to set
* MillisecondsPeriod: period of the timer
* NOTES:
* - Minimum predictible interval is ~10ms
* - Must be called at IRQL <= DISPATCH_LEVEL)
*/
{ {
LARGE_INTEGER Timeout; LARGE_INTEGER Timeout;
Timeout.QuadPart = MillisecondsPeriod * -10000; PAGED_CODE();
ASSERT(Timer);
KeSetTimerEx (&Timer->Timer, Timeout, MillisecondsPeriod, &Timer->Dpc); /* relative delays are negative, absolute are positive; resolution is 100ns */
Timeout.QuadPart = MillisecondsPeriod * -10000;
KeSetTimerEx (&Timer->Timer, Timeout, MillisecondsPeriod, &Timer->Dpc);
} }
/* /*
* @implemented * @implemented
*/ */
@ -125,15 +220,28 @@ EXPORT
NdisMSetTimer( NdisMSetTimer(
IN PNDIS_MINIPORT_TIMER Timer, IN PNDIS_MINIPORT_TIMER Timer,
IN UINT MillisecondsToDelay) IN UINT MillisecondsToDelay)
/*
* FUNCTION: Set a NDIS_MINIPORT_TIMER so that it goes off
* ARGUMENTS:
* Timer: timer object to set
* MillisecondsToDelay: time to wait for the timer to expire
* NOTES:
* - Minimum predictible interval is ~10ms
* - Must be called at IRQL <= DISPATCH_LEVEL)
*/
{ {
LARGE_INTEGER Timeout; LARGE_INTEGER Timeout;
Timeout.QuadPart = MillisecondsToDelay * -10000; PAGED_CODE();
ASSERT(Timer);
KeSetTimer (&Timer->Timer, Timeout, &Timer->Dpc); /* relative delays are negative, absolute are positive; resolution is 100ns */
Timeout.QuadPart = MillisecondsToDelay * -10000;
KeSetTimer (&Timer->Timer, Timeout, &Timer->Dpc);
} }
/* /*
* @implemented * @implemented
*/ */
@ -142,12 +250,26 @@ EXPORT
NdisSetTimer( NdisSetTimer(
IN PNDIS_TIMER Timer, IN PNDIS_TIMER Timer,
IN UINT MillisecondsToDelay) IN UINT MillisecondsToDelay)
/*
* FUNCTION: Set an NDIS_TIMER so that it goes off
* ARGUMENTS:
* Timer: timer object to set
* MillisecondsToDelay: time to wait for the timer to expire
* NOTES:
* - Minimum predictible interval is ~10ms
* - Must be called at IRQL <= DISPATCH_LEVEL)
*/
{ {
LARGE_INTEGER Timeout; LARGE_INTEGER Timeout;
Timeout.QuadPart = MillisecondsToDelay * -10000; PAGED_CODE();
ASSERT(Timer);
KeSetTimer (&Timer->Timer, Timeout, &Timer->Dpc); /* relative delays are negative, absolute are positive; resolution is 100ns */
Timeout.QuadPart = MillisecondsToDelay * -10000;
KeSetTimer (&Timer->Timer, Timeout, &Timer->Dpc);
} }
/* EOF */ /* EOF */

View file

@ -44,6 +44,7 @@ typedef enum _KWAIT_REASON
WrExecutive, WrExecutive,
WrFreePage, WrFreePage,
WrPageIn, WrPageIn,
WrPoolAllocation,
WrDelayExecution, WrDelayExecution,
WrSuspended, WrSuspended,
WrUserRequest, WrUserRequest,

View file

@ -95,12 +95,14 @@ RtlAssert (
PCHAR Message PCHAR Message
); );
#define ASSERT( exp ) if (!(exp)) RtlAssert( #exp, __FILE__, __LINE__, NULL ) #define ASSERT( exp ) if (!(exp)) RtlAssert( #exp, __FILE__, __LINE__, NULL )
#define ASSERTMSG( msg, exp ) if (!(exp)) RtlAssert( #exp, __FILE__, __LINE__, msg ) #define ASSERTMSG( msg, exp ) if (!(exp)) RtlAssert( #exp, __FILE__, __LINE__, msg )
#define PAGED_CODE() if (KeGetCurrentIrql() > APC_LEVEL) ASSERT(0);
#else #else
#define ASSERT( exp ) #define ASSERT( exp )
#define ASSERTMSG( msg, exp ) #define ASSERTMSG( msg, exp )
#define PAGED_CODE()
#endif /* DBG */ #endif /* DBG */
/* Base types */ /* Base types */
@ -5565,7 +5567,7 @@ NdisReturnPackets(
/* EOF */ /* EOF */
/* /*
* XXX - these macros are disabled for the momentdue to the fact that there are definitions for them elsewhere. * XXX - these macros are disabled for the moment due to the fact that there are definitions for them elsewhere.
* We will have to decide which to keep; we don't need both (no BINARY_COMPATIBLE) * We will have to decide which to keep; we don't need both (no BINARY_COMPATIBLE)
*/ */
#if 0 #if 0

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: main.c,v 1.172 2003/09/29 20:43:07 navaraf Exp $ /* $Id: main.c,v 1.173 2003/10/12 16:39:52 vizzini Exp $
* *
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/main.c * FILE: ntoskrnl/ke/main.c
@ -682,7 +682,7 @@ ExpInitializeExecutive(VOID)
for (i = 2; i < KeLoaderBlock.ModsCount; i++) for (i = 2; i < KeLoaderBlock.ModsCount; i++)
{ {
#ifdef KDBG #ifdef KDBG
/* Do not free the memory from symbol files, if the kernel debugger is activ */ /* Do not free the memory from symbol files, if the kernel debugger is active */
if (!RtlpCheckFileNameExtension(name, ".sym")) if (!RtlpCheckFileNameExtension(name, ".sym"))
#endif #endif
{ {

View file

@ -9,7 +9,7 @@ HOST = mingw32-windows
endif endif
# Build map files which includes source and asm code # Build map files which includes source and asm code
# FULL_MAP = yes FULL_MAP = yes
# Default to no PCH support # Default to no PCH support
ifeq ($(ROS_USE_PCH),) ifeq ($(ROS_USE_PCH),)