Pave the way for detachment of pciide(4)-family ATA controllers.

This commit is contained in:
jakllsch 2010-11-05 18:07:23 +00:00
parent 2ddc760fc7
commit 5947ac4e8e
26 changed files with 213 additions and 192 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: gcscide.c,v 1.7 2008/03/18 20:46:36 cube Exp $ */
/* $NetBSD: gcscide.c,v 1.8 2010/11/05 18:07:23 jakllsch Exp $ */
/*-
* Copyright (c) 2007 Juan Romero Pardines.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: gcscide.c,v 1.7 2008/03/18 20:46:36 cube Exp $");
__KERNEL_RCSID(0, "$NetBSD: gcscide.c,v 1.8 2010/11/05 18:07:23 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -153,7 +153,6 @@ static void
gcscide_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
{
pcireg_t interface;
bus_size_t cmdsize, ctlsize;
if (pciide_chipen(sc, pa) == 0)
return;
@ -184,7 +183,7 @@ gcscide_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
return;
pciide_mapchan(pa, &sc->pciide_channels[0], interface,
&cmdsize, &ctlsize, pciide_pci_intr);
pciide_pci_intr);
}
static void

View File

@ -1,4 +1,4 @@
/* $NetBSD: wdcvar.h,v 1.90 2009/12/01 01:06:31 dyoung Exp $ */
/* $NetBSD: wdcvar.h,v 1.91 2010/11/05 18:07:24 jakllsch Exp $ */
/*-
* Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@ -47,9 +47,11 @@ struct wdc_regs {
/* Our registers */
bus_space_tag_t cmd_iot;
bus_space_handle_t cmd_baseioh;
bus_size_t cmd_ios;
bus_space_handle_t cmd_iohs[WDC_NREG+WDC_NSHADOWREG];
bus_space_tag_t ctl_iot;
bus_space_handle_t ctl_ioh;
bus_size_t ctl_ios;
/* data32{iot,ioh} are only used for 32-bit data xfers */
bus_space_tag_t data32iot;

View File

