Source-Changes-HG archive

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

[src/trunk]: src/sys 1) Use config_interrupts() to attach IDE and ATAPI drive...



details:   https://anonhg.NetBSD.org/src/rev/b4690c4a8161
branches:  trunk
changeset: 552140:b4690c4a8161
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Fri Sep 19 21:35:56 2003 +0000

description:
1) Use config_interrupts() to attach IDE and ATAPI drives.  This eliminates
   most polling.
2) Clean up some goofiness in pciide -- get rid of the whole "candisable" path
   (it's gratuitous) and simplify the code by calling pciide_map_compat_intr(),
   *_set_modes() and wdc_print_modes() from central locations.
3) Add a register writability and register ghost test to eliminate phantom
   drives more quickly.

diffstat:

 sys/arch/acorn32/mainbus/wdc_pioc.c    |    7 +-
 sys/arch/amiga/dev/wdc_amiga.c         |    8 +-
 sys/arch/atari/dev/wdc_mb.c            |    9 +-
 sys/arch/i386/pnpbios/pciide_pnpbios.c |   20 +-
 sys/arch/mac68k/obio/wdc_obio.c        |    6 +-
 sys/arch/macppc/dev/kauai.c            |   11 +-
 sys/arch/macppc/dev/wdc_obio.c         |   12 +-
 sys/arch/playstation2/dev/wdc_spd.c    |    8 +-
 sys/arch/prep/dev/wdc_obio.c           |    9 +-
 sys/dev/ata/wd.c                       |    8 +-
 sys/dev/ic/wdc.c                       |  161 +++++++++++----
 sys/dev/ic/wdc_upc.c                   |   10 +-
 sys/dev/ic/wdcvar.h                    |    8 +-
 sys/dev/isa/wdc_isa.c                  |   11 +-
 sys/dev/isapnp/wdc_isapnp.c            |   10 +-
 sys/dev/ofisa/wdc_ofisa.c              |    8 +-
 sys/dev/pci/pciide.c                   |  354 +++++++-------------------------
 sys/dev/pcmcia/wdc_pcmcia.c            |   39 +-
 sys/dev/podulebus/dtide.c              |    7 +-
 sys/dev/podulebus/hcide.c              |    9 +-
 sys/dev/scsipi/atapi_wdc.c             |   94 ++-----
 21 files changed, 329 insertions(+), 480 deletions(-)

diffs (truncated from 2021 to 300 lines):

diff -r 08c3763348b5 -r b4690c4a8161 sys/arch/acorn32/mainbus/wdc_pioc.c
--- a/sys/arch/acorn32/mainbus/wdc_pioc.c       Fri Sep 19 18:32:41 2003 +0000
+++ b/sys/arch/acorn32/mainbus/wdc_pioc.c       Fri Sep 19 21:35:56 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc_pioc.c,v 1.7 2003/07/14 22:48:25 lukem Exp $       */
+/*     $NetBSD: wdc_pioc.c,v 1.8 2003/09/19 21:35:56 mycroft Exp $     */
 
 /*
  * Copyright (c) 1997-1998 Mark Brinicombe.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_pioc.c,v 1.7 2003/07/14 22:48:25 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_pioc.c,v 1.8 2003/09/19 21:35:56 mycroft Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -167,7 +167,8 @@
                    sc->sc_wdcdev.sc_dev.dv_xname);
                return;
        }
-       wdcattach(&sc->wdc_channel);
+
+       config_interrupts(self, wdcattach);
 }
 
 /* End of wdc_pioc.c */
