Skip to content

Commit d3098e6

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 76a50ff commit d3098e6

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
@@ -267,6 +267,7 @@ class OpTestConstants():
267267
TFMR_PURR_PARITY_ERROR = "0004080000000000"
268268
TFMR_SPURR_PARITY_ERROR = "0005080000000000"
269269
HMI_TOD_TOPOLOGY_FAILOVER = 7
270+
OPAL_TI = 8
270271

271272
# CPU sleep states constants
272273
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
@@ -444,6 +444,8 @@ def _testHMIHandling(self, i_test):
444444
self._testTFMR_Errors(BMC_CONST.TFMR_SPURR_PARITY_ERROR)
445445
elif l_test == BMC_CONST.HMI_TOD_TOPOLOGY_FAILOVER:
446446
self._test_tod_topology_failover()
447+
elif l_test == BMC_CONST.OPAL_TI:
448+
self._test_opal_ti()
447449
else:
448450
raise Exception("Please provide valid test case")
449451
l_con.run_command("dmesg -C")
@@ -601,6 +603,32 @@ def _test_tod_topology_failover(self):
601603

602604
return
603605

606+
def ppc_bit(self, bit):
607+
l_val = 0x8000000000000000 >> bit
608+
return l_val
609+
610+
def _test_opal_ti(self):
611+
'''
612+
This function is used to test OPAL TI functionality.
613+
'''
614+
lsprop_output = self.cv_HOST.host_run_command("lsprop /proc/device-tree/ibm,sw-checkstop-fir | tail -n 1")
615+
saddr, bit = str(lsprop_output[0]).split()
616+
scom_addr = "0x%s" % saddr
617+
bit = int(bit, 16)
618+
619+
l_error = "0x%016x" % self.ppc_bit(bit)
620+
621+
log.debug("lsprop = %s = %d" % (scom_addr, bit))
622+
console = self.cv_SYSTEM.console
623+
624+
for l_pair in self.l_dic:
625+
l_chip = l_pair[0]
626+
l_cmd = "PATH=/usr/local/sbin:$PATH putscom -c %s %s %s" % (l_chip, scom_addr, l_error)
627+
console.pty.sendline(l_cmd)
628+
self.handle_OpalTI()
629+
630+
return
631+
604632
def _test_hyp_resource_err(self):
605633
'''
606634
This function is used to test HMI: Hypervisor resource error
@@ -771,6 +799,14 @@ def runTest(self):
771799
else:
772800
self.skipTest("OPAL TI not supported on this system.")
773801

802+
class OpalTI(OpTestHMIHandling):
803+
def runTest(self):
804+
rc = self.is_node_present("/proc/device-tree/ibm,sw-checkstop-fir")
805+
if rc == 1:
806+
self._testHMIHandling(BMC_CONST.OPAL_TI)
807+
else:
808+
self.skipTest("OPAL TI not supported on this system.")
809+
774810
class HypervisorResourceError(OpTestHMIHandling):
775811
def runTest(self):
776812
self._testHMIHandling(BMC_CONST.HMI_HYPERVISOR_RESOURCE_ERROR)
@@ -785,6 +821,7 @@ def unrecoverable_suite():
785821
s.addTest(MalfunctionAlert())
786822
s.addTest(HypervisorResourceError())
787823
s.addTest(TodTopologyFailoverPanic())
824+
s.addTest(OpalTI())
788825
s.addTest(TodTopologyFailoverOpalTI())
789826
s.addTest(ClearGard())
790827
return s

0 commit comments

Comments
 (0)