public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* Enable early console for Ski simulator
@ 2007-08-16  5:03 Peter Chubb
  2007-08-20 13:24 ` Jes Sorensen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peter Chubb @ 2007-08-16  5:03 UTC (permalink / raw)
  To: linux-ia64


When using Ski to debug early startup, it's a bit of a pain not to
have printk.

This patch agains 2.6.23-rc? enables the simulated console very early.
It may be worth conditionalising on the command line... but this is
enough for now.

Signed-off-by: Peter Chubb <peterc@gelato.unsw.edu.au>

diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index eaa6a24..a8ada00 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -394,6 +394,13 @@ early_console_setup (char *cmdline)
 	if (!early_serial_console_init(cmdline))
 		earlycons++;
 #endif
+#ifdef CONFIG_HP_SIMSERIAL_CONSOLE
+	{
+		extern struct console hpsim_cons;
+		register_console(&hpsim_cons);
+		earlycons++;
+	}
+#endif
 
 	return (earlycons) ? 0 : -1;
 }

--
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au           ERTOS within National ICT Australia

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Enable early console for Ski simulator
  2007-08-16  5:03 Enable early console for Ski simulator Peter Chubb
@ 2007-08-20 13:24 ` Jes Sorensen
  2007-08-21  1:59 ` Peter Chubb
  2007-08-21  3:51 ` Peter Chubb
  2 siblings, 0 replies; 4+ messages in thread
From: Jes Sorensen @ 2007-08-20 13:24 UTC (permalink / raw)
  To: linux-ia64

>>>>> "Peter" = Peter Chubb <peterc@gelato.unsw.edu.au> writes:

Peter> When using Ski to debug early startup, it's a bit of a pain not
Peter> to have printk.

Peter> This patch agains 2.6.23-rc? enables the simulated console very
Peter> early.  It may be worth conditionalising on the command
Peter> line... but this is enough for now.

Hi Peter,

Really ugly with extern references in brackets like that - how about
sticking the thing in a header file instead?

Cheers,
Jes

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Enable early console for Ski simulator
  2007-08-16  5:03 Enable early console for Ski simulator Peter Chubb
  2007-08-20 13:24 ` Jes Sorensen
@ 2007-08-21  1:59 ` Peter Chubb
  2007-08-21  3:51 ` Peter Chubb
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Chubb @ 2007-08-21  1:59 UTC (permalink / raw)
  To: linux-ia64

>>>>> "Jes" = Jes Sorensen <jes@sgi.com> writes:

>>>>> "Peter" = Peter Chubb <peterc@gelato.unsw.edu.au> writes:
Peter> When using Ski to debug early startup, it's a bit of a pain not
Peter> to have printk.

Peter> This patch agains 2.6.23-rc? enables the simulated console very
Peter> early.  It may be worth conditionalising on the command
Peter> line... but this is enough for now.

Jes> Hi Peter,

Jes> Really ugly with extern references in brackets like that - how
Jes> about sticking the thing in a header file instead?

Yes you're right.  And looking at the patch, the wrong version got
sent to Tony... (you need to disable the console from being registered
twice or Bad Things Happen (TM))

Patch series follows...

--
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au           ERTOS within National ICT Australia
--
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au           ERTOS within National ICT Australia

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Enable early console for Ski simulator
  2007-08-16  5:03 Enable early console for Ski simulator Peter Chubb
  2007-08-20 13:24 ` Jes Sorensen
  2007-08-21  1:59 ` Peter Chubb
@ 2007-08-21  3:51 ` Peter Chubb
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Chubb @ 2007-08-21  3:51 UTC (permalink / raw)
  To: linux-ia64


