diff options
author | Patrick Williams <iawillia@us.ibm.com> | 2016-03-18 14:16:41 -0500 |
---|---|---|
committer | Sachin Gupta <sgupta2m@in.ibm.com> | 2016-08-04 03:09:31 -0400 |
commit | bb97d2b25e75b478db3963758afaddeeb65ed74b (patch) | |
tree | 1b55c3387c371ec7642526a7e4125e8ed62b5d59 /import | |
parent | 5ccbe4af007b3d9db1cbe853007c9462e0fb9748 (diff) | |
download | talos-sbe-bb97d2b25e75b478db3963758afaddeeb65ed74b.tar.gz talos-sbe-bb97d2b25e75b478db3963758afaddeeb65ed74b.zip |
Ensure fapi2::Target honors platform value type.
The fapi2::Target template is as follows:
template<TargetType K, typename V = plat_target_handle_t>
In many places the code was using the default V type instead of
preserving the type of the template. As an example:
Target<T> getParent(void) const; // old
vs
Target<T,V> getParent(void) const; // new
With the old variant, a Target<ANY, V> is converted to a
Target<ANY, plat_target_handle_t> by the getParent() function
instead of maintaining the V type.
Added associated ecmd release ver-14-4-2-ekbonly for testing
Change-Id: Ie613d658c59f5f6d3ce7be95f3b1e816b52582e0
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/22247
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Santosh S. Puranik <santosh.puranik@in.ibm.com>
Reviewed-by: Brian R. Silver <bsilver@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/27035
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'import')
-rw-r--r-- | import/hwpf/fapi2/include/fapi2_target.H | 48 | ||||
-rw-r--r-- | import/hwpf/fapi2/include/plat/target.H | 29 |
2 files changed, 40 insertions, 37 deletions
diff --git a/import/hwpf/fapi2/include/fapi2_target.H b/import/hwpf/fapi2/include/fapi2_target.H index 231e5ad9..db61b30e 100644 --- a/import/hwpf/fapi2/include/fapi2_target.H +++ b/import/hwpf/fapi2/include/fapi2_target.H @@ -114,7 +114,7 @@ class Target /// single uint64_t in value which represents all the information /// they might need. value( K | V ), for example /// - Target(V Value): + Target(const V& Value): iv_handle(Value) {}; @@ -195,7 +195,7 @@ class Target /// @return Target<T> a target representing the parent /// template< TargetType T > - inline Target<T> getParent(void) const; + inline Target<T, V> getParent(void) const; /// /// @brief Is this target a chip? @@ -263,13 +263,13 @@ class Target /// @brief Get this target's children /// @tparam T The type of the parent /// @param[in] i_state The desired TargetState of the children - /// @return std::vector<Target<T> > a vector of present/functional + /// @return std::vector<Target<T,V>> a vector of present/functional /// children /// @warning The children of EX's (cores) are expected to be returned /// in order. That is, core 0 is std::vector[0]. /// template< TargetType T> - inline std::vector<Target<T> > + inline std::vector<Target<T, V> > getChildren(const TargetState i_state = TARGET_STATE_FUNCTIONAL) const; /// @@ -277,11 +277,11 @@ class Target /// @tparam T The type of the parent /// @param[in] i_filter The desired chiplet filter /// @param[in] i_state The desired TargetState of the children - /// @return std::vector<Target<T> > a vector of present/functional + /// @return std::vector<Target<T,V>> a vector of present/functional /// children /// template< TargetType T> - inline std::vector<Target<T> > + inline std::vector<Target<T, V> > getChildren(const TargetFilter i_filter, const TargetState i_state = TARGET_STATE_FUNCTIONAL) const; @@ -297,7 +297,7 @@ class Target template<TargetType T> inline fapi2::ReturnCodes - getOtherEnd(Target<T>& o_target, const TargetState i_state = TARGET_STATE_FUNCTIONAL) const; + getOtherEnd(Target<T, V>& o_target, const TargetState i_state = TARGET_STATE_FUNCTIONAL) const; /// /// @brief Is the target functional? @@ -321,8 +321,8 @@ class Target /// @brief Copy from a Target<O> to a Target<K> /// @tparam O the target type of the other /// - template<TargetType O> - inline Target( const Target<O>& Other ): + template<TargetType O, typename VO> + inline Target( const Target<O, VO>& Other ): Target<K, V>(Other.get()) { // In case of recursion depth failure, use -ftemplate-depth= @@ -460,29 +460,29 @@ inline uint8_t thread_bitset_f2n(const uint8_t i_ordinal, const uint8_t i_thread /// /// @brief Return the string interpretation of this target /// @tparam T The type of the target -/// @param[in] i_target Target<T> +/// @param[in] i_target Target<T,V> /// @param[in] i_buffer buffer to write in to /// @param[in] i_bsize size of the buffer /// @return void /// @post The contents of the buffer is replaced with the string /// representation of the target /// -template< TargetType T > -inline void toString(const Target<T>& i_target, char* i_buffer, size_t i_bsize); +template< TargetType T, typename V > +inline void toString(const Target<T, V>& i_target, char* i_buffer, size_t i_bsize); /// /// @brief Return the string interpretation of this target /// @tparam T The type of the target /// @tparam B The type of the buffer -/// @param[in] i_target A pointer to the Target<T> +/// @param[in] i_target A pointer to the Target<T,V> /// @param[in] i_buffer buffer to write in to /// @param[in] i_bsize size of the buffer /// @return void /// @post The contents of the buffer is replaced with the string /// representation of the target /// -template< TargetType T > -inline void toString(const Target<T>* i_target, char* i_buffer, size_t i_bsize); +template< TargetType T, typename V > +inline void toString(const Target<T, V>* i_target, char* i_buffer, size_t i_bsize); /// /// @brief Get an enumerated target of a specific type @@ -491,8 +491,8 @@ inline void toString(const Target<T>* i_target, char* i_buffer, size_t i_bsize); /// the desired target /// @return Target<T> the target requested /// -template<TargetType T> -inline Target<T> getTarget(uint64_t Ordinal); +template<TargetType T, typename V> +inline Target<T, V> getTarget(uint64_t Ordinal); // Why has the been removed? For starters, the API name // is probably wrong as it's already been confused with @@ -503,14 +503,14 @@ inline Target<T> getTarget(uint64_t Ordinal); /// /// @brief Get the base target's children /// @tparam T The type of the target -/// @return std::vector<Target<T> > a vector of present/functional +/// @return std::vector<Target<T,V>> a vector of present/functional /// children /// -template<TargetType T> -inline std::vector<Target<T> > getChildren() +template<TargetType T, typename V> +inline std::vector<Target<T, V>> getChildren() { // For testing - return {Target<T>(), Target<T>()}; + return {Target<T, V>(), Target<T, V>()}; } #endif @@ -518,14 +518,14 @@ inline std::vector<Target<T> > getChildren() /// @brief Return the string interpretation of this target /// @tparam T The type of the target /// @tparam B The type of the buffer -/// @param[in] i_target Target<T> +/// @param[in] i_target Target<T,V> /// @param[in] i_buffer buffer /// @return void /// @post The contents of the buffer is replaced with the string /// representation of the target /// -template<TargetType T, typename B> -inline void toString(const Target<T>& i_target, B& i_buffer); +template<TargetType T, typename V, typename B> +inline void toString(const Target<T, V>& i_target, B& i_buffer); /// /// @brief Check if the target is of a type, or in a type subset. diff --git a/import/hwpf/fapi2/include/plat/target.H b/import/hwpf/fapi2/include/plat/target.H index ffc88e41..e09bdb70 100644 --- a/import/hwpf/fapi2/include/plat/target.H +++ b/import/hwpf/fapi2/include/plat/target.H @@ -89,10 +89,10 @@ bool Target<K, V>::operator<(const Target& i_right) const /// template<TargetType K, typename V> template<TargetType T> -inline Target<T> Target<K, V>::getParent(void) const +inline Target<T, V> Target<K, V>::getParent(void) const { // For testing - return Target<T>(iv_handle); + return Target<T, V>(iv_handle); } /// @@ -106,13 +106,13 @@ inline Target<T> Target<K, V>::getParent(void) const /// template<TargetType K, typename V> template< TargetType T> -inline std::vector<Target<T> > +inline std::vector<Target<T, V> > Target<K, V>::getChildren(const TargetState i_state) const { // To keep the compiler quiet about unused variables static_cast<void>(i_state); // For testing - return {Target<T>(), Target<T>()}; + return {Target<T, V>(), Target<T, V>()}; } // Specialization of getChildren, filtered for pervasive targets. template<> @@ -142,12 +142,13 @@ Target<TARGET_TYPE_PERV>::getChildren(const TargetFilter i_filter, template<TargetType K, typename V> template<TargetType T> inline fapi2::ReturnCodes -Target<K, V>::getOtherEnd(Target<T>& o_target, const TargetState i_state) const +Target<K, V>::getOtherEnd(Target<T, V>& o_target, + const TargetState i_state) const { // To keep the compiler quiet about unused variables static_cast<void>(i_state); - o_target = Target<T>(); + o_target = Target<T, V>(); return FAPI2_RC_SUCCESS; } @@ -191,8 +192,9 @@ Target<K, V>::getChipletNumber(void) const /// @post The contents of the buffer is replaced with the string /// representation of the target /// -template< TargetType T > -inline void toString(const Target<T>& i_target, char* i_buffer, size_t i_bsize) +template< TargetType T, typename V > +inline void toString(const Target<T, V>& i_target, + char* i_buffer, size_t i_bsize) { snprintf(i_buffer, i_bsize, "Target 0x%lx/0x%x", i_target.get(), T); } @@ -208,8 +210,9 @@ inline void toString(const Target<T>& i_target, char* i_buffer, size_t i_bsize) /// @post The contents of the buffer is replaced with the string /// representation of the target /// -template< TargetType T > -inline void toString(const Target<T>* i_target, char* i_buffer, size_t i_bsize) +template< TargetType T, typename V > +inline void toString(const Target<T, V>* i_target, + char* i_buffer, size_t i_bsize) { snprintf(i_buffer, i_bsize, "Target 0x%lx/0x%x", i_target->get(), T); } @@ -221,11 +224,11 @@ inline void toString(const Target<T>* i_target, char* i_buffer, size_t i_bsize) /// the desired target /// @return Target<T> the target requested /// -template<TargetType T> -inline Target<T> getTarget(uint64_t Ordinal) +template<TargetType T, typename V> +inline Target<T, V> getTarget(uint64_t Ordinal) { // For testing - return Target<T>(Ordinal); + return Target<T, V>(Ordinal); } } |