Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d79e743e authored by Paul Mackerras's avatar Paul Mackerras Committed by Linus Torvalds
Browse files

[PATCH] ppc64: Fix PCI flags when using OF device tree



My code to set up the PCI tree from the Open Firmware device tree was
setting IORESOURCE_* flags on the resources for the devices, but not
the PCI_BASE_ADDRESS_* flags.  This meant that some drivers
misbehaved, and /proc/pci showed the wrong types for the resources.
This fixes it.

Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2fe9f798
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -246,11 +246,14 @@ static unsigned int pci_parse_of_flags(u32 addr0)
	unsigned int flags = 0;
	unsigned int flags = 0;


	if (addr0 & 0x02000000) {
	if (addr0 & 0x02000000) {
		flags |= IORESOURCE_MEM;
		flags = IORESOURCE_MEM | PCI_BASE_ADDRESS_SPACE_MEMORY;
		flags |= (addr0 >> 22) & PCI_BASE_ADDRESS_MEM_TYPE_64;
		flags |= (addr0 >> 28) & PCI_BASE_ADDRESS_MEM_TYPE_1M;
		if (addr0 & 0x40000000)
		if (addr0 & 0x40000000)
			flags |= IORESOURCE_PREFETCH;
			flags |= IORESOURCE_PREFETCH
				 | PCI_BASE_ADDRESS_MEM_PREFETCH;
	} else if (addr0 & 0x01000000)
	} else if (addr0 & 0x01000000)
		flags |= IORESOURCE_IO;
		flags = IORESOURCE_IO | PCI_BASE_ADDRESS_SPACE_IO;
	return flags;
	return flags;
}
}