mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] pstore: implement devinfo callback
Date: Mon, 22 Jul 2024 19:06:35 +0200	[thread overview]
Message-ID: <20240722170635.3868432-1-a.fatoum@pengutronix.de> (raw)

The layout and memory region used for ramoops is normally described in
the device tree, but for barebox, it's instead specified via Kconfig
options.

To make it easy to check what parameters ramoops was initialized with,
add a devinfo callback and a resource mapping the region.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 fs/pstore/ram.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 4cdeca904fad..a2b11a02eeff 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -517,6 +517,18 @@ static int ramoops_of_fixup(struct device_node *root, void *data)
 	return 0;
 }
 
+static void ramoops_devinfo(struct device *dev)
+{
+	struct ramoops_context *cxt = &oops_cxt;
+
+	printf("ramoops layout:\n");
+	printf("  record-size = %zu\n", cxt->record_size);
+	printf("  console-size = %zu\n", cxt->console_size);
+	printf("  ftrace-size = %zu\n", cxt->ftrace_size);
+	printf("  pmsg-size = %zu\n", cxt->pmsg_size);
+	printf("  ecc-size = %u\n", cxt->ecc_info.ecc_size);
+}
+
 static int ramoops_probe(struct device *dev)
 {
 	struct ramoops_platform_data *pdata = dummy_data;
@@ -629,6 +641,10 @@ static int ramoops_probe(struct device *dev)
 		of_register_fixup(ramoops_of_fixup, pdata);
 	}
 
+	device_add_resource(dev, "mem", pdata->mem_address, pdata->mem_size,
+			    IORESOURCE_MEM);
+	dev->info = ramoops_devinfo;
+
 	return 0;
 
 fail_buf:
-- 
2.39.2




             reply	other threads:[~2024-07-22 17:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-22 17:06 Ahmad Fatoum [this message]
2024-07-24  8:14 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240722170635.3868432-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox