diff options
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/ahci.c | 13 | ||||
-rw-r--r-- | drivers/ata/ata_piix.c | 51 | ||||
-rw-r--r-- | drivers/ata/libata-acpi.c | 6 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 32 | ||||
-rw-r--r-- | drivers/ata/libata-sff.c | 216 | ||||
-rw-r--r-- | drivers/ata/pata_acpi.c | 6 | ||||
-rw-r--r-- | drivers/ata/pata_ali.c | 107 | ||||
-rw-r--r-- | drivers/ata/pata_amd.c | 4 | ||||
-rw-r--r-- | drivers/ata/pata_hpt366.c | 109 | ||||
-rw-r--r-- | drivers/ata/pata_hpt3x3.c | 49 | ||||
-rw-r--r-- | drivers/ata/pata_it821x.c | 17 | ||||
-rw-r--r-- | drivers/ata/pata_mpiix.c | 3 | ||||
-rw-r--r-- | drivers/ata/pata_platform.c | 2 | ||||
-rw-r--r-- | drivers/ata/pata_sil680.c | 4 | ||||
-rw-r--r-- | drivers/ata/sata_sil24.c | 7 |
15 files changed, 385 insertions, 241 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 656448c7fef9..96039671e3b9 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -105,7 +105,7 @@ enum { | |||
105 | board_ahci_ign_iferr = 2, | 105 | board_ahci_ign_iferr = 2, |
106 | board_ahci_sb600 = 3, | 106 | board_ahci_sb600 = 3, |
107 | board_ahci_mv = 4, | 107 | board_ahci_mv = 4, |
108 | board_ahci_sb700 = 5, | 108 | board_ahci_sb700 = 5, /* for SB700 and SB800 */ |
109 | board_ahci_mcp65 = 6, | 109 | board_ahci_mcp65 = 6, |
110 | board_ahci_nopmp = 7, | 110 | board_ahci_nopmp = 7, |
111 | 111 | ||
@@ -439,7 +439,7 @@ static const struct ata_port_info ahci_port_info[] = { | |||
439 | .udma_mask = ATA_UDMA6, | 439 | .udma_mask = ATA_UDMA6, |
440 | .port_ops = &ahci_ops, | 440 | .port_ops = &ahci_ops, |
441 | }, | 441 | }, |
442 | /* board_ahci_sb700 */ | 442 | /* board_ahci_sb700, for SB700 and SB800 */ |
443 | { | 443 | { |
444 | AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL), | 444 | AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL), |
445 | .flags = AHCI_FLAG_COMMON, | 445 | .flags = AHCI_FLAG_COMMON, |
@@ -2446,6 +2446,8 @@ static void ahci_print_info(struct ata_host *host) | |||
2446 | speed_s = "1.5"; | 2446 | speed_s = "1.5"; |
2447 | else if (speed == 2) | 2447 | else if (speed == 2) |
2448 | speed_s = "3"; | 2448 | speed_s = "3"; |
2449 | else if (speed == 3) | ||
2450 | speed_s = "6"; | ||
2449 | else | 2451 | else |
2450 | speed_s = "?"; | 2452 | speed_s = "?"; |
2451 | 2453 | ||
@@ -2610,6 +2612,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2610 | (pdev->revision == 0xa1 || pdev->revision == 0xa2)) | 2612 | (pdev->revision == 0xa1 || pdev->revision == 0xa2)) |
2611 | hpriv->flags |= AHCI_HFLAG_NO_MSI; | 2613 | hpriv->flags |= AHCI_HFLAG_NO_MSI; |
2612 | 2614 | ||
2615 | /* SB800 does NOT need the workaround to ignore SERR_INTERNAL */ | ||
2616 | if (board_id == board_ahci_sb700 && pdev->revision >= 0x40) | ||
2617 | hpriv->flags &= ~AHCI_HFLAG_IGN_SERR_INTERNAL; | ||
2618 | |||
2613 | if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev)) | 2619 | if ((hpriv->flags & AHCI_HFLAG_NO_MSI) || pci_enable_msi(pdev)) |
2614 | pci_intx(pdev, 1); | 2620 | pci_intx(pdev, 1); |
2615 | 2621 | ||
@@ -2654,6 +2660,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2654 | host->iomap = pcim_iomap_table(pdev); | 2660 | host->iomap = pcim_iomap_table(pdev); |
2655 | host->private_data = hpriv; | 2661 | host->private_data = hpriv; |
2656 | 2662 | ||
2663 | if (!(hpriv->cap & HOST_CAP_SSS)) | ||
2664 | host->flags |= ATA_HOST_PARALLEL_SCAN; | ||
2665 | |||
2657 | if (pi.flags & ATA_FLAG_EM) | 2666 | if (pi.flags & ATA_FLAG_EM) |
2658 | ahci_reset_em(host); | 2667 | ahci_reset_em(host); |
2659 | 2668 | ||
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 5fdf1678d0cc..887d8f46a287 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -154,11 +154,13 @@ struct piix_map_db { | |||
154 | 154 | ||
155 | struct piix_host_priv { | 155 | struct piix_host_priv { |
156 | const int *map; | 156 | const int *map; |
157 | u32 saved_iocfg; | ||
157 | void __iomem *sidpr; | 158 | void __iomem *sidpr; |
158 | }; | 159 | }; |
159 | 160 | ||
160 | static int piix_init_one(struct pci_dev *pdev, | 161 | static int piix_init_one(struct pci_dev *pdev, |
161 | const struct pci_device_id *ent); | 162 | const struct pci_device_id *ent); |
163 | static void piix_remove_one(struct pci_dev *pdev); | ||
162 | static int piix_pata_prereset(struct ata_link *link, unsigned long deadline); | 164 | static int piix_pata_prereset(struct ata_link *link, unsigned long deadline); |
163 | static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev); | 165 | static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev); |
164 | static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev); | 166 | static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev); |
@@ -296,7 +298,7 @@ static struct pci_driver piix_pci_driver = { | |||
296 | .name = DRV_NAME, | 298 | .name = DRV_NAME, |
297 | .id_table = piix_pci_tbl, | 299 | .id_table = piix_pci_tbl, |
298 | .probe = piix_init_one, | 300 | .probe = piix_init_one, |
299 | .remove = ata_pci_remove_one, | 301 | .remove = piix_remove_one, |
300 | #ifdef CONFIG_PM | 302 | #ifdef CONFIG_PM |
301 | .suspend = piix_pci_device_suspend, | 303 | .suspend = piix_pci_device_suspend, |
302 | .resume = piix_pci_device_resume, | 304 | .resume = piix_pci_device_resume, |
@@ -308,7 +310,7 @@ static struct scsi_host_template piix_sht = { | |||
308 | }; | 310 | }; |
309 | 311 | ||
310 | static struct ata_port_operations piix_pata_ops = { | 312 | static struct ata_port_operations piix_pata_ops = { |
311 | .inherits = &ata_bmdma_port_ops, | 313 | .inherits = &ata_bmdma32_port_ops, |
312 | .cable_detect = ata_cable_40wire, | 314 | .cable_detect = ata_cable_40wire, |
313 | .set_piomode = piix_set_piomode, | 315 | .set_piomode = piix_set_piomode, |
314 | .set_dmamode = piix_set_dmamode, | 316 | .set_dmamode = piix_set_dmamode, |
@@ -610,8 +612,9 @@ static const struct ich_laptop ich_laptop[] = { | |||
610 | static int ich_pata_cable_detect(struct ata_port *ap) | 612 | static int ich_pata_cable_detect(struct ata_port *ap) |
611 | { | 613 | { |
612 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 614 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
615 | struct piix_host_priv *hpriv = ap->host->private_data; | ||
613 | const struct ich_laptop *lap = &ich_laptop[0]; | 616 | const struct ich_laptop *lap = &ich_laptop[0]; |
614 | u8 tmp, mask; | 617 | u8 mask; |
615 | 618 | ||
616 | /* Check for specials - Acer Aspire 5602WLMi */ | 619 | /* Check for specials - Acer Aspire 5602WLMi */ |
617 | while (lap->device) { | 620 | while (lap->device) { |
@@ -625,8 +628,7 @@ static int ich_pata_cable_detect(struct ata_port *ap) | |||
625 | 628 | ||
626 | /* check BIOS cable detect results */ | 629 | /* check BIOS cable detect results */ |
627 | mask = ap->port_no == 0 ? PIIX_80C_PRI : PIIX_80C_SEC; | 630 | mask = ap->port_no == 0 ? PIIX_80C_PRI : PIIX_80C_SEC; |
628 | pci_read_config_byte(pdev, PIIX_IOCFG, &tmp); | 631 | if ((hpriv->saved_iocfg & mask) == 0) |
629 | if ((tmp & mask) == 0) | ||
630 | return ATA_CBL_PATA40; | 632 | return ATA_CBL_PATA40; |
631 | return ATA_CBL_PATA80; | 633 | return ATA_CBL_PATA80; |
632 | } | 634 | } |
@@ -1350,7 +1352,7 @@ static int __devinit piix_init_sidpr(struct ata_host *host) | |||
1350 | return 0; | 1352 | return 0; |
1351 | } | 1353 | } |
1352 | 1354 | ||
1353 | static void piix_iocfg_bit18_quirk(struct pci_dev *pdev) | 1355 | static void piix_iocfg_bit18_quirk(struct ata_host *host) |
1354 | { | 1356 | { |
1355 | static const struct dmi_system_id sysids[] = { | 1357 | static const struct dmi_system_id sysids[] = { |
1356 | { | 1358 | { |
@@ -1367,7 +1369,8 @@ static void piix_iocfg_bit18_quirk(struct pci_dev *pdev) | |||
1367 | 1369 | ||
1368 | { } /* terminate list */ | 1370 | { } /* terminate list */ |
1369 | }; | 1371 | }; |
1370 | u32 iocfg; | 1372 | struct pci_dev *pdev = to_pci_dev(host->dev); |
1373 | struct piix_host_priv *hpriv = host->private_data; | ||
1371 | 1374 | ||
1372 | if (!dmi_check_system(sysids)) | 1375 | if (!dmi_check_system(sysids)) |
1373 | return; | 1376 | return; |
@@ -1376,12 +1379,11 @@ static void piix_iocfg_bit18_quirk(struct pci_dev *pdev) | |||
1376 | * seem to use it to disable a channel. Clear the bit on the | 1379 | * seem to use it to disable a channel. Clear the bit on the |
1377 | * affected systems. | 1380 | * affected systems. |
1378 | */ | 1381 | */ |
1379 | pci_read_config_dword(pdev, PIIX_IOCFG, &iocfg); | 1382 | if (hpriv->saved_iocfg & (1 << 18)) { |
1380 | if (iocfg & (1 << 18)) { | ||
1381 | dev_printk(KERN_INFO, &pdev->dev, | 1383 | dev_printk(KERN_INFO, &pdev->dev, |
1382 | "applying IOCFG bit18 quirk\n"); | 1384 | "applying IOCFG bit18 quirk\n"); |
1383 | iocfg &= ~(1 << 18); | 1385 | pci_write_config_dword(pdev, PIIX_IOCFG, |
1384 | pci_write_config_dword(pdev, PIIX_IOCFG, iocfg); | 1386 | hpriv->saved_iocfg & ~(1 << 18)); |
1385 | } | 1387 | } |
1386 | } | 1388 | } |
1387 | 1389 | ||
@@ -1430,6 +1432,17 @@ static int __devinit piix_init_one(struct pci_dev *pdev, | |||
1430 | if (rc) | 1432 | if (rc) |
1431 | return rc; | 1433 | return rc; |
1432 | 1434 | ||
1435 | hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); | ||
1436 | if (!hpriv) | ||
1437 | return -ENOMEM; | ||
1438 | |||
1439 | /* Save IOCFG, this will be used for cable detection, quirk | ||
1440 | * detection and restoration on detach. This is necessary | ||
1441 | * because some ACPI implementations mess up cable related | ||
1442 | * bits on _STM. Reported on kernel bz#11879. | ||
1443 | */ | ||
1444 | pci_read_config_dword(pdev, PIIX_IOCFG, &hpriv->saved_iocfg); | ||
1445 | |||
1433 | /* ICH6R may be driven by either ata_piix or ahci driver | 1446 | /* ICH6R may be driven by either ata_piix or ahci driver |
1434 | * regardless of BIOS configuration. Make sure AHCI mode is | 1447 | * regardless of BIOS configuration. Make sure AHCI mode is |
1435 | * off. | 1448 | * off. |
@@ -1441,10 +1454,6 @@ static int __devinit piix_init_one(struct pci_dev *pdev, | |||
1441 | } | 1454 | } |
1442 | 1455 | ||
1443 | /* SATA map init can change port_info, do it before prepping host */ | 1456 | /* SATA map init can change port_info, do it before prepping host */ |
1444 | hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); | ||
1445 | if (!hpriv) | ||
1446 | return -ENOMEM; | ||
1447 | |||
1448 | if (port_flags & ATA_FLAG_SATA) | 1457 | if (port_flags & ATA_FLAG_SATA) |
1449 | hpriv->map = piix_init_sata_map(pdev, port_info, | 1458 | hpriv->map = piix_init_sata_map(pdev, port_info, |
1450 | piix_map_db_table[ent->driver_data]); | 1459 | piix_map_db_table[ent->driver_data]); |
@@ -1463,7 +1472,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev, | |||
1463 | } | 1472 | } |
1464 | 1473 | ||
1465 | /* apply IOCFG bit18 quirk */ | 1474 | /* apply IOCFG bit18 quirk */ |
1466 | piix_iocfg_bit18_quirk(pdev); | 1475 | piix_iocfg_bit18_quirk(host); |
1467 | 1476 | ||
1468 | /* On ICH5, some BIOSen disable the interrupt using the | 1477 | /* On ICH5, some BIOSen disable the interrupt using the |
1469 | * PCI_COMMAND_INTX_DISABLE bit added in PCI 2.3. | 1478 | * PCI_COMMAND_INTX_DISABLE bit added in PCI 2.3. |
@@ -1488,6 +1497,16 @@ static int __devinit piix_init_one(struct pci_dev *pdev, | |||
1488 | return ata_pci_sff_activate_host(host, ata_sff_interrupt, &piix_sht); | 1497 | return ata_pci_sff_activate_host(host, ata_sff_interrupt, &piix_sht); |
1489 | } | 1498 | } |
1490 | 1499 | ||
1500 | static void piix_remove_one(struct pci_dev *pdev) | ||
1501 | { | ||
1502 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
1503 | struct piix_host_priv *hpriv = host->private_data; | ||
1504 | |||
1505 | pci_write_config_dword(pdev, PIIX_IOCFG, hpriv->saved_iocfg); | ||
1506 | |||
1507 | ata_pci_remove_one(pdev); | ||
1508 | } | ||
1509 | |||
1491 | static int __init piix_init(void) | 1510 | static int __init piix_init(void) |
1492 | { | 1511 | { |
1493 | int rc; | 1512 | int rc; |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index ef02e488d468..6273d98d00eb 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -19,12 +19,6 @@ | |||
19 | #include "libata.h" | 19 | #include "libata.h" |
20 | 20 | ||
21 | #include <acpi/acpi_bus.h> | 21 | #include <acpi/acpi_bus.h> |
22 | #include <acpi/acnames.h> | ||
23 | #include <acpi/acnamesp.h> | ||
24 | #include <acpi/acparser.h> | ||
25 | #include <acpi/acexcep.h> | ||
26 | #include <acpi/acmacros.h> | ||
27 | #include <acpi/actypes.h> | ||
28 | 22 | ||
29 | enum { | 23 | enum { |
30 | ATA_ACPI_FILTER_SETXFER = 1 << 0, | 24 | ATA_ACPI_FILTER_SETXFER = 1 << 0, |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index f178a450ec08..71218d76d75e 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -1007,6 +1007,7 @@ static const char *sata_spd_string(unsigned int spd) | |||
1007 | static const char * const spd_str[] = { | 1007 | static const char * const spd_str[] = { |
1008 | "1.5 Gbps", | 1008 | "1.5 Gbps", |
1009 | "3.0 Gbps", | 1009 | "3.0 Gbps", |
1010 | "6.0 Gbps", | ||
1010 | }; | 1011 | }; |
1011 | 1012 | ||
1012 | if (spd == 0 || (spd - 1) >= ARRAY_SIZE(spd_str)) | 1013 | if (spd == 0 || (spd - 1) >= ARRAY_SIZE(spd_str)) |
@@ -2000,6 +2001,10 @@ unsigned int ata_pio_need_iordy(const struct ata_device *adev) | |||
2000 | as the caller should know this */ | 2001 | as the caller should know this */ |
2001 | if (adev->link->ap->flags & ATA_FLAG_NO_IORDY) | 2002 | if (adev->link->ap->flags & ATA_FLAG_NO_IORDY) |
2002 | return 0; | 2003 | return 0; |
2004 | /* CF spec. r4.1 Table 22 says no iordy on PIO5 and PIO6. */ | ||
2005 | if (ata_id_is_cfa(adev->id) | ||
2006 | && (adev->pio_mode == XFER_PIO_5 || adev->pio_mode == XFER_PIO_6)) | ||
2007 | return 0; | ||
2003 | /* PIO3 and higher it is mandatory */ | 2008 | /* PIO3 and higher it is mandatory */ |
2004 | if (adev->pio_mode > XFER_PIO_2) | 2009 | if (adev->pio_mode > XFER_PIO_2) |
2005 | return 1; | 2010 | return 1; |
@@ -4551,7 +4556,7 @@ void ata_sg_clean(struct ata_queued_cmd *qc) | |||
4551 | struct scatterlist *sg = qc->sg; | 4556 | struct scatterlist *sg = qc->sg; |
4552 | int dir = qc->dma_dir; | 4557 | int dir = qc->dma_dir; |
4553 | 4558 | ||
4554 | WARN_ON(sg == NULL); | 4559 | WARN_ON_ONCE(sg == NULL); |
4555 | 4560 | ||
4556 | VPRINTK("unmapping %u sg elements\n", qc->n_elem); | 4561 | VPRINTK("unmapping %u sg elements\n", qc->n_elem); |
4557 | 4562 | ||
@@ -4771,7 +4776,7 @@ void ata_qc_free(struct ata_queued_cmd *qc) | |||
4771 | struct ata_port *ap = qc->ap; | 4776 | struct ata_port *ap = qc->ap; |
4772 | unsigned int tag; | 4777 | unsigned int tag; |
4773 | 4778 | ||
4774 | WARN_ON(qc == NULL); /* ata_qc_from_tag _might_ return NULL */ | 4779 | WARN_ON_ONCE(qc == NULL); /* ata_qc_from_tag _might_ return NULL */ |
4775 | 4780 | ||
4776 | qc->flags = 0; | 4781 | qc->flags = 0; |
4777 | tag = qc->tag; | 4782 | tag = qc->tag; |
@@ -4786,8 +4791,8 @@ void __ata_qc_complete(struct ata_queued_cmd *qc) | |||
4786 | struct ata_port *ap = qc->ap; | 4791 | struct ata_port *ap = qc->ap; |
4787 | struct ata_link *link = qc->dev->link; | 4792 | struct ata_link *link = qc->dev->link; |
4788 | 4793 | ||
4789 | WARN_ON(qc == NULL); /* ata_qc_from_tag _might_ return NULL */ | 4794 | WARN_ON_ONCE(qc == NULL); /* ata_qc_from_tag _might_ return NULL */ |
4790 | WARN_ON(!(qc->flags & ATA_QCFLAG_ACTIVE)); | 4795 | WARN_ON_ONCE(!(qc->flags & ATA_QCFLAG_ACTIVE)); |
4791 | 4796 | ||
4792 | if (likely(qc->flags & ATA_QCFLAG_DMAMAP)) | 4797 | if (likely(qc->flags & ATA_QCFLAG_DMAMAP)) |
4793 | ata_sg_clean(qc); | 4798 | ata_sg_clean(qc); |
@@ -4873,7 +4878,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc) | |||
4873 | struct ata_device *dev = qc->dev; | 4878 | struct ata_device *dev = qc->dev; |
4874 | struct ata_eh_info *ehi = &dev->link->eh_info; | 4879 | struct ata_eh_info *ehi = &dev->link->eh_info; |
4875 | 4880 | ||
4876 | WARN_ON(ap->pflags & ATA_PFLAG_FROZEN); | 4881 | WARN_ON_ONCE(ap->pflags & ATA_PFLAG_FROZEN); |
4877 | 4882 | ||
4878 | if (unlikely(qc->err_mask)) | 4883 | if (unlikely(qc->err_mask)) |
4879 | qc->flags |= ATA_QCFLAG_FAILED; | 4884 | qc->flags |= ATA_QCFLAG_FAILED; |
@@ -4995,16 +5000,16 @@ void ata_qc_issue(struct ata_queued_cmd *qc) | |||
4995 | * check is skipped for old EH because it reuses active qc to | 5000 | * check is skipped for old EH because it reuses active qc to |
4996 | * request ATAPI sense. | 5001 | * request ATAPI sense. |
4997 | */ | 5002 | */ |
4998 | WARN_ON(ap->ops->error_handler && ata_tag_valid(link->active_tag)); | 5003 | WARN_ON_ONCE(ap->ops->error_handler && ata_tag_valid(link->active_tag)); |
4999 | 5004 | ||
5000 | if (ata_is_ncq(prot)) { | 5005 | if (ata_is_ncq(prot)) { |
5001 | WARN_ON(link->sactive & (1 << qc->tag)); | 5006 | WARN_ON_ONCE(link->sactive & (1 << qc->tag)); |
5002 | 5007 | ||
5003 | if (!link->sactive) | 5008 | if (!link->sactive) |
5004 | ap->nr_active_links++; | 5009 | ap->nr_active_links++; |
5005 | link->sactive |= 1 << qc->tag; | 5010 | link->sactive |= 1 << qc->tag; |
5006 | } else { | 5011 | } else { |
5007 | WARN_ON(link->sactive); | 5012 | WARN_ON_ONCE(link->sactive); |
5008 | 5013 | ||
5009 | ap->nr_active_links++; | 5014 | ap->nr_active_links++; |
5010 | link->active_tag = qc->tag; | 5015 | link->active_tag = qc->tag; |
@@ -5915,6 +5920,17 @@ static void async_port_probe(void *data, async_cookie_t cookie) | |||
5915 | { | 5920 | { |
5916 | int rc; | 5921 | int rc; |
5917 | struct ata_port *ap = data; | 5922 | struct ata_port *ap = data; |
5923 | |||
5924 | /* | ||
5925 | * If we're not allowed to scan this host in parallel, | ||
5926 | * we need to wait until all previous scans have completed | ||
5927 | * before going further. | ||
5928 | * Jeff Garzik says this is only within a controller, so we | ||
5929 | * don't need to wait for port 0, only for later ports. | ||
5930 | */ | ||
5931 | if (!(ap->host->flags & ATA_HOST_PARALLEL_SCAN) && ap->port_no != 0) | ||
5932 | async_synchronize_cookie(cookie); | ||
5933 | |||
5918 | /* probe */ | 5934 | /* probe */ |
5919 | if (ap->ops->error_handler) { | 5935 | if (ap->ops->error_handler) { |
5920 | struct ata_eh_info *ehi = &ap->link.eh_info; | 5936 | struct ata_eh_info *ehi = &ap->link.eh_info; |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 9033d164c4ec..5a4aad123c42 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -66,6 +66,7 @@ const struct ata_port_operations ata_sff_port_ops = { | |||
66 | 66 | ||
67 | .port_start = ata_sff_port_start, | 67 | .port_start = ata_sff_port_start, |
68 | }; | 68 | }; |
69 | EXPORT_SYMBOL_GPL(ata_sff_port_ops); | ||
69 | 70 | ||
70 | const struct ata_port_operations ata_bmdma_port_ops = { | 71 | const struct ata_port_operations ata_bmdma_port_ops = { |
71 | .inherits = &ata_sff_port_ops, | 72 | .inherits = &ata_sff_port_ops, |
@@ -77,6 +78,14 @@ const struct ata_port_operations ata_bmdma_port_ops = { | |||
77 | .bmdma_stop = ata_bmdma_stop, | 78 | .bmdma_stop = ata_bmdma_stop, |
78 | .bmdma_status = ata_bmdma_status, | 79 | .bmdma_status = ata_bmdma_status, |
79 | }; | 80 | }; |
81 | EXPORT_SYMBOL_GPL(ata_bmdma_port_ops); | ||
82 | |||
83 | const struct ata_port_operations ata_bmdma32_port_ops = { | ||
84 | .inherits = &ata_bmdma_port_ops, | ||
85 | |||
86 | .sff_data_xfer = ata_sff_data_xfer32, | ||
87 | }; | ||
88 | EXPORT_SYMBOL_GPL(ata_bmdma32_port_ops); | ||
80 | 89 | ||
81 | /** | 90 | /** |
82 | * ata_fill_sg - Fill PCI IDE PRD table | 91 | * ata_fill_sg - Fill PCI IDE PRD table |
@@ -166,8 +175,9 @@ static void ata_fill_sg_dumb(struct ata_queued_cmd *qc) | |||
166 | blen = len & 0xffff; | 175 | blen = len & 0xffff; |
167 | ap->prd[pi].addr = cpu_to_le32(addr); | 176 | ap->prd[pi].addr = cpu_to_le32(addr); |
168 | if (blen == 0) { | 177 | if (blen == 0) { |
169 | /* Some PATA chipsets like the CS5530 can't | 178 | /* Some PATA chipsets like the CS5530 can't |
170 | cope with 0x0000 meaning 64K as the spec says */ | 179 | cope with 0x0000 meaning 64K as the spec |
180 | says */ | ||
171 | ap->prd[pi].flags_len = cpu_to_le32(0x8000); | 181 | ap->prd[pi].flags_len = cpu_to_le32(0x8000); |
172 | blen = 0x8000; | 182 | blen = 0x8000; |
173 | ap->prd[++pi].addr = cpu_to_le32(addr + 0x8000); | 183 | ap->prd[++pi].addr = cpu_to_le32(addr + 0x8000); |
@@ -200,6 +210,7 @@ void ata_sff_qc_prep(struct ata_queued_cmd *qc) | |||
200 | 210 | ||
201 | ata_fill_sg(qc); | 211 | ata_fill_sg(qc); |
202 | } | 212 | } |
213 | EXPORT_SYMBOL_GPL(ata_sff_qc_prep); | ||
203 | 214 | ||
204 | /** | 215 | /** |
205 | * ata_sff_dumb_qc_prep - Prepare taskfile for submission | 216 | * ata_sff_dumb_qc_prep - Prepare taskfile for submission |
@@ -217,6 +228,7 @@ void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc) | |||
217 | 228 | ||
218 | ata_fill_sg_dumb(qc); | 229 | ata_fill_sg_dumb(qc); |
219 | } | 230 | } |
231 | EXPORT_SYMBOL_GPL(ata_sff_dumb_qc_prep); | ||
220 | 232 | ||
221 | /** | 233 | /** |
222 | * ata_sff_check_status - Read device status reg & clear interrupt | 234 | * ata_sff_check_status - Read device status reg & clear interrupt |
@@ -233,6 +245,7 @@ u8 ata_sff_check_status(struct ata_port *ap) | |||
233 | { | 245 | { |
234 | return ioread8(ap->ioaddr.status_addr); | 246 | return ioread8(ap->ioaddr.status_addr); |
235 | } | 247 | } |
248 | EXPORT_SYMBOL_GPL(ata_sff_check_status); | ||
236 | 249 | ||
237 | /** | 250 | /** |
238 | * ata_sff_altstatus - Read device alternate status reg | 251 | * ata_sff_altstatus - Read device alternate status reg |
@@ -275,7 +288,7 @@ static u8 ata_sff_irq_status(struct ata_port *ap) | |||
275 | status = ata_sff_altstatus(ap); | 288 | status = ata_sff_altstatus(ap); |
276 | /* Not us: We are busy */ | 289 | /* Not us: We are busy */ |
277 | if (status & ATA_BUSY) | 290 | if (status & ATA_BUSY) |
278 | return status; | 291 | return status; |
279 | } | 292 | } |
280 | /* Clear INTRQ latch */ | 293 | /* Clear INTRQ latch */ |
281 | status = ap->ops->sff_check_status(ap); | 294 | status = ap->ops->sff_check_status(ap); |
@@ -319,6 +332,7 @@ void ata_sff_pause(struct ata_port *ap) | |||
319 | ata_sff_sync(ap); | 332 | ata_sff_sync(ap); |
320 | ndelay(400); | 333 | ndelay(400); |
321 | } | 334 | } |
335 | EXPORT_SYMBOL_GPL(ata_sff_pause); | ||
322 | 336 | ||
323 | /** | 337 | /** |
324 | * ata_sff_dma_pause - Pause before commencing DMA | 338 | * ata_sff_dma_pause - Pause before commencing DMA |
@@ -327,7 +341,7 @@ void ata_sff_pause(struct ata_port *ap) | |||
327 | * Perform I/O fencing and ensure sufficient cycle delays occur | 341 | * Perform I/O fencing and ensure sufficient cycle delays occur |
328 | * for the HDMA1:0 transition | 342 | * for the HDMA1:0 transition |
329 | */ | 343 | */ |
330 | 344 | ||
331 | void ata_sff_dma_pause(struct ata_port *ap) | 345 | void ata_sff_dma_pause(struct ata_port *ap) |
332 | { | 346 | { |
333 | if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) { | 347 | if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) { |
@@ -341,6 +355,7 @@ void ata_sff_dma_pause(struct ata_port *ap) | |||
341 | corruption. */ | 355 | corruption. */ |
342 | BUG(); | 356 | BUG(); |
343 | } | 357 | } |
358 | EXPORT_SYMBOL_GPL(ata_sff_dma_pause); | ||
344 | 359 | ||
345 | /** | 360 | /** |
346 | * ata_sff_busy_sleep - sleep until BSY clears, or timeout | 361 | * ata_sff_busy_sleep - sleep until BSY clears, or timeout |
@@ -396,6 +411,7 @@ int ata_sff_busy_sleep(struct ata_port *ap, | |||
396 | 411 | ||
397 | return 0; | 412 | return 0; |
398 | } | 413 | } |
414 | EXPORT_SYMBOL_GPL(ata_sff_busy_sleep); | ||
399 | 415 | ||
400 | static int ata_sff_check_ready(struct ata_link *link) | 416 | static int ata_sff_check_ready(struct ata_link *link) |
401 | { | 417 | { |
@@ -422,6 +438,7 @@ int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline) | |||
422 | { | 438 | { |
423 | return ata_wait_ready(link, deadline, ata_sff_check_ready); | 439 | return ata_wait_ready(link, deadline, ata_sff_check_ready); |
424 | } | 440 | } |
441 | EXPORT_SYMBOL_GPL(ata_sff_wait_ready); | ||
425 | 442 | ||
426 | /** | 443 | /** |
427 | * ata_sff_dev_select - Select device 0/1 on ATA bus | 444 | * ata_sff_dev_select - Select device 0/1 on ATA bus |
@@ -449,6 +466,7 @@ void ata_sff_dev_select(struct ata_port *ap, unsigned int device) | |||
449 | iowrite8(tmp, ap->ioaddr.device_addr); | 466 | iowrite8(tmp, ap->ioaddr.device_addr); |
450 | ata_sff_pause(ap); /* needed; also flushes, for mmio */ | 467 | ata_sff_pause(ap); /* needed; also flushes, for mmio */ |
451 | } | 468 | } |
469 | EXPORT_SYMBOL_GPL(ata_sff_dev_select); | ||
452 | 470 | ||
453 | /** | 471 | /** |
454 | * ata_dev_select - Select device 0/1 on ATA bus | 472 | * ata_dev_select - Select device 0/1 on ATA bus |
@@ -513,6 +531,7 @@ u8 ata_sff_irq_on(struct ata_port *ap) | |||
513 | 531 | ||
514 | return tmp; | 532 | return tmp; |
515 | } | 533 | } |
534 | EXPORT_SYMBOL_GPL(ata_sff_irq_on); | ||
516 | 535 | ||
517 | /** | 536 | /** |
518 | * ata_sff_irq_clear - Clear PCI IDE BMDMA interrupt. | 537 | * ata_sff_irq_clear - Clear PCI IDE BMDMA interrupt. |
@@ -534,6 +553,7 @@ void ata_sff_irq_clear(struct ata_port *ap) | |||
534 | 553 | ||
535 | iowrite8(ioread8(mmio + ATA_DMA_STATUS), mmio + ATA_DMA_STATUS); | 554 | iowrite8(ioread8(mmio + ATA_DMA_STATUS), mmio + ATA_DMA_STATUS); |
536 | } | 555 | } |
556 | EXPORT_SYMBOL_GPL(ata_sff_irq_clear); | ||
537 | 557 | ||
538 | /** | 558 | /** |
539 | * ata_sff_tf_load - send taskfile registers to host controller | 559 | * ata_sff_tf_load - send taskfile registers to host controller |
@@ -558,7 +578,7 @@ void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) | |||
558 | } | 578 | } |
559 | 579 | ||
560 | if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { | 580 | if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) { |
561 | WARN_ON(!ioaddr->ctl_addr); | 581 | WARN_ON_ONCE(!ioaddr->ctl_addr); |
562 | iowrite8(tf->hob_feature, ioaddr->feature_addr); | 582 | iowrite8(tf->hob_feature, ioaddr->feature_addr); |
563 | iowrite8(tf->hob_nsect, ioaddr->nsect_addr); | 583 | iowrite8(tf->hob_nsect, ioaddr->nsect_addr); |
564 | iowrite8(tf->hob_lbal, ioaddr->lbal_addr); | 584 | iowrite8(tf->hob_lbal, ioaddr->lbal_addr); |
@@ -593,6 +613,7 @@ void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) | |||
593 | 613 | ||
594 | ata_wait_idle(ap); | 614 | ata_wait_idle(ap); |
595 | } | 615 | } |
616 | EXPORT_SYMBOL_GPL(ata_sff_tf_load); | ||
596 | 617 | ||
597 | /** | 618 | /** |
598 | * ata_sff_tf_read - input device's ATA taskfile shadow registers | 619 | * ata_sff_tf_read - input device's ATA taskfile shadow registers |
@@ -630,9 +651,10 @@ void ata_sff_tf_read(struct ata_port *ap, struct ata_taskfile *tf) | |||
630 | iowrite8(tf->ctl, ioaddr->ctl_addr); | 651 | iowrite8(tf->ctl, ioaddr->ctl_addr); |
631 | ap->last_ctl = tf->ctl; | 652 | ap->last_ctl = tf->ctl; |
632 | } else | 653 | } else |
633 | WARN_ON(1); | 654 | WARN_ON_ONCE(1); |
634 | } | 655 | } |
635 | } | 656 | } |
657 | EXPORT_SYMBOL_GPL(ata_sff_tf_read); | ||
636 | 658 | ||
637 | /** | 659 | /** |
638 | * ata_sff_exec_command - issue ATA command to host controller | 660 | * ata_sff_exec_command - issue ATA command to host controller |
@@ -652,6 +674,7 @@ void ata_sff_exec_command(struct ata_port *ap, const struct ata_taskfile *tf) | |||
652 | iowrite8(tf->command, ap->ioaddr.command_addr); | 674 | iowrite8(tf->command, ap->ioaddr.command_addr); |
653 | ata_sff_pause(ap); | 675 | ata_sff_pause(ap); |
654 | } | 676 | } |
677 | EXPORT_SYMBOL_GPL(ata_sff_exec_command); | ||
655 | 678 | ||
656 | /** | 679 | /** |
657 | * ata_tf_to_host - issue ATA taskfile to host controller | 680 | * ata_tf_to_host - issue ATA taskfile to host controller |
@@ -717,6 +740,53 @@ unsigned int ata_sff_data_xfer(struct ata_device *dev, unsigned char *buf, | |||
717 | 740 | ||
718 | return words << 1; | 741 | return words << 1; |
719 | } | 742 | } |
743 | EXPORT_SYMBOL_GPL(ata_sff_data_xfer); | ||
744 | |||
745 | /** | ||
746 | * ata_sff_data_xfer32 - Transfer data by PIO | ||
747 | * @dev: device to target | ||
748 | * @buf: data buffer | ||
749 | * @buflen: buffer length | ||
750 | * @rw: read/write | ||
751 | * | ||
752 | * Transfer data from/to the device data register by PIO using 32bit | ||
753 | * I/O operations. | ||
754 | * | ||
755 | * LOCKING: | ||
756 | * Inherited from caller. | ||
757 | * | ||
758 | * RETURNS: | ||
759 | * Bytes consumed. | ||
760 | */ | ||
761 | |||
762 | unsigned int ata_sff_data_xfer32(struct ata_device *dev, unsigned char *buf, | ||
763 | unsigned int buflen, int rw) | ||
764 | { | ||
765 | struct ata_port *ap = dev->link->ap; | ||
766 | void __iomem *data_addr = ap->ioaddr.data_addr; | ||
767 | unsigned int words = buflen >> 2; | ||
768 | int slop = buflen & 3; | ||
769 | |||
770 | /* Transfer multiple of 4 bytes */ | ||
771 | if (rw == READ) | ||
772 | ioread32_rep(data_addr, buf, words); | ||
773 | else | ||
774 | iowrite32_rep(data_addr, buf, words); | ||
775 | |||
776 | if (unlikely(slop)) { | ||
777 | __le32 pad; | ||
778 | if (rw == READ) { | ||
779 | pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr)); | ||
780 | memcpy(buf + buflen - slop, &pad, slop); | ||
781 | } else { | ||
782 | memcpy(&pad, buf + buflen - slop, slop); | ||
783 | iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr); | ||
784 | } | ||
785 | words++; | ||
786 | } | ||
787 | return words << 2; | ||
788 | } | ||
789 | EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); | ||
720 | 790 | ||
721 | /** | 791 | /** |
722 | * ata_sff_data_xfer_noirq - Transfer data by PIO | 792 | * ata_sff_data_xfer_noirq - Transfer data by PIO |
@@ -746,6 +816,7 @@ unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, unsigned char *buf, | |||
746 | 816 | ||
747 | return consumed; | 817 | return consumed; |
748 | } | 818 | } |
819 | EXPORT_SYMBOL_GPL(ata_sff_data_xfer_noirq); | ||
749 | 820 | ||
750 | /** | 821 | /** |
751 | * ata_pio_sector - Transfer a sector of data. | 822 | * ata_pio_sector - Transfer a sector of data. |
@@ -820,7 +891,7 @@ static void ata_pio_sectors(struct ata_queued_cmd *qc) | |||
820 | /* READ/WRITE MULTIPLE */ | 891 | /* READ/WRITE MULTIPLE */ |
821 | unsigned int nsect; | 892 | unsigned int nsect; |
822 | 893 | ||
823 | WARN_ON(qc->dev->multi_count == 0); | 894 | WARN_ON_ONCE(qc->dev->multi_count == 0); |
824 | 895 | ||
825 | nsect = min((qc->nbytes - qc->curbytes) / qc->sect_size, | 896 | nsect = min((qc->nbytes - qc->curbytes) / qc->sect_size, |
826 | qc->dev->multi_count); | 897 | qc->dev->multi_count); |
@@ -847,7 +918,7 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
847 | { | 918 | { |
848 | /* send SCSI cdb */ | 919 | /* send SCSI cdb */ |
849 | DPRINTK("send cdb\n"); | 920 | DPRINTK("send cdb\n"); |
850 | WARN_ON(qc->dev->cdb_len < 12); | 921 | WARN_ON_ONCE(qc->dev->cdb_len < 12); |
851 | 922 | ||
852 | ap->ops->sff_data_xfer(qc->dev, qc->cdb, qc->dev->cdb_len, 1); | 923 | ap->ops->sff_data_xfer(qc->dev, qc->cdb, qc->dev->cdb_len, 1); |
853 | ata_sff_sync(ap); | 924 | ata_sff_sync(ap); |
@@ -922,13 +993,15 @@ next_sg: | |||
922 | buf = kmap_atomic(page, KM_IRQ0); | 993 | buf = kmap_atomic(page, KM_IRQ0); |
923 | 994 | ||
924 | /* do the actual data transfer */ | 995 | /* do the actual data transfer */ |
925 | consumed = ap->ops->sff_data_xfer(dev, buf + offset, count, rw); | 996 | consumed = ap->ops->sff_data_xfer(dev, buf + offset, |
997 | count, rw); | ||
926 | 998 | ||
927 | kunmap_atomic(buf, KM_IRQ0); | 999 | kunmap_atomic(buf, KM_IRQ0); |
928 | local_irq_restore(flags); | 1000 | local_irq_restore(flags); |
929 | } else { | 1001 | } else { |
930 | buf = page_address(page); | 1002 | buf = page_address(page); |
931 | consumed = ap->ops->sff_data_xfer(dev, buf + offset, count, rw); | 1003 | consumed = ap->ops->sff_data_xfer(dev, buf + offset, |
1004 | count, rw); | ||
932 | } | 1005 | } |
933 | 1006 | ||
934 | bytes -= min(bytes, consumed); | 1007 | bytes -= min(bytes, consumed); |
@@ -940,9 +1013,12 @@ next_sg: | |||
940 | qc->cursg_ofs = 0; | 1013 | qc->cursg_ofs = 0; |
941 | } | 1014 | } |
942 | 1015 | ||
943 | /* consumed can be larger than count only for the last transfer */ | 1016 | /* |
944 | WARN_ON(qc->cursg && count != consumed); | 1017 | * There used to be a WARN_ON_ONCE(qc->cursg && count != consumed); |
945 | 1018 | * Unfortunately __atapi_pio_bytes doesn't know enough to do the WARN | |
1019 | * check correctly as it doesn't know if it is the last request being | ||
1020 | * made. Somebody should implement a proper sanity check. | ||
1021 | */ | ||
946 | if (bytes) | 1022 | if (bytes) |
947 | goto next_sg; | 1023 | goto next_sg; |
948 | return 0; | 1024 | return 0; |
@@ -1013,18 +1089,19 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc) | |||
1013 | * RETURNS: | 1089 | * RETURNS: |
1014 | * 1 if ok in workqueue, 0 otherwise. | 1090 | * 1 if ok in workqueue, 0 otherwise. |
1015 | */ | 1091 | */ |
1016 | static inline int ata_hsm_ok_in_wq(struct ata_port *ap, struct ata_queued_cmd *qc) | 1092 | static inline int ata_hsm_ok_in_wq(struct ata_port *ap, |
1093 | struct ata_queued_cmd *qc) | ||
1017 | { | 1094 | { |
1018 | if (qc->tf.flags & ATA_TFLAG_POLLING) | 1095 | if (qc->tf.flags & ATA_TFLAG_POLLING) |
1019 | return 1; | 1096 | return 1; |
1020 | 1097 | ||
1021 | if (ap->hsm_task_state == HSM_ST_FIRST) { | 1098 | if (ap->hsm_task_state == HSM_ST_FIRST) { |
1022 | if (qc->tf.protocol == ATA_PROT_PIO && | 1099 | if (qc->tf.protocol == ATA_PROT_PIO && |
1023 | (qc->tf.flags & ATA_TFLAG_WRITE)) | 1100 | (qc->tf.flags & ATA_TFLAG_WRITE)) |
1024 | return 1; | 1101 | return 1; |
1025 | 1102 | ||
1026 | if (ata_is_atapi(qc->tf.protocol) && | 1103 | if (ata_is_atapi(qc->tf.protocol) && |
1027 | !(qc->dev->flags & ATA_DFLAG_CDB_INTR)) | 1104 | !(qc->dev->flags & ATA_DFLAG_CDB_INTR)) |
1028 | return 1; | 1105 | return 1; |
1029 | } | 1106 | } |
1030 | 1107 | ||
@@ -1098,13 +1175,13 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, | |||
1098 | unsigned long flags = 0; | 1175 | unsigned long flags = 0; |
1099 | int poll_next; | 1176 | int poll_next; |
1100 | 1177 | ||
1101 | WARN_ON((qc->flags & ATA_QCFLAG_ACTIVE) == 0); | 1178 | WARN_ON_ONCE((qc->flags & ATA_QCFLAG_ACTIVE) == 0); |
1102 | 1179 | ||
1103 | /* Make sure ata_sff_qc_issue() does not throw things | 1180 | /* Make sure ata_sff_qc_issue() does not throw things |
1104 | * like DMA polling into the workqueue. Notice that | 1181 | * like DMA polling into the workqueue. Notice that |
1105 | * in_wq is not equivalent to (qc->tf.flags & ATA_TFLAG_POLLING). | 1182 | * in_wq is not equivalent to (qc->tf.flags & ATA_TFLAG_POLLING). |
1106 | */ | 1183 | */ |
1107 | WARN_ON(in_wq != ata_hsm_ok_in_wq(ap, qc)); | 1184 | WARN_ON_ONCE(in_wq != ata_hsm_ok_in_wq(ap, qc)); |
1108 | 1185 | ||
1109 | fsm_start: | 1186 | fsm_start: |
1110 | DPRINTK("ata%u: protocol %d task_state %d (dev_stat 0x%X)\n", | 1187 | DPRINTK("ata%u: protocol %d task_state %d (dev_stat 0x%X)\n", |
@@ -1313,7 +1390,7 @@ fsm_start: | |||
1313 | DPRINTK("ata%u: dev %u command complete, drv_stat 0x%x\n", | 1390 | DPRINTK("ata%u: dev %u command complete, drv_stat 0x%x\n", |
1314 | ap->print_id, qc->dev->devno, status); | 1391 | ap->print_id, qc->dev->devno, status); |
1315 | 1392 | ||
1316 | WARN_ON(qc->err_mask & (AC_ERR_DEV | AC_ERR_HSM)); | 1393 | WARN_ON_ONCE(qc->err_mask & (AC_ERR_DEV | AC_ERR_HSM)); |
1317 | 1394 | ||
1318 | ap->hsm_task_state = HSM_ST_IDLE; | 1395 | ap->hsm_task_state = HSM_ST_IDLE; |
1319 | 1396 | ||
@@ -1338,6 +1415,7 @@ fsm_start: | |||
1338 | 1415 | ||
1339 | return poll_next; | 1416 | return poll_next; |
1340 | } | 1417 | } |
1418 | EXPORT_SYMBOL_GPL(ata_sff_hsm_move); | ||
1341 | 1419 | ||
1342 | void ata_pio_task(struct work_struct *work) | 1420 | void ata_pio_task(struct work_struct *work) |
1343 | { | 1421 | { |
@@ -1348,7 +1426,7 @@ void ata_pio_task(struct work_struct *work) | |||
1348 | int poll_next; | 1426 | int poll_next; |
1349 | 1427 | ||
1350 | fsm_start: | 1428 | fsm_start: |
1351 | WARN_ON(ap->hsm_task_state == HSM_ST_IDLE); | 1429 | WARN_ON_ONCE(ap->hsm_task_state == HSM_ST_IDLE); |
1352 | 1430 | ||
1353 | /* | 1431 | /* |
1354 | * This is purely heuristic. This is a fast path. | 1432 | * This is purely heuristic. This is a fast path. |
@@ -1437,7 +1515,7 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) | |||
1437 | break; | 1515 | break; |
1438 | 1516 | ||
1439 | case ATA_PROT_DMA: | 1517 | case ATA_PROT_DMA: |
1440 | WARN_ON(qc->tf.flags & ATA_TFLAG_POLLING); | 1518 | WARN_ON_ONCE(qc->tf.flags & ATA_TFLAG_POLLING); |
1441 | 1519 | ||
1442 | ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */ | 1520 | ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */ |
1443 | ap->ops->bmdma_setup(qc); /* set up bmdma */ | 1521 | ap->ops->bmdma_setup(qc); /* set up bmdma */ |
@@ -1489,7 +1567,7 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) | |||
1489 | break; | 1567 | break; |
1490 | 1568 | ||
1491 | case ATAPI_PROT_DMA: | 1569 | case ATAPI_PROT_DMA: |
1492 | WARN_ON(qc->tf.flags & ATA_TFLAG_POLLING); | 1570 | WARN_ON_ONCE(qc->tf.flags & ATA_TFLAG_POLLING); |
1493 | 1571 | ||
1494 | ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */ | 1572 | ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */ |
1495 | ap->ops->bmdma_setup(qc); /* set up bmdma */ | 1573 | ap->ops->bmdma_setup(qc); /* set up bmdma */ |
@@ -1501,12 +1579,13 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) | |||
1501 | break; | 1579 | break; |
1502 | 1580 | ||
1503 | default: | 1581 | default: |
1504 | WARN_ON(1); | 1582 | WARN_ON_ONCE(1); |
1505 | return AC_ERR_SYSTEM; | 1583 | return AC_ERR_SYSTEM; |
1506 | } | 1584 | } |
1507 | 1585 | ||
1508 | return 0; | 1586 | return 0; |
1509 | } | 1587 | } |
1588 | EXPORT_SYMBOL_GPL(ata_sff_qc_issue); | ||
1510 | 1589 | ||
1511 | /** | 1590 | /** |
1512 | * ata_sff_qc_fill_rtf - fill result TF using ->sff_tf_read | 1591 | * ata_sff_qc_fill_rtf - fill result TF using ->sff_tf_read |
@@ -1526,6 +1605,7 @@ bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc) | |||
1526 | qc->ap->ops->sff_tf_read(qc->ap, &qc->result_tf); | 1605 | qc->ap->ops->sff_tf_read(qc->ap, &qc->result_tf); |
1527 | return true; | 1606 | return true; |
1528 | } | 1607 | } |
1608 | EXPORT_SYMBOL_GPL(ata_sff_qc_fill_rtf); | ||
1529 | 1609 | ||
1530 | /** | 1610 | /** |
1531 | * ata_sff_host_intr - Handle host interrupt for given (port, task) | 1611 | * ata_sff_host_intr - Handle host interrupt for given (port, task) |
@@ -1623,6 +1703,7 @@ idle_irq: | |||
1623 | #endif | 1703 | #endif |
1624 | return 0; /* irq not handled */ | 1704 | return 0; /* irq not handled */ |
1625 | } | 1705 | } |
1706 | EXPORT_SYMBOL_GPL(ata_sff_host_intr); | ||
1626 | 1707 | ||
1627 | /** | 1708 | /** |
1628 | * ata_sff_interrupt - Default ATA host interrupt handler | 1709 | * ata_sff_interrupt - Default ATA host interrupt handler |
@@ -1667,6 +1748,7 @@ irqreturn_t ata_sff_interrupt(int irq, void *dev_instance) | |||
1667 | 1748 | ||
1668 | return IRQ_RETVAL(handled); | 1749 | return IRQ_RETVAL(handled); |
1669 | } | 1750 | } |
1751 | EXPORT_SYMBOL_GPL(ata_sff_interrupt); | ||
1670 | 1752 | ||
1671 | /** | 1753 | /** |
1672 | * ata_sff_freeze - Freeze SFF controller port | 1754 | * ata_sff_freeze - Freeze SFF controller port |
@@ -1695,6 +1777,7 @@ void ata_sff_freeze(struct ata_port *ap) | |||
1695 | 1777 | ||
1696 | ap->ops->sff_irq_clear(ap); | 1778 | ap->ops->sff_irq_clear(ap); |
1697 | } | 1779 | } |
1780 | EXPORT_SYMBOL_GPL(ata_sff_freeze); | ||
1698 | 1781 | ||
1699 | /** | 1782 | /** |
1700 | * ata_sff_thaw - Thaw SFF controller port | 1783 | * ata_sff_thaw - Thaw SFF controller port |
@@ -1712,6 +1795,7 @@ void ata_sff_thaw(struct ata_port *ap) | |||
1712 | ap->ops->sff_irq_clear(ap); | 1795 | ap->ops->sff_irq_clear(ap); |
1713 | ap->ops->sff_irq_on(ap); | 1796 | ap->ops->sff_irq_on(ap); |
1714 | } | 1797 | } |
1798 | EXPORT_SYMBOL_GPL(ata_sff_thaw); | ||
1715 | 1799 | ||
1716 | /** | 1800 | /** |
1717 | * ata_sff_prereset - prepare SFF link for reset | 1801 | * ata_sff_prereset - prepare SFF link for reset |
@@ -1753,6 +1837,7 @@ int ata_sff_prereset(struct ata_link *link, unsigned long deadline) | |||
1753 | 1837 | ||
1754 | return 0; | 1838 | return 0; |
1755 | } | 1839 | } |
1840 | EXPORT_SYMBOL_GPL(ata_sff_prereset); | ||
1756 | 1841 | ||
1757 | /** | 1842 | /** |
1758 | * ata_devchk - PATA device presence detection | 1843 | * ata_devchk - PATA device presence detection |
@@ -1865,6 +1950,7 @@ unsigned int ata_sff_dev_classify(struct ata_device *dev, int present, | |||
1865 | 1950 | ||
1866 | return class; | 1951 | return class; |
1867 | } | 1952 | } |
1953 | EXPORT_SYMBOL_GPL(ata_sff_dev_classify); | ||
1868 | 1954 | ||
1869 | /** | 1955 | /** |
1870 | * ata_sff_wait_after_reset - wait for devices to become ready after reset | 1956 | * ata_sff_wait_after_reset - wait for devices to become ready after reset |
@@ -1941,6 +2027,7 @@ int ata_sff_wait_after_reset(struct ata_link *link, unsigned int devmask, | |||
1941 | 2027 | ||
1942 | return ret; | 2028 | return ret; |
1943 | } | 2029 | } |
2030 | EXPORT_SYMBOL_GPL(ata_sff_wait_after_reset); | ||
1944 | 2031 | ||
1945 | static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask, | 2032 | static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask, |
1946 | unsigned long deadline) | 2033 | unsigned long deadline) |
@@ -2013,6 +2100,7 @@ int ata_sff_softreset(struct ata_link *link, unsigned int *classes, | |||
2013 | DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]); | 2100 | DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]); |
2014 | return 0; | 2101 | return 0; |
2015 | } | 2102 | } |
2103 | EXPORT_SYMBOL_GPL(ata_sff_softreset); | ||
2016 | 2104 | ||
2017 | /** | 2105 | /** |
2018 | * sata_sff_hardreset - reset host port via SATA phy reset | 2106 | * sata_sff_hardreset - reset host port via SATA phy reset |
@@ -2045,6 +2133,7 @@ int sata_sff_hardreset(struct ata_link *link, unsigned int *class, | |||
2045 | DPRINTK("EXIT, class=%u\n", *class); | 2133 | DPRINTK("EXIT, class=%u\n", *class); |
2046 | return rc; | 2134 | return rc; |
2047 | } | 2135 | } |
2136 | EXPORT_SYMBOL_GPL(sata_sff_hardreset); | ||
2048 | 2137 | ||
2049 | /** | 2138 | /** |
2050 | * ata_sff_postreset - SFF postreset callback | 2139 | * ata_sff_postreset - SFF postreset callback |
@@ -2080,6 +2169,7 @@ void ata_sff_postreset(struct ata_link *link, unsigned int *classes) | |||
2080 | if (ap->ioaddr.ctl_addr) | 2169 | if (ap->ioaddr.ctl_addr) |
2081 | iowrite8(ap->ctl, ap->ioaddr.ctl_addr); | 2170 | iowrite8(ap->ctl, ap->ioaddr.ctl_addr); |
2082 | } | 2171 | } |
2172 | EXPORT_SYMBOL_GPL(ata_sff_postreset); | ||
2083 | 2173 | ||
2084 | /** | 2174 | /** |
2085 | * ata_sff_error_handler - Stock error handler for BMDMA controller | 2175 | * ata_sff_error_handler - Stock error handler for BMDMA controller |
@@ -2152,6 +2242,7 @@ void ata_sff_error_handler(struct ata_port *ap) | |||
2152 | ata_do_eh(ap, ap->ops->prereset, softreset, hardreset, | 2242 | ata_do_eh(ap, ap->ops->prereset, softreset, hardreset, |
2153 | ap->ops->postreset); | 2243 | ap->ops->postreset); |
2154 | } | 2244 | } |
2245 | EXPORT_SYMBOL_GPL(ata_sff_error_handler); | ||
2155 | 2246 | ||
2156 | /** | 2247 | /** |
2157 | * ata_sff_post_internal_cmd - Stock post_internal_cmd for SFF controller | 2248 | * ata_sff_post_internal_cmd - Stock post_internal_cmd for SFF controller |
@@ -2174,6 +2265,7 @@ void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc) | |||
2174 | 2265 | ||
2175 | spin_unlock_irqrestore(ap->lock, flags); | 2266 | spin_unlock_irqrestore(ap->lock, flags); |
2176 | } | 2267 | } |
2268 | EXPORT_SYMBOL_GPL(ata_sff_post_internal_cmd); | ||
2177 | 2269 | ||
2178 | /** | 2270 | /** |
2179 | * ata_sff_port_start - Set port up for dma. | 2271 | * ata_sff_port_start - Set port up for dma. |
@@ -2194,6 +2286,7 @@ int ata_sff_port_start(struct ata_port *ap) | |||
2194 | return ata_port_start(ap); | 2286 | return ata_port_start(ap); |
2195 | return 0; | 2287 | return 0; |
2196 | } | 2288 | } |
2289 | EXPORT_SYMBOL_GPL(ata_sff_port_start); | ||
2197 | 2290 | ||
2198 | /** | 2291 | /** |
2199 | * ata_sff_std_ports - initialize ioaddr with standard port offsets. | 2292 | * ata_sff_std_ports - initialize ioaddr with standard port offsets. |
@@ -2219,6 +2312,7 @@ void ata_sff_std_ports(struct ata_ioports *ioaddr) | |||
2219 | ioaddr->status_addr = ioaddr->cmd_addr + ATA_REG_STATUS; | 2312 | ioaddr->status_addr = ioaddr->cmd_addr + ATA_REG_STATUS; |
2220 | ioaddr->command_addr = ioaddr->cmd_addr + ATA_REG_CMD; | 2313 | ioaddr->command_addr = ioaddr->cmd_addr + ATA_REG_CMD; |
2221 | } | 2314 | } |
2315 | EXPORT_SYMBOL_GPL(ata_sff_std_ports); | ||
2222 | 2316 | ||
2223 | unsigned long ata_bmdma_mode_filter(struct ata_device *adev, | 2317 | unsigned long ata_bmdma_mode_filter(struct ata_device *adev, |
2224 | unsigned long xfer_mask) | 2318 | unsigned long xfer_mask) |
@@ -2230,6 +2324,7 @@ unsigned long ata_bmdma_mode_filter(struct ata_device *adev, | |||
2230 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); | 2324 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); |
2231 | return xfer_mask; | 2325 | return xfer_mask; |
2232 | } | 2326 | } |
2327 | EXPORT_SYMBOL_GPL(ata_bmdma_mode_filter); | ||
2233 | 2328 | ||
2234 | /** | 2329 | /** |
2235 | * ata_bmdma_setup - Set up PCI IDE BMDMA transaction | 2330 | * ata_bmdma_setup - Set up PCI IDE BMDMA transaction |
@@ -2258,6 +2353,7 @@ void ata_bmdma_setup(struct ata_queued_cmd *qc) | |||
2258 | /* issue r/w command */ | 2353 | /* issue r/w command */ |
2259 | ap->ops->sff_exec_command(ap, &qc->tf); | 2354 | ap->ops->sff_exec_command(ap, &qc->tf); |
2260 | } | 2355 | } |
2356 | EXPORT_SYMBOL_GPL(ata_bmdma_setup); | ||
2261 | 2357 | ||
2262 | /** | 2358 | /** |
2263 | * ata_bmdma_start - Start a PCI IDE BMDMA transaction | 2359 | * ata_bmdma_start - Start a PCI IDE BMDMA transaction |
@@ -2290,6 +2386,7 @@ void ata_bmdma_start(struct ata_queued_cmd *qc) | |||
2290 | * unneccessarily delayed for MMIO | 2386 | * unneccessarily delayed for MMIO |
2291 | */ | 2387 | */ |
2292 | } | 2388 | } |
2389 | EXPORT_SYMBOL_GPL(ata_bmdma_start); | ||
2293 | 2390 | ||
2294 | /** | 2391 | /** |
2295 | * ata_bmdma_stop - Stop PCI IDE BMDMA transfer | 2392 | * ata_bmdma_stop - Stop PCI IDE BMDMA transfer |
@@ -2314,6 +2411,7 @@ void ata_bmdma_stop(struct ata_queued_cmd *qc) | |||
2314 | /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ | 2411 | /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ |
2315 | ata_sff_dma_pause(ap); | 2412 | ata_sff_dma_pause(ap); |
2316 | } | 2413 | } |
2414 | EXPORT_SYMBOL_GPL(ata_bmdma_stop); | ||
2317 | 2415 | ||
2318 | /** | 2416 | /** |
2319 | * ata_bmdma_status - Read PCI IDE BMDMA status | 2417 | * ata_bmdma_status - Read PCI IDE BMDMA status |
@@ -2330,6 +2428,7 @@ u8 ata_bmdma_status(struct ata_port *ap) | |||
2330 | { | 2428 | { |
2331 | return ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | 2429 | return ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); |
2332 | } | 2430 | } |
2431 | EXPORT_SYMBOL_GPL(ata_bmdma_status); | ||
2333 | 2432 | ||
2334 | /** | 2433 | /** |
2335 | * ata_bus_reset - reset host port and associated ATA channel | 2434 | * ata_bus_reset - reset host port and associated ATA channel |
@@ -2422,6 +2521,7 @@ err_out: | |||
2422 | 2521 | ||
2423 | DPRINTK("EXIT\n"); | 2522 | DPRINTK("EXIT\n"); |
2424 | } | 2523 | } |
2524 | EXPORT_SYMBOL_GPL(ata_bus_reset); | ||
2425 | 2525 | ||
2426 | #ifdef CONFIG_PCI | 2526 | #ifdef CONFIG_PCI |
2427 | 2527 | ||
@@ -2449,6 +2549,7 @@ int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev) | |||
2449 | return -EOPNOTSUPP; | 2549 | return -EOPNOTSUPP; |
2450 | return 0; | 2550 | return 0; |
2451 | } | 2551 | } |
2552 | EXPORT_SYMBOL_GPL(ata_pci_bmdma_clear_simplex); | ||
2452 | 2553 | ||
2453 | /** | 2554 | /** |
2454 | * ata_pci_bmdma_init - acquire PCI BMDMA resources and init ATA host | 2555 | * ata_pci_bmdma_init - acquire PCI BMDMA resources and init ATA host |
@@ -2501,11 +2602,12 @@ int ata_pci_bmdma_init(struct ata_host *host) | |||
2501 | host->flags |= ATA_HOST_SIMPLEX; | 2602 | host->flags |= ATA_HOST_SIMPLEX; |
2502 | 2603 | ||
2503 | ata_port_desc(ap, "bmdma 0x%llx", | 2604 | ata_port_desc(ap, "bmdma 0x%llx", |
2504 | (unsigned long long)pci_resource_start(pdev, 4) + 8 * i); | 2605 | (unsigned long long)pci_resource_start(pdev, 4) + 8 * i); |
2505 | } | 2606 | } |
2506 | 2607 | ||
2507 | return 0; | 2608 | return 0; |
2508 | } | 2609 | } |
2610 | EXPORT_SYMBOL_GPL(ata_pci_bmdma_init); | ||
2509 | 2611 | ||
2510 | static int ata_resources_present(struct pci_dev *pdev, int port) | 2612 | static int ata_resources_present(struct pci_dev *pdev, int port) |
2511 | { | 2613 | { |
@@ -2513,7 +2615,7 @@ static int ata_resources_present(struct pci_dev *pdev, int port) | |||
2513 | 2615 | ||
2514 | /* Check the PCI resources for this channel are enabled */ | 2616 | /* Check the PCI resources for this channel are enabled */ |
2515 | port = port * 2; | 2617 | port = port * 2; |
2516 | for (i = 0; i < 2; i ++) { | 2618 | for (i = 0; i < 2; i++) { |
2517 | if (pci_resource_start(pdev, port + i) == 0 || | 2619 | if (pci_resource_start(pdev, port + i) == 0 || |
2518 | pci_resource_len(pdev, port + i) == 0) | 2620 | pci_resource_len(pdev, port + i) == 0) |
2519 | return 0; | 2621 | return 0; |
@@ -2598,6 +2700,7 @@ int ata_pci_sff_init_host(struct ata_host *host) | |||
2598 | 2700 | ||
2599 | return 0; | 2701 | return 0; |
2600 | } | 2702 | } |
2703 | EXPORT_SYMBOL_GPL(ata_pci_sff_init_host); | ||
2601 | 2704 | ||
2602 | /** | 2705 | /** |
2603 | * ata_pci_sff_prepare_host - helper to prepare native PCI ATA host | 2706 | * ata_pci_sff_prepare_host - helper to prepare native PCI ATA host |
@@ -2615,7 +2718,7 @@ int ata_pci_sff_init_host(struct ata_host *host) | |||
2615 | * 0 on success, -errno otherwise. | 2718 | * 0 on success, -errno otherwise. |
2616 | */ | 2719 | */ |
2617 | int ata_pci_sff_prepare_host(struct pci_dev *pdev, | 2720 | int ata_pci_sff_prepare_host(struct pci_dev *pdev, |
2618 | const struct ata_port_info * const * ppi, | 2721 | const struct ata_port_info * const *ppi, |
2619 | struct ata_host **r_host) | 2722 | struct ata_host **r_host) |
2620 | { | 2723 | { |
2621 | struct ata_host *host; | 2724 | struct ata_host *host; |
@@ -2645,17 +2748,18 @@ int ata_pci_sff_prepare_host(struct pci_dev *pdev, | |||
2645 | *r_host = host; | 2748 | *r_host = host; |
2646 | return 0; | 2749 | return 0; |
2647 | 2750 | ||
2648 | err_bmdma: | 2751 | err_bmdma: |
2649 | /* This is necessary because PCI and iomap resources are | 2752 | /* This is necessary because PCI and iomap resources are |
2650 | * merged and releasing the top group won't release the | 2753 | * merged and releasing the top group won't release the |
2651 | * acquired resources if some of those have been acquired | 2754 | * acquired resources if some of those have been acquired |
2652 | * before entering this function. | 2755 | * before entering this function. |
2653 | */ | 2756 | */ |
2654 | pcim_iounmap_regions(pdev, 0xf); | 2757 | pcim_iounmap_regions(pdev, 0xf); |
2655 | err_out: | 2758 | err_out: |
2656 | devres_release_group(&pdev->dev, NULL); | 2759 | devres_release_group(&pdev->dev, NULL); |
2657 | return rc; | 2760 | return rc; |
2658 | } | 2761 | } |
2762 | EXPORT_SYMBOL_GPL(ata_pci_sff_prepare_host); | ||
2659 | 2763 | ||
2660 | /** | 2764 | /** |
2661 | * ata_pci_sff_activate_host - start SFF host, request IRQ and register it | 2765 | * ata_pci_sff_activate_host - start SFF host, request IRQ and register it |
@@ -2741,7 +2845,7 @@ int ata_pci_sff_activate_host(struct ata_host *host, | |||
2741 | } | 2845 | } |
2742 | 2846 | ||
2743 | rc = ata_host_register(host, sht); | 2847 | rc = ata_host_register(host, sht); |
2744 | out: | 2848 | out: |
2745 | if (rc == 0) | 2849 | if (rc == 0) |
2746 | devres_remove_group(dev, NULL); | 2850 | devres_remove_group(dev, NULL); |
2747 | else | 2851 | else |
@@ -2749,6 +2853,7 @@ int ata_pci_sff_activate_host(struct ata_host *host, | |||
2749 | 2853 | ||
2750 | return rc; | 2854 | return rc; |
2751 | } | 2855 | } |
2856 | EXPORT_SYMBOL_GPL(ata_pci_sff_activate_host); | ||
2752 | 2857 | ||
2753 | /** | 2858 | /** |
2754 | * ata_pci_sff_init_one - Initialize/register PCI IDE host controller | 2859 | * ata_pci_sff_init_one - Initialize/register PCI IDE host controller |
@@ -2776,7 +2881,7 @@ int ata_pci_sff_activate_host(struct ata_host *host, | |||
2776 | * Zero on success, negative on errno-based value on error. | 2881 | * Zero on success, negative on errno-based value on error. |
2777 | */ | 2882 | */ |
2778 | int ata_pci_sff_init_one(struct pci_dev *pdev, | 2883 | int ata_pci_sff_init_one(struct pci_dev *pdev, |
2779 | const struct ata_port_info * const * ppi, | 2884 | const struct ata_port_info * const *ppi, |
2780 | struct scsi_host_template *sht, void *host_priv) | 2885 | struct scsi_host_template *sht, void *host_priv) |
2781 | { | 2886 | { |
2782 | struct device *dev = &pdev->dev; | 2887 | struct device *dev = &pdev->dev; |
@@ -2815,7 +2920,7 @@ int ata_pci_sff_init_one(struct pci_dev *pdev, | |||
2815 | 2920 | ||
2816 | pci_set_master(pdev); | 2921 | pci_set_master(pdev); |
2817 | rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht); | 2922 | rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht); |
2818 | out: | 2923 | out: |
2819 | if (rc == 0) | 2924 | if (rc == 0) |
2820 | devres_remove_group(&pdev->dev, NULL); | 2925 | devres_remove_group(&pdev->dev, NULL); |
2821 | else | 2926 | else |
@@ -2823,54 +2928,7 @@ int ata_pci_sff_init_one(struct pci_dev *pdev, | |||
2823 | 2928 | ||
2824 | return rc; | 2929 | return rc; |
2825 | } | 2930 | } |
2931 | EXPORT_SYMBOL_GPL(ata_pci_sff_init_one); | ||
2826 | 2932 | ||
2827 | #endif /* CONFIG_PCI */ | 2933 | #endif /* CONFIG_PCI */ |
2828 | 2934 | ||
2829 | EXPORT_SYMBOL_GPL(ata_sff_port_ops); | ||
2830 | EXPORT_SYMBOL_GPL(ata_bmdma_port_ops); | ||
2831 | EXPORT_SYMBOL_GPL(ata_sff_qc_prep); | ||
2832 | EXPORT_SYMBOL_GPL(ata_sff_dumb_qc_prep); | ||
2833 | EXPORT_SYMBOL_GPL(ata_sff_dev_select); | ||
2834 | EXPORT_SYMBOL_GPL(ata_sff_check_status); | ||
2835 | EXPORT_SYMBOL_GPL(ata_sff_dma_pause); | ||
2836 | EXPORT_SYMBOL_GPL(ata_sff_pause); | ||
2837 | EXPORT_SYMBOL_GPL(ata_sff_busy_sleep); | ||
2838 | EXPORT_SYMBOL_GPL(ata_sff_wait_ready); | ||
2839 | EXPORT_SYMBOL_GPL(ata_sff_tf_load); | ||
2840 | EXPORT_SYMBOL_GPL(ata_sff_tf_read); | ||
2841 | EXPORT_SYMBOL_GPL(ata_sff_exec_command); | ||
2842 | EXPORT_SYMBOL_GPL(ata_sff_data_xfer); | ||
2843 | EXPORT_SYMBOL_GPL(ata_sff_data_xfer_noirq); | ||
2844 | EXPORT_SYMBOL_GPL(ata_sff_irq_on); | ||
2845 | EXPORT_SYMBOL_GPL(ata_sff_irq_clear); | ||
2846 | EXPORT_SYMBOL_GPL(ata_sff_hsm_move); | ||
2847 | EXPORT_SYMBOL_GPL(ata_sff_qc_issue); | ||
2848 | EXPORT_SYMBOL_GPL(ata_sff_qc_fill_rtf); | ||
2849 | EXPORT_SYMBOL_GPL(ata_sff_host_intr); | ||
2850 | EXPORT_SYMBOL_GPL(ata_sff_interrupt); | ||
2851 | EXPORT_SYMBOL_GPL(ata_sff_freeze); | ||
2852 | EXPORT_SYMBOL_GPL(ata_sff_thaw); | ||
2853 | EXPORT_SYMBOL_GPL(ata_sff_prereset); | ||
2854 | EXPORT_SYMBOL_GPL(ata_sff_dev_classify); | ||
2855 | EXPORT_SYMBOL_GPL(ata_sff_wait_after_reset); | ||
2856 | EXPORT_SYMBOL_GPL(ata_sff_softreset); | ||
2857 | EXPORT_SYMBOL_GPL(sata_sff_hardreset); | ||
2858 | EXPORT_SYMBOL_GPL(ata_sff_postreset); | ||
2859 | EXPORT_SYMBOL_GPL(ata_sff_error_handler); | ||
2860 | EXPORT_SYMBOL_GPL(ata_sff_post_internal_cmd); | ||
2861 | EXPORT_SYMBOL_GPL(ata_sff_port_start); | ||
2862 | EXPORT_SYMBOL_GPL(ata_sff_std_ports); | ||
2863 | EXPORT_SYMBOL_GPL(ata_bmdma_mode_filter); | ||
2864 | EXPORT_SYMBOL_GPL(ata_bmdma_setup); | ||
2865 | EXPORT_SYMBOL_GPL(ata_bmdma_start); | ||
2866 | EXPORT_SYMBOL_GPL(ata_bmdma_stop); | ||
2867 | EXPORT_SYMBOL_GPL(ata_bmdma_status); | ||
2868 | EXPORT_SYMBOL_GPL(ata_bus_reset); | ||
2869 | #ifdef CONFIG_PCI | ||
2870 | EXPORT_SYMBOL_GPL(ata_pci_bmdma_clear_simplex); | ||
2871 | EXPORT_SYMBOL_GPL(ata_pci_bmdma_init); | ||
2872 | EXPORT_SYMBOL_GPL(ata_pci_sff_init_host); | ||
2873 | EXPORT_SYMBOL_GPL(ata_pci_sff_prepare_host); | ||
2874 | EXPORT_SYMBOL_GPL(ata_pci_sff_activate_host); | ||
2875 | EXPORT_SYMBOL_GPL(ata_pci_sff_init_one); | ||
2876 | #endif /* CONFIG_PCI */ | ||
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c index e2e332d8ff95..8b77a9802df1 100644 --- a/drivers/ata/pata_acpi.c +++ b/drivers/ata/pata_acpi.c | |||
@@ -13,12 +13,6 @@ | |||
13 | #include <linux/device.h> | 13 | #include <linux/device.h> |
14 | #include <scsi/scsi_host.h> | 14 | #include <scsi/scsi_host.h> |
15 | #include <acpi/acpi_bus.h> | 15 | #include <acpi/acpi_bus.h> |
16 | #include <acpi/acnames.h> | ||
17 | #include <acpi/acnamesp.h> | ||
18 | #include <acpi/acparser.h> | ||
19 | #include <acpi/acexcep.h> | ||
20 | #include <acpi/acmacros.h> | ||
21 | #include <acpi/actypes.h> | ||
22 | 16 | ||
23 | #include <linux/libata.h> | 17 | #include <linux/libata.h> |
24 | #include <linux/ata.h> | 18 | #include <linux/ata.h> |
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index 73c466e452ca..a7999c19f0c9 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -19,7 +19,9 @@ | |||
19 | * | 19 | * |
20 | * TODO/CHECK | 20 | * TODO/CHECK |
21 | * Cannot have ATAPI on both master & slave for rev < c2 (???) but | 21 | * Cannot have ATAPI on both master & slave for rev < c2 (???) but |
22 | * otherwise should do atapi DMA. | 22 | * otherwise should do atapi DMA (For now for old we do PIO only for |
23 | * ATAPI) | ||
24 | * Review Sunblade workaround. | ||
23 | */ | 25 | */ |
24 | 26 | ||
25 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
@@ -33,12 +35,14 @@ | |||
33 | #include <linux/dmi.h> | 35 | #include <linux/dmi.h> |
34 | 36 | ||
35 | #define DRV_NAME "pata_ali" | 37 | #define DRV_NAME "pata_ali" |
36 | #define DRV_VERSION "0.7.5" | 38 | #define DRV_VERSION "0.7.8" |
37 | 39 | ||
38 | static int ali_atapi_dma = 0; | 40 | static int ali_atapi_dma = 0; |
39 | module_param_named(atapi_dma, ali_atapi_dma, int, 0644); | 41 | module_param_named(atapi_dma, ali_atapi_dma, int, 0644); |
40 | MODULE_PARM_DESC(atapi_dma, "Enable ATAPI DMA (0=disable, 1=enable)"); | 42 | MODULE_PARM_DESC(atapi_dma, "Enable ATAPI DMA (0=disable, 1=enable)"); |
41 | 43 | ||
44 | static struct pci_dev *isa_bridge; | ||
45 | |||
42 | /* | 46 | /* |
43 | * Cable special cases | 47 | * Cable special cases |
44 | */ | 48 | */ |
@@ -147,8 +151,7 @@ static void ali_fifo_control(struct ata_port *ap, struct ata_device *adev, int o | |||
147 | 151 | ||
148 | pci_read_config_byte(pdev, pio_fifo, &fifo); | 152 | pci_read_config_byte(pdev, pio_fifo, &fifo); |
149 | fifo &= ~(0x0F << shift); | 153 | fifo &= ~(0x0F << shift); |
150 | if (on) | 154 | fifo |= (on << shift); |
151 | fifo |= (on << shift); | ||
152 | pci_write_config_byte(pdev, pio_fifo, fifo); | 155 | pci_write_config_byte(pdev, pio_fifo, fifo); |
153 | } | 156 | } |
154 | 157 | ||
@@ -337,6 +340,23 @@ static int ali_check_atapi_dma(struct ata_queued_cmd *qc) | |||
337 | return 0; | 340 | return 0; |
338 | } | 341 | } |
339 | 342 | ||
343 | static void ali_c2_c3_postreset(struct ata_link *link, unsigned int *classes) | ||
344 | { | ||
345 | u8 r; | ||
346 | int port_bit = 4 << link->ap->port_no; | ||
347 | |||
348 | /* If our bridge is an ALI 1533 then do the extra work */ | ||
349 | if (isa_bridge) { | ||
350 | /* Tristate and re-enable the bus signals */ | ||
351 | pci_read_config_byte(isa_bridge, 0x58, &r); | ||
352 | r &= ~port_bit; | ||
353 | pci_write_config_byte(isa_bridge, 0x58, r); | ||
354 | r |= port_bit; | ||
355 | pci_write_config_byte(isa_bridge, 0x58, r); | ||
356 | } | ||
357 | ata_sff_postreset(link, classes); | ||
358 | } | ||
359 | |||
340 | static struct scsi_host_template ali_sht = { | 360 | static struct scsi_host_template ali_sht = { |
341 | ATA_BMDMA_SHT(DRV_NAME), | 361 | ATA_BMDMA_SHT(DRV_NAME), |
342 | }; | 362 | }; |
@@ -349,10 +369,11 @@ static struct ata_port_operations ali_early_port_ops = { | |||
349 | .inherits = &ata_sff_port_ops, | 369 | .inherits = &ata_sff_port_ops, |
350 | .cable_detect = ata_cable_40wire, | 370 | .cable_detect = ata_cable_40wire, |
351 | .set_piomode = ali_set_piomode, | 371 | .set_piomode = ali_set_piomode, |
372 | .sff_data_xfer = ata_sff_data_xfer32, | ||
352 | }; | 373 | }; |
353 | 374 | ||
354 | static const struct ata_port_operations ali_dma_base_ops = { | 375 | static const struct ata_port_operations ali_dma_base_ops = { |
355 | .inherits = &ata_bmdma_port_ops, | 376 | .inherits = &ata_bmdma32_port_ops, |
356 | .set_piomode = ali_set_piomode, | 377 | .set_piomode = ali_set_piomode, |
357 | .set_dmamode = ali_set_dmamode, | 378 | .set_dmamode = ali_set_dmamode, |
358 | }; | 379 | }; |
@@ -377,6 +398,17 @@ static struct ata_port_operations ali_c2_port_ops = { | |||
377 | .check_atapi_dma = ali_check_atapi_dma, | 398 | .check_atapi_dma = ali_check_atapi_dma, |
378 | .cable_detect = ali_c2_cable_detect, | 399 | .cable_detect = ali_c2_cable_detect, |
379 | .dev_config = ali_lock_sectors, | 400 | .dev_config = ali_lock_sectors, |
401 | .postreset = ali_c2_c3_postreset, | ||
402 | }; | ||
403 | |||
404 | /* | ||
405 | * Port operations for DMA capable ALi with cable detect | ||
406 | */ | ||
407 | static struct ata_port_operations ali_c4_port_ops = { | ||
408 | .inherits = &ali_dma_base_ops, | ||
409 | .check_atapi_dma = ali_check_atapi_dma, | ||
410 | .cable_detect = ali_c2_cable_detect, | ||
411 | .dev_config = ali_lock_sectors, | ||
380 | }; | 412 | }; |
381 | 413 | ||
382 | /* | 414 | /* |
@@ -401,52 +433,49 @@ static struct ata_port_operations ali_c5_port_ops = { | |||
401 | static void ali_init_chipset(struct pci_dev *pdev) | 433 | static void ali_init_chipset(struct pci_dev *pdev) |
402 | { | 434 | { |
403 | u8 tmp; | 435 | u8 tmp; |
404 | struct pci_dev *north, *isa_bridge; | 436 | struct pci_dev *north; |
405 | 437 | ||
406 | /* | 438 | /* |
407 | * The chipset revision selects the driver operations and | 439 | * The chipset revision selects the driver operations and |
408 | * mode data. | 440 | * mode data. |
409 | */ | 441 | */ |
410 | 442 | ||
411 | if (pdev->revision >= 0x20 && pdev->revision < 0xC2) { | 443 | if (pdev->revision <= 0x20) { |
412 | /* 1543-E/F, 1543C-C, 1543C-D, 1543C-E */ | 444 | pci_read_config_byte(pdev, 0x53, &tmp); |
413 | pci_read_config_byte(pdev, 0x4B, &tmp); | 445 | tmp |= 0x03; |
414 | /* Clear CD-ROM DMA write bit */ | 446 | pci_write_config_byte(pdev, 0x53, tmp); |
415 | tmp &= 0x7F; | 447 | } else { |
416 | pci_write_config_byte(pdev, 0x4B, tmp); | 448 | pci_read_config_byte(pdev, 0x4a, &tmp); |
417 | } else if (pdev->revision >= 0xC2) { | 449 | pci_write_config_byte(pdev, 0x4a, tmp | 0x20); |
418 | /* Enable cable detection logic */ | ||
419 | pci_read_config_byte(pdev, 0x4B, &tmp); | 450 | pci_read_config_byte(pdev, 0x4B, &tmp); |
420 | pci_write_config_byte(pdev, 0x4B, tmp | 0x08); | 451 | if (pdev->revision < 0xC2) |
421 | } | 452 | /* 1543-E/F, 1543C-C, 1543C-D, 1543C-E */ |
422 | north = pci_get_bus_and_slot(0, PCI_DEVFN(0,0)); | 453 | /* Clear CD-ROM DMA write bit */ |
423 | isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); | 454 | tmp &= 0x7F; |
424 | 455 | /* Cable and UDMA */ | |
425 | if (north && north->vendor == PCI_VENDOR_ID_AL && isa_bridge) { | 456 | pci_write_config_byte(pdev, 0x4B, tmp | 0x09); |
426 | /* Configure the ALi bridge logic. For non ALi rely on BIOS. | ||
427 | Set the south bridge enable bit */ | ||
428 | pci_read_config_byte(isa_bridge, 0x79, &tmp); | ||
429 | if (pdev->revision == 0xC2) | ||
430 | pci_write_config_byte(isa_bridge, 0x79, tmp | 0x04); | ||
431 | else if (pdev->revision > 0xC2 && pdev->revision < 0xC5) | ||
432 | pci_write_config_byte(isa_bridge, 0x79, tmp | 0x02); | ||
433 | } | ||
434 | if (pdev->revision >= 0x20) { | ||
435 | /* | 457 | /* |
436 | * CD_ROM DMA on (0x53 bit 0). Enable this even if we want | 458 | * CD_ROM DMA on (0x53 bit 0). Enable this even if we want |
437 | * to use PIO. 0x53 bit 1 (rev 20 only) - enable FIFO control | 459 | * to use PIO. 0x53 bit 1 (rev 20 only) - enable FIFO control |
438 | * via 0x54/55. | 460 | * via 0x54/55. |
439 | */ | 461 | */ |
440 | pci_read_config_byte(pdev, 0x53, &tmp); | 462 | pci_read_config_byte(pdev, 0x53, &tmp); |
441 | if (pdev->revision <= 0x20) | ||
442 | tmp &= ~0x02; | ||
443 | if (pdev->revision >= 0xc7) | 463 | if (pdev->revision >= 0xc7) |
444 | tmp |= 0x03; | 464 | tmp |= 0x03; |
445 | else | 465 | else |
446 | tmp |= 0x01; /* CD_ROM enable for DMA */ | 466 | tmp |= 0x01; /* CD_ROM enable for DMA */ |
447 | pci_write_config_byte(pdev, 0x53, tmp); | 467 | pci_write_config_byte(pdev, 0x53, tmp); |
448 | } | 468 | } |
449 | pci_dev_put(isa_bridge); | 469 | north = pci_get_bus_and_slot(0, PCI_DEVFN(0,0)); |
470 | if (north && north->vendor == PCI_VENDOR_ID_AL && isa_bridge) { | ||
471 | /* Configure the ALi bridge logic. For non ALi rely on BIOS. | ||
472 | Set the south bridge enable bit */ | ||
473 | pci_read_config_byte(isa_bridge, 0x79, &tmp); | ||
474 | if (pdev->revision == 0xC2) | ||
475 | pci_write_config_byte(isa_bridge, 0x79, tmp | 0x04); | ||
476 | else if (pdev->revision > 0xC2 && pdev->revision < 0xC5) | ||
477 | pci_write_config_byte(isa_bridge, 0x79, tmp | 0x02); | ||
478 | } | ||
450 | pci_dev_put(north); | 479 | pci_dev_put(north); |
451 | ata_pci_bmdma_clear_simplex(pdev); | 480 | ata_pci_bmdma_clear_simplex(pdev); |
452 | } | 481 | } |
@@ -503,7 +532,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
503 | .pio_mask = 0x1f, | 532 | .pio_mask = 0x1f, |
504 | .mwdma_mask = 0x07, | 533 | .mwdma_mask = 0x07, |
505 | .udma_mask = ATA_UDMA5, | 534 | .udma_mask = ATA_UDMA5, |
506 | .port_ops = &ali_c2_port_ops | 535 | .port_ops = &ali_c4_port_ops |
507 | }; | 536 | }; |
508 | /* Revision 0xC5 is UDMA133 with LBA48 DMA */ | 537 | /* Revision 0xC5 is UDMA133 with LBA48 DMA */ |
509 | static const struct ata_port_info info_c5 = { | 538 | static const struct ata_port_info info_c5 = { |
@@ -516,7 +545,6 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
516 | 545 | ||
517 | const struct ata_port_info *ppi[] = { NULL, NULL }; | 546 | const struct ata_port_info *ppi[] = { NULL, NULL }; |
518 | u8 tmp; | 547 | u8 tmp; |
519 | struct pci_dev *isa_bridge; | ||
520 | int rc; | 548 | int rc; |
521 | 549 | ||
522 | rc = pcim_enable_device(pdev); | 550 | rc = pcim_enable_device(pdev); |
@@ -543,14 +571,12 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
543 | 571 | ||
544 | ali_init_chipset(pdev); | 572 | ali_init_chipset(pdev); |
545 | 573 | ||
546 | isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); | ||
547 | if (isa_bridge && pdev->revision >= 0x20 && pdev->revision < 0xC2) { | 574 | if (isa_bridge && pdev->revision >= 0x20 && pdev->revision < 0xC2) { |
548 | /* Are we paired with a UDMA capable chip */ | 575 | /* Are we paired with a UDMA capable chip */ |
549 | pci_read_config_byte(isa_bridge, 0x5E, &tmp); | 576 | pci_read_config_byte(isa_bridge, 0x5E, &tmp); |
550 | if ((tmp & 0x1E) == 0x12) | 577 | if ((tmp & 0x1E) == 0x12) |
551 | ppi[0] = &info_20_udma; | 578 | ppi[0] = &info_20_udma; |
552 | } | 579 | } |
553 | pci_dev_put(isa_bridge); | ||
554 | 580 | ||
555 | return ata_pci_sff_init_one(pdev, ppi, &ali_sht, NULL); | 581 | return ata_pci_sff_init_one(pdev, ppi, &ali_sht, NULL); |
556 | } | 582 | } |
@@ -590,13 +616,20 @@ static struct pci_driver ali_pci_driver = { | |||
590 | 616 | ||
591 | static int __init ali_init(void) | 617 | static int __init ali_init(void) |
592 | { | 618 | { |
593 | return pci_register_driver(&ali_pci_driver); | 619 | int ret; |
620 | isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); | ||
621 | |||
622 | ret = pci_register_driver(&ali_pci_driver); | ||
623 | if (ret < 0) | ||
624 | pci_dev_put(isa_bridge); | ||
625 | return ret; | ||
594 | } | 626 | } |
595 | 627 | ||
596 | 628 | ||
597 | static void __exit ali_exit(void) | 629 | static void __exit ali_exit(void) |
598 | { | 630 | { |
599 | pci_unregister_driver(&ali_pci_driver); | 631 | pci_unregister_driver(&ali_pci_driver); |
632 | pci_dev_put(isa_bridge); | ||
600 | } | 633 | } |
601 | 634 | ||
602 | 635 | ||
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c index 0ec9c7d9fe9d..63719ab9ea44 100644 --- a/drivers/ata/pata_amd.c +++ b/drivers/ata/pata_amd.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/libata.h> | 24 | #include <linux/libata.h> |
25 | 25 | ||
26 | #define DRV_NAME "pata_amd" | 26 | #define DRV_NAME "pata_amd" |
27 | #define DRV_VERSION "0.3.10" | 27 | #define DRV_VERSION "0.3.11" |
28 | 28 | ||
29 | /** | 29 | /** |
30 | * timing_setup - shared timing computation and load | 30 | * timing_setup - shared timing computation and load |
@@ -345,7 +345,7 @@ static struct scsi_host_template amd_sht = { | |||
345 | }; | 345 | }; |
346 | 346 | ||
347 | static const struct ata_port_operations amd_base_port_ops = { | 347 | static const struct ata_port_operations amd_base_port_ops = { |
348 | .inherits = &ata_bmdma_port_ops, | 348 | .inherits = &ata_bmdma32_port_ops, |
349 | .prereset = amd_pre_reset, | 349 | .prereset = amd_pre_reset, |
350 | }; | 350 | }; |
351 | 351 | ||
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c index e0c4f05d7d57..65c28e5a6cd7 100644 --- a/drivers/ata/pata_hpt366.c +++ b/drivers/ata/pata_hpt366.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #define DRV_VERSION "0.6.2" | 30 | #define DRV_VERSION "0.6.2" |
31 | 31 | ||
32 | struct hpt_clock { | 32 | struct hpt_clock { |
33 | u8 xfer_speed; | 33 | u8 xfer_mode; |
34 | u32 timing; | 34 | u32 timing; |
35 | }; | 35 | }; |
36 | 36 | ||
@@ -189,28 +189,6 @@ static unsigned long hpt366_filter(struct ata_device *adev, unsigned long mask) | |||
189 | return ata_bmdma_mode_filter(adev, mask); | 189 | return ata_bmdma_mode_filter(adev, mask); |
190 | } | 190 | } |
191 | 191 | ||
192 | /** | ||
193 | * hpt36x_find_mode - reset the hpt36x bus | ||
194 | * @ap: ATA port | ||
195 | * @speed: transfer mode | ||
196 | * | ||
197 | * Return the 32bit register programming information for this channel | ||
198 | * that matches the speed provided. | ||
199 | */ | ||
200 | |||
201 | static u32 hpt36x_find_mode(struct ata_port *ap, int speed) | ||
202 | { | ||
203 | struct hpt_clock *clocks = ap->host->private_data; | ||
204 | |||
205 | while(clocks->xfer_speed) { | ||
206 | if (clocks->xfer_speed == speed) | ||
207 | return clocks->timing; | ||
208 | clocks++; | ||
209 | } | ||
210 | BUG(); | ||
211 | return 0xffffffffU; /* silence compiler warning */ | ||
212 | } | ||
213 | |||
214 | static int hpt36x_cable_detect(struct ata_port *ap) | 192 | static int hpt36x_cable_detect(struct ata_port *ap) |
215 | { | 193 | { |
216 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 194 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
@@ -226,25 +204,16 @@ static int hpt36x_cable_detect(struct ata_port *ap) | |||
226 | return ATA_CBL_PATA80; | 204 | return ATA_CBL_PATA80; |
227 | } | 205 | } |
228 | 206 | ||
229 | /** | 207 | static void hpt366_set_mode(struct ata_port *ap, struct ata_device *adev, |
230 | * hpt366_set_piomode - PIO setup | 208 | u8 mode) |
231 | * @ap: ATA interface | ||
232 | * @adev: device on the interface | ||
233 | * | ||
234 | * Perform PIO mode setup. | ||
235 | */ | ||
236 | |||
237 | static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev) | ||
238 | { | 209 | { |
210 | struct hpt_clock *clocks = ap->host->private_data; | ||
239 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 211 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
240 | u32 addr1, addr2; | 212 | u32 addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); |
241 | u32 reg; | 213 | u32 addr2 = 0x51 + 4 * ap->port_no; |
242 | u32 mode; | 214 | u32 mask, reg; |
243 | u8 fast; | 215 | u8 fast; |
244 | 216 | ||
245 | addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); | ||
246 | addr2 = 0x51 + 4 * ap->port_no; | ||
247 | |||
248 | /* Fast interrupt prediction disable, hold off interrupt disable */ | 217 | /* Fast interrupt prediction disable, hold off interrupt disable */ |
249 | pci_read_config_byte(pdev, addr2, &fast); | 218 | pci_read_config_byte(pdev, addr2, &fast); |
250 | if (fast & 0x80) { | 219 | if (fast & 0x80) { |
@@ -252,12 +221,43 @@ static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
252 | pci_write_config_byte(pdev, addr2, fast); | 221 | pci_write_config_byte(pdev, addr2, fast); |
253 | } | 222 | } |
254 | 223 | ||
224 | /* determine timing mask and find matching clock entry */ | ||
225 | if (mode < XFER_MW_DMA_0) | ||
226 | mask = 0xc1f8ffff; | ||
227 | else if (mode < XFER_UDMA_0) | ||
228 | mask = 0x303800ff; | ||
229 | else | ||
230 | mask = 0x30070000; | ||
231 | |||
232 | while (clocks->xfer_mode) { | ||
233 | if (clocks->xfer_mode == mode) | ||
234 | break; | ||
235 | clocks++; | ||
236 | } | ||
237 | if (!clocks->xfer_mode) | ||
238 | BUG(); | ||
239 | |||
240 | /* | ||
241 | * Combine new mode bits with old config bits and disable | ||
242 | * on-chip PIO FIFO/buffer (and PIO MST mode as well) to avoid | ||
243 | * problems handling I/O errors later. | ||
244 | */ | ||
255 | pci_read_config_dword(pdev, addr1, ®); | 245 | pci_read_config_dword(pdev, addr1, ®); |
256 | mode = hpt36x_find_mode(ap, adev->pio_mode); | 246 | reg = ((reg & ~mask) | (clocks->timing & mask)) & ~0xc0000000; |
257 | mode &= ~0x8000000; /* No FIFO in PIO */ | 247 | pci_write_config_dword(pdev, addr1, reg); |
258 | mode &= ~0x30070000; /* Leave config bits alone */ | 248 | } |
259 | reg &= 0x30070000; /* Strip timing bits */ | 249 | |
260 | pci_write_config_dword(pdev, addr1, reg | mode); | 250 | /** |
251 | * hpt366_set_piomode - PIO setup | ||
252 | * @ap: ATA interface | ||
253 | * @adev: device on the interface | ||
254 | * | ||
255 | * Perform PIO mode setup. | ||
256 | */ | ||
257 | |||
258 | static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev) | ||
259 | { | ||
260 | hpt366_set_mode(ap, adev, adev->pio_mode); | ||
261 | } | 261 | } |
262 | 262 | ||
263 | /** | 263 | /** |
@@ -271,28 +271,7 @@ static void hpt366_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
271 | 271 | ||
272 | static void hpt366_set_dmamode(struct ata_port *ap, struct ata_device *adev) | 272 | static void hpt366_set_dmamode(struct ata_port *ap, struct ata_device *adev) |
273 | { | 273 | { |
274 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 274 | hpt366_set_mode(ap, adev, adev->dma_mode); |
275 | u32 addr1, addr2; | ||
276 | u32 reg; | ||
277 | u32 mode; | ||
278 | u8 fast; | ||
279 | |||
280 | addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); | ||
281 | addr2 = 0x51 + 4 * ap->port_no; | ||
282 | |||
283 | /* Fast interrupt prediction disable, hold off interrupt disable */ | ||
284 | pci_read_config_byte(pdev, addr2, &fast); | ||
285 | if (fast & 0x80) { | ||
286 | fast &= ~0x80; | ||
287 | pci_write_config_byte(pdev, addr2, fast); | ||
288 | } | ||
289 | |||
290 | pci_read_config_dword(pdev, addr1, ®); | ||
291 | mode = hpt36x_find_mode(ap, adev->dma_mode); | ||
292 | mode |= 0x8000000; /* FIFO in MWDMA or UDMA */ | ||
293 | mode &= ~0xC0000000; /* Leave config bits alone */ | ||
294 | reg &= 0xC0000000; /* Strip timing bits */ | ||
295 | pci_write_config_dword(pdev, addr1, reg | mode); | ||
296 | } | 275 | } |
297 | 276 | ||
298 | static struct scsi_host_template hpt36x_sht = { | 277 | static struct scsi_host_template hpt36x_sht = { |
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c index f11a320337c0..f19cc645881a 100644 --- a/drivers/ata/pata_hpt3x3.c +++ b/drivers/ata/pata_hpt3x3.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/libata.h> | 23 | #include <linux/libata.h> |
24 | 24 | ||
25 | #define DRV_NAME "pata_hpt3x3" | 25 | #define DRV_NAME "pata_hpt3x3" |
26 | #define DRV_VERSION "0.5.3" | 26 | #define DRV_VERSION "0.6.1" |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * hpt3x3_set_piomode - PIO setup | 29 | * hpt3x3_set_piomode - PIO setup |
@@ -80,14 +80,48 @@ static void hpt3x3_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
80 | r2 &= ~(0x11 << dn); /* Clear MWDMA and UDMA bits */ | 80 | r2 &= ~(0x11 << dn); /* Clear MWDMA and UDMA bits */ |
81 | 81 | ||
82 | if (adev->dma_mode >= XFER_UDMA_0) | 82 | if (adev->dma_mode >= XFER_UDMA_0) |
83 | r2 |= (0x10 << dn); /* Ultra mode */ | 83 | r2 |= (0x01 << dn); /* Ultra mode */ |
84 | else | 84 | else |
85 | r2 |= (0x01 << dn); /* MWDMA */ | 85 | r2 |= (0x10 << dn); /* MWDMA */ |
86 | 86 | ||
87 | pci_write_config_dword(pdev, 0x44, r1); | 87 | pci_write_config_dword(pdev, 0x44, r1); |
88 | pci_write_config_dword(pdev, 0x48, r2); | 88 | pci_write_config_dword(pdev, 0x48, r2); |
89 | } | 89 | } |
90 | #endif /* CONFIG_PATA_HPT3X3_DMA */ | 90 | |
91 | /** | ||
92 | * hpt3x3_freeze - DMA workaround | ||
93 | * @ap: port to freeze | ||
94 | * | ||
95 | * When freezing an HPT3x3 we must stop any pending DMA before | ||
96 | * writing to the control register or the chip will hang | ||
97 | */ | ||
98 | |||
99 | static void hpt3x3_freeze(struct ata_port *ap) | ||
100 | { | ||
101 | void __iomem *mmio = ap->ioaddr.bmdma_addr; | ||
102 | |||
103 | iowrite8(ioread8(mmio + ATA_DMA_CMD) & ~ ATA_DMA_START, | ||
104 | mmio + ATA_DMA_CMD); | ||
105 | ata_sff_dma_pause(ap); | ||
106 | ata_sff_freeze(ap); | ||
107 | } | ||
108 | |||
109 | /** | ||
110 | * hpt3x3_bmdma_setup - DMA workaround | ||
111 | * @qc: Queued command | ||
112 | * | ||
113 | * When issuing BMDMA we must clean up the error/active bits in | ||
114 | * software on this device | ||
115 | */ | ||
116 | |||
117 | static void hpt3x3_bmdma_setup(struct ata_queued_cmd *qc) | ||
118 | { | ||
119 | struct ata_port *ap = qc->ap; | ||
120 | u8 r = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | ||
121 | r |= ATA_DMA_INTR | ATA_DMA_ERR; | ||
122 | iowrite8(r, ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | ||
123 | return ata_bmdma_setup(qc); | ||
124 | } | ||
91 | 125 | ||
92 | /** | 126 | /** |
93 | * hpt3x3_atapi_dma - ATAPI DMA check | 127 | * hpt3x3_atapi_dma - ATAPI DMA check |
@@ -101,18 +135,23 @@ static int hpt3x3_atapi_dma(struct ata_queued_cmd *qc) | |||
101 | return 1; | 135 | return 1; |
102 | } | 136 | } |
103 | 137 | ||
138 | #endif /* CONFIG_PATA_HPT3X3_DMA */ | ||
139 | |||
104 | static struct scsi_host_template hpt3x3_sht = { | 140 | static struct scsi_host_template hpt3x3_sht = { |
105 | ATA_BMDMA_SHT(DRV_NAME), | 141 | ATA_BMDMA_SHT(DRV_NAME), |
106 | }; | 142 | }; |
107 | 143 | ||
108 | static struct ata_port_operations hpt3x3_port_ops = { | 144 | static struct ata_port_operations hpt3x3_port_ops = { |
109 | .inherits = &ata_bmdma_port_ops, | 145 | .inherits = &ata_bmdma_port_ops, |
110 | .check_atapi_dma= hpt3x3_atapi_dma, | ||
111 | .cable_detect = ata_cable_40wire, | 146 | .cable_detect = ata_cable_40wire, |
112 | .set_piomode = hpt3x3_set_piomode, | 147 | .set_piomode = hpt3x3_set_piomode, |
113 | #if defined(CONFIG_PATA_HPT3X3_DMA) | 148 | #if defined(CONFIG_PATA_HPT3X3_DMA) |
114 | .set_dmamode = hpt3x3_set_dmamode, | 149 | .set_dmamode = hpt3x3_set_dmamode, |
150 | .bmdma_setup = hpt3x3_bmdma_setup, | ||
151 | .check_atapi_dma= hpt3x3_atapi_dma, | ||
152 | .freeze = hpt3x3_freeze, | ||
115 | #endif | 153 | #endif |
154 | |||
116 | }; | 155 | }; |
117 | 156 | ||
118 | /** | 157 | /** |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index f828a29d7756..f1bb2f9fecbf 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -80,7 +80,7 @@ | |||
80 | 80 | ||
81 | 81 | ||
82 | #define DRV_NAME "pata_it821x" | 82 | #define DRV_NAME "pata_it821x" |
83 | #define DRV_VERSION "0.4.0" | 83 | #define DRV_VERSION "0.4.2" |
84 | 84 | ||
85 | struct it821x_dev | 85 | struct it821x_dev |
86 | { | 86 | { |
@@ -494,8 +494,6 @@ static int it821x_smart_set_mode(struct ata_link *link, struct ata_device **unus | |||
494 | * special. In our case we need to lock the sector count to avoid | 494 | * special. In our case we need to lock the sector count to avoid |
495 | * blowing the brains out of the firmware with large LBA48 requests | 495 | * blowing the brains out of the firmware with large LBA48 requests |
496 | * | 496 | * |
497 | * FIXME: When FUA appears we need to block FUA too. And SMART and | ||
498 | * basically we need to filter commands for this chip. | ||
499 | */ | 497 | */ |
500 | 498 | ||
501 | static void it821x_dev_config(struct ata_device *adev) | 499 | static void it821x_dev_config(struct ata_device *adev) |
@@ -890,6 +888,13 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
890 | .flags = ATA_FLAG_SLAVE_POSS, | 888 | .flags = ATA_FLAG_SLAVE_POSS, |
891 | .pio_mask = 0x1f, | 889 | .pio_mask = 0x1f, |
892 | .mwdma_mask = 0x07, | 890 | .mwdma_mask = 0x07, |
891 | .udma_mask = ATA_UDMA6, | ||
892 | .port_ops = &it821x_rdc_port_ops | ||
893 | }; | ||
894 | static const struct ata_port_info info_rdc_11 = { | ||
895 | .flags = ATA_FLAG_SLAVE_POSS, | ||
896 | .pio_mask = 0x1f, | ||
897 | .mwdma_mask = 0x07, | ||
893 | /* No UDMA */ | 898 | /* No UDMA */ |
894 | .port_ops = &it821x_rdc_port_ops | 899 | .port_ops = &it821x_rdc_port_ops |
895 | }; | 900 | }; |
@@ -903,7 +908,11 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
903 | return rc; | 908 | return rc; |
904 | 909 | ||
905 | if (pdev->vendor == PCI_VENDOR_ID_RDC) { | 910 | if (pdev->vendor == PCI_VENDOR_ID_RDC) { |
906 | ppi[0] = &info_rdc; | 911 | /* Deal with Vortex86SX */ |
912 | if (pdev->revision == 0x11) | ||
913 | ppi[0] = &info_rdc_11; | ||
914 | else | ||
915 | ppi[0] = &info_rdc; | ||
907 | } else { | 916 | } else { |
908 | /* Force the card into bypass mode if so requested */ | 917 | /* Force the card into bypass mode if so requested */ |
909 | if (it8212_noraid) { | 918 | if (it8212_noraid) { |
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c index 7c8faa48b5f3..aa576cac4d17 100644 --- a/drivers/ata/pata_mpiix.c +++ b/drivers/ata/pata_mpiix.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include <linux/libata.h> | 35 | #include <linux/libata.h> |
36 | 36 | ||
37 | #define DRV_NAME "pata_mpiix" | 37 | #define DRV_NAME "pata_mpiix" |
38 | #define DRV_VERSION "0.7.6" | 38 | #define DRV_VERSION "0.7.7" |
39 | 39 | ||
40 | enum { | 40 | enum { |
41 | IDETIM = 0x6C, /* IDE control register */ | 41 | IDETIM = 0x6C, /* IDE control register */ |
@@ -146,6 +146,7 @@ static struct ata_port_operations mpiix_port_ops = { | |||
146 | .cable_detect = ata_cable_40wire, | 146 | .cable_detect = ata_cable_40wire, |
147 | .set_piomode = mpiix_set_piomode, | 147 | .set_piomode = mpiix_set_piomode, |
148 | .prereset = mpiix_pre_reset, | 148 | .prereset = mpiix_pre_reset, |
149 | .sff_data_xfer = ata_sff_data_xfer32, | ||
149 | }; | 150 | }; |
150 | 151 | ||
151 | static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 152 | static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c index 6afa07a37648..d8d743af3225 100644 --- a/drivers/ata/pata_platform.c +++ b/drivers/ata/pata_platform.c | |||
@@ -186,7 +186,7 @@ EXPORT_SYMBOL_GPL(__pata_platform_probe); | |||
186 | * A platform bus ATA device has been unplugged. Perform the needed | 186 | * A platform bus ATA device has been unplugged. Perform the needed |
187 | * cleanup. Also called on module unload for any active devices. | 187 | * cleanup. Also called on module unload for any active devices. |
188 | */ | 188 | */ |
189 | int __devexit __pata_platform_remove(struct device *dev) | 189 | int __pata_platform_remove(struct device *dev) |
190 | { | 190 | { |
191 | struct ata_host *host = dev_get_drvdata(dev); | 191 | struct ata_host *host = dev_get_drvdata(dev); |
192 | 192 | ||
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c index 83580a59db58..9e764e5747e6 100644 --- a/drivers/ata/pata_sil680.c +++ b/drivers/ata/pata_sil680.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <linux/libata.h> | 32 | #include <linux/libata.h> |
33 | 33 | ||
34 | #define DRV_NAME "pata_sil680" | 34 | #define DRV_NAME "pata_sil680" |
35 | #define DRV_VERSION "0.4.8" | 35 | #define DRV_VERSION "0.4.9" |
36 | 36 | ||
37 | #define SIL680_MMIO_BAR 5 | 37 | #define SIL680_MMIO_BAR 5 |
38 | 38 | ||
@@ -195,7 +195,7 @@ static struct scsi_host_template sil680_sht = { | |||
195 | }; | 195 | }; |
196 | 196 | ||
197 | static struct ata_port_operations sil680_port_ops = { | 197 | static struct ata_port_operations sil680_port_ops = { |
198 | .inherits = &ata_bmdma_port_ops, | 198 | .inherits = &ata_bmdma32_port_ops, |
199 | .cable_detect = sil680_cable_detect, | 199 | .cable_detect = sil680_cable_detect, |
200 | .set_piomode = sil680_set_piomode, | 200 | .set_piomode = sil680_set_piomode, |
201 | .set_dmamode = sil680_set_dmamode, | 201 | .set_dmamode = sil680_set_dmamode, |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index ccee930f1e12..2590c2279fa7 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -51,13 +51,6 @@ struct sil24_sge { | |||
51 | __le32 flags; | 51 | __le32 flags; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | /* | ||
55 | * Port multiplier | ||
56 | */ | ||
57 | struct sil24_port_multiplier { | ||
58 | __le32 diag; | ||
59 | __le32 sactive; | ||
60 | }; | ||
61 | 54 | ||
62 | enum { | 55 | enum { |
63 | SIL24_HOST_BAR = 0, | 56 | SIL24_HOST_BAR = 0, |