Source-Changes-HG archive

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

[src/trunk]: src/sys Carve off the ISA configuration bits from the floppy dri...



details:   https://anonhg.NetBSD.org/src/rev/b3bcdaf46a72
branches:  trunk
changeset: 485261:b3bcdaf46a72
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Apr 23 16:47:45 2000 +0000

description:
Carve off the ISA configuration bits from the floppy driver.  Driver is
still ISA-specific, but we can attach ISA instances with different
configuration mechanisms now.

diffstat:

 sys/arch/alpha/conf/files.alpha |   13 +-
 sys/arch/bebox/conf/files.bebox |   13 +-
 sys/arch/i386/conf/files.i386   |   13 +-
 sys/dev/isa/fd.c                |  200 +---------------------------------
 sys/dev/isa/fdc_isa.c           |  226 ++++++++++++++++++++++++++++++++++++++++
 sys/dev/isa/fdcvar.h            |  147 ++++++++++++++++++++++++++
 6 files changed, 406 insertions(+), 206 deletions(-)

diffs (truncated from 750 to 300 lines):

diff -r 8c941792a2e1 -r b3bcdaf46a72 sys/arch/alpha/conf/files.alpha
--- a/sys/arch/alpha/conf/files.alpha   Sun Apr 23 16:38:52 2000 +0000
+++ b/sys/arch/alpha/conf/files.alpha   Sun Apr 23 16:47:45 2000 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.alpha,v 1.112 2000/04/07 18:58:09 nathanw Exp $
+# $NetBSD: files.alpha,v 1.113 2000/04/23 16:47:46 thorpej Exp $
 #
 # alpha-specific configuration info
 
@@ -227,11 +227,14 @@
 attach isabeep at pcppi
 
 # Floppy disk controller
-device fdc { drive = -1 }
-attach fdc at isa
-device fd: disk, isadma
+device fdc { drive = -1 }: isadma
+file   dev/isa/fd.c                    fdc needs-flag
+
+attach fdc at isa with fdc_isa
+file   dev/isa/fdc_isa.c               fdc_isa
+
+device fd: disk
 attach fd at fdc
-file   dev/isa/fd.c                    fdc needs-flag
 major  { fd = 0 }
 
 # ISA Plug 'n Play devices
diff -r 8c941792a2e1 -r b3bcdaf46a72 sys/arch/bebox/conf/files.bebox
--- a/sys/arch/bebox/conf/files.bebox   Sun Apr 23 16:38:52 2000 +0000
+++ b/sys/arch/bebox/conf/files.bebox   Sun Apr 23 16:47:45 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.bebox,v 1.19 2000/04/07 16:35:23 thorpej Exp $
+#      $NetBSD: files.bebox,v 1.20 2000/04/23 16:47:47 thorpej Exp $
 #
 # First try for bebox specific configuration info
 #
@@ -114,11 +114,14 @@
 include "dev/pckbc/files.pckbc"
 
 # Floppy disk controller
-device fdc {drive = -1}
-attach fdc at isa
-device fd: disk, isadma
+device fdc {drive = -1}: isadma
+file   dev/isa/fd.c                    fdc needs-flag
+
+attach fdc at isa with fdc_isa
+file   dev/isa/fdc_isa.c               fdc_isa
+
+device fd: disk
 attach fd at fdc
-file   dev/isa/fd.c                    fdc needs-flag
 major  {fd = 2}
 
 # Game adapter (joystick)
diff -r 8c941792a2e1 -r b3bcdaf46a72 sys/arch/i386/conf/files.i386
--- a/sys/arch/i386/conf/files.i386     Sun Apr 23 16:38:52 2000 +0000
+++ b/sys/arch/i386/conf/files.i386     Sun Apr 23 16:47:45 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.i386,v 1.156 2000/04/07 16:35:20 thorpej Exp $
+#      $NetBSD: files.i386,v 1.157 2000/04/23 16:47:46 thorpej Exp $
 #
 # new style config file for i386 architecture
 #
@@ -230,11 +230,14 @@
 attach sysbeep at pcppi
 
 # Floppy disk controller
