[AUDIO-BRINGUP]
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Sun, 26 Dec 2010 11:35:05 +0000 (11:35 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Sun, 26 Dec 2010 11:35:05 +0000 (11:35 +0000)
- Hack-register software bus driver

svn path=/branches/audio-bringup/; revision=50142

boot/bootdata/txtsetup.sif
boot/freeldr/freeldr/arch/i386/hardware.c
media/inf/machine.inf
ntoskrnl/io/pnpmgr/pnpmgr.c

index 15d5b7b..24eb5f2 100644 (file)
@@ -48,7 +48,7 @@ ext2.sys=,,,,,,x,,,,,,4
 *PNP0C08 = acpi
 ;PCI\CC_0601 = isapnp
 PCI\CC_0604 = pci
-ROOT\SWENUM = swenum
+SWENUM = swenum
 
 [BootBusExtenders.Load]
 acpi = acpi.sys
index 641bd8d..3e280d6 100644 (file)
@@ -1978,6 +1978,46 @@ DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey)
   /* FIXME: Add display peripheral (monitor) data */
 }
 
+static VOID
+DetectSWBus(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
+{
+  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
+  PCONFIGURATION_COMPONENT_DATA BusKey;
+  ULONG Size;
+
+  /* Increment bus number */
+  (*BusNumber)++;
+
+    /* Set 'Configuration Data' value */
+    Size = sizeof(CM_PARTIAL_RESOURCE_LIST) - sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
+
+    PartialResourceList = MmHeapAlloc(Size);
+    if (PartialResourceList == NULL)
+    {
+        DPRINTM(DPRINT_HWDETECT, "Failed to allocate resource descriptor\n");
+        return;
+    }
+
+    /* Initialize resource descriptor */
+    memset(PartialResourceList, 0, Size);
+    PartialResourceList->Version = 1;
+    PartialResourceList->Revision = 1;
+    PartialResourceList->Count = 0;
+
+    /* Create new bus key */
+    FldrCreateComponentKey(SystemKey,
+                           AdapterClass,
+                           MultiFunctionAdapter,
+                           0x0,
+                           0x0,
+                           0xFFFFFFFF,
+                           "SWENUM",
+                           PartialResourceList,
+                           Size,
+                           &BusKey);
+
+    MmHeapFree(PartialResourceList);
+}
 
 static VOID
 DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
@@ -2056,7 +2096,8 @@ PcHwDetect(VOID)
   DetectPnpBios(SystemKey, &BusNumber);
   DetectIsaBios(SystemKey, &BusNumber);
   DetectAcpiBios(SystemKey, &BusNumber);
-  
+  DetectSWBus(SystemKey, &BusNumber);
+
   DPRINTM(DPRINT_HWDETECT, "DetectHardware() Done\n");
 
   return SystemKey;
index fa24dde..f21cf43 100644 (file)
Binary files a/media/inf/machine.inf and b/media/inf/machine.inf differ
index 69e013c..729cae0 100644 (file)
@@ -2043,6 +2043,9 @@ IopEnumerateDetectedDevices(
    const UNICODE_STRING IdentifierPci = RTL_CONSTANT_STRING(L"PCI");
    UNICODE_STRING HardwareIdPci = RTL_CONSTANT_STRING(L"*PNP0A03\0");
    static ULONG DeviceIndexPci = 0;
+   const UNICODE_STRING IdentifierSW = RTL_CONSTANT_STRING(L"SWENUM");
+   UNICODE_STRING HardwareIdSW= RTL_CONSTANT_STRING(L"SWENUM\0");
+   static ULONG DeviceIndexSW = 0;
    const UNICODE_STRING IdentifierSerial = RTL_CONSTANT_STRING(L"SerialController");
    UNICODE_STRING HardwareIdSerial = RTL_CONSTANT_STRING(L"*PNP0501\0");
    static ULONG DeviceIndexSerial = 0;
@@ -2287,7 +2290,7 @@ IopEnumerateDetectedDevices(
          if (ValueName.Length >= sizeof(WCHAR) && ValueName.Buffer[ValueName.Length / sizeof(WCHAR) - 1] == UNICODE_NULL)
             ValueName.Length -= sizeof(WCHAR);
       }
-
+DPRINT1("RelativePath %wZ\n", RelativePath);
       if (RelativePath && RtlCompareUnicodeString(RelativePath, &IdentifierSerial, FALSE) == 0)
       {
          pHardwareId = &HardwareIdSerial;
@@ -2326,9 +2329,14 @@ IopEnumerateDetectedDevices(
             pHardwareId = &HardwareIdIsa;
             DeviceIndex = DeviceIndexIsa++;
          }
+         else if (RtlCompareUnicodeString(&ValueName, &IdentifierSW, FALSE) == 0)
+         {
+            pHardwareId = &HardwareIdSW;
+            DeviceIndex = DeviceIndexSW++;
+         }
          else
          {
-            DPRINT("Unknown device '%wZ'\n", &ValueName);
+            DPRINT1("Unknown device '%wZ'\n", &ValueName);
             goto nextdevice;
          }
       }