From 956172a5f70d79fbc62b2829d4952f85b6140056 Mon Sep 17 00:00:00 2001 From: Santosh Puranik Date: Wed, 5 Apr 2017 09:51:55 -0500 Subject: Cumulus ATTR_NAME Support Change-Id: I47946f25067c1d7cf6f56e1734406d1416269f5b Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38212 Tested-by: Jenkins Server Reviewed-by: Sachin Gupta Reviewed-by: Shakeeb A. Pasha B K Tested-by: FSP CI Jenkins Reviewed-by: Santosh S. Puranik --- src/hwpf/include/plat/plat_target_utils.H | 2 +- src/hwpf/src/plat/plat_attribute_service.H | 4 ++ src/hwpf/src/plat/target.C | 66 ++++++++++++++++++++++++++++-- 3 files changed, 68 insertions(+), 4 deletions(-) (limited to 'src/hwpf') diff --git a/src/hwpf/include/plat/plat_target_utils.H b/src/hwpf/include/plat/plat_target_utils.H index 523dfca4..9d3e520f 100644 --- a/src/hwpf/include/plat/plat_target_utils.H +++ b/src/hwpf/include/plat/plat_target_utils.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2016 */ +/* Contributors Listed Below - COPYRIGHT 2012,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ diff --git a/src/hwpf/src/plat/plat_attribute_service.H b/src/hwpf/src/plat/plat_attribute_service.H index c54a5f28..008132c3 100644 --- a/src/hwpf/src/plat/plat_attribute_service.H +++ b/src/hwpf/src/plat/plat_attribute_service.H @@ -46,6 +46,10 @@ #define PLAT_GET_CHIP_EC_FEATURE_OVERRIDE(ID, PTARGET, VAL) \ _getEcFeatureOverride(ID, PTARGET, VAL) +#define PLAT_ATTR_INIT(ID, TARGET, VAL) \ + (fapi2::checkIdType(ID, VAL), \ + ID##_PLAT_INIT(ID, TARGET, VAL)) + /* INSERT NEW ATTRIBUTES HERE */ diff --git a/src/hwpf/src/plat/target.C b/src/hwpf/src/plat/target.C index 60cfe47a..8ab8f0f4 100644 --- a/src/hwpf/src/plat/target.C +++ b/src/hwpf/src/plat/target.C @@ -28,6 +28,7 @@ #include #include #include +#include // Global Vector containing ALL targets. This structure is referenced by // fapi2::getChildren to produce the resultant returned vector from that @@ -46,6 +47,51 @@ fapi2attr::EXAttributes_t* G_ex_attributes_ptr; namespace fapi2 { + static ReturnCode plat_AttrInit() + { + union + { + struct + { + uint64_t iv_majorEC : 4; + uint64_t iv_deviceIdDontCare : 4; + uint64_t iv_minorEC : 4; + uint64_t iv_chipId : 8; + uint64_t iv_deviceIdDontCare2 : 20; + uint64_t iv_c4Pin : 1; + uint64_t iv_deviceIdDontCare3 : 23; + }; + uint64_t iv_deviceIdReg; + } l_deviceId; + + uint8_t l_chipName = fapi2::ENUM_ATTR_NAME_NONE; + uint8_t l_ec = 0; + fapi2::Target l_chipTarget = + plat_getChipTarget(); + + FAPI_TRY(getscom_abs(PERV_DEVICE_ID_REG, &l_deviceId.iv_deviceIdReg)); + l_ec = (l_deviceId.iv_majorEC << 4) | (l_deviceId.iv_minorEC); + switch(l_deviceId.iv_chipId) + { + case 0xD1: + l_chipName = fapi2::ENUM_ATTR_NAME_NIMBUS; + break; + case 0xD4: + l_chipName = fapi2::ENUM_ATTR_NAME_CUMULUS; + break; + default: + FAPI_ERR("Unsupported chip ID: 0x%02X", + static_cast(l_deviceId.iv_chipId)); + assert(false); + } + + FAPI_TRY(PLAT_ATTR_INIT(fapi2::ATTR_NAME, l_chipTarget, l_chipName)); + + FAPI_TRY(PLAT_ATTR_INIT(fapi2::ATTR_EC, l_chipTarget, l_ec)); +fapi_try_exit: + return fapi2::current_err; + } + // Get the plat target handle by chiplet number - For PERV targets template<> plat_target_handle_t plat_getTargetHandleByChipletNumber( @@ -350,6 +396,10 @@ namespace fapi2 bool & b_present) { + uint8_t l_chipName = fapi2::ENUM_ATTR_NAME_NONE; + + FAPI_TRY(FAPI_ATTR_GET_PRIVILEGED(fapi2::ATTR_NAME, plat_getChipTarget(), l_chipName)); + // TODO via RTC 164026 // In nimbus all pervasive chiplets (non quad, non core), are present // other than OBUS1 and OBUS2. In cumulus all chiplets are present. @@ -363,9 +413,15 @@ namespace fapi2 // attribute to differentiate between nimbus versus cumulus config. static const size_t OBUS1 = 10; static const size_t OBUS2 = 11; - if(( i_chiplet_target.getChipletNumber() != OBUS1 ) && - ( i_chiplet_target.getChipletNumber() != OBUS2 ) && - ( i_chiplet_target.getChipletNumber() < EQ_CHIPLET_OFFSET ) ) + if((OBUS1 == i_chiplet_target.getChipletNumber()) || + (OBUS2 == i_chiplet_target.getChipletNumber())) + { + if(fapi2::ENUM_ATTR_NAME_CUMULUS == l_chipName) + { + static_cast((i_chiplet_target.operator()())).setPresent(); + } + } + else if( i_chiplet_target.getChipletNumber() < EQ_CHIPLET_OFFSET ) { static_cast((i_chiplet_target.operator()())).setPresent(); } @@ -439,6 +495,10 @@ fapi_try_exit: fapi2::Target chip_target((createPlatTargetHandle(0))); G_vec_targets.at(l_beginning_offset) = revle32((fapi2::plat_target_handle_t)(chip_target.get())); + // Initialize platform attributes. Needs to be after the chip target is + // created. + FAPI_TRY(plat_AttrInit()); + /* * Nest Targets - group 1 */ -- cgit v1.2.1