This patch cleans up the `enable early console for SKI' patch, and
1. potentially allows the gensparse_defconfig to work again.
   (there are other problems running a generic kernel on Ski)
2. fixes the `console registered twice' problem. 
3. Cleans up the code by moving the `extern hpsim_cons' declaration to
   a new asm/hpsim.h file.


Thanks to Jes for comments.

Signed-off-by: Peter Chubb <peterc@gelato.unsw.edu.au>

 arch/ia64/hp/sim/hpsim_console.c |   15 ++++++++++++++-
 arch/ia64/hp/sim/hpsim_setup.c   |    9 ++-------
 arch/ia64/kernel/setup.c         |    8 ++------
 include/asm-ia64/hpsim.h         |   10 ++++++++++
 4 files changed, 28 insertions(+), 14 deletions(-)

Index: linux-2.6-git/arch/ia64/hp/sim/hpsim_console.c
=================================--- linux-2.6-git.orig/arch/ia64/hp/sim/hpsim_console.c	2007-08-21 13:04:47.000000000 +1000
+++ linux-2.6-git/arch/ia64/hp/sim/hpsim_console.c	2007-08-21 13:04:52.000000000 +1000
@@ -14,28 +14,29 @@
 #include <linux/tty.h>
 #include <linux/kdev_t.h>
 #include <linux/console.h>
 
 #include <asm/delay.h>
 #include <asm/irq.h>
 #include <asm/pal.h>
 #include <asm/machvec.h>
 #include <asm/pgtable.h>
 #include <asm/sal.h>
+#include <asm/hpsim.h>
 
 #include "hpsim_ssc.h"
 
 static int simcons_init (struct console *, char *);
 static void simcons_write (struct console *, const char *, unsigned);
 static struct tty_driver *simcons_console_device (struct console *, int *);
 
-struct console hpsim_cons = {
+static struct console hpsim_cons = {
 	.name =		"simcons",
 	.write =	simcons_write,
 	.device =	simcons_console_device,
 	.setup =	simcons_init,
 	.flags =	CON_PRINTBUFFER,
 	.index =	-1,
 };
 
 static int
 simcons_init (struct console *cons, char *options)
@@ -55,10 +56,22 @@ simcons_write (struct console *cons, con
 		  ia64_ssc('\r', 0, 0, 0, SSC_PUTCHAR);
 	}
 }
 
 static struct tty_driver *simcons_console_device (struct console *c, int *index)
 {
 	extern struct tty_driver *hp_simserial_driver;
 	*index = c->index;
 	return hp_simserial_driver;
 }
+
+int simcons_register(void)
+{
+	if (!ia64_platform_is("hpsim"))
+		return 1;
+
+	if (hpsim_cons.flags & CON_ENABLED)
+		return 1;
+
+	register_console(&hpsim_cons);
+	return 0;
+}
Index: linux-2.6-git/arch/ia64/hp/sim/hpsim_setup.c
=================================--- linux-2.6-git.orig/arch/ia64/hp/sim/hpsim_setup.c	2007-08-21 13:04:47.000000000 +1000
+++ linux-2.6-git/arch/ia64/hp/sim/hpsim_setup.c	2007-08-21 13:04:52.000000000 +1000
@@ -14,38 +14,33 @@
 #include <linux/root_dev.h>
 #include <linux/string.h>
 #include <linux/types.h>
 
 #include <asm/delay.h>
 #include <asm/irq.h>
 #include <asm/pal.h>
 #include <asm/machvec.h>
 #include <asm/pgtable.h>
 #include <asm/sal.h>
+#include <asm/hpsim.h>
 
 #include "hpsim_ssc.h"
 
 void
 ia64_ssc_connect_irq (long intr, long irq)
 {
 	ia64_ssc(intr, irq, 0, 0, SSC_CONNECT_INTERRUPT);
 }
 
 void
 ia64_ctl_trace (long on)
 {
 	ia64_ssc(on, 0, 0, 0, SSC_CTL_TRACE);
 }
 
 void __init
 hpsim_setup (char **cmdline_p)
 {
 	ROOT_DEV = Root_SDA1;		/* default to first SCSI drive */
 
-#ifdef CONFIG_HP_SIMSERIAL_CONSOLE
-	{
-		extern struct console hpsim_cons;
-		if (ia64_platform_is("hpsim"))
-			register_console(&hpsim_cons);
-	}
-#endif
+	simcons_register();
 }
Index: linux-2.6-git/include/asm-ia64/hpsim.h
=================================--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6-git/include/asm-ia64/hpsim.h	2007-08-21 13:04:52.000000000 +1000
@@ -0,0 +1,10 @@
+#ifndef _ASMIA64_HPSIM_H
+#define _ASMIA64_HPSIM_H
+
+#ifndef CONFIG_HP_SIMSERIAL_CONSOLE
+static inline int simcons_register(void) { return 1; }
+#else
+int simcons_register(void);
+#endif
+
+#endif
Index: linux-2.6-git/arch/ia64/kernel/setup.c
=================================--- linux-2.6-git.orig/arch/ia64/kernel/setup.c	2007-08-21 13:13:46.000000000 +1000
+++ linux-2.6-git/arch/ia64/kernel/setup.c	2007-08-21 13:15:19.000000000 +1000
@@ -53,20 +53,21 @@
 #include <asm/page.h>
 #include <asm/patch.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
 #include <asm/sal.h>
 #include <asm/sections.h>
 #include <asm/setup.h>
 #include <asm/smp.h>
 #include <asm/system.h>
 #include <asm/unistd.h>
+#include <asm/hpsim.h>
 
 #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
 # error "struct cpuinfo_ia64 too big!"
 #endif
 
 #ifdef CONFIG_SMP
 unsigned long __per_cpu_offset[NR_CPUS];
 EXPORT_SYMBOL(__per_cpu_offset);
 #endif
 
@@ -382,27 +383,22 @@ early_console_setup (char *cmdline)
 	{
 		extern int sn_serial_console_early_setup(void);
 		if (!sn_serial_console_early_setup())
 			earlycons++;
 	}
 #endif
 #ifdef CONFIG_EFI_PCDP
 	if (!efi_setup_pcdp_console(cmdline))
 		earlycons++;
 #endif
-#ifdef CONFIG_HP_SIMSERIAL_CONSOLE
-	{
-		extern struct console hpsim_cons;
-		register_console(&hpsim_cons);
+	if (!simcons_register())
 		earlycons++;
-	}
-#endif
 
 	return (earlycons) ? 0 : -1;
 }
 
 static inline void
 mark_bsp_online (void)
 {
 #ifdef CONFIG_SMP
 	/* If we register an early console, allow CPU 0 to printk */
 	cpu_set(smp_processor_id(), cpu_online_map);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-08-21  3:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-16  5:03 Enable early console for Ski simulator Peter Chubb
2007-08-20 13:24 ` Jes Sorensen
2007-08-21  1:59 ` Peter Chubb
2007-08-21  3:51 ` Peter Chubb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox