Skip to content

Commit 7dd7f69

Browse files
tpetazzoniRich Felker
authored andcommitted
arch/sh: pcie-sh7786: mark unavailable PCI resource as disabled
Some PCI MEM resources are marked as IORESOURCE_MEM_32BIT, which means they are only usable when the SH core runs in 32-bit mode. In 29-bit mode, such memory regions are not usable. The existing code for SH7786 properly skips such regions when configuring the PCIe controller registers. However, because such regions are still described in the resource array, the pcibios_scanbus() function in the SuperH pci.c will register them to the PCI core. Due to this, the PCI core will allocate MEM areas from this resource, and assign BARs pointing to this area, even though it's unusable. In order to prevent this from happening, we mark such regions as IORESOURCE_DISABLED, which tells the SuperH pci.c pcibios_scanbus() function to skip them. Note that we separate marking the region as disabled from skipping it, because other regions will be marked as disabled in follow-up patches. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Rich Felker <dalias@libc.org>
1 parent 3aeb93a commit 7dd7f69

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎arch/sh/drivers/pci/pcie-sh7786.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,9 @@ static int __init pcie_init(struct sh7786_pcie_port *port)
438438
* mode, so just skip them entirely.
439439
*/
440440
if ((res->flags & IORESOURCE_MEM_32BIT) && __in_29bit_mode())
441+
res->flags |= IORESOURCE_DISABLED;
442+
443+
if (res->flags & IORESOURCE_DISABLED)
441444
continue;
442445

443446
pci_write_reg(chan, 0x00000000, SH4A_PCIEPTCTLR(win));

0 commit comments

Comments
 (0)