- Split the register handles out of struct wdc_channel into a separate

wdc_regs structure, and array of which (indexed per channel) is pointed
  to by struct wdc_softc.
- Move the resulting wdc_channel structure to atavar.h and rename it to
  ata_channel.  Rename the corresponding flags.
- Add a "ch_ndrive" member to struct ata_channel, which indicates the
  maximum number of drives that can be present on the channel.  For now,
  this is always 2.  Add an ATA_MAXDRIVES constant that places an upper
  limit on this value, also currently 2.
This commit is contained in:
thorpej 2004-08-14 15:14:35 +00:00
parent 4b51cecfc2
commit 08fa2a3486
1 changed files with 11 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdc_upc.c,v 1.17 2004/08/14 15:08:05 thorpej Exp $ */
/* $NetBSD: wdc_upc.c,v 1.18 2004/08/14 15:14:35 thorpej Exp $ */
/*-
* Copyright (c) 2000 Ben Harris
* All rights reserved.
@ -28,7 +28,7 @@
/* This file is part of NetBSD/arm26 -- a port of NetBSD to ARM2/3 machines. */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wdc_upc.c,v 1.17 2004/08/14 15:08:05 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: wdc_upc.c,v 1.18 2004/08/14 15:14:35 thorpej Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -52,6 +52,7 @@ struct wdc_upc_softc {
struct ata_channel *sc_chanlist[1];
struct ata_channel sc_channel;
struct ata_queue sc_chqueue;
struct wdc_regs sc_wdc_regs;
};
CFATTACH_DECL(wdc_upc, sizeof(struct wdc_upc_softc),
@ -69,9 +70,12 @@ static void
wdc_upc_attach(struct device *parent, struct device *self, void *aux)
{
struct wdc_upc_softc *sc = (struct wdc_upc_softc *)self;
struct wdc_regs *wdr;
struct upc_attach_args *ua = aux;
int i;
sc->sc_wdc.regs = wdr = &sc->sc_wdc_regs;
sc->sc_wdc.cap = WDC_CAPABILITY_DATA16;
sc->sc_wdc.PIO_cap = 1; /* XXX ??? */
sc->sc_wdc.DMA_cap = 0;
@ -79,16 +83,16 @@ wdc_upc_attach(struct device *parent, struct device *self, void *aux)
sc->sc_wdc.nchannels = 1;
sc->sc_chanlist[0] = &sc->sc_channel;
sc->sc_wdc.channels = sc->sc_chanlist;
sc->sc_channel.cmd_iot = ua->ua_iot;
sc->sc_channel.cmd_baseioh = ua->ua_ioh;
sc->sc_channel.ctl_iot = ua->ua_iot;
sc->sc_channel.ctl_ioh = ua->ua_ioh2;
wdr->cmd_iot = ua->ua_iot;
wdr->cmd_baseioh = ua->ua_ioh;
wdr->ctl_iot = ua->ua_iot;
wdr->ctl_ioh = ua->ua_ioh2;
sc->sc_channel.ch_channel = 0;
sc->sc_channel.ch_wdc = &sc->sc_wdc;
sc->sc_channel.ch_queue = &sc->sc_chqueue;
for (i = 0; i < WDC_NREG; i++) {
if (bus_space_subregion(ua->ua_iot, ua->ua_ioh, i,
i == 0 ? 4 : 1, &sc->sc_channel.cmd_iohs[i]) != 0) {
i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) {
aprint_error("%s: can't subregion I/O space\n",
sc->sc_wdc.sc_dev.dv_xname);
return;