public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v3 0/6] console: Implement flush() function
@ 2022-09-05  9:31 Pali Rohár
  2022-09-05  9:31 ` [PATCH v3 1/6] sandbox: Add function os_flush() Pali Rohár
                   ` (6 more replies)
  0 siblings, 7 replies; 34+ messages in thread
From: Pali Rohár @ 2022-09-05  9:31 UTC (permalink / raw)
  To: Simon Glass; +Cc: u-boot

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


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

end of thread, other threads:[~2022-09-24 18:00 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-05  9:31 [PATCH v3 0/6] console: Implement flush() function Pali Rohár
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox