summaryrefslogtreecommitdiffstats
path: root/data/mnet/GP10/Host/Mch/post/860MemTest.cpp
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-07-09 16:09:18 +0200
committerHarald Welte <laforge@gnumonks.org>2010-07-09 16:09:18 +0200
commit903a15fc26e225c2559c98eba362e29f09de3d2c (patch)
tree5680b3c68a728df86092a5b8a4756625724025c3 /data/mnet/GP10/Host/Mch/post/860MemTest.cpp
import source code of Vovida GSML project (from www.vovida.org)HEADgsml-1_0master
This is the source code as it was published on vovida.org a couple of years ago. The filename was gsml-1_0.tar.bz2
Diffstat (limited to 'data/mnet/GP10/Host/Mch/post/860MemTest.cpp')
-rw-r--r--data/mnet/GP10/Host/Mch/post/860MemTest.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/data/mnet/GP10/Host/Mch/post/860MemTest.cpp b/data/mnet/GP10/Host/Mch/post/860MemTest.cpp
new file mode 100644
index 0000000..26798ba
--- /dev/null
+++ b/data/mnet/GP10/Host/Mch/post/860MemTest.cpp
@@ -0,0 +1,50 @@
+// *******************************************************************
+//
+// (c) Copyright Cisco 2000
+// All Rights Reserved
+//
+// *******************************************************************
+
+#include <stdio.h>
+#include <sysLib.h>
+#include "mch/post.h"
+
+
+
+void MPC860MemTest(void)
+{
+ // First validate the MPC860 SDRAM by writing a walking one pattern and a
+ // walking zero pattern. Each memory location is saved prior to testing a
+ // location and restored after testing.
+ unsigned int save, read, write;
+ unsigned int errs = 0;
+
+ // Loop through all MPC860 SDRAM.
+ for (unsigned int *addr = 0; addr < (unsigned int *)sysMemTop(); addr++)
+ {
+ // Do not test the memory used to execute this code.
+ if (((char *)*addr < pText) && ((char *)*addr > (pText+POT_MEM_SIZE)) && ((char **)*addr != &pText) &&
+ ((char **)*addr != &pData) && ((char **)*addr != &pBSS))
+ {
+ save = *addr;
+ write = 0x80000000;
+ for(; write; write>>=1)
+ {
+ *addr = write;
+ read = *addr;
+ if (read != write)
+ errs++;
+
+ *addr = ~write;
+ read = *addr;
+ if (read != ~write)
+ errs++;
+ }
+ *addr = save;
+ }
+ }
+
+ // Update the power on test status that will be checked later by root.
+ if (errs) PowerOnTestStatus |= MPC860_SDRAM_TEST;
+
+} \ No newline at end of file