Skip to content

Commit 22f2037

Browse files
committed
Merge tag 'pci-v6.17-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci
Pull pci fix from Bjorn Helgaas: - Fix mvebu PCI enumeration regression caused by converting to for_each_of_range() iterator (Klaus Kudielka) * tag 'pci-v6.17-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci: PCI: mvebu: Fix use of for_each_of_range() iterator
2 parents 965c995 + b816265 commit 22f2037

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

drivers/pci/controller/pci-mvebu.c

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,12 +1168,6 @@ static void __iomem *mvebu_pcie_map_registers(struct platform_device *pdev,
11681168
return devm_ioremap_resource(&pdev->dev, &port->regs);
11691169
}
11701170

1171-
#define DT_FLAGS_TO_TYPE(flags) (((flags) >> 24) & 0x03)
1172-
#define DT_TYPE_IO 0x1
1173-
#define DT_TYPE_MEM32 0x2
1174-
#define DT_CPUADDR_TO_TARGET(cpuaddr) (((cpuaddr) >> 56) & 0xFF)
1175-
#define DT_CPUADDR_TO_ATTR(cpuaddr) (((cpuaddr) >> 48) & 0xFF)
1176-
11771171
static int mvebu_get_tgt_attr(struct device_node *np, int devfn,
11781172
unsigned long type,
11791173
unsigned int *tgt,
@@ -1189,19 +1183,12 @@ static int mvebu_get_tgt_attr(struct device_node *np, int devfn,
11891183
return -EINVAL;
11901184

11911185
for_each_of_range(&parser, &range) {
1192-
unsigned long rtype;
11931186
u32 slot = upper_32_bits(range.bus_addr);
11941187

1195-
if (DT_FLAGS_TO_TYPE(range.flags) == DT_TYPE_IO)
1196-
rtype = IORESOURCE_IO;
1197-
else if (DT_FLAGS_TO_TYPE(range.flags) == DT_TYPE_MEM32)
1198-
rtype = IORESOURCE_MEM;
1199-
else
1200-
continue;
1201-
1202-
if (slot == PCI_SLOT(devfn) && type == rtype) {
1203-
*tgt = DT_CPUADDR_TO_TARGET(range.cpu_addr);
1204-
*attr = DT_CPUADDR_TO_ATTR(range.cpu_addr);
1188+
if (slot == PCI_SLOT(devfn) &&
1189+
type == (range.flags & IORESOURCE_TYPE_BITS)) {
1190+
*tgt = (range.parent_bus_addr >> 56) & 0xFF;
1191+
*attr = (range.parent_bus_addr >> 48) & 0xFF;
12051192
return 0;
12061193
}
12071194
}

0 commit comments

Comments
 (0)