summaryrefslogtreecommitdiffstats
path: root/common/console.c
Commit message (Collapse)AuthorAgeFilesLines
* console: Fix pre-console flushing via cfb_console being very slowHans de Goede2015-05-191-18/+22
| | | | | | | | | | | | | | | | | | | | | | | | | 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 <hdegoede@redhat.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* Export redesignMartin Dorwig2015-01-291-10/+10
| | | | | | | | | | | | | | | | | | | | | 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 <dorwig@tetronik.com> Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> (resending to the list since my tweaks are not quite trivial)
* console: Use pre-console buffer to get complete log on all consolesSiarhei Siamashka2015-01-141-5/+41
| | | | | | | | | | | | | | | | | | | 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 <siarhei.siamashka@gmail.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Tom Rini <trini@ti.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Fix console functions for U-Boot APISimon Glass2014-12-081-4/+4
| | | | | | | | | | | | | | | | | | | | | 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 <dorwig@tektronik.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* common:console: add missing includeJeroen Hofstee2014-10-251-1/+2
| | | | | | | search_device is declared in iomux, but console only had the definition. This prevents a warning. Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
* sandbox: Disable Ctrl-CSimon Glass2014-09-241-0/+3
| | | | | | | | 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 <sjg@chromium.org>
* Add a flag indicating when the serial console is readySimon Glass2014-07-231-2/+2
| | | | | | | | | | 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 <sjg@chromium.org>
* console: Remove vprintf() optimisation for sandboxSimon Glass2014-07-231-1/+1
| | | | | | | | | | | | If the console is not present, we try to reduce overhead by stopping any output in vprintf(), before it gets to putc(). This is of dubious merit in general, but in the case of sandbox it is incorrect since we have a fallback console which reports errors very early in U-Boot. If this is defeated U-Boot can hang or exit with no indication of what is wrong. Remove the optimisation for sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
* stdio: Pass device pointer to stdio methodsSimon Glass2014-07-231-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | At present stdio device functions do not get any clue as to which stdio device is being acted on. Some implementations go to great lengths to work around this, such as defining a whole separate set of functions for each possible device. For driver model we need to associate a stdio_dev with a device. It doesn't seem possible to continue with this work-around approach. Instead, add a stdio_dev pointer to each of the stdio member functions. Note: The serial drivers have the same problem, but it is not strictly necessary to fix that to get driver model running. Also, if we convert serial over to driver model the problem will go away. Code size increases by 244 bytes for Thumb2 and 428 for PowerPC. 22: stdio: Pass device pointer to stdio methods arm: (for 2/2 boards) all +244.0 bss -4.0 text +248.0 powerpc: (for 1/1 boards) all +428.0 text +428.0 Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Marek Vasut <marex@denx.de> Reviewed-by: Marek Vasut <marex@denx.de>
* Add the function 'confirm_yesno' for interactivePierre Aubert2014-05-231-1/+27
| | | | | | | | User's confirmation is asked in different commands. This commit adds a function for such confirmation. Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com> Signed-off-by: Pierre Aubert <p.aubert@staubli.com>
* sandbox: Allow the console to work earlierSimon Glass2014-01-081-1/+15
| | | | | | | | | | | | | With sandbox, errors and problems may be reported before console_init_f() is executed. For example, an argument may not parse correctly or U-Boot may panic(). At present this output is swallowed so there is no indication what is going wrong. Adjust the console to deal with a very early sandbox setup, by detecting that there is no global_data yet, and calling os functions in that case. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-241-17/+1
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* env: Add a silent env handlerJoe Hershberger2012-12-131-0/+23
| | | | | | | | The silent variable now updates the global data flag anytime it is changed as well as after the env relocation (in case its value is different from the default env in such cases as NAND env) Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Add a console env handlerJoe Hershberger2012-12-131-0/+44
| | | | | | Remove the hard-coded console handler and use a callback instead Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Refactor do_apply to a flagJoe Hershberger2012-12-131-4/+4
| | | | | | | | | | Use a flag in hsearch_r for insert mode passed from import to allow the behavior be different based on use. Now that "do_check" is called for all imports, ensure console init is complete before updating the console on relocation import Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* console: Enable function to display console infoSimon Glass2012-12-111-2/+4
| | | | | | | | | | | The CONFIG_SYS_CONSOLE_INFO_QUIET option should suppress the console information, but allow boards to display it later if required. Adjust the code to support this. This is used to avoid printing the information while the LCD display is not ready, since it only becomes ready when stdio init is complete. Signed-off-by: Simon Glass <sjg@chromium.org>
* Revert "Add board_pre_console_putc to deal with early console output"Simon Glass2012-03-231-9/+1
| | | | | | | | | | | This reverts commit 295d3942b806552503243f5cfb36aec6f1b5a9bf. It turns that this really doesn't work very nicely. Instead we should have a pre-console panic function so that we know that further execution is impossible and we don't need to worry about trampling on UARTs, etc. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Wolfgang Denk <wd@denx.de>
* Make printf and vprintf safe from buffer overrunsSonny Rao2011-12-171-5/+5
| | | | | | | | | | From: Sonny Rao <sonnyrao@chromium.org> utilize the added vscnprintf functions to avoid buffer overruns The implementation is fairly dumb in that it doesn't detect that the buffer is too small, but at least will not cause crashes. Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
* Add board_pre_console_putc to deal with early console outputSimon Glass2011-12-091-1/+9
| | | | | | | | | | | | | | | | This patch adds support for console output before the console is inited. The main purpose of this is to deal with a very early panic() which would otherwise cause a silent hang. A new board_pre_console_putc() function is added to the board API. If provided by the board it will be called in the event of console output before the console is ready. This function should turn on all UARTs and spray the character out if it possibly can. The feature is controlled by a new CONFIG_PRE_CONSOLE_PUTC option. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Graeme Russ <graeme.russ@gmail.com>
* console: Implement pre-console bufferGraeme Russ2011-10-051-2/+41
| | | | | | | | | | | | | Allow redirection of console output prior to console initialisation to a temporary buffer. To enable this functionality, the board (or arch) must define: - CONFIG_PRE_CONSOLE_BUFFER - Enable pre-console buffer - CONFIG_PRE_CON_BUF_ADDR - Base address of pre-console buffer - CONFIG_PRE_CON_BUF_SZ - Size of pre-console buffer (in bytes) The pre-console buffer will buffer the last CONFIG_PRE_CON_BUF_SZ bytes Any earlier characters are silently dropped.
* console: Squelch pre-console output in console functionsGraeme Russ2011-10-011-0/+18
| | | | | | | | | | There are some locations in the code which anticipate printf() being called before the console is ready by squelching printf() on gd->have_console. Move this squelching into printf(), vprintf(), puts() and putc(). Also make tstc() and getc() return 0 if console is not yet initialised Signed-off-by: Graeme Russ <graeme.russ@gmail.com> Tested-by: Simon Glass <sjg@chromium.org>
* stdio: constify "name" arg in public apiMike Frysinger2010-11-281-2/+2
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Make *printf() return "int" instead of "void"Wolfgang Denk2010-07-041-4/+8
| | | | | | | | | | Change the return type of the *printf() functions to the standard "int"; no changes are needed but returning the already available length count. This will save a few additional strlen() calls later... Signed-off-by: Wolfgang Denk <wd@denx.de>
* Remove AmigaOneG3SE boardWolfgang Denk2010-06-231-4/+0
| | | | | | | | | | The AmigaOneG3SE board has been orphaned or a very long time, and broken for more than 12 releases resp. more than 3 years. As nobody seems to be interested any more in this stuff we may as well ged rid of it, especially as it clutters many areas of the code so it is a continuous pain for all kinds of ongoing work. Signed-off-by: Wolfgang Denk <wd@denx.de>
* console.c: fix problem with splashimageAnatolij Gustschin2010-03-211-3/+7
| | | | | | | | | | | | | | | | | | If a board uses cfb_console driver and splash image and also defines CONFIG_SILENT_CONSOLE, the user is locked out even if "silent" is not set. It is not possible to get any output, neither on vga console device nor on serial console after redirecting the output to the serial console, since the GD_FLG_SILENT flag remains set. Fix the problem by redirecting the output from frame buffer to serial console if splashimage is used. Only suppress the output if "silent" environment variable was set and don't set the GD_FLG_SILENT flag arbitrarily. Signed-off-by: Anatolij Gustschin <agust@denx.de>
* bugfix CONFIG_SYS_CONSOLE_INFO_QUIETDavid Brownell2009-08-301-1/+1
| | | | | | | | | The "console: unify printing current devices" patch goofed: CONFIG_SYS_CONSOLE_INFO_QUIET is supposed to *REMOVE* boot time noise, not add it. Said patch changed the #ifndefs to #ifdef; this one restores them to the proper sense. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* console: unify printing current devicesJean-Christophe PLAGNIOL-VILLARD2009-07-191-46/+29
| | | | | | Create stdio_print_current_devices() for this purpose Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* stdio/device: rework function naming conventionJean-Christophe PLAGNIOL-VILLARD2009-07-181-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far the console API uses the following naming convention: ======Extract====== typedef struct device_t; int device_register (device_t * dev); int devices_init (void); int device_deregister(char *devname); struct list_head* device_get_list(void); device_t* device_get_by_name(char* name); device_t* device_clone(device_t *dev); ======= which is too generic and confusing. Instead of using device_XX and device_t we change this into stdio_XX and stdio_dev This will also allow to add later a generic device mechanism in order to have support for multiple devices and driver instances. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Edited commit message. Signed-off-by: Wolfgang Denk <wd@denx.de>
* common/console: avoid ifdef CONFIG_CONSOLE_MUX when it's possibleJean-Christophe PLAGNIOL-VILLARD2009-02-181-52/+56
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* common/console: coding style cleanupJean-Christophe PLAGNIOL-VILLARD2009-02-181-98/+101
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* IOMUX: Add console multiplexing support.Gary Jennejohn2008-12-071-1/+155
| | | | | | | | | | | | | | | | | | | | | | | | Modifications to support console multiplexing. This is controlled using CONFIG_SYS_CONSOLE_MUX in the board configuration file. This allows a user to specify multiple console devices in the environment with a command like this: setenv stdin serial,nc. As a result, the user can enter text on both the serial and netconsole interfaces. All devices - stdin, stdout and stderr - can be set in this manner. 1) common/iomux.c and include/iomux.h contain the environment setting implementation. 2) doc/README.iomux contains a somewhat more detailed description. 3) The implementation in (1) is called from common/cmd_nvedit.c to handle setenv and from common/console.c to handle initialization of input/output devices at boot time. 4) common/console.c also contains the code needed to poll multiple console devices for input and send output to all devices registered for output. 5) include/common.h includes iomux.h and common/Makefile generates iomux.o when CONFIG_SYS_CONSOLE_MUX is set. Signed-off-by: Gary Jennejohn <garyj@denx.de>
* rename CFG_ macros to CONFIG_SYSJean-Christophe PLAGNIOL-VILLARD2008-10-181-20/+20
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Allow console input to be disabledMark Jackson2008-09-061-0/+20
| | | | | | | | | Added new CONFIG_DISABLE_CONSOLE define and GD_FLG_DISABLE_CONSOLE. When CONFIG_DISABLE_CONSOLE is defined, setting GD_FLG_DISABLE_CONSOLE disables all console input and output. Signed-off-by: Mark Jackson <mpfj@mimc.co.uk>
* devices: merge to list_headJean-Christophe PLAGNIOL-VILLARD2008-08-311-37/+25
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* Big white-space cleanup.Wolfgang Denk2008-05-211-1/+1
| | | | | | | | | | | This commit gets rid of a huge amount of silly white-space issues. Especially, all sequences of SPACEs followed by TAB characters get removed (unless they appear in print statements). Also remove all embedded "vim:" and "vi:" statements which hide indentation problems. Signed-off-by: Wolfgang Denk <wd@denx.de>
* [PATCH] simplify silent consoleLadislav Michl2007-05-051-7/+1
| | | | | Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Stefan Roese <sr@denx.de>
* GCC-4.x fixes: clean up global data pointer initialization for all boards.Wolfgang Denk2006-03-311-16/+2
|
* * Patch by Detlev Zundel, 31 Mar 2005:wdenk2005-03-311-5/+3
| | | | | | | Cleanup duplicate definition of overwrite_console() * Update TQM5200 configuration; prepare for Rev. 200 starter kit boards
* * Cleanup, minor fixeswdenk2004-04-181-1/+4
| | | | | | | | | * Patch by Rune Torgersen, 16 Apr 2004: LBA48 fixes * Patches by Pantelis Antoniou, 16 Apr 2004: - Fix some compile problems; add "once" functionality for the netretry variable
* * Patches by Thomas Viehweger, 16 Mar 2004:wdenk2004-03-231-12/+12
| | | | | | | | | - show PCI clock frequency on MPC8260 systems - add FCC_PSMR_RMII flag for HiP7 processors - in do_jffs2_fsload(), take load address from load_addr if not set explicit, update load_addr otherwise - replaced printf by putc/puts when no formatting is needed (smaller code size, faster execution)
* Patch by Anders Larsen, 09 Jan 2004:wdenk2004-02-081-1/+1
| | | | | | | | | | ARM memory layout fixes: the abort-stack is now set up in the correct RAM area, and the BSS is zeroed out as it should be. Furthermore, the magic variables 'armboot_end' and 'armboot_end_data' of the linker scripts are replaced by '__bss_start' and '_end', resp., which is a further step to eliminate unnecessary differences between the implementation of the CPU architectures.
* * Patch by Wolter Kamphuis, 15 Dec 2003:wdenk2004-02-061-0/+10
| | | | | | made CONFIG_SILENT_CONSOLE usable on all architectures * Disable date command on TQM866M - there is no RTC on MPC866
* * Patches by Xianghua Xiao, 15 Oct 2003:wdenk2003-10-151-1/+1
| | | | | | | | - Added Motorola CPU 8540/8560 support (cpu/85xx) - Added Motorola MPC8540ADS board support (board/mpc8540ads) - Added Motorola MPC8560ADS board support (board/mpc8560ads) * Minor code cleanup
* Added config option CONFIG_SILENT_CONSOLE. See doc/README.silentwdenk2003-10-101-1/+13
| | | | for more information
* Suppress all output with splashscreen configured only if "splashimage"dzu2003-09-291-2/+4
| | | | is set
* * Patches by Anders Larsen, 17 Sep 2003:wdenk2003-09-181-0/+6
| | | | | | | | | | - fix spelling errors - set GD_FLG_DEVINIT flag only after device function pointers are valid - Allow CFG_ALT_MEMTEST on systems where address zero isn't writeable - enable 3.rd UART (ST-UART) on PXA(XScale) CPUs - trigger watchdog while waiting in serial driver
* * Implement new mechanism to export U-Boot's functions to standalonewdenk2003-07-241-13/+13
| | | | | | | | applications: instead of using (PPC-specific) system calls we now use a jump table; please see doc/README.standalone for details * Patch by Dave Westwood, 24 Jul 2003: added support for Unity OS (a proprietary OS)
* Patches by Murray Jensen, 17 Jun 2003:wdenk2003-06-191-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Hymod board database mods: add "who" field and new xilinx chip types - provide new "init_cmd_timeout()" function so code external to "common/main.c" can use the "reset_cmd_timeout()" function before entering the main loop - add DTT support for adm1021 (new file dtt/adm1021.c; config slightly different. see include/configs/hymod.h for an example (requires CONFIG_DTT_ADM1021, CONFIG_DTT_SENSORS, and CFG_DTT_ADM1021 defined) - add new "eeprom_probe()" function which has similar args and behaves in a similar way to "eeprom_read()" etc. - add 8260 FCC ethernet loopback code (new "eth_loopback_test()" function which is enabled by defining CONFIG_ETHER_LOOPBACK_TEST) - gdbtools copyright update - ensure that set_msr() executes the "sync" and "isync" instructions after the "mtmsr" instruction in cpu/mpc8260/interrupts.c - 8260 I/O ports fix: Open Drain should be set last when configuring - add SIU IRQ defines for 8260 - allow LDSCRIPT override and OBJCFLAGS initialization: change to config.mk to allow board configurations to override the GNU linker script, selected via the LDSCRIPT, make variable, and to give an initial value to the OBJCFLAGS make variable - 8260 i2c enhancement: o correctly extends the timeout depending on the size of all queued messages for both transmit and receive o will not continue with receive if transmit times out o ensures that the error callback is done for all queued tx and rx messages o correctly detects both tx and rx timeouts, only delivers one to the callback, and does not overwrite an earlier error o logic in i2c_probe now correct - add "vprintf()" function so that "panic()" function can be technically correct - many Hymod board changes
* * Make sure Block Lock Bits get cleared in R360MPI flash driverwdenk2003-04-201-2/+7
| | | | | | | | | | | | | | * MPC823 LCD driver: Fill color map backwards, to allow for steady display when Linux takes over * Patch by Erwin Rol, 27 Feb 2003: Add support for RTEMS (this time for real). * Add support for "bmp info" and "bmp display" commands to load bitmap images; this can be used (for example in a "preboot" command) to display a splash screen very quickly after poweron. * Add support for 133 MHz clock on INCA-IP board
* * Patches by Robert Schwebel, 06 Mar 2003:wdenk2003-03-061-1/+1
| | | | | | | | | | | - fix bug in BOOTP code (must use NetCopyIP) - update of CSB226 port - clear BSS segment on XScale - added support for i2c_init_board() function - update to the Innokom plattform * Extend support for redundand environments for configurations where environment size < sector size
OpenPOWER on IntegriCloud