diff options
author | Nick Bofferding <bofferdn@us.ibm.com> | 2013-03-29 00:01:56 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2013-03-29 13:41:30 -0500 |
commit | 467ae10a804451a843409e6b94a3c0108c083939 (patch) | |
tree | e9ccf6beda47303d5df79553bb5c402365431557 /src/usr/targeting/common/xmltohb/xmltohb.pl | |
parent | 192f986571b47f2f3d34556eebd089d9ad55b456 (diff) | |
download | talos-hostboot-467ae10a804451a843409e6b94a3c0108c083939.tar.gz talos-hostboot-467ae10a804451a843409e6b94a3c0108c083939.zip |
Support generic PEER_TARGET navigation
- Updated attribute compiler to lay down FSP specific PEER_TARGETS
- Added common predicate to filter targets with specific value for attribute
- Added generic PEER_TARGET navigation facility to filter utilities
- Added support for platform specific attribute accessor specialization
- Added target function to return target based on HUID
Change-Id: I190087ee7fb24e80185bc955bd994ee14512a704
RTC: 41735
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/3796
Reviewed-by: Brian H. Horton <brianh@linux.ibm.com>
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/targeting/common/xmltohb/xmltohb.pl')
-rwxr-xr-x | src/usr/targeting/common/xmltohb/xmltohb.pl | 85 |
1 files changed, 83 insertions, 2 deletions
diff --git a/src/usr/targeting/common/xmltohb/xmltohb.pl b/src/usr/targeting/common/xmltohb/xmltohb.pl index eb9a39625..89d7af58f 100755 --- a/src/usr/targeting/common/xmltohb/xmltohb.pl +++ b/src/usr/targeting/common/xmltohb/xmltohb.pl @@ -114,6 +114,7 @@ if($cfgVerbose) # Initialize some globals ################################################################################ +use constant INVALID_HUID=>0xffffffff; my $xml = new XML::Simple (KeyAttr=>[]); # Until full machine parseable workbook parsing splits out all the input files, @@ -135,7 +136,14 @@ validateAttributes($attributes); validateTargetInstances($attributes); validateTargetTypes($attributes); validateTargetTypesExtension($attributes); -handleTgtPtrAttributes(\$attributes, \%Target_t); +if($cfgIncludeFspAttributes) +{ + handleTgtPtrAttributesFsp(\$attributes, \%Target_t); +} +else +{ + handleTgtPtrAttributesHb(\$attributes, \%Target_t); +} # Open the output files and write them if( !($cfgSrcOutputDir =~ "none") ) @@ -427,10 +435,42 @@ sub validateTargetInstances{ } ################################################################################ +# Convert Target_t PHYS_PATH into Peer target's HUID - FSP Specific +################################################################################ + +sub handleTgtPtrAttributesFsp +{ + my($attributes) = @_; + + # replace PEER_TARGET attribute<PHYS_PATH> value with PEER's HUID + foreach my $targetInstance (@{${$attributes}->{targetInstance}}) + { + foreach my $attr (@{$targetInstance->{attribute}}) + { + if (exists $attr->{default}) + { + if( ($attr->{default} ne "NULL") + && ($attr->{id} eq "PEER_TARGET")) + { + my $peerHUID = getPeerHuid(${$attributes}, + $attr->{default}); + if($peerHUID == INVALID_HUID) + { + fatal("HUID for Peer Target not found"); + } + $attr->{default} = (hex($peerHUID) << 32); + $attr->{default} = sprintf("0x%X",$attr->{default}); + } + } + } + } +} + +################################################################################ # Convert PHYS_PATH into index for Target_t attribute's value ################################################################################ -sub handleTgtPtrAttributes{ +sub handleTgtPtrAttributesHb{ my($attributes, $Target_t) = @_; my $aId = 0; @@ -482,6 +522,47 @@ sub handleTgtPtrAttributes{ } } +sub getPeerHuid +{ + my($attributes, $peerPhysPath) = @_; + + my $peerHUID = INVALID_HUID; + my $found = 0; + foreach my $targetInstance (@{$attributes->{targetInstance}}) + { + foreach my $attr (@{$targetInstance->{attribute}}) + { + if ($attr->{id} eq "PHYS_PATH") + { + if ($attr->{default} eq $peerPhysPath) + { + # $attr->{id} for HUID might have been lost in the iteration + # Need to repeat iteration + foreach my $attr1 (@{$targetInstance->{attribute}}) + { + if ($attr1->{id} eq "HUID") + { + $peerHUID = $attr1->{default}; + $found = 1; + last; + } + } + if($found) + { + last; + } + } + } + } + if($found) + { + last; + } + } + + return $peerHUID; +} + sub SOURCE_FILE_GENERATION_FUNCTIONS { } ################################################################################ |