wdc_obio can be used again.

This commit is contained in:
nonaka 2004-03-10 15:14:49 +00:00
parent 034e646220
commit b67a1a734a
1 changed files with 21 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdc_obio.c,v 1.14 2004/01/06 18:46:08 he Exp $ */ /* $NetBSD: wdc_obio.c,v 1.15 2004/03/10 15:14:49 nonaka Exp $ */
/*- /*-
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.14 2004/01/06 18:46:08 he Exp $"); __KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.15 2004/03/10 15:14:49 nonaka Exp $");
#include <sys/types.h> #include <sys/types.h>
#include <sys/param.h> #include <sys/param.h>
@ -80,13 +80,20 @@ wdc_obio_probe(struct device *parent, struct cfdata *match, void *aux)
struct wdc_channel ch; struct wdc_channel ch;
struct obio_attach_args *oa = aux; struct obio_attach_args *oa = aux;
int result = 0; int result = 0;
int i;
bzero(&ch, sizeof(ch)); memset(&ch, 0, sizeof(ch));
ch.cmd_iot = oa->oa_iot; ch.cmd_iot = oa->oa_iot;
if (bus_space_map(ch.cmd_iot, oa->oa_iobase, WDC_OBIO_REG_NPORTS, 0, if (bus_space_map(ch.cmd_iot, oa->oa_iobase, WDC_OBIO_REG_NPORTS, 0,
&ch.cmd_baseioh)) &ch.cmd_baseioh))
goto out; goto out;
for (i = 0; i < WDC_OBIO_REG_NPORTS; i++) {
if (bus_space_subregion(ch.cmd_iot, ch.cmd_baseioh, i,
i == 0 ? 4 : 1, &ch.cmd_iohs[i]) != 0)
goto outunmap;
}
ch.ctl_iot = oa->oa_iot; ch.ctl_iot = oa->oa_iot;
if (bus_space_map(ch.ctl_iot, oa->oa_iobase + WDC_OBIO_AUXREG_OFFSET, if (bus_space_map(ch.ctl_iot, oa->oa_iobase + WDC_OBIO_AUXREG_OFFSET,
WDC_OBIO_AUXREG_NPORTS, 0, &ch.ctl_ioh)) WDC_OBIO_AUXREG_NPORTS, 0, &ch.ctl_ioh))
@ -110,6 +117,7 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux)
{ {
struct wdc_obio_softc *sc = (void *)self; struct wdc_obio_softc *sc = (void *)self;
struct obio_attach_args *oa = aux; struct obio_attach_args *oa = aux;
int i;
printf("\n"); printf("\n");
@ -123,6 +131,16 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux)
printf("%s: couldn't map registers\n", printf("%s: couldn't map registers\n",
sc->sc_wdcdev.sc_dev.dv_xname); sc->sc_wdcdev.sc_dev.dv_xname);
} }
for (i = 0; i < WDC_OBIO_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) {
printf(": couldn't subregion registers\n");
return;
}
}
sc->wdc_channel.data32iot = sc->wdc_channel.cmd_iot; sc->wdc_channel.data32iot = sc->wdc_channel.cmd_iot;
sc->wdc_channel.data32ioh = sc->wdc_channel.cmd_iohs[0]; sc->wdc_channel.data32ioh = sc->wdc_channel.cmd_iohs[0];