U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 08/21] spl: Add a define for SPL_TPL_PROMPT
Date: Thu, 15 Nov 2018 18:43:56 -0700	[thread overview]
Message-ID: <20181116014409.147279-9-sjg@chromium.org> (raw)
In-Reply-To: <20181116014409.147279-1-sjg@chromium.org>

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>
---

Changes in v3: None
Changes in v2: None

 common/spl/spl.c               | 27 +++++++++++++++------------
 include/spl.h                  | 13 +++++++++++++
 test/py/u_boot_console_base.py |  2 +-
 3 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index eea92ec1f8c..23be33c5c10 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -58,8 +58,9 @@ __weak void show_boot_progress(int val) {}
 #ifdef CONFIG_SPL_OS_BOOT
 __weak int spl_start_uboot(void)
 {
-	puts("SPL: Please implement spl_start_uboot() for your board\n");
-	puts("SPL: Direct Linux boot not active!\n");
+	puts(SPL_TPL_PROMPT
+	     "Please implement spl_start_uboot() for your board\n");
+	puts(SPL_TPL_PROMPT "Direct Linux boot not active!\n");
 	return 1;
 }
 
@@ -101,13 +102,13 @@ void spl_fixup_fdt(void)
 	/* fixup the memory dt node */
 	err = fdt_shrink_to_minimum(fdt_blob, 0);
 	if (err == 0) {
-		printf("spl: fdt_shrink_to_minimum err - %d\n", err);
+		printf(SPL_TPL_PROMPT "fdt_shrink_to_minimum err - %d\n", err);
 		return;
 	}
 
 	err = arch_fixup_fdt(fdt_blob);
 	if (err) {
-		printf("spl: arch_fixup_fdt err - %d\n", err);
+		printf(SPL_TPL_PROMPT "arch_fixup_fdt err - %d\n", err);
 		return;
 	}
 #endif
