13 Feb, 2020

1 commit

  • Avoid errors of like

    common/console.c: In function ‘console_record_reset’:
    common/console.c:615:16: error: passing argument 1 of ‘membuff_purge’
    discards ‘volatile’ qualifier from pointer target type
    [-Werror=discarded-qualifiers]
    615 | membuff_purge(&gd->console_out);
    | ^~~~~~~~~~~~~~~~

    by casting to non-volatile.

    The volatile property stems from declarations like

    arch/arm/include/asm/global_data.h:114:

    But there is no need to treat gd->console_out and gd->console_in as
    volatile in the context of common/console.c.

    Fixes: b612312816ff ("console: Add a function to read a line of the output / eof")
    Signed-off-by: Heinrich Schuchardt
    Reviewed-by: Simon Glass

    Heinrich Schuchardt
     

06 Feb, 2020

1 commit

  • When recording the console output for testing it is useful to be able to
    read the output a line at a time to check that the output is correct. Also
    we need to check that we get to the end of the output.

    Add a console function to return the next line and another to see how must
    data is left.

    Signed-off-by: Simon Glass

    Simon Glass
     

07 Nov, 2019

1 commit


12 Aug, 2019

2 commits

  • This file contains lots of internal details about the environment. Most
    code can include env.h instead, calling the functions there as needed.

    Rename this file and add a comment at the top to indicate its internal
    nature.

    Signed-off-by: Simon Glass
    Acked-by: Joe Hershberger
    Reviewed-by: Simon Goldschmidt
    [trini: Fixup apalis-tk1.c]
    Signed-off-by: Tom Rini

    Simon Glass
     
  • Move env_set() over to the new header file.

    Acked-by: Joe Hershberger
    Signed-off-by: Simon Glass

    Simon Glass
     

08 Aug, 2019

2 commits

  • 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
    Signed-off-by: Patrice Chotard

    Patrick Delaunay
     
  • 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
    Signed-off-by: Patrice Chotard

    Patrick Delaunay
     

26 Nov, 2018

1 commit

  • We support putc() in this case but not puts(), but this is more useful
    since it is what printf() uses.

    This particularly affects debugging early in SPL, where currently printf()
    statements result in no output. Fix this by adding a special case into
    puts() for sandbox, just like putc().

    Signed-off-by: Simon Glass
    Reviewed-by: Joe Hershberger

    Simon Glass
     

11 Sep, 2018

1 commit

  • Unify the fgetc function when MUX is activated or not:
    - always call tstc() : it is the normal behavior expected
    by serial uclass (call tstc then getc) and that avoids
    issue when SERIAL_RX_BUFFER is activated
    - reload WATCHDOG in the char waiting loop

    This patch allow to have the same behavior when CONSOLE_MUX is activated
    or not and avoid regression when this feature is deactivated.

    Signed-off-by: Patrick Delaunay
    Reviewed-by: Simon Glass

    Patrick Delaunay
     

27 Jul, 2018

2 commits


19 Jun, 2018

1 commit

  • Both putc() and puts() can be called before global_data is set up. Some of
    the code paths don't handle this correctly. Add an explicit test before
    any member is accessed.

    Reported-by: Coverity (CID: 169030)
    Signed-off-by: Simon Glass
    Reviewed-by: Heinrich Schuchardt

    Simon Glass
     

07 May, 2018

