summaryrefslogtreecommitdiffstats
path: root/hwpf
diff options
context:
space:
mode:
authorGreg Still <stillgs@us.ibm.com>2015-07-20 07:27:48 -0500
committerAmit J. Tendolkar <amit.tendolkar@in.ibm.com>2015-08-19 11:07:29 -0500
commitf3c18a2e5d3af5d66100b502091f636d219c3655 (patch)
treea5467166a2032e474059d1b3fcb4658d6c29f131 /hwpf
parent316f046100d70f6d8f0e1eda0174f49a797c1264 (diff)
downloadtalos-sbe-f3c18a2e5d3af5d66100b502091f636d219c3655.tar.gz
talos-sbe-f3c18a2e5d3af5d66100b502091f636d219c3655.zip
Honor PPE partial good attributes to intialize targets
- Addressed internal Gerrit comments - Addressed compilation issues with real procedures - Fix image tool "clean" function (updated) (deals with missing tools/image/bin) - make "clean" fixup - Get vector of attribute values properly into the image - Fix FAPI_ATTR_* signature from target pointer to target reference - ATTR_CHIP_UNIT_POS support for non-core/cache chiplets - Require FAPI_ATTR_GET/SET invocation to be in the form of fapi2::ATTR_.... - Fix tools bin directory creation issue - Address plat_PervPGTargets error case - Add FAPI_EXEC_HW support to deal with recently merged functions - Update libcommonerrors.mk to deal with recently merged compilation issue Change-Id: I31485ff05731e7fbaa0453d8ed9985b9ca56b8b3 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/19342 Tested-by: Jenkins Server Reviewed-by: Gregory S. Still <stillgs@us.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com> Reviewed-by: Amit J. Tendolkar <amit.tendolkar@in.ibm.com>
Diffstat (limited to 'hwpf')
-rw-r--r--hwpf/plat/include/fapi2.H2
-rw-r--r--hwpf/plat/include/fapi2_target.H88
-rw-r--r--hwpf/plat/include/hwp_executor.H59
-rw-r--r--hwpf/plat/include/plat_attributes.H1
-rw-r--r--hwpf/plat/include/plat_target_parms.H8
-rw-r--r--hwpf/plat/include/plat_target_pg_attributes.H97
-rw-r--r--hwpf/plat/include/target.H66
-rw-r--r--hwpf/plat/src/target.C357
8 files changed, 516 insertions, 162 deletions
diff --git a/hwpf/plat/include/fapi2.H b/hwpf/plat/include/fapi2.H
index 178860fc..de2295b4 100644
--- a/hwpf/plat/include/fapi2.H
+++ b/hwpf/plat/include/fapi2.H
@@ -35,7 +35,7 @@
#include <plat_target_utils.H>
-#include <hwp_executor.H>
+#include <fapi2_hwp_executor.H>
// Block of headers not currently in fapi2
#ifdef FAPI2_MISSING_HEADERS
diff --git a/hwpf/plat/include/fapi2_target.H b/hwpf/plat/include/fapi2_target.H
index 47b6d55a..32b68618 100644
--- a/hwpf/plat/include/fapi2_target.H
+++ b/hwpf/plat/include/fapi2_target.H
@@ -94,7 +94,7 @@ namespace fapi2
/// they might need. value( K | V ), for example
///
Target(V Value);
-
+
// Target(V Value):
// iv_handle(Value)
// {}
@@ -176,7 +176,7 @@ namespace fapi2
{
// return ( (K == TARGET_TYPE_PROC_CHIP) ||
// (K == TARGET_TYPE_MEMBUF_CHIP) );
-
+
return ( (K == TARGET_TYPE_PROC_CHIP) );
}
@@ -249,44 +249,44 @@ namespace fapi2
}
#ifdef __PPE__
-
- ///
- /// @brief Get the target present setting
- /// @return Bool whether present
- ///
- inline bool getPresent(void) const
- {
- return (this->iv_handle.fields.present ? true : false);
- }
-
- ///
- /// @brief Get the target functional setting
- /// @return Bool whether functional
- ///
- inline bool getFunctional(void) const
- {
- return (this->iv_handle.fields.functional ? true : false);
- }
-
- ///
- /// @brief Set the target present setting
- /// @return Bool whether present
- ///
- inline void setPresent(void) const
- {
- this->iv_handle.fields.present = 1;
- return;
- }
-
- ///
- /// @brief Set the target functional setting
- /// @return Bool whether functional
- ///
- inline void setFunctional(void) const
- {
- this->iv_handle.fields.functional = 1;
- return;
- }
+
+ ///
+ /// @brief Get the target present setting
+ /// @return Bool whether present
+ ///
+ inline bool getPresent(void) const
+ {
+ return (this->iv_handle.fields.present ? true : false);
+ }
+
+ ///
+ /// @brief Get the target functional setting
+ /// @return Bool whether functional
+ ///
+ inline bool getFunctional(void) const
+ {
+ return (this->iv_handle.fields.functional ? true : false);
+ }
+
+ ///
+ /// @brief Set the target present setting
+ /// @return Bool whether present
+ ///
+ inline void setPresent(void)
+ {
+ this->iv_handle.fields.present = 1;
+ return;
+ }
+
+ ///
+ /// @brief Set the target functional setting
+ /// @return Bool whether functional
+ ///
+ inline void setFunctional(void)
+ {
+ this->iv_handle.fields.functional = 1;
+ return;
+ }
/// Need to optimize PPE Target resoulution in a cheap manner
@@ -310,7 +310,7 @@ namespace fapi2
{
return static_cast<uint32_t>(this->iv_handle.fields.type_target_num);
}
-
+
///
/// @brief Get target type directly from the handle
/// @return Overlay as a type V
@@ -319,7 +319,7 @@ namespace fapi2
{
return static_cast<TargetTypes_t>(this->iv_handle.fields.type);
}
-
+
///
/// @brief Get chiplet number from the handle
/// @return ChipletNumber_t Chiplet Number
@@ -328,7 +328,7 @@ namespace fapi2
{
return static_cast<ChipletNumber_t>(this->iv_handle.fields.chiplet_num);
}
-
+
#endif
@@ -362,7 +362,7 @@ namespace fapi2
// iv_handle(V i_value = 0):value(i_value) {}
} iv_handle;
};
-
+
// EX threads map to CORE threads:
// t0 / t2 / t4 / t6 fused = t0 / t1 / t2 / t3 normal (c0)
// t1 / t3 / t5 / t7 fused = t0 / t1 / t2 / t3 normal (c1)
diff --git a/hwpf/plat/include/hwp_executor.H b/hwpf/plat/include/hwp_executor.H
index e69de29b..5a451081 100644
--- a/hwpf/plat/include/hwp_executor.H
+++ b/hwpf/plat/include/hwp_executor.H
@@ -0,0 +1,59 @@
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// fipsrefactordoc src/hwpf/plat/fapi2PlatHwpExecutor.H 1.1
+//
+// IBM CONFIDENTIAL
+//
+// OBJECT CODE ONLY SOURCE MATERIALS
+//
+// COPYRIGHT International Business Machines Corp. 2011
+// All Rights Reserved
+//
+// The source code for this program is not published or otherwise
+// divested of its trade secrets, irrespective of what has been
+// deposited with the U.S. Copyright Office.
+//
+// IBM_PROLOG_END_TAG
+/**
+ * @file fapi2PlatHwpExecutor.H
+ *
+ * @brief Defines the FAPI HWP Executor Macro.
+ *
+ * The HWP Executor macro is called when a PLAT invoker function or a HWP wants
+ * to execute a HWP. Each platform can modify the macro to do any platform
+ * specific work to execute the HWP (e.g. dlopening a shared library)
+ */
+
+#ifndef FAPI2PLATHWPEXECUTOR_H_
+#define FAPI2PLATHWPEXECUTOR_H_
+
+/**
+ * @brief HWP Executor macro
+ *
+ * By default, this macro just calls the HWP directly. If this cannot be done
+ * then the platform needs to modify
+ */
+
+#include <return_code.H>
+#include <target.H>
+#include <string>
+
+
+
+// Macro to execute an arbitrary function with an arbitray number of arguments. The
+// function is in a shared lib that must be dlopened. All that is required is that
+// there is a typedef for the function pointer available that is called <FUNC>_FP_t
+// i.e. if the function is called foo, then the typedef is called foo_FP_t
+#define FAPI_PLAT_EXEC_HWP(RC, FUNC, _args_...) \
+{\
+ RC = FUNC(_args_); \
+}
+
+#define FAPI_PLAT_EXEC_HWP_LAMBDA(FUNC, _args_...) \
+[&]()->fapi2::ReturnCode \
+{\
+ FUNC(_args_); \
+}()
+
+#endif // FAPI2PLATHWPEXECUTOR_H_
diff --git a/hwpf/plat/include/plat_attributes.H b/hwpf/plat/include/plat_attributes.H
index 2a55b221..894d516d 100644
--- a/hwpf/plat/include/plat_attributes.H
+++ b/hwpf/plat/include/plat_attributes.H
@@ -32,5 +32,6 @@
#include <fapi2AttributeService.H>
#include <fapi2AttributeIds.H> // Generated file
+//#include <plat_target_pg_attributes.H>
#endif // __PLAT_ATTTRIBUTE_H__
diff --git a/hwpf/plat/include/plat_target_parms.H b/hwpf/plat/include/plat_target_parms.H
index bbe4b8ba..d495241a 100644
--- a/hwpf/plat/include/plat_target_parms.H
+++ b/hwpf/plat/include/plat_target_parms.H
@@ -36,19 +36,22 @@
CONST_UINT32_T(CHIP_TARGET_OFFSET, 0);
CONST_UINT32_T(CHIP_TARGET_COUNT , 1);
-
+// Pervasive Targets (note; these include the MCS targets as well)
CONST_UINT32_T(PERV_TARGET_OFFSET, CHIP_TARGET_OFFSET + CHIP_TARGET_COUNT);
CONST_UINT32_T(PERV_CHIPLET_OFFSET, 0x1);
CONST_UINT32_T(PERV_TARGET_COUNT, 15);
+// Cache Targets
CONST_UINT32_T(EQ_TARGET_OFFSET, PERV_TARGET_OFFSET + PERV_TARGET_COUNT);
CONST_UINT32_T(EQ_CHIPLET_OFFSET, 0x10);
CONST_UINT32_T(EQ_TARGET_COUNT, 6);
+// Core Targets
CONST_UINT32_T(CORE_TARGET_OFFSET, EQ_TARGET_OFFSET + EQ_TARGET_COUNT);
CONST_UINT32_T(CORE_CHIPLET_OFFSET, 0x20);
CONST_UINT32_T(CORE_TARGET_COUNT, 24);
+// MCS Targets (note: these are phyically Pervastive targets)
CONST_UINT32_T(MCS_TARGET_OFFSET, CORE_TARGET_OFFSET + CORE_TARGET_COUNT);
CONST_UINT32_T(MCS_CHIPLET_OFFSET, 0x7);
CONST_UINT32_T(MCS_TARGET_COUNT, 2);
@@ -57,9 +60,6 @@ CONST_UINT32_T(EX_TARGET_OFFSET, MCS_TARGET_OFFSET + MCS_TARGET_COUNT);
CONST_UINT32_T(EX_CHIPLET_OFFSET, 0x10);
CONST_UINT32_T(EX_TARGET_COUNT, 12);
-
-//CONST_UINT32_T(TARGET_COUNT, EX_TARGET_OFFSET + EX_TARGET_COUNT);
-
CONST_UINT32_T(TARGET_COUNT, CHIP_TARGET_COUNT +
PERV_TARGET_COUNT +
EQ_TARGET_COUNT +
diff --git a/hwpf/plat/include/plat_target_pg_attributes.H b/hwpf/plat/include/plat_target_pg_attributes.H
new file mode 100644
index 00000000..e27a1784
--- /dev/null
+++ b/hwpf/plat/include/plat_target_pg_attributes.H
@@ -0,0 +1,97 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+/**
+ * @file plat_target_pg_attribute.H
+ * @brief Definitions for fapi2 PPE targets' partial good attribute mapping
+ */
+
+#ifndef __FAPI2_PPE_TARGET_PG_ATTR__
+#define __FAPI2_PPE_TARGET_PG_ATTR__
+
+
+typedef struct chiplet_pg_entry_t
+{
+ // char[16] pg_attribute;
+ uint32_t pg_attribute;
+ uint8_t target_type;
+ uint16_t relative_target_num;
+} chiplet_pg_entry_t;
+
+const chiplet_pg_entry_t CHIPLET_PG_ARRAY[] =
+{
+ // Pervasive Chiplets
+ { fapi2::ATTR_PG_PRV , fapi2::TARGET_TYPE_PERV, 0x01 },
+ { fapi2::ATTR_PG_N0 , fapi2::TARGET_TYPE_PERV, 0x02 },
+ { fapi2::ATTR_PG_N1 , fapi2::TARGET_TYPE_PERV, 0x03 },
+ { fapi2::ATTR_PG_N2 , fapi2::TARGET_TYPE_PERV, 0x04 },
+ { fapi2::ATTR_PG_N3 , fapi2::TARGET_TYPE_PERV, 0x05 },
+ { fapi2::ATTR_PG_XB , fapi2::TARGET_TYPE_PERV, 0x06 },
+ { fapi2::ATTR_PG_MC01, fapi2::TARGET_TYPE_PERV, 0x07 },
+ { fapi2::ATTR_PG_MC23, fapi2::TARGET_TYPE_PERV, 0x08 },
+ { fapi2::ATTR_PG_OB0 , fapi2::TARGET_TYPE_PERV, 0x09 },
+ { fapi2::ATTR_PG_OB1 , fapi2::TARGET_TYPE_PERV, 0x0A },
+ { fapi2::ATTR_PG_OB2 , fapi2::TARGET_TYPE_PERV, 0x0B },
+ { fapi2::ATTR_PG_OB3 , fapi2::TARGET_TYPE_PERV, 0x0C },
+ { fapi2::ATTR_PG_PCI0, fapi2::TARGET_TYPE_PERV, 0x0D },
+ { fapi2::ATTR_PG_PCI1, fapi2::TARGET_TYPE_PERV, 0x0E },
+ { fapi2::ATTR_PG_PCI2, fapi2::TARGET_TYPE_PERV, 0x0F },
+ // EQ Chiplets
+ { fapi2::ATTR_PG_EQ0 , fapi2::TARGET_TYPE_EQ, 0x00 },
+ { fapi2::ATTR_PG_EQ1 , fapi2::TARGET_TYPE_EQ, 0x01 },
+ { fapi2::ATTR_PG_EQ2 , fapi2::TARGET_TYPE_EQ, 0x02 },
+ { fapi2::ATTR_PG_EQ3 , fapi2::TARGET_TYPE_EQ, 0x03 },
+ { fapi2::ATTR_PG_EQ4 , fapi2::TARGET_TYPE_EQ, 0x04 },
+ { fapi2::ATTR_PG_EQ5 , fapi2::TARGET_TYPE_EQ, 0x05 },
+ // Core Chiplets
+ { fapi2::ATTR_PG_EC00, fapi2::TARGET_TYPE_CORE, 0x00 },
+ { fapi2::ATTR_PG_EC01, fapi2::TARGET_TYPE_CORE, 0x01 },
+ { fapi2::ATTR_PG_EC02, fapi2::TARGET_TYPE_CORE, 0x02 },
+ { fapi2::ATTR_PG_EC03, fapi2::TARGET_TYPE_CORE, 0x03 },
+ { fapi2::ATTR_PG_EC04, fapi2::TARGET_TYPE_CORE, 0x04 },
+ { fapi2::ATTR_PG_EC05, fapi2::TARGET_TYPE_CORE, 0x05 },
+ { fapi2::ATTR_PG_EC06, fapi2::TARGET_TYPE_CORE, 0x06 },
+ { fapi2::ATTR_PG_EC07, fapi2::TARGET_TYPE_CORE, 0x07 },
+ { fapi2::ATTR_PG_EC08, fapi2::TARGET_TYPE_CORE, 0x08 },
+ { fapi2::ATTR_PG_EC09, fapi2::TARGET_TYPE_CORE, 0x09 },
+ { fapi2::ATTR_PG_EC10, fapi2::TARGET_TYPE_CORE, 0x0A },
+ { fapi2::ATTR_PG_EC11, fapi2::TARGET_TYPE_CORE, 0x0B },
+ { fapi2::ATTR_PG_EC12, fapi2::TARGET_TYPE_CORE, 0x0C },
+ { fapi2::ATTR_PG_EC13, fapi2::TARGET_TYPE_CORE, 0x0D },
+ { fapi2::ATTR_PG_EC14, fapi2::TARGET_TYPE_CORE, 0x0E },
+ { fapi2::ATTR_PG_EC15, fapi2::TARGET_TYPE_CORE, 0x0F },
+ { fapi2::ATTR_PG_EC16, fapi2::TARGET_TYPE_CORE, 0x10 },
+ { fapi2::ATTR_PG_EC17, fapi2::TARGET_TYPE_CORE, 0x11 },
+ { fapi2::ATTR_PG_EC18, fapi2::TARGET_TYPE_CORE, 0x12 },
+ { fapi2::ATTR_PG_EC19, fapi2::TARGET_TYPE_CORE, 0x13 },
+ { fapi2::ATTR_PG_EC20, fapi2::TARGET_TYPE_CORE, 0x14 },
+ { fapi2::ATTR_PG_EC21, fapi2::TARGET_TYPE_CORE, 0x15 },
+ { fapi2::ATTR_PG_EC22, fapi2::TARGET_TYPE_CORE, 0x16 },
+ { fapi2::ATTR_PG_EC23, fapi2::TARGET_TYPE_CORE, 0x17 }
+};
+
+uint32_t CHIPLET_PG_ARRAY_ENTRIES = sizeof(CHIPLET_PG_ARRAY) /
+ sizeof(chiplet_pg_entry_t);
+
+#endif // __FAPI2_PPE_TARGET_PG_ATTR__
diff --git a/hwpf/plat/include/target.H b/hwpf/plat/include/target.H
index cce4e86e..0c40642b 100644
--- a/hwpf/plat/include/target.H
+++ b/hwpf/plat/include/target.H
@@ -77,13 +77,6 @@ namespace fapi2
if(K & TARGET_TYPE_CORE)
{
- /*
- if (Value > CORE_CHIPLET_COUNT)
- {
- PK_TRACE("Chiplet number is greater than CORE_CHIPLET_COUNT");
- return -1;
- }
- */
this->iv_handle.fields.chiplet_num = Value + CORE_CHIPLET_OFFSET;
this->iv_handle.fields.type = TARGET_TYPE_CORE | TARGET_TYPE_PERV;
this->iv_handle.fields.type_target_num = Value;
@@ -112,67 +105,11 @@ namespace fapi2
this->iv_handle.fields.type_target_num = Value;
}
-// if(K & TARGET_TYPE_EQ_MC_WRITE)
-// {
-// this->iv_handle.fields.chiplet_num =
-// (((MC_ENABLE) |
-// ((MC_WRITE << 3) | (Value & 0x07))) &
-// BITS(57,7));
-// this->iv_handle.fields.type = TARGET_TYPE_EQ_MC_WRITE;
-// }
-//
-// if(K & TARGET_TYPE_EQ_MC_READOR)
-// {
-// this->iv_handle.fields.chiplet_num =
-// (((MC_ENABLE) |
-// ((MC_READ_OR << 3) | (Value & 0x07))) &
-// BITS(57,7));
-// this->iv_handle.fields.type = TARGET_TYPE_EQ_MC_READOR;
-// }
-//
-// if(K & TARGET_TYPE_EQ_MC_READAND)
-// {
-// this->iv_handle.fields.chiplet_num =
-// (((MC_ENABLE) |
-// ((MC_READ_AND << 3) | (Value & 0x07))) &
-// BITS(57,7));
-// this->iv_handle.fields.type = TARGET_TYPE_EQ_MC_READAND;
-// }
-//
-// if(K & TARGET_TYPE_CORE_MC_WRITE)
-// {
-// this->iv_handle.fields.chiplet_num =
-// (((MC_ENABLE) |
-// ((MC_WRITE << 3) | (Value & 0x07))) &
-// BITS(57,7));
-// this->iv_handle.fields.type = TARGET_TYPE_CORE_MC_WRITE;
-// }
-//
-// if(K & TARGET_TYPE_CORE_MC_READOR)
-// {
-// this->iv_handle.fields.chiplet_num =
-// (((MC_ENABLE) |
-// ((MC_READ_OR << 3) | (Value & 0x07))) &
-// BITS(57,7));
-// this->iv_handle.fields.type = TARGET_TYPE_CORE_MC_READOR;
-// }
-//
-// if(K & TARGET_TYPE_CORE_MC_READAND)
-// {
-// this->iv_handle.fields.chiplet_num =
-// (((MC_ENABLE) |
-// ((MC_READ_AND << 3) | (Value & 0x07))) &
-// BITS(57,7));
-// this->iv_handle.fields.type = TARGET_TYPE_CORE_MC_READAND;
-// }
-
if(K == TARGET_TYPE_ALL)
{
this->iv_handle.fields.chiplet_num = Value;
this->iv_handle.fields.type = TARGET_TYPE_ALL;
}
- this->iv_handle.fields.present = 1;
- this->iv_handle.fields.functional = 1;
this->iv_handle.fields.address_overlay =
(this->iv_handle.fields.chiplet_num << 24);
@@ -235,7 +172,8 @@ namespace fapi2
///
/// @brief Get this target's children
- /// @tparam T The type of the parent
+ /// @tparam K The type of the parent
+ /// @tparam T The type of child
/// @param[in] i_state The desired TargetState of the children
/// @return std::vector<Target<T> > a vector of present/functional
/// children
diff --git a/hwpf/plat/src/target.C b/hwpf/plat/src/target.C
index 4b422f3c..bceb2e33 100644
--- a/hwpf/plat/src/target.C
+++ b/hwpf/plat/src/target.C
@@ -23,14 +23,18 @@
/* */
/* IBM_PROLOG_END_TAG */
-#include <target.H>
+
+#include <fapi2.H>
#include <new>
#include <utility> // For move
+#include <plat_target_pg_attributes.H>
+
// Global Vector containing ALL targets. This structure is referenced by
// fapi2::getChildren to produce the resultant returned vector from that
// call.
std::vector<fapi2::plat_target_handle_t> G_vec_targets;
+
namespace fapi2
{
@@ -38,11 +42,257 @@ namespace fapi2
ReturnCode current_err;
#endif
+
+ // Not a fan of the switch technique; I would prefer an array lookup
+ // but the attritute lookup is done via compile time macros that are
+ // resolved to attribute Ids (hashes).
+ fapi2::ReturnCode plat_PervPGTargets(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_target,
+ const fapi2::TargetTypes_t i_chiplet_num,
+ bool & o_present)
+ {
+
+ o_present = false;
+ uint16_t attr_value = 0;
+ switch (i_chiplet_num)
+ {
+ case 0x00: // Nop
+ break;
+ case 0x01:
+ FAPI_ATTR_GET(ATTR_PG_PRV, i_target, *(&attr_value));
+ FAPI_DBG("ATTR_PG_PRV value = %x", attr_value);
+ break;
+ case 0x02:
+ FAPI_ATTR_GET(ATTR_PG_N0, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_N0 value = %x", attr_value);
+ break;
+ case 0x03:
+ FAPI_ATTR_GET(ATTR_PG_N1, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_N1 value = %x", attr_value);
+ break;
+ case 0x04:
+ FAPI_ATTR_GET(ATTR_PG_N2, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_N2 value = %x", attr_value);
+ break;
+ case 0x05:
+ FAPI_ATTR_GET(ATTR_PG_N3, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_N0 value = %x", attr_value);
+ break;
+ case 0x06:
+ FAPI_ATTR_GET(ATTR_PG_XB, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_XB value = %x", attr_value);
+ break;
+ case 0x07:
+ FAPI_ATTR_GET(ATTR_PG_MC01, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_MC01 value = %x", attr_value);
+ break;
+ case 0x08:
+ FAPI_ATTR_GET(ATTR_PG_MC23, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_MC23 value = %x", attr_value);
+ break;
+ case 0x09:
+ FAPI_ATTR_GET(ATTR_PG_OB0, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_OB0 value = %x", attr_value);
+ break;
+ case 0x0A:
+ FAPI_ATTR_GET(ATTR_PG_OB1, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_OB1 value = %x", attr_value);
+ break;
+ case 0x0B:
+ FAPI_ATTR_GET(ATTR_PG_OB2, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_OB2 value = %x", attr_value);
+ break;
+ case 0x0C:
+ FAPI_ATTR_GET(ATTR_PG_OB3, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_OB3 value = %x", attr_value);
+ break;
+ case 0x0D:
+ FAPI_ATTR_GET(ATTR_PG_PCI0, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_PCI0 value = %x", attr_value);
+ break;
+ case 0x0E:
+ FAPI_ATTR_GET(ATTR_PG_PCI1, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_PCI1 value = %x", attr_value);
+ break;
+ case 0x0F:
+ FAPI_ATTR_GET(ATTR_PG_PCI2, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_PCI2 value = %x", attr_value);
+ break;
+ case 0x10:
+ FAPI_ATTR_GET(ATTR_PG_EQ0, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EQ0 value = %x", attr_value);
+ break;
+ case 0x11:
+ FAPI_ATTR_GET(ATTR_PG_EQ1, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EQ1 value = %x", attr_value);
+ break;
+ case 0x12:
+ FAPI_ATTR_GET(ATTR_PG_EQ2, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EQ2 value = %x", attr_value);
+ break;
+ case 0x13:
+ FAPI_ATTR_GET(ATTR_PG_EQ3, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EQ3 value = %x", attr_value);
+ break;
+ case 0x14:
+ FAPI_ATTR_GET(ATTR_PG_EQ4, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EQ4 value = %x", attr_value);
+ break;
+ case 0x15:
+ FAPI_ATTR_GET(ATTR_PG_EQ5, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EQ5 value = %x", attr_value);
+ break;
+ case 0x20:
+ FAPI_ATTR_GET(ATTR_PG_EC00, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC00 value = %x", attr_value);
+ break;
+ case 0x21:
+ FAPI_ATTR_GET(ATTR_PG_EC01, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC01 value = %x", attr_value);
+ break;
+ case 0x22:
+ FAPI_ATTR_GET(ATTR_PG_EC02, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC02 value = %x", attr_value);
+ break;
+ case 0x23:
+ FAPI_ATTR_GET(ATTR_PG_EC03, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC03 value = %x", attr_value);
+ break;
+ case 0x24:
+ FAPI_ATTR_GET(ATTR_PG_EC04, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC04 value = %x", attr_value);
+ break;
+ case 0x25:
+ FAPI_ATTR_GET(ATTR_PG_EC05, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC05 value = %x", attr_value);
+ break;
+ case 0x26:
+ FAPI_ATTR_GET(ATTR_PG_EC06, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC06 value = %x", attr_value);
+ break;
+ case 0x27:
+ FAPI_ATTR_GET(ATTR_PG_EC07, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC07 value = %x", attr_value);
+ break;
+ case 0x28:
+ FAPI_ATTR_GET(ATTR_PG_EC08, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC08 value = %x", attr_value);
+ break;
+ case 0x29:
+ FAPI_ATTR_GET(ATTR_PG_EC09, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC09 value = %x", attr_value);
+ break;
+ case 0x2A:
+ FAPI_ATTR_GET(ATTR_PG_EC10, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC10 value = %x", attr_value);
+ break;
+ case 0x2B:
+ FAPI_ATTR_GET(ATTR_PG_EC11, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC11 value = %x", attr_value);
+ break;
+ case 0x2C:
+ FAPI_ATTR_GET(ATTR_PG_EC12, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC12 value = %x", attr_value);
+ break;
+ case 0x2D:
+ FAPI_ATTR_GET(ATTR_PG_EC13, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC13 value = %x", attr_value);
+ break;
+ case 0x2E:
+ FAPI_ATTR_GET(ATTR_PG_EC14, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC14 value = %x", attr_value);
+ break;
+ case 0x2F:
+ FAPI_ATTR_GET(ATTR_PG_EC15, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC15 value = %x", attr_value);
+ break;
+ case 0x30:
+ FAPI_ATTR_GET(ATTR_PG_EC16, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC16 value = %x", attr_value);
+ break;
+ case 0x31:
+ FAPI_ATTR_GET(ATTR_PG_EC17, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC17 value = %x", attr_value);
+ break;
+ case 0x32:
+ FAPI_ATTR_GET(ATTR_PG_EC18, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC18 value = %x", attr_value);
+ break;
+ case 0x33:
+ FAPI_ATTR_GET(ATTR_PG_EC19, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC19 value = %x", attr_value);
+ break;
+ case 0x34:
+ FAPI_ATTR_GET(ATTR_PG_EC20, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC20 value = %x", attr_value);
+ break;
+ case 0x35:
+ FAPI_ATTR_GET(ATTR_PG_EC21, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC21 value = %x", attr_value);
+ break;
+ case 0x36:
+ FAPI_ATTR_GET(ATTR_PG_EC22, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC22 value = %x", attr_value);
+ break;
+ case 0x37:
+ FAPI_ATTR_GET(ATTR_PG_EC23, i_target, attr_value);
+ FAPI_DBG("ATTR_PG_EC23 value = %x", attr_value);
+ break;
+ default:
+ FAPI_ERR("PervPGTargets: invalid chiplet number %u", i_chiplet_num);
+ }
+
+ if (attr_value & 0xC000)
+ {
+ o_present = true;
+ }
+
+ return fapi2::FAPI2_RC_SUCCESS;
+
+ }
+
+ /// @brief Function to determine if pervsaive target within a chip is
+ /// present and, thus, considered functional per PG attributes
+ template<fapi2::TargetType K>
+ fapi2::ReturnCode
+ plat_TargetPresent( fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> & i_chip_target,
+ fapi2::Target<K> & i_chiplet_target,
+ bool & b_present)
+ {
+
+ // Find the PERV target number in the partial good initialization
+ // array
+ fapi2::ChipletNumber_t chiplet_number = i_chiplet_target.getChipletNumber();
+
+ FAPI_TRY(plat_PervPGTargets(i_chip_target, chiplet_number, b_present));
+
+ if (b_present)
+ {
+ i_chiplet_target.setPresent();
+ i_chiplet_target.setFunctional();
+ }
+ else
+ {
+ FAPI_DBG("Perv target NOT present (nor functional): chiplet_number = %d",
+ chiplet_number);
+ }
+
+ FAPI_DBG("Target present = %u, Target functional = %u",
+ i_chiplet_target.getPresent(),
+ i_chiplet_target.getFunctional());
+
+fapi_try_exit:
+ return fapi2::current_err;
+ }
+
+
/// @brief Function to initialize the G_targets vector based on partial good
/// attributes /// this will move to plat_target.H formally
fapi2::ReturnCode plat_TargetsInit()
{
+ bool b_present = false;
+ uint32_t c = 0;
+
// This is workaround. Currently we do not have code to initialise
// global objects. So initializing global objects against using local
// initialized object
@@ -52,69 +302,71 @@ namespace fapi2
uint32_t l_beginning_offset;
FAPI_DBG("Platform target initialization. Target Count = %u", TARGET_COUNT);
- // Initialize all entries to NULL
+ /*
+ * Initialize all entries to NULL
+ */
for (uint32_t i = 0; i < TARGET_COUNT; ++i)
{
G_vec_targets.push_back((fapi2::plat_target_handle_t)0x0);
FAPI_DBG("Nulling G_vec_targets[%u] hi value=0x%08X",
i, (uint32_t)(G_vec_targets.at(i)>>32));
- // FAPI_DBG("Nulling G_vec_targets[%u] lo value=0x%08X",
- // i, (uint32_t)(G_vec_targets.at(i)&0x00000000ffffffffull));
+
}
- FAPI_DBG("Vector size: %u", G_vec_targets.size());
+ FAPI_DBG("Vector size: %u", G_vec_targets.size());
- // Chip Target is the first one
+ /*
+ * Chip Target is the first one
+ */
FAPI_DBG("Chip Target info: CHIP_TARGET_OFFSET %u CHIP_TARGET_COUNT %u ",
CHIP_TARGET_OFFSET,CHIP_TARGET_COUNT);
-
l_beginning_offset = CHIP_TARGET_OFFSET;
- FAPI_DBG("Chip beginning offset =%u", l_beginning_offset);
- for (uint32_t i = 0; i < CHIP_TARGET_COUNT; ++i)
- {
- fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> target_name((fapi2::plat_target_handle_t)i);
- G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get()));
- // FAPI_DBG("Chip Target initialization: %u G_vec_targets[%u] value=0x%08X",
- // i,
- // (l_beginning_offset+i),
- // (uint32_t)(G_vec_targets.at(l_beginning_offset+i)>>32));
- }
- // Chip Level Pervasive Targets
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> chip_target((fapi2::plat_target_handle_t)0);
+ G_vec_targets.at(l_beginning_offset) = revle64((fapi2::plat_target_handle_t)(chip_target.get()));
+
+ /*
+ * Pervasive Targets
+ */
FAPI_DBG("Pervasive Target info: PERV_TARGET_OFFSET %u PERV_TARGET_COUNT %u",
PERV_TARGET_OFFSET, PERV_TARGET_COUNT);
l_beginning_offset = PERV_TARGET_OFFSET;
- FAPI_DBG("Perv beginning offset =%u", l_beginning_offset);
for (uint32_t i = 0; i < PERV_TARGET_COUNT; ++i)
{
- fapi2::Target<fapi2::TARGET_TYPE_PERV> target_name((fapi2::plat_target_handle_t)i);
- FAPI_DBG("target_name hi word = 0x%08X", (uint32_t)(target_name.get()>>32));
+ fapi2::Target<fapi2::TARGET_TYPE_PERV> target_name((fapi2::plat_target_handle_t)i+1);
+ FAPI_DBG("target_name i = %d hi word = 0x%08X", i+1, (uint32_t)(target_name.get()>>32));
+
+ // Determine if the chiplet is present and, thus, functional
+ // via partial good attributes
+ FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present));
G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get()));
- // FAPI_DBG("Pervasive Target initialization: %u G_vec_targets[%u] value=0x%08X",
- // i,
- // (l_beginning_offset+i),
- // (uint32_t)(G_vec_targets.at(l_beginning_offset+i)>>32));
+ FAPI_DBG("G offset = %d", l_beginning_offset+i);
}
- // Cache (EQ) Targets
+ /*
+ * Cache (EQ) Targets
+ */
FAPI_DBG("EQ Target info: EQ_TARGET_OFFSET %u EQ_TARGET_COUNT %u",
EQ_TARGET_OFFSET, EQ_TARGET_COUNT);
l_beginning_offset = EQ_TARGET_OFFSET;
- FAPI_DBG("EQ beginning offset =%u", l_beginning_offset);
for (uint32_t i = 0; i < EQ_TARGET_COUNT; ++i)
{
fapi2::Target<fapi2::TARGET_TYPE_EQ> target_name((fapi2::plat_target_handle_t)i);
- FAPI_DBG("target_name hi word = 0x%08X", (uint32_t)(target_name.get()>>32));
+ FAPI_DBG("target_name i = %d hi word = 0x%08X", i, (uint32_t)(target_name.get()>>32));
+
+ // Determine if the chiplet is present and, thus, functional
+ // via partial good attributes
+ FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present));
+
G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get()));
- // FAPI_DBG("EQ Target initialization: %u G_vec_targets[%u] value=%16llX",
- // i,
- // (l_beginning_offset+i),
- // revle64((uint64_t)G_vec_targets[l_beginning_offset+i]));
+ FAPI_DBG("G offset = %d", l_beginning_offset+i);
}
- // Core (EC) Targets
+ /*
+ * Core (EC) Targets
+ */
FAPI_DBG("Core Target info: CORE_TARGET_OFFSET %u CORE_TARGET_COUNT %u",
CORE_TARGET_OFFSET, CORE_TARGET_COUNT);
@@ -123,15 +375,19 @@ namespace fapi2
for (uint32_t i = 0; i < CORE_TARGET_COUNT; ++i)
{
fapi2::Target<fapi2::TARGET_TYPE_CORE> target_name((fapi2::plat_target_handle_t)i);
- FAPI_DBG("target_name hi word = 0x%08X", (uint32_t)(target_name.get()>>32));
+ FAPI_DBG("target_name i = %d hi word = 0x%08X", i, (uint32_t)(target_name.get()>>32));
+
+ // Determine if the chiplet is present and, thus, functional
+ // via partial good attributes
+ FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present));
+
G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get()));
- // FAPI_DBG("Core Target initialization: %u G_vec_targets[%u] value=0x%08X",
- // i,
- // (l_beginning_offset+i),
- // (uint32_t)(G_vec_targets.at(l_beginning_offset+i)>>32));
+ FAPI_DBG("G offset = %d", l_beginning_offset+i);
}
- // Memroy Controller Synchronous (MCS) Targets
+ /*
+ * Memory Controller Synchronous (MCS) Targets
+ */
FAPI_DBG("MCS Target info: MCS_TARGET_OFFSET %u MCS_TARGET_COUNT %u",
MCS_TARGET_OFFSET, MCS_TARGET_COUNT);
@@ -140,23 +396,26 @@ namespace fapi2
for (uint32_t i = 0; i < MCS_TARGET_COUNT; ++i)
{
fapi2::Target<fapi2::TARGET_TYPE_MCS> target_name((fapi2::plat_target_handle_t)i);
- FAPI_DBG("target_name hi word = 0x%08X", (uint32_t)(target_name.get()>>32));
+ FAPI_DBG("target_name i = %d hi word = 0x%08X", i, (uint32_t)(target_name.get()>>32));
+
+ // Determine if the chiplet is present and, thus, functional
+ // via partial good attributes
+ FAPI_TRY(plat_TargetPresent(chip_target, target_name, b_present));
+
G_vec_targets.at(l_beginning_offset+i) = revle64((fapi2::plat_target_handle_t)(target_name.get()));
- // FAPI_DBG("MCS Target initialization: %u G_vec_targets[%u] value=0x%08X",
- // i,
- // (l_beginning_offset+i),
- // (uint32_t)(G_vec_targets.at(l_beginning_offset+i)>>32));
+ FAPI_DBG("G offset = %d", l_beginning_offset+i);
+
}
// Trace all entries
- uint32_t c = 0;
- for (tgt_iter = G_vec_targets.begin(); tgt_iter != G_vec_targets.end(); ++tgt_iter)
+ for (auto tgt_iter : G_vec_targets)
{
FAPI_DBG("Trace hi word G_vec_targets[%u] value=%08X",
- c, (uint32_t)((*tgt_iter)>>32));
+ c, (uint32_t)(tgt_iter>>32));
++c;
}
+fapi_try_exit:
return fapi2::current_err;
}
@@ -167,7 +426,7 @@ namespace fapi2
// Get the chip specific target
return ((fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>)G_vec_targets.at(0));
- }
+ }
-};
+} // fapi2
OpenPOWER on IntegriCloud