summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/procedures/hwp
diff options
context:
space:
mode:
authorSachin Gupta <sgupta2m@in.ibm.com>2016-12-15 13:49:39 -0500
committerChristian R. Geddes <crgeddes@us.ibm.com>2016-12-19 14:58:43 -0500
commit5dfd2d49d67da0da9e24c3d6550b726412a7b0c9 (patch)
treec6d6053aad28a193d3f4641aceb84427592fab48 /src/import/chips/p9/procedures/hwp
parente592c081ef64501070ea2964f3d953fc8f30eb29 (diff)
downloadtalos-hostboot-5dfd2d49d67da0da9e24c3d6550b726412a7b0c9.tar.gz
talos-hostboot-5dfd2d49d67da0da9e24c3d6550b726412a7b0c9.zip
Reverting RS4v3 changes
Revert "TOR reduction: Ditching DeltaRingLayout and RingLayout_t" This reverts commit 0ea8cddae37eb5186571e6c66469dad694de9c5a. Revert "Shrinking RS4 header" This reverts commit c1a7c86e800e8bb38f6549b443bb4801feb4f1e3. Change-Id: I7832e23491ea34f86db3cbdc5d25c98e3a9f1821 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33985 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com> Reviewed-by: Prachi Gupta <pragupta@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33992 Tested-by: Jenkins OP Build CI <op-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>
Diffstat (limited to 'src/import/chips/p9/procedures/hwp')
-rw-r--r--src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.C8
-rw-r--r--src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.H6
-rw-r--r--src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.C527
-rw-r--r--src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.H4
-rw-r--r--src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.mk1
-rw-r--r--src/import/chips/p9/procedures/hwp/customize/p9_xip_customize.C85
6 files changed, 226 insertions, 405 deletions
diff --git a/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.C b/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.C
index 8fa09557e..72f63f030 100644
--- a/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.C
+++ b/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.C
@@ -48,17 +48,17 @@ extern "C"
const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>
& i_fapiTarget,
const uint8_t i_chipletId,
- const uint8_t i_evenOdd,
+ const uint64_t i_evenOddMask,
const uint8_t i_ringId,
uint8_t* i_pRingBuf,
uint32_t& io_rRingBufsize )
{
fapi2::ReturnCode l_fapirc;
- FAPI_DBG("getMvpdRing: Called w/ringId=0x%x, chipletId=0x%x, evenOdd=0x%x, size=0x%x",
+ FAPI_DBG("getMvpdRing: Called w/ringId=0x%x, chipletId=0x%x, evenOddMask=0x%016llx, size=0x%x",
i_ringId,
i_chipletId,
- i_evenOdd,
+ i_evenOddMask,
io_rRingBufsize );
// common get and set processing
@@ -67,7 +67,7 @@ extern "C"
i_keyword,
i_fapiTarget,
i_chipletId,
- i_evenOdd,
+ i_evenOddMask,
i_ringId,
i_pRingBuf,
io_rRingBufsize );
diff --git a/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.H b/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.H
index 6fe70da71..622c11687 100644
--- a/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.H
+++ b/src/import/chips/p9/procedures/hwp/accessors/p9_get_mvpd_ring.H
@@ -65,7 +65,7 @@ extern "C"
* MVPD_RECORD_CP00 - MVPD_KEYWORD_PDG
* @param i_fapiTarget - cpu target
* @param i_chipletId - Chiplet ID
- * @param i_evenOdd - Even (0) or odd (1) EX. Disregarded for other chiplets.
+ * @param i_evenOddMask - Mask to choose even or odd EX. O for all other chiplets
* @param i_ringId - Ring ID
* @param i_pRingBuf - pointer to a buffer allocated by the caller
* to receive the ring header and data.
@@ -86,7 +86,7 @@ extern "C"
* caller does compression and decompression.
* Buffer: io_rRingBufsize returns xNN.
* byte x0 CompressedScanData structure (rs4 header)
- * byte x0C compressed data (sizeof CompressedScanData is 0x0C)
+ * byte x18 compressed data (sizeof CompressedScanData is 0x18)
* byte xNN last byte of compressed data
*
* @return fapi2::ReturnCode - FAPI_RC_SUCCESS if success,
@@ -97,7 +97,7 @@ extern "C"
const Target<TARGET_TYPE_PROC_CHIP>&
i_fapiTarget,
const uint8_t i_chipletId,
- const uint8_t i_evenOdd,
+ const uint64_t i_evenOddMask,
const uint8_t i_ringId,
uint8_t* io_pRingBuf,
uint32_t& io_rRingBufsize );
diff --git a/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.C b/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.C
index 527a63509..939ce2619 100644
--- a/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.C
+++ b/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.C
@@ -41,7 +41,6 @@
// pull in CompressedScanData def from proc_slw_build HWP
#include <p9_scan_compression.H>
#include <p9_ring_identification.H>
-#include <p9_ringId.H>
extern "C"
@@ -60,7 +59,7 @@ extern "C"
fapi2::MvpdRecord i_record,
fapi2::MvpdKeyword i_keyword,
const uint8_t i_chipletId,
- const uint8_t i_evenOdd,
+ const uint64_t i_evenOddMask,
const uint8_t i_ringId,
uint8_t* i_pRecordBuf,
uint32_t i_recordBufLenfapi,
@@ -165,9 +164,8 @@ extern "C"
* @param[in] i_chipletId
* Chiplet ID for the op
*
- * @param[in] i_evenOdd
- * Indicates whether to choose even (0) or odd (1) EX.
- * Undefined and to be disregarded for non-EX.
+ * @param[in] i_evenOddMask
+ * Mask to choose even or odd EX. O for all other chiplets
*
* @param[in] i_ringId
* Ring ID for the op
@@ -188,7 +186,7 @@ extern "C"
const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>
& i_fapiTarget,
const uint8_t i_chipletId,
- const uint8_t i_evenOdd,
+ const uint64_t i_evenOddMask,
const uint8_t i_ringId,
uint8_t* i_pRingBuf,
uint32_t& io_rRingBufsize )
@@ -200,11 +198,11 @@ extern "C"
uint32_t l_ringLen = 0;
FAPI_DBG("mvpdRingFunc: Called w/op=0x%x, ringId=0x%x, chipletId=0x%x, "
- "evenOdd=0x%x, size=0x%x",
+ "evenOddMask=0x%016llx, size=0x%x",
i_mvpdRingFuncOp,
i_ringId,
i_chipletId,
- i_evenOdd,
+ i_evenOddMask,
io_rRingBufsize );
// do common get and set input parameter error checks
@@ -264,9 +262,9 @@ extern "C"
l_recordBuf,
l_recordLen ),
"mvpdRingFunc: getMvpdField failed "
- "chipletId=0x%x, evenOdd=0x%x, ringId=0x%x",
+ "chipletId=0x%x, evenOddMask=0x%016llx, ringId=0x%x",
i_chipletId,
- i_evenOdd,
+ i_evenOddMask,
i_ringId);
// find ring in the record. It is an error if not there for a "get".
@@ -276,16 +274,16 @@ extern "C"
i_record,
i_keyword,
i_chipletId,
- i_evenOdd,
+ i_evenOddMask,
i_ringId,
l_recordBuf,
l_recordLen,
l_pRing,
l_ringLen),
"mvpdRingFunc: mvpdRingFuncFind failed "
- "chipletId=0x%x, evenOdd=0x%x, ringId=0x%x",
+ "chipletId=0x%x, evenOddMask=0x%016llx, ringId=0x%x",
i_chipletId,
- i_evenOdd,
+ i_evenOddMask,
i_ringId);
// do the get or set specific operations
@@ -317,9 +315,9 @@ extern "C"
i_pRingBuf,
io_rRingBufsize),
"mvpdRingFunc: mvpdRingFuncGet failed "
- "chipletId=0x%x, evenOdd=0x%x, ringId=0x%x",
+ "chipletId=0x%x, evenOddMask=0x%016llx, ringId=0x%x",
i_chipletId,
- i_evenOdd,
+ i_evenOddMask,
i_ringId);
}
else // set operation
@@ -373,279 +371,6 @@ extern "C"
return l_fapirc;
}
- // Attempts to find the MVPD END marker at given buffer address.
- // Returns o_mvpdEnd: true if END marker read, false otherwise.
- // Adjusts buffer pointer and length for the consumed portion of buffer, if any.
- fapi2::ReturnCode mvpdRingFuncFindEnd( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>
- & i_fapiTarget,
- uint8_t** io_pBufLeft,
- uint32_t* io_pBufLenLeft,
- bool* o_mvpdEnd)
- {
- uint32_t l_mvpdMagic;
- const uint8_t l_mvpdMagicLength = 3; // we match against 3 out of 4 bytes
-
- *o_mvpdEnd = false;
-
- if (*io_pBufLenLeft < l_mvpdMagicLength)
- {
- return fapi2::current_err;
- }
-
- l_mvpdMagic = *(reinterpret_cast<uint32_t*>(*io_pBufLeft));
- l_mvpdMagic = be32toh(l_mvpdMagic) & 0xffffff00;
-
- // Check for end of data magic word
- if (l_mvpdMagic == (MVPD_END_OF_DATA_MAGIC & 0xffffff00))
- {
- *o_mvpdEnd = true;
-
- FAPI_DBG("mvpdRingFuncFind: Found end of VPD data "
- "at address 0x%x",
- *io_pBufLeft);
-
- *io_pBufLeft += l_mvpdMagicLength;
- *io_pBufLenLeft -= l_mvpdMagicLength;
- }
-
- return fapi2::current_err;
- }
-
-
- // Returns a matching MVPD ring in RS4 v2 format at given buffer address,
- // NULL otherwise.
- // Adjusts buffer pointer and remaining length for the consumed portion
- // of buffer, that is, for the size of a matching MVPD ring, if any.
- // This function is needed only for backward compatibility, and may be
- // removed as soon as no RS4 v2 MVPD rings will be available.
- fapi2::ReturnCode mvpdRingFuncFindOld( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>
- & i_fapiTarget,
- const uint8_t i_chipletId,
- const uint8_t i_evenOdd,
- const uint8_t i_ringId,
- uint8_t** io_pBufLeft,
- uint32_t* io_pBufLenLeft,
- CompressedScanData** o_pScanData)
- {
- uint64_t l_evenOddMask;
- CompressedScanData l_scanData;
-
- // old CompressedScanData structure
- typedef struct
- {
- uint32_t iv_magic;
- uint32_t iv_size;
- uint32_t iv_algorithmReserved;
- uint32_t iv_length;
- uint64_t iv_scanSelect;
- uint8_t iv_headerVersion;
- uint8_t iv_flushOptimization;
- uint8_t iv_ringId;
- uint8_t iv_chipletId;
- } OldCompressedScanData;
-
- OldCompressedScanData* l_pScanDataOld =
- reinterpret_cast<OldCompressedScanData*>(*io_pBufLeft);
-
- *o_pScanData = NULL;
-
- // check if buffer is big enough for old ring header
- if (*io_pBufLenLeft < sizeof(OldCompressedScanData))
- {
- return fapi2::current_err;
- }
-
- // check magic word assuming an old ring header
- if ((be32toh(l_pScanDataOld->iv_magic) & 0xffffff00) != 0x52533400)
- {
- return fapi2::current_err;
- }
-
- // make sure that buffer is big enough for entire ring
- FAPI_ASSERT(*io_pBufLenLeft >= be32toh(l_pScanDataOld->iv_size),
- fapi2::MVPD_INSUFFICIENT_RECORD_SPACE(),
- "mvpdRingFuncFind: data does not fit "
- "into record buffer: ringId=0x%x, chipletId=0x%x",
- i_ringId,
- i_chipletId );
-
- // ok, this is a ring with an old header,
- // hence this part of the input buffer can be considered consumed,
- // regardless of it being the ring to be found or not
- *io_pBufLeft += be32toh(l_pScanDataOld->iv_size);
- *io_pBufLenLeft -= be32toh(l_pScanDataOld->iv_size);
-
- // for a few rings there are two different copies,
- // called even and odd, which we need to consider
- // as an extra search criterion for those rings (EX only)
- switch (i_ringId)
- {
- case ex_l3_refr_time:
- case ex_l3_refr_repr:
- l_evenOddMask = 0x0008000000000000 >> i_evenOdd;
- break;
-
- case ex_l2_repr:
- l_evenOddMask = 0x0080000000000000 >> i_evenOdd;
- break;
-
- case ex_l3_repr:
- l_evenOddMask = 0x0200000000000000 >> i_evenOdd;
- break;
-
- default:
- l_evenOddMask = 0;
- }
-
- // check if this ring matches the given criteria
- // (ring ID, chiplet Id, and even/odd for EX)
- if ( l_pScanDataOld->iv_ringId == i_ringId &&
- l_pScanDataOld->iv_chipletId == i_chipletId &&
- (l_evenOddMask == 0 ||
- be64toh(l_pScanDataOld->iv_scanSelect) & l_evenOddMask) )
- {
- // look up ring in p9_ringId and retrieve scanAddr
- GenRingIdList* l_ringProp = p9_ringid_get_ring_properties(
- (RingID)i_ringId);
- FAPI_ASSERT(l_ringProp,
- fapi2::MVPD_RINGID_DATA_NOT_FOUND(),
- "mvpdRingFuncFind: lookup of scanAddr failed "
- "for ringId=0x%x, chipletId=0x%x",
- i_ringId,
- i_chipletId);
-
- // update chipletId in iv_scanScomAddress (for instance rings)
- uint32_t l_scanScomAddr = l_ringProp->scanScomAddress;
-
- if (i_chipletId != (l_scanScomAddr & 0xff000000) >> 24)
- {
- l_scanScomAddr = (l_scanScomAddr & 0x00ffffff) |
- (((uint32_t)i_chipletId) << 24);
- }
-
- // translate old ring header to new ring header
- l_scanData.iv_magic = htobe16(RS4_MAGIC);
- l_scanData.iv_version = RS4_VERSION;
- l_scanData.iv_type = RS4_SCAN_DATA_TYPE_NON_CMSK;
- l_scanData.iv_size = htobe16(
- (be32toh(l_pScanDataOld->iv_size)
- - sizeof(OldCompressedScanData)
- + sizeof(CompressedScanData)));
- l_scanData.iv_ringId = htobe16(i_ringId);
- l_scanData.iv_scanAddr = htobe32(l_scanScomAddr);
-
- // overwrite old ring header with new ring header
- memcpy(l_pScanDataOld, &l_scanData, sizeof(l_scanData));
-
- // move compressed ring data to position adjacent to new header
- memmove((uint8_t*)l_pScanDataOld + sizeof(CompressedScanData),
- (uint8_t*)l_pScanDataOld + sizeof(OldCompressedScanData),
- be16toh(l_scanData.iv_size) - sizeof(CompressedScanData));
-
- // return found ring in new format
- *o_pScanData = reinterpret_cast<CompressedScanData*>
- (l_pScanDataOld);
-
- FAPI_DBG("mvpdRingFuncFindOld: found RS4 v2 ring for "
- "chipletId 0x%x, evenOdd %d and ringId %d "
- "at address 0x%x and with old/translated size %d/%d",
- i_chipletId,
- i_evenOdd,
- i_ringId,
- *o_pScanData,
- be32toh(l_pScanDataOld->iv_size),
- be16toh((*o_pScanData)->iv_size));
- }
-
- fapi_try_exit:
- return fapi2::current_err;
- }
-
-
- // Returns a matching MVPD ring in RS4 v3 format at given buffer address,
- // NULL otherwise.
- // Adjusts buffer pointer and remaining length for the consumed portion
- // of buffer, that is, for the size of a matching MVPD ring, if any.
- fapi2::ReturnCode mvpdRingFuncFindNew( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>
- & i_fapiTarget,
- const uint8_t i_chipletId,
- const uint8_t i_evenOdd,
- const uint8_t i_ringId,
- uint8_t** io_pBufLeft,
- uint32_t* io_pBufLenLeft,
- CompressedScanData** o_pScanData)
- {
- uint32_t l_evenOddMask;
-
- CompressedScanData* l_pScanData =
- reinterpret_cast<CompressedScanData*>(*io_pBufLeft);
-
- *o_pScanData = NULL;
-
- // check if buffer is big enough for new ring header
- if (*io_pBufLenLeft < sizeof(CompressedScanData))
- {
- return fapi2::current_err;
- }
-
- // check magic word assuming a new ring header
- if (be16toh(l_pScanData->iv_magic) != RS4_MAGIC)
- {
- return fapi2::current_err;
- }
-
- // make sure that buffer is big enough for entire ring
- FAPI_ASSERT(*io_pBufLenLeft >= be16toh(l_pScanData->iv_size),
- fapi2::MVPD_INSUFFICIENT_RECORD_SPACE(),
- "mvpdRingFuncFind: data does not fit "
- "into record buffer: ringId=0x%x, chipletId=0x%x",
- i_ringId,
- i_chipletId);
-
- // ok, this is a ring with a new header,
- // hence this part of the input buffer can be considered consumed,
- // regardless of it being the ring to be found or not
- *io_pBufLeft += be16toh(l_pScanData->iv_size);
- *io_pBufLenLeft -= be16toh(l_pScanData->iv_size);
-
- // for a few rings there are two different copies,
- // called even and odd, which we need to consider
- // as an extra search criterion for those rings (EX only)
- switch (i_ringId)
- {
- case ex_l3_refr_time:
- case ex_l3_refr_repr:
- case ex_l2_repr:
- case ex_l3_repr:
- l_evenOddMask = 0x00000800 >> i_evenOdd;
- break;
-
- default:
- l_evenOddMask = 0;
- }
-
- if ( be16toh(l_pScanData->iv_ringId) == i_ringId &&
- (be32toh(l_pScanData->iv_scanAddr) & 0xFF000000UL) >> 24
- == i_chipletId &&
- ( l_evenOddMask == 0 ||
- (be32toh(l_pScanData->iv_scanAddr) & l_evenOddMask) ) )
- {
- // found it, return pointer to ring
- *o_pScanData = l_pScanData;
-
- FAPI_DBG("mvpdRingFuncFindNew: found RS4 v3 ring for "
- "chipletId 0x%x, evenOdd %d and ringId %d "
- "at address 0x%x and with size %d",
- i_chipletId,
- i_evenOdd,
- i_ringId,
- *o_pScanData,
- be16toh((*o_pScanData)->iv_size));
- }
-
- fapi_try_exit:
- return fapi2::current_err;
- }
/**
* @brief MVPD Ring Function Find
@@ -656,9 +381,8 @@ extern "C"
* @param[in] i_chipletId
* Chiplet ID for the op
*
- * @param[in] i_evenOdd
- * Indicates whether choose even (0) or odd (1) EX.
- * Undefined and to be disregarded for non-EX.
+ * @param[in] i_evenOddMask
+ * Mask to choose even or odd EX. O for all other chiplets
*
* @param[in] i_ringId
* Ring ID for the op
@@ -685,102 +409,149 @@ extern "C"
fapi2::MvpdRecord i_record,
fapi2::MvpdKeyword i_keyword,
const uint8_t i_chipletId,
- const uint8_t i_evenOdd,
+ const uint64_t i_evenOddMask,
const uint8_t i_ringId,
uint8_t* i_pRecordBuf,
uint32_t i_recordBufLen,
uint8_t*& o_rpRing,
uint32_t& o_rRingLen )
{
- fapi2::ReturnCode l_fapirc;
- bool l_mvpdEnd;
- CompressedScanData* l_pScanData = NULL;
- uint32_t l_prevLen;
- uint32_t l_recordBufLenLeft = i_recordBufLen;
+ fapi2::ReturnCode l_fapirc;
+ uint8_t* l_pRing = NULL;
+ uint32_t l_offset = 0;
+ CompressedScanData* l_pScanData = NULL;
+ bool l_foundflag = false;
+
+ // initialize return fields in case of an error.
+ o_rpRing = NULL;
+ o_rRingLen = 0;
- FAPI_DBG("mvpdRingFuncFind: Called w/chipletId=0x%x, evenOdd=0x%x, ringId=0x%x ",
+ FAPI_DBG("mvpdRingFuncFind: Called w/chipletId=0x%x, evenOddMask=0x%016llx, ringId=0x%x ",
i_chipletId,
- i_evenOdd,
+ i_evenOddMask,
i_ringId);
- // Find first RSA data block in ring (fixed offset defined by
- // MVPD spec)
- //
- // First byte in record should be the version number, skip
- // over this.
- //
- FAPI_DBG( "mvpdRingFuncFind: record version = 0x%x", *i_pRecordBuf );
- i_pRecordBuf++;
- l_recordBufLenLeft--;
-
do
{
- // let's track the previous size of the remaining buffer,
- // so that we can determine whether we have found anything,
- // and bail out if not (= buffer content corrupted)
- l_prevLen = l_recordBufLenLeft;
-
- // first look for vpd end marker
- FAPI_TRY(mvpdRingFuncFindEnd(i_fapiTarget,
- &i_pRecordBuf,
- &l_recordBufLenLeft,
- &l_mvpdEnd),
- "mvpdRingFuncFind: mvpdRingFuncFindEnd failed");
-
- // next look for old ring header, because
- // its magic "RS4" is not as ambigiuous as the new "RS" magic
- if (!l_mvpdEnd)
+ // Point to record
+ l_pRing = i_pRecordBuf;
+
+ // Find first RSA data block in ring (fixed offset defined by
+ // MVPD spec)
+ //
+ // First byte in record should be the version number, skip
+ // over this.
+ //
+ FAPI_DBG( "mvpdRingFuncFind: record version = 0x%x", *l_pRing );
+ l_pRing++;
+ l_offset = 0;
+
+ // point to header of first ring in record
+ l_pScanData =
+ reinterpret_cast<CompressedScanData*>( l_pRing + l_offset );
+
+ l_foundflag = false;
+
+ // be sure that data we will look at is within the passed buffer
+ while ( (l_offset + be32toh(l_pScanData->iv_size)) < i_recordBufLen )
{
- FAPI_TRY(mvpdRingFuncFindOld(i_fapiTarget,
- i_chipletId,
- i_evenOdd,
- i_ringId,
- &i_pRecordBuf,
- &l_recordBufLenLeft,
- &l_pScanData),
- "mvpdRingFuncFind: mvpdRingFuncFindOld failed");
- }
- // last look for new ring header
- if (!l_mvpdEnd && !l_pScanData)
+ // There's only two valid header words that may appear in the Mvpd record:
+ // - MVPD_END_OF_DATA_MAGIC which indicates end of the data with a record.
+ // - RS4_MAGIC which indicates the beginning of another VPD ring.
+ // - Anything else is a catastrophic failure.
+
+ // Check for end of data magic word
+ if ((be32toh(l_pScanData->iv_magic) & 0xffffff00) == (MVPD_END_OF_DATA_MAGIC & 0xffffff00))
+ {
+ FAPI_DBG("mvpdRingFuncFind: Found end of data magic word (=0x%08X): "
+ "offset=0x%x, chipletId=0x%x, ringId=0x%x",
+ be32toh(l_pScanData->iv_magic),
+ l_offset,
+ i_chipletId,
+ i_ringId);
+ break;
+ }
+
+ // Check magic word to make sure this is valid data.
+ FAPI_ASSERT( (be32toh(l_pScanData->iv_magic) & 0xffffff00) == (RS4_MAGIC & 0xffffff00),
+ fapi2::MVPD_INVALID_RS4_HEADER().
+ set_CHIP_TARGET(i_fapiTarget).
+ set_MVPD_RECORD(i_record).
+ set_MVPD_KEYWORD(i_keyword),
+ "mvpdRingFuncFind: Couldn't find RS4 or End-of-data magic word in header: "
+ "Header=0x%x, offset=0x%x, ringId=0x%x, chipletId=0x%x",
+ be32toh(l_pScanData->iv_magic),
+ l_offset,
+ i_ringId,
+ i_chipletId );
+
+ // We can now assume good data...
+
+ // Dump record info for debug
+ FAPI_DBG("mvpdRingFuncFind:%d ringId=0x%x chipletId=0x%x"
+ " ringlen=0x%x size=0x%x",
+ l_offset,
+ l_pScanData->iv_ringId,
+ l_pScanData->iv_chipletId,
+ be32toh(l_pScanData->iv_length),
+ be32toh(l_pScanData->iv_size) );
+
+
+ if ( l_pScanData->iv_ringId == i_ringId &&
+ l_pScanData->iv_chipletId == i_chipletId &&
+ ( i_evenOddMask == 0 || (be64toh(l_pScanData->iv_scanSelect) & i_evenOddMask) ) )
+ {
+ FAPI_DBG( "mvpdRingFuncFind: Found it: ringId=0x%x, "
+ "chipletId=0x%x, evenOddMask=0x%016llx, ringlen=0x%x",
+ i_ringId,
+ i_chipletId,
+ i_evenOddMask,
+ be32toh(l_pScanData->iv_length) );
+
+ // shouldn't happen, but does not all fit
+ FAPI_ASSERT(l_offset + be32toh(l_pScanData->iv_size) <=
+ i_recordBufLen,
+ fapi2::MVPD_INSUFFICIENT_RECORD_SPACE(),
+ "mvpdRingFuncFind: data does not fit "
+ "into record buffer: ringId=0x%x, chipletId=0x%x",
+ i_ringId,
+ i_chipletId );
+
+ l_foundflag = true;
+ o_rpRing = l_pRing + l_offset;
+ o_rRingLen = be32toh(l_pScanData->iv_size);
+ // got it, break out of scan loop
+ break;
+ }
+
+ // being defensive.
+ if ( be32toh(l_pScanData->iv_size) == 0)
+ {
+ // size of 0 is invalid, would loop forever.
+ break;
+ }
+
+ // bump to next ring
+ l_offset += be32toh(l_pScanData->iv_size) ;
+
+ // point to header
+ l_pScanData =
+ reinterpret_cast<CompressedScanData*>( l_pRing + l_offset );
+
+
+ } // end while scan loop
+
+ // if no other error and not found, indicate with 0 size.
+ if ( !l_fapirc && ! l_foundflag )
{
- FAPI_TRY(mvpdRingFuncFindNew(i_fapiTarget,
- i_chipletId,
- i_evenOdd,
- i_ringId,
- &i_pRecordBuf,
- &l_recordBufLenLeft,
- &l_pScanData),
- "mvpdRingFuncFind: mvpdRingFuncFindNew failed");
+ o_rpRing = l_pRing + l_offset; //return pointer to end of list
+ //incase needed for appending
+ o_rRingLen = 0; //indicate not found
}
- FAPI_ASSERT(l_prevLen != l_recordBufLenLeft,
- fapi2::MVPD_RING_FUNC_ENDLESS(),
- "mvpdRingFuncFind: found neither END marker, nor valid"
- " ring at address 0x%x for remaining buffer size 0x%d.",
- i_pRecordBuf,
- l_recordBufLenLeft);
- }
- while (!l_mvpdEnd && !l_pScanData && l_recordBufLenLeft);
-
- if (l_pScanData)
- {
- o_rpRing = (uint8_t*)l_pScanData;
- o_rRingLen = be16toh(l_pScanData->iv_size);
-
- // Dump record info for debug
- FAPI_DBG("mvpdRingFuncFind:ringId=0x%x chipletId=0x%x size=0x%x",
- i_ringId,
- i_chipletId,
- be16toh(l_pScanData->iv_size));
- }
- else
- {
- // if no error and not found, return pointer to end of list
- // in case it's needed for appending, and indicate with 0 size
- o_rpRing = i_pRecordBuf;
- o_rRingLen = 0;
}
+ while ( 0 );
fapi_try_exit:
// get current error
@@ -815,11 +586,10 @@ extern "C"
*
* @return fapi2::ReturnCode
*/
- fapi2::ReturnCode mvpdValidateRingHeader(
- CompressedScanData* i_pRingBuf,
- uint8_t i_chipletId,
- uint8_t i_ringId,
- uint32_t i_ringBufsize)
+ fapi2::ReturnCode mvpdValidateRingHeader( CompressedScanData* i_pRingBuf,
+ uint8_t i_chipletId,
+ uint8_t i_ringId,
+ uint32_t i_ringBufsize)
{
FAPI_ASSERT(i_ringBufsize > sizeof(CompressedScanData),
fapi2::MVPD_RING_FUNC_INVALID_PARAMETER(),
@@ -827,26 +597,25 @@ extern "C"
"chipletId=0x%x, ringId=0x%x",
i_chipletId,
i_ringId);
- FAPI_ASSERT(be16toh(i_pRingBuf->iv_magic) == RS4_MAGIC,
+ FAPI_ASSERT((be32toh(i_pRingBuf->iv_magic) & 0xffffff00) == (RS4_MAGIC & 0xffffff00),
fapi2::MVPD_RING_FUNC_INVALID_PARAMETER(),
"mvpdValidateRingHeader: i_pRingBuf->iv_magic failed "
"chipletId=0x%x, ringId=0x%x",
i_chipletId,
i_ringId);
- FAPI_ASSERT(be16toh(i_pRingBuf->iv_ringId) == i_ringId,
+ FAPI_ASSERT(i_pRingBuf->iv_ringId == i_ringId,
fapi2::MVPD_RING_FUNC_INVALID_PARAMETER(),
"mvpdValidateRingHeader: i_pRingBuf->iv_ringId failed "
"chipletId=0x%x, ringId=0x%x",
i_chipletId,
i_ringId);
- FAPI_ASSERT((be32toh(i_pRingBuf->iv_scanAddr) & 0xFF000000UL) >> 24
- == i_chipletId,
+ FAPI_ASSERT(i_pRingBuf->iv_chipletId == i_chipletId,
fapi2::MVPD_RING_FUNC_INVALID_PARAMETER(),
"mvpdValidateRingHeader: i_pRingBuf->iv_chipletId failed "
"chipletId=0x%x, ringId=0x%x",
i_chipletId,
i_ringId);
- FAPI_ASSERT(be16toh(i_pRingBuf->iv_size) == i_ringBufsize,
+ FAPI_ASSERT(be32toh(i_pRingBuf->iv_size) == i_ringBufsize,
fapi2::MVPD_RING_FUNC_INVALID_PARAMETER(),
"mvpdValidateRingHeader: i_pRingBuf->iv_size failed "
"chipletId=0x%x, ringId=0x%x",
diff --git a/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.H b/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.H
index 396db3419..6965d4b1b 100644
--- a/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.H
+++ b/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.H
@@ -72,7 +72,7 @@ extern "C"
* @param i_keyword - Keyword enumerator
* @param i_fapiTarget - cpu target
* @param i_chipletId - Chiplet ID
- * @param i_evenOddMask - Even (0) or odd (1) EX. Disregarded for other chiplets.
+ * @param i_evenOddMask - Mask to choose even or odd EX. O for all other chiplets
* @param i_ringId - Ring ID
* @param i_pRingBuf - The buffer to receive or send the ring
* @param io_rRingBufsize - Size of ring / ring buffer
@@ -86,7 +86,7 @@ extern "C"
const Target<TARGET_TYPE_PROC_CHIP>&
i_fapiTarget,
const uint8_t i_chipletId,
- const uint8_t i_evenOdd,
+ const uint64_t i_evenOddMask,
const uint8_t i_ringId,
uint8_t* i_pRingBuf,
uint32_t& io_rRingBufsize );
diff --git a/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.mk b/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.mk
index e936a8d70..601b92808 100644
--- a/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.mk
+++ b/src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.mk
@@ -26,5 +26,4 @@
# Include the macros and things for MVPD ring procedures
PROCEDURE=p9_mvpd_ring_funcs
$(call ADD_MODULE_INCDIR,$(PROCEDURE),$(ROOTPATH)/chips/p9/utils/imageProcs)
-lib$(PROCEDURE)_DEPLIBS+=p9_ringId
$(call BUILD_PROCEDURE)
diff --git a/src/import/chips/p9/procedures/hwp/customize/p9_xip_customize.C b/src/import/chips/p9/procedures/hwp/customize/p9_xip_customize.C
index a3bb7d4d0..00723dea3 100644
--- a/src/import/chips/p9/procedures/hwp/customize/p9_xip_customize.C
+++ b/src/import/chips/p9/procedures/hwp/customize/p9_xip_customize.C
@@ -165,9 +165,11 @@ fapi2::ReturnCode _fetch_and_insert_vpd_rings(
int l_rc = 0;
uint8_t l_chipletId;
- uint8_t l_ringsPerChipletId = 1;
+ uint8_t l_ringsPerChipletId = 0;
uint8_t l_instanceIdMax;
uint8_t l_evenOdd;
+ uint64_t l_evenOddMaskStart;
+ uint64_t l_evenOddMask; // 0:even, 1:odd
uint8_t bSkipRing = 0;
@@ -185,13 +187,44 @@ fapi2::ReturnCode _fetch_and_insert_vpd_rings(
// listed in ring_identification.C: One for each of the two EX, even and odd.
// Each of these two rings have the same [EQ] chipletId encoded in their
// iv_chipletId (current RS4 header) or iv_scanAddress (next gen RS4 header).
- // They are distinguished by their even-odd bits in iv_scanAddress and so
- // for each EQ chipletId there's two EX rings to be accommodated.
+ // They are distinguished by their even-odd bits in iv_scanSelect as follows:
if (i_ring.vpdRingClass == VPD_RING_CLASS_EX_INS)
{
l_ringsPerChipletId = 2;
+
+ switch (i_ring.ringId)
+ {
+ case ex_l3_refr_time:
+ case ex_l3_refr_repr:
+ l_evenOddMaskStart = ((uint64_t)0x00080000) << 32;
+ break;
+
+ case ex_l2_repr:
+ l_evenOddMaskStart = ((uint64_t)0x00800000) << 32;
+ break;
+
+ case ex_l3_repr:
+ l_evenOddMaskStart = ((uint64_t)0x02000000) << 32;
+ break;
+
+ default:
+ FAPI_ASSERT( false,
+ fapi2::XIPC_MVPD_RING_ID_MESS().
+ set_CHIP_TARGET(i_proc_target).
+ set_RING_ID(i_ring.ringId),
+ "Code bug: Wrong assumption about supported ringIds in this context. "
+ "ringId=%d(=0x%x)(=ringId.ringName) is not allowed here. ",
+ i_ring.ringId, i_ring.ringId, i_ring.ringName );
+ break;
+ }
+ }
+ else
+ {
+ l_ringsPerChipletId = 1;
+ l_evenOddMaskStart = 0;
}
+
// We use ring.instanceIdMax column to govern max value of instanceIdMax (i.e., the
// max chipletId). But unlike in P8, in P9 we will not search for chipletId=0xff in P9
// MVPD. It is no longer used in the MVPD. We merely keep the multicast Id, 0xff, in
@@ -210,6 +243,9 @@ fapi2::ReturnCode _fetch_and_insert_vpd_rings(
for (l_evenOdd = 0; l_evenOdd < l_ringsPerChipletId; l_evenOdd++)
{
+
+ l_evenOddMask = l_evenOddMaskStart >> l_evenOdd;
+
FAPI_INF("_fetch_and_insert_vpd_rings: (ringId,chipletId) = (0x%02X,0x%02x)",
i_ring.ringId, l_chipletId);
@@ -262,7 +298,7 @@ fapi2::ReturnCode _fetch_and_insert_vpd_rings(
l_mvpdKeyword,
i_proc_target,
l_chipletId,
- l_evenOdd,
+ l_evenOddMask,
i_ring.ringId,
(uint8_t*)i_vpdRing,
l_vpdRingSize );
@@ -286,7 +322,7 @@ fapi2::ReturnCode _fetch_and_insert_vpd_rings(
l_mvpdKeyword,
i_proc_target,
l_chipletId,
- l_evenOdd,
+ l_evenOddMask,
i_ring.ringId,
(uint8_t*)i_vpdRing,
l_vpdRingSize );
@@ -309,7 +345,7 @@ fapi2::ReturnCode _fetch_and_insert_vpd_rings(
l_mvpdKeyword,
i_proc_target,
l_chipletId,
- l_evenOdd,
+ l_evenOddMask,
i_ring.ringId,
(uint8_t*)i_vpdRing,
l_vpdRingSize );
@@ -334,7 +370,7 @@ fapi2::ReturnCode _fetch_and_insert_vpd_rings(
l_mvpdKeyword,
i_proc_target,
l_chipletId,
- l_evenOdd,
+ l_evenOddMask,
i_ring.ringId,
(uint8_t*)i_vpdRing,
l_vpdRingSize );
@@ -356,12 +392,12 @@ fapi2::ReturnCode _fetch_and_insert_vpd_rings(
else if (l_fapiRc == fapi2::FAPI2_RC_SUCCESS)
{
- auto l_scanAddr =
- be32toh(((CompressedScanData*)i_vpdRing)->iv_scanAddr);
- auto l_vpdChipletId = (l_scanAddr & 0xFF000000UL) >> 24;
+ auto l_vpdChipletId = ((CompressedScanData*)i_vpdRing)->iv_chipletId;
// Even though success, checking that chipletId didn't somehow get
// messed up (code bug).
+ //@TODO: Modify this when chipletId becomes part of iv_scanAddress
+ // as part of RS4 shrinkage (RTC158101).
FAPI_ASSERT( l_vpdChipletId == l_chipletId,
fapi2::XIPC_MVPD_CHIPLET_ID_MESS().
set_CHIP_TARGET(i_proc_target).
@@ -390,7 +426,7 @@ fapi2::ReturnCode _fetch_and_insert_vpd_rings(
// Also fix p9_mvpd_ring_funcs.C to look for entire RS4_MAGIC string.
// Actually, do all the above in connection with RS4 header
// shrinkage (RTC158101 and RTC159801).
- ((CompressedScanData*)i_vpdRing)->iv_magic = htobe16(RS4_MAGIC);
+ ((CompressedScanData*)i_vpdRing)->iv_magic = htobe32(RS4_MAGIC);
// Check if ring is a flush ring, i.e. if it is redundant, meaning that it will
// result in no change.
@@ -414,8 +450,25 @@ fapi2::ReturnCode _fetch_and_insert_vpd_rings(
}
else
{
+
+ //@TODO: Temporary fix to convert VPD RS4 container format to
+ // to RingLayout format. Remove/replace in connection
+ // with RS4 header shrinkage (RTC158101)
+ uint32_t i;
+
+ for (i = 0; i < l_vpdRingSize; i++)
+ {
+ *(((uint8_t*)i_vpdRing) + l_vpdRingSize - 1 + sizeof(P9_TOR::RingLayout_t) - i) =
+ *(((uint8_t*)i_vpdRing) + l_vpdRingSize - 1 - i);
+ }
+
+ uint32_t l_sizeOfThisRing = l_vpdRingSize + sizeof(P9_TOR::RingLayout_t);
+ ((P9_TOR::RingLayout_t*)i_vpdRing)->sizeOfThis = htobe32(l_sizeOfThisRing);
+ ((P9_TOR::RingLayout_t*)i_vpdRing)->sizeOfCmsk = 0;
+ ((P9_TOR::RingLayout_t*)i_vpdRing)->sizeOfMeta = 0;
+
// Checking for potential image overflow BEFORE appending the ring.
- if ( (io_ringSectionSize + l_vpdRingSize) > i_maxRingSectionSize )
+ if ( (io_ringSectionSize + l_sizeOfThisRing) > i_maxRingSectionSize )
{
//@TODO: We can't update bootCoreMask until RTC158106. So for now
// we're simply returning the requested bootCoreMask. Thus,
@@ -428,7 +481,7 @@ fapi2::ReturnCode _fetch_and_insert_vpd_rings(
fapi2::XIPC_IMAGE_WOULD_OVERFLOW().
set_CHIP_TARGET(i_proc_target).
set_CURRENT_RING_SECTION_SIZE(io_ringSectionSize).
- set_SIZE_OF_THIS_RING(l_vpdRingSize).
+ set_SIZE_OF_THIS_RING(l_sizeOfThisRing).
set_MAX_RING_SECTION_SIZE(i_maxRingSectionSize).
set_RING_ID(i_ring.ringId).
set_CHIPLET_ID(l_chipletId).
@@ -462,7 +515,7 @@ fapi2::ReturnCode _fetch_and_insert_vpd_rings(
l_chipletTorId, // Chiplet instance TOR Index
i_vpdRing ); // The VPD RS4 ring container
- if (l_rc == TOR_SUCCESS)
+ if (l_rc == TOR_APPEND_RING_DONE)
{
FAPI_INF("Successfully added VPD ring: (ringId,evenOdd,chipletId)=(0x%02X,0x%X,0x%02X)",
i_ring.ringId, l_evenOdd, l_chipletId);
@@ -492,7 +545,7 @@ fapi2::ReturnCode _fetch_and_insert_vpd_rings(
l_chipletTorId, // Chiplet instance ID
i_vpdRing ); // The VPD RS4 ring container
- if (l_rc == TOR_SUCCESS)
+ if (l_rc == TOR_APPEND_RING_DONE)
{
FAPI_INF("Successfully added VPD ring: (ringId,evenOdd,chipletId)=(0x%02X,0x%X,0x%02X)",
i_ring.ringId, l_evenOdd, l_chipletId);
@@ -524,7 +577,7 @@ fapi2::ReturnCode _fetch_and_insert_vpd_rings(
l_chipletTorId, // Chiplet instance ID
i_vpdRing ); // The VPD RS4 ring container
- if (l_rc == TOR_SUCCESS)
+ if (l_rc == TOR_APPEND_RING_DONE)
{
FAPI_INF("Successfully added VPD ring: (ringId,evenOdd,chipletId)=(0x%02X,0x%X,0x%02X)",
i_ring.ringId, l_evenOdd, l_chipletId);
OpenPOWER on IntegriCloud