Skip to content

Commit

Permalink
Add VERSION to all OpenPOWER error logs
Browse files Browse the repository at this point in the history
When an error log is created for OpenPOWER systems
it didn't contain the VERSION info within it. This
commit adds a function called AddVersionInfo() that
appends the VERSION info to every error log for
OpenPOWER.

Change-Id: Ic259e10e942f6df0675055823e4945ef9696b659
RTC: 196794
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/65506
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Reviewed-by: ILYA SMIRNOV <ismirno@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
  • Loading branch information
Matt Raybuck authored and wghoffa committed Sep 7, 2018
1 parent e867f7f commit 3060376
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/include/usr/errl/errlentry.H
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,14 @@ private:
*/
void addHbBuildId();

/**
* @brief Called by commit(), this function creates a user details section
* which contains the version info for each of the fw components in an
* OpenPOWER System and adds it to the current error log being processed.
* Note: This function only executes on a BMC based system.
*/
void addVersionInfo(void);

#ifdef CONFIG_BMC_IPMI
/**
* @brief called by addHwCallout to retrieve the serial and part number
Expand Down
100 changes: 100 additions & 0 deletions src/usr/errl/errlentry.C
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,103 @@ void ErrlEntry::addHbBuildId()
ErrlUserDetailsString(l_pString).addToLog(this);
}

void ErrlEntry::addVersionInfo()
{
// Version section of PNOR is only available to OpenPOWER systems.
if (!INITSERVICE::spBaseServicesEnabled())
{
//TODO: CQ:SW416159 Uncomment when merged
// bool l_secureSectionLoaded = false;
errlHndl_t l_errl = nullptr/*, l_errl_loadSecureSection = nullptr*/;

do
{
/* TODO: CQ:SW416159 Uncomment when merged
#ifdef CONFIG_SECUREBOOT
l_errl_loadSecureSection = PNOR::loadSecureSection(PNOR::VERSION);
if (l_errl_loadSecureSection)
{
TRACFCOMP( g_trac_errl,
"addVersionInfo: Failed to load secure VERSION");
// Since an error occurred while attempting to add version info
// to another error log there is nothing that can be done with
// this error since attempting to commit it will lead to an
// infinite loop of committing the error and then recalling this
// function. If this error occurred then the VERSION partition
// is not added and the error log commit continues.
delete l_errl_loadSecureSection;
l_errl_loadSecureSection = nullptr;
break;
}
else
{
l_secureSectionLoaded = true;
}
#endif
*/
// Get PNOR Version
PNOR::SectionInfo_t l_pnorVersionInfo;
l_errl = getSectionInfo(PNOR::VERSION, l_pnorVersionInfo);

if (l_errl)
{
TRACFCOMP( g_trac_errl,
"addVersionInfo: Failed to getSectionInfo");
// Since an error occurred while attempting to add version info
// to another error log there is nothing that can be done with
// this error since attempting to commit it will lead to an
// infinite loop of committing the error and then recalling this
// function. If this error occurred then the VERSION partition
// is not added and the error log commit continues.
delete l_errl;
l_errl = nullptr;
break;
}

const uint8_t* l_versionData =
reinterpret_cast<uint8_t*>(l_pnorVersionInfo.vaddr);

size_t l_numberOfBytes = 0;

// Determine the size of the version data.
while ((static_cast<char>(l_versionData[l_numberOfBytes]) != '\0')
&& l_numberOfBytes < l_pnorVersionInfo.size)
{
++l_numberOfBytes;
}

char l_pVersionString[l_numberOfBytes + 1]={0};

memcpy(l_pVersionString, l_versionData, l_numberOfBytes);

ErrlUserDetailsString(l_pVersionString).addToLog(this);
} while(0);

/* TODO: CQ:SW416159 Uncomment when merged
#ifdef CONFIG_SECUREBOOT
if (l_secureSectionLoaded)
{
l_errl_loadSecureSection = PNOR::unloadSecureSection(PNOR::VERSION);
if(l_errl_loadSecureSection)
{
TRACFCOMP( g_trac_errl,
"addVersionInfo: Failed to unload secure VERSION");
// Since an error occurred while attempting to add version info
// to another error log there is nothing that can be done with
// this error since attempting to commit it will lead to an
// infinite loop of committing the error and then recalling this
// function. If this error occurred then the VERSION partition
// is not added and the error log commit continues.
delete l_errl_loadSecureSection;
l_errl_loadSecureSection = nullptr;
}
}
#endif
*/
}

}

enum {
SKIP_INFO_RECOVERABLE_LOGS =
TARGETING::HIDDEN_ERRLOGS_ENABLE_NO_HIDDEN_LOGS,
Expand Down Expand Up @@ -896,6 +993,9 @@ void ErrlEntry::commit( compId_t i_committerComponent )
// Add the Hostboot Build ID to the error log
addHbBuildId();

// Add the version info to the error log for OpenPOWER systems
addVersionInfo();

// check to see if we should skip info and recoverable errors?
checkHiddenLogsEnable();

Expand Down

0 comments on commit 3060376

Please sign in to comment.