diff options
author | Greg Edwards <edwardsg@sgi.com> | 2005-06-23 03:09:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-23 12:45:18 -0400 |
commit | ab4af03a4054bd78bcabfb2214c9597201beae35 (patch) | |
tree | 43d2b273cb84349bfdde6667f8d5fea1d2d87031 /kernel | |
parent | dfe52244e004f5103478966cd88351feb5c50d79 (diff) |
[PATCH] CON_CONSDEV bit not set correctly on last console
According to include/linux/console.h, CON_CONSDEV flag should be set on
the last console specified on the boot command line:
86 #define CON_PRINTBUFFER (1)
87 #define CON_CONSDEV (2) /* Last on the command line */
88 #define CON_ENABLED (4)
89 #define CON_BOOT (8)
This does not currently happen if there is more than one console specified
on the boot commandline. Instead, it gets set on the first console on the
command line. This can cause problems for things like kdb that look for
the CON_CONSDEV flag to see if the console is valid.
Additionaly, it doesn't look like CON_CONSDEV is reassigned to the next
preferred console at unregister time if the console being unregistered
currently has that bit set.
Example (from sn2 ia64):
elilo vmlinuz root=<dev> console=ttyS0 console=ttySG0
in this case, the flags on ttySG console struct will be 0x4 (should be
0x6).
Attached patch against bk fixes both issues for the cases I looked at. It
uses selected_console (which gets incremented for each console specified on
the command line) as the indicator of which console to set CON_CONSDEV on.
When adding the console to the list, if the previous one had CON_CONSDEV
set, it masks it out. Tested on ia64 and x86.
The problem with the current behavior is it breaks overriding the default from
the boot line. In the ia64 case, there may be a global append line defining
console=a in elilo.conf. Then you want to boot your kernel, and want to
override the default by passing console=b on the boot line. elilo constructs
the kernel cmdline by starting with the value of the global append line, then
tacks on whatever else you specify, which puts console=b last.
Signed-off-by: Greg Edwards <edwardsg@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/printk.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 01b58d7d17ff..3a442bfb8bee 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -876,8 +876,10 @@ void register_console(struct console * console) | |||
876 | break; | 876 | break; |
877 | console->flags |= CON_ENABLED; | 877 | console->flags |= CON_ENABLED; |
878 | console->index = console_cmdline[i].index; | 878 | console->index = console_cmdline[i].index; |
879 | if (i == preferred_console) | 879 | if (i == selected_console) { |
880 | console->flags |= CON_CONSDEV; | 880 | console->flags |= CON_CONSDEV; |
881 | preferred_console = selected_console; | ||
882 | } | ||
881 | break; | 883 | break; |
882 | } | 884 | } |
883 | 885 | ||
@@ -897,6 +899,8 @@ void register_console(struct console * console) | |||
897 | if ((console->flags & CON_CONSDEV) || console_drivers == NULL) { | 899 | if ((console->flags & CON_CONSDEV) || console_drivers == NULL) { |
898 | console->next = console_drivers; | 900 | console->next = console_drivers; |
899 | console_drivers = console; | 901 | console_drivers = console; |
902 | if (console->next) | ||
903 | console->next->flags &= ~CON_CONSDEV; | ||
900 | } else { | 904 | } else { |
901 | console->next = console_drivers->next; | 905 | console->next = console_drivers->next; |
902 | console_drivers->next = console; | 906 | console_drivers->next = console; |
@@ -937,10 +941,14 @@ int unregister_console(struct console * console) | |||
937 | /* If last console is removed, we re-enable picking the first | 941 | /* If last console is removed, we re-enable picking the first |
938 | * one that gets registered. Without that, pmac early boot console | 942 | * one that gets registered. Without that, pmac early boot console |
939 | * would prevent fbcon from taking over. | 943 | * would prevent fbcon from taking over. |
944 | * | ||
945 | * If this isn't the last console and it has CON_CONSDEV set, we | ||
946 | * need to set it on the next preferred console. | ||
940 | */ | 947 | */ |
941 | if (console_drivers == NULL) | 948 | if (console_drivers == NULL) |
942 | preferred_console = selected_console; | 949 | preferred_console = selected_console; |
943 | 950 | else if (console->flags & CON_CONSDEV) | |
951 | console_drivers->flags |= CON_CONSDEV; | ||
944 | 952 | ||
945 | release_console_sem(); | 953 | release_console_sem(); |
946 | return res; | 954 | return res; |