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: 75118 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp532469qga; Wed, 31 Aug 2016 13:51:43 -0700 (PDT) X-Received: by 10.66.4.41 with SMTP id h9mr20396101pah.69.1472676699345; Wed, 31 Aug 2016 13:51:39 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ie10si1485883pad.137.2016.08.31.13.51.38; Wed, 31 Aug 2016 13:51:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933789AbcHaUvc (ORCPT + 27 others); Wed, 31 Aug 2016 16:51:32 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 1.9.1 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) {