瀏覽代碼

PCI: mvebu: Use resource_size() to remap I/O space

Instead of hardcoding the remapping of IO_SPACE_LIMIT - SZ_64K, use
resource_size().

However, we cannot use just IO_SPACE_LIMIT, because pci_ioremap_io() has
a bug and doesn't allow remapping the last 64 KB before IO_SPACE_LIMIT,
so we ensure that we do not exceed this limit. When the pci_ioremap_io()
issue is fixed, this work around can be dropped.

Note that this workaround already existed, since we were mapping only
up to IO_SPACE_LIMIT - SZ_64K.

Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[lorenzo.pieralisi@arm.com: tweaked the commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Thomas Petazzoni 7 年之前
父節點
當前提交
5a553d6ba1
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      drivers/pci/controller/pci-mvebu.c

+ 2 - 2
drivers/pci/controller/pci-mvebu.c

@@ -1218,10 +1218,10 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
 		pcie->realio.flags = pcie->io.flags;
 		pcie->realio.start = PCIBIOS_MIN_IO;
 		pcie->realio.end = min_t(resource_size_t,
-					 IO_SPACE_LIMIT,
+					 IO_SPACE_LIMIT - SZ_64K,
 					 resource_size(&pcie->io) - 1);
 
-		for (i = 0; i < (IO_SPACE_LIMIT - SZ_64K); i += SZ_64K)
+		for (i = 0; i < resource_size(&pcie->realio); i += SZ_64K)
 			pci_ioremap_io(i, pcie->io.start + i);
 	} else
 		pcie->realio = pcie->io;