Skip to content

Commit

Permalink
SBE logs on serial console
Browse files Browse the repository at this point in the history
Print relevant information of SBE on
serial console

cmvc-prereq: 1071648
Change-Id: I17c38a06efef37defaefa3ef041635ed5b101270
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/65446
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: RAJA DAS <rajadas2@in.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
  • Loading branch information
Shakeebbk authored and sgupta2m committed Nov 13, 2018
1 parent 41ac7c1 commit cf61dc3
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/sbefw/core/ipl.C
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "sbeFFDC.H"

#include "ipl.H"
#include "sbeConsole.H"
#include "sbeglobals.H"

#include "p9n2_perv_scom_addresses.H"
Expand Down Expand Up @@ -121,6 +122,7 @@ void sbeDoContinuousIpl()
auto istepMap = &istepTableEntry->istepMinorArr[step-1];
if(istepMap->istepWrapper != NULL)
{
SBE_MSG_CONSOLE("istep ", istepTableEntry->istepMajorNum, ".", step);
rc = istepMap->istepWrapper(istepMap->istepHwp);
}
bool checkstop = isSystemCheckstop();
Expand Down
40 changes: 32 additions & 8 deletions src/sbefw/core/sbeConsole.C
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,40 @@ void uartUnLock(void)
pk_halt();
}
}

void sbeMsgConsole(uint32_t num)
{
// 8 chars for max unit32_t and a null terminator
char num_str[9] = {};

int i = 0;
if(num == 0)
num_str[0] = '0';
while(num)
{
num_str[i++] = (num % 10) + '0';
num /= 10;
}

// reverse string
char *start = num_str, *end = num_str + i-1;
while(start < end)
{
char temp = *start;
*start = *end;
*end = temp;
start++;
end--;
}

sbeMsgConsole((char*)(num_str));
}

void sbeMsgConsole(char const *msg)
{
if(SBE_GLOBAL->sbeUartActive)
size_t c = 0;
while(msg[c] != '\0')
{
size_t c = 0;
while(msg[c] != '\0')
{
uartPutChar(msg[c++]);
}
uartPutChar(msg[c++]);
}
else
SBE_DEBUG("uart is not active");
}
34 changes: 30 additions & 4 deletions src/sbefw/core/sbeConsole.H
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/* OpenPOWER sbe Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
Expand Down Expand Up @@ -34,16 +35,34 @@
_SBE_MSG_CONSOLE(msg); \
_SBE_MSG_CONSOLE("\n\r"); \
SBE_UART_UNLOCK;

#define SBE_MSG_CONSOLE_2(msg1, msg2) \
SBE_UART_LOCK; \
_SBE_MSG_CONSOLE(msg1); \
_SBE_MSG_CONSOLE(" "); \
_SBE_MSG_CONSOLE(msg2); \
_SBE_MSG_CONSOLE("\n\r"); \
SBE_UART_UNLOCK;

#define SBE_MSG_CONSOLE_3(msg1, msg2, msg3) \
SBE_UART_LOCK; \
_SBE_MSG_CONSOLE(msg1); \
_SBE_MSG_CONSOLE(msg2); \
_SBE_MSG_CONSOLE(msg3); \
_SBE_MSG_CONSOLE("\n\r"); \
SBE_UART_UNLOCK;

#define SBE_MSG_CONSOLE_4(msg1, msg2, msg3, msg4) \
SBE_UART_LOCK; \
_SBE_MSG_CONSOLE(msg1); \
_SBE_MSG_CONSOLE(msg2); \
_SBE_MSG_CONSOLE(msg3); \
_SBE_MSG_CONSOLE(msg4); \
_SBE_MSG_CONSOLE("\n\r"); \
SBE_UART_UNLOCK;

#define SBE_MSG_CONSOLE_HELPER_CALL(count, ...) SBE_MSG_CONSOLE_ ## count(__VA_ARGS__)
#define SBE_MSG_CONSOLE_HELPER(count, ...) SBE_MSG_CONSOLE_HELPER_CALL(count, __VA_ARGS__)
#define SBE_MSG_CONSOLE(...) SBE_MSG_CONSOLE_HELPER(VARG_COUNT(__VA_ARGS__), __VA_ARGS__)
#define SBE_MSG_CONSOLE(...) SBE_MSG_CONSOLE_CHECK(__VA_ARGS__)

#ifndef SBE_CONSOLE_SUPPORT

Expand All @@ -52,6 +71,7 @@
#define SBE_UART_LOCK
#define SBE_UART_UNLOCK
#define _SBE_MSG_CONSOLE(msg)
#define SBE_MSG_CONSOLE_CHECK(...)

#else

Expand All @@ -60,11 +80,16 @@
#define SBE_UART_LOCK uartLock()
#define SBE_UART_UNLOCK uartUnLock()

#define SBE_MSG_CONSOLE_CHECK(...) \
if(SBE_GLOBAL->sbeUartActive) \
{ \
SBE_MSG_CONSOLE_HELPER(VARG_COUNT(__VA_ARGS__), __VA_ARGS__) \
}
// SBE messages
#define SBE_CONSOLE_WELCOME_MSG ("\n\r--== Welcome to SBE - CommitId[" STRINGIFY(SBE_COMMIT_ID) "] ==--")

#define _SBE_MSG_CONSOLE(msg) \
sbeMsgConsole(msg)
#define _SBE_MSG_CONSOLE(msg) sbeMsgConsole(msg)

#define LPC_IO_SPACE 0xD0010000
#define LPC_MAX_IO_SPACE (64*1024)

Expand All @@ -73,6 +98,7 @@ void uartDisable(void);
void uartLock(void);
void uartUnLock(void);
void sbeMsgConsole(char const *msg);
void sbeMsgConsole(uint32_t num);
//
/** UART Register Offsets */
enum
Expand Down

0 comments on commit cf61dc3

Please sign in to comment.