2 commits

  • When U-Boot started using SPDX tags we were among the early adopters and
    there weren't a lot of other examples to borrow from. So we picked the
    area of the file that usually had a full license text and replaced it
    with an appropriate SPDX-License-Identifier: entry. Since then, the
    Linux Kernel has adopted SPDX tags and they place it as the very first
    line in a file (except where shebangs are used, then it's second line)
    and with slightly different comment styles than us.

    In part due to community overlap, in part due to better tag visibility
    and in part for other minor reasons, switch over to that style.

    This commit changes all instances where we have a single declared
    license in the tag as both the before and after are identical in tag
    contents. There's also a few places where I found we did not have a tag
    and have introduced one.

    Signed-off-by: Tom Rini

    Tom Rini
     
  • With tighter build flags the fact that doesn't have a
    reference back to MAX_NAMES causes an error. Include here and
    then in common/console.c use MAX_NAMES rather than 3 when working with
    stdio_names.

    Reported-by: Peter Robinson
    Signed-off-by: Tom Rini
    Tested-by: Peter Robinson

    Tom Rini
     

08 Dec, 2017

1 commit

  • While sandbox works OK without the special-case code, it does result in
    console output being stored in the pre-console buffer while sandbox starts
    up. If there is a crash or a problem then there is no indication of what
    is going on.

    For ease of debugging it seems better to revert this change also.

    This reverts commit d8c6fb8cedbc35eee27730a7fa544e499b3c81cc.

    Signed-off-by: Simon Glass

    Simon Glass
     

13 Nov, 2017

1 commit

  • This reverts commit c61d0009feb966e0e93254a8c435a1889085e6b8.

    A tbs2910 board user reported a very slow console frambuffer as
    regression in current u-boot. I could bisect this down to the
    above mentioned commit.

    This revert brings back the fast framebuffer console (one
    cache flush per string in puts(), not after each char).

    Reported-by: Uwe Scheffler
    Signed-off-by: Soeren Moch
    Tested-by: Uwe Scheffler
    Reviewed-by: Simon Glass

    Soeren Moch
     

28 Aug, 2017

1 commit

  • The silent environment callback function does not update the silent
    flag during silent env set or unset. That is because of duplicated
    CONFIG keyword at preprocessor condition in silent environment
    callback function and cause silent env callback unable to work.

    This patch is to remove the duplicated CONFIG keywork in silent
    environment callback function.

    Signed-off-by: Wilson Lee
    Cc: Keng Soon Cheah
    Cc: Chen Yee Chew
    Cc: Joe Hershberger

    Wilson Lee
     

16 Aug, 2017

2 commits

  • We are now using an env_ prefix for environment functions. Rename these
    two functions for consistency. Also add function comments in common.h.

    Quite a few places use getenv() in a condition context, provoking a
    warning from checkpatch. These are fixed up in this patch also.

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     
  • We are now using an env_ prefix for environment functions. Rename setenv()
    for consistency. Also add function comments in common.h.

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     

01 Aug, 2017

2 commits


29 Jul, 2017

1 commit


12 Jul, 2017

3 commits

  • At present sandbox has a special case where it directly calls os_putc()
    when it does not have a console yet.

    Now that we have the pre-console buffer enabled we can drop this. Any
    early characters will be buffered and output later.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Tested-by: Stephen Warren

    Simon Glass
     
  • At present this feature casts the address to a pointer. Use the
    map_sysmem() function so that it will work correctly on sandbox.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Tested-by: Bin Meng
    Tested-by: Stephen Warren

    Simon Glass
     
  • At present the U-Boot banner is only displayed on the serial console. If
    this is not visible to the user, the banner does not show. Some devices
    have a video display which can usefully display this information.

    Add a banner which is printed after relocation only on non-serial devices
    if CONFIG_DISPLAY_BOARDINFO_LATE is defined.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Tested-by: Bin Meng
    Tested-by: Stephen Warren

    Simon Glass
     

06 Feb, 2017

1 commit


24 Oct, 2016

2 commits


18 Oct, 2016

1 commit

  • Hardware: CM-FX6 Module from Compulab

    This patch fixes unwanted watchdog resets while the user enters
    a command at the U-Boot prompt.

    As found on the CM-FX6 board from Compulab, when having enabled the
    watchdog, a missing WATCHDOG_RESET call in common/console.c causes
    this and alike boards to reset when the watchdog's timeout has
    elapsed while waiting at the U-Boot prompt.

    Despite the user could press several keys within the watchdog
    timeout limit, the while loop in cli_readline.c, line 261, does only
    call WATCHDOG_RESET if first == 1, which gets set to 0 in the 1st
    loop iteration. This leads to a watchdog timeout no matter if the
    user presses keys or not.

    Although, this affects other boards as well as it touches
    common/console.c, the macro WATCHDOG_RESET expands to {} if watchdog
    support isn't configured. Hence, there's no harm caused and no need to
    surround it by #ifdef in this case.

    * Symptom:
    U-Boot resets after watchdog times out when in commandline prompt
    and watchdog is enabled.

    * Reasoning:
    When U-Boot shows the commandline prompt, the following function
    call stack is executed while waiting for a keypress:

    common/main.c:
    main_loop => common/cli.c: cli_loop() =>
    common/cli_hush.c:
    parse_file_outer => parse_stream_outer =>
    parse_stream => b_getch(i) =>
    i->get(i) => file_get =>
    get_user_input => cmdedit_read_input =>
    uboot_cli_readline =>
    common/cli_readline.c:
    cli_readline => cli_readline_into_buffer =>
    cread_line => getcmd_getch (== getc) =>
    common/console.c:
    fgetc => console_tstc

    common/console.c:
    (with CONFIG_CONSOLE_MUX is set)

    - in console_tstc line 181:
    If dev->tstc(dev) returns 0, the global tstcdev variable doesn't get
    set. This is the case if no character is in the serial buffer.

    - in fgetc(int file), line 297:
    Program flow keeps looping because tstcdev does not get set.
    Therefore WATCHDOG_RESET is not called, as mx_serial_tstc from
    drivers/serial/serial_mxc.c does not call it.

    * Solution:
    Add WATCHDOG_RESET into the loop of console_tstc.

    Note: Macro expands to {} if not configured, so no #ifdef is needed.

    * Comment:

    Signed-off-by: Christian Storm
    Signed-off-by: Jan Kiszka
    Signed-off-by: Andreas J. Reichel
    Acked-by: Simon Glass

    Andreas J. Reichel
     

07 Oct, 2016

1 commit

  • When CONFIG_SILENT_CONSOLE is defined and the default environment has
    silent=1 it is not possible for a user to make the console un-silent if
    the environment is not available when console_init_f() is called (for
    example because the environment is in SPI).

    Add a new helper function console_update_silent() and call it from both
    console_init_f() and console_init_r().

    Signed-off-by: Chris Packham
    Reviewed-by: Simon Glass

    Chris Packham
     

27 Mar, 2016

1 commit


12 Feb, 2016

1 commit

  • Boards with a saved environment may use 'lcd' in their stdout environment
    variable, expecting that this will enable output to the LCD. When the board
    moves to use driver model for video, this will no-longer work. Add a
    work-around to fix this. A warning messages is printed, and we will remove
    the work-around at the end of 2016.

    Signed-off-by: Simon Glass
    Acked-by: Anatolij Gustschin
    Tested-by: Stephen Warren

    Simon Glass
     

25 Jan, 2016

1 commit


23 Nov, 2015

3 commits

  • This patch adds a small printf() version that supports all basic formats.
    Its intented to be used in U-Boot SPL versions on platforms with very
    limited internal RAM sizes.

    To enable it, just define CONFIG_USE_TINY_PRINTF in your defconfig. This
    will result in the SPL using this tiny function and the main U-Boot
    still using the full-blown printf() function.

    This code was copied from:
    http://www.sparetimelabs.com/printfrevisited
    With mostly only coding style related changes so that its checkpatch
    clean.

    The size reduction is about 2.5KiB. Here a comparison for the db-mv784mp-gp
    (Marvell AXP) SPL:

    Without this patch:
    58963 18536 1928 79427 13643 ./spl/u-boot-spl

    With this patch:
    56542 18536 1956 77034 12cea ./spl/u-boot-spl

    Note:
    To make it possible to compile tiny-printf.c instead of vsprintf.c when
    CONFIG_USE_TINY_PRINTF is defined, the functions printf() and vprintf() are
    moved from common/console.c into vsprintf.c in this patch.

    Signed-off-by: Stefan Roese
    Cc: Simon Glass
    Cc: Hans de Goede
    Cc: Tom Rini
    Cc: Albert Aribaud

    Stefan Roese
     
  • Change some comments to match the U-Boot coding style rules.

    Signed-off-by: Stefan Roese
    Cc: Simon Glass
    Acked-by: Simon Glass

    Stefan Roese
     
  • As done in commit da229e4e [sandbox: Drop special-case sandbox console code],
    this patch drops the sandbox special-case code in vprintf() that was
    missed by Simon at that time.

    Signed-off-by: Stefan Roese
    Cc: Simon Glass
    Acked-by: Simon Glass

    Stefan Roese
     

20 Nov, 2015

2 commits

  • It is useful to be able to record console output and provide console input
    via a buffer. This provides sandbox with the ability to run a command and
    check its output. If the console is set to silent then no visible output
    is generated.

    This also provides a means to fix the problem where tests produce unwanted
    output, such as errors or warnings. This can be confusing. We can instead
    set the console to silent and record this output. It can be checked later
    in the test if required.

    It is possible that this may prove useful for non-test situations. For
    example the console output may be suppressed for normal operations, but
    recorded and stored for access by the OS. That feature is not implemented
    at present.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • The console includes a global variable and several functions that are only
    used by a small subset of U-Boot files. Before adding more functions, move
    the definitions into their own header file.

    Signed-off-by: Simon Glass

    Simon Glass
     

22 Jul, 2015

2 commits