All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tiny-printf: Handle %pM format when CONFIG_SPL_NET_SUPPORT is enabled
@ 2021-08-05 12:42 Matwey V. Kornilov
  2021-08-05 16:22 ` Simon Glass
  0 siblings, 1 reply; 5+ messages in thread
From: Matwey V. Kornilov @ 2021-08-05 12:42 UTC (permalink / raw)
  To: trini, vigneshr; +Cc: u-boot, Matwey V. Kornilov

%pM format string is used to print MAC-address and this is required while SPL
network boot.

This patch fixes the SPL boot issues like the following:

    Trying to boot from USB eth
    ## Error: flags type check failure for "ethaddr" <= "40309614M" (type: m)
    ## Error inserting "ethaddr" variable, errno=1
    eth0: eth_cpsw## Error: flags type check failure for "eth1addr" <=
    "81f01114M" (type: m)
    ## Error inserting "eth1addr" variable, errno=1
    , eth1: usb_ether
    eth_cpsw Waiting for PHY auto negotiation to complete......... TIMEOUT !
    Problem booting with BOOTP
    SPL: failed to boot from all boot devices
    ### ERROR ### Please RESET the board ###

Signed-off-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
---
 lib/tiny-printf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
index 8fc7e48d99..0b2fabf118 100644
--- a/lib/tiny-printf.c
+++ b/lib/tiny-printf.c
@@ -269,7 +269,7 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va)
 				}
 				break;
 			case 'p':
-#ifdef DEBUG
+#if IS_ENABLED(CONFIG_SPL_NET_SUPPORT) || defined(DEBUG)
 				pointer(info, fmt, va_arg(va, void *));
 				/*
 				 * Skip this because it pulls in _ctype which is
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] tiny-printf: Handle %pM format when CONFIG_SPL_NET_SUPPORT is enabled
  2021-08-05 12:42 [PATCH] tiny-printf: Handle %pM format when CONFIG_SPL_NET_SUPPORT is enabled Matwey V. Kornilov
@ 2021-08-05 16:22 ` Simon Glass
  2021-08-05 19:06   ` [PATCH v2] " Matwey V. Kornilov
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Glass @ 2021-08-05 16:22 UTC (permalink / raw)
  To: Matwey V. Kornilov; +Cc: Tom Rini, Vignesh R, U-Boot Mailing List

Hi Matwey,

On Thu, 5 Aug 2021 at 06:43, Matwey V. Kornilov
<matwey.kornilov@gmail.com> wrote:
>
> %pM format string is used to print MAC-address and this is required while SPL
> network boot.
>
> This patch fixes the SPL boot issues like the following:
>
>     Trying to boot from USB eth
>     ## Error: flags type check failure for "ethaddr" <= "40309614M" (type: m)
>     ## Error inserting "ethaddr" variable, errno=1
>     eth0: eth_cpsw## Error: flags type check failure for "eth1addr" <=
>     "81f01114M" (type: m)
>     ## Error inserting "eth1addr" variable, errno=1
>     , eth1: usb_ether
>     eth_cpsw Waiting for PHY auto negotiation to complete......... TIMEOUT !
>     Problem booting with BOOTP
>     SPL: failed to boot from all boot devices
>     ### ERROR ### Please RESET the board ###
>
> Signed-off-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
> ---
>  lib/tiny-printf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
> index 8fc7e48d99..0b2fabf118 100644
> --- a/lib/tiny-printf.c
> +++ b/lib/tiny-printf.c
> @@ -269,7 +269,7 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va)
>                                 }
>                                 break;
>                         case 'p':
> -#ifdef DEBUG
> +#if IS_ENABLED(CONFIG_SPL_NET_SUPPORT) || defined(DEBUG)
>                                 pointer(info, fmt, va_arg(va, void *));
>                                 /*
>                                  * Skip this because it pulls in _ctype which is
> --
> 2.31.1
>

Reviewed-by: Simon Glass <sjg@chromium.org>

But can you try something like:

case 'p':
if (CONFIG_IS_ENABLED(NET_SUPPORT) || _DEBUG) {
   ...
}

instead? Will need to include log-h though. We try to avoid the preprocessor.

Regards,
Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] tiny-printf: Handle %pM format when CONFIG_SPL_NET_SUPPORT is enabled
  2021-08-05 16:22 ` Simon Glass
