patch by vizzini - added settings for vmware's net driver, implemented a handful of functions needed by the driver, more to come

svn path=/trunk/; revision=5450
This commit is contained in:
Royce Mitchell III 2003-08-07 05:28:33 +00:00
parent 74ff28452f
commit fcd871c119
6 changed files with 179 additions and 111 deletions

View file

@ -209,7 +209,8 @@ 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
; should have one entry per child device object. Note that REG_MULTI_SZ is 0x00010000.
; 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"
@ -218,9 +219,9 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Start",0x00010001,0x00000001
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",0x00000000,"\Device\Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Linkage","Export",0x00000000,"\Device\Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000\Linkage","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"
; Each adapter in the system gets its own SCM entry where its parameters and protocol info are stored.
; NOTE - service type is 0x4 (SERVICE_ADAPTER) and start is 0x3 (manual start). These drivers are named
@ -240,7 +241,37 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters","StringTest",0x00000
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",0x00010001,"255.255.255.0"
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,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"
; Each adapter in the system gets its own SCM entry where its parameters and protocol info are stored.
; NOTE - service type is 0x4 (SERVICE_ADAPTER) and start is 0x3 (manual start). These drivers are named
; 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\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","Port",0x00010001,0x00000280
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","Irq",0x00010001,0x00000009
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","DwordTest",0x00010001,0xbaadf00d
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","StringTest",0x00000000,"StringTest"
HKLM,"SYSTEM\CurrentControlSet\Services\PCNet1\Parameters","NetworkAddress",0x00000000,"001122334455"
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"
; Named Pipe filesystem driver
HKLM,"SYSTEM\CurrentControlSet\Services\Npfs","ErrorControl",0x00010001,0x00000000
@ -277,8 +308,8 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Packet","ImagePath",0x00020000,"system32
HKLM,"SYSTEM\CurrentControlSet\Services\Packet","Start",0x00010001,0x00000004
HKLM,"SYSTEM\CurrentControlSet\Services\Packet","Type",0x00010001,0x00000001
; NOTE: These settings should be added by the network setup
HKLM,"SYSTEM\CurrentControlSet\Services\Packet\Linkage","Bind",0x00020000,"\Device\Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Packet\Linkage","Export",0x00020000,"\Device\packet"
HKLM,"SYSTEM\CurrentControlSet\Services\Packet\Linkage","Bind",0x00010000,"\Device\Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Packet\Linkage","Export",0x00010000,"\Device\packet"
; Private ICE driver
HKLM,"SYSTEM\CurrentControlSet\Services\Pice","ErrorControl",0x00010001,0x00000000
@ -324,18 +355,18 @@ 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",0x00020000,"\Device\Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Export",0x00020000,"\Device\Tcpip_Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Route",0x00020000,"Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Bind",0x00010000,"\Device\Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Export",0x00010000,"\Device\Tcpip_Ne20001"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Linkage","Route",0x00010000,"Ne20001"
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"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","NameServer",0x00000000,"203.13.174.1"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","NameServer",0x00000000,"10.0.0.1"
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","ForwardBroadcasts",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","IPEnableRouter",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","SearchList",0x00000000,""
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","SearchList",0x00010000,""
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters","EnableSecurityFilters",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes",,0x00000010
;HKLM,"SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes",,0x00000010
; Virtual FAT filesystem driver
HKLM,"SYSTEM\CurrentControlSet\Services\Vfatfs","ErrorControl",0x00010001,0x00000000

View file

@ -44,6 +44,13 @@ typedef struct _MINIPORT_CONFIGURATION_CONTEXT {
KSPIN_LOCK ResourceLock;
} MINIPORT_CONFIGURATION_CONTEXT, *PMINIPORT_CONFIGURATION_CONTEXT;
/* Bugcheck callback context */
typedef struct _MINIPORT_BUGCHECK_CONTEXT {
PVOID DriverContext;
ADAPTER_SHUTDOWN_HANDLER ShutdownHandler;
PKBUGCHECK_CALLBACK_RECORD CallbackRecord;
} MINIPORT_BUGCHECK_CONTEXT, *PMINIPORT_BUGCHECK_CONTEXT;
#define GET_MINIPORT_DRIVER(Handle)((PMINIPORT_DRIVER)Handle)
/* Information about a logical adapter */
@ -81,6 +88,7 @@ typedef struct _LOGICAL_ADAPTER {
PNDIS_PACKET PacketQueueTail; /* Head of packet queue */
PNDIS_PACKET LoopPacket; /* Current packet beeing looped */
PMINIPORT_BUGCHECK_CONTEXT BugcheckContext; /* Adapter's shutdown handler */
} LOGICAL_ADAPTER, *PLOGICAL_ADAPTER;
#define GET_LOGICAL_ADAPTER(Handle)((PLOGICAL_ADAPTER)Handle)

View file

@ -69,4 +69,73 @@ DriverEntry(
return STATUS_SUCCESS;
}
/*
* @unimplemented
*/
VOID
EXPORT
NdisWriteErrorLogEntry(
IN NDIS_HANDLE NdisAdapterHandle,
IN NDIS_ERROR_CODE ErrorCode,
IN ULONG NumberOfErrorValues,
IN ULONG ERROR_LOG_MAXIMUM_SIZE)
/* IN ULONG ...)
* ERROR_LOG_MAXIMUM_SIZE = ... in MSDN
*/
{
/*
* XXX This may be tricky due to the va_arg thing. I don't
* want to figure it out now so it's just gonna be disabled.
UNIMPLEMENTED
*/
}
/*
* @implemented
*/
VOID
EXPORT
NdisInitializeReadWriteLock(
IN PNDIS_RW_LOCK Lock)
/*
* FUNCTION:
* ARGUMENTS:
* NOTES:
* NDIS 5.0
*/
{
memset(Lock,0,sizeof(NDIS_RW_LOCK));
}
/*
* @unimplemented
*/
NDIS_STATUS
EXPORT
NdisWriteEventLogEntry(
IN PVOID LogHandle,
IN NDIS_STATUS EventCode,
IN ULONG UniqueEventValue,
IN USHORT NumStrings,
IN PVOID StringsList OPTIONAL,
IN ULONG DataSize,
IN PVOID Data OPTIONAL)
/*
* FUNCTION:
* ARGUMENTS:
* NOTES:
* NDIS 5.0
*/
{
/*
* gonna try just returning true
*
UNIMPLEMENTED
return NDIS_STATUS_FAILURE;
*/
return NDIS_STATUS_SUCCESS;
}
/* EOF */

View file

