Commit 8b713c67 authored by Peter Chubb's avatar Peter Chubb Committed by Tony Luck

[IA64] Enable early console for Ski simulator

This patch cleans up the `enable early console for SKI' patch
(471e7a44), 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: default avatarPeter Chubb <peterc@gelato.unsw.edu.au>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 99a19cf1
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <asm/machvec.h> #include <asm/machvec.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/sal.h> #include <asm/sal.h>
#include <asm/hpsim.h>
#include "hpsim_ssc.h" #include "hpsim_ssc.h"
...@@ -28,7 +29,7 @@ static int simcons_init (struct console *, char *); ...@@ -28,7 +29,7 @@ static int simcons_init (struct console *, char *);
static void simcons_write (struct console *, const char *, unsigned); static void simcons_write (struct console *, const char *, unsigned);
static struct tty_driver *simcons_console_device (struct console *, int *); static struct tty_driver *simcons_console_device (struct console *, int *);
struct console hpsim_cons = { static struct console hpsim_cons = {
.name = "simcons", .name = "simcons",
.write = simcons_write, .write = simcons_write,
.device = simcons_console_device, .device = simcons_console_device,
...@@ -62,3 +63,15 @@ static struct tty_driver *simcons_console_device (struct console *c, int *index) ...@@ -62,3 +63,15 @@ static struct tty_driver *simcons_console_device (struct console *c, int *index)
*index = c->index; *index = c->index;
return hp_simserial_driver; 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;
}
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <asm/machvec.h> #include <asm/machvec.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/sal.h> #include <asm/sal.h>
#include <asm/hpsim.h>
#include "hpsim_ssc.h" #include "hpsim_ssc.h"
...@@ -41,11 +42,5 @@ hpsim_setup (char **cmdline_p) ...@@ -41,11 +42,5 @@ hpsim_setup (char **cmdline_p)
{ {
ROOT_DEV = Root_SDA1; /* default to first SCSI drive */ ROOT_DEV = Root_SDA1; /* default to first SCSI drive */
#ifdef CONFIG_HP_SIMSERIAL_CONSOLE simcons_register();
{
extern struct console hpsim_cons;
if (ia64_platform_is("hpsim"))
register_console(&hpsim_cons);
}
#endif
} }
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include <asm/smp.h> #include <asm/smp.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/unistd.h> #include <asm/unistd.h>
#include <asm/hpsim.h>
#if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE) #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
# error "struct cpuinfo_ia64 too big!" # error "struct cpuinfo_ia64 too big!"
...@@ -389,13 +390,8 @@ early_console_setup (char *cmdline) ...@@ -389,13 +390,8 @@ early_console_setup (char *cmdline)
if (!efi_setup_pcdp_console(cmdline)) if (!efi_setup_pcdp_console(cmdline))
earlycons++; earlycons++;
#endif #endif
#ifdef CONFIG_HP_SIMSERIAL_CONSOLE if (!simcons_register())
{
extern struct console hpsim_cons;
register_console(&hpsim_cons);
earlycons++; earlycons++;
}
#endif
return (earlycons) ? 0 : -1; return (earlycons) ? 0 : -1;
} }
......
#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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment