Skip to content

Commit 6909008

Browse files
committed
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 <[email protected]>
1 parent dbd9430 commit 6909008

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

common/OpTestConstants.py

+1
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ class OpTestConstants():
259259
TFMR_PURR_PARITY_ERROR = "0004080000000000"
260260
TFMR_SPURR_PARITY_ERROR = "0005080000000000"
261261
HMI_TOD_TOPOLOGY_FAILOVER = 7
262+
OPAL_TI = 8
262263

263264
# CPU sleep states constants
264265
GET_CPU_SLEEP_STATE2 = "cat /sys/devices/system/cpu/cpu*/cpuidle/state2/disable"

testcases/OpTestHMIHandling.py

+37
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,8 @@ def _testHMIHandling(self, i_test):
357357
self._testTFMR_Errors(BMC_CONST.TFMR_SPURR_PARITY_ERROR)
358358
elif l_test == BMC_CONST.HMI_TOD_TOPOLOGY_FAILOVER:
359359
self._test_tod_topology_failover()
360+
elif l_test == BMC_CONST.OPAL_TI:
361+
self._test_opal_ti()
360362
else:
361363
raise Exception("Please provide valid test case")
362364
l_con.run_command("dmesg -C")
@@ -514,6 +516,32 @@ def _test_tod_topology_failover(self):
514516

515517
return
516518

519+
def ppc_bit(self, bit):
520+
l_val = 0x8000000000000000 >> bit
521+
return l_val
522+
523+
def _test_opal_ti(self):
524+
'''
525+
This function is used to test OPAL TI functionality.
526+
'''
527+
lsprop_output = self.cv_HOST.host_run_command("lsprop /proc/device-tree/ibm,sw-checkstop-fir | tail -n 1")
528+
saddr, bit = str(lsprop_output[0]).split()
529+
scom_addr = "0x%s" % saddr
530+
bit = int(bit, 16)
531+
532+
l_error = "0x%016x" % self.ppc_bit(bit)
533+
534+
log.debug("lsprop = %s = %d" % (scom_addr, bit))
535+
console = self.cv_SYSTEM.console
536+
537+
for l_pair in self.l_dic:
538+
l_chip = l_pair[0]
539+
l_cmd = "PATH=/usr/local/sbin:$PATH putscom -c %s %s %s" % (l_chip, scom_addr, l_error)
540+
console.pty.sendline(l_cmd)
541+
self.handle_OpalTI()
542+
543+
return
544+
517545
def _test_hyp_resource_err(self):
518546
'''
519547
This function is used to test HMI: Hypervisor resource error
@@ -684,6 +712,14 @@ def runTest(self):
684712
else:
685713
self.skipTest("OPAL TI not supported on this system.")
686714

715+
class OpalTI(OpTestHMIHandling):
716+
def runTest(self):
717+
rc = self.is_node_present("/proc/device-tree/ibm,sw-checkstop-fir")
718+
if rc == 1:
719+
self._testHMIHandling(BMC_CONST.OPAL_TI)
720+
else:
721+
self.skipTest("OPAL TI not supported on this system.")
722+
687723
class HypervisorResourceError(OpTestHMIHandling):
688724
def runTest(self):
689725
self._testHMIHandling(BMC_CONST.HMI_HYPERVISOR_RESOURCE_ERROR)
@@ -698,6 +734,7 @@ def unrecoverable_suite():
698734
s.addTest(MalfunctionAlert())
699735
s.addTest(HypervisorResourceError())
700736
s.addTest(TodTopologyFailoverPanic())
737+
s.addTest(OpalTI())
701738
s.addTest(TodTopologyFailoverOpalTI())
702739
s.addTest(ClearGard())
703740
return s

0 commit comments

Comments
 (0)