ahci: work around ATI SB600 h/w quirk

This addresses the recent ATI SB600 errata, where the hardware does
not like 256-length PRD entries during FPDMA (aka NCQ).

It hurts performance on SB600, but it is more important to get a
correct patch eliminating the data corruption/lockups, and then later
on tune for performance.

We simply limit each command to a maximum of 255 sectors, on SB600.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

+13 -1
+13 -1
drivers/ata/ahci.c
··· 186 AHCI_HFLAG_NO_MSI = (1 << 5), /* no PCI MSI */ 187 AHCI_HFLAG_NO_PMP = (1 << 6), /* no PMP */ 188 AHCI_HFLAG_NO_HOTPLUG = (1 << 7), /* ignore PxSERR.DIAG.N */ 189 190 /* ap->flags bits */ 191 ··· 256 static void ahci_p5wdh_error_handler(struct ata_port *ap); 257 static void ahci_post_internal_cmd(struct ata_queued_cmd *qc); 258 static int ahci_port_resume(struct ata_port *ap); 259 static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl); 260 static void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag, 261 u32 opts); ··· 295 .check_status = ahci_check_status, 296 .check_altstatus = ahci_check_status, 297 .dev_select = ata_noop_dev_select, 298 299 .tf_read = ahci_tf_read, 300 ··· 429 /* board_ahci_sb600 */ 430 { 431 AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL | 432 - AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_PMP), 433 .flags = AHCI_FLAG_COMMON, 434 .link_flags = AHCI_LFLAG_COMMON, 435 .pio_mask = 0x1f, /* pio0-4 */ ··· 1178 writel(tmp | HOST_IRQ_EN, mmio + HOST_CTL); 1179 tmp = readl(mmio + HOST_CTL); 1180 VPRINTK("HOST_CTL 0x%x\n", tmp); 1181 } 1182 1183 static unsigned int ahci_dev_classify(struct ata_port *ap)
··· 186 AHCI_HFLAG_NO_MSI = (1 << 5), /* no PCI MSI */ 187 AHCI_HFLAG_NO_PMP = (1 << 6), /* no PMP */ 188 AHCI_HFLAG_NO_HOTPLUG = (1 << 7), /* ignore PxSERR.DIAG.N */ 189 + AHCI_HFLAG_SECT255 = (1 << 8), /* max 255 sectors */ 190 191 /* ap->flags bits */ 192 ··· 255 static void ahci_p5wdh_error_handler(struct ata_port *ap); 256 static void ahci_post_internal_cmd(struct ata_queued_cmd *qc); 257 static int ahci_port_resume(struct ata_port *ap); 258 + static void ahci_dev_config(struct ata_device *dev); 259 static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl); 260 static void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag, 261 u32 opts); ··· 293 .check_status = ahci_check_status, 294 .check_altstatus = ahci_check_status, 295 .dev_select = ata_noop_dev_select, 296 + 297 + .dev_config = ahci_dev_config, 298 299 .tf_read = ahci_tf_read, 300 ··· 425 /* board_ahci_sb600 */ 426 { 427 AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL | 428 + AHCI_HFLAG_SECT255 | AHCI_HFLAG_NO_PMP), 429 .flags = AHCI_FLAG_COMMON, 430 .link_flags = AHCI_LFLAG_COMMON, 431 .pio_mask = 0x1f, /* pio0-4 */ ··· 1174 writel(tmp | HOST_IRQ_EN, mmio + HOST_CTL); 1175 tmp = readl(mmio + HOST_CTL); 1176 VPRINTK("HOST_CTL 0x%x\n", tmp); 1177 + } 1178 + 1179 + static void ahci_dev_config(struct ata_device *dev) 1180 + { 1181 + struct ahci_host_priv *hpriv = dev->link->ap->host->private_data; 1182 + 1183 + if (hpriv->flags & AHCI_HFLAG_SECT255) 1184 + dev->max_sectors = 255; 1185 } 1186 1187 static unsigned int ahci_dev_classify(struct ata_port *ap)