diff options
Diffstat (limited to 'src/usr/targeting')
6 files changed, 72 insertions, 9 deletions
diff --git a/src/usr/targeting/common/Targets.pm b/src/usr/targeting/common/Targets.pm index a61340fda..9ee8c7a0b 100644 --- a/src/usr/targeting/common/Targets.pm +++ b/src/usr/targeting/common/Targets.pm @@ -646,7 +646,8 @@ sub buildAffinity my $node_aff = ""; my $sys_pos = 0; # There is always a single system target my $mcbist = -1; - my $num_mc = 0 ; + my $num_mc = 0 ; + my @tpm_list = (); # The list of TPMs found on the system $multiNode = 0; @@ -725,18 +726,16 @@ sub buildAffinity elsif ($type eq "TPM") { $tpm++; + push @tpm_list, $target; $self->{targeting}{SYS}[0]{NODES}[$node]{TPMS}[$tpm]{KEY} = $target; my $tpm_phys = $node_phys . "/tpm-$tpm"; - my $tpm_aff = $node_aff . "/tpm-$tpm"; - $self->setHuid($target, $sys_pos, $node); $self->setAttribute($target, "FAPI_NAME",$self->getFapiName($type)); $self->setAttribute($target, "FAPI_POS", $pos); $self->setAttribute($target, "PHYS_PATH", $tpm_phys); - $self->setAttribute($target, "AFFINITY_PATH", $tpm_aff); $self->setAttribute($target, "ORDINAL_ID", $tpm); } elsif ($type eq "BMC") @@ -872,10 +871,74 @@ sub buildAffinity $self->processMc($target, $sys_pos, $node, $proc, $parent_affinity, $parent_physical, $node_phys); } + } # foreach + + # Now populate the affinity path of each TPM. Do this after the main loop + # because we need to make sure that all of the procs have been processed + $tpm = 0; + foreach my $tpm_target (@tpm_list) + { + my $affinity_path = $self->getTpmAffinityPath($tpm_target, $tpm); + $self-> + setAttribute($tpm_target, "AFFINITY_PATH", $affinity_path); + $tpm++; } } +# Get the affinity path of the passed TPM target. The affinity path +# is the physical path of the TPM's I2C master (necessarily a PROC) +# with TPM number appended. +sub getTpmAffinityPath +{ + my $self = shift; + my $target = shift; + my $tpm_number = shift; + + my $affinity_path = ""; + + my $target_type = $self->getAttribute($target, "TYPE"); + if($target_type ne "TPM") + { + die "Attempted to get TPM affinity path" . + " on non-TPM target ($target_type)"; + } + + my $parentProcsPtr = $self->findDestConnections($target, "I2C", ""); + + if($parentProcsPtr eq "") + { + $affinity_path = "affinity:sys-0/node-0/proc-0/tpm-$tpm_number"; + } + else + { + my @parentProcsList = @{$parentProcsPtr->{CONN}}; + my $numConnections = scalar @parentProcsList; + + if($numConnections != 1) + { + die "Incorrect number of parent procs ($numConnections)". + " found for TPM$tpm_number"; + } + + # TPM is only connected to one proc, so we can fetch just the + # first connection. + my $parentProc = $parentProcsList[0]{SOURCE_PARENT}; + if($self->getAttribute($parentProc, "TYPE") ne "PROC") + { + die "Upstream I2C connection to TPM$tpm_number is not type PROC!"; + } + + # Look at the I2C master's physical path; replace + # "physical" with "affinity" and append tpm number + $affinity_path = $self->getAttribute($parentProc, "PHYS_PATH"); + $affinity_path =~ s/physical/affinity/g; + $affinity_path = $affinity_path . "/tpm-$tpm_number"; + } + + return $affinity_path; +} + sub iterateOverChiplets { my $self = shift; diff --git a/src/usr/targeting/common/genHwsvMrwXml.pl b/src/usr/targeting/common/genHwsvMrwXml.pl index ee2bcb35e..3b3013269 100755 --- a/src/usr/targeting/common/genHwsvMrwXml.pl +++ b/src/usr/targeting/common/genHwsvMrwXml.pl @@ -6268,7 +6268,7 @@ sub generate_tpm # Compute the rest of the attributes my $huidAttr = sprintf("0x%02X31%04X",${node},$position); my $physPathAttr = "physical:sys-$sys/node-$node/tpm-$position"; - my $affinityPathAttr = "affinity:sys-$sys/node-$node/tpm-$position"; + my $affinityPathAttr = "affinity:sys-$sys/node-$node/proc-$proc/tpm-$position"; my $ordinalIdAttr = "$ordinalId"; my $positionAttr = $position; my $instancePathAttr = "$instancePath"; diff --git a/src/usr/targeting/common/xmltohb/simics_CUMULUS.system.xml b/src/usr/targeting/common/xmltohb/simics_CUMULUS.system.xml index 887d1d0c9..cd468970c 100644 --- a/src/usr/targeting/common/xmltohb/simics_CUMULUS.system.xml +++ b/src/usr/targeting/common/xmltohb/simics_CUMULUS.system.xml @@ -720,7 +720,7 @@ <type>chip-tpm-cectpm</type> <attribute> <id>AFFINITY_PATH</id> - <default>affinity:sys-0/node-0/tpm-0</default> + <default>affinity:sys-0/node-0/proc-0/tpm-0</default> </attribute> <attribute> <id>HUID</id> diff --git a/src/usr/targeting/common/xmltohb/simics_CUMULUS_CDIMM.system.xml b/src/usr/targeting/common/xmltohb/simics_CUMULUS_CDIMM.system.xml index 934f83e2b..a35956813 100644 --- a/src/usr/targeting/common/xmltohb/simics_CUMULUS_CDIMM.system.xml +++ b/src/usr/targeting/common/xmltohb/simics_CUMULUS_CDIMM.system.xml @@ -733,7 +733,7 @@ <type>chip-tpm-cectpm</type> <attribute> <id>AFFINITY_PATH</id> - <default>affinity:sys-0/node-0/tpm-0</default> + <default>affinity:sys-0/node-0/proc-0/tpm-0</default> </attribute> <attribute> <id>HUID</id> diff --git a/src/usr/targeting/common/xmltohb/simics_NIMBUS.system.xml b/src/usr/targeting/common/xmltohb/simics_NIMBUS.system.xml index afc3b2f80..1ef322818 100644 --- a/src/usr/targeting/common/xmltohb/simics_NIMBUS.system.xml +++ b/src/usr/targeting/common/xmltohb/simics_NIMBUS.system.xml @@ -213,7 +213,7 @@ <type>chip-tpm-cectpm</type> <attribute> <id>AFFINITY_PATH</id> - <default>affinity:sys-0/node-0/tpm-0</default> + <default>affinity:sys-0/node-0/proc-0/tpm-0</default> </attribute> <attribute> <id>HUID</id> diff --git a/src/usr/targeting/common/xmltohb/vbu_NIMBUS.system.xml b/src/usr/targeting/common/xmltohb/vbu_NIMBUS.system.xml index a011a2434..b61fa0166 100644 --- a/src/usr/targeting/common/xmltohb/vbu_NIMBUS.system.xml +++ b/src/usr/targeting/common/xmltohb/vbu_NIMBUS.system.xml @@ -172,7 +172,7 @@ <type>chip-tpm-cectpm</type> <attribute> <id>AFFINITY_PATH</id> - <default>affinity:sys-0/node-0/tpm-0</default> + <default>affinity:sys-0/node-0/proc-0/tpm-0</default> </attribute> <attribute> <id>HUID</id> |