regulators: Wait for compatible system types

There are two options for naming the JSON configuration file:
1. Default name
2. Name based on compatible system types provided by EntityManager

If option #2 is used, there is no guarantee that EntityManager will have
published the compatible systems types on D-Bus before a boot is
attempted.  This is not common, but the problem has occurred.

When the boot begins, the regulators application configures the voltage
regulators.  If the config file has not been found and loaded, this
configuration cannot occur.

This commit enhances the regulators application to wait for
EntityManager to publish the compatible systems information during the
boot so that the regulators can be configured.

A maximum wait time is enforced to prevent the boot from being blocked
indefinitely.  If this maximum wait time is reached, a critical error is
logged indicating that the voltage regulators could not be configured.

Tested:
* System types available before boot
* Have to wait for system types during boot
  * System types found within 5 minutes
  * System types not found within 5 minutes
* For complete test plan details, see
  https://gist.github.com/smccarney/b059a5f4da1a9138af770217cbafaea3

Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I700a376b94603f36defd1fe266c0a2d7e2a9d30b
diff --git a/phosphor-regulators/src/manager.hpp b/phosphor-regulators/src/manager.hpp
index f1aa0d9..e2ec5a7 100644
--- a/phosphor-regulators/src/manager.hpp
+++ b/phosphor-regulators/src/manager.hpp
@@ -131,6 +131,17 @@
     std::filesystem::path findConfigFile();
 
     /**
+     * Returns whether the JSON configuration file has been loaded.
+     *
+     * @return true if config file loaded, false otherwise
+     */
+    bool isConfigFileLoaded() const
+    {
+        // If System object exists, the config file has been loaded
+        return (system != nullptr);
+    }
+
+    /**
      * Loads the JSON configuration file.
      *
      * Looks for the config file using findConfigFile().
@@ -142,6 +153,16 @@
     void loadConfigFile();
 
     /**
+     * Waits until the JSON configuration file has been loaded.
+     *
+     * If the config file has not yet been loaded, waits until one of the
+     * following occurs:
+     * - config file is loaded
+     * - maximum amount of time to wait has elapsed
+     */
+    void waitUntilConfigFileLoaded();
+
+    /**
      * The D-Bus bus
      */
     sdbusplus::bus::bus& bus;