Révision | 7277c4bddceb6b8a59ba47b8b111ab070d86919f (tree) |
---|---|
l'heure | 2022-07-27 19:59:55 |
Auteur | Tom Rini <trini@kons...> |
Commiter | Tom Rini |
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
@@ -4,6 +4,7 @@ | ||
4 | 4 | */ |
5 | 5 | |
6 | 6 | #include <common.h> |
7 | +#include <addr_map.h> | |
7 | 8 | #include <cpu_func.h> |
8 | 9 | #include <cros_ec.h> |
9 | 10 | #include <dm.h> |
@@ -155,3 +156,11 @@ int board_late_init(void) | ||
155 | 156 | return 0; |
156 | 157 | } |
157 | 158 | #endif |
159 | + | |
160 | +int init_addr_map(void) | |
161 | +{ | |
162 | + if (IS_ENABLED(CONFIG_ADDR_MAP)) | |
163 | + addrmap_set_entry(0, 0, CONFIG_SYS_SDRAM_SIZE, 0); | |
164 | + | |
165 | + return 0; | |
166 | +} |
@@ -126,6 +126,21 @@ int run_command_list(const char *cmd, int len, int flag) | ||
126 | 126 | return rcode; |
127 | 127 | } |
128 | 128 | |
129 | +int run_commandf(const char *fmt, ...) | |
130 | +{ | |
131 | + va_list args; | |
132 | + char cmd[128]; | |
133 | + int i, ret; | |
134 | + | |
135 | + va_start(args, fmt); | |
136 | + i = vsnprintf(cmd, sizeof(cmd), fmt, args); | |
137 | + va_end(args); | |
138 | + | |
139 | + ret = run_command(cmd, 0); | |
140 | + | |
141 | + return ret; | |
142 | +} | |
143 | + | |
129 | 144 | /****************************************************************************/ |
130 | 145 | |
131 | 146 | #if defined(CONFIG_CMD_RUN) |
@@ -31,6 +31,8 @@ CONFIG_CONSOLE_RECORD=y | ||
31 | 31 | CONFIG_CONSOLE_RECORD_OUT_SIZE=0x6000 |
32 | 32 | CONFIG_PRE_CONSOLE_BUFFER=y |
33 | 33 | CONFIG_LOG=y |
34 | +CONFIG_LOG_MAX_LEVEL=9 | |
35 | +CONFIG_LOG_DEFAULT_LEVEL=6 | |
34 | 36 | CONFIG_DISPLAY_BOARDINFO_LATE=y |
35 | 37 | CONFIG_STACKPROTECTOR=y |
36 | 38 | CONFIG_ANDROID_AB=y |
@@ -313,6 +315,7 @@ CONFIG_WDT_GPIO=y | ||
313 | 315 | CONFIG_WDT_SANDBOX=y |
314 | 316 | CONFIG_FS_CBFS=y |
315 | 317 | CONFIG_FS_CRAMFS=y |
318 | +CONFIG_ADDR_MAP=y | |
316 | 319 | CONFIG_CMD_DHRYSTONE=y |
317 | 320 | CONFIG_ECDSA=y |
318 | 321 | CONFIG_ECDSA_VERIFY=y |
@@ -66,26 +66,21 @@ Sometimes it is useful to turn on logging just in one file. You can use this | ||
66 | 66 | #define LOG_DEBUG |
67 | 67 | |
68 | 68 | to enable building in of all logging statements in a single file. Put it at |
69 | -the top of the file, before any #includes. | |
70 | - | |
71 | -To actually get U-Boot to output this you need to also set the default logging | |
72 | -level - e.g. set CONFIG_LOG_DEFAULT_LEVEL to 7 (:c:data:`LOGL_DEBUG`) or more. | |
73 | -Otherwise debug output is suppressed and will not be generated. | |
69 | +the top of the file, before any #includes and any message in the file will be | |
70 | +written, regardless of the value of CONFIG_LOG_DEFAULT_LEVEL. | |
74 | 71 | |
75 | 72 | Using DEBUG |
76 | 73 | ----------- |
77 | 74 | |
78 | 75 | U-Boot has traditionally used a #define called DEBUG to enable debugging on a |
79 | -file-by-file basis. The debug() macro compiles to a printf() statement if | |
80 | -DEBUG is enabled, and an empty statement if not. | |
76 | +file-by-file basis but LOG_DEBUG are intended to replace it with the logging | |
77 | +facilities; DEBUG is activated when LOG_DEBUG is activated. | |
81 | 78 | |
82 | 79 | With logging enabled, debug() statements are interpreted as logging output |
83 | -with a level of LOGL_DEBUG and a category of LOGC_NONE. | |
80 | +with a level of LOGL_DEBUG and a category of LOG_CATEGORY. | |
84 | 81 | |
85 | -The logging facilities are intended to replace DEBUG, but if DEBUG is defined | |
86 | -at the top of a file, then it takes precedence. This means that debug() | |
87 | -statements will result in output to the console and this output will not be | |
88 | -logged. | |
82 | +With logging disabled, the debug() macro compiles to a printf() statement | |
83 | +if DEBUG is enabled and to an empty statement if not. | |
89 | 84 | |
90 | 85 | Logging statements |
91 | 86 | ------------------ |
@@ -0,0 +1,69 @@ | ||
1 | +.. SPDX-License-Identifier: GPL-2.0+ | |
2 | + | |
3 | +fdt command | |
4 | +=========== | |
5 | + | |
6 | +Synopis | |
7 | +------- | |
8 | + | |
9 | +:: | |
10 | + | |
11 | + fdt addr [-cq] [addr [len]] | |
12 | + | |
13 | +Description | |
14 | +----------- | |
15 | + | |
16 | +The fdt command provides access to flat device tree blobs in memory. It has | |
17 | +many subcommands, some of which are not documented here. | |
18 | + | |
19 | +Flags: | |
20 | + | |
21 | +-c | |
22 | + Select the control FDT (otherwise the working FDT is used). | |
23 | +-q | |
24 | + Don't display errors | |
25 | + | |
26 | +The control FDT is the one used by U-Boot itself to control various features, | |
27 | +including driver model. This should only be changed if you really know what you | |
28 | +are doing, since once U-Boot starts it maintains pointers into the FDT from the | |
29 | +various driver model data structures. | |
30 | + | |
31 | +The working FDT is the one passed to the Operating System when booting. This | |
32 | +can be freely modified, so far as U-Boot is concerned, since it does not affect | |
33 | +U-Boot's operation. | |
34 | + | |
35 | +fdt addr | |
36 | +~~~~~~~~ | |
37 | + | |
38 | +With no arguments, this shows the address of the current working or control | |
39 | +FDT. | |
40 | + | |
41 | +If the `addr` argument is provided, then this sets the address of the working or | |
42 | +control FDT to the provided address. | |
43 | + | |
44 | +If the `len` argument is provided, then the device tree is expanded to that | |
45 | +size. This can be used to make space for more nodes and properties. It is | |
46 | +assumed that there is enough space in memory for this expansion. | |
47 | + | |
48 | +Example | |
49 | +------- | |
50 | + | |
51 | +Get the control address and copy that FDT to free memory:: | |
52 | + | |
53 | + => fdt addr -c | |
54 | + Control fdt: 0aff9fd0 | |
55 | + => cp.b 0aff9fd0 10000 10000 | |
56 | + => md 10000 4 | |
57 | + 00010000: edfe0dd0 5b3d0000 78000000 7c270000 ......=[...x..'| | |
58 | + | |
59 | +The second word shows the size of the FDT. Now set the working FDT to that | |
60 | +address and expand it to 0xf000 in size:: | |
61 | + | |
62 | + => fdt addr 10000 f000 | |
63 | + => md 10000 4 | |
64 | + 00010000: edfe0dd0 00f00000 78000000 7c270000 ...........x..'| | |
65 | + | |
66 | +Return value | |
67 | +------------ | |
68 | + | |
69 | +The return value $? indicates whether the command succeeded. |
@@ -43,6 +43,7 @@ Shell commands | ||
43 | 43 | cmd/false |
44 | 44 | cmd/fatinfo |
45 | 45 | cmd/fatload |
46 | + cmd/fdt | |
46 | 47 | cmd/for |
47 | 48 | cmd/load |
48 | 49 | cmd/loadm |
@@ -18,7 +18,7 @@ config SPL_DM | ||
18 | 18 | consider using CONFIG_SPL_SYS_MALLOC_SIMPLE. In that case you |
19 | 19 | must provide CONFIG_SPL_SYS_MALLOC_F_LEN to set the size. |
20 | 20 | In most cases driver model will only allocate a few uclasses |
21 | - and devices in SPL, so 1KB should be enable. See | |
21 | + and devices in SPL, so 1KB should be enough. See | |
22 | 22 | CONFIG_SPL_SYS_MALLOC_F_LEN for more details on how to enable it. |
23 | 23 | |
24 | 24 | config TPL_DM |
@@ -159,8 +159,8 @@ static int add_item(struct acpi_ctx *ctx, struct udevice *dev, | ||
159 | 159 | memcpy(item->buf, start, item->size); |
160 | 160 | } |
161 | 161 | item_count++; |
162 | - log_debug("* %s: Added type %d, %p, size %x\n", dev->name, type, start, | |
163 | - item->size); | |
162 | + log_debug("* %s: Added type %d, %p, size %x\n", | |
163 | + dev ? dev->name : "other", type, start, item->size); | |
164 | 164 | |
165 | 165 | return 0; |
166 | 166 | } |
@@ -223,10 +223,14 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp, | ||
223 | 223 | compat); |
224 | 224 | |
225 | 225 | for (entry = driver; entry != driver + n_ents; entry++) { |
226 | + if (drv) { | |
227 | + if (drv != entry) | |
228 | + continue; | |
229 | + if (!entry->of_match) | |
230 | + break; | |
231 | + } | |
226 | 232 | ret = driver_check_compatible(entry->of_match, &id, |
227 | 233 | compat); |
228 | - if ((drv) && (drv == entry)) | |
229 | - break; | |
230 | 234 | if (!ret) |
231 | 235 | break; |
232 | 236 | } |
@@ -241,9 +245,10 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp, | ||
241 | 245 | } |
242 | 246 | } |
243 | 247 | |
244 | - log_debug(" - found match at '%s': '%s' matches '%s'\n", | |
245 | - entry->name, entry->of_match->compatible, | |
246 | - id->compatible); | |
248 | + if (entry->of_match) | |
249 | + log_debug(" - found match at '%s': '%s' matches '%s'\n", | |
250 | + entry->name, entry->of_match->compatible, | |
251 | + id->compatible); | |
247 | 252 | ret = device_bind_with_driver_data(parent, entry, name, |
248 | 253 | id->data, node, &dev); |
249 | 254 | if (ret == -ENODEV) { |
@@ -14,7 +14,9 @@ struct addrmap { | ||
14 | 14 | unsigned long vaddr; |
15 | 15 | }; |
16 | 16 | |
17 | +#ifdef CONFIG_ADDR_MAP | |
17 | 18 | extern struct addrmap address_map[CONFIG_SYS_NUM_ADDR_MAP]; |
19 | +#endif | |
18 | 20 | |
19 | 21 | phys_addr_t addrmap_virt_to_phys(void *vaddr); |
20 | 22 | void *addrmap_phys_to_virt(phys_addr_t paddr); |
@@ -258,6 +258,16 @@ int run_command(const char *cmd, int flag); | ||
258 | 258 | int run_command_repeatable(const char *cmd, int flag); |
259 | 259 | |
260 | 260 | /** |
261 | + * run_commandf() - Run a command created by a format string | |
262 | + * | |
263 | + * The command cannot be larger than 127 characters | |
264 | + * | |
265 | + * @fmt: printf() format string | |
266 | + * @...: Arguments to use (flag is always 0) | |
267 | + */ | |
268 | +int run_commandf(const char *fmt, ...); | |
269 | + | |
270 | +/** | |
261 | 271 | * Run a list of commands separated by ; or even \0 |
262 | 272 | * |
263 | 273 | * Note that if 'len' is not -1, then the command does not need to be nul |
@@ -194,6 +194,9 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level, | ||
194 | 194 | |
195 | 195 | #ifdef LOG_DEBUG |
196 | 196 | #define _LOG_DEBUG LOGL_FORCE_DEBUG |
197 | +#ifndef DEBUG | |
198 | +#define DEBUG | |
199 | +#endif | |
197 | 200 | #else |
198 | 201 | #define _LOG_DEBUG 0 |
199 | 202 | #endif |
@@ -38,6 +38,7 @@ int do_ut_compression(struct cmd_tbl *cmdtp, int flag, int argc, | ||
38 | 38 | char *const argv[]); |
39 | 39 | int do_ut_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); |
40 | 40 | int do_ut_env(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); |
41 | +int do_ut_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); | |
41 | 42 | int do_ut_lib(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); |
42 | 43 | int do_ut_loadm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]); |
43 | 44 | int do_ut_log(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]); |
@@ -5,6 +5,7 @@ | ||
5 | 5 | |
6 | 6 | #include <common.h> |
7 | 7 | #include <addr_map.h> |
8 | +#include <mapmem.h> | |
8 | 9 | |
9 | 10 | struct addrmap address_map[CONFIG_SYS_NUM_ADDR_MAP]; |
10 | 11 |
@@ -18,7 +19,7 @@ phys_addr_t addrmap_virt_to_phys(void * vaddr) | ||
18 | 19 | if (address_map[i].size == 0) |
19 | 20 | continue; |
20 | 21 | |
21 | - addr = (u64)((u32)vaddr); | |
22 | + addr = map_to_sysmem(vaddr); | |
22 | 23 | base = (u64)(address_map[i].vaddr); |
23 | 24 | upper = (u64)(address_map[i].size) + base - 1; |
24 | 25 |
@@ -48,7 +49,7 @@ void *addrmap_phys_to_virt(phys_addr_t paddr) | ||
48 | 49 | |
49 | 50 | offset = address_map[i].paddr - address_map[i].vaddr; |
50 | 51 | |
51 | - return (void *)(unsigned long)(paddr - offset); | |
52 | + return map_sysmem(paddr - offset, 0); | |
52 | 53 | } |
53 | 54 | } |
54 | 55 |
@@ -7,6 +7,7 @@ obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o | ||
7 | 7 | endif |
8 | 8 | obj-y += mem.o |
9 | 9 | obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o |
10 | +obj-$(CONFIG_CMD_FDT) += fdt.o | |
10 | 11 | obj-$(CONFIG_CMD_LOADM) += loadm.o |
11 | 12 | obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o |
12 | 13 | obj-$(CONFIG_CMD_PINMUX) += pinmux.o |
@@ -29,9 +29,8 @@ ADDRMAP_TEST(addrmap_test_basic, UT_TESTF_CONSOLE_REC); | ||
29 | 29 | |
30 | 30 | int do_ut_addrmap(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
31 | 31 | { |
32 | - struct unit_test *tests = ll_entry_start(struct unit_test, | |
33 | - addrmap_test); | |
34 | - const int n_ents = ll_entry_count(struct unit_test, addrmap_test); | |
32 | + struct unit_test *tests = UNIT_TEST_SUITE_START(addrmap_test); | |
33 | + const int n_ents = UNIT_TEST_SUITE_COUNT(addrmap_test); | |
35 | 34 | |
36 | 35 | return cmd_ut_category("cmd_addrmap", "cmd_addrmap_", tests, n_ents, |
37 | 36 | argc, argv); |
@@ -0,0 +1,142 @@ | ||
1 | +// SPDX-License-Identifier: GPL-2.0+ | |
2 | +/* | |
3 | + * Tests for fdt command | |
4 | + * | |
5 | + * Copyright 2022 Google LLCmap_to_sysmem(fdt)); | |
6 | + */ | |
7 | + | |
8 | +#include <common.h> | |
9 | +#include <console.h> | |
10 | +#include <fdt_support.h> | |
11 | +#include <mapmem.h> | |
12 | +#include <asm/global_data.h> | |
13 | +#include <linux/libfdt.h> | |
14 | +#include <test/suites.h> | |
15 | +#include <test/ut.h> | |
16 | + | |
17 | +DECLARE_GLOBAL_DATA_PTR; | |
18 | + | |
19 | +/* Declare a new fdt test */ | |
20 | +#define FDT_TEST(_name, _flags) UNIT_TEST(_name, _flags, fdt_test) | |
21 | + | |
22 | +/** | |
23 | + * make_test_fdt() - Create an FDT with just a root node | |
24 | + * | |
25 | + * The size is set to the minimum needed | |
26 | + * | |
27 | + * @uts: Test state | |
28 | + * @fdt: Place to write FDT | |
29 | + * @size: Maximum size of space for fdt | |
30 | + */ | |
31 | +static int make_test_fdt(struct unit_test_state *uts, void *fdt, int size) | |
32 | +{ | |
33 | + ut_assertok(fdt_create(fdt, size)); | |
34 | + ut_assertok(fdt_finish_reservemap(fdt)); | |
35 | + ut_assert(fdt_begin_node(fdt, "") >= 0); | |
36 | + ut_assertok(fdt_end_node(fdt)); | |
37 | + ut_assertok(fdt_finish(fdt)); | |
38 | + | |
39 | + return 0; | |
40 | +} | |
41 | + | |
42 | +/* Test 'fdt addr' getting/setting address */ | |
43 | +static int fdt_test_addr(struct unit_test_state *uts) | |
44 | +{ | |
45 | + const void *fdt_blob, *new_fdt; | |
46 | + char fdt[256]; | |
47 | + ulong addr; | |
48 | + int ret; | |
49 | + | |
50 | + ut_assertok(console_record_reset_enable()); | |
51 | + ut_assertok(run_command("fdt addr -c", 0)); | |
52 | + ut_assert_nextline("Control fdt: %08lx", | |
53 | + (ulong)map_to_sysmem(gd->fdt_blob)); | |
54 | + ut_assertok(ut_check_console_end(uts)); | |
55 | + | |
56 | + /* The working fdt is not set, so this should fail */ | |
57 | + set_working_fdt_addr(0); | |
58 | + ut_asserteq(CMD_RET_FAILURE, run_command("fdt addr", 0)); | |
59 | + ut_assert_nextline("libfdt fdt_check_header(): FDT_ERR_BADMAGIC"); | |
60 | + ut_assertok(ut_check_console_end(uts)); | |
61 | + | |
62 | + /* Set up a working FDT and try again */ | |
63 | + ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt))); | |
64 | + addr = map_to_sysmem(fdt); | |
65 | + set_working_fdt_addr(addr); | |
66 | + ut_assertok(run_command("fdt addr", 0)); | |
67 | + ut_assert_nextline("Working fdt: %08lx", (ulong)map_to_sysmem(fdt)); | |
68 | + ut_assertok(ut_check_console_end(uts)); | |
69 | + | |
70 | + /* Set the working FDT */ | |
71 | + set_working_fdt_addr(0); | |
72 | + ut_assertok(run_commandf("fdt addr %08x", addr)); | |
73 | + ut_asserteq(addr, map_to_sysmem(working_fdt)); | |
74 | + ut_assertok(ut_check_console_end(uts)); | |
75 | + set_working_fdt_addr(0); | |
76 | + | |
77 | + /* Set the working FDT */ | |
78 | + fdt_blob = gd->fdt_blob; | |
79 | + gd->fdt_blob = NULL; | |
80 | + ret = run_commandf("fdt addr -c %08x", addr); | |
81 | + new_fdt = gd->fdt_blob; | |
82 | + gd->fdt_blob = fdt_blob; | |
83 | + ut_assertok(ret); | |
84 | + ut_asserteq(addr, map_to_sysmem(new_fdt)); | |
85 | + ut_assertok(ut_check_console_end(uts)); | |
86 | + | |
87 | + /* Test setting an invalid FDT */ | |
88 | + fdt[0] = 123; | |
89 | + ut_asserteq(1, run_commandf("fdt addr %08x", addr)); | |
90 | + ut_assert_nextline("libfdt fdt_check_header(): FDT_ERR_BADMAGIC"); | |
91 | + ut_assertok(ut_check_console_end(uts)); | |
92 | + | |
93 | + /* Test detecting an invalid FDT */ | |
94 | + fdt[0] = 123; | |
95 | + set_working_fdt_addr(addr); | |
96 | + ut_asserteq(1, run_commandf("fdt addr")); | |
97 | + ut_assert_nextline("libfdt fdt_check_header(): FDT_ERR_BADMAGIC"); | |
98 | + ut_assertok(ut_check_console_end(uts)); | |
99 | + | |
100 | + return 0; | |
101 | +} | |
102 | +FDT_TEST(fdt_test_addr, UT_TESTF_CONSOLE_REC); | |
103 | + | |
104 | +/* Test 'fdt addr' resizing an fdt */ | |
105 | +static int fdt_test_resize(struct unit_test_state *uts) | |
106 | +{ | |
107 | + char fdt[256]; | |
108 | + const int newsize = sizeof(fdt) / 2; | |
109 | + ulong addr; | |
110 | + | |
111 | + ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt))); | |
112 | + addr = map_to_sysmem(fdt); | |
113 | + set_working_fdt_addr(addr); | |
114 | + | |
115 | + /* Test setting and resizing the working FDT to a larger size */ | |
116 | + ut_assertok(console_record_reset_enable()); | |
117 | + ut_assertok(run_commandf("fdt addr %08x %x", addr, newsize)); | |
118 | + ut_assertok(ut_check_console_end(uts)); | |
119 | + | |
120 | + /* Try shrinking it */ | |
121 | + ut_assertok(run_commandf("fdt addr %08x %x", addr, sizeof(fdt) / 4)); | |
122 | + ut_assert_nextline("New length %d < existing length %d, ignoring", | |
123 | + (int)sizeof(fdt) / 4, newsize); | |
124 | + ut_assertok(ut_check_console_end(uts)); | |
125 | + | |
126 | + /* ...quietly */ | |
127 | + ut_assertok(run_commandf("fdt addr -q %08x %x", addr, sizeof(fdt) / 4)); | |
128 | + ut_assertok(ut_check_console_end(uts)); | |
129 | + | |
130 | + /* We cannot easily provoke errors in fdt_open_into(), so ignore that */ | |
131 | + | |
132 | + return 0; | |
133 | +} | |
134 | +FDT_TEST(fdt_test_resize, UT_TESTF_CONSOLE_REC); | |
135 | + | |
136 | +int do_ut_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) | |
137 | +{ | |
138 | + struct unit_test *tests = UNIT_TEST_SUITE_START(fdt_test); | |
139 | + const int n_ents = UNIT_TEST_SUITE_COUNT(fdt_test); | |
140 | + | |
141 | + return cmd_ut_category("fdt", "fdt_test_", tests, n_ents, argc, argv); | |
142 | +} |
@@ -39,6 +39,9 @@ static struct cmd_tbl cmd_ut_sub[] = { | ||
39 | 39 | #if defined(CONFIG_UT_ENV) |
40 | 40 | U_BOOT_CMD_MKENT(env, CONFIG_SYS_MAXARGS, 1, do_ut_env, "", ""), |
41 | 41 | #endif |
42 | +#ifdef CONFIG_CMD_FDT | |
43 | + U_BOOT_CMD_MKENT(fdt, CONFIG_SYS_MAXARGS, 1, do_ut_fdt, "", ""), | |
44 | +#endif | |
42 | 45 | #ifdef CONFIG_UT_OPTEE |
43 | 46 | U_BOOT_CMD_MKENT(optee, CONFIG_SYS_MAXARGS, 1, do_ut_optee, "", ""), |
44 | 47 | #endif |
@@ -131,6 +134,9 @@ static char ut_help_text[] = | ||
131 | 134 | #ifdef CONFIG_UT_ENV |
132 | 135 | "ut env [test-name]\n" |
133 | 136 | #endif |
137 | +#ifdef CONFIG_CMD_FDT | |
138 | + "ut fdt [test-name] - test of the fdt command\n" | |
139 | +#endif | |
134 | 140 | #ifdef CONFIG_UT_LIB |
135 | 141 | "ut lib [test-name] - test library functions\n" |
136 | 142 | #endif |
@@ -277,7 +277,7 @@ int do_log_test_helpers(struct unit_test_state *uts) | ||
277 | 277 | log_content("level %d\n", LOGL_DEBUG_CONTENT); |
278 | 278 | log_io("level %d\n", LOGL_DEBUG_IO); |
279 | 279 | |
280 | - for (i = LOGL_EMERG; i <= _LOG_MAX_LEVEL; i++) | |
280 | + for (i = LOGL_EMERG; i <= gd->default_log_level; i++) | |
281 | 281 | ut_assert_nextline("%*s() level %d", CONFIG_LOGF_FUNC_PAD, |
282 | 282 | __func__, i); |
283 | 283 | ut_assert_console_end(); |
@@ -381,7 +381,8 @@ int log_test_level_deny(struct unit_test_state *uts) | ||
381 | 381 | ut_assertok(console_record_reset_enable()); |
382 | 382 | log_run(); |
383 | 383 | check_log_entries_flags_levels(EXPECT_LOG | EXPECT_DIRECT | EXPECT_FORCE, |
384 | - LOGL_WARNING + 1, _LOG_MAX_LEVEL); | |
384 | + LOGL_WARNING + 1, | |
385 | + min(gd->default_log_level, LOGL_INFO)); | |
385 | 386 | |
386 | 387 | ut_assertok(log_remove_filter("console", filt1)); |
387 | 388 | ut_assertok(log_remove_filter("console", filt2)); |
@@ -420,9 +421,11 @@ int log_test_dropped(struct unit_test_state *uts) | ||
420 | 421 | gd->log_drop_count = 0; |
421 | 422 | |
422 | 423 | ut_assertok(console_record_reset_enable()); |
423 | - log_run(); | |
424 | 424 | |
425 | - ut_asserteq(gd->log_drop_count, 3 * (LOGL_COUNT - LOGL_FIRST - 1)); | |
425 | + log_run(); | |
426 | + ut_asserteq(2 * (LOGL_COUNT - LOGL_FIRST) + | |
427 | + _LOG_MAX_LEVEL - LOGL_FIRST + 1, | |
428 | + gd->log_drop_count); | |
426 | 429 | check_log_entries_flags_levels(EXPECT_DEBUG, LOGL_FIRST, CONFIG_LOG_DEFAULT_LEVEL); |
427 | 430 | |
428 | 431 | gd->flags |= GD_FLG_LOG_READY; |
@@ -658,6 +658,7 @@ class Entry_fit(Entry_section): | ||
658 | 658 | # Build a new tree with all nodes and properties starting from the |
659 | 659 | # entry node |
660 | 660 | fsw = libfdt.FdtSw() |
661 | + fsw.INC_SIZE = 65536 | |
661 | 662 | fsw.finish_reservemap() |
662 | 663 | to_remove = [] |
663 | 664 | loadables = [] |
@@ -186,7 +186,7 @@ def check_patch_parse(checkpatch_output, verbose=False): | ||
186 | 186 | return result |
187 | 187 | |
188 | 188 | |
189 | -def check_patch(fname, verbose=False, show_types=False): | |
189 | +def check_patch(fname, verbose=False, show_types=False, use_tree=False): | |
190 | 190 | """Run checkpatch.pl on a file and parse the results. |
191 | 191 | |
192 | 192 | Args: |
@@ -194,6 +194,7 @@ def check_patch(fname, verbose=False, show_types=False): | ||
194 | 194 | verbose: True to print out every line of the checkpatch output as it is |
195 | 195 | parsed |
196 | 196 | show_types: Tell checkpatch to show the type (number) of each message |
197 | + use_tree (bool): If False we'll pass '--no-tree' to checkpatch. | |
197 | 198 | |
198 | 199 | Returns: |
199 | 200 | namedtuple containing: |
@@ -210,7 +211,9 @@ def check_patch(fname, verbose=False, show_types=False): | ||
210 | 211 | stdout: Full output of checkpatch |
211 | 212 | """ |
212 | 213 | chk = find_check_patch() |
213 | - args = [chk, '--no-tree'] | |
214 | + args = [chk] | |
215 | + if not use_tree: | |
216 | + args.append('--no-tree') | |
214 | 217 | if show_types: |
215 | 218 | args.append('--show-types') |
216 | 219 | output = command.output(*args, fname, raise_on_error=False) |
@@ -236,13 +239,13 @@ def get_warning_msg(col, msg_type, fname, line, msg): | ||
236 | 239 | line_str = '' if line is None else '%d' % line |
237 | 240 | return '%s:%s: %s: %s\n' % (fname, line_str, msg_type, msg) |
238 | 241 | |
239 | -def check_patches(verbose, args): | |
242 | +def check_patches(verbose, args, use_tree): | |
240 | 243 | '''Run the checkpatch.pl script on each patch''' |
241 | 244 | error_count, warning_count, check_count = 0, 0, 0 |
242 | 245 | col = terminal.Color() |
243 | 246 | |
244 | 247 | for fname in args: |
245 | - result = check_patch(fname, verbose) | |
248 | + result = check_patch(fname, verbose, use_tree=use_tree) | |
246 | 249 | if not result.ok: |
247 | 250 | error_count += result.errors |
248 | 251 | warning_count += result.warnings |
@@ -64,7 +64,7 @@ def prepare_patches(col, branch, count, start, end, ignore_binary, signoff): | ||
64 | 64 | patchstream.insert_cover_letter(cover_fname, series, to_do) |
65 | 65 | return series, cover_fname, patch_files |
66 | 66 | |
67 | -def check_patches(series, patch_files, run_checkpatch, verbose): | |
67 | +def check_patches(series, patch_files, run_checkpatch, verbose, use_tree): | |
68 | 68 | """Run some checks on a set of patches |
69 | 69 | |
70 | 70 | 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): | ||
77 | 77 | run_checkpatch (bool): True to run checkpatch.pl |
78 | 78 | verbose (bool): True to print out every line of the checkpatch output as |
79 | 79 | it is parsed |
80 | + use_tree (bool): If False we'll pass '--no-tree' to checkpatch. | |
80 | 81 | |
81 | 82 | Returns: |
82 | 83 | 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): | ||
86 | 87 | |
87 | 88 | # Check the patches, and run them through 'git am' just to be sure |
88 | 89 | if run_checkpatch: |
89 | - ok = checkpatch.check_patches(verbose, patch_files) | |
90 | + ok = checkpatch.check_patches(verbose, patch_files, use_tree) | |
90 | 91 | else: |
91 | 92 | ok = True |
92 | 93 | return ok |
@@ -165,7 +166,7 @@ def send(args): | ||
165 | 166 | col, args.branch, args.count, args.start, args.end, |
166 | 167 | args.ignore_binary, args.add_signoff) |
167 | 168 | ok = check_patches(series, patch_files, args.check_patch, |
168 | - args.verbose) | |
169 | + args.verbose, args.check_patch_use_tree) | |
169 | 170 | |
170 | 171 | ok = ok and gitutil.check_suppress_cc_config() |
171 | 172 |
@@ -81,6 +81,12 @@ send.add_argument('--no-binary', action='store_true', dest='ignore_binary', | ||
81 | 81 | send.add_argument('--no-check', action='store_false', dest='check_patch', |
82 | 82 | default=True, |
83 | 83 | help="Don't check for patch compliance") |
84 | +send.add_argument('--tree', dest='check_patch_use_tree', default=False, | |
85 | + action='store_true', | |
86 | + help=("Set `tree` to True. If `tree` is False then we'll " | |
87 | + "pass '--no-tree' to checkpatch (default: tree=%(default)s)")) | |
88 | +send.add_argument('--no-tree', dest='check_patch_use_tree', | |
89 | + action='store_false', help="Set `tree` to False") | |
84 | 90 | send.add_argument('--no-tags', action='store_false', dest='process_tags', |
85 | 91 | default=True, help="Don't process subject tags as aliases") |
86 | 92 | send.add_argument('--no-signoff', action='store_false', dest='add_signoff', |
@@ -23,6 +23,7 @@ _default_settings = { | ||
23 | 23 | "u-boot": {}, |
24 | 24 | "linux": { |
25 | 25 | "process_tags": "False", |
26 | + "check_patch_use_tree": "True", | |
26 | 27 | }, |
27 | 28 | "gcc": { |
28 | 29 | "process_tags": "False", |
@@ -71,7 +72,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser): | ||
71 | 72 | >>> config = _ProjectConfigParser("linux") |
72 | 73 | >>> config.readfp(StringIO(sample_config)) |
73 | 74 | >>> sorted((str(a), str(b)) for (a, b) in config.items("settings")) |
74 | - [('am_hero', 'True'), ('process_tags', 'False')] | |
75 | + [('am_hero', 'True'), ('check_patch_use_tree', 'True'), ('process_tags', 'False')] | |
75 | 76 | |
76 | 77 | # Check to make sure that settings works with unknown project. |
77 | 78 | >>> config = _ProjectConfigParser("unknown") |