-device fdc {drive = -1}
-attach fdc at isa
-device fd: disk, isadma
+device fdc {drive = -1}: isadma
+file   dev/isa/fd.c                    fdc needs-flag
+
+attach fdc at isa with fdc_isa
+file   dev/isa/fdc_isa.c               fdc_isa
+
+device fd: disk
 attach fd at fdc
-file   dev/isa/fd.c                    fdc needs-flag
 major  {fd = 2}
 
 attach joy at isa with joy_isa
diff -r 8c941792a2e1 -r b3bcdaf46a72 sys/dev/isa/fd.c
--- a/sys/dev/isa/fd.c  Sun Apr 23 16:38:52 2000 +0000
+++ b/sys/dev/isa/fd.c  Sun Apr 23 16:47:45 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.2 2000/04/07 16:58:53 thorpej Exp $   */
+/*     $NetBSD: fd.c,v 1.3 2000/04/23 16:47:45 thorpej Exp $   */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -136,7 +136,9 @@
 
 #include <dev/isa/isavar.h>
 #include <dev/isa/isadmavar.h>
+
 #include <dev/isa/fdreg.h>
+#include <dev/isa/fdcvar.h>
 
 #if defined(__i386__)
 #include <dev/ic/mc146818reg.h>                        /* for NVRAM access */
@@ -149,67 +151,8 @@
 /* XXX misuse a flag to identify format operation */
 #define B_FORMAT B_XXX
 
-enum fdc_state {
-       DEVIDLE = 0,
-       MOTORWAIT,
-       DOSEEK,
-       SEEKWAIT,
-       SEEKTIMEDOUT,
-       SEEKCOMPLETE,
-       DOIO,
-       IOCOMPLETE,
-       IOTIMEDOUT,
-       DORESET,
-       RESETCOMPLETE,
-       RESETTIMEDOUT,
-       DORECAL,
-       RECALWAIT,
-       RECALTIMEDOUT,
-       RECALCOMPLETE,
-};
-
-/* software state, per controller */
-struct fdc_softc {
-       struct device sc_dev;           /* boilerplate */
-       void *sc_ih;
-
-       bus_space_tag_t sc_iot;         /* ISA i/o space identifier */
-       bus_space_handle_t sc_ioh;      /* ISA io handle */
-       isa_chipset_tag_t sc_ic;        /* ISA chipset info */
-
-       struct callout sc_timo_ch;      /* timeout callout */
-       struct callout sc_intr_ch;      /* pseudo-intr callout */
-
-       /*
-        * XXX We have port overlap with the first IDE controller.
-        * Until we have a reasonable solution for handling overlap
-        * like this, we kludge access to our control register at
-        * offset 7.
-        */
-       bus_space_handle_t sc_fdctlioh;
-#define        sc_fdinioh      sc_fdctlioh
-
-       int sc_drq;
-       bus_size_t sc_maxiosize;
-
-       struct fd_softc *sc_fd[4];      /* pointers to children */
-       TAILQ_HEAD(drivehead, fd_softc) sc_drives;
-       enum fdc_state sc_state;
-       int sc_errors;                  /* number of retries so far */
-       u_char sc_status[7];            /* copy of registers */
-};
-
 /* controller driver configuration */
-int fdcprobe __P((struct device *, struct cfdata *, void *));
 int fdprint __P((void *, const char *));
-#ifdef NEWCONFIG
-void fdcforceintr __P((void *));
-#endif
-void fdcattach __P((struct device *, struct device *, void *));
-
-struct cfattach fdc_ca = {
-       sizeof(struct fdc_softc), fdcprobe, fdcattach
-};
 
 /*
  * Floppies come in various flavors, e.g., 1.2MB vs 1.44MB; here is how
@@ -282,16 +225,15 @@
 #endif
 };
 
-/* floppy driver configuration */
 int fdprobe __P((struct device *, struct cfdata *, void *));
 void fdattach __P((struct device *, struct device *, void *));
 
+extern struct cfdriver fd_cd;
+
 struct cfattach fd_ca = {
-       sizeof(struct fd_softc), fdprobe, fdattach
+       sizeof(struct fd_softc), fdprobe, fdattach,
 };
 
