Skip to content

console: Implement flush() function

Pali Rohár u-boot 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest6 patches 27 repliesIn review
  2. v26 patches 20 repliesSuperseded
  3. v11 patch 1 replySuperseded

Changes in v3 from the cover letter

* add macro STDIO_DEV_ASSIGN_FLUSH()
* fix commit messages
* remove changes from serial.c

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6sandbox: Add function os_flush()arch/sandbox/cpu/os.c include/os.h+13 -02 replies
2/6console: Implement flush() functioncommon/Kconfig common/console.c include/_exports.h +2 more+92 -01 reply
3/6serial: Implement flush callbackdrivers/serial/serial-uclass.c+20 -03 replies
4/6serial: Implement serial_flush() function for console flush() fallbackcommon/console.c common/stdio.c drivers/serial/serial-uclass.c +1 more+26 -06 replies
5/6serial: Call flush() before changing baudratecmd/load.c drivers/serial/serial-uclass.c+6 -01 reply
6/6boot: Call flush() before bootingboot/bootm_os.c cmd/boot.c cmd/elf.c+4 -02 replies

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchSimon Glass
1/6R-b
2/6R-b
3/6R-b
4/6R-b
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/6] console: Implement flush() function

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(+)
Signature · 1 line
2.20.1