@ -144,27 +144,30 @@ NdisAllocateMemory(
* HighestAcceptableAddress = Specifies -1
*/
{
PVOID Block;
if (MemoryFlags & NDIS_MEMORY_CONTIGUOUS) {
/* FIXME */
*VirtualAddress = NULL;
if (MemoryFlags & NDIS_MEMORY_NONCACHED)
{
*VirtualAddress = MmAllocateNonCachedMemory(Length);
if(!*VirtualAddress)
return NDIS_STATUS_FAILURE;
return NDIS_STATUS_SUCCESS;
}
if (MemoryFlags & NDIS_MEMORY_NONCACHED) {
/* FIXME */
*VirtualAddress = NULL;
if (MemoryFlags & NDIS_MEMORY_CONTIGUOUS)
{
*VirtualAddress = MmAllocateContiguousMemory(Length, HighestAcceptableAddress);
if(!*VirtualAddress)
return NDIS_STATUS_FAILURE;
return NDIS_STATUS_SUCCESS;
}
/* Plain nonpaged memory */
Block = ExAllocatePool(NonPagedPool, Length);
*VirtualAddress = Block;
if (!Block)
return NDIS_STATUS_FAILURE;
/* Plain nonpaged memory */
*VirtualAddress = ExAllocatePool(NonPagedPool, Length);
if (!*VirtualAddress)
return NDIS_STATUS_FAILURE;
return NDIS_STATUS_SUCCESS;
return NDIS_STATUS_SUCCESS;
}
@ -185,18 +188,19 @@ NdisFreeMemory(
* MemoryFlags = Memory flags passed to NdisAllocateMemory
*/
{
if (MemoryFlags & NDIS_MEMORY_CONTIGUOUS) {
/* FIXME */
return;
if (MemoryFlags & NDIS_MEMORY_NONCACHED)
{
MmFreeNonCachedMemory(VirtualAddress, Length);
return;
}
if (MemoryFlags & NDIS_MEMORY_NONCACHED) {
/* FIXME */
return;
if (MemoryFlags & NDIS_MEMORY_CONTIGUOUS)
{
MmFreeContiguousMemory(VirtualAddress);
return;
}
/* Plain nonpaged memory */
ExFreePool(VirtualAddress);
ExFreePool(VirtualAddress);
}
@ -211,6 +215,7 @@ NdisImmediateReadSharedMemory(
OUT PUCHAR Buffer,
IN ULONG Length)
{
UNIMPLEMENTED
}

View file

@ -754,14 +754,17 @@ NdisMCreateLog(
/*
* @unimplemented
* @implemented
*/
VOID
EXPORT
NdisMDeregisterAdapterShutdownHandler(
IN NDIS_HANDLE MiniportHandle)
{
UNIMPLEMENTED
PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)MiniportHandle;
if(Adapter->BugcheckContext->ShutdownHandler)
KeDeregisterBugCheckCallback(Adapter->BugcheckContext->CallbackRecord);
}
@ -902,9 +905,19 @@ NdisMQueryInformationComplete(
Status);
}
VOID NdisIBugcheckCallback(
IN PVOID Buffer,
IN ULONG Length)
{
PMINIPORT_BUGCHECK_CONTEXT Context = (PMINIPORT_BUGCHECK_CONTEXT)Buffer;
ADAPTER_SHUTDOWN_HANDLER sh = (ADAPTER_SHUTDOWN_HANDLER)Context->ShutdownHandler;
if(sh)
sh(Context->DriverContext);
}
/*
* @unimplemented
* @implemented
*/
VOID
EXPORT
@ -913,7 +926,20 @@ NdisMRegisterAdapterShutdownHandler(
IN PVOID ShutdownContext,
IN ADAPTER_SHUTDOWN_HANDLER ShutdownHandler)
{
UNIMPLEMENTED
PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)MiniportHandle;
PMINIPORT_BUGCHECK_CONTEXT BugcheckContext = Adapter->BugcheckContext;
if(BugcheckContext->ShutdownHandler)
return;
BugcheckContext->ShutdownHandler = ShutdownHandler;
BugcheckContext->DriverContext = ShutdownContext;
/* not sure if this needs to be initialized or not... oh well, it's a leak. */
BugcheckContext->CallbackRecord = ExAllocatePool(NonPagedPool, sizeof(KBUGCHECK_CALLBACK_RECORD));
KeRegisterBugCheckCallback(BugcheckContext->CallbackRecord, NdisIBugcheckCallback,
BugcheckContext, sizeof(BugcheckContext), "Ndis Miniport");
}
@ -1302,8 +1328,7 @@ NdisMRegisterMiniport(
NDIS_DbgPrint(MIN_TRACE, ("MiniportInitialize() failed for an adapter.\n"));
}
/* NextRouteOffset += wcslen((WCHAR *)RouteData->Data); */
RouteData->Data[NextRouteOffset] = 0; /* will cause the while to break */
NextRouteOffset += wcslen((WCHAR *)RouteData->Data);
}
ExFreePool(RouteData);

View file

@ -150,26 +150,6 @@ NdisMapFile(
UNIMPLEMENTED
}
/*
* @unimplemented
*/
VOID
EXPORT
NdisWriteErrorLogEntry(
IN NDIS_HANDLE NdisAdapterHandle,
IN NDIS_ERROR_CODE ErrorCode,
IN ULONG NumberOfErrorValues,
IN ULONG ERROR_LOG_MAXIMUM_SIZE)
/* IN ULONG ...)
* ERROR_LOG_MAXIMUM_SIZE = ... in MSDN
*/
{
/*
* let's just try not doing anything at all
UNIMPLEMENTED
*/
}
/*
* @unimplemented
@ -481,24 +461,6 @@ NdisGetSystemUptime(
}
/*
* @unimplemented
*/
VOID
EXPORT
NdisInitializeReadWriteLock(
IN PNDIS_RW_LOCK Lock)
/*
* FUNCTION:
* ARGUMENTS:
* NOTES:
* NDIS 5.0
*/
{
UNIMPLEMENTED
}
/*
* @unimplemented
*/
@ -857,38 +819,6 @@ NdisReleaseReadWriteLock(
UNIMPLEMENTED
}
/*
* @unimplemented
*/
NDIS_STATUS
EXPORT
NdisWriteEventLogEntry(
IN PVOID LogHandle,
IN NDIS_STATUS EventCode,
IN ULONG UniqueEventValue,
IN USHORT NumStrings,
IN PVOID StringsList OPTIONAL,
IN ULONG DataSize,
IN PVOID Data OPTIONAL)
/*
* FUNCTION:
* ARGUMENTS:
* NOTES:
* NDIS 5.0
*/
{
/*
* gonna try just returning true
*
UNIMPLEMENTED
return NDIS_STATUS_FAILURE;
*/
return NDIS_STATUS_SUCCESS;
}
/*
* @unimplemented
*/