Skip to content

Commit

Permalink
New Global For Console Daemon
Browse files Browse the repository at this point in the history
This change implements a new global variable that indicates
whether the console daemon has been started. This variable
is checked in the doShutdown path prior to printing any
console traces.

There may be a situation very early in the IPL where we
attempt to write to console before the console daemon has
been started. This causes timeouts and IPL failures.

Change-Id: Ibec90d2207e5db9ef3b9507503d1ea9e2eb7cf6d
CQ: SW431130
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/60227
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
Ilya Smirnov authored and dcrowell77 committed Jun 14, 2018
1 parent 9df0950 commit da0cef6
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
16 changes: 15 additions & 1 deletion src/include/util/misc.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2014,2017 */
/* Contributors Listed Below - COPYRIGHT 2014,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion src/lib/utilmisc.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2014,2017 */
/* Contributors Listed Below - COPYRIGHT 2014,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -55,6 +55,17 @@ void setIsTargetingLoaded()
g_isTargetingLoaded = true;
}

static bool g_isConsoleStarted = false;

bool isConsoleStarted()
{
return g_isConsoleStarted;
}

void setIsConsoleStarted()
{
g_isConsoleStarted = true;
}

};

5 changes: 4 additions & 1 deletion src/usr/console/daemon.C
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
/* */
Expand All @@ -31,6 +31,7 @@
#include <initservice/initserviceif.H>
#include "uart.H"
#include "daemon.H"
#include <util/misc.H>

extern char hbi_ImageId[];

Expand Down Expand Up @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion src/usr/initservice/baseinitsvc/initservice.C
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit da0cef6

Please sign in to comment.