-extern struct cfdriver fd_cd;
-
 void fdgetdisklabel __P((struct fd_softc *));
 int fd_get_parms __P((struct fd_softc *));
 void fdstrategy __P((struct buf *));
@@ -306,12 +248,10 @@
 void fd_motor_off __P((void *arg));
 void fd_motor_on __P((void *arg));
 int fdcresult __P((struct fdc_softc *fdc));
-int out_fdc __P((bus_space_tag_t iot, bus_space_handle_t ioh, u_char x));
 void fdcstart __P((struct fdc_softc *fdc));
 void fdcstatus __P((struct device *dv, int n, char *s));
 void fdctimeout __P((void *arg));
 void fdcpseudointr __P((void *arg));
-int fdcintr __P((void *));
 void fdcretry __P((struct fdc_softc *fdc));
 void fdfinish __P((struct fd_softc *fd, struct buf *bp));
 __inline struct fd_type *fd_dev_to_type __P((struct fd_softc *, dev_t));
@@ -319,97 +259,6 @@
 
 void   fd_mountroot_hook __P((struct device *));
 
-int
-fdcprobe(parent, match, aux)
-       struct device *parent;
-       struct cfdata *match;
-       void *aux;
-{
-       register struct isa_attach_args *ia = aux;
-       bus_space_tag_t iot;
-       bus_space_handle_t ioh;
-       int rv;
-
-       iot = ia->ia_iot;
-       rv = 0;
-
-       /* Disallow wildcarded i/o address. */
-       if (ia->ia_iobase == IOBASEUNK)
-               return 0;
-
-       /* Map the i/o space. */
-       if (bus_space_map(iot, ia->ia_iobase, 6 /* XXX FDC_NPORT */, 0, &ioh))
-               return 0;
-
-       /* XXX XXX XXX BEGIN XXX XXX XXX */
-       {
-               bus_space_handle_t fdctlioh;
-               if (bus_space_map(iot, ia->ia_iobase + fdctl, 1, 0,
-                   &fdctlioh)) {
-                       bus_space_unmap(iot, ioh, 6);
-                       return 0;
-               }
-               /* not needed for the rest of the probe */
-               bus_space_unmap(iot, fdctlioh, 1);
-       }
-       /* XXX XXX XXX END XXX XXX XXX */
-
-       /* reset */
-       bus_space_write_1(iot, ioh, fdout, 0);
-       delay(100);
-       bus_space_write_1(iot, ioh, fdout, FDO_FRST);
-
-       /* see if it can handle a command */
-       if (out_fdc(iot, ioh, NE7CMD_SPECIFY) < 0)
-               goto out;
-       out_fdc(iot, ioh, 0xdf);
-       out_fdc(iot, ioh, 2);
-
-#ifdef NEWCONFIG
-       if (ia->ia_iobase == IOBASEUNK || ia->ia_drq == DRQUNK)
-               return 0;
-
-       if (ia->ia_irq == IRQUNK) {
-               ia->ia_irq = isa_discoverintr(fdcforceintr, aux);
-               if (ia->ia_irq == IRQNONE)
-                       goto out;
-
-               /* reset it again */
-               bus_space_write_1(iot, ioh, fdout, 0);
-               delay(100);
-               bus_space_write_1(iot, ioh, fdout, FDO_FRST);
-       }
-#endif
-
-       rv = 1;
-       ia->ia_iosize = FDC_NPORT;
-       ia->ia_msize = 0;
-
- out:
-       bus_space_unmap(iot, ioh, 6 /* XXX FDC_NPORT */);
-       return rv;
-}
-
-#ifdef NEWCONFIG
-/*
- * XXX This is broken, and needs fixing.  In general, the interface needs
- * XXX to change.
- */
-void
-fdcforceintr(aux)
-       void *aux;
-{
-       struct isa_attach_args *ia = aux;
-       int iobase = ia->ia_iobase;
-
-       /* the motor is off; this should generate an error with or
-          without a disk drive present */
-       out_fdc(iot, ioh, NE7CMD_SEEK);
-       out_fdc(iot, ioh, 0);
-       out_fdc(iot, ioh, 0);
-}
-#endif
-
 /*



Home | Main Index | Thread Index | Old Index