Update for new world of indirect wdc registers.

This commit is contained in:
bjh21 2003-12-02 23:47:20 +00:00
parent 9bbe2098c6
commit 870dad0f43
4 changed files with 65 additions and 22 deletions

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: wdc_pioc.c,v 1.10 2003/10/08 11:01:16 bouyer Exp $")
#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 @@ 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,

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: icside.c,v 1.15 2003/10/19 18:49:25 he Exp $");
#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 @@ 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;

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: rapide.c,v 1.14 2003/10/19 19:29:50 he Exp $");
#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 @@ 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;

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: simide.c,v 1.13 2003/10/19 19:29:50 he Exp $");
#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 @@ 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;
}