summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rwxr-xr-xsrc/test/testcases/test.xml3
-rwxr-xr-xsrc/test/testcases/testModifyScom.py98
-rwxr-xr-xsrc/test/testcases/testPutGetInScom.py83
-rw-r--r--[-rwxr-xr-x]src/test/testcases/testPutGetScom.py102
-rwxr-xr-xsrc/test/testcases/testPutScomUnderMask.py99
-rw-r--r--src/test/testcases/testSbeDump.py5
-rwxr-xr-xsrc/test/testcases/testScom.xml43
-rw-r--r--src/test/testcases/testScomUtil.py125
-rw-r--r--src/test/testcases/testSecurity.py43
9 files changed, 182 insertions, 419 deletions
diff --git a/src/test/testcases/test.xml b/src/test/testcases/test.xml
index a56da5de..6cbdcc17 100755
--- a/src/test/testcases/test.xml
+++ b/src/test/testcases/test.xml
@@ -33,7 +33,7 @@
<include>../simics/targets/p9_nimbus/sbeTest/testPSUSetStashPair.xml</include>
<include>../simics/targets/p9_nimbus/sbeTest/testIstep.xml</include>
<include>../simics/targets/p9_nimbus/sbeTest/testSuspendIO.xml</include>
- <include>../simics/targets/p9_nimbus/sbeTest/testScom.xml</include>
+ <include>../simics/targets/p9_nimbus/sbeTest/testSecurity.xml</include>
<include>../simics/targets/p9_nimbus/sbeTest/testGeneric.xml</include>
<!-- Memory access testcases -->
<include>../simics/targets/p9_nimbus/sbeTest/testUnsecureMemRegions.xml</include>
@@ -52,7 +52,6 @@
<include>../simics/targets/p9_nimbus/sbeTest/testExecutorPutRing.xml</include>
<include>../simics/targets/p9_nimbus/sbeTest/testFastAccess.xml</include>
<include>../simics/targets/p9_nimbus/sbeTest/testQuiesce.xml</include>
- <include>../simics/targets/p9_nimbus/sbeTest/testSecurity.xml</include>
<testcase>
<simcmd>sbe-trace 0</simcmd>
</testcase>
diff --git a/src/test/testcases/testModifyScom.py b/src/test/testcases/testModifyScom.py
deleted file mode 100755
index 487dae5b..00000000
--- a/src/test/testcases/testModifyScom.py
+++ /dev/null
@@ -1,98 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/test/testcases/testModifyScom.py $
-#
-# OpenPOWER sbe Project
-#
-# Contributors Listed Below - COPYRIGHT 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
-import sys
-sys.path.append("targets/p9_nimbus/sbeTest" )
-import testUtil
-err = False
-#from testWrite import *
-
-
-PUTSCOM_TESTDATA = [0,0,0,6,
- 0,0,0xA2,0x02,
- 0,0,0x0,0x00,
- 0,0x05,0x00,0x3E, #scratch reg 7 (32-bit)
- 0x00,0xff,0x00,0xff,
- 0x00,0x00,0x00,0x00 ]
-
-PUTSCOM_EXPDATA = [0xc0,0xde,0xa2,0x02,
- 0x0,0x0,0x0,0x0,
- 0x00,0x0,0x0,0x03];
-
-
-MODIFYSCOM_TESTDATA = [0,0,0,7,
- 0,0,0xA2,0x03,
- 0,0,0x0,0x01,
- 0,0,0x0,0x00,
- 0,0x05,0x00,0x3E,
- 0xde,0x00,0xff,0x00,
- 0x00,0x00,0x00,0x00]
-
-MODIFYSCOM_EXPDATA = [0xc0,0xde,0xa2,0x03,
- 0x0,0x0,0x0,0x0,
- 0x00,0x0,0x0,0x03];
-
-GETSCOM4MODIFYSCOM_TESTDATA = [0,0,0,4,
- 0,0,0xA2,0x01,
- 0,0,0x0,0x00,
- 0,0x05,0x0,0x3E]
-
-GETSCOM4MODIFYSCOM_EXPDATA = [0xde,0xff,0xff,0xff,
- 0x00,0x00,0x00,0x00,
- 0xc0,0xde,0xa2,0x01,
- 0x0,0x0,0x0,0x0,
- 0x00,0x0,0x0,0x03];
-
-# MAIN Test Run Starts Here...
-#-------------------------------------------------
-def main( ):
- testUtil.runCycles( 10000000 )
-
- testUtil.writeUsFifo( PUTSCOM_TESTDATA )
- testUtil.writeEot( )
- testUtil.readDsFifo( PUTSCOM_EXPDATA )
- testUtil.readEot( )
-
- testUtil.writeUsFifo( MODIFYSCOM_TESTDATA )
- testUtil.writeEot( )
- testUtil.readDsFifo( MODIFYSCOM_EXPDATA )
- testUtil.readEot( )
-
- testUtil.writeUsFifo( GETSCOM4MODIFYSCOM_TESTDATA )
- testUtil.writeEot( )
- testUtil.readDsFifo( GETSCOM4MODIFYSCOM_EXPDATA )
- testUtil.readEot( )
-
-#-------------------------------------------------
-# Calling all test code
-#-------------------------------------------------
-main()
-
-if err:
- print ("\nTest Suite completed with error(s)")
- #sys.exit(1)
-else:
- print ("\nTest Suite completed with no errors")
- #sys.exit(0);
-
diff --git a/src/test/testcases/testPutGetInScom.py b/src/test/testcases/testPutGetInScom.py
deleted file mode 100755
index 2aecb0e6..00000000
--- a/src/test/testcases/testPutGetInScom.py
+++ /dev/null
@@ -1,83 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/test/testcases/testPutGetInScom.py $
-#
-# OpenPOWER sbe Project
-#
-# Contributors Listed Below - COPYRIGHT 2015,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
-
-import sys
-sys.path.append("targets/p9_nimbus/sbeTest" )
-import testUtil
-err = False
-#from testWrite import *
-
-# @TODO via RTC : 141905
-# Modify the test sequence in such a way that
-# the test does not leave the Register value altered.
-
-# Indirect scom form 0 test case
-PUTSCOM_TESTDATA = [0,0,0,6,
- 0,0,0xA2,0x02,
- 0x80,0x0,0x0,0x83,
- 0x0D,0x01,0x0C,0x3F,
- 0xde,0xca,0xff,0xee,
- 0x00,0x00,0x12,0x34 ]
-
-PUTSCOM_EXPDATA = [0xc0,0xde,0xa2,0x02,
- 0x0,0x0,0x0,0x0,
- 0x00,0x0,0x0,0x03];
-
-GETSCOM_TESTDATA = [0,0,0,4,
- 0,0,0xA2,0x01,
- 0x80,0x0,0x0,0x83,
- 0x0D,0x01,0x0C,0x3F]
-
-GETSCOM_EXPDATA = [0x00,0x00,0x00,0x00,
- 0x00,0x00,0x12,0x34, # Only last 16 bits will be returned
- 0xc0,0xde,0xa2,0x01,
- 0x0,0x0,0x0,0x0,
- 0x00,0x0,0x0,0x03];
-
-# MAIN Test Run Starts Here...
-#-------------------------------------------------
-def main( ):
- testUtil.runCycles( 10000000 )
- testUtil.writeUsFifo( PUTSCOM_TESTDATA )
- testUtil.writeEot( )
- testUtil.readDsFifo( PUTSCOM_EXPDATA )
- testUtil.readEot( )
- testUtil.writeUsFifo( GETSCOM_TESTDATA )
- testUtil.writeEot( )
- testUtil.readDsFifo( GETSCOM_EXPDATA )
- testUtil.readEot( )
-
-#-------------------------------------------------
-# Calling all test code
-#-------------------------------------------------
-main()
-
-if err:
- print ("\nTest Suite completed with error(s)")
- #sys.exit(1)
-else:
- print ("\nTest Suite completed with no errors")
- #sys.exit(0);
-
diff --git a/src/test/testcases/testPutGetScom.py b/src/test/testcases/testPutGetScom.py
index 6378e114..8b5fe5ce 100755..100644
--- a/src/test/testcases/testPutGetScom.py
+++ b/src/test/testcases/testPutGetScom.py
@@ -5,7 +5,7 @@
#
# OpenPOWER sbe Project
#
-# Contributors Listed Below - COPYRIGHT 2015,2016
+# Contributors Listed Below - COPYRIGHT 2016,2017
# [+] International Business Machines Corp.
#
#
@@ -22,98 +22,12 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
+import os
import sys
-sys.path.append("targets/p9_nimbus/sbeTest" )
-import testUtil
-err = False
-#from testWrite import *
-
-# @TODO via RTC : 141905
-# Modify the test sequence in such a way that
-# the test does not leave the Register value altered.
-
-PUTSCOM_TESTDATA = [0,0,0,6,
- 0,0,0xA2,0x02,
- 0,0,0x0,0x00,
- 0,0x05,0x00,0x3E, #scratch reg 7 (32-bit)
- 0xde,0xca,0xff,0xee,
- 0x00,0x00,0x00,0x00 ]
-
-PUTSCOM_TESTDATA_INVALID = [0,0,0,6,
- 0,0,0xA2,0x02,
- 0,0,0x0,0x00,
- # TODO via RTC 152952: This address is invalid for
- # Nimbus but not for Cumulus
- 0x0a,0x00,0x00,0x00,
- 0xde,0xca,0xff,0xee,
- 0x00,0x00,0x00,0x00 ]
-
-PUTSCOM_EXPDATA = [0xc0,0xde,0xa2,0x02,
- 0x0,0x0,0x0,0x0,
- 0x00,0x0,0x0,0x03];
-
-PUTSCOM_EXPDATA_INVALID = [0xc0,0xde,0xa2,0x02,
- 0x0,0xfe,0x0,0x11]
-GETSCOM_TESTDATA = [0,0,0,4,
- 0,0,0xA2,0x01,
- 0,0,0x0,0x00,
- 0,0x05,0x0,0x3E]
-
-GETSCOM_TESTDATA_INVALID = [0,0,0,4,
- 0,0,0xA2,0x01,
- 0,0,0x0,0x00,
- # TODO via RTC: 152952: This address is invalid for
- # Nimbus but not for Cumulus
- 0x0a,0x0,0x0,0x0]
-
-GETSCOM_EXPDATA = [0xde,0xca,0xff,0xee,
- 0x00,0x00,0x00,0x00,
- 0xc0,0xde,0xa2,0x01,
- 0x0,0x0,0x0,0x0,
- 0x00,0x0,0x0,0x03];
-
-GETSCOM_EXPDATA_INVALID = [0xc0,0xde,0xa2,0x01,
- 0x0,0xfe,0x0,0x11]
-# MAIN Test Run Starts Here...
-#-------------------------------------------------
-def main( ):
- testUtil.runCycles( 10000000 )
- print ("\nStarting putscom test")
- testUtil.writeUsFifo( PUTSCOM_TESTDATA )
- testUtil.writeEot( )
- testUtil.readDsFifo( PUTSCOM_EXPDATA )
- testUtil.readEot( )
- print ("\nStarting invalid putscom test")
- testUtil.writeUsFifo( PUTSCOM_TESTDATA_INVALID )
- testUtil.writeEot( )
- testUtil.readDsFifo( PUTSCOM_EXPDATA_INVALID )
- testUtil.extractHWPFFDC( )
- #flush out distance
- testUtil.readDsEntryReturnVal()
- testUtil.readEot( )
- print ("\nStarting getscom test")
- testUtil.writeUsFifo( GETSCOM_TESTDATA )
- testUtil.writeEot( )
- testUtil.readDsFifo( GETSCOM_EXPDATA )
- testUtil.readEot( )
- print ("\nStarting invalid getscom test")
- testUtil.writeUsFifo( GETSCOM_TESTDATA_INVALID )
- testUtil.writeEot( )
- testUtil.readDsFifo( GETSCOM_EXPDATA_INVALID )
- testUtil.extractHWPFFDC( )
- #flush out distance
- testUtil.readDsEntryReturnVal()
- testUtil.readEot( )
-
-#-------------------------------------------------
-# Calling all test code
-#-------------------------------------------------
-main()
-
-if err:
- print ("\nTest Suite completed with error(s)")
- #sys.exit(1)
-else:
- print ("\nTest Suite completed with no errors")
- #sys.exit(0);
+import struct
+import testScomUtil
+# getscom success
+testScomUtil.getscom(0x0204001A)
+# putscom success
+testScomUtil.putscom(0x000F001A, testScomUtil.getscom(0x000F001A))
diff --git a/src/test/testcases/testPutScomUnderMask.py b/src/test/testcases/testPutScomUnderMask.py
deleted file mode 100755
index 200c57a9..00000000
--- a/src/test/testcases/testPutScomUnderMask.py
+++ /dev/null
@@ -1,99 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/test/testcases/testPutScomUnderMask.py $
-#
-# OpenPOWER sbe Project
-#
-# Contributors Listed Below - COPYRIGHT 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
-import sys
-sys.path.append("targets/p9_nimbus/sbeTest" )
-import testUtil
-err = False
-#from testWrite import *
-
-PUTSCOM_TESTDATA = [0,0,0,6,
- 0,0,0xA2,0x02,
- 0,0,0x0,0x00,
- 0,0x05,0x00,0x3E, #scratch reg 7 (32-bit)
- 0xff,0xff,0xff,0xff,
- 0x00,0x00,0x00,0x00 ]
-
-PUTSCOM_EXPDATA = [0xc0,0xde,0xa2,0x02,
- 0x0,0x0,0x0,0x0,
- 0x00,0x0,0x0,0x03];
-
-
-PUTSCOMUMASK_TESTDATA = [0,0,0,8,
- 0,0,0xA2,0x04,
- 0,0,0x0,0x00,
- 0,0x05,0x00,0x3E,
- 0xde,0xca,0xff,0xee,
- 0x00,0x00,0x00,0x00,
- 0xff,0x00,0xff,0x00,
- 0x00,0x00,0x00,0x00]
-
-
-PUTSCOMUMASK_EXPDATA = [0xc0,0xde,0xa2,0x04,
- 0x0,0x0,0x0,0x0,
- 0x00,0x0,0x0,0x03];
-
-GETSCOMUMASK_TESTDATA = [0,0,0,4,
- 0,0,0xA2,0x01,
- 0,0,0x0,0x00,
- 0,0x05,0x0,0x3E]
-
-GETSCOMUMASK_EXPDATA = [0xde, 0xff, 0xff, 0xff,
- 0x00, 0x00, 0x00, 0x00,
- 0xc0,0xde,0xa2,0x01,
- 0x0,0x0,0x0,0x0,
- 0x00,0x0,0x0,0x03];
-
-# MAIN Test Run Starts Here...
-#-------------------------------------------------
-def main( ):
- testUtil.runCycles( 10000000 )
-
- testUtil.writeUsFifo( PUTSCOM_TESTDATA )
- testUtil.writeEot( )
- testUtil.readDsFifo( PUTSCOM_EXPDATA )
- testUtil.readEot( )
-
- testUtil.writeUsFifo( PUTSCOMUMASK_TESTDATA )
- testUtil.writeEot( )
- testUtil.readDsFifo( PUTSCOMUMASK_EXPDATA )
- testUtil.readEot( )
-
- testUtil.writeUsFifo( GETSCOMUMASK_TESTDATA )
- testUtil.writeEot( )
- testUtil.readDsFifo( GETSCOMUMASK_EXPDATA )
- testUtil.readEot( )
-
-#-------------------------------------------------
-# Calling all test code
-#-------------------------------------------------
-main()
-
-if err:
- print ("\nTest Suite completed with error(s)")
- #sys.exit(1)
-else:
- print ("\nTest Suite completed with no errors")
- #sys.exit(0);
-
diff --git a/src/test/testcases/testSbeDump.py b/src/test/testcases/testSbeDump.py
index 01ae81a7..f4f472a2 100644
--- a/src/test/testcases/testSbeDump.py
+++ b/src/test/testcases/testSbeDump.py
@@ -26,6 +26,7 @@ import sys
sys.path.append("targets/p9_nimbus/sbeTest")
import testUtil
err = False
+import testScomUtil
#from testWrite import *
TESTDATA = [0, 0, 0, 2,
@@ -39,6 +40,10 @@ EXPDATA = [0xc0, 0xde, 0xa8, 0x01,
#-------------------------------------------------
def main():
testUtil.runCycles(10000000)
+
+ # Generate FSPI rc
+ testScomUtil.getscom(0x0A000000, [0x00, 0xFE, 0x00, 0x11], True)
+
testUtil.writeUsFifo(TESTDATA)
testUtil.writeEot()
diff --git a/src/test/testcases/testScom.xml b/src/test/testcases/testScom.xml
deleted file mode 100755
index 8b536031..00000000
--- a/src/test/testcases/testScom.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<!-- IBM_PROLOG_BEGIN_TAG -->
-<!-- This is an automatically generated prolog. -->
-<!-- -->
-<!-- $Source: src/test/testcases/testScom.xml $ -->
-<!-- -->
-<!-- OpenPOWER sbe Project -->
-<!-- -->
-<!-- Contributors Listed Below - COPYRIGHT 2015,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 -->
-<?xml version="1.0" encoding="UTF-8"?>
-
- <testcase>
- <simcmd>run-python-file targets/p9_nimbus/sbeTest/testPutGetScom.py</simcmd>
- <exitonerror>yes</exitonerror>
- </testcase>
- <testcase>
- <simcmd>run-python-file targets/p9_nimbus/sbeTest/testPutScomUnderMask.py</simcmd>
- <exitonerror>yes</exitonerror>
- </testcase>
- <testcase>
- <simcmd>run-python-file targets/p9_nimbus/sbeTest/testModifyScom.py</simcmd>
- <exitonerror>yes</exitonerror>
- </testcase>
- <testcase>
- <simcmd>run-python-file targets/p9_nimbus/sbeTest/testPutGetInScom.py</simcmd>
- <exitonerror>yes</exitonerror>
- </testcase>
-
diff --git a/src/test/testcases/testScomUtil.py b/src/test/testcases/testScomUtil.py
new file mode 100644
index 00000000..23b20005
--- /dev/null
+++ b/src/test/testcases/testScomUtil.py
@@ -0,0 +1,125 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/test/testcases/testScomUtil.py $
+#
+# OpenPOWER sbe Project
+#
+# Contributors Listed Below - COPYRIGHT 2017
+#
+#
+# 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
+import sys
+import os
+import struct
+sys.path.append("targets/p9_nimbus/sbeTest" )
+import testUtil
+err = False
+
+def getsingleword(dataInInt):
+ hex_string = '0'*(8-len(str(hex(dataInInt))[2:])) + str(hex(dataInInt))[2:]
+ return list(struct.unpack('<BBBB',hex_string.decode('hex')))
+def getdoubleword(dataInInt):
+ hex_string = '0'*(16-len(str(hex(dataInInt))[:18][2:])) + str(hex(dataInInt))[:18][2:]
+ return list(struct.unpack('<BBBBBBBB',hex_string.decode('hex')))
+
+def getscom(addr, expStatus = [0, 0, 0, 0], HWPffdc = False):
+ req = ([0, 0, 0, 4]
+ + [0,0,0xA2,0x01]
+ + getdoubleword(addr))
+
+ testUtil.writeUsFifo(req)
+ testUtil.writeEot( )
+
+ expData = ([0xc0,0xde,0xa2,0x01]
+ + expStatus)
+ success = False
+ if(expStatus == [0, 0, 0, 0]):
+ success = True
+
+ data = [0]*8
+ if(success):
+ data = testUtil.readDsEntryReturnVal()
+ data += testUtil.readDsEntryReturnVal()
+ testUtil.readDsFifo(expData)
+ if(not success and HWPffdc):
+ testUtil.extractHWPFFDC( )
+ #flush out distance
+ testUtil.readDsEntryReturnVal()
+ testUtil.readEot( )
+
+ val = 0
+ for i in range(0, 8):
+ val |= data[i] << ((7-i)*8)
+ return val
+
+def putscom(addr, data, expStatus = [0, 0, 0, 0]):
+ req = ([0,0,0,6,
+ 0,0,0xA2,0x02]
+ + getdoubleword(addr)
+ + getdoubleword(data))
+ testUtil.writeUsFifo(req)
+ testUtil.writeEot( )
+
+ expData = ([0xc0,0xde,0xa2,0x02]
+ + expStatus)
+
+ success = False
+ if(expStatus == [0, 0, 0, 0]):
+ success = True
+ testUtil.readDsFifo(expData)
+ #flush out distance
+ testUtil.readDsEntryReturnVal()
+ testUtil.readEot( )
+
+def putScomUnderMask(addr, data, mask, expStatus = [0, 0, 0, 0]):
+ req = ([0,0,0,8,
+ 0,0,0xA2,0x04]
+ + getdoubleword(addr)
+ + getdoubleword(data)
+ + getdoubleword(mask))
+ testUtil.writeUsFifo(req)
+ testUtil.writeEot( )
+
+ expData = ([0xc0,0xde,0xa2,0x04]
+ + expStatus)
+
+ success = False
+ if(expStatus == [0, 0, 0, 0]):
+ success = True
+ testUtil.readDsFifo(expData)
+ #flush out distance
+ testUtil.readDsEntryReturnVal()
+ testUtil.readEot( )
+
+def modifyScom(operation, addr, data, expStatus = [0, 0, 0, 0]):
+ req = ([0,0,0,7,
+ 0,0,0xA2,0x03]
+ + getsingleword(operation)
+ + getdoubleword(addr)
+ + getdoubleword(data))
+ testUtil.writeUsFifo(req)
+ testUtil.writeEot( )
+
+ expData = ([0xc0,0xde,0xa2,0x03]
+ + expStatus)
+
+ success = False
+ if(expStatus == [0, 0, 0, 0]):
+ success = True
+ testUtil.readDsFifo(expData)
+ #flush out distance
+ testUtil.readDsEntryReturnVal()
+ testUtil.readEot( )
diff --git a/src/test/testcases/testSecurity.py b/src/test/testcases/testSecurity.py
index 58c4e2d4..be352ca1 100644
--- a/src/test/testcases/testSecurity.py
+++ b/src/test/testcases/testSecurity.py
@@ -25,6 +25,7 @@
import os
import sys
import struct
+import testScomUtil
SECURITY_FILE = "../../src/import/chips/p9/security/p9_security_white_black_list.csv"
SECURITY_SCRIPT = "../../src/build/security/securityRegListGen.py"
@@ -78,11 +79,53 @@ def main():
whitelist_table1,
whitelist_table2,
whitelist_table3)
+ print "generated whitelist validation passed"
test_normal('blacklist',
blacklist,
blacklist_table1,
blacklist_table2,
blacklist_table3)
+ print "generated blacklist validation passed"
+
+ # getscom success
+ testScomUtil.getscom(0x0204001A)
+ print "getscom success testcase - passed"
+ # getscom failure
+ testScomUtil.getscom(eval(blacklist[0]), [0x00, 0x05, 0x00, 0x0B])
+ print "getscom failure testcase - passed"
+ # putscom success
+ testScomUtil.putscom(eval(whitelist[0]), testScomUtil.getscom(eval(whitelist[0])))
+ print "putscom success testcase - passed"
+ # putscom failure
+ while(True):
+ random_addr = struct.unpack('>L', os.urandom(4))[0]
+ if random_addr not in [eval(a) for a in whitelist]:
+ testScomUtil.putscom(random_addr, 0, [0x00, 0x05, 0x00, 0x0B])
+ break
+ print "putscom failure testcase - passed"
+ # modify scom success
+ dataWritten = testScomUtil.getscom(0x00040006)
+ testScomUtil.modifyScom(0x01, 0x00040006, 0x0)
+ dataRead = testScomUtil.getscom(0x00040006)
+ if(dataRead != dataWritten):
+ raise Exception('modify scom failed %x != %x' % (dataRead, dataWritten))
+ print "modify scom success testcase - passed"
+ # putscom under mask success
+ dataWritten = testScomUtil.getscom(0x00040006)
+ testScomUtil.putScomUnderMask(0x00040006, dataWritten, 0xFFFFFFFFFFFFFFFF)
+ dataRead = testScomUtil.getscom(0x00040006)
+ if(dataRead != dataWritten):
+ raise Exception('PutScom under mask failed %x != %x' % (dataRead, dataWritten))
+ print "putscom under mask success testcase - passed"
+ # indirect scom test
+ dataWritten = testScomUtil.getscom(0x8000000D06010C3F)
+ dataiActWritten = (dataWritten & 0x00000000FFFFFFFF) | (0xDECAFFEE00000000)
+ testScomUtil.putscom(0x8000000D06010C3F, dataiActWritten)
+ dataRead = testScomUtil.getscom(0x8000000D06010C3F)
+ if(dataRead != dataWritten):
+ raise Exception('indirect scom test failed %x != %x' % (dataRead, dataWritten))
+ print "Indirect scom success testcase - passed"
+
except Exception, error:
raise Exception(error)
OpenPOWER on IntegriCloud