--- lshw-02.18.orig/debian/README.source +++ lshw-02.18/debian/README.source @@ -0,0 +1,3 @@ +Refer to /usr/share/doc/quilt/README.source + + -- Ghe Rivero , Thu, 17 Feb 2011 09:14:52 +0100 --- lshw-02.18.orig/debian/changelog +++ lshw-02.18/debian/changelog @@ -0,0 +1,461 @@ +lshw (02.18-0.1ubuntu6.18.04.2) bionic; urgency=medium + + * Backported patches for NMVe support (LP: #1826737): + - d/p/lp1826737-code-clean-up.patch + - d/p/lp1826737-implement-NVMe-scanning.patch + - d/p/lp1826737-align-physical-ID-with-NVMe-namespace.patch + - d/p/lp1826737-treat-NVMe-namespaces-like-disks.patch + + -- Victor Manuel Tapia King Thu, 17 Dec 2020 10:34:41 +0100 + +lshw (02.18-0.1ubuntu6.18.04.1) bionic; urgency=medium + + * d/patches/lshw-add-json-option-in-help-output.patch, + * d/patches/lshw-fix-unknown-version-issue.patch: + Cherry pick from upstream. (LP: #1752523) + * d/rules: pass uver as VERSION when building the core module as + the lshw-fix-unknown-version-issue.patch expects that variable + to be set, otherwise lshw's version will be set to an empty + string. + + -- Tiago Stürmer Daitx Tue, 10 Jul 2018 14:25:42 +0000 + +lshw (02.18-0.1ubuntu6) bionic; urgency=medium + + * AArch64: cpuinfo: Remove redundant cpu caps loop (LP: #1582181) + (Merged into EZix upstream commit [20cda772]) + + -- Ike Panhc Wed, 21 Mar 2018 14:42:13 +0800 + +lshw (02.18-0.1ubuntu5) bionic; urgency=medium + + * d/patches/devtree-Check-status-property-for-caches.patch, + d/patches/devtree-Parse-spd-data.patch, + d/patches/cpuinfo-Do-not-enable-cpu-node-on-IBM-Power-System.patch, + d/patches/devtree-Add-vendor-field-for-cpu-node.patch: + Cherry pick from upstream (LP: #1745018) + + -- Julian Andres Klode Wed, 24 Jan 2018 21:35:32 +0100 + +lshw (02.18-0.1ubuntu4) artful; urgency=medium + + * d/p/fix-segfault-in-privileged-containers.patch: + Fix lshw crashes with SEGV in privileged containers (LP: #1699161) + (cherry-picked from EZix upstream commit [7b99d35]) + + -- Eric Desrochers Mon, 23 Oct 2017 10:25:52 -0400 + +lshw (02.18-0.1ubuntu3) zesty; urgency=medium + + * Parse-OPAL-firmware-properties-from-the-device-tree.patch: drop; per + discussion with IBM, this is no longer needed due to changes in the + upstream devicetree layout on the hardware in question. LP: #1655102. + + -- Steve Langasek Tue, 28 Mar 2017 12:25:04 -0700 + +lshw (02.18-0.1ubuntu2) zesty; urgency=medium + + * debian/patches/merge-github-pull-request-23-parse-CPU-information.patch, + debian/patches/devtree-*, + debian/patches/cpuinfo-Rectify-cpuinfo-for-IBM-Power-Systems.patch, + debian/patches/pci-Add-device-tree-info.patch: cherry-pick from upstream. + LP: #1655102. + * debian/patches/Parse-OPAL-firmware-properties-from-the-device-tree.patch: + fix up patch to apply on top of above upstream patch. + + -- Steve Langasek Tue, 21 Mar 2017 18:53:48 -0700 + +lshw (02.18-0.1ubuntu1) yakkety; urgency=low + + * Merge from Debian unstable. Remaining changes: + - debian/patches/Parse-OPAL-firmware-properties-from-the-device-tree.patch: + include support for displaying OPAL information on PowerNV systems. + * Dropped changes, included in Debian: + - debian/patches/fix-width-handling.patch: Fix regression in detecting + platform width. + - debian/patches/Avoid-crash-in-scan_dmi_sysfs-when-running-as-non-ro.patch: + Fix a regression that causes lshw to crash when running unprivileged + + -- Steve Langasek Sun, 21 Aug 2016 22:07:06 -0700 + +lshw (02.18-0.1) unstable; urgency=medium + + * Non-maintainer upload with permission of the maintainer. + * New upstream release. Closes: #823639, #756921, #746616, #758550, + #767023. + - Refresh patches for unfortunate new upstream tarball layout. + - debian/patches/fat-inspection.patch, debian/patches/smbios-noscan.patch: + drop, fixed upstream. + - Drop debian/patches/sparc.patch: no longer applies cleanly, and is + incorrect (double header inclusion). + * debian/patches/Avoid-crash-in-scan_dmi_sysfs-when-running-as-non-ro.patch: + patch taken from Ubuntu to fix an upstream regression when running as + non-root; thanks to dann frazier + * debian/patches/fix-width-handling.patch: Fix regression in detecting + platform width. + + -- Steve Langasek Mon, 15 Aug 2016 13:42:04 -0700 + +lshw (02.18-0ubuntu1) yakkety; urgency=medium + + * New upstream release. Closes: #823639, #756921, #746616, #758550. + - Refresh patches for unfortunate new upstream tarball layout. + - debian/patches/cpuinfo-arm-aarch64-s390-support.patch, + debian/patches/fix-endianness-problem-in-dev-tree-parsing.patch, + debian/patches/ddr3-device-tree-support.patch, + debian/patches/Do-not-brutally-merge-NICs-in-the-same-PCI-function-.patch, + debian/patches/fat-inspection.patch, + debian/patches/presumably-fix-653.patch, + debian/patches/use-sysfs-for-DMI-info-when-available-696-666-664.patch: + drop, included upstream. + - Drop debian/patches/sparc.patch: no longer applies cleanly, and is + incorrect (double header inclusion). + * debian/patches/Parse-OPAL-firmware-properties-from-the-device-tree.patch: + include support for displaying OPAL information on PowerNV systems. + LP: #1585186. + * debian/patches/fix-width-handling.patch: Fix regression in detecting + platform width. + + -- Steve Langasek Mon, 15 Aug 2016 13:42:04 -0700 + +lshw (02.17-1.1ubuntu5) yakkety; urgency=medium + + * d/p/Avoid-crash-in-scan_dmi_sysfs-when-running-as-non-ro.patch: Fix a + regression from the last upload that causes lshw to crash when running + unprivileged (LP: #1590994). + + -- dann frazier Mon, 13 Jun 2016 16:36:15 -0600 + +lshw (02.17-1.1ubuntu4) yakkety; urgency=medium + + * Use upstream solution for avoiding /dev/mem accesses on !x86, + fixing a memory size detection regression (LP: #1039701): + - Drop: smbios-noscan.patch + - Add: use-sysfs-for-DMI-info-when-available-696-666-664.patch + + -- dann frazier Wed, 01 Jun 2016 15:01:29 -0600 + +lshw (02.17-1.1ubuntu3) wily; urgency=medium + + * [d048d30] Fix lshw crash issue on system with some USB-3 sticks + (LP: #1471983) + + -- Chen-Han Hsiao (Stanley) Sun, 11 Oct 2015 21:35:54 +0800 + +lshw (02.17-1.1ubuntu2) wily; urgency=medium + + [ Manoj Iyer ] + * debian/patches/cpuinfo-arm-aarch64-s390-support.patch: + - Backport from upstream to better support arm, aarch64, and s390 + + -- Michael Terry Tue, 18 Aug 2015 15:06:49 -0400 + +lshw (02.17-1.1ubuntu1) vivid; urgency=medium + + * Resynchronise with Debian (LP: #1427436), remaining changes: + - Fix endianness issues with device-tree + - Add DDR3 support for systems described by device-tree + - Support multiple NICs sharing the same PCI function + * aarch64-disable-smbios-check.patch: Superseded (LP: #1388262) + + -- Adam Conrad Fri, 03 Apr 2015 21:34:15 -0600 + +lshw (02.17-1.1) unstable; urgency=medium + + * Non-maintainer upload. + * Disable the memory scanning for all architectures other + than i386 and x86_64. Patch from Leif Lindholm + (Closes: #740034) + * Prevent segfault if system has FAT partition(s) Patch from + Alban Browaeys (Closes: #757689) + + -- Neil Williams Thu, 06 Nov 2014 12:16:13 +0000 + +lshw (02.17-1ubuntu1) vivid; urgency=medium + + * Resynchronise with Debian. Remaining changes: + - Disable /dev/mem access for SMBIOS on aarch64 systems + - Fix endianness issues with device-tree + - Add DDR3 support for systems described by device-tree + * Support multiple NICs sharing the same PCI function (LP: #1379591) + + -- dann frazier Mon, 27 Oct 2014 13:22:38 -0600 + +lshw (02.17-1) unstable; urgency=medium + + [ Alex Henrie ] + * New upstream release + * SVG icon + * Changed desktop category from Settings to System + + -- Ghe Rivero Tue, 29 Jul 2014 12:20:05 +0200 + +lshw (02.16-2.1) unstable; urgency=medium + + * Non-maintainer upload. + * Closes: #572098 + - lshw-gtk.desktop requires su-to-root from the menu package + + -- Alex Henrie Thu, 24 Jul 2014 22:39:07 +0200 + +lshw (02.16-2) unstable; urgency=low + + * Closes: #525217 + - lshw: segfauls on armel (! /proc/efi/systab) + * Closes: #707152 + - lshw can miscount cpus on devicetree platforms + + -- Ghe Rivero Thu, 27 Jun 2013 04:10:58 -0400 + +lshw (02.16-1) unstable; urgency=low + + * New upstream release + + -- Ghe Rivero Sat, 30 Jun 2012 10:15:18 +0200 + +lshw (02.15-2) unstable; urgency=low + + * Relaxed depends on pciutils and usbutils. Closes: #540119 + + -- Ghe Rivero Sun, 18 Dec 2011 13:26:10 +0100 + +lshw (02.15-1) unstable; urgency=low + + * [bbfc08f] Imported Upstream version 02.15 + * [927e643] Updated debian/watch file + * [7ce089a] Clean some patches + * [2ef1ea7] Added libsqlite3-dev as build-depend + * [ea1f7f5] Bumped policy version + * [2254715] New upstream release fixed FTBFS gcc4.5 (Closes: #565031) + * [abac6bb] Added Spanish translation to .desktop. + Thanks to Javier Fernández-Sanguino Peña (JFS) (Closes: #537904) + * [ef94e6e] Added gksu launcher to .desktop. + Thanks to Javier Fernández-Sanguino Peña (JFS) (Closes: #537903) + * [ed92c99] Lintian clean again + * [5e64767] Fixed manpage + + -- Ghe Rivero Thu, 17 Feb 2011 10:10:08 +0100 + +lshw (02.14-1) unstable; urgency=low + + * New upstream release + * Some lintian clean + * Standars Version 3.8.2 + + -- Ghe Rivero Sat, 25 Jul 2009 15:30:52 +0200 + +lshw (02.13-2) unstable; urgency=low + + * Added patch sparc: FTBFS in sparc arch. (Closes: #480628) + + -- Ghe Rivero Sun, 11 May 2008 16:09:55 +0200 + +lshw (02.13-1) unstable; urgency=low + + * New upstream release + - Fixe lshw: no output for memory (Closes: #456896) + * Migrated dpatch to quilt + * Clean lintian (no more copyright-without-copyright-notice) + + -- Ghe Rivero Sat, 10 May 2008 15:36:31 +0200 + +lshw (02.12.01-4) unstable; urgency=low + + * DudesConf2 release + * Added patch 09-sysfs-hang + * Added patch 10-privacy + + -- Ghe Rivero Sat, 03 May 2008 12:37:32 +0200 + +lshw (02.12.01-3) unstable; urgency=low + + * Now really updated Debian-Policy Standards-Version to 3.7.3 + * watch file working again. (Closes: #453535) + * lintian cleans: + - debian-rules-ignores-make-clean-error + - debian-rules-sets-DH_COMPAT + - dpatch-missing-description + + -- Ghe Rivero Sat, 2 Feb 2008 18:04:41 +0100 + +lshw (02.12.01-2) unstable; urgency=low + + * More fixes for gcc4.3. Closes: #462000 + * Updated Debian-Policy Standards-Version to 3.7.3 + + -- Ghe Rivero Wed, 23 Jan 2008 14:20:46 +0100 + +lshw (02.12.01-1) unstable; urgency=low + + * New upstream release + * More fixes for gcc4.3 (Ubuntu Patch). Closes: #441569 + * Some Lintian cleans: + Remove homepage from page description + * Static man-page (no build-depends on docbook-utils) + * Moved icon menu to /usr/share/pixmaps + * Added /usr/share/pixmpas and /usr/share/applications to lshw-gtk.dir + + -- Ghe Rivero Wed, 26 Dec 2007 13:22:07 +0100 + +lshw (02.11.01-2) unstable; urgency=low + + * s/gtk-lshw/lshw-gtk/g Closes: #443771 + * Some lintian cleans (new menu Applications section) + + -- Ghe Rivero Mon, 8 Oct 2007 17:29:45 +0200 + +lshw (02.11.01-1) unstable; urgency=low + + * New upstream release + * Fixed ftbfs with g++-4.3/gcc-snapshot (07-gcc43.dpath). Closes: #441569 + * Explain why lshw -X fail in non X environment. Closes: #434644 + + -- Ghe Rivero Wed, 12 Sep 2007 09:54:48 +0200 + +lshw (02.10-4) unstable; urgency=low + + * Added Upstream Homepage to package description. Closes: #426698 + * Updated Debian-Policy Standards-Version to 3.7.2 + + -- Ghe Rivero Wed, 30 May 2007 13:02:26 +0200 + +lshw (02.10-3) unstable; urgency=low + + * New URL at debian/copyright. Closes: #405452 + + -- Ghe Rivero Mon, 28 May 2007 18:09:22 +0200 + +lshw (02.10-2) unstable; urgency=low + + * New upstream release. Closes: #413800 + * New Maintainer mail address in control file + + -- Ghe Rivero Fri, 25 May 2007 11:02:42 +0200 + +lshw (02.10-1) unstable; urgency=low + + * New upstream release. Closes: #405452 + * Remove lshw-common package. manuf.txt and oui.txt aren't used at all, + and we now depend on pciutils and usbutils for pci.ids and usb.ids + respectively (ubuntu patch) + * New URL at debian/copyright. Closes: #405452 + * Fix FTBFS with GCC 4.3: missing #includes. Closes: #417381 + + -- Ghe Rivero Thu, 03 May 2007 20:02:07 +0200 + +lshw (02.08.01-1) unstable; urgency=low + + * New upstream release. Closes: #360182 + * Added AMD64 to the known platforms that works properly. Closes: #349619 + + -- Ghe Rivero Thu, 20 Jul 2006 00:35:07 +0200 + +lshw (02.06-3) unstable; urgency=low + + * "See you in GUA, Debconf-es2" Release + * Change CXX flags on alpha, so no more segfaults. + Closes: #243752 and similar not reported to BTS. + * Small fix on code for alpha (dpatch 06-alpha) + * gxx transition + * Dedicated to Endesa to switch off the electricity from my university + all the weekend :/ + * Updated DH_COMPAT=4 + * Removed ${shlibs:Depends} variable from lshw-common + + -- Ghe Rivero Wed, 21 Dec 2005 16:58:49 +0100 + +lshw (02.06-2) unstable; urgency=low + + * Updated rules files. Copy logy.xpm instead of move it. + + -- Ghe Rivero Mon, 17 Oct 2005 21:48:29 +0200 + +lshw (02.06-1) unstable; urgency=low + + * New upstream release + + -- Ghe Rivero Sun, 16 Oct 2005 23:59:50 +0200 + +lshw (02.05.01-3) unstable; urgency=low + + * Removed spurious files from source. + * Make works with DEB_BUILD_OPTIONS. + * Now can be compiled twice or more. + + -- Ghe Rivero Sun, 16 Oct 2005 23:11:27 +0200 + +lshw (02.05.01-2) unstable; urgency=low + + * New Free Software Foundation (FSF) address: + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. + + -- Ghe Rivero Tue, 27 Sep 2005 22:10:16 +0200 + +lshw (02.05.01-1) unstable; urgency=low + + * New upstream release + * Added manpage for lshw-gtk (lintian/linda clean) + * Upgraded to Debian Policy 3.6.2 + + -- Ghe Rivero Thu, 21 Jul 2005 23:42:52 +0200 + +lshw (02.04-1) unstable; urgency=low + + * New upstream release + * lshw-common is now arch independent, closes: #308473 + * Added watch file + * Binaries moved to /usr/bin, + Added menu entry for lshw-gtk, closes: #303393 + + -- Ghe Rivero Sun, 17 Jul 2005 13:29:09 +0200 + +lshw (02.03-2) unstable; urgency=low + + * Build fix on AMD64, closes: #298029 + * Build fix on no network machines, Depends on hwdata, closes: #300788 + * Build Depends on dpatch + + -- Ghe Rivero Wed, 23 Mar 2005 00:16:06 +0100 + +lshw (02.03-1) unstable; urgency=low + + * New upstream release + * Recommends pciutils and hwdata, closes: #191506 + + -- Ghe Rivero Sun, 6 Feb 2005 23:09:00 +0100 + +lshw (02.00-1) unstable; urgency=low + + * New upstream release, closes: #233038 + * Updated standards version from 3.5.10 to 3.6.1 + * New binary package: lshw-gtk, a GUI frontend + * New package: lshw-common, hw info files + + -- Ghe Rivero Thu, 6 Jan 2005 23:01:14 +0100 + +lshw (01.03-1) unstable; urgency=low + + * New upstream release. + This release include SCSI support, closes: #182543. + Includes alpha support, closes: #183502. + It also fix html output, closes: #182826. + * Removed the manpage from debian dir because it is there in upstream + sources. This also means that the build dependency on perl is changed + to docbook-utils. + * Updated standards version from 3.5.8 to 3.5.10. + + -- Ola Lundqvist Sat, 30 Aug 2003 12:56:50 +0200 + +lshw (0.06-2) unstable; urgency=low + + * Fixed description, closes: #183321. + + -- Ola Lundqvist Thu, 17 Apr 2003 22:36:19 +0200 + +lshw (0.06-1) unstable; urgency=low + + * Initial release, closes: #181106. + + -- Ola Lundqvist Sat, 15 Feb 2003 13:23:56 +0100 + --- lshw-02.18.orig/debian/compat +++ lshw-02.18/debian/compat @@ -0,0 +1 @@ +6 \ No newline at end of file --- lshw-02.18.orig/debian/control +++ lshw-02.18/debian/control @@ -0,0 +1,33 @@ +Source: lshw +Section: utils +Priority: optional +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Ghe Rivero +Build-Depends: debhelper (>> 6.0.0), libgtk2.0-dev, quilt, libsqlite3-dev +Standards-Version: 3.9.4 + +Package: lshw +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Recommends: pciutils, usbutils +Description: information about hardware configuration + A small tool to provide detailed information on the hardware + configuration of the machine. It can report exact memory + configuration, firmware version, mainboard configuration, CPU version + and speed, cache configuration, bus speed, etc. on DMI-capable x86 + systems, on some PowerPC machines (PowerMac G4 is known to work) and AMD64. + . + Information can be output in plain text, HTML or XML. + +Package: lshw-gtk +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Recommends: menu, pciutils, usbutils +Description: graphical information about hardware configuration + A small tool to provide detailed information on the hardware + configuration of the machine. It can report exact memory + configuration, firmware version, mainboard configuration, CPU version + and speed, cache configuration, bus speed, etc. on DMI-capable x86 + systems, on some PowerPC machines (PowerMac G4 is known to work) and AMD64. + . + This package provides lshw-gtk (the GTK+ version) --- lshw-02.18.orig/debian/copyright +++ lshw-02.18/debian/copyright @@ -0,0 +1,26 @@ +This package was debianized by Ola Lundqvist on +Sat, 15 Feb 2003 13:23:56 +0100. + +It was downloaded from: + http://ezix.org/project/wiki/HardwareLiSter + +Upstream Author: + Lyonel Vincent + +Copyright: 2003-2008 Lyonel Vincent + + This is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 2, or (at your option) any later + version. + + This is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License with + your Debian GNU/Linux system, in /usr/share/common-licenses/GPL, or with + the lshw source package as the file COPYING. If not, write to the Free + Software Foundation, Inc.,51 Franklin St, Fifth Floor, Boston, + MA 02110-1301, USA. --- lshw-02.18.orig/debian/lshw-common.dirs +++ lshw-02.18/debian/lshw-common.dirs @@ -0,0 +1 @@ +usr/share/lshw --- lshw-02.18.orig/debian/lshw-gtk.dirs +++ lshw-02.18/debian/lshw-gtk.dirs @@ -0,0 +1,3 @@ +usr/bin +usr/share/applications +usr/share/pixmaps \ No newline at end of file --- lshw-02.18.orig/debian/lshw-gtk.manpages +++ lshw-02.18/debian/lshw-gtk.manpages @@ -0,0 +1 @@ +debian/patches/lshw-gtk.1 --- lshw-02.18.orig/debian/lshw-gtk.menu +++ lshw-02.18/debian/lshw-gtk.menu @@ -0,0 +1 @@ +?package(lshw-gtk):needs="x11" section="Applications/System/Monitoring" title="lshw-gtk" command="lshw-gtk" icon="/usr/share/pixmaps/lshw-gtk.xpm" --- lshw-02.18.orig/debian/lshw.dirs +++ lshw-02.18/debian/lshw.dirs @@ -0,0 +1 @@ +usr/bin --- lshw-02.18.orig/debian/patches/AArch64-cpuinfo-Remove-redundant-cpu-caps-loop.patch +++ lshw-02.18/debian/patches/AArch64-cpuinfo-Remove-redundant-cpu-caps-loop.patch @@ -0,0 +1,90 @@ +From: Alexandru Avadanii +Date: Sun, 15 May 2016 22:16:03 +0200 +Subject: [PATCH] AArch64: cpuinfo: Remove redundant cpu caps loop. + +CPU capabilities should be added only to the current CPU core, +and not recursively to all previous CPU cores. + +For a 48 core node, this parsing added up to 30 seconds (8 lines +per core in /proc/cpuinfo resulted in 384 lines to parse). + +After this change, parsing for the above system takes less than +1 second. + +Signed-off-by: Alexandru Avadanii +--- + lshw-B.02.18/src/core/cpuinfo.cc | 57 ++++++++++++++++++++++++++--------------------------- + 1 file changed, 28 insertions(+), 29 deletions(-) + +diff --git a/lshw-B.02.18/src/core/cpuinfo.cc b/lshw-B.02.18/src/core/cpuinfo.cc +index 5c7a6b1..1a3ea9d 100644 +--- a/lshw-B.02.18/src/core/cpuinfo.cc ++++ b/lshw-B.02.18/src/core/cpuinfo.cc +@@ -74,37 +74,36 @@ static void cpuinfo_aarch64(hwNode & node, + + if (id == "Features") + { +- while (value.length() > 0) +- { +- size_t pos = value.find(' '); +- string capability = (pos==string::npos)?value:value.substr(0, pos); +- aarch64_features.push_back(capability); +- if (pos == string::npos) +- value = ""; +- else +- value = hw::strip(value.substr(pos)); +- } +- for(int i=0; i<=currentcpu; i++) ++ hwNode *cpu = getcpu(node, currentcpu); ++ if (cpu) + { +- hwNode *cpu = getcpu(node, i); +- if (cpu) ++ cpu->addHint("logo", string("aarch64")); ++ if (node.getDescription() == "") ++ node.setDescription(aarch64_processor_name); ++ cpu->claim(true); ++ ++ while (value.length() > 0) ++ { ++ size_t pos = value.find(' '); ++ string capability = (pos==string::npos)?value:value.substr(0, pos); ++ aarch64_features.push_back(capability); ++ if (pos == string::npos) ++ value = ""; ++ else ++ value = hw::strip(value.substr(pos)); ++ } ++ ++ for(int i=0; i < aarch64_features.size(); i++) + { +- cpu->addHint("logo", string("aarch64")); +- if (node.getDescription() == "") +- node.setDescription(aarch64_processor_name); +- cpu->claim(true); +- for(int i=0; i < aarch64_features.size(); i++) +- { +- cpu->addCapability(aarch64_features[i]); +- cpu->describeCapability("fp", "Floating point instructions"); +- cpu->describeCapability("asimd", "Advanced SIMD"); +- cpu->describeCapability("evtstrm", "Event stream"); +- cpu->describeCapability("aes", "AES instructions"); +- cpu->describeCapability("pmull", "PMULL instruction"); +- cpu->describeCapability("sha1", "SHA1 instructions"); +- cpu->describeCapability("sha2", "SHA2 instructions"); +- cpu->describeCapability("crc32", "CRC extension"); +- } ++ cpu->addCapability(aarch64_features[i]); ++ cpu->describeCapability("fp", "Floating point instructions"); ++ cpu->describeCapability("asimd", "Advanced SIMD"); ++ cpu->describeCapability("evtstrm", "Event stream"); ++ cpu->describeCapability("aes", "AES instructions"); ++ cpu->describeCapability("pmull", "PMULL instruction"); ++ cpu->describeCapability("sha1", "SHA1 instructions"); ++ cpu->describeCapability("sha2", "SHA2 instructions"); ++ cpu->describeCapability("crc32", "CRC extension"); + } + } + } +-- +1.9.1 --- lshw-02.18.orig/debian/patches/Avoid-crash-in-scan_dmi_sysfs-when-running-as-non-ro.patch +++ lshw-02.18/debian/patches/Avoid-crash-in-scan_dmi_sysfs-when-running-as-non-ro.patch @@ -0,0 +1,26 @@ +From: dann frazier +Date: Thu, 9 Jun 2016 17:40:54 -0600 +Subject: [PATCH] Avoid crash in scan_dmi_sysfs() when running as non-root + (#716) + +Instead of just checking that the sysfs files exist, make sure we +can also read them. + +Bug: http://ezix.org/project/ticket/716 +Bug-Ubuntu: http://bugs.launchpad.net/bugs/1590994 +Forwarded: https://github.com/lyonel/lshw/pull/14 +Last-Update: 2016-06-13 + +diff --git a/src/core/dmi.cc b/src/core/dmi.cc +index ced891a..8bfe86f 100644 +--- a/lshw-B.02.18/src/core/dmi.cc ++++ b/lshw-B.02.18/src/core/dmi.cc +@@ -1823,7 +1823,7 @@ static bool smbios_entry_point(const u8 *buf, size_t len, + + static bool scan_dmi_sysfs(hwNode & n) + { +- if (!exists(SYSFSDMI "/smbios_entry_point") || !exists(SYSFSDMI "/DMI")) ++ if (access(SYSFSDMI "/smbios_entry_point", R_OK) || access(SYSFSDMI "/DMI", R_OK)) + return false; + + uint32_t table_len = 0; --- lshw-02.18.orig/debian/patches/alpha.patch +++ lshw-02.18/debian/patches/alpha.patch @@ -0,0 +1,14 @@ +diff -urNad lshw-02.06~/src/core/pcmcia.cc lshw-02.06/src/core/pcmcia.cc +--- lshw-02.06~/src/core/pcmcia.cc 2005-10-13 23:33:55.000000000 +0200 ++++ lshw-02.06/src/core/pcmcia.cc 2005-10-18 10:32:20.000000000 +0200 +@@ -1007,8 +1007,8 @@ + { + if (stab[i][0] == 'S') + { +- unsigned int pos = stab[i].find(':'); +- ++ string::size_type pos = stab[i].find(':'); ++ + socketname = ""; + carddescription = ""; + --- lshw-02.18.orig/debian/patches/arm-disable-smbios-check.patch +++ lshw-02.18/debian/patches/arm-disable-smbios-check.patch @@ -0,0 +1,15 @@ +Index: src/core/dmi.cc +=================================================================== +--- a/lshw-B.02.18/src/core/dmi.cc (revision 2519) ++++ b/lshw-B.02.18/src/core/dmi.cc (working copy) +@@ -1752,8 +1752,8 @@ + u16 dmimaj = 0, dmimin = 0; + currentcpu = 0; + +-#ifdef __hppa__ +- return false; // SMBIOS not supported on PA-RISC machines ++#if defined(__arm__) || defined (__hppa__) ++ return false; // SMBIOS not supported on ARM and PA-RISC machines + #endif + + if (sizeof(u8) != 1 || sizeof(u16) != 2 || sizeof(u32) != 4) --- lshw-02.18.orig/debian/patches/bin.patch +++ lshw-02.18/debian/patches/bin.patch @@ -0,0 +1,14 @@ +Move binaries to /bin instead of /sbin +It can be executed by normal users without privilegesIndex: lshw-02.14/src/Makefile +=================================================================== +--- a/lshw-B.02.18/src/Makefile ++++ b/lshw-B.02.18/src/Makefile +@@ -6,7 +6,7 @@ + + DESTDIR?=/ + PREFIX?=/usr +-SBINDIR=$(PREFIX)/sbin ++SBINDIR=$(PREFIX)/bin + MANDIR=$(PREFIX)/share/man + DATADIR=$(PREFIX)/share + INSTALL?=install -p --- lshw-02.18.orig/debian/patches/cflags.patch +++ lshw-02.18/debian/patches/cflags.patch @@ -0,0 +1,46 @@ +Change of Makefile +* Don't include debug info +* Compile using CXX_DEB_FLAGSIndex: lshw-02.14/src/Makefile +=================================================================== +--- a/lshw-B.02.18/src/gui/Makefile ++++ b/lshw-B.02.18/src/gui/Makefile +@@ -8,7 +8,8 @@ + DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" + GTKINCLUDES=$(shell pkg-config gtk+-2.0 --cflags) + INCLUDES=-I../core $(GTKINCLUDES) +-CXXFLAGS=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) ++#CXXFLAGS=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) ++CXXFLAGS=$(CXX_DEB_FLAGS) $(INCLUDES) $(DEFINES) + CFLAGS=$(CXXFLAGS) $(DEFINES) + GTKLIBS=$(shell pkg-config gtk+-2.0 gmodule-2.0 --libs) + LIBS=-L../core -llshw -lresolv -lsqlite3 $(GTKLIBS) +--- a/lshw-B.02.18/src/Makefile ++++ b/lshw-B.02.18/src/Makefile +@@ -21,11 +21,13 @@ + CXX?=c++ + INCLUDES=-I./core/ + DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" +-CXXFLAGS=-g -Wall -g $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) ++#CXXFLAGS=-g -Wall -g $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) ++CXXFLAGS=$(CXX_DEB_FLAGS) $(INCLUDES) $(DEFINES) + ifeq ($(SQLITE), 1) + CXXFLAGS+= -DSQLITE $(shell pkg-config --cflags sqlite3) + endif +-LDFLAGS=-L./core/ -g ++#LDFLAGS=-L./core/ -g ++LDFLAGS=-L./core/ + ifneq ($(shell $(LD) --help 2| grep -- --as-needed), ) + LDFLAGS+= -Wl,--as-needed + endif +--- a/lshw-B.02.18/src/core/Makefile ++++ b/lshw-B.02.18/src/core/Makefile +@@ -3,7 +3,8 @@ + CXX=c++ + INCLUDES= + DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" +-CXXFLAGS?=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) ++#CXXFLAGS?=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) ++CXXFLAGS?=$(CXX_DEB_FLAGS) $(INCLUDES) $(DEFINES) + LDFLAGS= + LDSTATIC= + LIBS= --- lshw-02.18.orig/debian/patches/cpuinfo-Do-not-enable-cpu-node-on-IBM-Power-System.patch +++ lshw-02.18/debian/patches/cpuinfo-Do-not-enable-cpu-node-on-IBM-Power-System.patch @@ -0,0 +1,32 @@ +From b253f9bd66478d2ed6e3a9c89aa81ca262a8f772 Mon Sep 17 00:00:00 2001 +From: Vasant Hegde +Date: Tue, 22 Aug 2017 20:58:11 +0530 +Subject: [PATCH 3/4] cpuinfo: Do not enable cpu node on IBM Power System + +On IBM Power System device tree parsing code detects CPU state +and sets enable flag properly. Hence do not call enable() from +cpuinfo code. + +Signed-off-by: Vasant Hegde +--- + src/core/cpuinfo.cc | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/core/cpuinfo.cc b/src/core/cpuinfo.cc +index b475594..f6aef74 100644 +--- a/lshw-B.02.18/src/core/cpuinfo.cc ++++ b/lshw-B.02.18/src/core/cpuinfo.cc +@@ -37,7 +37,9 @@ int n = 0) + { + cpu->addHint("icon", string("cpu")); + cpu->claim(true); // claim the cpu and all its children +- cpu->enable(); // enable it ++ if (!is_system_ppc_ibm(node)) ++ cpu->enable(); // enable it ++ + return cpu; + } + +-- +2.15.1 + --- lshw-02.18.orig/debian/patches/cpuinfo-Rectify-cpuinfo-for-IBM-Power-Systems.patch +++ lshw-02.18/debian/patches/cpuinfo-Rectify-cpuinfo-for-IBM-Power-Systems.patch @@ -0,0 +1,111 @@ +From 9a81309286a05f2b088c9898a0e3a16e807532be Mon Sep 17 00:00:00 2001 +From: Chandni Verma +Date: Thu, 20 Oct 2016 19:24:46 +0530 +Subject: [PATCH 07/19] cpuinfo: Rectify cpuinfo for IBM Power Systems + +'/proc/cpuinfo' file on Power Systems represents online CPU threads, +not physical cores. Also we can dynamically change number of threads. + +Previous patch added support to parse device tree and display core +information under CPU nodes. + +This patch pulls useful info from cpuinfo file and updates CPU nodes. + - description : Processor description + - version : Processor version including subversion + +Signed-off-by: Chandni Verma +[Code cleanup, updated description - Vasant] +Signed-off-by: Vasant Hegde +--- + src/core/cpuinfo.cc | 47 ++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 46 insertions(+), 1 deletion(-) + +diff --git a/lshw-B.02.18/src/core/cpuinfo.cc b/lshw-B.02.18/src/core/cpuinfo.cc +index 5a2b8c0..8443adc 100644 +--- a/lshw-B.02.18/src/core/cpuinfo.cc ++++ b/lshw-B.02.18/src/core/cpuinfo.cc +@@ -13,6 +13,13 @@ __ID("@(#) $Id$"); + + static int currentcpu = 0; + ++static inline bool is_system_ppc_ibm(hwNode & node) ++{ ++ string desc = node.getDescription(); ++ ++ return (desc == "PowerNV" || desc == "pSeries Guest" || desc == "pSeries LPAR"); ++} ++ + static hwNode *getcpu(hwNode & node, + int n = 0) + { +@@ -33,6 +40,13 @@ int n = 0) + return cpu; + } + ++ /* ++ * device-tree.cc creates all CPU nodes on Power Systems. ++ * Hence do not create new CPU nodes here. ++ */ ++ if (is_system_ppc_ibm(node)) ++ return NULL; ++ + hwNode *core = node.getChild("core"); + + if (core) +@@ -49,6 +63,20 @@ int n = 0) + + + #ifdef __powerpc__ ++static void cpuinfo_ppc_ibm(hwNode & node, ++ const string & description, const string & version) ++{ ++ hwNode *cpu = getcpu(node, currentcpu); ++ ++ while (cpu) ++ { ++ cpu->setDescription(description); ++ cpu->setVersion(version); ++ ++ cpu = getcpu(node, ++currentcpu); ++ } ++} ++ + static void cpuinfo_ppc(hwNode & node, + string id, + string value) +@@ -570,6 +598,7 @@ bool scan_cpuinfo(hwNode & n) + char buffer[1024]; + size_t count; + string cpuinfo_str = ""; ++ string description = "", version = ""; + + while ((count = read(cpuinfo, buffer, sizeof(buffer))) > 0) + { +@@ -599,7 +628,23 @@ bool scan_cpuinfo(hwNode & n) + cpuinfo_x86(n, id, value); + #endif + #ifdef __powerpc__ +- cpuinfo_ppc(n, id, value); ++ ++ // All cores have same product name and version on power systems ++ if (is_system_ppc_ibm(n)) ++ { ++ if (id == "cpu") ++ description = value; ++ if (id == "revision") ++ version = value; ++ ++ if (description != "" && version != "") ++ { ++ cpuinfo_ppc_ibm(n, description, version); ++ break; ++ } ++ } ++ else ++ cpuinfo_ppc(n, id, value); + #endif + #ifdef __s390x__ + cpuinfo_s390x(n, id, value); +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Add-VPD-info-for-BMC-based-IBM-Power-System.patch +++ lshw-02.18/debian/patches/devtree-Add-VPD-info-for-BMC-based-IBM-Power-System.patch @@ -0,0 +1,152 @@ +From d0791b8831e2eee3e6942dbcbe716021576a72bd Mon Sep 17 00:00:00 2001 +From: Jack Miller +Date: Thu, 20 Oct 2016 16:43:22 +0530 +Subject: [PATCH 06/19] devtree: Add VPD info for BMC based IBM Power System + +Power Systems supports various environment and various service +processor types (like IBM FSP, industry standard BMC, etc). + +We have processor chip level VPD (part number, serial number etc) +and all cores under chip shares this information. + +BMC based Power Systems provides chip VPD information under xscom +node. This patch adds support for adding VPD information for CPU +nodes on BMC based system. + +Sample output: + *-cpu:0 + description: POWER8 (raw), altivec supported + product: 00UM003 + vendor: PROCESSOR + physical id: 16 + bus info: cpu@0 + version: 2.0 (pvr 004d 0200) + serial: YA1932579651 + size: 2061MHz + capacity: 3491MHz + capabilities: performance-monitor cpufreq + configuration: threads=8 + +Signed-off-by: Jack Miller +[Reorganized code, updated description - Vasant] +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 58 +++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 56 insertions(+), 2 deletions(-) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index 16406fd..d61347b 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -443,16 +443,19 @@ static void scan_chip_vpd(map & vpd) + + + static void fill_core_vpd(hwNode & cpu, string & basepath, +- map & chip_vpd) ++ map & chip_vpd, ++ map & xscoms) + { + uint32_t chip_id; + chip_vpd_data *data; ++ string xscom_path; + + if (!exists(basepath + "/ibm,chip-id")) + return; + + chip_id = get_u32(basepath + "/ibm,chip-id"); + data = chip_vpd[chip_id]; ++ xscom_path = xscoms[chip_id]; + + if (data) + { +@@ -460,6 +463,25 @@ static void fill_core_vpd(hwNode & cpu, string & basepath, + cpu.setSerial(data->serial); + cpu.setSlot(data->slot); + } ++ ++ if (xscom_path != "") ++ { ++ vector board_pieces; ++ ++ splitlines(hw::strip(get_string(xscom_path + "/board-info")), ++ board_pieces, ' '); ++ if (board_pieces.size() > 0) ++ cpu.setVendor(board_pieces[0]); ++ ++ if (exists(xscom_path + "/serial-number")) ++ cpu.setSerial(hw::strip(get_string(xscom_path + "/serial-number"))); ++ ++ if (exists(xscom_path + "/ibm,slot-location-code")) ++ cpu.setSlot(hw::strip(get_string(xscom_path + "/ibm,slot-location-code"))); ++ ++ if (exists(xscom_path + "/part-number")) ++ cpu.setProduct(hw::strip(get_string(xscom_path + "/part-number"))); ++ } + } + + static void set_cpu_config_threads(hwNode & cpu, const string & basepath) +@@ -488,6 +510,34 @@ static void set_cpu_config_threads(hwNode & cpu, const string & basepath) + } + + ++static void scan_xscom_node(map & xscoms) ++{ ++ int n; ++ struct dirent **namelist; ++ ++ pushd(DEVICETREE); ++ n = scandir(".", &namelist, selectdir, alphasort); ++ popd(); ++ ++ if (n <= 0) ++ return; ++ ++ for (int i = 0; i < n; i++) { ++ string sname = string(namelist[i]->d_name); ++ string fullpath = ""; ++ int chip_id = 0; ++ ++ if (sname.substr(0,5) == "xscom") { ++ fullpath = string(DEVICETREE) + "/" + sname; ++ chip_id = get_u32(fullpath + "/ibm,chip-id"); ++ xscoms.insert(std::pair(chip_id, fullpath)); ++ } ++ ++ free(namelist[i]); ++ } ++ free(namelist); ++} ++ + static void scan_devtree_cpu_power(hwNode & core) + { + int n; +@@ -496,6 +546,7 @@ static void scan_devtree_cpu_power(hwNode & core) + map > > l2_caches; + map > l3_caches; + map chip_vpd; ++ map xscoms; + + pushd(DEVICETREE "/cpus"); + n = scandir(".", &namelist, selectdir, alphasort); +@@ -578,6 +629,9 @@ static void scan_devtree_cpu_power(hwNode & core) + */ + scan_chip_vpd(chip_vpd); + ++ // List all xscom nodes under DT ++ scan_xscom_node(xscoms); ++ + for (int i = 0; i < n; i++) //second and final pass + { + uint32_t l2_key = 0; +@@ -608,7 +662,7 @@ static void scan_devtree_cpu_power(hwNode & core) + if (version != 0) + cpu.setVersion(tostring(version)); + +- fill_core_vpd(cpu, basepath, chip_vpd); ++ fill_core_vpd(cpu, basepath, chip_vpd, xscoms); + + if (hw::strip(get_string(basepath + "/status")) != "okay") + cpu.disable(); +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Add-VPD-info-for-FSP-based-Power-System.patch +++ lshw-02.18/debian/patches/devtree-Add-VPD-info-for-FSP-based-Power-System.patch @@ -0,0 +1,192 @@ +From 8059dc9ef1cb92107370ff4e1e9a390210ec01b7 Mon Sep 17 00:00:00 2001 +From: Chandni Verma +Date: Thu, 20 Oct 2016 14:55:43 +0530 +Subject: [PATCH 05/19] devtree: Add VPD info for FSP based Power System + +Power Systems supports various service processor (IBM FSP, BMC, etc). + +We have processor chip level VPD (part number, serial number etc) and +all cores under chip shares this information. + +On FSP based system, chip level vpd is available under '/vpd' node. This +patch adds support to parse /vpd information and fill part, slot, serial +number info for CPU nodes. + +Sample output: + *-cpu:0 + description: POWER8E (raw), altivec supported + product: 00FY143 FRU #00FX519 + physical id: 32 + bus info: cpu@0 + version: 2.0 (pvr 004b 0200) + serial: YA3932008163 + slot: U78C9.001.RST0027-P1-C32 + size: 2061MHz + capacity: 4123MHz + capabilities: performance-monitor cpufreq + configuration: threads=8 + +Signed-off-by: Chandni Verma +[Reorganized code, updated description - Vasant] +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 115 ++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 115 insertions(+) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index 9c74e5a..16406fd 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -361,6 +361,107 @@ static void scan_devtree_cpu(hwNode & core) + } + } + ++ ++struct chip_vpd_data ++{ ++ string product; ++ string serial; ++ string slot; ++}; ++ ++ ++static void add_chip_vpd(string path, string name, ++ map & vpd) ++{ ++ int n; ++ struct dirent **dirlist; ++ ++ pushd(path + name); ++ ++ if (name.substr(0, 9) == "processor" && exists("ibm,chip-id")) ++ { ++ uint32_t chip_id = get_u32("ibm,chip-id"); ++ chip_vpd_data *data = new chip_vpd_data(); ++ ++ if (data) ++ { ++ if (exists("serial-number")) ++ data->serial = hw::strip(get_string("serial-number")); ++ ++ if (exists("ibm,loc-code")) ++ data->slot = hw::strip(get_string("ibm,loc-code")); ++ ++ if (exists("part-number")) ++ data->product = hw::strip(get_string("part-number")); ++ ++ if (exists("fru-number")) ++ data->product += " FRU #" + hw::strip(get_string("fru-number")); ++ ++ vpd.insert(std::pair(chip_id, data)); ++ } ++ } ++ ++ n = scandir(".", &dirlist, selectdir, alphasort); ++ popd(); ++ ++ if (n <= 0) ++ return; ++ ++ for (int i = 0; i < n; i++) ++ { ++ add_chip_vpd(path + name + "/", dirlist[i]->d_name, vpd); ++ free(dirlist[i]); ++ } ++ ++ free(dirlist); ++} ++ ++ ++static void scan_chip_vpd(map & vpd) ++{ ++ int n; ++ struct dirent **namelist; ++ ++ if (!exists(DEVICETREEVPD)) ++ return; ++ ++ pushd(DEVICETREEVPD); ++ n = scandir(".", &namelist, selectdir, alphasort); ++ popd(); ++ ++ if (n <= 0) ++ return; ++ ++ for (int i = 0; i < n; i++) ++ { ++ add_chip_vpd(DEVICETREEVPD, namelist[i]->d_name, vpd); ++ free(namelist[i]); ++ } ++ ++ free(namelist); ++} ++ ++ ++static void fill_core_vpd(hwNode & cpu, string & basepath, ++ map & chip_vpd) ++{ ++ uint32_t chip_id; ++ chip_vpd_data *data; ++ ++ if (!exists(basepath + "/ibm,chip-id")) ++ return; ++ ++ chip_id = get_u32(basepath + "/ibm,chip-id"); ++ data = chip_vpd[chip_id]; ++ ++ if (data) ++ { ++ cpu.setProduct(data->product); ++ cpu.setSerial(data->serial); ++ cpu.setSlot(data->slot); ++ } ++} ++ + static void set_cpu_config_threads(hwNode & cpu, const string & basepath) + { + static int threads_per_cpu = 0; +@@ -394,6 +495,7 @@ static void scan_devtree_cpu_power(hwNode & core) + struct dirent **namelist; + map > > l2_caches; + map > l3_caches; ++ map chip_vpd; + + pushd(DEVICETREE "/cpus"); + n = scandir(".", &namelist, selectdir, alphasort); +@@ -469,6 +571,13 @@ static void scan_devtree_cpu_power(hwNode & core) + } + } // first pass end + ++ /* ++ * We have chip level VPD information (like part number, slot, etc). ++ * and this information is same for all cores under chip. ++ * Fetch chip-level VPD from /vpd node. ++ */ ++ scan_chip_vpd(chip_vpd); ++ + for (int i = 0; i < n; i++) //second and final pass + { + uint32_t l2_key = 0; +@@ -499,6 +608,8 @@ static void scan_devtree_cpu_power(hwNode & core) + if (version != 0) + cpu.setVersion(tostring(version)); + ++ fill_core_vpd(cpu, basepath, chip_vpd); ++ + if (hw::strip(get_string(basepath + "/status")) != "okay") + cpu.disable(); + +@@ -548,6 +659,10 @@ static void scan_devtree_cpu_power(hwNode & core) + free(namelist[i]); + } + free(namelist); ++ ++ map ::iterator it; ++ for (it = chip_vpd.begin(); it != chip_vpd.end(); it++) ++ delete it->second; + } + + void add_memory_bank(string name, string path, hwNode & core) +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Add-add_device_tree_info.patch +++ lshw-02.18/debian/patches/devtree-Add-add_device_tree_info.patch @@ -0,0 +1,58 @@ +From 719c039f5daf2ecf99a1c02669745486be36ba43 Mon Sep 17 00:00:00 2001 +From: Jeremy Kerr +Date: Wed, 24 Aug 2016 17:39:23 +0800 +Subject: [PATCH 09/19] devtree: Add add_device_tree_info() + +sysfs contains symbolic link (of_node) for each device which has +correspoding device tree entry. It helps user space tool to +parse firmware information for that device. +This patch adds logic to add location code for given sysfs path. + +Signed-off-by: Jeremy Kerr +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 19 +++++++++++++++++++ + src/core/device-tree.h | 2 ++ + 2 files changed, 21 insertions(+) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index 0bba4e9..1e49f3a 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -1208,3 +1208,22 @@ bool scan_device_tree(hwNode & n) + + return true; + } ++ ++void add_device_tree_info(hwNode & n, string sysfs_path) ++{ ++ string of_node = sysfs_path + "/of_node"; ++ string val; ++ ++ if (!exists(of_node)) ++ return; ++ ++ /* read location / slot data */ ++ val = hw::strip(get_string(of_node + "/ibm,loc-code", "")); ++ if (val == "") ++ val = hw::strip(get_string(of_node + "/ibm,slot-location-code", "")); ++ if (val == "") ++ val = hw::strip(get_string(of_node + "/ibm,slot-label")); ++ ++ if (val != "") ++ n.setSlot(val); ++} +diff --git a/lshw-B.02.18/src/core/device-tree.h b/lshw-B.02.18/src/core/device-tree.h +index 62313aa..91ecb7d 100644 +--- a/lshw-B.02.18/src/core/device-tree.h ++++ b/lshw-B.02.18/src/core/device-tree.h +@@ -4,4 +4,6 @@ + #include "hw.h" + + bool scan_device_tree(hwNode & n); ++ ++void add_device_tree_info(hwNode & n, string sysfs_path); + #endif +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Add-description-vendor-and-clock-info-to-mem.patch +++ lshw-02.18/debian/patches/devtree-Add-description-vendor-and-clock-info-to-mem.patch @@ -0,0 +1,85 @@ +From 9f448f011d58c5c2e5279dccb077bfd83a02da68 Mon Sep 17 00:00:00 2001 +From: Vasant Hegde +Date: Tue, 29 Nov 2016 12:02:03 +0530 +Subject: [PATCH 15/19] devtree: Add description, vendor and clock info to + memory bank + +This patch parses SPD info to get vendor id and then uses +jedec_resolve() to get vendor name. Also adds clock and description +info based on SPD values. + +Sample output; + *-bank:1 + description: RDIMM DDR3 1600 MHz (0.6ns) + product: HMT42GR7BFR4A-PB + vendor: Hynix Semiconductor (Hyundai Electronics) + physical id: 1 + version: 5438,15 33,01 + serial: 0x10c0af2c + slot: Physical:/Sys0/Node0/DIMM11 + size: 16GiB + clock: 1333MHz (0.8ns) + capabilities: ecc spd-1.3 + configuration: errordetection=ecc + +Signed-off-by: Jack Miller +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index e286ab4..e224024 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -14,6 +14,7 @@ + #include "version.h" + #include "device-tree.h" + #include "osutils.h" ++#include "jedec.h" + #include + #include + #include +@@ -808,6 +809,39 @@ static void add_memory_bank_spd(string path, hwNode & bank) + bank.setConfig("errordetection", "ecc"); + break; + } ++ ++ double ns = (dimminfo[0xc] / 2) * (dimminfo[0xa] / (float) dimminfo[0xb]); ++ bank.setClock(1000000000 / ns); ++ ++ char vendor[3]; ++ snprintf(vendor, sizeof(vendor), "%x%x", dimminfo[0x76], dimminfo[0x75]); ++ bank.setVendor(jedec_resolve(vendor)); ++ ++ char description[100]; ++ const char *type, *mod_type; ++ ++ type = "DDR3"; ++ switch(dimminfo[0x3]) ++ { ++ case 0x1: ++ mod_type = "RDIMM"; ++ break; ++ case 0x2: ++ mod_type = "UDIMM"; ++ break; ++ case 0x3: ++ mod_type = "SODIMM"; ++ break; ++ case 0x4: ++ mod_type = "LRDIMM"; ++ break; ++ default: ++ mod_type = "DIMM"; ++ } ++ ++ snprintf(description, sizeof(description), "%s %s %d MHz (%0.1fns)", ++ mod_type, type, (int) (1000 / ns), ns); ++ bank.setDescription(description); + } else { + mfg_loc_offset = 0x48; + rev_offset1 = 0x5b; +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Add-machine-description.patch +++ lshw-02.18/debian/patches/devtree-Add-machine-description.patch @@ -0,0 +1,41 @@ +From 1fee4c448ea6932fb3a01e866ce4b1741f26c6bb Mon Sep 17 00:00:00 2001 +From: Chandni Verma +Date: Thu, 20 Oct 2016 12:12:13 +0530 +Subject: [PATCH 02/19] devtree: Add machine description + +Add machine description for PowerNV and pseries LPAR platform. + +PowerNV = Power Non Virtualized +pSeries LPAR = Linux running on PowerVM LPAR + +Signed-off-by: Chandni Verma +[Split original patch and created separate patch for machine + description - Vasant] +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index b8feb12..951535c 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -927,6 +927,7 @@ bool scan_device_tree(hwNode & n) + { + n.setVendor(get_string(DEVICETREE "/vendor", "IBM")); + n.setProduct(get_string(DEVICETREE "/model-name")); ++ n.setDescription("PowerNV"); + if (core) + { + core->addHint("icon", string("board")); +@@ -983,6 +984,7 @@ bool scan_device_tree(hwNode & n) + scan_devtree_root(*core); + scan_devtree_bootrom(*core); + if (exists(DEVICETREE "/ibm,lpar-capable")) { ++ n.setDescription("pSeries LPAR"); + scan_devtree_cpu_power(*core); + scan_devtree_memory(*core); + } +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Add-parsed-firmware-version-info.patch +++ lshw-02.18/debian/patches/devtree-Add-parsed-firmware-version-info.patch @@ -0,0 +1,85 @@ +From 3abc9878e862d3401f2e5b3eb9e507f10bad7e2e Mon Sep 17 00:00:00 2001 +From: Jack Miller +Date: Tue, 23 Aug 2016 15:18:47 -0500 +Subject: [PATCH 08/19] devtree: Add parsed firmware version info + +We have /ibm,firmware-versions node in device tree ..which contains +various firmware version information. + +Property name represents firmware component and property value +represents the version. + +This patch adds support to parse above information on Power System. + +Sample output: + *-firmware:0 + description: buildroot + physical id: 1 + version: 211bd05 + *-firmware:1 + description: capp-ucode + physical id: 2 + version: 1bb7503 + +Signed-off-by: Jack Miller +[Minor code cleanup, updated description - Vasant] +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index d61347b..0bba4e9 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -218,6 +218,39 @@ static void scan_devtree_bootrom(hwNode & core) + } + } + ++static void scan_devtree_firmware_powernv(hwNode & core) ++{ ++ int n; ++ struct dirent **namelist; ++ ++ if (!exists(DEVICETREE "/ibm,firmware-versions")) ++ return; ++ ++ pushd(DEVICETREE "/ibm,firmware-versions"); ++ n = scandir(".", &namelist, selectfile, alphasort); ++ popd(); ++ ++ if (n <= 0) ++ return; ++ ++ for (int i = 0; i < n; i++) ++ { ++ string sname = string(namelist[i]->d_name); ++ string fullpath = string(DEVICETREE) + "/ibm,firmware-versions/" + sname; ++ ++ if (sname != "linux,phandle" && sname != "name" && sname != "phandle") ++ { ++ hwNode fwnode("firmware"); ++ fwnode.setDescription(sname); ++ fwnode.setVersion(hw::strip(get_string(fullpath))); ++ fwnode.claim(); ++ core.addChild(fwnode); ++ } ++ free(namelist[i]); ++ } ++ ++ free(namelist); ++} + + static string cpubusinfo(int cpu) + { +@@ -1111,6 +1144,7 @@ bool scan_device_tree(hwNode & n) + scan_devtree_root(*core); + scan_devtree_cpu_power(*core); + scan_devtree_memory_powernv(*core); ++ scan_devtree_firmware_powernv(*core); + n.addCapability("powernv", "Non-virtualized"); + n.addCapability("opal", "OPAL firmware"); + } +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Add-part-and-serial-number-info-to-memory-ba.patch +++ lshw-02.18/debian/patches/devtree-Add-part-and-serial-number-info-to-memory-ba.patch @@ -0,0 +1,65 @@ +From e296a0e6f5d88029d561ba2eef0d39b5cc96cbd3 Mon Sep 17 00:00:00 2001 +From: Vasant Hegde +Date: Tue, 29 Nov 2016 12:12:37 +0530 +Subject: [PATCH 16/19] devtree: Add part and serial number info to memory bank + +SPD has both part number and serial number information. Presently +we are displaying part number info under serial numbers. Instead +use Product field for part number and display proper serial number +under serial field. + +Signed-off-by: Jack Miller +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index e224024..41034e5 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -763,6 +763,7 @@ static void add_memory_bank_spd(string path, hwNode & bank) + unsigned char week_offset; + unsigned char partno_offset; + unsigned char ver_offset; ++ unsigned char serial_offset; + int fd; + size_t len = 0; + dimminfo_buf dimminfo; +@@ -798,6 +799,7 @@ static void add_memory_bank_spd(string path, hwNode & bank) + week_offset = 0x79; + partno_offset = 0x80; + ver_offset = 0x01; ++ serial_offset = 0x7a; + + switch ((dimminfo[0x8] >> 3) & 0x3) // DDR3 error detection and correction scheme + { +@@ -850,6 +852,7 @@ static void add_memory_bank_spd(string path, hwNode & bank) + week_offset = 0x5e; + partno_offset = 0x49; + ver_offset = 0x3e; ++ serial_offset = 0x5f; + + switch (dimminfo[0xb] & 0x3) // DDR2 error detection and correction scheme + { +@@ -872,12 +875,16 @@ static void add_memory_bank_spd(string path, hwNode & bank) + "%02X%02X,%02X %02X,%02X", dimminfo[rev_offset1], + dimminfo[rev_offset2], dimminfo[year_offset], dimminfo[week_offset], + dimminfo[mfg_loc_offset]); +- bank.setSerial(string((char *) &dimminfo[partno_offset], 18)); ++ bank.setProduct(string((char *) &dimminfo[partno_offset], 18)); + bank.setVersion(dimmversion); + ++ unsigned long serial = be_long(&dimminfo[serial_offset]); + int version = dimminfo[ver_offset]; + char buff[32]; + ++ snprintf(buff, sizeof(buff), "0x%lx", serial); ++ bank.setSerial(buff); ++ + snprintf(buff, sizeof(buff), "spd-%d.%d", (version & 0xF0) >> 4, version & 0x0F); + bank.addCapability(buff); + } +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Add-support-for-DDR4-SPD.patch +++ lshw-02.18/debian/patches/devtree-Add-support-for-DDR4-SPD.patch @@ -0,0 +1,100 @@ +From 0ea2e95b3ccdeb3834bec6fe22d0794a65e8c37a Mon Sep 17 00:00:00 2001 +From: Jeremy Kerr +Date: Tue, 6 Sep 2016 14:57:21 +0800 +Subject: [PATCH 19/19] devtree: Add support for DDR4 SPD + +This patch adds support for DDR4 SPD. + +Signed-off-by: Jeremy Kerr +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 51 ++++++++++++++++++++++++++++++++++++------------- + 1 file changed, 38 insertions(+), 13 deletions(-) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index 2672b53..48aac94 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -815,6 +815,7 @@ static void add_memory_bank_spd(string path, hwNode & bank) + uint16_t partno_offset; + uint16_t ver_offset; + uint16_t serial_offset; ++ uint16_t bus_width_offset; + int fd; + size_t len = 0; + dimminfo_buf dimminfo; +@@ -847,16 +848,47 @@ static void add_memory_bank_spd(string path, hwNode & bank) + close(fd); + + if (dimminfo[2] >= 9) { +- mfg_loc_offset = 0x77; ++ double ns; ++ char vendor[5]; ++ const char *type, *mod_type; ++ + rev_offset1 = 0x92; + rev_offset2 = 0x93; +- year_offset = 0x78; +- week_offset = 0x79; +- partno_offset = 0x80; + ver_offset = 0x01; +- serial_offset = 0x7a; + +- switch ((dimminfo[0x8] >> 3) & 0x3) // DDR3 error detection and correction scheme ++ if (dimminfo[0x2] >= 0xc) { ++ type = "DDR4"; ++ mfg_loc_offset = 0x142; ++ year_offset = 0x143; ++ week_offset = 0x144; ++ partno_offset = 0x149; ++ bus_width_offset = 0x0d; ++ serial_offset = 0x145; ++ ++ /* ++ * There is no other valid values for the medium- and fine- timebase ++ * other than (125ps, 1ps), so we hard-code those here. The fine ++ * t_{ckavg}_{min} value is signed. Divide by 2 to get from raw clock ++ * to expected data rate ++ */ ++ ns = (((float)dimminfo[0x12] * 0.125) + ++ (((signed char) dimminfo[0x7d]) * 0.001)) / 2; ++ snprintf(vendor, sizeof(vendor), "%x%x", dimminfo[0x141], dimminfo[0x140]); ++ } else { ++ type = "DDR3"; ++ mfg_loc_offset = 0x77; ++ year_offset = 0x78; ++ week_offset = 0x79; ++ partno_offset = 0x80; ++ serial_offset = 0x7a; ++ bus_width_offset = 0x08; ++ ++ ns = (dimminfo[0xc] / 2) * (dimminfo[0xa] / (float) dimminfo[0xb]); ++ snprintf(vendor, sizeof(vendor), "%x%x", dimminfo[0x76], dimminfo[0x75]); ++ } ++ ++ /* DDR3 & DDR4 error detection and correction scheme */ ++ switch ((dimminfo[bus_width_offset] >> 3) & 0x3) + { + case 0x00: + bank.setConfig("errordetection", "none"); +@@ -867,17 +899,10 @@ static void add_memory_bank_spd(string path, hwNode & bank) + break; + } + +- double ns = (dimminfo[0xc] / 2) * (dimminfo[0xa] / (float) dimminfo[0xb]); + bank.setClock(1000000000 / ns); +- +- char vendor[3]; +- snprintf(vendor, sizeof(vendor), "%x%x", dimminfo[0x76], dimminfo[0x75]); + bank.setVendor(jedec_resolve(vendor)); + + char description[100]; +- const char *type, *mod_type; +- +- type = "DDR3"; + switch(dimminfo[0x3]) + { + case 0x1: +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Add-vendor-field-for-cpu-node.patch +++ lshw-02.18/debian/patches/devtree-Add-vendor-field-for-cpu-node.patch @@ -0,0 +1,46 @@ +From cae5a49f90149515dfc33c1d2878bac81f86fcf3 Mon Sep 17 00:00:00 2001 +From: Vasant Hegde +Date: Tue, 16 Jan 2018 16:11:53 +0530 +Subject: [PATCH 4/4] devtree: Add vendor field for cpu node + +Device tree provides 'vendor' property for cpu nodes. Use that to +populate cpu vendor field + +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc +index 57fc15f..deca219 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -395,6 +395,7 @@ struct chip_vpd_data + string product; + string serial; + string slot; ++ string vendor; + }; + + +@@ -422,6 +423,9 @@ static void add_chip_vpd(string path, string name, + if (exists("part-number")) + data->product = hw::strip(get_string("part-number")); + ++ if (exists("vendor")) ++ data->vendor = hw::strip(get_string("vendor")); ++ + if (exists("fru-number")) + data->product += " FRU# " + hw::strip(get_string("fru-number")); + +@@ -490,6 +494,7 @@ static void fill_core_vpd(hwNode & cpu, string & basepath, + cpu.setProduct(data->product); + cpu.setSerial(data->serial); + cpu.setSlot(data->slot); ++ cpu.setVendor(data->vendor); + } + + if (xscom_path != "") +-- +2.15.1 + --- lshw-02.18.orig/debian/patches/devtree-Check-status-property-for-caches.patch +++ lshw-02.18/debian/patches/devtree-Check-status-property-for-caches.patch @@ -0,0 +1,44 @@ +From c04b4a85c895ad78a6b1c05da7383ea3af8b0e0b Mon Sep 17 00:00:00 2001 +From: Vasant Hegde +Date: Tue, 22 Aug 2017 20:53:41 +0530 +Subject: [PATCH 1/4] devtree: Check status property for caches + +Check status property for L1 cache before enabling cache node. +Also check status before enabling L2/L3 icache. + +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc +index 1be1ff4..259fe7a 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -606,7 +606,10 @@ static void scan_devtree_cpu_power(hwNode & core) + product = hw::strip(get_string(basepath + "/name")); + + if (hw::strip(get_string(basepath + "/status")) != "okay") ++ { + cache.disable(); ++ icache.disable(); ++ } + + if (product == "l2-cache") + fill_cache_info("L2 Cache", basepath, cache, icache); +@@ -709,6 +712,12 @@ static void scan_devtree_cpu_power(hwNode & core) + + if (cache.getSize() > 0) + cpu.addChild(cache); ++ ++ if (hw::strip(get_string(basepath + "/status")) != "okay") ++ { ++ cache.disable(); ++ icache.disable(); ++ } + } + + if (exists(basepath + "/l2-cache")) +-- +2.15.1 + --- lshw-02.18.orig/debian/patches/devtree-Code-cleanup.patch +++ lshw-02.18/debian/patches/devtree-Code-cleanup.patch @@ -0,0 +1,42 @@ +From 20bd6fc0673eeba3e3419f152a66c264ee4335ef Mon Sep 17 00:00:00 2001 +From: Vasant Hegde +Date: Mon, 28 Nov 2016 15:01:15 +0530 +Subject: [PATCH 12/19] devtree: Code cleanup + +Make function as static function, use hw:strip() for reading +strings from device tree property. + +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index 21bb6d9..05db9f3 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -752,7 +752,7 @@ static void scan_devtree_cpu_power(hwNode & core) + delete it->second; + } + +-void add_memory_bank(string name, string path, hwNode & core) ++static void add_memory_bank(string name, string path, hwNode & core) + { + struct dirent **dirlist; + string product; +@@ -773,10 +773,10 @@ void add_memory_bank(string name, string path, hwNode & core) + if(exists("serial-number")) + bank.setSerial(hw::strip(get_string("serial-number"))); + +- product = get_string("part-number"); ++ product = hw::strip(get_string("part-number")); + if(exists("fru-number")) + { +- product += " FRU# " + get_string("fru-number"); ++ product += " FRU# " + hw::strip(get_string("fru-number")); + } + if(product != "") + bank.setProduct(hw::strip(product)); +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Correctly-read-size-for-DDR4-SPD.patch +++ lshw-02.18/debian/patches/devtree-Correctly-read-size-for-DDR4-SPD.patch @@ -0,0 +1,71 @@ +From ab43c697ebaff3e5138c43a39a17f69859cde87d Mon Sep 17 00:00:00 2001 +From: Jeremy Kerr +Date: Tue, 6 Sep 2016 14:11:34 +0800 +Subject: [PATCH 18/19] devtree: Correctly read size for DDR4 SPD + +We may have up to 512 bytes of SPD now, so bump dimminfo_buf. + +This will mean our offsets can be larger than 256 bytes, so use a +uint16_t here. + +Signed-off-by: Jeremy Kerr +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 26 +++++++++++++++----------- + 1 file changed, 15 insertions(+), 11 deletions(-) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index b7d0d57..2672b53 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -32,7 +32,7 @@ + + __ID("@(#) $Id$"); + +-#define DIMMINFOSIZE 0x100 ++#define DIMMINFOSIZE 0x200 + typedef uint8_t dimminfo_buf[DIMMINFOSIZE]; + + struct dimminfo +@@ -807,14 +807,14 @@ static bool add_memory_bank_mba_dimm(string path, + static void add_memory_bank_spd(string path, hwNode & bank) + { + char dimmversion[20]; +- unsigned char mfg_loc_offset; +- unsigned char rev_offset1; +- unsigned char rev_offset2; +- unsigned char year_offset; +- unsigned char week_offset; +- unsigned char partno_offset; +- unsigned char ver_offset; +- unsigned char serial_offset; ++ uint16_t mfg_loc_offset; ++ uint16_t rev_offset1; ++ uint16_t rev_offset2; ++ uint16_t year_offset; ++ uint16_t week_offset; ++ uint16_t partno_offset; ++ uint16_t ver_offset; ++ uint16_t serial_offset; + int fd; + size_t len = 0; + dimminfo_buf dimminfo; +@@ -830,9 +830,13 @@ static void add_memory_bank_spd(string path, hwNode & bank) + } + + /* Read entire SPD eeprom */ +- if (dimminfo[2] >= 9) /* DDR3 */ ++ if (dimminfo[2] >= 9) /* DDR3 & DDR4 */ + { +- len = 64 << ((dimminfo[0] & 0x70) >> 4); ++ uint8_t val = (dimminfo[0] >> 4) & 0x7; ++ if (val == 1) ++ len = 256; ++ else if (val == 2) ++ len = 512; + } else if (dimminfo[0] < 15) { /* DDR 2 */ + len = 1 << dimminfo[1]; + } +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Display-CPU-nodes-before-memory.patch +++ lshw-02.18/debian/patches/devtree-Display-CPU-nodes-before-memory.patch @@ -0,0 +1,55 @@ +From 6a75f4e52f0a356d54e1cd06f99f91d21bd03663 Mon Sep 17 00:00:00 2001 +From: Chandni Verma +Date: Thu, 14 Jul 2016 23:46:42 +0530 +Subject: [PATCH 01/19] devtree: Display CPU nodes before memory + +Present lshw displays memory node before cpu node for Power System. But +on x86, it displays cpu before memory. Lets use same output format on +x86 and Power Systems. + +Note that I've made sure it doesn't hurt other platforms (like Apple) +which has device tree. + +Signed-off-by: Chandni Verma +[Made sure this patch doesn't impact non-IBM Power systems, + updated description - Vasant] +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index 700dff0..b8feb12 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -931,8 +931,8 @@ bool scan_device_tree(hwNode & n) + { + core->addHint("icon", string("board")); + scan_devtree_root(*core); +- scan_devtree_memory_powernv(*core); + scan_devtree_cpu_power(*core); ++ scan_devtree_memory_powernv(*core); + n.addCapability("powernv", "Non-virtualized"); + n.addCapability("opal", "OPAL firmware"); + } +@@ -982,11 +982,14 @@ bool scan_device_tree(hwNode & n) + core->addHint("icon", string("board")); + scan_devtree_root(*core); + scan_devtree_bootrom(*core); +- scan_devtree_memory(*core); +- if (exists(DEVICETREE "/ibm,lpar-capable")) ++ if (exists(DEVICETREE "/ibm,lpar-capable")) { + scan_devtree_cpu_power(*core); +- else ++ scan_devtree_memory(*core); ++ } ++ else { ++ scan_devtree_memory(*core); + scan_devtree_cpu(*core); ++ } + } + } + +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Don-t-overrun-dimminfo-buffer.patch +++ lshw-02.18/debian/patches/devtree-Don-t-overrun-dimminfo-buffer.patch @@ -0,0 +1,49 @@ +From 54a9827172d4fb94447e81f598200c7d5d41db05 Mon Sep 17 00:00:00 2001 +From: Jeremy Kerr +Date: Tue, 6 Sep 2016 13:32:03 +0800 +Subject: [PATCH 14/19] devtree: Don't overrun dimminfo buffer + +The SPD size fields report the total size of the SPD, but we're reading +into 128-bytes beyond the start of our spd buffer. So, we currently +overrung our stack-allocated dimminfo buffer. + +This change takes account of the data we've already read. + +Signed-off-by: Jeremy Kerr +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index 2d908d2..e286ab4 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -763,6 +763,7 @@ static void add_memory_bank_spd(string path, hwNode & bank) + unsigned char partno_offset; + unsigned char ver_offset; + int fd; ++ size_t len = 0; + dimminfo_buf dimminfo; + + fd = open(path.c_str(), O_RDONLY); +@@ -778,11 +779,14 @@ static void add_memory_bank_spd(string path, hwNode & bank) + /* Read entire SPD eeprom */ + if (dimminfo[2] >= 9) /* DDR3 */ + { +- read(fd, &dimminfo[0x80], (64 << ((dimminfo[0] & 0x70) >> 4))); ++ len = 64 << ((dimminfo[0] & 0x70) >> 4); + } else if (dimminfo[0] < 15) { /* DDR 2 */ +- read(fd, &dimminfo[0x80], (1 << (dimminfo[1]))); ++ len = 1 << dimminfo[1]; + } + ++ if (len > 0x80) ++ read(fd, &dimminfo[0x80], len - 0x80); ++ + close(fd); + + if (dimminfo[2] >= 9) { +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Fix-motherboard-model-reporting.patch +++ lshw-02.18/debian/patches/devtree-Fix-motherboard-model-reporting.patch @@ -0,0 +1,40 @@ +From b409777707752adddbbd9fd33b5388825f8a032e Mon Sep 17 00:00:00 2001 +From: Vasant Hegde +Date: Fri, 21 Oct 2016 11:08:34 +0530 +Subject: [PATCH 03/19] devtree: Fix motherboard model reporting + +We have 'model' property on all Power System. Some system has +'model-name' property which is more descriptive. + +Append 'model-name' info to product instead of overwriting it. + +Sample output: +tul176p1 + description: PowerNV + product: 8286-42A (IBM Power System S824) + +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index 951535c..c60e49c 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -926,7 +926,11 @@ bool scan_device_tree(hwNode & n) + if (matches(get_string(DEVICETREE "/compatible"), "^ibm,powernv")) + { + n.setVendor(get_string(DEVICETREE "/vendor", "IBM")); +- n.setProduct(get_string(DEVICETREE "/model-name")); ++ ++ if (exists(DEVICETREE "/model-name")) ++ n.setProduct(n.getProduct() + " (" + ++ hw::strip(get_string(DEVICETREE "/model-name")) + ")"); ++ + n.setDescription("PowerNV"); + if (core) + { +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Fix-physical-ID-info-for-CPU-nodes.patch +++ lshw-02.18/debian/patches/devtree-Fix-physical-ID-info-for-CPU-nodes.patch @@ -0,0 +1,41 @@ +From 9faf09f9851fafd50b96b59d7eac77fcd1b641d7 Mon Sep 17 00:00:00 2001 +From: Chandni Verma +Date: Thu, 20 Oct 2016 14:23:50 +0530 +Subject: [PATCH 04/19] devtree: Fix physical ID info for CPU nodes + +'reg' property contains processor core id. Use this info to fill +processor physical ID. This is useful to map processor core to +sysfs entry in cpufreq.cc code. + +Signed-off-by: Chandni Verma +[Splited original patch and updated description - Vasant] +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index c60e49c..9c74e5a 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -473,6 +473,7 @@ static void scan_devtree_cpu_power(hwNode & core) + { + uint32_t l2_key = 0; + uint32_t version = 0; ++ uint32_t reg; + string basepath = string(DEVICETREE "/cpus/") + string(namelist[i]->d_name); + hwNode cpu("cpu", hw::processor); + +@@ -491,6 +492,9 @@ static void scan_devtree_cpu_power(hwNode & core) + cpu.setDescription("CPU"); + set_cpu(cpu, currentcpu++, basepath); + ++ reg = get_u32(basepath + "/reg"); ++ cpu.setPhysId(tostring(reg)); ++ + version = get_u32(basepath + "/cpu-version"); + if (version != 0) + cpu.setVersion(tostring(version)); +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Parse-spd-data.patch +++ lshw-02.18/debian/patches/devtree-Parse-spd-data.patch @@ -0,0 +1,32 @@ +From f16f4e1d97950c8d5a6c509aea779b1f672254c7 Mon Sep 17 00:00:00 2001 +From: Vasant Hegde +Date: Tue, 23 Jan 2018 04:49:57 -0600 +Subject: [PATCH 2/4] devtree: Parse spd data + +In some Power system (like P9 system), spd data is available under +ms-dimm node in device tree. Hence call add_memory_bank_spd() from +ms-dimm section as well. + +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc +index 259fe7a..57fc15f 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -1009,6 +1009,10 @@ static void add_memory_bank(string name, string path, hwNode & core) + if(unsigned long size = get_number("size")) + bank.setSize(size*1024*1024); + ++ // Parse Memory SPD data ++ if (exists("spd")) ++ add_memory_bank_spd(path + "/" + name + "/spd", bank); ++ + memory->addChild(bank); + } else if(name.substr(0, 4) == "dimm") { + hwNode bank("bank", hw::memory); +-- +2.15.1 + --- lshw-02.18.orig/debian/patches/devtree-Refactor-SPD-handling-code.patch +++ lshw-02.18/debian/patches/devtree-Refactor-SPD-handling-code.patch @@ -0,0 +1,272 @@ +From 20872dd40742dc7f59c338e1575765cb2c88e6c6 Mon Sep 17 00:00:00 2001 +From: Jack Miller +Date: Tue, 16 Aug 2016 14:03:47 -0500 +Subject: [PATCH 13/19] devtree: Refactor SPD handling code + +Some variants of IBM Power Systems has SPD property in device tree. +Hence move SPD reading code to separate function. Following patch +makes use of this changes. + +Also minor cleanup included, mostly trying to reduce nested scopes. + +No functionality changes. + +Signed-off-by: Jack Miller +[Fixed minor issues, updated description - Vasant] +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 227 ++++++++++++++++++++++++------------------------ + 1 file changed, 114 insertions(+), 113 deletions(-) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index 05db9f3..2d908d2 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -752,6 +752,98 @@ static void scan_devtree_cpu_power(hwNode & core) + delete it->second; + } + ++static void add_memory_bank_spd(string path, hwNode & bank) ++{ ++ char dimmversion[20]; ++ unsigned char mfg_loc_offset; ++ unsigned char rev_offset1; ++ unsigned char rev_offset2; ++ unsigned char year_offset; ++ unsigned char week_offset; ++ unsigned char partno_offset; ++ unsigned char ver_offset; ++ int fd; ++ dimminfo_buf dimminfo; ++ ++ fd = open(path.c_str(), O_RDONLY); ++ if (fd < 0) ++ return; ++ ++ if (read(fd, &dimminfo, 0x80) != 0x80) ++ { ++ close(fd); ++ return; ++ } ++ ++ /* Read entire SPD eeprom */ ++ if (dimminfo[2] >= 9) /* DDR3 */ ++ { ++ read(fd, &dimminfo[0x80], (64 << ((dimminfo[0] & 0x70) >> 4))); ++ } else if (dimminfo[0] < 15) { /* DDR 2 */ ++ read(fd, &dimminfo[0x80], (1 << (dimminfo[1]))); ++ } ++ ++ close(fd); ++ ++ if (dimminfo[2] >= 9) { ++ mfg_loc_offset = 0x77; ++ rev_offset1 = 0x92; ++ rev_offset2 = 0x93; ++ year_offset = 0x78; ++ week_offset = 0x79; ++ partno_offset = 0x80; ++ ver_offset = 0x01; ++ ++ switch ((dimminfo[0x8] >> 3) & 0x3) // DDR3 error detection and correction scheme ++ { ++ case 0x00: ++ bank.setConfig("errordetection", "none"); ++ break; ++ case 0x01: ++ bank.addCapability("ecc"); ++ bank.setConfig("errordetection", "ecc"); ++ break; ++ } ++ } else { ++ mfg_loc_offset = 0x48; ++ rev_offset1 = 0x5b; ++ rev_offset2 = 0x5c; ++ year_offset = 0x5d; ++ week_offset = 0x5e; ++ partno_offset = 0x49; ++ ver_offset = 0x3e; ++ ++ switch (dimminfo[0xb] & 0x3) // DDR2 error detection and correction scheme ++ { ++ case 0x00: ++ bank.setConfig("errordetection", "none"); ++ break; ++ case 0x01: ++ bank.addCapability("parity"); ++ bank.setConfig("errordetection", "parity"); ++ break; ++ case 0x02: ++ case 0x03: ++ bank.addCapability("ecc"); ++ bank.setConfig("errordetection", "ecc"); ++ break; ++ } ++ } ++ ++ snprintf(dimmversion, sizeof(dimmversion), ++ "%02X%02X,%02X %02X,%02X", dimminfo[rev_offset1], ++ dimminfo[rev_offset2], dimminfo[year_offset], dimminfo[week_offset], ++ dimminfo[mfg_loc_offset]); ++ bank.setSerial(string((char *) &dimminfo[partno_offset], 18)); ++ bank.setVersion(dimmversion); ++ ++ int version = dimminfo[ver_offset]; ++ char buff[32]; ++ ++ snprintf(buff, sizeof(buff), "spd-%d.%d", (version & 0xF0) >> 4, version & 0x0F); ++ bank.addCapability(buff); ++} ++ + static void add_memory_bank(string name, string path, hwNode & core) + { + struct dirent **dirlist; +@@ -872,123 +964,32 @@ static void scan_devtree_memory(hwNode & core) + memory = core.addChild(hwNode("memory", hw::memory)); + } + +- if (memory) +- { +- int fd = open(dimminfo.c_str(), O_RDONLY); ++ if (!memory) ++ break; + +- if (regs.size() == slotnames.size()) ++ if (regs.size() == slotnames.size()) ++ { ++ for (unsigned int i = 0; i < slotnames.size(); i++) + { +- for (unsigned int i = 0; i < slotnames.size(); i++) +- { +- uint64_t size = regs[i].size; +- hwNode bank("bank", +- hw::memory); +- +- if (fd >= 0) +- { +- dimminfo_buf dimminfo; +- +- if (read(fd, &dimminfo, 0x80) == 0x80) +- { +- +- /* Read entire SPD eeprom */ +- if (dimminfo[2] >= 9) /* DDR3 */ +- { +- read(fd, &dimminfo[0x80], (64 << ((dimminfo[0] & 0x70) >> 4))); +- } else if (dimminfo[0] < 15) { /* DDR 2 */ +- read(fd, &dimminfo[0x80], (1 << (dimminfo[1]) )); +- } +- +- if (size > 0) +- { +- char dimmversion[20]; +- unsigned char mfg_loc_offset; +- unsigned char rev_offset1; +- unsigned char rev_offset2; +- unsigned char year_offset; +- unsigned char week_offset; +- unsigned char partno_offset; +- unsigned char ver_offset; +- +- if (dimminfo[2] >= 9) { +- mfg_loc_offset = 0x77; +- rev_offset1 = 0x92; +- rev_offset2 = 0x93; +- year_offset = 0x78; +- week_offset = 0x79; +- partno_offset = 0x80; +- ver_offset = 0x01; +- +- switch ((dimminfo[0x8] >> 3) & 0x3) // DDR3 error detection and correction scheme +- { +- case 0x00: +- bank.setConfig("errordetection", "none"); +- break; +- case 0x01: +- bank.addCapability("ecc"); +- bank.setConfig("errordetection", "ecc"); +- break; +- } +- } else { +- mfg_loc_offset = 0x48; +- rev_offset1 = 0x5b; +- rev_offset2 = 0x5c; +- year_offset = 0x5d; +- week_offset = 0x5e; +- partno_offset = 0x49; +- ver_offset = 0x3e; +- +- switch (dimminfo[0xb] & 0x3) // DDR2 error detection and correction scheme +- { +- case 0x00: +- bank.setConfig("errordetection", "none"); +- break; +- case 0x01: +- bank.addCapability("parity"); +- bank.setConfig("errordetection", "parity"); +- break; +- case 0x02: +- case 0x03: +- bank.addCapability("ecc"); +- bank.setConfig("errordetection", "ecc"); +- break; +- } +- } +- snprintf(dimmversion, sizeof(dimmversion), +- "%02X%02X,%02X %02X,%02X", dimminfo[rev_offset1], +- dimminfo[rev_offset2], dimminfo[year_offset], dimminfo[week_offset], +- dimminfo[mfg_loc_offset]); +- bank.setSerial(string((char *) &dimminfo[partno_offset], 18)); +- bank.setVersion(dimmversion); +- +- int version = dimminfo[ver_offset]; +- char buff[32]; +- +- snprintf(buff, sizeof(buff), "spd-%d.%d", (version & 0xF0) >> 4, version & 0x0F); +- bank.addCapability(buff); +- } +- } +- } +- +- if(size>0) +- bank.addHint("icon", string("memory")); +- bank.setDescription("Memory bank"); +- bank.setSlot(slotnames[i]); +- if (i < dimmtypes.size()) +- bank.setDescription(dimmtypes[i]); +- if (i < dimmspeeds.size()) +- bank.setProduct(hw::strip(dimmspeeds[i])); +- bank.setSize(size); +- memory->addChild(bank); +- } ++ uint64_t size = regs[i].size; ++ hwNode bank("bank", hw::memory); ++ ++ // Parse Memory SPD data ++ add_memory_bank_spd(dimminfo, bank); ++ ++ if (size > 0) ++ bank.addHint("icon", string("memory")); ++ bank.setDescription("Memory bank"); ++ bank.setSlot(slotnames[i]); ++ if (i < dimmtypes.size()) ++ bank.setDescription(dimmtypes[i]); ++ if (i < dimmspeeds.size()) ++ bank.setProduct(hw::strip(dimmspeeds[i])); ++ bank.setSize(size); ++ memory->addChild(bank); + } +- +- if (fd >= 0) +- close(fd); +- currentmc++; + } +- else +- break; ++ currentmc++; + + memory = NULL; + } +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Report-memory-info-for-BMC-based-Power-Syste.patch +++ lshw-02.18/debian/patches/devtree-Report-memory-info-for-BMC-based-Power-Syste.patch @@ -0,0 +1,145 @@ +From f1cd42c0c6f434e15ba322970cfa4519ee1f523d Mon Sep 17 00:00:00 2001 +From: Jack Miller +Date: Tue, 16 Aug 2016 15:08:51 -0500 +Subject: [PATCH 17/19] devtree: Report memory info for BMC based Power System + +Some variants of Power System (BMC service processor system) device tree +contains SPD information. Also it has memory-buffer representation in +device tree. + +This patch adds support to display memory information on this system. + +Sample output; + *-bank:1 + description: RDIMM DDR3 1600 MHz (0.6ns) + product: HMT42GR7BFR4A-PB + vendor: Hynix Semiconductor (Hyundai Electronics) + physical id: 1 + version: 5438,15 33,01 + serial: 0x10c0af2c + slot: Physical:/Sys0/Node0/DIMM11 + size: 16GiB + clock: 1333MHz (0.8ns) + capabilities: ecc spd-1.3 + configuration: errordetection=ecc + +Signed-off-by: Jack Miller +[Updated description, fixed minor issues - Vasant] +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 71 +++++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 66 insertions(+), 5 deletions(-) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index 41034e5..b7d0d57 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -753,6 +753,57 @@ static void scan_devtree_cpu_power(hwNode & core) + delete it->second; + } + ++static bool add_memory_bank_mba_dimm(string path, ++ unsigned long serial, hwNode & bank) ++{ ++ bool found = false; ++ int n; ++ struct dirent **namelist; ++ ++ pushd(path); ++ n = scandir(".", &namelist, selectdir, alphasort); ++ popd(); ++ ++ if (n < 0) ++ return found; ++ ++ for (int i = 0; i < n; i++) ++ { ++ string sname = string(namelist[i]->d_name); ++ string fullpath = path + "/" + sname; ++ ++ if (found) ++ { ++ free(namelist[i]); ++ continue; ++ } ++ ++ if (sname.substr(0, 13) == "memory-buffer") ++ { ++ if (exists(fullpath + "/frequency-mhz")) ++ { ++ int hz = get_u32(fullpath + "/frequency-mhz") * 1000000; ++ bank.setClock(hz); ++ } ++ found = add_memory_bank_mba_dimm(fullpath, serial, bank); ++ } else if (sname.substr(0, 3) == "mba") { ++ found = add_memory_bank_mba_dimm(fullpath, serial, bank); ++ } else if ((sname.substr(0, 4) == "dimm") && ++ (get_u32(fullpath + "/serial-number") == serial)) { ++ vector < reg_entry > regs = get_reg_property(fullpath); ++ bank.setSize(regs[0].size); ++ ++ bank.setSlot(hw::strip(get_string(fullpath + "/ibm,slot-location-code"))); ++ found = true; ++ } ++ free(namelist[i]); ++ } ++ ++ free(namelist); ++ return found; ++} ++ ++ + static void add_memory_bank_spd(string path, hwNode & bank) + { + char dimmversion[20]; +@@ -885,6 +936,8 @@ static void add_memory_bank_spd(string path, hwNode & bank) + snprintf(buff, sizeof(buff), "0x%lx", serial); + bank.setSerial(buff); + ++ add_memory_bank_mba_dimm(DEVICETREE, serial, bank); ++ + snprintf(buff, sizeof(buff), "spd-%d.%d", (version & 0xF0) >> 4, version & 0x0F); + bank.addCapability(buff); + } +@@ -895,18 +948,17 @@ static void add_memory_bank(string name, string path, hwNode & core) + string product; + int n; + ++ hwNode *memory = core.getChild("memory"); ++ if(!memory) ++ memory = core.addChild(hwNode("memory", hw::memory)); ++ + pushd(path + name); + if(name.substr(0, 7) == "ms-dimm") + { +- hwNode *memory = core.getChild("memory"); +- + hwNode bank("bank", hw::memory); + bank.claim(true); + bank.addHint("icon", string("memory")); + +- if(!memory) +- memory = core.addChild(hwNode("memory", hw::memory)); +- + if(exists("serial-number")) + bank.setSerial(hw::strip(get_string("serial-number"))); + +@@ -926,6 +978,15 @@ static void add_memory_bank(string name, string path, hwNode & core) + bank.setSize(size*1024*1024); + + memory->addChild(bank); ++ } else if(name.substr(0, 4) == "dimm") { ++ hwNode bank("bank", hw::memory); ++ bank.claim(true); ++ bank.addHint("icon", string("memory")); ++ ++ // Parse Memory SPD data ++ add_memory_bank_spd(path + name + "/spd", bank); ++ ++ memory->addChild(bank); + } + + n = scandir(".", &dirlist, selectdir, alphasort); +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/devtree-Use-consistent-output-format.patch +++ lshw-02.18/debian/patches/devtree-Use-consistent-output-format.patch @@ -0,0 +1,39 @@ +From a49913317e51d607bf43249143eedffaaa64a5a8 Mon Sep 17 00:00:00 2001 +From: Vasant Hegde +Date: Mon, 28 Nov 2016 14:57:27 +0530 +Subject: [PATCH 11/19] devtree: Use consistent output format + +Use consistent output format (FRU# ). + +This change is specific to Power Systems. + +Signed-off-by: Vasant Hegde +--- + src/core/device-tree.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index 1e49f3a..21bb6d9 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -428,7 +428,7 @@ static void add_chip_vpd(string path, string name, + data->product = hw::strip(get_string("part-number")); + + if (exists("fru-number")) +- data->product += " FRU #" + hw::strip(get_string("fru-number")); ++ data->product += " FRU# " + hw::strip(get_string("fru-number")); + + vpd.insert(std::pair(chip_id, data)); + } +@@ -776,7 +776,7 @@ void add_memory_bank(string name, string path, hwNode & core) + product = get_string("part-number"); + if(exists("fru-number")) + { +- product += " FRU#" + get_string("fru-number"); ++ product += " FRU# " + get_string("fru-number"); + } + if(product != "") + bank.setProduct(hw::strip(product)); +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/fix-manpage.patch +++ lshw-02.18/debian/patches/fix-manpage.patch @@ -0,0 +1,8 @@ +--- a/lshw-B.02.18/src/lshw.1 ++++ b/lshw-B.02.18/src/lshw.1 +@@ -1,4 +1,4 @@ +-.\\" auto-generated by docbook2man-spec $Revision: 1.2 $ ++.\" auto-generated by docbook2man-spec $Revision: 1.2 $ + .TH "LSHW" "1" "30 May 2010" "$Rev: 2179 $" "" + .SH NAME + lshw \- list hardware --- lshw-02.18.orig/debian/patches/fix-segfault-in-privileged-containers.patch +++ lshw-02.18/debian/patches/fix-segfault-in-privileged-containers.patch @@ -0,0 +1,36 @@ +Description: Fix lshw crashes with SEGV in privileged containers. + lshw cmd is segfaulting when ran inside a privileged container because + in a privileged container all debugfs access are denied (as it should be). + This patch offer a better mechanism to detect if SYSKERNELDEBUGUSBDEVICES + or PROCBUSUSBDEVICES exist and if it can be properly open. + + # lshw strace inside privileged container with a Ubuntu img. + ... + open("/sys/kernel/debug/usb/devices", O_RDONLY) = -1 EACCES (Permission denied) + open("/proc/bus/usb/devices", O_RDONLY) = -1 ENOENT (No such file or directory) + +Author: Eric Desrochers +Origin: upstream, https://ezix.org/src/pkg/lshw/commit/7b99d35064230f908551ba65c29264d90f49f246 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1699161 +Index: lshw-02.18/lshw-B.02.18/src/core/usb.cc +=================================================================== +--- lshw-02.18.orig/lshw-B.02.18/src/core/usb.cc ++++ lshw-02.18/lshw-B.02.18/src/core/usb.cc +@@ -376,10 +376,15 @@ bool scan_usb(hwNode & n) + } + filenames.clear(); + +- usbdevices = fopen(SYSKERNELDEBUGUSBDEVICES, "r"); +- if(!usbdevices) ++ if (exists(SYSKERNELDEBUGUSBDEVICES)) ++ usbdevices = fopen(SYSKERNELDEBUGUSBDEVICES, "r"); ++ ++ if(!usbdevices && exists(PROCBUSUSBDEVICES)) + usbdevices = fopen(PROCBUSUSBDEVICES, "r"); + ++ if(!usbdevices) ++ return false; ++ + while(!feof(usbdevices)) + { + char * buffer = NULL; --- lshw-02.18.orig/debian/patches/fix-width-handling.patch +++ lshw-02.18/debian/patches/fix-width-handling.patch @@ -0,0 +1,21 @@ +Description: Fix regression in detecting platform width + LONG_BIT is not an argument to sysconf(), it is a static variable that is + set to either 32 or 64 bits. Revert this upstream change so that we + actually query with _SC_LONG_BIT and get a correct answer, instead of + always getting -1 bits as our answer. +Author: Steve Langasek +Forwarded-Upstream: not-needed + +Index: lshw-02.18/lshw-B.02.18/src/core/abi.cc +=================================================================== +--- lshw-02.18.orig/lshw-B.02.18/src/core/abi.cc ++++ lshw-02.18/lshw-B.02.18/src/core/abi.cc +@@ -20,7 +20,7 @@ + bool scan_abi(hwNode & system) + { + // are we compiled as 32- or 64-bit process ? +- system.setWidth(sysconf(LONG_BIT)); ++ system.setWidth(sysconf(_SC_LONG_BIT)); + + pushd(PROC_SYS); + --- lshw-02.18.orig/debian/patches/gcc45.gcc +++ lshw-02.18/debian/patches/gcc45.gcc @@ -0,0 +1,197 @@ +Include headers to build under gcc-4.3Index: lshw-02.14/src/core/cdrom.cc +=================================================================== +--- a/lshw-B.02.18/src/core/cdrom.cc ++++ b/lshw-B.02.18/src/core/cdrom.cc +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + __ID("@(#) $Id: cdrom.cc 1923 2008-02-10 23:04:53Z lyonel $"); + +--- a/lshw-B.02.18/src/core/cpuid.cc ++++ b/lshw-B.02.18/src/core/cpuid.cc +@@ -7,6 +7,7 @@ + #include + #include + #include ++#include + + __ID("@(#) $Id: cpuid.cc 2151 2010-03-15 20:26:20Z lyonel $"); + +--- a/lshw-B.02.18/src/core/cpuinfo.cc ++++ b/lshw-B.02.18/src/core/cpuinfo.cc +@@ -5,6 +5,7 @@ + #include + #include + #include ++#include + #include + #include + #include +--- a/lshw-B.02.18/src/core/fb.cc ++++ b/lshw-B.02.18/src/core/fb.cc +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + + __ID("@(#) $Id: fb.cc 2038 2008-09-05 19:53:35Z lyonel $"); + +--- a/lshw-B.02.18/src/core/hw.cc ++++ b/lshw-B.02.18/src/core/hw.cc +@@ -19,6 +19,9 @@ + #include + #include + #include ++#include ++#include ++#include + + using namespace hw; + +--- a/lshw-B.02.18/src/core/ideraid.cc ++++ b/lshw-B.02.18/src/core/ideraid.cc +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include +--- a/lshw-B.02.18/src/core/mounts.cc ++++ b/lshw-B.02.18/src/core/mounts.cc +@@ -14,7 +14,7 @@ + #include + #include + #include +- ++#include + + __ID("@(#) $Id: mounts.cc 2066 2009-02-12 19:24:33Z lyonel $"); + +--- a/lshw-B.02.18/src/core/osutils.cc ++++ b/lshw-B.02.18/src/core/osutils.cc +@@ -3,6 +3,7 @@ + #include + #include + #include ++#include + #include + #include + #include +--- a/lshw-B.02.18/src/core/partitions.cc ++++ b/lshw-B.02.18/src/core/partitions.cc +@@ -21,6 +21,8 @@ + #include "volumes.h" + #include "osutils.h" + #include ++#include ++#include + #include + #include + #include +--- a/lshw-B.02.18/src/core/pci.cc ++++ b/lshw-B.02.18/src/core/pci.cc +@@ -12,6 +12,8 @@ + #include + #include + #include ++#include ++#include + + __ID("@(#) $Id: pci.cc 2496 2012-05-15 08:00:13Z lyonel $"); + +--- a/lshw-B.02.18/src/core/pcmcia-legacy.cc ++++ b/lshw-B.02.18/src/core/pcmcia-legacy.cc +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + + __ID("@(#) $Id: pcmcia-legacy.cc 2038 2008-09-05 19:53:35Z lyonel $"); + +--- a/lshw-B.02.18/src/core/pcmcia.cc ++++ b/lshw-B.02.18/src/core/pcmcia.cc +@@ -6,6 +6,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +--- a/lshw-B.02.18/src/core/smp.cc ++++ b/lshw-B.02.18/src/core/smp.cc +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + + #include "osutils.h" + +--- a/lshw-B.02.18/src/core/spd.cc ++++ b/lshw-B.02.18/src/core/spd.cc +@@ -9,6 +9,7 @@ + #include + #include + #include ++#include + + __ID("@(#) $Id: spd.cc 1936 2008-03-23 12:29:29Z lyonel $"); + +--- a/lshw-B.02.18/src/core/usb.cc ++++ b/lshw-B.02.18/src/core/usb.cc +@@ -14,6 +14,7 @@ + #include "heuristics.h" + #include "options.h" + #include ++#include + #include + #include + #include +@@ -24,6 +25,7 @@ + #include + #include + #include ++#include + + #define PROCBUSUSBDEVICES "/proc/bus/usb/devices" + #define SYSKERNELDEBUGUSBDEVICES "/sys/kernel/debug/usb/devices" +--- a/lshw-B.02.18/src/core/volumes.cc ++++ b/lshw-B.02.18/src/core/volumes.cc +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + __ID("@(#) $Id: volumes.cc 2488 2012-02-22 00:23:47Z lyonel $"); + +--- a/lshw-B.02.18/src/gui/engine.cc ++++ b/lshw-B.02.18/src/gui/engine.cc +@@ -6,6 +6,8 @@ + #include "osutils.h" + #include "options.h" + ++#include ++#include + #include + #include + #include +--- a/lshw-B.02.18/src/gui/print-gui.cc ++++ b/lshw-B.02.18/src/gui/print-gui.cc +@@ -10,6 +10,7 @@ + #include "version.h" + #include "osutils.h" + #include "stock.h" ++#include + #include + #include + #include --- lshw-02.18.orig/debian/patches/logo.svg +++ lshw-02.18/debian/patches/logo.svg @@ -0,0 +1,253 @@ + + + + + + + + + + + + + + + + image/svg+xml + + LSHW logo + 2005/07/15 + + + Lyonel Vincent + + + + + ezIX.org + + + logo + $Id: logo.svg 1822 2007-08-07 19:51:34Z lyonel $ + C + + + lshw logo diagnostics + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --- lshw-02.18.orig/debian/patches/lp1826737-align-physical-ID-with-NVMe-namespace.patch +++ lshw-02.18/debian/patches/lp1826737-align-physical-ID-with-NVMe-namespace.patch @@ -0,0 +1,20 @@ +From 9d5eb0dcbe814f4d55f2718b039b4bdc024ac0e4 Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Wed, 18 Mar 2020 15:22:37 +0100 +Subject: [PATCH] align physical ID with NVMe namespace + +Bug-Ubuntu: https://launchpad.net/bugs/1826737 +--- + src/core/nvme.cc | 1 + + 1 file changed, 1 insertion(+) + +--- a/lshw-B.02.18/src/core/nvme.cc ++++ b/lshw-B.02.18/src/core/nvme.cc +@@ -37,6 +37,7 @@ + for(unsigned long long i=1; e.hassubdir(e.name()+"n"+tostring(i)); i++) { + hwNode ns("namespace", hw::disk); + ns.claim(); ++ ns.setPhysId(i); + ns.setLogicalName(e.name()+"n"+tostring(i)); + scan_partitions(ns); + device.addChild(ns); --- lshw-02.18.orig/debian/patches/lp1826737-code-clean-up.patch +++ lshw-02.18/debian/patches/lp1826737-code-clean-up.patch @@ -0,0 +1,33 @@ +From 45db7ddd50b9d4197c82c49d0c1c32f616539a83 Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Thu, 26 Dec 2019 00:04:17 +0100 +Subject: [PATCH] code clean-up + +Bug-Ubuntu: https://launchpad.net/bugs/1826737 +--- + lshw-B.02.18/src/core/sysfs.cc | 2 +- + lshw-B.02.18/src/core/sysfs.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/lshw-B.02.18/src/core/sysfs.cc ++++ b/lshw-B.02.18/src/core/sysfs.cc +@@ -253,7 +253,7 @@ + delete This; + } + +-bool entry::hassubdir(const string & s) ++bool entry::hassubdir(const string & s) const + { + return exists(This->devpath + "/" + s); + } +--- a/lshw-B.02.18/src/core/sysfs.h ++++ b/lshw-B.02.18/src/core/sysfs.h +@@ -20,7 +20,7 @@ + entry(const entry &); + ~entry(); + +- bool hassubdir(const string &); ++ bool hassubdir(const string &) const; + string name() const; + string businfo() const; + string driver() const; --- lshw-02.18.orig/debian/patches/lp1826737-implement-NVMe-scanning.patch +++ lshw-02.18/debian/patches/lp1826737-implement-NVMe-scanning.patch @@ -0,0 +1,279 @@ +From 68ebc7d3d201cfeebf8063522d38209f482cade5 Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Wed, 18 Mar 2020 15:17:28 +0100 +Subject: [PATCH] implement NVMe scanning + +Bug-Ubuntu: https://launchpad.net/bugs/1826737 +--- + lshw-B.02.18/src/core/Makefile | 2 +- + lshw-B.02.18/src/core/main.cc | 4 ++++ + lshw-B.02.18/src/core/network.cc | 4 ++-- + lshw-B.02.18/src/core/nvme.cc | 53 ++++++++++++++++++++++++++++++++++++++++++ + lshw-B.02.18/src/core/nvme.h | 8 +++++++ + lshw-B.02.18/src/core/partitions.cc | 21 +++++++++++------ + lshw-B.02.18/src/core/sysfs.cc | 27 ++++++++++++++++++++- + lshw-B.02.18/src/core/sysfs.h | 3 +++ + 8 files changed, 111 insertions(+), 11 deletions(-) + create mode 100644 lshw-B.02.18/src/core/nvme.cc + create mode 100644 lshw-B.02.18/src/core/nvme.h + +--- a/lshw-B.02.18/src/core/Makefile ++++ b/lshw-B.02.18/src/core/Makefile +@@ -9,7 +9,7 @@ + LDSTATIC= + LIBS= + +-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 ++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 nvme.o + ifeq ($(SQLITE), 1) + OBJS+= db.o + endif +--- a/lshw-B.02.18/src/core/main.cc ++++ b/lshw-B.02.18/src/core/main.cc +@@ -41,6 +41,7 @@ + #include "ideraid.h" + #include "mounts.h" + #include "virtio.h" ++#include "nvme.h" + #include "smp.h" + #include "abi.h" + #include "dasd.h" +@@ -128,6 +129,9 @@ + scan_dasd(computer); + if (enabled("mounts")) + scan_mounts(computer); ++ status("NVMe"); ++ if (enabled("nvme")) ++ scan_nvme(computer); + status("Network interfaces"); + if (enabled("network")) + scan_network(computer); +--- a/lshw-B.02.18/src/core/network.cc ++++ b/lshw-B.02.18/src/core/network.cc +@@ -335,7 +335,7 @@ + interface.claim(); + interface.addHint("icon", string("network")); + +- string businfo = sysfs::entry::byClass("net", interface.getLogicalName()).businfo(); ++ string businfo = sysfs::entry::byClass("net", interface.getLogicalName()).leaf().businfo(); + interface.setBusInfo(businfo); + + //scan_mii(fd, interface); +--- /dev/null ++++ b/lshw-B.02.18/src/core/nvme.cc +@@ -0,0 +1,52 @@ ++#include "version.h" ++#include "hw.h" ++#include "sysfs.h" ++#include "osutils.h" ++#include "nvme.h" ++#include "partitions.h" ++ ++#include ++#include ++ ++__ID("@(#) $Id$"); ++ ++using namespace std; ++ ++bool scan_nvme(hwNode & n) ++{ ++ vector < sysfs::entry > entries = sysfs::entries_by_class("nvme"); ++ ++ if (entries.empty()) ++ return false; ++ ++ for (vector < sysfs::entry >::iterator it = entries.begin(); ++ it != entries.end(); ++it) ++ { ++ const sysfs::entry & e = *it; ++ ++ hwNode device(e.name(), hw::storage); ++ device.claim(); ++ device.setLogicalName(e.name()); ++ device.setDescription("NVMe device"); ++ device.setProduct(e.string_attr("model")); ++ device.setSerial(e.string_attr("serial")); ++ device.setVersion(e.string_attr("firmware_rev")); ++ device.setConfig("nqn",e.string_attr("subsysnqn")); ++ device.setConfig("state",e.string_attr("state")); ++ ++ for(unsigned long long i=1; e.hassubdir(e.name()+"n"+tostring(i)); i++) { ++ hwNode ns("namespace", hw::disk); ++ ns.claim(); ++ ns.setLogicalName(e.name()+"n"+tostring(i)); ++ scan_partitions(ns); ++ device.addChild(ns); ++ } ++ ++ if(hwNode *child = n.findChildByBusInfo(e.leaf().businfo())) { ++ child->addChild(device); ++ } else ++ n.addChild(device); ++ } ++ ++ return true; ++} +--- /dev/null ++++ b/lshw-B.02.18/src/core/nvme.h +@@ -0,0 +1,8 @@ ++#ifndef _NVME_H_ ++#define _NVME_H_ ++ ++#include "hw.h" ++ ++bool scan_nvme(hwNode &); ++ ++#endif +--- a/lshw-B.02.18/src/core/partitions.cc ++++ b/lshw-B.02.18/src/core/partitions.cc +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + __ID("@(#) $Id$"); + +@@ -292,23 +293,29 @@ + + static unsigned int lastlogicalpart = 5; + ++static string partitionname(string disk, unsigned int n) ++{ ++ if(isdigit(disk[disk.length()-1])) ++ return disk+"p"+tostring(n); ++ else ++ return disk+tostring(n); ++} ++ + static bool guess_logicalname(source & s, const hwNode & disk, unsigned int n, hwNode & partition) + { + struct stat buf; +- char name[10]; + int dev = 0; + +- snprintf(name, sizeof(name), "%d", n); + if(disk.getBusInfo()!="") +- partition.setBusInfo(disk.getBusInfo()+string(",")+string(name)); ++ partition.setBusInfo(disk.getBusInfo()+string(",")+tostring(n)); + + if(fstat(s.fd, &buf)!=0) return false; + if(!S_ISBLK(buf.st_mode)) return false; + + if(s.diskname!="") +- dev = open_dev(buf.st_rdev + n, S_IFBLK, s.diskname+string(name)); ++ dev = open_dev(buf.st_rdev + n, S_IFBLK, partitionname(s.diskname, n)); + else +- dev = open_dev(buf.st_rdev + n, S_IFBLK, disk.getLogicalName()+string(name)); ++ dev = open_dev(buf.st_rdev + n, S_IFBLK, partitionname(disk.getLogicalName(), n)); + + if(dev>=0) + { +@@ -333,9 +340,9 @@ + { + partition.claim(); + if(s.diskname!="") +- partition.setLogicalName(s.diskname+string(name)); ++ partition.setLogicalName(partitionname(s.diskname,n)); + else +- partition.setLogicalName(disk.getLogicalName()+string(name)); ++ partition.setLogicalName(partitionname(disk.getLogicalName(),n)); + return true; + } + } +--- a/lshw-B.02.18/src/core/sysfs.cc ++++ b/lshw-B.02.18/src/core/sysfs.cc +@@ -17,6 +17,7 @@ + #include + #include + ++ + __ID("@(#) $Id$"); + + using namespace sysfs; +@@ -201,6 +202,13 @@ + return result; + } + ++entry entry::leaf() const ++{ ++ if (hassubdir("device")) ++ return entry(This->devpath+"/device"); ++ ++ return entry(This->devpath); ++} + + string entry::driver() const + { +@@ -220,7 +228,7 @@ + + entry entry::byClass(string devclass, string devname) + { +- entry e(fs.path + "/class/" + devclass + "/" + devname + "/device"); ++ entry e(fs.path + "/class/" + devclass + "/" + devname); + return e; + } + +@@ -298,6 +306,11 @@ + return e; + } + ++string entry::string_attr(const string & name, const string & def) const ++{ ++ return hw::strip(get_string(This->devpath + "/" + name, def)); ++} ++ + + vector < entry > sysfs::entries_by_bus(const string & busname) + { +@@ -317,6 +330,23 @@ + return result; + } + ++vector < entry > sysfs::entries_by_class(const string & classname) ++{ ++ vector < entry > result; ++ ++ if (!pushd(fs.path + "/class/" + classname)) ++ return result; ++ ++ struct dirent **namelist; ++ int count; ++ count = scandir(".", &namelist, selectlink, alphasort); ++ for (int i = 0; i < count; i ++) ++ { ++ entry e = sysfs::entry::byClass(classname, namelist[i]->d_name); ++ result.push_back(e); ++ } ++ return result; ++} + + bool scan_sysfs(hwNode & n) + { +--- a/lshw-B.02.18/src/core/sysfs.h ++++ b/lshw-B.02.18/src/core/sysfs.h +@@ -20,12 +20,15 @@ + entry(const entry &); + ~entry(); + ++ entry leaf() const; ++ + bool hassubdir(const string &) const; + string name() const; + string businfo() const; + string driver() const; + entry parent() const; + string name_in_class(const string &) const; ++ string string_attr(const string & name, const string & def = "") const; + + struct entry_i * This; + +@@ -35,6 +38,7 @@ + }; + + vector < entry > entries_by_bus(const string & busname); ++ vector < entry > entries_by_class(const string & classname); + + } // namespace sysfs + --- lshw-02.18.orig/debian/patches/lp1826737-treat-NVMe-namespaces-like-disks.patch +++ lshw-02.18/debian/patches/lp1826737-treat-NVMe-namespaces-like-disks.patch @@ -0,0 +1,32 @@ +From 5dd11ac1ffc0262468f3efdb65005c960b7afa60 Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Wed, 18 Mar 2020 15:56:15 +0100 +Subject: [PATCH] treat NVMe namespaces like disks + +Bug-Ubuntu: https://launchpad.net/bugs/1826737 +--- + src/core/nvme.cc | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/lshw-B.02.18/src/core/nvme.cc ++++ b/lshw-B.02.18/src/core/nvme.cc +@@ -3,7 +3,7 @@ + #include "sysfs.h" + #include "osutils.h" + #include "nvme.h" +-#include "partitions.h" ++#include "disk.h" + + #include + #include +@@ -38,8 +38,9 @@ + hwNode ns("namespace", hw::disk); + ns.claim(); + ns.setPhysId(i); ++ ns.setDescription("NVMe namespace"); + ns.setLogicalName(e.name()+"n"+tostring(i)); +- scan_partitions(ns); ++ scan_disk(ns); + device.addChild(ns); + } + --- lshw-02.18.orig/debian/patches/lshw-X.patch +++ lshw-02.18/debian/patches/lshw-X.patch @@ -0,0 +1,62 @@ +Sanitize error when trying to run GUI without XIndex: lshw-02.14/src/gui/integration/console.apps +=================================================================== +--- a/lshw-B.02.18/src/gui/integration/console.apps ++++ b/lshw-B.02.18/src/gui/integration/console.apps +@@ -1,3 +1,3 @@ + USER=root +-PROGRAM=/usr/sbin/gtk-lshw ++PROGRAM=/usr/sbin/lshw-gtk + SESSION=true +--- a/lshw-B.02.18/src/gui/integration/gtk-lshw.desktop ++++ b/lshw-B.02.18/src/gui/integration/gtk-lshw.desktop +@@ -3,7 +3,7 @@ + Comment=HardWare LiSter + Categories=Application;System;X-Red-Hat-Base;X-Fedora; + Icon=/usr/share/lshw/artwork/logo.svg +-Exec=/usr/bin/gtk-lshw ++Exec=/usr/bin/lshw-gtk + Type=Application + Terminal=false + Encoding=UTF-8 +--- a/lshw-B.02.18/src/lshw.cc ++++ b/lshw-B.02.18/src/lshw.cc +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + + #ifndef NONLS + #include +@@ -30,8 +31,8 @@ + fprintf(stderr, _("\t-xml output hardware tree as XML\n")); + fprintf(stderr, _("\t-short output hardware paths\n")); + fprintf(stderr, _("\t-businfo output bus information\n")); +- if(getenv("DISPLAY") && exists(SBINDIR"/gtk-lshw")) +- fprintf(stderr, _("\t-X use graphical interface\n")); ++ if(getenv("DISPLAY") && exists(SBINDIR"/lshw-gtk")) ++ fprintf(stderr, _("\t-X use graphical interface\n")); + fprintf(stderr, _("\noptions can be\n")); + #ifdef SQLITE + fprintf(stderr, _("\t-dump OUTFILE save hardware tree to a file\n")); +@@ -211,7 +212,19 @@ + exit(1); + } + +- if(enabled("output:X")) execl(SBINDIR"/gtk-lshw", SBINDIR"/gtk-lshw", NULL); ++/* if(enabled("output:X")) execl(SBINDIR"/gtk-lshw", SBINDIR"/gtk-lshw", NULL); */ ++ ++ if(enabled("output:X")) { ++ execl(SBINDIR"/lshw-gtk", SBINDIR"/lshw-gtk", NULL); ++ // Execl only returns if an error has occurred. ++ if ( errno == ENOENT ) { ++ fprintf(stderr, "ERROR: Sorry, cannot run the X11/GTK interface because %s/lshw-gtk\n is not available.\n", SBINDIR); ++ fprintf(stderr, "HINT: Install the lshw-gtk package in Debian.\n"); ++ } else { ++ fprintf(stderr, "ERROR: There was an error when trying to execute %s/lshw-gtk: %s\n", SBINDIR, strerror(errno)); ++ fprintf(stderr, "Will just print the information on screen\n"); ++ } ++ } + + if (geteuid() != 0) + { --- lshw-02.18.orig/debian/patches/lshw-add-json-option-in-help-output.patch +++ lshw-02.18/debian/patches/lshw-add-json-option-in-help-output.patch @@ -0,0 +1,25 @@ +From 503c76a35a9e97a098af7c1ac793a7e13c07ce70 Mon Sep 17 00:00:00 2001 +From: Chandni Verma +Date: Thu, 8 Sep 2016 14:29:08 +0530 +Subject: [PATCH] Adding -json option in -help output + +-json works perfectly and is a recognized lshw option already. +It was only missed in printing. Nothing more needs to be done. + +Signed-off-by: Chandni Verma +--- + lshw-B.02.18/src/lshw.cc | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lshw-B.02.18/src/lshw.cc b/lshw-B.02.18/src/lshw.cc +index 77a5932..5fc8ade 100644 +--- a/lshw-B.02.18/src/lshw.cc ++++ b/lshw-B.02.18/src/lshw.cc +@@ -29,6 +29,7 @@ void usage(const char *progname) + fprintf(stderr, _("\nformat can be\n")); + fprintf(stderr, _("\t-html output hardware tree as HTML\n")); + fprintf(stderr, _("\t-xml output hardware tree as XML\n")); ++ fprintf(stderr, _("\t-json output hardware tree as a JSON object\n")); + fprintf(stderr, _("\t-short output hardware paths\n")); + fprintf(stderr, _("\t-businfo output bus information\n")); + if(getenv("DISPLAY") && exists(SBINDIR"/lshw-gtk")) --- lshw-02.18.orig/debian/patches/lshw-common.patch +++ lshw-02.18/debian/patches/lshw-common.patch @@ -0,0 +1,22 @@ +Added paths to look for device idsIndex: lshw-02.14/src/core/pci.cc +=================================================================== +--- a/lshw-B.02.18/src/core/pci.cc ++++ b/lshw-B.02.18/src/core/pci.cc +@@ -18,6 +18,7 @@ + #define PROC_BUS_PCI "/proc/bus/pci" + #define SYS_BUS_PCI "/sys/bus/pci" + #define PCIID_PATH DATADIR"/pci.ids:/usr/share/lshw/pci.ids:/usr/local/share/pci.ids:/usr/share/pci.ids:/etc/pci.ids:/usr/share/hwdata/pci.ids:/usr/share/misc/pci.ids" ++#define PCIID_PATH DATADIR"/pci.ids:/usr/share/lshw-common/pci.ids:/usr/local/share/pci.ids:/usr/share/pci.ids:/etc/pci.ids:/usr/share/hwdata/pci.ids:/usr/share/misc/pci.ids" + + #define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 revision */ + #define PCI_VENDOR_ID 0x00 /* 16 bits */ +--- a/lshw-B.02.18/src/core/usb.cc ++++ b/lshw-B.02.18/src/core/usb.cc +@@ -28,6 +28,7 @@ + #define PROCBUSUSBDEVICES "/proc/bus/usb/devices" + #define SYSKERNELDEBUGUSBDEVICES "/sys/kernel/debug/usb/devices" + #define USBID_PATH DATADIR"/usb.ids:/usr/share/lshw/usb.ids:/usr/local/share/usb.ids:/usr/share/usb.ids:/etc/usb.ids:/usr/share/hwdata/usb.ids:/usr/share/misc/usb.ids" ++#define USBID_PATH DATADIR"/usb.ids:/usr/share/lshw-common/usb.ids:/usr/local/share/usb.ids:/usr/share/usb.ids:/etc/usb.ids:/usr/share/hwdata/usb.ids:/usr/share/misc/usb.ids" + + #define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */ + #define USB_CLASS_AUDIO 1 --- lshw-02.18.orig/debian/patches/lshw-devictree-assume-untyped-cpu-is-cpu.patch +++ lshw-02.18/debian/patches/lshw-devictree-assume-untyped-cpu-is-cpu.patch @@ -0,0 +1,12 @@ +--- a/lshw-B.02.18/src/core/device-tree.cc.orig 2013-05-07 14:57:16.400177000 -0400 ++++ b/lshw-B.02.18/src/core/device-tree.cc 2013-05-07 15:01:51.710177000 -0400 +@@ -193,7 +193,8 @@ + struct dirent **cachelist; + int ncache; + +- if (hw::strip(get_string(basepath + "/device_type")) != "cpu") ++ if (exists(basepath + "/device_type") && ++ hw::strip(get_string(basepath + "/device_type")) != "cpu") + break; // oops, not a CPU! + + cpu.setProduct(get_string(basepath + "/name")); --- lshw-02.18.orig/debian/patches/lshw-fix-unknown-version-issue.patch +++ lshw-02.18/debian/patches/lshw-fix-unknown-version-issue.patch @@ -0,0 +1,79 @@ +From 18edc98f9d08883f340087cfefbdf05c585d56f7 Mon Sep 17 00:00:00 2001 +From: Vasant Hegde +Date: Wed, 23 Aug 2017 14:01:21 +0530 +Subject: [PATCH] Fix version issue + +Commit 2d0296cc changed the way to get version number. Now it uses git +describe command to get version number. Also B.02.18 release missed to +expand 'versiontag' variable in version.cc file. Hence lshw -version +is showing version as "unknown". + +This patch passes VERSION macro during compilatio and uses it to show +version number. + +I've verified this with `make release` command as well. It works fine. +As long as user is working on git tree or uses `make release` command +it works fine. + +Signed-off-by: Vasant Hegde +--- + lshw-B.02.18/src/Makefile | 2 +- + lshw-B.02.18/src/core/version.cc | 29 +++-------------------------- + 2 files changed, 4 insertions(+), 27 deletions(-) + +diff --git a/lshw-B.02.18/src/Makefile b/lshw-B.02.18/src/Makefile +index acbdbfa..d3fc3c5 100644 +--- a/lshw-B.02.18/src/Makefile ++++ b/lshw-B.02.18/src/Makefile +@@ -20,7 +20,7 @@ export SQLITE + + CXX?=c++ + INCLUDES=-I./core/ +-DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" ++DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" -DVERSION=\"$(VERSION)\" + #CXXFLAGS=-g -Wall -g $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) + CXXFLAGS=$(CXX_DEB_FLAGS) $(INCLUDES) $(DEFINES) + ifeq ($(SQLITE), 1) +diff --git a/lshw-B.02.18/src/core/version.cc b/lshw-B.02.18/src/core/version.cc +index c9dc899..1f64b3a 100644 +--- a/lshw-B.02.18/src/core/version.cc ++++ b/lshw-B.02.18/src/core/version.cc +@@ -23,35 +23,12 @@ + #endif + + +-static char versiontag[] = "@(#) $URL$ >"; +- + const char *getpackageversion() + { +- static char * result = NULL; +- char * lastslash = NULL; +- +- if(result) +- return result; +- +- lastslash = strrchr(versiontag, '/'); +- if(lastslash) +- *lastslash = '\0'; // cut the basename off +- +- lastslash = strrchr(versiontag, '/'); +- if(lastslash) +- *lastslash = '\0'; // cut the basename off +- +- lastslash = strrchr(versiontag, '/'); +- if(lastslash) +- *lastslash = '\0'; // cut the basename off +- +- lastslash = strrchr(versiontag, '/'); +- if(lastslash) +- result = lastslash+1; +- else +- return "unknown"; ++ if (VERSION) ++ return VERSION; + +- return result; ++ return "unknown"; + } + + static char *txtquery(const char *name, const char *domain, unsigned int *ttl) --- lshw-02.18.orig/debian/patches/lshw-gtk.1 +++ lshw-02.18/debian/patches/lshw-gtk.1 @@ -0,0 +1,160 @@ +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.hy 0 +.if n .na +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "LSHW-GTK 1" +.TH LSHW-GTK 1 "2007-12-05" "perl v5.8.8" "User Contributed Perl Documentation" +.SH "NAME" +lshw\-gtk \- list hardware (GTK version) +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +lshw is a small tool to extract detailed information on the hardware +configuration of the machine. It can report exact memory +configuration, firmware version, mainboard configuration, +\&\s-1CPU\s0 version +and speed, cache configuration, bus speed, etc. on +DMI-capable x86 or \s-1IA\-64\s0 +systems and on some PowerPC +machines (PowerMac G4 is known to work). +.PP +It currently supports \s-1DMI\s0 (x86 and \s-1IA\-64\s0 only), OpenFirmware device tree (PowerPC only), +\&\s-1PCI/AGP\s0, \s-1CPUID\s0 (x86), \s-1IDE/ATA/ATAPI\s0, \s-1PCMCIA\s0 (only tested on x86), \s-1SCSI\s0 and \s-1USB\s0. +.SH "NOTES" +.IX Header "NOTES" +lshw-gtk must be run as super user or it will only report +.SH "COPYING" +.IX Header "COPYING" +lshw is distributed under the \s-1GNU\s0 \s-1GENERAL\s0 \s-1PUBLIC\s0 \s-1LICENSE\s0 (\s-1GPL\s0) version 2. +.SH "AUTOR" +.IX Header "AUTOR" +lshw is maintained by Lyonel Vincent +. +.SH "OTHER INFO" +.IX Header "OTHER INFO" +The webpage for lshw is at http://ezix.org/software/lshw.html --- lshw-02.18.orig/debian/patches/lshw-gtk.desktop +++ lshw-02.18/debian/patches/lshw-gtk.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Application +Name=Hardware Lister +Name[es]=Listar equipamiento +Comment=Provides information on hardware +Comment[ca]=Proveeix informació sobre el maquinari +Comment[es]=Ofrece información sobre el equipamiento instalado +Icon=lshw-gtk +Exec=su-to-root -X -c lshw-gtk +Terminal=false +Categories=System; --- lshw-02.18.orig/debian/patches/lshw-gtk.patch +++ lshw-02.18/debian/patches/lshw-gtk.patch @@ -0,0 +1,15 @@ +Modified install directoriesIndex: lshw-02.14/src/Makefile +=================================================================== +--- a/lshw-B.02.18/src/Makefile ++++ b/lshw-B.02.18/src/Makefile +@@ -104,8 +104,8 @@ + + install-gui: gui + $(INSTALL) -d -m 0755 $(DESTDIR)/$(SBINDIR) +- $(INSTALL) -m 0755 gui/gtk-$(PACKAGENAME) $(DESTDIR)/$(SBINDIR) +- $(INSTALL) -d -m 0755 $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/artwork ++ $(INSTALL) -m 0755 gui/gtk-$(PACKAGENAME) $(DESTDIR)/$(SBINDIR)/$(PACKAGENAME)-gtk ++ $(INSTALL) -d -m 0754 $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/artwork + $(INSTALL) -d -m 0755 $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/ui + $(INSTALL) -m 0644 gui/*.ui $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/ui + $(INSTALL) -m 0644 gui/artwork/*.svg $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/artwork --- lshw-02.18.orig/debian/patches/lshw-gtk.pod +++ lshw-02.18/debian/patches/lshw-gtk.pod @@ -0,0 +1,36 @@ +=head1 NAME + +lshw-gtk - list hardware (GTK version) + +=head1 DESCRIPTION + +lshw is a small tool to extract detailed information on the hardware +configuration of the machine. It can report exact memory +configuration, firmware version, mainboard configuration, +CPU version +and speed, cache configuration, bus speed, etc. on +DMI-capable x86 or IA-64 +systems and on some PowerPC +machines (PowerMac G4 is known to work). + +It currently supports DMI (x86 and IA-64 only), OpenFirmware device tree (PowerPC only), +PCI/AGP, CPUID (x86), IDE/ATA/ATAPI, PCMCIA (only tested on x86), SCSI and USB. + +=head1 NOTES + +lshw-gtk must be run as super user or it will only report + +=head1 COPYING + +lshw is distributed under the GNU GENERAL PUBLIC LICENSE (GPL) version 2. + +=head1 AUTOR + +lshw is maintained by Lyonel Vincent +. + +=head1 OTHER INFO + +The webpage for lshw is at http://ezix.org/software/lshw.html + +=cut --- lshw-02.18.orig/debian/patches/merge-github-pull-request-23-parse-CPU-information.patch +++ lshw-02.18/debian/patches/merge-github-pull-request-23-parse-CPU-information.patch @@ -0,0 +1,359 @@ +From a5fb8431d9888cbd4b40e6435d4379bf0c86cdec Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Thu, 20 Oct 2016 00:27:58 +0200 +Subject: [PATCH] merge github pull request 23: parse CPU information + +FIXME: `dimminfo` magic needs cleansing, ugly code getting uglier +--- + src/core/device-tree.cc | 267 ++++++++++++++++++++++++++++++++++++++++++------ + 1 file changed, 237 insertions(+), 30 deletions(-) + +diff --git a/lshw-B.02.18/src/core/device-tree.cc b/lshw-B.02.18/src/core/device-tree.cc +index c2b7d15..700dff0 100644 +--- a/lshw-B.02.18/src/core/device-tree.cc ++++ b/lshw-B.02.18/src/core/device-tree.cc +@@ -26,6 +26,8 @@ + #include + #include + #include ++#include ++#include + + __ID("@(#) $Id$"); + +@@ -227,6 +229,42 @@ static string cpubusinfo(int cpu) + } + + ++static void set_cpu(hwNode & cpu, int currentcpu, const string & basepath) ++{ ++ cpu.setProduct(get_string(basepath + "/name")); ++ cpu.claim(); ++ cpu.setBusInfo(cpubusinfo(currentcpu)); ++ ++ cpu.setSize(get_u32(basepath + "/clock-frequency")); ++ cpu.setClock(get_u32(basepath + "/bus-frequency")); ++ ++ if (exists(basepath + "/altivec")) ++ cpu.addCapability("altivec"); ++ ++ if (exists(basepath + "/performance-monitor")) ++ cpu.addCapability("performance-monitor"); ++} ++ ++ ++static void fill_cache_info(string cache_type, string cachebase, ++ hwNode & cache, hwNode & icache) ++{ ++ cache.claim(); ++ cache.setDescription(cache_type); ++ cache.setSize(get_u32(cachebase + "/d-cache-size")); ++ ++ if (exists(cachebase + "/cache-unified")) ++ cache.setDescription(cache.getDescription() + " (unified)"); ++ else ++ { ++ icache = cache; ++ cache.setDescription(cache.getDescription() + " (data)"); ++ icache.setDescription(icache.getDescription() + " (instruction)"); ++ icache.setSize(get_u32(cachebase + "/i-cache-size")); ++ } ++} ++ ++ + static void scan_devtree_cpu(hwNode & core) + { + struct dirent **namelist; +@@ -254,14 +292,8 @@ static void scan_devtree_cpu(hwNode & core) + hw::strip(get_string(basepath + "/device_type")) != "cpu") + break; // oops, not a CPU! + +- cpu.setProduct(get_string(basepath + "/name")); + cpu.setDescription("CPU"); +- cpu.claim(); +- cpu.setBusInfo(cpubusinfo(currentcpu++)); +- cpu.setSize(get_u32(basepath + "/clock-frequency")); +- cpu.setClock(get_u32(basepath + "/bus-frequency")); +- if (exists(basepath + "/altivec")) +- cpu.addCapability("altivec"); ++ set_cpu(cpu, currentcpu++, basepath); + + version = get_u32(basepath + "/cpu-version"); + if (version != 0) +@@ -273,14 +305,11 @@ static void scan_devtree_cpu(hwNode & core) + snprintf(buffer, sizeof(buffer), "%lx.%d.%d", + (version & 0xffff0000) >> 16, major, minor); + cpu.setVersion(buffer); +- + } ++ + if (hw::strip(get_string(basepath + "/state")) != "running") + cpu.disable(); + +- if (exists(basepath + "/performance-monitor")) +- cpu.addCapability("performance-monitor"); +- + if (exists(basepath + "/d-cache-size")) + { + hwNode cache("cache", +@@ -302,29 +331,19 @@ static void scan_devtree_cpu(hwNode & core) + { + hwNode cache("cache", + hw::memory); ++ hwNode icache("cache", ++ hw::memory); + string cachebase = basepath + "/" + cachelist[j]->d_name; + + if (hw::strip(get_string(cachebase + "/device_type")) != "cache" && + hw::strip(get_string(cachebase + "/device_type")) != "l2-cache") + break; // oops, not a cache! + +- cache.claim(); +- cache.setDescription("L2 Cache"); +- cache.setSize(get_u32(cachebase + "/d-cache-size")); +- cache.setClock(get_u32(cachebase + "/clock-frequency")); ++ cache.setClock(get_u32(cachebase + "/clock-frequency")); ++ fill_cache_info("L2 Cache", cachebase, cache, icache); + +- if (exists(cachebase + "/cache-unified")) +- cache.setDescription(cache.getDescription() + " (unified)"); +- else +- { +- hwNode icache = cache; +- cache.setDescription(cache.getDescription() + " (data)"); +- icache.setDescription(icache.getDescription() + " (instruction)"); +- icache.setSize(get_u32(cachebase + "/i-cache-size")); +- +- if (icache.getSize() > 0) +- cpu.addChild(icache); +- } ++ if (icache.getSize() > 0) ++ cpu.addChild(icache); + + if (cache.getSize() > 0) + cpu.addChild(cache); +@@ -342,6 +361,191 @@ static void scan_devtree_cpu(hwNode & core) + } + } + ++static void set_cpu_config_threads(hwNode & cpu, const string & basepath) ++{ ++ static int threads_per_cpu = 0; ++ ++ /* In power systems, there are equal no. of threads per cpu-core */ ++ if (threads_per_cpu == 0) ++ { ++ int rc; ++ struct stat sbuf; ++ string p = hw::strip(basepath + string("/ibm,ppc-interrupt-server#s")); ++ ++ /* ++ * This file contains as many 32 bit interrupt server numbers, as the ++ * number of threads per CPU (in hexadecimal format). st_size gives size ++ * in bytes of a file. Hence, grouping by 4 bytes, we get the thread ++ * count. ++ */ ++ rc = stat(p.c_str(), &sbuf); ++ if (!rc) ++ threads_per_cpu = sbuf.st_size / 4; ++ } ++ ++ cpu.setConfig("threads", threads_per_cpu); ++} ++ ++ ++static void scan_devtree_cpu_power(hwNode & core) ++{ ++ int n; ++ int currentcpu = 0; ++ struct dirent **namelist; ++ map > > l2_caches; ++ map > l3_caches; ++ ++ pushd(DEVICETREE "/cpus"); ++ n = scandir(".", &namelist, selectdir, alphasort); ++ popd(); ++ if (n < 0) ++ return; ++ ++ /* ++ * 'cpus' node contains CPU, L2 and L3 cache nodes. L1 cache information is ++ * available under CPU node itself. l2-cache (or next-level-cache) property ++ * contains next level cache node phandle/ibm,phanle number. ++ * First pass creates cache nodes and second pass will link cache nodes to ++ * corresponding CPU nodes. ++ */ ++ for (int i = 0; i < n; i++) ++ { ++ string product; ++ string basepath = string(DEVICETREE "/cpus/") + string(namelist[i]->d_name); ++ hwNode cache("cache", hw::memory); ++ hwNode icache("cache", hw::memory); ++ vector value; ++ ++ if (!exists(basepath + "/device_type")) ++ continue; ++ ++ if (hw::strip(get_string(basepath + "/device_type")) != "cache") ++ continue; ++ ++ product = hw::strip(get_string(basepath + "/name")); ++ ++ if (hw::strip(get_string(basepath + "/status")) != "okay") ++ cache.disable(); ++ ++ if (product == "l2-cache") ++ fill_cache_info("L2 Cache", basepath, cache, icache); ++ else ++ fill_cache_info("L3 Cache", basepath, cache, icache); ++ ++ if (icache.getSize() > 0) ++ value.insert(value.begin(), icache); ++ ++ if (cache.getSize() > 0) ++ value.insert(value.begin(), cache); ++ ++ if (value.size() > 0) ++ { ++ uint32_t phandle = 0; ++ ++ if (exists(basepath + "/phandle")) ++ phandle = get_u32(basepath + "/phandle"); ++ else if (exists(basepath + "/ibm,phandle")) // on pSeries LPARs ++ phandle = get_u32(basepath + "/ibm,phandle"); ++ ++ if (!phandle) ++ continue; ++ ++ if (product == "l2-cache") ++ { ++ uint32_t l3_key = 0; // 0 indicating no next level of cache ++ ++ if (exists(basepath + "/l2-cache")) ++ l3_key = get_u32(basepath + "/l2-cache"); ++ else if (exists(basepath + "/next-level-cache")) //on OpenPOWER systems ++ l3_key = get_u32(basepath + "/next-level-cache"); ++ ++ pair > p (l3_key, value); ++ l2_caches[phandle] = p; ++ } ++ else if (product == "l3-cache") ++ { ++ l3_caches[phandle] = value; ++ } ++ } ++ } // first pass end ++ ++ for (int i = 0; i < n; i++) //second and final pass ++ { ++ uint32_t l2_key = 0; ++ uint32_t version = 0; ++ string basepath = string(DEVICETREE "/cpus/") + string(namelist[i]->d_name); ++ hwNode cpu("cpu", hw::processor); ++ ++ if (!exists(basepath + "/device_type")) ++ { ++ free(namelist[i]); ++ continue; ++ } ++ ++ if (hw::strip(get_string(basepath + "/device_type")) != "cpu") ++ { ++ free(namelist[i]); ++ continue; ++ } ++ ++ cpu.setDescription("CPU"); ++ set_cpu(cpu, currentcpu++, basepath); ++ ++ version = get_u32(basepath + "/cpu-version"); ++ if (version != 0) ++ cpu.setVersion(tostring(version)); ++ ++ if (hw::strip(get_string(basepath + "/status")) != "okay") ++ cpu.disable(); ++ ++ set_cpu_config_threads(cpu, basepath); ++ ++ if (exists(basepath + "/d-cache-size")) ++ { ++ hwNode cache("cache", hw::memory); ++ hwNode icache("cache", hw::memory); ++ ++ fill_cache_info("L1 Cache", basepath, cache, icache); ++ ++ if (icache.getSize() > 0) ++ cpu.addChild(icache); ++ ++ if (cache.getSize() > 0) ++ cpu.addChild(cache); ++ } ++ ++ if (exists(basepath + "/l2-cache")) ++ l2_key = get_u32(basepath + "/l2-cache"); ++ else if (exists(basepath + "/next-level-cache")) ++ l2_key = get_u32(basepath + "/next-level-cache"); ++ ++ if (l2_key != 0) ++ { ++ map > >:: ++ const_iterator got = l2_caches.find(l2_key); ++ ++ if (!(got == l2_caches.end())) ++ for (uint32_t j = 0; j < (got->second).second.size(); j++) ++ cpu.addChild((got->second).second[j]); ++ ++ if ((got->second).first != 0) // we have another level of cache ++ { ++ map >::const_iterator got_l3 = ++ l3_caches.find ((got->second).first); ++ ++ if (!(got_l3 == l3_caches.end())) ++ for (uint32_t j = 0; j < (got_l3->second).size(); j++) ++ cpu.addChild((got_l3->second)[j]); ++ } ++ } ++ ++ core.addChild(cpu); ++ ++ free(namelist[i]); ++ } ++ free(namelist); ++} ++ + void add_memory_bank(string name, string path, hwNode & core) + { + struct dirent **dirlist; +@@ -728,7 +932,7 @@ bool scan_device_tree(hwNode & n) + core->addHint("icon", string("board")); + scan_devtree_root(*core); + scan_devtree_memory_powernv(*core); +- scan_devtree_cpu(*core); ++ scan_devtree_cpu_power(*core); + n.addCapability("powernv", "Non-virtualized"); + n.addCapability("opal", "OPAL firmware"); + } +@@ -764,7 +968,7 @@ bool scan_device_tree(hwNode & n) + { + core->addHint("icon", string("board")); + scan_devtree_root(*core); +- scan_devtree_cpu(*core); ++ scan_devtree_cpu_power(*core); + core->addCapability("qemu", "QEMU virtualization"); + core->addCapability("guest", "Virtualization guest"); + } +@@ -779,7 +983,10 @@ bool scan_device_tree(hwNode & n) + scan_devtree_root(*core); + scan_devtree_bootrom(*core); + scan_devtree_memory(*core); +- scan_devtree_cpu(*core); ++ if (exists(DEVICETREE "/ibm,lpar-capable")) ++ scan_devtree_cpu_power(*core); ++ else ++ scan_devtree_cpu(*core); + } + } + +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/pci-Add-device-tree-info.patch +++ lshw-02.18/debian/patches/pci-Add-device-tree-info.patch @@ -0,0 +1,34 @@ +From e05126bfbf112fc73c98decaf9d27c5e5e38c3c4 Mon Sep 17 00:00:00 2001 +From: Jeremy Kerr +Date: Wed, 24 Aug 2016 17:39:44 +0800 +Subject: [PATCH 10/19] pci: Add device tree info + +Signed-off-by: Jeremy Kerr +Signed-off-by: Vasant Hegde +--- + src/core/pci.cc | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lshw-B.02.18/src/core/pci.cc b/lshw-B.02.18/src/core/pci.cc +index 8871bbf..1d2b4ee 100644 +--- a/lshw-B.02.18/src/core/pci.cc ++++ b/lshw-B.02.18/src/core/pci.cc +@@ -1,6 +1,7 @@ + #include "version.h" + #include "config.h" + #include "pci.h" ++#include "device-tree.h" + #include "osutils.h" + #include "options.h" + #include "sysfs.h" +@@ -1177,6 +1178,7 @@ bool scan_pci(hwNode & n) + fclose(resource); + } + } ++ add_device_tree_info(*device, devices[i]->d_name); + + result = true; + } +-- +2.9.3 + --- lshw-02.18.orig/debian/patches/privacy.patch +++ lshw-02.18/debian/patches/privacy.patch @@ -0,0 +1,13 @@ +Doesn't look for new version on inte to avoid privacy issuesIndex: lshw-02.14/src/core/version.cc +=================================================================== +--- a/lshw-B.02.18/src/core/version.cc ++++ b/lshw-B.02.18/src/core/version.cc +@@ -112,6 +112,8 @@ + { + static char *latest = NULL; + ++ return NULL; ++ + if(!latest) + latest = txtquery(PACKAGE, "ezix.org", NULL); + --- lshw-02.18.orig/debian/patches/series +++ lshw-02.18/debian/patches/series @@ -0,0 +1,45 @@ +wget.patch +bin.patch +lshw-gtk.patch +lshw-common.patch +cflags.patch +#alpha.patch +gcc45.gcc +lshw-X.patch +privacy.patch +spelling-error.patch +fix-manpage.patch +Avoid-crash-in-scan_dmi_sysfs-when-running-as-non-ro.patch +fix-width-handling.patch +merge-github-pull-request-23-parse-CPU-information.patch +devtree-Display-CPU-nodes-before-memory.patch +devtree-Add-machine-description.patch +devtree-Fix-motherboard-model-reporting.patch +devtree-Fix-physical-ID-info-for-CPU-nodes.patch +devtree-Add-VPD-info-for-FSP-based-Power-System.patch +devtree-Add-VPD-info-for-BMC-based-IBM-Power-System.patch +cpuinfo-Rectify-cpuinfo-for-IBM-Power-Systems.patch +devtree-Add-parsed-firmware-version-info.patch +devtree-Add-add_device_tree_info.patch +pci-Add-device-tree-info.patch +devtree-Use-consistent-output-format.patch +devtree-Code-cleanup.patch +devtree-Refactor-SPD-handling-code.patch +devtree-Don-t-overrun-dimminfo-buffer.patch +devtree-Add-description-vendor-and-clock-info-to-mem.patch +devtree-Add-part-and-serial-number-info-to-memory-ba.patch +devtree-Report-memory-info-for-BMC-based-Power-Syste.patch +devtree-Correctly-read-size-for-DDR4-SPD.patch +devtree-Add-support-for-DDR4-SPD.patch +fix-segfault-in-privileged-containers.patch +devtree-Check-status-property-for-caches.patch +devtree-Parse-spd-data.patch +cpuinfo-Do-not-enable-cpu-node-on-IBM-Power-System.patch +devtree-Add-vendor-field-for-cpu-node.patch +AArch64-cpuinfo-Remove-redundant-cpu-caps-loop.patch +lshw-add-json-option-in-help-output.patch +lshw-fix-unknown-version-issue.patch +lp1826737-code-clean-up.patch +lp1826737-implement-NVMe-scanning.patch +lp1826737-align-physical-ID-with-NVMe-namespace.patch +lp1826737-treat-NVMe-namespaces-like-disks.patch --- lshw-02.18.orig/debian/patches/spelling-error.patch +++ lshw-02.18/debian/patches/spelling-error.patch @@ -0,0 +1,11 @@ +--- a/lshw-B.02.18/src/core/network.cc ++++ b/lshw-B.02.18/src/core/network.cc +@@ -414,7 +414,7 @@ + if(ecmd.supported & SUPPORTED_BNC) + interface.addCapability("bnc", _("BNC")); + if(ecmd.supported & SUPPORTED_MII) +- interface.addCapability("mii", _("Media Independant Interface")); ++ interface.addCapability("mii", _("Media Independent Interface")); + if(ecmd.supported & SUPPORTED_FIBRE) + interface.addCapability("fibre",_( "optical fibre")); + if(ecmd.supported & SUPPORTED_10baseT_Half) --- lshw-02.18.orig/debian/patches/sysfs-hang.patch +++ lshw-02.18/debian/patches/sysfs-hang.patch @@ -0,0 +1,32 @@ +Index: lshw-02.12.01/src/core/pci.cc +=================================================================== +--- lshw-02.12.01.orig/src/core/pci.cc 2008-05-04 00:24:49.000000000 +0200 ++++ lshw-02.12.01/src/core/pci.cc 2008-05-04 00:24:49.000000000 +0200 +@@ -68,6 +68,7 @@ + #define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ + #define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ + #define PCI_CAP_SIZEOF 4 ++#define PCI_FIND_CAP_TTL 48 + + #define PCI_SID_ESR 2 /* Expansion Slot Register */ + #define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */ +@@ -666,8 +667,9 @@ + { + unsigned int where = get_conf_byte(d, PCI_CAPABILITY_LIST) & ~3; + string buffer; ++ unsigned int ttl = PCI_FIND_CAP_TTL; + +- while(where) ++ while(where && ttl--) + { + unsigned int id, next, cap; + +@@ -675,7 +677,7 @@ + next = get_conf_byte(d, where + PCI_CAP_LIST_NEXT) & ~3; + cap = get_conf_word(d, where + PCI_CAP_FLAGS); + +- if(!id) ++ if(!id || id == 0xff) + return false; + + switch(id) --- lshw-02.18.orig/debian/patches/wget.patch +++ lshw-02.18/debian/patches/wget.patch @@ -0,0 +1,26 @@ +Avoid downloading of files from inet at build time +This is provided by hwdata packageIndex: lshw-02.14/src/Makefile +=================================================================== +--- a/lshw-B.02.18/src/Makefile ++++ b/lshw-B.02.18/src/Makefile +@@ -82,16 +82,16 @@ + docbook2man $< + + pci.ids: +- wget http://pciids.sourceforge.net/pci.ids ++ #wget http://pciids.sourceforge.net/pci.ids + + usb.ids: +- wget http://www.linux-usb.org/usb.ids ++ #wget http://www.linux-usb.org/usb.ids + + oui.txt: +- wget http://standards.ieee.org/regauth/oui/oui.txt ++ #wget http://standards.ieee.org/regauth/oui/oui.txt + + manuf.txt: +- wget -O $@ http://anonsvn.wireshark.org/wireshark/trunk/manuf ++ #wget -O $@ http://anonsvn.wireshark.org/wireshark/trunk/manuf + + install: all + $(INSTALL) -d -m 0755 $(DESTDIR)/$(SBINDIR) --- lshw-02.18.orig/debian/rules +++ lshw-02.18/debian/rules @@ -0,0 +1,125 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# GNU copyright 1997 to 1999 by Joey Hess. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# This is the debhelper compatibility version to use. +#export DH_COMPAT=4 + +include /usr/share/quilt/quilt.make + +CXX_DEB_FLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + export CXX_DEB_FLAGS += -O0 +else + export CXX_DEB_FLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + export INSTALL_PROGRAM += -s +endif + +ifeq ($(DEB_BUILD_GNU_TYPE),alpha-linux-gnu) + export CXX_DEB_FLAGS = -Wall -g +endif + + +uver=B.02.18 +srcdir=lshw-$(uver)/src + +configure: configure-stamp +configure-stamp: + dh_testdir + #Add here commands to configure the package. + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp patch + dh_testdir + + # Add here commands to compile the package. + $(MAKE) -C $(srcdir) VERSION=$(uver) core + $(MAKE) -C $(srcdir) gui + #/usr/bin/docbook-to-man debian/lshw.sgml > lshw.1 + touch build-stamp + +clean: unpatch + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) -C $(srcdir) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/lshw. + $(MAKE) -C $(srcdir) install DESTDIR=$(CURDIR)/debian/lshw + $(MAKE) -C $(srcdir) install-gui DESTDIR=$(CURDIR)/debian/lshw-gtk + + # data files supplied by pciutils and usbutils + rm -rf $(CURDIR)/debian/lshw/usr/share/lshw + #pod2man --lax $(CURDIR)/debian/patches/lshw-gtk.pod > $(CURDIR)/debian/patches/lshw-gtk.1 + cp $(CURDIR)/debian/patches/lshw-gtk.desktop $(CURDIR)/debian/lshw-gtk/usr/share/applications/lshw-gtk.desktop + cp $(CURDIR)/debian/patches/logo.svg $(CURDIR)/debian/lshw-gtk/usr/share/pixmaps/lshw-gtk.svg + chmod 644 $(CURDIR)/debian/lshw/usr/share/locale/fr/LC_MESSAGES/lshw.mo + +# Build architecture-independent files here. +binary-indep: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installmenu + dh_installcron + dh_installman + dh_installinfo + dh_installchangelogs + dh_link + dh_strip + dh_compress + dh_fixperms + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installexamples + dh_installmenu + dh_installcron + dh_installman + dh_installinfo + dh_installchangelogs + dh_link + dh_strip + dh_compress + dh_fixperms + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure patch unpatch --- lshw-02.18.orig/debian/watch +++ lshw-02.18/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://ezix.org/software/files/ lshw-B.([\d.]*).tar.gz debian uupdate \ No newline at end of file