diff options
author | Chen Du <duchen@us.ibm.com> | 2019-04-08 12:47:06 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2019-05-15 11:49:15 -0500 |
commit | 54a570f06c63ae18c6eca5ee9e48fe5c3c755625 (patch) | |
tree | bd2c3a5b0f5deca03a6ce2d1c930b98ce7f71613 | |
parent | bda479bb756377e5237ef8be451ad5db6073a11f (diff) | |
download | talos-hostboot-54a570f06c63ae18c6eca5ee9e48fe5c3c755625.tar.gz talos-hostboot-54a570f06c63ae18c6eca5ee9e48fe5c3c755625.zip |
MRW parsing updates for Axone+UB task 2
Task 2: Deal with chip-ocmb
Code parses out chip-ocmb information from the swift.xml
and checks for validity of the data. Code processed the correct
affinity path based on a modulo algorithm. All other information
was taken from our current simics_AXONE.system.xml
Code also parses the i2c_mux information because it highly
correlates with the chip-ocmb
Change-Id: I97ce375280c268837135fd16c13399f662f1c8dc
RTC: 196808
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/75673
Reviewed-by: Matthew Raybuck <matthew.raybuck@ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Tested-by: Daniel M. Crowell <dcrowell@us.ibm.com>
-rw-r--r-- | src/usr/targeting/common/Targets.pm | 208 | ||||
-rwxr-xr-x | src/usr/targeting/common/processMrw.pl | 54 |
2 files changed, 227 insertions, 35 deletions
diff --git a/src/usr/targeting/common/Targets.pm b/src/usr/targeting/common/Targets.pm index ffedb048f..2c60ae3eb 100644 --- a/src/usr/targeting/common/Targets.pm +++ b/src/usr/targeting/common/Targets.pm @@ -653,6 +653,8 @@ sub buildAffinity my $bmc = -1; my $mcc = -1; my $omi = -1; + my $ocmb = -1; + my $i2c_mux = -1; my $sys_phys = ""; my $node_phys = ""; my $node_aff = ""; @@ -790,10 +792,17 @@ sub buildAffinity { $mcc++; - my $proc_num = ($mcc / 8) % 2; - my $mc_num = ($mcc / 4) % 2; - my $mi_num = ($mcc / 2) % 2; - my $mcc_num = ($mcc / 1) % 2; + # For a given proc, there are 2 MCs, 4 MIs, 8 MCCs, and 16 OMIs + # To get the corresponding proc, MC, or MI number for a given MCC + # divide the MCC number by the number of MCCs per unit, then mod 2 + # to get the relative path in terms of 0 or 1 + my $numOfMccsPerProc = 8; + my $numOfMccsPerMc = 4; + my $numOfMccsPerMi = 2; + my $proc_num = ($mcc / $numOfMccsPerProc) % 2; + my $mc_num = ($mcc / $numOfMccsPerMc) % 2; + my $mi_num = ($mcc / $numOfMccsPerMi) % 2; + my $mcc_num = $mcc % 2; my $mcc_aff = $node_aff . "/proc-$proc_num/mc-$mc_num/mi-$mi_num/mcc-$mcc_num"; $self->setAttribute($target, "AFFINITY_PATH", $mcc_aff); } @@ -801,11 +810,16 @@ sub buildAffinity { $omi++; - my $proc_num = ($omi / 16) % 2; - my $mc_num = ($omi / 8) % 2; - my $mi_num = ($omi / 4) % 2; - my $mcc_num = ($omi / 2) % 2; - my $omi_num = ($omi / 1) % 2; + # Same logic for MCC, but for OMI instead + my $numOfOmisPerProc = 16; + my $numOfOmisPerMc = 8; + my $numOfOmisPerMi = 4; + my $numOfOmisPerMcc = 2; + my $proc_num = ($omi / $numOfOmisPerProc) % 2; + my $mc_num = ($omi / $numOfOmisPerMc) % 2; + my $mi_num = ($omi / $numOfOmisPerMi) % 2; + my $mcc_num = ($omi / $numOfOmisPerMcc) % 2; + my $omi_num = $omi % 2; my $omi_aff = $node_aff . "/proc-$proc_num/mc-$mc_num/mi-$mi_num/mcc-$mcc_num/omi-$omi_num"; $self->setAttribute($target, "AFFINITY_PATH", $omi_aff); } @@ -834,7 +848,94 @@ sub buildAffinity my $ddrs = $self->findConnections($target,"DDR4",""); $self->processMcaDimms($ddrs, $sys_pos, $node_phys, $node, $proc); } + elsif ($type eq "OCMB_CHIP") + { + $ocmb++; + + $self->{targeting}{SYS}[0]{NODES}[$node]{OCMB_CHIPS}[$ocmb]{KEY} = $target; + $self->setHuid($target, $sys_pos, $ocmb); + + my $ocmb_phys = $node_phys . "/ocmb_chip-$ocmb"; + # Same logic for MCC, but for OCMB_CHIP instead + my $numOfOcmbsPerProc = 16; + my $numOfOcmbsPerMc = 8; + my $numOfOcmbsPerMi = 4; + my $numOfOcmbsPerMcc = 2; + my $proc_num = ($ocmb / $numOfOcmbsPerProc) % 2; + my $mc_num = ($ocmb / $numOfOcmbsPerMc) % 2; + my $mi_num = ($ocmb / $numOfOcmbsPerMi) % 2; + my $mcc_num = ($ocmb / $numOfOcmbsPerMcc) % 2; + my $omi_num = $ocmb % 2; + my $ocmb_aff = $node_aff . "/proc-$proc_num/mc-$mc_num/mi-$mi_num/mcc-$mcc_num/omi-$omi_num/ocmb_chip-0"; + $self->setAttribute($target, "AFFINITY_PATH", $ocmb_aff); + $self->setAttribute($target, "PHYS_PATH", $ocmb_phys); + + my $ocmb_num = $ocmb; + # The norm for FAPI_NAME has a two digit number at the end + if ($ocmb < 10) + { + $ocmb_num = "0$ocmb"; + } + + # chipunit:system:node:slot:position + $self->setAttribute($target, "FAPI_NAME", "ocmb:k0:n0:s0:p$ocmb_num"); + $self->setAttribute($target, "MRU_ID", "0x00060000"); + + $self->setAttribute($target, "POSITION", $ocmb); + $self->setAttribute($target, "FAPI_POS", $ocmb); + my $fapi_name = "FAPI_I2C_CONTROL_INFO"; + my $master_path = "physical:sys-0/node-0/proc-$proc_num"; + my $mux_path = "physical:sys-0/node-0/i2c_mux-0"; + $self->setAttributeField($target, $fapi_name, "i2cMasterPath", $master_path); + $self->setAttributeField($target, $fapi_name, "i2cMuxPath", $mux_path); + + my $eeprom_name = "EEPROM_VPD_PRIMARY_INFO"; + $self->setAttributeField($target, $eeprom_name, "i2cMasterPath", $master_path); + $self->setAttributeField($target, $eeprom_name, "chipCount", "0x01"); + $self->setAttributeField($target, $eeprom_name, "i2cMuxPath", $mux_path); + } + elsif ($type eq "I2C_MUX") + { + $i2c_mux++; + + $self->{targeting}{SYS}[0]{NODES}[$node]{I2C_MUXS}[$i2c_mux]{KEY} = $target; + + # There exists 1 i2c_mux per MC, so 2 i2c_mux per proc + my $numOfMuxesPerProc = 2; + my $proc_num = ($i2c_mux / $numOfMuxesPerProc) % 2; + my $i2c_aff = $node_aff . "/proc-$proc_num/i2c_mux-$i2c_mux"; + $self->setAttribute($target, "AFFINITY_PATH", $i2c_aff); + + my $i2c_phys = $node_phys . "/i2c_mux-$i2c_mux"; + $self->setAttribute($target, "PHYS_PATH", $i2c_phys); + $self->setHuid($target, $sys_pos, $i2c_mux); + + my $fapi_name = "FAPI_I2C_CONTROL_INFO"; + my $master_path = $node_phys . "/proc-$proc_num"; + $self->setAttributeField($target, $fapi_name, "i2cMasterPath", $master_path); + my $conn = $self->findConnectionsByDirection($target, "I2C", + "", 1); + if ($conn ne "") + { + # Get the i2c-master-omi which has the engine and port values + # The endpoint mux has the devAddr + foreach my $conn (@{$conn->{CONN}}) + { + my $source = $conn->{SOURCE}; + my $dest = $conn->{DEST}; + if ($self->getTargetParent($conn->{DEST}) eq $target) + { + $self->setAttributeField($target, $fapi_name, "engine", + $self->getAttribute($source, "I2C_ENGINE")); + $self->setAttributeField($target, $fapi_name, "port", + $self->getAttribute($source, "I2C_PORT")); + $self->setAttributeField($target, $fapi_name, "devAddr", + $self->getAttribute($dest, "I2C_ADDRESS")); + } + } + } + } elsif ($type eq "PROC") { my $socket = $target; @@ -2045,6 +2146,91 @@ sub findDestConnections } +sub setEepromAttributesForOcmbChip +{ + my $self = shift; + my $targetObj = shift; + my $target = shift; + + my %connections; + my $num=0; + my $target_children = $self->getTargetChildren($target); + if ($target_children eq "") + { + return ""; + } + + my $name = "EEPROM_VPD_PRIMARY_INFO"; + # SPD contains data for EEPROM_VPD_PRIMARY_INFO + # SPD is the child of ocmb's parent, so get ocmb's parent + # then look for the SPD child + my $target_parent = $self->getTargetParent($target); + foreach my $child (@{ $self->getTargetChildren($target_parent) }) + { + my $instance_name = $self->getInstanceName($child); + if ($instance_name eq "spd") + { + $targetObj->setAttributeField($target, $name, "byteAddrOffset", + $self->getAttribute($child, "BYTE_ADDRESS_OFFSET")); + $targetObj->setAttributeField($target, $name, "maxMemorySizeKB", + $self->getAttribute($child, "MEMORY_SIZE_IN_KB")); + $targetObj->setAttributeField($target, $name, "writeCycleTime", + $self->getAttribute($child, "WRITE_CYCLE_TIME")); + $targetObj->setAttributeField($target, $name, "writePageSize", + $self->getAttribute($child, "WRITE_PAGE_SIZE")); + # Each dimm target has one chip-ocmb and one spd target. So break here + last; + } + } + + # Get data from i2c-master-omi, which connects to the i2c_mux PCA9847 + my $conn = $self->findConnectionsByDirection($target, "I2C", "", 1); + if ($conn ne "") + { + # There exists multiple i2c bus connections with chip-ocmb + # They are all the same connections so we just take the first one + # The mux channel has the i2cMuxBusSelector + my $conn_source = @{$conn->{CONN}}[0]->{SOURCE}; + my $mux = $self->getAttribute($conn_source, "MUX_CHANNEL"); + + # PCA9847.i2cm-0 source, which connects the i2c-master-omi + my $parent = $self->getTargetParent($conn_source); + my $master_i2c = $self->findConnectionsByDirection($self->getTargetParent($conn_source), "I2C", "", 1); + if ($master_i2c ne "") + { + # There exists multiple i2c bus connections with the PCA9847 i2c_mux + # They are all the same connections so we just take the first one + $master_i2c = @{$master_i2c->{CONN}}[0]; + # i2c-master-omi source which has data we need + my $source = $master_i2c->{SOURCE}; + my $dest = $master_i2c->{DEST}; + my $engine = $self->getAttribute($source, "I2C_ENGINE"); + my $port = $self->getAttribute($source, "I2C_PORT"); + my $address = $self->getAttribute($dest, "I2C_ADDRESS"); + + my $fapi_name = "FAPI_I2C_CONTROL_INFO"; + $self->setAttributeField($target, $fapi_name, "engine", + $engine); + $self->setAttributeField($target, $fapi_name, "port", + $port); + $self->setAttributeField($target, $fapi_name, "devAddr", + $address); + $self->setAttributeField($target, $fapi_name, "i2cMuxBusSelector", + $mux); + + my $eeprom_name = "EEPROM_VPD_PRIMARY_INFO"; + $self->setAttributeField($target, $eeprom_name, "engine", + $engine); + $self->setAttributeField($target, $eeprom_name, "port", + $port); + $self->setAttributeField($target, $eeprom_name, "devAddr", + $address); + $self->setAttributeField($target, $eeprom_name, "i2cMuxBusSelector", + $mux); + } + } +} + # Find connections from/to $target (and it's children) # $to_this_target indicates the direction to find. sub findConnectionsByDirection @@ -2082,6 +2268,7 @@ sub findConnectionsByDirection { $numOfConnections = $self->getNumConnections($child); } + for (my $i = 0; $i < $numOfConnections; $i++) { my $other_end_target = undef; @@ -2094,6 +2281,7 @@ sub findConnectionsByDirection $other_end_target = $self->getConnectionDestination($child, $i); } + my $other_end_parent = $self->getTargetParent($other_end_target); my $type = $self->getMrwType($other_end_parent); my $dest_type = $self->getType($other_end_parent); @@ -2112,12 +2300,10 @@ sub findConnectionsByDirection #like unit->pingroup->muxgroup->chip where the chip has #the interesting type. while ($type ne $other_end_type) { - $other_end_parent = $self->getTargetParent($other_end_parent); if ($other_end_parent eq "") { last; } - $type = $self->getMrwType($other_end_parent); if ($type eq "NA") { $type = $self->getType($other_end_parent); diff --git a/src/usr/targeting/common/processMrw.pl b/src/usr/targeting/common/processMrw.pl index a507dc1a8..ac1365c62 100755 --- a/src/usr/targeting/common/processMrw.pl +++ b/src/usr/targeting/common/processMrw.pl @@ -47,24 +47,7 @@ my $build = "hb"; my $system_config = ""; my $output_filename = ""; -# Map for omi to omic parent -# OMI | OMIC -# -------------- -# 1 | 2 -# 2 | 1 -# 3 | 1 -# 4 | 0 -# 5 | 0 -# 6 | 0 -# 7 | 1 -# 8 | 2 -# 9 | 2 -# 10 | 1 -# 11 | 1 -# 12 | 0 -# 13 | 0 -# 14 | 0 -# 15 | 1 +# Map the OMI instance to its corresponding OMIC parent my %omi_map = (4 => "physical:sys-0/node-0/proc-0/mc-0/omic-0", 5 => "physical:sys-0/node-0/proc-0/mc-0/omic-0", 6 => "physical:sys-0/node-0/proc-0/mc-0/omic-0", @@ -413,7 +396,10 @@ foreach my $target (@targets) { processUcd($targetObj, $target); } - + } + elsif ($type eq "OCMB_CHIP") + { + processOcmbChip($targetObj, $target); } processIpmiSensors($targetObj,$target); @@ -1170,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, @@ -1797,7 +1782,31 @@ sub processOmic $targetObj->setAttribute( $target, "CHIPLET_ID", $value); } + #-------------------------------------------------- +## OCMB_CHIP +## +## +sub processOcmbChip +{ + my $targetObj = shift; + my $target = shift; + + use integer; + # processMrw parses all of the values in the input xml + # Here we delete the values that are not needed + $targetObj->deleteAttribute($target, "CLASS"); + $targetObj->deleteAttribute($target, "DIRECTION"); + $targetObj->deleteAttribute($target, "FSI_OPTION_FLAGS"); + $targetObj->deleteAttribute($target, "INSTANCE_PATH"); + $targetObj->deleteAttribute($target, "MRW_TYPE"); + $targetObj->deleteAttribute($target, "PRIMARY_CAPABILITIES"); + $targetObj->deleteAttribute($target, "FRU_ID"); + + $targetObj->setEepromAttributesForOcmbChip($targetObj, $target); +} + +#-------------------------------------------------g ## MI ## ## @@ -3069,7 +3078,6 @@ sub processI2C \@i2cSpeed, \@i2cType, \@i2cPurpose, \@i2cLabel); } - sub setEepromAttributes { my $targetObj = shift; @@ -3084,9 +3092,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 |