[HIVESYS]
authorCameron Gutman <aicommander@gmail.com>
Mon, 30 Jan 2012 21:36:51 +0000 (21:36 +0000)
committerCameron Gutman <aicommander@gmail.com>
Mon, 30 Jan 2012 21:36:51 +0000 (21:36 +0000)
- Fix the service entries
[HAL]
- Synchronously invalidate device relations
[NTOSKRNL]
- Remove hacks

svn path=/branches/usb-bringup-trunk/; revision=55336

boot/bootdata/hivesys_i386.inf
hal/halx86/acpi/halpnpdd.c
hal/halx86/legacy/halpnpdd.c
ntoskrnl/io/pnpmgr/pnpmgr.c

index e82d5d3..32a4d6b 100644 (file)
@@ -1453,31 +1453,35 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Packet","Type",0x00010001,0x00000001
 
 ; USB hub driver
 HKLM,"SYSTEM\CurrentControlSet\Services\usbhub","ErrorControl",0x00010001,0x00000001
-HKLM,"SYSTEM\CurrentControlSet\Services\usbhub","Group",0x00000000,"Boot Bus"
+HKLM,"SYSTEM\CurrentControlSet\Services\usbhub","Group",0x00000000,"Boot Bus Extender"
 HKLM,"SYSTEM\CurrentControlSet\Services\usbhub","Tag",0x00010001,0x00000002
 HKLM,"SYSTEM\CurrentControlSet\Services\usbhub","ImagePath",0x00020000,"system32\drivers\usbhub.sys"
 HKLM,"SYSTEM\CurrentControlSet\Services\usbhub","Start",0x00010001,0x00000000
+HKLM,"SYSTEM\CurrentControlSet\Services\usbhub","Type",0x00010001,0x00000002
 
 ; EHCI controller driver
 HKLM,"SYSTEM\CurrentControlSet\Services\usbehci","ErrorControl",0x00010001,0x00000001
-HKLM,"SYSTEM\CurrentControlSet\Services\usbehci","Group",0x00000000,"Boot Bus"
+HKLM,"SYSTEM\CurrentControlSet\Services\usbehci","Group",0x00000000,"Boot Bus Extender"
 HKLM,"SYSTEM\CurrentControlSet\Services\usbehci","Tag",0x00010001,0x00000002
 HKLM,"SYSTEM\CurrentControlSet\Services\usbehci","ImagePath",0x00020000,"system32\drivers\usbehci.sys"
 HKLM,"SYSTEM\CurrentControlSet\Services\usbehci","Start",0x00010001,0x00000000
+HKLM,"SYSTEM\CurrentControlSet\Services\usbehci","Type",0x00010001,0x00000002
 
 ; OHCI controller driver
 HKLM,"SYSTEM\CurrentControlSet\Services\usbohci","ErrorControl",0x00010001,0x00000001
-HKLM,"SYSTEM\CurrentControlSet\Services\usbohci","Group",0x00000000,"Boot Bus"
+HKLM,"SYSTEM\CurrentControlSet\Services\usbohci","Group",0x00000000,"Boot Bus Extender"
 HKLM,"SYSTEM\CurrentControlSet\Services\usbohci","Tag",0x00010001,0x00000002
 HKLM,"SYSTEM\CurrentControlSet\Services\usbohci","ImagePath",0x00020000,"system32\drivers\usbohci.sys"
 HKLM,"SYSTEM\CurrentControlSet\Services\usbohci","Start",0x00010001,0x00000000
+HKLM,"SYSTEM\CurrentControlSet\Services\usbohci","Type",0x00010001,0x00000001
 
 ; UHCI controller driver
-HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","ErrorControl",0x00010001,0x00000001
-HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","Group",0x00000000,"Boot Bus"
-HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","Tag",0x00010001,0x00000002
-HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","ImagePath",0x00020000,"system32\drivers\usbuhci.sys"
-HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","Start",0x00010001,0x00000000
+;HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","ErrorControl",0x00010001,0x00000001
+;HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","Group",0x00000000,"Boot Bus Extender"
+;HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","Tag",0x00010001,0x00000002
+;HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","ImagePath",0x00020000,"system32\drivers\usbuhci.sys"
+;HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","Start",0x00010001,0x00000000
+;HKLM,"SYSTEM\CurrentControlSet\Services\usbuhci","Type",0x00010001,0x00000001
 
 ; USB storage driver
 HKLM,"SYSTEM\CurrentControlSet\Services\usbstor","ErrorControl",0x00010001,0x00000001
@@ -1485,27 +1489,31 @@ HKLM,"SYSTEM\CurrentControlSet\Services\usbstor","Group",0x00000000,"Primary Dis
 HKLM,"SYSTEM\CurrentControlSet\Services\usbstor","Tag",0x00010001,0x00000002
 HKLM,"SYSTEM\CurrentControlSet\Services\usbstor","ImagePath",0x00020000,"system32\drivers\usbstor.sys"
 HKLM,"SYSTEM\CurrentControlSet\Services\usbstor","Start",0x00010001,0x00000000
+HKLM,"SYSTEM\CurrentControlSet\Services\usbstor","Type",0x00010001,0x00000001
 
 ; USB composite generic parent
 HKLM,"SYSTEM\CurrentControlSet\Services\usbccgp","ErrorControl",0x00010001,0x00000001
-HKLM,"SYSTEM\CurrentControlSet\Services\usbccgp","Group",0x00000000,"Boot Bus"
+HKLM,"SYSTEM\CurrentControlSet\Services\usbccgp","Group",0x00000000,"Boot Bus Extender"
 HKLM,"SYSTEM\CurrentControlSet\Services\usbccgp","Tag",0x00010001,0x00000002
 HKLM,"SYSTEM\CurrentControlSet\Services\usbccgp","ImagePath",0x00020000,"system32\drivers\usbccgp.sys"
 HKLM,"SYSTEM\CurrentControlSet\Services\usbccgp","Start",0x00010001,0x00000000
+HKLM,"SYSTEM\CurrentControlSet\Services\usbccgp","Type",0x00010001,0x00000001
 
 ; ACPI driver
 HKLM,"SYSTEM\CurrentControlSet\Services\acpi","ErrorControl",0x00010001,0x00000001
-HKLM,"SYSTEM\CurrentControlSet\Services\acpi","Group",0x00000000,"Boot Bus"
+HKLM,"SYSTEM\CurrentControlSet\Services\acpi","Group",0x00000000,"Boot Bus Extender"
 HKLM,"SYSTEM\CurrentControlSet\Services\acpi","Tag",0x00010001,0x00000002
 HKLM,"SYSTEM\CurrentControlSet\Services\acpi","ImagePath",0x00020000,"system32\drivers\acpi.sys"
 HKLM,"SYSTEM\CurrentControlSet\Services\acpi","Start",0x00010001,0x00000000
+HKLM,"SYSTEM\CurrentControlSet\Services\acpi","Type",0x00010001,0x00000001
 
 ; PCI Bus driver
 HKLM,"SYSTEM\CurrentControlSet\Services\Pci","ErrorControl",0x00010001,0x00000001
-HKLM,"SYSTEM\CurrentControlSet\Services\Pci","Group",0x00000000,"Boot Bus"
+HKLM,"SYSTEM\CurrentControlSet\Services\Pci","Group",0x00000000,"Boot Bus Extender"
 HKLM,"SYSTEM\CurrentControlSet\Services\Pci","Tag",0x00010001,0x00000002
 HKLM,"SYSTEM\CurrentControlSet\Services\Pci","ImagePath",0x00020000,"system32\drivers\pci.sys"
 HKLM,"SYSTEM\CurrentControlSet\Services\Pci","Start",0x00010001,0x00000000
