]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] 2.5 and 2.4: fix PCI IO BAR flags
authorRussell King <rmk@arm.linux.org.uk>
Fri, 15 Mar 2002 06:44:18 +0000 (22:44 -0800)
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Fri, 15 Mar 2002 06:44:18 +0000 (22:44 -0800)
There is a problem where the resource flags sometimes contain bits from
the address part of the PCI BAR, especially when you have the low address
bit set for an IO BAR.

(bit 3 of a PCI IO BAR is an address bit, and (bar & 0xf) propagates this
to res->flags).

This exists in Ivan Kokshaysky PCI patches, and so far hasn't made it into
the kernel.  It's required for IDE on certain ARM machines to even work.

drivers/pci/pci.c

index d64c570e051e464555af99393b9fa6cc8190c09b..890ca713c9993f7fecedbac7496679c3d696177c 100644 (file)
@@ -1013,13 +1013,15 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
                        l = 0;
                if ((l & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY) {
                        res->start = l & PCI_BASE_ADDRESS_MEM_MASK;
+                       res->flags |= l & ~PCI_BASE_ADDRESS_MEM_MASK;
                        sz = pci_size(sz, PCI_BASE_ADDRESS_MEM_MASK);
                } else {
                        res->start = l & PCI_BASE_ADDRESS_IO_MASK;
+                       res->flags |= l & ~PCI_BASE_ADDRESS_IO_MASK;
                        sz = pci_size(sz, PCI_BASE_ADDRESS_IO_MASK & 0xffff);
                }
                res->end = res->start + (unsigned long) sz;
-               res->flags |= (l & 0xf) | pci_calc_resource_flags(l);
+               res->flags |= pci_calc_resource_flags(l);
                if ((l & (PCI_BASE_ADDRESS_SPACE | PCI_BASE_ADDRESS_MEM_TYPE_MASK))
                    == (PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64)) {
                        pci_read_config_dword(dev, reg+4, &l);