9
0
Fork 0
Commit Graph

81 Commits

Author SHA1 Message Date
Sascha Hauer 4960dc9db0 rework debug_ll
Convert to static inline functions and use lower case letters for function
names. Also, include mach/debug_ll.h when an architecture provides support
for debug_ll, not only when it's actually enabled. This allows architecures
to put some UART initialization code into mach/debug_ll.h which is compiled
out when debug_ll is disabled.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-05 10:15:48 +02:00
Alexey Galakhov 3d85dae2be Force set console baudrate at enable time
Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-10 23:25:22 +02:00
Alexander Shiyan 4ccf45db0a common: console: Fix possible null pointer dereference
doing a 'cs0.active=' on the command line crashed barebox. Fix this by
not dereferencing val when it's NULL.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-09 08:45:42 +02:00
Sascha Hauer ab855df99f console: Use dev_add_param_int for baudrate parameter
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:35 +02:00
Sascha Hauer c429c68416 console: consolidate common console code
The different console implementations share a good amount of code,
share this in console_common.c.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-13 09:22:33 +01:00
Sascha Hauer 1a9e93cc81 drivers/base: fix corrupt device tree
dev_add_child is a very unsafe function. If called multiple times
it allows setting the same device to different parents thus corrupting
the siblings list. This happens regularly since:

| commit c2e568d19c
| Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
| Date:   Sat Nov 3 16:11:05 2012 +0100
|
|    bus: add bus device
|
|    automatically add it as parent of any bus device if none already specified
|
|    we have now a nice output per bus

If for example a FATfs is mounted this nice output per bus often ends with:

>     `---- fat0
>     `---- 0
>          `---- 0x86f0000087020031-0x86f000410df27124: /dev/<NULL>
>          `---- sram00
>               `---- 0x00000000-0xffffffffffffffff: /dev/<NULL>
>               `---- 0x00000000-0xffffffffffffffff: /dev/<NULL>
>               unable to handle NULL pointer dereference at address 0x0000000c
> pc : [<87f08a20>]    lr : [<87f08a04>]
> sp : 86eff8c0  ip : 87f3fbde  fp : ffffffff
> r10: ffffffff  r9 : 00000000  r8 : 00000003
> r7 : 86f075b8  r6 : 00000002  r5 : ffffffec  r4 : 86f07544
> r3 : 00000000  r2 : 43f900b4  r1 : 00000020  r0 : 00000005
> Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
> [<87f08a20>] (do_devinfo_subtree+0x90/0x130) from [<87f08a90>] (do_devinfo_subtree+0x100/0x130)
>
> [<87f3e070>] (unwind_backtrace+0x0/0x90) from [<87f28514>] (panic+0x28/0x3c)
> [<87f28514>] (panic+0x28/0x3c) from [<87f3e4b8>] (do_exception+0x10/0x14)
> [<87f3e4b8>] (do_exception+0x10/0x14) from [<87f3e544>] (do_data_abort+0x2c/0x38)
> [<87f3e544>] (do_data_abort+0x2c/0x38) from [<87f3e268>] (data_abort+0x48/0x60)

This patch fixes this by adding a device to its parents children list in
register_device so that dev_add_child is no longer needed. This function
is removed from the tree. Now callers of register_device have to clearly
set the parent *before* registering a device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Jan Lübbe <jlu@pengutronix.de>
2012-12-12 15:04:27 +01:00
Jean-Christophe PLAGNIOL-VILLARD ba526393dd console: display Switch to console [csxx] when switching from debug_ll to real console
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-30 10:24:39 +01:00
Jean-Christophe PLAGNIOL-VILLARD 0448644294 console: use debug_ll before the console is available
This will allow to have the same feature as earlyprintk in the kernel

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-30 10:23:50 +01:00
Sascha Hauer 3510a4b0f5 console/of: evaluate linux,stdout-path property
When a linux,stdout-path property is given in the devicetree
activate the corresponding console.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-09 20:58:27 +02:00
Sascha Hauer 2909d4ca4b console: Cleanup console activation
When CONFIG_CONSOLE_ACTIVATE_ALL is set, the banner will never be printed.
Also, the console buffer is emptied when the first console is registered,
even when it's not enabled.

