summaryrefslogtreecommitdiffstats
path: root/src/usr/targeting/xmltohb
diff options
context:
space:
mode:
authorNick Bofferding <bofferdn@us.ibm.com>2012-08-18 03:59:34 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-08-20 12:01:53 -0500
commitce4006ce81bddbfe93de586ae5011f80f6dfcf35 (patch)
tree6a905dd5946825634b836e740cdbfe2b35efda01 /src/usr/targeting/xmltohb
parentaa608a6fdaf7791a48f1b8a1c886525d9bd9cccb (diff)
downloadtalos-hostboot-ce4006ce81bddbfe93de586ae5011f80f6dfcf35.tar.gz
talos-hostboot-ce4006ce81bddbfe93de586ae5011f80f6dfcf35.zip
Fix DIMM instance path sort order
- Added DIMM instance path sort function to MRW parser - Fixed MRW parser bug where DIMM instances were not normalized correctly Change-Id: Ida107f76be62eb3fc9a30263f7f163bcb4bb5fe4 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1562 Tested-by: Jenkins Server Reviewed-by: Van H. Lee <vanlee@us.ibm.com> Reviewed-by: Andrea Y. Ma <ayma@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/targeting/xmltohb')
-rwxr-xr-xsrc/usr/targeting/xmltohb/genHwsvMrwXml.pl60
1 files changed, 42 insertions, 18 deletions
diff --git a/src/usr/targeting/xmltohb/genHwsvMrwXml.pl b/src/usr/targeting/xmltohb/genHwsvMrwXml.pl
index 84dd03c5c..03e6a89fc 100755
--- a/src/usr/targeting/xmltohb/genHwsvMrwXml.pl
+++ b/src/usr/targeting/xmltohb/genHwsvMrwXml.pl
@@ -47,6 +47,13 @@ use strict;
use XML::Simple;
use Data::Dumper;
+################################################################################
+# Set PREFERRED_PARSER to XML::Parser. Otherwise it uses XML::SAX which contains
+# bugs that result in XML parse errors that can be fixed by adjusting white-
+# space (i.e. parse errors that do not make sense).
+################################################################################
+$XML::Simple::PREFERRED_PARSER = 'XML::Parser';
+
my $mrwdir = "";
my $sysname = "";
my $usage = 0;
@@ -165,25 +172,13 @@ foreach my $i (@{$memBus->{'memory-bus'}})
$i->{dimm}->{'instance-path'}, $i->{'fsi-link'} ];
}
-# Sort physical DIMM order
-my @Memfields;
-my @SMembuses;
-for my $i ( 0 .. $#Membuses )
+# Sort the memory busses, based on their instance paths
+my @SMembuses = sort byDimmInstancePath @Membuses;
+
+# Rewrite each DIMM instance path's DIMM instance to be indexed from 0
+for my $i ( 0 .. $#SMembuses )
{
- for (my $j = 0; $j <= $#Membuses; $j++ )
- {
- my $k = $Membuses[$j][DIMM_PATH_FIELD];
- $k =~ s/.*dimm-(.*).*$/$1/;
- if ($k == $i)
- {
- for my $l ( 0 .. CFSI_LINK_FIELD )
- {
- $Memfields[$l] = $Membuses[$j][$l];
- }
- push @SMembuses, [ @Memfields ];
- $j = $#Membuses;
- }
- }
+ $SMembuses[$i][DIMM_PATH_FIELD] =~ s/[0-9]*$/$i/;
}
# Find master processor's node and proc. The FSP master is always connected to
@@ -473,6 +468,35 @@ exit 0;
########## Subroutines ##############
+################################################################################
+# Compares two MRW DIMM instance paths based only on the DIMM instance #
+################################################################################
+
+sub byDimmInstancePath ($$)
+{
+ # Operates on two DIMM instance paths, each in the form of:
+ # assembly-0/shilin-0/dimm-X
+ #
+ # Assumes that "X is always a decimal number, and that every DIMM in the
+ # system has a unique value of "X", including for multi-node systems and for
+ # systems whose DIMMs are contained on different parts of the system
+ # topology
+ #
+ # Note, in the path example above, the parts leading up to the dimm-X could
+ # be arbitrarily deep and have different types/instance values
+
+ # Get just the instance path for each supplied memory bus
+ my $lhsInstance = $_[0][DIMM_PATH_FIELD];
+ my $rhsInstance = $_[1][DIMM_PATH_FIELD];
+
+ # Replace each with just its DIMM instance value (a string)
+ $lhsInstance =~ s/.*-([0-9]*)$/$1/;
+ $rhsInstance =~ s/.*-([0-9]*)$/$1/;
+
+ # Convert each DIMM instance value string to int, and return comparison
+ return int($lhsInstance) <=> int($rhsInstance);
+}
+
sub generate_sys
{
my $proc_refclk = $policy->{'required-policy-settings'}->{'processor-refclock-frequency'}->{content};
OpenPOWER on IntegriCloud