aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2005-09-12 12:49:24 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-12 13:49:58 -0400
commit459192c92cde49d1a2f721c90adf45d774c2dcf5 (patch)
treec5d6639084a070d93987a6a7707535738e3cd24f /arch
parente5bc8b6baf86538f3d0407cf0880f86aec828a13 (diff)
[PATCH] x86-64: Add simnow console
This adds console and earlyprintk support for a host file on AMD's SimNow simulator. Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/kernel/early_printk.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/arch/x86_64/kernel/early_printk.c b/arch/x86_64/kernel/early_printk.c
index 9631c747c5e3..9cd968dd0f5a 100644
--- a/arch/x86_64/kernel/early_printk.c
+++ b/arch/x86_64/kernel/early_printk.c
@@ -5,6 +5,7 @@
5#include <linux/tty.h> 5#include <linux/tty.h>
6#include <asm/io.h> 6#include <asm/io.h>
7#include <asm/processor.h> 7#include <asm/processor.h>
8#include <asm/fcntl.h>
8 9
9/* Simple VGA output */ 10/* Simple VGA output */
10 11
@@ -158,6 +159,47 @@ static struct console early_serial_console = {
158 .index = -1, 159 .index = -1,
159}; 160};
160 161
162/* Console interface to a host file on AMD's SimNow! */
163
164static int simnow_fd;
165
166enum {
167 MAGIC1 = 0xBACCD00A,
168 MAGIC2 = 0xCA110000,
169 XOPEN = 5,
170 XWRITE = 4,
171};
172
173static noinline long simnow(long cmd, long a, long b, long c)
174{
175 long ret;
176 asm volatile("cpuid" :
177 "=a" (ret) :
178 "b" (a), "c" (b), "d" (c), "0" (MAGIC1), "D" (cmd + MAGIC2));
179 return ret;
180}
181
182void __init simnow_init(char *str)
183{
184 char *fn = "klog";
185 if (*str == '=')
186 fn = ++str;
187 /* error ignored */
188 simnow_fd = simnow(XOPEN, (unsigned long)fn, O_WRONLY|O_APPEND|O_CREAT, 0644);
189}
190
191static void simnow_write(struct console *con, const char *s, unsigned n)
192{
193 simnow(XWRITE, simnow_fd, (unsigned long)s, n);
194}
195
196static struct console simnow_console = {
197 .name = "simnow",
198 .write = simnow_write,
199 .flags = CON_PRINTBUFFER,
200 .index = -1,
201};
202
161/* Direct interface for emergencies */ 203/* Direct interface for emergencies */
162struct console *early_console = &early_vga_console; 204struct console *early_console = &early_vga_console;
163static int early_console_initialized = 0; 205static int early_console_initialized = 0;
@@ -205,6 +247,10 @@ int __init setup_early_printk(char *opt)
205 max_xpos = SCREEN_INFO.orig_video_cols; 247 max_xpos = SCREEN_INFO.orig_video_cols;
206 max_ypos = SCREEN_INFO.orig_video_lines; 248 max_ypos = SCREEN_INFO.orig_video_lines;
207 early_console = &early_vga_console; 249 early_console = &early_vga_console;
250 } else if (!strncmp(buf, "simnow", 6)) {
251 simnow_init(buf + 6);
252 early_console = &simnow_console;
253 keep_early = 1;
208 } 254 }
209 early_console_initialized = 1; 255 early_console_initialized = 1;
210 register_console(early_console); 256 register_console(early_console);