[PATCH 0/4] m68k/atari: Add ARAnyM support

2011-02-06 Thread Geert Uytterhoeven
This patch series add improved support for running under the ARAnyM emulator
(Atari Running on Any Machine - http://aranym.org/).
Without these patches, you can run a Linux/m68k kernel with Atari support
under ARAnyM (it emulates the IDE interface), but you can't have network and
console access.

This support has been in active use for several years. In fact some Debian
build daemons run under ARAnyM, as it's the fastest m68k platform around.

  [1/4] m68k/atari: Initial ARAnyM support
  [2/4] m68k/atari: ARAnyM - Add support for block access
  [3/4] m68k/atari: ARAnyM - Add support for console access
  [4/4] m68k/atari: ARAnyM - Add support for network access

Questions:
  - Who should be listed as author for patches 1 and 4?
  - Can I please have Signed-off-by's from the ARAnyM people?

 arch/m68k/Kconfig   |   31 +
 arch/m68k/Makefile  |1 +
 arch/m68k/emu/Makefile  |9 ++
 arch/m68k/emu/natfeat.c |   78 +++
 arch/m68k/emu/nfblock.c |  195 
 arch/m68k/emu/nfcon.c   |  162 +++
 arch/m68k/emu/nfeth.c   |  272 +++
 arch/m68k/include/asm/natfeat.h |   22 +++
 arch/m68k/kernel/setup.c|5 +
 9 files changed, 775 insertions(+), 0 deletions(-)

Thanks in advance!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line unsubscribe linux-m68k in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] m68k/atari: Initial ARAnyM support

2011-02-06 Thread Geert Uytterhoeven
From: Michael Schmitz schm...@opal.biophys.uni-duesseldorf.de

Should be signed off by Petr, really.

[geert] Cleanups and updates
Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
Cc: Petr Stehlik psteh...@sophics.cz

---
Changelog:
  - 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 |   78 +++
 arch/m68k/include/asm/natfeat.h |   22 +++
 arch/m68k/kernel/setup.c|5 ++
 6 files changed, 118 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

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index cbe8b18..f668a58 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -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
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index b06a7e3..b793163 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -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/
diff --git a/arch/m68k/emu/Makefile b/arch/m68k/emu/Makefile
new file mode 100644
index 000..34cfa34
--- /dev/null
+++ b/arch/m68k/emu/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for Linux arch/m68k/emu source directory
+#
+
+obj-y  += natfeat.o
diff --git a/arch/m68k/emu/natfeat.c b/arch/m68k/emu/natfeat.c
new file mode 100644
index 000..2291a7d
--- /dev/null
+++ b/arch/m68k/emu/natfeat.c
@@ -0,0 +1,78 @@
+/*
+ * natfeat.c - ARAnyM hardware support via Native Features (natfeats)
+ *
+ * Copyright (c) 2005 Petr Stehlik of ARAnyM dev team
+ *
+ * Reworked for Linux by Roman Zippel zip...@linux-m68k.org
+ *
+ * This software may be used and distributed according to the terms of
+ * the GNU General Public License (GPL), incorporated herein by reference.
+ */
+
+#include linux/types.h
+#include linux/console.h
+#include linux/string.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/io.h
+#include asm/machdep.h
+#include asm/natfeat.h
+
+asm(\n
+  .global nf_get_id,nf_call\n
+nf_get_id:\n
+  .short  0x7300\n
+  rts\n
+nf_call:\n
+  .short  0x7301\n
+  rts\n
+1:moveq.l #0,%d0\n
+  rts\n
+  .section __ex_table,\a\\n
+  .long   nf_get_id,1b\n
+  .long   nf_call,1b\n
+  .previous);
+EXPORT_SYMBOL_GPL(nf_get_id);
+EXPORT_SYMBOL_GPL(nf_call);
+
+void nfprint(const char *fmt, ...)
+{
+   static char buf[256];
+   va_list ap;
+   int n;
+
+   va_start(ap, fmt);
+   n = vsnprintf(buf, 256, fmt, ap);
+   nf_call(nf_get_id(NF_STDERR), buf);
+   va_end(ap);
+}
+
+static void nf_poweroff(void)
+{
+   long id = nf_get_id(NF_SHUTDOWN);
+
+   if (id)
+   nf_call(id);
+}
+
+void nf_init(void)
+{
+   unsigned long id, version;
+   char buf[256];
+
+   id = nf_get_id(NF_VERSION);
+   if (!id)
+   return;
+   version = nf_call(id);
+
+   id = nf_get_id(NF_NAME);
+   if (!id)
+   return;
+   nf_call(id, buf, 256);
+   buf[255] = 0;
+
+   pr_info(NatFeats found (%s, %lu.%lu)\n, buf, version  16,
+   version  0x);
+
+   mach_power_off = nf_poweroff;
+}
diff --git a/arch/m68k/include/asm/natfeat.h b/arch/m68k/include/asm/natfeat.h
new file mode 100644
index 000..a3521b8
--- /dev/null
+++ b/arch/m68k/include/asm/natfeat.h
@@ -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 */
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index b3963ab..334d836 100644
--- a/arch/m68k/kernel/setup.c

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

