diff options
-rw-r--r-- | arch/m68k/Kconfig | 7 | ||||
-rw-r--r-- | arch/m68k/Makefile | 1 | ||||
-rw-r--r-- | arch/m68k/emu/Makefile | 5 | ||||
-rw-r--r-- | arch/m68k/emu/natfeat.c | 116 | ||||
-rw-r--r-- | arch/m68k/include/asm/natfeat.h | 22 | ||||
-rw-r--r-- | arch/m68k/kernel/setup.c | 5 |
6 files changed, 156 insertions, 0 deletions
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index cbe8b18e808b..f668a5802a4a 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig | |||
@@ -240,6 +240,13 @@ config SUN3 | |||
240 | 240 | ||
241 | If you don't want to compile a kernel exclusively for a Sun 3, say N. | 241 | If you don't want to compile a kernel exclusively for a Sun 3, say N. |
242 | 242 | ||
243 | config NATFEAT | ||
244 | bool "ARAnyM emulator support" | ||
245 | depends on ATARI | ||
246 | help | ||
247 | This option enables support for ARAnyM native features, such as | ||
248 | access to a disk image as /dev/hda. | ||
249 | |||
243 | comment "Processor type" | 250 | comment "Processor type" |
244 | 251 | ||
245 | config M68020 | 252 | config M68020 |
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile index b06a7e3cbcd6..b793163abc61 100644 --- a/arch/m68k/Makefile +++ b/arch/m68k/Makefile | |||
@@ -76,6 +76,7 @@ core-$(CONFIG_MVME16x) += arch/m68k/mvme16x/ | |||
76 | core-$(CONFIG_BVME6000) += arch/m68k/bvme6000/ | 76 | core-$(CONFIG_BVME6000) += arch/m68k/bvme6000/ |
77 | core-$(CONFIG_SUN3X) += arch/m68k/sun3x/ arch/m68k/sun3/ | 77 | core-$(CONFIG_SUN3X) += arch/m68k/sun3x/ arch/m68k/sun3/ |
78 | core-$(CONFIG_SUN3) += arch/m68k/sun3/ arch/m68k/sun3/prom/ | 78 | core-$(CONFIG_SUN3) += arch/m68k/sun3/ arch/m68k/sun3/prom/ |
79 | core-$(CONFIG_NATFEAT) += arch/m68k/emu/ | ||
79 | core-$(CONFIG_M68040) += arch/m68k/fpsp040/ | 80 | core-$(CONFIG_M68040) += arch/m68k/fpsp040/ |
80 | core-$(CONFIG_M68060) += arch/m68k/ifpsp060/ | 81 | core-$(CONFIG_M68060) += arch/m68k/ifpsp060/ |
81 | core-$(CONFIG_M68KFPU_EMU) += arch/m68k/math-emu/ | 82 | core-$(CONFIG_M68KFPU_EMU) += arch/m68k/math-emu/ |
diff --git a/arch/m68k/emu/Makefile b/arch/m68k/emu/Makefile new file mode 100644 index 000000000000..34cfa348ca2b --- /dev/null +++ b/arch/m68k/emu/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for Linux arch/m68k/emu source directory | ||
3 | # | ||
4 | |||
5 | obj-y += natfeat.o | ||
diff --git a/arch/m68k/emu/natfeat.c b/arch/m68k/emu/natfeat.c new file mode 100644 index 000000000000..987d77322178 --- /dev/null +++ b/arch/m68k/emu/natfeat.c | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * natfeat.c - ARAnyM hardware support via Native Features (natfeats) | ||
3 | * | ||
4 | * Copyright (c) 2005 Petr Stehlik of ARAnyM dev team | ||
5 | * | ||
6 | * Reworked for Linux by Roman Zippel <zippel@linux-m68k.org> | ||
7 | * | ||
8 | * This software may be used and distributed according to the terms of | ||
9 | * the GNU General Public License (GPL), incorporated herein by reference. | ||
10 | */ | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | #include <linux/console.h> | ||
14 | #include <linux/string.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/io.h> | ||
18 | #include <asm/machdep.h> | ||
19 | #include <asm/natfeat.h> | ||
20 | |||
21 | asm("\n" | ||
22 | " .global nf_get_id,nf_call\n" | ||
23 | "nf_get_id:\n" | ||
24 | " .short 0x7300\n" | ||
25 | " rts\n" | ||
26 | "nf_call:\n" | ||
27 | " .short 0x7301\n" | ||
28 | " rts\n" | ||
29 | "1: moveq.l #0,%d0\n" | ||
30 | " rts\n" | ||
31 | " .section __ex_table,\"a\"\n" | ||
32 | " .long nf_get_id,1b\n" | ||
33 | " .long nf_call,1b\n" | ||
34 | " .previous"); | ||
35 | EXPORT_SYMBOL_GPL(nf_get_id); | ||
36 | EXPORT_SYMBOL_GPL(nf_call); | ||
37 | |||
38 | static int stderr_id; | ||
39 | |||
40 | static void nf_write(struct console *co, const char *str, unsigned int count) | ||
41 | { | ||
42 | char buf[68]; | ||
43 | |||
44 | buf[64] = 0; | ||
45 | while (count > 64) { | ||
46 | memcpy(buf, str, 64); | ||
47 | nf_call(stderr_id, buf); | ||
48 | str += 64; | ||
49 | count -= 64; | ||
50 | } | ||
51 | memcpy(buf, str, count); | ||
52 | buf[count] = 0; | ||
53 | nf_call(stderr_id, buf); | ||
54 | } | ||
55 | |||
56 | void nfprint(const char *fmt, ...) | ||
57 | { | ||
58 | static char buf[256]; | ||
59 | va_list ap; | ||
60 | int n; | ||
61 | |||
62 | va_start(ap, fmt); | ||
63 | n = vsnprintf(buf, 256, fmt, ap); | ||
64 | nf_call(nf_get_id("NF_STDERR"), buf); | ||
65 | va_end(ap); | ||
66 | } | ||
67 | |||
68 | static struct console nf_console_driver = { | ||
69 | .name = "debug", | ||
70 | .write = nf_write, | ||
71 | .flags = CON_PRINTBUFFER, | ||
72 | .index = -1, | ||
73 | }; | ||
74 | |||
75 | static int __init nf_debug_setup(char *arg) | ||
76 | { | ||
77 | if (strcmp(arg, "emu")) | ||
78 | return 0; | ||
79 | |||
80 | stderr_id = nf_get_id("NF_STDERR"); | ||
81 | if (stderr_id) | ||
82 | register_console(&nf_console_driver); | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | early_param("debug", nf_debug_setup); | ||
87 | |||
88 | static void nf_poweroff(void) | ||
89 | { | ||
90 | long id = nf_get_id("NF_SHUTDOWN"); | ||
91 | |||
92 | if (id) | ||
93 | nf_call(id); | ||
94 | } | ||
95 | |||
96 | void nf_init(void) | ||
97 | { | ||
98 | unsigned long id, version; | ||
99 | char buf[256]; | ||
100 | |||
101 | id = nf_get_id("NF_VERSION"); | ||
102 | if (!id) | ||
103 | return; | ||
104 | version = nf_call(id); | ||
105 | |||
106 | id = nf_get_id("NF_NAME"); | ||
107 | if (!id) | ||
108 | return; | ||
109 | nf_call(id, buf, 256); | ||
110 | buf[255] = 0; | ||
111 | |||
112 | pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16, | ||
113 | version & 0xffff); | ||
114 | |||
115 | mach_power_off = nf_poweroff; | ||
116 | } | ||
diff --git a/arch/m68k/include/asm/natfeat.h b/arch/m68k/include/asm/natfeat.h new file mode 100644 index 000000000000..a3521b80c3b9 --- /dev/null +++ b/arch/m68k/include/asm/natfeat.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * ARAnyM hardware support via Native Features (natfeats) | ||
3 | * | ||
4 | * Copyright (c) 2005 Petr Stehlik of ARAnyM dev team | ||
5 | * | ||
6 | * This software may be used and distributed according to the terms of | ||
7 | * the GNU General Public License (GPL), incorporated herein by reference. | ||
8 | */ | ||
9 | |||
10 | #ifndef _NATFEAT_H | ||
11 | #define _NATFEAT_H | ||
12 | |||
13 | long nf_get_id(const char *feature_name); | ||
14 | long nf_call(long id, ...); | ||
15 | |||
16 | void nf_init(void); | ||
17 | void nf_shutdown(void); | ||
18 | |||
19 | void nfprint(const char *fmt, ...) | ||
20 | __attribute__ ((format (printf, 1, 2))); | ||
21 | |||
22 | # endif /* _NATFEAT_H */ | ||
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c index b3963ab3d149..334d83640376 100644 --- a/arch/m68k/kernel/setup.c +++ b/arch/m68k/kernel/setup.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #ifdef CONFIG_SUN3X | 42 | #ifdef CONFIG_SUN3X |
43 | #include <asm/dvma.h> | 43 | #include <asm/dvma.h> |
44 | #endif | 44 | #endif |
45 | #include <asm/natfeat.h> | ||
45 | 46 | ||
46 | #if !FPSTATESIZE || !NR_IRQS | 47 | #if !FPSTATESIZE || !NR_IRQS |
47 | #warning No CPU/platform type selected, your kernel will not work! | 48 | #warning No CPU/platform type selected, your kernel will not work! |
@@ -324,6 +325,10 @@ void __init setup_arch(char **cmdline_p) | |||
324 | panic("No configuration setup"); | 325 | panic("No configuration setup"); |
325 | } | 326 | } |
326 | 327 | ||
328 | #ifdef CONFIG_NATFEAT | ||
329 | nf_init(); | ||
330 | #endif | ||
331 | |||
327 | paging_init(); | 332 | paging_init(); |
328 | 333 | ||
329 | #ifndef CONFIG_SUN3 | 334 | #ifndef CONFIG_SUN3 |