2014-02-26 22:59:18 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Google, Inc
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2017-06-22 07:50:01 +00:00
|
|
|
#include <dm/util.h>
|
2017-02-18 18:46:21 +00:00
|
|
|
#include <libfdt.h>
|
2014-02-26 22:59:18 +00:00
|
|
|
#include <vsprintf.h>
|
|
|
|
|
2017-06-22 07:50:01 +00:00
|
|
|
#ifdef CONFIG_DM_WARN
|
2014-02-26 22:59:18 +00:00
|
|
|
void dm_warn(const char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start(args, fmt);
|
|
|
|
vprintf(fmt, args);
|
|
|
|
va_end(args);
|
|
|
|
}
|
2017-06-22 07:50:01 +00:00
|
|
|
#endif
|
2014-02-26 22:59:18 +00:00
|
|
|
|
|
|
|
int list_count_items(struct list_head *head)
|
|
|
|
{
|
|
|
|
struct list_head *node;
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
list_for_each(node, head)
|
|
|
|
count++;
|
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
2017-02-18 18:46:21 +00:00
|
|
|
|
2017-02-23 16:30:38 +00:00
|
|
|
bool dm_fdt_pre_reloc(const void *blob, int offset)
|
2017-02-18 18:46:21 +00:00
|
|
|
{
|
|
|
|
if (fdt_getprop(blob, offset, "u-boot,dm-pre-reloc", NULL))
|
2017-02-23 16:30:38 +00:00
|
|
|
return true;
|
2017-02-18 18:46:21 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_TPL_BUILD
|
|
|
|
if (fdt_getprop(blob, offset, "u-boot,dm-tpl", NULL))
|
2017-02-23 16:30:38 +00:00
|
|
|
return true;
|
2017-02-18 18:46:21 +00:00
|
|
|
#elif defined(CONFIG_SPL_BUILD)
|
|
|
|
if (fdt_getprop(blob, offset, "u-boot,dm-spl", NULL))
|
2017-02-23 16:30:38 +00:00
|
|
|
return true;
|
2017-02-18 18:46:21 +00:00
|
|
|
#else
|
|
|
|
/*
|
|
|
|
* In regular builds individual spl and tpl handling both
|
|
|
|
* count as handled pre-relocation for later second init.
|
|
|
|
*/
|
|
|
|
if (fdt_getprop(blob, offset, "u-boot,dm-spl", NULL) ||
|
|
|
|
fdt_getprop(blob, offset, "u-boot,dm-tpl", NULL))
|
2017-02-23 16:30:38 +00:00
|
|
|
return true;
|
2017-02-18 18:46:21 +00:00
|
|
|
#endif
|
|
|
|
|
2017-02-23 16:30:38 +00:00
|
|
|
return false;
|
2017-02-18 18:46:21 +00:00
|
|
|
}
|