]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
pci: fix checking PCI_REGION_MEM in pci_hose_phys_to_bus()
authorCheng Gu <chenggu@marvell.com>
Fri, 23 Oct 2015 21:48:01 +0000 (21:48 +0000)
committerTom Rini <trini@konsulko.com>
Thu, 12 Nov 2015 18:19:03 +0000 (13:19 -0500)
When converting between PCI bus and phys addresses, a two pass search
was introduced with preference to non-PCI_REGION_SYS_MEMORY regions.
See commit 2d43e873a29ca4959ba6a30fc7fb396d3fd0dccf.

However, since PCI_REGION_MEM is defined as 0, the if statement was
always asserted true: ((flags & PCI_REGION_MEM) == PCI_REGION_MEM)

This patch uses PCI_REGION_TYPE bit to check if the region is
PCI_REGION_MEM: ((flags & PCI_REGION_TYPE) == PCI_REGION_MEM)

Signed-off-by: Cheng Gu <chenggu@marvell.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/pci/pci_common.c

index 07f1726748a2f2b45eb83746729e30a4c2edab2c..a64792f988177dda4bc3ef2dab25937ffedc6ee0 100644 (file)
@@ -231,7 +231,7 @@ phys_addr_t pci_hose_bus_to_phys(struct pci_controller *hose,
         * if PCI_REGION_MEM is set we do a two pass search with preference
         * on matches that don't have PCI_REGION_SYS_MEMORY set
         */
-       if ((flags & PCI_REGION_MEM) == PCI_REGION_MEM) {
+       if ((flags & PCI_REGION_TYPE) == PCI_REGION_MEM) {
                ret = __pci_hose_bus_to_phys(hose, bus_addr,
                                flags, PCI_REGION_SYS_MEMORY, &phys_addr);
                if (!ret)
@@ -298,7 +298,7 @@ pci_addr_t pci_hose_phys_to_bus(struct pci_controller *hose,
         * if PCI_REGION_MEM is set we do a two pass search with preference
         * on matches that don't have PCI_REGION_SYS_MEMORY set
         */
-       if ((flags & PCI_REGION_MEM) == PCI_REGION_MEM) {
+       if ((flags & PCI_REGION_TYPE) == PCI_REGION_MEM) {
                ret = __pci_hose_phys_to_bus(hose, phys_addr,
                                flags, PCI_REGION_SYS_MEMORY, &bus_addr);
                if (!ret)