From 446e41da2bde65a199853230e235b0ffa631b0a8 Mon Sep 17 00:00:00 2001 From: Nick Bofferding Date: Thu, 20 Oct 2011 22:47:21 -0500 Subject: Add support for targeting features - Support enums inside of complex types - Support native types (EntityPath) inside complex types - Support integer types (int8,int16,int32,int64) - Determine PNOR virtual base address from host boot code - Allow reuse of enums across multiple attributes Change-Id: I56501b79f354c83310e86854d27de8ce9be61952 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/454 Tested-by: Jenkins Server Reviewed-by: Nicholas E. Bofferding --- src/usr/targeting/xmltohb/attribute_types.xml | 438 ++++++++++++++++---------- src/usr/targeting/xmltohb/makefile | 9 +- src/usr/targeting/xmltohb/target_types.xml | 1 + src/usr/targeting/xmltohb/xmltohb.pl | 326 +++++++++++++------ 4 files changed, 505 insertions(+), 269 deletions(-) (limited to 'src/usr/targeting/xmltohb') diff --git a/src/usr/targeting/xmltohb/attribute_types.xml b/src/usr/targeting/xmltohb/attribute_types.xml index 6adc8037a..343d791ce 100644 --- a/src/usr/targeting/xmltohb/attribute_types.xml +++ b/src/usr/targeting/xmltohb/attribute_types.xml @@ -28,45 +28,200 @@ Contains the definition of all hostboot attributes ================================================================= --> + + CLASS + Enumeration indicating the target's class + + NA + 0 + + + CARD + 1 + + + ENC + 2 + + + CHIP + 3 + + + UNIT + 4 + + + DEV + 5 + + + SYS + 6 + + + MAX + 7 + + NA + + + + TYPE + Enumeration indicating the target's type + + NA + 0 + + + SYS + + + NODE + + + DIMM + + + SCM + + + DCM + + + MEMBUF + + + PROC + + + MEMVRM + + + PROCVRM + + + EX + + + CORE + + + L2 + + + L3 + + + L4 + + + MCS + + + MBS + + + MBA + + + MEM_PORT + + + PERVASIVE + + + POWERBUS + + + XBUS + + + ABUS + + + PCI + + + LAST_IN_RANGE + + NA + + + + MODEL + Enumeration indicating the target's model + + NA + 0 + + + SALERNO + 16 + + + VENICE + + + CENTAUR + 48 + + + JEDEC + 80 + + + CDIMM + + + POWER8 + 112 + + NA + + + + ENGINE_TYPE + Enumeration indicating the target's engine type + + NA + 0 + + + ENGINE_IIC + 1 + + + ENGINE_SCOM + 2 + + NA + + + + FSI_MASTER_TYPE + Enumeration indicating the master's FSI type + + MFSI + 0 + + + CMFSI + 1 + + + NO_MASTER + 2 + + NO_MASTER + + CLASS Attribute indicating the target's class - Enumeration indicating the target's class - - NA - 0 - - - CARD - 1 - - - ENC - 2 - - - CHIP - 3 - - - UNIT - 4 - - - DEV - 5 - - - SYS - 6 - - - MAX - 7 - - NA + CLASS non-volatile @@ -79,84 +234,7 @@ Attribute indicating the target's type - Attribute indicating the target's type - - NA - 0 - - - SYS - - - NODE - - - DIMM - - - SCM - - - DCM - - - MEMBUF - - - PROC - - - MEMVRM - - - PROCVRM - - - EX - - - CORE - - - L2 - - - L3 - - - L4 - - - MCS - - - MBS - - - MBA - - - MEM_PORT - - - PERVASIVE - - - POWERBUS - - - XBUS - - - ABUS - - - PCI - - - LAST_IN_RANGE - - NA + TYPE non-volatile @@ -169,34 +247,7 @@ Attribute indicating the target's model - Enumeration indicating the target's model - - NA - 0 - - - SALERNO - 16 - - - VENICE - - - CENTAUR - 48 - - - JEDEC - 80 - - - CDIMM - - - POWER8 - 112 - - NA + MODEL non-volatile @@ -209,20 +260,7 @@ Attribute indicating the target's engine type - Enumeration indicating the target's engine type - - NA - 0 - - - ENGINE_IIC - 1 - - - ENGINE_SCOM - 2 - - NA + ENGINE_TYPE non-volatile @@ -235,7 +273,7 @@ Scratch attribute that can be used for dev/test - 0 + 0 volatile-zeroed @@ -699,23 +737,11 @@ Type of Master FSI connection to this slave (MFSI or cMFSI) - Enumeration indicating the master's FSI type - - MFSI - 0 - - - CMFSI - 1 - - - NO_MASTER - 2 - - NO_MASTER + FSI_MASTER_TYPE non-volatile + @@ -766,6 +792,7 @@ non-volatile + HWAS_STATE HardWare Availability Service State Attribute. @@ -818,6 +845,7 @@ volatile + MSS_EFF_PRIMARY_RANK The effective rank group on each port (0 to 3) for each group 0-3 @@ -835,5 +863,77 @@ DIRECT + + + + NUMERIC_POD_TYPE_TEST + Attribute which tests numeric POD types + + Numeric POD type test structure + + fsiPath + Entity path for testing purposes + EntityPath + physical:sys-0 + + + className + Class for testing purposes + CLASS + CHIP + + + uint8 + Test uint8 + uint8_t + 0xAB + + + uint16 + Test uint16 + uint16_t + 0xABCD + + + uint32 + Test uint32 + uint32_t + 0xABCDEF01 + + + uint64 + Test uint64 + uint64_t + 0xABCDEF0123456789 + + + int8 + Test int8 + int8_t + -124 + + + int16 + Test int16 + int16_t + -32764 + + + int32 + Test int32 + int32_t + -2147483644 + + + int64 + Test int64 + int64_t + -9223372036854775804 + + + non-volatile + + + diff --git a/src/usr/targeting/xmltohb/makefile b/src/usr/targeting/xmltohb/makefile index d4e28dab7..b6234fc60 100644 --- a/src/usr/targeting/xmltohb/makefile +++ b/src/usr/targeting/xmltohb/makefile @@ -48,6 +48,9 @@ XMLTOHB_GENERIC_SOURCES = attribute_types.xml target_types.xml XMLTOHB_FAPIATTR_SOURCES = \ ${ROOTPATH}/src/usr/hwpf/hwp/fapiHwpAttributeInfo.xml +VMM_CONSTS_FILE = \ + ${ROOTPATH}/src/include/usr/vmmconst.h + GENFILES = ${XMLTOHB_TARGETS} EXTRA_PARTS = $(addprefix $(IMGDIR)/, $(XMLTOHB_SYSTEM_BINARIES)) @@ -81,14 +84,14 @@ $(call GENTARGET,$(XMLTOHB_TARGETS)) : \ ${GENDIR}/%.hb.xml: %.system.xml ${XMLTOHB_GENERIC_SOURCES} ./mergexml.sh $^ > $@ - # create the binary files -${GENDIR}/%_targeting.bin: xmltohb.pl ${GENDIR}/%.hb.xml ${XMLTOHB_FAPIATTR_SOURCES} +${GENDIR}/%_targeting.bin: xmltohb.pl ${GENDIR}/%.hb.xml ${XMLTOHB_FAPIATTR_SOURCES} ${VMM_CONSTS_FILE} ./$< $(addprefix --hb-xml-file=,${GENDIR}/$*.hb.xml) \ $(addprefix --fapi-attributes-xml-file=,\ ${XMLTOHB_FAPIATTR_SOURCES}) \ --src-output-dir=none --img-output-dir=$(dir $@) \ - --img-output-file=$(notdir $@) + --img-output-file=$(notdir $@) \ + --vmm-consts-file=$(VMM_CONSTS_FILE) diff --git a/src/usr/targeting/xmltohb/target_types.xml b/src/usr/targeting/xmltohb/target_types.xml index 5cd23608d..2b0cbfe6c 100644 --- a/src/usr/targeting/xmltohb/target_types.xml +++ b/src/usr/targeting/xmltohb/target_types.xml @@ -59,6 +59,7 @@ SCRATCH_UINT32_ARRAY_2 SCRATCH_UINT64_ARRAY_1 SCRATCH_UINT64_ARRAY_2 + NUMERIC_POD_TYPE_TEST DUMMY_RW XSCOM_BASE_ADDRESS diff --git a/src/usr/targeting/xmltohb/xmltohb.pl b/src/usr/targeting/xmltohb/xmltohb.pl index c0eb36949..266f2b522 100755 --- a/src/usr/targeting/xmltohb/xmltohb.pl +++ b/src/usr/targeting/xmltohb/xmltohb.pl @@ -46,6 +46,8 @@ use Text::Wrap; use Data::Dumper; use POSIX; + + ################################################################################ # Process command line parameters, issue help text if needed ################################################################################ @@ -54,6 +56,7 @@ sub main{ } my $cfgSrcOutputDir = "."; my $cfgImgOutputDir = "."; my $cfgHbXmlFile = "./hb.xml"; +my $cfgVmmConstsFile = "../../../include/usr/vmmconst.h"; my $cfgFapiAttributesXmlFile = "../../hwpf/hwp/fapiHwpAttributeInfo.xml"; my $cfgImgOutputFile = "./targeting.bin"; my $cfgHelp = 0; @@ -65,6 +68,7 @@ GetOptions("hb-xml-file:s" => \$cfgHbXmlFile, "img-output-dir:s" => \$cfgImgOutputDir, "fapi-attributes-xml-file:s" => \$cfgFapiAttributesXmlFile, "img-output-file:s" => \$cfgImgOutputFile, + "vmm-consts-file:s" => \$cfgVmmConstsFile, "help" => \$cfgHelp, "man" => \$cfgMan, "verbose" => \$cfgVerbose ) || pod2usage(-verbose => 0); @@ -89,6 +93,7 @@ if($cfgVerbose) print STDOUT "Fapi attributes XML file = $cfgFapiAttributesXmlFile\n"; print STDOUT "Source output dir = $cfgSrcOutputDir\n"; print STDOUT "Image output dir = $cfgImgOutputDir\n"; + print STDOUT "VMM constants file = $cfgVmmConstsFile\n"; } ################################################################################ @@ -100,7 +105,7 @@ my $xml = new XML::Simple (KeyAttr=>[]); # Until full machine parseable workbook parsing splits out all the input files, # use the intermediate representation containing the full host boot model. # Aborts application if file name not found. -my $attributes = $xml->XMLin($cfgHbXmlFile, forcearray => ['attribute','hwpfToHbAttrMap']); +my $attributes = $xml->XMLin($cfgHbXmlFile, forcearray => ['enumerationType','attribute','hwpfToHbAttrMap']); my $fapiAttributes = $xml->XMLin($cfgFapiAttributesXmlFile, forcearray => ['attribute']); # Perform some sanity validation of the model (so we don't have to later) @@ -180,7 +185,7 @@ if( !($cfgImgOutputDir =~ "none") ) or fatal ("Targeting image file: \"$cfgImgOutputDir" . "$cfgImgOutputFile\" could not be opened."); my $pnorFile = *PNOR_TARGETING_FILE; - writeTargetingImage($pnorFile,$attributes); + writeTargetingImage($pnorFile,$cfgVmmConstsFile,$attributes); close $pnorFile; } @@ -677,8 +682,9 @@ sub writeStringImplementationFileStrings { print $outFile "{\n"; print $outFile " switch(i_attrValue)\n"; print $outFile " {\n"; + my $enumerationType = getEnumerationType($attributes,$enumeration->{id}); - foreach my $enumerator (@{$enumeration->{enumerator}}) + foreach my $enumerator (@{$enumerationType->{enumerator}}) { print $outFile " case ", $attribute->{id}, "_", $enumerator->{name},":\n"; @@ -696,6 +702,32 @@ sub writeStringImplementationFileStrings { } } +################################################################################ +# Locate generic attribute definition, given an enumeration ID +################################################################################ + +sub getEnumerationType { + + my($attributes,$id) = @_; + my $matchingEnumeration; + + foreach my $enumerationType (@{$attributes->{enumerationType}}) + { + if($id eq $enumerationType->{id}) + { + $matchingEnumeration = $enumerationType; + last; + } + } + + if(!exists $matchingEnumeration->{id}) + { + fatal("Could not find enumeration with ID of " . $id . "\n"); + } + + return $matchingEnumeration; +} + ################################################################################ # Writes the string implementation file footer ################################################################################ @@ -1011,31 +1043,23 @@ sub writeEnumFileAttrEnums { select($outFile); $~ = 'ENUMFORMAT'; - foreach my $attribute (@{$attributes->{attribute}}) + foreach my $enumerationType (@{$attributes->{enumerationType}}) { - if(exists $attribute->{simpleType}) - { - my $simpleType = $attribute->{simpleType}; - if(exists $simpleType->{enumeration}) - { - my $enumeration = $simpleType->{enumeration}; - print $outFile "/**\n"; - print $outFile wrapBrief( $enumeration->{description} ); - print $outFile " */\n"; - print $outFile "enum ", $attribute->{id}, "\n"; - print $outFile "{\n"; - - foreach my $enumerator (@{$enumeration->{enumerator}}) - { - $enumHex = sprintf "0x%08X", - enumNameToValue($enumeration,$enumerator->{name}); - $enumName = $attribute->{id} . "_" . $enumerator->{name}; - write; - } + print $outFile "/**\n"; + print $outFile wrapBrief( $enumerationType->{description} ); + print $outFile " */\n"; + print $outFile "enum ", $enumerationType->{id}, "\n"; + print $outFile "{\n"; - print $outFile "};\n\n"; - } + foreach my $enumerator (@{$enumerationType->{enumerator}}) + { + $enumHex = sprintf "0x%08X", + enumNameToValue($enumerationType,$enumerator->{name}); + $enumName = $enumerationType->{id} . "_" . $enumerator->{name}; + write; } + + print $outFile "};\n\n"; } } @@ -1265,7 +1289,7 @@ sub getAttributeIdEnumeration { sub unhexify { my($val) = @_; - if($val =~ m/^0[xX][0123456790A-Fa-f]+$/) + if($val =~ m/^0[xX][01234567890A-Fa-f]+$/) { $val = hex($val); } @@ -1279,9 +1303,9 @@ sub unhexify { sub packQuad{ my($quad) = @_; - unhexify($quad); + my $value = unhexify($quad); - return pack("NN" , $quad >> 32, $quad); + return pack("NN" , (($value >> 32) & 0xFFFFFFFF), ($value & 0xFFFFFFFF)); } ################################################################################ @@ -1407,6 +1431,35 @@ sub getInstantiatedTargetTypes { return @uniqueTargetTypes; } +################################################################################ +# Return default value of zero for an attribute which is a POD numerical type +################################################################################ + +sub defaultZero { + my($attributes,$typeInstance) = @_; + + # print STDOUT "Attribute's default value is 0\n"; + + return 0; +} + +################################################################################ +# Return default value for an attribute whose type is 'enumeration' +################################################################################ + +sub defaultEnum { + my($attributes,$enumerationInstance) = @_; + + my $enumerationType = getEnumerationType( + $attributes,$enumerationInstance->{id}); + + # print STDOUT "Attribute enumeration's " . + # "(\"$enumerationType->{id}\") default is: " . + # $enumerationType->{default} . "\n"; + + return $enumerationType->{default}; +} + ################################################################################ # Get hash ref to supported simple types and their properties ################################################################################ @@ -1417,11 +1470,15 @@ sub simpleTypeProperties { # Intentionally didn't wrap these to 80 columns to keep them lined up and # more readable/editable - $typesHoH{"uint8_t"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 1, typeName => "uint8_t" , bytes => 1, bits => 8 , packfmt => "C" }; - $typesHoH{"uint16_t"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 1, typeName => "uint16_t" , bytes => 2, bits => 16, packfmt => "S" }; - $typesHoH{"uint32_t"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 1, typeName => "uint32_t" , bytes => 4, bits => 32, packfmt => "L" }; - $typesHoH{"uint64_t"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 1, typeName => "uint64_t" , bytes => 8, bits => 64, packfmt =>\&packQuad }; - $typesHoH{"enumeration"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 0, typeName => "XMLTOHB_USE_PARENT_ATTR_ID" , bytes => 0, bits => 0 , packfmt => "packEnumeration" }; + $typesHoH{"int8_t"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 1, typeName => "int8_t" , bytes => 1, bits => 8 , default => \&defaultZero, packfmt => "C" }; + $typesHoH{"int16_t"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 1, typeName => "int16_t" , bytes => 2, bits => 16, default => \&defaultZero, packfmt => "n" }; + $typesHoH{"int32_t"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 1, typeName => "int32_t" , bytes => 4, bits => 32, default => \&defaultZero, packfmt => "N" }; + $typesHoH{"int64_t"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 1, typeName => "int64_t" , bytes => 8, bits => 64, default => \&defaultZero, packfmt =>\&packQuad}; + $typesHoH{"uint8_t"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 1, typeName => "uint8_t" , bytes => 1, bits => 8 , default => \&defaultZero, packfmt => "C" }; + $typesHoH{"uint16_t"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 1, typeName => "uint16_t" , bytes => 2, bits => 16, default => \&defaultZero, packfmt => "n" }; + $typesHoH{"uint32_t"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 1, typeName => "uint32_t" , bytes => 4, bits => 32, default => \&defaultZero, packfmt => "N" }; + $typesHoH{"uint64_t"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 1, typeName => "uint64_t" , bytes => 8, bits => 64, default => \&defaultZero, packfmt =>\&packQuad}; + $typesHoH{"enumeration"} = { supportsArray => 1, canBeHex => 1, complexTypeSupport => 0, typeName => "XMLTOHB_USE_PARENT_ATTR_ID" , bytes => 0, bits => 0 , default => \&defaultEnum, packfmt => "packEnumeration"}; return \%typesHoH; } @@ -1446,10 +1503,18 @@ sub getAttributeDefault { { # Note: must check for 'type' before 'default', otherwise # might add value to the hash - if( exists $attribute->{simpleType}->{$type} - && exists $attribute->{simpleType}->{$type}->{default}) + if(exists $attribute->{simpleType}->{$type} ) { - $default = $attribute->{simpleType}->{$type}->{default}; + if(exists $attribute->{simpleType}->{$type}->{default}) + { + $default = + $attribute->{simpleType}->{$type}->{default}; + } + else + { + $default = $simpleTypeProperties->{$type}{default}->( + $attributes,$attribute->{simpleType}->{$type} ); + } last; } } @@ -1730,7 +1795,7 @@ sub releaseAndClear { ################################################################################ sub packComplexType { - my ($complexType,$attributeDefault) = @_; + my ($attributes,$complexType,$attributeDefault) = @_; my $binaryData; my $simpleTypeProperties = simpleTypeProperties(); @@ -1761,10 +1826,23 @@ sub packComplexType { else { $binaryData .= $accumulator->releaseAndClear(); - + + # If native "EntityPath" type, process accordingly + if($field->{type} eq "EntityPath") + { + $binaryData .= packEntityPath($attributes,$default->{value}); + } + # If not a defined simple type, process as an enumeration + elsif(!exists $simpleTypeProperties->{$field->{type}}) + { + my $enumerationType = getEnumerationType( + $attributes,$field->{type}); + my $enumeratorValue = enumNameToValue($enumerationType,$default->{value}); + $binaryData .= packEnumeration($enumerationType,$enumeratorValue); + } # Pack easy types using 'pack', otherwise invoke appropriate # (possibly workaround) callback function - if(exists $simpleTypeProperties->{$field->{type}} + elsif(exists $simpleTypeProperties->{$field->{type}} && $simpleTypeProperties->{$field->{type}} {complexTypeSupport}) { @@ -1810,6 +1888,68 @@ sub packComplexType { return $binaryData; } +################################################################################ +# Pack an entity path into a binary data stream +################################################################################ + +sub packEntityPath { + my($attributes,$value) = @_; + + my $binaryData; + + my $maxPathElements = 8; + my ($typeStr,$path) = split(/:/,$value); + my (@paths) = split(/\//,$path); + + my $type = 0; + if($typeStr eq "physical") + { + $type = 2; + } + elsif($typeStr eq "affinity") + { + $type = 1; + } + else + { + fatal("Unsupported enity path type."); + } + + if( (scalar @paths) > $maxPathElements) + { + fatal("Path elements cannot be greater than $maxPathElements."); + } + + $binaryData .= pack("C", (0xF0 & ($type << 4)) + + (0x0F & (scalar @paths))); + + foreach my $pathElement (@paths) + { + my ($pathType,$pathInstance) = split(/-/,$pathElement); + $pathType = uc($pathType); + + foreach my $attr (@{$attributes->{attribute}}) + { + if($attr->{id} eq "TYPE") + { + $pathType = + enumNameToValue( + getEnumerationType($attributes, + $attr->{simpleType}->{enumeration}->{id}),$pathType); + $binaryData .= pack ("CC", $pathType, $pathInstance); + last; + } + } + } + + if($maxPathElements > (scalar @paths)) + { + $binaryData .= pack("C".(($maxPathElements - scalar @paths)*2)); + } + + return $binaryData; +} + ################################################################################ # Pack an attribute into a binary data stream ################################################################################ @@ -1830,7 +1970,7 @@ sub packAttribute { { if($typeName eq "enumeration") { - my $enumeration = $simpleType->{enumeration}; + my $enumeration = getEnumerationType($attributes,$simpleType->{enumeration}->{id}); # Here $value is the enumerator name my $enumeratorValue = enumNameToValue($enumeration,$value); @@ -1887,7 +2027,7 @@ sub packAttribute { { if(ref ($value) eq "HASH" ) { - $binaryData = packComplexType($attribute->{complexType},$value); + $binaryData = packComplexType($attributes,$attribute->{complexType},$value); } else { @@ -1898,54 +2038,7 @@ sub packAttribute { { if($attribute->{nativeType}->{name} eq "EntityPath") { - my $maxPathElements = 8; - my ($typeStr,$path) = split(/:/,$value); - my (@paths) = split(/\//,$path); - - my $type = 0; - if($typeStr eq "physical") - { - $type = 2; - } - elsif($typeStr eq "affinity") - { - $type = 1; - } - else - { - fatal("Unsupported enity path type."); - } - - if( (scalar @paths) > $maxPathElements) - { - fatal("Path elements cannot be greater than $maxPathElements."); - } - - $binaryData .= pack("C", (0xF0 & ($type << 4)) + - (0x0F & (scalar @paths))); - - foreach my $pathElement (@paths) - { - my ($pathType,$pathInstance) = split(/-/,$pathElement); - $pathType = uc($pathType); - - foreach my $attr (@{$attributes->{attribute}}) - { - if($attr->{id} eq "TYPE") - { - $pathType = - enumNameToValue( - $attr->{simpleType}->{enumeration},$pathType); - $binaryData .= pack ("CC", $pathType, $pathInstance); - last; - } - } - } - - if($maxPathElements > (scalar @paths)) - { - $binaryData .= pack("C".(($maxPathElements - scalar @paths)*2)); - } + $binaryData = packEntityPath($attributes,$value); } else { @@ -1966,12 +2059,42 @@ sub packAttribute { return $binaryData; } +################################################################################ +# Get the PNOR base address from host boot code +################################################################################ + +sub getPnorBaseAddress { + my($vmmConstsFile) = @_; + my $pnorBaseAddress = 0; + + open(VMM_CONSTS_FILE,"<$vmmConstsFile") + or fatal ("VMM Constants file: \"$vmmConstsFile\" could not be opened."); + + foreach my $line () + { + chomp($line); + if( $line =~ /VMM_VADDR_ATTR_RP/) + { + $line =~ s/[^0-9\*]//g; + $pnorBaseAddress = eval $line; + last; + } + } + + if($pnorBaseAddress == 0) + { + fatal("PNOR base address was zero!"); + } + + return $pnorBaseAddress; +} + ################################################################################ # Write the PNOR targeting image ################################################################################ sub writeTargetingImage { - my($outFile, $attributes) = @_; + my($outFile, $vmmConstsFile, $attributes) = @_; # 128 MB virtual memory offset between sections #@TODO Need the final value after full host boot support is implemented. @@ -1980,9 +2103,7 @@ sub writeTargetingImage { # Virtual memory addresses corresponding to the start of the targeting image # PNOR/heap sections - #@TODO Need the final value of the base address after full host boot support - # is implemented. - my $pnorRoBaseAddress = 0xC0000000; # 3GB - See vmmconst.H. + my $pnorRoBaseAddress = getPnorBaseAddress($vmmConstsFile); my $pnorRwBaseAddress = $pnorRoBaseAddress + $vmmSectionOffset; my $heapPnorInitBaseAddr = $pnorRwBaseAddress + $vmmSectionOffset; my $heapZeroInitBaseAddr = $heapPnorInitBaseAddr + $vmmSectionOffset; @@ -2068,7 +2189,7 @@ sub writeTargetingImage { # Reserve # pointers * sizeof(pointer) my $startOfAttributePointers = $offset; - print "Total attributes = $numAttributes\n"; + # print "Total attributes = $numAttributes\n"; $offset += ($numAttributes * (length packQuad(0) )); # Now we can determine the pointer to the number of targets @@ -2197,8 +2318,9 @@ sub writeTargetingImage { my $rwdata = packAttribute($attributes,$attributeDef, $attrhash{$attributeId}->{default}); - print "Wrote to pnor-rw value ",$attributeDef->{id}, ", - ", $attrhash{$attributeId}->{default}," \n"; + #print "Wrote to pnor-rw value ",$attributeDef->{id}, ", + #", $attrhash{$attributeId}->{default}," \n"; + $attributePointerBinData .= packQuad( $rwOffset + $pnorRwBaseAddress); @@ -2255,7 +2377,6 @@ sub writeTargetingImage { } # Build header data - #@TODO Need header file for host boot which lays out the header my $headerBinData; my $blockSize = 4*1024; @@ -2391,6 +2512,17 @@ directory) Sets the output directory for generated binary files (default is the current directory) +=item B<--img-output-file>=FILE + +Sets the file to receive the PNOR targeting image output (default +./targeting.bin). Only used when generating the PNOR targeting image + +=item B<--vmm-consts-file>=FILE + +Indicates the file containing the base virtual address of the attributes +(default is src/include/usr/vmmconst.h). Only used when generating the PNOR +targeting image + =item B<--verbose> Prints out some internal workings -- cgit v1.2.1