diff options
| author | nagurram-in <nagendra.g@in.ibm.com> | 2018-05-09 03:47:59 -0500 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-05-14 14:49:56 -0400 |
| commit | f3fd15c5b1231f80df25acb87e1da0da3c3bdb54 (patch) | |
| tree | bf1ec203e726c0d9f5be6414ee8137076f8672e3 /src/usr/hdat | |
| parent | b1771bfafee10eb48308457bab14f511394cf57d (diff) | |
| download | blackbird-hostboot-f3fd15c5b1231f80df25acb87e1da0da3c3bdb54.tar.gz blackbird-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>
Diffstat (limited to 'src/usr/hdat')
| -rw-r--r-- | src/usr/hdat/hdatutil.C | 47 |
1 files changed, 22 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++; } } |

