aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2005-12-18 03:17:07 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-26 21:56:07 -0500
commitff0fc1467f8189c8e2340b91161c97138a75e484 (patch)
treea1cbb418100267424f5edd6cfef3f463de0b49e6
parent7db74a4780cf9cc6b2ea97582cdc8031d5f22ccd (diff)
[PATCH] ata_piix: fix MAP VALUE interpretation for for ICH6/7
Unlike their older siblings, ICH6 and 7 use different scheme for MAP VALUE. This patch makes ata_piix interpret MV properly on ICH6/7. Pre-ICH6/7 The value of these bits indicate the address range the SATA port responds to, and whether or not the SATA and IDE functions are combined. 000 = Non-combined. P0 is primary master. P1 is secondary master. 001 = Non-combined. P0 is secondary master. P1 is primary master. 100 = Combined. P0 is primary master. P1 is primary slave. P-ATA is 2:0 Map Value secondary. 101 = Combined. P0 is primary slave. P1 is primary master. P-ATA is secondary. 110 = Combined. P-ATA is primary. P0 is secondary master. P1 is secondary slave. 111 = Combined. P-ATA is primary. P0 is secondary slave. P1 is secondary master. ICH6/7 Map Value - R/W. Map Value (MV): The value in the bits below indicate the address range the SATA ports responds to, and whether or not the PATA and SATA functions are combined. When in combined mode, the AHCI memory space is not available and AHCI may not be used. 00 = Non-combined. P0 is primary master, P2 is the primary slave. P1 is secondary master, P3 is the 1:0 secondary slave (desktop only). P0 is primary master, P2 is the primary slave (mobile only). 01 = Combined. IDE is primary. P1 is secondary master, P3 is the secondary slave. (desktop only) 10 = Combined. P0 is primary master. P2 is primary slave. IDE is secondary 11 = Reserved Signed-off-by: Tejun Heo <htejun@gmail.com> -- Jeff, without this patch, ata_piix misdetects my ICH7's combined mode, ending up not applying bridge limits to PX-710SA and configuring IDE drive on 40-c cable to UDMA/66. Thanks. Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r--drivers/scsi/ata_piix.c53
1 files changed, 39 insertions, 14 deletions
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index fc3ca051ceed..19d8d4ba6a1e 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -101,9 +101,11 @@ enum {
101 ICH5_PCS = 0x92, /* port control and status */ 101 ICH5_PCS = 0x92, /* port control and status */
102 PIIX_SCC = 0x0A, /* sub-class code register */ 102 PIIX_SCC = 0x0A, /* sub-class code register */
103 103
104 PIIX_FLAG_AHCI = (1 << 28), /* AHCI possible */ 104 PIIX_FLAG_AHCI = (1 << 27), /* AHCI possible */
105 PIIX_FLAG_CHECKINTR = (1 << 29), /* make sure PCI INTx enabled */ 105 PIIX_FLAG_CHECKINTR = (1 << 28), /* make sure PCI INTx enabled */
106 PIIX_FLAG_COMBINED = (1 << 30), /* combined mode possible */ 106 PIIX_FLAG_COMBINED = (1 << 29), /* combined mode possible */
107 /* ICH6/7 use different scheme for map value */
108 PIIX_FLAG_COMBINED_ICH6 = PIIX_FLAG_COMBINED | (1 << 30),
107 109
108 /* combined mode. if set, PATA is channel 0. 110 /* combined mode. if set, PATA is channel 0.
109 * if clear, PATA is channel 1. 111 * if clear, PATA is channel 1.
@@ -297,8 +299,8 @@ static struct ata_port_info piix_port_info[] = {
297 { 299 {
298 .sht = &piix_sht, 300 .sht = &piix_sht,
299 .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST | 301 .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST |
300 PIIX_FLAG_COMBINED | PIIX_FLAG_CHECKINTR | 302 PIIX_FLAG_COMBINED_ICH6 |
301 ATA_FLAG_SLAVE_POSS, 303 PIIX_FLAG_CHECKINTR | ATA_FLAG_SLAVE_POSS,
302 .pio_mask = 0x1f, /* pio0-4 */ 304 .pio_mask = 0x1f, /* pio0-4 */
303 .mwdma_mask = 0x07, /* mwdma0-2 */ 305 .mwdma_mask = 0x07, /* mwdma0-2 */
304 .udma_mask = 0x7f, /* udma0-6 */ 306 .udma_mask = 0x7f, /* udma0-6 */
@@ -309,8 +311,9 @@ static struct ata_port_info piix_port_info[] = {
309 { 311 {
310 .sht = &piix_sht, 312 .sht = &piix_sht,
311 .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST | 313 .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST |
312 PIIX_FLAG_COMBINED | PIIX_FLAG_CHECKINTR | 314 PIIX_FLAG_COMBINED_ICH6 |
313 ATA_FLAG_SLAVE_POSS | PIIX_FLAG_AHCI, 315 PIIX_FLAG_CHECKINTR | ATA_FLAG_SLAVE_POSS |
316 PIIX_FLAG_AHCI,
314 .pio_mask = 0x1f, /* pio0-4 */ 317 .pio_mask = 0x1f, /* pio0-4 */
315 .mwdma_mask = 0x07, /* mwdma0-2 */ 318 .mwdma_mask = 0x07, /* mwdma0-2 */
316 .udma_mask = 0x7f, /* udma0-6 */ 319 .udma_mask = 0x7f, /* udma0-6 */
@@ -680,6 +683,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
680 struct ata_port_info *port_info[2]; 683 struct ata_port_info *port_info[2];
681 unsigned int combined = 0; 684 unsigned int combined = 0;
682 unsigned int pata_chan = 0, sata_chan = 0; 685 unsigned int pata_chan = 0, sata_chan = 0;
686 unsigned long host_flags;
683 687
684 if (!printed_version++) 688 if (!printed_version++)
685 dev_printk(KERN_DEBUG, &pdev->dev, 689 dev_printk(KERN_DEBUG, &pdev->dev,
@@ -692,7 +696,9 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
692 port_info[0] = &piix_port_info[ent->driver_data]; 696 port_info[0] = &piix_port_info[ent->driver_data];
693 port_info[1] = &piix_port_info[ent->driver_data]; 697 port_info[1] = &piix_port_info[ent->driver_data];
694 698
695 if (port_info[0]->host_flags & PIIX_FLAG_AHCI) { 699 host_flags = port_info[0]->host_flags;
700
701 if (host_flags & PIIX_FLAG_AHCI) {
696 u8 tmp; 702 u8 tmp;
697 pci_read_config_byte(pdev, PIIX_SCC, &tmp); 703 pci_read_config_byte(pdev, PIIX_SCC, &tmp);
698 if (tmp == PIIX_AHCI_DEVICE) { 704 if (tmp == PIIX_AHCI_DEVICE) {
@@ -702,16 +708,35 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
702 } 708 }
703 } 709 }
704 710
705 if (port_info[0]->host_flags & PIIX_FLAG_COMBINED) { 711 if (host_flags & PIIX_FLAG_COMBINED) {
706 u8 tmp; 712 u8 tmp;
707 pci_read_config_byte(pdev, ICH5_PMR, &tmp); 713 pci_read_config_byte(pdev, ICH5_PMR, &tmp);
708 714
709 if (tmp & PIIX_COMB) { 715 if (host_flags & PIIX_FLAG_COMBINED_ICH6) {
710 combined = 1; 716 switch (tmp) {
711 if (tmp & PIIX_COMB_PATA_P0) 717 case 0:
718 break;
719 case 1:
720 combined = 1;
712 sata_chan = 1; 721 sata_chan = 1;
713 else 722 break;
723 case 2:
724 combined = 1;
714 pata_chan = 1; 725 pata_chan = 1;
726 break;
727 case 3:
728 dev_printk(KERN_WARNING, &pdev->dev,
729 "invalid MAP value %u\n", tmp);
730 break;
731 }
732 } else {
733 if (tmp & PIIX_COMB) {
734 combined = 1;
735 if (tmp & PIIX_COMB_PATA_P0)
736 sata_chan = 1;
737 else
738 pata_chan = 1;
739 }
715 } 740 }
716 } 741 }
717 742
@@ -721,7 +746,7 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
721 * MSI is disabled (and it is disabled, as we don't use 746 * MSI is disabled (and it is disabled, as we don't use
722 * message-signalled interrupts currently). 747 * message-signalled interrupts currently).
723 */ 748 */
724 if (port_info[0]->host_flags & PIIX_FLAG_CHECKINTR) 749 if (host_flags & PIIX_FLAG_CHECKINTR)
725 pci_intx(pdev, 1); 750 pci_intx(pdev, 1);
726 751
727 if (combined) { 752 if (combined) {