Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/acorn32 Update for new world of indirect wdc regist...



details:   https://anonhg.NetBSD.org/src/rev/b075e219938a
branches:  trunk
changeset: 555871:b075e219938a
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Tue Dec 02 23:47:20 2003 +0000

description:
Update for new world of indirect wdc registers.

diffstat:

 sys/arch/acorn32/mainbus/wdc_pioc.c |  33 ++++++++++++++++++++++++++-------
 sys/arch/acorn32/podulebus/icside.c |  14 ++++++++++----
 sys/arch/acorn32/podulebus/rapide.c |  21 +++++++++++++++------
 sys/arch/acorn32/podulebus/simide.c |  19 ++++++++++++++-----
 4 files changed, 65 insertions(+), 22 deletions(-)

diffs (263 lines):

diff -r 4850519afd96 -r b075e219938a sys/arch/acorn32/mainbus/wdc_pioc.c
--- a/sys/arch/acorn32/mainbus/wdc_pioc.c       Tue Dec 02 22:44:17 2003 +0000
+++ b/sys/arch/acorn32/mainbus/wdc_pioc.c       Tue Dec 02 23:47:20 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc_pioc.c,v 1.10 2003/10/08 11:01:16 bouyer Exp $     */
+/*     $NetBSD: wdc_pioc.c,v 1.11 2003/12/02 23:47:20 bjh21 Exp $      */
 
 /*
  * Copyright (c) 1997-1998 Mark Brinicombe.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_pioc.c,v 1.10 2003/10/08 11:01:16 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_pioc.c,v 1.11 2003/12/02 23:47:20 bjh21 Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -47,6 +47,7 @@
 #include <acorn32/mainbus/piocvar.h>
 
 #include <dev/ata/atavar.h>
+#include <dev/ic/wdcreg.h>
 #include <dev/ic/wdcvar.h>
 
 #include "locators.h"
@@ -85,7 +86,7 @@
 {
        struct pioc_attach_args *pa = aux;
        struct channel_softc ch;
-       int res;
+       int res, i;
        u_int iobase;
 
        if (pa->pa_name && strcmp(pa->pa_name, "wdc") != 0)
@@ -102,18 +103,28 @@
        ch.ctl_iot = pa->pa_iot;
 
        if (bus_space_map(ch.cmd_iot, iobase, WDC_PIOC_REG_NPORTS, 0,
-           &ch.cmd_ioh))
+           &ch.cmd_baseioh))
                return(0);
+       for (i = 0; i < WDC_PIOC_REG_NPORTS; i++) {
+               if (bus_space_subregion(ch.cmd_iot, ch.cmd_baseioh, i,
+                       i == 0 ? 4 : 1, &ch.cmd_iohs[i]) != 0) {
+                       bus_space_unmap(ch.cmd_iot, ch.cmd_baseioh,
+                           WDC_PIOC_REG_NPORTS);
+                       return 0;
+               }
+       }
+
        if (bus_space_map(ch.ctl_iot, iobase + WDC_PIOC_AUXREG_OFFSET,
            WDC_PIOC_AUXREG_NPORTS, 0, &ch.ctl_ioh)) {
-               bus_space_unmap(ch.cmd_iot, ch.cmd_ioh, WDC_PIOC_REG_NPORTS);
+               bus_space_unmap(ch.cmd_iot, ch.cmd_baseioh,
+                   WDC_PIOC_REG_NPORTS);
                return(0);
        }
 
        res = wdcprobe(&ch);
 
        bus_space_unmap(ch.ctl_iot, ch.ctl_ioh, WDC_PIOC_AUXREG_NPORTS);
-       bus_space_unmap(ch.cmd_iot, ch.cmd_ioh, WDC_PIOC_REG_NPORTS);
+       bus_space_unmap(ch.cmd_iot, ch.cmd_baseioh, WDC_PIOC_REG_NPORTS);
 
        if (res)
                 pa->pa_iosize = WDC_PIOC_REG_NPORTS;
@@ -134,6 +145,7 @@
        struct wdc_pioc_softc *sc = (void *)self;
        struct pioc_attach_args *pa = aux;
        u_int iobase;
+       int i;
 
        printf("\n");
 
@@ -141,8 +153,15 @@
        sc->wdc_channel.cmd_iot = pa->pa_iot;
        sc->wdc_channel.ctl_iot = pa->pa_iot;
        if (bus_space_map(sc->wdc_channel.cmd_iot, iobase,
-           WDC_PIOC_REG_NPORTS, 0, &sc->wdc_channel.cmd_ioh))
+           WDC_PIOC_REG_NPORTS, 0, &sc->wdc_channel.cmd_baseioh))
                panic("%s: couldn't map drive registers", self->dv_xname);
+       for (i = 0; i < WDC_PIOC_REG_NPORTS; i++) {
+               if (bus_space_subregion(sc->wdc_channel.cmd_iot,
+                       sc->wdc_channel.cmd_baseioh, i, i == 0 ? 4 : 1,
+                       &sc->wdc_channel.cmd_iohs[i]) != 0)
+                       panic("%s: couldn't submap drive registers",
+                           self->dv_xname);
+       }
            
        if (bus_space_map(sc->wdc_channel.ctl_iot,
            iobase + WDC_PIOC_AUXREG_OFFSET, WDC_PIOC_AUXREG_NPORTS, 0,
diff -r 4850519afd96 -r b075e219938a sys/arch/acorn32/podulebus/icside.c
--- a/sys/arch/acorn32/podulebus/icside.c       Tue Dec 02 22:44:17 2003 +0000
+++ b/sys/arch/acorn32/podulebus/icside.c       Tue Dec 02 23:47:20 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: icside.c,v 1.15 2003/10/19 18:49:25 he Exp $   */
+/*     $NetBSD: icside.c,v 1.16 2003/12/02 23:47:20 bjh21 Exp $        */
 
 /*
  * Copyright (c) 1997-1998 Mark Brinicombe
@@ -42,7 +42,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: icside.c,v 1.15 2003/10/19 18:49:25 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icside.c,v 1.16 2003/12/02 23:47:20 bjh21 Exp $");
 
 #include <sys/systm.h>
 #include <sys/conf.h>
@@ -56,6 +56,7 @@
 #include <acorn32/podulebus/icsidereg.h>
 
 #include <dev/ata/atavar.h>
+#include <dev/ic/wdcreg.h>
 #include <dev/ic/wdcvar.h>
 #include <dev/podulebus/podules.h>
 
@@ -174,7 +175,7 @@
        bus_space_handle_t ioh;
        const struct ide_version *ide = NULL;
        u_int iobase;
-       int channel;
+       int channel, i;
        struct icside_channel *icp;
        struct channel_softc *cp;
        int loop;
@@ -277,8 +278,13 @@
                        iobase = pa->pa_podule->fast_base;
 
                if (bus_space_map(iot, iobase + ide->ideregs[channel],
-                   IDE_REGISTER_SPACE, 0, &cp->cmd_ioh))
+                   IDE_REGISTER_SPACE, 0, &cp->cmd_baseioh))
                        return;
+               for (i = 0; i < IDE_REGISTER_SPACE; i++) {
+                       if (bus_space_subregion(cp->cmd_iot, cp->cmd_baseioh,
+                               i, i == 0 ? 4 : 1, &cp->cmd_iohs[i]) != 0)
+                               return;
+               }
                if (bus_space_map(iot, iobase + ide->auxregs[channel],
                    AUX_REGISTER_SPACE, 0, &cp->ctl_ioh))
                        return;
diff -r 4850519afd96 -r b075e219938a sys/arch/acorn32/podulebus/rapide.c
--- a/sys/arch/acorn32/podulebus/rapide.c       Tue Dec 02 22:44:17 2003 +0000
+++ b/sys/arch/acorn32/podulebus/rapide.c       Tue Dec 02 23:47:20 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rapide.c,v 1.14 2003/10/19 19:29:50 he Exp $   */
+/*     $NetBSD: rapide.c,v 1.15 2003/12/02 23:47:20 bjh21 Exp $        */
 
 /*
  * Copyright (c) 1997-1998 Mark Brinicombe
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rapide.c,v 1.14 2003/10/19 19:29:50 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rapide.c,v 1.15 2003/12/02 23:47:20 bjh21 Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -86,6 +86,7 @@
 #include <acorn32/podulebus/rapidereg.h>
 
 #include <dev/ata/atavar.h>
+#include <dev/ic/wdcreg.h>
 #include <dev/ic/wdcvar.h>
 #include <dev/podulebus/podules.h>
 
@@ -196,7 +197,7 @@
        bus_space_tag_t iot;
        bus_space_handle_t ctlioh;
        u_int iobase;
-       int channel;
+       int channel, i;
        struct rapide_channel *rcp;
        struct channel_softc *cp;
        irqhandler_t *ihp;
@@ -268,17 +269,25 @@
                cp->data32iot = iot;
 
                if (bus_space_map(iot, iobase + rapide_info[channel].registers,
-                   DRIVE_REGISTERS_SPACE, 0, &cp->cmd_ioh))
+                   DRIVE_REGISTERS_SPACE, 0, &cp->cmd_baseioh))
                        continue;
+               for (i = 0; i < DRIVE_REGISTERS_SPACE; i++) {
+                       if (bus_space_subregion(cp->cmd_iot, cp->cmd_baseioh,
+                               i, i == 0 ? 4 : 1, &cp->cmd_iohs[i]) != 0) {
+                               bus_space_unmap(iot, cp->cmd_baseioh,
+                                   DRIVE_REGISTERS_SPACE);
+                               continue;
+                       }
+               }
                if (bus_space_map(iot, iobase +
                    rapide_info[channel].aux_register, 4, 0, &cp->ctl_ioh)) {
-                       bus_space_unmap(iot, cp->cmd_ioh,
+                       bus_space_unmap(iot, cp->cmd_baseioh,
                           DRIVE_REGISTERS_SPACE);
                        continue;
                }
                if (bus_space_map(iot, iobase +
                    rapide_info[channel].data_register, 4, 0, &cp->data32ioh)) {
-                       bus_space_unmap(iot, cp->cmd_ioh,
+                       bus_space_unmap(iot, cp->cmd_baseioh,
                           DRIVE_REGISTERS_SPACE);
                        bus_space_unmap(iot, cp->ctl_ioh, 4);
                        continue;
diff -r 4850519afd96 -r b075e219938a sys/arch/acorn32/podulebus/simide.c
--- a/sys/arch/acorn32/podulebus/simide.c       Tue Dec 02 22:44:17 2003 +0000
+++ b/sys/arch/acorn32/podulebus/simide.c       Tue Dec 02 23:47:20 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: simide.c,v 1.13 2003/10/19 19:29:50 he Exp $   */
+/*     $NetBSD: simide.c,v 1.14 2003/12/02 23:47:20 bjh21 Exp $        */
 
 /*
  * Copyright (c) 1997-1998 Mark Brinicombe
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: simide.c,v 1.13 2003/10/19 19:29:50 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: simide.c,v 1.14 2003/12/02 23:47:20 bjh21 Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -55,6 +55,7 @@
 #include <acorn32/podulebus/simidereg.h>
 
 #include <dev/ata/atavar.h>
+#include <dev/ic/wdcreg.h>
 #include <dev/ic/wdcvar.h>
 #include <dev/podulebus/podules.h>
 
@@ -160,7 +161,7 @@
        struct podule_attach_args *pa = (void *)aux;
        int status;
        u_int iobase;
-       int channel;
+       int channel, i;
        struct simide_channel *scp;
        struct channel_softc *cp;
        irqhandler_t *ihp;
@@ -265,11 +266,19 @@
                iobase = pa->pa_podule->mod_base;
                if (bus_space_map(cp->cmd_iot, iobase +
                    simide_info[channel].drive_registers,
-                   DRIVE_REGISTERS_SPACE, 0, &cp->cmd_ioh)) 
+                   DRIVE_REGISTERS_SPACE, 0, &cp->cmd_baseioh)) 
                        continue;
+               for (i = 0; i < DRIVE_REGISTERS_SPACE; i++) {
+                       if (bus_space_subregion(cp->cmd_iot, cp->cmd_baseioh,
+                               i, i == 0 ? 4 : 1, &cp->cmd_iohs[i]) != 0) {
+                               bus_space_unmap(cp->cmd_iot, cp->cmd_baseioh,
+                                   DRIVE_REGISTERS_SPACE);
+                               continue;
+                       }
+               }
                if (bus_space_map(cp->ctl_iot, iobase +
                    simide_info[channel].aux_register, 4, 0, &cp->ctl_ioh)) {
-                       bus_space_unmap(cp->cmd_iot, cp->cmd_ioh,
+                       bus_space_unmap(cp->cmd_iot, cp->cmd_baseioh,
                            DRIVE_REGISTERS_SPACE);
                        continue;
                }



Home | Main Index | Thread Index | Old Index