From 4b4f97ae4c699f17842be298f838a8f33c83c212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Schmidt?= Date: Wed, 8 Jan 2003 16:51:41 +0000 Subject: [PATCH] Add support for the nVidia nForce2 ATA part. Fix support for the nForce1 as well, registers are offset 0x10 against the AMD/VIA parts. --- sys/dev/ata/ata-dma.c | 32 ++++++++++++++++++++++---------- sys/dev/ata/ata-pci.c | 5 ++++- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/sys/dev/ata/ata-dma.c b/sys/dev/ata/ata-dma.c index 5aa91ed8e817..e7970b7ba9b3 100644 --- a/sys/dev/ata/ata-dma.c +++ b/sys/dev/ata/ata-dma.c @@ -502,6 +502,7 @@ ata_dmainit(struct ata_device *atadev, int apiomode, int wdmamode, int udmamode) break; case 0x01bc10de: /* nVIDIA nForce */ + case 0x006510de: /* nVIDIA nForce2 */ case 0x74411022: /* AMD 768 */ case 0x74111022: /* AMD 766 */ case 0x74091022: /* AMD 756 */ @@ -512,7 +513,8 @@ ata_dmainit(struct ata_device *atadev, int apiomode, int wdmamode, int udmamode) { 0x00, 0x00, 0xea, 0x00, 0xe8, 0x00, 0x00 }, /* VIA ATA66 */ { 0x00, 0x00, 0xf4, 0x00, 0xf1, 0xf0, 0x00 }, /* VIA ATA100 */ { 0x00, 0x00, 0xf6, 0x00, 0xf2, 0xf1, 0xf0 }, /* VIA ATA133 */ - { 0x00, 0x00, 0xc0, 0x00, 0xc5, 0xc6, 0x00 }}; /* AMD/nVIDIA */ + { 0x00, 0x00, 0xc0, 0x00, 0xc5, 0xc6, 0xc7 }}; /* AMD/nVIDIA */ + int reg = 0x53 - devno; int *reg_val = NULL; char *chip = "VIA"; @@ -553,14 +555,24 @@ ata_dmainit(struct ata_device *atadev, int apiomode, int wdmamode, int udmamode) reg_val = via_modes[4]; chip = "AMD"; } - else if (chiptype == 0x01bc10de) { /* nVIDIA */ - udmamode = imin(udmamode, 5); + else if (chiptype == 0x006510de) { /* nForce2 */ + udmamode = imin(udmamode, 6); + reg += 0x10; reg_val = via_modes[4]; - chip = "nVIDIA"; + chip = "nVidia"; + } + else if (chiptype == 0x01bc10de) { /* nForce */ + udmamode = imin(udmamode, 5); + reg += 0x10; + reg_val = via_modes[4]; + chip = "nVidia"; } else udmamode = 0; + if (udmamode || wdmamode) + pci_write_config(parent, reg - 0x08, 0x20, 1); + if (udmamode >= 6) { error = ata_command(atadev, ATA_C_SETFEATURES, 0, ATA_UDMA6, ATA_C_F_SETXFER, ATA_WAIT_READY); @@ -568,7 +580,7 @@ ata_dmainit(struct ata_device *atadev, int apiomode, int wdmamode, int udmamode) ata_prtdev(atadev, "%s setting UDMA6 on %s chip\n", (error) ? "failed" : "success", chip); if (!error) { - pci_write_config(parent, 0x53 - devno, reg_val[6], 1); + pci_write_config(parent, reg, reg_val[6], 1); ata_dmacreate(atadev, apiomode, ATA_UDMA6); return; } @@ -580,7 +592,7 @@ ata_dmainit(struct ata_device *atadev, int apiomode, int wdmamode, int udmamode) ata_prtdev(atadev, "%s setting UDMA5 on %s chip\n", (error) ? "failed" : "success", chip); if (!error) { - pci_write_config(parent, 0x53 - devno, reg_val[5], 1); + pci_write_config(parent, reg, reg_val[5], 1); ata_dmacreate(atadev, apiomode, ATA_UDMA5); return; } @@ -592,7 +604,7 @@ ata_dmainit(struct ata_device *atadev, int apiomode, int wdmamode, int udmamode) ata_prtdev(atadev, "%s setting UDMA4 on %s chip\n", (error) ? "failed" : "success", chip); if (!error) { - pci_write_config(parent, 0x53 - devno, reg_val[4], 1); + pci_write_config(parent, reg, reg_val[4], 1); ata_dmacreate(atadev, apiomode, ATA_UDMA4); return; } @@ -604,7 +616,7 @@ ata_dmainit(struct ata_device *atadev, int apiomode, int wdmamode, int udmamode) ata_prtdev(atadev, "%s setting UDMA2 on %s chip\n", (error) ? "failed" : "success", chip); if (!error) { - pci_write_config(parent, 0x53 - devno, reg_val[2], 1); + pci_write_config(parent, reg, reg_val[2], 1); ata_dmacreate(atadev, apiomode, ATA_UDMA2); return; } @@ -616,8 +628,8 @@ ata_dmainit(struct ata_device *atadev, int apiomode, int wdmamode, int udmamode) ata_prtdev(atadev, "%s setting WDMA2 on %s chip\n", (error) ? "failed" : "success", chip); if (!error) { - pci_write_config(parent, 0x53 - devno, 0x0b, 1); - pci_write_config(parent, 0x4b - devno, 0x31, 1); + pci_write_config(parent, reg, 0x0b, 1); + pci_write_config(parent, reg - 0x08, 0x31, 1); ata_dmacreate(atadev, apiomode, ATA_WDMA2); return; } diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c index 9ebcd1be48e4..ca545fa8f860 100644 --- a/sys/dev/ata/ata-pci.c +++ b/sys/dev/ata/ata-pci.c @@ -234,7 +234,10 @@ ata_pci_match(device_t dev) return "AMD 768 ATA100 controller"; case 0x01bc10de: - return "nVIDIA nForce ATA100 controller"; + return "nVidia nForce ATA100 controller"; + + case 0x006510de: + return "nVidia nForce ATA133 controller"; case 0x02111166: return "ServerWorks ROSB4 ATA33 controller";