@ -1,4 +1,4 @@
/* $NetBSD: acardide.c,v 1.23 2008/05/14 13:29:29 tsutsui Exp $ */
/* $NetBSD: acardide.c,v 1.24 2010/11/05 18:07:24 jakllsch Exp $ */
/*-
* Copyright (c) 2001 Izumi Tsutsui. All rights reserved.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acardide.c,v 1.23 2008/05/14 13:29:29 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: acardide.c,v 1.24 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -115,7 +115,6 @@ acard_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
struct pciide_channel *cp;
int i;
pcireg_t interface;
bus_size_t cmdsize, ctlsize;
if (pciide_chipen(sc, pa) == 0)
return;
@ -167,8 +166,7 @@ acard_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
cp = &sc->pciide_channels[i];
if (pciide_chansetup(sc, i, interface) == 0)
continue;
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
if (!ACARD_IS_850(sc)) {
u_int32_t reg;

View File

@ -1,4 +1,4 @@
/* $NetBSD: aceride.c,v 1.28 2010/11/03 11:46:30 nakayama Exp $ */
/* $NetBSD: aceride.c,v 1.29 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: aceride.c,v 1.28 2010/11/03 11:46:30 nakayama Exp $");
__KERNEL_RCSID(0, "$NetBSD: aceride.c,v 1.29 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -114,7 +114,6 @@ acer_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
struct pciide_channel *cp;
int channel;
pcireg_t cr, interface;
bus_size_t cmdsize, ctlsize;
pcireg_t rev = PCI_REVISION(pa->pa_class);
struct aceride_softc *acer_sc = (struct aceride_softc *)sc;
@ -223,7 +222,7 @@ acer_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
continue;
}
/* newer controllers seems to lack the ACER_CHIDS. Sigh */
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_mapchan(pa, cp, interface,
(rev >= 0xC2) ? pciide_pci_intr : acer_pci_intr);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: artsata.c,v 1.19 2009/11/26 15:17:08 njoly Exp $ */
/* $NetBSD: artsata.c,v 1.20 2010/11/05 18:07:24 jakllsch Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: artsata.c,v 1.19 2009/11/26 15:17:08 njoly Exp $");
__KERNEL_RCSID(0, "$NetBSD: artsata.c,v 1.20 2010/11/05 18:07:24 jakllsch Exp $");
#include "opt_pciide.h"
@ -119,7 +119,6 @@ artsata_attach(device_t parent, device_t self, void *aux)
static void
artisea_mapregs(struct pci_attach_args *pa, struct pciide_channel *cp,
bus_size_t *cmdsizep, bus_size_t *ctlsizep,
int (*pci_intr)(void *))
{
struct pciide_softc *sc = CHAN_TO_PCIIDE(&cp->ata_channel);
@ -320,7 +319,6 @@ static void
artisea_chip_map_dpa(struct pciide_softc *sc, struct pci_attach_args *pa)
{
struct pciide_channel *cp;
bus_size_t cmdsize, ctlsize;
pcireg_t interface;
int channel;
@ -330,7 +328,7 @@ artisea_chip_map_dpa(struct pciide_softc *sc, struct pci_attach_args *pa)
"interface wired in DPA mode\n");
if (pci_mapreg_map(pa, ARTISEA_PCI_DPA_BASE, PCI_MAPREG_MEM_TYPE_64BIT,
0, &sc->sc_ba5_st, &sc->sc_ba5_sh, NULL, NULL) != 0)
0, &sc->sc_ba5_st, &sc->sc_ba5_sh, NULL, &sc->sc_ba5_ss) != 0)
return;
artisea_mapreg_dma(sc, pa);
@ -380,7 +378,7 @@ artisea_chip_map_dpa(struct pciide_softc *sc, struct pci_attach_args *pa)
if (artisea_chansetup(sc, channel, interface) == 0)
continue;
/* XXX We can probably do interrupts more efficiently. */
artisea_mapregs(pa, cp, &cmdsize, &ctlsize, pciide_pci_intr);
artisea_mapregs(pa, cp, pciide_pci_intr);
}
}
@ -388,7 +386,6 @@ static void
artisea_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
{
struct pciide_channel *cp;
bus_size_t cmdsize, ctlsize;
pcireg_t interface;
int channel;
@ -438,7 +435,6 @@ artisea_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
cp = &sc->pciide_channels[channel];
if (pciide_chansetup(sc, channel, interface) == 0)
continue;
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmdide.c,v 1.29 2009/10/19 18:41:14 bouyer Exp $ */
/* $NetBSD: cmdide.c,v 1.30 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cmdide.c,v 1.29 2009/10/19 18:41:14 bouyer Exp $");
__KERNEL_RCSID(0, "$NetBSD: cmdide.c,v 1.30 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -124,7 +124,6 @@ cmd_channel_map(struct pci_attach_args *pa, struct pciide_softc *sc,
int channel)
{
struct pciide_channel *cp = &sc->pciide_channels[channel];
bus_size_t cmdsize, ctlsize;
u_int8_t ctrl = pciide_pci_read(sc->sc_pc, sc->sc_tag, CMD_CTRL);
int interface, one_channel;
@ -194,7 +193,7 @@ cmd_channel_map(struct pci_attach_args *pa, struct pciide_softc *sc,
return;
}
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize, cmd_pci_intr);
pciide_mapchan(pa, cp, interface, cmd_pci_intr);
}
static int
@ -499,7 +498,6 @@ cmd680_channel_map(struct pci_attach_args *pa, struct pciide_softc *sc,
int channel)
{
struct pciide_channel *cp = &sc->pciide_channels[channel];
bus_size_t cmdsize, ctlsize;
int interface, i, reg;
static const u_int8_t init_val[] =
{ 0x8a, 0x32, 0x8a, 0x32, 0x8a, 0x32,
@ -541,7 +539,7 @@ cmd680_channel_map(struct pci_attach_args *pa, struct pciide_softc *sc,
(interface & PCIIDE_INTERFACE_PCI(channel)) ?
"native-PCI" : "compatibility");
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize, pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
static void

View File

@ -1,4 +1,4 @@
/* $NetBSD: cypide.c,v 1.22 2009/10/19 18:41:14 bouyer Exp $ */
/* $NetBSD: cypide.c,v 1.23 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cypide.c,v 1.22 2009/10/19 18:41:14 bouyer Exp $");
__KERNEL_RCSID(0, "$NetBSD: cypide.c,v 1.23 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -93,7 +93,6 @@ cy693_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
{
struct pciide_channel *cp;
pcireg_t interface = PCI_INTERFACE(pa->pa_class);
bus_size_t cmdsize, ctlsize;
if (pciide_chipen(sc, pa) == 0)
return;
@ -164,12 +163,10 @@ cy693_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
"configured" : "wired");
if (interface & PCIIDE_INTERFACE_PCI(0)) {
aprint_normal("native-PCI mode\n");
pciide_mapregs_native(pa, cp, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapregs_native(pa, cp, pciide_pci_intr);
} else {
aprint_normal("compatibility mode\n");
pciide_mapregs_compat(pa, cp, sc->sc_cy_compatchan, &cmdsize,
&ctlsize);
pciide_mapregs_compat(pa, cp, sc->sc_cy_compatchan);
if ((cp->ata_channel.ch_flags & ATACH_DISABLED) == 0)
pciide_map_compat_intr(pa, cp, sc->sc_cy_compatchan);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: geodeide.c,v 1.16 2009/10/19 18:41:15 bouyer Exp $ */
/* $NetBSD: geodeide.c,v 1.17 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 2004 Manuel Bouyer.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: geodeide.c,v 1.16 2009/10/19 18:41:15 bouyer Exp $");
__KERNEL_RCSID(0, "$NetBSD: geodeide.c,v 1.17 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -106,7 +106,6 @@ geodeide_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
{
struct pciide_channel *cp;
int channel;
bus_size_t cmdsize, ctlsize;
if (pciide_chipen(sc, pa) == 0)
return;
@ -163,7 +162,7 @@ geodeide_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
/* controller is compat-only */
if (pciide_chansetup(sc, channel, 0) == 0)
continue;
pciide_mapchan(pa, cp, 0, &cmdsize, &ctlsize, pciide_pci_intr);
pciide_mapchan(pa, cp, 0, pciide_pci_intr);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: hptide.c,v 1.26 2009/10/19 18:41:15 bouyer Exp $ */
/* $NetBSD: hptide.c,v 1.27 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hptide.c,v 1.26 2009/10/19 18:41:15 bouyer Exp $");
__KERNEL_RCSID(0, "$NetBSD: hptide.c,v 1.27 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -110,7 +110,6 @@ hpt_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
struct pciide_channel *cp;
int i, compatchan, revision;
pcireg_t interface;
bus_size_t cmdsize, ctlsize;
if (pciide_chipen(sc, pa) == 0)
return;
@ -238,11 +237,9 @@ hpt_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
if (pciide_chansetup(sc, i, interface) == 0)
continue;
if (interface & PCIIDE_INTERFACE_PCI(i)) {
pciide_mapregs_native(pa, cp, &cmdsize,
&ctlsize, hpt_pci_intr);
pciide_mapregs_native(pa, cp, hpt_pci_intr);
} else {
pciide_mapregs_compat(pa, cp, compatchan,
&cmdsize, &ctlsize);
pciide_mapregs_compat(pa, cp, compatchan);
if ((cp->ata_channel.ch_flags & ATACH_DISABLED) == 0)
pciide_map_compat_intr(pa, cp,
sc->sc_cy_compatchan);

View File

@ -1,4 +1,4 @@
/* $NetBSD: iteide.c,v 1.10 2008/04/10 19:13:37 cegger Exp $ */
/* $NetBSD: iteide.c,v 1.11 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: iteide.c,v 1.10 2008/04/10 19:13:37 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: iteide.c,v 1.11 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -99,7 +99,6 @@ ite_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
struct pciide_channel *cp;
int channel;
pcireg_t interface;
bus_size_t cmdsize, ctlsize;
pcireg_t cfg, modectl;
/* fake interface since IT8212 claims to be a RAID device */
@ -149,8 +148,7 @@ ite_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
if (pciide_chansetup(sc, channel, interface) == 0)
continue;
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
/* Re-read configuration registers after channels setup */
cfg = pci_conf_read(sc->sc_pc, sc->sc_tag, IT_CFG);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ixpide.c,v 1.16 2010/02/24 22:38:01 dyoung Exp $ */
/* $NetBSD: ixpide.c,v 1.17 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 2004 The NetBSD Foundation.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ixpide.c,v 1.16 2010/02/24 22:38:01 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: ixpide.c,v 1.17 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -99,7 +99,6 @@ ixp_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
struct pciide_channel *cp;
int channel;
pcireg_t interface;
bus_size_t cmdsize, ctlsize;
if (pciide_chipen(sc, pa) == 0)
return;
@ -131,8 +130,7 @@ ixp_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
cp = &sc->pciide_channels[channel];
if (pciide_chansetup(sc, channel, interface) == 0)
continue;
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: jmide.c,v 1.8 2010/07/27 22:07:51 jakllsch Exp $ */
/* $NetBSD: jmide.c,v 1.9 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 2007 Manuel Bouyer.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: jmide.c,v 1.8 2010/07/27 22:07:51 jakllsch Exp $");
__KERNEL_RCSID(0, "$NetBSD: jmide.c,v 1.9 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -308,7 +308,6 @@ jmpata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
struct jmide_softc *jmidesc = (struct jmide_softc *)sc;
int channel;
pcireg_t interface;
bus_size_t cmdsize, ctlsize;
struct pciide_channel *cp;
if (pciide_chipen(sc, pa) == 0)
@ -358,8 +357,7 @@ jmpata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
cp->ata_channel.ch_flags |= ATACH_DISABLED;
continue;
}
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: optiide.c,v 1.17 2008/04/28 20:23:55 martin Exp $ */
/* $NetBSD: optiide.c,v 1.18 2010/11/05 18:07:24 jakllsch Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: optiide.c,v 1.17 2008/04/28 20:23:55 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: optiide.c,v 1.18 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -104,7 +104,6 @@ static void
opti_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
{
struct pciide_channel *cp;
bus_size_t cmdsize, ctlsize;
pcireg_t interface;
u_int8_t init_ctrl;
int channel;
@ -162,8 +161,7 @@ opti_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
cp->ata_channel.ch_flags |= ATACH_DISABLED;
continue;
}
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pciide_common.c,v 1.43 2009/10/19 18:41:15 bouyer Exp $ */
/* $NetBSD: pciide_common.c,v 1.44 2010/11/05 18:07:24 jakllsch Exp $ */
/*
@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.43 2009/10/19 18:41:15 bouyer Exp $");
__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.44 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@ -171,6 +171,57 @@ pciide_common_attach(struct pciide_softc *sc, struct pci_attach_args *pa, const
pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG)), DEBUG_PROBE);
}
int
pciide_common_detach(struct pciide_softc *sc, int flags)
{
struct pciide_channel *cp;
struct ata_channel *wdc_cp;
struct wdc_regs *wdr;
int channel, drive;
int rv;
rv = wdcdetach(sc->sc_wdcdev.sc_atac.atac_dev, flags);
if (rv)
return rv;
for (channel = 0; channel < sc->sc_wdcdev.sc_atac.atac_nchannels;
channel++) {
cp = &sc->pciide_channels[channel];
wdc_cp = &cp->ata_channel;
wdr = CHAN_TO_WDC_REGS(wdc_cp);
if (wdc_cp->ch_flags & ATACH_DISABLED)
continue;
if (wdr->cmd_ios != 0)
bus_space_unmap(wdr->cmd_iot,
wdr->cmd_baseioh, wdr->cmd_ios);
if (cp->compat != 0) {
if (wdr->ctl_ios != 0)
bus_space_unmap(wdr->ctl_iot,
wdr->ctl_ioh, wdr->ctl_ios);
} else {
if (cp->ctl_ios != 0)
bus_space_unmap(wdr->ctl_iot,
cp->ctl_baseioh, cp->ctl_ios);
}
for (drive = 0; drive < cp->ata_channel.ch_ndrive; drive++) {
pciide_dma_table_teardown(sc, channel, drive);
}
free(cp->ata_channel.ch_queue, M_DEVBUF);
cp->ata_channel.atabus = NULL;
}
if (sc->sc_dma_ios != 0)
bus_space_unmap(sc->sc_dma_iot, sc->sc_dma_ioh, sc->sc_dma_ios);
if (sc->sc_ba5_ss != 0)
bus_space_unmap(sc->sc_dma_iot, sc->sc_dma_ioh, sc->sc_dma_ios);
return 0;
}
/* tell whether the chip is enabled or not */
int
pciide_chipen(struct pciide_softc *sc, struct pci_attach_args *pa)
@ -190,7 +241,7 @@ pciide_chipen(struct pciide_softc *sc, struct pci_attach_args *pa)
}
void
pciide_mapregs_compat(struct pci_attach_args *pa, struct pciide_channel *cp, int compatchan, bus_size_t *cmdsizep, bus_size_t *ctlsizep)
pciide_mapregs_compat(struct pci_attach_args *pa, struct pciide_channel *cp, int compatchan)
{
struct pciide_softc *sc = CHAN_TO_PCIIDE(&cp->ata_channel);
struct ata_channel *wdc_cp = &cp->ata_channel;
@ -198,8 +249,6 @@ pciide_mapregs_compat(struct pci_attach_args *pa, struct pciide_channel *cp, int
int i;
cp->compat = 1;
*cmdsizep = PCIIDE_COMPAT_CMD_SIZE;
*ctlsizep = PCIIDE_COMPAT_CTL_SIZE;
wdr->cmd_iot = pa->pa_iot;
if (bus_space_map(wdr->cmd_iot, PCIIDE_COMPAT_CMD_BASE(compatchan),
@ -208,16 +257,17 @@ pciide_mapregs_compat(struct pci_attach_args *pa, struct pciide_channel *cp, int
"couldn't map %s channel cmd regs\n", cp->name);
goto bad;
}
wdr->cmd_ios = PCIIDE_COMPAT_CMD_SIZE;
wdr->ctl_iot = pa->pa_iot;
if (bus_space_map(wdr->ctl_iot, PCIIDE_COMPAT_CTL_BASE(compatchan),
PCIIDE_COMPAT_CTL_SIZE, 0, &wdr->ctl_ioh) != 0) {
aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev,
"couldn't map %s channel ctl regs\n", cp->name);
bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh,
PCIIDE_COMPAT_CMD_SIZE);
bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh, wdr->cmd_ios);
goto bad;
}
wdr->ctl_ios = PCIIDE_COMPAT_CTL_SIZE;
for (i = 0; i < WDC_NREG; i++) {
if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i,
@ -240,8 +290,7 @@ bad:
void
pciide_mapregs_native(struct pci_attach_args *pa,
struct pciide_channel *cp, bus_size_t *cmdsizep,
bus_size_t *ctlsizep, int (*pci_intr)(void *))
struct pciide_channel *cp, int (*pci_intr)(void *))
{
struct pciide_softc *sc = CHAN_TO_PCIIDE(&cp->ata_channel);
struct ata_channel *wdc_cp = &cp->ata_channel;
@ -277,7 +326,7 @@ pciide_mapregs_native(struct pci_attach_args *pa,
cp->ih = sc->sc_pci_ih;
if (pci_mapreg_map(pa, PCIIDE_REG_CMD_BASE(wdc_cp->ch_channel),
PCI_MAPREG_TYPE_IO, 0,
&wdr->cmd_iot, &wdr->cmd_baseioh, NULL, cmdsizep) != 0) {
&wdr->cmd_iot, &wdr->cmd_baseioh, NULL, &wdr->cmd_ios) != 0) {
aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev,
"couldn't map %s channel cmd regs\n", cp->name);
goto bad;
@ -285,11 +334,10 @@ pciide_mapregs_native(struct pci_attach_args *pa,
if (pci_mapreg_map(pa, PCIIDE_REG_CTL_BASE(wdc_cp->ch_channel),
PCI_MAPREG_TYPE_IO, 0,
&wdr->ctl_iot, &cp->ctl_baseioh, NULL, ctlsizep) != 0) {
&wdr->ctl_iot, &cp->ctl_baseioh, NULL, &cp->ctl_ios) != 0) {
aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev,
"couldn't map %s channel ctl regs\n", cp->name);
bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh,
*cmdsizep);
bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh, wdr->cmd_ios);
goto bad;
}
/*
@ -301,9 +349,8 @@ pciide_mapregs_native(struct pci_attach_args *pa,
&wdr->ctl_ioh) != 0) {
aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev,
"unable to subregion %s channel ctl regs\n", cp->name);
bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh,
*cmdsizep);
bus_space_unmap(wdr->cmd_iot, cp->ctl_baseioh, *ctlsizep);
bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh, wdr->cmd_ios);
bus_space_unmap(wdr->cmd_iot, cp->ctl_baseioh, cp->ctl_ios);
goto bad;
}
@ -377,7 +424,8 @@ pciide_mapreg_dma(struct pciide_softc *sc, struct pci_attach_args *pa)
case PCI_MAPREG_MEM_TYPE_32BIT:
sc->sc_dma_ok = (pci_mapreg_map(pa,
PCIIDE_REG_BUS_MASTER_DMA, maptype, 0,
&sc->sc_dma_iot, &sc->sc_dma_ioh, NULL, NULL) == 0);
&sc->sc_dma_iot, &sc->sc_dma_ioh, NULL, &sc->sc_dma_ios)
== 0);
sc->sc_dmat = pa->pa_dmat;
if (sc->sc_dma_ok == 0) {
aprint_verbose(", but unused (couldn't map registers)");
@ -514,8 +562,7 @@ pciide_channel_dma_setup(struct pciide_channel *cp)
int
pciide_dma_table_setup(struct pciide_softc *sc, int channel, int drive)
{
bus_dma_segment_t seg;
int error, rseg;
int error;
const bus_size_t dma_table_size =
sizeof(struct idedma_table) * NIDEDMA_TABLES(sc);
struct pciide_dma_maps *dma_maps =
@ -527,15 +574,15 @@ pciide_dma_table_setup(struct pciide_softc *sc, int channel, int drive)
/* Allocate memory for the DMA tables and map it */
if ((error = bus_dmamem_alloc(sc->sc_dmat, dma_table_size,
IDEDMA_TBL_ALIGN, IDEDMA_TBL_ALIGN, &seg, 1, &rseg,
BUS_DMA_NOWAIT)) != 0) {
IDEDMA_TBL_ALIGN, IDEDMA_TBL_ALIGN, &dma_maps->dmamap_table_seg,
1, &dma_maps->dmamap_table_nseg, BUS_DMA_NOWAIT)) != 0) {
aprint_error(dmaerrfmt,
device_xname(sc->sc_wdcdev.sc_atac.atac_dev), channel,
"allocate", drive, error);
return error;
}
if ((error = bus_dmamem_map(sc->sc_dmat, &seg, rseg,
dma_table_size,
if ((error = bus_dmamem_map(sc->sc_dmat, &dma_maps->dmamap_table_seg,
dma_maps->dmamap_table_nseg, dma_table_size,
(void **)&dma_maps->dma_table,
BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) {
aprint_error(dmaerrfmt,
@ -545,7 +592,7 @@ pciide_dma_table_setup(struct pciide_softc *sc, int channel, int drive)
}
ATADEBUG_PRINT(("pciide_dma_table_setup: table at %p len %lu, "
"phy 0x%lx\n", dma_maps->dma_table, (u_long)dma_table_size,
(unsigned long)seg.ds_addr), DEBUG_PROBE);
(unsigned long)dma_maps->dmamap_table_seg.ds_addr), DEBUG_PROBE);
/* Create and load table DMA map for this disk */
if ((error = bus_dmamap_create(sc->sc_dmat, dma_table_size,
1, dma_table_size, IDEDMA_TBL_ALIGN, BUS_DMA_NOWAIT,
@ -580,6 +627,31 @@ pciide_dma_table_setup(struct pciide_softc *sc, int channel, int drive)
return 0;
}
void
pciide_dma_table_teardown(struct pciide_softc *sc, int channel, int drive)
{
struct pciide_channel *cp;
struct pciide_dma_maps *dma_maps;
cp = &sc->pciide_channels[channel];
dma_maps = &cp->dma_maps[drive];
if (dma_maps->dma_table == NULL)
return;
bus_dmamap_destroy(sc->sc_dmat, dma_maps->dmamap_xfer);
bus_dmamap_unload(sc->sc_dmat, dma_maps->dmamap_table);
bus_dmamap_destroy(sc->sc_dmat, dma_maps->dmamap_table);
bus_dmamem_unmap(sc->sc_dmat, dma_maps->dma_table,
sizeof(struct idedma_table) * NIDEDMA_TABLES(sc));
bus_dmamem_free(sc->sc_dmat, &dma_maps->dmamap_table_seg,
dma_maps->dmamap_table_nseg);
dma_maps->dma_table = NULL;
return;
}
int
pciide_dma_dmamap_setup(struct pciide_softc *sc, int channel, int drive, void *databuf, size_t datalen, int flags)
{
@ -778,16 +850,14 @@ pciide_chansetup(struct pciide_softc *sc, int channel, pcireg_t interface)
void
pciide_mapchan(struct pci_attach_args *pa,
struct pciide_channel *cp,
pcireg_t interface, bus_size_t *cmdsizep,
bus_size_t *ctlsizep, int (*pci_intr)(void *))
pcireg_t interface, int (*pci_intr)(void *))
{
struct ata_channel *wdc_cp = &cp->ata_channel;
if (interface & PCIIDE_INTERFACE_PCI(wdc_cp->ch_channel))
pciide_mapregs_native(pa, cp, cmdsizep, ctlsizep, pci_intr);
pciide_mapregs_native(pa, cp, pci_intr);
else {
pciide_mapregs_compat(pa, cp, wdc_cp->ch_channel, cmdsizep,
ctlsizep);
pciide_mapregs_compat(pa, cp, wdc_cp->ch_channel);
if ((cp->ata_channel.ch_flags & ATACH_DISABLED) == 0)
pciide_map_compat_intr(pa, cp, wdc_cp->ch_channel);
}
@ -828,7 +898,6 @@ default_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
int drive;
u_int8_t idedma_ctl;
#endif
bus_size_t cmdsize, ctlsize;
const char *failreason;
struct wdc_regs *wdr;
@ -887,11 +956,10 @@ default_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
continue;
wdr = CHAN_TO_WDC_REGS(&cp->ata_channel);
if (interface & PCIIDE_INTERFACE_PCI(channel))
pciide_mapregs_native(pa, cp, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapregs_native(pa, cp, pciide_pci_intr);
else
pciide_mapregs_compat(pa, cp,
cp->ata_channel.ch_channel, &cmdsize, &ctlsize);
cp->ata_channel.ch_channel);
if (cp->ata_channel.ch_flags & ATACH_DISABLED)
continue;
/*
@ -932,8 +1000,9 @@ next:
"%s channel ignored (%s)\n", cp->name, failreason);
cp->ata_channel.ch_flags |= ATACH_DISABLED;
bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh,
cmdsize);
bus_space_unmap(wdr->ctl_iot, wdr->ctl_ioh, ctlsize);
wdr->cmd_ios);
bus_space_unmap(wdr->ctl_iot, wdr->ctl_ioh,
wdr->ctl_ios);
} else {
pciide_map_compat_intr(pa, cp,
cp->ata_channel.ch_channel);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pciidevar.h,v 1.40 2009/11/14 09:42:50 cegger Exp $ */
/* $NetBSD: pciidevar.h,v 1.41 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 1998 Christopher G. Demetriou. All rights reserved.
@ -89,6 +89,7 @@ struct pciide_softc {
*/
bus_space_tag_t sc_dma_iot;
bus_space_handle_t sc_dma_ioh;
bus_size_t sc_dma_ios;
bus_dma_tag_t sc_dmat;
/*
@ -114,6 +115,7 @@ struct pciide_softc {
*/
bus_space_tag_t sc_ba5_st;
bus_space_handle_t sc_ba5_sh;
bus_size_t sc_ba5_ss;
int sc_ba5_en;
#endif /* NATA_DMA */
@ -130,14 +132,17 @@ struct pciide_softc {
int compat; /* is it compat? */
void *ih; /* compat or pci handle */
bus_space_handle_t ctl_baseioh; /* ctrl regs blk, native mode */
bus_size_t ctl_ios;
#if NATA_DMA
/* DMA tables and DMA map for xfer, for each drive */
struct pciide_dma_maps {
bus_dma_segment_t dmamap_table_seg;
int dmamap_table_nseg;
bus_dmamap_t dmamap_table;
struct idedma_table *dma_table;
bus_dmamap_t dmamap_xfer;
int dma_flags;
} dma_maps[2];
} dma_maps[ATA_MAXDRIVES];
bus_space_handle_t dma_iohs[IDEDMA_NREGS];
/*
* Some controllers require certain bits to
@ -164,9 +169,6 @@ struct pciide_product_desc {
const char *ide_name;
/* map and setup chip, probe drives */
void (*chip_map)(struct pciide_softc*, struct pci_attach_args*);
#if 0
void (*chip_unmap)(struct pciide_softc *);
#endif
};
/* Flags for ide_flags */
@ -202,6 +204,8 @@ void sata_setup_channel(struct ata_channel*);
void pciide_channel_dma_setup(struct pciide_channel *);
int pciide_dma_table_setup(struct pciide_softc*, int, int);
void pciide_dma_table_teardown(struct pciide_softc *, int, int);
int pciide_dma_dmamap_setup(struct pciide_softc *, int, int,
void *, size_t, int);
int pciide_dma_init(void*, int, int, void *, size_t, int);
@ -223,19 +227,18 @@ const struct pciide_product_desc* pciide_lookup_product
(u_int32_t, const struct pciide_product_desc *);
void pciide_common_attach(struct pciide_softc *, struct pci_attach_args *,
const struct pciide_product_desc *);
int pciide_common_detach(struct pciide_softc *, int);
int pciide_chipen(struct pciide_softc *, struct pci_attach_args *);
void pciide_mapregs_compat(struct pci_attach_args *,
struct pciide_channel *, int, bus_size_t *, bus_size_t*);
struct pciide_channel *, int);
void pciide_mapregs_native(struct pci_attach_args *,
struct pciide_channel *, bus_size_t *, bus_size_t *,
int (*pci_intr)(void *));
struct pciide_channel *, int (*pci_intr)(void *));
void pciide_mapreg_dma(struct pciide_softc *,
struct pci_attach_args *);
int pciide_chansetup(struct pciide_softc *, int, pcireg_t);
void pciide_mapchan(struct pci_attach_args *,
struct pciide_channel *, pcireg_t, bus_size_t *, bus_size_t *,
int (*pci_intr)(void *));
struct pciide_channel *, pcireg_t, int (*pci_intr)(void *));
void pciide_map_compat_intr(struct pci_attach_args *,
struct pciide_channel *, int);
int pciide_compat_intr(void *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pdcide.c,v 1.27 2009/10/19 18:41:16 bouyer Exp $ */
/* $NetBSD: pdcide.c,v 1.28 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pdcide.c,v 1.27 2009/10/19 18:41:16 bouyer Exp $");
__KERNEL_RCSID(0, "$NetBSD: pdcide.c,v 1.28 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -181,7 +181,6 @@ pdc202xx_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
struct pciide_channel *cp;
int channel;
pcireg_t interface, st, mode;
bus_size_t cmdsize, ctlsize;
if (!PDC_IS_268(sc)) {
st = pci_conf_read(sc->sc_pc, sc->sc_tag, PDC2xx_STATE);
@ -313,7 +312,7 @@ pdc202xx_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
cp->ata_channel.ch_flags |= ATACH_DISABLED;
continue;
}
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_mapchan(pa, cp, interface,
PDC_IS_265(sc) ? pdc20265_pci_intr : pdc202xx_pci_intr);
/* clear interrupt, in case there is one pending */
bus_space_write_1(sc->sc_dma_iot, cp->dma_iohs[IDEDMA_CTL], 0,

View File

@ -1,4 +1,4 @@
/* $NetBSD: pdcsata.c,v 1.18 2009/11/26 15:17:10 njoly Exp $ */
/* $NetBSD: pdcsata.c,v 1.19 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 2004, Manuel Bouyer.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pdcsata.c,v 1.18 2009/11/26 15:17:10 njoly Exp $");
__KERNEL_RCSID(0, "$NetBSD: pdcsata.c,v 1.19 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/types.h>
#include <sys/malloc.h>
@ -226,7 +226,6 @@ pdcsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
struct ata_channel *wdc_cp;
struct wdc_regs *wdr;
int channel, i;
bus_size_t dmasize;
pci_intr_handle_t intrhandle;
const char *intrstr;
@ -257,7 +256,7 @@ pdcsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
sc->sc_dma_ok = (pci_mapreg_map(pa, PCIIDE_REG_BUS_MASTER_DMA,
PCI_MAPREG_MEM_TYPE_32BIT, 0, &sc->sc_dma_iot,
&sc->sc_dma_ioh, NULL, &dmasize) == 0);
&sc->sc_dma_ioh, NULL, &sc->sc_dma_ios) == 0);
if (!sc->sc_dma_ok) {
aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev,
"couldn't map bus-master DMA registers\n");
@ -269,10 +268,10 @@ pdcsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
if (pci_mapreg_map(pa, PDC203xx_BAR_IDEREGS,
PCI_MAPREG_MEM_TYPE_32BIT, 0, &sc->sc_ba5_st,
&sc->sc_ba5_sh, NULL, NULL) != 0) {
&sc->sc_ba5_sh, NULL, &sc->sc_ba5_ss) != 0) {
aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev,
"couldn't map IDE registers\n");
bus_space_unmap(sc->sc_dma_iot, sc->sc_dma_ioh, dmasize);
bus_space_unmap(sc->sc_dma_iot, sc->sc_dma_ioh, sc->sc_dma_ios);
pci_intr_disestablish(pa->pa_pc, sc->sc_pci_ih);
return;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: piixide.c,v 1.55 2010/07/30 15:28:09 njoly Exp $ */
/* $NetBSD: piixide.c,v 1.56 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.55 2010/07/30 15:28:09 njoly Exp $");
__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.56 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -398,7 +398,6 @@ piix_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
struct pciide_channel *cp;
int channel;
u_int32_t idetim;
bus_size_t cmdsize, ctlsize;
pcireg_t interface = PCI_INTERFACE(pa->pa_class);
if (pciide_chipen(sc, pa) == 0)
@ -523,8 +522,7 @@ piix_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
channel, idetim, interface);
#endif
}
pciide_mapchan(pa, cp, interface,
&cmdsize, &ctlsize, pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
ATADEBUG_PRINT(("piix_setup_chip: idetim=0x%x",
@ -894,7 +892,6 @@ static void
piixsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
{
struct pciide_channel *cp;
bus_size_t cmdsize, ctlsize;
pcireg_t interface, cmdsts;
int channel;
@ -938,8 +935,7 @@ piixsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
cp = &sc->pciide_channels[channel];
if (pciide_chansetup(sc, channel, interface) == 0)
continue;
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rccide.c,v 1.19 2009/03/14 15:36:19 dsl Exp $ */
/* $NetBSD: rccide.c,v 1.20 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 2003 By Noon Software, Inc. All rights reserved.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rccide.c,v 1.19 2009/03/14 15:36:19 dsl Exp $");
__KERNEL_RCSID(0, "$NetBSD: rccide.c,v 1.20 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -116,7 +116,6 @@ serverworks_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
pcireg_t interface = PCI_INTERFACE(pa->pa_class);
pcitag_t pcib_tag;
int channel;
bus_size_t cmdsize, ctlsize;
if (pciide_chipen(sc, pa) == 0)
return;
@ -164,11 +163,11 @@ serverworks_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
switch (sc->sc_pp->ide_product) {
case PCI_PRODUCT_SERVERWORKS_CSB6_IDE:
case PCI_PRODUCT_SERVERWORKS_CSB6_RAID:
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_mapchan(pa, cp, interface,
serverworkscsb6_pci_intr);
break;
default:
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_mapchan(pa, cp, interface,
serverworks_pci_intr);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: satalink.c,v 1.41 2010/06/08 05:06:10 mrg Exp $ */
/* $NetBSD: satalink.c,v 1.42 2010/11/05 18:07:24 jakllsch Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: satalink.c,v 1.41 2010/06/08 05:06:10 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: satalink.c,v 1.42 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -423,7 +423,6 @@ static void
sii3112_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
{
struct pciide_channel *cp;
bus_size_t cmdsize, ctlsize;
pcireg_t interface, scs_cmd, cfgctl;
int channel;
@ -453,7 +452,7 @@ sii3112_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
PCI_MAPREG_TYPE_MEM|
PCI_MAPREG_MEM_TYPE_32BIT, 0,
&sc->sc_ba5_st, &sc->sc_ba5_sh,
NULL, NULL) != 0)
NULL, &sc->sc_ba5_ss) != 0)
aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev,
"unable to map SATALink BA5 register space\n");
else
@ -523,8 +522,7 @@ sii3112_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
cp = &sc->pciide_channels[channel];
if (pciide_chansetup(sc, channel, interface) == 0)
continue;
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
}
@ -709,7 +707,7 @@ sii3114_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
PCI_MAPREG_TYPE_MEM|
PCI_MAPREG_MEM_TYPE_32BIT, 0,
&sc->sc_ba5_st, &sc->sc_ba5_sh,
NULL, NULL) != 0) {
NULL, &sc->sc_ba5_ss) != 0) {
aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev,
"unable to map SATALink BA5 register space\n");
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: siside.c,v 1.25 2009/10/19 18:41:16 bouyer Exp $ */
/* $NetBSD: siside.c,v 1.26 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: siside.c,v 1.25 2009/10/19 18:41:16 bouyer Exp $");
__KERNEL_RCSID(0, "$NetBSD: siside.c,v 1.26 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -226,7 +226,6 @@ sis_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
u_int8_t sis_ctr0 = pciide_pci_read(sc->sc_pc, sc->sc_tag, SIS_CTRL0);
pcireg_t interface = PCI_INTERFACE(pa->pa_class);
pcireg_t rev = PCI_REVISION(pa->pa_class);
bus_size_t cmdsize, ctlsize;
if (pciide_chipen(sc, pa) == 0)
return;
@ -331,8 +330,7 @@ sis_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
cp->ata_channel.ch_flags |= ATACH_DISABLED;
continue;
}
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
}
@ -513,7 +511,6 @@ sis_sata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
struct pciide_channel *cp;
pcireg_t interface = PCI_INTERFACE(pa->pa_class);
int channel;
bus_size_t cmdsize, ctlsize;
if (pciide_chipen(sc, pa) == 0)
return;
@ -554,7 +551,6 @@ sis_sata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
cp = &sc->pciide_channels[channel];
if (pciide_chansetup(sc, channel, interface) == 0)
continue;
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: slide.c,v 1.20 2008/04/28 20:23:55 martin Exp $ */
/* $NetBSD: slide.c,v 1.21 2010/11/05 18:07:24 jakllsch Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: slide.c,v 1.20 2008/04/28 20:23:55 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: slide.c,v 1.21 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -128,7 +128,6 @@ static void
sl82c105_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
{
struct pciide_channel *cp;
bus_size_t cmdsize, ctlsize;
pcireg_t interface, idecr;
int channel;
@ -179,8 +178,7 @@ sl82c105_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
cp->ata_channel.ch_flags |= ATACH_DISABLED;
continue;
}
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: stpcide.c,v 1.19 2008/05/26 10:31:22 nisimura Exp $ */
/* $NetBSD: stpcide.c,v 1.20 2010/11/05 18:07:24 jakllsch Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: stpcide.c,v 1.19 2008/05/26 10:31:22 nisimura Exp $");
__KERNEL_RCSID(0, "$NetBSD: stpcide.c,v 1.20 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -89,7 +89,6 @@ stpc_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
struct pciide_channel *cp;
int channel;
pcireg_t interface = PCI_INTERFACE(pa->pa_class);
bus_size_t cmdsize, ctlsize;
if (pciide_chipen(sc, pa) == 0)
return;
@ -117,8 +116,7 @@ stpc_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
cp = &sc->pciide_channels[channel];
if (pciide_chansetup(sc, channel, interface) == 0)
continue;
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: svwsata.c,v 1.11 2009/11/26 15:17:10 njoly Exp $ */
/* $NetBSD: svwsata.c,v 1.12 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: svwsata.c,v 1.11 2009/11/26 15:17:10 njoly Exp $");
__KERNEL_RCSID(0, "$NetBSD: svwsata.c,v 1.12 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -122,7 +122,7 @@ svwsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
PCI_MAPREG_TYPE_MEM |
PCI_MAPREG_MEM_TYPE_32BIT, 0,
&sc->sc_ba5_st, &sc->sc_ba5_sh,
NULL, NULL) != 0) {
NULL, &sc->sc_ba5_ss) != 0) {
aprint_error(": unable to map BA5 register space\n");
return;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: toshide.c,v 1.2 2009/09/20 01:12:30 christos Exp $ */
/* $NetBSD: toshide.c,v 1.3 2010/11/05 18:07:24 jakllsch Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: toshide.c,v 1.2 2009/09/20 01:12:30 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: toshide.c,v 1.3 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -114,7 +114,6 @@ static void
piccolo_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
{
struct pciide_channel *cp;
bus_size_t cmdsize, ctlsize;
pcireg_t interface;
int channel;
@ -157,8 +156,7 @@ piccolo_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
if (pciide_chansetup(sc, channel, interface) == 0)
continue;
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: viaide.c,v 1.69 2010/03/22 22:39:48 dyoung Exp $ */
/* $NetBSD: viaide.c,v 1.70 2010/11/05 18:07:24 jakllsch Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.69 2010/03/22 22:39:48 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.70 2010/11/05 18:07:24 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -40,9 +40,9 @@ __KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.69 2010/03/22 22:39:48 dyoung Exp $");
static int via_pcib_match(struct pci_attach_args *);
static void via_chip_map(struct pciide_softc *, struct pci_attach_args *);
static void via_mapchan(struct pci_attach_args *, struct pciide_channel *,
pcireg_t, bus_size_t *, bus_size_t *, int (*)(void *));
pcireg_t, int (*)(void *));
static void via_mapregs_compat_native(struct pci_attach_args *,
struct pciide_channel *, bus_size_t *, bus_size_t *);
struct pciide_channel *);
static int via_sata_chip_map_common(struct pciide_softc *,
struct pci_attach_args *);
static void via_sata_chip_map(struct pciide_softc *,
@ -440,7 +440,6 @@ via_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
pcireg_t vendor = PCI_VENDOR(pa->pa_id);
int channel;
u_int32_t ideconf;
bus_size_t cmdsize, ctlsize;
pcireg_t pcib_id, pcib_class;
struct pci_attach_args pcib_pa;
@ -614,15 +613,13 @@ unknown:
cp->ata_channel.ch_flags |= ATACH_DISABLED;
continue;
}
via_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_pci_intr);
via_mapchan(pa, cp, interface, pciide_pci_intr);
}
}
static void
via_mapchan(struct pci_attach_args *pa, struct pciide_channel *cp,
pcireg_t interface, bus_size_t *cmdsizep, bus_size_t *ctlsizep,
int (*pci_intr)(void *))
pcireg_t interface, int (*pci_intr)(void *))
{
struct ata_channel *wdc_cp;
struct pciide_softc *sc;
@ -638,13 +635,11 @@ via_mapchan(struct pci_attach_args *pa, struct pciide_channel *cp,
/* native mode with irq 14/15 requested? */
if (compat_nat_enable != NULL &&
prop_bool_true(compat_nat_enable))
via_mapregs_compat_native(pa, cp, cmdsizep, ctlsizep);
via_mapregs_compat_native(pa, cp);
else
pciide_mapregs_native(pa, cp, cmdsizep, ctlsizep,
pci_intr);
pciide_mapregs_native(pa, cp, pci_intr);
} else {
pciide_mapregs_compat(pa, cp, wdc_cp->ch_channel, cmdsizep,
ctlsizep);
pciide_mapregs_compat(pa, cp, wdc_cp->ch_channel);
if ((cp->ata_channel.ch_flags & ATACH_DISABLED) == 0)
pciide_map_compat_intr(pa, cp, wdc_cp->ch_channel);
}
@ -659,7 +654,7 @@ via_mapchan(struct pci_attach_args *pa, struct pciide_channel *cp,
*/
static void
via_mapregs_compat_native(struct pci_attach_args *pa,
struct pciide_channel *cp, bus_size_t *cmdsizep, bus_size_t *ctlsizep)
struct pciide_channel *cp)
{
struct ata_channel *wdc_cp;
struct pciide_softc *sc;
@ -670,7 +665,7 @@ via_mapregs_compat_native(struct pci_attach_args *pa,
/* XXX prevent pciide_mapregs_native from installing a handler */
if (sc->sc_pci_ih == NULL)
sc->sc_pci_ih = (void *)~0;
pciide_mapregs_native(pa, cp, cmdsizep, ctlsizep, NULL);
pciide_mapregs_native(pa, cp, NULL);
/* interrupts are fixed to 14/15, as in compatibility mode */
cp->compat = 1;
@ -840,7 +835,6 @@ pio: /* setup PIO mode */
static int
via_sata_chip_map_common(struct pciide_softc *sc, struct pci_attach_args *pa)
{
bus_size_t satasize;
int maptype, ret;
if (pciide_chipen(sc, pa) == 0)
@ -875,7 +869,7 @@ via_sata_chip_map_common(struct pciide_softc *sc, struct pci_attach_args *pa)
case PCI_MAPREG_TYPE_IO:
ret = pci_mapreg_map(pa, PCI_MAPREG_START + 0x14,
PCI_MAPREG_TYPE_IO, 0, &sc->sc_ba5_st, &sc->sc_ba5_sh,
NULL, &satasize);
NULL, &sc->sc_ba5_ss);
break;
case PCI_MAPREG_MEM_TYPE_32BIT:
/*
@ -895,7 +889,7 @@ via_sata_chip_map_common(struct pciide_softc *sc, struct pci_attach_args *pa)
ret = pci_mapreg_map(pa, PCI_MAPREG_START + 0x14,
PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT,
0, &sc->sc_ba5_st, &sc->sc_ba5_sh,
NULL, &satasize);
NULL, &sc->sc_ba5_ss);
break;
default:
aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev,
@ -920,7 +914,6 @@ via_sata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa,
struct wdc_regs *wdr;
pcireg_t interface = PCI_INTERFACE(pa->pa_class);
int channel;
bus_size_t cmdsize, ctlsize;
if (via_sata_chip_map_common(sc, pa) == 0)
return;
@ -966,8 +959,7 @@ via_sata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa,
continue;
}
sc->sc_wdcdev.sc_atac.atac_probe = wdc_sataprobe;
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
pciide_pci_intr);
pciide_mapchan(pa, cp, interface, pciide_pci_intr);
}
}
@ -991,7 +983,6 @@ via_sata_chip_map_new(struct pciide_softc *sc, struct pci_attach_args *pa)
struct wdc_regs *wdr;
pcireg_t interface = PCI_INTERFACE(pa->pa_class);
int channel;
bus_size_t cmdsize;
pci_intr_handle_t intrhandle;
const char *intrstr;
int i;
@ -1065,7 +1056,7 @@ via_sata_chip_map_new(struct pciide_softc *sc, struct pci_attach_args *pa)
if (pci_mapreg_map(pa, (PCI_MAPREG_START + (4 * (channel))),
PCI_MAPREG_TYPE_IO, 0, &wdr->cmd_iot, &wdr->cmd_baseioh,
NULL, &cmdsize) != 0) {
NULL, &wdr->cmd_ios) != 0) {
aprint_error_dev(sc->sc_wdcdev.sc_atac.atac_dev,
"couldn't map %s channel regs\n", cp->name);
}