summaryrefslogtreecommitdiff
path: root/general/PLX9x5x/sys/Pci9656.c
diff options
context:
space:
mode:
authorkarlf <[email protected]>2016-08-11 13:28:13 -0700
committerkarlf <[email protected]>2016-08-11 13:28:13 -0700
commit96eb96dfb613e4c745db6bd1f53a92fe7e2290fc (patch)
treead5f3ede5cbcd6b598677ce41bcf8318471bdd92 /general/PLX9x5x/sys/Pci9656.c
parent687b274aa38fd05c8c26e3068932121876d7f745 (diff)
Updated for "Windows 10 Anniversary Update" (Version 1607)
Diffstat (limited to 'general/PLX9x5x/sys/Pci9656.c')
-rw-r--r--general/PLX9x5x/sys/Pci9656.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/general/PLX9x5x/sys/Pci9656.c b/general/PLX9x5x/sys/Pci9656.c
index 176b9ca7..7fc33349 100644
--- a/general/PLX9x5x/sys/Pci9656.c
+++ b/general/PLX9x5x/sys/Pci9656.c
@@ -38,6 +38,7 @@ Environment:
#ifdef ALLOC_PRAGMA
#pragma alloc_text (INIT, DriverEntry)
#pragma alloc_text (PAGE, PLxEvtDeviceAdd)
+#pragma alloc_text (PAGE, PlxEvtDeviceCleanup)
#pragma alloc_text (PAGE, PLxEvtDevicePrepareHardware)
#pragma alloc_text (PAGE, PLxEvtDeviceReleaseHardware)
#pragma alloc_text (PAGE, PLxEvtDeviceD0Exit)
@@ -201,6 +202,12 @@ Return Value:
attributes.SynchronizationScope = WdfSynchronizationScopeDevice;
//
+ // This callback is invoked when the device is removed or the driver
+ // is unloaded.
+ //
+ attributes.EvtCleanupCallback = PlxEvtDeviceCleanup;
+
+ //
// Create the device
//
status = WdfDeviceCreate( &DeviceInit, &attributes, &device );
@@ -288,6 +295,36 @@ Return Value:
return status;
}
+_Use_decl_annotations_
+VOID
+PlxEvtDeviceCleanup(
+ _In_ WDFOBJECT Device
+ )
+/*++
+
+Routine Description:
+
+ Invoked before the device object is deleted.
+
+Arguments:
+
+ Device - A handle to the WDFDEVICE
+
+Return Value:
+
+ None
+
+--*/
+{
+ PDEVICE_EXTENSION devExt;
+
+ PAGED_CODE();
+
+ devExt = PLxGetDeviceContext((WDFDEVICE)Device);
+
+ PlxCleanupDeviceExtension(devExt);
+}
+
NTSTATUS
PLxEvtDevicePrepareHardware (
WDFDEVICE Device,
@@ -382,12 +419,11 @@ Return Value:
devExt = PLxGetDeviceContext(Device);
if (devExt->RegsBase) {
-
MmUnmapIoSpace(devExt->RegsBase, devExt->RegsLength);
devExt->RegsBase = NULL;
}
- if(devExt->SRAMBase){
+ if (devExt->SRAMBase) {
MmUnmapIoSpace(devExt->SRAMBase, devExt->SRAMLength);
devExt->SRAMBase = NULL;
}