summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaptor Engineering Development Team <support@raptorengineering.com>2018-05-12 21:15:17 -0500
committerRaptor Engineering Development Team <support@raptorengineering.com>2018-05-12 21:15:17 -0500
commit0224ef08eb31c65820f4181411fcc1e0c205612f (patch)
treeebbc098bf3e82c70f7edbbb879833d2e593e9c1d
parent21753529f0f8a17824984bb04d6157251f6296c1 (diff)
downloadtalos-skeleton-05-11-2018.tar.gz
talos-skeleton-05-11-2018.zip
Recover from BMC reboot by properly setting host and IPL status05-11-2018
This assumes that if the ATX power is on, the host was previously IPLed
-rwxr-xr-xpyiplobserver/ipl_status_observer.py26
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
OpenPOWER on IntegriCloud