Skip to content

Commit 30db384

Browse files
e-linerdcrowell77
authored andcommitted
Revert "ProcessMRW changes for dynamic i2c devices"
This reverts commit 651ed35. Change-Id: I6152ddd93890383f6c22ff07241ce5d078ab40fc Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/42221 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> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com> Reviewed-by: Prachi Gupta <pragupta@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
1 parent 8f1c625 commit 30db384

File tree

5 files changed

+12
-216
lines changed

5 files changed

+12
-216
lines changed

src/usr/i2c/i2c.C

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3858,6 +3858,9 @@ void getDeviceInfo( TARGETING::Target* i_i2cMaster,
38583858
case EEPROM::VPD_BACKUP:
38593859
l_currentDI.devicePurpose =
38603860
TARGETING::HDAT_I2C_DEVICE_PURPOSE_MODULE_VPD;
3861+
//TODO RTC:165485 this isn't currently right. we'll need
3862+
//to add the changes in the enum and possibly the other
3863+
//struct/attribute.
38613864
break;
38623865
case EEPROM::SBE_PRIMARY:
38633866
case EEPROM::SBE_BACKUP:
@@ -3943,8 +3946,8 @@ void getDeviceInfo( TARGETING::Target* i_i2cMaster,
39433946
TARGETING::ATTR_HDAT_I2C_MASTER_PORT_type l_i2cMasterPort;
39443947
(*childItr)->tryGetAttr<TARGETING::ATTR_HDAT_I2C_MASTER_PORT>(
39453948
l_i2cMasterPort);
3946-
TARGETING::ATTR_HDAT_I2C_DEVICE_TYPE_type l_i2cDevType;
3947-
(*childItr)->tryGetAttr<TARGETING::ATTR_HDAT_I2C_DEVICE_TYPE>(
3949+
TARGETING::ATTR_HDAT_I2C_DEVTYPE_type l_i2cDevType;
3950+
(*childItr)->tryGetAttr<TARGETING::ATTR_HDAT_I2C_DEVTYPE>(
39483951
l_i2cDevType);
39493952
TARGETING::ATTR_HDAT_I2C_ADDR_type l_i2cAddr;
39503953
(*childItr)->tryGetAttr<TARGETING::ATTR_HDAT_I2C_ADDR>(l_i2cAddr);
@@ -3954,8 +3957,8 @@ void getDeviceInfo( TARGETING::Target* i_i2cMaster,
39543957
TARGETING::ATTR_HDAT_I2C_BUS_FREQ_type l_i2cBusFreq;
39553958
(*childItr)->tryGetAttr<TARGETING::ATTR_HDAT_I2C_BUS_FREQ>(
39563959
l_i2cBusFreq);
3957-
TARGETING::ATTR_HDAT_I2C_DEVICE_PURPOSE_type l_i2cDevPurpose;
3958-
(*childItr)->tryGetAttr<TARGETING::ATTR_HDAT_I2C_DEVICE_PURPOSE>(
3960+
TARGETING::ATTR_HDAT_I2C_DEV_PURPOSE_type l_i2cDevPurpose;
3961+
(*childItr)->tryGetAttr<TARGETING::ATTR_HDAT_I2C_DEV_PURPOSE>(
39593962
l_i2cDevPurpose);
39603963

39613964
uint8_t l_arrayLength =
@@ -3971,7 +3974,6 @@ void getDeviceInfo( TARGETING::Target* i_i2cMaster,
39713974
l_idx++)
39723975
{
39733976
DeviceInfo_t l_currentDevice;
3974-
l_currentDevice.masterChip = (*childItr);
39753977
l_currentDevice.engine = l_i2cEngine[l_idx];
39763978
l_currentDevice.masterPort = l_i2cMasterPort[l_idx];
39773979
l_currentDevice.addr = l_i2cAddr[l_idx];

src/usr/targeting/common/Targets.pm

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,18 +1727,6 @@ sub getBusAttribute
17271727
->{default};
17281728
}
17291729

1730-
## returns a boolean for if a given bus attribute is defined
1731-
sub isBusAttributeDefined
1732-
{
1733-
my $self = shift;
1734-
my $target = shift;
1735-
my $busnum = shift;
1736-
my $attr = shift;
1737-
my $target_ptr = $self->getTarget($target);
1738-
1739-
return defined($target_ptr->{CONNECTION}->{BUS}->[$busnum]->{bus_attribute}
1740-
->{$attr}->{default});
1741-
}
17421730

17431731
## returns a pointer to an array of children target names
17441732
sub getTargetChildren
@@ -2082,10 +2070,6 @@ to value C<VALUE>. This is for complex attributes.
20822070
Gets the attribute C<ATTRIBUTE_NAME> from bus C<TARGET_STRING> bus number
20832071
C<INDEX>.
20842072
2085-
=item isBusAttributeDefined(C<TARGET_STRING>,C<INDEX>.C<ATTRIBUTE_NAME>)
2086-
2087-
Looks for a specific attribute and returns if it exists or not
2088-
20892073
=item getTargetChildren(C<TARGET_STRING>)
20902074
20912075
Returns an array of target strings representing all the children of target

src/usr/targeting/common/processMrw.pl

Lines changed: 0 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -512,15 +512,6 @@ sub processProcessor
512512
$targetObj->setMasterProc($target);
513513
}
514514

515-
# I2C arrays
516-
my @engine = ();
517-
my @port = ();
518-
my @slavePort = ();
519-
my @addr = ();
520-
my @speed = ();
521-
my @type = ();
522-
my @purpose = ();
523-
524515
$targetObj->log($target, "Processing PROC");
525516
foreach my $child (@{ $targetObj->getTargetChildren($target) })
526517
{
@@ -576,58 +567,8 @@ sub processProcessor
576567
{
577568
processOcc($targetObj, $child, $target);
578569
}
579-
# Ideally this should be $child_type eq "I2C", but we need a change
580-
# in serverwiz and the witherspoon.xml first
581-
elsif (index($child,"i2c-master") != -1)
582-
{
583-
my ($i2cEngine, $i2cPort, $i2cSlavePort, $i2cAddr,
584-
$i2cSpeed, $i2cType, $i2cPurpose) =
585-
processI2C($targetObj, $child, $target);
586-
587-
# Add this I2C device's information to the proc array
588-
push(@engine,@$i2cEngine);
589-
push(@port,@$i2cPort);
590-
push(@slavePort,@$i2cSlavePort);
591-
push(@addr,@$i2cAddr);
592-
push(@speed,@$i2cSpeed);
593-
push(@type,@$i2cType);
594-
push(@purpose,@$i2cPurpose);
595-
596-
}
597570
}
598571

599-
# Add final I2C arrays to processor
600-
my $size = scalar @engine;
601-
my $engine_attr = $engine[0];
602-
my $port_attr = $port[0];
603-
my $slave_attr = $slavePort[0];
604-
my $addr_attr = $addr[0];
605-
my $speed_attr = $speed[0];
606-
my $type_attr = "0x".$type[0];
607-
my $purpose_attr = "0x".$purpose[0];
608-
609-
# Parse out array to print as a string
610-
foreach my $n (1..($size-1))
611-
{
612-
$engine_attr .= ",".$engine[$n];
613-
$port_attr .= ",".$port[$n];
614-
$slave_attr .= ",".$slavePort[$n];
615-
$addr_attr .= ",".$addr[$n];
616-
$speed_attr .= ",".$speed[$n];
617-
$type_attr .= ",0x".$type[$n];
618-
$purpose_attr .= ",0x".$purpose[$n];
619-
}
620-
621-
# Set the arrays to the corresponding attribute on the proc
622-
$targetObj->setAttribute($target,"HDAT_I2C_ENGINE",$engine_attr);
623-
$targetObj->setAttribute($target,"HDAT_I2C_MASTER_PORT",$port_attr);
624-
$targetObj->setAttribute($target,"HDAT_I2C_SLAVE_PORT",$slave_attr);
625-
$targetObj->setAttribute($target,"HDAT_I2C_ADDR",$addr_attr);
626-
$targetObj->setAttribute($target,"HDAT_I2C_BUS_FREQ",$speed_attr);
627-
$targetObj->setAttribute($target,"HDAT_I2C_DEVICE_TYPE",$type_attr);
628-
$targetObj->setAttribute($target,"HDAT_I2C_DEVICE_PURPOSE",$purpose_attr);
629-
$targetObj->setAttribute($target,"HDAT_I2C_ELEMENTS",$size);
630-
631572
## update path for mvpd's and sbe's
632573
my $path = $targetObj->getAttribute($target, "PHYS_PATH");
633574
my $model = $targetObj->getAttribute($target, "MODEL");
@@ -1562,137 +1503,6 @@ sub getI2cMapField
15621503
return $hexfield;
15631504
}
15641505

1565-
#------------------------------------------------------------------------------
1566-
# I2C
1567-
#
1568-
sub processI2C
1569-
{
1570-
my $targetObj = shift; # Top Hierarchy of targeting structure
1571-
my $target = shift; # I2C targetInstance
1572-
my $parentTarget = shift; # Processor target
1573-
1574-
# Initialize output arrays
1575-
my @i2cEngine = ();
1576-
my @i2cPort = ();
1577-
my @i2cSlave = ();
1578-
my @i2cAddr = ();
1579-
my @i2cSpeed = ();
1580-
my @i2cType = ();
1581-
my @i2cPurpose = ();
1582-
1583-
# Step 1: get I2C_ENGINE and PORT from <targetInstance>
1584-
1585-
my $engine = $targetObj->getAttribute($target, "I2C_ENGINE");
1586-
if($engine eq "") {$engine = "0xFF";}
1587-
1588-
my $port = $targetObj->getAttribute($target, "I2C_PORT");
1589-
if($port eq "") {$port = "0xFF";}
1590-
1591-
# Step 2: get I2C_ADDRESS and I2C_SPEED from <bus>
1592-
# This is different for each connection.
1593-
1594-
my $i2cs = $targetObj->findConnections($parentTarget, "I2C","");
1595-
if ($i2cs ne "")
1596-
{
1597-
# This gives all i2c connections
1598-
foreach my $i2c (@{$i2cs->{CONN}})
1599-
{
1600-
# Here we are checking that the i2c source matches our target
1601-
my $source = $i2c->{SOURCE};
1602-
if ($source ne $target)
1603-
{
1604-
next;
1605-
}
1606-
1607-
# Most I2C devices will default the slave port, it is only valid
1608-
# for gpio expanders.
1609-
my $slavePort = "0xFF";
1610-
1611-
my @source_array = split(/-/,$source);
1612-
my $source_idx = scalar @source_array;
1613-
1614-
# If the last part of the source only includes numbers
1615-
if($source_array[$source_idx-1] =~ /^[0-9,.E]+$/)
1616-
{
1617-
$slavePort = $source_array[$source_idx-1];
1618-
}
1619-
1620-
my $addr;
1621-
my $speed;
1622-
my $type;
1623-
my $purpose;
1624-
1625-
# For all these attributes, we need to check if they're defined,
1626-
# and if not we set them to a default value.
1627-
if ($targetObj->isBusAttributeDefined(
1628-
$i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_ADDRESS"))
1629-
{
1630-
$addr = $targetObj->getBusAttribute(
1631-
$i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_ADDRESS");
1632-
}
1633-
1634-
if ($addr eq "") {$addr = "0xFF";}
1635-
1636-
if ($targetObj->isBusAttributeDefined(
1637-
$i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_SPEED"))
1638-
{
1639-
$speed = $targetObj->getBusAttribute(
1640-
$i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_SPEED");
1641-
}
1642-
1643-
if ($speed eq "") {$speed = "0";}
1644-
1645-
if ($targetObj->isBusAttributeDefined(
1646-
$i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_TYPE"))
1647-
{
1648-
$type = $targetObj->getBusAttribute(
1649-
$i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_TYPE");
1650-
}
1651-
1652-
if ($type eq "")
1653-
{
1654-
$type = "FF";
1655-
}
1656-
else
1657-
{
1658-
$type = $targetObj->getEnumValue("HDAT_I2C_DEVICE_TYPE",$type);
1659-
}
1660-
1661-
if ($targetObj->isBusAttributeDefined(
1662-
$i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_PURPOSE"))
1663-
{
1664-
$purpose = $targetObj->getBusAttribute(
1665-
$i2c->{SOURCE},$i2c->{BUS_NUM},"I2C_PURPOSE");
1666-
}
1667-
1668-
if ($purpose eq "")
1669-
{
1670-
$purpose = "FF";
1671-
}
1672-
else
1673-
{
1674-
$purpose = $targetObj->getEnumValue("HDAT_I2C_DEVICE_PURPOSE",
1675-
$purpose);
1676-
}
1677-
1678-
# Step 3: For each connection, create an instance in the array
1679-
# for the DeviceInfo_t struct.
1680-
push @i2cEngine, $engine;
1681-
push @i2cPort, $port;
1682-
push @i2cSlave, $slavePort;
1683-
push @i2cAddr, $addr;
1684-
push @i2cSpeed, $speed;
1685-
push @i2cType, $type;
1686-
push @i2cPurpose, $purpose;
1687-
1688-
}
1689-
}
1690-
1691-
# Return this i2c device's information back to the processor
1692-
return (\@i2cEngine, \@i2cPort, \@i2cSlave, \@i2cAddr,
1693-
\@i2cSpeed, \@i2cType, \@i2cPurpose);
1694-
}
1695-
16961506

16971507
sub setEepromAttributes
16981508
{

src/usr/targeting/common/xmltohb/attribute_types_openpower.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
</attribute>
192192

193193
<attribute>
194-
<id>HDAT_I2C_DEVICE_TYPE</id>
194+
<id>HDAT_I2C_DEVTYPE</id>
195195
<description>
196196
This attribute holds the values of the I2C device type from the i2c
197197
device connections as defined in the MRW. It is parsed into a
@@ -255,7 +255,7 @@
255255
</attribute>
256256

257257
<attribute>
258-
<id>HDAT_I2C_DEVICE_PURPOSE</id>
258+
<id>HDAT_I2C_DEV_PURPOSE</id>
259259
<description>
260260
This attribute holds the values of the I2C device purpose from the i2c
261261
device connections as defined in the MRW. It is parsed into a

src/usr/targeting/common/xmltohb/target_types_openpower.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
=====================================================================
3333
-->
3434
<targetTypeExtension>
35-
<id>chip-processor</id>
35+
<id>base</id>
3636
<attribute><id>HDAT_I2C_ENGINE</id></attribute>
3737
<attribute><id>HDAT_I2C_MASTER_PORT</id></attribute>
38-
<attribute><id>HDAT_I2C_DEVICE_TYPE</id></attribute>
38+
<attribute><id>HDAT_I2C_DEVTYPE</id></attribute>
3939
<attribute><id>HDAT_I2C_ADDR</id></attribute>
4040
<attribute><id>HDAT_I2C_SLAVE_PORT</id></attribute>
4141
<attribute><id>HDAT_I2C_BUS_FREQ</id></attribute>
42-
<attribute><id>HDAT_I2C_DEVICE_PURPOSE</id></attribute>
42+
<attribute><id>HDAT_I2C_DEV_PURPOSE</id></attribute>
4343
<attribute><id>HDAT_I2C_ELEMENTS</id></attribute>
4444
<attribute>
4545
<id>IPMI_INSTANCE</id>

0 commit comments

Comments
 (0)