blob: bd4de7acd69873fc1ebcc1adb069d12282555194 [file] [log] [blame]
Simon Glassdd6ab882014-02-26 15:59:18 -07001/*
2 * Copyright (c) 2013 Google, Inc
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
Heiko Stübner9a2cdca2017-02-18 19:46:21 +01008#include <libfdt.h>
Simon Glassdd6ab882014-02-26 15:59:18 -07009#include <vsprintf.h>
10
11void dm_warn(const char *fmt, ...)
12{
13 va_list args;
14
15 va_start(args, fmt);
16 vprintf(fmt, args);
17 va_end(args);
18}
19
20void dm_dbg(const char *fmt, ...)
21{
22 va_list args;
23
24 va_start(args, fmt);
25 vprintf(fmt, args);
26 va_end(args);
27}
28
29int list_count_items(struct list_head *head)
30{
31 struct list_head *node;
32 int count = 0;
33
34 list_for_each(node, head)
35 count++;
36
37 return count;
38}
Heiko Stübner9a2cdca2017-02-18 19:46:21 +010039
40int dm_fdt_pre_reloc(const void *blob, int offset)
41{
42 if (fdt_getprop(blob, offset, "u-boot,dm-pre-reloc", NULL))
43 return 1;
44
45#ifdef CONFIG_TPL_BUILD
46 if (fdt_getprop(blob, offset, "u-boot,dm-tpl", NULL))
47 return 1;
48#elif defined(CONFIG_SPL_BUILD)
49 if (fdt_getprop(blob, offset, "u-boot,dm-spl", NULL))
50 return 1;
51#else
52 /*
53 * In regular builds individual spl and tpl handling both
54 * count as handled pre-relocation for later second init.
55 */
56 if (fdt_getprop(blob, offset, "u-boot,dm-spl", NULL) ||
57 fdt_getprop(blob, offset, "u-boot,dm-tpl", NULL))
58 return 1;
59#endif
60
61 return 0;
62}