[PATCH] ppc64: Add /proc/ppc64/flat-device-tree for debugging purposes

Michael Ellerman michael at ellerman.id.au
Mon Jul 25 13:53:17 EST 2005


This patch adds a /proc/ppc64/flat-device-tree file which exports
the flattened device tree as a binary blob. It assumes the device
tree is contiguous in memory.

I haven't tested the !initial_boot_params case, but it should be
ok looking at the code.


Index: work/arch/ppc64/kernel/proc_ppc64.c
===================================================================
--- work.orig/arch/ppc64/kernel/proc_ppc64.c
+++ work/arch/ppc64/kernel/proc_ppc64.c
@@ -69,6 +69,24 @@ core_initcall(proc_ppc64_create);
 static int __init proc_ppc64_init(void)
 {
 	struct proc_dir_entry *pde;
+#ifdef CONFIG_PROC_DEVICETREE
+	extern struct boot_param_header *initial_boot_params;
+
+	pde = create_proc_entry("ppc64/flat-device-tree",
+			S_IFREG|S_IRUGO, NULL);
+	if (!pde)
+		return 1;
+	pde->nlink = 1;
+
+	if (initial_boot_params) {
+		pde->data = initial_boot_params;
+		pde->size = initial_boot_params->totalsize;
+	} else {
+		pde->data = pde->size = 0;
+	}
+
+	pde->proc_fops = &page_map_fops;
+#endif
 
 	pde = create_proc_entry("ppc64/systemcfg", S_IFREG|S_IRUGO, NULL);
 	if (!pde)



More information about the Linuxppc64-dev mailing list