summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDonald Washburn <dwashbur@us.ibm.com>2017-06-02 09:37:28 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-06-09 14:23:21 -0400
commit6988e53d4cdcb55fadce30c4e2c29fd09098bf32 (patch)
tree2ba05467aaba5fc91cffa6c3162bae241d1185cd /src
parent88eb1def152e5171451da346df9dd5738f15d7de (diff)
downloadtalos-hostboot-6988e53d4cdcb55fadce30c4e2c29fd09098bf32.tar.gz
talos-hostboot-6988e53d4cdcb55fadce30c4e2c29fd09098bf32.zip
Verify buffer support for error log.
Added Unit Tests to verify that a caller buffer is propageted to the error log through an FAPI_INVOKE_HWP call. The Unit Tests use both a fapi2::buffer<uin64_t> and a fapi2::variable_buffer types. Presently, support for using fapi2::variable_buffer is disabled in the code base. The unit tests for the variable_buffer is also disabled. To enable fapi2::variable buffer support the parseErrorInfo.pl script must be invoked with the --use_variable_buffers option. This can be done by adding the --use_variable_buffers option to the parseErrorInfo_RUN macro located in import/hwpf/fapi2/tools/parseErrorInfo.mk. RTC: 161195 Change-Id: I0e372dc72e749f635517eb1752e3ca1ec4d2195b Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41310 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Prachi Gupta <pragupta@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/usr/fapi2/test/fapi2HwpErrorBufferTest.H587
-rw-r--r--src/usr/fapi2/test/fapi2Test.mk1
-rw-r--r--src/usr/fapi2/test/rcSupport.C91
-rw-r--r--src/usr/fapi2/test/rcSupport.H56
4 files changed, 719 insertions, 16 deletions
diff --git a/src/usr/fapi2/test/fapi2HwpErrorBufferTest.H b/src/usr/fapi2/test/fapi2HwpErrorBufferTest.H
new file mode 100644
index 000000000..ab9811ccf
--- /dev/null
+++ b/src/usr/fapi2/test/fapi2HwpErrorBufferTest.H
@@ -0,0 +1,587 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/fapi2/test/fapi2HwpErrorBufferTest.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2017 */
+/* [+] 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 */
+#ifndef __FAPI2_TEST_FAPI2HWPERRORBUFFERTEST_H
+#define __FAPI2_TEST_FAPI2HWPERRORBUFFERTEST_H
+
+#include <cxxtest/TestSuite.H>
+#include "rcSupport.H"
+
+#include <errl/errlmanager.H>
+#include <errl/errlentry.H>
+#include <error_info.H>
+#include <fapi2.H>
+#include <plat_hwp_invoker.H>
+#include <targeting/common/targetservice.H>
+
+#include <hwp_error_info.H>
+#include <hwp_ffdc_classes.H>
+
+namespace fapi2
+{
+
+class Fapi2HwpErrorBufferTest:public CxxTest::TestSuite
+{
+
+public:
+
+ //Test that caller supplied error data is collected for Error Handling
+ //by the FAPI_ASSERT macro when called with the PROC_EXAMPLE_ERROR
+ //generated class. The FAPI_ASSERT macro does not commit information
+ //to the error log
+ //-----------------------------------------------------------------
+ void testU64BufferAddedToHwpErrorNoLog()
+ {
+ //setup enter and exit messages
+ FAPI_INF("Entering testU64BufferAddedToHwpErrorNoLog");
+
+ int l_result = -1;
+
+ do
+ {
+ //Setup buffer for caller supplied information.
+ fapi2::buffer<uint64_t> l_userBuffer{FAPI2_TEST_BUFFER_VALUE};
+
+ //Parameter type for the p9_collect_some_ffdc function.
+ //Can be 0x01 or 0x02. Has relevence for ErrorInfo objects
+ //not related to this test
+ uint32_t l_paramValue = 0x01;
+
+ //Setup return code values
+ fapi2::ReturnCode l_rc{FAPI2_RC_INVALID_PARAMETER};
+ fapi2::errlSeverity_t l_sev = FAPI2_ERRL_SEV_UNRECOVERABLE;
+
+ //get a PROC target for this test.
+ TARGETING::Target *l_procTarget = getProcTarget();
+
+ if(!l_procTarget)
+ {
+ TS_FAIL("Unable to get a Proc target for test.");
+ l_result=1;
+ break;
+ }
+
+ Target<TARGET_TYPE_PROC_CHIP> l_testTarget{l_procTarget};
+
+ //Create error class and do FAPI_ASSERT.
+ //The FAPI_ASSERT will collect error data but will
+ //not commit the data to the error log.
+ PROC_EXAMPLE_ERROR l_testError{l_sev, l_rc};
+
+ FAPI_ASSERT(false,
+ l_testError.set_BUFFER(l_userBuffer)
+ .set_parm1(l_paramValue)
+ .set_UNIT_TEST_CHIP_TARGET(l_testTarget),
+ "testU64BufferAddedToHwpErrorNoLog Unit Test"
+ );
+
+//Label required by the FAPI_ASSERT Macro
+fapi_try_exit:
+
+ //check results
+
+ //Since the error data was not logged, no errlHandl_t pointer
+ //should have been placed in the ReturnCode object.
+ if(nullptr != l_rc.getPlatDataPtr())
+ {
+ TS_FAIL("l_rc contains a non-null platform pointer.");
+ l_result = 2;
+ break;
+ }
+ FAPI_INF("l_rc did not contain a errlHndl_t pointer (expected)");
+
+
+ //The caller suppiled buffer should not have been modified.
+ if(nullptr == l_testError.BUFFER.ptr())
+ {
+ TS_FAIL("l_testError.BUFFER.ptr was set to NULL during test!");
+ l_result = 3;
+ break;
+ }
+
+ //Ensure that the BUFFER object contains the same value.
+ if(FAPI2_TEST_BUFFER_VALUE !=
+ *(reinterpret_cast<const uint64_t*>(l_testError.BUFFER.ptr())))
+ {
+ FAPI_INF("l_testError.BUFFER.ptr() contains the value %X",
+ *(reinterpret_cast<const uint64_t*>(l_testError.BUFFER.ptr()))
+ );
+ TS_FAIL("l_testError.BUFFER data was changed during the test");
+ l_result = 4;
+ break;
+ }
+ FAPI_INF("BUFFER data was not modified during test (expected)");
+
+ //Check that ErrorInfo was generated during the FAPI_ASSERT call.
+ if(nullptr == l_rc.getErrorInfo())
+ {
+ TS_FAIL("Did not generate ErrorInfo data during test!");
+ l_result = 5;
+ break;
+ }
+ else if(l_rc.getErrorInfo()->iv_ffdcs.empty())
+ {
+ TS_FAIL("Did not generate ErrorInfoFFDC data during test!");
+ l_result = 6;
+ break;
+ }
+ else
+ {
+ FAPI_INF("Test Generated ErrorInfoFFDC data (expected)");
+ }
+
+ //The processing for the fapi2::PROC_EXAMPLE_ERROR class will
+ //place an ErrorInfoFfdc object representing the BUFFER data as the
+ //last ErrorInfoFfdc obect in a vector of ErrorInfoFfdc's in
+ //the ReturnCode.
+ const std::shared_ptr<ErrorInfoFfdc>& l_lastFFDC =
+ l_rc.getErrorInfo()->iv_ffdcs.back();
+
+ if(!l_lastFFDC)
+ {
+ TS_FAIL("ErrorInfoFfdc pointer "
+ "returned from last FFDC is NULL.");
+ l_result = 7;
+ break;
+ }
+
+ //Check that the last ErrorInfoFfdc's ffdc id is as expected
+ FAPI_INF("Checking that last ErrorInfoFFDC ffdcid has value %X",
+ RC_PROC_EXAMPLE_ERROR_BUFFER);
+
+ if(RC_PROC_EXAMPLE_ERROR_BUFFER != l_lastFFDC->getFfdcId())
+ {
+ FAPI_ERR("Last ErrorInfoFFDC ffdcid actual value %X, "
+ "expected value %X",
+ l_lastFFDC->getFfdcId(),
+ RC_PROC_EXAMPLE_ERROR_BUFFER
+ );
+ TS_FAIL("ErrorInfoFFDC ffdc id does not match expected value "
+ "fapi2::RC_PROC_EXAMPLE_ERROR_BUFFER."
+ );
+ l_result = 8;
+ break;
+ }
+
+ FAPI_INF("Last ErrorInfoFFDC ffdcid was equal to %X (expected)",
+ l_lastFFDC->getFfdcId());
+
+ //Check that the last ErrorInfoFfdc data and size
+ //match fapi2::PROC_EXAMPLE_ERROR::BUFFER
+ uint32_t l_ffdc_data_size{};
+ const void* l_ffdc_data = l_lastFFDC->getData(l_ffdc_data_size);
+
+ if(nullptr == l_ffdc_data)
+ {
+ TS_FAIL("ErrorInfoFFDC buffer is NULL");
+ l_result = 9;
+ break;
+ }
+
+ if(l_ffdc_data_size != getErrorInfoFfdcSize(l_testError.BUFFER))
+ {
+ FAPI_ERR("ErrorInfoFFDC size: %X, l_testError.BUFFER size: %X",
+ l_ffdc_data_size,
+ getErrorInfoFfdcSize(l_testError.BUFFER)
+ );
+ TS_FAIL("ErrorInfoFFDC size does not match BUFFER size");
+ l_result = 10;
+ break;
+ }
+
+ FAPI_INF("ErrorInfoFFDC buffer vlaue: %X, "
+ "PROC_EXAMPLE_ERROR::BUFFER: %X",
+ *(reinterpret_cast<const uint64_t*>(l_ffdc_data)),
+ *(reinterpret_cast<const uint64_t*>(l_testError.BUFFER.ptr()))
+ );
+
+ if(*(reinterpret_cast<const uint64_t*>(l_ffdc_data)) !=
+ *(reinterpret_cast<const uint64_t*>(l_testError.BUFFER.ptr())))
+ {
+ TS_FAIL("ErrorInfoFFDC buffer value does not match"
+ " fapi2::PROC_EXAMPLE_ERROR::BUFFER.");
+ l_result = 11;
+ break;
+ }
+
+ //Test passed. Log information
+ FAPI_INF("Last ErrorInfoFFDC data matches BUFFER passed to "
+ "the test PROC_EXAMPLE_ERROR object. (expected)"
+ "Data value: %X, FFDC id: %X",
+ *(reinterpret_cast<const uint64_t*>(l_ffdc_data)),
+ l_lastFFDC->getFfdcId()
+ );
+
+ l_result = 0;
+
+ }
+ while(0);
+
+ FAPI_INF("Exiting "
+ "testU64BufferAddedToHwpErrorNoLog "
+ "Result (%d) - %s",
+ l_result,
+ (0x00 == l_result)?"Passed":"Failed"
+ );
+ }
+
+ //Test that caller supplied Error information (fapi::buffer<>)
+ //is propagated to the error log through a call to FAPI_INVOKE_HWP
+ //-----------------------------------------------------------------------
+ void testU64BufferAddedToInvokeHWPError()
+ {
+ FAPI_INF("Entering testU64BufferAddedToInvokeHWPError");
+
+ int l_result = -1;
+
+ //prepare test data
+
+ do
+ {
+ //get a PROC target for this test.
+ TARGETING::Target *l_procTarget = getProcTarget();
+
+ if(!l_procTarget)
+ {
+ TS_FAIL("Unable to get a Proc target for test.");
+ l_result=1;
+ break;
+ }
+
+ Target<TARGET_TYPE_PROC_CHIP> l_testTarget{l_procTarget};
+
+ errlHndl_t l_err{};
+
+ //invoke the simulated hardware function.
+ FAPI_INVOKE_HWP(l_err, p9ErrorWithBuffer, l_testTarget);
+
+ if(!l_err)
+ {
+ TS_FAIL("FAPI_INVOKE_HWP did not return error information.");
+ l_result = 2;
+ break;
+ }
+
+ //Find the caller supplied information in the error log.
+ bool l_found_ud_section{false};
+
+ std::vector<void*> ud_sections =
+ l_err->getUDSections(HWPF_COMP_ID, HWPF_FAPI2_UDT_HWP_FFDC);
+
+ if(ud_sections.empty())
+ {
+ TS_FAIL("err_ptr->getUDSections did not return any data.");
+ l_result = 3;
+ break;
+ }
+
+ FAPI_INF("err_ptr->getUDSections returned %d sections",
+ ud_sections.size());
+
+ //The buffer we are looking for has the following format:
+ // |-- fapi2::RC_PROC_EXAMPLE_ERROR_BUFFER uint32_t --|
+ // | -- uint64_t (BUFFER val) --|
+ for(const void* ptr: ud_sections)
+ {
+ if(ptr)
+ {
+ const char* l_ptrBuf = reinterpret_cast<const char*>(ptr);
+ uint32_t l_u32val{};
+
+ //copy data to ensure alignment
+ memcpy(&l_u32val, l_ptrBuf, sizeof(l_u32val));
+ if(RC_PROC_EXAMPLE_ERROR_BUFFER == l_u32val)
+ {
+ l_ptrBuf += sizeof(l_u32val);
+ uint64_t l_u64val{};
+ memcpy(&l_u64val, l_ptrBuf, sizeof(l_u64val));
+ if(FAPI2_TEST_BUFFER_VALUE == l_u64val)
+ {
+ l_found_ud_section = true;
+ FAPI_INF("Found UD section with expected values. "
+ "ffdc id: %X, "
+ "user data: %X",
+ l_u32val,
+ l_u64val
+ );
+ break;
+ }
+ }
+ }
+ }
+
+ if(!l_found_ud_section)
+ {
+ TS_FAIL("Did not find the error log UD section that contained "
+ "caller suppiled buffer.");
+ l_result = 4;
+ break;
+ }
+
+ //Test data is in the log, now commit the error log.
+ errlCommit(l_err, HWPF_COMP_ID);
+
+ if(l_err)
+ {
+ delete l_err;
+ l_err = nullptr;
+
+ TS_FAIL("Failed to commit error log!");
+ l_result = 5;
+ break;
+ }
+
+ l_result = 0;
+ }
+ while(0);
+
+ FAPI_INF("Exiting "
+ "testU64BufferAddedToInvokeHWPError "
+ "Result (%d) - %s",
+ l_result,
+ (0x00 == l_result)?"Passed":"Failed");
+ }
+
+
+ //Test that caller supplied Error information (fapi2::buffer_variable)
+ //is propagated to the Error Log through a call to FAPI_INVOKE_HWP
+ //-----------------------------------------------------------------------
+ void testVariableBufferAddedToInvokeHWPError()
+ {
+ FAPI_INF("Entering testVariableBufferAddedToInvokeHWPError");
+
+ int l_result = -1;
+
+//The generated classes in hwp_ffdc_classes.H are not produced to support
+//fapi2::variable_buffer.In order to enable the following test the
+//parseErrorInfo.pl script must be configured to use variable buffers.
+//To enable variable buffer support ensure that the parseErrorInfo_RUN
+//macro in import/hwpf/fapi2/tools/parseErrorInfo.mk is defined to
+//include the --use-variable-buffers option as shown below.
+//$(C1) $$< --use-variable-buffers --output-dir=$$($(GENERATED)_PATH) ...
+
+//Disable unless parseErrorInfo.pl --use-variable-buffers invoked to
+//generate hwp_ffdc_classes.H.
+
+ do
+ {
+#if 0
+ //get a PROC target for this test.
+ TARGETING::Target *l_procTarget = getProcTarget();
+
+ if(!l_procTarget)
+ {
+ TS_FAIL("Unable to get a Proc target for test.");
+ l_result=1;
+ break;
+ }
+
+ Target<TARGET_TYPE_PROC_CHIP> l_testTarget{l_procTarget};
+
+ errlHndl_t l_err{};
+ //Call the simulated hardware function to generate an error.
+ FAPI_INVOKE_HWP(l_err,
+ p9ErrorWithVariableBuffer,
+ l_testTarget
+ );
+
+ if(!l_err)
+ {
+ TS_FAIL("FAPI_INVOKE_HWP did not return error information.");
+ l_result = 2;
+ break;
+ }
+
+ //Find the caller supplied information in the error log.
+ bool l_found_ud_section{false};
+
+ std::vector<void*> ud_sections =
+ l_err->getUDSections(HWPF_COMP_ID, HWPF_FAPI2_UDT_HWP_FFDC);
+
+ if(ud_sections.empty())
+ {
+ TS_FAIL("err_ptr->getUDSections did not return any data.");
+ l_result = 3;
+ break;
+ }
+
+ FAPI_INF("err_ptr->getUDSections returned %d sections",
+ ud_sections.size());
+
+ //The buffer we are looking for has the following format:
+ // |-- fapi2::RC_PROC_EXAMPLE_ERROR_BUFFER uint32_t --|
+ // | -- uint32_t (BUFFER val[0])--|
+ // | -- uint32_t (BUFFER val[1])--|
+ // .....
+ for(const void* ptr: ud_sections)
+ {
+ if(ptr)
+ {
+ const char* l_ptrBuffer =
+ reinterpret_cast<const char*>(ptr);
+ uint32_t l_u32val{};
+ memcpy(&l_u32val, l_ptrBuffer, sizeof(l_u32val));
+ int l_hitCount{};
+ if(RC_PROC_EXAMPLE_ERROR_BUFFER == l_u32val)
+ {
+ for(unsigned int i=0;
+ i < VARIABLE_BUFFER_ELEMENTS; ++i)
+ {
+ l_ptrBuffer += sizeof(l_u32val);
+ memcpy(&l_u32val, l_ptrBuffer, sizeof(l_u32val));
+ if(FAPI2_TEST_VARIABLE_BUFFER_VALUE[i] == l_u32val)
+ {
+ ++l_hitCount;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ //print buffer values for information.
+ if(VARIABLE_BUFFER_ELEMENTS ==
+ static_cast<uint32_t>(l_hitCount))
+ {
+ int l_remain{};
+ int l_ct{};
+ char l_infoString[256] = {0};
+ char* l_ptr = l_infoString;
+
+ l_found_ud_section = true;
+ l_remain = static_cast<int>(sizeof(l_infoString));
+ l_ct = snprintf(
+ l_ptr,
+ l_remain,
+ "Found UD section with expected values."
+ " ffdc id: %X ",
+ RC_PROC_EXAMPLE_ERROR_BUFFER
+ );
+
+ for(int i = 0; i < l_hitCount; ++i)
+ {
+ if(l_ct > 0 && l_ct < l_remain)
+ {
+ l_remain -= l_ct;
+
+ if(l_remain <= 0)
+ {
+ break;
+ }
+
+ l_ptr += l_ct;
+ l_ct = snprintf(
+ l_ptr,
+ l_remain,
+ ", Data[%d]: %X ",
+ i,
+ FAPI2_TEST_VARIABLE_BUFFER_VALUE[i]
+ );
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ FAPI_INF("%s", l_infoString);
+
+ //found our user data section.
+ break;
+ }
+ }
+ }
+ }
+
+ if(!l_found_ud_section)
+ {
+ TS_FAIL("Did not find the error log UD section that contained "
+ "caller suppiled buffer."
+ );
+ l_result = 4;
+ break;
+ }
+
+ //test data was in the log, commit error log.
+ errlCommit(l_err, HWPF_COMP_ID);
+
+ if(l_err)
+ {
+ delete l_err;
+ l_err = nullptr;
+
+ TS_FAIL("Failed to commit error log!");
+ l_result = 5;
+ break;
+ }
+
+#endif
+ l_result = 0;
+
+ }
+ while(0);
+
+ FAPI_INF("Exiting "
+ "testVariableBufferAddedToInvokeHWPError"
+ "Result (%d) - %s",
+ l_result,
+ (0x00 == l_result)?"Passed":"Failed");
+ }
+
+private:
+ TARGETING::Target * iv_procTarget = nullptr;
+
+ //cache a proc chip for all the tests
+ TARGETING::Target* getProcTarget()
+ {
+ if(!iv_procTarget)
+ {
+ TARGETING::TargetHandleList l_targetList;
+ TARGETING::getAllChips(l_targetList, TARGETING::TYPE_PROC, false);
+
+ if(l_targetList.empty())
+ {
+ FAPI_ERR("Unable to get a Proc target for test.");
+ }
+ else
+ {
+ FAPI_INF("getAllChips returned %X processor chips.",
+ l_targetList.size());
+ iv_procTarget = l_targetList[0];
+ }
+ }
+
+ return iv_procTarget;
+ }
+};
+
+}
+
+//CxxTest does not use the enclosing namespace for a test class.
+//Place this here in case we are the first or only unit test.
+//If no unit test defines the namespace declaration CxxTest
+//runner will fail to compile.
+using namespace fapi2;
+
+#endif
diff --git a/src/usr/fapi2/test/fapi2Test.mk b/src/usr/fapi2/test/fapi2Test.mk
index 2ffb16e5d..3a4e4c7e4 100644
--- a/src/usr/fapi2/test/fapi2Test.mk
+++ b/src/usr/fapi2/test/fapi2Test.mk
@@ -38,6 +38,7 @@ EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/pm/
EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/accessors/
EXTRAINCDIR += ${ROOTPATH}/src/include/usr/targeting/common/
EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc/
+EXTRAINCDIR += ${ROOTPATH}/obj/genfiles/
# Procedures
OBJS += p9_sample_procedure.o
diff --git a/src/usr/fapi2/test/rcSupport.C b/src/usr/fapi2/test/rcSupport.C
index f0ebed58d..537f8567f 100644
--- a/src/usr/fapi2/test/rcSupport.C
+++ b/src/usr/fapi2/test/rcSupport.C
@@ -34,6 +34,19 @@
#include <rcSupport.H>
#include <plat_hwp_invoker.H>
+#include <hwp_error_info.H>
+#include <hwp_ffdc_classes.H>
+
+const uint64_t FAPI2_TEST_BUFFER_VALUE = 0x123456789ABCDEF;
+const uint32_t FAPI2_TEST_VARIABLE_BUFFER_VALUE[] =
+ {
+ 0x12345678,
+ 0x9ABCDEF
+ };
+const uint32_t VARIABLE_BUFFER_ELEMENTS =
+ sizeof(FAPI2_TEST_VARIABLE_BUFFER_VALUE)/
+ sizeof(FAPI2_TEST_VARIABLE_BUFFER_VALUE[0]);
+
//******************************************************************************
// p9_ffdc_fail. Returns a fapi2::ReturnCode with an ffdc entry
@@ -65,10 +78,9 @@ fapi2::ReturnCode p9_registerFfdc_fail(
FAPI_ASSERT(0, fapi2::TEST_ERROR_A().set_TARGET(i_proc_target));
- fapi_try_exit:
+fapi_try_exit:
FAPI_INF("Exiting p9_registerFfdc_fail...");
-
return fapi2::current_err;
}
@@ -167,3 +179,78 @@ fapi2::ReturnCode p9_hwCallout(
return fapi2::current_err;
}
+
+//****************************************************************************
+// p9ErrorWithBuffer
+// Force an error that will use a caller populated fapi2::buffer<>
+//****************************************************************************
+fapi2::ReturnCode p9ErrorWithBuffer(
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target)
+{
+ FAPI_INF("Entering p9ErrorWithBuffer");
+
+ fapi2::buffer<uint64_t> l_userBuffer{FAPI2_TEST_BUFFER_VALUE};
+
+ //Parameter type for the p9_collect_some_ffdc function.
+ //Can be 0x01 or 0x02. Has relevence for ErrorInfo objects
+ //not related to this test.
+ uint32_t l_paramValue = 0x01;
+
+ fapi2::current_err = fapi2::FAPI2_RC_INVALID_PARAMETER;
+
+ FAPI_ASSERT(false,
+ fapi2::PROC_EXAMPLE_ERROR().set_BUFFER(l_userBuffer)
+ .set_parm1(l_paramValue)
+ .set_UNIT_TEST_CHIP_TARGET(i_target),
+ "p9ErrorWithBuffer Unit Test"
+ );
+
+fapi_try_exit:
+ FAPI_INF("Exiting p9ErrorWithBuffer");
+ return fapi2::current_err;
+}
+
+#if 0
+//The generated classes in hwp_ffdc_classes.H are not produced to support
+//fapi2::variable_buffer.In order to enable the following function the
+//parseErrorInfo.pl script must be configured to use variable buffers.
+//To enable variable buffer support ensure that the parseErrorInfo_RUN
+//macro in import/hwpf/fapi2/tools/parseErrorInfo.mk is defined to
+//include the --use-variable-buffers option as shown below.
+//$(C1) $$< --use-variable-buffers --output-dir=$$($(GENERATED)_PATH) ...
+//
+//****************************************************************************
+// p9ErrorWithVariableBuffer
+// Force an error that will use a caller populated fapi2::variable_buffer
+//****************************************************************************
+fapi2::ReturnCode p9ErrorWithVariableBuffer(
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target)
+{
+ FAPI_INF("Entering p9ErrorWithVariableBuffer");
+
+ fapi2::variable_buffer l_userBuffer(FAPI2_TEST_VARIABLE_BUFFER_VALUE,
+ VARIABLE_BUFFER_ELEMENTS,
+ VARIABLE_BUFFER_ELEMENTS*32
+ );
+
+ //Parameter type for the p9_collect_some_ffdc function.
+ //Can be 0x01 or 0x02. Has relevence for ErrorInfo objects
+ //not related to this test
+ uint32_t l_paramValue = 0x01;
+
+ fapi2::current_err = fapi2::FAPI2_RC_INVALID_PARAMETER;
+
+ FAPI_ASSERT(false,
+ fapi2::PROC_EXAMPLE_ERROR().set_BUFFER(l_userBuffer)
+ .set_parm1(l_paramValue)
+ .set_UNIT_TEST_CHIP_TARGET(i_target),
+ "p9ErrorWithVariableBuffer Unit Test"
+ );
+
+fapi_try_exit:
+ FAPI_INF("Exiting p9ErrorWithVariableBuffer");
+ return fapi2::current_err;
+}
+#endif
+
+
diff --git a/src/usr/fapi2/test/rcSupport.H b/src/usr/fapi2/test/rcSupport.H
index 74867623c..1968bcf2f 100644
--- a/src/usr/fapi2/test/rcSupport.H
+++ b/src/usr/fapi2/test/rcSupport.H
@@ -33,52 +33,80 @@
#include <fapi2.H>
-//******************************************************************************
+extern const uint32_t VARIABLE_BUFFER_ELEMENTS;
+extern const uint64_t FAPI2_TEST_BUFFER_VALUE;
+extern const uint32_t FAPI2_TEST_VARIABLE_BUFFER_VALUE[];
+
+//*****************************************************************************
// p9_ffdc_fail. Returns a fapi2::ReturnCode with an ffdc entry
-//******************************************************************************
+//*****************************************************************************
fapi2::ReturnCode p9_ffdc_fail(void);
-//******************************************************************************
+//*****************************************************************************
// p9_registerFfdc_fail.
// Returns a fapi2::ReturnCode with registery reads of a target
-//******************************************************************************
+//*****************************************************************************
fapi2::ReturnCode p9_registerFfdc_fail(
fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_proc_target);
-//******************************************************************************
+//*****************************************************************************
// p9_procedureFfdc_fail.
// Cause a failure which calls a procedure that fills in some ffdc into the
// fapi2::ReturnCode
-//******************************************************************************
+//*****************************************************************************
fapi2::ReturnCode p9_procedureFfdc_fail(void);
-//******************************************************************************
+//*****************************************************************************
// p9_gardAndDeconfig
// Force a test return code that deconfigures the target and gards it
-//******************************************************************************
+//****************************************************************************
fapi2::ReturnCode p9_gardAndDeconfig(
fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_proc_target);
-//******************************************************************************
+//*****************************************************************************
// p9_deconfigCallout
// Force a test return code that deconfigures the target
-//******************************************************************************
+//*****************************************************************************
fapi2::ReturnCode p9_deconfigCallout(
fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_dimm_target);
-//******************************************************************************
+//*****************************************************************************
// p9_procedureCallout
// Force a test return code that creates a procedure callout
-//******************************************************************************
+//*****************************************************************************
fapi2::ReturnCode p9_procedureCallout();
-//******************************************************************************
+//*****************************************************************************
// p9_hwCallout
// Force a test return code that creates a hw callout
-//******************************************************************************
+//*****************************************************************************
fapi2::ReturnCode p9_hwCallout(
fapi2::Target<fapi2::TARGET_TYPE_CORE>& i_core_target);
+//****************************************************************************
+// p9ErrorWithBuffer
+// Force an error that will use a caller populated fapi2::buffer<>
+//****************************************************************************
+fapi2::ReturnCode p9ErrorWithBuffer(
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target);
+
+#if 0
+//The generated classes in hwp_ffdc_classes.H are not produced to support
+//fapi2::variable_buffer.In order to enable the following function the
+//parseErrorInfo.pl script must be configured to use variable buffers.
+//To enable variable buffer support ensure that the parseErrorInfo_RUN
+//macro in import/hwpf/fapi2/tools/parseErrorInfo.mk is defined to
+//include the --use-variable-buffers option as shown below.
+//$(C1) $$< --use-variable-buffers --output-dir=$$($(GENERATED)_PATH) ...
+
+//*****************************************************************************
+// p9ErrorWithVariableBuffer
+// Force an error that will use a caller populated fapi2::variable_buffer
+//*****************************************************************************
+fapi2::ReturnCode p9ErrorWithVariableBuffer(
+ fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target);
+#endif
+
#endif
OpenPOWER on IntegriCloud