Source-Changes-HG archive

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

[src/netbsd-9]: src/sys Pull up following revision(s) (requested by tsutsui i...



details:   https://anonhg.NetBSD.org/src/rev/95def506dc11
branches:  netbsd-9
changeset: 454623:95def506dc11
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Sep 23 07:09:47 2019 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #232):

        sys/arch/evbppc/mpc85xx/wdc_obio.c: revision 1.7
        sys/arch/dreamcast/dev/g1/wdc_g1.c: revision 1.4
        sys/arch/dreamcast/dev/g1/wdc_g1.c: revision 1.5
        sys/arch/mmeye/dev/wdc_mainbus.c: revision 1.7
        sys/dev/ic/wdcvar.h: revision 1.99
        sys/dev/ic/wdc.c: revision 1.292
        sys/arch/mips/adm5120/dev/wdc_extio.c: revision 1.11

adjust several missed drivers for wdcprobe() changes of ATA NCQ branch
for dreamcast g1 just drop the custom reset function, it doesn't seem to do
anything useful over the generic variant

PR kern/54538 by Izumi Tsutsui

Restore interface to pass a MD reset function to MI wdcprobe().

Fixes silent hang on G1IDE on Dreamcast. PR kern/54538
Should be pulled up to netbsd-9 with the previous changes.

diffstat:

 sys/arch/dreamcast/dev/g1/wdc_g1.c    |  29 +++++++++--------------------
 sys/arch/evbppc/mpc85xx/wdc_obio.c    |  13 +++----------
 sys/arch/mips/adm5120/dev/wdc_extio.c |  16 +++++++---------
 sys/arch/mmeye/dev/wdc_mainbus.c      |  15 ++++-----------
 sys/dev/ic/wdc.c                      |  17 ++++++++++++-----
 sys/dev/ic/wdcvar.h                   |   4 +++-
 6 files changed, 38 insertions(+), 56 deletions(-)

diffs (300 lines):

diff -r a35fef88ab0d -r 95def506dc11 sys/arch/dreamcast/dev/g1/wdc_g1.c
--- a/sys/arch/dreamcast/dev/g1/wdc_g1.c        Mon Sep 23 07:06:31 2019 +0000
+++ b/sys/arch/dreamcast/dev/g1/wdc_g1.c        Mon Sep 23 07:09:47 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wdc_g1.c,v 1.3 2017/10/20 07:06:06 jdolecek Exp $ */
+/* $NetBSD: wdc_g1.c,v 1.3.10.1 2019/09/23 07:09:47 martin Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -71,25 +71,14 @@
 static int
 wdc_g1_probe(device_t parent, cfdata_t cf, void *aux)
 {
-       struct ata_channel ch;
        struct g1bus_attach_args *ga = aux;
-       struct wdc_softc wdc;
        struct wdc_regs wdr;
        int result = 0, i;
-#ifdef ATADEBUG
-       struct device dev;
-#endif
 
        *((volatile uint32_t *)0xa05f74e4) = 0x1fffff;
        for (i = 0; i < 0x200000 / 4; i++)
                (void)((volatile uint32_t *)0xa0000000)[i];
 
-       memset(&wdc, 0, sizeof(wdc));
-       memset(&ch, 0, sizeof(ch));
-       ch.ch_atac = &wdc.sc_atac;
-       wdc.reset = wdc_g1_do_reset;
-       wdc.regs = &wdr;
-
        wdr.cmd_iot = ga->ga_memt;
        if (bus_space_map(wdr.cmd_iot, WDC_G1_CMD_ADDR,
            WDC_G1_REG_NPORTS * 4, 0, &wdr.cmd_baseioh))
@@ -101,20 +90,14 @@
                        goto outunmap;
        }
 
-       wdc_init_shadow_regs(&ch);
+       wdc_init_shadow_regs(&wdr);
 
        wdr.ctl_iot = ga->ga_memt;
        if (bus_space_map(wdr.ctl_iot, WDC_G1_CTL_ADDR,
            WDC_G1_AUXREG_NPORTS, 0, &wdr.ctl_ioh))
          goto outunmap;
 
-#ifdef ATADEBUG
-       /* fake up device name for ATADEBUG_PRINT() with DEBUG_PROBE */
-       memset(&dev, 0, sizeof(dev));
-       strncat(dev.dv_xname, "wdc(g1probe)", sizeof(dev.dv_xname));
-       wdc.sc_atac.atac_dev = &dev;
-#endif
-       result = wdcprobe(&ch);
+       result = wdcprobe_with_reset(&wdr, wdc_g1_do_reset);
        
        bus_space_unmap(wdr.ctl_iot, wdr.ctl_ioh, WDC_G1_AUXREG_NPORTS);
  outunmap:
@@ -181,6 +164,12 @@
        return wdcintr(arg);
 }
 
