summaryrefslogtreecommitdiffstats
path: root/src/usr/targeting
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/targeting')
-rw-r--r--src/usr/targeting/common/Targets.pm69
-rwxr-xr-xsrc/usr/targeting/common/filter_out_unwanted_attributes.pl212
-rwxr-xr-xsrc/usr/targeting/common/processMrw.pl44
3 files changed, 255 insertions, 70 deletions
diff --git a/src/usr/targeting/common/Targets.pm b/src/usr/targeting/common/Targets.pm
index f7f707660..091154116 100644
--- a/src/usr/targeting/common/Targets.pm
+++ b/src/usr/targeting/common/Targets.pm
@@ -76,6 +76,7 @@ my %maxInstance = (
"MI" => 4,
"DMI" => 8,
"OCC" => 1,
+ "NV" => 6,
);
sub new
{
@@ -137,6 +138,7 @@ sub loadXML
{
my $self = shift;
my $filename = shift;
+
$XML::Simple::PREFERRED_PARSER = 'XML::Parser';
print "Loading MRW XML: $filename\n";
$self->{xml} =
@@ -165,6 +167,7 @@ sub printXML
my $self = shift;
my $fh = shift;
my $t = shift;
+ my $build= shift;
my $atTop = 0;
if ($t eq "top")
@@ -182,13 +185,13 @@ sub printXML
{
if (ref($t->[$p]) ne "HASH") { next; }
my $target = $t->[$p]->{KEY};
- $self->printTarget($fh, $target);
+ $self->printTarget($fh, $target, $build);
my $children = $t->[$p];
foreach my $u (sort(keys %{$children}))
{
if ($u ne "KEY")
{
- $self->printXML($fh, $t->[$p]->{$u});
+ $self->printXML($fh, $t->[$p]->{$u}, $build);
}
}
}
@@ -203,6 +206,7 @@ sub printTarget
my $self = shift;
my $fh = shift;
my $target = shift;
+ my $build = shift;
my $target_ptr = $self->getTarget($target);
@@ -224,7 +228,7 @@ sub printTarget
## get attributes
foreach my $attr (sort (keys %{ $target_ptr->{ATTRIBUTES} }))
{
- $self->printAttribute($fh, $target_ptr->{ATTRIBUTES}, $attr);
+ $self->printAttribute($fh, $target_ptr->{ATTRIBUTES}, $attr, $build);
}
print $fh "</targetInstance>\n";
}
@@ -235,6 +239,7 @@ sub printAttribute
my $fh = shift;
my $target_ptr = shift;
my $attribute = shift;
+ my $build = shift;
my $r = "";
# TODO RTC: TBD
@@ -246,7 +251,11 @@ sub printAttribute
{
return;
}
- print $fh "\t<attribute>\n";
+ if ( $build eq "fsp" && ($attribute eq "INSTANCE_PATH" || $attribute eq "PEER_HUID"))
+ {
+ print $fh "\t<compileAttribute>\n";
+ }
+ else{ print $fh "\t<attribute>\n";}
print $fh "\t\t<id>$attribute</id>\n";
my $value = $target_ptr->{$attribute}->{default};
@@ -269,7 +278,11 @@ sub printAttribute
print $fh "\t\t<default>$value</default>\n";
}
}
- print $fh "\t</attribute>\n";
+ if ( $build eq "fsp" && ($attribute eq "INSTANCE_PATH" || $attribute eq "PEER_HUID"))
+ {
+ print $fh "\t</compileAttribute>\n";
+ }
+ else{ print $fh "\t</attribute>\n";}
}
## stores TYPE enumeration values which is used to generate HUIDs
@@ -406,7 +419,14 @@ sub buildHierarchy
}
else
{
- $self->setAttribute($key, $attribute, "");
+ if ($attribute eq "FSI_MASTER_CHIP" || $attribute eq "ALTFSI_MASTER_CHIP" )
+ {
+ $self->setAttribute($key, $attribute, "physical:sys-0");
+ }
+ else
+ {
+ $self->setAttribute($key, $attribute, "");
+ }
}
}
else
@@ -543,7 +563,7 @@ sub buildAffinity
#SYS target has PHYS_PATH and AFFINITY_PATH defined in the XML
#Also, there is no HUID for SYS
- $self->setAttribute($target,"FAPI_NAME",getFapiName($type));
+ $self->setAttribute($target,"FAPI_NAME",$self->getFapiName($type));
$self->setAttribute($target,"FAPI_POS", $sys_pos);
$self->setAttribute($target,"ORDINAL_ID", $sys_pos);
$sys_phys = $self->getAttribute($target, "PHYS_PATH");
@@ -561,7 +581,7 @@ sub buildAffinity
$self->{targeting}{SYS}[0]{NODES}[$node]{KEY} = $target;
$self->setHuid($target, $sys_pos, $node);
- $self->setAttribute($target, "FAPI_NAME",getFapiName($type));
+ $self->setAttribute($target, "FAPI_NAME",$self->getFapiName($type));
$self->setAttribute($target, "FAPI_POS", $pos);
$self->setAttribute($target, "PHYS_PATH", $node_phys);
$self->setAttribute($target, "AFFINITY_PATH", $node_aff);
@@ -578,8 +598,8 @@ sub buildAffinity
my $tpm_aff = $node_aff . "/tpm-$tpm";
- $self->setHuid($target, $sys_pos, $tpm);
- $self->setAttribute($target, "FAPI_NAME",getFapiName($type));
+ $self->setHuid($target, $sys_pos, $node);
+ $self->setAttribute($target, "FAPI_NAME",$self->getFapiName($type));
$self->setAttribute($target, "FAPI_POS", $pos);
$self->setAttribute($target, "PHYS_PATH", $tpm_phys);
$self->setAttribute($target, "AFFINITY_PATH", $tpm_aff);
@@ -594,7 +614,7 @@ sub buildAffinity
my $bmc_aff = $node_aff . "/bmc-$bmc";
$self->setHuid($target, $sys_pos, $bmc);
- $self->setAttribute($target, "FAPI_NAME",getFapiName($type));
+ $self->setAttribute($target, "FAPI_NAME",$self->getFapiName($type));
$self->setAttribute($target, "FAPI_POS", $pos);
$self->setAttribute($target, "PHYS_PATH", $bmc_phys);
$self->setAttribute($target, "AFFINITY_PATH", $bmc_aff);
@@ -660,7 +680,7 @@ sub buildAffinity
my $parent_affinity = $node_aff . "/proc-$proc";
my $parent_physical = $node_phys . "/proc-$proc";
- my $fapi_name = getFapiName($type, $node, $proc);
+ my $fapi_name = $self->getFapiName($type, $node, $proc);
$self->setHuid($target, $sys_pos, $node);
$self->setAttribute($target, "FAPI_NAME", $fapi_name);
@@ -791,8 +811,10 @@ sub iterateOverChiplets
#System XML has some sensor target as hidden children
#of targets. We don't care for sensors in this function
#So, we can avoid them with this conditional
- if ($unit_type ne "NA" && $unit_type ne "FSI" &&
- $unit_type ne "PCI")
+
+ if ($unit_type ne "PCI" && $unit_type ne "NA" &&
+ $unit_type ne "FSI" && $unit_type ne "PSI" &&
+ $unit_type ne "SYSREFCLKENDPT" && $unit_type ne "MFREFCLKENDPT")
{
#set common attrs for child
$self->setCommonAttrForChiplet($child, $sys, $node, $proc);
@@ -870,7 +892,7 @@ sub setCommonAttrForChiplet
my $affinity_path = $parent_affinity . "/" . lc $tgt_type ."-". $unit_pos;
my $physical_path = $parent_physical . "/" . lc $tgt_type ."-". $unit_pos;
- my $fapi_name = getFapiName($tgt_type, $node, $proc, $pos);
+ my $fapi_name = $self->getFapiName($tgt_type, $node, $proc, $pos);
#unique offset per system
my $offset = ($proc * $maxInstance{$tgt_type}) + $pos;
@@ -894,6 +916,7 @@ sub setCommonAttrForChiplet
sub getFapiName
{
+ my $self = shift;
my $target = shift;
my $node = shift;
my $chipPos = shift;
@@ -1115,7 +1138,7 @@ sub processDimms
$self->getAttribute($dimm,"REL_POS");
$self->setAttribute($dimm,"FAPI_NAME",
- getFapiName($type, $node, $dimm_pos));
+ $self->getFapiName($type, $node, $dimm_pos));
$self->setAttribute($mcbist_target, "FAPI_POS", $mcbist_pos);
$self->setAttribute($mcs_target, "FAPI_POS", $mcs_pos);
@@ -1335,9 +1358,9 @@ sub setFsiAttributes
{
$self->setAttribute($target, "FSI_MASTER_TYPE","CMFSI");
}
- $self->setAttribute($target, "FSI_MASTER_CHIP","physical:sys");
+ $self->setAttribute($target, "FSI_MASTER_CHIP","physical:sys-0");
$self->setAttribute($target, "FSI_MASTER_PORT","0xFF");
- $self->setAttribute($target, "ALTFSI_MASTER_CHIP","physical:sys");
+ $self->setAttribute($target, "ALTFSI_MASTER_CHIP","physical:sys-0");
$self->setAttribute($target, "ALTFSI_MASTER_PORT","0xFF");
$self->setAttribute($target, "FSI_SLAVE_CASCADE", "0");
if ($cmfsi == 0)
@@ -1908,7 +1931,17 @@ sub setHuid
my $type = $self->getType($target);
my $type_id = $self->{enumeration}->{TYPE}->{$type};
+ if ($type eq "" || $type eq "NA")
+ {
+ if (defined ($self->getAttribute($target,"BUS_TYPE")))
+ {
+ $type = $self->getAttribute($target,"BUS_TYPE");
+ $type_id = $self->{enumeration}->{TYPE}->{$type};
+ if ($type_id eq "") {$type_id = $self->{enumeration}->{BUS_TYPE}->{$type};}
+ }
+ }
if ($type_id eq "") { $type_id = 0; }
+
if ($type_id == 0) { return; }
my $index = 0;
if (defined($self->{huid_idx}->{$type}))
diff --git a/src/usr/targeting/common/filter_out_unwanted_attributes.pl b/src/usr/targeting/common/filter_out_unwanted_attributes.pl
index df4d31c70..ce1cc97ec 100755
--- a/src/usr/targeting/common/filter_out_unwanted_attributes.pl
+++ b/src/usr/targeting/common/filter_out_unwanted_attributes.pl
@@ -70,23 +70,150 @@ sub usage
print "Any attribute not referenced in hostboot's target_types.xml\n";
print "are deleted from mrw xml.\n";
print "Usage: ./filter_out_unwanted_attributes.pl --mrw-xml [mrw xml]\\\n";
- print " --tgt-xml [target xml] <--tgt-xml [target xml]>\n";
+ print " --tgt-xml [common target xml] <--tgt-xml [platform target xml]>\n";
exit (-1);
}
-#Load all the target_type xmls
-my @tgt_xmls;
$XML::Simple::PREFERRED_PARSER = 'XML::Parser';
-foreach my $i (0 .. $#tgt_files)
+
+#Merge both the files to merge all extension target into target types and add
+#new target types which is coming from platform specific target
+open (FH, "<$tgt_files[0]") ||
+ die "ERROR: unable to open $tgt_files[0]\n";
+close (FH);
+
+open (FH, "<$tgt_files[1]") ||
+ die "ERROR: unable to open $tgt_files[1]\n";
+close (FH);
+
+
+my $fileCommon = XMLin("$tgt_files[0]");
+my $filePlatform = XMLin("$tgt_files[1]", ForceArray=>1);
+
+# This loop will fetch all targetTypeExtension from platform target types xml
+# and push it in an array "@NewAttr"
+my @NewAttr;
+foreach my $Extension ( @{$filePlatform->{targetTypeExtension}} )
{
- my $tgt_file = $tgt_files[$i];
- print "Loading TGT XML: $tgt_file in $i\n";
- $tgt_xmls[$i] =
- XMLin($tgt_file,
- forcearray => ['attribute', 'targetType', 'field', 'targetTypeExtension']);
+ my $id = $Extension->{id}->[0];
+ foreach my $attr ( @{$Extension->{attribute}} )
+ {
+ my $attribute_id = $attr->{id}->[0];
+ my $default = "";
+ if (exists $attr->{default})
+ {
+ $default = $attr->{default}->[0];
+ }
+ if (! exists $fileCommon->{targetType}->{$id}->{attribute}->{$attribute_id})
+ {
+ push @NewAttr, [ $id, $attribute_id, $default ];
+ }
+ }
+}
+
+# Pick up all new added targets which are platform specific fsp/hb, and push the
+# same into an array "@NewTargetType"
+my @NewTargetType;
+foreach my $newTarget ( @{$filePlatform->{targetType}} )
+{
+ my $targetId = $newTarget->{id}->[0];
+ push @NewTargetType, [$targetId, $newTarget];
+}
+
+#Create a new file from the common target types xml, over which
+#the new targets from platform target types xml will be merged,
+#then the extension targets will be merged over the existing one.
+
+my $file_name = 'merged_target_types.xml'; # Temporary File created for merger
+open (my $FILE, '>', $file_name );# To be updated by reading FH
+open (FH, "<$tgt_files[0]"); #To read out each line
+
+my $check = 0;
+my $id = "";
+my $endOfLine = 0;
+while (my $line = <FH>)
+{
+ if ( $line =~ /^\s*<targetType>.*/)
+ {
+ $check = 1;
+ }
+ elsif ($check == 1 && $line =~ /^\s*<id>/)
+ {
+ $check = 0;
+ $id = $line;
+ $id =~ s/\n//;
+ $id =~ s/.*<id>(.*)<\/id>.*/$1/;
+ }
+ elsif ($line =~ /^\s*<\/targetType>.*/)
+ {
+ for my $i ( 0 .. $#NewAttr )
+ {
+ if ($NewAttr[$i][0] eq $id)
+ {
+ print $FILE " <attribute>\n";
+ print $FILE " <id>$NewAttr[$i][1]</id>\n";
+ if ($NewAttr[$i][2] ne "")
+ {
+ print $FILE " <default>$NewAttr[$i][2]</default>\n";
+ }
+ print $FILE " </attribute>\n";
+ }
+ }
+ }
+ if ($line =~ /^\s*<\/attributes>.*/)
+ {
+ foreach my $newTarget (@NewTargetType)
+ {
+ print $FILE "<targetType>\n";
+ print $FILE " <id>$newTarget->[1]->{id}->[0]</id>\n";
+ print $FILE " <parent>$newTarget->[1]->{parent}->[0]</parent>\n";
+ foreach my $attrNewTarget ( @{$newTarget->[1]->{attribute}} )
+ {
+ print $FILE " <attribute>\n";
+ print $FILE " <id>$attrNewTarget->{id}->[0]</id>\n";
+ if (exists $attrNewTarget->{default})
+ {
+ if (ref($attrNewTarget->{default}->[0]) eq "HASH")
+ {
+ if(exists $attrNewTarget->{default}->[0]->{field})
+ {
+ print $FILE " <default>\n";
+ print $FILE " <field>\n";
+ foreach my $attrField ( @{$attrNewTarget->{default}->[0]->{field}} )
+ {
+ print $FILE " <id>$attrField->{id}->[0]</id><value>$attrField->{value}->[0]</value>\n";
+ }
+ print $FILE " </field>\n";
+ print $FILE " </default>\n";
+ }
+ }
+ else
+ {
+ print $FILE " <default>$attrNewTarget->{default}->[0]</default>\n";
+ }
+ }
+ print $FILE " </attribute>\n";
+ }
+ if(exists $newTarget->[1]->{fspOnly})
+ {
+ print $FILE " <fspOnly/>\n";
+ }
+ print $FILE "</targetType>\n";
+ }
+ }
+ print $FILE "$line";
}
+close (FH);
+close ($FILE);
+
+
+print "Loading Merged Targeting XML: $file_name\n";
+#Load all the merged (common & platform) target_type xml
+my $tgt_xmls = XMLin($file_name,
+ forcearray => ['attribute', 'targetType', 'field', 'targetTypeExtension']);
+
#Load MRW XML
#Using LibXML parser to parse mrw xml to keep the order of the input xml in the
#output xml. Simple parser doesn't keep the order of the input file, so, it's
@@ -99,19 +226,16 @@ my $mrw_parsed = $parser->parse_file($mrw_file);
print "The following target and attribute pairs are being removed from";
print " SYSTEM_hb.mrw.xml as they are not used by hostboot:\n";
-#foreach targetInstance
+#foreach targetInstance in the MRW file
foreach my $tgt
($mrw_parsed->findnodes('/attributes/targetInstance'))
{
- #get target type
my $tgt_type = $tgt->findnodes('./type');
#foreach attribute defined in this target
foreach my $attr ($tgt->findnodes('./attribute'))
{
- #get attribute id == attribute name
my $attr_id = $attr->findnodes('./id');
-
#findAttribute searches for this target and attribute
#pair in all the target type xmls
my $found = findAttribute($tgt_type, $attr_id);
@@ -119,9 +243,13 @@ foreach my $tgt
{
#if the attribute is not found in any of the target_type
#xmls, then remove it from the mrw xml
- print "Target: $tgt_type Attr: $attr_id\n";
+ print "Removing Attr: $attr_id from Target: $tgt_type \n";
$tgt->removeChild($attr);
}
+ else
+ {
+ print "Found Attr $attr_id for Target Type $tgt_type\n";
+ }
}
}
@@ -133,39 +261,22 @@ sub findAttribute
{
my $tgt = shift;
my $attr = shift;
- #foreach target type xml
- foreach my $i (0 .. $#tgt_xmls)
- {
- my $tgt_xml = $tgt_xmls[$i];
- my $targetType;
- if (defined $tgt_xml->{targetType})
- {
- $targetType = "targetType";
- }
- elsif (defined $tgt_xml->{targetTypeExtension})
- {
- $targetType = "targetTypeExtension";
- }
- else
- {
- next;
- }
+ my $targetType;
- if (defined $tgt_xml->{$targetType}{$tgt}{attribute}{$attr})
+ if (defined $tgt_xmls->{'targetType'}{$tgt}{attribute}{$attr})
+ {
+ #attribute found under the passed in target in this xml
+ return 1;
+ }
+ else
+ {
+ my %tgt_hash = %$tgt_xmls;
+ #if not found in this target, look under parent target
+ #some targets are inherrited
+ if (lookAtParentAttributes (\%tgt_hash, $tgt, $attr) eq 1)
{
- #attribute found under the passed in target in this xml
return 1;
}
- else
- {
- my %tgt_hash = %$tgt_xml;
- #if not found in this target, look under parent target
- #some targets are inherrited
- if (lookAtParentAttributes (\%tgt_hash, $tgt, $attr, $targetType) eq 1)
- {
- return 1;
- }
- }
}
return 0;
}
@@ -173,42 +284,43 @@ sub findAttribute
# sub - lookAtParentAttributes
# recursively looks for an attribute in current
# target's parent because some attributes are inherrited from parents
-# param[in]: tgt_xml - hash containing the entire target type xml
+# param[in]: tgt_xmls - hash containing the entire target type xml
# param[in]: tgt - look at the parent of this target
# param[in]: attr - attribute to look for
# retval: true == attr found, false == attr not found
sub lookAtParentAttributes
{
- my ($tgt_xml, $tgt, $attr, $targetType) = @_;
+ my ($tgt_xmls, $tgt, $attr) = @_;
- my $parent = $tgt_xml->{$targetType}{$tgt}{parent};
+ my $parent = $tgt_xmls->{'targetType'}{$tgt}{parent};
if ($parent eq "")
{
return 0;
}
elsif ($parent eq "base")
{
- return (defined $tgt_xml->{$targetType}{$parent}{attribute}{$attr}) ?
+ return (defined $tgt_xmls->{'targetType'}{$parent}{attribute}{$attr}) ?
1 : 0;
}
else
{
- if (defined $tgt_xml->{$targetType}{$parent}{attribute}{$attr})
+ if (defined $tgt_xmls->{'targetType'}{$parent}{attribute}{$attr})
{
return 1;
}
else
{
- my %tgt_hash = %$tgt_xml;
+ my %tgt_hash = %$tgt_xmls;
#attribute not found, maybe it is inherrited from the parent
#recursively look for the attribute in this target's parent
#We will look until we find the attribute, or there is no parent
#(parent == "") or we have reached the "base" target
#"base" is the topmost target defined in target_type xml
- return lookAtParentAttributes(\%tgt_hash, $parent, $attr, $targetType);
+ return lookAtParentAttributes(\%tgt_hash, $parent, $attr);
}
}
}
+
#OUTPUT
my $xml_fh;
my $filename = $mrw_file . ".updated";
diff --git a/src/usr/targeting/common/processMrw.pl b/src/usr/targeting/common/processMrw.pl
index 6523895a7..4bf640950 100755
--- a/src/usr/targeting/common/processMrw.pl
+++ b/src/usr/targeting/common/processMrw.pl
@@ -42,11 +42,13 @@ my $version = 0;
my $debug = 0;
my $report = 0;
my $sdr_file = "";
+my $build = "hb";
# TODO RTC:170860 - Remove this after dimm connector defines VDDR_ID
my $num_voltage_rails_per_proc = 1;
GetOptions(
+ "build=s" => \$build,
"f" => \$force, # numeric
"x=s" => \$serverwiz_file, # string
"d" => \$debug,
@@ -81,6 +83,13 @@ $targetObj->setVersion($VERSION);
my $xmldir = dirname($serverwiz_file);
$targetObj->loadXML($serverwiz_file);
+our %hwsvmrw_plugins;
+# FSP-specific functions
+if ($build eq "fsp")
+{
+ eval ("use processMrw_fsp; return 1;");
+ processMrw_fsp::return_plugins();
+}
my $str=sprintf(
" %30s | %10s | %6s | %4s | %9s | %4s | %4s | %4s | %10s | %s\n",
@@ -107,6 +116,10 @@ foreach my $target (sort keys %{ $targetObj->getAllTargets() })
elsif ($type eq "PROC")
{
processProcessor($targetObj, $target);
+ if ($build eq "fsp")
+ {
+ do_plugin("fsp_proc", $targetObj, $target);
+ }
}
elsif ($type eq "APSS")
{
@@ -120,6 +133,10 @@ foreach my $target (sort keys %{ $targetObj->getAllTargets() })
processIpmiSensors($targetObj,$target);
}
+if ($build eq "fsp")
+{
+ processMrw_fsp::loadFSP($targetObj);
+}
## check topology
foreach my $n (keys %{$targetObj->{TOPOLOGY}}) {
foreach my $p (keys %{$targetObj->{TOPOLOGY}->{$n}}) {
@@ -145,10 +162,17 @@ foreach my $target (keys %{ $targetObj->getAllTargets() })
#--------------------------------------------------
## write out final XML
my $xml_fh;
-my $filename = $xmldir . "/" . $targetObj->getSystemName() . "_hb.mrw.xml";
+my $filename;
+if ( $build eq "fsp" ){
+ $filename = $xmldir . "/" . $targetObj->getSystemName() . "_fsp.mrw.xml";
+}
+else{
+ $filename = $xmldir . "/" . $targetObj->getSystemName() . "_hb.mrw.xml";
+}
print "Creating XML: $filename\n";
open($xml_fh, ">$filename") || die "Unable to create: $filename";
-$targetObj->printXML($xml_fh, "top");
+
+$targetObj->printXML($xml_fh, "top", $build);
close $xml_fh;
if (!$targetObj->{errorsExist})
{
@@ -1951,3 +1975,19 @@ Options:
";
exit(1);
}
+################################################################################
+# utility function used to call plugins. if none exists, call is skipped.
+################################################################################
+
+sub do_plugin
+{
+ my $step = shift;
+ if (exists($hwsvmrw_plugins{$step}))
+ {
+ $hwsvmrw_plugins{$step}(@_);
+ }
+ elsif ($debug && ($build eq "fsp"))
+ {
+ print STDERR "build is $build but no plugin for $step\n";
+ }
+}
OpenPOWER on IntegriCloud