Re: [PATCH 1/2] pci: Fix bus resource assignment on 32 bits with 64b resources
On Fri, Feb 01, 2008 at 11:18:56AM +0100, Stefan Roese wrote: > On Monday 10 December 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 <[EMAIL PROTECTED]> > > Checking Linus's latest git repository, it seems this patch (and the 2nd from > this series) hasn't been applied till now. This is just a reminder, that it > gets in in this merge-window. Just got sent to him... thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] pci: Fix bus resource assignment on 32 bits with 64b resources
On Monday 10 December 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 <[EMAIL PROTECTED]> Checking Linus's latest git repository, it seems this patch (and the 2nd from this series) hasn't been applied till now. This is just a reminder, that it gets in in this merge-window. Thanks. Best regards, Stefan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] pci: Fix bus resource assignment on 32 bits with 64b resources
On Monday 10 December 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 [EMAIL PROTECTED] Checking Linus's latest git repository, it seems this patch (and the 2nd from this series) hasn't been applied till now. This is just a reminder, that it gets in in this merge-window. Thanks. Best regards, Stefan -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] pci: Fix bus resource assignment on 32 bits with 64b resources
On Fri, Feb 01, 2008 at 11:18:56AM +0100, Stefan Roese wrote: On Monday 10 December 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 [EMAIL PROTECTED] Checking Linus's latest git repository, it seems this patch (and the 2nd from this series) hasn't been applied till now. This is just a reminder, that it gets in in this merge-window. Just got sent to him... thanks, greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] pci: Fix bus resource assignment on 32 bits with 64b resources
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 <[EMAIL PROTECTED]> --- This version now uses casts as Greg asked for and adds proper setup of the prefetchable base & limit "upper" registers when using 64 bits resources. (and builds ... sorry about that) drivers/pci/setup-bus.c | 64 ++-- include/linux/pci.h |4 +-- 2 files changed, 42 insertions(+), 26 deletions(-) Index: linux-work/drivers/pci/setup-bus.c === --- linux-work.orig/drivers/pci/setup-bus.c 2007-12-10 17:16:44.0 +1100 +++ linux-work/drivers/pci/setup-bus.c 2007-12-10 17:21:53.0 +1100 @@ -89,8 +89,9 @@ void pci_setup_cardbus(struct pci_bus *b * The IO resource is allocated a range twice as large as it * would normally need. This allows us to set both IO regs. */ - printk(" IO window: %08lx-%08lx\n", - region.start, region.end); + printk(KERN_INFO " IO window: 0x%08lx-0x%08lx\n", + (unsigned long)region.start, + (unsigned long)region.end); pci_write_config_dword(bridge, PCI_CB_IO_BASE_0, region.start); pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_0, @@ -99,8 +100,9 @@ void pci_setup_cardbus(struct pci_bus *b pcibios_resource_to_bus(bridge, , bus->resource[1]); if (bus->resource[1]->flags & IORESOURCE_IO) { - printk(" IO window: %08lx-%08lx\n", - region.start, region.end); + printk(KERN_INFO " IO window: 0x%08lx-0x%08lx\n", + (unsigned long)region.start, + (unsigned long)region.end); pci_write_config_dword(bridge, PCI_CB_IO_BASE_1, region.start); pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_1, @@ -109,8 +111,9 @@ void pci_setup_cardbus(struct pci_bus *b pcibios_resource_to_bus(bridge, , bus->resource[2]); if (bus->resource[2]->flags & IORESOURCE_MEM) { - printk(" PREFETCH window: %08lx-%08lx\n", - region.start, region.end); + printk(KERN_INFO " PREFETCH window: 0x%08lx-0x%08lx\n", + (unsigned long)region.start, + (unsigned long)region.end); pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0, region.start); pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_0, @@ -119,8 +122,9 @@ void pci_setup_cardbus(struct pci_bus *b pcibios_resource_to_bus(bridge, , bus->resource[3]); if (bus->resource[3]->flags & IORESOURCE_MEM) { - printk(" MEM window: %08lx-%08lx\n", - region.start, region.end); + printk(KERN_INFO " MEM window: 0x%08lx-0x%08lx\n", + (unsigned long)region.start, + (unsigned long)region.end); pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1, region.start); pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_1, @@ -145,7 +149,7 @@ pci_setup_bridge(struct pci_bus *bus) { struct pci_dev *bridge = bus->self; struct pci_bus_region region; - u32 l, io_upper16; + u32 l, bu, lu, io_upper16; DBG(KERN_INFO "PCI: Bridge: %s\n", pci_name(bridge)); @@ -159,7 +163,8 @@ pci_setup_bridge(struct pci_bus *bus) /* Set up upper 16 bits of I/O base/limit. */ io_upper16 = (region.end & 0x) | (region.start >> 16); DBG(KERN_INFO " IO window: %04lx-%04lx\n", - region.start, region.end); + (unsigned long)region.start, + (unsigned long)region.end); } else { /* Clear upper 16 bits of I/O base/limit. */ @@ -180,8 +185,9 @@ pci_setup_bridge(struct pci_bus *bus) if (bus->resource[1]->flags & IORESOURCE_MEM) { l = (region.start >> 16) & 0xfff0; l |= region.end & 0xfff0; - DBG(KERN_INFO " MEM window: %08lx-%08lx\n", - region.start, region.end); + DBG(KERN_INFO " MEM window: 0x%08lx-0x%08lx\n", + (unsigned long)region.start, +
[PATCH 1/2] pci: Fix bus resource assignment on 32 bits with 64b resources
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 [EMAIL PROTECTED] --- This version now uses casts as Greg asked for and adds proper setup of the prefetchable base limit upper registers when using 64 bits resources. (and builds ... sorry about that) drivers/pci/setup-bus.c | 64 ++-- include/linux/pci.h |4 +-- 2 files changed, 42 insertions(+), 26 deletions(-) Index: linux-work/drivers/pci/setup-bus.c === --- linux-work.orig/drivers/pci/setup-bus.c 2007-12-10 17:16:44.0 +1100 +++ linux-work/drivers/pci/setup-bus.c 2007-12-10 17:21:53.0 +1100 @@ -89,8 +89,9 @@ void pci_setup_cardbus(struct pci_bus *b * The IO resource is allocated a range twice as large as it * would normally need. This allows us to set both IO regs. */ - printk( IO window: %08lx-%08lx\n, - region.start, region.end); + printk(KERN_INFO IO window: 0x%08lx-0x%08lx\n, + (unsigned long)region.start, + (unsigned long)region.end); pci_write_config_dword(bridge, PCI_CB_IO_BASE_0, region.start); pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_0, @@ -99,8 +100,9 @@ void pci_setup_cardbus(struct pci_bus *b pcibios_resource_to_bus(bridge, region, bus-resource[1]); if (bus-resource[1]-flags IORESOURCE_IO) { - printk( IO window: %08lx-%08lx\n, - region.start, region.end); + printk(KERN_INFO IO window: 0x%08lx-0x%08lx\n, + (unsigned long)region.start, + (unsigned long)region.end); pci_write_config_dword(bridge, PCI_CB_IO_BASE_1, region.start); pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_1, @@ -109,8 +111,9 @@ void pci_setup_cardbus(struct pci_bus *b pcibios_resource_to_bus(bridge, region, bus-resource[2]); if (bus-resource[2]-flags IORESOURCE_MEM) { - printk( PREFETCH window: %08lx-%08lx\n, - region.start, region.end); + printk(KERN_INFO PREFETCH window: 0x%08lx-0x%08lx\n, + (unsigned long)region.start, + (unsigned long)region.end); pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0, region.start); pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_0, @@ -119,8 +122,9 @@ void pci_setup_cardbus(struct pci_bus *b pcibios_resource_to_bus(bridge, region, bus-resource[3]); if (bus-resource[3]-flags IORESOURCE_MEM) { - printk( MEM window: %08lx-%08lx\n, - region.start, region.end); + printk(KERN_INFO MEM window: 0x%08lx-0x%08lx\n, + (unsigned long)region.start, + (unsigned long)region.end); pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1, region.start); pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_1, @@ -145,7 +149,7 @@ pci_setup_bridge(struct pci_bus *bus) { struct pci_dev *bridge = bus-self; struct pci_bus_region region; - u32 l, io_upper16; + u32 l, bu, lu, io_upper16; DBG(KERN_INFO PCI: Bridge: %s\n, pci_name(bridge)); @@ -159,7 +163,8 @@ pci_setup_bridge(struct pci_bus *bus) /* Set up upper 16 bits of I/O base/limit. */ io_upper16 = (region.end 0x) | (region.start 16); DBG(KERN_INFO IO window: %04lx-%04lx\n, - region.start, region.end); + (unsigned long)region.start, + (unsigned long)region.end); } else { /* Clear upper 16 bits of I/O base/limit. */ @@ -180,8 +185,9 @@ pci_setup_bridge(struct pci_bus *bus) if (bus-resource[1]-flags IORESOURCE_MEM) { l = (region.start 16) 0xfff0; l |= region.end 0xfff0; - DBG(KERN_INFO MEM window: %08lx-%08lx\n, - region.start, region.end); + DBG(KERN_INFO MEM window: 0x%08lx-0x%08lx\n, + (unsigned long)region.start, + (unsigned