From a5cc1c4293f79f9b8b96c741112d52fe7fb5b5cc 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 --- pyiplledmonitor/ipl_status_led_monitor.py | 3 ++- pyiplobserver/ipl_status_observer.py | 38 +++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/pyiplledmonitor/ipl_status_led_monitor.py b/pyiplledmonitor/ipl_status_led_monitor.py index 998e1a5..907ceeb 100644 --- a/pyiplledmonitor/ipl_status_led_monitor.py +++ b/pyiplledmonitor/ipl_status_led_monitor.py @@ -170,7 +170,8 @@ class IPLStatusLEDMonitor(DbusProperties, DbusObjectManager): '18': 10, '19': 10, '20': 11, - '21': 11 + '21': 11, + '22': 12 }.get(self.current_ipl_istep_major, 0) proc = subprocess.Popen(["i2cset", "-y", "12", "0x31", "0x10", str(128 + led_code)], stdout=subprocess.PIPE, stderr=open(os.devnull, 'wb'), shell=False) (out, err) = proc.communicate() 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