diff options
author | Ilya Smirnov <ismirno@us.ibm.com> | 2018-01-30 14:46:48 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-02-12 12:01:07 -0500 |
commit | 4648dad462fddbd4e4bd829b04b1a7090be409b5 (patch) | |
tree | 2ccf0047a8548f236853bfc688786fc8d279fa71 /src/usr/fapi2 | |
parent | c80dab12a8551cc1d7b22c1c142f6bbf2bf3da8e (diff) | |
download | talos-hostboot-4648dad462fddbd4e4bd829b04b1a7090be409b5.tar.gz talos-hostboot-4648dad462fddbd4e4bd829b04b1a7090be409b5.zip |
Populate the Severity of PLAT Errors
An issue was observed where recovered PLAT error logs were not
being properly hidden/skipped and incorrect severity was
assigned to those error logs. The reason is that the path of
code that PLAT errors take fails to overwrite the default severity
(unrecoverable). A fix is to explicitly set the severity of all
errors at the end of rcToErrl.
Change-Id: Ib0aff72a800e0ed7a5b48e753049d2f3422406b4
CQ:SW410923
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/53221
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/fapi2')
-rw-r--r-- | src/usr/fapi2/plat_utils.C | 4 | ||||
-rw-r--r-- | src/usr/fapi2/test/fapi2CreatePlatLogTest.H | 218 |
2 files changed, 222 insertions, 0 deletions
diff --git a/src/usr/fapi2/plat_utils.C b/src/usr/fapi2/plat_utils.C index dc4493391..d134582ea 100644 --- a/src/usr/fapi2/plat_utils.C +++ b/src/usr/fapi2/plat_utils.C @@ -955,6 +955,10 @@ errlHndl_t rcToErrl(ReturnCode & io_rc, l_pError->collectTrace(FAPI_IMP_TRACE_NAME, 384 ); l_pError->collectTrace(FAPI_SCAN_TRACE_NAME, 256 ); l_pError->collectTrace(FAPI_DBG_TRACE_NAME, 256 ); + + // Make sure the severity is set correctly for all errors. + // The severity of PLAT errors is not set above, so set it here. + l_pError->setSev(i_sev); } FAPI_DBG("Exiting rcToErrl"); diff --git a/src/usr/fapi2/test/fapi2CreatePlatLogTest.H b/src/usr/fapi2/test/fapi2CreatePlatLogTest.H new file mode 100644 index 000000000..3cccd74c1 --- /dev/null +++ b/src/usr/fapi2/test/fapi2CreatePlatLogTest.H @@ -0,0 +1,218 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/fapi2/test/fapi2CreatePlatLogTest.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2018 */ +/* [+] 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 */ + +#include <plat_utils.H> +#include <hwpf_fapi2_reasoncodes.H> +#include <cxxtest/TestSuite.H> +#include <errl/errlmanager.H> +#include <errl/hberrltypes.H> +#include <errl/errlreasoncodes.H> +#include <errl/errlentry.H> + +extern trace_desc_t* g_trac_runtime; + +class CreatePlatLogTest : public CxxTest::TestSuite +{ +public: + + void testCreatePlatLogCreatorFapi2() + { + TRACFCOMP(g_trac_runtime, "testCreatePlatLogCreatorFapi2 running"); + + fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_INVALID_ATTR_GET; + fapi2::errlSeverity_t l_sev = fapi2::FAPI2_ERRL_SEV_RECOVERED; + createPlatLog(l_rc, l_sev); + errlHndl_t l_errl = reinterpret_cast<errlHndl_t>(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_RECOVERED) + { + TS_FAIL("testCreatePlatLogCreatorFapi2: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_RECOVERED, + l_errl->sev()); + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorFapi2: ERRL_SEV_RECOVERED passed"); + } + l_rc.forgetData(); + + + l_sev = fapi2::FAPI2_ERRL_SEV_PREDICTIVE; + createPlatLog(l_rc, l_sev); + l_errl = reinterpret_cast<errlHndl_t>(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_PREDICTIVE) + { + TS_FAIL("testCreatePlatLogCreatorFapi2: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_PREDICTIVE, + l_errl->sev()); + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorFapi2: ERRL_SEV_PREDICTIVE passed"); + } + l_rc.forgetData(); + + + l_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE; + createPlatLog(l_rc, l_sev); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_UNRECOVERABLE) + { + TS_FAIL("testCreatePlatLogCreatorFapi2: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_PREDICTIVE, + l_errl->sev()); + + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorFapi2: ERRL_SEV_UNRECOVERABLE passed"); + } + l_rc.forgetData(); + + TRACFCOMP(g_trac_runtime, "testCreatePlatLogCreatorFapi2 done"); + } + + void testCreatePlatLogCreatorPlat() + { + TRACFCOMP(g_trac_runtime, "testCreatePlatLogCreatorPlat running"); + + fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_PLAT_ERR_SEE_DATA; + fapi2::errlSeverity_t l_sev = fapi2::FAPI2_ERRL_SEV_RECOVERED; + // Allocate a fake error log since PLAT code path expects a non-null ptr + errlHndl_t l_errl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_INFORMATIONAL, + ERRORLOG::ERRL_FIRST_MODULE_ID, + fapi2::RC_HWP_GENERATED_ERROR, + ERRORLOG::ERRL_TEST_REASON_CODE); + l_rc.setPlatDataPtr(reinterpret_cast<void *>(l_errl)); + + createPlatLog(l_rc, l_sev); + l_errl = reinterpret_cast<errlHndl_t>(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_RECOVERED) + { + TS_FAIL("testCreatePlatLogCreatorPlat: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_RECOVERED, + l_errl->sev()); + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorPlat: ERRL_SEV_RECOVERED passed"); + } + + l_sev = fapi2::FAPI2_ERRL_SEV_PREDICTIVE; + createPlatLog(l_rc, l_sev); + l_errl = reinterpret_cast<errlHndl_t>(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_PREDICTIVE) + { + TS_FAIL("testCreatePlatLogCreatorPlat: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_PREDICTIVE, + l_errl->sev()); + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorPlat: ERRL_SEV_PREDICTIVE passed"); + } + + l_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE; + createPlatLog(l_rc, l_sev); + l_errl = reinterpret_cast<errlHndl_t>(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_UNRECOVERABLE) + { + TS_FAIL("testCreatePlatLogCreatorPlat: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_PREDICTIVE, + l_errl->sev()); + + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorPlat: ERRL_SEV_UNRECOVERABLE passed"); + } + l_rc.forgetData(); + + TRACFCOMP(g_trac_runtime, "testCreatePlatLogCreatorPlat done"); + } + + void testCreatePlatLogCreatorHwp() + { + TRACFCOMP(g_trac_runtime, "testCreatePlatLogCreatorHwp running"); + + fapi2::ReturnCode l_rc = 0x00000001; // Fake return code wit creator == HWP + fapi2::errlSeverity_t l_sev = fapi2::FAPI2_ERRL_SEV_RECOVERED; + createPlatLog(l_rc, l_sev); + errlHndl_t l_errl = reinterpret_cast<errlHndl_t>(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_RECOVERED) + { + TS_FAIL("testCreatePlatLogCreatorHwp: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_RECOVERED, + l_errl->sev()); + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorHwp: ERRL_SEV_RECOVERED passed"); + } + l_rc.forgetData(); + + l_sev = fapi2::FAPI2_ERRL_SEV_PREDICTIVE; + createPlatLog(l_rc, l_sev); + l_errl = reinterpret_cast<errlHndl_t>(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_PREDICTIVE) + { + TS_FAIL("testCreatePlatLogCreatorHwp: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_PREDICTIVE, + l_errl->sev()); + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorHwp: ERRL_SEV_PREDICTIVE passed"); + } + l_rc.forgetData(); + + l_sev = fapi2::FAPI2_ERRL_SEV_UNRECOVERABLE; + createPlatLog(l_rc, l_sev); + l_errl = reinterpret_cast<errlHndl_t>(l_rc.getPlatDataPtr()); + if(l_errl->sev() != ERRORLOG::ERRL_SEV_UNRECOVERABLE) + { + TS_FAIL("testCreatePlatLogCreatorHwp: incorrect errl severity. " + "Expected: %x Actual: %x", + ERRORLOG::ERRL_SEV_PREDICTIVE, + l_errl->sev()); + + } + else + { + TRACDCOMP(g_trac_runtime, "testCreatePlatLogCreatorHwp: ERRL_SEV_UNRECOVERABLE passed"); + } + l_rc.forgetData(); + + TRACFCOMP(g_trac_runtime, "testCreatePlatLogCreatorHwp done"); + } +}; + |