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.c132
1 files changed, 97 insertions, 35 deletions
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index 333d69dd84ef..557788ec4eec 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};
@@ -125,6 +166,8 @@ static struct pci_driver piix_pci_driver = {
125 .id_table = piix_pci_tbl, 166 .id_table = piix_pci_tbl,
126 .probe = piix_init_one, 167 .probe = piix_init_one,
127 .remove = ata_pci_remove_one, 168 .remove = ata_pci_remove_one,
169 .suspend = ata_pci_device_suspend,
170 .resume = ata_pci_device_resume,
128}; 171};
129 172
130static struct scsi_host_template piix_sht = { 173static struct scsi_host_template piix_sht = {
@@ -144,7 +187,8 @@ static struct scsi_host_template piix_sht = {
144 .dma_boundary = ATA_DMA_BOUNDARY, 187 .dma_boundary = ATA_DMA_BOUNDARY,
145 .slave_configure = ata_scsi_slave_config, 188 .slave_configure = ata_scsi_slave_config,
146 .bios_param = ata_std_bios_param, 189 .bios_param = ata_std_bios_param,
147 .ordered_flush = 1, 190 .resume = ata_scsi_device_resume,
191 .suspend = ata_scsi_device_suspend,
148}; 192};
149 193
150static const struct ata_port_operations piix_pata_ops = { 194static const struct ata_port_operations piix_pata_ops = {
@@ -258,31 +302,7 @@ static struct ata_port_info piix_port_info[] = {
258 .port_ops = &piix_sata_ops, 302 .port_ops = &piix_sata_ops,
259 }, 303 },
260 304
261 /* ich6_sata_rm */ 305 /* 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 { 306 {
287 .sht = &piix_sht, 307 .sht = &piix_sht,
288 .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST | 308 .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST |
@@ -603,6 +623,40 @@ static int piix_disable_ahci(struct pci_dev *pdev)
603} 623}
604 624
605/** 625/**
626 * piix_check_450nx_errata - Check for problem 450NX setup
627 *
628 * Check for the present of 450NX errata #19 and errata #25. If
629 * they are found return an error code so we can turn off DMA
630 */
631
632static int __devinit piix_check_450nx_errata(struct pci_dev *ata_dev)
633{
634 struct pci_dev *pdev = NULL;
635 u16 cfg;
636 u8 rev;
637 int no_piix_dma = 0;
638
639 while((pdev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev)) != NULL)
640 {
641 /* Look for 450NX PXB. Check for problem configurations
642 A PCI quirk checks bit 6 already */
643 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
644 pci_read_config_word(pdev, 0x41, &cfg);
645 /* Only on the original revision: IDE DMA can hang */
646 if(rev == 0x00)
647 no_piix_dma = 1;
648 /* On all revisions below 5 PXB bus lock must be disabled for IDE */
649 else if(cfg & (1<<14) && rev < 5)
650 no_piix_dma = 2;
651 }
652 if(no_piix_dma)
653 dev_printk(KERN_WARNING, &ata_dev->dev, "450NX errata present, disabling IDE DMA.\n");
654 if(no_piix_dma == 2)
655 dev_printk(KERN_WARNING, &ata_dev->dev, "A BIOS update may resolve this.\n");
656 return no_piix_dma;
657}
658
659/**
606 * piix_init_one - Register PIIX ATA PCI device with kernel services 660 * piix_init_one - Register PIIX ATA PCI device with kernel services
607 * @pdev: PCI device to register 661 * @pdev: PCI device to register
608 * @ent: Entry in piix_pci_tbl matching with @pdev 662 * @ent: Entry in piix_pci_tbl matching with @pdev
@@ -676,7 +730,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", 730 "combined mode detected (p=%u, s=%u)\n",
677 pata_chan, sata_chan); 731 pata_chan, sata_chan);
678 } 732 }
679 733 if (piix_check_450nx_errata(pdev)) {
734 /* This writes into the master table but it does not
735 really matter for this errata as we will apply it to
736 all the PIIX devices on the board */
737 port_info[0]->mwdma_mask = 0;
738 port_info[0]->udma_mask = 0;
739 port_info[1]->mwdma_mask = 0;
740 port_info[1]->udma_mask = 0;
741 }
680 return ata_pci_init_one(pdev, port_info, 2); 742 return ata_pci_init_one(pdev, port_info, 2);
681} 743}
682 744