Matt Ploetz | 940dcf6 | 2015-02-13 13:52:56 -0600 | [diff] [blame^] | 1 | From a05bf62e7eb14354ca2d6ca45b149aac6dbd193c Mon Sep 17 00:00:00 2001 |
| 2 | From: Matt Ploetz <maploetz@us.ibm.com> |
| 3 | Date: Wed, 11 Feb 2015 11:41:48 -0600 |
| 4 | Subject: [PATCH] Revert "Support for Redundant Copy of HB code in PNOR" |
| 5 | |
| 6 | This reverts commit 67c5a1ebe73f81bca1bb6608bbb8f204f0f37fa8. |
| 7 | --- |
| 8 | src/build/buildpnor/buildpnor.pl | 590 +++++++++++----------------- |
| 9 | src/build/buildpnor/defaultPnorLayout.xml | 91 ++--- |
| 10 | src/build/mkrules/hbfw/img/makefile | 4 +- |
| 11 | src/include/usr/hwas/hwasPlatDeconfigGard.H | 19 +- |
| 12 | src/include/usr/pnor/pnor_reasoncodes.H | 2 - |
| 13 | src/include/usr/pnor/pnorif.H | 39 +- |
| 14 | src/usr/hwas/hwasPlatDeconfigGard.C | 89 +---- |
| 15 | src/usr/pnor/HBconfig | 5 - |
| 16 | src/usr/pnor/common/ffs_hb.H | 7 +- |
| 17 | src/usr/pnor/makefile | 1 - |
| 18 | src/usr/pnor/pnor_common.C | 182 ++------- |
| 19 | src/usr/pnor/pnor_common.H | 19 +- |
| 20 | src/usr/pnor/pnorrp.C | 152 +++---- |
| 21 | src/usr/pnor/pnorrp.H | 26 +- |
| 22 | src/usr/pnor/pnorsbe.C | 87 ---- |
| 23 | src/usr/pnor/pnorvalid.C | 5 +- |
| 24 | src/usr/pnor/runtime/rt_pnor.C | 11 +- |
| 25 | src/usr/pnor/runtime/rt_pnor.H | 2 +- |
| 26 | src/usr/pnor/test/pnorrptest.H | 104 +---- |
| 27 | src/usr/sbe/sbe_update.C | 95 +++-- |
| 28 | src/usr/sbe/sbe_update.H | 38 +- |
| 29 | src/usr/sbe/test/sbeupdatetest.H | 24 +- |
| 30 | 22 files changed, 535 insertions(+), 1057 deletions(-) |
| 31 | delete mode 100644 src/usr/pnor/pnorsbe.C |
| 32 | |
| 33 | diff --git a/src/build/buildpnor/buildpnor.pl b/src/build/buildpnor/buildpnor.pl |
| 34 | index f6df6c8..51b6922 100755 |
| 35 | --- a/src/build/buildpnor/buildpnor.pl |
| 36 | +++ b/src/build/buildpnor/buildpnor.pl |
| 37 | @@ -6,7 +6,7 @@ |
| 38 | # |
| 39 | # OpenPOWER HostBoot Project |
| 40 | # |
| 41 | -# Contributors Listed Below - COPYRIGHT 2012,2015 |
| 42 | +# Contributors Listed Below - COPYRIGHT 2012,2014 |
| 43 | # [+] International Business Machines Corp. |
| 44 | # |
| 45 | # |
| 46 | @@ -62,20 +62,16 @@ my $g_trace = 1; |
| 47 | my $programName = File::Basename::basename $0; |
| 48 | my %pnorLayout; |
| 49 | my %binFiles; |
| 50 | + |
| 51 | + |
| 52 | my $pnorLayoutFile; |
| 53 | my $pnorBinName = ""; |
| 54 | my $tocVersion = 0x1; |
| 55 | my $g_TOCEyeCatch = "part"; |
| 56 | my $emitTestSections = 0; |
| 57 | +my $g_ffsCmd = ""; |
| 58 | my $g_fpartCmd = ""; |
| 59 | my $g_fcpCmd = ""; |
| 60 | -my %sidelessSecFilled = (); |
| 61 | - |
| 62 | -my %SideOptions = ( |
| 63 | - A => "A", |
| 64 | - B => "B", |
| 65 | - sideless => "sideless", |
| 66 | - ); |
| 67 | |
| 68 | if ($#ARGV < 0) { |
| 69 | usage(); |
| 70 | @@ -106,6 +102,9 @@ for (my $i=0; $i < $#ARGV + 1; $i++) |
| 71 | my $argVal = $ARGV[++$i]; |
| 72 | saveInputFile("--binFile", $argName, $argVal, \%binFiles); |
| 73 | } |
| 74 | + elsif($ARGV[$i] =~ /--ffsCmd/) { |
| 75 | + $g_ffsCmd = $ARGV[++$i]; |
| 76 | + } |
| 77 | elsif($ARGV[$i] =~ /--fpartCmd/) { |
| 78 | $g_fpartCmd = $ARGV[++$i]; |
| 79 | } |
| 80 | @@ -122,14 +121,12 @@ for (my $i=0; $i < $#ARGV + 1; $i++) |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | -############################## Begin Actions ################################## |
| 85 | - |
| 86 | -#Delete File (pnorBinName) if exists to prevent errors when making layout |
| 87 | -#changes |
| 88 | -if (-e $pnorBinName) |
| 89 | -{ |
| 90 | - unlink $pnorBinName or warn "Could not unlink $pnorBinName: $!"; |
| 91 | -} |
| 92 | +#Extract ffs version number from help text. |
| 93 | +#Use to trigger using proper input parms.. |
| 94 | +#my $ffsParms = 0; |
| 95 | +#my $ffsVersion = `$g_ffsCmd 2>&1 | grep "Partition Tool" `; |
| 96 | +#$ffsVersion =~ s/.*(v[0-9\.]*).*/\1/; |
| 97 | +#$ffsVersion = $1; |
| 98 | |
| 99 | #Load PNOR Layout XML file |
| 100 | my $rc = loadPnorLayout($pnorLayoutFile, \%pnorLayout); |
| 101 | @@ -139,6 +136,9 @@ if($rc != 0) |
| 102 | exit 1; |
| 103 | } |
| 104 | |
| 105 | +#trace(1, Dumper(%pnorLayout->{1576960})); |
| 106 | +#trace(1, Dumper(%binFiles)); |
| 107 | + |
| 108 | #Verify all the section files exist |
| 109 | my $rc = verifyFilesExist(\%pnorLayout, \%binFiles); |
| 110 | if($rc != 0) |
| 111 | @@ -161,48 +161,42 @@ if($rc != 0) |
| 112 | trace(0, "Error detected from call to checkSpaceConstraints(). Exiting"); |
| 113 | exit 1; |
| 114 | } |
| 115 | -trace(1, "Done checkSpaceConstraints"); |
| 116 | - |
| 117 | -# @TODO RTC: 120062 - Determine which side is Golden, possibly handle a new |
| 118 | -# xml tag |
| 119 | -# Create all Partition Tables at each TOC offset |
| 120 | -# Each side has 2 TOC's created at different offsets for backup purposes. |
| 121 | -# Loop all side sections |
| 122 | -foreach my $sideId ( keys %{$pnorLayout{metadata}{sides}} ) |
| 123 | + |
| 124 | +#create the PNOR image |
| 125 | +#two copies of TOC created at different offsets |
| 126 | +my $sideAOffset = $pnorLayout{metadata}{sideAOffset}; |
| 127 | +my $sideBOffset = $pnorLayout{metadata}{sideBOffset}; |
| 128 | + |
| 129 | +$rc = createPnorImg($tocVersion, $pnorBinName, \%pnorLayout, $sideAOffset, 'A'); |
| 130 | +if($rc != 0) |
| 131 | { |
| 132 | - # Loop all tocs (primary and backup) |
| 133 | - foreach my $toc ( keys %{$pnorLayout{metadata}{sides}{$sideId}{toc}}) |
| 134 | - { |
| 135 | - my $tocOffset = $pnorLayout{metadata}{sides}{$sideId}{toc}{$toc}; |
| 136 | + trace(0, "Error detected from createPnorImg() sideAOffset. Exiting"); |
| 137 | + exit 1; |
| 138 | +} |
| 139 | |
| 140 | - $rc = createPnorPartition($tocVersion, $pnorBinName, \%pnorLayout, |
| 141 | - $sideId, $tocOffset); |
| 142 | - if($rc != 0) |
| 143 | - { |
| 144 | - trace(0, "Error detected from createPnorPartition() $tocOffset Exiting"); |
| 145 | - exit 1; |
| 146 | - } |
| 147 | - } |
| 148 | +$rc = createPnorImg($tocVersion, $pnorBinName, \%pnorLayout, $sideBOffset, 'B'); |
| 149 | +if($rc != 0) |
| 150 | +{ |
| 151 | + trace(0, "Error detected from createPnorImg() sideBOffset. Exiting"); |
| 152 | + exit 1; |
| 153 | } |
| 154 | |
| 155 | -# Fill all sides |
| 156 | -foreach my $sideId ( keys %{$pnorLayout{metadata}{sides}} ) |
| 157 | +$rc = fillPnorImage($pnorBinName, \%pnorLayout, \%binFiles, $sideAOffset, 'A'); |
| 158 | +if($rc != 0) |
| 159 | { |
| 160 | - my $tocOffset = $pnorLayout{metadata}{sides}{$sideId}{toc}{primary}; |
| 161 | + trace(0, "Error detected from call to fillPnorImage() sideAOffset. Exiting"); |
| 162 | + exit 1; |
| 163 | +} |
| 164 | |
| 165 | - $rc = fillPnorImage($pnorBinName, \%pnorLayout, \%binFiles, $sideId, |
| 166 | - $tocOffset); |
| 167 | - if($rc != 0) |
| 168 | - { |
| 169 | - trace(0, "Error detected from call to fillPnorImage() sideATocOffset. Exiting"); |
| 170 | - exit 1; |
| 171 | - } |
| 172 | +$rc = fillPnorImage($pnorBinName, \%pnorLayout, \%binFiles, $sideBOffset, 'B'); |
| 173 | +if($rc != 0) |
| 174 | +{ |
| 175 | + trace(0, "Error detected from call to fillPnorImage() sideBOffset. Exiting"); |
| 176 | + exit 1; |
| 177 | } |
| 178 | |
| 179 | exit 0; |
| 180 | |
| 181 | -######################### Begin Utility Subroutines ########################### |
| 182 | - |
| 183 | ################################################################################ |
| 184 | # loadPnorLayout |
| 185 | ################################################################################ |
| 186 | @@ -221,52 +215,33 @@ sub loadPnorLayout |
| 187 | my $xs = new XML::Simple(keyattr=>[], forcearray => 1); |
| 188 | my $xml = $xs->XMLin($i_pnorFile); |
| 189 | |
| 190 | + #trace(1, "pnorLayoutXML \n ".Dumper($xml)); |
| 191 | + |
| 192 | #Save the meatadata - imageSize, blockSize, etc. |
| 193 | - # @TODO RTC:120062 enhance metadata section, fix metadataE1 to match xml |
| 194 | - # and change TOC names accordingly |
| 195 | foreach my $metadataEl (@{$xml->{metadata}}) |
| 196 | { |
| 197 | - # Get meta data |
| 198 | my $imageSize = $metadataEl->{imageSize}[0]; |
| 199 | my $blockSize = $metadataEl->{blockSize}[0]; |
| 200 | + my $sideAOffset = $metadataEl->{sideAOffset}[0]; |
| 201 | + my $sideBOffset = $metadataEl->{sideBOffset}[0]; |
| 202 | + |
| 203 | + trace(3, "$this_func: metadata: imageSize = $imageSize, blockSize=$blockSize, sideAOffset=$sideAOffset, sideBOffset=$sideBOffset"); |
| 204 | + |
| 205 | $imageSize = getNumber($imageSize); |
| 206 | $blockSize = getNumber($blockSize); |
| 207 | + $sideAOffset = getNumber($sideAOffset); |
| 208 | + $sideBOffset = getNumber($sideBOffset); |
| 209 | + |
| 210 | $$i_pnorLayoutRef{metadata}{imageSize} = $imageSize; |
| 211 | $$i_pnorLayoutRef{metadata}{blockSize} = $blockSize; |
| 212 | - |
| 213 | - # Get Side A |
| 214 | - my $sideATocOffset = $metadataEl->{sideATocOffset}[0]; |
| 215 | - my $sideATocBackupOffset = $metadataEl->{sideATocBackupOffset}[0]; |
| 216 | - $sideATocOffset = getNumber($sideATocOffset); |
| 217 | - $sideATocBackupOffset = getNumber($sideATocBackupOffset); |
| 218 | - # @TODO RTC: 120062 change pnorLayoutRef hash to match new xml |
| 219 | - $$i_pnorLayoutRef{metadata}{sides}{$SideOptions{A}}{toc}{primary} = $sideATocOffset; |
| 220 | - $$i_pnorLayoutRef{metadata}{sides}{$SideOptions{A}}{toc}{backup} = $sideATocBackupOffset; |
| 221 | - |
| 222 | - # Get side B info (if it exists) |
| 223 | - if (exists $metadataEl->{sideBTocOffset}[0]) |
| 224 | - { |
| 225 | - trace(1, "Adding Side B information ...."); |
| 226 | - my $sideBTocOffset = $metadataEl->{sideBTocOffset}[0]; |
| 227 | - my $sideBTocBackupOffset = $metadataEl->{sideBTocBackupOffset}[0]; |
| 228 | - $sideBTocOffset = getNumber($sideBTocOffset); |
| 229 | - $sideBTocBackupOffset = getNumber($sideBTocBackupOffset); |
| 230 | - # @TODO RTC: 120062 change pnorLayoutRef hash to match new xml |
| 231 | - $$i_pnorLayoutRef{metadata}{sides}{$SideOptions{B}}{toc}{primary} = $sideBTocOffset; |
| 232 | - $$i_pnorLayoutRef{metadata}{sides}{$SideOptions{B}}{toc}{backup} = $sideBTocBackupOffset; |
| 233 | - |
| 234 | - trace(3, "$this_func: metadata: imageSize = $imageSize, blockSize=$blockSize, sideATocOffset=$sideATocOffset, sideATocBackupOffset=$sideATocBackupOffset, sideBTocOffset=$sideBTocOffset, sideBTocBackupOffset=$sideBTocBackupOffset"); |
| 235 | - } |
| 236 | - else |
| 237 | - { |
| 238 | - trace(3, "$this_func: metadata: imageSize = $imageSize, blockSize=$blockSize, sideATocOffset=$sideATocOffset, sideATocBackupOffset=$sideATocBackupOffset"); |
| 239 | - } |
| 240 | - |
| 241 | + $$i_pnorLayoutRef{metadata}{sideAOffset} = $sideAOffset; |
| 242 | + $$i_pnorLayoutRef{metadata}{sideBOffset} = $sideBOffset; |
| 243 | } |
| 244 | |
| 245 | #Iterate over the <section> elements. |
| 246 | foreach my $sectionEl (@{$xml->{section}}) |
| 247 | { |
| 248 | + #trace(1, "current Element: \n ".Dumper($sectionEl)); |
| 249 | my $description = $sectionEl->{description}[0]; |
| 250 | my $eyeCatch = $sectionEl->{eyeCatch}[0]; |
| 251 | my $physicalOffset = $sectionEl->{physicalOffset}[0]; |
| 252 | @@ -276,9 +251,7 @@ sub loadPnorLayout |
| 253 | my $ecc = (exists $sectionEl->{ecc} ? "yes" : "no"); |
| 254 | my $sha512Version = (exists $sectionEl->{sha512Version} ? "yes" : "no"); |
| 255 | my $sha512perEC = (exists $sectionEl->{sha512perEC} ? "yes" : "no"); |
| 256 | - my $sideless = (exists $sectionEl->{sideless} ? "yes" : "no"); |
| 257 | - my $preserved = (exists $sectionEl->{preserved} ? "yes" : "no"); |
| 258 | - my $readOnly = (exists $sectionEl->{readOnly} ? "yes" : "no"); |
| 259 | + |
| 260 | if (($emitTestSections == 0) && ($sectionEl->{testonly}[0] eq "yes")) |
| 261 | { |
| 262 | next; |
| 263 | @@ -289,6 +262,8 @@ sub loadPnorLayout |
| 264 | $physicalOffset = getNumber($physicalOffset); |
| 265 | $physicalRegionSize = getNumber($physicalRegionSize); |
| 266 | |
| 267 | + # trace(4, "$this_func: physicalOffset=$physicalOffset, physicalRegionSize=$physicalRegionSize"); |
| 268 | + |
| 269 | $$i_pnorLayoutRef{sections}{$physicalOffset}{description} = $description; |
| 270 | $$i_pnorLayoutRef{sections}{$physicalOffset}{eyeCatch} = $eyeCatch; |
| 271 | $$i_pnorLayoutRef{sections}{$physicalOffset}{physicalOffset} = $physicalOffset; |
| 272 | @@ -297,9 +272,6 @@ sub loadPnorLayout |
| 273 | $$i_pnorLayoutRef{sections}{$physicalOffset}{ecc} = $ecc; |
| 274 | $$i_pnorLayoutRef{sections}{$physicalOffset}{sha512Version} = $sha512Version; |
| 275 | $$i_pnorLayoutRef{sections}{$physicalOffset}{sha512perEC} = $sha512perEC; |
| 276 | - $$i_pnorLayoutRef{sections}{$physicalOffset}{sideless} = $sideless; |
| 277 | - $$i_pnorLayoutRef{sections}{$physicalOffset}{preserved} = $preserved; |
| 278 | - $$i_pnorLayoutRef{sections}{$physicalOffset}{readOnly} = $readOnly; |
| 279 | |
| 280 | } |
| 281 | |
| 282 | @@ -307,16 +279,23 @@ sub loadPnorLayout |
| 283 | } |
| 284 | |
| 285 | ################################################################################ |
| 286 | -# createPnorImg - Create PNOR image based on input data. |
| 287 | +# createPnorImg - Create PNOR image and partitions based on input data. |
| 288 | ################################################################################ |
| 289 | sub createPnorImg |
| 290 | { |
| 291 | - my ($i_tocVersion, $i_pnorBinName, $i_pnorLayoutRef, $i_offset) = @_; |
| 292 | + my ($i_tocVersion, $i_pnorBinName, $i_pnorLayoutRef, $offset, $side) = @_; |
| 293 | my $this_func = (caller(0))[3]; |
| 294 | my $rc = 0; |
| 295 | + my $key; |
| 296 | + my $other_side = 'B'; |
| 297 | trace(4, "$this_func: >>Enter"); |
| 298 | |
| 299 | - trace(1, "createPnorImg:: $i_offset"); |
| 300 | + trace(1, "createPnorImg:: $offset"); |
| 301 | + |
| 302 | + if($side eq 'B') |
| 303 | + { |
| 304 | + $other_side = 'A'; |
| 305 | + } |
| 306 | |
| 307 | #get Block size |
| 308 | my $blockSize = $$i_pnorLayoutRef{metadata}{blockSize}; |
| 309 | @@ -324,212 +303,154 @@ sub createPnorImg |
| 310 | #Get size of image in blocks |
| 311 | my $imageSize = $$i_pnorLayoutRef{metadata}{imageSize}; |
| 312 | my $blockCount = $imageSize/$blockSize; |
| 313 | - do{ |
| 314 | - if ($blockCount != int($blockCount)) |
| 315 | - { |
| 316 | - trace(0, "$this_func: Image size ($imageSize) is not an even multiple of erase blocks ($blockSize). This is not supported. Aborting!"); |
| 317 | - $rc = 1; |
| 318 | - last; |
| 319 | - } |
| 320 | - |
| 321 | - #f{fs,part} --create tuleta.pnor --partition-offset 0 --size 8MiB --block 4KiB --force |
| 322 | - trace(2, "$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --create --size $imageSize --block $blockSize --force"); |
| 323 | - $rc = `$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --create --size $imageSize --block $blockSize --force`; |
| 324 | - if($rc) |
| 325 | - { |
| 326 | - trace(0, "$this_func: Call to creating image failed. rc=$rc. Aborting!"); |
| 327 | - last; |
| 328 | - } |
| 329 | - }while(0); |
| 330 | - |
| 331 | - return $rc; |
| 332 | -} |
| 333 | - |
| 334 | -################################################################################ |
| 335 | -# addUserData - Add partition user data. |
| 336 | -################################################################################ |
| 337 | -sub addUserData |
| 338 | -{ |
| 339 | - my $i_pnorBinName = shift; |
| 340 | - my $i_offset = shift; |
| 341 | - my $i_key = shift; |
| 342 | - my %i_sectionHash = @_; |
| 343 | - |
| 344 | - my $this_func = (caller(0))[3]; |
| 345 | - my $rc = 0; |
| 346 | - trace(4, "$this_func: >>Enter"); |
| 347 | - |
| 348 | - my $eyeCatch = $i_sectionHash{$i_key}{eyeCatch}; |
| 349 | - |
| 350 | - # User data Flags based on FFS entry user data (ffs_hb_user_t) |
| 351 | - my $chip = 0; |
| 352 | - my $compressType = 0; |
| 353 | - my $dataInteg = 0; |
| 354 | - my $verCheck = 0; |
| 355 | - my $miscFlags = 0; |
| 356 | - |
| 357 | - # DataInteg flag |
| 358 | - if( ($i_sectionHash{$i_key}{ecc} eq "yes") ) |
| 359 | - { |
| 360 | - $dataInteg = 0x8000; |
| 361 | - } |
| 362 | - |
| 363 | - # VerCheck Flag |
| 364 | - if( ($i_sectionHash{$i_key}{sha512Version} eq "yes") ) |
| 365 | + if ($blockCount != int($blockCount)) |
| 366 | { |
| 367 | - $verCheck = 0x80; |
| 368 | - } |
| 369 | - elsif( ($i_sectionHash{$i_key}{sha512perEC} eq "yes") ) |
| 370 | - { |
| 371 | - $verCheck = 0x40; |
| 372 | + trace(0, "$this_func: Image size ($imageSize) is not an even multiple of erase blocks ($blockSize). This is not supported. Aborting!"); |
| 373 | + $rc = 1; |
| 374 | + return $rc; |
| 375 | } |
| 376 | |
| 377 | - # Misc Flags |
| 378 | - if( ($i_sectionHash{$i_key}{preserved} eq "yes") ) |
| 379 | - { |
| 380 | - $miscFlags |= 0x80; |
| 381 | + #f{fs,part} --create tuleta.pnor --partition-offset 0 --size 8MiB --block 4KiB --force |
| 382 | + if ($g_ffsCmd eq "") { |
| 383 | + my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --create --size $imageSize --block $blockSize --force`; |
| 384 | + } else { |
| 385 | + my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $offset --create --size $imageSize --block $blockSize --force`; |
| 386 | } |
| 387 | - if( ($i_sectionHash{$i_key}{readOnly} eq "yes") ) |
| 388 | + $rc = $?; |
| 389 | + if($rc) |
| 390 | { |
| 391 | - $miscFlags |= 0x40; |
| 392 | + trace(0, "$this_func: Call to creating image failed. rc=$rc. Aborting!"); |
| 393 | + return $rc; |
| 394 | } |
| 395 | |
| 396 | + #key into hash data is the physical offset of section. Need to sort the keys |
| 397 | + #so we put things in the correct order in toc. |
| 398 | + #Generally speaking, this loop is populating the FFS Header with records based on the |
| 399 | + #section data specified in the XML + actual sizes of the input binary files. |
| 400 | + my %sectionHash = %{$$i_pnorLayoutRef{sections}}; |
| 401 | |
| 402 | - #First User Data Word |
| 403 | - #[1:chip][1:compressType][2:dataInteg] |
| 404 | - my $userflags0 = ($chip << 24) |
| 405 | - | ($compressType << 16) |
| 406 | - | $dataInteg; |
| 407 | + for $key ( sort {$a<=> $b} keys %sectionHash) |
| 408 | + { |
| 409 | + my $eyeCatch = "UNDEF"; |
| 410 | + my $physicalOffset = 0xFFFFFFFF; |
| 411 | + my $physicalRegionSize = 0xFFFFFFFF; |
| 412 | |
| 413 | - #Second User Data Word |
| 414 | - #[1:sha512Version/sha512perEC][1:miscFlags] |
| 415 | - my $userflags1 = ($verCheck << 24) |
| 416 | - | ($miscFlags << 16); |
| 417 | + # eyecatcher |
| 418 | + my $eyeCatch = $sectionHash{$key}{eyeCatch}; |
| 419 | + my $myside = $sectionHash{$key}{side}; |
| 420 | |
| 421 | - do{ |
| 422 | - trace(2, "$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --user 0 --name $eyeCatch --value userflags0=$userflags0"); |
| 423 | - $rc = `$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --user 0 --name $eyeCatch --value $userflags0`; |
| 424 | - if($rc) |
| 425 | - { |
| 426 | - trace(0, "$this_func: Call to add userdata to $eyeCatch failed. rc=$rc. Aborting!"); |
| 427 | - last; |
| 428 | - } |
| 429 | - trace(2, "$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --user 1 --name $eyeCatch --value userflags1=$userflags1"); |
| 430 | - $rc = `$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --user 1 --name $eyeCatch --value $userflags1`; |
| 431 | - if($rc) |
| 432 | + #don't try to add the TOC, but need to update all other paritions |
| 433 | + #Add if side matches (or not set) -- so if it isn't equal to other side |
| 434 | + if(( $eyeCatch ne $g_TOCEyeCatch ) && ( $myside ne $other_side )) |
| 435 | { |
| 436 | - trace(0, "$this_func: Call to add userdata to $eyeCatch failed. rc=$rc. Aborting!"); |
| 437 | - last; |
| 438 | - } |
| 439 | - }while(0); |
| 440 | - |
| 441 | - return $rc; |
| 442 | -} |
| 443 | - |
| 444 | -################################################################################ |
| 445 | -# createPnorPartition - Create PNOR partitions based on input data. |
| 446 | -################################################################################ |
| 447 | -sub createPnorPartition |
| 448 | -{ |
| 449 | - my ($i_tocVersion, $i_pnorBinName, $i_pnorLayoutRef, $side, $offset) = @_; |
| 450 | - my $this_func = (caller(0))[3]; |
| 451 | - my $rc = 0; |
| 452 | - my $key; |
| 453 | - my $other_side = getOtherSide($side); |
| 454 | |
| 455 | - trace(4, "$this_func: >>Enter"); |
| 456 | - |
| 457 | - trace(1, "createPnorPartition:: $offset"); |
| 458 | - |
| 459 | - do{ |
| 460 | - # Create pnor image at partition offset |
| 461 | - $rc = createPnorImg($i_tocVersion, $i_pnorBinName, $i_pnorLayoutRef, |
| 462 | - $offset); |
| 463 | - if($rc) |
| 464 | - { |
| 465 | - last; |
| 466 | - } |
| 467 | + # base/physical offset |
| 468 | + my $physicalOffset = $sectionHash{$key}{physicalOffset}; |
| 469 | + #make sure offset is on a block boundary |
| 470 | + my $val = $physicalOffset/$blockSize; |
| 471 | + if ($val != int($val)) |
| 472 | + { |
| 473 | + trace(0, "$this_func: Partition offset ($val) is does not fall on an erase block ($blockSize) boundary. This is not supported. Aborting!"); |
| 474 | + $rc = -1; |
| 475 | + last; |
| 476 | + } |
| 477 | |
| 478 | - #get Block size |
| 479 | - my $blockSize = $$i_pnorLayoutRef{metadata}{blockSize}; |
| 480 | + #physical size |
| 481 | + my $physicalRegionSize = $sectionHash{$key}{physicalRegionSize}; |
| 482 | + $val = $physicalRegionSize/$blockSize; |
| 483 | + if($val != int($val)) |
| 484 | + { |
| 485 | + trace(0, "$this_func: Partition size ($val) is not an even multiple of erase blocks ($blockSize). This is not supported. Aborting!"); |
| 486 | + exit 1; |
| 487 | + } |
| 488 | |
| 489 | - # key into hash data is the physical offset of section. Need to sort the |
| 490 | - # keys so we put things in the correct order in toc. Generally speaking, |
| 491 | - # this loop is populating the FFS Header with records based on the section |
| 492 | - # data specified in the XML + actual sizes of the input binary files. |
| 493 | - my %sectionHash = %{$$i_pnorLayoutRef{sections}}; |
| 494 | + #Add Partition |
| 495 | + #f{fs,part} --add --target tuleta.pnor --partition-offset 0 --offset 0x1000 --size 0x280000 --name HBI --flags 0x0 |
| 496 | + if ($g_ffsCmd eq "") { |
| 497 | + trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0"); |
| 498 | + my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0`; |
| 499 | + } else { |
| 500 | + my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $offset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0`; |
| 501 | + } |
| 502 | + $rc = $?; |
| 503 | + if($rc) |
| 504 | + { |
| 505 | + trace(0, "$this_func: Call to add partition $eyeCatch failed. rc=$rc. Aborting!"); |
| 506 | + last; |
| 507 | + } |
| 508 | |
| 509 | - for $key ( sort {$a<=> $b} keys %sectionHash) |
| 510 | - { |
| 511 | - my $eyeCatch = "UNDEF"; |
| 512 | - my $physicalOffset = 0xFFFFFFFF; |
| 513 | - my $physicalRegionSize = 0xFFFFFFFF; |
| 514 | + # User data Flags |
| 515 | + my $chip = 0; |
| 516 | + my $compress = 0; |
| 517 | + my $ecc = 0; |
| 518 | + my $version = 0; |
| 519 | |
| 520 | - # eyecatcher |
| 521 | - my $eyeCatch = $sectionHash{$key}{eyeCatch}; |
| 522 | + if( ($sectionHash{$key}{ecc} eq "yes") ) |
| 523 | + { |
| 524 | + $ecc = 0x8000; |
| 525 | + } |
| 526 | + if( ($sectionHash{$key}{sha512Version} eq "yes") ) |
| 527 | + { |
| 528 | + $version = 0x80; |
| 529 | + } |
| 530 | + elsif( ($sectionHash{$key}{sha512perEC} eq "yes") ) |
| 531 | + { |
| 532 | + $version = 0x40; |
| 533 | + } |
| 534 | |
| 535 | - my $sideInfo = getSideInfo($key, %sectionHash); |
| 536 | + #First User Data Word |
| 537 | + #[1:chip][1:compression][2:ecc] |
| 538 | + my $userflags0 = ($chip << 24) |
| 539 | + | ($compress << 16) |
| 540 | + | $ecc; |
| 541 | + |
| 542 | + #Second User Data Word |
| 543 | + #[1:sha512Version/sha512perEC] |
| 544 | + my $userflags1 = ($version << 24); |
| 545 | + |
| 546 | + trace(1,"userflags0 = $userflags0"); |
| 547 | + trace(1,"userflags1 = $userflags1"); |
| 548 | + if ($g_ffsCmd eq "") { |
| 549 | + trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --user 0 --name $eyeCatch --value $userflags0"); |
| 550 | + my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --user 0 --name $eyeCatch --value $userflags0`; |
| 551 | + trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --user 1 --name $eyeCatch --value $userflags1"); |
| 552 | + my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --user 1 --name $eyeCatch --value $userflags1`; |
| 553 | + } |
| 554 | + $rc = $?; |
| 555 | + if($rc) |
| 556 | + { |
| 557 | + trace(0, "$this_func: Call to add userdata to $eyeCatch failed. rc=$rc. Aborting!"); |
| 558 | + last; |
| 559 | + } |
| 560 | |
| 561 | - #don't try to add the TOC, but need to update all other paritions |
| 562 | - #Add if side matches (or not set) -- so if it isn't equal to other side |
| 563 | - #Also add if sideless |
| 564 | - if( ($eyeCatch ne $g_TOCEyeCatch ) && |
| 565 | - ($sideInfo ne $other_side )) |
| 566 | + #Trunc Partition |
| 567 | + #f{fs,part} --target tuleta.pnor --partition-offset 0 --name HBI --trunc |
| 568 | + if ($g_ffsCmd eq "") { |
| 569 | + my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --trunc --name $eyeCatch`; |
| 570 | + } else { |
| 571 | + my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $offset --trunc --name $eyeCatch`; |
| 572 | + } |
| 573 | + $rc = $?; |
| 574 | + if($rc) |
| 575 | { |
| 576 | - # base/physical offset |
| 577 | - my $physicalOffset = $sectionHash{$key}{physicalOffset}; |
| 578 | - #make sure offset is on a block boundary |
| 579 | - my $val = $physicalOffset/$blockSize; |
| 580 | - if ($val != int($val)) |
| 581 | - { |
| 582 | - trace(0, "$this_func: Partition offset ($val) does not fall on an erase block ($blockSize) boundary. This is not supported. Aborting!"); |
| 583 | - $rc = -1; |
| 584 | - last; |
| 585 | - } |
| 586 | - |
| 587 | - #physical size |
| 588 | - my $physicalRegionSize = $sectionHash{$key}{physicalRegionSize}; |
| 589 | - $val = $physicalRegionSize/$blockSize; |
| 590 | - if($val != int($val)) |
| 591 | - { |
| 592 | - trace(0, "$this_func: Partition size ($val) is not an even multiple of erase blocks ($blockSize). This is not supported. Aborting!"); |
| 593 | - exit 1; |
| 594 | - } |
| 595 | - |
| 596 | - #Add Partition |
| 597 | - #f{fs,part} --add --target tuleta.pnor --partition-offset 0 --offset 0x1000 --size 0x280000 --name HBI --flags 0x0 |
| 598 | - trace(2, "$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0"); |
| 599 | - $rc = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0`; |
| 600 | - if($rc) |
| 601 | - { |
| 602 | - trace(0, "$this_func: Call to add partition $eyeCatch failed. rc=$rc. Aborting!"); |
| 603 | - last; |
| 604 | - } |
| 605 | - |
| 606 | - # Add User Partition data |
| 607 | - $rc = addUserData($i_pnorBinName, $offset, $key, %sectionHash); |
| 608 | - if($rc) |
| 609 | - { |
| 610 | - trace(0, "$this_func: Call to add user data to partition $eyeCatch failed. rc=$rc. Aborting!"); |
| 611 | - last; |
| 612 | - } |
| 613 | - |
| 614 | - #Trunc Partition |
| 615 | - #f{fs,part} --target tuleta.pnor --partition-offset 0 --name HBI --trunc |
| 616 | - $rc = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --trunc --name $eyeCatch`; |
| 617 | - if($rc) |
| 618 | - { |
| 619 | - trace(0, "$this_func: Call to trunc partition $eyeCatch failed. rc=$rc. Aborting!"); |
| 620 | - last; |
| 621 | - } |
| 622 | + trace(0, "$this_func: Call to trunc partition $eyeCatch failed. rc=$rc. Aborting!"); |
| 623 | + last; |
| 624 | } |
| 625 | } |
| 626 | - # Added in case more functionality added before while ends |
| 627 | - if ($rc) |
| 628 | - { |
| 629 | - last; |
| 630 | - } |
| 631 | - }while(0); |
| 632 | + |
| 633 | + #Disable usewords for now. Will get re-enabled and fixed up as |
| 634 | + #we add support for underlying functions |
| 635 | + |
| 636 | +# my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset |
| 637 | +# --user 0 --name $eyeCatch --value $actualRegionSize`; |
| 638 | +# $rc = $?; |
| 639 | +# if($rc) |
| 640 | +# { |
| 641 | +# trace(0, "$this_func: Call to fpart setting user 0 for partition $eyeCatch failed. rc=$rc. Aborting!"); |
| 642 | +# last; |
| 643 | +# } |
| 644 | + |
| 645 | + } |
| 646 | |
| 647 | return $rc; |
| 648 | } |
| 649 | @@ -649,13 +570,21 @@ sub checkSpaceConstraints |
| 650 | ################################################################################ |
| 651 | sub fillPnorImage |
| 652 | { |
| 653 | - my ($i_pnorBinName, $i_pnorLayoutRef, $i_binFiles, $side, $offset) = @_; |
| 654 | + my ($i_pnorBinName, $i_pnorLayoutRef, $i_binFiles, $offset, $side) = @_; |
| 655 | my $this_func = (caller(0))[3]; |
| 656 | my $rc = 0; |
| 657 | my $key; |
| 658 | - my $other_side = getOtherSide($side); |
| 659 | + my $other_side = 'B'; |
| 660 | + |
| 661 | + |
| 662 | + if($side eq 'B') |
| 663 | + { |
| 664 | + $other_side = 'A'; |
| 665 | + } |
| 666 | + |
| 667 | |
| 668 | trace(1, "fillPnorImage:: $offset"); |
| 669 | + |
| 670 | #key is the physical offset into the file, however don't need to sort |
| 671 | #since FFS allows populating partitions in any order |
| 672 | my %sectionHash = %{$$i_pnorLayoutRef{sections}}; |
| 673 | @@ -676,26 +605,27 @@ sub fillPnorImage |
| 674 | next; |
| 675 | } |
| 676 | |
| 677 | - my $sideInfo = getSideInfo($key, %sectionHash); |
| 678 | + my $myside = $sectionHash{$key}{side}; |
| 679 | |
| 680 | - # Add if side matches (or not set) -- so if it isn't equal to other side |
| 681 | - # Only fill sideless sections once |
| 682 | - if( ($sideInfo ne $other_side) && |
| 683 | - (!exists($sidelessSecFilled{$eyeCatch}))) |
| 684 | + #Add if side matches (or not set) -- so if it isn't equal to other side |
| 685 | + if( $myside ne $other_side ) |
| 686 | { |
| 687 | - if($sideInfo eq $SideOptions{sideless}) |
| 688 | - { |
| 689 | - $sidelessSecFilled{$eyeCatch} = 1; |
| 690 | - } |
| 691 | - trace(5, "$this_func: populating section $sideInfo:$eyeCatch, filename=$inputFile"); |
| 692 | + trace(5, "$this_func: populating section $myside:$eyeCatch, filename=$inputFile"); |
| 693 | + |
| 694 | #fcp --target tuleta.pnor --partition-offset 0 --name HBI --write hostboot_extended.bin |
| 695 | - $rc = `$g_fcpCmd $inputFile $i_pnorBinName:$eyeCatch --offset $offset --write --buffer 0x40000000`; |
| 696 | + if ($g_ffsCmd eq "") { |
| 697 | + my $Out = `$g_fcpCmd $inputFile $i_pnorBinName:$eyeCatch --offset $offset --write --buffer 0x40000000`; |
| 698 | + } else { |
| 699 | + my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $offset --name $eyeCatch --write $inputFile`; |
| 700 | + } |
| 701 | + $rc = $?; |
| 702 | if($rc) |
| 703 | { |
| 704 | trace(0, "$this_func: Call to fcp adding data to partition $eyeCatch failed. rc=$rc. Aborting!"); |
| 705 | last; |
| 706 | } |
| 707 | } |
| 708 | + |
| 709 | } |
| 710 | |
| 711 | return $rc; |
| 712 | @@ -723,6 +653,28 @@ sub saveInputFile |
| 713 | } |
| 714 | |
| 715 | ################################################# |
| 716 | +# getFFSEntrySize: Returns number of bytes in an ffs_entry based on specified version |
| 717 | +################################################# |
| 718 | +sub getFFSEntrySize |
| 719 | +{ |
| 720 | + my($i_tocVersion, $i_pnorLayoutRef) = @_; |
| 721 | + my $this_func = (caller(0))[3]; |
| 722 | + my $ffsEntrySize = 0; |
| 723 | + |
| 724 | + if($i_tocVersion == 0x1) |
| 725 | + { |
| 726 | + #16 char name + 12 fixed words + 16 user data words |
| 727 | + $ffsEntrySize = 16+(12*4)+(16*4); |
| 728 | + } |
| 729 | + else |
| 730 | + { |
| 731 | + trace(0, "$this_func: Layout Version Unsupported! i_tocVersion=$i_tocVersion"); |
| 732 | + exit 1; |
| 733 | + } |
| 734 | + return $ffsEntrySize; |
| 735 | +} |
| 736 | + |
| 737 | +################################################# |
| 738 | # Insert specifed number of pad bytes into file |
| 739 | # |
| 740 | ################################################# |
| 741 | @@ -780,70 +732,6 @@ sub trace |
| 742 | } |
| 743 | } |
| 744 | |
| 745 | -################################################################################ |
| 746 | -# getSideInfo - return side info of certain sections and determine if value is |
| 747 | -# a supported value |
| 748 | -################################################################################ |
| 749 | -sub getSideInfo |
| 750 | -{ |
| 751 | - my $i_key = shift; |
| 752 | - my %i_sectionHash = @_; |
| 753 | - |
| 754 | - my $side = ""; |
| 755 | - my $eyeCatch = $i_sectionHash{$i_key}{eyeCatch}; |
| 756 | - |
| 757 | - |
| 758 | - if($i_sectionHash{$i_key}{sideless} eq "yes") |
| 759 | - { |
| 760 | - return $SideOptions{sideless}; |
| 761 | - } |
| 762 | - else |
| 763 | - { |
| 764 | - $side = $i_sectionHash{$i_key}{side}; |
| 765 | - } |
| 766 | - |
| 767 | - # Error paths |
| 768 | - if ($side eq "") |
| 769 | - { |
| 770 | - trace(0, "Error detected from call to getSideInfo() - $eyeCatch has no side info specified Exiting"); |
| 771 | - exit 1; |
| 772 | - } |
| 773 | - elsif (!exists($SideOptions{$side})) |
| 774 | - { |
| 775 | - trace(0, "Error detected from call to getSideInfo() - $eyeCatch has sideInfo = $side which is not supported Exiting"); |
| 776 | - exit 1; |
| 777 | - } |
| 778 | - |
| 779 | - return $side; |
| 780 | -} |
| 781 | - |
| 782 | -################################################################################ |
| 783 | -# getOtherSide - return other side of the given side |
| 784 | -# does not default to main side in case more sides are added |
| 785 | -################################################################################ |
| 786 | -sub getOtherSide |
| 787 | -{ |
| 788 | - my $i_side = shift; |
| 789 | - my $other_side = ""; |
| 790 | - |
| 791 | - if($i_side eq $SideOptions{A}) |
| 792 | - { |
| 793 | - $other_side = $SideOptions{B}; |
| 794 | - } |
| 795 | - elsif($i_side eq $SideOptions{B}) |
| 796 | - { |
| 797 | - $other_side = $SideOptions{A}; |
| 798 | - } |
| 799 | - |
| 800 | - # Error paths |
| 801 | - if ($other_side eq "") |
| 802 | - { |
| 803 | - trace(0, "Error detected from call to getOtherSide() - Could not get other side of side = $i_side Exiting"); |
| 804 | - exit 1; |
| 805 | - } |
| 806 | - |
| 807 | - return $other_side; |
| 808 | -} |
| 809 | |
| 810 | |
| 811 | ################################################################################ |
| 812 | diff --git a/src/build/buildpnor/defaultPnorLayout.xml b/src/build/buildpnor/defaultPnorLayout.xml |
| 813 | index 249bdb4..e34f0fe 100644 |
| 814 | --- a/src/build/buildpnor/defaultPnorLayout.xml |
| 815 | +++ b/src/build/buildpnor/defaultPnorLayout.xml |
| 816 | @@ -5,9 +5,7 @@ |
| 817 | <!-- --> |
| 818 | <!-- OpenPOWER HostBoot Project --> |
| 819 | <!-- --> |
| 820 | -<!-- Contributors Listed Below - COPYRIGHT 2012,2015 --> |
| 821 | -<!-- [+] International Business Machines Corp. --> |
| 822 | -<!-- --> |
| 823 | +<!-- COPYRIGHT International Business Machines Corp. 2012,2014 --> |
| 824 | <!-- --> |
| 825 | <!-- Licensed under the Apache License, Version 2.0 (the "License"); --> |
| 826 | <!-- you may not use this file except in compliance with the License. --> |
| 827 | @@ -24,50 +22,48 @@ |
| 828 | <!-- IBM_PROLOG_END_TAG --> |
| 829 | <!-- |
| 830 | Layout Description |
| 831 | -<metadata> Element -> Contains high-level information about the PNOR layout. |
| 832 | - <imageSize> -> Size of PNOR image in bytes. |
| 833 | - <blockSize> -> size of erase blocks in bytes. |
| 834 | - <sideATocOffset> -> Location of Side A Partition Table |
| 835 | - <sideATocBackupOffset>-> Location of Side A Backup Partition Table |
| 836 | - <sideBTocOffset> -> Location of Side B Partition Table |
| 837 | - <sideBTocBackupOffset>-> Location of Side B Backup Partition Table |
| 838 | -</metadata> |
| 839 | -<section> Element -> Contains information about a PNOR Partition |
| 840 | - <description> -> Text description of the partition. |
| 841 | - Does not have to be machine readable. |
| 842 | - <eyeCatch> -> Name of the Partition |
| 843 | - <physicalOffset>-> Offset of the Partition in PNOR |
| 844 | - in bytes. |
| 845 | - <physicalSize> -> Size of the Partition in bytes. |
| 846 | - <side> -> Side the Partition should be associated with. This |
| 847 | - determines if the partition should be added to the |
| 848 | - partition table at <sideATocOffset> or <sideBTocOffset> |
| 849 | - <sideless/> -> Indicates partition will be in both TOCs but only one |
| 850 | - copy of the partition should be created |
| 851 | - <testonly/> -> Indicates partition is used for internal testing only. |
| 852 | - Partition should be skipped in production environments. |
| 853 | - <ecc/> -> Indicates Partition should be ECC protected |
| 854 | - <sha512Version/>-> Indicates Partition uses SHA512 for version information. |
| 855 | - <sha512perEC/> -> Indicates SHA512 is used to indicate version for each |
| 856 | - EC-specific image within the Partition. |
| 857 | - <preserved/> -> Indicates Partition is preserved across code updates. |
| 858 | -</section> |
| 859 | +<metadata> Element -> Contains high-level information about |
| 860 | + the PNOR layout. |
| 861 | + <imageSize> -> Size of PNOR image in bytes. |
| 862 | + <blockSize> -> size of erase blocks in bytes. |
| 863 | + <sideAOffset> -> Location of Side A Partition Table |
| 864 | + <sideBOffset> -> Location of Side B Partition Table |
| 865 | +<section> -> Contains information about a PNOR Partition |
| 866 | + <description> -> Text description of the partition. |
| 867 | + Does not have to be machine readable. |
| 868 | + <eyeCatch> -> Name of the Partition |
| 869 | + <physicalOffset> -> Offset of the Partition in PNOR |
| 870 | + in bytes. |
| 871 | + <physicalSize> -> Size of the Partition in bytes. |
| 872 | + <side> -> Side the partition should be associated with. |
| 873 | + This determines if the partition should be |
| 874 | + added to the partition table at <sideAOffset> |
| 875 | + or <sideBOffset> |
| 876 | + <testonly/> Indicates partition is used for internal |
| 877 | + testing only. Partition should be skipped |
| 878 | + in production environments. |
| 879 | + <ecc/> Indicates Partition should be ECC protected |
| 880 | + <sha512Version/> Indicates Partition uses SHA512 for |
| 881 | + version information. |
| 882 | + <sha512perEC/> Indicates SHA512 is used to indicate |
| 883 | + version for each EC-specific image |
| 884 | + within the Partition. |
| 885 | + <preserved/> Indicates Partition is preserved |
| 886 | + across code updates. |
| 887 | --> |
| 888 | |
| 889 | <pnor> |
| 890 | <metadata> |
| 891 | <imageSize>0x4000000</imageSize> |
| 892 | <blockSize>0x1000</blockSize> |
| 893 | - <!-- @TODO RTC: 120062 - Enhance meta info --> |
| 894 | - <sideATocOffset>0x0</sideATocOffset> |
| 895 | - <sideATocBackupOffset>0x8000</sideATocBackupOffset> |
| 896 | + <sideAOffset>0x0</sideAOffset> |
| 897 | + <sideBOffset>0x8000</sideBOffset> |
| 898 | </metadata> |
| 899 | <section> |
| 900 | <description>Hostboot Error Logs (144K)</description> |
| 901 | <eyeCatch>HBEL</eyeCatch> |
| 902 | <physicalOffset>0x10000</physicalOffset> |
| 903 | <physicalRegionSize>0x24000</physicalRegionSize> |
| 904 | - <sideless/> |
| 905 | <ecc/> |
| 906 | </section> |
| 907 | <section> |
| 908 | @@ -75,7 +71,6 @@ Layout Description |
| 909 | <eyeCatch>GUARD</eyeCatch> |
| 910 | <physicalOffset>0x58000</physicalOffset> |
| 911 | <physicalRegionSize>0x5000</physicalRegionSize> |
| 912 | - <sideless/> |
| 913 | <ecc/> |
| 914 | </section> |
| 915 | <section> |
| 916 | @@ -83,7 +78,6 @@ Layout Description |
| 917 | <eyeCatch>HBD</eyeCatch> |
| 918 | <physicalOffset>0x5D000</physicalOffset> |
| 919 | <physicalRegionSize>0x120000</physicalRegionSize> |
| 920 | - <sideless/> |
| 921 | <ecc/> |
| 922 | </section> |
| 923 | <section> |
| 924 | @@ -92,7 +86,6 @@ Layout Description |
| 925 | <!--NOTE: MUST update standalone.simics if offset changes --> |
| 926 | <physicalOffset>0x17D000</physicalOffset> |
| 927 | <physicalRegionSize>0x48000</physicalRegionSize> |
| 928 | - <sideless/> |
| 929 | <ecc/> |
| 930 | </section> |
| 931 | <section> |
| 932 | @@ -101,7 +94,6 @@ Layout Description |
| 933 | <!--NOTE: MUST update standalone.simics if offset changes --> |
| 934 | <physicalOffset>0x1C5000</physicalOffset> |
| 935 | <physicalRegionSize>0x90000</physicalRegionSize> |
| 936 | - <sideless/> |
| 937 | <ecc/> |
| 938 | </section> |
| 939 | <section> |
| 940 | @@ -110,7 +102,6 @@ Layout Description |
| 941 | <!--NOTE: MUST update standalone.simics if offset changes --> |
| 942 | <physicalOffset>0x255000</physicalOffset> |
| 943 | <physicalRegionSize>0x48000</physicalRegionSize> |
| 944 | - <sideless/> |
| 945 | <ecc/> |
| 946 | </section> |
| 947 | <section> |
| 948 | @@ -119,7 +110,6 @@ Layout Description |
| 949 | <physicalOffset>0x29D000</physicalOffset> |
| 950 | <physicalRegionSize>0x5A0000</physicalRegionSize> |
| 951 | <sha512Version/> |
| 952 | - <sideless/> |
| 953 | <ecc/> |
| 954 | </section> |
| 955 | <section> |
| 956 | @@ -128,7 +118,6 @@ Layout Description |
| 957 | <physicalOffset>0x83D000</physicalOffset> |
| 958 | <physicalRegionSize>0x90000</physicalRegionSize> |
| 959 | <sha512perEC/> |
| 960 | - <sideless/> |
| 961 | <ecc/> |
| 962 | </section> |
| 963 | <section> |
| 964 | @@ -137,7 +126,6 @@ Layout Description |
| 965 | <physicalOffset>0x8CD000</physicalOffset> |
| 966 | <physicalRegionSize>0x48000</physicalRegionSize> |
| 967 | <sha512perEC/> |
| 968 | - <sideless/> |
| 969 | <ecc/> |
| 970 | </section> |
| 971 | <section> |
| 972 | @@ -146,7 +134,6 @@ Layout Description |
| 973 | <physicalOffset>0x915000</physicalOffset> |
| 974 | <physicalRegionSize>0x120000</physicalRegionSize> |
| 975 | <sha512Version/> |
| 976 | - <sideless/> |
| 977 | <ecc/> |
| 978 | </section> |
| 979 | <section> |
| 980 | @@ -155,7 +142,6 @@ Layout Description |
| 981 | <physicalOffset>0xA35000</physicalOffset> |
| 982 | <physicalRegionSize>0x240000</physicalRegionSize> |
| 983 | <sha512Version/> |
| 984 | - <sideless/> |
| 985 | <ecc/> |
| 986 | </section> |
| 987 | <section> |
| 988 | @@ -163,7 +149,6 @@ Layout Description |
| 989 | <eyeCatch>PAYLOAD</eyeCatch> |
| 990 | <physicalOffset>0xC75000</physicalOffset> |
| 991 | <physicalRegionSize>0x1680000</physicalRegionSize> |
| 992 | - <sideless/> |
| 993 | <ecc/> |
| 994 | </section> |
| 995 | <section> |
| 996 | @@ -172,18 +157,6 @@ Layout Description |
| 997 | <physicalOffset>0x3590000</physicalOffset> |
| 998 | <physicalRegionSize>0x9000</physicalRegionSize> |
| 999 | <testonly/> |
| 1000 | - <sideless/> |
| 1001 | - <ecc/> |
| 1002 | - </section> |
| 1003 | - <section> |
| 1004 | - <description>Special PNOR Test Space (36K)</description> |
| 1005 | - <eyeCatch>TESTRO</eyeCatch> |
| 1006 | - <physicalOffset>0x3599000</physicalOffset> |
| 1007 | - <physicalRegionSize>0x9000</physicalRegionSize> |
| 1008 | - <testonly/> |
| 1009 | - <sideless/> |
| 1010 | - <preserved/> |
| 1011 | - <readOnly/> |
| 1012 | <ecc/> |
| 1013 | </section> |
| 1014 | <section> |
| 1015 | @@ -193,7 +166,6 @@ Layout Description |
| 1016 | <physicalOffset>0x3F67000</physicalOffset> |
| 1017 | <physicalRegionSize>0x90000</physicalRegionSize> |
| 1018 | <sha512Version/> |
| 1019 | - <sideless/> |
| 1020 | <ecc/> |
| 1021 | </section> |
| 1022 | <section> |
| 1023 | @@ -201,7 +173,6 @@ Layout Description |
| 1024 | <eyeCatch>GLOBAL</eyeCatch> |
| 1025 | <physicalOffset>0x3FF7000</physicalOffset> |
| 1026 | <physicalRegionSize>0x9000</physicalRegionSize> |
| 1027 | - <sideless/> |
| 1028 | <ecc/> |
| 1029 | </section> |
| 1030 | </pnor> |
| 1031 | diff --git a/src/build/mkrules/hbfw/img/makefile b/src/build/mkrules/hbfw/img/makefile |
| 1032 | index 925061e..c0b0900 100755 |
| 1033 | --- a/src/build/mkrules/hbfw/img/makefile |
| 1034 | +++ b/src/build/mkrules/hbfw/img/makefile |
| 1035 | @@ -5,7 +5,7 @@ |
| 1036 | # |
| 1037 | # OpenPOWER HostBoot Project |
| 1038 | # |
| 1039 | -# Contributors Listed Below - COPYRIGHT 2012,2015 |
| 1040 | +# Contributors Listed Below - COPYRIGHT 2012,2014 |
| 1041 | # [+] International Business Machines Corp. |
| 1042 | # |
| 1043 | # |
| 1044 | @@ -226,7 +226,7 @@ PNOR_BUILD_SCRIPT = ${buildpnor.pl:P} |
| 1045 | #so need to use tryinclude for now. |
| 1046 | .tryinclude <${.PATH:Ffips_pnor.mk}> |
| 1047 | |
| 1048 | -HOSTBOOT_DEFAULT_SECTIONS = HBB=${BASE_W_HEADER_ECC_IMAGE},HBI=${EXT_ECC_HEADER_IMAGE},HBRT=${HBRT_ECC_HEADER_IMAGE},TEST=${TESTDATA_ECC},TESTRO=${TESTDATA_ECC},HBEL=${HBEL_ECC_IMAGE},GUARD=${GUARD_ECC_IMAGE},GLOBAL=${GLOBAL_ECC_IMAGE},PAYLOAD=${PAYLOAD_ECC_IMAGE},CVPD=${CVPD_ECC_IMAGE},MVPD=${MVPD_ECC_IMAGE},DJVPD=${DJVPD_ECC_IMAGE} |
| 1049 | +HOSTBOOT_DEFAULT_SECTIONS = HBB=${BASE_W_HEADER_ECC_IMAGE},HBI=${EXT_ECC_HEADER_IMAGE},HBRT=${HBRT_ECC_HEADER_IMAGE},TEST=${TESTDATA_ECC},HBEL=${HBEL_ECC_IMAGE},GUARD=${GUARD_ECC_IMAGE},GLOBAL=${GLOBAL_ECC_IMAGE},PAYLOAD=${PAYLOAD_ECC_IMAGE},CVPD=${CVPD_ECC_IMAGE},MVPD=${MVPD_ECC_IMAGE},DJVPD=${DJVPD_ECC_IMAGE} |
| 1050 | |
| 1051 | |
| 1052 | HBFW_OBJPATH = ${.PATH:M*obj*} |
| 1053 | diff --git a/src/include/usr/hwas/hwasPlatDeconfigGard.H b/src/include/usr/hwas/hwasPlatDeconfigGard.H |
| 1054 | index c439a42..4b89353 100644 |
| 1055 | --- a/src/include/usr/hwas/hwasPlatDeconfigGard.H |
| 1056 | +++ b/src/include/usr/hwas/hwasPlatDeconfigGard.H |
| 1057 | @@ -5,9 +5,7 @@ |
| 1058 | /* */ |
| 1059 | /* OpenPOWER HostBoot Project */ |
| 1060 | /* */ |
| 1061 | -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ |
| 1062 | -/* [+] International Business Machines Corp. */ |
| 1063 | -/* */ |
| 1064 | +/* COPYRIGHT International Business Machines Corp. 2012,2014 */ |
| 1065 | /* */ |
| 1066 | /* Licensed under the Apache License, Version 2.0 (the "License"); */ |
| 1067 | /* you may not use this file except in compliance with the License. */ |
| 1068 | @@ -32,8 +30,6 @@ |
| 1069 | #ifndef HWASPLATDECONFIGGARD_H_ |
| 1070 | #define HWASPLATDECONFIGGARD_H_ |
| 1071 | |
| 1072 | -#include <pnor/pnorif.H> |
| 1073 | - |
| 1074 | /** |
| 1075 | * @brief Adapt common singleton declaration to specific platform |
| 1076 | * |
| 1077 | @@ -68,19 +64,6 @@ struct HBDeconfigGard |
| 1078 | void *iv_pGardRecords; // Pointer to the GARD Records in PNOR |
| 1079 | }; |
| 1080 | |
| 1081 | -/** |
| 1082 | - * @brief Gets iv_gardSectionInfo and sets it if first time called. |
| 1083 | - * Sets o_sectionInfo based on iv_gardSectionInfo for the caller |
| 1084 | - * |
| 1085 | - * @param[out] Guard PNOR section info |
| 1086 | - * |
| 1087 | - * @return errlHndl_t Error log handle, depending on config options will |
| 1088 | - * ignore error because no Guard section exists in PNOR |
| 1089 | - * (e.g. CONFIG_GOLDEN_PNOR_SIDE_SUPPORT) |
| 1090 | - * |
| 1091 | - */ |
| 1092 | -errlHndl_t getGardSectionInfo(PNOR::SectionInfo_t& o_sectionInfo); |
| 1093 | - |
| 1094 | } // namespace HWAS |
| 1095 | |
| 1096 | #endif // HWASPLATDECONFIGGARD_H_ |
| 1097 | diff --git a/src/include/usr/pnor/pnor_reasoncodes.H b/src/include/usr/pnor/pnor_reasoncodes.H |
| 1098 | index 4857c1b..a9854a4 100644 |
| 1099 | --- a/src/include/usr/pnor/pnor_reasoncodes.H |
| 1100 | +++ b/src/include/usr/pnor/pnor_reasoncodes.H |
| 1101 | @@ -136,8 +136,6 @@ namespace PNOR |
| 1102 | RC_PNOR_READ_NOT_SUPPORTED = PNOR_COMP_ID | 0x1F, |
| 1103 | RC_PNOR_WRITE_NOT_SUPPORTED = PNOR_COMP_ID | 0x20, |
| 1104 | RC_NON_ECC_PROTECTED_SECTION = PNOR_COMP_ID | 0x21, |
| 1105 | - RC_WRITABLE_PERM_FAIL = PNOR_COMP_ID | 0x22, |
| 1106 | - RC_WRITE_TRACKED_PERM_FAIL = PNOR_COMP_ID | 0x23, |
| 1107 | }; |
| 1108 | |
| 1109 | enum UserDetailsTypes |
| 1110 | diff --git a/src/include/usr/pnor/pnorif.H b/src/include/usr/pnor/pnorif.H |
| 1111 | index 2689077..a9856f8 100644 |
| 1112 | --- a/src/include/usr/pnor/pnorif.H |
| 1113 | +++ b/src/include/usr/pnor/pnorif.H |
| 1114 | @@ -29,7 +29,6 @@ |
| 1115 | #include <stdint.h> |
| 1116 | #include <builtins.h> |
| 1117 | #include <errl/errlentry.H> |
| 1118 | -#include <utility> |
| 1119 | |
| 1120 | namespace PNOR |
| 1121 | { |
| 1122 | @@ -62,7 +61,6 @@ enum SectionId |
| 1123 | ATTR_PERM, /**< Permanent Attribute Override */ |
| 1124 | CAPP, /**< CAPP lid */ |
| 1125 | TEST, /**< Scratch space for PNOR test cases */ |
| 1126 | - TESTRO, /**< Scratch space for PNOR ReadOnly test cases */ |
| 1127 | |
| 1128 | NUM_SECTIONS, /**< Number of defined sections */ |
| 1129 | |
| 1130 | @@ -84,8 +82,7 @@ struct SectionInfo_t |
| 1131 | uint64_t size; /**< Size of partition in bytes */ |
| 1132 | bool eccProtected; /**< Section is ECC protected */ |
| 1133 | bool sha512Version; /**< Version Checking */ |
| 1134 | - bool sha512perEC; /**< Version Checking perEC */ |
| 1135 | - bool readOnly; /**< Section is read only */ |
| 1136 | + bool sha512perEC; /**< Version Checking perEC */ |
| 1137 | }; |
| 1138 | |
| 1139 | /** |
| 1140 | @@ -124,7 +121,6 @@ errlHndl_t fixECC (SectionId i_section); |
| 1141 | * true = PNOR DD is using L3 Cache for fake PNOR |
| 1142 | * false = PNOR DD not using L3 Cache for fake PNOR |
| 1143 | */ |
| 1144 | - bool usingL3Cache(); |
| 1145 | |
| 1146 | /** |
| 1147 | * @brief Clears the specified PNOR section with all FF's (w/ good ECC) |
| 1148 | @@ -135,6 +131,8 @@ errlHndl_t fixECC (SectionId i_section); |
| 1149 | */ |
| 1150 | errlHndl_t clearSection(PNOR::SectionId i_section); |
| 1151 | |
| 1152 | +bool usingL3Cache(); |
| 1153 | + |
| 1154 | /** |
| 1155 | * @brief Validate the Alternative Master Processor's LPC |
| 1156 | * Connection to PNOR |
| 1157 | @@ -143,14 +141,6 @@ errlHndl_t clearSection(PNOR::SectionId i_section); |
| 1158 | */ |
| 1159 | errlHndl_t validateAltMaster( void ); |
| 1160 | |
| 1161 | -//@ TODO RTC: 120061 add golden info |
| 1162 | -//@ TODO RTC: 109703 make golden changes for informing OPAL |
| 1163 | -struct TocInfo_t |
| 1164 | -{ |
| 1165 | - std::pair<uint64_t, uint64_t> activeTocOffsets; |
| 1166 | - std::pair<uint64_t, uint64_t> altTocOffsets; |
| 1167 | -}; |
| 1168 | - |
| 1169 | /** @brief PNOR::TEST section offsets for test cases to prevent |
| 1170 | * concurrency problems |
| 1171 | */ |
| 1172 | @@ -160,29 +150,6 @@ enum TestSectionOffset{ |
| 1173 | pnorTestSec_rt_readwrite_offset = 0x6000, |
| 1174 | }; |
| 1175 | |
| 1176 | -//////////////////////////////////////////////////////////////////////////////// |
| 1177 | -// SBE functionality that lives in PNOR |
| 1178 | - |
| 1179 | -// Used to keep track of perm/temp, and cur/alt |
| 1180 | -enum sbeSeepromSide_t |
| 1181 | -{ |
| 1182 | - SBE_SEEPROM0 = 0x00, // corresponds to EEPROM::SBE_PRIMARY |
| 1183 | - SBE_SEEPROM1 = 0x01, // corresponts to EEPROM::SBE_BACKUP |
| 1184 | - SBE_SEEPROM_INVALID = 0xFF, |
| 1185 | -}; |
| 1186 | - |
| 1187 | -/** |
| 1188 | - * @brief Determines which Seeprom was used to boot the SBE |
| 1189 | - * |
| 1190 | - * @param[in] i_target Target processor to customize |
| 1191 | - * |
| 1192 | - * @param[out] o_bootSide The Seeprom the SBE booted from |
| 1193 | - * |
| 1194 | - * @return errlHndl_t Error log handle on failure. |
| 1195 | - */ |
| 1196 | -errlHndl_t getSbeBootSeeprom(TARGETING::Target* i_target, |
| 1197 | - sbeSeepromSide_t& o_bootSide); |
| 1198 | - |
| 1199 | } |
| 1200 | |
| 1201 | #endif |
| 1202 | diff --git a/src/usr/hwas/hwasPlatDeconfigGard.C b/src/usr/hwas/hwasPlatDeconfigGard.C |
| 1203 | index 2911cf3..912f7d4 100644 |
| 1204 | --- a/src/usr/hwas/hwasPlatDeconfigGard.C |
| 1205 | +++ b/src/usr/hwas/hwasPlatDeconfigGard.C |
| 1206 | @@ -5,7 +5,7 @@ |
| 1207 | /* */ |
| 1208 | /* OpenPOWER HostBoot Project */ |
| 1209 | /* */ |
| 1210 | -/* Contributors Listed Below - COPYRIGHT 2013,2015 */ |
| 1211 | +/* Contributors Listed Below - COPYRIGHT 2013,2014 */ |
| 1212 | /* [+] Google Inc. */ |
| 1213 | /* [+] International Business Machines Corp. */ |
| 1214 | /* */ |
| 1215 | @@ -52,15 +52,6 @@ using namespace HWAS::COMMON; |
| 1216 | using namespace TARGETING; |
| 1217 | |
| 1218 | const uint32_t EMPTY_GARD_RECORDID = 0xFFFFFFFF; |
| 1219 | -/** |
| 1220 | - * @brief Guard PNOR section info, obtained once for efficiency |
| 1221 | - */ |
| 1222 | -static PNOR::SectionInfo_t g_GardSectionInfo; |
| 1223 | - |
| 1224 | -/** |
| 1225 | - * @brief Flag indicating if getGardSectionInfo() was called previously |
| 1226 | - */ |
| 1227 | -static bool getGardSectionInfoCalled; |
| 1228 | |
| 1229 | void _flush(void *i_addr); |
| 1230 | errlHndl_t _GardRecordIdSetup(void *&io_platDeconfigGard); |
| 1231 | @@ -99,7 +90,7 @@ errlHndl_t DeconfigGard::platClearGardRecords( |
| 1232 | |
| 1233 | HWAS_MUTEX_LOCK(iv_mutex); |
| 1234 | l_pErr = _GardRecordIdSetup(iv_platDeconfigGard); |
| 1235 | - if (!l_pErr && iv_platDeconfigGard) |
| 1236 | + if (!l_pErr) |
| 1237 | { |
| 1238 | uint32_t l_gardRecordsCleared = 0; |
| 1239 | HBDeconfigGard *l_hbDeconfigGard = |
| 1240 | @@ -136,6 +127,10 @@ errlHndl_t DeconfigGard::platClearGardRecords( |
| 1241 | |
| 1242 | HWAS_INF("GARD Records Cleared: %d", l_gardRecordsCleared); |
| 1243 | } |
| 1244 | + else |
| 1245 | + { |
| 1246 | + HWAS_ERR("Error from _GardRecordIdSetup"); |
| 1247 | + } |
| 1248 | |
| 1249 | HWAS_MUTEX_UNLOCK(iv_mutex); |
| 1250 | #endif // CONFIG_NO_GARD_SUPPORT |
| 1251 | @@ -158,7 +153,7 @@ errlHndl_t DeconfigGard::platGetGardRecords( |
| 1252 | |
| 1253 | HWAS_MUTEX_LOCK(iv_mutex); |
| 1254 | l_pErr = _GardRecordIdSetup(iv_platDeconfigGard); |
| 1255 | - if (!l_pErr && iv_platDeconfigGard) |
| 1256 | + if (!l_pErr) |
| 1257 | { |
| 1258 | HBDeconfigGard *l_hbDeconfigGard = |
| 1259 | (HBDeconfigGard *)iv_platDeconfigGard; |
| 1260 | @@ -188,6 +183,10 @@ errlHndl_t DeconfigGard::platGetGardRecords( |
| 1261 | } |
| 1262 | } // for |
| 1263 | } |
| 1264 | + else |
| 1265 | + { |
| 1266 | + HWAS_ERR("Error from _GardRecordIdSetup"); |
| 1267 | + } |
| 1268 | |
| 1269 | HWAS_MUTEX_UNLOCK(iv_mutex); |
| 1270 | HWAS_INF("Get returning %d GARD Records", o_records.size()); |
| 1271 | @@ -270,8 +269,9 @@ errlHndl_t DeconfigGard::platCreateGardRecord( |
| 1272 | } |
| 1273 | |
| 1274 | l_pErr = _GardRecordIdSetup(iv_platDeconfigGard); |
| 1275 | - if (l_pErr && iv_platDeconfigGard) |
| 1276 | + if (l_pErr) |
| 1277 | { |
| 1278 | + HWAS_ERR("Error from _GardRecordIdSetup"); |
| 1279 | break; |
| 1280 | } |
| 1281 | |
| 1282 | @@ -394,27 +394,20 @@ errlHndl_t _GardRecordIdSetup( void *&io_platDeconfigGard) |
| 1283 | break; |
| 1284 | } |
| 1285 | |
| 1286 | - // Get the PNOR Guard information |
| 1287 | + // allocate our memory and set things up |
| 1288 | + io_platDeconfigGard = malloc(sizeof(HBDeconfigGard)); |
| 1289 | + HBDeconfigGard *l_hbDeconfigGard = |
| 1290 | + (HBDeconfigGard *)io_platDeconfigGard; |
| 1291 | + |
| 1292 | + // get the PNOR address. |
| 1293 | PNOR::SectionInfo_t l_section; |
| 1294 | - l_pErr = getGardSectionInfo(l_section); |
| 1295 | + l_pErr = PNOR::getSectionInfo(PNOR::GUARD_DATA, l_section); |
| 1296 | if (l_pErr) |
| 1297 | { |
| 1298 | - HWAS_ERR("_GardRecordIdSetup: getGardSectionInfo failed!!!"); |
| 1299 | + HWAS_ERR("PNOR::getSectionInfo failed!!!"); |
| 1300 | // no support for GARD in this configuration. |
| 1301 | break; |
| 1302 | } |
| 1303 | - // Check if guard section exists, as certain configs ignore the above |
| 1304 | - // error (e.g. golden side has no GARD section) |
| 1305 | - if (l_section.size == 0) |
| 1306 | - { |
| 1307 | - HWAS_ERR("_GardRecordIdSetup: No guard section skipping function"); |
| 1308 | - break; |
| 1309 | - } |
| 1310 | - |
| 1311 | - // allocate our memory and set things up |
| 1312 | - io_platDeconfigGard = malloc(sizeof(HBDeconfigGard)); |
| 1313 | - HBDeconfigGard *l_hbDeconfigGard = |
| 1314 | - (HBDeconfigGard *)io_platDeconfigGard; |
| 1315 | |
| 1316 | l_hbDeconfigGard->iv_pGardRecords = |
| 1317 | reinterpret_cast<DeconfigGard::GardRecord *> (l_section.vaddr); |
| 1318 | @@ -473,44 +466,4 @@ void _flush(void *i_addr) |
| 1319 | } |
| 1320 | } |
| 1321 | |
| 1322 | -errlHndl_t getGardSectionInfo(PNOR::SectionInfo_t& o_sectionInfo) |
| 1323 | -{ |
| 1324 | - errlHndl_t l_errl = NULL; |
| 1325 | - do |
| 1326 | - { |
| 1327 | - // getSectionInfo has already been called for GUARD_DATA |
| 1328 | - if(getGardSectionInfoCalled) |
| 1329 | - { |
| 1330 | - o_sectionInfo = g_GardSectionInfo; |
| 1331 | - break; |
| 1332 | - } |
| 1333 | - |
| 1334 | - // Get Guard Section Info and set gardSectionInfo |
| 1335 | - l_errl = PNOR::getSectionInfo(PNOR::GUARD_DATA, g_GardSectionInfo); |
| 1336 | - if (l_errl) |
| 1337 | - { |
| 1338 | - g_GardSectionInfo.size = 0; |
| 1339 | -// @TODO RTC: 120061 - replace config flag with a pnor interface call to say if |
| 1340 | -// there is a guard section on the current (active) side |
| 1341 | -// of pnor |
| 1342 | -#ifdef CONFIG_TWO_SIDE_SUPPORT |
| 1343 | - HWAS_INF("getGardSectionInfo: No guard section disabling guard support"); |
| 1344 | - l_errl = NULL; |
| 1345 | -#else |
| 1346 | - HWAS_ERR("getGardSectionInfo:getSectionInfo failed"); |
| 1347 | -#endif |
| 1348 | - } |
| 1349 | - else |
| 1350 | - { |
| 1351 | - HWAS_INF("getGardSectionInfo: Section %s found, size %d", |
| 1352 | - g_GardSectionInfo.name, g_GardSectionInfo.size); |
| 1353 | - } |
| 1354 | - |
| 1355 | - o_sectionInfo = g_GardSectionInfo; |
| 1356 | - getGardSectionInfoCalled = true; |
| 1357 | - } while(0); |
| 1358 | - |
| 1359 | - return l_errl; |
| 1360 | -} |
| 1361 | - |
| 1362 | } // namespace HWAS |
| 1363 | diff --git a/src/usr/pnor/HBconfig b/src/usr/pnor/HBconfig |
| 1364 | index 21082f4..298144c 100644 |
| 1365 | --- a/src/usr/pnor/HBconfig |
| 1366 | +++ b/src/usr/pnor/HBconfig |
| 1367 | @@ -37,8 +37,3 @@ config PNOR_IS_32MB |
| 1368 | default n |
| 1369 | help |
| 1370 | Size of the attached flash chip is 32MB, if not set then 64MB is default |
| 1371 | - |
| 1372 | -config TWO_SIDE_SUPPORT |
| 1373 | - default n |
| 1374 | - help |
| 1375 | - This is used to turn on/off two sided pnor support |
| 1376 | diff --git a/src/usr/pnor/common/ffs_hb.H b/src/usr/pnor/common/ffs_hb.H |
| 1377 | index c96911b..b638021 100644 |
| 1378 | --- a/src/usr/pnor/common/ffs_hb.H |
| 1379 | +++ b/src/usr/pnor/common/ffs_hb.H |
| 1380 | @@ -5,9 +5,7 @@ |
| 1381 | /* */ |
| 1382 | /* OpenPOWER HostBoot Project */ |
| 1383 | /* */ |
| 1384 | -/* Contributors Listed Below - COPYRIGHT 2012,2015 */ |
| 1385 | -/* [+] International Business Machines Corp. */ |
| 1386 | -/* */ |
| 1387 | +/* COPYRIGHT International Business Machines Corp. 2012,2014 */ |
| 1388 | /* */ |
| 1389 | /* Licensed under the Apache License, Version 2.0 (the "License"); */ |
| 1390 | /* you may not use this file except in compliance with the License. */ |
| 1391 | @@ -27,7 +25,7 @@ |
| 1392 | |
| 1393 | /* |
| 1394 | * FSP Destination: src/hbfw/fsp/pnor/common/ffs_hb.H |
| 1395 | - * |
| 1396 | + * |
| 1397 | * NOTE: Do NOT modify this file in CMVC directly! It comes from the Hostboot |
| 1398 | * repository and will be overwritten. |
| 1399 | */ |
| 1400 | @@ -65,7 +63,6 @@ enum |
| 1401 | |
| 1402 | /* Miscellaneous Bits : 1 byte */ |
| 1403 | FFS_MISC_PRESERVED = 0x80, /**< Preserved across code updates */ |
| 1404 | - FFS_MISC_READ_ONLY = 0x40, /**< Read only section */ |
| 1405 | FFS_MISC_UNUSED = 0x1F, /**< Unused MISC Flags */ |
| 1406 | }; |
| 1407 | |
| 1408 | diff --git a/src/usr/pnor/makefile b/src/usr/pnor/makefile |
| 1409 | index 2f0a4e1..31087a4 100644 |
| 1410 | --- a/src/usr/pnor/makefile |
| 1411 | +++ b/src/usr/pnor/makefile |
| 1412 | @@ -32,7 +32,6 @@ OBJS += pnor_common.o |
| 1413 | OBJS += pnorvalid.o |
| 1414 | OBJS += ecc.o |
| 1415 | OBJS += sfcdd.o |
| 1416 | -OBJS += pnorsbe.o |
| 1417 | |
| 1418 | #SFC Implementations |
| 1419 | OBJS += $(if $(CONFIG_SFC_IS_IBM_DPSS),sfc_ibm.o) |
| 1420 | diff --git a/src/usr/pnor/pnor_common.C b/src/usr/pnor/pnor_common.C |
| 1421 | index 00931ec..e8972e2 100644 |
| 1422 | --- a/src/usr/pnor/pnor_common.C |
| 1423 | +++ b/src/usr/pnor/pnor_common.C |
| 1424 | @@ -24,15 +24,14 @@ |
| 1425 | /* IBM_PROLOG_END_TAG */ |
| 1426 | |
| 1427 | #include "pnor_common.H" |
| 1428 | +#include <pnor/pnorif.H> |
| 1429 | #include <pnor/pnor_reasoncodes.H> |
| 1430 | |
| 1431 | #include "ffs.h" //Common header file with BuildingBlock. |
| 1432 | #include "common/ffs_hb.H" //Hostboot def of user data in ffs_entry struct |
| 1433 | -#include <sys/mm.h> |
| 1434 | |
| 1435 | #include <initservice/initserviceif.H> |
| 1436 | #include <util/align.H> |
| 1437 | -#include <errl/errlmanager.H> |
| 1438 | |
| 1439 | // Trace definition |
| 1440 | trace_desc_t* g_trac_pnor = NULL; |
| 1441 | @@ -46,29 +45,28 @@ TRAC_INIT(&g_trac_pnor, PNOR_COMP_NAME, 4*KILOBYTE, TRACE::BUFFER_SLOW); //4K |
| 1442 | * Eyecatcher strings for PNOR TOC entries |
| 1443 | */ |
| 1444 | const char* cv_EYECATCHER[] = { |
| 1445 | - "part", /**< PNOR::TOC : Table of Contents */ |
| 1446 | - "HBI", /**< PNOR::HB_EXT_CODE : Hostboot Extended Image */ |
| 1447 | - "GLOBAL", /**< PNOR::GLOBAL_DATA : Global Data */ |
| 1448 | - "HBB", /**< PNOR::HB_BASE_CODE : Hostboot Base Image */ |
| 1449 | - "SBEC", /**< PNOR::CENTAUR_SBE : Centaur Self-Boot Engine image */ |
| 1450 | - "SBE", /**< PNOR::SBE_IPL : Self-Boot Enginer IPL image */ |
| 1451 | - "WINK", /**< PNOR::WINK : Sleep Winkle Reference image */ |
| 1452 | - "PAYLOAD", /**< PNOR::PAYLOAD : HAL/OPAL */ |
| 1453 | - "HBRT", /**< PNOR::HB_RUNTIME : Hostboot Runtime (for Sapphire) */ |
| 1454 | - "HBD", /**< PNOR::HB_DATA : Hostboot Data */ |
| 1455 | - "GUARD", /**< PNOR::GUARD_DATA : Hostboot Data */ |
| 1456 | - "HBEL", /**< PNOR::HB_ERRLOGS : Hostboot Error log Repository */ |
| 1457 | - "DJVPD", /**< PNOR::DIMM_JEDEC_VPD : Dimm JEDEC VPD */ |
| 1458 | - "MVPD", /**< PNOR::MODULE_VPD : Module VPD */ |
| 1459 | - "CVPD", /**< PNOR::CENTAUR_VPD : Centaur VPD */ |
| 1460 | - "NVRAM", /**< PNOR::NVRAM : OPAL Storage */ |
| 1461 | - "OCC", /**< PNOR::OCC : OCC LID */ |
| 1462 | - "FIRDATA", /**< PNOR::FIRDATA : FIRDATA */ |
| 1463 | + "part", /**< PNOR::TOC : Table of Contents */ |
| 1464 | + "HBI", /**< PNOR::HB_EXT_CODE : Hostboot Extended Image */ |
| 1465 | + "GLOBAL", /**< PNOR::GLOBAL_DATA : Global Data */ |
| 1466 | + "HBB", /**< PNOR::HB_BASE_CODE : Hostboot Base Image */ |
| 1467 | + "SBEC", /**< PNOR::CENTAUR_SBE : Centaur Self-Boot Engine image */ |
| 1468 | + "SBE", /**< PNOR::SBE_IPL : Self-Boot Enginer IPL image */ |
| 1469 | + "WINK", /**< PNOR::WINK : Sleep Winkle Reference image */ |
| 1470 | + "PAYLOAD", /**< PNOR::PAYLOAD : HAL/OPAL */ |
| 1471 | + "HBRT", /**< PNOR::HB_RUNTIME : Hostboot Runtime (for Sapphire) */ |
| 1472 | + "HBD", /**< PNOR::HB_DATA : Hostboot Data */ |
| 1473 | + "GUARD", /**< PNOR::GUARD_DATA : Hostboot Data */ |
| 1474 | + "HBEL", /**< PNOR::HB_ERRLOGS : Hostboot Error log Repository */ |
| 1475 | + "DJVPD", /**< PNOR::DIMM_JEDEC_VPD : Dimm JEDEC VPD */ |
| 1476 | + "MVPD", /**< PNOR::MODULE_VPD : Module VPD */ |
| 1477 | + "CVPD", /**< PNOR::CENTAUR_VPD : Centaur VPD */ |
| 1478 | + "NVRAM", /**< PNOR::NVRAM : OPAL Storage */ |
| 1479 | + "OCC", /**< PNOR::OCC : OCC LID */ |
| 1480 | + "FIRDATA", /**< PNOR::FIRDATA : FIRDATA */ |
| 1481 | "ATTR_TMP", /**< PNOR::ATTR_TMP : Temporary Attribute Overrides */ |
| 1482 | "ATTR_PERM", /**< PNOR::ATTR_PERM : Permanent Attribute Overrides */ |
| 1483 | - "CAPP", /**< PNOR::CAPP : CAPP LID */ |
| 1484 | - "TEST", /**< PNOR::TEST : Test space for PNOR*/ |
| 1485 | - "TESTRO", /**< PNOR::TESTRO : ReadOnly Test space for PNOR */ |
| 1486 | + "CAPP", /**< PNOR::CAPP : CAPP LID */ |
| 1487 | + "TEST", /**< PNOR::TEST : Test space for PNOR*/ |
| 1488 | //Not currently used |
| 1489 | // "XXX", /**< NUM_SECTIONS : Used as invalid entry */ |
| 1490 | }; |
| 1491 | @@ -91,7 +89,7 @@ uint32_t PNOR::pnor_ffs_checksum(void* data, size_t size) |
| 1492 | } |
| 1493 | |
| 1494 | errlHndl_t PNOR::parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer, |
| 1495 | - TOCS & o_TOC_used, SectionData_t * o_TOC, uint64_t i_baseVAddr) |
| 1496 | + uint32_t & o_TOC_used, SectionData_t * o_TOC, uint64_t i_baseVAddr) |
| 1497 | { |
| 1498 | TRACUCOMP(g_trac_pnor,"PNOR::parseTOC>"); |
| 1499 | errlHndl_t l_errhdl = NULL; |
| 1500 | @@ -99,10 +97,9 @@ errlHndl_t PNOR::parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer, |
| 1501 | bool TOC_0_failed = false; |
| 1502 | |
| 1503 | do{ |
| 1504 | - o_TOC_used = TOC_0; |
| 1505 | + o_TOC_used = 0; |
| 1506 | |
| 1507 | - for (TOCS cur_TOC = TOC_0; cur_TOC < NUM_TOCS; |
| 1508 | - cur_TOC = (TOCS)(cur_TOC+1)) |
| 1509 | + for (uint32_t cur_TOC = 0; cur_TOC < NUM_TOCS; ++cur_TOC) |
| 1510 | { |
| 1511 | TRACFCOMP(g_trac_pnor, "PNOR::parseTOC verifying TOC: %d",cur_TOC); |
| 1512 | uint64_t nextVAddr = i_baseVAddr; |
| 1513 | @@ -137,10 +134,10 @@ errlHndl_t PNOR::parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer, |
| 1514 | { |
| 1515 | TRACFCOMP(g_trac_pnor, "PNOR::parseTOC TOC 0 failed header checksum"); |
| 1516 | TOC_0_failed = true; |
| 1517 | - o_TOC_used = TOC_1; |
| 1518 | + o_TOC_used = 1; |
| 1519 | continue; |
| 1520 | } |
| 1521 | - else if (cur_TOC == TOC_1 && TOC_0_failed) |
| 1522 | + else if (cur_TOC == 1 && TOC_0_failed) |
| 1523 | { |
| 1524 | // Both TOC's failed |
| 1525 | TRACFCOMP(g_trac_pnor, "PNOR::parseTOC both TOCs are corrupted"); |
| 1526 | @@ -167,7 +164,7 @@ errlHndl_t PNOR::parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer, |
| 1527 | } |
| 1528 | |
| 1529 | // Only check header if on first TOC or the first TOC failed |
| 1530 | - if (cur_TOC == TOC_0 || TOC_0_failed) |
| 1531 | + if (cur_TOC == 0 || TOC_0_failed) |
| 1532 | { |
| 1533 | TRACFCOMP(g_trac_pnor, "PNOR::parseTOC: FFS Block size=0x%.8X," |
| 1534 | " Partition Table Size = 0x%.8x, entry_count=%d", |
| 1535 | @@ -273,15 +270,15 @@ errlHndl_t PNOR::parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer, |
| 1536 | // in SP-less config |
| 1537 | TRACFCOMP(g_trac_pnor, "PNOR::parseTOC pnor_ffs_checksum" |
| 1538 | " entry checksums do not match"); |
| 1539 | - if (cur_TOC == TOC_0) |
| 1540 | + if (cur_TOC == 0) |
| 1541 | { |
| 1542 | TRACFCOMP(g_trac_pnor,"PNOR::parseTOC TOC 0 entry" |
| 1543 | " checksum failed"); |
| 1544 | TOC_0_failed = true; |
| 1545 | - o_TOC_used = TOC_1; |
| 1546 | + o_TOC_used = 1; |
| 1547 | break; |
| 1548 | } |
| 1549 | - else if (cur_TOC == TOC_1 && TOC_0_failed) |
| 1550 | + else if (cur_TOC == 1 && TOC_0_failed) |
| 1551 | { |
| 1552 | // Both TOC's failed |
| 1553 | TRACFCOMP(g_trac_pnor, "PNOR::parseTOC both TOC's are" |
| 1554 | @@ -309,7 +306,7 @@ errlHndl_t PNOR::parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer, |
| 1555 | } |
| 1556 | |
| 1557 | // Only set data if on first TOC or the first TOC failed |
| 1558 | - if (cur_TOC == TOC_0 || TOC_0_failed) |
| 1559 | + if (cur_TOC == 0 || TOC_0_failed) |
| 1560 | { |
| 1561 | //Figure out section enum |
| 1562 | for(uint32_t eyeIndex=PNOR::TOC;eyeIndex<PNOR::NUM_SECTIONS; |
| 1563 | @@ -396,120 +393,25 @@ errlHndl_t PNOR::parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer, |
| 1564 | 0, 0, true); |
| 1565 | break; |
| 1566 | } |
| 1567 | - |
| 1568 | -# ifndef __HOSTBOOT_RUNTIME |
| 1569 | - // Handle section permissions |
| 1570 | - if (o_TOC[secId].misc & FFS_MISC_READ_ONLY) |
| 1571 | - { |
| 1572 | - // Need to set permissions to allow writing to virtual |
| 1573 | - // addresses, but prevents the kernel from ejecting |
| 1574 | - // dirty pages (no WRITE_TRACKED). |
| 1575 | - int rc = mm_set_permission( |
| 1576 | - (void*)o_TOC[secId].virtAddr, |
| 1577 | - o_TOC[secId].size, |
| 1578 | - WRITABLE); |
| 1579 | - if (rc) |
| 1580 | - { |
| 1581 | - TRACFCOMP(g_trac_pnor, "E>PnorRP::readTOC: Failed to set block permissions to WRITABLE for section %s.", |
| 1582 | - cv_EYECATCHER[secId]); |
| 1583 | - /*@ |
| 1584 | - * @errortype |
| 1585 | - * @moduleid PNOR::MOD_PNORRP_READTOC |
| 1586 | - * @reasoncode PNOR::RC_WRITABLE_PERM_FAIL |
| 1587 | - * @userdata1 PNOR section id |
| 1588 | - * @userdata2 PNOR section vaddr |
| 1589 | - * @devdesc Could not set permissions of the |
| 1590 | - * given PNOR section to WRITABLE |
| 1591 | - * @custdesc A problem occurred while reading PNOR partition table |
| 1592 | - */ |
| 1593 | - l_errhdl = new ERRORLOG::ErrlEntry( |
| 1594 | - ERRORLOG::ERRL_SEV_UNRECOVERABLE, |
| 1595 | - PNOR::MOD_PNORRP_READTOC, |
| 1596 | - PNOR::RC_WRITABLE_PERM_FAIL, |
| 1597 | - secId, |
| 1598 | - o_TOC[secId].virtAddr, |
| 1599 | - true /*Add HB SW Callout*/); |
| 1600 | - l_errhdl->collectTrace(PNOR_COMP_NAME); |
| 1601 | - } |
| 1602 | - } |
| 1603 | - else |
| 1604 | - { |
| 1605 | - // Need to set permissions to R/W |
| 1606 | - int rc = mm_set_permission( |
| 1607 | - (void*)o_TOC[secId].virtAddr, |
| 1608 | - o_TOC[secId].size, |
| 1609 | - WRITABLE | WRITE_TRACKED); |
| 1610 | - if (rc) |
| 1611 | - { |
| 1612 | - TRACFCOMP(g_trac_pnor, "E>PnorRP::readTOC: Failed to set block permissions to WRITABLE/WRITE_TRACKED for section %s.", |
| 1613 | - cv_EYECATCHER[secId]); |
| 1614 | - /*@ |
| 1615 | - * @errortype |
| 1616 | - * @moduleid PNOR::MOD_PNORRP_READTOC |
| 1617 | - * @reasoncode PNOR::RC_WRITE_TRACKED_PERM_FAIL |
| 1618 | - * @userdata1 PNOR section id |
| 1619 | - * @userdata2 PNOR section vaddr |
| 1620 | - * @devdesc Could not set permissions of the |
| 1621 | - * given PNOR section to |
| 1622 | - * WRITABLE/WRITE_TRACKED |
| 1623 | - * @custdesc A problem occurred while reading |
| 1624 | - * PNOR partition table |
| 1625 | - */ |
| 1626 | - l_errhdl = new ERRORLOG::ErrlEntry( |
| 1627 | - ERRORLOG::ERRL_SEV_UNRECOVERABLE, |
| 1628 | - PNOR::MOD_PNORRP_READTOC, |
| 1629 | - PNOR::RC_WRITE_TRACKED_PERM_FAIL, |
| 1630 | - secId, |
| 1631 | - o_TOC[secId].virtAddr, |
| 1632 | - true /*Add HB SW Callout*/); |
| 1633 | - l_errhdl->collectTrace(PNOR_COMP_NAME); |
| 1634 | - } |
| 1635 | - } |
| 1636 | -#endif |
| 1637 | - if( l_errhdl ) |
| 1638 | - { |
| 1639 | - // If both toc0 and toc1 fail break and return the error |
| 1640 | - if ( (cur_TOC == TOC_1) && (TOC_0_failed) ) |
| 1641 | - { |
| 1642 | - TRACFCOMP(g_trac_pnor, "PNOR::parseTOC readFromDevice Failed on both TOCs"); |
| 1643 | - break; |
| 1644 | - } |
| 1645 | - |
| 1646 | - // Toc 1 has not been read yet or Toc 0 was read |
| 1647 | - // successfully |
| 1648 | - // Commit error and break to continue checking the next |
| 1649 | - // TOC |
| 1650 | - else |
| 1651 | - { |
| 1652 | - TRACFCOMP(g_trac_pnor, "PNOR::parseTOC readFromDevice Failed on TOC %d, commit error", |
| 1653 | - cur_TOC); |
| 1654 | - errlCommit(l_errhdl,PNOR_COMP_ID); |
| 1655 | - l_errhdl = NULL; |
| 1656 | - break; |
| 1657 | - } |
| 1658 | - } |
| 1659 | } |
| 1660 | - } // For TOC Entries |
| 1661 | + } |
| 1662 | if (l_errhdl) |
| 1663 | { |
| 1664 | + TRACFCOMP(g_trac_pnor, ERR_MRK"PNOR::parseTOC: error parsing"); |
| 1665 | break; |
| 1666 | } |
| 1667 | - } // For TOC's |
| 1668 | - if (l_errhdl) |
| 1669 | - { |
| 1670 | - break; |
| 1671 | + |
| 1672 | + for(PNOR::SectionId tmpId = PNOR::FIRST_SECTION; |
| 1673 | + tmpId < PNOR::NUM_SECTIONS; |
| 1674 | + tmpId = (PNOR::SectionId) (tmpId + 1) ) |
| 1675 | + { |
| 1676 | + TRACFCOMP(g_trac_pnor, "%s: size=0x%.8X flash=0x%.8X " |
| 1677 | + "virt=0x%.16X", cv_EYECATCHER[tmpId], o_TOC[tmpId].size, |
| 1678 | + o_TOC[tmpId].flashAddr, o_TOC[tmpId].virtAddr ); |
| 1679 | + } |
| 1680 | } |
| 1681 | } while(0); |
| 1682 | |
| 1683 | - for(PNOR::SectionId tmpId = PNOR::FIRST_SECTION; |
| 1684 | - tmpId < PNOR::NUM_SECTIONS; |
| 1685 | - tmpId = (PNOR::SectionId) (tmpId + 1) ) |
| 1686 | - { |
| 1687 | - TRACFCOMP(g_trac_pnor, "%s: size=0x%.8X flash=0x%.8X " |
| 1688 | - "virt=0x%.16X", cv_EYECATCHER[tmpId], o_TOC[tmpId].size, |
| 1689 | - o_TOC[tmpId].flashAddr, o_TOC[tmpId].virtAddr ); |
| 1690 | - } |
| 1691 | - |
| 1692 | TRACUCOMP(g_trac_pnor, "< PNOR::parseTOC" ); |
| 1693 | return l_errhdl; |
| 1694 | } |
| 1695 | diff --git a/src/usr/pnor/pnor_common.H b/src/usr/pnor/pnor_common.H |
| 1696 | index 5eb8934..3944e27 100644 |
| 1697 | --- a/src/usr/pnor/pnor_common.H |
| 1698 | +++ b/src/usr/pnor/pnor_common.H |
| 1699 | @@ -41,22 +41,11 @@ namespace PNOR { |
| 1700 | uint8_t misc; /**< Misc Flags */ |
| 1701 | } PACKED; |
| 1702 | |
| 1703 | - // Simple enum of TOC's per PNOR side |
| 1704 | - enum TOCS |
| 1705 | - { |
| 1706 | - TOC_0 = 0, |
| 1707 | - TOC_1 = 1, |
| 1708 | - NUM_TOCS, |
| 1709 | - }; |
| 1710 | - |
| 1711 | enum |
| 1712 | { |
| 1713 | - // @TODO RTC: 120061 - Determine TOC locations |
| 1714 | - // TOC offsets based on pnor layout |
| 1715 | - SIDE_A_TOC_0_OFFSET = 0, |
| 1716 | - SIDE_A_TOC_1_OFFSET = 0x8000, |
| 1717 | - SIDE_B_TOC_0_OFFSET = 0x2000000, |
| 1718 | - SIDE_B_TOC_1_OFFSET = 0x2008000, |
| 1719 | + NUM_TOCS = 2, |
| 1720 | + TOC_0_OFFSET = 0, |
| 1721 | + TOC_1_OFFSET = 0x8000, |
| 1722 | |
| 1723 | /** Real number of bytes required to read 1 logical page */ |
| 1724 | PAGESIZE_PLUS_ECC = ((PAGESIZE * 9)/8), // 8B data + 1B of ECC |
| 1725 | @@ -90,7 +79,7 @@ namespace PNOR { |
| 1726 | * @return Error |
| 1727 | */ |
| 1728 | errlHndl_t parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer, |
| 1729 | - TOCS & o_TOC_used, SectionData_t * o_TOC, uint64_t i_baseVAddr); |
| 1730 | + uint32_t & o_TOC_used, SectionData_t * o_TOC, uint64_t i_baseVAddr); |
| 1731 | } |
| 1732 | |
| 1733 | #endif |
| 1734 | diff --git a/src/usr/pnor/pnorrp.C b/src/usr/pnor/pnorrp.C |
| 1735 | index aeaeb22..299a063 100644 |
| 1736 | --- a/src/usr/pnor/pnorrp.C |
| 1737 | +++ b/src/usr/pnor/pnorrp.C |
| 1738 | @@ -44,7 +44,6 @@ |
| 1739 | #include <endian.h> |
| 1740 | #include <util/align.H> |
| 1741 | #include <config.h> |
| 1742 | -#include "pnor_common.H" |
| 1743 | |
| 1744 | |
| 1745 | extern trace_desc_t* g_trac_pnor; |
| 1746 | @@ -193,9 +192,7 @@ void* wait_for_message( void* unused ) |
| 1747 | * @brief Constructor |
| 1748 | */ |
| 1749 | PnorRP::PnorRP() |
| 1750 | -: iv_activeTocOffsets(SIDE_A_TOC_0_OFFSET,SIDE_A_TOC_1_OFFSET) |
| 1751 | -,iv_altTocOffsets(SIDE_B_TOC_0_OFFSET,SIDE_B_TOC_1_OFFSET) |
| 1752 | -,iv_TOC_used(TOC_0) |
| 1753 | +: iv_TOC_used(0) |
| 1754 | ,iv_msgQ(NULL) |
| 1755 | ,iv_startupRC(0) |
| 1756 | { |
| 1757 | @@ -234,28 +231,12 @@ void PnorRP::initDaemon() |
| 1758 | |
| 1759 | do |
| 1760 | { |
| 1761 | - // @TODO RTC: 120062 - Determine which side is Golden |
| 1762 | - // Default TOC offsets set to side A. If two side support is enabled, |
| 1763 | - // check which SEEPROM hostboot booted from |
| 1764 | -#ifdef CONFIG_TWO_SIDE_SUPPORT |
| 1765 | - TARGETING::Target* pnor_target = TARGETING:: |
| 1766 | - MASTER_PROCESSOR_CHIP_TARGET_SENTINEL; |
| 1767 | - // Get correct TOC |
| 1768 | - PNOR::sbeSeepromSide_t l_bootSide; |
| 1769 | - PNOR::getSbeBootSeeprom(pnor_target, l_bootSide); |
| 1770 | - if (l_bootSide == PNOR::SBE_SEEPROM1) |
| 1771 | - { |
| 1772 | - TRACFCOMP( g_trac_pnor, "PnorRP::initDaemon> Booting from Side B"); |
| 1773 | - iv_activeTocOffsets.first = SIDE_B_TOC_0_OFFSET; |
| 1774 | - iv_activeTocOffsets.second = SIDE_B_TOC_1_OFFSET; |
| 1775 | - iv_altTocOffsets.first = SIDE_A_TOC_0_OFFSET; |
| 1776 | - iv_altTocOffsets.second = SIDE_A_TOC_0_OFFSET; |
| 1777 | - } |
| 1778 | - else |
| 1779 | + // read the TOC in the PNOR to compute the sections |
| 1780 | + l_errhdl = readTOC(); |
| 1781 | + if( l_errhdl ) |
| 1782 | { |
| 1783 | - TRACFCOMP( g_trac_pnor, "PnorRP::initDaemon> Booting from Side A"); |
| 1784 | + break; |
| 1785 | } |
| 1786 | -#endif |
| 1787 | |
| 1788 | // create a message queue |
| 1789 | iv_msgQ = msg_q_create(); |
| 1790 | @@ -272,7 +253,7 @@ void PnorRP::initDaemon() |
| 1791 | * @userdata1 Requested Address |
| 1792 | * @userdata2 rc from mm_alloc_block |
| 1793 | * @devdesc PnorRP::initDaemon> Error from mm_alloc_block |
| 1794 | - * @custdesc A problem occurred while accessing the boot flash. |
| 1795 | + * @custdesc A problem occurred while accessing the boot flash. |
| 1796 | */ |
| 1797 | l_errhdl = new ERRORLOG::ErrlEntry( |
| 1798 | ERRORLOG::ERRL_SEV_UNRECOVERABLE, |
| 1799 | @@ -289,14 +270,9 @@ void PnorRP::initDaemon() |
| 1800 | INITSERVICE::registerBlock(reinterpret_cast<void*>(BASE_VADDR), |
| 1801 | TOTAL_SIZE,PNOR_PRIORITY); |
| 1802 | |
| 1803 | - // Read the TOC in the PNOR to compute the sections and set their |
| 1804 | - // correct permissions |
| 1805 | - l_errhdl = readTOC(); |
| 1806 | - if( l_errhdl ) |
| 1807 | - { |
| 1808 | - TRACFCOMP(g_trac_pnor, ERR_MRK"PnorRP::initDaemon: Failed to readTOC"); |
| 1809 | - break; |
| 1810 | - } |
| 1811 | + // Need to set permissions to R/W |
| 1812 | + rc = mm_set_permission((void*) BASE_VADDR,TOTAL_SIZE, |
| 1813 | + WRITABLE | WRITE_TRACKED); |
| 1814 | |
| 1815 | // start task to wait on the queue |
| 1816 | task_create( wait_for_message, NULL ); |
| 1817 | @@ -343,7 +319,7 @@ errlHndl_t PnorRP::getSectionInfo( PNOR::SectionId i_section, |
| 1818 | * @userdata1 Requested Section |
| 1819 | * @userdata2 Startup RC |
| 1820 | * @devdesc PnorRP::getSectionInfo> RP not properly initialized |
| 1821 | - * @custdesc A problem occurred while accessing the boot flash. |
| 1822 | + * @custdesc A problem occurred while accessing the boot flash. |
| 1823 | */ |
| 1824 | l_errhdl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, |
| 1825 | PNOR::MOD_PNORRP_GETSECTIONINFO, |
| 1826 | @@ -370,7 +346,7 @@ errlHndl_t PnorRP::getSectionInfo( PNOR::SectionId i_section, |
| 1827 | * @userdata1 Requested Section |
| 1828 | * @userdata2 TOC used |
| 1829 | * @devdesc PnorRP::getSectionInfo> Invalid Address for read/write |
| 1830 | - * @custdesc A problem occurred while accessing the boot flash. |
| 1831 | + * @custdesc A problem occurred while accessing the boot flash. |
| 1832 | */ |
| 1833 | l_errhdl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, |
| 1834 | PNOR::MOD_PNORRP_GETSECTIONINFO, |
| 1835 | @@ -402,13 +378,12 @@ errlHndl_t PnorRP::getSectionInfo( PNOR::SectionId i_section, |
| 1836 | != 0) ? true : false; |
| 1837 | o_info.sha512perEC = ((iv_TOC[id].version & FFS_VERS_SHA512_PER_EC) |
| 1838 | != 0) ? true : false; |
| 1839 | - o_info.readOnly = ((iv_TOC[id].misc & FFS_MISC_READ_ONLY) |
| 1840 | - != 0) ? true : false; |
| 1841 | } |
| 1842 | |
| 1843 | return l_errhdl; |
| 1844 | } |
| 1845 | |
| 1846 | + |
| 1847 | /** |
| 1848 | * @brief Read the TOC and store section information |
| 1849 | */ |
| 1850 | @@ -420,7 +395,7 @@ errlHndl_t PnorRP::readTOC() |
| 1851 | uint8_t* toc1Buffer = new uint8_t[PAGESIZE]; |
| 1852 | uint64_t fatal_error = 0; |
| 1853 | do { |
| 1854 | - l_errhdl = readFromDevice( iv_activeTocOffsets.first, 0, false, |
| 1855 | + l_errhdl = readFromDevice( TOC_0_OFFSET, 0, false, |
| 1856 | toc0Buffer, fatal_error ); |
| 1857 | if (l_errhdl) |
| 1858 | { |
| 1859 | @@ -428,7 +403,7 @@ errlHndl_t PnorRP::readTOC() |
| 1860 | break; |
| 1861 | } |
| 1862 | |
| 1863 | - l_errhdl = readFromDevice( iv_activeTocOffsets.second, 0, false, |
| 1864 | + l_errhdl = readFromDevice( TOC_1_OFFSET, 0, false, |
| 1865 | toc1Buffer, fatal_error ); |
| 1866 | if (l_errhdl) |
| 1867 | { |
| 1868 | @@ -437,7 +412,7 @@ errlHndl_t PnorRP::readTOC() |
| 1869 | } |
| 1870 | |
| 1871 | l_errhdl = PNOR::parseTOC(toc0Buffer, toc1Buffer, iv_TOC_used, iv_TOC, |
| 1872 | - BASE_VADDR); |
| 1873 | + BASE_VADDR); |
| 1874 | if (l_errhdl) |
| 1875 | { |
| 1876 | TRACFCOMP(g_trac_pnor, "readTOC: parseTOC failed"); |
| 1877 | @@ -762,63 +737,59 @@ errlHndl_t PnorRP::computeDeviceAddr( void* i_vaddr, |
| 1878 | o_chip = 99; |
| 1879 | uint64_t l_vaddr = (uint64_t)i_vaddr; |
| 1880 | |
| 1881 | - do |
| 1882 | + // make sure this is one of our addresses |
| 1883 | + if( !((l_vaddr >= BASE_VADDR) |
| 1884 | + && (l_vaddr < LAST_VADDR)) ) |
| 1885 | { |
| 1886 | - // make sure this is one of our addresses |
| 1887 | - if( !((l_vaddr >= BASE_VADDR) |
| 1888 | - && (l_vaddr < LAST_VADDR)) ) |
| 1889 | - { |
| 1890 | - TRACFCOMP( g_trac_pnor, "PnorRP::computeDeviceAddr> Virtual Address outside known PNOR range : i_vaddr=%p", i_vaddr ); |
| 1891 | - /*@ |
| 1892 | - * @errortype |
| 1893 | - * @moduleid PNOR::MOD_PNORRP_WAITFORMESSAGE |
| 1894 | - * @reasoncode PNOR::RC_INVALID_ADDRESS |
| 1895 | - * @userdata1 Virtual Address |
| 1896 | - * @userdata2 Base PNOR Address |
| 1897 | - * @devdesc PnorRP::computeDeviceAddr> Virtual Address outside |
| 1898 | - * known PNOR range |
| 1899 | - * @custdesc A problem occurred while accessing the boot flash. |
| 1900 | - */ |
| 1901 | - l_errhdl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, |
| 1902 | - PNOR::MOD_PNORRP_COMPUTEDEVICEADDR, |
| 1903 | - PNOR::RC_INVALID_ADDRESS, |
| 1904 | - l_vaddr, |
| 1905 | - BASE_VADDR, |
| 1906 | - true /*Add HB SW Callout*/); |
| 1907 | - l_errhdl->collectTrace(PNOR_COMP_NAME); |
| 1908 | - break; |
| 1909 | - } |
| 1910 | + TRACFCOMP( g_trac_pnor, "PnorRP::computeDeviceAddr> Virtual Address outside known PNOR range : i_vaddr=%p", i_vaddr ); |
| 1911 | + /*@ |
| 1912 | + * @errortype |
| 1913 | + * @moduleid PNOR::MOD_PNORRP_WAITFORMESSAGE |
| 1914 | + * @reasoncode PNOR::RC_INVALID_ADDRESS |
| 1915 | + * @userdata1 Virtual Address |
| 1916 | + * @userdata2 Base PNOR Address |
| 1917 | + * @devdesc PnorRP::computeDeviceAddr> Virtual Address outside |
| 1918 | + * known PNOR range |
| 1919 | + * @custdesc A problem occurred while accessing the boot flash. |
| 1920 | + */ |
| 1921 | + l_errhdl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, |
| 1922 | + PNOR::MOD_PNORRP_COMPUTEDEVICEADDR, |
| 1923 | + PNOR::RC_INVALID_ADDRESS, |
| 1924 | + l_vaddr, |
| 1925 | + BASE_VADDR, |
| 1926 | + true /*Add HB SW Callout*/); |
| 1927 | + l_errhdl->collectTrace(PNOR_COMP_NAME); |
| 1928 | + return l_errhdl; |
| 1929 | + } |
| 1930 | |
| 1931 | - // find the matching section |
| 1932 | - PNOR::SectionId id = PNOR::INVALID_SECTION; |
| 1933 | - l_errhdl = computeSection( l_vaddr, id ); |
| 1934 | - if( l_errhdl ) |
| 1935 | - { |
| 1936 | - TRACFCOMP( g_trac_pnor, "PnorRP::computeDeviceAddr> Virtual address does not match any pnor sections : i_vaddr=%p", i_vaddr ); |
| 1937 | - break; |
| 1938 | - } |
| 1939 | + // find the matching section |
| 1940 | + PNOR::SectionId id = PNOR::INVALID_SECTION; |
| 1941 | + l_errhdl = computeSection( l_vaddr, id ); |
| 1942 | + if( l_errhdl ) |
| 1943 | + { |
| 1944 | + return l_errhdl; |
| 1945 | + } |
| 1946 | |
| 1947 | - // pull out the information we need to return from our global copy |
| 1948 | - o_chip = iv_TOC[id].chip; |
| 1949 | - o_ecc = (bool)(iv_TOC[id].integrity & FFS_INTEG_ECC_PROTECT); |
| 1950 | - o_offset = l_vaddr - iv_TOC[id].virtAddr; //offset into section |
| 1951 | + // pull out the information we need to return from our global copy |
| 1952 | + o_chip = iv_TOC[id].chip; |
| 1953 | + o_ecc = (bool)(iv_TOC[id].integrity & FFS_INTEG_ECC_PROTECT); |
| 1954 | + o_offset = l_vaddr - iv_TOC[id].virtAddr; //offset into section |
| 1955 | |
| 1956 | - // for ECC we need to figure out where the ECC-enhanced offset is |
| 1957 | - // before tacking on the offset to the section |
| 1958 | - if( o_ecc ) |
| 1959 | - { |
| 1960 | - o_offset = (o_offset * 9) / 8; |
| 1961 | - } |
| 1962 | - // add on the offset of the section itself |
| 1963 | - o_offset += iv_TOC[id].flashAddr; |
| 1964 | - } while(0); |
| 1965 | + // for ECC we need to figure out where the ECC-enhanced offset is |
| 1966 | + // before tacking on the offset to the section |
| 1967 | + if( o_ecc ) |
| 1968 | + { |
| 1969 | + o_offset = (o_offset * 9) / 8; |
| 1970 | + } |
| 1971 | + // add on the offset of the section itself |
| 1972 | + o_offset += iv_TOC[id].flashAddr; |
| 1973 | |
| 1974 | TRACUCOMP( g_trac_pnor, "< PnorRP::computeDeviceAddr: i_vaddr=%X, o_offset=0x%X, o_chip=%d", l_vaddr, o_offset, o_chip ); |
| 1975 | return l_errhdl; |
| 1976 | } |
| 1977 | |
| 1978 | /** |
| 1979 | - * @brief Static instance function |
| 1980 | + * @brief Static instance function for testcase only |
| 1981 | */ |
| 1982 | PnorRP& PnorRP::getInstance() |
| 1983 | { |
| 1984 | @@ -1016,10 +987,3 @@ errlHndl_t PnorRP::fixECC (PNOR::SectionId i_section) |
| 1985 | TRACFCOMP(g_trac_pnor, EXIT_MRK"PnorRP::fixECC"); |
| 1986 | return l_err; |
| 1987 | } |
| 1988 | - |
| 1989 | -uint64_t PnorRP::getTocOffset(TOCS i_toc) const |
| 1990 | -{ |
| 1991 | - // Can use a ternary operator because there are only 2 TOCs per side |
| 1992 | - return (i_toc == TOC_0) ? iv_activeTocOffsets.first : |
| 1993 | - iv_activeTocOffsets.second; |
| 1994 | -} |
| 1995 | diff --git a/src/usr/pnor/pnorrp.H b/src/usr/pnor/pnorrp.H |
| 1996 | index 509cf14..3703afe 100644 |
| 1997 | --- a/src/usr/pnor/pnorrp.H |
| 1998 | +++ b/src/usr/pnor/pnorrp.H |
| 1999 | @@ -76,18 +76,9 @@ class PnorRP |
| 2000 | */ |
| 2001 | errlHndl_t fixECC(PNOR::SectionId i_section); |
| 2002 | |
| 2003 | - /** |
| 2004 | - * @brief Get TOC offset of specified TOC on active side |
| 2005 | - * |
| 2006 | - * @param[in] i_toc TOC offset desired on active side |
| 2007 | - * |
| 2008 | - * @return uint64_t TOC offset |
| 2009 | - */ |
| 2010 | - uint64_t getTocOffset(PNOR::TOCS i_toc) const; |
| 2011 | - |
| 2012 | protected: |
| 2013 | /** |
| 2014 | - * @brief Constructor, default TOC offsets to side A |
| 2015 | + * @brief Constructor |
| 2016 | */ |
| 2017 | PnorRP(); |
| 2018 | |
| 2019 | @@ -98,23 +89,16 @@ class PnorRP |
| 2020 | |
| 2021 | |
| 2022 | private: |
| 2023 | - |
| 2024 | - // TOC 0 and 1 offsets of both PNOR sides. The active PNOR side determined |
| 2025 | - // by the Seeprom the SBE booted from |
| 2026 | - std::pair<uint64_t, uint64_t> iv_activeTocOffsets; |
| 2027 | - std::pair<uint64_t, uint64_t> iv_altTocOffsets; |
| 2028 | - |
| 2029 | enum |
| 2030 | { |
| 2031 | BASE_VADDR = VMM_VADDR_PNOR_RP, /**< 2GB = 0x80000000*/ |
| 2032 | TOTAL_SIZE = 64*MEGABYTE, /**< Allocate 64 MB (0x4000000)*/ |
| 2033 | LAST_VADDR = BASE_VADDR + TOTAL_SIZE, /**< End of our VA range */ |
| 2034 | }; |
| 2035 | - |
| 2036 | /** |
| 2037 | * Which TOC (0 or 1) is used after verifying both. |
| 2038 | */ |
| 2039 | - PNOR::TOCS iv_TOC_used; |
| 2040 | + uint32_t iv_TOC_used; |
| 2041 | |
| 2042 | /** |
| 2043 | * Flash statistics |
| 2044 | @@ -154,8 +138,7 @@ class PnorRP |
| 2045 | |
| 2046 | /** |
| 2047 | * @brief Verify both TOC's and store section information from one of the |
| 2048 | - * verified TOC's. Additionally set each section permissions |
| 2049 | - * (e.g. readOnly) |
| 2050 | + * verified TOC's |
| 2051 | * |
| 2052 | * @return Error from device |
| 2053 | */ |
| 2054 | @@ -241,6 +224,7 @@ class PnorRP |
| 2055 | return false; |
| 2056 | }; |
| 2057 | |
| 2058 | + |
| 2059 | // allow local helper function to call private methods |
| 2060 | friend void* wait_for_message( void* unused ); |
| 2061 | |
| 2062 | @@ -253,7 +237,7 @@ class PnorRP |
| 2063 | friend errlHndl_t PNOR::validateAltMaster( void ); |
| 2064 | |
| 2065 | /** |
| 2066 | - * @brief Static instance function |
| 2067 | + * @brief Static instance function for testcase only |
| 2068 | */ |
| 2069 | static PnorRP& getInstance(); |
| 2070 | }; |
| 2071 | diff --git a/src/usr/pnor/pnorsbe.C b/src/usr/pnor/pnorsbe.C |
| 2072 | deleted file mode 100644 |
| 2073 | index 0b61173..0000000 |
| 2074 | --- a/src/usr/pnor/pnorsbe.C |
| 2075 | +++ /dev/null |
| 2076 | @@ -1,87 +0,0 @@ |
| 2077 | -/* IBM_PROLOG_BEGIN_TAG */ |
| 2078 | -/* This is an automatically generated prolog. */ |
| 2079 | -/* */ |
| 2080 | -/* $Source: src/usr/pnor/pnorsbe.C $ */ |
| 2081 | -/* */ |
| 2082 | -/* OpenPOWER HostBoot Project */ |
| 2083 | -/* */ |
| 2084 | -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ |
| 2085 | -/* [+] International Business Machines Corp. */ |
| 2086 | -/* */ |
| 2087 | -/* */ |
| 2088 | -/* Licensed under the Apache License, Version 2.0 (the "License"); */ |
| 2089 | -/* you may not use this file except in compliance with the License. */ |
| 2090 | -/* You may obtain a copy of the License at */ |
| 2091 | -/* */ |
| 2092 | -/* http://www.apache.org/licenses/LICENSE-2.0 */ |
| 2093 | -/* */ |
| 2094 | -/* Unless required by applicable law or agreed to in writing, software */ |
| 2095 | -/* distributed under the License is distributed on an "AS IS" BASIS, */ |
| 2096 | -/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ |
| 2097 | -/* implied. See the License for the specific language governing */ |
| 2098 | -/* permissions and limitations under the License. */ |
| 2099 | -/* */ |
| 2100 | -/* IBM_PROLOG_END_TAG */ |
| 2101 | -/** |
| 2102 | - * @file pnorsbe.C |
| 2103 | - * |
| 2104 | - * @brief Implements PNOR::getSbeBootSeeprom(), which Determines which |
| 2105 | - * Seeprom was used to boot the SB |
| 2106 | - */ |
| 2107 | - |
| 2108 | -#include <pnor/pnorif.H> |
| 2109 | -#include <trace/interface.H> |
| 2110 | -#include <errl/errlmanager.H> |
| 2111 | -#include <errl/errlentry.H> |
| 2112 | -#include <devicefw/userif.H> |
| 2113 | - |
| 2114 | -extern trace_desc_t* g_trac_pnor; |
| 2115 | - |
| 2116 | -namespace PNOR |
| 2117 | -{ |
| 2118 | - |
| 2119 | -//Used to read SBE Boot Side from processor |
| 2120 | -const uint64_t SBE_VITAL_REG_0x0005001C = 0x005001C; |
| 2121 | -const uint64_t SBE_BOOT_SELECT_MASK = 0x0080000000000000; |
| 2122 | - |
| 2123 | -errlHndl_t getSbeBootSeeprom(TARGETING::Target* i_target, |
| 2124 | - sbeSeepromSide_t& o_bootSide) |
| 2125 | -{ |
| 2126 | - TRACFCOMP( g_trac_pnor, ENTER_MRK"PNOR::getSbeBootSeeprom()" ); |
| 2127 | - |
| 2128 | - errlHndl_t err = NULL; |
| 2129 | - uint64_t scomData = 0x0; |
| 2130 | - |
| 2131 | - o_bootSide = SBE_SEEPROM0; |
| 2132 | - |
| 2133 | - do{ |
| 2134 | - |
| 2135 | - size_t op_size = sizeof(scomData); |
| 2136 | - err = deviceRead( i_target, |
| 2137 | - &scomData, |
| 2138 | - op_size, |
| 2139 | - DEVICE_SCOM_ADDRESS(SBE_VITAL_REG_0x0005001C) ); |
| 2140 | - if( err ) |
| 2141 | - { |
| 2142 | - TRACFCOMP( g_trac_pnor, ERR_MRK"PNOR::getSbeBootSeeprom() -Error " |
| 2143 | - "reading SBE VITAL REG (0x%.8X) from Target :" |
| 2144 | - "HUID=0x%.8X", |
| 2145 | - SBE_VITAL_REG_0x0005001C, |
| 2146 | - TARGETING::get_huid(i_target)); |
| 2147 | - break; |
| 2148 | - } |
| 2149 | - if(scomData & SBE_BOOT_SELECT_MASK) |
| 2150 | - { |
| 2151 | - o_bootSide = SBE_SEEPROM1; |
| 2152 | - } |
| 2153 | - |
| 2154 | - }while(0); |
| 2155 | - |
| 2156 | - TRACFCOMP( g_trac_pnor, |
| 2157 | - EXIT_MRK"PNOR::getSbeBootSeeprom(): o_bootSide=0x%X (reg=0x%X)", |
| 2158 | - o_bootSide, scomData ); |
| 2159 | - |
| 2160 | - return err; |
| 2161 | -} |
| 2162 | - |
| 2163 | -} // end namespace |
| 2164 | \ No newline at end of file |
| 2165 | diff --git a/src/usr/pnor/pnorvalid.C b/src/usr/pnor/pnorvalid.C |
| 2166 | index 46204ca..1bc09a2 100644 |
| 2167 | --- a/src/usr/pnor/pnorvalid.C |
| 2168 | +++ b/src/usr/pnor/pnorvalid.C |
| 2169 | @@ -102,7 +102,7 @@ errlHndl_t validateAltMaster( void ) |
| 2170 | // When reading PNOR TOC assume a single page and no ECC |
| 2171 | uint8_t* tocBuffer = new uint8_t[PAGESIZE]; |
| 2172 | size_t read_size = PAGESIZE; |
| 2173 | - const uint64_t toc0_offset = PnorRP::getInstance().getTocOffset(TOC_0); |
| 2174 | + const uint64_t toc0_offset = PNOR::TOC_0_OFFSET; |
| 2175 | |
| 2176 | do{ |
| 2177 | |
| 2178 | @@ -176,7 +176,8 @@ errlHndl_t validateAltMaster( void ) |
| 2179 | pnordd = new PnorDD(procList[i]); |
| 2180 | |
| 2181 | // Read Flash |
| 2182 | - l_err = pnordd->readFlash(tocBuffer, read_size, toc0_offset); |
| 2183 | + l_err = pnordd->readFlash(tocBuffer, read_size, |
| 2184 | + PNOR::TOC_0_OFFSET); |
| 2185 | if ( l_err ) |
| 2186 | { |
| 2187 | // Commit Error Log, but continue the test |
| 2188 | diff --git a/src/usr/pnor/runtime/rt_pnor.C b/src/usr/pnor/runtime/rt_pnor.C |
| 2189 | index c61aa1d..c43160f 100644 |
| 2190 | --- a/src/usr/pnor/runtime/rt_pnor.C |
| 2191 | +++ b/src/usr/pnor/runtime/rt_pnor.C |
| 2192 | @@ -297,7 +297,7 @@ errlHndl_t RtPnor::flush( PNOR::SectionId i_section) |
| 2193 | } |
| 2194 | /*******Protected Methods**************/ |
| 2195 | RtPnor::RtPnor() |
| 2196 | -:iv_TOC_used(PNOR::TOC_0) |
| 2197 | +:iv_TOC_used(0) |
| 2198 | { |
| 2199 | errlHndl_t l_err = readTOC(); |
| 2200 | if (l_err) |
| 2201 | @@ -588,10 +588,7 @@ errlHndl_t RtPnor::readTOC () |
| 2202 | break; |
| 2203 | } |
| 2204 | |
| 2205 | - // @TODO RTC:120733 |
| 2206 | - // RT code needs a way to get the active side tocs vs just defaulting |
| 2207 | - // to SIDE_A |
| 2208 | - l_err = readFromDevice (l_procId, PNOR::TOC, PNOR::SIDE_A_TOC_0_OFFSET, |
| 2209 | + l_err = readFromDevice (l_procId, PNOR::TOC, PNOR::TOC_0_OFFSET, |
| 2210 | PAGESIZE,false,toc0Buffer); |
| 2211 | if (l_err) |
| 2212 | { |
| 2213 | @@ -599,7 +596,7 @@ errlHndl_t RtPnor::readTOC () |
| 2214 | " for TOC0"); |
| 2215 | break; |
| 2216 | } |
| 2217 | - l_err = readFromDevice (l_procId, PNOR::TOC, PNOR::SIDE_A_TOC_1_OFFSET, |
| 2218 | + l_err = readFromDevice (l_procId, PNOR::TOC, PNOR::TOC_1_OFFSET, |
| 2219 | PAGESIZE, false,toc1Buffer); |
| 2220 | if (l_err) |
| 2221 | { |
| 2222 | @@ -608,7 +605,7 @@ errlHndl_t RtPnor::readTOC () |
| 2223 | break; |
| 2224 | } |
| 2225 | |
| 2226 | - l_err = PNOR::parseTOC(toc0Buffer, toc1Buffer, iv_TOC_used, iv_TOC, 0); |
| 2227 | + l_err = PNOR::parseTOC(toc0Buffer, toc1Buffer, iv_TOC_used, iv_TOC,0); |
| 2228 | if (l_err) |
| 2229 | { |
| 2230 | TRACFCOMP(g_trac_pnor, "RtPnor::readTOC: parseTOC failed"); |
| 2231 | diff --git a/src/usr/pnor/runtime/rt_pnor.H b/src/usr/pnor/runtime/rt_pnor.H |
| 2232 | index f3a03a5..43041fc 100644 |
| 2233 | --- a/src/usr/pnor/runtime/rt_pnor.H |
| 2234 | +++ b/src/usr/pnor/runtime/rt_pnor.H |
| 2235 | @@ -81,7 +81,7 @@ class RtPnor |
| 2236 | /** |
| 2237 | * Which TOC (0 or 1) is used after verifying both. |
| 2238 | */ |
| 2239 | - PNOR::TOCS iv_TOC_used; |
| 2240 | + uint32_t iv_TOC_used; |
| 2241 | |
| 2242 | /** |
| 2243 | * Cached copy of section data |
| 2244 | diff --git a/src/usr/pnor/test/pnorrptest.H b/src/usr/pnor/test/pnorrptest.H |
| 2245 | index 427227b..04ca729 100644 |
| 2246 | --- a/src/usr/pnor/test/pnorrptest.H |
| 2247 | +++ b/src/usr/pnor/test/pnorrptest.H |
| 2248 | @@ -517,30 +517,22 @@ class PnorRpTest : public CxxTest::TestSuite |
| 2249 | uint8_t* corruptBuffer = new uint8_t[PAGESIZE]; |
| 2250 | |
| 2251 | // Corrupt both ffs header and first entry for each TOC |
| 2252 | - for (PNOR::TOCS cur_TOC = PNOR::TOC_0; cur_TOC < PNOR::NUM_TOCS; |
| 2253 | - cur_TOC = (PNOR::TOCS)(cur_TOC+1)) |
| 2254 | + for (uint32_t cur_TOC = 0; cur_TOC < PNOR::NUM_TOCS; ++cur_TOC) |
| 2255 | { |
| 2256 | - PNOR::TOCS TOC_used = cur_TOC; |
| 2257 | + uint32_t TOC_used = cur_TOC; |
| 2258 | |
| 2259 | if (cur_TOC == 0) |
| 2260 | { |
| 2261 | - offset = PnorRP::getInstance().getTocOffset(PNOR::TOC_0); |
| 2262 | + offset = PNOR::TOC_0_OFFSET; |
| 2263 | } |
| 2264 | else |
| 2265 | { |
| 2266 | - offset = PnorRP::getInstance().getTocOffset(PNOR::TOC_1); |
| 2267 | + offset = PNOR::TOC_1_OFFSET; |
| 2268 | } |
| 2269 | |
| 2270 | // Read cur_TOC header data |
| 2271 | - PnorRP::getInstance().readFromDevice( offset, 0, false, |
| 2272 | - tocHeader, fatal_error ); |
| 2273 | - if (fatal_error) |
| 2274 | - { |
| 2275 | - TRACFCOMP(g_trac_pnor, "PnorRpTest::test_TOC> ERROR : Could not read TOC header data at offset 0x%X RC=%X", |
| 2276 | - offset, fatal_error); |
| 2277 | - TS_FAIL("PnorRpTest::test_TOC> ERROR : Could not read TOC header data at offset 0x%X RC=%X", |
| 2278 | - offset, fatal_error); |
| 2279 | - } |
| 2280 | + PnorRP::getInstance().readFromDevice( offset, 0, false, tocHeader, |
| 2281 | + fatal_error ); |
| 2282 | |
| 2283 | // Corrupt cur_TOC header data |
| 2284 | memcpy(corruptBuffer, tocHeader, PAGESIZE); |
| 2285 | @@ -567,13 +559,6 @@ class PnorRpTest : public CxxTest::TestSuite |
| 2286 | PnorRP::getInstance().readFromDevice( offset + FFS_HDR_SIZE, 0, |
| 2287 | false, tocEntry, |
| 2288 | fatal_error ); |
| 2289 | - if (fatal_error) |
| 2290 | - { |
| 2291 | - TRACFCOMP(g_trac_pnor, "PnorRpTest::test_TOC> ERROR : Could not read first TOC entry data at offset 0x%X RC=%X", |
| 2292 | - offset, fatal_error); |
| 2293 | - TS_FAIL("PnorRpTest::test_TOC> ERROR : Could not read first TOC entry data at offset 0x%X RC=%X", |
| 2294 | - offset, fatal_error); |
| 2295 | - } |
| 2296 | |
| 2297 | // Corrupt cur_TOC header data |
| 2298 | memcpy(corruptBuffer, tocEntry, PAGESIZE); |
| 2299 | @@ -606,83 +591,6 @@ class PnorRpTest : public CxxTest::TestSuite |
| 2300 | TRACFCOMP(g_trac_pnor, "PnorRpTest::test_TOC End"); |
| 2301 | } |
| 2302 | |
| 2303 | - /** |
| 2304 | - * @brief PNOR RP test - ReadOnlyTag |
| 2305 | - * Tests if readOnly tag on a section is being processed correctly |
| 2306 | - * |
| 2307 | - */ |
| 2308 | - void test_ReadOnlyTag(void) |
| 2309 | - { |
| 2310 | - TRACFCOMP(g_trac_pnor, "PnorRpTest::test_ReadOnlyTag Start" ); |
| 2311 | - PNOR::SectionInfo_t l_info; |
| 2312 | - errlHndl_t l_errhdl = NULL; |
| 2313 | - uint64_t chip_select = 0xF; |
| 2314 | - bool needs_ecc = false; |
| 2315 | - |
| 2316 | - l_errhdl = PNOR::getSectionInfo(PNOR::TESTRO, l_info); |
| 2317 | - if( l_errhdl ) |
| 2318 | - { |
| 2319 | - TRACFCOMP(g_trac_pnor, "PnorRpTest::test_ReadOnlyTag> ERROR : getSectionInfo returned error for %d : RC=%X", |
| 2320 | - PNOR::TESTRO, l_errhdl->reasonCode()); |
| 2321 | - ERRORLOG::errlCommit(l_errhdl, PNOR_COMP_ID); |
| 2322 | - TS_FAIL( "PnorRpTest::test_ReadOnlyTag> ERROR : could not read pnor section %d", PNOR::TESTRO); |
| 2323 | - } |
| 2324 | - |
| 2325 | - // Write some data |
| 2326 | - const uint64_t l_writeData = 0x1122334455667788; |
| 2327 | - uint64_t* l_dataptr = reinterpret_cast<uint64_t*> (l_info.vaddr); |
| 2328 | - l_dataptr[0] = l_writeData; |
| 2329 | - |
| 2330 | - // Flush the page to make sure it gets out to the device |
| 2331 | - // Due to ReadOnly permissions set on TESTRO should be a no-op |
| 2332 | - int rc = mm_remove_pages( RELEASE, l_dataptr, PAGESIZE ); |
| 2333 | - if( rc ) |
| 2334 | - { |
| 2335 | - TRACFCOMP( g_trac_pnor, "PnorRpTest::test_ReadOnlyTag> ERROR : error on RELEASE : rc=%X", rc ); |
| 2336 | - TS_FAIL( "PnorRpTest::test_ReadOnlyTag> ERROR : error on RELEASE" ); |
| 2337 | - } |
| 2338 | - |
| 2339 | - // Get physical address of pnor section |
| 2340 | - uint64_t l_address = 0; |
| 2341 | - l_errhdl = PnorRP::getInstance().computeDeviceAddr((void*)l_info.vaddr, |
| 2342 | - l_address, |
| 2343 | - chip_select, |
| 2344 | - needs_ecc); |
| 2345 | - if(l_errhdl) |
| 2346 | - { |
| 2347 | - TRACFCOMP(g_trac_pnor, "PnorRpTest::test_ReadOnlyTag> ERROR : computeDeviceAddr vaddr = 0x%X",l_info.vaddr); |
| 2348 | - errlCommit(l_errhdl,PNOR_COMP_ID); |
| 2349 | - TS_FAIL( "PnorRpTest::test_ReadOnlyTag> ERROR : computeDeviceAddr vaddr = 0x%X",l_info.vaddr); |
| 2350 | - } |
| 2351 | - |
| 2352 | - // Read pnor section and check if write did not occur |
| 2353 | - uint64_t l_readData = 0; |
| 2354 | - size_t l_size = sizeof(uint64_t); |
| 2355 | - l_errhdl = deviceRead(TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL, |
| 2356 | - &l_readData, |
| 2357 | - l_size, |
| 2358 | - DEVICE_PNOR_ADDRESS(0, l_address)); |
| 2359 | - TRACFCOMP(g_trac_pnor, "PnorRpTest::test_ReadOnlyTag> Read Data = 0x%X",l_readData); |
| 2360 | - if(l_errhdl) |
| 2361 | - { |
| 2362 | - TS_FAIL("PnorRpTest::test_ReadOnlyTag: deviceRead() failed! Error committed."); |
| 2363 | - ERRORLOG::errlCommit(l_errhdl, PNOR_COMP_ID); |
| 2364 | - } |
| 2365 | - if(l_readData == l_writeData) |
| 2366 | - { |
| 2367 | - TS_FAIL("PnorRpTest::test_ReadOnlyTag: Data was written to readOnly section = %s", |
| 2368 | - l_info.name); |
| 2369 | - } |
| 2370 | - if(l_size != sizeof(uint64_t)) |
| 2371 | - { |
| 2372 | - TS_FAIL("PnorRpTest::test_ReadOnlyTag: deviceRead() Read length not expected value. Addr: 0x%llx, Exp: %d, Act: %d", |
| 2373 | - l_address, sizeof(uint64_t), l_size); |
| 2374 | - } |
| 2375 | - |
| 2376 | - TRACFCOMP(g_trac_pnor, "PnorRpTest::test_ReadOnlyTag End"); |
| 2377 | - } |
| 2378 | - |
| 2379 | - |
| 2380 | //@todo - import config data from build and compare to section info |
| 2381 | |
| 2382 | /** |
| 2383 | diff --git a/src/usr/sbe/sbe_update.C b/src/usr/sbe/sbe_update.C |
| 2384 | index 698d41a..9dd9e0a 100644 |
| 2385 | --- a/src/usr/sbe/sbe_update.C |
| 2386 | +++ b/src/usr/sbe/sbe_update.C |
| 2387 | @@ -1214,6 +1214,49 @@ namespace SBE |
| 2388 | } |
| 2389 | |
| 2390 | ///////////////////////////////////////////////////////////////////// |
| 2391 | + errlHndl_t getSbeBootSeeprom(TARGETING::Target* i_target, |
| 2392 | + sbeSeepromSide_t& o_bootSide) |
| 2393 | + { |
| 2394 | + TRACUCOMP( g_trac_sbe, |
| 2395 | + ENTER_MRK"getSbeBootSeeprom()" ); |
| 2396 | + |
| 2397 | + errlHndl_t err = NULL; |
| 2398 | + uint64_t scomData = 0x0; |
| 2399 | + |
| 2400 | + o_bootSide = SBE_SEEPROM0; |
| 2401 | + |
| 2402 | + do{ |
| 2403 | + |
| 2404 | + size_t op_size = sizeof(scomData); |
| 2405 | + err = deviceRead( i_target, |
| 2406 | + &scomData, |
| 2407 | + op_size, |
| 2408 | + DEVICE_SCOM_ADDRESS(SBE_VITAL_REG_0x0005001C) ); |
| 2409 | + if( err ) |
| 2410 | + { |
| 2411 | + TRACFCOMP( g_trac_sbe, ERR_MRK"getSbeBootSeeprom() -Error " |
| 2412 | + "reading SBE VITAL REG (0x%.8X) from Target :" |
| 2413 | + "HUID=0x%.8X", |
| 2414 | + SBE_VITAL_REG_0x0005001C, |
| 2415 | + TARGETING::get_huid(i_target)); |
| 2416 | + break; |
| 2417 | + } |
| 2418 | + if(scomData & SBE_BOOT_SELECT_MASK) |
| 2419 | + { |
| 2420 | + o_bootSide = SBE_SEEPROM1; |
| 2421 | + } |
| 2422 | + |
| 2423 | + }while(0); |
| 2424 | + |
| 2425 | + TRACUCOMP( g_trac_sbe, |
| 2426 | + EXIT_MRK"getSbeBootSeeprom(): o_bootSide=0x%X (reg=0x%X)", |
| 2427 | + o_bootSide, scomData ); |
| 2428 | + |
| 2429 | + return err; |
| 2430 | + } |
| 2431 | + |
| 2432 | + |
| 2433 | +///////////////////////////////////////////////////////////////////// |
| 2434 | errlHndl_t getSbeInfoState(sbeTargetState_t& io_sbeState) |
| 2435 | { |
| 2436 | |
| 2437 | @@ -1308,11 +1351,11 @@ namespace SBE |
| 2438 | if(SEEPROM_0_PERMANENT_VALUE == |
| 2439 | (io_sbeState.mvpdSbKeyword.flags & PERMANENT_FLAG_MASK)) |
| 2440 | { |
| 2441 | - io_sbeState.permanent_seeprom_side = PNOR::SBE_SEEPROM0; |
| 2442 | + io_sbeState.permanent_seeprom_side = SBE_SEEPROM0; |
| 2443 | } |
| 2444 | else // Side 1 must be permanent |
| 2445 | { |
| 2446 | - io_sbeState.permanent_seeprom_side = PNOR::SBE_SEEPROM1; |
| 2447 | + io_sbeState.permanent_seeprom_side = SBE_SEEPROM1; |
| 2448 | } |
| 2449 | |
| 2450 | |
| 2451 | @@ -1361,21 +1404,21 @@ namespace SBE |
| 2452 | /* Determine which SEEPROM System Booted On */ |
| 2453 | /***********************************************/ |
| 2454 | //Get Current (boot) Side |
| 2455 | - PNOR::sbeSeepromSide_t tmp_cur_side = PNOR::SBE_SEEPROM_INVALID; |
| 2456 | - err = PNOR::getSbeBootSeeprom(io_sbeState.target, tmp_cur_side); |
| 2457 | + sbeSeepromSide_t tmp_cur_side = SBE_SEEPROM_INVALID; |
| 2458 | + err = getSbeBootSeeprom(io_sbeState.target, tmp_cur_side); |
| 2459 | if(err) |
| 2460 | { |
| 2461 | TRACFCOMP( g_trac_sbe, ERR_MRK"getSbeInfoState() - Error returned from getSbeBootSeeprom()"); |
| 2462 | break; |
| 2463 | } |
| 2464 | io_sbeState.cur_seeprom_side = tmp_cur_side; |
| 2465 | - if (io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM0) |
| 2466 | + if (io_sbeState.cur_seeprom_side == SBE_SEEPROM0) |
| 2467 | { |
| 2468 | - io_sbeState.alt_seeprom_side = PNOR::SBE_SEEPROM1; |
| 2469 | + io_sbeState.alt_seeprom_side = SBE_SEEPROM1; |
| 2470 | } |
| 2471 | - else if ( io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM1) |
| 2472 | + else if ( io_sbeState.cur_seeprom_side == SBE_SEEPROM1) |
| 2473 | { |
| 2474 | - io_sbeState.alt_seeprom_side = PNOR::SBE_SEEPROM0; |
| 2475 | + io_sbeState.alt_seeprom_side = SBE_SEEPROM0; |
| 2476 | } |
| 2477 | else |
| 2478 | { |
| 2479 | @@ -2012,7 +2055,7 @@ namespace SBE |
| 2480 | /* Determine what side to update */ |
| 2481 | /**************************************************************/ |
| 2482 | // Set cur and alt isDirty values |
| 2483 | - if( io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM0 ) |
| 2484 | + if( io_sbeState.cur_seeprom_side == SBE_SEEPROM0 ) |
| 2485 | { |
| 2486 | current_side_isDirty = seeprom_0_isDirty; |
| 2487 | alt_side_isDirty = seeprom_1_isDirty; |
| 2488 | @@ -2179,14 +2222,14 @@ namespace SBE |
| 2489 | io_sbeState.seeprom_side_to_update = EEPROM::SBE_PRIMARY; |
| 2490 | |
| 2491 | // Update MVPD PERMANENT flag: make cur=perm |
| 2492 | - ( io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM0 ) ? |
| 2493 | + ( io_sbeState.cur_seeprom_side == SBE_SEEPROM0 ) ? |
| 2494 | // clear bit 0 |
| 2495 | io_sbeState.mvpdSbKeyword.flags &= ~PERMANENT_FLAG_MASK |
| 2496 | : //set bit 0 |
| 2497 | io_sbeState.mvpdSbKeyword.flags |= PERMANENT_FLAG_MASK; |
| 2498 | |
| 2499 | // Update MVPD RE-IPL SEEPROM flag: re-IPL on ALT: |
| 2500 | - ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ? |
| 2501 | + ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) ? |
| 2502 | // clear bit 1 |
| 2503 | io_sbeState.mvpdSbKeyword.flags &= ~REIPL_SEEPROM_MASK |
| 2504 | : //set bit 1 |
| 2505 | @@ -2252,18 +2295,18 @@ namespace SBE |
| 2506 | |
| 2507 | // Set Update side to alt |
| 2508 | io_sbeState.seeprom_side_to_update = |
| 2509 | - ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) |
| 2510 | + ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) |
| 2511 | ? EEPROM::SBE_PRIMARY : EEPROM::SBE_BACKUP ; |
| 2512 | |
| 2513 | // Update MVPD PERMANENT flag: make cur=perm |
| 2514 | - ( io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM0 ) ? |
| 2515 | + ( io_sbeState.cur_seeprom_side == SBE_SEEPROM0 ) ? |
| 2516 | // clear bit 0 |
| 2517 | io_sbeState.mvpdSbKeyword.flags &= ~PERMANENT_FLAG_MASK |
| 2518 | : //set bit 0 |
| 2519 | io_sbeState.mvpdSbKeyword.flags |= PERMANENT_FLAG_MASK; |
| 2520 | |
| 2521 | // Update MVPD RE-IPL SEEPROM flag: re-IPL on ALT: |
| 2522 | - ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ? |
| 2523 | + ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) ? |
| 2524 | // clear bit 1 |
| 2525 | io_sbeState.mvpdSbKeyword.flags &= ~REIPL_SEEPROM_MASK |
| 2526 | : //set bit 1 |
| 2527 | @@ -2298,13 +2341,13 @@ namespace SBE |
| 2528 | |
| 2529 | // Set Update side to alt |
| 2530 | io_sbeState.seeprom_side_to_update = |
| 2531 | - ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) |
| 2532 | + ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) |
| 2533 | ? EEPROM::SBE_PRIMARY : EEPROM::SBE_BACKUP ; |
| 2534 | |
| 2535 | |
| 2536 | // MVPD flag Update |
| 2537 | // Update MVPD flag make cur=perm |
| 2538 | - ( io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM0 ) ? |
| 2539 | + ( io_sbeState.cur_seeprom_side == SBE_SEEPROM0 ) ? |
| 2540 | // clear bit 0 |
| 2541 | io_sbeState.mvpdSbKeyword.flags &= ~PERMANENT_FLAG_MASK |
| 2542 | : // set bit 0 |
| 2543 | @@ -2358,11 +2401,11 @@ namespace SBE |
| 2544 | |
| 2545 | // Set Update side to alt |
| 2546 | io_sbeState.seeprom_side_to_update = |
| 2547 | - ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) |
| 2548 | + ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) |
| 2549 | ? EEPROM::SBE_PRIMARY : EEPROM::SBE_BACKUP ; |
| 2550 | |
| 2551 | // Update MVPD RE-IPL SEEPROM flag: re-IPL on ALT: |
| 2552 | - ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ? |
| 2553 | + ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) ? |
| 2554 | // clear bit 1 |
| 2555 | io_sbeState.mvpdSbKeyword.flags &= ~REIPL_SEEPROM_MASK |
| 2556 | : // set bit 1 |
| 2557 | @@ -2373,7 +2416,7 @@ namespace SBE |
| 2558 | if ( g_istep_mode ) |
| 2559 | { |
| 2560 | // Update MVPD PERMANENT flag: make alt=perm |
| 2561 | - (io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ? |
| 2562 | + (io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) ? |
| 2563 | // clear bit 0 |
| 2564 | io_sbeState.mvpdSbKeyword.flags &= ~PERMANENT_FLAG_MASK |
| 2565 | : //set bit 0 |
| 2566 | @@ -2455,11 +2498,11 @@ namespace SBE |
| 2567 | |
| 2568 | // Set Update side to alt |
| 2569 | io_sbeState.seeprom_side_to_update = |
| 2570 | - ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) |
| 2571 | + ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) |
| 2572 | ? EEPROM::SBE_PRIMARY : EEPROM::SBE_BACKUP ; |
| 2573 | |
| 2574 | // Update MVPD RE-IPL SEEPROM flag: re-IPL on ALT: |
| 2575 | - ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ? |
| 2576 | + ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) ? |
| 2577 | // clear bit 1 |
| 2578 | io_sbeState.mvpdSbKeyword.flags &= ~REIPL_SEEPROM_MASK |
| 2579 | : // set bit 1 |
| 2580 | @@ -2491,7 +2534,7 @@ namespace SBE |
| 2581 | |
| 2582 | // Set Update side to alt |
| 2583 | io_sbeState.seeprom_side_to_update = |
| 2584 | - ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) |
| 2585 | + ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) |
| 2586 | ? EEPROM::SBE_PRIMARY : EEPROM::SBE_BACKUP ; |
| 2587 | |
| 2588 | TRACFCOMP( g_trac_sbe, INFO_MRK"SBE Update tgt=0x%X: " |
| 2589 | @@ -3201,12 +3244,12 @@ namespace SBE |
| 2590 | |
| 2591 | // Compare against 'current' Master side in case there is |
| 2592 | // an issue with the other side |
| 2593 | - if (io_sbeStates_v[i].cur_seeprom_side == PNOR::SBE_SEEPROM0) |
| 2594 | + if (io_sbeStates_v[i].cur_seeprom_side == SBE_SEEPROM0) |
| 2595 | { |
| 2596 | ver_ptr = |
| 2597 | &(io_sbeStates_v[i].seeprom_0_ver.image_version); |
| 2598 | } |
| 2599 | - else // PNOR::SBE_SEEPROM1 |
| 2600 | + else // SBE_SEEPROM1 |
| 2601 | { |
| 2602 | ver_ptr = |
| 2603 | &(io_sbeStates_v[i].seeprom_1_ver.image_version); |
| 2604 | @@ -3346,12 +3389,12 @@ namespace SBE |
| 2605 | else |
| 2606 | { |
| 2607 | // Not Master, so get 'current' version |
| 2608 | - if (io_sbeStates_v[i].cur_seeprom_side == PNOR::SBE_SEEPROM0) |
| 2609 | + if (io_sbeStates_v[i].cur_seeprom_side == SBE_SEEPROM0) |
| 2610 | { |
| 2611 | ver_ptr = |
| 2612 | &(io_sbeStates_v[i].seeprom_0_ver.image_version); |
| 2613 | } |
| 2614 | - else // PNOR::SBE_SEEPROM1 |
| 2615 | + else // SBE_SEEPROM1 |
| 2616 | { |
| 2617 | ver_ptr = |
| 2618 | &(io_sbeStates_v[i].seeprom_1_ver.image_version); |
| 2619 | diff --git a/src/usr/sbe/sbe_update.H b/src/usr/sbe/sbe_update.H |
| 2620 | index e49c582..aa880b2 100644 |
| 2621 | --- a/src/usr/sbe/sbe_update.H |
| 2622 | +++ b/src/usr/sbe/sbe_update.H |
| 2623 | @@ -5,9 +5,7 @@ |
| 2624 | /* */ |
| 2625 | /* OpenPOWER HostBoot Project */ |
| 2626 | /* */ |
| 2627 | -/* Contributors Listed Below - COPYRIGHT 2013,2015 */ |
| 2628 | -/* [+] International Business Machines Corp. */ |
| 2629 | -/* */ |
| 2630 | +/* COPYRIGHT International Business Machines Corp. 2013,2014 */ |
| 2631 | /* */ |
| 2632 | /* Licensed under the Apache License, Version 2.0 (the "License"); */ |
| 2633 | /* you may not use this file except in compliance with the License. */ |
| 2634 | @@ -55,6 +53,10 @@ namespace SBE |
| 2635 | const uint64_t SBE_IMAGE_SEEPROM_ADDRESS = 0x400; // 1KB |
| 2636 | const uint64_t SBE_VERSION_SEEPROM_ADDRESS = 0x300; // 1KB - 256B |
| 2637 | |
| 2638 | + //Used to read SBE Boot Side from processor |
| 2639 | + const uint64_t SBE_VITAL_REG_0x0005001C = 0x005001C; |
| 2640 | + const uint64_t SBE_BOOT_SELECT_MASK = 0x0080000000000000; |
| 2641 | + |
| 2642 | // PNOR SBE and SBEC Partition constants |
| 2643 | const uint32_t MAX_SBE_ENTRIES = 9; |
| 2644 | const uint32_t SBETOC_EYECATCH = 0x53424500; //'SBE\0' |
| 2645 | @@ -104,6 +106,14 @@ namespace SBE |
| 2646 | MVPDOP_WRITE, // Write version data to MVPD |
| 2647 | }; |
| 2648 | |
| 2649 | + // Used to keep track of perm/temp, and cur/alt |
| 2650 | + enum sbeSeepromSide_t |
| 2651 | + { |
| 2652 | + SBE_SEEPROM0 = 0x00, // corresponds to EEPROM::SBE_PRIMARY |
| 2653 | + SBE_SEEPROM1 = 0x01, // corresponts to EEPROM::SBE_BACKUP |
| 2654 | + SBE_SEEPROM_INVALID = 0xFF, |
| 2655 | + }; |
| 2656 | + |
| 2657 | // Actions can be combined |
| 2658 | enum sbeUpdateActions_t |
| 2659 | { |
| 2660 | @@ -117,6 +127,7 @@ namespace SBE |
| 2661 | UNSUPPORTED_SITUATION = 0x80000000, |
| 2662 | }; |
| 2663 | |
| 2664 | + |
| 2665 | /******************************************/ |
| 2666 | /* Structs */ |
| 2667 | /******************************************/ |
| 2668 | @@ -196,9 +207,9 @@ namespace SBE |
| 2669 | bool seeprom_0_ver_ECC_fail; |
| 2670 | bool seeprom_1_ver_ECC_fail; |
| 2671 | |
| 2672 | - PNOR::sbeSeepromSide_t cur_seeprom_side; // aka 'booted' side |
| 2673 | - PNOR::sbeSeepromSide_t alt_seeprom_side; |
| 2674 | - PNOR::sbeSeepromSide_t permanent_seeprom_side; |
| 2675 | + sbeSeepromSide_t cur_seeprom_side; // aka 'booted' side |
| 2676 | + sbeSeepromSide_t alt_seeprom_side; |
| 2677 | + sbeSeepromSide_t permanent_seeprom_side; |
| 2678 | |
| 2679 | // Customized Image Information for this Target |
| 2680 | size_t customizedImage_size; |
| 2681 | @@ -318,6 +329,21 @@ namespace SBE |
| 2682 | void* io_imgPtr, |
| 2683 | size_t& o_actImgSize); |
| 2684 | |
| 2685 | + |
| 2686 | + /** |
| 2687 | + * @brief Determines which Seeprom was used to boot the SBE |
| 2688 | + * |
| 2689 | + * @param[in] i_target Target processor to customize |
| 2690 | + * |
| 2691 | + * @param[out] o_bootSide The Seeprom the SBE booted from |
| 2692 | + * |
| 2693 | + * @return errlHndl_t Error log handle on failure. |
| 2694 | + */ |
| 2695 | + |
| 2696 | + errlHndl_t getSbeBootSeeprom(TARGETING::Target* i_target, |
| 2697 | + sbeSeepromSide_t& o_bootSide); |
| 2698 | + |
| 2699 | + |
| 2700 | /** |
| 2701 | * @brief Collects Version information from a specific SEEPROM |
| 2702 | * |
| 2703 | diff --git a/src/usr/sbe/test/sbeupdatetest.H b/src/usr/sbe/test/sbeupdatetest.H |
| 2704 | index 5e25706..d235141 100644 |
| 2705 | --- a/src/usr/sbe/test/sbeupdatetest.H |
| 2706 | +++ b/src/usr/sbe/test/sbeupdatetest.H |
| 2707 | @@ -580,7 +580,7 @@ class SBEUpdateTest: public CxxTest::TestSuite |
| 2708 | { |
| 2709 | // Inputs |
| 2710 | uint8_t i_situation; |
| 2711 | - PNOR::sbeSeepromSide_t i_cur; // current_seeprom_side |
| 2712 | + sbeSeepromSide_t i_cur; // current_seeprom_side |
| 2713 | uint8_t i_flags; // mvpdSbKeyword.flags |
| 2714 | |
| 2715 | // Expected Output |
| 2716 | @@ -596,7 +596,7 @@ class SBEUpdateTest: public CxxTest::TestSuite |
| 2717 | // - update alt=1 |
| 2718 | // - make cur=perm |
| 2719 | // - re-IPL |
| 2720 | - { 0xE0, PNOR::SBE_SEEPROM0, 0x80, |
| 2721 | + { 0xE0, SBE_SEEPROM0, 0x80, |
| 2722 | static_cast<sbeUpdateActions_t> |
| 2723 | (DO_UPDATE|IPL_RESTART|UPDATE_MVPD|UPDATE_SBE), |
| 2724 | EEPROM::SBE_BACKUP, 0x40 }, |
| 2725 | @@ -606,7 +606,7 @@ class SBEUpdateTest: public CxxTest::TestSuite |
| 2726 | // - update alt=0 |
| 2727 | // - make cur=perm |
| 2728 | // - re-IPL |
| 2729 | - { 0xC0, PNOR::SBE_SEEPROM1, 0x00, |
| 2730 | + { 0xC0, SBE_SEEPROM1, 0x00, |
| 2731 | static_cast<sbeUpdateActions_t> |
| 2732 | (DO_UPDATE|IPL_RESTART|UPDATE_MVPD|UPDATE_SBE), |
| 2733 | EEPROM::SBE_PRIMARY, 0x80 }, |
| 2734 | @@ -616,7 +616,7 @@ class SBEUpdateTest: public CxxTest::TestSuite |
| 2735 | // - update alt=0 |
| 2736 | // - make cur=perm |
| 2737 | // - Continue IPL |
| 2738 | - { 0xA0, PNOR::SBE_SEEPROM1, 0x00, |
| 2739 | + { 0xA0, SBE_SEEPROM1, 0x00, |
| 2740 | static_cast<sbeUpdateActions_t> |
| 2741 | (DO_UPDATE|UPDATE_MVPD|UPDATE_SBE), |
| 2742 | EEPROM::SBE_PRIMARY, 0x80 }, |
| 2743 | @@ -625,7 +625,7 @@ class SBEUpdateTest: public CxxTest::TestSuite |
| 2744 | // Arbitrarily set cur side to 1 (therefore perm set to 0) |
| 2745 | // - No updates |
| 2746 | // - Continue IPL |
| 2747 | - { 0x80, PNOR::SBE_SEEPROM1, 0x00, |
| 2748 | + { 0x80, SBE_SEEPROM1, 0x00, |
| 2749 | static_cast<sbeUpdateActions_t>(CLEAR_ACTIONS), |
| 2750 | EEPROM::LAST_CHIP_TYPE, 0x00 }, |
| 2751 | |
| 2752 | @@ -633,7 +633,7 @@ class SBEUpdateTest: public CxxTest::TestSuite |
| 2753 | // Arbitrarily set cur side to 0 (therefore perm set to 0) |
| 2754 | // - update alt=1 |
| 2755 | // - re-IPL |
| 2756 | - { 0x60, PNOR::SBE_SEEPROM0, 0x00, |
| 2757 | + { 0x60, SBE_SEEPROM0, 0x00, |
| 2758 | static_cast<sbeUpdateActions_t> |
| 2759 | (DO_UPDATE|IPL_RESTART|UPDATE_MVPD|UPDATE_SBE), |
| 2760 | EEPROM::SBE_BACKUP, 0x40 }, |
| 2761 | @@ -644,14 +644,14 @@ class SBEUpdateTest: public CxxTest::TestSuite |
| 2762 | // Arbitrarily set cur side to 1 (therefore perm set to 1) |
| 2763 | // - update alt=0 |
| 2764 | // - re-IPL |
| 2765 | - { 0x40, PNOR::SBE_SEEPROM1, 0x80, |
| 2766 | + { 0x40, SBE_SEEPROM1, 0x80, |
| 2767 | static_cast<sbeUpdateActions_t> |
| 2768 | (DO_UPDATE|IPL_RESTART|UPDATE_MVPD|UPDATE_SBE), |
| 2769 | EEPROM::SBE_PRIMARY, 0x80 }, |
| 2770 | |
| 2771 | // Repeat previous case to make sure global variables are used |
| 2772 | // correctly to save MBOX value |
| 2773 | - { 0x40, PNOR::SBE_SEEPROM1, 0x80, |
| 2774 | + { 0x40, SBE_SEEPROM1, 0x80, |
| 2775 | static_cast<sbeUpdateActions_t> |
| 2776 | (DO_UPDATE|IPL_RESTART|UPDATE_MVPD|UPDATE_SBE), |
| 2777 | EEPROM::SBE_PRIMARY, 0x80 }, |
| 2778 | @@ -660,7 +660,7 @@ class SBEUpdateTest: public CxxTest::TestSuite |
| 2779 | // Arbitrarily set cur side to 0 (therefore perm set to 0) |
| 2780 | // - update alt=1 |
| 2781 | // - Continue IPL |
| 2782 | - { 0x20, PNOR::SBE_SEEPROM0, 0x00, |
| 2783 | + { 0x20, SBE_SEEPROM0, 0x00, |
| 2784 | static_cast<sbeUpdateActions_t>(DO_UPDATE|UPDATE_SBE), |
| 2785 | EEPROM::SBE_BACKUP, 0x00 }, |
| 2786 | |
| 2787 | @@ -670,7 +670,7 @@ class SBEUpdateTest: public CxxTest::TestSuite |
| 2788 | // - Continue IPL |
| 2789 | // NOTE: this will test that right-most-bit is ignored: |
| 2790 | // so techincally case 0x01, which should be = case 0x00 |
| 2791 | - { 0x01, PNOR::SBE_SEEPROM0, 0x00, |
| 2792 | + { 0x01, SBE_SEEPROM0, 0x00, |
| 2793 | static_cast<sbeUpdateActions_t>(CLEAR_ACTIONS), |
| 2794 | EEPROM::LAST_CHIP_TYPE, 0x00 }, |
| 2795 | #endif // SBE_UPDATE_SEQUENTIAL |
| 2796 | @@ -708,8 +708,8 @@ class SBEUpdateTest: public CxxTest::TestSuite |
| 2797 | sbeState.cur_seeprom_side = testData[i].i_cur; |
| 2798 | |
| 2799 | sbeState.alt_seeprom_side = |
| 2800 | - ( ( testData[i].i_cur == PNOR::SBE_SEEPROM0 ) |
| 2801 | - ? PNOR::SBE_SEEPROM1 : PNOR::SBE_SEEPROM0 ); |
| 2802 | + ( ( testData[i].i_cur == SBE_SEEPROM0 ) |
| 2803 | + ? SBE_SEEPROM1 : SBE_SEEPROM0 ); |
| 2804 | |
| 2805 | sbeState.mvpdSbKeyword.flags = testData[i].i_flags; |
| 2806 | |
| 2807 | -- |
| 2808 | 1.8.2.2 |
| 2809 | |