mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] pstore: implement devinfo callback
@ 2024-07-22 17:06 Ahmad Fatoum
  2024-07-24  8:14 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-07-22 17:06 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] pstore: implement devinfo callback
  2024-07-22 17:06 [PATCH] pstore: implement devinfo callback Ahmad Fatoum
@ 2024-07-24  8:14 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-07-24  8:14 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Mon, 22 Jul 2024 19:06:35 +0200, Ahmad Fatoum wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] pstore: implement devinfo callback
      https://git.pengutronix.de/cgit/barebox/commit/?id=3c118d510bda (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-24  8:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-22 17:06 [PATCH] pstore: implement devinfo callback Ahmad Fatoum
2024-07-24  8:14 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox