summaryrefslogtreecommitdiffstats
path: root/src/hwpf
diff options
context:
space:
mode:
Diffstat (limited to 'src/hwpf')
-rw-r--r--src/hwpf/include/plat/plat_target_utils.H2
-rw-r--r--src/hwpf/src/plat/plat_attribute_service.H4
-rw-r--r--src/hwpf/src/plat/target.C66
3 files changed, 68 insertions, 4 deletions
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##_Type>(ID, PTARGET, VAL)
+#define PLAT_ATTR_INIT(ID, TARGET, VAL) \
+ (fapi2::checkIdType<ID##_Type>(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 <assert.h>
#include <fapi2_target.H>
#include <plat_target_utils.H>
+#include <p9_perv_scom_addresses.H>
// 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<fapi2::TARGET_TYPE_PROC_CHIP> 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<uint8_t>(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<TARGET_TYPE_PERV>(
@@ -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<plat_target_handle_t&>((i_chiplet_target.operator()())).setPresent();
+ }
+ }
+ else if( i_chiplet_target.getChipletNumber() < EQ_CHIPLET_OFFSET )
{
static_cast<plat_target_handle_t&>((i_chiplet_target.operator()())).setPresent();
}
@@ -439,6 +495,10 @@ fapi_try_exit:
fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> chip_target((createPlatTargetHandle<fapi2::TARGET_TYPE_PROC_CHIP>(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
*/
OpenPOWER on IntegriCloud