diff options
author | Sampa Misra <sampmisr@in.ibm.com> | 2018-10-08 03:54:37 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-11-27 08:34:21 -0600 |
commit | ac53c27a467b524a906ee4a92ff6a79759f77977 (patch) | |
tree | 0c6c5fa8c254c0de1b3290e7bcf4e73adcf7c1c0 | |
parent | 4288e39bf210c36431cbc59cb9eb7a0371510042 (diff) | |
download | blackbird-hostboot-ac53c27a467b524a906ee4a92ff6a79759f77977.tar.gz blackbird-hostboot-ac53c27a467b524a906ee4a92ff6a79759f77977.zip |
all scripts for hdat pnor partition
Change-Id: Ied9c154d544d65eebfe5cfb0185ccb26545ee130
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/67144
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Jayashankar Padath <jayashankar.padath@in.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r-- | src/build/buildpnor/defaultPnorLayout.xml | 9 | ||||
-rwxr-xr-x | src/build/mkrules/dist.targets.mk | 3 | ||||
-rw-r--r-- | src/include/usr/pnor/pnor_const.H | 3 | ||||
-rw-r--r-- | src/usr/hdat/genHdatBin.pl | 166 | ||||
-rw-r--r-- | src/usr/hdat/hdatBinLayout.xml | 193 | ||||
-rw-r--r-- | src/usr/hdat/makefile | 3 | ||||
-rw-r--r-- | src/usr/pnor/pnor_utils.C | 1 | ||||
-rw-r--r-- | src/usr/targeting/common/Targets.pm | 11 | ||||
-rwxr-xr-x | src/usr/targeting/common/genHDATstructures.pl | 12 |
9 files changed, 392 insertions, 9 deletions
diff --git a/src/build/buildpnor/defaultPnorLayout.xml b/src/build/buildpnor/defaultPnorLayout.xml index dc6c68143..505db8c48 100644 --- a/src/build/buildpnor/defaultPnorLayout.xml +++ b/src/build/buildpnor/defaultPnorLayout.xml @@ -316,4 +316,13 @@ Layout Description <readOnly/> <ecc/> </section> + <section> + <description>HDAT Data (16K)</description> + <eyeCatch>HDAT</eyeCatch> + <physicalOffset>0x3BD0000</physicalOffset> + <physicalRegionSize>0x4000</physicalRegionSize> + <side>sideless</side> + <sha512Version/> + <ecc/> + </section> </pnor> diff --git a/src/build/mkrules/dist.targets.mk b/src/build/mkrules/dist.targets.mk index 422c2bad6..050bc0d94 100755 --- a/src/build/mkrules/dist.targets.mk +++ b/src/build/mkrules/dist.targets.mk @@ -86,6 +86,8 @@ COPY_FILES = \ src/build/buildpnor/memd_creation.pl:openpower \ src/usr/targeting/common/processMrw.pl:openpower \ src/usr/targeting/common/Targets.pm:openpower \ + src/usr/targeting/common/genHDATstructures.pl:openpower \ + src/usr/hdat/genHdatBin.pl:openpower \ src/usr/targeting/common/filter_out_unwanted_attributes.pl:openpower \ src/usr/targeting/common/xmltohb/mergexml.sh:openpower \ src/usr/targeting/common/xmltohb/attribute_types.xml:openpower \ @@ -96,6 +98,7 @@ COPY_FILES = \ src/usr/targeting/common/xmltohb/simics_CUMULUS_CDIMM.system.xml:openpower \ src/usr/targeting/common/xmltohb/simics_AXONE.system.xml:openpower \ src/usr/targeting/common/xmltohb/xmltohb.pl:openpower \ + src/usr/hdat/hdatBinLayout.xml:openpower \ src/usr/targeting/xmltohb/updatetempsxml.pl:openpower \ src/include/usr/vmmconst.h:openpower \ src/usr/targeting/common/xmltohb/bios.xsd:openpower \ diff --git a/src/include/usr/pnor/pnor_const.H b/src/include/usr/pnor/pnor_const.H index 9b48db7ff..e8716c12c 100644 --- a/src/include/usr/pnor/pnor_const.H +++ b/src/include/usr/pnor/pnor_const.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2017 */ +/* Contributors Listed Below - COPYRIGHT 2015,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -74,6 +74,7 @@ enum SectionId MEMD, /**< Memory configuration data */ TESTLOAD, /**< Secureboot test load */ CENTAUR_HW_IMG, /**< Centaur HCODE Reference image */ + HDAT, /**< HDAT data */ #endif NUM_SECTIONS, /**< Number of defined sections */ diff --git a/src/usr/hdat/genHdatBin.pl b/src/usr/hdat/genHdatBin.pl new file mode 100644 index 000000000..e598486a8 --- /dev/null +++ b/src/usr/hdat/genHdatBin.pl @@ -0,0 +1,166 @@ +#!/usr/bin/perl +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/hdat/genHdatBin.pl $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2017,2018 +# [+] International Business Machines Corp. +# +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. See the License for the specific language governing +# permissions and limitations under the License. +# +# IBM_PROLOG_END_TAG + +use strict; +use warnings; +use XML::LibXML; +use feature 'say'; +use Class::Struct; +use File::stat; +use File::Copy; + +my $cfgBigEndian = 1; + +################################################################################ +# Pack 2 byte value into a buffer using configured endianness +################################################################################ + +sub pack4byte { + my($value) = @_; + + my $binaryData; + if($cfgBigEndian) + { + $binaryData = pack("N",$value); + } + else # Little endian + { + $binaryData = pack("V",$value); + } + + return $binaryData; +} + +my $layoutFile = 'hdatBinLayout.xml'; +my $dom = XML::LibXML->load_xml(location => $layoutFile); + +# verify if collective bins size if less than max size + +validateMaxSize($dom); +my %toc = createToc($dom); +my $chkSum = createChecksum($dom); +my $ver = '104q'; +my $hdatBin = "hdat.bin"; +open ( my $hdatBinfh , '>', $hdatBin) + or die "Can't open > $hdatBin: $!"; +binmode($hdatBinfh); +print $hdatBinfh $ver; +print $hdatBinfh $chkSum; +foreach my $my_key ( sort keys %toc ) +{ + print $hdatBinfh $my_key; + print $hdatBinfh $toc{$my_key}; +} +seek($hdatBinfh,0x1014,0); + +my $tmpFile = "./tempFile"; +open my $totbinfh , '<', $tmpFile; +binmode($totbinfh); +local $/; +my $buffer = <$totbinfh>; +print $hdatBinfh $buffer; +close $totbinfh; +close $hdatBinfh; + +sub validateMaxSize +{ + my $dom = shift; + my $totSize = 0; + my $headerSize = 0x1014; #tocsize + checksum size + version size + foreach my $binFile ( $dom->findnodes('/hdat/section')) + { + if (-e $binFile->findvalue('./fileName')) + { + say $binFile->findvalue('./fileName'); + $totSize += (stat($binFile->findvalue('./fileName')))->size; + } + else + { + say $binFile->findvalue('./fileName'), "doesnt exist"; + } + } + my $maxsize = hex($dom->findvalue('/hdat/metadata/maxSize')); + say $maxsize; + if($maxsize < ($totSize + $headerSize)) + { + #say $dom->findvalue('/hdat/metaData/maxSize'); + #say ($totSize + $headerSize); + die " collective size of binaries is more than max size , $totSize"; + } + +} + +sub createToc +{ + my $dom = shift; + my %toc = (); + my $offset = 0x1014; + foreach my $binFile ( $dom->findnodes('/hdat/section')){ + if (-e $binFile->findvalue('./fileName')) + { + $toc{pack4byte($offset)} = pack4byte((stat($binFile->findvalue('./fileName')))->size); + $offset += ((stat($binFile->findvalue('./fileName')))->size); + } + else + { + $toc{pack4byte($offset)} = pack4byte(0); + $offset += 4; #its a hash, so bump up by 4 bytes for uniqueness + } + } + return %toc; +} + + + +sub createChecksum +{ + my $dom = shift; + my $tmpFile = "./tempFile"; + open my $totbinfh , '>', $tmpFile; + binmode($totbinfh); + foreach my $section ( $dom->findnodes('/hdat/section')){ + if (-e $section->findvalue('./fileName')) + { + local $/; + open my $sectBinfh, '<', $section->findvalue('./fileName'); + binmode($sectBinfh); + my $data = <$sectBinfh>; + print $totbinfh $data; + close $sectBinfh; + say $section->findvalue('./fileName'); + } + else + { + print $totbinfh pack4byte(0); # if the file doesn't exist,fill 4 byte 0's. + say $section->findvalue('./fileName'), "is empty"; + } + } + my @md5= split / /, `md5sum ./tempFile`; + close $tmpFile; + say 'checksum is'.$md5[0]; + return $md5[0]; +} + diff --git a/src/usr/hdat/hdatBinLayout.xml b/src/usr/hdat/hdatBinLayout.xml new file mode 100644 index 000000000..16431fefe --- /dev/null +++ b/src/usr/hdat/hdatBinLayout.xml @@ -0,0 +1,193 @@ +<!-- IBM_PROLOG_BEGIN_TAG --> +<!-- This is an automatically generated prolog. --> +<!-- --> +<!-- $Source: src/usr/hdat/hdatBinLayout.xml $ --> +<!-- --> +<!-- OpenPOWER HostBoot Project --> +<!-- --> +<!-- Contributors Listed Below - COPYRIGHT 2017,2018 --> +<!-- [+] International Business Machines Corp. --> +<!-- --> +<!-- --> +<!-- Licensed under the Apache License, Version 2.0 (the "License"); --> +<!-- you may not use this file except in compliance with the License. --> +<!-- You may obtain a copy of the License at --> +<!-- --> +<!-- http://www.apache.org/licenses/LICENSE-2.0 --> +<!-- --> +<!-- Unless required by applicable law or agreed to in writing, software --> +<!-- distributed under the License is distributed on an "AS IS" BASIS, --> +<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or --> +<!-- implied. See the License for the specific language governing --> +<!-- permissions and limitations under the License. --> +<!-- --> +<!-- IBM_PROLOG_END_TAG --> +<!-- +Layout Description +<metadata> Element -> Contains high-level information about the HDAT binary layout. + <maxSize> -> Max size of HDAT pnor section + <version> -> Version + <tocSize> -> size of TOC + <checkSum/> -> Checksum of whole HDAT Binary Image. +</metadata> +<section> Element -> Contains information about a HDAT binary entity + <description> -> Text description of the binary entity + <eyeCatch> -> Name of the Entity foreg: SLOTMAP + <fileName> -> Binary File name + <instance> -> Instance foreg:, proc0 , proc1 +</section> +--> + +<hdat> + <metadata> + <maxSize>0x4000</maxSize> + <version>10.5d</version> + <tocSize>0x1000</tocSize> + <checksum/> + </metadata> + <section> + <description>Slot Map Table Area binary data</description> + <eyeCatch>SLOTMAP_TABLE</eyeCatch> + <instance>proc0</instance> + <fileName>slotmapproc0</fileName> + </section> + <section> + <description>Slot Map Table Area binary data</description> + <eyeCatch>SLOTMAP_TABLE</eyeCatch> + <instance>proc1</instance> + <fileName>slotmapproc1</fileName> + </section> + <section> + <description>Slot Map Table Area binary data</description> + <eyeCatch>SLOTMAP_TABLE</eyeCatch> + <instance>proc2</instance> + <fileName>slotmapproc2</fileName> + </section> + <section> + <description>Slot Map Table Area binary data</description> + <eyeCatch>SLOTMAP_TABLE</eyeCatch> + <instance>proc3</instance> + <fileName>slotmapproc3</fileName> + </section> + <section> + <description>Slot Map Entry details binary data</description> + <eyeCatch>SLOTMAP_ENTRY</eyeCatch> + <instance>proc0</instance> + <fileName>slotdetailsproc0</fileName> + </section> + <section> + <description>Slot Map Entry details binary data</description> + <eyeCatch>SLOTMAP_ENTRY</eyeCatch> + <instance>proc1</instance> + <fileName>slotdetailsproc1</fileName> + </section> + <section> + <description>Slot Map Entry details binary data</description> + <eyeCatch>SLOTMAP_ENTRY</eyeCatch> + <instance>proc2</instance> + <fileName>slotdetailsproc2</fileName> + </section> + <section> + <description>Slot Map Entry details binary data</description> + <eyeCatch>SLOTMAP_ENTRY</eyeCatch> + <instance>proc3</instance> + <fileName>slotdetailsproc3</fileName> + </section> + <section> + <description>SMP Link proc 0 6gpu binary data</description> + <eyeCatch>SMPLINK_INFO_6GPU</eyeCatch> + <instance>proc0</instance> + <fileName>smplinkproc0_oc1</fileName> + </section> + <section> + <description>SMP Link proc 1 6gpu binary data</description> + <eyeCatch>SMPLINK_INFO_6GPU</eyeCatch> + <instance>proc1</instance> + <fileName>smplinkproc1_oc1</fileName> + </section> + <section> + <description>SMP Link proc 2 6gpu binary data</description> + <eyeCatch>SMPLINK_INFO_6GPU</eyeCatch> + <instance>proc2</instance> + <fileName>smplinkproc2_oc1</fileName> + </section> + <section> + <description>SMP Link proc 3 6gpu binary data</description> + <eyeCatch>SMPLINK_INFO_6GPU</eyeCatch> + <instance>proc3</instance> + <fileName>smplinkproc3_oc1</fileName> + </section> + <section> + <description>SMP Link proc 0 4gpu binary data</description> + <eyeCatch>SMPLINK_INFO_4GPU</eyeCatch> + <instance>proc0</instance> + <fileName>smplinkproc0_oc2</fileName> + </section> + <section> + <description>SMP Link proc 1 4gpu binary data</description> + <eyeCatch>SMPLINK_INFO_4GPU</eyeCatch> + <instance>proc1</instance> + <fileName>smplinkproc1_oc2</fileName> + </section> + <section> + <description>SMP Link proc 2 4gpu binary data</description> + <eyeCatch>SMPLINK_INFO_4GPU</eyeCatch> + <instance>proc2</instance> + <fileName>smplinkproc2_oc2</fileName> + </section> + <section> + <description>SMP Link proc 3 4gpu binary data</description> + <eyeCatch>SMPLINK_INFO_4GPU</eyeCatch> + <instance>proc3</instance> + <fileName>smplinkproc3_oc2</fileName> + </section> + <section> + <description>I2c Map info binary data</description> + <eyeCatch>I2CMAP_INFO</eyeCatch> + <instance>proc0</instance> + <fileName>i2cmapproc0</fileName> + </section> + <section> + <description>I2c Map info binary data</description> + <eyeCatch>I2CMAP_INFO</eyeCatch> + <instance>proc1</instance> + <fileName>i2cmapproc1</fileName> + </section> + <section> + <description>I2c Map info binary data</description> + <eyeCatch>I2CMAP_INFO</eyeCatch> + <instance>proc2</instance> + <fileName>i2cmapproc2</fileName> + </section> + <section> + <description>I2c Map info binary data</description> + <eyeCatch>I2CMAP_INFO</eyeCatch> + <instance>proc3</instance> + <fileName>i2cmapproc3</fileName> + </section> + <section> + <description>SMP Link proc 0 data</description> + <eyeCatch>SMPLINK_INFO</eyeCatch> + <instance>proc0</instance> + <fileName>smplinkproc0</fileName> + </section> + <section> + <description>SMP Link proc 1 data</description> + <eyeCatch>SMPLINK_INFO</eyeCatch> + <instance>proc1</instance> + <fileName>smplinkproc1</fileName> + </section> + <section> + <description>SMP Link proc 2 data</description> + <eyeCatch>SMPLINK_INFO</eyeCatch> + <instance>proc2</instance> + <fileName>smplinkproc2</fileName> + </section> + <section> + <description>SMP Link proc 3 data</description> + <eyeCatch>SMPLINK_INFO</eyeCatch> + <instance>proc3</instance> + <fileName>smplinkproc3</fileName> + </section> +</hdat> + diff --git a/src/usr/hdat/makefile b/src/usr/hdat/makefile index 9e9de6c74..b4add1b8e 100644 --- a/src/usr/hdat/makefile +++ b/src/usr/hdat/makefile @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2015,2017 +# Contributors Listed Below - COPYRIGHT 2015,2018 # [+] International Business Machines Corp. # # @@ -27,7 +27,6 @@ ROOTPATH = ../../.. MODULE = hdat EXTRAINCDIR += ../vpd -EXTRAINCDIR += ../../include/usr/vpd EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/common/include OBJS += hdatutil.o diff --git a/src/usr/pnor/pnor_utils.C b/src/usr/pnor/pnor_utils.C index 3e2d64c83..44a4bd03d 100644 --- a/src/usr/pnor/pnor_utils.C +++ b/src/usr/pnor/pnor_utils.C @@ -448,6 +448,7 @@ const char * PNOR::SectionIdToString( uint32_t i_secIdIndex ) "MEMD", /**< PNOR::MEMD : Memory configuration data */ "TESTLOAD", /**< PNOR::TESTLOAD : Secureboot Test Load */ "CENHWIMG", /**< PNOR::CENTAUR_HW_IMG : Centaur HCODE ref image */ + "HDAT", /**< PNOR::HDAT : Hdat Data */ #endif }; diff --git a/src/usr/targeting/common/Targets.pm b/src/usr/targeting/common/Targets.pm index b5597a711..f2a80c709 100644 --- a/src/usr/targeting/common/Targets.pm +++ b/src/usr/targeting/common/Targets.pm @@ -1027,10 +1027,12 @@ sub iterateOverChiplets } else { - # The dynamic bifurcation feature will make duplicate connection - # for single PEC. So just post warning message for the possible - # error in other scenario. - printf("Warning: Found a duplicate connection for PEC %s PHB %s.\n",$pec_num,$phb_num); + # This is our "bug" scenerio. We have found a + # connection, but that PHB element is already + # filled in the array. We need to kill the + # program. + printf("Found a duplicate connection for PEC %s PHB %s.\n",$pec_num,$phb_num); + die "Duplicate PHB bus connection found\n"; } } } @@ -2179,6 +2181,7 @@ sub getAttribute return $target_ptr->{ATTRIBUTES}->{$attribute}->{default}; } + sub getAttributeGroup { my $self = shift; diff --git a/src/usr/targeting/common/genHDATstructures.pl b/src/usr/targeting/common/genHDATstructures.pl index bf0b13589..5150e3a06 100755 --- a/src/usr/targeting/common/genHDATstructures.pl +++ b/src/usr/targeting/common/genHDATstructures.pl @@ -6,7 +6,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2015,2017 +# Contributors Listed Below - COPYRIGHT 2015,2018 # [+] International Business Machines Corp. # # @@ -391,7 +391,15 @@ sub processProcessor my $parent_target = $targetObj->getTargetParent($targetObj->getTargetParent($target)); - my $proc_id = $targetObj->getAttribute($parent_target, "POSITION"); + my $proc_id = 0; + if (!($targetObj->isBadAttribute($parent_target, "POSITION"))) + { + $proc_id = $targetObj->getAttribute($parent_target, "POSITION"); + } + else + { + $targetObj->writeReport("ERROR::proc id not found for $parent_target \n"); + } my $node_id = getParentNodeId($targetObj,$parent_target); my $hosti2centryid = ($node_id << 24) | ($proc_id << 16); |