All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH 2/3] log: use debug uart to output trace before LOG init
Date: Wed, 11 Nov 2020 07:32:02 -0700	[thread overview]
Message-ID: <CAPnjgZ1WOvuw5E04ncJVSqWSAoCbT4i-1FeW=Ob-3L9+VE2J6w@mail.gmail.com> (raw)
In-Reply-To: <20201106175339.30683-2-patrick.delaunay@st.com>

+Heinrich Schuchardt

On Fri, 6 Nov 2020 at 10:55, Patrick Delaunay <patrick.delaunay@st.com> wrote:
>
> Use the debug uart functions to output the traces before
> the log initialization (when CONFIG_LOG is not activated)
> as it is done in puts/putc function in console.c.
>
> This patch allows to display the first U-Boot traces
> (with macro debug) when CONFIG_DEBUG_UART is activated
> and not only drop them.
>
> For example for traces in board_f.c requested by the macro debug,
> when LOG_DEBUG is defined and CONFIG_LOG is activated.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
>  common/log.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)

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

Again this needs a sandbox test

>
> diff --git a/common/log.c b/common/log.c
> index aadf533fb2..aa5505943f 100644
> --- a/common/log.c
> +++ b/common/log.c
> @@ -7,6 +7,7 @@
>   */
>
>  #include <common.h>
> +#include <debug_uart.h>
>  #include <log.h>
>  #include <malloc.h>
>  #include <dm/uclass.h>
> @@ -245,6 +246,16 @@ int _log(enum log_category_t cat, enum log_level_t level, const char *file,
>
>         if (!(gd->flags & GD_FLG_LOG_READY)) {
>                 gd->log_drop_count++;
> +
> +               /* manage droppped trace at default level with debug uart */

dropped


> +               if (IS_ENABLED(CONFIG_DEBUG_UART) &&
> +                   (rec.level <= CONFIG_LOG_DEFAULT_LEVEL || rec.force_debug)) {
> +                       va_start(args, fmt);
> +                       vsnprintf(buf, sizeof(buf), fmt, args);
> +                       printascii(buf);
> +                       va_end(args);
> +               }
> +
>                 return -ENOSYS;
>         }
>         va_start(args, fmt);
> --
> 2.17.1
>

  reply	other threads:[~2020-11-11 14:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06 17:53 [PATCH 1/3] log: don't build the trace buffer when log is not ready Patrick Delaunay
2020-11-06 17:53 ` [PATCH 2/3] log: use debug uart to output trace before LOG init Patrick Delaunay
2020-11-11 14:32   ` Simon Glass [this message]
2020-11-19 13:42     ` Patrick DELAUNAY
2020-11-06 17:53 ` [PATCH 3/3] log: call vsnprintf only when it is needed to emit trace Patrick Delaunay
2020-11-11 14:32   ` Simon Glass
2020-11-11 14:32 ` [PATCH 1/3] log: don't build the trace buffer when log is not ready 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='CAPnjgZ1WOvuw5E04ncJVSqWSAoCbT4i-1FeW=Ob-3L9+VE2J6w@mail.gmail.com' \
    --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 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.