|
|
bf6610 |
From 4ab4314e39f41045ef0e60d0a4500b204e26b313 Mon Sep 17 00:00:00 2001
|
|
|
bf6610 |
From: Dan Callaghan <dcallagh@redhat.com>
|
|
|
bf6610 |
Date: Fri, 10 Jul 2015 12:37:55 +1000
|
|
|
99c779 |
Subject: [PATCH 15/26] scan vio devices in sysfs (#692)
|
|
|
bf6610 |
|
|
|
bf6610 |
---
|
|
|
bf6610 |
src/core/Makefile | 5 +++--
|
|
|
bf6610 |
src/core/main.cc | 4 ++++
|
|
|
bf6610 |
src/core/sysfs.cc | 3 +++
|
|
|
bf6610 |
src/core/vio.cc | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
bf6610 |
src/core/vio.h | 8 ++++++++
|
|
|
bf6610 |
5 files changed, 69 insertions(+), 2 deletions(-)
|
|
|
bf6610 |
create mode 100644 src/core/vio.cc
|
|
|
bf6610 |
create mode 100644 src/core/vio.h
|
|
|
bf6610 |
|
|
|
bf6610 |
diff --git a/src/core/Makefile b/src/core/Makefile
|
|
|
bf6610 |
index da34a55..643067b 100644
|
|
|
bf6610 |
--- a/src/core/Makefile
|
|
|
bf6610 |
+++ b/src/core/Makefile
|
|
|
bf6610 |
@@ -8,7 +8,7 @@ LDFLAGS=
|
|
|
bf6610 |
LDSTATIC=
|
|
|
bf6610 |
LIBS=
|
|
|
bf6610 |
|
|
|
99c779 |
-OBJS = hw.o main.o print.o mem.o dmi.o device-tree.o cpuinfo.o osutils.o pci.o version.o cpuid.o ide.o cdrom.o pcmcia-legacy.o scsi.o dasd.o disk.o spd.o network.o isapnp.o pnp.o fb.o options.o usb.o sysfs.o display.o heuristics.o parisc.o cpufreq.o partitions.o blockio.o lvm.o ideraid.o pcmcia.o volumes.o mounts.o smp.o abi.o jedec.o dump.o fat.o virtio.o
|
|
|
99c779 |
+OBJS = hw.o main.o print.o mem.o dmi.o device-tree.o cpuinfo.o osutils.o pci.o version.o cpuid.o ide.o cdrom.o pcmcia-legacy.o scsi.o dasd.o disk.o spd.o network.o isapnp.o pnp.o fb.o options.o usb.o sysfs.o display.o heuristics.o parisc.o cpufreq.o partitions.o blockio.o lvm.o ideraid.o pcmcia.o volumes.o mounts.o smp.o abi.o jedec.o dump.o fat.o virtio.o vio.o
|
|
|
bf6610 |
ifeq ($(SQLITE), 1)
|
|
|
bf6610 |
OBJS+= db.o
|
|
|
bf6610 |
endif
|
|
|
bf6610 |
@@ -37,7 +37,7 @@ hw.o: hw.h osutils.h version.h config.h options.h heuristics.h
|
|
|
bf6610 |
main.o: hw.h print.h version.h options.h mem.h dmi.h cpuinfo.h cpuid.h
|
|
|
bf6610 |
main.o: device-tree.h pci.h pcmcia.h pcmcia-legacy.h ide.h scsi.h spd.h
|
|
|
bf6610 |
main.o: network.h isapnp.h fb.h usb.h sysfs.h display.h parisc.h cpufreq.h
|
|
|
99c779 |
-main.o: ideraid.h mounts.h smp.h abi.h dasd.h virtio.h pnp.h
|
|
|
99c779 |
+main.o: ideraid.h mounts.h smp.h abi.h dasd.h virtio.h pnp.h vio.h
|
|
|
bf6610 |
print.o: print.h hw.h options.h version.h osutils.h config.h
|
|
|
bf6610 |
mem.o: version.h config.h mem.h hw.h
|
|
|
bf6610 |
dmi.o: version.h config.h dmi.h hw.h osutils.h
|
|
|
99c779 |
@@ -77,3 +77,4 @@ abi.o: version.h abi.h hw.h osutils.h
|
|
|
bf6610 |
jedec.o: jedec.h
|
|
|
99c779 |
dasd.o: dasd.h disk.h hw.h osutils.h
|
|
|
bf6610 |
virtio.o: version.h hw.h sysfs.h disk.h virtio.h
|
|
|
bf6610 |
+vio.o: version.h hw.h sysfs.h vio.h
|
|
|
bf6610 |
diff --git a/src/core/main.cc b/src/core/main.cc
|
|
|
bf6610 |
index 7008933..3c88f4c 100644
|
|
|
bf6610 |
--- a/src/core/main.cc
|
|
|
bf6610 |
+++ b/src/core/main.cc
|
|
|
99c779 |
@@ -42,6 +42,7 @@
|
|
|
bf6610 |
#include "ideraid.h"
|
|
|
bf6610 |
#include "mounts.h"
|
|
|
bf6610 |
#include "virtio.h"
|
|
|
bf6610 |
+#include "vio.h"
|
|
|
bf6610 |
#include "smp.h"
|
|
|
bf6610 |
#include "abi.h"
|
|
|
99c779 |
#include "dasd.h"
|
|
|
99c779 |
@@ -114,6 +115,9 @@ bool scan_system(hwNode & system)
|
|
|
bf6610 |
status("Virtual I/O (VIRTIO) devices");
|
|
|
bf6610 |
if (enabled("virtio"))
|
|
|
bf6610 |
scan_virtio(computer);
|
|
|
bf6610 |
+ status("IBM Virtual I/O (VIO)");
|
|
|
bf6610 |
+ if (enabled("vio"))
|
|
|
bf6610 |
+ scan_vio(computer);
|
|
|
bf6610 |
status("kernel device tree (sysfs)");
|
|
|
bf6610 |
if (enabled("sysfs"))
|
|
|
bf6610 |
scan_sysfs(computer);
|
|
|
bf6610 |
diff --git a/src/core/sysfs.cc b/src/core/sysfs.cc
|
|
|
bf6610 |
index ed2c600..a2eca6c 100644
|
|
|
bf6610 |
--- a/src/core/sysfs.cc
|
|
|
bf6610 |
+++ b/src/core/sysfs.cc
|
|
|
bf6610 |
@@ -146,6 +146,9 @@ static string sysfstobusinfo(const string & path)
|
|
|
bf6610 |
return "virtio@" + name;
|
|
|
bf6610 |
}
|
|
|
bf6610 |
|
|
|
bf6610 |
+ if (bustype == "vio")
|
|
|
bf6610 |
+ return string("vio@") + basename(path.c_str());
|
|
|
bf6610 |
+
|
|
|
bf6610 |
return "";
|
|
|
bf6610 |
}
|
|
|
bf6610 |
|
|
|
bf6610 |
diff --git a/src/core/vio.cc b/src/core/vio.cc
|
|
|
bf6610 |
new file mode 100644
|
|
|
bf6610 |
index 0000000..e70640f
|
|
|
bf6610 |
--- /dev/null
|
|
|
bf6610 |
+++ b/src/core/vio.cc
|
|
|
bf6610 |
@@ -0,0 +1,51 @@
|
|
|
bf6610 |
+#include "version.h"
|
|
|
bf6610 |
+#include "hw.h"
|
|
|
bf6610 |
+#include "sysfs.h"
|
|
|
bf6610 |
+#include "vio.h"
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+#include <vector>
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+__ID("@(#) $Id$");
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+using namespace std;
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+bool scan_vio(hwNode & n)
|
|
|
bf6610 |
+{
|
|
|
bf6610 |
+ vector < sysfs::entry > entries = sysfs::entries_by_bus("vio");
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+ if (entries.empty())
|
|
|
bf6610 |
+ return false;
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+ for (vector < sysfs::entry >::iterator it = entries.begin();
|
|
|
bf6610 |
+ it != entries.end(); ++it)
|
|
|
bf6610 |
+ {
|
|
|
bf6610 |
+ const sysfs::entry & e = *it;
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+ if (e.name() == "vio")
|
|
|
bf6610 |
+ continue; // skip root device
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+ string name = e.string_attr("name");
|
|
|
bf6610 |
+ if (name.empty())
|
|
|
bf6610 |
+ name = e.name();
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+ hwNode device(name);
|
|
|
bf6610 |
+ device.setDescription("Virtual I/O device (" + name + ")");
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+ string businfo = e.businfo();
|
|
|
bf6610 |
+ if (!businfo.empty())
|
|
|
bf6610 |
+ device.setBusInfo(businfo);
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+ string driver = e.driver();
|
|
|
bf6610 |
+ if (!driver.empty())
|
|
|
bf6610 |
+ device.setConfig("driver", driver);
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+ string devicetree_node = e.string_attr("devspec");
|
|
|
bf6610 |
+ if (!devicetree_node.empty() && devicetree_node[0] == '/')
|
|
|
bf6610 |
+ device.setLogicalName("/proc/device-tree" + devicetree_node);
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+ n.addChild(device);
|
|
|
bf6610 |
+ }
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+ return true;
|
|
|
bf6610 |
+}
|
|
|
bf6610 |
diff --git a/src/core/vio.h b/src/core/vio.h
|
|
|
bf6610 |
new file mode 100644
|
|
|
bf6610 |
index 0000000..d220f19
|
|
|
bf6610 |
--- /dev/null
|
|
|
bf6610 |
+++ b/src/core/vio.h
|
|
|
bf6610 |
@@ -0,0 +1,8 @@
|
|
|
bf6610 |
+#ifndef _VIO_H_
|
|
|
bf6610 |
+#define _VIO_H_
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+#include "hw.h"
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+bool scan_vio(hwNode &);
|
|
|
bf6610 |
+
|
|
|
bf6610 |
+#endif
|
|
|
bf6610 |
--
|
|
|
99c779 |
2.10.2
|
|
|
bf6610 |
|