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

Pali Rohár pali at kernel.org
Wed Sep 21 15:54:13 CEST 2022


On Wednesday 21 September 2022 09:49:24 Tom Rini wrote:
> On Mon, Sep 05, 2022 at 11:31:15AM +0200, Pali Rohár wrote:
> 
> > 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
> 
> Including the change you suggested to 4/6 to fix that build issue,
> there's at least one more large issue that prevents CI from getting too
> far:
> https://source.denx.de/u-boot/u-boot/-/pipelines/13534
> and they all have a failure similar to:
> https://source.denx.de/u-boot/u-boot/-/jobs/500794#L51

It looks like that some efi stuff overloads u-boot functions, in this
case newly added flush() function.

Any idea how to handle this issue?

The only option which I see how to address it is to revert those changes
in source files which always calls flush() function and replace them by
my first attempt which use guard #ifdef to ensure that flush() call is
completely eliminated at preprocessor stage when efi is enabled.

> Please see
> https://u-boot.readthedocs.io/en/latest/develop/ci_testing.html for how
> to run CI on the world yourself before submitting v4. Thanks!


More information about the U-Boot mailing list