summaryrefslogtreecommitdiffstats
path: root/src/usr/errl
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/errl')
-rw-r--r--src/usr/errl/runtime/makefile16
-rw-r--r--src/usr/errl/runtime/test/makefile5
-rw-r--r--src/usr/errl/runtime/test/test_runtimeDeconfig.H290
3 files changed, 309 insertions, 2 deletions
diff --git a/src/usr/errl/runtime/makefile b/src/usr/errl/runtime/makefile
index d4d097dfe..4c6f20262 100644
--- a/src/usr/errl/runtime/makefile
+++ b/src/usr/errl/runtime/makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2013,2017
+# Contributors Listed Below - COPYRIGHT 2013,2018
# [+] International Business Machines Corp.
#
#
@@ -29,6 +29,18 @@ MODULE = errl_rt
#include common ojects between hostboot and runtime hostboot
include ../errl.mk
+#needed to compile hwasPlatDeconfigGard in runtime context
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/fapi2
+EXTRAINCDIR += ${ROOTPATH}/src/import/hwpf/fapi2/include
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/pm
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/common/utils/imageProcs
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/common/include
+
+
+# need find the source for this hwp in runtime env
+VPATH += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/pm
+
VPATH += ${ROOTPATH}/src/usr/hwas/common
VPATH += ${ROOTPATH}/src/usr/hwas
@@ -37,6 +49,8 @@ OBJS += rt_vfs.o
OBJS += hwasCallout.o
OBJS += deconfigGard.o
OBJS += hwasPlatDeconfigGard.o
+OBJS += p9_update_ec_eq_state.o
+
SUBDIRS += test.d
diff --git a/src/usr/errl/runtime/test/makefile b/src/usr/errl/runtime/test/makefile
index de9d58e18..8c9326ca8 100644
--- a/src/usr/errl/runtime/test/makefile
+++ b/src/usr/errl/runtime/test/makefile
@@ -5,7 +5,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2013,2014
+# Contributors Listed Below - COPYRIGHT 2013,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.
@@ -24,6 +26,7 @@ HOSTBOOT_RUNTIME = 1
ROOTPATH = ../../../../..
MODULE = testerrl_rt
+
TESTS = *.H
include ${ROOTPATH}/config.mk
diff --git a/src/usr/errl/runtime/test/test_runtimeDeconfig.H b/src/usr/errl/runtime/test/test_runtimeDeconfig.H
new file mode 100644
index 000000000..2f5d37259
--- /dev/null
+++ b/src/usr/errl/runtime/test/test_runtimeDeconfig.H
@@ -0,0 +1,290 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/errl/runtime/test/test_runtimeDeconfig.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 */
+#ifndef _TEST_DECONFIGRUNTIME_H
+#define _TEST_DECONFIGRUNTIME_H
+
+#include <cxxtest/TestSuite.H>
+#include <attributestructs.H>
+#include <errl/errlmanager.H>
+#include <runtime/interface.h>
+#include <hwas/common/hwas_reasoncodes.H>
+#include <hwas/common/hwas.H>
+#include <hwas/common/deconfigGard.H>
+#include <targeting/common/utilFilter.H>
+
+extern trace_desc_t* g_trac_runtime;
+
+// enable this test to execute all unit tests
+//#define __ENABLE_DECONFIG_TEST
+
+class deconfigureTargetAtRuntimeTest : public CxxTest::TestSuite
+{
+ public:
+
+
+ void testNullTarget()
+ {
+ TRACFCOMP(g_trac_runtime, "testNullTarget running");
+
+ // pass in a null target pointer
+ TARGETING::Target * l_target = nullptr;
+
+ errlHndl_t l_errl =
+ HWAS::theDeconfigGard().deconfigureTargetAtRuntime(
+ l_target,
+ HWAS::DeconfigGard::FULLY_AT_RUNTIME,
+ l_errl);
+
+ do{
+
+ if(l_errl)
+ {
+ TRACFCOMP(g_trac_runtime, "testNullTarget:"
+ " errl returned (expected)");
+
+ //Check module id and reason code
+ if((l_errl->moduleId() == HWAS::MOD_RUNTIME_DECONFIG) and
+ (l_errl->reasonCode() == HWAS::RC_NULL_TARGET))
+ {
+ TRACFCOMP(g_trac_runtime, "testNullTarget:"
+ " error's module id and reason code match "
+ "expected values");
+
+ }
+ else
+ {
+ TS_FAIL("testNullTarget: error with unexpected"
+ " module id/reason code returned. Expected module "
+ "id = 0x%x returned module id = 0x%x; expected "
+ "reason code ="
+ " 0x%x returned reason code = 0x%x",
+ HWAS::MOD_RUNTIME_DECONFIG,
+ l_errl->moduleId(),
+ HWAS::RC_INVALID_TARGET,
+ l_errl->reasonCode());
+ errlCommit(l_errl, CXXTEST_COMP_ID);
+ break;
+ }
+ delete l_errl;
+ l_errl = nullptr;
+ }
+ else
+ {
+ TS_FAIL("testNullTarget: no errl returned from"
+ " checkHbResMemLimit under error condition");
+ }
+
+ }while(0);
+ TRACFCOMP(g_trac_runtime, "testNullTarget finished");
+ }
+
+
+ void testInvalidDeconfigOption()
+ {
+ TRACFCOMP(g_trac_runtime, "testInvalidDeconfig running");
+
+ TARGETING::Target * l_target = nullptr;
+
+ TARGETING::TargetHandleList l_cores;
+ TARGETING::getAllChiplets(l_cores, TARGETING::TYPE_CORE);
+
+ if( l_cores.size() == 0 )
+ {
+ TS_FAIL("Unable to execute test, found 0 cores");
+
+ }
+
+ l_target = l_cores.at(0);
+
+ errlHndl_t l_errl =
+ HWAS::theDeconfigGard().deconfigureTargetAtRuntime(
+ l_target,
+ HWAS::DeconfigGard::SPEC_DECONFIG,
+ l_errl);
+ do{
+
+ if(l_errl)
+ {
+ TRACDCOMP(g_trac_runtime, "testInvalidDeconfigOption:"
+ " errl returned (expected)");
+
+ //Check module id and reason code
+ if((l_errl->moduleId() == HWAS::MOD_RUNTIME_DECONFIG) and
+ (l_errl->reasonCode() == HWAS::RC_INVALID_PARAM))
+ {
+ TRACDCOMP(g_trac_runtime, "testInvalidDeconfigOption:"
+ " error's module id and reason code match "
+ "expected values");
+
+ }
+ else
+ {
+ TS_FAIL("testInvalidDeconfigOption: error with unexpected"
+ " module id/reason code returned. Expected module "
+ "id = 0x%x returned module id = 0x%x; expected "
+ "reason code = 0x%x returned reason code = 0x%x",
+ HWAS::MOD_RUNTIME_DECONFIG,
+ l_errl->moduleId(),
+ HWAS::RC_INVALID_PARAM,
+ l_errl->reasonCode());
+ errlCommit(l_errl, CXXTEST_COMP_ID);
+ break;
+ }
+ delete l_errl;
+ l_errl = nullptr;
+ }
+ else
+ {
+ TS_FAIL("testInvalidDeconfigOption: no errl returned from"
+ " checkHbResMemLimit under error condition");
+ }
+
+ }while(0);
+ TRACFCOMP(g_trac_runtime, "testInvalidDeconfigOption finished");
+ }
+
+ void testInvalidTarget()
+ {
+ TRACFCOMP(g_trac_runtime, "testInvalidTarget running");
+
+ TARGETING::TargetHandleList l_proc;
+ TARGETING::getAllChips(l_proc, TARGETING::TYPE_PROC);
+
+ if( l_proc.size() == 0 )
+ {
+ TS_FAIL("Unable to execute test, found procs");
+ }
+
+ TARGETING::Target * l_target = l_proc.at(0);
+
+ errlHndl_t l_errl =
+ HWAS::theDeconfigGard().deconfigureTargetAtRuntime(
+ l_target,
+ HWAS::DeconfigGard::FULLY_AT_RUNTIME,
+ l_errl);
+
+ do{
+
+ if(l_errl)
+ {
+ TRACDCOMP(g_trac_runtime, "deconfigureTargetAtRuntime:"
+ " errl returned (expected)");
+ //Check module id and reason code
+ if((l_errl->moduleId() == HWAS::MOD_RUNTIME_DECONFIG) and
+ (l_errl->reasonCode() == HWAS::RC_INVALID_TARGET))
+ {
+ TRACDCOMP(g_trac_runtime, "testInvalidTarget:"
+ " error's module id and reason code match "
+ "expected values");
+ }
+ else
+ {
+
+ TS_FAIL("testInvalidTarget: error with unexpected"
+ " module id/reason code returned. Expected "
+ "module id = 0x%x returned module id = "
+ "0x%x; expected reason code = 0x%x returned "
+ "reason code = 0x%x",
+ HWAS::MOD_RUNTIME_DECONFIG,
+ l_errl->moduleId(),
+ HWAS::RC_INVALID_TARGET,
+ l_errl->reasonCode());
+ errlCommit(l_errl, CXXTEST_COMP_ID);
+ break;
+
+ }
+ delete l_errl;
+ l_errl = nullptr;
+ }
+ else
+ {
+ TS_FAIL("testInvalidTarget: no errl returned from"
+ " deconfigTargetAtRuntime under error condition");
+ }
+
+ }while(0);
+ TRACFCOMP(g_trac_runtime, "testInvalidTarget finished");
+ }
+
+ void testDeconfigAtRuntime()
+ {
+ TRACFCOMP(g_trac_runtime, "testDeconfigAtRuntime running");
+
+#ifndef __ENABLE_DECONFIG_TEST
+ // NOTE: This test marks targets nonfunctional and then
+ // restore them. Since all the unit tests run in
+ // parallel, this may cause other tests to fail.
+ // Do not leave this test enabled for normal operations.
+ TS_TRACE(INFO_MRK "SKIPPING: other tests could be affected.");
+#else
+ TARGETING::TargetHandleList l_cores;
+ TARGETING::getAllChiplets(l_cores, TARGETING::TYPE_CORE);
+
+ if( l_cores.size() == 0 )
+ {
+ TS_FAIL("Unable to execute test, found procs");
+ }
+
+ TARGETING::Target * l_target = l_cores.at(0);
+
+ TARGETING::HwasState l_origState =
+ l_target->getAttr<TARGETING::ATTR_HWAS_STATE>();
+
+ errlHndl_t l_errl =
+ HWAS::theDeconfigGard().deconfigureTargetAtRuntime(
+ l_target,
+ HWAS::DeconfigGard::FULLY_AT_RUNTIME,
+ l_errl);
+
+ if(l_errl)
+ {
+ TS_FAIL("testDeconfigAtRuntime: deconfigureTargetAtRuntime"
+ " returned an unexpected error");
+ errlCommit(l_errl, CXXTEST_COMP_ID);
+ }
+ else
+ {
+ TRACDCOMP(g_trac_runtime, "testDeconfigAtRuntime:"
+ " no error returned (expected)");
+
+ TARGETING::HwasState l_state =
+ l_target->getAttr<TARGETING::ATTR_HWAS_STATE>();
+
+ if(l_state.functional)
+ {
+ TS_FAIL("testDeconfigureAtRuntime(): target functional after deconfigure");
+ }
+
+ l_target->setAttr<TARGETING::ATTR_HWAS_STATE>(l_origState);
+ }
+#endif
+ TRACFCOMP(g_trac_runtime, "testDeconfigAtRuntime finished");
+ }
+
+
+};
+
+
+#endif
OpenPOWER on IntegriCloud