Skip to content

Commit

Permalink
Cleanup: Updated Mvpd access function and removal of unused rings
Browse files Browse the repository at this point in the history
- Removed the function that converts the outdated RS4v2 header format
  to the current RS4v3 header format in the Mvpd accessor functions,
  mvpdRingFundFind(). This can be done since all Mvpd in existance on
  any of our supported P9 systems (i.e., >=P9N DD20) use RS4v3.
- Removed two #R rings which are no longer supported since P9n DD10.
  Because these rings happen to be located at the end of the TOR
  instance ring sections, it will alter the image, but will not
  interfere with the traversing of the ringSection image due to the
  way chiplet and common/instance sub-sections are partitioned.

Key_Cronus_Test=XIP_REGRESS

Change-Id: I39740a099b224bfade8a97a057453b85498e5880
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/61100
Reviewed-by: Joseph J. McGill <jmcgill@us.ibm.com>
Reviewed-by: Michael C. Sgro <mcs793@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com>
Tested-by: Cronus HW CI <cronushw-ci+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/61289
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>
  • Loading branch information
cmolsen authored and crgeddes committed Jul 17, 2018
1 parent 2fe6935 commit 55b7b8f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 233 deletions.
208 changes: 7 additions & 201 deletions src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.C
Original file line number Diff line number Diff line change
Expand Up @@ -425,191 +425,11 @@ extern "C"
}


// Returns a matching MVPD ring in RS4 v2 format at given buffer address,
// Returns a matching MVPD ring in RS4 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 RingId_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_RING_BUFFER_SPACE().
set_CHIP_TARGET(i_fapiTarget).
set_RING_ID(i_ringId).
set_CHIPLET_ID(i_chipletId).
set_BUFFER_SIZE(*io_pBufLenLeft).
set_RING_SIZE(be32toh(l_pScanDataOld->iv_size)).
set_OCCURRENCE(1),
"mvpdRingFuncFindOld: Not enough ring buffer space to contain ring: "
"ringId=0x%x, chipletId=0x%x, ",
"pBufLenLeft=%d, ring->iv_size=%d",
i_ringId, i_chipletId,
*io_pBufLenLeft, be32toh(l_pScanDataOld->iv_size));

// 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 ( ( i_ringId <= 0xff &&
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
int l_rc = INFRASTRUCT_RC_SUCCESS;
ChipType_t l_chipType = CT_P9N; // Any P9 CT will do here
GenRingIdList* l_ringProp = NULL;

l_rc = ringid_get_ring_list( l_chipType,
i_ringId,
&l_ringProp );

FAPI_ASSERT( l_rc == INFRASTRUCT_RC_SUCCESS ||
l_ringProp != NULL,
fapi2::MVPD_RINGID_DATA_NOT_FOUND().
set_CHIP_TARGET(i_fapiTarget).
set_RING_ID(i_ringId).
set_CHIPLET_ID(i_chipletId),
"mvpdRingFuncFind: lookup of scanAddr failed "
"for chipType=%d, ringId=0x%x, chipletId=0x%x",
l_chipType,
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);
}

// update even/odd region mask in iv_scanScomAddress (for EX):
// p9_ringId.C stores scan addresses for even EX rings. Hence we
// only need to clear the even bit and set the odd bit
// to create the correct scan address for odd EX rings.
if (l_evenOddMask && i_evenOdd)
{
uint32_t l_evenOddMask32 = (uint32_t)(l_evenOddMask >> 45);
l_scanScomAddr &= ~(l_evenOddMask32 << i_evenOdd);
l_scanScomAddr |= l_evenOddMask32;
}

// 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>
fapi2::ReturnCode mvpdRingFuncFindHdr( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>
& i_fapiTarget,
const uint8_t i_chipletId,
const uint8_t i_evenOdd,
Expand Down Expand Up @@ -646,7 +466,7 @@ extern "C"
set_BUFFER_SIZE(*io_pBufLenLeft).
set_RING_SIZE(be16toh(l_pScanData->iv_size)).
set_OCCURRENCE(2),
"mvpdRingFuncFindNew: Not enough ring buffer space to contain ring: "
"mvpdRingFuncFindHdr: Not enough ring buffer space to contain ring: "
"ringId=0x%x, chipletId=0x%x, ",
"pBufLenLeft=%d, ring->iv_size=%d",
i_ringId, i_chipletId,
Expand Down Expand Up @@ -689,7 +509,7 @@ extern "C"
// found it, return pointer to ring
*o_pScanData = l_pScanData;

FAPI_DBG("mvpdRingFuncFindNew: found RS4 v3 ring for "
FAPI_DBG("mvpdRingFuncFindHdr: found RS4 ring for "
"chipletId 0x%x, evenOdd %d and ringId %d "
"at address 0x%x and with size %d",
i_chipletId,
Expand Down Expand Up @@ -792,31 +612,17 @@ extern "C"
&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)
{
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
// second look for ring header
if (!l_mvpdEnd && !l_pScanData)
{
FAPI_TRY(mvpdRingFuncFindNew(i_fapiTarget,
FAPI_TRY(mvpdRingFuncFindHdr(i_fapiTarget,
i_chipletId,
i_evenOdd,
i_ringId,
&i_pRecordBuf,
&l_recordBufLenLeft,
&l_pScanData),
"mvpdRingFuncFind: mvpdRingFuncFindNew failed");
"mvpdRingFuncFind: mvpdRingFuncFindHdr failed");
}

FAPI_ASSERT(l_prevLen != l_recordBufLenLeft,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- -->
<!-- OpenPOWER HostBoot Project -->
<!-- -->
<!-- Contributors Listed Below - COPYRIGHT 2016,2017 -->
<!-- Contributors Listed Below - COPYRIGHT 2016,2018 -->
<!-- [+] International Business Machines Corp. -->
<!-- -->
<!-- -->
Expand Down Expand Up @@ -121,18 +121,6 @@
</callout>
</hwpError>
<!-- ********************************************************************* -->
<hwpError>
<rc>RC_MVPD_RINGID_DATA_NOT_FOUND</rc>
<description>Data for given ringId missing in p9_ringId</description>
<ffdc>CHIP_TARGET</ffdc>
<ffdc>RING_ID</ffdc>
<ffdc>CHIPLET_ID</ffdc>
<callout>
<procedure>CODE</procedure>
<priority>HIGH</priority>
</callout>
</hwpError>
<!-- ********************************************************************* -->
<hwpError>
<rc>RC_MVPD_RING_REDUNDANT_DATA</rc>
<description>MVPD ring has redundant data (Not a bug. Info to caller.)</description>
Expand Down
4 changes: 1 addition & 3 deletions src/import/chips/p9/utils/imageProcs/p9_ringId.C
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ const GenRingIdList RING_ID_LIST_INSTANCE[] =
{
{"n2_repr" , 0x09, 0x04, 0x04, VPD_RING , 0x04035C06},
{"n2_cxa1_repr" , 0x0a, 0x04, 0x04, VPD_RING , 0x04032006},
{"n2_psi_repr" , 0x0b, 0x04, 0x04, VPD_RING , 0x04030206},
};
const RingVariantOrder RING_VARIANT_ORDER[] = { RV_BASE, RV_RL, UNDEFINED_RING_VARIANT, UNDEFINED_RING_VARIANT, UNDEFINED_RING_VARIANT, UNDEFINED_RING_VARIANT, UNDEFINED_RING_VARIANT };
};
Expand Down Expand Up @@ -221,8 +220,7 @@ const GenRingIdList RING_ID_LIST_COMMON[] =
const GenRingIdList RING_ID_LIST_INSTANCE[] =
{
{"mc_repr" , 0x10, 0x07, 0x08, VPD_RING , 0x07036006},
{"mc_iom01_repr" , 0x11, 0x07, 0x08, VPD_RING , 0x07031006},
{"mc_iom23_repr" , 0x12, 0x07, 0x08, VPD_RING , 0x07030806},
{"mc_iom23_repr" , 0x11, 0x07, 0x08, VPD_RING , 0x07030806},
};
const RingVariantOrder RING_VARIANT_ORDER[] = { RV_BASE, RV_RL, UNDEFINED_RING_VARIANT, UNDEFINED_RING_VARIANT, UNDEFINED_RING_VARIANT, UNDEFINED_RING_VARIANT, UNDEFINED_RING_VARIANT };
};
Expand Down
20 changes: 9 additions & 11 deletions src/import/chips/p9/utils/imageProcs/p9_ringId.H
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,14 @@ enum RingOffset
// Instance Rings
n2_repr = (0 | INSTANCE_RING_MARK),
n2_cxa1_repr = (1 | INSTANCE_RING_MARK),
n2_psi_repr = (2 | INSTANCE_RING_MARK)
};

static const ChipletData_t g_chipletData =
{
4, // N2 Chiplet ID is 4.
9, // 9 common rings for N2 Chiplet
3, // 3 instance specific rings for N2 chiplet
3,
2, // 2 instance specific rings for N2 chiplet
2,
2, // 2 common ring variants: BASE, RL
};
};
Expand Down Expand Up @@ -404,16 +403,15 @@ enum RingOffset
mc_pll_func = 15,
// Instance Rings
mc_repr = (0 | INSTANCE_RING_MARK),
mc_iom01_repr = (1 | INSTANCE_RING_MARK),
mc_iom23_repr = (2 | INSTANCE_RING_MARK)
mc_iom23_repr = (1 | INSTANCE_RING_MARK),
};

static const ChipletData_t g_chipletData =
{
7, // MC Chiplet ID range is 7 - 8. The base ID is 7.
16, // 16 common rings for MC Chiplet
3, // 3 instance specific rings for each MC instance
3,
2, // 1 instance specific rings for each MC instance
2,
2, // 2 common ring variants: BASE, RL
};
}; // end of namespace MC
Expand Down Expand Up @@ -780,7 +778,7 @@ static const RingProperties_t RING_PROPERTIES[NUM_RING_IDS] =
{ N2::n2_psi_time , "n2_psi_time" , N2_TYPE }, // 57
{ N2::n2_repr , "n2_repr" , N2_TYPE }, // 58
{ N2::n2_cxa1_repr , "n2_cxa1_repr" , N2_TYPE }, // 59
{ N2::n2_psi_repr , "n2_psi_repr" , N2_TYPE }, // 60
{ INVALID_RING_OFFSET , "invalid" , N2_TYPE }, // 60
{ INVALID_RING_OFFSET , "invalid" , N2_TYPE }, // 61
{ N3::n3_fure , "n3_fure" , N3_TYPE }, // 62
{ N3::n3_gptr , "n3_gptr" , N3_TYPE }, // 63
Expand Down Expand Up @@ -834,7 +832,7 @@ static const RingProperties_t RING_PROPERTIES[NUM_RING_IDS] =
{ MC::mc_pll_bndy_bucket_5 , "mc_pll_bndy_bucket_5" , MC_TYPE }, // 111
{ MC::mc_pll_func , "mc_pll_func" , MC_TYPE }, // 112
{ MC::mc_repr , "mc_repr" , MC_TYPE }, // 113
{ MC::mc_iom01_repr , "mc_iom01_repr" , MC_TYPE }, // 114
{ INVALID_RING_OFFSET , "invalid" , MC_TYPE }, // 114
{ MC::mc_iom23_repr , "mc_iom23_repr" , MC_TYPE }, // 115
{ OB0::ob0_pll_bndy , "ob0_pll_bndy" , OB0_TYPE }, // 116
{ OB0::ob0_pll_bndy_bucket_1 , "ob0_pll_bndy_bucket_1" , OB0_TYPE }, // 117
Expand Down Expand Up @@ -1043,7 +1041,7 @@ static const RingProperties_t RING_PROPERTIES[NUM_RING_IDS] =
{ N2::n2_psi_time , N2_TYPE }, // 57
{ N2::n2_repr , N2_TYPE }, // 58
{ N2::n2_cxa1_repr , N2_TYPE }, // 59
{ N2::n2_psi_repr , N2_TYPE }, // 60
{ INVALID_RING_OFFSET , N2_TYPE }, // 60
{ INVALID_RING_OFFSET , N2_TYPE }, // 61
{ N3::n3_fure , N3_TYPE }, // 62
{ N3::n3_gptr , N3_TYPE }, // 63
Expand Down Expand Up @@ -1097,7 +1095,7 @@ static const RingProperties_t RING_PROPERTIES[NUM_RING_IDS] =
{ MC::mc_pll_bndy_bucket_5 , MC_TYPE }, // 111
{ MC::mc_pll_func , MC_TYPE }, // 112
{ MC::mc_repr , MC_TYPE }, // 113
{ MC::mc_iom01_repr , MC_TYPE }, // 114
{ INVALID_RING_OFFSET , MC_TYPE }, // 114
{ MC::mc_iom23_repr , MC_TYPE }, // 115
{ OB0::ob0_pll_bndy , OB0_TYPE }, // 116
{ OB0::ob0_pll_bndy_bucket_1 , OB0_TYPE }, // 117
Expand Down
7 changes: 3 additions & 4 deletions src/import/chips/p9/utils/imageProcs/p9_ring_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ enum RingID
n2_psi_time = 57, //0x39
n2_repr = 58, //0x3A
n2_cxa1_repr = 59, //0x3B
n2_psi_repr = 60, //0x3C
// values 61 unused
// values 60-61 unused

// Nest Chiplet Rings - N3
n3_fure = 62, //0x3E
Expand Down Expand Up @@ -177,8 +176,8 @@ enum RingID
// MC Chiplet Rings
// MC01 and MC23 instance specific Rings
mc_repr = 113, //0x71
mc_iom01_repr = 114, //0x72
mc_iom23_repr = 115, //0x73
// value 114 unused
mc_iom23_repr = 115, //0c73

// OB0 Chiplet Rings
ob0_pll_bndy = 116, //0x74
Expand Down

0 comments on commit 55b7b8f

Please sign in to comment.