summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2016-12-21 15:09:39 -0600
committerMatt Spinler <spinler@us.ibm.com>2017-01-03 14:36:04 -0600
commiteff6a1998e1240e8c0bb80b7e773ce652a2166a4 (patch)
treee6d7b75ff1156f406bf6d44c4e90499fb8dc8124
parent306e4d1d2175ba62b955e402aa877fccc79147f9 (diff)
downloadphosphor-mrw-tools-eff6a1998e1240e8c0bb80b7e773ce652a2166a4.tar.gz
phosphor-mrw-tools-eff6a1998e1240e8c0bb80b7e773ce652a2166a4.zip
Add cores to the inventory
Change-Id: Ic600bfd95eba76744c99ccdc1c1300983a748212 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
-rw-r--r--Inventory.pm35
1 files changed, 34 insertions, 1 deletions
diff --git a/Inventory.pm b/Inventory.pm
index 4efc38b..b5d4144 100644
--- a/Inventory.pm
+++ b/Inventory.pm
@@ -4,7 +4,7 @@ use strict;
use warnings;
#Target types to always include in the inventory if present
-my %TYPES = (SYS => 1, NODE => 1, PROC => 1, BMC => 1, GPU => 1);
+my %TYPES = (SYS => 1, NODE => 1, PROC => 1, BMC => 1, GPU => 1, CORE => 1);
#RU_TYPES of cards to include
#FRU = field replaceable unit, CRU = customer replaceable unit
@@ -119,6 +119,9 @@ sub makeOBMCNames
#Don't need card segments for non-FRUs
removeNonFRUCardSegments($targetObj, $inventory);
+ #Don't need to show the middle units between proc & core
+ removeIntermediateUnits($targetObj, $inventory);
+
#Certain parts have standard naming
renameSegmentWithType("PROC", "cpu", $targetObj, $inventory);
renameSegmentWithType("SYS", "system", $targetObj, $inventory);
@@ -208,6 +211,34 @@ sub removeConnectors
}
+#Units, typically cores, can be subunits of other subunits of
+#their parent chip. We can remove all of these intermediate
+#units. For example, cpu0/someunit1/someunit2/core3 ->
+#cpu0/core3.
+sub removeIntermediateUnits
+{
+ my ($targetObj, $inventory) = @_;
+
+ for my $item (@$inventory) {
+
+ my $class = $targetObj->getAttribute($item->{TARGET}, "CLASS");
+ next unless ($class eq "UNIT");
+
+ my $parent = $targetObj->getTargetParent($item->{TARGET});
+
+ #Remove all of these intermediate units until we find
+ #something that isn't a unit (most likely a chip).
+ while ($targetObj->getAttribute($parent, "CLASS") eq "UNIT") {
+
+ my $name = $targetObj->getInstanceName($parent);
+ $item->{OBMC_NAME} =~ s/$name(-)*(\d+)*\///;
+
+ $parent = $targetObj->getTargetParent($parent);
+ }
+ }
+}
+
+
#Renames segments of the paths to the name passed in
#based on the type of the segment.
#For example:
@@ -367,6 +398,8 @@ The inventory contains:
=item * All targets of type PROC
+=item * All targets of type CORE
+
=item * All targets of type BMC
=item * All targets of type GPU
OpenPOWER on IntegriCloud