diff -r 08c3763348b5 -r b4690c4a8161 sys/arch/amiga/dev/wdc_amiga.c
--- a/sys/arch/amiga/dev/wdc_amiga.c    Fri Sep 19 18:32:41 2003 +0000
+++ b/sys/arch/amiga/dev/wdc_amiga.c    Fri Sep 19 21:35:56 2003 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: wdc_amiga.c,v 1.10 2002/10/02 04:55:53 thorpej Exp $ */
+/*     $NetBSD: wdc_amiga.c,v 1.11 2003/09/19 21:35:57 mycroft Exp $ */
 
 /*-
- * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_amiga.c,v 1.10 2002/10/02 04:55:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_amiga.c,v 1.11 2003/09/19 21:35:57 mycroft Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -142,7 +142,7 @@
        if (sc->sc_a1200)
                gayle.intena |= GAYLE_INT_IDE;
 
-       wdcattach(&sc->wdc_channel);
+       config_interrupts(self, wdcattach);
 }
 
 int
diff -r 08c3763348b5 -r b4690c4a8161 sys/arch/atari/dev/wdc_mb.c
--- a/sys/arch/atari/dev/wdc_mb.c       Fri Sep 19 18:32:41 2003 +0000
+++ b/sys/arch/atari/dev/wdc_mb.c       Fri Sep 19 21:35:56 2003 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: wdc_mb.c,v 1.12 2003/07/15 01:19:52 lukem Exp $        */
+/*     $NetBSD: wdc_mb.c,v 1.13 2003/09/19 21:35:58 mycroft Exp $      */
 
 /*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_mb.c,v 1.12 2003/07/15 01:19:52 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_mb.c,v 1.13 2003/09/19 21:35:58 mycroft Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -185,7 +185,6 @@
                sc->sc_wdcdev.sc_dev.dv_xname);
            return;
        }
-       wdcattach(&sc->wdc_channel);
 
        /*
         * Setup & enable disk related interrupts.
@@ -193,6 +192,8 @@
        MFP->mf_ierb |= IB_DINT;
        MFP->mf_iprb  = (u_int8_t)~IB_DINT;
        MFP->mf_imrb |= IB_DINT;
+
+       config_interrupts(self, wdcattach);
 }
 
 /*
diff -r 08c3763348b5 -r b4690c4a8161 sys/arch/i386/pnpbios/pciide_pnpbios.c
--- a/sys/arch/i386/pnpbios/pciide_pnpbios.c    Fri Sep 19 18:32:41 2003 +0000
+++ b/sys/arch/i386/pnpbios/pciide_pnpbios.c    Fri Sep 19 21:35:56 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pciide_pnpbios.c,v 1.7 2002/10/02 05:47:17 thorpej Exp $       */
+/*     $NetBSD: pciide_pnpbios.c,v 1.8 2003/09/19 21:35:59 mycroft Exp $       */
 
 /*
  * Copyright (c) 1999 Soren S. Jorvang.  All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pciide_pnpbios.c,v 1.7 2002/10/02 05:47:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciide_pnpbios.c,v 1.8 2003/09/19 21:35:59 mycroft Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -53,6 +53,7 @@
 
 static int     pciide_pnpbios_match(struct device *, struct cfdata *, void *);
 static void    pciide_pnpbios_attach(struct device *, struct device *, void *);
+void           pciide_pnpbios_setup_channel(struct channel_softc *);
 
 extern void    pciide_channel_dma_setup(struct pciide_channel *);
 extern int     pciide_dma_init(void *, int, int, void *, size_t, int);
@@ -121,12 +122,13 @@
        sc->sc_wdcdev.nchannels = 1;
        sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32;
        sc->sc_wdcdev.cap |= WDC_CAPABILITY_DMA | WDC_CAPABILITY_UDMA;
-#if 0  /* Need documentation. */
+#if 0 /* XXX */
        sc->sc_wdcdev.cap |= WDC_CAPABILITY_MODE;
 #endif
         sc->sc_wdcdev.PIO_cap = 4;
         sc->sc_wdcdev.DMA_cap = 2;             /* XXX */
         sc->sc_wdcdev.UDMA_cap = 2;            /* XXX */
+       sc->sc_wdcdev.set_modes = pciide_pnpbios_setup_channel;
 
        cp = &sc->pciide_channels[0];
        sc->wdc_chanarray[0] = &cp->wdc_channel;
@@ -146,13 +148,21 @@
        wdc_cp->ctl_iot = wdc_cp->data32iot = compat_iot;
        wdc_cp->ctl_ioh = wdc_cp->data32ioh = ctl_ioh;
 
-       cp->hw_ok = 1;                          /* XXX */
        cp->compat = 1;
 
        cp->ih = pnpbios_intr_establish(aa->pbt, aa->resc, 0, IPL_BIO,
                                        pciide_compat_intr, cp);
 
-       wdcattach(wdc_cp);
+       config_interrupts(self, wdcattach);
 
        pciide_channel_dma_setup(cp);
 }
