diff options
author | Claus Michael Olsen <cmolsen@us.ibm.com> | 2017-07-16 09:51:43 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-04-05 09:31:43 -0400 |
commit | e286748a94bde253ec0d0d5bfae7d1df99393546 (patch) | |
tree | 2d13581564bea3b6607aa1caff632291ddc59d7e | |
parent | 3661916096ea58e7a99f031a46982106d593a0b2 (diff) | |
download | talos-hostboot-e286748a94bde253ec0d0d5bfae7d1df99393546.tar.gz talos-hostboot-e286748a94bde253ec0d0d5bfae7d1df99393546.zip |
Code restruct: ring_apply
- Consolidating the three <ppe>_image_ring_generation functions
into a single shared, and renamed, ring_section_generation
function,
- Moving several data centric functions into common_ringId API,
- Use of sizeof(<type or var>) instead of hardcoded assumptions
about structure or data type sizes,
- Renaming of variables which makes sense in the context of the
scope of this commit, such as:
- ringBuffer renamed to ringSection
- ringBufSize renamed to ringSectionSize and type changed to
uint32_t
- Removes the backward compatibility to TORV3/V4 and now only
works with latest TOR version, i.e. 6 at this point.
About the Hw_ImageBuild_Prereq:
- 51511 must have fully propagated into all repos and drivers
used in FSP CI tests before this commit (43175) can be merged.
43175 removes the TORV3/V4 backwards compatibility to support
TOR ring sections that have TOR level DD coordination.
Key_Cronus_Test=XIP_REGRESS
Change-Id: I0af25fa623c1c523eb0297e475066497787f3d15
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/43175
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: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Tested-by: Cronus HW CI <cronushw-ci+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/52211
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Tested-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r-- | src/import/chips/centaur/utils/imageProcs/cen_ringId.C | 2 | ||||
-rw-r--r-- | src/import/chips/centaur/utils/imageProcs/cen_ringId.H | 2 | ||||
-rw-r--r-- | src/import/chips/common/utils/imageProcs/common_ringId.C | 60 | ||||
-rw-r--r-- | src/import/chips/common/utils/imageProcs/common_ringId.H | 31 | ||||
-rw-r--r-- | src/import/chips/p9/procedures/hwp/accessors/p9_mvpd_ring_funcs.C | 44 | ||||
-rw-r--r-- | src/import/chips/p9/utils/imageProcs/p9_ringId.C | 2 | ||||
-rw-r--r-- | src/import/chips/p9/utils/imageProcs/p9_ringId.H | 2 | ||||
-rw-r--r-- | src/import/chips/p9/utils/imageProcs/p9_tor.C | 220 | ||||
-rw-r--r-- | src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H | 1 | ||||
-rw-r--r-- | src/include/usr/fapi2/plat_utils.H | 4 | ||||
-rw-r--r-- | src/usr/fapi2/plat_utils.C | 45 |
11 files changed, 152 insertions, 261 deletions
diff --git a/src/import/chips/centaur/utils/imageProcs/cen_ringId.C b/src/import/chips/centaur/utils/imageProcs/cen_ringId.C index ef2835fd1..cc7594580 100644 --- a/src/import/chips/centaur/utils/imageProcs/cen_ringId.C +++ b/src/import/chips/centaur/utils/imageProcs/cen_ringId.C @@ -187,7 +187,7 @@ void CEN_RID::ringid_get_chiplet_properties( } } -GenRingIdList* CEN_RID::ringid_get_ring_list(RingId_t i_ringId) +GenRingIdList* CEN_RID::_ringid_get_ring_list(RingId_t i_ringId) { ChipletData_t* l_cpltData; GenRingIdList* l_ringList[2]; // 0: common, 1: instance diff --git a/src/import/chips/centaur/utils/imageProcs/cen_ringId.H b/src/import/chips/centaur/utils/imageProcs/cen_ringId.H index e9cff6719..9f3d11c29 100644 --- a/src/import/chips/centaur/utils/imageProcs/cen_ringId.H +++ b/src/import/chips/centaur/utils/imageProcs/cen_ringId.H @@ -415,7 +415,7 @@ ringid_get_chiplet_properties( // returns properties of a ring as determined by ringId GenRingIdList* -ringid_get_ring_list(RingId_t i_ringId); +_ringid_get_ring_list(RingId_t i_ringId); #endif // _CEN_RINGID_H_ diff --git a/src/import/chips/common/utils/imageProcs/common_ringId.C b/src/import/chips/common/utils/imageProcs/common_ringId.C index 8ee9441f1..3528ca557 100644 --- a/src/import/chips/common/utils/imageProcs/common_ringId.C +++ b/src/import/chips/common/utils/imageProcs/common_ringId.C @@ -34,7 +34,7 @@ namespace CEN_RID }; #include <p9_infrastruct_help.H> -// These strings must adhere precisely to the enum of ppeType. +// These strings must adhere precisely to the enum of PpeType. const char* ppeTypeName[] = { "SBE", "CME", "SGPE" @@ -251,6 +251,64 @@ int ringid_get_raw_ring_file_path( uint32_t i_magic, #endif // End of ifndef __HOSTBOOT_MODULE + +int ringid_get_noof_ring_ids( ChipType_t i_chipType, + RingId_t* o_numRingIds) +{ + int rc = INFRASTRUCT_RC_SUCCESS; + + switch (i_chipType) + { + case CT_P9N: + case CT_P9C: + case CT_P9A: + *o_numRingIds = P9_RID::NUM_RING_IDS; + break; + + case CT_CEN: + *o_numRingIds = CEN_RID::NUM_RING_IDS; + break; + + default: + MY_ERR("ringid_get_noof_ring_ids(): Unsupported chipType (=%d) supplied", + i_chipType); + rc = TOR_INVALID_CHIPTYPE; + break; + } + + return rc; +} + + +int ringid_get_ring_list( ChipType_t i_chipType, + RingId_t i_ringId, + GenRingIdList** o_ringIdList) +{ + int rc = INFRASTRUCT_RC_SUCCESS; + + switch (i_chipType) + { + case CT_P9N: + case CT_P9C: + case CT_P9A: + *o_ringIdList = P9_RID::_ringid_get_ring_list(i_ringId); + break; + + case CT_CEN: + *o_ringIdList = CEN_RID::_ringid_get_ring_list(i_ringId); + break; + + default: + MY_ERR("ringid_get_ring_list(): Unsupported chipType (=%d) supplied", + i_chipType); + rc = TOR_INVALID_CHIPTYPE; + break; + } + + return rc; +} + + int ringid_get_noof_chiplets( ChipType_t i_chipType, uint32_t i_torMagic, uint8_t* o_numChiplets ) diff --git a/src/import/chips/common/utils/imageProcs/common_ringId.H b/src/import/chips/common/utils/imageProcs/common_ringId.H index a317ac4b1..7b60d5aed 100644 --- a/src/import/chips/common/utils/imageProcs/common_ringId.H +++ b/src/import/chips/common/utils/imageProcs/common_ringId.H @@ -29,8 +29,6 @@ #include <stdint.h> #include <stddef.h> -#define TORV3_SUPPORT - /////////////////////////////////////////////////////////////////////////////// // Declare assumptions - Begin // // // @@ -87,29 +85,14 @@ typedef struct uint32_t magic; // =TOR_MAGIC_xyz uint8_t version; // =TOR_VERSION ChipType_t chipType; // Value from ChipType enum -#ifdef TORV3_SUPPORT - uint8_t ddLevel; // =0xff if MAGIC_HW, >0 all other MAGICs - uint8_t numDdLevels; // >0 if MAGIC_HW, =1 all other MAGICs -#else uint8_t ddLevel; // Actual DD level of ringSection uint8_t undefined; -#endif uint32_t size; // Size of ringSection. } TorHeader_t; // // Subsequent TOR fields (listed in order they appear in TOR ringSections) // -#ifdef TORV3_SUPPORT -typedef struct -{ - uint32_t offset; - uint32_t size; - uint8_t ddLevel; - uint8_t reserved[3]; -} TorDdBlock_t; -#endif - typedef struct { uint32_t offset; @@ -258,11 +241,8 @@ enum RingType enum RingBlockType { GET_SINGLE_RING = 0x00, -#ifdef TORV3_SUPPORT - GET_DD_LEVEL_RINGS = 0x01, -#endif - GET_PPE_LEVEL_RINGS = 0x02, - PUT_SINGLE_RING = 0x03 + GET_PPE_LEVEL_RINGS = 0x01, + PUT_SINGLE_RING = 0x02 }; typedef struct @@ -351,10 +331,17 @@ int ringid_get_raw_ring_file_path( uint32_t i_magic, char* io_directory ); #endif +int ringid_get_noof_ring_ids( ChipType_t i_chipType, + RingId_t* o_numRingIds); + int ringid_get_noof_chiplets( ChipType_t i_chipType, uint32_t i_torMagic, uint8_t* o_numChiplets ); +int ringid_get_ring_list( ChipType_t i_chipType, + RingId_t i_ringId, + GenRingIdList** o_ringIdList); + int ringid_get_properties( ChipType_t i_chipType, uint32_t i_torMagic, uint8_t i_torVersion, 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 3dcc9024a..5645e364d 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 @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016,2017 */ +/* Contributors Listed Below - COPYRIGHT 2016,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -38,21 +38,13 @@ // #include <stdint.h> -#include <p9_scan_compression.H> - -namespace P9_RID -{ -#include <p9_ringId.H> -} -#include <p9_mvpd_ring_funcs.H> - -// fapi2 support #include <fapi2.H> #include <utils.H> #include <mvpd_access.H> - -using namespace P9_RID; +#include <p9_mvpd_ring_funcs.H> +#include <p9_scan_compression.H> +#include <p9_ringId.H> extern "C" { @@ -534,17 +526,25 @@ extern "C" be64toh(l_pScanDataOld->iv_scanSelect) & l_evenOddMask ) ) { // look up ring in p9_ringId and retrieve scanAddr - GenRingIdList* l_ringProp = ringid_get_ring_list(i_ringId); + int l_rc = INFRASTRUCT_RC_SUCCESS; + ChipType_t l_chipType = CT_P9N; // Any P9 CT will do here + GenRingIdList* l_ringProp = NULL; - FAPI_ASSERT(l_ringProp, - 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 ringId=0x%x, chipletId=0x%x", - i_ringId, - i_chipletId); + 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; diff --git a/src/import/chips/p9/utils/imageProcs/p9_ringId.C b/src/import/chips/p9/utils/imageProcs/p9_ringId.C index 35aed502f..cd99875f1 100644 --- a/src/import/chips/p9/utils/imageProcs/p9_ringId.C +++ b/src/import/chips/p9/utils/imageProcs/p9_ringId.C @@ -622,7 +622,7 @@ void P9_RID::ringid_get_chiplet_properties( } } -GenRingIdList* P9_RID::ringid_get_ring_list(RingId_t i_ringId) +GenRingIdList* P9_RID::_ringid_get_ring_list(RingId_t i_ringId) { ChipletData_t* l_cpltData; GenRingIdList* l_ringList[2]; // 0: common, 1: instance diff --git a/src/import/chips/p9/utils/imageProcs/p9_ringId.H b/src/import/chips/p9/utils/imageProcs/p9_ringId.H index f0941534e..d6cbb5c50 100644 --- a/src/import/chips/p9/utils/imageProcs/p9_ringId.H +++ b/src/import/chips/p9/utils/imageProcs/p9_ringId.H @@ -1261,7 +1261,7 @@ ringid_get_chiplet_properties( // Returns properties of a ring as determined by ringId GenRingIdList* -ringid_get_ring_list(RingId_t i_ringId); +_ringid_get_ring_list(RingId_t i_ringId); #endif diff --git a/src/import/chips/p9/utils/imageProcs/p9_tor.C b/src/import/chips/p9/utils/imageProcs/p9_tor.C index e706599cf..771f026ff 100644 --- a/src/import/chips/p9/utils/imageProcs/p9_tor.C +++ b/src/import/chips/p9/utils/imageProcs/p9_tor.C @@ -303,15 +303,6 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr int rc = 0; uint32_t torMagic; TorHeader_t* torHeader; -#ifdef TORV3_SUPPORT - TorDdBlock_t* torDdBlock; - uint32_t ddLevelCount = 0; - uint32_t ddLevelOffset = 0; - uint32_t ddBlockSize = 0; - void* ddBlockStart = NULL; - uint8_t bDdCheck = 0; - uint32_t ddLevel = 0; -#endif uint8_t* postHeaderStart = (uint8_t*)i_ringSection + sizeof(TorHeader_t); if (i_dbgl > 1) @@ -329,9 +320,6 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr " version: %d\n" " chipType: %d\n" " ddLevel: 0x%x\n" -#ifdef TORV3_SUPPORT - " numDdLevels: %d\n" -#endif " size: %d\n" "API parms\n" " i_ddLevel: 0x%x\n" @@ -339,9 +327,6 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr " i_ringVariant: %d\n", torMagic, torHeader->version, torHeader->chipType, torHeader->ddLevel, -#ifdef TORV3_SUPPORT - torHeader->numDdLevels, -#endif be32toh(torHeader->size), i_ddLevel, i_ppeType, i_ringVariant); @@ -371,96 +356,21 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr " version: %d\n" " chipType: %d\n" " ddLevel: 0x%x (requested ddLevel=0x%x)\n" -#ifdef TORV3_SUPPORT - " numDdLevels: %d\n" -#endif " size: %d\n", torMagic, torHeader->version, torHeader->chipType, torHeader->ddLevel, i_ddLevel, -#ifdef TORV3_SUPPORT - torHeader->numDdLevels, -#endif be32toh(torHeader->size)); return TOR_INVALID_MAGIC_NUMBER; } -#ifdef TORV3_SUPPORT - - if (torMagic == TOR_MAGIC_HW && torHeader->version < 5) - { - - ddLevelCount = torHeader->numDdLevels; - - if (ddLevelCount > MAX_NOOF_DD_LEVELS_IN_IMAGE) - { - MY_ERR("Too many DD levels in image:\n" - " ddLevelCount = %d\n" - " Max no of DD levels = %d\n", - ddLevelCount, MAX_NOOF_DD_LEVELS_IN_IMAGE); - - return TOR_TOO_MANY_DD_LEVELS; - } - else if (i_dbgl > 1) - { - MY_DBG("tor_access_ring(): No of DD levels: %d \n", ddLevelCount); - } - - for (uint8_t i = 0; i < ddLevelCount; i++) - { - torDdBlock = (TorDdBlock_t*)( (uint8_t*)torHeader + - sizeof(TorHeader_t) + - i * sizeof(TorDdBlock_t) ); - ddLevel = torDdBlock->ddLevel; - // Local ddLevelOffset (relative to where the DD blocks start) - ddLevelOffset = be32toh(torDdBlock->offset); - - if (i_dbgl > 1) - { - MY_DBG("tor_access_ring(): Local DD level offset: 0x%08x for DD level: 0x%x \n", - ddLevelOffset, ddLevel ); - } - - if (ddLevel == i_ddLevel) - { - // Calc ddBlockStart from origin of the ringSection to where - // the DD block's PPE block starts. - ddBlockStart = (void*)((uint8_t*)i_ringSection + - sizeof(TorHeader_t) + - ddLevelOffset); - ddBlockSize = htobe32(torDdBlock->size); - bDdCheck = 1; - break; - } - } - - if (!bDdCheck) - { - MY_ERR("Input DD level not found and/or image indicates zero no of DD levels\n" - " i_ddLevel = 0x%x\n" - " ddLevelCount = %d\n", - i_ddLevel, ddLevelCount); - - return TOR_DD_LEVEL_NOT_FOUND; - } - - } - else + if ( i_ddLevel != torHeader->ddLevel && + i_ddLevel != UNDEFINED_DD_LEVEL ) { -#endif - - if ( i_ddLevel != torHeader->ddLevel && - i_ddLevel != UNDEFINED_DD_LEVEL ) - { - MY_ERR("Requested DD level (=0x%x) doesn't match TOR header DD level (=0x%x) nor UNDEFINED_DD_LEVEL (=0x%x) \n", - i_ddLevel, torHeader->ddLevel, UNDEFINED_DD_LEVEL); - return TOR_DD_LEVEL_NOT_FOUND; - } - -#ifdef TORV3_SUPPORT + MY_ERR("Requested DD level (=0x%x) doesn't match TOR header DD level (=0x%x) nor UNDEFINED_DD_LEVEL (=0x%x) \n", + i_ddLevel, torHeader->ddLevel, UNDEFINED_DD_LEVEL); + return TOR_DD_LEVEL_NOT_FOUND; } -#endif - if ( i_ringBlockType == GET_SINGLE_RING || // All Magics support GET ( i_ringBlockType == PUT_SINGLE_RING && // Can only append to SBE,CME,SGPE ( torMagic == TOR_MAGIC_SBE || @@ -474,22 +384,8 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr // Update l_ringSection: // Extract the offset to the specified ppeType's ring section TOR header and update l_ringSection TorPpeBlock_t* torPpeBlock; -#ifdef TORV3_SUPPORT - - if (torHeader->version < 5) - { - torPpeBlock = (TorPpeBlock_t*)((uint8_t*)ddBlockStart + i_ppeType * sizeof(TorPpeBlock_t)); - l_ringSection = (void*)((uint8_t*)ddBlockStart + be32toh(torPpeBlock->offset)); - } - else - { -#endif - torPpeBlock = (TorPpeBlock_t*)(postHeaderStart + i_ppeType * sizeof(TorPpeBlock_t)); - l_ringSection = (void*)(postHeaderStart + be32toh(torPpeBlock->offset)); -#ifdef TORV3_SUPPORT - } - -#endif + torPpeBlock = (TorPpeBlock_t*)(postHeaderStart + i_ppeType * sizeof(TorPpeBlock_t)); + l_ringSection = (void*)(postHeaderStart + be32toh(torPpeBlock->offset)); } rc = get_ring_from_ring_section( l_ringSection, @@ -505,38 +401,6 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr return rc; } -#ifdef TORV3_SUPPORT - else if ( i_ringBlockType == GET_DD_LEVEL_RINGS && - torMagic == TOR_MAGIC_HW && - torHeader->version < 5 ) - { - if (io_ringBlockSize >= ddBlockSize) - { - memcpy( (uint8_t*)(*io_ringBlockPtr), ddBlockStart, ddBlockSize ); - io_ringBlockSize = ddBlockSize; - - return TOR_SUCCESS; - } - else if (io_ringBlockSize == 0) - { - if (i_dbgl > 0) - { - MY_DBG("io_ringBlockSize is zero. Returning required size.\n"); - } - - io_ringBlockSize = ddBlockSize; - - return TOR_SUCCESS; - } - else - { - MY_ERR("io_ringBlockSize is less than required size.\n"); - - return TOR_BUFFER_TOO_SMALL; - } - } - -#endif else if ( i_ringBlockType == GET_PPE_LEVEL_RINGS && torMagic == TOR_MAGIC_HW && (i_ppeType == PT_SBE || i_ppeType == PT_CME || i_ppeType == PT_SGPE) ) @@ -544,42 +408,14 @@ int tor_access_ring( void* i_ringSection, // Ring section ptr TorPpeBlock_t* torPpeBlock; uint32_t ppeSize; -#ifdef TORV3_SUPPORT - - if (torHeader->version < 5) - { - torPpeBlock = (TorPpeBlock_t*)((uint8_t*)ddBlockStart + i_ppeType * sizeof(TorPpeBlock_t)); - } - else - { -#endif - torPpeBlock = (TorPpeBlock_t*)(postHeaderStart + i_ppeType * sizeof(TorPpeBlock_t)); -#ifdef TORV3_SUPPORT - } - -#endif + torPpeBlock = (TorPpeBlock_t*)(postHeaderStart + i_ppeType * sizeof(TorPpeBlock_t)); ppeSize = be32toh(torPpeBlock->size); if (io_ringBlockSize >= ppeSize) { -#ifdef TORV3_SUPPORT - - if (torHeader->version < 5) - { - memcpy( (uint8_t*)(*io_ringBlockPtr), - (uint8_t*)ddBlockStart + be32toh(torPpeBlock->offset), - ppeSize ); - } - else - { -#endif - memcpy( (uint8_t*)(*io_ringBlockPtr), - postHeaderStart + be32toh(torPpeBlock->offset), - ppeSize ); -#ifdef TORV3_SUPPORT - } - -#endif + memcpy( (uint8_t*)(*io_ringBlockPtr), + postHeaderStart + be32toh(torPpeBlock->offset), + ppeSize ); io_ringBlockSize = ppeSize; return TOR_SUCCESS; @@ -699,46 +535,26 @@ int tor_get_block_of_rings ( void* i_ringSection, // Ring section if ( torMagic == TOR_MAGIC_HW && chipType != CT_CEN ) { -#ifdef TORV3_SUPPORT - - if ( i_ppeType == NUM_PPE_TYPES && - torHeader->version < 5 ) + if (i_ppeType == PT_SBE || i_ppeType == PT_CME || i_ppeType == PT_SGPE) { - // Get DD level block of rings + // Get specific PPE block of rings rc = tor_access_ring( i_ringSection, UNDEFINED_RING_ID, i_ddLevel, i_ppeType, i_ringVariant, l_instanceId, - GET_DD_LEVEL_RINGS, + GET_PPE_LEVEL_RINGS, io_ringBlockPtr, io_ringBlockSize, i_ringName, i_dbgl ); } else -#endif - if (i_ppeType == PT_SBE || i_ppeType == PT_CME || i_ppeType == PT_SGPE) - { - // Get specific PPE block of rings - rc = tor_access_ring( i_ringSection, - UNDEFINED_RING_ID, - i_ddLevel, - i_ppeType, - i_ringVariant, - l_instanceId, - GET_PPE_LEVEL_RINGS, - io_ringBlockPtr, - io_ringBlockSize, - i_ringName, - i_dbgl ); - } - else - { - MY_ERR("tor_get_block_of_rings(): Ambiguous API parameters\n"); - return TOR_AMBIGUOUS_API_PARMS; - } + { + MY_ERR("tor_get_block_of_rings(): Ambiguous API parameters\n"); + return TOR_AMBIGUOUS_API_PARMS; + } } else { diff --git a/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H b/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H index f516425ad..4ab4a3abb 100644 --- a/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H +++ b/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H @@ -143,6 +143,7 @@ namespace fapi2 RC_INCORRECT_HW_IMAGE_TYPE = FAPI2_COMP_ID | 0x3D, RC_DD_SUPPORT_CHECK_FAILED = FAPI2_COMP_ID | 0x3E, RC_SET_ATTR_NOT_VALID = FAPI2_COMP_ID | 0x3F, + RC_FAILED_TO_GET_RING_LIST = FAPI2_COMP_ID | 0x40, // HWP generated errors RC_HWP_GENERATED_ERROR = HWPF_COMP_ID | 0x0f, diff --git a/src/include/usr/fapi2/plat_utils.H b/src/include/usr/fapi2/plat_utils.H index 7e04e82f5..753d937d6 100644 --- a/src/include/usr/fapi2/plat_utils.H +++ b/src/include/usr/fapi2/plat_utils.H @@ -34,6 +34,7 @@ #define PLAT_UTILS_H_ #include <return_code.H> +#include <common_ringId.H> namespace fapi2 { @@ -106,7 +107,8 @@ ReturnCode platSpecialWakeup( const Target<TARGET_TYPE_ALL>& i_target, /// template<fapi2::TargetType T> ReturnCode get_ring(fapi2::Target<T> i_target, - const uint16_t i_ringId, unsigned char *&o_ringData, + const RingId_t i_ringId, + unsigned char *&o_ringData, uint64_t &o_ringLength, uint64_t &o_ringAddress); diff --git a/src/usr/fapi2/plat_utils.C b/src/usr/fapi2/plat_utils.C index 5c2b30bb3..0d2c0d747 100644 --- a/src/usr/fapi2/plat_utils.C +++ b/src/usr/fapi2/plat_utils.C @@ -45,15 +45,11 @@ #include <pnor/pnorif.H> #include <p9_xip_image.h> #include <p9_tor.H> -#include <common_ringId.H> #include <p9_scan_compression.H> +#include <cen_ringId.H> #include "handleSpecialWakeup.H" -namespace CEN_RID { -#include <cen_ringId.H> -} - //****************************************************************************** // Trace descriptors //****************************************************************************** @@ -96,7 +92,7 @@ ReturnCode current_err; template<> ReturnCode get_ring(Target<TARGET_TYPE_MEMBUF_CHIP>i_target, - const uint16_t i_ringId, + const RingId_t i_ringId, unsigned char *&o_ringData, size_t &o_ringLength, uint64_t &o_ringAddress) @@ -227,7 +223,7 @@ ReturnCode get_ring(Target<TARGET_TYPE_MEMBUF_CHIP>i_target, FAPI_INF("get_ring() - got the ring section.."); - char ringName[50] = {0}; + char ringName[MAX_RING_NAME_LENGTH] = {0}; // only a single instance for centaur uint8_t instanceId = 1; @@ -348,8 +344,39 @@ ReturnCode get_ring(Target<TARGET_TYPE_MEMBUF_CHIP>i_target, o_ringLength = l_ringSizeInBits; // grab the address from the Generic ring id list - GenRingIdList* l_idList = - CEN_RID::ringid_get_ring_list(l_ringId); + GenRingIdList* l_idList; + + rc = ringid_get_ring_list(CT_CEN, l_ringId, &l_idList); + + if (rc != INFRASTRUCT_RC_SUCCESS) + { + FAPI_ERR("get_ring() - call to ringid_get_ring_list() " + "failed w/rc=%d", rc); + + /*@ + * @errortype + * @moduleid fapi2::MOD_FAPI2_GET_RING + * @reasoncode fapi2::RC_FAILED_TO_GET_RING_LIST + * @userdata1 return code from ringid_get_ring_list + * @devdesc There was an error returned from the + * common ringid_get_ring_list API - see + * userdata1 for return code value. + * @custdesc Internal firmware error + */ + l_err = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + fapi2::MOD_FAPI2_GET_RING, + fapi2::RC_FAILED_TO_GET_RING_LIST, + rc, + 0, + true /*SW error*/); + + l_err->collectTrace(FAPI_TRACE_NAME); + + l_fapi2Rc.setPlatDataPtr(reinterpret_cast<void *>(l_err)); + + break; + } o_ringAddress = l_idList->scanScomAddress; |