summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Bakke <bbakke@us.ibm.com>2018-02-14 13:49:36 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-02-22 16:35:33 -0500
commit3403445e2f759b653bc08875aa1b27777b935ae0 (patch)
treea3f23869d8f4269ac600572d7b5b905ff071f841
parent3fbe556d9d69b8f4b7978f5b4053ca0bd9de9078 (diff)
downloadtalos-hostboot-3403445e2f759b653bc08875aa1b27777b935ae0.tar.gz
talos-hostboot-3403445e2f759b653bc08875aa1b27777b935ae0.zip
Fix and codify how system and node targets are handled by attribute overrides
This change adds support that allows the "chip type" and "chip unit type" parameters to preceed the "system string" parameter in a target line. The API is documented in attrTextToBinaryBlog.H and README.attr_override Change-Id: I850472102ae5f3907223ba1dc5d5d22d0a0da72f RTC: 187338 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/54061 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Matt Derksen <mderkse1@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: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r--src/usr/targeting/attroverride/README.attr_override142
-rwxr-xr-xsrc/usr/targeting/attroverride/attrTextToBinaryBlob.C160
-rwxr-xr-xsrc/usr/targeting/attroverride/attrTextToBinaryBlob.H42
3 files changed, 279 insertions, 65 deletions
diff --git a/src/usr/targeting/attroverride/README.attr_override b/src/usr/targeting/attroverride/README.attr_override
index da323e2c1..b87e5fddc 100644
--- a/src/usr/targeting/attroverride/README.attr_override
+++ b/src/usr/targeting/attroverride/README.attr_override
@@ -25,6 +25,90 @@ the user would like to override along with their new values.
ATTR_ATTRIBUTE_2 <datatype> <value in hex>
ATTR_ATTRIBUTE_3 <datatype> <value in hex> CONST
+###Target String Syntax:
+
+ <target string>
+ ** System Target Line Format **
+ <system string>
+
+ ** Unit Target Line Format **
+ <system string> || [:nz] ||
+ :<chip type> || [.<chip unit type>] ||
+ :<chip position> || [:<unit position>]
+
+ ** Unit Target Line Alternate Format**
+ <chip type> || [.<chip unit type>] ||
+ : <system string> || [:nz] ||
+ :<chip position> || [:<unit position>]
+
+
+ <system string>
+ *** System Target Line ***
+ kx:sy[:] note: x=0, y=0
+
+ note : additional obsolete forms have beeng grandfathered in:
+
+ blank note: interpreted as k0:s0
+ kx:nz:sy[:] note: x=0, y=0, z=0 or all
+
+ *** Unit Target Line ***
+ kx:sy[:] note: x=0, y=0
+
+ note : additional obsolete forms have beeng grandfathered in:
+
+ kx:nz:sy[:] note: x=0, y=0
+ z may be :
+ - single digit 0-9
+ - comma separated list of digits 0-9
+ -- 2 or more items in list
+ -- no ordering dependencies
+ e.g. 0,4
+ e.g. 5,3,9
+ - all
+
+ nz : optional node number term
+ z may be :
+ - single digit 0-9
+ - comma separated list of digits 0-9
+ -- 2 or more items in list
+ -- no ordering dependencies
+ e.g. 0,4
+ e.g. 5,3,9
+ - all
+
+ <chip type>
+ definitions :
+ src/usr/targeting/attroverride/attrTextToBinaryBlob.C
+ AttrOverrideSyncConstants::CHIP_TYPE_TARG_STR_TO_TYPE
+ e.g. p9n, pu, dimm
+
+ <chip unit type>
+ definitions :
+ src/usr/targeting/attroverride/attrTextToBinaryBlob.C
+ AttrOverrideSyncConstants::CHIP_UNIT_TYPE_TARG_STR_TO_TYPE
+ e.g. ex, mca, obus
+
+ <chip position>
+ pw
+ note : w may be :
+ - single number 0 - 65,534
+ - comma separated list of digits 0 - 65,534
+ -- 2 or more items in list
+ -- no ordering dependencies
+ e.g. 0,4
+ e.g. 5,3,9
+ - all
+
+ <unit position>
+ cv
+ note : v may be :
+ - single number 0 - 254
+ - comma separated list of digits 0 - 254
+ -- 2 or more items in list
+ -- no ordering dependencies
+ e.g. 0,4
+ e.g. 5,3,9
+ - all
####Examples
@@ -33,21 +117,21 @@ the user would like to override along with their new values.
CLEAR
- target = k0:n0:s0:
+ target = k0:s0
ATTR_SCRATCH_UINT8_1 0x12
ATTR_SCRATCH_UINT32_1 0x12345678
ATTR_SCRATCH_UINT64_1 0x8000000000000001 CONST
- target = k0:n0:s0:centaur:p06
+ target = k0:s0:n0:centaur:p06
ATTR_MSS_CACHE_ENABLE 0x0 CONST
- target = k0:n0:s0:centaur.mba:p06:c1
+ target = k0:s0:n0:centaur.mba:p06:c1
ATTR_MSS_FREQ 0x00000640 CONST
ATTR_MSS_VOLT_VDDR_MILLIVOLTS 0x00000546 CONST
ATTR_EFF_CEN_DRV_IMP_CNTL[0] OHM15 CONST
ATTR_EFF_CEN_DRV_IMP_CNTL[1] OHM15 CONST
- target = k0:n0:s0:centaur.mba:pall:call
+ target = k0:s0:n0:centaur.mba:pall:call
ATTR_MSS_DIMM_MFG_ID_CODE[0][0] 0x12345678
ATTR_MSS_DIMM_MFG_ID_CODE[0][1] 0x12345678
ATTR_MSS_DIMM_MFG_ID_CODE[1][0] 0x12345678
@@ -57,25 +141,24 @@ the user would like to override along with their new values.
#####Other target examples:
- System Target:
- - target
- - target = k0:n0:s0
- - target = k0:n0:s0:
+ - target = k0:s0
+ - target = k0:s0:
- DIMM Target
- - target = k0:n0:s0:dimm:p06
+ - target = k0:s0:n0:dimm:p06
- Multiple DIMM Targets
- - target = k0:n0:s0:dimm:p2,4
+ - target = k0:s0:n0:dimm:p2,4
- - All p8 chips
- - target = k0:n0:s0:p8:pall
+ - All p9 chips
+ - target = k0:s0:n0:p9:pall
- All MCS chiplets:
- - target = k0:n0:s0:p8.mcs:pall:call
+ - target = k0:s0:n0:p9.mcs:pall:call
- - Node number specified (Brazos only, for Tuleta, always use n0)
- - target = k0:n1:s0:dimm:p06
- - target = k0:nall:s0:dimm:p06
+ - Node number specified
+ - target = k0:s0:n1:dimm:p06
+ - target = k0:s0:nall:dimm:p06
###Rules:
@@ -86,36 +169,9 @@ the user would like to override along with their new values.
- You may want to have CLEAR as the first line of an overrides file to
clear all overrides before applying the new set.
- - Lines starting with "target = k0:n0:s0:" specify the target for all
+ - Lines starting with "target = k0:s0" specify the target for all
following attributes until the next target line.
- - The next part of the line specifies the target type
-
- - p8.ex (EX (core) unit takes chip position and unit position)
- - p8.mcs (MCS unit takes chip position and unit position)
- - p8.xbus (XBUS unit takes chip position and unit position)
- - p8.abus (ABUS unit takes chip position and unit position)
- - centaur.mba (MBA unit takes chip position and unit position)
- - centaur (takes chip position only)
- - p8 (takes chip position only)
- - dimm (takes dimm position only)
- - else system target is assumed
-
-
- - The next part of the line specifies the target position (for units
- this is the parent chip position)
-
- - :p0 or :p1 or :p1,3 or :p511 or :pall etc (note that 'all'
- specifies an override for all Targets of the specified type)
-
-
- - The next part of the line specified the target unit position (only
- applicable to targets)
-
- - :c0 or :c1 or :c1,2 or :call etc (note that 'all' specifies
- an override for all Targets of the specified type)
-
-
- Lines starting with "ATTR_" specify attribute overrides
- There are 2 or 3 columns, they must be separated by one or more
diff --git a/src/usr/targeting/attroverride/attrTextToBinaryBlob.C b/src/usr/targeting/attroverride/attrTextToBinaryBlob.C
index 7205ad854..eb8a923e7 100755
--- a/src/usr/targeting/attroverride/attrTextToBinaryBlob.C
+++ b/src/usr/targeting/attroverride/attrTextToBinaryBlob.C
@@ -596,7 +596,9 @@ bool AttrTextToBinaryBlob::attrFileTargetLineToData(
l_line = l_line.substr(0, l_nextWhiteSpacePos);
}
- // remove the single trailing colon
+ // if all that remains is a single ':' char
+ // then remove it and continue (e.g started with k0:s0:<blanks>)
+ // otherwise the ':' is part of a parameter term
if ( (l_line.size() == 1) &&
(l_line.substr(0, 1) == ":") )
{
@@ -604,7 +606,8 @@ bool AttrTextToBinaryBlob::attrFileTargetLineToData(
}
// Figure out the node number
- if (0 == l_line.find(TARGET_NODE_HEADER_STR))
+ size_t l_nPosn = l_line.find(TARGET_NODE_HEADER_STR);
+ if (0 == l_nPosn)
{
l_line = l_line.substr(strlen(TARGET_NODE_HEADER_STR));
@@ -675,7 +678,6 @@ bool AttrTextToBinaryBlob::attrFileTargetLineToData(
TargStrToType* chip_type_first = NULL;
TargStrToType* chip_type_last = NULL;
-
TargStrToType* item = NULL;
if( l_colon_pos != std::string::npos)
{
@@ -739,11 +741,20 @@ bool AttrTextToBinaryBlob::attrFileTargetLineToData(
l_sysTarget = true;
}
-
// For a non-system target,
// figure out the position and unit position
if (l_sysTarget == false)
{
+ if (l_nPosn == std::string::npos)
+ {
+ // missing n term, need to add a default label
+ o_targetLabels.push_back(l_label);
+ }
+ else
+ {
+ // (labels already exist)
+ }
+
// Figure out the target's position
if (0 == l_line.find(TARGET_POS_HEADER_STR))
{
@@ -1083,6 +1094,7 @@ bool AttrTextToBinaryBlob::convertTargLine( const std::string & i_line,
do
{
size_t l_kPosn = l_line.find( "k", 0);
+ size_t l_kColonPosn = l_line.find( ":k", 0);
size_t l_sPosn = l_line.find( ":s", 0);
if (l_line.find_first_not_of(" \t", 6) == std::string::npos)
@@ -1109,13 +1121,6 @@ bool AttrTextToBinaryBlob::convertTargLine( const std::string & i_line,
break;
}
- else if ( (l_sPosn == (l_kPosn + 2)) )
- {
- // kx:sy new format, no conversion needed
- o_convertedLine = i_line;
- break;
- }
-
else if ( l_kPosn > l_sPosn )
{
// out of order parms, cant convert
@@ -1128,6 +1133,123 @@ bool AttrTextToBinaryBlob::convertTargLine( const std::string & i_line,
break;
}
+ else if ( l_kColonPosn != std::string::npos )
+ {
+ // (a parameter preceeds k term)
+
+ size_t eqPos = l_line.find( "=", 0);
+
+ if (eqPos == std::string::npos)
+ {
+ // missing =, cant convert
+ o_convertedLine = i_line;
+ printf("convertTargLine : Error : "
+ "Missing = , cannot convert : %s \n",
+ o_convertedLine.c_str() );
+
+ l_rc = true;
+ break;
+ }
+
+ // preAmble may be <chiptype> || [.<chip unit type>] || :
+ size_t l_preAmbleStart = l_line.find_first_not_of(" \t", eqPos+1);
+
+ // remove trailing colon and prepend colon
+ size_t l_preAmbleLen = (l_kColonPosn - l_preAmbleStart);
+ std::string l_preAmble = ":" +
+ l_line.substr( l_preAmbleStart, l_preAmbleLen );
+
+ // k0:s0 term ( or k0:nz:s0 ) is next
+ size_t l_sysStrLen = (l_sPosn + 3) - (l_kColonPosn + 1);
+ std::string l_sysStr = l_line.substr( l_kColonPosn + 1,
+ l_sysStrLen );
+
+ std::string l_nStr;
+ l_nStr.clear();
+
+ // check for non standard k0:nz:s0 format
+ size_t l_nStart = l_sysStr.find(":n", 0);
+
+ if (l_nStart != std::string::npos)
+ {
+ // extract n term and compress system string
+ std::string l_nPrefix = l_sysStr.substr(0, l_nStart);
+
+ size_t l_nPost = l_sysStr.find(":", (l_nStart + 1));
+ std::string l_nPostfix;
+ l_nPostfix.clear();
+
+ if ( l_nPost != std::string::npos )
+ {
+ // extract n string & post fix
+ l_nStr = l_sysStr.substr(l_nStart, (l_nPost - l_nStart));
+ l_nPostfix = l_sysStr.substr( l_nPost, l_sysStr.size() );
+ }
+ else
+ {
+ // extract n string, no post fix
+ l_nStr = l_sysStr.substr(l_nStart, l_sysStr.size());
+ }
+
+ // rebuild the system string
+ l_sysStr = l_nPrefix + l_nPostfix + l_nStr;
+ l_nStr.clear();
+ } // end extract n term
+
+ std::string l_trlStr;
+ l_trlStr.clear();
+
+ // look for next term
+ size_t l_trlStart = l_line.find( ":", l_sPosn + 3);
+
+ if (l_trlStart != std::string::npos)
+ {
+ // step over optional :n term
+ if (l_line.substr( l_trlStart, 2) == ":n")
+ {
+ // locate the end of the n term
+ l_nStart = l_trlStart;
+ l_trlStart = l_line.find( ":", l_nStart + 1);
+
+ if ( l_trlStart != std::string::npos)
+ {
+ // create n and trl strings
+ l_nStr = l_line.substr( l_nStart,
+ (l_trlStart - l_nStart));
+
+ l_trlStr = l_line.substr( l_trlStart, l_line.size() );
+ }
+ else
+ {
+ // no trl string, create n string
+ l_nStr = l_line.substr( l_nStart, l_line.size() );
+ }
+ } // end step over n term
+ else
+ {
+ // no n string, create trl string
+ l_trlStr = l_line.substr( l_trlStart, l_line.size() );
+ }
+ } // end no trailer found
+
+ // assemble the converted line
+ o_convertedLine = ( "target = " + l_sysStr + l_nStr +
+ l_preAmble + l_trlStr );
+
+ printf("convertTargLine : Info : "
+ "Target Line converted to : %s \n",
+ o_convertedLine.c_str() );
+
+ break;
+ }
+
+ else if ( l_sPosn == (l_kPosn + 2) )
+ {
+ // kx:sy new format, no conversion needed
+ o_convertedLine = i_line;
+ break;
+ }
+
else
{
// (old format)
@@ -1136,6 +1258,9 @@ bool AttrTextToBinaryBlob::convertTargLine( const std::string & i_line,
// (old format, convert to new format. see header file)
// locate k & s term strings
+ // "overflow" is the position right after the term string
+ // and is the beginning of the next term string
+ // std::string::npos occurs when no "next" term string
size_t l_kPosn_overflow = l_line.find( ":", l_kPosn+1);
size_t l_kStrSize = (l_kPosn_overflow != std::string::npos) ?
(l_kPosn_overflow - l_kPosn) : (l_line.size() - l_kPosn);
@@ -1539,6 +1664,8 @@ AttrTextToBinaryBlob::TargetTypeRc
}
// Optional end Term exists, check n parm value(s)
+ // step over the k0:s0:n chars then isolate the
+ // size/value of the n parm
size_t l_nValStartPosn = 7;
size_t l_nValOverflowPosn = l_line.find( ":", l_nValStartPosn );
@@ -1725,9 +1852,11 @@ bool AttrTextToBinaryBlob::validateBinaryXlate( const uint8_t * i_buffer,
tank, pad, termLen );
printf("validateBinaryXlate: Attribute Hdr: "
- "ID = %.8X Target Type = %.8X Positon = %.4X "
- "Unit Position = %.2X node = %.1X flags = %.1X "
- "Parm Length = %.8X\n",
+ "ID = %.8X Target Type = %.8X \n"
+ " Positon = %.4X"
+ " Unit Position = %.2X node = %.1X \n"
+ " flags = %.1X"
+ " Parm Length = %.8X\n",
attrId, targetType, pos, unitPos, node, flags, valSize);
if // parm value exists
@@ -1823,6 +1952,9 @@ bool AttrTextToBinaryBlob::attrTextToBinaryBlob( std::ifstream& i_file,
l_attrString.clear();
l_attrLines.clear();
+ // line feed before "target" string
+ printf("\n");
+
do
{
// Read next line.
diff --git a/src/usr/targeting/attroverride/attrTextToBinaryBlob.H b/src/usr/targeting/attroverride/attrTextToBinaryBlob.H
index 9f1174315..ee12f61e6 100755
--- a/src/usr/targeting/attroverride/attrTextToBinaryBlob.H
+++ b/src/usr/targeting/attroverride/attrTextToBinaryBlob.H
@@ -74,12 +74,28 @@ namespace AttrTextToBinaryBlob
* ---------------------------------------
* The format of a Unit Target Line is :
*
- * <system string> || [:nz] || :<chip type> || [.<chip unit type>] ||
- * :<target position> || [:<unit position>]
+ * target = <system string> || [:nz] ||
+ * :<chip type> || [.<chip unit type>] ||
+ * :<chip position> || [:<unit position>]
*
- * note : x = 0
- * note : Y = 0
- * note : z may be :
+ * Examples:
+ * target = k0:s0:centaur:p06 // no optional fields
+ * target = k0:s0:n0:centaur.mba:p00:c0 // all optional fields
+ *
+ * ---- OR ----
+ * target = <chip type> || [.<chip unit type>] ||
+ * : <system string> || [:nz] ||
+ * :<chip position> || [:<unit position>]
+ *
+ * Examples:
+ * target = centaur:k0:s0:p06 // no optional fields
+ * target = centaur.mba:k0:s0:n0:p00:c0 // all optional fields
+ *
+ *
+ * <system string> is defined above; x=0, y=0
+ *
+ * nz : optional node number term
+ * z may be :
* - single digit 0-9
* - comma separated list of digits 0-9
* -- 2 or more items in list
@@ -88,7 +104,6 @@ namespace AttrTextToBinaryBlob
* e.g. 5,3,9
* - all
*
- *
* <chip type>
* definitions :
* src/usr/targeting/attroverride/attrTextToBinaryBlob.C
@@ -101,7 +116,7 @@ namespace AttrTextToBinaryBlob
* AttrOverrideSyncConstants::CHIP_UNIT_TYPE_TARG_STR_TO_TYPE
* e.g. ex, mca, obus
*
- * <target position>
+ * <chip position>
* pw
* note : w may be :
* - single number 0 - 65,534
@@ -168,6 +183,17 @@ namespace AttrTextToBinaryBlob
* target = k0:s0:n0,6,9:centaur.mba:p06:c1
* ATTR_MSS_FREQ 0x00000640 CONST
*
+ * ATTR_MSS_VOLT_VDDR_MILLIVOLTS 0x00000546 u32 CONST
+ *
+ * target = k0:s0:nall:p9:pall
+ * ATTR_VOLTAGE_EXT_VDD_BIAS_ULTRATURBO -5 CONST
+ *
+ * target = k0:s0:n4:centaur:p06
+ * ATTR_MSS_FREQ 0x00000345 CONST
+ *
+ * target = k0:s0:n0,6,9:centaur.mba:p06:c1
+ * ATTR_MSS_FREQ 0x00000640 CONST
+ *
*/
@@ -304,7 +330,7 @@ namespace AttrTextToBinaryBlob
* Structure for target's identification
*
* node Target Node Number
- * targetPos Target Position
+ * targetPos Target Position (chip position)
* unitPos Target Unit Position
*/
struct target_label
OpenPOWER on IntegriCloud