aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k
diff options
context:
space:
mode:
authorPetr Stehlik <pstehlik@sophics.cz>2008-11-18 15:02:18 -0500
committerGeert Uytterhoeven <geert@linux-m68k.org>2011-03-16 14:10:41 -0400
commit65cd577d5e61043d1c1aec5812dea8a5c834652d (patch)
tree7823e6b01e354717dc5340e6231f48a357a6de9e /arch/m68k
parent93ff9542462ba5074fb6b6cd9e27c4fb04d452ec (diff)
m68k/atari: Initial ARAnyM support
Add improved support for running under the ARAnyM emulator (Atari Running on Any Machine - http://aranym.org/). [michael, geert: Cleanups and updates] Signed-off-by: Petr Stehlik <pstehlik@sophics.cz> Signed-off-by: Michael Schmitz <schmitz@debian.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68k')
-rw-r--r--arch/m68k/Kconfig7
-rw-r--r--arch/m68k/Makefile1
-rw-r--r--arch/m68k/emu/Makefile5
-rw-r--r--arch/m68k/emu/natfeat.c116
-rw-r--r--arch/m68k/include/asm/natfeat.h22
-rw-r--r--arch/m68k/kernel/setup.c5
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
243config 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
243comment "Processor type" 250comment "Processor type"
244 251
245config M68020 252config 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/
76core-$(CONFIG_BVME6000) += arch/m68k/bvme6000/ 76core-$(CONFIG_BVME6000) += arch/m68k/bvme6000/
77core-$(CONFIG_SUN3X) += arch/m68k/sun3x/ arch/m68k/sun3/ 77core-$(CONFIG_SUN3X) += arch/m68k/sun3x/ arch/m68k/sun3/
78core-$(CONFIG_SUN3) += arch/m68k/sun3/ arch/m68k/sun3/prom/ 78core-$(CONFIG_SUN3) += arch/m68k/sun3/ arch/m68k/sun3/prom/
79core-$(CONFIG_NATFEAT) += arch/m68k/emu/
79core-$(CONFIG_M68040) += arch/m68k/fpsp040/ 80core-$(CONFIG_M68040) += arch/m68k/fpsp040/
80core-$(CONFIG_M68060) += arch/m68k/ifpsp060/ 81core-$(CONFIG_M68060) += arch/m68k/ifpsp060/
81core-$(CONFIG_M68KFPU_EMU) += arch/m68k/math-emu/ 82core-$(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
5obj-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
21asm("\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");
35EXPORT_SYMBOL_GPL(nf_get_id);
36EXPORT_SYMBOL_GPL(nf_call);
37
38static int stderr_id;
39
40static 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
56void 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
68static struct console nf_console_driver = {
69 .name = "debug",
70 .write = nf_write,
71 .flags = CON_PRINTBUFFER,
72 .index = -1,
73};
74
75static 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
86early_param("debug", nf_debug_setup);
87
88static void nf_poweroff(void)
89{
90 long id = nf_get_id("NF_SHUTDOWN");
91
92 if (id)
93 nf_call(id);
94}
95
96void 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
13long nf_get_id(const char *feature_name);
14long nf_call(long id, ...);
15
16void nf_init(void);
17void nf_shutdown(void);
18
19void 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