From 1008ef70a71fcfdec398ff30923d5025991c85f4 Mon Sep 17 00:00:00 2001 From: Shakeeb Date: Wed, 31 Aug 2016 15:15:19 -0500 Subject: SBE code restructure: cleanup Change-Id: I354cc79ba25b843fdb1a7524a19b8d0c41bd9051 RTC:159709 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/29060 Tested-by: Jenkins Server Reviewed-by: Sachin Gupta Reviewed-by: AMIT J. TENDOLKAR --- env.bash | 2 +- sb | 2 +- src/build/Makefile | 89 +- src/build/base_ppe_header.S | 209 ---- src/build/base_sbe_fixed.S | 67 -- src/build/buildInfo.py | 3 +- src/build/img_defs.mk | 20 +- src/build/linkerscripts/linkloader.cmd | 3 +- src/build/linkerscripts/linksbe.cmd | 3 +- src/build/linkerscripts/linkseeprom.cmd | 3 +- src/build/p9_sbe.H | 52 - src/build/parsAndCutElf.py | 6 +- src/build/proc_sbe_fixed.H | 211 ---- src/build/sbe_common.H | 600 ----------- src/build/sbe_link.H | 102 -- src/build/topfiles.mk | 3 +- src/build/utils/Makefile | 43 + src/build/utils/base_ppe_header.S | 209 ++++ src/build/utils/base_sbe_fixed.S | 67 ++ src/build/utils/p9_sbe.H | 52 + src/build/utils/proc_sbe_fixed.H | 211 ++++ src/build/utils/sbe_common.H | 600 +++++++++++ src/build/utils/sbe_link.H | 102 ++ src/build/utils/utils.mk | 27 + src/test/citest/autocitest | 96 -- src/test/citest/build-script | 72 -- src/test/citest/check-copyright | 30 - src/test/citest/copyright-check.sh | 56 -- src/test/citest/create-sandbox | 73 -- src/test/citest/etc/patches/chip.act.patch | 146 --- src/test/citest/etc/patches/patchlist.txt | 14 - src/test/citest/etc/patches/pervasive.act.patch | 28 - src/test/citest/etc/patches/powermgmt.act.patch | 1057 -------------------- .../citest/etc/patches/standalone.simics.patch | 4 - src/test/citest/etc/workarounds.postsimsetup | 43 - src/test/citest/etc/workarounds.presimsetup | 31 - src/test/citest/populate-sandbox | 61 -- src/test/citest/sbetest-start.sh | 38 - src/test/citest/setup-env | 84 -- src/test/ffdc.xml | 41 - src/test/framework/autocitest | 96 ++ src/test/framework/build-script | 72 ++ src/test/framework/check-copyright | 30 + src/test/framework/copyright-check.sh | 56 ++ src/test/framework/create-sandbox | 73 ++ src/test/framework/etc/patches/chip.act.patch | 146 +++ src/test/framework/etc/patches/patchlist.txt | 14 + src/test/framework/etc/patches/pervasive.act.patch | 28 + src/test/framework/etc/patches/powermgmt.act.patch | 1057 ++++++++++++++++++++ .../framework/etc/patches/standalone.simics.patch | 4 + src/test/framework/etc/workarounds.postsimsetup | 44 + src/test/framework/etc/workarounds.presimsetup | 31 + src/test/framework/populate-sandbox | 60 ++ src/test/framework/sbetest-start.sh | 38 + src/test/framework/setup-env | 84 ++ src/test/test.xml | 49 - src/test/testAbort.py | 57 -- src/test/testAduMem.xml | 42 - src/test/testAduMem_ecc.py | 68 -- src/test/testAduMem_itag.py | 66 -- src/test/testAduMem_noEccNoItag.py | 99 -- src/test/testAduMem_withEccItag.py | 66 -- src/test/testAduMem_withEccWithItagReadWrite.py | 96 -- src/test/testCntlInstruction.py | 473 --------- src/test/testCntlInstruction.xml | 30 - src/test/testContinueMpipl.py | 57 -- src/test/testContinueSbeBoot.py | 57 -- src/test/testEnterMpipl.py | 57 -- src/test/testExecutorMemory.py | 80 -- src/test/testExecutorPSU.py | 140 --- src/test/testExecutorPutRing.py | 225 ----- src/test/testExecutorPutRing.xml | 30 - src/test/testFifoReset.py | 80 -- src/test/testFifoReset.xml | 35 - src/test/testGeneric.xml | 30 - src/test/testGetCapabilities.py | 82 -- src/test/testGetMem.py | 74 -- src/test/testGetMem_expdata.py | 83 -- src/test/testGetRing.py | 95 -- src/test/testGetRing.xml | 29 - src/test/testIstep.xml | 332 ------ src/test/testIstepAuto.py | 54 - src/test/testIstepInvalid.py | 57 -- src/test/testIstepInvalidFenced.py | 57 -- src/test/testIstepSuccess.py | 57 -- src/test/testModifyScom.py | 97 -- src/test/testPSUUserUtil.py | 58 -- src/test/testPSUUtil.py | 376 ------- src/test/testPutGetInScom.py | 82 -- src/test/testPutGetMem.xml | 34 - src/test/testPutGetRegFpr.py | 81 -- src/test/testPutGetRegGpr.py | 81 -- src/test/testPutGetRegSpr.py | 81 -- src/test/testPutGetScom.py | 118 --- src/test/testPutMem.py | 83 -- src/test/testPutMem_fail.py | 84 -- src/test/testPutScomUnderMask.py | 98 -- src/test/testRegAccess.xml | 46 - src/test/testRegistry.py | 79 -- src/test/testSbeDump.py | 110 -- src/test/testScom.xml | 42 - src/test/testSram.py | 129 --- src/test/testSram.xml | 31 - src/test/testStartInstruction.py | 64 -- src/test/testStopInstruction.py | 64 -- src/test/testUtil.py | 170 ---- src/test/testcases/ffdc.xml | 41 + src/test/testcases/test.xml | 49 + src/test/testcases/testAbort.py | 57 ++ src/test/testcases/testAduMem.xml | 42 + src/test/testcases/testAduMem_ecc.py | 68 ++ src/test/testcases/testAduMem_itag.py | 66 ++ src/test/testcases/testAduMem_noEccNoItag.py | 99 ++ src/test/testcases/testAduMem_withEccItag.py | 66 ++ .../testAduMem_withEccWithItagReadWrite.py | 96 ++ src/test/testcases/testCntlInstruction.py | 473 +++++++++ src/test/testcases/testCntlInstruction.xml | 30 + src/test/testcases/testContinueMpipl.py | 57 ++ src/test/testcases/testContinueSbeBoot.py | 57 ++ src/test/testcases/testEnterMpipl.py | 57 ++ src/test/testcases/testExecutorMemory.py | 80 ++ src/test/testcases/testExecutorPSU.py | 140 +++ src/test/testcases/testExecutorPutRing.py | 225 +++++ src/test/testcases/testExecutorPutRing.xml | 30 + src/test/testcases/testFifoReset.py | 80 ++ src/test/testcases/testFifoReset.xml | 35 + src/test/testcases/testGeneric.xml | 30 + src/test/testcases/testGetCapabilities.py | 82 ++ src/test/testcases/testGetMem.py | 74 ++ src/test/testcases/testGetMem_expdata.py | 83 ++ src/test/testcases/testGetRing.py | 95 ++ src/test/testcases/testGetRing.xml | 29 + src/test/testcases/testIstep.xml | 332 ++++++ src/test/testcases/testIstepAuto.py | 54 + src/test/testcases/testIstepInvalid.py | 57 ++ src/test/testcases/testIstepInvalidFenced.py | 57 ++ src/test/testcases/testIstepSuccess.py | 57 ++ src/test/testcases/testModifyScom.py | 97 ++ src/test/testcases/testPSUUserUtil.py | 58 ++ src/test/testcases/testPSUUtil.py | 376 +++++++ src/test/testcases/testPutGetInScom.py | 82 ++ src/test/testcases/testPutGetMem.xml | 34 + src/test/testcases/testPutGetRegFpr.py | 81 ++ src/test/testcases/testPutGetRegGpr.py | 81 ++ src/test/testcases/testPutGetRegSpr.py | 81 ++ src/test/testcases/testPutGetScom.py | 118 +++ src/test/testcases/testPutMem.py | 83 ++ src/test/testcases/testPutMem_fail.py | 84 ++ src/test/testcases/testPutScomUnderMask.py | 98 ++ src/test/testcases/testRegAccess.xml | 46 + src/test/testcases/testRegistry.py | 79 ++ src/test/testcases/testSbeDump.py | 110 ++ src/test/testcases/testScom.xml | 42 + src/test/testcases/testSram.py | 129 +++ src/test/testcases/testSram.xml | 31 + src/test/testcases/testStartInstruction.py | 64 ++ src/test/testcases/testStopInstruction.py | 64 ++ src/test/testcases/testUtil.py | 170 ++++ src/tools/debug/hw-debug-framework.py | 136 +++ src/tools/debug/sbe-debug.py | 136 --- src/tools/debug/simics-debug-framework.py | 88 ++ src/tools/debug/simics/sbe_standalone.simics | 2 - src/tools/debug/simics/simics-debug-framework.py | 88 -- src/tools/image/Makefile | 24 +- src/tools/ppetracepp/Makefile | 37 - src/tools/ppetracepp/cmvc/makefile | 28 - src/tools/ppetracepp/jhash.h | 166 --- src/tools/ppetracepp/ppe2fsp.c | 532 ---------- src/tools/ppetracepp/ppe2fsp.h | 33 - src/tools/ppetracepp/ppe2fsp_cmd.c | 138 --- src/tools/ppetracepp/ppetracepp.C | 949 ------------------ src/tools/ppetracepp/trac_interface.h | 369 ------- src/tools/ppetracepp/tracehash.pl | 896 ----------------- src/tools/scripts/ppeSetFixed.pl | 3 +- src/tools/trace/Makefile | 37 + src/tools/trace/cmvc/makefile | 28 + src/tools/trace/jhash.h | 166 +++ src/tools/trace/ppe2fsp.c | 532 ++++++++++ src/tools/trace/ppe2fsp.h | 33 + src/tools/trace/ppe2fsp_cmd.c | 138 +++ src/tools/trace/ppetracepp.C | 949 ++++++++++++++++++ src/tools/trace/trac_interface.h | 369 +++++++ src/tools/trace/tracehash.pl | 896 +++++++++++++++++ src/tools/utils/modules/gitUtil.pm | 592 +++++++++++ src/tools/utils/perl.modules/gitUtil.pm | 592 ----------- src/tools/utils/sbeGitTool.pl | 3 +- 186 files changed, 12007 insertions(+), 11917 deletions(-) delete mode 100644 src/build/base_ppe_header.S delete mode 100644 src/build/base_sbe_fixed.S delete mode 100644 src/build/p9_sbe.H delete mode 100644 src/build/proc_sbe_fixed.H delete mode 100644 src/build/sbe_common.H delete mode 100644 src/build/sbe_link.H create mode 100644 src/build/utils/Makefile create mode 100644 src/build/utils/base_ppe_header.S create mode 100644 src/build/utils/base_sbe_fixed.S create mode 100644 src/build/utils/p9_sbe.H create mode 100644 src/build/utils/proc_sbe_fixed.H create mode 100644 src/build/utils/sbe_common.H create mode 100644 src/build/utils/sbe_link.H create mode 100644 src/build/utils/utils.mk delete mode 100755 src/test/citest/autocitest delete mode 100755 src/test/citest/build-script delete mode 100755 src/test/citest/check-copyright delete mode 100755 src/test/citest/copyright-check.sh delete mode 100755 src/test/citest/create-sandbox delete mode 100644 src/test/citest/etc/patches/chip.act.patch delete mode 100644 src/test/citest/etc/patches/patchlist.txt delete mode 100644 src/test/citest/etc/patches/pervasive.act.patch delete mode 100644 src/test/citest/etc/patches/powermgmt.act.patch delete mode 100644 src/test/citest/etc/patches/standalone.simics.patch delete mode 100755 src/test/citest/etc/workarounds.postsimsetup delete mode 100755 src/test/citest/etc/workarounds.presimsetup delete mode 100755 src/test/citest/populate-sandbox delete mode 100755 src/test/citest/sbetest-start.sh delete mode 100755 src/test/citest/setup-env delete mode 100755 src/test/ffdc.xml create mode 100755 src/test/framework/autocitest create mode 100755 src/test/framework/build-script create mode 100755 src/test/framework/check-copyright create mode 100755 src/test/framework/copyright-check.sh create mode 100755 src/test/framework/create-sandbox create mode 100644 src/test/framework/etc/patches/chip.act.patch create mode 100644 src/test/framework/etc/patches/patchlist.txt create mode 100644 src/test/framework/etc/patches/pervasive.act.patch create mode 100644 src/test/framework/etc/patches/powermgmt.act.patch create mode 100644 src/test/framework/etc/patches/standalone.simics.patch create mode 100755 src/test/framework/etc/workarounds.postsimsetup create mode 100755 src/test/framework/etc/workarounds.presimsetup create mode 100755 src/test/framework/populate-sandbox create mode 100755 src/test/framework/sbetest-start.sh create mode 100755 src/test/framework/setup-env delete mode 100755 src/test/test.xml delete mode 100755 src/test/testAbort.py delete mode 100644 src/test/testAduMem.xml delete mode 100644 src/test/testAduMem_ecc.py delete mode 100644 src/test/testAduMem_itag.py delete mode 100644 src/test/testAduMem_noEccNoItag.py delete mode 100644 src/test/testAduMem_withEccItag.py delete mode 100644 src/test/testAduMem_withEccWithItagReadWrite.py delete mode 100644 src/test/testCntlInstruction.py delete mode 100755 src/test/testCntlInstruction.xml delete mode 100755 src/test/testContinueMpipl.py delete mode 100755 src/test/testContinueSbeBoot.py delete mode 100755 src/test/testEnterMpipl.py delete mode 100644 src/test/testExecutorMemory.py delete mode 100644 src/test/testExecutorPSU.py delete mode 100644 src/test/testExecutorPutRing.py delete mode 100755 src/test/testExecutorPutRing.xml delete mode 100644 src/test/testFifoReset.py delete mode 100644 src/test/testFifoReset.xml delete mode 100755 src/test/testGeneric.xml delete mode 100755 src/test/testGetCapabilities.py delete mode 100644 src/test/testGetMem.py delete mode 100644 src/test/testGetMem_expdata.py delete mode 100644 src/test/testGetRing.py delete mode 100755 src/test/testGetRing.xml delete mode 100644 src/test/testIstep.xml delete mode 100755 src/test/testIstepAuto.py delete mode 100755 src/test/testIstepInvalid.py delete mode 100755 src/test/testIstepInvalidFenced.py delete mode 100755 src/test/testIstepSuccess.py delete mode 100755 src/test/testModifyScom.py delete mode 100644 src/test/testPSUUserUtil.py delete mode 100644 src/test/testPSUUtil.py delete mode 100755 src/test/testPutGetInScom.py delete mode 100644 src/test/testPutGetMem.xml delete mode 100755 src/test/testPutGetRegFpr.py delete mode 100755 src/test/testPutGetRegGpr.py delete mode 100755 src/test/testPutGetRegSpr.py delete mode 100755 src/test/testPutGetScom.py delete mode 100644 src/test/testPutMem.py delete mode 100644 src/test/testPutMem_fail.py delete mode 100755 src/test/testPutScomUnderMask.py delete mode 100755 src/test/testRegAccess.xml delete mode 100644 src/test/testRegistry.py delete mode 100644 src/test/testSbeDump.py delete mode 100755 src/test/testScom.xml delete mode 100644 src/test/testSram.py delete mode 100755 src/test/testSram.xml delete mode 100644 src/test/testStartInstruction.py delete mode 100644 src/test/testStopInstruction.py delete mode 100644 src/test/testUtil.py create mode 100755 src/test/testcases/ffdc.xml create mode 100755 src/test/testcases/test.xml create mode 100755 src/test/testcases/testAbort.py create mode 100644 src/test/testcases/testAduMem.xml create mode 100644 src/test/testcases/testAduMem_ecc.py create mode 100644 src/test/testcases/testAduMem_itag.py create mode 100644 src/test/testcases/testAduMem_noEccNoItag.py create mode 100644 src/test/testcases/testAduMem_withEccItag.py create mode 100644 src/test/testcases/testAduMem_withEccWithItagReadWrite.py create mode 100644 src/test/testcases/testCntlInstruction.py create mode 100755 src/test/testcases/testCntlInstruction.xml create mode 100755 src/test/testcases/testContinueMpipl.py create mode 100755 src/test/testcases/testContinueSbeBoot.py create mode 100755 src/test/testcases/testEnterMpipl.py create mode 100644 src/test/testcases/testExecutorMemory.py create mode 100644 src/test/testcases/testExecutorPSU.py create mode 100644 src/test/testcases/testExecutorPutRing.py create mode 100755 src/test/testcases/testExecutorPutRing.xml create mode 100644 src/test/testcases/testFifoReset.py create mode 100644 src/test/testcases/testFifoReset.xml create mode 100755 src/test/testcases/testGeneric.xml create mode 100755 src/test/testcases/testGetCapabilities.py create mode 100644 src/test/testcases/testGetMem.py create mode 100644 src/test/testcases/testGetMem_expdata.py create mode 100644 src/test/testcases/testGetRing.py create mode 100755 src/test/testcases/testGetRing.xml create mode 100644 src/test/testcases/testIstep.xml create mode 100755 src/test/testcases/testIstepAuto.py create mode 100755 src/test/testcases/testIstepInvalid.py create mode 100755 src/test/testcases/testIstepInvalidFenced.py create mode 100755 src/test/testcases/testIstepSuccess.py create mode 100755 src/test/testcases/testModifyScom.py create mode 100644 src/test/testcases/testPSUUserUtil.py create mode 100644 src/test/testcases/testPSUUtil.py create mode 100755 src/test/testcases/testPutGetInScom.py create mode 100644 src/test/testcases/testPutGetMem.xml create mode 100755 src/test/testcases/testPutGetRegFpr.py create mode 100755 src/test/testcases/testPutGetRegGpr.py create mode 100755 src/test/testcases/testPutGetRegSpr.py create mode 100755 src/test/testcases/testPutGetScom.py create mode 100644 src/test/testcases/testPutMem.py create mode 100644 src/test/testcases/testPutMem_fail.py create mode 100755 src/test/testcases/testPutScomUnderMask.py create mode 100755 src/test/testcases/testRegAccess.xml create mode 100644 src/test/testcases/testRegistry.py create mode 100644 src/test/testcases/testSbeDump.py create mode 100755 src/test/testcases/testScom.xml create mode 100644 src/test/testcases/testSram.py create mode 100755 src/test/testcases/testSram.xml create mode 100644 src/test/testcases/testStartInstruction.py create mode 100644 src/test/testcases/testStopInstruction.py create mode 100644 src/test/testcases/testUtil.py create mode 100755 src/tools/debug/hw-debug-framework.py delete mode 100755 src/tools/debug/sbe-debug.py create mode 100755 src/tools/debug/simics-debug-framework.py delete mode 100755 src/tools/debug/simics/sbe_standalone.simics delete mode 100755 src/tools/debug/simics/simics-debug-framework.py delete mode 100644 src/tools/ppetracepp/Makefile delete mode 100644 src/tools/ppetracepp/cmvc/makefile delete mode 100755 src/tools/ppetracepp/jhash.h delete mode 100755 src/tools/ppetracepp/ppe2fsp.c delete mode 100644 src/tools/ppetracepp/ppe2fsp.h delete mode 100644 src/tools/ppetracepp/ppe2fsp_cmd.c delete mode 100755 src/tools/ppetracepp/ppetracepp.C delete mode 100755 src/tools/ppetracepp/trac_interface.h delete mode 100755 src/tools/ppetracepp/tracehash.pl create mode 100644 src/tools/trace/Makefile create mode 100644 src/tools/trace/cmvc/makefile create mode 100755 src/tools/trace/jhash.h create mode 100755 src/tools/trace/ppe2fsp.c create mode 100644 src/tools/trace/ppe2fsp.h create mode 100644 src/tools/trace/ppe2fsp_cmd.c create mode 100755 src/tools/trace/ppetracepp.C create mode 100755 src/tools/trace/trac_interface.h create mode 100755 src/tools/trace/tracehash.pl create mode 100644 src/tools/utils/modules/gitUtil.pm delete mode 100644 src/tools/utils/perl.modules/gitUtil.pm diff --git a/env.bash b/env.bash index e43bc8b2..baf3a2ca 100755 --- a/env.bash +++ b/env.bash @@ -30,7 +30,7 @@ if [ -e ./customrc ]; then fi export PATH=${PATH}:${SBEROOT}/import/chips/p9/xip/bin/ -export PATH=${PATH}:${SBEROOT}/src/tools/ppetracepp/ +export PATH=${PATH}:${SBEROOT}/src/tools/trace/ if [ -n "${SANDBOXROOT}" ]; then if [ -n "${SANDBOXNAME}" ]; then diff --git a/sb b/sb index a8a9bdfb..5dda9b61 100755 --- a/sb +++ b/sb @@ -25,7 +25,7 @@ # IBM_PROLOG_END_TAG SBE_TOOLS_PATH="src/tools/utils" -SBE_CITEST_PATH="src/test/citest" +SBE_CITEST_PATH="src/test/framework" sb_helptext() { diff --git a/src/build/Makefile b/src/build/Makefile index 89473e73..23bae9e7 100644 --- a/src/build/Makefile +++ b/src/build/Makefile @@ -27,7 +27,8 @@ #Pull in the definitions that affect all makefiles for this image include img_defs.mk -include ../boot/bootfiles.mk +include $(BOOT_SRCDIR)/bootfiles.mk +include $(BUILDDATA_SRCDIR)/utils.mk #Pull in object file names for the top directory include topfiles.mk @@ -38,6 +39,7 @@ PKLIB := $(OBJDIR)/pk/libpk.a LLIBS += -lpk SUBDIRS += $(BOOT_SRCDIR) +SUBDIRS += $(BUILDDATA_SRCDIR) SUBDIRS += ../sbefw LIB_DIRS += -L$(OBJDIR)/sbefw @@ -102,22 +104,23 @@ LIB_DIRS += -L$(OBJDIR)/pm PMLIB := $(OBJDIR)/pm/libpm.a LLIBS += -lpm -SIMICS_PPE_TAR_FILES += $(OBJDIR)/$(IMAGE_SBE_NAME).out -SIMICS_PPE_TAR_FILES += $(OBJDIR)/$(IMAGE_SBE_NAME).map -SIMICS_PPE_TAR_FILES += $(OBJDIR)/$(IMAGE_SBE_NAME).dis +SIMICS_PPE_TAR_FILES += $(IMG_DIR)/$(IMAGE_SBE_NAME).out +SIMICS_PPE_TAR_FILES += $(IMG_DIR)/$(IMAGE_SBE_NAME).map +SIMICS_PPE_TAR_FILES += $(IMG_DIR)/$(IMAGE_SBE_NAME).dis SIMICS_PPE_TAR_FILES += $(BOOT_OBJDIR)/$(IMAGE_LOADER_NAME).out SIMICS_PPE_TAR_FILES += $(BOOT_OBJDIR)/$(IMAGE_LOADER_NAME).map SIMICS_PPE_TAR_FILES += $(BOOT_OBJDIR)/$(IMAGE_LOADER_NAME).dis -SIMICS_PPE_TAR_FILES += $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out -SIMICS_PPE_TAR_FILES += $(OBJDIR)/$(IMAGE_SEEPROM_NAME).map -SIMICS_PPE_TAR_FILES += $(OBJDIR)/$(IMAGE_SEEPROM_NAME).dis +SIMICS_PPE_TAR_FILES += $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).out +SIMICS_PPE_TAR_FILES += $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).map +SIMICS_PPE_TAR_FILES += $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).dis SIMICS_PPE_TAR_FILES += $(IMG_DIR)/sbe.syms SIMICS_PPE_TAR_FILES += $(TEST_SRCDIR)/*.xml SIMICS_PPE_TAR_FILES += $(TEST_SRCDIR)/*.py SIMICS_PPE_TAR_FILES += $(PPETRACEPP_DIR)/fsp-trace SIMICS_PPE_TAR_FILES += $(IMG_DIR)/sbeStringFile -SIMICS_PPE_TAR_FILES += $(OBJDIR)/ppe2fsp +SIMICS_PPE_TAR_FILES += $(PPETRACEPP_BIN_DIR)/ppe2fsp SIMICS_BB_TAR_FILES += $(SIMICSTOOLS_SRCDIR)/* +SIMICS_BB_TAR_FILES += $(DEBUGTOOLS_SRCDIR)/simics-debug-framework.py SIMICS_PPETRACEPP_TAR_FILES += $(PPETRACEPP_DIR)/cmvc/makefile SIMICS_PPETRACEPP_TAR_FILES += $(PPETRACEPP_DIR)/ppe2fsp.h SIMICS_PPETRACEPP_TAR_FILES += $(PPETRACEPP_DIR)/ppe2fsp.c @@ -127,7 +130,7 @@ SIMICS_PPETRACEPP_TAR_FILES += $(PK_SRCDIR)/trace/pk_trace.h SIMICS_PARSERPLUGINS_TAR_FILES += $(SBE_FW_DIR)/plugins/sbeUserDataParser.C SIMICS_PARSERPLUGINS_TAR_FILES += $(SBE_FW_DIR)/sbeFFDCType.H -SBE_TOOLS := $(BASE_OBJDIR)/sbe_default_tool +SBE_TOOLS := $(IMG_DIR)/sbe_default_tool P9_XIP_TOOL := $(P9_XIP_BINDIR)/p9_xip_tool @@ -137,45 +140,45 @@ LINK_OBJS = $(OBJS) OBJS := $(addprefix $(OBJDIR)/, $(TOP_OBJECTS)) LINK_OBJS += $(OBJS) $(GCCLIBS) -LINK_SCRIPT_SEEPROM = $(addprefix $(OBJDIR)/, linkscriptseeprom) -LINK_SCRIPT_SBE = $(addprefix $(OBJDIR)/, linkscriptsbe) +LINK_SCRIPT_SEEPROM = $(addprefix $(OBJDIR)/build/linkerscripts, linkscriptseeprom) +LINK_SCRIPT_SBE = $(addprefix $(OBJDIR)/build/linkerscripts, linkscriptsbe) # ---- SEEPROM Image ------ # This removes all unecessary headers from the ELF executable -$(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin $(OBJDIR)/$(IMAGE_SEEPROM_NAME).dis: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out +$(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).dis: $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).out ./parsAndCutElf.py - $(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_SEEPROM_NAME).dis + $(OBJDUMP) -S $< > $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).dis #create a linked ELF executable -$(OBJDIR)/$(IMAGE_SEEPROM_NAME).out: ppe_trace_bin buildInfo $(SUBDIRS) $(LINK_OBJS) $(LINK_SCRIPT_SEEPROM) - $(LD) -n -T$(LINK_SCRIPT_SEEPROM) -Map $(OBJDIR)/$(IMAGE_SEEPROM_NAME).map \ - -Bstatic -o $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out $(BOOT_OBJDIR)/$(BOOT_OBJECTS) $(OBJS) $(LIB_DIRS) \ +$(IMG_DIR)/$(IMAGE_SEEPROM_NAME).out: ppe_trace_bin buildInfo $(SUBDIRS) $(LINK_OBJS) $(LINK_SCRIPT_SEEPROM) + $(LD) -n -T$(LINK_SCRIPT_SEEPROM) -Map $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).map \ + -Bstatic -o $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).out $(BOOT_OBJDIR)/$(BOOT_OBJECTS) $(BUILDDATA_OBJDIR)/base_ppe_header.o $(OBJS) $(LIB_DIRS) \ --start-group $(LLIBS) --end-group -leabi -lmath -lc # pass the link command file through the C preprocessor to evaluate macros # and remove comments $(LINK_SCRIPT_SEEPROM): $(LINKER_DIR)/linkseeprom.cmd - $(CPP) -I. -E -x c++ -P $(DEFS) $(LINKER_DIR)/linkseeprom.cmd -o $(LINK_SCRIPT_SEEPROM) + $(CPP) -I $(INCLUDES) -E -x c++ -P $(DEFS) $(LINKER_DIR)/linkseeprom.cmd -o $(LINK_SCRIPT_SEEPROM) # ---- PIBMEM Image ------ #This removes all unecessary headers from the ELF executable -$(IMG_DIR)/$(IMAGE_SBE_NAME).bin $(OBJDIR)/$(IMAGE_SBE_NAME).dis: $(OBJDIR)/$(IMAGE_SBE_NAME).out +$(IMG_DIR)/$(IMAGE_SBE_NAME).bin $(IMG_DIR)/$(IMAGE_SBE_NAME).dis: $(IMG_DIR)/$(IMAGE_SBE_NAME).out $(OBJCOPY) -O binary $< $(IMG_DIR)/$(IMAGE_SBE_NAME).bin --pad-to \ - 0x`/usr/bin/nm $(OBJDIR)/$(IMAGE_SBE_NAME).out | grep "A _sbe_end" \ + 0x`/usr/bin/nm $(IMG_DIR)/$(IMAGE_SBE_NAME).out | grep "A _sbe_end" \ | cut -d " " -f 1` - $(OBJDUMP) -S $< > $(OBJDIR)/$(IMAGE_SBE_NAME).dis + $(OBJDUMP) -S $< > $(IMG_DIR)/$(IMAGE_SBE_NAME).dis $(NM) $< > $(IMG_DIR)/$(IMAGE_SBE_NAME).syms # create a linked ELF executable -$(OBJDIR)/$(IMAGE_SBE_NAME).out: ppe_trace_bin buildInfo $(OBJDIR)/base_sbe_fixed.o $(SUBDIRS) $(LINK_OBJS) $(LINK_SCRIPT_SBE) - $(LD) -e __system_reset -T$(LINK_SCRIPT_SBE) -Map $(OBJDIR)/$(IMAGE_SBE_NAME).map -Bstatic -o $(OBJDIR)/$(IMAGE_SBE_NAME).out $(LIB_DIRS) $(OBJDIR)/base_sbe_fixed.o --start-group $(LLIBS) --end-group +$(IMG_DIR)/$(IMAGE_SBE_NAME).out: ppe_trace_bin buildInfo $(SUBDIRS) $(LINK_OBJS) $(LINK_SCRIPT_SBE) + $(LD) -e __system_reset -T$(LINK_SCRIPT_SBE) -Map $(IMG_DIR)/$(IMAGE_SBE_NAME).map -Bstatic -o $(IMG_DIR)/$(IMAGE_SBE_NAME).out $(LIB_DIRS) $(BUILDDATA_OBJDIR)/base_sbe_fixed.o --start-group $(LLIBS) --end-group # pass the link command file through the C preprocessor to evaluate macros and remove comments $(LINK_SCRIPT_SBE): $(LINKER_DIR)/linksbe.cmd - $(CPP) -E -x c++ -I. -P $(DEFS) $(LINKER_DIR)/linksbe.cmd -o $(LINK_SCRIPT_SBE) + $(CPP) -E -x c++ -I $(INCLUDES) -P $(DEFS) $(LINKER_DIR)/linksbe.cmd -o $(LINK_SCRIPT_SBE) -all: $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin $(IMG_DIR)/$(IMAGE_SBE_NAME).bin \ - $(SBE_TOOLS) normalize defaultset $(OBJDIR)/fixed.bin appendloader \ +all: $(OBJDIR) xml $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin $(IMG_DIR)/$(IMAGE_SBE_NAME).bin \ + $(SBE_TOOLS) normalize defaultset $(IMG_DIR)/fixed.bin appendloader \ appendoverrides add_LoaderAddr symbols tracehash buildinfo report install: all @@ -188,9 +191,9 @@ install: all @cp $(SIMICS_BB_TAR_FILES) $(OBJDIR)/simics-tar-dir @cp $(SIMICS_PPETRACEPP_TAR_FILES) $(OBJDIR)/simics-tar-dir/ppetracepp @cp $(SIMICS_PARSERPLUGINS_TAR_FILES) $(OBJDIR)/simics-tar-dir/parserplugins - @cd $(OBJDIR)/simics-tar-dir && tar -cvf simics.tar * && mv simics.tar $(OBJDIR) && cd .. + @cd $(OBJDIR)/simics-tar-dir && tar -cvf simics.tar * && mv simics.tar $(IMG_DIR) && cd .. @rm -rf $(OBJDIR)/simics-tar-dir - @echo "Generated simics.tar in Sbe Obj Directory" + @echo "Generated simics.tar in Sbe images Directory" .PHONY: all normalize defaultset appendloader add_LoaderAddr symbols report \ appendoverrides xml tracehash topfixedheaders $(SUBDIRS) @@ -201,13 +204,13 @@ buildinfo: $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin set build_user `id -un` $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin set build_host `hostname` -add_LoaderAddr: $(P9_XIP_TOOL) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out - $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin set L1_LoaderAddr 0x`nm $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out | grep __pmLoader | cut -f 1 -d " "` +add_LoaderAddr: $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).out + $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin set L1_LoaderAddr 0x`nm $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).out | grep __pmLoader | cut -f 1 -d " "` $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin set L2_LoaderAddr 0x`nm $(BOOT_OBJDIR)/$(IMAGE_LOADER_NAME).out | grep __base_loader_setup | cut -f 1 -d " "` - $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin set kernelAddr 0x`nm $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out | grep __pk_boot | cut -f 1 -d " "` + $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin set kernelAddr 0x`nm $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).out | grep __pk_boot | cut -f 1 -d " "` -symbols: $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out $(BOOT_OBJDIR)/$(IMAGE_LOADER_NAME).out $(OBJDIR)/$(IMAGE_SBE_NAME).out - $(NM) $(OBJDIR)/$(IMAGE_SEEPROM_NAME).out > $(IMG_DIR)/$(SBE_SYMBOLS_NAME) +symbols: $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).out $(BOOT_OBJDIR)/$(IMAGE_LOADER_NAME).out $(IMG_DIR)/$(IMAGE_SBE_NAME).out + $(NM) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).out > $(IMG_DIR)/$(SBE_SYMBOLS_NAME) $(NM) $(BOOT_OBJDIR)/$(IMAGE_LOADER_NAME).out >> $(IMG_DIR)/$(SBE_SYMBOLS_NAME) report: $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin @@ -219,7 +222,7 @@ buildInfo: #Create an obj directory if needed -$(LINK_OBJS) $(OBJS) $(OBJS:.o=.d) $(OBJDIR)/base_sbe_fixed.o $(OBJDIR)/base_sbe_fixed.d: | $(OBJDIR) +$(LINK_OBJS) $(OBJS) $(OBJS:.o=.d) ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/pervasive_attributes.xml # TODO via RTC 142708 @@ -235,12 +238,13 @@ ATTRFILES += $(BASE_FAPI2_DIR)/xml/attribute_info/chip_attributes.xml ATTRFILES += $(IMPORT_XML_DIR)/attribute_info/chip_ec_attributes.xml $(OBJDIR): + mkdir -p $(OBJDIR) + mkdir -p $(IMG_DIR) + mkdir -p $(OBJDIR)/genfiles $(TOOLS_ATTR_DIR)/ppeParseProcSbeFixed.pl . $(IMPORT_XML_DIR)/attribute_info/p9_sbe_attributes.xml $(ATTRFILES) $(TOOLS_ATTR_DIR)/ppeParseAttributeInfo.pl $(PLAT_FAPI2_DIR)/include $(IMPORT_XML_DIR)/attribute_info/p9_sbe_attributes.xml $(ATTRFILES) $(TOOLS_ATTR_DIR)/ppeCreateAttrGetSetMacros.pl --path $(TOOLS_ATTR_DIR)/src --inc $(PLAT_FAPI2_DIR)/include --src $(PLAT_FAPI2_DIR)/src $(TOOLS_ATTR_DIR)/ppeCreateIfAttrService.pl $(PLAT_FAPI2_DIR)/include $(IMPORT_XML_DIR)/attribute_info/p9_sbe_attributes.xml $(ATTRFILES) - mkdir -p $(OBJDIR) - mkdir -p $(IMG_DIR) topfixedheaders: $(TOOLS_ATTR_DIR)/ppeParseProcSbeFixed.pl . $(IMPORT_XML_DIR)/attribute_info/p9_sbe_attributes.xml $(ATTRFILES) @@ -258,26 +262,27 @@ attrserv: # Build the subdirectories $(SUBDIRS): - $(MAKE) -I $(BUILD_DIR) -C $@ -f Makefile + $(MAKE) -I $(INCLUDES) -C $@ -f Makefile #Build the SBE XIP Tools $(SBE_TOOLS): $(P9_XIP_TOOL) - $(MAKE) -I $(BUILD_DIR) -C $(TOOLS_IMAGE_DIR) -f Makefile + $(MAKE) -I $(INCLUDES) -C $(TOOLS_IMAGE_DIR) -f Makefile # Build the P9-XIP Tool $(P9_XIP_TOOL): $(MAKE) -I $(P9_XIP_SRCDIR) -C $(P9_XIP_SRCDIR) -f Makefile BINDIR=$(P9_XIP_BINDIR) + cp $(P9_XIP_TOOL) $(IMG_DIR)/ normalize: $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin normalize -defaultset: $(SBE_TOOLS) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin normalize - $(TOOLS_ATTR_DIR)/ppeSetFixed.pl $(BASE_OBJDIR) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin $(IMPORT_XML_DIR)/attribute_info/p9_sbe_attributes.xml $(ATTRFILES) +defaultset:$(SBE_TOOLS) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin normalize + $(TOOLS_ATTR_DIR)/ppeSetFixed.pl $(IMG_DIR) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin $(IMPORT_XML_DIR)/attribute_info/p9_sbe_attributes.xml $(ATTRFILES) # Build the trace utilities ppe_trace_bin: - $(MAKE) -I $(BUILD_DIR) -C $(PPETRACEPP_DIR) -f Makefile #$(PK trace util) + $(MAKE) -I $(INCLUDES) -C $(PPETRACEPP_DIR) -f Makefile #$(PK trace util) # Build hwp_error_info.H. If the script fails then print the contents of @@ -290,8 +295,8 @@ xml: $(FAPI_RC) $(FAPI_RC): $(TOOLS_ATTR_DIR)/parseErrorInfo.pl $(ERROR_XML_FILES) $(TOOLS_ATTR_DIR)/parseErrorInfo.pl --local-ffdc --output-dir=. $(ERROR_XML_FILES) -$(OBJDIR)/fixed.bin: $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin - $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin extract .fixed $(BASE_OBJDIR)/fixed.bin +$(IMG_DIR)/fixed.bin: $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin + $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin extract .fixed $(IMG_DIR)/fixed.bin appendloader: $(P9_XIP_TOOL) $(IMG_DIR)/$(IMAGE_SEEPROM_NAME).bin $(IMG_DIR)/$(IMAGE_LOADER_NAME).bin diff --git a/src/build/base_ppe_header.S b/src/build/base_ppe_header.S deleted file mode 100644 index b68b9214..00000000 --- a/src/build/base_ppe_header.S +++ /dev/null @@ -1,209 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/build/base_ppe_header.S $ */ -/* */ -/* OpenPOWER sbe Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ -/* */ -/* */ -/* 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 */ -//----------------------------------------------------------------------------- -// *! (C) Copyright International Business Machines Corp. 2014 -// *! All Rights Reserved -- Property of IBM -// *! *** IBM Confidential *** -//----------------------------------------------------------------------------- - -/// \file base_ppe_header.S -/// \brief code to create header, toc, strings, fixed and fixed_toc sections -/// -/// function P9XipHeader creates header section, function .proc_sbe_fixed -/// creates fixed, fixed_toc sections -#include "p9_xip_image.h" -#include "proc_sbe_fixed.H" - - -#define IMAGE_SPACE_UNDEFINED 0xffff -#define IMAGE_SPACE_OCI 0x8000 -#define IMAGE_SPACE_PNOR 0x800b -#define IMAGE_SPACE_OTPROM 0x0001 -#define IMAGE_SPACE_SEEPROM 0x800c -#define IMAGE_SPACE_BASE 0x0008 - - - - .macro ..checku, x:req, bits:req, err="Unsigned value too large" - - .if (((\bits) <= 0) || ((\bits) > 63)) - .error "The number of bits must be in the range 0 < bits < 64" - .endif - - .iflt (\x) - .error "An unsigned value is required here" - .endif - - .ifgt ((\x) - (0xffffffffffffffff >> (64 - (\bits)))) - .error "\err" - .endif - - .endm - - .macro ..check_u16, u16 - ..checku (\u16), 16, "Unsigned immediate is larger than 16 bits" - .endm - - - .macro ..set_default_space, s - ..check_u16 (\s) - .set _PGAS_DEFAULT_SPACE, (\s) - .endm - - .macro ..check_default_space - .if (_PGAS_DEFAULT_SPACE == IMAGE_SPACE_UNDEFINED) - .error "The PGAS default address space has not been defined" - .endif - .endm - - - .macro .quada, offset:req - ..check_default_space - .long _PGAS_DEFAULT_SPACE - .long (\offset) - .endm - - - .macro P9XipHeader, magic, link_address, entry_point, image_size - - .section .header, "a", @progbits - - - ////////////////////////////////////////////////////////////////////// - // Identification - 8-byte aligned; 8 Entries; TOC-Indexed - ////////////////////////////////////////////////////////////////////// - -__magic: - .quad (\magic) -__L1_LoaderAddr: - .quad 0 -__L2_LoaderAddr: - .quad 0 -__kernelAddr: - .quad 0 -__link_address: - .quada (\link_address) -__header_64_reserved: - .quad 0, 0, 0 - - .xip_toc magic, P9_XIP_UINT64, __magic - .xip_toc L1_LoaderAddr, P9_XIP_UINT64, __L1_LoaderAddr - .xip_toc L2_LoaderAddr, P9_XIP_UINT64, __L2_LoaderAddr - .xip_toc kernelAddr, P9_XIP_UINT64, __kernelAddr - .xip_toc link_address, P9_XIP_UINT64, __link_address - - ////////////////////////////////////////////////////////////////////// - // Section Table - Not TOC-Indexed - ////////////////////////////////////////////////////////////////////// - - .xip_section header - .xip_section fixed, 8 - .xip_section fixed_toc, 8 - .xip_section toc, 4 - .xip_section strings - .xip_section loader_text, 4 - .xip_section loader_data, 8, empty=1 - .xip_section text, 4 - .xip_section data, 8, empty=1 - .xip_section base, 4 - .xip_section baseloader, 8, empty=1 - .xip_section overrides, 8, empty=1 - .xip_section rings, 8, empty=1 - .xip_section overlay, 8, empty=1 - .xip_section hbbl, 8, empty=1 - - - ////////////////////////////////////////////////////////////////////// - // Other Information - 4-byte aligned; 8 entries; TOC-Indexed - ////////////////////////////////////////////////////////////////////// - -__image_size: - .long (\image_size) -__build_date: - .long 0 -__build_time: - .long 0 -__header_32_reserved: - .long 0, 0, 0, 0, 0 - - .xip_toc image_size, P9_XIP_UINT32, __image_size - .xip_toc build_date, P9_XIP_UINT32, __build_date - .xip_toc build_time, P9_XIP_UINT32, __build_time - - - ////////////////////////////////////////////////////////////////////// - // Other Information - 1-byte aligned; 8 entries; TOC-Indexed - ////////////////////////////////////////////////////////////////////// - -__header_version: - .byte P9_XIP_HEADER_VERSION -__toc_normalized: - .byte 0 -__toc_sorted: - .byte 0 -__header_8_reserved: - .byte 0, 0, 0, 0, 0 - - .xip_toc header_version, P9_XIP_UINT8, __header_version - .xip_toc toc_normalized, P9_XIP_UINT8, __toc_normalized - .xip_toc toc_sorted, P9_XIP_UINT8, __toc_sorted - - - ////////////////////////////////////////////////////////////////////// - // Strings; 64 characters allocated; TOC-Indexed - ////////////////////////////////////////////////////////////////////// - -__build_user: - .asciz "unknown " # 16 Characters allocated -__build_host: - .asciz "unknown " # 24 characters allocated -__header_string_reserved: - .space 24, 0 - - .xip_toc build_user, P9_XIP_STRING, __build_user - .xip_toc build_host, P9_XIP_STRING, __build_host - - - .endm - - - .section .fixed, "a", @progbits - .section .fixed_toc, "a", @progbits - .section .loader_data, "a", @progbits - .section .loader_text, "a", @progbits - - .section .toc, "a", @progbits - .section .strings, "aS", @progbits - .section .base, "a", @progbits - - ..set_default_space IMAGE_SPACE_SEEPROM - P9XipHeader P9_XIP_MAGIC_SEEPROM, 0x80000000, 0x00000000, _sbe_image_size - - // Create the .fixed section - .proc_sbe_fixed_system - .proc_sbe_fixed_proc_chip - .proc_sbe_fixed_perv - .proc_sbe_fixed_core - .proc_sbe_fixed_ex - .proc_sbe_fixed_eq diff --git a/src/build/base_sbe_fixed.S b/src/build/base_sbe_fixed.S deleted file mode 100644 index e1a53f84..00000000 --- a/src/build/base_sbe_fixed.S +++ /dev/null @@ -1,67 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/build/base_sbe_fixed.S $ */ -/* */ -/* OpenPOWER sbe Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ -/* */ -/* */ -/* 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 */ -/// \file sbefixed.S -/// \brief code to generated fixed section in pibmem image -/// -#include "p9_xip_image.h" -#include "proc_sbe_fixed.H" - - - .macro ..checku, x:req, bits:req, err="Unsigned value too large" - - .if (((\bits) <= 0) || ((\bits) > 63)) - .error "The number of bits must be in the range 0 < bits < 64" - .endif - - .iflt (\x) - .error "An unsigned value is required here" - .endif - - .ifgt ((\x) - (0xffffffffffffffff >> (64 - (\bits)))) - .error "\err" - .endif - - .endm - - - .macro ..check_u16, u16 - ..checku (\u16), 16, "Unsigned immediate is larger than 16 bits" - .endm - - - .macro ..set_default_space, s - ..check_u16 (\s) - .set _PGAS_DEFAULT_SPACE, (\s) - .endm - - .section .fixed, "a", @progbits - - - // Create the .fixed section - .proc_sbe_fixed_system - .proc_sbe_fixed_proc_chip - .proc_sbe_fixed_perv - .proc_sbe_fixed_core - .proc_sbe_fixed_ex - .proc_sbe_fixed_eq diff --git a/src/build/buildInfo.py b/src/build/buildInfo.py index f7b109e4..4350e682 100755 --- a/src/build/buildInfo.py +++ b/src/build/buildInfo.py @@ -7,6 +7,7 @@ # OpenPOWER sbe Project # # Contributors Listed Below - COPYRIGHT 2016 +# [+] International Business Machines Corp. # # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,7 +27,7 @@ # This script will create header file sbe_build_info.H which will have # buld information required by SBE code. import os -buildInfoFileName = "sbe_build_info.H" +buildInfoFileName = "../../obj/genfiles/sbe_build_info.H" def buildInfo(): header = \ diff --git a/src/build/img_defs.mk b/src/build/img_defs.mk index 8d7b4184..b14ca419 100644 --- a/src/build/img_defs.mk +++ b/src/build/img_defs.mk @@ -83,6 +83,10 @@ ifndef BUILD_DIR export BUILD_DIR = $(SBE_SRC_DIR)/build endif +ifndef BUILDDATA_SRCDIR +export BUILDDATA_SRCDIR = $(BUILD_DIR)/utils +endif + ifndef LINKER_DIR export LINKER_DIR = $(BUILD_DIR)/linkerscripts endif @@ -100,7 +104,7 @@ export TOOLS_SRCDIR = $(SBE_SRC_DIR)/tools endif ifndef TEST_SRCDIR -export TEST_SRCDIR = $(SBE_SRC_DIR)/test +export TEST_SRCDIR = $(SBE_SRC_DIR)/test/testcases endif ifndef DEBUGTOOLS_SRCDIR @@ -171,6 +175,10 @@ ifndef BOOT_OBJDIR export BOOT_OBJDIR = $(BASE_OBJDIR)/boot endif +ifndef BUILDDATA_OBJDIR +export BUILDDATA_OBJDIR = $(BASE_OBJDIR)/build/utils +endif + ifndef IMG_DIR export IMG_DIR = $(SBE_ROOT_DIR)/images endif @@ -201,11 +209,15 @@ export IMPORT_COMMON_DIR = $(IMPORT_SRCDIR)/chips/p9/common endif ifndef PPETRACEPP_DIR -export PPETRACEPP_DIR = $(TOOLS_SRCDIR)/ppetracepp +export PPETRACEPP_DIR = $(TOOLS_SRCDIR)/trace endif ifndef PPETRACEPP_BIN_DIR -export PPETRACEPP_BIN_DIR = $(BASE_OBJDIR) +export PPETRACEPP_BIN_DIR = $(IMG_DIR) +endif + +ifndef GENFILES_DIR +export GENFILES_DIR = $(BASE_OBJDIR)/genfiles endif ifndef PLAT_FAPI2_DIR @@ -358,6 +370,8 @@ INCLUDES += -I$(PK_SRCDIR)/ppe INCLUDES += -I$(PK_SRCDIR)/ppe42 INCLUDES += -I$(SBE_FW_DIR) INCLUDES += -I$(BOOT_SRCDIR) +INCLUDES += -I$(GENFILES_DIR) +INCLUDES += -I$(BUILDDATA_SRCDIR) INCLUDES += -I$(PK_SRCDIR)/trace INCLUDES += -I$(PPETRACEPP_DIR) INCLUDES += -I$(IMPORT_COMMON_DIR)/include diff --git a/src/build/linkerscripts/linkloader.cmd b/src/build/linkerscripts/linkloader.cmd index 75c460d4..1e2a20e3 100755 --- a/src/build/linkerscripts/linkloader.cmd +++ b/src/build/linkerscripts/linkloader.cmd @@ -6,6 +6,7 @@ /* OpenPOWER sbe Project */ /* */ /* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* [+] International Business Machines Corp. */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -28,7 +29,7 @@ #ifndef BASE_LOADER_STACK_SIZE #define BASE_LOADER_STACK_SIZE 128 #endif -#include "../sbe_link.H" +#include "sbe_link.H" OUTPUT_FORMAT(elf32-powerpc); diff --git a/src/build/linkerscripts/linksbe.cmd b/src/build/linkerscripts/linksbe.cmd index 4e1832f6..12250a9d 100644 --- a/src/build/linkerscripts/linksbe.cmd +++ b/src/build/linkerscripts/linksbe.cmd @@ -6,6 +6,7 @@ /* OpenPOWER sbe Project */ /* */ /* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* [+] International Business Machines Corp. */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -28,7 +29,7 @@ #ifndef INITIAL_STACK_SIZE #define INITIAL_STACK_SIZE 256 #endif -#include +#include "sbe_link.H" OUTPUT_FORMAT(elf32-powerpc); diff --git a/src/build/linkerscripts/linkseeprom.cmd b/src/build/linkerscripts/linkseeprom.cmd index 7cbbcda4..fd1b1474 100644 --- a/src/build/linkerscripts/linkseeprom.cmd +++ b/src/build/linkerscripts/linkseeprom.cmd @@ -6,6 +6,7 @@ /* OpenPOWER sbe Project */ /* */ /* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* [+] International Business Machines Corp. */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -23,7 +24,7 @@ /* IBM_PROLOG_END_TAG */ // Need to do this so that elf32-powerpc is not modified! #undef powerpc -#include +#include "sbe_link.H" OUTPUT_FORMAT(elf32-powerpc); #ifndef INITIAL_STACK_SIZE diff --git a/src/build/p9_sbe.H b/src/build/p9_sbe.H deleted file mode 100644 index 3e624d01..00000000 --- a/src/build/p9_sbe.H +++ /dev/null @@ -1,52 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/build/p9_sbe.H $ */ -/* */ -/* OpenPOWER sbe Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ -/* */ -/* */ -/* 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 __P9_SBE_H -#define __P9_SBE_H - -/// \file p9_sbe.H -/// \brief A header to be included into all SBE assembler files and C++ -/// hardware procedures that interact with SBE images. -/// -/// This header #include-s all generally useful headers required for SBE code -/// development as well as defining other needed facilities. Note that any -/// sub-includes must be done in an assembler-safe way. - -#include "sbe_common.H" -//#include "p9_scom_addresses.H" -//#include "p9_istep_num.H" - -// The #include of fapiHwpReturnCodes.H must be made here (instead of in -// sbe_common.H) to guarantee that the P9-local copy is used. -//#include "fapiHwpReturnCodes.H" - -#ifdef __ASSEMBLER__ - - // p9_sbe.H 'recursively' inserts itself into any hook code extracted - // from an assembly context that includes p9_sbe.H. - - ##`#include "p9_sbe.H" - -#endif // __ASSEMBLER__ - -#endif // __P9_SBE_H diff --git a/src/build/parsAndCutElf.py b/src/build/parsAndCutElf.py index 934ddf97..acfe64a5 100755 --- a/src/build/parsAndCutElf.py +++ b/src/build/parsAndCutElf.py @@ -31,9 +31,9 @@ import sys # Workaround to cut SBE image from elf image. def parserElf(): - cmd = "readelf -S ../../obj/sbe_seeprom.out" + cmd = "readelf -S ../../images/sbe_seeprom.out" firstSection = ".header" - cmd1 = "nm ../../obj/sbe_seeprom.out | grep _sbe_image_size" + cmd1 = "nm ../../images/sbe_seeprom.out | grep _sbe_image_size" output = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) i = 0; for line in output.stdout: @@ -60,7 +60,7 @@ def parserElf(): exit(-1) # cut the image - cmd1 = "dd skip=" + str(startSize) + " count=" + str(endSize) + " if=../../obj/sbe_seeprom.out of=../../images/sbe_seeprom.bin bs=1" + cmd1 = "dd skip=" + str(startSize) + " count=" + str(endSize) + " if=../../images/sbe_seeprom.out of=../../images/sbe_seeprom.bin bs=1" rc = os.system(cmd1) if ( rc ): print "ERROR running %s: %d "%( cmd1, rc ) diff --git a/src/build/proc_sbe_fixed.H b/src/build/proc_sbe_fixed.H deleted file mode 100644 index 6c3d134e..00000000 --- a/src/build/proc_sbe_fixed.H +++ /dev/null @@ -1,211 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/build/proc_sbe_fixed.H $ */ -/* */ -/* OpenPOWER sbe Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ -/* */ -/* */ -/* 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 */ -//----------------------------------------------------------------------------- -// *! (C) Copyright International Business Machines Corp. 2014 -// *! All Rights Reserved -- Property of IBM -// *! *** IBM Confidential *** -//----------------------------------------------------------------------------- - -/// \file proc_sbe_fixed.H -/// \brief Define the layout of fixed-position data in the P9 SBE reference -/// and IPL images -/// -/// Contains struct ProcSbeFixed which contains functions, rings and -/// attributes whose pointers are stored in the fixed and fixed_toc section -/// -/// This file defines the layout of the special .fixed data section of P9 SBE -/// reference and IPL images. The .fixed section is guaranteed to appear at a -/// fixed offset from the beginning of the image, containing data required to -/// be manipulated when images are resident in non-volatile memories, thereby -/// avoiding having to search the TOC. Data manipulated during in-memory image -/// processing can always be easily located using the SBE-XIP TOC APIs. All -/// of the data stored in .fixed can also still be referenced via the SBE-XIP -/// TOC. -/// -/// This header file can be #include-ed into either C or SBE assembly language -/// source code. In C, it creates simple structures 'ProcChipAttributes', -/// 'PervAttributes', 'CoreAttributes', 'EQAttributes' and 'EXAttributes' that -/// contain attribute information that are sized per XML definition per entry. -/// -/// PPE image data is always stored big-endian, so applications on little-endian -/// hosts will need to perform the appropriate endian converison when reading or -/// writing images via this header. -/// -/// In assembler code, this header creates macros '.proc_sbe_fixed_proc_chip', -/// '.proc_sbe_fixed_perv', '.proc_sbe_fixed_core', '.proc_sbe_fixed_ex', -/// '.proc_sbe_fixed_eq', that is expanded exactly once in the file -/// 'sbe_base_header.S', creating the actual data allocation of the data -/// equivalent to the C structure. Assembler code references the data symbols -/// as normal. -/// -/// To simplify programming a 'mini-TOC' is also provided for this data in -/// the .fixed_toc section. This section is comprised of SbeXipHashedToc -/// structures. When a symbol is indedxed in .fixed, a blank SbeXipHashedToc -/// stucture is added to .fixed_toc. During image normalization the array of -/// SbeXipHashedToc is filled in as each symbol in .fixed is re-indexed into -/// .fixed_toc. - -#ifndef __PROC_SBE_FIXED_H__ -#define __PROC_SBE_FIXED_H__ - -#include "p9_sbe.H" -#include "plat_target_parms.H" -#include "fapi2AttributeIds.H" - -#ifdef __ASSEMBLER__ - .macro .proc_sbe_fixed_system - .section .fixed, "a", @progbits - .balign 8 - .global G_system_attributes -G_system_attributes: -#else - -extern "C" { -namespace fapi2attr { -typedef struct SystemAttributes_t { -#endif - -#include "proc_sbe_fixed_system.H" - -#ifdef __ASSEMBLER__ - .endm -#else -} SystemAttributes; -} // fapi2 -} // C -#endif - -#ifdef __ASSEMBLER__ - .macro .proc_sbe_fixed_proc_chip - .section .fixed, "a", @progbits - .balign 8 - .global G_proc_chip_attributes -G_proc_chip_attributes: -#else - -extern "C" { -namespace fapi2attr { -typedef struct ProcChipAttributes_t { -#endif - -#include "proc_sbe_fixed_proc_chip.H" - -#ifdef __ASSEMBLER__ - .endm -#else -} ProcChipAttributes; -} // fapi2 -} // C -#endif - -/// -/// Pervasive Target Attributes -#ifdef __ASSEMBLER__ - .macro .proc_sbe_fixed_perv - .section .fixed, "a", @progbits - .balign 8 - .global G_perv_attributes -G_perv_attributes: -#else -namespace fapi2attr { -typedef struct PervAttributes_t { -#endif - -#include "proc_sbe_fixed_perv.H" - -#ifdef __ASSEMBLER__ - .endm -#else -} PervAttributes; -} // fapi2 -#endif - -/// -/// Core (EC) Target Attributes -#ifdef __ASSEMBLER__ - .macro .proc_sbe_fixed_core - .section .fixed, "a", @progbits - .balign 8 - .global G_core_attributes -G_core_attributes: -#else -namespace fapi2attr { -typedef struct CoreAttributes_t { -#endif - -#include "proc_sbe_fixed_core.H" - -#ifdef __ASSEMBLER__ - .endm -#else -} CoreAttributes; -} // fapi2 -#endif - -/// -/// EX Target Attributes -#ifdef __ASSEMBLER__ - .macro .proc_sbe_fixed_ex - .section .fixed, "a", @progbits - .balign 8 - .global G_ex_attributes -G_ex_attributes: -#else -namespace fapi2attr { -typedef struct EXAttributes_t { -#endif - -#include "proc_sbe_fixed_ex.H" - -#ifdef __ASSEMBLER__ - .endm -#else -} EXAttributes; -} // fapi2 -#endif - -/// -/// EQ Target Attributes -#ifdef __ASSEMBLER__ - .macro .proc_sbe_fixed_eq - .section .fixed, "a", @progbits - .balign 8 - .global G_eq_attributes -G_eq_attributes: -#else -namespace fapi2attr { -typedef struct EQAttributes_t { -#endif - -#include "proc_sbe_fixed_eq.H" - -#ifdef __ASSEMBLER__ - .endm -#else -} EQAttributes; -} // fapi2 -#endif - - -#endif // __PROC_SBE_FIXED_H__ diff --git a/src/build/sbe_common.H b/src/build/sbe_common.H deleted file mode 100644 index 4fb78079..00000000 --- a/src/build/sbe_common.H +++ /dev/null @@ -1,600 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/build/sbe_common.H $ */ -/* */ -/* OpenPOWER sbe Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ -/* */ -/* */ -/* 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 __SBE_COMMON_H -#define __SBE_COMMON_H - -// $Id: Exp $ - -/// \file sbe_common.H - -/// \brief This header contains #include-s and macro definitions common to P8 -/// and Centaur SBE code development. It is #include-ed into p8_sbe.H and -/// cen_sbe.H which have other setup specific to each environment. - - -#include "sbe_link.H" -#include "p9_xip_image.h" -//#include "sbe_xip_header.H" - -/// Macros for generating the .fixed section -/// -/// The CPP macros PROC_SBE_FIXED_UINT64[_VECTOR] generate equivalent code -/// depending on whether they are being called from assembler (where they -/// actually create the .fixed section data) or from C (where they specifiy a -/// C-structure form of the contents of the .fixed section. -/// -/// In assembler each invocation also creates space in the .fixed_toc section -/// for a fixed TOC entry. Unlike the normal TOC no data is generated for -/// .fixed_toc by the data declaration. Instead, the fixed TOC table is -/// filled in during image normalization by normalizeToc (p9_xip_image.c) -/// which requires that there be one and only one fixed TOC entery allocated -/// per TOC entry referencing the .fixed section. This means that in the -/// current implementation it is not possible to create .fixed_toc entries -/// for addresses or for data stored in sections other than .fixed. - -#ifdef __ASSEMBLER__ - - .macro proc_sbe_fixed_uint8, symbol:req, tnumber=1, elements=1 - .global \symbol -\symbol\(): - .rept ((\tnumber)*(\elements)) - .byte 0 - .endr - - .xip_toc \symbol, P9_XIP_UINT8, \symbol, ((\tnumber)*(\elements)) - - .pushsection .fixed_toc - .space 8 - .popsection - - .endm - - .macro proc_sbe_fixed_int8, symbol:req, tnumber=1, elements=1 - .global \symbol -\symbol\(): - .rept ((\tnumber)*(\elements)) - .byte 0 - .endr - - .xip_toc \symbol, P9_XIP_INT8, \symbol, ((\tnumber)*(\elements)) - - .pushsection .fixed_toc - .space 8 - .popsection - - .endm - - .macro proc_sbe_fixed_uint16, symbol:req, tnumber=1, elements=1 - .balign 2 - .global \symbol -\symbol\(): - - .rept ((\tnumber)*(\elements)) - .byte 0,0 - .endr - - .xip_toc \symbol, P9_XIP_UINT16, \symbol, ((\tnumber)*(\elements)) - - .pushsection .fixed_toc - .space 8 - .popsection - - .endm - - .macro proc_sbe_fixed_int16, symbol:req, tnumber=1, elements=1 - .balign 2 - .global \symbol -\symbol\(): - - .rept ((\tnumber)*(\elements)) - .byte 0,0 - .endr - - .xip_toc \symbol, P9_XIP_INT16, \symbol, ((\tnumber)*(\elements)) - - .pushsection .fixed_toc - .space 8 - .popsection - - .endm - - .macro proc_sbe_fixed_uint32, symbol:req, tnumber=1, elements=1 - .balign 4 - .global \symbol -\symbol\(): - - .rept ((\tnumber)*(\elements)) - .long 0 - .endr - - .xip_toc \symbol, P9_XIP_UINT32, \symbol, ((\tnumber)*(\elements)) - - .pushsection .fixed_toc - .space 8 - .popsection - - .endm - - .macro proc_sbe_fixed_int32, symbol:req, tnumber=1, elements=1 - .balign 4 - .global \symbol -\symbol\(): - - .rept ((\tnumber)*(\elements)) - .long 0 - .endr - - .xip_toc \symbol, P9_XIP_INT32, \symbol, ((\tnumber)*(\elements)) - - .pushsection .fixed_toc - .space 8 - .popsection - - .endm - - .macro proc_sbe_fixed_uint64, symbol:req, tnumber=1, elements=1 - .balign 8 - .global \symbol -\symbol\(): - .rept ((\tnumber)*(\elements)) - .quad 0 - .endr - - .xip_toc \symbol, P9_XIP_UINT64, \symbol, ((\tnumber)*(\elements)) - - .pushsection .fixed_toc - .space 8 - .popsection - - .endm - - .macro proc_sbe_fixed_int64, symbol:req, tnumber=1, elements=1 - .balign 8 - .global \symbol -\symbol\(): - .rept ((\tnumber)*(\elements)) - .quad 0 - .endr - - .xip_toc \symbol, P9_XIP_INT64, \symbol, ((\tnumber)*(\elements)) - - .pushsection .fixed_toc - .space 8 - .popsection - - .endm - - .macro proc_sbe_fixed_quadia, symbol:req, space:req, address:req - .global \symbol -\symbol\(): - .quadia (\space), (\address) - - .xip_toc \symbol, P9_XIP_UINT64, \symbol - - .pushsection .fixed_toc - .space 8 - .popsection - - .endm - - -#define PROC_SBE_FIXED_UINT8(symbol) \ - proc_sbe_fixed_uint8 symbol - -#define PROC_SBE_FIXED_INT8(symbol) \ - proc_sbe_fixed_int8 symbol - -#define PROC_SBE_FIXED_UINT16(symbol) \ - proc_sbe_fixed_uint16 symbol - -#define PROC_SBE_FIXED_INT16(symbol) \ - proc_sbe_fixed_int16 symbol - -#define PROC_SBE_FIXED_UINT32(symbol) \ - proc_sbe_fixed_uint32 symbol - -#define PROC_SBE_FIXED_INT32(symbol) \ - proc_sbe_fixed_int32 symbol - -#define PROC_SBE_FIXED_UINT64(symbol) \ - proc_sbe_fixed_uint64 symbol - -#define PROC_SBE_FIXED_INT64(symbol) \ - proc_sbe_fixed_int64 symbol - -#define PROC_SBE_FIXED_UINT8_VECTOR(symbol, elements) \ - proc_sbe_fixed_uint8 symbol, 1, elements - -#define PROC_SBE_FIXED_INT8_VECTOR(symbol, elements) \ - proc_sbe_fixed_int8 symbol, 1, elements - -#define PROC_SBE_FIXED_UINT16_VECTOR(symbol, elements) \ - proc_sbe_fixed_uint16 symbol, 1, elements - -#define PROC_SBE_FIXED_INT16_VECTOR(symbol, elements) \ - proc_sbe_fixed_int16 symbol, 1, elements - -#define PROC_SBE_FIXED_UINT32_VECTOR(symbol, elements) \ - proc_sbe_fixed_uint32 symbol, 1, elements - -#define PROC_SBE_FIXED_INT32_VECTOR(symbol, elements) \ - proc_sbe_fixed_int32 symbol, 1, elements - -#define PROC_SBE_FIXED_UINT64_VECTOR(symbol, elements) \ - proc_sbe_fixed_uint64 symbol, 1, elements - -#define PROC_SBE_FIXED_INT64_VECTOR(symbol, elements) \ - proc_sbe_fixed_int64 symbol, 1, elements - -#define PROC_SBE_FIXED_UINT8_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_uint8 symbol, 1, dim1 * dim2 - -#define PROC_SBE_FIXED_INT8_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_int8 symbol, 1, dim1 * dim2 - -#define PROC_SBE_FIXED_UINT16_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_uint16 symbol, 1, dim1 * dim2 - -#define PROC_SBE_FIXED_INT16_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_int16 symbol, 1, dim1 * dim2 - -#define PROC_SBE_FIXED_UINT32_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_uint32 symbol, 1, dim1 * dim2 - -#define PROC_SBE_FIXED_INT32_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_int32 symbol, 1, dim1 * dim2 - -#define PROC_SBE_FIXED_UINT64_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_uint64 symbol, 1, dim1 * dim2 - -#define PROC_SBE_FIXED_INT64_VECTOR_2(symbol, dim1, dim2 ) \ - proc_sbe_fixed_int64 symbol, 1, dim1 * dim2 - -#define PROC_SBE_FIXED_UINT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint8 symbol, 1, dim1 * dim2 * dim3 - -#define PROC_SBE_FIXED_INT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint8 symbol, 1, dim1 * dim2 * dim3 - -#define PROC_SBE_FIXED_UINT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint16 symbol, 1, dim1 * dim2 * dim3 - -#define PROC_SBE_FIXED_INT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint16 symbol, 1, dim1 * dim2 * dim3 - -#define PROC_SBE_FIXED_UINT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint32 symbol, 1, dim1 * dim2 * dim3 - -#define PROC_SBE_FIXED_INT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint32 symbol, 1, dim1 * dim2 * dim3 - -#define PROC_SBE_FIXED_UINT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint64 symbol, 1, dim1 * dim2 * dim3 - -#define PROC_SBE_FIXED_INT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint64 symbol, 1, dim1 * dim2 * dim3 - -// Non-Chip Target Attributes - -#define PROC_SBE_FIXED_TARGET_UINT8(symbol, tnumber) \ - proc_sbe_fixed_uint8 symbol, tnumber - -#define PROC_SBE_FIXED_TARGET_INT8(symbol, tnumber) \ - proc_sbe_fixed_int8 symbol, tnumber - -#define PROC_SBE_FIXED_TARGET_UINT16(symbol, tnumber) \ - proc_sbe_fixed_uint16 symbol, tnumber - -#define PROC_SBE_FIXED_TARGET_INT16(symbol, tnumber) \ - proc_sbe_fixed_int16 symbol, tnumber - -#define PROC_SBE_FIXED_TARGET_UINT32(symbol, tnumber) \ - proc_sbe_fixed_uint32 symbol, tnumber - -#define PROC_SBE_FIXED_TARGET_INT32(symbol, tnumber) \ - proc_sbe_fixed_int32 symbol, tnumber - -#define PROC_SBE_FIXED_TARGET_UINT64(symbol, tnumber) \ - proc_sbe_fixed_uint64 symbol, tnumber - -#define PROC_SBE_FIXED_TARGET_INT64(symbol, tnumber) \ - proc_sbe_fixed_int64 symbol, tnumber - -#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_uint8 symbol, tnumber, elements - -#define PROC_SBE_FIXED_TARGET_INT8_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_int8 symbol, tnumber, elements - -#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_uint16 symbol, tnumber, elements - -#define PROC_SBE_FIXED_TARGET_INT16_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_int16 symbol, tnumber, elements - -#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_uint32 symbol, tnumber, elements - -#define PROC_SBE_FIXED_TARGET_INT32_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_int32 symbol, tnumber, elements - -#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_uint64 symbol, tnumber, elements - -#define PROC_SBE_FIXED_TARGET_INT64_VECTOR(symbol, tnumber, elements) \ - proc_sbe_fixed_int64 symbol, tnumber, elements - -#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_uint8 symbol, tnumber, dim1 * dim2 - -#define PROC_SBE_FIXED_TARGET_INT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_int8 symbol, tnumber, dim1 * dim2 - -#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_uint16 symbol, tnumber, dim1 * dim2 - -#define PROC_SBE_FIXED_TARGET_INT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_int16 symbol, tnumber, dim1 * dim2 - -#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_uint32 symbol, tnumber, dim1 * dim2 - -#define PROC_SBE_FIXED_TARGET_INT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_int32 symbol, tnumber, dim1 * dim2 - -#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_uint64 symbol, tnumber, dim1 * dim2 - -#define PROC_SBE_FIXED_TARGET_INT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - proc_sbe_fixed_int64 symbol, tnumber, dim1 * dim2 - -#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint8 symbol, tnumber, dim1 * dim2 * dim3 - -#define PROC_SBE_FIXED_TARGET_INT8_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint8 symbol, tnumber, dim1 * dim2 * dim3 - -#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint16 symbol, tnumber, dim1 * dim2 * dim3 - -#define PROC_SBE_FIXED_TARGET_INT16_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint16 symbol, tnumber, dim1 * dim2 * dim3 - -#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint32 symbol, tnumber, dim1 * dim2 * dim3 - -#define PROC_SBE_FIXED_TARGET_INT32_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint32 symbol, tnumber, dim1 * dim2 * dim3 - -#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint64 symbol, tnumber, dim1 * dim2 * dim3 - -#define PROC_SBE_FIXED_TARGET_INT64_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - proc_sbe_fixed_uint64 symbol, tnumber, dim1 * dim2 * dim3 - -#define PROC_SBE_FIXED_QUADIA(symbol, space, address) \ - proc_sbe_fixed_quadia symbol, (space), (address) - - -#else // __ASSEMBLER__ (eg the C portion) - -#define PROC_SBE_FIXED_UINT8(symbol) \ - uint8_t symbol - -#define PROC_SBE_FIXED_INT8(symbol) \ - int8_t symbol - -#define PROC_SBE_FIXED_UINT16(symbol) \ - uint16_t symbol - -#define PROC_SBE_FIXED_INT16(symbol) \ - int16_t symbol - -#define PROC_SBE_FIXED_UINT32(symbol) \ - uint32_t symbol - -#define PROC_SBE_FIXED_INT32(symbol) \ - int32_t symbol - -#define PROC_SBE_FIXED_UINT64(symbol) \ - uint64_t symbol - -#define PROC_SBE_FIXED_INT64(symbol) \ - int64_t symbol - -#define PROC_SBE_FIXED_UINT8_VECTOR(symbol, elements) \ - uint8_t symbol[elements] - -#define PROC_SBE_FIXED_INT8_VECTOR(symbol, elements) \ - int8_t symbol[elements] - -#define PROC_SBE_FIXED_UINT16_VECTOR(symbol, elements) \ - uint16_t symbol[elements] - -#define PROC_SBE_FIXED_INT16_VECTOR(symbol, elements) \ - int16_t symbol[elements] - -#define PROC_SBE_FIXED_UINT32_VECTOR(symbol, elements) \ - uint32_t symbol[elements] - -#define PROC_SBE_FIXED_INT32_VECTOR(symbol, elements) \ - int32_t symbol[elements] - -#define PROC_SBE_FIXED_UINT64_VECTOR(symbol, elements) \ - uint64_t symbol[elements] - -#define PROC_SBE_FIXED_INT64_VECTOR(symbol, elements) \ - int64_t symbol[elements] - -#define PROC_SBE_FIXED_UINT8_VECTOR_2(symbol, dim1, dim2 ) \ - uint8_t symbol[dim1][dim2] - -#define PROC_SBE_FIXED_INT8_VECTOR_2(symbol, dim1, dim2 ) \ - int8_t symbol[dim1][dim2] - -#define PROC_SBE_FIXED_UINT16_VECTOR_2(symbol, dim1, dim2 ) \ - uint16_t symbol[dim1][dim2] - -#define PROC_SBE_FIXED_INT16_VECTOR_2(symbol, dim1, dim2 ) \ - int16_t symbol[dim1][dim2] - -#define PROC_SBE_FIXED_UINT32_VECTOR_2(symbol, dim1, dim2 ) \ - uint32_t symbol[dim1][dim2] - -#define PROC_SBE_FIXED_INT32_VECTOR_2(symbol, dim1, dim2 ) \ - int32_t symbol[dim1][dim2] - -#define PROC_SBE_FIXED_UINT64_VECTOR_2(symbol, dim1, dim2 ) \ - uint64_t symbol[dim1][dim2] - -#define PROC_SBE_FIXED_INT64_VECTOR_2(symbol, dim1, dim2 ) \ - int64_t symbol[dim1][dim2] - -#define PROC_SBE_FIXED_UINT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - uint8_t symbol[dim1][dim2][dim3] - -#define PROC_SBE_FIXED_INT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - int8_t symbol[dim1][dim2][dim3] - -#define PROC_SBE_FIXED_UINT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - uint16_t symbol[dim1][dim2][dim3] - -#define PROC_SBE_FIXED_INT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - int16_t symbol[dim1][dim2][dim3] - -#define PROC_SBE_FIXED_UINT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - uint32_t symbol[dim1][dim2][dim3] - -#define PROC_SBE_FIXED_INT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - int32_t symbol[dim1][dim2][dim3] - -#define PROC_SBE_FIXED_UINT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - uint64_t symbol[dim1][dim2][dim3] - -#define PROC_SBE_FIXED_INT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \ - int64_t symbol[dim1][dim2][dim3] - -// Non-Chip Target Attributes - -#define PROC_SBE_FIXED_TARGET_UINT8(symbol, tnumber) \ - uint8_t symbol[tnumber] - -#define PROC_SBE_FIXED_TARGET_INT8(symbol, tnumber) \ - int8_t symbol[tnumber] - -#define PROC_SBE_FIXED_TARGET_UINT16(symbol, tnumber) \ - uint16_t symbol[tnumber] - -#define PROC_SBE_FIXED_TARGET_INT16(symbol, tnumber) \ - int16_t symbol[tnumber] - -#define PROC_SBE_FIXED_TARGET_UINT32(symbol, tnumber) \ - uint32_t symbol[tnumber] - -#define PROC_SBE_FIXED_TARGET_INT32(symbol, tnumber) \ - int32_t symbol[tnumber] - -#define PROC_SBE_FIXED_TARGET_UINT64(symbol, tnumber) \ - uint64_t symbol[tnumber] - -#define PROC_SBE_FIXED_TARGET_INT64(symbol, tnumber) \ - int64_t symbol[tnumber] - -#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR(symbol, tnumber, elements) \ - uint8_t symbol[tnumber][elements] - -#define PROC_SBE_FIXED_TARGET_INT8_VECTOR(symbol, tnumber, elements) \ - int8_t symbol[tnumber][elements] - -#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR(symbol, tnumber, elements) \ - uint16_t symbol[tnumber][elements] - -#define PROC_SBE_FIXED_TARGET_INT16_VECTOR(symbol, tnumber, elements) \ - int16_t symbol[tnumber][elements] - -#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR(symbol, tnumber, elements) \ - uint32_t symbol[tnumber][elements] - -#define PROC_SBE_FIXED_TARGET_INT32_VECTOR(symbol, tnumber, elements) \ - int32_t symbol[tnumber][elements] - -#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR(symbol, tnumber, elements) \ - uint64_t symbol[tnumber][elements] - -#define PROC_SBE_FIXED_TARGET_INT64_VECTOR(symbol, tnumber, elements) \ - int64_t symbol[tnumber][elements] - -#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - uint8_t symbol[tnumber][dim1][dim2] - -#define PROC_SBE_FIXED_TARGET_INT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - int8_t symbol[tnumber][dim1][dim2] - -#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - uint16_t symbol[tnumber][dim1][dim2] - -#define PROC_SBE_FIXED_TARGET_INT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - int16_t symbol[tnumber][dim1][dim2] - -#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - uint32_t symbol[tnumber][dim1][dim2] - -#define PROC_SBE_FIXED_TARGET_INT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - int32_t symbol[tnumber][dim1][dim2] - -#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - uint64_t symbol[tnumber][dim1][dim2] - -#define PROC_SBE_FIXED_TARGET_INT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ - int64_t symbol[tnumber][dim1][dim2] - -#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - uint8_t symbol[tnumber][dim1][dim2][dim3] - -#define PROC_SBE_FIXED_TARGET_INT8_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - int8_t symbol[tnumber][dim1][dim2][dim3] - -#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - uint16_t symbol[tnumber][dim1][dim2][dim3] - -#define PROC_SBE_FIXED_TARGET_INT16_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - int16_t symbol[tnumber][dim1][dim2][dim3] - -#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - uint32_t symbol[tnumber][dim1][dim2][dim3] - -#define PROC_SBE_FIXED_TARGET_INT32_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - int32_t symbol[tnumber][dim1][dim2][dim3] - -#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - uint64_t symbol[tnumber][dim1][dim2][dim3] - -#define PROC_SBE_FIXED_TARGET_INT64_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ - int64_t symbol[tnumber][dim1][dim2][dim3] - -#define PROC_SBE_FIXED_QUADIA(symbol, space, address) uint64_t symbol - -#endif // __ASSEMBLER__ - -#endif // __SBE_COMMON_H diff --git a/src/build/sbe_link.H b/src/build/sbe_link.H deleted file mode 100644 index ad703e1a..00000000 --- a/src/build/sbe_link.H +++ /dev/null @@ -1,102 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/build/sbe_link.H $ */ -/* */ -/* OpenPOWER sbe Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ -/* */ -/* */ -/* 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 __SBE_LINK_H -#define __SBE_LINK_H - -// $Id: Exp $ - -/// \file sbe_link.H -/// \brief Constants required for linking SBE code images -/// -/// This header contains those cpp manifest constants required for processing -/// the linker scripts used to generate SBE code images. They may also be -/// useful for PPE assembler programming so they are included in sbe.H as -/// well. -/// -/// The link address of OTPROM code as a byte-address -/// -/// The OTPROM can be addressed both as an I2C slave and as a direct PIB -/// slave. The I2C slave is at PIB local address 0x0 and the PIB memory -/// interface is at local address 0x8000. SBE/IPL uses the PIB addressing -/// mode, so the OTPROM image is linked at 0x40000 (the byte-address -/// equivalent of 0x8000). -#define OTPROM_ORIGIN 0xC0000 - -/// The amount of memory contained in each OTPROM macro -#define OTPROM_BLOCK_SIZE 1024 - -/// The amount of memory reserved for OTPROM code -/// -/// This amount is exclusive of physical OTPROM memory reserved for compressed -/// scan ring images. -#define OTPROM_CODE_SIZE (1 * OTPROM_BLOCK_SIZE) - -/// The link address of the P9 SBE Base image -#define SBE_BASE_ORIGIN 0xFFFE8000 -/// SBE base image length ( 96 KB - 512 bytes for loader) -#define SBE_BASE_LENGTH 0x17DFF - -///This Index depends upon XIP HEADER File -// Start offset of sectionTable in XIP header. There are 8 entries -// of 8 byte each. -#define SBE_XIP_TOC_OFFSET 8*8 - -/// The link address of the P9 SBE Base image -#define SBE_SEEPROM_BASE_ORIGIN 0x80000000 - -/// This Index depends upon XIP HEADER File -/// Each section table entry is 12 bytes(SIZE_OF_SBE_XIP_SECTION) size, -// Base Loader is 10 th (P9_XIP_SECTION_BASELOADER) section -#define SBE_LOADER_BASE_SECTION SBE_SEEPROM_BASE_ORIGIN + SBE_XIP_TOC_OFFSET \ - + 120 -// Base Loader start address -#define SBE_LOADER_BASE_ORIGIN 0xFFFFFE00 -// Base Loader length -#define SBE_LOADER_BASE_LENGTH 0x200 - -// Base Loader entry function offset in header -#define SBE_LOADER_ENTRY_HEADER_OFFSET 20 - -/// The physical address offset where SBE-SEEPROM code is loaded -/// -/// This address *must* be a constant known to the OTPROM code. -#define SBE_SEEPROM_LOAD_ADDRESS 0x2000 - -/// The offset (in bytes) of the .fixed section in P9 SBE-XIP images -#define SBE_XIP_FIXED_OFFSET 512 - -/// The link address of the PIBMEM image -#define PIBMEM_ORIGIN 0 - -/// The amount of space available in the PIBMEM, in bytes (96KB) -#define PIBMEM_SIZE (96 * 1024) - -/// The fixed section of Otprom -#define OTPROM_FIXED_SIZE (OTPROM_ORIGIN + 0x340) - -/// Sbe fixed sction for the pibmem repair -#define SBE_FIXED_SECTION (SBE_SEEPROM_BASE_ORIGIN + SBE_XIP_TOC_OFFSET + 12) - -#endif // __SBE_LINK_H - diff --git a/src/build/topfiles.mk b/src/build/topfiles.mk index 6c76eaaf..71732138 100644 --- a/src/build/topfiles.mk +++ b/src/build/topfiles.mk @@ -6,6 +6,7 @@ # OpenPOWER sbe Project # # Contributors Listed Below - COPYRIGHT 2015,2016 +# [+] International Business Machines Corp. # # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +24,7 @@ # IBM_PROLOG_END_TAG TOP-C-SOURCES = TOP-CPP-SOURCES = -TOP-S-SOURCES = base_ppe_header.S +TOP-S-SOURCES = # generated by ppeParseProcSbeFixed.pl TOP-FIXED-HEADERS += $(BUILD_DIR)/proc_sbe_fixed_system.H diff --git a/src/build/utils/Makefile b/src/build/utils/Makefile new file mode 100644 index 00000000..163984cf --- /dev/null +++ b/src/build/utils/Makefile @@ -0,0 +1,43 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/build/utils/Makefile $ +# +# 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 +export SUB_OBJDIR = /build/utils + +include img_defs.mk +include utils.mk + +OBJS := $(addprefix $(OBJDIR)/, $(BUILDDATA_OBJECTS)) +BUILDDATA_OBJECTS := $(OBJS) + +.PHONY: clean all + +all:$(OBJS) + +$(OBJS) $(OBJS:.o=.d): | $(OBJDIR) + +$(OBJDIR): + mkdir -p $(OBJDIR) + +clean: + rm -rf $(OBJDIR) diff --git a/src/build/utils/base_ppe_header.S b/src/build/utils/base_ppe_header.S new file mode 100644 index 00000000..c99cc08f --- /dev/null +++ b/src/build/utils/base_ppe_header.S @@ -0,0 +1,209 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/utils/base_ppe_header.S $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 */ +//----------------------------------------------------------------------------- +// *! (C) Copyright International Business Machines Corp. 2014 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +//----------------------------------------------------------------------------- + +/// \file base_ppe_header.S +/// \brief code to create header, toc, strings, fixed and fixed_toc sections +/// +/// function P9XipHeader creates header section, function .proc_sbe_fixed +/// creates fixed, fixed_toc sections +#include "p9_xip_image.h" +#include "proc_sbe_fixed.H" + + +#define IMAGE_SPACE_UNDEFINED 0xffff +#define IMAGE_SPACE_OCI 0x8000 +#define IMAGE_SPACE_PNOR 0x800b +#define IMAGE_SPACE_OTPROM 0x0001 +#define IMAGE_SPACE_SEEPROM 0x800c +#define IMAGE_SPACE_BASE 0x0008 + + + + .macro ..checku, x:req, bits:req, err="Unsigned value too large" + + .if (((\bits) <= 0) || ((\bits) > 63)) + .error "The number of bits must be in the range 0 < bits < 64" + .endif + + .iflt (\x) + .error "An unsigned value is required here" + .endif + + .ifgt ((\x) - (0xffffffffffffffff >> (64 - (\bits)))) + .error "\err" + .endif + + .endm + + .macro ..check_u16, u16 + ..checku (\u16), 16, "Unsigned immediate is larger than 16 bits" + .endm + + + .macro ..set_default_space, s + ..check_u16 (\s) + .set _PGAS_DEFAULT_SPACE, (\s) + .endm + + .macro ..check_default_space + .if (_PGAS_DEFAULT_SPACE == IMAGE_SPACE_UNDEFINED) + .error "The PGAS default address space has not been defined" + .endif + .endm + + + .macro .quada, offset:req + ..check_default_space + .long _PGAS_DEFAULT_SPACE + .long (\offset) + .endm + + + .macro P9XipHeader, magic, link_address, entry_point, image_size + + .section .header, "a", @progbits + + + ////////////////////////////////////////////////////////////////////// + // Identification - 8-byte aligned; 8 Entries; TOC-Indexed + ////////////////////////////////////////////////////////////////////// + +__magic: + .quad (\magic) +__L1_LoaderAddr: + .quad 0 +__L2_LoaderAddr: + .quad 0 +__kernelAddr: + .quad 0 +__link_address: + .quada (\link_address) +__header_64_reserved: + .quad 0, 0, 0 + + .xip_toc magic, P9_XIP_UINT64, __magic + .xip_toc L1_LoaderAddr, P9_XIP_UINT64, __L1_LoaderAddr + .xip_toc L2_LoaderAddr, P9_XIP_UINT64, __L2_LoaderAddr + .xip_toc kernelAddr, P9_XIP_UINT64, __kernelAddr + .xip_toc link_address, P9_XIP_UINT64, __link_address + + ////////////////////////////////////////////////////////////////////// + // Section Table - Not TOC-Indexed + ////////////////////////////////////////////////////////////////////// + + .xip_section header + .xip_section fixed, 8 + .xip_section fixed_toc, 8 + .xip_section toc, 4 + .xip_section strings + .xip_section loader_text, 4 + .xip_section loader_data, 8, empty=1 + .xip_section text, 4 + .xip_section data, 8, empty=1 + .xip_section base, 4 + .xip_section baseloader, 8, empty=1 + .xip_section overrides, 8, empty=1 + .xip_section rings, 8, empty=1 + .xip_section overlay, 8, empty=1 + .xip_section hbbl, 8, empty=1 + + + ////////////////////////////////////////////////////////////////////// + // Other Information - 4-byte aligned; 8 entries; TOC-Indexed + ////////////////////////////////////////////////////////////////////// + +__image_size: + .long (\image_size) +__build_date: + .long 0 +__build_time: + .long 0 +__header_32_reserved: + .long 0, 0, 0, 0, 0 + + .xip_toc image_size, P9_XIP_UINT32, __image_size + .xip_toc build_date, P9_XIP_UINT32, __build_date + .xip_toc build_time, P9_XIP_UINT32, __build_time + + + ////////////////////////////////////////////////////////////////////// + // Other Information - 1-byte aligned; 8 entries; TOC-Indexed + ////////////////////////////////////////////////////////////////////// + +__header_version: + .byte P9_XIP_HEADER_VERSION +__toc_normalized: + .byte 0 +__toc_sorted: + .byte 0 +__header_8_reserved: + .byte 0, 0, 0, 0, 0 + + .xip_toc header_version, P9_XIP_UINT8, __header_version + .xip_toc toc_normalized, P9_XIP_UINT8, __toc_normalized + .xip_toc toc_sorted, P9_XIP_UINT8, __toc_sorted + + + ////////////////////////////////////////////////////////////////////// + // Strings; 64 characters allocated; TOC-Indexed + ////////////////////////////////////////////////////////////////////// + +__build_user: + .asciz "unknown " # 16 Characters allocated +__build_host: + .asciz "unknown " # 24 characters allocated +__header_string_reserved: + .space 24, 0 + + .xip_toc build_user, P9_XIP_STRING, __build_user + .xip_toc build_host, P9_XIP_STRING, __build_host + + + .endm + + + .section .fixed, "a", @progbits + .section .fixed_toc, "a", @progbits + .section .loader_data, "a", @progbits + .section .loader_text, "a", @progbits + + .section .toc, "a", @progbits + .section .strings, "aS", @progbits + .section .base, "a", @progbits + + ..set_default_space IMAGE_SPACE_SEEPROM + P9XipHeader P9_XIP_MAGIC_SEEPROM, 0x80000000, 0x00000000, _sbe_image_size + + // Create the .fixed section + .proc_sbe_fixed_system + .proc_sbe_fixed_proc_chip + .proc_sbe_fixed_perv + .proc_sbe_fixed_core + .proc_sbe_fixed_ex + .proc_sbe_fixed_eq diff --git a/src/build/utils/base_sbe_fixed.S b/src/build/utils/base_sbe_fixed.S new file mode 100644 index 00000000..7474a38b --- /dev/null +++ b/src/build/utils/base_sbe_fixed.S @@ -0,0 +1,67 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/utils/base_sbe_fixed.S $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 */ +/// \file sbefixed.S +/// \brief code to generated fixed section in pibmem image +/// +#include "p9_xip_image.h" +#include "proc_sbe_fixed.H" + + + .macro ..checku, x:req, bits:req, err="Unsigned value too large" + + .if (((\bits) <= 0) || ((\bits) > 63)) + .error "The number of bits must be in the range 0 < bits < 64" + .endif + + .iflt (\x) + .error "An unsigned value is required here" + .endif + + .ifgt ((\x) - (0xffffffffffffffff >> (64 - (\bits)))) + .error "\err" + .endif + + .endm + + + .macro ..check_u16, u16 + ..checku (\u16), 16, "Unsigned immediate is larger than 16 bits" + .endm + + + .macro ..set_default_space, s + ..check_u16 (\s) + .set _PGAS_DEFAULT_SPACE, (\s) + .endm + + .section .fixed, "a", @progbits + + + // Create the .fixed section + .proc_sbe_fixed_system + .proc_sbe_fixed_proc_chip + .proc_sbe_fixed_perv + .proc_sbe_fixed_core + .proc_sbe_fixed_ex + .proc_sbe_fixed_eq diff --git a/src/build/utils/p9_sbe.H b/src/build/utils/p9_sbe.H new file mode 100644 index 00000000..36c281eb --- /dev/null +++ b/src/build/utils/p9_sbe.H @@ -0,0 +1,52 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/utils/p9_sbe.H $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 __P9_SBE_H +#define __P9_SBE_H + +/// \file p9_sbe.H +/// \brief A header to be included into all SBE assembler files and C++ +/// hardware procedures that interact with SBE images. +/// +/// This header #include-s all generally useful headers required for SBE code +/// development as well as defining other needed facilities. Note that any +/// sub-includes must be done in an assembler-safe way. + +#include "sbe_common.H" +//#include "p9_scom_addresses.H" +//#include "p9_istep_num.H" + +// The #include of fapiHwpReturnCodes.H must be made here (instead of in +// sbe_common.H) to guarantee that the P9-local copy is used. +//#include "fapiHwpReturnCodes.H" + +#ifdef __ASSEMBLER__ + + // p9_sbe.H 'recursively' inserts itself into any hook code extracted + // from an assembly context that includes p9_sbe.H. + + ##`#include "p9_sbe.H" + +#endif // __ASSEMBLER__ + +#endif // __P9_SBE_H diff --git a/src/build/utils/proc_sbe_fixed.H b/src/build/utils/proc_sbe_fixed.H new file mode 100644 index 00000000..9b06fb6f --- /dev/null +++ b/src/build/utils/proc_sbe_fixed.H @@ -0,0 +1,211 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/utils/proc_sbe_fixed.H $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 */ +//----------------------------------------------------------------------------- +// *! (C) Copyright International Business Machines Corp. 2014 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +//----------------------------------------------------------------------------- + +/// \file proc_sbe_fixed.H +/// \brief Define the layout of fixed-position data in the P9 SBE reference +/// and IPL images +/// +/// Contains struct ProcSbeFixed which contains functions, rings and +/// attributes whose pointers are stored in the fixed and fixed_toc section +/// +/// This file defines the layout of the special .fixed data section of P9 SBE +/// reference and IPL images. The .fixed section is guaranteed to appear at a +/// fixed offset from the beginning of the image, containing data required to +/// be manipulated when images are resident in non-volatile memories, thereby +/// avoiding having to search the TOC. Data manipulated during in-memory image +/// processing can always be easily located using the SBE-XIP TOC APIs. All +/// of the data stored in .fixed can also still be referenced via the SBE-XIP +/// TOC. +/// +/// This header file can be #include-ed into either C or SBE assembly language +/// source code. In C, it creates simple structures 'ProcChipAttributes', +/// 'PervAttributes', 'CoreAttributes', 'EQAttributes' and 'EXAttributes' that +/// contain attribute information that are sized per XML definition per entry. +/// +/// PPE image data is always stored big-endian, so applications on little-endian +/// hosts will need to perform the appropriate endian converison when reading or +/// writing images via this header. +/// +/// In assembler code, this header creates macros '.proc_sbe_fixed_proc_chip', +/// '.proc_sbe_fixed_perv', '.proc_sbe_fixed_core', '.proc_sbe_fixed_ex', +/// '.proc_sbe_fixed_eq', that is expanded exactly once in the file +/// 'sbe_base_header.S', creating the actual data allocation of the data +/// equivalent to the C structure. Assembler code references the data symbols +/// as normal. +/// +/// To simplify programming a 'mini-TOC' is also provided for this data in +/// the .fixed_toc section. This section is comprised of SbeXipHashedToc +/// structures. When a symbol is indedxed in .fixed, a blank SbeXipHashedToc +/// stucture is added to .fixed_toc. During image normalization the array of +/// SbeXipHashedToc is filled in as each symbol in .fixed is re-indexed into +/// .fixed_toc. + +#ifndef __PROC_SBE_FIXED_H__ +#define __PROC_SBE_FIXED_H__ + +#include "p9_sbe.H" +#include "plat_target_parms.H" +#include "fapi2AttributeIds.H" + +#ifdef __ASSEMBLER__ + .macro .proc_sbe_fixed_system + .section .fixed, "a", @progbits + .balign 8 + .global G_system_attributes +G_system_attributes: +#else + +extern "C" { +namespace fapi2attr { +typedef struct SystemAttributes_t { +#endif + +#include "proc_sbe_fixed_system.H" + +#ifdef __ASSEMBLER__ + .endm +#else +} SystemAttributes; +} // fapi2 +} // C +#endif + +#ifdef __ASSEMBLER__ + .macro .proc_sbe_fixed_proc_chip + .section .fixed, "a", @progbits + .balign 8 + .global G_proc_chip_attributes +G_proc_chip_attributes: +#else + +extern "C" { +namespace fapi2attr { +typedef struct ProcChipAttributes_t { +#endif + +#include "proc_sbe_fixed_proc_chip.H" + +#ifdef __ASSEMBLER__ + .endm +#else +} ProcChipAttributes; +} // fapi2 +} // C +#endif + +/// +/// Pervasive Target Attributes +#ifdef __ASSEMBLER__ + .macro .proc_sbe_fixed_perv + .section .fixed, "a", @progbits + .balign 8 + .global G_perv_attributes +G_perv_attributes: +#else +namespace fapi2attr { +typedef struct PervAttributes_t { +#endif + +#include "proc_sbe_fixed_perv.H" + +#ifdef __ASSEMBLER__ + .endm +#else +} PervAttributes; +} // fapi2 +#endif + +/// +/// Core (EC) Target Attributes +#ifdef __ASSEMBLER__ + .macro .proc_sbe_fixed_core + .section .fixed, "a", @progbits + .balign 8 + .global G_core_attributes +G_core_attributes: +#else +namespace fapi2attr { +typedef struct CoreAttributes_t { +#endif + +#include "proc_sbe_fixed_core.H" + +#ifdef __ASSEMBLER__ + .endm +#else +} CoreAttributes; +} // fapi2 +#endif + +/// +/// EX Target Attributes +#ifdef __ASSEMBLER__ + .macro .proc_sbe_fixed_ex + .section .fixed, "a", @progbits + .balign 8 + .global G_ex_attributes +G_ex_attributes: +#else +namespace fapi2attr { +typedef struct EXAttributes_t { +#endif + +#include "proc_sbe_fixed_ex.H" + +#ifdef __ASSEMBLER__ + .endm +#else +} EXAttributes; +} // fapi2 +#endif + +/// +/// EQ Target Attributes +#ifdef __ASSEMBLER__ + .macro .proc_sbe_fixed_eq + .section .fixed, "a", @progbits + .balign 8 + .global G_eq_attributes +G_eq_attributes: +#else +namespace fapi2attr { +typedef struct EQAttributes_t { +#endif + +#include "proc_sbe_fixed_eq.H" + +#ifdef __ASSEMBLER__ + .endm +#else +} EQAttributes; +} // fapi2 +#endif + + +#endif // __PROC_SBE_FIXED_H__ diff --git a/src/build/utils/sbe_common.H b/src/build/utils/sbe_common.H new file mode 100644 index 00000000..3cd8a0a0 --- /dev/null +++ b/src/build/utils/sbe_common.H @@ -0,0 +1,600 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/utils/sbe_common.H $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 __SBE_COMMON_H +#define __SBE_COMMON_H + +// $Id: Exp $ + +/// \file sbe_common.H + +/// \brief This header contains #include-s and macro definitions common to P8 +/// and Centaur SBE code development. It is #include-ed into p8_sbe.H and +/// cen_sbe.H which have other setup specific to each environment. + + +#include "sbe_link.H" +#include "p9_xip_image.h" +//#include "sbe_xip_header.H" + +/// Macros for generating the .fixed section +/// +/// The CPP macros PROC_SBE_FIXED_UINT64[_VECTOR] generate equivalent code +/// depending on whether they are being called from assembler (where they +/// actually create the .fixed section data) or from C (where they specifiy a +/// C-structure form of the contents of the .fixed section. +/// +/// In assembler each invocation also creates space in the .fixed_toc section +/// for a fixed TOC entry. Unlike the normal TOC no data is generated for +/// .fixed_toc by the data declaration. Instead, the fixed TOC table is +/// filled in during image normalization by normalizeToc (p9_xip_image.c) +/// which requires that there be one and only one fixed TOC entery allocated +/// per TOC entry referencing the .fixed section. This means that in the +/// current implementation it is not possible to create .fixed_toc entries +/// for addresses or for data stored in sections other than .fixed. + +#ifdef __ASSEMBLER__ + + .macro proc_sbe_fixed_uint8, symbol:req, tnumber=1, elements=1 + .global \symbol +\symbol\(): + .rept ((\tnumber)*(\elements)) + .byte 0 + .endr + + .xip_toc \symbol, P9_XIP_UINT8, \symbol, ((\tnumber)*(\elements)) + + .pushsection .fixed_toc + .space 8 + .popsection + + .endm + + .macro proc_sbe_fixed_int8, symbol:req, tnumber=1, elements=1 + .global \symbol +\symbol\(): + .rept ((\tnumber)*(\elements)) + .byte 0 + .endr + + .xip_toc \symbol, P9_XIP_INT8, \symbol, ((\tnumber)*(\elements)) + + .pushsection .fixed_toc + .space 8 + .popsection + + .endm + + .macro proc_sbe_fixed_uint16, symbol:req, tnumber=1, elements=1 + .balign 2 + .global \symbol +\symbol\(): + + .rept ((\tnumber)*(\elements)) + .byte 0,0 + .endr + + .xip_toc \symbol, P9_XIP_UINT16, \symbol, ((\tnumber)*(\elements)) + + .pushsection .fixed_toc + .space 8 + .popsection + + .endm + + .macro proc_sbe_fixed_int16, symbol:req, tnumber=1, elements=1 + .balign 2 + .global \symbol +\symbol\(): + + .rept ((\tnumber)*(\elements)) + .byte 0,0 + .endr + + .xip_toc \symbol, P9_XIP_INT16, \symbol, ((\tnumber)*(\elements)) + + .pushsection .fixed_toc + .space 8 + .popsection + + .endm + + .macro proc_sbe_fixed_uint32, symbol:req, tnumber=1, elements=1 + .balign 4 + .global \symbol +\symbol\(): + + .rept ((\tnumber)*(\elements)) + .long 0 + .endr + + .xip_toc \symbol, P9_XIP_UINT32, \symbol, ((\tnumber)*(\elements)) + + .pushsection .fixed_toc + .space 8 + .popsection + + .endm + + .macro proc_sbe_fixed_int32, symbol:req, tnumber=1, elements=1 + .balign 4 + .global \symbol +\symbol\(): + + .rept ((\tnumber)*(\elements)) + .long 0 + .endr + + .xip_toc \symbol, P9_XIP_INT32, \symbol, ((\tnumber)*(\elements)) + + .pushsection .fixed_toc + .space 8 + .popsection + + .endm + + .macro proc_sbe_fixed_uint64, symbol:req, tnumber=1, elements=1 + .balign 8 + .global \symbol +\symbol\(): + .rept ((\tnumber)*(\elements)) + .quad 0 + .endr + + .xip_toc \symbol, P9_XIP_UINT64, \symbol, ((\tnumber)*(\elements)) + + .pushsection .fixed_toc + .space 8 + .popsection + + .endm + + .macro proc_sbe_fixed_int64, symbol:req, tnumber=1, elements=1 + .balign 8 + .global \symbol +\symbol\(): + .rept ((\tnumber)*(\elements)) + .quad 0 + .endr + + .xip_toc \symbol, P9_XIP_INT64, \symbol, ((\tnumber)*(\elements)) + + .pushsection .fixed_toc + .space 8 + .popsection + + .endm + + .macro proc_sbe_fixed_quadia, symbol:req, space:req, address:req + .global \symbol +\symbol\(): + .quadia (\space), (\address) + + .xip_toc \symbol, P9_XIP_UINT64, \symbol + + .pushsection .fixed_toc + .space 8 + .popsection + + .endm + + +#define PROC_SBE_FIXED_UINT8(symbol) \ + proc_sbe_fixed_uint8 symbol + +#define PROC_SBE_FIXED_INT8(symbol) \ + proc_sbe_fixed_int8 symbol + +#define PROC_SBE_FIXED_UINT16(symbol) \ + proc_sbe_fixed_uint16 symbol + +#define PROC_SBE_FIXED_INT16(symbol) \ + proc_sbe_fixed_int16 symbol + +#define PROC_SBE_FIXED_UINT32(symbol) \ + proc_sbe_fixed_uint32 symbol + +#define PROC_SBE_FIXED_INT32(symbol) \ + proc_sbe_fixed_int32 symbol + +#define PROC_SBE_FIXED_UINT64(symbol) \ + proc_sbe_fixed_uint64 symbol + +#define PROC_SBE_FIXED_INT64(symbol) \ + proc_sbe_fixed_int64 symbol + +#define PROC_SBE_FIXED_UINT8_VECTOR(symbol, elements) \ + proc_sbe_fixed_uint8 symbol, 1, elements + +#define PROC_SBE_FIXED_INT8_VECTOR(symbol, elements) \ + proc_sbe_fixed_int8 symbol, 1, elements + +#define PROC_SBE_FIXED_UINT16_VECTOR(symbol, elements) \ + proc_sbe_fixed_uint16 symbol, 1, elements + +#define PROC_SBE_FIXED_INT16_VECTOR(symbol, elements) \ + proc_sbe_fixed_int16 symbol, 1, elements + +#define PROC_SBE_FIXED_UINT32_VECTOR(symbol, elements) \ + proc_sbe_fixed_uint32 symbol, 1, elements + +#define PROC_SBE_FIXED_INT32_VECTOR(symbol, elements) \ + proc_sbe_fixed_int32 symbol, 1, elements + +#define PROC_SBE_FIXED_UINT64_VECTOR(symbol, elements) \ + proc_sbe_fixed_uint64 symbol, 1, elements + +#define PROC_SBE_FIXED_INT64_VECTOR(symbol, elements) \ + proc_sbe_fixed_int64 symbol, 1, elements + +#define PROC_SBE_FIXED_UINT8_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_uint8 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_INT8_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_int8 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_UINT16_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_uint16 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_INT16_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_int16 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_UINT32_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_uint32 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_INT32_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_int32 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_UINT64_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_uint64 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_INT64_VECTOR_2(symbol, dim1, dim2 ) \ + proc_sbe_fixed_int64 symbol, 1, dim1 * dim2 + +#define PROC_SBE_FIXED_UINT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint8 symbol, 1, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_INT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint8 symbol, 1, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_UINT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint16 symbol, 1, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_INT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint16 symbol, 1, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_UINT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint32 symbol, 1, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_INT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint32 symbol, 1, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_UINT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint64 symbol, 1, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_INT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint64 symbol, 1, dim1 * dim2 * dim3 + +// Non-Chip Target Attributes + +#define PROC_SBE_FIXED_TARGET_UINT8(symbol, tnumber) \ + proc_sbe_fixed_uint8 symbol, tnumber + +#define PROC_SBE_FIXED_TARGET_INT8(symbol, tnumber) \ + proc_sbe_fixed_int8 symbol, tnumber + +#define PROC_SBE_FIXED_TARGET_UINT16(symbol, tnumber) \ + proc_sbe_fixed_uint16 symbol, tnumber + +#define PROC_SBE_FIXED_TARGET_INT16(symbol, tnumber) \ + proc_sbe_fixed_int16 symbol, tnumber + +#define PROC_SBE_FIXED_TARGET_UINT32(symbol, tnumber) \ + proc_sbe_fixed_uint32 symbol, tnumber + +#define PROC_SBE_FIXED_TARGET_INT32(symbol, tnumber) \ + proc_sbe_fixed_int32 symbol, tnumber + +#define PROC_SBE_FIXED_TARGET_UINT64(symbol, tnumber) \ + proc_sbe_fixed_uint64 symbol, tnumber + +#define PROC_SBE_FIXED_TARGET_INT64(symbol, tnumber) \ + proc_sbe_fixed_int64 symbol, tnumber + +#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR(symbol, tnumber, elements) \ + proc_sbe_fixed_uint8 symbol, tnumber, elements + +#define PROC_SBE_FIXED_TARGET_INT8_VECTOR(symbol, tnumber, elements) \ + proc_sbe_fixed_int8 symbol, tnumber, elements + +#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR(symbol, tnumber, elements) \ + proc_sbe_fixed_uint16 symbol, tnumber, elements + +#define PROC_SBE_FIXED_TARGET_INT16_VECTOR(symbol, tnumber, elements) \ + proc_sbe_fixed_int16 symbol, tnumber, elements + +#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR(symbol, tnumber, elements) \ + proc_sbe_fixed_uint32 symbol, tnumber, elements + +#define PROC_SBE_FIXED_TARGET_INT32_VECTOR(symbol, tnumber, elements) \ + proc_sbe_fixed_int32 symbol, tnumber, elements + +#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR(symbol, tnumber, elements) \ + proc_sbe_fixed_uint64 symbol, tnumber, elements + +#define PROC_SBE_FIXED_TARGET_INT64_VECTOR(symbol, tnumber, elements) \ + proc_sbe_fixed_int64 symbol, tnumber, elements + +#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + proc_sbe_fixed_uint8 symbol, tnumber, dim1 * dim2 + +#define PROC_SBE_FIXED_TARGET_INT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + proc_sbe_fixed_int8 symbol, tnumber, dim1 * dim2 + +#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + proc_sbe_fixed_uint16 symbol, tnumber, dim1 * dim2 + +#define PROC_SBE_FIXED_TARGET_INT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + proc_sbe_fixed_int16 symbol, tnumber, dim1 * dim2 + +#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + proc_sbe_fixed_uint32 symbol, tnumber, dim1 * dim2 + +#define PROC_SBE_FIXED_TARGET_INT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + proc_sbe_fixed_int32 symbol, tnumber, dim1 * dim2 + +#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + proc_sbe_fixed_uint64 symbol, tnumber, dim1 * dim2 + +#define PROC_SBE_FIXED_TARGET_INT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + proc_sbe_fixed_int64 symbol, tnumber, dim1 * dim2 + +#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint8 symbol, tnumber, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_TARGET_INT8_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint8 symbol, tnumber, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint16 symbol, tnumber, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_TARGET_INT16_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint16 symbol, tnumber, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint32 symbol, tnumber, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_TARGET_INT32_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint32 symbol, tnumber, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint64 symbol, tnumber, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_TARGET_INT64_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + proc_sbe_fixed_uint64 symbol, tnumber, dim1 * dim2 * dim3 + +#define PROC_SBE_FIXED_QUADIA(symbol, space, address) \ + proc_sbe_fixed_quadia symbol, (space), (address) + + +#else // __ASSEMBLER__ (eg the C portion) + +#define PROC_SBE_FIXED_UINT8(symbol) \ + uint8_t symbol + +#define PROC_SBE_FIXED_INT8(symbol) \ + int8_t symbol + +#define PROC_SBE_FIXED_UINT16(symbol) \ + uint16_t symbol + +#define PROC_SBE_FIXED_INT16(symbol) \ + int16_t symbol + +#define PROC_SBE_FIXED_UINT32(symbol) \ + uint32_t symbol + +#define PROC_SBE_FIXED_INT32(symbol) \ + int32_t symbol + +#define PROC_SBE_FIXED_UINT64(symbol) \ + uint64_t symbol + +#define PROC_SBE_FIXED_INT64(symbol) \ + int64_t symbol + +#define PROC_SBE_FIXED_UINT8_VECTOR(symbol, elements) \ + uint8_t symbol[elements] + +#define PROC_SBE_FIXED_INT8_VECTOR(symbol, elements) \ + int8_t symbol[elements] + +#define PROC_SBE_FIXED_UINT16_VECTOR(symbol, elements) \ + uint16_t symbol[elements] + +#define PROC_SBE_FIXED_INT16_VECTOR(symbol, elements) \ + int16_t symbol[elements] + +#define PROC_SBE_FIXED_UINT32_VECTOR(symbol, elements) \ + uint32_t symbol[elements] + +#define PROC_SBE_FIXED_INT32_VECTOR(symbol, elements) \ + int32_t symbol[elements] + +#define PROC_SBE_FIXED_UINT64_VECTOR(symbol, elements) \ + uint64_t symbol[elements] + +#define PROC_SBE_FIXED_INT64_VECTOR(symbol, elements) \ + int64_t symbol[elements] + +#define PROC_SBE_FIXED_UINT8_VECTOR_2(symbol, dim1, dim2 ) \ + uint8_t symbol[dim1][dim2] + +#define PROC_SBE_FIXED_INT8_VECTOR_2(symbol, dim1, dim2 ) \ + int8_t symbol[dim1][dim2] + +#define PROC_SBE_FIXED_UINT16_VECTOR_2(symbol, dim1, dim2 ) \ + uint16_t symbol[dim1][dim2] + +#define PROC_SBE_FIXED_INT16_VECTOR_2(symbol, dim1, dim2 ) \ + int16_t symbol[dim1][dim2] + +#define PROC_SBE_FIXED_UINT32_VECTOR_2(symbol, dim1, dim2 ) \ + uint32_t symbol[dim1][dim2] + +#define PROC_SBE_FIXED_INT32_VECTOR_2(symbol, dim1, dim2 ) \ + int32_t symbol[dim1][dim2] + +#define PROC_SBE_FIXED_UINT64_VECTOR_2(symbol, dim1, dim2 ) \ + uint64_t symbol[dim1][dim2] + +#define PROC_SBE_FIXED_INT64_VECTOR_2(symbol, dim1, dim2 ) \ + int64_t symbol[dim1][dim2] + +#define PROC_SBE_FIXED_UINT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + uint8_t symbol[dim1][dim2][dim3] + +#define PROC_SBE_FIXED_INT8_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + int8_t symbol[dim1][dim2][dim3] + +#define PROC_SBE_FIXED_UINT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + uint16_t symbol[dim1][dim2][dim3] + +#define PROC_SBE_FIXED_INT16_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + int16_t symbol[dim1][dim2][dim3] + +#define PROC_SBE_FIXED_UINT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + uint32_t symbol[dim1][dim2][dim3] + +#define PROC_SBE_FIXED_INT32_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + int32_t symbol[dim1][dim2][dim3] + +#define PROC_SBE_FIXED_UINT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + uint64_t symbol[dim1][dim2][dim3] + +#define PROC_SBE_FIXED_INT64_VECTOR_3(symbol, dim1, dim2, dim3 ) \ + int64_t symbol[dim1][dim2][dim3] + +// Non-Chip Target Attributes + +#define PROC_SBE_FIXED_TARGET_UINT8(symbol, tnumber) \ + uint8_t symbol[tnumber] + +#define PROC_SBE_FIXED_TARGET_INT8(symbol, tnumber) \ + int8_t symbol[tnumber] + +#define PROC_SBE_FIXED_TARGET_UINT16(symbol, tnumber) \ + uint16_t symbol[tnumber] + +#define PROC_SBE_FIXED_TARGET_INT16(symbol, tnumber) \ + int16_t symbol[tnumber] + +#define PROC_SBE_FIXED_TARGET_UINT32(symbol, tnumber) \ + uint32_t symbol[tnumber] + +#define PROC_SBE_FIXED_TARGET_INT32(symbol, tnumber) \ + int32_t symbol[tnumber] + +#define PROC_SBE_FIXED_TARGET_UINT64(symbol, tnumber) \ + uint64_t symbol[tnumber] + +#define PROC_SBE_FIXED_TARGET_INT64(symbol, tnumber) \ + int64_t symbol[tnumber] + +#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR(symbol, tnumber, elements) \ + uint8_t symbol[tnumber][elements] + +#define PROC_SBE_FIXED_TARGET_INT8_VECTOR(symbol, tnumber, elements) \ + int8_t symbol[tnumber][elements] + +#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR(symbol, tnumber, elements) \ + uint16_t symbol[tnumber][elements] + +#define PROC_SBE_FIXED_TARGET_INT16_VECTOR(symbol, tnumber, elements) \ + int16_t symbol[tnumber][elements] + +#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR(symbol, tnumber, elements) \ + uint32_t symbol[tnumber][elements] + +#define PROC_SBE_FIXED_TARGET_INT32_VECTOR(symbol, tnumber, elements) \ + int32_t symbol[tnumber][elements] + +#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR(symbol, tnumber, elements) \ + uint64_t symbol[tnumber][elements] + +#define PROC_SBE_FIXED_TARGET_INT64_VECTOR(symbol, tnumber, elements) \ + int64_t symbol[tnumber][elements] + +#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + uint8_t symbol[tnumber][dim1][dim2] + +#define PROC_SBE_FIXED_TARGET_INT8_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + int8_t symbol[tnumber][dim1][dim2] + +#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + uint16_t symbol[tnumber][dim1][dim2] + +#define PROC_SBE_FIXED_TARGET_INT16_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + int16_t symbol[tnumber][dim1][dim2] + +#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + uint32_t symbol[tnumber][dim1][dim2] + +#define PROC_SBE_FIXED_TARGET_INT32_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + int32_t symbol[tnumber][dim1][dim2] + +#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + uint64_t symbol[tnumber][dim1][dim2] + +#define PROC_SBE_FIXED_TARGET_INT64_VECTOR_2(symbol, tnumber, dim1, dim2 ) \ + int64_t symbol[tnumber][dim1][dim2] + +#define PROC_SBE_FIXED_TARGET_UINT8_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + uint8_t symbol[tnumber][dim1][dim2][dim3] + +#define PROC_SBE_FIXED_TARGET_INT8_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + int8_t symbol[tnumber][dim1][dim2][dim3] + +#define PROC_SBE_FIXED_TARGET_UINT16_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + uint16_t symbol[tnumber][dim1][dim2][dim3] + +#define PROC_SBE_FIXED_TARGET_INT16_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + int16_t symbol[tnumber][dim1][dim2][dim3] + +#define PROC_SBE_FIXED_TARGET_UINT32_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + uint32_t symbol[tnumber][dim1][dim2][dim3] + +#define PROC_SBE_FIXED_TARGET_INT32_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + int32_t symbol[tnumber][dim1][dim2][dim3] + +#define PROC_SBE_FIXED_TARGET_UINT64_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + uint64_t symbol[tnumber][dim1][dim2][dim3] + +#define PROC_SBE_FIXED_TARGET_INT64_VECTOR_3(symbol, tnumber, dim1, dim2, dim3 ) \ + int64_t symbol[tnumber][dim1][dim2][dim3] + +#define PROC_SBE_FIXED_QUADIA(symbol, space, address) uint64_t symbol + +#endif // __ASSEMBLER__ + +#endif // __SBE_COMMON_H diff --git a/src/build/utils/sbe_link.H b/src/build/utils/sbe_link.H new file mode 100644 index 00000000..0321a0a8 --- /dev/null +++ b/src/build/utils/sbe_link.H @@ -0,0 +1,102 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/build/utils/sbe_link.H $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 __SBE_LINK_H +#define __SBE_LINK_H + +// $Id: Exp $ + +/// \file sbe_link.H +/// \brief Constants required for linking SBE code images +/// +/// This header contains those cpp manifest constants required for processing +/// the linker scripts used to generate SBE code images. They may also be +/// useful for PPE assembler programming so they are included in sbe.H as +/// well. +/// +/// The link address of OTPROM code as a byte-address +/// +/// The OTPROM can be addressed both as an I2C slave and as a direct PIB +/// slave. The I2C slave is at PIB local address 0x0 and the PIB memory +/// interface is at local address 0x8000. SBE/IPL uses the PIB addressing +/// mode, so the OTPROM image is linked at 0x40000 (the byte-address +/// equivalent of 0x8000). +#define OTPROM_ORIGIN 0xC0000 + +/// The amount of memory contained in each OTPROM macro +#define OTPROM_BLOCK_SIZE 1024 + +/// The amount of memory reserved for OTPROM code +/// +/// This amount is exclusive of physical OTPROM memory reserved for compressed +/// scan ring images. +#define OTPROM_CODE_SIZE (1 * OTPROM_BLOCK_SIZE) + +/// The link address of the P9 SBE Base image +#define SBE_BASE_ORIGIN 0xFFFE8000 +/// SBE base image length ( 96 KB - 512 bytes for loader) +#define SBE_BASE_LENGTH 0x17DFF + +///This Index depends upon XIP HEADER File +// Start offset of sectionTable in XIP header. There are 8 entries +// of 8 byte each. +#define SBE_XIP_TOC_OFFSET 8*8 + +/// The link address of the P9 SBE Base image +#define SBE_SEEPROM_BASE_ORIGIN 0x80000000 + +/// This Index depends upon XIP HEADER File +/// Each section table entry is 12 bytes(SIZE_OF_SBE_XIP_SECTION) size, +// Base Loader is 10 th (P9_XIP_SECTION_BASELOADER) section +#define SBE_LOADER_BASE_SECTION SBE_SEEPROM_BASE_ORIGIN + SBE_XIP_TOC_OFFSET \ + + 120 +// Base Loader start address +#define SBE_LOADER_BASE_ORIGIN 0xFFFFFE00 +// Base Loader length +#define SBE_LOADER_BASE_LENGTH 0x200 + +// Base Loader entry function offset in header +#define SBE_LOADER_ENTRY_HEADER_OFFSET 20 + +/// The physical address offset where SBE-SEEPROM code is loaded +/// +/// This address *must* be a constant known to the OTPROM code. +#define SBE_SEEPROM_LOAD_ADDRESS 0x2000 + +/// The offset (in bytes) of the .fixed section in P9 SBE-XIP images +#define SBE_XIP_FIXED_OFFSET 512 + +/// The link address of the PIBMEM image +#define PIBMEM_ORIGIN 0 + +/// The amount of space available in the PIBMEM, in bytes (96KB) +#define PIBMEM_SIZE (96 * 1024) + +/// The fixed section of Otprom +#define OTPROM_FIXED_SIZE (OTPROM_ORIGIN + 0x340) + +/// Sbe fixed sction for the pibmem repair +#define SBE_FIXED_SECTION (SBE_SEEPROM_BASE_ORIGIN + SBE_XIP_TOC_OFFSET + 12) + +#endif // __SBE_LINK_H + diff --git a/src/build/utils/utils.mk b/src/build/utils/utils.mk new file mode 100644 index 00000000..e1fed401 --- /dev/null +++ b/src/build/utils/utils.mk @@ -0,0 +1,27 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/build/utils/utils.mk $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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 +BUILDDATA-S-SOURCES = base_ppe_header.S +BUILDDATA-S-SOURCES += base_sbe_fixed.S + +BUILDDATA_OBJECTS += $(BUILDDATA-S-SOURCES:.S=.o) diff --git a/src/test/citest/autocitest b/src/test/citest/autocitest deleted file mode 100755 index 088bb58b..00000000 --- a/src/test/citest/autocitest +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/citest/autocitest $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 -################################################################################ -## Simics automation using run-fsp-it -################################################################################ - -## verbose is the default. -VERBOSE=" --verbose" -if [ "$1" = "--quiet" ] ; then - VERBOSE="" - shift -fi - -## -## set up -## -DRIVER="$1" ## backing tree -export bb=$DRIVER ## simulate a workon - -export SHELL="/bin/bash" ## Needed to fool workon to launch a bash - ## shell, which autosim expects. -NOWIN="--nowin" ## remote execution does not have a display - -## jenkins creates a new workspace for every compile. -## sbetest-start.sh will verify this and then export WORKSPACE_DIR for us. -SBXHOME=$SBEROOT - -if [ "$DRIVER" = "" ] ; then - echo "ERROR: you must specify a driver (backing tree) to run the tests with" - usage - exit 1 -fi - -## let's get set up -cd $SANDBOXROOT - -echo "$0" -echo "VERBOSE = $VERBOSE" -echo "NOWIN = $NOWIN" -echo "BACKING_TREE = $DRIVER" -echo "SANDBOXRC = $SANDBOXRC" -echo "SBXHOME = $SBXHOME" -echo "AUTOSIM_FFDC_XML = $AUTOSIM_FFDC_XML" -echo "current directory is " `pwd` - - -timestamp=`date +'%H:%M:%S'` -echo "$timestamp Starting SBE test..." - -# Check preconditions for run-fsp-it -# This is just workaround. It is expected -# that user already either have this file -# or tokens have been taken by klog command. -# This is just to make run-fsp-it work in user -# sandbox -if [ -z $RUNNING_UNDER_JENKINS ] -then - mkdir -p ~/private - if [ ! -f ~/private/.p ]; then - echo "Creating p file" - touch ~/private/.p - fi - - if [ ! -f ~/private/password ]; then - echo "Creating passwd file" - touch ~/private/password - echo "dummy" > ~/private/password - fi -fi - -execute_in_sandbox "run-fsp-it $NOWIN --machine $MACHINE $SBE_TEST_XML" "ppc" || exit -1 - -exit 0 - diff --git a/src/test/citest/build-script b/src/test/citest/build-script deleted file mode 100755 index 5ad6b1bd..00000000 --- a/src/test/citest/build-script +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/citest/build-script $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2015,2016 -# -# -# 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 - -if [ -z $WORKSPACE ]; then - export WORKSPACE=`pwd` -fi - -if [ -z $SBEROOT ]; then - source "$WORKSPACE/env.bash" -fi - -source "$SBEROOT/src/test/citest/setup-env" - -# Check copyright. -#check-copyright > copyright.log 2>&1 & -#COPYRIGHT_PID=$! - - -# Build . -scl enable devtoolset-2 " bash -c \"make install\"" || exit -1 - -# Create simics sandbox. -create-sandbox > create-sandbox.log 2>&1 & -CREATESANDBOX_PID=$! - -# Check sandbox create completion. -wait $CREATESANDBOX_PID -if [ $? -eq 0 ]; then - cat create-sandbox.log -else - echo "----Sandbox creation failed." - cat create-sandbox.log - exit -1 -fi - -# Add SBE files to simics sandbox. -populate-sandbox || exit -1 - -sbetest-start.sh || exit -1 - -# Check copyright completion. -#wait $COPYRIGHT_PID -#if [ $? -eq 0 ]; then -# cat copyright.log -#else -# echo "----Copyright check failed." -# cat copyright.log -# exit -1 -#fi - diff --git a/src/test/citest/check-copyright b/src/test/citest/check-copyright deleted file mode 100755 index 28db5512..00000000 --- a/src/test/citest/check-copyright +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/citest/check-copyright $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -COPYRIGHT_CHECK=${SBEROOT}/src/test/citest/copyright-check.sh -COMMIT_CHECK=${SBEROOT}/src/tools/hooks/verify-commit - -$COPYRIGHT_CHECK || exit -1 -$COMMIT_CHECK || exit -1 diff --git a/src/test/citest/copyright-check.sh b/src/test/citest/copyright-check.sh deleted file mode 100755 index 3d7c5d54..00000000 --- a/src/test/citest/copyright-check.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/citest/copyright-check.sh $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -# -# Front end to addCopyright - script to check for copyright block during -# Gerrit checkin. -# - -export WORKSPACE_DIR=`pwd` -export ADDCOPYRIGHT=${WORKSPACE_DIR}/src/tools/hooks/addCopyright - -## run git show to get a list of checked in files -CHECKINFILES=`git show --pretty=format: --name-only -n1 | tr '\n' ' '` -## use git log to determine the year of the commit. -## Since commits have their copyright updated at the time they are -## committed, a commit might have a copyright date in its prolog of -## last year. Set the DATE_OVERRIDE variable to the 'validate' to allow -## slightly-old prologs (ie. ones corresponding to the date in the msg). -export DATE_OVERRIDE=`git log -n1 --date=short | grep "Date" | sed "s/Date: *//" | sed "s/-.*//"` - -echo "========================================================================" - -echo " Checking Copyright blocks for checked-in files:" -echo " $CHECKINFILES" -echo -$ADDCOPYRIGHT validate $CHECKINFILES --copyright-check - -if [ $? -eq 0 ]; then - echo "Copyright Check passed OK, $?" - exit 0 -else - echo "ERROR: $?" - exit 1 -fi diff --git a/src/test/citest/create-sandbox b/src/test/citest/create-sandbox deleted file mode 100755 index b6a1e7e8..00000000 --- a/src/test/citest/create-sandbox +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/citest/create-sandbox $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2015,2016 -# -# -# 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 - -echo "Creating ODE sandbox..." - -# Ensure backing build is accessible. -if [ ! -d "$BACKING_BUILD" ]; -then - echo "Cannot access the backing build: $BACKING_BUILD" - exit -1 -fi - -# Delete existing sandbox if it exists. -if [ -d "$SANDBOXBASE" ]; -then - echo "----Removing old sandbox." - mksb -undo -auto -rc $SANDBOXRC -dir $SANDBOXROOT -sb $SANDBOXNAME -fi -if [ -d "$SANDBOXBASE" ]; -then - rm -rf $SANDBOXBASE -fi - -# Create sandbox. -mksb -rc $SANDBOXRC -dir $SANDBOXROOT -back $BACKING_BUILD -sb $SANDBOXNAME \ - -m ppc -auto || exit -1 - -# workaround scripts expect $sb variable to be populated. -export sb=$SANDBOXBASE/src - -execute_in_sandbox "ecc --inject ${SBE_IMG_OUT_LOC}/sbe_seeprom.bin --output ${SBE_IMG_OUT_LOC}/sbe_seeprom.bin.ecc --p8 " "ppc" || exit -1 - -# Run presimsetup workarounds. -echo "----Running presimsetup workarounds." -if [ -f ${CITESTPATH}/etc/workarounds.presimsetup ]; -then - ${CITESTPATH}/etc/workarounds.presimsetup || exit -1 -fi - -# Run start_simics to populate simics directories. -echo "----Setting up simics." -execute_in_sandbox "start_simics -no_start -machine $MACHINE -batch_mode" \ - "ppc" || exit -1 - -# Run postsimsetup workarounds. -echo "----Running postsimsetup workarounds." -if [ -f ${CITESTPATH}/etc/workarounds.postsimsetup ]; -then - ${CITESTPATH}/etc/workarounds.postsimsetup || exit -1 -fi - diff --git a/src/test/citest/etc/patches/chip.act.patch b/src/test/citest/etc/patches/chip.act.patch deleted file mode 100644 index 0b9cf0f0..00000000 --- a/src/test/citest/etc/patches/chip.act.patch +++ /dev/null @@ -1,146 +0,0 @@ -184,240c184 -< # ========================================================================== -< # Actions for p9_adu_access and p9_adu_setup procedures -< # ========================================================================== -< #If a read/write is done to the ALTD_DATA Register set the ALTD_STATUS Register so things are as expected -< CAUSE_EFFECT{ -< LABEL=[ADU Read or write to set ALTD_STATUS Register] -< #If the data register is read -< WATCH_READ=[REG(0x00090004)] -< #If the data register is written -< WATCH=[REG(0x00090004)] -< -< #Set the ALTD_STATUS Register so these bits are set: -< #FBC_ALTD_BUSY = WAIT_CMD_ARBIT = WAIT_RESP = OVERRUN_ERR = AUTOINC_ERR = COMMAND_ERR = ADDRESS_ERR = COMMAND_HANG_ERR = DATA_HANG_ERR = PBINIT_MISSING = ECC_CE = ECC_UE = ECC_SUE = 0 -< EFFECT: TARGET=[REG(0x00090003)] OP=[BUF,AND] DATA=[LITERAL(64,001FDFFF FFFF1FFF)] -< EFFECT: TARGET=[REG(0x00090003)] OP=[BUF,OR] DATA=[LITERAL(64,30000000 00000000)] -< } -< -< #If a read/write is done to the ALTD_DATA Register and the Address only bit is not set then set the DATA_DONE bit to 1 -< CAUSE_EFFECT{ -< LABEL=[ADU Read or write to set ALTD_STATUS[DATA_DONE] bit] -< #If the data register is read -< WATCH_READ=[REG(0x00090004)] -< #If the data register is written -< WATCH=[REG(0x00090004)] -< CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[6] -< -< #Set the DATA_DONE bit -< EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[3] -< } -< -< #If a read/write is done to the ALTD_DATA Register and the Data only bit is not set then set the ADDR_DONE bit to 1 -< CAUSE_EFFECT{ -< LABEL=[ADU Read or write to set ALTD_STATUS[ADDR_DONE] bit] -< #If the data register is read -< WATCH_READ=[REG(0x00090004)] -< #If the data register is written -< WATCH=[REG(0x00090004)] -< CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[7] -< -< #Set the ADDR_DONE bit -< EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[2] -< } -< -< #If a read is done to the ALTD_CMD Register and it sets the lock set the ALTD_STATUS Register so the ALTD_STATUS_BUSY bit is set -< CAUSE_EFFECT{ -< LABEL=[ADU Write to set ALTD_STATUS_BUSY] -< WATCH=[REG(0x00090001)] -< CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[11] -< -< #Set the ALTD_STATUS Register so the ALTD_STATUS_BUSY bit is set -< EFFECT: TARGET=[REG(0x090003)] OP=[BIT,ON] BIT=[0] -< } -< #If a write is done to the ALD_CMD_REG to set the FBC_ALTD_START_OP bit it should turn FBC_ALTD_BUSY off -< CAUSE_EFFECT{ -< LABEL=[ADU Write to ALTD_CMD_REG to unset set ALTD_STATUS FBC_ALTD_BUSY bit] -< WATCH=[REG(0x00090001)] -< CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[2] ---- -> ### ADU ACTIONS - READ WRITE RESET ### -242,243c186,265 -< #Unset the ALTD_STATUS Register so the ALTD_STATUS_BUSY is unset -< EFFECT: TARGET=[REG(0x090003)] OP=[BIT,OFF] BIT=[0] ---- -> # Reset ALTD Status Reg -> CAUSE_EFFECT { -> LABEL=[RESET FSM ALTD Status Register] -> WATCH=[REG(0x00090001)] # ALTD_Cmd_Reg -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[4] #Reset FSM bit -> EFFECT: TARGET=[REG(0x00090003)] OP=[EQUALTO,BUF] DATA=[LITERAL(64,00000000 00000000)] -> } -> -> # ADU Transaction Complete Status - Busy Bit Low -> CAUSE_EFFECT { -> LABEL=[ALTD_BUSY Status Register Clear] -> WATCH=[REG(0x00090003)] # ALTD_Status_Reg -> CAUSE: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[2] #FBC_ALTD_ADDR_DONE -> CAUSE: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[3] #FBC_ALTD_DATA_DONE -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[19] #AUTO INCR Mode OFF -> -> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,OFF] BIT=[0] #BUSY Bit low -> } -> -> # Read without AutoIncr -> CAUSE_EFFECT{ -> LABEL=[READ Mainstore without AutoIncr] -> WATCH=[REG(0x00090001)] # ALTD_Cmd_Reg -> -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[2] #start ADU Operation -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[5] #READ ADU Operation -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[6] #addr Only Type Command -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[7] #data -> -> EFFECT: TARGET=[MODULE(readMainstore, 0x00090000)] OP=[MODULECALL] DATA=[REG(0x00090004)] # read the memory -> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[2] #FBC_ALTD_ADDR_DONE -> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[3] #FBC_ALTD_DATA_DONE -> } -> -> # Read with AutoIncr -> CAUSE_EFFECT{ -> LABEL=[READ Mainstore with AutoIncr] -> WATCH_READ=[REG(0x00090004)] # ALTD_Data_reg -> -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[2] #start ADU Operation -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[5] #READ ADU Operation -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[6] #addr Only Type Command -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[7] #data -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[19] #AutoInc bit on -> -> EFFECT: TARGET=[MODULE(readMainstore, 0x00090000)] OP=[MODULECALL] DATA=[REG(0x00090004)] # read the memory -> EFFECT: TARGET=[REG(0x00090000)] OP=[INCREMENT,MASK] INCVAL=[8] MASK=[LITERAL(64,00000000 0000FFFF)] # incr addr reg by 8 -> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[2] #FBC_ALTD_ADDR_DONE -> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[3] #FBC_ALTD_DATA_DONE -> } -> -> # Write without AutoIncr -> CAUSE_EFFECT{ -> LABEL=[WRITE Mainstore without AutoIncr] -> WATCH=[REG(0x00090001)] # ALTD_Cmd_Reg -> WATCH=[REG(0x00090004)] # ALTD_Data_reg -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[2] #start ADU Operation -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[5] #WRITE ADU Operation -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[6] #addr Only Type Command -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[7] #data -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[19] #AutoInc bit off -> EFFECT: TARGET=[MODULE(writeMainstore, 0x00090000)] OP=[MODULECALL] DATA=[REG(0x00090004)] # write the memory -> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[2] #FBC_ALTD_ADDR_DONE -> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[3] #FBC_ALTD_DATA_DONE -> } -> -> # Write with AutoIncr -> CAUSE_EFFECT{ -> LABEL=[WRITE Mainstore with AutoIncr] -> WATCH=[REG(0x00090001)] # ALTD_Cmd_reg -> WATCH=[REG(0x00090004)] # ALTD_Data_reg -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[2] #start ADU Operation -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[5] #WRITE ADU Operation -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[6] #addr Only Type Command -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[7] #data -> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[19] #AutoInc bit on -> EFFECT: TARGET=[MODULE(writeMainstore, 0x00090000)] OP=[MODULECALL] DATA=[REG(0x00090004)] # write the memory -> EFFECT: TARGET=[REG(0x00090000)] OP=[INCREMENT,MASK] INCVAL=[8] MASK=[LITERAL(64, 00000000 0000FFFF)] # incr addr reg by 8 -> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[2] #FBC_ALTD_ADDR_DONE -> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[3] #FBC_ALTD_DATA_DONE -265a288 -> EFFECT: TARGET=[MODULE(executeInstruction, MYCORE)] OP=[MODULECALL] DATA=[REG(MYCHIPLET, 0x00010A4F)] diff --git a/src/test/citest/etc/patches/patchlist.txt b/src/test/citest/etc/patches/patchlist.txt deleted file mode 100644 index 4fd0444a..00000000 --- a/src/test/citest/etc/patches/patchlist.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Example Format -#Brief description of the problem or reason for patch -#-RTC: Task/Story used to remove this patch -#-CQ: Defect/Req for checking the changes into fips910 -#-Files: list of files -#-Coreq: list of associated changes, e.g. workarounds.presimsetup - -RTC: 144728 -Files : pervasive.act.patch. Currently SUET does not support FSIMBOX KW. Once - support is in, remove this patch. - -RTC: 128984 -Files: chip.act.patch. Added call for executeInstruction module call. - p9.inst.patch. Added P9 specific commands for ramming. diff --git a/src/test/citest/etc/patches/pervasive.act.patch b/src/test/citest/etc/patches/pervasive.act.patch deleted file mode 100644 index 5531bef6..00000000 --- a/src/test/citest/etc/patches/pervasive.act.patch +++ /dev/null @@ -1,28 +0,0 @@ -55c55 -< WATCH=[REG(0x00050018)] ---- -> WATCH=[FSIMBOX(0x18)] -57c57 -< CAUSE: TARGET=[REG(0x00050018)] OP=[BIT,OFF] BIT=[12] ---- -> CAUSE: TARGET=[FSIMBOX(0x18)] OP=[BIT,OFF] BIT=[12] -59c59 -< CAUSE: TARGET=[REG(0x00050018)] OP=[BIT,OFF] BIT=[0] ---- -> CAUSE: TARGET=[FSIMBOX(0x18)] OP=[BIT,OFF] BIT=[0] -67c67 -< WATCH=[REG(0x00050018)] ---- -> WATCH=[FSIMBOX(0x18)] -69c69 -< CAUSE: TARGET=[REG(0x00050018)] OP=[BIT,OFF] BIT=[4] ---- -> CAUSE: TARGET=[FSIMBOX(0x18)] OP=[BIT,OFF] BIT=[4] -78c78 -< WATCH=[REG(0x00050018)] ---- -> WATCH=[FSIMBOX(0x18)] -80c80 -< CAUSE: TARGET=[REG(0x00050018)] OP=[BIT,OFF] BIT=[4] ---- -> CAUSE: TARGET=[FSIMBOX(0x18)] OP=[BIT,OFF] BIT=[4] diff --git a/src/test/citest/etc/patches/powermgmt.act.patch b/src/test/citest/etc/patches/powermgmt.act.patch deleted file mode 100644 index efb03845..00000000 --- a/src/test/citest/etc/patches/powermgmt.act.patch +++ /dev/null @@ -1,1057 +0,0 @@ -43,112d42 -< ## Actions for Procedure - p9_pm_occ_control -< ## -< -< CAUSE_EFFECT { -< LABEL=[PPC405 HALT] -< WATCH=[REG(0x0006D006)] -< CAUSE: TARGET=[REG(0x0006D006)] OP=[EQUALTO,BUF] DATA=[LITERAL(64, 02000000 00000000)] -< #suet PPC405_UNHALT:tc1- EFFECT: TARGET=[REG(0x01010800)] OP=[BIT,OFF] BIT=[31] -< EFFECT: TARGET=[REG(0x01010800)] OP=[BIT,ON] BIT=[31] -< } -< -< ## -< ## Actions for Procedure - p9_pm_occ_gpe_init -< ## -< -< CAUSE_EFFECT { -< LABEL=[OCC GPE0 HALT] -< WATCH=[REG(0x00060010)] -< CAUSE: TARGET=[REG(0x00060010)] OP=[BIT,OFF] BIT=[1] -< CAUSE: TARGET=[REG(0x00060010)] OP=[BIT,OFF] BIT=[2] -< CAUSE: TARGET=[REG(0x00060010)] OP=[BIT,ON] BIT=[3] -< #suet OCCGPE0_HALT_FAIL:tc1- EFFECT: TARGET=[REG(0x00060021)] OP=[BIT,OFF] BIT=[0] -< EFFECT: TARGET=[REG(0x00060021)] OP=[BIT,ON] BIT=[0] -< } -< -< CAUSE_EFFECT { -< LABEL=[OCC GPE1 HALT] -< WATCH=[REG(0x00062010)] -< CAUSE: TARGET=[REG(0x00062010)] OP=[BIT,OFF] BIT=[1] -< CAUSE: TARGET=[REG(0x00062010)] OP=[BIT,OFF] BIT=[2] -< CAUSE: TARGET=[REG(0x00062010)] OP=[BIT,ON] BIT=[3] -< #suet OCCGPE1_HALT_FAIL:tc1- EFFECT: TARGET=[REG(0x00062021)] OP=[BIT,OFF] BIT=[0] -< EFFECT: TARGET=[REG(0x00062021)] OP=[BIT,ON] BIT=[0] -< } -< -< # Upon writing the PU_OCB_PIB_OCR[DBG_HALT} bit, set the OCCLFIR_PPC405_DBGSTOPACK_BIT. -< CAUSE_EFFECT { -< LABEL=[PPC405 SAFE_HALT] -< WATCH=[REG(00x0006D002)] -< CAUSE: TARGET=[REG(0x0006D002)] OP=[EQUALTO,BUF] DATA=[LITERAL(64, 00200000 00000000)] -< EFFECT: TARGET=[REG(0x01010800)] OP=[BIT,ON] BIT=[31] -< } -< -< -< ## -< ## Actions for Procedure - p9_pm_occ_gpe_init -< ## -< -< CAUSE_EFFECT { -< LABEL=[OCC GPE0 HALT] -< WATCH=[REG(0x00060010)] -< CAUSE: TARGET=[REG(0x00060010)] OP=[BIT,OFF] BIT=[1] -< CAUSE: TARGET=[REG(0x00060010)] OP=[BIT,OFF] BIT=[2] -< CAUSE: TARGET=[REG(0x00060010)] OP=[BIT,ON] BIT=[3] -< #suet OCCGPE0_HALT_FAIL:tc1- EFFECT: TARGET=[REG(0x00060021)] OP=[BIT,OFF] BIT=[0] -< EFFECT: TARGET=[REG(0x00060021)] OP=[BIT,ON] BIT=[0] -< } -< -< CAUSE_EFFECT { -< LABEL=[OCC GPE1 HALT] -< WATCH=[REG(0x00062010)] -< CAUSE: TARGET=[REG(0x00062010)] OP=[BIT,OFF] BIT=[1] -< CAUSE: TARGET=[REG(0x00062010)] OP=[BIT,OFF] BIT=[2] -< CAUSE: TARGET=[REG(0x00062010)] OP=[BIT,ON] BIT=[3] -< #suet OCCGPE1_HALT_FAIL:tc1- EFFECT: TARGET=[REG(0x00062021)] OP=[BIT,OFF] BIT=[0] -< EFFECT: TARGET=[REG(0x00062021)] OP=[BIT,ON] BIT=[0] -< } -< -< -< ## -134,409c64 -< -< ## Core0 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x200F0110)] -< CAUSE: TARGET=[REG(0x200F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x200F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x200F0110)] -< EFFECT: TARGET=[REG(0x200F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x200F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x200F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x200F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core0 End -< -< ## Core1 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x210F0110)] -< CAUSE: TARGET=[REG(0x210F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x210F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x210F0110)] -< EFFECT: TARGET=[REG(0x210F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x210F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x210F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x210F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core1 End -< -< ## Core2 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x220F0110)] -< CAUSE: TARGET=[REG(0x220F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x220F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x200F0110)] -< EFFECT: TARGET=[REG(0x220F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x220F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x220F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x220F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core2 End -< -< ## Core3 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x230F0110)] -< CAUSE: TARGET=[REG(0x230F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x230F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x230F0110)] -< EFFECT: TARGET=[REG(0x230F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x230F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x230F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x230F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core3 End -< -< ## Core4 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x240F0110)] -< CAUSE: TARGET=[REG(0x240F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x240F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x240F0110)] -< EFFECT: TARGET=[REG(0x240F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x240F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x240F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x240F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core4 End -< -< ## Core5 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x250F0110)] -< CAUSE: TARGET=[REG(0x250F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x250F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x250F0110)] -< EFFECT: TARGET=[REG(0x250F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x250F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x250F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x250F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core5 End -< -< ## Core6 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x260F0110)] -< CAUSE: TARGET=[REG(0x260F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x260F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x200F0110)] -< EFFECT: TARGET=[REG(0x260F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x260F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x260F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x260F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core6 End -< -< ## Core7 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x270F0110)] -< CAUSE: TARGET=[REG(0x270F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x270F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x270F0110)] -< EFFECT: TARGET=[REG(0x270F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x270F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x270F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x270F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core7 End -< -< ## Core8 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x280F0110)] -< CAUSE: TARGET=[REG(0x280F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x280F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x280F0110)] -< EFFECT: TARGET=[REG(0x280F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x280F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x280F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x200F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core8 End -< -< ## Core9 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x290F0110)] -< CAUSE: TARGET=[REG(0x290F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x290F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x290F0110)] -< EFFECT: TARGET=[REG(0x290F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x290F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x290F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x290F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core9 End -< -< ## Core10 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x2A0F0110)] -< CAUSE: TARGET=[REG(0x2A0F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x2A0F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x2A0F0110)] -< EFFECT: TARGET=[REG(0x2A0F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2A0F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2A0F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2A0F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core10 End -< -< ## Core11 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x2B0F0110)] -< CAUSE: TARGET=[REG(0x2B0F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x2B0F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x2B0F0110)] -< EFFECT: TARGET=[REG(0x2B0F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2B0F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2B0F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2B0F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core11 End -< -< ## Core12 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x2C0F0110)] -< CAUSE: TARGET=[REG(0x2C0F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x2C0F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x2C0F0110)] -< EFFECT: TARGET=[REG(0x2C0F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2C0F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2C0F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2C0F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core12 End -< -< ## Core13 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x2D0F0110)] -< CAUSE: TARGET=[REG(0x2D0F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x2D0F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x2D0F0110)] -< EFFECT: TARGET=[REG(0x2D0F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2D0F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2D0F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2D0F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core13 End -< -< ## Core14 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x2E0F0110)] -< CAUSE: TARGET=[REG(0x2E0F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x2E0F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x2E0F0110)] -< EFFECT: TARGET=[REG(0x2E0F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2E0F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2E0F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2E0F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core14 End -< -< ## Core15 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x2F0F0110)] -< CAUSE: TARGET=[REG(0x2F0F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x2F0F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x2F0F0110)] -< EFFECT: TARGET=[REG(0x2F0F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2F0F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2F0F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x2F0F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core15 End -< -< ## Core16 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x300F0110)] -< CAUSE: TARGET=[REG(0x300F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x300F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x300F0110)] -< EFFECT: TARGET=[REG(0x300F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x300F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x300F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x300F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core16 End -< -< ## Core17 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x310F0110)] -< CAUSE: TARGET=[REG(0x310F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x310F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x310F0110)] -< EFFECT: TARGET=[REG(0x310F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x310F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x310F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x310F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core17 End -< -< ## Core18 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x320F0110)] -< CAUSE: TARGET=[REG(0x320F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x320F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x320F0110)] -< EFFECT: TARGET=[REG(0x320F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x320F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x320F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x320F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core18 End -< -< ## Core19 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x330F0110)] -< CAUSE: TARGET=[REG(0x330F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x330F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x330F0110)] -< EFFECT: TARGET=[REG(0x330F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x330F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x330F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x330F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core19 End -< -< ## Core20 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x340F0110)] -< CAUSE: TARGET=[REG(0x340F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x340F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x340F0110)] -< EFFECT: TARGET=[REG(0x340F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x340F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x340F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x340F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core20 End -< -< ## Core21 Start -< CAUSE_EFFECT { ---- -> CAUSE_EFFECT CHIPLETS ec { -411,478c66,89 -< WATCH=[REG(0x350F0110)] -< CAUSE: TARGET=[REG(0x350F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x350F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x350F0110)] -< EFFECT: TARGET=[REG(0x350F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x350F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x350F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x350F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core21 End -< -< ## Core22 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x360F0110)] -< CAUSE: TARGET=[REG(0x360F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x360F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x360F0110)] -< EFFECT: TARGET=[REG(0x360F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x360F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x360F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x360F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core22 End -< -< ## Core23 Start -< CAUSE_EFFECT { -< LABEL=[SSH_SRC_WRITE] -< WATCH=[REG(0x370F0110)] -< CAUSE: TARGET=[REG(0x370F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x370F0110)] -< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x370F0110)] -< EFFECT: TARGET=[REG(0x370F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x370F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x370F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< EFFECT: TARGET=[REG(0x370F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -< } -< ## Core23 End -< -< ## -< # Actions for Procedure - p9_block_wakeup_intr -< ## -< -< # Core Power Management Mode Register -< CAUSE_EFFECT { -< LABEL=[CPMMR Write OR of PPM Write Override] -< WATCH=[REG(0x290F0108)] -< CAUSE: TARGET=[REG(0x290F0108)] OP=[BIT,ON] BIT=[1] -< EFFECT: TARGET=[REG(0x290F0106)] OP=[BIT,ON] BIT=[1] -< } -< -< CAUSE_EFFECT { -< LABEL=[CPMMR Write CLEAR of PPM Write Override] -< WATCH=[REG(0x290F0107)] -< CAUSE: TARGET=[REG(0x290F0107)] OP=[BIT,ON] BIT=[1] -< EFFECT: TARGET=[REG(0x290F0106)] OP=[BIT,OFF] BIT=[1] -< } -< -< # General Power Management Mode Register -< CAUSE_EFFECT { -< LABEL=[GPMMR Write OR of Block Wakeup Events] -< WATCH=[REG(0x290F0102)] -< CAUSE: TARGET=[REG(0x290F0102)] OP=[BIT,ON] BIT=[6] -< EFFECT: TARGET=[REG(0x290F0100)] OP=[BIT,ON] BIT=[6] -< } -< -< CAUSE_EFFECT { -< LABEL=[GPMMR Write CLEAR of PPM Write Override] -< WATCH=[REG(0x290F0101)] -< CAUSE: TARGET=[REG(0x290F0101)] OP=[BIT,ON] BIT=[6] -< EFFECT: TARGET=[REG(0x290F0100)] OP=[BIT,OFF] BIT=[6] ---- -> WATCH=[REG(MYCHIPLET, 0x0F0110)] -> CAUSE: TARGET=[REG(MYCHIPLET, 0x0F0110)] OP=[EQUALTO,BUF] DATA=[REG(MYCHIPLET, 0x0F0110)] -> EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(MYCHIPLET, 0x0F0110)] -> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] -> } -> -> ## Action triggered when all threads are idle -> # Used for istep 16 to have hostboot properly wake up on SBE-set PSU -> # interrupt as well as to have p9_sbe_check_master_stop15.C properly -> # execute in firmware simics. -> # TODO: RTC 147787 -> CAUSE_EFFECT CHIPLETS ec { -> LABEL=[Master Winkle LPCR] -> WATCH=[IDLESTATE(MYCHIPLET,0x0)] -> # look for stop15 -> CAUSE: TARGET=[IDLESTATE(MYCHIPLET,0x0)] OP=[EQUALTO,BUF,MASK] DATA=[LITERAL(32,0F000000)] MASK=[LITERAL(32,FF000000)] -> # Restore LPCR for wake-up options. -> EFFECT: TARGET=[PROCREG(lpcr, MYCORE, 0)] OP=[BIT,ON] BIT=[17] -> EFFECT: TARGET=[PROCREG(lpcr, MYCORE, 0)] OP=[BIT,ON] BIT=[49] -> # Set required C_PPM_SSHOTR register required by procedure -> EFFECT: TARGET=[REG(0x200F0113)] OP=[EQUALTO,BUF] DATA=[LITERAL(64,8BB00000 FFFFFFFF)] -514c125 -< ## Actions for p9_pm_ocb_init ---- -> # Actions for Procedure - p9_hcd_core_poweron / p9_hcd_cache_poweron -517,524c128,133 -< CAUSE_EFFECT { -< LABEL=[Channel 0 linear stream] -< WATCH=[REG(0x0006D013)] -< WATCH=[REG(0x0006D012)] -< CAUSE: TARGET=[REG(0x0006D013)] OP=[BIT,ON] BIT=[4] -< CAUSE: TARGET=[REG(0x0006D012)] OP=[BIT,ON] BIT=[5] -< EFFECT: TARGET=[REG(0x0006D011)] OP=[BIT,ON] BIT=[4] -< EFFECT: TARGET=[REG(0x0006D011)] OP=[BIT,OFF] BIT=[5] ---- -> CAUSE_EFFECT CHIPLETS ec cache { -> LABEL=[Power on core/cache vdd pfet then fsm is idle and sense is enabled] -> WATCH=[REG(MYCHIPLET, 0x0F011A)] -> CAUSE: TARGET=[REG(MYCHIPLET, 0x0F011A)] OP=[BIT,ON] BIT=[0] -> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F0118)] OP=[BIT,ON] BIT=[42] -> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F011C)] OP=[BIT,ON] BIT=[0] -527,1071c136 -< CAUSE_EFFECT { -< LABEL=[Channel 1 linear stream] -< WATCH=[REG(0x0006D033)] -< WATCH=[REG(0x0006D032)] -< CAUSE: TARGET=[REG(0x0006D033)] OP=[BIT,ON] BIT=[4] -< CAUSE: TARGET=[REG(0x0006D032)] OP=[BIT,ON] BIT=[5] -< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,ON] BIT=[4] -< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,OFF] BIT=[5] -< } -< -< CAUSE_EFFECT { -< LABEL=[Channel 1 circular push interupt enable] -< WATCH=[REG(0x0006D033)] -< CAUSE: TARGET=[REG(0x0006D033)] OP=[BIT,ON] BIT=[3] -< CAUSE: TARGET=[REG(0x0006D033)] OP=[BIT,ON] BIT=[4] -< CAUSE: TARGET=[REG(0x0006D033)] OP=[BIT,ON] BIT=[5] -< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,ON] BIT=[3] -< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,ON] BIT=[4] -< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,ON] BIT=[5] -< } -< -< CAUSE_EFFECT { -< LABEL=[Channel 1 circular push interrupt disable] -< WATCH=[REG(0x0006D033)] -< WATCH=[REG(0x0006D032)] -< CAUSE: TARGET=[REG(0x0006D032)] OP=[BIT,ON] BIT=[3] -< CAUSE: TARGET=[REG(0x0006D033)] OP=[BIT,ON] BIT=[4] -< CAUSE: TARGET=[REG(0x0006D033)] OP=[BIT,ON] BIT=[5] -< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,OFF] BIT=[3] -< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,ON] BIT=[4] -< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,ON] BIT=[5] -< } -< -< CAUSE_EFFECT { -< LABEL=[Channel 2 linear stream] -< WATCH=[REG(0x0006D053)] -< WATCH=[REG(0x0006D052)] -< CAUSE: TARGET=[REG(0x0006D053)] OP=[BIT,ON] BIT=[4] -< CAUSE: TARGET=[REG(0x0006D052)] OP=[BIT,ON] BIT=[5] -< EFFECT: TARGET=[REG(0x0006D051)] OP=[BIT,ON] BIT=[4] -< EFFECT: TARGET=[REG(0x0006D051)] OP=[BIT,OFF] BIT=[5] -< } -< -< CAUSE_EFFECT { -< LABEL=[Channel 3 linear stream] -< WATCH=[REG(0x0006D073)] -< WATCH=[REG(0x0006D072)] -< CAUSE: TARGET=[REG(0x0006D073)] OP=[BIT,ON] BIT=[4] -< CAUSE: TARGET=[REG(0x0006D072)] OP=[BIT,ON] BIT=[5] -< EFFECT: TARGET=[REG(0x0006D071)] OP=[BIT,ON] BIT=[4] -< EFFECT: TARGET=[REG(0x0006D071)] OP=[BIT,OFF] BIT=[5] -< ## Actions for Procedure - p9_setup_evid -< ## -< -< CAUSE_EFFECT { -< LABEL=[AVSBus Write data register 0B] -< WATCH=[REG(0x0006C718)] -< CAUSE: TARGET=[REG(0x0006C718)] OP=[BIT,ON] BIT=[1] -< EFFECT: TARGET=[REG(0x0006C716)] OP=[BIT,ON] BIT=[0] -< } -< -< CAUSE_EFFECT { -< LABEL=[AVSBus Status register 0B] -< WATCH_READ=[REG(0x0006C716)] -< CAUSE: TARGET=[REG(0x0006C716)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x0006C716)] OP=[BIT,OFF] BIT=[0] -< } -< -< CAUSE_EFFECT { -< LABEL=[AVSBus Write data register 1B] -< WATCH=[REG(0x0006C738)] -< CAUSE: TARGET=[REG(0x0006C738)] OP=[BIT,ON] BIT=[1] -< EFFECT: TARGET=[REG(0x0006C736)] OP=[BIT,ON] BIT=[0] -< } -< -< CAUSE_EFFECT { -< LABEL=[AVSBus Status register 1B] -< WATCH_READ=[REG(0x0006C736)] -< CAUSE: TARGET=[REG(0x0006C736)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x0006C736)] OP=[BIT,OFF] BIT=[0] -< } -< -< ## Core 0 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x200F011A)] -< CAUSE: TARGET=[REG(0x200F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x200F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x200F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 0 End -< ## Core 1 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x210F011A)] -< CAUSE: TARGET=[REG(0x210F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x210F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x210F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 1 End -< ## Core 2 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x220F011A)] -< CAUSE: TARGET=[REG(0x220F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x220F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x220F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 2 End -< ## Core 3 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x230F011A)] -< CAUSE: TARGET=[REG(0x230F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x230F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x230F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 3 End -< ## Core 4 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x240F011A)] -< CAUSE: TARGET=[REG(0x240F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x240F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x240F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 4 End -< ## Core 5 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x250F011A)] -< CAUSE: TARGET=[REG(0x250F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x250F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x250F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 5 End -< ## Core 6 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x260F011A)] -< CAUSE: TARGET=[REG(0x260F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x260F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x260F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 6 End -< ## Core 7 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x270F011A)] -< CAUSE: TARGET=[REG(0x270F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x270F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x270F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 7 End -< ## Core 8 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x280F011A)] -< CAUSE: TARGET=[REG(0x280F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x280F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x280F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 8 End -< ## Core 9 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x290F011A)] -< CAUSE: TARGET=[REG(0x290F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x290F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x290F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 9 End -< ## Core 10 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x2a0F011A)] -< CAUSE: TARGET=[REG(0x2a0F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x2a0F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x2a0F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 10 End -< ## Core 11 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x2b0F011A)] -< CAUSE: TARGET=[REG(0x2b0F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x2b0F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x2b0F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 11 End -< ## Core 12 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x2c0F011A)] -< CAUSE: TARGET=[REG(0x2c0F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x2c0F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x2c0F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 12 End -< ## Core 13 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x2d0F011A)] -< CAUSE: TARGET=[REG(0x2d0F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x2d0F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x2d0F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 13 End -< ## Core 14 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x2e0F011A)] -< CAUSE: TARGET=[REG(0x2e0F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x2e0F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x2e0F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 14 End -< ## Core 15 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x2f0F011A)] -< CAUSE: TARGET=[REG(0x2f0F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x2f0F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x2f0F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 15 End -< ## Core 16 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x300F011A)] -< CAUSE: TARGET=[REG(0x300F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x300F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x300F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 16 End -< ## Core 17 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x310F011A)] -< CAUSE: TARGET=[REG(0x310F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x310F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x310F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 17 End -< ## Core 18 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x320F011A)] -< CAUSE: TARGET=[REG(0x320F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x320F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x320F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 18 End -< ## Core 19 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x330F011A)] -< CAUSE: TARGET=[REG(0x330F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x330F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x330F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 19 End -< ## Core 20 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x340F011A)] -< CAUSE: TARGET=[REG(0x340F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x340F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x340F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 20 End -< ## Core 21 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x350F011A)] -< CAUSE: TARGET=[REG(0x350F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x350F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x350F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 21 End -< ## Core 22 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x360F011A)] -< CAUSE: TARGET=[REG(0x360F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x360F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x360F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 22 End -< ## Core 23 Start -< -< ## -< # Actions for Procedure - p9_hcd_core_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x370F011A)] -< CAUSE: TARGET=[REG(0x370F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x370F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x370F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< # Core 23 End -< ## EQ 0 Start -< -< ## -< # Actions for Procedure - p9_hcd_cache_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on cache vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x100F011A)] -< CAUSE: TARGET=[REG(0x100F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x100F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x100F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< CAUSE_EFFECT { -< LABEL=[Power on cache vcs pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x100F011A)] -< CAUSE: TARGET=[REG(0x100F011A)] OP=[BIT,ON] BIT=[2] -< EFFECT: TARGET=[REG(0x100F0118)] OP=[BIT,ON] BIT=[50] -< EFFECT: TARGET=[REG(0x100F011C)] OP=[BIT,ON] BIT=[2] -< } -< -< ## EQ 0 End -< -< ## EQ 1 Start -< -< ## -< # Actions for Procedure - p9_hcd_cache_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on cache vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x110F011A)] -< CAUSE: TARGET=[REG(0x110F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x110F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x110F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< CAUSE_EFFECT { -< LABEL=[Power on cache vcs pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x110F011A)] -< CAUSE: TARGET=[REG(0x110F011A)] OP=[BIT,ON] BIT=[2] -< EFFECT: TARGET=[REG(0x110F0118)] OP=[BIT,ON] BIT=[50] -< EFFECT: TARGET=[REG(0x110F011C)] OP=[BIT,ON] BIT=[2] -< } -< -< ## EQ 1 End -< -< ## EQ 2 Start -< -< ## -< # Actions for Procedure - p9_hcd_cache_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on cache vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x120F011A)] -< CAUSE: TARGET=[REG(0x120F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x120F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x120F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< CAUSE_EFFECT { -< LABEL=[Power on cache vcs pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x120F011A)] -< CAUSE: TARGET=[REG(0x120F011A)] OP=[BIT,ON] BIT=[2] -< EFFECT: TARGET=[REG(0x120F0118)] OP=[BIT,ON] BIT=[50] -< EFFECT: TARGET=[REG(0x120F011C)] OP=[BIT,ON] BIT=[2] -< } -< -< ## EQ 2 End -< -< ## EQ 3 Start -< -< ## -< # Actions for Procedure - p9_hcd_cache_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on cache vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x130F011A)] -< CAUSE: TARGET=[REG(0x130F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x130F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x130F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< CAUSE_EFFECT { -< LABEL=[Power on cache vcs pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x130F011A)] -< CAUSE: TARGET=[REG(0x130F011A)] OP=[BIT,ON] BIT=[2] -< EFFECT: TARGET=[REG(0x130F0118)] OP=[BIT,ON] BIT=[50] -< EFFECT: TARGET=[REG(0x130F011C)] OP=[BIT,ON] BIT=[2] -< } -< -< ## EQ 3 End -< -< ## EQ 4 Start -< -< ## -< # Actions for Procedure - p9_hcd_cache_poweron -< ## -< -< CAUSE_EFFECT { ---- -> CAUSE_EFFECT CHIPLETS cache { -1073,1084c138,141 -< WATCH=[REG(0x140F011A)] -< CAUSE: TARGET=[REG(0x140F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x140F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x140F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< CAUSE_EFFECT { -< LABEL=[Power on cache vcs pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x140F011A)] -< CAUSE: TARGET=[REG(0x140F011A)] OP=[BIT,ON] BIT=[2] -< EFFECT: TARGET=[REG(0x140F0118)] OP=[BIT,ON] BIT=[50] -< EFFECT: TARGET=[REG(0x140F011C)] OP=[BIT,ON] BIT=[2] ---- -> WATCH=[REG(MYCHIPLET, 0x0F011A)] -> CAUSE: TARGET=[REG(MYCHIPLET, 0x0F011A)] OP=[BIT,ON] BIT=[2] -> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F0118)] OP=[BIT,ON] BIT=[50] -> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F011C)] OP=[BIT,ON] BIT=[2] -1087,1112d143 -< ## EQ 4 End -< -< ## EQ 5 Start -< -< ## -< # Actions for Procedure - p9_hcd_cache_poweron -< ## -< -< CAUSE_EFFECT { -< LABEL=[Power on cache vdd pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x150F011A)] -< CAUSE: TARGET=[REG(0x150F011A)] OP=[BIT,ON] BIT=[0] -< EFFECT: TARGET=[REG(0x150F0118)] OP=[BIT,ON] BIT=[42] -< EFFECT: TARGET=[REG(0x150F011C)] OP=[BIT,ON] BIT=[0] -< } -< -< CAUSE_EFFECT { -< LABEL=[Power on cache vcs pfet then fsm is idle and sense is enabled] -< WATCH=[REG(0x150F011A)] -< CAUSE: TARGET=[REG(0x150F011A)] OP=[BIT,ON] BIT=[2] -< EFFECT: TARGET=[REG(0x150F0118)] OP=[BIT,ON] BIT=[50] -< EFFECT: TARGET=[REG(0x150F011C)] OP=[BIT,ON] BIT=[2] -< } -< -< ## EQ 5 End -< diff --git a/src/test/citest/etc/patches/standalone.simics.patch b/src/test/citest/etc/patches/standalone.simics.patch deleted file mode 100644 index bdc40fd8..00000000 --- a/src/test/citest/etc/patches/standalone.simics.patch +++ /dev/null @@ -1,4 +0,0 @@ -52c52 -< ($hb_masterproc).proc_chip.invoke parallel_store SCOM 0x5003A "00000000_00000000" 64 ---- -> ($hb_masterproc).proc_chip.invoke parallel_store SCOM 0x5003A "80000000_00000000" 64 diff --git a/src/test/citest/etc/workarounds.postsimsetup b/src/test/citest/etc/workarounds.postsimsetup deleted file mode 100755 index 057c3b00..00000000 --- a/src/test/citest/etc/workarounds.postsimsetup +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/citest/etc/workarounds.postsimsetup $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2015,2016 -# -# -# 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 -## Workarounds that are run after start_simics is executed for the first time -## to setup the sandbox -## - -### Example applying a patch to cec-chip files -#echo "+++ Updating something wonderful in a simics file" -#mkdir -p $sb/simu/data/cec-chip/ -#cp $BACKING_BUILD/src/simu/data/cec-chip/base_cec_chip_file $sb/simu/data/cec-chip -#patch -p0 $sb/simu/data/cec-chip/base_cec_chip_file $SBEROOT/src/build/citest/etc/patches/my_patch_File - -# NOTE: The below patch removes mailbox settings in standalone.simics (comes -# from HB) that cause the SBE to run in plck mode. For our CI, we need the SBE -# to be in istep mode. This patch is likely never going to be removed as long as -# we need our CI to run in istep mode. -echo "+++ Patching standalone.simics" -mkdir -p $SANDBOXBASE/obj/ppc/simu/scripts/hbfw -cp $BACKING_BUILD/obj/ppc/simu/scripts/hbfw/standalone.simics $SANDBOXBASE/obj/ppc/simu/scripts/hbfw -patch -p0 $SANDBOXBASE/obj/ppc/simu/scripts/hbfw/standalone.simics $SBEROOT/src/test/citest/etc/patches/standalone.simics.patch - diff --git a/src/test/citest/etc/workarounds.presimsetup b/src/test/citest/etc/workarounds.presimsetup deleted file mode 100755 index 638a1e84..00000000 --- a/src/test/citest/etc/workarounds.presimsetup +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/citest/etc/workarounds.presimsetup $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2015,2016 -# -# -# 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 - -#### Examples #### -#echo "+++ Some message about why you need to do this." -#mkdir -p $sb/simu/data -#egrep -v "WSALIAS DEFAULT FIPSLEVEL|WSALIAS DEFAULT SIMICSLEVEL" $BACKING_BUILD/src/simu/data/simicsInfo > $sb/simu/data/simicsInfo -#echo "WSALIAS DEFAULT FIPSLEVEL env/gfwb/simics-4.2.0/simics-4.2.83/fips/fld36/fi120201a700.42" >> $sb/simu/data/simicsInfo -#echo "WSALIAS DEFAULT SIMICSLEVEL env/vtechb/simics-4.2.0/simics-4.2.83/bin" >> $sb/simu/data/simicsInfo diff --git a/src/test/citest/populate-sandbox b/src/test/citest/populate-sandbox deleted file mode 100755 index 488462b1..00000000 --- a/src/test/citest/populate-sandbox +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/citest/populate-sandbox $ -# -# 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 - -# Ensure sandbox exists (create-sandbox has been called). -if [ -z $SANDBOXBASE ]; -then - echo "SANDBOXBASE variable uninitialized.." - exit -1 -fi - -if [ ! -d "$SANDBOXBASE" ]; -then - echo "Cannot find sandbox: $SANDBOXBASE" - exit -1 -fi - -# Create test directory. -mkdir -p $SBETESTDIR || exit -1 - -# Create test directory. -mkdir -p $SBEFW_IMG_DIR || exit -1 - -# Copy sbe binaries -cp $SBEROOT/images/*.bin $SBEFW_IMG_DIR/ || exit -1 -cp $SBEROOT/obj/simics.tar $SBEFW_DIR/ || exit -1 -# Compile sbe code in sandbox to copy binaries at right place -echo "---Setup sandbox for sbe binaries." - -execute_in_sandbox "cd $SBEFW_DIR; mk -a" \ - "ppc" || exit -1 - -execute_in_sandbox "cd $SBEFW_DIR; mk install_all" \ - "ppc" || exit -1 - - -# Copy test files. -cp -r $SBEROOT/src/test/* $SBETESTDIR/ || exit -1 - diff --git a/src/test/citest/sbetest-start.sh b/src/test/citest/sbetest-start.sh deleted file mode 100755 index f39ed84e..00000000 --- a/src/test/citest/sbetest-start.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/citest/sbetest-start.sh $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 -if [ -z $SBE_CI_ENV_SETUP ]; -then - unset $SANDBOXBASE - unset $SANDBOXNAME - source "$SBEROOT/src/test/citest/setup-env" -fi - -# Front end to autocitest - script to execute unit tests under simics. -# -## when jenkins runs it will create a workspace with the built code tree -## and drop us into it. -autocitest ${BACKING_BUILD} - -exit $? diff --git a/src/test/citest/setup-env b/src/test/citest/setup-env deleted file mode 100755 index ee0bc18b..00000000 --- a/src/test/citest/setup-env +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/citest/setup-env $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2015,2016 -# -# -# 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 - -export CITESTPATH=${SBEROOT}/src/test/citest -export PATH=${CITESTPATH}:${PATH} - -# If we are running under Jenkins we need to pick a random-ish sandbox name -# so that the autoipl tools do not have a /tmp name collision. -if [ -z $JOB_NAME -o -z $BUILD_NUMBER ]; -then - SBECI_SANDBOX="test_sb" -else - export RUNNING_UNDER_JENKINS=1 - SBECI_SANDBOX=`echo $JOB_NAME $BUILD_NUMBER | md5sum | head -c10` -fi - -# Setup sandbox location variables. -if [ -z $SANDBOXROOT ]; -then - export SANDBOXROOT=${SBEROOT} -fi - -if [ -z $SANDBOXNAME ] || [ "$RUNNING_UNDER_JENKINS" = "1" ]; -then - export SANDBOXNAME=${SBECI_SANDBOX} -fi - -export SANDBOXBASE=${SANDBOXROOT}/${SANDBOXNAME} - -if [ -z $SANDBOXRC ]; -then - export SANDBOXRC=${SANDBOXROOT}/sbesandboxrc -fi -# Useful utility function. -execute_in_sandbox() -{ - WORKON_CMD="workon -rc ${SANDBOXRC} -sb ${SANDBOXNAME} -m $2 " - echo $1 > ${SANDBOXBASE}/src/sandbox_execute_cmd - chmod 700 ${SANDBOXBASE}/src/sandbox_execute_cmd - - TEST="${WORKON_CMD} -c ./sandbox_execute_cmd " - echo $TEST - ${WORKON_CMD} -c ./sandbox_execute_cmd - - if [ $? -ne 0 ]; then - return 1 - fi - - rm ${SANDBOXBASE}/src/sandbox_execute_cmd -} -export -f execute_in_sandbox - -# Setup machine type. -export MACHINE=${MACHINE:-$DEFAULT_MACHINE} - -export SBETESTDIR=$SANDBOXBASE/simics/targets/p9_nimbus/sbeTest -export SBEFW_DIR=$SANDBOXBASE/src/sbei/sbfw/ -export SBEFW_IMG_DIR=$SANDBOXBASE/src/sbei/sbfw/img -export AUTOSIM_FFDC_XML=$SBETESTDIR/ffdc.xml -export SBE_TEST_XML=$SBETESTDIR/test.xml -# Indicate we setup the CI environment. -export SBE_CI_ENV_SETUP=1 diff --git a/src/test/ffdc.xml b/src/test/ffdc.xml deleted file mode 100755 index 65364249..00000000 --- a/src/test/ffdc.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sbe-trace 0 - - - p9Proc0.sbe.ppe->ppe_state - - - p9Proc0.proc_fifo->upstream_hw_fifo - - - p9Proc0.proc_fifo->downstream_hw_fifo - - - diff --git a/src/test/framework/autocitest b/src/test/framework/autocitest new file mode 100755 index 00000000..3b7332b2 --- /dev/null +++ b/src/test/framework/autocitest @@ -0,0 +1,96 @@ +#!/bin/bash +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/framework/autocitest $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 +################################################################################ +## Simics automation using run-fsp-it +################################################################################ + +## verbose is the default. +VERBOSE=" --verbose" +if [ "$1" = "--quiet" ] ; then + VERBOSE="" + shift +fi + +## +## set up +## +DRIVER="$1" ## backing tree +export bb=$DRIVER ## simulate a workon + +export SHELL="/bin/bash" ## Needed to fool workon to launch a bash + ## shell, which autosim expects. +NOWIN="--nowin" ## remote execution does not have a display + +## jenkins creates a new workspace for every compile. +## sbetest-start.sh will verify this and then export WORKSPACE_DIR for us. +SBXHOME=$SBEROOT + +if [ "$DRIVER" = "" ] ; then + echo "ERROR: you must specify a driver (backing tree) to run the tests with" + usage + exit 1 +fi + +## let's get set up +cd $SANDBOXROOT + +echo "$0" +echo "VERBOSE = $VERBOSE" +echo "NOWIN = $NOWIN" +echo "BACKING_TREE = $DRIVER" +echo "SANDBOXRC = $SANDBOXRC" +echo "SBXHOME = $SBXHOME" +echo "AUTOSIM_FFDC_XML = $AUTOSIM_FFDC_XML" +echo "current directory is " `pwd` + + +timestamp=`date +'%H:%M:%S'` +echo "$timestamp Starting SBE test..." + +# Check preconditions for run-fsp-it +# This is just workaround. It is expected +# that user already either have this file +# or tokens have been taken by klog command. +# This is just to make run-fsp-it work in user +# sandbox +if [ -z $RUNNING_UNDER_JENKINS ] +then + mkdir -p ~/private + if [ ! -f ~/private/.p ]; then + echo "Creating p file" + touch ~/private/.p + fi + + if [ ! -f ~/private/password ]; then + echo "Creating passwd file" + touch ~/private/password + echo "dummy" > ~/private/password + fi +fi + +execute_in_sandbox "run-fsp-it $NOWIN --machine $MACHINE $SBE_TEST_XML" "ppc" || exit -1 + +exit 0 + diff --git a/src/test/framework/build-script b/src/test/framework/build-script new file mode 100755 index 00000000..486a0ac9 --- /dev/null +++ b/src/test/framework/build-script @@ -0,0 +1,72 @@ +#!/bin/sh +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/framework/build-script $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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 + +if [ -z $WORKSPACE ]; then + export WORKSPACE=`pwd` +fi + +if [ -z $SBEROOT ]; then + source "$WORKSPACE/env.bash" +fi + +source "$SBEROOT/src/test/framework/setup-env" + +# Check copyright. +#check-copyright > copyright.log 2>&1 & +#COPYRIGHT_PID=$! + + +# Build . +scl enable devtoolset-2 " bash -c \"make install\"" || exit -1 + +# Create simics sandbox. +create-sandbox > create-sandbox.log 2>&1 & +CREATESANDBOX_PID=$! + +# Check sandbox create completion. +wait $CREATESANDBOX_PID +if [ $? -eq 0 ]; then + cat create-sandbox.log +else + echo "----Sandbox creation failed." + cat create-sandbox.log + exit -1 +fi + +# Add SBE files to simics sandbox. +populate-sandbox || exit -1 + +sbetest-start.sh || exit -1 + +# Check copyright completion. +#wait $COPYRIGHT_PID +#if [ $? -eq 0 ]; then +# cat copyright.log +#else +# echo "----Copyright check failed." +# cat copyright.log +# exit -1 +#fi + diff --git a/src/test/framework/check-copyright b/src/test/framework/check-copyright new file mode 100755 index 00000000..bd893b39 --- /dev/null +++ b/src/test/framework/check-copyright @@ -0,0 +1,30 @@ +#!/bin/sh +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/framework/check-copyright $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +COPYRIGHT_CHECK=${SBEROOT}/src/test/framework/copyright-check.sh +COMMIT_CHECK=${SBEROOT}/src/tools/hooks/verify-commit + +$COPYRIGHT_CHECK || exit -1 +$COMMIT_CHECK || exit -1 diff --git a/src/test/framework/copyright-check.sh b/src/test/framework/copyright-check.sh new file mode 100755 index 00000000..ec305360 --- /dev/null +++ b/src/test/framework/copyright-check.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/framework/copyright-check.sh $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +# +# Front end to addCopyright - script to check for copyright block during +# Gerrit checkin. +# + +export WORKSPACE_DIR=`pwd` +export ADDCOPYRIGHT=${WORKSPACE_DIR}/src/tools/hooks/addCopyright + +## run git show to get a list of checked in files +CHECKINFILES=`git show --pretty=format: --name-only -n1 | tr '\n' ' '` +## use git log to determine the year of the commit. +## Since commits have their copyright updated at the time they are +## committed, a commit might have a copyright date in its prolog of +## last year. Set the DATE_OVERRIDE variable to the 'validate' to allow +## slightly-old prologs (ie. ones corresponding to the date in the msg). +export DATE_OVERRIDE=`git log -n1 --date=short | grep "Date" | sed "s/Date: *//" | sed "s/-.*//"` + +echo "========================================================================" + +echo " Checking Copyright blocks for checked-in files:" +echo " $CHECKINFILES" +echo +$ADDCOPYRIGHT validate $CHECKINFILES --copyright-check + +if [ $? -eq 0 ]; then + echo "Copyright Check passed OK, $?" + exit 0 +else + echo "ERROR: $?" + exit 1 +fi diff --git a/src/test/framework/create-sandbox b/src/test/framework/create-sandbox new file mode 100755 index 00000000..add0a78b --- /dev/null +++ b/src/test/framework/create-sandbox @@ -0,0 +1,73 @@ +#!/bin/sh +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/framework/create-sandbox $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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 + +echo "Creating ODE sandbox..." + +# Ensure backing build is accessible. +if [ ! -d "$BACKING_BUILD" ]; +then + echo "Cannot access the backing build: $BACKING_BUILD" + exit -1 +fi + +# Delete existing sandbox if it exists. +if [ -d "$SANDBOXBASE" ]; +then + echo "----Removing old sandbox." + mksb -undo -auto -rc $SANDBOXRC -dir $SANDBOXROOT -sb $SANDBOXNAME +fi +if [ -d "$SANDBOXBASE" ]; +then + rm -rf $SANDBOXBASE +fi + +# Create sandbox. +mksb -rc $SANDBOXRC -dir $SANDBOXROOT -back $BACKING_BUILD -sb $SANDBOXNAME \ + -m ppc -auto || exit -1 + +# workaround scripts expect $sb variable to be populated. +export sb=$SANDBOXBASE/src + +execute_in_sandbox "ecc --inject ${SBE_IMG_OUT_LOC}/sbe_seeprom.bin --output ${SBE_IMG_OUT_LOC}/sbe_seeprom.bin.ecc --p8 " "ppc" || exit -1 + +# Run presimsetup workarounds. +echo "----Running presimsetup workarounds." +if [ -f ${CITESTPATH}/etc/workarounds.presimsetup ]; +then + ${CITESTPATH}/etc/workarounds.presimsetup || exit -1 +fi + +# Run start_simics to populate simics directories. +echo "----Setting up simics." +execute_in_sandbox "start_simics -no_start -machine $MACHINE -batch_mode" \ + "ppc" || exit -1 + +# Run postsimsetup workarounds. +echo "----Running postsimsetup workarounds." +if [ -f ${CITESTPATH}/etc/workarounds.postsimsetup ]; +then + ${CITESTPATH}/etc/workarounds.postsimsetup || exit -1 +fi + diff --git a/src/test/framework/etc/patches/chip.act.patch b/src/test/framework/etc/patches/chip.act.patch new file mode 100644 index 00000000..0b9cf0f0 --- /dev/null +++ b/src/test/framework/etc/patches/chip.act.patch @@ -0,0 +1,146 @@ +184,240c184 +< # ========================================================================== +< # Actions for p9_adu_access and p9_adu_setup procedures +< # ========================================================================== +< #If a read/write is done to the ALTD_DATA Register set the ALTD_STATUS Register so things are as expected +< CAUSE_EFFECT{ +< LABEL=[ADU Read or write to set ALTD_STATUS Register] +< #If the data register is read +< WATCH_READ=[REG(0x00090004)] +< #If the data register is written +< WATCH=[REG(0x00090004)] +< +< #Set the ALTD_STATUS Register so these bits are set: +< #FBC_ALTD_BUSY = WAIT_CMD_ARBIT = WAIT_RESP = OVERRUN_ERR = AUTOINC_ERR = COMMAND_ERR = ADDRESS_ERR = COMMAND_HANG_ERR = DATA_HANG_ERR = PBINIT_MISSING = ECC_CE = ECC_UE = ECC_SUE = 0 +< EFFECT: TARGET=[REG(0x00090003)] OP=[BUF,AND] DATA=[LITERAL(64,001FDFFF FFFF1FFF)] +< EFFECT: TARGET=[REG(0x00090003)] OP=[BUF,OR] DATA=[LITERAL(64,30000000 00000000)] +< } +< +< #If a read/write is done to the ALTD_DATA Register and the Address only bit is not set then set the DATA_DONE bit to 1 +< CAUSE_EFFECT{ +< LABEL=[ADU Read or write to set ALTD_STATUS[DATA_DONE] bit] +< #If the data register is read +< WATCH_READ=[REG(0x00090004)] +< #If the data register is written +< WATCH=[REG(0x00090004)] +< CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[6] +< +< #Set the DATA_DONE bit +< EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[3] +< } +< +< #If a read/write is done to the ALTD_DATA Register and the Data only bit is not set then set the ADDR_DONE bit to 1 +< CAUSE_EFFECT{ +< LABEL=[ADU Read or write to set ALTD_STATUS[ADDR_DONE] bit] +< #If the data register is read +< WATCH_READ=[REG(0x00090004)] +< #If the data register is written +< WATCH=[REG(0x00090004)] +< CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[7] +< +< #Set the ADDR_DONE bit +< EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[2] +< } +< +< #If a read is done to the ALTD_CMD Register and it sets the lock set the ALTD_STATUS Register so the ALTD_STATUS_BUSY bit is set +< CAUSE_EFFECT{ +< LABEL=[ADU Write to set ALTD_STATUS_BUSY] +< WATCH=[REG(0x00090001)] +< CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[11] +< +< #Set the ALTD_STATUS Register so the ALTD_STATUS_BUSY bit is set +< EFFECT: TARGET=[REG(0x090003)] OP=[BIT,ON] BIT=[0] +< } +< #If a write is done to the ALD_CMD_REG to set the FBC_ALTD_START_OP bit it should turn FBC_ALTD_BUSY off +< CAUSE_EFFECT{ +< LABEL=[ADU Write to ALTD_CMD_REG to unset set ALTD_STATUS FBC_ALTD_BUSY bit] +< WATCH=[REG(0x00090001)] +< CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[2] +--- +> ### ADU ACTIONS - READ WRITE RESET ### +242,243c186,265 +< #Unset the ALTD_STATUS Register so the ALTD_STATUS_BUSY is unset +< EFFECT: TARGET=[REG(0x090003)] OP=[BIT,OFF] BIT=[0] +--- +> # Reset ALTD Status Reg +> CAUSE_EFFECT { +> LABEL=[RESET FSM ALTD Status Register] +> WATCH=[REG(0x00090001)] # ALTD_Cmd_Reg +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[4] #Reset FSM bit +> EFFECT: TARGET=[REG(0x00090003)] OP=[EQUALTO,BUF] DATA=[LITERAL(64,00000000 00000000)] +> } +> +> # ADU Transaction Complete Status - Busy Bit Low +> CAUSE_EFFECT { +> LABEL=[ALTD_BUSY Status Register Clear] +> WATCH=[REG(0x00090003)] # ALTD_Status_Reg +> CAUSE: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[2] #FBC_ALTD_ADDR_DONE +> CAUSE: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[3] #FBC_ALTD_DATA_DONE +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[19] #AUTO INCR Mode OFF +> +> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,OFF] BIT=[0] #BUSY Bit low +> } +> +> # Read without AutoIncr +> CAUSE_EFFECT{ +> LABEL=[READ Mainstore without AutoIncr] +> WATCH=[REG(0x00090001)] # ALTD_Cmd_Reg +> +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[2] #start ADU Operation +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[5] #READ ADU Operation +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[6] #addr Only Type Command +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[7] #data +> +> EFFECT: TARGET=[MODULE(readMainstore, 0x00090000)] OP=[MODULECALL] DATA=[REG(0x00090004)] # read the memory +> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[2] #FBC_ALTD_ADDR_DONE +> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[3] #FBC_ALTD_DATA_DONE +> } +> +> # Read with AutoIncr +> CAUSE_EFFECT{ +> LABEL=[READ Mainstore with AutoIncr] +> WATCH_READ=[REG(0x00090004)] # ALTD_Data_reg +> +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[2] #start ADU Operation +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[5] #READ ADU Operation +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[6] #addr Only Type Command +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[7] #data +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[19] #AutoInc bit on +> +> EFFECT: TARGET=[MODULE(readMainstore, 0x00090000)] OP=[MODULECALL] DATA=[REG(0x00090004)] # read the memory +> EFFECT: TARGET=[REG(0x00090000)] OP=[INCREMENT,MASK] INCVAL=[8] MASK=[LITERAL(64,00000000 0000FFFF)] # incr addr reg by 8 +> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[2] #FBC_ALTD_ADDR_DONE +> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[3] #FBC_ALTD_DATA_DONE +> } +> +> # Write without AutoIncr +> CAUSE_EFFECT{ +> LABEL=[WRITE Mainstore without AutoIncr] +> WATCH=[REG(0x00090001)] # ALTD_Cmd_Reg +> WATCH=[REG(0x00090004)] # ALTD_Data_reg +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[2] #start ADU Operation +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[5] #WRITE ADU Operation +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[6] #addr Only Type Command +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[7] #data +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[19] #AutoInc bit off +> EFFECT: TARGET=[MODULE(writeMainstore, 0x00090000)] OP=[MODULECALL] DATA=[REG(0x00090004)] # write the memory +> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[2] #FBC_ALTD_ADDR_DONE +> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[3] #FBC_ALTD_DATA_DONE +> } +> +> # Write with AutoIncr +> CAUSE_EFFECT{ +> LABEL=[WRITE Mainstore with AutoIncr] +> WATCH=[REG(0x00090001)] # ALTD_Cmd_reg +> WATCH=[REG(0x00090004)] # ALTD_Data_reg +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[2] #start ADU Operation +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[5] #WRITE ADU Operation +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[6] #addr Only Type Command +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,OFF] BIT=[7] #data +> CAUSE: TARGET=[REG(0x00090001)] OP=[BIT,ON] BIT=[19] #AutoInc bit on +> EFFECT: TARGET=[MODULE(writeMainstore, 0x00090000)] OP=[MODULECALL] DATA=[REG(0x00090004)] # write the memory +> EFFECT: TARGET=[REG(0x00090000)] OP=[INCREMENT,MASK] INCVAL=[8] MASK=[LITERAL(64, 00000000 0000FFFF)] # incr addr reg by 8 +> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[2] #FBC_ALTD_ADDR_DONE +> EFFECT: TARGET=[REG(0x00090003)] OP=[BIT,ON] BIT=[3] #FBC_ALTD_DATA_DONE +265a288 +> EFFECT: TARGET=[MODULE(executeInstruction, MYCORE)] OP=[MODULECALL] DATA=[REG(MYCHIPLET, 0x00010A4F)] diff --git a/src/test/framework/etc/patches/patchlist.txt b/src/test/framework/etc/patches/patchlist.txt new file mode 100644 index 00000000..4fd0444a --- /dev/null +++ b/src/test/framework/etc/patches/patchlist.txt @@ -0,0 +1,14 @@ +# Example Format +#Brief description of the problem or reason for patch +#-RTC: Task/Story used to remove this patch +#-CQ: Defect/Req for checking the changes into fips910 +#-Files: list of files +#-Coreq: list of associated changes, e.g. workarounds.presimsetup + +RTC: 144728 +Files : pervasive.act.patch. Currently SUET does not support FSIMBOX KW. Once + support is in, remove this patch. + +RTC: 128984 +Files: chip.act.patch. Added call for executeInstruction module call. + p9.inst.patch. Added P9 specific commands for ramming. diff --git a/src/test/framework/etc/patches/pervasive.act.patch b/src/test/framework/etc/patches/pervasive.act.patch new file mode 100644 index 00000000..5531bef6 --- /dev/null +++ b/src/test/framework/etc/patches/pervasive.act.patch @@ -0,0 +1,28 @@ +55c55 +< WATCH=[REG(0x00050018)] +--- +> WATCH=[FSIMBOX(0x18)] +57c57 +< CAUSE: TARGET=[REG(0x00050018)] OP=[BIT,OFF] BIT=[12] +--- +> CAUSE: TARGET=[FSIMBOX(0x18)] OP=[BIT,OFF] BIT=[12] +59c59 +< CAUSE: TARGET=[REG(0x00050018)] OP=[BIT,OFF] BIT=[0] +--- +> CAUSE: TARGET=[FSIMBOX(0x18)] OP=[BIT,OFF] BIT=[0] +67c67 +< WATCH=[REG(0x00050018)] +--- +> WATCH=[FSIMBOX(0x18)] +69c69 +< CAUSE: TARGET=[REG(0x00050018)] OP=[BIT,OFF] BIT=[4] +--- +> CAUSE: TARGET=[FSIMBOX(0x18)] OP=[BIT,OFF] BIT=[4] +78c78 +< WATCH=[REG(0x00050018)] +--- +> WATCH=[FSIMBOX(0x18)] +80c80 +< CAUSE: TARGET=[REG(0x00050018)] OP=[BIT,OFF] BIT=[4] +--- +> CAUSE: TARGET=[FSIMBOX(0x18)] OP=[BIT,OFF] BIT=[4] diff --git a/src/test/framework/etc/patches/powermgmt.act.patch b/src/test/framework/etc/patches/powermgmt.act.patch new file mode 100644 index 00000000..efb03845 --- /dev/null +++ b/src/test/framework/etc/patches/powermgmt.act.patch @@ -0,0 +1,1057 @@ +43,112d42 +< ## Actions for Procedure - p9_pm_occ_control +< ## +< +< CAUSE_EFFECT { +< LABEL=[PPC405 HALT] +< WATCH=[REG(0x0006D006)] +< CAUSE: TARGET=[REG(0x0006D006)] OP=[EQUALTO,BUF] DATA=[LITERAL(64, 02000000 00000000)] +< #suet PPC405_UNHALT:tc1- EFFECT: TARGET=[REG(0x01010800)] OP=[BIT,OFF] BIT=[31] +< EFFECT: TARGET=[REG(0x01010800)] OP=[BIT,ON] BIT=[31] +< } +< +< ## +< ## Actions for Procedure - p9_pm_occ_gpe_init +< ## +< +< CAUSE_EFFECT { +< LABEL=[OCC GPE0 HALT] +< WATCH=[REG(0x00060010)] +< CAUSE: TARGET=[REG(0x00060010)] OP=[BIT,OFF] BIT=[1] +< CAUSE: TARGET=[REG(0x00060010)] OP=[BIT,OFF] BIT=[2] +< CAUSE: TARGET=[REG(0x00060010)] OP=[BIT,ON] BIT=[3] +< #suet OCCGPE0_HALT_FAIL:tc1- EFFECT: TARGET=[REG(0x00060021)] OP=[BIT,OFF] BIT=[0] +< EFFECT: TARGET=[REG(0x00060021)] OP=[BIT,ON] BIT=[0] +< } +< +< CAUSE_EFFECT { +< LABEL=[OCC GPE1 HALT] +< WATCH=[REG(0x00062010)] +< CAUSE: TARGET=[REG(0x00062010)] OP=[BIT,OFF] BIT=[1] +< CAUSE: TARGET=[REG(0x00062010)] OP=[BIT,OFF] BIT=[2] +< CAUSE: TARGET=[REG(0x00062010)] OP=[BIT,ON] BIT=[3] +< #suet OCCGPE1_HALT_FAIL:tc1- EFFECT: TARGET=[REG(0x00062021)] OP=[BIT,OFF] BIT=[0] +< EFFECT: TARGET=[REG(0x00062021)] OP=[BIT,ON] BIT=[0] +< } +< +< # Upon writing the PU_OCB_PIB_OCR[DBG_HALT} bit, set the OCCLFIR_PPC405_DBGSTOPACK_BIT. +< CAUSE_EFFECT { +< LABEL=[PPC405 SAFE_HALT] +< WATCH=[REG(00x0006D002)] +< CAUSE: TARGET=[REG(0x0006D002)] OP=[EQUALTO,BUF] DATA=[LITERAL(64, 00200000 00000000)] +< EFFECT: TARGET=[REG(0x01010800)] OP=[BIT,ON] BIT=[31] +< } +< +< +< ## +< ## Actions for Procedure - p9_pm_occ_gpe_init +< ## +< +< CAUSE_EFFECT { +< LABEL=[OCC GPE0 HALT] +< WATCH=[REG(0x00060010)] +< CAUSE: TARGET=[REG(0x00060010)] OP=[BIT,OFF] BIT=[1] +< CAUSE: TARGET=[REG(0x00060010)] OP=[BIT,OFF] BIT=[2] +< CAUSE: TARGET=[REG(0x00060010)] OP=[BIT,ON] BIT=[3] +< #suet OCCGPE0_HALT_FAIL:tc1- EFFECT: TARGET=[REG(0x00060021)] OP=[BIT,OFF] BIT=[0] +< EFFECT: TARGET=[REG(0x00060021)] OP=[BIT,ON] BIT=[0] +< } +< +< CAUSE_EFFECT { +< LABEL=[OCC GPE1 HALT] +< WATCH=[REG(0x00062010)] +< CAUSE: TARGET=[REG(0x00062010)] OP=[BIT,OFF] BIT=[1] +< CAUSE: TARGET=[REG(0x00062010)] OP=[BIT,OFF] BIT=[2] +< CAUSE: TARGET=[REG(0x00062010)] OP=[BIT,ON] BIT=[3] +< #suet OCCGPE1_HALT_FAIL:tc1- EFFECT: TARGET=[REG(0x00062021)] OP=[BIT,OFF] BIT=[0] +< EFFECT: TARGET=[REG(0x00062021)] OP=[BIT,ON] BIT=[0] +< } +< +< +< ## +134,409c64 +< +< ## Core0 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x200F0110)] +< CAUSE: TARGET=[REG(0x200F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x200F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x200F0110)] +< EFFECT: TARGET=[REG(0x200F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x200F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x200F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x200F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core0 End +< +< ## Core1 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x210F0110)] +< CAUSE: TARGET=[REG(0x210F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x210F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x210F0110)] +< EFFECT: TARGET=[REG(0x210F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x210F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x210F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x210F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core1 End +< +< ## Core2 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x220F0110)] +< CAUSE: TARGET=[REG(0x220F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x220F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x200F0110)] +< EFFECT: TARGET=[REG(0x220F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x220F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x220F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x220F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core2 End +< +< ## Core3 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x230F0110)] +< CAUSE: TARGET=[REG(0x230F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x230F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x230F0110)] +< EFFECT: TARGET=[REG(0x230F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x230F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x230F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x230F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core3 End +< +< ## Core4 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x240F0110)] +< CAUSE: TARGET=[REG(0x240F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x240F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x240F0110)] +< EFFECT: TARGET=[REG(0x240F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x240F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x240F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x240F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core4 End +< +< ## Core5 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x250F0110)] +< CAUSE: TARGET=[REG(0x250F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x250F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x250F0110)] +< EFFECT: TARGET=[REG(0x250F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x250F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x250F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x250F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core5 End +< +< ## Core6 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x260F0110)] +< CAUSE: TARGET=[REG(0x260F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x260F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x200F0110)] +< EFFECT: TARGET=[REG(0x260F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x260F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x260F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x260F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core6 End +< +< ## Core7 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x270F0110)] +< CAUSE: TARGET=[REG(0x270F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x270F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x270F0110)] +< EFFECT: TARGET=[REG(0x270F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x270F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x270F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x270F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core7 End +< +< ## Core8 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x280F0110)] +< CAUSE: TARGET=[REG(0x280F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x280F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x280F0110)] +< EFFECT: TARGET=[REG(0x280F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x280F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x280F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x200F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core8 End +< +< ## Core9 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x290F0110)] +< CAUSE: TARGET=[REG(0x290F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x290F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x290F0110)] +< EFFECT: TARGET=[REG(0x290F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x290F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x290F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x290F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core9 End +< +< ## Core10 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x2A0F0110)] +< CAUSE: TARGET=[REG(0x2A0F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x2A0F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x2A0F0110)] +< EFFECT: TARGET=[REG(0x2A0F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2A0F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2A0F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2A0F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core10 End +< +< ## Core11 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x2B0F0110)] +< CAUSE: TARGET=[REG(0x2B0F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x2B0F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x2B0F0110)] +< EFFECT: TARGET=[REG(0x2B0F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2B0F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2B0F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2B0F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core11 End +< +< ## Core12 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x2C0F0110)] +< CAUSE: TARGET=[REG(0x2C0F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x2C0F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x2C0F0110)] +< EFFECT: TARGET=[REG(0x2C0F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2C0F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2C0F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2C0F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core12 End +< +< ## Core13 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x2D0F0110)] +< CAUSE: TARGET=[REG(0x2D0F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x2D0F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x2D0F0110)] +< EFFECT: TARGET=[REG(0x2D0F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2D0F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2D0F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2D0F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core13 End +< +< ## Core14 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x2E0F0110)] +< CAUSE: TARGET=[REG(0x2E0F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x2E0F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x2E0F0110)] +< EFFECT: TARGET=[REG(0x2E0F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2E0F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2E0F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2E0F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core14 End +< +< ## Core15 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x2F0F0110)] +< CAUSE: TARGET=[REG(0x2F0F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x2F0F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x2F0F0110)] +< EFFECT: TARGET=[REG(0x2F0F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2F0F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2F0F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x2F0F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core15 End +< +< ## Core16 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x300F0110)] +< CAUSE: TARGET=[REG(0x300F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x300F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x300F0110)] +< EFFECT: TARGET=[REG(0x300F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x300F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x300F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x300F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core16 End +< +< ## Core17 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x310F0110)] +< CAUSE: TARGET=[REG(0x310F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x310F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x310F0110)] +< EFFECT: TARGET=[REG(0x310F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x310F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x310F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x310F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core17 End +< +< ## Core18 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x320F0110)] +< CAUSE: TARGET=[REG(0x320F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x320F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x320F0110)] +< EFFECT: TARGET=[REG(0x320F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x320F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x320F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x320F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core18 End +< +< ## Core19 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x330F0110)] +< CAUSE: TARGET=[REG(0x330F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x330F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x330F0110)] +< EFFECT: TARGET=[REG(0x330F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x330F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x330F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x330F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core19 End +< +< ## Core20 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x340F0110)] +< CAUSE: TARGET=[REG(0x340F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x340F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x340F0110)] +< EFFECT: TARGET=[REG(0x340F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x340F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x340F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x340F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core20 End +< +< ## Core21 Start +< CAUSE_EFFECT { +--- +> CAUSE_EFFECT CHIPLETS ec { +411,478c66,89 +< WATCH=[REG(0x350F0110)] +< CAUSE: TARGET=[REG(0x350F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x350F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x350F0110)] +< EFFECT: TARGET=[REG(0x350F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x350F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x350F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x350F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core21 End +< +< ## Core22 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x360F0110)] +< CAUSE: TARGET=[REG(0x360F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x360F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x360F0110)] +< EFFECT: TARGET=[REG(0x360F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x360F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x360F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x360F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core22 End +< +< ## Core23 Start +< CAUSE_EFFECT { +< LABEL=[SSH_SRC_WRITE] +< WATCH=[REG(0x370F0110)] +< CAUSE: TARGET=[REG(0x370F0110)] OP=[EQUALTO,BUF] DATA=[REG(0x370F0110)] +< EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(0x370F0110)] +< EFFECT: TARGET=[REG(0x370F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x370F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x370F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< EFFECT: TARGET=[REG(0x370F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +< } +< ## Core23 End +< +< ## +< # Actions for Procedure - p9_block_wakeup_intr +< ## +< +< # Core Power Management Mode Register +< CAUSE_EFFECT { +< LABEL=[CPMMR Write OR of PPM Write Override] +< WATCH=[REG(0x290F0108)] +< CAUSE: TARGET=[REG(0x290F0108)] OP=[BIT,ON] BIT=[1] +< EFFECT: TARGET=[REG(0x290F0106)] OP=[BIT,ON] BIT=[1] +< } +< +< CAUSE_EFFECT { +< LABEL=[CPMMR Write CLEAR of PPM Write Override] +< WATCH=[REG(0x290F0107)] +< CAUSE: TARGET=[REG(0x290F0107)] OP=[BIT,ON] BIT=[1] +< EFFECT: TARGET=[REG(0x290F0106)] OP=[BIT,OFF] BIT=[1] +< } +< +< # General Power Management Mode Register +< CAUSE_EFFECT { +< LABEL=[GPMMR Write OR of Block Wakeup Events] +< WATCH=[REG(0x290F0102)] +< CAUSE: TARGET=[REG(0x290F0102)] OP=[BIT,ON] BIT=[6] +< EFFECT: TARGET=[REG(0x290F0100)] OP=[BIT,ON] BIT=[6] +< } +< +< CAUSE_EFFECT { +< LABEL=[GPMMR Write CLEAR of PPM Write Override] +< WATCH=[REG(0x290F0101)] +< CAUSE: TARGET=[REG(0x290F0101)] OP=[BIT,ON] BIT=[6] +< EFFECT: TARGET=[REG(0x290F0100)] OP=[BIT,OFF] BIT=[6] +--- +> WATCH=[REG(MYCHIPLET, 0x0F0110)] +> CAUSE: TARGET=[REG(MYCHIPLET, 0x0F0110)] OP=[EQUALTO,BUF] DATA=[REG(MYCHIPLET, 0x0F0110)] +> EFFECT: TARGET=[SSH(0x0)] OP=[EQUALTO,BUF] DATA=[REG(MYCHIPLET, 0x0F0110)] +> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F0111)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F0112)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F0113)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F0114)] OP=[EQUALTO,BUF] DATA=[SSH(0x0)] +> } +> +> ## Action triggered when all threads are idle +> # Used for istep 16 to have hostboot properly wake up on SBE-set PSU +> # interrupt as well as to have p9_sbe_check_master_stop15.C properly +> # execute in firmware simics. +> # TODO: RTC 147787 +> CAUSE_EFFECT CHIPLETS ec { +> LABEL=[Master Winkle LPCR] +> WATCH=[IDLESTATE(MYCHIPLET,0x0)] +> # look for stop15 +> CAUSE: TARGET=[IDLESTATE(MYCHIPLET,0x0)] OP=[EQUALTO,BUF,MASK] DATA=[LITERAL(32,0F000000)] MASK=[LITERAL(32,FF000000)] +> # Restore LPCR for wake-up options. +> EFFECT: TARGET=[PROCREG(lpcr, MYCORE, 0)] OP=[BIT,ON] BIT=[17] +> EFFECT: TARGET=[PROCREG(lpcr, MYCORE, 0)] OP=[BIT,ON] BIT=[49] +> # Set required C_PPM_SSHOTR register required by procedure +> EFFECT: TARGET=[REG(0x200F0113)] OP=[EQUALTO,BUF] DATA=[LITERAL(64,8BB00000 FFFFFFFF)] +514c125 +< ## Actions for p9_pm_ocb_init +--- +> # Actions for Procedure - p9_hcd_core_poweron / p9_hcd_cache_poweron +517,524c128,133 +< CAUSE_EFFECT { +< LABEL=[Channel 0 linear stream] +< WATCH=[REG(0x0006D013)] +< WATCH=[REG(0x0006D012)] +< CAUSE: TARGET=[REG(0x0006D013)] OP=[BIT,ON] BIT=[4] +< CAUSE: TARGET=[REG(0x0006D012)] OP=[BIT,ON] BIT=[5] +< EFFECT: TARGET=[REG(0x0006D011)] OP=[BIT,ON] BIT=[4] +< EFFECT: TARGET=[REG(0x0006D011)] OP=[BIT,OFF] BIT=[5] +--- +> CAUSE_EFFECT CHIPLETS ec cache { +> LABEL=[Power on core/cache vdd pfet then fsm is idle and sense is enabled] +> WATCH=[REG(MYCHIPLET, 0x0F011A)] +> CAUSE: TARGET=[REG(MYCHIPLET, 0x0F011A)] OP=[BIT,ON] BIT=[0] +> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F0118)] OP=[BIT,ON] BIT=[42] +> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F011C)] OP=[BIT,ON] BIT=[0] +527,1071c136 +< CAUSE_EFFECT { +< LABEL=[Channel 1 linear stream] +< WATCH=[REG(0x0006D033)] +< WATCH=[REG(0x0006D032)] +< CAUSE: TARGET=[REG(0x0006D033)] OP=[BIT,ON] BIT=[4] +< CAUSE: TARGET=[REG(0x0006D032)] OP=[BIT,ON] BIT=[5] +< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,ON] BIT=[4] +< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,OFF] BIT=[5] +< } +< +< CAUSE_EFFECT { +< LABEL=[Channel 1 circular push interupt enable] +< WATCH=[REG(0x0006D033)] +< CAUSE: TARGET=[REG(0x0006D033)] OP=[BIT,ON] BIT=[3] +< CAUSE: TARGET=[REG(0x0006D033)] OP=[BIT,ON] BIT=[4] +< CAUSE: TARGET=[REG(0x0006D033)] OP=[BIT,ON] BIT=[5] +< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,ON] BIT=[3] +< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,ON] BIT=[4] +< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,ON] BIT=[5] +< } +< +< CAUSE_EFFECT { +< LABEL=[Channel 1 circular push interrupt disable] +< WATCH=[REG(0x0006D033)] +< WATCH=[REG(0x0006D032)] +< CAUSE: TARGET=[REG(0x0006D032)] OP=[BIT,ON] BIT=[3] +< CAUSE: TARGET=[REG(0x0006D033)] OP=[BIT,ON] BIT=[4] +< CAUSE: TARGET=[REG(0x0006D033)] OP=[BIT,ON] BIT=[5] +< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,OFF] BIT=[3] +< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,ON] BIT=[4] +< EFFECT: TARGET=[REG(0x0006D031)] OP=[BIT,ON] BIT=[5] +< } +< +< CAUSE_EFFECT { +< LABEL=[Channel 2 linear stream] +< WATCH=[REG(0x0006D053)] +< WATCH=[REG(0x0006D052)] +< CAUSE: TARGET=[REG(0x0006D053)] OP=[BIT,ON] BIT=[4] +< CAUSE: TARGET=[REG(0x0006D052)] OP=[BIT,ON] BIT=[5] +< EFFECT: TARGET=[REG(0x0006D051)] OP=[BIT,ON] BIT=[4] +< EFFECT: TARGET=[REG(0x0006D051)] OP=[BIT,OFF] BIT=[5] +< } +< +< CAUSE_EFFECT { +< LABEL=[Channel 3 linear stream] +< WATCH=[REG(0x0006D073)] +< WATCH=[REG(0x0006D072)] +< CAUSE: TARGET=[REG(0x0006D073)] OP=[BIT,ON] BIT=[4] +< CAUSE: TARGET=[REG(0x0006D072)] OP=[BIT,ON] BIT=[5] +< EFFECT: TARGET=[REG(0x0006D071)] OP=[BIT,ON] BIT=[4] +< EFFECT: TARGET=[REG(0x0006D071)] OP=[BIT,OFF] BIT=[5] +< ## Actions for Procedure - p9_setup_evid +< ## +< +< CAUSE_EFFECT { +< LABEL=[AVSBus Write data register 0B] +< WATCH=[REG(0x0006C718)] +< CAUSE: TARGET=[REG(0x0006C718)] OP=[BIT,ON] BIT=[1] +< EFFECT: TARGET=[REG(0x0006C716)] OP=[BIT,ON] BIT=[0] +< } +< +< CAUSE_EFFECT { +< LABEL=[AVSBus Status register 0B] +< WATCH_READ=[REG(0x0006C716)] +< CAUSE: TARGET=[REG(0x0006C716)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x0006C716)] OP=[BIT,OFF] BIT=[0] +< } +< +< CAUSE_EFFECT { +< LABEL=[AVSBus Write data register 1B] +< WATCH=[REG(0x0006C738)] +< CAUSE: TARGET=[REG(0x0006C738)] OP=[BIT,ON] BIT=[1] +< EFFECT: TARGET=[REG(0x0006C736)] OP=[BIT,ON] BIT=[0] +< } +< +< CAUSE_EFFECT { +< LABEL=[AVSBus Status register 1B] +< WATCH_READ=[REG(0x0006C736)] +< CAUSE: TARGET=[REG(0x0006C736)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x0006C736)] OP=[BIT,OFF] BIT=[0] +< } +< +< ## Core 0 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x200F011A)] +< CAUSE: TARGET=[REG(0x200F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x200F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x200F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 0 End +< ## Core 1 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x210F011A)] +< CAUSE: TARGET=[REG(0x210F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x210F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x210F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 1 End +< ## Core 2 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x220F011A)] +< CAUSE: TARGET=[REG(0x220F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x220F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x220F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 2 End +< ## Core 3 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x230F011A)] +< CAUSE: TARGET=[REG(0x230F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x230F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x230F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 3 End +< ## Core 4 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x240F011A)] +< CAUSE: TARGET=[REG(0x240F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x240F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x240F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 4 End +< ## Core 5 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x250F011A)] +< CAUSE: TARGET=[REG(0x250F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x250F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x250F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 5 End +< ## Core 6 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x260F011A)] +< CAUSE: TARGET=[REG(0x260F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x260F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x260F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 6 End +< ## Core 7 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x270F011A)] +< CAUSE: TARGET=[REG(0x270F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x270F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x270F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 7 End +< ## Core 8 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x280F011A)] +< CAUSE: TARGET=[REG(0x280F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x280F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x280F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 8 End +< ## Core 9 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x290F011A)] +< CAUSE: TARGET=[REG(0x290F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x290F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x290F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 9 End +< ## Core 10 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x2a0F011A)] +< CAUSE: TARGET=[REG(0x2a0F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x2a0F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x2a0F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 10 End +< ## Core 11 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x2b0F011A)] +< CAUSE: TARGET=[REG(0x2b0F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x2b0F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x2b0F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 11 End +< ## Core 12 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x2c0F011A)] +< CAUSE: TARGET=[REG(0x2c0F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x2c0F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x2c0F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 12 End +< ## Core 13 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x2d0F011A)] +< CAUSE: TARGET=[REG(0x2d0F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x2d0F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x2d0F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 13 End +< ## Core 14 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x2e0F011A)] +< CAUSE: TARGET=[REG(0x2e0F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x2e0F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x2e0F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 14 End +< ## Core 15 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x2f0F011A)] +< CAUSE: TARGET=[REG(0x2f0F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x2f0F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x2f0F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 15 End +< ## Core 16 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x300F011A)] +< CAUSE: TARGET=[REG(0x300F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x300F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x300F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 16 End +< ## Core 17 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x310F011A)] +< CAUSE: TARGET=[REG(0x310F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x310F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x310F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 17 End +< ## Core 18 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x320F011A)] +< CAUSE: TARGET=[REG(0x320F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x320F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x320F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 18 End +< ## Core 19 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x330F011A)] +< CAUSE: TARGET=[REG(0x330F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x330F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x330F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 19 End +< ## Core 20 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x340F011A)] +< CAUSE: TARGET=[REG(0x340F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x340F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x340F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 20 End +< ## Core 21 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x350F011A)] +< CAUSE: TARGET=[REG(0x350F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x350F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x350F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 21 End +< ## Core 22 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x360F011A)] +< CAUSE: TARGET=[REG(0x360F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x360F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x360F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 22 End +< ## Core 23 Start +< +< ## +< # Actions for Procedure - p9_hcd_core_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on core vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x370F011A)] +< CAUSE: TARGET=[REG(0x370F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x370F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x370F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< # Core 23 End +< ## EQ 0 Start +< +< ## +< # Actions for Procedure - p9_hcd_cache_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on cache vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x100F011A)] +< CAUSE: TARGET=[REG(0x100F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x100F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x100F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< CAUSE_EFFECT { +< LABEL=[Power on cache vcs pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x100F011A)] +< CAUSE: TARGET=[REG(0x100F011A)] OP=[BIT,ON] BIT=[2] +< EFFECT: TARGET=[REG(0x100F0118)] OP=[BIT,ON] BIT=[50] +< EFFECT: TARGET=[REG(0x100F011C)] OP=[BIT,ON] BIT=[2] +< } +< +< ## EQ 0 End +< +< ## EQ 1 Start +< +< ## +< # Actions for Procedure - p9_hcd_cache_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on cache vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x110F011A)] +< CAUSE: TARGET=[REG(0x110F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x110F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x110F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< CAUSE_EFFECT { +< LABEL=[Power on cache vcs pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x110F011A)] +< CAUSE: TARGET=[REG(0x110F011A)] OP=[BIT,ON] BIT=[2] +< EFFECT: TARGET=[REG(0x110F0118)] OP=[BIT,ON] BIT=[50] +< EFFECT: TARGET=[REG(0x110F011C)] OP=[BIT,ON] BIT=[2] +< } +< +< ## EQ 1 End +< +< ## EQ 2 Start +< +< ## +< # Actions for Procedure - p9_hcd_cache_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on cache vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x120F011A)] +< CAUSE: TARGET=[REG(0x120F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x120F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x120F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< CAUSE_EFFECT { +< LABEL=[Power on cache vcs pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x120F011A)] +< CAUSE: TARGET=[REG(0x120F011A)] OP=[BIT,ON] BIT=[2] +< EFFECT: TARGET=[REG(0x120F0118)] OP=[BIT,ON] BIT=[50] +< EFFECT: TARGET=[REG(0x120F011C)] OP=[BIT,ON] BIT=[2] +< } +< +< ## EQ 2 End +< +< ## EQ 3 Start +< +< ## +< # Actions for Procedure - p9_hcd_cache_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on cache vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x130F011A)] +< CAUSE: TARGET=[REG(0x130F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x130F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x130F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< CAUSE_EFFECT { +< LABEL=[Power on cache vcs pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x130F011A)] +< CAUSE: TARGET=[REG(0x130F011A)] OP=[BIT,ON] BIT=[2] +< EFFECT: TARGET=[REG(0x130F0118)] OP=[BIT,ON] BIT=[50] +< EFFECT: TARGET=[REG(0x130F011C)] OP=[BIT,ON] BIT=[2] +< } +< +< ## EQ 3 End +< +< ## EQ 4 Start +< +< ## +< # Actions for Procedure - p9_hcd_cache_poweron +< ## +< +< CAUSE_EFFECT { +--- +> CAUSE_EFFECT CHIPLETS cache { +1073,1084c138,141 +< WATCH=[REG(0x140F011A)] +< CAUSE: TARGET=[REG(0x140F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x140F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x140F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< CAUSE_EFFECT { +< LABEL=[Power on cache vcs pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x140F011A)] +< CAUSE: TARGET=[REG(0x140F011A)] OP=[BIT,ON] BIT=[2] +< EFFECT: TARGET=[REG(0x140F0118)] OP=[BIT,ON] BIT=[50] +< EFFECT: TARGET=[REG(0x140F011C)] OP=[BIT,ON] BIT=[2] +--- +> WATCH=[REG(MYCHIPLET, 0x0F011A)] +> CAUSE: TARGET=[REG(MYCHIPLET, 0x0F011A)] OP=[BIT,ON] BIT=[2] +> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F0118)] OP=[BIT,ON] BIT=[50] +> EFFECT: TARGET=[REG(MYCHIPLET, 0x0F011C)] OP=[BIT,ON] BIT=[2] +1087,1112d143 +< ## EQ 4 End +< +< ## EQ 5 Start +< +< ## +< # Actions for Procedure - p9_hcd_cache_poweron +< ## +< +< CAUSE_EFFECT { +< LABEL=[Power on cache vdd pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x150F011A)] +< CAUSE: TARGET=[REG(0x150F011A)] OP=[BIT,ON] BIT=[0] +< EFFECT: TARGET=[REG(0x150F0118)] OP=[BIT,ON] BIT=[42] +< EFFECT: TARGET=[REG(0x150F011C)] OP=[BIT,ON] BIT=[0] +< } +< +< CAUSE_EFFECT { +< LABEL=[Power on cache vcs pfet then fsm is idle and sense is enabled] +< WATCH=[REG(0x150F011A)] +< CAUSE: TARGET=[REG(0x150F011A)] OP=[BIT,ON] BIT=[2] +< EFFECT: TARGET=[REG(0x150F0118)] OP=[BIT,ON] BIT=[50] +< EFFECT: TARGET=[REG(0x150F011C)] OP=[BIT,ON] BIT=[2] +< } +< +< ## EQ 5 End +< diff --git a/src/test/framework/etc/patches/standalone.simics.patch b/src/test/framework/etc/patches/standalone.simics.patch new file mode 100644 index 00000000..bdc40fd8 --- /dev/null +++ b/src/test/framework/etc/patches/standalone.simics.patch @@ -0,0 +1,4 @@ +52c52 +< ($hb_masterproc).proc_chip.invoke parallel_store SCOM 0x5003A "00000000_00000000" 64 +--- +> ($hb_masterproc).proc_chip.invoke parallel_store SCOM 0x5003A "80000000_00000000" 64 diff --git a/src/test/framework/etc/workarounds.postsimsetup b/src/test/framework/etc/workarounds.postsimsetup new file mode 100755 index 00000000..ac7f3a29 --- /dev/null +++ b/src/test/framework/etc/workarounds.postsimsetup @@ -0,0 +1,44 @@ +#!/bin/sh +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/framework/etc/workarounds.postsimsetup $ +# +# 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 +## Workarounds that are run after start_simics is executed for the first time +## to setup the sandbox +## + +### Example applying a patch to cec-chip files +#echo "+++ Updating something wonderful in a simics file" +#mkdir -p $sb/simu/data/cec-chip/ +#cp $BACKING_BUILD/src/simu/data/cec-chip/base_cec_chip_file $sb/simu/data/cec-chip +#patch -p0 $sb/simu/data/cec-chip/base_cec_chip_file $SBEROOT/src/build/citest/etc/patches/my_patch_File + +# NOTE: The below patch removes mailbox settings in standalone.simics (comes +# from HB) that cause the SBE to run in plck mode. For our CI, we need the SBE +# to be in istep mode. This patch is likely never going to be removed as long as +# we need our CI to run in istep mode. +echo "+++ Patching standalone.simics" +mkdir -p $SANDBOXBASE/obj/ppc/simu/scripts/hbfw +cp $BACKING_BUILD/obj/ppc/simu/scripts/hbfw/standalone.simics $SANDBOXBASE/obj/ppc/simu/scripts/hbfw +patch -p0 $SANDBOXBASE/obj/ppc/simu/scripts/hbfw/standalone.simics $SBEROOT/src/test/framework/etc/patches/standalone.simics.patch + diff --git a/src/test/framework/etc/workarounds.presimsetup b/src/test/framework/etc/workarounds.presimsetup new file mode 100755 index 00000000..e863b07d --- /dev/null +++ b/src/test/framework/etc/workarounds.presimsetup @@ -0,0 +1,31 @@ +#!/bin/sh +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/framework/etc/workarounds.presimsetup $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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 + +#### Examples #### +#echo "+++ Some message about why you need to do this." +#mkdir -p $sb/simu/data +#egrep -v "WSALIAS DEFAULT FIPSLEVEL|WSALIAS DEFAULT SIMICSLEVEL" $BACKING_BUILD/src/simu/data/simicsInfo > $sb/simu/data/simicsInfo +#echo "WSALIAS DEFAULT FIPSLEVEL env/gfwb/simics-4.2.0/simics-4.2.83/fips/fld36/fi120201a700.42" >> $sb/simu/data/simicsInfo +#echo "WSALIAS DEFAULT SIMICSLEVEL env/vtechb/simics-4.2.0/simics-4.2.83/bin" >> $sb/simu/data/simicsInfo diff --git a/src/test/framework/populate-sandbox b/src/test/framework/populate-sandbox new file mode 100755 index 00000000..729b61fa --- /dev/null +++ b/src/test/framework/populate-sandbox @@ -0,0 +1,60 @@ +#!/bin/sh +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/framework/populate-sandbox $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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 + +# Ensure sandbox exists (create-sandbox has been called). +if [ -z $SANDBOXBASE ]; +then + echo "SANDBOXBASE variable uninitialized.." + exit -1 +fi + +if [ ! -d "$SANDBOXBASE" ]; +then + echo "Cannot find sandbox: $SANDBOXBASE" + exit -1 +fi + +# Create test directory. +mkdir -p $SBETESTDIR || exit -1 + +# Create test directory. +mkdir -p $SBEFW_IMG_DIR || exit -1 + +# Copy sbe binaries +cp $SBEROOT/images/*.bin $SBEFW_IMG_DIR/ || exit -1 +cp $SBEROOT/images/simics.tar $SBEFW_DIR/ || exit -1 +# Compile sbe code in sandbox to copy binaries at right place +echo "---Setup sandbox for sbe binaries." + +execute_in_sandbox "cd $SBEFW_DIR; mk -a" \ + "ppc" || exit -1 + +execute_in_sandbox "cd $SBEFW_DIR; mk install_all" \ + "ppc" || exit -1 + + +# Copy test files. +cp -r $SBEROOT/src/test/testcases/* $SBETESTDIR/ || exit -1 + diff --git a/src/test/framework/sbetest-start.sh b/src/test/framework/sbetest-start.sh new file mode 100755 index 00000000..a0d7f27a --- /dev/null +++ b/src/test/framework/sbetest-start.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/framework/sbetest-start.sh $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 +if [ -z $SBE_CI_ENV_SETUP ]; +then + unset $SANDBOXBASE + unset $SANDBOXNAME + source "$SBEROOT/src/test/framework/setup-env" +fi + +# Front end to autocitest - script to execute unit tests under simics. +# +## when jenkins runs it will create a workspace with the built code tree +## and drop us into it. +autocitest ${BACKING_BUILD} + +exit $? diff --git a/src/test/framework/setup-env b/src/test/framework/setup-env new file mode 100755 index 00000000..6de2d8fd --- /dev/null +++ b/src/test/framework/setup-env @@ -0,0 +1,84 @@ +#!/bin/sh +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/framework/setup-env $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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 + +export CITESTPATH=${SBEROOT}/src/test/framework +export PATH=${CITESTPATH}:${PATH} + +# If we are running under Jenkins we need to pick a random-ish sandbox name +# so that the autoipl tools do not have a /tmp name collision. +if [ -z $JOB_NAME -o -z $BUILD_NUMBER ]; +then + SBECI_SANDBOX="test_sb" +else + export RUNNING_UNDER_JENKINS=1 + SBECI_SANDBOX=`echo $JOB_NAME $BUILD_NUMBER | md5sum | head -c10` +fi + +# Setup sandbox location variables. +if [ -z $SANDBOXROOT ]; +then + export SANDBOXROOT=${SBEROOT} +fi + +if [ -z $SANDBOXNAME ] || [ "$RUNNING_UNDER_JENKINS" = "1" ]; +then + export SANDBOXNAME=${SBECI_SANDBOX} +fi + +export SANDBOXBASE=${SANDBOXROOT}/${SANDBOXNAME} + +if [ -z $SANDBOXRC ]; +then + export SANDBOXRC=${SANDBOXROOT}/sbesandboxrc +fi +# Useful utility function. +execute_in_sandbox() +{ + WORKON_CMD="workon -rc ${SANDBOXRC} -sb ${SANDBOXNAME} -m $2 " + echo $1 > ${SANDBOXBASE}/src/sandbox_execute_cmd + chmod 700 ${SANDBOXBASE}/src/sandbox_execute_cmd + + TEST="${WORKON_CMD} -c ./sandbox_execute_cmd " + echo $TEST + ${WORKON_CMD} -c ./sandbox_execute_cmd + + if [ $? -ne 0 ]; then + return 1 + fi + + rm ${SANDBOXBASE}/src/sandbox_execute_cmd +} +export -f execute_in_sandbox + +# Setup machine type. +export MACHINE=${MACHINE:-$DEFAULT_MACHINE} + +export SBETESTDIR=$SANDBOXBASE/simics/targets/p9_nimbus/sbeTest +export SBEFW_DIR=$SANDBOXBASE/src/sbei/sbfw/ +export SBEFW_IMG_DIR=$SANDBOXBASE/src/sbei/sbfw/img +export AUTOSIM_FFDC_XML=$SBETESTDIR/ffdc.xml +export SBE_TEST_XML=$SBETESTDIR/test.xml +# Indicate we setup the CI environment. +export SBE_CI_ENV_SETUP=1 diff --git a/src/test/test.xml b/src/test/test.xml deleted file mode 100755 index 2172b8f6..00000000 --- a/src/test/test.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - %%machine%% - - - p9Proc0.pib_psu->tppsu_tpbr_interrupt_msg_available=[NIL] - - ../simics/targets/p9_nimbus/sbeTest/testIstep.xml - ../simics/targets/p9_nimbus/sbeTest/testScom.xml - ../simics/targets/p9_nimbus/sbeTest/testGeneric.xml - - - ../simics/targets/p9_nimbus/sbeTest/testSram.xml - ../simics/targets/p9_nimbus/sbeTest/testCntlInstruction.xml - ../simics/targets/p9_nimbus/sbeTest/testRegAccess.xml - ../simics/targets/p9_nimbus/sbeTest/testFifoReset.xml - ../simics/targets/p9_nimbus/sbeTest/testAduMem.xml - ../simics/targets/p9_nimbus/sbeTest/testExecutorPutRing.xml - ../simics/targets/p9_nimbus/sbeTest/testGetRing.xml - - sbe-trace 0 - - - - diff --git a/src/test/testAbort.py b/src/test/testAbort.py deleted file mode 100755 index 7039c70b..00000000 --- a/src/test/testAbort.py +++ /dev/null @@ -1,57 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testAbort.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -TESTDATA = [0,0,0,2, - 0,0,0xA8,0x04 ] - -EXPDATA = [0xc0,0xde,0xa8,0x04, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x3]; - - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - testUtil.writeUsFifo( TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( 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/testAduMem.xml b/src/test/testAduMem.xml deleted file mode 100644 index 1fcbe12d..00000000 --- a/src/test/testAduMem.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - run-python-file targets/p9_nimbus/sbeTest/testAduMem_ecc.py - yes - - - run-python-file targets/p9_nimbus/sbeTest/testAduMem_itag.py - yes - - - run-python-file targets/p9_nimbus/sbeTest/testAduMem_withEccItag.py - yes - - - run-python-file targets/p9_nimbus/sbeTest/testAduMem_noEccNoItag.py - yes - - diff --git a/src/test/testAduMem_ecc.py b/src/test/testAduMem_ecc.py deleted file mode 100644 index f60af64e..00000000 --- a/src/test/testAduMem_ecc.py +++ /dev/null @@ -1,68 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testAduMem_ecc.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -LOOP_COUNT = 1 - -GETMEMADU_TESTDATA_ECC = [0,0,0,0x6, - 0,0,0xA4,0x01, - 0,0,0x0,0xAD, #CoreChipletId/EccByte/Flags - CacheInhibit/FastMode/NoTag/Ecc/AutoIncr/Adu/Proc - 0,0,0,0, # Addr Upper 32 bit - 0x08,0x00,0x00,0x00, # Addr Lower 32 bit - 0x00,0x00,0x00,0x20] # length of data - -GETMEMADU_EXPDATA_ECC = [0x00,0x00,0x00,0x24, # length of data - 0xc0,0xde,0xa4,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - - # GetMemAdu with Ecc - testUtil.writeUsFifo( GETMEMADU_TESTDATA_ECC) - testUtil.writeEot( ) - - testUtil.readDsEntry ( 9 ) - testUtil.readDsFifo( GETMEMADU_EXPDATA_ECC) - testUtil.runCycles( 10000000 ) - 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/testAduMem_itag.py b/src/test/testAduMem_itag.py deleted file mode 100644 index 8c7d9a3c..00000000 --- a/src/test/testAduMem_itag.py +++ /dev/null @@ -1,66 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testAduMem_itag.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -GETMEMADU_TESTDATA_ITAG = [0,0,0,0x6, - 0,0,0xA4,0x01, - 0,0,0x0,0xB5, #CoreChipletId/EccByte/Flags -> CacheInhibit/FastMode/Tag/NoEcc/AutoIncr/Adu/Proc - 0,0,0,0, # Addr Upper 32 bit - 0x08,0x00,0x00,0x00, # Addr Lower 32 bit - 0x00,0x00,0x00,0x40] # length of data - -GETMEMADU_EXPDATA_ITAG = [0x00,0x00,0x00,0x48, # length of data - 0xc0,0xde,0xa4,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - - # GetMemAdu with Itag - testUtil.writeUsFifo( GETMEMADU_TESTDATA_ITAG ) - testUtil.writeEot( ) - - testUtil.readDsEntry ( 18 ) - testUtil.readDsFifo( GETMEMADU_EXPDATA_ITAG ) - testUtil.runCycles( 10000000 ) - 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/testAduMem_noEccNoItag.py b/src/test/testAduMem_noEccNoItag.py deleted file mode 100644 index ccbad942..00000000 --- a/src/test/testAduMem_noEccNoItag.py +++ /dev/null @@ -1,99 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testAduMem_noEccNoItag.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -LOOP_COUNT = 1 - -PUTMEMADU_CNTLDATA = [0,0,0,0, - 0,0,0xA4,0x02, - 0,0,0x0,0xA5, #CoreChipletId/EccByte/Flags -> NoEccOverride/CacheInhibit/FastMode/NoTag/NoEcc/AutoIncr/Adu/Proc - 0,0,0,0, # Addr Upper 32 bit - 0x08,0x00,0x00,0x00, # Addr Lower 32 bit - 0x00,0x00,0x00,0x10] # length of data - -PUTMEMADU_TESTDATA = [0xab,0xcd,0xef,0x12, - 0xba,0xdc,0xfe,0x21, - 0x34,0x56,0x78,0x9a, - 0x43,0x65,0x87,0xa9] - -PUTMEMADU_EXPDATA = [0x00,0x00,0x00,0x10, # length of data - 0xc0,0xde,0xa4,0x02, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - - - -GETMEMADU_TESTDATA = [0,0,0,0x6, - 0,0,0xA4,0x01, - 0,0,0x0,0xA5, #CoreChipletId/EccByte/Flags -> CacheInhibit/FastMode/NoTag/NoEcc/AutoIncr/Adu/Proc - 0,0,0,0, # Addr Upper 32 bit - 0x08,0x00,0x00,0x00, # Addr Lower 32 bit - 0x00,0x00,0x00,0x10] # length of data - -GETMEMADU_EXPDATA = [0xab,0xcd,0xef,0x12, #data - 0xba,0xdc,0xfe,0x21, - 0x34,0x56,0x78,0x9a, - 0x43,0x65,0x87,0xa9, - 0x00,0x00,0x00,0x10, # length of data - 0xc0,0xde,0xa4,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - - #PutMemAdu Test - testUtil.writeUsFifo( PUTMEMADU_CNTLDATA ) - testUtil.writeUsFifo( PUTMEMADU_TESTDATA ) - testUtil.writeEot( ) - - testUtil.readDsFifo( PUTMEMADU_EXPDATA ) - testUtil.readEot( ) - - # GetMemAdu test - testUtil.writeUsFifo( GETMEMADU_TESTDATA ) - testUtil.writeEot( ) - - testUtil.readDsFifo( GETMEMADU_EXPDATA ) - testUtil.runCycles( 10000000 ) - 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/testAduMem_withEccItag.py b/src/test/testAduMem_withEccItag.py deleted file mode 100644 index 7db53813..00000000 --- a/src/test/testAduMem_withEccItag.py +++ /dev/null @@ -1,66 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testAduMem_withEccItag.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -GETMEMADU_TESTDATA_ECC_ITAG = [0,0,0,0x6, - 0,0,0xA4,0x01, - 0,0,0x0,0xBD, #CoreChipletId/EccByte/Flags -> CacheInhibit/FastMode/Tag/Ecc/AutoIncr/Adu/Proc - 0,0,0,0, # Addr Upper 32 bit - 0x08,0x00,0x00,0x00, # Addr Lower 32 bit - 0x00,0x00,0x00,0x40] # length of data - -GETMEMADU_EXPDATA_ECC_ITAG = [0x00,0x00,0x00,0x50, # length of data - 0xc0,0xde,0xa4,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - - # GetMemAdu with Ecc with Itag test - testUtil.writeUsFifo( GETMEMADU_TESTDATA_ECC_ITAG ) - testUtil.writeEot( ) - - testUtil.readDsEntry ( 20 ) - testUtil.readDsFifo( GETMEMADU_EXPDATA_ECC_ITAG ) - testUtil.runCycles( 10000000 ) - 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/testAduMem_withEccWithItagReadWrite.py b/src/test/testAduMem_withEccWithItagReadWrite.py deleted file mode 100644 index 95578979..00000000 --- a/src/test/testAduMem_withEccWithItagReadWrite.py +++ /dev/null @@ -1,96 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testAduMem_withEccWithItagReadWrite.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -LOOP_COUNT = 1 - -PUTMEMADU_CNTLDATA = [0,0,0,0, - 0,0,0xA4,0x02, - 0,0x07,0x0,0xBD, #CoreChipletId/EccByteTrue/Flags -> EccOverride/CacheInhibit/FastMode/Tag/EccOverride/AutoIncr/Adu/Proc - 0,0,0,0, # Addr Upper 32 bit - 0x08,0x00,0x00,0x00, # Addr Lower 32 bit - 0x00,0x00,0x00,0x08] # length of data - -PUTMEMADU_TESTDATA = [0xab,0xcd,0xef,0x12, - 0xba,0xdc,0xfe,0x21] - -PUTMEMADU_EXPDATA = [0x00,0x00,0x00,0x0a, # length of data - 0xc0,0xde,0xa4,0x02, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03] - - - -GETMEMADU_TESTDATA = [0,0,0,0x6, - 0,0,0xA4,0x01, - 0,0,0x0,0xBD, #CoreChipletId/EccByte/Flags -> CacheInhibit/FastMode/Tag/Ecc/AutoIncr/Adu/Proc - 0,0,0,0, # Addr Upper 32 bit - 0x08,0x00,0x00,0x00, # Addr Lower 32 bit - 0x00,0x00,0x00,0x08] # length of data - -GETMEMADU_EXPDATA = [0xab,0xcd,0xef,0x12, #data - 0xba,0xdc,0xfe,0x21, - 0x01,0x07,0,0, #First Byte is iTag / Second Byte is ECC - 0x00,0x00,0x00,0x0a, # length of data - 0xc0,0xde,0xa4,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - - #PutMemAdu Test - testUtil.writeUsFifo( PUTMEMADU_CNTLDATA ) - testUtil.writeUsFifo( PUTMEMADU_TESTDATA ) - testUtil.writeEot( ) - - testUtil.readDsFifo( PUTMEMADU_EXPDATA ) - testUtil.readEot( ) - - # GetMemAdu test - testUtil.writeUsFifo( GETMEMADU_TESTDATA ) - testUtil.writeEot( ) - - testUtil.readDsFifo( GETMEMADU_EXPDATA ) - testUtil.runCycles( 10000000 ) - 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/testCntlInstruction.py b/src/test/testCntlInstruction.py deleted file mode 100644 index 125b1b67..00000000 --- a/src/test/testCntlInstruction.py +++ /dev/null @@ -1,473 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testCntlInstruction.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 * - -LOOP_COUNT = 1 - -#Invalid Input -INST_INVALID_TESTDATA = [0,0,0,3, - 0,0,0xa7,0x01, - 0,1,0x20,0xee] - - -INST_INVALID_EXPDATA_ERR = [0xc0,0xde,0xa7,0x01, - 0x00,0x02,0x00,0x0A, - 0x00,0x00,0x00,0x03] - -# STOP Ins -# core 0 thread 0 STOP WARN FLAG as true -INST_STOP_0_0_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x01] - -# core 0 thread 1 STOP WARN FLAG as true -INST_STOP_0_1_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x11] - -# core 0 thread 2 STOP WARN FLAG as true -INST_STOP_0_2_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x21] - -# core 0 thread 3 STOP with WARN FLAG as true -INST_STOP_0_3_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x31] - -# core 0 thread 0 STOP WARN FLAG as false -INST_STOP_0_0_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x01] - -# core 0 thread 1 STOP WARN FLAG as false -INST_STOP_0_1_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x11] - -# core 0 thread 2 STOP WARN FLAG as false -INST_STOP_0_2_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x21] - -# core 0 thread 3 STOP WARN FLAG as false -INST_STOP_0_3_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x31] - -# Stop All thread in Core0 with warn flag true -INST_STOP0_ALL_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0xf1] - -# Stop All thread in Core0 with warn flag false -INST_STOP0_ALL_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0xf1] - - -# START Ins -# core 0 thread 0 START WARN FLAG as true -INST_START_0_0_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x00] - -# core 0 thread 1 START WARN FLAG as true -INST_START_0_1_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x10] - -# core 0 thread 2 START WARN FLAG as true -INST_START_0_2_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x20] - -# core 0 thread 3 START with WARN FLAG as true -INST_START_0_3_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x30] - -# core 0 thread 0 START WARN FLAG as false -INST_START_0_0_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x00] - -# core 0 thread 1 START WARN FLAG as false -INST_START_0_1_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x10] - -# core 0 thread 2 START WARN FLAG as false -INST_START_0_2_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x20] - -# core 0 thread 3 START WARN FLAG as false -INST_START_0_3_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x30] - -# Start All thread in Core0 with warn flag true -INST_START0_ALL_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0xf0] - -# Start All thread in Core0 with warn flag false -INST_START0_ALL_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0xf0] - -# STEP Ins -# core 0 thread 0 STEP WARN FLAG as true -INST_STEP_0_0_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x02] - -# core 0 thread 1 STEP WARN FLAG as true -INST_STEP_0_1_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x12] - -# core 0 thread 2 STEP WARN FLAG as true -INST_STEP_0_2_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x22] - -# core 0 thread 3 STEP with WARN FLAG as true -INST_STEP_0_3_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x32] - -# core 0 thread 0 STEP WARN FLAG as false -INST_STEP_0_0_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x02] - -# core 0 thread 1 STEP WARN FLAG as false -INST_STEP_0_1_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x12] - -# core 0 thread 2 STEP WARN FLAG as false -INST_STEP_0_2_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x22] - -# core 0 thread 3 STEP WARN FLAG as false -INST_STEP_0_3_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x32] - -# Step All thread in Core0 with warn flag true -INST_STEP0_ALL_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0xf2] - -# Step All thread in Core0 with warn flag false -INST_STEP0_ALL_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0xf2] - -# SRESET Ins -# core 0 thread 0 SRESET WARN FLAG as true -INST_SRESET_0_0_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x03] - -# core 0 thread 1 SRESET WARN FLAG as true -INST_SRESET_0_1_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x13] - -# core 0 thread 2 SRESET WARN FLAG as true -INST_SRESET_0_2_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x23] - -# core 0 thread 3 SRESET with WARN FLAG as true -INST_SRESET_0_3_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0x33] - -# core 0 thread 0 SRESET WARN FLAG as false -INST_SRESET_0_0_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x03] - -# core 0 thread 1 SRESET WARN FLAG as false -INST_SRESET_0_1_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x13] - -# core 0 thread 2 SRESET WARN FLAG as false -INST_SRESET_0_2_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x23] - -# core 0 thread 3 SRESET WARN FLAG as false -INST_SRESET_0_3_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0x33] - -# Sreset All thread in Core0 with warn flag true -INST_SRESET0_ALL_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0xf3] - -# Sreset All thread in Core0 with warn flag false -INST_SRESET0_ALL_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,0,0x20,0xf3] - - -INST_EXPDATA = [0xc0,0xde,0xa7,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03] - -INST_EXPDATA_ERR = [0xc0,0xde,0xa7,0x01, - 0x00,0xFE,0x00,0x0A, - 0x00,0x00,0x00,0x03] - -STOP_INST_EXPDATA_ERR_WTH_FFDC = [0xc0,0xde,0xa7,0x01, - 0x00,0xFE,0x00,0x0A, - 0xFF,0xDC,0x00,0x02, - 0x00,0xCE,0xBC,0xB2, - 0x00,0x00,0x00,0x05] - -START_INST_EXPDATA_ERR_WTH_FFDC = [0xc0,0xde,0xa7,0x01, - 0x00,0xFE,0x00,0x0A, - 0xFF,0xDC,0x00,0x02, - 0x00,0x25,0x64,0xDB, - 0x00,0x00,0x00,0x05] - -STEP_INST_EXPDATA_ERR_WTH_FFDC = [0xc0,0xde,0xa7,0x01, - 0x00,0xFE,0x00,0x0A, - 0xFF,0xDC,0x00,0x02, - 0x00,0x0D,0x06,0x8E, - 0x00,0x00,0x00,0x05] - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - #Try an invalid data case - testUtil.writeUsFifo( INST_INVALID_TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_INVALID_EXPDATA_ERR ) - testUtil.readEot( ) - - # Control Instruction Message - Stop - testUtil.writeUsFifo( INST_STOP_0_0_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STOP_0_1_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STOP_0_2_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STOP_0_3_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STOP_0_0_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( STOP_INST_EXPDATA_ERR_WTH_FFDC ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STOP_0_1_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( STOP_INST_EXPDATA_ERR_WTH_FFDC ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STOP_0_2_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( STOP_INST_EXPDATA_ERR_WTH_FFDC ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STOP_0_3_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( STOP_INST_EXPDATA_ERR_WTH_FFDC ) - testUtil.readEot( ) - - #stop all thread in core0 - testUtil.writeUsFifo( INST_STOP0_ALL_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STOP0_ALL_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( STOP_INST_EXPDATA_ERR_WTH_FFDC ) - testUtil.readEot( ) - - # Control Instruction Message - Start - testUtil.writeUsFifo( INST_START_0_0_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_START_0_1_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_START_0_2_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_START_0_3_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - - testUtil.writeUsFifo( INST_START_0_0_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( START_INST_EXPDATA_ERR_WTH_FFDC ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_START_0_1_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( START_INST_EXPDATA_ERR_WTH_FFDC ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_START_0_2_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( START_INST_EXPDATA_ERR_WTH_FFDC ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_START_0_3_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( START_INST_EXPDATA_ERR_WTH_FFDC ) - testUtil.readEot( ) - - #start all thread in core0 - testUtil.writeUsFifo( INST_START0_ALL_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_START0_ALL_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( START_INST_EXPDATA_ERR_WTH_FFDC ) - testUtil.readEot( ) - - # Control Instruction Message - Step - testUtil.writeUsFifo( INST_STEP_0_0_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STEP_0_1_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STEP_0_2_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STEP_0_3_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STEP_0_0_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( STEP_INST_EXPDATA_ERR_WTH_FFDC ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STEP_0_1_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( STEP_INST_EXPDATA_ERR_WTH_FFDC ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STEP_0_2_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( STEP_INST_EXPDATA_ERR_WTH_FFDC ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STEP_0_3_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( STEP_INST_EXPDATA_ERR_WTH_FFDC ) - testUtil.readEot( ) - - #step all thread in core0 - testUtil.writeUsFifo( INST_STEP0_ALL_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_STEP0_ALL_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( STEP_INST_EXPDATA_ERR_WTH_FFDC ) - testUtil.readEot( ) - - # Control Instruction Message - Sreset - testUtil.writeUsFifo( INST_SRESET_0_0_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_SRESET_0_1_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_SRESET_0_2_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_SRESET_0_3_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_SRESET_0_0_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_SRESET_0_1_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_SRESET_0_2_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_SRESET_0_3_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - - #step all thread in core0 - testUtil.writeUsFifo( INST_SRESET0_ALL_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( INST_SRESET0_ALL_TESTDATA_WITHOUT_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_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/testCntlInstruction.xml b/src/test/testCntlInstruction.xml deleted file mode 100755 index 07e22ee3..00000000 --- a/src/test/testCntlInstruction.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - run-python-file targets/p9_nimbus/sbeTest/testCntlInstruction.py - yes - - diff --git a/src/test/testContinueMpipl.py b/src/test/testContinueMpipl.py deleted file mode 100755 index 080e479a..00000000 --- a/src/test/testContinueMpipl.py +++ /dev/null @@ -1,57 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testContinueMpipl.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -TESTDATA = [0,0,0,2, - 0,0,0xA9,0x02 ] - -EXPDATA = [0xc0,0xde,0xa9,0x02, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x3]; - - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - testUtil.writeUsFifo( TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( 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/testContinueSbeBoot.py b/src/test/testContinueSbeBoot.py deleted file mode 100755 index 5f64f0fa..00000000 --- a/src/test/testContinueSbeBoot.py +++ /dev/null @@ -1,57 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testContinueSbeBoot.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -TESTDATA = [0,0,0,2, - 0,0,0xA1,0x02 ] - -EXPDATA = [0xc0,0xde,0xa1,0x02, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x3]; - - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - testUtil.writeUsFifo( TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( 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/testEnterMpipl.py b/src/test/testEnterMpipl.py deleted file mode 100755 index 8d225831..00000000 --- a/src/test/testEnterMpipl.py +++ /dev/null @@ -1,57 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testEnterMpipl.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -TESTDATA = [0,0,0,2, - 0,0,0xA9,0x01 ] - -EXPDATA = [0xc0,0xde,0xa9,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x3]; - - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - testUtil.writeUsFifo( TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( 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/testExecutorMemory.py b/src/test/testExecutorMemory.py deleted file mode 100644 index 125528bf..00000000 --- a/src/test/testExecutorMemory.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/python -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testExecutorMemory.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 -''' -############################################################# -# @file testExecutor.py -# @author: George Keishing -# @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/src/test/testExecutorPSU.py b/src/test/testExecutorPSU.py deleted file mode 100644 index 5c58a954..00000000 --- a/src/test/testExecutorPSU.py +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/python -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testExecutorPSU.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 -''' -############################################################# -# @file testExecutor.py -# @author: George Keishing -# @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 testPSUUtil -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 = testPSUUtil.registry() # Registry obj def for operation - - print "\n Execute SBE Test set [ PSU ] ...\n" - # Sim obj Target Test set Raise Exception - rc_test = regObj.ExecuteTestOp(testPSUUtil.simSbeObj,sbe_test_data, True) - if rc_test != testPSUUtil.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(testPSUUtil.simSbeObj,host_test_data,20) - if rc_intr == testPSUUtil.SUCCESS: - print " Interrupt Event Recieved .. Success !!" - else: - print " Interrupt not Recieved.. Exiting .." - - print "\n" - -if __name__=="__main__": - main() - diff --git a/src/test/testExecutorPutRing.py b/src/test/testExecutorPutRing.py deleted file mode 100644 index d6c74bb8..00000000 --- a/src/test/testExecutorPutRing.py +++ /dev/null @@ -1,225 +0,0 @@ -#!/usr/bin/python -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testExecutorPutRing.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 testPSUUtil -import testRegistry as reg -import testUtil - -#------------------------------- -# This is a Test Expected Data -#------------------------------- -''' -This data are the values or strings that needs to be validated for the test. -''' -''' -#------------------------------------------------------------------------------------------------------------------------------ -# SBE side test data - Target - Pervasive(Core), Chiplet Id - 32, Ring ID - ec_func(224), mode - 0x0020(RING_MODE_HEADER_CHECK) -#------------------------------------------------------------------------------------------------------------------------------ -''' -sbe_test_data1 = ( - #----------------------------------------------------------------------------------------------------- - # OP Reg ValueToWrite size Test Expected Data Description - #----------------------------------------------------------------------------------------------------- - ["write", reg.REG_MBOX0, "0000010000F0D301", 8, "None", "Writing to MBOX0 address"], - ["write", reg.REG_MBOX1, "0002002000E00020", 8, "None", "Writing to MBOX1 address"], - ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, "None", "Update SBE Doorbell register to interrupt SBE"], - ) -''' -#------------------------------------------------------------------------------------------------------------------------------ -# SBE side test data - Target - Pervasive(Perv), Chiplet Id - 1, Ring ID - perv_fure(00), mode - 0x0020(RING_MODE_HEADER_CHECK) -#------------------------------------------------------------------------------------------------------------------------------ -''' -sbe_test_data2 = ( - #-------------------------------------------------------------------------------------------------------------------------- - # OP Reg ValueToWrite size Test Expected Data Description - #-------------------------------------------------------------------------------------------------------------------------- - ["write", reg.REG_MBOX0, "0000010000F0D301", 8, "None", "Writing to MBOX0 address"], - ["write", reg.REG_MBOX1, "0002000100000020", 8, "None", "Writing to MBOX1 address"], - ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, "None", "Update SBE Doorbell register to interrupt SBE"], - ) -''' -#--------------------- -# SBE side test data - Target - PROC CHIP, Chiplet Id - x, Ring ID - ob0_fure(118), mode - 0x0020(RING_MODE_HEADER_CHECK) -#--------------------- -''' -sbe_test_data3 = ( - #-------------------------------------------------------------------------------------------------------------------------- - # OP Reg ValueToWrite size Test Expected Data Description - #-------------------------------------------------------------------------------------------------------------------------- - ["write", reg.REG_MBOX0, "0000010000F0D301", 8, "None", "Writing to MBOX0 address"], - ["write", reg.REG_MBOX1, "0000000600760020", 8, "None", "Writing to MBOX1 address"], - ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, "None", "Update SBE Doorbell register to interrupt SBE"], - ) -''' -#------------------------------------------------------------------------------------------------------------------------------ -# SBE side test data - Target - EX, Chiplet Id - 32, Ring ID - ex_l3_fure(176), mode - 0x0020(RING_MODE_HEADER_CHECK) -#------------------------------------------------------------------------------------------------------------------------------ -''' -sbe_test_data4 = ( - #----------------------------------------------------------------------------------------------------- - # OP Reg ValueToWrite size Test Expected Data Description - #----------------------------------------------------------------------------------------------------- - ["write", reg.REG_MBOX0, "0000010000F0D301", 8, "None", "Writing to MBOX0 address"], - ["write", reg.REG_MBOX1, "0001002000B00020", 8, "None", "Writing to MBOX1 address"], - ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, "None", "Update SBE Doorbell register to interrupt SBE"], - ) -''' -#------------------------------------------------------------------------------------------------------------------------------ -# SBE side test data - Target - Invalid target 0x10, Chiplet Id - 32, Ring ID - ex_l3_refr_repr(248), mode - 0x0020(RING_MODE_HEADER_CHECK) -#------------------------------------------------------------------------------------------------------------------------------ -''' -sbe_test_data5 = ( - #----------------------------------------------------------------------------------------------------- - # OP Reg ValueToWrite size Test Expected Data Description - #----------------------------------------------------------------------------------------------------- - ["write", reg.REG_MBOX0, "0000010000F0D301", 8, "None", "Writing to MBOX0 address"], - ["write", reg.REG_MBOX1, "0010002000F80020", 8, "None", "Writing to MBOX1 address"], - ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, "None", "Update SBE Doorbell register to interrupt SBE"], - ) -''' -#--------------------- -# Host side test data - SUCCESS -#--------------------- -''' -host_test_data_success = ( - #---------------------------------------------------------------------------------------------------------------- - # OP Reg ValueToWrite size Test Expected Data Description - #---------------------------------------------------------------------------------------------------------------- - ["read", reg.REG_MBOX4, "0", 8, "0000000000F0D301", "Reading Host MBOX4 data to Validate"], - ) -''' -#--------------------- -# Host side test data - FAILURE -#--------------------- -''' -host_test_data_failure5 = ( - #---------------------------------------------------------------------------------------------------------------- - # OP Reg ValueToWrite size Test Expected Data Description - #---------------------------------------------------------------------------------------------------------------- - ["read", reg.REG_MBOX4, "0", 8, "0002000400F0D301", "Reading Host MBOX4 data to Validate"], - ) - -''' -#----------------------------------------------------------------------- -# Do not modify - Used to simulate interrupt on Ringing Doorbell on Host -#----------------------------------------------------------------------- -''' -host_polling_data = ( - #---------------------------------------------------------------------------------------------------------------- - # OP Reg ValueToWrite size Test Expected Data Description - #---------------------------------------------------------------------------------------------------------------- - ["read", reg.PSU_HOST_DOORBELL_REG_WO_OR, "0", 8, "8000000000000000", "Reading Host Doorbell for Interrupt"], - ) - -#------------------------- -# Main Function -#------------------------- -def main(): - # Run Simics initially - testUtil.runCycles( 10000000 ); - - # Intialize the class obj instances - regObj = testPSUUtil.registry() # Registry obj def for operation - - print "\n Execute SBE Test set1 [ Put Ring ] ...\n" - - ''' - Test Case 1 - ''' - # HOST->SBE data set execution - regObj.ExecuteTestOp( testPSUUtil.simSbeObj, sbe_test_data1 ) - - print "\n Poll on Host side for INTR ...\n" - #Poll on HOST DoorBell Register for interrupt - regObj.pollingOn( testPSUUtil.simSbeObj, host_polling_data, 5 ) - - #SBE->HOST data set execution - regObj.ExecuteTestOp( testPSUUtil.simSbeObj, host_test_data_success ) - - print "\n Execute SBE Test set2 [ Put Ring ] ...\n" - ''' - Test Case 2 - ''' - # HOST->SBE data set execution - regObj.ExecuteTestOp( testPSUUtil.simSbeObj, sbe_test_data2 ) - - print "\n Poll on Host side for INTR ...\n" - #Poll on HOST DoorBell Register for interrupt - regObj.pollingOn( testPSUUtil.simSbeObj, host_polling_data, 5 ) - - #SBE->HOST data set execution - regObj.ExecuteTestOp( testPSUUtil.simSbeObj, host_test_data_success ) - - print "\n Execute SBE Test set3 [ Put Ring ] ...\n" - ''' - Test Case 3 - ''' - # HOST->SBE data set execution - regObj.ExecuteTestOp( testPSUUtil.simSbeObj, sbe_test_data3 ) - - print "\n Poll on Host side for INTR ...\n" - #Poll on HOST DoorBell Register for interrupt - regObj.pollingOn( testPSUUtil.simSbeObj, host_polling_data, 5 ) - - #SBE->HOST data set execution - regObj.ExecuteTestOp( testPSUUtil.simSbeObj, host_test_data_success ) - - print "\n Execute SBE Test set4 [ Put Ring ] ...\n" - ''' - Test Case 4 - ''' - # HOST->SBE data set execution - regObj.ExecuteTestOp( testPSUUtil.simSbeObj, sbe_test_data4 ) - - print "\n Poll on Host side for INTR ...\n" - #Poll on HOST DoorBell Register for interrupt - regObj.pollingOn( testPSUUtil.simSbeObj, host_polling_data, 5 ) - - #SBE->HOST data set execution - regObj.ExecuteTestOp( testPSUUtil.simSbeObj, host_test_data_success ) - - print "\n Execute SBE Test set5 [ Put Ring ] ...\n" - ''' - Test Case 5 - ''' - # HOST->SBE data set execution - regObj.ExecuteTestOp( testPSUUtil.simSbeObj, sbe_test_data5 ) - - print "\n Poll on Host side for INTR ...\n" - #Poll on HOST DoorBell Register for interrupt - regObj.pollingOn( testPSUUtil.simSbeObj, host_polling_data, 5 ) - - #SBE->HOST data set execution - regObj.ExecuteTestOp( testPSUUtil.simSbeObj, host_test_data_failure5 ) - -if __name__ == "__main__": - 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/testExecutorPutRing.xml b/src/test/testExecutorPutRing.xml deleted file mode 100755 index 56aabc0c..00000000 --- a/src/test/testExecutorPutRing.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - run-python-file targets/p9_nimbus/sbeTest/testExecutorPutRing.py - yes - - diff --git a/src/test/testFifoReset.py b/src/test/testFifoReset.py deleted file mode 100644 index 3b03e6c6..00000000 --- a/src/test/testFifoReset.py +++ /dev/null @@ -1,80 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testFifoReset.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -# Test data that only contains the command header -TESTDATA = [0, 0, 0, 3, - 0, 0, 0xA1, 0x01] - -# Complete test data -TESTDATA_FULL = [0, 0, 0, 3, - 0, 0, 0xA1, 0x01, - 0, 0x02, 0x00, 0x01] - -# Get capabilities command. This will ensure the DS FIFO gets full -TESTDATA_2 = [0, 0, 0, 2, - 0, 0, 0xA8, 0x02] - -def main(): - try: - testUtil.runCycles(10000000) - # Send a partial chip-op - testUtil.writeUsFifo(TESTDATA) - testUtil.resetFifo() - # Make sure both the upstream and downstrem FIFOs are clear after the reset - testUtil.waitTillUsFifoEmpty() - testUtil.waitTillDsFifoEmpty() - # Now send a complete chip-op on the upstream FIFO - testUtil.writeUsFifo(TESTDATA_FULL) - testUtil.writeEot() - testUtil.resetFifo() - # Make sure both the upstream and downstrem FIFOs are clear after the reset - testUtil.waitTillUsFifoEmpty() - testUtil.waitTillDsFifoEmpty() - # Now send a get capabilities chip-op, so that in response, the DS FIFO - # gets full before we do a reset - testUtil.writeUsFifo(TESTDATA_2) - testUtil.writeEot() - testUtil.resetFifo() - # Make sure both the upstream and downstrem FIFOs are clear after the reset - testUtil.waitTillUsFifoEmpty() - testUtil.waitTillDsFifoEmpty() - except: - print("\nTest completed with error(s), Raise error") - raise - print("\nTest completed with no errors") - -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/testFifoReset.xml b/src/test/testFifoReset.xml deleted file mode 100644 index 48b12a3e..00000000 --- a/src/test/testFifoReset.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - run-python-file targets/p9_nimbus/sbeTest/testFifoReset.py - yes - - - - run-python-file targets/p9_nimbus/sbeTest/testIstepInvalidFenced.py - yes - diff --git a/src/test/testGeneric.xml b/src/test/testGeneric.xml deleted file mode 100755 index cc49a78b..00000000 --- a/src/test/testGeneric.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - run-python-file targets/p9_nimbus/sbeTest/testGetCapabilities.py - yes - diff --git a/src/test/testGetCapabilities.py b/src/test/testGetCapabilities.py deleted file mode 100755 index e6831352..00000000 --- a/src/test/testGetCapabilities.py +++ /dev/null @@ -1,82 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testGetCapabilities.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2015,2016 -# -# -# 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 - -TESTDATA = [0,0,0,2, - 0,0,0xA8,0x02 ] - -EXPDATA1 = [0x0,0x0,0x0,0x0, - 0x0,0x0,0x0,0x0, - 0xa1,0x0,0x0,0x01, # istep - 0x0,0x0,0x0,0x0, - 0xa2,0x0,0x0,0x0f, #getscom/putscom/modifyscom/putscomundermask - 0x0,0x0,0x0,0x0, - 0xa3,0x0,0x0,0x1, #getring - 0x00,0x0,0x0,0x0]; - -EXPDATA2 = [0xa4,0x0,0x0,0x0f, #GetMemPba/PutMemPba/GetSramOcc/PutSramOcc - 0x0,0x0,0x0,0x0, - 0xa5,0x0,0x0,0x03, #GetReg/PutReg - 0x0,0x0,0x0,0x0, - 0x0,0x0,0x0,0x0, - 0x0,0x0,0x0,0x0, - 0xa7,0x0,0x0,0x1, # control Instruction - 0x00,0x0,0x0,0x0]; - -EXPDATA3 = [0xa8,0x0,0x0,0x02, #getcapability - 0x0,0x0,0x0,0x0, - 0xc0,0xde,0xa8,0x02, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x3]; - - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - testUtil.writeUsFifo( TESTDATA ) - testUtil.writeEot( ) - # Ignore first two enteries ( major number, minor number - # and fw version) as they will keep on changing - testUtil.readDsEntry( 2 ) - testUtil.readDsFifo( EXPDATA1 ) - testUtil.readDsFifo( EXPDATA2 ) - testUtil.readDsFifo( EXPDATA3 ) - 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/testGetMem.py b/src/test/testGetMem.py deleted file mode 100644 index a927f250..00000000 --- a/src/test/testGetMem.py +++ /dev/null @@ -1,74 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testGetMem.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 * - -LOOP_COUNT = 1 - -GETMEM_TESTDATA = [0,0,0,0x6, - 0,0,0xA4,0x01, - 0,0,0x0,0x02, - 0,0,0,0, - 0x08,0x00,0x00,0x00, - 0x00,0x00,0x00,0x80] # length of data - -GETMEM_EXPDATA = [0x00,0x00,0x00,0x80, # length of data - 0xc0,0xde,0xa4,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - - # GetMem test - testUtil.writeUsFifo( GETMEM_TESTDATA ) - testUtil.writeEot( ) - # GetMem chipOp would send the read data first, - # thus, would attempt to read the expected length of data first - loop = 1 - while ( loop <= LOOP_COUNT ): - testUtil.readDsEntry ( 32 ) ## 32 entries ~ 128B PBA granule - loop += 1 - testUtil.readDsFifo( GETMEM_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/testGetMem_expdata.py b/src/test/testGetMem_expdata.py deleted file mode 100644 index 56b43119..00000000 --- a/src/test/testGetMem_expdata.py +++ /dev/null @@ -1,83 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testGetMem_expdata.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 * - -LOOP_COUNT = 4 - -GETMEM_TESTDATA = [0,0,0,0x6, - 0,0,0xA4,0x01, - 0,0,0x0,0x02, - 0,0,0,0, - 0x08,0x00,0x00,0x00, - 0x00,0x00,0x00,0x80] # length of data - -GETMEM_EXP_RESPHDR = [0x00,0x00,0x00,0x80, # length of data - 0xc0,0xde,0xa4,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03] - -GETMEM_EXP_RESPDATA = [0xAB,0xCD,0xEF,0x01, - 0xAB,0xCD,0xEF,0x02, - 0xAB,0xCD,0xEF,0x03, - 0xAB,0xCD,0xEF,0x04, - 0xAB,0xCD,0xEF,0x05, - 0xAB,0xCD,0xEF,0x06, - 0xAB,0xCD,0xEF,0x07, - 0xAB,0xCD,0xEF,0x08] - - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - - # GetMem test - testUtil.writeUsFifo( GETMEM_TESTDATA ) - testUtil.writeEot( ) - # GetMem chipOp would send the read data first, - # thus, would attempt to read the expected length of data first - loop = 1 - while ( loop <= LOOP_COUNT ): - testUtil.readDsFifo ( GETMEM_EXP_RESPDATA ) - loop += 1 - testUtil.readDsFifo( GETMEM_EXP_RESPHDR ) - 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/testGetRing.py b/src/test/testGetRing.py deleted file mode 100644 index d6d786b8..00000000 --- a/src/test/testGetRing.py +++ /dev/null @@ -1,95 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testGetRing.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 * - -LOOP_COUNT = 1 - -#aligned Data -GETRING_TESTDATA = [0,0,0,0x6, - 0,0,0xA3,0x01, - 0xa,0xa,0xa,0xa, # address - 0,0,0,0x40, # length of data - 0x00,0x00,0x00,0x01] - -GETRING_EXPDATA = [0,0,0,0, #data - 0,0,0,0, #data - 0,0,0,0x40, # length of data - 0xc0,0xde,0xa3,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - -#Un-aligned Data -GETRING_TESTDATA1 = [0,0,0,0x6, - 0,0,0xA3,0x01, - 0xa,0xa,0xa,0xa, # address - 0,0,0,0x45, # length of data - 0x00,0x00,0x00,0x01] - -GETRING_EXPDATA1 = [0,0,0,0, #data - 0,0,0,0, #data - 0,0,0,0, #data - 0,0,0,0, #data - 0,0,0,0x45, # length of data - 0xc0,0xde,0xa3,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - - - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - - # GetRing test - Aligned Data - testUtil.writeUsFifo( GETRING_TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( GETRING_EXPDATA ) - testUtil.runCycles( 10000000 ) - testUtil.readEot( ) - - # GetRing test - un-aligned Data - testUtil.runCycles( 10000000 ) - testUtil.writeUsFifo( GETRING_TESTDATA1 ) - testUtil.writeEot( ) - testUtil.readDsFifo( GETRING_EXPDATA1 ) - testUtil.runCycles( 10000000 ) - 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/testGetRing.xml b/src/test/testGetRing.xml deleted file mode 100755 index a30802c2..00000000 --- a/src/test/testGetRing.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - run-python-file targets/p9_nimbus/sbeTest/testGetRing.py - yes - - diff --git a/src/test/testIstep.xml b/src/test/testIstep.xml deleted file mode 100644 index f0e71d61..00000000 --- a/src/test/testIstep.xml +++ /dev/null @@ -1,332 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - run-python-file targets/p9_nimbus/sbeTest/testIstepInvalid.py - yes - - - - sbe-istep 2 2 - yes - - - sbe-istep 2 3 - yes - - - sbe-istep 2 4 - yes - - - sbe-istep 2 5 - yes - - - sbe-istep 2 6 - yes - - - sbe-istep 2 7 - yes - - - sbe-istep 2 8 - yes - - - sbe-istep 2 9 - yes - - - sbe-istep 2 10 - yes - - - sbe-istep 2 11 - yes - - - sbe-istep 2 12 - yes - - - sbe-istep 2 13 - yes - - - sbe-istep 2 14 - yes - - - sbe-istep 2 15 - yes - - - sbe-istep 2 16 - yes - - - sbe-istep 2 17 - yes - - - sbe-istep 3 1 - yes - - - sbe-istep 3 2 - yes - - - sbe-istep 3 3 - yes - - - sbe-istep 3 4 - yes - - - sbe-istep 3 5 - yes - - - sbe-istep 3 6 - yes - - - sbe-istep 3 7 - yes - - - sbe-istep 3 8 - yes - - - sbe-istep 3 9 - yes - - - sbe-istep 3 10 - yes - - - sbe-istep 3 11 - yes - - - sbe-istep 3 12 - yes - - - sbe-istep 3 13 - yes - - - sbe-istep 3 14 - yes - - - sbe-istep 3 15 - yes - - - sbe-istep 3 16 - yes - - - sbe-istep 3 17 - yes - - - sbe-istep 3 18 - yes - - - sbe-istep 3 19 - yes - - - sbe-istep 3 20 - yes - - - sbe-istep 3 21 - yes - - - sbe-istep 3 22 - yes - - - sbe-istep 4 1 - yes - - - sbe-istep 4 2 - yes - - - sbe-istep 4 3 - yes - - - sbe-istep 4 4 - yes - - - sbe-istep 4 5 - yes - - - sbe-istep 4 6 - yes - - - sbe-istep 4 7 - yes - - - sbe-istep 4 8 - yes - - - sbe-istep 4 9 - yes - - - sbe-istep 4 10 - yes - - - sbe-istep 4 11 - yes - - - sbe-istep 4 12 - yes - - - sbe-istep 4 13 - yes - - - sbe-istep 4 14 - yes - - - sbe-istep 4 15 - yes - - - sbe-istep 4 16 - yes - - - sbe-istep 4 17 - yes - - - sbe-istep 4 18 - yes - - - sbe-istep 4 19 - yes - - - sbe-istep 4 20 - yes - - - sbe-istep 4 21 - yes - - - sbe-istep 4 22 - yes - - - sbe-istep 4 23 - yes - - - sbe-istep 4 24 - yes - - - sbe-istep 4 25 - yes - - - sbe-istep 4 26 - yes - - - sbe-istep 4 27 - yes - - - sbe-istep 4 28 - yes - - - sbe-istep 4 29 - yes - - - sbe-istep 4 30 - yes - - - sbe-istep 4 31 - yes - - - sbe-istep 4 32 - yes - - - sbe-istep 4 33 - yes - - - sbe-istep 4 34 - yes - - - sbe-istep 5 1 - yes - - - sbe-istep 5 2 - yes - - - - run-python-file targets/p9_nimbus/sbeTest/testIstepInvalidFenced.py - yes - diff --git a/src/test/testIstepAuto.py b/src/test/testIstepAuto.py deleted file mode 100755 index 8cbccffa..00000000 --- a/src/test/testIstepAuto.py +++ /dev/null @@ -1,54 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testIstepAuto.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 -from sim_commands import * -import imp -err = False -testUtil = imp.load_source("testUtil", os.environ['SBE_TOOLS_PATH'] + "/testUtil.py") -EXPDATA = [0xc0,0xde,0xa1,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; -# MAIN Test Run Starts Here... -#------------------------------------------------- -def sbe_istep_func( major, minor ): - try: - TESTDATA = [0,0,0,3, - 0,0,0xA1,0x01, - 0,major,0,minor ] - testUtil.runCycles( 10000000 ) - testUtil.writeUsFifo( TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( EXPDATA ) - testUtil.readEot( ) - except: - print ("\nTest completed with error(s). Raise error") - # TODO via RTC 142706 - # Currently simics commands created using hooks always return - # success. Need to check from simics command a way to return - # Calling non existant command to return failure - run_command("Command Failed"); - raise - print ("\nTest completed with no errors") - #sys.exit(0); - diff --git a/src/test/testIstepInvalid.py b/src/test/testIstepInvalid.py deleted file mode 100755 index 5af909d7..00000000 --- a/src/test/testIstepInvalid.py +++ /dev/null @@ -1,57 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testIstepInvalid.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2015,2016 -# -# -# 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 * - -TESTDATA = [0,0,0,3, - 0,0,0xA1,0x01, - 0,0x02,0x00,0x1] - -EXPDATA = [0xc0,0xde,0xa1,0x01, - 0x00,0x02,0x00,0x0A, - 0x00,0x0,0x0,0x03]; - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - testUtil.writeUsFifo( TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( 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/testIstepInvalidFenced.py b/src/test/testIstepInvalidFenced.py deleted file mode 100755 index 568253af..00000000 --- a/src/test/testIstepInvalidFenced.py +++ /dev/null @@ -1,57 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testIstepInvalidFenced.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2015,2016 -# -# -# 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 * - -TESTDATA = [0,0,0,3, - 0,0,0xA1,0x01, - 0,0x02,0x00,0x1] - -EXPDATA = [0xc0,0xde,0xa1,0x01, - 0x00,0x00,0x00,0x08, - 0x00,0x0,0x0,0x03]; - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - testUtil.writeUsFifo( TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( 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/testIstepSuccess.py b/src/test/testIstepSuccess.py deleted file mode 100755 index 83871896..00000000 --- a/src/test/testIstepSuccess.py +++ /dev/null @@ -1,57 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testIstepSuccess.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 * - -TESTDATA = [0,0,0,3, - 0,0,0xA1,0x01, - 0,0x02,0x00,0x2] - -EXPDATA = [0xc0,0xde,0xa1,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - testUtil.writeUsFifo( TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( 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/testModifyScom.py b/src/test/testModifyScom.py deleted file mode 100755 index 703ad680..00000000 --- a/src/test/testModifyScom.py +++ /dev/null @@ -1,97 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testModifyScom.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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/testPSUUserUtil.py b/src/test/testPSUUserUtil.py deleted file mode 100644 index df586ab7..00000000 --- a/src/test/testPSUUserUtil.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/python -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testPSUUserUtil.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 -''' -############################################################# -# @file testClassUtil.py -# @author: George Keishing -# @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 testPSUUtil - -''' -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 testPSUUtil.SUCCESS diff --git a/src/test/testPSUUtil.py b/src/test/testPSUUtil.py deleted file mode 100644 index 84b91ff7..00000000 --- a/src/test/testPSUUtil.py +++ /dev/null @@ -1,376 +0,0 @@ -#!/usr/bin/python -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testPSUUtil.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 -''' -############################################################# -# @file testClass.py -# @author: George Keishing -# @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 testUtil -import testPSUUserUtil -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, raiseException=True): - ''' - 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: - if(raiseException == True): - raise Exception('Data mistmach'); - 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: - print "\n Invalid Test Data" - if(raiseException == True): - raise Exception('Invalid Test Data'); - 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 poll mechanism - #---------------------------------------------------- - def pollingOn(self, simObj, test_data, retries=20): - for l_param in test_data: - while True: - print "\n***** Polling On result - retrials left [%d] " % retries - print "\n" - testUtil.runCycles( 1000000); - test_d = (l_param,) - rc = self.ExecuteTestOp(simObj, test_d, False) - if rc == SUCCESS: - print ('Polling Successful for - ' + l_param[5]) - break - elif retries <= 0: - print " Retrials exhausted... Exiting polling" - raise Exception('Polling Failed for - ' + l_param[5]); - break - else: - retries = retries - 1 - return FAILURE - - #---------------------------------------------------- - # Load the function and execute - #---------------------------------------------------- - def loadFunc(self, func_name, i_pArray ): - rc = testPSUUserUtil.__getattribute__(func_name)(i_pArray) - return rc # Either success or failure from func - - diff --git a/src/test/testPutGetInScom.py b/src/test/testPutGetInScom.py deleted file mode 100755 index 03571eaa..00000000 --- a/src/test/testPutGetInScom.py +++ /dev/null @@ -1,82 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testPutGetInScom.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2015,2016 -# -# -# 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/testPutGetMem.xml b/src/test/testPutGetMem.xml deleted file mode 100644 index c386c933..00000000 --- a/src/test/testPutGetMem.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - run-python-file targets/p9_nimbus/sbeTest/testPutMem.py - yes - - - run-python-file targets/p9_nimbus/sbeTest/testGetMem_expdata.py - yes - - diff --git a/src/test/testPutGetRegFpr.py b/src/test/testPutGetRegFpr.py deleted file mode 100755 index 2b2cd75c..00000000 --- a/src/test/testPutGetRegFpr.py +++ /dev/null @@ -1,81 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testPutGetRegFpr.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -PUTREG_TESTDATA = [0,0,0,9, - 0,0,0xA5,0x02, - 0x00,0x20,0x02,0x02, # two fpr registers - 0,0,0x0,0x01, - 0,0,0x0,0x0, - 0,0,0x0,0x1, - 0,0,0x0,0x02, - 0,0,0x0,0x0, - 0,0,0x0,0x2 ] - -PUTREG_EXPDATA = [0xc0,0xde,0xa5,0x02, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - -GETREG_TESTDATA = [0,0,0,5, - 0,0,0xA5,0x01, - 0x00,0x20,0x02,0x02, #two fpr registers - 0,0,0x0,0x01, - 0,0,0x0,0x02 ] - -GETREG_EXPDATA = [0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x01, - 0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x02, - 0xc0,0xde,0xa5,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - testUtil.writeUsFifo( PUTREG_TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( PUTREG_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( GETREG_TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( GETREG_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/testPutGetRegGpr.py b/src/test/testPutGetRegGpr.py deleted file mode 100755 index cd1e31b4..00000000 --- a/src/test/testPutGetRegGpr.py +++ /dev/null @@ -1,81 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testPutGetRegGpr.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -PUTREG_TESTDATA = [0,0,0,9, - 0,0,0xA5,0x02, - 0x00,0x20,0x00,0x02, # two gpr registers - 0,0,0x0,0x07, - 0,0,0x0,0x0, - 0,0,0x0,0x1, - 0,0,0x0,0x08, - 0,0,0x0,0x0, - 0,0,0x0,0x2 ] - -PUTREG_EXPDATA = [0xc0,0xde,0xa5,0x02, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - -GETREG_TESTDATA = [0,0,0,5, - 0,0,0xA5,0x01, - 0x00,0x20,0x00,0x02, # two gpr registers - 0,0,0x0,0x07, - 0,0,0x0,0x08 ] - -GETREG_EXPDATA = [0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x01, - 0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x02, - 0xc0,0xde,0xa5,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - testUtil.writeUsFifo( PUTREG_TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( PUTREG_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( GETREG_TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( GETREG_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/testPutGetRegSpr.py b/src/test/testPutGetRegSpr.py deleted file mode 100755 index 55c6fa09..00000000 --- a/src/test/testPutGetRegSpr.py +++ /dev/null @@ -1,81 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testPutGetRegSpr.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -PUTREG_TESTDATA = [0,0,0,9, - 0,0,0xA5,0x02, - 0x00,0x20,0x01,0x02, # two spr registers - 0,0,0x0,0x08, - 0,0,0x0,0x0, - 0,0,0x0,0x1, - 0,0,0x0,0x09, - 0,0,0x0,0x0, - 0,0,0x0,0x2 ] - -PUTREG_EXPDATA = [0xc0,0xde,0xa5,0x02, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - -GETREG_TESTDATA = [0,0,0,5, - 0,0,0xA5,0x01, - 0x00,0x20,0x01,0x02, # two spr registers - 0,0,0x0,0x08, - 0,0,0x0,0x09 ] - -GETREG_EXPDATA = [0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x01, - 0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x02, - 0xc0,0xde,0xa5,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - testUtil.writeUsFifo( PUTREG_TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( PUTREG_EXPDATA ) - testUtil.readEot( ) - testUtil.writeUsFifo( GETREG_TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( GETREG_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/testPutGetScom.py b/src/test/testPutGetScom.py deleted file mode 100755 index de020fb2..00000000 --- a/src/test/testPutGetScom.py +++ /dev/null @@ -1,118 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testPutGetScom.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2015,2016 -# -# -# 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. - -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, - 0x00,0x0,0x0,0x04, - 0x00,0x0,0x0,0x04]; - -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, - 0x00,0x0,0x0,0x04, - 0x00,0x0,0x0,0x04]; - -# 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.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.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/testPutMem.py b/src/test/testPutMem.py deleted file mode 100644 index eec39f5f..00000000 --- a/src/test/testPutMem.py +++ /dev/null @@ -1,83 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testPutMem.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 * - -LOOP_COUNT = 4 - -PUTMEM_TEST_HDR = [0,0,0,0x86, - 0,0,0xA4,0x02, - 0,0,0x0,0x02, - 0,0,0,0, - 0x08,0x00,0x00,0x00, - 0x00,0x00,0x00,0x80] - -PUTMEM_TEST_DATA = [0xAB,0xCD,0xEF,0x01, - 0xAB,0xCD,0xEF,0x02, - 0xAB,0xCD,0xEF,0x03, - 0xAB,0xCD,0xEF,0x04, - 0xAB,0xCD,0xEF,0x05, - 0xAB,0xCD,0xEF,0x06, - 0xAB,0xCD,0xEF,0x07, - 0xAB,0xCD,0xEF,0x08] - -PUTMEM_EXPDATA = [0x00,0x00,0x00,0x80, - 0xc0,0xde,0xa4,0x02, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03] - - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - - testUtil.writeUsFifo( PUTMEM_TEST_HDR ) - - loop = 1 - while (loop <= LOOP_COUNT): - #testUtil.runCycles( 10000000 ) - testUtil.writeUsFifo( PUTMEM_TEST_DATA ) - loop += 1 - testUtil.writeEot( ) - - #testUtil.runCycles( 10000000 ) - testUtil.readDsFifo( PUTMEM_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/testPutMem_fail.py b/src/test/testPutMem_fail.py deleted file mode 100644 index b13032a1..00000000 --- a/src/test/testPutMem_fail.py +++ /dev/null @@ -1,84 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testPutMem_fail.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 * - -LOOP_COUNT = 4 - -PUTMEM_TEST_HDR = [0,0,0x00,0x86, - 0,0,0xA4,0x02, - 0,0,0x0,0x02, - 0,0,0,0, - 0x08,0x00,0x00,0x04, # Un-aligned PBA Address - 0x00,0x00,0x00,0x80] - -PUTMEM_TEST_DATA = [0xAB,0xCD,0xEF,0x01, - 0xAB,0xCD,0xEF,0x02, - 0xAB,0xCD,0xEF,0x03, - 0xAB,0xCD,0xEF,0x04, - 0xAB,0xCD,0xEF,0x05, - 0xAB,0xCD,0xEF,0x06, - 0xAB,0xCD,0xEF,0x07, - 0xAB,0xCD,0xEF,0x08] - -PUTMEM_EXPDATA = [0x00,0x00,0x00,0x00, - 0xc0,0xde,0xa4,0x02, - 0x00,0xfe,0x00,0x0a, - 0xff,0xdc,0x00,0x03, - 0x00,0x00,0x00,0x00, - 0x00,0xf8,0x82,0x19, - 0x00,0x00,0x00,0x06] - - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - - testUtil.writeUsFifo( PUTMEM_TEST_HDR ) - - loop = 1 - while (loop <= LOOP_COUNT): - testUtil.writeUsFifo( PUTMEM_TEST_DATA ) - loop += 1 - testUtil.writeEot( ) - - testUtil.readDsFifo( PUTMEM_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/testPutScomUnderMask.py b/src/test/testPutScomUnderMask.py deleted file mode 100755 index c8c58427..00000000 --- a/src/test/testPutScomUnderMask.py +++ /dev/null @@ -1,98 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testPutScomUnderMask.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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/testRegAccess.xml b/src/test/testRegAccess.xml deleted file mode 100755 index a44eecac..00000000 --- a/src/test/testRegAccess.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - run-python-file targets/p9_nimbus/sbeTest/testStopInstruction.py - yes - - - run-python-file targets/p9_nimbus/sbeTest/testPutGetRegGpr.py - yes - - - run-python-file targets/p9_nimbus/sbeTest/testPutGetRegFpr.py - yes - - - run-python-file targets/p9_nimbus/sbeTest/testPutGetRegSpr.py - yes - - - run-python-file targets/p9_nimbus/sbeTest/testStartInstruction.py - yes - - diff --git a/src/test/testRegistry.py b/src/test/testRegistry.py deleted file mode 100644 index ff205dbd..00000000 --- a/src/test/testRegistry.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/python -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testRegistry.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 -''' -############################################################# -# @file testClass.py -# @author: George Keishing -# @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 diff --git a/src/test/testSbeDump.py b/src/test/testSbeDump.py deleted file mode 100644 index 72d089e0..00000000 --- a/src/test/testSbeDump.py +++ /dev/null @@ -1,110 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testSbeDump.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 * - -TESTDATA = [0, 0, 0, 3, - 0, 0, 0xA1, 0x01, - 0, 0x02, 0x00, 0x2] - -EXPDATA = [0xc0, 0xde, 0xa1, 0x01] - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main(): - testUtil.runCycles(10000000) - testUtil.writeUsFifo(TESTDATA) - testUtil.writeEot() - testUtil.readDsFifo(EXPDATA) - #flush out primary and secondary status - data = testUtil.readDsEntryReturnVal() - - #flush hwp ffdc - data = testUtil.readDsEntryReturnVal() - data = testUtil.readDsEntryReturnVal() - - #start processing sbe ffdc - data = testUtil.readDsEntryReturnVal() - magicBytes = ((data[0] << 8) | data[1]) - if (magicBytes == 0xFFDC) : - print ("\nMagic Bytes Match") - else : - raise Exception('data mistmach') - packLen = ((data[2] << 8) | data[3]) - print ("\nFFDC package length = " + str(packLen)) - - data = testUtil.readDsEntryReturnVal() - fapiRc = ((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]) - print ("\nFAPI rc = " + str(hex(fapiRc))) - - data = testUtil.readDsEntryReturnVal() - primaryStatus = ((data[0] << 8) | data[1]) - secondaryStatus = ((data[2] << 8) | data[3]) - print ("\nPrimary Status " + str(hex(primaryStatus)) + " Secondary Status "\ - + str(hex(secondaryStatus))) - - data = testUtil.readDsEntryReturnVal() - header = ((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]) - print ("\nHeader = " + str(hex(header))) - - for i in range(0, (bin(header).count("1"))): - #read user data id - data = testUtil.readDsEntryReturnVal() - id = (data[0] << 8) | data[1] - print "User data Id ["+str(hex(id))+"]" - len = (data[2] << 8) | data[3] - #if it is trace field SBE_FFDC_TRACE_DUMP - fileName = "" - if(id == 0x0002): - fileName = "trace.bin" - print ("\nlength of trace dump " + str(len)) - #if it is trace field SBE_FFDC_ATTR_DUMP - elif(id == 0x0001): - fileName = "attr.bin" - print ("\nlength of attr dump " + str(len)) - myBin = open(fileName, 'wb') - print ("\nwriting "+fileName) - loopCount = (len ) / 4 - for j in range(0, loopCount): - data = testUtil.readDsEntryReturnVal() - myBin.write(bytearray(data)) - print("write to a file Done") - myBin.close() - #flush out distance - data = testUtil.readDsEntryReturnVal() -#------------------------------------------------- -# 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/testScom.xml b/src/test/testScom.xml deleted file mode 100755 index d3df6196..00000000 --- a/src/test/testScom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - run-python-file targets/p9_nimbus/sbeTest/testPutGetScom.py - yes - - - run-python-file targets/p9_nimbus/sbeTest/testPutScomUnderMask.py - yes - - - run-python-file targets/p9_nimbus/sbeTest/testModifyScom.py - yes - - - run-python-file targets/p9_nimbus/sbeTest/testPutGetInScom.py - yes - - diff --git a/src/test/testSram.py b/src/test/testSram.py deleted file mode 100644 index 2b62597f..00000000 --- a/src/test/testSram.py +++ /dev/null @@ -1,129 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testSram.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 * - -LOOP_COUNT = 1 - -PUTSRAM_OCC_CNTLDATA = [0,0,0,0x20, - 0,0,0xa4,0x04, #magic - 0,0,0,0x01, - 0xe7,0xf0,0x00,0x00, #addr - 0,0,0x01,0x00] # length - -PUTSRAM_OCC_TESTDATA = [0xab,0xcd,0xef,0x12, - 0xba,0xdc,0xfe,0x21, - 0x34,0x56,0x78,0x9a, - 0x43,0x65,0x87,0xa9, - 0xab,0xcd,0xef,0x12, - 0xba,0xdc,0xfe,0x21, - 0x34,0x56,0x78,0x9a, - 0x43,0x65,0x87,0xa9] - -PUTSRAM_OCC_EXP_CNTLDATA = [0,0,0x01,0x00, - 0xc0,0xde,0xa4,0x04, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03] - -GETSRAM_OCC_CNTLDATA = [0,0,0,0x5, - 0,0,0xa4,0x03, - 0,0,0,0x01, - 0xe7,0xf0,0x00,0x00, #address - 0x00,0x00,0x01,0x00] # length of data - -GETSRAM_OCC_EXP_TESTDATA = [0xab,0xcd,0xef,0x12, #data - 0xba,0xdc,0xfe,0x21, - 0x34,0x56,0x78,0x9a, - 0x43,0x65,0x87,0xa9, - 0xab,0xcd,0xef,0x12, - 0xba,0xdc,0xfe,0x21, - 0x34,0x56,0x78,0x9a, - 0x43,0x65,0x87,0xa9] - -GETSRAM_OCC_EXP_CNTLDATA = [0x00,0x00,0x01,0x00, # length - 0xc0,0xde,0xa4,0x03, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03]; - - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - - # Put Occ Sram test - Linear - Can be tested over Normal - # Debug mode - testUtil.writeUsFifo( PUTSRAM_OCC_CNTLDATA ) - # Write 32 bytes of data 8 times => 32*8 = 256 = 0x100 - i_cnt = 0 - while i_cnt < 8: - testUtil.writeUsFifo( PUTSRAM_OCC_TESTDATA ) - i_cnt = i_cnt+1 - - testUtil.writeEot( ) - - # Read the expected data for put sram - testUtil.readDsFifo( PUTSRAM_OCC_EXP_CNTLDATA ) - testUtil.readEot( ) - - # Get Sram Linear - testUtil.writeUsFifo( GETSRAM_OCC_CNTLDATA ) - testUtil.writeEot( ) - - # Read the Expected Data for get Sram - i_cnt = 0 - while i_cnt < 8: - testUtil.readDsFifo( GETSRAM_OCC_EXP_TESTDATA ) - i_cnt = i_cnt+1 - - testUtil.readDsFifo( GETSRAM_OCC_EXP_CNTLDATA ) - testUtil.readEot( ) - - # Put Occ Sram test - Circular - Can be enabled once we get - # valid address range to read the circular data - #testUtil.writeUsFifo( PUTSRAM_OCC_TESTDATA_1 ) - #testUtil.writeEot( ) - #testUtil.readDsFifo( PUTSRAM_OCC_EXPDATA_1 ) - #testUtil.readEot( ) - #testUtil.writeUsFifo( GETSRAM_OCC_TESTDATA_1 ) - #testUtil.writeEot( ) - #testUtil.readDsFifo( GETSRAM_OCC_EXPDATA_1 ) - #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/testSram.xml b/src/test/testSram.xml deleted file mode 100755 index 902786ad..00000000 --- a/src/test/testSram.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/testStartInstruction.py b/src/test/testStartInstruction.py deleted file mode 100644 index d45e791c..00000000 --- a/src/test/testStartInstruction.py +++ /dev/null @@ -1,64 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testStartInstruction.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 * - -LOOP_COUNT = 1 - - -# Start All thread in Core0 with warn flag true -INST_START0_ALL_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0xf0] - -INST_EXPDATA = [0xc0,0xde,0xa7,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03] - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - - #stop all thread in core0 - testUtil.writeUsFifo( INST_START0_ALL_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_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/testStopInstruction.py b/src/test/testStopInstruction.py deleted file mode 100644 index a43463c7..00000000 --- a/src/test/testStopInstruction.py +++ /dev/null @@ -1,64 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testStopInstruction.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 * - -LOOP_COUNT = 1 - - -# Stop All thread in Core0 with warn flag true -INST_STOP0_ALL_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, - 0,0,0xa7,0x01, - 0,1,0x20,0xf1] - -INST_EXPDATA = [0xc0,0xde,0xa7,0x01, - 0x0,0x0,0x0,0x0, - 0x00,0x0,0x0,0x03] - -# MAIN Test Run Starts Here... -#------------------------------------------------- -def main( ): - testUtil.runCycles( 10000000 ) - - #stop all thread in core0 - testUtil.writeUsFifo( INST_STOP0_ALL_TESTDATA_WITH_WARN_FLG ) - testUtil.writeEot( ) - testUtil.readDsFifo( INST_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/testUtil.py b/src/test/testUtil.py deleted file mode 100644 index 444319ab..00000000 --- a/src/test/testUtil.py +++ /dev/null @@ -1,170 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/test/testUtil.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2015,2016 -# -# -# 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 time -import conf -from sim_commands import * - -#err = False -lbus = conf.p9Proc0.proc_lbus_map -def writeUsFifo( data): - """Main test Loop""" - loopCount = len(data)/4; - for i in range (loopCount): - idx = i * 4; - writeEntry(lbus, 0x2400, (data[idx], data[idx+1], data[idx+2], data[idx+3]) ) - -def readDsFifo(data): - """Main test Loop""" - loopCount = len(data)/4; - for i in range (loopCount): - idx = i * 4; - checkEqual(readEntry(lbus, 0x2440, 4), (data[idx], data[idx+1], data[idx+2], data[idx+3])) - -def writeEot(): - write(lbus, 0x2408, (0, 0, 0, 1) ) - -def write(obj, address, value ): - """ Write to memory space """ - iface = SIM_get_interface(obj, "memory_space") - iface.write(None, address, value, 0x0) - -def readEot(): - """ Read from memory space """ - status = read(lbus, 0x2444, 4) - checkEqual( (status[3] & 0x80), 0x80 ); - read(lbus, 0x2440, 4) - -def resetFifo(): - write(lbus, 0x240C, (0, 0, 0, 1)) - return - -def readUsFifoStatus(): - status = read(lbus, 0x2404, 4) - return status - -def readDsFifoStatus(): - status = read(lbus, 0x2444, 4) - return status - -def waitTillFifoEmpty(func): - count = 0 - loop = True - while(loop is True): - status = func() - if(status[1] == 0x10): - loop = False - break - else: - count = count + 1 - runCycles(200000) - if(count > 10): - raise Exception('Timed out waiting for FIFO to get flushed') - - -def waitTillUsFifoEmpty(): - try: - waitTillFifoEmpty(readUsFifoStatus) - except: - raise Exception('US FIFO did not get empty') - - -def waitTillDsFifoEmpty(): - try: - waitTillFifoEmpty(readDsFifoStatus) - except: - raise Exception('DS FIFO did not get empty') - - -# This function will only read the entry but will not compare it -# with anything. This can be used to flush out enteries. -def readDsEntry(entryCount): - for i in range (entryCount): - readEntry(lbus, 0x2440, 4) - -def writeEntry(obj, address, value ): - - loop = 1; - count = 0; - while( loop ): - status = read(lbus, 0x2404, 4) # Address 0x2404: Upstream Fifo Status - - if( status[2] & 0x02): - count = count + 1 - runCycles(200000) - # This will cause test to fail - if(count > 10): - raise Exception('Timeout. FIFO FULL'); - else: - # write entry - write(obj, address, value) - loop = 0 - - return value -def readDsEntryReturnVal(): - data = readEntry(lbus, 0x2440, 4) - runCycles(200000) - return data -def readEntry(obj, address, size): - - """ Read from memory space """ - loop = 1; - count = 0; - value = (0,0,0,0) - while( loop ): - status = read(lbus, 0x2444, 4) # Address 0x2444: Downstream Fifo Status - - if( status[1] & 0x0F): - # read entry - value = read(lbus, address, size) - loop = 0 - else: - count = count + 1 - runCycles(200000) - # This will cause test to fail - if(count > 10): - raise Exception('Timeout. Empty FIFO'); - - return value - -def read(obj, address, size): - """ Read from memory space """ - iface = SIM_get_interface(obj, "memory_space") - value = iface.read(None, address, size, 0x0) - return value - -def runCycles( cycles ): - if (not SIM_simics_is_running()): - syscmd = "run-cycles %d"%(cycles) - ( rc, out ) = quiet_run_command( syscmd, output_modes.regular ) - if ( rc ): - print "simics ERROR running %s: %d "%( syscmd, rc ) - -def checkEqual( data, expdata ): - """ Throw exception if data is not equal """ - if( cmp(data, expdata )): - print "Eqality check failed" - print "Data:", data - print "Expected Data", expdata - raise Exception('data mistmach'); - diff --git a/src/test/testcases/ffdc.xml b/src/test/testcases/ffdc.xml new file mode 100755 index 00000000..b8773556 --- /dev/null +++ b/src/test/testcases/ffdc.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sbe-trace 0 + + + p9Proc0.sbe.ppe->ppe_state + + + p9Proc0.proc_fifo->upstream_hw_fifo + + + p9Proc0.proc_fifo->downstream_hw_fifo + + + diff --git a/src/test/testcases/test.xml b/src/test/testcases/test.xml new file mode 100755 index 00000000..240ec318 --- /dev/null +++ b/src/test/testcases/test.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + %%machine%% + + + p9Proc0.pib_psu->tppsu_tpbr_interrupt_msg_available=[NIL] + + ../simics/targets/p9_nimbus/sbeTest/testIstep.xml + ../simics/targets/p9_nimbus/sbeTest/testScom.xml + ../simics/targets/p9_nimbus/sbeTest/testGeneric.xml + + + ../simics/targets/p9_nimbus/sbeTest/testSram.xml + ../simics/targets/p9_nimbus/sbeTest/testCntlInstruction.xml + ../simics/targets/p9_nimbus/sbeTest/testRegAccess.xml + ../simics/targets/p9_nimbus/sbeTest/testFifoReset.xml + ../simics/targets/p9_nimbus/sbeTest/testAduMem.xml + ../simics/targets/p9_nimbus/sbeTest/testExecutorPutRing.xml + ../simics/targets/p9_nimbus/sbeTest/testGetRing.xml + + sbe-trace 0 + + + + diff --git a/src/test/testcases/testAbort.py b/src/test/testcases/testAbort.py new file mode 100755 index 00000000..c8be29bf --- /dev/null +++ b/src/test/testcases/testAbort.py @@ -0,0 +1,57 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testAbort.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +TESTDATA = [0,0,0,2, + 0,0,0xA8,0x04 ] + +EXPDATA = [0xc0,0xde,0xa8,0x04, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x3]; + + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( 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/testAduMem.xml b/src/test/testcases/testAduMem.xml new file mode 100644 index 00000000..fe3194d7 --- /dev/null +++ b/src/test/testcases/testAduMem.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + run-python-file targets/p9_nimbus/sbeTest/testAduMem_ecc.py + yes + + + run-python-file targets/p9_nimbus/sbeTest/testAduMem_itag.py + yes + + + run-python-file targets/p9_nimbus/sbeTest/testAduMem_withEccItag.py + yes + + + run-python-file targets/p9_nimbus/sbeTest/testAduMem_noEccNoItag.py + yes + + diff --git a/src/test/testcases/testAduMem_ecc.py b/src/test/testcases/testAduMem_ecc.py new file mode 100644 index 00000000..9741d1cb --- /dev/null +++ b/src/test/testcases/testAduMem_ecc.py @@ -0,0 +1,68 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testAduMem_ecc.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +LOOP_COUNT = 1 + +GETMEMADU_TESTDATA_ECC = [0,0,0,0x6, + 0,0,0xA4,0x01, + 0,0,0x0,0xAD, #CoreChipletId/EccByte/Flags - CacheInhibit/FastMode/NoTag/Ecc/AutoIncr/Adu/Proc + 0,0,0,0, # Addr Upper 32 bit + 0x08,0x00,0x00,0x00, # Addr Lower 32 bit + 0x00,0x00,0x00,0x20] # length of data + +GETMEMADU_EXPDATA_ECC = [0x00,0x00,0x00,0x24, # length of data + 0xc0,0xde,0xa4,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + + # GetMemAdu with Ecc + testUtil.writeUsFifo( GETMEMADU_TESTDATA_ECC) + testUtil.writeEot( ) + + testUtil.readDsEntry ( 9 ) + testUtil.readDsFifo( GETMEMADU_EXPDATA_ECC) + testUtil.runCycles( 10000000 ) + 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/testAduMem_itag.py b/src/test/testcases/testAduMem_itag.py new file mode 100644 index 00000000..33a594ab --- /dev/null +++ b/src/test/testcases/testAduMem_itag.py @@ -0,0 +1,66 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testAduMem_itag.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +GETMEMADU_TESTDATA_ITAG = [0,0,0,0x6, + 0,0,0xA4,0x01, + 0,0,0x0,0xB5, #CoreChipletId/EccByte/Flags -> CacheInhibit/FastMode/Tag/NoEcc/AutoIncr/Adu/Proc + 0,0,0,0, # Addr Upper 32 bit + 0x08,0x00,0x00,0x00, # Addr Lower 32 bit + 0x00,0x00,0x00,0x40] # length of data + +GETMEMADU_EXPDATA_ITAG = [0x00,0x00,0x00,0x48, # length of data + 0xc0,0xde,0xa4,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + + # GetMemAdu with Itag + testUtil.writeUsFifo( GETMEMADU_TESTDATA_ITAG ) + testUtil.writeEot( ) + + testUtil.readDsEntry ( 18 ) + testUtil.readDsFifo( GETMEMADU_EXPDATA_ITAG ) + testUtil.runCycles( 10000000 ) + 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/testAduMem_noEccNoItag.py b/src/test/testcases/testAduMem_noEccNoItag.py new file mode 100644 index 00000000..354ad8bd --- /dev/null +++ b/src/test/testcases/testAduMem_noEccNoItag.py @@ -0,0 +1,99 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testAduMem_noEccNoItag.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +LOOP_COUNT = 1 + +PUTMEMADU_CNTLDATA = [0,0,0,0, + 0,0,0xA4,0x02, + 0,0,0x0,0xA5, #CoreChipletId/EccByte/Flags -> NoEccOverride/CacheInhibit/FastMode/NoTag/NoEcc/AutoIncr/Adu/Proc + 0,0,0,0, # Addr Upper 32 bit + 0x08,0x00,0x00,0x00, # Addr Lower 32 bit + 0x00,0x00,0x00,0x10] # length of data + +PUTMEMADU_TESTDATA = [0xab,0xcd,0xef,0x12, + 0xba,0xdc,0xfe,0x21, + 0x34,0x56,0x78,0x9a, + 0x43,0x65,0x87,0xa9] + +PUTMEMADU_EXPDATA = [0x00,0x00,0x00,0x10, # length of data + 0xc0,0xde,0xa4,0x02, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + + + +GETMEMADU_TESTDATA = [0,0,0,0x6, + 0,0,0xA4,0x01, + 0,0,0x0,0xA5, #CoreChipletId/EccByte/Flags -> CacheInhibit/FastMode/NoTag/NoEcc/AutoIncr/Adu/Proc + 0,0,0,0, # Addr Upper 32 bit + 0x08,0x00,0x00,0x00, # Addr Lower 32 bit + 0x00,0x00,0x00,0x10] # length of data + +GETMEMADU_EXPDATA = [0xab,0xcd,0xef,0x12, #data + 0xba,0xdc,0xfe,0x21, + 0x34,0x56,0x78,0x9a, + 0x43,0x65,0x87,0xa9, + 0x00,0x00,0x00,0x10, # length of data + 0xc0,0xde,0xa4,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + + #PutMemAdu Test + testUtil.writeUsFifo( PUTMEMADU_CNTLDATA ) + testUtil.writeUsFifo( PUTMEMADU_TESTDATA ) + testUtil.writeEot( ) + + testUtil.readDsFifo( PUTMEMADU_EXPDATA ) + testUtil.readEot( ) + + # GetMemAdu test + testUtil.writeUsFifo( GETMEMADU_TESTDATA ) + testUtil.writeEot( ) + + testUtil.readDsFifo( GETMEMADU_EXPDATA ) + testUtil.runCycles( 10000000 ) + 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/testAduMem_withEccItag.py b/src/test/testcases/testAduMem_withEccItag.py new file mode 100644 index 00000000..d3c9f9c0 --- /dev/null +++ b/src/test/testcases/testAduMem_withEccItag.py @@ -0,0 +1,66 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testAduMem_withEccItag.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +GETMEMADU_TESTDATA_ECC_ITAG = [0,0,0,0x6, + 0,0,0xA4,0x01, + 0,0,0x0,0xBD, #CoreChipletId/EccByte/Flags -> CacheInhibit/FastMode/Tag/Ecc/AutoIncr/Adu/Proc + 0,0,0,0, # Addr Upper 32 bit + 0x08,0x00,0x00,0x00, # Addr Lower 32 bit + 0x00,0x00,0x00,0x40] # length of data + +GETMEMADU_EXPDATA_ECC_ITAG = [0x00,0x00,0x00,0x50, # length of data + 0xc0,0xde,0xa4,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + + # GetMemAdu with Ecc with Itag test + testUtil.writeUsFifo( GETMEMADU_TESTDATA_ECC_ITAG ) + testUtil.writeEot( ) + + testUtil.readDsEntry ( 20 ) + testUtil.readDsFifo( GETMEMADU_EXPDATA_ECC_ITAG ) + testUtil.runCycles( 10000000 ) + 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/testAduMem_withEccWithItagReadWrite.py b/src/test/testcases/testAduMem_withEccWithItagReadWrite.py new file mode 100644 index 00000000..3d294915 --- /dev/null +++ b/src/test/testcases/testAduMem_withEccWithItagReadWrite.py @@ -0,0 +1,96 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testAduMem_withEccWithItagReadWrite.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +LOOP_COUNT = 1 + +PUTMEMADU_CNTLDATA = [0,0,0,0, + 0,0,0xA4,0x02, + 0,0x07,0x0,0xBD, #CoreChipletId/EccByteTrue/Flags -> EccOverride/CacheInhibit/FastMode/Tag/EccOverride/AutoIncr/Adu/Proc + 0,0,0,0, # Addr Upper 32 bit + 0x08,0x00,0x00,0x00, # Addr Lower 32 bit + 0x00,0x00,0x00,0x08] # length of data + +PUTMEMADU_TESTDATA = [0xab,0xcd,0xef,0x12, + 0xba,0xdc,0xfe,0x21] + +PUTMEMADU_EXPDATA = [0x00,0x00,0x00,0x0a, # length of data + 0xc0,0xde,0xa4,0x02, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03] + + + +GETMEMADU_TESTDATA = [0,0,0,0x6, + 0,0,0xA4,0x01, + 0,0,0x0,0xBD, #CoreChipletId/EccByte/Flags -> CacheInhibit/FastMode/Tag/Ecc/AutoIncr/Adu/Proc + 0,0,0,0, # Addr Upper 32 bit + 0x08,0x00,0x00,0x00, # Addr Lower 32 bit + 0x00,0x00,0x00,0x08] # length of data + +GETMEMADU_EXPDATA = [0xab,0xcd,0xef,0x12, #data + 0xba,0xdc,0xfe,0x21, + 0x01,0x07,0,0, #First Byte is iTag / Second Byte is ECC + 0x00,0x00,0x00,0x0a, # length of data + 0xc0,0xde,0xa4,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + + #PutMemAdu Test + testUtil.writeUsFifo( PUTMEMADU_CNTLDATA ) + testUtil.writeUsFifo( PUTMEMADU_TESTDATA ) + testUtil.writeEot( ) + + testUtil.readDsFifo( PUTMEMADU_EXPDATA ) + testUtil.readEot( ) + + # GetMemAdu test + testUtil.writeUsFifo( GETMEMADU_TESTDATA ) + testUtil.writeEot( ) + + testUtil.readDsFifo( GETMEMADU_EXPDATA ) + testUtil.runCycles( 10000000 ) + 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/testCntlInstruction.py b/src/test/testcases/testCntlInstruction.py new file mode 100644 index 00000000..f3143e70 --- /dev/null +++ b/src/test/testcases/testCntlInstruction.py @@ -0,0 +1,473 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testCntlInstruction.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 * + +LOOP_COUNT = 1 + +#Invalid Input +INST_INVALID_TESTDATA = [0,0,0,3, + 0,0,0xa7,0x01, + 0,1,0x20,0xee] + + +INST_INVALID_EXPDATA_ERR = [0xc0,0xde,0xa7,0x01, + 0x00,0x02,0x00,0x0A, + 0x00,0x00,0x00,0x03] + +# STOP Ins +# core 0 thread 0 STOP WARN FLAG as true +INST_STOP_0_0_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x01] + +# core 0 thread 1 STOP WARN FLAG as true +INST_STOP_0_1_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x11] + +# core 0 thread 2 STOP WARN FLAG as true +INST_STOP_0_2_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x21] + +# core 0 thread 3 STOP with WARN FLAG as true +INST_STOP_0_3_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x31] + +# core 0 thread 0 STOP WARN FLAG as false +INST_STOP_0_0_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x01] + +# core 0 thread 1 STOP WARN FLAG as false +INST_STOP_0_1_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x11] + +# core 0 thread 2 STOP WARN FLAG as false +INST_STOP_0_2_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x21] + +# core 0 thread 3 STOP WARN FLAG as false +INST_STOP_0_3_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x31] + +# Stop All thread in Core0 with warn flag true +INST_STOP0_ALL_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0xf1] + +# Stop All thread in Core0 with warn flag false +INST_STOP0_ALL_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0xf1] + + +# START Ins +# core 0 thread 0 START WARN FLAG as true +INST_START_0_0_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x00] + +# core 0 thread 1 START WARN FLAG as true +INST_START_0_1_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x10] + +# core 0 thread 2 START WARN FLAG as true +INST_START_0_2_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x20] + +# core 0 thread 3 START with WARN FLAG as true +INST_START_0_3_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x30] + +# core 0 thread 0 START WARN FLAG as false +INST_START_0_0_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x00] + +# core 0 thread 1 START WARN FLAG as false +INST_START_0_1_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x10] + +# core 0 thread 2 START WARN FLAG as false +INST_START_0_2_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x20] + +# core 0 thread 3 START WARN FLAG as false +INST_START_0_3_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x30] + +# Start All thread in Core0 with warn flag true +INST_START0_ALL_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0xf0] + +# Start All thread in Core0 with warn flag false +INST_START0_ALL_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0xf0] + +# STEP Ins +# core 0 thread 0 STEP WARN FLAG as true +INST_STEP_0_0_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x02] + +# core 0 thread 1 STEP WARN FLAG as true +INST_STEP_0_1_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x12] + +# core 0 thread 2 STEP WARN FLAG as true +INST_STEP_0_2_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x22] + +# core 0 thread 3 STEP with WARN FLAG as true +INST_STEP_0_3_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x32] + +# core 0 thread 0 STEP WARN FLAG as false +INST_STEP_0_0_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x02] + +# core 0 thread 1 STEP WARN FLAG as false +INST_STEP_0_1_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x12] + +# core 0 thread 2 STEP WARN FLAG as false +INST_STEP_0_2_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x22] + +# core 0 thread 3 STEP WARN FLAG as false +INST_STEP_0_3_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x32] + +# Step All thread in Core0 with warn flag true +INST_STEP0_ALL_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0xf2] + +# Step All thread in Core0 with warn flag false +INST_STEP0_ALL_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0xf2] + +# SRESET Ins +# core 0 thread 0 SRESET WARN FLAG as true +INST_SRESET_0_0_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x03] + +# core 0 thread 1 SRESET WARN FLAG as true +INST_SRESET_0_1_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x13] + +# core 0 thread 2 SRESET WARN FLAG as true +INST_SRESET_0_2_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x23] + +# core 0 thread 3 SRESET with WARN FLAG as true +INST_SRESET_0_3_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0x33] + +# core 0 thread 0 SRESET WARN FLAG as false +INST_SRESET_0_0_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x03] + +# core 0 thread 1 SRESET WARN FLAG as false +INST_SRESET_0_1_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x13] + +# core 0 thread 2 SRESET WARN FLAG as false +INST_SRESET_0_2_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x23] + +# core 0 thread 3 SRESET WARN FLAG as false +INST_SRESET_0_3_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0x33] + +# Sreset All thread in Core0 with warn flag true +INST_SRESET0_ALL_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0xf3] + +# Sreset All thread in Core0 with warn flag false +INST_SRESET0_ALL_TESTDATA_WITHOUT_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,0,0x20,0xf3] + + +INST_EXPDATA = [0xc0,0xde,0xa7,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03] + +INST_EXPDATA_ERR = [0xc0,0xde,0xa7,0x01, + 0x00,0xFE,0x00,0x0A, + 0x00,0x00,0x00,0x03] + +STOP_INST_EXPDATA_ERR_WTH_FFDC = [0xc0,0xde,0xa7,0x01, + 0x00,0xFE,0x00,0x0A, + 0xFF,0xDC,0x00,0x02, + 0x00,0xCE,0xBC,0xB2, + 0x00,0x00,0x00,0x05] + +START_INST_EXPDATA_ERR_WTH_FFDC = [0xc0,0xde,0xa7,0x01, + 0x00,0xFE,0x00,0x0A, + 0xFF,0xDC,0x00,0x02, + 0x00,0x25,0x64,0xDB, + 0x00,0x00,0x00,0x05] + +STEP_INST_EXPDATA_ERR_WTH_FFDC = [0xc0,0xde,0xa7,0x01, + 0x00,0xFE,0x00,0x0A, + 0xFF,0xDC,0x00,0x02, + 0x00,0x0D,0x06,0x8E, + 0x00,0x00,0x00,0x05] + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + #Try an invalid data case + testUtil.writeUsFifo( INST_INVALID_TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_INVALID_EXPDATA_ERR ) + testUtil.readEot( ) + + # Control Instruction Message - Stop + testUtil.writeUsFifo( INST_STOP_0_0_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STOP_0_1_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STOP_0_2_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STOP_0_3_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STOP_0_0_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( STOP_INST_EXPDATA_ERR_WTH_FFDC ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STOP_0_1_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( STOP_INST_EXPDATA_ERR_WTH_FFDC ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STOP_0_2_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( STOP_INST_EXPDATA_ERR_WTH_FFDC ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STOP_0_3_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( STOP_INST_EXPDATA_ERR_WTH_FFDC ) + testUtil.readEot( ) + + #stop all thread in core0 + testUtil.writeUsFifo( INST_STOP0_ALL_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STOP0_ALL_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( STOP_INST_EXPDATA_ERR_WTH_FFDC ) + testUtil.readEot( ) + + # Control Instruction Message - Start + testUtil.writeUsFifo( INST_START_0_0_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_START_0_1_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_START_0_2_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_START_0_3_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + + testUtil.writeUsFifo( INST_START_0_0_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( START_INST_EXPDATA_ERR_WTH_FFDC ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_START_0_1_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( START_INST_EXPDATA_ERR_WTH_FFDC ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_START_0_2_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( START_INST_EXPDATA_ERR_WTH_FFDC ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_START_0_3_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( START_INST_EXPDATA_ERR_WTH_FFDC ) + testUtil.readEot( ) + + #start all thread in core0 + testUtil.writeUsFifo( INST_START0_ALL_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_START0_ALL_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( START_INST_EXPDATA_ERR_WTH_FFDC ) + testUtil.readEot( ) + + # Control Instruction Message - Step + testUtil.writeUsFifo( INST_STEP_0_0_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STEP_0_1_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STEP_0_2_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STEP_0_3_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STEP_0_0_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( STEP_INST_EXPDATA_ERR_WTH_FFDC ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STEP_0_1_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( STEP_INST_EXPDATA_ERR_WTH_FFDC ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STEP_0_2_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( STEP_INST_EXPDATA_ERR_WTH_FFDC ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STEP_0_3_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( STEP_INST_EXPDATA_ERR_WTH_FFDC ) + testUtil.readEot( ) + + #step all thread in core0 + testUtil.writeUsFifo( INST_STEP0_ALL_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_STEP0_ALL_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( STEP_INST_EXPDATA_ERR_WTH_FFDC ) + testUtil.readEot( ) + + # Control Instruction Message - Sreset + testUtil.writeUsFifo( INST_SRESET_0_0_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_SRESET_0_1_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_SRESET_0_2_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_SRESET_0_3_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_SRESET_0_0_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_SRESET_0_1_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_SRESET_0_2_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_SRESET_0_3_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + + #step all thread in core0 + testUtil.writeUsFifo( INST_SRESET0_ALL_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( INST_SRESET0_ALL_TESTDATA_WITHOUT_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_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/testCntlInstruction.xml b/src/test/testcases/testCntlInstruction.xml new file mode 100755 index 00000000..ef16cd40 --- /dev/null +++ b/src/test/testcases/testCntlInstruction.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + run-python-file targets/p9_nimbus/sbeTest/testCntlInstruction.py + yes + + diff --git a/src/test/testcases/testContinueMpipl.py b/src/test/testcases/testContinueMpipl.py new file mode 100755 index 00000000..17f9f7fa --- /dev/null +++ b/src/test/testcases/testContinueMpipl.py @@ -0,0 +1,57 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testContinueMpipl.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +TESTDATA = [0,0,0,2, + 0,0,0xA9,0x02 ] + +EXPDATA = [0xc0,0xde,0xa9,0x02, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x3]; + + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( 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/testContinueSbeBoot.py b/src/test/testcases/testContinueSbeBoot.py new file mode 100755 index 00000000..f3542eda --- /dev/null +++ b/src/test/testcases/testContinueSbeBoot.py @@ -0,0 +1,57 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testContinueSbeBoot.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +TESTDATA = [0,0,0,2, + 0,0,0xA1,0x02 ] + +EXPDATA = [0xc0,0xde,0xa1,0x02, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x3]; + + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( 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/testEnterMpipl.py b/src/test/testcases/testEnterMpipl.py new file mode 100755 index 00000000..ce99c81b --- /dev/null +++ b/src/test/testcases/testEnterMpipl.py @@ -0,0 +1,57 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testEnterMpipl.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +TESTDATA = [0,0,0,2, + 0,0,0xA9,0x01 ] + +EXPDATA = [0xc0,0xde,0xa9,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x3]; + + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( 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/testExecutorMemory.py b/src/test/testcases/testExecutorMemory.py new file mode 100644 index 00000000..fe1b8526 --- /dev/null +++ b/src/test/testcases/testExecutorMemory.py @@ -0,0 +1,80 @@ +#!/usr/bin/python +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testExecutorMemory.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 +''' +############################################################# +# @file testExecutor.py +# @author: George Keishing +# @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/src/test/testcases/testExecutorPSU.py b/src/test/testcases/testExecutorPSU.py new file mode 100644 index 00000000..0b5d83d1 --- /dev/null +++ b/src/test/testcases/testExecutorPSU.py @@ -0,0 +1,140 @@ +#!/usr/bin/python +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testExecutorPSU.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 +''' +############################################################# +# @file testExecutor.py +# @author: George Keishing +# @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 testPSUUtil +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 = testPSUUtil.registry() # Registry obj def for operation + + print "\n Execute SBE Test set [ PSU ] ...\n" + # Sim obj Target Test set Raise Exception + rc_test = regObj.ExecuteTestOp(testPSUUtil.simSbeObj,sbe_test_data, True) + if rc_test != testPSUUtil.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(testPSUUtil.simSbeObj,host_test_data,20) + if rc_intr == testPSUUtil.SUCCESS: + print " Interrupt Event Recieved .. Success !!" + else: + print " Interrupt not Recieved.. Exiting .." + + print "\n" + +if __name__=="__main__": + main() + diff --git a/src/test/testcases/testExecutorPutRing.py b/src/test/testcases/testExecutorPutRing.py new file mode 100644 index 00000000..59949a9f --- /dev/null +++ b/src/test/testcases/testExecutorPutRing.py @@ -0,0 +1,225 @@ +#!/usr/bin/python +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testExecutorPutRing.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 testPSUUtil +import testRegistry as reg +import testUtil + +#------------------------------- +# This is a Test Expected Data +#------------------------------- +''' +This data are the values or strings that needs to be validated for the test. +''' +''' +#------------------------------------------------------------------------------------------------------------------------------ +# SBE side test data - Target - Pervasive(Core), Chiplet Id - 32, Ring ID - ec_func(224), mode - 0x0020(RING_MODE_HEADER_CHECK) +#------------------------------------------------------------------------------------------------------------------------------ +''' +sbe_test_data1 = ( + #----------------------------------------------------------------------------------------------------- + # OP Reg ValueToWrite size Test Expected Data Description + #----------------------------------------------------------------------------------------------------- + ["write", reg.REG_MBOX0, "0000010000F0D301", 8, "None", "Writing to MBOX0 address"], + ["write", reg.REG_MBOX1, "0002002000E00020", 8, "None", "Writing to MBOX1 address"], + ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, "None", "Update SBE Doorbell register to interrupt SBE"], + ) +''' +#------------------------------------------------------------------------------------------------------------------------------ +# SBE side test data - Target - Pervasive(Perv), Chiplet Id - 1, Ring ID - perv_fure(00), mode - 0x0020(RING_MODE_HEADER_CHECK) +#------------------------------------------------------------------------------------------------------------------------------ +''' +sbe_test_data2 = ( + #-------------------------------------------------------------------------------------------------------------------------- + # OP Reg ValueToWrite size Test Expected Data Description + #-------------------------------------------------------------------------------------------------------------------------- + ["write", reg.REG_MBOX0, "0000010000F0D301", 8, "None", "Writing to MBOX0 address"], + ["write", reg.REG_MBOX1, "0002000100000020", 8, "None", "Writing to MBOX1 address"], + ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, "None", "Update SBE Doorbell register to interrupt SBE"], + ) +''' +#--------------------- +# SBE side test data - Target - PROC CHIP, Chiplet Id - x, Ring ID - ob0_fure(118), mode - 0x0020(RING_MODE_HEADER_CHECK) +#--------------------- +''' +sbe_test_data3 = ( + #-------------------------------------------------------------------------------------------------------------------------- + # OP Reg ValueToWrite size Test Expected Data Description + #-------------------------------------------------------------------------------------------------------------------------- + ["write", reg.REG_MBOX0, "0000010000F0D301", 8, "None", "Writing to MBOX0 address"], + ["write", reg.REG_MBOX1, "0000000600760020", 8, "None", "Writing to MBOX1 address"], + ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, "None", "Update SBE Doorbell register to interrupt SBE"], + ) +''' +#------------------------------------------------------------------------------------------------------------------------------ +# SBE side test data - Target - EX, Chiplet Id - 32, Ring ID - ex_l3_fure(176), mode - 0x0020(RING_MODE_HEADER_CHECK) +#------------------------------------------------------------------------------------------------------------------------------ +''' +sbe_test_data4 = ( + #----------------------------------------------------------------------------------------------------- + # OP Reg ValueToWrite size Test Expected Data Description + #----------------------------------------------------------------------------------------------------- + ["write", reg.REG_MBOX0, "0000010000F0D301", 8, "None", "Writing to MBOX0 address"], + ["write", reg.REG_MBOX1, "0001002000B00020", 8, "None", "Writing to MBOX1 address"], + ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, "None", "Update SBE Doorbell register to interrupt SBE"], + ) +''' +#------------------------------------------------------------------------------------------------------------------------------ +# SBE side test data - Target - Invalid target 0x10, Chiplet Id - 32, Ring ID - ex_l3_refr_repr(248), mode - 0x0020(RING_MODE_HEADER_CHECK) +#------------------------------------------------------------------------------------------------------------------------------ +''' +sbe_test_data5 = ( + #----------------------------------------------------------------------------------------------------- + # OP Reg ValueToWrite size Test Expected Data Description + #----------------------------------------------------------------------------------------------------- + ["write", reg.REG_MBOX0, "0000010000F0D301", 8, "None", "Writing to MBOX0 address"], + ["write", reg.REG_MBOX1, "0010002000F80020", 8, "None", "Writing to MBOX1 address"], + ["write", reg.PSU_SBE_DOORBELL_REG_WO_OR, "8000000000000000", 8, "None", "Update SBE Doorbell register to interrupt SBE"], + ) +''' +#--------------------- +# Host side test data - SUCCESS +#--------------------- +''' +host_test_data_success = ( + #---------------------------------------------------------------------------------------------------------------- + # OP Reg ValueToWrite size Test Expected Data Description + #---------------------------------------------------------------------------------------------------------------- + ["read", reg.REG_MBOX4, "0", 8, "0000000000F0D301", "Reading Host MBOX4 data to Validate"], + ) +''' +#--------------------- +# Host side test data - FAILURE +#--------------------- +''' +host_test_data_failure5 = ( + #---------------------------------------------------------------------------------------------------------------- + # OP Reg ValueToWrite size Test Expected Data Description + #---------------------------------------------------------------------------------------------------------------- + ["read", reg.REG_MBOX4, "0", 8, "0002000400F0D301", "Reading Host MBOX4 data to Validate"], + ) + +''' +#----------------------------------------------------------------------- +# Do not modify - Used to simulate interrupt on Ringing Doorbell on Host +#----------------------------------------------------------------------- +''' +host_polling_data = ( + #---------------------------------------------------------------------------------------------------------------- + # OP Reg ValueToWrite size Test Expected Data Description + #---------------------------------------------------------------------------------------------------------------- + ["read", reg.PSU_HOST_DOORBELL_REG_WO_OR, "0", 8, "8000000000000000", "Reading Host Doorbell for Interrupt"], + ) + +#------------------------- +# Main Function +#------------------------- +def main(): + # Run Simics initially + testUtil.runCycles( 10000000 ); + + # Intialize the class obj instances + regObj = testPSUUtil.registry() # Registry obj def for operation + + print "\n Execute SBE Test set1 [ Put Ring ] ...\n" + + ''' + Test Case 1 + ''' + # HOST->SBE data set execution + regObj.ExecuteTestOp( testPSUUtil.simSbeObj, sbe_test_data1 ) + + print "\n Poll on Host side for INTR ...\n" + #Poll on HOST DoorBell Register for interrupt + regObj.pollingOn( testPSUUtil.simSbeObj, host_polling_data, 5 ) + + #SBE->HOST data set execution + regObj.ExecuteTestOp( testPSUUtil.simSbeObj, host_test_data_success ) + + print "\n Execute SBE Test set2 [ Put Ring ] ...\n" + ''' + Test Case 2 + ''' + # HOST->SBE data set execution + regObj.ExecuteTestOp( testPSUUtil.simSbeObj, sbe_test_data2 ) + + print "\n Poll on Host side for INTR ...\n" + #Poll on HOST DoorBell Register for interrupt + regObj.pollingOn( testPSUUtil.simSbeObj, host_polling_data, 5 ) + + #SBE->HOST data set execution + regObj.ExecuteTestOp( testPSUUtil.simSbeObj, host_test_data_success ) + + print "\n Execute SBE Test set3 [ Put Ring ] ...\n" + ''' + Test Case 3 + ''' + # HOST->SBE data set execution + regObj.ExecuteTestOp( testPSUUtil.simSbeObj, sbe_test_data3 ) + + print "\n Poll on Host side for INTR ...\n" + #Poll on HOST DoorBell Register for interrupt + regObj.pollingOn( testPSUUtil.simSbeObj, host_polling_data, 5 ) + + #SBE->HOST data set execution + regObj.ExecuteTestOp( testPSUUtil.simSbeObj, host_test_data_success ) + + print "\n Execute SBE Test set4 [ Put Ring ] ...\n" + ''' + Test Case 4 + ''' + # HOST->SBE data set execution + regObj.ExecuteTestOp( testPSUUtil.simSbeObj, sbe_test_data4 ) + + print "\n Poll on Host side for INTR ...\n" + #Poll on HOST DoorBell Register for interrupt + regObj.pollingOn( testPSUUtil.simSbeObj, host_polling_data, 5 ) + + #SBE->HOST data set execution + regObj.ExecuteTestOp( testPSUUtil.simSbeObj, host_test_data_success ) + + print "\n Execute SBE Test set5 [ Put Ring ] ...\n" + ''' + Test Case 5 + ''' + # HOST->SBE data set execution + regObj.ExecuteTestOp( testPSUUtil.simSbeObj, sbe_test_data5 ) + + print "\n Poll on Host side for INTR ...\n" + #Poll on HOST DoorBell Register for interrupt + regObj.pollingOn( testPSUUtil.simSbeObj, host_polling_data, 5 ) + + #SBE->HOST data set execution + regObj.ExecuteTestOp( testPSUUtil.simSbeObj, host_test_data_failure5 ) + +if __name__ == "__main__": + 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/testExecutorPutRing.xml b/src/test/testcases/testExecutorPutRing.xml new file mode 100755 index 00000000..833484a8 --- /dev/null +++ b/src/test/testcases/testExecutorPutRing.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + run-python-file targets/p9_nimbus/sbeTest/testExecutorPutRing.py + yes + + diff --git a/src/test/testcases/testFifoReset.py b/src/test/testcases/testFifoReset.py new file mode 100644 index 00000000..41eb6563 --- /dev/null +++ b/src/test/testcases/testFifoReset.py @@ -0,0 +1,80 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testFifoReset.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +# Test data that only contains the command header +TESTDATA = [0, 0, 0, 3, + 0, 0, 0xA1, 0x01] + +# Complete test data +TESTDATA_FULL = [0, 0, 0, 3, + 0, 0, 0xA1, 0x01, + 0, 0x02, 0x00, 0x01] + +# Get capabilities command. This will ensure the DS FIFO gets full +TESTDATA_2 = [0, 0, 0, 2, + 0, 0, 0xA8, 0x02] + +def main(): + try: + testUtil.runCycles(10000000) + # Send a partial chip-op + testUtil.writeUsFifo(TESTDATA) + testUtil.resetFifo() + # Make sure both the upstream and downstrem FIFOs are clear after the reset + testUtil.waitTillUsFifoEmpty() + testUtil.waitTillDsFifoEmpty() + # Now send a complete chip-op on the upstream FIFO + testUtil.writeUsFifo(TESTDATA_FULL) + testUtil.writeEot() + testUtil.resetFifo() + # Make sure both the upstream and downstrem FIFOs are clear after the reset + testUtil.waitTillUsFifoEmpty() + testUtil.waitTillDsFifoEmpty() + # Now send a get capabilities chip-op, so that in response, the DS FIFO + # gets full before we do a reset + testUtil.writeUsFifo(TESTDATA_2) + testUtil.writeEot() + testUtil.resetFifo() + # Make sure both the upstream and downstrem FIFOs are clear after the reset + testUtil.waitTillUsFifoEmpty() + testUtil.waitTillDsFifoEmpty() + except: + print("\nTest completed with error(s), Raise error") + raise + print("\nTest completed with no errors") + +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/testFifoReset.xml b/src/test/testcases/testFifoReset.xml new file mode 100644 index 00000000..b9ef674d --- /dev/null +++ b/src/test/testcases/testFifoReset.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + run-python-file targets/p9_nimbus/sbeTest/testFifoReset.py + yes + + + + run-python-file targets/p9_nimbus/sbeTest/testIstepInvalidFenced.py + yes + diff --git a/src/test/testcases/testGeneric.xml b/src/test/testcases/testGeneric.xml new file mode 100755 index 00000000..85ce990a --- /dev/null +++ b/src/test/testcases/testGeneric.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + run-python-file targets/p9_nimbus/sbeTest/testGetCapabilities.py + yes + diff --git a/src/test/testcases/testGetCapabilities.py b/src/test/testcases/testGetCapabilities.py new file mode 100755 index 00000000..4a61d761 --- /dev/null +++ b/src/test/testcases/testGetCapabilities.py @@ -0,0 +1,82 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testGetCapabilities.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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 + +TESTDATA = [0,0,0,2, + 0,0,0xA8,0x02 ] + +EXPDATA1 = [0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0, + 0xa1,0x0,0x0,0x01, # istep + 0x0,0x0,0x0,0x0, + 0xa2,0x0,0x0,0x0f, #getscom/putscom/modifyscom/putscomundermask + 0x0,0x0,0x0,0x0, + 0xa3,0x0,0x0,0x1, #getring + 0x00,0x0,0x0,0x0]; + +EXPDATA2 = [0xa4,0x0,0x0,0x0f, #GetMemPba/PutMemPba/GetSramOcc/PutSramOcc + 0x0,0x0,0x0,0x0, + 0xa5,0x0,0x0,0x03, #GetReg/PutReg + 0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0, + 0xa7,0x0,0x0,0x1, # control Instruction + 0x00,0x0,0x0,0x0]; + +EXPDATA3 = [0xa8,0x0,0x0,0x02, #getcapability + 0x0,0x0,0x0,0x0, + 0xc0,0xde,0xa8,0x02, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x3]; + + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( TESTDATA ) + testUtil.writeEot( ) + # Ignore first two enteries ( major number, minor number + # and fw version) as they will keep on changing + testUtil.readDsEntry( 2 ) + testUtil.readDsFifo( EXPDATA1 ) + testUtil.readDsFifo( EXPDATA2 ) + testUtil.readDsFifo( EXPDATA3 ) + 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/testGetMem.py b/src/test/testcases/testGetMem.py new file mode 100644 index 00000000..baf3b353 --- /dev/null +++ b/src/test/testcases/testGetMem.py @@ -0,0 +1,74 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testGetMem.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 * + +LOOP_COUNT = 1 + +GETMEM_TESTDATA = [0,0,0,0x6, + 0,0,0xA4,0x01, + 0,0,0x0,0x02, + 0,0,0,0, + 0x08,0x00,0x00,0x00, + 0x00,0x00,0x00,0x80] # length of data + +GETMEM_EXPDATA = [0x00,0x00,0x00,0x80, # length of data + 0xc0,0xde,0xa4,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + + # GetMem test + testUtil.writeUsFifo( GETMEM_TESTDATA ) + testUtil.writeEot( ) + # GetMem chipOp would send the read data first, + # thus, would attempt to read the expected length of data first + loop = 1 + while ( loop <= LOOP_COUNT ): + testUtil.readDsEntry ( 32 ) ## 32 entries ~ 128B PBA granule + loop += 1 + testUtil.readDsFifo( GETMEM_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/testGetMem_expdata.py b/src/test/testcases/testGetMem_expdata.py new file mode 100644 index 00000000..df0b51f6 --- /dev/null +++ b/src/test/testcases/testGetMem_expdata.py @@ -0,0 +1,83 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testGetMem_expdata.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 * + +LOOP_COUNT = 4 + +GETMEM_TESTDATA = [0,0,0,0x6, + 0,0,0xA4,0x01, + 0,0,0x0,0x02, + 0,0,0,0, + 0x08,0x00,0x00,0x00, + 0x00,0x00,0x00,0x80] # length of data + +GETMEM_EXP_RESPHDR = [0x00,0x00,0x00,0x80, # length of data + 0xc0,0xde,0xa4,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03] + +GETMEM_EXP_RESPDATA = [0xAB,0xCD,0xEF,0x01, + 0xAB,0xCD,0xEF,0x02, + 0xAB,0xCD,0xEF,0x03, + 0xAB,0xCD,0xEF,0x04, + 0xAB,0xCD,0xEF,0x05, + 0xAB,0xCD,0xEF,0x06, + 0xAB,0xCD,0xEF,0x07, + 0xAB,0xCD,0xEF,0x08] + + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + + # GetMem test + testUtil.writeUsFifo( GETMEM_TESTDATA ) + testUtil.writeEot( ) + # GetMem chipOp would send the read data first, + # thus, would attempt to read the expected length of data first + loop = 1 + while ( loop <= LOOP_COUNT ): + testUtil.readDsFifo ( GETMEM_EXP_RESPDATA ) + loop += 1 + testUtil.readDsFifo( GETMEM_EXP_RESPHDR ) + 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/testGetRing.py b/src/test/testcases/testGetRing.py new file mode 100644 index 00000000..61fba66e --- /dev/null +++ b/src/test/testcases/testGetRing.py @@ -0,0 +1,95 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testGetRing.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 * + +LOOP_COUNT = 1 + +#aligned Data +GETRING_TESTDATA = [0,0,0,0x6, + 0,0,0xA3,0x01, + 0xa,0xa,0xa,0xa, # address + 0,0,0,0x40, # length of data + 0x00,0x00,0x00,0x01] + +GETRING_EXPDATA = [0,0,0,0, #data + 0,0,0,0, #data + 0,0,0,0x40, # length of data + 0xc0,0xde,0xa3,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + +#Un-aligned Data +GETRING_TESTDATA1 = [0,0,0,0x6, + 0,0,0xA3,0x01, + 0xa,0xa,0xa,0xa, # address + 0,0,0,0x45, # length of data + 0x00,0x00,0x00,0x01] + +GETRING_EXPDATA1 = [0,0,0,0, #data + 0,0,0,0, #data + 0,0,0,0, #data + 0,0,0,0, #data + 0,0,0,0x45, # length of data + 0xc0,0xde,0xa3,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + + + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + + # GetRing test - Aligned Data + testUtil.writeUsFifo( GETRING_TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( GETRING_EXPDATA ) + testUtil.runCycles( 10000000 ) + testUtil.readEot( ) + + # GetRing test - un-aligned Data + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( GETRING_TESTDATA1 ) + testUtil.writeEot( ) + testUtil.readDsFifo( GETRING_EXPDATA1 ) + testUtil.runCycles( 10000000 ) + 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/testGetRing.xml b/src/test/testcases/testGetRing.xml new file mode 100755 index 00000000..808b2012 --- /dev/null +++ b/src/test/testcases/testGetRing.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + run-python-file targets/p9_nimbus/sbeTest/testGetRing.py + yes + + diff --git a/src/test/testcases/testIstep.xml b/src/test/testcases/testIstep.xml new file mode 100644 index 00000000..70cf2a62 --- /dev/null +++ b/src/test/testcases/testIstep.xml @@ -0,0 +1,332 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + run-python-file targets/p9_nimbus/sbeTest/testIstepInvalid.py + yes + + + + sbe-istep 2 2 + yes + + + sbe-istep 2 3 + yes + + + sbe-istep 2 4 + yes + + + sbe-istep 2 5 + yes + + + sbe-istep 2 6 + yes + + + sbe-istep 2 7 + yes + + + sbe-istep 2 8 + yes + + + sbe-istep 2 9 + yes + + + sbe-istep 2 10 + yes + + + sbe-istep 2 11 + yes + + + sbe-istep 2 12 + yes + + + sbe-istep 2 13 + yes + + + sbe-istep 2 14 + yes + + + sbe-istep 2 15 + yes + + + sbe-istep 2 16 + yes + + + sbe-istep 2 17 + yes + + + sbe-istep 3 1 + yes + + + sbe-istep 3 2 + yes + + + sbe-istep 3 3 + yes + + + sbe-istep 3 4 + yes + + + sbe-istep 3 5 + yes + + + sbe-istep 3 6 + yes + + + sbe-istep 3 7 + yes + + + sbe-istep 3 8 + yes + + + sbe-istep 3 9 + yes + + + sbe-istep 3 10 + yes + + + sbe-istep 3 11 + yes + + + sbe-istep 3 12 + yes + + + sbe-istep 3 13 + yes + + + sbe-istep 3 14 + yes + + + sbe-istep 3 15 + yes + + + sbe-istep 3 16 + yes + + + sbe-istep 3 17 + yes + + + sbe-istep 3 18 + yes + + + sbe-istep 3 19 + yes + + + sbe-istep 3 20 + yes + + + sbe-istep 3 21 + yes + + + sbe-istep 3 22 + yes + + + sbe-istep 4 1 + yes + + + sbe-istep 4 2 + yes + + + sbe-istep 4 3 + yes + + + sbe-istep 4 4 + yes + + + sbe-istep 4 5 + yes + + + sbe-istep 4 6 + yes + + + sbe-istep 4 7 + yes + + + sbe-istep 4 8 + yes + + + sbe-istep 4 9 + yes + + + sbe-istep 4 10 + yes + + + sbe-istep 4 11 + yes + + + sbe-istep 4 12 + yes + + + sbe-istep 4 13 + yes + + + sbe-istep 4 14 + yes + + + sbe-istep 4 15 + yes + + + sbe-istep 4 16 + yes + + + sbe-istep 4 17 + yes + + + sbe-istep 4 18 + yes + + + sbe-istep 4 19 + yes + + + sbe-istep 4 20 + yes + + + sbe-istep 4 21 + yes + + + sbe-istep 4 22 + yes + + + sbe-istep 4 23 + yes + + + sbe-istep 4 24 + yes + + + sbe-istep 4 25 + yes + + + sbe-istep 4 26 + yes + + + sbe-istep 4 27 + yes + + + sbe-istep 4 28 + yes + + + sbe-istep 4 29 + yes + + + sbe-istep 4 30 + yes + + + sbe-istep 4 31 + yes + + + sbe-istep 4 32 + yes + + + sbe-istep 4 33 + yes + + + sbe-istep 4 34 + yes + + + sbe-istep 5 1 + yes + + + sbe-istep 5 2 + yes + + + + run-python-file targets/p9_nimbus/sbeTest/testIstepInvalidFenced.py + yes + diff --git a/src/test/testcases/testIstepAuto.py b/src/test/testcases/testIstepAuto.py new file mode 100755 index 00000000..bb1fcb5f --- /dev/null +++ b/src/test/testcases/testIstepAuto.py @@ -0,0 +1,54 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testIstepAuto.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 +from sim_commands import * +import imp +err = False +testUtil = imp.load_source("testUtil", os.environ['SBE_TOOLS_PATH'] + "/testUtil.py") +EXPDATA = [0xc0,0xde,0xa1,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; +# MAIN Test Run Starts Here... +#------------------------------------------------- +def sbe_istep_func( major, minor ): + try: + TESTDATA = [0,0,0,3, + 0,0,0xA1,0x01, + 0,major,0,minor ] + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( EXPDATA ) + testUtil.readEot( ) + except: + print ("\nTest completed with error(s). Raise error") + # TODO via RTC 142706 + # Currently simics commands created using hooks always return + # success. Need to check from simics command a way to return + # Calling non existant command to return failure + run_command("Command Failed"); + raise + print ("\nTest completed with no errors") + #sys.exit(0); + diff --git a/src/test/testcases/testIstepInvalid.py b/src/test/testcases/testIstepInvalid.py new file mode 100755 index 00000000..cd26b209 --- /dev/null +++ b/src/test/testcases/testIstepInvalid.py @@ -0,0 +1,57 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testIstepInvalid.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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 * + +TESTDATA = [0,0,0,3, + 0,0,0xA1,0x01, + 0,0x02,0x00,0x1] + +EXPDATA = [0xc0,0xde,0xa1,0x01, + 0x00,0x02,0x00,0x0A, + 0x00,0x0,0x0,0x03]; + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( 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/testIstepInvalidFenced.py b/src/test/testcases/testIstepInvalidFenced.py new file mode 100755 index 00000000..f64074b8 --- /dev/null +++ b/src/test/testcases/testIstepInvalidFenced.py @@ -0,0 +1,57 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testIstepInvalidFenced.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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 * + +TESTDATA = [0,0,0,3, + 0,0,0xA1,0x01, + 0,0x02,0x00,0x1] + +EXPDATA = [0xc0,0xde,0xa1,0x01, + 0x00,0x00,0x00,0x08, + 0x00,0x0,0x0,0x03]; + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( 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/testIstepSuccess.py b/src/test/testcases/testIstepSuccess.py new file mode 100755 index 00000000..f9e18436 --- /dev/null +++ b/src/test/testcases/testIstepSuccess.py @@ -0,0 +1,57 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testIstepSuccess.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 * + +TESTDATA = [0,0,0,3, + 0,0,0xA1,0x01, + 0,0x02,0x00,0x2] + +EXPDATA = [0xc0,0xde,0xa1,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( 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/testModifyScom.py b/src/test/testcases/testModifyScom.py new file mode 100755 index 00000000..36d75aca --- /dev/null +++ b/src/test/testcases/testModifyScom.py @@ -0,0 +1,97 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testModifyScom.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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/testPSUUserUtil.py b/src/test/testcases/testPSUUserUtil.py new file mode 100644 index 00000000..383cb97c --- /dev/null +++ b/src/test/testcases/testPSUUserUtil.py @@ -0,0 +1,58 @@ +#!/usr/bin/python +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testPSUUserUtil.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 +''' +############################################################# +# @file testClassUtil.py +# @author: George Keishing +# @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 testPSUUtil + +''' +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 testPSUUtil.SUCCESS diff --git a/src/test/testcases/testPSUUtil.py b/src/test/testcases/testPSUUtil.py new file mode 100644 index 00000000..efc7d5be --- /dev/null +++ b/src/test/testcases/testPSUUtil.py @@ -0,0 +1,376 @@ +#!/usr/bin/python +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testPSUUtil.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 +''' +############################################################# +# @file testClass.py +# @author: George Keishing +# @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 testUtil +import testPSUUserUtil +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, raiseException=True): + ''' + 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: + if(raiseException == True): + raise Exception('Data mistmach'); + 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: + print "\n Invalid Test Data" + if(raiseException == True): + raise Exception('Invalid Test Data'); + 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 poll mechanism + #---------------------------------------------------- + def pollingOn(self, simObj, test_data, retries=20): + for l_param in test_data: + while True: + print "\n***** Polling On result - retrials left [%d] " % retries + print "\n" + testUtil.runCycles( 1000000); + test_d = (l_param,) + rc = self.ExecuteTestOp(simObj, test_d, False) + if rc == SUCCESS: + print ('Polling Successful for - ' + l_param[5]) + break + elif retries <= 0: + print " Retrials exhausted... Exiting polling" + raise Exception('Polling Failed for - ' + l_param[5]); + break + else: + retries = retries - 1 + return FAILURE + + #---------------------------------------------------- + # Load the function and execute + #---------------------------------------------------- + def loadFunc(self, func_name, i_pArray ): + rc = testPSUUserUtil.__getattribute__(func_name)(i_pArray) + return rc # Either success or failure from func + + diff --git a/src/test/testcases/testPutGetInScom.py b/src/test/testcases/testPutGetInScom.py new file mode 100755 index 00000000..2e42a253 --- /dev/null +++ b/src/test/testcases/testPutGetInScom.py @@ -0,0 +1,82 @@ +# 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 +# +# +# 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/testPutGetMem.xml b/src/test/testcases/testPutGetMem.xml new file mode 100644 index 00000000..ae82868c --- /dev/null +++ b/src/test/testcases/testPutGetMem.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + run-python-file targets/p9_nimbus/sbeTest/testPutMem.py + yes + + + run-python-file targets/p9_nimbus/sbeTest/testGetMem_expdata.py + yes + + diff --git a/src/test/testcases/testPutGetRegFpr.py b/src/test/testcases/testPutGetRegFpr.py new file mode 100755 index 00000000..6bf0209e --- /dev/null +++ b/src/test/testcases/testPutGetRegFpr.py @@ -0,0 +1,81 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testPutGetRegFpr.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +PUTREG_TESTDATA = [0,0,0,9, + 0,0,0xA5,0x02, + 0x00,0x20,0x02,0x02, # two fpr registers + 0,0,0x0,0x01, + 0,0,0x0,0x0, + 0,0,0x0,0x1, + 0,0,0x0,0x02, + 0,0,0x0,0x0, + 0,0,0x0,0x2 ] + +PUTREG_EXPDATA = [0xc0,0xde,0xa5,0x02, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + +GETREG_TESTDATA = [0,0,0,5, + 0,0,0xA5,0x01, + 0x00,0x20,0x02,0x02, #two fpr registers + 0,0,0x0,0x01, + 0,0,0x0,0x02 ] + +GETREG_EXPDATA = [0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01, + 0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x02, + 0xc0,0xde,0xa5,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( PUTREG_TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( PUTREG_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( GETREG_TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( GETREG_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/testPutGetRegGpr.py b/src/test/testcases/testPutGetRegGpr.py new file mode 100755 index 00000000..871ff375 --- /dev/null +++ b/src/test/testcases/testPutGetRegGpr.py @@ -0,0 +1,81 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testPutGetRegGpr.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +PUTREG_TESTDATA = [0,0,0,9, + 0,0,0xA5,0x02, + 0x00,0x20,0x00,0x02, # two gpr registers + 0,0,0x0,0x07, + 0,0,0x0,0x0, + 0,0,0x0,0x1, + 0,0,0x0,0x08, + 0,0,0x0,0x0, + 0,0,0x0,0x2 ] + +PUTREG_EXPDATA = [0xc0,0xde,0xa5,0x02, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + +GETREG_TESTDATA = [0,0,0,5, + 0,0,0xA5,0x01, + 0x00,0x20,0x00,0x02, # two gpr registers + 0,0,0x0,0x07, + 0,0,0x0,0x08 ] + +GETREG_EXPDATA = [0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01, + 0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x02, + 0xc0,0xde,0xa5,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( PUTREG_TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( PUTREG_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( GETREG_TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( GETREG_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/testPutGetRegSpr.py b/src/test/testcases/testPutGetRegSpr.py new file mode 100755 index 00000000..d42e4c53 --- /dev/null +++ b/src/test/testcases/testPutGetRegSpr.py @@ -0,0 +1,81 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testPutGetRegSpr.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +PUTREG_TESTDATA = [0,0,0,9, + 0,0,0xA5,0x02, + 0x00,0x20,0x01,0x02, # two spr registers + 0,0,0x0,0x08, + 0,0,0x0,0x0, + 0,0,0x0,0x1, + 0,0,0x0,0x09, + 0,0,0x0,0x0, + 0,0,0x0,0x2 ] + +PUTREG_EXPDATA = [0xc0,0xde,0xa5,0x02, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + +GETREG_TESTDATA = [0,0,0,5, + 0,0,0xA5,0x01, + 0x00,0x20,0x01,0x02, # two spr registers + 0,0,0x0,0x08, + 0,0,0x0,0x09 ] + +GETREG_EXPDATA = [0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x01, + 0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x02, + 0xc0,0xde,0xa5,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( PUTREG_TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( PUTREG_EXPDATA ) + testUtil.readEot( ) + testUtil.writeUsFifo( GETREG_TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( GETREG_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 new file mode 100755 index 00000000..9c8700e4 --- /dev/null +++ b/src/test/testcases/testPutGetScom.py @@ -0,0 +1,118 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testPutGetScom.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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. + +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, + 0x00,0x0,0x0,0x04, + 0x00,0x0,0x0,0x04]; + +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, + 0x00,0x0,0x0,0x04, + 0x00,0x0,0x0,0x04]; + +# 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.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.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/testPutMem.py b/src/test/testcases/testPutMem.py new file mode 100644 index 00000000..cb0398ff --- /dev/null +++ b/src/test/testcases/testPutMem.py @@ -0,0 +1,83 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testPutMem.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 * + +LOOP_COUNT = 4 + +PUTMEM_TEST_HDR = [0,0,0,0x86, + 0,0,0xA4,0x02, + 0,0,0x0,0x02, + 0,0,0,0, + 0x08,0x00,0x00,0x00, + 0x00,0x00,0x00,0x80] + +PUTMEM_TEST_DATA = [0xAB,0xCD,0xEF,0x01, + 0xAB,0xCD,0xEF,0x02, + 0xAB,0xCD,0xEF,0x03, + 0xAB,0xCD,0xEF,0x04, + 0xAB,0xCD,0xEF,0x05, + 0xAB,0xCD,0xEF,0x06, + 0xAB,0xCD,0xEF,0x07, + 0xAB,0xCD,0xEF,0x08] + +PUTMEM_EXPDATA = [0x00,0x00,0x00,0x80, + 0xc0,0xde,0xa4,0x02, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03] + + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + + testUtil.writeUsFifo( PUTMEM_TEST_HDR ) + + loop = 1 + while (loop <= LOOP_COUNT): + #testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( PUTMEM_TEST_DATA ) + loop += 1 + testUtil.writeEot( ) + + #testUtil.runCycles( 10000000 ) + testUtil.readDsFifo( PUTMEM_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/testPutMem_fail.py b/src/test/testcases/testPutMem_fail.py new file mode 100644 index 00000000..a3ab46b5 --- /dev/null +++ b/src/test/testcases/testPutMem_fail.py @@ -0,0 +1,84 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testPutMem_fail.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 * + +LOOP_COUNT = 4 + +PUTMEM_TEST_HDR = [0,0,0x00,0x86, + 0,0,0xA4,0x02, + 0,0,0x0,0x02, + 0,0,0,0, + 0x08,0x00,0x00,0x04, # Un-aligned PBA Address + 0x00,0x00,0x00,0x80] + +PUTMEM_TEST_DATA = [0xAB,0xCD,0xEF,0x01, + 0xAB,0xCD,0xEF,0x02, + 0xAB,0xCD,0xEF,0x03, + 0xAB,0xCD,0xEF,0x04, + 0xAB,0xCD,0xEF,0x05, + 0xAB,0xCD,0xEF,0x06, + 0xAB,0xCD,0xEF,0x07, + 0xAB,0xCD,0xEF,0x08] + +PUTMEM_EXPDATA = [0x00,0x00,0x00,0x00, + 0xc0,0xde,0xa4,0x02, + 0x00,0xfe,0x00,0x0a, + 0xff,0xdc,0x00,0x03, + 0x00,0x00,0x00,0x00, + 0x00,0xf8,0x82,0x19, + 0x00,0x00,0x00,0x06] + + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + + testUtil.writeUsFifo( PUTMEM_TEST_HDR ) + + loop = 1 + while (loop <= LOOP_COUNT): + testUtil.writeUsFifo( PUTMEM_TEST_DATA ) + loop += 1 + testUtil.writeEot( ) + + testUtil.readDsFifo( PUTMEM_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/testPutScomUnderMask.py b/src/test/testcases/testPutScomUnderMask.py new file mode 100755 index 00000000..b3484bef --- /dev/null +++ b/src/test/testcases/testPutScomUnderMask.py @@ -0,0 +1,98 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testPutScomUnderMask.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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/testRegAccess.xml b/src/test/testcases/testRegAccess.xml new file mode 100755 index 00000000..c5876c0b --- /dev/null +++ b/src/test/testcases/testRegAccess.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + run-python-file targets/p9_nimbus/sbeTest/testStopInstruction.py + yes + + + run-python-file targets/p9_nimbus/sbeTest/testPutGetRegGpr.py + yes + + + run-python-file targets/p9_nimbus/sbeTest/testPutGetRegFpr.py + yes + + + run-python-file targets/p9_nimbus/sbeTest/testPutGetRegSpr.py + yes + + + run-python-file targets/p9_nimbus/sbeTest/testStartInstruction.py + yes + + diff --git a/src/test/testcases/testRegistry.py b/src/test/testcases/testRegistry.py new file mode 100644 index 00000000..dc15fc87 --- /dev/null +++ b/src/test/testcases/testRegistry.py @@ -0,0 +1,79 @@ +#!/usr/bin/python +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testRegistry.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 +''' +############################################################# +# @file testClass.py +# @author: George Keishing +# @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 diff --git a/src/test/testcases/testSbeDump.py b/src/test/testcases/testSbeDump.py new file mode 100644 index 00000000..7d7a7d77 --- /dev/null +++ b/src/test/testcases/testSbeDump.py @@ -0,0 +1,110 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testSbeDump.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 * + +TESTDATA = [0, 0, 0, 3, + 0, 0, 0xA1, 0x01, + 0, 0x02, 0x00, 0x2] + +EXPDATA = [0xc0, 0xde, 0xa1, 0x01] + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main(): + testUtil.runCycles(10000000) + testUtil.writeUsFifo(TESTDATA) + testUtil.writeEot() + testUtil.readDsFifo(EXPDATA) + #flush out primary and secondary status + data = testUtil.readDsEntryReturnVal() + + #flush hwp ffdc + data = testUtil.readDsEntryReturnVal() + data = testUtil.readDsEntryReturnVal() + + #start processing sbe ffdc + data = testUtil.readDsEntryReturnVal() + magicBytes = ((data[0] << 8) | data[1]) + if (magicBytes == 0xFFDC) : + print ("\nMagic Bytes Match") + else : + raise Exception('data mistmach') + packLen = ((data[2] << 8) | data[3]) + print ("\nFFDC package length = " + str(packLen)) + + data = testUtil.readDsEntryReturnVal() + fapiRc = ((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]) + print ("\nFAPI rc = " + str(hex(fapiRc))) + + data = testUtil.readDsEntryReturnVal() + primaryStatus = ((data[0] << 8) | data[1]) + secondaryStatus = ((data[2] << 8) | data[3]) + print ("\nPrimary Status " + str(hex(primaryStatus)) + " Secondary Status "\ + + str(hex(secondaryStatus))) + + data = testUtil.readDsEntryReturnVal() + header = ((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]) + print ("\nHeader = " + str(hex(header))) + + for i in range(0, (bin(header).count("1"))): + #read user data id + data = testUtil.readDsEntryReturnVal() + id = (data[0] << 8) | data[1] + print "User data Id ["+str(hex(id))+"]" + len = (data[2] << 8) | data[3] + #if it is trace field SBE_FFDC_TRACE_DUMP + fileName = "" + if(id == 0x0002): + fileName = "trace.bin" + print ("\nlength of trace dump " + str(len)) + #if it is trace field SBE_FFDC_ATTR_DUMP + elif(id == 0x0001): + fileName = "attr.bin" + print ("\nlength of attr dump " + str(len)) + myBin = open(fileName, 'wb') + print ("\nwriting "+fileName) + loopCount = (len ) / 4 + for j in range(0, loopCount): + data = testUtil.readDsEntryReturnVal() + myBin.write(bytearray(data)) + print("write to a file Done") + myBin.close() + #flush out distance + data = testUtil.readDsEntryReturnVal() +#------------------------------------------------- +# 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/testScom.xml b/src/test/testcases/testScom.xml new file mode 100755 index 00000000..6f59c7cd --- /dev/null +++ b/src/test/testcases/testScom.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + run-python-file targets/p9_nimbus/sbeTest/testPutGetScom.py + yes + + + run-python-file targets/p9_nimbus/sbeTest/testPutScomUnderMask.py + yes + + + run-python-file targets/p9_nimbus/sbeTest/testModifyScom.py + yes + + + run-python-file targets/p9_nimbus/sbeTest/testPutGetInScom.py + yes + + diff --git a/src/test/testcases/testSram.py b/src/test/testcases/testSram.py new file mode 100644 index 00000000..ca064c77 --- /dev/null +++ b/src/test/testcases/testSram.py @@ -0,0 +1,129 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testSram.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 * + +LOOP_COUNT = 1 + +PUTSRAM_OCC_CNTLDATA = [0,0,0,0x20, + 0,0,0xa4,0x04, #magic + 0,0,0,0x01, + 0xe7,0xf0,0x00,0x00, #addr + 0,0,0x01,0x00] # length + +PUTSRAM_OCC_TESTDATA = [0xab,0xcd,0xef,0x12, + 0xba,0xdc,0xfe,0x21, + 0x34,0x56,0x78,0x9a, + 0x43,0x65,0x87,0xa9, + 0xab,0xcd,0xef,0x12, + 0xba,0xdc,0xfe,0x21, + 0x34,0x56,0x78,0x9a, + 0x43,0x65,0x87,0xa9] + +PUTSRAM_OCC_EXP_CNTLDATA = [0,0,0x01,0x00, + 0xc0,0xde,0xa4,0x04, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03] + +GETSRAM_OCC_CNTLDATA = [0,0,0,0x5, + 0,0,0xa4,0x03, + 0,0,0,0x01, + 0xe7,0xf0,0x00,0x00, #address + 0x00,0x00,0x01,0x00] # length of data + +GETSRAM_OCC_EXP_TESTDATA = [0xab,0xcd,0xef,0x12, #data + 0xba,0xdc,0xfe,0x21, + 0x34,0x56,0x78,0x9a, + 0x43,0x65,0x87,0xa9, + 0xab,0xcd,0xef,0x12, + 0xba,0xdc,0xfe,0x21, + 0x34,0x56,0x78,0x9a, + 0x43,0x65,0x87,0xa9] + +GETSRAM_OCC_EXP_CNTLDATA = [0x00,0x00,0x01,0x00, # length + 0xc0,0xde,0xa4,0x03, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03]; + + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + + # Put Occ Sram test - Linear - Can be tested over Normal + # Debug mode + testUtil.writeUsFifo( PUTSRAM_OCC_CNTLDATA ) + # Write 32 bytes of data 8 times => 32*8 = 256 = 0x100 + i_cnt = 0 + while i_cnt < 8: + testUtil.writeUsFifo( PUTSRAM_OCC_TESTDATA ) + i_cnt = i_cnt+1 + + testUtil.writeEot( ) + + # Read the expected data for put sram + testUtil.readDsFifo( PUTSRAM_OCC_EXP_CNTLDATA ) + testUtil.readEot( ) + + # Get Sram Linear + testUtil.writeUsFifo( GETSRAM_OCC_CNTLDATA ) + testUtil.writeEot( ) + + # Read the Expected Data for get Sram + i_cnt = 0 + while i_cnt < 8: + testUtil.readDsFifo( GETSRAM_OCC_EXP_TESTDATA ) + i_cnt = i_cnt+1 + + testUtil.readDsFifo( GETSRAM_OCC_EXP_CNTLDATA ) + testUtil.readEot( ) + + # Put Occ Sram test - Circular - Can be enabled once we get + # valid address range to read the circular data + #testUtil.writeUsFifo( PUTSRAM_OCC_TESTDATA_1 ) + #testUtil.writeEot( ) + #testUtil.readDsFifo( PUTSRAM_OCC_EXPDATA_1 ) + #testUtil.readEot( ) + #testUtil.writeUsFifo( GETSRAM_OCC_TESTDATA_1 ) + #testUtil.writeEot( ) + #testUtil.readDsFifo( GETSRAM_OCC_EXPDATA_1 ) + #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/testSram.xml b/src/test/testcases/testSram.xml new file mode 100755 index 00000000..a1e74162 --- /dev/null +++ b/src/test/testcases/testSram.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/testcases/testStartInstruction.py b/src/test/testcases/testStartInstruction.py new file mode 100644 index 00000000..cc5cba02 --- /dev/null +++ b/src/test/testcases/testStartInstruction.py @@ -0,0 +1,64 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testStartInstruction.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 * + +LOOP_COUNT = 1 + + +# Start All thread in Core0 with warn flag true +INST_START0_ALL_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0xf0] + +INST_EXPDATA = [0xc0,0xde,0xa7,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03] + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + + #stop all thread in core0 + testUtil.writeUsFifo( INST_START0_ALL_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_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/testStopInstruction.py b/src/test/testcases/testStopInstruction.py new file mode 100644 index 00000000..37d79acf --- /dev/null +++ b/src/test/testcases/testStopInstruction.py @@ -0,0 +1,64 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testStopInstruction.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 * + +LOOP_COUNT = 1 + + +# Stop All thread in Core0 with warn flag true +INST_STOP0_ALL_TESTDATA_WITH_WARN_FLG = [0,0,0,0x03, + 0,0,0xa7,0x01, + 0,1,0x20,0xf1] + +INST_EXPDATA = [0xc0,0xde,0xa7,0x01, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x03] + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + + #stop all thread in core0 + testUtil.writeUsFifo( INST_STOP0_ALL_TESTDATA_WITH_WARN_FLG ) + testUtil.writeEot( ) + testUtil.readDsFifo( INST_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/testUtil.py b/src/test/testcases/testUtil.py new file mode 100644 index 00000000..2312d2b7 --- /dev/null +++ b/src/test/testcases/testUtil.py @@ -0,0 +1,170 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testUtil.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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 time +import conf +from sim_commands import * + +#err = False +lbus = conf.p9Proc0.proc_lbus_map +def writeUsFifo( data): + """Main test Loop""" + loopCount = len(data)/4; + for i in range (loopCount): + idx = i * 4; + writeEntry(lbus, 0x2400, (data[idx], data[idx+1], data[idx+2], data[idx+3]) ) + +def readDsFifo(data): + """Main test Loop""" + loopCount = len(data)/4; + for i in range (loopCount): + idx = i * 4; + checkEqual(readEntry(lbus, 0x2440, 4), (data[idx], data[idx+1], data[idx+2], data[idx+3])) + +def writeEot(): + write(lbus, 0x2408, (0, 0, 0, 1) ) + +def write(obj, address, value ): + """ Write to memory space """ + iface = SIM_get_interface(obj, "memory_space") + iface.write(None, address, value, 0x0) + +def readEot(): + """ Read from memory space """ + status = read(lbus, 0x2444, 4) + checkEqual( (status[3] & 0x80), 0x80 ); + read(lbus, 0x2440, 4) + +def resetFifo(): + write(lbus, 0x240C, (0, 0, 0, 1)) + return + +def readUsFifoStatus(): + status = read(lbus, 0x2404, 4) + return status + +def readDsFifoStatus(): + status = read(lbus, 0x2444, 4) + return status + +def waitTillFifoEmpty(func): + count = 0 + loop = True + while(loop is True): + status = func() + if(status[1] == 0x10): + loop = False + break + else: + count = count + 1 + runCycles(200000) + if(count > 10): + raise Exception('Timed out waiting for FIFO to get flushed') + + +def waitTillUsFifoEmpty(): + try: + waitTillFifoEmpty(readUsFifoStatus) + except: + raise Exception('US FIFO did not get empty') + + +def waitTillDsFifoEmpty(): + try: + waitTillFifoEmpty(readDsFifoStatus) + except: + raise Exception('DS FIFO did not get empty') + + +# This function will only read the entry but will not compare it +# with anything. This can be used to flush out enteries. +def readDsEntry(entryCount): + for i in range (entryCount): + readEntry(lbus, 0x2440, 4) + +def writeEntry(obj, address, value ): + + loop = 1; + count = 0; + while( loop ): + status = read(lbus, 0x2404, 4) # Address 0x2404: Upstream Fifo Status + + if( status[2] & 0x02): + count = count + 1 + runCycles(200000) + # This will cause test to fail + if(count > 10): + raise Exception('Timeout. FIFO FULL'); + else: + # write entry + write(obj, address, value) + loop = 0 + + return value +def readDsEntryReturnVal(): + data = readEntry(lbus, 0x2440, 4) + runCycles(200000) + return data +def readEntry(obj, address, size): + + """ Read from memory space """ + loop = 1; + count = 0; + value = (0,0,0,0) + while( loop ): + status = read(lbus, 0x2444, 4) # Address 0x2444: Downstream Fifo Status + + if( status[1] & 0x0F): + # read entry + value = read(lbus, address, size) + loop = 0 + else: + count = count + 1 + runCycles(200000) + # This will cause test to fail + if(count > 10): + raise Exception('Timeout. Empty FIFO'); + + return value + +def read(obj, address, size): + """ Read from memory space """ + iface = SIM_get_interface(obj, "memory_space") + value = iface.read(None, address, size, 0x0) + return value + +def runCycles( cycles ): + if (not SIM_simics_is_running()): + syscmd = "run-cycles %d"%(cycles) + ( rc, out ) = quiet_run_command( syscmd, output_modes.regular ) + if ( rc ): + print "simics ERROR running %s: %d "%( syscmd, rc ) + +def checkEqual( data, expdata ): + """ Throw exception if data is not equal """ + if( cmp(data, expdata )): + print "Eqality check failed" + print "Data:", data + print "Expected Data", expdata + raise Exception('data mistmach'); + diff --git a/src/tools/debug/hw-debug-framework.py b/src/tools/debug/hw-debug-framework.py new file mode 100755 index 00000000..7d294e15 --- /dev/null +++ b/src/tools/debug/hw-debug-framework.py @@ -0,0 +1,136 @@ +#!/usr/bin/python +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/tools/debug/hw-debug-framework.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 os +import subprocess +import re +import random +import argparse +import sys +err = False + +syms = {}; + +def fillSymTable(sbeObjDir): + symFile = sbeObjDir + "/sbe.syms" + f = open( symFile, 'r' ) + for line in f: + words = line.split() + if( len( words ) == 4 ): + syms[words[3]] = [words[0], words[1]] + +def collectTrace( hwpBinDir, sbeObjDir, target, proc ): + cmd1 = ("."+hwpBinDir+"/p9_sbe_pibMemDump_wrap.exe " + \ + syms['g_pk_trace_buf'][0] +\ + " " + syms['g_pk_trace_buf'][1] + " " + target) + cmd2 = "." + "/ppe2fsp dumpPibMem sbetrace.bin " + cmd3 = ("." + "/fsp-trace -s " + sbeObjDir +\ + "/trexStringFile sbetrace.bin > "+\ + "sbe_"+str(proc)+"_tracMERG") + cmd4 = "mv dumpPibMem dumpPibMem_trace" + print "\ncollecting trace with commands -\n" + print "cmd1:", cmd1 + rc = os.system( cmd1 ) + if ( rc ): + print "ERROR running %s: %d " % ( cmd1, rc ) + return 1 + + print "cmd2:", cmd2 + rc = os.system( cmd2 ) + if ( rc ): + print "ERROR running %s: %d " % ( cmd2, rc ) + return 1 + + print "cmd3:", cmd3 + rc = os.system( cmd3 ) + if ( rc ): + print "ERROR running %s: %d " % ( cmd3, rc ) + return 1 + + print "cmd4:", cmd4 + rc = os.system( cmd4 ) + if ( rc ): + print "ERROR running %s: %d " % ( cmd4, rc ) + return 1 + +def collectAttr( hwpBinDir, sbeObjDir, target, proc ): + cmd1 = ("."+hwpBinDir+"/p9_sbe_pibMemDump_wrap.exe " +\ + syms['G_sbe_attrs'][0] + " " + \ + syms['G_sbe_attrs'][1] + " " + target) + cmd2 = "mv dumpPibMem sbeAttr.bin" + cmd3 = ("."+ sbeObjDir + "/p9_xip_tool " +\ + sbeObjDir + "/sbe_seeprom.bin -ifs attrdump sbeAttr.bin > "+\ + "sbe_"+str(proc)+"_attrs") + print "\ncollecting attributes with commands -\n" + print "cmd1:", cmd1 + rc = os.system( cmd1 ) + if ( rc ): + print "ERROR running %s: %d " % ( cmd1, rc ) + return 1 + + print "cmd2:", cmd2 + rc = os.system( cmd2 ) + if ( rc ): + print "ERROR running %s: %d " % ( cmd2, rc ) + return 1 + + print "cmd3:", cmd3 + rc = os.system( cmd3 ) + if ( rc ): + print "ERROR running %s: %d " % ( cmd3, rc ) + return 1 + +def main( argv ): + parser = argparse.ArgumentParser( description = "SBE Dump Parser" ) + + parser.add_argument( '-hwpBinDir', type=str, default = os.getcwd(), \ + help = 'Path of p9_sbe_pibMemDump_wrap.exe') + parser.add_argument( '-sbeObjDir', type=str, default = os.getcwd(), \ + help = 'Path of sbe.syms file') + parser.add_argument( '-l', '--level', choices = ['all', 'trace', 'attr'],\ + default='all', help = 'Parser level' ) + parser.add_argument( '-t', '--target', choices = ['AWAN', 'HW'], \ + required = 'true', help = 'Target type' ) + parser.add_argument( '-p', '--proc', type=int , default = 0, \ + help = 'Proc Number' ) + + args = parser.parse_args() + + if ( args.target == 'AWAN' ): + target = "1" + elif ( args.target == 'HW' ): + target = "0" + + fillSymTable(args.sbeObjDir) + if ( args.level == 'all' ): + print "Parsing everything" + collectTrace( args.hwpBinDir, args.sbeObjDir, target, args.proc ) + collectAttr( args.hwpBinDir, args.sbeObjDir, target, args.proc ) + elif ( args.level == 'trace' ): + collectTrace( args.hwpBinDir, args.sbeObjDir, target, args.proc ) + elif ( args.level == 'attr' ): + collectAttr( args.hwpBinDir, args.sbeObjDir, target, args.proc ) + +if __name__ == "__main__": + main( sys.argv ) diff --git a/src/tools/debug/sbe-debug.py b/src/tools/debug/sbe-debug.py deleted file mode 100755 index dbea27d8..00000000 --- a/src/tools/debug/sbe-debug.py +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/python -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/tools/debug/sbe-debug.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 os -import subprocess -import re -import random -import argparse -import sys -err = False - -syms = {}; - -def fillSymTable(sbeObjDir): - symFile = sbeObjDir + "/sbe.syms" - f = open( symFile, 'r' ) - for line in f: - words = line.split() - if( len( words ) == 4 ): - syms[words[3]] = [words[0], words[1]] - -def collectTrace( hwpBinDir, sbeObjDir, target, proc ): - cmd1 = ("."+hwpBinDir+"/p9_sbe_pibMemDump_wrap.exe " + \ - syms['g_pk_trace_buf'][0] +\ - " " + syms['g_pk_trace_buf'][1] + " " + target) - cmd2 = "." + "/ppe2fsp dumpPibMem sbetrace.bin " - cmd3 = ("." + "/fsp-trace -s " + sbeObjDir +\ - "/trexStringFile sbetrace.bin > "+\ - "sbe_"+str(proc)+"_tracMERG") - cmd4 = "mv dumpPibMem dumpPibMem_trace" - print "\ncollecting trace with commands -\n" - print "cmd1:", cmd1 - rc = os.system( cmd1 ) - if ( rc ): - print "ERROR running %s: %d " % ( cmd1, rc ) - return 1 - - print "cmd2:", cmd2 - rc = os.system( cmd2 ) - if ( rc ): - print "ERROR running %s: %d " % ( cmd2, rc ) - return 1 - - print "cmd3:", cmd3 - rc = os.system( cmd3 ) - if ( rc ): - print "ERROR running %s: %d " % ( cmd3, rc ) - return 1 - - print "cmd4:", cmd4 - rc = os.system( cmd4 ) - if ( rc ): - print "ERROR running %s: %d " % ( cmd4, rc ) - return 1 - -def collectAttr( hwpBinDir, sbeObjDir, target, proc ): - cmd1 = ("."+hwpBinDir+"/p9_sbe_pibMemDump_wrap.exe " +\ - syms['G_sbe_attrs'][0] + " " + \ - syms['G_sbe_attrs'][1] + " " + target) - cmd2 = "mv dumpPibMem sbeAttr.bin" - cmd3 = ("."+ sbeObjDir + "/p9_xip_tool " +\ - sbeObjDir + "/sbe_seeprom.bin -ifs attrdump sbeAttr.bin > "+\ - "sbe_"+str(proc)+"_attrs") - print "\ncollecting attributes with commands -\n" - print "cmd1:", cmd1 - rc = os.system( cmd1 ) - if ( rc ): - print "ERROR running %s: %d " % ( cmd1, rc ) - return 1 - - print "cmd2:", cmd2 - rc = os.system( cmd2 ) - if ( rc ): - print "ERROR running %s: %d " % ( cmd2, rc ) - return 1 - - print "cmd3:", cmd3 - rc = os.system( cmd3 ) - if ( rc ): - print "ERROR running %s: %d " % ( cmd3, rc ) - return 1 - -def main( argv ): - parser = argparse.ArgumentParser( description = "SBE Dump Parser" ) - - parser.add_argument( '-hwpBinDir', type=str, default = os.getcwd(), \ - help = 'Path of p9_sbe_pibMemDump_wrap.exe') - parser.add_argument( '-sbeObjDir', type=str, default = os.getcwd(), \ - help = 'Path of sbe.syms file') - parser.add_argument( '-l', '--level', choices = ['all', 'trace', 'attr'],\ - default='all', help = 'Parser level' ) - parser.add_argument( '-t', '--target', choices = ['AWAN', 'HW'], \ - required = 'true', help = 'Target type' ) - parser.add_argument( '-p', '--proc', type=int , default = 0, \ - help = 'Proc Number' ) - - args = parser.parse_args() - - if ( args.target == 'AWAN' ): - target = "1" - elif ( args.target == 'HW' ): - target = "0" - - fillSymTable(args.sbeObjDir) - if ( args.level == 'all' ): - print "Parsing everything" - collectTrace( args.hwpBinDir, args.sbeObjDir, target, args.proc ) - collectAttr( args.hwpBinDir, args.sbeObjDir, target, args.proc ) - elif ( args.level == 'trace' ): - collectTrace( args.hwpBinDir, args.sbeObjDir, target, args.proc ) - elif ( args.level == 'attr' ): - collectAttr( args.hwpBinDir, args.sbeObjDir, target, args.proc ) - -if __name__ == "__main__": - main( sys.argv ) diff --git a/src/tools/debug/simics-debug-framework.py b/src/tools/debug/simics-debug-framework.py new file mode 100755 index 00000000..d15212ea --- /dev/null +++ b/src/tools/debug/simics-debug-framework.py @@ -0,0 +1,88 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/tools/debug/simics-debug-framework.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 os +import os.path +import subprocess +import re +import random +import sys +import imp +testIstepAuto = imp.load_source("testIstepAuto", os.environ['SBE_TOOLS_PATH'] + "/testIstepAuto.py") +err = False + +syms = {}; + +def check_sbe_tools_path (): + global SBE_TOOLS_PATH + SBE_TOOLS_PATH = os.environ['SBE_TOOLS_PATH']; + +def register_sbe_debug_framework_tools(): + check_sbe_tools_path () + fillSymTable() + # Create command hook. + new_command("sbe-istep",testIstepAuto.sbe_istep_func, + args = [arg(int_t, "major"), arg(int_t, "minor")], + alias = "istep", + type = ["sbe-commands"], + short = "Runs the debug framework for istep ", + doc = "") + new_command("sbe-trace", collectTrace, + args = [arg(int_t, "procNr")], + alias = "strace", + type = ["sbe-commands"], + short = "Runs the debug framework for trace ", + doc = "") + print "SBE Debug Framework: Registered tool:", "sbe-istep" + print "SBE Debug Framework: Registered tool:", "sbe-trace" + + +def fillSymTable(): +# symFile = os.environ['SBE_IMG_OUT_LOC'] + "/sbe.syms" + symFile = SBE_TOOLS_PATH + "/sbe.syms" +# symFile = os.environ['sb'] + "/../obj/ppc/sbei/sbfw/simics/sbe.syms" + f = open( symFile, 'r') + for line in f: + words = line.split() + if( len( words ) == 4 ): + syms[words[3]] = [words[0], words[1]] + +def collectTrace ( procNr ): + fileName = "sbe_" + `procNr` + "_tracMERG" + cmd1 = "pipe \"p9Proc" + `procNr` + ".sbe.mibo_space.x 0x" + syms['g_pk_trace_buf'][0] + " 0x2028\" \"sed 's/^p:0x........ //g' | sed 's/ ................$//g' | sed 's/ //g' | xxd -r -p> ppetrace.bin\"" + cmd2 = "shell \"" + SBE_TOOLS_PATH + "/ppe2fsp ppetrace.bin sbetrace.bin \"" + cmd3 = "shell \"" + SBE_TOOLS_PATH + "/fsp-trace -s " + SBE_TOOLS_PATH + "/sbeStringFile sbetrace.bin >" + fileName + "\"" + cmd4 = "shell \"" + "cat " + fileName + "\"" + + ( rc, out ) = quiet_run_command( cmd1, output_modes.regular ) + if ( rc ): + print "simics ERROR running %s: %d "%( cmd1, rc ) + + SIM_run_alone( run_command, cmd2 ) + SIM_run_alone( run_command, cmd3 ) + SIM_run_alone( run_command, cmd4 ) + + +# Run the registration automatically whenever this script is loaded. +register_sbe_debug_framework_tools() + diff --git a/src/tools/debug/simics/sbe_standalone.simics b/src/tools/debug/simics/sbe_standalone.simics deleted file mode 100755 index 8fd3bdb0..00000000 --- a/src/tools/debug/simics/sbe_standalone.simics +++ /dev/null @@ -1,2 +0,0 @@ -echo "SBE standalone Tools" - diff --git a/src/tools/debug/simics/simics-debug-framework.py b/src/tools/debug/simics/simics-debug-framework.py deleted file mode 100755 index 87d3656b..00000000 --- a/src/tools/debug/simics/simics-debug-framework.py +++ /dev/null @@ -1,88 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/tools/debug/simics/simics-debug-framework.py $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 os -import os.path -import subprocess -import re -import random -import sys -import imp -testIstepAuto = imp.load_source("testIstepAuto", os.environ['SBE_TOOLS_PATH'] + "/testIstepAuto.py") -err = False - -syms = {}; - -def check_sbe_tools_path (): - global SBE_TOOLS_PATH - SBE_TOOLS_PATH = os.environ['SBE_TOOLS_PATH']; - -def register_sbe_debug_framework_tools(): - check_sbe_tools_path () - fillSymTable() - # Create command hook. - new_command("sbe-istep",testIstepAuto.sbe_istep_func, - args = [arg(int_t, "major"), arg(int_t, "minor")], - alias = "istep", - type = ["sbe-commands"], - short = "Runs the debug framework for istep ", - doc = "") - new_command("sbe-trace", collectTrace, - args = [arg(int_t, "procNr")], - alias = "strace", - type = ["sbe-commands"], - short = "Runs the debug framework for trace ", - doc = "") - print "SBE Debug Framework: Registered tool:", "sbe-istep" - print "SBE Debug Framework: Registered tool:", "sbe-trace" - - -def fillSymTable(): -# symFile = os.environ['SBE_IMG_OUT_LOC'] + "/sbe.syms" - symFile = SBE_TOOLS_PATH + "/sbe.syms" -# symFile = os.environ['sb'] + "/../obj/ppc/sbei/sbfw/simics/sbe.syms" - f = open( symFile, 'r') - for line in f: - words = line.split() - if( len( words ) == 4 ): - syms[words[3]] = [words[0], words[1]] - -def collectTrace ( procNr ): - fileName = "sbe_" + `procNr` + "_tracMERG" - cmd1 = "pipe \"p9Proc" + `procNr` + ".sbe.mibo_space.x 0x" + syms['g_pk_trace_buf'][0] + " 0x2028\" \"sed 's/^p:0x........ //g' | sed 's/ ................$//g' | sed 's/ //g' | xxd -r -p> ppetrace.bin\"" - cmd2 = "shell \"" + SBE_TOOLS_PATH + "/ppe2fsp ppetrace.bin sbetrace.bin \"" - cmd3 = "shell \"" + SBE_TOOLS_PATH + "/fsp-trace -s " + SBE_TOOLS_PATH + "/sbeStringFile sbetrace.bin >" + fileName + "\"" - cmd4 = "shell \"" + "cat " + fileName + "\"" - - ( rc, out ) = quiet_run_command( cmd1, output_modes.regular ) - if ( rc ): - print "simics ERROR running %s: %d "%( cmd1, rc ) - - SIM_run_alone( run_command, cmd2 ) - SIM_run_alone( run_command, cmd3 ) - SIM_run_alone( run_command, cmd4 ) - - -# Run the registration automatically whenever this script is loaded. -register_sbe_debug_framework_tools() - diff --git a/src/tools/image/Makefile b/src/tools/image/Makefile index fab89e66..58650875 100644 --- a/src/tools/image/Makefile +++ b/src/tools/image/Makefile @@ -6,6 +6,7 @@ # OpenPOWER sbe Project # # Contributors Listed Below - COPYRIGHT 2015,2016 +# [+] International Business Machines Corp. # # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -59,28 +60,23 @@ else CXX = g++ endif -UTILITIES-SOURCES = sbe_default_tool.c -UTILITIES = sbe_default_tool - -# Utility targets -UTILITIES-OBJc = $(patsubst %.c,$(BASE_OBJDIR)/%.o,$(UTILITIES-SOURCES)) -UTILITIES-OBJECTS += $(patsubst %.C,$(BASE_OBJDIR)/%.o,$(UTILITIES-OBJc)) -UTILITIES-DEPENDENCIES = $(patsubst %.o,%.d,$(UTILITIES-OBJECTS)) -UTILITIES-EXECUTABLES = $(patsubst %,$(BASE_OBJDIR)/%,$(UTILITIES)) - .PHONY : all utilities clean -all: utilities +all:objdir utilities + +objdir: + mkdir -p $(BASE_OBJDIR)/tools/image -utilities: $(UTILITIES-EXECUTABLES) +utilities: $(IMG_DIR)/sbe_default_tool CXXFLAGS+=-DFAPI2_NO_FFDC -$(BASE_OBJDIR)/%.o: %.c +$(BASE_OBJDIR)/tools/image/%.o: %.c $(CXX) -std=c++11 $(INCLUDES) $(CXXFLAGS) -c -o $@ $< -$(BASE_OBJDIR)/sbe_default_tool: $(P9_XIP_BINDIR)/p9_xip_image.o $(BASE_OBJDIR)/sbe_default_tool.o +$(IMG_DIR)/sbe_default_tool: $(P9_XIP_BINDIR)/p9_xip_image.o $(BASE_OBJDIR)/tools/image/sbe_default_tool.o $(CXX) $(CXXFLAGS) ${INCLUDES} -o $@ $^ clean: - rm -f $(BASE_OBJDIR)/sbe_default_tool* + rm -f $(BASE_OBJDIR)/tools/image/sbe_default_tool* + rm -f $(IMG_DIR)/sbe_default_tool* diff --git a/src/tools/ppetracepp/Makefile b/src/tools/ppetracepp/Makefile deleted file mode 100644 index eec6da6a..00000000 --- a/src/tools/ppetracepp/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/tools/ppetracepp/Makefile $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2015,2016 -# -# -# 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 -include img_defs.mk - -all: ppetracepp ppe2fsp - -ppetracepp: ppetracepp.C - g++ -m32 -O3 -w -g -I./ ppetracepp.C -o $(PPETRACEPP_BIN_DIR)/ppetracepp -# g++ -O3 -w -x c++ -fPIC -g -I./ ppetracepp.C -o ppetracepp - -ppe2fsp: ppe2fsp.c ppe2fsp_cmd.c - gcc -m32 -w -g -I./ -I$(PK_SRCDIR)/trace ppe2fsp.c ppe2fsp_cmd.c -o $(PPETRACEPP_BIN_DIR)/ppe2fsp - -clean: - rm $(PPETRACEPP_BIN_DIR)/ppetracepp $(PPETRACEPP_BIN_DIR)/ppe2fsp - diff --git a/src/tools/ppetracepp/cmvc/makefile b/src/tools/ppetracepp/cmvc/makefile deleted file mode 100644 index cf2ad437..00000000 --- a/src/tools/ppetracepp/cmvc/makefile +++ /dev/null @@ -1,28 +0,0 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/tools/ppetracepp/cmvc/makefile $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 -PROGRAMS += ppe2fsp -ppe2fsp_OFILES = ppe2fsp.o ppe2fsp_cmd.o - -.include <${RULES_MK}> - diff --git a/src/tools/ppetracepp/jhash.h b/src/tools/ppetracepp/jhash.h deleted file mode 100755 index 0dcc3bf3..00000000 --- a/src/tools/ppetracepp/jhash.h +++ /dev/null @@ -1,166 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/tools/ppetracepp/jhash.h $ */ -/* */ -/* OpenPOWER sbe Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ -/* */ -/* */ -/* 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 _LINUX_JHASH_H -#define _LINUX_JHASH_H - -/* jhash.h: Jenkins hash support. - * - * Copyright (C) 1996 Bob Jenkins (bob_jenkins@burtleburtle.net) - * - * http://burtleburtle.net/bob/hash/ - * - * These are the credits from Bob's sources: - * - * lookup2.c, by Bob Jenkins, December 1996, Public Domain. - * hash(), hash2(), hash3, and mix() are externally useful functions. - * Routines to test the hash are included if SELF_TEST is defined. - * You can use this free for any purpose. It has no warranty. - * - * Copyright (C) 2003 David S. Miller (davem@redhat.com) - * - * I've modified Bob's hash to be useful in the Linux kernel, and - * any bugs present are surely my fault. -DaveM - */ - -/* NOTE: Arguments are modified. */ -#define __jhash_mix(a, b, c) \ -{ \ - a -= b; a -= c; a ^= (c>>13); \ - b -= c; b -= a; b ^= (a<<8); \ - c -= a; c -= b; c ^= (b>>13); \ - a -= b; a -= c; a ^= (c>>12); \ - b -= c; b -= a; b ^= (a<<16); \ - c -= a; c -= b; c ^= (b>>5); \ - a -= b; a -= c; a ^= (c>>3); \ - b -= c; b -= a; b ^= (a<<10); \ - c -= a; c -= b; c ^= (b>>15); \ -} - -/* The golden ration: an arbitrary value */ -#define JHASH_GOLDEN_RATIO 0x9e3779b9 - -/* The most generic version, hashes an arbitrary sequence - * of bytes. No alignment or length assumptions are made about - * the input key. - */ -static inline u32 jhash(const void *key, u32 length, u32 initval) -{ - u32 a, b, c, len; - const u8 *k = (const u8*)key; - - len = length; - a = b = JHASH_GOLDEN_RATIO; - c = initval; - - while (len >= 12) { - a += (k[0] +((u32)k[1]<<8) +((u32)k[2]<<16) +((u32)k[3]<<24)); - b += (k[4] +((u32)k[5]<<8) +((u32)k[6]<<16) +((u32)k[7]<<24)); - c += (k[8] +((u32)k[9]<<8) +((u32)k[10]<<16)+((u32)k[11]<<24)); - - __jhash_mix(a,b,c); - - k += 12; - len -= 12; - } - - c += length; - switch (len) { - case 11: c += ((u32)k[10]<<24); - case 10: c += ((u32)k[9]<<16); - case 9 : c += ((u32)k[8]<<8); - case 8 : b += ((u32)k[7]<<24); - case 7 : b += ((u32)k[6]<<16); - case 6 : b += ((u32)k[5]<<8); - case 5 : b += k[4]; - case 4 : a += ((u32)k[3]<<24); - case 3 : a += ((u32)k[2]<<16); - case 2 : a += ((u32)k[1]<<8); - case 1 : a += k[0]; - }; - - __jhash_mix(a,b,c); - - return c; -} - -/* A special optimized version that handles 1 or more of u32s. - * The length parameter here is the number of u32s in the key. - */ -static inline u32 jhash2(const u32 *k, u32 length, u32 initval) -{ - u32 a, b, c, len; - - a = b = JHASH_GOLDEN_RATIO; - c = initval; - len = length; - - while (len >= 3) { - a += k[0]; - b += k[1]; - c += k[2]; - __jhash_mix(a, b, c); - k += 3; len -= 3; - } - - c += length * 4; - - switch (len) { - case 2 : b += k[1]; - case 1 : a += k[0]; - }; - - __jhash_mix(a,b,c); - - return c; -} - - -/* A special ultra-optimized versions that knows they are hashing exactly - * 3, 2 or 1 word(s). - * - * NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally - * done at the end is not done here. - */ -static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval) -{ - a += JHASH_GOLDEN_RATIO; - b += JHASH_GOLDEN_RATIO; - c += initval; - - __jhash_mix(a, b, c); - - return c; -} - -static inline u32 jhash_2words(u32 a, u32 b, u32 initval) -{ - return jhash_3words(a, b, 0, initval); -} - -static inline u32 jhash_1word(u32 a, u32 initval) -{ - return jhash_3words(a, 0, 0, initval); -} - -#endif /* _LINUX_JHASH_H */ diff --git a/src/tools/ppetracepp/ppe2fsp.c b/src/tools/ppetracepp/ppe2fsp.c deleted file mode 100755 index d681b147..00000000 --- a/src/tools/ppetracepp/ppe2fsp.c +++ /dev/null @@ -1,532 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/tools/ppetracepp/ppe2fsp.c $ */ -/* */ -/* OpenPOWER sbe Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2015,2016 */ -/* */ -/* */ -/* 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 */ -#include "pk_trace.h" -#include "ppe2fsp.h" -#include "trac_interface.h" -#include -#include -#include - -#define TRACE_BUF_VERSION 0x01 /*!< Trace buffer version */ -#define TRACE_FIELDTRACE 0x4654 /*!< Field Trace - "FT" */ -#define TRACE_FIELDBIN 0x4644 /*!< Binary Field Trace - "FD" */ - -#define TRAC_TIME_REAL 0 // upper 32 = seconds, lower 32 = nanoseconds -#define TRAC_TIME_50MHZ 1 -#define TRAC_TIME_200MHZ 2 -#define TRAC_TIME_167MHZ 3 // 166666667Hz - -typedef struct -{ - trace_entry_stamp_t stamp; - trace_entry_head_t head; - union - { - uint8_t data[PK_TRACE_MAX_BINARY + 1]; //add 1 byte for padding - uint32_t parms[PK_TRACE_MAX_PARMS]; - }; - uint32_t size; -}largest_fsp_entry_t; - -typedef struct -{ - union - { - uint8_t binary_data[PK_TRACE_MAX_BINARY + 1]; - struct - { - uint8_t rsvd[(PK_TRACE_MAX_BINARY + 1) - (PK_TRACE_MAX_PARMS * sizeof(uint32_t))]; - uint32_t parms[PK_TRACE_MAX_PARMS]; - }; - }; - PkTraceEntryFooter footer; -}LargestPpeEntry; - -//convert a ppe timestamp to an fsp trace timestamp -uint64_t ppe2fsp_time(uint64_t ppe_time, uint32_t hz) -{ - uint32_t seconds; - uint32_t remainder; - uint32_t nseconds; - - //convert from ppe ticks to seconds and nanoseconds - seconds = ppe_time / hz; - remainder = ppe_time - (((uint64_t)seconds) * hz); - nseconds = (((uint64_t)remainder) * 1000000000) / hz; - return (((uint64_t)seconds) << 32) | nseconds; -} - -//Writes an fsp trace entry to the fsp trace buffer -void fsp_put_entry(trace_buf_head_t* tb, largest_fsp_entry_t* fte, size_t entry_size, uint32_t bytes_left) -{ - char* buffer = ((char*)tb) + sizeof(trace_buf_head_t); - char* tb_start; - char* fte_start; - uint32_t copy_bytes; - - if(entry_size <= bytes_left) - { - tb_start = buffer + bytes_left - entry_size; - fte_start = (char*)fte; - copy_bytes = entry_size; - } - else - { - tb_start = buffer; - fte_start = ((char*)fte) + (entry_size - bytes_left); - copy_bytes = bytes_left; - } - - memcpy(tb_start, fte_start, copy_bytes); -} - - -//convert a ppe trace entry to an fsp trace entry -size_t pte2fte(PkTraceBuffer* ptb, - LargestPpeEntry* pte, - size_t pte_size, - largest_fsp_entry_t* fte, - uint64_t ppe_time64) -{ - size_t entry_size; - PkTraceGeneric* pte_footer = &pte->footer.generic; - uint32_t format; - uint32_t hash32; - uint32_t hash32_partial; - uint32_t* parm_start; - uint32_t parm_bytes; - uint64_t fsp_time64; - - //convert the ppe trace time to an fsp trace time - fsp_time64 = ppe2fsp_time(ppe_time64, ntohl(ptb->hz)); - - //fill in the 64 bit timestamp - fte->stamp.tbh = htonl((uint32_t)(fsp_time64 >> 32)); - fte->stamp.tbl = htonl((uint32_t)(fsp_time64 & 0x00000000ffffffffull)); - - //use the ppe instance id as the thread id. - fte->stamp.tid = htonl((uint32_t)ntohs(ptb->instance_id)); - - //merge the hash prefix and the string_id fields together for a 32 bit hash value - hash32 = ((uint32_t)ntohs(ptb->hash_prefix)) << 16; - hash32 |= pte_footer->string_id; - fte->head.hash = htonl(hash32); - - //generate the 32bit hash value for a partial trace entry in case it's needed - hash32_partial = ((uint32_t)ntohs(ptb->hash_prefix)) << 16; - hash32_partial |= ntohs(ptb->partial_trace_hash); - - //set the line number to 1 - fte->head.line = htonl(1); - - //determine the FSP trace format - format = PK_GET_TRACE_FORMAT(pte_footer->time_format.word32); - if(format == PK_TRACE_FORMAT_BINARY) - { - fte->head.tag = htons(TRACE_FIELDBIN); - } - else - { - fte->head.tag = htons(TRACE_FIELDTRACE); - } - - parm_start = (uint32_t*)(((char*)pte) + (sizeof(LargestPpeEntry) - pte_size)); - - //fill in the parameters/binary data and size at the end - switch(format) - { - - case PK_TRACE_FORMAT_TINY: - //one or 0 parameters - entry_size = sizeof(trace_entry_stamp_t) + - sizeof(trace_entry_head_t) + - sizeof(uint32_t); - fte->parms[0] = htonl((uint32_t)(pte_footer->parm16)); - fte->head.length = htons(sizeof(uint32_t)); - parm_bytes = 0; - break; - - case PK_TRACE_FORMAT_BIG: - //1 - 4 parameters - // - //If the trace entry data is incomplete (not all parm data - //had been written at the time the trace was captured) then - //we will write a trace to the fsp buffer that says - //"PARTIAL TRACE ENTRY. HASH_ID = %d" - if(pte_footer->complete) - { - parm_bytes = pte_footer->bytes_or_parms_count * sizeof(uint32_t); - fte->head.length = htons(parm_bytes + sizeof(uint32_t)); - entry_size = sizeof(trace_entry_stamp_t) + - sizeof(trace_entry_head_t) + - parm_bytes + sizeof(uint32_t); - } - else - { - parm_bytes = 0; - entry_size = sizeof(trace_entry_stamp_t) + - sizeof(trace_entry_head_t) + - sizeof(uint32_t); - fte->parms[0] = fte->head.hash; //already corrected for endianess - fte->head.hash = htonl(hash32_partial); - fte->head.length = htons(sizeof(uint32_t)); - } - break; - - case PK_TRACE_FORMAT_BINARY: - //If the trace entry data is incomplete (not all parm data - //had been written at the time the trace was captured) then - //we will write a trace to the fsp buffer that says - //"PARTIAL TRACE ENTRY. HASH_ID = %d" - if(pte_footer->complete) - { - parm_bytes = pte_footer->bytes_or_parms_count; - fte->head.length = htons((uint16_t)parm_bytes); - entry_size = sizeof(trace_entry_stamp_t) + - sizeof(trace_entry_head_t) + - parm_bytes; - - //pad to 4 byte boundary - entry_size = (entry_size + 3) & ~3; - } - else - { - parm_bytes = 0; - entry_size = sizeof(trace_entry_stamp_t) + - sizeof(trace_entry_head_t) + - sizeof(uint32_t); - fte->parms[0] = fte->head.hash; - fte->head.hash = htonl(hash32_partial); - fte->head.length = htons(sizeof(uint32_t)); - fte->head.tag = htons(TRACE_FIELDTRACE); - } - break; - - - default: - entry_size = 0; - parm_bytes = 0; - break; - } - - //copy parameter bytes to the fsp entry if necessary - if(parm_bytes) - { - memcpy(fte->data, parm_start, parm_bytes); - } - - //add the entry size to the end - if(entry_size) - { - uint32_t new_entry_size = entry_size + sizeof(uint32_t); - *((uint32_t*)(((char*)fte) + entry_size)) = htonl(new_entry_size); - entry_size = new_entry_size; - } - - return entry_size; -} - -//retrieve a ppe trace entry from a ppe trace buffer -size_t ppe_get_entry(PkTraceBuffer* tb, uint32_t offset, LargestPpeEntry* pte) -{ - uint32_t mask = ntohs(tb->size) - 1; - PkTraceEntryFooter* footer; - size_t entry_size; - size_t parm_size; - char* dest = (char*)pte; - uint32_t format; - uint32_t start_index; - uint32_t bytes_left; - uint32_t bytes_to_copy; - - //Find the footer in the circular buffer - footer = (PkTraceEntryFooter*)(&tb->cb[(offset - sizeof(PkTraceEntryFooter)) & mask]); - - //always correct endianess for the time and string id words - pte->footer.generic.time_format.word32 = ntohl(footer->generic.time_format.word32); - pte->footer.generic.string_id = ntohs(footer->generic.string_id); - - //only need to byte swap the parm16 value if this is a tiny format - pte->footer.generic.parm16 = footer->generic.parm16; - - //use footer data to determine the length of the binary data or parameters - format = PK_GET_TRACE_FORMAT(pte->footer.generic.time_format.word32); - switch(format) - { - case PK_TRACE_FORMAT_TINY: - pte->footer.generic.parm16 = ntohs(pte->footer.generic.parm16); - parm_size = 0; - entry_size = sizeof(PkTraceEntryFooter); - break; - - case PK_TRACE_FORMAT_BIG: - parm_size = pte->footer.generic.bytes_or_parms_count * sizeof(uint32_t); - entry_size = sizeof(PkTraceEntryFooter); - break; - - case PK_TRACE_FORMAT_BINARY: - parm_size = pte->footer.generic.bytes_or_parms_count; - entry_size = sizeof(PkTraceEntryFooter); - break; - - default: - entry_size = 0; - parm_size = 0; - break; - } - - //pad to 8 byte boundary - parm_size = (parm_size + 7) & ~0x00000007ul; - - //add the parameter size to the total entry size - entry_size += parm_size; - - //copy the entry from the circular buffer to pte - start_index = (offset - entry_size) & mask; - bytes_left = ntohs(tb->size) - start_index; - - //only copy up to the end of the circular buffer - if(parm_size < bytes_left) - { - bytes_to_copy = parm_size; - } - else - { - bytes_to_copy = bytes_left; - } - - dest += sizeof(LargestPpeEntry) - entry_size; - memcpy(dest, &tb->cb[start_index], bytes_to_copy); - - //now copy the rest of the data starting from the beginning of the - //circular buffer. - if(bytes_to_copy < parm_size) - { - memcpy(dest + bytes_to_copy, tb->cb, parm_size - bytes_to_copy); - } - - //return the size of the entry - return entry_size; -} - -//convert a ppe trace buffer to an fsp trace buffer -int ppe2fsp(void* in, size_t in_size, void* out, size_t* io_size) -{ - PkTraceBuffer* ptb = (PkTraceBuffer*)in; - trace_buf_head_t* ftb = (trace_buf_head_t*)out; - uint32_t ppe_bytes_left; - uint32_t fsp_bytes_left; - int rc = 0; - uint32_t ptb_offset; - uint64_t ppe_time64; - uint32_t fte_size, pte_size; - uint32_t fsp_te_count = 0; - uint32_t time_diff32, prev_time32, new_time32; - PkTraceGeneric* pte_footer; - largest_fsp_entry_t fte; - LargestPpeEntry pte; - uint64_t time_adj64; - - do - { - if(!ptb || !ftb || !io_size) - { - rc = P2F_NULL_POINTER; - break; - } - - if(ntohs(ptb->version) != PK_TRACE_VERSION) - { - rc = P2F_INVALID_VERSION; - break; - } - - //check that the input buffer is large enough to have a ppe trace buffer - if(in_size < (((uintptr_t)(&ptb->cb[0])) - (uintptr_t)(ptb))) - { - rc = P2F_INPUT_BUFFER_TOO_SMALL; - break; - } - - //initialize some locals - fsp_bytes_left = *io_size - sizeof(trace_buf_head_t); - ppe_bytes_left = ntohs(ptb->size); - ptb_offset = ntohl(ptb->state.offset); - if(htonl(1) == 1) - { - time_adj64 = ptb->time_adj64; - } - else - { - time_adj64 = ntohl((uint32_t)(ptb->time_adj64 >> 32)); - time_adj64 |= ((uint64_t)(ntohl((uint32_t)(ptb->time_adj64 & 0x00000000ffffffff)))) << 32; - } - - //make sure the ppe buffer size is a power of two - if((ppe_bytes_left - 1) & ppe_bytes_left) - { - //size is not a power of two - rc = P2F_INVALID_INPUT_SIZE; - break; - } - - //The ppe bytes field should always be a multiple of 8 - if(ptb_offset & 0x7) - { - rc = P2F_INVALID_PPE_OFFSET; - break; - } - - //make sure there is enough room for the fsp header - if(*io_size < sizeof(trace_buf_head_t)) - { - rc = P2F_OUTPUT_BUFFER_TOO_SMALL; - break; - } - - - //initialize the fsp header - ftb->ver = TRACE_BUF_VERSION; - ftb->hdr_len = sizeof(trace_buf_head_t); - ftb->time_flg = TRAC_TIME_REAL; - ftb->endian_flg = 'B'; //big endian - memcpy(ftb->comp, ptb->image_str, sizeof(ftb->comp)); - ftb->times_wrap = htonl(1); - ftb->size = htonl(sizeof(trace_buf_head_t) + sizeof(uint32_t)); - ftb->next_free = htonl(sizeof(trace_buf_head_t)); - ftb->extracted = htonl(0); - ftb->te_count = htonl(0); - - //find the latest timestamp so that we can work back from there - ppe_time64 = ((uint64_t)(ntohl(ptb->state.tbu32) & 0xefffffff)) << 32; - pte_size = ppe_get_entry(ptb, ptb_offset, &pte); - prev_time32 = PK_GET_TRACE_TIME(pte.footer.generic.time_format.word32); - ppe_time64 |= prev_time32; - - //process all of the input bytes one trace entry at a time - //from newest to oldest (backwards) until we run out of input bytes or - //we run out of output space. - while(1) - { - //check if we have enough data for a ppe footer - if(ppe_bytes_left < sizeof(PkTraceEntryFooter)) - { - break; - } - - //get the next ppe entry - pte_size = ppe_get_entry(ptb, ptb_offset, &pte); - - //Stop if there are no more entries to retrieve from the ppe trace buffer - if(!pte_size) - { - break; - } - pte_footer = &pte.footer.generic; - - //mark the entry as incomplete if we didn't have enough data - //for the entire entry - if(pte_size > ppe_bytes_left) - { - pte_footer->complete = 0; - ppe_bytes_left = 0; - } - else - { - ppe_bytes_left -= pte_size; - ptb_offset -= pte_size; - } - - //Calculate the 64 bit timestamp for this entry.... - //On PPE, getting the timestamp is not done atomically with writing - //the entry to the buffer. This means that an entry with an older - //timestamp could possibly be added to the buffer after an entry - //with a newer timestamp. Detect this condition by checking if the - //time difference is bigger than the max difference. The max - //difference is enforced by the PPE having a trace added on a - //shorter time boundary (using a timer). - new_time32 = PK_GET_TRACE_TIME(pte_footer->time_format.word32); - time_diff32 = prev_time32 - new_time32; - - if(time_diff32 > ntohl(ptb->max_time_change)) - { - time_diff32 = new_time32 - prev_time32; - ppe_time64 += time_diff32; - } - else - { - ppe_time64 -= time_diff32; - } - - //save off the lower 32bit timestamp for the next iteration - prev_time32 = new_time32; - - //convert the ppe trace entry to an fsp trace entry - fte_size = pte2fte(ptb, &pte, pte_size, &fte, ppe_time64 + time_adj64); - - //fit as much of the entry into the fsp trace buffer as possible - fsp_put_entry(ftb, &fte, fte_size, fsp_bytes_left); - - //update the fsp trace entry count - fsp_te_count++; - - //stop if there is no more room left in the fsp trace buffer - if(fte_size >= fsp_bytes_left) - { - fsp_bytes_left = 0; - ftb->times_wrap = htonl(1); - break; - } - else - { - fsp_bytes_left -= fte_size; - } - }//while(1) - - - //shift the trace data up if there is space to do so - if(fsp_bytes_left) - { - char* dest = ((char*)ftb) + sizeof(trace_buf_head_t); - char* src = dest + fsp_bytes_left; - size_t data_size = *io_size - sizeof(trace_buf_head_t) - fsp_bytes_left; - memmove(dest, src, data_size); - } - - //update the fsp header to reflect the true size and entry count - ftb->te_count = htonl(fsp_te_count); - - //inform the caller of how many bytes were actually used - *io_size -= fsp_bytes_left; - - //shrink the size field to what we actually ended up using - ftb->size = htonl(*io_size); - - }while(0); - - return rc; -} - - - diff --git a/src/tools/ppetracepp/ppe2fsp.h b/src/tools/ppetracepp/ppe2fsp.h deleted file mode 100644 index 2abb146c..00000000 --- a/src/tools/ppetracepp/ppe2fsp.h +++ /dev/null @@ -1,33 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/tools/ppetracepp/ppe2fsp.h $ */ -/* */ -/* OpenPOWER sbe Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2015,2016 */ -/* */ -/* */ -/* 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 */ -#include - -#define P2F_NULL_POINTER 1 -#define P2F_INVALID_INPUT_SIZE 2 -#define P2F_INVALID_PPE_OFFSET 3 -#define P2F_OUTPUT_BUFFER_TOO_SMALL 4 -#define P2F_INPUT_BUFFER_TOO_SMALL 5 -#define P2F_INVALID_VERSION 6 - -int ppe2fsp(void* in, size_t in_size, void* out, size_t* io_size); diff --git a/src/tools/ppetracepp/ppe2fsp_cmd.c b/src/tools/ppetracepp/ppe2fsp_cmd.c deleted file mode 100644 index c36d735c..00000000 --- a/src/tools/ppetracepp/ppe2fsp_cmd.c +++ /dev/null @@ -1,138 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/tools/ppetracepp/ppe2fsp_cmd.c $ */ -/* */ -/* OpenPOWER sbe Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ -/* */ -/* */ -/* 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 */ -#include -#include "ppe2fsp.h" -#include "pk_trace.h" - -#define MAX_INPUT_SIZE 0x2040 //8k -#define MAX_OUTPUT_SIZE (4 * MAX_INPUT_SIZE) - -char* inbuf[MAX_INPUT_SIZE]; -char* outbuf[MAX_OUTPUT_SIZE]; -; -int main(int argc, char** argv) -{ - FILE* in; - FILE* out; - size_t input_size; - size_t output_size; - size_t bytes_written; - int rc = -1; - - do - { - if(argc > 3) - { - fprintf(stderr, "Usage: %s [input file] [output file]\n", argv[0]); - } - - if(argc < 3) - { - out = stdout; - } - else - { - //open the output file for writing - out = fopen(argv[2], "w"); - if(!out) - { - perror("failed to open file for writing"); - break; - } - } - - if(argc < 2) - { - in = stdin; - } - else - { - //open the input file for reading - in = fopen(argv[1], "r"); - if(!in) - { - perror("failed to open file for reading"); - break; - } - } - - //read the input stream until we reach EOF or the max size - input_size = fread(inbuf, 1, MAX_INPUT_SIZE, in); - if(!feof(in)) - { - if(ferror(in)) - { - perror("failed to read input file"); - break; - } - else - { - fprintf(stderr, "Input stream exceeds max size of %d bytes. Exiting.\n", MAX_INPUT_SIZE); - break; - } - } - - output_size = MAX_OUTPUT_SIZE; - - //Actual size of output buffer will be set upon successful completion - rc = ppe2fsp(inbuf, input_size, outbuf, &output_size); - if(rc) - { - fprintf(stderr, "Failed converting ppe trace to fsp trace. rc = %d\n", rc); - if(rc == P2F_INVALID_VERSION) - { - fprintf(stderr, "PPE trace buffer must be version %d.\n", PK_TRACE_VERSION); - } - break; - } - - rc = -1; - //operation was successful. Write out the fsp trace data - bytes_written = fwrite(outbuf, 1, output_size, out); - if(bytes_written != output_size) - { - if(ferror(out)) - { - perror("Failed to write output stream"); - break; - } - fprintf(stderr, "Failure: Only able to write %d of %d bytes to output stream\n", bytes_written, output_size); - break; - } - - fclose(in); - fclose(out); - fclose(stderr); - - rc = 0; - }while(0); - - return rc; -} - - - - - - diff --git a/src/tools/ppetracepp/ppetracepp.C b/src/tools/ppetracepp/ppetracepp.C deleted file mode 100755 index 2829e4dd..00000000 --- a/src/tools/ppetracepp/ppetracepp.C +++ /dev/null @@ -1,949 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/tools/ppetracepp/ppetracepp.C $ */ -/* */ -/* OpenPOWER sbe Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2015,2016 */ -/* */ -/* */ -/* 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 */ - -/* -# *** ppetracepp - a fsp/common Linux trace pre processor -# this one replaces the trace strings by the corresponding hash value -# (i.e. the complete call to trace_ppe_hash is replaced) - -# *** Usage -# -# prepend compiler call with the call of this pre processor, i.e if you have -# $(CC) $(CFLAGS) -o $@ $< -# in your Makefile change it to this: -# ppetracepp $(CC) $(CFLAGS) -o $@ $< -# ppetracepp will use "$(CC) -E" to call the C pre processor "cpp". -# you can set a env var "REALCPP" to the name of a program to select -# a different programm as cpp -# -# ppetracepp creates a file "$target.ppe.hash" with the trace strings and the hash values. -# -# to enable debug mode set envvar PPETRACEPPDEBUG to 1 or give '-d' as first arg - -# *** Change History -# -# 2003-02-26 RBa created from scratch -# 2003-02-28 RBa add C++ support (C++ interface uses own type for the hash) -# 2003-05-28 RBa if cc should link instead of compile just call compiler -# 2003-07-11 AGe Change search alg. slightly and put just format back -# 2003-07-25 RBa just call gcc if called to link instead to compile -# eat argument for option -x -# 2003-11-26 RBa fix c/c++ algo: compile as c++ if realcc=*g++ -# 2004-02-02 RBa remove explicit test whether source file is readable -# it is obsolete and might lead to an error if afs is used -# 2004-02-13 RBa add support for dependency generation (-MD/-MG, -MF) -# don't prepend './' to object filename -# 2006-04-19 RBa rewrite trace_ppe_write_all support, handle C and C++ the same -# 2006-05-24 RBa fix handling of missing -o ; add TRAC_PPVER for macro/API version -# 2006-09-15 RBa add handling of \" in trace format strings ; reduce non-error output -# put object file in current dir if no -o given -# 2007-03-22 RBa handle more gcc options (-i) ; protect " in call to shell -# store output of cpp as "unmodified" output for debug -# only write string/hash file if strings found -# 2012-09-24 hlava Rewritten as C program for better build performance (was perl) -*/ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -typedef u_int32_t u32 ; -typedef u_int8_t u8 ; -#include - -using namespace std; - -static string version = "2.0"; -static string macro_version = "1"; - -static bool debug = false; -#define dprintf(format, ...) if (debug) { printf(format, ##__VA_ARGS__); fflush(stdout); } -static map hashtab; -static string hashtype; -static string hashtype_suffix; - -static string tmp; -static string cmd; -static FILE* CPP = NULL; // pipe from preprocessor -static FILE* CC = NULL; // pipe to compiler -static FILE* DEBUG = NULL; -static FILE* DEBUGIN = NULL; - -//***************************************************************************** -// replace_substr -//***************************************************************************** -void replace_substr(std::string& str, const std::string& oldStr, const std::string& newStr) -{ - size_t pos = 0; - while((pos = str.find(oldStr, pos)) != std::string::npos) - { - str.replace(pos, oldStr.length(), newStr); - pos += newStr.length(); - } - -} - -//***************************************************************************** -// fileparse -//***************************************************************************** -void fileparse(const string& in_str, string& name, string& dir, string& suff) -{ - string str(in_str); - size_t pos; - name = ""; - dir = ""; - suff = ""; - pos = str.find_last_of('.'); - if (pos != string::npos) - { - suff = str.substr(pos); - str = str.substr(0, pos); - } - pos = str.find_last_of('/'); - if (pos != string::npos) - { - name = str.substr(pos+1); - str = str.substr(0, pos+1); - } - dir = str; -} - -static const size_t TRACE_PPE_HASH_LEN = 13; -//***************************************************************************** -// chop_up_line -//***************************************************************************** -bool chop_up_line(string& in_line, string& prefix, string& strings, string& salt, string& suffix) -{ - // First see if this line matches the pattern we're looking for - // Since this will return false 95%+ of the time this function it called, we do it - // before doing any other init for performance reasons. - size_t pos = in_line.find("trace_ppe_hash"); - if (pos == string::npos) { return(false); } - - // trace_ppe_hash ( "..." ".." "..." , 2 ) - // regex: PREFIX 'trace_ppe_hash' space '(' space STRINGS space ',' space NUMBER space ')' SUFFIX - // STRINGS: '"' .* '"' space? + - - // Original perl magic incantation: - // while($line =~ m/^(.*?)trace_ppe_hash\s*\(\s*((".*?(? $1 = everything up to the word "trace_ppe_hash" - // trace_ppe_hash = delimiter - // \s*\(\s* = delimiter = <0-n whitespace chars>, left paren, <0-n whitespace chars> - // ((".*?(? $2 = double-quote, some chars up to last closing double-quote ($3 used for nested regex) - // ,\s* = delimiter = comma followed by some whitespace - // (-?\d+)\s*\)(.*) => $4 and $5 - // $/) = end of the line input string - string line(in_line); - prefix = ""; - strings = ""; - salt = ""; - suffix = ""; - size_t pos1; - size_t pos2; - size_t pos3; - - pos1 = pos + 14; // pos1 = after "trace_ppe_hash" - pos2 = line.find("(", pos1); - if (pos2 == string::npos) { return(false); } - ++pos2; - pos3 = line.find("\"", pos2); - if (pos3 == string::npos) { return(false); } - dprintf("--------\nchop_up_line: Passed basic checks. line= %s\n", line.c_str()); - dprintf("pos1=%d, pos2=%d, pos3=%d\n", pos1, pos2, pos3); - if ((pos1 != (pos2-1)) && (line.find_first_not_of(" \t", pos1, (pos2-pos1)+1) != string::npos)) { return(false); } //non-whitespace? - if ((pos2 != pos3) && (line.find_first_not_of(" \t", pos2, (pos3-pos2)) != string::npos)) { return(false); } //non-whitespace? - - // Get the prefix data - dprintf(">chop_up_line(\"%s\",...)\n", line.c_str()); - prefix = line.substr(0, pos); - line = line.substr(pos + TRACE_PPE_HASH_LEN); - dprintf(" prefix=\"%s\"\n", prefix.c_str()); - - // Get the strings and join/fix them: Store all strings between paired double-quotes up to the - // first comma not inside a string - pos = line.find_first_of('('); - if (pos == string::npos) { return(false); } - line = line.substr(pos + 1); - strings = ""; - while(!line.empty()) - { - pos = line.find_first_of(','); - pos1 = line.find_first_of('"'); - if ((pos1 == string::npos) || ((pos != string::npos) && (pos < pos1))) { break; } // found comma before next quote - pos2 = line.find_first_of('"', (pos1+1)); - if (pos2 == string::npos) { return(false); } // unbalanced quotes! - while(line[pos2-1] == '\\') // skip escaped quotes in the string (they're not the ending quote) - { - pos2 = line.find_first_of('"', (pos2+1)); - if (pos2 == string::npos) { return(false); } // unbalanced quotes! - } - if (!strings.empty()) { strings += " "; } - strings += line.substr(pos1, (pos2-pos1)+1); - line = line.substr(pos2+1); - } - replace_substr(strings, "\" \"", ""); - replace_substr(strings, "\\\"", "ESCAPEDQUOTE"); - replace_substr(strings, "\"", ""); - replace_substr(strings, "ESCAPEDQUOTE", "\""); - // Remove trailing whitespace ah20130717 - pos = strings.find_last_not_of(" \t\n"); - if ((pos != string::npos) && (pos < (strings.length()-1))) - { - strings = strings.substr(0, pos+1); - } - - dprintf(" strings>%s<\n", strings.c_str()); - - // Get the salt - pos = line.find(","); - if (pos != string::npos) { line = line.substr(pos+1); } - pos = line.find_first_of(')'); - if (pos == string::npos) { return(false); } - salt = line.substr(0, pos); - line = line.substr(pos+1); - //dprintf(" salt=\"%s\"\n", salt.c_str()); - pos = salt.find_first_not_of(" \t\n"); - if (pos == string::npos) { return(false); } - salt = salt.substr(pos); - pos = salt.find_last_not_of(" \t\n"); - if (pos == string::npos) { return(false); } - salt = salt.substr(0, pos+1); - dprintf(" salt=\"%s\"\n", salt.c_str()); - - // Get the suffix (i.e. the rest) - suffix = line; - if (suffix[suffix.length()-1] == '\n') { suffix = suffix.substr(0, suffix.length()-1); } - dprintf(" suffix=\"%s\"\nget_hash(\"%s\",%d)\n", str.c_str(), salt_num); - - // Call jhash function to get the hash value - hash_num = jhash((void*)str.c_str(), str.length(), salt_num); - dprintf("jhash() returned: %u\n", hash_num); - sprintf(buf, "%u", hash_num & 0x0000ffff); - hash16 = buf; - sprintf(buf, "%u", ((salt_num << 16) | (hash_num & 0x0000ffff))); - hash32 = buf; - - // validate the hash value - size_t pos = hash32.find_first_not_of("0123456789"); - if (pos != string::npos) - { - fprintf(stderr, "trexhash error: %s\n", hash32.c_str()); - fprintf(stderr, "for call <<%s>>\n", cmd.c_str()); - exit(1); - } - -//removing this since it doesn't seem to have any affect on the output -#if 0 - // If hash is empty, use the sum of the ord values in the original string - if ((hash == "")||(hash == "0")) - { - unsigned int len = str.length(); - unsigned int hash_num = 0; - //unsigned char conv_buf[2] = { '\0', '\0' }; - u_int8_t conv_num; - for (unsigned int i=0; i < len; ++i) - { - //conv_buf[0] = str[i]; - conv_num = (u_int8_t)str[i]; - hash_num += (unsigned int)conv_num; - } - } -#endif - - dprintf("& rhash, string& line, string& out_line) -{ - // NOTE: "line" arg may get modified by this function! Caller must not assume it's unchanged. - string format; - string prefix; - string strings; - string tmp; - string salt; - string hash16; - string hash32; - int salt_num; - int format_salt; - string suffix; - string write_all_suffix; - size_t pos; - - out_line = ""; - // trace_ppe_hash ( "..." ".." "..." , 2 ) - // regex: PREFIX 'trace_ppe_hash' space '(' space STRINGS space ',' space NUMBER space ')' SUFFIX - // STRINGS: '"' .* '"' space? + - //while($line =~ m/^(.*?)trace_ppe_hash\s*\(\s*((".*?(? 1) arg = argv[1]; - if ((argc < 2) || (arg == "-h")) - { - fprintf(stderr, "usage: %s realcompiler compileroptions -o target source\n", argv[0]); - exit(9); - } - string realcc(argv[argi++]); - string cctype("c++"); - bool optx_found = false; - - if (realcc == "-d") - { - debug = true; - realcc = argv[argi++]; - } - - // wait until -d options is handled before checking $debug - dprintf("ppetracepp version %s - API/macro version %s\n", version.c_str(), macro_version.c_str()); - - p_env = getenv("REALCPP"); - string realcpp; - if (p_env) - realcpp = p_env; - if (realcpp.empty()) - { - dprintf("cannot find cpp, using -E\n"); - realcpp = realcc; - realcpp += " -E"; - } - dprintf("realcpp is %s\n", realcpp.c_str()); - -//------------------------------------------------------------------------------ -// parse all the arguments -//------------------------------------------------------------------------------ -string source; -string object; -vector ccopts; -vector cppopts; -bool dodeps = false; -string depfile; -string pfx; -string sfx; -int origargi = argi; -for( ; argi < argc; ++argi) -{ - arg = argv[argi]; - dprintf("Processing argv[%d]: \"%s\"\n", argi, arg.c_str()); - if (arg.length() > 2) - { - pfx = arg.substr(0,2); - sfx = arg.substr(arg.length()-2); - } - else - { - pfx = arg; - sfx = arg; - } - dprintf(" pfx: \"%s\" sfx: \"%s\"\n", pfx.c_str(), sfx.c_str()); - - if (pfx == "-o") - { - if (! object.empty()) - { - fprintf(stderr, "two -o options, aborting\n"); - exit(1); - } - if (arg.length() > 2) - { - object = sfx; - } - else - { - object = argv[++argi]; - } - dprintf("object is now %s\n", object.c_str()); - } - else if (arg == "-c") - { - // don't call cpp with -c, this is for the compiler - ccopts.push_back(arg); - dprintf("found -c option\n"); - } - else if (pfx == "-l") - { - // cpp doesn't need library arguments - cppopts.push_back(arg); - } - else if (pfx == "-i") - { - // option takes an argument, handle it too - optarg = argv[argi++]; - ccopts.push_back(arg); - ccopts.push_back(optarg); - cppopts.push_back(arg); - cppopts.push_back(optarg); - dprintf("found option '%s %s'\n", arg.c_str(), optarg.c_str()); - } - else if ((arg == "-L") || - (arg == "-I") || - (arg == "-x") || - (arg == "-b") || - (arg == "-B") || - (arg == "-V") || - (arg == "-D") || - (arg == "--param") || - (arg == "-MQ") || - (arg == "-MT")) - { - // option takes an argument, handle it too - optarg = argv[argi++]; - ccopts.push_back(arg); - ccopts.push_back(optarg); - cppopts.push_back(arg); - cppopts.push_back(optarg); - dprintf("found option '%s %s'\n", arg.c_str(), optarg.c_str()); - if (arg == "-x") - { - // option x sets the language - c or c++ - if ((optarg != "c") && (optarg != "c++") && (optarg != "assembler-with-cpp")) - { - fprintf(stderr, "cannot process language '%s', aborting\n", optarg.c_str()); - exit(1); - } - cctype = optarg; - optx_found = true; - } - } - else if ((arg == "-MD")||(arg == "-MG")) - { - // gen deps - dodeps = true; - dprintf("found %s, creating dependencies\n", arg.c_str()); - } - else if (arg == "-MF") - { - // set dependencies file - depfile = argv[argi++]; - dprintf("set dependencies file to '%s'\n", depfile.c_str()); - } - else if (arg[0] == '-') - { - // arg starts with - so it's an option - ccopts.push_back(arg); - cppopts.push_back(arg); - dprintf("found option '%s'\n", arg.c_str()); - } - else if ((sfx == ".a") || - (sfx == ".o")) - { - // an object or archive, ignore this but give it to cc - ccopts.push_back(arg); - dprintf("found object/archive '%s'\n", arg.c_str()); - } - else if ((sfx == ".c") || - (sfx == ".C") || - (sfx == ".S") || - (arg.substr(arg.length()-4) == ".cpp") || - (arg.substr(arg.length()-4) == ".cxx")) - { - // the source file(s). we should only get one - if (!source.empty()) - { - fprintf(stderr, "don't know to handle two source files, aborting\n"); - exit(1); - } - source = arg; - // put the - (for read-from-stdin) where the source file was - // (order is important!) - ccopts.push_back("-"); - dprintf("found source file %s\n", source.c_str()); - } - else if (access(arg.c_str(), F_OK)) - { - // option but not a file, an unknown option? - ccopts.push_back(arg); - cppopts.push_back(arg); - dprintf("found unknown option '%s'\n", arg.c_str()); - } -} - -//------------------------------------------------------------------------------ -// set other parameters based on arguments specified -//------------------------------------------------------------------------------ -if (source.empty()) -{ - // this might be a call to link a program instead of compile a source (or asm source) - dprintf("NOTME: starting as cc '%s ...'\n", realcc.c_str()); - execvp(realcc.c_str(), &(argv[origargi])); - fprintf(stderr, "ERROR: returned from execvp() call to run %s\n", realcc.c_str()); -} -if (object.empty()) -{ - dprintf("no object file given, default to source name\n"); - // gcc builds object name from source name if no -o given, replacing - // suffix with .o. The file is placed in the current directory, - // not in the source directory! - string n; - string d; - string s; - fileparse(source, n, d, s); - if (!n.empty() && !s.empty()) - { - object = n + ".o"; - dprintf("tracpp: guessing object name %s\n", object.c_str()); - dprintf(" from source name %s\n", source.c_str()); - } - else - { - fprintf(stderr, "Unable to determine Source File Name\n"); - exit(1);; - } -} - -// set value of trace hash according to language -// check source file extension if no explicit -x option given -if (!optx_found) -{ - if (realcc.find("g++") != string::npos) - { - dprintf("compiler language: C++ (from compiler name)\n"); - cctype = "c++"; - } - else - { - if (source.substr(source.length()-2) == ".c") - { - dprintf("compiler language: C (from source file extension)\n"); - cctype = "c"; - } - else if (source.substr(source.length()-2) == ".S") - { - dprintf("compiler language: assembly (from source file extension)\n"); - cctype = "assembler-with-cpp"; - } - else - { - dprintf("compiler language: C++ (default)\n"); - cctype = "c++"; - } - } -} -else -{ - dprintf("compiler language: %s (from option '-x')\n", cctype.c_str()); -} - -if (cctype == "c") -{ - hashtype = "(unsigned short)"; - hashtype_suffix = "U"; -} -else if (cctype == "assembler-with-cpp") -{ - hashtype = ""; - hashtype_suffix = ""; -} -else -{ - hashtype = "(trace_hash_val)"; - hashtype_suffix = "U"; -} -// define TRAC_PPETRACEPP for macros -tmp = "-DTRAC_PPETRACEPP -DTRAC_PPVER="; -tmp += macro_version; -cppopts.push_back(tmp); -if (dodeps) -{ - if (depfile.empty()) - { - if ((p_env = getenv("DEPENDENCIES_OUTPUT")) != NULL) - { - depfile = p_env; - } - else if ((p_env = getenv("SUNPRO_DEPENDENCIES")) != NULL) - { - depfile = p_env; - } - else - { - depfile = object; - if (depfile.substr(depfile.length()-2) == ".o") - { - depfile = depfile.substr(0, depfile.length()-2); - depfile += ".d"; - } - } - } - tmp = "-MD -MF "; - tmp += depfile; - cppopts.push_back(tmp); -} - -//------------------------------------------------------------------------------ -// start cpp -//------------------------------------------------------------------------------ -cmd = realcpp; -for(vector::iterator p = cppopts.begin(); p != cppopts.end(); ++p) -{ - cmd += " "; - cmd += *p; -} -cmd += " "; -cmd += source; -cmd += " -o-"; -dprintf("starting as cpp '%s'\n", cmd.c_str()); -CPP = popen(cmd.c_str(), "r"); -if (CPP == NULL) -{ - fprintf(stderr, "cannot start cpp '%s'\n", realcpp.c_str()); - perror(""); - exit(1); -} - -//------------------------------------------------------------------------------ -// start cc. manually set language as source file extension not available to cc -//------------------------------------------------------------------------------ -string type_str = ""; -if (!optx_found) -{ - // no option -x given by caller, set manually - type_str = "-x "; - type_str += cctype; -} -cmd = realcc; -cmd += " "; -cmd += type_str; -for(vector::iterator p = ccopts.begin(); p != ccopts.end(); ++p) -{ - cmd += " "; - cmd += *p; -} -cmd += " -o "; -cmd += object; -dprintf("starting as cc '%s'\n", cmd.c_str()); -CC = popen(cmd.c_str(), "w"); -if (CC == NULL) -{ - fprintf(stderr, "cannot start cc '%s'\n", realcc.c_str()); - perror(""); - exit(1); -} - -string modifiedfile; -string unmodifiedfile; -if (debug) -{ - modifiedfile = object + ".debug"; - DEBUG = fopen(modifiedfile.c_str(), "w"); - if (DEBUG == NULL) - { - string msg = "cannot open file "; - msg += modifiedfile; - perror(msg.c_str()); - modifiedfile = ""; - } - else - { - fprintf(stderr, "writing preprocessed source to %s\n", modifiedfile.c_str()); - } - unmodifiedfile = object + ".debug_in"; - DEBUGIN = fopen(unmodifiedfile.c_str(), "w"); - if (DEBUGIN == NULL) - { - string msg = "cannot open file "; - msg += unmodifiedfile; - perror(msg.c_str()); - unmodifiedfile = ""; - } - else - { - fprintf(stderr, "writing unprocessed source to %s\n", unmodifiedfile.c_str()); - } -} - -string oldline; -string newline; -static const int MAX_BUFFER = 51200; -char buf[MAX_BUFFER]; -while (!feof(CPP)) -{ - if (fgets(buf, MAX_BUFFER, CPP) != NULL) - { - oldline = buf; - if (DEBUGIN) { fprintf(DEBUGIN, "%s", oldline.c_str()); } - parse_line(hashtab, oldline, newline); - //#print "oldline = $oldline"; - //#print "newline = $newline"; - if (newline.empty()) - { - fprintf(stderr, "hash error in/with file %s\n", source.c_str()); - exit(1); - } - //#print "newline = $newline\n"; - fprintf(CC, "%s", newline.c_str()); - if (DEBUG) { fprintf(DEBUG, "%s", newline.c_str()); } - } -} -if (DEBUG) { fclose(DEBUG); } -if (DEBUGIN) { fclose(DEBUGIN); } -int cmd_rc = pclose(CPP); -if (cmd_rc) -{ - fprintf(stderr, "error from cpp\n"); - if (cmd_rc & 127) - { - fprintf(stderr, "cpp got signal %d\n", (cmd_rc & 127)); - exit(1); - } - else if (cmd_rc >> 8) - { - fprintf(stderr, "cpp returned %d\n", (cmd_rc >> 8)); - exit(cmd_rc >> 8); - } -} -cmd_rc = pclose(CC); -if (cmd_rc) -{ - fprintf(stderr, "error from cc\n"); - if (cmd_rc & 127) - { - fprintf(stderr, "cc got signal %d\n", (cmd_rc & 127)); - exit(1); - } - else if (cmd_rc >> 8) - { - fprintf(stderr, "cc returned %d\n", (cmd_rc >> 8)); - exit(cmd_rc >> 8); - } -} - -if (!hashtab.empty()) -{ - string stringfile = object; - stringfile += ".ppe.hash"; - // open trace string file - FILE* TRC = fopen(stringfile.c_str(), "w"); - if (TRC == NULL) - { - fprintf(stderr, "cannot write trace string file '%s'\n", stringfile.c_str()); - exit(1); - } - dprintf("Writing to file %s\n", stringfile.c_str()); - - string pwd; - FILE* PWD = popen("pwd", "r"); - fgets(buf, MAX_BUFFER, PWD); - pwd = buf; - pclose(PWD); - time_t tt = time(NULL); - sprintf(buf, "%s", asctime(localtime(&tt))); - buf[strlen(buf)-1] = '\0'; // chop off extra newline - fprintf(TRC, "#FSP_TRACE_v2|||%s|||BUILD:%s", buf, pwd.c_str()); - - string srch_str = "||"; - srch_str += source; - int srch_str_len = srch_str.length(); - size_t pos; - for(map::iterator p = hashtab.begin(); p != hashtab.end(); ++p) - { - pos = (p->second).find(srch_str); - if ((pos != string::npos) && ((pos + srch_str_len) == (p->second).length())) - { - // source file name is already part of the string - fprintf(TRC, "%s||%s\n", (p->first).c_str(), (p->second).c_str()); - } - else - { - fprintf(TRC, "%s||%s||%s\n", (p->first).c_str(), (p->second).c_str(), source.c_str()); - } - //#print TRC "$key||$source||$hashtab{$key}\n"; - } - fclose(TRC); -} -else -{ - dprintf("No trace calls/strings found, not writing hash file\n"); -} -} // end main diff --git a/src/tools/ppetracepp/trac_interface.h b/src/tools/ppetracepp/trac_interface.h deleted file mode 100755 index 2ff9dff0..00000000 --- a/src/tools/ppetracepp/trac_interface.h +++ /dev/null @@ -1,369 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/tools/ppetracepp/trac_interface.h $ */ -/* */ -/* OpenPOWER sbe Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ -/* */ -/* */ -/* 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 */ -/****************************************************************************** -// @file trac_interface.h -// @brief Interface codes for TRAC component. -*/ -/****************************************************************************** - * - * @page ChangeLogs Change Logs - * @section _trac_interface_h trac_interface.h - * @verbatim - * - * Flag Def/Fea Userid Date Description - * ------- ---------- -------- ---------- ---------------------------------- - * TEAM 06/16/2010 Port - * @rc003 rickylie 02/03/2012 Verify & Clean Up OCC Headers & Comments - * @pb00E pbavari 03/11/2012 Added correct include file - * @at009 859308 alvinwan 10/15/2012 Added tracepp support - * @ai005 860268 ailutsar 11/20/2012 Create trace test applet - * @rc005 864101 rickylie 12/12/2012 add small circ buffer to handle ISR semaphore conflict - * - * @endverbatim - * - *///*************************************************************************/ - -#ifndef _TRAC_INTERFACE_H -#define _TRAC_INTERFACE_H - -/** \defgroup Trace Trace Component - * Port of the trace code used in the fsp and tpmd. - */ - -//************************************************************************* -// Includes -//************************************************************************* - -//************************************************************************* -// Externs -//************************************************************************* - -//************************************************************************* -// Macros -//************************************************************************* -/** - * \defgroup TracMacros Trace Component Macro Interfaces - * \ingroup Trace - * Used to trace 0 - 5 arguments or a binary buffer when using a hash value. - */ -/*@{*/ - - -// @at009c - start -#define TRACE(i_td,i_string,args...) \ - trace_adal_write_all(i_td,trace_adal_hash(i_string,-1),__LINE__,0,##args) - -#define TRACEBIN(i_td,i_string,i_ptr,i_size) \ - trac_write_bin(i_td,trace_adal_hash(i_string,0),__LINE__,i_ptr,i_size) - -#ifndef NO_TRAC_STRINGS - -#define FIELD(a) \ - printf("%s",a) - -#define FIELD1(a,b) \ - printf("%s%lx",a,(unsigned long)b) - -#else // NO_TRAC_STRINGS - -#define FIELD(a) - -#define FIELD1(a,b) - -#endif // NO_TRAC_STRINGS - -#define SUCCESS 0 -// @at009c - end - - - -/*@}*/ - -//************************************************************************* -// Defines/Enums -//************************************************************************* -#define TRACE_MAX_ARGS 5 /*!< Maximum number of args to trace */ - -typedef uint32_t trace_hash_val; - -// NOTE! Increment this when new components are added! -#define TRAC_NUM_TRACE_COMPONENTS 1 - - -#define TRACE_BUFFER_SIZE 8192 // @ai005a - -#define CIRCULAR_BUFFER_SIZE 4 // @rc005a - -typedef uint32_t UINT32; -typedef int32_t INT32; -typedef uint8_t UCHAR; -typedef uint8_t UINT8; -typedef int8_t INT8; -typedef uint16_t UINT16; -typedef int16_t INT16; -typedef char CHAR; -typedef unsigned int UINT; -typedef unsigned long ULONG; -typedef int INT; -typedef void VOID; - -//************************************************************************* -// Structures -//************************************************************************* -/* - * @brief Structure is put at beginning of all trace buffers - */ -typedef struct trace_buf_head { - UCHAR ver; /*!< version of this struct (1) */ - UCHAR hdr_len; /*!< size of this struct in bytes */ - UCHAR time_flg; /*!< meaning of timestamp entry field */ - UCHAR endian_flg; /*!< flag for big ('B') or little ('L') endian */ - CHAR comp[16]; /*!< the buffer name as specified in init call */ - UINT32 size; /*!< size of buffer, including this struct */ - UINT32 times_wrap; /*!< how often the buffer wrapped */ - UINT32 next_free; /*!< offset of the byte behind the latest entry */ - UINT32 te_count; /*!< Updated each time a trace is done */ - UINT32 extracted; /*!< Not currently used */ -}trace_buf_head_t; - -/*! - * @brief Timestamp and thread id for each trace entry. - */ -typedef struct trace_entry_stamp { - UINT32 tbh; /*!< timestamp upper part */ - UINT32 tbl; /*!< timestamp lower part */ - UINT32 tid; /*!< process/thread id */ -}trace_entry_stamp_t; - -/* - * @brief Structure is used by adal app. layer to fill in trace info. - */ -typedef struct trace_entry_head { - UINT16 length; /*!< size of trace entry */ - UINT16 tag; /*!< type of entry: xTRACE xDUMP, (un)packed */ - UINT32 hash; /*!< a value for the (format) string */ - UINT32 line; /*!< source file line number of trace call */ -}trace_entry_head_t; - -/* - * @brief Parameter traces can be all contained in one write. - */ -typedef struct trace_entire_entry { - trace_entry_stamp_t stamp; - trace_entry_head_t head; - UINT32 args[TRACE_MAX_ARGS + 1]; -} trace_entire_entry_t; - - -/* - * @brief Binary first writes header and time stamp. - */ -typedef struct trace_bin_entry { - trace_entry_stamp_t stamp; - trace_entry_head_t head; -} trace_bin_entry_t; - -/** - * @brief Used as input to traces to get to correct buffer. - */ -typedef trace_buf_head_t * tracDesc_t; - -/* - * @brief Structure is used to hold array of all trace descriptors - */ -typedef struct trace_descriptor_array -{ - tracDesc_t *entry; /*!< Pointer to trace descriptor */ - CHAR *comp; /*!< Pointer to component name */ -}trace_descriptor_array_t; - -// @rc005a - start -typedef struct circular_buf_head -{ - UINT32 head; // pointer to head - UINT32 tail; // pointer to tail - UINT32 entryCount; // nums of entry -} circular_buf_header_t; - - -typedef struct circular_entire_data { - UINT32 len; - CHAR comp[4]; - trace_entire_entry_t entry; -} circular_entire_data_t; - -// @rc005a - end - -//************************************************************************* -// Globals -//************************************************************************* -// All TPMF component trace descriptors. -extern tracDesc_t g_trac_inf; // @at009a -extern tracDesc_t g_trac_err; // @at009a -extern tracDesc_t g_trac_imp; // @at009a - -extern const trace_descriptor_array_t g_des_array[]; - -//************************************************************************* -// Function Prototypes -//************************************************************************* - -/** - * \defgroup TracIntefaces Trace Component Interfaces for External Use - * \ingroup Trace - */ -/*@{*/ - - -/** - * @brief Allocate and initialize all trace buffers in memory. - * - * This function will allocate memory for each of the pre-defined trace - * buffers, initilize the buffers with starting data, and setup the - * trace descriptors which each component will use to trace. - * - * This function must be called first before any components try to trace! - * - * @return Non-zero return code on error. - */ -UINT TRAC_init_buffers(void); - -/** - * @brief Retrieve full trace buffer for component i_comp - * - * This function assumes memory has already been allocated for - * the full trace buffer in o_data. - * - * @param i_td_ptr Trace descriptor of buffer to retrieve. - * @param o_data Pre-allocated pointer to where data will be stored. - * - * @return Non-zero return code on error - */ -UINT TRAC_get_buffer(const tracDesc_t i_td_ptr, - void *o_data); - -/** - * @brief Retrieve partial trace buffer for component i_comp - * - * This function assumes memory has already been allocated for - * the trace buffer (size io_size). This function will copy - * in up to io_size in bytes to the buffer and set io_size - * to the exact size that is copied in. - * - * @param i_td_ptr Trace descriptor of buffer to retrieve. - * @param o_data Pre-allocated pointer to where data will be stored. - * @param io_size Size of trace data to retrieve (input) - * Actual size of trace data stored (output) - * - * @return Non-zero return code on error - */ -UINT TRAC_get_buffer_partial(const tracDesc_t i_td_ptr, - void *o_data, - UINT *io_size); - -/** - * @brief Retrieve trace descriptor for input component name - * - * @param i_comp Component name to retrieve trace descriptor for. - * - * @return Valid trace descriptor on success, NULL on failure. - */ -tracDesc_t TRAC_get_td(const char *i_comp); - -/** - * @brief Reset all trace buffers - * - * @return Non-zero return code on error - */ -UINT TRAC_reset_buf(void); - -/*@}*/ // Ending tag for external interface module in doxygen - - -/** - * @brief Trace input integers to trace buffer. - * - * This function assumes i_td has been initialized. - * - * @param io_td Intialized trace descriptor point to buffer to trace to. - * @param i_hash Hash value to be recorded for this trace. - * @param i_fmt Output format - * @param i_line Line number trace is occurring on. - * @param i_type trace type. filed or debug. - * @param ... parames that are limited to a size of 4 bytes, i.e. int, uint32_t, nnn* - * - * @return Non-zero return code on error. - */ -UINT trace_adal_write_all(tracDesc_t io_td,const trace_hash_val i_hash, - const char *i_fmt,const ULONG i_line, const ULONG i_type,...); - - -/** - * @brief Trace input integers to trace buffer. - * - * This function assumes i_td has been initialized. - * - * @param io_td Intialized trace descriptor point to buffer to trace to. - * @param i_hash Hash value to be recorded for this trace. - * @param i_line Line number trace is occurring on. - * @param i_num_args Number of arguments to trace. - * @param i_1 Input Parameter 1 - * @param i_2 Input Parameter 2 - * @param i_3 Input Parameter 3 - * @param i_4 Input Parameter 4 - * @param i_5 Input Parameter 5 - * - * @return Non-zero return code on error. - */ -UINT trac_write_int(tracDesc_t io_td,const trace_hash_val i_hash, - const ULONG i_line, - const UINT i_num_args, - const ULONG i_1,const ULONG i_2,const ULONG i_3, - const ULONG i_4,const ULONG i_5 - ); - - - /** - * @brief Trace binary data to buffer. - * - * This function assumes i_td has been initialized. - * - * @param io_td Intialized trace descriptor point to buffer to trace to. - * @param i_hash Hash value to be recorded for this trace. - * @param i_line Line number trace is occurring on. - * @param i_ptr Pointer to binary data to trace. - * @param i_size Size of data to copy from i_ptr. - * - * @return Non-zero return code on error. - */ -UINT trac_write_bin(tracDesc_t io_td,const trace_hash_val i_hash, - const ULONG i_line, - const void *i_ptr, - const ULONG i_size); - -//************************************************************************* -// Functions -//************************************************************************* - -#endif //_TRAC_INTERFACE_H diff --git a/src/tools/ppetracepp/tracehash.pl b/src/tools/ppetracepp/tracehash.pl deleted file mode 100755 index 8855adee..00000000 --- a/src/tools/ppetracepp/tracehash.pl +++ /dev/null @@ -1,896 +0,0 @@ -#!/usr/bin/perl -w -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/tools/ppetracepp/tracehash.pl $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2015,2016 -# -# -# 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 -# File tracehash.pl created by B J Zander. - -use strict; - -sub determine_args(); -sub launch_cpp_and_parse($$); -sub cpp_dir($); -sub read_string_file(); -sub collect_files($); -sub assimilate_file($); -sub hash_strings(); -sub write_string_file(); -sub help(); - -select (STDERR); -$| = 1; # Make all prints to STDERR flush the buffer immediately -select (STDOUT); -$| = 1; # Make all prints to STDOUT flush the buffer immediately - -# Constants -my $HEAD_SEP = "|||"; -my $HEAD_EYE_CATCHER = "#FSP_TRACE_v"; -my $HEAD_BUILD_FLAG = "BUILD:"; -my $HEAD_VER_FLAG = 2; -my $BB_STRING_FILE = "/opt/fsp/etc/BB_StringFile"; - -# Global Variables -my $debug = 0; -my $seperator = "&&&&"; -my $file_name = "sbeStringFile"; -my $in_sand; -my ($backing) = $ENV{'bb'}; -my $hash_prog = "trexhash"; #default to in path -my $build = ""; -my ($sandbox) = $ENV{'SANDBOX'} || ""; -my ($context) = $ENV{'CONTEXT'} || ""; -my ($sandboxbase) = $ENV{'SANDBOXBASE'} || ""; -my ($bb); -my ($sourcebase) = "$sandboxbase/src"; -my ($version) = $HEAD_VER_FLAG; # default to oldest version -my ($collect) = 0; -my ($INCLUDE, $Arg, $file, $dir, $string_file); -my $args = ""; - -my $fail_on_collision = 0; # 1 = exit with error if hash collision occurs -my $hash_filename_too = 0; # 1 = hash is calculated over format string + filename - -print "sourcebase = $sourcebase\n" if $debug; -print "sandbox = $sandbox\n" if $debug; -print "backing = $backing\n" if $debug; -print "context = $context\n" if $debug; - -if ($context =~ /x86/) -{ - $bb = "i586-pc-linux-gnu"; -} -else -{ - $bb = "powerpc-linux"; -} - -if(($sourcebase =~ /\w+/) && ($sandbox =~ /\w+/)) -{ - $INCLUDE = "-I $sandboxbase/export/$context/fips/include -I $backing/export/$context/fips/include -I /opt/fsp/$bb/include/fsp -I/opt/fsp/$bb/include/ -include /opt/fsp/$bb/include/fsp/tracinterface.H"; -} -else -{ - print "Not in Sandbox so guessing Include Paths...\n" if $debug; - $INCLUDE = "-I/opt/fsp/i586-pc-linux-gnu/include/fsp -I/opt/fsp/i586-pc-linux-gnu/include/ -include /opt/fsp/i586-pc-linux-gnu/include/fsp/tracinterface.H"; -} - -# I/P Series work in ODE sandbox env. -if ($sandboxbase =~ /\w+/) -{ - $in_sand = 1; - print "backing = $backing\n" if $debug; -} -else -{ - $in_sand = 0; -} - - - -# Parse the input parameters. - -while (@ARGV) { - $Arg = shift; - - if ($Arg eq "-h" || $Arg eq "-H") { - help(); - exit(127); - } - if ($Arg eq "-f") { - $file = shift; - next; - } - if ($Arg eq "-d") { - $dir = shift; - next; - } - if ($Arg eq "-s") { - $string_file = shift; - next; - } - if ($Arg eq "-c") { - $collect = 1; - next; - } - if ($Arg eq "-v") { - $debug = 1; - print "debug on\n" if $debug; - next; - } - if ($Arg eq "-C") { # fail if a hash collision is detected - $fail_on_collision = 1; - next; - } - if ($Arg eq "-F") { # hash is calculated over format string + file name - $hash_filename_too = 1; - next; - } - if ($Arg eq "-S") { - $BB_STRING_FILE = ""; - next; - } - - #just pass it onto compiler - $args = $args . " " . $Arg; -} - -print "args = $args\n" if $debug; - -if (!$file && !$dir && !$in_sand) { - help(); - exit(127); -} - -################################# -# M A I N # -################################# - -my $clock = `date`; - -$build = $HEAD_EYE_CATCHER . "$HEAD_VER_FLAG" . $HEAD_SEP . $clock . $HEAD_SEP . $HEAD_BUILD_FLAG; - -$build =~ s/\n//g; - -# Global array to hold the parsed TRAC macro calls. -my @strings = (); - -# Assoc. arrays to hold hash|string values. -my %string_file_array = (); -my %hash_strings_array = (); - -# Check all provided arguments and look for defaults if not provided by user -determine_args(); - -# Scan the appropriate files or directories for TRAC macro calls. - -if (defined $dir) -{ - - $build = $build . $dir; # default to put at top of string file - if($collect) - { - collect_files($dir); - } - else - { - cpp_dir($dir); - # Hash the string that have been scanned. - %hash_strings_array = hash_strings(); - } -} -else -{ - $build = $build . $file; # default to put at top of string file - - if($collect) - { - assimilate_file($file); - } - else - { - # make sure include path includes directory that file is in - if($file =~ /^(.+)\/[^\/]+\.C$/) - { - - launch_cpp_and_parse($file,$1); - } - else - { - # No path in front of file so it has to be local dir - launch_cpp_and_parse($file,"./"); - } - # Hash the string that have been scanned. - %hash_strings_array = hash_strings(); - } -} - -# Read the existing string file into memory. -%string_file_array = read_string_file(); - -# Write out the new string file. check for collisions of new/old string here -write_string_file(); - -print "Hashing Started at $clock\n"; -$clock = `date`; -print "Hashing Finished at $clock\n"; - -exit 0; - - -################################# -# S U B R O U T I N E S # -################################# - -#============================================================================= -# Enhance usability by figuring out which build env. we are in -#============================================================================= -sub determine_args() { - - - # Find trexhash program - # but only if needed (i.e. not in collect mode) - if (!$collect) { - my $tmp = `which $hash_prog`; - chomp $tmp; - - if ($tmp eq '') { - print STDOUT "\nWarning: Program trexhash does not exist in path.\n" if $debug; - $hash_prog = "./trexhash"; - - $tmp = `which $hash_prog`; - chomp $tmp; - if ($tmp eq '') { - print STDOUT "\nError: Unable to find trexhash \n"; - exit(127); - } - } - } - - # Verify input values. - if ((!defined $file) && (!defined $dir)) { - if(!($in_sand)) - { - print STDOUT "\nError: No input directory or file provided as input to scan\n"; - exit(127); - } - - # Assume they want sandbox scanned - if($collect) - { - # collect all string files generated by tracepp and merge - $dir = "$sandboxbase/obj/"; - } - else - { - # generate our own string file by pre-compiling all source code - $dir = "$sandboxbase/src/"; - } - print STDOUT "\n-f or -d not found...scanning $dir by default\n\n"; - } - - if (!defined $string_file) - { - if ($in_sand) - { - - # Copy the current string file from backing build into our sandbox - system ("cp $backing/obj/$file_name $sandboxbase/obj/$file_name") - if !(-e "$sandboxbase/obj/$file_name"); - - $string_file = "$sandboxbase/obj/$file_name"; - } - else - { - $string_file = "./$file_name"; - } - print STDOUT "-sf not specified, using $string_file instead...\n\n" if $debug; - - } - - # Try Creating the string file - `touch $string_file`; - - if (! -f $string_file) { - print STDOUT "\nError: File $string_file does not exist. Current directory may not be writable.\n\n"; - help(); - exit(127); - } - - # Make sure sbeStringFile is readable/writeable - system("chmod ugo+rw $string_file"); - -} - -#============================================================================= -# Launch cpp script and grab input from it looking for trace calls. -#============================================================================= -sub launch_cpp_and_parse($$) { - - my ($l_loc, $l_dir) = @_; - - print "Processing file $l_loc\n" if $debug; - my $cmd = "/usr/bin/cpp $INCLUDE -I $l_dir $args $l_loc|"; - print "$cmd\n" if $debug; - open(FH,"$cmd") - or die ("Cannot open $_:$!,stopped"); - - # Read through all lines in the file.. - my $line = ; - while (defined $line) - { - chop $line; # remove EOL - $line =~ s/^\s*//; # remove unneccesary beginning white space. - $line =~ s/\s*$//; # remove unneccesary ending white space. - # Look for lines that are trace macro calls. - #if (/(trace_adal_hash)(\()( *)(".+")(,)(\d)/) - #if ($line =~ /(.*?)(trace_adal_hash)(\()( *)(".+")(,)(\d)\)+(.*\d.*)/) - while($line =~ m/^(.*?)trace_adal_hash\s*\(\s*(("[^"]*"\s*)+),\s*(\d+)\s*\)(.*)$/) - { - my ($prefix, $strings, $salt, $suffix) = ($1, $2, $4, $5); - print STDOUT "$strings $salt\n" if $debug; - $strings =~ s/"\s*$//; # remove trailing " and space - $strings =~ s/^"//; # remove leading " - $strings =~ s/"\s*"//g; - # Check to see if it's contained on a single line, or if we - # have to combine lines to get a complete trace call. - - # Save the macro call so it can be hashed later.. - push (@strings, [$l_loc, $strings, $salt]); - $line = $suffix; # check rest of line for a second trace call - } - my $nextline = ; - last if !defined $nextline; - # if a trace call is spread over multiple lines we have to add the next - # line from the source. the only problem is the definition/declaration - # of trace_adal_hash: we have to ignore that. we catch that by requiring - # a " after the function name. hopefully nobody writes a comment with - # a " after the function declaration ... - if ($line =~ /trace_adal_hash.*"/) { - $line .= $nextline; - } else { - $line = $nextline; - } - } - close(FH); -} - -#============================================================================= -# run cpp on all files in this directory and return the output -#============================================================================= -sub cpp_dir($) { - - my ($l_dir) = @_; - my @dir_entry; - my $l_entry; - - # Open the directory and read all entry names. - opendir ( DH , "$l_dir") - or die ("Cannot open $l_dir: $!, stopped"); - - print STDOUT "Processing directory $l_dir\n" if $debug; - @dir_entry = readdir(DH); - closedir(DH); - - while (@dir_entry) { - $l_entry = shift(@dir_entry); - - if ($l_dir =~ m"/$") { - $l_entry = "$l_dir$l_entry"; - } - else { - $l_entry = "$l_dir/$l_entry"; - } - - # Is the entry a directory? - if (-d $l_entry) { - - if($l_entry =~ m"/?([^/]+)$") - { - # check dir we are going into - print "dir = $1\n" if $debug; - # should we recurse into this directory. - if ($1 =~ m/^(\.\.?|sim[ou]|bldv)$/) - { - next; # skip '.', '..' and some fips dirs - } - cpp_dir($l_entry); - } - else - { - # unable to determine name of dir (no / in filename) - # should we recurse into this directory. - if ($l_entry =~ m/^(\.\.?|sim[ou]|bldv)$/) - { - next; # skip '.', '..' and some fips dirs - } - cpp_dir($l_entry); - } - } - # Is the entry a file? - elsif ((-f $l_entry) && ($l_entry =~ m/\.C$/)) { - # it's a file so - launch_cpp_and_parse($l_entry,$l_dir); - } - else { - # Not a file or directory so ignore it... - } - } -} - -#============================================================================= -# Read in strings from the existing trace string file.... -#============================================================================= -sub read_string_file() { - - my %o_strings; - my ($line) = ""; - my ($l_hash) = ""; - my ($l_str) = ""; - my ($cur_build) = ""; - my ($l_file) = ""; - - - # Make sure we can open each file. - open ( FH , "<$string_file") - or die ("Cannot open $_: $!, stopped"); - - $line = ; - - print "first line in sbeStringFile= $line\n" if $debug; - - if((defined $line) && ($line =~ /^$HEAD_EYE_CATCHER(\d)/)) - { - $version = $1; - - print "version = $version\n" if $debug; - - #Always put latest version in file - $line =~ s/^$HEAD_EYE_CATCHER\d/${HEAD_EYE_CATCHER}${HEAD_VER_FLAG}/; - - # Take previous version in file and use it. - $build = $line; - chomp($build); - $line = ; - - while (defined $line) { - chomp $line; # remove EOL - if($version eq "1") - { - ($l_hash, $l_file ,$l_str) = split(/\|\|/, $line); - } - elsif($version eq "2") - { - ($l_hash, $l_str ,$l_file) = split(/\|\|/, $line); - } - else - { - print "Unknown version of stringfile $version\n"; - exit(127); - } - $o_strings{$l_hash} = $l_str . "||" . $l_file; - $line = ; - } - - } - else - { # If there is a file then we are dealing with the first - # version of sbeStringFile so don't look for file name. - if ($debug) { - print "version 0 stringfile detected: $string_file\n"; - } - - # there is a file and it doesn't have a header - $version = 0; - - while (defined $line) { - chomp $line; # remove EOL - ($l_hash,$l_str) = split(/\|\|/, $line); - $o_strings{$l_hash} =$l_str . "||" . "NO FILE"; - $line = ; - } - } - - close(FH); - - #Time to look for a building block string file - if($BB_STRING_FILE ne "" and $string_file ne $BB_STRING_FILE and -f $BB_STRING_FILE) - { - - # Make sure we can open the file. - open ( FH , "<$BB_STRING_FILE") - or die ("Cannot open $_: $!, stopped"); - - $line = ; - - print "first line in BB_StringFile = $line\n" if $debug; - if((defined $line) && ($line =~ /^$HEAD_EYE_CATCHER(\d)/)) - { - $version = $1; - - $line = ; - while (defined $line) - { - chop $line; # remove EOL - if($version eq "1") - { - ($l_hash, $l_file ,$l_str) = split(/\|\|/, $line); - } - elsif($version eq "2") - { - ($l_hash, $l_str ,$l_file) = split(/\|\|/, $line); - } - #($l_hash, $l_file ,$l_str) = split(/\|\|/, $line); - $o_strings{$l_hash} = $l_str . "||" . $l_file ; - $line = ; - } - } - else - { - print "*** ERROR: BB_StringFile '$BB_STRING_FILE' should always have version!!!\n" - } - - } - else - { - print "$BB_STRING_FILE is not available\n" if $debug; - } - #All files are latest version now. - $version = $HEAD_VER_FLAG; - return %o_strings; -} - -#============================================================================= -# Read in strings from the existing trace string file.... -#============================================================================= -sub collect_files($) { - - my ($l_dir) = @_; - my (@dir_entry); - my ($l_entry) = ""; - - # Open the directory and read all entry names. - opendir ( DH , "$l_dir") - or die ("Cannot open $l_dir: $!, stopped"); - - print STDOUT "Processing directory $l_dir\n" if $debug; - @dir_entry = readdir(DH); - closedir(DH); - - while (@dir_entry) { - $l_entry = shift(@dir_entry); - - if ($l_dir =~ m"/$") { - $l_entry = "$l_dir$l_entry"; - } - else { - $l_entry = "$l_dir/$l_entry"; - } - - # Is the entry a directory? - if (-d $l_entry) { - - # should we recurse into this directory. - if ($l_entry =~ m/\/(\.\.?|sim[ou]|bldv)$/) - { - next; # skip '.', '..' and some fips dirs - } - collect_files($l_entry); - } - # Is the entry a file? - elsif ((-f $l_entry) && ($l_entry =~ m"\.hash$")) { - # it's a file so - assimilate_file($l_entry); - } - else { - # Not a file or directory so ignore it... - } - } - -} - -#============================================================================= -# Read in data from file and add to master one -#============================================================================= -sub assimilate_file($) { - - my ($l_loc) = @_; - - my (%o_strings); - my ($line) = ""; - my ($l_hash) = ""; - my ($l_str) = ""; - my ($l_file) = ""; - - # Make sure we can open each file. - open ( FH , "<$l_loc") - or die ("Cannot open $_: $!, stopped"); - - $line = ; - - print "Assimilate: first line in $l_loc = $line" if $debug; - - if((defined $line) && ($line =~ /^$HEAD_EYE_CATCHER(\d)/)) - { - $version = $1; - if ($version eq "1") { - if ($hash_filename_too) { - print "*** ERROR: hash_filename_too (-F) isn't possible with trace version 1\n"; - print " please rebuild all .hash files and global sbeStringFile\n"; - print " version 1 file is '$l_loc'\n"; - exit(127); - } - } elsif ($version ne "2") { - print "Unknown version of stringfile $version\n"; - exit(127); - } - - $line = ; - - - while (defined $line) { - chop $line; # remove EOL - if($version eq "1") - { - ($l_hash, $l_file ,$l_str) = split(/\|\|/, $line); - } - elsif($version eq "2") - { - ($l_hash, $l_str ,$l_file) = split(/\|\|/, $line); - } - my $newstring = $l_str . "||" . $l_file; - if (exists $hash_strings_array{$l_hash}) { - my $hashstr1 = $hash_strings_array{$l_hash}; - my $hashstr2 = $newstring; - if (!$hash_filename_too) { - # hash was made over format string only, remove file name - $hashstr1 =~ s/\|\|.*$//; - $hashstr2 = $l_str; - } - if ($debug) { - print "a_f: compare $hashstr1\n", - " vs. $hashstr2\n"; - } - if ($hashstr1 ne $hashstr2) - { - print "*** ERROR: HASH Collision! (a_f)\n", - " Two different strings have the same hash value ($l_hash)\n", - " String 1: $hash_strings_array{$l_hash}\n", - " String 2: $newstring\n"; - if ($fail_on_collision) { - exit(1); - } - } - } - $hash_strings_array{$l_hash} = $newstring; - $line = ; - } - - } - else - { # If there is a file then we are dealing with the first - # version of sbeStringFile so don't look for file name. - # these files shouldn't be there anymore. we don't check for collisions here - if ($debug) { - print "version 0 stringfile detected: $string_file\n"; - } - - if(defined $line) - { - # there is a file and it doesn't have a header - $version = 0; - } - - while (defined $line) { - chop $line; # remove EOL - ($l_hash,$l_str) = split(/\|\|/, $line); - $hash_strings_array{$l_hash} = $l_str . "||" . "NO FILE"; - $line = ; - } - } - $version = $HEAD_VER_FLAG; - close(FH); -} - -#============================================================================= - -#============================================================================= -sub hash_strings() { - - my ($hash_val, $l_key, $l_hash, %l_hash_strings); - my ($line_feed) = chr(10); - my ($l_file_name) = "NO FILENAME"; - print "\nHashing printf strings.\n\n"; - - foreach my $str (@strings) { - my $printf_string; - $l_file_name = $str->[0]; - $printf_string = $str->[1]; - $l_key = $str->[2]; - print "printf_string = $printf_string\n" if $debug; - $printf_string =~ s/"\s?"//g; #multi line traces will have extra " in them - $printf_string =~ s/`/\\`/g; # excape ' - $printf_string =~ s/\\n/$line_feed/g; # escape \n - if ($hash_filename_too) { - $printf_string .= "||" . $l_file_name; - } - - # call the hasher. - print "$hash_prog \"$printf_string\" $l_key\n" if $debug; - $hash_val = `$hash_prog \"$printf_string\" $l_key`; - if ($?) { - my ($hp_ret, $hp_sig) = ($? >> 8, $? & 127); - if ($hp_sig) { - print "*** ERROR: $hash_prog died with signal $hp_sig\n"; - } elsif ($hp_ret) { - print "*** ERROR: $hash_prog returned the error $hp_ret\n"; - if ($hash_val) { - print " error from $hash_prog:\n$hash_val"; - } - } - exit(1); - } - print "printf_string = $printf_string l_key = $l_key hash val = $hash_val\n" if $debug; - - # undo escaping - $printf_string =~ s/$line_feed/\\n/g; - $printf_string =~ s/\\`/`/g; - - if (exists $l_hash_strings{$hash_val}) - { - # hash val was found before. check if it's the same string - # else we have a hash collision - my $l_tmp = $l_hash_strings{$hash_val}; - if (!$hash_filename_too) { - $l_tmp =~ s/\|\|.*$//; - } - if ($l_tmp ne $printf_string) - { - print "*** ERROR: HASH Collision! (h_s)\n", - " Two different strings have the same hash value ($hash_val)\n", - " String 1: $l_hash_strings{$hash_val}\n", - " String 2: $printf_string (file $l_file_name)\n"; - if ($fail_on_collision) { - exit(1); - } - } - } - # this will overwrite an old string with a new one if a collision occurred - # but we might want to bail out in this case anyway - $printf_string = $printf_string . "||" . $l_file_name; - $l_hash_strings{$hash_val} = $printf_string; - } - return %l_hash_strings; -} -#============================================================================= - -#============================================================================= -sub write_string_file() { - - my (@keys) = (); - my ($l_key) = ""; - - # Combine the contents of the existing string file with the trace calls - # that we have just hashed. - print STDOUT "\nCombining Hash strings...\n\n"; - - @keys = keys(%hash_strings_array); - - foreach $l_key (@keys) { - my $l_tmp = $hash_strings_array{$l_key}; # freshly collected strings - if (exists $string_file_array{$l_key}) - { # hash exists in list from sbeStringFile - my $l_tmp2 = $string_file_array{$l_key}; - if (!$hash_filename_too) { - $l_tmp =~ s/\|\|.*$//; - $l_tmp2 =~ s/\|\|.*$//; - } - - # Check for hash collisions. - if ($l_tmp ne $l_tmp2) - { - print "*** ERROR: HASH Collision! (w_s_f)\n", - " Two different strings have the same hash value ($l_key)\n", - " String 1: $hash_strings_array{$l_key}\n", - " String 2: $string_file_array{$l_key}\n"; - if ($fail_on_collision) { - exit(1); - } - # don't fail, write new one - } - } - if($version > 0) - { - # add/replace the new string to the string_file_array. - $string_file_array{$l_key} = $hash_strings_array{$l_key} - } - else - { - # old version so only write out format string (not file name to) - $string_file_array{$l_key} = $l_tmp; - } - } - - # Write out the updated string file. - print STDOUT "\nWriting updated hash||string file...\n\n"; - - @keys = sort(keys(%string_file_array)); - - open ( FH , ">$string_file") - or die ("Cannot open $_: $!, stopped"); - - if($version > 0) - { - print FH "$build\n"; # only print version if newer then version 0 - } - foreach $l_key (@keys) { - print FH "$l_key||$string_file_array{$l_key}\n"; - } - close FH; -} -#============================================================================= - -#============================================================================= -# Display command invokation help for this program... -#============================================================================= -sub help() { - print << "EOF"; -tracehash.pl - create a trace string file from sources or collect tracepp files -Usage: tracehash.pl [options] - General options: - -h - Print this help text. - -v - Be verbose, tell what's going on (debug output) - Operation modes - -c - Collect StringFiles created by tracepp and merge. - default - Scan source files for trace calls. - -Collect mode: tracehash.pl -c [-vFCS] [-d ] [-s ] - tracehash.pl -c [-vFCS] [-f ] [-s ] - Collect string files created by tracepp (.hash) from directory tree at - or read them from string file and write to file - , adding entries already in this file. - -f - String file to read and write/add to . - -d - Start of directory tree to scan for .hash files. Default = . - -s - File with trace strings (and hashes) to read from and write to - default = ./sbeStringFile - -F - hash is calculated over trace string and source file name, - otherwise without source file name - -C - report an error if a hash collisions occurs - -S - don't read global FLD-2.2 string file ($BB_STRING_FILE) - If tracehash.pl is called in a FipS build sandbox without -d and -f - defaults for the sandbox will be used. - -Scan mode: tracehash.pl [-vFCS] [-d ] [-s ] [ccpopts] - tracehash.pl [-vFCS] [-f ] [-s ] [cppopts] - Scan all files in directory tree or scan file and write - strings to file . Strings already in this file will be merged. - -f - Source file to scan for trace entries. - -d - Source directory to scan for trace entries. - -s - File with trace strings (and hashes) to read from and write to. - default = ./sbeStringFile - -F - hash for string was build from format string + source file name - -C - report an error if hash collisions occur - -S - don't read global FLD-2.2 string file ($BB_STRING_FILE) - All other arguments will be passed verbatim to cpp -EOF -} -#============================================================================= - diff --git a/src/tools/scripts/ppeSetFixed.pl b/src/tools/scripts/ppeSetFixed.pl index ab92ec42..52880258 100755 --- a/src/tools/scripts/ppeSetFixed.pl +++ b/src/tools/scripts/ppeSetFixed.pl @@ -7,6 +7,7 @@ # OpenPOWER sbe Project # # Contributors Listed Below - COPYRIGHT 2015,2016 +# [+] International Business Machines Corp. # # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,7 +29,7 @@ use strict; my $attrpath = "../../importtemp/xml"; -my $sbedefaultpath = "../../script/image"; +my $sbedefaultpath = "../../../images"; #------------------------------------------------------------------------------ # Print Command Line Help diff --git a/src/tools/trace/Makefile b/src/tools/trace/Makefile new file mode 100644 index 00000000..547cff57 --- /dev/null +++ b/src/tools/trace/Makefile @@ -0,0 +1,37 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/tools/trace/Makefile $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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 +include img_defs.mk + +all: ppetracepp ppe2fsp + +ppetracepp: ppetracepp.C + g++ -m32 -O3 -w -g -I./ ppetracepp.C -o $(PPETRACEPP_BIN_DIR)/ppetracepp +# g++ -O3 -w -x c++ -fPIC -g -I./ ppetracepp.C -o ppetracepp + +ppe2fsp: ppe2fsp.c ppe2fsp_cmd.c + gcc -m32 -w -g -I./ -I$(PK_SRCDIR)/trace ppe2fsp.c ppe2fsp_cmd.c -o $(PPETRACEPP_BIN_DIR)/ppe2fsp + +clean: + rm $(PPETRACEPP_BIN_DIR)/ppetracepp $(PPETRACEPP_BIN_DIR)/ppe2fsp + diff --git a/src/tools/trace/cmvc/makefile b/src/tools/trace/cmvc/makefile new file mode 100644 index 00000000..3c96ca18 --- /dev/null +++ b/src/tools/trace/cmvc/makefile @@ -0,0 +1,28 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/tools/trace/cmvc/makefile $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 +PROGRAMS += ppe2fsp +ppe2fsp_OFILES = ppe2fsp.o ppe2fsp_cmd.o + +.include <${RULES_MK}> + diff --git a/src/tools/trace/jhash.h b/src/tools/trace/jhash.h new file mode 100755 index 00000000..5bfe5fb3 --- /dev/null +++ b/src/tools/trace/jhash.h @@ -0,0 +1,166 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/tools/trace/jhash.h $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 _LINUX_JHASH_H +#define _LINUX_JHASH_H + +/* jhash.h: Jenkins hash support. + * + * Copyright (C) 1996 Bob Jenkins (bob_jenkins@burtleburtle.net) + * + * http://burtleburtle.net/bob/hash/ + * + * These are the credits from Bob's sources: + * + * lookup2.c, by Bob Jenkins, December 1996, Public Domain. + * hash(), hash2(), hash3, and mix() are externally useful functions. + * Routines to test the hash are included if SELF_TEST is defined. + * You can use this free for any purpose. It has no warranty. + * + * Copyright (C) 2003 David S. Miller (davem@redhat.com) + * + * I've modified Bob's hash to be useful in the Linux kernel, and + * any bugs present are surely my fault. -DaveM + */ + +/* NOTE: Arguments are modified. */ +#define __jhash_mix(a, b, c) \ +{ \ + a -= b; a -= c; a ^= (c>>13); \ + b -= c; b -= a; b ^= (a<<8); \ + c -= a; c -= b; c ^= (b>>13); \ + a -= b; a -= c; a ^= (c>>12); \ + b -= c; b -= a; b ^= (a<<16); \ + c -= a; c -= b; c ^= (b>>5); \ + a -= b; a -= c; a ^= (c>>3); \ + b -= c; b -= a; b ^= (a<<10); \ + c -= a; c -= b; c ^= (b>>15); \ +} + +/* The golden ration: an arbitrary value */ +#define JHASH_GOLDEN_RATIO 0x9e3779b9 + +/* The most generic version, hashes an arbitrary sequence + * of bytes. No alignment or length assumptions are made about + * the input key. + */ +static inline u32 jhash(const void *key, u32 length, u32 initval) +{ + u32 a, b, c, len; + const u8 *k = (const u8*)key; + + len = length; + a = b = JHASH_GOLDEN_RATIO; + c = initval; + + while (len >= 12) { + a += (k[0] +((u32)k[1]<<8) +((u32)k[2]<<16) +((u32)k[3]<<24)); + b += (k[4] +((u32)k[5]<<8) +((u32)k[6]<<16) +((u32)k[7]<<24)); + c += (k[8] +((u32)k[9]<<8) +((u32)k[10]<<16)+((u32)k[11]<<24)); + + __jhash_mix(a,b,c); + + k += 12; + len -= 12; + } + + c += length; + switch (len) { + case 11: c += ((u32)k[10]<<24); + case 10: c += ((u32)k[9]<<16); + case 9 : c += ((u32)k[8]<<8); + case 8 : b += ((u32)k[7]<<24); + case 7 : b += ((u32)k[6]<<16); + case 6 : b += ((u32)k[5]<<8); + case 5 : b += k[4]; + case 4 : a += ((u32)k[3]<<24); + case 3 : a += ((u32)k[2]<<16); + case 2 : a += ((u32)k[1]<<8); + case 1 : a += k[0]; + }; + + __jhash_mix(a,b,c); + + return c; +} + +/* A special optimized version that handles 1 or more of u32s. + * The length parameter here is the number of u32s in the key. + */ +static inline u32 jhash2(const u32 *k, u32 length, u32 initval) +{ + u32 a, b, c, len; + + a = b = JHASH_GOLDEN_RATIO; + c = initval; + len = length; + + while (len >= 3) { + a += k[0]; + b += k[1]; + c += k[2]; + __jhash_mix(a, b, c); + k += 3; len -= 3; + } + + c += length * 4; + + switch (len) { + case 2 : b += k[1]; + case 1 : a += k[0]; + }; + + __jhash_mix(a,b,c); + + return c; +} + + +/* A special ultra-optimized versions that knows they are hashing exactly + * 3, 2 or 1 word(s). + * + * NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally + * done at the end is not done here. + */ +static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval) +{ + a += JHASH_GOLDEN_RATIO; + b += JHASH_GOLDEN_RATIO; + c += initval; + + __jhash_mix(a, b, c); + + return c; +} + +static inline u32 jhash_2words(u32 a, u32 b, u32 initval) +{ + return jhash_3words(a, b, 0, initval); +} + +static inline u32 jhash_1word(u32 a, u32 initval) +{ + return jhash_3words(a, 0, 0, initval); +} + +#endif /* _LINUX_JHASH_H */ diff --git a/src/tools/trace/ppe2fsp.c b/src/tools/trace/ppe2fsp.c new file mode 100755 index 00000000..c1ddc610 --- /dev/null +++ b/src/tools/trace/ppe2fsp.c @@ -0,0 +1,532 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/tools/trace/ppe2fsp.c $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* */ +/* */ +/* 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 */ +#include "pk_trace.h" +#include "ppe2fsp.h" +#include "trac_interface.h" +#include +#include +#include + +#define TRACE_BUF_VERSION 0x01 /*!< Trace buffer version */ +#define TRACE_FIELDTRACE 0x4654 /*!< Field Trace - "FT" */ +#define TRACE_FIELDBIN 0x4644 /*!< Binary Field Trace - "FD" */ + +#define TRAC_TIME_REAL 0 // upper 32 = seconds, lower 32 = nanoseconds +#define TRAC_TIME_50MHZ 1 +#define TRAC_TIME_200MHZ 2 +#define TRAC_TIME_167MHZ 3 // 166666667Hz + +typedef struct +{ + trace_entry_stamp_t stamp; + trace_entry_head_t head; + union + { + uint8_t data[PK_TRACE_MAX_BINARY + 1]; //add 1 byte for padding + uint32_t parms[PK_TRACE_MAX_PARMS]; + }; + uint32_t size; +}largest_fsp_entry_t; + +typedef struct +{ + union + { + uint8_t binary_data[PK_TRACE_MAX_BINARY + 1]; + struct + { + uint8_t rsvd[(PK_TRACE_MAX_BINARY + 1) - (PK_TRACE_MAX_PARMS * sizeof(uint32_t))]; + uint32_t parms[PK_TRACE_MAX_PARMS]; + }; + }; + PkTraceEntryFooter footer; +}LargestPpeEntry; + +//convert a ppe timestamp to an fsp trace timestamp +uint64_t ppe2fsp_time(uint64_t ppe_time, uint32_t hz) +{ + uint32_t seconds; + uint32_t remainder; + uint32_t nseconds; + + //convert from ppe ticks to seconds and nanoseconds + seconds = ppe_time / hz; + remainder = ppe_time - (((uint64_t)seconds) * hz); + nseconds = (((uint64_t)remainder) * 1000000000) / hz; + return (((uint64_t)seconds) << 32) | nseconds; +} + +//Writes an fsp trace entry to the fsp trace buffer +void fsp_put_entry(trace_buf_head_t* tb, largest_fsp_entry_t* fte, size_t entry_size, uint32_t bytes_left) +{ + char* buffer = ((char*)tb) + sizeof(trace_buf_head_t); + char* tb_start; + char* fte_start; + uint32_t copy_bytes; + + if(entry_size <= bytes_left) + { + tb_start = buffer + bytes_left - entry_size; + fte_start = (char*)fte; + copy_bytes = entry_size; + } + else + { + tb_start = buffer; + fte_start = ((char*)fte) + (entry_size - bytes_left); + copy_bytes = bytes_left; + } + + memcpy(tb_start, fte_start, copy_bytes); +} + + +//convert a ppe trace entry to an fsp trace entry +size_t pte2fte(PkTraceBuffer* ptb, + LargestPpeEntry* pte, + size_t pte_size, + largest_fsp_entry_t* fte, + uint64_t ppe_time64) +{ + size_t entry_size; + PkTraceGeneric* pte_footer = &pte->footer.generic; + uint32_t format; + uint32_t hash32; + uint32_t hash32_partial; + uint32_t* parm_start; + uint32_t parm_bytes; + uint64_t fsp_time64; + + //convert the ppe trace time to an fsp trace time + fsp_time64 = ppe2fsp_time(ppe_time64, ntohl(ptb->hz)); + + //fill in the 64 bit timestamp + fte->stamp.tbh = htonl((uint32_t)(fsp_time64 >> 32)); + fte->stamp.tbl = htonl((uint32_t)(fsp_time64 & 0x00000000ffffffffull)); + + //use the ppe instance id as the thread id. + fte->stamp.tid = htonl((uint32_t)ntohs(ptb->instance_id)); + + //merge the hash prefix and the string_id fields together for a 32 bit hash value + hash32 = ((uint32_t)ntohs(ptb->hash_prefix)) << 16; + hash32 |= pte_footer->string_id; + fte->head.hash = htonl(hash32); + + //generate the 32bit hash value for a partial trace entry in case it's needed + hash32_partial = ((uint32_t)ntohs(ptb->hash_prefix)) << 16; + hash32_partial |= ntohs(ptb->partial_trace_hash); + + //set the line number to 1 + fte->head.line = htonl(1); + + //determine the FSP trace format + format = PK_GET_TRACE_FORMAT(pte_footer->time_format.word32); + if(format == PK_TRACE_FORMAT_BINARY) + { + fte->head.tag = htons(TRACE_FIELDBIN); + } + else + { + fte->head.tag = htons(TRACE_FIELDTRACE); + } + + parm_start = (uint32_t*)(((char*)pte) + (sizeof(LargestPpeEntry) - pte_size)); + + //fill in the parameters/binary data and size at the end + switch(format) + { + + case PK_TRACE_FORMAT_TINY: + //one or 0 parameters + entry_size = sizeof(trace_entry_stamp_t) + + sizeof(trace_entry_head_t) + + sizeof(uint32_t); + fte->parms[0] = htonl((uint32_t)(pte_footer->parm16)); + fte->head.length = htons(sizeof(uint32_t)); + parm_bytes = 0; + break; + + case PK_TRACE_FORMAT_BIG: + //1 - 4 parameters + // + //If the trace entry data is incomplete (not all parm data + //had been written at the time the trace was captured) then + //we will write a trace to the fsp buffer that says + //"PARTIAL TRACE ENTRY. HASH_ID = %d" + if(pte_footer->complete) + { + parm_bytes = pte_footer->bytes_or_parms_count * sizeof(uint32_t); + fte->head.length = htons(parm_bytes + sizeof(uint32_t)); + entry_size = sizeof(trace_entry_stamp_t) + + sizeof(trace_entry_head_t) + + parm_bytes + sizeof(uint32_t); + } + else + { + parm_bytes = 0; + entry_size = sizeof(trace_entry_stamp_t) + + sizeof(trace_entry_head_t) + + sizeof(uint32_t); + fte->parms[0] = fte->head.hash; //already corrected for endianess + fte->head.hash = htonl(hash32_partial); + fte->head.length = htons(sizeof(uint32_t)); + } + break; + + case PK_TRACE_FORMAT_BINARY: + //If the trace entry data is incomplete (not all parm data + //had been written at the time the trace was captured) then + //we will write a trace to the fsp buffer that says + //"PARTIAL TRACE ENTRY. HASH_ID = %d" + if(pte_footer->complete) + { + parm_bytes = pte_footer->bytes_or_parms_count; + fte->head.length = htons((uint16_t)parm_bytes); + entry_size = sizeof(trace_entry_stamp_t) + + sizeof(trace_entry_head_t) + + parm_bytes; + + //pad to 4 byte boundary + entry_size = (entry_size + 3) & ~3; + } + else + { + parm_bytes = 0; + entry_size = sizeof(trace_entry_stamp_t) + + sizeof(trace_entry_head_t) + + sizeof(uint32_t); + fte->parms[0] = fte->head.hash; + fte->head.hash = htonl(hash32_partial); + fte->head.length = htons(sizeof(uint32_t)); + fte->head.tag = htons(TRACE_FIELDTRACE); + } + break; + + + default: + entry_size = 0; + parm_bytes = 0; + break; + } + + //copy parameter bytes to the fsp entry if necessary + if(parm_bytes) + { + memcpy(fte->data, parm_start, parm_bytes); + } + + //add the entry size to the end + if(entry_size) + { + uint32_t new_entry_size = entry_size + sizeof(uint32_t); + *((uint32_t*)(((char*)fte) + entry_size)) = htonl(new_entry_size); + entry_size = new_entry_size; + } + + return entry_size; +} + +//retrieve a ppe trace entry from a ppe trace buffer +size_t ppe_get_entry(PkTraceBuffer* tb, uint32_t offset, LargestPpeEntry* pte) +{ + uint32_t mask = ntohs(tb->size) - 1; + PkTraceEntryFooter* footer; + size_t entry_size; + size_t parm_size; + char* dest = (char*)pte; + uint32_t format; + uint32_t start_index; + uint32_t bytes_left; + uint32_t bytes_to_copy; + + //Find the footer in the circular buffer + footer = (PkTraceEntryFooter*)(&tb->cb[(offset - sizeof(PkTraceEntryFooter)) & mask]); + + //always correct endianess for the time and string id words + pte->footer.generic.time_format.word32 = ntohl(footer->generic.time_format.word32); + pte->footer.generic.string_id = ntohs(footer->generic.string_id); + + //only need to byte swap the parm16 value if this is a tiny format + pte->footer.generic.parm16 = footer->generic.parm16; + + //use footer data to determine the length of the binary data or parameters + format = PK_GET_TRACE_FORMAT(pte->footer.generic.time_format.word32); + switch(format) + { + case PK_TRACE_FORMAT_TINY: + pte->footer.generic.parm16 = ntohs(pte->footer.generic.parm16); + parm_size = 0; + entry_size = sizeof(PkTraceEntryFooter); + break; + + case PK_TRACE_FORMAT_BIG: + parm_size = pte->footer.generic.bytes_or_parms_count * sizeof(uint32_t); + entry_size = sizeof(PkTraceEntryFooter); + break; + + case PK_TRACE_FORMAT_BINARY: + parm_size = pte->footer.generic.bytes_or_parms_count; + entry_size = sizeof(PkTraceEntryFooter); + break; + + default: + entry_size = 0; + parm_size = 0; + break; + } + + //pad to 8 byte boundary + parm_size = (parm_size + 7) & ~0x00000007ul; + + //add the parameter size to the total entry size + entry_size += parm_size; + + //copy the entry from the circular buffer to pte + start_index = (offset - entry_size) & mask; + bytes_left = ntohs(tb->size) - start_index; + + //only copy up to the end of the circular buffer + if(parm_size < bytes_left) + { + bytes_to_copy = parm_size; + } + else + { + bytes_to_copy = bytes_left; + } + + dest += sizeof(LargestPpeEntry) - entry_size; + memcpy(dest, &tb->cb[start_index], bytes_to_copy); + + //now copy the rest of the data starting from the beginning of the + //circular buffer. + if(bytes_to_copy < parm_size) + { + memcpy(dest + bytes_to_copy, tb->cb, parm_size - bytes_to_copy); + } + + //return the size of the entry + return entry_size; +} + +//convert a ppe trace buffer to an fsp trace buffer +int ppe2fsp(void* in, size_t in_size, void* out, size_t* io_size) +{ + PkTraceBuffer* ptb = (PkTraceBuffer*)in; + trace_buf_head_t* ftb = (trace_buf_head_t*)out; + uint32_t ppe_bytes_left; + uint32_t fsp_bytes_left; + int rc = 0; + uint32_t ptb_offset; + uint64_t ppe_time64; + uint32_t fte_size, pte_size; + uint32_t fsp_te_count = 0; + uint32_t time_diff32, prev_time32, new_time32; + PkTraceGeneric* pte_footer; + largest_fsp_entry_t fte; + LargestPpeEntry pte; + uint64_t time_adj64; + + do + { + if(!ptb || !ftb || !io_size) + { + rc = P2F_NULL_POINTER; + break; + } + + if(ntohs(ptb->version) != PK_TRACE_VERSION) + { + rc = P2F_INVALID_VERSION; + break; + } + + //check that the input buffer is large enough to have a ppe trace buffer + if(in_size < (((uintptr_t)(&ptb->cb[0])) - (uintptr_t)(ptb))) + { + rc = P2F_INPUT_BUFFER_TOO_SMALL; + break; + } + + //initialize some locals + fsp_bytes_left = *io_size - sizeof(trace_buf_head_t); + ppe_bytes_left = ntohs(ptb->size); + ptb_offset = ntohl(ptb->state.offset); + if(htonl(1) == 1) + { + time_adj64 = ptb->time_adj64; + } + else + { + time_adj64 = ntohl((uint32_t)(ptb->time_adj64 >> 32)); + time_adj64 |= ((uint64_t)(ntohl((uint32_t)(ptb->time_adj64 & 0x00000000ffffffff)))) << 32; + } + + //make sure the ppe buffer size is a power of two + if((ppe_bytes_left - 1) & ppe_bytes_left) + { + //size is not a power of two + rc = P2F_INVALID_INPUT_SIZE; + break; + } + + //The ppe bytes field should always be a multiple of 8 + if(ptb_offset & 0x7) + { + rc = P2F_INVALID_PPE_OFFSET; + break; + } + + //make sure there is enough room for the fsp header + if(*io_size < sizeof(trace_buf_head_t)) + { + rc = P2F_OUTPUT_BUFFER_TOO_SMALL; + break; + } + + + //initialize the fsp header + ftb->ver = TRACE_BUF_VERSION; + ftb->hdr_len = sizeof(trace_buf_head_t); + ftb->time_flg = TRAC_TIME_REAL; + ftb->endian_flg = 'B'; //big endian + memcpy(ftb->comp, ptb->image_str, sizeof(ftb->comp)); + ftb->times_wrap = htonl(1); + ftb->size = htonl(sizeof(trace_buf_head_t) + sizeof(uint32_t)); + ftb->next_free = htonl(sizeof(trace_buf_head_t)); + ftb->extracted = htonl(0); + ftb->te_count = htonl(0); + + //find the latest timestamp so that we can work back from there + ppe_time64 = ((uint64_t)(ntohl(ptb->state.tbu32) & 0xefffffff)) << 32; + pte_size = ppe_get_entry(ptb, ptb_offset, &pte); + prev_time32 = PK_GET_TRACE_TIME(pte.footer.generic.time_format.word32); + ppe_time64 |= prev_time32; + + //process all of the input bytes one trace entry at a time + //from newest to oldest (backwards) until we run out of input bytes or + //we run out of output space. + while(1) + { + //check if we have enough data for a ppe footer + if(ppe_bytes_left < sizeof(PkTraceEntryFooter)) + { + break; + } + + //get the next ppe entry + pte_size = ppe_get_entry(ptb, ptb_offset, &pte); + + //Stop if there are no more entries to retrieve from the ppe trace buffer + if(!pte_size) + { + break; + } + pte_footer = &pte.footer.generic; + + //mark the entry as incomplete if we didn't have enough data + //for the entire entry + if(pte_size > ppe_bytes_left) + { + pte_footer->complete = 0; + ppe_bytes_left = 0; + } + else + { + ppe_bytes_left -= pte_size; + ptb_offset -= pte_size; + } + + //Calculate the 64 bit timestamp for this entry.... + //On PPE, getting the timestamp is not done atomically with writing + //the entry to the buffer. This means that an entry with an older + //timestamp could possibly be added to the buffer after an entry + //with a newer timestamp. Detect this condition by checking if the + //time difference is bigger than the max difference. The max + //difference is enforced by the PPE having a trace added on a + //shorter time boundary (using a timer). + new_time32 = PK_GET_TRACE_TIME(pte_footer->time_format.word32); + time_diff32 = prev_time32 - new_time32; + + if(time_diff32 > ntohl(ptb->max_time_change)) + { + time_diff32 = new_time32 - prev_time32; + ppe_time64 += time_diff32; + } + else + { + ppe_time64 -= time_diff32; + } + + //save off the lower 32bit timestamp for the next iteration + prev_time32 = new_time32; + + //convert the ppe trace entry to an fsp trace entry + fte_size = pte2fte(ptb, &pte, pte_size, &fte, ppe_time64 + time_adj64); + + //fit as much of the entry into the fsp trace buffer as possible + fsp_put_entry(ftb, &fte, fte_size, fsp_bytes_left); + + //update the fsp trace entry count + fsp_te_count++; + + //stop if there is no more room left in the fsp trace buffer + if(fte_size >= fsp_bytes_left) + { + fsp_bytes_left = 0; + ftb->times_wrap = htonl(1); + break; + } + else + { + fsp_bytes_left -= fte_size; + } + }//while(1) + + + //shift the trace data up if there is space to do so + if(fsp_bytes_left) + { + char* dest = ((char*)ftb) + sizeof(trace_buf_head_t); + char* src = dest + fsp_bytes_left; + size_t data_size = *io_size - sizeof(trace_buf_head_t) - fsp_bytes_left; + memmove(dest, src, data_size); + } + + //update the fsp header to reflect the true size and entry count + ftb->te_count = htonl(fsp_te_count); + + //inform the caller of how many bytes were actually used + *io_size -= fsp_bytes_left; + + //shrink the size field to what we actually ended up using + ftb->size = htonl(*io_size); + + }while(0); + + return rc; +} + + + diff --git a/src/tools/trace/ppe2fsp.h b/src/tools/trace/ppe2fsp.h new file mode 100644 index 00000000..56f0a0bd --- /dev/null +++ b/src/tools/trace/ppe2fsp.h @@ -0,0 +1,33 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/tools/trace/ppe2fsp.h $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* */ +/* */ +/* 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 */ +#include + +#define P2F_NULL_POINTER 1 +#define P2F_INVALID_INPUT_SIZE 2 +#define P2F_INVALID_PPE_OFFSET 3 +#define P2F_OUTPUT_BUFFER_TOO_SMALL 4 +#define P2F_INPUT_BUFFER_TOO_SMALL 5 +#define P2F_INVALID_VERSION 6 + +int ppe2fsp(void* in, size_t in_size, void* out, size_t* io_size); diff --git a/src/tools/trace/ppe2fsp_cmd.c b/src/tools/trace/ppe2fsp_cmd.c new file mode 100644 index 00000000..bab51ab5 --- /dev/null +++ b/src/tools/trace/ppe2fsp_cmd.c @@ -0,0 +1,138 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/tools/trace/ppe2fsp_cmd.c $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 */ +#include +#include "ppe2fsp.h" +#include "pk_trace.h" + +#define MAX_INPUT_SIZE 0x2040 //8k +#define MAX_OUTPUT_SIZE (4 * MAX_INPUT_SIZE) + +char* inbuf[MAX_INPUT_SIZE]; +char* outbuf[MAX_OUTPUT_SIZE]; +; +int main(int argc, char** argv) +{ + FILE* in; + FILE* out; + size_t input_size; + size_t output_size; + size_t bytes_written; + int rc = -1; + + do + { + if(argc > 3) + { + fprintf(stderr, "Usage: %s [input file] [output file]\n", argv[0]); + } + + if(argc < 3) + { + out = stdout; + } + else + { + //open the output file for writing + out = fopen(argv[2], "w"); + if(!out) + { + perror("failed to open file for writing"); + break; + } + } + + if(argc < 2) + { + in = stdin; + } + else + { + //open the input file for reading + in = fopen(argv[1], "r"); + if(!in) + { + perror("failed to open file for reading"); + break; + } + } + + //read the input stream until we reach EOF or the max size + input_size = fread(inbuf, 1, MAX_INPUT_SIZE, in); + if(!feof(in)) + { + if(ferror(in)) + { + perror("failed to read input file"); + break; + } + else + { + fprintf(stderr, "Input stream exceeds max size of %d bytes. Exiting.\n", MAX_INPUT_SIZE); + break; + } + } + + output_size = MAX_OUTPUT_SIZE; + + //Actual size of output buffer will be set upon successful completion + rc = ppe2fsp(inbuf, input_size, outbuf, &output_size); + if(rc) + { + fprintf(stderr, "Failed converting ppe trace to fsp trace. rc = %d\n", rc); + if(rc == P2F_INVALID_VERSION) + { + fprintf(stderr, "PPE trace buffer must be version %d.\n", PK_TRACE_VERSION); + } + break; + } + + rc = -1; + //operation was successful. Write out the fsp trace data + bytes_written = fwrite(outbuf, 1, output_size, out); + if(bytes_written != output_size) + { + if(ferror(out)) + { + perror("Failed to write output stream"); + break; + } + fprintf(stderr, "Failure: Only able to write %d of %d bytes to output stream\n", bytes_written, output_size); + break; + } + + fclose(in); + fclose(out); + fclose(stderr); + + rc = 0; + }while(0); + + return rc; +} + + + + + + diff --git a/src/tools/trace/ppetracepp.C b/src/tools/trace/ppetracepp.C new file mode 100755 index 00000000..9d795371 --- /dev/null +++ b/src/tools/trace/ppetracepp.C @@ -0,0 +1,949 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/tools/trace/ppetracepp.C $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* */ +/* */ +/* 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 */ + +/* +# *** ppetracepp - a fsp/common Linux trace pre processor +# this one replaces the trace strings by the corresponding hash value +# (i.e. the complete call to trace_ppe_hash is replaced) + +# *** Usage +# +# prepend compiler call with the call of this pre processor, i.e if you have +# $(CC) $(CFLAGS) -o $@ $< +# in your Makefile change it to this: +# ppetracepp $(CC) $(CFLAGS) -o $@ $< +# ppetracepp will use "$(CC) -E" to call the C pre processor "cpp". +# you can set a env var "REALCPP" to the name of a program to select +# a different programm as cpp +# +# ppetracepp creates a file "$target.ppe.hash" with the trace strings and the hash values. +# +# to enable debug mode set envvar PPETRACEPPDEBUG to 1 or give '-d' as first arg + +# *** Change History +# +# 2003-02-26 RBa created from scratch +# 2003-02-28 RBa add C++ support (C++ interface uses own type for the hash) +# 2003-05-28 RBa if cc should link instead of compile just call compiler +# 2003-07-11 AGe Change search alg. slightly and put just format back +# 2003-07-25 RBa just call gcc if called to link instead to compile +# eat argument for option -x +# 2003-11-26 RBa fix c/c++ algo: compile as c++ if realcc=*g++ +# 2004-02-02 RBa remove explicit test whether source file is readable +# it is obsolete and might lead to an error if afs is used +# 2004-02-13 RBa add support for dependency generation (-MD/-MG, -MF) +# don't prepend './' to object filename +# 2006-04-19 RBa rewrite trace_ppe_write_all support, handle C and C++ the same +# 2006-05-24 RBa fix handling of missing -o ; add TRAC_PPVER for macro/API version +# 2006-09-15 RBa add handling of \" in trace format strings ; reduce non-error output +# put object file in current dir if no -o given +# 2007-03-22 RBa handle more gcc options (-i) ; protect " in call to shell +# store output of cpp as "unmodified" output for debug +# only write string/hash file if strings found +# 2012-09-24 hlava Rewritten as C program for better build performance (was perl) +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +typedef u_int32_t u32 ; +typedef u_int8_t u8 ; +#include + +using namespace std; + +static string version = "2.0"; +static string macro_version = "1"; + +static bool debug = false; +#define dprintf(format, ...) if (debug) { printf(format, ##__VA_ARGS__); fflush(stdout); } +static map hashtab; +static string hashtype; +static string hashtype_suffix; + +static string tmp; +static string cmd; +static FILE* CPP = NULL; // pipe from preprocessor +static FILE* CC = NULL; // pipe to compiler +static FILE* DEBUG = NULL; +static FILE* DEBUGIN = NULL; + +//***************************************************************************** +// replace_substr +//***************************************************************************** +void replace_substr(std::string& str, const std::string& oldStr, const std::string& newStr) +{ + size_t pos = 0; + while((pos = str.find(oldStr, pos)) != std::string::npos) + { + str.replace(pos, oldStr.length(), newStr); + pos += newStr.length(); + } + +} + +//***************************************************************************** +// fileparse +//***************************************************************************** +void fileparse(const string& in_str, string& name, string& dir, string& suff) +{ + string str(in_str); + size_t pos; + name = ""; + dir = ""; + suff = ""; + pos = str.find_last_of('.'); + if (pos != string::npos) + { + suff = str.substr(pos); + str = str.substr(0, pos); + } + pos = str.find_last_of('/'); + if (pos != string::npos) + { + name = str.substr(pos+1); + str = str.substr(0, pos+1); + } + dir = str; +} + +static const size_t TRACE_PPE_HASH_LEN = 13; +//***************************************************************************** +// chop_up_line +//***************************************************************************** +bool chop_up_line(string& in_line, string& prefix, string& strings, string& salt, string& suffix) +{ + // First see if this line matches the pattern we're looking for + // Since this will return false 95%+ of the time this function it called, we do it + // before doing any other init for performance reasons. + size_t pos = in_line.find("trace_ppe_hash"); + if (pos == string::npos) { return(false); } + + // trace_ppe_hash ( "..." ".." "..." , 2 ) + // regex: PREFIX 'trace_ppe_hash' space '(' space STRINGS space ',' space NUMBER space ')' SUFFIX + // STRINGS: '"' .* '"' space? + + + // Original perl magic incantation: + // while($line =~ m/^(.*?)trace_ppe_hash\s*\(\s*((".*?(? $1 = everything up to the word "trace_ppe_hash" + // trace_ppe_hash = delimiter + // \s*\(\s* = delimiter = <0-n whitespace chars>, left paren, <0-n whitespace chars> + // ((".*?(? $2 = double-quote, some chars up to last closing double-quote ($3 used for nested regex) + // ,\s* = delimiter = comma followed by some whitespace + // (-?\d+)\s*\)(.*) => $4 and $5 + // $/) = end of the line input string + string line(in_line); + prefix = ""; + strings = ""; + salt = ""; + suffix = ""; + size_t pos1; + size_t pos2; + size_t pos3; + + pos1 = pos + 14; // pos1 = after "trace_ppe_hash" + pos2 = line.find("(", pos1); + if (pos2 == string::npos) { return(false); } + ++pos2; + pos3 = line.find("\"", pos2); + if (pos3 == string::npos) { return(false); } + dprintf("--------\nchop_up_line: Passed basic checks. line= %s\n", line.c_str()); + dprintf("pos1=%d, pos2=%d, pos3=%d\n", pos1, pos2, pos3); + if ((pos1 != (pos2-1)) && (line.find_first_not_of(" \t", pos1, (pos2-pos1)+1) != string::npos)) { return(false); } //non-whitespace? + if ((pos2 != pos3) && (line.find_first_not_of(" \t", pos2, (pos3-pos2)) != string::npos)) { return(false); } //non-whitespace? + + // Get the prefix data + dprintf(">chop_up_line(\"%s\",...)\n", line.c_str()); + prefix = line.substr(0, pos); + line = line.substr(pos + TRACE_PPE_HASH_LEN); + dprintf(" prefix=\"%s\"\n", prefix.c_str()); + + // Get the strings and join/fix them: Store all strings between paired double-quotes up to the + // first comma not inside a string + pos = line.find_first_of('('); + if (pos == string::npos) { return(false); } + line = line.substr(pos + 1); + strings = ""; + while(!line.empty()) + { + pos = line.find_first_of(','); + pos1 = line.find_first_of('"'); + if ((pos1 == string::npos) || ((pos != string::npos) && (pos < pos1))) { break; } // found comma before next quote + pos2 = line.find_first_of('"', (pos1+1)); + if (pos2 == string::npos) { return(false); } // unbalanced quotes! + while(line[pos2-1] == '\\') // skip escaped quotes in the string (they're not the ending quote) + { + pos2 = line.find_first_of('"', (pos2+1)); + if (pos2 == string::npos) { return(false); } // unbalanced quotes! + } + if (!strings.empty()) { strings += " "; } + strings += line.substr(pos1, (pos2-pos1)+1); + line = line.substr(pos2+1); + } + replace_substr(strings, "\" \"", ""); + replace_substr(strings, "\\\"", "ESCAPEDQUOTE"); + replace_substr(strings, "\"", ""); + replace_substr(strings, "ESCAPEDQUOTE", "\""); + // Remove trailing whitespace ah20130717 + pos = strings.find_last_not_of(" \t\n"); + if ((pos != string::npos) && (pos < (strings.length()-1))) + { + strings = strings.substr(0, pos+1); + } + + dprintf(" strings>%s<\n", strings.c_str()); + + // Get the salt + pos = line.find(","); + if (pos != string::npos) { line = line.substr(pos+1); } + pos = line.find_first_of(')'); + if (pos == string::npos) { return(false); } + salt = line.substr(0, pos); + line = line.substr(pos+1); + //dprintf(" salt=\"%s\"\n", salt.c_str()); + pos = salt.find_first_not_of(" \t\n"); + if (pos == string::npos) { return(false); } + salt = salt.substr(pos); + pos = salt.find_last_not_of(" \t\n"); + if (pos == string::npos) { return(false); } + salt = salt.substr(0, pos+1); + dprintf(" salt=\"%s\"\n", salt.c_str()); + + // Get the suffix (i.e. the rest) + suffix = line; + if (suffix[suffix.length()-1] == '\n') { suffix = suffix.substr(0, suffix.length()-1); } + dprintf(" suffix=\"%s\"\nget_hash(\"%s\",%d)\n", str.c_str(), salt_num); + + // Call jhash function to get the hash value + hash_num = jhash((void*)str.c_str(), str.length(), salt_num); + dprintf("jhash() returned: %u\n", hash_num); + sprintf(buf, "%u", hash_num & 0x0000ffff); + hash16 = buf; + sprintf(buf, "%u", ((salt_num << 16) | (hash_num & 0x0000ffff))); + hash32 = buf; + + // validate the hash value + size_t pos = hash32.find_first_not_of("0123456789"); + if (pos != string::npos) + { + fprintf(stderr, "trexhash error: %s\n", hash32.c_str()); + fprintf(stderr, "for call <<%s>>\n", cmd.c_str()); + exit(1); + } + +//removing this since it doesn't seem to have any affect on the output +#if 0 + // If hash is empty, use the sum of the ord values in the original string + if ((hash == "")||(hash == "0")) + { + unsigned int len = str.length(); + unsigned int hash_num = 0; + //unsigned char conv_buf[2] = { '\0', '\0' }; + u_int8_t conv_num; + for (unsigned int i=0; i < len; ++i) + { + //conv_buf[0] = str[i]; + conv_num = (u_int8_t)str[i]; + hash_num += (unsigned int)conv_num; + } + } +#endif + + dprintf("& rhash, string& line, string& out_line) +{ + // NOTE: "line" arg may get modified by this function! Caller must not assume it's unchanged. + string format; + string prefix; + string strings; + string tmp; + string salt; + string hash16; + string hash32; + int salt_num; + int format_salt; + string suffix; + string write_all_suffix; + size_t pos; + + out_line = ""; + // trace_ppe_hash ( "..." ".." "..." , 2 ) + // regex: PREFIX 'trace_ppe_hash' space '(' space STRINGS space ',' space NUMBER space ')' SUFFIX + // STRINGS: '"' .* '"' space? + + //while($line =~ m/^(.*?)trace_ppe_hash\s*\(\s*((".*?(? 1) arg = argv[1]; + if ((argc < 2) || (arg == "-h")) + { + fprintf(stderr, "usage: %s realcompiler compileroptions -o target source\n", argv[0]); + exit(9); + } + string realcc(argv[argi++]); + string cctype("c++"); + bool optx_found = false; + + if (realcc == "-d") + { + debug = true; + realcc = argv[argi++]; + } + + // wait until -d options is handled before checking $debug + dprintf("ppetracepp version %s - API/macro version %s\n", version.c_str(), macro_version.c_str()); + + p_env = getenv("REALCPP"); + string realcpp; + if (p_env) + realcpp = p_env; + if (realcpp.empty()) + { + dprintf("cannot find cpp, using -E\n"); + realcpp = realcc; + realcpp += " -E"; + } + dprintf("realcpp is %s\n", realcpp.c_str()); + +//------------------------------------------------------------------------------ +// parse all the arguments +//------------------------------------------------------------------------------ +string source; +string object; +vector ccopts; +vector cppopts; +bool dodeps = false; +string depfile; +string pfx; +string sfx; +int origargi = argi; +for( ; argi < argc; ++argi) +{ + arg = argv[argi]; + dprintf("Processing argv[%d]: \"%s\"\n", argi, arg.c_str()); + if (arg.length() > 2) + { + pfx = arg.substr(0,2); + sfx = arg.substr(arg.length()-2); + } + else + { + pfx = arg; + sfx = arg; + } + dprintf(" pfx: \"%s\" sfx: \"%s\"\n", pfx.c_str(), sfx.c_str()); + + if (pfx == "-o") + { + if (! object.empty()) + { + fprintf(stderr, "two -o options, aborting\n"); + exit(1); + } + if (arg.length() > 2) + { + object = sfx; + } + else + { + object = argv[++argi]; + } + dprintf("object is now %s\n", object.c_str()); + } + else if (arg == "-c") + { + // don't call cpp with -c, this is for the compiler + ccopts.push_back(arg); + dprintf("found -c option\n"); + } + else if (pfx == "-l") + { + // cpp doesn't need library arguments + cppopts.push_back(arg); + } + else if (pfx == "-i") + { + // option takes an argument, handle it too + optarg = argv[argi++]; + ccopts.push_back(arg); + ccopts.push_back(optarg); + cppopts.push_back(arg); + cppopts.push_back(optarg); + dprintf("found option '%s %s'\n", arg.c_str(), optarg.c_str()); + } + else if ((arg == "-L") || + (arg == "-I") || + (arg == "-x") || + (arg == "-b") || + (arg == "-B") || + (arg == "-V") || + (arg == "-D") || + (arg == "--param") || + (arg == "-MQ") || + (arg == "-MT")) + { + // option takes an argument, handle it too + optarg = argv[argi++]; + ccopts.push_back(arg); + ccopts.push_back(optarg); + cppopts.push_back(arg); + cppopts.push_back(optarg); + dprintf("found option '%s %s'\n", arg.c_str(), optarg.c_str()); + if (arg == "-x") + { + // option x sets the language - c or c++ + if ((optarg != "c") && (optarg != "c++") && (optarg != "assembler-with-cpp")) + { + fprintf(stderr, "cannot process language '%s', aborting\n", optarg.c_str()); + exit(1); + } + cctype = optarg; + optx_found = true; + } + } + else if ((arg == "-MD")||(arg == "-MG")) + { + // gen deps + dodeps = true; + dprintf("found %s, creating dependencies\n", arg.c_str()); + } + else if (arg == "-MF") + { + // set dependencies file + depfile = argv[argi++]; + dprintf("set dependencies file to '%s'\n", depfile.c_str()); + } + else if (arg[0] == '-') + { + // arg starts with - so it's an option + ccopts.push_back(arg); + cppopts.push_back(arg); + dprintf("found option '%s'\n", arg.c_str()); + } + else if ((sfx == ".a") || + (sfx == ".o")) + { + // an object or archive, ignore this but give it to cc + ccopts.push_back(arg); + dprintf("found object/archive '%s'\n", arg.c_str()); + } + else if ((sfx == ".c") || + (sfx == ".C") || + (sfx == ".S") || + (arg.substr(arg.length()-4) == ".cpp") || + (arg.substr(arg.length()-4) == ".cxx")) + { + // the source file(s). we should only get one + if (!source.empty()) + { + fprintf(stderr, "don't know to handle two source files, aborting\n"); + exit(1); + } + source = arg; + // put the - (for read-from-stdin) where the source file was + // (order is important!) + ccopts.push_back("-"); + dprintf("found source file %s\n", source.c_str()); + } + else if (access(arg.c_str(), F_OK)) + { + // option but not a file, an unknown option? + ccopts.push_back(arg); + cppopts.push_back(arg); + dprintf("found unknown option '%s'\n", arg.c_str()); + } +} + +//------------------------------------------------------------------------------ +// set other parameters based on arguments specified +//------------------------------------------------------------------------------ +if (source.empty()) +{ + // this might be a call to link a program instead of compile a source (or asm source) + dprintf("NOTME: starting as cc '%s ...'\n", realcc.c_str()); + execvp(realcc.c_str(), &(argv[origargi])); + fprintf(stderr, "ERROR: returned from execvp() call to run %s\n", realcc.c_str()); +} +if (object.empty()) +{ + dprintf("no object file given, default to source name\n"); + // gcc builds object name from source name if no -o given, replacing + // suffix with .o. The file is placed in the current directory, + // not in the source directory! + string n; + string d; + string s; + fileparse(source, n, d, s); + if (!n.empty() && !s.empty()) + { + object = n + ".o"; + dprintf("tracpp: guessing object name %s\n", object.c_str()); + dprintf(" from source name %s\n", source.c_str()); + } + else + { + fprintf(stderr, "Unable to determine Source File Name\n"); + exit(1);; + } +} + +// set value of trace hash according to language +// check source file extension if no explicit -x option given +if (!optx_found) +{ + if (realcc.find("g++") != string::npos) + { + dprintf("compiler language: C++ (from compiler name)\n"); + cctype = "c++"; + } + else + { + if (source.substr(source.length()-2) == ".c") + { + dprintf("compiler language: C (from source file extension)\n"); + cctype = "c"; + } + else if (source.substr(source.length()-2) == ".S") + { + dprintf("compiler language: assembly (from source file extension)\n"); + cctype = "assembler-with-cpp"; + } + else + { + dprintf("compiler language: C++ (default)\n"); + cctype = "c++"; + } + } +} +else +{ + dprintf("compiler language: %s (from option '-x')\n", cctype.c_str()); +} + +if (cctype == "c") +{ + hashtype = "(unsigned short)"; + hashtype_suffix = "U"; +} +else if (cctype == "assembler-with-cpp") +{ + hashtype = ""; + hashtype_suffix = ""; +} +else +{ + hashtype = "(trace_hash_val)"; + hashtype_suffix = "U"; +} +// define TRAC_PPETRACEPP for macros +tmp = "-DTRAC_PPETRACEPP -DTRAC_PPVER="; +tmp += macro_version; +cppopts.push_back(tmp); +if (dodeps) +{ + if (depfile.empty()) + { + if ((p_env = getenv("DEPENDENCIES_OUTPUT")) != NULL) + { + depfile = p_env; + } + else if ((p_env = getenv("SUNPRO_DEPENDENCIES")) != NULL) + { + depfile = p_env; + } + else + { + depfile = object; + if (depfile.substr(depfile.length()-2) == ".o") + { + depfile = depfile.substr(0, depfile.length()-2); + depfile += ".d"; + } + } + } + tmp = "-MD -MF "; + tmp += depfile; + cppopts.push_back(tmp); +} + +//------------------------------------------------------------------------------ +// start cpp +//------------------------------------------------------------------------------ +cmd = realcpp; +for(vector::iterator p = cppopts.begin(); p != cppopts.end(); ++p) +{ + cmd += " "; + cmd += *p; +} +cmd += " "; +cmd += source; +cmd += " -o-"; +dprintf("starting as cpp '%s'\n", cmd.c_str()); +CPP = popen(cmd.c_str(), "r"); +if (CPP == NULL) +{ + fprintf(stderr, "cannot start cpp '%s'\n", realcpp.c_str()); + perror(""); + exit(1); +} + +//------------------------------------------------------------------------------ +// start cc. manually set language as source file extension not available to cc +//------------------------------------------------------------------------------ +string type_str = ""; +if (!optx_found) +{ + // no option -x given by caller, set manually + type_str = "-x "; + type_str += cctype; +} +cmd = realcc; +cmd += " "; +cmd += type_str; +for(vector::iterator p = ccopts.begin(); p != ccopts.end(); ++p) +{ + cmd += " "; + cmd += *p; +} +cmd += " -o "; +cmd += object; +dprintf("starting as cc '%s'\n", cmd.c_str()); +CC = popen(cmd.c_str(), "w"); +if (CC == NULL) +{ + fprintf(stderr, "cannot start cc '%s'\n", realcc.c_str()); + perror(""); + exit(1); +} + +string modifiedfile; +string unmodifiedfile; +if (debug) +{ + modifiedfile = object + ".debug"; + DEBUG = fopen(modifiedfile.c_str(), "w"); + if (DEBUG == NULL) + { + string msg = "cannot open file "; + msg += modifiedfile; + perror(msg.c_str()); + modifiedfile = ""; + } + else + { + fprintf(stderr, "writing preprocessed source to %s\n", modifiedfile.c_str()); + } + unmodifiedfile = object + ".debug_in"; + DEBUGIN = fopen(unmodifiedfile.c_str(), "w"); + if (DEBUGIN == NULL) + { + string msg = "cannot open file "; + msg += unmodifiedfile; + perror(msg.c_str()); + unmodifiedfile = ""; + } + else + { + fprintf(stderr, "writing unprocessed source to %s\n", unmodifiedfile.c_str()); + } +} + +string oldline; +string newline; +static const int MAX_BUFFER = 51200; +char buf[MAX_BUFFER]; +while (!feof(CPP)) +{ + if (fgets(buf, MAX_BUFFER, CPP) != NULL) + { + oldline = buf; + if (DEBUGIN) { fprintf(DEBUGIN, "%s", oldline.c_str()); } + parse_line(hashtab, oldline, newline); + //#print "oldline = $oldline"; + //#print "newline = $newline"; + if (newline.empty()) + { + fprintf(stderr, "hash error in/with file %s\n", source.c_str()); + exit(1); + } + //#print "newline = $newline\n"; + fprintf(CC, "%s", newline.c_str()); + if (DEBUG) { fprintf(DEBUG, "%s", newline.c_str()); } + } +} +if (DEBUG) { fclose(DEBUG); } +if (DEBUGIN) { fclose(DEBUGIN); } +int cmd_rc = pclose(CPP); +if (cmd_rc) +{ + fprintf(stderr, "error from cpp\n"); + if (cmd_rc & 127) + { + fprintf(stderr, "cpp got signal %d\n", (cmd_rc & 127)); + exit(1); + } + else if (cmd_rc >> 8) + { + fprintf(stderr, "cpp returned %d\n", (cmd_rc >> 8)); + exit(cmd_rc >> 8); + } +} +cmd_rc = pclose(CC); +if (cmd_rc) +{ + fprintf(stderr, "error from cc\n"); + if (cmd_rc & 127) + { + fprintf(stderr, "cc got signal %d\n", (cmd_rc & 127)); + exit(1); + } + else if (cmd_rc >> 8) + { + fprintf(stderr, "cc returned %d\n", (cmd_rc >> 8)); + exit(cmd_rc >> 8); + } +} + +if (!hashtab.empty()) +{ + string stringfile = object; + stringfile += ".ppe.hash"; + // open trace string file + FILE* TRC = fopen(stringfile.c_str(), "w"); + if (TRC == NULL) + { + fprintf(stderr, "cannot write trace string file '%s'\n", stringfile.c_str()); + exit(1); + } + dprintf("Writing to file %s\n", stringfile.c_str()); + + string pwd; + FILE* PWD = popen("pwd", "r"); + fgets(buf, MAX_BUFFER, PWD); + pwd = buf; + pclose(PWD); + time_t tt = time(NULL); + sprintf(buf, "%s", asctime(localtime(&tt))); + buf[strlen(buf)-1] = '\0'; // chop off extra newline + fprintf(TRC, "#FSP_TRACE_v2|||%s|||BUILD:%s", buf, pwd.c_str()); + + string srch_str = "||"; + srch_str += source; + int srch_str_len = srch_str.length(); + size_t pos; + for(map::iterator p = hashtab.begin(); p != hashtab.end(); ++p) + { + pos = (p->second).find(srch_str); + if ((pos != string::npos) && ((pos + srch_str_len) == (p->second).length())) + { + // source file name is already part of the string + fprintf(TRC, "%s||%s\n", (p->first).c_str(), (p->second).c_str()); + } + else + { + fprintf(TRC, "%s||%s||%s\n", (p->first).c_str(), (p->second).c_str(), source.c_str()); + } + //#print TRC "$key||$source||$hashtab{$key}\n"; + } + fclose(TRC); +} +else +{ + dprintf("No trace calls/strings found, not writing hash file\n"); +} +} // end main diff --git a/src/tools/trace/trac_interface.h b/src/tools/trace/trac_interface.h new file mode 100755 index 00000000..ce9355ae --- /dev/null +++ b/src/tools/trace/trac_interface.h @@ -0,0 +1,369 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/tools/trace/trac_interface.h $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* */ +/* */ +/* 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 */ +/****************************************************************************** +// @file trac_interface.h +// @brief Interface codes for TRAC component. +*/ +/****************************************************************************** + * + * @page ChangeLogs Change Logs + * @section _trac_interface_h trac_interface.h + * @verbatim + * + * Flag Def/Fea Userid Date Description + * ------- ---------- -------- ---------- ---------------------------------- + * TEAM 06/16/2010 Port + * @rc003 rickylie 02/03/2012 Verify & Clean Up OCC Headers & Comments + * @pb00E pbavari 03/11/2012 Added correct include file + * @at009 859308 alvinwan 10/15/2012 Added tracepp support + * @ai005 860268 ailutsar 11/20/2012 Create trace test applet + * @rc005 864101 rickylie 12/12/2012 add small circ buffer to handle ISR semaphore conflict + * + * @endverbatim + * + *///*************************************************************************/ + +#ifndef _TRAC_INTERFACE_H +#define _TRAC_INTERFACE_H + +/** \defgroup Trace Trace Component + * Port of the trace code used in the fsp and tpmd. + */ + +//************************************************************************* +// Includes +//************************************************************************* + +//************************************************************************* +// Externs +//************************************************************************* + +//************************************************************************* +// Macros +//************************************************************************* +/** + * \defgroup TracMacros Trace Component Macro Interfaces + * \ingroup Trace + * Used to trace 0 - 5 arguments or a binary buffer when using a hash value. + */ +/*@{*/ + + +// @at009c - start +#define TRACE(i_td,i_string,args...) \ + trace_adal_write_all(i_td,trace_adal_hash(i_string,-1),__LINE__,0,##args) + +#define TRACEBIN(i_td,i_string,i_ptr,i_size) \ + trac_write_bin(i_td,trace_adal_hash(i_string,0),__LINE__,i_ptr,i_size) + +#ifndef NO_TRAC_STRINGS + +#define FIELD(a) \ + printf("%s",a) + +#define FIELD1(a,b) \ + printf("%s%lx",a,(unsigned long)b) + +#else // NO_TRAC_STRINGS + +#define FIELD(a) + +#define FIELD1(a,b) + +#endif // NO_TRAC_STRINGS + +#define SUCCESS 0 +// @at009c - end + + + +/*@}*/ + +//************************************************************************* +// Defines/Enums +//************************************************************************* +#define TRACE_MAX_ARGS 5 /*!< Maximum number of args to trace */ + +typedef uint32_t trace_hash_val; + +// NOTE! Increment this when new components are added! +#define TRAC_NUM_TRACE_COMPONENTS 1 + + +#define TRACE_BUFFER_SIZE 8192 // @ai005a + +#define CIRCULAR_BUFFER_SIZE 4 // @rc005a + +typedef uint32_t UINT32; +typedef int32_t INT32; +typedef uint8_t UCHAR; +typedef uint8_t UINT8; +typedef int8_t INT8; +typedef uint16_t UINT16; +typedef int16_t INT16; +typedef char CHAR; +typedef unsigned int UINT; +typedef unsigned long ULONG; +typedef int INT; +typedef void VOID; + +//************************************************************************* +// Structures +//************************************************************************* +/* + * @brief Structure is put at beginning of all trace buffers + */ +typedef struct trace_buf_head { + UCHAR ver; /*!< version of this struct (1) */ + UCHAR hdr_len; /*!< size of this struct in bytes */ + UCHAR time_flg; /*!< meaning of timestamp entry field */ + UCHAR endian_flg; /*!< flag for big ('B') or little ('L') endian */ + CHAR comp[16]; /*!< the buffer name as specified in init call */ + UINT32 size; /*!< size of buffer, including this struct */ + UINT32 times_wrap; /*!< how often the buffer wrapped */ + UINT32 next_free; /*!< offset of the byte behind the latest entry */ + UINT32 te_count; /*!< Updated each time a trace is done */ + UINT32 extracted; /*!< Not currently used */ +}trace_buf_head_t; + +/*! + * @brief Timestamp and thread id for each trace entry. + */ +typedef struct trace_entry_stamp { + UINT32 tbh; /*!< timestamp upper part */ + UINT32 tbl; /*!< timestamp lower part */ + UINT32 tid; /*!< process/thread id */ +}trace_entry_stamp_t; + +/* + * @brief Structure is used by adal app. layer to fill in trace info. + */ +typedef struct trace_entry_head { + UINT16 length; /*!< size of trace entry */ + UINT16 tag; /*!< type of entry: xTRACE xDUMP, (un)packed */ + UINT32 hash; /*!< a value for the (format) string */ + UINT32 line; /*!< source file line number of trace call */ +}trace_entry_head_t; + +/* + * @brief Parameter traces can be all contained in one write. + */ +typedef struct trace_entire_entry { + trace_entry_stamp_t stamp; + trace_entry_head_t head; + UINT32 args[TRACE_MAX_ARGS + 1]; +} trace_entire_entry_t; + + +/* + * @brief Binary first writes header and time stamp. + */ +typedef struct trace_bin_entry { + trace_entry_stamp_t stamp; + trace_entry_head_t head; +} trace_bin_entry_t; + +/** + * @brief Used as input to traces to get to correct buffer. + */ +typedef trace_buf_head_t * tracDesc_t; + +/* + * @brief Structure is used to hold array of all trace descriptors + */ +typedef struct trace_descriptor_array +{ + tracDesc_t *entry; /*!< Pointer to trace descriptor */ + CHAR *comp; /*!< Pointer to component name */ +}trace_descriptor_array_t; + +// @rc005a - start +typedef struct circular_buf_head +{ + UINT32 head; // pointer to head + UINT32 tail; // pointer to tail + UINT32 entryCount; // nums of entry +} circular_buf_header_t; + + +typedef struct circular_entire_data { + UINT32 len; + CHAR comp[4]; + trace_entire_entry_t entry; +} circular_entire_data_t; + +// @rc005a - end + +//************************************************************************* +// Globals +//************************************************************************* +// All TPMF component trace descriptors. +extern tracDesc_t g_trac_inf; // @at009a +extern tracDesc_t g_trac_err; // @at009a +extern tracDesc_t g_trac_imp; // @at009a + +extern const trace_descriptor_array_t g_des_array[]; + +//************************************************************************* +// Function Prototypes +//************************************************************************* + +/** + * \defgroup TracIntefaces Trace Component Interfaces for External Use + * \ingroup Trace + */ +/*@{*/ + + +/** + * @brief Allocate and initialize all trace buffers in memory. + * + * This function will allocate memory for each of the pre-defined trace + * buffers, initilize the buffers with starting data, and setup the + * trace descriptors which each component will use to trace. + * + * This function must be called first before any components try to trace! + * + * @return Non-zero return code on error. + */ +UINT TRAC_init_buffers(void); + +/** + * @brief Retrieve full trace buffer for component i_comp + * + * This function assumes memory has already been allocated for + * the full trace buffer in o_data. + * + * @param i_td_ptr Trace descriptor of buffer to retrieve. + * @param o_data Pre-allocated pointer to where data will be stored. + * + * @return Non-zero return code on error + */ +UINT TRAC_get_buffer(const tracDesc_t i_td_ptr, + void *o_data); + +/** + * @brief Retrieve partial trace buffer for component i_comp + * + * This function assumes memory has already been allocated for + * the trace buffer (size io_size). This function will copy + * in up to io_size in bytes to the buffer and set io_size + * to the exact size that is copied in. + * + * @param i_td_ptr Trace descriptor of buffer to retrieve. + * @param o_data Pre-allocated pointer to where data will be stored. + * @param io_size Size of trace data to retrieve (input) + * Actual size of trace data stored (output) + * + * @return Non-zero return code on error + */ +UINT TRAC_get_buffer_partial(const tracDesc_t i_td_ptr, + void *o_data, + UINT *io_size); + +/** + * @brief Retrieve trace descriptor for input component name + * + * @param i_comp Component name to retrieve trace descriptor for. + * + * @return Valid trace descriptor on success, NULL on failure. + */ +tracDesc_t TRAC_get_td(const char *i_comp); + +/** + * @brief Reset all trace buffers + * + * @return Non-zero return code on error + */ +UINT TRAC_reset_buf(void); + +/*@}*/ // Ending tag for external interface module in doxygen + + +/** + * @brief Trace input integers to trace buffer. + * + * This function assumes i_td has been initialized. + * + * @param io_td Intialized trace descriptor point to buffer to trace to. + * @param i_hash Hash value to be recorded for this trace. + * @param i_fmt Output format + * @param i_line Line number trace is occurring on. + * @param i_type trace type. filed or debug. + * @param ... parames that are limited to a size of 4 bytes, i.e. int, uint32_t, nnn* + * + * @return Non-zero return code on error. + */ +UINT trace_adal_write_all(tracDesc_t io_td,const trace_hash_val i_hash, + const char *i_fmt,const ULONG i_line, const ULONG i_type,...); + + +/** + * @brief Trace input integers to trace buffer. + * + * This function assumes i_td has been initialized. + * + * @param io_td Intialized trace descriptor point to buffer to trace to. + * @param i_hash Hash value to be recorded for this trace. + * @param i_line Line number trace is occurring on. + * @param i_num_args Number of arguments to trace. + * @param i_1 Input Parameter 1 + * @param i_2 Input Parameter 2 + * @param i_3 Input Parameter 3 + * @param i_4 Input Parameter 4 + * @param i_5 Input Parameter 5 + * + * @return Non-zero return code on error. + */ +UINT trac_write_int(tracDesc_t io_td,const trace_hash_val i_hash, + const ULONG i_line, + const UINT i_num_args, + const ULONG i_1,const ULONG i_2,const ULONG i_3, + const ULONG i_4,const ULONG i_5 + ); + + + /** + * @brief Trace binary data to buffer. + * + * This function assumes i_td has been initialized. + * + * @param io_td Intialized trace descriptor point to buffer to trace to. + * @param i_hash Hash value to be recorded for this trace. + * @param i_line Line number trace is occurring on. + * @param i_ptr Pointer to binary data to trace. + * @param i_size Size of data to copy from i_ptr. + * + * @return Non-zero return code on error. + */ +UINT trac_write_bin(tracDesc_t io_td,const trace_hash_val i_hash, + const ULONG i_line, + const void *i_ptr, + const ULONG i_size); + +//************************************************************************* +// Functions +//************************************************************************* + +#endif //_TRAC_INTERFACE_H diff --git a/src/tools/trace/tracehash.pl b/src/tools/trace/tracehash.pl new file mode 100755 index 00000000..a278741a --- /dev/null +++ b/src/tools/trace/tracehash.pl @@ -0,0 +1,896 @@ +#!/usr/bin/perl -w +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/tools/trace/tracehash.pl $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2015,2016 +# +# +# 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 +# File tracehash.pl created by B J Zander. + +use strict; + +sub determine_args(); +sub launch_cpp_and_parse($$); +sub cpp_dir($); +sub read_string_file(); +sub collect_files($); +sub assimilate_file($); +sub hash_strings(); +sub write_string_file(); +sub help(); + +select (STDERR); +$| = 1; # Make all prints to STDERR flush the buffer immediately +select (STDOUT); +$| = 1; # Make all prints to STDOUT flush the buffer immediately + +# Constants +my $HEAD_SEP = "|||"; +my $HEAD_EYE_CATCHER = "#FSP_TRACE_v"; +my $HEAD_BUILD_FLAG = "BUILD:"; +my $HEAD_VER_FLAG = 2; +my $BB_STRING_FILE = "/opt/fsp/etc/BB_StringFile"; + +# Global Variables +my $debug = 0; +my $seperator = "&&&&"; +my $file_name = "sbeStringFile"; +my $in_sand; +my ($backing) = $ENV{'bb'}; +my $hash_prog = "trexhash"; #default to in path +my $build = ""; +my ($sandbox) = $ENV{'SANDBOX'} || ""; +my ($context) = $ENV{'CONTEXT'} || ""; +my ($sandboxbase) = $ENV{'SANDBOXBASE'} || ""; +my ($bb); +my ($sourcebase) = "$sandboxbase/src"; +my ($version) = $HEAD_VER_FLAG; # default to oldest version +my ($collect) = 0; +my ($INCLUDE, $Arg, $file, $dir, $string_file); +my $args = ""; + +my $fail_on_collision = 0; # 1 = exit with error if hash collision occurs +my $hash_filename_too = 0; # 1 = hash is calculated over format string + filename + +print "sourcebase = $sourcebase\n" if $debug; +print "sandbox = $sandbox\n" if $debug; +print "backing = $backing\n" if $debug; +print "context = $context\n" if $debug; + +if ($context =~ /x86/) +{ + $bb = "i586-pc-linux-gnu"; +} +else +{ + $bb = "powerpc-linux"; +} + +if(($sourcebase =~ /\w+/) && ($sandbox =~ /\w+/)) +{ + $INCLUDE = "-I $sandboxbase/export/$context/fips/include -I $backing/export/$context/fips/include -I /opt/fsp/$bb/include/fsp -I/opt/fsp/$bb/include/ -include /opt/fsp/$bb/include/fsp/tracinterface.H"; +} +else +{ + print "Not in Sandbox so guessing Include Paths...\n" if $debug; + $INCLUDE = "-I/opt/fsp/i586-pc-linux-gnu/include/fsp -I/opt/fsp/i586-pc-linux-gnu/include/ -include /opt/fsp/i586-pc-linux-gnu/include/fsp/tracinterface.H"; +} + +# I/P Series work in ODE sandbox env. +if ($sandboxbase =~ /\w+/) +{ + $in_sand = 1; + print "backing = $backing\n" if $debug; +} +else +{ + $in_sand = 0; +} + + + +# Parse the input parameters. + +while (@ARGV) { + $Arg = shift; + + if ($Arg eq "-h" || $Arg eq "-H") { + help(); + exit(127); + } + if ($Arg eq "-f") { + $file = shift; + next; + } + if ($Arg eq "-d") { + $dir = shift; + next; + } + if ($Arg eq "-s") { + $string_file = shift; + next; + } + if ($Arg eq "-c") { + $collect = 1; + next; + } + if ($Arg eq "-v") { + $debug = 1; + print "debug on\n" if $debug; + next; + } + if ($Arg eq "-C") { # fail if a hash collision is detected + $fail_on_collision = 1; + next; + } + if ($Arg eq "-F") { # hash is calculated over format string + file name + $hash_filename_too = 1; + next; + } + if ($Arg eq "-S") { + $BB_STRING_FILE = ""; + next; + } + + #just pass it onto compiler + $args = $args . " " . $Arg; +} + +print "args = $args\n" if $debug; + +if (!$file && !$dir && !$in_sand) { + help(); + exit(127); +} + +################################# +# M A I N # +################################# + +my $clock = `date`; + +$build = $HEAD_EYE_CATCHER . "$HEAD_VER_FLAG" . $HEAD_SEP . $clock . $HEAD_SEP . $HEAD_BUILD_FLAG; + +$build =~ s/\n//g; + +# Global array to hold the parsed TRAC macro calls. +my @strings = (); + +# Assoc. arrays to hold hash|string values. +my %string_file_array = (); +my %hash_strings_array = (); + +# Check all provided arguments and look for defaults if not provided by user +determine_args(); + +# Scan the appropriate files or directories for TRAC macro calls. + +if (defined $dir) +{ + + $build = $build . $dir; # default to put at top of string file + if($collect) + { + collect_files($dir); + } + else + { + cpp_dir($dir); + # Hash the string that have been scanned. + %hash_strings_array = hash_strings(); + } +} +else +{ + $build = $build . $file; # default to put at top of string file + + if($collect) + { + assimilate_file($file); + } + else + { + # make sure include path includes directory that file is in + if($file =~ /^(.+)\/[^\/]+\.C$/) + { + + launch_cpp_and_parse($file,$1); + } + else + { + # No path in front of file so it has to be local dir + launch_cpp_and_parse($file,"./"); + } + # Hash the string that have been scanned. + %hash_strings_array = hash_strings(); + } +} + +# Read the existing string file into memory. +%string_file_array = read_string_file(); + +# Write out the new string file. check for collisions of new/old string here +write_string_file(); + +print "Hashing Started at $clock\n"; +$clock = `date`; +print "Hashing Finished at $clock\n"; + +exit 0; + + +################################# +# S U B R O U T I N E S # +################################# + +#============================================================================= +# Enhance usability by figuring out which build env. we are in +#============================================================================= +sub determine_args() { + + + # Find trexhash program + # but only if needed (i.e. not in collect mode) + if (!$collect) { + my $tmp = `which $hash_prog`; + chomp $tmp; + + if ($tmp eq '') { + print STDOUT "\nWarning: Program trexhash does not exist in path.\n" if $debug; + $hash_prog = "./trexhash"; + + $tmp = `which $hash_prog`; + chomp $tmp; + if ($tmp eq '') { + print STDOUT "\nError: Unable to find trexhash \n"; + exit(127); + } + } + } + + # Verify input values. + if ((!defined $file) && (!defined $dir)) { + if(!($in_sand)) + { + print STDOUT "\nError: No input directory or file provided as input to scan\n"; + exit(127); + } + + # Assume they want sandbox scanned + if($collect) + { + # collect all string files generated by tracepp and merge + $dir = "$sandboxbase/obj/"; + } + else + { + # generate our own string file by pre-compiling all source code + $dir = "$sandboxbase/src/"; + } + print STDOUT "\n-f or -d not found...scanning $dir by default\n\n"; + } + + if (!defined $string_file) + { + if ($in_sand) + { + + # Copy the current string file from backing build into our sandbox + system ("cp $backing/obj/$file_name $sandboxbase/obj/$file_name") + if !(-e "$sandboxbase/obj/$file_name"); + + $string_file = "$sandboxbase/obj/$file_name"; + } + else + { + $string_file = "./$file_name"; + } + print STDOUT "-sf not specified, using $string_file instead...\n\n" if $debug; + + } + + # Try Creating the string file + `touch $string_file`; + + if (! -f $string_file) { + print STDOUT "\nError: File $string_file does not exist. Current directory may not be writable.\n\n"; + help(); + exit(127); + } + + # Make sure sbeStringFile is readable/writeable + system("chmod ugo+rw $string_file"); + +} + +#============================================================================= +# Launch cpp script and grab input from it looking for trace calls. +#============================================================================= +sub launch_cpp_and_parse($$) { + + my ($l_loc, $l_dir) = @_; + + print "Processing file $l_loc\n" if $debug; + my $cmd = "/usr/bin/cpp $INCLUDE -I $l_dir $args $l_loc|"; + print "$cmd\n" if $debug; + open(FH,"$cmd") + or die ("Cannot open $_:$!,stopped"); + + # Read through all lines in the file.. + my $line = ; + while (defined $line) + { + chop $line; # remove EOL + $line =~ s/^\s*//; # remove unneccesary beginning white space. + $line =~ s/\s*$//; # remove unneccesary ending white space. + # Look for lines that are trace macro calls. + #if (/(trace_adal_hash)(\()( *)(".+")(,)(\d)/) + #if ($line =~ /(.*?)(trace_adal_hash)(\()( *)(".+")(,)(\d)\)+(.*\d.*)/) + while($line =~ m/^(.*?)trace_adal_hash\s*\(\s*(("[^"]*"\s*)+),\s*(\d+)\s*\)(.*)$/) + { + my ($prefix, $strings, $salt, $suffix) = ($1, $2, $4, $5); + print STDOUT "$strings $salt\n" if $debug; + $strings =~ s/"\s*$//; # remove trailing " and space + $strings =~ s/^"//; # remove leading " + $strings =~ s/"\s*"//g; + # Check to see if it's contained on a single line, or if we + # have to combine lines to get a complete trace call. + + # Save the macro call so it can be hashed later.. + push (@strings, [$l_loc, $strings, $salt]); + $line = $suffix; # check rest of line for a second trace call + } + my $nextline = ; + last if !defined $nextline; + # if a trace call is spread over multiple lines we have to add the next + # line from the source. the only problem is the definition/declaration + # of trace_adal_hash: we have to ignore that. we catch that by requiring + # a " after the function name. hopefully nobody writes a comment with + # a " after the function declaration ... + if ($line =~ /trace_adal_hash.*"/) { + $line .= $nextline; + } else { + $line = $nextline; + } + } + close(FH); +} + +#============================================================================= +# run cpp on all files in this directory and return the output +#============================================================================= +sub cpp_dir($) { + + my ($l_dir) = @_; + my @dir_entry; + my $l_entry; + + # Open the directory and read all entry names. + opendir ( DH , "$l_dir") + or die ("Cannot open $l_dir: $!, stopped"); + + print STDOUT "Processing directory $l_dir\n" if $debug; + @dir_entry = readdir(DH); + closedir(DH); + + while (@dir_entry) { + $l_entry = shift(@dir_entry); + + if ($l_dir =~ m"/$") { + $l_entry = "$l_dir$l_entry"; + } + else { + $l_entry = "$l_dir/$l_entry"; + } + + # Is the entry a directory? + if (-d $l_entry) { + + if($l_entry =~ m"/?([^/]+)$") + { + # check dir we are going into + print "dir = $1\n" if $debug; + # should we recurse into this directory. + if ($1 =~ m/^(\.\.?|sim[ou]|bldv)$/) + { + next; # skip '.', '..' and some fips dirs + } + cpp_dir($l_entry); + } + else + { + # unable to determine name of dir (no / in filename) + # should we recurse into this directory. + if ($l_entry =~ m/^(\.\.?|sim[ou]|bldv)$/) + { + next; # skip '.', '..' and some fips dirs + } + cpp_dir($l_entry); + } + } + # Is the entry a file? + elsif ((-f $l_entry) && ($l_entry =~ m/\.C$/)) { + # it's a file so + launch_cpp_and_parse($l_entry,$l_dir); + } + else { + # Not a file or directory so ignore it... + } + } +} + +#============================================================================= +# Read in strings from the existing trace string file.... +#============================================================================= +sub read_string_file() { + + my %o_strings; + my ($line) = ""; + my ($l_hash) = ""; + my ($l_str) = ""; + my ($cur_build) = ""; + my ($l_file) = ""; + + + # Make sure we can open each file. + open ( FH , "<$string_file") + or die ("Cannot open $_: $!, stopped"); + + $line = ; + + print "first line in sbeStringFile= $line\n" if $debug; + + if((defined $line) && ($line =~ /^$HEAD_EYE_CATCHER(\d)/)) + { + $version = $1; + + print "version = $version\n" if $debug; + + #Always put latest version in file + $line =~ s/^$HEAD_EYE_CATCHER\d/${HEAD_EYE_CATCHER}${HEAD_VER_FLAG}/; + + # Take previous version in file and use it. + $build = $line; + chomp($build); + $line = ; + + while (defined $line) { + chomp $line; # remove EOL + if($version eq "1") + { + ($l_hash, $l_file ,$l_str) = split(/\|\|/, $line); + } + elsif($version eq "2") + { + ($l_hash, $l_str ,$l_file) = split(/\|\|/, $line); + } + else + { + print "Unknown version of stringfile $version\n"; + exit(127); + } + $o_strings{$l_hash} = $l_str . "||" . $l_file; + $line = ; + } + + } + else + { # If there is a file then we are dealing with the first + # version of sbeStringFile so don't look for file name. + if ($debug) { + print "version 0 stringfile detected: $string_file\n"; + } + + # there is a file and it doesn't have a header + $version = 0; + + while (defined $line) { + chomp $line; # remove EOL + ($l_hash,$l_str) = split(/\|\|/, $line); + $o_strings{$l_hash} =$l_str . "||" . "NO FILE"; + $line = ; + } + } + + close(FH); + + #Time to look for a building block string file + if($BB_STRING_FILE ne "" and $string_file ne $BB_STRING_FILE and -f $BB_STRING_FILE) + { + + # Make sure we can open the file. + open ( FH , "<$BB_STRING_FILE") + or die ("Cannot open $_: $!, stopped"); + + $line = ; + + print "first line in BB_StringFile = $line\n" if $debug; + if((defined $line) && ($line =~ /^$HEAD_EYE_CATCHER(\d)/)) + { + $version = $1; + + $line = ; + while (defined $line) + { + chop $line; # remove EOL + if($version eq "1") + { + ($l_hash, $l_file ,$l_str) = split(/\|\|/, $line); + } + elsif($version eq "2") + { + ($l_hash, $l_str ,$l_file) = split(/\|\|/, $line); + } + #($l_hash, $l_file ,$l_str) = split(/\|\|/, $line); + $o_strings{$l_hash} = $l_str . "||" . $l_file ; + $line = ; + } + } + else + { + print "*** ERROR: BB_StringFile '$BB_STRING_FILE' should always have version!!!\n" + } + + } + else + { + print "$BB_STRING_FILE is not available\n" if $debug; + } + #All files are latest version now. + $version = $HEAD_VER_FLAG; + return %o_strings; +} + +#============================================================================= +# Read in strings from the existing trace string file.... +#============================================================================= +sub collect_files($) { + + my ($l_dir) = @_; + my (@dir_entry); + my ($l_entry) = ""; + + # Open the directory and read all entry names. + opendir ( DH , "$l_dir") + or die ("Cannot open $l_dir: $!, stopped"); + + print STDOUT "Processing directory $l_dir\n" if $debug; + @dir_entry = readdir(DH); + closedir(DH); + + while (@dir_entry) { + $l_entry = shift(@dir_entry); + + if ($l_dir =~ m"/$") { + $l_entry = "$l_dir$l_entry"; + } + else { + $l_entry = "$l_dir/$l_entry"; + } + + # Is the entry a directory? + if (-d $l_entry) { + + # should we recurse into this directory. + if ($l_entry =~ m/\/(\.\.?|sim[ou]|bldv)$/) + { + next; # skip '.', '..' and some fips dirs + } + collect_files($l_entry); + } + # Is the entry a file? + elsif ((-f $l_entry) && ($l_entry =~ m"\.hash$")) { + # it's a file so + assimilate_file($l_entry); + } + else { + # Not a file or directory so ignore it... + } + } + +} + +#============================================================================= +# Read in data from file and add to master one +#============================================================================= +sub assimilate_file($) { + + my ($l_loc) = @_; + + my (%o_strings); + my ($line) = ""; + my ($l_hash) = ""; + my ($l_str) = ""; + my ($l_file) = ""; + + # Make sure we can open each file. + open ( FH , "<$l_loc") + or die ("Cannot open $_: $!, stopped"); + + $line = ; + + print "Assimilate: first line in $l_loc = $line" if $debug; + + if((defined $line) && ($line =~ /^$HEAD_EYE_CATCHER(\d)/)) + { + $version = $1; + if ($version eq "1") { + if ($hash_filename_too) { + print "*** ERROR: hash_filename_too (-F) isn't possible with trace version 1\n"; + print " please rebuild all .hash files and global sbeStringFile\n"; + print " version 1 file is '$l_loc'\n"; + exit(127); + } + } elsif ($version ne "2") { + print "Unknown version of stringfile $version\n"; + exit(127); + } + + $line = ; + + + while (defined $line) { + chop $line; # remove EOL + if($version eq "1") + { + ($l_hash, $l_file ,$l_str) = split(/\|\|/, $line); + } + elsif($version eq "2") + { + ($l_hash, $l_str ,$l_file) = split(/\|\|/, $line); + } + my $newstring = $l_str . "||" . $l_file; + if (exists $hash_strings_array{$l_hash}) { + my $hashstr1 = $hash_strings_array{$l_hash}; + my $hashstr2 = $newstring; + if (!$hash_filename_too) { + # hash was made over format string only, remove file name + $hashstr1 =~ s/\|\|.*$//; + $hashstr2 = $l_str; + } + if ($debug) { + print "a_f: compare $hashstr1\n", + " vs. $hashstr2\n"; + } + if ($hashstr1 ne $hashstr2) + { + print "*** ERROR: HASH Collision! (a_f)\n", + " Two different strings have the same hash value ($l_hash)\n", + " String 1: $hash_strings_array{$l_hash}\n", + " String 2: $newstring\n"; + if ($fail_on_collision) { + exit(1); + } + } + } + $hash_strings_array{$l_hash} = $newstring; + $line = ; + } + + } + else + { # If there is a file then we are dealing with the first + # version of sbeStringFile so don't look for file name. + # these files shouldn't be there anymore. we don't check for collisions here + if ($debug) { + print "version 0 stringfile detected: $string_file\n"; + } + + if(defined $line) + { + # there is a file and it doesn't have a header + $version = 0; + } + + while (defined $line) { + chop $line; # remove EOL + ($l_hash,$l_str) = split(/\|\|/, $line); + $hash_strings_array{$l_hash} = $l_str . "||" . "NO FILE"; + $line = ; + } + } + $version = $HEAD_VER_FLAG; + close(FH); +} + +#============================================================================= + +#============================================================================= +sub hash_strings() { + + my ($hash_val, $l_key, $l_hash, %l_hash_strings); + my ($line_feed) = chr(10); + my ($l_file_name) = "NO FILENAME"; + print "\nHashing printf strings.\n\n"; + + foreach my $str (@strings) { + my $printf_string; + $l_file_name = $str->[0]; + $printf_string = $str->[1]; + $l_key = $str->[2]; + print "printf_string = $printf_string\n" if $debug; + $printf_string =~ s/"\s?"//g; #multi line traces will have extra " in them + $printf_string =~ s/`/\\`/g; # excape ' + $printf_string =~ s/\\n/$line_feed/g; # escape \n + if ($hash_filename_too) { + $printf_string .= "||" . $l_file_name; + } + + # call the hasher. + print "$hash_prog \"$printf_string\" $l_key\n" if $debug; + $hash_val = `$hash_prog \"$printf_string\" $l_key`; + if ($?) { + my ($hp_ret, $hp_sig) = ($? >> 8, $? & 127); + if ($hp_sig) { + print "*** ERROR: $hash_prog died with signal $hp_sig\n"; + } elsif ($hp_ret) { + print "*** ERROR: $hash_prog returned the error $hp_ret\n"; + if ($hash_val) { + print " error from $hash_prog:\n$hash_val"; + } + } + exit(1); + } + print "printf_string = $printf_string l_key = $l_key hash val = $hash_val\n" if $debug; + + # undo escaping + $printf_string =~ s/$line_feed/\\n/g; + $printf_string =~ s/\\`/`/g; + + if (exists $l_hash_strings{$hash_val}) + { + # hash val was found before. check if it's the same string + # else we have a hash collision + my $l_tmp = $l_hash_strings{$hash_val}; + if (!$hash_filename_too) { + $l_tmp =~ s/\|\|.*$//; + } + if ($l_tmp ne $printf_string) + { + print "*** ERROR: HASH Collision! (h_s)\n", + " Two different strings have the same hash value ($hash_val)\n", + " String 1: $l_hash_strings{$hash_val}\n", + " String 2: $printf_string (file $l_file_name)\n"; + if ($fail_on_collision) { + exit(1); + } + } + } + # this will overwrite an old string with a new one if a collision occurred + # but we might want to bail out in this case anyway + $printf_string = $printf_string . "||" . $l_file_name; + $l_hash_strings{$hash_val} = $printf_string; + } + return %l_hash_strings; +} +#============================================================================= + +#============================================================================= +sub write_string_file() { + + my (@keys) = (); + my ($l_key) = ""; + + # Combine the contents of the existing string file with the trace calls + # that we have just hashed. + print STDOUT "\nCombining Hash strings...\n\n"; + + @keys = keys(%hash_strings_array); + + foreach $l_key (@keys) { + my $l_tmp = $hash_strings_array{$l_key}; # freshly collected strings + if (exists $string_file_array{$l_key}) + { # hash exists in list from sbeStringFile + my $l_tmp2 = $string_file_array{$l_key}; + if (!$hash_filename_too) { + $l_tmp =~ s/\|\|.*$//; + $l_tmp2 =~ s/\|\|.*$//; + } + + # Check for hash collisions. + if ($l_tmp ne $l_tmp2) + { + print "*** ERROR: HASH Collision! (w_s_f)\n", + " Two different strings have the same hash value ($l_key)\n", + " String 1: $hash_strings_array{$l_key}\n", + " String 2: $string_file_array{$l_key}\n"; + if ($fail_on_collision) { + exit(1); + } + # don't fail, write new one + } + } + if($version > 0) + { + # add/replace the new string to the string_file_array. + $string_file_array{$l_key} = $hash_strings_array{$l_key} + } + else + { + # old version so only write out format string (not file name to) + $string_file_array{$l_key} = $l_tmp; + } + } + + # Write out the updated string file. + print STDOUT "\nWriting updated hash||string file...\n\n"; + + @keys = sort(keys(%string_file_array)); + + open ( FH , ">$string_file") + or die ("Cannot open $_: $!, stopped"); + + if($version > 0) + { + print FH "$build\n"; # only print version if newer then version 0 + } + foreach $l_key (@keys) { + print FH "$l_key||$string_file_array{$l_key}\n"; + } + close FH; +} +#============================================================================= + +#============================================================================= +# Display command invokation help for this program... +#============================================================================= +sub help() { + print << "EOF"; +tracehash.pl - create a trace string file from sources or collect tracepp files +Usage: tracehash.pl [options] + General options: + -h - Print this help text. + -v - Be verbose, tell what's going on (debug output) + Operation modes + -c - Collect StringFiles created by tracepp and merge. + default - Scan source files for trace calls. + +Collect mode: tracehash.pl -c [-vFCS] [-d ] [-s ] + tracehash.pl -c [-vFCS] [-f ] [-s ] + Collect string files created by tracepp (.hash) from directory tree at + or read them from string file and write to file + , adding entries already in this file. + -f - String file to read and write/add to . + -d - Start of directory tree to scan for .hash files. Default = . + -s - File with trace strings (and hashes) to read from and write to + default = ./sbeStringFile + -F - hash is calculated over trace string and source file name, + otherwise without source file name + -C - report an error if a hash collisions occurs + -S - don't read global FLD-2.2 string file ($BB_STRING_FILE) + If tracehash.pl is called in a FipS build sandbox without -d and -f + defaults for the sandbox will be used. + +Scan mode: tracehash.pl [-vFCS] [-d ] [-s ] [ccpopts] + tracehash.pl [-vFCS] [-f ] [-s ] [cppopts] + Scan all files in directory tree or scan file and write + strings to file . Strings already in this file will be merged. + -f - Source file to scan for trace entries. + -d - Source directory to scan for trace entries. + -s - File with trace strings (and hashes) to read from and write to. + default = ./sbeStringFile + -F - hash for string was build from format string + source file name + -C - report an error if hash collisions occur + -S - don't read global FLD-2.2 string file ($BB_STRING_FILE) + All other arguments will be passed verbatim to cpp +EOF +} +#============================================================================= + diff --git a/src/tools/utils/modules/gitUtil.pm b/src/tools/utils/modules/gitUtil.pm new file mode 100644 index 00000000..b94f711c --- /dev/null +++ b/src/tools/utils/modules/gitUtil.pm @@ -0,0 +1,592 @@ +#!/usr/bin/perl +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/tools/utils/modules/gitUtil.pm $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2016 +# +# +# 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 + +package gitUtil; + +use strict; + +my %globals = {}; + +# Function : gitRoot +# +# @brief : Determine the root of the GIT repository +# +# @return root : Root of GIT repository +# +sub gitRoot +{ + return $globals{git_root} if (defined $globals{git_root}); + + open COMMAND, "git rev-parse --show-toplevel |"; + my $root = ; + close COMMAND; + chomp $root; + + die "Unable to determine git_root" if ($root eq ""); + + $globals{git_root} = $root; + return $root; +} + +#################### Begin Gerrit JSON Utility Subroutines ##################### + +# @note There are perl modules for doing this but they are not installed on +# the pool machines. The parsing for JSON (at least the content from +# the Gerrit server) isn't so bad... + +# Function : jsonParse +# +# @brief : Parse a line of JSON into an hash-object. +# +# @param[in] line : The JSON content. +# +# @return hash : The parsed object. +# +sub jsonParse +{ + my $line = shift; + + die "Invalid JSON format: $line" unless ($line =~ m/^\{.*\}$/); + $line =~ s/^\{(.*)}$/$1/; + + my %object = (); + + while($line ne "") + { + my $key; + my $value; + + ($key, $line) = jsonGetString($line); + $key =~ s/^"(.*)"$/$1/; + + $line =~ s/^://; + if ($line =~ m/^"/) + { + ($value, $line) = jsonGetString($line); + $value =~ s/^"(.*)"$/$1/; + } + elsif ($line =~ m/^{/) + { + ($value, $line) = jsonGetObject($line); + $value = jsonParse($value); + } + elsif ($line =~ m/^\[/) + { + ($value, $line) = jsonGetArray($line); + $value = jsonParseArray($value); + } + else + { + $line =~ s/([^,]*)//; + $value = $1; + } + + $object{$key} = $value; + } + + return \%object; +} + +# Function : jsonGetString +# +# @brief : Utility function for jsonParse that extracts +# the string data in a given object +# +# @param[in] line : The JSON line containing the strings. +# +# @return strings : The parsed strings. +# +sub jsonGetString +{ + my $line = shift; + + $line =~ /("[^"]*")(.*)/; + my $first = $1; + my $second = $2; + + if ($first =~ m/\\"$/) + { + my ($more, $rest) = jsonGetString($second); + return ($first.$more , $rest); + } + else + { + return ($first, $second); + } +} + +# Function : jsonGetObject +# +# @brief : Utility function for jsonParse that extracts +# the nested JSON object data in a given object +# +# @param[in] line : The JSON line containing the object +# +# @return object : The nested object +# +sub jsonGetObject +{ + my $line = shift; + + $line =~ s/^{//; + my $object = "{"; + my $frag = ""; + + my $found_object = 0; + + until ((not $found_object) && ($object =~ m/}$/)) + { + $found_object = 0; + + if ($line =~ m/^\{/) + { + ($frag, $line) = jsonGetObject($line); + $object = $object.$frag; + $found_object = 1; + } + elsif ($line =~ m/^"/) + { + ($frag, $line) = jsonGetString($line); + $object = $object.$frag; + } + elsif ($line =~ m/^\[/) + { + ($frag, $line) = jsonGetArray($line); + $object = $object.$frag; + } + elsif ($line =~ m/^[:,}]/) + { + $line =~ s/^([:,}])//; + $frag = $1; + $object = $object.$frag; + } + else + { + $line =~ s/([^,}]*)//; + $frag = $1; + $object = $object.$frag; + } + } + + return ($object, $line); +} + +# Function : jsonGetArray +# +# @brief : Utility function for jsonParse that extracts +# the array in a given object +# +# @param[in] line : The JSON line containing the array +# +# @return array : The array object +# +sub jsonGetArray +{ + my $line = shift; + + $line =~ s/^\[//; + my $array = "["; + my $frag = ""; + + my $found_array = 0; + + until ((not $found_array) && ($array =~ m/]$/)) + { + $found_array = 0; + + if ($line =~ m/^\[/) + { + ($frag, $line) = jsonGetArray($line); + $array = $array.$frag; + $found_array; + } + elsif ($line =~ m/^\{/) + { + ($frag, $line) = jsonGetObject($line); + $array = $array.$frag; + } + elsif ($line =~ m/^"/) + { + ($frag, $line) = jsonGetString($line); + $array = $array.$frag; + } + elsif ($line =~ m/^[:,\]]/) + { + $line =~ s/^([:,\]])//; + $frag = $1; + $array = $array.$frag; + } + else + { + $line =~ s/([^,]*)//; + $frag = $1; + $array = $array.$frag; + } + } + + return ($array, $line); +} + +# Function : jsonParseArray +# +# @brief : Utility function for jsonParse that parses +# the array object +# +# @param[in] line : The array +# +# @return array : The parsed array object +# +# +sub jsonParseArray +{ + my $line = shift; + + $line =~ s/^\[(.*)\]$/$1/; + + my @array = (); + + while ($line ne "") + { + my $value; + + if ($line =~ m/^"/) + { + ($value, $line) = jsonGetString($line); + $value =~ s/^"(.*)"$/$1/; + } + elsif ($line =~ m/^\{/) + { + ($value, $line) = jsonGetObject($line); + $value = jsonParse($value); + } + elsif ($line =~ m/^\[/) + { + ($value, $line) = jsonGetArray($line); + $value = jsonParseArray($value); + } + else + { + $line =~ s/([^,]*)//; + $value = $1; + } + + push @array, $value; + $line =~ s/^,//; + } + + return \@array; +} + +#################### End Gerrit JSON Utility Subroutines ####################### + +# Function : gerritIsPatch +# +# @brief : Determine if patch identifier is a Gerrit patch or not. +# +# @param[in] i_patch : The patch to make determination about. +# +# @retval flag : true/false (patch is/not a valid ID) +# +sub gerritIsPatch +{ + my $patch = shift; + return 1 if ($patch =~ m/I[0-9a-f]+/); + return 0; +} + +# Function : configFilename +# +# @brief : Create the file that stroes the GIT server details +# +# @return : Location of the config file +# +sub configFilename +{ + return gitRoot()."/.git/gitRelease.config"; +} + +# Function : configInit +# +# @brief : Fetch & write server details to the config file +# +sub configInit +{ + return if (defined $globals{configInit}); + + unless (-e configFilename()) + { + open COMMAND, "git config --list | grep remote.*ssh |"; + my $url = ; + close COMMAND; + chomp $url; + + die "Undefined git-remote 'gerrit'" if ($url eq ""); + + die "Unexpected url found: $url" if (not ($url =~ m/ssh:\/\/.*\/.*/)); + + my $server = $url; + my $project = $url; + + # match first occurance of '/' after ssh:// + # eg: remote.gerrit.url=ssh://hw.gerrit/hw/ppe + # $2 is 'hw.gerrit' + # $3 is 'hw/ppe' + $server =~ s/(.*)ssh:\/\/(.*?)\/(.*)/$2/; + $project =~ s/(.*)ssh:\/\/(.*?)\/(.*)/$3/; + + open(UNUSED, ">".configFilename()) || die; + close UNUSED; + + system("git config --file ".configFilename(). + " --add releaseLevels.server $server"); + system("git config --file ".configFilename(). + " --add releaseLevels.project $project"); + } + $globals{configInit} = 1; +} + +# Function : configProject +# +# @brief : Fetch the project name of the current configured repository +# +# @return : GIT project name +# +sub configProject +{ + return $globals{config_project} if (defined $globals{config_project}); + + configInit(); + + open COMMAND, "git config --file ".configFilename(). + " --get releaseLevels.project |"; + my $project = ; chomp($project); + close COMMAND; + + die "Project config does not exist" if ($project eq ""); + + $globals{config_project} = $project; + + return $project; +} + +# Function : configServer +# +# @brief : Fetch the server name of the current configured repository +# +# @return : GIT server location +# +sub configServer +{ + return $globals{config_server} if (defined $globals{config_server}); + + configInit(); + + + open COMMAND, "git config --file ".configFilename(). + " --get releaseLevels.server |"; + my $server = ; chomp($server); + close COMMAND; + + die "Server config does not exist" if ($server eq ""); + + $globals{config_server} = $server; + return $server; + +} + +# Function : gerritSSHCommand +# +# @brief : Creates a properly formed ssh command based on the server address +# +# @return : The basic ssh command to connect to the server. +# +sub gerritSSHCommand +{ + return $globals{gerrit_ssh_command} + if (defined $globals{gerrit_ssh_command}); + + my $server = configServer(); + my $port = ""; + + if ($server =~ m/.*:.*/) + { + $port = $server; + $server =~ s/(.*):.*/$1/; + $port =~ s/.*:(.*)/$1/; + + $port = "-p $port"; + } + + my $command = "ssh -qx $port $server gerrit"; + + $globals{gerrit_ssh_command} = $command; + return $command; +} + +# Function : gerritQuery +# +# @brief : Performs a gerrit query and parses the resulting JSON. +# +# @param[in] query : The query to perform. +# +# @return item : A list of items from the JSON query. Each item is a +# hash (key-value pair) for the item attributes. +# +sub gerritQuery +{ + my $query = shift; + my @items = (); + + $query = gerritSSHCommand()." query $query --current-patch-set --patch-sets --format=JSON |"; + + open COMMAND, $query; + while (my $line = ) + { + chomp $line; + push @items, jsonParse($line); + } + + return \@items; +} + +# Function : gerritQueryReference +# +# @brief : Retrieves reference for a patch id, patchset number +# +# @param[in] changeId : Change id of the patch +# @param[in] patchNumber : Patch set number +# +# @return reference : The reference string +# +sub gerritQueryReference +{ + my $changeId = shift; + my $patchNumber = shift; + + my $project = configProject(); + + my $query_result = gerritQuery("$changeId project:$project"); + + foreach my $result (@{$query_result}) + { + if ($result->{id} eq $changeId) + { + # If all patchsets queried, search all of them for the commit + foreach my $patchset (@{$result->{patchSets}}) + { + if ($patchNumber eq " ") + { + return $patchset->{currentPatchSet}->{ref}; + } + else + { + if ($patchset->{number} =~ m/$patchNumber/) + { + return $patchset->{ref}; + } + } + } + } + } + die "Cannot find $changeId in $project"; +} + +# Function : gerritQueryCommit +# +# @brief : Retrieves commit for a patch id, patchset number +# +# @param[in] changeId : Change id of the patch +# @param[in] patchNumber : Patch set number +# +# @return commit : The commit string +# +sub gerritQueryCommit +{ + my $changeId = shift; + my $patchNumber = shift; + + my $project = configProject(); + + my $query_result = gerritQuery("$changeId project:$project"); + + foreach my $result (@{$query_result}) + { + if ($result->{id} eq $changeId) + { + # If all patchsets queried, search all of them for the commit + foreach my $patchset (@{$result->{patchSets}}) + { + if ($patchNumber eq "") + { + return $patchset->{currentPatchSet}->{revision}; + } + else + { + if ($patchset->{number} =~ m/$patchNumber/) + { + return $patchset->{revision}; + } + } + } + } + } + die "Cannot find $changeId in $project"; +} + +# Function : patchMergeStatus +# +# @brief : Check if given patch is merged into repository +# +# @param[in] changeId : Change id of the patch +# +# @return mergeStatus : 1 if merged; else 0 +# +sub patchMergeStatus +{ + my $mergeStatus = 1; + + my $changeId = shift; + + my $project = configProject(); + + my $query_result = gerritQuery("$changeId project:$project"); + + foreach my $result (@{$query_result}) + { + if ($result->{id} eq $changeId) + { + if ($result->{status} eq "MERGED" || $result->{status} eq "merged") + { + $mergeStatus = 1; + } + else + { + $mergeStatus = 0; + } + return $mergeStatus; + } + } + die "Cannot find $changeId in $project"; +} diff --git a/src/tools/utils/perl.modules/gitUtil.pm b/src/tools/utils/perl.modules/gitUtil.pm deleted file mode 100644 index bbfd7092..00000000 --- a/src/tools/utils/perl.modules/gitUtil.pm +++ /dev/null @@ -1,592 +0,0 @@ -#!/usr/bin/perl -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. -# -# $Source: src/tools/utils/perl.modules/gitUtil.pm $ -# -# OpenPOWER sbe Project -# -# Contributors Listed Below - COPYRIGHT 2016 -# -# -# 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 - -package gitUtil; - -use strict; - -my %globals = {}; - -# Function : gitRoot -# -# @brief : Determine the root of the GIT repository -# -# @return root : Root of GIT repository -# -sub gitRoot -{ - return $globals{git_root} if (defined $globals{git_root}); - - open COMMAND, "git rev-parse --show-toplevel |"; - my $root = ; - close COMMAND; - chomp $root; - - die "Unable to determine git_root" if ($root eq ""); - - $globals{git_root} = $root; - return $root; -} - -#################### Begin Gerrit JSON Utility Subroutines ##################### - -# @note There are perl modules for doing this but they are not installed on -# the pool machines. The parsing for JSON (at least the content from -# the Gerrit server) isn't so bad... - -# Function : jsonParse -# -# @brief : Parse a line of JSON into an hash-object. -# -# @param[in] line : The JSON content. -# -# @return hash : The parsed object. -# -sub jsonParse -{ - my $line = shift; - - die "Invalid JSON format: $line" unless ($line =~ m/^\{.*\}$/); - $line =~ s/^\{(.*)}$/$1/; - - my %object = (); - - while($line ne "") - { - my $key; - my $value; - - ($key, $line) = jsonGetString($line); - $key =~ s/^"(.*)"$/$1/; - - $line =~ s/^://; - if ($line =~ m/^"/) - { - ($value, $line) = jsonGetString($line); - $value =~ s/^"(.*)"$/$1/; - } - elsif ($line =~ m/^{/) - { - ($value, $line) = jsonGetObject($line); - $value = jsonParse($value); - } - elsif ($line =~ m/^\[/) - { - ($value, $line) = jsonGetArray($line); - $value = jsonParseArray($value); - } - else - { - $line =~ s/([^,]*)//; - $value = $1; - } - - $object{$key} = $value; - } - - return \%object; -} - -# Function : jsonGetString -# -# @brief : Utility function for jsonParse that extracts -# the string data in a given object -# -# @param[in] line : The JSON line containing the strings. -# -# @return strings : The parsed strings. -# -sub jsonGetString -{ - my $line = shift; - - $line =~ /("[^"]*")(.*)/; - my $first = $1; - my $second = $2; - - if ($first =~ m/\\"$/) - { - my ($more, $rest) = jsonGetString($second); - return ($first.$more , $rest); - } - else - { - return ($first, $second); - } -} - -# Function : jsonGetObject -# -# @brief : Utility function for jsonParse that extracts -# the nested JSON object data in a given object -# -# @param[in] line : The JSON line containing the object -# -# @return object : The nested object -# -sub jsonGetObject -{ - my $line = shift; - - $line =~ s/^{//; - my $object = "{"; - my $frag = ""; - - my $found_object = 0; - - until ((not $found_object) && ($object =~ m/}$/)) - { - $found_object = 0; - - if ($line =~ m/^\{/) - { - ($frag, $line) = jsonGetObject($line); - $object = $object.$frag; - $found_object = 1; - } - elsif ($line =~ m/^"/) - { - ($frag, $line) = jsonGetString($line); - $object = $object.$frag; - } - elsif ($line =~ m/^\[/) - { - ($frag, $line) = jsonGetArray($line); - $object = $object.$frag; - } - elsif ($line =~ m/^[:,}]/) - { - $line =~ s/^([:,}])//; - $frag = $1; - $object = $object.$frag; - } - else - { - $line =~ s/([^,}]*)//; - $frag = $1; - $object = $object.$frag; - } - } - - return ($object, $line); -} - -# Function : jsonGetArray -# -# @brief : Utility function for jsonParse that extracts -# the array in a given object -# -# @param[in] line : The JSON line containing the array -# -# @return array : The array object -# -sub jsonGetArray -{ - my $line = shift; - - $line =~ s/^\[//; - my $array = "["; - my $frag = ""; - - my $found_array = 0; - - until ((not $found_array) && ($array =~ m/]$/)) - { - $found_array = 0; - - if ($line =~ m/^\[/) - { - ($frag, $line) = jsonGetArray($line); - $array = $array.$frag; - $found_array; - } - elsif ($line =~ m/^\{/) - { - ($frag, $line) = jsonGetObject($line); - $array = $array.$frag; - } - elsif ($line =~ m/^"/) - { - ($frag, $line) = jsonGetString($line); - $array = $array.$frag; - } - elsif ($line =~ m/^[:,\]]/) - { - $line =~ s/^([:,\]])//; - $frag = $1; - $array = $array.$frag; - } - else - { - $line =~ s/([^,]*)//; - $frag = $1; - $array = $array.$frag; - } - } - - return ($array, $line); -} - -# Function : jsonParseArray -# -# @brief : Utility function for jsonParse that parses -# the array object -# -# @param[in] line : The array -# -# @return array : The parsed array object -# -# -sub jsonParseArray -{ - my $line = shift; - - $line =~ s/^\[(.*)\]$/$1/; - - my @array = (); - - while ($line ne "") - { - my $value; - - if ($line =~ m/^"/) - { - ($value, $line) = jsonGetString($line); - $value =~ s/^"(.*)"$/$1/; - } - elsif ($line =~ m/^\{/) - { - ($value, $line) = jsonGetObject($line); - $value = jsonParse($value); - } - elsif ($line =~ m/^\[/) - { - ($value, $line) = jsonGetArray($line); - $value = jsonParseArray($value); - } - else - { - $line =~ s/([^,]*)//; - $value = $1; - } - - push @array, $value; - $line =~ s/^,//; - } - - return \@array; -} - -#################### End Gerrit JSON Utility Subroutines ####################### - -# Function : gerritIsPatch -# -# @brief : Determine if patch identifier is a Gerrit patch or not. -# -# @param[in] i_patch : The patch to make determination about. -# -# @retval flag : true/false (patch is/not a valid ID) -# -sub gerritIsPatch -{ - my $patch = shift; - return 1 if ($patch =~ m/I[0-9a-f]+/); - return 0; -} - -# Function : configFilename -# -# @brief : Create the file that stroes the GIT server details -# -# @return : Location of the config file -# -sub configFilename -{ - return gitRoot()."/.git/gitRelease.config"; -} - -# Function : configInit -# -# @brief : Fetch & write server details to the config file -# -sub configInit -{ - return if (defined $globals{configInit}); - - unless (-e configFilename()) - { - open COMMAND, "git config --list | grep remote.*ssh |"; - my $url = ; - close COMMAND; - chomp $url; - - die "Undefined git-remote 'gerrit'" if ($url eq ""); - - die "Unexpected url found: $url" if (not ($url =~ m/ssh:\/\/.*\/.*/)); - - my $server = $url; - my $project = $url; - - # match first occurance of '/' after ssh:// - # eg: remote.gerrit.url=ssh://hw.gerrit/hw/ppe - # $2 is 'hw.gerrit' - # $3 is 'hw/ppe' - $server =~ s/(.*)ssh:\/\/(.*?)\/(.*)/$2/; - $project =~ s/(.*)ssh:\/\/(.*?)\/(.*)/$3/; - - open(UNUSED, ">".configFilename()) || die; - close UNUSED; - - system("git config --file ".configFilename(). - " --add releaseLevels.server $server"); - system("git config --file ".configFilename(). - " --add releaseLevels.project $project"); - } - $globals{configInit} = 1; -} - -# Function : configProject -# -# @brief : Fetch the project name of the current configured repository -# -# @return : GIT project name -# -sub configProject -{ - return $globals{config_project} if (defined $globals{config_project}); - - configInit(); - - open COMMAND, "git config --file ".configFilename(). - " --get releaseLevels.project |"; - my $project = ; chomp($project); - close COMMAND; - - die "Project config does not exist" if ($project eq ""); - - $globals{config_project} = $project; - - return $project; -} - -# Function : configServer -# -# @brief : Fetch the server name of the current configured repository -# -# @return : GIT server location -# -sub configServer -{ - return $globals{config_server} if (defined $globals{config_server}); - - configInit(); - - - open COMMAND, "git config --file ".configFilename(). - " --get releaseLevels.server |"; - my $server = ; chomp($server); - close COMMAND; - - die "Server config does not exist" if ($server eq ""); - - $globals{config_server} = $server; - return $server; - -} - -# Function : gerritSSHCommand -# -# @brief : Creates a properly formed ssh command based on the server address -# -# @return : The basic ssh command to connect to the server. -# -sub gerritSSHCommand -{ - return $globals{gerrit_ssh_command} - if (defined $globals{gerrit_ssh_command}); - - my $server = configServer(); - my $port = ""; - - if ($server =~ m/.*:.*/) - { - $port = $server; - $server =~ s/(.*):.*/$1/; - $port =~ s/.*:(.*)/$1/; - - $port = "-p $port"; - } - - my $command = "ssh -qx $port $server gerrit"; - - $globals{gerrit_ssh_command} = $command; - return $command; -} - -# Function : gerritQuery -# -# @brief : Performs a gerrit query and parses the resulting JSON. -# -# @param[in] query : The query to perform. -# -# @return item : A list of items from the JSON query. Each item is a -# hash (key-value pair) for the item attributes. -# -sub gerritQuery -{ - my $query = shift; - my @items = (); - - $query = gerritSSHCommand()." query $query --current-patch-set --patch-sets --format=JSON |"; - - open COMMAND, $query; - while (my $line = ) - { - chomp $line; - push @items, jsonParse($line); - } - - return \@items; -} - -# Function : gerritQueryReference -# -# @brief : Retrieves reference for a patch id, patchset number -# -# @param[in] changeId : Change id of the patch -# @param[in] patchNumber : Patch set number -# -# @return reference : The reference string -# -sub gerritQueryReference -{ - my $changeId = shift; - my $patchNumber = shift; - - my $project = configProject(); - - my $query_result = gerritQuery("$changeId project:$project"); - - foreach my $result (@{$query_result}) - { - if ($result->{id} eq $changeId) - { - # If all patchsets queried, search all of them for the commit - foreach my $patchset (@{$result->{patchSets}}) - { - if ($patchNumber eq " ") - { - return $patchset->{currentPatchSet}->{ref}; - } - else - { - if ($patchset->{number} =~ m/$patchNumber/) - { - return $patchset->{ref}; - } - } - } - } - } - die "Cannot find $changeId in $project"; -} - -# Function : gerritQueryCommit -# -# @brief : Retrieves commit for a patch id, patchset number -# -# @param[in] changeId : Change id of the patch -# @param[in] patchNumber : Patch set number -# -# @return commit : The commit string -# -sub gerritQueryCommit -{ - my $changeId = shift; - my $patchNumber = shift; - - my $project = configProject(); - - my $query_result = gerritQuery("$changeId project:$project"); - - foreach my $result (@{$query_result}) - { - if ($result->{id} eq $changeId) - { - # If all patchsets queried, search all of them for the commit - foreach my $patchset (@{$result->{patchSets}}) - { - if ($patchNumber eq "") - { - return $patchset->{currentPatchSet}->{revision}; - } - else - { - if ($patchset->{number} =~ m/$patchNumber/) - { - return $patchset->{revision}; - } - } - } - } - } - die "Cannot find $changeId in $project"; -} - -# Function : patchMergeStatus -# -# @brief : Check if given patch is merged into repository -# -# @param[in] changeId : Change id of the patch -# -# @return mergeStatus : 1 if merged; else 0 -# -sub patchMergeStatus -{ - my $mergeStatus = 1; - - my $changeId = shift; - - my $project = configProject(); - - my $query_result = gerritQuery("$changeId project:$project"); - - foreach my $result (@{$query_result}) - { - if ($result->{id} eq $changeId) - { - if ($result->{status} eq "MERGED" || $result->{status} eq "merged") - { - $mergeStatus = 1; - } - else - { - $mergeStatus = 0; - } - return $mergeStatus; - } - } - die "Cannot find $changeId in $project"; -} diff --git a/src/tools/utils/sbeGitTool.pl b/src/tools/utils/sbeGitTool.pl index 9ffd4b2b..120a906e 100755 --- a/src/tools/utils/sbeGitTool.pl +++ b/src/tools/utils/sbeGitTool.pl @@ -7,6 +7,7 @@ # OpenPOWER sbe Project # # Contributors Listed Below - COPYRIGHT 2016 +# [+] International Business Machines Corp. # # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,7 +26,7 @@ use strict; #use lib "$ENV{'PERLMODULES'}"; -use lib "src/tools/utils/perl.modules"; +use lib "src/tools/utils/modules"; use Getopt::Long qw(:config pass_through); use Data::Dumper; use Cwd; -- cgit v1.2.1