2011-02-06 Thread Geert Uytterhoeven
From: Roman Zippel zip...@linux-m68k.org

Signed-off-by: Roman Zippel zip...@linux-m68k.org
[geert] Cleanups and updates
Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
Cc: Petr Stehlik psteh...@sophics.cz

---
Changelog:
  - 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

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index f668a58..2c890b5 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -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
diff --git a/arch/m68k/emu/Makefile b/arch/m68k/emu/Makefile
index 34cfa34..fc4f77a 100644
--- a/arch/m68k/emu/Makefile
+++ b/arch/m68k/emu/Makefile
@@ -3,3 +3,5 @@
 #
 
 obj-y  += natfeat.o
+
+obj-$(CONFIG_NFBLOCK)  += nfblock.o
diff --git a/arch/m68k/emu/nfblock.c b/arch/m68k/emu/nfblock.c
new file mode 100644
index 000..48e50f8
--- /dev/null
+++ b/arch/m68k/emu/nfblock.c
@@ -0,0 +1,195 @@
+/*
+ * ARAnyM block device driver
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+#include linux/module.h
+#include linux/moduleparam.h
+#include linux/init.h
+
+#include linux/kernel.h
+#include linux/errno.h
+#include linux/types.h
+#include linux/genhd.h
+#include linux/blkdev.h
+#include linux/hdreg.h
+#include linux/slab.h
+
+#include asm/natfeat.h
+
+static long nfhd_id;
+
+enum {
+   /* emulation entry points */
+   NFHD_READ_WRITE = 10,
+   NFHD_GET_CAPACITY = 14,
+
+   /* skip ACSI devices */
+   NFHD_DEV_OFFSET = 8,
+};
+
+static inline s32 nfhd_read_write(u32 major, u32 minor, u32 rwflag, u32 recno,
+ u32 count, u32 buf)
+{
+   return nf_call(nfhd_id + NFHD_READ_WRITE, major, minor, rwflag, recno,
+  count, buf);
+}
+
+static inline s32 nfhd_get_capacity(u32 major, u32 minor, u32 *blocks,
+   u32 *blocksize)
+{
+   return nf_call(nfhd_id + NFHD_GET_CAPACITY, major, minor, blocks,
+  blocksize);
+}
+
+static LIST_HEAD(nfhd_list);
+
+static int major_num;
+module_param(major_num, int, 0);
+
+struct nfhd_device {
+   struct list_head list;
+   int id;
+   u32 blocks, bsize;
+   int bshift;
+   struct request_queue *queue;
+   struct gendisk *disk;
+};
+
+static int nfhd_make_request(struct request_queue *queue, struct bio *bio)
+{
+   struct nfhd_device *dev = queue-queuedata;
+   struct bio_vec *bvec;
+   int i, dir, len, shift;
+   sector_t sec = bio-bi_sector;
+
+   dir = bio_data_dir(bio);
+   shift = dev-bshift;
+   bio_for_each_segment(bvec, bio, i) {
+   len = bvec-bv_len;
+   len = 9;
+   nfhd_read_write(dev-id, 0, dir, sec  shift, len  shift,
+   bvec_to_phys(bvec));
+   sec += len;
+   }
+   bio_endio(bio, 0);
+   return 0;
+}
+
+static int nfhd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
+{
+   struct nfhd_device *dev = bdev-bd_disk-private_data;
+
+   geo-cylinders = dev-blocks  (6 - dev-bshift);
+   geo-heads = 4;
+   geo-sectors = 16;
+
+   return 0;
+}
+
+static const struct block_device_operations nfhd_ops = {
+   .owner  = THIS_MODULE,
+   .getgeo = nfhd_getgeo,
+};
+
+static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
+{
+   struct nfhd_device *dev;
+   int dev_id = id - NFHD_DEV_OFFSET;
+
+   pr_info(nfhd%u: found device with %u blocks (%u bytes)\n, dev_id,
+   blocks, bsize);
+
+   if (bsize  512 || (bsize  (bsize - 1))) {
+   pr_warn(nfhd%u: invalid block size\n, dev_id);
+   return -EINVAL;
+   }
+
+   dev = kmalloc(sizeof(struct nfhd_device), GFP_KERNEL);
+   if (!dev)
+   

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

2011-02-06 Thread Geert Uytterhoeven
From: Michael Schmitz schm...@opal.biophys.uni-duesseldorf.de

Should be signed off by Milan and Petr, really.

[geert] Cleanups and updates
Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
Cc: Petr Stehlik psteh...@sophics.cz
Cc: Milan Jurik m.ju...@sh.cvut.cz
Cc: net...@vger.kernel.org

---
Changelog:
  - 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  |  272 
 3 files changed, 281 insertions(+), 0 deletions(-)
 create mode 100644 arch/m68k/emu/nfeth.c

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 6719c56..80df6ee 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -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
diff --git a/arch/m68k/emu/Makefile b/arch/m68k/emu/Makefile
index a83ef1e..7dc2010 100644
--- a/arch/m68k/emu/Makefile
+++ b/arch/m68k/emu/Makefile
@@ -6,3 +6,4 @@ obj-y   += natfeat.o
 
 obj-$(CONFIG_NFBLOCK)  += nfblock.o
 obj-$(CONFIG_NFCON)+= nfcon.o
+obj-$(CONFIG_NFETH)+= nfeth.o
diff --git a/arch/m68k/emu/nfeth.c b/arch/m68k/emu/nfeth.c
new file mode 100644
index 000..5b2a33d
--- /dev/null
+++ b/arch/m68k/emu/nfeth.c
@@ -0,0 +1,272 @@
+/*
+ * atari_nfeth.c - ARAnyM ethernet card driver for GNU/Linux
+ *
+ * Copyright (c) 2005 Milan Jurik, Petr Stehlik of ARAnyM dev team
+ *
+ * Based on ARAnyM driver for FreeMiNT written by Standa Opichal
+ *
+ * This software may be used and distributed according to the terms of
+ * the GNU General Public License (GPL), incorporated herein by reference.
+ */
+
+#include linux/netdevice.h
+#include linux/etherdevice.h
+#include linux/module.h
+#include asm/natfeat.h
+#include asm/virtconvert.h
+
+enum {
+   GET_VERSION = 0,/* no parameters, return NFAPI_VERSION in d0 */
+   XIF_INTLEVEL,   /* no parameters, return Interrupt Level in d0 */
+   XIF_IRQ,/* acknowledge interrupt from host */
+   XIF_START,  /* (ethX), called on 'ifup', start receiver thread */
+   XIF_STOP,   /* (ethX), called on 'ifdown', stop the thread */
+   XIF_READLENGTH, /* (ethX), return size of network data block to read */
+   XIF_READBLOCK,  /* (ethX, buffer, size), read block of network data */
+   XIF_WRITEBLOCK, /* (ethX, buffer, size), write block of network data */
+   XIF_GET_MAC,/* (ethX, buffer, size), return MAC HW addr in buffer */
+   XIF_GET_IPHOST, /* (ethX, buffer, size), return IP address of host */
+   XIF_GET_IPATARI,/* (ethX, buffer, size), return IP address of atari */
+   XIF_GET_NETMASK /* (ethX, buffer, size), return IP netmask */
+};
+
+#define DRV_NAME   nfeth
+#define DRV_VERSION0.3
+#define DRV_RELDATE10/12/2005
+
+#define MAX_UNIT   8
+
+/* These identify the driver base version and may not be removed. */
+static const char version[] __devinitdata =
+   KERN_INFO DRV_NAME .c:v DRV_VERSION   DRV_RELDATE
+S.Opichal, M.Jurik, P.Stehlik\n
+   KERN_INFO  http://aranym.atari.org/\n;;
+
+MODULE_AUTHOR(Milan Jurik);
+MODULE_DESCRIPTION(Atari NFeth driver);
+MODULE_LICENSE(GPL);
+/*
+MODULE_PARM(nfeth_debug, i);
+MODULE_PARM_DESC(nfeth_debug, nfeth_debug level (1-2));
+*/
+
+
+static long nfEtherID;
+static int nfEtherIRQ;
+
+struct nfeth_private {
+   int ethX;
+};
+
+static struct net_device *nfeth_dev[MAX_UNIT];
+
+static int nfeth_open(struct net_device *dev)
+{
+   struct nfeth_private *priv = netdev_priv(dev);
+   int res;
+
+   res = nf_call(nfEtherID + XIF_START, priv-ethX);
+
+   pr_debug(DRV_NAME : open %d\n, res);
+
+   /* Ready for data */
+   netif_start_queue(dev);
+
+   return 0;
+}
+
+static int nfeth_stop(struct net_device *dev)
+{
+   struct nfeth_private *priv = netdev_priv(dev);
+
+   /* No more data */
+   netif_stop_queue(dev);
+
+   nf_call(nfEtherID + XIF_STOP, priv-ethX);
+
+   return 0;
+}
+
+/*
+ * Read a packet out of the adapter and pass it to the upper layers
+ */
+static inline void recv_packet(struct net_device *dev)
+{
+   struct nfeth_private *priv = netdev_priv(dev);
+   unsigned short pktlen;
+   struct sk_buff *skb;
+
+   /* read 

Re: [Aranym-dev] [PATCH 0/4] m68k/atari: Add ARAnyM support

2011-02-06 Thread Petr Stehlik
Geert Uytterhoeven píše v Ne 06. 02. 2011 v 11:51 +0100:
 Questions:
   - Who should be listed as author for patches 1 and 4?

initial authors are

1 - Petr Stehlik
4 - Milan Jurik, Petr Stehlik

but of course Michael Schmitz a Roman Zippel updated and reworked the
ARAnyM support in the linux kernel significantly which should be
mentioned somewhere as well. And the network patch was based on Standa
Opichal's FreeMiNT driver.

   - Can I please have Signed-off-by's from the ARAnyM people?

Signed-off-by: Petr Stehlik psteh...@sophics.cz

Thanks, looking forward to running vanilla linux kernel on ARAnyM :-)

Petr


--
To unsubscribe from this list: send the line unsubscribe linux-m68k in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] m68k/atari: ARAnyM - Add support for console access

2011-02-06 Thread Petr Stehlik
Geert Uytterhoeven píše v Ne 06. 02. 2011 v 11:51 +0100:
 From: Roman Zippel zip...@linux-m68k.org
 
 Signed-off-by: Roman Zippel zip...@linux-m68k.org
 [geert] Cleanups and updates
 Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
 Cc: Petr Stehlik psteh...@sophics.cz

Signed-off-by: Petr Stehlik psteh...@sophics.cz

Petr


--
To unsubscribe from this list: send the line unsubscribe linux-m68k in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Aranym-dev] [PATCH 4/4] m68k/atari: ARAnyM - Add support for network access

2011-02-06 Thread Milan Jurik
Hi,

Signed-off-by: Milan Jurik milan.ju...@xylab.cz

The original e-mail address is dead for some time.

Best regards,

Milan

Geert Uytterhoeven píše v ne 06. 02. 2011 v 11:51 +0100:
 From: Michael Schmitz schm...@opal.biophys.uni-duesseldorf.de
 
 Should be signed off by Milan and Petr, really.
 
 [geert] Cleanups and updates
 Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
 Cc: Petr Stehlik psteh...@sophics.cz
 Cc: Milan Jurik m.ju...@sh.cvut.cz
 Cc: net...@vger.kernel.org
 
 ---
 Changelog:
   - 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  |  272 
 
  3 files changed, 281 insertions(+), 0 deletions(-)
  create mode 100644 arch/m68k/emu/nfeth.c
 
 diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
 index 6719c56..80df6ee 100644
 --- a/arch/m68k/Kconfig
 +++ b/arch/m68k/Kconfig
 @@ -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
 diff --git a/arch/m68k/emu/Makefile b/arch/m68k/emu/Makefile
 index a83ef1e..7dc2010 100644
 --- a/arch/m68k/emu/Makefile
 +++ b/arch/m68k/emu/Makefile
 @@ -6,3 +6,4 @@ obj-y += natfeat.o
  
  obj-$(CONFIG_NFBLOCK)+= nfblock.o
  obj-$(CONFIG_NFCON)  += nfcon.o
 +obj-$(CONFIG_NFETH)  += nfeth.o
 diff --git a/arch/m68k/emu/nfeth.c b/arch/m68k/emu/nfeth.c
 new file mode 100644
 index 000..5b2a33d
 --- /dev/null
 +++ b/arch/m68k/emu/nfeth.c
 @@ -0,0 +1,272 @@
 +/*
 + * atari_nfeth.c - ARAnyM ethernet card driver for GNU/Linux
 + *
 + * Copyright (c) 2005 Milan Jurik, Petr Stehlik of ARAnyM dev team
 + *
 + * Based on ARAnyM driver for FreeMiNT written by Standa Opichal
 + *
 + * This software may be used and distributed according to the terms of
 + * the GNU General Public License (GPL), incorporated herein by reference.
 + */
 +
 +#include linux/netdevice.h
 +#include linux/etherdevice.h
 +#include linux/module.h
 +#include asm/natfeat.h
 +#include asm/virtconvert.h
 +
 +enum {
 + GET_VERSION = 0,/* no parameters, return NFAPI_VERSION in d0 */
 + XIF_INTLEVEL,   /* no parameters, return Interrupt Level in d0 */
 + XIF_IRQ,/* acknowledge interrupt from host */
 + XIF_START,  /* (ethX), called on 'ifup', start receiver thread */
 + XIF_STOP,   /* (ethX), called on 'ifdown', stop the thread */
 + XIF_READLENGTH, /* (ethX), return size of network data block to read */
 + XIF_READBLOCK,  /* (ethX, buffer, size), read block of network data */
 + XIF_WRITEBLOCK, /* (ethX, buffer, size), write block of network data */
 + XIF_GET_MAC,/* (ethX, buffer, size), return MAC HW addr in buffer */
 + XIF_GET_IPHOST, /* (ethX, buffer, size), return IP address of host */
 + XIF_GET_IPATARI,/* (ethX, buffer, size), return IP address of atari */
 + XIF_GET_NETMASK /* (ethX, buffer, size), return IP netmask */
 +};
 +
 +#define DRV_NAME nfeth
 +#define DRV_VERSION  0.3
 +#define DRV_RELDATE  10/12/2005
 +
 +#define MAX_UNIT 8
 +
 +/* These identify the driver base version and may not be removed. */
 +static const char version[] __devinitdata =
 + KERN_INFO DRV_NAME .c:v DRV_VERSION   DRV_RELDATE
 +  S.Opichal, M.Jurik, P.Stehlik\n
 + KERN_INFO  http://aranym.atari.org/\n;;
 +
 +MODULE_AUTHOR(Milan Jurik);
 +MODULE_DESCRIPTION(Atari NFeth driver);
 +MODULE_LICENSE(GPL);
 +/*
 +MODULE_PARM(nfeth_debug, i);
 +MODULE_PARM_DESC(nfeth_debug, nfeth_debug level (1-2));
 +*/
 +
 +
 +static long nfEtherID;
 +static int nfEtherIRQ;
 +
 +struct nfeth_private {
 + int ethX;
 +};
 +
 +static struct net_device *nfeth_dev[MAX_UNIT];
 +
 +static int nfeth_open(struct net_device *dev)
 +{
 + struct nfeth_private *priv = netdev_priv(dev);
 + int res;
 +
 + res = nf_call(nfEtherID + XIF_START, priv-ethX);
 +
 + pr_debug(DRV_NAME : open %d\n, res);
 +
 + /* Ready for data */
 + netif_start_queue(dev);
 +
 + return 0;
 +}
 +
 +static int nfeth_stop(struct net_device *dev)
 +{
 + struct nfeth_private *priv = netdev_priv(dev);
 +
 + /* No more data */
 + netif_stop_queue(dev);
 +
 + nf_call(nfEtherID + XIF_STOP, priv-ethX);
 +
 + return 0;
 +}
 +
 +/*
 + * Read 

Re: [PATCH 4/4] m68k/atari: ARAnyM - Add support for network access

2011-02-06 Thread David Miller
From: Geert Uytterhoeven ge...@linux-m68k.org
Date: Sun,  6 Feb 2011 11:51:09 +0100

 + dev-trans_start = jiffies;

Device drivers no longer make this operation, the generic code
does it (see net/core/dev.c:dev_hard_start_xmit() and how it
invokes txq_trans_update() on -ndo_start_xmit() success).

Therefore, please remove this line.

 + pr_debug(DRV_NAME : send %d bytes\n, len);

For consistency with other network drivers, add an appropriate CPP
define for pr_fmt and use netdev_info(), netdev_debug(), etc.

In situations where a netdev pointer is not available
(ie. pre-register_netdev()), use dev_*() instead.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-m68k in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html