@@ -186,7 +187,7 @@ static int spl_load_fit_image(struct spl_image_info *spl_image,
 	spl_image->os = IH_OS_U_BOOT;
 	spl_image->name = "U-Boot";
 
-	debug("spl: payload image: %32s load addr: 0x%lx size: %d\n",
+	debug(SPL_TPL_PROMPT "payload image: %32s load addr: 0x%lx size: %d\n",
 	      spl_image->name, spl_image->load_addr, spl_image->size);
 
 #ifdef CONFIG_SPL_FIT_SIGNATURE
@@ -256,7 +257,8 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 		}
 		spl_image->os = image_get_os(header);
 		spl_image->name = image_get_name(header);
-		debug("spl: payload image: %32s load addr: 0x%lx size: %d\n",
+		debug(SPL_TPL_PROMPT
+		      "payload image: %32s load addr: 0x%lx size: %d\n",
 		      spl_image->name, spl_image->load_addr, spl_image->size);
 #else
 		/* LEGACY image not supported */
@@ -285,7 +287,8 @@ int spl_parse_image_header(struct spl_image_info *spl_image,
 			spl_image->load_addr = CONFIG_SYS_LOAD_ADDR;
 			spl_image->entry_point = CONFIG_SYS_LOAD_ADDR;
 			spl_image->size = end - start;
-			debug("spl: payload zImage, load addr: 0x%lx size: %d\n",
+			debug(SPL_TPL_PROMPT
+			      "payload zImage, load addr: 0x%lx size: %d\n",
 			      spl_image->load_addr, spl_image->size);
 			return 0;
 		}
@@ -469,7 +472,7 @@ static int boot_from_devices(struct spl_image_info *spl_image,
 		if (loader)
 			printf("Trying to boot from %s\n", loader->name);
 		else
-			puts("SPL: Unsupported Boot Device!\n");
+			puts(SPL_TPL_PROMPT "Unsupported Boot Device!\n");
 #endif
 		if (loader && !spl_load_image(spl_image, loader)) {
 			spl_image->boot_device = spl_boot_list[i];
@@ -492,7 +495,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	struct spl_image_info spl_image;
 	int ret;
 
-	debug(">>spl:board_init_r()\n");
+	debug(">>" SPL_TPL_PROMPT "board_init_r()\n");
 
 	spl_set_bd();
 
@@ -532,7 +535,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 
 	if (boot_from_devices(&spl_image, spl_boot_list,
 			      ARRAY_SIZE(spl_boot_list))) {
-		puts("SPL: failed to boot from all boot devices\n");
+		puts(SPL_TPL_PROMPT "failed to boot from all boot devices\n");
 		hang();
 	}
 
@@ -605,8 +608,8 @@ void preloader_console_init(void)
 	gd->have_console = 1;
 
 #ifndef CONFIG_SPL_DISABLE_BANNER_PRINT
-	puts("\nU-Boot SPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \
-			U_BOOT_TIME " " U_BOOT_TZ ")\n");
+	puts("\nU-Boot " SPL_TPL_NAME " " PLAIN_VERSION " (" U_BOOT_DATE " - "
+	     U_BOOT_TIME " " U_BOOT_TZ ")\n");
 #endif
 #ifdef CONFIG_SPL_DISPLAY_PRINT
 	spl_display_print();
diff --git a/include/spl.h b/include/spl.h
index a56032ae3eb..205aaff4b9d 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -48,6 +48,19 @@ static inline bool u_boot_first_phase(void)
 	return false;
 }
 
+/* A string name for SPL or TPL */
+#ifdef CONFIG_SPL_BUILD
+# ifdef CONFIG_TPL_BUILD
+#  define SPL_TPL_NAME	"tpl"
+# else
+#  define SPL_TPL_NAME	"spl"
+# endif
+# define SPL_TPL_PROMPT	SPL_TPL_NAME ": "
+#else
+# define SPL_TPL_NAME	""
+# define SPL_TPL_PROMPT	""
+#endif
+
 struct spl_image_info {
 	const char *name;
 	u8 os;
diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
index 326b2ac51fb..e044eb3ea1d 100644
--- a/test/py/u_boot_console_base.py
+++ b/test/py/u_boot_console_base.py
@@ -16,7 +16,7 @@ import sys
 import u_boot_spawn
 
 # Regexes for text we expect U-Boot to send to the console.
-pattern_u_boot_spl_signon = re.compile('(U-Boot SPL \\d{4}\\.\\d{2}[^\r\n]*\\))')
+pattern_u_boot_spl_signon = re.compile('(U-Boot spl \\d{4}\\.\\d{2}[^\r\n]*\\))')
 pattern_u_boot_main_signon = re.compile('(U-Boot \\d{4}\\.\\d{2}[^\r\n]*\\))')
 pattern_stop_autoboot_prompt = re.compile('Hit any key to stop autoboot: ')
 pattern_unknown_command = re.compile('Unknown command \'.*\' - try \'help\'')
-- 
2.19.1.1215.g8438c0b245-goog

  parent reply	other threads:[~2018-11-16  1:43 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-16  1:43 [U-Boot] [PATCH v3 00/21] spl: Add features for passing info from SPL to U-Boot proper Simon Glass
2018-11-16  1:43 ` [U-Boot] [PATCH v3 01/21] spl: Add support for logging in SPL and TPL Simon Glass
2018-11-26 18:43   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-11-16  1:43 ` [U-Boot] [PATCH v3 02/21] Add core support for a bloblist to convey data from SPL Simon Glass
2018-11-26 18:43   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-11-16  1:43 ` [U-Boot] [PATCH v3 03/21] spl: Set up the bloblist in SPL Simon Glass
2018-11-26 18:43   ` [U-Boot] [U-Boot,v3,03/21] " Tom Rini
2018-11-16  1:43 ` [U-Boot] [PATCH v3 04/21] bloblist: Locate bloblist in U-Boot Simon Glass
2018-11-26 18:43   ` [U-Boot] [U-Boot,v3,04/21] " Tom Rini
2018-11-16  1:43 ` [U-Boot] [PATCH v3 05/21] test: Add a simple test for bloblist Simon Glass
2018-11-26 18:43   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-11-16  1:43 ` [U-Boot] [PATCH v3 06/21] Add bloblist documentation Simon Glass
2018-11-26 18:43   ` [U-Boot] [U-Boot,v3,06/21] " Tom Rini
2018-11-16  1:43 ` [U-Boot] [PATCH v3 07/21] spl: Support hash, input, pch, pci, rtc, tpm in SPL Simon Glass
2018-11-26 18:43   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-11-16  1:43 ` Simon Glass [this message]
2018-11-26 18:44   ` [U-Boot] [U-Boot, v3, 08/21] spl: Add a define for SPL_TPL_PROMPT Tom Rini
2018-11-16  1:43 ` [U-Boot] [PATCH v3 09/21] spl: Make SPL_DISABLE_BANNER_PRINT a positive option Simon Glass
2018-11-26 18:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-11-16  1:43 ` [U-Boot] [PATCH v3 10/21] spl: Add a comment to spl_set_bd() Simon Glass
2018-11-26 18:44   ` [U-Boot] [U-Boot,v3,10/21] " Tom Rini
2018-11-16  1:43 ` [U-Boot] [PATCH v3 11/21] sandbox: Add a memory map to the sandbox README Simon Glass
2018-11-26 18:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-11-16  1:44 ` [U-Boot] [PATCH v3 12/21] test/py: Add a way to pass flags to sandbox Simon Glass
2018-11-26 18:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-11-16  1:44 ` [U-Boot] [PATCH v3 13/21] sandbox: Add an option to display of-platdata in SPL Simon Glass
2018-11-26 18:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-11-16  1:44 ` [U-Boot] [PATCH v3 14/21] sandbox: Drop the deprecated 'sb' command Simon Glass
2018-11-26 18:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-11-16  1:44 ` [U-Boot] [PATCH v3 15/21] sandbox: Add a new " Simon Glass
2018-11-26 18:44   ` [U-Boot] [U-Boot,v3,15/21] " Tom Rini
2018-11-16  1:44 ` [U-Boot] [PATCH v3 16/21] sandbox: Allow puts() output before global_data is set up Simon Glass
2018-11-26 18:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-11-16  1:44 ` [U-Boot] [PATCH v3 17/21] sandbox: Refactor code to create os_jump_to_file() Simon Glass
2018-11-26 18:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-11-16  1:44 ` [U-Boot] [PATCH v3 18/21] sandbox: Use malloc() and free() from os layer Simon Glass
2018-11-26 18:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-11-16  1:44 ` [U-Boot] [PATCH v3 19/21] sandbox: Filter arguments when starting U-Boot Simon Glass
2018-11-26 18:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-11-16  1:44 ` [U-Boot] [PATCH v3 20/21] sandbox: Boot in U-Boot through the standard call Simon Glass
2018-11-26 18:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-11-16  1:44 ` [U-Boot] [PATCH v3 21/21] spl: Add support for passing handoff info to U-Boot proper Simon Glass
2018-11-26 18:44   ` [U-Boot] [U-Boot, v3, " Tom Rini
2018-11-27  0:08     ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181116014409.147279-9-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox