diff options
-rw-r--r-- | drivers/ata/ata_piix.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index ea2c7649d399..a9027b8fbdd5 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -1348,6 +1348,8 @@ static void __devinit piix_init_sidpr(struct ata_host *host) | |||
1348 | { | 1348 | { |
1349 | struct pci_dev *pdev = to_pci_dev(host->dev); | 1349 | struct pci_dev *pdev = to_pci_dev(host->dev); |
1350 | struct piix_host_priv *hpriv = host->private_data; | 1350 | struct piix_host_priv *hpriv = host->private_data; |
1351 | struct ata_device *dev0 = &host->ports[0]->link.device[0]; | ||
1352 | u32 scontrol; | ||
1351 | int i; | 1353 | int i; |
1352 | 1354 | ||
1353 | /* check for availability */ | 1355 | /* check for availability */ |
@@ -1366,6 +1368,29 @@ static void __devinit piix_init_sidpr(struct ata_host *host) | |||
1366 | return; | 1368 | return; |
1367 | 1369 | ||
1368 | hpriv->sidpr = pcim_iomap_table(pdev)[PIIX_SIDPR_BAR]; | 1370 | hpriv->sidpr = pcim_iomap_table(pdev)[PIIX_SIDPR_BAR]; |
1371 | |||
1372 | /* SCR access via SIDPR doesn't work on some configurations. | ||
1373 | * Give it a test drive by inhibiting power save modes which | ||
1374 | * we'll do anyway. | ||
1375 | */ | ||
1376 | scontrol = piix_sidpr_read(dev0, SCR_CONTROL); | ||
1377 | |||
1378 | /* if IPM is already 3, SCR access is probably working. Don't | ||
1379 | * un-inhibit power save modes as BIOS might have inhibited | ||
1380 | * them for a reason. | ||
1381 | */ | ||
1382 | if ((scontrol & 0xf00) != 0x300) { | ||
1383 | scontrol |= 0x300; | ||
1384 | piix_sidpr_write(dev0, SCR_CONTROL, scontrol); | ||
1385 | scontrol = piix_sidpr_read(dev0, SCR_CONTROL); | ||
1386 | |||
1387 | if ((scontrol & 0xf00) != 0x300) { | ||
1388 | dev_printk(KERN_INFO, host->dev, "SCR access via " | ||
1389 | "SIDPR is available but doesn't work\n"); | ||
1390 | return; | ||
1391 | } | ||
1392 | } | ||
1393 | |||
1369 | host->ports[0]->ops = &piix_sidpr_sata_ops; | 1394 | host->ports[0]->ops = &piix_sidpr_sata_ops; |
1370 | host->ports[1]->ops = &piix_sidpr_sata_ops; | 1395 | host->ports[1]->ops = &piix_sidpr_sata_ops; |
1371 | } | 1396 | } |