5.2 ata driver doesn't detect VIA 8237 IDE controller

From: Mikael Hubsch <nisse_at_hubsch.org>
Date: Fri, 2 Jan 2004 22:43:40 +0100 (CET)
Bought a new Athlon motherboard with a KT400A + VT8237 chipset.
A RELENG_5_2 built at Dec 29, says that atapci0 is a
"GENERIC ATA controller" that only handles UDMA33.
boot -v output can be found at http://hubsch.org/freebsd/boot52_2.txt.

ata-chipset.c have code that should recognize the VT8237 but it seems that
the wrong chipid (0x3149) is used. According to the first url below, that
chipid is for the standalone SATA card VT6420. VIA have released patches
to have Linux recognize the VT8237 that uses chipid 0x3227 (url2 below).
This chipid is also found on my motherboard.

URL1:
http://pciids.sourceforge.net/iii/?i=1106
URL2:
http://downloads.viaarena.com/LinuxApplicationNotes/Sep03/VIA%20IDE%20ATA133%20Patch%208237%20ver0.8.gz

These is yet another problem to have FreeBSD recognize my IDE controller.
The code in ata-chipset.c requires that the ISA bridge have the
same slot id as the VIA IDE controler (0x0571). This is not the case on
my motherboard. As shown in the boot -v output the ide controller is
at slot 15 and the isa bridge is at slot 17.

The patch below works for me, but is not directly committable.
I had to bypass the logic in ata_find_chip() by using -99 as the slot id
(as the bridge slot id is higher than the ide controller's).
I don't know the original reason to have the slot id tests in there ...

Index: ata-chipset.c
===================================================================
RCS file: /d2/FreeBSD-cvs/src/sys/dev/ata/ata-chipset.c,v
retrieving revision 1.48.2.1
diff -u -r1.48.2.1 ata-chipset.c
--- ata-chipset.c	18 Dec 2003 21:39:38 -0000	1.48.2.1
+++ ata-chipset.c	2 Jan 2004 21:36:17 -0000
_at__at_ -2124,12 +2124,12 _at__at_
      { ATA_VIA8237,   0x00, VIA133, 0x00,   ATA_UDMA6, "VIA 8237" },
      { 0, 0, 0, 0, 0, 0 }};
     static struct ata_chip_id new_ids[] =
-    {{ ATA_VIA8237,   0x00, 0x00,   0x00,   ATA_SA150, "VIA 8237" },
+    {{ ATA_VIA6420,   0x00, 0x00,   0x00,   ATA_SA150, "VIA 6420" },
      { 0, 0, 0, 0, 0, 0 }};
     char buffer[64];

     if (pci_get_devid(dev) == ATA_VIA82C571) {
-	if (!(idx = ata_find_chip(dev, ids, pci_get_slot(dev))))
+	if (!(idx = ata_find_chip(dev, ids, -99)))
 	    return ENXIO;
     }
     else {
Index: ata-pci.h
===================================================================
RCS file: /d2/FreeBSD-cvs/src/sys/dev/ata/ata-pci.h,v
retrieving revision 1.19.2.1
diff -u -r1.19.2.1 ata-pci.h
--- ata-pci.h	18 Dec 2003 21:39:38 -0000	1.19.2.1
+++ ata-pci.h	2 Jan 2004 21:36:17 -0000
_at__at_ -211,6 +211,7 _at__at_
 #define ATA_SIS964_1		0x01801039

 #define ATA_VIA_ID		0x1106
+#define ATA_VIA6420		0x31491106
 #define ATA_VIA82C571		0x05711106
 #define ATA_VIA82C586		0x05861106
 #define ATA_VIA82C596		0x05961106
_at__at_ -220,7 +221,7 _at__at_
 #define ATA_VIA8233A		0x31471106
 #define ATA_VIA8233C		0x31091106
 #define ATA_VIA8235		0x31771106
-#define ATA_VIA8237		0x31491106
+#define ATA_VIA8237		0x32271106
 #define ATA_VIA8361		0x31121106
 #define ATA_VIA8363		0x03051106
 #define ATA_VIA8371		0x03911106

--
 Mikael Hubsch
Received on Fri Jan 02 2004 - 12:43:57 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:36 UTC