diff options
author | Sakethan R Kotta <sakkotta@in.ibm.com> | 2017-06-27 04:00:52 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-06-30 10:17:00 -0400 |
commit | addad359a11b8f624cf7503dbb830785788a06fd (patch) | |
tree | 4df0c4a7d47199d278cbc0ff32ec32c5d77662df /src | |
parent | d25c0aa86167d8b61c406bfca80e22372c6f1e38 (diff) | |
download | talos-hostboot-addad359a11b8f624cf7503dbb830785788a06fd.tar.gz talos-hostboot-addad359a11b8f624cf7503dbb830785788a06fd.zip |
I2C_ADDRESS is taken from i2c-slave if not defined in the Bus
Change-Id: Ice05829a1a45b483f94df18e990f246de2f27ccd
RTC:164489
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/42472
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: SWATHI M. BHATTIPROLU <bhmadhur@in.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
-rwxr-xr-x | src/usr/targeting/common/processMrw.pl | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/usr/targeting/common/processMrw.pl b/src/usr/targeting/common/processMrw.pl index 3a8eb3df4..40c483394 100755 --- a/src/usr/targeting/common/processMrw.pl +++ b/src/usr/targeting/common/processMrw.pl @@ -1507,8 +1507,32 @@ sub getI2cMapField 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}, + my $addr = ""; + + # For Open Power systems continue to get the I2C_ADDRESS from + # bus target, if defined. + if ($targetObj->isBusAttributeDefined( + $conn_target->{SOURCE},$conn_target->{BUS_NUM},"I2C_ADDRESS")) + { + $addr = $targetObj->getBusAttribute($conn_target->{SOURCE}, $conn_target->{BUS_NUM}, "I2C_ADDRESS"); + } + # If bus doesn't have I2C_ADDRESS or default value is not set, + # then get it from i2c-slave, if defined. + if ($addr eq "") + { + if (! $targetObj->isBadAttribute($conn_target->{DEST},"I2C_ADDRESS") ) + { + $addr = $targetObj->getAttribute($conn_target->{DEST},"I2C_ADDRESS"); + } + } + + #if the addr is still not defined, then throw an error + if ($addr eq "") + { + print ("ERROR: I2C_ADDRESS is not defined for $conn_target\n"); + $targetObj->myExit(4); + } my $bits=sprintf("%08b",hex($addr)); my $field=sprintf("%d%3s",oct($port),substr($bits,4,3)); |