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


20 May, 2015

1 commit

  • On my A10 OlinuxIno Lime I noticed a huge (5+ seconds) delay coming from
    console_init_r. This turns out to be caused by the preconsole buffer flushing
    to the cfb_console. The Lime only has a 16 bit memory bus and that is already
    heavy used to scan out the 1920x1080 framebuffer.

    The problem is that print_pre_console_buffer() was printing the buffer once
    character at a time and the cfb_console code then ends up doing a cache-flush
    for touched display lines for each character.

    This commit fixes this by first building a 0 terminated buffer and then
    printing it in one puts() call, avoiding unnecessary cache flushes.

    This changes the time for the flush from 5+ seconds to not noticable.

    The downside of this approach is that the pre-console buffer needs to fit
    on the stack, this is not that much to ask since we are talking about plain
    text here. This commit also adjusts the sunxi CONFIG_PRE_CON_BUF_SZ to
    actually fit on the stack. Sunxi currently is the only user of the pre-console
    code so no other boards need to be adjusted.

    Signed-off-by: Hans de Goede
    Reviewed-by: Tom Rini

    Hans de Goede
     

30 Jan, 2015

1 commit

  • this is an atempt to make the export of functions typesafe.
    I replaced the jumptable void ** by a struct (jt_funcs) with function pointers.
    The EXPORT_FUNC macro now has 3 fixed parameters and one
    variadic parameter
    The first is the name of the exported function,
    the rest of the parameters are used to format a functionpointer
    in the jumptable,

    the EXPORT_FUNC macros are expanded three times,
    1. to declare the members of the struct
    2. to initialize the structmember pointers
    3. to call the functions in stubs.c

    Signed-off-by: Martin Dorwig
    Acked-by: Simon Glass

    Signed-off-by: Simon Glass
    (resending to the list since my tweaks are not quite trivial)

    Martin Dorwig
     

14 Jan, 2015

1 commit

  • Currently the pre-console buffer can accumulate early log messages
    and flush them to the serial console as soon as it becomes available.

    This patch just adds one more pre-console buffer flushing point and
    does all the same for the other consoles too. This is particularly
    useful for the vga/hdmi/lcd console, where we can see all the older
    messages now (except for the log messages from SPL).

    Naturally, we don't want to get an extra copy of the log messages
    on the serial console again at the second flushing point, so the
    serial console has to be explicitly filtered out.

    Signed-off-by: Siarhei Siamashka
    Acked-by: Hans de Goede
    Acked-by: Tom Rini
    Signed-off-by: Hans de Goede

    Siarhei Siamashka
     

08 Dec, 2014

1 commit

  • Commit 709ea54 made a subtle change to the way the U-Boot API jump table
    is set up. So at present putc(), getc(), tstc() and puts() do not work
    correctly from functions that use the U-Boot API.

    Previously these were set to the stdio functions, but these now take a
    parameter specifying which stdio device to use. Instead, we should change
    them to use the global functions which do not have a parameter.

    This is a slight change in behaviour. The functions will now output to
    all selected stdio devices - for example putc() will output a character to
    all devices selected by stdout. However in most cases there is only one,
    and it isn't necessarily incorrect behaviour anyway.

    The API version is not changed since it is compatible with what was there
    before.

    Reported-by: Martin Dorwig
    Signed-off-by: Simon Glass

    Simon Glass
     

25 Oct, 2014

1 commit


25 Sep, 2014

1 commit

  • This is not supported properly on sandbox, and interferes with running
    tests, since when a test script is piped in, some commands will call
    ctrlc() which will drop characters from the test script.

    Signed-off-by: Simon Glass

    Simon Glass
     

23 Jul, 2014

1 commit

  • For sandbox we have a fallback console which is used very early in
    U-Boot, before serial drivers are available. Rather than try to guess
    when to switch to the real console, add a flag so we can be sure. This
    makes sure that sandbox can always output a panic() message, for example,
    and avoids silent failure (which is very annoying in sandbox).

    Signed-off-by: Simon Glass

    Simon Glass