From patchwork Wed Aug 31 20:50:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic PALLARDY X-Patchwork-Id: 9307841 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9C82060487 for ; Wed, 31 Aug 2016 20:54:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F4182909A for ; Wed, 31 Aug 2016 20:54:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83DE0290B0; Wed, 31 Aug 2016 20:54:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35EEE2909A for ; Wed, 31 Aug 2016 20:54:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933693AbcHaUv3 (ORCPT ); Wed, 31 Aug 2016 16:51:29 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:23275 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933452AbcHaUv1 (ORCPT ); Wed, 31 Aug 2016 16:51:27 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u7VKkmQo018578; Wed, 31 Aug 2016 22:51:24 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-.pphosted.com with ESMTP id 255bs839cx-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 31 Aug 2016 22:51:24 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id C645E34; Wed, 31 Aug 2016 20:51:23 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id AC5B950E2; Wed, 31 Aug 2016 20:51:23 +0000 (GMT) Received: from localhost (10.129.5.21) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.279.2; Wed, 31 Aug 2016 22:51:22 +0200 From: Loic Pallardy To: , , CC: , , , Subject: [PATCH v2 09/19] remoteproc: core: Finalize dump resource table function Date: Wed, 31 Aug 2016 22:50:12 +0200 Message-ID: <1472676622-32533-10-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1472676622-32533-1-git-send-email-loic.pallardy@st.com> References: <1472676622-32533-1-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 X-Originating-IP: [10.129.5.21] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-08-31_04:, , signatures=0 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Diverse updates: - add cfg field display of vdev struct - add support of spare resource - put rproc_dump_resource_table under DEBUG compilation flag Signed-off-by: Loic Pallardy --- drivers/remoteproc/remoteproc_core.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index cd64fae..345bdfb 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -791,15 +791,17 @@ static void rproc_resource_cleanup(struct rproc *rproc) rproc_remove_virtio_dev(rvdev); } +#if defined(DEBUG) static void rproc_dump_resource_table(struct rproc *rproc, struct resource_table *table, int size) { - const char *types[] = {"carveout", "devmem", "trace", "vdev"}; + static const char *types[] = {"carveout", "devmem", "trace", "vdev", "spare"}; struct device *dev = &rproc->dev; struct fw_rsc_carveout *c; struct fw_rsc_devmem *d; struct fw_rsc_trace *t; struct fw_rsc_vdev *v; + struct fw_rsc_spare *s; int i, j; if (!table) { @@ -814,6 +816,8 @@ static void rproc_dump_resource_table(struct rproc *rproc, int offset = table->offset[i]; struct fw_rsc_hdr *hdr = (void *)table + offset; void *rsc = (void *)hdr + sizeof(*hdr); + unsigned char *cfg; + int len; switch (hdr->type) { case RSC_CARVEOUT: @@ -867,14 +871,35 @@ static void rproc_dump_resource_table(struct rproc *rproc, dev_dbg(dev, " Reserved (should be zero) [%d]\n\n", v->vring[j].reserved); } + + dev_dbg(dev, " Config table\n"); + cfg = (unsigned char *)(&v->vring[v->num_of_vrings]); + len = 0; + do { + j = min(16, v->config_len - len); + dev_dbg(dev, " Config[%2d-%2d] = %*phC\n", + len, len + j - 1, j, cfg + len); + len += j; + } while (len < v->config_len); + + break; + case RSC_SPARE: + s = rsc; + dev_dbg(dev, "Entry %d is of type %s\n", i, types[hdr->type]); + dev_dbg(dev, " Spare size: 0x%x bytes\n\n", s->len); break; default: - dev_dbg(dev, "Invalid resource type found: %d [hdr: %p]\n", - hdr->type, hdr); + dev_dbg(dev, "Entry %d: Invalid resource type found: %d [hdr: %p]\n", + i, hdr->type, hdr); return; } } } +#else +static inline void rproc_dump_resource_table(struct rproc *rproc, + struct resource_table *table, int size) +{} +#endif int rproc_request_resource(struct rproc *rproc, u32 type, u32 action, void *resource) {