+
+void
+pciide_pnpbios_setup_channel(chp)
+       struct channel_softc *chp;
+{
+       struct pciide_channel *cp = (struct pciide_channel *)chp;
+
+       pciide_channel_dma_setup(cp);
+}
diff -r 08c3763348b5 -r b4690c4a8161 sys/arch/mac68k/obio/wdc_obio.c
--- a/sys/arch/mac68k/obio/wdc_obio.c   Fri Sep 19 18:32:41 2003 +0000
+++ b/sys/arch/mac68k/obio/wdc_obio.c   Fri Sep 19 21:35:56 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc_obio.c,v 1.4 2003/07/15 02:43:26 lukem Exp $ */
+/*     $NetBSD: wdc_obio.c,v 1.5 2003/09/19 21:35:59 mycroft Exp $ */
 
 /*
  * Copyright (c) 2002 Takeshi Shibagaki  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.4 2003/07/15 02:43:26 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.5 2003/09/19 21:35:59 mycroft Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -227,7 +227,7 @@
        
        printf("\n");
 
-       wdcattach(chp);
+       config_interrupts(self, wdcattach);
 }
 
 u_int16_t
diff -r 08c3763348b5 -r b4690c4a8161 sys/arch/macppc/dev/kauai.c
--- a/sys/arch/macppc/dev/kauai.c       Fri Sep 19 18:32:41 2003 +0000
+++ b/sys/arch/macppc/dev/kauai.c       Fri Sep 19 21:35:56 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kauai.c,v 1.3 2003/08/17 18:10:09 chs Exp $    */
+/*     $NetBSD: kauai.c,v 1.4 2003/09/19 21:35:59 mycroft Exp $        */
 
 /*-
  * Copyright (c) 2003 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kauai.c,v 1.3 2003/08/17 18:10:09 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kauai.c,v 1.4 2003/09/19 21:35:59 mycroft Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -180,10 +180,7 @@
        chp->wdc = &sc->sc_wdcdev;
        chp->ch_queue = &sc->wdc_queue;
 
-       wdcattach(chp);
-
-       /* Modify access timings. */
-       kauai_set_modes(chp);
+       config_interrupts(self, wdcattach);
 }
 
 void
@@ -211,8 +208,6 @@
                            DMA_CONFIG_REG, sc->sc_dmatiming_r[drive]);
                }
        }
-
-       wdc_print_modes(chp);
 }
 
 /*
diff -r 08c3763348b5 -r b4690c4a8161 sys/arch/macppc/dev/wdc_obio.c
--- a/sys/arch/macppc/dev/wdc_obio.c    Fri Sep 19 18:32:41 2003 +0000
+++ b/sys/arch/macppc/dev/wdc_obio.c    Fri Sep 19 21:35:56 2003 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: wdc_obio.c,v 1.26 2003/07/15 02:43:30 lukem Exp $      */
+/*     $NetBSD: wdc_obio.c,v 1.27 2003/09/19 21:35:59 mycroft Exp $    */
 
 /*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.26 2003/07/15 02:43:30 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.27 2003/09/19 21:35:59 mycroft Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -224,9 +224,7 @@
                out32rb(OHARE_FEATURE_REG, x);
        }
 
-       wdcattach(chp);
-       sc->sc_wdcdev.set_modes(chp);
-
+       config_interrupts(self, wdcattach);
 }
 
 /* Multiword DMA transfer timings */
@@ -342,7 +340,6 @@
        } else if (sc->sc_dmaconf[1]) {
                wdc_obio_select(chp,1);
        }
-       wdc_print_modes(chp);
 }
 
 void
@@ -412,7 +409,6 @@
        } else if (sc->sc_dmaconf[1]) {
                wdc_obio_select(chp,1);
        }
-       wdc_print_modes(chp);
 }
 
 int
diff -r 08c3763348b5 -r b4690c4a8161 sys/arch/playstation2/dev/wdc_spd.c
--- a/sys/arch/playstation2/dev/wdc_spd.c       Fri Sep 19 18:32:41 2003 +0000
+++ b/sys/arch/playstation2/dev/wdc_spd.c       Fri Sep 19 21:35:56 2003 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: wdc_spd.c,v 1.4 2003/07/15 02:54:36 lukem Exp $        */
+/*     $NetBSD: wdc_spd.c,v 1.5 2003/09/19 21:36:00 mycroft Exp $      */
 
 /*-
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * Copyright (c) 2001, 2003 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_spd.c,v 1.4 2003/07/15 02:54:36 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_spd.c,v 1.5 2003/09/19 21:36:00 mycroft Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>



Home | Main Index | Thread Index | Old Index