diff options
| author | thorpej <thorpej@NetBSD.org> | 2003-12-14 01:32:01 +0000 |
|---|---|---|
| committer | thorpej <thorpej@NetBSD.org> | 2003-12-14 01:32:01 +0000 |
| commit | 2f2ca9e66b4d76404a87dc0b37d8aa0cd74663bb (patch) | |
| tree | 50e9ac04580b00483676bdde0e85ed6d47542ba7 /sys/dev | |
| parent | 188f029f3fb3658d4ddd27245e70342f8d20c51a (diff) | |
Split the Intel i31244 SATA controller ("Artisea") driver out of piixide
into its own driver (artsata).
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/pci/artsata.c | 142 | ||||
| -rw-r--r-- | sys/dev/pci/files.pci | 7 | ||||
| -rw-r--r-- | sys/dev/pci/piixide.c | 61 |
3 files changed, 149 insertions, 61 deletions
diff --git a/sys/dev/pci/artsata.c b/sys/dev/pci/artsata.c new file mode 100644 index 00000000000..ee2e1513da7 --- /dev/null +++ b/sys/dev/pci/artsata.c @@ -0,0 +1,142 @@ +/* $NetBSD: artsata.c,v 1.1 2003/12/14 01:32:02 thorpej Exp $ */ + +/*- + * Copyright (c) 2003 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe of Wasabi Systems, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/param.h> +#include <sys/systm.h> + +#include <dev/pci/pcivar.h> +#include <dev/pci/pcidevs.h> +#include <dev/pci/pciidereg.h> +#include <dev/pci/pciidevar.h> + +static void artisea_chip_map(struct pciide_softc*, struct pci_attach_args *); + +static int artsata_match(struct device *, struct cfdata *, void *); +static void artsata_attach(struct device *, struct device *, void *); + +static const struct pciide_product_desc pciide_artsata_products[] = { + { PCI_PRODUCT_INTEL_31244, + 0, + "Intel 31244 Serial ATA Controller", + artisea_chip_map, + }, + { 0, + 0, + NULL, + NULL + } +}; + +CFATTACH_DECL(artsata, sizeof(struct pciide_softc), + artsata_match, artsata_attach, NULL, NULL); + +static int +artsata_match(struct device *parent, struct cfdata *match, void *aux) +{ + struct pci_attach_args *pa = aux; + + if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_INTEL) { + if (pciide_lookup_product(pa->pa_id, pciide_artsata_products)) + return (2); + } + return (0); +} + +static void +artsata_attach(struct device *parent, struct device *self, void *aux) +{ + struct pci_attach_args *pa = aux; + struct pciide_softc *sc = (struct pciide_softc *)self; + + pciide_common_attach(sc, pa, + pciide_lookup_product(pa->pa_id, pciide_artsata_products)); + +} + +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; + + if (pciide_chipen(sc, pa) == 0) + return; + + aprint_normal("%s: bus-master DMA support present", + sc->sc_wdcdev.sc_dev.dv_xname); +#ifndef PCIIDE_I31244_ENABLEDMA + if (sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_31244 && + PCI_REVISION(pa->pa_class) == 0) { + aprint_normal(" but disabled due to rev. 0"); + sc->sc_dma_ok = 0; + } else +#endif + pciide_mapreg_dma(sc, pa); + aprint_normal("\n"); + + /* + * XXX Configure LEDs to show activity. + */ + + sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32 | + WDC_CAPABILITY_MODE; + sc->sc_wdcdev.PIO_cap = 4; + if (sc->sc_dma_ok) { + sc->sc_wdcdev.cap |= WDC_CAPABILITY_DMA | WDC_CAPABILITY_UDMA; + sc->sc_wdcdev.cap |= WDC_CAPABILITY_IRQACK; + sc->sc_wdcdev.irqack = pciide_irqack; + sc->sc_wdcdev.DMA_cap = 2; + sc->sc_wdcdev.UDMA_cap = 6; + } + sc->sc_wdcdev.set_modes = sata_setup_channel; + + sc->sc_wdcdev.channels = sc->wdc_chanarray; + sc->sc_wdcdev.nchannels = PCIIDE_NUM_CHANNELS; + + interface = PCI_INTERFACE(pa->pa_class); + + for (channel = 0; channel < sc->sc_wdcdev.nchannels; channel++) { + cp = &sc->pciide_channels[channel]; + if (pciide_chansetup(sc, channel, interface) == 0) + continue; + pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize, + pciide_pci_intr); + } +} diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci index 5d321cda3fc..de69448b24e 100644 --- a/sys/dev/pci/files.pci +++ b/sys/dev/pci/files.pci @@ -1,4 +1,4 @@ -# $NetBSD: files.pci,v 1.203 2003/12/13 23:13:41 thorpej Exp $ +# $NetBSD: files.pci,v 1.204 2003/12/14 01:32:02 thorpej Exp $ # # Config file and device description for machine-independent PCI code. # Included by ports that need it. Requires that the SCSI files be @@ -210,6 +210,11 @@ device aceride {[channel = -1]}: ata, pciide_common attach aceride at pci file dev/pci/aceride.c aceride +# Intel i31244 SATA controller +device artsata {[channel = -1]}: ata, pciide_common +attach artsata at pci +file dev/pci/artsata.c artsata + # CMD tech IDE controllers device cmdide {[channel = -1]}: ata, pciide_common attach cmdide at pci diff --git a/sys/dev/pci/piixide.c b/sys/dev/pci/piixide.c index f9cf0cb2e4e..e489c3450f2 100644 --- a/sys/dev/pci/piixide.c +++ b/sys/dev/pci/piixide.c @@ -1,4 +1,4 @@ -/* $NetBSD: piixide.c,v 1.5 2003/12/06 22:40:03 bouyer Exp $ */ +/* $NetBSD: piixide.c,v 1.6 2003/12/14 01:32:02 thorpej Exp $ */ /* * Copyright (c) 1999, 2000, 2001 Manuel Bouyer. @@ -44,7 +44,6 @@ static void piix3_4_setup_channel(struct channel_softc *); static u_int32_t piix_setup_idetim_timings(u_int8_t, u_int8_t, u_int8_t); static u_int32_t piix_setup_idetim_drvs(struct ata_drive_datas *); static u_int32_t piix_setup_sidetim_timings(u_int8_t, u_int8_t, u_int8_t); -static void artisea_chip_map(struct pciide_softc*, struct pci_attach_args *); static void piixsata_chip_map(struct pciide_softc*, struct pci_attach_args *); static int piixide_match(struct device *, struct cfdata *, void *); @@ -121,11 +120,6 @@ static const struct pciide_product_desc pciide_intel_products[] = { "Intel 82801EB IDE Controller (ICH5)", piix_chip_map, }, - { PCI_PRODUCT_INTEL_31244, - 0, - "Intel 31244 Serial ATA Controller", - artisea_chip_map, - }, { PCI_PRODUCT_INTEL_82801EB_SATA, 0, "Intel 82801EB Serial ATA Controller", @@ -641,59 +635,6 @@ piix_setup_sidetim_timings(mode, dma, channel) } 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; - - if (pciide_chipen(sc, pa) == 0) - return; - - aprint_normal("%s: bus-master DMA support present", - sc->sc_wdcdev.sc_dev.dv_xname); -#ifndef PCIIDE_I31244_ENABLEDMA - if (sc->sc_pp->ide_product == PCI_PRODUCT_INTEL_31244 && - PCI_REVISION(pa->pa_class) == 0) { - aprint_normal(" but disabled due to rev. 0"); - sc->sc_dma_ok = 0; - } else -#endif - pciide_mapreg_dma(sc, pa); - aprint_normal("\n"); - - /* - * XXX Configure LEDs to show activity. - */ - - sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32 | - WDC_CAPABILITY_MODE; - sc->sc_wdcdev.PIO_cap = 4; - if (sc->sc_dma_ok) { - sc->sc_wdcdev.cap |= WDC_CAPABILITY_DMA | WDC_CAPABILITY_UDMA; - sc->sc_wdcdev.cap |= WDC_CAPABILITY_IRQACK; - sc->sc_wdcdev.irqack = pciide_irqack; - sc->sc_wdcdev.DMA_cap = 2; - sc->sc_wdcdev.UDMA_cap = 6; - } - sc->sc_wdcdev.set_modes = sata_setup_channel; - - sc->sc_wdcdev.channels = sc->wdc_chanarray; - sc->sc_wdcdev.nchannels = PCIIDE_NUM_CHANNELS; - - interface = PCI_INTERFACE(pa->pa_class); - - for (channel = 0; channel < sc->sc_wdcdev.nchannels; channel++) { - cp = &sc->pciide_channels[channel]; - if (pciide_chansetup(sc, channel, interface) == 0) - continue; - pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize, - pciide_pci_intr); - } -} - -static void piixsata_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa) { struct pciide_channel *cp; |
