From 870dad0f43e2552c955591191b9d339f248bde57 Mon Sep 17 00:00:00 2001 From: bjh21 Date: Tue, 2 Dec 2003 23:47:20 +0000 Subject: [PATCH] Update for new world of indirect wdc registers. --- 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(-) diff --git a/sys/arch/acorn32/mainbus/wdc_pioc.c b/sys/arch/acorn32/mainbus/wdc_pioc.c index 4199ab475326..13b6fd4ee396 100644 --- a/sys/arch/acorn32/mainbus/wdc_pioc.c +++ b/sys/arch/acorn32/mainbus/wdc_pioc.c @@ -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 -__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 #include @@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: wdc_pioc.c,v 1.10 2003/10/08 11:01:16 bouyer Exp $") #include #include +#include #include #include "locators.h" @@ -85,7 +86,7 @@ wdc_pioc_probe(parent, cf, aux) { 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 @@ wdc_pioc_probe(parent, cf, aux) 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 @@ wdc_pioc_attach(parent, self, aux) struct wdc_pioc_softc *sc = (void *)self; struct pioc_attach_args *pa = aux; u_int iobase; + int i; printf("\n"); @@ -141,8 +153,15 @@ wdc_pioc_attach(parent, self, aux) 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 --git a/sys/arch/acorn32/podulebus/icside.c b/sys/arch/acorn32/podulebus/icside.c index a8d33c3622c8..2b5737a4b449 100644 --- a/sys/arch/acorn32/podulebus/icside.c +++ b/sys/arch/acorn32/podulebus/icside.c @@ -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 -__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 #include @@ -56,6 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: icside.c,v 1.15 2003/10/19 18:49:25 he Exp $"); #include #include +#include #include #include @@ -174,7 +175,7 @@ icside_attach(struct device *parent, struct device *self, void *aux) 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 @@ icside_attach(struct device *parent, struct device *self, void *aux) 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 --git a/sys/arch/acorn32/podulebus/rapide.c b/sys/arch/acorn32/podulebus/rapide.c index 45b68cb69afd..c28fc23019ee 100644 --- a/sys/arch/acorn32/podulebus/rapide.c +++ b/sys/arch/acorn32/podulebus/rapide.c @@ -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 -__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 #include @@ -86,6 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: rapide.c,v 1.14 2003/10/19 19:29:50 he Exp $"); #include #include +#include #include #include @@ -196,7 +197,7 @@ rapide_attach(parent, self, aux) 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 @@ rapide_attach(parent, self, aux) 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 --git a/sys/arch/acorn32/podulebus/simide.c b/sys/arch/acorn32/podulebus/simide.c index 7d7bb86c9dc3..b1ce3bb6b764 100644 --- a/sys/arch/acorn32/podulebus/simide.c +++ b/sys/arch/acorn32/podulebus/simide.c @@ -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 -__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 #include @@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: simide.c,v 1.13 2003/10/19 19:29:50 he Exp $"); #include #include +#include #include #include @@ -160,7 +161,7 @@ simide_attach(parent, self, aux) 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 @@ simide_attach(parent, self, aux) 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; }