From: Paul Durrant Date: Wed, 4 Mar 2015 10:09:51 +0000 (+0000) Subject: Only call PdoSuspend() and PdoResume() when in the correct state X-Git-Tag: 8.1.0-rc1~50 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=124869c8aa6acf07986cc72a02355e8ad1cf4284;p=pvdrivers%2Fwin%2Fxenbus.git Only call PdoSuspend() and PdoResume() when in the correct state The FDO code calls PdoSuspend() and PdoResume() when a PDO is removed or added (respectively) to the FDO list. However, if the FDO is not in state D0, this is not the correct thing to do. Currently PdoSuspend() and PdoResume() do nothing in XENBUS, but the equivalent functions in XENVIF do and a call to PdoSuspend() when the FDO was in D3 was causing a BSOD. Commit 5b895423957de23a82dc763dc378e305be16817a fixes this problem in XENVIF. This patch brings XENBUS into line. Signed-off-by: Paul Durrant --- diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c index 17a74ab..1eb5fa8 100644 --- a/src/xenbus/fdo.c +++ b/src/xenbus/fdo.c @@ -706,7 +706,8 @@ FdoAddPhysicalDeviceObject( ASSERT3U(Fdo->References, !=, 0); Fdo->References++; - PdoResume(Pdo); + if (__FdoGetDevicePowerState(Fdo) == PowerDeviceD0) + PdoResume(Pdo); } VOID @@ -722,7 +723,8 @@ FdoRemovePhysicalDeviceObject( Dx = (PXENBUS_DX)DeviceObject->DeviceExtension; ASSERT3U(Dx->Type, ==, PHYSICAL_DEVICE_OBJECT); - PdoSuspend(Pdo); + if (__FdoGetDevicePowerState(Fdo) == PowerDeviceD0) + PdoSuspend(Pdo); RemoveEntryList(&Dx->ListEntry); ASSERT3U(Fdo->References, !=, 0); diff --git a/src/xenbus/pdo.c b/src/xenbus/pdo.c index 621f377..4c6017d 100644 --- a/src/xenbus/pdo.c +++ b/src/xenbus/pdo.c @@ -2206,6 +2206,8 @@ PdoResume( ) { UNREFERENCED_PARAMETER(Pdo); + + Trace("<===>\n"); } VOID @@ -2214,6 +2216,8 @@ PdoSuspend( ) { UNREFERENCED_PARAMETER(Pdo); + + Trace("<===>\n"); } NTSTATUS