2 * natfeat.c - ARAnyM hardware support via Native Features (natfeats)
4 * Copyright (c) 2005 Petr Stehlik of ARAnyM dev team
6 * Reworked for Linux by Roman Zippel <zippel@linux-m68k.org>
8 * This software may be used and distributed according to the terms of
9 * the GNU General Public License (GPL), incorporated herein by reference.
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>
18 #include <asm/machdep.h>
19 #include <asm/natfeat.h>
22 " .global nf_get_id,nf_call\n"
31 " .section __ex_table,\"a\"\n"
32 " .long nf_get_id,1b\n"
35 EXPORT_SYMBOL_GPL(nf_get_id);
36 EXPORT_SYMBOL_GPL(nf_call);
40 static void nf_write(struct console *co, const char *str, unsigned int count)
47 nf_call(stderr_id, buf);
51 memcpy(buf, str, count);
53 nf_call(stderr_id, buf);
56 void nfprint(const char *fmt, ...)
63 n = vsnprintf(buf, 256, fmt, ap);
64 nf_call(nf_get_id("NF_STDERR"), buf);
68 static struct console nf_console_driver = {
71 .flags = CON_PRINTBUFFER,
75 static int __init nf_debug_setup(char *arg)
77 if (strcmp(arg, "emu"))
80 stderr_id = nf_get_id("NF_STDERR");
82 register_console(&nf_console_driver);
86 early_param("debug", nf_debug_setup);
88 static void nf_poweroff(void)
90 long id = nf_get_id("NF_SHUTDOWN");
98 unsigned long id, version;
101 id = nf_get_id("NF_VERSION");
104 version = nf_call(id);
106 id = nf_get_id("NF_NAME");
109 nf_call(id, buf, 256);
112 pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16,
115 mach_power_off = nf_poweroff;