Skip to contentSkip to conversation

working early printk

PATCH New Jesse Barnes 1 participant 1 message May 7, 2004 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 working early printk

Bjorn, does this look like what you had in mind?

Early printk is currently broken due to the removal (quite some time ago) of arch_consoles_callable. This patch re-introduces a flag that can be used by printk() to determine whether early printing is ok. The flag is intended to be set by arch code after early console init is done. It adds an early console setup routine for ia64 that can be used by drivers that support early printk.

Ideas?

Thanks,
Jesse

===== arch/ia64/kernel/setup.c 1.70 vs edited =====

arch/ia64/kernel/setup.c +21 -0
@@ -280,6 +280,24 @@
 }
 #endif
 
+/**
+ * early_console_setup - setup debugging console
+ *
+ * Consoles started here require little enough setup that we can start using
+ * them very early in the boot process, either right after the machine
+ * vector initialization, or even before if the drivers are smart enough
+ * to detect their hw.
+ *
+ * Returns non-zero if a console couldn't be setup.
+ */
+static int __init early_console_setup(void)
+{
+	extern void sn_serial_console_early_setup(void);
+
+	sn_serial_console_early_setup();
+	return 0;
+}
+
 void __init
 setup_arch (char **cmdline_p)
 {
@@ -296,6 +314,9 @@
 #ifdef CONFIG_IA64_GENERIC
 	machvec_init(acpi_get_sysname());
 #endif
+
+	if (!early_console_setup())
+		early_printk_ok = 1;
 
 #ifdef CONFIG_ACPI_BOOT
 	/* Initialize the ACPI boot-time table parser */

===== drivers/char/sn_serial.c 1.11 vs edited =====

drivers/char/sn_serial.c +46 -27

107 lines not on this page · raw message

===== include/asm-ia64/sn/sn_sal.h 1.8 vs edited =====

include/asm-ia64/sn/sn_sal.h +2 -0
@@ -130,6 +130,8 @@
 #define SN_SAL_MIN_MAJOR	0x1  /* SN2 kernels need at least PROM 1.0 */
 #define SN_SAL_MIN_MINOR	0x0
 
+void early_sn_setup(void);
+
 u64 ia64_sn_probe_io_slot(long paddr, long size, void *data_ptr);
 
 /*

===== include/linux/kernel.h 1.48 vs edited =====

include/linux/kernel.h +1 -0
@@ -107,6 +107,7 @@
 }
 
 extern void bust_spinlocks(int yes);
+extern int early_printk_ok;		/* If set, console drivers will be called even if the system isn't up yet */
 extern int oops_in_progress;		/* If set, an oops, panic(), BUG() or die() is in progress */
 extern int panic_on_oops;
 extern int system_state;		/* See values below */

===== kernel/printk.c 1.37 vs edited =====

kernel/printk.c +2 -1
@@ -54,6 +54,7 @@
 EXPORT_SYMBOL(console_printk);
 
 int oops_in_progress;
+int early_printk_ok;
 
 /*
  * console_sem protects the console_drivers list, and also
@@ -526,7 +527,7 @@
 			log_level_unknown = 1;
 	}
 
-	if (!cpu_online(smp_processor_id()) &&
+	if (!early_printk_ok && !cpu_online(smp_processor_id()) &&
 	    system_state != SYSTEM_RUNNING) {
 		/*
 		 * Some console drivers may assume that per-cpu resources have