aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/ahci.c159
-rw-r--r--drivers/ata/ata_generic.c4
-rw-r--r--drivers/ata/ata_piix.c35
-rw-r--r--drivers/ata/libata-acpi.c914
-rw-r--r--drivers/ata/libata-core.c105
-rw-r--r--drivers/ata/libata-eh.c11
-rw-r--r--drivers/ata/libata-scsi.c2
-rw-r--r--drivers/ata/libata.h18
-rw-r--r--drivers/ata/pata_ali.c22
-rw-r--r--drivers/ata/pata_amd.c38
-rw-r--r--drivers/ata/pata_artop.c6
-rw-r--r--drivers/ata/pata_atiixp.c3
-rw-r--r--drivers/ata/pata_cmd640.c2
-rw-r--r--drivers/ata/pata_cmd64x.c12
-rw-r--r--drivers/ata/pata_cs5520.c4
-rw-r--r--drivers/ata/pata_cs5530.c8
-rw-r--r--drivers/ata/pata_cs5535.c4
-rw-r--r--drivers/ata/pata_cypress.c2
-rw-r--r--drivers/ata/pata_efar.c2
-rw-r--r--drivers/ata/pata_hpt366.c4
-rw-r--r--drivers/ata/pata_hpt37x.c20
-rw-r--r--drivers/ata/pata_hpt3x2n.c4
-rw-r--r--drivers/ata/pata_hpt3x3.c2
-rw-r--r--drivers/ata/pata_icside.c2
-rw-r--r--drivers/ata/pata_it8213.c4
-rw-r--r--drivers/ata/pata_it821x.c6
-rw-r--r--drivers/ata/pata_ixp4xx_cf.c76
-rw-r--r--drivers/ata/pata_jmicron.c4
-rw-r--r--drivers/ata/pata_marvell.c8
-rw-r--r--drivers/ata/pata_netcell.c4
-rw-r--r--drivers/ata/pata_ns87410.c2
-rw-r--r--drivers/ata/pata_oldpiix.c2
-rw-r--r--drivers/ata/pata_opti.c2
-rw-r--r--drivers/ata/pata_optidma.c4
-rw-r--r--drivers/ata/pata_pdc202xx_old.c6
-rw-r--r--drivers/ata/pata_platform.c6
-rw-r--r--drivers/ata/pata_radisys.c2
-rw-r--r--drivers/ata/pata_rz1000.c2
-rw-r--r--drivers/ata/pata_sc1200.c6
-rw-r--r--drivers/ata/pata_serverworks.c12
-rw-r--r--drivers/ata/pata_sil680.c21
-rw-r--r--drivers/ata/pata_sis.c14
-rw-r--r--drivers/ata/pata_sl82c105.c4
-rw-r--r--drivers/ata/pata_triflex.c2
-rw-r--r--drivers/ata/pata_via.c8
-rw-r--r--drivers/ata/pdc_adma.c20
-rw-r--r--drivers/ata/sata_inic162x.c6
-rw-r--r--drivers/ata/sata_mv.c31
-rw-r--r--drivers/ata/sata_promise.c78
-rw-r--r--drivers/ata/sata_qstor.c2
-rw-r--r--drivers/ata/sata_sil.c13
-rw-r--r--drivers/ata/sata_sil24.c8
-rw-r--r--drivers/ata/sata_sis.c2
-rw-r--r--drivers/ata/sata_svw.c15
-rw-r--r--drivers/ata/sata_sx4.c168
-rw-r--r--drivers/ata/sata_uli.c2
-rw-r--r--drivers/ata/sata_via.c10
-rw-r--r--drivers/ata/sata_vsc.c2
58 files changed, 1020 insertions, 915 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index ca5229d24d8e..11e4eb9f304e 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -46,7 +46,7 @@
46#include <linux/libata.h> 46#include <linux/libata.h>
47 47
48#define DRV_NAME "ahci" 48#define DRV_NAME "ahci"
49#define DRV_VERSION "2.2" 49#define DRV_VERSION "2.3"
50 50
51 51
52enum { 52enum {
@@ -54,7 +54,7 @@ enum {
54 AHCI_MAX_PORTS = 32, 54 AHCI_MAX_PORTS = 32,
55 AHCI_MAX_SG = 168, /* hardware max is 64K */ 55 AHCI_MAX_SG = 168, /* hardware max is 64K */
56 AHCI_DMA_BOUNDARY = 0xffffffff, 56 AHCI_DMA_BOUNDARY = 0xffffffff,
57 AHCI_USE_CLUSTERING = 0, 57 AHCI_USE_CLUSTERING = 1,
58 AHCI_MAX_CMDS = 32, 58 AHCI_MAX_CMDS = 32,
59 AHCI_CMD_SZ = 32, 59 AHCI_CMD_SZ = 32,
60 AHCI_CMD_SLOT_SZ = AHCI_MAX_CMDS * AHCI_CMD_SZ, 60 AHCI_CMD_SLOT_SZ = AHCI_MAX_CMDS * AHCI_CMD_SZ,
@@ -81,6 +81,7 @@ enum {
81 board_ahci_vt8251 = 2, 81 board_ahci_vt8251 = 2,
82 board_ahci_ign_iferr = 3, 82 board_ahci_ign_iferr = 3,
83 board_ahci_sb600 = 4, 83 board_ahci_sb600 = 4,
84 board_ahci_mv = 5,
84 85
85 /* global controller registers */ 86 /* global controller registers */
86 HOST_CAP = 0x00, /* host capabilities */ 87 HOST_CAP = 0x00, /* host capabilities */
@@ -171,6 +172,8 @@ enum {
171 AHCI_FLAG_HONOR_PI = (1 << 26), /* honor PORTS_IMPL */ 172 AHCI_FLAG_HONOR_PI = (1 << 26), /* honor PORTS_IMPL */
172 AHCI_FLAG_IGN_SERR_INTERNAL = (1 << 27), /* ignore SERR_INTERNAL */ 173 AHCI_FLAG_IGN_SERR_INTERNAL = (1 << 27), /* ignore SERR_INTERNAL */
173 AHCI_FLAG_32BIT_ONLY = (1 << 28), /* force 32bit */ 174 AHCI_FLAG_32BIT_ONLY = (1 << 28), /* force 32bit */
175 AHCI_FLAG_MV_PATA = (1 << 29), /* PATA port */
176 AHCI_FLAG_NO_MSI = (1 << 30), /* no PCI MSI */
174 177
175 AHCI_FLAG_COMMON = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 178 AHCI_FLAG_COMMON = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
176 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | 179 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
@@ -228,9 +231,12 @@ static void ahci_thaw(struct ata_port *ap);
228static void ahci_error_handler(struct ata_port *ap); 231static void ahci_error_handler(struct ata_port *ap);
229static void ahci_vt8251_error_handler(struct ata_port *ap); 232static void ahci_vt8251_error_handler(struct ata_port *ap);
230static void ahci_post_internal_cmd(struct ata_queued_cmd *qc); 233static void ahci_post_internal_cmd(struct ata_queued_cmd *qc);
234static int ahci_port_resume(struct ata_port *ap);
235static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl);
236static void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag,
237 u32 opts);
231#ifdef CONFIG_PM 238#ifdef CONFIG_PM
232static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg); 239static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg);
233static int ahci_port_resume(struct ata_port *ap);
234static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); 240static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
235static int ahci_pci_device_resume(struct pci_dev *pdev); 241static int ahci_pci_device_resume(struct pci_dev *pdev);
236#endif 242#endif
@@ -327,14 +333,14 @@ static const struct ata_port_info ahci_port_info[] = {
327 { 333 {
328 .flags = AHCI_FLAG_COMMON, 334 .flags = AHCI_FLAG_COMMON,
329 .pio_mask = 0x1f, /* pio0-4 */ 335 .pio_mask = 0x1f, /* pio0-4 */
330 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 336 .udma_mask = ATA_UDMA6,
331 .port_ops = &ahci_ops, 337 .port_ops = &ahci_ops,
332 }, 338 },
333 /* board_ahci_pi */ 339 /* board_ahci_pi */
334 { 340 {
335 .flags = AHCI_FLAG_COMMON | AHCI_FLAG_HONOR_PI, 341 .flags = AHCI_FLAG_COMMON | AHCI_FLAG_HONOR_PI,
336 .pio_mask = 0x1f, /* pio0-4 */ 342 .pio_mask = 0x1f, /* pio0-4 */
337 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 343 .udma_mask = ATA_UDMA6,
338 .port_ops = &ahci_ops, 344 .port_ops = &ahci_ops,
339 }, 345 },
340 /* board_ahci_vt8251 */ 346 /* board_ahci_vt8251 */
@@ -342,14 +348,14 @@ static const struct ata_port_info ahci_port_info[] = {
342 .flags = AHCI_FLAG_COMMON | ATA_FLAG_HRST_TO_RESUME | 348 .flags = AHCI_FLAG_COMMON | ATA_FLAG_HRST_TO_RESUME |
343 AHCI_FLAG_NO_NCQ, 349 AHCI_FLAG_NO_NCQ,
344 .pio_mask = 0x1f, /* pio0-4 */ 350 .pio_mask = 0x1f, /* pio0-4 */
345 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 351 .udma_mask = ATA_UDMA6,
346 .port_ops = &ahci_vt8251_ops, 352 .port_ops = &ahci_vt8251_ops,
347 }, 353 },
348 /* board_ahci_ign_iferr */ 354 /* board_ahci_ign_iferr */
349 { 355 {
350 .flags = AHCI_FLAG_COMMON | AHCI_FLAG_IGN_IRQ_IF_ERR, 356 .flags = AHCI_FLAG_COMMON | AHCI_FLAG_IGN_IRQ_IF_ERR,
351 .pio_mask = 0x1f, /* pio0-4 */ 357 .pio_mask = 0x1f, /* pio0-4 */
352 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 358 .udma_mask = ATA_UDMA6,
353 .port_ops = &ahci_ops, 359 .port_ops = &ahci_ops,
354 }, 360 },
355 /* board_ahci_sb600 */ 361 /* board_ahci_sb600 */
@@ -358,7 +364,19 @@ static const struct ata_port_info ahci_port_info[] = {
358 AHCI_FLAG_IGN_SERR_INTERNAL | 364 AHCI_FLAG_IGN_SERR_INTERNAL |
359 AHCI_FLAG_32BIT_ONLY, 365 AHCI_FLAG_32BIT_ONLY,
360 .pio_mask = 0x1f, /* pio0-4 */ 366 .pio_mask = 0x1f, /* pio0-4 */
361 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 367 .udma_mask = ATA_UDMA6,
368 .port_ops = &ahci_ops,
369 },
370 /* board_ahci_mv */
371 {
372 .sht = &ahci_sht,
373 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
374 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
375 ATA_FLAG_SKIP_D2H_BSY | AHCI_FLAG_HONOR_PI |
376 AHCI_FLAG_NO_NCQ | AHCI_FLAG_NO_MSI |
377 AHCI_FLAG_MV_PATA,
378 .pio_mask = 0x1f, /* pio0-4 */
379 .udma_mask = ATA_UDMA6,
362 .port_ops = &ahci_ops, 380 .port_ops = &ahci_ops,
363 }, 381 },
364}; 382};
@@ -456,6 +474,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
456 { PCI_VDEVICE(SI, 0x1185), board_ahci }, /* SiS 966 */ 474 { PCI_VDEVICE(SI, 0x1185), board_ahci }, /* SiS 966 */
457 { PCI_VDEVICE(SI, 0x0186), board_ahci }, /* SiS 968 */ 475 { PCI_VDEVICE(SI, 0x0186), board_ahci }, /* SiS 968 */
458 476
477 /* Marvell */
478 { PCI_VDEVICE(MARVELL, 0x6145), board_ahci_mv }, /* 6145 */
479
459 /* Generic, PCI class code for AHCI */ 480 /* Generic, PCI class code for AHCI */
460 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 481 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
461 PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci }, 482 PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci },
@@ -481,11 +502,17 @@ static inline int ahci_nr_ports(u32 cap)
481 return (cap & 0x1f) + 1; 502 return (cap & 0x1f) + 1;
482} 503}
483 504
484static inline void __iomem *ahci_port_base(struct ata_port *ap) 505static inline void __iomem *__ahci_port_base(struct ata_host *host,
506 unsigned int port_no)
485{ 507{
486 void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR]; 508 void __iomem *mmio = host->iomap[AHCI_PCI_BAR];
509
510 return mmio + 0x100 + (port_no * 0x80);
511}
487 512
488 return mmio + 0x100 + (ap->port_no * 0x80); 513static inline void __iomem *ahci_port_base(struct ata_port *ap)
514{
515 return __ahci_port_base(ap->host, ap->port_no);
489} 516}
490 517
491/** 518/**
@@ -535,6 +562,20 @@ static void ahci_save_initial_config(struct pci_dev *pdev,
535 hpriv->saved_port_map = port_map; 562 hpriv->saved_port_map = port_map;
536 } 563 }
537 564
565 /*
566 * Temporary Marvell 6145 hack: PATA port presence
567 * is asserted through the standard AHCI port
568 * presence register, as bit 4 (counting from 0)
569 */
570 if (pi->flags & AHCI_FLAG_MV_PATA) {
571 dev_printk(KERN_ERR, &pdev->dev,
572 "MV_AHCI HACK: port_map %x -> %x\n",
573 hpriv->port_map,
574 hpriv->port_map & 0xf);
575
576 port_map &= 0xf;
577 }
578
538 /* cross check port_map and cap.n_ports */ 579 /* cross check port_map and cap.n_ports */
539 if (pi->flags & AHCI_FLAG_HONOR_PI) { 580 if (pi->flags & AHCI_FLAG_HONOR_PI) {
540 u32 tmp_port_map = port_map; 581 u32 tmp_port_map = port_map;
@@ -740,7 +781,7 @@ static void ahci_power_down(struct ata_port *ap)
740} 781}
741#endif 782#endif
742 783
743static void ahci_init_port(struct ata_port *ap) 784static void ahci_start_port(struct ata_port *ap)
744{ 785{
745 /* enable FIS reception */ 786 /* enable FIS reception */
746 ahci_start_fis_rx(ap); 787 ahci_start_fis_rx(ap);
@@ -814,39 +855,62 @@ static int ahci_reset_controller(struct ata_host *host)
814 return 0; 855 return 0;
815} 856}
816 857
858static void ahci_port_init(struct pci_dev *pdev, struct ata_port *ap,
859 int port_no, void __iomem *mmio,
860 void __iomem *port_mmio)
861{
862 const char *emsg = NULL;
863 int rc;
864 u32 tmp;
865
866 /* make sure port is not active */
867 rc = ahci_deinit_port(ap, &emsg);
868 if (rc)
869 dev_printk(KERN_WARNING, &pdev->dev,
870 "%s (%d)\n", emsg, rc);
871
872 /* clear SError */
873 tmp = readl(port_mmio + PORT_SCR_ERR);
874 VPRINTK("PORT_SCR_ERR 0x%x\n", tmp);
875 writel(tmp, port_mmio + PORT_SCR_ERR);
876
877 /* clear port IRQ */
878 tmp = readl(port_mmio + PORT_IRQ_STAT);
879 VPRINTK("PORT_IRQ_STAT 0x%x\n", tmp);
880 if (tmp)
881 writel(tmp, port_mmio + PORT_IRQ_STAT);
882
883 writel(1 << port_no, mmio + HOST_IRQ_STAT);
884}
885
817static void ahci_init_controller(struct ata_host *host) 886static void ahci_init_controller(struct ata_host *host)
818{ 887{
819 struct pci_dev *pdev = to_pci_dev(host->dev); 888 struct pci_dev *pdev = to_pci_dev(host->dev);
820 void __iomem *mmio = host->iomap[AHCI_PCI_BAR]; 889 void __iomem *mmio = host->iomap[AHCI_PCI_BAR];
821 int i, rc; 890 int i;
891 void __iomem *port_mmio;
822 u32 tmp; 892 u32 tmp;
823 893
824 for (i = 0; i < host->n_ports; i++) { 894 if (host->ports[0]->flags & AHCI_FLAG_MV_PATA) {
825 struct ata_port *ap = host->ports[i]; 895 port_mmio = __ahci_port_base(host, 4);
826 void __iomem *port_mmio = ahci_port_base(ap);
827 const char *emsg = NULL;
828
829 if (ata_port_is_dummy(ap))
830 continue;
831
832 /* make sure port is not active */
833 rc = ahci_deinit_port(ap, &emsg);
834 if (rc)
835 dev_printk(KERN_WARNING, &pdev->dev,
836 "%s (%d)\n", emsg, rc);
837 896
838 /* clear SError */ 897 writel(0, port_mmio + PORT_IRQ_MASK);
839 tmp = readl(port_mmio + PORT_SCR_ERR);
840 VPRINTK("PORT_SCR_ERR 0x%x\n", tmp);
841 writel(tmp, port_mmio + PORT_SCR_ERR);
842 898
843 /* clear port IRQ */ 899 /* clear port IRQ */
844 tmp = readl(port_mmio + PORT_IRQ_STAT); 900 tmp = readl(port_mmio + PORT_IRQ_STAT);
845 VPRINTK("PORT_IRQ_STAT 0x%x\n", tmp); 901 VPRINTK("PORT_IRQ_STAT 0x%x\n", tmp);
846 if (tmp) 902 if (tmp)
847 writel(tmp, port_mmio + PORT_IRQ_STAT); 903 writel(tmp, port_mmio + PORT_IRQ_STAT);
904 }
848 905
849 writel(1 << i, mmio + HOST_IRQ_STAT); 906 for (i = 0; i < host->n_ports; i++) {
907 struct ata_port *ap = host->ports[i];
908
909 port_mmio = ahci_port_base(ap);
910 if (ata_port_is_dummy(ap))
911 continue;
912
913 ahci_port_init(pdev, ap, i, mmio, port_mmio);
850 } 914 }
851 915
852 tmp = readl(mmio + HOST_CTL); 916 tmp = readl(mmio + HOST_CTL);
@@ -1232,7 +1296,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
1232 ata_port_abort(ap); 1296 ata_port_abort(ap);
1233} 1297}
1234 1298
1235static void ahci_host_intr(struct ata_port *ap) 1299static void ahci_port_intr(struct ata_port *ap)
1236{ 1300{
1237 void __iomem *port_mmio = ap->ioaddr.cmd_addr; 1301 void __iomem *port_mmio = ap->ioaddr.cmd_addr;
1238 struct ata_eh_info *ehi = &ap->eh_info; 1302 struct ata_eh_info *ehi = &ap->eh_info;
@@ -1358,7 +1422,7 @@ static irqreturn_t ahci_interrupt(int irq, void *dev_instance)
1358 1422
1359 ap = host->ports[i]; 1423 ap = host->ports[i];
1360 if (ap) { 1424 if (ap) {
1361 ahci_host_intr(ap); 1425 ahci_port_intr(ap);
1362 VPRINTK("port %u\n", i); 1426 VPRINTK("port %u\n", i);
1363 } else { 1427 } else {
1364 VPRINTK("port %u (no irq)\n", i); 1428 VPRINTK("port %u (no irq)\n", i);
@@ -1466,7 +1530,7 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
1466 ahci_power_down(ap); 1530 ahci_power_down(ap);
1467 else { 1531 else {
1468 ata_port_printk(ap, KERN_ERR, "%s (%d)\n", emsg, rc); 1532 ata_port_printk(ap, KERN_ERR, "%s (%d)\n", emsg, rc);
1469 ahci_init_port(ap); 1533 ahci_start_port(ap);
1470 } 1534 }
1471 1535
1472 return rc; 1536 return rc;
@@ -1475,7 +1539,7 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
1475static int ahci_port_resume(struct ata_port *ap) 1539static int ahci_port_resume(struct ata_port *ap)
1476{ 1540{
1477 ahci_power_up(ap); 1541 ahci_power_up(ap);
1478 ahci_init_port(ap); 1542 ahci_start_port(ap);
1479 1543
1480 return 0; 1544 return 0;
1481} 1545}
@@ -1573,13 +1637,8 @@ static int ahci_port_start(struct ata_port *ap)
1573 1637
1574 ap->private_data = pp; 1638 ap->private_data = pp;
1575 1639
1576 /* power up port */ 1640 /* engage engines, captain */
1577 ahci_power_up(ap); 1641 return ahci_port_resume(ap);
1578
1579 /* initialize port */
1580 ahci_init_port(ap);
1581
1582 return 0;
1583} 1642}
1584 1643
1585static void ahci_port_stop(struct ata_port *ap) 1644static void ahci_port_stop(struct ata_port *ap)
@@ -1724,7 +1783,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1724 if (rc) 1783 if (rc)
1725 return rc; 1784 return rc;
1726 1785
1727 if (pci_enable_msi(pdev)) 1786 if ((pi.flags & AHCI_FLAG_NO_MSI) || pci_enable_msi(pdev))
1728 pci_intx(pdev, 1); 1787 pci_intx(pdev, 1);
1729 1788
1730 hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); 1789 hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
@@ -1745,14 +1804,18 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1745 host->private_data = hpriv; 1804 host->private_data = hpriv;
1746 1805
1747 for (i = 0; i < host->n_ports; i++) { 1806 for (i = 0; i < host->n_ports; i++) {
1748 if (hpriv->port_map & (1 << i)) { 1807 struct ata_port *ap = host->ports[i];
1749 struct ata_port *ap = host->ports[i]; 1808 void __iomem *port_mmio = ahci_port_base(ap);
1750 void __iomem *port_mmio = ahci_port_base(ap);
1751 1809
1810 /* standard SATA port setup */
1811 if (hpriv->port_map & (1 << i)) {
1752 ap->ioaddr.cmd_addr = port_mmio; 1812 ap->ioaddr.cmd_addr = port_mmio;
1753 ap->ioaddr.scr_addr = port_mmio + PORT_SCR; 1813 ap->ioaddr.scr_addr = port_mmio + PORT_SCR;
1754 } else 1814 }
1755 host->ports[i]->ops = &ata_dummy_port_ops; 1815
1816 /* disabled/not-implemented port */
1817 else
1818 ap->ops = &ata_dummy_port_ops;
1756 } 1819 }
1757 1820
1758 /* initialize adapter */ 1821 /* initialize adapter */
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
index 4c6e95c95e4a..430fcf4f9ef3 100644
--- a/drivers/ata/ata_generic.c
+++ b/drivers/ata/ata_generic.c
@@ -143,10 +143,10 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id
143 u16 command; 143 u16 command;
144 static const struct ata_port_info info = { 144 static const struct ata_port_info info = {
145 .sht = &generic_sht, 145 .sht = &generic_sht,
146 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 146 .flags = ATA_FLAG_SLAVE_POSS,
147 .pio_mask = 0x1f, 147 .pio_mask = 0x1f,
148 .mwdma_mask = 0x07, 148 .mwdma_mask = 0x07,
149 .udma_mask = 0x3f, 149 .udma_mask = ATA_UDMA5,
150 .port_ops = &generic_port_ops 150 .port_ops = &generic_port_ops
151 }; 151 };
152 const struct ata_port_info *ppi[] = { &info, NULL }; 152 const struct ata_port_info *ppi[] = { &info, NULL };
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 9c07b88631be..6a3bfef58e13 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -200,6 +200,8 @@ static const struct pci_device_id piix_pci_tbl[] = {
200 /* ICH7/7-R (i945, i975) UDMA 100*/ 200 /* ICH7/7-R (i945, i975) UDMA 100*/
201 { 0x8086, 0x27DF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_133 }, 201 { 0x8086, 0x27DF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_133 },
202 { 0x8086, 0x269E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 }, 202 { 0x8086, 0x269E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 },
203 /* ICH8 Mobile PATA Controller */
204 { 0x8086, 0x2850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 },
203 205
204 /* NOTE: The following PCI ids must be kept in sync with the 206 /* NOTE: The following PCI ids must be kept in sync with the
205 * list in drivers/pci/quirks.c. 207 * list in drivers/pci/quirks.c.
@@ -495,7 +497,7 @@ static struct ata_port_info piix_port_info[] = {
495 .flags = PIIX_SATA_FLAGS, 497 .flags = PIIX_SATA_FLAGS,
496 .pio_mask = 0x1f, /* pio0-4 */ 498 .pio_mask = 0x1f, /* pio0-4 */
497 .mwdma_mask = 0x07, /* mwdma0-2 */ 499 .mwdma_mask = 0x07, /* mwdma0-2 */
498 .udma_mask = 0x7f, /* udma0-6 */ 500 .udma_mask = ATA_UDMA6,
499 .port_ops = &piix_sata_ops, 501 .port_ops = &piix_sata_ops,
500 }, 502 },
501 503
@@ -505,7 +507,7 @@ static struct ata_port_info piix_port_info[] = {
505 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR, 507 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR,
506 .pio_mask = 0x1f, /* pio0-4 */ 508 .pio_mask = 0x1f, /* pio0-4 */
507 .mwdma_mask = 0x07, /* mwdma0-2 */ 509 .mwdma_mask = 0x07, /* mwdma0-2 */
508 .udma_mask = 0x7f, /* udma0-6 */ 510 .udma_mask = ATA_UDMA6,
509 .port_ops = &piix_sata_ops, 511 .port_ops = &piix_sata_ops,
510 }, 512 },
511 513
@@ -516,7 +518,7 @@ static struct ata_port_info piix_port_info[] = {
516 PIIX_FLAG_AHCI, 518 PIIX_FLAG_AHCI,
517 .pio_mask = 0x1f, /* pio0-4 */ 519 .pio_mask = 0x1f, /* pio0-4 */
518 .mwdma_mask = 0x07, /* mwdma0-2 */ 520 .mwdma_mask = 0x07, /* mwdma0-2 */
519 .udma_mask = 0x7f, /* udma0-6 */ 521 .udma_mask = ATA_UDMA6,
520 .port_ops = &piix_sata_ops, 522 .port_ops = &piix_sata_ops,
521 }, 523 },
522 524
@@ -527,7 +529,7 @@ static struct ata_port_info piix_port_info[] = {
527 PIIX_FLAG_AHCI, 529 PIIX_FLAG_AHCI,
528 .pio_mask = 0x1f, /* pio0-4 */ 530 .pio_mask = 0x1f, /* pio0-4 */
529 .mwdma_mask = 0x07, /* mwdma0-2 */ 531 .mwdma_mask = 0x07, /* mwdma0-2 */
530 .udma_mask = 0x7f, /* udma0-6 */ 532 .udma_mask = ATA_UDMA6,
531 .port_ops = &piix_sata_ops, 533 .port_ops = &piix_sata_ops,
532 }, 534 },
533 535
@@ -538,7 +540,7 @@ static struct ata_port_info piix_port_info[] = {
538 PIIX_FLAG_AHCI, 540 PIIX_FLAG_AHCI,
539 .pio_mask = 0x1f, /* pio0-4 */ 541 .pio_mask = 0x1f, /* pio0-4 */
540 .mwdma_mask = 0x07, /* mwdma0-2 */ 542 .mwdma_mask = 0x07, /* mwdma0-2 */
541 .udma_mask = 0x7f, /* udma0-6 */ 543 .udma_mask = ATA_UDMA6,
542 .port_ops = &piix_sata_ops, 544 .port_ops = &piix_sata_ops,
543 }, 545 },
544 546
@@ -685,8 +687,14 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev)
685 if (adev->class == ATA_DEV_ATA) 687 if (adev->class == ATA_DEV_ATA)
686 control |= 4; /* PPE enable */ 688 control |= 4; /* PPE enable */
687 689
690 /* PIO configuration clears DTE unconditionally. It will be
691 * programmed in set_dmamode which is guaranteed to be called
692 * after set_piomode if any DMA mode is available.
693 */
688 pci_read_config_word(dev, master_port, &master_data); 694 pci_read_config_word(dev, master_port, &master_data);
689 if (is_slave) { 695 if (is_slave) {
696 /* clear TIME1|IE1|PPE1|DTE1 */
697 master_data &= 0xff0f;
690 /* Enable SITRE (seperate slave timing register) */ 698 /* Enable SITRE (seperate slave timing register) */
691 master_data |= 0x4000; 699 master_data |= 0x4000;
692 /* enable PPE1, IE1 and TIME1 as needed */ 700 /* enable PPE1, IE1 and TIME1 as needed */
@@ -694,12 +702,14 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev)
694 pci_read_config_byte(dev, slave_port, &slave_data); 702 pci_read_config_byte(dev, slave_port, &slave_data);
695 slave_data &= (ap->port_no ? 0x0f : 0xf0); 703 slave_data &= (ap->port_no ? 0x0f : 0xf0);
696 /* Load the timing nibble for this slave */ 704 /* Load the timing nibble for this slave */
697 slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << (ap->port_no ? 4 : 0); 705 slave_data |= ((timings[pio][0] << 2) | timings[pio][1])
706 << (ap->port_no ? 4 : 0);
698 } else { 707 } else {
699 /* Master keeps the bits in a different format */ 708 /* clear ISP|RCT|TIME0|IE0|PPE0|DTE0 */
700 master_data &= 0xccf8; 709 master_data &= 0xccf0;
701 /* Enable PPE, IE and TIME as appropriate */ 710 /* Enable PPE, IE and TIME as appropriate */
702 master_data |= control; 711 master_data |= control;
712 /* load ISP and RCT */
703 master_data |= 713 master_data |=
704 (timings[pio][0] << 12) | 714 (timings[pio][0] << 12) |
705 (timings[pio][1] << 8); 715 (timings[pio][1] << 8);
@@ -816,7 +826,7 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i
816 master_data &= 0xFF4F; /* Mask out IORDY|TIME1|DMAONLY */ 826 master_data &= 0xFF4F; /* Mask out IORDY|TIME1|DMAONLY */
817 master_data |= control << 4; 827 master_data |= control << 4;
818 pci_read_config_byte(dev, 0x44, &slave_data); 828 pci_read_config_byte(dev, 0x44, &slave_data);
819 slave_data &= (0x0F + 0xE1 * ap->port_no); 829 slave_data &= (ap->port_no ? 0x0f : 0xf0);
820 /* Load the matching timing */ 830 /* Load the matching timing */
821 slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << (ap->port_no ? 4 : 0); 831 slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << (ap->port_no ? 4 : 0);
822 pci_write_config_byte(dev, 0x44, slave_data); 832 pci_write_config_byte(dev, 0x44, slave_data);
@@ -828,8 +838,11 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i
828 (timings[pio][0] << 12) | 838 (timings[pio][0] << 12) |
829 (timings[pio][1] << 8); 839 (timings[pio][1] << 8);
830 } 840 }
831 udma_enable &= ~(1 << devid); 841
832 pci_write_config_word(dev, master_port, master_data); 842 if (ap->udma_mask) {
843 udma_enable &= ~(1 << devid);
844 pci_write_config_word(dev, master_port, master_data);
845 }
833 } 846 }
834 /* Don't scribble on 0x48 if the controller does not support UDMA */ 847 /* Don't scribble on 0x48 if the controller does not support UDMA */
835 if (ap->udma_mask) 848 if (ap->udma_mask)
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 02236739b40f..c059f78ad944 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -24,15 +24,13 @@
24#include <acpi/acmacros.h> 24#include <acpi/acmacros.h>
25#include <acpi/actypes.h> 25#include <acpi/actypes.h>
26 26
27#define SATA_ROOT_PORT(x) (((x) >> 16) & 0xffff)
28#define SATA_PORT_NUMBER(x) ((x) & 0xffff) /* or NO_PORT_MULT */
29#define NO_PORT_MULT 0xffff 27#define NO_PORT_MULT 0xffff
30#define SATA_ADR_RSVD 0xffffffff 28#define SATA_ADR(root,pmp) (((root) << 16) | (pmp))
31 29
32#define REGS_PER_GTF 7 30#define REGS_PER_GTF 7
33struct taskfile_array { 31struct ata_acpi_gtf {
34 u8 tfa[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */ 32 u8 tf[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */
35}; 33} __packed;
36 34
37/* 35/*
38 * Helper - belongs in the PCI layer somewhere eventually 36 * Helper - belongs in the PCI layer somewhere eventually
@@ -42,237 +40,173 @@ static int is_pci_dev(struct device *dev)
42 return (dev->bus == &pci_bus_type); 40 return (dev->bus == &pci_bus_type);
43} 41}
44 42
43static void ata_acpi_associate_sata_port(struct ata_port *ap)
44{
45 acpi_integer adr = SATA_ADR(ap->port_no, NO_PORT_MULT);
46
47 ap->device->acpi_handle = acpi_get_child(ap->host->acpi_handle, adr);
48}
49
50static void ata_acpi_associate_ide_port(struct ata_port *ap)
51{
52 int max_devices, i;
53
54 ap->acpi_handle = acpi_get_child(ap->host->acpi_handle, ap->port_no);
55 if (!ap->acpi_handle)
56 return;
57
58 max_devices = 1;
59 if (ap->flags & ATA_FLAG_SLAVE_POSS)
60 max_devices++;
61
62 for (i = 0; i < max_devices; i++) {
63 struct ata_device *dev = &ap->device[i];
64
65 dev->acpi_handle = acpi_get_child(ap->acpi_handle, i);
66 }
67}
68
45/** 69/**
46 * sata_get_dev_handle - finds acpi_handle and PCI device.function 70 * ata_acpi_associate - associate ATA host with ACPI objects
47 * @dev: device to locate 71 * @host: target ATA host
48 * @handle: returned acpi_handle for @dev 72 *
49 * @pcidevfn: return PCI device.func for @dev 73 * Look up ACPI objects associated with @host and initialize
74 * acpi_handle fields of @host, its ports and devices accordingly.
50 * 75 *
51 * This function is somewhat SATA-specific. Or at least the 76 * LOCKING:
52 * PATA & SATA versions of this function are different, 77 * EH context.
53 * so it's not entirely generic code.
54 * 78 *
55 * Returns 0 on success, <0 on error. 79 * RETURNS:
80 * 0 on success, -errno on failure.
56 */ 81 */
57static int sata_get_dev_handle(struct device *dev, acpi_handle *handle, 82void ata_acpi_associate(struct ata_host *host)
58 acpi_integer *pcidevfn)
59{ 83{
60 struct pci_dev *pci_dev; 84 int i;
61 acpi_integer addr; 85
62 86 if (!is_pci_dev(host->dev) || libata_noacpi)
63 if (!is_pci_dev(dev)) 87 return;
64 return -ENODEV; 88
65 89 host->acpi_handle = DEVICE_ACPI_HANDLE(host->dev);
66 pci_dev = to_pci_dev(dev); /* NOTE: PCI-specific */ 90 if (!host->acpi_handle)
67 /* Please refer to the ACPI spec for the syntax of _ADR. */ 91 return;
68 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); 92
69 *pcidevfn = addr; 93 for (i = 0; i < host->n_ports; i++) {
70 *handle = acpi_get_child(DEVICE_ACPI_HANDLE(dev->parent), addr); 94 struct ata_port *ap = host->ports[i];
71 if (!*handle) 95
72 return -ENODEV; 96 if (host->ports[0]->flags & ATA_FLAG_ACPI_SATA)
73 return 0; 97 ata_acpi_associate_sata_port(ap);
98 else
99 ata_acpi_associate_ide_port(ap);
100 }
74} 101}
75 102
76/** 103/**
77 * pata_get_dev_handle - finds acpi_handle and PCI device.function 104 * ata_acpi_gtm - execute _GTM
78 * @dev: device to locate 105 * @ap: target ATA port
79 * @handle: returned acpi_handle for @dev 106 * @gtm: out parameter for _GTM result
80 * @pcidevfn: return PCI device.func for @dev 107 *
108 * Evaluate _GTM and store the result in @gtm.
81 * 109 *
82 * The PATA and SATA versions of this function are different. 110 * LOCKING:
111 * EH context.
83 * 112 *
84 * Returns 0 on success, <0 on error. 113 * RETURNS:
114 * 0 on success, -ENOENT if _GTM doesn't exist, -errno on failure.
85 */ 115 */
86static int pata_get_dev_handle(struct device *dev, acpi_handle *handle, 116static int ata_acpi_gtm(const struct ata_port *ap, struct ata_acpi_gtm *gtm)
87 acpi_integer *pcidevfn)
88{ 117{
89 unsigned int bus, devnum, func; 118 struct acpi_buffer output = { .length = ACPI_ALLOCATE_BUFFER };
90 acpi_integer addr; 119 union acpi_object *out_obj;
91 acpi_handle dev_handle, parent_handle;
92 struct acpi_buffer buffer = {.length = ACPI_ALLOCATE_BUFFER,
93 .pointer = NULL};
94 acpi_status status; 120 acpi_status status;
95 struct acpi_device_info *dinfo = NULL; 121 int rc = 0;
96 int ret = -ENODEV; 122
97 struct pci_dev *pdev; 123 status = acpi_evaluate_object(ap->acpi_handle, "_GTM", NULL, &output);
98 124
99 if (!is_pci_dev(dev)) 125 rc = -ENOENT;
100 return -ENODEV; 126 if (status == AE_NOT_FOUND)
101 127 goto out_free;
102 pdev = to_pci_dev(dev); 128
103 129 rc = -EINVAL;
104 bus = pdev->bus->number; 130 if (ACPI_FAILURE(status)) {
105 devnum = PCI_SLOT(pdev->devfn); 131 ata_port_printk(ap, KERN_ERR,
106 func = PCI_FUNC(pdev->devfn); 132 "ACPI get timing mode failed (AE 0x%x)\n",
107 133 status);
108 dev_handle = DEVICE_ACPI_HANDLE(dev); 134 goto out_free;
109 parent_handle = DEVICE_ACPI_HANDLE(dev->parent);
110
111 status = acpi_get_object_info(parent_handle, &buffer);
112 if (ACPI_FAILURE(status))
113 goto err;
114
115 dinfo = buffer.pointer;
116 if (dinfo && (dinfo->valid & ACPI_VALID_ADR) &&
117 dinfo->address == bus) {
118 /* ACPI spec for _ADR for PCI bus: */
119 addr = (acpi_integer)(devnum << 16 | func);
120 *pcidevfn = addr;
121 *handle = dev_handle;
122 } else {
123 goto err;
124 } 135 }
125 136
126 if (!*handle) 137 out_obj = output.pointer;
127 goto err; 138 if (out_obj->type != ACPI_TYPE_BUFFER) {
128 ret = 0; 139 ata_port_printk(ap, KERN_WARNING,
129err: 140 "_GTM returned unexpected object type 0x%x\n",
130 kfree(dinfo); 141 out_obj->type);
131 return ret;
132}
133 142
134struct walk_info { /* can be trimmed some */ 143 goto out_free;
135 struct device *dev;
136 struct acpi_device *adev;
137 acpi_handle handle;
138 acpi_integer pcidevfn;
139 unsigned int drivenum;
140 acpi_handle obj_handle;
141 struct ata_port *ataport;
142 struct ata_device *atadev;
143 u32 sata_adr;
144 int status;
145 char basepath[ACPI_PATHNAME_MAX];
146 int basepath_len;
147};
148
149static acpi_status get_devices(acpi_handle handle,
150 u32 level, void *context, void **return_value)
151{
152 acpi_status status;
153 struct walk_info *winfo = context;
154 struct acpi_buffer namebuf = {ACPI_ALLOCATE_BUFFER, NULL};
155 char *pathname;
156 struct acpi_buffer buffer;
157 struct acpi_device_info *dinfo;
158
159 status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &namebuf);
160 if (status)
161 goto ret;
162 pathname = namebuf.pointer;
163
164 buffer.length = ACPI_ALLOCATE_BUFFER;
165 buffer.pointer = NULL;
166 status = acpi_get_object_info(handle, &buffer);
167 if (ACPI_FAILURE(status))
168 goto out2;
169
170 dinfo = buffer.pointer;
171
172 /* find full device path name for pcidevfn */
173 if (dinfo && (dinfo->valid & ACPI_VALID_ADR) &&
174 dinfo->address == winfo->pcidevfn) {
175 if (ata_msg_probe(winfo->ataport))
176 ata_dev_printk(winfo->atadev, KERN_DEBUG,
177 ":%s: matches pcidevfn (0x%llx)\n",
178 pathname, winfo->pcidevfn);
179 strlcpy(winfo->basepath, pathname,
180 sizeof(winfo->basepath));
181 winfo->basepath_len = strlen(pathname);
182 goto out;
183 } 144 }
184 145
185 /* if basepath is not yet known, ignore this object */ 146 if (out_obj->buffer.length != sizeof(struct ata_acpi_gtm)) {
186 if (!winfo->basepath_len) 147 ata_port_printk(ap, KERN_ERR,
187 goto out; 148 "_GTM returned invalid length %d\n",
188 149 out_obj->buffer.length);
189 /* if this object is in scope of basepath, maybe use it */ 150 goto out_free;
190 if (strncmp(pathname, winfo->basepath,
191 winfo->basepath_len) == 0) {
192 if (!(dinfo->valid & ACPI_VALID_ADR))
193 goto out;
194 if (ata_msg_probe(winfo->ataport))
195 ata_dev_printk(winfo->atadev, KERN_DEBUG,
196 "GOT ONE: (%s) root_port = 0x%llx,"
197 " port_num = 0x%llx\n", pathname,
198 SATA_ROOT_PORT(dinfo->address),
199 SATA_PORT_NUMBER(dinfo->address));
200 /* heuristics: */
201 if (SATA_PORT_NUMBER(dinfo->address) != NO_PORT_MULT)
202 if (ata_msg_probe(winfo->ataport))
203 ata_dev_printk(winfo->atadev,
204 KERN_DEBUG, "warning: don't"
205 " know how to handle SATA port"
206 " multiplier\n");
207 if (SATA_ROOT_PORT(dinfo->address) ==
208 winfo->ataport->port_no &&
209 SATA_PORT_NUMBER(dinfo->address) == NO_PORT_MULT) {
210 if (ata_msg_probe(winfo->ataport))
211 ata_dev_printk(winfo->atadev,
212 KERN_DEBUG,
213 "THIS ^^^^^ is the requested"
214 " SATA drive (handle = 0x%p)\n",
215 handle);
216 winfo->sata_adr = dinfo->address;
217 winfo->obj_handle = handle;
218 }
219 } 151 }
220out:
221 kfree(dinfo);
222out2:
223 kfree(pathname);
224 152
225ret: 153 memcpy(gtm, out_obj->buffer.pointer, sizeof(struct ata_acpi_gtm));
226 return status; 154 rc = 0;
155 out_free:
156 kfree(output.pointer);
157 return rc;
227} 158}
228 159
229/* Get the SATA drive _ADR object. */ 160/**
230static int get_sata_adr(struct device *dev, acpi_handle handle, 161 * ata_acpi_stm - execute _STM
231 acpi_integer pcidevfn, unsigned int drive, 162 * @ap: target ATA port
232 struct ata_port *ap, 163 * @stm: timing parameter to _STM
233 struct ata_device *atadev, u32 *dev_adr) 164 *
165 * Evaluate _STM with timing parameter @stm.
166 *
167 * LOCKING:
168 * EH context.
169 *
170 * RETURNS:
171 * 0 on success, -ENOENT if _STM doesn't exist, -errno on failure.
172 */
173static int ata_acpi_stm(const struct ata_port *ap, struct ata_acpi_gtm *stm)
234{ 174{
235 acpi_status status; 175 acpi_status status;
236 struct walk_info *winfo; 176 struct acpi_object_list input;
237 int err = -ENOMEM; 177 union acpi_object in_params[3];
238
239 winfo = kzalloc(sizeof(struct walk_info), GFP_KERNEL);
240 if (!winfo)
241 goto out;
242
243 winfo->dev = dev;
244 winfo->atadev = atadev;
245 winfo->ataport = ap;
246 if (acpi_bus_get_device(handle, &winfo->adev) < 0)
247 if (ata_msg_probe(ap))
248 ata_dev_printk(winfo->atadev, KERN_DEBUG,
249 "acpi_bus_get_device failed\n");
250 winfo->handle = handle;
251 winfo->pcidevfn = pcidevfn;
252 winfo->drivenum = drive;
253 178
254 status = acpi_get_devices(NULL, get_devices, winfo, NULL); 179 in_params[0].type = ACPI_TYPE_BUFFER;
180 in_params[0].buffer.length = sizeof(struct ata_acpi_gtm);
181 in_params[0].buffer.pointer = (u8 *)stm;
182 /* Buffers for id may need byteswapping ? */
183 in_params[1].type = ACPI_TYPE_BUFFER;
184 in_params[1].buffer.length = 512;
185 in_params[1].buffer.pointer = (u8 *)ap->device[0].id;
186 in_params[2].type = ACPI_TYPE_BUFFER;
187 in_params[2].buffer.length = 512;
188 in_params[2].buffer.pointer = (u8 *)ap->device[1].id;
189
190 input.count = 3;
191 input.pointer = in_params;
192
193 status = acpi_evaluate_object(ap->acpi_handle, "_STM", &input, NULL);
194
195 if (status == AE_NOT_FOUND)
196 return -ENOENT;
255 if (ACPI_FAILURE(status)) { 197 if (ACPI_FAILURE(status)) {
256 if (ata_msg_probe(ap)) 198 ata_port_printk(ap, KERN_ERR,
257 ata_dev_printk(winfo->atadev, KERN_DEBUG, 199 "ACPI set timing mode failed (status=0x%x)\n", status);
258 "%s: acpi_get_devices failed\n", 200 return -EINVAL;
259 __FUNCTION__);
260 err = -ENODEV;
261 } else {
262 *dev_adr = winfo->sata_adr;
263 atadev->obj_handle = winfo->obj_handle;
264 err = 0;
265 } 201 }
266 kfree(winfo); 202 return 0;
267out:
268 return err;
269} 203}
270 204
271/** 205/**
272 * do_drive_get_GTF - get the drive bootup default taskfile settings 206 * ata_dev_get_GTF - get the drive bootup default taskfile settings
273 * @dev: target ATA device 207 * @dev: target ATA device
274 * @gtf_length: number of bytes of _GTF data returned at @gtf_address 208 * @gtf: output parameter for buffer containing _GTF taskfile arrays
275 * @gtf_address: buffer containing _GTF taskfile arrays 209 * @ptr_to_free: pointer which should be freed
276 * 210 *
277 * This applies to both PATA and SATA drives. 211 * This applies to both PATA and SATA drives.
278 * 212 *
@@ -282,121 +216,41 @@ out:
282 * The <variable number> is not known in advance, so have ACPI-CA 216 * The <variable number> is not known in advance, so have ACPI-CA
283 * allocate the buffer as needed and return it, then free it later. 217 * allocate the buffer as needed and return it, then free it later.
284 * 218 *
285 * The returned @gtf_length and @gtf_address are only valid if the 219 * LOCKING:
286 * function return value is 0. 220 * EH context.
221 *
222 * RETURNS:
223 * Number of taskfiles on success, 0 if _GTF doesn't exist or doesn't
224 * contain valid data. -errno on other errors.
287 */ 225 */
288static int do_drive_get_GTF(struct ata_device *dev, unsigned int *gtf_length, 226static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
289 unsigned long *gtf_address, unsigned long *obj_loc) 227 void **ptr_to_free)
290{ 228{
291 struct ata_port *ap = dev->ap; 229 struct ata_port *ap = dev->ap;
292 acpi_status status; 230 acpi_status status;
293 acpi_handle dev_handle = NULL;
294 acpi_handle chan_handle, drive_handle;
295 acpi_integer pcidevfn = 0;
296 u32 dev_adr;
297 struct acpi_buffer output; 231 struct acpi_buffer output;
298 union acpi_object *out_obj; 232 union acpi_object *out_obj;
299 struct device *gdev = ap->host->dev; 233 int rc = 0;
300 int err = -ENODEV;
301 234
302 *gtf_length = 0; 235 /* set up output buffer */
303 *gtf_address = 0UL; 236 output.length = ACPI_ALLOCATE_BUFFER;
304 *obj_loc = 0UL; 237 output.pointer = NULL; /* ACPI-CA sets this; save/free it later */
305
306 if (libata_noacpi)
307 return 0;
308 238
309 if (ata_msg_probe(ap)) 239 if (ata_msg_probe(ap))
310 ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n", 240 ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n",
311 __FUNCTION__, ap->port_no); 241 __FUNCTION__, ap->port_no);
312 242
313 if (!ata_dev_enabled(dev) || (ap->flags & ATA_FLAG_DISABLED)) {
314 if (ata_msg_probe(ap))
315 ata_dev_printk(dev, KERN_DEBUG, "%s: ERR: "
316 "ata_dev_present: %d, PORT_DISABLED: %lu\n",
317 __FUNCTION__, ata_dev_enabled(dev),
318 ap->flags & ATA_FLAG_DISABLED);
319 goto out;
320 }
321
322 /* Don't continue if device has no _ADR method.
323 * _GTF is intended for known motherboard devices. */
324 if (!(ap->flags & ATA_FLAG_ACPI_SATA)) {
325 err = pata_get_dev_handle(gdev, &dev_handle, &pcidevfn);
326 if (err < 0) {
327 if (ata_msg_probe(ap))
328 ata_dev_printk(dev, KERN_DEBUG,
329 "%s: pata_get_dev_handle failed (%d)\n",
330 __FUNCTION__, err);
331 goto out;
332 }
333 } else {
334 err = sata_get_dev_handle(gdev, &dev_handle, &pcidevfn);
335 if (err < 0) {
336 if (ata_msg_probe(ap))
337 ata_dev_printk(dev, KERN_DEBUG,
338 "%s: sata_get_dev_handle failed (%d\n",
339 __FUNCTION__, err);
340 goto out;
341 }
342 }
343
344 /* Get this drive's _ADR info. if not already known. */
345 if (!dev->obj_handle) {
346 if (!(ap->flags & ATA_FLAG_ACPI_SATA)) {
347 /* get child objects of dev_handle == channel objects,
348 * + _their_ children == drive objects */
349 /* channel is ap->port_no */
350 chan_handle = acpi_get_child(dev_handle,
351 ap->port_no);
352 if (ata_msg_probe(ap))
353 ata_dev_printk(dev, KERN_DEBUG,
354 "%s: chan adr=%d: chan_handle=0x%p\n",
355 __FUNCTION__, ap->port_no,
356 chan_handle);
357 if (!chan_handle) {
358 err = -ENODEV;
359 goto out;
360 }
361 /* TBD: could also check ACPI object VALID bits */
362 drive_handle = acpi_get_child(chan_handle, dev->devno);
363 if (!drive_handle) {
364 err = -ENODEV;
365 goto out;
366 }
367 dev_adr = dev->devno;
368 dev->obj_handle = drive_handle;
369 } else { /* for SATA mode */
370 dev_adr = SATA_ADR_RSVD;
371 err = get_sata_adr(gdev, dev_handle, pcidevfn, 0,
372 ap, dev, &dev_adr);
373 }
374 if (err < 0 || dev_adr == SATA_ADR_RSVD ||
375 !dev->obj_handle) {
376 if (ata_msg_probe(ap))
377 ata_dev_printk(dev, KERN_DEBUG,
378 "%s: get_sata/pata_adr failed: "
379 "err=%d, dev_adr=%u, obj_handle=0x%p\n",
380 __FUNCTION__, err, dev_adr,
381 dev->obj_handle);
382 goto out;
383 }
384 }
385
386 /* Setting up output buffer */
387 output.length = ACPI_ALLOCATE_BUFFER;
388 output.pointer = NULL; /* ACPI-CA sets this; save/free it later */
389
390 /* _GTF has no input parameters */ 243 /* _GTF has no input parameters */
391 err = -EIO; 244 status = acpi_evaluate_object(dev->acpi_handle, "_GTF", NULL, &output);
392 status = acpi_evaluate_object(dev->obj_handle, "_GTF", 245
393 NULL, &output);
394 if (ACPI_FAILURE(status)) { 246 if (ACPI_FAILURE(status)) {
395 if (ata_msg_probe(ap)) 247 if (status != AE_NOT_FOUND) {
396 ata_dev_printk(dev, KERN_DEBUG, 248 ata_dev_printk(dev, KERN_WARNING,
397 "%s: Run _GTF error: status = 0x%x\n", 249 "_GTF evaluation failed (AE 0x%x)\n",
398 __FUNCTION__, status); 250 status);
399 goto out; 251 rc = -EIO;
252 }
253 goto out_free;
400 } 254 }
401 255
402 if (!output.length || !output.pointer) { 256 if (!output.length || !output.pointer) {
@@ -406,43 +260,39 @@ static int do_drive_get_GTF(struct ata_device *dev, unsigned int *gtf_length,
406 __FUNCTION__, 260 __FUNCTION__,
407 (unsigned long long)output.length, 261 (unsigned long long)output.length,
408 output.pointer); 262 output.pointer);
409 kfree(output.pointer); 263 goto out_free;
410 goto out;
411 } 264 }
412 265
413 out_obj = output.pointer; 266 out_obj = output.pointer;
414 if (out_obj->type != ACPI_TYPE_BUFFER) { 267 if (out_obj->type != ACPI_TYPE_BUFFER) {
415 kfree(output.pointer); 268 ata_dev_printk(dev, KERN_WARNING,
416 if (ata_msg_probe(ap)) 269 "_GTF unexpected object type 0x%x\n",
417 ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: " 270 out_obj->type);
418 "error: expected object type of " 271 rc = -EINVAL;
419 " ACPI_TYPE_BUFFER, got 0x%x\n", 272 goto out_free;
420 __FUNCTION__, out_obj->type);
421 err = -ENOENT;
422 goto out;
423 } 273 }
424 274
425 if (!out_obj->buffer.length || !out_obj->buffer.pointer || 275 if (out_obj->buffer.length % REGS_PER_GTF) {
426 out_obj->buffer.length % REGS_PER_GTF) { 276 ata_dev_printk(dev, KERN_WARNING,
427 if (ata_msg_drv(ap)) 277 "unexpected _GTF length (%d)\n",
428 ata_dev_printk(dev, KERN_ERR, 278 out_obj->buffer.length);
429 "%s: unexpected GTF length (%d) or addr (0x%p)\n", 279 rc = -EINVAL;
430 __FUNCTION__, out_obj->buffer.length, 280 goto out_free;
431 out_obj->buffer.pointer);
432 err = -ENOENT;
433 goto out;
434 } 281 }
435 282
436 *gtf_length = out_obj->buffer.length; 283 *ptr_to_free = out_obj;
437 *gtf_address = (unsigned long)out_obj->buffer.pointer; 284 *gtf = (void *)out_obj->buffer.pointer;
438 *obj_loc = (unsigned long)out_obj; 285 rc = out_obj->buffer.length / REGS_PER_GTF;
286
439 if (ata_msg_probe(ap)) 287 if (ata_msg_probe(ap))
440 ata_dev_printk(dev, KERN_DEBUG, "%s: returning " 288 ata_dev_printk(dev, KERN_DEBUG, "%s: returning "
441 "gtf_length=%d, gtf_address=0x%lx, obj_loc=0x%lx\n", 289 "gtf=%p, gtf_count=%d, ptr_to_free=%p\n",
442 __FUNCTION__, *gtf_length, *gtf_address, *obj_loc); 290 __FUNCTION__, *gtf, rc, *ptr_to_free);
443 err = 0; 291 return rc;
444out: 292
445 return err; 293 out_free:
294 kfree(output.pointer);
295 return rc;
446} 296}
447 297
448/** 298/**
@@ -461,154 +311,99 @@ out:
461 * function also waits for idle after writing control and before 311 * function also waits for idle after writing control and before
462 * writing the remaining registers. 312 * writing the remaining registers.
463 * 313 *
464 * LOCKING: TBD: 314 * LOCKING:
465 * Inherited from caller. 315 * EH context.
316 *
317 * RETURNS:
318 * 0 on success, -errno on failure.
466 */ 319 */
467static void taskfile_load_raw(struct ata_device *dev, 320static int taskfile_load_raw(struct ata_device *dev,
468 const struct taskfile_array *gtf) 321 const struct ata_acpi_gtf *gtf)
469{ 322{
470 struct ata_port *ap = dev->ap; 323 struct ata_port *ap = dev->ap;
471 struct ata_taskfile tf; 324 struct ata_taskfile tf, rtf;
472 unsigned int err; 325 unsigned int err_mask;
473 326
474 if (ata_msg_probe(ap)) 327 if ((gtf->tf[0] == 0) && (gtf->tf[1] == 0) && (gtf->tf[2] == 0)
475 ata_dev_printk(dev, KERN_DEBUG, "%s: (0x1f1-1f7): hex: " 328 && (gtf->tf[3] == 0) && (gtf->tf[4] == 0) && (gtf->tf[5] == 0)
476 "%02x %02x %02x %02x %02x %02x %02x\n", 329 && (gtf->tf[6] == 0))
477 __FUNCTION__, 330 return 0;
478 gtf->tfa[0], gtf->tfa[1], gtf->tfa[2],
479 gtf->tfa[3], gtf->tfa[4], gtf->tfa[5], gtf->tfa[6]);
480
481 if ((gtf->tfa[0] == 0) && (gtf->tfa[1] == 0) && (gtf->tfa[2] == 0)
482 && (gtf->tfa[3] == 0) && (gtf->tfa[4] == 0) && (gtf->tfa[5] == 0)
483 && (gtf->tfa[6] == 0))
484 return;
485 331
486 ata_tf_init(dev, &tf); 332 ata_tf_init(dev, &tf);
487 333
488 /* convert gtf to tf */ 334 /* convert gtf to tf */
489 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; /* TBD */ 335 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; /* TBD */
490 tf.protocol = ATA_PROT_NODATA; 336 tf.protocol = ATA_PROT_NODATA;
491 tf.feature = gtf->tfa[0]; /* 0x1f1 */ 337 tf.feature = gtf->tf[0]; /* 0x1f1 */
492 tf.nsect = gtf->tfa[1]; /* 0x1f2 */ 338 tf.nsect = gtf->tf[1]; /* 0x1f2 */
493 tf.lbal = gtf->tfa[2]; /* 0x1f3 */ 339 tf.lbal = gtf->tf[2]; /* 0x1f3 */
494 tf.lbam = gtf->tfa[3]; /* 0x1f4 */ 340 tf.lbam = gtf->tf[3]; /* 0x1f4 */
495 tf.lbah = gtf->tfa[4]; /* 0x1f5 */ 341 tf.lbah = gtf->tf[4]; /* 0x1f5 */
496 tf.device = gtf->tfa[5]; /* 0x1f6 */ 342 tf.device = gtf->tf[5]; /* 0x1f6 */
497 tf.command = gtf->tfa[6]; /* 0x1f7 */ 343 tf.command = gtf->tf[6]; /* 0x1f7 */
498
499 err = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
500 if (err && ata_msg_probe(ap))
501 ata_dev_printk(dev, KERN_ERR,
502 "%s: ata_exec_internal failed: %u\n",
503 __FUNCTION__, err);
504}
505
506/**
507 * do_drive_set_taskfiles - write the drive taskfile settings from _GTF
508 * @dev: target ATA device
509 * @gtf_length: total number of bytes of _GTF taskfiles
510 * @gtf_address: location of _GTF taskfile arrays
511 *
512 * This applies to both PATA and SATA drives.
513 *
514 * Write {gtf_address, length gtf_length} in groups of
515 * REGS_PER_GTF bytes.
516 */
517static int do_drive_set_taskfiles(struct ata_device *dev,
518 unsigned int gtf_length,
519 unsigned long gtf_address)
520{
521 struct ata_port *ap = dev->ap;
522 int err = -ENODEV;
523 int gtf_count = gtf_length / REGS_PER_GTF;
524 int ix;
525 struct taskfile_array *gtf;
526 344
527 if (ata_msg_probe(ap)) 345 if (ata_msg_probe(ap))
528 ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n", 346 ata_dev_printk(dev, KERN_DEBUG, "executing ACPI cmd "
529 __FUNCTION__, ap->port_no); 347 "%02x/%02x:%02x:%02x:%02x:%02x:%02x\n",
530 348 tf.command, tf.feature, tf.nsect,
531 if (libata_noacpi || !(ap->flags & ATA_FLAG_ACPI_SATA)) 349 tf.lbal, tf.lbam, tf.lbah, tf.device);
532 return 0; 350
533 351 rtf = tf;
534 if (!ata_dev_enabled(dev) || (ap->flags & ATA_FLAG_DISABLED)) 352 err_mask = ata_exec_internal(dev, &rtf, NULL, DMA_NONE, NULL, 0);
535 goto out; 353 if (err_mask) {
536 if (!gtf_count) /* shouldn't be here */ 354 ata_dev_printk(dev, KERN_ERR,
537 goto out; 355 "ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x failed "
538 356 "(Emask=0x%x Stat=0x%02x Err=0x%02x)\n",
539 if (gtf_length % REGS_PER_GTF) { 357 tf.command, tf.feature, tf.nsect, tf.lbal, tf.lbam,
540 if (ata_msg_drv(ap)) 358 tf.lbah, tf.device, err_mask, rtf.command, rtf.feature);
541 ata_dev_printk(dev, KERN_ERR, 359 return -EIO;
542 "%s: unexpected GTF length (%d)\n",
543 __FUNCTION__, gtf_length);
544 goto out;
545 }
546
547 for (ix = 0; ix < gtf_count; ix++) {
548 gtf = (struct taskfile_array *)
549 (gtf_address + ix * REGS_PER_GTF);
550
551 /* send all TaskFile registers (0x1f1-0x1f7) *in*that*order* */
552 taskfile_load_raw(dev, gtf);
553 } 360 }
554 361
555 err = 0; 362 return 0;
556out:
557 return err;
558} 363}
559 364
560/** 365/**
561 * ata_acpi_exec_tfs - get then write drive taskfile settings 366 * ata_acpi_exec_tfs - get then write drive taskfile settings
562 * @ap: the ata_port for the drive 367 * @dev: target ATA device
563 * 368 *
564 * This applies to both PATA and SATA drives. 369 * Evaluate _GTF and excute returned taskfiles.
370 *
371 * LOCKING:
372 * EH context.
373 *
374 * RETURNS:
375 * Number of executed taskfiles on success, 0 if _GTF doesn't exist or
376 * doesn't contain valid data. -errno on other errors.
565 */ 377 */
566int ata_acpi_exec_tfs(struct ata_port *ap) 378static int ata_acpi_exec_tfs(struct ata_device *dev)
567{ 379{
568 int ix; 380 struct ata_acpi_gtf *gtf = NULL;
569 int ret = 0; 381 void *ptr_to_free = NULL;
570 unsigned int gtf_length; 382 int gtf_count, i, rc;
571 unsigned long gtf_address; 383
572 unsigned long obj_loc; 384 /* get taskfiles */
573 385 rc = ata_dev_get_GTF(dev, &gtf, &ptr_to_free);
574 if (libata_noacpi) 386 if (rc < 0)
575 return 0; 387 return rc;
576 /* 388 gtf_count = rc;
577 * TBD - implement PATA support. For now, 389
578 * we should not run GTF on PATA devices since some 390 /* execute them */
579 * PATA require execution of GTM/STM before GTF. 391 for (i = 0, rc = 0; i < gtf_count; i++) {
580 */ 392 int tmp;
581 if (!(ap->flags & ATA_FLAG_ACPI_SATA)) 393
582 return 0; 394 /* ACPI errors are eventually ignored. Run till the
583 395 * end even after errors.
584 for (ix = 0; ix < ATA_MAX_DEVICES; ix++) { 396 */
585 struct ata_device *dev = &ap->device[ix]; 397 tmp = taskfile_load_raw(dev, gtf++);
586 398 if (!rc)
587 if (!ata_dev_enabled(dev)) 399 rc = tmp;
588 continue;
589
590 ret = do_drive_get_GTF(dev, &gtf_length, &gtf_address,
591 &obj_loc);
592 if (ret < 0) {
593 if (ata_msg_probe(ap))
594 ata_port_printk(ap, KERN_DEBUG,
595 "%s: get_GTF error (%d)\n",
596 __FUNCTION__, ret);
597 break;
598 }
599
600 ret = do_drive_set_taskfiles(dev, gtf_length, gtf_address);
601 kfree((void *)obj_loc);
602 if (ret < 0) {
603 if (ata_msg_probe(ap))
604 ata_port_printk(ap, KERN_DEBUG,
605 "%s: set_taskfiles error (%d)\n",
606 __FUNCTION__, ret);
607 break;
608 }
609 } 400 }
610 401
611 return ret; 402 kfree(ptr_to_free);
403
404 if (rc == 0)
405 return gtf_count;
406 return rc;
612} 407}
613 408
614/** 409/**
@@ -620,62 +415,25 @@ int ata_acpi_exec_tfs(struct ata_port *ap)
620 * ATM this function never returns a failure. It is an optional 415 * ATM this function never returns a failure. It is an optional
621 * method and if it fails for whatever reason, we should still 416 * method and if it fails for whatever reason, we should still
622 * just keep going. 417 * just keep going.
418 *
419 * LOCKING:
420 * EH context.
421 *
422 * RETURNS:
423 * 0 on success, -errno on failure.
623 */ 424 */
624int ata_acpi_push_id(struct ata_device *dev) 425static int ata_acpi_push_id(struct ata_device *dev)
625{ 426{
626 struct ata_port *ap = dev->ap; 427 struct ata_port *ap = dev->ap;
627 acpi_handle handle;
628 acpi_integer pcidevfn;
629 int err; 428 int err;
630 struct device *gdev = ap->host->dev;
631 u32 dev_adr;
632 acpi_status status; 429 acpi_status status;
633 struct acpi_object_list input; 430 struct acpi_object_list input;
634 union acpi_object in_params[1]; 431 union acpi_object in_params[1];
635 432
636 if (libata_noacpi)
637 return 0;
638
639 if (ata_msg_probe(ap)) 433 if (ata_msg_probe(ap))
640 ata_dev_printk(dev, KERN_DEBUG, "%s: ix = %d, port#: %d\n", 434 ata_dev_printk(dev, KERN_DEBUG, "%s: ix = %d, port#: %d\n",
641 __FUNCTION__, dev->devno, ap->port_no); 435 __FUNCTION__, dev->devno, ap->port_no);
642 436
643 /* Don't continue if not a SATA device. */
644 if (!(ap->flags & ATA_FLAG_ACPI_SATA)) {
645 if (ata_msg_probe(ap))
646 ata_dev_printk(dev, KERN_DEBUG,
647 "%s: Not a SATA device\n", __FUNCTION__);
648 goto out;
649 }
650
651 /* Don't continue if device has no _ADR method.
652 * _SDD is intended for known motherboard devices. */
653 err = sata_get_dev_handle(gdev, &handle, &pcidevfn);
654 if (err < 0) {
655 if (ata_msg_probe(ap))
656 ata_dev_printk(dev, KERN_DEBUG,
657 "%s: sata_get_dev_handle failed (%d\n",
658 __FUNCTION__, err);
659 goto out;
660 }
661
662 /* Get this drive's _ADR info, if not already known */
663 if (!dev->obj_handle) {
664 dev_adr = SATA_ADR_RSVD;
665 err = get_sata_adr(gdev, handle, pcidevfn, dev->devno, ap, dev,
666 &dev_adr);
667 if (err < 0 || dev_adr == SATA_ADR_RSVD ||
668 !dev->obj_handle) {
669 if (ata_msg_probe(ap))
670 ata_dev_printk(dev, KERN_DEBUG,
671 "%s: get_sata_adr failed: "
672 "err=%d, dev_adr=%u, obj_handle=0x%p\n",
673 __FUNCTION__, err, dev_adr,
674 dev->obj_handle);
675 goto out;
676 }
677 }
678
679 /* Give the drive Identify data to the drive via the _SDD method */ 437 /* Give the drive Identify data to the drive via the _SDD method */
680 /* _SDD: set up input parameters */ 438 /* _SDD: set up input parameters */
681 input.count = 1; 439 input.count = 1;
@@ -687,20 +445,150 @@ int ata_acpi_push_id(struct ata_device *dev)
687 445
688 /* It's OK for _SDD to be missing too. */ 446 /* It's OK for _SDD to be missing too. */
689 swap_buf_le16(dev->id, ATA_ID_WORDS); 447 swap_buf_le16(dev->id, ATA_ID_WORDS);
690 status = acpi_evaluate_object(dev->obj_handle, "_SDD", &input, NULL); 448 status = acpi_evaluate_object(dev->acpi_handle, "_SDD", &input, NULL);
691 swap_buf_le16(dev->id, ATA_ID_WORDS); 449 swap_buf_le16(dev->id, ATA_ID_WORDS);
692 450
693 err = ACPI_FAILURE(status) ? -EIO : 0; 451 err = ACPI_FAILURE(status) ? -EIO : 0;
694 if (err < 0) { 452 if (err < 0)
695 if (ata_msg_probe(ap)) 453 ata_dev_printk(dev, KERN_WARNING,
696 ata_dev_printk(dev, KERN_DEBUG, 454 "ACPI _SDD failed (AE 0x%x)\n", status);
697 "%s _SDD error: status = 0x%x\n", 455
698 __FUNCTION__, status); 456 return err;
457}
458
459/**
460 * ata_acpi_on_suspend - ATA ACPI hook called on suspend
461 * @ap: target ATA port
462 *
463 * This function is called when @ap is about to be suspended. All
464 * devices are already put to sleep but the port_suspend() callback
465 * hasn't been executed yet. Error return from this function aborts
466 * suspend.
467 *
468 * LOCKING:
469 * EH context.
470 *
471 * RETURNS:
472 * 0 on success, -errno on failure.
473 */
474int ata_acpi_on_suspend(struct ata_port *ap)
475{
476 unsigned long flags;
477 int rc;
478
479 /* proceed iff per-port acpi_handle is valid */
480 if (!ap->acpi_handle)
481 return 0;
482 BUG_ON(ap->flags & ATA_FLAG_ACPI_SATA);
483
484 /* store timing parameters */
485 rc = ata_acpi_gtm(ap, &ap->acpi_gtm);
486
487 spin_lock_irqsave(ap->lock, flags);
488 if (rc == 0)
489 ap->pflags |= ATA_PFLAG_GTM_VALID;
490 else
491 ap->pflags &= ~ATA_PFLAG_GTM_VALID;
492 spin_unlock_irqrestore(ap->lock, flags);
493
494 if (rc == -ENOENT)
495 rc = 0;
496 return rc;
497}
498
499/**
500 * ata_acpi_on_resume - ATA ACPI hook called on resume
501 * @ap: target ATA port
502 *
503 * This function is called when @ap is resumed - right after port
504 * itself is resumed but before any EH action is taken.
505 *
506 * LOCKING:
507 * EH context.
508 */
509void ata_acpi_on_resume(struct ata_port *ap)
510{
511 int i;
512
513 if (ap->acpi_handle && (ap->pflags & ATA_PFLAG_GTM_VALID)) {
514 BUG_ON(ap->flags & ATA_FLAG_ACPI_SATA);
515
516 /* restore timing parameters */
517 ata_acpi_stm(ap, &ap->acpi_gtm);
699 } 518 }
700 519
701 /* always return success */ 520 /* schedule _GTF */
702out: 521 for (i = 0; i < ATA_MAX_DEVICES; i++)
703 return 0; 522 ap->device[i].flags |= ATA_DFLAG_ACPI_PENDING;
704} 523}
705 524
525/**
526 * ata_acpi_on_devcfg - ATA ACPI hook called on device donfiguration
527 * @dev: target ATA device
528 *
529 * This function is called when @dev is about to be configured.
530 * IDENTIFY data might have been modified after this hook is run.
531 *
532 * LOCKING:
533 * EH context.
534 *
535 * RETURNS:
536 * Positive number if IDENTIFY data needs to be refreshed, 0 if not,
537 * -errno on failure.
538 */
539int ata_acpi_on_devcfg(struct ata_device *dev)
540{
541 struct ata_port *ap = dev->ap;
542 struct ata_eh_context *ehc = &ap->eh_context;
543 int acpi_sata = ap->flags & ATA_FLAG_ACPI_SATA;
544 int rc;
545
546 if (!dev->acpi_handle)
547 return 0;
548
549 /* do we need to do _GTF? */
550 if (!(dev->flags & ATA_DFLAG_ACPI_PENDING) &&
551 !(acpi_sata && (ehc->i.flags & ATA_EHI_DID_HARDRESET)))
552 return 0;
553
554 /* do _SDD if SATA */
555 if (acpi_sata) {
556 rc = ata_acpi_push_id(dev);
557 if (rc)
558 goto acpi_err;
559 }
560
561 /* do _GTF */
562 rc = ata_acpi_exec_tfs(dev);
563 if (rc < 0)
564 goto acpi_err;
565
566 dev->flags &= ~ATA_DFLAG_ACPI_PENDING;
567
568 /* refresh IDENTIFY page if any _GTF command has been executed */
569 if (rc > 0) {
570 rc = ata_dev_reread_id(dev, 0);
571 if (rc < 0) {
572 ata_dev_printk(dev, KERN_ERR, "failed to IDENTIFY "
573 "after ACPI commands\n");
574 return rc;
575 }
576 }
706 577
578 return 0;
579
580 acpi_err:
581 /* let EH retry on the first failure, disable ACPI on the second */
582 if (dev->flags & ATA_DFLAG_ACPI_FAILED) {
583 ata_dev_printk(dev, KERN_WARNING, "ACPI on devcfg failed the "
584 "second time, disabling (errno=%d)\n", rc);
585
586 dev->acpi_handle = NULL;
587
588 /* if port is working, request IDENTIFY reload and continue */
589 if (!(ap->pflags & ATA_PFLAG_FROZEN))
590 rc = 1;
591 }
592 dev->flags |= ATA_DFLAG_ACPI_FAILED;
593 return rc;
594}
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 981b397cb46b..5b25311ba885 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1845,7 +1845,8 @@ static void ata_dev_config_ncq(struct ata_device *dev,
1845int ata_dev_configure(struct ata_device *dev) 1845int ata_dev_configure(struct ata_device *dev)
1846{ 1846{
1847 struct ata_port *ap = dev->ap; 1847 struct ata_port *ap = dev->ap;
1848 int print_info = ap->eh_context.i.flags & ATA_EHI_PRINTINFO; 1848 struct ata_eh_context *ehc = &ap->eh_context;
1849 int print_info = ehc->i.flags & ATA_EHI_PRINTINFO;
1849 const u16 *id = dev->id; 1850 const u16 *id = dev->id;
1850 unsigned int xfer_mask; 1851 unsigned int xfer_mask;
1851 char revbuf[7]; /* XYZ-99\0 */ 1852 char revbuf[7]; /* XYZ-99\0 */
@@ -1862,15 +1863,10 @@ int ata_dev_configure(struct ata_device *dev)
1862 if (ata_msg_probe(ap)) 1863 if (ata_msg_probe(ap))
1863 ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__); 1864 ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__);
1864 1865
1865 /* set _SDD */ 1866 /* let ACPI work its magic */
1866 rc = ata_acpi_push_id(dev); 1867 rc = ata_acpi_on_devcfg(dev);
1867 if (rc) { 1868 if (rc)
1868 ata_dev_printk(dev, KERN_WARNING, "failed to set _SDD(%d)\n", 1869 return rc;
1869 rc);
1870 }
1871
1872 /* retrieve and execute the ATA task file of _GTF */
1873 ata_acpi_exec_tfs(ap);
1874 1870
1875 /* print device capabilities */ 1871 /* print device capabilities */
1876 if (ata_msg_probe(ap)) 1872 if (ata_msg_probe(ap))
@@ -3359,7 +3355,7 @@ int ata_std_prereset(struct ata_port *ap, unsigned long deadline)
3359 return 0; 3355 return 0;
3360 3356
3361 /* if SATA, resume phy */ 3357 /* if SATA, resume phy */
3362 if (ap->cbl == ATA_CBL_SATA) { 3358 if (ap->flags & ATA_FLAG_SATA) {
3363 rc = sata_phy_resume(ap, timing, deadline); 3359 rc = sata_phy_resume(ap, timing, deadline);
3364 /* whine about phy resume failure but proceed */ 3360 /* whine about phy resume failure but proceed */
3365 if (rc && rc != -EOPNOTSUPP) 3361 if (rc && rc != -EOPNOTSUPP)
@@ -4107,6 +4103,68 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
4107} 4103}
4108 4104
4109/** 4105/**
4106 * ata_fill_sg_dumb - Fill PCI IDE PRD table
4107 * @qc: Metadata associated with taskfile to be transferred
4108 *
4109 * Fill PCI IDE PRD (scatter-gather) table with segments
4110 * associated with the current disk command. Perform the fill
4111 * so that we avoid writing any length 64K records for
4112 * controllers that don't follow the spec.
4113 *
4114 * LOCKING:
4115 * spin_lock_irqsave(host lock)
4116 *
4117 */
4118static void ata_fill_sg_dumb(struct ata_queued_cmd *qc)
4119{
4120 struct ata_port *ap = qc->ap;
4121 struct scatterlist *sg;
4122 unsigned int idx;
4123
4124 WARN_ON(qc->__sg == NULL);
4125 WARN_ON(qc->n_elem == 0 && qc->pad_len == 0);
4126
4127 idx = 0;
4128 ata_for_each_sg(sg, qc) {
4129 u32 addr, offset;
4130 u32 sg_len, len, blen;
4131
4132 /* determine if physical DMA addr spans 64K boundary.
4133 * Note h/w doesn't support 64-bit, so we unconditionally
4134 * truncate dma_addr_t to u32.
4135 */
4136 addr = (u32) sg_dma_address(sg);
4137 sg_len = sg_dma_len(sg);
4138
4139 while (sg_len) {
4140 offset = addr & 0xffff;
4141 len = sg_len;
4142 if ((offset + sg_len) > 0x10000)
4143 len = 0x10000 - offset;
4144
4145 blen = len & 0xffff;
4146 ap->prd[idx].addr = cpu_to_le32(addr);
4147 if (blen == 0) {
4148 /* Some PATA chipsets like the CS5530 can't
4149 cope with 0x0000 meaning 64K as the spec says */
4150 ap->prd[idx].flags_len = cpu_to_le32(0x8000);
4151 blen = 0x8000;
4152 ap->prd[++idx].addr = cpu_to_le32(addr + 0x8000);
4153 }
4154 ap->prd[idx].flags_len = cpu_to_le32(blen);
4155 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len);
4156
4157 idx++;
4158 sg_len -= len;
4159 addr += len;
4160 }
4161 }
4162
4163 if (idx)
4164 ap->prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
4165}
4166
4167/**
4110 * ata_check_atapi_dma - Check whether ATAPI DMA can be supported 4168 * ata_check_atapi_dma - Check whether ATAPI DMA can be supported
4111 * @qc: Metadata associated with taskfile to check 4169 * @qc: Metadata associated with taskfile to check
4112 * 4170 *
@@ -4153,6 +4211,23 @@ void ata_qc_prep(struct ata_queued_cmd *qc)
4153 ata_fill_sg(qc); 4211 ata_fill_sg(qc);
4154} 4212}
4155 4213
4214/**
4215 * ata_dumb_qc_prep - Prepare taskfile for submission
4216 * @qc: Metadata associated with taskfile to be prepared
4217 *
4218 * Prepare ATA taskfile for submission.
4219 *
4220 * LOCKING:
4221 * spin_lock_irqsave(host lock)
4222 */
4223void ata_dumb_qc_prep(struct ata_queued_cmd *qc)
4224{
4225 if (!(qc->flags & ATA_QCFLAG_DMAMAP))
4226 return;
4227
4228 ata_fill_sg_dumb(qc);
4229}
4230
4156void ata_noop_qc_prep(struct ata_queued_cmd *qc) { } 4231void ata_noop_qc_prep(struct ata_queued_cmd *qc) { }
4157 4232
4158/** 4233/**
@@ -5660,7 +5735,7 @@ irqreturn_t ata_interrupt (int irq, void *dev_instance)
5660 */ 5735 */
5661int sata_scr_valid(struct ata_port *ap) 5736int sata_scr_valid(struct ata_port *ap)
5662{ 5737{
5663 return ap->cbl == ATA_CBL_SATA && ap->ops->scr_read; 5738 return (ap->flags & ATA_FLAG_SATA) && ap->ops->scr_read;
5664} 5739}
5665 5740
5666/** 5741/**
@@ -6293,6 +6368,9 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
6293 if (rc) 6368 if (rc)
6294 return rc; 6369 return rc;
6295 6370
6371 /* associate with ACPI nodes */
6372 ata_acpi_associate(host);
6373
6296 /* set cable, sata_spd_limit and report */ 6374 /* set cable, sata_spd_limit and report */
6297 for (i = 0; i < host->n_ports; i++) { 6375 for (i = 0; i < host->n_ports; i++) {
6298 struct ata_port *ap = host->ports[i]; 6376 struct ata_port *ap = host->ports[i];
@@ -6324,7 +6402,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
6324 if (!ata_port_is_dummy(ap)) 6402 if (!ata_port_is_dummy(ap))
6325 ata_port_printk(ap, KERN_INFO, "%cATA max %s cmd 0x%p " 6403 ata_port_printk(ap, KERN_INFO, "%cATA max %s cmd 0x%p "
6326 "ctl 0x%p bmdma 0x%p irq %d\n", 6404 "ctl 0x%p bmdma 0x%p irq %d\n",
6327 ap->cbl == ATA_CBL_SATA ? 'S' : 'P', 6405 (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P',
6328 ata_mode_string(xfer_mask), 6406 ata_mode_string(xfer_mask),
6329 ap->ioaddr.cmd_addr, 6407 ap->ioaddr.cmd_addr,
6330 ap->ioaddr.ctl_addr, 6408 ap->ioaddr.ctl_addr,
@@ -6822,6 +6900,7 @@ EXPORT_SYMBOL_GPL(ata_do_set_mode);
6822EXPORT_SYMBOL_GPL(ata_data_xfer); 6900EXPORT_SYMBOL_GPL(ata_data_xfer);
6823EXPORT_SYMBOL_GPL(ata_data_xfer_noirq); 6901EXPORT_SYMBOL_GPL(ata_data_xfer_noirq);
6824EXPORT_SYMBOL_GPL(ata_qc_prep); 6902EXPORT_SYMBOL_GPL(ata_qc_prep);
6903EXPORT_SYMBOL_GPL(ata_dumb_qc_prep);
6825EXPORT_SYMBOL_GPL(ata_noop_qc_prep); 6904EXPORT_SYMBOL_GPL(ata_noop_qc_prep);
6826EXPORT_SYMBOL_GPL(ata_bmdma_setup); 6905EXPORT_SYMBOL_GPL(ata_bmdma_setup);
6827EXPORT_SYMBOL_GPL(ata_bmdma_start); 6906EXPORT_SYMBOL_GPL(ata_bmdma_start);
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index f7582c9c320e..9ee0a8c08d96 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2154,19 +2154,25 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap)
2154 2154
2155 WARN_ON(ap->pflags & ATA_PFLAG_SUSPENDED); 2155 WARN_ON(ap->pflags & ATA_PFLAG_SUSPENDED);
2156 2156
2157 /* tell ACPI we're suspending */
2158 rc = ata_acpi_on_suspend(ap);
2159 if (rc)
2160 goto out;
2161
2157 /* suspend */ 2162 /* suspend */
2158 ata_eh_freeze_port(ap); 2163 ata_eh_freeze_port(ap);
2159 2164
2160 if (ap->ops->port_suspend) 2165 if (ap->ops->port_suspend)
2161 rc = ap->ops->port_suspend(ap, ap->pm_mesg); 2166 rc = ap->ops->port_suspend(ap, ap->pm_mesg);
2162 2167
2168 out:
2163 /* report result */ 2169 /* report result */
2164 spin_lock_irqsave(ap->lock, flags); 2170 spin_lock_irqsave(ap->lock, flags);
2165 2171
2166 ap->pflags &= ~ATA_PFLAG_PM_PENDING; 2172 ap->pflags &= ~ATA_PFLAG_PM_PENDING;
2167 if (rc == 0) 2173 if (rc == 0)
2168 ap->pflags |= ATA_PFLAG_SUSPENDED; 2174 ap->pflags |= ATA_PFLAG_SUSPENDED;
2169 else 2175 else if (ap->pflags & ATA_PFLAG_FROZEN)
2170 ata_port_schedule_eh(ap); 2176 ata_port_schedule_eh(ap);
2171 2177
2172 if (ap->pm_result) { 2178 if (ap->pm_result) {
@@ -2207,6 +2213,9 @@ static void ata_eh_handle_port_resume(struct ata_port *ap)
2207 if (ap->ops->port_resume) 2213 if (ap->ops->port_resume)
2208 rc = ap->ops->port_resume(ap); 2214 rc = ap->ops->port_resume(ap);
2209 2215
2216 /* tell ACPI that we're resuming */
2217 ata_acpi_on_resume(ap);
2218
2210 /* report result */ 2219 /* report result */
2211 spin_lock_irqsave(ap->lock, flags); 2220 spin_lock_irqsave(ap->lock, flags);
2212 ap->pflags &= ~(ATA_PFLAG_PM_PENDING | ATA_PFLAG_SUSPENDED); 2221 ap->pflags &= ~(ATA_PFLAG_PM_PENDING | ATA_PFLAG_SUSPENDED);
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 4ddf00c8c5f5..cfde22da07ac 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2620,7 +2620,7 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
2620 ata_dev_printk(dev, KERN_WARNING, 2620 ata_dev_printk(dev, KERN_WARNING,
2621 "invalid multi_count %u ignored\n", 2621 "invalid multi_count %u ignored\n",
2622 multi_count); 2622 multi_count);
2623 } 2623 }
2624 2624
2625 /* READ/WRITE LONG use a non-standard sect_size */ 2625 /* READ/WRITE LONG use a non-standard sect_size */
2626 qc->sect_size = ATA_SECT_SIZE; 2626 qc->sect_size = ATA_SECT_SIZE;
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index 5e2466658420..ba17fc5f2e99 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -98,17 +98,15 @@ extern struct ata_port *ata_port_alloc(struct ata_host *host);
98 98
99/* libata-acpi.c */ 99/* libata-acpi.c */
100#ifdef CONFIG_ATA_ACPI 100#ifdef CONFIG_ATA_ACPI
101extern int ata_acpi_exec_tfs(struct ata_port *ap); 101extern void ata_acpi_associate(struct ata_host *host);
102extern int ata_acpi_push_id(struct ata_device *dev); 102extern int ata_acpi_on_suspend(struct ata_port *ap);
103extern void ata_acpi_on_resume(struct ata_port *ap);
104extern int ata_acpi_on_devcfg(struct ata_device *adev);
103#else 105#else
104static inline int ata_acpi_exec_tfs(struct ata_port *ap) 106static inline void ata_acpi_associate(struct ata_host *host) { }
105{ 107static inline int ata_acpi_on_suspend(struct ata_port *ap) { return 0; }
106 return 0; 108static inline void ata_acpi_on_resume(struct ata_port *ap) { }
107} 109static inline int ata_acpi_on_devcfg(struct ata_device *adev) { return 0; }
108static inline int ata_acpi_push_id(struct ata_device *dev)
109{
110 return 0;
111}
112#endif 110#endif
113 111
114/* libata-scsi.c */ 112/* libata-scsi.c */
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index 75e95bdbe02f..30c4276ec882 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -520,14 +520,14 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
520{ 520{
521 static const struct ata_port_info info_early = { 521 static const struct ata_port_info info_early = {
522 .sht = &ali_sht, 522 .sht = &ali_sht,
523 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 523 .flags = ATA_FLAG_SLAVE_POSS,
524 .pio_mask = 0x1f, 524 .pio_mask = 0x1f,
525 .port_ops = &ali_early_port_ops 525 .port_ops = &ali_early_port_ops
526 }; 526 };
527 /* Revision 0x20 added DMA */ 527 /* Revision 0x20 added DMA */
528 static const struct ata_port_info info_20 = { 528 static const struct ata_port_info info_20 = {
529 .sht = &ali_sht, 529 .sht = &ali_sht,
530 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, 530 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_PIO_LBA48,
531 .pio_mask = 0x1f, 531 .pio_mask = 0x1f,
532 .mwdma_mask = 0x07, 532 .mwdma_mask = 0x07,
533 .port_ops = &ali_20_port_ops 533 .port_ops = &ali_20_port_ops
@@ -535,7 +535,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
535 /* Revision 0x20 with support logic added UDMA */ 535 /* Revision 0x20 with support logic added UDMA */
536 static const struct ata_port_info info_20_udma = { 536 static const struct ata_port_info info_20_udma = {
537 .sht = &ali_sht, 537 .sht = &ali_sht,
538 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, 538 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_PIO_LBA48,
539 .pio_mask = 0x1f, 539 .pio_mask = 0x1f,
540 .mwdma_mask = 0x07, 540 .mwdma_mask = 0x07,
541 .udma_mask = 0x07, /* UDMA33 */ 541 .udma_mask = 0x07, /* UDMA33 */
@@ -544,37 +544,37 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
544 /* Revision 0xC2 adds UDMA66 */ 544 /* Revision 0xC2 adds UDMA66 */
545 static const struct ata_port_info info_c2 = { 545 static const struct ata_port_info info_c2 = {
546 .sht = &ali_sht, 546 .sht = &ali_sht,
547 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, 547 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_PIO_LBA48,
548 .pio_mask = 0x1f, 548 .pio_mask = 0x1f,
549 .mwdma_mask = 0x07, 549 .mwdma_mask = 0x07,
550 .udma_mask = 0x1f, 550 .udma_mask = ATA_UDMA4,
551 .port_ops = &ali_c2_port_ops 551 .port_ops = &ali_c2_port_ops
552 }; 552 };
553 /* Revision 0xC3 is UDMA66 for now */ 553 /* Revision 0xC3 is UDMA66 for now */
554 static const struct ata_port_info info_c3 = { 554 static const struct ata_port_info info_c3 = {
555 .sht = &ali_sht, 555 .sht = &ali_sht,
556 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, 556 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_PIO_LBA48,
557 .pio_mask = 0x1f, 557 .pio_mask = 0x1f,
558 .mwdma_mask = 0x07, 558 .mwdma_mask = 0x07,
559 .udma_mask = 0x1f, 559 .udma_mask = ATA_UDMA4,
560 .port_ops = &ali_c2_port_ops 560 .port_ops = &ali_c2_port_ops
561 }; 561 };
562 /* Revision 0xC4 is UDMA100 */ 562 /* Revision 0xC4 is UDMA100 */
563 static const struct ata_port_info info_c4 = { 563 static const struct ata_port_info info_c4 = {
564 .sht = &ali_sht, 564 .sht = &ali_sht,
565 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST | ATA_FLAG_PIO_LBA48, 565 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_PIO_LBA48,
566 .pio_mask = 0x1f, 566 .pio_mask = 0x1f,
567 .mwdma_mask = 0x07, 567 .mwdma_mask = 0x07,
568 .udma_mask = 0x3f, 568 .udma_mask = ATA_UDMA5,
569 .port_ops = &ali_c2_port_ops 569 .port_ops = &ali_c2_port_ops
570 }; 570 };
571 /* Revision 0xC5 is UDMA133 with LBA48 DMA */ 571 /* Revision 0xC5 is UDMA133 with LBA48 DMA */
572 static const struct ata_port_info info_c5 = { 572 static const struct ata_port_info info_c5 = {
573 .sht = &ali_sht, 573 .sht = &ali_sht,
574 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 574 .flags = ATA_FLAG_SLAVE_POSS,
575 .pio_mask = 0x1f, 575 .pio_mask = 0x1f,
576 .mwdma_mask = 0x07, 576 .mwdma_mask = 0x07,
577 .udma_mask = 0x7f, 577 .udma_mask = ATA_UDMA6,
578 .port_ops = &ali_c5_port_ops 578 .port_ops = &ali_c5_port_ops
579 }; 579 };
580 580
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index a16f629b7b38..b9c44c575ce3 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -541,7 +541,7 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
541 static const struct ata_port_info info[10] = { 541 static const struct ata_port_info info[10] = {
542 { /* 0: AMD 7401 */ 542 { /* 0: AMD 7401 */
543 .sht = &amd_sht, 543 .sht = &amd_sht,
544 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 544 .flags = ATA_FLAG_SLAVE_POSS,
545 .pio_mask = 0x1f, 545 .pio_mask = 0x1f,
546 .mwdma_mask = 0x07, /* No SWDMA */ 546 .mwdma_mask = 0x07, /* No SWDMA */
547 .udma_mask = 0x07, /* UDMA 33 */ 547 .udma_mask = 0x07, /* UDMA 33 */
@@ -549,74 +549,74 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
549 }, 549 },
550 { /* 1: Early AMD7409 - no swdma */ 550 { /* 1: Early AMD7409 - no swdma */
551 .sht = &amd_sht, 551 .sht = &amd_sht,
552 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 552 .flags = ATA_FLAG_SLAVE_POSS,
553 .pio_mask = 0x1f, 553 .pio_mask = 0x1f,
554 .mwdma_mask = 0x07, 554 .mwdma_mask = 0x07,
555 .udma_mask = 0x1f, /* UDMA 66 */ 555 .udma_mask = ATA_UDMA4, /* UDMA 66 */
556 .port_ops = &amd66_port_ops 556 .port_ops = &amd66_port_ops
557 }, 557 },
558 { /* 2: AMD 7409, no swdma errata */ 558 { /* 2: AMD 7409, no swdma errata */
559 .sht = &amd_sht, 559 .sht = &amd_sht,
560 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 560 .flags = ATA_FLAG_SLAVE_POSS,
561 .pio_mask = 0x1f, 561 .pio_mask = 0x1f,
562 .mwdma_mask = 0x07, 562 .mwdma_mask = 0x07,
563 .udma_mask = 0x1f, /* UDMA 66 */ 563 .udma_mask = ATA_UDMA4, /* UDMA 66 */
564 .port_ops = &amd66_port_ops 564 .port_ops = &amd66_port_ops
565 }, 565 },
566 { /* 3: AMD 7411 */ 566 { /* 3: AMD 7411 */
567 .sht = &amd_sht, 567 .sht = &amd_sht,
568 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 568 .flags = ATA_FLAG_SLAVE_POSS,
569 .pio_mask = 0x1f, 569 .pio_mask = 0x1f,
570 .mwdma_mask = 0x07, 570 .mwdma_mask = 0x07,
571 .udma_mask = 0x3f, /* UDMA 100 */ 571 .udma_mask = ATA_UDMA5, /* UDMA 100 */
572 .port_ops = &amd100_port_ops 572 .port_ops = &amd100_port_ops
573 }, 573 },
574 { /* 4: AMD 7441 */ 574 { /* 4: AMD 7441 */
575 .sht = &amd_sht, 575 .sht = &amd_sht,
576 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 576 .flags = ATA_FLAG_SLAVE_POSS,
577 .pio_mask = 0x1f, 577 .pio_mask = 0x1f,
578 .mwdma_mask = 0x07, 578 .mwdma_mask = 0x07,
579 .udma_mask = 0x3f, /* UDMA 100 */ 579 .udma_mask = ATA_UDMA5, /* UDMA 100 */
580 .port_ops = &amd100_port_ops 580 .port_ops = &amd100_port_ops
581 }, 581 },
582 { /* 5: AMD 8111*/ 582 { /* 5: AMD 8111*/
583 .sht = &amd_sht, 583 .sht = &amd_sht,
584 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 584 .flags = ATA_FLAG_SLAVE_POSS,
585 .pio_mask = 0x1f, 585 .pio_mask = 0x1f,
586 .mwdma_mask = 0x07, 586 .mwdma_mask = 0x07,
587 .udma_mask = 0x7f, /* UDMA 133, no swdma */ 587 .udma_mask = ATA_UDMA6, /* UDMA 133, no swdma */
588 .port_ops = &amd133_port_ops 588 .port_ops = &amd133_port_ops
589 }, 589 },
590 { /* 6: AMD 8111 UDMA 100 (Serenade) */ 590 { /* 6: AMD 8111 UDMA 100 (Serenade) */
591 .sht = &amd_sht, 591 .sht = &amd_sht,
592 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 592 .flags = ATA_FLAG_SLAVE_POSS,
593 .pio_mask = 0x1f, 593 .pio_mask = 0x1f,
594 .mwdma_mask = 0x07, 594 .mwdma_mask = 0x07,
595 .udma_mask = 0x3f, /* UDMA 100, no swdma */ 595 .udma_mask = ATA_UDMA5, /* UDMA 100, no swdma */
596 .port_ops = &amd133_port_ops 596 .port_ops = &amd133_port_ops
597 }, 597 },
598 { /* 7: Nvidia Nforce */ 598 { /* 7: Nvidia Nforce */
599 .sht = &amd_sht, 599 .sht = &amd_sht,
600 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 600 .flags = ATA_FLAG_SLAVE_POSS,
601 .pio_mask = 0x1f, 601 .pio_mask = 0x1f,
602 .mwdma_mask = 0x07, 602 .mwdma_mask = 0x07,
603 .udma_mask = 0x3f, /* UDMA 100 */ 603 .udma_mask = ATA_UDMA5, /* UDMA 100 */
604 .port_ops = &nv100_port_ops 604 .port_ops = &nv100_port_ops
605 }, 605 },
606 { /* 8: Nvidia Nforce2 and later */ 606 { /* 8: Nvidia Nforce2 and later */
607 .sht = &amd_sht, 607 .sht = &amd_sht,
608 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 608 .flags = ATA_FLAG_SLAVE_POSS,
609 .pio_mask = 0x1f, 609 .pio_mask = 0x1f,
610 .mwdma_mask = 0x07, 610 .mwdma_mask = 0x07,
611 .udma_mask = 0x7f, /* UDMA 133, no swdma */ 611 .udma_mask = ATA_UDMA6, /* UDMA 133, no swdma */
612 .port_ops = &nv133_port_ops 612 .port_ops = &nv133_port_ops
613 }, 613 },
614 { /* 9: AMD CS5536 (Geode companion) */ 614 { /* 9: AMD CS5536 (Geode companion) */
615 .sht = &amd_sht, 615 .sht = &amd_sht,
616 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 616 .flags = ATA_FLAG_SLAVE_POSS,
617 .pio_mask = 0x1f, 617 .pio_mask = 0x1f,
618 .mwdma_mask = 0x07, 618 .mwdma_mask = 0x07,
619 .udma_mask = 0x3f, /* UDMA 100 */ 619 .udma_mask = ATA_UDMA5, /* UDMA 100 */
620 .port_ops = &amd100_port_ops 620 .port_ops = &amd100_port_ops
621 } 621 }
622 }; 622 };
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c
index 03b6ddd2abd2..ce589d96ca42 100644
--- a/drivers/ata/pata_artop.c
+++ b/drivers/ata/pata_artop.c
@@ -416,7 +416,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
416 static int printed_version; 416 static int printed_version;
417 static const struct ata_port_info info_6210 = { 417 static const struct ata_port_info info_6210 = {
418 .sht = &artop_sht, 418 .sht = &artop_sht,
419 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 419 .flags = ATA_FLAG_SLAVE_POSS,
420 .pio_mask = 0x1f, /* pio0-4 */ 420 .pio_mask = 0x1f, /* pio0-4 */
421 .mwdma_mask = 0x07, /* mwdma0-2 */ 421 .mwdma_mask = 0x07, /* mwdma0-2 */
422 .udma_mask = ATA_UDMA2, 422 .udma_mask = ATA_UDMA2,
@@ -424,7 +424,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
424 }; 424 };
425 static const struct ata_port_info info_626x = { 425 static const struct ata_port_info info_626x = {
426 .sht = &artop_sht, 426 .sht = &artop_sht,
427 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 427 .flags = ATA_FLAG_SLAVE_POSS,
428 .pio_mask = 0x1f, /* pio0-4 */ 428 .pio_mask = 0x1f, /* pio0-4 */
429 .mwdma_mask = 0x07, /* mwdma0-2 */ 429 .mwdma_mask = 0x07, /* mwdma0-2 */
430 .udma_mask = ATA_UDMA4, 430 .udma_mask = ATA_UDMA4,
@@ -432,7 +432,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
432 }; 432 };
433 static const struct ata_port_info info_626x_fast = { 433 static const struct ata_port_info info_626x_fast = {
434 .sht = &artop_sht, 434 .sht = &artop_sht,
435 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 435 .flags = ATA_FLAG_SLAVE_POSS,
436 .pio_mask = 0x1f, /* pio0-4 */ 436 .pio_mask = 0x1f, /* pio0-4 */
437 .mwdma_mask = 0x07, /* mwdma0-2 */ 437 .mwdma_mask = 0x07, /* mwdma0-2 */
438 .udma_mask = ATA_UDMA5, 438 .udma_mask = ATA_UDMA5,
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index 844914681a2a..80509be49e7a 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -270,7 +270,7 @@ static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
270{ 270{
271 static const struct ata_port_info info = { 271 static const struct ata_port_info info = {
272 .sht = &atiixp_sht, 272 .sht = &atiixp_sht,
273 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 273 .flags = ATA_FLAG_SLAVE_POSS,
274 .pio_mask = 0x1f, 274 .pio_mask = 0x1f,
275 .mwdma_mask = 0x06, /* No MWDMA0 support */ 275 .mwdma_mask = 0x06, /* No MWDMA0 support */
276 .udma_mask = 0x3F, 276 .udma_mask = 0x3F,
@@ -285,6 +285,7 @@ static const struct pci_device_id atiixp[] = {
285 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP300_IDE), }, 285 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP300_IDE), },
286 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP400_IDE), }, 286 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP400_IDE), },
287 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP600_IDE), }, 287 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP600_IDE), },
288 { PCI_VDEVICE(ATI, PCI_DEVICE_ID_ATI_IXP700_IDE), },
288 289
289 { }, 290 { },
290}; 291};
diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c
index 31cbf8daa299..0feb5ae8c486 100644
--- a/drivers/ata/pata_cmd640.c
+++ b/drivers/ata/pata_cmd640.c
@@ -251,7 +251,7 @@ static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
251{ 251{
252 static const struct ata_port_info info = { 252 static const struct ata_port_info info = {
253 .sht = &cmd640_sht, 253 .sht = &cmd640_sht,
254 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 254 .flags = ATA_FLAG_SLAVE_POSS,
255 .pio_mask = 0x1f, 255 .pio_mask = 0x1f,
256 .port_ops = &cmd640_port_ops 256 .port_ops = &cmd640_port_ops
257 }; 257 };
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c
index 320a5b10aa98..dc443e7dc37c 100644
--- a/drivers/ata/pata_cmd64x.c
+++ b/drivers/ata/pata_cmd64x.c
@@ -380,21 +380,21 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
380 static const struct ata_port_info cmd_info[6] = { 380 static const struct ata_port_info cmd_info[6] = {
381 { /* CMD 643 - no UDMA */ 381 { /* CMD 643 - no UDMA */
382 .sht = &cmd64x_sht, 382 .sht = &cmd64x_sht,
383 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 383 .flags = ATA_FLAG_SLAVE_POSS,
384 .pio_mask = 0x1f, 384 .pio_mask = 0x1f,
385 .mwdma_mask = 0x07, 385 .mwdma_mask = 0x07,
386 .port_ops = &cmd64x_port_ops 386 .port_ops = &cmd64x_port_ops
387 }, 387 },
388 { /* CMD 646 with broken UDMA */ 388 { /* CMD 646 with broken UDMA */
389 .sht = &cmd64x_sht, 389 .sht = &cmd64x_sht,
390 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 390 .flags = ATA_FLAG_SLAVE_POSS,
391 .pio_mask = 0x1f, 391 .pio_mask = 0x1f,
392 .mwdma_mask = 0x07, 392 .mwdma_mask = 0x07,
393 .port_ops = &cmd64x_port_ops 393 .port_ops = &cmd64x_port_ops
394 }, 394 },
395 { /* CMD 646 with working UDMA */ 395 { /* CMD 646 with working UDMA */
396 .sht = &cmd64x_sht, 396 .sht = &cmd64x_sht,
397 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 397 .flags = ATA_FLAG_SLAVE_POSS,
398 .pio_mask = 0x1f, 398 .pio_mask = 0x1f,
399 .mwdma_mask = 0x07, 399 .mwdma_mask = 0x07,
400 .udma_mask = ATA_UDMA1, 400 .udma_mask = ATA_UDMA1,
@@ -402,14 +402,14 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
402 }, 402 },
403 { /* CMD 646 rev 1 */ 403 { /* CMD 646 rev 1 */
404 .sht = &cmd64x_sht, 404 .sht = &cmd64x_sht,
405 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 405 .flags = ATA_FLAG_SLAVE_POSS,
406 .pio_mask = 0x1f, 406 .pio_mask = 0x1f,
407 .mwdma_mask = 0x07, 407 .mwdma_mask = 0x07,
408 .port_ops = &cmd646r1_port_ops 408 .port_ops = &cmd646r1_port_ops
409 }, 409 },
410 { /* CMD 648 */ 410 { /* CMD 648 */
411 .sht = &cmd64x_sht, 411 .sht = &cmd64x_sht,
412 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 412 .flags = ATA_FLAG_SLAVE_POSS,
413 .pio_mask = 0x1f, 413 .pio_mask = 0x1f,
414 .mwdma_mask = 0x07, 414 .mwdma_mask = 0x07,
415 .udma_mask = ATA_UDMA2, 415 .udma_mask = ATA_UDMA2,
@@ -417,7 +417,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
417 }, 417 },
418 { /* CMD 649 */ 418 { /* CMD 649 */
419 .sht = &cmd64x_sht, 419 .sht = &cmd64x_sht,
420 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 420 .flags = ATA_FLAG_SLAVE_POSS,
421 .pio_mask = 0x1f, 421 .pio_mask = 0x1f,
422 .mwdma_mask = 0x07, 422 .mwdma_mask = 0x07,
423 .udma_mask = ATA_UDMA3, 423 .udma_mask = ATA_UDMA3,
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index 00cf0134079c..6bf037d82b5a 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -146,7 +146,7 @@ static struct scsi_host_template cs5520_sht = {
146 .queuecommand = ata_scsi_queuecmd, 146 .queuecommand = ata_scsi_queuecmd,
147 .can_queue = ATA_DEF_QUEUE, 147 .can_queue = ATA_DEF_QUEUE,
148 .this_id = ATA_SHT_THIS_ID, 148 .this_id = ATA_SHT_THIS_ID,
149 .sg_tablesize = LIBATA_MAX_PRD, 149 .sg_tablesize = LIBATA_DUMB_MAX_PRD,
150 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 150 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
151 .emulated = ATA_SHT_EMULATED, 151 .emulated = ATA_SHT_EMULATED,
152 .use_clustering = ATA_SHT_USE_CLUSTERING, 152 .use_clustering = ATA_SHT_USE_CLUSTERING,
@@ -178,7 +178,7 @@ static struct ata_port_operations cs5520_port_ops = {
178 .bmdma_start = ata_bmdma_start, 178 .bmdma_start = ata_bmdma_start,
179 .bmdma_stop = ata_bmdma_stop, 179 .bmdma_stop = ata_bmdma_stop,
180 .bmdma_status = ata_bmdma_status, 180 .bmdma_status = ata_bmdma_status,
181 .qc_prep = ata_qc_prep, 181 .qc_prep = ata_dumb_qc_prep,
182 .qc_issue = ata_qc_issue_prot, 182 .qc_issue = ata_qc_issue_prot,
183 .data_xfer = ata_data_xfer, 183 .data_xfer = ata_data_xfer,
184 184
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c
index 848f0309bf03..3fca5898642b 100644
--- a/drivers/ata/pata_cs5530.c
+++ b/drivers/ata/pata_cs5530.c
@@ -167,7 +167,7 @@ static struct scsi_host_template cs5530_sht = {
167 .queuecommand = ata_scsi_queuecmd, 167 .queuecommand = ata_scsi_queuecmd,
168 .can_queue = ATA_DEF_QUEUE, 168 .can_queue = ATA_DEF_QUEUE,
169 .this_id = ATA_SHT_THIS_ID, 169 .this_id = ATA_SHT_THIS_ID,
170 .sg_tablesize = LIBATA_MAX_PRD, 170 .sg_tablesize = LIBATA_DUMB_MAX_PRD,
171 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 171 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
172 .emulated = ATA_SHT_EMULATED, 172 .emulated = ATA_SHT_EMULATED,
173 .use_clustering = ATA_SHT_USE_CLUSTERING, 173 .use_clustering = ATA_SHT_USE_CLUSTERING,
@@ -201,7 +201,7 @@ static struct ata_port_operations cs5530_port_ops = {
201 .post_internal_cmd = ata_bmdma_post_internal_cmd, 201 .post_internal_cmd = ata_bmdma_post_internal_cmd,
202 .cable_detect = ata_cable_40wire, 202 .cable_detect = ata_cable_40wire,
203 203
204 .qc_prep = ata_qc_prep, 204 .qc_prep = ata_dumb_qc_prep,
205 .qc_issue = cs5530_qc_issue_prot, 205 .qc_issue = cs5530_qc_issue_prot,
206 206
207 .data_xfer = ata_data_xfer, 207 .data_xfer = ata_data_xfer,
@@ -337,7 +337,7 @@ static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
337{ 337{
338 static const struct ata_port_info info = { 338 static const struct ata_port_info info = {
339 .sht = &cs5530_sht, 339 .sht = &cs5530_sht,
340 .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, 340 .flags = ATA_FLAG_SLAVE_POSS,
341 .pio_mask = 0x1f, 341 .pio_mask = 0x1f,
342 .mwdma_mask = 0x07, 342 .mwdma_mask = 0x07,
343 .udma_mask = 0x07, 343 .udma_mask = 0x07,
@@ -346,7 +346,7 @@ static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
346 /* The docking connector doesn't do UDMA, and it seems not MWDMA */ 346 /* The docking connector doesn't do UDMA, and it seems not MWDMA */
347 static const struct ata_port_info info_palmax_secondary = { 347 static const struct ata_port_info info_palmax_secondary = {
348 .sht = &cs5530_sht, 348 .sht = &cs5530_sht,
349 .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, 349 .flags = ATA_FLAG_SLAVE_POSS,
350 .pio_mask = 0x1f, 350 .pio_mask = 0x1f,
351 .port_ops = &cs5530_port_ops 351 .port_ops = &cs5530_port_ops
352 }; 352 };
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c
index aa3256fb9f7a..360b6f32e17e 100644
--- a/drivers/ata/pata_cs5535.c
+++ b/drivers/ata/pata_cs5535.c
@@ -225,10 +225,10 @@ static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id)
225{ 225{
226 static const struct ata_port_info info = { 226 static const struct ata_port_info info = {
227 .sht = &cs5535_sht, 227 .sht = &cs5535_sht,
228 .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, 228 .flags = ATA_FLAG_SLAVE_POSS,
229 .pio_mask = 0x1f, 229 .pio_mask = 0x1f,
230 .mwdma_mask = 0x07, 230 .mwdma_mask = 0x07,
231 .udma_mask = 0x1f, 231 .udma_mask = ATA_UDMA4,
232 .port_ops = &cs5535_port_ops 232 .port_ops = &cs5535_port_ops
233 }; 233 };
234 const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; 234 const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info };
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c
index d41a7691dd8e..6cbc8778bf4f 100644
--- a/drivers/ata/pata_cypress.c
+++ b/drivers/ata/pata_cypress.c
@@ -167,7 +167,7 @@ static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *i
167{ 167{
168 static const struct ata_port_info info = { 168 static const struct ata_port_info info = {
169 .sht = &cy82c693_sht, 169 .sht = &cy82c693_sht,
170 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 170 .flags = ATA_FLAG_SLAVE_POSS,
171 .pio_mask = 0x1f, 171 .pio_mask = 0x1f,
172 .mwdma_mask = 0x07, 172 .mwdma_mask = 0x07,
173 .port_ops = &cy82c693_port_ops 173 .port_ops = &cy82c693_port_ops
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c
index 079248a9b460..c8ba59c56114 100644
--- a/drivers/ata/pata_efar.c
+++ b/drivers/ata/pata_efar.c
@@ -303,7 +303,7 @@ static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
303 static int printed_version; 303 static int printed_version;
304 static const struct ata_port_info info = { 304 static const struct ata_port_info info = {
305 .sht = &efar_sht, 305 .sht = &efar_sht,
306 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 306 .flags = ATA_FLAG_SLAVE_POSS,
307 .pio_mask = 0x1f, /* pio0-4 */ 307 .pio_mask = 0x1f, /* pio0-4 */
308 .mwdma_mask = 0x07, /* mwdma1-2 */ 308 .mwdma_mask = 0x07, /* mwdma1-2 */
309 .udma_mask = 0x0f, /* UDMA 66 */ 309 .udma_mask = 0x0f, /* UDMA 66 */
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
index 0c9cb6090711..6f7d34ad19ef 100644
--- a/drivers/ata/pata_hpt366.c
+++ b/drivers/ata/pata_hpt366.c
@@ -393,10 +393,10 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
393{ 393{
394 static const struct ata_port_info info_hpt366 = { 394 static const struct ata_port_info info_hpt366 = {
395 .sht = &hpt36x_sht, 395 .sht = &hpt36x_sht,
396 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 396 .flags = ATA_FLAG_SLAVE_POSS,
397 .pio_mask = 0x1f, 397 .pio_mask = 0x1f,
398 .mwdma_mask = 0x07, 398 .mwdma_mask = 0x07,
399 .udma_mask = 0x1f, 399 .udma_mask = ATA_UDMA4,
400 .port_ops = &hpt366_port_ops 400 .port_ops = &hpt366_port_ops
401 }; 401 };
402 struct ata_port_info info = info_hpt366; 402 struct ata_port_info info = info_hpt366;
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index a8c0cbeca399..b0af65aadde3 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -889,25 +889,25 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
889 /* HPT370 - UDMA100 */ 889 /* HPT370 - UDMA100 */
890 static const struct ata_port_info info_hpt370 = { 890 static const struct ata_port_info info_hpt370 = {
891 .sht = &hpt37x_sht, 891 .sht = &hpt37x_sht,
892 .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, 892 .flags = ATA_FLAG_SLAVE_POSS,
893 .pio_mask = 0x1f, 893 .pio_mask = 0x1f,
894 .mwdma_mask = 0x07, 894 .mwdma_mask = 0x07,
895 .udma_mask = 0x3f, 895 .udma_mask = ATA_UDMA5,
896 .port_ops = &hpt370_port_ops 896 .port_ops = &hpt370_port_ops
897 }; 897 };
898 /* HPT370A - UDMA100 */ 898 /* HPT370A - UDMA100 */
899 static const struct ata_port_info info_hpt370a = { 899 static const struct ata_port_info info_hpt370a = {
900 .sht = &hpt37x_sht, 900 .sht = &hpt37x_sht,
901 .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, 901 .flags = ATA_FLAG_SLAVE_POSS,
902 .pio_mask = 0x1f, 902 .pio_mask = 0x1f,
903 .mwdma_mask = 0x07, 903 .mwdma_mask = 0x07,
904 .udma_mask = 0x3f, 904 .udma_mask = ATA_UDMA5,
905 .port_ops = &hpt370a_port_ops 905 .port_ops = &hpt370a_port_ops
906 }; 906 };
907 /* HPT370 - UDMA100 */ 907 /* HPT370 - UDMA100 */
908 static const struct ata_port_info info_hpt370_33 = { 908 static const struct ata_port_info info_hpt370_33 = {
909 .sht = &hpt37x_sht, 909 .sht = &hpt37x_sht,
910 .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, 910 .flags = ATA_FLAG_SLAVE_POSS,
911 .pio_mask = 0x1f, 911 .pio_mask = 0x1f,
912 .mwdma_mask = 0x07, 912 .mwdma_mask = 0x07,
913 .udma_mask = 0x0f, 913 .udma_mask = 0x0f,
@@ -916,7 +916,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
916 /* HPT370A - UDMA100 */ 916 /* HPT370A - UDMA100 */
917 static const struct ata_port_info info_hpt370a_33 = { 917 static const struct ata_port_info info_hpt370a_33 = {
918 .sht = &hpt37x_sht, 918 .sht = &hpt37x_sht,
919 .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, 919 .flags = ATA_FLAG_SLAVE_POSS,
920 .pio_mask = 0x1f, 920 .pio_mask = 0x1f,
921 .mwdma_mask = 0x07, 921 .mwdma_mask = 0x07,
922 .udma_mask = 0x0f, 922 .udma_mask = 0x0f,
@@ -925,19 +925,19 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
925 /* HPT371, 372 and friends - UDMA133 */ 925 /* HPT371, 372 and friends - UDMA133 */
926 static const struct ata_port_info info_hpt372 = { 926 static const struct ata_port_info info_hpt372 = {
927 .sht = &hpt37x_sht, 927 .sht = &hpt37x_sht,
928 .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, 928 .flags = ATA_FLAG_SLAVE_POSS,
929 .pio_mask = 0x1f, 929 .pio_mask = 0x1f,
930 .mwdma_mask = 0x07, 930 .mwdma_mask = 0x07,
931 .udma_mask = 0x7f, 931 .udma_mask = ATA_UDMA6,
932 .port_ops = &hpt372_port_ops 932 .port_ops = &hpt372_port_ops
933 }; 933 };
934 /* HPT374 - UDMA100 */ 934 /* HPT374 - UDMA100 */
935 static const struct ata_port_info info_hpt374 = { 935 static const struct ata_port_info info_hpt374 = {
936 .sht = &hpt37x_sht, 936 .sht = &hpt37x_sht,
937 .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, 937 .flags = ATA_FLAG_SLAVE_POSS,
938 .pio_mask = 0x1f, 938 .pio_mask = 0x1f,
939 .mwdma_mask = 0x07, 939 .mwdma_mask = 0x07,
940 .udma_mask = 0x3f, 940 .udma_mask = ATA_UDMA5,
941 .port_ops = &hpt374_port_ops 941 .port_ops = &hpt374_port_ops
942 }; 942 };
943 943
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
index e947433cb37d..aa29cde09f8b 100644
--- a/drivers/ata/pata_hpt3x2n.c
+++ b/drivers/ata/pata_hpt3x2n.c
@@ -490,10 +490,10 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
490 /* HPT372N and friends - UDMA133 */ 490 /* HPT372N and friends - UDMA133 */
491 static const struct ata_port_info info = { 491 static const struct ata_port_info info = {
492 .sht = &hpt3x2n_sht, 492 .sht = &hpt3x2n_sht,
493 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 493 .flags = ATA_FLAG_SLAVE_POSS,
494 .pio_mask = 0x1f, 494 .pio_mask = 0x1f,
495 .mwdma_mask = 0x07, 495 .mwdma_mask = 0x07,
496 .udma_mask = 0x7f, 496 .udma_mask = ATA_UDMA6,
497 .port_ops = &hpt3x2n_port_ops 497 .port_ops = &hpt3x2n_port_ops
498 }; 498 };
499 struct ata_port_info port = info; 499 struct ata_port_info port = info;
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c
index 8ce5e23a5f75..d928c9105034 100644
--- a/drivers/ata/pata_hpt3x3.c
+++ b/drivers/ata/pata_hpt3x3.c
@@ -173,7 +173,7 @@ static int hpt3x3_init_one(struct pci_dev *dev, const struct pci_device_id *id)
173{ 173{
174 static const struct ata_port_info info = { 174 static const struct ata_port_info info = {
175 .sht = &hpt3x3_sht, 175 .sht = &hpt3x3_sht,
176 .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, 176 .flags = ATA_FLAG_SLAVE_POSS,
177 .pio_mask = 0x1f, 177 .pio_mask = 0x1f,
178 .mwdma_mask = 0x07, 178 .mwdma_mask = 0x07,
179 .udma_mask = 0x07, 179 .udma_mask = 0x07,
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c
index c791a46df461..321d98b0bed2 100644
--- a/drivers/ata/pata_icside.c
+++ b/drivers/ata/pata_icside.c
@@ -530,7 +530,7 @@ static int __devinit pata_icside_add_ports(struct pata_icside_info *info)
530 530
531 ap->pio_mask = 0x1f; 531 ap->pio_mask = 0x1f;
532 ap->mwdma_mask = info->mwdma_mask; 532 ap->mwdma_mask = info->mwdma_mask;
533 ap->flags |= ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST; 533 ap->flags |= ATA_FLAG_SLAVE_POSS;
534 ap->ops = &pata_icside_port_ops; 534 ap->ops = &pata_icside_port_ops;
535 535
536 pata_icside_setup_ioaddr(&ap->ioaddr, info->base, info->port[i]); 536 pata_icside_setup_ioaddr(&ap->ioaddr, info->base, info->port[i]);
diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c
index 95b0bb61788b..b8af55e89156 100644
--- a/drivers/ata/pata_it8213.c
+++ b/drivers/ata/pata_it8213.c
@@ -313,10 +313,10 @@ static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *en
313 static int printed_version; 313 static int printed_version;
314 static const struct ata_port_info info = { 314 static const struct ata_port_info info = {
315 .sht = &it8213_sht, 315 .sht = &it8213_sht,
316 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 316 .flags = ATA_FLAG_SLAVE_POSS,
317 .pio_mask = 0x1f, /* pio0-4 */ 317 .pio_mask = 0x1f, /* pio0-4 */
318 .mwdma_mask = 0x07, /* mwdma0-2 */ 318 .mwdma_mask = 0x07, /* mwdma0-2 */
319 .udma_mask = 0x1f, /* UDMA 100 */ 319 .udma_mask = ATA_UDMA4, /* FIXME: want UDMA 100? */
320 .port_ops = &it8213_ops, 320 .port_ops = &it8213_ops,
321 }; 321 };
322 /* Current IT8213 stuff is single port */ 322 /* Current IT8213 stuff is single port */
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 12c6e08cc4d1..b67bbf6516ba 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -714,17 +714,17 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
714 714
715 static const struct ata_port_info info_smart = { 715 static const struct ata_port_info info_smart = {
716 .sht = &it821x_sht, 716 .sht = &it821x_sht,
717 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 717 .flags = ATA_FLAG_SLAVE_POSS,
718 .pio_mask = 0x1f, 718 .pio_mask = 0x1f,
719 .mwdma_mask = 0x07, 719 .mwdma_mask = 0x07,
720 .port_ops = &it821x_smart_port_ops 720 .port_ops = &it821x_smart_port_ops
721 }; 721 };
722 static const struct ata_port_info info_passthru = { 722 static const struct ata_port_info info_passthru = {
723 .sht = &it821x_sht, 723 .sht = &it821x_sht,
724 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 724 .flags = ATA_FLAG_SLAVE_POSS,
725 .pio_mask = 0x1f, 725 .pio_mask = 0x1f,
726 .mwdma_mask = 0x07, 726 .mwdma_mask = 0x07,
727 .udma_mask = 0x7f, 727 .udma_mask = ATA_UDMA6,
728 .port_ops = &it821x_passthru_port_ops 728 .port_ops = &it821x_passthru_port_ops
729 }; 729 };
730 730
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index 8d2bc1e9e871..4ca7fd6118d5 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -1,13 +1,14 @@
1/* 1/*
2 * ixp4xx PATA/Compact Flash driver 2 * ixp4xx PATA/Compact Flash driver
3 * Copyright (c) 2006 Tower Technologies 3 * Copyright (C) 2006-07 Tower Technologies
4 * Author: Alessandro Zummo <a.zummo@towertech.it> 4 * Author: Alessandro Zummo <a.zummo@towertech.it>
5 * 5 *
6 * An ATA driver to handle a Compact Flash connected 6 * An ATA driver to handle a Compact Flash connected
7 * to the ixp4xx expansion bus in TrueIDE mode. The CF 7 * to the ixp4xx expansion bus in TrueIDE mode. The CF
8 * must have it chip selects connected to two CS lines 8 * must have it chip selects connected to two CS lines
9 * on the ixp4xx. The interrupt line is optional, if not 9 * on the ixp4xx. In the irq is not available, you might
10 * specified the driver will run in polling mode. 10 * want to modify both this driver and libata to run in
11 * polling mode.
11 * 12 *
12 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as 14 * it under the terms of the GNU General Public License version 2 as
@@ -23,7 +24,7 @@
23#include <scsi/scsi_host.h> 24#include <scsi/scsi_host.h>
24 25
25#define DRV_NAME "pata_ixp4xx_cf" 26#define DRV_NAME "pata_ixp4xx_cf"
26#define DRV_VERSION "0.1.3" 27#define DRV_VERSION "0.2"
27 28
28static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device **error) 29static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device **error)
29{ 30{
@@ -42,13 +43,6 @@ static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device **error)
42 return 0; 43 return 0;
43} 44}
44 45
45static void ixp4xx_phy_reset(struct ata_port *ap)
46{
47 ap->cbl = ATA_CBL_PATA40;
48 ata_port_probe(ap);
49 ata_bus_reset(ap);
50}
51
52static void ixp4xx_mmio_data_xfer(struct ata_device *adev, unsigned char *buf, 46static void ixp4xx_mmio_data_xfer(struct ata_device *adev, unsigned char *buf,
53 unsigned int buflen, int write_data) 47 unsigned int buflen, int write_data)
54{ 48{
@@ -56,7 +50,7 @@ static void ixp4xx_mmio_data_xfer(struct ata_device *adev, unsigned char *buf,
56 unsigned int words = buflen >> 1; 50 unsigned int words = buflen >> 1;
57 u16 *buf16 = (u16 *) buf; 51 u16 *buf16 = (u16 *) buf;
58 struct ata_port *ap = adev->ap; 52 struct ata_port *ap = adev->ap;
59 void __iomem *mmio = (void __iomem *)ap->ioaddr.data_addr; 53 void __iomem *mmio = ap->ioaddr.data_addr;
60 struct ixp4xx_pata_data *data = ap->host->dev->platform_data; 54 struct ixp4xx_pata_data *data = ap->host->dev->platform_data;
61 55
62 /* set the expansion bus in 16bit mode and restore 56 /* set the expansion bus in 16bit mode and restore
@@ -92,10 +86,6 @@ static void ixp4xx_mmio_data_xfer(struct ata_device *adev, unsigned char *buf,
92 *data->cs0_cfg |= 0x01; 86 *data->cs0_cfg |= 0x01;
93} 87}
94 88
95static void ixp4xx_irq_clear(struct ata_port *ap)
96{
97}
98
99static struct scsi_host_template ixp4xx_sht = { 89static struct scsi_host_template ixp4xx_sht = {
100 .module = THIS_MODULE, 90 .module = THIS_MODULE,
101 .name = DRV_NAME, 91 .name = DRV_NAME,
@@ -115,29 +105,32 @@ static struct scsi_host_template ixp4xx_sht = {
115}; 105};
116 106
117static struct ata_port_operations ixp4xx_port_ops = { 107static struct ata_port_operations ixp4xx_port_ops = {
118 .set_mode = ixp4xx_set_mode, 108 .set_mode = ixp4xx_set_mode,
119 .mode_filter = ata_pci_default_filter, 109 .mode_filter = ata_pci_default_filter,
120 110
121 .port_disable = ata_port_disable, 111 .port_disable = ata_port_disable,
122 .tf_load = ata_tf_load, 112 .tf_load = ata_tf_load,
123 .tf_read = ata_tf_read, 113 .tf_read = ata_tf_read,
124 .check_status = ata_check_status, 114 .exec_command = ata_exec_command,
125 .exec_command = ata_exec_command, 115 .check_status = ata_check_status,
126 .dev_select = ata_std_dev_select, 116 .dev_select = ata_std_dev_select,
127 117
128 .qc_prep = ata_qc_prep, 118 .freeze = ata_bmdma_freeze,
129 .qc_issue = ata_qc_issue_prot, 119 .thaw = ata_bmdma_thaw,
130 .eng_timeout = ata_eng_timeout, 120 .error_handler = ata_bmdma_error_handler,
131 .data_xfer = ixp4xx_mmio_data_xfer, 121 .post_internal_cmd = ata_bmdma_post_internal_cmd,
132 .cable_detect = ata_cable_40wire, 122
133 123 .qc_prep = ata_qc_prep,
134 .irq_clear = ixp4xx_irq_clear, 124 .qc_issue = ata_qc_issue_prot,
135 .irq_on = ata_irq_on, 125 .data_xfer = ixp4xx_mmio_data_xfer,
136 .irq_ack = ata_irq_ack, 126 .cable_detect = ata_cable_40wire,
137 127
138 .port_start = ata_port_start, 128 .irq_handler = ata_interrupt,
139 129 .irq_clear = ata_bmdma_irq_clear,
140 .phy_reset = ixp4xx_phy_reset, 130 .irq_on = ata_irq_on,
131 .irq_ack = ata_dummy_irq_ack,
132
133 .port_start = ata_port_start,
141}; 134};
142 135
143static void ixp4xx_setup_port(struct ata_ioports *ioaddr, 136static void ixp4xx_setup_port(struct ata_ioports *ioaddr,
@@ -178,7 +171,6 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev)
178 struct ata_host *host; 171 struct ata_host *host;
179 struct ata_port *ap; 172 struct ata_port *ap;
180 struct ixp4xx_pata_data *data = pdev->dev.platform_data; 173 struct ixp4xx_pata_data *data = pdev->dev.platform_data;
181 int rc;
182 174
183 cs0 = platform_get_resource(pdev, IORESOURCE_MEM, 0); 175 cs0 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
184 cs1 = platform_get_resource(pdev, IORESOURCE_MEM, 1); 176 cs1 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
@@ -211,10 +203,6 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev)
211 ap->pio_mask = 0x1f; /* PIO4 */ 203 ap->pio_mask = 0x1f; /* PIO4 */
212 ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY | ATA_FLAG_NO_ATAPI; 204 ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY | ATA_FLAG_NO_ATAPI;
213 205
214 /* run in polling mode if no irq has been assigned */
215 if (!irq)
216 ap->flags |= ATA_FLAG_PIO_POLLING;
217
218 ixp4xx_setup_port(&ap->ioaddr, data); 206 ixp4xx_setup_port(&ap->ioaddr, data);
219 207
220 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); 208 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
index 2af7ff8256ca..4d67f238eee2 100644
--- a/drivers/ata/pata_jmicron.c
+++ b/drivers/ata/pata_jmicron.c
@@ -193,11 +193,11 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i
193{ 193{
194 static const struct ata_port_info info = { 194 static const struct ata_port_info info = {
195 .sht = &jmicron_sht, 195 .sht = &jmicron_sht,
196 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 196 .flags = ATA_FLAG_SLAVE_POSS,
197 197
198 .pio_mask = 0x1f, 198 .pio_mask = 0x1f,
199 .mwdma_mask = 0x07, 199 .mwdma_mask = 0x07,
200 .udma_mask = 0x3f, 200 .udma_mask = ATA_UDMA5,
201 201
202 .port_ops = &jmicron_ops, 202 .port_ops = &jmicron_ops,
203 }; 203 };
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index edbfe0dbbf78..87594c04d3a3 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -163,22 +163,22 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *i
163{ 163{
164 static const struct ata_port_info info = { 164 static const struct ata_port_info info = {
165 .sht = &marvell_sht, 165 .sht = &marvell_sht,
166 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 166 .flags = ATA_FLAG_SLAVE_POSS,
167 167
168 .pio_mask = 0x1f, 168 .pio_mask = 0x1f,
169 .mwdma_mask = 0x07, 169 .mwdma_mask = 0x07,
170 .udma_mask = 0x3f, 170 .udma_mask = ATA_UDMA5,
171 171
172 .port_ops = &marvell_ops, 172 .port_ops = &marvell_ops,
173 }; 173 };
174 static const struct ata_port_info info_sata = { 174 static const struct ata_port_info info_sata = {
175 .sht = &marvell_sht, 175 .sht = &marvell_sht,
176 /* Slave possible as its magically mapped not real */ 176 /* Slave possible as its magically mapped not real */
177 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 177 .flags = ATA_FLAG_SLAVE_POSS,
178 178
179 .pio_mask = 0x1f, 179 .pio_mask = 0x1f,
180 .mwdma_mask = 0x07, 180 .mwdma_mask = 0x07,
181 .udma_mask = 0x7f, 181 .udma_mask = ATA_UDMA6,
182 182
183 .port_ops = &marvell_ops, 183 .port_ops = &marvell_ops,
184 }; 184 };
diff --git a/drivers/ata/pata_netcell.c b/drivers/ata/pata_netcell.c
index 81f563458666..40eb574828bf 100644
--- a/drivers/ata/pata_netcell.c
+++ b/drivers/ata/pata_netcell.c
@@ -94,12 +94,12 @@ static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *e
94 static int printed_version; 94 static int printed_version;
95 static const struct ata_port_info info = { 95 static const struct ata_port_info info = {
96 .sht = &netcell_sht, 96 .sht = &netcell_sht,
97 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 97 .flags = ATA_FLAG_SLAVE_POSS,
98 /* Actually we don't really care about these as the 98 /* Actually we don't really care about these as the
99 firmware deals with it */ 99 firmware deals with it */
100 .pio_mask = 0x1f, /* pio0-4 */ 100 .pio_mask = 0x1f, /* pio0-4 */
101 .mwdma_mask = 0x07, /* mwdma0-2 */ 101 .mwdma_mask = 0x07, /* mwdma0-2 */
102 .udma_mask = 0x3f, /* UDMA 133 */ 102 .udma_mask = ATA_UDMA5, /* UDMA 133 */
103 .port_ops = &netcell_ops, 103 .port_ops = &netcell_ops,
104 }; 104 };
105 const struct ata_port_info *port_info[] = { &info, NULL }; 105 const struct ata_port_info *port_info[] = { &info, NULL };
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c
index ea70ec744879..2f5d714ebfc4 100644
--- a/drivers/ata/pata_ns87410.c
+++ b/drivers/ata/pata_ns87410.c
@@ -193,7 +193,7 @@ static int ns87410_init_one(struct pci_dev *dev, const struct pci_device_id *id)
193{ 193{
194 static const struct ata_port_info info = { 194 static const struct ata_port_info info = {
195 .sht = &ns87410_sht, 195 .sht = &ns87410_sht,
196 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 196 .flags = ATA_FLAG_SLAVE_POSS,
197 .pio_mask = 0x0F, 197 .pio_mask = 0x0F,
198 .port_ops = &ns87410_port_ops 198 .port_ops = &ns87410_port_ops
199 }; 199 };
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c
index 29c23ddd6550..091a70a0ef1c 100644
--- a/drivers/ata/pata_oldpiix.c
+++ b/drivers/ata/pata_oldpiix.c
@@ -291,7 +291,7 @@ static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *e
291 static int printed_version; 291 static int printed_version;
292 static const struct ata_port_info info = { 292 static const struct ata_port_info info = {
293 .sht = &oldpiix_sht, 293 .sht = &oldpiix_sht,
294 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 294 .flags = ATA_FLAG_SLAVE_POSS,
295 .pio_mask = 0x1f, /* pio0-4 */ 295 .pio_mask = 0x1f, /* pio0-4 */
296 .mwdma_mask = 0x07, /* mwdma1-2 */ 296 .mwdma_mask = 0x07, /* mwdma1-2 */
297 .port_ops = &oldpiix_pata_ops, 297 .port_ops = &oldpiix_pata_ops,
diff --git a/drivers/ata/pata_opti.c b/drivers/ata/pata_opti.c
index 1c44653e1e06..458bf67f766f 100644
--- a/drivers/ata/pata_opti.c
+++ b/drivers/ata/pata_opti.c
@@ -218,7 +218,7 @@ static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id)
218{ 218{
219 static const struct ata_port_info info = { 219 static const struct ata_port_info info = {
220 .sht = &opti_sht, 220 .sht = &opti_sht,
221 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 221 .flags = ATA_FLAG_SLAVE_POSS,
222 .pio_mask = 0x1f, 222 .pio_mask = 0x1f,
223 .port_ops = &opti_port_ops 223 .port_ops = &opti_port_ops
224 }; 224 };
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c
index 3093b02286ce..f89bdfde16d0 100644
--- a/drivers/ata/pata_optidma.c
+++ b/drivers/ata/pata_optidma.c
@@ -484,14 +484,14 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id)
484{ 484{
485 static const struct ata_port_info info_82c700 = { 485 static const struct ata_port_info info_82c700 = {
486 .sht = &optidma_sht, 486 .sht = &optidma_sht,
487 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 487 .flags = ATA_FLAG_SLAVE_POSS,
488 .pio_mask = 0x1f, 488 .pio_mask = 0x1f,
489 .mwdma_mask = 0x07, 489 .mwdma_mask = 0x07,
490 .port_ops = &optidma_port_ops 490 .port_ops = &optidma_port_ops
491 }; 491 };
492 static const struct ata_port_info info_82c700_udma = { 492 static const struct ata_port_info info_82c700_udma = {
493 .sht = &optidma_sht, 493 .sht = &optidma_sht,
494 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 494 .flags = ATA_FLAG_SLAVE_POSS,
495 .pio_mask = 0x1f, 495 .pio_mask = 0x1f,
496 .mwdma_mask = 0x07, 496 .mwdma_mask = 0x07,
497 .udma_mask = 0x07, 497 .udma_mask = 0x07,
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index d277246b7337..92447bed5e77 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -320,7 +320,7 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id
320 static const struct ata_port_info info[3] = { 320 static const struct ata_port_info info[3] = {
321 { 321 {
322 .sht = &pdc202xx_sht, 322 .sht = &pdc202xx_sht,
323 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 323 .flags = ATA_FLAG_SLAVE_POSS,
324 .pio_mask = 0x1f, 324 .pio_mask = 0x1f,
325 .mwdma_mask = 0x07, 325 .mwdma_mask = 0x07,
326 .udma_mask = ATA_UDMA2, 326 .udma_mask = ATA_UDMA2,
@@ -328,7 +328,7 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id
328 }, 328 },
329 { 329 {
330 .sht = &pdc202xx_sht, 330 .sht = &pdc202xx_sht,
331 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 331 .flags = ATA_FLAG_SLAVE_POSS,
332 .pio_mask = 0x1f, 332 .pio_mask = 0x1f,
333 .mwdma_mask = 0x07, 333 .mwdma_mask = 0x07,
334 .udma_mask = ATA_UDMA4, 334 .udma_mask = ATA_UDMA4,
@@ -336,7 +336,7 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id
336 }, 336 },
337 { 337 {
338 .sht = &pdc202xx_sht, 338 .sht = &pdc202xx_sht,
339 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 339 .flags = ATA_FLAG_SLAVE_POSS,
340 .pio_mask = 0x1f, 340 .pio_mask = 0x1f,
341 .mwdma_mask = 0x07, 341 .mwdma_mask = 0x07,
342 .udma_mask = ATA_UDMA5, 342 .udma_mask = ATA_UDMA5,
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index cbb7866940d6..79f841bca593 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -139,6 +139,7 @@ static int __devinit pata_platform_probe(struct platform_device *pdev)
139 struct resource *io_res, *ctl_res; 139 struct resource *io_res, *ctl_res;
140 struct ata_host *host; 140 struct ata_host *host;
141 struct ata_port *ap; 141 struct ata_port *ap;
142 struct pata_platform_info *pp_info;
142 unsigned int mmio; 143 unsigned int mmio;
143 144
144 /* 145 /*
@@ -208,11 +209,12 @@ static int __devinit pata_platform_probe(struct platform_device *pdev)
208 209
209 ap->ioaddr.altstatus_addr = ap->ioaddr.ctl_addr; 210 ap->ioaddr.altstatus_addr = ap->ioaddr.ctl_addr;
210 211
211 pata_platform_setup_port(&ap->ioaddr, pdev->dev.platform_data); 212 pp_info = (struct pata_platform_info *)(pdev->dev.platform_data);
213 pata_platform_setup_port(&ap->ioaddr, pp_info);
212 214
213 /* activate */ 215 /* activate */
214 return ata_host_activate(host, platform_get_irq(pdev, 0), ata_interrupt, 216 return ata_host_activate(host, platform_get_irq(pdev, 0), ata_interrupt,
215 0, &pata_platform_sht); 217 pp_info->irq_flags, &pata_platform_sht);
216} 218}
217 219
218/** 220/**
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c
index ba96b54f5b87..7d1aabed422d 100644
--- a/drivers/ata/pata_radisys.c
+++ b/drivers/ata/pata_radisys.c
@@ -257,7 +257,7 @@ static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *e
257 static int printed_version; 257 static int printed_version;
258 static const struct ata_port_info info = { 258 static const struct ata_port_info info = {
259 .sht = &radisys_sht, 259 .sht = &radisys_sht,
260 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 260 .flags = ATA_FLAG_SLAVE_POSS,
261 .pio_mask = 0x1f, /* pio0-4 */ 261 .pio_mask = 0x1f, /* pio0-4 */
262 .mwdma_mask = 0x07, /* mwdma1-2 */ 262 .mwdma_mask = 0x07, /* mwdma1-2 */
263 .udma_mask = 0x14, /* UDMA33/66 only */ 263 .udma_mask = 0x14, /* UDMA33/66 only */
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c
index a3488b41ad26..7632fcb070ca 100644
--- a/drivers/ata/pata_rz1000.c
+++ b/drivers/ata/pata_rz1000.c
@@ -133,7 +133,7 @@ static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *en
133 static int printed_version; 133 static int printed_version;
134 static const struct ata_port_info info = { 134 static const struct ata_port_info info = {
135 .sht = &rz1000_sht, 135 .sht = &rz1000_sht,
136 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 136 .flags = ATA_FLAG_SLAVE_POSS,
137 .pio_mask = 0x1f, 137 .pio_mask = 0x1f,
138 .port_ops = &rz1000_port_ops 138 .port_ops = &rz1000_port_ops
139 }; 139 };
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c
index 1233063ab9a8..b8b2d11e4180 100644
--- a/drivers/ata/pata_sc1200.c
+++ b/drivers/ata/pata_sc1200.c
@@ -185,7 +185,7 @@ static struct scsi_host_template sc1200_sht = {
185 .queuecommand = ata_scsi_queuecmd, 185 .queuecommand = ata_scsi_queuecmd,
186 .can_queue = ATA_DEF_QUEUE, 186 .can_queue = ATA_DEF_QUEUE,
187 .this_id = ATA_SHT_THIS_ID, 187 .this_id = ATA_SHT_THIS_ID,
188 .sg_tablesize = LIBATA_MAX_PRD, 188 .sg_tablesize = LIBATA_DUMB_MAX_PRD,
189 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 189 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
190 .emulated = ATA_SHT_EMULATED, 190 .emulated = ATA_SHT_EMULATED,
191 .use_clustering = ATA_SHT_USE_CLUSTERING, 191 .use_clustering = ATA_SHT_USE_CLUSTERING,
@@ -219,7 +219,7 @@ static struct ata_port_operations sc1200_port_ops = {
219 .bmdma_stop = ata_bmdma_stop, 219 .bmdma_stop = ata_bmdma_stop,
220 .bmdma_status = ata_bmdma_status, 220 .bmdma_status = ata_bmdma_status,
221 221
222 .qc_prep = ata_qc_prep, 222 .qc_prep = ata_dumb_qc_prep,
223 .qc_issue = sc1200_qc_issue_prot, 223 .qc_issue = sc1200_qc_issue_prot,
224 224
225 .data_xfer = ata_data_xfer, 225 .data_xfer = ata_data_xfer,
@@ -245,7 +245,7 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
245{ 245{
246 static const struct ata_port_info info = { 246 static const struct ata_port_info info = {
247 .sht = &sc1200_sht, 247 .sht = &sc1200_sht,
248 .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, 248 .flags = ATA_FLAG_SLAVE_POSS,
249 .pio_mask = 0x1f, 249 .pio_mask = 0x1f,
250 .mwdma_mask = 0x07, 250 .mwdma_mask = 0x07,
251 .udma_mask = 0x07, 251 .udma_mask = 0x07,
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
index 1e8f421963c7..0231aba51ca4 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -478,31 +478,31 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id
478 static const struct ata_port_info info[4] = { 478 static const struct ata_port_info info[4] = {
479 { /* OSB4 */ 479 { /* OSB4 */
480 .sht = &serverworks_sht, 480 .sht = &serverworks_sht,
481 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 481 .flags = ATA_FLAG_SLAVE_POSS,
482 .pio_mask = 0x1f, 482 .pio_mask = 0x1f,
483 .mwdma_mask = 0x07, 483 .mwdma_mask = 0x07,
484 .udma_mask = 0x07, 484 .udma_mask = 0x07,
485 .port_ops = &serverworks_osb4_port_ops 485 .port_ops = &serverworks_osb4_port_ops
486 }, { /* OSB4 no UDMA */ 486 }, { /* OSB4 no UDMA */
487 .sht = &serverworks_sht, 487 .sht = &serverworks_sht,
488 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 488 .flags = ATA_FLAG_SLAVE_POSS,
489 .pio_mask = 0x1f, 489 .pio_mask = 0x1f,
490 .mwdma_mask = 0x07, 490 .mwdma_mask = 0x07,
491 .udma_mask = 0x00, 491 .udma_mask = 0x00,
492 .port_ops = &serverworks_osb4_port_ops 492 .port_ops = &serverworks_osb4_port_ops
493 }, { /* CSB5 */ 493 }, { /* CSB5 */
494 .sht = &serverworks_sht, 494 .sht = &serverworks_sht,
495 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 495 .flags = ATA_FLAG_SLAVE_POSS,
496 .pio_mask = 0x1f, 496 .pio_mask = 0x1f,
497 .mwdma_mask = 0x07, 497 .mwdma_mask = 0x07,
498 .udma_mask = 0x1f, 498 .udma_mask = ATA_UDMA4,
499 .port_ops = &serverworks_csb_port_ops 499 .port_ops = &serverworks_csb_port_ops
500 }, { /* CSB5 - later revisions*/ 500 }, { /* CSB5 - later revisions*/
501 .sht = &serverworks_sht, 501 .sht = &serverworks_sht,
502 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 502 .flags = ATA_FLAG_SLAVE_POSS,
503 .pio_mask = 0x1f, 503 .pio_mask = 0x1f,
504 .mwdma_mask = 0x07, 504 .mwdma_mask = 0x07,
505 .udma_mask = 0x3f, 505 .udma_mask = ATA_UDMA5,
506 .port_ops = &serverworks_csb_port_ops 506 .port_ops = &serverworks_csb_port_ops
507 } 507 }
508 }; 508 };
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index 440e2cb6ee75..b0cd52d6e3fb 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -35,6 +35,8 @@
35#define DRV_NAME "pata_sil680" 35#define DRV_NAME "pata_sil680"
36#define DRV_VERSION "0.4.6" 36#define DRV_VERSION "0.4.6"
37 37
38#define SIL680_MMIO_BAR 5
39
38/** 40/**
39 * sil680_selreg - return register base 41 * sil680_selreg - return register base
40 * @hwif: interface 42 * @hwif: interface
@@ -293,8 +295,8 @@ static u8 sil680_init_chip(struct pci_dev *pdev)
293 295
294 pci_read_config_byte(pdev, 0x8A, &tmpbyte); 296 pci_read_config_byte(pdev, 0x8A, &tmpbyte);
295 297
296 printk(KERN_INFO "sil680: BA5_EN = %d clock = %02X\n", 298 dev_dbg(&pdev->dev, "sil680: BA5_EN = %d clock = %02X\n",
297 tmpbyte & 1, tmpbyte & 0x30); 299 tmpbyte & 1, tmpbyte & 0x30);
298 300
299 switch(tmpbyte & 0x30) { 301 switch(tmpbyte & 0x30) {
300 case 0x00: 302 case 0x00:
@@ -315,8 +317,8 @@ static u8 sil680_init_chip(struct pci_dev *pdev)
315 } 317 }
316 318
317 pci_read_config_byte(pdev, 0x8A, &tmpbyte); 319 pci_read_config_byte(pdev, 0x8A, &tmpbyte);
318 printk(KERN_INFO "sil680: BA5_EN = %d clock = %02X\n", 320 dev_dbg(&pdev->dev, "sil680: BA5_EN = %d clock = %02X\n",
319 tmpbyte & 1, tmpbyte & 0x30); 321 tmpbyte & 1, tmpbyte & 0x30);
320 322
321 pci_write_config_byte(pdev, 0xA1, 0x72); 323 pci_write_config_byte(pdev, 0xA1, 0x72);
322 pci_write_config_word(pdev, 0xA2, 0x328A); 324 pci_write_config_word(pdev, 0xA2, 0x328A);
@@ -339,22 +341,23 @@ static u8 sil680_init_chip(struct pci_dev *pdev)
339 return tmpbyte & 0x30; 341 return tmpbyte & 0x30;
340} 342}
341 343
342static int sil680_init_one(struct pci_dev *pdev, const struct pci_device_id *id) 344static int __devinit sil680_init_one(struct pci_dev *pdev,
345 const struct pci_device_id *id)
343{ 346{
344 static const struct ata_port_info info = { 347 static const struct ata_port_info info = {
345 .sht = &sil680_sht, 348 .sht = &sil680_sht,
346 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 349 .flags = ATA_FLAG_SLAVE_POSS,
347 .pio_mask = 0x1f, 350 .pio_mask = 0x1f,
348 .mwdma_mask = 0x07, 351 .mwdma_mask = 0x07,
349 .udma_mask = 0x7f, 352 .udma_mask = ATA_UDMA6,
350 .port_ops = &sil680_port_ops 353 .port_ops = &sil680_port_ops
351 }; 354 };
352 static const struct ata_port_info info_slow = { 355 static const struct ata_port_info info_slow = {
353 .sht = &sil680_sht, 356 .sht = &sil680_sht,
354 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 357 .flags = ATA_FLAG_SLAVE_POSS,
355 .pio_mask = 0x1f, 358 .pio_mask = 0x1f,
356 .mwdma_mask = 0x07, 359 .mwdma_mask = 0x07,
357 .udma_mask = 0x3f, 360 .udma_mask = ATA_UDMA5,
358 .port_ops = &sil680_port_ops 361 .port_ops = &sil680_port_ops
359 }; 362 };
360 const struct ata_port_info *ppi[] = { &info, NULL }; 363 const struct ata_port_info *ppi[] = { &info, NULL };
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index cfe4ec6eb3d5..2b4508206a6c 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -732,7 +732,7 @@ static const struct ata_port_operations sis_old_ops = {
732 732
733static const struct ata_port_info sis_info = { 733static const struct ata_port_info sis_info = {
734 .sht = &sis_sht, 734 .sht = &sis_sht,
735 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 735 .flags = ATA_FLAG_SLAVE_POSS,
736 .pio_mask = 0x1f, /* pio0-4 */ 736 .pio_mask = 0x1f, /* pio0-4 */
737 .mwdma_mask = 0x07, 737 .mwdma_mask = 0x07,
738 .udma_mask = 0, 738 .udma_mask = 0,
@@ -740,7 +740,7 @@ static const struct ata_port_info sis_info = {
740}; 740};
741static const struct ata_port_info sis_info33 = { 741static const struct ata_port_info sis_info33 = {
742 .sht = &sis_sht, 742 .sht = &sis_sht,
743 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 743 .flags = ATA_FLAG_SLAVE_POSS,
744 .pio_mask = 0x1f, /* pio0-4 */ 744 .pio_mask = 0x1f, /* pio0-4 */
745 .mwdma_mask = 0x07, 745 .mwdma_mask = 0x07,
746 .udma_mask = ATA_UDMA2, /* UDMA 33 */ 746 .udma_mask = ATA_UDMA2, /* UDMA 33 */
@@ -748,28 +748,28 @@ static const struct ata_port_info sis_info33 = {
748}; 748};
749static const struct ata_port_info sis_info66 = { 749static const struct ata_port_info sis_info66 = {
750 .sht = &sis_sht, 750 .sht = &sis_sht,
751 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 751 .flags = ATA_FLAG_SLAVE_POSS,
752 .pio_mask = 0x1f, /* pio0-4 */ 752 .pio_mask = 0x1f, /* pio0-4 */
753 .udma_mask = ATA_UDMA4, /* UDMA 66 */ 753 .udma_mask = ATA_UDMA4, /* UDMA 66 */
754 .port_ops = &sis_66_ops, 754 .port_ops = &sis_66_ops,
755}; 755};
756static const struct ata_port_info sis_info100 = { 756static const struct ata_port_info sis_info100 = {
757 .sht = &sis_sht, 757 .sht = &sis_sht,
758 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 758 .flags = ATA_FLAG_SLAVE_POSS,
759 .pio_mask = 0x1f, /* pio0-4 */ 759 .pio_mask = 0x1f, /* pio0-4 */
760 .udma_mask = ATA_UDMA5, 760 .udma_mask = ATA_UDMA5,
761 .port_ops = &sis_100_ops, 761 .port_ops = &sis_100_ops,
762}; 762};
763static const struct ata_port_info sis_info100_early = { 763static const struct ata_port_info sis_info100_early = {
764 .sht = &sis_sht, 764 .sht = &sis_sht,
765 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 765 .flags = ATA_FLAG_SLAVE_POSS,
766 .udma_mask = ATA_UDMA5, 766 .udma_mask = ATA_UDMA5,
767 .pio_mask = 0x1f, /* pio0-4 */ 767 .pio_mask = 0x1f, /* pio0-4 */
768 .port_ops = &sis_66_ops, 768 .port_ops = &sis_66_ops,
769}; 769};
770static const struct ata_port_info sis_info133 = { 770static const struct ata_port_info sis_info133 = {
771 .sht = &sis_sht, 771 .sht = &sis_sht,
772 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 772 .flags = ATA_FLAG_SLAVE_POSS,
773 .pio_mask = 0x1f, /* pio0-4 */ 773 .pio_mask = 0x1f, /* pio0-4 */
774 .udma_mask = ATA_UDMA6, 774 .udma_mask = ATA_UDMA6,
775 .port_ops = &sis_133_ops, 775 .port_ops = &sis_133_ops,
@@ -783,7 +783,7 @@ const struct ata_port_info sis_info133_for_sata = {
783}; 783};
784static const struct ata_port_info sis_info133_early = { 784static const struct ata_port_info sis_info133_early = {
785 .sht = &sis_sht, 785 .sht = &sis_sht,
786 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 786 .flags = ATA_FLAG_SLAVE_POSS,
787 .pio_mask = 0x1f, /* pio0-4 */ 787 .pio_mask = 0x1f, /* pio0-4 */
788 .udma_mask = ATA_UDMA6, 788 .udma_mask = ATA_UDMA6,
789 .port_ops = &sis_133_early_ops, 789 .port_ops = &sis_133_early_ops,
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c
index e5aaec43694d..bde734189623 100644
--- a/drivers/ata/pata_sl82c105.c
+++ b/drivers/ata/pata_sl82c105.c
@@ -303,14 +303,14 @@ static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id
303{ 303{
304 static const struct ata_port_info info_dma = { 304 static const struct ata_port_info info_dma = {
305 .sht = &sl82c105_sht, 305 .sht = &sl82c105_sht,
306 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 306 .flags = ATA_FLAG_SLAVE_POSS,
307 .pio_mask = 0x1f, 307 .pio_mask = 0x1f,
308 .mwdma_mask = 0x07, 308 .mwdma_mask = 0x07,
309 .port_ops = &sl82c105_port_ops 309 .port_ops = &sl82c105_port_ops
310 }; 310 };
311 static const struct ata_port_info info_early = { 311 static const struct ata_port_info info_early = {
312 .sht = &sl82c105_sht, 312 .sht = &sl82c105_sht,
313 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 313 .flags = ATA_FLAG_SLAVE_POSS,
314 .pio_mask = 0x1f, 314 .pio_mask = 0x1f,
315 .port_ops = &sl82c105_port_ops 315 .port_ops = &sl82c105_port_ops
316 }; 316 };
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c
index b1d3076dfe51..af21f443db6e 100644
--- a/drivers/ata/pata_triflex.c
+++ b/drivers/ata/pata_triflex.c
@@ -235,7 +235,7 @@ static int triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id)
235{ 235{
236 static const struct ata_port_info info = { 236 static const struct ata_port_info info = {
237 .sht = &triflex_sht, 237 .sht = &triflex_sht,
238 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, 238 .flags = ATA_FLAG_SLAVE_POSS,
239 .pio_mask = 0x1f, 239 .pio_mask = 0x1f,
240 .mwdma_mask = 0x07, 240 .mwdma_mask = 0x07,
241 .port_ops = &triflex_port_ops 241 .port_ops = &triflex_port_ops
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 63eca299c62b..f0cadbe6aa11 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -471,7 +471,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
471 .flags = ATA_FLAG_SLAVE_POSS, 471 .flags = ATA_FLAG_SLAVE_POSS,
472 .pio_mask = 0x1f, 472 .pio_mask = 0x1f,
473 .mwdma_mask = 0x07, 473 .mwdma_mask = 0x07,
474 .udma_mask = 0x7, 474 .udma_mask = ATA_UDMA2,
475 .port_ops = &via_port_ops 475 .port_ops = &via_port_ops
476 }; 476 };
477 /* VIA UDMA 66 devices */ 477 /* VIA UDMA 66 devices */
@@ -480,7 +480,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
480 .flags = ATA_FLAG_SLAVE_POSS, 480 .flags = ATA_FLAG_SLAVE_POSS,
481 .pio_mask = 0x1f, 481 .pio_mask = 0x1f,
482 .mwdma_mask = 0x07, 482 .mwdma_mask = 0x07,
483 .udma_mask = 0x1f, 483 .udma_mask = ATA_UDMA4,
484 .port_ops = &via_port_ops 484 .port_ops = &via_port_ops
485 }; 485 };
486 /* VIA UDMA 100 devices */ 486 /* VIA UDMA 100 devices */
@@ -489,7 +489,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
489 .flags = ATA_FLAG_SLAVE_POSS, 489 .flags = ATA_FLAG_SLAVE_POSS,
490 .pio_mask = 0x1f, 490 .pio_mask = 0x1f,
491 .mwdma_mask = 0x07, 491 .mwdma_mask = 0x07,
492 .udma_mask = 0x3f, 492 .udma_mask = ATA_UDMA5,
493 .port_ops = &via_port_ops 493 .port_ops = &via_port_ops
494 }; 494 };
495 /* UDMA133 with bad AST (All current 133) */ 495 /* UDMA133 with bad AST (All current 133) */
@@ -498,7 +498,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
498 .flags = ATA_FLAG_SLAVE_POSS, 498 .flags = ATA_FLAG_SLAVE_POSS,
499 .pio_mask = 0x1f, 499 .pio_mask = 0x1f,
500 .mwdma_mask = 0x07, 500 .mwdma_mask = 0x07,
501 .udma_mask = 0x7f, /* FIXME: should check north bridge */ 501 .udma_mask = ATA_UDMA6, /* FIXME: should check north bridge */
502 .port_ops = &via_port_ops 502 .port_ops = &via_port_ops
503 }; 503 };
504 struct ata_port_info type; 504 struct ata_port_info type;
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
index f12c2b6ac08e..bec1de594de8 100644
--- a/drivers/ata/pdc_adma.c
+++ b/drivers/ata/pdc_adma.c
@@ -145,32 +145,32 @@ static struct scsi_host_template adma_ata_sht = {
145 .name = DRV_NAME, 145 .name = DRV_NAME,
146 .ioctl = ata_scsi_ioctl, 146 .ioctl = ata_scsi_ioctl,
147 .queuecommand = ata_scsi_queuecmd, 147 .queuecommand = ata_scsi_queuecmd,
148 .slave_configure = ata_scsi_slave_config,
149 .slave_destroy = ata_scsi_slave_destroy,
150 .bios_param = ata_std_bios_param,
151 .proc_name = DRV_NAME,
148 .can_queue = ATA_DEF_QUEUE, 152 .can_queue = ATA_DEF_QUEUE,
149 .this_id = ATA_SHT_THIS_ID, 153 .this_id = ATA_SHT_THIS_ID,
150 .sg_tablesize = LIBATA_MAX_PRD, 154 .sg_tablesize = LIBATA_MAX_PRD,
155 .dma_boundary = ADMA_DMA_BOUNDARY,
151 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 156 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
152 .emulated = ATA_SHT_EMULATED,
153 .use_clustering = ENABLE_CLUSTERING, 157 .use_clustering = ENABLE_CLUSTERING,
154 .proc_name = DRV_NAME, 158 .emulated = ATA_SHT_EMULATED,
155 .dma_boundary = ADMA_DMA_BOUNDARY,
156 .slave_configure = ata_scsi_slave_config,
157 .slave_destroy = ata_scsi_slave_destroy,
158 .bios_param = ata_std_bios_param,
159}; 159};
160 160
161static const struct ata_port_operations adma_ata_ops = { 161static const struct ata_port_operations adma_ata_ops = {
162 .port_disable = ata_port_disable, 162 .port_disable = ata_port_disable,
163 .tf_load = ata_tf_load, 163 .tf_load = ata_tf_load,
164 .tf_read = ata_tf_read, 164 .tf_read = ata_tf_read,
165 .check_status = ata_check_status,
166 .check_atapi_dma = adma_check_atapi_dma,
167 .exec_command = ata_exec_command, 165 .exec_command = ata_exec_command,
166 .check_status = ata_check_status,
168 .dev_select = ata_std_dev_select, 167 .dev_select = ata_std_dev_select,
169 .phy_reset = adma_phy_reset, 168 .phy_reset = adma_phy_reset,
169 .check_atapi_dma = adma_check_atapi_dma,
170 .data_xfer = ata_data_xfer,
170 .qc_prep = adma_qc_prep, 171 .qc_prep = adma_qc_prep,
171 .qc_issue = adma_qc_issue, 172 .qc_issue = adma_qc_issue,
172 .eng_timeout = adma_eng_timeout, 173 .eng_timeout = adma_eng_timeout,
173 .data_xfer = ata_data_xfer,
174 .irq_clear = adma_irq_clear, 174 .irq_clear = adma_irq_clear,
175 .irq_on = ata_irq_on, 175 .irq_on = ata_irq_on,
176 .irq_ack = ata_irq_ack, 176 .irq_ack = ata_irq_ack,
@@ -188,7 +188,7 @@ static struct ata_port_info adma_port_info[] = {
188 ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO | 188 ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO |
189 ATA_FLAG_PIO_POLLING, 189 ATA_FLAG_PIO_POLLING,
190 .pio_mask = 0x10, /* pio4 */ 190 .pio_mask = 0x10, /* pio4 */
191 .udma_mask = 0x1f, /* udma0-4 */ 191 .udma_mask = ATA_UDMA4,
192 .port_ops = &adma_ata_ops, 192 .port_ops = &adma_ata_ops,
193 }, 193 },
194}; 194};
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index dc3bbce04676..3de183461c3c 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -192,7 +192,7 @@ static void inic_reset_port(void __iomem *port_base)
192 192
193static u32 inic_scr_read(struct ata_port *ap, unsigned sc_reg) 193static u32 inic_scr_read(struct ata_port *ap, unsigned sc_reg)
194{ 194{
195 void __iomem *scr_addr = (void __iomem *)ap->ioaddr.scr_addr; 195 void __iomem *scr_addr = ap->ioaddr.scr_addr;
196 void __iomem *addr; 196 void __iomem *addr;
197 u32 val; 197 u32 val;
198 198
@@ -210,7 +210,7 @@ static u32 inic_scr_read(struct ata_port *ap, unsigned sc_reg)
210 210
211static void inic_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val) 211static void inic_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val)
212{ 212{
213 void __iomem *scr_addr = (void __iomem *)ap->ioaddr.scr_addr; 213 void __iomem *scr_addr = ap->ioaddr.scr_addr;
214 void __iomem *addr; 214 void __iomem *addr;
215 215
216 if (unlikely(sc_reg >= ARRAY_SIZE(scr_map))) 216 if (unlikely(sc_reg >= ARRAY_SIZE(scr_map)))
@@ -594,7 +594,7 @@ static struct ata_port_info inic_port_info = {
594 .flags = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA, 594 .flags = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA,
595 .pio_mask = 0x1f, /* pio0-4 */ 595 .pio_mask = 0x1f, /* pio0-4 */
596 .mwdma_mask = 0x07, /* mwdma0-2 */ 596 .mwdma_mask = 0x07, /* mwdma0-2 */
597 .udma_mask = 0x7f, /* udma0-6 */ 597 .udma_mask = ATA_UDMA6,
598 .port_ops = &inic_port_ops 598 .port_ops = &inic_port_ops
599}; 599};
600 600
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 590f2f92b4e0..3873b29c80d6 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -526,44 +526,44 @@ static const struct ata_port_info mv_port_info[] = {
526 { /* chip_504x */ 526 { /* chip_504x */
527 .flags = MV_COMMON_FLAGS, 527 .flags = MV_COMMON_FLAGS,
528 .pio_mask = 0x1f, /* pio0-4 */ 528 .pio_mask = 0x1f, /* pio0-4 */
529 .udma_mask = 0x7f, /* udma0-6 */ 529 .udma_mask = ATA_UDMA6,
530 .port_ops = &mv5_ops, 530 .port_ops = &mv5_ops,
531 }, 531 },
532 { /* chip_508x */ 532 { /* chip_508x */
533 .flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC), 533 .flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC),
534 .pio_mask = 0x1f, /* pio0-4 */ 534 .pio_mask = 0x1f, /* pio0-4 */
535 .udma_mask = 0x7f, /* udma0-6 */ 535 .udma_mask = ATA_UDMA6,
536 .port_ops = &mv5_ops, 536 .port_ops = &mv5_ops,
537 }, 537 },
538 { /* chip_5080 */ 538 { /* chip_5080 */
539 .flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC), 539 .flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC),
540 .pio_mask = 0x1f, /* pio0-4 */ 540 .pio_mask = 0x1f, /* pio0-4 */
541 .udma_mask = 0x7f, /* udma0-6 */ 541 .udma_mask = ATA_UDMA6,
542 .port_ops = &mv5_ops, 542 .port_ops = &mv5_ops,
543 }, 543 },
544 { /* chip_604x */ 544 { /* chip_604x */
545 .flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS), 545 .flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS),
546 .pio_mask = 0x1f, /* pio0-4 */ 546 .pio_mask = 0x1f, /* pio0-4 */
547 .udma_mask = 0x7f, /* udma0-6 */ 547 .udma_mask = ATA_UDMA6,
548 .port_ops = &mv6_ops, 548 .port_ops = &mv6_ops,
549 }, 549 },
550 { /* chip_608x */ 550 { /* chip_608x */
551 .flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS | 551 .flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS |
552 MV_FLAG_DUAL_HC), 552 MV_FLAG_DUAL_HC),
553 .pio_mask = 0x1f, /* pio0-4 */ 553 .pio_mask = 0x1f, /* pio0-4 */
554 .udma_mask = 0x7f, /* udma0-6 */ 554 .udma_mask = ATA_UDMA6,
555 .port_ops = &mv6_ops, 555 .port_ops = &mv6_ops,
556 }, 556 },
557 { /* chip_6042 */ 557 { /* chip_6042 */
558 .flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS), 558 .flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS),
559 .pio_mask = 0x1f, /* pio0-4 */ 559 .pio_mask = 0x1f, /* pio0-4 */
560 .udma_mask = 0x7f, /* udma0-6 */ 560 .udma_mask = ATA_UDMA6,
561 .port_ops = &mv_iie_ops, 561 .port_ops = &mv_iie_ops,
562 }, 562 },
563 { /* chip_7042 */ 563 { /* chip_7042 */
564 .flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS), 564 .flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS),
565 .pio_mask = 0x1f, /* pio0-4 */ 565 .pio_mask = 0x1f, /* pio0-4 */
566 .udma_mask = 0x7f, /* udma0-6 */ 566 .udma_mask = ATA_UDMA6,
567 .port_ops = &mv_iie_ops, 567 .port_ops = &mv_iie_ops,
568 }, 568 },
569}; 569};
@@ -2338,7 +2338,7 @@ static void mv_print_info(struct ata_host *host)
2338 struct pci_dev *pdev = to_pci_dev(host->dev); 2338 struct pci_dev *pdev = to_pci_dev(host->dev);
2339 struct mv_host_priv *hpriv = host->private_data; 2339 struct mv_host_priv *hpriv = host->private_data;
2340 u8 rev_id, scc; 2340 u8 rev_id, scc;
2341 const char *scc_s; 2341 const char *scc_s, *gen;
2342 2342
2343 /* Use this to determine the HW stepping of the chip so we know 2343 /* Use this to determine the HW stepping of the chip so we know
2344 * what errata to workaround 2344 * what errata to workaround
@@ -2351,11 +2351,20 @@ static void mv_print_info(struct ata_host *host)
2351 else if (scc == 0x01) 2351 else if (scc == 0x01)
2352 scc_s = "RAID"; 2352 scc_s = "RAID";
2353 else 2353 else
2354 scc_s = "unknown"; 2354 scc_s = "?";
2355
2356 if (IS_GEN_I(hpriv))
2357 gen = "I";
2358 else if (IS_GEN_II(hpriv))
2359 gen = "II";
2360 else if (IS_GEN_IIE(hpriv))
2361 gen = "IIE";
2362 else
2363 gen = "?";
2355 2364
2356 dev_printk(KERN_INFO, &pdev->dev, 2365 dev_printk(KERN_INFO, &pdev->dev,
2357 "%u slots %u ports %s mode IRQ via %s\n", 2366 "Gen-%s %u slots %u ports %s mode IRQ via %s\n",
2358 (unsigned)MV_MAX_Q_DEPTH, host->n_ports, 2367 gen, (unsigned)MV_MAX_Q_DEPTH, host->n_ports,
2359 scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx"); 2368 scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx");
2360} 2369}
2361 2370
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 6dc0b011a6b7..2ad5872fe90c 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -45,8 +45,7 @@
45#include "sata_promise.h" 45#include "sata_promise.h"
46 46
47#define DRV_NAME "sata_promise" 47#define DRV_NAME "sata_promise"
48#define DRV_VERSION "2.07" 48#define DRV_VERSION "2.08"
49
50 49
51enum { 50enum {
52 PDC_MAX_PORTS = 4, 51 PDC_MAX_PORTS = 4,
@@ -94,7 +93,7 @@ enum {
94 board_20319 = 2, /* FastTrak S150 TX4 */ 93 board_20319 = 2, /* FastTrak S150 TX4 */
95 board_20619 = 3, /* FastTrak TX4000 */ 94 board_20619 = 3, /* FastTrak TX4000 */
96 board_2057x = 4, /* SATAII150 Tx2plus */ 95 board_2057x = 4, /* SATAII150 Tx2plus */
97 board_2057x_pata = 5, /* SATAII150 Tx2plus */ 96 board_2057x_pata = 5, /* SATAII150 Tx2plus PATA port */
98 board_40518 = 6, /* SATAII150 Tx4 */ 97 board_40518 = 6, /* SATAII150 Tx4 */
99 98
100 PDC_HAS_PATA = (1 << 1), /* PDC20375/20575 has PATA */ 99 PDC_HAS_PATA = (1 << 1), /* PDC20375/20575 has PATA */
@@ -124,7 +123,6 @@ enum {
124 PDC_FLAG_4_PORTS = (1 << 26), /* 4 ports */ 123 PDC_FLAG_4_PORTS = (1 << 26), /* 4 ports */
125}; 124};
126 125
127
128struct pdc_port_priv { 126struct pdc_port_priv {
129 u8 *pkt; 127 u8 *pkt;
130 dma_addr_t pkt_dma; 128 dma_addr_t pkt_dma;
@@ -252,7 +250,7 @@ static const struct ata_port_info pdc_port_info[] = {
252 PDC_FLAG_SATA_PATA, 250 PDC_FLAG_SATA_PATA,
253 .pio_mask = 0x1f, /* pio0-4 */ 251 .pio_mask = 0x1f, /* pio0-4 */
254 .mwdma_mask = 0x07, /* mwdma0-2 */ 252 .mwdma_mask = 0x07, /* mwdma0-2 */
255 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 253 .udma_mask = ATA_UDMA6,
256 .port_ops = &pdc_old_sata_ops, 254 .port_ops = &pdc_old_sata_ops,
257 }, 255 },
258 256
@@ -261,7 +259,7 @@ static const struct ata_port_info pdc_port_info[] = {
261 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS, 259 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS,
262 .pio_mask = 0x1f, /* pio0-4 */ 260 .pio_mask = 0x1f, /* pio0-4 */
263 .mwdma_mask = 0x07, /* mwdma0-2 */ 261 .mwdma_mask = 0x07, /* mwdma0-2 */
264 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 262 .udma_mask = ATA_UDMA6,
265 .port_ops = &pdc_pata_ops, 263 .port_ops = &pdc_pata_ops,
266 }, 264 },
267 265
@@ -271,7 +269,7 @@ static const struct ata_port_info pdc_port_info[] = {
271 PDC_FLAG_4_PORTS, 269 PDC_FLAG_4_PORTS,
272 .pio_mask = 0x1f, /* pio0-4 */ 270 .pio_mask = 0x1f, /* pio0-4 */
273 .mwdma_mask = 0x07, /* mwdma0-2 */ 271 .mwdma_mask = 0x07, /* mwdma0-2 */
274 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 272 .udma_mask = ATA_UDMA6,
275 .port_ops = &pdc_old_sata_ops, 273 .port_ops = &pdc_old_sata_ops,
276 }, 274 },
277 275
@@ -281,7 +279,7 @@ static const struct ata_port_info pdc_port_info[] = {
281 PDC_FLAG_4_PORTS, 279 PDC_FLAG_4_PORTS,
282 .pio_mask = 0x1f, /* pio0-4 */ 280 .pio_mask = 0x1f, /* pio0-4 */
283 .mwdma_mask = 0x07, /* mwdma0-2 */ 281 .mwdma_mask = 0x07, /* mwdma0-2 */
284 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 282 .udma_mask = ATA_UDMA6,
285 .port_ops = &pdc_pata_ops, 283 .port_ops = &pdc_pata_ops,
286 }, 284 },
287 285
@@ -291,7 +289,7 @@ static const struct ata_port_info pdc_port_info[] = {
291 PDC_FLAG_GEN_II | PDC_FLAG_SATA_PATA, 289 PDC_FLAG_GEN_II | PDC_FLAG_SATA_PATA,
292 .pio_mask = 0x1f, /* pio0-4 */ 290 .pio_mask = 0x1f, /* pio0-4 */
293 .mwdma_mask = 0x07, /* mwdma0-2 */ 291 .mwdma_mask = 0x07, /* mwdma0-2 */
294 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 292 .udma_mask = ATA_UDMA6,
295 .port_ops = &pdc_sata_ops, 293 .port_ops = &pdc_sata_ops,
296 }, 294 },
297 295
@@ -301,7 +299,7 @@ static const struct ata_port_info pdc_port_info[] = {
301 PDC_FLAG_GEN_II, 299 PDC_FLAG_GEN_II,
302 .pio_mask = 0x1f, /* pio0-4 */ 300 .pio_mask = 0x1f, /* pio0-4 */
303 .mwdma_mask = 0x07, /* mwdma0-2 */ 301 .mwdma_mask = 0x07, /* mwdma0-2 */
304 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 302 .udma_mask = ATA_UDMA6,
305 .port_ops = &pdc_pata_ops, 303 .port_ops = &pdc_pata_ops,
306 }, 304 },
307 305
@@ -311,7 +309,7 @@ static const struct ata_port_info pdc_port_info[] = {
311 PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS, 309 PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS,
312 .pio_mask = 0x1f, /* pio0-4 */ 310 .pio_mask = 0x1f, /* pio0-4 */
313 .mwdma_mask = 0x07, /* mwdma0-2 */ 311 .mwdma_mask = 0x07, /* mwdma0-2 */
314 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 312 .udma_mask = ATA_UDMA6,
315 .port_ops = &pdc_sata_ops, 313 .port_ops = &pdc_sata_ops,
316 }, 314 },
317}; 315};
@@ -340,7 +338,6 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = {
340 { } /* terminate list */ 338 { } /* terminate list */
341}; 339};
342 340
343
344static struct pci_driver pdc_ata_pci_driver = { 341static struct pci_driver pdc_ata_pci_driver = {
345 .name = DRV_NAME, 342 .name = DRV_NAME,
346 .id_table = pdc_ata_pci_tbl, 343 .id_table = pdc_ata_pci_tbl,
@@ -348,7 +345,6 @@ static struct pci_driver pdc_ata_pci_driver = {
348 .remove = ata_pci_remove_one, 345 .remove = ata_pci_remove_one,
349}; 346};
350 347
351
352static int pdc_common_port_start(struct ata_port *ap) 348static int pdc_common_port_start(struct ata_port *ap)
353{ 349{
354 struct device *dev = ap->host->dev; 350 struct device *dev = ap->host->dev;
@@ -382,7 +378,7 @@ static int pdc_sata_port_start(struct ata_port *ap)
382 378
383 /* fix up PHYMODE4 align timing */ 379 /* fix up PHYMODE4 align timing */
384 if (ap->flags & PDC_FLAG_GEN_II) { 380 if (ap->flags & PDC_FLAG_GEN_II) {
385 void __iomem *mmio = (void __iomem *) ap->ioaddr.scr_addr; 381 void __iomem *mmio = ap->ioaddr.scr_addr;
386 unsigned int tmp; 382 unsigned int tmp;
387 383
388 tmp = readl(mmio + 0x014); 384 tmp = readl(mmio + 0x014);
@@ -418,7 +414,7 @@ static void pdc_reset_port(struct ata_port *ap)
418static int pdc_pata_cable_detect(struct ata_port *ap) 414static int pdc_pata_cable_detect(struct ata_port *ap)
419{ 415{
420 u8 tmp; 416 u8 tmp;
421 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03; 417 void __iomem *mmio = ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03;
422 418
423 tmp = readb(mmio); 419 tmp = readb(mmio);
424 if (tmp & 0x01) 420 if (tmp & 0x01)
@@ -438,7 +434,6 @@ static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg)
438 return readl(ap->ioaddr.scr_addr + (sc_reg * 4)); 434 return readl(ap->ioaddr.scr_addr + (sc_reg * 4));
439} 435}
440 436
441
442static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, 437static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg,
443 u32 val) 438 u32 val)
444{ 439{
@@ -573,7 +568,7 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc)
573 568
574static void pdc_freeze(struct ata_port *ap) 569static void pdc_freeze(struct ata_port *ap)
575{ 570{
576 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr; 571 void __iomem *mmio = ap->ioaddr.cmd_addr;
577 u32 tmp; 572 u32 tmp;
578 573
579 tmp = readl(mmio + PDC_CTLSTAT); 574 tmp = readl(mmio + PDC_CTLSTAT);
@@ -585,7 +580,7 @@ static void pdc_freeze(struct ata_port *ap)
585 580
586static void pdc_thaw(struct ata_port *ap) 581static void pdc_thaw(struct ata_port *ap)
587{ 582{
588 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr; 583 void __iomem *mmio = ap->ioaddr.cmd_addr;
589 u32 tmp; 584 u32 tmp;
590 585
591 /* clear IRQ */ 586 /* clear IRQ */
@@ -657,8 +652,8 @@ static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc,
657 ata_port_abort(ap); 652 ata_port_abort(ap);
658} 653}
659 654
660static inline unsigned int pdc_host_intr( struct ata_port *ap, 655static inline unsigned int pdc_host_intr(struct ata_port *ap,
661 struct ata_queued_cmd *qc) 656 struct ata_queued_cmd *qc)
662{ 657{
663 unsigned int handled = 0; 658 unsigned int handled = 0;
664 void __iomem *port_mmio = ap->ioaddr.cmd_addr; 659 void __iomem *port_mmio = ap->ioaddr.cmd_addr;
@@ -685,10 +680,10 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap,
685 handled = 1; 680 handled = 1;
686 break; 681 break;
687 682
688 default: 683 default:
689 ap->stats.idle_irq++; 684 ap->stats.idle_irq++;
690 break; 685 break;
691 } 686 }
692 687
693 return handled; 688 return handled;
694} 689}
@@ -701,6 +696,18 @@ static void pdc_irq_clear(struct ata_port *ap)
701 readl(mmio + PDC_INT_SEQMASK); 696 readl(mmio + PDC_INT_SEQMASK);
702} 697}
703 698
699static inline int pdc_is_sataii_tx4(unsigned long flags)
700{
701 const unsigned long mask = PDC_FLAG_GEN_II | PDC_FLAG_4_PORTS;
702 return (flags & mask) == mask;
703}
704
705static inline unsigned int pdc_port_no_to_ata_no(unsigned int port_no, int is_sataii_tx4)
706{
707 static const unsigned char sataii_tx4_port_remap[4] = { 3, 1, 0, 2};
708 return is_sataii_tx4 ? sataii_tx4_port_remap[port_no] : port_no;
709}
710
704static irqreturn_t pdc_interrupt (int irq, void *dev_instance) 711static irqreturn_t pdc_interrupt (int irq, void *dev_instance)
705{ 712{
706 struct ata_host *host = dev_instance; 713 struct ata_host *host = dev_instance;
@@ -807,7 +814,6 @@ static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
807 ata_tf_load(ap, tf); 814 ata_tf_load(ap, tf);
808} 815}
809 816
810
811static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf) 817static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
812{ 818{
813 WARN_ON (tf->protocol == ATA_PROT_DMA || 819 WARN_ON (tf->protocol == ATA_PROT_DMA ||
@@ -867,7 +873,6 @@ static void pdc_ata_setup_port(struct ata_port *ap,
867 ap->ioaddr.scr_addr = scr_addr; 873 ap->ioaddr.scr_addr = scr_addr;
868} 874}
869 875
870
871static void pdc_host_init(struct ata_host *host) 876static void pdc_host_init(struct ata_host *host)
872{ 877{
873 void __iomem *mmio = host->iomap[PDC_MMIO_BAR]; 878 void __iomem *mmio = host->iomap[PDC_MMIO_BAR];
@@ -955,10 +960,8 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
955 960
956 if (pi->flags & PDC_FLAG_SATA_PATA) { 961 if (pi->flags & PDC_FLAG_SATA_PATA) {
957 u8 tmp = readb(base + PDC_FLASH_CTL+1); 962 u8 tmp = readb(base + PDC_FLASH_CTL+1);
958 if (!(tmp & 0x80)) { 963 if (!(tmp & 0x80))
959 ppi[n_ports++] = pi + 1; 964 ppi[n_ports++] = pi + 1;
960 dev_printk(KERN_INFO, &pdev->dev, "PATA port found\n");
961 }
962 } 965 }
963 966
964 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); 967 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports);
@@ -968,22 +971,12 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
968 } 971 }
969 host->iomap = pcim_iomap_table(pdev); 972 host->iomap = pcim_iomap_table(pdev);
970 973
971 is_sataii_tx4 = 0; 974 is_sataii_tx4 = pdc_is_sataii_tx4(pi->flags);
972 if ((pi->flags & (PDC_FLAG_GEN_II|PDC_FLAG_4_PORTS)) == (PDC_FLAG_GEN_II|PDC_FLAG_4_PORTS)) {
973 is_sataii_tx4 = 1;
974 dev_printk(KERN_INFO, &pdev->dev, "applying SATAII TX4 port numbering workaround\n");
975 }
976 for (i = 0; i < host->n_ports; i++) { 975 for (i = 0; i < host->n_ports; i++) {
977 static const unsigned char sataii_tx4_port_remap[4] = { 3, 1, 0, 2}; 976 unsigned int ata_no = pdc_port_no_to_ata_no(i, is_sataii_tx4);
978 int ata_nr;
979
980 ata_nr = i;
981 if (is_sataii_tx4)
982 ata_nr = sataii_tx4_port_remap[i];
983
984 pdc_ata_setup_port(host->ports[i], 977 pdc_ata_setup_port(host->ports[i],
985 base + 0x200 + ata_nr * 0x80, 978 base + 0x200 + ata_no * 0x80,
986 base + 0x400 + ata_nr * 0x100); 979 base + 0x400 + ata_no * 0x100);
987 } 980 }
988 981
989 /* initialize adapter */ 982 /* initialize adapter */
@@ -1002,19 +995,16 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
1002 &pdc_ata_sht); 995 &pdc_ata_sht);
1003} 996}
1004 997
1005
1006static int __init pdc_ata_init(void) 998static int __init pdc_ata_init(void)
1007{ 999{
1008 return pci_register_driver(&pdc_ata_pci_driver); 1000 return pci_register_driver(&pdc_ata_pci_driver);
1009} 1001}
1010 1002
1011
1012static void __exit pdc_ata_exit(void) 1003static void __exit pdc_ata_exit(void)
1013{ 1004{
1014 pci_unregister_driver(&pdc_ata_pci_driver); 1005 pci_unregister_driver(&pdc_ata_pci_driver);
1015} 1006}
1016 1007
1017
1018MODULE_AUTHOR("Jeff Garzik"); 1008MODULE_AUTHOR("Jeff Garzik");
1019MODULE_DESCRIPTION("Promise ATA TX2/TX4/TX4000 low-level driver"); 1009MODULE_DESCRIPTION("Promise ATA TX2/TX4/TX4000 low-level driver");
1020MODULE_LICENSE("GPL"); 1010MODULE_LICENSE("GPL");
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index 6688ccb66320..9ab554da89bf 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -176,7 +176,7 @@ static const struct ata_port_info qs_port_info[] = {
176 //FIXME ATA_FLAG_SRST | 176 //FIXME ATA_FLAG_SRST |
177 ATA_FLAG_MMIO | ATA_FLAG_PIO_POLLING, 177 ATA_FLAG_MMIO | ATA_FLAG_PIO_POLLING,
178 .pio_mask = 0x10, /* pio4 */ 178 .pio_mask = 0x10, /* pio4 */
179 .udma_mask = 0x7f, /* udma0-6 */ 179 .udma_mask = ATA_UDMA6,
180 .port_ops = &qs_ata_ops, 180 .port_ops = &qs_ata_ops,
181 }, 181 },
182}; 182};
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index a3b339bcf3cf..2a86dc4598d0 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -218,7 +218,7 @@ static const struct ata_port_info sil_port_info[] = {
218 .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE, 218 .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE,
219 .pio_mask = 0x1f, /* pio0-4 */ 219 .pio_mask = 0x1f, /* pio0-4 */
220 .mwdma_mask = 0x07, /* mwdma0-2 */ 220 .mwdma_mask = 0x07, /* mwdma0-2 */
221 .udma_mask = 0x3f, /* udma0-5 */ 221 .udma_mask = ATA_UDMA5,
222 .port_ops = &sil_ops, 222 .port_ops = &sil_ops,
223 }, 223 },
224 /* sil_3112_no_sata_irq */ 224 /* sil_3112_no_sata_irq */
@@ -227,7 +227,7 @@ static const struct ata_port_info sil_port_info[] = {
227 SIL_FLAG_NO_SATA_IRQ, 227 SIL_FLAG_NO_SATA_IRQ,
228 .pio_mask = 0x1f, /* pio0-4 */ 228 .pio_mask = 0x1f, /* pio0-4 */
229 .mwdma_mask = 0x07, /* mwdma0-2 */ 229 .mwdma_mask = 0x07, /* mwdma0-2 */
230 .udma_mask = 0x3f, /* udma0-5 */ 230 .udma_mask = ATA_UDMA5,
231 .port_ops = &sil_ops, 231 .port_ops = &sil_ops,
232 }, 232 },
233 /* sil_3512 */ 233 /* sil_3512 */
@@ -235,7 +235,7 @@ static const struct ata_port_info sil_port_info[] = {
235 .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT, 235 .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT,
236 .pio_mask = 0x1f, /* pio0-4 */ 236 .pio_mask = 0x1f, /* pio0-4 */
237 .mwdma_mask = 0x07, /* mwdma0-2 */ 237 .mwdma_mask = 0x07, /* mwdma0-2 */
238 .udma_mask = 0x3f, /* udma0-5 */ 238 .udma_mask = ATA_UDMA5,
239 .port_ops = &sil_ops, 239 .port_ops = &sil_ops,
240 }, 240 },
241 /* sil_3114 */ 241 /* sil_3114 */
@@ -243,7 +243,7 @@ static const struct ata_port_info sil_port_info[] = {
243 .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT, 243 .flags = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT,
244 .pio_mask = 0x1f, /* pio0-4 */ 244 .pio_mask = 0x1f, /* pio0-4 */
245 .mwdma_mask = 0x07, /* mwdma0-2 */ 245 .mwdma_mask = 0x07, /* mwdma0-2 */
246 .udma_mask = 0x3f, /* udma0-5 */ 246 .udma_mask = ATA_UDMA5,
247 .port_ops = &sil_ops, 247 .port_ops = &sil_ops,
248 }, 248 },
249}; 249};
@@ -262,8 +262,9 @@ static const struct {
262 unsigned long sfis_cfg; /* SATA FIS reception config register */ 262 unsigned long sfis_cfg; /* SATA FIS reception config register */
263} sil_port[] = { 263} sil_port[] = {
264 /* port 0 ... */ 264 /* port 0 ... */
265 { 0x80, 0x8A, 0x00, 0x10, 0x40, 0x100, 0x148, 0xb4, 0x14c }, 265 /* tf ctl bmdma bmdma2 fifo scr sien mode sfis */
266 { 0xC0, 0xCA, 0x08, 0x18, 0x44, 0x180, 0x1c8, 0xf4, 0x1cc }, 266 { 0x80, 0x8A, 0x0, 0x10, 0x40, 0x100, 0x148, 0xb4, 0x14c },
267 { 0xC0, 0xCA, 0x8, 0x18, 0x44, 0x180, 0x1c8, 0xf4, 0x1cc },
267 { 0x280, 0x28A, 0x200, 0x210, 0x240, 0x300, 0x348, 0x2b4, 0x34c }, 268 { 0x280, 0x28A, 0x200, 0x210, 0x240, 0x300, 0x348, 0x2b4, 0x34c },
268 { 0x2C0, 0x2CA, 0x208, 0x218, 0x244, 0x380, 0x3c8, 0x2f4, 0x3cc }, 269 { 0x2C0, 0x2CA, 0x208, 0x218, 0x244, 0x380, 0x3c8, 0x2f4, 0x3cc },
269 /* ... port 3 */ 270 /* ... port 3 */
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 0ddfae9911cd..ac43a30ebe29 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -426,7 +426,7 @@ static const struct ata_port_info sil24_port_info[] = {
426 SIL24_FLAG_PCIX_IRQ_WOC, 426 SIL24_FLAG_PCIX_IRQ_WOC,
427 .pio_mask = 0x1f, /* pio0-4 */ 427 .pio_mask = 0x1f, /* pio0-4 */
428 .mwdma_mask = 0x07, /* mwdma0-2 */ 428 .mwdma_mask = 0x07, /* mwdma0-2 */
429 .udma_mask = 0x3f, /* udma0-5 */ 429 .udma_mask = ATA_UDMA5, /* udma0-5 */
430 .port_ops = &sil24_ops, 430 .port_ops = &sil24_ops,
431 }, 431 },
432 /* sil_3132 */ 432 /* sil_3132 */
@@ -434,7 +434,7 @@ static const struct ata_port_info sil24_port_info[] = {
434 .flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(2), 434 .flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(2),
435 .pio_mask = 0x1f, /* pio0-4 */ 435 .pio_mask = 0x1f, /* pio0-4 */
436 .mwdma_mask = 0x07, /* mwdma0-2 */ 436 .mwdma_mask = 0x07, /* mwdma0-2 */
437 .udma_mask = 0x3f, /* udma0-5 */ 437 .udma_mask = ATA_UDMA5, /* udma0-5 */
438 .port_ops = &sil24_ops, 438 .port_ops = &sil24_ops,
439 }, 439 },
440 /* sil_3131/sil_3531 */ 440 /* sil_3131/sil_3531 */
@@ -442,7 +442,7 @@ static const struct ata_port_info sil24_port_info[] = {
442 .flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(1), 442 .flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(1),
443 .pio_mask = 0x1f, /* pio0-4 */ 443 .pio_mask = 0x1f, /* pio0-4 */
444 .mwdma_mask = 0x07, /* mwdma0-2 */ 444 .mwdma_mask = 0x07, /* mwdma0-2 */
445 .udma_mask = 0x3f, /* udma0-5 */ 445 .udma_mask = ATA_UDMA5, /* udma0-5 */
446 .port_ops = &sil24_ops, 446 .port_ops = &sil24_ops,
447 }, 447 },
448}; 448};
@@ -888,7 +888,7 @@ static irqreturn_t sil24_interrupt(int irq, void *dev_instance)
888 if (status & (1 << i)) { 888 if (status & (1 << i)) {
889 struct ata_port *ap = host->ports[i]; 889 struct ata_port *ap = host->ports[i];
890 if (ap && !(ap->flags & ATA_FLAG_DISABLED)) { 890 if (ap && !(ap->flags & ATA_FLAG_DISABLED)) {
891 sil24_host_intr(host->ports[i]); 891 sil24_host_intr(ap);
892 handled++; 892 handled++;
893 } else 893 } else
894 printk(KERN_ERR DRV_NAME 894 printk(KERN_ERR DRV_NAME
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index f111c984a359..fd80bcf1b236 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -133,7 +133,7 @@ static const struct ata_port_info sis_port_info = {
133 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, 133 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
134 .pio_mask = 0x1f, 134 .pio_mask = 0x1f,
135 .mwdma_mask = 0x7, 135 .mwdma_mask = 0x7,
136 .udma_mask = 0x7f, 136 .udma_mask = ATA_UDMA6,
137 .port_ops = &sis_ops, 137 .port_ops = &sis_ops,
138}; 138};
139 139
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index bcb2cd8b063d..63fe99afd59f 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -107,7 +107,7 @@ static u32 k2_sata_scr_read (struct ata_port *ap, unsigned int sc_reg)
107{ 107{
108 if (sc_reg > SCR_CONTROL) 108 if (sc_reg > SCR_CONTROL)
109 return 0xffffffffU; 109 return 0xffffffffU;
110 return readl((void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); 110 return readl(ap->ioaddr.scr_addr + (sc_reg * 4));
111} 111}
112 112
113 113
@@ -116,7 +116,7 @@ static void k2_sata_scr_write (struct ata_port *ap, unsigned int sc_reg,
116{ 116{
117 if (sc_reg > SCR_CONTROL) 117 if (sc_reg > SCR_CONTROL)
118 return; 118 return;
119 writel(val, (void __iomem *) ap->ioaddr.scr_addr + (sc_reg * 4)); 119 writel(val, ap->ioaddr.scr_addr + (sc_reg * 4));
120} 120}
121 121
122 122
@@ -197,7 +197,8 @@ static void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc)
197 struct ata_port *ap = qc->ap; 197 struct ata_port *ap = qc->ap;
198 unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); 198 unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE);
199 u8 dmactl; 199 u8 dmactl;
200 void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; 200 void __iomem *mmio = ap->ioaddr.bmdma_addr;
201
201 /* load PRD table addr. */ 202 /* load PRD table addr. */
202 mb(); /* make sure PRD table writes are visible to controller */ 203 mb(); /* make sure PRD table writes are visible to controller */
203 writel(ap->prd_dma, mmio + ATA_DMA_TABLE_OFS); 204 writel(ap->prd_dma, mmio + ATA_DMA_TABLE_OFS);
@@ -225,7 +226,7 @@ static void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc)
225static void k2_bmdma_start_mmio (struct ata_queued_cmd *qc) 226static void k2_bmdma_start_mmio (struct ata_queued_cmd *qc)
226{ 227{
227 struct ata_port *ap = qc->ap; 228 struct ata_port *ap = qc->ap;
228 void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr; 229 void __iomem *mmio = ap->ioaddr.bmdma_addr;
229 u8 dmactl; 230 u8 dmactl;
230 231
231 /* start host DMA transaction */ 232 /* start host DMA transaction */
@@ -253,7 +254,7 @@ static void k2_bmdma_start_mmio (struct ata_queued_cmd *qc)
253 254
254static u8 k2_stat_check_status(struct ata_port *ap) 255static u8 k2_stat_check_status(struct ata_port *ap)
255{ 256{
256 return readl((void __iomem *) ap->ioaddr.status_addr); 257 return readl(ap->ioaddr.status_addr);
257} 258}
258 259
259#ifdef CONFIG_PPC_OF 260#ifdef CONFIG_PPC_OF
@@ -360,7 +361,7 @@ static const struct ata_port_info k2_port_info[] = {
360 ATA_FLAG_MMIO | K2_FLAG_NO_ATAPI_DMA, 361 ATA_FLAG_MMIO | K2_FLAG_NO_ATAPI_DMA,
361 .pio_mask = 0x1f, 362 .pio_mask = 0x1f,
362 .mwdma_mask = 0x07, 363 .mwdma_mask = 0x07,
363 .udma_mask = 0x7f, 364 .udma_mask = ATA_UDMA6,
364 .port_ops = &k2_sata_ops, 365 .port_ops = &k2_sata_ops,
365 }, 366 },
366 /* board_svw8 */ 367 /* board_svw8 */
@@ -370,7 +371,7 @@ static const struct ata_port_info k2_port_info[] = {
370 K2_FLAG_SATA_8_PORTS, 371 K2_FLAG_SATA_8_PORTS,
371 .pio_mask = 0x1f, 372 .pio_mask = 0x1f,
372 .mwdma_mask = 0x07, 373 .mwdma_mask = 0x07,
373 .udma_mask = 0x7f, 374 .udma_mask = ATA_UDMA6,
374 .port_ops = &k2_sata_ops, 375 .port_ops = &k2_sata_ops,
375 }, 376 },
376}; 377};
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
index 2d14f3d56d92..5193bd8647ba 100644
--- a/drivers/ata/sata_sx4.c
+++ b/drivers/ata/sata_sx4.c
@@ -30,6 +30,54 @@
30 * 30 *
31 */ 31 */
32 32
33/*
34 Theory of operation
35 -------------------
36
37 The SX4 (PDC20621) chip features a single Host DMA (HDMA) copy
38 engine, DIMM memory, and four ATA engines (one per SATA port).
39 Data is copied to/from DIMM memory by the HDMA engine, before
40 handing off to one (or more) of the ATA engines. The ATA
41 engines operate solely on DIMM memory.
42
43 The SX4 behaves like a PATA chip, with no SATA controls or
44 knowledge whatsoever, leading to the presumption that
45 PATA<->SATA bridges exist on SX4 boards, external to the
46 PDC20621 chip itself.
47
48 The chip is quite capable, supporting an XOR engine and linked
49 hardware commands (permits a string to transactions to be
50 submitted and waited-on as a single unit), and an optional
51 microprocessor.
52
53 The limiting factor is largely software. This Linux driver was
54 written to multiplex the single HDMA engine to copy disk
55 transactions into a fixed DIMM memory space, from where an ATA
56 engine takes over. As a result, each WRITE looks like this:
57
58 submit HDMA packet to hardware
59 hardware copies data from system memory to DIMM
60 hardware raises interrupt
61
62 submit ATA packet to hardware
63 hardware executes ATA WRITE command, w/ data in DIMM
64 hardware raises interrupt
65
66 and each READ looks like this:
67
68 submit ATA packet to hardware
69 hardware executes ATA READ command, w/ data in DIMM
70 hardware raises interrupt
71
72 submit HDMA packet to hardware
73 hardware copies data from DIMM to system memory
74 hardware raises interrupt
75
76 This is a very slow, lock-step way of doing things that can
77 certainly be improved by motivated kernel hackers.
78
79 */
80
33#include <linux/kernel.h> 81#include <linux/kernel.h>
34#include <linux/module.h> 82#include <linux/module.h>
35#include <linux/pci.h> 83#include <linux/pci.h>
@@ -58,6 +106,8 @@ enum {
58 PDC_INT_SEQMASK = 0x40, /* Mask of asserted SEQ INTs */ 106 PDC_INT_SEQMASK = 0x40, /* Mask of asserted SEQ INTs */
59 PDC_HDMA_CTLSTAT = 0x12C, /* Host DMA control / status */ 107 PDC_HDMA_CTLSTAT = 0x12C, /* Host DMA control / status */
60 108
109 PDC_CTLSTAT = 0x60, /* IDEn control / status */
110
61 PDC_20621_SEQCTL = 0x400, 111 PDC_20621_SEQCTL = 0x400,
62 PDC_20621_SEQMASK = 0x480, 112 PDC_20621_SEQMASK = 0x480,
63 PDC_20621_GENERAL_CTL = 0x484, 113 PDC_20621_GENERAL_CTL = 0x484,
@@ -87,48 +137,60 @@ enum {
87 137
88 board_20621 = 0, /* FastTrak S150 SX4 */ 138 board_20621 = 0, /* FastTrak S150 SX4 */
89 139
90 PDC_RESET = (1 << 11), /* HDMA reset */ 140 PDC_MASK_INT = (1 << 10), /* HDMA/ATA mask int */
141 PDC_RESET = (1 << 11), /* HDMA/ATA reset */
142 PDC_DMA_ENABLE = (1 << 7), /* DMA start/stop */
91 143
92 PDC_MAX_HDMA = 32, 144 PDC_MAX_HDMA = 32,
93 PDC_HDMA_Q_MASK = (PDC_MAX_HDMA - 1), 145 PDC_HDMA_Q_MASK = (PDC_MAX_HDMA - 1),
94 146
95 PDC_DIMM0_SPD_DEV_ADDRESS = 0x50, 147 PDC_DIMM0_SPD_DEV_ADDRESS = 0x50,
96 PDC_DIMM1_SPD_DEV_ADDRESS = 0x51, 148 PDC_DIMM1_SPD_DEV_ADDRESS = 0x51,
97 PDC_MAX_DIMM_MODULE = 0x02, 149 PDC_I2C_CONTROL = 0x48,
98 PDC_I2C_CONTROL_OFFSET = 0x48, 150 PDC_I2C_ADDR_DATA = 0x4C,
99 PDC_I2C_ADDR_DATA_OFFSET = 0x4C, 151 PDC_DIMM0_CONTROL = 0x80,
100 PDC_DIMM0_CONTROL_OFFSET = 0x80, 152 PDC_DIMM1_CONTROL = 0x84,
101 PDC_DIMM1_CONTROL_OFFSET = 0x84, 153 PDC_SDRAM_CONTROL = 0x88,
102 PDC_SDRAM_CONTROL_OFFSET = 0x88, 154 PDC_I2C_WRITE = 0, /* master -> slave */
103 PDC_I2C_WRITE = 0x00000000, 155 PDC_I2C_READ = (1 << 6), /* master <- slave */
104 PDC_I2C_READ = 0x00000040, 156 PDC_I2C_START = (1 << 7), /* start I2C proto */
105 PDC_I2C_START = 0x00000080, 157 PDC_I2C_MASK_INT = (1 << 5), /* mask I2C interrupt */
106 PDC_I2C_MASK_INT = 0x00000020, 158 PDC_I2C_COMPLETE = (1 << 16), /* I2C normal compl. */
107 PDC_I2C_COMPLETE = 0x00010000, 159 PDC_I2C_NO_ACK = (1 << 20), /* slave no-ack addr */
108 PDC_I2C_NO_ACK = 0x00100000, 160 PDC_DIMM_SPD_SUBADDRESS_START = 0x00,
109 PDC_DIMM_SPD_SUBADDRESS_START = 0x00, 161 PDC_DIMM_SPD_SUBADDRESS_END = 0x7F,
110 PDC_DIMM_SPD_SUBADDRESS_END = 0x7F, 162 PDC_DIMM_SPD_ROW_NUM = 3,
111 PDC_DIMM_SPD_ROW_NUM = 3, 163 PDC_DIMM_SPD_COLUMN_NUM = 4,
112 PDC_DIMM_SPD_COLUMN_NUM = 4, 164 PDC_DIMM_SPD_MODULE_ROW = 5,
113 PDC_DIMM_SPD_MODULE_ROW = 5, 165 PDC_DIMM_SPD_TYPE = 11,
114 PDC_DIMM_SPD_TYPE = 11, 166 PDC_DIMM_SPD_FRESH_RATE = 12,
115 PDC_DIMM_SPD_FRESH_RATE = 12, 167 PDC_DIMM_SPD_BANK_NUM = 17,
116 PDC_DIMM_SPD_BANK_NUM = 17, 168 PDC_DIMM_SPD_CAS_LATENCY = 18,
117 PDC_DIMM_SPD_CAS_LATENCY = 18, 169 PDC_DIMM_SPD_ATTRIBUTE = 21,
118 PDC_DIMM_SPD_ATTRIBUTE = 21, 170 PDC_DIMM_SPD_ROW_PRE_CHARGE = 27,
119 PDC_DIMM_SPD_ROW_PRE_CHARGE = 27, 171 PDC_DIMM_SPD_ROW_ACTIVE_DELAY = 28,
120 PDC_DIMM_SPD_ROW_ACTIVE_DELAY = 28, 172 PDC_DIMM_SPD_RAS_CAS_DELAY = 29,
121 PDC_DIMM_SPD_RAS_CAS_DELAY = 29, 173 PDC_DIMM_SPD_ACTIVE_PRECHARGE = 30,
122 PDC_DIMM_SPD_ACTIVE_PRECHARGE = 30, 174 PDC_DIMM_SPD_SYSTEM_FREQ = 126,
123 PDC_DIMM_SPD_SYSTEM_FREQ = 126, 175 PDC_CTL_STATUS = 0x08,
124 PDC_CTL_STATUS = 0x08, 176 PDC_DIMM_WINDOW_CTLR = 0x0C,
125 PDC_DIMM_WINDOW_CTLR = 0x0C, 177 PDC_TIME_CONTROL = 0x3C,
126 PDC_TIME_CONTROL = 0x3C, 178 PDC_TIME_PERIOD = 0x40,
127 PDC_TIME_PERIOD = 0x40, 179 PDC_TIME_COUNTER = 0x44,
128 PDC_TIME_COUNTER = 0x44, 180 PDC_GENERAL_CTLR = 0x484,
129 PDC_GENERAL_CTLR = 0x484, 181 PCI_PLL_INIT = 0x8A531824,
130 PCI_PLL_INIT = 0x8A531824, 182 PCI_X_TCOUNT = 0xEE1E5CFF,
131 PCI_X_TCOUNT = 0xEE1E5CFF 183
184 /* PDC_TIME_CONTROL bits */
185 PDC_TIMER_BUZZER = (1 << 10),
186 PDC_TIMER_MODE_PERIODIC = 0, /* bits 9:8 == 00 */
187 PDC_TIMER_MODE_ONCE = (1 << 8), /* bits 9:8 == 01 */
188 PDC_TIMER_ENABLE = (1 << 7),
189 PDC_TIMER_MASK_INT = (1 << 5),
190 PDC_TIMER_SEQ_MASK = 0x1f, /* SEQ ID for timer */
191 PDC_TIMER_DEFAULT = PDC_TIMER_MODE_ONCE |
192 PDC_TIMER_ENABLE |
193 PDC_TIMER_MASK_INT,
132}; 194};
133 195
134 196
@@ -217,7 +279,7 @@ static const struct ata_port_info pdc_port_info[] = {
217 ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING, 279 ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING,
218 .pio_mask = 0x1f, /* pio0-4 */ 280 .pio_mask = 0x1f, /* pio0-4 */
219 .mwdma_mask = 0x07, /* mwdma0-2 */ 281 .mwdma_mask = 0x07, /* mwdma0-2 */
220 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 282 .udma_mask = ATA_UDMA6,
221 .port_ops = &pdc_20621_ops, 283 .port_ops = &pdc_20621_ops,
222 }, 284 },
223 285
@@ -999,17 +1061,17 @@ static unsigned int pdc20621_i2c_read(struct ata_host *host, u32 device,
999 i2creg |= subaddr << 16; 1061 i2creg |= subaddr << 16;
1000 1062
1001 /* Set the device and subaddress */ 1063 /* Set the device and subaddress */
1002 writel(i2creg, mmio + PDC_I2C_ADDR_DATA_OFFSET); 1064 writel(i2creg, mmio + PDC_I2C_ADDR_DATA);
1003 readl(mmio + PDC_I2C_ADDR_DATA_OFFSET); 1065 readl(mmio + PDC_I2C_ADDR_DATA);
1004 1066
1005 /* Write Control to perform read operation, mask int */ 1067 /* Write Control to perform read operation, mask int */
1006 writel(PDC_I2C_READ | PDC_I2C_START | PDC_I2C_MASK_INT, 1068 writel(PDC_I2C_READ | PDC_I2C_START | PDC_I2C_MASK_INT,
1007 mmio + PDC_I2C_CONTROL_OFFSET); 1069 mmio + PDC_I2C_CONTROL);
1008 1070
1009 for (count = 0; count <= 1000; count ++) { 1071 for (count = 0; count <= 1000; count ++) {
1010 status = readl(mmio + PDC_I2C_CONTROL_OFFSET); 1072 status = readl(mmio + PDC_I2C_CONTROL);
1011 if (status & PDC_I2C_COMPLETE) { 1073 if (status & PDC_I2C_COMPLETE) {
1012 status = readl(mmio + PDC_I2C_ADDR_DATA_OFFSET); 1074 status = readl(mmio + PDC_I2C_ADDR_DATA);
1013 break; 1075 break;
1014 } else if (count == 1000) 1076 } else if (count == 1000)
1015 return 0; 1077 return 0;
@@ -1099,8 +1161,8 @@ static int pdc20621_prog_dimm0(struct ata_host *host)
1099 data |= (((size / 16) - 1) << 16); 1161 data |= (((size / 16) - 1) << 16);
1100 data |= (0 << 23); 1162 data |= (0 << 23);
1101 data |= 8; 1163 data |= 8;
1102 writel(data, mmio + PDC_DIMM0_CONTROL_OFFSET); 1164 writel(data, mmio + PDC_DIMM0_CONTROL);
1103 readl(mmio + PDC_DIMM0_CONTROL_OFFSET); 1165 readl(mmio + PDC_DIMM0_CONTROL);
1104 return size; 1166 return size;
1105} 1167}
1106 1168
@@ -1122,27 +1184,27 @@ static unsigned int pdc20621_prog_dimm_global(struct ata_host *host)
1122 */ 1184 */
1123 1185
1124 data = 0x022259F1; 1186 data = 0x022259F1;
1125 writel(data, mmio + PDC_SDRAM_CONTROL_OFFSET); 1187 writel(data, mmio + PDC_SDRAM_CONTROL);
1126 readl(mmio + PDC_SDRAM_CONTROL_OFFSET); 1188 readl(mmio + PDC_SDRAM_CONTROL);
1127 1189
1128 /* Turn on for ECC */ 1190 /* Turn on for ECC */
1129 pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, 1191 pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS,
1130 PDC_DIMM_SPD_TYPE, &spd0); 1192 PDC_DIMM_SPD_TYPE, &spd0);
1131 if (spd0 == 0x02) { 1193 if (spd0 == 0x02) {
1132 data |= (0x01 << 16); 1194 data |= (0x01 << 16);
1133 writel(data, mmio + PDC_SDRAM_CONTROL_OFFSET); 1195 writel(data, mmio + PDC_SDRAM_CONTROL);
1134 readl(mmio + PDC_SDRAM_CONTROL_OFFSET); 1196 readl(mmio + PDC_SDRAM_CONTROL);
1135 printk(KERN_ERR "Local DIMM ECC Enabled\n"); 1197 printk(KERN_ERR "Local DIMM ECC Enabled\n");
1136 } 1198 }
1137 1199
1138 /* DIMM Initialization Select/Enable (bit 18/19) */ 1200 /* DIMM Initialization Select/Enable (bit 18/19) */
1139 data &= (~(1<<18)); 1201 data &= (~(1<<18));
1140 data |= (1<<19); 1202 data |= (1<<19);
1141 writel(data, mmio + PDC_SDRAM_CONTROL_OFFSET); 1203 writel(data, mmio + PDC_SDRAM_CONTROL);
1142 1204
1143 error = 1; 1205 error = 1;
1144 for (i = 1; i <= 10; i++) { /* polling ~5 secs */ 1206 for (i = 1; i <= 10; i++) { /* polling ~5 secs */
1145 data = readl(mmio + PDC_SDRAM_CONTROL_OFFSET); 1207 data = readl(mmio + PDC_SDRAM_CONTROL);
1146 if (!(data & (1<<19))) { 1208 if (!(data & (1<<19))) {
1147 error = 0; 1209 error = 0;
1148 break; 1210 break;
@@ -1176,7 +1238,7 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host)
1176 VPRINTK("Time Period Register (0x40): 0x%x\n", time_period); 1238 VPRINTK("Time Period Register (0x40): 0x%x\n", time_period);
1177 1239
1178 /* Enable timer */ 1240 /* Enable timer */
1179 writel(0x00001a0, mmio + PDC_TIME_CONTROL); 1241 writel(PDC_TIMER_DEFAULT, mmio + PDC_TIME_CONTROL);
1180 readl(mmio + PDC_TIME_CONTROL); 1242 readl(mmio + PDC_TIME_CONTROL);
1181 1243
1182 /* Wait 3 seconds */ 1244 /* Wait 3 seconds */
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c
index 6815de7cca79..aca71819f6e8 100644
--- a/drivers/ata/sata_uli.c
+++ b/drivers/ata/sata_uli.c
@@ -129,7 +129,7 @@ static const struct ata_port_info uli_port_info = {
129 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 129 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
130 ATA_FLAG_IGN_SIMPLEX, 130 ATA_FLAG_IGN_SIMPLEX,
131 .pio_mask = 0x1f, /* pio0-4 */ 131 .pio_mask = 0x1f, /* pio0-4 */
132 .udma_mask = 0x7f, /* udma0-6 */ 132 .udma_mask = ATA_UDMA6,
133 .port_ops = &uli_ops, 133 .port_ops = &uli_ops,
134}; 134};
135 135
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index e8b90e7b42dd..a4c0832033d8 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -223,7 +223,7 @@ static const struct ata_port_info vt6420_port_info = {
223 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, 223 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
224 .pio_mask = 0x1f, 224 .pio_mask = 0x1f,
225 .mwdma_mask = 0x07, 225 .mwdma_mask = 0x07,
226 .udma_mask = 0x7f, 226 .udma_mask = ATA_UDMA6,
227 .port_ops = &vt6420_sata_ops, 227 .port_ops = &vt6420_sata_ops,
228}; 228};
229 229
@@ -231,7 +231,7 @@ static struct ata_port_info vt6421_sport_info = {
231 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY, 231 .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
232 .pio_mask = 0x1f, 232 .pio_mask = 0x1f,
233 .mwdma_mask = 0x07, 233 .mwdma_mask = 0x07,
234 .udma_mask = 0x7f, 234 .udma_mask = ATA_UDMA6,
235 .port_ops = &vt6421_sata_ops, 235 .port_ops = &vt6421_sata_ops,
236}; 236};
237 237
@@ -239,7 +239,7 @@ static struct ata_port_info vt6421_pport_info = {
239 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_NO_LEGACY, 239 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_NO_LEGACY,
240 .pio_mask = 0x1f, 240 .pio_mask = 0x1f,
241 .mwdma_mask = 0, 241 .mwdma_mask = 0,
242 .udma_mask = 0x7f, 242 .udma_mask = ATA_UDMA6,
243 .port_ops = &vt6421_pata_ops, 243 .port_ops = &vt6421_pata_ops,
244}; 244};
245 245
@@ -303,9 +303,7 @@ static int vt6420_prereset(struct ata_port *ap, unsigned long deadline)
303 if (!(ap->pflags & ATA_PFLAG_LOADING)) 303 if (!(ap->pflags & ATA_PFLAG_LOADING))
304 goto skip_scr; 304 goto skip_scr;
305 305
306 /* Resume phy. This is the old resume sequence from 306 /* Resume phy. This is the old SATA resume sequence */
307 * __sata_phy_reset().
308 */
309 svia_scr_write(ap, SCR_CONTROL, 0x300); 307 svia_scr_write(ap, SCR_CONTROL, 0x300);
310 svia_scr_read(ap, SCR_CONTROL); /* flush */ 308 svia_scr_read(ap, SCR_CONTROL); /* flush */
311 309
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c
index 81330175fc89..1b5d81faa102 100644
--- a/drivers/ata/sata_vsc.c
+++ b/drivers/ata/sata_vsc.c
@@ -371,7 +371,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
371 ATA_FLAG_MMIO, 371 ATA_FLAG_MMIO,
372 .pio_mask = 0x1f, 372 .pio_mask = 0x1f,
373 .mwdma_mask = 0x07, 373 .mwdma_mask = 0x07,
374 .udma_mask = 0x7f, 374 .udma_mask = ATA_UDMA6,
375 .port_ops = &vsc_sata_ops, 375 .port_ops = &vsc_sata_ops,
376 }; 376 };
377 const struct ata_port_info *ppi[] = { &pi, NULL }; 377 const struct ata_port_info *ppi[] = { &pi, NULL };