summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVan Lee <vanlee@us.ibm.com>2012-04-25 21:45:15 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-05-08 10:32:11 -0500
commitc1deed47cb48542d5d5685a488983a6f5e0d82d8 (patch)
tree662e537e4010f7b607b1bceb923e0e106b3b8305
parente5b86b7585a58d0d5878d826f79bdd855336e147 (diff)
downloadtalos-hostboot-c1deed47cb48542d5d5685a488983a6f5e0d82d8.tar.gz
talos-hostboot-c1deed47cb48542d5d5685a488983a6f5e0d82d8.zip
Change xmltohb.pl compiler to support Target pointer.
Change-Id: Ib0ffadc7265dd77da0854f173f5b7d992e7b71fe RTC: 41006 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/942 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-rw-r--r--src/usr/targeting/common/xmltohb/attribute_types.xml18
-rw-r--r--src/usr/targeting/common/xmltohb/simics_MURANO.system.xml48
-rw-r--r--src/usr/targeting/common/xmltohb/simics_VENICE.system.xml128
-rw-r--r--src/usr/targeting/common/xmltohb/target_types.xml2
-rwxr-xr-xsrc/usr/targeting/common/xmltohb/xmltohb.pl123
5 files changed, 295 insertions, 24 deletions
diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml
index 1c1ed6e25..d6f7a573a 100644
--- a/src/usr/targeting/common/xmltohb/attribute_types.xml
+++ b/src/usr/targeting/common/xmltohb/attribute_types.xml
@@ -3403,4 +3403,22 @@
<readable/>
</attribute>
+<attribute>
+ <id>PEER_TARGET</id>
+ <description>Peer target's address of a A/X-bus connection.
+ NULL means address 0 for no peer target. If a
+ target instance overrides the default with the
+ peer target's PHYS_PATH. The target compiler will
+ convert the valid PHYS_PATH string into the runtime
+ virtual address of the peer target instance.
+ </description>
+ <simpleType>
+ <Target_t>
+ <default>NULL</default>
+ </Target_t>
+ </simpleType>
+ <persistency>non-volatile</persistency>
+ <readable/>
+</attribute>
+
</attributes>
diff --git a/src/usr/targeting/common/xmltohb/simics_MURANO.system.xml b/src/usr/targeting/common/xmltohb/simics_MURANO.system.xml
index 6094b4b7c..dc5d611bc 100644
--- a/src/usr/targeting/common/xmltohb/simics_MURANO.system.xml
+++ b/src/usr/targeting/common/xmltohb/simics_MURANO.system.xml
@@ -606,6 +606,10 @@
<id>CHIP_UNIT</id>
<default>1</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-2/abus-1</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -624,6 +628,10 @@
<id>CHIP_UNIT</id>
<default>2</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-2/abus-2</default>
+ </attribute>
</targetInstance>
<!-- murano n0p0 XBUS units -->
@@ -644,6 +652,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-1/xbus-0</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -1182,6 +1194,10 @@
<id>CHIP_UNIT</id>
<default>1</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-3/abus-1</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -1200,6 +1216,10 @@
<id>CHIP_UNIT</id>
<default>2</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-3/abus-2</default>
+ </attribute>
</targetInstance>
<!-- murano n0p1 XBUS units -->
@@ -1220,6 +1240,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-0/xbus-0</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -1759,6 +1783,10 @@
<id>CHIP_UNIT</id>
<default>1</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-0/abus-1</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -1777,6 +1805,10 @@
<id>CHIP_UNIT</id>
<default>2</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-0/abus-2</default>
+ </attribute>
</targetInstance>
<!-- murano n0p2 XBUS units -->
@@ -1797,6 +1829,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-3/xbus-0</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -2335,6 +2371,10 @@
<id>CHIP_UNIT</id>
<default>1</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-1/abus-1</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -2353,6 +2393,10 @@
<id>CHIP_UNIT</id>
<default>2</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-1/abus-2</default>
+ </attribute>
</targetInstance>
<!-- murano n0p3 XBUS units -->
@@ -2373,6 +2417,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-2/xbus-0</default>
+ </attribute>
</targetInstance>
<targetInstance>
diff --git a/src/usr/targeting/common/xmltohb/simics_VENICE.system.xml b/src/usr/targeting/common/xmltohb/simics_VENICE.system.xml
index b820f97aa..5bd76560f 100644
--- a/src/usr/targeting/common/xmltohb/simics_VENICE.system.xml
+++ b/src/usr/targeting/common/xmltohb/simics_VENICE.system.xml
@@ -563,6 +563,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-6/abus-2</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -581,6 +585,10 @@
<id>CHIP_UNIT</id>
<default>1</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-4/abus-1</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -599,6 +607,10 @@
<id>CHIP_UNIT</id>
<default>2</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-2/abus-0</default>
+ </attribute>
</targetInstance>
<!-- Venice n0p0 XBUS units -->
@@ -619,6 +631,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-1/xbus-0</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -1150,6 +1166,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-7/abus-2</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -1168,6 +1188,10 @@
<id>CHIP_UNIT</id>
<default>1</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-5/abus-1</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -1186,6 +1210,10 @@
<id>CHIP_UNIT</id>
<default>2</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-3/abus-0</default>
+ </attribute>
</targetInstance>
<!-- Venice n0p1 XBUS units -->
@@ -1206,6 +1234,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-0/xbus-0</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -1738,6 +1770,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-0/abus-2</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -1756,6 +1792,10 @@
<id>CHIP_UNIT</id>
<default>1</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-6/abus-1</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -1774,6 +1814,10 @@
<id>CHIP_UNIT</id>
<default>2</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-4/abus-0</default>
+ </attribute>
</targetInstance>
<!-- Venice n0p2 XBUS units -->
@@ -1794,6 +1838,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-3/xbus-0</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -2326,6 +2374,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-1/abus-2</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -2344,6 +2396,10 @@
<id>CHIP_UNIT</id>
<default>1</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-7/abus-1</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -2362,6 +2418,10 @@
<id>CHIP_UNIT</id>
<default>2</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-5/abus-0</default>
+ </attribute>
</targetInstance>
<!-- Venice n0p3 XBUS units -->
@@ -2382,6 +2442,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-2/xbus-0</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -2913,6 +2977,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-2/abus-2</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -2931,6 +2999,10 @@
<id>CHIP_UNIT</id>
<default>1</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-0/abus-1</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -2949,6 +3021,10 @@
<id>CHIP_UNIT</id>
<default>2</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-6/abus-0</default>
+ </attribute>
</targetInstance>
@@ -2970,6 +3046,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-5/xbus-0</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -3500,6 +3580,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-3/abus-2</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -3518,6 +3602,10 @@
<id>CHIP_UNIT</id>
<default>1</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-1/abus-1</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -3536,6 +3624,10 @@
<id>CHIP_UNIT</id>
<default>2</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-7/abus-0</default>
+ </attribute>
</targetInstance>
<!-- Venice n0p5 XBUS units -->
@@ -3556,6 +3648,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-4/xbus-0</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -4086,6 +4182,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-4/abus-2</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -4104,6 +4204,10 @@
<id>CHIP_UNIT</id>
<default>1</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-2/abus-1</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -4122,6 +4226,10 @@
<id>CHIP_UNIT</id>
<default>2</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-0/abus-0</default>
+ </attribute>
</targetInstance>
<!-- Venice n0p6 XBUS units -->
@@ -4142,6 +4250,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-7/xbus-0</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -4672,6 +4784,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-5/abus-2</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -4690,6 +4806,10 @@
<id>CHIP_UNIT</id>
<default>1</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-3/abus-1</default>
+ </attribute>
</targetInstance>
<targetInstance>
@@ -4708,6 +4828,10 @@
<id>CHIP_UNIT</id>
<default>2</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-1/abus-0</default>
+ </attribute>
</targetInstance>
<!-- Venice n0p7 XBUS units -->
@@ -4728,6 +4852,10 @@
<id>CHIP_UNIT</id>
<default>0</default>
</attribute>
+ <attribute>
+ <id>PEER_TARGET</id>
+ <default>physical:sys-0/node-0/proc-6/xbus-0</default>
+ </attribute>
</targetInstance>
<targetInstance>
diff --git a/src/usr/targeting/common/xmltohb/target_types.xml b/src/usr/targeting/common/xmltohb/target_types.xml
index a22d8ef1c..e353af812 100644
--- a/src/usr/targeting/common/xmltohb/target_types.xml
+++ b/src/usr/targeting/common/xmltohb/target_types.xml
@@ -505,6 +505,7 @@
<default>ABUS</default>
</attribute>
<attribute><id>CHIP_UNIT</id></attribute>
+ <attribute><id>PEER_TARGET</id></attribute>
</targetType>
<targetType>
@@ -542,6 +543,7 @@
<default>XBUS</default>
</attribute>
<attribute><id>CHIP_UNIT</id></attribute>
+ <attribute><id>PEER_TARGET</id></attribute>
</targetType>
<targetType>
diff --git a/src/usr/targeting/common/xmltohb/xmltohb.pl b/src/usr/targeting/common/xmltohb/xmltohb.pl
index a75d53e49..1abd986d3 100755
--- a/src/usr/targeting/common/xmltohb/xmltohb.pl
+++ b/src/usr/targeting/common/xmltohb/xmltohb.pl
@@ -114,12 +114,15 @@ my $attributes = $xml->XMLin($cfgHbXmlFile,
forcearray => ['enumerationType','attribute','hwpfToHbAttrMap']);
my $fapiAttributes = $xml->XMLin($cfgFapiAttributesXmlFile,
forcearray => ['attribute']);
+# save attributes defined as Target_t type
+my %Target_t = ();
# Perform some sanity validation of the model (so we don't have to later)
validateAttributes($attributes);
validateTargetInstances($attributes);
validateTargetTypes($attributes);
validateTargetTypesExtension($attributes);
+handleTgtPtrAttributes(\$attributes, \%Target_t);
# Open the output files and write them
if( !($cfgSrcOutputDir =~ "none") )
@@ -199,12 +202,14 @@ if( !($cfgSrcOutputDir =~ "none") )
if( !($cfgImgOutputDir =~ "none") )
{
+ my $Data = generateTargetingImage($cfgVmmConstsFile,$attributes,\%Target_t);
+
open(PNOR_TARGETING_FILE,">$cfgImgOutputDir".$cfgImgOutputFile)
or fatal ("Targeting image file: \"$cfgImgOutputDir"
. "$cfgImgOutputFile\" could not be opened.");
- my $pnorFile = *PNOR_TARGETING_FILE;
- writeTargetingImage($pnorFile,$cfgVmmConstsFile,$attributes);
- close $pnorFile;
+ binmode(PNOR_TARGETING_FILE);
+ print PNOR_TARGETING_FILE "$Data";
+ close(PNOR_TARGETING_FILE);
}
exit(0);
@@ -276,6 +281,7 @@ sub validateSubElements {
}
}
+
################################################################################
# Validates attribute element for correctness
################################################################################
@@ -376,6 +382,62 @@ sub validateTargetInstances{
}
}
+################################################################################
+# Convert PHYS_PATH into index for Target_t attribute's value
+################################################################################
+
+sub handleTgtPtrAttributes{
+ my($attributes, $Target_t) = @_;
+
+ my $aId = 0;
+ ${$Target_t}{'NULL'} = $aId;
+ foreach my $attribute (@{${$attributes}->{attribute}})
+ {
+ $aId++;
+ if(exists $attribute->{simpleType} &&
+ exists $attribute->{simpleType}->{'Target_t'})
+ {
+ ${$Target_t}{"$attribute->{id}"} = $aId;
+ }
+ }
+
+ my %TargetList = ();
+ my $index = 1;
+ # Mapping instance's PHYS_PATH to index (1-base)
+ foreach my $targetInstance (@{${$attributes}->{targetInstance}})
+ {
+ foreach my $attr (@{$targetInstance->{attribute}})
+ {
+ if ($attr->{id} eq "PHYS_PATH")
+ {
+ $TargetList{$attr->{default}} = $index++;
+ last;
+ }
+ }
+ }
+ # replace Target_t attribute's value with instance's index
+ foreach my $targetInstance (@{${$attributes}->{targetInstance}})
+ {
+ foreach my $attr (@{$targetInstance->{attribute}})
+ {
+ # An instance has a Target_t attribute
+ if(exists ${$Target_t}{$attr->{id}})
+ {
+ if (exists $TargetList{$attr->{default}})
+ {
+ $attr->{default} = $TargetList{$attr->{default}};
+ }
+ else
+ {
+ fatal("$attr->{id} attribute has an unknown value "
+ . "$attr->{default}\n"
+ . "It must be NULL or a valid PHYS_PATH\n");
+ }
+ }
+ }
+ }
+}
+
sub SOURCE_FILE_GENERATION_FUNCTIONS { }
################################################################################
@@ -1857,6 +1919,7 @@ sub simpleTypeProperties {
$typesHoH{"uint64_t"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 1, typeName => "uint64_t" , bytes => 8, bits => 64, default => \&defaultZero , alignment => 1, specialPolicies =>\&null, packfmt =>\&packQuad};
$typesHoH{"enumeration"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 0, typeName => "XMLTOHB_USE_PARENT_ATTR_ID" , bytes => 0, bits => 0 , default => \&defaultEnum , alignment => 1, specialPolicies =>\&null, packfmt => "packEnumeration"};
$typesHoH{"hbmutex"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 0, typeName => "mutex_t*" , bytes => 8, bits => 64, default => \&defaultZero , alignment => 8, specialPolicies =>\&enforceHbMutex, packfmt =>\&packQuad};
+ $typesHoH{"Target_t"} = { supportsArray => 0, canBeHex => 1, complexTypeSupport => 0, typeName => "TARGETING::Target*" , bytes => 8, bits => 64, default => \&defaultZero , alignment => 8, specialPolicies =>\&null, packfmt =>\&packQuad};
$g_simpleTypeProperties_cache = \%typesHoH;
@@ -2544,8 +2607,8 @@ sub getPnorBaseAddress {
# Write the PNOR targeting image
################################################################################
-sub writeTargetingImage {
- my($outFile, $vmmConstsFile, $attributes) = @_;
+sub generateTargetingImage {
+ my($vmmConstsFile, $attributes, $Target_t) = @_;
# 128 MB virtual memory offset between sections
#@TODO Need the final value after full host boot support is implemented.
@@ -2645,10 +2708,10 @@ sub writeTargetingImage {
# Don't increment the offset; already accounted for
$numTargetsPointer = $pnorRoBaseAddress + $offset;
$numTargetsPointerBinData = packQuad($numTargetsPointer);
-
my $numTargetsBinData = pack("N",$numTargets);
$offset += (length $numTargetsBinData);
+ my $firstTgtPtr = $pnorRoBaseAddress + $offset;
my $roAttrBinData;
my $heapZeroInitOffset = 0;
my $heapZeroInitBinData;
@@ -2666,11 +2729,11 @@ sub writeTargetingImage {
{
my $data;
- # print "TargetInstance: $targetInstance->{id}\n";
- # print " Attributes: ",
- # $attributeListTypeHoH{$targetInstance->{type}}{elements}, "\n" ;
- # print " offset: ",
- # $attributeListTypeHoH{$targetInstance->{type}}{offset}, "\n" ;
+ # print "TargetInstance: $targetInstance->{id}\n";
+ # print " Attributes: ",
+ # $attributeListTypeHoH{$targetInstance->{type}}{elements}, "\n" ;
+ # print " offset: ",
+ # $attributeListTypeHoH{$targetInstance->{type}}{offset}, "\n" ;
# Create target record
$data .= pack('N',
@@ -2757,6 +2820,14 @@ sub writeTargetingImage {
if($section eq "pnor-ro")
{
+ if ((exists ${$Target_t}{$attributeId}) &&
+ ($attrhash{$attributeId}->{default} != 0))
+ {
+ my $index = $attrhash{$attributeId}->{default} - 1;
+ $index *= 20; # length(N + quad + quad)
+ $attrhash{$attributeId}->{default} = $index + $firstTgtPtr;
+ }
+
my ($rodata,$alignment) = packAttribute($attributes,
$attributeDef,
$attrhash{$attributeId}->{default});
@@ -2912,29 +2983,33 @@ sub writeTargetingImage {
fatal("Header data of length " . (length $headerBinData) . " is larger "
. "than allocated amount of $headerSize.");
}
- print $outFile $headerBinData;
+
+ my $outFile;
+ $outFile .= $headerBinData;
my $padSize = sizeBlockAligned((length $headerBinData),$headerSize,1)
- (length $headerBinData);
- print $outFile pack ("@".$padSize);
+ $outFile .= pack ("@".$padSize);
# Remaining data belongs to targeting
- print $outFile $numTargetsPointerBinData;
- print $outFile $attributeListBinData;
- print $outFile $attributePointerBinData;
- print $outFile $numTargetsBinData;
- print $outFile $targetsBinData;
- print $outFile $roAttrBinData;
- print $outFile pack ("@".($sectionHoH{pnorRo}{size} - $offset));
+ $outFile .= $numTargetsPointerBinData;
+ $outFile .= $attributeListBinData;
+ $outFile .= $attributePointerBinData;
+ $outFile .= $numTargetsBinData;
+ $outFile .= $targetsBinData;
+ $outFile .= $roAttrBinData;
+ $outFile .= pack ("@".($sectionHoH{pnorRo}{size} - $offset));
# Serialize PNOR RW section to multiple of 4k page size (pad if necessary)
- print $outFile $rwAttrBinData;
- print $outFile pack("@".($sectionHoH{pnorRw}{size} - $rwOffset));
+ $outFile .= $rwAttrBinData;
+ $outFile .= pack("@".($sectionHoH{pnorRw}{size} - $rwOffset));
# Serialize PNOR initiated heap section to multiple of 4k page size (pad if
# necessary)
- print $outFile $heapPnorInitBinData;
- print $outFile pack("@".($sectionHoH{heapPnorInit}{size}
+ $outFile .= $heapPnorInitBinData;
+ $outFile .= pack("@".($sectionHoH{heapPnorInit}{size}
- $heapPnorInitOffset));
+
+ return $outFile;
}
__END__
OpenPOWER on IntegriCloud