Blame SOURCES/0002-move-PnP-devices-to-the-ISA-LPC-bridge.patch

33b0a4
From 126bc4387648fabf0478d0b869fe6bc52676b447 Mon Sep 17 00:00:00 2001
33b0a4
From: Lyonel Vincent <lyonel@ezix.org>
33b0a4
Date: Sun, 29 Mar 2020 19:25:39 +0200
33b0a4
Subject: [PATCH 02/17] move PnP devices to the ISA/LPC bridge
33b0a4
33b0a4
---
33b0a4
 src/core/pnp.cc | 14 ++++++++++----
33b0a4
 1 file changed, 10 insertions(+), 4 deletions(-)
33b0a4
33b0a4
diff --git a/src/core/pnp.cc b/src/core/pnp.cc
33b0a4
index 8c92adf647a0..6a391856ec52 100644
33b0a4
--- a/src/core/pnp.cc
33b0a4
+++ b/src/core/pnp.cc
33b0a4
@@ -165,6 +165,11 @@ hw::hwClass pnp_class(const string & pnpid)
33b0a4
   return hw::generic;
33b0a4
 }
33b0a4
 
33b0a4
+static bool ISAbridge(const hwNode & n)
33b0a4
+{
33b0a4
+  return n.getClass()==hw::bridge && n.isCapable("isa");
33b0a4
+}
33b0a4
+
33b0a4
 bool scan_pnp(hwNode & n)
33b0a4
 {
33b0a4
   vector < sysfs::entry > entries = sysfs::entries_by_bus("pnp");
33b0a4
@@ -172,11 +177,12 @@ bool scan_pnp(hwNode & n)
33b0a4
   if (entries.empty())
33b0a4
     return false;
33b0a4
 
33b0a4
-  hwNode *core = n.getChild("core");
33b0a4
-  if (!core)
33b0a4
+  hwNode *isapnpbridge = n.findChild(ISAbridge);
33b0a4
+  if (!isapnpbridge) isapnpbridge = n.getChild("core");
33b0a4
+  if (!isapnpbridge)
33b0a4
   {
33b0a4
     n.addChild(hwNode("core", hw::bus));
33b0a4
-    core = n.getChild("core");
33b0a4
+    isapnpbridge = n.getChild("core");
33b0a4
   }
33b0a4
 
33b0a4
   for (vector < sysfs::entry >::iterator it = entries.begin();
33b0a4
@@ -208,7 +214,7 @@ bool scan_pnp(hwNode & n)
33b0a4
       device.setProduct("PnP device " + pnpid);
33b0a4
     device.claim();
33b0a4
 
33b0a4
-    core->addChild(device);
33b0a4
+    isapnpbridge->addChild(device);
33b0a4
   }
33b0a4
   return true;
33b0a4
 }
33b0a4
-- 
33b0a4
2.17.1
33b0a4