[PATCH] pci: Fix bus resource assignment on 32 bits with 64b resources
Geert Uytterhoeven
Geert.Uytterhoeven at sonycom.com
Tue Dec 4 23:39:47 EST 2007
On Tue, 4 Dec 2007, Benjamin Herrenschmidt wrote:
> The current pci_assign_unassigned_resources() code doesn't work properly
> on 32 bits platforms with 64 bits resources. The main reason is the use
> of unsigned long in various places instead of resource_size_t.
>
> This fixes it, along with some tricks to avoid casting to 64 bits on
> platforms that don't need it in every printk around.
>
> This is a pre-requisite for making powerpc use the generic code instead of
> its own half-useful implementation.
>
> Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
> ---
>
> drivers/pci/pci.h | 11 +++++++++++
> drivers/pci/setup-bus.c | 32 +++++++++++++++++---------------
> drivers/pci/setup-res.c | 5 ++---
> include/linux/pci.h | 4 ++--
> 4 files changed, 32 insertions(+), 20 deletions(-)
>
> Index: linux-work/drivers/pci/pci.h
> ===================================================================
> --- linux-work.orig/drivers/pci/pci.h 2007-12-04 17:00:43.000000000 +1100
> +++ linux-work/drivers/pci/pci.h 2007-12-04 17:02:11.000000000 +1100
> @@ -91,3 +91,14 @@ pci_match_one_device(const struct pci_de
> }
>
> struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev);
> +
> +#ifdef CONFIG_RESOURCES_64BIT
> +#define RESOURCE_ORDER(order) (1ULL << (order))
> +#define RES_PR "%016llx"
> +#else
> +#define RESOURCE_ORDER(order) (1UL << (order))
> +#define RES_PR "%08lx"
> +#endif
> +
> +#define RANGE_PR RES_PR "-" RES_PR
Can we please have them in <linux/ioport.h>? They look very useful to me
elsewhere (other bus drivers, device drivers), too.
What about naming the printf format specifier macros more like in C99, e.g.
PRI*?
With kind regards,
Geert Uytterhoeven
Software Architect
Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: Geert.Uytterhoeven at sonycom.com
Internet: http://www.sony-europe.com/
Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619
More information about the Linuxppc-dev
mailing list