cvs commit: src/sys/dev/ata ata-pci.c

Andrey V. Elsukov bu7cher at yandex.ru
Mon Oct 29 10:38:13 PDT 2007


SЬren Schmidt wrote:
 >   Modified files:
 >     sys/dev/ata          ata-pci.c
 >   Log:
 >   Fix treating some modern chips (mem mapped) as legacy devices.

Hi, SЬren.

Seems that PCIP_STORAGE_IDE_MASTERDEV, PCIP_STORAGE_IDE_MODEPRIM and
PCIP_STORAGE_IDE_MODESEC should be related to the PCIS_STORAGE_IDE
subclass. My Marvell 88SE6141 chip have PCIS_STORAGE_SATA subclass and
PCIP_STORAGE_SATA_AHCI_1_0|PCIS_STORAGE_OTHER programming interface.
And this chip detected as a legacy controller. What you think about
the attached patch?

-- 
WBR, Andrey V. Elsukov
-------------- next part --------------
--- /usr/src/sys/dev/ata/ata-pci.c	2007-10-29 08:01:06.000000000 +0300
+++ ata-pci.c	2007-10-29 08:11:20.000000000 +0300
@@ -59,15 +59,17 @@
 int
 ata_legacy(device_t dev)
 {
-    return (((pci_read_config(dev, PCIR_PROGIF, 1)&PCIP_STORAGE_IDE_MASTERDEV)&&
-	     ((pci_read_config(dev, PCIR_PROGIF, 1) &
-	       (PCIP_STORAGE_IDE_MODEPRIM | PCIP_STORAGE_IDE_MODESEC)) !=
+    uint32_t pi, scc;
+    pi = pci_read_config(dev, PCIR_PROGIF, 1);
+    scc = pci_read_config(dev, PCIR_SUBCLASS, 1);
+    return ((scc == PCIS_STORAGE_IDE && (pi & PCIP_STORAGE_IDE_MASTERDEV) &&
+	    ((pi & (PCIP_STORAGE_IDE_MODEPRIM | PCIP_STORAGE_IDE_MODESEC)) !=
 	      (PCIP_STORAGE_IDE_MODEPRIM | PCIP_STORAGE_IDE_MODESEC))) ||
-	    (!pci_read_config(dev, PCIR_BAR(0), 4) &&
-	     !pci_read_config(dev, PCIR_BAR(1), 4) &&
-	     !pci_read_config(dev, PCIR_BAR(2), 4) &&
-	     !pci_read_config(dev, PCIR_BAR(3), 4) &&
-	     !pci_read_config(dev, PCIR_BAR(5), 4)));
+	    (pci_read_config(dev, PCIR_BAR(0), 4) == 0 &&
+	     pci_read_config(dev, PCIR_BAR(1), 4) == 0 &&
+	     pci_read_config(dev, PCIR_BAR(2), 4) == 0 &&
+	     pci_read_config(dev, PCIR_BAR(3), 4) == 0 &&
+	     pci_read_config(dev, PCIR_BAR(5), 4) == 0));
 }
 
 int


More information about the cvs-src mailing list