summaryrefslogtreecommitdiffstats
path: root/src/tools/debug
diff options
context:
space:
mode:
authorShakeeb <shakeebbk@in.ibm.com>2016-08-27 10:50:49 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2016-08-30 06:01:06 -0400
commitf2d94b5f809410300fe10dc9d0786790018463a0 (patch)
tree467f90297b0eb7c5c6672653d778ed4734c0d5a3 /src/tools/debug
parent49b557dcae32250e8e06c4de895c0b7ba0e8009e (diff)
downloadtalos-sbe-f2d94b5f809410300fe10dc9d0786790018463a0.tar.gz
talos-sbe-f2d94b5f809410300fe10dc9d0786790018463a0.zip
SBE code restructure: sbe -> src rename
Change-Id: I6e4378d0e71a00ed2b239658d43f180df2a9b748 RTC:159709 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/28875 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: RAJA DAS <rajadas2@in.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'src/tools/debug')
-rwxr-xr-xsrc/tools/debug/simics/makefile53
-rwxr-xr-xsrc/tools/debug/simics/sbe_standalone.simics2
-rwxr-xr-xsrc/tools/debug/simics/sbe_startup.simics14
-rwxr-xr-xsrc/tools/debug/simics/simics-debug-framework.py88
4 files changed, 157 insertions, 0 deletions
diff --git a/src/tools/debug/simics/makefile b/src/tools/debug/simics/makefile
new file mode 100755
index 00000000..473c0088
--- /dev/null
+++ b/src/tools/debug/simics/makefile
@@ -0,0 +1,53 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/tools/debug/simics/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
+#
+# FSP Destination: obj/ppc/sbei/sbfw/simics/makefile
+#
+# NOTE: Do NOT modify this file in CMVC directly! It comes from the SBE
+# repository and will be overwritten.
+
+.include <${RULES_MK}>
+
+OTHERS = copy_scripts
+
+SBE_SIMICS_PATH = ${MAKETOP}simu/scripts/sbfw/
+
+SBE_SRC_PATHS = ${.PATH:M*src*sbei*sbfw*simics*} ${.PATH:M*obj*sbei*sbfw*simics*}
+SBE_SRC_DIRS = ${SBE_SRC_PATHS:XD}
+SBE_SRC_FILES = ${:!${SBE_SRC_DIRS:@path@ls ${path};@}!}
+
+SBE_SCRIPTS_TO_COPY = ${SBE_SRC_FILES:Nmakefile}
+SBE_SCRIPTS_PATHS = ${SBE_SCRIPTS_TO_COPY:p}
+
+SBE_COPY_COMMAND = \
+ ${SBE_SCRIPTS_PATHS:@file@cp -r ${file} ${SBE_SIMICS_PATH}; @}
+SBE_REMOVE_COMMAND = \
+ ${SBE_SCRIPTS_TO_COPY:@file@rm -rf ${SBE_SIMICS_PATH}${file}; @}
+
+copy_scripts:
+ mkdir -p ${SBE_SIMICS_PATH}
+ ${SBE_COPY_COMMAND}
+
+clobber_copy_scripts:
+ ${SBE_REMOVE_COMMAND}
diff --git a/src/tools/debug/simics/sbe_standalone.simics b/src/tools/debug/simics/sbe_standalone.simics
new file mode 100755
index 00000000..8fd3bdb0
--- /dev/null
+++ b/src/tools/debug/simics/sbe_standalone.simics
@@ -0,0 +1,2 @@
+echo "SBE standalone Tools"
+
diff --git a/src/tools/debug/simics/sbe_startup.simics b/src/tools/debug/simics/sbe_startup.simics
new file mode 100755
index 00000000..5d466a20
--- /dev/null
+++ b/src/tools/debug/simics/sbe_startup.simics
@@ -0,0 +1,14 @@
+echo "Attempting to register SBE Tools"
+
+# Load SBE debug tools.
+try {
+ $sbe_startup_path = (lookup-file sbfw/simics-debug-framework.py);
+ $sbe_script_location = (python "''.join(map('/'.__add__,\""+$sbe_startup_path+"\"[1:].split('/')[0:-1]))")
+ python "os.environ['SBE_TOOLS_PATH'] = \""+$sbe_script_location+"\""
+ echo $sbe_script_location;
+ run-python-file (lookup-file sbfw/simics-debug-framework.py)
+ # Set mailbox scratch registers so that the SBE starts in plck mode
+ # p9Proc0.proc_chip.invoke parallel_store SCOM 0x5003F "20000000_00000000" 64
+ # p9Proc0.proc_chip.invoke parallel_store SCOM 0x5003A "00000000_00000000" 64
+} except { echo "ERROR: Failed to load SBE debug tools." }
+
diff --git a/src/tools/debug/simics/simics-debug-framework.py b/src/tools/debug/simics/simics-debug-framework.py
new file mode 100755
index 00000000..87d3656b
--- /dev/null
+++ b/src/tools/debug/simics/simics-debug-framework.py
@@ -0,0 +1,88 @@
+# 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()
+
OpenPOWER on IntegriCloud