+HKLM,"SYSTEM\CurrentControlSet\Services\Pci","Type",0x00010001,0x00000001
 HKLM,"SYSTEM\CurrentControlSet\Services\Pci\Parameters","1045C621",0x00030003,04,00,00,00,00,00,00,00
 HKLM,"SYSTEM\CurrentControlSet\Services\Pci\Parameters","10950640",0x00030003,04,00,00,00,00,00,00,00
 HKLM,"SYSTEM\CurrentControlSet\Services\Pci\Parameters","80861230",0x00030003,04,00,00,00,00,00,00,00
index 926ef20..8499ce3 100644 (file)
@@ -57,9 +57,50 @@ HalpReportDetectedDevices(IN PDRIVER_OBJECT DriverObject,
                           IN ULONG Count)
 {
     PFDO_EXTENSION FdoExtension = Context;
+    PPDO_EXTENSION PdoExtension;
+    PDEVICE_OBJECT PdoDeviceObject;
+    PDESCRIPTION_HEADER Wdrt;
+    NTSTATUS Status;
+
+    /* Create the PDO */
+    Status = IoCreateDevice(DriverObject,
+                            sizeof(PDO_EXTENSION),
+                            NULL,
+                            FILE_DEVICE_BUS_EXTENDER,
+                            FILE_AUTOGENERATED_DEVICE_NAME,
+                            FALSE,
+                            &PdoDeviceObject);
+    if (!NT_SUCCESS(Status))
+    {
+        /* Fail */
+        DPRINT1("HAL: Could not create ACPI device object status=0x%08x\n", Status);
+        return;
+    }
+
+    /* Setup the PDO device extension */
+    PdoExtension = PdoDeviceObject->DeviceExtension;
+    PdoExtension->ExtensionType = PdoExtensionType;
+    PdoExtension->PhysicalDeviceObject = PdoDeviceObject;
+    PdoExtension->ParentFdoExtension = FdoExtension;
+    PdoExtension->PdoType = AcpiPdo;
+
+    /* Add the PDO to the head of the list */
+    PdoExtension->Next = FdoExtension->ChildPdoList;
+    FdoExtension->ChildPdoList = PdoExtension;
+
+    /* Initialization is finished */
+    PdoDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
+
+    /* Find the ACPI watchdog table */
+    Wdrt = HalAcpiGetTable(0, 'TRDW');
+    if (Wdrt)
+    {
+        /* FIXME: TODO */
+        DPRINT1("You have an ACPI Watchdog. That's great! You should be proud ;-)\n");
+    }
 
-    /* Invalidate device relations since we added a new device */
-    IoInvalidateDeviceRelations(FdoExtension->PhysicalDeviceObject, BusRelations);
+    /* This will synchronously load the ACPI driver (needed because we're critical for boot) */
+    IoSynchronousInvalidateDeviceRelations(FdoExtension->PhysicalDeviceObject, BusRelations);
 }
 
 NTSTATUS
