[parisc-linux-cvs] re-enable pdc_console if a HPMC occurs

Helge Deller deller@gmx.de
Wed, 20 Jun 2001 14:33:52 +0200


--- Makefile    2001/06/20 12:20:54     1.63
+++ Makefile    2001/06/20 12:27:49
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 0
-EXTRAVERSION = -pa31
+EXTRAVERSION = -pa32

 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)

Index: pdc_cons.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/pdc_cons.c,v
retrieving revision 1.26
diff -u -r1.26 pdc_cons.c
--- pdc_cons.c	2001/06/14 12:12:42	1.26
+++ pdc_cons.c	2001/06/20 12:28:12
@@ -11,10 +11,12 @@
 #include <asm/system.h>
 #include <asm/pdc.h>	/* for iodc_call() proto and friends */
 
-
-/* Enable to use this simple PDC console (for debugging purposes only!): */
+/* define EARLY_BOOTUP_DEBUG to use this simple console driver
+ * for debugging kernel related boot problems. 
+ * On production kernels EARLY_BOOTUP_DEBUG should be undefined. */
 #undef EARLY_BOOTUP_DEBUG
 
+
 static void pdc_console_write(struct console *co, const char *s, unsigned 
count)
 {
 	while(count--)
@@ -34,13 +36,15 @@
 	wait_key:	NULL,
 	unblank:	NULL,
 	setup:		pdc_console_setup,
-	flags:		CON_BOOT|CON_PRINTBUFFER|CON_ENABLED,  // |CON_CONSDEV,
+	flags:		CON_BOOT|CON_PRINTBUFFER|CON_ENABLED,
 	index:		-1,
 };
 
 static int pdc_console_initialized;
+extern unsigned long log_size; /* kernel/printk.c */
 
-void pdc_console_init(void)
+
+static void pdc_console_init_force(void)
 {
 	if (pdc_console_initialized)
 		return;
@@ -50,31 +54,33 @@
 	if (PAGE0->mem_cons.cl_class == CL_DUPLEX)
 		memcpy(&PAGE0->mem_kbd, &PAGE0->mem_cons, sizeof(PAGE0->mem_cons));
 
-#ifdef EARLY_BOOTUP_DEBUG
-	pdc_console_write(0, "PDC Console Initialized\n", 24);
 	/* register the pdc console */
 	register_console(&pdc_cons);
-#endif /* EARLY_BOOTUP_DEBUG */
+
+	pdc_console_write(0, "PDC Console Initialized\n", 24);
 }
 
+void pdc_console_init(void)
+{
+#ifdef EARLY_BOOTUP_DEBUG
+	pdc_console_init_force();
+#endif
+}
+
 
 /* Unregister the pdc console with the printk console layer */
 void pdc_console_die(void)
 {
-	extern unsigned long log_size; /* kernel/printk.c */
-
 	if (!pdc_console_initialized)
 		return;
 	--pdc_console_initialized;
 
-#ifdef EARLY_BOOTUP_DEBUG
-	printk("Switching from PDC console\n");
+	printk(KERN_INFO "Switching from PDC console\n");
 
 	/* Don't repeat what we've already printed */
 	log_size = 0;
 
 	unregister_console(&pdc_cons);
-#endif /* EARLY_BOOTUP_DEBUG */
 }
 
 
@@ -89,22 +95,13 @@
 void pdc_console_restart(void)
 {
 	struct console *console;
-	extern unsigned long log_size;	/* kernel/printk.c */
 
 	if (pdc_console_initialized)
 		return;
 
-	while ((console = console_drivers) != (struct console *)0)
+	while ((console = console_drivers) != NULL)
 		unregister_console(console_drivers);
 
 	log_size = 0;
-	pdc_console_init();
-
-#ifndef EARLY_BOOTUP_DEBUG
-	register_console(&pdc_cons);
-#endif /* EARLY_BOOTUP_DEBUG */
-
-	printk("Switched to PDC console\n");
-	return;
+	pdc_console_init_force();	/* force registering the pdc console */
 }
-