From c6aaded090e34c4da293d118205f7de18421b161 Mon Sep 17 00:00:00 2001 From: Dan Crowell Date: Tue, 10 Dec 2019 16:40:44 -0600 Subject: Support for ATTR_TMP and GUARD in standalone simics 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 Reviewed-by: Luis P Fernandez Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Matt Derksen Reviewed-by: Nicholas E Bofferding --- src/build/buildpnor/PnorUtils.pm | 16 ++++++++++++++++ src/build/buildpnor/pnorLayoutAxone.xml | 6 ++++++ src/build/configs/simics_axone.config | 2 +- src/build/simics/standalone.simics | 32 +++++++++++++++++++++++++++++++- src/build/tools/hb | 2 +- 5 files changed, 55 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/build/buildpnor/PnorUtils.pm b/src/build/buildpnor/PnorUtils.pm index c889893e2..e5ecbb150 100644 --- a/src/build/buildpnor/PnorUtils.pm +++ b/src/build/buildpnor/PnorUtils.pm @@ -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
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; diff --git a/src/build/buildpnor/pnorLayoutAxone.xml b/src/build/buildpnor/pnorLayoutAxone.xml index a4f3bf4e2..274439a39 100644 --- a/src/build/buildpnor/pnorLayoutAxone.xml +++ b/src/build/buildpnor/pnorLayoutAxone.xml @@ -102,6 +102,12 @@ Layout Description sideless
+
+ Attributes + ATTR_TMP + 0x4000 + sideless +
Hostboot Base (1MB) HBB diff --git a/src/build/configs/simics_axone.config b/src/build/configs/simics_axone.config index ae799a4f6..c3f33e583 100644 --- a/src/build/configs/simics_axone.config +++ b/src/build/configs/simics_axone.config @@ -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 diff --git a/src/build/simics/standalone.simics b/src/build/simics/standalone.simics index dbd5cc920..c785dfc44 100755 --- a/src/build/simics/standalone.simics +++ b/src/build/simics/standalone.simics @@ -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) { @@ -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) { diff --git a/src/build/tools/hb b/src/build/tools/hb index 013700f84..9e7e38a48 100755 --- a/src/build/tools/hb +++ b/src/build/tools/hb @@ -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 "**********" -- cgit v1.2.1