diff options
author | Claudio Carvalho <cclaudio@linux.vnet.ibm.com> | 2017-10-12 02:03:56 -0300 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-10-15 20:08:14 -0500 |
commit | b307a54d9672d779c31a82dd045587300a0eeedc (patch) | |
tree | 90db10104b24486a1207a8717a1d81189e36b4ba | |
parent | f0379b84b9088796d61287a3ab31bf5a54519df7 (diff) | |
download | skiboot-b307a54d9672d779c31a82dd045587300a0eeedc.zip skiboot-b307a54d9672d779c31a82dd045587300a0eeedc.tar.gz skiboot-b307a54d9672d779c31a82dd045587300a0eeedc.tar.bz2 |
hdata/i2c: log unknown i2c devices
An i2c device is unknown if either the i2c device list is outdated or
the device is marked as unknown (0xFF) in the hdat.
This log both cases.
Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com>
Reviewed-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | hdata/i2c.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/hdata/i2c.c b/hdata/i2c.c index 2e14212..9fb8513 100644 --- a/hdata/i2c.c +++ b/hdata/i2c.c @@ -165,6 +165,7 @@ int parse_i2c_devs(const struct HDIF_common_hdr *hdr, int idata_index, uint32_t i2c_addr; uint32_t version; uint32_t size; + uint32_t purpose; int i, count; /* @@ -226,11 +227,9 @@ int parse_i2c_devs(const struct HDIF_common_hdr *hdr, int idata_index, */ i2c_addr = dev->i2c_addr >> 1; - prlog(PR_TRACE, "HDAT I2C: found e%dp%d - %x\n", - dev->i2cm_engine, dev->i2cm_port, i2c_addr); - + purpose = be32_to_cpu(dev->purpose); type = map_type(dev->type); - label = map_label(be32_to_cpu(dev->purpose)); + label = map_label(purpose); if (type) { compat = type->compat; name = type->name; @@ -239,6 +238,20 @@ int parse_i2c_devs(const struct HDIF_common_hdr *hdr, int idata_index, compat = NULL; } + /* + * An i2c device is unknown if either the i2c device list is + * outdated or the device is marked as unknown (0xFF) in the + * hdat. Log both cases to see what/where/why. + */ + if (!type || dev->type == 0xFF) + prlog(PR_WARNING, "HDAT I2C: found e%dp%d - %s@%x (%#x:%s)\n", + dev->i2cm_engine, dev->i2cm_port, name, i2c_addr, + purpose, label); + else + prlog(PR_TRACE, "HDAT I2C: found e%dp%d - %s@%x (%#x:%s)\n", + dev->i2cm_engine, dev->i2cm_port, name, i2c_addr, + purpose, label); + node = dt_new_addr(bus, name, i2c_addr); if (!node) continue; |