diff options
author | Norman James <njames@us.ibm.com> | 2015-02-16 20:34:50 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-02-23 14:21:07 -0600 |
commit | 14c99ac3fa5dfd721d7fd214a7cd0f17deaa2c46 (patch) | |
tree | 4c88995ba4dcf2f99265e973a26aca7d1e5b2dfc /src | |
parent | 07bb80e9281ed8aafbd283d5ab2c0f777e347b73 (diff) | |
download | talos-hostboot-14c99ac3fa5dfd721d7fd214a7cd0f17deaa2c46.tar.gz talos-hostboot-14c99ac3fa5dfd721d7fd214a7cd0f17deaa2c46.zip |
Serverwiz: Multiple improvements
Including handling negative attribute values
Change-Id: I3351a3085bcba1fd9ee371e907066b7a1e101fde
RTC: 123515
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15774
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Tested-by: Jenkins Server
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/targeting/common/Targets.pm | 7 | ||||
-rw-r--r-- | src/usr/targeting/common/processMrw.pl | 162 |
2 files changed, 87 insertions, 82 deletions
diff --git a/src/usr/targeting/common/Targets.pm b/src/usr/targeting/common/Targets.pm index d4c2bfad1..3cb519ea0 100644 --- a/src/usr/targeting/common/Targets.pm +++ b/src/usr/targeting/common/Targets.pm @@ -193,7 +193,9 @@ sub printAttribute $filter{ENTITY_INSTANCE} = 1; $filter{MBA_NUM} = 1; $filter{IPMI_INSTANCE} = 1; + $filter{IPMI_NAME} = 1; $filter{INSTANCE_ID} = 1; + $filter{ADC_CHANNEL_SENSOR_NUMBERS} = 1; if ($filter{$attribute} == 1) { @@ -531,6 +533,7 @@ sub buildAffinity { $self->processMcs($unit, $node, $proc, $parent_affinity, $parent_physical, $node_phys); + } } } @@ -671,8 +674,8 @@ 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}++; diff --git a/src/usr/targeting/common/processMrw.pl b/src/usr/targeting/common/processMrw.pl index 18107dfae..6b685dbde 100644 --- a/src/usr/targeting/common/processMrw.pl +++ b/src/usr/targeting/common/processMrw.pl @@ -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 @@ -285,7 +209,30 @@ sub processSystem $targetObj->setAttribute($target, "MAX_PROC_CHIPS_PER_NODE", $targetObj->{NUM_PROCS_PER_NODE}); parseBitwise($targetObj,$target,"CDM_POLICIES"); + convertNegativeNumbers($targetObj,$target,"ADC_CHANNEL_OFFSETS",32); +} + +sub convertNegativeNumbers +{ + my $targetObj=shift; + my $target=shift; + my $attribute=shift; + my $numbits=shift; + + my @offset = split(/\,/, + $targetObj->getAttribute($target,$attribute)); + for (my $i=0;$i<@offset;$i++) + { + if ($offset[$i]<0) + { + my $neg_offset = 2**$numbits+$offset[$i]; + $offset[$i]=sprintf("0x%08X",$neg_offset); + } + } + my $new_offset = join(',',@offset); + $targetObj->setAttribute($target,$attribute,$new_offset) } + sub processBmc { my $targetObj = shift; @@ -785,14 +732,14 @@ 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"); @@ -949,7 +896,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 +933,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); @@ -984,6 +968,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 { |