Skip to contentSkip to conversation

m68k/atari: Initial ARAnyM support

PATCH New Geert Uytterhoeven 1 participant 4 messages Feb 21, 2011

Subsystems (3)
lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

PATCH v2 1/4 m68k/atari: Initial ARAnyM support

From: Petr Stehlik <[email protected]>

[michael, geert: Cleanups and updates]

---
v2: No changes
v1:
- Export native feature API,
- Remove bogus line from Kconfig help.

 arch/m68k/Kconfig               |    7 ++
 arch/m68k/Makefile              |    1 +
 arch/m68k/emu/Makefile          |    5 ++
 arch/m68k/emu/natfeat.c         |  116 +++++++++++++++++++++++++++++++++++++++
 arch/m68k/include/asm/natfeat.h |   22 +++++++
 arch/m68k/kernel/setup.c        |    5 ++
 6 files changed, 156 insertions(+), 0 deletions(-)
 create mode 100644 arch/m68k/emu/Makefile
 create mode 100644 arch/m68k/emu/natfeat.c
 create mode 100644 arch/m68k/include/asm/natfeat.h
arch/m68k/Kconfig +7 -0
index cbe8b18..f668a58 100644
@@ -240,6 +240,13 @@ config SUN3
 
 	  If you don't want to compile a kernel exclusively for a Sun 3, say N.
 
+config NATFEAT
+	bool "ARAnyM emulator support"
+	depends on ATARI
+	help
+	  This option enables support for ARAnyM native features, such as
+	  access to a disk image as /dev/hda.
+
 comment "Processor type"
 
 config M68020
arch/m68k/Makefile +1 -0
index b06a7e3..b793163 100644
@@ -76,6 +76,7 @@ core-$(CONFIG_MVME16x)		+= arch/m68k/mvme16x/
 core-$(CONFIG_BVME6000)		+= arch/m68k/bvme6000/
 core-$(CONFIG_SUN3X)		+= arch/m68k/sun3x/	arch/m68k/sun3/
 core-$(CONFIG_SUN3)		+= arch/m68k/sun3/	arch/m68k/sun3/prom/
+core-$(CONFIG_NATFEAT)		+= arch/m68k/emu/
 core-$(CONFIG_M68040)		+= arch/m68k/fpsp040/
 core-$(CONFIG_M68060)		+= arch/m68k/ifpsp060/
 core-$(CONFIG_M68KFPU_EMU)	+= arch/m68k/math-emu/
arch/m68k/emu/Makefile new file +5 -0
new file mode 100644
index 0000000..34cfa34
@@ -0,0 +1,5 @@
+#
+# Makefile for Linux arch/m68k/emu source directory
+#
+
+obj-y			+= natfeat.o
arch/m68k/emu/natfeat.c new file +116 -0

116 lines not on this page · raw message

arch/m68k/include/asm/natfeat.h new file +22 -0
new file mode 100644
index 0000000..a3521b8
@@ -0,0 +1,22 @@
+/*
+ * ARAnyM hardware support via Native Features (natfeats)
+ *
+ * Copyright (c) 2005 Petr Stehlik of ARAnyM dev team
+ *
+ * This software may be used and distributed according to the terms of
+ * the GNU General Public License (GPL), incorporated herein by reference.
+ */
+
+#ifndef _NATFEAT_H
+#define _NATFEAT_H
+
+long nf_get_id(const char *feature_name);
+long nf_call(long id, ...);
+
+void nf_init(void);
+void nf_shutdown(void);
+
+void nfprint(const char *fmt, ...)
+	__attribute__ ((format (printf, 1, 2)));
+
+# endif /* _NATFEAT_H */
arch/m68k/kernel/setup.c +5 -0
index b3963ab..334d836 100644
@@ -42,6 +42,7 @@
 #ifdef CONFIG_SUN3X
 #include <asm/dvma.h>
 #endif
+#include <asm/natfeat.h>
 
 #if !FPSTATESIZE || !NR_IRQS
 #warning No CPU/platform type selected, your kernel will not work!
