* [PATCH 1/5] Convert resource to u64 from unsigned long
@ 2005-01-13 23:26 Dave
2005-01-14 0:23 ` Andrew Morton
2005-01-14 0:52 ` Greg KH
0 siblings, 2 replies; 10+ messages in thread
From: Dave @ 2005-01-13 23:26 UTC (permalink / raw)
To: akpm, torvalds, linux-kernel, smaurer, linux, dsaxena,
drew.moseley, mporter
[-- Attachment #1: Type: text/plain, Size: 984 bytes --]
Here's my first attempt of trying to convert the struct resource
start/end to u64 per blessed by Linus =) This is to support >32bit
physical address on 32bit archs such as some of the newer ARMv6 and
XSC3 based platforms and perhaps IA32 PAE. I left the PCI stuff alone
functionally. Supporting 64bit PCI BAR on 32bit archs is for another
day. I fixed most of the core stuff I can think of, fixed ARM and i386
hopefully and a few of the device drivers as examples. I have tested
on an IQ31244 XScale IOP (ARM) platform and a dual-xeon platform for
i386. Matt Porter has graciously sent me PPC fixes that he tested on.
Signed-off-by: Dave Jiang (dave.jiang@gmail.com)
--
-= Dave =-
Software Engineer - Advanced Development Engineering Team
Storage Component Division - Intel Corp.
mailto://dave.jiang @ intel
http://sourceforge.net/projects/xscaleiop/
----
The views expressed in this email are
mine alone and do not necessarily
reflect the views of my employer
(Intel Corp.).
[-- Attachment #2: patch-core_u64fix --]
[-- Type: application/octet-stream, Size: 18730 bytes --]
diff -Naur linux-2.6.11-rc1/drivers/pci/bus.c linux-2.6.11-rc1-u64/drivers/pci/bus.c
--- linux-2.6.11-rc1/drivers/pci/bus.c 2004-12-24 14:35:39.000000000 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/bus.c 2005-01-13 11:45:41.834462168 -0700
@@ -34,10 +34,10 @@
*/
int
pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
- unsigned long size, unsigned long align, unsigned long min,
+ u64 size, u64 align, u64 min,
unsigned int type_mask,
void (*alignf)(void *, struct resource *,
- unsigned long, unsigned long),
+ u64, u64),
void *alignf_data)
{
int i, ret = -ENOMEM;
diff -Naur linux-2.6.11-rc1/drivers/pci/pci.c linux-2.6.11-rc1-u64/drivers/pci/pci.c
--- linux-2.6.11-rc1/drivers/pci/pci.c 2005-01-13 14:40:02.726164904 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/pci.c 2005-01-13 14:08:10.854813528 -0700
@@ -564,7 +564,7 @@
return 0;
err_out:
- printk (KERN_WARNING "PCI: Unable to reserve %s region #%d:%lx@%lx for device %s\n",
+ printk (KERN_WARNING "PCI: Unable to reserve %s region #%d:%" U64FMT "@%" U64FMT " for device %s\n",
pci_resource_flags(pdev, bar) & IORESOURCE_IO ? "I/O" : "mem",
bar + 1, /* PCI BAR # */
pci_resource_len(pdev, bar), pci_resource_start(pdev, bar),
diff -Naur linux-2.6.11-rc1/drivers/pci/pci.h linux-2.6.11-rc1-u64/drivers/pci/pci.h
--- linux-2.6.11-rc1/drivers/pci/pci.h 2004-12-24 14:34:31.000000000 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/pci.h 2005-01-13 11:45:41.836461864 -0700
@@ -6,10 +6,10 @@
extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev);
extern void pci_cleanup_rom(struct pci_dev *dev);
extern int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
- unsigned long size, unsigned long align,
- unsigned long min, unsigned int type_mask,
+ u64 size, u64 align,
+ u64 min, unsigned int type_mask,
void (*alignf)(void *, struct resource *,
- unsigned long, unsigned long),
+ u64, u64),
void *alignf_data);
/* PCI /proc functions */
#ifdef CONFIG_PROC_FS
diff -Naur linux-2.6.11-rc1/drivers/pci/pci-sysfs.c linux-2.6.11-rc1-u64/drivers/pci/pci-sysfs.c
--- linux-2.6.11-rc1/drivers/pci/pci-sysfs.c 2005-01-13 14:40:02.725165056 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/pci-sysfs.c 2005-01-13 14:09:42.229922400 -0700
@@ -65,7 +65,7 @@
max = DEVICE_COUNT_RESOURCE;
for (i = 0; i < max; i++) {
- str += sprintf(str,"0x%016lx 0x%016lx 0x%016lx\n",
+ str += sprintf(str,"0x%" U64FMT " 0x%" U64FMT " 0x%016lx\n",
pci_resource_start(pci_dev,i),
pci_resource_end(pci_dev,i),
pci_resource_flags(pci_dev,i));
diff -Naur linux-2.6.11-rc1/drivers/pci/proc.c linux-2.6.11-rc1-u64/drivers/pci/proc.c
--- linux-2.6.11-rc1/drivers/pci/proc.c 2004-12-24 14:34:58.000000000 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/proc.c 2005-01-13 14:26:57.296568352 -0700
@@ -301,10 +301,10 @@
#endif /* HAVE_PCI_MMAP */
};
-#if BITS_PER_LONG == 32
-#define LONG_FORMAT "\t%08lx"
-#else
+#if BITS_PER_LONG == 64
#define LONG_FORMAT "\t%16lx"
+#else
+#define LONG_FORMAT "\t%16Lx"
#endif
/* iterator */
diff -Naur linux-2.6.11-rc1/drivers/pci/rom.c linux-2.6.11-rc1-u64/drivers/pci/rom.c
--- linux-2.6.11-rc1/drivers/pci/rom.c 2004-12-24 14:34:44.000000000 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/rom.c 2005-01-13 11:45:41.837461712 -0700
@@ -74,7 +74,11 @@
} else {
if (res->flags & IORESOURCE_ROM_COPY) {
*size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
+#if BITS_PER_LONG == 64
return (void __iomem *)pci_resource_start(pdev, PCI_ROM_RESOURCE);
+#else
+ return (void __iomem *)(u32)pci_resource_start(pdev, PCI_ROM_RESOURCE);
+#endif
} else {
/* assign the ROM an address if it doesn't have one */
if (res->parent == NULL)
@@ -156,11 +160,15 @@
return rom;
res->end = res->start + *size;
+#if BITS_PER_LONG == 64
memcpy_fromio((void*)res->start, rom, *size);
+#else
+ memcpy_fromio((void*)(u32)res->start, rom, *size);
+#endif
pci_unmap_rom(pdev, rom);
res->flags |= IORESOURCE_ROM_COPY;
- return (void __iomem *)res->start;
+ return (void __iomem *)(u32)res->start;
}
/**
@@ -212,7 +220,11 @@
{
struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
if (res->flags & IORESOURCE_ROM_COPY) {
+#if BITS_PER_LONG == 64
kfree((void*)res->start);
+#else
+ kfree((void*)(u32)res->start);
+#endif
res->flags &= ~IORESOURCE_ROM_COPY;
res->start = 0;
res->end = 0;
diff -Naur linux-2.6.11-rc1/drivers/pci/setup-bus.c linux-2.6.11-rc1-u64/drivers/pci/setup-bus.c
--- linux-2.6.11-rc1/drivers/pci/setup-bus.c 2005-01-13 14:40:02.729164448 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/setup-bus.c 2005-01-13 14:16:42.450039232 -0700
@@ -357,7 +357,7 @@
order = __ffs(align) - 20;
if (order > 11) {
printk(KERN_WARNING "PCI: region %s/%d "
- "too large: %lx-%lx\n",
+ "too large: %" U64FMT "-%" U64FMT "\n",
pci_name(dev), i, r->start, r->end);
r->flags = 0;
continue;
diff -Naur linux-2.6.11-rc1/drivers/pci/setup-res.c linux-2.6.11-rc1-u64/drivers/pci/setup-res.c
--- linux-2.6.11-rc1/drivers/pci/setup-res.c 2004-12-24 14:35:25.000000000 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/setup-res.c 2005-01-13 14:20:58.061180432 -0700
@@ -42,7 +42,7 @@
pcibios_resource_to_bus(dev, ®ion, res);
- DBGC((KERN_ERR " got res [%lx:%lx] bus [%lx:%lx] flags %lx for "
+ DBGC((KERN_ERR " got res [%" U64FMT ":%" U64FMT "] bus [%lx:%lx] flags %lx for "
"BAR %d of %s\n", res->start, res->end,
region.start, region.end, res->flags,
resno, pci_name(dev)));
@@ -108,7 +108,7 @@
err = insert_resource(root, res);
if (err) {
- printk(KERN_ERR "PCI: %s region %d of %s %s [%lx:%lx]\n",
+ printk(KERN_ERR "PCI: %s region %d of %s %s [%" U64FMT ":%" U64FMT "]\n",
root ? "Address space collision on" :
"No parent found for",
resource, dtype, pci_name(dev), res->start, res->end);
@@ -121,7 +121,7 @@
{
struct pci_bus *bus = dev->bus;
struct resource *res = dev->resource + resno;
- unsigned long size, min, align;
+ u64 size, min, align;
int ret;
size = res->end - res->start + 1;
@@ -148,7 +148,7 @@
}
if (ret) {
- printk(KERN_ERR "PCI: Failed to allocate %s resource #%d:%lx@%lx for %s\n",
+ printk(KERN_ERR "PCI: Failed to allocate %s resource #%d:%" U64FMT "@%" U64FMT " for %s\n",
res->flags & IORESOURCE_IO ? "I/O" : "mem",
resno, size, res->start, pci_name(dev));
} else if (resno < PCI_BRIDGE_RESOURCES) {
@@ -176,7 +176,7 @@
continue;
if (!r_align) {
printk(KERN_WARNING "PCI: Ignore bogus resource %d "
- "[%lx:%lx] of %s\n",
+ "[%" U64FMT ":%" U64FMT "] of %s\n",
i, r->start, r->end, pci_name(dev));
continue;
}
diff -Naur linux-2.6.11-rc1/drivers/pnp/manager.c linux-2.6.11-rc1-u64/drivers/pnp/manager.c
--- linux-2.6.11-rc1/drivers/pnp/manager.c 2004-12-24 14:35:39.000000000 -0700
+++ linux-2.6.11-rc1-u64/drivers/pnp/manager.c 2005-01-13 11:45:41.839461408 -0700
@@ -25,7 +25,8 @@
static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
{
- unsigned long *start, *end, *flags;
+ u64 *start, *end;
+ unsigned long *flags;
if (!dev || !rule)
return -EINVAL;
@@ -68,7 +69,8 @@
static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
{
- unsigned long *start, *end, *flags;
+ u64 *start, *end;
+ unsigned long *flags;
if (!dev || !rule)
return -EINVAL;
@@ -121,7 +123,8 @@
static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx)
{
- unsigned long *start, *end, *flags;
+ u64 *start, *end;
+ unsigned long *flags;
int i;
/* IRQ priority: this table is good for i386 */
@@ -173,7 +176,8 @@
static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
{
- unsigned long *start, *end, *flags;
+ u64 *start, *end;
+ unsigned long *flags;
int i;
/* DMA priority: this table is good for i386 */
@@ -548,7 +552,7 @@
* @size: size of region
*
*/
-void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size)
+void pnp_resource_change(struct resource *resource, u64 start, u64 size)
{
if (resource == NULL)
return;
diff -Naur linux-2.6.11-rc1/drivers/pnp/resource.c linux-2.6.11-rc1-u64/drivers/pnp/resource.c
--- linux-2.6.11-rc1/drivers/pnp/resource.c 2004-12-24 14:34:58.000000000 -0700
+++ linux-2.6.11-rc1-u64/drivers/pnp/resource.c 2005-01-13 11:45:41.840461256 -0700
@@ -242,7 +242,7 @@
{
int tmp;
struct pnp_dev *tdev;
- unsigned long *port, *end, *tport, *tend;
+ u64 *port, *end, *tport, *tend;
port = &dev->res.port_resource[idx].start;
end = &dev->res.port_resource[idx].end;
@@ -298,7 +298,7 @@
{
int tmp;
struct pnp_dev *tdev;
- unsigned long *addr, *end, *taddr, *tend;
+ u64 *addr, *end, *taddr, *tend;
addr = &dev->res.mem_resource[idx].start;
end = &dev->res.mem_resource[idx].end;
@@ -359,7 +359,7 @@
{
int tmp;
struct pnp_dev *tdev;
- unsigned long * irq = &dev->res.irq_resource[idx].start;
+ u64 * irq = &dev->res.irq_resource[idx].start;
/* if the resource doesn't exist, don't complain about it */
if (cannot_compare(dev->res.irq_resource[idx].flags))
@@ -424,7 +424,7 @@
#ifndef CONFIG_IA64
int tmp;
struct pnp_dev *tdev;
- unsigned long * dma = &dev->res.dma_resource[idx].start;
+ u64 * dma = &dev->res.dma_resource[idx].start;
/* if the resource doesn't exist, don't complain about it */
if (cannot_compare(dev->res.dma_resource[idx].flags))
diff -Naur linux-2.6.11-rc1/include/linux/ioport.h linux-2.6.11-rc1-u64/include/linux/ioport.h
--- linux-2.6.11-rc1/include/linux/ioport.h 2004-12-24 14:34:26.000000000 -0700
+++ linux-2.6.11-rc1-u64/include/linux/ioport.h 2005-01-13 11:45:41.843460800 -0700
@@ -9,13 +9,14 @@
#define _LINUX_IOPORT_H
#include <linux/compiler.h>
+#include <linux/types.h>
/*
* Resources are tree-like, allowing
* nesting etc..
*/
struct resource {
+ u64 start, end;
const char *name;
- unsigned long start, end;
unsigned long flags;
struct resource *parent, *sibling, *child;
};
@@ -98,31 +99,31 @@
extern int release_resource(struct resource *new);
extern int insert_resource(struct resource *parent, struct resource *new);
extern int allocate_resource(struct resource *root, struct resource *new,
- unsigned long size,
- unsigned long min, unsigned long max,
- unsigned long align,
+ u64 size,
+ u64 min, u64 max,
+ u64 align,
void (*alignf)(void *, struct resource *,
- unsigned long, unsigned long),
+ u64, u64),
void *alignf_data);
-int adjust_resource(struct resource *res, unsigned long start,
- unsigned long size);
+int adjust_resource(struct resource *res, u64 start,
+ u64 size);
/* Convenience shorthand with allocation */
#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name))
#define rename_region(region, newname) do { (region)->name = (newname); } while (0)
-extern struct resource * __request_region(struct resource *, unsigned long start, unsigned long n, const char *name);
+extern struct resource * __request_region(struct resource *, u64 start, u64 n, const char *name);
/* Compatibility cruft */
#define release_region(start,n) __release_region(&ioport_resource, (start), (n))
#define check_mem_region(start,n) __check_region(&iomem_resource, (start), (n))
#define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n))
-extern int __check_region(struct resource *, unsigned long, unsigned long);
-extern void __release_region(struct resource *, unsigned long, unsigned long);
+extern int __check_region(struct resource *, u64, u64);
+extern void __release_region(struct resource *, u64, u64);
-static inline int __deprecated check_region(unsigned long s, unsigned long n)
+static inline int __deprecated check_region(u64 s, u64 n)
{
return __check_region(&ioport_resource, s, n);
}
diff -Naur linux-2.6.11-rc1/include/linux/kernel.h linux-2.6.11-rc1-u64/include/linux/kernel.h
--- linux-2.6.11-rc1/include/linux/kernel.h 2005-01-13 14:40:16.364091624 -0700
+++ linux-2.6.11-rc1-u64/include/linux/kernel.h 2005-01-13 12:13:03.566880904 -0700
@@ -39,6 +39,12 @@
#define KERN_INFO "<6>" /* informational */
#define KERN_DEBUG "<7>" /* debug-level messages */
+#if BITS_PER_LONG == 64
+#define U64FMT "016lx"
+#else
+#define U64FMT "016Lx"
+#endif
+
extern int console_printk[];
#define console_loglevel (console_printk[0])
diff -Naur linux-2.6.11-rc1/include/linux/pci.h linux-2.6.11-rc1-u64/include/linux/pci.h
--- linux-2.6.11-rc1/include/linux/pci.h 2005-01-13 14:40:18.001842648 -0700
+++ linux-2.6.11-rc1-u64/include/linux/pci.h 2005-01-13 11:45:41.844460648 -0700
@@ -726,7 +726,7 @@
/* Used only when drivers/pci/setup.c is used */
void pcibios_align_resource(void *, struct resource *,
- unsigned long, unsigned long);
+ u64, u64);
void pcibios_update_irq(struct pci_dev *, int irq);
/* Generic PCI functions used internally */
@@ -843,10 +843,10 @@
/* drivers/pci/bus.c */
int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
- unsigned long size, unsigned long align,
- unsigned long min, unsigned int type_mask,
+ u64 size, u64 align,
+ u64 min, unsigned int type_mask,
void (*alignf)(void *, struct resource *,
- unsigned long, unsigned long),
+ u64, u64),
void *alignf_data);
void pci_enable_bridges(struct pci_bus *bus);
diff -Naur linux-2.6.11-rc1/include/linux/pnp.h linux-2.6.11-rc1-u64/include/linux/pnp.h
--- linux-2.6.11-rc1/include/linux/pnp.h 2004-12-24 14:35:40.000000000 -0700
+++ linux-2.6.11-rc1-u64/include/linux/pnp.h 2005-01-13 11:45:41.845460496 -0700
@@ -384,7 +384,7 @@
int pnp_validate_config(struct pnp_dev *dev);
int pnp_activate_dev(struct pnp_dev *dev);
int pnp_disable_dev(struct pnp_dev *dev);
-void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size);
+void pnp_resource_change(struct resource *resource, u64 start, u64 size);
/* protocol helpers */
int pnp_is_active(struct pnp_dev * dev);
@@ -429,7 +429,7 @@
static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; }
static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
-static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { }
+static inline void pnp_resource_change(struct resource *resource, u64 start, u64 size) { }
/* protocol helpers */
static inline int pnp_is_active(struct pnp_dev * dev) { return 0; }
diff -Naur linux-2.6.11-rc1/kernel/resource.c linux-2.6.11-rc1-u64/kernel/resource.c
--- linux-2.6.11-rc1/kernel/resource.c 2005-01-13 14:40:18.537761176 -0700
+++ linux-2.6.11-rc1-u64/kernel/resource.c 2005-01-13 14:43:24.877433240 -0700
@@ -23,7 +23,7 @@
struct resource ioport_resource = {
.name = "PCI IO",
- .start = 0x0000,
+ .start = 0x0000ULL,
.end = IO_SPACE_LIMIT,
.flags = IORESOURCE_IO,
};
@@ -32,8 +32,8 @@
struct resource iomem_resource = {
.name = "PCI mem",
- .start = 0UL,
- .end = ~0UL,
+ .start = 0ULL,
+ .end = ~0ULL,
.flags = IORESOURCE_MEM,
};
@@ -83,7 +83,7 @@
for (depth = 0, p = r; depth < MAX_IORES_LEVEL; depth++, p = p->parent)
if (p->parent == root)
break;
- seq_printf(m, "%*s%0*lx-%0*lx : %s\n",
+ seq_printf(m, "%*s%" U64FMT "-%" U64FMT " : %s\n",
depth * 2, "",
width, r->start,
width, r->end,
@@ -151,8 +151,8 @@
/* Return the conflict entry if you can't request it */
static struct resource * __request_resource(struct resource *root, struct resource *new)
{
- unsigned long start = new->start;
- unsigned long end = new->end;
+ u64 start = new->start;
+ u64 end = new->end;
struct resource *tmp, **p;
if (end < start)
@@ -236,11 +236,11 @@
* Find empty slot in the resource tree given range and alignment.
*/
static int find_resource(struct resource *root, struct resource *new,
- unsigned long size,
- unsigned long min, unsigned long max,
- unsigned long align,
+ u64 size,
+ u64 min, u64 max,
+ u64 align,
void (*alignf)(void *, struct resource *,
- unsigned long, unsigned long),
+ u64, u64),
void *alignf_data)
{
struct resource *this = root->child;
@@ -282,11 +282,11 @@
* Allocate empty slot in the resource tree given range and alignment.
*/
int allocate_resource(struct resource *root, struct resource *new,
- unsigned long size,
- unsigned long min, unsigned long max,
- unsigned long align,
+ u64 size,
+ u64 min, u64 max,
+ u64 align,
void (*alignf)(void *, struct resource *,
- unsigned long, unsigned long),
+ u64, u64),
void *alignf_data)
{
int err;
@@ -378,10 +378,10 @@
* arguments. Returns -EBUSY if it can't fit. Existing children of
* the resource are assumed to be immutable.
*/
-int adjust_resource(struct resource *res, unsigned long start, unsigned long size)
+int adjust_resource(struct resource *res, u64 start, u64 size)
{
struct resource *tmp, *parent = res->parent;
- unsigned long end = start + size - 1;
+ u64 end = start + size - 1;
int result = -EBUSY;
write_lock(&resource_lock);
@@ -428,7 +428,7 @@
*
* Release-region releases a matching busy region.
*/
-struct resource * __request_region(struct resource *parent, unsigned long start, unsigned long n, const char *name)
+struct resource * __request_region(struct resource *parent, u64 start, u64 n, const char *name)
{
struct resource *res = kmalloc(sizeof(*res), GFP_KERNEL);
@@ -465,7 +465,7 @@
EXPORT_SYMBOL(__request_region);
-int __deprecated __check_region(struct resource *parent, unsigned long start, unsigned long n)
+int __deprecated __check_region(struct resource *parent, u64 start, u64 n)
{
struct resource * res;
@@ -480,10 +480,10 @@
EXPORT_SYMBOL(__check_region);
-void __release_region(struct resource *parent, unsigned long start, unsigned long n)
+void __release_region(struct resource *parent, u64 start, u64 n)
{
struct resource **p;
- unsigned long end;
+ u64 end;
p = &parent->child;
end = start + n - 1;
@@ -512,7 +512,7 @@
write_unlock(&resource_lock);
- printk(KERN_WARNING "Trying to free nonexistent resource <%08lx-%08lx>\n", start, end);
+ printk(KERN_WARNING "Trying to free nonexistent resource <%" U64FMT "-%" U64FMT ">\n", start, end);
}
EXPORT_SYMBOL(__release_region);
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/5] Convert resource to u64 from unsigned long
2005-01-13 23:26 [PATCH 1/5] Convert resource to u64 from unsigned long Dave
@ 2005-01-14 0:23 ` Andrew Morton
2005-01-14 0:28 ` Dave
` (4 more replies)
2005-01-14 0:52 ` Greg KH
1 sibling, 5 replies; 10+ messages in thread
From: Andrew Morton @ 2005-01-14 0:23 UTC (permalink / raw)
To: Dave; +Cc: torvalds, linux-kernel, smaurer, linux, dsaxena, drew.moseley,
mporter
Dave <dave.jiang@gmail.com> wrote:
>
> ere's my first attempt of trying to convert the struct resource
> start/end to u64 per blessed by Linus =) This is to support >32bit
> physical address on 32bit archs such as some of the newer ARMv6 and
> XSC3 based platforms and perhaps IA32 PAE. I left the PCI stuff alone
> functionally. Supporting 64bit PCI BAR on 32bit archs is for another
> day. I fixed most of the core stuff I can think of, fixed ARM and i386
> hopefully and a few of the device drivers as examples. I have tested
> on an IQ31244 XScale IOP (ARM) platform and a dual-xeon platform for
> i386. Matt Porter has graciously sent me PPC fixes that he tested on.
OK, well Greg KH will be the main target of this work..
Can you do something a bit more friendly than application/octet-stream
encoding, btw?
+#if BITS_PER_LONG == 64
+#define U64FMT "016lx"
+#else
+#define U64FMT "016Lx"
+#endif
We've avoided doing this. We prefer to do
printk("%llx", (unsigned long long)foo);
which is tidier, although a little more runtime-costly.
Your approach assumes that all 64-bit architectures implement u64 as
unsigned long (as opposed to unsigned long long, which I guess is legal?) I
don't know if that's a problem or not.
Also, the patches introduce tons of ifdefs such as:
+#if BITS_PER_LONG == 64
return (void __iomem *)pci_resource_start(pdev, PCI_ROM_RESOURCE);
+#else
+ return (void __iomem *)(u32)pci_resource_start(pdev, PCI_ROM_RESOURCE);
+#endif
We really should find a way of avoiding this. Even if it is
#if BITS_PER_LONG == 64
#define resource_to_ptr(r) ((void *)(r))
#else
#define resource_to_ptr(r) ((void *)((u32)r))
#endif
in a header file somewhere. Open-coding the decision all over the place is
unsightly.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/5] Convert resource to u64 from unsigned long
2005-01-14 0:23 ` Andrew Morton
@ 2005-01-14 0:28 ` Dave
2005-01-14 0:43 ` Linus Torvalds
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Dave @ 2005-01-14 0:28 UTC (permalink / raw)
To: Andrew Morton
Cc: torvalds, linux-kernel, smaurer, linux, dsaxena, drew.moseley,
mporter
On Thu, 13 Jan 2005 16:23:09 -0800, Andrew Morton <akpm@osdl.org> wrote:
> Dave <dave.jiang@gmail.com> wrote:
> >
> > ere's my first attempt of trying to convert the struct resource
> > start/end to u64 per blessed by Linus =) This is to support >32bit
> > physical address on 32bit archs such as some of the newer ARMv6 and
> > XSC3 based platforms and perhaps IA32 PAE. I left the PCI stuff alone
> > functionally. Supporting 64bit PCI BAR on 32bit archs is for another
> > day. I fixed most of the core stuff I can think of, fixed ARM and i386
> > hopefully and a few of the device drivers as examples. I have tested
> > on an IQ31244 XScale IOP (ARM) platform and a dual-xeon platform for
> > i386. Matt Porter has graciously sent me PPC fixes that he tested on.
>
> OK, well Greg KH will be the main target of this work..
>
> Can you do something a bit more friendly than application/octet-stream
> encoding, btw?
>
> +#if BITS_PER_LONG == 64
> +#define U64FMT "016lx"
> +#else
> +#define U64FMT "016Lx"
> +#endif
>
> We've avoided doing this. We prefer to do
>
> printk("%llx", (unsigned long long)foo);
>
> which is tidier, although a little more runtime-costly.
>
> Your approach assumes that all 64-bit architectures implement u64 as
> unsigned long (as opposed to unsigned long long, which I guess is legal?) I
> don't know if that's a problem or not.
>
> Also, the patches introduce tons of ifdefs such as:
>
> +#if BITS_PER_LONG == 64
> return (void __iomem *)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> +#else
> + return (void __iomem *)(u32)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> +#endif
>
> We really should find a way of avoiding this. Even if it is
>
> #if BITS_PER_LONG == 64
> #define resource_to_ptr(r) ((void *)(r))
> #else
> #define resource_to_ptr(r) ((void *)((u32)r))
> #endif
>
> in a header file somewhere. Open-coding the decision all over the place is
> unsightly.
>
Ok, I shall rework the patches w/ ull. I wasn't sure that ull would
cause problems on 64bit archs or not for u64....thus the ugly
workarounds....
BTW, anyone know how to inline patches via gmail?
--
-= Dave =-
Software Engineer - Advanced Development Engineering Team
Storage Component Division - Intel Corp.
mailto://dave.jiang @ intel
http://sourceforge.net/projects/xscaleiop/
----
The views expressed in this email are
mine alone and do not necessarily
reflect the views of my employer
(Intel Corp.).
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/5] Convert resource to u64 from unsigned long
2005-01-14 0:23 ` Andrew Morton
2005-01-14 0:28 ` Dave
@ 2005-01-14 0:43 ` Linus Torvalds
2005-01-14 0:48 ` Dave
2005-01-14 0:52 ` Al Viro
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Linus Torvalds @ 2005-01-14 0:43 UTC (permalink / raw)
To: Andrew Morton
Cc: Dave, linux-kernel, smaurer, linux, dsaxena, drew.moseley,
mporter
On Thu, 13 Jan 2005, Andrew Morton wrote:
>
> Also, the patches introduce tons of ifdefs such as:
>
> +#if BITS_PER_LONG == 64
> return (void __iomem *)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> +#else
> + return (void __iomem *)(u32)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> +#endif
Ouch. Who does that, anyway? It's wrong to do that. It's not a pointer,
not even an __iomem one. You'd need to do an ioremap() on it to turn it
into a pointer.
Linus
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/5] Convert resource to u64 from unsigned long
2005-01-14 0:43 ` Linus Torvalds
@ 2005-01-14 0:48 ` Dave
0 siblings, 0 replies; 10+ messages in thread
From: Dave @ 2005-01-14 0:48 UTC (permalink / raw)
To: Linus Torvalds
Cc: Andrew Morton, linux-kernel, smaurer, linux, dsaxena,
drew.moseley, mporter
On Thu, 13 Jan 2005 16:43:58 -0800 (PST), Linus Torvalds
<torvalds@osdl.org> wrote:
>
>
> On Thu, 13 Jan 2005, Andrew Morton wrote:
> >
> > Also, the patches introduce tons of ifdefs such as:
> >
> > +#if BITS_PER_LONG == 64
> > return (void __iomem *)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> > +#else
> > + return (void __iomem *)(u32)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> > +#endif
>
> Ouch. Who does that, anyway? It's wrong to do that. It's not a pointer,
> not even an __iomem one. You'd need to do an ioremap() on it to turn it
> into a pointer.
>
> Linus
>
It's in the PCI option ROM code and at first it thew me just a bit
too. Apparently the resource.start is a kmalloc'd buffer and not
really an actual bus address. Is that a gross abuse of the way struct
resource is intended to be used?
--
-= Dave =-
Software Engineer - Advanced Development Engineering Team
Storage Component Division - Intel Corp.
mailto://dave.jiang @ intel
http://sourceforge.net/projects/xscaleiop/
----
The views expressed in this email are
mine alone and do not necessarily
reflect the views of my employer
(Intel Corp.).
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/5] Convert resource to u64 from unsigned long
2005-01-14 0:23 ` Andrew Morton
2005-01-14 0:28 ` Dave
2005-01-14 0:43 ` Linus Torvalds
@ 2005-01-14 0:52 ` Al Viro
2005-01-14 0:52 ` Russell King
2005-01-14 1:35 ` Jesse Barnes
4 siblings, 0 replies; 10+ messages in thread
From: Al Viro @ 2005-01-14 0:52 UTC (permalink / raw)
To: Andrew Morton
Cc: Dave, torvalds, linux-kernel, smaurer, linux, dsaxena,
drew.moseley, mporter
On Thu, Jan 13, 2005 at 04:23:09PM -0800, Andrew Morton wrote:
> +#if BITS_PER_LONG == 64
> return (void __iomem *)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> +#else
> + return (void __iomem *)(u32)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> +#endif
>
> We really should find a way of avoiding this. Even if it is
>
> #if BITS_PER_LONG == 64
> #define resource_to_ptr(r) ((void *)(r))
> #else
> #define resource_to_ptr(r) ((void *)((u32)r))
> #endif
>
> in a header file somewhere. Open-coding the decision all over the place is
> unsightly.
This is wrong anyway - ioremap() on these will give you __iomem pointers,
but cast like that looks very bogus.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/5] Convert resource to u64 from unsigned long
2005-01-13 23:26 [PATCH 1/5] Convert resource to u64 from unsigned long Dave
2005-01-14 0:23 ` Andrew Morton
@ 2005-01-14 0:52 ` Greg KH
1 sibling, 0 replies; 10+ messages in thread
From: Greg KH @ 2005-01-14 0:52 UTC (permalink / raw)
To: Dave
Cc: akpm, torvalds, linux-kernel, smaurer, linux, dsaxena,
drew.moseley, mporter
[-- Attachment #1: Type: text/plain, Size: 137 bytes --]
On Thu, Jan 13, 2005 at 04:26:57PM -0700, Dave wrote:
Ick, care to put the patches inline so we can comment on them?
thanks,
greg k-h
[-- Attachment #2: patch-core_u64fix --]
[-- Type: application/octet-stream, Size: 18730 bytes --]
diff -Naur linux-2.6.11-rc1/drivers/pci/bus.c linux-2.6.11-rc1-u64/drivers/pci/bus.c
--- linux-2.6.11-rc1/drivers/pci/bus.c 2004-12-24 14:35:39.000000000 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/bus.c 2005-01-13 11:45:41.834462168 -0700
@@ -34,10 +34,10 @@
*/
int
pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
- unsigned long size, unsigned long align, unsigned long min,
+ u64 size, u64 align, u64 min,
unsigned int type_mask,
void (*alignf)(void *, struct resource *,
- unsigned long, unsigned long),
+ u64, u64),
void *alignf_data)
{
int i, ret = -ENOMEM;
diff -Naur linux-2.6.11-rc1/drivers/pci/pci.c linux-2.6.11-rc1-u64/drivers/pci/pci.c
--- linux-2.6.11-rc1/drivers/pci/pci.c 2005-01-13 14:40:02.726164904 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/pci.c 2005-01-13 14:08:10.854813528 -0700
@@ -564,7 +564,7 @@
return 0;
err_out:
- printk (KERN_WARNING "PCI: Unable to reserve %s region #%d:%lx@%lx for device %s\n",
+ printk (KERN_WARNING "PCI: Unable to reserve %s region #%d:%" U64FMT "@%" U64FMT " for device %s\n",
pci_resource_flags(pdev, bar) & IORESOURCE_IO ? "I/O" : "mem",
bar + 1, /* PCI BAR # */
pci_resource_len(pdev, bar), pci_resource_start(pdev, bar),
diff -Naur linux-2.6.11-rc1/drivers/pci/pci.h linux-2.6.11-rc1-u64/drivers/pci/pci.h
--- linux-2.6.11-rc1/drivers/pci/pci.h 2004-12-24 14:34:31.000000000 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/pci.h 2005-01-13 11:45:41.836461864 -0700
@@ -6,10 +6,10 @@
extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev);
extern void pci_cleanup_rom(struct pci_dev *dev);
extern int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
- unsigned long size, unsigned long align,
- unsigned long min, unsigned int type_mask,
+ u64 size, u64 align,
+ u64 min, unsigned int type_mask,
void (*alignf)(void *, struct resource *,
- unsigned long, unsigned long),
+ u64, u64),
void *alignf_data);
/* PCI /proc functions */
#ifdef CONFIG_PROC_FS
diff -Naur linux-2.6.11-rc1/drivers/pci/pci-sysfs.c linux-2.6.11-rc1-u64/drivers/pci/pci-sysfs.c
--- linux-2.6.11-rc1/drivers/pci/pci-sysfs.c 2005-01-13 14:40:02.725165056 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/pci-sysfs.c 2005-01-13 14:09:42.229922400 -0700
@@ -65,7 +65,7 @@
max = DEVICE_COUNT_RESOURCE;
for (i = 0; i < max; i++) {
- str += sprintf(str,"0x%016lx 0x%016lx 0x%016lx\n",
+ str += sprintf(str,"0x%" U64FMT " 0x%" U64FMT " 0x%016lx\n",
pci_resource_start(pci_dev,i),
pci_resource_end(pci_dev,i),
pci_resource_flags(pci_dev,i));
diff -Naur linux-2.6.11-rc1/drivers/pci/proc.c linux-2.6.11-rc1-u64/drivers/pci/proc.c
--- linux-2.6.11-rc1/drivers/pci/proc.c 2004-12-24 14:34:58.000000000 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/proc.c 2005-01-13 14:26:57.296568352 -0700
@@ -301,10 +301,10 @@
#endif /* HAVE_PCI_MMAP */
};
-#if BITS_PER_LONG == 32
-#define LONG_FORMAT "\t%08lx"
-#else
+#if BITS_PER_LONG == 64
#define LONG_FORMAT "\t%16lx"
+#else
+#define LONG_FORMAT "\t%16Lx"
#endif
/* iterator */
diff -Naur linux-2.6.11-rc1/drivers/pci/rom.c linux-2.6.11-rc1-u64/drivers/pci/rom.c
--- linux-2.6.11-rc1/drivers/pci/rom.c 2004-12-24 14:34:44.000000000 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/rom.c 2005-01-13 11:45:41.837461712 -0700
@@ -74,7 +74,11 @@
} else {
if (res->flags & IORESOURCE_ROM_COPY) {
*size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
+#if BITS_PER_LONG == 64
return (void __iomem *)pci_resource_start(pdev, PCI_ROM_RESOURCE);
+#else
+ return (void __iomem *)(u32)pci_resource_start(pdev, PCI_ROM_RESOURCE);
+#endif
} else {
/* assign the ROM an address if it doesn't have one */
if (res->parent == NULL)
@@ -156,11 +160,15 @@
return rom;
res->end = res->start + *size;
+#if BITS_PER_LONG == 64
memcpy_fromio((void*)res->start, rom, *size);
+#else
+ memcpy_fromio((void*)(u32)res->start, rom, *size);
+#endif
pci_unmap_rom(pdev, rom);
res->flags |= IORESOURCE_ROM_COPY;
- return (void __iomem *)res->start;
+ return (void __iomem *)(u32)res->start;
}
/**
@@ -212,7 +220,11 @@
{
struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
if (res->flags & IORESOURCE_ROM_COPY) {
+#if BITS_PER_LONG == 64
kfree((void*)res->start);
+#else
+ kfree((void*)(u32)res->start);
+#endif
res->flags &= ~IORESOURCE_ROM_COPY;
res->start = 0;
res->end = 0;
diff -Naur linux-2.6.11-rc1/drivers/pci/setup-bus.c linux-2.6.11-rc1-u64/drivers/pci/setup-bus.c
--- linux-2.6.11-rc1/drivers/pci/setup-bus.c 2005-01-13 14:40:02.729164448 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/setup-bus.c 2005-01-13 14:16:42.450039232 -0700
@@ -357,7 +357,7 @@
order = __ffs(align) - 20;
if (order > 11) {
printk(KERN_WARNING "PCI: region %s/%d "
- "too large: %lx-%lx\n",
+ "too large: %" U64FMT "-%" U64FMT "\n",
pci_name(dev), i, r->start, r->end);
r->flags = 0;
continue;
diff -Naur linux-2.6.11-rc1/drivers/pci/setup-res.c linux-2.6.11-rc1-u64/drivers/pci/setup-res.c
--- linux-2.6.11-rc1/drivers/pci/setup-res.c 2004-12-24 14:35:25.000000000 -0700
+++ linux-2.6.11-rc1-u64/drivers/pci/setup-res.c 2005-01-13 14:20:58.061180432 -0700
@@ -42,7 +42,7 @@
pcibios_resource_to_bus(dev, ®ion, res);
- DBGC((KERN_ERR " got res [%lx:%lx] bus [%lx:%lx] flags %lx for "
+ DBGC((KERN_ERR " got res [%" U64FMT ":%" U64FMT "] bus [%lx:%lx] flags %lx for "
"BAR %d of %s\n", res->start, res->end,
region.start, region.end, res->flags,
resno, pci_name(dev)));
@@ -108,7 +108,7 @@
err = insert_resource(root, res);
if (err) {
- printk(KERN_ERR "PCI: %s region %d of %s %s [%lx:%lx]\n",
+ printk(KERN_ERR "PCI: %s region %d of %s %s [%" U64FMT ":%" U64FMT "]\n",
root ? "Address space collision on" :
"No parent found for",
resource, dtype, pci_name(dev), res->start, res->end);
@@ -121,7 +121,7 @@
{
struct pci_bus *bus = dev->bus;
struct resource *res = dev->resource + resno;
- unsigned long size, min, align;
+ u64 size, min, align;
int ret;
size = res->end - res->start + 1;
@@ -148,7 +148,7 @@
}
if (ret) {
- printk(KERN_ERR "PCI: Failed to allocate %s resource #%d:%lx@%lx for %s\n",
+ printk(KERN_ERR "PCI: Failed to allocate %s resource #%d:%" U64FMT "@%" U64FMT " for %s\n",
res->flags & IORESOURCE_IO ? "I/O" : "mem",
resno, size, res->start, pci_name(dev));
} else if (resno < PCI_BRIDGE_RESOURCES) {
@@ -176,7 +176,7 @@
continue;
if (!r_align) {
printk(KERN_WARNING "PCI: Ignore bogus resource %d "
- "[%lx:%lx] of %s\n",
+ "[%" U64FMT ":%" U64FMT "] of %s\n",
i, r->start, r->end, pci_name(dev));
continue;
}
diff -Naur linux-2.6.11-rc1/drivers/pnp/manager.c linux-2.6.11-rc1-u64/drivers/pnp/manager.c
--- linux-2.6.11-rc1/drivers/pnp/manager.c 2004-12-24 14:35:39.000000000 -0700
+++ linux-2.6.11-rc1-u64/drivers/pnp/manager.c 2005-01-13 11:45:41.839461408 -0700
@@ -25,7 +25,8 @@
static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
{
- unsigned long *start, *end, *flags;
+ u64 *start, *end;
+ unsigned long *flags;
if (!dev || !rule)
return -EINVAL;
@@ -68,7 +69,8 @@
static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
{
- unsigned long *start, *end, *flags;
+ u64 *start, *end;
+ unsigned long *flags;
if (!dev || !rule)
return -EINVAL;
@@ -121,7 +123,8 @@
static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx)
{
- unsigned long *start, *end, *flags;
+ u64 *start, *end;
+ unsigned long *flags;
int i;
/* IRQ priority: this table is good for i386 */
@@ -173,7 +176,8 @@
static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
{
- unsigned long *start, *end, *flags;
+ u64 *start, *end;
+ unsigned long *flags;
int i;
/* DMA priority: this table is good for i386 */
@@ -548,7 +552,7 @@
* @size: size of region
*
*/
-void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size)
+void pnp_resource_change(struct resource *resource, u64 start, u64 size)
{
if (resource == NULL)
return;
diff -Naur linux-2.6.11-rc1/drivers/pnp/resource.c linux-2.6.11-rc1-u64/drivers/pnp/resource.c
--- linux-2.6.11-rc1/drivers/pnp/resource.c 2004-12-24 14:34:58.000000000 -0700
+++ linux-2.6.11-rc1-u64/drivers/pnp/resource.c 2005-01-13 11:45:41.840461256 -0700
@@ -242,7 +242,7 @@
{
int tmp;
struct pnp_dev *tdev;
- unsigned long *port, *end, *tport, *tend;
+ u64 *port, *end, *tport, *tend;
port = &dev->res.port_resource[idx].start;
end = &dev->res.port_resource[idx].end;
@@ -298,7 +298,7 @@
{
int tmp;
struct pnp_dev *tdev;
- unsigned long *addr, *end, *taddr, *tend;
+ u64 *addr, *end, *taddr, *tend;
addr = &dev->res.mem_resource[idx].start;
end = &dev->res.mem_resource[idx].end;
@@ -359,7 +359,7 @@
{
int tmp;
struct pnp_dev *tdev;
- unsigned long * irq = &dev->res.irq_resource[idx].start;
+ u64 * irq = &dev->res.irq_resource[idx].start;
/* if the resource doesn't exist, don't complain about it */
if (cannot_compare(dev->res.irq_resource[idx].flags))
@@ -424,7 +424,7 @@
#ifndef CONFIG_IA64
int tmp;
struct pnp_dev *tdev;
- unsigned long * dma = &dev->res.dma_resource[idx].start;
+ u64 * dma = &dev->res.dma_resource[idx].start;
/* if the resource doesn't exist, don't complain about it */
if (cannot_compare(dev->res.dma_resource[idx].flags))
diff -Naur linux-2.6.11-rc1/include/linux/ioport.h linux-2.6.11-rc1-u64/include/linux/ioport.h
--- linux-2.6.11-rc1/include/linux/ioport.h 2004-12-24 14:34:26.000000000 -0700
+++ linux-2.6.11-rc1-u64/include/linux/ioport.h 2005-01-13 11:45:41.843460800 -0700
@@ -9,13 +9,14 @@
#define _LINUX_IOPORT_H
#include <linux/compiler.h>
+#include <linux/types.h>
/*
* Resources are tree-like, allowing
* nesting etc..
*/
struct resource {
+ u64 start, end;
const char *name;
- unsigned long start, end;
unsigned long flags;
struct resource *parent, *sibling, *child;
};
@@ -98,31 +99,31 @@
extern int release_resource(struct resource *new);
extern int insert_resource(struct resource *parent, struct resource *new);
extern int allocate_resource(struct resource *root, struct resource *new,
- unsigned long size,
- unsigned long min, unsigned long max,
- unsigned long align,
+ u64 size,
+ u64 min, u64 max,
+ u64 align,
void (*alignf)(void *, struct resource *,
- unsigned long, unsigned long),
+ u64, u64),
void *alignf_data);
-int adjust_resource(struct resource *res, unsigned long start,
- unsigned long size);
+int adjust_resource(struct resource *res, u64 start,
+ u64 size);
/* Convenience shorthand with allocation */
#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name))
#define rename_region(region, newname) do { (region)->name = (newname); } while (0)
-extern struct resource * __request_region(struct resource *, unsigned long start, unsigned long n, const char *name);
+extern struct resource * __request_region(struct resource *, u64 start, u64 n, const char *name);
/* Compatibility cruft */
#define release_region(start,n) __release_region(&ioport_resource, (start), (n))
#define check_mem_region(start,n) __check_region(&iomem_resource, (start), (n))
#define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n))
-extern int __check_region(struct resource *, unsigned long, unsigned long);
-extern void __release_region(struct resource *, unsigned long, unsigned long);
+extern int __check_region(struct resource *, u64, u64);
+extern void __release_region(struct resource *, u64, u64);
-static inline int __deprecated check_region(unsigned long s, unsigned long n)
+static inline int __deprecated check_region(u64 s, u64 n)
{
return __check_region(&ioport_resource, s, n);
}
diff -Naur linux-2.6.11-rc1/include/linux/kernel.h linux-2.6.11-rc1-u64/include/linux/kernel.h
--- linux-2.6.11-rc1/include/linux/kernel.h 2005-01-13 14:40:16.364091624 -0700
+++ linux-2.6.11-rc1-u64/include/linux/kernel.h 2005-01-13 12:13:03.566880904 -0700
@@ -39,6 +39,12 @@
#define KERN_INFO "<6>" /* informational */
#define KERN_DEBUG "<7>" /* debug-level messages */
+#if BITS_PER_LONG == 64
+#define U64FMT "016lx"
+#else
+#define U64FMT "016Lx"
+#endif
+
extern int console_printk[];
#define console_loglevel (console_printk[0])
diff -Naur linux-2.6.11-rc1/include/linux/pci.h linux-2.6.11-rc1-u64/include/linux/pci.h
--- linux-2.6.11-rc1/include/linux/pci.h 2005-01-13 14:40:18.001842648 -0700
+++ linux-2.6.11-rc1-u64/include/linux/pci.h 2005-01-13 11:45:41.844460648 -0700
@@ -726,7 +726,7 @@
/* Used only when drivers/pci/setup.c is used */
void pcibios_align_resource(void *, struct resource *,
- unsigned long, unsigned long);
+ u64, u64);
void pcibios_update_irq(struct pci_dev *, int irq);
/* Generic PCI functions used internally */
@@ -843,10 +843,10 @@
/* drivers/pci/bus.c */
int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
- unsigned long size, unsigned long align,
- unsigned long min, unsigned int type_mask,
+ u64 size, u64 align,
+ u64 min, unsigned int type_mask,
void (*alignf)(void *, struct resource *,
- unsigned long, unsigned long),
+ u64, u64),
void *alignf_data);
void pci_enable_bridges(struct pci_bus *bus);
diff -Naur linux-2.6.11-rc1/include/linux/pnp.h linux-2.6.11-rc1-u64/include/linux/pnp.h
--- linux-2.6.11-rc1/include/linux/pnp.h 2004-12-24 14:35:40.000000000 -0700
+++ linux-2.6.11-rc1-u64/include/linux/pnp.h 2005-01-13 11:45:41.845460496 -0700
@@ -384,7 +384,7 @@
int pnp_validate_config(struct pnp_dev *dev);
int pnp_activate_dev(struct pnp_dev *dev);
int pnp_disable_dev(struct pnp_dev *dev);
-void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size);
+void pnp_resource_change(struct resource *resource, u64 start, u64 size);
/* protocol helpers */
int pnp_is_active(struct pnp_dev * dev);
@@ -429,7 +429,7 @@
static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; }
static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
-static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { }
+static inline void pnp_resource_change(struct resource *resource, u64 start, u64 size) { }
/* protocol helpers */
static inline int pnp_is_active(struct pnp_dev * dev) { return 0; }
diff -Naur linux-2.6.11-rc1/kernel/resource.c linux-2.6.11-rc1-u64/kernel/resource.c
--- linux-2.6.11-rc1/kernel/resource.c 2005-01-13 14:40:18.537761176 -0700
+++ linux-2.6.11-rc1-u64/kernel/resource.c 2005-01-13 14:43:24.877433240 -0700
@@ -23,7 +23,7 @@
struct resource ioport_resource = {
.name = "PCI IO",
- .start = 0x0000,
+ .start = 0x0000ULL,
.end = IO_SPACE_LIMIT,
.flags = IORESOURCE_IO,
};
@@ -32,8 +32,8 @@
struct resource iomem_resource = {
.name = "PCI mem",
- .start = 0UL,
- .end = ~0UL,
+ .start = 0ULL,
+ .end = ~0ULL,
.flags = IORESOURCE_MEM,
};
@@ -83,7 +83,7 @@
for (depth = 0, p = r; depth < MAX_IORES_LEVEL; depth++, p = p->parent)
if (p->parent == root)
break;
- seq_printf(m, "%*s%0*lx-%0*lx : %s\n",
+ seq_printf(m, "%*s%" U64FMT "-%" U64FMT " : %s\n",
depth * 2, "",
width, r->start,
width, r->end,
@@ -151,8 +151,8 @@
/* Return the conflict entry if you can't request it */
static struct resource * __request_resource(struct resource *root, struct resource *new)
{
- unsigned long start = new->start;
- unsigned long end = new->end;
+ u64 start = new->start;
+ u64 end = new->end;
struct resource *tmp, **p;
if (end < start)
@@ -236,11 +236,11 @@
* Find empty slot in the resource tree given range and alignment.
*/
static int find_resource(struct resource *root, struct resource *new,
- unsigned long size,
- unsigned long min, unsigned long max,
- unsigned long align,
+ u64 size,
+ u64 min, u64 max,
+ u64 align,
void (*alignf)(void *, struct resource *,
- unsigned long, unsigned long),
+ u64, u64),
void *alignf_data)
{
struct resource *this = root->child;
@@ -282,11 +282,11 @@
* Allocate empty slot in the resource tree given range and alignment.
*/
int allocate_resource(struct resource *root, struct resource *new,
- unsigned long size,
- unsigned long min, unsigned long max,
- unsigned long align,
+ u64 size,
+ u64 min, u64 max,
+ u64 align,
void (*alignf)(void *, struct resource *,
- unsigned long, unsigned long),
+ u64, u64),
void *alignf_data)
{
int err;
@@ -378,10 +378,10 @@
* arguments. Returns -EBUSY if it can't fit. Existing children of
* the resource are assumed to be immutable.
*/
-int adjust_resource(struct resource *res, unsigned long start, unsigned long size)
+int adjust_resource(struct resource *res, u64 start, u64 size)
{
struct resource *tmp, *parent = res->parent;
- unsigned long end = start + size - 1;
+ u64 end = start + size - 1;
int result = -EBUSY;
write_lock(&resource_lock);
@@ -428,7 +428,7 @@
*
* Release-region releases a matching busy region.
*/
-struct resource * __request_region(struct resource *parent, unsigned long start, unsigned long n, const char *name)
+struct resource * __request_region(struct resource *parent, u64 start, u64 n, const char *name)
{
struct resource *res = kmalloc(sizeof(*res), GFP_KERNEL);
@@ -465,7 +465,7 @@
EXPORT_SYMBOL(__request_region);
-int __deprecated __check_region(struct resource *parent, unsigned long start, unsigned long n)
+int __deprecated __check_region(struct resource *parent, u64 start, u64 n)
{
struct resource * res;
@@ -480,10 +480,10 @@
EXPORT_SYMBOL(__check_region);
-void __release_region(struct resource *parent, unsigned long start, unsigned long n)
+void __release_region(struct resource *parent, u64 start, u64 n)
{
struct resource **p;
- unsigned long end;
+ u64 end;
p = &parent->child;
end = start + n - 1;
@@ -512,7 +512,7 @@
write_unlock(&resource_lock);
- printk(KERN_WARNING "Trying to free nonexistent resource <%08lx-%08lx>\n", start, end);
+ printk(KERN_WARNING "Trying to free nonexistent resource <%" U64FMT "-%" U64FMT ">\n", start, end);
}
EXPORT_SYMBOL(__release_region);
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/5] Convert resource to u64 from unsigned long
2005-01-14 0:23 ` Andrew Morton
` (2 preceding siblings ...)
2005-01-14 0:52 ` Al Viro
@ 2005-01-14 0:52 ` Russell King
2005-01-14 1:35 ` Jesse Barnes
4 siblings, 0 replies; 10+ messages in thread
From: Russell King @ 2005-01-14 0:52 UTC (permalink / raw)
To: Andrew Morton
Cc: Dave, torvalds, linux-kernel, smaurer, linux, dsaxena,
drew.moseley, mporter
On Thu, Jan 13, 2005 at 04:23:09PM -0800, Andrew Morton wrote:
> Also, the patches introduce tons of ifdefs such as:
>
> +#if BITS_PER_LONG == 64
> return (void __iomem *)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> +#else
> + return (void __iomem *)(u32)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> +#endif
That looks rather illegal to me. What says that ROM resources are
in a different memory space to MMIO resources? PCI internally treats
them the same as MMIO, and as such they certainly require ioremapping
on ARM.
Just because x86 has a broken architecture with respect to having
holes in its memory map does not mean that's suitable for the rest
of the world.
ISTR x86 ioremap knows about this, so maybe the solution to the above
is to do it the Right Way(tm) and use ioremap() ?
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/5] Convert resource to u64 from unsigned long
2005-01-14 0:23 ` Andrew Morton
` (3 preceding siblings ...)
2005-01-14 0:52 ` Russell King
@ 2005-01-14 1:35 ` Jesse Barnes
2005-01-14 3:49 ` Dave
4 siblings, 1 reply; 10+ messages in thread
From: Jesse Barnes @ 2005-01-14 1:35 UTC (permalink / raw)
To: Andrew Morton
Cc: Dave, torvalds, linux-kernel, smaurer, linux, dsaxena,
drew.moseley, mporter
On Thursday, January 13, 2005 4:23 pm, Andrew Morton wrote:
> +#if BITS_PER_LONG == 64
> return (void __iomem *)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> +#else
> + return (void __iomem *)(u32)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> +#endif
I just noticed that the PCI rom code also appears to be mixing other types,
e.g. it delcares start as loff_t and stuffs a pci_resource_start into it,
then uses it as the first argument to ioremap.
Jesse
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/5] Convert resource to u64 from unsigned long
2005-01-14 1:35 ` Jesse Barnes
@ 2005-01-14 3:49 ` Dave
0 siblings, 0 replies; 10+ messages in thread
From: Dave @ 2005-01-14 3:49 UTC (permalink / raw)
To: Jesse Barnes
Cc: Andrew Morton, torvalds, linux-kernel, smaurer, linux, dsaxena,
drew.moseley, mporter
On Thu, 13 Jan 2005 17:35:04 -0800, Jesse Barnes <jbarnes@engr.sgi.com> wrote:
> On Thursday, January 13, 2005 4:23 pm, Andrew Morton wrote:
> > +#if BITS_PER_LONG == 64
> > return (void __iomem *)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> > +#else
> > + return (void __iomem *)(u32)pci_resource_start(pdev, PCI_ROM_RESOURCE);
> > +#endif
>
> I just noticed that the PCI rom code also appears to be mixing other types,
> e.g. it delcares start as loff_t and stuffs a pci_resource_start into it,
> then uses it as the first argument to ioremap.
>
> Jesse
>
Looks like the PCI rom code is in a "weird" state and I will just
leave it alone until it is done the "right" way (unless it's not
compiling). I don't believe I'll have to touch the code if it is
corrected....
--
-= Dave =-
Software Engineer - Advanced Development Engineering Team
Storage Component Division - Intel Corp.
mailto://dave.jiang @ intel
http://sourceforge.net/projects/xscaleiop/
----
The views expressed in this email are
mine alone and do not necessarily
reflect the views of my employer
(Intel Corp.).
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-01-14 3:50 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-13 23:26 [PATCH 1/5] Convert resource to u64 from unsigned long Dave
2005-01-14 0:23 ` Andrew Morton
2005-01-14 0:28 ` Dave
2005-01-14 0:43 ` Linus Torvalds
2005-01-14 0:48 ` Dave
2005-01-14 0:52 ` Al Viro
2005-01-14 0:52 ` Russell King
2005-01-14 1:35 ` Jesse Barnes
2005-01-14 3:49 ` Dave
2005-01-14 0:52 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox