Add the notion of "shadow registers" to the wdc driver. These shadow
registers are registers that overlap with others on many controllers, but which may actually be distinct on some controllers. Right now, the two shadows are: - wd_status (usually overlaps wd_command) - wd_features (usually overlaps wd_error) Add a new helper function, wdc_init_shadow_regs(), used to initialize the shadow register handles on controllers where they do actually overlap. Partially from Jordan Rhody @ Wasabi Systems, Inc.
This commit is contained in:
parent
5031ff004a
commit
2ecdd552dc
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rside.c,v 1.2 2004/01/04 13:49:49 chris Exp $ */
|
||||
/* $NetBSD: rside.c,v 1.3 2004/05/25 20:42:40 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 Christopher Gilbert
|
||||
|
@ -56,7 +56,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rside.c,v 1.2 2004/01/04 13:49:49 chris Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rside.c,v 1.3 2004/05/25 20:42:40 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -213,6 +213,7 @@ rside_attach(struct device *parent, struct device *self, void *aux)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(cp);
|
||||
|
||||
if (bus_space_map(cp->ctl_iot,
|
||||
rside_info[channel].aux_register, 0x4, 0, &cp->ctl_ioh))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wdc_pioc.c,v 1.15 2004/01/03 22:56:52 thorpej Exp $ */
|
||||
/* $NetBSD: wdc_pioc.c,v 1.16 2004/05/25 20:42:40 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-1998 Mark Brinicombe.
|
||||
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_pioc.c,v 1.15 2004/01/03 22:56:52 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_pioc.c,v 1.16 2004/05/25 20:42:40 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -114,6 +114,7 @@ wdc_pioc_probe(parent, cf, aux)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(&ch);
|
||||
|
||||
if (bus_space_map(ch.ctl_iot, iobase + WDC_PIOC_AUXREG_OFFSET,
|
||||
WDC_PIOC_AUXREG_NPORTS, 0, &ch.ctl_ioh)) {
|
||||
|
@ -163,7 +164,8 @@ wdc_pioc_attach(parent, self, aux)
|
|||
panic("%s: couldn't submap drive registers",
|
||||
self->dv_xname);
|
||||
}
|
||||
|
||||
wdc_init_shadow_regs(&sc->wdc_channel);
|
||||
|
||||
if (bus_space_map(sc->wdc_channel.ctl_iot,
|
||||
iobase + WDC_PIOC_AUXREG_OFFSET, WDC_PIOC_AUXREG_NPORTS, 0,
|
||||
&sc->wdc_channel.ctl_ioh))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: icside.c,v 1.20 2004/01/03 22:56:52 thorpej Exp $ */
|
||||
/* $NetBSD: icside.c,v 1.21 2004/05/25 20:42:40 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-1998 Mark Brinicombe
|
||||
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include <sys/param.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: icside.c,v 1.20 2004/01/03 22:56:52 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: icside.c,v 1.21 2004/05/25 20:42:40 thorpej Exp $");
|
||||
|
||||
#include <sys/systm.h>
|
||||
#include <sys/conf.h>
|
||||
|
@ -279,6 +279,7 @@ icside_attach(struct device *parent, struct device *self, void *aux)
|
|||
i, i == 0 ? 4 : 1, &cp->cmd_iohs[i]) != 0)
|
||||
return;
|
||||
}
|
||||
wdc_init_shadow_regs(cp);
|
||||
if (bus_space_map(iot, iobase + ide->auxregs[channel],
|
||||
AUX_REGISTER_SPACE, 0, &cp->ctl_ioh))
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rapide.c,v 1.19 2004/01/03 22:56:52 thorpej Exp $ */
|
||||
/* $NetBSD: rapide.c,v 1.20 2004/05/25 20:42:40 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-1998 Mark Brinicombe
|
||||
|
@ -68,7 +68,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rapide.c,v 1.19 2004/01/03 22:56:52 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rapide.c,v 1.20 2004/05/25 20:42:40 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -273,6 +273,7 @@ rapide_attach(parent, self, aux)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(cp);
|
||||
if (bus_space_map(iot, iobase +
|
||||
rapide_info[channel].aux_register, 4, 0, &cp->ctl_ioh)) {
|
||||
bus_space_unmap(iot, cp->cmd_baseioh,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: simide.c,v 1.18 2004/01/03 22:56:52 thorpej Exp $ */
|
||||
/* $NetBSD: simide.c,v 1.19 2004/05/25 20:42:40 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997-1998 Mark Brinicombe
|
||||
|
@ -40,7 +40,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: simide.c,v 1.18 2004/01/03 22:56:52 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: simide.c,v 1.19 2004/05/25 20:42:40 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -270,6 +270,7 @@ simide_attach(parent, self, aux)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(cp);
|
||||
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_baseioh,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wdc_amiga.c,v 1.20 2004/01/06 18:46:07 he Exp $ */
|
||||
/* $NetBSD: wdc_amiga.c,v 1.21 2004/05/25 20:42:40 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_amiga.c,v 1.20 2004/01/06 18:46:07 he Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_amiga.c,v 1.21 2004/05/25 20:42:40 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -128,6 +128,7 @@ wdc_amiga_attach(struct device *parent, struct device *self, void *aux)
|
|||
return;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(&sc->wdc_channel);
|
||||
|
||||
if (sc->sc_a1200)
|
||||
sc->wdc_channel.ctl_ioh = sc->ctl_iot.base;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pciide_pnpbios.c,v 1.14 2004/01/03 22:56:53 thorpej Exp $ */
|
||||
/* $NetBSD: pciide_pnpbios.c,v 1.15 2004/05/25 20:42:40 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Soren S. Jorvang. All rights reserved.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pciide_pnpbios.c,v 1.14 2004/01/03 22:56:53 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pciide_pnpbios.c,v 1.15 2004/05/25 20:42:40 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -156,6 +156,7 @@ pciide_pnpbios_attach(parent, self, aux)
|
|||
return;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(wdc_cp);
|
||||
|
||||
wdc_cp->ctl_iot = wdc_cp->data32iot = compat_iot;
|
||||
wdc_cp->ctl_ioh = wdc_cp->data32ioh = ctl_ioh;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wdc_obio.c,v 1.14 2004/01/09 17:00:02 fredb Exp $ */
|
||||
/* $NetBSD: wdc_obio.c,v 1.15 2004/05/25 20:42:40 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Takeshi Shibagaki All rights reserved.
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.14 2004/01/09 17:00:02 fredb Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.15 2004/05/25 20:42:40 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -112,6 +112,7 @@ wdc_obio_match(parent, match, aux)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(&ch);
|
||||
|
||||
|
||||
if (bus_space_subregion(ch.cmd_iot, ch.cmd_baseioh,
|
||||
|
@ -183,6 +184,7 @@ wdc_obio_attach(parent, self, aux)
|
|||
return;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(&sc->wdc_channel);
|
||||
|
||||
if (bus_space_subregion(sc->wdc_channel.cmd_iot,
|
||||
sc->wdc_channel.cmd_baseioh,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kauai.c,v 1.12 2004/01/04 07:08:13 dbj Exp $ */
|
||||
/* $NetBSD: kauai.c,v 1.13 2004/05/25 20:42:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 Tsubai Masanari. All rights reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kauai.c,v 1.12 2004/01/04 07:08:13 dbj Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kauai.c,v 1.13 2004/05/25 20:42:41 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -164,6 +164,7 @@ kauai_attach(parent, self, aux)
|
|||
return;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(chp);
|
||||
|
||||
if (pci_intr_establish(pa->pa_pc, ih, IPL_BIO, wdcintr, chp) == NULL) {
|
||||
printf("%s: unable to establish interrupt\n", self->dv_xname);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wdc_obio.c,v 1.36 2004/01/04 07:08:13 dbj Exp $ */
|
||||
/* $NetBSD: wdc_obio.c,v 1.37 2004/05/25 20:42:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.36 2004/01/04 07:08:13 dbj Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.37 2004/05/25 20:42:41 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -172,6 +172,7 @@ wdc_obio_attach(parent, self, aux)
|
|||
return;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(chp);
|
||||
#if 0
|
||||
chp->data32iot = chp->cmd_iot;
|
||||
chp->data32ioh = chp->cmd_ioh;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wdc_spd.c,v 1.13 2004/01/06 18:46:07 he Exp $ */
|
||||
/* $NetBSD: wdc_spd.c,v 1.14 2004/05/25 20:42:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_spd.c,v 1.13 2004/01/06 18:46:07 he Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_spd.c,v 1.14 2004/05/25 20:42:41 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -227,6 +227,7 @@ __wdc_spd_bus_space(struct wdc_channel *ch)
|
|||
ch->cmd_iot = &_wdc_spd_space;
|
||||
for (i = 0; i < 8; i++)
|
||||
ch->cmd_iohs[i] = SPD_HDD_IO_BASE + i * 2; /* wdc register is 16 bit wide. */
|
||||
wdc_init_shadow_regs(ch);
|
||||
ch->ctl_iot = &_wdc_spd_space;
|
||||
ch->ctl_ioh = SPD_HDD_IO_BASE + WDC_SPD_HDD_AUXREG_OFFSET;
|
||||
ch->data32iot = ch->cmd_iot;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wdc_obio.c,v 1.15 2004/03/10 15:14:49 nonaka Exp $ */
|
||||
/* $NetBSD: wdc_obio.c,v 1.16 2004/05/25 20:42:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.15 2004/03/10 15:14:49 nonaka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_obio.c,v 1.16 2004/05/25 20:42:41 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -93,6 +93,7 @@ wdc_obio_probe(struct device *parent, struct cfdata *match, void *aux)
|
|||
i == 0 ? 4 : 1, &ch.cmd_iohs[i]) != 0)
|
||||
goto outunmap;
|
||||
}
|
||||
wdc_init_shadow_regs(&ch);
|
||||
|
||||
ch.ctl_iot = oa->oa_iot;
|
||||
if (bus_space_map(ch.ctl_iot, oa->oa_iobase + WDC_OBIO_AUXREG_OFFSET,
|
||||
|
@ -140,6 +141,7 @@ wdc_obio_attach(struct device *parent, struct device *self, void *aux)
|
|||
return;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(&sc->wdc_channel);
|
||||
|
||||
sc->wdc_channel.data32iot = sc->wdc_channel.cmd_iot;
|
||||
sc->wdc_channel.data32ioh = sc->wdc_channel.cmd_iohs[0];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wdc.c,v 1.175 2004/05/24 20:45:30 bouyer Exp $ */
|
||||
/* $NetBSD: wdc.c,v 1.176 2004/05/25 20:42:41 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 2001, 2003 Manuel Bouyer. All rights reserved.
|
||||
|
@ -70,7 +70,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.175 2004/05/24 20:45:30 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.176 2004/05/25 20:42:41 thorpej Exp $");
|
||||
|
||||
#ifndef WDCDEBUG
|
||||
#define WDCDEBUG
|
||||
|
@ -175,6 +175,17 @@ struct atabus_initq_head atabus_initq_head =
|
|||
TAILQ_HEAD_INITIALIZER(atabus_initq_head);
|
||||
struct simplelock atabus_interlock = SIMPLELOCK_INITIALIZER;
|
||||
|
||||
/*
|
||||
* Initialize the "shadow register" handles for a standard wdc controller.
|
||||
*/
|
||||
void
|
||||
wdc_init_shadow_regs(struct wdc_channel *chp)
|
||||
{
|
||||
|
||||
chp->cmd_iohs[wd_status] = chp->cmd_iohs[wd_command];
|
||||
chp->cmd_iohs[wd_features] = chp->cmd_iohs[wd_error];
|
||||
}
|
||||
|
||||
/* Test to see controller with at last one attached drive is there.
|
||||
* Returns a bit for each possible drive found (0x01 for drive 0,
|
||||
* 0x02 for drive 1).
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wdc_upc.c,v 1.15 2004/01/03 22:56:53 thorpej Exp $ */
|
||||
/* $NetBSD: wdc_upc.c,v 1.16 2004/05/25 20:42:41 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.15 2004/01/03 22:56:53 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_upc.c,v 1.16 2004/05/25 20:42:41 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -94,6 +94,7 @@ wdc_upc_attach(struct device *parent, struct device *self, void *aux)
|
|||
return;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(&sc->sc_channel);
|
||||
|
||||
upc_intr_establish(ua->ua_irqhandle, IPL_BIO, wdcintr,
|
||||
&sc->sc_channel);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wdcreg.h,v 1.32 2003/12/30 19:30:13 thorpej Exp $ */
|
||||
/* $NetBSD: wdcreg.h,v 1.33 2004/05/25 20:42:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
|
@ -45,7 +45,6 @@
|
|||
#define wd_data 0 /* data register (R/W - 16 bits) */
|
||||
#define wd_error 1 /* error register (R) */
|
||||
#define wd_precomp 1 /* write precompensation (W) */
|
||||
#define wd_features 1 /* features (W), same as wd_precomp */
|
||||
#define wd_seccnt 2 /* sector count (R/W) */
|
||||
#define wd_ireason 2 /* interrupt reason (R/W) (for atapi) */
|
||||
#define wd_sector 3 /* first sector number (R/W) */
|
||||
|
@ -53,11 +52,14 @@
|
|||
#define wd_cyl_hi 5 /* cylinder address, high byte (R/W) */
|
||||
#define wd_sdh 6 /* sector size/drive/head (R/W) */
|
||||
#define wd_command 7 /* command register (W) */
|
||||
#define wd_status 7 /* immediate status (R) */
|
||||
#define wd_lba_lo 3 /* lba address, low byte (RW) */
|
||||
#define wd_lba_mi 4 /* lba address, middle byte (RW) */
|
||||
#define wd_lba_hi 5 /* lba address, high byte (RW) */
|
||||
|
||||
/* "shadow" registers; these may or may not overlap regular registers */
|
||||
#define wd_status 8 /* immediate status (R) */
|
||||
#define wd_features 9 /* features (W) */
|
||||
|
||||
/* offsets of registers in the auxiliary register region */
|
||||
#define wd_aux_altsts 0 /* alternate fixed disk status (R) */
|
||||
#define wd_aux_ctlr 0 /* fixed disk controller control (W) */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wdcvar.h,v 1.56 2004/04/13 19:51:06 bouyer Exp $ */
|
||||
/* $NetBSD: wdcvar.h,v 1.57 2004/05/25 20:42:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -39,16 +39,19 @@
|
|||
#ifndef _DEV_IC_WDCVAR_H_
|
||||
#define _DEV_IC_WDCVAR_H_
|
||||
|
||||
#include <sys/callout.h>
|
||||
|
||||
/* XXX For scsipi_adapter and scsipi_channel. */
|
||||
#include <dev/scsipi/scsipi_all.h>
|
||||
#include <dev/scsipi/atapiconf.h>
|
||||
|
||||
#include <sys/callout.h>
|
||||
#include <dev/ic/wdcreg.h>
|
||||
|
||||
#define WAITTIME (10 * hz) /* time to wait for a completion */
|
||||
/* this is a lot for hard drives, but not for cdroms */
|
||||
|
||||
#define WDC_NREG 8 /* number of command registers */
|
||||
#define WDC_NSHADOWREG 2 /* number of command "shadow" registers */
|
||||
|
||||
/*
|
||||
* Per-channel data
|
||||
|
@ -61,7 +64,7 @@ struct wdc_channel {
|
|||
/* Our registers */
|
||||
bus_space_tag_t cmd_iot;
|
||||
bus_space_handle_t cmd_baseioh;
|
||||
bus_space_handle_t cmd_iohs[WDC_NREG];
|
||||
bus_space_handle_t cmd_iohs[WDC_NREG+WDC_NSHADOWREG];
|
||||
bus_space_tag_t ctl_iot;
|
||||
bus_space_handle_t ctl_ioh;
|
||||
|
||||
|
@ -172,6 +175,8 @@ struct wdc_softc {
|
|||
* or bus-specific backends.
|
||||
*/
|
||||
|
||||
void wdc_init_shadow_regs(struct wdc_channel *);
|
||||
|
||||
int wdcprobe(struct wdc_channel *);
|
||||
void wdcattach(struct wdc_channel *);
|
||||
int wdcdetach(struct device *, int);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wdc_isa.c,v 1.40 2004/01/03 22:56:53 thorpej Exp $ */
|
||||
/* $NetBSD: wdc_isa.c,v 1.41 2004/05/25 20:42:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_isa.c,v 1.40 2004/01/03 22:56:53 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_isa.c,v 1.41 2004/05/25 20:42:41 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -124,6 +124,7 @@ wdc_isa_probe(parent, match, aux)
|
|||
i == 0 ? 4 : 1, &ch.cmd_iohs[i]) != 0)
|
||||
goto outunmap;
|
||||
}
|
||||
wdc_init_shadow_regs(&ch);
|
||||
|
||||
ch.ctl_iot = ia->ia_iot;
|
||||
if (bus_space_map(ch.ctl_iot, ia->ia_io[0].ir_addr +
|
||||
|
@ -177,6 +178,7 @@ wdc_isa_attach(parent, self, aux)
|
|||
return;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(&sc->wdc_channel);
|
||||
|
||||
sc->wdc_channel.data32iot = sc->wdc_channel.cmd_iot;
|
||||
sc->wdc_channel.data32ioh = sc->wdc_channel.cmd_iohs[0];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wdc_isapnp.c,v 1.26 2004/01/03 22:56:53 thorpej Exp $ */
|
||||
/* $NetBSD: wdc_isapnp.c,v 1.27 2004/05/25 20:42:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_isapnp.c,v 1.26 2004/01/03 22:56:53 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_isapnp.c,v 1.27 2004/05/25 20:42:41 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -142,6 +142,7 @@ wdc_isapnp_attach(parent, self, aux)
|
|||
return;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(&sc->wdc_channel);
|
||||
sc->wdc_channel.data32iot = sc->wdc_channel.cmd_iot;
|
||||
sc->wdc_channel.data32ioh = sc->wdc_channel.cmd_iohs[0];
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wdc_ofisa.c,v 1.19 2004/01/03 22:56:53 thorpej Exp $ */
|
||||
/* $NetBSD: wdc_ofisa.c,v 1.20 2004/05/25 20:42:41 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997, 1998
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_ofisa.c,v 1.19 2004/01/03 22:56:53 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_ofisa.c,v 1.20 2004/05/25 20:42:41 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -151,7 +151,7 @@ wdc_ofisa_attach(parent, self, aux)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
wdc_init_shadow_regs(&sc->wdc_channel);
|
||||
|
||||
sc->sc_ih = isa_intr_establish(aa->ic, intr.irq, intr.share,
|
||||
IPL_BIO, wdcintr, &sc->wdc_channel);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pciide_common.c,v 1.10 2004/05/05 17:56:14 bouyer Exp $ */
|
||||
/* $NetBSD: pciide_common.c,v 1.11 2004/05/25 20:42:41 thorpej Exp $ */
|
||||
|
||||
|
||||
/*
|
||||
|
@ -76,7 +76,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.10 2004/05/05 17:56:14 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.11 2004/05/25 20:42:41 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/malloc.h>
|
||||
|
@ -236,6 +236,7 @@ pciide_mapregs_compat(pa, cp, compatchan, cmdsizep, ctlsizep)
|
|||
goto bad;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(wdc_cp);
|
||||
wdc_cp->data32iot = wdc_cp->cmd_iot;
|
||||
wdc_cp->data32ioh = wdc_cp->cmd_iohs[0];
|
||||
pciide_map_compat_intr(pa, cp, compatchan);
|
||||
|
@ -326,6 +327,7 @@ pciide_mapregs_native(pa, cp, cmdsizep, ctlsizep, pci_intr)
|
|||
goto bad;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(wdc_cp);
|
||||
wdc_cp->data32iot = wdc_cp->cmd_iot;
|
||||
wdc_cp->data32ioh = wdc_cp->cmd_iohs[0];
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: satalink.c,v 1.13 2004/05/07 13:01:49 sekiya Exp $ */
|
||||
/* $NetBSD: satalink.c,v 1.14 2004/05/25 20:42:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -596,6 +596,7 @@ sii3114_mapchan(struct pciide_channel *cp)
|
|||
goto bad;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(wdc_cp);
|
||||
wdc_cp->data32iot = wdc_cp->cmd_iot;
|
||||
wdc_cp->data32ioh = wdc_cp->cmd_iohs[0];
|
||||
wdcattach(wdc_cp);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wdc_pcmcia.c,v 1.67 2004/01/03 22:56:53 thorpej Exp $ */
|
||||
/* $NetBSD: wdc_pcmcia.c,v 1.68 2004/05/25 20:42:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.67 2004/01/03 22:56:53 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.68 2004/05/25 20:42:41 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -361,6 +361,7 @@ wdc_pcmcia_attach(parent, self, aux)
|
|||
goto mapaux_failed;
|
||||
}
|
||||
}
|
||||
wdc_init_shadow_regs(&sc->wdc_channel);
|
||||
sc->wdc_channel.data32iot = sc->wdc_channel.cmd_iot;
|
||||
sc->wdc_channel.data32ioh = sc->wdc_channel.cmd_iohs[0];
|
||||
sc->sc_wdcdev.PIO_cap = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dtide.c,v 1.15 2004/01/03 22:56:53 thorpej Exp $ */
|
||||
/* $NetBSD: dtide.c,v 1.16 2004/05/25 20:42:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001 Ben Harris
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dtide.c,v 1.15 2004/01/03 22:56:53 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dtide.c,v 1.16 2004/05/25 20:42:41 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
|
@ -108,6 +108,7 @@ dtide_attach(struct device *parent, struct device *self, void *aux)
|
|||
for (j = 0; j < WDC_NREG; j++)
|
||||
bus_space_subregion(ch->cmd_iot, ch->cmd_baseioh,
|
||||
j, j == 0 ? 4 : 1, &ch->cmd_iohs[j]);
|
||||
wdc_init_shadow_regs(ch);
|
||||
bus_space_map(pa->pa_fast_t,
|
||||
pa->pa_fast_base + dtide_ctloffsets[i], 0, 8,
|
||||
&ch->ctl_ioh);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hcide.c,v 1.12 2004/01/03 22:56:53 thorpej Exp $ */
|
||||
/* $NetBSD: hcide.c,v 1.13 2004/05/25 20:42:41 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001 Ben Harris
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: hcide.c,v 1.12 2004/01/03 22:56:53 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: hcide.c,v 1.13 2004/05/25 20:42:41 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
|
@ -103,6 +103,7 @@ hcide_attach(struct device *parent, struct device *self, void *aux)
|
|||
for (j = 0; j < WDC_NREG; j++)
|
||||
bus_space_subregion(ch->cmd_iot, ch->cmd_baseioh,
|
||||
j, j == 0 ? 4 : 1, &ch->cmd_iohs[j]);
|
||||
wdc_init_shadow_regs(ch);
|
||||
bus_space_map(pa->pa_fast_t,
|
||||
pa->pa_fast_base + hcide_ctloffsets[i], 0, 8,
|
||||
&ch->ctl_ioh);
|
||||
|
|
Loading…
Reference in New Issue