Author: cgutman
Date: Mon Oct 6 16:39:39 2008
New Revision: 36669
URL:
http://svn.reactos.org/svn/reactos?rev=36669&view=rev
Log:
- Implement a MiniportShutdown routine for both NIC drivers
Modified:
branches/aicom-network-fixes/drivers/network/dd/ne2000/include/ne2000.h
branches/aicom-network-fixes/drivers/network/dd/ne2000/ne2000/main.c
branches/aicom-network-fixes/drivers/network/dd/pcnet/pcnet.c
Modified: branches/aicom-network-fixes/drivers/network/dd/ne2000/include/ne2000.h
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/dd/ne2000/include/ne2000.h [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/dd/ne2000/include/ne2000.h [iso-8859-1]
Mon Oct 6 16:39:39 2008
@@ -175,6 +175,7 @@
/* Flags used for driver cleanup */
BOOLEAN IOPortRangeRegistered;
BOOLEAN InterruptRegistered;
+ BOOLEAN ShutdownHandlerRegistered;
} NIC_ADAPTER, *PNIC_ADAPTER;
/* Global driver information */
Modified: branches/aicom-network-fixes/drivers/network/dd/ne2000/ne2000/main.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/dd/ne2000/ne2000/main.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/dd/ne2000/ne2000/main.c [iso-8859-1] Mon
Oct 6 16:39:39 2008
@@ -141,10 +141,13 @@
0x20,
Adapter->IOBase);
+ if (Adapter->ShutdownHandlerRegistered)
+ NdisMDeregisterAdapterShutdownHandler(Adapter->MiniportAdapterHandle);
+
/* Remove adapter from global adapter list */
if ((&Adapter->ListEntry)->Blink != NULL) {
RemoveEntryList(&Adapter->ListEntry);
- }
+ }
/* Free adapter context area */
NdisFreeMemory(Adapter, sizeof(NIC_ADAPTER), 0);
@@ -203,6 +206,14 @@
}
}
+VOID
+STDCALL
+MiniportShutdown(PVOID Context)
+{
+ #ifndef NOCARD
+ NICStop((PNIC_ADAPTER)Context);
+ #endif
+}
static NDIS_STATUS STDCALL MiniportInitialize(
OUT PNDIS_STATUS OpenErrorStatus,
@@ -414,6 +425,12 @@
/* Start the NIC */
NICStart(Adapter);
#endif
+
+ /* Register the shutdown handler */
+ NdisMRegisterAdapterShutdownHandler(MiniportAdapterHandle, Adapter,
MiniportShutdown);
+
+ Adapter->ShutdownHandlerRegistered = TRUE;
+
/* Add adapter to the global adapter list */
InsertTailList(&DriverInfo.AdapterListHead, &Adapter->ListEntry);
Modified: branches/aicom-network-fixes/drivers/network/dd/pcnet/pcnet.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/dd/pcnet/pcnet.c [iso-8859-1] (original)
+++ branches/aicom-network-fixes/drivers/network/dd/pcnet/pcnet.c [iso-8859-1] Mon Oct 6
16:39:39 2008
@@ -573,6 +573,9 @@
/* deregister i/o port range */
NdisMDeregisterIoPortRange(Adapter->MiniportAdapterHandle,
Adapter->IoBaseAddress, NUMBER_OF_PORTS, (PVOID)Adapter->PortOffset);
+ /* deregister the shutdown routine */
+ NdisMDeregisterAdapterShutdownHandler(Adapter->MiniportAdapterHandle);
+
/* free shared memory */
MiFreeSharedMemory(Adapter);
@@ -780,6 +783,18 @@
return TRUE;
}
#endif
+
+VOID
+STDCALL
+MiniportShutdown( PVOID Context )
+{
+ PADAPTER Adapter = Context;
+
+ DPRINT("Stopping the chip\n");
+
+ NdisRawWritePortUshort(Adapter->PortOffset + RAP, CSR0);
+ NdisRawWritePortUshort(Adapter->PortOffset + RDP, CSR0_STOP);
+}
static NDIS_STATUS
STDCALL
@@ -952,6 +967,8 @@
ASSERT(0);
#endif
+ NdisMRegisterAdapterShutdownHandler(Adapter->MiniportAdapterHandle, Adapter,
MiniportShutdown);
+
DPRINT("returning 0x%x\n", Status);
*OpenErrorStatus = Status;
return Status;