aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorYoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>2007-10-02 17:19:23 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 18:03:17 -0400
commitfd6e732186ab522c812ab19c2c5e5befb8ec8115 (patch)
treedd65db780133a32476c5d68f21aa8350221d62e4 /drivers
parentcbf5d9e6b9bcf03291cbb51db144b3e2773a8a2d (diff)
PCI: fix IDE legacy mode resources
I got the following error on MIPS Cobalt. PCI: Unable to reserve I/O region #1:8@f00001f0 for device 0000:00:09.1 pata_via 0000:00:09.1: failed to request/iomap BARs for port 0 (errno=-16) PCI: Unable to reserve I/O region #3:8@f0000170 for device 0000:00:09.1 pata_via 0000:00:09.1: failed to request/iomap BARs for port 1 (errno=-16) pata_via 0000:00:09.1: no available native port The legacy mode IDE resources set the following order. pci_setup_device() Legacy mode ATA controllers have fixed addresses. IDE resources: 0x1F0-0x1F7, 0x3F6, 0x170-0x177, 0x376 | V pcibios_fixup_bus() MIPS Cobalt PCI bus regions have the -0x10000000 offset from PCI resources. pcibios_fixup_bus() fix PCI bus regions. 0x1F0 - 0x10000000 = 0xF00001F0 | V ata_pci_init_one() PCI: Unable to reserve I/O region #1:8@f00001f0 for device 0000:00:09.1 In some architectures, PCI bus regions have the offset from PCI resources. For this reason, pci_setup_device() should set PCI bus regions to dev->resource[]. [akpm@linux-foundation.org: use struct initialiser] Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Greg KH <greg@kroah.com> Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Cc: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/probe.c48
1 files changed, 36 insertions, 12 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 171ca712e523..40e571d3c392 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -744,22 +744,46 @@ static int pci_setup_device(struct pci_dev * dev)
744 */ 744 */
745 if (class == PCI_CLASS_STORAGE_IDE) { 745 if (class == PCI_CLASS_STORAGE_IDE) {
746 u8 progif; 746 u8 progif;
747 struct pci_bus_region region;
748
747 pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); 749 pci_read_config_byte(dev, PCI_CLASS_PROG, &progif);
748 if ((progif & 1) == 0) { 750 if ((progif & 1) == 0) {
749 dev->resource[0].start = 0x1F0; 751 struct resource resource = {
750 dev->resource[0].end = 0x1F7; 752 .start = 0x1F0,
751 dev->resource[0].flags = LEGACY_IO_RESOURCE; 753 .end = 0x1F7,
752 dev->resource[1].start = 0x3F6; 754 .flags = LEGACY_IO_RESOURCE,
753 dev->resource[1].end = 0x3F6; 755 };
754 dev->resource[1].flags = LEGACY_IO_RESOURCE; 756
757 pcibios_resource_to_bus(dev, &region, &resource);
758 dev->resource[0].start = region.start;
759 dev->resource[0].end = region.end;
760 dev->resource[0].flags = resource.flags;
761 resource.start = 0x3F6;
762 resource.end = 0x3F6;
763 resource.flags = LEGACY_IO_RESOURCE;
764 pcibios_resource_to_bus(dev, &region, &resource);
765 dev->resource[1].start = region.start;
766 dev->resource[1].end = region.end;
767 dev->resource[1].flags = resource.flags;
755 } 768 }
756 if ((progif & 4) == 0) { 769 if ((progif & 4) == 0) {
757 dev->resource[2].start = 0x170; 770 struct resource resource = {
758 dev->resource[2].end = 0x177; 771 .start = 0x170,
759 dev->resource[2].flags = LEGACY_IO_RESOURCE; 772 .end = 0x177,
760 dev->resource[3].start = 0x376; 773 .flags = LEGACY_IO_RESOURCE,
761 dev->resource[3].end = 0x376; 774 };
762 dev->resource[3].flags = LEGACY_IO_RESOURCE; 775
776 pcibios_resource_to_bus(dev, &region, &resource);
777 dev->resource[2].start = region.start;
778 dev->resource[2].end = region.end;
779 dev->resource[2].flags = resource.flags;
780 resource.start = 0x376;
781 resource.end = 0x376;
782 resource.flags = LEGACY_IO_RESOURCE;
783 pcibios_resource_to_bus(dev, &region, &resource);
784 dev->resource[3].start = region.start;
785 dev->resource[3].end = region.end;
786 dev->resource[3].flags = resource.flags;
763 } 787 }
764 } 788 }
765 break; 789 break;