Home | History | Annotate | Download | only in dtc

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