This patch cleans it up in a way that:

- the console buffer is emptied once the first console is activated, not
  when it's registered.
- Make sure that the banner is printed first, so that we can output things
  to the buffer before the banner is printed without ending up in having
  the banner in the middle of the other boot messages.
- Use IS_ENABLED rather than ifdefs

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-09 08:57:10 +02:00
Jean-Christophe PLAGNIOL-VILLARD 3c5327e660 switch all platform_bus device/driver registering to platform_driver/device_register
now register_driver and register_device are for bus only usage.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-10-04 15:19:12 +02:00
Sascha Hauer 77322aa896 Treewide: remove address of the Free Software Foundation
The FSF address has changed in the past. Instead of updating it
each time the address changes, just drop it completely treewide.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-17 10:57:41 +02:00
Sascha Hauer abe4560c8a Use DEVICE_ID_DYNAMIC where applicable
We now have DEVICE_ID_DYNAMIC for dynamic allocation of device ids,
Use it where applicable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-04-16 09:43:02 +02:00
Sascha Hauer a9236dd6b5 console: use container_of instead of type_data
This reduces the usage of type_data.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-02-25 15:16:14 +01:00
Sascha Hauer 64a46e2217 console: make it work without malloc
This changes the dynamically allocated kfifos to statically initialized
ones. This makes the console work without malloc and thus safe to be
called before malloc is initialized.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-26 13:59:20 +01:00
Jean-Christophe PLAGNIOL-VILLARD 4c4fae147d poller_call: move from getc to is_timeout
this will allow to always call poller_call even durring timeout
and still the case in getc

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-04 14:10:13 +01:00
Sascha Hauer 0ee6847f7b Merge branch 'next' 2011-12-07 12:03:13 +01:00
Sascha Hauer a2792b03ff fprintf: remove unused variable
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-07 11:44:37 +01:00
Robert Jarzmik ea8314d19f console: add console unregistering
Some console are transient, like the USB connected serial
console which should be removed when the USB connection is
severed.

