summaryrefslogtreecommitdiffstats
path: root/src/usr/pnor/test
diff options
context:
space:
mode:
authorcrgeddes <crgeddes@us.ibm.com>2015-08-26 13:50:30 -0500
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2016-03-03 16:17:52 -0500
commitc73c1d03450fb1dfa0ef9c98485999aeaa0257d7 (patch)
tree70056c4a6b064db49d7419d2d5040f6569ea51fc /src/usr/pnor/test
parent8f30c7db00a3ce2940900ec2ba67838bcf432b98 (diff)
downloadblackbird-hostboot-c73c1d03450fb1dfa0ef9c98485999aeaa0257d7.tar.gz
blackbird-hostboot-c73c1d03450fb1dfa0ef9c98485999aeaa0257d7.zip
FFS Support for Bootloader
This commit moves functionality out of pnor_common.C and puts it in a new file pnor_utils.C this file will be shared with bootloader and hostboot code. Quite a few files were pulled apart in order to make includes easier across modules. These are lpc_const.H and pnor_const.H. bl_pnorAccess leverages the new pnor_utils.C file that will help the bootloader parse pnor TOC Change-Id: I740f6f8a707760756a261535e62e2d0a849324f8 RTC:134064 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/696 Tested-by: Jenkins Server Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr/pnor/test')
-rw-r--r--src/usr/pnor/test/makefile6
-rw-r--r--src/usr/pnor/test/pnorUtilsTestResources.H56
-rw-r--r--src/usr/pnor/test/pnorddtest.H45
-rw-r--r--src/usr/pnor/test/pnorutilsTest.H341
4 files changed, 442 insertions, 6 deletions
diff --git a/src/usr/pnor/test/makefile b/src/usr/pnor/test/makefile
index 35af02afc..098ea84a9 100644
--- a/src/usr/pnor/test/makefile
+++ b/src/usr/pnor/test/makefile
@@ -25,11 +25,11 @@
# IBM_PROLOG_END_TAG
ROOTPATH = ../../../..
+EXTRAINCDIR += ${ROOTPATH}/src/usr/pnor/
+
MODULE = testpnor
-TESTS = pnorddtest.H
-TESTS += ecctest.H
-TESTS += pnorrptest.H
+TESTS = pnorddtest.H ecctest.H pnorrptest.H pnorutilsTest.H
#SFC Implementations
TESTS += $(if $(CONFIG_SFC_IS_IBM_DPSS),sfc_ibmtest.H)
diff --git a/src/usr/pnor/test/pnorUtilsTestResources.H b/src/usr/pnor/test/pnorUtilsTestResources.H
new file mode 100644
index 000000000..5cab8f227
--- /dev/null
+++ b/src/usr/pnor/test/pnorUtilsTestResources.H
@@ -0,0 +1,56 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/pnor/test/pnorUtilsTestResources.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2014,2016 */
+/* [+] 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 BOOTLOADERTESTRESOURCES_H
+#define BOOTLOADERTESTRESOURCES_H
+
+//This data is used to test some of the parsing code that handles
+// the Table of Contents of PNOR flash. Do not modify this data
+// unless you are working with the pnor parsing test cases.
+static uint8_t testTOC[] =
+{0x50, 0x41, 0x52, 0x54, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80,
+0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x41, 0x02, 0xC6,
+0x70, 0x61, 0x72, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01,
+0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8F, 0x9E, 0x9D, 0x89,
+0x48, 0x42, 0x45, 0x4C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x24, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x02,
+0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB7, 0xBF, 0x7A, 0x84,
+};
+
+
+#endif
diff --git a/src/usr/pnor/test/pnorddtest.H b/src/usr/pnor/test/pnorddtest.H
index 3a38e88a6..3cf3ef350 100644
--- a/src/usr/pnor/test/pnorddtest.H
+++ b/src/usr/pnor/test/pnorddtest.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* Contributors Listed Below - COPYRIGHT 2011,2016 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
@@ -133,9 +133,48 @@ class PnorDdTest : public CxxTest::TestSuite
break;
}
+ // Perform PnorDD read 1
+ uint64_t l_address =
+ base_address + PNOR::pnorTestSec_readwrite_offset;
+ uint64_t l_readData = 0;
+ l_size = sizeof(uint64_t);
+ l_err = deviceRead(l_testTarget,
+ &l_readData,
+ l_size,
+ DEVICE_PNOR_ADDRESS(0, l_address));
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_readwrite: PNORDD read 1: deviceRead() failed! Error committed.");
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+ total++;
+
+ TRACFCOMP(g_trac_pnor, "Original value in read 1: %lx", l_readData);
+
+ // Perform PnorDD read 2
+ l_address = base_address + PNOR::pnorTestSec_readwrite_offset + 0x8;
+ l_size = sizeof(uint64_t);
+ l_err = deviceRead(l_testTarget,
+ &l_readData,
+ l_size,
+ DEVICE_PNOR_ADDRESS(0, l_address));
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_readwrite: PNORDD read 2: deviceRead() failed! Error committed.");
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+ total++;
+
+ TRACFCOMP(g_trac_pnor, "Original value in read 2: %lx", l_readData);
+
+
// Perform PnorDD Write 1
- uint64_t l_address = base_address +
+ l_address = base_address +
PNOR::pnorTestSec_readwrite_offset;
uint64_t l_writeData = 0x12345678FEEDB0B0;
l_size = sizeof(uint64_t);
@@ -183,7 +222,7 @@ class PnorDdTest : public CxxTest::TestSuite
// Perform PnorDD read 1
l_address = base_address + PNOR::pnorTestSec_readwrite_offset;
- uint64_t l_readData = 0;
+ l_readData = 0;
l_size = sizeof(uint64_t);
l_err = deviceRead(l_testTarget,
&l_readData,
diff --git a/src/usr/pnor/test/pnorutilsTest.H b/src/usr/pnor/test/pnorutilsTest.H
new file mode 100644
index 000000000..937d59b85
--- /dev/null
+++ b/src/usr/pnor/test/pnorutilsTest.H
@@ -0,0 +1,341 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/pnor/test/pnorutilsTest.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2014,2016 */
+/* [+] 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 PNORUTILSTEST_H
+#define PNORUTILSTEST_H
+
+#include <cxxtest/TestSuite.H>
+#include <errl/errlmanager.H>
+#include <errl/errlentry.H>
+#include "pnorUtilsTestResources.H"
+#include <usr/vmmconst.h>
+#include <pnor/pnor_const.H>
+#include <pnor/pnorif.H>
+#include <pnor_utils.H>
+
+/**
+ * @file pnorutilsTest.H
+ *
+ * @brief unit tests for pnor utils
+*/
+extern const char* cv_EYECATCHER[];
+extern trace_desc_t* g_trac_pnor;
+class pnorutilsTest : public CxxTest::TestSuite
+{
+ public:
+
+
+ void test_invalidMagicWord(void)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidMagicWord: starting");
+
+ uint8_t l_tocBuffer[PNOR::TOC_SIZE];
+ uint32_t l_errCode = 0;
+ bool l_failed = false;
+ memcpy(l_tocBuffer, testTOC, sizeof(testTOC));
+
+ //mess up the magic word while maintaining checksum
+ l_tocBuffer[0] = 0;
+ l_tocBuffer[1] = 0;
+ l_tocBuffer[16] = 0x50;
+ l_tocBuffer[17] = 0x41;
+
+ ffs_hdr* l_ffs_hdr = NULL;
+ PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ PNOR::checkHeader(l_ffs_hdr, l_errCode);
+
+ if((l_errCode & PNOR::INVALID_MAGIC) == PNOR::INVALID_MAGIC)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidMagicWord: Successfully found error with magic number");
+ }
+ else
+ {
+ TS_FAIL("pnorutilsTest::test_invalidMagicWord: Failed to find error with magic word ERR CODE: 0x%x", l_errCode);
+ l_failed = true;
+ }
+
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidMagicWord: complete, Failed = %d", l_failed);
+ }
+
+ void test_invalidFFSVersion(void)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidFFSVersion: starting");
+ uint8_t l_tocBuffer[PNOR::TOC_SIZE];
+ uint32_t l_errCode = 0;
+ bool l_failed = false;
+
+ memcpy(l_tocBuffer, testTOC, sizeof(testTOC));
+
+ //mess up the FFS version while maintaining checksum
+ l_tocBuffer[23] = 0x1;
+ l_tocBuffer[7] = 0x0;
+
+ ffs_hdr* l_ffs_hdr = NULL;
+ PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ PNOR::checkHeader(l_ffs_hdr, l_errCode);
+
+
+ if((l_errCode & PNOR::UNSUPPORTED_FFS) == PNOR::UNSUPPORTED_FFS)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidFFSVersion: Successfully found error with version");
+ }
+ else
+ {
+ TS_FAIL("pnorutilsTest::test_invalidFFSVersion: failed to find error with version. ERR CODE: 0x%x", l_errCode);
+ l_failed = true;
+ }
+
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidFFSVersion: complete, Failed = %d", l_failed);
+ }
+
+ void test_invalidEntrySize(void)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidEntrySize: starting");
+ uint8_t l_tocBuffer[PNOR::TOC_SIZE];
+ uint32_t l_errCode = 0;
+ bool l_failed = false;
+ memcpy(l_tocBuffer, testTOC, sizeof(testTOC));
+
+ //Make the entry size 0 while maintaining checksum
+ l_tocBuffer[15] = 0x0;
+ l_tocBuffer[31] = 0x80;
+
+ ffs_hdr* l_ffs_hdr = NULL;
+ PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ PNOR::checkHeader(l_ffs_hdr, l_errCode);
+
+
+ if((l_errCode & PNOR::INVALID_ENTRY_SIZE)
+ == PNOR::INVALID_ENTRY_SIZE)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidEntrySize: Successfully found error with entry size");
+ }
+ else
+ {
+ TS_FAIL("pnorutilsTest::test_invalidEntrySize: failed to find error with entry size. ERR CODE: 0x%x", l_errCode);
+ l_failed = true;
+ }
+
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidEntrySize: complete, Failed = %d", l_failed);
+ }
+
+ void test_invalidEntryCount(void)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidEntryCount: starting");
+ uint8_t l_tocBuffer[PNOR::TOC_SIZE];
+ uint32_t l_errCode = 0;
+ bool l_failed = false;
+ memcpy(l_tocBuffer, testTOC, sizeof(testTOC));
+
+ //make the entry count 0 while maintaining checksum
+ l_tocBuffer[19] = 0x00;
+ l_tocBuffer[35] = 0x12;
+
+ ffs_hdr* l_ffs_hdr = NULL;
+ PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ PNOR::checkHeader(l_ffs_hdr, l_errCode);
+
+
+ if((l_errCode & PNOR::NO_ENTRIES)== PNOR::NO_ENTRIES)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidEntryCount: Successfully found error with entry count");
+ }
+ else
+ {
+ TS_FAIL("pnorutilsTest::test_invalidEntryCount: Failed to find error with entry count. ERR CODE: 0x%x", l_errCode);
+ l_failed = true;
+ }
+
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidEntryCount: complete, Failed = %d", l_failed);
+ }
+
+ void test_invalidBlockSize(void)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidBlockSize: starting");
+ uint8_t l_tocBuffer[PNOR::TOC_SIZE];
+ uint32_t l_errCode = 0;
+ bool l_failed = false;
+ memcpy(l_tocBuffer, testTOC, sizeof(testTOC));
+
+ //make the block size 0 while maintaining checksum
+ l_tocBuffer[22] = 0x00;
+ l_tocBuffer[38] = 0x10;
+
+ ffs_hdr* l_ffs_hdr = NULL;
+ PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ PNOR::checkHeader(l_ffs_hdr, l_errCode);
+
+
+ if((l_errCode & PNOR::INVALID_BLOCK_SIZE) == PNOR::INVALID_BLOCK_SIZE)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidBlockSize: Successfully found error with block size");
+ }
+ else
+ {
+ TS_FAIL("pnorutilsTest::test_invalidBlockSize: Failed to find error with the block size. ERR CODE: 0x%x", l_errCode);
+ l_failed = true;
+ }
+
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidBlockSize: complete, Failed = %d", l_failed);
+ }
+
+ void test_invalidBlockCount(void)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidBlockCount: starting");
+ uint8_t l_tocBuffer[PNOR::TOC_SIZE];
+ uint32_t l_errCode = 0;
+ bool l_failed = false;
+ memcpy(l_tocBuffer, testTOC, sizeof(testTOC));
+
+ //make the block count 0 while maintaining checksum
+ l_tocBuffer[26] = 0x00;
+ l_tocBuffer[42] = 0x40;
+
+ ffs_hdr* l_ffs_hdr = NULL;
+ PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ PNOR::checkHeader(l_ffs_hdr, l_errCode);
+
+
+ if((l_errCode & PNOR::INVALID_BLOCK_COUNT)
+ == PNOR::INVALID_BLOCK_COUNT)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidBlockCount: Successfully found error with block count");
+ }
+ else
+ {
+ TS_FAIL("pnorutilsTest::test_invalidBlockCount: Failed to find error with block count. ERR CODE: 0x%x", l_errCode);
+ l_failed = true;
+ }
+
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidBlockCount: complete, Failed = %d", l_failed);
+ }
+
+ void test_invalidHdrSize(void)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidHdrSize: starting");
+ uint8_t l_tocBuffer[PNOR::TOC_SIZE];
+ uint32_t l_errCode = 0;
+ bool l_failed = false;
+ memcpy(l_tocBuffer, testTOC, sizeof(testTOC));
+
+ //Shrink block size to 51 while maintaining checksum
+ l_tocBuffer[22] = 0x00;
+ l_tocBuffer[38] = 0x10;
+ l_tocBuffer[23] = 0x33;
+ l_tocBuffer[39] = 0x33;
+
+ ffs_hdr* l_ffs_hdr = NULL;
+ PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ PNOR::checkHeader(l_ffs_hdr, l_errCode);
+
+
+ if((l_errCode & PNOR::INVALID_HEADER_SIZE)
+ == PNOR::INVALID_HEADER_SIZE)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidHdrSize: Successfully found error with hdr size");
+ }
+ else
+ {
+ TS_FAIL("pnorutilsTest::test_invalidHdrSize: Failed to find error with hdr size. ERR CODE: 0x%x", l_errCode);
+ l_failed = true;
+ }
+
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidHdrSize: complete, Failed = %d", l_failed);
+ }
+
+ void test_invalidEntryChecksum(void)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidEntryChecksum: starting");
+ uint8_t l_tocBuffer[PNOR::TOC_SIZE];
+ uint32_t l_errCode = 0;
+ bool l_failed = false;
+ memcpy(l_tocBuffer, testTOC, sizeof(testTOC));
+
+ //Mess up the checksum of an entry
+ l_tocBuffer[208] = 0xFF;
+ PNOR::SectionData_t * l_TOC;
+ ffs_hdr* l_ffs_hdr = NULL;
+ PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ PNOR::checkHeader(l_ffs_hdr, l_errCode);
+ //parse through the entries and check for any errors
+ ffs_entry* l_err_entry = NULL;
+ PNOR::parseEntries(l_ffs_hdr, l_errCode, l_TOC, l_err_entry);
+
+ if((l_errCode & PNOR::ENTRY_CHECKSUM_ERR)
+ == PNOR::ENTRY_CHECKSUM_ERR)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidEntryChecksum: Successfully found error with entry checksum");
+ }
+ else
+ {
+ TS_FAIL("pnorutilsTest::test_invalidEntryChecksum: Failed to find error the checksum for an entry. ERR CODE: 0x%x", l_errCode);
+ l_failed = true;
+ }
+
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_invalidEntryChecksum: complete, Failed = %d", l_failed);
+ }
+
+ void test_entryExtendsBeyondFlash(void)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_entryExtendsBeyondFlash: starting");
+ uint8_t l_tocBuffer[PNOR::TOC_SIZE];
+ uint32_t l_errCode = 0;
+ bool l_failed = false;
+ memcpy(l_tocBuffer, testTOC, sizeof(testTOC));
+
+ //make the block count 1
+ l_tocBuffer[26] = 0x01;
+ //make the size of the entry 0xFFFFFF24 (the 24 is in there)
+ l_tocBuffer[196] = 0xFF;
+ l_tocBuffer[197] = 0xFF;
+ l_tocBuffer[198] = 0xFF;
+ //Make sure you don't mess up the checksum
+ l_tocBuffer[212] = 0xFF;
+ l_tocBuffer[213] = 0xFF;
+ l_tocBuffer[214] = 0xFF;
+
+ PNOR::SectionData_t * l_TOC;
+ ffs_hdr* l_ffs_hdr = NULL;
+ PNOR::checkForNullBuffer(l_tocBuffer, l_errCode, l_ffs_hdr);
+ PNOR::checkHeader(l_ffs_hdr, l_errCode);
+ //parse through the entries and check for any errors
+ ffs_entry* l_err_entry = NULL;
+ PNOR::parseEntries(l_ffs_hdr, l_errCode, l_TOC, l_err_entry);
+
+ if((l_errCode & PNOR::ENTRY_EXTENDS_BEYOND_FLASH)
+ == PNOR::ENTRY_EXTENDS_BEYOND_FLASH)
+ {
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_entryExtendsBeyondFlash: Successfully found error with size of all entries");
+ }
+ else
+ {
+ TS_FAIL("pnorutilsTest::test_entryExtendsBeyondFlash: Failed to find error about entries extending beyond flash. ERR CODE: 0x%x", l_errCode);
+ l_failed = true;
+ }
+
+ TRACFCOMP(g_trac_pnor, "pnorutilsTest::test_entryExtendsBeyondFlash: complete, Failed = %d", l_failed);
+ }
+};
+
+#endif \ No newline at end of file
OpenPOWER on IntegriCloud