summaryrefslogtreecommitdiffstats
path: root/sbe/test
diff options
context:
space:
mode:
authorGeorge Keishing <gkeishin@in.ibm.com>2016-03-31 02:35:28 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2016-05-12 07:06:30 -0400
commit9dbfd86625731214044f2d8869442aab90020f5e (patch)
tree0a4a71676d1061dac5cc7353d5d8b1236bab50d1 /sbe/test
parentb84d23d816652b65903c964b9612cdbed62abdd4 (diff)
downloadtalos-sbe-9dbfd86625731214044f2d8869442aab90020f5e.tar.gz
talos-sbe-9dbfd86625731214044f2d8869442aab90020f5e.zip
RTC : 150637 SBE: Python Test Framework to test Host to SBE Interface on simics
Change-Id: I33963bf6b12a4bdf9053f16219b1e2fe42859132 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/22697 Tested-by: Jenkins Server Reviewed-by: RAJA DAS <rajadas2@in.ibm.com> Reviewed-by: Shakeeb A. Pasha B K <shakeebbk@in.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'sbe/test')
-rw-r--r--sbe/test/testClass.py343
-rw-r--r--sbe/test/testClassUtil.py35
-rw-r--r--sbe/test/testExecutorMemory.py57
-rw-r--r--sbe/test/testExecutorPSU.py117
-rw-r--r--sbe/test/testExecutorPutRing.py121
-rw-r--r--sbe/test/testRegistry.py56
6 files changed, 729 insertions, 0 deletions
diff --git a/sbe/test/testClass.py b/sbe/test/testClass.py
new file mode 100644
index 00000000..bdae1df5
--- /dev/null
+++ b/sbe/test/testClass.py
@@ -0,0 +1,343 @@
+#!/usr/bin/python
+'''
+#############################################################
+# @file testClass.py
+# @author: George Keishing <gkeishin@in.ibm.com>
+# @brief Framework class Host SBE interface on simics
+#
+# Created on March 29, 2016
+# ----------------------------------------------------
+# @version Developer Date Description
+# ----------------------------------------------------
+# 1.0 gkeishin 29/03/16 Initial create
+#############################################################
+'''
+
+#-------------------------
+# Imports packages
+#-------------------------
+import time
+import conf
+import testClassUtil as util
+from sim_commands import *
+
+#-------------------------
+# Macros constants
+#-------------------------
+SUCCESS = 1
+FAILURE = 0
+
+#-------------------------
+# SIM OBJs
+#-------------------------
+'''
+This is a simulator obj mapped. Refer simics folks if new objects are needed.
+'''
+simSbeObj = conf.p9Proc0.sbe.mibo_space
+simHostObj = conf.p9Proc0.p9_mem_map.host_xscom_device_mm
+simMemObj = conf.system_cmp0.phys_mem
+
+'''
+This is a base MBOX registry address from 0..7
+'''
+# Register MBOX 0..3 SBE side address in order
+REGDATA_SBE = [
+ 0x00680500,
+ 0x00680510,
+ 0x00680520,
+ 0x00680530
+ ]
+
+# Register MBOX 4..7 host side address in order
+REGDATA_HOST = [
+ 0x00680540,
+ 0x00680550,
+ 0x00680560,
+ 0x00680570
+ ]
+
+# Supporting Class objects
+'''
+Base function members definitions for set,get,read, write and others needed.
+Keep it simple and modular so that it can be extended as a base class.
+'''
+#------------------
+# Registry class
+#------------------
+class registry(object):
+ #------------------------------
+ # Set the reg data
+ #------------------------------
+ def setRegData(self, addr, value, size):
+ self.regAddr = addr
+ self.regVal = value
+ self.regSize = size
+
+ #------------------------------
+ # Read Reg value set or updated
+ #------------------------------
+ def getRegData(self):
+ print " Addr : ",hex(self.regAddr)
+ print " Value : ",self.regVal
+ print " Size : ",self.regSize
+
+ #------------------------------
+ # Write to a Registry
+ #------------------------------
+ def writeToReg(self, objType):
+ address = self.regAddr
+ value = self.stringToByte(self.regVal)
+ size = self.regSize
+ print " WData : 0x%s -> Byte Data %s"% (self.regVal,value)
+ print " Addr :", hex(address)
+ print " Size : %s Bytes"% size
+
+ self.__write(objType,address,value,size)
+ return
+
+ #------------------------------
+ # Write to Registry 0..3 using
+ # test data directly.
+ #------------------------------
+ def writeTestData(self, data):
+ simObj = SIM_get_interface(simSbeObj, "memory_space")
+ entryCount = len(data)
+ size = 8
+ for i in range (entryCount):
+ value = stringToByte(data[i])
+ print "\n Writting ", hex(REGDATA_SBE[i])
+ print " %x %x %x %x %x %x %x %x" % (value[0],value[1],value[2],value[3],value[4],value[5],value[6],value[7])
+ simObj.write(None, REGDATA_SBE[regIndex],
+ (value[0],value[1],value[2],value[3],value[4],value[5],value[6],value[7]),
+ size)
+ return
+
+ #------------------------------
+ # Write using SIM object
+ # 4/8 Bytes data
+ #------------------------------
+ def __write(self, Targetobj, address, value, size):
+ simObj = SIM_get_interface(Targetobj, "memory_space")
+ if int(size) == 4:
+ simObj.write(None, address,
+ (value[0],value[1],value[2],value[3]),
+ size)
+ elif int(size) == 8:
+ simObj.write(None, address,
+ (value[0],value[1],value[2],value[3],value[4],value[5],value[6],value[7]),
+ size)
+ print " SIM obj: Write %s bytes [ OK ] " % size
+ return
+
+ #---------------------------
+ # Read from a Registry
+ #---------------------------
+ def readFromReg(self, objType):
+ address = self.regAddr
+ size = self.regSize
+ value = self.regVal
+ if int(value) !=0:
+ print " RData :", value
+ print " Addr :", hex(address)
+ print " Size : %s Bytes"% size
+
+ value = self.__read(objType,address,size)
+ return value
+
+ #---------------------------
+ # Read from a memomry
+ # Max Sim interface can read 8
+ # byte data at a given time
+ #---------------------------
+ def readFromMemory(self, objType, magicNum):
+ # Start addr + 8 bytes
+ address = self.regAddr
+ size = self.regSize # Max it can read is 8 Bytes
+ value = self.regVal # Max lentgth it should read
+
+ MaxAddr = address + value # This is the addres range it could read
+ print " MaxAddr Range:",hex(MaxAddr)
+ OffsetAddr = address
+ print " OffsetAddr:",hex(OffsetAddr)
+
+ print " Memory Entries to be read : %d" % (value/8)
+ print " Match Magic Number : ", magicNum
+
+ while ( OffsetAddr <= MaxAddr):
+ sim_data = self.__read(objType,OffsetAddr,size)
+ print " ", hex(OffsetAddr),self.joinListDataToHex(sim_data).upper()
+ OffsetAddr += 8
+
+ if self.validateTestMemOp(sim_data,magicNum) == True:
+ print " Test validated .. [ OK ]"
+ return SUCCESS
+
+ return FAILURE # Failed validation
+
+ #------------------------------
+ # Read using SIM Object
+ #------------------------------
+ def __read(self, Targetobj, address, size):
+ simObj = SIM_get_interface(Targetobj, "memory_space")
+ value = simObj.read(None, address, size, 0x0)
+ #print " SIM obj: Read %s bytes [ OK ] " % size
+ return value
+
+ #--------------------------------
+ # Prepare the byte data from the
+ # string and return the list set
+ #-------------------------------
+ def stringToByte(self,value):
+ '''
+ The sim interface doesnt take the values as it is ..
+ it takes as byte arrays
+ Ex: "0000030100F0D101"
+ '\x00\x00\x03\x01\x00\xf0\xd1\x01'
+ [0, 0, 3, 1, 0, 240, 209, 1]
+ '''
+ # Convert it to a hex string
+ hex_val= value.decode("hex")
+ # Prepare the conversion to a list of byte values
+ value=map(ord, hex_val)
+ return value
+
+ #---------------------------------------
+ # Joing the list set data to hex data
+ # Reverse of the stringToByte logic
+ #---------------------------------------
+ def joinListDataToHex(self, data):
+ # simics> (0, 0, 3, 1, 0, 240, 209, 1)
+ # Join this data into hex string 0xf0d101
+ bit_shift=56
+ hex_val = 0x0
+ for val in data:
+ hex_val |= int(val) << bit_shift
+ bit_shift -=8
+ return hex(hex_val)
+
+ #----------------------------------------------------
+ # Execute the read or write operation in loop as per
+ # Test data set pre-defined
+ #----------------------------------------------------
+ def ExecuteTestOp(self, testOp, test_bucket):
+ '''
+ 3 prong steps : set data, read/write data, validate
+ '''
+ #--------------------------------------------
+ for l_params in test_bucket:
+ #--------------------------------------------
+ print " Desc : %s " % l_params[5]
+ print " Op : %s " % l_params[0]
+ if "func" == l_params[0]:
+ print " Func : %s " % l_params[1]
+ if l_params[4] != "None":
+ print " Expect : %s " % l_params[4]
+ if "func" == l_params[0]:
+ print " Function Params :",l_params[2]
+ else:
+ # addr, value, size
+ self.setRegData(l_params[1],l_params[2],l_params[3])
+
+ # ---------------------------------------------
+ # Check the Op and perform the action
+ # read/write
+ # ---------------------------------------------
+ if "read" == l_params[0]:
+ sim_data = self.readFromReg(testOp)
+ print " ++++++++++++++++++++++++++++++++++++++++++"
+ print " simics Data : ", sim_data
+ print " simics Hex : ", self.joinListDataToHex(sim_data).upper()
+
+ # Validate the test data
+ '''
+ This field in the test entry holds the data
+ that needs validation against sim data.
+ '''
+ if l_params[4] != "None":
+ if self.validateTestOp(sim_data,l_params[4]) == True:
+ print " Test validated .. [ OK ]"
+ else:
+ return FAILURE # Failed validation
+ else:
+ print " ++++++++++++++++++++++++++++++++++++++++++"
+ elif "write" == l_params[0]:
+ self.writeToReg(testOp)
+ elif "memRead" == l_params[0]:
+ # (Sim obj) (Validate)
+ return self.readFromMemory(testOp, l_params[4])
+ elif "func" == l_params[0]:
+ # Func name Params
+ rc = self.loadFunc( l_params[1], l_params[2] )
+ return rc
+ else:
+ return FAILURE # Unknown entry op
+
+ print "\n"
+ return SUCCESS
+
+ #----------------------------------------------------
+ # Validate simulator data against test data
+ #----------------------------------------------------
+ def validateTestOp(self, sim_data, test_data):
+ print " Test Expects : 0x%s " % test_data
+ print " Expect bytes : ", self.stringToByte(test_data)
+ if self.compareList(self.stringToByte(test_data), sim_data, "None") == True:
+ print " Test ... [ OK ] "
+ print " ++++++++++++++++++++++++++++++++++++++++++"
+ return SUCCESS
+ else:
+ print " Test Failed... !!!"
+ print " ++++++++++++++++++++++++++++++++++++++++++"
+ return FAILURE
+
+ #----------------------------------------------------
+ # Validate simulator data against test data
+ #----------------------------------------------------
+ def validateTestMemOp(self, sim_data, test_data):
+ if self.compareList(self.stringToByte(test_data), sim_data,"memRead") == True:
+ return SUCCESS
+ return # Return nothing to check next memory entry
+
+
+ #----------------------------------------------------
+ # Compare the result vs expected list data
+ # byte by byte
+ #----------------------------------------------------
+ def compareList(self, expList, resList, opType):
+ for i in range(0,8):
+ if int(expList[i]) == int(resList[i]):
+ #print " %s : %s " % (expList[i],resList[i])
+ continue
+ else:
+ if opType != "memRead":
+ print " Error \t %s : %s [ Mismatch ]" % (expList[i],resList[i])
+ return False # mismatch
+ return # Return nothing for Next Mem byte read
+ return True
+
+ #----------------------------------------------------
+ # A basic loop wait poll mechanism
+ #----------------------------------------------------
+ def pollingOn(self, simObj, test_data, timeOut):
+ print "\n***** Polling On result for %d seconds " % timeOut
+ while True:
+ print "\n"
+ rc = self.ExecuteTestOp(simObj,test_data)
+ if rc == SUCCESS:
+ return rc
+ elif timeOut <= 0:
+ print " Timmer Expired... Exiting polling"
+ break
+ else:
+ time.sleep(5)
+ timeOut = timeOut - 5
+ return FAILURE
+
+ #----------------------------------------------------
+ # Load the function and execute
+ #----------------------------------------------------
+ def loadFunc(self, func_name, i_pArray ):
+ rc = util.__getattribute__(func_name)(i_pArray)
+ return rc # Either success or failure from func
+
+
diff --git a/sbe/test/testClassUtil.py b/sbe/test/testClassUtil.py
new file mode 100644
index 00000000..48e79b80
--- /dev/null
+++ b/sbe/test/testClassUtil.py
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+'''
+#############################################################
+# @file testClassUtil.py
+# @author: George Keishing <gkeishin@in.ibm.com>
+# @brief Framework utility fucntions for Host SBE
+# interface on simics
+#
+# Created on March 29, 2016
+# ----------------------------------------------------
+# @version Developer Date Description
+# ----------------------------------------------------
+# 1.0 gkeishin 29/03/16 Initial create
+#############################################################
+'''
+
+import testClass as testClass
+
+'''
+Add your personalize functions here for execution but ensure it returns
+either SUCCESS or FAILURE as an end result for generalization purpose.
+'''
+
+##########################################################################
+# Function : classUtilFuncSample
+#
+# @param i_paramArray : user supplied input array parameters
+#
+# @brief Function to do a task and returns SUCCCES or FAILURE
+#
+##########################################################################
+def classUtilFuncSample(i_paramArray):
+ for input in i_paramArray:
+ print " classUtilFuncSample : parm: ",input
+ return testClass.SUCCESS
diff --git a/sbe/test/testExecutorMemory.py b/sbe/test/testExecutorMemory.py
new file mode 100644
index 00000000..5bb4416a
--- /dev/null
+++ b/sbe/test/testExecutorMemory.py
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+'''
+#############################################################
+# @file testExecutor.py
+# @author: George Keishing <gkeishin@in.ibm.com>
+# @brief Framework to test Host SBE interface on simics
+#
+# Created on March 29, 2016
+# ----------------------------------------------------
+# @version Developer Date Description
+# ----------------------------------------------------
+# 1.0 gkeishin 29/03/16 Initial create
+#############################################################
+'''
+
+import testClass as testObj
+import testRegistry as reg
+
+#-------------------------------
+# This is a Test Expected Data
+#-------------------------------
+'''
+This data are the values or strings that needs to be validated for the test.
+'''
+SBE_TEST_EXPECT_DEFAULT = "None"
+
+HOST_TEST_EXPECT_MAGIC = "00000000DEADBEEF"
+
+sbe_test_data = (
+ #-----------------------------------------------------------------------------------------------------
+ # OP Reg Mem Length (bytes) size Test Expected Data Description
+ #-----------------------------------------------------------------------------------------------------
+ #["memRead", reg.MEM_ADDR, 0xA00000, 8, HOST_TEST_EXPECT_MAGIC, "Reading data from the address"],
+ ["memRead", reg.MEM_ADDR, 0x50, 8, HOST_TEST_EXPECT_MAGIC, "Reading data from the address"],
+ )
+
+#-------------------------
+# Main Function
+#-------------------------
+def main():
+
+ # Intialize the class obj instances
+ print "\n Initializing Registry instances ...."
+ regObj = testObj.registry() # Registry obj def for operation
+
+ print "\n Execute SBE Test set [ Indirect Commands ] ...\n"
+ # Sim obj Target Test set
+ rc_test = regObj.ExecuteTestOp(testObj.simMemObj,sbe_test_data)
+ if rc_test != testObj.SUCCESS:
+ print " SBE Test data set .. [ FAILED ] .."
+ else:
+ print " SBE Test data set .. [ SUCCESS ] "
+ print "\n"
+
+if __name__=="__main__":
+ main()
+
diff --git a/sbe/test/testExecutorPSU.py b/sbe/test/testExecutorPSU.py
new file mode 100644
index 00000000..20314792
--- /dev/null
+++ b/sbe/test/testExecutorPSU.py
@@ -0,0 +1,117 @@
+#!/usr/bin/python
+'''
+#############################################################
+# @file testExecutor.py
+# @author: George Keishing <gkeishin@in.ibm.com>
+# @brief Framework to test Host SBE interface on simics
+#
+# Created on March 29, 2016
+# ----------------------------------------------------
+# @version Developer Date Description
+# ----------------------------------------------------
+# 1.0 gkeishin 29/03/16 Initial create
+#############################################################
+'''
+
+import testClass as testObj
+import testRegistry as reg
+
+#-------------------------------
+# This is a Test Expected Data
+#-------------------------------
+'''
+This data are the values or strings that needs to be validated for the test.
+'''
+SBE_TEST_EXPECT_DEFAULT = "None"
+
+HOST_TEST_EXPECT_DEFAULT = "None"
+HOST_TEST_EXPECT_MBOX04 = "0000000000F0D101"
+
+'''
+The test data is designed to accomodate as many as new entries a test needs
+and can also increase the field in it to add new action associated with it.
+'''
+#---------------------
+# SBE side test data
+#---------------------
+'''
+Every test data entry itself represent an action associated with it's data.
+The data is validated as it executes.
+
+The Test Expected Data if "None" signifies that this test entry is not to be
+validated else it would validated against the expected value in the field.
+On success returns macro SUCCESS else FAILURE
+
+Refer Documentation for the data used here directly.
+'''
+
+sbe_test_data = (
+ #-----------------------------------------------------------------------------------------------------
+ # OP Reg Value size Test Expected Data Description
+ #-----------------------------------------------------------------------------------------------------
+ ["write", reg.REG_MBOX0, "0000030100F0D101", 8, SBE_TEST_EXPECT_DEFAULT, "Writing to MBOX0 address"],
+ ["write", reg.REG_MBOX1, "0000000000001000", 8, SBE_TEST_EXPECT_DEFAULT, "Writing to MBOX1 address"],
+ ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, SBE_TEST_EXPECT_DEFAULT, "Update SBE Doorbell register to interrupt SBE"],
+ )
+
+#---------------------
+# Host side test data
+#---------------------
+'''
+This Host data indicates that this will validate the SBE test set execution
+if the overall test is a success or failure.
+
+It can have as many entries which are needed to be validated.
+'''
+host_test_data = (
+ #----------------------------------------------------------------------------------------------------------------
+ # OP Reg Value size Test Expected Data Description
+ #----------------------------------------------------------------------------------------------------------------
+ ["read", reg.REG_MBOX4, "0000000000000000", 8, HOST_TEST_EXPECT_MBOX04, "Reading Host MBOX4 data to Validate"],
+ )
+
+'''
+User can define a function which does some task and returns SUCCESS or FAILURE.
+one can simply call that function like any OP in the test data and still work.
+
+Define those function in testClassUtil.py context for this to work.
+'''
+
+SAMPLE_TEST_EXPECT_FUNC = "None"
+PARM_DATA = [1, 2, 3, 4] # sample 4 input paramters
+sample_test_data = (
+ #----------------------------------------------------------------------------------------------------------------
+ # OP function Name Parameters NA Test Expected Data Description
+ #----------------------------------------------------------------------------------------------------------------
+ ["func", "classUtilFuncSample", PARM_DATA, 0, SAMPLE_TEST_EXPECT_FUNC, "Load func and do task"],
+ )
+
+#-------------------------
+# Main Function
+#-------------------------
+def main():
+
+ # Intialize the class obj instances
+ print "\n Initializing Registry instances ...."
+ regObj = testObj.registry() # Registry obj def for operation
+
+ print "\n Execute SBE Test set [ PSU ] ...\n"
+ # Sim obj Target Test set
+ rc_test = regObj.ExecuteTestOp(testObj.simSbeObj,sbe_test_data)
+ if rc_test != testObj.SUCCESS:
+ print " SBE Test data set .. [ Failed ] .."
+ else:
+ print " SBE Test data set .. [ OK ] "
+ print "\n Poll on Host side for INTR ...\n"
+ # Sim obj Target Test set Max timedout
+ rc_intr = regObj.pollingOn(testObj.simSbeObj,host_test_data,20)
+ if rc_intr == testObj.SUCCESS:
+ print " Interrupt Event Recieved .. Success !!"
+ else:
+ print " Interrupt not Recieved.. Exiting .."
+
+ print "\n"
+
+if __name__=="__main__":
+ main()
+
diff --git a/sbe/test/testExecutorPutRing.py b/sbe/test/testExecutorPutRing.py
new file mode 100644
index 00000000..856c804a
--- /dev/null
+++ b/sbe/test/testExecutorPutRing.py
@@ -0,0 +1,121 @@
+#!/usr/bin/python
+'''
+#############################################################
+# @file testExecutor.py
+# @author: George Keishing <gkeishin@in.ibm.com>
+# @brief Framework to test Host SBE interface on simics
+#
+# Created on March 29, 2016
+# ----------------------------------------------------
+# @version Developer Date Description
+# ----------------------------------------------------
+# 1.0 gkeishin 29/03/16 Initial create
+#############################################################
+'''
+
+import testClass as testObj
+import testRegistry as reg
+
+#-------------------------------
+# This is a Test Expected Data
+#-------------------------------
+'''
+This data are the values or strings that needs to be validated for the test.
+'''
+SBE_TEST_EXPECT_DEFAULT = "None"
+SBE_TEST_EXPECT_MBOX0 = "0000030100F0D101"
+SBE_TEST_EXPECT_DOORBELL = "8000000000000000"
+
+HOST_TEST_EXPECT_DEFAULT = "None"
+HOST_TEST_EXPECT_MBOX04 = "0000000000F0D301"
+HOST_TEST_EXPECT_DOORBELL= "2000000000000000"
+
+'''
+The test data is designed to accomodate as many as new entries a test needs
+and can also increase the field in it to add new action associated with it.
+'''
+#---------------------
+# SBE side test data
+#---------------------
+'''
+Every test data entry itself represent an action associated with it's data.
+The data is validated as it executes.
+
+The Test Expected Data if "None" signifies that this test entry is not to be
+validated else it would validated against the expected value in the field.
+On success returns macro SUCCESS else FAILURE
+
+Refer Documentation for the data used here directly.
+'''
+
+sbe_test_data = (
+ #-----------------------------------------------------------------------------------------------------
+ # OP Reg Value size Test Expected Data Description
+ #-----------------------------------------------------------------------------------------------------
+ ["write", reg.REG_MBOX0, "0000010000F0D301", 8, SBE_TEST_EXPECT_DEFAULT, "Writing to MBOX0 address"],
+ ["write", reg.REG_MBOX0, "123456789ABCDEF0", 8, SBE_TEST_EXPECT_DEFAULT, "Writing to MBOX1 address"],
+ ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, SBE_TEST_EXPECT_DEFAULT, "Update SBE Doorbell register to interrupt SBE"],
+ )
+
+#---------------------
+# Host side test data
+#---------------------
+'''
+This Host data indicates that this will validate the SBE test set execution
+if the overall test is a success or failure.
+
+It can have as many entries which are needed to be validated.
+'''
+host_test_data = (
+ #----------------------------------------------------------------------------------------------------------------
+ # OP Reg Value size Test Expected Data Description
+ #----------------------------------------------------------------------------------------------------------------
+ ["read", reg.PSU_HOST_DOORBELL_REG_WO_OR, "0000000000000000", 8, HOST_TEST_EXPECT_DOORBELL, "Reading Host Doorbell for Interrupt"],
+ ["read", reg.REG_MBOX4, "0000000000000000", 8, HOST_TEST_EXPECT_MBOX04, "Reading Host MBOX4 data to Validate"],
+ )
+
+'''
+User can define a function which does some task and returns SUCCESS or FAILURE.
+one can simply call that function like any OP in the test data and still work.
+
+Define those function in testClassUtil.py context for this to work.
+'''
+
+SAMPLE_TEST_EXPECT_FUNC = "None"
+PARM_DATA = [1, 2, 3, 4] # sample 4 input paramters
+sample_test_data = (
+ #----------------------------------------------------------------------------------------------------------------
+ # OP function Name Parameters NA Test Expected Data Description
+ #----------------------------------------------------------------------------------------------------------------
+ ["func", "classUtilFuncSample", PARM_DATA, 0, SAMPLE_TEST_EXPECT_FUNC, "Load func and do task"],
+ )
+
+#-------------------------
+# Main Function
+#-------------------------
+def main():
+
+ # Intialize the class obj instances
+ print "\n Initializing Registry instances ...."
+ regObj = testObj.registry() # Registry obj def for operation
+
+ print "\n Execute SBE Test set [ Put Ring ] ...\n"
+ # Sim obj Target Test set
+ rc_test = regObj.ExecuteTestOp(testObj.simSbeObj,sbe_test_data)
+ if rc_test != testObj.SUCCESS:
+ print " SBE Test data set .. [ Failed ] .."
+ else:
+ print " SBE Test data set .. [ OK ] "
+ print "\n Poll on Host side for INTR ...\n"
+ # Sim obj Target Test set Max timedout
+ rc_intr = regObj.pollingOn(testObj.simSbeObj,host_test_data,20)
+ if rc_intr == testObj.SUCCESS:
+ print " Interrupt Event Recieved .. Success !!"
+ else:
+ print " Interrupt not Recieved.. Exiting .."
+
+ print "\n"
+
+if __name__=="__main__":
+ main()
+
diff --git a/sbe/test/testRegistry.py b/sbe/test/testRegistry.py
new file mode 100644
index 00000000..b6119583
--- /dev/null
+++ b/sbe/test/testRegistry.py
@@ -0,0 +1,56 @@
+#!/usr/bin/python
+'''
+#############################################################
+# @file testClass.py
+# @author: George Keishing <gkeishin@in.ibm.com>
+# @brief Framework class Host SBE interface on simics
+#
+# Created on March 29, 2016
+# ----------------------------------------------------
+# @version Developer Date Description
+# ----------------------------------------------------
+# 1.0 gkeishin 29/03/16 Initial create
+#############################################################
+'''
+
+# Test OP keywords for reference
+'''
+ - read : Read from a Registry
+ - write : write to a Registry
+ - memRead : Read from a memory address block
+'''
+
+# Registry address for direct usage
+REG_MBOX0 = 0x00680500
+REG_MBOX1 = 0x00680510
+REG_MBOX2 = 0x00680520
+REG_MBOX3 = 0x00680530
+REG_MBOX4 = 0x00680540
+REG_MBOX5 = 0x00680550
+REG_MBOX6 = 0x00680560
+REG_MBOX7 = 0x00680570
+
+# PSU doorbell regs
+PSU_SBE_DOORBELL_REG = 0x00680600
+PSU_SBE_DOORBELL_REG_WO_AND = 0x00680610
+PSU_SBE_DOORBELL_REG_WO_OR = 0x00680620
+
+PSU_HOST_DOORBELL_REG = 0x00680630
+PSU_HOST_DOORBELL_REG_WO_AND = 0x00680640
+PSU_HOST_DOORBELL_REG_WO_OR = 0x00680650
+
+
+# Memory space address
+'''
+simics> system_cmp0.phys_mem.map
+ Base Object Fn Offset Length
+-------------------------------------------------------------------------
+0x0000008000000 p9Proc0.l3_cache_ram 0 0x0 0xa00000
+ width 8192 bytes
+0x6030000000000 p9Proc0.lpcm 0 0x6030000000000 0xffffffff
+ width 4 bytes
+0x603fc00000000 proc_p9chip0.mc_freeze 0 0x0 0x400000000
+ target -> proc_p9chip0.xscom_memspc, width 8 bytes
+
+'''
+MEM_ADDR = 0x0000008000000
OpenPOWER on IntegriCloud