[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>

authored by Peter Chubb and committed by Tony Luck 8b713c67 99a19cf1

+28 -14
+14 -1
arch/ia64/hp/sim/hpsim_console.c
··· 21 21 #include <asm/machvec.h> 22 22 #include <asm/pgtable.h> 23 23 #include <asm/sal.h> 24 + #include <asm/hpsim.h> 24 25 25 26 #include "hpsim_ssc.h" 26 27 ··· 29 28 static void simcons_write (struct console *, const char *, unsigned); 30 29 static struct tty_driver *simcons_console_device (struct console *, int *); 31 30 32 - struct console hpsim_cons = { 31 + static struct console hpsim_cons = { 33 32 .name = "simcons", 34 33 .write = simcons_write, 35 34 .device = simcons_console_device, ··· 62 61 extern struct tty_driver *hp_simserial_driver; 63 62 *index = c->index; 64 63 return hp_simserial_driver; 64 + } 65 + 66 + int simcons_register(void) 67 + { 68 + if (!ia64_platform_is("hpsim")) 69 + return 1; 70 + 71 + if (hpsim_cons.flags & CON_ENABLED) 72 + return 1; 73 + 74 + register_console(&hpsim_cons); 75 + return 0; 65 76 }
+2 -7
arch/ia64/hp/sim/hpsim_setup.c
··· 21 21 #include <asm/machvec.h> 22 22 #include <asm/pgtable.h> 23 23 #include <asm/sal.h> 24 + #include <asm/hpsim.h> 24 25 25 26 #include "hpsim_ssc.h" 26 27 ··· 42 41 { 43 42 ROOT_DEV = Root_SDA1; /* default to first SCSI drive */ 44 43 45 - #ifdef CONFIG_HP_SIMSERIAL_CONSOLE 46 - { 47 - extern struct console hpsim_cons; 48 - if (ia64_platform_is("hpsim")) 49 - register_console(&hpsim_cons); 50 - } 51 - #endif 44 + simcons_register(); 52 45 }
+2 -6
arch/ia64/kernel/setup.c
··· 60 60 #include <asm/smp.h> 61 61 #include <asm/system.h> 62 62 #include <asm/unistd.h> 63 + #include <asm/hpsim.h> 63 64 64 65 #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE) 65 66 # error "struct cpuinfo_ia64 too big!" ··· 390 389 if (!efi_setup_pcdp_console(cmdline)) 391 390 earlycons++; 392 391 #endif 393 - #ifdef CONFIG_HP_SIMSERIAL_CONSOLE 394 - { 395 - extern struct console hpsim_cons; 396 - register_console(&hpsim_cons); 392 + if (!simcons_register()) 397 393 earlycons++; 398 - } 399 - #endif 400 394 401 395 return (earlycons) ? 0 : -1; 402 396 }
+10
include/asm-ia64/hpsim.h
··· 1 + #ifndef _ASMIA64_HPSIM_H 2 + #define _ASMIA64_HPSIM_H 3 + 4 + #ifndef CONFIG_HP_SIMSERIAL_CONSOLE 5 + static inline int simcons_register(void) { return 1; } 6 + #else 7 + int simcons_register(void); 8 + #endif 9 + 10 + #endif