]> xenbits.xensource.com Git - people/pauldu/xenbus.git/commitdiff
Make sure XENFILT PDOs get moved from Present to Enumerated
authorPaul Durrant <paul.durrant@citrix.com>
Thu, 23 Jul 2015 14:10:13 +0000 (15:10 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Thu, 23 Jul 2015 14:12:15 +0000 (15:12 +0100)
The code to adjust the state was mistakenly removed in a previous patch.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/xenfilt/fdo.c

index 7121eb24b8888001d5342b66480f7ced989f1435..0c48090e7fa8d704deb070b7843857e5acca229c 100644 (file)
@@ -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;