sst: Rediscover profiles after host reboot

In some cases, host processor reboot may change the static SST-PP
profile information. This commit adds ability to register callbacks to
run upon hostState changes, and reruns SST discovery whenever the host
exits the power-off state.

Tested:
- Ran tools/sst-compare-redfish-os.py tool on platform with SPR host
  CPU, and observed no mismatches before and after a host reboot.
- Confirmed Redfish OperatingConfig properties still populated when host
  is off.

Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
Change-Id: I9e7b0ebb8c5ec7a8464346f3476490b765579428
diff --git a/src/cpuinfo_utils.cpp b/src/cpuinfo_utils.cpp
index 1c69e6a..7265bbb 100644
--- a/src/cpuinfo_utils.cpp
+++ b/src/cpuinfo_utils.cpp
@@ -36,11 +36,18 @@
 static PowerState powerState = PowerState::Off;
 static OsState osState = OsState::Inactive;
 static bool biosDone = false;
+static std::vector<HostStateHandler> hostStateCallbacks;
 
 static std::shared_ptr<sdbusplus::asio::connection> dbusConn;
 
+void addHostStateCallback(HostStateHandler cb)
+{
+    hostStateCallbacks.push_back(cb);
+}
+
 static void updateHostState()
 {
+    HostState prevState = hostState;
     if (powerState == PowerState::Off)
     {
         hostState = HostState::off;
@@ -67,6 +74,14 @@
         hostState = HostState::postComplete;
     }
     DEBUG_PRINT << "new host state: " << static_cast<int>(hostState) << "\n";
+
+    if (prevState != hostState)
+    {
+        for (const auto& cb : hostStateCallbacks)
+        {
+            cb(prevState, hostState);
+        }
+    }
 }
 
 void updatePowerState(const std::string& newState)