diff options
author | Matt Derksen <v2cibmd@us.ibm.com> | 2016-10-05 16:55:45 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2016-10-06 16:17:10 -0400 |
commit | 84977a2ecf01c521a20bbb6951f3c5fefac5ef8b (patch) | |
tree | 0b51d25dfceeeebbca18312b502c740caa419cb6 /src/usr/targeting/common/genHwsvMrwXml.pl | |
parent | 81420bcfadc3620f8e5267ff550d52a960926f9a (diff) | |
download | talos-hostboot-84977a2ecf01c521a20bbb6951f3c5fefac5ef8b.tar.gz talos-hostboot-84977a2ecf01c521a20bbb6951f3c5fefac5ef8b.zip |
Support new gen3 and gen4 PHB equalization-setting
Change-Id: Idd8c274beb45adf1dfdf15b321bc113e34e5f937
RTC:160416
CMVC-Prereq:1007474
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30762
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/targeting/common/genHwsvMrwXml.pl')
-rwxr-xr-x | src/usr/targeting/common/genHwsvMrwXml.pl | 198 |
1 files changed, 115 insertions, 83 deletions
diff --git a/src/usr/targeting/common/genHwsvMrwXml.pl b/src/usr/targeting/common/genHwsvMrwXml.pl index e209e5d29..9e688e020 100755 --- a/src/usr/targeting/common/genHwsvMrwXml.pl +++ b/src/usr/targeting/common/genHwsvMrwXml.pl @@ -658,11 +658,11 @@ my $ProcPcie = parse_xml_file($proc_pcie_settings_file, my %procPcieTargetList = (); my $pcieInit = 0; -# MAX Phb values Per PROC is 4 and is hard coded here -use constant MAX_NUM_PHB_PER_PROC => 4; +# MAX Phb values Per PROC is 6 in P9 and is hard coded here +use constant MAX_NUM_PHB_PER_PROC => 6; -# MAX lane settings value is 32 bytes per phb and is hard coded here -use constant MAX_LANE_SETTINGS_PER_PHB => 32; +# MAX lane settings value is 16 lanes per phb and is hard coded here +use constant MAX_LANE_SETTINGS_PER_PHB => 16; ################################################################################ # If value is hex, convert to regular number @@ -689,7 +689,8 @@ sub pcie_init ($) use bigint; my $procPcieKey = ""; - my @phb_value = (); + my @gen3_phb_values = (); # [PHB#][lane#] = uint16 value + my @gen4_phb_values = (); # [PHB#][lane#] = uint16 value my $procPcieIopConfig = 0; my $procPciePhbActive = 0; $procPcieKey = sprintf("n%dp%d\,", $proc->{'target'}->{'node'}, @@ -697,93 +698,119 @@ sub pcie_init ($) if(!(exists($procPcieTargetList{$procPcieKey}))) { - # Loop through each PHB which each contain 32 Bytes of EQ + # Loop through each PHB which each contain 32 bytes (2 bytes * 16) of EQ foreach my $Phb (@{$proc->{'phb-settings'}}) { my $phb_number = 0; + if(exists($Phb->{'phb-number'})) + { + $phb_number = $Phb->{'phb-number'}; + } + else + { + die "ERROR: phb-number does not exist for + proc:$procPcieKey\n"; + } + # Each PHB has 16 lanes (Each lane containing 2 total bytes of EQ) foreach my $Lane (@{$Phb->{'lane-settings'}}) { my $lane_number = 0; - foreach my $Equ (@{$Lane->{'equalization-setting'}}) + if(exists($Lane->{'lane-number'})) { - if(exists($Phb->{'phb-number'})) - { - $phb_number = $Phb->{'phb-number'}; - } - else - { - die "ERROR: phb-number does not exist for - proc:$procPcieKey\n"; - } - if(exists($Lane->{'lane-number'})) - { - $lane_number = $Lane->{'lane-number'}; - } - else + $lane_number = $Lane->{'lane-number'}; + } + else + { + die "ERROR: lane-number does not exist for + proc:$procPcieKey\n"; + } + + my $gen = 3; + my $pPhb_value = \@gen3_phb_values; + while ($gen < 5) # go through gen3 and gen4 + { + if ($gen == 4) { - die "ERROR: lane-number does not exist for - proc:$procPcieKey\n"; + $pPhb_value = \@gen4_phb_values } - - # Accumulate all values for each of the lanes from the MRW - # (2 Bytes) - # First Byte: - # - Nibble 1: up_rx_hint (bit 0 reserved) - # - Nibble 2: up_tx_preset - # Second Byte: - # - Nibble 1: dn_rx_hint (bit 0 reserved) - # - Nibble 2: dn_tx_preset - if($Equ->{'type'} eq 'up_rx_hint') + my $genKey = "gen".$gen; + foreach my $Equ (@{$Lane->{$genKey}{'equalization-setting'}}) { - $phb_value[$phb_number][$lane_number*2] = - $phb_value[$phb_number][$lane_number*2] | - (($Equ->{value} & 0x07) << 4); - if($Equ->{value} > 0x7) + my $eq_value = hex($Equ->{value}); + + # Accumulate all values for each of the lanes from the MRW + # (2 Bytes) + # First Byte: + # - Nibble 1: up_rx_hint (bit 0 reserved) + # - Nibble 2: up_tx_preset + # Second Byte: + # - Nibble 1: dn_rx_hint (bit 0 reserved) + # - Nibble 2: dn_tx_preset + + if($Equ->{'type'} eq 'up_rx_hint') { - die "ERROR: Attempting to modify the - reserved bit\n"; + $pPhb_value->[$phb_number][$lane_number] = + $pPhb_value->[$phb_number][$lane_number] | + (($eq_value & 0x0007) << 12); + if($eq_value > 0x7) + { + die "ERROR: Attempting to modify the + reserved bit in $genKey PHB$phb_number + (up_rx_hint value: ". $Equ->{value} . ")\n"; + } } - } - if($Equ->{'type'} eq 'up_tx_preset') - { - $phb_value[$phb_number][$lane_number*2] = - $phb_value[$phb_number][$lane_number*2] | - ($Equ->{value} & 0x0F); - } - if($Equ->{'type'} eq 'dn_rx_hint') - { - $phb_value[$phb_number][($lane_number*2)+1] = - $phb_value[$phb_number][($lane_number*2)+1] | - (($Equ->{value} & 0x07) << 4); - if($Equ->{value} > 0x7) + if($Equ->{'type'} eq 'up_tx_preset') { - die "ERROR: Attempting to modify the - reserved bit\n"; + $pPhb_value->[$phb_number][$lane_number] = + $pPhb_value->[$phb_number][$lane_number] | + (($eq_value & 0x000F) << 8); } - } - if($Equ->{'type'} eq 'dn_tx_preset') - { - $phb_value[$phb_number][($lane_number*2)+1] = - $phb_value[$phb_number][($lane_number*2)+1] | - ($Equ->{value} & 0x0F); - } - } - } - } + if($Equ->{'type'} eq 'dn_rx_hint') + { + $pPhb_value->[$phb_number][$lane_number] = + $pPhb_value->[$phb_number][$lane_number] | + (($eq_value & 0x0007) << 4); + if($eq_value > 0x7) + { + die "ERROR: Attempting to modify the + reserved bit in $genKey PHB$phb_number + (dn_rx_hint value: ". $Equ->{value} . ")\n"; + } + } + if($Equ->{'type'} eq 'dn_tx_preset') + { + $pPhb_value->[$phb_number][$lane_number] = + $pPhb_value->[$phb_number][$lane_number] | + ($eq_value & 0x000F); + } + } # end of equalization-setting + $gen++; + } # end of gen + } # end of lane-number + } # end of phb + + my @gen3PhbValues; # gen3 PHB values for this processor + my @gen4PhbValues; # gen4 PHB values for this processor - # Produce a 32 byte output hex value per PHB - my $phbvalue = ""; for (my $phbnumber = 0; $phbnumber < MAX_NUM_PHB_PER_PROC; ++$phbnumber) { + my $gen3PhbValue; + my $gen4PhbValue; + for(my $lane_settings_count = 0; $lane_settings_count < MAX_LANE_SETTINGS_PER_PHB; ++$lane_settings_count) { - $phbvalue = sprintf("%s0x%02X\,", $phbvalue, - $phb_value[$phbnumber][$lane_settings_count]); + $gen3PhbValue = sprintf("%s0x%04X\,", $gen3PhbValue, + $gen3_phb_values[$phbnumber][$lane_settings_count]); + $gen4PhbValue = sprintf("%s0x%04X\,", $gen4PhbValue, + $gen4_phb_values[$phbnumber][$lane_settings_count]); } + + $gen3PhbValues[$phbnumber] = substr($gen3PhbValue, 0, -1); + $gen4PhbValues[$phbnumber] = substr($gen4PhbValue, 0, -1); } if ( exists($proc->{proc_pcie_iop_config}) ) @@ -796,14 +823,15 @@ sub pcie_init ($) } $procPcieTargetList{$procPcieKey} = { - 'procName' => $proc->{'target'}->{'name'}, - 'procPosition' => $proc->{'target'}->{'position'}, - 'nodePosition' => $proc->{'target'}->{'node'}, - 'phbValue' => substr($phbvalue, 0, -1), - 'phbActive' => $procPciePhbActive, - 'iopConfig' => $procPcieIopConfig, + 'procName' => $proc->{'target'}->{'name'}, + 'procPosition' => $proc->{'target'}->{'position'}, + 'nodePosition' => $proc->{'target'}->{'node'}, + 'gen3phbValues' => \@gen3PhbValues, + 'gen4phbValues' => \@gen4PhbValues, + 'phbActive' => $procPciePhbActive, + 'iopConfig' => $procPcieIopConfig, }; - } + } # end of processor loop } # Repeated [NODE, POS, ATTR, IOP0-VAL, IOP1-VAL, ATTR, IOP0-VAL, IOP1-VAL] @@ -3907,11 +3935,6 @@ sub generate_proc print " <!-- End PHYP Memory Map -->\n\n"; # end PHYP Memory Map - print " <!-- PROC_PCIE_ attributes -->\n"; - addProcPcieAttrs( $proc, $node ); - - print " <!-- End PROC_PCIE_ attributes -->\n"; - if ((scalar @SortedPmChipAttr) == 0) { # Default the values. @@ -4891,6 +4914,8 @@ sub generate_phb_chiplet </attribute> "; + addProcPcieAttrs( $proc, $node, $phb_orig ); + addPervasiveParentLink($sys,$node,$proc,$phbChipUnit,"phb"); calcAndAddFapiPos("phb",$affinityPath,$phb,$fapiPosHr); @@ -6641,7 +6666,7 @@ sub addProcPmAttrs sub addProcPcieAttrs { - my ($position,$nodeId) = @_; + my ($position, $nodeId, $phbNum) = @_; foreach my $pcie ( keys %procPcieTargetList ) { @@ -6649,9 +6674,16 @@ sub addProcPcieAttrs $procPcieTargetList{$pcie}{procPosition} eq $position) { my $procPcieRef = (\%procPcieTargetList)->{$pcie}; + my @gen3PhbValues = @{ $procPcieRef->{'gen3phbValues'}}; + my @gen4PhbValues = @{ $procPcieRef->{'gen4phbValues'}}; + print " <attribute>\n"; + print " <id>PROC_PCIE_LANE_EQUALIZATION_GEN3</id>\n"; + print " <default>$gen3PhbValues[$phbNum]\n"; + print " </default>\n"; + print " </attribute>\n"; print " <attribute>\n"; - print " <id>PROC_PCIE_LANE_EQUALIZATION</id>\n"; - print " <default>$procPcieRef->{phbValue}\n"; + print " <id>PROC_PCIE_LANE_EQUALIZATION_GEN4</id>\n"; + print " <default>$gen4PhbValues[$phbNum]\n"; print " </default>\n"; print " </attribute>\n"; last; |