Skip to content

Commit

Permalink
Deprecate legacy ATTR_MBA_PORT/ATTR_MBA_DIMM
Browse files Browse the repository at this point in the history
There are currently two competing sets of attributes related to
the DIMM position.
- Legacy (P8) MBA_PORT/MBA_DIMM
- New (P9) CEN_MBA_PORT/CEN_MBA_DIMM

These two sets of attributes are not currently being populated
with the same data in all of the MRW xml files.  The P9 HWPs are
using the CEN_ versions but there is a lot of code on the FSP
that is still using the old versions.  Additionally, the Nimbus
MRW XMLs are using MBA_PORT to represent the dimm position
behind the MCA (even though there is only a single port on the
MCA and MBA is erroneous).

This commit attempts to consolidate things into a new set of
more generic (and hopefully more descriptive) attributes to use
for all system types.  The MRW parsing logic has been modified
to consume whatever data it can to populate all 3 sets of data
with the same values.  Eventually we will deprecate the 2
previous attribute sets once we've cleaned all the existing files
up.

The new attributes are:
- MEM_PORT
- POS_ON_MEM_PORT

CQ: SW430317
Change-Id: If63929d78dcaacc1120709a659d6094ce576918d
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/59077
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
crgeddes authored and dcrowell77 committed Jun 15, 2018
1 parent eae5dde commit 5090c19
Show file tree
Hide file tree
Showing 8 changed files with 312 additions and 218 deletions.
10 changes: 5 additions & 5 deletions src/usr/htmgt/htmgt_utility.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2014,2017 */
/* Contributors Listed Below - COPYRIGHT 2014,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -164,15 +164,15 @@ namespace HTMGT
{
//To make the OCC DIMM # 0 - 7: 0bABC
// A: MBA ATTR_CHIP_UNIT: 0 or 1
// B: DIMM ATTR_MBA_PORT: 0 or 1
// C: DIMM ATTR_MBA_DIMM: 0 or 1
// B: DIMM ATTR_MEM_PORT: 0 or 1
// C: DIMM ATTR_POS_ON_MEM_PORT: 0 or 1

//Note: No CDIMM systems in plan. May need to revisit
//this if there are any as OCC may not care about logical DIMMs.

const uint8_t mbaUnit = i_mba->getAttr<ATTR_CHIP_UNIT>();
const uint8_t mbaPort = i_dimm->getAttr<ATTR_MBA_PORT>();
const uint8_t mbaDIMM = i_dimm->getAttr<ATTR_MBA_DIMM>();
const uint8_t mbaPort = i_dimm->getAttr<ATTR_MEM_PORT>();
const uint8_t mbaDIMM = i_dimm->getAttr<ATTR_POS_ON_MEM_PORT>();

TMGT_DBG("DIMM 0x%X unit %d port %d pos %d = %d",
i_dimm->getAttr<ATTR_HUID>(),
Expand Down
169 changes: 137 additions & 32 deletions src/usr/targeting/common/Targets.pm
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ use constant
NUM_PROCS_PER_GROUP => 4,
DIMMS_PER_PROC => 64, # Cumulus
DIMMS_PER_DMI => 8, # Cumulus
DIMMS_PER_MBAPORT => 4,# Cumulus
DIMMS_PER_MBA => 4,# Cumulus
MAX_MCS_PER_PROC => 4, # 4 MCS per Nimbus
MBA_PER_MEMBUF => 2,
MAX_DIMMS_PER_MBA_PORT => 2,

};

Expand Down Expand Up @@ -761,7 +762,7 @@ sub buildAffinity
elsif ($type eq "MCA")
{
my $ddrs = $self->findConnections($target,"DDR4","");
$self->processDimms($ddrs, $sys_pos, $node_phys, $node, $proc);
$self->processMcaDimms($ddrs, $sys_pos, $node_phys, $node, $proc);
}

elsif ($type eq "PROC")
Expand Down Expand Up @@ -1335,7 +1336,7 @@ sub getPervasiveForUnit

return $pervasive
}
sub processDimms
sub processMcaDimms
{
my $self = shift;
my $ddrs = shift;
Expand All @@ -1351,8 +1352,6 @@ sub processDimms
foreach my $dimms (@{$ddrs->{CONN}})
{
my $ddr = $dimms->{SOURCE};
my $port_num = $self->getAttribute($ddr,"MBA_PORT");
my $dimm_num = $self->getAttribute($ddr,"MBA_DIMM");
my $dimm=$dimms->{DEST_PARENT};

#proc->mcbist->mcs->mca->ddr
Expand All @@ -1370,9 +1369,43 @@ sub processDimms
my $mcbist = $self->getAttribute($mcbist_target, "CHIP_UNIT");
my $dimm_pos= $self->getAttribute($dimm_connector_tgt,"POSITION");

#The port/dimm attributes have been swizzled too many times and
# now they no longer make sense. Until everyone is on the same
# page we will replicate everything as needed.
my $dimm_num = 0;
my $port_num = 0; # MCA only has 1 port

# Eventually we will converge on a generic name for all
# configurations that the MRW will use.
if( !$self->isBadAttribute($ddr, "POS_ON_MEM_PORT") )
{
$dimm_num = $self->getAttribute($ddr,"POS_ON_MEM_PORT");
}
# Legacy OP systems are using MBA_PORT to represent the dimm
# position within the port, going to remap that to keep that
# support in place.
elsif( !$self->isBadAttribute($ddr, "MBA_PORT") )
{
$dimm_num = $self->getAttribute($ddr,"MBA_PORT");
}
else
{
print "ERROR: No port specified for dimm $ddr\n";
$self->myExit(4);
}

# Write out all the attributes that someone might still be using
$self->setAttribute($dimm, "CEN_MBA_PORT",$port_num); #unused
$self->setAttribute($dimm, "MBA_PORT",$port_num); #legacy
$self->setAttribute($dimm, "MEM_PORT",$port_num); #converged
$self->setAttribute($dimm, "CEN_MBA_DIMM",$dimm_num); #unused
$self->setAttribute($dimm, "MBA_DIMM",$dimm_num); #legacy
$self->setAttribute($dimm, "POS_ON_MEM_PORT",$dimm_num); #converged


$self->setAttribute($dimm, "AFFINITY_PATH",
$self->getAttribute($mcbist_target, "AFFINITY_PATH")
. "/mcs-$mcs/mca-$mca/dimm-$port_num"
. "/mcs-$mcs/mca-$mca/dimm-$dimm_num"
);

$self->setAttribute($dimm, "PHYS_PATH",
Expand All @@ -1383,8 +1416,6 @@ sub processDimms
$self->setAttribute($dimm, "POSITION", $dimm_pos);
$self->setAttribute($dimm, "VPD_REC_NUM", $dimm_pos);
$self->setAttribute($dimm, "REL_POS", $port_num);
$self->setAttribute($dimm, "MBA_DIMM", $port_num); #which dimm
$self->setAttribute($dimm, "MBA_PORT", 0); #0, each MCA is a port
$self->setAttribute($dimm, "LOCATION_CODE",$loc_code);

## set all FAPI_POS
Expand Down Expand Up @@ -1583,7 +1614,7 @@ sub processMc
$self->setAttribute($membuf_child, "FAPI_POS", $fapi_pos);
$self->setAttribute($membuf_child, "ORDINAL_ID", $fapi_pos);

$self->setAttribute($membuf_child, "REL_POS", $mba_offset);
$self->setAttribute($membuf_child, "REL_POS", $mba);
$self->setAttribute($membuf_child, "POSITION", $mba_offset);

$self->setHuid($membuf_child, $sys, $node);
Expand All @@ -1603,43 +1634,37 @@ sub processMc
foreach my $dimms (@{$ddrs->{CONN}})
{
my $ddr = $dimms->{SOURCE};
my $port_num = $self->getAttribute($ddr,"MBA_PORT");
my $dimm_num = $self->getAttribute($ddr,"MBA_DIMM");
my $dimm=$dimms->{DEST_PARENT};
$self->setAttribute($dimm,"MBA_PORT",$port_num);
$self->setAttribute($dimm,"MBA_DIMM",$dimm_num);
$self->setAttribute($dimm,"CLASS","LOGICAL_CARD");

#Centaur/Membufs use CEN_MBA_PORT and not MBA_PORT
#For now, support both.
if (!$self->isBadAttribute($ddr, "CEN_MBA_PORT"))
{
$port_num = $self->getAttribute($ddr,"CEN_MBA_PORT");
}
#We will converge on POS_ON_MEM_PORT/MEM_PORT eventually, but
# we are leaving in support for everything for now
my $port_num = getDimmPort( $self, $ddr );
$self->setAttribute($dimm, "CEN_MBA_PORT",$port_num); #hwp
$self->setAttribute($dimm, "MBA_PORT",$port_num); #legacy
$self->setAttribute($dimm, "MEM_PORT",$port_num); #converged

if (!$self->isBadAttribute($ddr, "CEN_MBA_DIMM"))
{
$dimm_num = $self->getAttribute($ddr,"CEN_MBA_DIMM");
}
my $dimm_num = getDimmPos( $self, $ddr );
$self->setAttribute($dimm, "CEN_MBA_DIMM",$dimm_num); #hwp
$self->setAttribute($dimm, "MBA_DIMM",$dimm_num); #legacy
$self->setAttribute($dimm, "POS_ON_MEM_PORT",$dimm_num); #converged

$self->setAttribute($dimm,"CEN_MBA_PORT",$port_num);
$self->setAttribute($dimm,"CEN_MBA_DIMM",$dimm_num);

my $aff_pos = DIMMS_PER_PROC*$proc+
DIMMS_PER_DMI*$dmi_num+
DIMMS_PER_MBAPORT*$mba+
$port_num + 2*$dimm_num;
DIMMS_PER_MBA*$mba+
MAX_DIMMS_PER_MBA_PORT*$port_num + $dimm_num;
my $fapi_pos =
(($node * $maxInstance{"PROC"}) + $proc ) * DIMMS_PER_PROC +
DIMMS_PER_DMI*$dmi_num+
DIMMS_PER_MBAPORT*$mba+
$port_num + 2*$dimm_num;
DIMMS_PER_MBA*$mba+
MAX_DIMMS_PER_MBA_PORT*$port_num + $dimm_num;

#unique offset per system
my $dimm_ordinal_id = (($node * $maxInstance{"PROC"}) + $proc ) * DIMMS_PER_PROC +
DIMMS_PER_DMI*$dmi_num+
DIMMS_PER_MBAPORT*$mba+
$port_num + 2*$dimm_num;
DIMMS_PER_MBA*$mba+
MAX_DIMMS_PER_MBA_PORT*$port_num + $dimm_num;

$self->setAttribute($dimm, "AFFINITY_PATH",
$membuf_aff . "/mba-$mba/dimm-$dimmPos" );
Expand All @@ -1658,7 +1683,9 @@ sub processMc

$self->setAttribute($dimm, "POSITION", $aff_pos);

$self->setAttribute($dimm, "REL_POS", $aff_pos);
$self->setAttribute($dimm, "REL_POS",
MAX_DIMMS_PER_MBA_PORT*$port_num +
$dimm_num);

$self->setAttribute($dimm, "VPD_REC_NUM", $self->{dimm_tpos});

Expand Down Expand Up @@ -2458,6 +2485,84 @@ sub getSystemName
return $self->getAttribute("/".$self->{TOP_LEVEL}, "SYSTEM_NAME");
}

#--------------------------------------------------
## Utility function to process all of the existing
## types of dimm port attributes that we have
## supported.
sub getDimmPort
{
my $self = shift;

# input can be a dimm connector or a ddr target
# data exist on the dimm_port in the xml but
# we mirror it to the ddr while processing (somewhere...)
my $targ = shift;

# output values
my $port_num = 0;

#We will converge on MEM_PORT eventually, but
# we are leaving in support for everything for now
if (!$self->isBadAttribute($targ, "MEM_PORT"))
{
$port_num = $self->getAttribute($targ,"MEM_PORT");
}
elsif (!$self->isBadAttribute($targ, "CEN_MBA_PORT"))
{
$port_num = $self->getAttribute($targ,"CEN_MBA_PORT");
}
elsif( !$self->isBadAttribute($targ, "MBA_PORT"))
{
$port_num = $self->getAttribute($targ,"MBA_PORT");
}
else
{
print("ERROR: There is no memory port defined for target $targ\n");
$self->myExit(4);
}

return $port_num;
}

#--------------------------------------------------
## Utility function to process all of the existing
## types of dimm port position attributes that we have
## supported.
sub getDimmPos
{
my $self = shift;

# input can be a dimm connector or a ddr target
# data exist on the dimm_port in the xml but
# we mirror it to the ddr while processing (somewhere...)
my $targ = shift;

# output values
my $dimm_num = 0;

#We will converge on POS_ON_MEM_PORT eventually, but
# we are leaving in support for everything for now
if (!$self->isBadAttribute($targ, "POS_ON_MEM_PORT"))
{
$dimm_num = $self->getAttribute($targ,"POS_ON_MEM_PORT");
}
elsif (!$self->isBadAttribute($targ, "CEN_MBA_DIMM"))
{
$dimm_num = $self->getAttribute($targ,"CEN_MBA_DIMM");
}
elsif( !$self->isBadAttribute($targ, "MBA_DIMM"))
{
$dimm_num = $self->getAttribute($targ,"MBA_DIMM");
}
else
{
print("ERROR: CEN_MBA_DIMM not defined for dimm $targ\n");
$self->myExit(4);
}

return $dimm_num;
}

sub myExit
{
my $self = shift;
Expand Down
53 changes: 16 additions & 37 deletions src/usr/targeting/common/processMrw.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2212,39 +2212,37 @@ sub processMembufVpdAssociation
## Finds I2C connections to DIMM and creates EEPROM attributes
## FYI: I had to handle DMI busses in framework because they
## define affinity path
#@TODO RTC:163874 -- centaur support
sub processMembuf
{
my $targetObj = shift;
my $target = shift;
if ($targetObj->isBadAttribute($target, "PHYS_PATH", ""))
my $membufTarg = shift;
if ($targetObj->isBadAttribute($membufTarg, "PHYS_PATH", ""))
{
##dmi is probably not connected. will get caught in error checking
return;
}
processMembufVpdAssociation($targetObj,$target);
processMembufVpdAssociation($targetObj,$membufTarg);
## find port mapping
my %dimm_portmap;
foreach my $child (@{$targetObj->getTargetChildren($target)})
foreach my $child (@{$targetObj->getTargetChildren($membufTarg)})
{
if ($targetObj->getType($child) eq "MBA")
{
# find this MBA's position relative to the membuf
my $mba_num = $targetObj->getAttribute($child,"MBA_NUM");
my $dimms=$targetObj->findConnections($child,"DDR4","");
# follow the DDR4 bus connection to find the 'ddr' targets
my $ddrs = $targetObj->findConnections($child,"DDR4","");
if ($dimms ne "")
if ($ddrs ne "")
{
foreach my $dimm (@{$dimms->{CONN}})
foreach my $ddr (@{$ddrs->{CONN}})
{
my $port_num = $targetObj->getAttribute(
$dimm->{SOURCE},"MBA_PORT");
my $dimm_num = $targetObj->getAttribute(
$dimm->{SOURCE},"MBA_DIMM");
my $port_num = $targetObj->getDimmPort($ddr->{SOURCE});
my $dimm_num = $targetObj->getDimmPos($ddr->{SOURCE});
my $map = oct("0b".$mba_num.$port_num.$dimm_num);
$dimm_portmap{$dimm->{DEST_PARENT}} = $map;
$dimm_portmap{$ddr->{DEST_PARENT}} = $map;
}
}
}
Expand All @@ -2253,7 +2251,7 @@ sub processMembuf
## Process MEMBUF to DIMM I2C connections
my @addr_map=('0','0','0','0','0','0','0','0');
my $dimms=$targetObj->findConnections($target,"I2C","SPD");
my $dimms=$targetObj->findConnections($membufTarg,"I2C","SPD");
if ($dimms ne "") {
foreach my $dimm (@{$dimms->{CONN}}) {
my $dimm_target = $targetObj->getTargetParent($dimm->{DEST_PARENT});
Expand All @@ -2271,32 +2269,13 @@ sub processMembuf
$addr_map[$map] = $field;
}
}
$targetObj->setAttribute($target,
$targetObj->setAttribute($membufTarg,
"MRW_MEM_SENSOR_CACHE_ADDR_MAP","0x".join("",@addr_map));
## Update bus speeds
processI2cSpeeds($targetObj,$target);
## Do MBA port mapping
my %mba_port_map;
#@TODO RTC:175881 -- Support DDR3 DIMMs on Fleetwood systems
my $ddrs=$targetObj->findConnections($target,"DDR4","DIMM");
if ($ddrs ne "") {
my %portmap;
foreach my $ddr (@{$ddrs->{CONN}}) {
my $mba=$ddr->{SOURCE};
my $dimm=$ddr->{DEST_PARENT};
my ($dimmnum,$port)=split(//,sprintf("%02b\n",$portmap{$mba}));
$targetObj->setAttribute($dimm, "MBA_DIMM",$dimmnum);
$targetObj->setAttribute($dimm, "MBA_PORT",$port);
$portmap{$mba}++;
## Copy connector attributes
my $dimmconn=$targetObj->getTargetParent($dimm);
}
}
processI2cSpeeds($targetObj,$membufTarg);
processPowerRails($targetObj, $target);
processPowerRails($targetObj, $membufTarg);
}
sub getI2cMapField
Expand Down

0 comments on commit 5090c19

Please sign in to comment.