Skip to contentSkip to conversation

Console

parisc-linux Matthew Wilcox 2 participants 6 messages Dec 21, 2000 – Dec 31, 2000

lore
Share & tools
lore
#0 lore raw

We were doing some very dubious things with our console; I hope I've now fixed them.

The problem was that we can't output from the serial port until we've done all the GSC and LASI setup, which is very late in the boot sequence. The current serial console code just guesses, and gets lucky on x86, that it can output bytes to the serial port. This crashes for us because it assumes it can use outb when it should be using gsc_readb.

So I've moved the call to initialise the serial console to the serial driver, after it does its own setup. This makes much more sense (the serial console code might now be simplifiable, I haven't checked).

Of course, we'd like to see a bit of output before we get to that point. So we still register the PDC console, crappy as it is, very early on in the boot sequence (slightly later now than before, but it wasn't used up until that point anyway, because none of the console system was activated).

However, if you just do that and don't frob the dmesg log (nasty, nasty!), you get everything twice. So I invented a new console flag, CON_BOOT. the register_console() interface notices that the previous console was CON_BOOT, removes it and doesn't display the log to that point as it assumes you've already seen it on the boot console.

I hope other architectures can take advantage of this small piece of infrastructure. Ted, are you the console maintainer?

Signature · 1 line
Revolutions do not require corporate support.
#1 lore raw

Couple of things I forgot to mention...

you may now want to specify `console=ttyS0' in the palo makefile... though thinking about it now, you may not need to. I've only tried it with, not without.

I haven't tested STI console with these changes. I don't have a monitor/kbd for my 712. Someone should test this, and remove the calls to pdc_console_die (and remove pdc_console_die altogether).

Signature · 1 line
Revolutions do not require corporate support.
#2 lore raw
Quoted 6 lines · Matthew Wilcox

Couple of things I forgot to mention...

you may now want to specify `console=ttyS0' in the palo makefile... though thinking about it now, you may not need to. I've only tried it with, not without.

Yes, you do need `console=ttyS0' now. Otherwise you get "cannot open initial console" and then silence until the login prompt.

dmesg works nicely though :)

Richard

#3 lore raw
Quoted 4 lines · Richard Hirst

Yes, you do need `console=ttyS0' now. Otherwise you get "cannot open initial console" and then silence until the login prompt.

dmesg works nicely though :)

Yay :-) I just committed a change to PALO which ought to make this work. I must confess though, I'm not clear where it gets the CONFIG_ variables from. are they in the environment?

Signature · 1 line
Revolutions do not require corporate support.
#4 lore raw
In reply to Matthew Wilcox
Quoted 3 lines · Matthew Wilcox

I haven't tested STI console with these changes. I don't have a monitor/kbd for my 712. Someone should test this, and remove the calls to pdc_console_die (and remove pdc_console_die altogether).

here's a patch which does this. please let me know how this works out for you.

Index: arch/parisc/kernel/pdc_cons.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/pdc_cons.c,v retrieving revision 1.22

pdc_cons.c +6 -38
diff -u -p -r1.22 pdc_cons.c
@@ -66,7 +66,7 @@ static void pdc_console_write(struct con
 		pdc_putc(*s++);
 }
 
-int pdc_console_wait_key(struct console *co)
+static int pdc_console_wait_key(struct console *co)
 {
 	int ch = 'X';
 	int status;
@@ -96,11 +96,6 @@ int pdc_getc(void)
 	return pdc_console_wait_key(NULL);
 }
 
