summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/man/man4/pciide.44
-rw-r--r--sys/dev/pci/pciide.c72
-rw-r--r--sys/dev/pci/pciide_hpt_reg.h31
3 files changed, 83 insertions, 24 deletions
diff --git a/share/man/man4/pciide.4 b/share/man/man4/pciide.4
index 17591201b2a..c2672305534 100644
--- a/share/man/man4/pciide.4
+++ b/share/man/man4/pciide.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pciide.4,v 1.19 2001/12/11 22:07:48 chris Exp $
+.\" $OpenBSD: pciide.4,v 1.20 2002/07/06 14:35:47 gluk Exp $
.\" $NetBSD: pciide.4,v 1.8 1999/03/16 01:19:17 garbled Exp $
.\"
.\" Copyright (c) 1998 Manuel Bouyer.
@@ -66,7 +66,7 @@ CMD Tech PCI0640, PCI0643, PCI0646, PCI0648, PCI0649
.It
Contaq Microsystems/Cypress CY82C693
.It
-HighPoint HPT366, HPT370
+HighPoint HPT366, HPT370, HPT372, HPT374
.It
Intel PIIX, PIIX3, and PIIX4
.It
diff --git a/sys/dev/pci/pciide.c b/sys/dev/pci/pciide.c
index 0638df5f566..edf31294dc2 100644
--- a/sys/dev/pci/pciide.c
+++ b/sys/dev/pci/pciide.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pciide.c,v 1.85 2002/06/08 23:32:51 chris Exp $ */
+/* $OpenBSD: pciide.c,v 1.86 2002/07/06 14:35:47 gluk Exp $ */
/* $NetBSD: pciide.c,v 1.127 2001/08/03 01:31:08 tsutsui Exp $ */
/*
@@ -420,6 +420,14 @@ const struct pciide_product_desc pciide_triones_products[] = {
{ PCI_PRODUCT_TRIONES_HPT366, /* Highpoint HPT36x/37x IDE */
IDE_PCI_CLASS_OVERRIDE,
hpt_chip_map,
+ },
+ { PCI_PRODUCT_TRIONES_HPT372A, /* Highpoint HPT372A IDE */
+ IDE_PCI_CLASS_OVERRIDE,
+ hpt_chip_map
+ },
+ { PCI_PRODUCT_TRIONES_HPT374, /* Highpoint HPT374 IDE */
+ IDE_PCI_CLASS_OVERRIDE,
+ hpt_chip_map
}
};
@@ -3466,7 +3474,11 @@ hpt_chip_map(sc, pa)
} else {
interface = PCIIDE_INTERFACE_BUS_MASTER_DMA |
PCIIDE_INTERFACE_PCI(0);
- if (revision == HPT370_REV || revision == HPT370A_REV)
+ if ((sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT366 &&
+ (revision == HPT370_REV || revision == HPT370A_REV ||
+ revision == HPT372_REV)) ||
+ sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT372A ||
+ sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT374)
interface |= PCIIDE_INTERFACE_PCI(1);
}
@@ -3485,7 +3497,8 @@ hpt_chip_map(sc, pa)
sc->sc_wdcdev.set_modes = hpt_setup_channel;
sc->sc_wdcdev.channels = sc->wdc_chanarray;
- if (revision < HPT370_REV) {
+ if (sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT366 &&
+ revision == HPT366_REV) {
sc->sc_wdcdev.UDMA_cap = 4;
/*
* The 366 has 2 PCI IDE functions, one for primary and one
@@ -3504,13 +3517,21 @@ hpt_chip_map(sc, pa)
sc->sc_wdcdev.nchannels = 1;
} else {
sc->sc_wdcdev.nchannels = 2;
- /*
- * XXX disable udma5 for now.
- */
- if (revision == HPT370_REV)
- sc->sc_wdcdev.UDMA_cap = 4;
- else
- sc->sc_wdcdev.UDMA_cap = 5;
+ if (sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT374 ||
+ sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT372A)
+ sc->sc_wdcdev.UDMA_cap = 6;
+ else if (sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT366) {
+ if (revision == HPT372_REV)
+ sc->sc_wdcdev.UDMA_cap = 6;
+ else
+ sc->sc_wdcdev.UDMA_cap = 5;
+ if (revision == HPT370_REV) {
+ /*
+ * XXX disable udma5 for now.
+ */
+ sc->sc_wdcdev.UDMA_cap = 4;
+ }
+ }
}
for (i = 0; i < sc->sc_wdcdev.nchannels; i++) {
cp = &sc->pciide_channels[i];
@@ -3539,15 +3560,28 @@ hpt_chip_map(sc, pa)
wdcattach(&cp->wdc_channel);
hpt_setup_channel(&cp->wdc_channel);
}
- if (revision == HPT370_REV || revision == HPT370A_REV) {
+ if ((sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT366 &&
+ (revision == HPT370_REV || revision == HPT370A_REV ||
+ revision == HPT372_REV)) ||
+ sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT372A ||
+ sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT374) {
/*
- * HPT370_REV has a bit to disable interrupts, make sure
- * to clear it
+ * HPT370 and highter has a bit to disable interrupts,
+ * make sure to clear it
*/
pciide_pci_write(sc->sc_pc, sc->sc_tag, HPT_CSEL,
pciide_pci_read(sc->sc_pc, sc->sc_tag, HPT_CSEL) &
~HPT_CSEL_IRQDIS);
}
+ /* set clocks, etc (mandatory on 372/4, optional otherwise) */
+ if (sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT372A ||
+ sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT374 ||
+ (sc->sc_pp->ide_product == PCI_PRODUCT_TRIONES_HPT366 &&
+ revision == HPT372_REV))
+ 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);
+
return;
}
@@ -3587,7 +3621,9 @@ hpt_setup_channel(chp)
drvp->UDMA_mode > 2)
drvp->UDMA_mode = 2;
after = (sc->sc_wdcdev.nchannels == 2) ?
- hpt370_udma[drvp->UDMA_mode] :
+ ((sc->sc_wdcdev.UDMA_cap == 6) ?
+ hpt374_udma[drvp->UDMA_mode] :
+ hpt370_udma[drvp->UDMA_mode]) :
hpt366_udma[drvp->UDMA_mode];
idedma_ctl |= IDEDMA_CTL_DRV_DMA(drive);
} else if (drvp->drive_flags & DRIVE_DMA) {
@@ -3601,13 +3637,17 @@ hpt_setup_channel(chp)
drvp->DMA_mode = drvp->PIO_mode - 2;
}
after = (sc->sc_wdcdev.nchannels == 2) ?
- hpt370_dma[drvp->DMA_mode] :
+ ((sc->sc_wdcdev.UDMA_cap == 6) ?
+ hpt374_dma[drvp->DMA_mode] :
+ hpt370_dma[drvp->DMA_mode]) :
hpt366_dma[drvp->DMA_mode];
idedma_ctl |= IDEDMA_CTL_DRV_DMA(drive);
} else {
/* PIO only */
after = (sc->sc_wdcdev.nchannels == 2) ?
- hpt370_pio[drvp->PIO_mode] :
+ ( (sc->sc_wdcdev.UDMA_cap == 6) ?
+ hpt374_pio[drvp->PIO_mode] :
+ hpt370_pio[drvp->PIO_mode]) :
hpt366_pio[drvp->PIO_mode];
}
pci_conf_write(sc->sc_pc, sc->sc_tag,
diff --git a/sys/dev/pci/pciide_hpt_reg.h b/sys/dev/pci/pciide_hpt_reg.h
index e1d11f14616..a61ae1f1cb6 100644
--- a/sys/dev/pci/pciide_hpt_reg.h
+++ b/sys/dev/pci/pciide_hpt_reg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pciide_hpt_reg.h,v 1.2 2001/08/03 22:03:44 chris Exp $ */
+/* $OpenBSD: pciide_hpt_reg.h,v 1.3 2002/07/06 14:35:47 gluk Exp $ */
/* $NetBSD: pciide_hpt_reg.h,v 1.4 2001/07/23 14:55:27 bouyer Exp $ */
/*
@@ -34,20 +34,22 @@
/*
- * Register definitions for the Highpoint HPT366 UDMA/66 * and HPT370 UDMA/100
- * PCI IDE controller.
+ * Register definitions for Highpoint PCI IDE controllers.
*
* The HPT366 has 2 PCI IDE functions, each of them has only one channel.
- * The HPT370 has the 2 channels on the same PCI IDE function.
+ * The HPT370 and HPT372 has the 2 channels on the same PCI IDE function.
*/
/*
- * The HPT366 and HPT370 have the save vendor/device ID but not the
- * same revision
+ * The HPT366, HPT370 and HPT372 have the save vendor/device ID but not the
+ * same revision.
*/
#define HPT366_REV 0x01
#define HPT370_REV 0x03
#define HPT370A_REV 0x04
+#define HPT372_REV 0x05
+#define HPT372A_REV 0x01
+#define HPT374_REV 0x07
#define HPT_IDETIM(chan, drive) (0x40 + ((drive) * 4) + ((chan) * 8))
#define HPT_IDETIM_BUFEN 0x80000000
@@ -115,6 +117,15 @@
#define HPT_CSEL_PCIWR 0x04 /* 370 only */
#define HPT_CSEL_CBLID(chan) (0x01 << (1 - (chan)))
+#define HPT_SC2 0x5b
+#define HPT_SC2_OSC_OK 0x80
+#define HPT_SC2_OSC_EN 0x20
+#define HPT_SC2_ECLK 0x10
+#define HPT_SC2_BPIO 0x08
+#define HPT_SC2_DMARQW 0x04
+#define HPT_SC2_SCLK 0x02
+#define HPT_SC2_MAEN 0x01
+
static u_int32_t hpt366_pio[] =
{0x00d0a7aa, 0x00c8a753, 0x00c8a742, 0x00c8a731};
static u_int32_t hpt366_dma[] =
@@ -129,3 +140,11 @@ static u_int32_t hpt370_dma[] =
static u_int32_t hpt370_udma[] =
{0x16514e31, 0x164d4e31, 0x16494e31, 0x166d4e31, 0x16454e31,
0x1a85f442};
+
+static u_int32_t hpt374_pio[] =
+ {0x0ac1f48a, 0x0ac1f465, 0x0a81f454, 0x0a81f443, 0x0a81f442};
+static u_int32_t hpt374_dma[] =
+ {0x228082ea, 0x22808254, 0x22808242};
+static u_int32_t hpt374_udma[] =
+ {0x121882ea, 0x12148254, 0x120c8242, 0x128c8242, 0x12ac8242,
+ 0x12848242, 0x12808242};