/*
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
static void
hpt_chip_map(struct pciide_softc *sc, const struct pci_attach_args *pa)
{
struct pciide_channel *cp;
int i, compatchan, revision;
pcireg_t interface;
if (pciide_chipen(sc, pa) == 0)
return;
revision = PCI_REVISION(pa->pa_class);
aprint_normal_dev(sc->sc_wdcdev.sc_atac.atac_dev,
"Triones/Highpoint ");
switch (sc->sc_pp->ide_product) {
case PCI_PRODUCT_TRIONES_HPT302:
aprint_normal("HPT302 IDE Controller\n");
break;
case PCI_PRODUCT_TRIONES_HPT371:
aprint_normal("HPT371 IDE Controller\n");
break;
case PCI_PRODUCT_TRIONES_HPT374:
aprint_normal("HPT374 IDE Controller\n");
break;
case PCI_PRODUCT_TRIONES_HPT372A:
aprint_normal("HPT372A IDE Controller\n");
break;
case PCI_PRODUCT_TRIONES_HPT366:
if (revision == HPT372_REV)
aprint_normal("HPT372 IDE Controller\n");
else if (revision == HPT370_REV)
aprint_normal("HPT370 IDE Controller\n");
else if (revision == HPT370A_REV)
aprint_normal("HPT370A IDE Controller\n");
else if (revision == HPT368_REV)
aprint_normal("HPT368 IDE Controller\n");
else if (revision == HPT366_REV)
aprint_normal("HPT366 IDE Controller\n");
else
aprint_normal("unknown HPT IDE controller rev %d\n",
revision);
break;
default:
aprint_normal("unknown HPT IDE controller 0x%x\n",
sc->sc_pp->ide_product);
}
/*
* when the chip is in native mode it identifies itself as a
* 'misc mass storage'. Fake interface in this case.
*/
if (PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_MASS_STORAGE_IDE) {
interface = PCI_INTERFACE(pa->pa_class);
} else {
interface = PCIIDE_INTERFACE_BUS_MASTER_DMA |
PCIIDE_INTERFACE_PCI(0);
if ((sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT366 &&
(revision == HPT368_REV || revision == HPT370_REV || revision == HPT370A_REV ||
revision == HPT372_REV)) ||
sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT302 ||
sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT371 ||
sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT372A ||
sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT374)
interface |= PCIIDE_INTERFACE_PCI(1);
}