summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBill Hoffa <wghoffa@us.ibm.com>2018-09-26 10:18:57 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-09-27 13:41:16 -0500
commit0d43552dfb6dcac11a447cfcb2ba86bfdf552c29 (patch)
tree891e792d36aead6ced1d661ae737f8245515d008 /src
parent9f4cbc90fd47fb0438fcbbf5b56ff553c70b51f5 (diff)
downloadtalos-hostboot-0d43552dfb6dcac11a447cfcb2ba86bfdf552c29.tar.gz
talos-hostboot-0d43552dfb6dcac11a447cfcb2ba86bfdf552c29.zip
Use Simics CPU Object passed in when executing hap handler code
Change-Id: I589529f3550e7c9a11f0e0027a75edd0eec48e25 CQ: SW445281 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/66677 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Ilya Smirnov <ismirno@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/build/debug/simics-debug-framework.py68
1 files changed, 39 insertions, 29 deletions
diff --git a/src/build/debug/simics-debug-framework.py b/src/build/debug/simics-debug-framework.py
index e04b3dd8c..37794a2e4 100644
--- a/src/build/debug/simics-debug-framework.py
+++ b/src/build/debug/simics-debug-framework.py
@@ -90,35 +90,35 @@ class DebugFrameworkIPCMessage:
# types into the appropriate simics interface.
#
class DebugFrameworkProcess:
- process = ""; # subprocess object.
- tool = ""; # string - tool module name.
- toolOptions = ""; # string - tool options
- outputToString = None; # mode - String output instead of STDOUT.
- imgPath = None; # Image dir path override.
- result = ""; # Result string for Usage-mode.
- outputFile = None; # Output file for results in addition to STDOUT
+ process = "" # subprocess object.
+ tool = "" # string - tool module name.
+ toolOptions = "" # string - tool options
+ outputToString = None # mode - String output instead of STDOUT.
+ imgPath = None # Image dir path override.
+ result = "" # Result string for Usage-mode.
+ outputFile = None # Output file for results in addition to STDOUT
def __init__(self, tool = "Printk", toolOptions = "",
outputToString = None, usage = None,
imgPath = None,
outputFile = None):
# Assign instance 'imgPath' variable.
- self.imgPath = imgPath if imgPath else (os.environ['HB_TOOLPATH']+"/");
+ self.imgPath = imgPath if imgPath else (os.environ['HB_TOOLPATH']+"/")
# Determine sub-process arguments.
- process_args = [self.imgPath+"simics-debug-framework.pl"];
+ process_args = [self.imgPath+"simics-debug-framework.pl"]
if (usage): # Pass --usage if Usage mode selected.
- process_args = process_args + [ "--usage" ];
- outputToString = True;
+ process_args = process_args + [ "--usage" ]
+ outputToString = True
# Spawn sub-process
self.process = subprocess.Popen(process_args,
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
# Update instance variables.
- self.tool = tool;
- self.toolOptions = toolOptions;
- self.outputToString = outputToString;
- self.outputFile = open(outputFile, 'w') if outputFile else None;
+ self.tool = tool
+ self.toolOptions = toolOptions
+ self.outputToString = outputToString
+ self.outputFile = open(outputFile, 'w') if outputFile else None
# Read a message from the process pipe.
def recvMsg(self):
@@ -169,9 +169,9 @@ class DebugFrameworkProcess:
addr = int(match.group(1))
size = int(match.group(2))
- data = map(ord, match.group(3).decode("hex"));
+ data = map(ord, match.group(3).decode("hex"))
- conf.system_cmp0.phys_mem.memory[[addr, addr+size-1]] = data;
+ conf.system_cmp0.phys_mem.memory[[addr, addr+size-1]] = data
# Read data from PNOR.
# This message has data of the format "0dADDRESS,0dSIZE".
@@ -304,22 +304,22 @@ def register_hb_debug_framework_tools():
files = os.listdir(os.environ['HB_TOOLPATH']+"/Hostboot")
# Filter out any prefixed with '_' (utility module) or a '.' (hidden file).
- pattern = re.compile("[^\._]");
+ pattern = re.compile("[^\._]")
files = [f for f in files if pattern.match(f)]
# Filter out modules written for vbu only
- pattern = re.compile("AutoIpl|ContTrace");
+ pattern = re.compile("AutoIpl|ContTrace")
files = [f for f in files if not pattern.match(f)]
# Remove the .pm extension from the tool modules.
- files = [re.sub("\.pm","",f) for f in files];
+ files = [re.sub("\.pm","",f) for f in files]
# Create an entry for each module.
for tool in files:
# Get usage information for each module, fix text to HTML-like.
usage = run_hb_debug_framework(tool, usage = 1)
- usage = re.sub("<","&lt;", usage);
- usage = re.sub(">","&gt;", usage);
+ usage = re.sub("<","&lt;", usage)
+ usage = re.sub(">","&gt;", usage)
usage = re.sub("\t"," ",usage)
usage = "<pre>"+usage+"</pre>"
@@ -372,6 +372,11 @@ def getHRMOR():
result = SIM_get_object(simenv.hb_cpu).hrmor
return result
+# Fetch the current HRMOR value for inputted cpu obj
+def getHrmorCpu(cpu):
+ # Use the cpu object to get the hrmor value
+ iface = SIM_get_interface(cpu, "int_register")
+ return iface.read(iface.get_number("hrmor"))
# Read simics memory and return a list of strings such as ['0x0','0x2b','0x8']
# representing the data read from simics. The list returned may be handed
@@ -404,20 +409,20 @@ def writeLong(address,datvalue):
def writeSimicsMemory(address,data):
address = address + getHRMOR()
size = len(data)
- conf.system_cmp0.phys_mem.memory[[address, address+size-1]] = data;
+ conf.system_cmp0.phys_mem.memory[[address, address+size-1]] = data
# Convert an integer to a byte list <size> bytes long.
def intToList(n,size):
lst = []
for i in range(size):
- b = n & 0xFF;
+ b = n & 0xFF
lst.insert(0,b)
n = n >> 8
return lst
# Convert a byte list to an integer.
def listToInt(l):
- i = 0;
+ i = 0
for c in l:
i = (i << 8) | c
return i
@@ -499,14 +504,19 @@ def magic_instruction_callback(user_arg, cpu, arg):
if( os.environ.has_key('HB_DISABLE_MAGIC')
and (os.environ['HB_DISABLE_MAGIC'] == '1') ):
#print 'Skipping HB magic (disabled)', arg
- return;
+ return
+
+ #Only respond to haps for cpu model types we care about (mambo)
+ if 'mambo_core' not in cpu.classname:
+ #print 'Skipping HB magic (Not a Mambo core)', arg
+ return
# Disable our handler if we aren't inside HB part of IPL
# If HB is running then HRMOR==128MB (ignoring high bits)
# 0x40000000=1GB, 0x8000000=128MB
- if( (getHRMOR() % 0x40000000) != 0x8000000 ):
+ if( (getHrmorCpu(cpu) % 0x40000000) != 0x8000000 ):
#print 'Skipping HB magic (outside of HB)', arg
- return;
+ return
if arg == 7006: # MAGIC_SHUTDOWN
# KernelMisc::shutdown()
@@ -535,7 +545,7 @@ def magic_instruction_callback(user_arg, cpu, arg):
#print 'loading payload from', flash_file, 'to 0x%x' % load_addr
#cmd = 'shell "fcp --force -o0 -R %s:PAYLOAD simicsPayload.ecc; ecc --remove --p8 simicsPayload.ecc simicsPayload"; load-file simicsPayload 0x%x' % (flash_file, load_addr)
#SIM_run_alone( run_command, cmd )
- print "MAGIC_LOAD_PAYLOAD not implemented\n";
+ print "MAGIC_LOAD_PAYLOAD not implemented\n"
if arg == 7018: # MAGIC_BREAK_ON_ERROR
# Stop the simulation if an env var is set
OpenPOWER on IntegriCloud