aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2007-10-11 05:17:24 -0400
committerThomas Gleixner <tglx@linutronix.de>2007-10-11 05:17:24 -0400
commit250c22777fe1ccd7ac588579a6c16db4c0161cc5 (patch)
tree55c317efb7d792ec6fdae1d1937c67a502c48dec /arch
parent2db55d344e529492545cb3b755c7e9ba8e4fa94e (diff)
x86_64: move kernel
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/boot/compressed/head_64.S2
-rw-r--r--arch/x86/kernel/Makefile2
-rw-r--r--arch/x86/kernel/Makefile_322
-rw-r--r--arch/x86/kernel/Makefile_64 (renamed from arch/x86_64/kernel/Makefile_64)9
-rw-r--r--arch/x86/kernel/acpi/wakeup_64.S2
-rw-r--r--arch/x86/kernel/aperture_64.c (renamed from arch/x86_64/kernel/aperture_64.c)0
-rw-r--r--arch/x86/kernel/apic_64.c (renamed from arch/x86_64/kernel/apic_64.c)0
-rw-r--r--arch/x86/kernel/asm-offsets_64.c (renamed from arch/x86_64/kernel/asm-offsets_64.c)0
-rw-r--r--arch/x86/kernel/audit_64.c (renamed from arch/x86_64/kernel/audit_64.c)0
-rw-r--r--arch/x86/kernel/bugs_64.c (renamed from arch/x86_64/kernel/bugs_64.c)0
-rw-r--r--arch/x86/kernel/crash_64.c (renamed from arch/x86_64/kernel/crash_64.c)0
-rw-r--r--arch/x86/kernel/crash_dump_64.c (renamed from arch/x86_64/kernel/crash_dump_64.c)0
-rw-r--r--arch/x86/kernel/e820_64.c (renamed from arch/x86_64/kernel/e820_64.c)0
-rw-r--r--arch/x86/kernel/early-quirks_64.c (renamed from arch/x86_64/kernel/early-quirks_64.c)0
-rw-r--r--arch/x86/kernel/early_printk.c259
-rw-r--r--arch/x86/kernel/entry_64.S (renamed from arch/x86_64/kernel/entry_64.S)0
-rw-r--r--arch/x86/kernel/genapic_64.c (renamed from arch/x86_64/kernel/genapic_64.c)0
-rw-r--r--arch/x86/kernel/genapic_flat_64.c (renamed from arch/x86_64/kernel/genapic_flat_64.c)0
-rw-r--r--arch/x86/kernel/head64.c (renamed from arch/x86_64/kernel/head64.c)0
-rw-r--r--arch/x86/kernel/head_64.S (renamed from arch/x86_64/kernel/head_64.S)0
-rw-r--r--arch/x86/kernel/hpet_64.c (renamed from arch/x86_64/kernel/hpet_64.c)0
-rw-r--r--arch/x86/kernel/i387_64.c (renamed from arch/x86_64/kernel/i387_64.c)0
-rw-r--r--arch/x86/kernel/i8259_64.c (renamed from arch/x86_64/kernel/i8259_64.c)0
-rw-r--r--arch/x86/kernel/init_task_64.c (renamed from arch/x86_64/kernel/init_task_64.c)0
-rw-r--r--arch/x86/kernel/io_apic_64.c (renamed from arch/x86_64/kernel/io_apic_64.c)0
-rw-r--r--arch/x86/kernel/ioport_64.c (renamed from arch/x86_64/kernel/ioport_64.c)0
-rw-r--r--arch/x86/kernel/irq_64.c (renamed from arch/x86_64/kernel/irq_64.c)0
-rw-r--r--arch/x86/kernel/k8.c (renamed from arch/x86_64/kernel/k8.c)0
-rw-r--r--arch/x86/kernel/kprobes_64.c (renamed from arch/x86_64/kernel/kprobes_64.c)0
-rw-r--r--arch/x86/kernel/ldt_64.c (renamed from arch/x86_64/kernel/ldt_64.c)0
-rw-r--r--arch/x86/kernel/machine_kexec_64.c (renamed from arch/x86_64/kernel/machine_kexec_64.c)0
-rw-r--r--arch/x86/kernel/mce_64.c (renamed from arch/x86_64/kernel/mce_64.c)0
-rw-r--r--arch/x86/kernel/mce_amd_64.c (renamed from arch/x86_64/kernel/mce_amd_64.c)0
-rw-r--r--arch/x86/kernel/mce_intel_64.c (renamed from arch/x86_64/kernel/mce_intel_64.c)0
-rw-r--r--arch/x86/kernel/module_64.c (renamed from arch/x86_64/kernel/module_64.c)0
-rw-r--r--arch/x86/kernel/mpparse_64.c (renamed from arch/x86_64/kernel/mpparse_64.c)0
-rw-r--r--arch/x86/kernel/nmi_64.c (renamed from arch/x86_64/kernel/nmi_64.c)0
-rw-r--r--arch/x86/kernel/pci-calgary_64.c (renamed from arch/x86_64/kernel/pci-calgary_64.c)0
-rw-r--r--arch/x86/kernel/pci-dma_64.c (renamed from arch/x86_64/kernel/pci-dma_64.c)0
-rw-r--r--arch/x86/kernel/pci-gart_64.c (renamed from arch/x86_64/kernel/pci-gart_64.c)0
-rw-r--r--arch/x86/kernel/pci-nommu_64.c (renamed from arch/x86_64/kernel/pci-nommu_64.c)0
-rw-r--r--arch/x86/kernel/pci-swiotlb_64.c (renamed from arch/x86_64/kernel/pci-swiotlb_64.c)0
-rw-r--r--arch/x86/kernel/pmtimer_64.c (renamed from arch/x86_64/kernel/pmtimer_64.c)0
-rw-r--r--arch/x86/kernel/process_64.c (renamed from arch/x86_64/kernel/process_64.c)0
-rw-r--r--arch/x86/kernel/ptrace_64.c (renamed from arch/x86_64/kernel/ptrace_64.c)0
-rw-r--r--arch/x86/kernel/reboot_64.c (renamed from arch/x86_64/kernel/reboot_64.c)0
-rw-r--r--arch/x86/kernel/relocate_kernel_64.S (renamed from arch/x86_64/kernel/relocate_kernel_64.S)0
-rw-r--r--arch/x86/kernel/setup64.c (renamed from arch/x86_64/kernel/setup64.c)0
-rw-r--r--arch/x86/kernel/setup_64.c (renamed from arch/x86_64/kernel/setup_64.c)0
-rw-r--r--arch/x86/kernel/signal_64.c (renamed from arch/x86_64/kernel/signal_64.c)0
-rw-r--r--arch/x86/kernel/smp_64.c (renamed from arch/x86_64/kernel/smp_64.c)0
-rw-r--r--arch/x86/kernel/smpboot_64.c (renamed from arch/x86_64/kernel/smpboot_64.c)0
-rw-r--r--arch/x86/kernel/stacktrace.c (renamed from arch/x86_64/kernel/stacktrace.c)0
-rw-r--r--arch/x86/kernel/suspend_64.c (renamed from arch/x86_64/kernel/suspend_64.c)0
-rw-r--r--arch/x86/kernel/suspend_asm_64.S (renamed from arch/x86_64/kernel/suspend_asm_64.S)0
-rw-r--r--arch/x86/kernel/sys_x86_64.c (renamed from arch/x86_64/kernel/sys_x86_64.c)0
-rw-r--r--arch/x86/kernel/syscall_64.c (renamed from arch/x86_64/kernel/syscall_64.c)0
-rw-r--r--arch/x86/kernel/tce_64.c (renamed from arch/x86_64/kernel/tce_64.c)0
-rw-r--r--arch/x86/kernel/time_64.c (renamed from arch/x86_64/kernel/time_64.c)0
-rw-r--r--arch/x86/kernel/trampoline_64.S (renamed from arch/x86_64/kernel/trampoline_64.S)0
-rw-r--r--arch/x86/kernel/traps_64.c (renamed from arch/x86_64/kernel/traps_64.c)0
-rw-r--r--arch/x86/kernel/tsc_64.c (renamed from arch/x86_64/kernel/tsc_64.c)0
-rw-r--r--arch/x86/kernel/tsc_sync.c188
-rw-r--r--arch/x86/kernel/verify_cpu_64.S (renamed from arch/x86_64/kernel/verify_cpu_64.S)0
-rw-r--r--arch/x86/kernel/vmlinux_64.lds.S (renamed from arch/x86_64/kernel/vmlinux_64.lds.S)0
-rw-r--r--arch/x86/kernel/vsmp_64.c (renamed from arch/x86_64/kernel/vsmp_64.c)0
-rw-r--r--arch/x86/kernel/vsyscall_64.c (renamed from arch/x86_64/kernel/vsyscall_64.c)0
-rw-r--r--arch/x86/kernel/x8664_ksyms_64.c (renamed from arch/x86_64/kernel/x8664_ksyms_64.c)0
-rw-r--r--arch/x86_64/Makefile11
-rw-r--r--arch/x86_64/kernel/Makefile5
-rw-r--r--arch/x86_64/kernel/asm-offsets.c5
-rw-r--r--arch/x86_64/kernel/early_printk.c259
-rw-r--r--arch/x86_64/kernel/tsc_sync.c187
-rw-r--r--arch/x86_64/kernel/vmlinux.lds.S5
74 files changed, 457 insertions, 479 deletions
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index cff3d1dc5dd4..49467640751f 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -174,7 +174,7 @@ no_longmode:
174 hlt 174 hlt
175 jmp 1b 175 jmp 1b
176 176
177#include "../../../x86_64/kernel/verify_cpu_64.S" 177#include "../../kernel/verify_cpu_64.S"
178 178
179 /* Be careful here startup_64 needs to be at a predictable 179 /* Be careful here startup_64 needs to be at a predictable
180 * address so I can export it in an ELF header. Bootloaders 180 * address so I can export it in an ELF header. Bootloaders
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 577d08f4b8bb..45855c97923e 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -1,5 +1,5 @@
1ifeq ($(CONFIG_X86_32),y) 1ifeq ($(CONFIG_X86_32),y)
2include ${srctree}/arch/x86/kernel/Makefile_32 2include ${srctree}/arch/x86/kernel/Makefile_32
3else 3else
4include ${srctree}/arch/x86_64/kernel/Makefile_64 4include ${srctree}/arch/x86/kernel/Makefile_64
5endif 5endif
diff --git a/arch/x86/kernel/Makefile_32 b/arch/x86/kernel/Makefile_32
index 5096f486d389..cb25523026a6 100644
--- a/arch/x86/kernel/Makefile_32
+++ b/arch/x86/kernel/Makefile_32
@@ -83,6 +83,4 @@ $(obj)/vsyscall-syms.o: $(src)/vsyscall_32.lds \
83 $(obj)/vsyscall-sysenter_32.o $(obj)/vsyscall-note_32.o FORCE 83 $(obj)/vsyscall-sysenter_32.o $(obj)/vsyscall-note_32.o FORCE
84 $(call if_changed,syscall) 84 $(call if_changed,syscall)
85 85
86k8-y += ../../x86_64/kernel/k8.o
87stacktrace-y += ../../x86_64/kernel/stacktrace.o
88 86
diff --git a/arch/x86_64/kernel/Makefile_64 b/arch/x86/kernel/Makefile_64
index 120d4e51fd4d..6e6b5909e465 100644
--- a/arch/x86_64/kernel/Makefile_64
+++ b/arch/x86/kernel/Makefile_64
@@ -49,15 +49,6 @@ obj-y += pcspeaker.o
49CFLAGS_vsyscall_64.o := $(PROFILING) -g0 49CFLAGS_vsyscall_64.o := $(PROFILING) -g0
50 50
51therm_throt-y += ../../x86/kernel/cpu/mcheck/therm_throt.o 51therm_throt-y += ../../x86/kernel/cpu/mcheck/therm_throt.o
52bootflag-y += ../../x86/kernel/bootflag.o
53cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../x86/kernel/cpuid.o
54topology-y += ../../x86/kernel/topology.o
55microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../x86/kernel/microcode.o
56intel_cacheinfo-y += ../../x86/kernel/cpu/intel_cacheinfo.o 52intel_cacheinfo-y += ../../x86/kernel/cpu/intel_cacheinfo.o
57addon_cpuid_features-y += ../../x86/kernel/cpu/addon_cpuid_features.o 53addon_cpuid_features-y += ../../x86/kernel/cpu/addon_cpuid_features.o
58quirks-y += ../../x86/kernel/quirks.o
59i8237-y += ../../x86/kernel/i8237.o
60msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../x86/kernel/msr.o
61alternative-y += ../../x86/kernel/alternative.o
62pcspeaker-y += ../../x86/kernel/pcspeaker.o
63perfctr-watchdog-y += ../../x86/kernel/cpu/perfctr-watchdog.o 54perfctr-watchdog-y += ../../x86/kernel/cpu/perfctr-watchdog.o
diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S
index 5e3b3f5496c5..8b4357e1efe0 100644
--- a/arch/x86/kernel/acpi/wakeup_64.S
+++ b/arch/x86/kernel/acpi/wakeup_64.S
@@ -269,7 +269,7 @@ no_longmode:
269 movb $0xbc,%al ; outb %al,$0x80 269 movb $0xbc,%al ; outb %al,$0x80
270 jmp no_longmode 270 jmp no_longmode
271 271
272#include "../../../x86_64/kernel/verify_cpu_64.S" 272#include "../verify_cpu_64.S"
273 273
274/* This code uses an extended set of video mode numbers. These include: 274/* This code uses an extended set of video mode numbers. These include:
275 * Aliases for standard modes 275 * Aliases for standard modes
diff --git a/arch/x86_64/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index 8f681cae7bf7..8f681cae7bf7 100644
--- a/arch/x86_64/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
diff --git a/arch/x86_64/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 925758dbca0c..925758dbca0c 100644
--- a/arch/x86_64/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
diff --git a/arch/x86_64/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index 778953bc636c..778953bc636c 100644
--- a/arch/x86_64/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
diff --git a/arch/x86_64/kernel/audit_64.c b/arch/x86/kernel/audit_64.c
index 06d3e5a14d9d..06d3e5a14d9d 100644
--- a/arch/x86_64/kernel/audit_64.c
+++ b/arch/x86/kernel/audit_64.c
diff --git a/arch/x86_64/kernel/bugs_64.c b/arch/x86/kernel/bugs_64.c
index 4e5e9d364d63..4e5e9d364d63 100644
--- a/arch/x86_64/kernel/bugs_64.c
+++ b/arch/x86/kernel/bugs_64.c
diff --git a/arch/x86_64/kernel/crash_64.c b/arch/x86/kernel/crash_64.c
index 13432a1ae904..13432a1ae904 100644
--- a/arch/x86_64/kernel/crash_64.c
+++ b/arch/x86/kernel/crash_64.c
diff --git a/arch/x86_64/kernel/crash_dump_64.c b/arch/x86/kernel/crash_dump_64.c
index 942deac4d43a..942deac4d43a 100644
--- a/arch/x86_64/kernel/crash_dump_64.c
+++ b/arch/x86/kernel/crash_dump_64.c
diff --git a/arch/x86_64/kernel/e820_64.c b/arch/x86/kernel/e820_64.c
index 0f4d5e209e9b..0f4d5e209e9b 100644
--- a/arch/x86_64/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
diff --git a/arch/x86_64/kernel/early-quirks_64.c b/arch/x86/kernel/early-quirks_64.c
index 13aa4fd728f3..13aa4fd728f3 100644
--- a/arch/x86_64/kernel/early-quirks_64.c
+++ b/arch/x86/kernel/early-quirks_64.c
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index 92f812ba275c..fd9aff3f3890 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -1,2 +1,259 @@
1#include <linux/console.h>
2#include <linux/kernel.h>
3#include <linux/init.h>
4#include <linux/string.h>
5#include <linux/screen_info.h>
6#include <asm/io.h>
7#include <asm/processor.h>
8#include <asm/fcntl.h>
9#include <xen/hvc-console.h>
1 10
2#include "../../x86_64/kernel/early_printk.c" 11/* Simple VGA output */
12
13#ifdef __i386__
14#include <asm/setup.h>
15#else
16#include <asm/bootsetup.h>
17#endif
18#define VGABASE (__ISA_IO_base + 0xb8000)
19
20static int max_ypos = 25, max_xpos = 80;
21static int current_ypos = 25, current_xpos = 0;
22
23static void early_vga_write(struct console *con, const char *str, unsigned n)
24{
25 char c;
26 int i, k, j;
27
28 while ((c = *str++) != '\0' && n-- > 0) {
29 if (current_ypos >= max_ypos) {
30 /* scroll 1 line up */
31 for (k = 1, j = 0; k < max_ypos; k++, j++) {
32 for (i = 0; i < max_xpos; i++) {
33 writew(readw(VGABASE+2*(max_xpos*k+i)),
34 VGABASE + 2*(max_xpos*j + i));
35 }
36 }
37 for (i = 0; i < max_xpos; i++)
38 writew(0x720, VGABASE + 2*(max_xpos*j + i));
39 current_ypos = max_ypos-1;
40 }
41 if (c == '\n') {
42 current_xpos = 0;
43 current_ypos++;
44 } else if (c != '\r') {
45 writew(((0x7 << 8) | (unsigned short) c),
46 VGABASE + 2*(max_xpos*current_ypos +
47 current_xpos++));
48 if (current_xpos >= max_xpos) {
49 current_xpos = 0;
50 current_ypos++;
51 }
52 }
53 }
54}
55
56static struct console early_vga_console = {
57 .name = "earlyvga",
58 .write = early_vga_write,
59 .flags = CON_PRINTBUFFER,
60 .index = -1,
61};
62
63/* Serial functions loosely based on a similar package from Klaus P. Gerlicher */
64
65static int early_serial_base = 0x3f8; /* ttyS0 */
66
67#define XMTRDY 0x20
68
69#define DLAB 0x80
70
71#define TXR 0 /* Transmit register (WRITE) */
72#define RXR 0 /* Receive register (READ) */
73#define IER 1 /* Interrupt Enable */
74#define IIR 2 /* Interrupt ID */
75#define FCR 2 /* FIFO control */
76#define LCR 3 /* Line control */
77#define MCR 4 /* Modem control */
78#define LSR 5 /* Line Status */
79#define MSR 6 /* Modem Status */
80#define DLL 0 /* Divisor Latch Low */
81#define DLH 1 /* Divisor latch High */
82
83static int early_serial_putc(unsigned char ch)
84{
85 unsigned timeout = 0xffff;
86 while ((inb(early_serial_base + LSR) & XMTRDY) == 0 && --timeout)
87 cpu_relax();
88 outb(ch, early_serial_base + TXR);
89 return timeout ? 0 : -1;
90}
91
92static void early_serial_write(struct console *con, const char *s, unsigned n)
93{
94 while (*s && n-- > 0) {
95 if (*s == '\n')
96 early_serial_putc('\r');
97 early_serial_putc(*s);
98 s++;
99 }
100}
101
102#define DEFAULT_BAUD 9600
103
104static __init void early_serial_init(char *s)
105{
106 unsigned char c;
107 unsigned divisor;
108 unsigned baud = DEFAULT_BAUD;
109 char *e;
110
111 if (*s == ',')
112 ++s;
113
114 if (*s) {
115 unsigned port;
116 if (!strncmp(s,"0x",2)) {
117 early_serial_base = simple_strtoul(s, &e, 16);
118 } else {
119 static int bases[] = { 0x3f8, 0x2f8 };
120
121 if (!strncmp(s,"ttyS",4))
122 s += 4;
123 port = simple_strtoul(s, &e, 10);
124 if (port > 1 || s == e)
125 port = 0;
126 early_serial_base = bases[port];
127 }
128 s += strcspn(s, ",");
129 if (*s == ',')
130 s++;
131 }
132
133 outb(0x3, early_serial_base + LCR); /* 8n1 */
134 outb(0, early_serial_base + IER); /* no interrupt */
135 outb(0, early_serial_base + FCR); /* no fifo */
136 outb(0x3, early_serial_base + MCR); /* DTR + RTS */
137
138 if (*s) {
139 baud = simple_strtoul(s, &e, 0);
140 if (baud == 0 || s == e)
141 baud = DEFAULT_BAUD;
142 }
143
144 divisor = 115200 / baud;
145 c = inb(early_serial_base + LCR);
146 outb(c | DLAB, early_serial_base + LCR);
147 outb(divisor & 0xff, early_serial_base + DLL);
148 outb((divisor >> 8) & 0xff, early_serial_base + DLH);
149 outb(c & ~DLAB, early_serial_base + LCR);
150}
151
152static struct console early_serial_console = {
153 .name = "earlyser",
154 .write = early_serial_write,
155 .flags = CON_PRINTBUFFER,
156 .index = -1,
157};
158
159/* Console interface to a host file on AMD's SimNow! */
160
161static int simnow_fd;
162
163enum {
164 MAGIC1 = 0xBACCD00A,
165 MAGIC2 = 0xCA110000,
166 XOPEN = 5,
167 XWRITE = 4,
168};
169
170static noinline long simnow(long cmd, long a, long b, long c)
171{
172 long ret;
173 asm volatile("cpuid" :
174 "=a" (ret) :
175 "b" (a), "c" (b), "d" (c), "0" (MAGIC1), "D" (cmd + MAGIC2));
176 return ret;
177}
178
179static void __init simnow_init(char *str)
180{
181 char *fn = "klog";
182 if (*str == '=')
183 fn = ++str;
184 /* error ignored */
185 simnow_fd = simnow(XOPEN, (unsigned long)fn, O_WRONLY|O_APPEND|O_CREAT, 0644);
186}
187
188static void simnow_write(struct console *con, const char *s, unsigned n)
189{
190 simnow(XWRITE, simnow_fd, (unsigned long)s, n);
191}
192
193static struct console simnow_console = {
194 .name = "simnow",
195 .write = simnow_write,
196 .flags = CON_PRINTBUFFER,
197 .index = -1,
198};
199
200/* Direct interface for emergencies */
201struct console *early_console = &early_vga_console;
202static int early_console_initialized = 0;
203
204void early_printk(const char *fmt, ...)
205{
206 char buf[512];
207 int n;
208 va_list ap;
209
210 va_start(ap,fmt);
211 n = vscnprintf(buf,512,fmt,ap);
212 early_console->write(early_console,buf,n);
213 va_end(ap);
214}
215
216static int __initdata keep_early;
217
218static int __init setup_early_printk(char *buf)
219{
220 if (!buf)
221 return 0;
222
223 if (early_console_initialized)
224 return 0;
225 early_console_initialized = 1;
226
227 if (strstr(buf, "keep"))
228 keep_early = 1;
229
230 if (!strncmp(buf, "serial", 6)) {
231 early_serial_init(buf + 6);
232 early_console = &early_serial_console;
233 } else if (!strncmp(buf, "ttyS", 4)) {
234 early_serial_init(buf);
235 early_console = &early_serial_console;
236 } else if (!strncmp(buf, "vga", 3)
237 && SCREEN_INFO.orig_video_isVGA == 1) {
238 max_xpos = SCREEN_INFO.orig_video_cols;
239 max_ypos = SCREEN_INFO.orig_video_lines;
240 current_ypos = SCREEN_INFO.orig_y;
241 early_console = &early_vga_console;
242 } else if (!strncmp(buf, "simnow", 6)) {
243 simnow_init(buf + 6);
244 early_console = &simnow_console;
245 keep_early = 1;
246#ifdef CONFIG_HVC_XEN
247 } else if (!strncmp(buf, "xen", 3)) {
248 early_console = &xenboot_console;
249#endif
250 }
251
252 if (keep_early)
253 early_console->flags &= ~CON_BOOT;
254 else
255 early_console->flags |= CON_BOOT;
256 register_console(early_console);
257 return 0;
258}
259early_param("earlyprintk", setup_early_printk);
diff --git a/arch/x86_64/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 1d232e5f5658..1d232e5f5658 100644
--- a/arch/x86_64/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
diff --git a/arch/x86_64/kernel/genapic_64.c b/arch/x86/kernel/genapic_64.c
index 47496a40e84f..47496a40e84f 100644
--- a/arch/x86_64/kernel/genapic_64.c
+++ b/arch/x86/kernel/genapic_64.c
diff --git a/arch/x86_64/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c
index ecb01eefdd27..ecb01eefdd27 100644
--- a/arch/x86_64/kernel/genapic_flat_64.c
+++ b/arch/x86/kernel/genapic_flat_64.c
diff --git a/arch/x86_64/kernel/head64.c b/arch/x86/kernel/head64.c
index 6c34bdd22e26..6c34bdd22e26 100644
--- a/arch/x86_64/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
diff --git a/arch/x86_64/kernel/head_64.S b/arch/x86/kernel/head_64.S
index b6167fe3330e..b6167fe3330e 100644
--- a/arch/x86_64/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
diff --git a/arch/x86_64/kernel/hpet_64.c b/arch/x86/kernel/hpet_64.c
index e2d1b912e154..e2d1b912e154 100644
--- a/arch/x86_64/kernel/hpet_64.c
+++ b/arch/x86/kernel/hpet_64.c
diff --git a/arch/x86_64/kernel/i387_64.c b/arch/x86/kernel/i387_64.c
index 1d58c13bc6bc..1d58c13bc6bc 100644
--- a/arch/x86_64/kernel/i387_64.c
+++ b/arch/x86/kernel/i387_64.c
diff --git a/arch/x86_64/kernel/i8259_64.c b/arch/x86/kernel/i8259_64.c
index 948cae646099..948cae646099 100644
--- a/arch/x86_64/kernel/i8259_64.c
+++ b/arch/x86/kernel/i8259_64.c
diff --git a/arch/x86_64/kernel/init_task_64.c b/arch/x86/kernel/init_task_64.c
index 4ff33d4f8551..4ff33d4f8551 100644
--- a/arch/x86_64/kernel/init_task_64.c
+++ b/arch/x86/kernel/init_task_64.c
diff --git a/arch/x86_64/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 966fa1062491..966fa1062491 100644
--- a/arch/x86_64/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
diff --git a/arch/x86_64/kernel/ioport_64.c b/arch/x86/kernel/ioport_64.c
index 653efa30b0f4..653efa30b0f4 100644
--- a/arch/x86_64/kernel/ioport_64.c
+++ b/arch/x86/kernel/ioport_64.c
diff --git a/arch/x86_64/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index 39cb3fa83ebb..39cb3fa83ebb 100644
--- a/arch/x86_64/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
diff --git a/arch/x86_64/kernel/k8.c b/arch/x86/kernel/k8.c
index 7377ccb21335..7377ccb21335 100644
--- a/arch/x86_64/kernel/k8.c
+++ b/arch/x86/kernel/k8.c
diff --git a/arch/x86_64/kernel/kprobes_64.c b/arch/x86/kernel/kprobes_64.c
index a30e004682e2..a30e004682e2 100644
--- a/arch/x86_64/kernel/kprobes_64.c
+++ b/arch/x86/kernel/kprobes_64.c
diff --git a/arch/x86_64/kernel/ldt_64.c b/arch/x86/kernel/ldt_64.c
index bc9ffd5c19cc..bc9ffd5c19cc 100644
--- a/arch/x86_64/kernel/ldt_64.c
+++ b/arch/x86/kernel/ldt_64.c
diff --git a/arch/x86_64/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index c3a554703672..c3a554703672 100644
--- a/arch/x86_64/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
diff --git a/arch/x86_64/kernel/mce_64.c b/arch/x86/kernel/mce_64.c
index a66d607f5b92..a66d607f5b92 100644
--- a/arch/x86_64/kernel/mce_64.c
+++ b/arch/x86/kernel/mce_64.c
diff --git a/arch/x86_64/kernel/mce_amd_64.c b/arch/x86/kernel/mce_amd_64.c
index 2f8a7f18b0fe..2f8a7f18b0fe 100644
--- a/arch/x86_64/kernel/mce_amd_64.c
+++ b/arch/x86/kernel/mce_amd_64.c
diff --git a/arch/x86_64/kernel/mce_intel_64.c b/arch/x86/kernel/mce_intel_64.c
index 6551505d8a2c..6551505d8a2c 100644
--- a/arch/x86_64/kernel/mce_intel_64.c
+++ b/arch/x86/kernel/mce_intel_64.c
diff --git a/arch/x86_64/kernel/module_64.c b/arch/x86/kernel/module_64.c
index a888e67f5874..a888e67f5874 100644
--- a/arch/x86_64/kernel/module_64.c
+++ b/arch/x86/kernel/module_64.c
diff --git a/arch/x86_64/kernel/mpparse_64.c b/arch/x86/kernel/mpparse_64.c
index 8bf0ca03ac8e..8bf0ca03ac8e 100644
--- a/arch/x86_64/kernel/mpparse_64.c
+++ b/arch/x86/kernel/mpparse_64.c
diff --git a/arch/x86_64/kernel/nmi_64.c b/arch/x86/kernel/nmi_64.c
index 0ec6d2ddb931..0ec6d2ddb931 100644
--- a/arch/x86_64/kernel/nmi_64.c
+++ b/arch/x86/kernel/nmi_64.c
diff --git a/arch/x86_64/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 71da01e73f03..71da01e73f03 100644
--- a/arch/x86_64/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
diff --git a/arch/x86_64/kernel/pci-dma_64.c b/arch/x86/kernel/pci-dma_64.c
index 29711445c818..29711445c818 100644
--- a/arch/x86_64/kernel/pci-dma_64.c
+++ b/arch/x86/kernel/pci-dma_64.c
diff --git a/arch/x86_64/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index 4918c575d582..4918c575d582 100644
--- a/arch/x86_64/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
diff --git a/arch/x86_64/kernel/pci-nommu_64.c b/arch/x86/kernel/pci-nommu_64.c
index 2a34c6c025a9..2a34c6c025a9 100644
--- a/arch/x86_64/kernel/pci-nommu_64.c
+++ b/arch/x86/kernel/pci-nommu_64.c
diff --git a/arch/x86_64/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c
index b2f405ea7c85..b2f405ea7c85 100644
--- a/arch/x86_64/kernel/pci-swiotlb_64.c
+++ b/arch/x86/kernel/pci-swiotlb_64.c
diff --git a/arch/x86_64/kernel/pmtimer_64.c b/arch/x86/kernel/pmtimer_64.c
index ae8f91214f15..ae8f91214f15 100644
--- a/arch/x86_64/kernel/pmtimer_64.c
+++ b/arch/x86/kernel/pmtimer_64.c
diff --git a/arch/x86_64/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 98956555450b..98956555450b 100644
--- a/arch/x86_64/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
diff --git a/arch/x86_64/kernel/ptrace_64.c b/arch/x86/kernel/ptrace_64.c
index eea3702427b4..eea3702427b4 100644
--- a/arch/x86_64/kernel/ptrace_64.c
+++ b/arch/x86/kernel/ptrace_64.c
diff --git a/arch/x86_64/kernel/reboot_64.c b/arch/x86/kernel/reboot_64.c
index 368db2b9c5ac..368db2b9c5ac 100644
--- a/arch/x86_64/kernel/reboot_64.c
+++ b/arch/x86/kernel/reboot_64.c
diff --git a/arch/x86_64/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
index 14e95872c6a3..14e95872c6a3 100644
--- a/arch/x86_64/kernel/relocate_kernel_64.S
+++ b/arch/x86/kernel/relocate_kernel_64.S
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86/kernel/setup64.c
index 1200aaac403e..1200aaac403e 100644
--- a/arch/x86_64/kernel/setup64.c
+++ b/arch/x86/kernel/setup64.c
diff --git a/arch/x86_64/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index af838f6b0b7f..af838f6b0b7f 100644
--- a/arch/x86_64/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
diff --git a/arch/x86_64/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index 739175b01e06..739175b01e06 100644
--- a/arch/x86_64/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
diff --git a/arch/x86_64/kernel/smp_64.c b/arch/x86/kernel/smp_64.c
index df4a82812adb..df4a82812adb 100644
--- a/arch/x86_64/kernel/smp_64.c
+++ b/arch/x86/kernel/smp_64.c
diff --git a/arch/x86_64/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index 32f50783edc8..32f50783edc8 100644
--- a/arch/x86_64/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
diff --git a/arch/x86_64/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c
index cb9109113584..cb9109113584 100644
--- a/arch/x86_64/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
diff --git a/arch/x86_64/kernel/suspend_64.c b/arch/x86/kernel/suspend_64.c
index 573c0a6e0ac6..573c0a6e0ac6 100644
--- a/arch/x86_64/kernel/suspend_64.c
+++ b/arch/x86/kernel/suspend_64.c
diff --git a/arch/x86_64/kernel/suspend_asm_64.S b/arch/x86/kernel/suspend_asm_64.S
index 16d183f67bc1..16d183f67bc1 100644
--- a/arch/x86_64/kernel/suspend_asm_64.S
+++ b/arch/x86/kernel/suspend_asm_64.S
diff --git a/arch/x86_64/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
index 4770b7a2052c..4770b7a2052c 100644
--- a/arch/x86_64/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
diff --git a/arch/x86_64/kernel/syscall_64.c b/arch/x86/kernel/syscall_64.c
index 63d592c276cc..63d592c276cc 100644
--- a/arch/x86_64/kernel/syscall_64.c
+++ b/arch/x86/kernel/syscall_64.c
diff --git a/arch/x86_64/kernel/tce_64.c b/arch/x86/kernel/tce_64.c
index e3f2569b2c44..e3f2569b2c44 100644
--- a/arch/x86_64/kernel/tce_64.c
+++ b/arch/x86/kernel/tce_64.c
diff --git a/arch/x86_64/kernel/time_64.c b/arch/x86/kernel/time_64.c
index 6d48a4e826d9..6d48a4e826d9 100644
--- a/arch/x86_64/kernel/time_64.c
+++ b/arch/x86/kernel/time_64.c
diff --git a/arch/x86_64/kernel/trampoline_64.S b/arch/x86/kernel/trampoline_64.S
index 607983b0d27b..607983b0d27b 100644
--- a/arch/x86_64/kernel/trampoline_64.S
+++ b/arch/x86/kernel/trampoline_64.S
diff --git a/arch/x86_64/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index 03888420775d..03888420775d 100644
--- a/arch/x86_64/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
diff --git a/arch/x86_64/kernel/tsc_64.c b/arch/x86/kernel/tsc_64.c
index 2a59bde663f2..2a59bde663f2 100644
--- a/arch/x86_64/kernel/tsc_64.c
+++ b/arch/x86/kernel/tsc_64.c
diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c
index 12424629af87..355f5f506c81 100644
--- a/arch/x86/kernel/tsc_sync.c
+++ b/arch/x86/kernel/tsc_sync.c
@@ -1 +1,187 @@
1#include "../../x86_64/kernel/tsc_sync.c" 1/*
2 * arch/x86_64/kernel/tsc_sync.c: check TSC synchronization.
3 *
4 * Copyright (C) 2006, Red Hat, Inc., Ingo Molnar
5 *
6 * We check whether all boot CPUs have their TSC's synchronized,
7 * print a warning if not and turn off the TSC clock-source.
8 *
9 * The warp-check is point-to-point between two CPUs, the CPU
10 * initiating the bootup is the 'source CPU', the freshly booting
11 * CPU is the 'target CPU'.
12 *
13 * Only two CPUs may participate - they can enter in any order.
14 * ( The serial nature of the boot logic and the CPU hotplug lock
15 * protects against more than 2 CPUs entering this code. )
16 */
17#include <linux/spinlock.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/smp.h>
21#include <linux/nmi.h>
22#include <asm/tsc.h>
23
24/*
25 * Entry/exit counters that make sure that both CPUs
26 * run the measurement code at once:
27 */
28static __cpuinitdata atomic_t start_count;
29static __cpuinitdata atomic_t stop_count;
30
31/*
32 * We use a raw spinlock in this exceptional case, because
33 * we want to have the fastest, inlined, non-debug version
34 * of a critical section, to be able to prove TSC time-warps:
35 */
36static __cpuinitdata raw_spinlock_t sync_lock = __RAW_SPIN_LOCK_UNLOCKED;
37static __cpuinitdata cycles_t last_tsc;
38static __cpuinitdata cycles_t max_warp;
39static __cpuinitdata int nr_warps;
40
41/*
42 * TSC-warp measurement loop running on both CPUs:
43 */
44static __cpuinit void check_tsc_warp(void)
45{
46 cycles_t start, now, prev, end;
47 int i;
48
49 start = get_cycles_sync();
50 /*
51 * The measurement runs for 20 msecs:
52 */
53 end = start + tsc_khz * 20ULL;
54 now = start;
55
56 for (i = 0; ; i++) {
57 /*
58 * We take the global lock, measure TSC, save the
59 * previous TSC that was measured (possibly on
60 * another CPU) and update the previous TSC timestamp.
61 */
62 __raw_spin_lock(&sync_lock);
63 prev = last_tsc;
64 now = get_cycles_sync();
65 last_tsc = now;
66 __raw_spin_unlock(&sync_lock);
67
68 /*
69 * Be nice every now and then (and also check whether
70 * measurement is done [we also insert a 100 million
71 * loops safety exit, so we dont lock up in case the
72 * TSC readout is totally broken]):
73 */
74 if (unlikely(!(i & 7))) {
75 if (now > end || i > 100000000)
76 break;
77 cpu_relax();
78 touch_nmi_watchdog();
79 }
80 /*
81 * Outside the critical section we can now see whether
82 * we saw a time-warp of the TSC going backwards:
83 */
84 if (unlikely(prev > now)) {
85 __raw_spin_lock(&sync_lock);
86 max_warp = max(max_warp, prev - now);
87 nr_warps++;
88 __raw_spin_unlock(&sync_lock);
89 }
90
91 }
92}
93
94/*
95 * Source CPU calls into this - it waits for the freshly booted
96 * target CPU to arrive and then starts the measurement:
97 */
98void __cpuinit check_tsc_sync_source(int cpu)
99{
100 int cpus = 2;
101
102 /*
103 * No need to check if we already know that the TSC is not
104 * synchronized:
105 */
106 if (unsynchronized_tsc())
107 return;
108
109 printk(KERN_INFO "checking TSC synchronization [CPU#%d -> CPU#%d]:",
110 smp_processor_id(), cpu);
111
112 /*
113 * Reset it - in case this is a second bootup:
114 */
115 atomic_set(&stop_count, 0);
116
117 /*
118 * Wait for the target to arrive:
119 */
120 while (atomic_read(&start_count) != cpus-1)
121 cpu_relax();
122 /*
123 * Trigger the target to continue into the measurement too:
124 */
125 atomic_inc(&start_count);
126
127 check_tsc_warp();
128
129 while (atomic_read(&stop_count) != cpus-1)
130 cpu_relax();
131
132 /*
133 * Reset it - just in case we boot another CPU later:
134 */
135 atomic_set(&start_count, 0);
136
137 if (nr_warps) {
138 printk("\n");
139 printk(KERN_WARNING "Measured %Ld cycles TSC warp between CPUs,"
140 " turning off TSC clock.\n", max_warp);
141 mark_tsc_unstable("check_tsc_sync_source failed");
142 nr_warps = 0;
143 max_warp = 0;
144 last_tsc = 0;
145 } else {
146 printk(" passed.\n");
147 }
148
149 /*
150 * Let the target continue with the bootup:
151 */
152 atomic_inc(&stop_count);
153}
154
155/*
156 * Freshly booted CPUs call into this:
157 */
158void __cpuinit check_tsc_sync_target(void)
159{
160 int cpus = 2;
161
162 if (unsynchronized_tsc())
163 return;
164
165 /*
166 * Register this CPU's participation and wait for the
167 * source CPU to start the measurement:
168 */
169 atomic_inc(&start_count);
170 while (atomic_read(&start_count) != cpus)
171 cpu_relax();
172
173 check_tsc_warp();
174
175 /*
176 * Ok, we are done:
177 */
178 atomic_inc(&stop_count);
179
180 /*
181 * Wait for the source CPU to print stuff:
182 */
183 while (atomic_read(&stop_count) != cpus)
184 cpu_relax();
185}
186#undef NR_LOOPS
187
diff --git a/arch/x86_64/kernel/verify_cpu_64.S b/arch/x86/kernel/verify_cpu_64.S
index 45b6f8a975a1..45b6f8a975a1 100644
--- a/arch/x86_64/kernel/verify_cpu_64.S
+++ b/arch/x86/kernel/verify_cpu_64.S
diff --git a/arch/x86_64/kernel/vmlinux_64.lds.S b/arch/x86/kernel/vmlinux_64.lds.S
index ba8ea97abd21..ba8ea97abd21 100644
--- a/arch/x86_64/kernel/vmlinux_64.lds.S
+++ b/arch/x86/kernel/vmlinux_64.lds.S
diff --git a/arch/x86_64/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c
index 414caf0c5f9a..414caf0c5f9a 100644
--- a/arch/x86_64/kernel/vsmp_64.c
+++ b/arch/x86/kernel/vsmp_64.c
diff --git a/arch/x86_64/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 06c34949bfdc..06c34949bfdc 100644
--- a/arch/x86_64/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
diff --git a/arch/x86_64/kernel/x8664_ksyms_64.c b/arch/x86/kernel/x8664_ksyms_64.c
index 77c25b307635..77c25b307635 100644
--- a/arch/x86_64/kernel/x8664_ksyms_64.c
+++ b/arch/x86/kernel/x8664_ksyms_64.c
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile
index 189d80d3a891..afaf0f998878 100644
--- a/arch/x86_64/Makefile
+++ b/arch/x86_64/Makefile
@@ -21,6 +21,13 @@
21# 21#
22# $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $ 22# $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $
23 23
24# Fill in SRCARCH
25SRCARCH := x86
26
27archprepare:
28 @mkdir -p ${objtree}/arch/x86/kernel
29
30
24LDFLAGS := -m elf_x86_64 31LDFLAGS := -m elf_x86_64
25OBJCOPYFLAGS := -O binary -R .note -R .comment -S 32OBJCOPYFLAGS := -O binary -R .note -R .comment -S
26LDFLAGS_vmlinux := 33LDFLAGS_vmlinux :=
@@ -71,10 +78,10 @@ CFLAGS += $(cflags-y)
71CFLAGS_KERNEL += $(cflags-kernel-y) 78CFLAGS_KERNEL += $(cflags-kernel-y)
72AFLAGS += -m64 79AFLAGS += -m64
73 80
74head-y := arch/x86_64/kernel/head_64.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task_64.o 81head-y := arch/x86/kernel/head_64.o arch/x86/kernel/head64.o arch/x86/kernel/init_task_64.o
75 82
76libs-y += arch/x86/lib/ 83libs-y += arch/x86/lib/
77core-y += arch/x86_64/kernel/ \ 84core-y += arch/x86/kernel/ \
78 arch/x86/mm/ \ 85 arch/x86/mm/ \
79 arch/x86/crypto/ \ 86 arch/x86/crypto/ \
80 arch/x86/vdso/ 87 arch/x86/vdso/
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
deleted file mode 100644
index 577d08f4b8bb..000000000000
--- a/arch/x86_64/kernel/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1ifeq ($(CONFIG_X86_32),y)
2include ${srctree}/arch/x86/kernel/Makefile_32
3else
4include ${srctree}/arch/x86_64/kernel/Makefile_64
5endif
diff --git a/arch/x86_64/kernel/asm-offsets.c b/arch/x86_64/kernel/asm-offsets.c
deleted file mode 100644
index cfa82c899f47..000000000000
--- a/arch/x86_64/kernel/asm-offsets.c
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "asm-offsets_32.c"
3#else
4# include "asm-offsets_64.c"
5#endif
diff --git a/arch/x86_64/kernel/early_printk.c b/arch/x86_64/kernel/early_printk.c
deleted file mode 100644
index fd9aff3f3890..000000000000
--- a/arch/x86_64/kernel/early_printk.c
+++ /dev/null
@@ -1,259 +0,0 @@
1#include <linux/console.h>
2#include <linux/kernel.h>
3#include <linux/init.h>
4#include <linux/string.h>
5#include <linux/screen_info.h>
6#include <asm/io.h>
7#include <asm/processor.h>
8#include <asm/fcntl.h>
9#include <xen/hvc-console.h>
10
11/* Simple VGA output */
12
13#ifdef __i386__
14#include <asm/setup.h>
15#else
16#include <asm/bootsetup.h>
17#endif
18#define VGABASE (__ISA_IO_base + 0xb8000)
19
20static int max_ypos = 25, max_xpos = 80;
21static int current_ypos = 25, current_xpos = 0;
22
23static void early_vga_write(struct console *con, const char *str, unsigned n)
24{
25 char c;
26 int i, k, j;
27
28 while ((c = *str++) != '\0' && n-- > 0) {
29 if (current_ypos >= max_ypos) {
30 /* scroll 1 line up */
31 for (k = 1, j = 0; k < max_ypos; k++, j++) {
32 for (i = 0; i < max_xpos; i++) {
33 writew(readw(VGABASE+2*(max_xpos*k+i)),
34 VGABASE + 2*(max_xpos*j + i));
35 }
36 }
37 for (i = 0; i < max_xpos; i++)
38 writew(0x720, VGABASE + 2*(max_xpos*j + i));
39 current_ypos = max_ypos-1;
40 }
41 if (c == '\n') {
42 current_xpos = 0;
43 current_ypos++;
44 } else if (c != '\r') {
45 writew(((0x7 << 8) | (unsigned short) c),
46 VGABASE + 2*(max_xpos*current_ypos +
47 current_xpos++));
48 if (current_xpos >= max_xpos) {
49 current_xpos = 0;
50 current_ypos++;
51 }
52 }
53 }
54}
55
56static struct console early_vga_console = {
57 .name = "earlyvga",
58 .write = early_vga_write,
59 .flags = CON_PRINTBUFFER,
60 .index = -1,
61};
62
63/* Serial functions loosely based on a similar package from Klaus P. Gerlicher */
64
65static int early_serial_base = 0x3f8; /* ttyS0 */
66
67#define XMTRDY 0x20
68
69#define DLAB 0x80
70
71#define TXR 0 /* Transmit register (WRITE) */
72#define RXR 0 /* Receive register (READ) */
73#define IER 1 /* Interrupt Enable */
74#define IIR 2 /* Interrupt ID */
75#define FCR 2 /* FIFO control */
76#define LCR 3 /* Line control */
77#define MCR 4 /* Modem control */
78#define LSR 5 /* Line Status */
79#define MSR 6 /* Modem Status */
80#define DLL 0 /* Divisor Latch Low */
81#define DLH 1 /* Divisor latch High */
82
83static int early_serial_putc(unsigned char ch)
84{
85 unsigned timeout = 0xffff;
86 while ((inb(early_serial_base + LSR) & XMTRDY) == 0 && --timeout)
87 cpu_relax();
88 outb(ch, early_serial_base + TXR);
89 return timeout ? 0 : -1;
90}
91
92static void early_serial_write(struct console *con, const char *s, unsigned n)
93{
94 while (*s && n-- > 0) {
95 if (*s == '\n')
96 early_serial_putc('\r');
97 early_serial_putc(*s);
98 s++;
99 }
100}
101
102#define DEFAULT_BAUD 9600
103
104static __init void early_serial_init(char *s)
105{
106 unsigned char c;
107 unsigned divisor;
108 unsigned baud = DEFAULT_BAUD;
109 char *e;
110
111 if (*s == ',')
112 ++s;
113
114 if (*s) {
115 unsigned port;
116 if (!strncmp(s,"0x",2)) {
117 early_serial_base = simple_strtoul(s, &e, 16);
118 } else {
119 static int bases[] = { 0x3f8, 0x2f8 };
120
121 if (!strncmp(s,"ttyS",4))
122 s += 4;
123 port = simple_strtoul(s, &e, 10);
124 if (port > 1 || s == e)
125 port = 0;
126 early_serial_base = bases[port];
127 }
128 s += strcspn(s, ",");
129 if (*s == ',')
130 s++;
131 }
132
133 outb(0x3, early_serial_base + LCR); /* 8n1 */
134 outb(0, early_serial_base + IER); /* no interrupt */
135 outb(0, early_serial_base + FCR); /* no fifo */
136 outb(0x3, early_serial_base + MCR); /* DTR + RTS */
137
138 if (*s) {
139 baud = simple_strtoul(s, &e, 0);
140 if (baud == 0 || s == e)
141 baud = DEFAULT_BAUD;
142 }
143
144 divisor = 115200 / baud;
145 c = inb(early_serial_base + LCR);
146 outb(c | DLAB, early_serial_base + LCR);
147 outb(divisor & 0xff, early_serial_base + DLL);
148 outb((divisor >> 8) & 0xff, early_serial_base + DLH);
149 outb(c & ~DLAB, early_serial_base + LCR);
150}
151
152static struct console early_serial_console = {
153 .name = "earlyser",
154 .write = early_serial_write,
155 .flags = CON_PRINTBUFFER,
156 .index = -1,
157};
158
159/* Console interface to a host file on AMD's SimNow! */
160
161static int simnow_fd;
162
163enum {
164 MAGIC1 = 0xBACCD00A,
165 MAGIC2 = 0xCA110000,
166 XOPEN = 5,
167 XWRITE = 4,
168};
169
170static noinline long simnow(long cmd, long a, long b, long c)
171{
172 long ret;
173 asm volatile("cpuid" :
174 "=a" (ret) :
175 "b" (a), "c" (b), "d" (c), "0" (MAGIC1), "D" (cmd + MAGIC2));
176 return ret;
177}
178
179static void __init simnow_init(char *str)
180{
181 char *fn = "klog";
182 if (*str == '=')
183 fn = ++str;
184 /* error ignored */
185 simnow_fd = simnow(XOPEN, (unsigned long)fn, O_WRONLY|O_APPEND|O_CREAT, 0644);
186}
187
188static void simnow_write(struct console *con, const char *s, unsigned n)
189{
190 simnow(XWRITE, simnow_fd, (unsigned long)s, n);
191}
192
193static struct console simnow_console = {
194 .name = "simnow",
195 .write = simnow_write,
196 .flags = CON_PRINTBUFFER,
197 .index = -1,
198};
199
200/* Direct interface for emergencies */
201struct console *early_console = &early_vga_console;
202static int early_console_initialized = 0;
203
204void early_printk(const char *fmt, ...)
205{
206 char buf[512];
207 int n;
208 va_list ap;
209
210 va_start(ap,fmt);
211 n = vscnprintf(buf,512,fmt,ap);
212 early_console->write(early_console,buf,n);
213 va_end(ap);
214}
215
216static int __initdata keep_early;
217
218static int __init setup_early_printk(char *buf)
219{
220 if (!buf)
221 return 0;
222
223 if (early_console_initialized)
224 return 0;
225 early_console_initialized = 1;
226
227 if (strstr(buf, "keep"))
228 keep_early = 1;
229
230 if (!strncmp(buf, "serial", 6)) {
231 early_serial_init(buf + 6);
232 early_console = &early_serial_console;
233 } else if (!strncmp(buf, "ttyS", 4)) {
234 early_serial_init(buf);
235 early_console = &early_serial_console;
236 } else if (!strncmp(buf, "vga", 3)
237 && SCREEN_INFO.orig_video_isVGA == 1) {
238 max_xpos = SCREEN_INFO.orig_video_cols;
239 max_ypos = SCREEN_INFO.orig_video_lines;
240 current_ypos = SCREEN_INFO.orig_y;
241 early_console = &early_vga_console;
242 } else if (!strncmp(buf, "simnow", 6)) {
243 simnow_init(buf + 6);
244 early_console = &simnow_console;
245 keep_early = 1;
246#ifdef CONFIG_HVC_XEN
247 } else if (!strncmp(buf, "xen", 3)) {
248 early_console = &xenboot_console;
249#endif
250 }
251
252 if (keep_early)
253 early_console->flags &= ~CON_BOOT;
254 else
255 early_console->flags |= CON_BOOT;
256 register_console(early_console);
257 return 0;
258}
259early_param("earlyprintk", setup_early_printk);
diff --git a/arch/x86_64/kernel/tsc_sync.c b/arch/x86_64/kernel/tsc_sync.c
deleted file mode 100644
index 355f5f506c81..000000000000
--- a/arch/x86_64/kernel/tsc_sync.c
+++ /dev/null
@@ -1,187 +0,0 @@
1/*
2 * arch/x86_64/kernel/tsc_sync.c: check TSC synchronization.
3 *
4 * Copyright (C) 2006, Red Hat, Inc., Ingo Molnar
5 *
6 * We check whether all boot CPUs have their TSC's synchronized,
7 * print a warning if not and turn off the TSC clock-source.
8 *
9 * The warp-check is point-to-point between two CPUs, the CPU
10 * initiating the bootup is the 'source CPU', the freshly booting
11 * CPU is the 'target CPU'.
12 *
13 * Only two CPUs may participate - they can enter in any order.
14 * ( The serial nature of the boot logic and the CPU hotplug lock
15 * protects against more than 2 CPUs entering this code. )
16 */
17#include <linux/spinlock.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/smp.h>
21#include <linux/nmi.h>
22#include <asm/tsc.h>
23
24/*
25 * Entry/exit counters that make sure that both CPUs
26 * run the measurement code at once:
27 */
28static __cpuinitdata atomic_t start_count;
29static __cpuinitdata atomic_t stop_count;
30
31/*
32 * We use a raw spinlock in this exceptional case, because
33 * we want to have the fastest, inlined, non-debug version
34 * of a critical section, to be able to prove TSC time-warps:
35 */
36static __cpuinitdata raw_spinlock_t sync_lock = __RAW_SPIN_LOCK_UNLOCKED;
37static __cpuinitdata cycles_t last_tsc;
38static __cpuinitdata cycles_t max_warp;
39static __cpuinitdata int nr_warps;
40
41/*
42 * TSC-warp measurement loop running on both CPUs:
43 */
44static __cpuinit void check_tsc_warp(void)
45{
46 cycles_t start, now, prev, end;
47 int i;
48
49 start = get_cycles_sync();
50 /*
51 * The measurement runs for 20 msecs:
52 */
53 end = start + tsc_khz * 20ULL;
54 now = start;
55
56 for (i = 0; ; i++) {
57 /*
58 * We take the global lock, measure TSC, save the
59 * previous TSC that was measured (possibly on
60 * another CPU) and update the previous TSC timestamp.
61 */
62 __raw_spin_lock(&sync_lock);
63 prev = last_tsc;
64 now = get_cycles_sync();
65 last_tsc = now;
66 __raw_spin_unlock(&sync_lock);
67
68 /*
69 * Be nice every now and then (and also check whether
70 * measurement is done [we also insert a 100 million
71 * loops safety exit, so we dont lock up in case the
72 * TSC readout is totally broken]):
73 */
74 if (unlikely(!(i & 7))) {
75 if (now > end || i > 100000000)
76 break;
77 cpu_relax();
78 touch_nmi_watchdog();
79 }
80 /*
81 * Outside the critical section we can now see whether
82 * we saw a time-warp of the TSC going backwards:
83 */
84 if (unlikely(prev > now)) {
85 __raw_spin_lock(&sync_lock);
86 max_warp = max(max_warp, prev - now);
87 nr_warps++;
88 __raw_spin_unlock(&sync_lock);
89 }
90
91 }
92}
93
94/*
95 * Source CPU calls into this - it waits for the freshly booted
96 * target CPU to arrive and then starts the measurement:
97 */
98void __cpuinit check_tsc_sync_source(int cpu)
99{
100 int cpus = 2;
101
102 /*
103 * No need to check if we already know that the TSC is not
104 * synchronized:
105 */
106 if (unsynchronized_tsc())
107 return;
108
109 printk(KERN_INFO "checking TSC synchronization [CPU#%d -> CPU#%d]:",
110 smp_processor_id(), cpu);
111
112 /*
113 * Reset it - in case this is a second bootup:
114 */
115 atomic_set(&stop_count, 0);
116
117 /*
118 * Wait for the target to arrive:
119 */
120 while (atomic_read(&start_count) != cpus-1)
121 cpu_relax();
122 /*
123 * Trigger the target to continue into the measurement too:
124 */
125 atomic_inc(&start_count);
126
127 check_tsc_warp();
128
129 while (atomic_read(&stop_count) != cpus-1)
130 cpu_relax();
131
132 /*
133 * Reset it - just in case we boot another CPU later:
134 */
135 atomic_set(&start_count, 0);
136
137 if (nr_warps) {
138 printk("\n");
139 printk(KERN_WARNING "Measured %Ld cycles TSC warp between CPUs,"
140 " turning off TSC clock.\n", max_warp);
141 mark_tsc_unstable("check_tsc_sync_source failed");
142 nr_warps = 0;
143 max_warp = 0;
144 last_tsc = 0;
145 } else {
146 printk(" passed.\n");
147 }
148
149 /*
150 * Let the target continue with the bootup:
151 */
152 atomic_inc(&stop_count);
153}
154
155/*
156 * Freshly booted CPUs call into this:
157 */
158void __cpuinit check_tsc_sync_target(void)
159{
160 int cpus = 2;
161
162 if (unsynchronized_tsc())
163 return;
164
165 /*
166 * Register this CPU's participation and wait for the
167 * source CPU to start the measurement:
168 */
169 atomic_inc(&start_count);
170 while (atomic_read(&start_count) != cpus)
171 cpu_relax();
172
173 check_tsc_warp();
174
175 /*
176 * Ok, we are done:
177 */
178 atomic_inc(&stop_count);
179
180 /*
181 * Wait for the source CPU to print stuff:
182 */
183 while (atomic_read(&stop_count) != cpus)
184 cpu_relax();
185}
186#undef NR_LOOPS
187
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
deleted file mode 100644
index 849ee611f013..000000000000
--- a/arch/x86_64/kernel/vmlinux.lds.S
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "vmlinux_32.lds.S"
3#else
4# include "vmlinux_64.lds.S"
5#endif