[patch] make ppc build with 64-bit resource.start, end
Andrew Morton
akpm at osdl.org
Wed Feb 23 18:28:03 EST 2005
Could someone please double-check that this is an equivalent
transformation?
(wtf is that code doing, btw?)
Greg's tree changes resource.start and resource.end to u64. So ppc fails to
link due to missing 64-bit divide helpers. Fix.
Signed-off-by: Andrew Morton <akpm at osdl.org>
---
25-akpm/arch/ppc/kernel/pci.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff -puN arch/ppc/kernel/pci.c~ppc32-64-bit-resource-fix arch/ppc/kernel/pci.c
--- 25/arch/ppc/kernel/pci.c~ppc32-64-bit-resource-fix 2005-02-22 23:27:09.000000000 -0800
+++ 25-akpm/arch/ppc/kernel/pci.c 2005-02-22 23:27:33.000000000 -0800
@@ -21,6 +21,7 @@
#include <asm/byteorder.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
+#include <asm/div64.h>
#undef DEBUG
@@ -1088,6 +1089,18 @@ do_update_p2p_io_resource(struct pci_bus
#endif
}
+
+static u64 push_end(struct resource *res, u64 size)
+{
+ u64 end;
+
+ end = res->end + size;
+ do_div(end, size + 1);
+ end *= size + 1;
+ end += size;
+ return end;
+}
+
/* This function is pretty basic and actually quite broken for the
* general case, it's enough for us right now though. It's supposed
* to tell us if we need to open an IO range at all or not and what
@@ -1100,10 +1113,6 @@ check_for_io_childs(struct pci_bus *bus,
int i;
int rc = 0;
-#define push_end(res, size) do { unsigned long __sz = (size) ; \
- res->end = ((res->end + __sz) / (__sz + 1)) * (__sz + 1) + __sz; \
- } while (0)
-
list_for_each_entry(dev, &bus->devices, bus_list) {
u16 class = dev->class >> 8;
@@ -1117,7 +1126,7 @@ check_for_io_childs(struct pci_bus *bus,
for (i=0; i<PCI_NUM_RESOURCES; i++) {
struct resource *r;
- unsigned long r_size;
+ u64 r_size;
if (dev->class >> 8 == PCI_CLASS_BRIDGE_PCI
&& i >= PCI_BRIDGE_RESOURCES)
_
More information about the Linuxppc-dev
mailing list