summaryrefslogtreecommitdiffstats
path: root/src/usr/pnor/test
diff options
context:
space:
mode:
authorBill Hoffa <wghoffa@us.ibm.com>2016-09-16 15:09:28 -0500
committerMatthew A. Ploetz <maploetz@us.ibm.com>2016-10-31 15:49:47 -0400
commitfde2240fafb48866ef3324f57ae7f4417625ad18 (patch)
tree418a4b243625c08b0bded4675e8a174d3ffcbd20 /src/usr/pnor/test
parent0cb19a22319130ec4ebeb64ee87a47328297486e (diff)
downloadtalos-hostboot-fde2240fafb48866ef3324f57ae7f4417625ad18.tar.gz
talos-hostboot-fde2240fafb48866ef3324f57ae7f4417625ad18.zip
Pnor DD Changes for AST2500
- Created Common sfc_ast2X000 class for common functions - Modified sfc_ast2400 class to use common class - Added sfc_ast2500 class Change-Id: I27c7674b58e006801ae03aabd60fdcfa21f49e9c RTC: 161664 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30919 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: Elizabeth K. Liner <eliner@us.ibm.com> Reviewed-by: Matthew A. Ploetz <maploetz@us.ibm.com>
Diffstat (limited to 'src/usr/pnor/test')
-rw-r--r--src/usr/pnor/test/pnorddtest.H4
-rw-r--r--src/usr/pnor/test/sfc_ast2500test.H186
2 files changed, 188 insertions, 2 deletions
diff --git a/src/usr/pnor/test/pnorddtest.H b/src/usr/pnor/test/pnorddtest.H
index 3cf3ef350..eb1fa793e 100644
--- a/src/usr/pnor/test/pnorddtest.H
+++ b/src/usr/pnor/test/pnorddtest.H
@@ -133,8 +133,8 @@ class PnorDdTest : public CxxTest::TestSuite
break;
}
- // Perform PnorDD read 1
- uint64_t l_address =
+ // Perform PnorDD read 1
+ uint64_t l_address =
base_address + PNOR::pnorTestSec_readwrite_offset;
uint64_t l_readData = 0;
l_size = sizeof(uint64_t);
diff --git a/src/usr/pnor/test/sfc_ast2500test.H b/src/usr/pnor/test/sfc_ast2500test.H
new file mode 100644
index 000000000..536293ab9
--- /dev/null
+++ b/src/usr/pnor/test/sfc_ast2500test.H
@@ -0,0 +1,186 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/pnor/test/sfc_ast2500test.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2016 */
+/* [+] Google Inc. */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+#ifndef __SFC_AST2500TEST_H
+#define __SFC_AST2500TEST_H
+
+/**
+ * @file sfc_ast2500test.H
+ *
+ * @brief Test case for AST2500 Flash Controller
+*/
+
+#include <cxxtest/TestSuite.H>
+#include <errl/errlmanager.H>
+#include <errl/errlentry.H>
+#include <devicefw/userif.H>
+#include <sys/time.h>
+#include "../pnordd.H"
+#include <list>
+#include <targeting/common/attributes.H>
+#include <lpc/lpcif.H>
+#include "../sfc_ast2500.H"
+#include <sio/sio.H>
+
+extern trace_desc_t* g_trac_pnor;
+
+class SfcAST2500Test : public CxxTest::TestSuite
+{
+ public:
+
+ bool getTestSection(uint64_t &o_physAddr, uint64_t &o_size)
+ {
+ errlHndl_t l_err = NULL;
+ PNOR::SectionInfo_t info;
+ uint64_t chip_select = 0xF;
+ bool needs_ecc = false;
+ bool section_found = false;
+
+ do{
+
+ // Get TEST PNOR section info from PNOR RP
+ l_err = PNOR::getSectionInfo( PNOR::TEST,
+ info );
+ if(l_err)
+ {
+ if(l_err->reasonCode() == PNOR::RC_INVALID_SECTION)
+ {
+ //This is expected in some configurations,
+ // so just delete it.
+ delete l_err;
+ }
+ else
+ {
+ //Any other type of error is not expected, so commit it.
+ errlCommit(l_err,PNOR_COMP_ID);
+ TS_FAIL("SfcAST2500Test::getTestSection> Error encountered"
+ " trying to find PNOR::TEST section");
+ }
+ break;
+ }
+
+ l_err = PnorRP::getInstance().computeDeviceAddr((void*)info.vaddr,
+ o_physAddr,
+ chip_select,
+ needs_ecc);
+ if(l_err)
+ {
+ errlCommit(l_err,PNOR_COMP_ID);
+ TS_FAIL("SfcAST2500Test::getTestSection> Error encountered"
+ " computing device address");
+ break;
+ }
+
+ o_size = info.size;
+ section_found = true;
+
+ }while(0);
+ return section_found;
+
+ }
+
+ /**
+ * @brief Test Flash Reads
+ * Verify that reads work in normal mode and then do
+ * not work in command mode
+ */
+ void test_FlashReads( void )
+ {
+ PnorDD& pnordd = Singleton<PnorDD>::instance();
+
+ //todo RTC:133649 -- enable once LPC error handling is in place
+ // SfcAST2500* sfc = reinterpret_cast<SfcAST2500*>(pnordd.iv_sfc );
+ mutex_t* l_mutex = pnordd.iv_mutex_ptr;
+ errlHndl_t l_err = NULL;
+
+ //Find some pnor to read
+ uint64_t base_address;
+ uint64_t sect_size;
+ if(!getTestSection(base_address, sect_size))
+ {
+ TRACFCOMP(g_trac_pnor, "SfcAST2500Test::test_FlashReads> Skipped due to not finding test section in PNOR" );
+ TS_FAIL("SfcAST2500Test::test_FlashReads> Skipped due to not finding test section in PNOR");
+ return;
+ }
+
+ mutex_lock(l_mutex);
+
+ //Prove reads work by default and that they fail in command mode
+ uint64_t l_readData = 0;
+ size_t l_size = sizeof(uint64_t);
+ l_err = pnordd._readFlash(base_address,
+ l_size,
+ &l_readData);
+ if( l_err )
+ {
+ TS_FAIL("SfcAST2500Test::test_FlashReads> Basic read failed");
+ mutex_unlock(l_mutex);//unlock before commit
+ errlCommit(l_err,PNOR_COMP_ID);
+ return; //just give up if basic reads don't work
+ }
+
+ mutex_unlock(l_mutex);
+// *****************************************************
+// Skipping test where we try to read in command mode
+// We know this will fail, currently no solution in place
+// to relay error from BMC to HB
+// todo RTC:133649 -- enable once LPC error handling is in place
+// ********************************
+// // Put controller into command mode (instead of read mode)
+// l_err = sfc->commandMode( true );
+// if( l_err )
+// {
+// TS_FAIL("SfcAST2500Test::test_FlashReads> Error entering command mode");
+// mutex_unlock(l_mutex);//unlock before commit
+// errlCommit(l_err,PNOR_COMP_ID);
+// mutex_lock(l_mutex);//lock again for next op
+// }
+//
+// // Reads should fail
+// l_err = pnordd._readFlash(base_address,
+// l_size,
+// &l_readData);
+// if( !l_err )
+// {
+// TS_FAIL("SfcAST2500Test::test_FlashReads> Read did not fail in command mode");
+// }
+// else
+// {
+// delete l_err;
+// }
+//
+// // Put controller back into read mode
+// l_err = sfc->commandMode( false );
+// mutex_unlock(l_mutex);
+// if( l_err )
+// {
+// TS_FAIL("SfcAST2500Test::test_FlashReads> Error exiting command mode");
+// errlCommit(l_err,PNOR_COMP_ID);
+// }
+ }
+
+};
+
+#endif
OpenPOWER on IntegriCloud