summaryrefslogtreecommitdiffstats
path: root/src/usr/targeting/common
diff options
context:
space:
mode:
authorMike Baiocchi <baiocchi@us.ibm.com>2014-11-03 10:31:42 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-12-03 08:21:06 -0600
commite6b7b30e1722ea948c090bf757e04510517ff890 (patch)
tree63e33d8ed9ee7d04e9abb40ac466eb273225e5fc /src/usr/targeting/common
parent6917afadcdea9e5761319c6f5d4d259563c4a6ef (diff)
downloadblackbird-hostboot-e6b7b30e1722ea948c090bf757e04510517ff890.tar.gz
blackbird-hostboot-e6b7b30e1722ea948c090bf757e04510517ff890.zip
Sync I2C and EEPROM Attributes from MRW
This commit adds additional MRW parsing and a new I2C Bus attribute to pull the needed information from the MRWs for EEPROM and I2C operations. Change-Id: I28abec9a04fe27502cab02790c00b15329a8b364 RTC: 80614 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/14298 Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> Tested-by: Jenkins Server
Diffstat (limited to 'src/usr/targeting/common')
-rwxr-xr-xsrc/usr/targeting/common/genHwsvMrwXml.pl201
-rw-r--r--src/usr/targeting/common/xmltohb/attribute_types.xml21
-rw-r--r--src/usr/targeting/common/xmltohb/target_types.xml13
3 files changed, 155 insertions, 80 deletions
diff --git a/src/usr/targeting/common/genHwsvMrwXml.pl b/src/usr/targeting/common/genHwsvMrwXml.pl
index 34b550ed3..e45c6656b 100755
--- a/src/usr/targeting/common/genHwsvMrwXml.pl
+++ b/src/usr/targeting/common/genHwsvMrwXml.pl
@@ -1232,6 +1232,53 @@ for my $i ( 0 .. $#SMembuses )
$SMembuses[$i][DIMM_PATH_FIELD] =~ s/[0-9]*$/$i/;
}
+#------------------------------------------------------------------------------
+# Process the i2c-busses MRW file
+#------------------------------------------------------------------------------
+my $i2c_busses_file = open_mrw_file($mrwdir, "${sysname}-i2c-busses.xml");
+my $i2cBus = XMLin($i2c_busses_file);
+
+# Capture all i2c buses info into the @I2Cdevices array
+use constant I2C_MASTER_NAME_FIELD => 0;
+use constant I2C_MASTER_NODE_FIELD => 1;
+use constant I2C_MASTER_POS_FIELD => 2;
+use constant I2C_MASTER_UNIT_ID_FIELD => 3;
+use constant I2C_CONTENT_TYPE_FIELD => 4;
+use constant I2C_CARD_ID_FIELD => 5;
+use constant I2C_PORT_FIELD => 6;
+use constant I2C_DEVADDR_FIELD => 7;
+use constant I2C_ENGINE_FIELD => 8;
+use constant I2C_SPEED_FIELD => 9;
+use constant I2C_SIZE_FIELD => 10;
+use constant I2C_BYTE_ADDR_OFFSET_FIELD => 11;
+use constant I2C_MAX_MEM_SIZE_FIELD => 12;
+use constant I2C_WRITE_PAGE_SIZE_FIELD => 13;
+use constant I2C_WRITE_CYCLE_TIME_FIELD => 14;
+
+my @I2Cdevices;
+foreach my $i (@{$i2cBus->{'i2c-device'}})
+{
+
+ push @I2Cdevices, [
+ $i->{'i2c-master'}->{target}->{name},
+ $i->{'i2c-master'}->{target}->{node},
+ $i->{'i2c-master'}->{target}->{position},
+ $i->{'i2c-master'}->{'unit-id'},
+ $i->{'content-type'},
+ $i->{'card-id'},
+ $i->{'i2c-master'}->{'i2c-port'},
+ $i->{address},
+ $i->{'i2c-master'}->{'i2c-engine'},
+ $i->{speed},
+ $i->{size},
+# @todo RTC 119382 - will eventually read these values from this file
+ "0x02",
+ "0x40",
+ "0x80",
+ "0x05" ];
+
+}
+
# Generate @STargets array from the @Targets array to have the order as shown
# belows. The rest of the codes assume that this order is in place
#
@@ -2562,10 +2609,9 @@ sub generate_proc
print " <!-- End FSI connections -->\n";
## End FSI ##
- # add EEPROM attributes
+ # add EEPROM attributes and I2C_BUS_SPEED_ARRAY attribute
addEeproms($sys, $node, $proc);
-
# fsp-specific proc attributes
do_plugin('fsp_proc',
$scomFspApath, $scomFspAsize, $scanFspApath, $scanFspAsize,
@@ -4479,112 +4525,109 @@ sub addProcPcieAttrs
}
}
-# RTC 80614 - these values will eventually be pulled from the MRW
sub addEeproms
{
my ($sys, $node, $proc) = @_;
my $id_name eq "";
- my $port = 0;
my $devAddr = 0x00;
- my $mur_num = $proc % 2;
-
+ my $tmp_ct eq "";
- for my $i (0 .. 3)
+ # Loop through all i2c devices
+ for my $i ( 0 .. $#I2Cdevices )
{
- # Loops on $i
- # %i = 0 -> EEPROM_VPD_PRIMARY_INFO
- # %i = 1 -> EEPROM_VPD_BACKUP_INFO
- # %i = 2 -> EEPROM_SBE_PRIMARY_INFO
- # %i = 3 -> EEPROM_SBE_BACKUP_INFO
-
- # no EEPROM_VPD_BACKUP on Murano
- if ( ($i eq 1) && ($CHIPNAME eq "murano"))
+ # Skip I2C devices that we don't care about
+ if( ( !($I2Cdevices[$i][I2C_MASTER_UNIT_ID_FIELD] eq "I2CM_PROC_PROM")
+ &&
+ !($I2Cdevices[$i][I2C_MASTER_UNIT_ID_FIELD] eq "I2CM_PROC_PROM1")
+ ) ||
+ !($I2Cdevices[$i][I2C_MASTER_NODE_FIELD] == $node) )
{
next;
}
-
- if($CHIPNAME eq "murano")
+ # Position field must match $proc with one exception:
+ # Murano's PRIMARY_MODULE_VPD has a position field one spot behind $proc
+ if ( ($CHIPNAME eq "murano") &&
+ ("$I2Cdevices[$i][I2C_CONTENT_TYPE_FIELD]" eq
+ "PRIMARY_MODULE_VPD") )
{
- if ($i eq 0 )
+ if ( ($I2Cdevices[$i][I2C_MASTER_POS_FIELD]+1) != $proc )
{
- $id_name = "EEPROM_VPD_PRIMARY_INFO";
- $port = 1;
-
- if ($mur_num eq 0)
- {
- $devAddr = 0xA4;
- }
- else
- {
- $devAddr = 0xA6;
- }
+ next;
}
+ }
+ elsif ( $I2Cdevices[$i][I2C_MASTER_POS_FIELD] != $proc)
+ {
+ next;
+ }
- # $i = 1: EEPROM_VPD_BACKUP_INFO skipped above
- elsif ($i eq 2 )
- {
- $id_name = "EEPROM_SBE_PRIMARY_INFO";
- $port = 0;
- $devAddr = 0xAC;
- }
- elsif ($i eq 3 )
- {
- $id_name = "EEPROM_SBE_BACKUP_INFO";
- $port = 0;
- $devAddr = 0xAE;
- }
+ # Convert Content Type
+ $tmp_ct = "$I2Cdevices[$i][I2C_CONTENT_TYPE_FIELD]";
+ if ( $tmp_ct eq "PRIMARY_SBE_VPD")
+ {
+ $id_name = "EEPROM_SBE_PRIMARY_INFO";
}
-
- elsif ($CHIPNAME eq "venice")
+ elsif ($tmp_ct eq "REDUNDANT_SBE_VPD")
{
- if ($i eq 0 )
- {
- $id_name = "EEPROM_VPD_PRIMARY_INFO";
- $port = 0;
- $devAddr = 0xA0;
- }
- elsif ($i eq 1 )
- {
- $id_name = "EEPROM_VPD_BACKUP_INFO";
- $port = 1;
- $devAddr = 0xA0;
- }
- elsif ($i eq 2 )
- {
- $id_name = "EEPROM_SBE_PRIMARY_INFO";
- $port = 0;
- $devAddr = 0xA2;
- }
- elsif ($i eq 3 )
- {
- $id_name = "EEPROM_SBE_BACKUP_INFO";
- $port = 1;
- $devAddr = 0xA2;
- }
+ $id_name = "EEPROM_SBE_BACKUP_INFO";
+ }
+ elsif ( ($tmp_ct eq "PRIMARY_MODULE_VPD") ||
+ ($tmp_ct eq "PRIMARY_FRU_AND_MODULE_VPD") )
+ {
+ $id_name = "EEPROM_VPD_PRIMARY_INFO";
+ }
+ elsif ($tmp_ct eq "REDUNDANT_FRU_AND_MODULE_VPD")
+ {
+ $id_name = "EEPROM_VPD_BACKUP_INFO";
+ }
+ else
+ {
+ die "ERROR: addEeproms: unrecognized Content Type $tmp_ct ($i)\n";
}
-
- # make devAddr show as a hex number
- my $devAddr_hex = sprintf("0x%02X", $devAddr);
print " <attribute>\n";
print " <id>$id_name</id>\n";
print " <default>\n";
- print " <field><id>i2cMasterPath</id><value>physical:sys-$sys/node-$node/proc-$proc</value></field>\n";
- print " <field><id>port</id><value>$port</value></field>\n";
- print " <field><id>devAddr</id><value>$devAddr_hex</value></field>\n";
- print " <field><id>engine</id><value>0</value></field>\n";
- print " <field><id>byteAddrOffset</id><value>0x02</value></field>\n";
- print " <field><id>maxMemorySizeKB</id><value>0x40</value></field>\n";
- print " <field><id>writePageSize</id><value>0x80</value></field>\n";
- print " <field><id>writeCycleTime</id><value>0x05</value></field>\n";
+ print " <field><id>i2cMasterPath</id><value>physical:"
+ "sys-$sys/node-$node/proc-$proc</value></field>\n";
+ print " <field><id>port</id><value>"
+ "$I2Cdevices[$i][I2C_PORT_FIELD]</value></field>\n";
+ print " <field><id>devAddr</id><value>0x$I2Cdevices[$i]"
+ "[I2C_DEVADDR_FIELD]</value></field>\n";
+ print " <field><id>engine</id><value>$I2Cdevices[$i]"
+ "[I2C_ENGINE_FIELD]</value></field>\n";
+ print " <field><id>byteAddrOffset</id><value>$I2Cdevices"
+ "[$i][I2C_BYTE_ADDR_OFFSET_FIELD]</value></field>\n";
+ print " <field><id>maxMemorySizeKB</id><value>$I2Cdevices"
+ "[$i][I2C_MAX_MEM_SIZE_FIELD]</value></field>\n";
+ print " <field><id>writePageSize</id><value>$I2Cdevices"
+ "[$i][I2C_WRITE_PAGE_SIZE_FIELD]</value></field>\n";
+ print " <field><id>writeCycleTime</id><value>$I2Cdevices"
+ "[$i][I2C_WRITE_CYCLE_TIME_FIELD]</value></field>\n";
print " </default>\n";
print " </attribute>\n";
+
}
+ # @todo RTC 116428 - Support for more than just processor defaults
+ # @todo RTC 117430 - Default procs to use 1MHZ speed until MRWs are updated
+
+ print " <attribute>\n";
+ print " <id>I2C_BUS_SPEED_ARRAY</id>\n";
+ print " <default>\n";
+ print " 1000,\n";
+ print " 1000,\n";
+ print " 0,\n";
+ print " 0,\n";
+ print " 0,\n";
+ print " 0\n";
+ print " </default>\n";
+ print " </attribute>\n";
+
}
+
sub get_mruid
{
my($ipath) = @_;
diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml
index 4807dbdb1..dda04e4ed 100644
--- a/src/usr/targeting/common/xmltohb/attribute_types.xml
+++ b/src/usr/targeting/common/xmltohb/attribute_types.xml
@@ -14904,6 +14904,27 @@ firmware notes: Platforms should initialize this attribute to AUTO (0)</descript
<hasStringConversion/>
</attribute>
+<attribute>
+ <id>I2C_BUS_SPEED_ARRAY</id>
+ <description>Designates the speed at which a given I2C bus should run.
+ Creator: MRW
+ Purpose: Used by FW to know the fastest possible bus speed that all of
+ the devices on a given bus are able to use.
+ Data Format: 2x3 array of uint16_t values. The first two values
+ indicate the engine number of the bus. The next 3 vaules indicate
+ the port number of the bus. The value in the array is the I2C bus
+ speed used for that engine/port combination in KHz.
+ </description>
+ <simpleType>
+ <uint16_t>
+ <default>0,0,0,0,0,0</default>
+ </uint16_t>
+ <array>2,3</array>
+ </simpleType>
+ <persistency>non-volatile</persistency>
+ <readable/>
+</attribute>
+
</attributes>
diff --git a/src/usr/targeting/common/xmltohb/target_types.xml b/src/usr/targeting/common/xmltohb/target_types.xml
index f45ef7ea4..421993a90 100644
--- a/src/usr/targeting/common/xmltohb/target_types.xml
+++ b/src/usr/targeting/common/xmltohb/target_types.xml
@@ -519,6 +519,10 @@
<attribute><id>EEPROM_VPD_BACKUP_INFO</id></attribute>
<attribute><id>EEPROM_SBE_PRIMARY_INFO</id></attribute>
<attribute><id>EEPROM_SBE_BACKUP_INFO</id></attribute>
+ <attribute>
+ <id>I2C_BUS_SPEED_ARRAY</id>
+ <default>1000,1000,0,0,0,0</default>
+ </attribute>
<!-- From PHYP Memory Map -->
<attribute><id>FSP_BASE_ADDR</id></attribute>
@@ -1351,6 +1355,10 @@
</default>
</attribute>
<attribute><id>EEPROM_VPD_PRIMARY_INFO</id></attribute>
+ <attribute>
+ <id>I2C_BUS_SPEED_ARRAY</id>
+ <default>400,0,0,0,0,0</default>
+ </attribute>
<attribute><id>MSS_VOLT</id></attribute>
<attribute><id>VPP_BASE</id></attribute>
<attribute><id>MEM_VDDR_OFFSET_MILLIVOLTS</id></attribute>
@@ -1481,6 +1489,10 @@
</attribute>
<attribute><id>EEPROM_VPD_PRIMARY_INFO</id></attribute>
+ <attribute>
+ <id>I2C_BUS_SPEED_ARRAY</id>
+ <default>400,0,0,0,0,0</default>
+ </attribute>
<attribute><id>VPD_REC_NUM</id></attribute>
<attribute><id>MSS_EFF_VPD_VERSION</id></attribute>
@@ -1495,7 +1507,6 @@
<parent>lcard-dimm</parent>
<attribute><id>MODEL</id><default>JEDEC</default></attribute>
<attribute><id>CEN_DQ_TO_DIMM_CONN_DQ</id></attribute>
- <attribute><id>EEPROM_VPD_PRIMARY_INFO</id></attribute>
</targetType>
<targetType>
OpenPOWER on IntegriCloud