-static int pdc_console_setup(struct console *co, char *options)
-{
-	return 0;
-}
-
 static struct console pdc_cons = {
 	name:		"ttyB",
 	write:		pdc_console_write,
@@ -108,19 +103,19 @@ static struct console pdc_cons = {
 	device:		NULL, 
 	wait_key:	pdc_console_wait_key,
 	unblank:	NULL,
-	setup:		pdc_console_setup,
+	setup:		NULL,
 	flags:		CON_BOOT|CON_PRINTBUFFER|CON_ENABLED,  // |CON_CONSDEV,
 	index:		-1,
 };
 
 static int pdc_console_initialized;
 
-void pdc_console_init(void)
+void __init pdc_console_init(void)
 {
 	if (pdc_console_initialized)
 		return;
-	++pdc_console_initialized;
-	
+	pdc_console_initialized = 1;
+
 	/* If the console is duplex then copy the COUT parameters to CIN. */
 	if (PAGE0->mem_cons.cl_class == CL_DUPLEX)
 		memcpy(&PAGE0->mem_kbd, &PAGE0->mem_cons, sizeof(PAGE0->mem_cons));
@@ -130,32 +125,6 @@ void pdc_console_init(void)
 	register_console(&pdc_cons);
 }
 
-
-/* Unregister the pdc console with the printk console layer */
-void pdc_console_die(void)
-{
-	extern unsigned long log_size; /* kernel/printk.c */
-
-	printk("Switching from PDC console\n");
-	if (!pdc_console_initialized)
-		return;
-	--pdc_console_initialized;
-
-	/* Don't repeat what we've already printed */
-	log_size = 0;
-
-#ifdef CONFIG_VT_CONSOLE
-	{
-	    /* fixme (needed?): Wait for console-tasklet to finish !*/
-	    extern struct tasklet_struct console_tasklet;
-    	    tasklet_schedule(&console_tasklet);
-	}
-#endif
-
-	unregister_console(&pdc_cons);
-}
-
-
 /*
  * Used for emergencies. Currently only used if an HPMC occurs. If an
  * HPMC occurs, it is possible that the current console may not be
@@ -172,7 +141,7 @@ void pdc_console_restart(void)
 	if (pdc_console_initialized)
 		return;
 
-	while ((console = console_drivers) != (struct console *)0)
+	while ((console = console_drivers) != NULL)
 		unregister_console(console_drivers);
 
 	log_size = 0;
@@ -180,4 +149,3 @@ void pdc_console_restart(void)
 	printk("Switched to PDC console\n");
 	return;
 }
-

Index: drivers/video/sticon-bmode.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sticon-bmode.c,v retrieving revision 1.7

sticon-bmode.c +1 -7
diff -u -p -r1.7 sticon-bmode.c
@@ -861,13 +861,7 @@ static void __init sti_try_rom(unsigned 
 	sti_init_graph(sti);
 
 	//sti_inq_conf(sti);
-#if !defined(SERIAL_CONSOLE)	
-	{ 
-	    extern void pdc_console_die(void);  
-	    pdc_console_die(); 
-	}
-#endif
-		
+
 	take_over_console(&sti_con, 0, MAX_NR_CONSOLES-1, 1);
 
 	/* sti_inq_conf(sti); */

Index: drivers/video/sticon.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sticon.c,v retrieving revision 1.9

sticon.c +0 -1
diff -u -p -r1.9 sticon.c
@@ -219,7 +219,6 @@ static int __init sti_init(void)
 {
 	printk("searching for word mode STI ROMs\n");
 	if (sti_init_roms()) {
-		pdc_console_die();
 		take_over_console(&sti_con, 0, MAX_NR_CONSOLES-1, 1);
 		return 0;
 	} else

Index: drivers/video/stifb.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/stifb.c,v retrieving revision 1.2

stifb.c +0 -1
diff -u -p -r1.2 stifb.c
@@ -183,7 +183,6 @@ stifb_init(void)
 	fbgen_do_set_var(&disp.var, 1, &fb_info.gen);
 	fbgen_set_disp(-1, &fb_info.gen);
 	fbgen_install_cmap(0, &fb_info.gen);
-	pdc_console_die();
 	if (register_framebuffer(&fb_info.gen.info) < 0)
 		return -EINVAL;
 
Signature · 1 line
Revolutions do not require corporate support.
#5 lore raw
Quoted 7 lines · Matthew Wilcox
Quoted 3 lines · Matthew Wilcox

I haven't tested STI console with these changes. I don't have a monitor/kbd for my 712. Someone should test this, and remove the calls to pdc_console_die (and remove pdc_console_die altogether).

here's a patch which does this. please let me know how this works out for you.

If no-one tests this and tells me whether it works, i shall commit it anyway and you can deal with the breakage yourselves.

Signature · 1 line
Revolutions do not require corporate support.