Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add driver for ELBOX FastATA 1200 Mk-III/Mk-IV (and the man ...



details:   https://anonhg.NetBSD.org/src/rev/25a0421469d9
branches:  trunk
changeset: 770651:25a0421469d9
user:      rkujawa <rkujawa%NetBSD.org@localhost>
date:      Thu Oct 27 22:12:23 2011 +0000

description:
Add driver for ELBOX FastATA 1200 Mk-III/Mk-IV (and the man page).

diffstat:

 distrib/sets/lists/man/mi          |    5 +-
 share/man/man4/man4.amiga/Makefile |    4 +-
 share/man/man4/man4.amiga/efa.4    |  110 +++++++
 sys/arch/amiga/conf/GENERIC.in     |    6 +-
 sys/arch/amiga/conf/files.amiga    |    7 +-
 sys/arch/amiga/dev/efa.c           |  558 +++++++++++++++++++++++++++++++++++++
 sys/arch/amiga/dev/efareg.h        |   74 ++++
 sys/arch/amiga/dev/efavar.h        |   70 ++++
 8 files changed, 828 insertions(+), 6 deletions(-)

diffs (truncated from 925 to 300 lines):

diff -r 619200ce13eb -r 25a0421469d9 distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Thu Oct 27 21:10:55 2011 +0000
+++ b/distrib/sets/lists/man/mi Thu Oct 27 22:12:23 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1350 2011/10/18 10:19:11 wiz Exp $
+# $NetBSD: mi,v 1.1351 2011/10/27 22:12:24 rkujawa Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -728,6 +728,7 @@
 ./usr/share/man/cat4/amiga/bppcsc.0            man-sys-catman          .cat
 ./usr/share/man/cat4/amiga/console.0           man-sys-catman          .cat
 ./usr/share/man/cat4/amiga/ed.0                        man-sys-catman          .cat
+./usr/share/man/cat4/amiga/efa.0               man-sys-catman          .cat
 ./usr/share/man/cat4/amiga/es.0                        man-sys-catman          .cat
 ./usr/share/man/cat4/amiga/fdc.0               man-sys-catman          .cat
 ./usr/share/man/cat4/amiga/grf.0               man-sys-catman          .cat
@@ -3604,6 +3605,7 @@
 ./usr/share/man/html4/amiga/bppcsc.html                man-sys-htmlman         html
 ./usr/share/man/html4/amiga/console.html       man-sys-htmlman         html
 ./usr/share/man/html4/amiga/ed.html            man-sys-htmlman         html
+./usr/share/man/html4/amiga/efa.html           man-sys-htmlman         html
 ./usr/share/man/html4/amiga/es.html            man-sys-htmlman         html
 ./usr/share/man/html4/amiga/fdc.html           man-sys-htmlman         html
 ./usr/share/man/html4/amiga/grf.html           man-sys-htmlman         html
@@ -6177,6 +6179,7 @@
 ./usr/share/man/man4/amiga/bppcsc.4            man-sys-man             .man
 ./usr/share/man/man4/amiga/console.4           man-sys-man             .man
 ./usr/share/man/man4/amiga/ed.4                        man-sys-man             .man
+./usr/share/man/man4/amiga/efa.4               man-sys-man             .man
 ./usr/share/man/man4/amiga/es.4                        man-sys-man             .man
 ./usr/share/man/man4/amiga/fdc.4               man-sys-man             .man
 ./usr/share/man/man4/amiga/grf.4               man-sys-man             .man
diff -r 619200ce13eb -r 25a0421469d9 share/man/man4/man4.amiga/Makefile
--- a/share/man/man4/man4.amiga/Makefile        Thu Oct 27 21:10:55 2011 +0000
+++ b/share/man/man4/man4.amiga/Makefile        Thu Oct 27 22:12:23 2011 +0000
@@ -1,8 +1,8 @@
 #      from: @(#)Makefile      8.2 (Berkeley) 2/16/94
-#      $NetBSD: Makefile,v 1.20 2011/09/17 17:04:22 rkujawa Exp $
+#      $NetBSD: Makefile,v 1.21 2011/10/27 22:12:24 rkujawa Exp $
 
 MAN=   afsc.4 ahsc.4 amidisplaycc.4 atzsc.4 autoconf.4 console.4 bah.4 \
-       bppcsc.4 ed.4 es.4 fdc.4 grf.4 \
+       bppcsc.4 ed.4 efa.4 es.4 fdc.4 grf.4 \
        grfcl.4 grfcv.4 grfcv3d.4 grfet.4 grfrh.4 grfrt.4 grful.4 \
        gtsc.4 intro.4 ite.4 mem.4 mfcs.4 mgnsc.4 mppb.4 p5pb.4 \
        qn.4 ser.4 wesc.4 zssc.4
diff -r 619200ce13eb -r 25a0421469d9 share/man/man4/man4.amiga/efa.4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/man4.amiga/efa.4   Thu Oct 27 22:12:23 2011 +0000
@@ -0,0 +1,110 @@
+.\" $NetBSD: efa.4,v 1.1 2011/10/27 22:12:24 rkujawa Exp $
+.\"
+.\" Copyright (c) 2011 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Radoslaw Kujawa.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd October 25, 2011
+.Dt EFA 4 amiga
+.Os
+.Sh NAME
+.Nm efa
+.Nd ELBOX FastATA 1200 IDE disk controller driver
+.Sh SYNOPSIS
+.Cd "efa0 at mainbus0"
+.\".Cd "options EFA_32BIT_IO"
+.\".Cd "options EFA_NO_INTR"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for the FastATA 1200 family of IDE controllers and
+provides the interface with the hardware for the
+.Xr ata 4
+driver. PIO modes 0, 3, 4 and 5 are supported.
+.\".Pp
+.\"The following kernel configuration options are available:
+.\".Bl -ohang
+.\".It Cd options EFA_32BIT_IO
+.\"Use 32-bit data port. 
+.\".It Cd options EFA_GAYLE_COMPAT
+.\"Drive FastATA in Gayle IDE compatibility mode. Use if the driver does not 
+.\"work correctly in native (default) mode. Limits operation to PIO0 mode.
+.\".El
+.Sh HARDWARE
+The
+.Nm
+driver supports the following hardware:
+.Bl -tag -width "ELBOX FastATA 1200 Mk-IV" -offset indent
+.It Em ELBOX FastATA 1200 Mk-III 
+.It Em ELBOX FastATA 1200 Mk-IV 
+.El
+.Sh SEE ALSO
+.Xr ata 4 ,
+.Xr wdc 4 
+.Sh HISTORY
+The
+.Nm
+device first appeared in
+.Nx 6.0 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm
+driver was written by
+.An Radoslaw Kujawa Aq radoslaw.kujawa%gmail.com@localhost .
+.Sh CAVEATS
+Older versions of FastATA 1200 are NOT supported:
+.Bl -tag -width "ELBOX FastATA 1200 Mk-II" -offset indent
+.It Em ELBOX FastATA 1200 Mk-I
+.It Em ELBOX FastATA 1200 Lite
+.It Em ELBOX FastATA 1200 GOLD
+.It Em ELBOX FastATA 1200 Mk-II
+.El
+.Pp
+These devices do not generate hardware interrupts and need to be driven in
+non-standard polling mode. Code needed to support it is present in driver
+but does not work correctly.
+.Pp
+Some of the above devices were also marketed under PowerFlyer and Winner brands.
+.Pp
+The
+.Nm
+driver can not coexist with 
+.Xr wdc 4
+driver attached to
+.Xr mainbus 4 , 
+because FastATA 1200 hardware uses portions of the on-board Gayle IDE 
+controller. These 
+drivers should not be enabled in the same kernel.
+.Pp
+DMA modes are not supported, this is a hardware limitation.
+.Sh BUGS
+Performance is worse than with official AmigaOS driver from ELBOX.
+.Pp
+Disks paritioned in split mode, which is specific to official AmigaOS FastATA
+driver, are not recognized in NetBSD.
+.Pp
+Improved probe procedure should be written.
diff -r 619200ce13eb -r 25a0421469d9 sys/arch/amiga/conf/GENERIC.in
--- a/sys/arch/amiga/conf/GENERIC.in    Thu Oct 27 21:10:55 2011 +0000
+++ b/sys/arch/amiga/conf/GENERIC.in    Thu Oct 27 22:12:23 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC.in,v 1.84 2011/09/19 19:15:29 rkujawa Exp $
+# $NetBSD: GENERIC.in,v 1.85 2011/10/27 22:12:23 rkujawa Exp $
 #
 ##
 # GENERIC machine description file
@@ -57,7 +57,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.84 $"
+#ident                 "GENERIC-$Revision: 1.85 $"
 
 m4_ifdef(`INSTALL_CONFIGURATION', `m4_dnl
 makeoptions    COPTS="-Os"
@@ -528,8 +528,10 @@
 
 wdc0           at mainbus0             # A4000 & A1200 IDE bus
 wdc*           at zbus0                # Buddha / Catweasel
+#efa0          at mainbus0             # ELBOX FastATA 1200 Mk-III/Mk-IV 
 
 atabus*        at wdc? channel ?       # ATA bus
+#atabus*               at efa? channel ?       # ATA bus 
 wd*            at atabus? drive ?      #  + drives
 atapibus*      at atabus?              # ATAPI bus
 cd*            at atapibus? drive ?    # ATAPI CD-ROM drives
diff -r 619200ce13eb -r 25a0421469d9 sys/arch/amiga/conf/files.amiga
--- a/sys/arch/amiga/conf/files.amiga   Thu Oct 27 21:10:55 2011 +0000
+++ b/sys/arch/amiga/conf/files.amiga   Thu Oct 27 22:12:23 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.amiga,v 1.148 2011/09/19 19:15:29 rkujawa Exp $
+#      $NetBSD: files.amiga,v 1.149 2011/10/27 22:12:23 rkujawa Exp $
 
 # maxpartitions must be first item in files.${ARCH}.newconf
 maxpartitions 16                       # NOTE THAT AMIGA IS SPECIAL!
@@ -470,6 +470,11 @@
 attach wdc at zbus with wdc_buddha
 file   arch/amiga/dev/wdc_buddha.c     wdc_buddha
 
+# FastATA 
+device  efa: ata,wdc_common
+attach  efa at mainbus
+file    arch/amiga/dev/efa.c           efa
+
 # Compatibility modules
 
 # NetBSD m68k a.out Binary Compatibility (COMPAT_AOUT_M68K)
diff -r 619200ce13eb -r 25a0421469d9 sys/arch/amiga/dev/efa.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amiga/dev/efa.c  Thu Oct 27 22:12:23 2011 +0000
@@ -0,0 +1,558 @@
+/*     $NetBSD: efa.c,v 1.1 2011/10/27 22:12:23 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* 
+ * Driver for FastATA 1200 EIDE controller, manufactured by ELBOX Computer. 
+ *
+ * Gayle-related stuff inspired by wdc_amiga.c written by Michael L. Hitch
+ * and Aymeric Vincent. 
+ */
+
+#include <sys/cdefs.h>
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <sys/device.h>
+#include <sys/bus.h>
+#include <sys/proc.h>
+#include <sys/kernel.h>
+#include <sys/kthread.h>
+
+#include <machine/cpu.h>
+#include <machine/intr.h>
+#include <sys/bswap.h>
+
+#include <amiga/amiga/cia.h>
+#include <amiga/amiga/custom.h>
+#include <amiga/amiga/device.h>
+#include <amiga/amiga/gayle.h>
+#include <amiga/dev/zbusvar.h>
+
+#include <dev/ata/atavar.h>
+#include <dev/ic/wdcvar.h>
+
+#include <amiga/dev/efareg.h>
+#include <amiga/dev/efavar.h>
+
+/* #define EFA_32BIT_IO 1 */
+/* #define EFA_NO_INTR 1 */
+/* #define EFA_DEBUG 1 */
+
+int            efa_probe(device_t, cfdata_t, void *);
+void           efa_attach(device_t, device_t, void *);
+int            efa_intr(void *);
+int            efa_intr_soft(void *arg);
+static void    efa_set_opts(struct efa_softc *sc);
+static bool    efa_mapbase(struct efa_softc *sc);
+static bool    efa_mapreg_gayle(struct efa_softc *sc);
+static bool    efa_mapreg_native(struct efa_softc *sc);
+static void    efa_fata_subregion_pio0(struct wdc_regs *wdr_fata);
+static void    efa_fata_subregion_pion(struct wdc_regs *wdr_fata, bool data32);
+static void    efa_setup_channel(struct ata_channel *chp);
+static void    efa_attach_channel(struct efa_softc *sc, int i);
+static void    efa_select_regset(struct efa_softc *sc, int chnum, 
+                   uint8_t piomode);
+static void    efa_poll_kthread(void *arg);



Home | Main Index | Thread Index | Old Index