aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-sff.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/libata-sff.c')
-rw-r--r--drivers/ata/libata-sff.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 12c88c588039..cfa9ed179d9c 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -832,6 +832,21 @@ void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc)
832} 832}
833 833
834#ifdef CONFIG_PCI 834#ifdef CONFIG_PCI
835
836static int ata_resources_present(struct pci_dev *pdev, int port)
837{
838 int i;
839
840 /* Check the PCI resources for this channel are enabled */
841 port = port * 2;
842 for (i = 0; i < 2; i ++) {
843 if (pci_resource_start(pdev, port + i) == 0 ||
844 pci_resource_len(pdev, port + i) == 0)
845 return 0;
846 }
847 return 1;
848}
849
835/** 850/**
836 * ata_pci_init_native_mode - Initialize native-mode driver 851 * ata_pci_init_native_mode - Initialize native-mode driver
837 * @pdev: pci device to be initialized 852 * @pdev: pci device to be initialized
@@ -863,6 +878,13 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int
863 878
864 probe_ent->irq = pdev->irq; 879 probe_ent->irq = pdev->irq;
865 probe_ent->irq_flags = IRQF_SHARED; 880 probe_ent->irq_flags = IRQF_SHARED;
881
882 /* Discard disabled ports. Some controllers show their
883 unused channels this way */
884 if (ata_resources_present(pdev, 0) == 0)
885 ports &= ~ATA_PORT_PRIMARY;
886 if (ata_resources_present(pdev, 1) == 0)
887 ports &= ~ATA_PORT_SECONDARY;
866 888
867 if (ports & ATA_PORT_PRIMARY) { 889 if (ports & ATA_PORT_PRIMARY) {
868 probe_ent->port[p].cmd_addr = pci_resource_start(pdev, 0); 890 probe_ent->port[p].cmd_addr = pci_resource_start(pdev, 0);