Skip to content

Commit bc97bea

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 3d7a58a commit bc97bea

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

common/OpTestConstants.py

Lines changed: 1 addition & 0 deletions
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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ def _testHMIHandling(self, i_test):
336336
self._testTFMR_Errors(BMC_CONST.TFMR_SPURR_PARITY_ERROR)
337337
elif l_test == BMC_CONST.HMI_TOD_TOPOLOGY_FAILOVER:
338338
self._test_tod_topology_failover()
339+
elif l_test == BMC_CONST.OPAL_TI:
340+
self._test_opal_ti()
339341
else:
340342
raise Exception("Please provide valid test case")
341343
l_con.run_command("dmesg -C")
@@ -493,6 +495,32 @@ def _test_tod_topology_failover(self):
493495

494496
return
495497

498+
def ppc_bit(self, bit):
499+
l_val = 0x8000000000000000 >> bit
500+
return l_val
501+
502+
def _test_opal_ti(self):
503+
'''
504+
This function is used to test OPAL TI functionality.
505+
'''
506+
lsprop_output = self.cv_HOST.host_run_command("lsprop /proc/device-tree/ibm,sw-checkstop-fir | tail -n 1")
507+
saddr, bit = str(lsprop_output[0]).split()
508+
scom_addr = "0x%s" % saddr
509+
bit = int(bit, 16)
510+
511+
l_error = "0x%016x" % self.ppc_bit(bit)
512+
513+
log.debug("lsprop = %s = %d" % (scom_addr, bit))
514+
console = self.cv_SYSTEM.console
515+
516+
for l_pair in self.l_dic:
517+
l_chip = l_pair[0]
518+
l_cmd = "PATH=/usr/local/sbin:$PATH putscom -c %s %s %s" % (l_chip, scom_addr, l_error)
519+
console.pty.sendline(l_cmd)
520+
self.handle_OpalTI()
521+
522+
return
523+
496524
def _test_hyp_resource_err(self):
497525
'''
498526
This function is used to test HMI: Hypervisor resource error
@@ -663,6 +691,14 @@ def runTest(self):
663691
else:
664692
self.skipTest("OPAL TI not supported on this system.")
665693

694+
class OpalTI(OpTestHMIHandling):
695+
def runTest(self):
696+
rc = self.is_node_present("/proc/device-tree/ibm,sw-checkstop-fir")
697+
if rc == 1:
698+
self._testHMIHandling(BMC_CONST.OPAL_TI)
699+
else:
700+
self.skipTest("OPAL TI not supported on this system.")
701+
666702
class HypervisorResourceError(OpTestHMIHandling):
667703
def runTest(self):
668704
self._testHMIHandling(BMC_CONST.HMI_HYPERVISOR_RESOURCE_ERROR)
@@ -677,6 +713,7 @@ def unrecoverable_suite():
677713
s.addTest(MalfunctionAlert())
678714
s.addTest(HypervisorResourceError())
679715
s.addTest(TodTopologyFailoverPanic())
716+
s.addTest(OpalTI())
680717
s.addTest(TodTopologyFailoverOpalTI())
681718
s.addTest(ClearGard())
682719
return s

0 commit comments

Comments
 (0)