1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2013 Google, Inc
11 #include <linux/libfdt.h>
15 void dm_warn(const char *fmt, ...)
25 int list_count_items(struct list_head *head)
27 struct list_head *node;
30 list_for_each(node, head)
36 #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
37 bool dm_ofnode_pre_reloc(ofnode node)
39 #if defined(CONFIG_SPL_BUILD) || defined(CONFIG_TPL_BUILD)
40 /* for SPL and TPL the remaining nodes after the fdtgrep 1st pass
41 * had property dm-pre-reloc or u-boot,dm-spl/tpl.
42 * They are removed in final dtb (fdtgrep 2nd pass)
46 if (ofnode_read_bool(node, "u-boot,dm-pre-reloc"))
48 if (ofnode_read_bool(node, "u-boot,dm-pre-proper"))
52 * In regular builds individual spl and tpl handling both
53 * count as handled pre-relocation for later second init.
55 if (ofnode_read_bool(node, "u-boot,dm-spl") ||
56 ofnode_read_bool(node, "u-boot,dm-tpl"))
64 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
65 int pci_get_devfn(struct udevice *dev)
67 struct fdt_pci_addr addr;
70 /* Extract the devfn from fdt_pci_addr */
71 ret = ofnode_read_pci_addr(dev_ofnode(dev), FDT_PCI_SPACE_CONFIG,
78 return addr.phys_hi & 0xff00;