summaryrefslogtreecommitdiffstats
path: root/src/usr/errl
diff options
context:
space:
mode:
authorStephen Cprek <smcprek@us.ibm.com>2013-10-03 17:07:20 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-10-10 13:08:56 -0500
commitc9343d971c4410c80ff92bd554d61740cd39b8dd (patch)
tree3d1cfe2c369e7b0a664019d305e6cfd41b0a8523 /src/usr/errl
parentcb4b721956f9a0a347db3b838608ffc0b08fd7e5 (diff)
downloadblackbird-hostboot-c9343d971c4410c80ff92bd554d61740cd39b8dd.tar.gz
blackbird-hostboot-c9343d971c4410c80ff92bd554d61740cd39b8dd.zip
Added common header file for reason code
Change-Id: Ifea8a00b9a36817e0b42054dfb9ce13dad8f15a6 RTC: 76269 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/6478 Tested-by: Jenkins Server Reviewed-by: Brian H. Horton <brianh@linux.ibm.com> Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/errl')
-rwxr-xr-xsrc/usr/errl/parser/genErrlParsers.pl77
-rw-r--r--src/usr/errl/test/errlReportTest.H46
-rw-r--r--src/usr/errl/test/errltest.H26
3 files changed, 112 insertions, 37 deletions
diff --git a/src/usr/errl/parser/genErrlParsers.pl b/src/usr/errl/parser/genErrlParsers.pl
index a21ae94e1..b1093dbbe 100755
--- a/src/usr/errl/parser/genErrlParsers.pl
+++ b/src/usr/errl/parser/genErrlParsers.pl
@@ -74,6 +74,7 @@ my $compIdFile = $base."/src/include/usr/hbotcompid.H";
my $compPath = $base."/src/usr";
my $compIncPath = $base."/src/include/usr";
my $genFilesPath = $base."/obj/genfiles";
+my $hbfwTermRcFile = $genFilesPath."/hbfw_term_rc.H";
#------------------------------------------------------------------------------
# Call subroutines to populate the following arrays:
@@ -183,6 +184,30 @@ if ($DEBUG)
my %modIdToValueHash;
my %rcToValueHash;
my %udIdToValueHash;
+open(TERM_RC_FILE, ">", "$hbfwTermRcFile") or die("Cannot open: $hbfwTermRcFile: $!");
+
+# print header of file
+print TERM_RC_FILE "#ifndef __HBFW_TERM_RC_H\n";
+print TERM_RC_FILE "#define __HBFW_TERM_RC_H\n\n";
+print TERM_RC_FILE "namespace HBFW\n{\n\n";
+
+# print body of file
+sub print_term_rc
+{
+ my ($namespace, $enumName, @taggedLines) = @_;
+
+ # spaces in front to ensure correct headerfile format
+ print TERM_RC_FILE "namespace $namespace\n";
+ print TERM_RC_FILE "{\n";
+ print TERM_RC_FILE " $enumName\n";
+ print TERM_RC_FILE " {\n";
+ foreach my $line (@taggedLines)
+ {
+ print TERM_RC_FILE " $line\n";
+ }
+ print TERM_RC_FILE " };\n";
+ print TERM_RC_FILE "};\n\n";
+}
foreach my $file (@reasonCodeFiles)
{
@@ -193,6 +218,10 @@ foreach my $file (@reasonCodeFiles)
my $processingRcs = 2;
my $processingUds = 3;
my $compId = "";
+ my $term_rc_tag = 0;
+ my $printEnum = 0;
+ my $enumName = "";
+ my @taggedLines;
while (my $line = <RC_FILE>)
{
@@ -230,6 +259,20 @@ foreach my $file (@reasonCodeFiles)
}
elsif ($line =~ /enum.+ReasonCode/i)
{
+ # avoids comment lines '@enum *ReasonCode'
+ if ($line !~ /\s*\@/ )
+ {
+ # requiring namespaces in reason code header files
+ if ($namespace eq "NO_NS")
+ {
+ print ("No namespace in '$file'\n");
+ exit(1);
+ }
+ # strip leading whitespace and trailing characters
+ $enumName = $line;
+ $enumName =~ s!^\s+!!;
+ chomp($enumName);
+ }
$processing = $processingRcs;
next;
}
@@ -241,6 +284,11 @@ foreach my $file (@reasonCodeFiles)
elsif ($line =~ /}/)
{
$processing = 0;
+ if ($printEnum)
+ {
+ print_term_rc($namespace, $enumName, @taggedLines);
+ $printEnum = 0;
+ }
next;
}
@@ -254,6 +302,11 @@ foreach my $file (@reasonCodeFiles)
}
elsif ($processing == $processingRcs)
{
+ if ($line =~ /termination_rc/i)
+ {
+ $term_rc_tag = 1;
+ next;
+ }
if ($compId ne "")
{
# Reason code line does not contain Component ID
@@ -267,6 +320,16 @@ foreach my $file (@reasonCodeFiles)
}
$rcToValueHash{$namespace}->{$1} =
$compIdToValueHash{$compId} . $2;
+
+ # if comment tag "termination_rc" is above enum
+ # in reasoncode.H files
+ if($term_rc_tag)
+ {
+ my $line = $1." = 0x".$rcToValueHash{$namespace}->{$1};
+ push @taggedLines, $line;
+ $printEnum = 1;
+ $term_rc_tag = 0;
+ }
}
}
else
@@ -282,6 +345,16 @@ foreach my $file (@reasonCodeFiles)
}
$rcToValueHash{$namespace}->{$1} =
$compIdToValueHash{$2} . $3;
+
+ # if comment tag "termination_rc" is above enum
+ # in reasoncode.H files
+ if($term_rc_tag)
+ {
+ my $line = $1." = 0x".$rcToValueHash{$namespace}->{$1};
+ push @taggedLines, $line;
+ $printEnum = 1;
+ $term_rc_tag = 0;
+ }
}
}
}
@@ -304,9 +377,11 @@ foreach my $file (@reasonCodeFiles)
}
}
}
-
close(RC_FILE);
}
+# print footer of file
+print TERM_RC_FILE "};\n#endif\n";
+close(TERM_RC_FILE);
if ($DEBUG)
{
diff --git a/src/usr/errl/test/errlReportTest.H b/src/usr/errl/test/errlReportTest.H
index fc8fc289e..1e22d6419 100644
--- a/src/usr/errl/test/errlReportTest.H
+++ b/src/usr/errl/test/errlReportTest.H
@@ -49,7 +49,7 @@ class ErrlReportTest: public CxxTest::TestSuite
public:
/**
- * @brief Send a small size error log to FSP
+ * @brief Send a small size error log to FSP
* - Create an error log with only 192 bytes
* - Verify that hostbot created error log and sent it to FSP
* - Found an issue with FSI mailbox DMA code to realign data len
@@ -65,11 +65,11 @@ public:
TS_TRACE( "test testErrlReport1");
do
{
- // Create an error log
+ // Create an error log
l_err = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_INFORMATIONAL,
- ERRL_TEST_MOD_ID,
- ERRL_TEST_REASON_CODE,
+ ERRORLOG::ERRL_TEST_MOD_ID,
+ ERRORLOG::ERRL_TEST_REASON_CODE,
l_userData1,
l_userData2);
if (l_err == NULL)
@@ -80,14 +80,14 @@ public:
// Commit error log.
errlCommit(l_err, CXXTEST_COMP_ID);
-
+
} while(0);
}
/**
* @brief Send multiple error logs back to back to FSP
- * - Create several error logs and send them to FSP in a loop.
+ * - Create several error logs and send them to FSP in a loop.
* - Verify that error logs are created and sent to FSP
* - Verify that FSP received all the error logs and log them properly.
*/
@@ -103,11 +103,11 @@ public:
for (l_loopi = 0; l_loopi < 5; l_loopi++)
{
- // Create an error log
+ // Create an error log
l_err = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_INFORMATIONAL,
- ERRL_TEST_MOD_ID,
- ERRL_TEST_REASON_CODE,
+ ERRORLOG::ERRL_TEST_MOD_ID,
+ ERRORLOG::ERRL_TEST_REASON_CODE,
l_loopi,
l_loopi);
if (l_err == NULL)
@@ -118,7 +118,7 @@ public:
// Commit error log
errlCommit(l_err, CXXTEST_COMP_ID);
- }
+ }
} while(0);
}
@@ -129,7 +129,7 @@ public:
* - Verify that an error log with severity unrecoverable created successfully
* - Verify that the error log is sent to FSP
* - Verify that FSP log the error as unrecoverable one.
- *
+ *
*/
void testErrlReport3(void)
@@ -144,8 +144,8 @@ public:
// Create an error log
l_err = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- ERRL_TEST_MOD_ID,
- ERRL_TEST_REASON_CODE,
+ ERRORLOG::ERRL_TEST_MOD_ID,
+ ERRORLOG::ERRL_TEST_REASON_CODE,
l_userData1,
l_userData2);
if (l_err == NULL)
@@ -172,15 +172,15 @@ public:
errlHndl_t l_err = NULL;
uint64_t l_userData1 = 0xAAAAAAAA;
uint64_t l_userData2 = 0xBBBBBBBB;
-
+
TS_TRACE( "test testErrlReport4");
do
{
// Create an error log
l_err = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM,
- ERRL_TEST_MOD_ID,
- ERRL_TEST_REASON_CODE,
+ ERRORLOG::ERRL_TEST_MOD_ID,
+ ERRORLOG::ERRL_TEST_REASON_CODE,
l_userData1,
l_userData2);
if (l_err == NULL)
@@ -197,8 +197,8 @@ public:
/**
* @brief Send a big size error log to FSP
* - Verfiy that an error log with ffdc and traces is created successfully
- * - Verify that the error log is sent to FSP
- * - Verify that FSP logged the error with correct data successfully
+ * - Verify that the error log is sent to FSP
+ * - Verify that FSP logged the error with correct data successfully
*/
void testErrlReport5(void)
{
@@ -213,8 +213,8 @@ public:
// Create an error log
errlHndl_t l_err = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- ERRL_TEST_MOD_ID,
- ERRL_TEST_REASON_CODE,
+ ERRORLOG::ERRL_TEST_MOD_ID,
+ ERRORLOG::ERRL_TEST_REASON_CODE,
l_userData1,
l_userData2);
@@ -226,7 +226,7 @@ public:
break;
}
- // add FFDC
+ // add FFDC
const char * l_str = "Error log report testing.";
pffdc = l_err->addFFDC( DEVFW_COMP_ID, l_str, strlen( l_str ), 0, 0);
if ( NULL == pffdc )
@@ -258,9 +258,9 @@ public:
break;
}
- // Commit error log.
+ // Commit error log.
errlCommit(l_err, CXXTEST_COMP_ID);
-
+
} while(0);
}
diff --git a/src/usr/errl/test/errltest.H b/src/usr/errl/test/errltest.H
index 08163abee..8cd640fbb 100644
--- a/src/usr/errl/test/errltest.H
+++ b/src/usr/errl/test/errltest.H
@@ -103,9 +103,9 @@ public:
{
/*@
* @errortype
- * @reasoncode ERRL_TEST_REASON_CODE
+ * @reasoncode ERRORLOG::ERRL_TEST_REASON_CODE
* @severity ERRORLOG::ERRL_SEV_INFORMATIONAL
- * @moduleid ERRL_TEST_MOD_ID
+ * @moduleid ERRORLOG::ERRL_TEST_MOD_ID
* @devdesc Errl test. Error with non-decoded string
* and lots of trace buffers.
*/
@@ -113,8 +113,8 @@ public:
// Create an error log
errlHndl_t l_err = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_INFORMATIONAL,
- ERRL_TEST_MOD_ID,
- ERRL_TEST_REASON_CODE,
+ ERRORLOG::ERRL_TEST_MOD_ID,
+ ERRORLOG::ERRL_TEST_REASON_CODE,
l_userData1,
l_userData2);
@@ -220,7 +220,7 @@ public:
break;
}
- if (l_err->reasonCode() != ERRL_TEST_REASON_CODE)
+ if (l_err->reasonCode() != ERRORLOG::ERRL_TEST_REASON_CODE)
{
TS_FAIL("testErrl1: createErrlLog() returns incorrect reason code!");
break;
@@ -287,8 +287,8 @@ public:
// Create an error log
errlHndl_t l_err = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- ERRL_TEST_MOD_ID,
- ERRL_TEST_REASON_CODE,
+ ERRORLOG::ERRL_TEST_MOD_ID,
+ ERRORLOG::ERRL_TEST_REASON_CODE,
l_userData1,
l_userData2);
@@ -406,8 +406,8 @@ public:
// Create an error log
errlHndl_t errl = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- ERRL_TEST_MOD_ID,
- ERRL_TEST_REASON_CODE);
+ ERRORLOG::ERRL_TEST_MOD_ID,
+ ERRORLOG::ERRL_TEST_REASON_CODE);
// test the different callout types
TS_TRACE("test callout target %.8X", TARGETING::get_huid(pTarget));
@@ -583,8 +583,8 @@ public:
// Create an error log
errlHndl_t errl = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- ERRL_TEST_MOD_ID,
- ERRL_TEST_REASON_CODE);
+ ERRORLOG::ERRL_TEST_MOD_ID,
+ ERRORLOG::ERRL_TEST_REASON_CODE);
// test the different callout types
TS_TRACE( "test callout pEx %p", l_target);
@@ -669,8 +669,8 @@ public:
// Create an error log
errlHndl_t errl = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- ERRL_TEST_MOD_ID,
- ERRL_TEST_REASON_CODE);
+ ERRORLOG::ERRL_TEST_MOD_ID,
+ ERRORLOG::ERRL_TEST_REASON_CODE);
// test the different callout types
TS_TRACE( "test callout pEx %p", l_target);
OpenPOWER on IntegriCloud