All of lore.kernel.org
 help / color / mirror / Atom feed
* [POWERPC] Fix config space address for 440SPe PCIeport 2
@ 2006-12-07 23:47 Roland Dreier
  0 siblings, 0 replies; only message in thread
From: Roland Dreier @ 2006-12-07 23:47 UTC (permalink / raw)
  To: mporter; +Cc: linuxppc-embedded

The PCI Express code for PowerPC 440SPe sets up windows for memory
mapped config space access starting with port 0 at 0xc40000000, with
port 1 offset at 0x40000000 and port 2 offset at 0x80000000.  However,
ppc440spe_setup_pcie() calculates the offset as port * 0x40000000,
which doesn't work for port 2, since port is signed and the result is
big enough to be treated as negative.  Fix this by using the unsigned
constant 0x40000000u instead.

Bug originally found by Ruslan V. Sushko <rsushko@ru.mvista.com>.

Signed-off-by: Roland Dreier <rolandd@cisco.com>

---
I'm still working on cleaning up my Rev B 440SPe changes, but this bug
kills PCIe port 2 on rev A silicon so I want to send this in now.

diff --git a/arch/ppc/syslib/ppc440spe_pcie.c b/arch/ppc/syslib/ppc440spe_pcie.c
index dd5d4b9..a116325 100644
--- a/arch/ppc/syslib/ppc440spe_pcie.c
+++ b/arch/ppc/syslib/ppc440spe_pcie.c
@@ -378,14 +378,14 @@ void ppc440spe_setup_pcie(struct pci_controller *hose, int port)
 	/*
 	 * Map 16MB, which is enough for 4 bits of bus #
 	 */
-	hose->cfg_data = ioremap64(0xc40000000ull + port * 0x40000000,
+	hose->cfg_data = ioremap64(0xc40000000ull + port * 0x40000000u,
 				   1 << 24);
 	hose->ops = &pcie_pci_ops;
 
 	/*
 	 * Set bus numbers on our root port
 	 */
-	mbase = ioremap64(0xc50000000ull + port * 0x40000000, 4096);
+	mbase = ioremap64(0xc50000000ull + port * 0x40000000u, 4096);
 	out_8(mbase + PCI_PRIMARY_BUS, 0);
 	out_8(mbase + PCI_SECONDARY_BUS, 0);
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-12-07 23:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-07 23:47 [POWERPC] Fix config space address for 440SPe PCIeport 2 Roland Dreier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.