From b0bf18528f97ecef49ff27fd4715b2d2a50ad5ba Mon Sep 17 00:00:00 2001 From: crgeddes Date: Tue, 26 Jul 2016 11:40:30 -0500 Subject: Update Bootloader to handle moving the TOC of PNOR around Moved 1 of the PNOR TOCs from 0x8000 to TOP_OF_FLASH - 64KB. Updated bootloader and pnor access code to handle new toc location. Update the defaultPnorLayout to reflect these changes Also added a FSP default pnor xml that will generate a 128 MB image for FSP boxes to use. RTC: 154286 Change-Id: I0253590299ff9714b0d5ab12a02ac9d653b115fa Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/27461 Tested-by: Jenkins Server Reviewed-by: Martin Gloff Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell Reviewed-by: Andrew J. Geissler Reviewed-by: Andres A. Lugo-Reyes Reviewed-by: William G. Hoffa --- src/bootloader/bl_pnorAccess.C | 32 +++-- src/bootloader/bootloader.C | 16 ++- src/build/buildpnor/buildpnor.pl | 143 ++++++++++++---------- src/build/buildpnor/defaultPnorLayout.xml | 59 +++++---- src/build/buildpnor/pnorLayoutFSP.xml | 197 ++++++++++++++++++++++++++++++ src/build/mkrules/dist.targets.mk | 1 + src/build/simics/standalone.simics | 11 +- src/include/bootloader/bl_pnorAccess.H | 23 ++-- src/include/usr/pnor/pnor_const.H | 2 + src/usr/pnor/pnor_utils.H | 1 - 10 files changed, 361 insertions(+), 124 deletions(-) create mode 100644 src/build/buildpnor/pnorLayoutFSP.xml diff --git a/src/bootloader/bl_pnorAccess.C b/src/bootloader/bl_pnorAccess.C index 046a4bf0a..991011872 100644 --- a/src/bootloader/bl_pnorAccess.C +++ b/src/bootloader/bl_pnorAccess.C @@ -40,9 +40,10 @@ extern const char* cv_EYECATCHER[]; also returns a SectionData_t struct if the toc was valid */ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE], - uint32_t & o_errCode, + uint32_t& o_errCode, PNOR::SectionData_t * o_TOC, - uint64_t i_baseAddr) + uint64_t& o_pnorStart, + uint64_t i_pnorEnd) { do { @@ -57,6 +58,10 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE], //make sure that the buffer is not null PNOR::checkForNullBuffer(i_tocBuffer, o_errCode, l_ffs_hdr); + //Subtract the size of the pnor from the end address to find the start + o_pnorStart = i_pnorEnd - + (l_ffs_hdr->block_size * l_ffs_hdr->block_count) + 1; + if(o_errCode != PNOR::NO_ERROR) { BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_READTOC_CHKNULLBUFFER_NULL); @@ -109,8 +114,9 @@ void bl_pnorAccess::readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE], } while(0); } -void bl_pnorAccess::findTOC(uint64_t i_pnorBase, PNOR::SectionData_t * o_TOC, - uint32_t& o_errCode, uint8_t& o_tocUsed) +void bl_pnorAccess::findTOC(uint64_t i_pnorEnd, PNOR::SectionData_t * o_TOC, + uint32_t& o_errCode, uint8_t& o_tocUsed, + uint64_t& o_pnorStart) { uint8_t *l_tocBuffer = Bootloader::g_blScratchSpace; do @@ -119,14 +125,15 @@ void bl_pnorAccess::findTOC(uint64_t i_pnorBase, PNOR::SectionData_t * o_TOC, o_errCode = 0; o_tocUsed = 0; //Copy Table of Contents from PNOR flash to a local buffer - Bootloader::handleMMIO(i_pnorBase, + //The first TOC is 2 TOC sizes back from the end of the flash (+ 1) + Bootloader::handleMMIO(i_pnorEnd - PNOR::TOC_OFFSET_FROM_TOP_OF_FLASH, reinterpret_cast(l_tocBuffer), (PNOR::TOC_SIZE), Bootloader::BYTESIZE); BOOTLOADER_TRACE(BTLDR_TRC_PA_FINDTOC_TOC1_HANDLEMMIO_RTN); - readTOC(l_tocBuffer, o_errCode, o_TOC, i_pnorBase); + readTOC(l_tocBuffer, o_errCode, o_TOC, o_pnorStart, i_pnorEnd); if(o_errCode == PNOR::NO_ERROR) { @@ -136,13 +143,14 @@ void bl_pnorAccess::findTOC(uint64_t i_pnorBase, PNOR::SectionData_t * o_TOC, } else { - Bootloader::handleMMIO(i_pnorBase + PNOR::BACKUP_TOC_OFFSET, + //If the first toc was invalid, look for the backup in the start + Bootloader::handleMMIO(o_pnorStart, reinterpret_cast(l_tocBuffer), (PNOR::TOC_SIZE), Bootloader::BYTESIZE); o_errCode = 0; - readTOC(l_tocBuffer, o_errCode, o_TOC, i_pnorBase); + readTOC(l_tocBuffer, o_errCode, o_TOC, o_pnorStart, i_pnorEnd); if(o_errCode == PNOR::NO_ERROR) { o_tocUsed = 1; @@ -158,17 +166,19 @@ void bl_pnorAccess::findTOC(uint64_t i_pnorBase, PNOR::SectionData_t * o_TOC, /** * @brief Get the hostboot base image */ -void bl_pnorAccess::getHBBSection(uint64_t i_pnorStart, +void bl_pnorAccess::getHBBSection(uint64_t i_pnorEnd, PNOR::SectionData_t& o_hbbSection, uint32_t& o_errCode, - uint8_t& o_tocUsed) + uint8_t& o_tocUsed, + uint64_t& o_pnorStart) { BOOTLOADER_TRACE(BTLDR_TRC_PA_GETHBBSECTION_START); do { PNOR::SectionData_t l_TOC[PNOR::NUM_SECTIONS]; - findTOC(i_pnorStart, l_TOC, o_errCode, o_tocUsed); + findTOC(i_pnorEnd, l_TOC, o_errCode, o_tocUsed, o_pnorStart); + if(o_errCode != PNOR::NO_ERROR) { BOOTLOADER_TRACE_W_BRK(BTLDR_TRC_PA_GETHBBSECTION_FINDTOC_ERR); diff --git a/src/bootloader/bootloader.C b/src/bootloader/bootloader.C index 0158f211a..ec9b12c4a 100644 --- a/src/bootloader/bootloader.C +++ b/src/bootloader/bootloader.C @@ -76,17 +76,25 @@ namespace Bootloader{ // Set variables needed for getting location of HB base code // @TODO RTC:138268 Support multiple sides of PNOR in bootloader - uint64_t l_pnorStart = LPC::LPC_PHYS_BASE + LPC::LPCHC_FW_SPACE - + PNOR::LPC_SFC_MMIO_OFFSET; + + //pnorEnd is the end of flash, which is base of lpc, plus + //the offset of the FW space, plus the TOP memory address in FW space + uint64_t l_pnorEnd = LPC::LPC_PHYS_BASE + LPC::LPCHC_FW_SPACE + + PNOR::LPC_TOP_OF_FLASH_OFFSET; + + //We dont know what the start of pnor is because we dont know the size + uint64_t l_pnorStart = 0; + uint32_t l_errCode = PNOR::NO_ERROR; uint8_t l_tocUsed = 0; // Get location of HB base code in PNOR from TOC // @TODO RTC:138268 Support multiple sides of PNOR in bootloader - bl_pnorAccess::getHBBSection(l_pnorStart, + bl_pnorAccess::getHBBSection(l_pnorEnd, bootloader_hbbSection, l_errCode, - l_tocUsed); + l_tocUsed, + l_pnorStart); BOOTLOADER_TRACE(BTLDR_TRC_MAIN_GETHBBSECTION_RTN ); if(PNOR::NO_ERROR == l_errCode) diff --git a/src/build/buildpnor/buildpnor.pl b/src/build/buildpnor/buildpnor.pl index 25f6f1959..a3693396c 100755 --- a/src/build/buildpnor/buildpnor.pl +++ b/src/build/buildpnor/buildpnor.pl @@ -201,70 +201,22 @@ sub loadPnorLayout #parse the input XML file my $xs = new XML::Simple(keyattr=>[], forcearray => 1); my $xml = $xs->XMLin($i_pnorFile); - - #Iterate over the
elements. - foreach my $sectionEl (@{$xml->{section}}) - { - my $description = $sectionEl->{description}[0]; - my $eyeCatch = $sectionEl->{eyeCatch}[0]; - my $physicalOffset = $sectionEl->{physicalOffset}[0]; - my $physicalRegionSize = $sectionEl->{physicalRegionSize}[0]; - my $side = $sectionEl->{side}[0]; - my $testonly = $sectionEl->{testonly}[0]; - my $ecc = (exists $sectionEl->{ecc} ? "yes" : "no"); - my $sha512Version = (exists $sectionEl->{sha512Version} ? "yes" : "no"); - my $sha512perEC = (exists $sectionEl->{sha512perEC} ? "yes" : "no"); - my $preserved = (exists $sectionEl->{preserved} ? "yes" : "no"); - my $readOnly = (exists $sectionEl->{readOnly} ? "yes" : "no"); - if (($testRun == 0) && ($sectionEl->{testonly}[0] eq "yes")) - { - next; - } - - trace(3, "$this_func: description = $description, eyeCatch=$eyeCatch, physicalOffset = $physicalOffset, physicalRegionSize=$physicalRegionSize, side=$side"); - - $physicalOffset = getNumber($physicalOffset); - $physicalRegionSize = getNumber($physicalRegionSize); - - $$i_pnorLayoutRef{sections}{$physicalOffset}{description} = $description; - $$i_pnorLayoutRef{sections}{$physicalOffset}{eyeCatch} = $eyeCatch; - $$i_pnorLayoutRef{sections}{$physicalOffset}{physicalOffset} = $physicalOffset; - $$i_pnorLayoutRef{sections}{$physicalOffset}{physicalRegionSize} = $physicalRegionSize; - $$i_pnorLayoutRef{sections}{$physicalOffset}{side} = $side; - $$i_pnorLayoutRef{sections}{$physicalOffset}{ecc} = $ecc; - $$i_pnorLayoutRef{sections}{$physicalOffset}{sha512Version} = $sha512Version; - $$i_pnorLayoutRef{sections}{$physicalOffset}{sha512perEC} = $sha512perEC; - $$i_pnorLayoutRef{sections}{$physicalOffset}{preserved} = $preserved; - $$i_pnorLayoutRef{sections}{$physicalOffset}{readOnly} = $readOnly; - - #store the physical offsets of each section in a hash, so, it is easy - #to search physicalOffsets based on the name of the section (eyecatch) - if ($side eq "sideless") - { - foreach my $metadata (@{$xml->{metadata}}) - { - foreach my $sides (@{$metadata->{side}}) - { - $$i_physicalOffsets{side}{$sides->{id}[0]}{eyecatch}{$eyeCatch} = $physicalOffset; - } - } - } - else - { - $$i_physicalOffsets{side}{$side}{eyecatch}{$eyeCatch} = $physicalOffset; - } - } + my $imageSize = 0; + my $chipSize = 0; # Save the metadata - imageSize, blockSize, toc Information etc. foreach my $metadataEl (@{$xml->{metadata}}) { # Get meta data - my $imageSize = $metadataEl->{imageSize}[0]; + $imageSize = $metadataEl->{imageSize}[0]; + $chipSize = $metadataEl->{chipSize}[0]; my $blockSize = $metadataEl->{blockSize}[0]; my $tocSize = $metadataEl->{tocSize}[0]; my $arrangement = $metadataEl->{arrangement}[0]; + $chipSize = getNumber($chipSize); $imageSize = getNumber($imageSize); $blockSize = getNumber($blockSize); $tocSize = getNumber($tocSize); + $$i_pnorLayoutRef{metadata}{chipSize} = $chipSize; $$i_pnorLayoutRef{metadata}{imageSize} = $imageSize; $$i_pnorLayoutRef{metadata}{blockSize} = $blockSize; $$i_pnorLayoutRef{metadata}{tocSize} = $tocSize; @@ -280,7 +232,8 @@ sub loadPnorLayout # #Arrangement A-B-D means that the layout had Primary TOC (A), then backup TOC (B), then Data (pnor section information). #Similaryly, arrangement A-D-B means that primary toc is followed by the data (section information) and then - #the backup TOC. + #the backup TOC. In order for the parsing tools to find the TOC, the TOCs must be at TOP_OF_FLASH-(2) * TOC_SIZE + # and the other at 0x0 of flash memory. if ($arrangement eq "A-B-D") { my $count = 0; @@ -301,18 +254,22 @@ sub loadPnorLayout } elsif ($arrangement eq "A-D-B") { + my $count = 0; foreach my $side (@{$metadataEl->{side}}) { my $golden = (exists $side->{golden} ? "yes" : "no"); my $sideId = $side->{id}[0]; - my $hbbAddr = $$i_physicalOffsets{side}{$sideId}{eyecatch}{"HBB"}; - my $primaryTOC = align_down($hbbAddr, $sideSize); - my $backupTOC = align_up($hbbAddr, $sideSize) - $tocSize; + + #Leave 1 block sized pad because the top addr of flash special + # and simics broke we had the toc touching it + my $primaryTOC = ($sideSize)*($count + 1) - ($tocSize + $blockSize) ; + my $backupTOC = ($sideSize)*($count); $$i_pnorLayoutRef{metadata}{sides}{$sideId}{toc}{primary} = $primaryTOC; $$i_pnorLayoutRef{metadata}{sides}{$sideId}{toc}{backup} = $backupTOC; $$i_pnorLayoutRef{metadata}{sides}{$sideId}{golden} = $golden; - trace(1, "A-D-B: side:$sideId HBB:$hbbAddr, primaryTOC:$primaryTOC, backupTOC:$backupTOC, golden: $golden"); + $count = $count + 1; + trace(1, "A-D-B: side:$sideId, primaryTOC:$primaryTOC, backupTOC:$backupTOC, golden: $golden"); } } else @@ -320,6 +277,65 @@ sub loadPnorLayout trace(0, "Arrangement:$arrangement is not supported"); exit(1); } + + #Iterate over the
elements. + foreach my $sectionEl (@{$xml->{section}}) + { + my $description = $sectionEl->{description}[0]; + my $eyeCatch = $sectionEl->{eyeCatch}[0]; + my $physicalOffset = $sectionEl->{physicalOffset}[0]; + my $physicalRegionSize = $sectionEl->{physicalRegionSize}[0]; + my $side = $sectionEl->{side}[0]; + my $testonly = $sectionEl->{testonly}[0]; + my $ecc = (exists $sectionEl->{ecc} ? "yes" : "no"); + my $sha512Version = (exists $sectionEl->{sha512Version} ? "yes" : "no"); + my $sha512perEC = (exists $sectionEl->{sha512perEC} ? "yes" : "no"); + my $preserved = (exists $sectionEl->{preserved} ? "yes" : "no"); + my $readOnly = (exists $sectionEl->{readOnly} ? "yes" : "no"); + if (($testRun == 0) && ($sectionEl->{testonly}[0] eq "yes")) + { + next; + } + + trace(3, "$this_func: description = $description, eyeCatch=$eyeCatch, physicalOffset = $physicalOffset, physicalRegionSize=$physicalRegionSize, side=$side"); + + $physicalOffset = getNumber($physicalOffset); + $physicalRegionSize = getNumber($physicalRegionSize); + + if($physicalRegionSize + $physicalOffset > $imageSize) + { + die "ERROR: $this_func: Image size ($imageSize) smaller than $eyeCatch's offset + $eyeCatch's size (".($physicalOffset + $physicalRegionSize)."). Aborting! "; + } + + $$i_pnorLayoutRef{sections}{$physicalOffset}{description} = $description; + $$i_pnorLayoutRef{sections}{$physicalOffset}{eyeCatch} = $eyeCatch; + $$i_pnorLayoutRef{sections}{$physicalOffset}{physicalOffset} = $physicalOffset; + $$i_pnorLayoutRef{sections}{$physicalOffset}{physicalRegionSize} = $physicalRegionSize; + $$i_pnorLayoutRef{sections}{$physicalOffset}{side} = $side; + $$i_pnorLayoutRef{sections}{$physicalOffset}{ecc} = $ecc; + $$i_pnorLayoutRef{sections}{$physicalOffset}{sha512Version} = $sha512Version; + $$i_pnorLayoutRef{sections}{$physicalOffset}{sha512perEC} = $sha512perEC; + $$i_pnorLayoutRef{sections}{$physicalOffset}{preserved} = $preserved; + $$i_pnorLayoutRef{sections}{$physicalOffset}{readOnly} = $readOnly; + + #store the physical offsets of each section in a hash, so, it is easy + #to search physicalOffsets based on the name of the section (eyecatch) + if ($side eq "sideless") + { + foreach my $metadata (@{$xml->{metadata}}) + { + foreach my $sides (@{$metadata->{side}}) + { + $$i_physicalOffsets{side}{$sides->{id}[0]}{eyecatch}{$eyeCatch} = $physicalOffset; + } + } + } + else + { + $$i_physicalOffsets{side}{$side}{eyecatch}{$eyeCatch} = $physicalOffset; + } + } + } return 0; } @@ -339,6 +355,7 @@ sub createPnorImg my $blockSize = $$i_pnorLayoutRef{metadata}{blockSize}; #Get size of image in blocks + my $chipSize = $$i_pnorLayoutRef{metadata}{chipSize}; my $imageSize = $$i_pnorLayoutRef{metadata}{imageSize}; my $blockCount = $imageSize/$blockSize; if ($blockCount != int($blockCount)) @@ -347,8 +364,8 @@ sub createPnorImg } #f{fs,part} --create tuleta.pnor --partition-offset 0 --size 8MiB --block 4KiB --force - trace(2, "$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --create --size $imageSize --block $blockSize --force"); - system("$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --create --size $imageSize --block $blockSize --force"); + trace(2, "$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --create --size $chipSize --block $blockSize --force"); + system("$g_fpartCmd --target $i_pnorBinName --partition-offset $i_offset --create --size $chipSize --block $blockSize --force"); die "ERROR: $this_func: Call to creating image failed. Aborting!" if($?); } @@ -735,6 +752,8 @@ sub fillPnorImage my $key; my $other_side = getOtherSide($side); + my $imageSize = $$i_pnorLayoutRef{metadata}{imageSize}; + trace(1, "fillPnorImage:: $offset"); #key is the physical offset into the file, however don't need to sort #since FFS allows populating partitions in any order @@ -769,7 +788,7 @@ sub fillPnorImage } trace(5, "$this_func: populating section $sideInfo:$eyeCatch, filename=$inputFile"); #fcp --target tuleta.pnor --partition-offset 0 --name HBI --write hostboot_extended.bin - system("$g_fcpCmd $inputFile $i_pnorBinName:$eyeCatch --offset $offset --write --buffer 0x40000000"); + system("$g_fcpCmd $inputFile $i_pnorBinName:$eyeCatch --offset $offset --write --buffer $imageSize"); die "ERROR: $this_func: Call to fcp adding data to partition $eyeCatch failed. Aborting!" if($?); } } diff --git a/src/build/buildpnor/defaultPnorLayout.xml b/src/build/buildpnor/defaultPnorLayout.xml index ccc84fece..04c347ff1 100644 --- a/src/build/buildpnor/defaultPnorLayout.xml +++ b/src/build/buildpnor/defaultPnorLayout.xml @@ -25,6 +25,7 @@ - 0x0 - 0x8000 - A-B-D + 0x3FF0000 + 0x0 + A-D-B B +
+ Hostboot Base (576K) + HBB + 0x8000 + 0x90000 + + sideless + +
Hostboot Error Logs (144K) HBEL - 0x10000 + 0x98000 0x24000 sideless @@ -87,7 +98,7 @@ Layout Description
Guard Data (20K) GUARD - 0x58000 + 0xBC000 0x5000 sideless @@ -95,7 +106,7 @@ Layout Description
Hostboot Data (1.125M) HBD - 0x5D000 + 0xC1000 0x120000 sideless @@ -105,7 +116,7 @@ Layout Description DIMM JEDEC (288K) DJVPD - 0x17D000 + 0x1E1000 0x48000 sideless @@ -114,7 +125,7 @@ Layout Description Module VPD (576K) MVPD - 0x1C5000 + 0x229000 0x90000 sideless @@ -123,7 +134,7 @@ Layout Description Centaur VPD (288K) CVPD - 0x255000 + 0x2B9000 0x48000 sideless @@ -131,7 +142,7 @@ Layout Description
Hostboot Extended image (11MB w/o ECC) HBI - 0x29D000 + 0x301000 0xC60000 sideless @@ -151,7 +162,7 @@ Layout Description
SBE-IPL (Staging Area) (288K) SBE - 0xEFD000 + 0xF61000 0x48000 sideless @@ -160,7 +171,7 @@ Layout Description
HCODE Ref Image (1.125MB) HCODE - 0xF45000 + 0xFA9000 0x120000 sideless @@ -169,7 +180,7 @@ Layout Description
Hostboot Runtime Services for Sapphire (4.5MB) HBRT - 0x1065000 + 0x10C9000 0x480000 sideless @@ -178,7 +189,7 @@ Layout Description
Payload (21.375MB) PAYLOAD - 0x14E5000 + 0x1549000 0x1560000 sideless @@ -186,7 +197,7 @@ Layout Description
Special PNOR Test Space (36K) TEST - 0x2A45000 + 0x2AA9000 0x9000 sideless @@ -195,7 +206,7 @@ Layout Description
Special PNOR Test Space (36K) TESTRO - 0x2A4E000 + 0x2AB2000 0x9000 sideless @@ -206,27 +217,15 @@ Layout Description
Hostboot Bootloader (22.5K) HBBL - 0x2A57000 + 0x2ABB000 0x6000 sideless
-
- Hostboot Base (576K) - - - HBB - 0x3F67000 - 0x90000 - - sideless - -
Global Data (36K) GLOBAL - 0x3FF7000 + 0x2AC1000 0x9000 sideless diff --git a/src/build/buildpnor/pnorLayoutFSP.xml b/src/build/buildpnor/pnorLayoutFSP.xml new file mode 100644 index 000000000..35a0195ab --- /dev/null +++ b/src/build/buildpnor/pnorLayoutFSP.xml @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0x4000000 + 0x8000000 + 0x1000 + 0x8000 + + 0x3FF0000 + 0x0 + A-D-B + + B + + +
+ Hostboot Base (576K) + HBB + 0x8000 + 0x90000 + + sideless + +
+
+ Hostboot Error Logs (144K) + HBEL + 0x98000 + 0x24000 + sideless + +
+
+ Guard Data (20K) + GUARD + 0xBC000 + 0x5000 + sideless + +
+
+ Hostboot Data (1.125M) + HBD + 0xC1000 + 0x120000 + + sideless + +
+
+ DIMM JEDEC (288K) + DJVPD + + 0x1E1000 + 0x48000 + sideless + +
+
+ Module VPD (576K) + MVPD + + 0x229000 + 0x90000 + sideless + +
+
+ Centaur VPD (288K) + CVPD + + 0x2B9000 + 0x48000 + sideless + +
+
+ Hostboot Extended image (22MB w/o ECC) + HBI + 0x301000 + 0x18C0000 + + sideless + +
+ +
+ SBE-IPL (Staging Area) (288K) + SBE + 0x1BC1000 + 0x48000 + + sideless + +
+
+ HCODE Ref Image (1.125MB) + HCODE + 0x1C09000 + 0x120000 + + sideless + +
+
+ Hostboot Bootloader (22.5K) + HBBL + 0x1D29000 + 0x6000 + sideless + +
+
+ Global Data (36K) + GLOBAL + 0x1D2F000 + 0x9000 + sideless + +
+
diff --git a/src/build/mkrules/dist.targets.mk b/src/build/mkrules/dist.targets.mk index dcceefa9c..d20157027 100644 --- a/src/build/mkrules/dist.targets.mk +++ b/src/build/mkrules/dist.targets.mk @@ -209,6 +209,7 @@ fsp.tar_CONTENTS = \ src/build/buildpnor/buildSbePart.pl \ src/build/buildpnor/buildpnor.pl \ src/build/buildpnor/defaultPnorLayout.xml \ + src/build/buildpnor/pnorLayoutFSP.xml \ $(if $(FAKEPNOR), src/build/buildpnor/pnorLayoutFake.xml, ) \ $(if $(FAKEPNOR), img/vbu_NIMBUS_targeting.bin, ) \ $(if $(FAKEPNOR), img/vpo_sysmvpd.dat, ) \ diff --git a/src/build/simics/standalone.simics b/src/build/simics/standalone.simics index 5f4da19f7..4e39a1dc6 100755 --- a/src/build/simics/standalone.simics +++ b/src/build/simics/standalone.simics @@ -12,16 +12,11 @@ } try { run-python-file (lookup-file hbfw/hb-pnor-vpd-preload.py) - ($hb_pnor).sfc_master_mem.load-file ./sysmvpd.dat.ecc 0x1C5000 - ($hb_pnor).sfc_master_mem.load-file ./sysspd.dat.ecc 0x17D000 - ($hb_pnor).sfc_master_mem.load-file ./sysmemvpd.dat.ecc 0x255000 + ($hb_pnor).sfc_master_mem.load-file ./sysmvpd.dat.ecc 0x229000 + ($hb_pnor).sfc_master_mem.load-file ./sysspd.dat.ecc 0x1E1000 + ($hb_pnor).sfc_master_mem.load-file ./sysmemvpd.dat.ecc 0x2B9000 } except { echo "ERROR: Failed to preload VPD into PNOR." } -#Write the PNOR MMIO addr into Scratch 2, 0x283A -($hb_masterproc).proc_lbus_map.write 0x28e8 0xFFF78000 #HB PNOR addr -foreach $cc in (get-object-list p9_proc) { - ($cc).proc_lbus_map.write 0x28e8 0xFFF78000 -} # Loop through every processor chip foreach $cc in (get-object-list p9_proc) { diff --git a/src/include/bootloader/bl_pnorAccess.H b/src/include/bootloader/bl_pnorAccess.H index bc19a4dc2..237900b0d 100644 --- a/src/include/bootloader/bl_pnorAccess.H +++ b/src/include/bootloader/bl_pnorAccess.H @@ -49,7 +49,7 @@ class bl_pnorAccess /** * @brief Get the hostboot base image * - * @param[in] i_pnorStart MMIO address to access the start of pnor flash + * @param[in] i_pnorEnd MMIO address to access the end of pnor flash * * @param[out] o_hbbSection Struct that holds information about the * Hostboot Base Image Section @@ -58,12 +58,15 @@ class bl_pnorAccess * * @param[out] o_tocUsed Tells you which table of contents was used * + * @param[out] o_pnorStart The MMIO address of the start of PNOR + * * @return void */ -static void getHBBSection(uint64_t i_pnorStart, +static void getHBBSection(uint64_t i_pnorEnd, PNOR::SectionData_t& o_hbbSection, uint32_t& o_errCode, - uint8_t& o_tocUsed); + uint8_t& o_tocUsed, + uint64_t& o_pnorStart); private: /** @@ -75,18 +78,20 @@ static void getHBBSection(uint64_t i_pnorStart, * * @param[out] o_TOC Array of section data describing contents of pnor * - * @param[in] i_baseAddr MMIO address to access the start of pnor flash + * @param[out] o_pnorStart The MMIO address of the start of PNOR + * + * @param[out] i_pnorEnd The MMIO address of the end of PNOR * * @return void */ static void readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE], uint32_t & o_errCode, - PNOR::SectionData_t * o_TOC, uint64_t i_baseAddr); + PNOR::SectionData_t * o_TOC, uint64_t& o_pnorStart, uint64_t i_pnorEnd); /** * @brief Find a valid TOC within specified side of pnor flash side is determined by the base mmio address passed in * - * @param[in] i_pnorBase MMIO address to access the start of pnor flash + * @param[in] i_pnorEnd MMIO address to access the end of pnor flash * * @param[out] o_TOC Array of section data describing contents of pnor * @@ -94,10 +99,12 @@ static void readTOC(uint8_t i_tocBuffer[PNOR::TOC_SIZE], uint32_t & o_errCode, * * @param[out] o_tocUsed Tells you which table of contents was used * + * @param[out] o_pnorStart The MMIO address of the start of PNOR + * * @return void */ -static void findTOC(uint64_t i_pnorBase, PNOR::SectionData_t * o_TOC, - uint32_t& o_errCode, uint8_t& o_tocUsed); +static void findTOC(uint64_t i_pnorEnd, PNOR::SectionData_t * o_TOC, + uint32_t& o_errCode, uint8_t& o_tocUsed, uint64_t& o_pnorStart); }; diff --git a/src/include/usr/pnor/pnor_const.H b/src/include/usr/pnor/pnor_const.H index a7ca2c3b0..2d0d90f51 100644 --- a/src/include/usr/pnor/pnor_const.H +++ b/src/include/usr/pnor/pnor_const.H @@ -107,6 +107,8 @@ enum { INVALID_OFFSET = 0xFFFFFFF, // Invalid primary or alternate TOC BACKUP_TOC_OFFSET = 0x8000, + TOC_SIZE = 0x8000, + TOC_OFFSET_FROM_TOP_OF_FLASH = 0x8FFF, INVALID_FLASH_OFFSET = 0xFFFFFFFF, }; diff --git a/src/usr/pnor/pnor_utils.H b/src/usr/pnor/pnor_utils.H index b314336ae..ed0f7176b 100644 --- a/src/usr/pnor/pnor_utils.H +++ b/src/usr/pnor/pnor_utils.H @@ -54,7 +54,6 @@ enum /** Real number of bytes required to read 1 logical page */ PAGESIZE_PLUS_ECC = ((PAGESIZE * 9)/8), // 8B data + 1B of ECC SUPPORTED_FFS_VERSION = 0x1, /**< Supported FFS Version */ - TOC_SIZE = 0x8000, }; -- cgit v1.2.1