]> git.sur5r.net Git - u-boot/blobdiff - scripts/dtc/livetree.c
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot
[u-boot] / scripts / dtc / livetree.c
index 36be9afefd539ae072e4dd62e3e89dfec4ce95f2..6846ad2fd6d2e54599c88c95647300fddac07771 100644 (file)
@@ -216,6 +216,28 @@ struct node *merge_nodes(struct node *old_node, struct node *new_node)
        return old_node;
 }
 
+void add_orphan_node(struct node *dt, struct node *new_node, char *ref)
+{
+       static unsigned int next_orphan_fragment = 0;
+       struct node *node;
+       struct property *p;
+       struct data d = empty_data;
+       char *name;
+
+       d = data_add_marker(d, REF_PHANDLE, ref);
+       d = data_append_integer(d, 0xffffffff, 32);
+
+       p = build_property("target", d);
+
+       xasprintf(&name, "fragment@%u",
+                       next_orphan_fragment++);
+       name_node(new_node, "__overlay__");
+       node = build_node(p, new_node);
+       name_node(node, name);
+
+       add_child(dt, node);
+}
+
 struct node *chain_node(struct node *first, struct node *list)
 {
        assert(first->next_sibling == NULL);
@@ -319,8 +341,8 @@ struct reserve_info *build_reserve_entry(uint64_t address, uint64_t size)
 
        memset(new, 0, sizeof(*new));
 
-       new->re.address = address;
-       new->re.size = size;
+       new->address = address;
+       new->size = size;
 
        return new;
 }
@@ -393,7 +415,13 @@ struct property *get_property(struct node *node, const char *propname)
 cell_t propval_cell(struct property *prop)
 {
        assert(prop->val.len == sizeof(cell_t));
-       return fdt32_to_cpu(*((cell_t *)prop->val.val));
+       return fdt32_to_cpu(*((fdt32_t *)prop->val.val));
+}
+
+cell_t propval_cell_n(struct property *prop, int n)
+{
+       assert(prop->val.len / sizeof(cell_t) >= n);
+       return fdt32_to_cpu(*((fdt32_t *)prop->val.val + n));
 }
 
 struct property *get_property_by_label(struct node *tree, const char *label,
@@ -478,7 +506,8 @@ struct node *get_node_by_path(struct node *tree, const char *path)
        p = strchr(path, '/');
 
        for_each_child(tree, child) {
-               if (p && strneq(path, child->name, p-path))
+               if (p && (strlen(child->name) == p-path) &&
+                               strneq(path, child->name, p-path))
                        return get_node_by_path(child, p+1);
                else if (!p && streq(path, child->name))
                        return child;
@@ -599,13 +628,13 @@ static int cmp_reserve_info(const void *ax, const void *bx)
        a = *((const struct reserve_info * const *)ax);
        b = *((const struct reserve_info * const *)bx);
 
-       if (a->re.address < b->re.address)
+       if (a->address < b->address)
                return -1;
-       else if (a->re.address > b->re.address)
+       else if (a->address > b->address)
                return 1;
-       else if (a->re.size < b->re.size)
+       else if (a->size < b->size)
                return -1;
-       else if (a->re.size > b->re.size)
+       else if (a->size > b->size)
                return 1;
        else
                return 0;
@@ -902,7 +931,7 @@ static void add_local_fixup_entry(struct dt_info *dti,
                struct node *refnode)
 {
        struct node *wn, *nwn;  /* local fixup node, walk node, new */
-       uint32_t value_32;
+       fdt32_t value_32;
        char **compp;
        int i, depth;