diff options
Diffstat (limited to 'drivers/scsi/ata_piix.c')
-rw-r--r-- | drivers/scsi/ata_piix.c | 53 |
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) { |