aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ata_piix.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ata_piix.c')
-rw-r--r--drivers/scsi/ata_piix.c127
1 files changed, 93 insertions, 34 deletions
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index 333d69dd84ef..0ea27873b9ff 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -37,6 +37,49 @@
37 * 37 *
38 * Hardware documentation available at http://developer.intel.com/ 38 * Hardware documentation available at http://developer.intel.com/
39 * 39 *
40 * Documentation
41 * Publically available from Intel web site. Errata documentation
42 * is also publically available. As an aide to anyone hacking on this
43 * driver the list of errata that are relevant is below.going back to
44 * PIIX4. Older device documentation is now a bit tricky to find.
45 *
46 * The chipsets all follow very much the same design. The orginal Triton
47 * series chipsets do _not_ support independant device timings, but this
48 * is fixed in Triton II. With the odd mobile exception the chips then
49 * change little except in gaining more modes until SATA arrives. This
50 * driver supports only the chips with independant timing (that is those
51 * with SITRE and the 0x44 timing register). See pata_oldpiix and pata_mpiix
52 * for the early chip drivers.
53 *
54 * Errata of note:
55 *
56 * Unfixable
57 * PIIX4 errata #9 - Only on ultra obscure hw
58 * ICH3 errata #13 - Not observed to affect real hw
59 * by Intel
60 *
61 * Things we must deal with
62 * PIIX4 errata #10 - BM IDE hang with non UDMA
63 * (must stop/start dma to recover)
64 * 440MX errata #15 - As PIIX4 errata #10
65 * PIIX4 errata #15 - Must not read control registers
66 * during a PIO transfer
67 * 440MX errata #13 - As PIIX4 errata #15
68 * ICH2 errata #21 - DMA mode 0 doesn't work right
69 * ICH0/1 errata #55 - As ICH2 errata #21
70 * ICH2 spec c #9 - Extra operations needed to handle
71 * drive hotswap [NOT YET SUPPORTED]
72 * ICH2 spec c #20 - IDE PRD must not cross a 64K boundary
73 * and must be dword aligned
74 * ICH2 spec c #24 - UDMA mode 4,5 t85/86 should be 6ns not 3.3
75 *
76 * Should have been BIOS fixed:
77 * 450NX: errata #19 - DMA hangs on old 450NX
78 * 450NX: errata #20 - DMA hangs on old 450NX
79 * 450NX: errata #25 - Corruption with DMA on old 450NX
80 * ICH3 errata #15 - IDE deadlock under high load
81 * (BIOS must set dev 31 fn 0 bit 23)
82 * ICH3 errata #18 - Don't use native mode
40 */ 83 */
41 84
42#include <linux/kernel.h> 85#include <linux/kernel.h>
@@ -78,9 +121,7 @@ enum {
78 ich5_sata = 1, 121 ich5_sata = 1,
79 piix4_pata = 2, 122 piix4_pata = 2,
80 ich6_sata = 3, 123 ich6_sata = 3,
81 ich6_sata_rm = 4, 124 ich6_sata_ahci = 4,
82 ich7_sata = 5,
83 esb2_sata = 6,
84 125
85 PIIX_AHCI_DEVICE = 6, 126 PIIX_AHCI_DEVICE = 6,
86}; 127};
@@ -111,11 +152,11 @@ static const struct pci_device_id piix_pci_tbl[] = {
111 { 0x8086, 0x25a3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_sata }, 152 { 0x8086, 0x25a3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_sata },
112 { 0x8086, 0x25b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_sata }, 153 { 0x8086, 0x25b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_sata },
113 { 0x8086, 0x2651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata }, 154 { 0x8086, 0x2651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata },
114 { 0x8086, 0x2652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_rm }, 155 { 0x8086, 0x2652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
115 { 0x8086, 0x2653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_rm }, 156 { 0x8086, 0x2653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
116 { 0x8086, 0x27c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich7_sata }, 157 { 0x8086, 0x27c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
117 { 0x8086, 0x27c4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich7_sata }, 158 { 0x8086, 0x27c4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
118 { 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, esb2_sata }, 159 { 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
119 160
120 { } /* terminate list */ 161 { } /* terminate list */
121}; 162};
@@ -258,31 +299,7 @@ static struct ata_port_info piix_port_info[] = {
258 .port_ops = &piix_sata_ops, 299 .port_ops = &piix_sata_ops,
259 }, 300 },
260 301
261 /* ich6_sata_rm */ 302 /* ich6_sata_ahci */
262 {
263 .sht = &piix_sht,
264 .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST |
265 PIIX_FLAG_COMBINED | PIIX_FLAG_CHECKINTR |
266 ATA_FLAG_SLAVE_POSS | PIIX_FLAG_AHCI,
267 .pio_mask = 0x1f, /* pio0-4 */
268 .mwdma_mask = 0x07, /* mwdma0-2 */
269 .udma_mask = 0x7f, /* udma0-6 */
270 .port_ops = &piix_sata_ops,
271 },
272
273 /* ich7_sata */
274 {
275 .sht = &piix_sht,
276 .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST |
277 PIIX_FLAG_COMBINED | PIIX_FLAG_CHECKINTR |
278 ATA_FLAG_SLAVE_POSS | PIIX_FLAG_AHCI,
279 .pio_mask = 0x1f, /* pio0-4 */
280 .mwdma_mask = 0x07, /* mwdma0-2 */
281 .udma_mask = 0x7f, /* udma0-6 */
282 .port_ops = &piix_sata_ops,
283 },
284
285 /* esb2_sata */
286 { 303 {
287 .sht = &piix_sht, 304 .sht = &piix_sht,
288 .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST | 305 .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST |
@@ -603,6 +620,40 @@ static int piix_disable_ahci(struct pci_dev *pdev)
603} 620}
604 621
605/** 622/**
623 * piix_check_450nx_errata - Check for problem 450NX setup
624 *
625 * Check for the present of 450NX errata #19 and errata #25. If
626 * they are found return an error code so we can turn off DMA
627 */
628
629static int __devinit piix_check_450nx_errata(struct pci_dev *ata_dev)
630{
631 struct pci_dev *pdev = NULL;
632 u16 cfg;
633 u8 rev;
634 int no_piix_dma = 0;
635
636 while((pdev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev)) != NULL)
637 {
638 /* Look for 450NX PXB. Check for problem configurations
639 A PCI quirk checks bit 6 already */
640 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
641 pci_read_config_word(pdev, 0x41, &cfg);
642 /* Only on the original revision: IDE DMA can hang */
643 if(rev == 0x00)
644 no_piix_dma = 1;
645 /* On all revisions below 5 PXB bus lock must be disabled for IDE */
646 else if(cfg & (1<<14) && rev < 5)
647 no_piix_dma = 2;
648 }
649 if(no_piix_dma)
650 dev_printk(KERN_WARNING, &ata_dev->dev, "450NX errata present, disabling IDE DMA.\n");
651 if(no_piix_dma == 2)
652 dev_printk(KERN_WARNING, &ata_dev->dev, "A BIOS update may resolve this.\n");
653 return no_piix_dma;
654}
655
656/**
606 * piix_init_one - Register PIIX ATA PCI device with kernel services 657 * piix_init_one - Register PIIX ATA PCI device with kernel services
607 * @pdev: PCI device to register 658 * @pdev: PCI device to register
608 * @ent: Entry in piix_pci_tbl matching with @pdev 659 * @ent: Entry in piix_pci_tbl matching with @pdev
@@ -676,7 +727,15 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
676 "combined mode detected (p=%u, s=%u)\n", 727 "combined mode detected (p=%u, s=%u)\n",
677 pata_chan, sata_chan); 728 pata_chan, sata_chan);
678 } 729 }
679 730 if (piix_check_450nx_errata(pdev)) {
731 /* This writes into the master table but it does not
732 really matter for this errata as we will apply it to
733 all the PIIX devices on the board */
734 port_info[0]->mwdma_mask = 0;
735 port_info[0]->udma_mask = 0;
736 port_info[1]->mwdma_mask = 0;
737 port_info[1]->udma_mask = 0;
738 }
680 return ata_pci_init_one(pdev, port_info, 2); 739 return ata_pci_init_one(pdev, port_info, 2);
681} 740}
682 741