blob: ee27fc85006ebf3d457ecd89d1991470bcacfeb7 [file] [log] [blame]
From 06f2d36f5e7b7f48d85f93da974816d5b25dfaf1 Mon Sep 17 00:00:00 2001
From: Prachi Gupta <pragupta@us.ibm.com>
Date: Tue, 29 Nov 2016 09:46:43 -0600
Subject: [PATCH 1/4] processMrw: fixes to work with latest witherspoon.xml
- Fix logic to find lpc bus under the bmc target
- Updated I2C_BUS_SPEED_ARRAY to be 4x4
- Fixed XBUS HUID
- Update all BAR attributes
Change-Id: I82dcf21e28f77bcd1fb2391a5bd40d8ce1a6b172
---
src/usr/targeting/common/Targets.pm | 81 +++++++++++++++++++--
src/usr/targeting/common/processMrw.pl | 83 ++++++++++++----------
.../targeting/common/xmltohb/attribute_types.xml | 2 +-
.../targeting/common/xmltohb/target_types_hb.xml | 4 +-
4 files changed, 123 insertions(+), 47 deletions(-)
diff --git a/src/usr/targeting/common/Targets.pm b/src/usr/targeting/common/Targets.pm
index fc18675..42780dd 100644
--- a/src/usr/targeting/common/Targets.pm
+++ b/src/usr/targeting/common/Targets.pm
@@ -123,7 +123,8 @@ sub loadXML
print "Loading MRW XML: $filename\n";
$self->{xml} =
XMLin($filename,forcearray => [ 'child_id', 'hidden_child_id', 'bus',
- 'property', 'field', 'attribute' ]);
+ 'property', 'field', 'attribute',
+ 'enumerator' ]);
if (defined($self->{xml}->{'enumerationTypes'}))
{
@@ -462,7 +463,6 @@ sub buildHierarchy
{
$baseptr = $self->{xml}->{'targetInstances'}->{'targetInstance'};
}
-
if ($target eq "")
{
## find system target
@@ -816,7 +816,11 @@ sub setCommonAttrForChiplet
my $fapi_name = getFapiName($tgt_type, $node, $proc, $pos);
- $self->{huid_idx}->{$tgt_type} = $pos;
+ if ($tgt_type ne "XBUS")
+ {
+ $self->{huid_idx}->{$tgt_type} = $pos;
+ }
+
$self->setHuid($target, $sys, $node);
$self->setAttribute($target, "FAPI_NAME", $fapi_name);
$self->setAttribute($target, "PHYS_PATH", $physical_path);
@@ -1332,16 +1336,16 @@ sub findConnections
my $target = shift;
my $bus_type = shift;
my $end_type = shift;
+
my %connections;
my $num=0;
my $target_children = $self->getTargetChildren($target);
-
if ($target_children eq "")
{
return "";
}
- foreach my $child (@{ $self->getTargetChildren($target) })
+ foreach my $child ($self->getAllTargetChildren($target))
{
my $child_bus_type = $self->getBusType($child);
if ($child_bus_type eq $bus_type)
@@ -1353,7 +1357,6 @@ sub findConnections
my $type = $self->getMrwType($dest_parent);
my $dest_type = $self->getType($dest_parent);
my $dest_class = $self->getAttribute($dest_parent,"CLASS");
-
if ($type eq "NA")
{
$type = $dest_type;
@@ -1361,6 +1364,29 @@ sub findConnections
if ($type eq "NA") {
$type = $dest_class;
}
+
+ if ($end_type ne "") {
+ #Look for an end_type match on any ancestor, as
+ #connections may have a destination unit with a hierarchy
+ #like unit->pingroup->muxgroup->chip where the chip has
+ #the interesting type.
+ while ($type ne $end_type) {
+
+ $dest_parent = $self->getTargetParent($dest_parent);
+ if ($dest_parent eq "") {
+ last;
+ }
+
+ $type = $self->getMrwType($dest_parent);
+ if ($type eq "NA") {
+ $type = $self->getType($dest_parent);
+ }
+ if ($type eq "NA") {
+ $type = $self->getAttribute($dest_parent, "CLASS");
+ }
+ }
+ }
+
if ($type eq $end_type || $end_type eq "")
{
$connections{CONN}[$num]{SOURCE}=$child;
@@ -1554,6 +1580,22 @@ sub renameAttribute
return 0;
}
+## remove an attribute from a target
+sub removeAttribute
+{
+ my $self = shift;
+ my $target = shift;
+ my $attribute = shift;
+
+ my $target_ptr = $self->{data}->{TARGETS}->{$target};
+ if (!defined($target_ptr->{ATTRIBUTES}->{$attribute}))
+ {
+ return 1;
+ }
+ delete($target_ptr->{ATTRIBUTES}->{$attribute});
+ $self->log($target, "Removing attribute: $attribute");
+}
+
## copy an attribute between targets
sub copyAttribute
{
@@ -1589,7 +1631,6 @@ sub setAttributeField
my $value = shift;
$self->{data}->{TARGETS}->{$target}->{ATTRIBUTES}->{$attribute}->{default}
->{field}->{$field}->{value} = $value;
-
$self->log($target, "Setting Attribute: $attribute ($field) =$value");
}
## returns complex attribute value
@@ -1652,6 +1693,27 @@ sub getTargetChildren
return $target_ptr->{CHILDREN};
}
+## returns an array of all child (including grandchildren) target names
+sub getAllTargetChildren
+{
+ my $self = shift;
+ my $target = shift;
+ my @children;
+
+ my $targets = $self->getTargetChildren($target);
+ if ($targets ne "")
+ {
+ for my $child (@$targets)
+ {
+ push @children, $child;
+ my @more = $self->getAllTargetChildren($child);
+ push @children, @more;
+ }
+ }
+
+ return @children;
+}
+
sub getEnumValue
{
my $self = shift;
@@ -1964,6 +2026,11 @@ C<INDEX>.
Returns an array of target strings representing all the children of target
C<TARGET_STRING>.
+=item getAllTargetChildren(C<TARGET_STRING>)
+
+Returns an array of target strings representing all the children of target
+C<TARGET_STRING>, including grandchildren and below as well.
+
=item getEnumValue(C<ENUM_TYPE>,C<ENUM_NAME>)
Returns the enum value of type C<ENUM_TYPE> and name C<ENUM_NAME>. The
diff --git a/src/usr/targeting/common/processMrw.pl b/src/usr/targeting/common/processMrw.pl
index f898500..312582d 100644
--- a/src/usr/targeting/common/processMrw.pl
+++ b/src/usr/targeting/common/processMrw.pl
@@ -112,7 +112,7 @@ foreach my $target (sort keys %{ $targetObj->getAllTargets() })
processApss($targetObj, $target);
}
- processIpmiSensors($targetObj,$target);
+ #processIpmiSensors($targetObj,$target);
}
## check topology
@@ -427,16 +427,6 @@ sub processProcessor
$targetObj->getTargetParent($target);
$targetObj->copyAttribute($module_target,$target,"LOCATION_CODE");
- ## Copy all attributes from module
- foreach my $attr (sort (keys
- %{ $targetObj->getTarget($module_target)->{TARGET}->{attribute} }))
- {
- if (($attr ne "TYPE") && ($attr ne "PHYS_PATH"))
- {
- $targetObj->copyAttribute($module_target,$target,$attr);
- }
- }
-
## Copy PCIE attributes from socket
## Copy Position attribute from socket
foreach my $attr (sort (keys
@@ -453,7 +443,7 @@ sub processProcessor
}
$targetObj->log($target,"Finding master proc");
- my $lpcs=$targetObj->findConnections($target,"LPC","FSP");
+ my $lpcs=$targetObj->findConnections($target,"LPC","BMC");
if ($lpcs ne "")
{
$targetObj->log ($target, "Setting master proc to $target");
@@ -522,9 +512,9 @@ sub processProcessor
{
$targetObj->setAttributeField($target, "FSI_OPTION_FLAGS", "reserved",
"0");
- $targetObj->setAttribute($target, "FSI_MASTER_CHIP", "physical:sys");
+ $targetObj->setAttribute($target, "FSI_MASTER_CHIP", "physical:sys-0");
$targetObj->setAttribute($target, "FSI_MASTER_PORT", "0xFF");
- $targetObj->setAttribute($target, "ALTFSI_MASTER_CHIP", "physical:sys");
+ $targetObj->setAttribute($target, "ALTFSI_MASTER_CHIP", "physical:sys-0");
$targetObj->setAttribute($target, "ALTFSI_MASTER_PORT", "0xFF");
$targetObj->setAttribute($target, "FSI_MASTER_TYPE", "NO_MASTER");
$targetObj->setAttribute($target, "FSI_SLAVE_CASCADE", "0");
@@ -534,6 +524,7 @@ sub processProcessor
{
$targetObj->setAttribute($target, "PROC_MASTER_TYPE",
"NOT_MASTER");
+ $targetObj->setAttribute($target, "ALTFSI_MASTER_CHIP", "physical:sys-0");
}
## Update bus speeds
processI2cSpeeds($targetObj,$target);
@@ -562,15 +553,19 @@ sub processI2cSpeeds
$bus_speeds[0][0] = $bus_speeds2[0];
$bus_speeds[0][1] = $bus_speeds2[1];
$bus_speeds[0][2] = $bus_speeds2[2];
- $bus_speeds[1][0] = $bus_speeds2[3];
- $bus_speeds[1][1] = $bus_speeds2[4];
- $bus_speeds[1][2] = $bus_speeds2[5];
- $bus_speeds[2][0] = $bus_speeds2[6];
- $bus_speeds[2][1] = $bus_speeds2[7];
- $bus_speeds[2][2] = $bus_speeds2[8];
- $bus_speeds[3][0] = $bus_speeds2[9];
- $bus_speeds[3][1] = $bus_speeds2[10];
- $bus_speeds[3][2] = $bus_speeds2[11];
+ $bus_speeds[0][3] = $bus_speeds2[3];
+ $bus_speeds[1][0] = $bus_speeds2[4];
+ $bus_speeds[1][1] = $bus_speeds2[5];
+ $bus_speeds[1][2] = $bus_speeds2[6];
+ $bus_speeds[1][3] = $bus_speeds2[7];
+ $bus_speeds[2][0] = $bus_speeds2[8];
+ $bus_speeds[2][1] = $bus_speeds2[9];
+ $bus_speeds[2][2] = $bus_speeds2[10];
+ $bus_speeds[2][3] = $bus_speeds2[11];
+ $bus_speeds[3][0] = $bus_speeds2[12];
+ $bus_speeds[3][1] = $bus_speeds2[13];
+ $bus_speeds[3][2] = $bus_speeds2[14];
+ $bus_speeds[3][3] = $bus_speeds2[15];
my $i2cs=$targetObj->findConnections($target,"I2C","");
if ($i2cs ne "") {
@@ -581,13 +576,11 @@ sub processI2cSpeeds
my $bus_speed=$targetObj->getBusAttribute(
$i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_SPEED");
- #@todo RTC:164224 > currently the bus_speed fields are empty in the xml
-=begin
if ($bus_speed eq "" || $bus_speed==0) {
print "ERROR: I2C bus speed not defined for $i2c->{SOURCE}\n";
$targetObj->myExit(3);
}
-=cut
+
## choose lowest bus speed
if ($bus_speeds[$engine][$port] eq "" ||
$bus_speeds[$engine][$port]==0 ||
@@ -599,15 +592,19 @@ sub processI2cSpeeds
$bus_speed_attr = $bus_speeds[0][0].",".
$bus_speeds[0][1].",".
$bus_speeds[0][2].",".
+ $bus_speeds[0][3].",".
$bus_speeds[1][0].",".
$bus_speeds[1][1].",".
$bus_speeds[1][2].",".
+ $bus_speeds[1][3].",".
$bus_speeds[2][0].",".
$bus_speeds[2][1].",".
$bus_speeds[2][2].",".
+ $bus_speeds[2][3].",".
$bus_speeds[3][0].",".
$bus_speeds[3][1].",".
- $bus_speeds[3][2];
+ $bus_speeds[3][2].",".
+ $bus_speeds[3][3];
$targetObj->setAttribute($target,"I2C_BUS_SPEED_ARRAY",$bus_speed_attr);
}
@@ -626,16 +623,28 @@ sub setupBars
my $proc = $targetObj->getAttribute($target, "FABRIC_CHIP_ID");
$targetObj->{TOPOLOGY}->{$group}->{$proc}++;
- my @bars=("FSP_BASE_ADDR","PSI_BRIDGE_BASE_ADDR",
- "INTP_BASE_ADDR","PHB_MMIO_ADDRS_64","PHB_MMIO_ADDRS_32",
- "PHB_XIVE_ESB_ADDRS","PHB_REG_ADDRS","XIVE_ROUTING_ESB_ADDR",
- "XIVE_ROUTING_END_ADDR","XIVE_PRESENTATION_NVT_ADDR",
- "VAS_HYPERVISOR_WINDOW_CONTEXT_ADDR",
- "VAS_USER_WINDOW_CONTEXT_ADDR","LPC_BUS_ADDR",
- "NVIDIA_NPU_PRIVILEGED_ADDR","NVIDIA_NPU_USER_REG_ADDR",
- "NVIDIA_PHY0_REG_ADDR","NVIDIA_PHY1_REG_ADDR",
- "XIVE_CONTROLLER_BAR_ADDR","XIVE_PRESENTATION_BAR_ADDR",
- "NX_RNG_ADDR");
+ my @bars=( "FSP_BASE_ADDR", #
+ "PSI_BRIDGE_BASE_ADDR", #
+ "INTP_BASE_ADDR",
+ "PHB_MMIO_ADDRS_64", #
+ "PHB_MMIO_ADDRS_32", #
+ "PHB_XIVE_ESB_ADDRS", #
+ "PHB_REG_ADDRS", #
+ "XIVE_ROUTING_ESB_ADDR", #
+ "XIVE_ROUTING_END_ADDR", #
+ "XIVE_PRESENTATION_NVT_ADDR", #
+ "VAS_HYPERVISOR_WINDOW_CONTEXT_ADDR", #
+ "VAS_USER_WINDOW_CONTEXT_ADDR", #
+ "LPC_BUS_ADDR", #
+ "NVIDIA_NPU_PRIVILEGED_ADDR", #
+ "NVIDIA_NPU_USER_REG_ADDR", #
+ "NVIDIA_PHY0_REG_ADDR", #
+ "NVIDIA_PHY1_REG_ADDR", #
+ "PSI_HB_ESB_ADDR", #
+ "XIVE_CONTROLLER_BAR_ADDR", #
+ "XIVE_PRESENTATION_BAR_ADDR", #
+ "XSCOM_BASE_ADDRESS", #
+ "NX_RNG_ADDR"); #
# Attribute only valid in naples-based systems
if (!$targetObj->isBadAttribute($target,"NPU_MMIO_BAR_BASE_ADDR") ) {
diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml
index 9fce73d..70342c5 100644
--- a/src/usr/targeting/common/xmltohb/attribute_types.xml
+++ b/src/usr/targeting/common/xmltohb/attribute_types.xml
@@ -15548,7 +15548,7 @@ Measured in GB</description>
<attribute>
<id>REDUNDANT_CLOCKS</id>
<description>
      1 = System has redundant clock oscillators
+ 1 = System has redundant clock oscillators
0 = System does not have redundant clock oscillators
From the Machine Readable Workbook
</description>
diff --git a/src/usr/targeting/common/xmltohb/target_types_hb.xml b/src/usr/targeting/common/xmltohb/target_types_hb.xml
index aa941be..4e2447d 100755
--- a/src/usr/targeting/common/xmltohb/target_types_hb.xml
+++ b/src/usr/targeting/common/xmltohb/target_types_hb.xml
@@ -258,10 +258,10 @@
<attribute><id>VPD_SWITCHES</id></attribute>
</targetTypeExtension>
-<targetType>
+<targetTypeExtension>
<id>unit-xbus-nimbus</id>
<attribute><id>HB_TARGET_SCOMABLE</id></attribute>
-</targetType>
+</targetTypeExtension>
<targetTypeExtension>
<id>occ</id>
--
1.8.2.2