summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/plat/fapiPlatTarget.C
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2013-10-04 16:26:37 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-10-10 13:02:54 -0500
commite650b34e1940043d342a39d5018867f172fb7f40 (patch)
treeed36b781ebbd3817cad373ecab1f08203fbe7eda /src/usr/hwpf/plat/fapiPlatTarget.C
parentae5f2aa9194b6f26893bfb21b1fc115d3cae0dcb (diff)
downloadtalos-hostboot-e650b34e1940043d342a39d5018867f172fb7f40.tar.gz
talos-hostboot-e650b34e1940043d342a39d5018867f172fb7f40.zip
FAPI Target to-ecmd-string. Display chiplet positions >=10 properly
Change-Id: I03ed05953c3b9d4ae5dd46b900a0c5e093c0f4d8 CQ: SW222946 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/6500 Reviewed-by: Brian H. Horton <brianh@linux.ibm.com> Tested-by: Jenkins Server Reviewed-by: Donald E. Dahle <dedahle@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/plat/fapiPlatTarget.C')
-rw-r--r--src/usr/hwpf/plat/fapiPlatTarget.C48
1 files changed, 22 insertions, 26 deletions
diff --git a/src/usr/hwpf/plat/fapiPlatTarget.C b/src/usr/hwpf/plat/fapiPlatTarget.C
index 01b4f03f7..46b06ba8d 100644
--- a/src/usr/hwpf/plat/fapiPlatTarget.C
+++ b/src/usr/hwpf/plat/fapiPlatTarget.C
@@ -96,14 +96,14 @@ const char * Target::toEcmdString() const
//******************************************************************************
void Target::toString(char (&o_ecmdString)[MAX_ECMD_STRING_LEN]) const
{
- // Extract the HostBoot target pointer
+ // Extract the Targeting target pointer
TARGETING::Target* l_pTarget =
reinterpret_cast<TARGETING::Target*>(iv_pHandle);
if (l_pTarget == NULL)
{
FAPI_ERR("toString: Called on NULL target");
- strcpy(o_ecmdString, "ecmd-no-target");
+ strcpy(o_ecmdString, "ecmd-no-target");
}
else
{
@@ -125,13 +125,12 @@ void Target::toString(char (&o_ecmdString)[MAX_ECMD_STRING_LEN]) const
// Chip: <chip> kX:nX:sX:pXX
// There is officially a tab character between ">" and "k", this is
// replaced with the number of spaces seen in the Cronus trace
- // If the k.. string is less than 18 chars, it is padded to 18 chars
- // and a single space is added
+ // If the k.. string is less than 19 chars, it is padded to 19 chars
//
// <chip> = chip type ("p8" = processor, "centaur" = memory buffer)
// <unit> = unit type ("ex", "mcs", "mba", "abus", "xbus")
// kX = cage number. Always zero
- // nX = node number. Always zero in HostBoot (right now)
+ // nX = node number. Always zero (right now)
// sX = slot number. Always zero
// pXX = chip position
// cX = unit position
@@ -150,6 +149,7 @@ void Target::toString(char (&o_ecmdString)[MAX_ECMD_STRING_LEN]) const
const char * const ECMD_CHIPLET_MBA = "mba ";
const char * const ECMD_CHIPLET_XBUS = "xbus ";
const char * const ECMD_CHIPLET_ABUS = "abus ";
+ const int K_STRING_LEN = 19;
// Look for a chip in the path
const char * l_pChipType = NULL;
@@ -241,37 +241,33 @@ void Target::toString(char (&o_ecmdString)[MAX_ECMD_STRING_LEN]) const
// Middle of the string
strcpy(l_pStr, "k0:n0:s0:p");
l_pStr += strlen("k0:n0:s0:p");
+ int l_kstringlen = strlen("k0:n0:s0:p");
- // Chip Pos (Note that %02d does not appear to work)
- if (l_chipPos >= 10)
- {
- sprintf(l_pStr, "%d", l_chipPos / 10);
- }
- else
- {
- *l_pStr = '0';
- }
- l_pStr++;
-
- sprintf(l_pStr, "%d", l_chipPos % 10);
- l_pStr++;
+ // Chip Pos.
+ int l_num = sprintf(l_pStr, "%02d", l_chipPos);
+ l_pStr += l_num;
+ l_kstringlen += l_num;
if (l_pChipletType != NULL)
{
// Chiplet Pos
strcpy(l_pStr, ":c");
l_pStr += strlen(":c");
- sprintf(l_pStr, "%d", l_chipletPos);
- l_pStr++;
-
- // Pad to 18 chars and add a space
- sprintf(l_pStr, " ");
+ l_kstringlen += strlen(":c");
+ int l_num = sprintf(l_pStr, "%d", l_chipletPos);
+ l_pStr += l_num;
+ l_kstringlen += l_num;
}
- else
+
+ // Pad the k-string to K_STRING_LEN characters
+ while (l_kstringlen < K_STRING_LEN)
{
- // Pad to 18 chars and add a space
- sprintf(l_pStr, " ");
+ *l_pStr = ' ';
+ l_pStr++;
+ l_kstringlen++;
}
+
+ *l_pStr = '\0';
}
}
else
OpenPOWER on IntegriCloud