From patchwork Thu Oct 12 05:03:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Carvalho X-Patchwork-Id: 824700 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yCJfh6KxHz9s2G for ; Thu, 12 Oct 2017 16:04:12 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yCJfh5WByzDr6D for ; Thu, 12 Oct 2017 16:04:12 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=cclaudio@linux.vnet.ibm.com; receiver=) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yCJfW6D0bzDqJ7 for ; Thu, 12 Oct 2017 16:04:03 +1100 (AEDT) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9C53jrp071255 for ; Thu, 12 Oct 2017 01:04:01 -0400 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0b-001b2d01.pphosted.com with ESMTP id 2dhswcj5pd-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 12 Oct 2017 01:04:01 -0400 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Oct 2017 01:04:00 -0400 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 12 Oct 2017 01:03:59 -0400 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9C53xMP50135108; Thu, 12 Oct 2017 05:03:59 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C70FBAC043; Thu, 12 Oct 2017 01:04:38 -0400 (EDT) Received: from legolas.ibm.com (unknown [9.85.153.47]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP id 84705AC03A; Thu, 12 Oct 2017 01:04:37 -0400 (EDT) From: Claudio Carvalho To: skiboot@lists.ozlabs.org Date: Thu, 12 Oct 2017 02:03:56 -0300 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 17101205-2213-0000-0000-0000022A8A8C X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007882; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000236; SDB=6.00929910; UDB=6.00468073; IPR=6.00710178; BA=6.00005634; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017501; XFM=3.00000015; UTC=2017-10-12 05:04:00 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17101205-2214-0000-0000-000057D3F7BE Message-Id: <1507784636-31883-1-git-send-email-cclaudio@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-12_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710120074 Subject: [Skiboot] [PATCH] hdata/i2c: log unknown i2c devices X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: oohal@gmail.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 Reviewed-by: Oliver O'Halloran Signed-off-by: Stewart Smith --- hdata/i2c.c | 21 +++++++++++++++++---- 1 file 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;