diff options
author | Stephen Cprek <smcprek@us.ibm.com> | 2015-09-23 12:49:36 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-09-29 13:35:16 -0500 |
commit | ab89379aa0c4e7ceeae91f6c729cd7d120379dd5 (patch) | |
tree | ca4efeb539023a621aab7f93d031369e9ffc8cd2 /src/build/buildpnor | |
parent | 4fab389f133585edd833edd0aeb31f6957432f47 (diff) | |
download | talos-hostboot-ab89379aa0c4e7ceeae91f6c729cd7d120379dd5.tar.gz talos-hostboot-ab89379aa0c4e7ceeae91f6c729cd7d120379dd5.zip |
Allow dynamic sizing of HBI when test cases are run
Change-Id: I30947cb19125e616c57af89434acd8a9811b1a74
RTC:135217
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/20735
Tested-by: Jenkins Server
Tested-by: Jenkins OP Build CI
Reviewed-by: Thi N. Tran <thi@us.ibm.com>
Tested-by: Jenkins OP HW
Tested-by: FSP CI Jenkins
Reviewed-by: Christopher J. Engel <cjengel@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/build/buildpnor')
-rwxr-xr-x | src/build/buildpnor/buildpnor.pl | 62 |
1 files changed, 57 insertions, 5 deletions
diff --git a/src/build/buildpnor/buildpnor.pl b/src/build/buildpnor/buildpnor.pl index 1a18f2dfd..722080aa6 100755 --- a/src/build/buildpnor/buildpnor.pl +++ b/src/build/buildpnor/buildpnor.pl @@ -67,7 +67,7 @@ my $pnorLayoutFile; my $pnorBinName = ""; my $tocVersion = 0x1; my $g_TOCEyeCatch = "part"; -my $emitTestSections = 0; +my $testRun = 0; my $g_fpartCmd = ""; my $g_fcpCmd = ""; my %sidelessSecFilled = (); @@ -76,6 +76,7 @@ my %SideOptions = ( B => "B", sideless => "sideless", ); +use constant PAGE_SIZE => 4096; if ($#ARGV < 0) { usage(); @@ -113,7 +114,7 @@ for (my $i=0; $i < $#ARGV + 1; $i++) $g_fcpCmd = $ARGV[++$i]; } elsif($ARGV[$i] =~ /--test/) { - $emitTestSections = 1; + $testRun = 1; } else { traceErr("Unrecognized Input: $ARGV[$i]"); @@ -254,7 +255,7 @@ sub loadPnorLayout my $sha512perEC = (exists $sectionEl->{sha512perEC} ? "yes" : "no"); my $preserved = (exists $sectionEl->{preserved} ? "yes" : "no"); my $readOnly = (exists $sectionEl->{readOnly} ? "yes" : "no"); - if (($emitTestSections == 0) && ($sectionEl->{testonly}[0] eq "yes")) + if (($testRun == 0) && ($sectionEl->{testonly}[0] eq "yes")) { next; } @@ -784,8 +785,19 @@ sub checkSpaceConstraints if($filesize > $physicalRegionSize) { - trace(0, "$this_func: Image provided ($$i_binFiles{$eyeCatch}) has size ($filesize) which is greater than allocated space ($physicalRegionSize) for section=$eyeCatch. Aborting!"); - $rc = 1; + # If this is a test run increase HBI size by PAGE_SIZE until all test + # cases fit + if ($testRun && $eyeCatch eq "HBI") + { + print "Adjusting HBI size - ran out of space for test cases\n"; + my $hbbKey = findLayoutKeyByEyeCatch("HBB", \%$i_pnorLayoutRef); + adjustHbiPhysSize(\%sectionHash, $layoutKey, $filesize, $hbbKey); + } + else + { + trace(0, "$this_func: Image provided ($$i_binFiles{$eyeCatch}) has size ($filesize) which is greater than allocated space ($physicalRegionSize) for section=$eyeCatch. Aborting!"); + $rc = 1; + } } } @@ -793,6 +805,46 @@ sub checkSpaceConstraints return $rc; } +############################################################################### +# adjustHbiPhysSize - Adjust HBI physical size when running test cases and fix +# up physical offsets of partitions between HBI and HBB +################################################################################ +sub adjustHbiPhysSize +{ + my ($i_sectionHashRef, $i_hbiKey, $i_filesize, $i_hbbKey) = @_; + + my %sectionHash = %$i_sectionHashRef; + + # Increment HBI physical size by PAGE_SIZE until the HBI file can fit + my $hbi_old = $sectionHash{$i_hbiKey}{physicalRegionSize}; + while ($i_filesize > $sectionHash{$i_hbiKey}{physicalRegionSize}) + { + $sectionHash{$i_hbiKey}{physicalRegionSize} += PAGE_SIZE; + } + my $hbi_move = $sectionHash{$i_hbiKey}{physicalRegionSize} - $hbi_old; + my $hbi_end = $sectionHash{$i_hbiKey}{physicalRegionSize} + $hbi_move; + + # Fix up physical offset affected by HBI size change + foreach my $section (keys %sectionHash) + { + # Only fix partitions after HBI and before HBB + if ( ( $sectionHash{$section}{physicalOffset} > + $sectionHash{$i_hbiKey}{physicalOffset} ) && + ( $sectionHash{$section}{physicalOffset} < + $sectionHash{$i_hbbKey}{physicalOffset} ) + ) + { + $sectionHash{$section}{physicalOffset} += $hbi_move; + # Ensure section adjustment does not cause an overlap with HBB + if ($sectionHash{$section}{physicalOffset} > + $sectionHash{$i_hbbKey}{physicalOffset}) + { + die "Error detected $sectionHash{$section}{eyeCatch}'s adjusted size overlaps HBB"; + } + } + } +} + ############################################################################### # fillPnorImage - Load actual PNOR image with data using the provided input images |