From f916027c4141dd8e874074e9884f7a75c38fa118 Mon Sep 17 00:00:00 2001 From: Raptor Engineering Development Team Date: Tue, 23 Jan 2018 03:11:27 -0600 Subject: Add skiboot state to IPL observer and LED monitor services This helps reduce issues with the OCCs dropping off the bus during skiboot initialization --- pyiplobserver/ipl_status_observer.py | 38 ++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'pyiplobserver') diff --git a/pyiplobserver/ipl_status_observer.py b/pyiplobserver/ipl_status_observer.py index f5e3d25..5329a7c 100644 --- a/pyiplobserver/ipl_status_observer.py +++ b/pyiplobserver/ipl_status_observer.py @@ -40,6 +40,9 @@ IPL_HOSTBOOT_START_ISTEP_MINOR = 0 IPL_COMPLETE_ISTEP_MAJOR = 21 IPL_COMPLETE_ISTEP_MINOR = 3 +SKIBOOT_RUNNING_ISTEP_MAJOR = 22 +SKIBOOT_RUNNING_ISTEP_MINOR = 0 + class IPLStatus(DbusProperties, DbusObjectManager): def __init__(self, bus, obj_name): super(IPLStatus, self).__init__( @@ -74,6 +77,28 @@ class IPLStatus(DbusProperties, DbusObjectManager): print "IPLStatus Init Done" + def getSkibootBootFlag(self): + result = 0 + try: + proc = subprocess.Popen(["devmem", "0x1e789060", "8"], stdout=subprocess.PIPE, stderr=open(os.devnull, 'wb'), shell=False) + (out, err) = proc.communicate() + result = (int(out, 16) & 4) >> 2 + except: + pass + + return result + + def resetSkibootBootFlag(self): + try: + proc = subprocess.Popen(["devmem", "0x1e789060", "8"], stdout=subprocess.PIPE, stderr=open(os.devnull, 'wb'), shell=False) + (out, err) = proc.communicate() + reg_data = int(out, 16) & (~4) + proc = subprocess.Popen(["devmem", "0x1e789060", "8", str(reg_data)], stdout=subprocess.PIPE, stderr=open(os.devnull, 'wb'), shell=False) + (out, err) = proc.communicate() + except: + print "IPLStatus unable to reset skiboot flags!" + pass + def readIPLStatus(self): try: # Set up defaults @@ -96,6 +121,7 @@ class IPLStatus(DbusProperties, DbusObjectManager): self.Set(DBUS_NAME, "current_istep", current_istep) self.IPLStepChanged(current_istep) self.last_istep = current_istep + self.resetSkibootBootFlag() return True; @@ -174,7 +200,13 @@ class IPLStatus(DbusProperties, DbusObjectManager): if ((current_istep_major > 0) or (current_istep_minor > 0 )): current_status = "IPL_RUNNING" if ((current_istep_major == IPL_COMPLETE_ISTEP_MAJOR) and (current_istep_minor == IPL_COMPLETE_ISTEP_MINOR)): - current_status = "IPL_COMPLETE" + if (self.getSkibootBootFlag() == 0): + current_status = "IPL_RUNNING" + current_istep_major = SKIBOOT_RUNNING_ISTEP_MAJOR + current_istep_minor = SKIBOOT_RUNNING_ISTEP_MINOR + current_istep = str(current_istep_major) + "," + str(current_istep_minor) + else: + current_status = "IPL_COMPLETE" # Reset failure counter self.prev_access_fail_count = 0 @@ -198,9 +230,11 @@ class IPLStatus(DbusProperties, DbusObjectManager): pass else: try: - os.remove(IPL_FLAG_DIR + IPL_FLAG_FILE,) + os.remove(IPL_FLAG_DIR + IPL_FLAG_FILE) except: pass + if (current_istep_major < IPL_COMPLETE_ISTEP_MAJOR): + self.resetSkibootBootFlag() # Since it is extremely unlikely that both fetches will fail unless the host is offline, simply check that both fetches passed or failed before continuing if (sbe_fetch_failed == hostboot_fetch_failed): -- cgit v1.2.1