diff options
author | Donald Washburn <dwashbur@us.ibm.com> | 2017-06-08 10:39:35 -0500 |
---|---|---|
committer | Sachin Gupta <sgupta2m@in.ibm.com> | 2017-06-19 15:44:09 -0400 |
commit | cf7b3f781f41a3891e6af34a11c5e1d64e303c20 (patch) | |
tree | ef8604cddaf5cd465bd7dbc2cb4b412ecd8f8731 /src/import/hwpf | |
parent | ccc8e8a0b52d369eda85fe07ccd5d5dd19c5646b (diff) | |
download | talos-sbe-cf7b3f781f41a3891e6af34a11c5e1d64e303c20.tar.gz talos-sbe-cf7b3f781f41a3891e6af34a11c5e1d64e303c20.zip |
Enable and fix error log variable_buffer support.
Errorlog support for the fapi2::variable_buffer type was not enabled in
hostboot. Tests showed that when enabled, variable_buffer data was not
being propagated properly to the error log. The issue was found to be
that the pointer to the variable_buffer's internal data was not being
properly passed to an ffdc_t object. Also, transferring the size of
the variable_buffer data was not being correctly communicated to an
ffdc_t object because a specialization of the getErrorInfoFfdcSize
template function is needed. Becuase the specialization of the
getErrorInfoFfdcSize function with an ffdc_t parameter did not exist,
the code base used the primary function template for the
getErrorInfoFfdcSize function which just returns the size of an ffdc_t
object passed to it instead of the size of the contained data within
the ffdc_t.
Changes:
* Added specialization of getErrorInfoFfdcSize for fapi2::ffdc_t.
* Enabled variable_buffer support in parseErrorInfo.mk.
* Added const overload of the pointer() method for the fapi2::buffer
and fapi2::variable_buffer classes. This to allow these methods
to be used in the set_BUFFER methods that take a const reference
to objects of these classes.
* Modified parseErrorInfo.pl to generate code to use the above
mentioned pointer methods. The adjusted generated code fixes
the problem of assigning an incorrect buffer pointer.
Change-Id: I96dc89fbb68ee6a153ca43191181c56804b84ae8
RTC: 175239
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41541
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: William G. Hoffa <wghoffa@us.ibm.com>
Reviewed-by: Richard J. Knight <rjknight@us.ibm.com>
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41547
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'src/import/hwpf')
-rw-r--r-- | src/import/hwpf/fapi2/include/buffer.H | 9 | ||||
-rw-r--r-- | src/import/hwpf/fapi2/include/error_info_defs.H | 12 | ||||
-rw-r--r-- | src/import/hwpf/fapi2/include/variable_buffer.H | 11 | ||||
-rwxr-xr-x | src/import/hwpf/fapi2/tools/parseErrorInfo.pl | 20 |
4 files changed, 44 insertions, 8 deletions
diff --git a/src/import/hwpf/fapi2/include/buffer.H b/src/import/hwpf/fapi2/include/buffer.H index eee15f3b..572d4813 100644 --- a/src/import/hwpf/fapi2/include/buffer.H +++ b/src/import/hwpf/fapi2/include/buffer.H @@ -401,6 +401,15 @@ class buffer return &iv_data; } + /// + /// @brief Get a pointer to the buffer bits + /// @return Pointer to the buffer itself + /// + inline const T* pointer(void) const + { + return &iv_data; + } + // Note: Many (all?) of these are not needed and the compiler complains // as the cast to T yields a better operator. There are here mainly for // documenation purposes. diff --git a/src/import/hwpf/fapi2/include/error_info_defs.H b/src/import/hwpf/fapi2/include/error_info_defs.H index 880552eb..0476f1ed 100644 --- a/src/import/hwpf/fapi2/include/error_info_defs.H +++ b/src/import/hwpf/fapi2/include/error_info_defs.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* Contributors Listed Below - COPYRIGHT 2015,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -332,6 +332,16 @@ inline uint16_t getErrorInfoFfdcSize(const fapi2::variable_buffer& i_thing) i_thing.getLength<uint8_t>()); } #endif + +/// +/// @brief Get FFDC Size specialization for ffdc_t +/// +template<> +inline uint16_t getErrorInfoFfdcSize(const fapi2::ffdc_t& i_ffdc) +{ + return static_cast<uint16_t>(i_ffdc.size()); +} + }; #endif // FAPI2_ERRORINFO_DEFS_H_ diff --git a/src/import/hwpf/fapi2/include/variable_buffer.H b/src/import/hwpf/fapi2/include/variable_buffer.H index 744ebc96..c96f83a9 100644 --- a/src/import/hwpf/fapi2/include/variable_buffer.H +++ b/src/import/hwpf/fapi2/include/variable_buffer.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* Contributors Listed Below - COPYRIGHT 2015,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -812,6 +812,15 @@ class variable_buffer } /// + /// @brief Get a pointer to the buffer bits + /// @return Pointer to the buffer itself + /// + inline const unit_type* pointer(void) const + { + return &(iv_data[0]); + } + + /// /// @brief operator!=() /// inline bool operator!=(const variable_buffer& rhs) const diff --git a/src/import/hwpf/fapi2/tools/parseErrorInfo.pl b/src/import/hwpf/fapi2/tools/parseErrorInfo.pl index ed4b9928..57a6a87d 100755 --- a/src/import/hwpf/fapi2/tools/parseErrorInfo.pl +++ b/src/import/hwpf/fapi2/tools/parseErrorInfo.pl @@ -324,10 +324,14 @@ sub addFfdcMethod elsif ( $type eq $buffer_ffdc_type ) { # Two methods - one for integral buffers and one for variable_buffers - $method = "\n template< typename T >\n"; + $method = "\n"; + $method .= " template< typename T >\n"; $method .= " inline $class_name& set_$ffdc_uc(const fapi2::buffer<T>& $param)\n"; - $method_body = - " {\n $ffdc_uc.ptr() = &i_value(); $ffdc_uc.size() = i_value.template getLength<uint8_t>(); return *this;}\n\n"; + $method_body = " {\n"; + $method_body .= " $ffdc_uc.ptr() = $param.pointer();\n"; + $method_body .= " $ffdc_uc.size() = $param.template getLength<uint8_t>();\n"; + $method_body .= " return *this;\n"; + $method_body .= " }\n\n"; $methods->{$key}{member} = "$ffdc_type $ffdc_uc;"; $methods->{$objectNumber}{localvar} = "$buffer_ffdc_type $ffdc_uc = getFfdcData(FFDC_BUFFER[$objectNumber]);"; $methods->{$objectNumber}{assignment_string} = "l_obj.$ffdc_uc = $ffdc_uc;"; @@ -335,9 +339,13 @@ sub addFfdcMethod elsif ( $type eq $variable_buffer_ffdc_type ) { - $method = "\n inline $class_name& set_$ffdc_uc(const fapi2::variable_buffer& $param)\n"; - $method_body = - " {$ffdc_uc.ptr() = &$param(); $ffdc_uc.size() = $param.template getLength<uint8_t>(); return *this;}\n\n"; + $method = "\n"; + $method .= " inline $class_name& set_$ffdc_uc(const fapi2::variable_buffer& $param)\n"; + $method_body = " {\n"; + $method_body .= " $ffdc_uc.ptr() = $param.pointer();\n"; + $method_body .= " $ffdc_uc.size() = $param.template getLength<uint8_t>();\n"; + $method_body .= " return *this;\n"; + $method_body .= " }\n\n"; # No need to add the member here, it was added with fapi2::buffer. And we can't have variable # buffer support with out integral buffer support (can we?) |