of/fdt: Add extern prototype for early_init_dt_scan_chosen_serial()
PATCH 1/1 of/fdt: Add extern prototype for early_init_dt_scan_chosen_serial()
The original commit that introduced this function (fb11ffe74c794a) indicated that calling it from the architecture code was one possible use case. Let's declare it in of_fdt.h to make it a public API.
--- include/linux/of_fdt.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/linux/of_fdt.h +8 -0
@@ -12,6 +12,7 @@#ifndef _LINUX_OF_FDT_H#define _LINUX_OF_FDT_H +#include <linux/errno.h> #include <linux/types.h> #include <linux/init.h>
@@ -87,6 +88,13 @@ extern void early_init_devtree(void *);extern void early_get_first_memblock_info (void *,phys_addr_t *);extern u64 fdt_translate_address (const void *blob,int node_offset);extern void of_fdt_limit_memory (int limit); + +#if defined(CONFIG_SERIAL_EARLYCON ) +extern int early_init_dt_scan_chosen_serial (void ); +#else +static inline int early_init_dt_scan_chosen_serial (void ) {return -ENOENT ; } +#endif +#else /* CONFIG_OF_FLATTREE */ static inline void early_init_fdt_scan_reserved_mem (void ) {}static inline const char *of_flat_dt_get_machine_name (void ) {return NULL ; }
Signature · 6 lines
2.1.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1413706294-12578-1-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 5 lines · Kevin Cernekee
The original commit that introduced this function (
fb11ffe74c794a) indicated that calling it from the architecture code was one possible use case. Let's declare it inof_fdt.hto make it a public API.Signed-off-by Kevin Cernekee <[email protected]>
Please note that arch/microblaze/kernel/prom.c has a local function with the same name but a different signature, so this will cause a compile failure there.
Quoted 20 lines
--- include/linux/of_fdt.h | 8 ++++++++ 1 file changed, 8 insertions(+)include/linux/of_fdt.h +1
-0@@ -12,6 +12,7 @@#ifndef _LINUX_OF_FDT_H#define _LINUX_OF_FDT_H +#include <linux/errno.h> #include <linux/types.h> #include <linux/init.h> @@ -87,6 +88,13 @@ extern void early_init_devtree(void *);extern void early_get_first_memblock_info (void *,phys_addr_t *);extern u64 fdt_translate_address (const void *blob,int node_offset);extern void of_fdt_limit_memory (int limit);
include/linux/of_fdt.h extern void early_init_devtree(void *); · line 100
Quoted 10 lines
include/linux/of_fdt.h +7
-0+ +#if defined(CONFIG_SERIAL_EARLYCON ) +extern int early_init_dt_scan_chosen_serial (void ); +#else +static inline int early_init_dt_scan_chosen_serial (void ) {return -ENOENT ; } +#endif +#else /* CONFIG_OF_FLATTREE */ static inline void early_init_fdt_scan_reserved_mem (void ) {}static inline const char *of_flat_dt_get_machine_name (void ) {return NULL ; }
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Kevin Cernekee
The original commit that introduced this function (
fb11ffe74c794a) indicated that calling it from the architecture code was one possible use case. Let's declare it inof_fdt.hto make it a public API.
Who is the user for this?
Despite what I said, there would be issues calling this from arch code. Doing so would result in 2 calls to this function as the early_param call is not disabled. This could be fixed, but really we want an arch to implement one of the other options.
Rob
Quoted 33 lines
Signed-off-by Kevin Cernekee <[email protected]>--- include/linux/of_fdt.h | 8 ++++++++ 1 file changed, 8 insertions(+)include/linux/of_fdt.h +8
-1@@ -12,6 +12,7 @@#ifndef _LINUX_OF_FDT_H#define _LINUX_OF_FDT_H +#include <linux/errno.h> #include <linux/types.h> #include <linux/init.h> @@ -87,6 +88,13 @@ extern void early_init_devtree(void *);extern void early_get_first_memblock_info (void *,phys_addr_t *);extern u64 fdt_translate_address (const void *blob,int node_offset);extern void of_fdt_limit_memory (int limit); + +#if defined(CONFIG_SERIAL_EARLYCON ) +extern int early_init_dt_scan_chosen_serial (void ); +#else +static inline int early_init_dt_scan_chosen_serial (void ) {return -ENOENT ; } +#endif +#else /* CONFIG_OF_FLATTREE */ static inline void early_init_fdt_scan_reserved_mem (void ) {}static inline const char *of_flat_dt_get_machine_name (void ) {return NULL ; } --
Quoted 2 lines
2.1.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): CAL_JsqKzWfwMRheB0qGhcHFkj9zku2uevX7GF+=U4Qhd9m3VYg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 6 lines · Rob Herring
Quoted 3 lines · Kevin Cernekee
The original commit that introduced this function (
fb11ffe74c794a) indicated that calling it from the architecture code was one possible use case. Let's declare it inof_fdt.hto make it a public API.Who is the user for this?
bcm3384 on MIPS, a new target under development.
There are three objectives here:
1) Use the new DT-based earlycon code instead of the old MIPS EARLY_PRINTK code. This lets us read the MMIO addresses straight out of DT instead of hardcoding them.
2) Start earlycon as soon as possible, so if there are errors during the boot sequence, the user will see some output that helps diagnose problems. The MIPS code was ideal as it started printing output before memory setup or command line parsing.
3) Enable earlycon by default without forcing everyone to tweak their command lines. On this system the command line is supplied by another OS on another CPU, and requiring "earlycon" to be added is problematic. The original MIPS EARLY_PRINTK code could be enabled unconditionally.
Quoted 3 lines
Despite what I said, there would be issues calling this from arch code. Doing so would result in 2 calls to this function as the
early_paramcall is not disabled.
Good point - it looks like this case will need to be covered in either scenario (called from early_param() or called from arch code). If I add "earlycon earlycon" to the command line, it yields a scary warning:
bootconsole [uart0] enabled
------------[ cut here ]------------
WARNING: CPU: 0 PID: 0 at kernel/printk/printk.c:2391
register_console+0x244/0x3fc()
console 'uart0' already registered
CPU: 0 PID: 0 Comm: swapper Not tainted 3.17.0+ #97
Stack : 00000000 00000004 80bb0000 80bb0000 00000000 00000000 00000000 00000000
80b94e12 00000033 00000000 00000000 00010000 80511308 804cff8c 80510f67
00000000 00000000 80b938d8 80511308 804cebd4 43f42d13 99808621 80445bd4
80510000 80032574 00000000 00000000 804d4214 804ffc84 804ffc84 804cff8c
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
...
Call Trace:
[<80019f8c>] show_stack+0x64/0x7c
[<80447a5c>] dump_stack+0xc8/0xfc
[<800327c8>] warn_slowpath_common+0x7c/0xac
[<80032858>] warn_slowpath_fmt+0x2c/0x38
[<80076244>] register_console+0x244/0x3fc
[<8053a7e4>] of_setup_earlycon+0x74/0x98
[<8053d07c>] early_init_dt_scan_chosen_serial+0x110/0x140
[<805281a0>] do_early_param+0xc4/0x13c
[<8004ecc0>] parse_args+0x284/0x444
[<805286cc>] parse_early_options+0x34/0x40
[<80528714>] parse_early_param+0x3c/0x58
[<8052b7b0>] setup_arch+0xec/0x6ac
[<805287d4>] start_kernel+0x94/0x458
---[ end trace dc8fa200cb88537f ]---I'll send a patch to fix this.
Quoted 2 lines
This could be fixed, but really we
want an arch to implement one of the other options.
We do have a functioning ioremap when early params are parsed. But this doesn't solve objective #3, which is what I was trying to accomplish by calling early_init_dt_scan_chosen_serial() from the arch code.
In lieu of my original solution, I can send a patch to add a CONFIG_EARLYCON_FORCE option to unconditionally call early_init_dt_scan_chosen_serial() from early_init_dt_scan(), if that makes sense.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html