[PATCH] pstore: implement devinfo callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux