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", \
"File System", \
"Event log", \
"NDIS", \
"NDIS Wrapper" \
"PNP_TDI", \
"NDIS", \
"TDI", \
"Extended Base"
@ -219,28 +220,28 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Msfs","Type",0x00010001,0x00000002
; NDIS driver - the only boot-start network driver
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","Start",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","Start",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
; 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
; NE2000 NIC driver
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","ErrorControl",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Group",0x00000000,"NDIS"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","ImagePath",0x00020000,"system32\drivers\ne2000.sys"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Start",0x00010001,0x00000003
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Type",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Test",0x00010001,0xbaadf00d
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Route",0x00000000,"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","Route",0x00010000,"Ne20001"
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","NextInstance",0x00010001,0x00000001
;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","ErrorControl",0x00010001,0x00000001
;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Group",0x00000000,"NDIS"
;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","ImagePath",0x00020000,"system32\drivers\ne2000.sys"
;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Start",0x00010001,0x00000003
;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Type",0x00010001,0x00000001
;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Test",0x00010001,0xbaadf00d
;HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Route",0x00000000,"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","Route",0x00010000,"Ne20001"
;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","NextInstance",0x00010001,0x00000001
; 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
@ -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)
; TODO: create this with NDI
; NE2000 Adapter 1
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001","ErrorControl",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001","Start",0x00010001,0x00000003
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001","Type",0x00010001,0x00000004
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","Route",0x00010000,"Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","Port",0x00000000,"280"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","Irq",0x00000000,"9"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","DwordTest",0x00000000,"baadf00d"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","StringTest",0x00000000,"StringTest"
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","IPAddress",0x00010000,"10.0.0.100"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0"
;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001","ErrorControl",0x00010001,0x00000001
;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001","Start",0x00010001,0x00000003
;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001","Type",0x00010001,0x00000004
;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","Route",0x00010000,"Ne20001"
;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","Port",0x00000000,"280"
;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","Irq",0x00000000,"9"
;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","DwordTest",0x00000000,"baadf00d"
;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","StringTest",0x00000000,"StringTest"
;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","IPAddress",0x00010000,"10.0.0.100"
;HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0"
; AMD PCNet NIC driver
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","ErrorControl",0x00010001,0x00000001
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","Group",0x00000000,"NDIS"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","ImagePath",0x00020000,"system32\drivers\pcntn5m.sys"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","Start",0x00010001,0x00000003
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","Type",0x00010001,0x00000001
;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","Route",0x00010000,"PCNet1"
;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","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","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\Services\PCNet","ErrorControl",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","Group",0x00000000,"NDIS"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","ImagePath",0x00020000,"system32\drivers\pcntn5m.sys"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet","Start",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","Export",0x00010000,"\Device\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","Count",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","Class",0x00000000,"Net"
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
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1","ErrorControl",0x00010001,0x00000001
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1","Start",0x00010001,0x00000003
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1","Type",0x00010001,0x00000004
;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","Route",0x00010000,"PCNet1"
;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","BUSTYPE",0x00000000,"5"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","EXTPHY",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","LED1",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","MPMODE",0x00000000,"0"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","TP",0x00000000,"1"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","SlotNumber",0x00000000,"10"
;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","IPAddress",0x00010000,"10.1.0.100"
;HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1","ErrorControl",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1","Start",0x00010001,0x00000003
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1","Type",0x00010001,0x00000004
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","Route",0x00010000,"PCNet1"
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","BUSTYPE",0x00000000,"5"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","EXTPHY",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","LED1",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","MPMODE",0x00000000,"0"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","TP",0x00000000,"1"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","SlotNumber",0x00000000,"10"
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","IPAddress",0x00010000,"10.1.0.100"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters\Tcpip","SubnetMask",0x00010000,"255.255.255.0"
; ReactOS PCNet Driver
;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
; twiddled to get 3rd-party network-related software to work.
; 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\Ne20001"
;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_Ne20001"
;HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Route",0x00010000,"PCNet1", "Ne20001", "PCNet1"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Route",0x00010000,"Ne20001"
;HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Bind",0x00010000,"\Device\PCNet1", "\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"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Export",0x00010000, "\Device\Tcpip_PCNet1"
;HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Route",0x00010000,"PCNet1", "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","Domain",0x00000000,""
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","Hostname",0x00000000,"ROSHost"

View file

@ -79,9 +79,9 @@ typedef struct _ORPHAN_ADATER {
} ORPHAN_ADAPTER, *PORPHAN_ADAPTER;
/* Information about a logical adapter */
typedef struct _LOGICAL_ADAPTER {
NDIS_MINIPORT_BLOCK NdisMiniportBlock; /* NDIS defined fields */
typedef struct _LOGICAL_ADAPTER
{
NDIS_MINIPORT_BLOCK NdisMiniportBlock; /* NDIS defined fields */
KDPC MiniportDpc; /* DPC routine for adapter */
BOOLEAN MiniportBusy; /* A MiniportXxx routine is executing */
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];
PNDIS_MINIPORT_WORK_ITEM WorkQueueHead; /* Head of work queue */
PNDIS_MINIPORT_WORK_ITEM WorkQueueTail; /* Tail of work queue */
LIST_ENTRY ListEntry; /* Entry on global list */
LIST_ENTRY MiniportListEntry; /* Entry on miniport driver list */
LIST_ENTRY ProtocolListHead; /* List of bound protocols */
@ -97,8 +96,7 @@ typedef struct _LOGICAL_ADAPTER {
PMINIPORT_DRIVER Miniport; /* Miniport owning this adapter */
UNICODE_STRING DeviceName; /* Device name of this adapter */
ULONG Attributes; /* Attributes of adapter */
/* TRUE if the miniport has called NdisSetAttributes(Ex) for this adapter */
BOOLEAN AttributesSet;
BOOLEAN AttributesSet; /* Whether NdisMSetAttributes(Ex) has been called */
PVOID QueryBuffer; /* Buffer to use for queries */
ULONG QueryBufferLength; /* Length of QueryBuffer */
ULONG MediumHeaderSize; /* Size of medium header */
@ -108,10 +106,8 @@ typedef struct _LOGICAL_ADAPTER {
ULONG LookaheadLength; /* Length of lookahead buffer */
ULONG CurLookaheadLength; /* Current (selected) length of lookahead buffer */
ULONG MaxLookaheadLength; /* Maximum 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 */
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 */
KEVENT DmaEvent; /* Event to support DMA register allocation */
KSPIN_LOCK DmaLock; /* Spinlock to protect the dma list */
UINT BusNumber;
INTERFACE_TYPE BusType;
UINT SlotNumber;
ULONG Irql;
ULONG Vector;
KAFFINITY Affinity;
PHYSICAL_ADDRESS BaseIoAddress;
PHYSICAL_ADDRESS BaseMemoryAddress; /* multiple ranges? */
ULONG DmaChannel;
ULONG DmaPort;
PNDIS_MINIPORT_TIMER Timer;
UINT BusNumber; /* The bus number of the adapter */
INTERFACE_TYPE BusType; /* The bus type of the adapter */
UINT SlotNumber; /* The slot number of the adapter*/
ULONG Irql; /* The Irql assigned to the adapter */
ULONG Vector; /* The interrupt vector assigned to the adapter */
KAFFINITY Affinity; /* The processor affinity of the adapter */
PHYSICAL_ADDRESS BaseIoAddress; /* The base IO address of the adapter */
PHYSICAL_ADDRESS BaseMemoryAddress; /* The base memory address of mapped memory for the adapter */
ULONG DmaChannel; /* The DMA channel number of the adapter */
ULONG DmaPort; /* The DMA port number of the adapter */
PNDIS_MINIPORT_TIMER Timer; /* The timer object of the adapter */
} LOGICAL_ADAPTER, *PLOGICAL_ADAPTER;
#define GET_LOGICAL_ADAPTER(Handle)((PLOGICAL_ADAPTER)Handle)
@ -206,3 +202,4 @@ NdisStartDevices();
#endif /* __MINIPORT_H */
/* EOF */

View file

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

View file

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

View file

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

View file

@ -7,12 +7,16 @@
* Vizzini (vizzini@plasmic.com)
* REVISIONS:
* 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 <miniport.h>
/*
* @implemented
*/
@ -25,15 +29,10 @@ NdisImmediateReadPciSlotInformation(
IN PVOID Buffer,
IN ULONG Length)
{
return HalGetBusDataByOffset (PCIConfiguration,
0, /* FIXME */
SlotNumber,
Buffer,
Offset,
Length);
return HalGetBusDataByOffset (PCIConfiguration, 0, SlotNumber, Buffer, Offset, Length);
}
/*
* @implemented
*/
@ -46,15 +45,10 @@ NdisImmediateWritePciSlotInformation(
IN PVOID Buffer,
IN ULONG Length)
{
return HalSetBusDataByOffset (PCIConfiguration,
0, /* FIXME */
SlotNumber,
Buffer,
Offset,
Length);
return HalSetBusDataByOffset (PCIConfiguration, 0, SlotNumber, Buffer, Offset, Length);
}
/*
* @implemented
*/
@ -88,13 +82,12 @@ NdisMPciAssignResources(
return NDIS_STATUS_FAILURE;
}
*AssignedResources =
(PNDIS_RESOURCE_LIST)&ResourceList->List[0].PartialResourceList;
*AssignedResources = (PNDIS_RESOURCE_LIST)&ResourceList->List[0].PartialResourceList;
return NDIS_STATUS_SUCCESS;
}
/*
* @unimplemented
*/
@ -124,10 +117,10 @@ NdisQueryMapRegisterCount(
* 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
*/
@ -171,15 +164,10 @@ NdisReadPciSlotInformation(
IN PVOID Buffer,
IN ULONG Length)
{
return HalGetBusDataByOffset (PCIConfiguration,
0, /* FIXME */
SlotNumber,
Buffer,
Offset,
Length);
return HalGetBusDataByOffset (PCIConfiguration, 0, SlotNumber, Buffer, Offset, Length);
}
/*
* @implemented
*/
@ -192,12 +180,8 @@ NdisWritePciSlotInformation(
IN PVOID Buffer,
IN ULONG Length)
{
return HalSetBusDataByOffset (PCIConfiguration,
0, /* FIXME */
SlotNumber,
Buffer,
Offset,
Length);
return HalSetBusDataByOffset (PCIConfiguration, 0, SlotNumber, Buffer, Offset, Length);
}
/* EOF */

View file

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

View file

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

View file

@ -7,11 +7,13 @@
* Vizzini (vizzini@plasmic.com)
* REVISIONS:
* 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 <miniport.h>
/*
* @implemented
*/
@ -45,7 +47,7 @@ NdisAllocateMemoryWithTag(
return NDIS_STATUS_SUCCESS;
}
/*
* @unimplemented
*/
@ -59,7 +61,7 @@ NdisCreateLookaheadBufferFromSharedMemory(
UNIMPLEMENTED
}
/*
* @unimplemented
*/
@ -71,7 +73,7 @@ NdisDestroyLookaheadBufferFromSharedMemory(
UNIMPLEMENTED
}
/*
* @unimplemented
*/
@ -85,7 +87,7 @@ NdisMoveFromMappedMemory(
UNIMPLEMENTED
}
/*
* @unimplemented
*/
@ -99,7 +101,7 @@ NdisMoveMappedMemory(
RtlCopyMemory(Destination,Source,Length);
}
/*
* @unimplemented
*/
@ -113,7 +115,7 @@ NdisMoveToMappedMemory(
UNIMPLEMENTED
}
/*
* @unimplemented
*/
@ -128,7 +130,7 @@ NdisMUpdateSharedMemory(
UNIMPLEMENTED
}
/*
* @implemented
*/
@ -180,7 +182,7 @@ NdisAllocateMemory(
return NDIS_STATUS_SUCCESS;
}
/*
* @implemented
*/
@ -215,7 +217,7 @@ NdisFreeMemory(
ExFreePool(VirtualAddress);
}
/*
* @unimplemented
*/
@ -230,7 +232,7 @@ NdisImmediateReadSharedMemory(
UNIMPLEMENTED
}
/*
* @unimplemented
*/
@ -245,7 +247,7 @@ NdisImmediateWriteSharedMemory(
UNIMPLEMENTED
}
/*
* @implemented
*/
@ -276,7 +278,7 @@ NdisMAllocateSharedMemory(
*VirtualAddress = HalAllocateCommonBuffer(Adapter->AdapterObject, Length, PhysicalAddress, Cached);
}
/*
* @unimplemented
*/
@ -291,9 +293,10 @@ NdisMAllocateSharedMemoryAsync(
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
UNIMPLEMENTED
return NDIS_STATUS_FAILURE;
return NDIS_STATUS_FAILURE;
}
/*
* @implemented
*/
@ -321,7 +324,7 @@ NdisMFreeSharedMemoryPassive(
ExFreePool(Memory);
}
/*
* @implemented
*/

File diff suppressed because it is too large Load diff

View file

@ -76,6 +76,7 @@ ProIndicatePacket(
NdisQueryPacket(Packet, NULL, NULL, NULL, &PacketLength);
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
{
Adapter->LoopPacket = Packet;
@ -95,6 +96,7 @@ ProIndicatePacket(
MiniIndicateData(Adapter, NULL, Adapter->LookaheadBuffer, Adapter->MediumHeaderSize, NULL, 0, 0);
}
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
{
Adapter->LoopPacket = NULL;
@ -119,7 +121,7 @@ ProRequest(
*/
{
KIRQL OldIrql;
BOOLEAN QueueWorkItem;
BOOLEAN QueueWorkItem = FALSE;
NDIS_STATUS NdisStatus;
PADAPTER_BINDING AdapterBinding;
PLOGICAL_ADAPTER Adapter;
@ -135,12 +137,16 @@ ProRequest(
/*
* If the miniport is already busy, queue a workitem
*/
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &OldIrql);
{
if(Adapter->MiniportBusy)
QueueWorkItem = TRUE;
else
Adapter->MiniportBusy = TRUE;
{
NDIS_DbgPrint(MAX_TRACE, ("Setting adapter 0x%x to busy\n"));
Adapter->MiniportBusy = TRUE;
}
}
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
@ -156,8 +162,10 @@ ProRequest(
{
NdisStatus = MiniDoRequest(Adapter, NdisRequest);
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
{
NDIS_DbgPrint(MAX_TRACE, ("Setting adapter 0x%x to free\n"));
Adapter->MiniportBusy = FALSE;
if (Adapter->WorkQueueHead)
@ -202,7 +210,7 @@ ProSend(
*/
{
KIRQL RaiseOldIrql, SpinOldIrql;
BOOLEAN QueueWorkItem;
BOOLEAN QueueWorkItem = FALSE;
NDIS_STATUS NdisStatus;
PADAPTER_BINDING AdapterBinding;
PLOGICAL_ADAPTER Adapter;
@ -229,6 +237,7 @@ ProSend(
* Else we don't do anything because we have to queue a workitem
* anyway.
*/
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &SpinOldIrql);
{
/*
@ -239,7 +248,10 @@ ProSend(
if (Adapter->MiniportBusy)
QueueWorkItem = TRUE;
else
Adapter->MiniportBusy = TRUE;
{
NDIS_DbgPrint(MAX_TRACE, ("Setting adapter 0x%x to busy\n"));
Adapter->MiniportBusy = TRUE;
}
}
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, SpinOldIrql);
@ -271,8 +283,10 @@ ProSend(
*/
NdisStatus = ProIndicatePacket(Adapter, Packet);
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
{
NDIS_DbgPrint(MAX_TRACE, ("Setting adapter 0x%x to free\n"));
Adapter->MiniportBusy = FALSE;
if (Adapter->WorkQueueHead)
@ -317,6 +331,7 @@ ProSend(
KeLowerIrql(RaiseOldIrql);
/* XXX why the hell do we do this? */
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLock(&Adapter->NdisMiniportBlock.Lock, &SpinOldIrql);
{
if (Adapter->WorkQueueHead)
@ -342,6 +357,7 @@ ProSend(
NDIS_DbgPrint(MAX_TRACE, ("back from miniport's send handler\n"));
/* XXX why the hell do we do this? */
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
{
if (Adapter->WorkQueueHead)
@ -442,6 +458,7 @@ NdisCloseAdapter(
KeReleaseSpinLock(&AdapterBinding->ProtocolBinding->Lock, OldIrql);
/* Remove protocol from adapter's bound protocols list */
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
KeAcquireSpinLock(&AdapterBinding->Adapter->NdisMiniportBlock.Lock, &OldIrql);
RemoveEntryList(&AdapterBinding->AdapterListEntry);
KeReleaseSpinLock(&AdapterBinding->Adapter->NdisMiniportBlock.Lock, OldIrql);
@ -518,85 +535,90 @@ NdisOpenAdapter(
* AddressingInformation = Optional pointer to buffer with NIC specific information
*/
{
UINT i;
BOOLEAN Found;
PLOGICAL_ADAPTER Adapter;
PADAPTER_BINDING AdapterBinding;
PPROTOCOL_BINDING Protocol = GET_PROTOCOL_BINDING(NdisProtocolHandle);
UINT i;
BOOLEAN Found;
PLOGICAL_ADAPTER Adapter;
PADAPTER_BINDING AdapterBinding;
PPROTOCOL_BINDING Protocol = GET_PROTOCOL_BINDING(NdisProtocolHandle);
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
if(!NdisProtocolHandle)
{
NDIS_DbgPrint(MAX_TRACE, ("NdisProtocolHandle is NULL\n"));
*OpenErrorStatus = *Status = NDIS_STATUS_FAILURE;
return;
}
Adapter = MiniLocateDevice(AdapterName);
if (!Adapter) {
NDIS_DbgPrint(MIN_TRACE, ("Adapter not found.\n"));
*Status = NDIS_STATUS_ADAPTER_NOT_FOUND;
return;
if(!NdisProtocolHandle)
{
NDIS_DbgPrint(MAX_TRACE, ("NdisProtocolHandle is NULL\n"));
*OpenErrorStatus = *Status = NDIS_STATUS_FAILURE;
return;
}
/* 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;
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 */
Found = FALSE;
for (i = 0; i < MediumArraySize; i++)
{
if (Adapter->NdisMiniportBlock.MediaType == MediumArray[i])
{
*SelectedMediumIndex = i;
Found = TRUE;
break;
}
}
if (!Found) {
NDIS_DbgPrint(MIN_TRACE, ("Medium is not supported.\n"));
*Status = NDIS_STATUS_UNSUPPORTED_MEDIA;
return;
if (!Found)
{
NDIS_DbgPrint(MIN_TRACE, ("Medium is not supported.\n"));
*Status = NDIS_STATUS_UNSUPPORTED_MEDIA;
return;
}
AdapterBinding = ExAllocatePool(NonPagedPool, sizeof(ADAPTER_BINDING));
if (!AdapterBinding) {
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
*Status = NDIS_STATUS_RESOURCES;
return;
/* Now that we have confirmed that the adapter can be opened, create a binding */
AdapterBinding = ExAllocatePool(NonPagedPool, sizeof(ADAPTER_BINDING));
if (!AdapterBinding)
{
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->Adapter = Adapter;
AdapterBinding->NdisOpenBlock.ProtocolBindingContext = ProtocolBindingContext;
AdapterBinding->ProtocolBinding = Protocol;
AdapterBinding->Adapter = Adapter;
AdapterBinding->NdisOpenBlock.ProtocolBindingContext = ProtocolBindingContext;
/* Set fields required by some NDIS macros */
AdapterBinding->NdisOpenBlock.MacBindingHandle = (NDIS_HANDLE)AdapterBinding;
/* Set fields required by some NDIS macros */
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.ResetHandler = ProReset;
AdapterBinding->NdisOpenBlock.u1.SendHandler = ProSend;
AdapterBinding->NdisOpenBlock.SendPacketsHandler = ProSendPackets;
AdapterBinding->NdisOpenBlock.TransferDataHandler = ProTransferData;
AdapterBinding->NdisOpenBlock.RequestHandler = ProRequest;
AdapterBinding->NdisOpenBlock.ResetHandler = ProReset;
AdapterBinding->NdisOpenBlock.u1.SendHandler = ProSend;
AdapterBinding->NdisOpenBlock.SendPacketsHandler = ProSendPackets;
AdapterBinding->NdisOpenBlock.TransferDataHandler = ProTransferData;
#if 0
/* XXX this looks fishy */
/* OK, this really *is* fishy - it bugchecks */
/* Put on protocol's bound adapters list */
ExInterlockedInsertTailList(&Protocol->AdapterListHead,
&AdapterBinding->ProtocolListEntry,
&Protocol->Lock);
/* XXX this looks fishy */
/* OK, this really *is* fishy - it bugchecks */
/* Put on protocol's bound adapters list */
ExInterlockedInsertTailList(&Protocol->AdapterListHead, &AdapterBinding->ProtocolListEntry, &Protocol->Lock);
#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
* PURPOSE: String management routines
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
* Vizzini (vizzini@plasmic.com)
* REVISIONS:
* CSH 01/08-2000 Created
* Vizzini 08-Oct-2003 Error checking, documentation, and formatting
*/
#include <ndissys.h>
/*
* @implemented
*/
NDIS_STATUS
EXPORT
NdisAnsiStringToUnicodeString(
IN OUT PNDIS_STRING DestinationString,
IN OUT PNDIS_STRING DestinationString,
IN PANSI_STRING SourceString)
/*
* FUNCTION: Converts an ANSI string to an NDIS (unicode) string
* ARGUMENTS:
* DestinationString = Address of buffer to place converted string in
* SourceString = Pointer to ANSI string to be converted
* NOTES:
* - caller must be running at IRQL = PASSIVE_LEVEL
*/
{
return (NDIS_STATUS)RtlAnsiStringToUnicodeString(
(PUNICODE_STRING)DestinationString,
(PANSI_STRING)SourceString, FALSE);
PAGED_CODE();
ASSERT(DestinationString);
ASSERT(SourceString);
return (NDIS_STATUS)RtlAnsiStringToUnicodeString(
(PUNICODE_STRING)DestinationString,
(PANSI_STRING)SourceString, FALSE);
}
/*
* @implemented
*/
@ -46,15 +54,20 @@ NdisEqualString(
* String1 = Pointer to first string
* String2 = Pointer to second string
* CaseInsensitive = TRUE if the compare should be case insensitive
* NOTES:
* - caller must be at IRQL = PASSIVE_LEVEL
*/
{
return RtlEqualUnicodeString(
(PUNICODE_STRING)String1,
(PUNICODE_STRING)String2,
CaseInsensitive);
PAGED_CODE();
ASSERT(String1);
ASSERT(String2);
return RtlEqualUnicodeString((PUNICODE_STRING)String1,
(PUNICODE_STRING)String2,
CaseInsensitive);
}
/*
* @implemented
*/
@ -62,20 +75,23 @@ VOID
EXPORT
NdisInitAnsiString(
IN OUT PANSI_STRING DestinationString,
IN PCSTR SourceString)
IN PCSTR SourceString)
/*
* FUNCTION: Initializes an ANSI string
* ARGUMENTS:
* DestinationString = Address of buffer to place string in
* SourceString = Pointer to null terminated ANSI string
* NOTES:
* - Caller must be at IRQL <= DISPATCH_LEVEL
*/
{
RtlInitString(
(PANSI_STRING)DestinationString,
(PCSZ)SourceString);
ASSERT(DestinationString);
ASSERT(SourceString);
RtlInitString((PANSI_STRING)DestinationString, (PCSZ)SourceString);
}
/*
* @implemented
*/
@ -89,21 +105,22 @@ NdisInitializeString(
* ARGUMENTS:
* DestinationString = Address of buffer to place string in
* SourceString = Pointer to null terminated ANSI string
* NOTES:
* - Must be called at IRQL = PASSIVE_LEVEL
*/
{
ANSI_STRING AnsiString;
ANSI_STRING AnsiString;
RtlInitAnsiString(
&AnsiString,
(PCSZ)SourceString);
PAGED_CODE();
ASSERT(DestinationString);
ASSERT(SourceString);
RtlAnsiStringToUnicodeString(
(PUNICODE_STRING)DestinationString,
&AnsiString,
TRUE);
RtlInitAnsiString(&AnsiString, (PCSZ)SourceString);
RtlAnsiStringToUnicodeString((PUNICODE_STRING)DestinationString, &AnsiString, TRUE);
}
/*
* @implemented
*/
@ -117,14 +134,17 @@ NdisInitUnicodeString(
* ARGUMENTS:
* DestinationString = Address of buffer to place string in
* SourceString = Pointer to null terminated unicode string
* NOTES:
* - call with IRQL <= DISPATCH_LEVEL
*/
{
RtlInitUnicodeString(
(PUNICODE_STRING)DestinationString,
SourceString);
ASSERT(DestinationString);
ASSERT(SourceString);
RtlInitUnicodeString((PUNICODE_STRING)DestinationString, SourceString);
}
/*
* @implemented
*/
@ -132,21 +152,27 @@ NDIS_STATUS
EXPORT
NdisUnicodeStringToAnsiString(
IN OUT PANSI_STRING DestinationString,
IN PNDIS_STRING SourceString)
IN PNDIS_STRING SourceString)
/*
* FUNCTION: Converts an NDIS (unicode) string to an ANSI string
* ARGUMENTS:
* DestinationString = Address of buffer to place converted string in
* SourceString = Pointer to unicode string to be converted
* NOTES:
* - must be called at IRQL = PASSIVE_LEVEL
*/
{
return (NDIS_STATUS)RtlUnicodeStringToAnsiString(
(PANSI_STRING)DestinationString,
(PUNICODE_STRING)SourceString,
FALSE);
PAGED_CODE();
ASSERT(DestinationString);
ASSERT(SourceString);
return (NDIS_STATUS)RtlUnicodeStringToAnsiString(
(PANSI_STRING)DestinationString,
(PUNICODE_STRING)SourceString,
FALSE);
}
/*
* @implemented
*/
@ -156,15 +182,21 @@ NdisUpcaseUnicodeString(
OUT PUNICODE_STRING DestinationString,
IN PUNICODE_STRING SourceString)
/*
* FUNCTION:
* FUNCTION: Uppercase a UNICODE string
* ARGUMENTS:
* DestinationString: caller-allocated space for the uppercased string
* SourceString: string to be uppercased
* 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);
// FIXME - not sure if 3rd param should be TRUE or FALSE
return RtlUpcaseUnicodeString ( DestinationString, SourceString, FALSE );
PAGED_CODE();
ASSERT(SourceString);
ASSERT(DestinationString);
return RtlUpcaseUnicodeString (DestinationString, SourceString, FALSE );
}
/* EOF */

View file

@ -4,27 +4,50 @@
* FILE: ndis/time.c
* PURPOSE: Time related routines
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
* Vizzini (vizzini@plasmic.com)
* REVISIONS:
* 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>
VOID STDCALL
MiniportTimerDpc(
PKDPC Dpc,
PVOID DeferredContext,
PVOID SystemArgument1,
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
*/
@ -33,11 +56,22 @@ EXPORT
NdisCancelTimer(
IN PNDIS_TIMER Timer,
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
*/
@ -45,11 +79,21 @@ VOID
EXPORT
NdisGetCurrentSystemTime (
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
*/
@ -59,13 +103,26 @@ NdisInitializeTimer(
IN OUT PNDIS_TIMER Timer,
IN PNDIS_TIMER_FUNCTION TimerFunction,
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
*/
@ -74,11 +131,23 @@ EXPORT
NdisMCancelTimer(
IN PNDIS_MINIPORT_TIMER Timer,
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
*/
@ -89,17 +158,30 @@ NdisMInitializeTimer(
IN NDIS_HANDLE MiniportAdapterHandle,
IN PNDIS_TIMER_FUNCTION TimerFunction,
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->MiniportTimerContext = FunctionContext;
Timer->Miniport = MiniportAdapterHandle;
Timer->MiniportTimerFunction = TimerFunction;
Timer->MiniportTimerContext = FunctionContext;
Timer->Miniport = MiniportAdapterHandle;
}
/*
* @implemented
*/
@ -108,15 +190,28 @@ EXPORT
NdisMSetPeriodicTimer(
IN PNDIS_MINIPORT_TIMER Timer,
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
*/
@ -125,15 +220,28 @@ EXPORT
NdisMSetTimer(
IN PNDIS_MINIPORT_TIMER Timer,
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
*/
@ -142,12 +250,26 @@ EXPORT
NdisSetTimer(
IN PNDIS_TIMER Timer,
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 */

View file

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

View file

@ -95,12 +95,14 @@ RtlAssert (
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 PAGED_CODE() if (KeGetCurrentIrql() > APC_LEVEL) ASSERT(0);
#else
#define ASSERT( exp )
#define ASSERTMSG( msg, exp )
#define PAGED_CODE()
#endif /* DBG */
/* Base types */
@ -5565,7 +5567,7 @@ NdisReturnPackets(
/* 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)
*/
#if 0

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* 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
* FILE: ntoskrnl/ke/main.c
@ -682,7 +682,7 @@ ExpInitializeExecutive(VOID)
for (i = 2; i < KeLoaderBlock.ModsCount; i++)
{
#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"))
#endif
{

View file

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