From bc97bea0926204dced39c9723e4dc3b0a81cface Mon Sep 17 00:00:00 2001 From: Mahesh Salgaonkar Date: Sat, 9 Mar 2019 14:47:02 +0530 Subject: [PATCH] Opal TI: Add test for OPAL TI. Trigger manual OPAL TI by directly setting scom address provided in device-tree node ibm,sw-xstop-fir. This is to test basic functionality of OPAL TI under normal circumstance. Signed-off-by: Mahesh Salgaonkar --- common/OpTestConstants.py | 1 + testcases/OpTestHMIHandling.py | 37 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/common/OpTestConstants.py b/common/OpTestConstants.py index bc0819643..fb6356dc8 100644 --- a/common/OpTestConstants.py +++ b/common/OpTestConstants.py @@ -259,6 +259,7 @@ class OpTestConstants(): TFMR_PURR_PARITY_ERROR = "0004080000000000" TFMR_SPURR_PARITY_ERROR = "0005080000000000" HMI_TOD_TOPOLOGY_FAILOVER = 7 + OPAL_TI = 8 # CPU sleep states constants GET_CPU_SLEEP_STATE2 = "cat /sys/devices/system/cpu/cpu*/cpuidle/state2/disable" diff --git a/testcases/OpTestHMIHandling.py b/testcases/OpTestHMIHandling.py index 2b0f927d2..a2f0ebf0a 100644 --- a/testcases/OpTestHMIHandling.py +++ b/testcases/OpTestHMIHandling.py @@ -336,6 +336,8 @@ def _testHMIHandling(self, i_test): self._testTFMR_Errors(BMC_CONST.TFMR_SPURR_PARITY_ERROR) elif l_test == BMC_CONST.HMI_TOD_TOPOLOGY_FAILOVER: self._test_tod_topology_failover() + elif l_test == BMC_CONST.OPAL_TI: + self._test_opal_ti() else: raise Exception("Please provide valid test case") l_con.run_command("dmesg -C") @@ -493,6 +495,32 @@ def _test_tod_topology_failover(self): return + def ppc_bit(self, bit): + l_val = 0x8000000000000000 >> bit + return l_val + + def _test_opal_ti(self): + ''' + This function is used to test OPAL TI functionality. + ''' + lsprop_output = self.cv_HOST.host_run_command("lsprop /proc/device-tree/ibm,sw-checkstop-fir | tail -n 1") + saddr, bit = str(lsprop_output[0]).split() + scom_addr = "0x%s" % saddr + bit = int(bit, 16) + + l_error = "0x%016x" % self.ppc_bit(bit) + + log.debug("lsprop = %s = %d" % (scom_addr, bit)) + console = self.cv_SYSTEM.console + + for l_pair in self.l_dic: + l_chip = l_pair[0] + l_cmd = "PATH=/usr/local/sbin:$PATH putscom -c %s %s %s" % (l_chip, scom_addr, l_error) + console.pty.sendline(l_cmd) + self.handle_OpalTI() + + return + def _test_hyp_resource_err(self): ''' This function is used to test HMI: Hypervisor resource error @@ -663,6 +691,14 @@ def runTest(self): else: self.skipTest("OPAL TI not supported on this system.") +class OpalTI(OpTestHMIHandling): + def runTest(self): + rc = self.is_node_present("/proc/device-tree/ibm,sw-checkstop-fir") + if rc == 1: + self._testHMIHandling(BMC_CONST.OPAL_TI) + else: + self.skipTest("OPAL TI not supported on this system.") + class HypervisorResourceError(OpTestHMIHandling): def runTest(self): self._testHMIHandling(BMC_CONST.HMI_HYPERVISOR_RESOURCE_ERROR) @@ -677,6 +713,7 @@ def unrecoverable_suite(): s.addTest(MalfunctionAlert()) s.addTest(HypervisorResourceError()) s.addTest(TodTopologyFailoverPanic()) + s.addTest(OpalTI()) s.addTest(TodTopologyFailoverOpalTI()) s.addTest(ClearGard()) return s