aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2004-10-19 18:41:12 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-10-19 18:41:12 -0700
commit35bafd11c7ec2df43d45c58edfda1c53e6296700 (patch)
tree99053228578fb737601cafe0c635e8a58f2a1fa2 /kernel
parent151d661106981a7a714ce2a6f609ec5274e3fabe (diff)
downloadhistory-35bafd11c7ec2df43d45c58edfda1c53e6296700.tar.gz
[PATCH] "console=" parameter ignored
I've noticed that under specific circumstances the "console=" kernel parameter is ignored. This happens when EARLY_PRINTK is enabled and the serial console is the only available. In this case unregister_console() when called for the early console sets preferred_console back to -1 replacing the value that was recorded by console_setup() -- the order of calls is as follows: 1. register_console() -- for the early console, 2. console_setup() -- recording the console index for the real console, 3. unregister_console() -- for the early console, erasing the console index recorded above, 4. register_console() -- for the real console, picking up the first device available, instead of the selected one. I've observed this problem with a DECstation system using ttyS3 -- its default console device from the firmware's point of view. The solution is to restore the setting of "console=" upon unregister_console(). This made a snapshot of 2.4.26 work for me. I wasn't able to test the changes with 2.6 because DECstation drivers don't support it yet, but the code responsible for console selection appears functionally the same. So I've concluded it needs the same change. Here's a patch. 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.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index 390396fc6d017f..13c01c9be6913f 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -109,6 +109,7 @@ struct console_cmdline
#define MAX_CMDLINECONSOLES 8
static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES];
+static int selected_console = -1;
static int preferred_console = -1;
/* Flag: console code may call schedule() */
@@ -174,12 +175,12 @@ int __init add_preferred_console(char *name, int idx, char *options)
for(i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++)
if (strcmp(console_cmdline[i].name, name) == 0 &&
console_cmdline[i].index == idx) {
- preferred_console = i;
+ selected_console = i;
return 0;
}
if (i == MAX_CMDLINECONSOLES)
return -E2BIG;
- preferred_console = i;
+ selected_console = i;
c = &console_cmdline[i];
memcpy(c->name, name, sizeof(c->name));
c->name[sizeof(c->name) - 1] = 0;
@@ -746,6 +747,9 @@ void register_console(struct console * console)
int i;
unsigned long flags;
+ if (preferred_console < 0)
+ preferred_console = selected_console;
+
/*
* See if we want to use this console driver. If we
* didn't select a console we take the first one
@@ -836,7 +840,7 @@ int unregister_console(struct console * console)
* would prevent fbcon from taking over.
*/
if (console_drivers == NULL)
- preferred_console = -1;
+ preferred_console = selected_console;
release_console_sem();