+/*
+ * This does what the generic wdc_do_reset() does, with additional
+ * GD-ROM reset. GD-ROM is a very early ATAPI device appeared in 1998
+ * and it doesn't reset itself by the WDCTL_RST in AUX_CTLR but requires
+ * ATAPI_SOFT_RESET command to reset whole device as a master.
+ */
 static void
 wdc_g1_do_reset(struct ata_channel *chp, int poll)
 {
diff -r a35fef88ab0d -r 95def506dc11 sys/arch/evbppc/mpc85xx/wdc_obio.c
--- a/sys/arch/evbppc/mpc85xx/wdc_obio.c        Mon Sep 23 07:06:31 2019 +0000
+++ b/sys/arch/evbppc/mpc85xx/wdc_obio.c        Mon Sep 23 07:09:47 2019 +0000
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.6 2017/10/20 07:06:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.6.8.1 2019/09/23 07:09:47 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -100,8 +100,6 @@
 {
        struct generic_attach_args * const ga = aux;
        bus_size_t size = ga->ga_size;
-       struct ata_channel ch;
-       struct wdc_softc wdc;
        struct wdc_regs wdr;
        struct device dev;
        int rv = 0;
@@ -115,18 +113,13 @@
         * We need to see if a CF is attached in True-IDE mode
         */
        memset(&dev, 0, sizeof(dev));
-       memset(&wdc, 0, sizeof(wdc));
-       memset(&ch, 0, sizeof(ch));
        memset(&wdr, 0, sizeof(wdr));
 
        dev.dv_xname[0] = '?';
-       wdc.sc_atac.atac_dev = &dev;
-       ch.ch_atac = &wdc.sc_atac;
-       wdc.regs = &wdr;
 
        if (wdc_obio_initregmap(&wdr, ga->ga_bst, ga->ga_addr, size)) {
-               wdc_init_shadow_regs(&ch);
-               rv = wdcprobe(&ch);
+               wdc_init_shadow_regs(&wdr);
+               rv = wdcprobe(&wdr);
                bus_space_unmap(wdr.cmd_iot, wdr.cmd_baseioh, size);
        }
 
diff -r a35fef88ab0d -r 95def506dc11 sys/arch/mips/adm5120/dev/wdc_extio.c
--- a/sys/arch/mips/adm5120/dev/wdc_extio.c     Mon Sep 23 07:06:31 2019 +0000
+++ b/sys/arch/mips/adm5120/dev/wdc_extio.c     Mon Sep 23 07:09:47 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc_extio.c,v 1.10 2017/10/20 07:06:07 jdolecek Exp $ */
+/*     $NetBSD: wdc_extio.c,v 1.10.8.1 2019/09/23 07:09:47 martin Exp $ */
 
 /*-
  * Copyright (c) 2007 David Young.  All rights reserved.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_extio.c,v 1.10 2017/10/20 07:06:07 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_extio.c,v 1.10.8.1 2019/09/23 07:09:47 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -156,7 +156,7 @@
 
 static int
 wdc_extio_map(struct extio_attach_args *ea, struct wdc_regs *wdr,
-    struct ata_channel *chp, void **gpio, struct gpio_pinmap *pinmap)
+    void **gpio, struct gpio_pinmap *pinmap)
 {
        int i;
 
@@ -200,7 +200,7 @@
                goto post_bus_err;
        }
 
-       wdc_init_shadow_regs(chp);
+       wdc_init_shadow_regs(wdr);
 
        return 0;
 post_bus_err:
@@ -234,8 +234,6 @@
 wdc_extio_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct extio_attach_args *ea = (struct extio_attach_args *)aux;
-       struct ata_channel ch;
-       struct wdc_softc wdc;
        struct wdc_regs wdr;
        int result = 0;
        void *gpio;
@@ -260,10 +258,10 @@
                    (WDC_CAPABILITY_PREATA|WDC_CAPABILITY_NO_EXTRA_RESETS);
        }
 
-       if (wdc_extio_map(ea, &wdr, &ch, &gpio, &pm) == -1)
+       if (wdc_extio_map(ea, &wdr, &gpio, &pm) == -1)
                return 0;
 
-       result = wdcprobe(&ch);
+       result = wdcprobe(&wdr);
 
        bus_space_unmap(wdr.cmd_iot, wdr.cmd_baseioh, WDC_OBIO_CF_WINSIZE);
 #if 0
@@ -289,7 +287,7 @@
        sc->sc_wdcdev.regs = wdr = &sc->sc_wdc_regs;
        chp->ch_atac = &sc->sc_wdcdev.sc_atac;
 
-       if (wdc_extio_map(ea, wdr, chp, &sc->sc_gpio, &sc->sc_pinmap) == -1)
+       if (wdc_extio_map(ea, wdr, &sc->sc_gpio, &sc->sc_pinmap) == -1)
                return;
 
        cf = device_cfdata(sc->sc_wdcdev.sc_atac.atac_dev);
diff -r a35fef88ab0d -r 95def506dc11 sys/arch/mmeye/dev/wdc_mainbus.c
--- a/sys/arch/mmeye/dev/wdc_mainbus.c  Mon Sep 23 07:06:31 2019 +0000
+++ b/sys/arch/mmeye/dev/wdc_mainbus.c  Mon Sep 23 07:09:47 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc_mainbus.c,v 1.6 2017/10/20 07:06:07 jdolecek Exp $ */
+/*     $NetBSD: wdc_mainbus.c,v 1.6.8.1 2019/09/23 07:09:47 martin Exp $       */
 /*
  * Copyright (c) 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_mainbus.c,v 1.6 2017/10/20 07:06:07 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_mainbus.c,v 1.6.8.1 2019/09/23 07:09:47 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -70,8 +70,6 @@
 wdc_mainbus_match(device_t parent, cfdata_t match, void *aux)
 {
        struct mainbus_attach_args *ma = aux;
-       struct ata_channel ch;
-       struct wdc_softc wdc;
        struct wdc_regs wdr;
        int result = 0, i;
 
@@ -83,11 +81,6 @@
            ma->ma_irq1 == MAINBUSCF_IRQ1_DEFAULT)
                return 0;
 
-       memset(&wdc, 0, sizeof(wdc));
-       memset(&ch, 0, sizeof(ch));
-       ch.ch_atac = &wdc.sc_atac;
-       wdc.regs = &wdr;
-
        wdr.cmd_iot = SH3_BUS_SPACE_PCMCIA_IO;
        if (bus_space_map(wdr.cmd_iot, ma->ma_addr1,
            WDC_MAINBUS_REG_NPORTS, 0, &wdr.cmd_baseioh) != 0)
@@ -98,7 +91,7 @@
                    i == 0 ? 4 : 1, &wdr.cmd_iohs[i]) != 0)
                        goto outunmap;
        }
-       wdc_init_shadow_regs(&ch);
+       wdc_init_shadow_regs(&wdr);
 
        wdr.ctl_iot = SH3_BUS_SPACE_PCMCIA_IO;
        if (bus_space_map(wdr.ctl_iot, ma->ma_addr1 + WDC_MAINBUS_AUXREG_OFFSET,
@@ -115,7 +108,7 @@
 printf("CF COR=0x%x\n", bus_space_read_1(iot, ioh, 0x200));
 delay(1000000);
 #endif
-       result = wdcprobe(&ch);
+       result = wdcprobe(&wdr);
 
        bus_space_unmap(wdr.ctl_iot, wdr.ctl_ioh, WDC_MAINBUS_AUXREG_NPORTS);
 outunmap:
diff -r a35fef88ab0d -r 95def506dc11 sys/dev/ic/wdc.c
--- a/sys/dev/ic/wdc.c  Mon Sep 23 07:06:31 2019 +0000
+++ b/sys/dev/ic/wdc.c  Mon Sep 23 07:09:47 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc.c,v 1.291 2018/10/27 05:38:08 maya Exp $ */
+/*     $NetBSD: wdc.c,v 1.291.4.1 2019/09/23 07:09:47 martin Exp $ */
 
 /*
  * Copyright (c) 1998, 2001, 2003 Manuel Bouyer.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.291 2018/10/27 05:38:08 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.291.4.1 2019/09/23 07:09:47 martin Exp $");
 
 #include "opt_ata.h"
 #include "opt_wdc.h"
@@ -477,6 +477,14 @@
 int
 wdcprobe(struct wdc_regs *wdr)
 {
+
+       return wdcprobe_with_reset(wdr, NULL);
+}
+
+int
+wdcprobe_with_reset(struct wdc_regs *wdr,
+    void (*do_reset)(struct ata_channel *, int))
+{
        struct wdc_softc wdc;
        struct ata_channel ch;
        int rv;
@@ -487,9 +495,8 @@
        ch.ch_atac = &wdc.sc_atac;
        wdc.regs = wdr;
 
-       /* default reset method */
-       if (wdc.reset == NULL)
-               wdc.reset = wdc_do_reset;
+       /* check the MD reset method */
+       wdc.reset = (do_reset != NULL) ? do_reset : wdc_do_reset;
 
        rv = wdcprobe1(&ch, 1);
 
diff -r a35fef88ab0d -r 95def506dc11 sys/dev/ic/wdcvar.h
--- a/sys/dev/ic/wdcvar.h       Mon Sep 23 07:06:31 2019 +0000
+++ b/sys/dev/ic/wdcvar.h       Mon Sep 23 07:09:47 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdcvar.h,v 1.98 2017/10/07 16:05:32 jdolecek Exp $     */
+/*     $NetBSD: wdcvar.h,v 1.98.10.1 2019/09/23 07:09:47 martin Exp $  */
 
 /*-
  * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -145,6 +145,8 @@
 void   wdc_init_shadow_regs(struct wdc_regs *);
 
 int    wdcprobe(struct wdc_regs *);
+int    wdcprobe_with_reset(struct wdc_regs *,
+           void (*)(struct ata_channel *, int));
 void   wdcattach(struct ata_channel *);
 int    wdcdetach(device_t, int);
 void   wdc_childdetached(device_t, device_t);



Home | Main Index | Thread Index | Old Index