From 5fea395b2bdc6d3982c6733ad7ef0c7546d38c97 Mon Sep 17 00:00:00 2001 From: "Richard J. Knight" Date: Wed, 21 Sep 2016 14:55:57 -0500 Subject: Create sample ffdc collection procedure Change-Id: I4e2c45f08c8f104caeb5b368ff6467b6d2981c48 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30384 Tested-by: Jenkins Server Tested-by: Hostboot CI Reviewed-by: Matt Derksen Reviewed-by: Deepak Kodihalli Reviewed-by: Jennifer A. Stofer Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30387 Reviewed-by: Hostboot Team Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell --- .../p9/procedures/hwp/ffdc/p9_collect_some_ffdc.C | 62 +++++++++++++++++++--- .../p9/procedures/hwp/ffdc/p9_collect_some_ffdc.H | 18 ++++--- .../xml/error_info/p9_collect_some_ffdc.xml | 46 ++++++++++++++++ .../xml/error_info/proc_example_errors.xml | 22 +------- 4 files changed, 113 insertions(+), 35 deletions(-) create mode 100644 src/import/chips/p9/procedures/xml/error_info/p9_collect_some_ffdc.xml (limited to 'src/import/chips/p9/procedures') diff --git a/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_some_ffdc.C b/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_some_ffdc.C index 4299d296d..b7a630611 100644 --- a/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_some_ffdc.C +++ b/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_some_ffdc.C @@ -27,20 +27,70 @@ /// #include +#include #include using fapi2::FAPI2_RC_FALSE; +const uint32_t PIB_RC_EXAMPLE_1 = 0x01; +const uint32_t PIB_RC_EXAMPLE_2 = 0x02; + extern "C" { - fapi2::ReturnCode p9_collect_some_ffdc(std::vector>& o_ffdc_data, uint32_t a, - uint8_t b) + fapi2::ReturnCode p9_collect_some_ffdc(fapi2::ffdc_t& param1, fapi2::ReturnCode& o_rc) { - FAPI_INF("parm1=%d and parm2=%d", a, b); - o_ffdc_data.push_back(std::shared_ptr(new fapi2::ErrorInfoFfdc( 0xdeadbeef, &a, sizeof(a)))); - o_ffdc_data.push_back(std::shared_ptr(new fapi2::ErrorInfoFfdc( 0xcafebabe, &b, sizeof(b)))); + FAPI_INF("parm1=%d\n", param1); + + // define reference to data to be captured by the macro below + // ffdc classes use these ffdc_t types so all data should be stored + // in one. + fapi2::ffdc_t FFDC_DATA1; + fapi2::ffdc_t FFDC_DATA2; + + // some piece of ffdc we collected or this failure, through a register + // read or function call + uint32_t my_ffdc_data = 32; + uint64_t more_ffdc_data = 0x10002005; + + // get the actual data from the parameter, in this case its a pretend + // pib_rc we can check and add different FFDC data depending on the + // RC + const uint32_t pib_rc = *(reinterpret_cast(param1.ptr())); + + switch( pib_rc ) + { + case PIB_RC_EXAMPLE_1: + { + FFDC_DATA1.ptr() = static_cast(&my_ffdc_data); + FFDC_DATA1.size() = sizeof(my_ffdc_data); + + // add our ffdc to the returnCode passed in - see sample + // xml for details on the xml + FAPI_ADD_INFO_TO_HWP_ERROR(o_rc, RC_PIB_ERROR_1); + } + break; + case PIB_RC_EXAMPLE_2: + { + FFDC_DATA1.ptr() = static_cast(&my_ffdc_data); + FFDC_DATA1.size() = sizeof(my_ffdc_data); + + FFDC_DATA2.ptr() = static_cast(&more_ffdc_data); + FFDC_DATA2.size() = sizeof(&more_ffdc_data); + + // add our ffdc to the returnCode passed in - see sample + // xml for details on the xml + FAPI_ADD_INFO_TO_HWP_ERROR(o_rc, RC_PIB_ERROR_2); + + } + break; + + default: + // do nothing + break; + } + + // just return success return fapi2::ReturnCode(); } - } diff --git a/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_some_ffdc.H b/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_some_ffdc.H index 76b28b690..caa08fcd6 100644 --- a/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_some_ffdc.H +++ b/src/import/chips/p9/procedures/hwp/ffdc/p9_collect_some_ffdc.H @@ -28,15 +28,15 @@ //------------------------------------------------------------------------------ // Includes //------------------------------------------------------------------------------ -#include +#include +#include //------------------------------------------------------------------------------ // Structure definitions //------------------------------------------------------------------------------ // function pointer typedef definition for HWP call support -typedef fapi2::ReturnCode (*p9_collect_some_ffdc_FP_t)(std::vector>& o_ffdc_data, - uint32_t a, uint8_t b); +typedef fapi2::ReturnCode (*p9_collect_some_ffdc_FP_t)(fapi2::ffdc_t& i_param1, fapi2::ReturnCode&); //------------------------------------------------------------------------------ // Constant definitions @@ -52,15 +52,17 @@ extern "C" /// /// @brief Sample procedure used to demonstrate FFDC collection using /// collectFfdc tag in xml files -/// @param[in] o_ffdc_data - default parameter ffdc data returned in this /// vector -/// @param[in] a - parameter passed from the SBE through the ffdc data buffer -/// @param[in] b - parameter passed from the SBE through the ffdc data buffer +/// @param[in] a - parameter passed in from calling context +/// @param[out] o_rc - return code to add FFDC data to. /// /// @return FAPI2_RC_SUCCESS iff ok /// - fapi2::ReturnCode p9_collect_some_ffdc(std::vector>& o_ffdc_data, uint32_t a, - uint8_t b); +/// NOTE: All input parameters must be of type fapi2::ffdc_t and converted +/// to the correct type inside the function. +/// + fapi2::ReturnCode p9_collect_some_ffdc(fapi2::ffdc_t&, + fapi2::ReturnCode& ); } // extern "C" diff --git a/src/import/chips/p9/procedures/xml/error_info/p9_collect_some_ffdc.xml b/src/import/chips/p9/procedures/xml/error_info/p9_collect_some_ffdc.xml new file mode 100644 index 000000000..a3abb5453 --- /dev/null +++ b/src/import/chips/p9/procedures/xml/error_info/p9_collect_some_ffdc.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + RC_PIB_ERROR_1 + + Return code used for testing collectFfdc - returns single piece of data + + FFDC_DATA1 + + + + RC_PIB_ERROR_2 + + Return code used for testing collectFfdc - returns two pieces of + ffdc data + + FFDC_DATA1 + FFDC_DATA2 + + + + diff --git a/src/import/chips/p9/procedures/xml/error_info/proc_example_errors.xml b/src/import/chips/p9/procedures/xml/error_info/proc_example_errors.xml index 690446474..a6aee3c40 100644 --- a/src/import/chips/p9/procedures/xml/error_info/proc_example_errors.xml +++ b/src/import/chips/p9/procedures/xml/error_info/proc_example_errors.xml @@ -78,7 +78,7 @@ test example BUFFER - + p9_collect_some_ffdc,parm1 CODE HIGH @@ -113,26 +113,6 @@ - - - RC_PIB_ERROR_1 - - Return code used for testing collectFfdc - returns single piece of data - - FFDC_DATA1 - - - - RC_PIB_ERROR_2 - - Return code used for testing collectFfdc - returns two pieces of - ffdc data - - FFDC_DATA1 - FFDC_DATA2 - - - -- cgit v1.2.1