diff options
author | Richard J. Knight <rjknight@us.ibm.com> | 2016-09-21 14:55:57 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2016-10-26 00:35:50 -0400 |
commit | 5fea395b2bdc6d3982c6733ad7ef0c7546d38c97 (patch) | |
tree | a2574a211e31625b3ddbc3d3fd29adc4747d253a /src/import/chips/p9/procedures | |
parent | 86408b627a526ad89ad5643779429e94a0fb47b1 (diff) | |
download | talos-hostboot-5fea395b2bdc6d3982c6733ad7ef0c7546d38c97.tar.gz talos-hostboot-5fea395b2bdc6d3982c6733ad7ef0c7546d38c97.zip |
Create sample ffdc collection procedure
Change-Id: I4e2c45f08c8f104caeb5b368ff6467b6d2981c48
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30384
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Matt Derksen <v2cibmd@us.ibm.com>
Reviewed-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30387
Reviewed-by: Hostboot Team <hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import/chips/p9/procedures')
4 files changed, 113 insertions, 35 deletions
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 <stdint.h> +#include <hwp_error_info.H> #include <fapi2.H> 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<std::shared_ptr<fapi2::ErrorInfoFfdc>>& 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<fapi2::ErrorInfoFfdc>(new fapi2::ErrorInfoFfdc( 0xdeadbeef, &a, sizeof(a)))); - o_ffdc_data.push_back(std::shared_ptr<fapi2::ErrorInfoFfdc>(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<const uint32_t*>(param1.ptr())); + + switch( pib_rc ) + { + case PIB_RC_EXAMPLE_1: + { + FFDC_DATA1.ptr() = static_cast<void*>(&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<void*>(&my_ffdc_data); + FFDC_DATA1.size() = sizeof(my_ffdc_data); + + FFDC_DATA2.ptr() = static_cast<void*>(&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 <fapi2.H> +#include <return_code.H> +#include <error_info_defs.H> //------------------------------------------------------------------------------ // Structure definitions //------------------------------------------------------------------------------ // function pointer typedef definition for HWP call support -typedef fapi2::ReturnCode (*p9_collect_some_ffdc_FP_t)(std::vector<std::shared_ptr<fapi2::ErrorInfoFfdc>>& 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<std::shared_ptr<fapi2::ErrorInfoFfdc>>& 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 @@ +<!-- IBM_PROLOG_BEGIN_TAG --> +<!-- This is an automatically generated prolog. --> +<!-- --> +<!-- $Source: src/import/chips/p9/procedures/xml/error_info/p9_collect_some_ffdc.xml $ --> +<!-- --> +<!-- OpenPOWER HostBoot Project --> +<!-- --> +<!-- Contributors Listed Below - COPYRIGHT 2016 --> +<!-- [+] International Business Machines Corp. --> +<!-- --> +<!-- --> +<!-- Licensed under the Apache License, Version 2.0 (the "License"); --> +<!-- you may not use this file except in compliance with the License. --> +<!-- You may obtain a copy of the License at --> +<!-- --> +<!-- http://www.apache.org/licenses/LICENSE-2.0 --> +<!-- --> +<!-- Unless required by applicable law or agreed to in writing, software --> +<!-- distributed under the License is distributed on an "AS IS" BASIS, --> +<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or --> +<!-- implied. See the License for the specific language governing --> +<!-- permissions and limitations under the License. --> +<!-- --> +<!-- IBM_PROLOG_END_TAG --> +<hwpErrors> +<hwpError> + <sbeError/> + <rc>RC_PIB_ERROR_1</rc> + <description> + Return code used for testing collectFfdc - returns single piece of data + </description> + <ffdc>FFDC_DATA1</ffdc> +</hwpError> +<hwpError> + <sbeError/> + <rc>RC_PIB_ERROR_2</rc> + <description> + Return code used for testing collectFfdc - returns two pieces of + ffdc data + </description> + <ffdc>FFDC_DATA1</ffdc> + <ffdc>FFDC_DATA2</ffdc> +</hwpError> +</hwpErrors> + + 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 </description> <buffer>BUFFER</buffer> - <!--collectFfdc>p9_collect_some_ffdc,parm1</collectFfdc--> + <collectFfdc>p9_collect_some_ffdc,parm1</collectFfdc> <callout> <procedure>CODE</procedure> <priority>HIGH</priority> @@ -113,26 +113,6 @@ </collectRegisterFfdc> </hwpError> -<hwpError> - <sbeError/> - <rc>RC_PIB_ERROR_1</rc> - <description> - Return code used for testing collectFfdc - returns single piece of data - </description> - <ffdc>FFDC_DATA1</ffdc> -</hwpError> -<hwpError> - <sbeError/> - <rc>RC_PIB_ERROR_2</rc> - <description> - Return code used for testing collectFfdc - returns two pieces of - ffdc data - </description> - <ffdc>FFDC_DATA1</ffdc> - <ffdc>FFDC_DATA2</ffdc> -</hwpError> - - </hwpErrors> |