aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-04-23 17:19:36 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-04-23 17:19:36 -0400
commit01abc2aa0f447bce2f6beb06dd0607ba0f01c5bb (patch)
treeb96d0ee538ea3a47ca443db2a221ba95b04a022b /drivers/pci/probe.c
parentc445a31cd7f469d77acc37538ab43a99530968b8 (diff)
Revert "adjust legacy IDE resource setting (v2)"
This reverts commit ed8ccee0918ad063a4741c0656fda783e02df627. It causes hang on boot for some users and we don't yet know why: http://bugzilla.kernel.org/show_bug.cgi?id=7562 http://lkml.org/lkml/2007/4/20/404 http://lkml.org/lkml/2007/3/25/113 Just reverse it for 2.6.21-final, having broken X server is somehow better than unbootable system. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c45
1 files changed, 13 insertions, 32 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index a4a96826d9e0..2fe1d690eb13 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -682,34 +682,7 @@ static void pci_read_irq(struct pci_dev *dev)
682 dev->irq = irq; 682 dev->irq = irq;
683} 683}
684 684
685static void change_legacy_io_resource(struct pci_dev * dev, unsigned index, 685#define LEGACY_IO_RESOURCE (IORESOURCE_IO | IORESOURCE_PCI_FIXED)
686 unsigned start, unsigned end)
687{
688 unsigned base = start & PCI_BASE_ADDRESS_IO_MASK;
689 unsigned len = (end | ~PCI_BASE_ADDRESS_IO_MASK) - base + 1;
690
691 /*
692 * Some X versions get confused when the BARs reported through
693 * /sys or /proc differ from those seen in config space, thus
694 * try to update the config space values, too.
695 */
696 if (!(pci_resource_flags(dev, index) & IORESOURCE_IO))
697 printk(KERN_WARNING "%s: cannot adjust BAR%u (not I/O)\n",
698 pci_name(dev), index);
699 else if (pci_resource_len(dev, index) != len)
700 printk(KERN_WARNING "%s: cannot adjust BAR%u (size %04X)\n",
701 pci_name(dev), index, (unsigned)pci_resource_len(dev, index));
702 else {
703 printk(KERN_INFO "%s: trying to change BAR%u from %04X to %04X\n",
704 pci_name(dev), index,
705 (unsigned)pci_resource_start(dev, index), base);
706 pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + index * 4, base);
707 }
708 pci_resource_start(dev, index) = start;
709 pci_resource_end(dev, index) = end;
710 pci_resource_flags(dev, index) =
711 IORESOURCE_IO | IORESOURCE_PCI_FIXED | PCI_BASE_ADDRESS_SPACE_IO;
712}
713 686
714/** 687/**
715 * pci_setup_device - fill in class and map information of a device 688 * pci_setup_device - fill in class and map information of a device
@@ -762,12 +735,20 @@ static int pci_setup_device(struct pci_dev * dev)
762 u8 progif; 735 u8 progif;
763 pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); 736 pci_read_config_byte(dev, PCI_CLASS_PROG, &progif);
764 if ((progif & 1) == 0) { 737 if ((progif & 1) == 0) {
765 change_legacy_io_resource(dev, 0, 0x1F0, 0x1F7); 738 dev->resource[0].start = 0x1F0;
766 change_legacy_io_resource(dev, 1, 0x3F6, 0x3F6); 739 dev->resource[0].end = 0x1F7;
740 dev->resource[0].flags = LEGACY_IO_RESOURCE;
741 dev->resource[1].start = 0x3F6;
742 dev->resource[1].end = 0x3F6;
743 dev->resource[1].flags = LEGACY_IO_RESOURCE;
767 } 744 }
768 if ((progif & 4) == 0) { 745 if ((progif & 4) == 0) {
769 change_legacy_io_resource(dev, 2, 0x170, 0x177); 746 dev->resource[2].start = 0x170;
770 change_legacy_io_resource(dev, 3, 0x376, 0x376); 747 dev->resource[2].end = 0x177;
748 dev->resource[2].flags = LEGACY_IO_RESOURCE;
749 dev->resource[3].start = 0x376;
750 dev->resource[3].end = 0x376;
751 dev->resource[3].flags = LEGACY_IO_RESOURCE;
771 } 752 }
772 } 753 }
773 break; 754 break;