From d5adce60c0cc910171c2938e581f187a2083cba7 Mon Sep 17 00:00:00 2001 From: Dan Crowell Date: Thu, 12 Sep 2013 13:46:07 -0500 Subject: PNOR ECC Support Adding ECC support to the PNOR Resource Provider as well as the makefiles that create the images. Also fixed a bug in the PNOR DD for writes across erase blocks. Change-Id: I31ff6817cd35728badcd23a48fa73e51727142b9 RTC: 66213 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/6203 Reviewed-by: A. Patrick Williams III Reviewed-by: Michael Baiocchi Tested-by: Jenkins Server Reviewed-by: ADAM R. MUHLE --- src/build/buildpnor/buildpnor.pl | 29 +++++++++++++++++++++++++++++ src/build/buildpnor/defaultPnorLayout.xml | 1 + src/build/citest/autocitest | 16 ++++++++++++++++ src/build/mkrules/hbfw/img/makefile | 24 +++++++++++++++++++++--- 4 files changed, 67 insertions(+), 3 deletions(-) (limited to 'src/build') diff --git a/src/build/buildpnor/buildpnor.pl b/src/build/buildpnor/buildpnor.pl index 3c7ded545..6b4e4a1dd 100755 --- a/src/build/buildpnor/buildpnor.pl +++ b/src/build/buildpnor/buildpnor.pl @@ -213,6 +213,8 @@ sub loadPnorLayout my $physicalOffset = $sectionEl->{physicalOffset}[0]; my $physicalRegionSize = $sectionEl->{physicalRegionSize}[0]; my $side = $sectionEl->{side}[0]; + my $testonly = $sectionEl->{testonly}[0]; + my $ecc = (exists $sectionEl->{ecc} ? "yes" : "no"); if (($emitTestSections == 0) && ($sectionEl->{testonly}[0] eq "yes")) { @@ -231,6 +233,7 @@ sub loadPnorLayout $$i_pnorLayoutRef{sections}{$physicalOffset}{physicalOffset} = $physicalOffset; $$i_pnorLayoutRef{sections}{$physicalOffset}{physicalRegionSize} = $physicalRegionSize; $$i_pnorLayoutRef{sections}{$physicalOffset}{side} = $side; + $$i_pnorLayoutRef{sections}{$physicalOffset}{ecc} = $ecc; } @@ -319,6 +322,7 @@ sub createPnorImage #Add Partition #f{fs,part} --add --target tuleta.pnor --partition-offset 0 --offset 0x1000 --size 0x280000 --name HBI --flags 0x0 if ($g_ffsCmd eq "") { + trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0"); my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0`; } else { my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $sideAOffset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0`; @@ -330,6 +334,31 @@ sub createPnorImage last; } + #ECC flag + my $chip = 0; + my $compress = 0; + my $ecc = 0; + if( ($sectionHash{$key}{ecc} eq "yes") ) + { + $ecc = 0x8000; + }; + #[1:chip][1:compression][2:ecc] + my $userflags0 = ($chip << 16) + | ($compress << 8) + | $ecc; + trace(0,"userflags0 = $userflags0"); + if ($g_ffsCmd eq "") { + trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset --user 0 --name $eyeCatch --value $userflags0"); + my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset --user 0 --name $eyeCatch --value $userflags0`; + } + $rc = $?; + if($rc) + { + trace(0, "$this_func: Call to add userdata to $eyeCatch failed. rc=$rc. Aborting!"); + last; + } + + #Trunc Partition #f{fs,part} --target tuleta.pnor --partition-offset 0 --name HBI --trunc if ($g_ffsCmd eq "") { diff --git a/src/build/buildpnor/defaultPnorLayout.xml b/src/build/buildpnor/defaultPnorLayout.xml index 102b0fad3..58eafe112 100644 --- a/src/build/buildpnor/defaultPnorLayout.xml +++ b/src/build/buildpnor/defaultPnorLayout.xml @@ -108,6 +108,7 @@ Layout Description 0x8000 A +
Hostboot Data (1M) diff --git a/src/build/citest/autocitest b/src/build/citest/autocitest index a4f083893..d79737637 100755 --- a/src/build/citest/autocitest +++ b/src/build/citest/autocitest @@ -319,6 +319,8 @@ mods_started_addr=`grep "CxxTest::g_ModulesStarted" \ ${SBXHOME}/${HBICORE_TEST_SYMS} | awk '{split($0,a,","); print a[2]}'` mods_completed_addr=`grep "CxxTest::g_ModulesCompleted" \ ${SBXHOME}/${HBICORE_TEST_SYMS} | awk '{split($0,a,","); print a[2]}'` +shutdown_status=`grep "CpuManager::cv_shutdown_status" \ + ${SBXHOME}/${HBICORE_TEST_SYMS} | awk '{split($0,a,","); print a[2]}'` #Adjust addresses for HRMOR HRMOR=`autosim $NOWIN --simcmd "python \"getHRMOR()\""| tr -d '\n\r'` @@ -344,6 +346,9 @@ mods_started_addr=`echo "obase=16; $temp" | bc` temp=$(($HRMOR + 0x$mods_completed_addr)) mods_completed_addr=`echo "obase=16; $temp" | bc` +temp=$(($HRMOR + 0x$shutdown_status)) +shutdown_status=`echo "obase=16; $temp" | bc` + ## note, don't use $VERBOSE here or you get all sorts of extra junk in the output file. echo "Wait for unit test completion." declare -i timeout=0 @@ -368,6 +373,17 @@ while [ $(($modsstarted)) -lt 1 -o $(($modsstarted)) -ne $(($modscompleted)) ]; fi done +echo "====> waiting for shutdown..." +loopcount=0 +while [ "$loopcount" -lt 6 ]; do + autosim $NOWIN --simcmd "print ((system_cmp0.phys_mem).read 0x$shutdown_status 0x08)" 1> $SBXHOME/shutdown_status.log 2> /dev/null + shutdown_yet=`cat $SBXHOME/shutdown_status.log | awk '/0x/ {print strtonum($1)}'` + if [ "$shutdown_yet" -ne 0 ]; then + break + fi + sleep 5 + ((loopcount++)) # increment loopcount +done echo "====> dump totaltests..." autosim $NOWIN --simcmd "print ((system_cmp0.phys_mem).read 0x$totaltests_addr 0x08)" 1> $SBXHOME/totaltests.log 2> /dev/null diff --git a/src/build/mkrules/hbfw/img/makefile b/src/build/mkrules/hbfw/img/makefile index e6f4b39a0..dcaf0ea25 100755 --- a/src/build/mkrules/hbfw/img/makefile +++ b/src/build/mkrules/hbfw/img/makefile @@ -52,7 +52,16 @@ BASE_IMAGES = ${BASE_IMAGE} ${EXT_IMAGE} ${HBRT_IMAGE} BASE_W_HEADER_IMAGE = hostboot.header.bin BASE_W_HEADER_ECC_IMAGE = hostboot.header.bin.ecc BASE_ECC_IMAGE = hostboot.bin.ecc - +EXT_PAD_IMAGE = hostboot_extended.bin.pad +EXT_ECC_IMAGE = hostboot_extended.bin.ecc +TESTDATA = hbtestdata.bin +TESTDATA_ECC = hbtestdata.bin.ecc +ALL_HB_IMAGES = ${BASE_IMAGES} \ + ${BASE_W_HEADER_IMAGE} \ + ${BASE_ECC_IMAGE} ${EXT_ECC_IMAGE} \ + ${BASE_W_HEADER_ECC_IMAGE} \ + ${EXT_PAD_IMAGE} \ + ${TESTDATA} ${TESTDATA_ECC} cp_hbfiles: .SPECTARG ${BASE_IMAGES:@image@cp -f -u ${SRCPATH:F${image}} ${image};@} @@ -64,9 +73,15 @@ cp_hbfiles: .SPECTARG currentsb -chain ecc --inject ${BASE_IMAGE} --output ${BASE_ECC_IMAGE} --p8 ecc --inject ${BASE_W_HEADER_IMAGE} --output ${BASE_W_HEADER_ECC_IMAGE} --p8 + # dd command will pad image up to the next 4K page + dd if=${EXT_IMAGE} of=${EXT_PAD_IMAGE} ibs=4k count=1280 conv=sync + ecc --inject ${EXT_PAD_IMAGE} --output ${EXT_ECC_IMAGE} --p8 + # create data for a test partition in pnor + dd if=/dev/urandom of=${TESTDATA} bs=1 count=28K + ecc --inject ${TESTDATA} --output ${TESTDATA_ECC} --p8 clobber_cp_hbfiles: - rm -f ${BASE_IMAGES} ${BASE_W_HEADER_IMAGE} {BASE_W_HEADER_ECC_IMAGE} \ + rm -f ${ALL_HB_IMAGES} \ sbe.header secureboot.header hb.footer hostboot.stage.bin @@ -89,7 +104,10 @@ PNOR_BUILD_SCRIPT = ${buildpnor.pl:P} #so need to use tryinclude for now. .tryinclude <${.PATH:Ffips_pnor.mk}> -HOSTBOOT_DEFAULT_SECTIONS = HBB=${BASE_W_HEADER_ECC_IMAGE},HBI=${EXT_IMAGE},HBRT=${HBRT_IMAGE} +#uncomment the below line to enable ECC in the extended image +#HOSTBOOT_DEFAULT_SECTIONS = HBB=${BASE_W_HEADER_ECC_IMAGE},HBI=${EXT_ECC_IMAGE},HBRT=${HBRT_IMAGE},TEST=${TESTDATA_ECC} +HOSTBOOT_DEFAULT_SECTIONS = HBB=${BASE_W_HEADER_ECC_IMAGE},HBI=${EXT_IMAGE},HBRT=${HBRT_IMAGE},TEST=${TESTDATA_ECC} + HBFW_OBJPATH = ${.PATH:M*obj*} ENGD_OBJPATH = ${HBFW_OBJPATH:S/hbfw\/img/engd\/href/g} -- cgit v1.2.1