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