aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/kernel
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2013-08-06 14:11:21 -0400
committerChris Metcalf <cmetcalf@tilera.com>2013-08-12 14:46:18 -0400
commitbda0f5bad812df076a28fa5e58d86dfe68415251 (patch)
tree221517adf66b504282e484d9d2faaee4efe3602d /arch/tile/kernel
parent7c29b78a0e0c7df6e0ba0092fee334ddc3086f16 (diff)
tile: various console improvements
This change improves and cleans up the tile console. - We enable HVC_IRQ support on tilegx, with the addition of a new Tilera hypervisor API for tilegx to allow a console IPI. If IPI support is not available we fall back to the previous polling mode. - We simplify the earlyprintk code to use CON_BOOT and eliminate some of the other supporting earlyprintk code. - A new tile_console_write() primitive is used to send output to the console and is factored out of the hvc_tile driver. This lets us support a "sim_console" boot argument to allow using simulator hooks to send output to the "console" as a slightly faster alternative to emulating the hardware more directly. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/tile/kernel')
-rw-r--r--arch/tile/kernel/early_printk.c47
-rw-r--r--arch/tile/kernel/hvglue.lds3
-rw-r--r--arch/tile/kernel/reboot.c2
3 files changed, 13 insertions, 39 deletions
diff --git a/arch/tile/kernel/early_printk.c b/arch/tile/kernel/early_printk.c
index 34d72a151bf3..b608e00e7f6d 100644
--- a/arch/tile/kernel/early_printk.c
+++ b/arch/tile/kernel/early_printk.c
@@ -23,19 +23,24 @@
23 23
24static void early_hv_write(struct console *con, const char *s, unsigned n) 24static void early_hv_write(struct console *con, const char *s, unsigned n)
25{ 25{
26 hv_console_write((HV_VirtAddr) s, n); 26 tile_console_write(s, n);
27
28 /*
29 * Convert NL to NLCR (close enough to CRNL) during early boot.
30 * We assume newlines are at the ends of strings, which turns out
31 * to be good enough for early boot console output.
32 */
33 if (n && s[n-1] == '\n')
34 tile_console_write("\r", 1);
27} 35}
28 36
29static struct console early_hv_console = { 37static struct console early_hv_console = {
30 .name = "earlyhv", 38 .name = "earlyhv",
31 .write = early_hv_write, 39 .write = early_hv_write,
32 .flags = CON_PRINTBUFFER, 40 .flags = CON_PRINTBUFFER | CON_BOOT,
33 .index = -1, 41 .index = -1,
34}; 42};
35 43
36/* Direct interface for emergencies */
37static int early_console_complete;
38
39void early_panic(const char *fmt, ...) 44void early_panic(const char *fmt, ...)
40{ 45{
41 va_list ap; 46 va_list ap;
@@ -43,51 +48,21 @@ void early_panic(const char *fmt, ...)
43 va_start(ap, fmt); 48 va_start(ap, fmt);
44 early_printk("Kernel panic - not syncing: "); 49 early_printk("Kernel panic - not syncing: ");
45 early_vprintk(fmt, ap); 50 early_vprintk(fmt, ap);
46 early_console->write(early_console, "\n", 1); 51 early_printk("\n");
47 va_end(ap); 52 va_end(ap);
48 dump_stack(); 53 dump_stack();
49 hv_halt(); 54 hv_halt();
50} 55}
51 56
52static int __initdata keep_early;
53
54static int __init setup_early_printk(char *str) 57static int __init setup_early_printk(char *str)
55{ 58{
56 if (early_console) 59 if (early_console)
57 return 1; 60 return 1;
58 61
59 if (str != NULL && strncmp(str, "keep", 4) == 0)
60 keep_early = 1;
61
62 early_console = &early_hv_console; 62 early_console = &early_hv_console;
63 register_console(early_console); 63 register_console(early_console);
64 64
65 return 0; 65 return 0;
66} 66}
67 67
68void __init disable_early_printk(void)
69{
70 early_console_complete = 1;
71 if (!early_console)
72 return;
73 if (!keep_early) {
74 early_printk("disabling early console\n");
75 unregister_console(early_console);
76 early_console = NULL;
77 } else {
78 early_printk("keeping early console\n");
79 }
80}
81
82void warn_early_printk(void)
83{
84 if (early_console_complete || early_console)
85 return;
86 early_printk("\
87Machine shutting down before console output is fully initialized.\n\
88You may wish to reboot and add the option 'earlyprintk' to your\n\
89boot command line to see any diagnostic early console output.\n\
90");
91}
92
93early_param("earlyprintk", setup_early_printk); 68early_param("earlyprintk", setup_early_printk);
diff --git a/arch/tile/kernel/hvglue.lds b/arch/tile/kernel/hvglue.lds
index d44c5a67a1ed..ef522900633a 100644
--- a/arch/tile/kernel/hvglue.lds
+++ b/arch/tile/kernel/hvglue.lds
@@ -56,4 +56,5 @@ hv_inquire_realpa = TEXT_OFFSET + 0x106c0;
56hv_flush_all = TEXT_OFFSET + 0x106e0; 56hv_flush_all = TEXT_OFFSET + 0x106e0;
57hv_get_ipi_pte = TEXT_OFFSET + 0x10700; 57hv_get_ipi_pte = TEXT_OFFSET + 0x10700;
58hv_set_pte_super_shift = TEXT_OFFSET + 0x10720; 58hv_set_pte_super_shift = TEXT_OFFSET + 0x10720;
59hv_glue_internals = TEXT_OFFSET + 0x10740; 59hv_console_set_ipi = TEXT_OFFSET + 0x107e0;
60hv_glue_internals = TEXT_OFFSET + 0x10800;
diff --git a/arch/tile/kernel/reboot.c b/arch/tile/kernel/reboot.c
index d1b5c913ae72..6c5d2c070a12 100644
--- a/arch/tile/kernel/reboot.c
+++ b/arch/tile/kernel/reboot.c
@@ -27,7 +27,6 @@
27 27
28void machine_halt(void) 28void machine_halt(void)
29{ 29{
30 warn_early_printk();
31 arch_local_irq_disable_all(); 30 arch_local_irq_disable_all();
32 smp_send_stop(); 31 smp_send_stop();
33 hv_halt(); 32 hv_halt();
@@ -35,7 +34,6 @@ void machine_halt(void)
35 34
36void machine_power_off(void) 35void machine_power_off(void)
37{ 36{
38 warn_early_printk();
39 arch_local_irq_disable_all(); 37 arch_local_irq_disable_all();
40 smp_send_stop(); 38 smp_send_stop();
41 hv_power_off(); 39 hv_power_off();