Commit d6330064634aa698c0a686002ceeb19b3de0d71f
Committed by
Tom Rini
1 parent
2d424eb0cd
Exists in
smarc_8mq_lf_v2020.04
and in
12 other branches
spl: Add a define for SPL_TPL_PROMPT
We should use a macro rather than hard-coding the SPL prompt to 'spl' since the code can be used by TPL too. Add a macro that works for both and use it in various places. This allows TPL to use the same code without printing confusing messages. Note that the string is lower case ('spl', 'tpl') which is a change from previously. Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Simon Glass <sjg@chromium.org>
Showing 3 changed files with 29 additions and 13 deletions Side-by-side Diff
common/spl/spl.c
... | ... | @@ -58,8 +58,9 @@ |
58 | 58 | #ifdef CONFIG_SPL_OS_BOOT |
59 | 59 | __weak int spl_start_uboot(void) |
60 | 60 | { |
61 | - puts("SPL: Please implement spl_start_uboot() for your board\n"); | |
62 | - puts("SPL: Direct Linux boot not active!\n"); | |
61 | + puts(SPL_TPL_PROMPT | |
62 | + "Please implement spl_start_uboot() for your board\n"); | |
63 | + puts(SPL_TPL_PROMPT "Direct Linux boot not active!\n"); | |
63 | 64 | return 1; |
64 | 65 | } |
65 | 66 | |
66 | 67 | |
... | ... | @@ -101,13 +102,13 @@ |
101 | 102 | /* fixup the memory dt node */ |
102 | 103 | err = fdt_shrink_to_minimum(fdt_blob, 0); |
103 | 104 | if (err == 0) { |
104 | - printf("spl: fdt_shrink_to_minimum err - %d\n", err); | |
105 | + printf(SPL_TPL_PROMPT "fdt_shrink_to_minimum err - %d\n", err); | |
105 | 106 | return; |
106 | 107 | } |
107 | 108 | |
108 | 109 | err = arch_fixup_fdt(fdt_blob); |
109 | 110 | if (err) { |
110 | - printf("spl: arch_fixup_fdt err - %d\n", err); | |
111 | + printf(SPL_TPL_PROMPT "arch_fixup_fdt err - %d\n", err); | |
111 | 112 | return; |
112 | 113 | } |
113 | 114 | #endif |
... | ... | @@ -186,7 +187,7 @@ |
186 | 187 | spl_image->os = IH_OS_U_BOOT; |
187 | 188 | spl_image->name = "U-Boot"; |
188 | 189 | |
189 | - debug("spl: payload image: %32s load addr: 0x%lx size: %d\n", | |
190 | + debug(SPL_TPL_PROMPT "payload image: %32s load addr: 0x%lx size: %d\n", | |
190 | 191 | spl_image->name, spl_image->load_addr, spl_image->size); |
191 | 192 | |
192 | 193 | #ifdef CONFIG_SPL_FIT_SIGNATURE |
... | ... | @@ -256,7 +257,8 @@ |
256 | 257 | } |
257 | 258 | spl_image->os = image_get_os(header); |
258 | 259 | spl_image->name = image_get_name(header); |
259 | - debug("spl: payload image: %32s load addr: 0x%lx size: %d\n", | |
260 | + debug(SPL_TPL_PROMPT | |
261 | + "payload image: %32s load addr: 0x%lx size: %d\n", | |
260 | 262 | spl_image->name, spl_image->load_addr, spl_image->size); |
261 | 263 | #else |
262 | 264 | /* LEGACY image not supported */ |
... | ... | @@ -285,7 +287,8 @@ |
285 | 287 | spl_image->load_addr = CONFIG_SYS_LOAD_ADDR; |
286 | 288 | spl_image->entry_point = CONFIG_SYS_LOAD_ADDR; |
287 | 289 | spl_image->size = end - start; |
288 | - debug("spl: payload zImage, load addr: 0x%lx size: %d\n", | |
290 | + debug(SPL_TPL_PROMPT | |
291 | + "payload zImage, load addr: 0x%lx size: %d\n", | |
289 | 292 | spl_image->load_addr, spl_image->size); |
290 | 293 | return 0; |
291 | 294 | } |
... | ... | @@ -469,7 +472,7 @@ |
469 | 472 | if (loader) |
470 | 473 | printf("Trying to boot from %s\n", loader->name); |
471 | 474 | else |
472 | - puts("SPL: Unsupported Boot Device!\n"); | |
475 | + puts(SPL_TPL_PROMPT "Unsupported Boot Device!\n"); | |
473 | 476 | #endif |
474 | 477 | if (loader && !spl_load_image(spl_image, loader)) { |
475 | 478 | spl_image->boot_device = spl_boot_list[i]; |
... | ... | @@ -492,7 +495,7 @@ |
492 | 495 | struct spl_image_info spl_image; |
493 | 496 | int ret; |
494 | 497 | |
495 | - debug(">>spl:board_init_r()\n"); | |
498 | + debug(">>" SPL_TPL_PROMPT "board_init_r()\n"); | |
496 | 499 | |
497 | 500 | spl_set_bd(); |
498 | 501 | |
... | ... | @@ -532,7 +535,7 @@ |
532 | 535 | |
533 | 536 | if (boot_from_devices(&spl_image, spl_boot_list, |
534 | 537 | ARRAY_SIZE(spl_boot_list))) { |
535 | - puts("SPL: failed to boot from all boot devices\n"); | |
538 | + puts(SPL_TPL_PROMPT "failed to boot from all boot devices\n"); | |
536 | 539 | hang(); |
537 | 540 | } |
538 | 541 | |
... | ... | @@ -605,8 +608,8 @@ |
605 | 608 | gd->have_console = 1; |
606 | 609 | |
607 | 610 | #ifndef CONFIG_SPL_DISABLE_BANNER_PRINT |
608 | - puts("\nU-Boot SPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \ | |
609 | - U_BOOT_TIME " " U_BOOT_TZ ")\n"); | |
611 | + puts("\nU-Boot " SPL_TPL_NAME " " PLAIN_VERSION " (" U_BOOT_DATE " - " | |
612 | + U_BOOT_TIME " " U_BOOT_TZ ")\n"); | |
610 | 613 | #endif |
611 | 614 | #ifdef CONFIG_SPL_DISPLAY_PRINT |
612 | 615 | spl_display_print(); |
include/spl.h
... | ... | @@ -48,6 +48,19 @@ |
48 | 48 | return false; |
49 | 49 | } |
50 | 50 | |
51 | +/* A string name for SPL or TPL */ | |
52 | +#ifdef CONFIG_SPL_BUILD | |
53 | +# ifdef CONFIG_TPL_BUILD | |
54 | +# define SPL_TPL_NAME "tpl" | |
55 | +# else | |
56 | +# define SPL_TPL_NAME "spl" | |
57 | +# endif | |
58 | +# define SPL_TPL_PROMPT SPL_TPL_NAME ": " | |
59 | +#else | |
60 | +# define SPL_TPL_NAME "" | |
61 | +# define SPL_TPL_PROMPT "" | |
62 | +#endif | |
63 | + | |
51 | 64 | struct spl_image_info { |
52 | 65 | const char *name; |
53 | 66 | u8 os; |
test/py/u_boot_console_base.py
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | import u_boot_spawn |
17 | 17 | |
18 | 18 | # Regexes for text we expect U-Boot to send to the console. |
19 | -pattern_u_boot_spl_signon = re.compile('(U-Boot SPL \d{4}\.\d{2}[^\r\n]*\))') | |
19 | +pattern_u_boot_spl_signon = re.compile('(U-Boot spl \d{4}\.\d{2}[^\r\n]*\))') | |
20 | 20 | pattern_u_boot_main_signon = re.compile('(U-Boot \\d{4}\\.\\d{2}[^\r\n]*\\))') |
21 | 21 | pattern_stop_autoboot_prompt = re.compile('Hit any key to stop autoboot: ') |
22 | 22 | pattern_unknown_command = re.compile('Unknown command \'.*\' - try \'help\'') |
-
mentioned in commit 8fb239
-
mentioned in commit 8fb239
-
mentioned in commit 8fb239
-
mentioned in commit 8fb239
-
mentioned in commit 8fb239
-
mentioned in commit 8fb239
-
mentioned in commit 8fb239
-
mentioned in commit 8fb239
-
mentioned in commit 8fb239
-
mentioned in commit 8fb239
-
mentioned in commit 8fb239
-
mentioned in commit 8fb239
-
mentioned in commit 8fb239
-
mentioned in commit 8fb239
-
mentioned in commit 8fb239