Lines Matching defs:dti
31 typedef void (*check_fn)(struct check *c, struct dt_info *dti, struct node *node);
61 check_msg(struct check *c, struct dt_info *dti, struct node *node, struct property *prop, const char *fmt, ...)
82 } else if (streq(dti->outname, "-")) {
85 xasprintf(&str, "%s", dti->outname);
118 #define FAIL(c, dti, node, ...) \
122 check_msg((c), dti, node, NULL, __VA_ARGS__); \
125 #define FAIL_PROP(c, dti, node, prop, ...) \
129 check_msg((c), dti, node, prop, __VA_ARGS__); \
132 static void check_nodes_props(struct check *c, struct dt_info *dti, struct node *node)
138 c->fn(c, dti, node);
141 for_each_child(node, child) check_nodes_props(c, dti, child);
144 static bool run_check(struct check *c, struct dt_info *dti)
146 struct node *dt = dti->dt;
160 error = error || run_check(prq, dti);
163 check_msg(c, dti, NULL, NULL, "Failed prerequisite '%s'", c->prereq[i]->name);
171 check_nodes_props(c, dti, dt);
192 static inline void check_always_fail(struct check *c, struct dt_info *dti, struct node *node)
194 FAIL(c, dti, node, "always_fail check");
198 static void check_is_string(struct check *c, struct dt_info *dti, struct node *node)
209 FAIL_PROP(c, dti, node, prop, "property is not a string");
215 static void check_is_string_list(struct check *c, struct dt_info *dti, struct node *node)
232 FAIL_PROP(c, dti, node, prop, "property is not a string list");
242 static void check_is_cell(struct check *c, struct dt_info *dti, struct node *node)
253 FAIL_PROP(c, dti, node, prop, "property is not a single cell");
263 static void check_duplicate_node_names(struct check *c, struct dt_info *dti, struct node *node)
271 FAIL(c, dti, child2, "Duplicate node name");
277 static void check_duplicate_property_names(struct check *c, struct dt_info *dti, struct node *node)
288 FAIL_PROP(c, dti, node, prop, "Duplicate property name");
301 static void check_node_name_chars(struct check *c, struct dt_info *dti, struct node *node)
305 FAIL(c, dti, node, "Bad character '%c' in node name", node->name[n]);
310 static void check_node_name_chars_strict(struct check *c, struct dt_info *dti, struct node *node)
314 FAIL(c, dti, node, "Character '%c' not recommended in node name", node->name[n]);
319 static void check_node_name_format(struct check *c, struct dt_info *dti, struct node *node)
322 FAIL(c, dti, node, "multiple '@' characters in node name");
327 static void check_unit_address_vs_reg(struct check *c, struct dt_info *dti, struct node *node)
346 FAIL(c, dti, node, "node has a reg or ranges property, but no unit name");
350 FAIL(c, dti, node, "node has a unit name, but no reg or ranges property");
356 static void check_property_name_chars(struct check *c, struct dt_info *dti, struct node *node)
364 FAIL_PROP(c, dti, node, prop, "Bad character '%c' in property name", prop->name[n]);
370 static void check_property_name_chars_strict(struct check *c, struct dt_info *dti, struct node *node)
396 FAIL_PROP(c, dti, node, prop, "Character '%c' not recommended in property name", name[n]);
407 static void check_duplicate_label(struct check *c, struct dt_info *dti, const char *label, struct node *node,
410 struct node *dt = dti->dt;
428 FAIL(c, dti, node, "Duplicate label '%s' on " DESCLABEL_FMT " and " DESCLABEL_FMT, label,
433 static void check_duplicate_label_node(struct check *c, struct dt_info *dti, struct node *node)
438 for_each_label(node->labels, l) check_duplicate_label(c, dti, l->label, node, NULL, NULL);
444 for_each_label(prop->labels, l) check_duplicate_label(c, dti, l->label, node, prop, NULL);
446 for_each_marker_of_type(m, LABEL) check_duplicate_label(c, dti, m->ref, node, prop, m);
451 static cell_t check_phandle_prop(struct check *c, struct dt_info *dti, struct node *node, const char *propname)
453 struct node *root = dti->dt;
464 FAIL_PROP(c, dti, node, prop, "bad length (%d) %s property", prop->val.len, prop->name);
476 FAIL(c, dti, node, "%s is a reference to another node", prop->name);
488 FAIL_PROP(c, dti, node, prop, "bad value (0x%x) in %s property", phandle, prop->name);
495 static void check_explicit_phandles(struct check *c, struct dt_info *dti, struct node *node)
497 struct node *root = dti->dt;
504 phandle = check_phandle_prop(c, dti, node, "phandle");
506 linux_phandle = check_phandle_prop(c, dti, node, "linux,phandle");
513 FAIL(c, dti, node,
524 FAIL(c, dti, node, "duplicated phandle 0x%x (seen before at %s)", phandle, other->fullpath);
532 static void check_name_properties(struct check *c, struct dt_info *dti, struct node *node)
548 FAIL(c, dti, node,
568 static void fixup_phandle_references(struct check *c, struct dt_info *dti, struct node *node)
570 struct node *dt = dti->dt;
585 if (!(dti->dtsflags & DTSF_PLUGIN)) {
586 FAIL(c, dti, node,
605 static void fixup_path_references(struct check *c, struct dt_info *dti, struct node *node)
607 struct node *dt = dti->dt;
622 FAIL(c, dti, node, "Reference to non-existent node or label \"%s\"\n", m->ref);
635 static void fixup_omit_unused_nodes(struct check *c, struct dt_info *dti, struct node *node)
675 static void check_names_is_string_list(struct check *c, struct dt_info *dti, struct node *node)
687 check_is_string_list(c, dti, node);
692 static void check_alias_paths(struct check *c, struct dt_info *dti, struct node *node)
706 if (!prop->val.val || !get_node_by_path(dti->dt, prop->val.val)) {
707 FAIL_PROP(c, dti, node, prop, "aliases property is not a valid node (%s)", prop->val.val);
711 FAIL(c, dti, node, "aliases property name must include only lowercase and '-'");
717 static void fixup_addr_size_cells(struct check *c, struct dt_info *dti, struct node *node)
766 static void check_reg_format(struct check *c, struct dt_info *dti, struct node *node)
777 FAIL(c, dti, node, "Root node has a \"reg\" property");
782 FAIL_PROP(c, dti, node, prop, "property is empty");
790 FAIL_PROP(c, dti, node, prop,
798 static void check_ranges_format(struct check *c, struct dt_info *dti, struct node *node)
810 FAIL_PROP(c, dti, node, prop, "Root node has a \"%s\" property", ranges);
822 FAIL_PROP(c, dti, node, prop,
828 FAIL_PROP(c, dti, node, prop,
834 FAIL_PROP(c, dti, node, prop,
848 static void check_pci_bridge(struct check *c, struct dt_info *dti, struct node *node)
861 FAIL(c, dti, node, "node name is not \"pci\" or \"pcie\"");
866 FAIL(c, dti, node, "missing ranges for PCI bridge (or not a bridge)");
870 FAIL(c, dti, node, "incorrect #address-cells for PCI bridge");
873 FAIL(c, dti, node, "incorrect #size-cells for PCI bridge");
882 FAIL_PROP(c, dti, node, prop, "value must be 2 cells");
887 FAIL_PROP(c, dti, node, prop, "1st cell must be less than or equal to 2nd cell");
890 FAIL_PROP(c, dti, node, prop, "maximum bus number must be less than 256");
895 static void check_pci_device_bus_num(struct check *c, struct dt_info *dti, struct node *node)
922 FAIL_PROP(c, dti, node, prop, "PCI bus number %d out of range, expected (%d - %d)", bus_num, min_bus, max_bus);
927 static void check_pci_device_reg(struct check *c, struct dt_info *dti, struct node *node)
946 FAIL_PROP(c, dti, node, prop, "PCI reg config space address cells 2 and 3 must be 0");
954 FAIL_PROP(c, dti, node, prop, "PCI reg address is not configuration space");
957 FAIL_PROP(c, dti, node, prop, "PCI reg config space address register number must be 0");
972 FAIL(c, dti, node, "PCI unit address format error, expected \"%s\"", unit_addr);
998 static void check_simple_bus_bridge(struct check *c, struct dt_info *dti, struct node *node)
1006 static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct node *node)
1032 FAIL(c, dti, node, "missing or empty reg/ranges property");
1044 FAIL(c, dti, node, "simple-bus unit address format error, expected \"%s\"", unit_addr);
1053 static void check_i2c_bus_bridge(struct check *c, struct dt_info *dti, struct node *node)
1076 FAIL(c, dti, node, "incorrect #address-cells for I2C bus");
1079 FAIL(c, dti, node, "incorrect #size-cells for I2C bus");
1087 static void check_i2c_bus_reg(struct check *c, struct dt_info *dti, struct node *node)
1106 FAIL(c, dti, node, "missing or empty reg property");
1115 FAIL(c, dti, node, "I2C bus unit address format error, expected \"%s\"", unit_addr);
1124 FAIL_PROP(c, dti, node, prop, "I2C address must be less than 10-bits, got \"0x%x\"", reg);
1126 FAIL_PROP(c, dti, node, prop,
1139 static void check_spi_bus_bridge(struct check *c, struct dt_info *dti, struct node *node)
1169 FAIL(c, dti, node, "node name for SPI buses should be 'spi'");
1180 FAIL(c, dti, node, "incorrect #address-cells for SPI bus");
1183 FAIL(c, dti, node, "incorrect #size-cells for SPI bus");
1188 static void check_spi_bus_reg(struct check *c, struct dt_info *dti, struct node *node)
1210 FAIL(c, dti, node, "missing or empty reg property");
1217 FAIL(c, dti, node, "SPI bus unit address format error, expected \"%s\"", unit_addr);
1222 static void check_unit_address_format(struct check *c, struct dt_info *dti, struct node *node)
1235 FAIL(c, dti, node, "unit name should not have leading \"0x\"");
1241 FAIL(c, dti, node, "unit name should not have leading 0s");
1249 static void check_avoid_default_addr_size(struct check *c, struct dt_info *dti, struct node *node)
1264 FAIL(c, dti, node, "Relying on default #address-cells value");
1268 FAIL(c, dti, node, "Relying on default #size-cells value");
1273 static void check_avoid_unnecessary_addr_size(struct check *c, struct dt_info *dti, struct node *node)
1296 FAIL(c, dti, node, "unnecessary #address-cells/#size-cells without \"ranges\" or child \"reg\" property");
1316 static void check_unique_unit_address_common(struct check *c, struct dt_info *dti, struct node *node,
1354 FAIL(c, dti, childb, "duplicate unit-address (also used in node %s)", childa->fullpath);
1360 static void check_unique_unit_address(struct check *c, struct dt_info *dti, struct node *node)
1362 check_unique_unit_address_common(c, dti, node, false);
1366 static void check_unique_unit_address_if_enabled(struct check *c, struct dt_info *dti, struct node *node)
1368 check_unique_unit_address_common(c, dti, node, true);
1373 static void check_obsolete_chosen_interrupt_controller(struct check *c, struct dt_info *dti, struct node *node)
1375 struct node *dt = dti->dt;
1390 FAIL_PROP(c, dti, node, prop, "/chosen has obsolete \"interrupt-controller\" property");
1395 static void check_chosen_node_is_root(struct check *c, struct dt_info *dti, struct node *node)
1401 if (node->parent != dti->dt) {
1402 FAIL(c, dti, node, "chosen node must be at root node");
1407 static void check_chosen_node_bootargs(struct check *c, struct dt_info *dti, struct node *node)
1421 check_is_string(c, dti, node);
1425 static void check_chosen_node_stdout_path(struct check *c, struct dt_info *dti, struct node *node)
1439 FAIL_PROP(c, dti, node, prop, "Use 'stdout-path' instead");
1443 check_is_string(c, dti, node);
1453 static void check_property_phandle_args(struct check *c, struct dt_info *dti, struct node *node, struct property *prop,
1456 struct node *root = dti->dt;
1460 FAIL_PROP(c, dti, node, prop, "property size (%d) is invalid, expected multiple of %zu", prop->val.len,
1477 if (dti->dtsflags & DTSF_PLUGIN) {
1495 FAIL_PROP(c, dti, node, prop, "cell %d is not a phandle reference", cell);
1501 FAIL_PROP(c, dti, node, prop, "Could not get phandle node for (cell %d)", cell);
1511 FAIL(c, dti, node, "Missing property '%s' in node %s or bad phandle (referred from %s[%d])",
1517 FAIL_PROP(c, dti, node, prop, "property size (%d) too small for cell size %d", prop->val.len, cellsize);
1522 static void check_provider_cells_property(struct check *c, struct dt_info *dti, struct node *node)
1532 check_property_phandle_args(c, dti, node, prop, provider);
1580 static void check_gpios_property(struct check *c, struct dt_info *dti, struct node *node)
1600 check_property_phandle_args(c, dti, node, prop, &provider);
1605 static void check_deprecated_gpio_property(struct check *c, struct dt_info *dti, struct node *node)
1622 FAIL_PROP(c, dti, node, prop, "'[*-]gpio' is deprecated, use '[*-]gpios' instead");
1644 static void check_interrupt_provider(struct check *c, struct dt_info *dti, struct node *node)
1654 FAIL(c, dti, node, "Missing #interrupt-cells in interrupt provider");
1659 FAIL(c, dti, node, "Missing #address-cells in interrupt provider");
1664 static void check_interrupts_property(struct check *c, struct dt_info *dti, struct node *node)
1666 struct node *root = dti->dt;
1677 FAIL_PROP(c, dti, node, irq_prop, "size (%d) is invalid, expected multiple of %zu", irq_prop->val.len,
1693 if (dti->dtsflags & DTSF_PLUGIN) {
1696 FAIL_PROP(c, dti, parent, prop, "Invalid phandle");
1702 FAIL_PROP(c, dti, parent, prop, "Bad phandle");
1706 FAIL(c, dti, irq_node, "Missing interrupt-controller or interrupt-map property");
1716 FAIL(c, dti, node, "Missing interrupt-parent");
1728 FAIL_PROP(c, dti, node, prop, "size is (%d), expected multiple of %d", irq_prop->val.len,
1742 static void check_graph_nodes(struct check *c, struct dt_info *dti, struct node *node)
1764 static void check_graph_child_address(struct check *c, struct dt_info *dti, struct node *node)
1786 FAIL(c, dti, node, "graph node has single child node '%s', #address-cells/#size-cells are not necessary",
1792 static void check_graph_reg(struct check *c, struct dt_info *dti, struct node *node)
1804 FAIL(c, dti, node, "graph node malformed 'reg' property");
1810 FAIL(c, dti, node, "graph node unit address error, expected \"%s\"", unit_addr);
1814 FAIL_PROP(c, dti, node, get_property(node, "#address-cells"), "graph node '#address-cells' is %d, must be 1",
1818 FAIL_PROP(c, dti, node, get_property(node, "#size-cells"), "graph node '#size-cells' is %d, must be 0",
1823 static void check_graph_port(struct check *c, struct dt_info *dti, struct node *node)
1830 FAIL(c, dti, node, "graph port node name should be 'port'");
1833 check_graph_reg(c, dti, node);
1837 static struct node *get_remote_endpoint(struct check *c, struct dt_info *dti, struct node *endpoint)
1854 node = get_node_by_phandle(dti->dt, phandle);
1856 FAIL_PROP(c, dti, endpoint, prop, "graph phandle is not valid");
1862 static void check_graph_endpoint(struct check *c, struct dt_info *dti, struct node *node)
1871 FAIL(c, dti, node, "graph endpoint node name should be 'endpoint'");
1874 check_graph_reg(c, dti, node);
1876 remote_node = get_remote_endpoint(c, dti, node);
1881 if (get_remote_endpoint(c, dti, remote_node) != node) {
1882 FAIL(c, dti, node, "graph connection to node '%s' is not bidirectional", remote_node->fullpath);
2045 void process_checks(bool force, struct dt_info *dti)
2054 error = error || run_check(c, dti);