Skip to content

Commit

Permalink
HDAT: New attribute LOCATION_CODE support for fru target
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
nagendraIBM authored and dcrowell77 committed May 14, 2018
1 parent b1771bf commit f3fd15c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 25 deletions.
47 changes: 22 additions & 25 deletions src/usr/hdat/hdatutil.C
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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;
Expand All @@ -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++;
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/usr/targeting/common/Targets.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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}->
Expand Down
12 changes: 12 additions & 0 deletions src/usr/targeting/common/xmltohb/attribute_types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@
</simpleType>
</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>
Expand Down
6 changes: 6 additions & 0 deletions src/usr/targeting/common/xmltohb/target_types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@
<attribute>
<id>DISABLE_I2C_ENGINE2_PORT0_DIAG_MODE</id>
</attribute>
<attribute>
<id>LOCATION_CODE</id>
</attribute>
</targetType>

<targetType>
Expand Down Expand Up @@ -470,6 +473,9 @@
<default>CARD</default>
<id>CLASS</id>
</attribute>
<attribute>
<id>LOCATION_CODE</id>
</attribute>
</targetType>

<targetType>
Expand Down

0 comments on commit f3fd15c

Please sign in to comment.