summaryrefslogtreecommitdiffstats
path: root/src/usr/pnor/test/sfc_ibmtest.H
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2014-06-17 10:27:07 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-10-14 08:49:13 -0500
commitf058c4b71a182364fd664f5a4d93cd1fe3e07d19 (patch)
tree348cab519fb07d2172fad68d1df689381c437793 /src/usr/pnor/test/sfc_ibmtest.H
parent4b16ee65fc46cb19aca69bd54b6024a948316315 (diff)
downloadtalos-hostboot-f058c4b71a182364fd664f5a4d93cd1fe3e07d19.tar.gz
talos-hostboot-f058c4b71a182364fd664f5a4d93cd1fe3e07d19.zip
Split out SFC logic and add support for AST2400
Refactored the PNOR device driver to pull all SFC-specific code into a new set of classes. Any time a new type of serial flash controller (SFC) is introduced, a new subclass should be created to support it. Also added the full support for the AST2400 BMC that is being used on Palmetto. Change-Id: I9cdbf9b48bbf94615a39804920e170a3142ec386 Origin: Google Shared Technology RTC: 97493 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/13229 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/pnor/test/sfc_ibmtest.H')
-rw-r--r--src/usr/pnor/test/sfc_ibmtest.H174
1 files changed, 174 insertions, 0 deletions
diff --git a/src/usr/pnor/test/sfc_ibmtest.H b/src/usr/pnor/test/sfc_ibmtest.H
new file mode 100644
index 000000000..967045ad0
--- /dev/null
+++ b/src/usr/pnor/test/sfc_ibmtest.H
@@ -0,0 +1,174 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/pnor/test/sfc_ibmtest.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2014 */
+/* [+] 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_IBMTEST_H
+#define __SFC_IBMTEST_H
+
+/**
+ * @file sfc_ibmtest.H
+ *
+ * @brief Test case for IBM DPSS 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 "../sfc_ibm.H"
+
+extern trace_desc_t* g_trac_pnor;
+
+class SfcIBMTest : public CxxTest::TestSuite
+{
+ public:
+
+ /*************************************************************************/
+ /* NOTE: TEST DISABLED!!! remove "_" before test name to re-enable */
+ /*************************************************************************/
+ /**
+ * @brief PNOR DD Force Fails testcase
+ */
+ void _test_forceFails(void)
+ {
+ errlHndl_t l_err = NULL;
+ uint64_t fails = 0;
+ uint64_t total = 0;
+ SfcIBM* sfcdd = reinterpret_cast<SfcIBM*>(
+ Singleton<PnorDD>::instance().iv_sfc );
+ mutex_t* l_mutex = Singleton<PnorDD>::instance().iv_mutex_ptr;
+ SfcIBM::SfcCmdReg_t sfc_cmd;
+
+ do{
+ TRACFCOMP(g_trac_pnor, "SfcIBMTest::test_forceFails> starting - expect to see errors");
+
+ /*******************************/
+ /* Send in an invalid OP Code */
+ /*******************************/
+ sfc_cmd.opcode = SfcIBM::SFC_OP_INVALID;
+ sfc_cmd.length = 0;
+
+ mutex_lock(l_mutex);
+ l_err = sfcdd->writeReg(SfcIBM::SFC_CMD_SPACE,
+ SfcIBM::SFC_REG_CMD,
+ sfc_cmd.data32);
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("SfcIBMTest::test_forceFails> writeReg failed! Error committed.");
+ fails++;
+
+ // Unlock mutex for Error Log to be commited
+ mutex_unlock(l_mutex);
+ errlCommit(l_err,PNOR_COMP_ID);
+
+ // Lock mutex for next operation
+ mutex_lock(l_mutex);
+ }
+
+ // Poll for complete status without waiting
+ l_err = sfcdd->pollOpComplete();
+ mutex_unlock(l_mutex);
+
+ total++;
+ if ( l_err == NULL )
+ {
+ TS_FAIL("SfcIBMTest::test_forceFails> Failed to create illegal opcode error!");
+ fails++;
+ }
+ else
+ {
+ // error correctly created - delete it
+ delete l_err;
+ }
+
+ /*******************************************************/
+ /* Issue a cmd but poll for completion without waiting */
+ /*******************************************************/
+ //Issue Get Chip ID command
+ sfc_cmd.opcode = SfcIBM::SFC_OP_CHIPID;
+ sfc_cmd.length = 0;
+
+ mutex_lock(l_mutex);
+ l_err = sfcdd->writeReg(SfcIBM::SFC_CMD_SPACE,
+ SfcIBM::SFC_REG_CMD,
+ sfc_cmd.data32);
+
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("SfcIBMTest::test_forceFails> Get Chip Id cmd failed! Error committed.");
+ fails++;
+
+ // Unlock mutex for Error Log to be commited
+ mutex_unlock(l_mutex);
+ errlCommit(l_err,PNOR_COMP_ID);
+
+ // Lock mutex for next operation
+ mutex_lock(l_mutex);
+ }
+
+ // Poll for complete status without waiting
+ l_err = sfcdd->pollOpComplete();
+
+ total++;
+ if ( l_err == NULL )
+ {
+ TS_FAIL("SfcIBMTest::test_forceFails> pollOpCompletel(l_poll=0) Failed to create an error!");
+ fails++;
+ }
+ else
+ {
+ // error correctly created - delete it
+ delete l_err;
+ }
+
+ /*******************************************************/
+ /* Cleanup: poll to make sure last operation completes */
+ /* before continuing */
+ /*******************************************************/
+ l_err = sfcdd->pollOpComplete();
+ mutex_unlock(l_mutex);
+
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("SfcIBMTest::test_forceFails> Cleanup polling failed! Error committed.");
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+
+
+ }while(0);
+
+ TRACFCOMP(g_trac_pnor, "SfcIBMTest::test_forceFails> %d/%d fails", fails, total );
+
+ }
+};
+
+#endif
OpenPOWER on IntegriCloud