Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/sys/dev/pci Pull up revision 1.166 (requested by bouyer...
details: https://anonhg.NetBSD.org/src/rev/3187e9cbfe44
branches: netbsd-1-6
changeset: 529220:3187e9cbfe44
user: tron <tron%NetBSD.org@localhost>
date: Fri Nov 01 16:20:50 2002 +0000
description:
Pull up revision 1.166 (requested by bouyer in ticket #725):
Add support for HPT372. From sdegler%kashmir.degler.net@localhost in kern/17908,
with some improvement from me, and from FreeBSD.
diffstat:
sys/dev/pci/pciide.c | 121 +++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 98 insertions(+), 23 deletions(-)
diffs (202 lines):
diff -r 7198ca8d85e3 -r 3187e9cbfe44 sys/dev/pci/pciide.c
--- a/sys/dev/pci/pciide.c Fri Nov 01 16:20:30 2002 +0000
+++ b/sys/dev/pci/pciide.c Fri Nov 01 16:20:50 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pciide.c,v 1.153.2.6 2002/11/01 13:23:06 tron Exp $ */
+/* $NetBSD: pciide.c,v 1.153.2.7 2002/11/01 16:20:50 tron Exp $ */
/*
@@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pciide.c,v 1.153.2.6 2002/11/01 13:23:06 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciide.c,v 1.153.2.7 2002/11/01 16:20:50 tron Exp $");
#ifndef WDCDEBUG
#define WDCDEBUG
@@ -504,6 +504,11 @@
NULL,
hpt_chip_map,
},
+ { PCI_PRODUCT_TRIONES_HPT372,
+ IDE_PCI_CLASS_OVERRIDE,
+ NULL,
+ hpt_chip_map
+ },
{ PCI_PRODUCT_TRIONES_HPT374,
IDE_PCI_CLASS_OVERRIDE,
NULL,
@@ -3266,8 +3271,12 @@
printf(": Triones/Highpoint ");
if (sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT374)
printf("HPT374 IDE Controller\n");
+ else if (sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT372)
+ printf("HPT372 IDE Controller\n");
else if (sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT366) {
- if (revision == HPT370_REV)
+ if (revision == HPT372_REV)
+ printf("HPT372 IDE Controller\n");
+ else if (revision == HPT370_REV)
printf("HPT370 IDE Controller\n");
else if (revision == HPT370A_REV)
printf("HPT370A IDE Controller\n");
@@ -3289,7 +3298,9 @@
interface = PCIIDE_INTERFACE_BUS_MASTER_DMA |
PCIIDE_INTERFACE_PCI(0);
if ((sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT366 &&
- (revision == HPT370_REV || revision == HPT370A_REV)) ||
+ (revision == HPT370_REV || revision == HPT370A_REV ||
+ revision == HPT372_REV)) ||
+ sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT372 ||
sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT374)
interface |= PCIIDE_INTERFACE_PCI(1);
}
@@ -3330,7 +3341,10 @@
sc->sc_wdcdev.nchannels = 1;
} else {
sc->sc_wdcdev.nchannels = 2;
- if (sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT374)
+ if (sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT374 ||
+ sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT372 ||
+ (sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT366 &&
+ revision == HPT372_REV))
sc->sc_wdcdev.UDMA_cap = 6;
else
sc->sc_wdcdev.UDMA_cap = 5;
@@ -3363,7 +3377,9 @@
hpt_setup_channel(&cp->wdc_channel);
}
if ((sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT366 &&
- (revision == HPT370_REV || revision == HPT370A_REV)) ||
+ (revision == HPT370_REV || revision == HPT370A_REV ||
+ revision == HPT372_REV)) ||
+ sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT372 ||
sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT374) {
/*
* HPT370_REV and highter has a bit to disable interrupts,
@@ -3373,8 +3389,11 @@
pciide_pci_read(sc->sc_pc, sc->sc_tag, HPT_CSEL) &
~HPT_CSEL_IRQDIS);
}
- /* set clocks, etc (mandatory on 374, optional otherwise) */
- if (sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT374)
+ /* set clocks, etc (mandatory on 372/4, optional otherwise) */
+ if ((sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT366 &&
+ revision == HPT372_REV ) ||
+ sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT372 ||
+ sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT374)
pciide_pci_write(sc->sc_pc, sc->sc_tag, HPT_SC2,
(pciide_pci_read(sc->sc_pc, sc->sc_tag, HPT_SC2) &
HPT_SC2_MAEN) | HPT_SC2_OSC_EN);
@@ -3392,6 +3411,8 @@
u_int32_t idedma_ctl;
struct pciide_channel *cp = (struct pciide_channel*)chp;
struct pciide_softc *sc = (struct pciide_softc *)cp->wdc_channel.wdc;
+ int revision =
+ PCI_REVISION(pci_conf_read(sc->sc_pc, sc->sc_tag, PCI_CLASS_REG));
cable = pciide_pci_read(sc->sc_pc, sc->sc_tag, HPT_CSEL);
@@ -3416,11 +3437,29 @@
if ((cable & HPT_CSEL_CBLID(chp->channel)) != 0 &&
drvp->UDMA_mode > 2)
drvp->UDMA_mode = 2;
- after = (sc->sc_wdcdev.nchannels == 2) ?
- ( (sc->sc_wdcdev.UDMA_cap == 6) ?
- hpt374_udma[drvp->UDMA_mode] :
- hpt370_udma[drvp->UDMA_mode]) :
- hpt366_udma[drvp->UDMA_mode];
+ switch (sc->sc_pp->ide_product) {
+ case PCI_PRODUCT_TRIONES_HPT374:
+ after = hpt374_udma[drvp->UDMA_mode];
+ break;
+ case PCI_PRODUCT_TRIONES_HPT372:
+ after = hpt372_udma[drvp->UDMA_mode];
+ break;
+ case PCI_PRODUCT_TRIONES_HPT366:
+ default:
+ switch(revision) {
+ case HPT372_REV:
+ after = hpt372_udma[drvp->UDMA_mode];
+ break;
+ case HPT370_REV:
+ case HPT370A_REV:
+ after = hpt370_udma[drvp->UDMA_mode];
+ break;
+ case HPT366_REV:
+ default:
+ after = hpt366_udma[drvp->UDMA_mode];
+ break;
+ }
+ }
idedma_ctl |= IDEDMA_CTL_DRV_DMA(drive);
} else if (drvp->drive_flags & DRIVE_DMA) {
/*
@@ -3432,19 +3471,55 @@
(drvp->DMA_mode + 2) > drvp->PIO_mode) {
drvp->DMA_mode = drvp->PIO_mode - 2;
}
- after = (sc->sc_wdcdev.nchannels == 2) ?
- ( (sc->sc_wdcdev.UDMA_cap == 6) ?
- hpt374_dma[drvp->DMA_mode] :
- hpt370_dma[drvp->DMA_mode]) :
- hpt366_dma[drvp->DMA_mode];
+ switch (sc->sc_pp->ide_product) {
+ case PCI_PRODUCT_TRIONES_HPT374:
+ after = hpt374_dma[drvp->DMA_mode];
+ break;
+ case PCI_PRODUCT_TRIONES_HPT372:
+ after = hpt372_dma[drvp->DMA_mode];
+ break;
+ case PCI_PRODUCT_TRIONES_HPT366:
+ default:
+ switch(revision) {
+ case HPT372_REV:
+ after = hpt372_dma[drvp->DMA_mode];
+ break;
+ case HPT370_REV:
+ case HPT370A_REV:
+ after = hpt370_dma[drvp->DMA_mode];
+ break;
+ case HPT366_REV:
+ default:
+ after = hpt366_dma[drvp->DMA_mode];
+ break;
+ }
+ }
idedma_ctl |= IDEDMA_CTL_DRV_DMA(drive);
} else {
/* PIO only */
- after = (sc->sc_wdcdev.nchannels == 2) ?
- ( (sc->sc_wdcdev.UDMA_cap == 6) ?
- hpt374_pio[drvp->PIO_mode] :
- hpt370_pio[drvp->PIO_mode]) :
- hpt366_pio[drvp->PIO_mode];
+ switch (sc->sc_pp->ide_product) {
+ case PCI_PRODUCT_TRIONES_HPT374:
+ after = hpt374_pio[drvp->PIO_mode];
+ break;
+ case PCI_PRODUCT_TRIONES_HPT372:
+ after = hpt372_pio[drvp->PIO_mode];
+ break;
+ case PCI_PRODUCT_TRIONES_HPT366:
+ default:
+ switch(revision) {
+ case HPT372_REV:
+ after = hpt372_pio[drvp->PIO_mode];
+ break;
+ case HPT370_REV:
+ case HPT370A_REV:
+ after = hpt370_pio[drvp->PIO_mode];
+ break;
+ case HPT366_REV:
+ default:
+ after = hpt366_pio[drvp->PIO_mode];
+ break;
+ }
+ }
}
pci_conf_write(sc->sc_pc, sc->sc_tag,
HPT_IDETIM(chp->channel, drive), after);
Home |
Main Index |
Thread Index |
Old Index