summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorRaja Das <rajadas2@in.ibm.com>2015-02-12 12:00:55 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-02-16 12:15:28 -0600
commit34c58e19162834ff5bb8d4ffb9975b50d5a0770a (patch)
tree10f80fce04ce3e129aa0152c87f245c74c9d3880 /src/usr
parent7a51e37d5d7672fbef3a8f3c4a11a652ded9241a (diff)
downloadtalos-hostboot-34c58e19162834ff5bb8d4ffb9975b50d5a0770a.tar.gz
talos-hostboot-34c58e19162834ff5bb8d4ffb9975b50d5a0770a.zip
Targeting: Generate VERSION page for binaries.
Change-Id: Iab58f6a4a6a5e7648e8a20e6f72cc1c9851acea0 CQ: SW293516 CMVC-Coreq: 950300 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15706 Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> Tested-by: Jenkins Server
Diffstat (limited to 'src/usr')
-rwxr-xr-xsrc/usr/targeting/common/xmltohb/xmltohb.pl59
-rw-r--r--src/usr/targeting/xmltohb/makefile5
2 files changed, 60 insertions, 4 deletions
diff --git a/src/usr/targeting/common/xmltohb/xmltohb.pl b/src/usr/targeting/common/xmltohb/xmltohb.pl
index a658c7458..d02c1a7ed 100755
--- a/src/usr/targeting/common/xmltohb/xmltohb.pl
+++ b/src/usr/targeting/common/xmltohb/xmltohb.pl
@@ -74,6 +74,7 @@ my $cfgShortEnums = 0;
my $cfgBigEndian = 1;
my $cfgIncludeFspAttributes = 0;
my $CfgSMAttrFile = "";
+my $cfgAddVersionPage = 0;
GetOptions("hb-xml-file:s" => \$cfgHbXmlFile,
"src-output-dir:s" => \$cfgSrcOutputDir,
@@ -85,6 +86,7 @@ GetOptions("hb-xml-file:s" => \$cfgHbXmlFile,
"big-endian!" => \$cfgBigEndian,
"smattr-output-file:s" => \$CfgSMAttrFile,
"include-fsp-attributes!" => \$cfgIncludeFspAttributes,
+ "version-page!" => \$cfgAddVersionPage,
"help" => \$cfgHelp,
"man" => \$cfgMan,
"verbose" => \$cfgVerbose ) || pod2usage(-verbose => 0);
@@ -113,6 +115,7 @@ if($cfgVerbose)
print STDOUT "Short enums = $cfgShortEnums\n";
print STDOUT "Big endian = $cfgBigEndian\n";
print STDOUT "include-fsp-attributes = $cfgIncludeFspAttributes\n",
+ print STDOUT "version-page = $cfgAddVersionPage\n",
}
################################################################################
@@ -334,9 +337,21 @@ use constant SECTION => 3;
use constant TARGET => 4;
use constant ATTRNAME => 5;
my @attrDataforSM = ();
+
+#Flag which indicates if the script needs to add the 4096 bytes of version
+#checksum as first page in the binary file generated.
+my $addRO_Section_VerPage = 0;
if( !($cfgImgOutputDir =~ "none") )
{
- my $Data = generateTargetingImage($cfgVmmConstsFile,$attributes,\%Target_t);
+ #Version page will be added only if the script is called in with the flag
+ #--version-flag
+ if ($cfgAddVersionPage)
+ {
+ $addRO_Section_VerPage = 1;
+ }
+ #Pass the $addRO_Section_VerPage into the sub rotuine
+ my $Data = generateTargetingImage($cfgVmmConstsFile,$attributes,\%Target_t,
+ $addRO_Section_VerPage);
open(PNOR_TARGETING_FILE,">$cfgImgOutputDir".$cfgImgOutputFile)
or fatal ("Targeting image file: \"$cfgImgOutputDir"
@@ -4958,7 +4973,7 @@ sub serializeAssociations
################################################################################
sub generateTargetingImage {
- my($vmmConstsFile, $attributes, $Target_t) = @_;
+ my($vmmConstsFile, $attributes, $Target_t,$addRO_Section_VerPage) = @_;
# 128 MB virtual memory offset between sections
my $vmmSectionOffset = 128 * 1024 * 1024; # 128MB
@@ -4983,6 +4998,12 @@ sub generateTargetingImage {
my $headerSize = 256;
my $offset = $headerSize;
+
+ #If the file to be created is the HB targeting binary , then it will contain
+ #first page (4096 bytes) as the read-only data checksum. Need to adjust the
+ #read-only section offset.
+ my $versionSectionSize = 4096;
+
# Reserve space for the pointer to the # of targets, update later;
my $numTargetsPointer = 0;
my $numTargetsPointerBinData = pack8byte($numTargetsPointer);
@@ -5747,6 +5768,15 @@ sub generateTargetingImage {
my $blockSize = 4*1024;
my %sectionHoH = ();
+
+ my $roOffset = 0;
+ if ($addRO_Section_VerPage == 1)
+ {
+ #First section to start after 4096 bytes
+ #as RO version data occupies first page in the binary file
+ $roOffset = $versionSectionSize;
+ }
+
$sectionHoH{ pnorRo }{ offset } = 0;
$sectionHoH{ pnorRo }{ type } = 0;
$sectionHoH{ pnorRo }{ size } = sizeBlockAligned($offset,$blockSize,1);
@@ -5867,6 +5897,24 @@ sub generateTargetingImage {
}
my $outFile;
+
+ #HB Targeting binary file will contain <Version Page>+<Targeting Header>+
+ #<Section data>...
+ if ($addRO_Section_VerPage == 1)
+ {
+ #Generate the MD5 checksum value for the read-only data and update the
+ #content of the version section
+ my $versionHeader = "VERSION";
+ $versionHeader .= md5_hex($roAttrBinData);
+
+ $outFile .= $versionHeader;
+ my $versionHeaderPadSize =
+ (sizeBlockAligned ((length $versionHeader),$versionSectionSize,1)
+ - (length $versionHeader));
+ $outFile .= pack ("@".$versionHeaderPadSize);
+ }
+
+ #Append the 256 bytes header data
$outFile .= $headerBinData;
my $padSize = sizeBlockAligned((length $headerBinData),$headerSize,1)
- (length $headerBinData);
@@ -6055,6 +6103,13 @@ generated code.
Omits FSP specific attributes and targets from the generated binaries and
generated code. This is the default behavior.
+=item B<--version-page>
+Adds 4096 bytes of version page as first page in the generated binaries.
+
+=item B<--no-version-page>
+Does not add 4096 bytes of version page as first page in the generated
+binaries . This is the default behavior.
+
=item B<--verbose>
Prints out some internal workings
diff --git a/src/usr/targeting/xmltohb/makefile b/src/usr/targeting/xmltohb/makefile
index 6d1fff381..eb0b05ac2 100644
--- a/src/usr/targeting/xmltohb/makefile
+++ b/src/usr/targeting/xmltohb/makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2011,2014
+# Contributors Listed Below - COPYRIGHT 2011,2015
# [+] International Business Machines Corp.
#
#
@@ -154,5 +154,6 @@ ${GENDIR}/%_targeting.bin: ${XMLTOHB_COMPILER_SCRIPT} ${GENDIR}/%.hb.xml \
$(addprefix --fapi-attributes-xml-file=,${GENDIR}/${XMLTOHB_FAPI_XML}) \
--src-output-dir=none --img-output-dir=$(dir $@) \
--img-output-file=$(notdir $@) \
- --vmm-consts-file=$(VMM_CONSTS_FILE) --noshort-enums
+ --vmm-consts-file=$(VMM_CONSTS_FILE) --noshort-enums \
+ --version-page
OpenPOWER on IntegriCloud