summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2011-06-15 22:59:48 +0200
committerAlon Levy <alevy@redhat.com>2011-06-20 12:19:25 +0200
commit639c1619add2a13956afe0d809ef4df1253cc2ec (patch)
tree992daaf46c64f4747cb5476e4999f03c21d670bf
parent11d97d41593224141ac41f312011bcd719032557 (diff)
miniport/qxl: add DebugZeroDeviceMemory and use in DBG for hibernate and
We zero the memory explicitly for debugging purposes when going to sleep to ensure the return path doesn't rely on any initialization done before. SetPowerState slightly refactored in the process.
-rw-r--r--miniport/qxl.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/miniport/qxl.c b/miniport/qxl.c
index 37def2d..344f19e 100644
--- a/miniport/qxl.c
+++ b/miniport/qxl.c
@@ -752,10 +752,29 @@ VP_STATUS GetPowerState(PVOID dev_extension,
return ERROR_DEVICE_REINITIALIZATION_NEEDED;
}
+#ifdef DBG
+static void DebugZeroDeviceMemory(QXLExtension *dev_ext)
+{
+ // don't zero the memory if the ram_start and vram_start are not initialized (a
+ // device has been installed but the monitor is disabled)
+ if (dev_ext->ram_start == 0 || dev_ext->vram_start == 0) {
+ DEBUG_PRINT((dev_ext, 0, "%s: not zeroing memory (addresses not initialized)\n", __FUNCTION__));
+ return;
+ }
+ VideoPortZeroMemory(dev_ext->ram_start, dev_ext->ram_size);
+ VideoPortZeroMemory(dev_ext->vram_start, dev_ext->vram_size);
+}
+#else
+static _inline void DebugZeroDeviceMemory(QXLExtension *dev_ext)
+{
+}
+#endif
+
VP_STATUS SetPowerState(PVOID dev_extension,
ULONG hw_id,
PVIDEO_POWER_MANAGEMENT pm_stat)
{
+ QXLExtension *dev_ext = dev_extension;
PAGED_CODE();
DEBUG_PRINT((0, "%s: %lu\n", __FUNCTION__, pm_stat->PowerState));
@@ -766,19 +785,28 @@ VP_STATUS SetPowerState(PVOID dev_extension,
ResetDeviceWithoutIO(dev_ext);
break;
case VideoPowerStandBy:
+ break;
case VideoPowerSuspend:
+ break;
case VideoPowerOff:
+ DebugZeroDeviceMemory(dev_ext);
+ break;
case VideoPowerShutdown:
+ /* Important: you cannot call out to qxldd.dll here or you get a BSOD. */
+ break;
case VideoPowerHibernate:
- DEBUG_PRINT((0, "%s: OK\n", __FUNCTION__));
- return NO_ERROR;
+ DebugZeroDeviceMemory(dev_ext);
+ break;
+ default:
+ DEBUG_PRINT((0, "%s: unexpected power state\n", __FUNCTION__));
+ return ERROR_DEVICE_REINITIALIZATION_NEEDED;
}
break;
default:
DEBUG_PRINT((0, "%s: unexpected hw_id %lu\n", __FUNCTION__, hw_id));
+ return ERROR_DEVICE_REINITIALIZATION_NEEDED;
}
- DEBUG_PRINT((0, "%s: ERROR_DEVICE_REINITIALIZATION_NEEDED\n", __FUNCTION__));
- return ERROR_DEVICE_REINITIALIZATION_NEEDED;
+ return NO_ERROR;
}
VP_STATUS GetChildDescriptor(IN PVOID dev_extension,