Enable console removal for such devices.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-05 17:59:02 +01:00
Sascha Hauer 1533f6b7b3 fix fprintf prototype and return value
The puts functions now properly return the number of characters
written. With this we can also fix fprintf.
Also, remove never reached return in fputs.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-11 16:19:48 +01:00
Sascha Hauer 8fe1e8fd41 console: fix return values of puts functions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-11 12:20:21 +01:00
Sascha Hauer d01070c8af remove EARLY_INIT and EARLY_CONSOLE support
Bitrotted over time and nearly unused, so remove it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-27 10:27:18 +02:00
Sascha Hauer ad140020b8 console: make console device a child of the hardware device
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-08-15 09:48:03 +02:00
Alexey Galakhov 943bf72dc8 fix console fifo (and loadb/loady commands)
This patch fixes loadb and loady commands. tstc() should return true if
console_input_buffer is not empty.

Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-05-16 08:28:27 +02:00
Sascha Hauer 3f1ff6b730 move version_string to seperate file
In a noninteractive environment barebox will be compiled without
command support. So move version_string to a seperate file which
is compiled unconditionally.
Also, display the banner when the simple console support is used.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 12:36:08 +02:00
Juergen Beisert 76dd3e70a5 Fix default baudrate setting
The menu entry to set the default baudrate (CONFIG_BAUDRATE) makes no sense,
as long as its content is not used. This patch makes barebox using the setting
again.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-01-18 14:24:09 +01:00
Marc Kleine-Budde 0277a663bc Add generic poll infrastructure
Barebox does not have interrupt functionality. Nevertheless it's
sometimes useful to periodically call functions, like for example
a heartbeat LED or watchdog reset. Instead of cluttering the code
with calls to these functions this patch adds a generic polling
infrastructure. Code which might run for longer now can call
poller_call() periodically which in turn will call all registered
pollers.
This patch adds a call to poller_call in two generic pathes. First
of them is getc() which covers waiting for uart input. Second is
ctrlc() which should be called anyway from code which might run
for longer. So instead adding poller_call directly to your code,
consider checking ctrlc instead which also gives additional
convenience to the user.
The poller code is safe against reentrancy which means that it's
safe to call poller_call inside a poller.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-12-20 09:28:21 +01:00
Sascha Hauer e2fadcc34a version_string: sparse fixes
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-21 22:21:24 +02:00
Sascha Hauer f538b46572 console: sparse fixes
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-21 22:21:23 +02:00
Jean-Christophe PLAGNIOL-VILLARD 098e9e8f20 console: set device_d id at -1
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-09-24 08:46:41 +02:00
Sascha Hauer 2db4aa5c32 rename __initdata to __early_initdata
The __initdata define was present before Jean-Christophe
added it as fake value for Linux compatibility. Rename
the previous define to a different name to avoid
clashes

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-09-20 09:21:31 +02:00
Sascha Hauer c3789cd49b rework device parameters
Change device parameters so that the memory management is in generic
code. This also removes the need of storing statically initialized
parameters as they are stored in a struct list_head for each device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-17 08:28:25 +02:00
Sascha Hauer 73d57b1d35 list: remove duplicated list.h
We accidently have two list implementations in the tree:
include/list.h and include/linux/list.h. This patch moves
the latter (newer one) to include/linux/list.h.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-11-03 09:48:53 +01:00
Sascha Hauer 0217e514cf console: partly revert 84688dfdb4
Some unrelated code leaked in in this commit

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-09-25 14:13:17 +02:00
Sascha Hauer 84688dfdb4 console: make locally used function static
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-09-25 13:34:15 +02:00
Sascha Hauer 0bf2410e85 console: Fix line endings
use \r\n instead of \n\r

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-08-13 10:43:12 +02:00
Sascha Hauer 02ba8a0542 get rid of device ids
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-07-21 16:41:47 +02:00
Sascha Hauer 49321a5cd3 console: buffer characters before console is initialized
instead of throwing all output away when the console
is not initialized, buffer it in a kfifo and print
it later when the first console gets initialized.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-05-13 16:23:09 +02:00
Sascha Hauer 2e8254e387 console: rename console_buffer to console_input_buffer
...as we want to add an output buffer, too

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-05-13 16:11:24 +02:00
Sascha Hauer 8a2e721fc5 Flush consoles before exiting
We use FIFOs on some devices, so flush them before exiting so
we do not get funny characters in the output.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-03-19 12:21:24 +01:00
Sascha Hauer 4e2fe88944 Console: Fix baudrate switching
When waiting for the user to confirm the new baudrate, wait
for '\n' and '\r' instead of only '\r'

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-02-06 14:44:46 +01:00
Sascha Hauer aca52174a9 console: add a simple console for saving space
Add a simple console layer which is not able to handle multiple
consoles for those who don't need it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2008-08-01 11:47:10 +02:00
Sascha Hauer 8759e68de2 Add the possibility to have an architecture specific ctrlc() function.
This allows us to return immediately in ctrlc() on sandbox and thus
not slow down network througput.
2008-03-11 00:00:37 +01:00
sascha ceac76ffce Move display_banner() to console.c. This helps us to show
the banner as first message.
2007-10-19 11:04:33 +02:00
Sascha Hauer ac8a1f064e Use Linux Kernel list implementation for console devices instead
of homegrown list.
2007-10-11 20:36:57 +02:00
Sascha Hauer 9b391290c2 Fix use of unitialized Variable. Why didn't this come up earlier??? 2007-10-09 08:18:37 +02:00
Sascha Hauer 2443c7a6f1 export symbols 2007-10-07 14:27:24 +02:00
Sascha Hauer aaa71a1263 Export symbols printf and the ones needed for getopt 2007-10-01 10:26:45 +02:00
Sascha Hauer a3110c5f8f add console buffering 2007-09-21 21:30:59 +02:00
Sascha Hauer 0dd68e795e - putc is now putchar for better standard conformity
- make printf return int
2007-09-21 09:09:06 +02:00