@ 2021-08-05 19:06   ` Matwey V. Kornilov
  2021-08-05 19:20     ` Simon Glass
  2021-08-22 20:54     ` Tom Rini
  0 siblings, 2 replies; 5+ messages in thread
From: Matwey V. Kornilov @ 2021-08-05 19:06 UTC (permalink / raw)
  To: sjg, trini, vigneshr; +Cc: u-boot, Matwey V. Kornilov

%pM format string is used to print MAC-address and this is required while SPL
network boot.

This patch fixes the SPL boot issues like the following:

    Trying to boot from USB eth
    ## Error: flags type check failure for "ethaddr" <= "40309614M" (type: m)
    ## Error inserting "ethaddr" variable, errno=1
    eth0: eth_cpsw## Error: flags type check failure for "eth1addr" <=
    "81f01114M" (type: m)
    ## Error inserting "eth1addr" variable, errno=1
    , eth1: usb_ether
    eth_cpsw Waiting for PHY auto negotiation to complete......... TIMEOUT !
    Problem booting with BOOTP
    SPL: failed to boot from all boot devices
    ### ERROR ### Please RESET the board ###

Signed-off-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
---
Changes since v1:
 - avoid the preprocessor as suggested by Simon Glass

 lib/tiny-printf.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
index 8fc7e48d99..89aaa85477 100644
--- a/lib/tiny-printf.c
+++ b/lib/tiny-printf.c
@@ -9,8 +9,9 @@
  */
 
 #include <common.h>
-#include <stdarg.h>
+#include <log.h>
 #include <serial.h>
+#include <stdarg.h>
 #include <linux/ctype.h>
 
 struct printf_info {
@@ -269,20 +270,19 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va)
 				}
 				break;
 			case 'p':
-#ifdef DEBUG
-				pointer(info, fmt, va_arg(va, void *));
-				/*
-				 * Skip this because it pulls in _ctype which is
-				 * 256 bytes, and we don't generally implement
-				 * pointer anyway
-				 */
-				while (isalnum(fmt[0]))
-					fmt++;
-				break;
-#else
+				if (CONFIG_IS_ENABLED(NET_SUPPORT) || _DEBUG) {
+					pointer(info, fmt, va_arg(va, void *));
+					/*
+					 * Skip this because it pulls in _ctype which is
+					 * 256 bytes, and we don't generally implement
+					 * pointer anyway
+					 */
+					while (isalnum(fmt[0]))
+						fmt++;
+					break;
+				}
 				islong = true;
 				/* no break */
-#endif
 			case 'x':
 				if (islong) {
 					num = va_arg(va, unsigned long);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] tiny-printf: Handle %pM format when CONFIG_SPL_NET_SUPPORT is enabled
  2021-08-05 19:06   ` [PATCH v2] " Matwey V. Kornilov
@ 2021-08-05 19:20     ` Simon Glass
  2021-08-22 20:54     ` Tom Rini
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Glass @ 2021-08-05 19:20 UTC (permalink / raw)
  To: Matwey V. Kornilov; +Cc: Tom Rini, Vignesh R, U-Boot Mailing List

On Thu, 5 Aug 2021 at 13:06, Matwey V. Kornilov
<matwey.kornilov@gmail.com> wrote:
>
> %pM format string is used to print MAC-address and this is required while SPL
> network boot.
>
> This patch fixes the SPL boot issues like the following:
>
>     Trying to boot from USB eth
>     ## Error: flags type check failure for "ethaddr" <= "40309614M" (type: m)
>     ## Error inserting "ethaddr" variable, errno=1
>     eth0: eth_cpsw## Error: flags type check failure for "eth1addr" <=
>     "81f01114M" (type: m)
>     ## Error inserting "eth1addr" variable, errno=1
>     , eth1: usb_ether
>     eth_cpsw Waiting for PHY auto negotiation to complete......... TIMEOUT !
>     Problem booting with BOOTP
>     SPL: failed to boot from all boot devices
>     ### ERROR ### Please RESET the board ###
>
> Signed-off-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
> ---
> Changes since v1:
>  - avoid the preprocessor as suggested by Simon Glass
>
>  lib/tiny-printf.c | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] tiny-printf: Handle %pM format when CONFIG_SPL_NET_SUPPORT is enabled
  2021-08-05 19:06   ` [PATCH v2] " Matwey V. Kornilov
  2021-08-05 19:20     ` Simon Glass
@ 2021-08-22 20:54     ` Tom Rini
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Rini @ 2021-08-22 20:54 UTC (permalink / raw)
  To: Matwey V. Kornilov; +Cc: sjg, vigneshr, u-boot

[-- Attachment #1: Type: text/plain, Size: 966 bytes --]

On Thu, Aug 05, 2021 at 10:06:05PM +0300, Matwey V. Kornilov wrote:

> %pM format string is used to print MAC-address and this is required while SPL
> network boot.
> 
> This patch fixes the SPL boot issues like the following:
> 
>     Trying to boot from USB eth
>     ## Error: flags type check failure for "ethaddr" <= "40309614M" (type: m)
>     ## Error inserting "ethaddr" variable, errno=1
>     eth0: eth_cpsw## Error: flags type check failure for "eth1addr" <=
>     "81f01114M" (type: m)
>     ## Error inserting "eth1addr" variable, errno=1
>     , eth1: usb_ether
>     eth_cpsw Waiting for PHY auto negotiation to complete......... TIMEOUT !
>     Problem booting with BOOTP
>     SPL: failed to boot from all boot devices
>     ### ERROR ### Please RESET the board ###
> 
> Signed-off-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-22 20:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05 12:42 [PATCH] tiny-printf: Handle %pM format when CONFIG_SPL_NET_SUPPORT is enabled Matwey V. Kornilov
2021-08-05 16:22 ` Simon Glass
2021-08-05 19:06   ` [PATCH v2] " Matwey V. Kornilov
2021-08-05 19:20     ` Simon Glass
2021-08-22 20:54     ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.