Re: SiS5591(?) ATA

From: Søren Schmidt <sos_at_DeepCore.dk>
Date: Tue, 16 Mar 2004 11:42:55 +0100
FUJITA Kazutoshi wrote:
> From: Søren Schmidt <sos_at_DeepCore.dk>
> Subject: Re: SiS5591(?) ATA
> Date: Tue, 16 Mar 2004 09:21:51 +0100
> Message-ID: <4056B91F.8090505_at_DeepCore.dk>
> 
>>I need a *complete* dmesg and the *complete* output of pciconf -l to 
>>tell what is wrong. 
> ok, attach them.

OK, I see the problem, please try the attached patch and let me know if 
that solves the problem...

-- 
-Søren


Index: ata-chipset.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-chipset.c,v
retrieving revision 1.65
diff -u -r1.65 ata-chipset.c
--- ata-chipset.c	15 Mar 2004 12:03:47 -0000	1.65
+++ ata-chipset.c	16 Mar 2004 10:41:10 -0000
_at__at_ -1655,8 +1655,10 _at__at_
 	    ctlr->channels = 4;
 
 	ctlr->allocate = ata_sii_mio_allocate;
-	if (ctlr->chip->max_dma >= ATA_SA150)
+	if (ctlr->chip->max_dma >= ATA_SA150) {
+	    ctlr->locking = ata_serialize;
 	    ctlr->setmode = ata_sata_setmode;
+	}
 	else
 	    ctlr->setmode = ata_sii_setmode;
     }
_at__at_ -1953,26 +1955,36 _at__at_
      { ATA_SIS530,  0x00, SIS66,     0, ATA_UDMA4, "SiS 530" },
 
      { ATA_SIS5513, 0xc2, SIS33,     0, ATA_UDMA2, "SiS 5513" },
-     { ATA_SIS5513, 0x00, SIS33,     1, ATA_WDMA2, "SiS 5513" },
+     { ATA_SIS5513, 0x00, SIS33,     0, ATA_WDMA2, "SiS 5513" },
      { 0, 0, 0, 0, 0, 0 }};
     char buffer[64];
+    int found = 0;
 
     if (!(idx = ata_find_chip(dev, ids, -pci_get_slot(dev)))) 
 	return ENXIO;
 
-    if (idx->cfg2) {
-	pci_write_config(dev, 0x57, pci_read_config(dev, 0x57, 1) & 0x7f, 1);
-	if (pci_read_config(dev, 0x00, 4) == ATA_SIS5518) {
+    if (!found) {
+	u_int8_t reg57 = pci_read_config(dev, 0x57, 1);
+
+	pci_write_config(dev, 0x57, (reg57 & 0x7f), 1);
+	if (pci_read_config(dev, PCIR_DEVVENDOR, 4) == ATA_SIS5518) {
+	    found = 1;
 	    idx->cfg1 = SIS133NEW;
 	    idx->max_dma = ATA_UDMA6;
 	    sprintf(buffer, "SiS 962/963 %s controller",
 		    ata_mode2str(idx->max_dma));
 	}
-	else {
+	pci_write_config(dev, 0x57, reg57, 1);
+    }
+    if (!found) {
+	u_int8_t reg4a = pci_read_config(dev, 0x4a, 1);
+
+	pci_write_config(dev, 0x4a, (reg4a | 0x10), 1);
+	if (pci_read_config(dev, PCIR_DEVVENDOR, 4) == ATA_SIS5517) {
 	    struct ata_chip_id id[] =
-		{{ ATA_SISSOUTH, 0x10, 0, 0, ATA_UDMA6, "SiS 961" },
-		 { 0, 0, 0, 0, 0, 0 }};
+		{{ ATA_SISSOUTH, 0x10, 0, 0, 0, "" }, { 0, 0, 0, 0, 0, 0 }};
 
+	    found = 1;
 	    if (ata_find_chip(dev, id, pci_get_slot(dev))) {
 		idx->cfg1 = SIS133OLD;
 		idx->max_dma = ATA_UDMA6;
_at__at_ -1983,10 +1995,11 _at__at_
 	    }
 	    sprintf(buffer, "SiS 961 %s controller",ata_mode2str(idx->max_dma));
 	}
-	pci_write_config(dev, 0x57, pci_read_config(dev, 0x57, 1) | 0x80, 1);
+	pci_write_config(dev, 0x4a, reg4a, 1);
     }
-    else
+    if (!found)
 	sprintf(buffer,"%s %s controller",idx->text,ata_mode2str(idx->max_dma));
+
     device_set_desc_copy(dev, buffer);
     ctlr->chip = idx;
     ctlr->chipinit = ata_sis_chipinit;
Index: ata-pci.h
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-pci.h,v
retrieving revision 1.27
diff -u -r1.27 ata-pci.h
--- ata-pci.h	15 Mar 2004 12:03:47 -0000	1.27
+++ ata-pci.h	16 Mar 2004 10:39:58 -0000
_at__at_ -176,6 +176,7 _at__at_
 #define ATA_SISSOUTH		0x00081039
 #define ATA_SIS5511		0x55111039
 #define ATA_SIS5513		0x55131039
+#define ATA_SIS5517		0x55171039
 #define ATA_SIS5518		0x55181039
 #define ATA_SIS5571		0x55711039
 #define ATA_SIS5591		0x55911039
Received on Tue Mar 16 2004 - 01:43:18 UTC

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