| From 8f139eab659dc681e24a8c414dac00607a090fa0 Mon Sep 17 00:00:00 2001 |
| From: Matt Ploetz <maploetz@us.ibm.com> |
| Date: Mon, 16 Feb 2015 13:15:43 -0600 |
| Subject: [PATCH] New Serverwiz2 patches |
| |
| Change-Id: I4ba05d89e9ca0ef3298c0f9d503f349782632d89 |
| --- |
| src/build/mkrules/dist.targets.mk | 3 +- |
| src/usr/targeting/common/Targets.pm | 24 ++--- |
| src/usr/targeting/common/processMrw.pl | 171 ++++++++++++++------------------- |
| 3 files changed, 88 insertions(+), 110 deletions(-) |
| mode change 100644 => 100755 src/usr/targeting/common/Targets.pm |
| mode change 100644 => 100755 src/usr/targeting/common/processMrw.pl |
| |
| diff --git a/src/build/mkrules/dist.targets.mk b/src/build/mkrules/dist.targets.mk |
| index ca28150..4b541ce 100644 |
| --- a/src/build/mkrules/dist.targets.mk |
| +++ b/src/build/mkrules/dist.targets.mk |
| @@ -74,7 +74,8 @@ COPY_FILES = \ |
| src/usr/hwpf/hwp/initfiles/sample.initfile:tools \ |
| src/build/buildpnor/buildSbePart.pl:openpower \ |
| src/build/buildpnor/buildpnor.pl:openpower \ |
| - src/usr/targeting/common/genHwsvMrwXml.pl:openpower \ |
| + src/usr/targeting/common/processMrw.pl:openpower \ |
| + src/usr/targeting/common/Targets.pm:openpower \ |
| src/usr/targeting/common/xmltohb/mergexml.sh:openpower \ |
| src/usr/targeting/common/xmltohb/attribute_types.xml:openpower \ |
| src/usr/targeting/common/xmltohb/attribute_types_hb.xml:openpower \ |
| diff --git a/src/usr/targeting/common/Targets.pm b/src/usr/targeting/common/Targets.pm |
| old mode 100644 |
| new mode 100755 |
| index d4c2bfa..53568cf |
| --- a/src/usr/targeting/common/Targets.pm |
| +++ b/src/usr/targeting/common/Targets.pm |
| @@ -194,6 +194,7 @@ sub printAttribute |
| $filter{MBA_NUM} = 1; |
| $filter{IPMI_INSTANCE} = 1; |
| $filter{INSTANCE_ID} = 1; |
| + $filter{ADC_CHANNEL_SENSOR_NUMBERS} = 1; |
| |
| if ($filter{$attribute} == 1) |
| { |
| @@ -286,7 +287,7 @@ sub buildHierarchy |
| $self->{data}->{INSTANCE_PATH} = $old_path . "/" . $target; |
| |
| ## copy attributes |
| - |
| + |
| foreach my $attribute (keys %{ $target_xml->{attribute} }) |
| { |
| my $value = $target_xml->{attribute}->{$attribute}->{default}; |
| @@ -317,7 +318,7 @@ sub buildHierarchy |
| $self->setAttribute($key, $attribute, $value); |
| } |
| } |
| - ## global attributes overwrite local |
| + ## global attributes overwrite local |
| foreach my $prop (keys %{$self->{xml}->{globalSetting}->{$key}->{property}}) |
| { |
| my $val=$self->{xml}->{globalSetting}->{$key}->{property}-> |
| @@ -400,7 +401,7 @@ sub buildAffinity |
| { |
| $proc = -1; |
| $node = -1; |
| - |
| + |
| $self->{targeting}{SYS}[0]{KEY} = $target; |
| $self->setAttribute($target, "AFFINITY_PATH", "affinity:sys-0"); |
| $self->setAttribute($target, "PHYS_PATH", "physical:sys-0"); |
| @@ -443,7 +444,7 @@ sub buildAffinity |
| $self->{NUM_PROCS_PER_NODE} = $proc + 1; |
| $self->{targeting}->{SYS}[0]{NODES}[$node]{PROCS}[$proc]{KEY} = |
| $target; |
| - |
| + |
| $self->setHuid($target, 0, $node); |
| my $socket = $self->getTargetParent( |
| $self->getTargetParent($target)); |
| @@ -475,7 +476,7 @@ sub buildAffinity |
| ## don't want non-hostboot targets |
| if ($unit_type_id > 0) |
| { |
| - |
| + |
| push(@{$self->{targeting} |
| ->{SYS}[0]{NODES}[$node]{PROCS}[$proc]{$unit_type}}, |
| { 'KEY' => $unit }); |
| @@ -490,7 +491,7 @@ sub buildAffinity |
| $self->setHuid($unit, 0, $node); |
| if ($unit_type eq "OCC") |
| { |
| - $self->setAttribute($unit, "ENTITY_INSTANCE",$proc); |
| + $self->setAttribute($unit, "ENTITY_INSTANCE",$proc); |
| } |
| ## export core |
| if ($unit_type eq "EX") |
| @@ -610,9 +611,9 @@ sub processMcs |
| $self->{targeting} |
| ->{SYS}[0]{NODES}[$node]{PROCS}[$proc]{MCSS}[$mcs] {MEMBUFS}[0]{KEY} = |
| $membuf; |
| - |
| + |
| $self->setAttribute($membuf, "ENTITY_INSTANCE", |
| - $self->{membuf_inst_num}); |
| + $self->{membuf_inst_num}); |
| $self->{membuf_inst_num}++; |
| ## get the mbas |
| foreach my $child (@{ $self->{data}->{TARGETS}{$membuf}{CHILDREN} }) |
| @@ -629,7 +630,7 @@ sub processMcs |
| $node_phys . "/membuf-$membufnum/l4-0"); |
| $self->setHuid($child, 0, $node); |
| } |
| - |
| + |
| if ($self->getType($child) eq "MBA") |
| { |
| my $mba = $self->getAttribute($child,"MBA_NUM"); |
| @@ -671,10 +672,9 @@ sub processMcs |
| $self->setHuid($dimm, 0, $node); |
| $self->{targeting} |
| ->{SYS}[0]{NODES}[$node]{PROCS}[$proc] {MCSS}[$mcs] |
| - {MEMBUFS}[0]{MBAS}[$mba]{DIMMS}[$affinitypos]{KEY} |
| - = $dimm; |
| + {MEMBUFS}[0]{MBAS}[$mba] {DIMMS}[$affinitypos]{KEY} = $dimm; |
| $self->setAttribute($dimm, "ENTITY_INSTANCE", |
| - $self->{dimm_tpos}); |
| + $self->{dimm_tpos}); |
| $self->{dimm_tpos}++; |
| $affinitypos++; |
| } |
| diff --git a/src/usr/targeting/common/processMrw.pl b/src/usr/targeting/common/processMrw.pl |
| old mode 100644 |
| new mode 100755 |
| index 18107df..1fb292f |
| --- a/src/usr/targeting/common/processMrw.pl |
| +++ b/src/usr/targeting/common/processMrw.pl |
| @@ -84,7 +84,7 @@ foreach my $target (sort keys %{ $targetObj->getAllTargets() }) |
| if ($type eq "SYS") |
| { |
| processSystem($targetObj, $target); |
| - } |
| + } |
| elsif ($type eq "PROC") |
| { |
| processProcessor($targetObj, $target); |
| @@ -141,7 +141,7 @@ if ($report) |
| { |
| my $report_file = $xmldir . "/" . $targetObj->getSystemName() . ".rpt"; |
| open(SUM,">$report_file") || die "Unable to create: $report_file\n"; |
| - my $ref = $targetObj->{targeting}->{SYS}[0]{NODES}[0]{PROCS}; |
| + my $ref = $targetObj->{targeting}->{SYS}[0]{NODES}[0]{PROCS}; |
| foreach my $proc (@{$ref}) |
| { |
| foreach my $mcs (@{$proc->{MCSS}}) |
| @@ -149,7 +149,7 @@ if ($report) |
| my $mcs_target = $mcs->{KEY}; |
| my $membuf=$mcs->{MEMBUFS}[0]; |
| my $membuf_target = $membuf->{KEY}; |
| - |
| + |
| my $sch = $targetObj->getAttribute($mcs_target, |
| "SCHEMATIC_INTERFACE"); |
| my $aff = $targetObj->getAttribute($mcs_target,"AFFINITY_PATH"); |
| @@ -158,7 +158,7 @@ if ($report) |
| if ($membuf_target ne "") { |
| foreach my $mba (@{$membuf->{MBAS}}) { |
| my $mba_target = $mba->{KEY}; |
| - |
| + |
| $huid = $targetObj->getAttribute($mba_target,"HUID"); |
| $aff = $targetObj->getAttribute($mcs_target, |
| "AFFINITY_PATH"); |
| @@ -177,7 +177,7 @@ if ($report) |
| my $sens = $targetObj->getAttribute($dimm_target, |
| "IPMI_SENSORS"); |
| my @s = split(/\,/,$sens); |
| - |
| + |
| print SUM "\t\t$huid | $dimm_target". |
| " | $aff | $p | $d | $i2c | ". |
| "$s[0],$s[1] | $s[2],$s[3]\n"; |
| @@ -194,82 +194,6 @@ if ($report) |
| ## Processing subroutines |
| |
| #-------------------------------------------------- |
| -## SDRs |
| -## |
| - |
| -sub processSdr |
| -{ |
| - my $targetObj = shift; |
| - my $target = shift; |
| - my $sdrObj = shift; |
| - |
| - my @ipmi_sensors; |
| - my %id_lu; |
| - |
| - if ($targetObj->isBadAttribute($target,"ENTITY_ID_LOOKUP")==1) |
| - { |
| - return; |
| - } |
| - my $entity_id_lookup = $targetObj->getAttribute($target,"ENTITY_ID_LOOKUP"); |
| - if ($entity_id_lookup ne "") { |
| - my $pos=0; |
| - if ($targetObj->isBadAttribute($target,"IPMI_INSTANCE")==1) |
| - { |
| - $pos = $targetObj->getAttribute($target,"ENTITY_INSTANCE"); |
| - } |
| - else |
| - { |
| - $pos = $targetObj->getAttribute($target,"IPMI_INSTANCE"); |
| - } |
| - print "$entity_id_lookup,$pos\n"; |
| - my @ids = split(/,/,$entity_id_lookup); |
| - foreach my $i (@ids) |
| - { |
| - my $i_int = oct($i); |
| - if ($i_int>0) |
| - { |
| - $id_lu{$i_int}=1; |
| - } |
| - } |
| - foreach my $s (@{$sdrObj->{data}}) |
| - { |
| - my $sdr_entity_id = oct($s->{entity_id}); |
| - if ($s->{name}=~/Core/) { |
| - $sdr_entity_id=208; |
| - } |
| - if ($id_lu{$sdr_entity_id}>0) |
| - { |
| - my $sensor_id=$s->{sensor_id}; |
| - my $instance_id=oct($s->{entity_instance}); |
| - my $sensor_type=oct($s->{sensor_type}); |
| - if ($instance_id==$pos) |
| - { |
| - print "IMPORTING: $target; pos=$pos; entity_id=". |
| - "$sdr_entity_id; ". |
| - "sensor_id=$sensor_id; sensor_type=$sensor_type\n"; |
| - my $eid=sprintf("0x%02x%02x",$sensor_type,$sdr_entity_id); |
| - my $sid=sprintf("0x%02x",$s->{sensor_id}); |
| - push(@ipmi_sensors,$eid.",".$sid); |
| - $id_lu{$sdr_entity_id}++; |
| - } |
| - } |
| - } |
| - foreach my $k (keys(%id_lu)) { |
| - if ($id_lu{$k}==1) |
| - { |
| - print "WARNING: $target; pos=$pos; entity_id=$k; ". |
| - "not imported\n"; |
| - #$targetObj->myExit(3); |
| - } |
| - } |
| - for (my $i=@ipmi_sensors;$i<16;$i++) |
| - { |
| - push(@ipmi_sensors,"0xFFFF,0xFF"); |
| - } |
| - my $ipmi = join(',',@ipmi_sensors); |
| - $targetObj->setAttribute($target,"IPMI_SENSORS",$ipmi); |
| - } |
| -} |
| |
| #-------------------------------------------------- |
| ## System |
| @@ -347,7 +271,7 @@ sub processProcessor |
| $targetObj->getTargetParent($targetObj->getTargetParent($target)); |
| $targetObj->copyAttribute($socket_target,$target,"LOCATION_CODE"); |
| $targetObj->copyAttribute($socket_target,$target,"FRU_ID"); |
| - |
| + |
| |
| foreach my $attr (sort (keys |
| %{ $targetObj->getTarget($socket_target)->{TARGET}->{attribute} })) |
| @@ -529,7 +453,7 @@ sub setupBars |
| my $b=sprintf("0x%016X", |
| $i_base+$i_node_offset*$node+$i_proc_offset*$proc+$i_offset*$i); |
| my $sep=","; |
| - if ($i==$num-1) |
| + if ($i==$num-1) |
| { |
| $sep=""; |
| } |
| @@ -560,7 +484,7 @@ sub processMcs |
| my $i_offset = Math::BigInt->new($offset); |
| |
| my $mcs = $targetObj->getAttribute($target, "MCS_NUM"); |
| - my $mcsStr=sprintf("0x%016X", |
| + my $mcsStr=sprintf("0x%016X", |
| $i_base+$i_node_offset*$node+$i_proc_offset*$proc+$i_offset*$mcs); |
| $targetObj->setAttribute($target, "IBSCOM_MCS_BASE_ADDR", $mcsStr); |
| } |
| @@ -577,7 +501,7 @@ sub processXbus |
| my $target = shift; |
| |
| # $targetObj->setAttribute($target, "PEER_TARGET",""); |
| - |
| + |
| } |
| |
| #-------------------------------------------------- |
| @@ -595,7 +519,7 @@ sub processAbus |
| $targetObj->setAttribute($target, "EI_BUS_TX_LANE_INVERT","0"); |
| $targetObj->setAttribute($target, "EI_BUS_TX_MSBSWAP","0"); |
| # $targetObj->setAttribute($target, "PEER_TARGET",""); |
| - |
| + |
| my $abus_child_conn = $targetObj->getFirstConnectionDestination($target); |
| if ($abus_child_conn ne "") |
| { |
| @@ -785,14 +709,12 @@ sub processPcie |
| { |
| for (my $lane=0;$lane<16;$lane++) |
| { |
| - $equalization[$phb_num][$lane]=$eqs[$e+1].",". |
| - $eqs[$e+2]; |
| - } |
| + $equalization[$phb_num][$lane]=$eqs[$e+1].",".$eqs[$e+2]; |
| + } |
| } |
| else |
| { |
| - $equalization[$phb_num][$eqs[$e]] = $eqs[$e+1].",". |
| - $eqs[$e+2]; |
| + $equalization[$phb_num][$eqs[$e]] = $eqs[$e+1].",".$eqs[$e+2]; |
| } |
| } |
| substr($phb_config, $phb_num, 1, "1"); |
| @@ -886,7 +808,7 @@ sub processMembufVpdAssociation |
| { |
| my $targetObj = shift; |
| my $target = shift; |
| - |
| + |
| my $vpds=$targetObj->findConnections($target,"I2C","VPD"); |
| if ($vpds ne "" ) { |
| my $vpd = $vpds->{CONN}->[0]; |
| @@ -899,7 +821,7 @@ sub processMembufVpdAssociation |
| setEepromAttributes($targetObj, |
| "EEPROM_VPD_PRIMARY_INFO",$membuf_target,$vpd); |
| setEepromAttributes($targetObj, |
| - "EEPROM_VPD_FRU_INFO",$membuf_target,$vpd,"0++"); |
| + "EEPROM_VPD_FRU_INFO",$membuf_target,$vpd,"0++"); |
| my $index = $targetObj->getBusAttribute($membuf_assoc->{SOURCE}, |
| $membuf_assoc->{BUS_NUM}, "ISDIMM_MBVPD_INDEX"); |
| $targetObj->setAttribute( |
| @@ -920,8 +842,8 @@ sub processMembuf |
| { |
| my $targetObj = shift; |
| my $target = shift; |
| - if ($targetObj->isBadAttribute($target, "PHYS_PATH", "")) |
| - { |
| + if ($targetObj->isBadAttribute($target, "PHYS_PATH", "")) |
| + { |
| ##dmi is probably not connected. will get caught in error checking |
| return; |
| } |
| @@ -949,7 +871,33 @@ sub processMembuf |
| } |
| } |
| } |
| + ## find port mapping |
| + my %dimm_portmap; |
| + foreach my $child (@{$targetObj->getTargetChildren($target)}) |
| + { |
| + if ($targetObj->getType($child) eq "MBA") |
| + { |
| + my $mba_num = $targetObj->getAttribute($child,"MBA_NUM"); |
| + my $dimms=$targetObj->findConnections($child,"DDR3",""); |
| + if ($dimms ne "") |
| + { |
| + foreach my $dimm (@{$dimms->{CONN}}) |
| + { |
| + my $port_num = $targetObj->getAttribute( |
| + $dimm->{SOURCE},"MBA_PORT"); |
| + my $dimm_num = $targetObj->getAttribute( |
| + $dimm->{SOURCE},"MBA_DIMM"); |
| + |
| + my $map = oct("0b".$mba_num.$port_num.$dimm_num); |
| + $dimm_portmap{$dimm->{DEST_PARENT}} = $map; |
| + } |
| + } |
| + } |
| + } |
| + |
| + |
| ## Process MEMBUF to DIMM I2C connections |
| + my @addr_map=('0','0','0','0','0','0','0','0'); |
| my $dimms=$targetObj->findConnections($target,"I2C","SPD"); |
| if ($dimms ne "") { |
| foreach my $dimm (@{$dimms->{CONN}}) { |
| @@ -960,8 +908,19 @@ sub processMembuf |
| setEepromAttributes($targetObj, |
| "EEPROM_VPD_FRU_INFO",$dimm_target, |
| $dimm,"0++"); |
| + |
| + my $field=getI2cMapField($targetObj,$dimm_target,$dimm); |
| + my $map = $dimm_portmap{$dimm_target}; |
| + if ($map eq "") { |
| + print "ERROR: $dimm_target doesn't map to a dimm/port\n"; |
| + $targetObj->myExit(3); |
| + } |
| + $addr_map[$map] = $field; |
| } |
| } |
| + $targetObj->setAttribute($targetObj->{targeting}->{SYS}[0]->{KEY}, |
| + "MRW_MEM_SENSOR_CACHE_ADDR_MAP","0x".join("",@addr_map)); |
| + |
| ## Update bus speeds |
| processI2cSpeeds($targetObj,$target); |
| |
| @@ -973,7 +932,7 @@ sub processMembuf |
| foreach my $ddr (@{$ddrs->{CONN}}) { |
| my $mba=$ddr->{SOURCE}; |
| my $dimm=$ddr->{DEST_PARENT}; |
| - my ($dimmnum,$port)=split(//,sprintf("%02b\n",$portmap{$mba})); |
| + my ($dimmnum,$port)=split(//,sprintf("%02b\n",$portmap{$mba})); |
| $targetObj->setAttribute($dimm, "MBA_DIMM",$dimmnum); |
| $targetObj->setAttribute($dimm, "MBA_PORT",$port); |
| $portmap{$mba}++; |
| @@ -984,6 +943,24 @@ sub processMembuf |
| } |
| } |
| |
| +sub getI2cMapField |
| +{ |
| + my $targetObj = shift; |
| + my $target = shift; |
| + my $conn_target = shift; |
| + |
| + |
| + my $port = $targetObj->getAttribute($conn_target->{SOURCE}, "I2C_PORT"); |
| + my $engine = $targetObj->getAttribute($conn_target->{SOURCE}, "I2C_ENGINE"); |
| + my $addr = $targetObj->getBusAttribute($conn_target->{SOURCE}, |
| + $conn_target->{BUS_NUM}, "I2C_ADDRESS"); |
| + |
| + my $bits=sprintf("%08b",hex($addr)); |
| + my $field=sprintf("%d%3s",oct($port),substr($bits,4,3)); |
| + my $hexfield = sprintf("%X",oct("0b$field")); |
| + return $hexfield; |
| +} |
| + |
| |
| sub setEepromAttributes |
| { |
| @@ -1036,7 +1013,7 @@ sub setGpioAttributes |
| my $engine = $targetObj->getAttribute($conn_target->{SOURCE}, "I2C_ENGINE"); |
| my $addr = $targetObj->getBusAttribute($conn_target->{SOURCE}, |
| $conn_target->{BUS_NUM}, "I2C_ADDRESS"); |
| - my $path = $targetObj->getAttribute($conn_target->{SOURCE_PARENT}, |
| + my $path = $targetObj->getAttribute($conn_target->{SOURCE_PARENT}, |
| "PHYS_PATH"); |
| |
| |
| -- |
| 1.8.2.2 |
| |