diff options
author | Mike Baiocchi <mbaiocch@us.ibm.com> | 2018-11-15 13:30:49 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-11-27 13:05:31 -0600 |
commit | 2ce1bf13b5bf0d156732b2c5f91721e15cb92f01 (patch) | |
tree | ad8f2fa4f7eb88dc4bded80f88bac83df93ce093 | |
parent | 63a9aa53dcf3c7ddcff756e694ddcff246b5c9f2 (diff) | |
download | talos-hostboot-2ce1bf13b5bf0d156732b2c5f91721e15cb92f01.tar.gz talos-hostboot-2ce1bf13b5bf0d156732b2c5f91721e15cb92f01.zip |
Make TOC partion Read-Only in all PNOR Layouts
This commit ensures that the TOC(s) are all set to "read-only" via
the FFS flags for all PNOR files that are created. It also does
the same for the "BACKUP_PART" and "OTHER_SIDE" partitions, if they
exist, as well.
Change-Id: I5698045b27630e2cb83f470193526ceea02c61d3
CQ:SW423354
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/68828
Reviewed-by: Marshall J. Wilks <mjwilks@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@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: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Reviewed-by: Ilya Smirnov <ismirno@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rwxr-xr-x | src/build/buildpnor/buildpnor.pl | 18 | ||||
-rw-r--r-- | src/usr/pnor/pnor_common.C | 4 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/build/buildpnor/buildpnor.pl b/src/build/buildpnor/buildpnor.pl index de46fa25e..227e8fe0f 100755 --- a/src/build/buildpnor/buildpnor.pl +++ b/src/build/buildpnor/buildpnor.pl @@ -6,7 +6,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2012,2017 +# Contributors Listed Below - COPYRIGHT 2012,2018 # [+] International Business Machines Corp. # # @@ -136,7 +136,10 @@ foreach my $sideId ( keys %{$pnorLayout{metadata}{sides}} ) my $userflags1 = ($pnorLayout{metadata}{sides}{$sideId}{golden} eq "yes") ? 0x01 : 0x00; - #add a golden bit to the misc flags in userflag1 + # Make the TOC Read-only + $userflags1 |= 0x40; + + #add the golden and read-only bits to the misc flags in userflag1 $userflags1 = $userflags1 << 16; trace(2, "$g_fpartCmd --target $pnorBinName --partition-offset $tocOffset --user 1 --name part --value $userflags1 --force"); system("$g_fpartCmd --target $pnorBinName --partition-offset $tocOffset --user 1 --name part --value $userflags1 --force"); @@ -373,6 +376,11 @@ sub addTOCInfo my $otherSide = getOtherSide($sideId); my $numOfTOCs = scalar keys %{$$i_pnorLayout{metadata}{sides}{$sideId}{toc}}; + #Using userflags mark these sections read-only (0x40) and indicate that + #they are puesdo-partitions that should be skipped on code update (0x20) + my $userflags1 = 0x40 | 0x20; + $userflags1 = $userflags1 << 16; + #Adding an extra entry in the TOC that points to its backup TOC and other side's TOC (if other side exists). #This is used to search for all the TOCs in PnorRP code. The idea is to create a link between the tocs such that #if we can find one valid TOC, then we can look at its BACKUP_PART entry or OTHER_SIDE entry in the TOC to @@ -388,9 +396,7 @@ sub addTOCInfo system("$g_fpartCmd --target $i_pnorBinName --partition-offset $toc_offset --add --offset $backup_offset --size $physicalRegionSize --name $backup_part --flags 0x0"); die "ERROR: Call to add partition $backup_part failed. Aborting!" if ($?); - #indicate that this is a puesdo-partition and should be skipped on code update - my $userflags1 = 0x20; - $userflags1 = $userflags1 << 16; + #adding user flags trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $toc_offset --user 1 --name $backup_part --value $userflags1 --force"); system("$g_fpartCmd --target $i_pnorBinName --partition-offset $toc_offset --user 1 --name $backup_part --value $userflags1 --force"); die "ERROR: Call to set BACKUP_PART as pseudo failed. Aborting!" if ($?); @@ -404,7 +410,7 @@ sub addTOCInfo system("$g_fpartCmd --target $i_pnorBinName --partition-offset $toc_offset --add --offset $otherSide_offset --size $physicalRegionSize --name $other_side --flags 0x0"); die "ERROR: Call to add partition $other_side failed. Aborting!" if($?); - #indicate that this is a puesdo-partition and should be skipped on code update + #adding user flags trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $toc_offset --user 1 --name $other_side --value $userflags1 --force"); system("$g_fpartCmd --target $i_pnorBinName --partition-offset $toc_offset --user 1 --name $other_side --value $userflags1 --force"); die "ERROR: Call to set OTHER_SIDE as pseudo failed. Aborting!" if($?); diff --git a/src/usr/pnor/pnor_common.C b/src/usr/pnor/pnor_common.C index 6bf7cc480..3b642a6e6 100644 --- a/src/usr/pnor/pnor_common.C +++ b/src/usr/pnor/pnor_common.C @@ -332,9 +332,9 @@ errlHndl_t PNOR::parseTOC( uint8_t* i_tocBuffer,SectionData_t * o_TOC, tmpId < PNOR::NUM_SECTIONS; tmpId ++ ) { - TRACFCOMP(g_trac_pnor, "%s: secure=0x%.2X size=0x%.8X flash=0x%.8X ", + TRACFCOMP(g_trac_pnor, "%s: secure=0x%.2X size=0x%.8X flash=0x%.8X misc=0x%.2X", PNOR::SectionIdToString(tmpId), o_TOC[tmpId].secure, - o_TOC[tmpId].size, o_TOC[tmpId].flashAddr); + o_TOC[tmpId].size, o_TOC[tmpId].flashAddr, o_TOC[tmpId].misc); } } while (0); |