@@ -324,6 +325,10 @@ void __init setup_arch(char **cmdline_p)
 		panic("No configuration setup");
 	}
 
+#ifdef CONFIG_NATFEAT
+	nf_init();
+#endif
+
 	paging_init();
 
 #ifndef CONFIG_SUN3
Signature · 1 line
1.7.0.4
author maintainer
#1 lore raw

PATCH v2 2/4 m68k/atari: ARAnyM - Add support for block access

From: Roman Zippel <[email protected]>

[geert: Cleanups and updates]

---
v2: No changes
v1:
- Wrap natfeat calls

Add wrappers with proper prototypes for the natfeat calls in nfblock. This fixes the problem where sector_t was pushed on the stack as a 64-bit value if CONFIG_LBDAF=y, while all parameters of the nf_call() varargs function are 32-bit.

- Update for v2.6.31 block layer changes,
- nfblock needs <linux/slab.h>,
- Make needlessly global functions static,
- Make struct block_device_operations const,
- Use pr_*(),
- Propagate error code from register_blkdev().

 arch/m68k/Kconfig       |    8 ++
 arch/m68k/emu/Makefile  |    2 +
 arch/m68k/emu/nfblock.c |  195 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 205 insertions(+), 0 deletions(-)
 create mode 100644 arch/m68k/emu/nfblock.c
arch/m68k/Kconfig +8 -0
index f668a58..2c890b5 100644
@@ -247,6 +247,14 @@ config NATFEAT
 	  This option enables support for ARAnyM native features, such as
 	  access to a disk image as /dev/hda.
 
+config NFBLOCK
+	tristate "NatFeat block device support"
+	depends on BLOCK && NATFEAT
+	help
+	  Say Y to include support for the ARAnyM NatFeat block device
+	  which allows direct access to the hard drives without using
+	  the hardware emulation.
+
 comment "Processor type"
 
 config M68020
arch/m68k/emu/Makefile +2 -0
index 34cfa34..fc4f77a 100644
@@ -3,3 +3,5 @@
 #
 
 obj-y			+= natfeat.o
+
+obj-$(CONFIG_NFBLOCK)	+= nfblock.o
arch/m68k/emu/nfblock.c new file +195 -0

195 lines not on this page · raw message

Signature · 1 line
1.7.0.4
author maintainer
#2 lore raw

PATCH v2 3/4 m68k/atari: ARAnyM - Add support for console access

In reply to Geert Uytterhoeven

From: Roman Zippel <[email protected]>

[geert: Cleanups and updates]

---
v2: No changes
v1:
- early_param() does not exist in the modular case,
- Break too long lines,
- Make needlessly global functions static,
- Use pr_*(),
- Extract nfputs(), to avoid code duplication in nfcon_write() and

    nfcon_tty_write().
 arch/m68k/Kconfig       |    8 +++
 arch/m68k/emu/Makefile  |    1 +
 arch/m68k/emu/natfeat.c |   38 -----------
 arch/m68k/emu/nfcon.c   |  162 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 171 insertions(+), 38 deletions(-)
 create mode 100644 arch/m68k/emu/nfcon.c
arch/m68k/Kconfig +8 -0
index 2c890b5..6719c56 100644
@@ -255,6 +255,14 @@ config NFBLOCK
 	  which allows direct access to the hard drives without using
 	  the hardware emulation.
 
+config NFCON
+	tristate "NatFeat console driver"
+	depends on NATFEAT
+	help
+	  Say Y to include support for the ARAnyM NatFeat console driver
+	  which allows the console output to be redirected to the stderr
+	  output of ARAnyM.
+
 comment "Processor type"
 
 config M68020
arch/m68k/emu/Makefile +1 -0
index fc4f77a..a83ef1e 100644
@@ -5,3 +5,4 @@
 obj-y			+= natfeat.o
 
 obj-$(CONFIG_NFBLOCK)	+= nfblock.o
