ahci: don't attach if ICH6 is in combined mode

ICH6 R/Ms share PCI ID between piix and ahci modes and we've been
allowing ahci to attach regardless of how BIOS configured it.
However, enabling AHCI mode when the controller is in combined mode
can result in unexpected behavior. Don't attach if the controller is
in combined mode.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Bill Nottingham <notting@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>

authored by Tejun Heo and committed by Jeff Garzik c4f7792c d1aa690a

+18
+18
drivers/ata/ahci.c
··· 193 193 ATA_FLAG_ACPI_SATA | ATA_FLAG_AN | 194 194 ATA_FLAG_IPM, 195 195 AHCI_LFLAG_COMMON = ATA_LFLAG_SKIP_D2H_BSY, 196 + 197 + ICH_MAP = 0x90, /* ICH MAP register */ 196 198 }; 197 199 198 200 struct ahci_cmd_hdr { ··· 2274 2272 pcim_pin_device(pdev); 2275 2273 if (rc) 2276 2274 return rc; 2275 + 2276 + if (pdev->vendor == PCI_VENDOR_ID_INTEL && 2277 + (pdev->device == 0x2652 || pdev->device == 0x2653)) { 2278 + u8 map; 2279 + 2280 + /* ICH6s share the same PCI ID for both piix and ahci 2281 + * modes. Enabling ahci mode while MAP indicates 2282 + * combined mode is a bad idea. Yield to ata_piix. 2283 + */ 2284 + pci_read_config_byte(pdev, ICH_MAP, &map); 2285 + if (map & 0x3) { 2286 + dev_printk(KERN_INFO, &pdev->dev, "controller is in " 2287 + "combined mode, can't enable AHCI mode\n"); 2288 + return -ENODEV; 2289 + } 2290 + } 2277 2291 2278 2292 hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); 2279 2293 if (!hpriv)