- Merge aicom-network-fixes up to r36740
[reactos.git] / reactos / drivers / network / dd / pcnet / pcnet.c
index 31c9c77..f1fbf06 100644 (file)
@@ -573,6 +573,9 @@ MiniportHalt(
   /* 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);
 
@@ -781,6 +784,18 @@ MiTestCard(
 }
 #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
 MiniportInitialize(
@@ -952,6 +967,8 @@ MiniportInitialize(
     ASSERT(0);
 #endif
 
+  NdisMRegisterAdapterShutdownHandler(Adapter->MiniportAdapterHandle, Adapter, MiniportShutdown);
+
   DPRINT("returning 0x%x\n", Status);
   *OpenErrorStatus = Status;
   return Status;