mirror of https://gitlab.com/qemu-project/dtc.git
livetree: add missing type markers in generated overlay properties
The YAML output fails for overlays and when symbol generation are enabled due to missing markers in the generated properties. Add type markers when generating properties under '__symbols__' and '__fixups__' nodes as well as target-path properties. As a side effect of append_to_property() changes, this also sets type markers in '__local_fixups__' node properties. Signed-off-by: Rob Herring <robh@kernel.org> Message-Id: <20190517202804.9084-1-robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
825146d13d
commit
87963ee206
3
dtc.h
3
dtc.h
|
@ -231,7 +231,8 @@ void add_child(struct node *parent, struct node *child);
|
||||||
void delete_node_by_name(struct node *parent, char *name);
|
void delete_node_by_name(struct node *parent, char *name);
|
||||||
void delete_node(struct node *node);
|
void delete_node(struct node *node);
|
||||||
void append_to_property(struct node *node,
|
void append_to_property(struct node *node,
|
||||||
char *name, const void *data, int len);
|
char *name, const void *data, int len,
|
||||||
|
enum markertype type);
|
||||||
|
|
||||||
const char *get_unitname(struct node *node);
|
const char *get_unitname(struct node *node);
|
||||||
struct property *get_property(struct node *node, const char *propname);
|
struct property *get_property(struct node *node, const char *propname);
|
||||||
|
|
18
livetree.c
18
livetree.c
|
@ -249,6 +249,7 @@ struct node * add_orphan_node(struct node *dt, struct node *new_node, char *ref)
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
if (ref[0] == '/') {
|
if (ref[0] == '/') {
|
||||||
|
d = data_add_marker(d, TYPE_STRING, ref);
|
||||||
d = data_append_data(d, ref, strlen(ref) + 1);
|
d = data_append_data(d, ref, strlen(ref) + 1);
|
||||||
|
|
||||||
p = build_property("target-path", d, NULL);
|
p = build_property("target-path", d, NULL);
|
||||||
|
@ -350,17 +351,20 @@ void delete_node(struct node *node)
|
||||||
}
|
}
|
||||||
|
|
||||||
void append_to_property(struct node *node,
|
void append_to_property(struct node *node,
|
||||||
char *name, const void *data, int len)
|
char *name, const void *data, int len,
|
||||||
|
enum markertype type)
|
||||||
{
|
{
|
||||||
struct data d;
|
struct data d;
|
||||||
struct property *p;
|
struct property *p;
|
||||||
|
|
||||||
p = get_property(node, name);
|
p = get_property(node, name);
|
||||||
if (p) {
|
if (p) {
|
||||||
d = data_append_data(p->val, data, len);
|
d = data_add_marker(p->val, type, name);
|
||||||
|
d = data_append_data(d, data, len);
|
||||||
p->val = d;
|
p->val = d;
|
||||||
} else {
|
} else {
|
||||||
d = data_append_data(empty_data, data, len);
|
d = data_add_marker(empty_data, type, name);
|
||||||
|
d = data_append_data(d, data, len);
|
||||||
p = build_property(name, d, NULL);
|
p = build_property(name, d, NULL);
|
||||||
add_property(node, p);
|
add_property(node, p);
|
||||||
}
|
}
|
||||||
|
@ -858,8 +862,8 @@ static void generate_label_tree_internal(struct dt_info *dti,
|
||||||
|
|
||||||
/* insert it */
|
/* insert it */
|
||||||
p = build_property(l->label,
|
p = build_property(l->label,
|
||||||
data_copy_mem(node->fullpath,
|
data_copy_escape_string(node->fullpath,
|
||||||
strlen(node->fullpath) + 1),
|
strlen(node->fullpath)),
|
||||||
NULL);
|
NULL);
|
||||||
add_property(an, p);
|
add_property(an, p);
|
||||||
}
|
}
|
||||||
|
@ -910,7 +914,7 @@ static void add_fixup_entry(struct dt_info *dti, struct node *fn,
|
||||||
|
|
||||||
xasprintf(&entry, "%s:%s:%u",
|
xasprintf(&entry, "%s:%s:%u",
|
||||||
node->fullpath, prop->name, m->offset);
|
node->fullpath, prop->name, m->offset);
|
||||||
append_to_property(fn, m->ref, entry, strlen(entry) + 1);
|
append_to_property(fn, m->ref, entry, strlen(entry) + 1, TYPE_STRING);
|
||||||
|
|
||||||
free(entry);
|
free(entry);
|
||||||
}
|
}
|
||||||
|
@ -993,7 +997,7 @@ static void add_local_fixup_entry(struct dt_info *dti,
|
||||||
free(compp);
|
free(compp);
|
||||||
|
|
||||||
value_32 = cpu_to_fdt32(m->offset);
|
value_32 = cpu_to_fdt32(m->offset);
|
||||||
append_to_property(wn, prop->name, &value_32, sizeof(value_32));
|
append_to_property(wn, prop->name, &value_32, sizeof(value_32), TYPE_UINT32);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void generate_local_fixups_tree_internal(struct dt_info *dti,
|
static void generate_local_fixups_tree_internal(struct dt_info *dti,
|
||||||
|
|
Loading…
Reference in New Issue