summaryrefslogtreecommitdiffstats
path: root/src/usr/sbeio/test
diff options
context:
space:
mode:
authorDzuy Nguyen <dzuy@us.ibm.com>2016-11-23 16:57:16 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-01-19 18:03:32 -0500
commit7fd14de1394f507935cd60f6215ca5f65b97df51 (patch)
tree57aee80a5e9627f76fa9b09068568fc07f05df6c /src/usr/sbeio/test
parente671bf2e25b6902a76212ab830c1f6e2841042cc (diff)
downloadtalos-hostboot-7fd14de1394f507935cd60f6215ca5f65b97df51.tar.gz
talos-hostboot-7fd14de1394f507935cd60f6215ca5f65b97df51.zip
SBE FIFO device driver FFDC and error recovery
Add SBE FFDC error handling to FIFO driver Change-Id: I6ae81062eac1d5362c5fa5651c8ca5a2043b5c73 RTC: 149454 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/32969 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> Reviewed-by: Shakeeb A. Pasha B K <shakeebbk@in.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/sbeio/test')
-rw-r--r--src/usr/sbeio/test/sbe_ffdctest.H245
1 files changed, 156 insertions, 89 deletions
diff --git a/src/usr/sbeio/test/sbe_ffdctest.H b/src/usr/sbeio/test/sbe_ffdctest.H
index 51105f997..f48206a35 100644
--- a/src/usr/sbeio/test/sbe_ffdctest.H
+++ b/src/usr/sbeio/test/sbe_ffdctest.H
@@ -32,13 +32,17 @@
*/
#include <cxxtest/TestSuite.H>
+#include <util/utilbyte.H>
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
-#include <sbeio/sbe_psudd.H>
+#include <sbeio/sbe_ffdc_parser.H>
+
+#define SBE_TRACF(printf_string,args...) \
+ TRACFCOMP(g_trac_sbeio,"ffdcParserTest: " printf_string,##args)
extern trace_desc_t* g_trac_sbeio;
-class SbeFFDCTest : public CxxTest::TestSuite, public SBEIO::SbePsu
+class SbeFFDCTest : public CxxTest::TestSuite
{
public:
@@ -47,22 +51,34 @@ class SbeFFDCTest : public CxxTest::TestSuite, public SBEIO::SbePsu
*/
void testSBEFFDC1(void)
{
- TS_TRACE(ENTER_MRK "sbeioTestFFDC test 1: no data");
+ uint8_t l_num = 0;
+ uint8_t data[16] = {
+ 0, 0, // magic byte
+ 0, 0, // package length
+ 0, 0, // arbitrary sequence ID
+ 0, 0, // arbitrary command class and commamd
+ 0, 0, 0, 0, // return code
+ 0, 0, 0, 0 // arbitrary data
+ };
+
+ TS_TRACE("ffdcParserTest test 1 - no data");
- errlHndl_t l_errl = new ERRORLOG::ErrlEntry(
- ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- 0,
- 0,
- 0,
- 0);
+ SBEIO::SbeFFDCParser * l_ffdc_parser = new SBEIO::SbeFFDCParser();
+ l_ffdc_parser->parseFFDCData(&data);
- if(!SBEIO::SbePsu::handleFFDCError(l_errl))
+ l_num = l_ffdc_parser->getTotalPackages();
+ if(l_num != 0)
{
- TS_FAIL(EXIT_MRK "sbeioTestFFDC test 1 failed.");
+ TS_FAIL("ffdcParserTest test 1 FAILED: 0 expected, got %d", l_num);
}
+ else
+ {
+ SBE_TRACF("package test 1 PASSED: 0 expected, got %d", l_num);
+ }
+
+ delete l_ffdc_parser;
- delete l_errl;
- TS_TRACE(EXIT_MRK "sbeioTestFFDC test 1: no data");
+ TS_TRACE("ffdcParserTest test 1 - no data PASSED");
}
/**
@@ -70,32 +86,46 @@ class SbeFFDCTest : public CxxTest::TestSuite, public SBEIO::SbePsu
*/
void testSBEFFDC2(void)
{
+ uint8_t i;
+ uint8_t l_num = 0;
uint8_t data[16] = {
- 255, 220, // magic byte
- 0, 7, // length of 1 word + 6
+ 0xff, 0xdc, // magic byte
+ 0, 4, // package length of
0, 1, // arbitrary sequence ID
1, 1, // arbitrary command class and commamd
- 0, 1, 0, 1, // arbitrary return code
+ 0x00, 0x01, 0x02, 0x03, // return code
1, 1, 1, 1 // arbitrary data
};
- TS_TRACE(ENTER_MRK "sbeioTestFFDC test 2: 1 package, 1 word data");
+ TS_TRACE("ffdcParserTest test 2 - 1 package, 1 word data");
- errlHndl_t l_errl = new ERRORLOG::ErrlEntry(
- ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- 0,
- 0,
- 0,
- 0);
+ SBEIO::SbeFFDCParser * l_ffdc_parser = new SBEIO::SbeFFDCParser();
+ l_ffdc_parser->parseFFDCData(&data);
- SBEIO::SbePsu::writeFFDCBuffer(&data, 16);
- if(!SBEIO::SbePsu::handleFFDCError(l_errl))
+ l_num = l_ffdc_parser->getTotalPackages();
+ if(l_num != 1)
{
- TS_FAIL(EXIT_MRK "sbeioTestFFDC test 2 failed.");
+ TS_FAIL("ffdcParserTest test 2 FAILED: 1 expected, got %d", l_num);
+ }
+ else
+ {
+ SBE_TRACF("package test 2 PASSED: 1 expected, got %d", l_num);
+ for(i=0; i<l_num; i++)
+ {
+ uint32_t l_rc = l_ffdc_parser->getPackageRC(i);
+ if(l_rc != 66051)
+ {
+ TS_FAIL("ffdcParserTest test 2 FAILED RC: expected 66051, got %d", l_rc);
+ }
+ else
+ {
+ SBE_TRACF("RC test 2 PASSED: 66051 expected, got %d", l_rc);
+ }
+ }
}
- delete l_errl;
- TS_TRACE(EXIT_MRK "sbeioTestFFDC test 2: 1 package, 1 word data");
+ delete l_ffdc_parser;
+ TS_TRACE("ffdcParserTest test 2 - 1 package, 1 word data PASSED");
}
/**
@@ -103,34 +133,47 @@ class SbeFFDCTest : public CxxTest::TestSuite, public SBEIO::SbePsu
*/
void testSBEFFDC3(void)
{
-
+ uint8_t i;
+ uint8_t l_num = 0;
uint8_t data[20] = {
- 255, 220, // magic byte
- 0, 8, // length of 2 word + 6
+ 0xff, 0xdc, // magic byte
+ 0, 5, // package length
0, 2, // arbitrary sequence ID
1, 1, // arbitrary command class and commamd
- 0, 1, 0, 1, // arbitrary return code
+ 0x01, 0x02, 0x03, 0x04, // return code
1, 1, 1, 1, // arbitrary data
1, 1, 1, 1 // arbitrary data
};
- errlHndl_t l_errl = new ERRORLOG::ErrlEntry(
- ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- 0,
- 0,
- 0,
- 0);
- TS_TRACE(ENTER_MRK "sbeioTestFFDC test 3: 1 package, 2 word data");
+ TS_TRACE("ffdcParserTest test 3 - 1 package, 2 word data");
+
+ SBEIO::SbeFFDCParser * l_ffdc_parser = new SBEIO::SbeFFDCParser();
+ l_ffdc_parser->parseFFDCData(&data);
- SBEIO::SbePsu::writeFFDCBuffer(&data, 20);
- if(!SBEIO::SbePsu::handleFFDCError(l_errl))
+ l_num = l_ffdc_parser->getTotalPackages();
+ if(l_num != 1)
{
- TS_FAIL(EXIT_MRK "sbeioTestFFDC test 3 failed.");
+ TS_FAIL("ffdcParserTest test 3 FAILED: 1 expected, got %d", l_num);
+ }
+ else
+ {
+ SBE_TRACF("package test 3 PASSED: 1 expected, got %d", l_num);
+ for(i=0; i<l_num; i++)
+ {
+ uint32_t l_rc = l_ffdc_parser->getPackageRC(i);
+ if(l_rc != 16909060)
+ {
+ TS_FAIL("ffdcParserTest test 3 FAILED RC: expect 16909060, got %d", l_rc);
+ }
+ else
+ {
+ SBE_TRACF("RC test 3 PASSED: 16909060 expected, got %d", l_rc);
+ }
+ }
}
- delete l_errl;
- TS_TRACE(EXIT_MRK "sbeioTestFFDC test 3: 1 package, 2 word data");
-
+ delete l_ffdc_parser;
+ TS_TRACE("ffdcParserTest test 3 - 1 package, 2 word data PASSED");
}
/**
@@ -138,83 +181,107 @@ class SbeFFDCTest : public CxxTest::TestSuite, public SBEIO::SbePsu
*/
void testSBEFFDC4(void)
{
-
+ uint8_t i;
+ uint8_t l_num = 0;
uint8_t data[36] = {
- 255, 220, // magic byte
- 0, 8, // length of 1 word + 6
+ 0xff, 0xdc, // magic byte
+ 0, 5, // package length
0, 2, // arbitrary sequence ID
1, 1, // arbitrary command class and commamd
- 0, 1, 0, 1, // arbitrary return code
+ 0x02, 0x03, 0x04, 0x05, // return code
1, 1, 1, 1, // arbitrary data
1, 1, 1, 1,
- 255, 220, // package 2
- 0, 7, // length of 1 word + 6
+ 0xff, 0xdc, // package 2
+ 0, 4, // length of 1 word + 6
0, 2, // arbitrary sequence ID
1, 1, // arbitrary command class and commamd
- 0, 1, 0, 1, // arbitrary return code
+ 0x02, 0x03, 0x04, 0x05, // return code
2, 2, 2, 2
};
- TS_TRACE(ENTER_MRK "sbeioTestFFDC test 4: 2 packages, 2 word data");
+ TS_TRACE("ffdcParserTest test 4 - 2 packages, 2 word data");
+
+ SBEIO::SbeFFDCParser * l_ffdc_parser = new SBEIO::SbeFFDCParser();
+ l_ffdc_parser->parseFFDCData(&data);
- errlHndl_t l_errl = new ERRORLOG::ErrlEntry(
- ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- 0,
- 0,
- 0,
- 0);
- SBEIO::SbePsu::writeFFDCBuffer(&data, 36);
- if(!SBEIO::SbePsu::handleFFDCError(l_errl))
+ l_num = l_ffdc_parser->getTotalPackages();
+ if(l_num != 2)
{
- TS_FAIL(EXIT_MRK "sbeioTestFFDC test 4 failed.");
+ TS_FAIL("ffdcParserTest test 4 FAILED: 2 expected, got %d", l_num);
+ }
+ else
+ {
+ SBE_TRACF("package test 4 PASSED: 2 expected, got %d", l_num);
+ for(i=0; i<l_num; i++)
+ {
+ uint32_t l_rc = l_ffdc_parser->getPackageRC(i);
+ if(l_rc != 33752069)
+ {
+ TS_FAIL("ffdcParserTest test 4 FAILED RC: expect 33752069, got %d", l_rc);
+ }
+ else
+ {
+ SBE_TRACF("RC test 4 PASSED: 33752069 expected, got %d", l_rc);
+ }
+ }
}
- delete l_errl;
- TS_TRACE(EXIT_MRK "sbeioTestFFDC test 4: 2 packages, 2 word data");
-
+ delete l_ffdc_parser;
+ TS_TRACE("ffdcParserTest test 4 - 2 packages, 2 word data PASSED");
}
/**
* @brief Test with valid magic byte, 2 package, 2nd magic byte is bad
*/
void testSBEFFDC5(void)
{
-
+ uint8_t i;
+ uint8_t l_num = 0;
uint8_t data[40] = {
- 255, 220, // magic byte
- 0, 8, // length of 1 word + 6
+ 0xff, 0xdc, // magic byte
+ 0, 6, // package length
0, 2, // arbitrary sequence ID
1, 1, // arbitrary command class and commamd
- 0, 1, 0, 1, // arbitrary return code
+ 0x04, 0x05, 0x06, 0x07, // return code
1, 1, 1, 1, // arbitrary data
1, 1, 1, 1,
- 220, 220, // package 2 - bad magic byte
+ 1, 1, 1, 1,
+ 0xdc, 0xdc, // package 2 - bad magic byte
0, 7, // length of 1 word + 6
0, 2, // arbitrary sequence ID
1, 1, // arbitrary command class and commamd
- 0, 1, 0, 1, // arbitrary return code
- 1, 1, 1, 1, // arbitrary data
- 2, 2, 2, 2
+ 0x05, 0x06, 0x07, 0x08, // return code
+ 1, 1, 1, 1 // arbitrary data
};
- TS_TRACE(ENTER_MRK"sbeioTestFFDC test 5:\
- 2 packages, bad 2nd magic byte");
-
- errlHndl_t l_errl = new ERRORLOG::ErrlEntry(
- ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- 0,
- 0,
- 0,
- 0);
- SBEIO::SbePsu::writeFFDCBuffer(&data, 40);
- if(!SBEIO::SbePsu::handleFFDCError(l_errl))
+ TS_TRACE("ffdcParserTest test 5 - 2 packages, bad 2nd magic byte");
+
+ SBEIO::SbeFFDCParser * l_ffdc_parser = new SBEIO::SbeFFDCParser();
+ l_ffdc_parser->parseFFDCData(&data);
+ l_num = l_ffdc_parser->getTotalPackages();
+ if(l_num != 1)
{
- TS_FAIL(EXIT_MRK "sbeioTestFFDC test 5 failed.");
+ TS_FAIL("ffdcParserTest test 5 FAILED: 1 expected, got %d", l_num);
+ }
+ else
+ {
+ SBE_TRACF("package test 5 PASSED: 1 expected, got %d", l_num);
+ for(i=0; i<l_num; i++)
+ {
+ uint32_t l_rc = l_ffdc_parser->getPackageRC(i);
+ if(l_rc != 67438087)
+ {
+ TS_FAIL("ffdcParserTest test 5 FAIL RC: 67438087, got %d", l_rc);
+ }
+ else
+ {
+ SBE_TRACF("RC test 5 PASSED: 67438087 expected, got %d", l_rc);
+ }
+ }
}
- delete l_errl;
- TS_TRACE(EXIT_MRK"sbeioTestFFDC test 5:\
- 2 packages, bad 2nd magic byte");
-
+ delete l_ffdc_parser;
+ TS_TRACE("ffdcParserTest test 5 -\
+ 2 packages, bad 2nd magic byte PASSED");
}
};
OpenPOWER on IntegriCloud