+obj-$(CONFIG_NFCON)	+= nfcon.o
arch/m68k/emu/natfeat.c +0 -38
index 987d773..2291a7d 100644
@@ -35,24 +35,6 @@ asm("\n"
 EXPORT_SYMBOL_GPL(nf_get_id);
 EXPORT_SYMBOL_GPL(nf_call);
 
-static int stderr_id;
-
-static void nf_write(struct console *co, const char *str, unsigned int count)
-{
-	char buf[68];
-
-	buf[64] = 0;
-	while (count > 64) {
-		memcpy(buf, str, 64);
-		nf_call(stderr_id, buf);
-		str += 64;
-		count -= 64;
-	}
-	memcpy(buf, str, count);
-	buf[count] = 0;
-	nf_call(stderr_id, buf);
-}
-
 void nfprint(const char *fmt, ...)
 {
 	static char buf[256];
@@ -65,26 +47,6 @@ void nfprint(const char *fmt, ...)
 	va_end(ap);
 }
 
-static struct console nf_console_driver = {
-	.name	= "debug",
-	.write	= nf_write,
-	.flags	= CON_PRINTBUFFER,
-	.index	= -1,
-};
-
-static int __init nf_debug_setup(char *arg)
-{
-	if (strcmp(arg, "emu"))
-		return 0;
-
-	stderr_id = nf_get_id("NF_STDERR");
-	if (stderr_id)
-		register_console(&nf_console_driver);
-	return 0;
-}
-
-early_param("debug", nf_debug_setup);
-
 static void nf_poweroff(void)
 {
 	long id = nf_get_id("NF_SHUTDOWN");
arch/m68k/emu/nfcon.c new file +162 -0

162 lines not on this page · raw message

Signature · 1 line
1.7.0.4
author maintainer
#3 lore raw

PATCH v2 4/4 m68k/atari: ARAnyM - Add support for network access

In reply to Geert Uytterhoeven

From: Milan Jurik <[email protected]>

[petr: Second author]
[michael, geert: Cleanups and updates]

---
v2:
- Review comments from David Miller:
- Remove "dev->trans_start = jiffies;",
- Set pr_fmt(),
- Use netdev_*() for logging.
- Review comments from Petr Stehlik:
- Update ARAnyM URL.
v1:
- Convert to net_device_ops,
- nfeth doesn't need obsolete <net/ieee80211.h>,
- Convert print_mac to %pM,
- Break too long lines,
- Make needlessly global functions static,
- Make version[] const,
- Use pr_*(),
- Use net_device_stats from struct net_device instead of our own,
- Propagate error code from request_irq(),
- Remove unused variable "handled".

 arch/m68k/Kconfig      |    8 ++
 arch/m68k/emu/Makefile |    1 +
 arch/m68k/emu/nfeth.c  |  270 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 279 insertions(+), 0 deletions(-)
 create mode 100644 arch/m68k/emu/nfeth.c
arch/m68k/Kconfig +8 -0
index 6719c56..80df6ee 100644
@@ -263,6 +263,14 @@ config NFCON
 	  which allows the console output to be redirected to the stderr
 	  output of ARAnyM.
 
+config NFETH
+	tristate "NatFeat Ethernet support"
+	depends on NET_ETHERNET && NATFEAT
+	help
+	  Say Y to include support for the ARAnyM NatFeat network device
+	  which will emulate a regular ethernet device while presenting an
+	  ethertap device to the host system.
+
 comment "Processor type"
 
 config M68020
arch/m68k/emu/Makefile +1 -0
index a83ef1e..7dc2010 100644
@@ -6,3 +6,4 @@ obj-y			+= natfeat.o
 
 obj-$(CONFIG_NFBLOCK)	+= nfblock.o
 obj-$(CONFIG_NFCON)	+= nfcon.o
+obj-$(CONFIG_NFETH)	+= nfeth.o
arch/m68k/emu/nfeth.c new file +270 -0

270 lines not on this page · raw message

Signature · 1 line
1.7.0.4