diff options
Diffstat (limited to 'src/usr/targeting/common/processMrw.pl')
-rwxr-xr-x | src/usr/targeting/common/processMrw.pl | 234 |
1 files changed, 221 insertions, 13 deletions
diff --git a/src/usr/targeting/common/processMrw.pl b/src/usr/targeting/common/processMrw.pl index 341574246..2b88520ba 100755 --- a/src/usr/targeting/common/processMrw.pl +++ b/src/usr/targeting/common/processMrw.pl @@ -44,9 +44,27 @@ my $debug = 0; my $report = 0; my $sdr_file = ""; my $build = "hb"; -my $system_config = ""; +my $system_config = ""; my $output_filename = ""; +# Map the OMI instance to its corresponding OMIC parent +my %omi_map = (4 => "omic-0", + 5 => "omic-0", + 6 => "omic-0", + 7 => "omic-1", + 2 => "omic-1", + 3 => "omic-1", + 0 => "omic-2", + 1 => "omic-2", + 12 => "omic-0", + 13 => "omic-0", + 14 => "omic-0", + 15 => "omic-1", + 10 => "omic-1", + 11 => "omic-1", + 8 => "omic-2", + 9 => "omic-2"); + # TODO RTC:170860 - Remove this after dimm connector defines VDDR_ID my $num_voltage_rails_per_proc = 1; @@ -378,7 +396,10 @@ foreach my $target (@targets) { processUcd($targetObj, $target); } - + } + elsif ($type eq "OCMB_CHIP") + { + processOcmbChip($targetObj, $target); } processIpmiSensors($targetObj,$target); @@ -1135,7 +1156,6 @@ sub processProcessor ## update path for mvpd's and sbe's my $path = $targetObj->getAttribute($target, "PHYS_PATH"); my $model = $targetObj->getAttribute($target, "MODEL"); - $targetObj->setAttributeField($target, "EEPROM_VPD_PRIMARY_INFO","i2cMasterPath",$path); $targetObj->setAttributeField($target, @@ -1434,9 +1454,9 @@ sub setupBars foreach my $bar (keys %bars) { my $i_base = Math::BigInt->new($bars{$bar}); - my $value=sprintf("0x%016s",substr(( - $i_base+$groupOffset*$group+ - $procOffset*$proc)->as_hex(),2)); + my $value=sprintf("0x%016s",substr(( + $i_base+$groupOffset*$group+ + $procOffset*$proc)->as_hex(),2)); $targetObj->setAttribute($target,$bar,$value); } } @@ -1642,6 +1662,9 @@ sub processMcbist ## sub processMc { + # NOTE: OMI_INBAND_BAR_BASE_ADDR_OFFSET will be set for the MC + # targets via a specific child OMI Target. View the + # processOmi function for further details. my $targetObj = shift; my $target = shift; @@ -1656,6 +1679,10 @@ sub processMc { processMi($targetObj, $child); } + elsif ($child_type eq "OMIC") + { + processOmic($targetObj, $child); + } } { @@ -1669,8 +1696,146 @@ sub processMc } } +#-------------------------------------------------- +## MCC +## +## +sub processMcc +{ + my $targetObj = shift; + my $target = shift; + + foreach my $child (@{ $targetObj->getTargetChildren($target) }) + { + my $child_type = $targetObj->getType($child); + + $targetObj->log($target, + "Processing MCC child: $child Type: $child_type"); + + if ($child_type eq "OMI") + { + processOmi($targetObj, $child); + } + } + + { + use integer; + # There are a total of four MCC units on an MC unit. So, to + # determine which MC an MCC belongs to, the CHIP_UNIT of the MCC can + # be divided by the number of units per MC to arrive at the correct + # offset to add to the pervasive MCC parent offset. + my $numberOfMccPerMc = 4; + my $chip_unit = $targetObj->getAttribute($target, "CHIP_UNIT"); + + my $value = sprintf("0x%x", + Targets::PERVASIVE_PARENT_MI_OFFSET + + ($chip_unit / $numberOfMccPerMc)); + + $targetObj->setAttribute( $target, "CHIPLET_ID", $value); + } +} #-------------------------------------------------- +## OMI +## +## +sub processOmi +{ + my $mrwObj = shift; + my $omitarg = shift; + + use integer; + # There are a total of eight OMI units on an MC unit. So, to + # determine which MC an OMI belongs to, the CHIP_UNIT of the OMI can + # be divided by the number of units per MC to arrive at the correct + # offset to add to the pervasive OMI parent offset. + my $numberOfOmiPerMc = 8; + my $chip_unit = $mrwObj->getAttribute($omitarg, "CHIP_UNIT"); + my $fapi_pos = $mrwObj->getAttribute($omitarg, "FAPI_POS"); + my $value = sprintf("0x%x", + Targets::PERVASIVE_PARENT_MI_OFFSET + + ($chip_unit / $numberOfOmiPerMc)); + + $mrwObj->setAttribute($omitarg, "CHIPLET_ID", $value); + + # Start with our affinity path "sys-a/node-b/proc-c/mc-d/mi-e/mcc-f/omi-g" + # then snip off everything before the mi + my $phys_path = $mrwObj->getAttribute($omitarg, "PHYS_PATH"); + my $up_to_mi = index($phys_path,"mi-"); + my $omic_parent = substr($phys_path,0,$up_to_mi); + $omic_parent = $omic_parent.$omi_map{$chip_unit}; + $mrwObj->setAttribute($omitarg, "OMIC_PARENT", $omic_parent); + + my $omi = Math::BigInt->new($mrwObj->getAttribute($omitarg,"FAPI_POS")); + # Base omi bar offset + # We use this base address in simics_AXONE.system.xml and want our + # addresses to match the ones in that xml + my $base = 0x30400000000; + my $gigabyte = 0x40000000; + my $value = 0; + + # This algorithm is explained in src/usr/mmio/mmio.C + if ($omi % 2 eq 0) + { + $value = $base + $omi * 4 * $gigabyte; + } + else + { + $value = $base + (($omi - 1) * 4 + 2) * $gigabyte; + } + + $value = sprintf("0x%016s", substr(($value)->as_hex(),2)); + $mrwObj->setAttribute($omitarg, "OMI_INBAND_BAR_BASE_ADDR_OFFSET", + $value); + + # Set the parent MC BAR value to value of first OMI unit + if ($omi % 8 eq 0) + { + my $parent_mcc = $mrwObj->getTargetParent($omitarg); + my $parent_mi = $mrwObj->getTargetParent($parent_mcc); + my $parent_mc = $mrwObj->getTargetParent($parent_mi); + $mrwObj->setAttribute($parent_mc, "OMI_INBAND_BAR_BASE_ADDR_OFFSET", + $value); + } +} + +#-------------------------------------------------- +## OMIC +## +## +sub processOmic +{ + my $targetObj = shift; + my $target = shift; + + use integer; + # There are a total of three OMIC units on an MC unit. So, to + # determine which MC an OMIC belongs to, the CHIP_UNIT of the OMIC can + # be divided by the number of units per MC to arrive at the correct + # offset to add to the pervasive OMIC parent offset. + my $numberOfOmicPerMc = 3; + my $chip_unit = $targetObj->getAttribute($target, "CHIP_UNIT"); + + my $value = sprintf("0x%x", + Targets::PERVASIVE_PARENT_MI_OFFSET + + ($chip_unit / $numberOfOmicPerMc)); + + $targetObj->setAttribute( $target, "CHIPLET_ID", $value); +} + +#-------------------------------------------------- +## OCMB_CHIP +## +## +sub processOcmbChip +{ + my $targetObj = shift; + my $target = shift; + + $targetObj->setEepromAttributesForAxone($targetObj, $target); +} + +#-------------------------------------------------g ## MI ## ## @@ -1690,6 +1855,10 @@ sub processMi { processDmi($targetObj, $child); } + elsif ($child_type eq "MCC") + { + processMcc($targetObj, $child); + } } { @@ -1745,7 +1914,7 @@ sub processDmi Targets::PERVASIVE_PARENT_DMI_OFFSET + ($chip_unit / $numberOfDmiPerMc)); - $targetObj->setAttribute( $target, "CHIPLET_ID", $value); + $targetObj->setAttribute($target, "CHIPLET_ID", $value); } } @@ -1837,12 +2006,27 @@ sub processObus if ($match eq 0) { $targetObj->setAttribute($obrick, "OBUS_SLOT_INDEX", -1); - } } } } + + my $chip_unit = $targetObj->getAttribute($target, "CHIP_UNIT"); + my $value = sprintf("0x%x", Targets::PERVASIVE_PARENT_OBUS_OFFSET + $chip_unit); + $targetObj->setAttribute($target, "CHIPLET_ID", $value); + + # Set CHIPLET_ID for OBUS_BRICKs + foreach my $child (@{ $targetObj->getTargetChildren($target) }) + { + my $type = $targetObj->getType($child); + if ($type eq "OBUS_BRICK") + { + # OBUS_BRICK takes on CHIPLET_ID of OBUS parent + $targetObj->setAttribute($child, "CHIPLET_ID", $value); + } + } } + #-------------------------------------------------- ## XBUS ## @@ -2769,6 +2953,23 @@ sub processI2C { $type = "0xFF"; } + # TPM types can vary by MODEL number + elsif ($type_str eq "NUVOTON_TPM") + { + # Model values can be found in tpmddif.H and are kept in + # sync with TPM_MODEL attribute in attribute_types_hb.xml + my $tpm_model = $targetObj->getAttribute($i2c->{DEST_PARENT},"TPM_MODEL"); + if ($tpm_model eq 1) + { + $type = $targetObj->getEnumValue("HDAT_I2C_DEVICE_TYPE",$type_str); + } + if ($tpm_model eq 2) + { + # @TODO RTC 212201 use proper enum when <system>.xml supports it + #$type = $targetObj->getEnumValue("HDAT_I2C_DEVICE_TYPE","TCG_I2C_TPM"); + $type = 0x15; + } + } else { $type = $targetObj->getEnumValue("HDAT_I2C_DEVICE_TYPE",$type_str); @@ -2901,7 +3102,17 @@ sub processI2C # <vendor>,<device type>,<purpose>,<scope> if ($type_str eq "NUVOTON_TPM") { - $label = "nuvoton,npct601,tpm,host"; + # Model values can be found in tpmddif.H and are kept in + # sync with TPM_MODEL attribute in attribute_types_hb.xml + my $tpm_model = $targetObj->getAttribute($i2c->{DEST_PARENT},"TPM_MODEL"); + if ($tpm_model eq 1) + { + $label = "nuvoton,npct601,tpm,host"; + } + if ($tpm_model eq 2) + { + $label = "tcg,tpm_i2c_ptp,tpm,host"; + } } if ($label eq "") @@ -2938,7 +3149,6 @@ sub processI2C \@i2cSpeed, \@i2cType, \@i2cPurpose, \@i2cLabel); } - sub setEepromAttributes { my $targetObj = shift; @@ -2953,9 +3163,7 @@ sub setEepromAttributes # $conn_target->{BUS_NUM}, "I2C_ADDRESS"); my $addr = $targetObj->getAttribute($conn_target->{DEST},"I2C_ADDRESS"); - - my $path = $targetObj->getAttribute($conn_target->{SOURCE_PARENT}, - "PHYS_PATH"); + my $path = $targetObj->getAttribute($conn_target->{SOURCE_PARENT}, "PHYS_PATH"); my $mem = $targetObj->getAttribute($conn_target->{DEST_PARENT}, "MEMORY_SIZE_IN_KB"); my $count = 1; # default for VPD SEEPROMs |