summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/viaide.c89
1 files changed, 3 insertions, 86 deletions
diff --git a/sys/dev/pci/viaide.c b/sys/dev/pci/viaide.c
index 4caca04775a..098cd523ea3 100644
--- a/sys/dev/pci/viaide.c
+++ b/sys/dev/pci/viaide.c
@@ -1,4 +1,4 @@
-/* $NetBSD: viaide.c,v 1.48 2007/12/16 16:41:01 phx Exp $ */
+/* $NetBSD: viaide.c,v 1.49 2007/12/17 22:01:12 phx Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.48 2007/12/16 16:41:01 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.49 2007/12/17 22:01:12 phx Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -44,11 +44,6 @@ __KERNEL_RCSID(0, "$NetBSD: viaide.c,v 1.48 2007/12/16 16:41:01 phx 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 *));
-static void vt8231_mapregs_native(struct pci_attach_args *,
- struct pciide_channel *, bus_size_t *, bus_size_t *,
- int (*)(void *));
static int via_sata_chip_map_common(struct pciide_softc *,
struct pci_attach_args *);
static void via_sata_chip_map(struct pciide_softc *,
@@ -564,90 +559,12 @@ unknown:
cp->ata_channel.ch_flags |= ATACH_DISABLED;
continue;
}
- via_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
+ pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
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 *))
-{
- struct ata_channel *wdc_cp;
- struct pciide_softc *sc;
- prop_bool_t compat_nat_enable;
-
- wdc_cp = &cp->ata_channel;
- sc = CHAN_TO_PCIIDE(&cp->ata_channel);
- compat_nat_enable = prop_dictionary_get(
- device_properties((struct device *)sc), "use-compat-native-irq");
-
- if (interface & PCIIDE_INTERFACE_PCI(wdc_cp->ch_channel)) {
- /* native mode with irq 14/15 requested? */
- if (compat_nat_enable != NULL &&
- prop_bool_true(compat_nat_enable))
- vt8231_mapregs_native(pa, cp, cmdsizep, ctlsizep,
- pci_intr);
- else
- pciide_mapregs_native(pa, cp, cmdsizep, ctlsizep,
- pci_intr);
- } else {
- pciide_mapregs_compat(pa, cp, wdc_cp->ch_channel, cmdsizep,
- ctlsizep);
- if ((cp->ata_channel.ch_flags & ATACH_DISABLED) == 0)
- pciide_map_compat_intr(pa, cp, wdc_cp->ch_channel);
- }
- wdcattach(wdc_cp);
-}
-
-/*
- * At least under certain (mis)configurations (e.g. on the "Pegasos" board)
- * the VT8231-IDE's native mode only works with irq 14/15, and cannot be
- * programmed to use a single native PCI irq alone. So we install an interrupt
- * handler for each channel, as in compatibility mode.
- */
-static void
-vt8231_mapregs_native(struct pci_attach_args *pa, struct pciide_channel *cp,
- bus_size_t *cmdsizep, bus_size_t *ctlsizep, int (*pci_intr)(void *))
-{
- struct ata_channel *wdc_cp;
- struct pciide_softc *sc;
- pci_intr_handle_t intrhandle;
- const char *intrstr;
-
- wdc_cp = &cp->ata_channel;
- sc = CHAN_TO_PCIIDE(&cp->ata_channel);
-
- /* 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, pci_intr);
-
- /* interrupts are fixed to 14/15, as in compatibility mode */
- intrhandle = PCIIDE_COMPAT_IRQ(wdc_cp->ch_channel);
- intrstr = pci_intr_string(pa->pa_pc, intrhandle);
- sc->sc_pci_ih = pci_intr_establish(pa->pa_pc, intrhandle, IPL_BIO,
- pci_intr, sc);
-
- if (sc->sc_pci_ih != NULL) {
- aprint_normal("%s: %s channel interrupting at %s\n",
- sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cp->name,
- intrstr ? intrstr : "unknown interrupt");
- } else {
- aprint_error("%s: couldn't establish native-PCI interrupt",
- sc->sc_wdcdev.sc_atac.atac_dev.dv_xname);
- if (intrstr != NULL)
- aprint_normal(" at %s", intrstr);
- aprint_normal("\n");
- return;
- }
-
- /* interrupt handler for this channel */
- cp->ih = sc->sc_pci_ih;
-}
-
-static void
via_setup_channel(struct ata_channel *chp)
{
u_int32_t udmatim_reg, datatim_reg;