diff options
author | Raptor Engineering Development Team <support@raptorengineering.com> | 2018-05-12 21:15:17 -0500 |
---|---|---|
committer | Raptor Engineering Development Team <support@raptorengineering.com> | 2019-04-19 10:28:12 +0000 |
commit | 697da84f55c2bb080eee647bcab3255a6fd818e2 (patch) | |
tree | ac5c3723824dc162819960bc68734678f797bb95 | |
parent | c99efec307b5b5b35f5519dc6d15d395ca6f5bf0 (diff) | |
download | blackbird-skeleton-697da84f55c2bb080eee647bcab3255a6fd818e2.tar.gz blackbird-skeleton-697da84f55c2bb080eee647bcab3255a6fd818e2.zip |
Recover from BMC reboot by properly setting host and IPL status
This assumes that if the ATX power is on, the host was previously IPLed
-rwxr-xr-x | pyiplobserver/ipl_status_observer.py | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/pyiplobserver/ipl_status_observer.py b/pyiplobserver/ipl_status_observer.py index 96678fc..b3bafa7 100755 --- a/pyiplobserver/ipl_status_observer.py +++ b/pyiplobserver/ipl_status_observer.py @@ -80,14 +80,17 @@ class IPLStatus(DbusProperties, DbusObjectManager): host_state_iface = dbus.Interface(host_state_dev, 'org.freedesktop.DBus.Properties') host_state_value = host_state_iface.Get("xyz.openbmc_project.State.Host", "CurrentHostState") if host_state_value is not None: - if (host_state_value == HOST_STATUS_RUNNING): - skiboot_flags = self.getSkibootBootFlags() - if (skiboot_flags != 0): - self.current_istep_major = IPL_COMPLETE_ISTEP_MAJOR - self.current_istep_minor = IPL_COMPLETE_ISTEP_MINOR + power_ctrl_flag = self.getChassisPowerRequestFlag() + skiboot_flags = self.getSkibootBootFlags() + if ((skiboot_flags != 0) and (skiboot_flags != 1)) or ((power_ctrl_flag == 1) and (skiboot_flags == 0)): + self.current_istep_major = KERNEL_COMPLETE_ISTEP_MAJOR + self.current_istep_minor = KERNEL_COMPLETE_ISTEP_MAJOR + if (skiboot_flags != 0) or (power_ctrl_flag == 1): self.activateMonitoringPrev = True self.activateMonitoring = True - + if (host_state_value != HOST_STATUS_RUNNING) and (self.activateMonitoring == True): + host_state_iface.Set("xyz.openbmc_project.State.Host", "CurrentHostState", HOST_STATUS_RUNNING) + self.setSkibootBootFlags(2) self.Set(DBUS_NAME, "current_istep", "") self.Set(DBUS_NAME, "current_status", "UNKNOWN") @@ -101,6 +104,17 @@ class IPLStatus(DbusProperties, DbusObjectManager): print "IPLStatus Init Done" + def getChassisPowerRequestFlag(self): + result = 0 + try: + proc = subprocess.Popen(["i2cget -y 12 0x31 0x7"], stdout=subprocess.PIPE, stderr=open(os.devnull, 'wb'), shell=True) + (out, err) = proc.communicate() + result = (int(out, 16) & 2) >> 1 + except: + pass + + return result + # BMC bits OEM1, OEM2, and OEM3 are the signalling flags # OEM1 is unconditionally set at skiboot completion and is only cleared by the BMC IPL monitor # OEM2 is used as a persistent state indicator, and is only set and cleared by the BMC IPL monitor |