Blob Blame History Raw
From 126bc4387648fabf0478d0b869fe6bc52676b447 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Sun, 29 Mar 2020 19:25:39 +0200
Subject: [PATCH 02/17] move PnP devices to the ISA/LPC bridge

---
 src/core/pnp.cc | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/core/pnp.cc b/src/core/pnp.cc
index 8c92adf647a0..6a391856ec52 100644
--- a/src/core/pnp.cc
+++ b/src/core/pnp.cc
@@ -165,6 +165,11 @@ hw::hwClass pnp_class(const string & pnpid)
   return hw::generic;
 }
 
+static bool ISAbridge(const hwNode & n)
+{
+  return n.getClass()==hw::bridge && n.isCapable("isa");
+}
+
 bool scan_pnp(hwNode & n)
 {
   vector < sysfs::entry > entries = sysfs::entries_by_bus("pnp");
@@ -172,11 +177,12 @@ bool scan_pnp(hwNode & n)
   if (entries.empty())
     return false;
 
-  hwNode *core = n.getChild("core");
-  if (!core)
+  hwNode *isapnpbridge = n.findChild(ISAbridge);
+  if (!isapnpbridge) isapnpbridge = n.getChild("core");
+  if (!isapnpbridge)
   {
     n.addChild(hwNode("core", hw::bus));
-    core = n.getChild("core");
+    isapnpbridge = n.getChild("core");
   }
 
   for (vector < sysfs::entry >::iterator it = entries.begin();
@@ -208,7 +214,7 @@ bool scan_pnp(hwNode & n)
       device.setProduct("PnP device " + pnpid);
     device.claim();
 
-    core->addChild(device);
+    isapnpbridge->addChild(device);
   }
   return true;
 }
-- 
2.17.1