summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.mk2
-rw-r--r--img/.gitignore1
-rwxr-xr-xsrc/build/buildpnor/buildpnor.pl691
-rw-r--r--src/build/buildpnor/makefile58
-rw-r--r--src/build/buildpnor/pnorLayout.xml66
-rw-r--r--src/build/makefile2
-rwxr-xr-xsrc/build/simics/post_model_hook.simics7
-rw-r--r--src/build/tocgen/makefile20
-rwxr-xr-xsrc/build/tocgen/mkpnortoc.pl347
-rw-r--r--src/build/tocgen/pnortoc.xml156
-rwxr-xr-xsrc/build/tools/cpfiles.pl41
-rw-r--r--src/include/usr/pnor/pnorif.H24
-rw-r--r--src/makefile5
-rw-r--r--src/usr/pnor/pnordd.C4
-rw-r--r--src/usr/pnor/pnordd.H2
-rw-r--r--src/usr/pnor/pnorrp.C58
-rw-r--r--src/usr/pnor/pnorrp.H3
-rw-r--r--src/usr/pnor/test/pnorddtest.H4
-rw-r--r--src/usr/pnor/test/pnorrptest.H28
19 files changed, 918 insertions, 601 deletions
diff --git a/config.mk b/config.mk
index 9f46a3274..109980f68 100644
--- a/config.mk
+++ b/config.mk
@@ -333,7 +333,7 @@ ${IMGDIR}/hbotStringFile : ${IMAGES}
code_pass: ${OBJECTS} ${SUBDIRS} ${LIBRARIES} ${EXTRA_LIDS_} ${EXTRA_PARTS}
ifdef IMAGES
- ${MAKE} ${IMAGES} ${IMAGE_EXTRAS}
+ ${MAKE} ${IMAGES} ${IMAGE_EXTRAS} ${IMAGE_EXTRA_TARGETS}
endif
gen_pass:
diff --git a/img/.gitignore b/img/.gitignore
index 1b3ba7d32..476e0915d 100644
--- a/img/.gitignore
+++ b/img/.gitignore
@@ -14,3 +14,4 @@ hbotStringFile
errlparser
*.csv
dimmspd.dat
+*.pnor
diff --git a/src/build/buildpnor/buildpnor.pl b/src/build/buildpnor/buildpnor.pl
new file mode 100755
index 000000000..9e00ab1db
--- /dev/null
+++ b/src/build/buildpnor/buildpnor.pl
@@ -0,0 +1,691 @@
+#!/usr/bin/perl
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/buildpnor/buildpnor.pl $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2012
+#
+# p1
+#
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
+#
+# The source code for this program is not published or other-
+# wise divested of its trade secrets, irrespective of what has
+# been deposited with the U.S. Copyright Office.
+#
+# Origin: 30
+#
+# IBM_PROLOG_END
+
+#Builds a PNOR image based on pnorLayout XML file.
+#See usage function at bottom of file for details on how to use this script
+
+#Limitations to address later
+# number fields must be 4 or 8 bytes
+# numbers cannot be over 32 bits
+
+
+use strict;
+use XML::Simple;
+use Data::Dumper;
+use File::Basename;
+
+################################################################################
+# Set PREFERRED_PARSER to XML::Parser. Otherwise it uses XML::SAX which contains
+# bugs that result in XML parse errors that can be fixed by adjusting white-
+# space (i.e. parse errors that do not make sense).
+################################################################################
+$XML::Simple::PREFERRED_PARSER = 'XML::Parser';
+
+my $TRAC_ERR = 0;
+# 0=errors, >0 for more traces, leaving at 1 to keep key milestone traces.
+my $g_trace = 1;
+
+my $programName = File::Basename::basename $0;
+my %tocLayout;
+my %pnorLayout;
+my %binFiles;
+
+
+my $pnorLayoutFile;
+my $pnorBinName = "";
+my $tocVersion = 0x12345;
+my $genTocFlag = 0;
+
+
+if ($#ARGV < 0) {
+ usage();
+ exit;
+}
+
+#Parse the commandline args
+for (my $i=0; $i < $#ARGV + 1; $i++)
+{
+ if ($ARGV[$i] =~ /-h/) {
+ usage();
+ exit 0;
+ }
+ elsif($ARGV[$i] =~ /--tocVersion/) {
+ $tocVersion = getNumber($ARGV[++$i]);
+ trace(2, "TOC Version to use=".sprintf("0x%x", $tocVersion));
+ }
+ elsif($ARGV[$i] =~ /--pnorLayout/) {
+ $pnorLayoutFile = $ARGV[++$i];
+ trace(2, "PNOR Layout XML File=$pnorLayoutFile");
+ }
+ elsif($ARGV[$i] =~ /--pnorOutBin/) {
+ $pnorBinName = $ARGV[++$i];
+ trace(2, "PNOR Binary File=$pnorBinName");
+ }
+ elsif($ARGV[$i] =~ /--genToc/) {
+ $genTocFlag = 1;
+ trace(2, "genTocFlag Set");
+ }
+ elsif($ARGV[$i] =~ /--binFile/) {
+ my $argName = $ARGV[$i];
+ my $argVal = $ARGV[++$i];
+ saveInputFile("--binFile", $argName, $argVal, \%binFiles);
+ }
+ else {
+ traceErr("Unrecognized Input: $ARGV[$i]");
+ exit 1;
+ #Error!!
+ }
+}
+
+
+#Load PNOR Layout XML file
+my $rc = loadPnorLayout($pnorLayoutFile, \%pnorLayout);
+if($rc != 0)
+{
+ exit 1;
+}
+
+#trace(1, Dumper(%pnorLayout->{1576960}));
+#trace(1, Dumper(%binFiles));
+
+#Verify all the section files exist
+my $rc = verifyFilesExist($genTocFlag, \%pnorLayout, \%binFiles);
+if($rc != 0)
+{
+ exit 1;
+}
+
+#Perform any data integrity manipulation (ECC, shaw-hash, etc)
+$rc = robustifyImgs(\%pnorLayout, \%binFiles);
+if($rc != 0)
+{
+ exit 1;
+}
+
+#collect Actual image sizes
+$rc = collectActSizes(\%pnorLayout, \%binFiles);
+if($rc != 0)
+{
+ exit 1;
+}
+
+#Generate TOC if requested.
+if ($genTocFlag != 0)
+{
+ $rc = fillTocActSize($tocVersion, \%pnorLayout);
+ if($rc != 0)
+ {
+ exit 1;
+ }
+
+ if(exists($binFiles{TOC}))
+ {
+ $rc = genToc($tocVersion, $binFiles{TOC}, \%pnorLayout);
+ if($rc != 0)
+ {
+ exit 1;
+ }
+ }
+ else
+ {
+ trace(0, "No TOC Binary file name provided. Aborting!");
+ exit 1;
+ }
+}
+
+
+$rc = checkSpaceConstraints(\%pnorLayout, \%binFiles);
+if($rc != 0)
+{
+ exit 1;
+}
+
+$rc = assemblePnorImage($pnorBinName, \%pnorLayout, \%binFiles);
+if($rc != 0)
+{
+ exit 1;
+}
+
+exit 0;
+
+################################################################################
+# loadPnorLayout
+################################################################################
+sub loadPnorLayout
+{
+ my ($i_pnorFile, $i_pnorLayoutRef) = @_;
+ my $this_func = (caller(0))[3];
+
+ unless(-e $i_pnorFile)
+ {
+ traceErr("$this_func: File not found: $i_pnorFile");
+ return -1;
+ }
+
+ #parse the input XML file
+ my $xs = new XML::Simple(keyattr=>[], forcearray => 1);
+ my $xml = $xs->XMLin($i_pnorFile);
+
+ #trace(1, "pnorLayoutXML \n ".Dumper($xml));
+
+ #Iterate over the <section> elements.
+ foreach my $sectionEl (@{$xml->{section}})
+ {
+ #trace(1, "current Element: \n ".Dumper($sectionEl));
+ my $description = $sectionEl->{description}[0];
+ my $eyeCatch = $sectionEl->{eyeCatch}[0];
+ my $physicalOffset = $sectionEl->{physicalOffset}[0];
+ my $physicalRegionSize = $sectionEl->{physicalRegionSize}[0];
+ my $ecc = $sectionEl->{ecc}[0];
+ my $source = $sectionEl->{source}[0];
+
+ my $actualRegionSize = 0;
+ if(exists($sectionEl->{actualRegionSize}[0]))
+ {
+ $actualRegionSize = $sectionEl->{actualRegionSize}[0];
+ $actualRegionSize = getNumber($actualRegionSize);
+ }
+
+ trace(3, "$this_func: description = $description, eyeCatch=$eyeCatch, physicalOffset = $physicalOffset, physicalRegionSize=$physicalRegionSize, ecc=$ecc, source=$source, actualRegionSize=$actualRegionSize");
+
+ $physicalOffset = getNumber($physicalOffset);
+ $physicalRegionSize = getNumber($physicalRegionSize);
+
+ # trace(4, "$this_func: physicalOffset=$physicalOffset, physicalRegionSize=$physicalRegionSize");
+
+ %{$i_pnorLayoutRef}->{$physicalOffset}{description}=$description;
+ %{$i_pnorLayoutRef}->{$physicalOffset}{eyeCatch}=$eyeCatch;
+ %{$i_pnorLayoutRef}->{$physicalOffset}{physicalOffset}=$physicalOffset;
+ %{$i_pnorLayoutRef}->{$physicalOffset}{physicalRegionSize}=$physicalRegionSize;
+ %{$i_pnorLayoutRef}->{$physicalOffset}{actualRegionSize}=$actualRegionSize;
+ %{$i_pnorLayoutRef}->{$physicalOffset}{ecc}=$ecc;
+ %{$i_pnorLayoutRef}->{$physicalOffset}{source}=$source;
+
+ }
+
+ return 0;
+}
+
+################################################################################
+# genToc - generate Table of Contents image based on input data.
+################################################################################
+sub genToc
+{
+ my ($i_tocVersion, $i_tocBinName, $i_pnorLayoutRef) = @_;
+ my $this_func = (caller(0))[3];
+ my $key;
+ my $FILEHANDLE;
+ trace(4, "$this_func: >>Enter");
+
+ #open output file
+ open( $FILEHANDLE, ">:raw", $i_tocBinName) or die "Can't open $i_tocBinName file for writing";
+
+ #Write version to toc Binary
+ print $FILEHANDLE pack('N', 0);
+ print $FILEHANDLE pack('N', $i_tocVersion);
+
+ #key is the physical offset of section. Need to sort the keys
+ #so we put things in the correct order in toc.
+ #This is important so pnorrp can easily find the length of the TOC section.
+ #Generally speaking, this loop is populating the TOC with records based on the
+ #section data specified in the XML + actual sizes of the input binary files.
+ for $key ( sort {$a<=> $b} keys %{$i_pnorLayoutRef})
+ {
+ #trace(1, Dumper(%{$i_pnorLayoutRef}->{$key}));
+ # print eyecatcher
+ if(exists(%{$i_pnorLayoutRef}->{$key}{eyeCatch}))
+ {
+ my $char;
+ my @charArray = unpack("C*", %{$i_pnorLayoutRef}->{$key}{eyeCatch});
+ foreach $char (@charArray)
+ {
+ print $FILEHANDLE pack('C', $char);
+ }
+ #pad out to get 8 bytes
+ my $zeroPad = 8-length(%{$i_pnorLayoutRef}->{$key}{eyeCatch});
+ insertPadBytes($FILEHANDLE, $zeroPad);
+ }
+ else
+ {
+ insertPadBytes($FILEHANDLE, 8);
+ }
+
+ #print physical offset
+ if(exists(%{$i_pnorLayoutRef}->{$key}{physicalOffset}))
+ {
+ my $val = %{$i_pnorLayoutRef}->{$key}{physicalOffset};
+ #pad first 32 bits
+ print $FILEHANDLE pack('N', 0);
+ #verify number consumes less than 32 bits
+ if($val > 0xFFFFFFFF)
+ {
+ trace(0, "value=".$val.". This is greater than 32 bits in hex and not currently supported!. \n Aborting program");
+ exit 1;
+ }
+
+ print $FILEHANDLE pack('N', $val);
+
+ }
+ else
+ {
+ insertPadBytes($FILEHANDLE, 8);
+ }
+
+ #print physical size
+ if(exists(%{$i_pnorLayoutRef}->{$key}{physicalRegionSize}))
+ {
+ my $val = %{$i_pnorLayoutRef}->{$key}{physicalRegionSize};
+ #pad first 32 bits
+ print $FILEHANDLE pack('N', 0);
+ #verify number consumes less than 32 bits
+ if($val > 0xFFFFFFFF)
+ {
+ trace(0, "value=".$val.". This is greater than 32 bits in hex and not currently supported!. \n Aborting program");
+ exit 1;
+ }
+
+ print $FILEHANDLE pack('N', $val);
+
+ }
+ else
+ {
+ insertPadBytes($FILEHANDLE, 8);
+ }
+
+ #print actual size
+ if(exists(%{$i_pnorLayoutRef}->{$key}{actualRegionSize}))
+ {
+ my $val = %{$i_pnorLayoutRef}->{$key}{actualRegionSize};
+ #pad first 32 bits
+ print $FILEHANDLE pack('N', 0);
+ #verify number consumes less than 32 bits
+ if($val > 0xFFFFFFFF)
+ {
+ trace(0, "value=".$val.". This is greater than 32 bits in hex and not currently supported!. \n Aborting program");
+ exit 1;
+ }
+
+ print $FILEHANDLE pack('N', $val);
+ }
+ else
+ {
+ insertPadBytes($FILEHANDLE, 8);
+ }
+
+ #pad Miscellaneous information (8 bytes)
+ insertPadBytes($FILEHANDLE, 8);
+
+ #Pad Free space in TOC entry
+ insertPadBytes($FILEHANDLE, 88);
+ }
+ return 0;
+}
+
+################################################################################
+# fillTocActSize - Fill in the toc actual size record based on number of PNOR records
+################################################################################
+sub fillTocActSize
+{
+ #Note: tocVersion is passed in because the toc Layout version could influence the
+ #rules regarding how the size is calculated.
+ my($i_tocVersion, $i_pnorLayoutRef) = @_;
+ my $this_func = (caller(0))[3];
+ my $rc = 0;
+ my $tocRecordSize = 128;
+
+ my $recordCount = scalar keys %{$i_pnorLayoutRef};
+ my $size = ($recordCount*$tocRecordSize);
+
+ if(%{$i_pnorLayoutRef}->{0}{ecc} =~ "yes")
+ {
+ $size=$size*(9/8);
+ }
+
+ trace(2, "$this_func: PNOR TOC Size=$size");
+
+ #Assume TOC is always at address zero for now since it's currently true by design
+ %{$i_pnorLayoutRef}->{0}{actualRegionSize}=$size;
+
+
+ return $rc;
+}
+
+################################################################################
+# robustifyImgs - Perform any ECC or ShawHash manipulations
+################################################################################
+sub robustifyImgs
+{
+ my ($i_pnorLayout, $i_binFiles) = @_;
+ my $this_func = (caller(0))[3];
+
+ #@TODO: ECC Correction
+ #@TODO: maybe a little SHA hashing?
+
+ return 0;
+}
+
+################################################################################
+# collectActSizes - walk through all the images and set their actual sizes in the layout
+################################################################################
+sub collectActSizes
+{
+ my ($i_pnorLayout, $i_binFiles) = @_;
+ my $this_func = (caller(0))[3];
+ my $key;
+ my $rc = 0;
+
+ for $key ( keys %{$i_binFiles})
+ {
+ my $filesize = -s $$i_binFiles{$key};
+ trace(10, "$this_func: $$i_binFiles{$key} size = $filesize");
+
+ my $layoutKey = findLayoutKeyByEyeCatch($key, \%$i_pnorLayout);
+ if( $layoutKey == -1)
+ {
+ $rc = 1;
+ last;
+ }
+
+ $$i_pnorLayout{$layoutKey}{actualRegionSize} = $filesize;
+
+ trace(2, "$this_func: $$i_binFiles{$key} size = $$i_pnorLayout{$layoutKey}{actualRegionSize}");
+
+ }
+
+ return $rc;
+}
+
+################################################################################
+# findLayoutKeyByEyeCatch - Figure out hash key based on eyeCatcher
+################################################################################
+sub findLayoutKeyByEyeCatch
+{
+ my $layoutKey = -1;
+ my($eyeCatch, $i_pnorLayout) = @_;
+ my $key;
+
+ for $key (keys %{$i_pnorLayout})
+ {
+ if($$i_pnorLayout{$key}{eyeCatch} =~ $eyeCatch)
+ {
+ $layoutKey = $key;
+ last;
+ }
+
+ }
+
+ return $layoutKey;
+}
+
+################################################################################
+# verifyFilesExist - Verify all the input files exist, and there are files
+# provided for each PNOR section
+################################################################################
+sub verifyFilesExist
+{
+ my ($i_genToc, $i_pnorLayout, $i_binFiles) = @_;
+ my $this_func = (caller(0))[3];
+ my $key;
+ my $rc = 0;
+
+ for $key ( keys %$i_binFiles)
+ {
+
+ #Don't check if toc file exists if we're going to generate it
+ if(($key =~ "TOC") && ($i_genToc != 0))
+ {
+ next;
+ }
+ unless(-e $$i_binFiles{$key})
+ {
+ my $inputFile = $$i_binFiles{$key};
+ trace(0, "Specified input file ($inputFile) for key ($key) does not exist. Aborting!");
+ $rc = 1;
+ }
+ else
+ {
+ trace(10, "$this_func: $$i_binFiles{$key} exists");
+ }
+ }
+
+ #Verify there is an input file for each section of PNOR
+ for $key ( keys %$i_pnorLayout)
+ {
+ my $eyeCatch = $$i_pnorLayout{$key}{eyeCatch};
+
+ #Don't check if toc file exists if we're going to generate it
+ if(($eyeCatch =~ "TOC") && ($i_genToc != 0))
+ {
+ next;
+ }
+ #Ignore sections that are marked as blank
+ elsif($$i_pnorLayout{$key}{source} =~ "Blank")
+ {
+ next;
+ }
+ #check if binFiles list has a file for eyeCatcher
+ unless(exists($$i_binFiles{$eyeCatch}))
+ {
+ my $inputFile = $$i_binFiles{$eyeCatch};
+ trace(0, "Input file not provided for PNOR section with eyeCatcher=$eyeCatch. Aborting!");
+ $rc = 1;
+ }
+ else
+ {
+ trace(10, "$this_func: $$i_binFiles{$key} exists");
+ }
+ }
+
+ return $rc;
+}
+
+################################################################################
+# checkSpaceConstraints - Make sure provided files will fit in their sections
+################################################################################
+sub checkSpaceConstraints
+{
+ my ($i_pnorLayout, $i_binFiles) = @_;
+ my $rc = 0;
+ my $this_func = (caller(0))[3];
+ my $key;
+
+ #Verify there is an input file for each section of PNOR
+ for $key ( keys %$i_pnorLayout)
+ {
+ my $eyeCatch = $$i_pnorLayout{$key}{eyeCatch};
+ my $physicalRegionSize = $$i_pnorLayout{$key}{physicalRegionSize};
+ my $actualRegionSize = $$i_pnorLayout{$key}{actualRegionSize};
+
+ if($actualRegionSize > $physicalRegionSize)
+ {
+ trace(0, "$this_func: Image provided ($$i_binFiles{$eyeCatch}) has size ($actualRegionSize) which is greater than allocated space ($physicalRegionSize) for section=$eyeCatch. Aborting!");
+ $rc = 1;
+ }
+
+ }
+
+
+ return $rc;
+}
+
+################################################################################
+# assemblePnorImage - Assemble actual PNOR image using the provided input data
+################################################################################
+sub assemblePnorImage
+{
+ my ($i_pnorBinName, $i_pnorLayout, $i_binFiles) = @_;
+ my $this_func = (caller(0))[3];
+ my $rc = 0;
+ my $key;
+
+ #key is the physical offset into the file, however don't need to sort
+ #as long as I tell dd not to truncate the file.
+ for $key ( keys %{$i_pnorLayout})
+ {
+ my $eyeCatch = $$i_pnorLayout{$key}{eyeCatch};
+ my $physicalOffset = $$i_pnorLayout{$key}{physicalOffset};
+ my $if = $$i_binFiles{$eyeCatch};
+
+ #Ignore sections that are marked as blank
+ if($$i_pnorLayout{$key}{source} =~ "Blank")
+ {
+ next;
+ }
+
+ #telling dd to read write 512 characters (1b) at a time, so need to seek
+ #<bytes>/512 blocks. This will work because PNOR offests will always be
+ # on a page boundary
+ my $blockSeek = $physicalOffset/512;
+
+ trace(1, "$this_func: populating section $eyeCatch, filename=$if");
+# my $ddCmd = `dd if=$if ibs=8c of=$i_pnorBinName obs=8c seek=$physicalOffset`;
+ my $ddCmd = `dd if=$if ibs=1b of=$i_pnorBinName obs=1b seek=$blockSeek conv=notrunc`;
+
+
+
+ }
+
+ return $rc;
+}
+
+################################################################################
+# saveInputFile - save inputfile name into binFiles array
+################################################################################
+sub saveInputFile
+{
+ my ($i_argPrefix, $i_argName, $i_argVal, $i_binFiles) = @_;
+ my $this_func = (caller(0))[3];
+
+ #$i_argName will be something like --binFile_HBB
+ #This substr command should return just the HBB, which should match an eyeCather
+ my $eyeCatcher = substr($i_argName, length($i_argPrefix)+1, length($i_argName)-length($i_argPrefix));
+
+ trace(10, "$this_func: $eyeCatcher=$i_argVal");
+
+ $$i_binFiles{$eyeCatcher} = $i_argVal;
+
+ trace(10, "$this_func: $$i_binFiles{$eyeCatcher}");
+
+ #no return code expected
+}
+
+
+
+#################################################
+# Insert specifed number of pad bytes into file
+#
+#################################################
+sub insertPadBytes
+{
+ my ($i_FILEHANDLE, $i_padBytes) = @_;
+ my $i;
+ print $i_FILEHANDLE pack("C[$i_padBytes]", map { 0 } 1..$i_padBytes);
+
+}
+
+################################################################################
+# getNumber - handle hex or decimal input string
+################################################################################
+sub getNumber
+{
+ my $inVal = shift;
+ if($inVal =~ "0x")
+ {
+ return oct($inVal);
+ }
+ else
+ {
+ return $inVal;
+ }
+}
+
+################################################################################
+# trace
+################################################################################
+sub traceErr
+{
+ my $i_string = shift;
+ trace($TRAC_ERR, $i_string);
+}
+
+################################################################################
+# trace
+################################################################################
+sub trace
+{
+ my $i_traceLevel;
+ my $i_string;
+
+ ($i_traceLevel, $i_string) = @_;
+
+ #traceLevel 0 is for errors
+ if($i_traceLevel == 0)
+ {
+ print "ERROR: ".$i_string."\n";
+ }
+ elsif ($g_trace >= $i_traceLevel)
+ {
+ print "TRACE: ".$i_string."\n";
+ }
+}
+
+
+
+################################################################################
+# print usage instructions
+################################################################################
+sub usage
+{
+print <<"ENDUSAGE";
+ $programName = Creates the PNOR IMAGE and with TOC based on input data.
+
+ Usage:
+ $programName --pnorlayout <layout xml file> --genToc --tocVersion <TOC layout version
+ --pnorOutBin <complete PNOR image>
+ --binFile_HBB <hostboot base image> --binFile_HBI <hostboot extended image>
+
+ Parms:
+ -h Print this help text
+ --pnorlayout <file> PNOR Layout XML file
+ --pnorOutBin <file> Name of output file for PNOR Binary
+ --genToc Indicates you wish to generate a table of contents. It will
+ write the file indicated by --binFile_TOC.
+
+ --binFile_<Section> <file> This is a special paramater. It is used to specify
+ input files to use for populating the various sections of
+ PNOR.
+ Examples: --binFile_HBB hostboot.bin
+ --binFile_HBI hostboot_extended.bin
+ --binFile_TOC murano.toc
+ A section declared as Blank in the XML does not need to have a
+ binFile specified
+
+ Current Limitations:
+ --TOC Records must be 4 or 8 bytes in length
+ --Regions and offsets cannot be over 32 bits (in hex), not an issue with current PNOR size
+ The script will print and error and exit with a non-zero return code if these
+ conditions are encountered.
+
+ENDUSAGE
+}
diff --git a/src/build/buildpnor/makefile b/src/build/buildpnor/makefile
new file mode 100644
index 000000000..922b4a969
--- /dev/null
+++ b/src/build/buildpnor/makefile
@@ -0,0 +1,58 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/buildpnor/makefile $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2012
+#
+# p1
+#
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
+#
+# The source code for this program is not published or other-
+# wise divested of its trade secrets, irrespective of what has
+# been deposited with the U.S. Copyright Office.
+#
+# Origin: 30
+#
+# IBM_PROLOG_END
+#Build PNOR Images for each platform.
+#Also builds images which contain the test code.
+ROOTPATH = ../../..
+
+PNOR_TARGETS = simics_MURANO simics_VENICE vbu
+
+define PNOR_template
+$${IMGDIR}/$(1).pnor: $${IMGDIR}/hbicore_extended.bin $${IMGDIR}/$(1)_targeting.bin
+ ./buildpnor.pl --pnorLayout ./pnorLayout.xml \
+ --genToc \
+ --pnorOutBin $${IMGDIR}/$(1).pnor \
+ --binFile_TOC $${IMGDIR}/$(1)_pnor.toc \
+ --binFile_HBI $${IMGDIR}/hbicore_extended.bin \
+ --binFile_HBD $${IMGDIR}/$(1)_targeting.bin
+endef
+define PNOR_test_template
+$${IMGDIR}/$(1)_test.pnor: $${IMGDIR}/hbicore_extended.bin $${IMGDIR}/$(1)_targeting.bin
+ ./buildpnor.pl --pnorLayout ./pnorLayout.xml \
+ --genToc \
+ --pnorOutBin $${IMGDIR}/$(1)_test.pnor \
+ --binFile_TOC $${IMGDIR}/$(1)_pnor.toc \
+ --binFile_HBI $${IMGDIR}/hbicore_test_extended.bin \
+ --binFile_HBD $${IMGDIR}/$(1)_targeting.bin
+endef
+
+PNOR_IMAGES = $(addsuffix .pnor, $(addprefix $(IMGDIR)/, ${PNOR_TARGETS})) \
+ $(addsuffix _test.pnor, $(addprefix $(IMGDIR)/, ${PNOR_TARGETS}))
+
+EXTRA_CLEAN = ${PNOR_IMAGES} ${PNOR_IMAGES:.pnor=_pnor.toc}
+
+include ${ROOTPATH}/config.mk
+
+buildpnor: ${PNOR_IMAGES}
+
+$(foreach pnor,$(PNOR_TARGETS),$(eval $(call PNOR_template,$(pnor))))
+$(foreach pnor,$(PNOR_TARGETS),$(eval $(call PNOR_test_template,$(pnor))))
diff --git a/src/build/buildpnor/pnorLayout.xml b/src/build/buildpnor/pnorLayout.xml
new file mode 100644
index 000000000..66afd169c
--- /dev/null
+++ b/src/build/buildpnor/pnorLayout.xml
@@ -0,0 +1,66 @@
+<!-- IBM_PROLOG_BEGIN_TAG
+ This is an automatically generated prolog.
+
+ $Source: src/build/buildpnor/pnorLayout.xml $
+
+ IBM CONFIDENTIAL
+
+ COPYRIGHT International Business Machines Corp. 2012
+
+ p1
+
+ Object Code Only (OCO) source materials
+ Licensed Internal Code Source Materials
+ IBM HostBoot Licensed Internal Code
+
+ The source code for this program is not published or other-
+ wise divested of its trade secrets, irrespective of what has
+ been deposited with the U.S. Copyright Office.
+
+ Origin: 30
+
+ IBM_PROLOG_END -->
+<pnor>
+ <section>
+ <description>Table of Contents (2K)</description>
+ <eyeCatch>TOC</eyeCatch>
+ <physicalOffset>0</physicalOffset>
+ <physicalRegionSize>0x1000</physicalRegionSize>
+ <ecc>no</ecc>
+ <source>Generate</source>
+ </section>
+ <section>
+ <description>Hostboot Extended image (2MB)</description>
+ <eyeCatch>HBI</eyeCatch>
+ <physicalOffset>0x1000</physicalOffset>
+ <physicalRegionSize>0x200000</physicalRegionSize>
+ <ecc>no</ecc>
+ <source>File</source>
+ </section>
+ <section>
+ <description>Attribute Data (512K)</description>
+ <eyeCatch>HBD</eyeCatch>
+ <physicalOffset>0x201000</physicalOffset>
+ <physicalRegionSize>0x80000</physicalRegionSize>
+ <ecc>no</ecc>
+ <source>File</source>
+ </section>
+ <section>
+ <description>Module VPD</description>
+ <eyeCatch>MVPD</eyeCatch>
+ <physicalOffset>0x281000</physicalOffset>
+ <physicalRegionSize>0x80000</physicalRegionSize>
+ <actualRegionSize>0x80000</actualRegionSize>
+ <ecc>no</ecc>
+ <source>Blank</source>
+ </section>
+ <section>
+ <description>DIMM JEDEC</description>
+ <eyeCatch>DJVPD</eyeCatch>
+ <physicalOffset>0x301000</physicalOffset>
+ <physicalRegionSize>0x40000</physicalRegionSize>
+ <actualRegionSize>0x40000</actualRegionSize>
+ <ecc>no</ecc>
+ <source>Blank</source>
+ </section>
+</pnor>
diff --git a/src/build/makefile b/src/build/makefile
index 9cc2341ff..b138664ca 100644
--- a/src/build/makefile
+++ b/src/build/makefile
@@ -22,6 +22,6 @@
# IBM_PROLOG_END
ROOTPATH = ../..
-SUBDIRS = linker.d tocgen.d
+SUBDIRS = linker.d buildpnor.d
include ${ROOTPATH}/config.mk
diff --git a/src/build/simics/post_model_hook.simics b/src/build/simics/post_model_hook.simics
index 0df0206b3..d102862af 100755
--- a/src/build/simics/post_model_hook.simics
+++ b/src/build/simics/post_model_hook.simics
@@ -33,9 +33,6 @@
run-python-file simics-debug-framework.py
run-python-file hb-simdebug.py
-#Load extended image and pnor.toc into phys_mem
-#This will be merged into once the proper tools are written.
-phys_mem.load-file ../img/hbicore_extended.bin 0x500690
-phys_mem.load-file ../img/pnor.toc 0x500000
-phys_mem.load-file ../img/targeting.bin 0x601690
+#Load PNOR image into phys_mem
+phys_mem.load-file ../img/simics.pnor 0x400000
diff --git a/src/build/tocgen/makefile b/src/build/tocgen/makefile
deleted file mode 100644
index cb872f1f1..000000000
--- a/src/build/tocgen/makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-
-#Temporary implementation to get a PNOR TOC created. This will all change once the PNOR
-#layout is finalized and we put together some real build tools.
-#TODO: restructure to fit the usual makefile structure
-ROOTPATH = ../../..
-
-pnortoc:
- ${ROOTPATH}/src/build/tocgen/mkpnortoc.pl -i ${ROOTPATH}/src/build/tocgen/pnortoc.xml \
- -o ${ROOTPATH}/img/pnor.toc
-
-all: gen_pass
-
-code_pass:
-
-gen_pass: pnortoc
-
-clean:
-
-beam:
-
diff --git a/src/build/tocgen/mkpnortoc.pl b/src/build/tocgen/mkpnortoc.pl
deleted file mode 100755
index 7fc263a72..000000000
--- a/src/build/tocgen/mkpnortoc.pl
+++ /dev/null
@@ -1,347 +0,0 @@
-#!/usr/bin/perl
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/build/tocgen/mkpnortoc.pl $
-#
-# IBM CONFIDENTIAL
-#
-# COPYRIGHT International Business Machines Corp. 2011
-#
-# p1
-#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
-#
-# The source code for this program is not published or other-
-# wise divested of its trade secrets, irrespective of what has
-# been deposited with the U.S. Copyright Office.
-#
-# Origin: 30
-#
-# IBM_PROLOG_END
-# File mkPnorTOC.pl created by ADAM R. MUHLE at 14:39:27 on Mon Aug 1 2011.
-
-#Limitations to address later
-# number fields must be 4 or 8 bytes
-# numbers cannot be over 32 bits
-
-#@TODO - enable "use strict"
-#@TODO - standardize variable names, i_blah for input, etc.
-
-use XML::LibXML;
-#use Data::Dumper;
-use File::Basename;
-
-my $programName = File::Basename::basename $0;
-my $g_trace = 0; # >0 enable traces
-$tocDataFile = "";
-$tocOutFile = "";
-
-if ($#ARGV < 0) {
- usage();
- exit;
-}
-
-
-#Parse the commandline args
-for ($i=0; $i < $#ARGV + 1; $i++)
-{
- if ($ARGV[$i] =~ /-h/) {
- usage();
- exit 0;
- }
- elsif($ARGV[$i] =~ /-v/) {
- $verbose = 1;
- }
- elsif($ARGV[$i] =~ /-i/) {
- $tocDataFile = $ARGV[++$i];
- trace(1, "Input Data File=$tocDataFile");
- }
- elsif($ARGV[$i] =~ /-o/) {
- $tocOutFile = $ARGV[++$i];
- trace(1, "Output Binary File=$tocOutFile");
- }
- else {
- #Error!!
- }
-}
-
-
-#open output file
-open( BIN_TOC_FILE, ">:raw", $tocOutFile) or die "Can't open $tocOutFile file for writing";
-
-#parse the input XML file
-$parser = XML::LibXML->new();
-$doc = $parser->parse_file($tocDataFile);
-
-#add the SBE field to the TOC
-$sbeNodes = $doc->getElementsByTagName("sbeLoc");
-$onlySbeNode = $sbeNodes->pop();
-writeElementToBinFile(BIN_TOC_FILE, $onlySbeNode);
-
-#Add TOC version field to TOC
-$tocVerNodes = $doc->getElementsByTagName("tocVersion");
-$onlytocVerNode = $tocVerNodes->pop();
-writeElementToBinFile(BIN_TOC_FILE, $onlytocVerNode);
-
-
-#Add the individual TOC entries; skip over the mandatory comment block
-$root = $doc->firstChild->nextSibling;
-$curSibling = $root->firstChild;
-
-do {
- #just in case the first childe is bad
- if(!$curSibling)
- {
- last;
- }
- elsif($curSibling->nodeName eq "tocEntry")
- {
- parseTocEntry(BIN_TOC_FILE, $curSibling);
- }
- elsif(($curSibling->nodeName eq "sbeLoc") ||
- ($curSibling->nodeName eq "tocVersion"))
- {
- #skip these, already inserted above
- }
-
-}while($curSibling = $curSibling->nextSibling());
-
-
-close(BIN_TOC_FILE);
-exit;
-
-#################################################
-# Get Length of a field
-# Searches XML element for sub-element called
-# length
-#################################################
-sub getLength
-{
- $element = @_[0];
-
- $lenElements = $element->getElementsByLocalName("length");
- $lenEl = $lenElements->pop();
-
- $len = $lenEl->firstChild->data;
- chomp $len;
- return $len;
-
-}
-
-#################################################
-# Get format of a field
-# Searches XML element for sub-element called
-# format
-#################################################
-sub getFormat
-{
- $element = @_[0];
-
- $formatElements = $element->getElementsByLocalName("format");
- $formatEl = $formatElements->pop();
-
- $format = $formatEl->firstChild->data;
- chomp $format;
- return $format;
-
-}
-
-
-#################################################
-# Get data value from provided XML element
-#
-#################################################
-sub getValue
-{
- $i_element = @_[0];
-
- $value = $i_element->firstChild->data;
-
- $value =~s/\s+$//;
- chomp $value;
-
- return $value;
-}
-
-#################################################
-# parse <tocEntry> node, write bin data to file
-#
-#################################################
-sub parseTocEntry
-{
- ($i_FILEHANDLE, $i_element) = @_;
- $entryLength = 0;
- $sumFieldLen = 0;
- local $curSibling;
-
-
- $curSibling = $i_element->firstChild;
- do {
- #just in case the first childe is bad
- if(!$curSibling)
- {
- last;
- }
- elsif(($curSibling->nodeName eq "text") ||
- ($curSibling->nodeName eq "#text"))
- {
- trace(1, "ignoring ".$curSibling->nodeName);
- }
- elsif($curSibling->nodeName eq "length")
- {
- $entryLength = $curSibling->firstChild->data;
-
- }
- else
- {
- trace(1, "Parsing ".$curSibling->nodeName);
- $fieldLen = writeElementToBinFile($i_FILEHANDLE, $curSibling);
- $sumFieldLen = $sumFieldLen + $fieldLen;
-
- }
-# ($nextSibling = $curSibling->nextSibling)
-
- }while($curSibling = $curSibling->nextSibling);
-
- if($sumFieldLen > $entryLength)
- {
- trace(0, "Fields in TOC Entry consumed more space (".$sumFieldLen.") then they were supposed to (".$entryLength.")\n Aborting");
- exit 1;
- }
- elsif($sumFieldLen < $entryLength)
- {
- trace(1, "Need to insert padding to fill up TOC entry space");
- $padBytes = $entryLength - $sumFieldLen;
- insertPadBytes($i_FILEHANDLE, $padBytes);
- }
-
-
-}
-#################################################
-# write provided element to binary file
-#
-#################################################
-sub writeElementToBinFile
-{
- ($i_FILEHANDLE, $i_element) = @_;
-
- $elValue = getValue($i_element);
- $len = getLength($i_element);
- $format = getFormat($i_element);
-
- trace(1, "Value=".$elValue." Length=".$len." Format=".$format);
-
-
- if($format =~ "string")
- {
- #print in ascii
- #pad on right side
- @charArray = unpack("C*", $elValue);
- foreach $char (@charArray)
- {
- print $i_FILEHANDLE pack('C', $char);
- }
-
- $zeroPad = $len-length($elValue);
- insertPadBytes($i_FILEHANDLE, $zeroPad);
- }
- elsif ($format =~ "number")
- {
- if(($len != 4) &&
- ($len != 8))
- {
- trace(0, "field <length>=".$len.". Currently only lengths of 4 or 8 are supported. \n Aborting program");
- exit 1;
- }
-
- if($len == 8)
- {
- print $i_FILEHANDLE pack('N', 0);
- }
-
- #check if we have a hex number
- if($elValue =~ "0x")
- {
- $num = oct($elValue);
- }
- else
- {
- $num = $elValue;
- }
-
- #verify number consumes less than 32 bits
- if($num > 0xFFFFFFFF)
- {
- trace(0, "number=".$num.". This is greater than 32 bits in hex and not currently supported!. \n Aborting program");
- exit 1;
- }
-
- print $i_FILEHANDLE pack('N', $num);
-
- }
- else
- {
- print "ERROR: Unrecognized <format> type: ".$format." Exiting!\n";
- exit 1;
- }
-
- return $len
-
-}
-
-#################################################
-# Insert specifed number of pad bytes into file
-#
-#################################################
-sub insertPadBytes
-{
- ($i_FILEHANDLE, $i_padBytes) = @_;
- for($i=0; $i<$i_padBytes; $i++)
- {
- print $i_FILEHANDLE pack('C', 0);
- }
-}
-
-
-
-
-################################################################################
-# trace
-################################################################################
-sub trace
-{
- ($i_traceLevel, $i_string) = @_;
-
- #traceLevel 0 is for errors
- if($i_traceLevel == 0)
- {
- print "ERROR: ".$i_string."\n";
- }
- elsif ($g_trace >= $i_traceLevel)
- {
- print "TRACE: ".$i_string."\n";
- }
-}
-
-################################################################################
-# print usage instructions
-################################################################################
-sub usage
-{
-print <<"ENDUSAGE";
- $programName = Creates the PNOR Table of Contents (TOC) based on input XML file.
-
- Usage:
- $programName -i <XML File> -o <binary Output File>
-
- Current Limitations:
- --Hex/number fields must be 4 or 8 bytes in length
- --Numbers cannot be over 32 bits (in hex)
- The script will print and error and exit with a non-zero return code if these
- conditions are encountered.
-
-ENDUSAGE
-}
diff --git a/src/build/tocgen/pnortoc.xml b/src/build/tocgen/pnortoc.xml
deleted file mode 100644
index f99595c40..000000000
--- a/src/build/tocgen/pnortoc.xml
+++ /dev/null
@@ -1,156 +0,0 @@
-<!-- IBM_PROLOG_BEGIN_TAG
- This is an automatically generated prolog.
-
- $Source: src/build/tocgen/pnortoc.xml $
-
- IBM CONFIDENTIAL
-
- COPYRIGHT International Business Machines Corp. 2011
-
- p1
-
- Object Code Only (OCO) source materials
- Licensed Internal Code Source Materials
- IBM HostBoot Licensed Internal Code
-
- The source code for this program is not published or other-
- wise divested of its trade secrets, irrespective of what has
- been deposited with the U.S. Copyright Office.
-
- Origin: 30
-
- IBM_PROLOG_END -->
-<pnorToc>
- <sbeLoc>0x180
- <length>8</length>
- <format>number</format>
- </sbeLoc>
- <tocVersion>0xFFFF
- <length>8</length>
- <format>number</format>
- </tocVersion>
- <tocEntry>
- <length>56</length>
- <field type="eyeCatch">TOC
- <length>8</length>
- <format>string</format>
- </field>
- <field type="logical_offset">0
- <length>8</length>
- <format>number</format>
- </field>
- <field type="physical_offset">0
- <length>8</length>
- <format>number</format>
- </field>
- <field type="logical_size">0x690
- <length>8</length>
- <format>number</format>
- </field>
- <field type="physical_size">0x690
- <length>8</length>
- <format>number</format>
- </field>
- <field type="Act_logical_size">0
- <length>8</length>
- <format>number</format>
- </field>
- <field type="Act_physical_size">0
- <length>8</length>
- <format>number</format>
- </field>
- </tocEntry>
- <tocEntry>
- <length>56</length>
- <field type="eyeCatch">HBI
- <length>8</length>
- <format>string</format>
- </field>
- <field type="logical_offset">0x690
- <length>8</length>
- <format>number</format>
- </field>
- <field type="physical_offset">0x690
- <length>8</length>
- <format>number</format>
- </field>
- <field type="logical_size">0x100000
- <length>8</length>
- <format>number</format>
- </field>
- <field type="physical_size">0x100000
- <length>8</length>
- <format>number</format>
- </field>
- <field type="Act_logical_size">0
- <length>8</length>
- <format>number</format>
- </field>
- <field type="Act_physical_size">0
- <length>8</length>
- <format>number</format>
- </field>
- </tocEntry>
- <tocEntry>
- <length>56</length>
- <field type="eyeCatch">GLOBAL
- <length>8</length>
- <format>string</format>
- </field>
- <field type="logical_offset">0x100690
- <length>8</length>
- <format>number</format>
- </field>
- <field type="physical_offset">0x100690
- <length>8</length>
- <format>number</format>
- </field>
- <field type="logical_size">4096
- <length>8</length>
- <format>number</format>
- </field>
- <field type="physical_size">4096
- <length>8</length>
- <format>number</format>
- </field>
- <field type="Act_logical_size">0
- <length>8</length>
- <format>number</format>
- </field>
- <field type="Act_physical_size">0
- <length>8</length>
- <format>number</format>
- </field>
- </tocEntry>
- <tocEntry>
- <length>56</length>
- <field type="eyeCatch">HBD
- <length>8</length>
- <format>string</format>
- </field>
- <field type="logical_offset">0x101690
- <length>8</length>
- <format>number</format>
- </field>
- <field type="physical_offset">0x101690
- <length>8</length>
- <format>number</format>
- </field>
- <field type="logical_size">0x20000
- <length>8</length>
- <format>number</format>
- </field>
- <field type="physical_size">0x20000
- <length>8</length>
- <format>number</format>
- </field>
- <field type="Act_logical_size">0
- <length>8</length>
- <format>number</format>
- </field>
- <field type="Act_physical_size">0
- <length>8</length>
- <format>number</format>
- </field>
- </tocEntry>
-</pnorToc>
diff --git a/src/build/tools/cpfiles.pl b/src/build/tools/cpfiles.pl
index 5e68a77bf..381d455e0 100755
--- a/src/build/tools/cpfiles.pl
+++ b/src/build/tools/cpfiles.pl
@@ -79,14 +79,14 @@ my %files = ("src/build/tools/hb-parsedump.pl" => "rsv",
"img/hbicore_test.bin" => "rsv",
"img/hbicore.list" => "rsv",
"img/hbicore_test.list" => "rsv",
- "img/hbicore_extended.bin" => "rsv",
- "img/hbicore_test_extended.bin" => "rsv",
"img/hbicore.bin.modinfo" => "rsv",
"img/hbicore_test.bin.modinfo" => "rsv",
- "img/pnor.toc" => "rsv",
- "img/simics_VENICE_targeting.bin" => "rs",
- "img/simics_MURANO_targeting.bin" => "rs",
- "img/vbu_targeting.bin" => "rv",
+ "img/simics_MURANO.pnor" => "rs",
+ "img/simics_MURANO_test.pnor" => "rs",
+ "img/simics_VENICE.pnor" => "rs",
+ "img/simics_VENICE_test.pnor" => "rs",
+ "img/vbu.pnor" => "rv",
+ "img/vbu_test.pnor" => "rv",
"img/isteplist.csv" => "rsv",
"src/usr/hwpf/hwp/fapiTestHwp.C" => "r",
"src/include/usr/hwpf/hwp/fapiTestHwp.H" => "r",
@@ -257,7 +257,8 @@ while ( my ($key, $value) = each(%files) )
#Is file in img dir?
if (($suffix eq ".bin") ||
- ($suffix eq ".toc"))
+ ($suffix eq ".toc") ||
+ ($suffix eq ".pnor"))
{
$copyDir = $imgDir;
}
@@ -288,7 +289,8 @@ while ( my ($key, $value) = each(%files) )
#Copy .bin to the img dir
if (($suffix eq ".bin") ||
- ($suffix eq ".toc"))
+ ($suffix eq ".toc") ||
+ ($suffix eq ".pnor"))
{
$copyDir = $imgDir;
}
@@ -306,12 +308,22 @@ while ( my ($key, $value) = each(%files) )
$command = sprintf("cp %s %s %s", $recursive,
$key, $copyDir."/hbicore".$suffix);
}
- elsif ($filename eq "hbicore_test_extended")
+ elsif ($filename eq "simics_MURANO_test")
{
$command = sprintf("cp %s %s %s", $recursive,
- $key, $copyDir."/hbicore_extended".$suffix);
+ $key, $copyDir."/simics_MURANO".$suffix);
}
- elsif ($filename ne "hbicore" and $filename ne "hbicore_extended")
+ elsif ($filename eq "simics_VENICE_test")
+ {
+ $command = sprintf("cp %s %s %s", $recursive,
+ $key, $copyDir."/simics_VENICE".$suffix);
+ }
+ elsif ($filename eq "vbu_test")
+ {
+ $command = sprintf("cp %s %s %s", $recursive,
+ $key, $copyDir."/vbu".$suffix);
+ }
+ elsif ($filename ne "hbicore" and $filename ne "simics_MURANO" and $filename ne "simics_VENICE" and $filename ne "vbu")
{
$command = sprintf("cp %s %s %s", $recursive,
$key, $copyDir);
@@ -337,9 +349,9 @@ while ( my ($key, $value) = each(%files) )
if ("s" eq $env) #simics
{
- # create a sym-link to the appropriate targeting binary
- print "Linking in simics_".$machine.".targeting.bin\n";
- $command = sprintf("ln -sf %s/simics_%s_targeting.bin %s/targeting.bin", $imgDir, $machine, $imgDir );
+ # create a sym-link to the appropriate pnor binary
+ print "Linking in simics_".$machine.".pnor\n";
+ $command = sprintf("ln -sf %s/simics_%s.pnor %s/simics.pnor", $imgDir, $machine, $imgDir );
print "$command\n";
`$command`;
if( $? != 0 )
@@ -347,6 +359,7 @@ if ("s" eq $env) #simics
print "ERROR : exiting\n";
exit(-1);
}
+
}
else #release or vpo
{
diff --git a/src/include/usr/pnor/pnorif.H b/src/include/usr/pnor/pnorif.H
index c26c49486..86dbdebc5 100644
--- a/src/include/usr/pnor/pnorif.H
+++ b/src/include/usr/pnor/pnorif.H
@@ -36,22 +36,22 @@ namespace PNOR
enum SectionId
{
TOC, /**< Table of Contents */
- GLOBAL_DATA, /**< Global Data */
- SBE_IPL, /**< Self-Boot Engine IPL image */
- HB_BASE_CODE, /**< Hostboot Base Image */
- HB_DATA, /**< Hostboot Data */
- HB_ERRLOGS, /**< Hostboot Error log Repository */
HB_EXT_CODE, /**< Hostboot Extended Image */
- HB_RUNTIME, /**< Hostboot Runtime Image */
- PAYLOAD, /**< HAL/OPAL */
- PFW_LITE_CODE, /**< PFW-lite */
- OCC_CODE, /**< OCC Code Image */
- KVM_PART_INFO, /**< KVM Partition Information */
- CODE_UPDATE, /**< Code Update Overhead */
+ HB_DATA, /**< Hostboot Data */
+ DIMM_JEDEC_VPD, /**< DIMM JEDEC VPD */
+ MODULE_VPD, /**< Module VPD */
NUM_SECTIONS, /**< Number of defined sections */
+ //Not currently used
+// GLOBAL_DATA, /**< Global Data */
+// SBE_IPL, /**< Self-Boot Engine IPL image */
+// HB_BASE_CODE, /**< Hostboot Base Image */
+// PAYLOAD, /**< HAL/OPAL */
+// HB_RUNTIME, /**< Hostboot Runtime Image */
+// HB_ERRLOGS, /**< Hostboot Error log Repository */
+
FIRST_SECTION = TOC, /**< First section (for looping) */
- LAST_SECTION = CODE_UPDATE, /**< Last section (for looping) */
+ LAST_SECTION = MODULE_VPD, /**< Last section (for looping) */
INVALID_SECTION = NUM_SECTIONS, /**< Used for error cases, initialization */
};
diff --git a/src/makefile b/src/makefile
index 10a7b45d3..321b48574 100644
--- a/src/makefile
+++ b/src/makefile
@@ -92,4 +92,9 @@ hbicore_test_DATA_MODULES = ${hbicore_DATA_MODULES} testdata
dslid_LIDNUMBER = 80f001fe
+IMAGE_EXTRA_TARGETS = buildpnor
+
include ${ROOTPATH}/config.mk
+
+buildpnor: ${IMAGES}
+ cd build/buildpnor/ && make buildpnor
diff --git a/src/usr/pnor/pnordd.C b/src/usr/pnor/pnordd.C
index 4df0dab36..5b409e32c 100644
--- a/src/usr/pnor/pnordd.C
+++ b/src/usr/pnor/pnordd.C
@@ -987,9 +987,9 @@ errlHndl_t PnorDD::eraseFlash(uint32_t i_address)
This code is used in the MODEL_MEMCPY and MODEL_LPC_MEM modes
*/
-#define FAKE_PNOR_START 5*MEGABYTE
+#define FAKE_PNOR_START 4*MEGABYTE
#define FAKE_PNOR_END 8*MEGABYTE
-#define FAKE_PNOR_SIZE 3*MEGABYTE
+#define FAKE_PNOR_SIZE 4*MEGABYTE
void write_fake_pnor( uint64_t i_pnorAddr, void* i_buffer, size_t i_size )
{
//create a pointer to the offset start.
diff --git a/src/usr/pnor/pnordd.H b/src/usr/pnor/pnordd.H
index 28d4f0b51..0ce538b4d 100644
--- a/src/usr/pnor/pnordd.H
+++ b/src/usr/pnor/pnordd.H
@@ -216,7 +216,7 @@ class PnorDD
LPC_STAT_REG_ERROR_MASK = 0xFC0000000007F700, /**< Error Bits */
- PNORSIZE = 3 * MEGABYTE, //@fixme - read from TOC instead
+ PNORSIZE = 4 * MEGABYTE, //@fixme - read from TOC instead
ERASESIZE_BYTES = 4 * KILOBYTE, /**< Minimum Erase Block (bytes) */
ERASESIZE_WORD32 = ERASESIZE_BYTES/(sizeof(uint32_t)), /**< Erase Block (32-bit words) */
diff --git a/src/usr/pnor/pnorrp.C b/src/usr/pnor/pnorrp.C
index a2175d06b..566358567 100644
--- a/src/usr/pnor/pnorrp.C
+++ b/src/usr/pnor/pnorrp.C
@@ -48,19 +48,20 @@ TRAC_INIT(&g_trac_pnor, "PNOR", 4096); //4K
*/
const char* cv_EYECATCHER[] = { //@todo - convert there to uint64_t
"TOC", /**< PNOR::TOC : Table of Contents */
- "GLOBAL", /**< PNOR::GLOBAL_DATA : Global Data */
- "SBE", /**< PNOR::SBE_IPL : Self-Boot Enginer IPL image */
- "HBB", /**< PNOR::HB_BASE_CODE : Hostboot Base Image */
- "HBD", /**< PNOR::HB_DATA : Hostboot Data */
- "XXX", /**< PNOR::HB_ERRLOGS : Hostboot Error log Repository */
"HBI", /**< PNOR::HB_EXT_CODE : Hostboot Extended Image */
- "HBR", /**< PNOR::HB_RUNTIME : Hostboot Runtime Image */
- "OPAL", /**< PNOR::PAYLOAD : HAL/OPAL */
- "PFWL", /**< PNOR::PFW_LITE_CODE : PFW-lite */
- "OCC", /**< PNOR::OCC_CODE : OCC Code Image */
- "PART", /**< PNOR::KVM_PART_INFO : KVM Partition Information */
- "XXX", /**< PNOR::CODE_UPDATE : Code Update Overhead */
- "XXX", /**< NUM_SECTIONS : Used as invalid entry */
+ "HBD", /**< PNOR::HB_DATA : Hostboot Data */
+ "DJVPD", /**< PNOR::DIMM_JEDEC_VPD: Dimm JEDEC VPD */
+ "MVPD", /**< PNOR::MODULE_VPD : Module VPD */
+
+ //Not currently used
+// "GLOBAL", /**< PNOR::GLOBAL_DATA : Global Data */
+// "SBE", /**< PNOR::SBE_IPL : Self-Boot Enginer IPL image */
+// "HBB", /**< PNOR::HB_BASE_CODE : Hostboot Base Image */
+// "XXX", /**< PNOR::HB_ERRLOGS : Hostboot Error log Repository */
+// "HBR", /**< PNOR::HB_RUNTIME : Hostboot Runtime Image */
+// "PART", /**< PNOR::KVM_PART_INFO : KVM Partition Information */
+// "XXX", /**< PNOR::CODE_UPDATE : Code Update Overhead */
+// "XXX", /**< NUM_SECTIONS : Used as invalid entry */
};
@@ -344,30 +345,35 @@ errlHndl_t PnorRP::readTOC()
// TOC starts at offset zero
// put some random sizes in here
- iv_TOC[PNOR::SIDE_A][PNOR::TOC].size = 8 + 8 + PNOR::NUM_SECTIONS*sizeof(TOCEntry_t);
- iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].size = 1024*KILOBYTE; //1MB
- iv_TOC[PNOR::SIDE_A][PNOR::GLOBAL_DATA].size = PAGESIZE; //4K
- iv_TOC[PNOR::SIDE_A][PNOR::HB_DATA].size = 512*KILOBYTE; //512K
-
- // fake PNOR will look like this: TOC::HB_EXT_CODE:GLOBAL_DATA:HB_DATA
+ //sizes and offsets taken from pnorLayout.xml
+ iv_TOC[PNOR::SIDE_A][PNOR::TOC].size = 0x1000;
+ iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].size = 0x200000; //1MB
+ iv_TOC[PNOR::SIDE_A][PNOR::HB_DATA].size = 0x80000; //512K
+ iv_TOC[PNOR::SIDE_A][PNOR::MODULE_VPD].size = 0x80000; //512K
+ iv_TOC[PNOR::SIDE_A][PNOR::DIMM_JEDEC_VPD].size = 0x40000; //256K
+
+ // fake PNOR will look like this: TOC::HB_EXT_CODE:HB_DATA:MODULE_VPD:DIMM_JEDEC_VPD
// virtual addresses
iv_TOC[PNOR::SIDE_A][PNOR::TOC].virtAddr = BASE_VADDR + 0;
- iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].virtAddr = iv_TOC[PNOR::SIDE_A][PNOR::TOC].virtAddr + iv_TOC[PNOR::SIDE_A][PNOR::TOC].size;
- iv_TOC[PNOR::SIDE_A][PNOR::GLOBAL_DATA].virtAddr = iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].virtAddr + iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].size;
- iv_TOC[PNOR::SIDE_A][PNOR::HB_DATA].virtAddr = iv_TOC[PNOR::SIDE_A][PNOR::GLOBAL_DATA].virtAddr + iv_TOC[PNOR::SIDE_A][PNOR::GLOBAL_DATA].size;
- // flash
+ iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].virtAddr = BASE_VADDR + 0x1000;
+ iv_TOC[PNOR::SIDE_A][PNOR::HB_DATA].virtAddr = BASE_VADDR + 0x201000;
+ iv_TOC[PNOR::SIDE_A][PNOR::MODULE_VPD].virtAddr = BASE_VADDR + 0x281000;
+ iv_TOC[PNOR::SIDE_A][PNOR::DIMM_JEDEC_VPD].virtAddr = BASE_VADDR + 0x301000;
+ // flash
iv_TOC[PNOR::SIDE_A][PNOR::TOC].flashAddr = 0;
- iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].flashAddr = iv_TOC[PNOR::SIDE_A][PNOR::TOC].flashAddr + iv_TOC[PNOR::SIDE_A][PNOR::TOC].size;
- iv_TOC[PNOR::SIDE_A][PNOR::GLOBAL_DATA].flashAddr = iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].flashAddr + iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].size;
- iv_TOC[PNOR::SIDE_A][PNOR::HB_DATA].flashAddr = iv_TOC[PNOR::SIDE_A][PNOR::GLOBAL_DATA].flashAddr + iv_TOC[PNOR::SIDE_A][PNOR::GLOBAL_DATA].size;
+ iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].flashAddr = 0x1000;
+ iv_TOC[PNOR::SIDE_A][PNOR::HB_DATA].flashAddr = 0x201000;
+ iv_TOC[PNOR::SIDE_A][PNOR::MODULE_VPD].flashAddr = 0x281000;
+ iv_TOC[PNOR::SIDE_A][PNOR::DIMM_JEDEC_VPD].flashAddr = 0x301000;
//@todo - end fake data
//keep these traces here until PNOR is rock-solid
TRACFCOMP(g_trac_pnor, "TOC: size=0x%.8X flash=0x%.8X virt=0x%.16X", iv_TOC[PNOR::SIDE_A][PNOR::TOC].size, iv_TOC[PNOR::SIDE_A][PNOR::TOC].flashAddr, iv_TOC[PNOR::SIDE_A][PNOR::TOC].virtAddr );
TRACFCOMP(g_trac_pnor, "EXT: size=0x%.8X flash=0x%.8X virt=0x%.16X", iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].size, iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].flashAddr, iv_TOC[PNOR::SIDE_A][PNOR::HB_EXT_CODE].virtAddr );
- TRACFCOMP(g_trac_pnor, "GLOBAL: size=0x%.8X flash=0x%.8X virt=0x%.16X", iv_TOC[PNOR::SIDE_A][PNOR::GLOBAL_DATA].size, iv_TOC[PNOR::SIDE_A][PNOR::GLOBAL_DATA].flashAddr, iv_TOC[PNOR::SIDE_A][PNOR::GLOBAL_DATA].virtAddr );
TRACFCOMP(g_trac_pnor, "DATA: size=0x%.8X flash=0x%.8X virt=0x%.16X", iv_TOC[PNOR::SIDE_A][PNOR::HB_DATA].size, iv_TOC[PNOR::SIDE_A][PNOR::HB_DATA].flashAddr, iv_TOC[PNOR::SIDE_A][PNOR::HB_DATA].virtAddr );
+ TRACFCOMP(g_trac_pnor, "MVPD: size=0x%.8X flash=0x%.8X virt=0x%.16X", iv_TOC[PNOR::SIDE_A][PNOR::MODULE_VPD].size, iv_TOC[PNOR::SIDE_A][PNOR::MODULE_VPD].flashAddr, iv_TOC[PNOR::SIDE_A][PNOR::MODULE_VPD].virtAddr );
+ TRACFCOMP(g_trac_pnor, "DJVPD: size=0x%.8X flash=0x%.8X virt=0x%.16X", iv_TOC[PNOR::SIDE_A][PNOR::DIMM_JEDEC_VPD].size, iv_TOC[PNOR::SIDE_A][PNOR::DIMM_JEDEC_VPD].flashAddr, iv_TOC[PNOR::SIDE_A][PNOR::DIMM_JEDEC_VPD].virtAddr );
//@todo - load flash layout (how many chips)
//@todo - read TOC on each chip/bank/whatever
diff --git a/src/usr/pnor/pnorrp.H b/src/usr/pnor/pnorrp.H
index 97a7fa80c..07e020034 100644
--- a/src/usr/pnor/pnorrp.H
+++ b/src/usr/pnor/pnorrp.H
@@ -102,7 +102,8 @@ class PnorRP
uint64_t offset; /**< Offset to region from zero (relative to chip) */
uint64_t size; /**< Size of region in bytes (with or without ECC?) */
uint64_t size_act; /**< Actual size of content in bytes */
- char fuse_tbd[96]; /**< Remainder is TBD depending on FUSE requirements */
+ uint64_t misc; /**< Miscellaneious Info */
+ char fuse_tbd[89]; /**< Free Space */
//@todo - need a chip select here I think?
} PACKED;
diff --git a/src/usr/pnor/test/pnorddtest.H b/src/usr/pnor/test/pnorddtest.H
index dd7034889..74e357cdf 100644
--- a/src/usr/pnor/test/pnorddtest.H
+++ b/src/usr/pnor/test/pnorddtest.H
@@ -40,7 +40,7 @@
#include <list>
#include <targeting/util.H>
-#define BASE_SCRATCH_SPACE (2*1024*1024+1024*512) //2.5MB offset in fake PNOR
+#define BASE_SCRATCH_SPACE (3*1024*1024+1024*512) //3.5MB offset in fake PNOR
extern trace_desc_t* g_trac_pnor;
@@ -58,7 +58,7 @@ class PnorDdTest : public CxxTest::TestSuite
/**
* @brief PNOR DD readWriteTest
* Write some data to PNOR and read it back again
- * Using fakePNOR scratch space (2.5 - 3 MB)
+ * Using fakePNOR scratch space (3.5 - 4 MB)
*/
void test_readwrite(void)
{
diff --git a/src/usr/pnor/test/pnorrptest.H b/src/usr/pnor/test/pnorrptest.H
index bdd28c2b8..d2f1fad2d 100644
--- a/src/usr/pnor/test/pnorrptest.H
+++ b/src/usr/pnor/test/pnorrptest.H
@@ -62,19 +62,21 @@ class PnorRpTest : public CxxTest::TestSuite
uint64_t vaddr;
};
const ExpVals_t exp_data[] = {
- /* TOC */ { 0x690, 0x80000000 },
- /* GLOBAL_DATA */ { PAGESIZE, 0x80100690 },
- /* SBE_IPL */ { 0, 0 },
- /* HB_BASE_CODE */ { 0, 0 },
- /* HB_DATA */ { 512*KILOBYTE, 0x80101690 },
- /* HB_ERRLOGS */ { 0, 0 },
- /* HB_EXT_CODE */ { 1024*KILOBYTE, 0x80000690 },
- /* HB_RUNTIME */ { 0, 0 },
- /* PAYLOAD */ { 0, 0 },
- /* PFW_LITE_CODE */ { 0, 0 },
- /* OCC_CODE */ { 0, 0 },
- /* KVM_PART_INFO */ { 0, 0 },
- /* CODE_UPDATE */ { 0, 0 },
+ /* TOC */ { 0x1000, 0x80000000 },
+ /* HB_EXT_CODE */ { 0x200000, 0x80001000 },
+ /* HB_DATA */ { 0x80000, 0x80201000 },
+ /* DIMM_JEDEC_VPD */ { 0x40000, 0x80301000 },
+ /* MODULE_VPD */ { 0x80000, 0x80281000 },
+ /* GLOBAL_DATA { 0, 0 },*/
+ /* SBE_IPL { 0, 0 },*/
+ /* HB_ERRLOGS { 0, 0 },*/
+ /* HB_BASE_CODE { 0, 0 },*/
+ /* HB_RUNTIME { 0, 0 },*/
+ /* PAYLOAD { 0, 0 },*/
+ /* PFW_LITE_CODE { 0, 0 },*/
+ /* OCC_CODE { 0, 0 },*/
+ /* KVM_PART_INFO { 0, 0 },*/
+ /* CODE_UPDATE { 0, 0 },*/
};
for( PNOR::SectionId id = PNOR::FIRST_SECTION;
OpenPOWER on IntegriCloud