From patchwork Mon Apr 14 16:25:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 3983991 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 44FF1BFF02 for ; Mon, 14 Apr 2014 16:41:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 63E93201DC for ; Mon, 14 Apr 2014 16:41:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B7D22018E for ; Mon, 14 Apr 2014 16:41:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755553AbaDNQkL (ORCPT ); Mon, 14 Apr 2014 12:40:11 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:46102 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755552AbaDNQ0I (ORCPT ); Mon, 14 Apr 2014 12:26:08 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s3EGPRDg008595; Mon, 14 Apr 2014 11:25:27 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3EGPRge013140; Mon, 14 Apr 2014 11:25:27 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Mon, 14 Apr 2014 11:25:27 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3EGPRGI021622; Mon, 14 Apr 2014 11:25:27 -0500 From: Nishanth Menon To: Tony Lindgren , Santosh Shilimkar , Sricharan R CC: Sekhar Nori , Rajendra Nayak , Nishanth Menon , Peter Ujfalusi , , , , Subject: [PATCH 06/15] bus: omap_l3_noc: make error reporting and handling common. Date: Mon, 14 Apr 2014 11:25:17 -0500 Message-ID: <1397492726-17203-8-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1397492726-17203-1-git-send-email-nm@ti.com> References: <1397492726-17203-1-git-send-email-nm@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The logic between handling CUSTOM_ERROR and STANDARD_ERROR is just the reporting style. So make it generic, simplify and standardize the reporting with both master and target information printed to log. While at it, fix a minor formatting error. Signed-off-by: Nishanth Menon --- drivers/bus/omap_l3_noc.c | 47 ++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/drivers/bus/omap_l3_noc.c b/drivers/bus/omap_l3_noc.c index 0ef8b75..0f0417a 100644 --- a/drivers/bus/omap_l3_noc.c +++ b/drivers/bus/omap_l3_noc.c @@ -58,6 +58,8 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3) void __iomem *l3_targ_stderr, *l3_targ_slvofslsb, *l3_targ_mstaddr; char *target_name, *master_name = "UN IDENTIFIED"; struct l3_target_data *l3_targ_inst; + char *err_description; + char err_string[30] = { 0 }; /* Get the Type of interrupt */ inttype = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR; @@ -73,6 +75,8 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3) /* Get the corresponding error and analyse */ if (err_reg) { + bool std_err = true; + /* Identify the source from control status register */ err_src = __ffs(err_reg); l3_targ_inst = &l3_targ[i][err_src]; @@ -89,35 +93,42 @@ static irqreturn_t l3_interrupt_handler(int irq, void *_l3) std_err_main = readl_relaxed(l3_targ_stderr); masterid = readl_relaxed(l3_targ_mstaddr); + for (k = 0; k < NUM_OF_L3_MASTERS; k++) { + if (masterid == l3_masters[k].id) + master_name = l3_masters[k].name; + } + switch (std_err_main & CUSTOM_ERROR) { case STANDARD_ERROR: - WARN(true, "L3 standard error: TARGET:%s at address 0x%x\n", - target_name, - readl_relaxed(l3_targ_slvofslsb)); - /* clear the std error log*/ - clear = std_err_main | CLEAR_STDERR_LOG; - writel_relaxed(clear, l3_targ_stderr); + err_description = "Standard"; + snprintf(err_string, sizeof(err_string), + ": At Address: 0x%08X", + readl_relaxed(l3_targ_slvofslsb)); break; case CUSTOM_ERROR: - for (k = 0; k < NUM_OF_L3_MASTERS; k++) { - if (masterid == l3_masters[k].id) - master_name = - l3_masters[k].name; - } - WARN(true, "L3 custom error: MASTER:%s TARGET:%s\n", - master_name, target_name); - /* clear the std error log*/ - clear = std_err_main | CLEAR_STDERR_LOG; - writel_relaxed(clear, l3_targ_stderr); + err_description = "Custom"; break; default: + std_err = false; /* Nothing to be handled here as of now */ break; } - /* Error found so break the for loop */ - break; + + if (std_err) { + WARN(true, + "L3 %s Error: MASTER %s TARGET %s %s\n", + err_description, + master_name, target_name, + err_string); + /* clear the std error log*/ + clear = std_err_main | CLEAR_STDERR_LOG; + writel_relaxed(clear, l3_targ_stderr); + } + + /* Error found so break the for loop */ + break; } } return IRQ_HANDLED;