diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-16 22:08:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-16 22:08:03 -0400 |
commit | dc113c1f1d4b47af1b1ca701c5a39e24d296c2ac (patch) | |
tree | 0bb5ce21bcd41a9443708567edbdca80d9a72397 /arch/m68k/emu/natfeat.c | |
parent | 63a93699c6a58795b854ff573542a08367684dae (diff) | |
parent | 059718d572e8ad388313b863aff717623bb2552f (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
m68k/block: amiflop - Remove superfluous amiga_chip_alloc() cast
m68k/atari: ARAnyM - Add support for network access
m68k/atari: ARAnyM - Add support for console access
m68k/atari: ARAnyM - Add support for block access
m68k/atari: Initial ARAnyM support
m68k: Kconfig - Remove unneeded "default n"
m68k: Makefiles - Change to new flags variables
m68k/amiga: Reclaim Chip RAM for PPC exception handlers
m68k: Allow all kernel traps to be handled via exception fixups
m68k: Use base_trap_init() to initialize vectors
m68k: Add helper function handle_kernel_fault()
Diffstat (limited to 'arch/m68k/emu/natfeat.c')
-rw-r--r-- | arch/m68k/emu/natfeat.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/arch/m68k/emu/natfeat.c b/arch/m68k/emu/natfeat.c new file mode 100644 index 000000000000..2291a7d69d49 --- /dev/null +++ b/arch/m68k/emu/natfeat.c | |||
@@ -0,0 +1,78 @@ | |||
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 | void nfprint(const char *fmt, ...) | ||
39 | { | ||
40 | static char buf[256]; | ||
41 | va_list ap; | ||
42 | int n; | ||
43 | |||
44 | va_start(ap, fmt); | ||
45 | n = vsnprintf(buf, 256, fmt, ap); | ||
46 | nf_call(nf_get_id("NF_STDERR"), buf); | ||
47 | va_end(ap); | ||
48 | } | ||
49 | |||
50 | static void nf_poweroff(void) | ||
51 | { | ||
52 | long id = nf_get_id("NF_SHUTDOWN"); | ||
53 | |||
54 | if (id) | ||
55 | nf_call(id); | ||
56 | } | ||
57 | |||
58 | void nf_init(void) | ||
59 | { | ||
60 | unsigned long id, version; | ||
61 | char buf[256]; | ||
62 | |||
63 | id = nf_get_id("NF_VERSION"); | ||
64 | if (!id) | ||
65 | return; | ||
66 | version = nf_call(id); | ||
67 | |||
68 | id = nf_get_id("NF_NAME"); | ||
69 | if (!id) | ||
70 | return; | ||
71 | nf_call(id, buf, 256); | ||
72 | buf[255] = 0; | ||
73 | |||
74 | pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16, | ||
75 | version & 0xffff); | ||
76 | |||
77 | mach_power_off = nf_poweroff; | ||
78 | } | ||