Greg Lehey wrote:

> On Saturday,  1 December 2001 at 13:05:53 +0100, Søren Schmidt wrote:
> 
>>It seems Zwane Mwaikambo wrote:
>>
>>>Hi,
>>>     I've got a box which boots up with UDMA33 but during the boot
>>>sequence gets write problems and ends up disabling it and i presume
>>>falling back to PIO4. I've tested the same box on Linux 2.4.2+ and have
>>>had no problems running it at UDMA33.
>>>
>>>Host: SiS 5591 (revision?)
>>>Disk: Seagate 3.2G ATA2
>>>
>>Ohhh, I need alot more info before I can tell whats going on..
>>I need at least the dmesg from a verbosely booted system and
>>also a pciconf -l to tell what chips you have.
>>
> 
> Note that there are other chips out there which return the same PCI
> information but which appear to be capable of ATA 100.  I recently
> gave a patch to Richard Sharpe (copied) which he says was able to get
> his "SiS 5591" to run at ATA 100.  I'm still waiting for feedback from
> him before forwarding it to you.  I also have a machine with a "SiS
> 5591" which can't go beyond ATA 33.  Here are the pciconf outputs for
> each chip:
> 
> Mine (ATA 33):
> 
> atapci0@pci0:0:1:       class=0x01018a card=0x00000000 chip=0x55131039 rev=0xd0 
>hdr=0x00
> 
> Richard's (ATA 100):
>                pci0:0:1 Class=0x010180 card=0x55131039 chip=0x55131039 red=0xd0 
>hdr=0x00
> 
> Dwayne's:
> 
> atapci0@pci0:0:1:       class=0x010180 card=0x55131039 chip=0x55131039 rev=0xd0 
>hdr=0x00
> 
> I don't understand why Richard's output is missing the atapci@ at the
> beginning.  I believe he was using 4.3-RELEASE at this point; mine was
> from 4-STABLE of May this year.

Here is what pciconf gives me:

atapci0@pci0:0:1:     class=0x010180 card=0x55131039 chip=0x55131039 
rev=0xd0 hdr=0x00

Attached is the patch I am using, which is based on what Greg gave me. 
It tries UDMA5 first, and steps down ...

-- 
Richard Sharpe, [EMAIL PROTECTED], LPIC-1
www.samba.org, www.ethereal.com, SAMS Teach Yourself Samba
in 24 Hours, Special Edition, Using Samba
--- ata-dma.c.orig      Wed Oct 31 07:29:52 2001
+++ ata-dma.c   Fri Nov 30 14:38:52 2001
@@ -519,30 +519,61 @@
        break;
 
     case 0x55131039:   /* SiS 5591 */
-       if (udmamode >= 2 && pci_get_revid(parent) > 0xc1) {
-           error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
-                               ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
-           if (bootverbose)
-               ata_printf(scp, device,
-                          "%s setting UDMA2 on SiS chip\n",
-                          (error) ? "failed" : "success");
-           if (!error) {
-               pci_write_config(parent, 0x40 + (devno << 1), 0xa301, 2);
-               scp->mode[ATA_DEV(device)] = ATA_UDMA2;
-               return;
+       if (bootverbose)
+           printf ("SiS 5513/5591, udmamode %d\n", udmamode);
+       if (pci_get_revid(parent) > 0xc1) {
+           udmamode = 5;                   /* Force it to 100 */
+           if (udmamode >= 5) {            /* Claims UDMA 100 */
+               error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
+                                   ATA_UDMA5, ATA_C_F_SETXFER, ATA_WAIT_READY);
+               if (bootverbose)
+                   ata_printf(scp, device,
+                              "%s setting UDMA5 on SiS chip\n",
+                              (error) ? "failed" : "success");
+               if (!error) {
+                   pci_write_config(parent, 0x40 + (devno << 1), 0xa301, 2);
+                   scp->mode[ATA_DEV(device)] = ATA_UDMA5;
+                   return;
+               }
            }
-       }
-       if (wdmamode >=2 && apiomode >= 4) {
-           error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
-                               ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
-           if (bootverbose)
-               ata_printf(scp, device,
-                          "%s setting WDMA2 on SiS chip\n",
-                          (error) ? "failed" : "success");
-           if (!error) {
-               pci_write_config(parent, 0x40 + (devno << 1), 0x0301, 2);
-               scp->mode[ATA_DEV(device)] = ATA_WDMA2;
-               return;
+           if (udmamode >= 4) {            /* Claims UDMA 66 */
+               error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
+                                   ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY);
+               if (bootverbose)
+                   ata_printf(scp, device,
+                              "%s setting UDMA4 on SiS chip\n",
+                              (error) ? "failed" : "success");
+               if (!error) {
+                   pci_write_config(parent, 0x40 + (devno << 1), 0xa301, 2);
+                   scp->mode[ATA_DEV(device)] = ATA_UDMA4;
+                   return;
+               }
+           }
+           if (udmamode >= 2) {
+               error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
+                                   ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
+               if (bootverbose)
+                   ata_printf(scp, device,
+                              "%s setting UDMA2 on SiS chip\n",
+                              (error) ? "failed" : "success");
+               if (!error) {
+                   pci_write_config(parent, 0x40 + (devno << 1), 0xa301, 2);
+                   scp->mode[ATA_DEV(device)] = ATA_UDMA2;
+                   return;
+               }
+           }
+           if (wdmamode >=2 && apiomode >= 4) {
+               error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
+                                   ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
+               if (bootverbose)
+                   ata_printf(scp, device,
+                              "%s setting WDMA2 on SiS chip\n",
+                              (error) ? "failed" : "success");
+               if (!error) {
+                   pci_write_config(parent, 0x40 + (devno << 1), 0x0301, 2);
+                   scp->mode[ATA_DEV(device)] = ATA_WDMA2;
+                   return;
+               }
            }
        }
        /* we could set PIO mode timings, but we assume the BIOS did that */

Reply via email to