Skip to content

Commit 80ae8c8

Browse files
dwashburdcrowell77
authored andcommitted
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/41548 Reviewed-by: Hostboot Team <hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
1 parent ed5d583 commit 80ae8c8

File tree

5 files changed

+48
-10
lines changed

5 files changed

+48
-10
lines changed

src/import/hwpf/fapi2/include/buffer.H

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,15 @@ class buffer
401401
return &iv_data;
402402
}
403403

404+
///
405+
/// @brief Get a pointer to the buffer bits
406+
/// @return Pointer to the buffer itself
407+
///
408+
inline const T* pointer(void) const
409+
{
410+
return &iv_data;
411+
}
412+
404413
// Note: Many (all?) of these are not needed and the compiler complains
405414
// as the cast to T yields a better operator. There are here mainly for
406415
// documenation purposes.

src/import/hwpf/fapi2/include/error_info_defs.H

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* OpenPOWER HostBoot Project */
77
/* */
8-
/* Contributors Listed Below - COPYRIGHT 2015,2016 */
8+
/* Contributors Listed Below - COPYRIGHT 2015,2017 */
99
/* [+] International Business Machines Corp. */
1010
/* */
1111
/* */
@@ -331,6 +331,16 @@ inline uint16_t getErrorInfoFfdcSize(const fapi2::variable_buffer& i_thing)
331331
i_thing.getLength<uint8_t>());
332332
}
333333
#endif
334+
335+
///
336+
/// @brief Get FFDC Size specialization for ffdc_t
337+
///
338+
template<>
339+
inline uint16_t getErrorInfoFfdcSize(const fapi2::ffdc_t& i_ffdc)
340+
{
341+
return static_cast<uint16_t>(i_ffdc.size());
342+
}
343+
334344
};
335345

336346
#endif // FAPI2_ERRORINFO_DEFS_H_

src/import/hwpf/fapi2/include/variable_buffer.H

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* OpenPOWER HostBoot Project */
77
/* */
8-
/* Contributors Listed Below - COPYRIGHT 2015,2016 */
8+
/* Contributors Listed Below - COPYRIGHT 2015,2017 */
99
/* [+] International Business Machines Corp. */
1010
/* */
1111
/* */
@@ -811,6 +811,15 @@ class variable_buffer
811811
return &(iv_data[0]);
812812
}
813813

814+
///
815+
/// @brief Get a pointer to the buffer bits
816+
/// @return Pointer to the buffer itself
817+
///
818+
inline const unit_type* pointer(void) const
819+
{
820+
return &(iv_data[0]);
821+
}
822+
814823
///
815824
/// @brief operator!=()
816825
///

src/import/hwpf/fapi2/tools/parseErrorInfo.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# OpenPOWER HostBoot Project
77
#
8-
# Contributors Listed Below - COPYRIGHT 2015,2016
8+
# Contributors Listed Below - COPYRIGHT 2015,2017
99
# [+] International Business Machines Corp.
1010
#
1111
#
@@ -44,7 +44,9 @@ CLEAN_TARGETS += $(GENPATH)/collect_reg_ffdc_regs.C
4444
CLEAN_TARGETS += $(GENPATH)/set_sbe_error.H
4545

4646
define parseErrorInfo_RUN
47-
$(C1) $$< --output-dir=$$($(GENERATED)_PATH) $$(filter-out $$<,$$^)
47+
$(C1) $$< --use-variable-buffers \
48+
--output-dir=$$($(GENERATED)_PATH) \
49+
$$(filter-out $$<,$$^)
4850
endef
4951

5052
$(call BUILD_GENERATED)

src/import/hwpf/fapi2/tools/parseErrorInfo.pl

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,20 +324,28 @@ sub addFfdcMethod
324324
elsif ( $type eq $buffer_ffdc_type )
325325
{
326326
# Two methods - one for integral buffers and one for variable_buffers
327-
$method = "\n template< typename T >\n";
327+
$method = "\n";
328+
$method .= " template< typename T >\n";
328329
$method .= " inline $class_name& set_$ffdc_uc(const fapi2::buffer<T>& $param)\n";
329-
$method_body =
330-
" {\n $ffdc_uc.ptr() = &i_value(); $ffdc_uc.size() = i_value.template getLength<uint8_t>(); return *this;}\n\n";
330+
$method_body = " {\n";
331+
$method_body .= " $ffdc_uc.ptr() = $param.pointer();\n";
332+
$method_body .= " $ffdc_uc.size() = $param.template getLength<uint8_t>();\n";
333+
$method_body .= " return *this;\n";
334+
$method_body .= " }\n\n";
331335
$methods->{$key}{member} = "$ffdc_type $ffdc_uc;";
332336
$methods->{$objectNumber}{localvar} = "$buffer_ffdc_type $ffdc_uc = getFfdcData(FFDC_BUFFER[$objectNumber]);";
333337
$methods->{$objectNumber}{assignment_string} = "l_obj.$ffdc_uc = $ffdc_uc;";
334338
}
335339

336340
elsif ( $type eq $variable_buffer_ffdc_type )
337341
{
338-
$method = "\n inline $class_name& set_$ffdc_uc(const fapi2::variable_buffer& $param)\n";
339-
$method_body =
340-
" {$ffdc_uc.ptr() = &$param(); $ffdc_uc.size() = $param.template getLength<uint8_t>(); return *this;}\n\n";
342+
$method = "\n";
343+
$method .= " inline $class_name& set_$ffdc_uc(const fapi2::variable_buffer& $param)\n";
344+
$method_body = " {\n";
345+
$method_body .= " $ffdc_uc.ptr() = $param.pointer();\n";
346+
$method_body .= " $ffdc_uc.size() = $param.template getLength<uint8_t>();\n";
347+
$method_body .= " return *this;\n";
348+
$method_body .= " }\n\n";
341349

342350
# No need to add the member here, it was added with fapi2::buffer. And we can't have variable
343351
# buffer support with out integral buffer support (can we?)

0 commit comments

Comments
 (0)