@@ -69,10 +110,7 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
 {
     NTSTATUS Status;
     PFDO_EXTENSION FdoExtension;
-    PPDO_EXTENSION PdoExtension;
     PDEVICE_OBJECT DeviceObject, AttachedDevice;
-    PDEVICE_OBJECT PdoDeviceObject;
-    PDESCRIPTION_HEADER Wdrt;
 
     DPRINT("HAL: PnP Driver ADD!\n");
 
@@ -113,43 +151,6 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
     /* Save the attachment */
     FdoExtension->AttachedDeviceObject = AttachedDevice;
 
-    /* Create the PDO */
-    Status = IoCreateDevice(DriverObject,
-                            sizeof(PDO_EXTENSION),
-                            NULL,
-                            FILE_DEVICE_BUS_EXTENDER,
-                            FILE_AUTOGENERATED_DEVICE_NAME,
-                            FALSE,
-                            &PdoDeviceObject);
-    if (!NT_SUCCESS(Status))
-    {
-        /* Fail */
-        DPRINT1("HAL: Could not create ACPI device object status=0x%08x\n", Status);
-        return Status;
-    }
-
-    /* Setup the PDO device extension */
-    PdoExtension = PdoDeviceObject->DeviceExtension;
-    PdoExtension->ExtensionType = PdoExtensionType;
-    PdoExtension->PhysicalDeviceObject = PdoDeviceObject;
-    PdoExtension->ParentFdoExtension = FdoExtension;
-    PdoExtension->PdoType = AcpiPdo;
-    
-    /* Add the PDO to the head of the list */
-    PdoExtension->Next = FdoExtension->ChildPdoList;
-    FdoExtension->ChildPdoList = PdoExtension;
-
-    /* Initialization is finished */
-    PdoDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
-
-    /* Find the ACPI watchdog table */
-    Wdrt = HalAcpiGetTable(0, 'TRDW');
-    if (Wdrt)
-    {
-        /* FIXME: TODO */
-        DPRINT1("You have an ACPI Watchdog. That's great! You should be proud ;-)\n");
-    }
-
     /* Register for reinitialization to report devices later */
     IoRegisterBootDriverReinitialization(DriverObject,
                                          HalpReportDetectedDevices,
index c3d783d..86cd7e3 100644 (file)
@@ -139,7 +139,7 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject,
 #endif
 
     /* Invalidate device relations since we added a new device */
-    IoInvalidateDeviceRelations(TargetDevice, BusRelations);
+    IoSynchronousInvalidateDeviceRelations(TargetDevice, BusRelations);
 
     /* Return status */
     DPRINT("Device added %lx\n", Status);
index c92deeb..05ddc37 100644 (file)
@@ -389,9 +389,6 @@ IopInstallCriticalDevice(PDEVICE_NODE DeviceNode)
                         DPRINT1("Installed NULL service for critical device '%wZ'\n", &ChildIdNameU);
                     }
 
-                    /* We need to enumerate children */
-                    DeviceNode->Flags |= DNF_NEED_TO_ENUM;
-
                     ExFreePool(OriginalIdBuffer);
                     ExFreePool(PartialInfo);
                     ExFreePool(BasicInfo);
@@ -2174,6 +2171,9 @@ IopHandleDeviceRemoval(
     ULONG i;
     BOOLEAN Found;
 
+    if (DeviceNode == IopRootDeviceNode)
+        return;
+
     while (Child != NULL)
     {
         NextChild = Child->Sibling;
@@ -2420,7 +2420,7 @@ IopActionConfigureChildServices(PDEVICE_NODE DeviceNode,
       UNICODE_STRING RegKey;
 
       /* Install the service for this if it's in the CDDB */
-      //IopInstallCriticalDevice(DeviceNode);
+      IopInstallCriticalDevice(DeviceNode);
 
       RegKey.Length = 0;
       RegKey.MaximumLength = sizeof(RegKeyBuffer);
@@ -2553,25 +2553,7 @@ IopActionInitChildServices(PDEVICE_NODE DeviceNode,
    if (IopDeviceNodeHasFlag(DeviceNode, DNF_STARTED) ||
        IopDeviceNodeHasFlag(DeviceNode, DNF_ADDED) ||
        IopDeviceNodeHasFlag(DeviceNode, DNF_DISABLED))
-   {
-       if (DeviceNode->Flags & DNF_NEED_TO_ENUM)
-       {
-           Status = IopInitializeDevice(DeviceNode, NULL);
-           if (NT_SUCCESS(Status))
-           {
-               /* HACK */
-               DeviceNode->Flags &= ~DNF_STARTED;
-               Status = IopStartDevice(DeviceNode);
-               if (!NT_SUCCESS(Status))
-               {
-                   DPRINT1("IopStartDevice(%wZ) failed with status 0x%08x\n",
-                           &DeviceNode->InstancePath, Status);
-               }
-           }
-           DeviceNode->Flags &= ~DNF_NEED_TO_ENUM;
-       }
        return STATUS_SUCCESS;
-   }
 
    if (DeviceNode->ServiceName.Buffer == NULL)
    {