aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Chubb <peterc@chubb.wattle.id.au>2007-08-20 23:51:45 -0400
committerTony Luck <tony.luck@intel.com>2007-09-01 05:50:39 -0400
commit8b713c67bccef7cabb0ee915f47eb33d82636af9 (patch)
tree73a0577c8dd70825eaa41dc4527ab09432418166
parent99a19cf1c0eb22bad83fff060f08330ee9e029e2 (diff)
[IA64] Enable early console for Ski simulator
This patch cleans up the `enable early console for SKI' patch (471e7a44848f467c9b83adc3463d019d2fa8817f), 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> Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r--arch/ia64/hp/sim/hpsim_console.c15
-rw-r--r--arch/ia64/hp/sim/hpsim_setup.c9
-rw-r--r--arch/ia64/kernel/setup.c8
-rw-r--r--include/asm-ia64/hpsim.h10
4 files changed, 28 insertions, 14 deletions
diff --git a/arch/ia64/hp/sim/hpsim_console.c b/arch/ia64/hp/sim/hpsim_console.c
index 6e149c8ab835..0475a5452404 100644
--- a/arch/ia64/hp/sim/hpsim_console.c
+++ b/arch/ia64/hp/sim/hpsim_console.c
@@ -21,6 +21,7 @@
21#include <asm/machvec.h> 21#include <asm/machvec.h>
22#include <asm/pgtable.h> 22#include <asm/pgtable.h>
23#include <asm/sal.h> 23#include <asm/sal.h>
24#include <asm/hpsim.h>
24 25
25#include "hpsim_ssc.h" 26#include "hpsim_ssc.h"
26 27
@@ -28,7 +29,7 @@ static int simcons_init (struct console *, char *);
28static void simcons_write (struct console *, const char *, unsigned); 29static void simcons_write (struct console *, const char *, unsigned);
29static struct tty_driver *simcons_console_device (struct console *, int *); 30static struct tty_driver *simcons_console_device (struct console *, int *);
30 31
31struct console hpsim_cons = { 32static struct console hpsim_cons = {
32 .name = "simcons", 33 .name = "simcons",
33 .write = simcons_write, 34 .write = simcons_write,
34 .device = simcons_console_device, 35 .device = simcons_console_device,
@@ -62,3 +63,15 @@ static struct tty_driver *simcons_console_device (struct console *c, int *index)
62 *index = c->index; 63 *index = c->index;
63 return hp_simserial_driver; 64 return hp_simserial_driver;
64} 65}
66
67int simcons_register(void)
68{
69 if (!ia64_platform_is("hpsim"))
70 return 1;
71
72 if (hpsim_cons.flags & CON_ENABLED)
73 return 1;
74
75 register_console(&hpsim_cons);
76 return 0;
77}
diff --git a/arch/ia64/hp/sim/hpsim_setup.c b/arch/ia64/hp/sim/hpsim_setup.c
index f2297192a582..f629e903ebc7 100644
--- a/arch/ia64/hp/sim/hpsim_setup.c
+++ b/arch/ia64/hp/sim/hpsim_setup.c
@@ -21,6 +21,7 @@
21#include <asm/machvec.h> 21#include <asm/machvec.h>
22#include <asm/pgtable.h> 22#include <asm/pgtable.h>
23#include <asm/sal.h> 23#include <asm/sal.h>
24#include <asm/hpsim.h>
24 25
25#include "hpsim_ssc.h" 26#include "hpsim_ssc.h"
26 27
@@ -41,11 +42,5 @@ hpsim_setup (char **cmdline_p)
41{ 42{
42 ROOT_DEV = Root_SDA1; /* default to first SCSI drive */ 43 ROOT_DEV = Root_SDA1; /* default to first SCSI drive */
43 44
44#ifdef CONFIG_HP_SIMSERIAL_CONSOLE 45 simcons_register();
45 {
46 extern struct console hpsim_cons;
47 if (ia64_platform_is("hpsim"))
48 register_console(&hpsim_cons);
49 }
50#endif
51} 46}
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 1f9b1d818dcd..9e392a30d197 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -60,6 +60,7 @@
60#include <asm/smp.h> 60#include <asm/smp.h>
61#include <asm/system.h> 61#include <asm/system.h>
62#include <asm/unistd.h> 62#include <asm/unistd.h>
63#include <asm/hpsim.h>
63 64
64#if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE) 65#if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
65# error "struct cpuinfo_ia64 too big!" 66# error "struct cpuinfo_ia64 too big!"
@@ -389,13 +390,8 @@ early_console_setup (char *cmdline)
389 if (!efi_setup_pcdp_console(cmdline)) 390 if (!efi_setup_pcdp_console(cmdline))
390 earlycons++; 391 earlycons++;
391#endif 392#endif
392#ifdef CONFIG_HP_SIMSERIAL_CONSOLE 393 if (!simcons_register())
393 {
394 extern struct console hpsim_cons;
395 register_console(&hpsim_cons);
396 earlycons++; 394 earlycons++;
397 }
398#endif
399 395
400 return (earlycons) ? 0 : -1; 396 return (earlycons) ? 0 : -1;
401} 397}
diff --git a/include/asm-ia64/hpsim.h b/include/asm-ia64/hpsim.h
new file mode 100644
index 000000000000..d6be3fdc39fa
--- /dev/null
+++ b/include/asm-ia64/hpsim.h
@@ -0,0 +1,10 @@
1#ifndef _ASMIA64_HPSIM_H
2#define _ASMIA64_HPSIM_H
3
4#ifndef CONFIG_HP_SIMSERIAL_CONSOLE
5static inline int simcons_register(void) { return 1; }
6#else
7int simcons_register(void);
8#endif
9
10#endif