diff --git a/sys/dev/ata/ata-dma.c b/sys/dev/ata/ata-dma.c index c587010dd429..8db7a7be45fe 100644 --- a/sys/dev/ata/ata-dma.c +++ b/sys/dev/ata/ata-dma.c @@ -927,9 +927,12 @@ ata_dmainit(struct ata_channel *ch, int device, return; case 0x00041103: /* HighPoint HPT366/368/370/372 controllers */ + case 0x00051103: /* HighPoint HPT372 controllers */ case 0x00081103: /* HighPoint HPT374 controllers */ - if (!ATAPI_DEVICE(ch, device) && - udmamode >= 6 && pci_get_revid(parent) >= 0x05 && + if (!ATAPI_DEVICE(ch, device) && udmamode >= 6 && + ((ch->chiptype == 0x00041103 && pci_get_revid(parent) >= 0x05) || + (ch->chiptype == 0x00051103 && pci_get_revid(parent) >= 0x01) || + (ch->chiptype == 0x00081103 && pci_get_revid(parent) >= 0x07)) && !(pci_read_config(parent, 0x5a, 1) & (ch->unit ? 0x01:0x02))) { error = ata_command(atadev, ATA_C_SETFEATURES, 0, ATA_UDMA6, ATA_C_F_SETXFER, ATA_WAIT_READY); @@ -942,8 +945,10 @@ ata_dmainit(struct ata_channel *ch, int device, return; } } - if (!ATAPI_DEVICE(ch, device) && - udmamode >= 5 && pci_get_revid(parent) >= 0x03 && + if (!ATAPI_DEVICE(ch, device) && udmamode >= 5 && + ((ch->chiptype == 0x00041103 && pci_get_revid(parent) >= 0x05) || + (ch->chiptype == 0x00051103 && pci_get_revid(parent) >= 0x01) || + (ch->chiptype == 0x00081103 && pci_get_revid(parent) >= 0x07)) && !(pci_read_config(parent, 0x5a, 1) & (ch->unit ? 0x01:0x02))) { error = ata_command(atadev, ATA_C_SETFEATURES, 0, ATA_UDMA5, ATA_C_F_SETXFER, ATA_WAIT_READY); @@ -1213,8 +1218,8 @@ hpt_timing(struct ata_channel *ch, int devno, int mode) { device_t parent = device_get_parent(ch->dev); u_int32_t timing; - if (pci_get_revid(parent) >= 0x07) { /* HPT374 */ - switch (mode) { + if (ch->chiptype == 0x00081103 && pci_get_revid(parent) >= 0x07) { + switch (mode) { /* HPT374 */ case ATA_PIO0: timing = 0x0ac1f48a; break; case ATA_PIO1: timing = 0x0ac1f465; break; case ATA_PIO2: timing = 0x0a81f454; break; @@ -1231,8 +1236,9 @@ hpt_timing(struct ata_channel *ch, int devno, int mode) pci_write_config(parent, 0x5b, (pci_read_config(parent, 0x5b, 1) & 0x01) | 0x20, 1); } - else if (pci_get_revid(parent) >= 0x05) { /* HPT372 */ - switch (mode) { + else if ((ch->chiptype == 0x00041103 && pci_get_revid(parent) >= 0x05) || + (ch->chiptype == 0x00051103 && pci_get_revid(parent) >= 0x01)) { + switch (mode) { /* HPT372 */ case ATA_PIO0: timing = 0x0d029d5e; break; case ATA_PIO1: timing = 0x0d029d26; break; case ATA_PIO2: timing = 0x0c829ca6; break; @@ -1246,10 +1252,11 @@ hpt_timing(struct ata_channel *ch, int devno, int mode) default: timing = 0x0d029d5e; } pci_write_config(parent, 0x40 + (devno << 2) , timing, 4); - pci_write_config(parent, 0x5b, 0x20, 1); + pci_write_config(parent, 0x5b, + (pci_read_config(parent, 0x5b, 1) & 0x01) | 0x20, 1); } - else if (pci_get_revid(parent) >= 0x03) { /* HPT370 */ - switch (mode) { + else if (ch->chiptype == 0x00041103 && pci_get_revid(parent) >= 0x03) { + switch (mode) { /* HPT370 */ case ATA_PIO0: timing = 0x06914e57; break; case ATA_PIO1: timing = 0x06914e43; break; case ATA_PIO2: timing = 0x06514e33; break; @@ -1264,7 +1271,7 @@ hpt_timing(struct ata_channel *ch, int devno, int mode) pci_write_config(parent, 0x40 + (devno << 2) , timing, 4); pci_write_config(parent, 0x5b, 0x22, 1); } - else { /* HPT36[68] */ + else { /* HPT36[68] */ switch (pci_read_config(parent, 0x41 + (devno << 2), 1)) { case 0x85: /* 25Mhz */ switch (mode) { diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c index dd1f15ba70a1..00fcb07b0a86 100644 --- a/sys/dev/ata/ata-pci.c +++ b/sys/dev/ata/ata-pci.c @@ -276,6 +276,13 @@ ata_pci_match(device_t dev) } return NULL; + case 0x00051103: + switch (pci_get_revid(dev)) { + case 0x01: + return "HighPoint HPT372 ATA133 controller"; + } + return NULL; + case 0x00081103: switch (pci_get_revid(dev)) { case 0x07: @@ -385,30 +392,23 @@ ata_pci_attach(device_t dev) ATA_OUTB(controller->bmio, 0x1f, ATA_INB(controller->bmio, 0x1f)|0x01); break; - case 0x00041103: /* HighPoint HPT 366/368/370/372 */ - case 0x00081103: /* HighPoint HPT 374 */ - switch (pci_get_revid(dev)) { - case 0x00: /* HPT 366 */ - case 0x01: + case 0x00041103: /* HighPoint HPT366/368/370/372 */ + if (pci_get_revid(dev) < 2) { /* HPT 366 */ /* turn off interrupt prediction */ pci_write_config(dev, 0x51, (pci_read_config(dev, 0x51, 1) & ~0x80), 1); break; - - case 0x02: /* HPT 368 */ - case 0x03: /* HPT 370 */ - case 0x04: - case 0x05: /* HPT 372 */ - case 0x07: /* HPT 374 */ - /* turn off interrupt prediction */ - pci_write_config(dev, 0x51, - (pci_read_config(dev, 0x51, 1) & ~0x03), 1); - pci_write_config(dev, 0x55, - (pci_read_config(dev, 0x55, 1) & ~0x03), 1); - /* turn on interrupts */ - pci_write_config(dev, 0x5a, - (pci_read_config(dev, 0x5a, 1) & ~0x10), 1); } + /* FALLTHROUGH */ + + case 0x00051103: /* HighPoint HPT372 */ + case 0x00081103: /* HighPoint HPT374 */ + /* turn off interrupt prediction */ + pci_write_config(dev, 0x51, (pci_read_config(dev, 0x51, 1) & ~0x03), 1); + pci_write_config(dev, 0x55, (pci_read_config(dev, 0x55, 1) & ~0x03), 1); + + /* turn on interrupts */ + pci_write_config(dev, 0x5a, (pci_read_config(dev, 0x5a, 1) & ~0x10), 1); break; case 0x05711106: /* VIA 82C586, '596, '686 default setup */ @@ -490,6 +490,7 @@ ata_pci_intr(struct ata_channel *ch) */ switch (ch->chiptype) { case 0x00041103: /* HighPoint HPT366/368/370/372 */ + case 0x00051103: /* HighPoint HPT372 */ case 0x00081103: /* HighPoint HPT374 */ if (((dmastat = ata_dmastatus(ch)) & (ATA_BMSTAT_ACTIVE | ATA_BMSTAT_INTERRUPT)) != ATA_BMSTAT_INTERRUPT) diff --git a/sys/dev/ata/ata-raid.c b/sys/dev/ata/ata-raid.c index bb6781cdb4fd..6f5de66620fd 100644 --- a/sys/dev/ata/ata-raid.c +++ b/sys/dev/ata/ata-raid.c @@ -106,6 +106,7 @@ ata_raid_probe(struct ad_softc *adp) { return (ar_promise_read_conf(adp, ar_table)); case 0x00041103: + case 0x00051103: case 0x00081103: return (ar_highpoint_read_conf(adp, ar_table)); }