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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
15
common/cli.c
15
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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
------------------
|
||||
|
||||
69
doc/usage/cmd/fdt.rst
Normal file
69
doc/usage/cmd/fdt.rst
Normal file
@@ -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.
|
||||
@@ -43,6 +43,7 @@ Shell commands
|
||||
cmd/false
|
||||
cmd/fatinfo
|
||||
cmd/fatload
|
||||
cmd/fdt
|
||||
cmd/for
|
||||
cmd/load
|
||||
cmd/loadm
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -257,6 +257,16 @@ int board_run_command(const char *cmdline);
|
||||
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
|
||||
*
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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[]);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
142
test/cmd/fdt.c
Normal file
142
test/cmd/fdt.c
Normal file
@@ -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);
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user