diff options
-rw-r--r-- | src/include/util/misc.H | 16 | ||||
-rw-r--r-- | src/lib/utilmisc.C | 13 | ||||
-rw-r--r-- | src/usr/console/daemon.C | 5 | ||||
-rw-r--r-- | src/usr/initservice/baseinitsvc/initservice.C | 3 |
4 files changed, 33 insertions, 4 deletions
diff --git a/src/include/util/misc.H b/src/include/util/misc.H index 78d17f591..56592a7f8 100644 --- a/src/include/util/misc.H +++ b/src/include/util/misc.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2017 */ +/* Contributors Listed Below - COPYRIGHT 2014,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -55,6 +55,20 @@ namespace Util * @return N/A */ void setIsTargetingLoaded( void ); + + /** + * @brief Determines if the Console daemon has been started + * + * @return bool true if Console daemon has been started; false otherwise + */ + bool isConsoleStarted(); + + /** + * @brief Sets the global variable to indicate that the Console daemon has + * been started. This should only be called once when the console + * daemon starts. + */ + void setIsConsoleStarted(); }; #endif diff --git a/src/lib/utilmisc.C b/src/lib/utilmisc.C index d91af9bc1..36f568d11 100644 --- a/src/lib/utilmisc.C +++ b/src/lib/utilmisc.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2017 */ +/* Contributors Listed Below - COPYRIGHT 2014,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -55,6 +55,17 @@ void setIsTargetingLoaded() g_isTargetingLoaded = true; } +static bool g_isConsoleStarted = false; + +bool isConsoleStarted() +{ + return g_isConsoleStarted; +} + +void setIsConsoleStarted() +{ + g_isConsoleStarted = true; +} }; diff --git a/src/usr/console/daemon.C b/src/usr/console/daemon.C index b51122561..0887afc7c 100644 --- a/src/usr/console/daemon.C +++ b/src/usr/console/daemon.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2017 */ +/* Contributors Listed Below - COPYRIGHT 2014,2018 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -31,6 +31,7 @@ #include <initservice/initserviceif.H> #include "uart.H" #include "daemon.H" +#include <util/misc.H> extern char hbi_ImageId[]; @@ -72,6 +73,8 @@ namespace CONSOLE Uart::g_device->initialize(); } + Util::setIsConsoleStarted(); + // Display a banner denoting the hostboot version char banner[256]; snprintf(banner, sizeof(banner), diff --git a/src/usr/initservice/baseinitsvc/initservice.C b/src/usr/initservice/baseinitsvc/initservice.C index 6ba26e392..2f88aa723 100644 --- a/src/usr/initservice/baseinitsvc/initservice.C +++ b/src/usr/initservice/baseinitsvc/initservice.C @@ -48,6 +48,7 @@ #include <hwas/common/hwas_reasoncodes.H> #include <console/consoleif.H> #include <sbe/sbereasoncodes.H> +#include <util/misc.H> #include <errl/errludstring.H> #include <errl/errludprintk.H> @@ -771,7 +772,7 @@ void InitService::doShutdown(uint64_t i_status, { CONSOLE::displayf(NULL, "System shutting down with error status 0x%X", i_status); - if(VFS::module_is_loaded("libconsole.so")) + if(Util::isConsoleStarted()) { // Only flush the trace when the console module is loaded CONSOLE::flush(); |