diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index c1360e0..ca1318c 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -15,6 +15,8 @@
#include<linux/of_fdt.h>
#include<linux/string.h>
#include<linux/errno.h>
+#include<asm-generic/vmlinux.lds.h>
+
#ifdef CONFIG_PPC
#include<asm/machdep.h>
@@ -604,3 +606,49 @@ void __init unflatten_device_tree(void)
pr_debug("<- unflatten_device_tree()\n");
}
+
+extern uint8_t __dtb_start[];
+extern uint8_t __dtb_end[];
+static void __init *of_flat_dt_find_compatible_dtb(char *name)
+{
+ void *rc = NULL;
+ unsigned long root, size;
+ struct boot_param_header *orig_initial_boot_params;
+ uint8_t *blob;
+
+ orig_initial_boot_params = initial_boot_params;
+ blob = __dtb_start;
+ initial_boot_params = (struct boot_param_header *)blob;
Oy... can you avoid the pointer dance by using of_fdt_is_compatible()
from my recent set of patches?
It takes a blob argument. Then the loop below goes away.
Steve
+OF_DT_HEADER) {
+
+ while (blob< __dtb_end) {
+ if (be32_to_cpu(initial_boot_params->magic) !=
+ WARN(1, "Invalid device tree blob invmlinux\n");+ break;of_flat_dt_find_compatible_dtb(line);
+ }
+
+ root = of_get_flat_dt_root();
+ if (of_flat_dt_is_compatible(root, name)> 0) {
+ rc = blob;
+ break;
+ }
+
+ size = be32_to_cpu(initial_boot_params->totalsize);
+ blob = PTR_ALIGN(blob + size, STRUCT_ALIGNMENT);
+ initial_boot_params = (struct boot_param_header *)blob;
+ }
+
+ if (rc == NULL)
+ initial_boot_params = orig_initial_boot_params;
+ return rc;
+}
+
+
+static int __init of_flat_dtb_compat_setup(char *line)
+{
+ if (!initial_boot_params)
+ initial_boot_params =
+ return 1;
+}
+
+early_param("dtb_compat", of_flat_dtb_compat_setup);
+
--
1.7.2.3
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss@xxxxxxxxxxxxxxxx
https://lists.ozlabs.org/listinfo/devicetree-discuss
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.