Skip to content

Commit

Permalink
Support for ATTR_TMP and GUARD in standalone simics
Browse files Browse the repository at this point in the history
If a file called ATTR_TMP or GUARD exists in the simics search
path, they will be automatically loaded into pnor when simics
starts.  The offset is computed when the pnor is built by
way of a generated python file that we then load into simics.

Change-Id: I4d68215a589dcbdaefb2a67e65d1f6928ce639fa
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/88398
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Luis P Fernandez <luis.fernandez@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: Matt Derksen <mderkse1@us.ibm.com>
Reviewed-by: Nicholas E Bofferding <bofferdn@us.ibm.com>
  • Loading branch information
dcrowell77 authored and Nicholas E Bofferding committed Jan 10, 2020
1 parent 45cb275 commit c6aaded
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 3 deletions.
16 changes: 16 additions & 0 deletions src/build/buildpnor/PnorUtils.pm
Expand Up @@ -274,6 +274,22 @@ sub loadPnorLayout
my $err = $@;
die "ERROR: $this_func: Failed to create new XML file with corrected offsets, error = $err";
};

# Write out a helper file for our simics scripts
print "\nlocation = " . ${i_outputLayoutLocation} . "\n";
my $simfilename = "${i_outputLayoutLocation}/simpnor.py";
open(SIM_FILE,'>',$simfilename) or die("($simfilename) could not be opened.");
print SIM_FILE "def hb_get_pnor_offset(partname):\n";
print SIM_FILE " toc_dict={}\n";
#Iterate over the <section> elements.
foreach my $sectionEl (@{$xml->{section}})
{
my $eyeCatch = $sectionEl->{eyeCatch}[0];
my $physicalOffset = $sectionEl->{physicalOffset}[0];
print SIM_FILE " toc_dict[\"$eyeCatch\"]=$physicalOffset\n";
}
print SIM_FILE " return toc_dict[partname]\n";
close SIM_FILE;
}

return 0;
Expand Down
6 changes: 6 additions & 0 deletions src/build/buildpnor/pnorLayoutAxone.xml
Expand Up @@ -102,6 +102,12 @@ Layout Description
<side>sideless</side>
<ecc/>
</section>
<section>
<description>Attributes</description>
<eyeCatch>ATTR_TMP</eyeCatch>
<physicalRegionSize>0x4000</physicalRegionSize>
<side>sideless</side>
</section>
<section>
<description>Hostboot Base (1MB)</description>
<eyeCatch>HBB</eyeCatch>
Expand Down
2 changes: 1 addition & 1 deletion src/build/configs/simics_axone.config
Expand Up @@ -21,7 +21,7 @@ set AXONE

# Enable Console
set CONSOLE
unset CONSOLE_OUTPUT_ERRORDISPLAY
set CONSOLE_OUTPUT_ERRORDISPLAY

# OMIs were introduced in Axone and will be in P10 also
set SUPPORT_OMI
32 changes: 31 additions & 1 deletion src/build/simics/standalone.simics
Expand Up @@ -13,6 +13,13 @@ if ($hb_mode == 0) { # Axone and beyond
$hb_skip_vpd_preload = 1;
}

# Load up the pnor parsing function
try {
add-directory $hb_pnor_dir
run-python-file (lookup-file simpnor.py)
echo "Loaded simpnor.py"
} except { "No simpnor.py found, using hardcoding PNOR offsets." }

# Preload VPD in PNOR unless told not to
if ($hb_skip_vpd_preload == 0) {

Expand Down Expand Up @@ -56,10 +63,33 @@ if ($hb_skip_vpd_preload == 0) {
if ($hb_mode == 0) {
$eccPreload = (lookup-file "%simics%/eecache_prebuilt.bin.ecc")
# NOTE must change offset if PNOR layout changes EECACHE offsets
echo " - Loading prebuilt EECACHE "+$eccPreload+" at 0x3D80000 in PNOR"
echo " - Loading prebuilt EECACHE "+$eccPreload+" at 0x2C000 in PNOR"
($hb_pnor).load-file $eccPreload 0x2C000
}

# Look for attribute overrides to load
try {
$attr_tmp = (lookup-file "ATTR_TMP")
try {
@simenv.attr_tmp_addr = hb_get_pnor_offset("ATTR_TMP")
} except {
$attr_tmp_addr = 0x000B2000
}
echo " - Loading ATTR_TMP "+$attr_tmp+" at "+$attr_tmp_addr+" in PNOR"
($hb_pnor).load-file $attr_tmp $attr_tmp_addr
} except { echo "No attribute overrides found." }

# Look for a guard file to load
try {
$guard = (lookup-file "GUARD")
try {
@simenv.guard_addr = hb_get_pnor_offset("GUARD")
} except {
$guard_addr = 0x000AC000
}
echo " - Loading GUARD "+$guard+" at "+$guard_addr+" in PNOR"
($hb_pnor).load-file $guard $guard_addr
} except { echo "No gard records found." }

# Turn on all processor cec-chips
if ($hb_mode == 1) {
Expand Down
2 changes: 1 addition & 1 deletion src/build/tools/hb
Expand Up @@ -435,7 +435,7 @@ hb_startsimics()
else
VEXEC_STR=""
fi
export RUNSIMCMD="cd ${SANDBOXBASE}/simics/ &&${VEXEC_STR} ./runsim -m ${MACHINE} hb_script_to_run=${MY_DIR}/startup.simics pnor_img=${MY_DIR}/../../../hbfw/img/axone.pnor sbe_seeprom_img=${SANDBOXBASE}/images/ppc/lab/flash/sbe_seeprom_p9a_10.bin.ecc num_procs=2 enable_lpc_console=TRUE"
export RUNSIMCMD="cd ${SANDBOXBASE}/simics/ &&${VEXEC_STR} ./runsim -m ${MACHINE} hb_script_to_run=${MY_DIR}/startup.simics pnor_img=${MY_DIR}/../../../hbfw/img/axone.pnor sbe_seeprom_img=${SANDBOXBASE}/images/ppc/lab/flash/sbe_seeprom_p9a_10.bin.ecc num_procs=2 enable_lpc_console=TRUE hb_pnor_dir=${MY_DIR}/../../../hbfw/img/"
echo "**********"
echo $RUNSIMCMD
echo "**********"
Expand Down

0 comments on commit c6aaded

Please sign in to comment.