From: "Pali Rohár" <pali@kernel.org>
To: Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.denx.de
Subject: [PATCH v3 0/6] console: Implement flush() function
Date: Mon, 5 Sep 2022 11:31:15 +0200 [thread overview]
Message-ID: <20220905093121.11630-1-pali@kernel.org> (raw)
On certain places it is required to flush output print buffers to ensure
that text strings were sent to console or serial devices. For example when
printing message that U-Boot is going to boot kernel or when U-Boot is
going to change baudrate of terminal device.
Some console devices, like UART, have putc/puts functions which just put
characters into HW transmit queue and do not wait until all data are
transmitted. Doing some sensitive operations (like changing baudrate or
starting kernel which resets UART HW) cause that U-Boot messages are lost.
Therefore introduce a new flush() function, implement it for all serial
devices via pending(false) callback and use this new flush() function on
sensitive places after which output device may go into reset state.
This change fixes printing of U-Boot messages:
"## Starting application at ..."
"## Switch baudrate to ..."
Changes in v3:
* add macro STDIO_DEV_ASSIGN_FLUSH()
* fix commit messages
* remove changes from serial.c
Changes in v2:
* split one big patch into smaller 6 patches
* add config option to allow disabling this new function
Pali Rohár (6):
sandbox: Add function os_flush()
console: Implement flush() function
serial: Implement flush callback
serial: Implement serial_flush() function for console flush() fallback
serial: Call flush() before changing baudrate
boot: Call flush() before booting
arch/sandbox/cpu/os.c | 5 +++
boot/bootm_os.c | 1 +
cmd/boot.c | 1 +
cmd/elf.c | 2 ++
cmd/load.c | 5 +++
common/Kconfig | 6 ++++
common/console.c | 64 ++++++++++++++++++++++++++++++++++
common/stdio.c | 8 +++++
drivers/serial/serial-uclass.c | 31 ++++++++++++++++
include/_exports.h | 3 ++
include/os.h | 8 +++++
include/serial.h | 5 +++
include/stdio.h | 15 ++++++++
include/stdio_dev.h | 7 ++++
14 files changed, 161 insertions(+)
--
2.20.1
next reply other threads:[~2022-09-05 9:31 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-05 9:31 Pali Rohár [this message]
2022-09-05 9:31 ` [PATCH v3 1/6] sandbox: Add function os_flush() Pali Rohár
2022-09-07 21:10 ` Simon Glass
2022-09-24 18:00 ` Tom Rini
2022-09-05 9:31 ` [PATCH v3 2/6] console: Implement flush() function Pali Rohár
2022-09-07 21:11 ` Simon Glass
2022-09-05 9:31 ` [PATCH v3 3/6] serial: Implement flush callback Pali Rohár
2022-09-05 17:24 ` Michael Nazzareno Trimarchi
2022-09-05 17:28 ` Pali Rohár
2022-09-07 21:11 ` Simon Glass
2022-09-05 9:31 ` [PATCH v3 4/6] serial: Implement serial_flush() function for console flush() fallback Pali Rohár
2022-09-07 21:10 ` Simon Glass
2022-09-20 21:40 ` Tom Rini
2022-09-20 22:18 ` Pali Rohár
2022-09-20 22:29 ` Tom Rini
2022-09-20 22:32 ` Pali Rohár
2022-09-20 22:46 ` Tom Rini
2022-09-05 9:31 ` [PATCH v3 5/6] serial: Call flush() before changing baudrate Pali Rohár
2022-09-07 21:10 ` Simon Glass
2022-09-05 9:31 ` [PATCH v3 6/6] boot: Call flush() before booting Pali Rohár
2022-09-07 21:10 ` Simon Glass
2022-09-07 21:14 ` Pali Rohár
2022-09-21 13:49 ` [PATCH v3 0/6] console: Implement flush() function Tom Rini
2022-09-21 13:54 ` Pali Rohár
2022-09-21 13:56 ` Tom Rini
2022-09-22 11:27 ` Simon Glass
2022-09-22 13:13 ` Heinrich Schuchardt
2022-09-22 13:14 ` Pali Rohár
2022-09-22 15:06 ` Heinrich Schuchardt
2022-09-23 15:45 ` Pali Rohár
2022-09-23 15:57 ` Tom Rini
2022-09-23 16:07 ` Pali Rohár
2022-09-23 16:19 ` Tom Rini
2022-09-24 14:01 ` 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=20220905093121.11630-1-pali@kernel.org \
--to=pali@kernel.org \
--cc=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