Rename boot_info

struct boot_info is named that for historical reasons, and isn't
particularly meaningful.  Essentially it contains all the information -
in "live" form from a single dts or dtb file.  As we move towards support
for dynamic dt overlays, that name will become increasingly bad.

So, in preparation, rename it to dt_info.  At the same time rename the
'the_boot_info' global to 'parser_output' since that's its actual purpose.
Unfortunately we do need the global unless we switch to bison's re-entrant
parser extensions, which would introduce its own complications.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
David Gibson 2016-05-31 11:58:42 +10:00
parent 1ef86ad2c2
commit 00fbb8696b
8 changed files with 147 additions and 148 deletions

View file

@ -352,19 +352,19 @@ struct reserve_info *add_reserve_entry(struct reserve_info *list,
return list;
}
struct boot_info *build_boot_info(unsigned int dtsflags,
struct reserve_info *reservelist,
struct node *tree, uint32_t boot_cpuid_phys)
struct dt_info *build_dt_info(unsigned int dtsflags,
struct reserve_info *reservelist,
struct node *tree, uint32_t boot_cpuid_phys)
{
struct boot_info *bi;
struct dt_info *dti;
bi = xmalloc(sizeof(*bi));
bi->dtsflags = dtsflags;
bi->reservelist = reservelist;
bi->dt = tree;
bi->boot_cpuid_phys = boot_cpuid_phys;
dti = xmalloc(sizeof(*dti));
dti->dtsflags = dtsflags;
dti->reservelist = reservelist;
dti->dt = tree;
dti->boot_cpuid_phys = boot_cpuid_phys;
return bi;
return dti;
}
/*
@ -611,12 +611,12 @@ static int cmp_reserve_info(const void *ax, const void *bx)
return 0;
}
static void sort_reserve_entries(struct boot_info *bi)
static void sort_reserve_entries(struct dt_info *dti)
{
struct reserve_info *ri, **tbl;
int n = 0, i = 0;
for (ri = bi->reservelist;
for (ri = dti->reservelist;
ri;
ri = ri->next)
n++;
@ -626,14 +626,14 @@ static void sort_reserve_entries(struct boot_info *bi)
tbl = xmalloc(n * sizeof(*tbl));
for (ri = bi->reservelist;
for (ri = dti->reservelist;
ri;
ri = ri->next)
tbl[i++] = ri;
qsort(tbl, n, sizeof(*tbl), cmp_reserve_info);
bi->reservelist = tbl[0];
dti->reservelist = tbl[0];
for (i = 0; i < (n-1); i++)
tbl[i]->next = tbl[i+1];
tbl[n-1]->next = NULL;
@ -723,10 +723,10 @@ static void sort_node(struct node *node)
sort_node(c);
}
void sort_tree(struct boot_info *bi)
void sort_tree(struct dt_info *dti)
{
sort_reserve_entries(bi);
sort_node(bi->dt);
sort_reserve_entries(dti);
sort_node(dti->dt);
}
/* utility helper to avoid code duplication */
@ -755,7 +755,7 @@ static struct node *build_root_node(struct node *dt, char *name)
return an;
}
static bool any_label_tree(struct boot_info *bi, struct node *node)
static bool any_label_tree(struct dt_info *dti, struct node *node)
{
struct node *c;
@ -763,17 +763,17 @@ static bool any_label_tree(struct boot_info *bi, struct node *node)
return true;
for_each_child(node, c)
if (any_label_tree(bi, c))
if (any_label_tree(dti, c))
return true;
return false;
}
static void generate_label_tree_internal(struct boot_info *bi,
static void generate_label_tree_internal(struct dt_info *dti,
struct node *an, struct node *node,
bool allocph)
{
struct node *dt = bi->dt;
struct node *dt = dti->dt;
struct node *c;
struct property *p;
struct label *l;
@ -806,10 +806,10 @@ static void generate_label_tree_internal(struct boot_info *bi,
}
for_each_child(node, c)
generate_label_tree_internal(bi, an, c, allocph);
generate_label_tree_internal(dti, an, c, allocph);
}
static bool any_fixup_tree(struct boot_info *bi, struct node *node)
static bool any_fixup_tree(struct dt_info *dti, struct node *node)
{
struct node *c;
struct property *prop;
@ -818,20 +818,20 @@ static bool any_fixup_tree(struct boot_info *bi, struct node *node)
for_each_property(node, prop) {
m = prop->val.markers;
for_each_marker_of_type(m, REF_PHANDLE) {
if (!get_node_by_ref(bi->dt, m->ref))
if (!get_node_by_ref(dti->dt, m->ref))
return true;
}
}
for_each_child(node, c) {
if (any_fixup_tree(bi, c))
if (any_fixup_tree(dti, c))
return true;
}
return false;
}
static void add_fixup_entry(struct boot_info *bi, struct node *fn,
static void add_fixup_entry(struct dt_info *dti, struct node *fn,
struct node *node, struct property *prop,
struct marker *m)
{
@ -849,11 +849,11 @@ static void add_fixup_entry(struct boot_info *bi, struct node *fn,
append_to_property(fn, m->ref, entry, strlen(entry) + 1);
}
static void generate_fixups_tree_internal(struct boot_info *bi,
static void generate_fixups_tree_internal(struct dt_info *dti,
struct node *fn,
struct node *node)
{
struct node *dt = bi->dt;
struct node *dt = dti->dt;
struct node *c;
struct property *prop;
struct marker *m;
@ -864,15 +864,15 @@ static void generate_fixups_tree_internal(struct boot_info *bi,
for_each_marker_of_type(m, REF_PHANDLE) {
refnode = get_node_by_ref(dt, m->ref);
if (!refnode)
add_fixup_entry(bi, fn, node, prop, m);
add_fixup_entry(dti, fn, node, prop, m);
}
}
for_each_child(node, c)
generate_fixups_tree_internal(bi, fn, c);
generate_fixups_tree_internal(dti, fn, c);
}
static bool any_local_fixup_tree(struct boot_info *bi, struct node *node)
static bool any_local_fixup_tree(struct dt_info *dti, struct node *node)
{
struct node *c;
struct property *prop;
@ -881,20 +881,20 @@ static bool any_local_fixup_tree(struct boot_info *bi, struct node *node)
for_each_property(node, prop) {
m = prop->val.markers;
for_each_marker_of_type(m, REF_PHANDLE) {
if (get_node_by_ref(bi->dt, m->ref))
if (get_node_by_ref(dti->dt, m->ref))
return true;
}
}
for_each_child(node, c) {
if (any_local_fixup_tree(bi, c))
if (any_local_fixup_tree(dti, c))
return true;
}
return false;
}
static void add_local_fixup_entry(struct boot_info *bi,
static void add_local_fixup_entry(struct dt_info *dti,
struct node *lfn, struct node *node,
struct property *prop, struct marker *m,
struct node *refnode)
@ -930,11 +930,11 @@ static void add_local_fixup_entry(struct boot_info *bi,
append_to_property(wn, prop->name, &value_32, sizeof(value_32));
}
static void generate_local_fixups_tree_internal(struct boot_info *bi,
static void generate_local_fixups_tree_internal(struct dt_info *dti,
struct node *lfn,
struct node *node)
{
struct node *dt = bi->dt;
struct node *dt = dti->dt;
struct node *c;
struct property *prop;
struct marker *m;
@ -945,34 +945,34 @@ static void generate_local_fixups_tree_internal(struct boot_info *bi,
for_each_marker_of_type(m, REF_PHANDLE) {
refnode = get_node_by_ref(dt, m->ref);
if (refnode)
add_local_fixup_entry(bi, lfn, node, prop, m, refnode);
add_local_fixup_entry(dti, lfn, node, prop, m, refnode);
}
}
for_each_child(node, c)
generate_local_fixups_tree_internal(bi, lfn, c);
generate_local_fixups_tree_internal(dti, lfn, c);
}
void generate_label_tree(struct boot_info *bi, char *name, bool allocph)
void generate_label_tree(struct dt_info *dti, char *name, bool allocph)
{
if (!any_label_tree(bi, bi->dt))
if (!any_label_tree(dti, dti->dt))
return;
generate_label_tree_internal(bi, build_root_node(bi->dt, name),
bi->dt, allocph);
generate_label_tree_internal(dti, build_root_node(dti->dt, name),
dti->dt, allocph);
}
void generate_fixups_tree(struct boot_info *bi, char *name)
void generate_fixups_tree(struct dt_info *dti, char *name)
{
if (!any_fixup_tree(bi, bi->dt))
if (!any_fixup_tree(dti, dti->dt))
return;
generate_fixups_tree_internal(bi, build_root_node(bi->dt, name),
bi->dt);
generate_fixups_tree_internal(dti, build_root_node(dti->dt, name),
dti->dt);
}
void generate_local_fixups_tree(struct boot_info *bi, char *name)
void generate_local_fixups_tree(struct dt_info *dti, char *name)
{
if (!any_local_fixup_tree(bi, bi->dt))
if (!any_local_fixup_tree(dti, dti->dt))
return;
generate_local_fixups_tree_internal(bi, build_root_node(bi->dt, name),
bi->dt);
generate_local_fixups_tree_internal(dti, build_root_node(dti->dt, name),
dti->dt);
}