summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornagurram-in <nagendra.g@in.ibm.com>2018-05-09 03:47:59 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-05-14 14:49:56 -0400
commitf3fd15c5b1231f80df25acb87e1da0da3c3bdb54 (patch)
treebf1ec203e726c0d9f5be6414ee8137076f8672e3
parentb1771bfafee10eb48308457bab14f511394cf57d (diff)
downloadtalos-hostboot-f3fd15c5b1231f80df25acb87e1da0da3c3bdb54.tar.gz
talos-hostboot-f3fd15c5b1231f80df25acb87e1da0da3c3bdb54.zip
HDAT: New attribute LOCATION_CODE support for fru target
Change-Id: I06fa69a577b110fcf90f8cff7117ba3609c62432 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/58559 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r--src/usr/hdat/hdatutil.C47
-rw-r--r--src/usr/targeting/common/Targets.pm4
-rwxr-xr-xsrc/usr/targeting/common/xmltohb/attribute_types.xml12
-rw-r--r--src/usr/targeting/common/xmltohb/target_types.xml6
4 files changed, 44 insertions, 25 deletions
diff --git a/src/usr/hdat/hdatutil.C b/src/usr/hdat/hdatutil.C
index 63b6a3117..46b53818d 100644
--- a/src/usr/hdat/hdatutil.C
+++ b/src/usr/hdat/hdatutil.C
@@ -26,6 +26,7 @@
#include "hdatutil.H"
#include <i2c/eepromif.H>
#include <stdio.h>
+#include <string.h>
#include <p9_frequency_buckets.H>
#include <util/utilcommonattr.H>
@@ -458,12 +459,17 @@ void hdatGetLocationCode(TARGETING::Target *i_pFruTarget,
char *o_locCode)
{
TARGETING::ATTR_PHYS_PATH_type l_physPath;
+ TARGETING::ATTR_LOCATION_CODE_type l_locationCode;
char *l_pPhysPath;
char l_locCode[64] = {0};
-
-//@TODO:RTC 149347: Add methods to generate location codes
-
- if(i_pFruTarget->tryGetAttr<TARGETING::ATTR_PHYS_PATH>(l_physPath))
+
+
+ if(i_pFruTarget->tryGetAttr<TARGETING::ATTR_LOCATION_CODE>(l_locationCode)
+ && (strlen(l_locationCode) > 0))
+ {
+ sprintf(l_locCode, "%s-%s",i_locCodePrefix,l_locationCode);
+ }
+ else if(i_pFruTarget->tryGetAttr<TARGETING::ATTR_PHYS_PATH>(l_physPath))
{
char *l_cutString;
char *l_suffix;
@@ -480,31 +486,22 @@ void hdatGetLocationCode(TARGETING::Target *i_pFruTarget,
l_cutString = strchr(l_cutString+1, '/');
}
-#if USE_PHYS_PATH_FOR_LOC_CODE
-
- strncpy(l_hdatslcaentry.location_code,
- reinterpret_cast<const char *>
- (i_Target->getAttr<TARGETING::ATTR_PHYS_PATH>().toString()),
- l_hdatslcaentry.max_location_code_len);
-#else
-
sprintf(l_locCode, "%s-%s",i_locCodePrefix,(l_suffix+1));
-
- uint8_t l_index = 0;
- while(l_index < strlen(l_locCode))
- {
- if(l_locCode[l_index] != ' ')
- {
- *o_locCode++ = l_locCode[l_index];
- }
- l_index++;
- }
- // *o_locCode = 0;
-#endif
}
else
{
- HDAT_ERR("Error accessing ATTR_PHYS_PATH attribute");
+ HDAT_ERR("Error accessing ATTR_PHYS_PATH or ATTR_LOCATION_CODE attribute");
+ return;
+ }
+
+ uint8_t l_index = 0;
+ while(l_index < strlen(l_locCode))
+ {
+ if(l_locCode[l_index] != ' ')
+ {
+ *o_locCode++ = l_locCode[l_index];
+ }
+ l_index++;
}
}
diff --git a/src/usr/targeting/common/Targets.pm b/src/usr/targeting/common/Targets.pm
index 4ad61ed47..a61340fda 100644
--- a/src/usr/targeting/common/Targets.pm
+++ b/src/usr/targeting/common/Targets.pm
@@ -1288,6 +1288,9 @@ sub processDimms
my $proc_target = $self->getTargetParent($mcbist_target);
my $dimm_connector_tgt = $self->getTargetParent($dimm);
+ #Get the loc code from connector and update to dimm targ
+ my $loc_code = $self->getAttribute($dimm_connector_tgt,"LOCATION_CODE");
+
my $mca = $self->getAttribute($mca_target, "CHIP_UNIT")%2;
my $mcs = $self->getAttribute($mcs_target, "CHIP_UNIT")%2;
my $mcbist = $self->getAttribute($mcbist_target, "CHIP_UNIT");
@@ -1308,6 +1311,7 @@ sub processDimms
$self->setAttribute($dimm, "REL_POS", $port_num);
$self->setAttribute($dimm, "MBA_DIMM", $port_num); #which dimm
$self->setAttribute($dimm, "MBA_PORT", 0); #0, each MCA is a port
+ $self->setAttribute($dimm, "LOCATION_CODE",$loc_code);
## set all FAPI_POS
my $MCBIST_PER_CHIP = $self->{UNIT_COUNTS}->
diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml
index 3074a9b64..1d834d780 100755
--- a/src/usr/targeting/common/xmltohb/attribute_types.xml
+++ b/src/usr/targeting/common/xmltohb/attribute_types.xml
@@ -130,6 +130,18 @@
</attribute>
<attribute>
+ <description>Location code of the Fru target</description>
+ <id>LOCATION_CODE</id>
+ <simpleType>
+ <string>
+ <sizeInclNull>64</sizeInclNull>
+ </string>
+ </simpleType>
+ <persistency>non-volatile</persistency>
+ <readable></readable>
+ </attribute>
+
+ <attribute>
<description>Physical hierarchical path to the target</description>
<id>PHYS_PATH</id>
<nativeType>
diff --git a/src/usr/targeting/common/xmltohb/target_types.xml b/src/usr/targeting/common/xmltohb/target_types.xml
index 6f6ee3a90..c86f99606 100644
--- a/src/usr/targeting/common/xmltohb/target_types.xml
+++ b/src/usr/targeting/common/xmltohb/target_types.xml
@@ -276,6 +276,9 @@
<attribute>
<id>DISABLE_I2C_ENGINE2_PORT0_DIAG_MODE</id>
</attribute>
+ <attribute>
+ <id>LOCATION_CODE</id>
+ </attribute>
</targetType>
<targetType>
@@ -470,6 +473,9 @@
<default>CARD</default>
<id>CLASS</id>
</attribute>
+ <attribute>
+ <id>LOCATION_CODE</id>
+ </attribute>
</targetType>
<targetType>
OpenPOWER on IntegriCloud