[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH 7/7] Make sure XENFILT PDOs get moved from Present to Enumerated



The code to adjust the state was mistakenly removed in a previous patch.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xenfilt/fdo.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/xenfilt/fdo.c b/src/xenfilt/fdo.c
index 7121eb2..0c48090 100644
--- a/src/xenfilt/fdo.c
+++ b/src/xenfilt/fdo.c
@@ -535,8 +535,6 @@ FdoEnumerate(
                   Relations->Objects,
                   sizeof (PDEVICE_OBJECT) * Count);
 
-    __FdoAcquireMutex(Fdo);
-
     // Remove any PDOs that do not appear in the device list
     ListEntry = Fdo->List.Flink;
     while (ListEntry != &Fdo->List) {
@@ -561,8 +559,6 @@ FdoEnumerate(
             (VOID) FdoAddDevice(Fdo, PhysicalDeviceObject[Index]);
     }
     
-    __FdoReleaseMutex(Fdo);
-
     __FdoSetEnumerated(Fdo);
 
     __FdoFree(PhysicalDeviceObject);
@@ -1128,6 +1124,8 @@ FdoQueryDeviceRelations(
 
     LowerRelations = (PDEVICE_RELATIONS)Irp->IoStatus.Information;
 
+    __FdoAcquireMutex(Fdo);
+
     if (LowerRelations->Count != 0)
         FdoEnumerate(Fdo, LowerRelations);
 
@@ -1145,7 +1143,20 @@ FdoQueryDeviceRelations(
         goto fail3;
 
     if (State == XENFILT_FILTER_DISABLED) {
-        ASSERT3U(Count, ==, LowerRelations->Count);
+        PLIST_ENTRY ListEntry;
+
+        for (ListEntry = Fdo->List.Flink;
+             ListEntry != &Fdo->List;
+             ListEntry = ListEntry->Flink) {
+            PXENFILT_DX     Dx = CONTAINING_RECORD(ListEntry, XENFILT_DX, 
ListEntry);
+            PXENFILT_PDO    Pdo = Dx->Pdo;
+
+            ASSERT3U(Dx->Type, ==, PHYSICAL_DEVICE_OBJECT);
+
+            if (PdoGetDevicePnpState(Pdo) == Present)
+                PdoSetDevicePnpState(Pdo, Enumerated);
+        }
+
         RtlCopyMemory(Relations, LowerRelations, Size);
 
         Trace("%s: %d PDO(s)\n",
@@ -1164,6 +1175,8 @@ FdoQueryDeviceRelations(
                                     BusRelations);
     }
 
+    __FdoReleaseMutex(Fdo);
+
     ExFreePool(LowerRelations);
 
     Irp->IoStatus.Information = (ULONG_PTR)Relations;
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.