diff --git a/src/import/hwpf/fapi2/include/buffer.H b/src/import/hwpf/fapi2/include/buffer.H index 08ce5ebeb50..32b6de79d94 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 7ea9d67c4f0..603ab2b4c64 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 HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* Contributors Listed Below - COPYRIGHT 2015,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -331,6 +331,16 @@ inline uint16_t getErrorInfoFfdcSize(const fapi2::variable_buffer& i_thing) i_thing.getLength()); } #endif + +/// +/// @brief Get FFDC Size specialization for ffdc_t +/// +template<> +inline uint16_t getErrorInfoFfdcSize(const fapi2::ffdc_t& i_ffdc) +{ + return static_cast(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 18df380d733..0c1414486d5 100644 --- a/src/import/hwpf/fapi2/include/variable_buffer.H +++ b/src/import/hwpf/fapi2/include/variable_buffer.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* Contributors Listed Below - COPYRIGHT 2015,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -811,6 +811,15 @@ class variable_buffer return &(iv_data[0]); } + /// + /// @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!=() /// diff --git a/src/import/hwpf/fapi2/tools/parseErrorInfo.mk b/src/import/hwpf/fapi2/tools/parseErrorInfo.mk index f472ec2e444..1c130e6e9b2 100644 --- a/src/import/hwpf/fapi2/tools/parseErrorInfo.mk +++ b/src/import/hwpf/fapi2/tools/parseErrorInfo.mk @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2015,2016 +# Contributors Listed Below - COPYRIGHT 2015,2017 # [+] International Business Machines Corp. # # @@ -44,7 +44,9 @@ CLEAN_TARGETS += $(GENPATH)/collect_reg_ffdc_regs.C CLEAN_TARGETS += $(GENPATH)/set_sbe_error.H define parseErrorInfo_RUN - $(C1) $$< --output-dir=$$($(GENERATED)_PATH) $$(filter-out $$<,$$^) + $(C1) $$< --use-variable-buffers \ + --output-dir=$$($(GENERATED)_PATH) \ + $$(filter-out $$<,$$^) endef $(call BUILD_GENERATED) diff --git a/src/import/hwpf/fapi2/tools/parseErrorInfo.pl b/src/import/hwpf/fapi2/tools/parseErrorInfo.pl index b4dd39312b8..082fef9f806 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& $param)\n"; - $method_body = - " {\n $ffdc_uc.ptr() = &i_value(); $ffdc_uc.size() = i_value.template getLength(); return *this;}\n\n"; + $method_body = " {\n"; + $method_body .= " $ffdc_uc.ptr() = $param.pointer();\n"; + $method_body .= " $ffdc_uc.size() = $param.template getLength();\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(); 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();\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?)