summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-07-27 06:59:55 -0400
committerTom Rini <trini@konsulko.com>2022-07-27 06:59:55 -0400
commit7277c4bddceb6b8a59ba47b8b111ab070d86919f (patch)
tree0bd1db6551763d178d25e80a350be458150c9e8e
parent81e712a91729950fbd8fb38a6f729cb9847b0adb (diff)
parentdce4322c0e1940e11ef9ff086890b8c474707317 (diff)
Merge tag 'dm-pull-26jul22' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm.git
minor dm- and fdt-related fixes start of test for fdt command
-rw-r--r--board/sandbox/sandbox.c9
-rw-r--r--common/cli.c15
-rw-r--r--configs/sandbox_defconfig3
-rw-r--r--doc/develop/logging.rst19
-rw-r--r--doc/usage/cmd/fdt.rst69
-rw-r--r--doc/usage/index.rst1
-rw-r--r--drivers/core/Kconfig2
-rw-r--r--drivers/core/acpi.c4
-rw-r--r--drivers/core/lists.c15
-rw-r--r--include/addr_map.h2
-rw-r--r--include/command.h10
-rw-r--r--include/log.h3
-rw-r--r--include/test/suites.h1
-rw-r--r--lib/addr_map.c5
-rw-r--r--test/cmd/Makefile1
-rw-r--r--test/cmd/addrmap.c5
-rw-r--r--test/cmd/fdt.c142
-rw-r--r--test/cmd_ut.c6
-rw-r--r--test/log/log_test.c11
-rw-r--r--tools/binman/etype/fit.py1
-rw-r--r--tools/patman/checkpatch.py11
-rw-r--r--tools/patman/control.py7
-rwxr-xr-xtools/patman/main.py6
-rw-r--r--tools/patman/settings.py3
24 files changed, 314 insertions, 37 deletions
diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c
index e054f300c4a..ca9a2ca5b17 100644
--- a/board/sandbox/sandbox.c
+++ b/board/sandbox/sandbox.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <addr_map.h>
#include <cpu_func.h>
#include <cros_ec.h>
#include <dm.h>
@@ -155,3 +156,11 @@ int board_late_init(void)
return 0;
}
#endif
+
+int init_addr_map(void)
+{
+ if (IS_ENABLED(CONFIG_ADDR_MAP))
+ addrmap_set_entry(0, 0, CONFIG_SYS_SDRAM_SIZE, 0);
+
+ return 0;
+}
diff --git a/common/cli.c b/common/cli.c
index a7e3d84b68f..a47d6a3f2b4 100644
--- a/common/cli.c
+++ b/common/cli.c
@@ -126,6 +126,21 @@ int run_command_list(const char *cmd, int len, int flag)
return rcode;
}
+int run_commandf(const char *fmt, ...)
+{
+ va_list args;
+ char cmd[128];
+ int i, ret;
+
+ va_start(args, fmt);
+ i = vsnprintf(cmd, sizeof(cmd), fmt, args);
+ va_end(args);
+
+ ret = run_command(cmd, 0);
+
+ return ret;
+}
+
/****************************************************************************/
#if defined(CONFIG_CMD_RUN)
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 572cf8edd8b..eba7bcbb483 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -31,6 +31,8 @@ CONFIG_CONSOLE_RECORD=y
CONFIG_CONSOLE_RECORD_OUT_SIZE=0x6000
CONFIG_PRE_CONSOLE_BUFFER=y
CONFIG_LOG=y
+CONFIG_LOG_MAX_LEVEL=9
+CONFIG_LOG_DEFAULT_LEVEL=6
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_STACKPROTECTOR=y
CONFIG_ANDROID_AB=y
@@ -313,6 +315,7 @@ CONFIG_WDT_GPIO=y
CONFIG_WDT_SANDBOX=y
CONFIG_FS_CBFS=y
CONFIG_FS_CRAMFS=y
+CONFIG_ADDR_MAP=y
CONFIG_CMD_DHRYSTONE=y
CONFIG_ECDSA=y
CONFIG_ECDSA_VERIFY=y
diff --git a/doc/develop/logging.rst b/doc/develop/logging.rst
index 51095b05ba9..704a6bf1d84 100644
--- a/doc/develop/logging.rst
+++ b/doc/develop/logging.rst
@@ -66,26 +66,21 @@ Sometimes it is useful to turn on logging just in one file. You can use this
#define LOG_DEBUG
to enable building in of all logging statements in a single file. Put it at
-the top of the file, before any #includes.
-
-To actually get U-Boot to output this you need to also set the default logging
-level - e.g. set CONFIG_LOG_DEFAULT_LEVEL to 7 (:c:data:`LOGL_DEBUG`) or more.
-Otherwise debug output is suppressed and will not be generated.
+the top of the file, before any #includes and any message in the file will be
+written, regardless of the value of CONFIG_LOG_DEFAULT_LEVEL.
Using DEBUG
-----------
U-Boot has traditionally used a #define called DEBUG to enable debugging on a
-file-by-file basis. The debug() macro compiles to a printf() statement if
-DEBUG is enabled, and an empty statement if not.
+file-by-file basis but LOG_DEBUG are intended to replace it with the logging
+facilities; DEBUG is activated when LOG_DEBUG is activated.
With logging enabled, debug() statements are interpreted as logging output
-with a level of LOGL_DEBUG and a category of LOGC_NONE.
+with a level of LOGL_DEBUG and a category of LOG_CATEGORY.
-The logging facilities are intended to replace DEBUG, but if DEBUG is defined
-at the top of a file, then it takes precedence. This means that debug()
-statements will result in output to the console and this output will not be
-logged.
+With logging disabled, the debug() macro compiles to a printf() statement
+if DEBUG is enabled and to an empty statement if not.
Logging statements
------------------
diff --git a/doc/usage/cmd/fdt.rst b/doc/usage/cmd/fdt.rst
new file mode 100644
index 00000000000..07fed732e45
--- /dev/null
+++ b/doc/usage/cmd/fdt.rst
@@ -0,0 +1,69 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+fdt command
+===========
+
+Synopis
+-------
+
+::
+
+ fdt addr [-cq] [addr [len]]
+
+Description
+-----------
+
+The fdt command provides access to flat device tree blobs in memory. It has
+many subcommands, some of which are not documented here.
+
+Flags:
+
+-c
+ Select the control FDT (otherwise the working FDT is used).
+-q
+ Don't display errors
+
+The control FDT is the one used by U-Boot itself to control various features,
+including driver model. This should only be changed if you really know what you
+are doing, since once U-Boot starts it maintains pointers into the FDT from the
+various driver model data structures.
+
+The working FDT is the one passed to the Operating System when booting. This
+can be freely modified, so far as U-Boot is concerned, since it does not affect
+U-Boot's operation.
+
+fdt addr
+~~~~~~~~
+
+With no arguments, this shows the address of the current working or control
+FDT.
+
+If the `addr` argument is provided, then this sets the address of the working or
+control FDT to the provided address.
+
+If the `len` argument is provided, then the device tree is expanded to that
+size. This can be used to make space for more nodes and properties. It is
+assumed that there is enough space in memory for this expansion.
+
+Example
+-------
+
+Get the control address and copy that FDT to free memory::
+
+ => fdt addr -c
+ Control fdt: 0aff9fd0
+ => cp.b 0aff9fd0 10000 10000
+ => md 10000 4
+ 00010000: edfe0dd0 5b3d0000 78000000 7c270000 ......=[...x..'|
+
+The second word shows the size of the FDT. Now set the working FDT to that
+address and expand it to 0xf000 in size::
+
+ => fdt addr 10000 f000
+ => md 10000 4
+ 00010000: edfe0dd0 00f00000 78000000 7c270000 ...........x..'|
+
+Return value
+------------
+
+The return value $? indicates whether the command succeeded.
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index 8b98629d6bf..16a3db5c000 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -43,6 +43,7 @@ Shell commands
cmd/false
cmd/fatinfo
cmd/fatload
+ cmd/fdt
cmd/for
cmd/load
cmd/loadm
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index 8eb0070d222..007dc6a1de3 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -18,7 +18,7 @@ config SPL_DM
consider using CONFIG_SPL_SYS_MALLOC_SIMPLE. In that case you
must provide CONFIG_SPL_SYS_MALLOC_F_LEN to set the size.
In most cases driver model will only allocate a few uclasses
- and devices in SPL, so 1KB should be enable. See
+ and devices in SPL, so 1KB should be enough. See
CONFIG_SPL_SYS_MALLOC_F_LEN for more details on how to enable it.
config TPL_DM
diff --git a/drivers/core/acpi.c b/drivers/core/acpi.c
index 0df58dbc0d9..8457733edb5 100644
--- a/drivers/core/acpi.c
+++ b/drivers/core/acpi.c
@@ -159,8 +159,8 @@ static int add_item(struct acpi_ctx *ctx, struct udevice *dev,
memcpy(item->buf, start, item->size);
}
item_count++;
- log_debug("* %s: Added type %d, %p, size %x\n", dev->name, type, start,
- item->size);
+ log_debug("* %s: Added type %d, %p, size %x\n",
+ dev ? dev->name : "other", type, start, item->size);
return 0;
}
diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index 22ccd9faaa9..c49695b24f0 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -223,10 +223,14 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp,
compat);
for (entry = driver; entry != driver + n_ents; entry++) {
+ if (drv) {
+ if (drv != entry)
+ continue;
+ if (!entry->of_match)
+ break;
+ }
ret = driver_check_compatible(entry->of_match, &id,
compat);
- if ((drv) && (drv == entry))
- break;
if (!ret)
break;
}
@@ -241,9 +245,10 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp,
}
}
- log_debug(" - found match at '%s': '%s' matches '%s'\n",
- entry->name, entry->of_match->compatible,
- id->compatible);
+ if (entry->of_match)
+ log_debug(" - found match at '%s': '%s' matches '%s'\n",
+ entry->name, entry->of_match->compatible,
+ id->compatible);
ret = device_bind_with_driver_data(parent, entry, name,
id->data, node, &dev);
if (ret == -ENODEV) {
diff --git a/include/addr_map.h b/include/addr_map.h
index 55d3a6a165a..db3712b5d30 100644
--- a/include/addr_map.h
+++ b/include/addr_map.h
@@ -14,7 +14,9 @@ struct addrmap {
unsigned long vaddr;
};
+#ifdef CONFIG_ADDR_MAP
extern struct addrmap address_map[CONFIG_SYS_NUM_ADDR_MAP];
+#endif
phys_addr_t addrmap_virt_to_phys(void *vaddr);
void *addrmap_phys_to_virt(phys_addr_t paddr);
diff --git a/include/command.h b/include/command.h
index 0cf12fde396..44c91f655d4 100644
--- a/include/command.h
+++ b/include/command.h
@@ -258,6 +258,16 @@ int run_command(const char *cmd, int flag);
int run_command_repeatable(const char *cmd, int flag);
/**
+ * run_commandf() - Run a command created by a format string
+ *
+ * The command cannot be larger than 127 characters
+ *
+ * @fmt: printf() format string
+ * @...: Arguments to use (flag is always 0)
+ */
+int run_commandf(const char *fmt, ...);
+
+/**
* Run a list of commands separated by ; or even \0
*
* Note that if 'len' is not -1, then the command does not need to be nul
diff --git a/include/log.h b/include/log.h
index 8f35c10abb5..7abc70e4398 100644
--- a/include/log.h
+++ b/include/log.h
@@ -194,6 +194,9 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level,
#ifdef LOG_DEBUG
#define _LOG_DEBUG LOGL_FORCE_DEBUG
+#ifndef DEBUG
+#define DEBUG
+#endif
#else
#define _LOG_DEBUG 0
#endif
diff --git a/include/test/suites.h b/include/test/suites.h
index ddb8827fdb1..44025ccecd6 100644
--- a/include/test/suites.h
+++ b/include/test/suites.h
@@ -38,6 +38,7 @@ int do_ut_compression(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[]);
int do_ut_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
int do_ut_env(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_ut_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
int do_ut_lib(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
int do_ut_loadm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
int do_ut_log(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]);
diff --git a/lib/addr_map.c b/lib/addr_map.c
index fb2ef400078..9b3e0a544e4 100644
--- a/lib/addr_map.c
+++ b/lib/addr_map.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <addr_map.h>
+#include <mapmem.h>
struct addrmap address_map[CONFIG_SYS_NUM_ADDR_MAP];
@@ -18,7 +19,7 @@ phys_addr_t addrmap_virt_to_phys(void * vaddr)
if (address_map[i].size == 0)
continue;
- addr = (u64)((u32)vaddr);
+ addr = map_to_sysmem(vaddr);
base = (u64)(address_map[i].vaddr);
upper = (u64)(address_map[i].size) + base - 1;
@@ -48,7 +49,7 @@ void *addrmap_phys_to_virt(phys_addr_t paddr)
offset = address_map[i].paddr - address_map[i].vaddr;
- return (void *)(unsigned long)(paddr - offset);
+ return map_sysmem(paddr - offset, 0);
}
}
diff --git a/test/cmd/Makefile b/test/cmd/Makefile
index 4b2d7df0d2e..c331757425e 100644
--- a/test/cmd/Makefile
+++ b/test/cmd/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o
endif
obj-y += mem.o
obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o
+obj-$(CONFIG_CMD_FDT) += fdt.o
obj-$(CONFIG_CMD_LOADM) += loadm.o
obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
obj-$(CONFIG_CMD_PINMUX) += pinmux.o
diff --git a/test/cmd/addrmap.c b/test/cmd/addrmap.c
index fb744485bbf..1eb5955db17 100644
--- a/test/cmd/addrmap.c
+++ b/test/cmd/addrmap.c
@@ -29,9 +29,8 @@ ADDRMAP_TEST(addrmap_test_basic, UT_TESTF_CONSOLE_REC);
int do_ut_addrmap(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
- struct unit_test *tests = ll_entry_start(struct unit_test,
- addrmap_test);
- const int n_ents = ll_entry_count(struct unit_test, addrmap_test);
+ struct unit_test *tests = UNIT_TEST_SUITE_START(addrmap_test);
+ const int n_ents = UNIT_TEST_SUITE_COUNT(addrmap_test);
return cmd_ut_category("cmd_addrmap", "cmd_addrmap_", tests, n_ents,
argc, argv);
diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c
new file mode 100644
index 00000000000..100a7ef5ebf
--- /dev/null
+++ b/test/cmd/fdt.c
@@ -0,0 +1,142 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Tests for fdt command
+ *
+ * Copyright 2022 Google LLCmap_to_sysmem(fdt));
+ */
+
+#include <common.h>
+#include <console.h>
+#include <fdt_support.h>
+#include <mapmem.h>
+#include <asm/global_data.h>
+#include <linux/libfdt.h>
+#include <test/suites.h>
+#include <test/ut.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Declare a new fdt test */
+#define FDT_TEST(_name, _flags) UNIT_TEST(_name, _flags, fdt_test)
+
+/**
+ * make_test_fdt() - Create an FDT with just a root node
+ *
+ * The size is set to the minimum needed
+ *
+ * @uts: Test state
+ * @fdt: Place to write FDT
+ * @size: Maximum size of space for fdt
+ */
+static int make_test_fdt(struct unit_test_state *uts, void *fdt, int size)
+{
+ ut_assertok(fdt_create(fdt, size));
+ ut_assertok(fdt_finish_reservemap(fdt));
+ ut_assert(fdt_begin_node(fdt, "") >= 0);
+ ut_assertok(fdt_end_node(fdt));
+ ut_assertok(fdt_finish(fdt));
+
+ return 0;
+}
+
+/* Test 'fdt addr' getting/setting address */
+static int fdt_test_addr(struct unit_test_state *uts)
+{
+ const void *fdt_blob, *new_fdt;
+ char fdt[256];
+ ulong addr;
+ int ret;
+
+ ut_assertok(console_record_reset_enable());
+ ut_assertok(run_command("fdt addr -c", 0));
+ ut_assert_nextline("Control fdt: %08lx",
+ (ulong)map_to_sysmem(gd->fdt_blob));
+ ut_assertok(ut_check_console_end(uts));
+
+ /* The working fdt is not set, so this should fail */
+ set_working_fdt_addr(0);
+ ut_asserteq(CMD_RET_FAILURE, run_command("fdt addr", 0));
+ ut_assert_nextline("libfdt fdt_check_header(): FDT_ERR_BADMAGIC");
+ ut_assertok(ut_check_console_end(uts));
+
+ /* Set up a working FDT and try again */
+ ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt)));
+ addr = map_to_sysmem(fdt);
+ set_working_fdt_addr(addr);
+ ut_assertok(run_command("fdt addr", 0));
+ ut_assert_nextline("Working fdt: %08lx", (ulong)map_to_sysmem(fdt));
+ ut_assertok(ut_check_console_end(uts));
+
+ /* Set the working FDT */
+ set_working_fdt_addr(0);
+ ut_assertok(run_commandf("fdt addr %08x", addr));
+ ut_asserteq(addr, map_to_sysmem(working_fdt));
+ ut_assertok(ut_check_console_end(uts));
+ set_working_fdt_addr(0);
+
+ /* Set the working FDT */
+ fdt_blob = gd->fdt_blob;
+ gd->fdt_blob = NULL;
+ ret = run_commandf("fdt addr -c %08x", addr);
+ new_fdt = gd->fdt_blob;
+ gd->fdt_blob = fdt_blob;
+ ut_assertok(ret);
+ ut_asserteq(addr, map_to_sysmem(new_fdt));
+ ut_assertok(ut_check_console_end(uts));
+
+ /* Test setting an invalid FDT */
+ fdt[0] = 123;
+ ut_asserteq(1, run_commandf("fdt addr %08x", addr));
+ ut_assert_nextline("libfdt fdt_check_header(): FDT_ERR_BADMAGIC");
+ ut_assertok(ut_check_console_end(uts));
+
+ /* Test detecting an invalid FDT */
+ fdt[0] = 123;
+ set_working_fdt_addr(addr);
+ ut_asserteq(1, run_commandf("fdt addr"));
+ ut_assert_nextline("libfdt fdt_check_header(): FDT_ERR_BADMAGIC");
+ ut_assertok(ut_check_console_end(uts));
+
+ return 0;
+}
+FDT_TEST(fdt_test_addr, UT_TESTF_CONSOLE_REC);
+
+/* Test 'fdt addr' resizing an fdt */
+static int fdt_test_resize(struct unit_test_state *uts)
+{
+ char fdt[256];
+ const int newsize = sizeof(fdt) / 2;
+ ulong addr;
+
+ ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt)));
+ addr = map_to_sysmem(fdt);
+ set_working_fdt_addr(addr);
+
+ /* Test setting and resizing the working FDT to a larger size */
+ ut_assertok(console_record_reset_enable());
+ ut_assertok(run_commandf("fdt addr %08x %x", addr, newsize));
+ ut_assertok(ut_check_console_end(uts));
+
+ /* Try shrinking it */
+ ut_assertok(run_commandf("fdt addr %08x %x", addr, sizeof(fdt) / 4));
+ ut_assert_nextline("New length %d < existing length %d, ignoring",
+ (int)sizeof(fdt) / 4, newsize);
+ ut_assertok(ut_check_console_end(uts));
+
+ /* ...quietly */
+ ut_assertok(run_commandf("fdt addr -q %08x %x", addr, sizeof(fdt) / 4));
+ ut_assertok(ut_check_console_end(uts));
+
+ /* We cannot easily provoke errors in fdt_open_into(), so ignore that */
+
+ return 0;
+}
+FDT_TEST(fdt_test_resize, UT_TESTF_CONSOLE_REC);
+
+int do_ut_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+ struct unit_test *tests = UNIT_TEST_SUITE_START(fdt_test);
+ const int n_ents = UNIT_TEST_SUITE_COUNT(fdt_test);
+
+ return cmd_ut_category("fdt", "fdt_test_", tests, n_ents, argc, argv);
+}
diff --git a/test/cmd_ut.c b/test/cmd_ut.c
index d70b72678ae..3789c6b784c 100644
--- a/test/cmd_ut.c
+++ b/test/cmd_ut.c
@@ -39,6 +39,9 @@ static struct cmd_tbl cmd_ut_sub[] = {
#if defined(CONFIG_UT_ENV)
U_BOOT_CMD_MKENT(env, CONFIG_SYS_MAXARGS, 1, do_ut_env, "", ""),
#endif
+#ifdef CONFIG_CMD_FDT
+ U_BOOT_CMD_MKENT(fdt, CONFIG_SYS_MAXARGS, 1, do_ut_fdt, "", ""),
+#endif
#ifdef CONFIG_UT_OPTEE
U_BOOT_CMD_MKENT(optee, CONFIG_SYS_MAXARGS, 1, do_ut_optee, "", ""),
#endif
@@ -131,6 +134,9 @@ static char ut_help_text[] =
#ifdef CONFIG_UT_ENV
"ut env [test-name]\n"
#endif
+#ifdef CONFIG_CMD_FDT
+ "ut fdt [test-name] - test of the fdt command\n"
+#endif
#ifdef CONFIG_UT_LIB
"ut lib [test-name] - test library functions\n"
#endif
diff --git a/test/log/log_test.c b/test/log/log_test.c
index db7170f3042..c5abff80d11 100644
--- a/test/log/log_test.c
+++ b/test/log/log_test.c
@@ -277,7 +277,7 @@ int do_log_test_helpers(struct unit_test_state *uts)
log_content("level %d\n", LOGL_DEBUG_CONTENT);
log_io("level %d\n", LOGL_DEBUG_IO);
- for (i = LOGL_EMERG; i <= _LOG_MAX_LEVEL; i++)
+ for (i = LOGL_EMERG; i <= gd->default_log_level; i++)
ut_assert_nextline("%*s() level %d", CONFIG_LOGF_FUNC_PAD,
__func__, i);
ut_assert_console_end();
@@ -381,7 +381,8 @@ int log_test_level_deny(struct unit_test_state *uts)
ut_assertok(console_record_reset_enable());
log_run();
check_log_entries_flags_levels(EXPECT_LOG | EXPECT_DIRECT | EXPECT_FORCE,
- LOGL_WARNING + 1, _LOG_MAX_LEVEL);
+ LOGL_WARNING + 1,
+ min(gd->default_log_level, LOGL_INFO));
ut_assertok(log_remove_filter("console", filt1));
ut_assertok(log_remove_filter("console", filt2));
@@ -420,9 +421,11 @@ int log_test_dropped(struct unit_test_state *uts)
gd->log_drop_count = 0;
ut_assertok(console_record_reset_enable());
- log_run();
- ut_asserteq(gd->log_drop_count, 3 * (LOGL_COUNT - LOGL_FIRST - 1));
+ log_run();
+ ut_asserteq(2 * (LOGL_COUNT - LOGL_FIRST) +
+ _LOG_MAX_LEVEL - LOGL_FIRST + 1,
+ gd->log_drop_count);
check_log_entries_flags_levels(EXPECT_DEBUG, LOGL_FIRST, CONFIG_LOG_DEFAULT_LEVEL);
gd->flags |= GD_FLG_LOG_READY;
diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py
index 12306623af6..ad43fce18ec 100644
--- a/tools/binman/etype/fit.py
+++ b/tools/binman/etype/fit.py
@@ -658,6 +658,7 @@ class Entry_fit(Entry_section):
# Build a new tree with all nodes and properties starting from the
# entry node
fsw = libfdt.FdtSw()
+ fsw.INC_SIZE = 65536
fsw.finish_reservemap()
to_remove = []
loadables = []
diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
index 70ba561c268..d1b902dd962 100644
--- a/tools/patman/checkpatch.py
+++ b/tools/patman/checkpatch.py
@@ -186,7 +186,7 @@ def check_patch_parse(checkpatch_output, verbose=False):
return result
-def check_patch(fname, verbose=False, show_types=False):
+def check_patch(fname, verbose=False, show_types=False, use_tree=False):
"""Run checkpatch.pl on a file and parse the results.
Args:
@@ -194,6 +194,7 @@ def check_patch(fname, verbose=False, show_types=False):
verbose: True to print out every line of the checkpatch output as it is
parsed
show_types: Tell checkpatch to show the type (number) of each message
+ use_tree (bool): If False we'll pass '--no-tree' to checkpatch.
Returns:
namedtuple containing:
@@ -210,7 +211,9 @@ def check_patch(fname, verbose=False, show_types=False):
stdout: Full output of checkpatch
"""
chk = find_check_patch()
- args = [chk, '--no-tree']
+ args = [chk]
+ if not use_tree:
+ args.append('--no-tree')
if show_types:
args.append('--show-types')
output = command.output(*args, fname, raise_on_error=False)
@@ -236,13 +239,13 @@ def get_warning_msg(col, msg_type, fname, line, msg):
line_str = '' if line is None else '%d' % line
return '%s:%s: %s: %s\n' % (fname, line_str, msg_type, msg)
-def check_patches(verbose, args):
+def check_patches(verbose, args, use_tree):
'''Run the checkpatch.pl script on each patch'''
error_count, warning_count, check_count = 0, 0, 0
col = terminal.Color()
for fname in args:
- result = check_patch(fname, verbose)
+ result = check_patch(fname, verbose, use_tree=use_tree)
if not result.ok:
error_count += result.errors
warning_count += result.warnings
diff --git a/tools/patman/control.py b/tools/patman/control.py
index b40382388e0..bf426cf7bcf 100644
--- a/tools/patman/control.py
+++ b/tools/patman/control.py
@@ -64,7 +64,7 @@ def prepare_patches(col, branch, count, start, end, ignore_binary, signoff):
patchstream.insert_cover_letter(cover_fname, series, to_do)
return series, cover_fname, patch_files
-def check_patches(series, patch_files, run_checkpatch, verbose):
+def check_patches(series, patch_files, run_checkpatch, verbose, use_tree):
"""Run some checks on a set of patches
This santiy-checks the patman tags like Series-version and runs the patches
@@ -77,6 +77,7 @@ def check_patches(series, patch_files, run_checkpatch, verbose):
run_checkpatch (bool): True to run checkpatch.pl
verbose (bool): True to print out every line of the checkpatch output as
it is parsed
+ use_tree (bool): If False we'll pass '--no-tree' to checkpatch.
Returns:
bool: True if the patches had no errors, False if they did
@@ -86,7 +87,7 @@ def check_patches(series, patch_files, run_checkpatch, verbose):
# Check the patches, and run them through 'git am' just to be sure
if run_checkpatch:
- ok = checkpatch.check_patches(verbose, patch_files)
+ ok = checkpatch.check_patches(verbose, patch_files, use_tree)
else:
ok = True
return ok
@@ -165,7 +166,7 @@ def send(args):
col, args.branch, args.count, args.start, args.end,
args.ignore_binary, args.add_signoff)
ok = check_patches(series, patch_files, args.check_patch,
- args.verbose)
+ args.verbose, args.check_patch_use_tree)
ok = ok and gitutil.check_suppress_cc_config()
diff --git a/tools/patman/main.py b/tools/patman/main.py
index 66d4806c8d8..15e7af0e54e 100755
--- a/tools/patman/main.py
+++ b/tools/patman/main.py
@@ -81,6 +81,12 @@ send.add_argument('--no-binary', action='store_true', dest='ignore_binary',
send.add_argument('--no-check', action='store_false', dest='check_patch',
default=True,
help="Don't check for patch compliance")
+send.add_argument('--tree', dest='check_patch_use_tree', default=False,
+ action='store_true',
+ help=("Set `tree` to True. If `tree` is False then we'll "
+ "pass '--no-tree' to checkpatch (default: tree=%(default)s)"))
+send.add_argument('--no-tree', dest='check_patch_use_tree',
+ action='store_false', help="Set `tree` to False")
send.add_argument('--no-tags', action='store_false', dest='process_tags',
default=True, help="Don't process subject tags as aliases")
send.add_argument('--no-signoff', action='store_false', dest='add_signoff',
diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index 4c847fe88fd..903d6fcb0b4 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -23,6 +23,7 @@ _default_settings = {
"u-boot": {},
"linux": {
"process_tags": "False",
+ "check_patch_use_tree": "True",
},
"gcc": {
"process_tags": "False",
@@ -71,7 +72,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
>>> config = _ProjectConfigParser("linux")
>>> config.readfp(StringIO(sample_config))
>>> sorted((str(a), str(b)) for (a, b) in config.items("settings"))
- [('am_hero', 'True'), ('process_tags', 'False')]
+ [('am_hero', 'True'), ('check_patch_use_tree', 'True'), ('process_tags', 'False')]
# Check to make sure that settings works with unknown project.
>>> config = _ProjectConfigParser("unknown")