[PATCH] ahci: Ensure that we don't grab both functions

When we force the chip into dual fn mode so we get PATA and AHCI we must
be sure we don't then do anything dumb like try and grab both with the AHCI
driver.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>

authored by root and committed by Jeff Garzik 9545b578 5afc8142

+11 -4
+11 -4
drivers/scsi/ahci.c
··· 1323 if (!printed_version++) 1324 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); 1325 1326 rc = pci_enable_device(pdev); 1327 if (rc) 1328 return rc; ··· 1388 1389 if (have_msi) 1390 hpriv->flags |= AHCI_FLAG_MSI; 1391 - 1392 - /* JMicron-specific fixup: make sure we're in AHCI mode */ 1393 - if (pdev->vendor == 0x197b) 1394 - pci_write_config_byte(pdev, 0x41, 0xa1); 1395 1396 /* initialize adapter */ 1397 rc = ahci_host_init(probe_ent);
··· 1323 if (!printed_version++) 1324 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); 1325 1326 + /* JMicron-specific fixup: make sure we're in AHCI mode */ 1327 + /* This is protected from races with ata_jmicron by the pci probe 1328 + locking */ 1329 + if (pdev->vendor == PCI_VENDOR_ID_JMICRON) { 1330 + /* AHCI enable, AHCI on function 0 */ 1331 + pci_write_config_byte(pdev, 0x41, 0xa1); 1332 + /* Function 1 is the PATA controller */ 1333 + if (PCI_FUNC(pdev->devfn)) 1334 + return -ENODEV; 1335 + } 1336 + 1337 rc = pci_enable_device(pdev); 1338 if (rc) 1339 return rc; ··· 1377 1378 if (have_msi) 1379 hpriv->flags |= AHCI_FLAG_MSI; 1380 1381 /* initialize adapter */ 1382 rc = ahci_host_init(probe_ent);