mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
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:
parent
1ef86ad2c2
commit
00fbb8696b
8 changed files with 147 additions and 148 deletions
86
checks.c
86
checks.c
|
@ -40,7 +40,7 @@ enum checkstatus {
|
|||
|
||||
struct check;
|
||||
|
||||
typedef void (*check_fn)(struct check *c, struct boot_info *bi, struct node *node);
|
||||
typedef void (*check_fn)(struct check *c, struct dt_info *dti, struct node *node);
|
||||
|
||||
struct check {
|
||||
const char *name;
|
||||
|
@ -97,21 +97,21 @@ static inline void check_msg(struct check *c, const char *fmt, ...)
|
|||
check_msg((c), __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
static void check_nodes_props(struct check *c, struct boot_info *bi, struct node *node)
|
||||
static void check_nodes_props(struct check *c, struct dt_info *dti, struct node *node)
|
||||
{
|
||||
struct node *child;
|
||||
|
||||
TRACE(c, "%s", node->fullpath);
|
||||
if (c->fn)
|
||||
c->fn(c, bi, node);
|
||||
c->fn(c, dti, node);
|
||||
|
||||
for_each_child(node, child)
|
||||
check_nodes_props(c, bi, child);
|
||||
check_nodes_props(c, dti, child);
|
||||
}
|
||||
|
||||
static bool run_check(struct check *c, struct boot_info *bi)
|
||||
static bool run_check(struct check *c, struct dt_info *dti)
|
||||
{
|
||||
struct node *dt = bi->dt;
|
||||
struct node *dt = dti->dt;
|
||||
bool error = false;
|
||||
int i;
|
||||
|
||||
|
@ -124,7 +124,7 @@ static bool run_check(struct check *c, struct boot_info *bi)
|
|||
|
||||
for (i = 0; i < c->num_prereqs; i++) {
|
||||
struct check *prq = c->prereq[i];
|
||||
error = error || run_check(prq, bi);
|
||||
error = error || run_check(prq, dti);
|
||||
if (prq->status != PASSED) {
|
||||
c->status = PREREQ;
|
||||
check_msg(c, "Failed prerequisite '%s'",
|
||||
|
@ -135,7 +135,7 @@ static bool run_check(struct check *c, struct boot_info *bi)
|
|||
if (c->status != UNCHECKED)
|
||||
goto out;
|
||||
|
||||
check_nodes_props(c, bi, dt);
|
||||
check_nodes_props(c, dti, dt);
|
||||
|
||||
if (c->status == UNCHECKED)
|
||||
c->status = PASSED;
|
||||
|
@ -154,14 +154,14 @@ out:
|
|||
*/
|
||||
|
||||
/* A check which always fails, for testing purposes only */
|
||||
static inline void check_always_fail(struct check *c, struct boot_info *bi,
|
||||
static inline void check_always_fail(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
FAIL(c, "always_fail check");
|
||||
}
|
||||
CHECK(always_fail, check_always_fail, NULL);
|
||||
|
||||
static void check_is_string(struct check *c, struct boot_info *bi,
|
||||
static void check_is_string(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
struct property *prop;
|
||||
|
@ -180,7 +180,7 @@ static void check_is_string(struct check *c, struct boot_info *bi,
|
|||
#define ERROR_IF_NOT_STRING(nm, propname) \
|
||||
ERROR(nm, check_is_string, (propname))
|
||||
|
||||
static void check_is_cell(struct check *c, struct boot_info *bi,
|
||||
static void check_is_cell(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
struct property *prop;
|
||||
|
@ -203,7 +203,7 @@ static void check_is_cell(struct check *c, struct boot_info *bi,
|
|||
* Structural check functions
|
||||
*/
|
||||
|
||||
static void check_duplicate_node_names(struct check *c, struct boot_info *bi,
|
||||
static void check_duplicate_node_names(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
struct node *child, *child2;
|
||||
|
@ -218,7 +218,7 @@ static void check_duplicate_node_names(struct check *c, struct boot_info *bi,
|
|||
}
|
||||
ERROR(duplicate_node_names, check_duplicate_node_names, NULL);
|
||||
|
||||
static void check_duplicate_property_names(struct check *c, struct boot_info *bi,
|
||||
static void check_duplicate_property_names(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
struct property *prop, *prop2;
|
||||
|
@ -240,7 +240,7 @@ ERROR(duplicate_property_names, check_duplicate_property_names, NULL);
|
|||
#define DIGITS "0123456789"
|
||||
#define PROPNODECHARS LOWERCASE UPPERCASE DIGITS ",._+*#?-"
|
||||
|
||||
static void check_node_name_chars(struct check *c, struct boot_info *bi,
|
||||
static void check_node_name_chars(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
int n = strspn(node->name, c->data);
|
||||
|
@ -251,7 +251,7 @@ static void check_node_name_chars(struct check *c, struct boot_info *bi,
|
|||
}
|
||||
ERROR(node_name_chars, check_node_name_chars, PROPNODECHARS "@");
|
||||
|
||||
static void check_node_name_format(struct check *c, struct boot_info *bi,
|
||||
static void check_node_name_format(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
if (strchr(get_unitname(node), '@'))
|
||||
|
@ -260,7 +260,7 @@ static void check_node_name_format(struct check *c, struct boot_info *bi,
|
|||
}
|
||||
ERROR(node_name_format, check_node_name_format, NULL, &node_name_chars);
|
||||
|
||||
static void check_unit_address_vs_reg(struct check *c, struct boot_info *bi,
|
||||
static void check_unit_address_vs_reg(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
const char *unitname = get_unitname(node);
|
||||
|
@ -284,7 +284,7 @@ static void check_unit_address_vs_reg(struct check *c, struct boot_info *bi,
|
|||
}
|
||||
WARNING(unit_address_vs_reg, check_unit_address_vs_reg, NULL);
|
||||
|
||||
static void check_property_name_chars(struct check *c, struct boot_info *bi,
|
||||
static void check_property_name_chars(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
struct property *prop;
|
||||
|
@ -306,11 +306,11 @@ ERROR(property_name_chars, check_property_name_chars, PROPNODECHARS);
|
|||
((prop) ? (prop)->name : ""), \
|
||||
((prop) ? "' in " : ""), (node)->fullpath
|
||||
|
||||
static void check_duplicate_label(struct check *c, struct boot_info *bi,
|
||||
static void check_duplicate_label(struct check *c, struct dt_info *dti,
|
||||
const char *label, struct node *node,
|
||||
struct property *prop, struct marker *mark)
|
||||
{
|
||||
struct node *dt = bi->dt;
|
||||
struct node *dt = dti->dt;
|
||||
struct node *othernode = NULL;
|
||||
struct property *otherprop = NULL;
|
||||
struct marker *othermark = NULL;
|
||||
|
@ -333,31 +333,31 @@ static void check_duplicate_label(struct check *c, struct boot_info *bi,
|
|||
DESCLABEL_ARGS(othernode, otherprop, othermark));
|
||||
}
|
||||
|
||||
static void check_duplicate_label_node(struct check *c, struct boot_info *bi,
|
||||
static void check_duplicate_label_node(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
struct label *l;
|
||||
struct property *prop;
|
||||
|
||||
for_each_label(node->labels, l)
|
||||
check_duplicate_label(c, bi, l->label, node, NULL, NULL);
|
||||
check_duplicate_label(c, dti, l->label, node, NULL, NULL);
|
||||
|
||||
for_each_property(node, prop) {
|
||||
struct marker *m = prop->val.markers;
|
||||
|
||||
for_each_label(prop->labels, l)
|
||||
check_duplicate_label(c, bi, l->label, node, prop, NULL);
|
||||
check_duplicate_label(c, dti, l->label, node, prop, NULL);
|
||||
|
||||
for_each_marker_of_type(m, LABEL)
|
||||
check_duplicate_label(c, bi, m->ref, node, prop, m);
|
||||
check_duplicate_label(c, dti, m->ref, node, prop, m);
|
||||
}
|
||||
}
|
||||
ERROR(duplicate_label, check_duplicate_label_node, NULL);
|
||||
|
||||
static cell_t check_phandle_prop(struct check *c, struct boot_info *bi,
|
||||
static cell_t check_phandle_prop(struct check *c, struct dt_info *dti,
|
||||
struct node *node, const char *propname)
|
||||
{
|
||||
struct node *root = bi->dt;
|
||||
struct node *root = dti->dt;
|
||||
struct property *prop;
|
||||
struct marker *m;
|
||||
cell_t phandle;
|
||||
|
@ -401,19 +401,19 @@ static cell_t check_phandle_prop(struct check *c, struct boot_info *bi,
|
|||
return phandle;
|
||||
}
|
||||
|
||||
static void check_explicit_phandles(struct check *c, struct boot_info *bi,
|
||||
static void check_explicit_phandles(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
struct node *root = bi->dt;
|
||||
struct node *root = dti->dt;
|
||||
struct node *other;
|
||||
cell_t phandle, linux_phandle;
|
||||
|
||||
/* Nothing should have assigned phandles yet */
|
||||
assert(!node->phandle);
|
||||
|
||||
phandle = check_phandle_prop(c, bi, node, "phandle");
|
||||
phandle = check_phandle_prop(c, dti, node, "phandle");
|
||||
|
||||
linux_phandle = check_phandle_prop(c, bi, node, "linux,phandle");
|
||||
linux_phandle = check_phandle_prop(c, dti, node, "linux,phandle");
|
||||
|
||||
if (!phandle && !linux_phandle)
|
||||
/* No valid phandles; nothing further to check */
|
||||
|
@ -437,7 +437,7 @@ static void check_explicit_phandles(struct check *c, struct boot_info *bi,
|
|||
}
|
||||
ERROR(explicit_phandles, check_explicit_phandles, NULL);
|
||||
|
||||
static void check_name_properties(struct check *c, struct boot_info *bi,
|
||||
static void check_name_properties(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
struct property **pp, *prop = NULL;
|
||||
|
@ -471,10 +471,10 @@ ERROR(name_properties, check_name_properties, NULL, &name_is_string);
|
|||
* Reference fixup functions
|
||||
*/
|
||||
|
||||
static void fixup_phandle_references(struct check *c, struct boot_info *bi,
|
||||
static void fixup_phandle_references(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
struct node *dt = bi->dt;
|
||||
struct node *dt = dti->dt;
|
||||
struct property *prop;
|
||||
|
||||
for_each_property(node, prop) {
|
||||
|
@ -487,7 +487,7 @@ static void fixup_phandle_references(struct check *c, struct boot_info *bi,
|
|||
|
||||
refnode = get_node_by_ref(dt, m->ref);
|
||||
if (! refnode) {
|
||||
if (!(bi->dtsflags & DTSF_PLUGIN))
|
||||
if (!(dti->dtsflags & DTSF_PLUGIN))
|
||||
FAIL(c, "Reference to non-existent node or "
|
||||
"label \"%s\"\n", m->ref);
|
||||
else /* mark the entry as unresolved */
|
||||
|
@ -504,10 +504,10 @@ static void fixup_phandle_references(struct check *c, struct boot_info *bi,
|
|||
ERROR(phandle_references, fixup_phandle_references, NULL,
|
||||
&duplicate_node_names, &explicit_phandles);
|
||||
|
||||
static void fixup_path_references(struct check *c, struct boot_info *bi,
|
||||
static void fixup_path_references(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
struct node *dt = bi->dt;
|
||||
struct node *dt = dti->dt;
|
||||
struct property *prop;
|
||||
|
||||
for_each_property(node, prop) {
|
||||
|
@ -544,7 +544,7 @@ WARNING_IF_NOT_STRING(device_type_is_string, "device_type");
|
|||
WARNING_IF_NOT_STRING(model_is_string, "model");
|
||||
WARNING_IF_NOT_STRING(status_is_string, "status");
|
||||
|
||||
static void fixup_addr_size_cells(struct check *c, struct boot_info *bi,
|
||||
static void fixup_addr_size_cells(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
struct property *prop;
|
||||
|
@ -568,7 +568,7 @@ WARNING(addr_size_cells, fixup_addr_size_cells, NULL,
|
|||
#define node_size_cells(n) \
|
||||
(((n)->size_cells == -1) ? 1 : (n)->size_cells)
|
||||
|
||||
static void check_reg_format(struct check *c, struct boot_info *bi,
|
||||
static void check_reg_format(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
struct property *prop;
|
||||
|
@ -597,7 +597,7 @@ static void check_reg_format(struct check *c, struct boot_info *bi,
|
|||
}
|
||||
WARNING(reg_format, check_reg_format, NULL, &addr_size_cells);
|
||||
|
||||
static void check_ranges_format(struct check *c, struct boot_info *bi,
|
||||
static void check_ranges_format(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
struct property *prop;
|
||||
|
@ -641,7 +641,7 @@ WARNING(ranges_format, check_ranges_format, NULL, &addr_size_cells);
|
|||
/*
|
||||
* Style checks
|
||||
*/
|
||||
static void check_avoid_default_addr_size(struct check *c, struct boot_info *bi,
|
||||
static void check_avoid_default_addr_size(struct check *c, struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
struct property *reg, *ranges;
|
||||
|
@ -667,10 +667,10 @@ WARNING(avoid_default_addr_size, check_avoid_default_addr_size, NULL,
|
|||
&addr_size_cells);
|
||||
|
||||
static void check_obsolete_chosen_interrupt_controller(struct check *c,
|
||||
struct boot_info *bi,
|
||||
struct dt_info *dti,
|
||||
struct node *node)
|
||||
{
|
||||
struct node *dt = bi->dt;
|
||||
struct node *dt = dti->dt;
|
||||
struct node *chosen;
|
||||
struct property *prop;
|
||||
|
||||
|
@ -774,7 +774,7 @@ void parse_checks_option(bool warn, bool error, const char *arg)
|
|||
die("Unrecognized check name \"%s\"\n", name);
|
||||
}
|
||||
|
||||
void process_checks(bool force, struct boot_info *bi)
|
||||
void process_checks(bool force, struct dt_info *dti)
|
||||
{
|
||||
int i;
|
||||
int error = 0;
|
||||
|
@ -783,7 +783,7 @@ void process_checks(bool force, struct boot_info *bi)
|
|||
struct check *c = check_table[i];
|
||||
|
||||
if (c->warn || c->error)
|
||||
error = error || run_check(c, bi);
|
||||
error = error || run_check(c, dti);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue