From ff36e79e80bcec5775601bf2f32be770117bc4c6 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 19 2015 16:05:11 +0000 Subject: import lshw-B.02.17-5.el7 --- diff --git a/SOURCES/0001-IBM-PowerNV.patch b/SOURCES/0001-IBM-PowerNV.patch new file mode 100644 index 0000000..7a67489 --- /dev/null +++ b/SOURCES/0001-IBM-PowerNV.patch @@ -0,0 +1,61 @@ +From bab358bdb88247e033f21b0155df3006535a18d6 Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Thu, 7 Aug 2014 22:01:02 +0000 +Subject: [PATCH 1/1] apply patch 2 of ticket #655: report IBM PowerNV hardware + model + +From: Dipankar Sarma + +Like x86, now IBM Power system allows the user to run Linux +on host (PowerNV - Power Non Virtualized) as well as guest +(PowerKVM guest, PowerVM LPAR). + +The IBM Power systems use OPAL firmware (https://github.com/open-power/skiboot) +on PowerNV mode which exposes system information to Linux +via device tree (/proc/device-tree). + +Device tree provided by OPAL is slightly different than Open +Firmware specification. + +lshw presently fetches device tree information according to the +Apple Open firmware format. + +Hence we need to detect if the platform is IBM Powernv, if true process +the information appropriately. + +Signed-off-by: Dipankar Sarma +Signed-off-by: Janani Venkataraman + + +git-svn-id: http://ezix.org/source/packages/lshw/development@2539 811e2811-9fd9-0310-a116-b6e8ac943c8b +--- + src/core/device-tree.cc | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc +index 809de7c..2938e1e 100644 +--- a/src/core/device-tree.cc ++++ b/src/core/device-tree.cc +@@ -529,9 +529,16 @@ bool scan_device_tree(hwNode & n) + n.setSerial(get_string(DEVICETREE "/system-id")); + fix_serial_number(n); + +- n.setVendor(get_string(DEVICETREE "/copyright", n.getVendor())); +- +- get_apple_model(n); ++ if (matches(get_string(DEVICETREE "/compatible"), "^ibm,powernv")) ++ { ++ n.setVendor(get_string(DEVICETREE "/vendor", "IBM")); ++ n.setDescription(get_string(DEVICETREE "/model-name")); ++ } ++ else ++ { ++ n.setVendor(get_string(DEVICETREE "/copyright", n.getVendor())); ++ get_apple_model(n); ++ } + + if (core) + { +-- +2.4.3 + diff --git a/SOURCES/0002-IBM-PowerNV.patch b/SOURCES/0002-IBM-PowerNV.patch new file mode 100644 index 0000000..306f4c2 --- /dev/null +++ b/SOURCES/0002-IBM-PowerNV.patch @@ -0,0 +1,133 @@ +From 368e26e023e2d19ffd1d973446f36130cf1ba0a1 Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Thu, 7 Aug 2014 22:15:58 +0000 +Subject: [PATCH 1/1] apply patch 5 of ticket #655: report IBM PowerNV memory + info + +From: Dipankar Sarma + +This patch adds support for listing memory hardware based on the +device tree exposed by OPAL firmware on IBM PowerNV platforms. + +We use this information available in device tree and make lshw list +the memory banks. + +We also add the location-code and part-number for the memory banks +listed. + +Signed-off-by: Dipankar Sarma +Signed-off-by: Janani Venkataraman + + + +git-svn-id: http://ezix.org/source/packages/lshw/development@2540 811e2811-9fd9-0310-a116-b6e8ac943c8b +--- + src/core/device-tree.cc | 73 +++++++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 62 insertions(+), 11 deletions(-) + +diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc +index 2938e1e..ca251bb 100644 +--- a/src/core/device-tree.cc ++++ b/src/core/device-tree.cc +@@ -9,6 +9,7 @@ + * + */ + ++#include + #include "version.h" + #include "device-tree.h" + #include "osutils.h" +@@ -283,6 +284,49 @@ static void scan_devtree_cpu(hwNode & core) + } + } + ++static void scan_devtree_memory_powernv(hwNode & core) ++{ ++ struct dirent **namelist; ++ hwNode *memory = core.getChild("memory"); ++ int n; ++ ++ pushd(DEVICETREE "/vpd"); ++ n = scandir(".", &namelist, selectdir, alphasort); ++ popd(); ++ if (n < 0) ++ return; ++ for (int i = 0; i < n; i++) ++ { ++ string basepath; ++ unsigned long size = 0; ++ string sizestr; ++ ++ if (strncmp(namelist[i]->d_name, "ms-dimm@", 8) == 0) ++ { ++ hwNode bank("bank", hw::memory); ++ ++ if (!memory) ++ memory = core.addChild(hwNode("memory", hw::memory)); ++ ++ basepath = string(DEVICETREE "/vpd/") + string(namelist[i]->d_name); ++ bank.setSerial(get_string(basepath + string("/serial-number"))); ++ bank.setProduct(get_string(basepath + string("/part-number")) + " FRU#" + get_string(basepath + string("/fru-number"))); ++ bank.setDescription(get_string(basepath + string("/description"))); ++ bank.setSlot(get_string(basepath + string("/ibm,loc-code"))); ++ sizestr = get_string(basepath + string("/size")); ++ errno = 0; ++ size = strtoul(sizestr.c_str(), NULL, 10); ++ if (!errno) ++ bank.setSize(size*1024*1024); ++ bank.addHint("icon", string("memory")); ++ ++ memory->addChild(bank); ++ } ++ free(namelist[i]); ++ } ++ free(namelist); ++} ++ + + static void scan_devtree_memory(hwNode & core) + { +@@ -532,22 +576,29 @@ bool scan_device_tree(hwNode & n) + if (matches(get_string(DEVICETREE "/compatible"), "^ibm,powernv")) + { + n.setVendor(get_string(DEVICETREE "/vendor", "IBM")); +- n.setDescription(get_string(DEVICETREE "/model-name")); ++ n.setProduct(get_string(DEVICETREE "/model-name")); ++ if (core) ++ { ++ core->addHint("icon", string("board")); ++ scan_devtree_root(*core); ++ scan_devtree_memory_powernv(*core); ++ scan_devtree_cpu(*core); ++ n.addCapability("powernv", "Non-virtualized"); ++ n.addCapability("opal", "OPAL firmware"); ++ } + } + else + { + n.setVendor(get_string(DEVICETREE "/copyright", n.getVendor())); + get_apple_model(n); +- } +- +- if (core) +- { +- core->addHint("icon", string("board")); +- scan_devtree_root(*core); +- scan_devtree_bootrom(*core); +- scan_devtree_memory(*core); +- scan_devtree_cpu(*core); +- core->addCapability(get_string(DEVICETREE "/compatible")); ++ if (core) ++ { ++ core->addHint("icon", string("board")); ++ scan_devtree_root(*core); ++ scan_devtree_bootrom(*core); ++ scan_devtree_memory(*core); ++ scan_devtree_cpu(*core); ++ } + } + + return true; +-- +2.4.3 + diff --git a/SOURCES/0003-IBM-PowerNV.patch b/SOURCES/0003-IBM-PowerNV.patch new file mode 100644 index 0000000..ca0f186 --- /dev/null +++ b/SOURCES/0003-IBM-PowerNV.patch @@ -0,0 +1,26 @@ +From fa74ac417db68e7788e46290743ff77e539903de Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Sat, 14 Feb 2015 10:28:25 +0000 +Subject: [PATCH 1/1] proper fix for #676 + +git-svn-id: http://ezix.org/source/packages/lshw/development@2573 811e2811-9fd9-0310-a116-b6e8ac943c8b +--- + src/core/hw.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/hw.cc b/src/core/hw.cc +index 4465c19..e2559ff 100644 +--- a/src/core/hw.cc ++++ b/src/core/hw.cc +@@ -622,7 +622,7 @@ hwNode *hwNode::getChild(const string & id) + } + + for (unsigned int i = 0; i < This->children.size(); i++) +- if (This->children[i].getId() == baseid) ++ if (This->children[i].getId() == cleanupId(baseid)) + { + if (path == "") + return &(This->children[i]); +-- +2.4.3 + diff --git a/SOURCES/0004-IBM-PowerNV.patch b/SOURCES/0004-IBM-PowerNV.patch new file mode 100644 index 0000000..156c93e --- /dev/null +++ b/SOURCES/0004-IBM-PowerNV.patch @@ -0,0 +1,141 @@ +From 2c84941819da11626ecaee1d2a10abc852cfff3d Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Sat, 9 May 2015 10:18:17 +0000 +Subject: [PATCH 1/1] update PowerPC device-tree memory detection (cf. #686) + +git-svn-id: http://ezix.org/source/packages/lshw/development@2576 811e2811-9fd9-0310-a116-b6e8ac943c8b +--- + src/core/device-tree.cc | 90 ++++++++++++++++++++++++++++++++++--------------- + 1 file changed, 63 insertions(+), 27 deletions(-) + +diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc +index 6d93ab8..0b3d814 100644 +--- a/src/core/device-tree.cc ++++ b/src/core/device-tree.cc +@@ -9,6 +9,7 @@ + * + */ + ++#include + #include + #include "version.h" + #include "device-tree.h" +@@ -35,6 +36,7 @@ struct dimminfo + }; + + #define DEVICETREE "/proc/device-tree" ++#define DEVICETREEVPD "/proc/device-tree/vpd/" + + static unsigned long get_long(const string & path) + { +@@ -284,46 +286,80 @@ static void scan_devtree_cpu(hwNode & core) + } + } + ++void add_memory_bank(string name, string path, hwNode & core) ++{ ++ struct dirent **dirlist; ++ string product; ++ int n; ++ ++ pushd(path + name); ++ if(name.substr(0, 7) == "ms-dimm") ++ { ++ replace(name.begin(), name.end(), '@', ':'); ++ 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(get_string("serial-number")); ++ ++ product = get_string("part-number"); ++ if(exists("fru-number")) ++ { ++ product += " FRU#" + get_string("fru-number"); ++ } ++ if(product != "") ++ bank.setProduct(product); ++ ++ if(exists("description")) ++ bank.setDescription(get_string("description")); ++ if(exists("ibm,loc-code")) ++ bank.setSlot(get_string("ibm,loc-code")); ++ if(unsigned long size = get_number("size")) ++ bank.setSize(size*1024*1024); ++ ++ memory->addChild(bank); ++ } ++ ++ n = scandir(".", &dirlist, selectdir, alphasort); ++ popd(); ++ ++ if (n < 0) ++ return; ++ ++ for (int i = 0; i < n; i++) ++ { ++ add_memory_bank(dirlist[i]->d_name, path + name + "/", core); ++ free(dirlist[i]); ++ } ++ free(dirlist); ++} ++ ++ + static void scan_devtree_memory_powernv(hwNode & core) + { + struct dirent **namelist; +- hwNode *memory = core.getChild("memory"); + int n; ++ string path = DEVICETREEVPD; + +- pushd(DEVICETREE "/vpd"); ++ pushd(DEVICETREEVPD); + n = scandir(".", &namelist, selectdir, alphasort); + popd(); ++ + if (n < 0) + return; ++ + for (int i = 0; i < n; i++) + { +- string basepath; +- unsigned long size = 0; +- string sizestr; +- +- if (strncmp(namelist[i]->d_name, "ms-dimm@", 8) == 0) +- { +- hwNode bank("bank", hw::memory); +- +- if (!memory) +- memory = core.addChild(hwNode("memory", hw::memory)); +- +- basepath = string(DEVICETREE "/vpd/") + string(namelist[i]->d_name); +- bank.setSerial(get_string(basepath + string("/serial-number"))); +- bank.setProduct(get_string(basepath + string("/part-number")) + " FRU#" + get_string(basepath + string("/fru-number"))); +- bank.setDescription(get_string(basepath + string("/description"))); +- bank.setSlot(get_string(basepath + string("/ibm,loc-code"))); +- sizestr = get_string(basepath + string("/size")); +- errno = 0; +- size = strtoul(sizestr.c_str(), NULL, 10); +- if (!errno) +- bank.setSize(size*1024*1024); +- bank.addHint("icon", string("memory")); +- +- memory->addChild(bank); +- } ++ add_memory_bank(namelist[i]->d_name, path, core); + free(namelist[i]); + } ++ + free(namelist); + } + +-- +2.4.3 + diff --git a/SPECS/lshw.spec b/SPECS/lshw.spec index 46f7f1f..7ac96b4 100644 --- a/SPECS/lshw.spec +++ b/SPECS/lshw.spec @@ -1,7 +1,7 @@ Summary: Hardware lister Name: lshw Version: B.02.17 -Release: 2%{?dist} +Release: 5%{?dist} License: GPLv2 Group: Applications/System URL: http://ezix.org/project/wiki/HardwareLiSter @@ -11,6 +11,10 @@ Source2: org.ezix.lshw.gui.policy Source3: lshw-gui Patch0: lshw-B.02.17-scan-fat-mem-bug.patch Patch1: no_smbios_unsupp.patch +Patch2: 0001-IBM-PowerNV.patch +Patch3: 0002-IBM-PowerNV.patch +Patch4: 0003-IBM-PowerNV.patch +Patch5: 0004-IBM-PowerNV.patch BuildRequires: sqlite-devel Requires: hwdata @@ -40,6 +44,10 @@ plain, XML or HTML format. %setup -q %patch0 -p0 %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 %build %{__make} %{?_smp_mflags} SBINDIR="%{_sbindir}" RPM_OPT_FLAGS="%{optflags}" SQLITE=1 gui @@ -109,6 +117,18 @@ rm -rf %{buildroot}%{_datadir}/locale/fr/ %{_datadir}/polkit-1/actions/org.ezix.lshw.gui.policy %changelog +* Mon Sep 14 2015 Petr Oros - B.02.17-5 +- Resolves: #1221933 +- Remove Trailing newline in 0004-IBM-PowerNV.patch + +* Tue Jun 30 2015 Petr Oros - B.02.17-4 +- Resolves: #1221933 +- Fix malformed patch for PowerNV/bare-metal + +* Tue Jun 30 2015 Petr Oros - B.02.17-3 +- Resolves: #1221933 +- Add power specific patches to RHEL7.2 for PowerNV/bare-metal + * Mon Dec 15 2014 Petr Oros - B.02.17-2 - Resolves: #1174195 - Don't look for SMBIOS structures on PowerPC and s390x systems