Lines Matching full:node
43 typedef void (*check_fn)(struct check *c, struct dt_info *dti, struct node *node);
99 static void check_nodes_props(struct check *c, struct dt_info *dti, struct node *node) in check_nodes_props() argument
101 struct node *child; in check_nodes_props()
103 TRACE(c, "%s", node->fullpath); in check_nodes_props()
105 c->fn(c, dti, node); in check_nodes_props()
107 for_each_child(node, child) in check_nodes_props()
113 struct node *dt = dti->dt; in run_check()
157 struct node *node) in check_always_fail() argument
164 struct node *node) in check_is_string() argument
169 prop = get_property(node, propname); in check_is_string()
175 propname, node->fullpath); in check_is_string()
183 struct node *node) in check_is_cell() argument
188 prop = get_property(node, propname); in check_is_cell()
194 propname, node->fullpath); in check_is_cell()
206 struct node *node) in check_duplicate_node_names() argument
208 struct node *child, *child2; in check_duplicate_node_names()
210 for_each_child(node, child) in check_duplicate_node_names()
215 FAIL(c, dti, "Duplicate node name %s", in check_duplicate_node_names()
221 struct node *node) in check_duplicate_property_names() argument
225 for_each_property(node, prop) { in check_duplicate_property_names()
231 prop->name, node->fullpath); in check_duplicate_property_names()
244 struct node *node) in check_node_name_chars() argument
246 int n = strspn(node->name, c->data); in check_node_name_chars()
248 if (n < strlen(node->name)) in check_node_name_chars()
249 FAIL(c, dti, "Bad character '%c' in node %s", in check_node_name_chars()
250 node->name[n], node->fullpath); in check_node_name_chars()
255 struct node *node) in check_node_name_chars_strict() argument
257 int n = strspn(node->name, c->data); in check_node_name_chars_strict()
259 if (n < node->basenamelen) in check_node_name_chars_strict()
260 FAIL(c, dti, "Character '%c' not recommended in node %s", in check_node_name_chars_strict()
261 node->name[n], node->fullpath); in check_node_name_chars_strict()
266 struct node *node) in check_node_name_format() argument
268 if (strchr(get_unitname(node), '@')) in check_node_name_format()
269 FAIL(c, dti, "Node %s has multiple '@' characters in name", in check_node_name_format()
270 node->fullpath); in check_node_name_format()
275 struct node *node) in check_unit_address_vs_reg() argument
277 const char *unitname = get_unitname(node); in check_unit_address_vs_reg()
278 struct property *prop = get_property(node, "reg"); in check_unit_address_vs_reg()
281 prop = get_property(node, "ranges"); in check_unit_address_vs_reg()
288 FAIL(c, dti, "Node %s has a reg or ranges property, but no unit name", in check_unit_address_vs_reg()
289 node->fullpath); in check_unit_address_vs_reg()
292 FAIL(c, dti, "Node %s has a unit name, but no reg property", in check_unit_address_vs_reg()
293 node->fullpath); in check_unit_address_vs_reg()
299 struct node *node) in check_property_name_chars() argument
303 for_each_property(node, prop) { in check_property_name_chars()
307 FAIL(c, dti, "Bad character '%c' in property name \"%s\", node %s", in check_property_name_chars()
308 prop->name[n], prop->name, node->fullpath); in check_property_name_chars()
315 struct node *node) in check_property_name_chars_strict() argument
319 for_each_property(node, prop) { in check_property_name_chars_strict()
339 FAIL(c, dti, "Character '%c' not recommended in property name \"%s\", node %s", in check_property_name_chars_strict()
340 name[n], prop->name, node->fullpath); in check_property_name_chars_strict()
346 #define DESCLABEL_ARGS(node,prop,mark) \ argument
350 ((prop) ? "' in " : ""), (node)->fullpath
353 const char *label, struct node *node, in check_duplicate_label() argument
356 struct node *dt = dti->dt; in check_duplicate_label()
357 struct node *othernode = NULL; in check_duplicate_label()
372 if ((othernode != node) || (otherprop != prop) || (othermark != mark)) in check_duplicate_label()
375 label, DESCLABEL_ARGS(node, prop, mark), in check_duplicate_label()
380 struct node *node) in check_duplicate_label_node() argument
385 for_each_label(node->labels, l) in check_duplicate_label_node()
386 check_duplicate_label(c, dti, l->label, node, NULL, NULL); in check_duplicate_label_node()
388 for_each_property(node, prop) { in check_duplicate_label_node()
392 check_duplicate_label(c, dti, l->label, node, prop, NULL); in check_duplicate_label_node()
395 check_duplicate_label(c, dti, m->ref, node, prop, m); in check_duplicate_label_node()
401 struct node *node, const char *propname) in check_phandle_prop() argument
403 struct node *root = dti->dt; in check_phandle_prop()
408 prop = get_property(node, propname); in check_phandle_prop()
414 node->fullpath, prop->val.len, prop->name); in check_phandle_prop()
421 if (node != get_node_by_ref(root, m->ref)) in check_phandle_prop()
422 /* "Set this node's phandle equal to some in check_phandle_prop()
423 * other node's phandle". That's nonsensical in check_phandle_prop()
425 FAIL(c, dti, "%s in %s is a reference to another node", in check_phandle_prop()
426 prop->name, node->fullpath); in check_phandle_prop()
428 /* But setting this node's phandle equal to its own in check_phandle_prop()
430 * phandle for this node, even if it's not otherwise in check_phandle_prop()
440 node->fullpath, phandle, prop->name); in check_phandle_prop()
448 struct node *node) in check_explicit_phandles() argument
450 struct node *root = dti->dt; in check_explicit_phandles()
451 struct node *other; in check_explicit_phandles()
455 assert(!node->phandle); in check_explicit_phandles()
457 phandle = check_phandle_prop(c, dti, node, "phandle"); in check_explicit_phandles()
459 linux_phandle = check_phandle_prop(c, dti, node, "linux,phandle"); in check_explicit_phandles()
467 " properties", node->fullpath); in check_explicit_phandles()
473 if (other && (other != node)) { in check_explicit_phandles()
475 node->fullpath, phandle, other->fullpath); in check_explicit_phandles()
479 node->phandle = phandle; in check_explicit_phandles()
484 struct node *node) in check_name_properties() argument
488 for (pp = &node->proplist; *pp; pp = &((*pp)->next)) in check_name_properties()
497 if ((prop->val.len != node->basenamelen+1) in check_name_properties()
498 || (memcmp(prop->val.val, node->name, node->basenamelen) != 0)) { in check_name_properties()
500 " of base node name)", node->fullpath, prop->val.val); in check_name_properties()
518 struct node *node) in fixup_phandle_references() argument
520 struct node *dt = dti->dt; in fixup_phandle_references()
523 for_each_property(node, prop) { in fixup_phandle_references()
525 struct node *refnode; in fixup_phandle_references()
534 FAIL(c, dti, "Reference to non-existent node or " in fixup_phandle_references()
551 struct node *node) in fixup_path_references() argument
553 struct node *dt = dti->dt; in fixup_path_references()
556 for_each_property(node, prop) { in fixup_path_references()
558 struct node *refnode; in fixup_path_references()
566 FAIL(c, dti, "Reference to non-existent node or label \"%s\"\n", in fixup_path_references()
591 struct node *node) in fixup_addr_size_cells() argument
595 node->addr_cells = -1; in fixup_addr_size_cells()
596 node->size_cells = -1; in fixup_addr_size_cells()
598 prop = get_property(node, "#address-cells"); in fixup_addr_size_cells()
600 node->addr_cells = propval_cell(prop); in fixup_addr_size_cells()
602 prop = get_property(node, "#size-cells"); in fixup_addr_size_cells()
604 node->size_cells = propval_cell(prop); in fixup_addr_size_cells()
615 struct node *node) in check_reg_format() argument
620 prop = get_property(node, "reg"); in check_reg_format()
624 if (!node->parent) { in check_reg_format()
625 FAIL(c, dti, "Root node has a \"reg\" property"); in check_reg_format()
630 FAIL(c, dti, "\"reg\" property in %s is empty", node->fullpath); in check_reg_format()
632 addr_cells = node_addr_cells(node->parent); in check_reg_format()
633 size_cells = node_size_cells(node->parent); in check_reg_format()
639 node->fullpath, prop->val.len, addr_cells, size_cells); in check_reg_format()
644 struct node *node) in check_ranges_format() argument
649 prop = get_property(node, "ranges"); in check_ranges_format()
653 if (!node->parent) { in check_ranges_format()
654 FAIL(c, dti, "Root node has a \"ranges\" property"); in check_ranges_format()
658 p_addr_cells = node_addr_cells(node->parent); in check_ranges_format()
659 p_size_cells = node_size_cells(node->parent); in check_ranges_format()
660 c_addr_cells = node_addr_cells(node); in check_ranges_format()
661 c_size_cells = node_size_cells(node); in check_ranges_format()
668 node->fullpath, c_addr_cells, node->parent->fullpath, in check_ranges_format()
673 node->fullpath, c_size_cells, node->parent->fullpath, in check_ranges_format()
678 "#size-cells == %d)", node->fullpath, prop->val.len, in check_ranges_format()
688 static void check_pci_bridge(struct check *c, struct dt_info *dti, struct node *node) in check_pci_bridge() argument
693 prop = get_property(node, "device_type"); in check_pci_bridge()
697 node->bus = &pci_bus; in check_pci_bridge()
699 if (!strneq(node->name, "pci", node->basenamelen) && in check_pci_bridge()
700 !strneq(node->name, "pcie", node->basenamelen)) in check_pci_bridge()
701 FAIL(c, dti, "Node %s node name is not \"pci\" or \"pcie\"", in check_pci_bridge()
702 node->fullpath); in check_pci_bridge()
704 prop = get_property(node, "ranges"); in check_pci_bridge()
706 FAIL(c, dti, "Node %s missing ranges for PCI bridge (or not a bridge)", in check_pci_bridge()
707 node->fullpath); in check_pci_bridge()
709 if (node_addr_cells(node) != 3) in check_pci_bridge()
710 FAIL(c, dti, "Node %s incorrect #address-cells for PCI bridge", in check_pci_bridge()
711 node->fullpath); in check_pci_bridge()
712 if (node_size_cells(node) != 2) in check_pci_bridge()
713 FAIL(c, dti, "Node %s incorrect #size-cells for PCI bridge", in check_pci_bridge()
714 node->fullpath); in check_pci_bridge()
716 prop = get_property(node, "bus-range"); in check_pci_bridge()
718 FAIL(c, dti, "Node %s missing bus-range for PCI bridge", in check_pci_bridge()
719 node->fullpath); in check_pci_bridge()
723 FAIL(c, dti, "Node %s bus-range must be 2 cells", in check_pci_bridge()
724 node->fullpath); in check_pci_bridge()
729 FAIL(c, dti, "Node %s bus-range 1st cell must be less than or equal to 2nd cell", in check_pci_bridge()
730 node->fullpath); in check_pci_bridge()
732 FAIL(c, dti, "Node %s bus-range maximum bus number must be less than 256", in check_pci_bridge()
733 node->fullpath); in check_pci_bridge()
738 static void check_pci_device_bus_num(struct check *c, struct dt_info *dti, struct node *node) in check_pci_device_bus_num() argument
744 if (!node->parent || (node->parent->bus != &pci_bus)) in check_pci_device_bus_num()
747 prop = get_property(node, "reg"); in check_pci_device_bus_num()
754 prop = get_property(node->parent, "bus-range"); in check_pci_device_bus_num()
763 FAIL(c, dti, "Node %s PCI bus number %d out of range, expected (%d - %d)", in check_pci_device_bus_num()
764 node->fullpath, bus_num, min_bus, max_bus); in check_pci_device_bus_num()
768 static void check_pci_device_reg(struct check *c, struct dt_info *dti, struct node *node) in check_pci_device_reg() argument
771 const char *unitname = get_unitname(node); in check_pci_device_reg()
776 if (!node->parent || (node->parent->bus != &pci_bus)) in check_pci_device_reg()
779 prop = get_property(node, "reg"); in check_pci_device_reg()
781 FAIL(c, dti, "Node %s missing PCI reg property", node->fullpath); in check_pci_device_reg()
787 FAIL(c, dti, "Node %s PCI reg config space address cells 2 and 3 must be 0", in check_pci_device_reg()
788 node->fullpath); in check_pci_device_reg()
795 FAIL(c, dti, "Node %s PCI reg address is not configuration space", in check_pci_device_reg()
796 node->fullpath); in check_pci_device_reg()
798 FAIL(c, dti, "Node %s PCI reg config space address register number must be 0", in check_pci_device_reg()
799 node->fullpath); in check_pci_device_reg()
811 FAIL(c, dti, "Node %s PCI unit address format error, expected \"%s\"", in check_pci_device_reg()
812 node->fullpath, unit_addr); in check_pci_device_reg()
820 static bool node_is_compatible(struct node *node, const char *compat) in node_is_compatible() argument
825 prop = get_property(node, "compatible"); in node_is_compatible()
837 static void check_simple_bus_bridge(struct check *c, struct dt_info *dti, struct node *node) in check_simple_bus_bridge() argument
839 if (node_is_compatible(node, "simple-bus")) in check_simple_bus_bridge()
840 node->bus = &simple_bus; in check_simple_bus_bridge()
844 static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct node *node) in check_simple_bus_reg() argument
847 const char *unitname = get_unitname(node); in check_simple_bus_reg()
853 if (!node->parent || (node->parent->bus != &simple_bus)) in check_simple_bus_reg()
856 prop = get_property(node, "reg"); in check_simple_bus_reg()
860 prop = get_property(node, "ranges"); in check_simple_bus_reg()
863 cells = ((cell_t *)prop->val.val) + node_addr_cells(node); in check_simple_bus_reg()
867 if (node->parent->parent && !(node->bus == &simple_bus)) in check_simple_bus_reg()
868 FAIL(c, dti, "Node %s missing or empty reg/ranges property", node->fullpath); in check_simple_bus_reg()
872 size = node_addr_cells(node->parent); in check_simple_bus_reg()
878 FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"", in check_simple_bus_reg()
879 node->fullpath, unit_addr); in check_simple_bus_reg()
884 struct node *node) in check_unit_address_format() argument
886 const char *unitname = get_unitname(node); in check_unit_address_format()
888 if (node->parent && node->parent->bus) in check_unit_address_format()
895 FAIL(c, dti, "Node %s unit name should not have leading \"0x\"", in check_unit_address_format()
896 node->fullpath); in check_unit_address_format()
901 FAIL(c, dti, "Node %s unit name should not have leading 0s", in check_unit_address_format()
902 node->fullpath); in check_unit_address_format()
911 struct node *node) in check_avoid_default_addr_size() argument
915 if (!node->parent) in check_avoid_default_addr_size()
916 return; /* Ignore root node */ in check_avoid_default_addr_size()
918 reg = get_property(node, "reg"); in check_avoid_default_addr_size()
919 ranges = get_property(node, "ranges"); in check_avoid_default_addr_size()
924 if (node->parent->addr_cells == -1) in check_avoid_default_addr_size()
926 node->fullpath); in check_avoid_default_addr_size()
928 if (node->parent->size_cells == -1) in check_avoid_default_addr_size()
930 node->fullpath); in check_avoid_default_addr_size()
937 struct node *node) in check_obsolete_chosen_interrupt_controller() argument
939 struct node *dt = dti->dt; in check_obsolete_chosen_interrupt_controller()
940 struct node *chosen; in check_obsolete_chosen_interrupt_controller()
943 if (node != dt) in check_obsolete_chosen_interrupt_controller()
967 struct node *node, in check_property_phandle_args() argument
971 struct node *root = dti->dt; in check_property_phandle_args()
975 FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %zu in node %s", in check_property_phandle_args()
976 prop->name, prop->val.len, sizeof(cell_t), node->fullpath); in check_property_phandle_args()
981 struct node *provider_node; in check_property_phandle_args()
1004 prop->name, cell, node->fullpath); in check_property_phandle_args()
1009 FAIL(c, dti, "Could not get phandle node for %s:%s(cell %d)", in check_property_phandle_args()
1010 node->fullpath, prop->name, cell); in check_property_phandle_args()
1020 FAIL(c, dti, "Missing property '%s' in node %s or bad phandle (referred from %s:%s[%d])", in check_property_phandle_args()
1023 node->fullpath, prop->name, cell); in check_property_phandle_args()
1029 prop->name, prop->val.len, cellsize, node->fullpath); in check_property_phandle_args()
1036 struct node *node) in check_provider_cells_property() argument
1041 prop = get_property(node, provider->prop_name); in check_provider_cells_property()
1045 check_property_phandle_args(c, dti, node, prop, provider); in check_provider_cells_property()
1092 struct node *node) in check_gpios_property() argument
1097 if (get_property(node, "gpio-hog")) in check_gpios_property()
1100 for_each_property(node, prop) { in check_gpios_property()
1109 check_property_phandle_args(c, dti, node, prop, &provider); in check_gpios_property()
1117 struct node *node) in check_deprecated_gpio_property() argument
1121 for_each_property(node, prop) { in check_deprecated_gpio_property()
1132 node->fullpath, prop->name); in check_deprecated_gpio_property()
1138 static bool node_is_interrupt_provider(struct node *node) in node_is_interrupt_provider() argument
1142 prop = get_property(node, "interrupt-controller"); in node_is_interrupt_provider()
1146 prop = get_property(node, "interrupt-map"); in node_is_interrupt_provider()
1154 struct node *node) in check_interrupts_property() argument
1156 struct node *root = dti->dt; in check_interrupts_property()
1157 struct node *irq_node = NULL, *parent = node; in check_interrupts_property()
1161 irq_prop = get_property(node, "interrupts"); in check_interrupts_property()
1166 FAIL(c, dti, "property '%s' size (%d) is invalid, expected multiple of %zu in node %s", in check_interrupts_property()
1168 node->fullpath); in check_interrupts_property()
1171 if (parent != node && node_is_interrupt_provider(parent)) { in check_interrupts_property()
1182 node->fullpath); in check_interrupts_property()
1197 FAIL(c, dti, "Missing interrupt-parent for %s", node->fullpath); in check_interrupts_property()
1213 node->fullpath); in check_interrupts_property()