diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-29 13:49:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-29 13:49:17 -0400 |
commit | 1903ac54f8536b11478e4f01c339e10b538f59e0 (patch) | |
tree | ff5410f0539ab4aa09f964fa1d0c6dc26c614dc2 /kernel/resource.c | |
parent | 47c2a3aa4475d27073dd3c7e183fcc13f495c8f5 (diff) | |
parent | 87937472ff8e34ad5c7b798a8a52e4368af216df (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6:
[PATCH] i386: export memory more than 4G through /proc/iomem
[PATCH] 64bit Resource: finally enable 64bit resource sizes
[PATCH] 64bit Resource: convert a few remaining drivers to use resource_size_t where needed
[PATCH] 64bit resource: change pnp core to use resource_size_t
[PATCH] 64bit resource: change pci core and arch code to use resource_size_t
[PATCH] 64bit resource: change resource core to use resource_size_t
[PATCH] 64bit resource: introduce resource_size_t for the start and end of struct resource
[PATCH] 64bit resource: fix up printks for resources in misc drivers
[PATCH] 64bit resource: fix up printks for resources in arch and core code
[PATCH] 64bit resource: fix up printks for resources in pcmcia drivers
[PATCH] 64bit resource: fix up printks for resources in video drivers
[PATCH] 64bit resource: fix up printks for resources in ide drivers
[PATCH] 64bit resource: fix up printks for resources in mtd drivers
[PATCH] 64bit resource: fix up printks for resources in pci core and hotplug drivers
[PATCH] 64bit resource: fix up printks for resources in networks drivers
[PATCH] 64bit resource: fix up printks for resources in sound drivers
[PATCH] 64bit resource: C99 changes for struct resource declarations
Fixed up trivial conflict in drivers/ide/pci/cmd64x.c (the printk that
was changed by the 64-bit resources had been deleted in the meantime ;)
Diffstat (limited to 'kernel/resource.c')
-rw-r--r-- | kernel/resource.c | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/kernel/resource.c b/kernel/resource.c index 2404f9b0bc47..bf1130d81b7f 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
@@ -23,20 +23,18 @@ | |||
23 | 23 | ||
24 | struct resource ioport_resource = { | 24 | struct resource ioport_resource = { |
25 | .name = "PCI IO", | 25 | .name = "PCI IO", |
26 | .start = 0x0000, | 26 | .start = 0, |
27 | .end = IO_SPACE_LIMIT, | 27 | .end = IO_SPACE_LIMIT, |
28 | .flags = IORESOURCE_IO, | 28 | .flags = IORESOURCE_IO, |
29 | }; | 29 | }; |
30 | |||
31 | EXPORT_SYMBOL(ioport_resource); | 30 | EXPORT_SYMBOL(ioport_resource); |
32 | 31 | ||
33 | struct resource iomem_resource = { | 32 | struct resource iomem_resource = { |
34 | .name = "PCI mem", | 33 | .name = "PCI mem", |
35 | .start = 0UL, | 34 | .start = 0, |
36 | .end = ~0UL, | 35 | .end = -1, |
37 | .flags = IORESOURCE_MEM, | 36 | .flags = IORESOURCE_MEM, |
38 | }; | 37 | }; |
39 | |||
40 | EXPORT_SYMBOL(iomem_resource); | 38 | EXPORT_SYMBOL(iomem_resource); |
41 | 39 | ||
42 | static DEFINE_RWLOCK(resource_lock); | 40 | static DEFINE_RWLOCK(resource_lock); |
@@ -83,10 +81,10 @@ static int r_show(struct seq_file *m, void *v) | |||
83 | for (depth = 0, p = r; depth < MAX_IORES_LEVEL; depth++, p = p->parent) | 81 | for (depth = 0, p = r; depth < MAX_IORES_LEVEL; depth++, p = p->parent) |
84 | if (p->parent == root) | 82 | if (p->parent == root) |
85 | break; | 83 | break; |
86 | seq_printf(m, "%*s%0*lx-%0*lx : %s\n", | 84 | seq_printf(m, "%*s%0*llx-%0*llx : %s\n", |
87 | depth * 2, "", | 85 | depth * 2, "", |
88 | width, r->start, | 86 | width, (unsigned long long) r->start, |
89 | width, r->end, | 87 | width, (unsigned long long) r->end, |
90 | r->name ? r->name : "<BAD>"); | 88 | r->name ? r->name : "<BAD>"); |
91 | return 0; | 89 | return 0; |
92 | } | 90 | } |
@@ -151,8 +149,8 @@ __initcall(ioresources_init); | |||
151 | /* Return the conflict entry if you can't request it */ | 149 | /* Return the conflict entry if you can't request it */ |
152 | static struct resource * __request_resource(struct resource *root, struct resource *new) | 150 | static struct resource * __request_resource(struct resource *root, struct resource *new) |
153 | { | 151 | { |
154 | unsigned long start = new->start; | 152 | resource_size_t start = new->start; |
155 | unsigned long end = new->end; | 153 | resource_size_t end = new->end; |
156 | struct resource *tmp, **p; | 154 | struct resource *tmp, **p; |
157 | 155 | ||
158 | if (end < start) | 156 | if (end < start) |
@@ -274,11 +272,10 @@ int find_next_system_ram(struct resource *res) | |||
274 | * Find empty slot in the resource tree given range and alignment. | 272 | * Find empty slot in the resource tree given range and alignment. |
275 | */ | 273 | */ |
276 | static int find_resource(struct resource *root, struct resource *new, | 274 | static int find_resource(struct resource *root, struct resource *new, |
277 | unsigned long size, | 275 | resource_size_t size, resource_size_t min, |
278 | unsigned long min, unsigned long max, | 276 | resource_size_t max, resource_size_t align, |
279 | unsigned long align, | ||
280 | void (*alignf)(void *, struct resource *, | 277 | void (*alignf)(void *, struct resource *, |
281 | unsigned long, unsigned long), | 278 | resource_size_t, resource_size_t), |
282 | void *alignf_data) | 279 | void *alignf_data) |
283 | { | 280 | { |
284 | struct resource *this = root->child; | 281 | struct resource *this = root->child; |
@@ -320,11 +317,10 @@ static int find_resource(struct resource *root, struct resource *new, | |||
320 | * Allocate empty slot in the resource tree given range and alignment. | 317 | * Allocate empty slot in the resource tree given range and alignment. |
321 | */ | 318 | */ |
322 | int allocate_resource(struct resource *root, struct resource *new, | 319 | int allocate_resource(struct resource *root, struct resource *new, |
323 | unsigned long size, | 320 | resource_size_t size, resource_size_t min, |
324 | unsigned long min, unsigned long max, | 321 | resource_size_t max, resource_size_t align, |
325 | unsigned long align, | ||
326 | void (*alignf)(void *, struct resource *, | 322 | void (*alignf)(void *, struct resource *, |
327 | unsigned long, unsigned long), | 323 | resource_size_t, resource_size_t), |
328 | void *alignf_data) | 324 | void *alignf_data) |
329 | { | 325 | { |
330 | int err; | 326 | int err; |
@@ -416,10 +412,10 @@ EXPORT_SYMBOL(insert_resource); | |||
416 | * arguments. Returns -EBUSY if it can't fit. Existing children of | 412 | * arguments. Returns -EBUSY if it can't fit. Existing children of |
417 | * the resource are assumed to be immutable. | 413 | * the resource are assumed to be immutable. |
418 | */ | 414 | */ |
419 | int adjust_resource(struct resource *res, unsigned long start, unsigned long size) | 415 | int adjust_resource(struct resource *res, resource_size_t start, resource_size_t size) |
420 | { | 416 | { |
421 | struct resource *tmp, *parent = res->parent; | 417 | struct resource *tmp, *parent = res->parent; |
422 | unsigned long end = start + size - 1; | 418 | resource_size_t end = start + size - 1; |
423 | int result = -EBUSY; | 419 | int result = -EBUSY; |
424 | 420 | ||
425 | write_lock(&resource_lock); | 421 | write_lock(&resource_lock); |
@@ -466,7 +462,9 @@ EXPORT_SYMBOL(adjust_resource); | |||
466 | * | 462 | * |
467 | * Release-region releases a matching busy region. | 463 | * Release-region releases a matching busy region. |
468 | */ | 464 | */ |
469 | struct resource * __request_region(struct resource *parent, unsigned long start, unsigned long n, const char *name) | 465 | struct resource * __request_region(struct resource *parent, |
466 | resource_size_t start, resource_size_t n, | ||
467 | const char *name) | ||
470 | { | 468 | { |
471 | struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL); | 469 | struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL); |
472 | 470 | ||
@@ -502,7 +500,8 @@ struct resource * __request_region(struct resource *parent, unsigned long start, | |||
502 | 500 | ||
503 | EXPORT_SYMBOL(__request_region); | 501 | EXPORT_SYMBOL(__request_region); |
504 | 502 | ||
505 | int __check_region(struct resource *parent, unsigned long start, unsigned long n) | 503 | int __check_region(struct resource *parent, resource_size_t start, |
504 | resource_size_t n) | ||
506 | { | 505 | { |
507 | struct resource * res; | 506 | struct resource * res; |
508 | 507 | ||
@@ -517,10 +516,11 @@ int __check_region(struct resource *parent, unsigned long start, unsigned long n | |||
517 | 516 | ||
518 | EXPORT_SYMBOL(__check_region); | 517 | EXPORT_SYMBOL(__check_region); |
519 | 518 | ||
520 | void __release_region(struct resource *parent, unsigned long start, unsigned long n) | 519 | void __release_region(struct resource *parent, resource_size_t start, |
520 | resource_size_t n) | ||
521 | { | 521 | { |
522 | struct resource **p; | 522 | struct resource **p; |
523 | unsigned long end; | 523 | resource_size_t end; |
524 | 524 | ||
525 | p = &parent->child; | 525 | p = &parent->child; |
526 | end = start + n - 1; | 526 | end = start + n - 1; |
@@ -549,7 +549,9 @@ void __release_region(struct resource *parent, unsigned long start, unsigned lon | |||
549 | 549 | ||
550 | write_unlock(&resource_lock); | 550 | write_unlock(&resource_lock); |
551 | 551 | ||
552 | printk(KERN_WARNING "Trying to free nonexistent resource <%08lx-%08lx>\n", start, end); | 552 | printk(KERN_WARNING "Trying to free nonexistent resource " |
553 | "<%016llx-%016llx>\n", (unsigned long long)start, | ||
554 | (unsigned long long)end); | ||
553 | } | 555 | } |
554 | 556 | ||
555 | EXPORT_SYMBOL(__release_region); | 557 | EXPORT_SYMBOL(__release_region); |