* [U-Boot] [PATCH 0/2] Silent console fixes
@ 2019-08-02 12:58 Patrice Chotard
2019-08-02 12:58 ` [U-Boot] [PATCH 1/2] console: update silent tag after env load Patrice Chotard
2019-08-02 12:58 ` [U-Boot] [PATCH 2/2] console: execute flush on uart when silent is removed Patrice Chotard
0 siblings, 2 replies; 5+ messages in thread
From: Patrice Chotard @ 2019-08-02 12:58 UTC (permalink / raw)
To: u-boot
This series fixes:
- issue when silent property is updated in saved environment
- issue regarding console flush when silent property is removed from
saved environment
Patrick Delaunay (2):
console: update silent tag after env load
console: execute flush on uart when silent is removed
common/console.c | 47 +++++++++++++++++++++++++++++++++++++++--------
1 file changed, 39 insertions(+), 8 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 1/2] console: update silent tag after env load
2019-08-02 12:58 [U-Boot] [PATCH 0/2] Silent console fixes Patrice Chotard
@ 2019-08-02 12:58 ` Patrice Chotard
2019-08-08 3:16 ` Tom Rini
2019-08-02 12:58 ` [U-Boot] [PATCH 2/2] console: execute flush on uart when silent is removed Patrice Chotard
1 sibling, 1 reply; 5+ messages in thread
From: Patrice Chotard @ 2019-08-02 12:58 UTC (permalink / raw)
To: u-boot
From: Patrick Delaunay <patrick.delaunay@st.com>
Update the "silent" property with the variable "silent" get from
saved environment, it solves the issue when:
- CONFIG_SILENT_CONSOLE and CONFIG_SYS_CONSOLE_IS_IN_ENV are activated
- silent is not defined in default environment
- silent is requested in saved environment with:
> env set silent 1; env save
On next reboot the console is not disabled as expected after relocation
and the environment load from flash (the callback is not called when
the INSERT is requested in the created hash table)
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---
common/console.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/common/console.c b/common/console.c
index 0b0dd76256..7b45403bb3 100644
--- a/common/console.c
+++ b/common/console.c
@@ -793,6 +793,9 @@ int console_init_r(void)
int iomux_err = 0;
#endif
+ /* update silent for env loaded from flash (initr_env) */
+ console_update_silent();
+
/* set default handlers at first */
gd->jt->getc = serial_getc;
gd->jt->tstc = serial_tstc;
@@ -884,6 +887,7 @@ int console_init_r(void)
struct list_head *pos;
struct stdio_dev *dev;
+ /* update silent for env loaded from flash (initr_env) */
console_update_silent();
#ifdef CONFIG_SPLASH_SCREEN
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 2/2] console: execute flush on uart when silent is removed
2019-08-02 12:58 [U-Boot] [PATCH 0/2] Silent console fixes Patrice Chotard
2019-08-02 12:58 ` [U-Boot] [PATCH 1/2] console: update silent tag after env load Patrice Chotard
@ 2019-08-02 12:58 ` Patrice Chotard
2019-08-08 3:16 ` Tom Rini
1 sibling, 1 reply; 5+ messages in thread
From: Patrice Chotard @ 2019-08-02 12:58 UTC (permalink / raw)
To: u-boot
From: Patrick Delaunay <patrick.delaunay@st.com>
Avoid to flush buffer when silent console is activated as the
console can be reactivate later, after relocation, when the env will
be updated with the saved one.
Solve issue (missing beginning of U-Boot trace) when:
- CONFIG_SILENT_CONSOLE is activated
- silent=1 is defined in default environment (CONFIG_EXTRA_ENV_SETTINGS)
- silent is removed in saved environment with:
> env delete silent; env save
Only functional when PRE_CONSOLE_BUFFER is activated.
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---
common/console.c | 45 ++++++++++++++++++++++++++++++++++++---------
1 file changed, 36 insertions(+), 9 deletions(-)
diff --git a/common/console.c b/common/console.c
index 7b45403bb3..d086feabb1 100644
--- a/common/console.c
+++ b/common/console.c
@@ -463,6 +463,11 @@ static void print_pre_console_buffer(int flushpoint)
char buf_out[CONFIG_PRE_CON_BUF_SZ + 1];
char *buf_in;
+#ifdef CONFIG_SILENT_CONSOLE
+ if (gd->flags & GD_FLG_SILENT)
+ return;
+#endif
+
buf_in = map_sysmem(CONFIG_PRE_CON_BUF_ADDR, CONFIG_PRE_CON_BUF_SZ);
if (gd->precon_buf_idx > CONFIG_PRE_CON_BUF_SZ)
in = gd->precon_buf_idx - CONFIG_PRE_CON_BUF_SZ;
@@ -511,8 +516,11 @@ void putc(const char c)
membuff_putbyte(&gd->console_out, c);
#endif
#ifdef CONFIG_SILENT_CONSOLE
- if (gd->flags & GD_FLG_SILENT)
+ if (gd->flags & GD_FLG_SILENT) {
+ if (!(gd->flags & GD_FLG_DEVINIT))
+ pre_console_putc(c);
return;
+ }
#endif
#ifdef CONFIG_DISABLE_CONSOLE
@@ -559,8 +567,11 @@ void puts(const char *s)
membuff_put(&gd->console_out, s, strlen(s));
#endif
#ifdef CONFIG_SILENT_CONSOLE
- if (gd->flags & GD_FLG_SILENT)
+ if (gd->flags & GD_FLG_SILENT) {
+ if (!(gd->flags & GD_FLG_DEVINIT))
+ pre_console_puts(s);
return;
+ }
#endif
#ifdef CONFIG_DISABLE_CONSOLE
@@ -720,14 +731,22 @@ int console_assign(int file, const char *devname)
return -1;
}
-static void console_update_silent(void)
+/* return true if the 'silent' flag is removed */
+static bool console_update_silent(void)
{
#ifdef CONFIG_SILENT_CONSOLE
- if (env_get("silent") != NULL)
+ if (env_get("silent")) {
gd->flags |= GD_FLG_SILENT;
- else
+ } else {
+ unsigned long flags = gd->flags;
+
gd->flags &= ~GD_FLG_SILENT;
+
+ return !!(flags & GD_FLG_SILENT);
+ }
#endif
+
+ return false;
}
int console_announce_r(void)
@@ -792,9 +811,13 @@ int console_init_r(void)
#if CONFIG_IS_ENABLED(CONSOLE_MUX)
int iomux_err = 0;
#endif
+ int flushpoint;
/* update silent for env loaded from flash (initr_env) */
- console_update_silent();
+ if (console_update_silent())
+ flushpoint = PRE_CONSOLE_FLUSHPOINT1_SERIAL;
+ else
+ flushpoint = PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL;
/* set default handlers at first */
gd->jt->getc = serial_getc;
@@ -872,7 +895,7 @@ done:
if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL))
return 0;
#endif
- print_pre_console_buffer(PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL);
+ print_pre_console_buffer(flushpoint);
return 0;
}
@@ -886,9 +909,13 @@ int console_init_r(void)
struct list_head *list = stdio_get_list();
struct list_head *pos;
struct stdio_dev *dev;
+ int flushpoint;
/* update silent for env loaded from flash (initr_env) */
- console_update_silent();
+ if (console_update_silent())
+ flushpoint = PRE_CONSOLE_FLUSHPOINT1_SERIAL;
+ else
+ flushpoint = PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL;
#ifdef CONFIG_SPLASH_SCREEN
/*
@@ -951,7 +978,7 @@ int console_init_r(void)
if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL))
return 0;
#endif
- print_pre_console_buffer(PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL);
+ print_pre_console_buffer(flushpoint);
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 1/2] console: update silent tag after env load
2019-08-02 12:58 ` [U-Boot] [PATCH 1/2] console: update silent tag after env load Patrice Chotard
@ 2019-08-08 3:16 ` Tom Rini
0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2019-08-08 3:16 UTC (permalink / raw)
To: u-boot
On Fri, Aug 02, 2019 at 02:58:09PM +0200, Patrice Chotard wrote:
> From: Patrick Delaunay <patrick.delaunay@st.com>
>
> Update the "silent" property with the variable "silent" get from
> saved environment, it solves the issue when:
> - CONFIG_SILENT_CONSOLE and CONFIG_SYS_CONSOLE_IS_IN_ENV are activated
> - silent is not defined in default environment
> - silent is requested in saved environment with:
> > env set silent 1; env save
>
> On next reboot the console is not disabled as expected after relocation
> and the environment load from flash (the callback is not called when
> the INSERT is requested in the created hash table)
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190807/14a538b2/attachment.sig>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH 2/2] console: execute flush on uart when silent is removed
2019-08-02 12:58 ` [U-Boot] [PATCH 2/2] console: execute flush on uart when silent is removed Patrice Chotard
@ 2019-08-08 3:16 ` Tom Rini
0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2019-08-08 3:16 UTC (permalink / raw)
To: u-boot
On Fri, Aug 02, 2019 at 02:58:10PM +0200, Patrice Chotard wrote:
> From: Patrick Delaunay <patrick.delaunay@st.com>
>
> Avoid to flush buffer when silent console is activated as the
> console can be reactivate later, after relocation, when the env will
> be updated with the saved one.
>
> Solve issue (missing beginning of U-Boot trace) when:
> - CONFIG_SILENT_CONSOLE is activated
> - silent=1 is defined in default environment (CONFIG_EXTRA_ENV_SETTINGS)
> - silent is removed in saved environment with:
> > env delete silent; env save
>
> Only functional when PRE_CONSOLE_BUFFER is activated.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190807/0c084b7c/attachment.sig>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-08-08 3:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02 12:58 [U-Boot] [PATCH 0/2] Silent console fixes Patrice Chotard
2019-08-02 12:58 ` [U-Boot] [PATCH 1/2] console: update silent tag after env load Patrice Chotard
2019-08-08 3:16 ` Tom Rini
2019-08-02 12:58 ` [U-Boot] [PATCH 2/2] console: execute flush on uart when silent is removed Patrice Chotard
2019-08-08 3:16 ` 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.