Skip to content

Commit

Permalink
Opal TI: Add test for OPAL TI.
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
maheshsal committed Mar 21, 2019
1 parent 76a50ff commit d3098e6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions common/OpTestConstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,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"
Expand Down
37 changes: 37 additions & 0 deletions testcases/OpTestHMIHandling.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,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")
Expand Down Expand Up @@ -601,6 +603,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
Expand Down Expand Up @@ -771,6 +799,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)
Expand All @@ -785,6 +821,7 @@ def unrecoverable_suite():
s.addTest(MalfunctionAlert())
s.addTest(HypervisorResourceError())
s.addTest(TodTopologyFailoverPanic())
s.addTest(OpalTI())
s.addTest(TodTopologyFailoverOpalTI())
s.addTest(ClearGard())
return s
Expand Down

0 comments on commit d3098e6

Please sign in to comment.