diff options
author | Timur Tabi <timur@freescale.com> | 2007-05-08 15:46:36 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2007-05-10 00:01:43 -0400 |
commit | 4c35630ccda56ed494f6102d2e147fefe14b78d2 (patch) | |
tree | 4f04754fb0ec6978923b3c1e0318997e420f6551 | |
parent | 742226c579c573c24386aaf41969a01ee058b97e (diff) |
[POWERPC] Change rheap functions to use ulongs instead of pointers
The rheap allocation functions return a pointer, but the actual value is based
on how the heap was initialized, and so it can be anything, e.g. an offset
into a buffer. A ulong is a better representation of the value returned by
the allocation functions.
This patch changes all of the relevant rheap functions to use a unsigned long
integers instead of a pointer. In case of an error, the value returned is
a negative error code that has been cast to an unsigned long. The caller can
use the IS_ERR_VALUE() macro to check for this.
All code which calls the rheap functions is updated accordingly. Macros
IS_MURAM_ERR() and IS_DPERR(), have been deleted in favor of IS_ERR_VALUE().
Also added error checking to rh_attach_region().
Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/lib/rheap.c | 117 | ||||
-rw-r--r-- | arch/powerpc/sysdev/commproc.c | 20 | ||||
-rw-r--r-- | arch/powerpc/sysdev/cpm2_common.c | 21 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/qe.c | 29 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/ucc_fast.c | 5 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/ucc_slow.c | 7 | ||||
-rw-r--r-- | arch/ppc/8xx_io/commproc.c | 22 | ||||
-rw-r--r-- | arch/ppc/lib/rheap.c | 95 | ||||
-rw-r--r-- | arch/ppc/syslib/cpm2_common.c | 23 | ||||
-rw-r--r-- | drivers/net/fs_enet/mac-scc.c | 2 | ||||
-rw-r--r-- | drivers/net/ucc_geth.c | 30 | ||||
-rw-r--r-- | drivers/serial/cpm_uart/cpm_uart_cpm1.c | 4 | ||||
-rw-r--r-- | drivers/serial/cpm_uart/cpm_uart_cpm2.c | 4 | ||||
-rw-r--r-- | include/asm-powerpc/qe.h | 13 | ||||
-rw-r--r-- | include/asm-ppc/commproc.h | 13 | ||||
-rw-r--r-- | include/asm-ppc/cpm2.h | 13 | ||||
-rw-r--r-- | include/asm-ppc/rheap.h | 20 |
17 files changed, 221 insertions, 217 deletions
diff --git a/arch/powerpc/lib/rheap.c b/arch/powerpc/lib/rheap.c index 6c5c5dd183ee..b2f6dcc59600 100644 --- a/arch/powerpc/lib/rheap.c +++ b/arch/powerpc/lib/rheap.c | |||
@@ -133,7 +133,7 @@ static rh_block_t *get_slot(rh_info_t * info) | |||
133 | info->empty_slots--; | 133 | info->empty_slots--; |
134 | 134 | ||
135 | /* Initialize */ | 135 | /* Initialize */ |
136 | blk->start = NULL; | 136 | blk->start = 0; |
137 | blk->size = 0; | 137 | blk->size = 0; |
138 | blk->owner = NULL; | 138 | blk->owner = NULL; |
139 | 139 | ||
@@ -158,7 +158,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn) | |||
158 | 158 | ||
159 | /* We assume that they are aligned properly */ | 159 | /* We assume that they are aligned properly */ |
160 | size = blkn->size; | 160 | size = blkn->size; |
161 | s = (unsigned long)blkn->start; | 161 | s = blkn->start; |
162 | e = s + size; | 162 | e = s + size; |
163 | 163 | ||
164 | /* Find the blocks immediately before and after the given one | 164 | /* Find the blocks immediately before and after the given one |
@@ -170,7 +170,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn) | |||
170 | list_for_each(l, &info->free_list) { | 170 | list_for_each(l, &info->free_list) { |
171 | blk = list_entry(l, rh_block_t, list); | 171 | blk = list_entry(l, rh_block_t, list); |
172 | 172 | ||
173 | bs = (unsigned long)blk->start; | 173 | bs = blk->start; |
174 | be = bs + blk->size; | 174 | be = bs + blk->size; |
175 | 175 | ||
176 | if (next == NULL && s >= bs) | 176 | if (next == NULL && s >= bs) |
@@ -188,10 +188,10 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn) | |||
188 | } | 188 | } |
189 | 189 | ||
190 | /* Now check if they are really adjacent */ | 190 | /* Now check if they are really adjacent */ |
191 | if (before != NULL && s != (unsigned long)before->start + before->size) | 191 | if (before && s != (before->start + before->size)) |
192 | before = NULL; | 192 | before = NULL; |
193 | 193 | ||
194 | if (after != NULL && e != (unsigned long)after->start) | 194 | if (after && e != after->start) |
195 | after = NULL; | 195 | after = NULL; |
196 | 196 | ||
197 | /* No coalescing; list insert and return */ | 197 | /* No coalescing; list insert and return */ |
@@ -216,7 +216,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn) | |||
216 | 216 | ||
217 | /* Grow the after block backwards */ | 217 | /* Grow the after block backwards */ |
218 | if (before == NULL && after != NULL) { | 218 | if (before == NULL && after != NULL) { |
219 | after->start = (int8_t *)after->start - size; | 219 | after->start -= size; |
220 | after->size += size; | 220 | after->size += size; |
221 | return; | 221 | return; |
222 | } | 222 | } |
@@ -321,14 +321,14 @@ void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks, | |||
321 | } | 321 | } |
322 | 322 | ||
323 | /* Attach a free memory region, coalesces regions if adjuscent */ | 323 | /* Attach a free memory region, coalesces regions if adjuscent */ |
324 | int rh_attach_region(rh_info_t * info, void *start, int size) | 324 | int rh_attach_region(rh_info_t * info, unsigned long start, int size) |
325 | { | 325 | { |
326 | rh_block_t *blk; | 326 | rh_block_t *blk; |
327 | unsigned long s, e, m; | 327 | unsigned long s, e, m; |
328 | int r; | 328 | int r; |
329 | 329 | ||
330 | /* The region must be aligned */ | 330 | /* The region must be aligned */ |
331 | s = (unsigned long)start; | 331 | s = start; |
332 | e = s + size; | 332 | e = s + size; |
333 | m = info->alignment - 1; | 333 | m = info->alignment - 1; |
334 | 334 | ||
@@ -338,9 +338,12 @@ int rh_attach_region(rh_info_t * info, void *start, int size) | |||
338 | /* Round end down */ | 338 | /* Round end down */ |
339 | e = e & ~m; | 339 | e = e & ~m; |
340 | 340 | ||
341 | if (IS_ERR_VALUE(e) || (e < s)) | ||
342 | return -ERANGE; | ||
343 | |||
341 | /* Take final values */ | 344 | /* Take final values */ |
342 | start = (void *)s; | 345 | start = s; |
343 | size = (int)(e - s); | 346 | size = e - s; |
344 | 347 | ||
345 | /* Grow the blocks, if needed */ | 348 | /* Grow the blocks, if needed */ |
346 | r = assure_empty(info, 1); | 349 | r = assure_empty(info, 1); |
@@ -358,7 +361,7 @@ int rh_attach_region(rh_info_t * info, void *start, int size) | |||
358 | } | 361 | } |
359 | 362 | ||
360 | /* Detatch given address range, splits free block if needed. */ | 363 | /* Detatch given address range, splits free block if needed. */ |
361 | void *rh_detach_region(rh_info_t * info, void *start, int size) | 364 | unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size) |
362 | { | 365 | { |
363 | struct list_head *l; | 366 | struct list_head *l; |
364 | rh_block_t *blk, *newblk; | 367 | rh_block_t *blk, *newblk; |
@@ -366,10 +369,10 @@ void *rh_detach_region(rh_info_t * info, void *start, int size) | |||
366 | 369 | ||
367 | /* Validate size */ | 370 | /* Validate size */ |
368 | if (size <= 0) | 371 | if (size <= 0) |
369 | return ERR_PTR(-EINVAL); | 372 | return (unsigned long) -EINVAL; |
370 | 373 | ||
371 | /* The region must be aligned */ | 374 | /* The region must be aligned */ |
372 | s = (unsigned long)start; | 375 | s = start; |
373 | e = s + size; | 376 | e = s + size; |
374 | m = info->alignment - 1; | 377 | m = info->alignment - 1; |
375 | 378 | ||
@@ -380,34 +383,34 @@ void *rh_detach_region(rh_info_t * info, void *start, int size) | |||
380 | e = e & ~m; | 383 | e = e & ~m; |
381 | 384 | ||
382 | if (assure_empty(info, 1) < 0) | 385 | if (assure_empty(info, 1) < 0) |
383 | return ERR_PTR(-ENOMEM); | 386 | return (unsigned long) -ENOMEM; |
384 | 387 | ||
385 | blk = NULL; | 388 | blk = NULL; |
386 | list_for_each(l, &info->free_list) { | 389 | list_for_each(l, &info->free_list) { |
387 | blk = list_entry(l, rh_block_t, list); | 390 | blk = list_entry(l, rh_block_t, list); |
388 | /* The range must lie entirely inside one free block */ | 391 | /* The range must lie entirely inside one free block */ |
389 | bs = (unsigned long)blk->start; | 392 | bs = blk->start; |
390 | be = (unsigned long)blk->start + blk->size; | 393 | be = blk->start + blk->size; |
391 | if (s >= bs && e <= be) | 394 | if (s >= bs && e <= be) |
392 | break; | 395 | break; |
393 | blk = NULL; | 396 | blk = NULL; |
394 | } | 397 | } |
395 | 398 | ||
396 | if (blk == NULL) | 399 | if (blk == NULL) |
397 | return ERR_PTR(-ENOMEM); | 400 | return (unsigned long) -ENOMEM; |
398 | 401 | ||
399 | /* Perfect fit */ | 402 | /* Perfect fit */ |
400 | if (bs == s && be == e) { | 403 | if (bs == s && be == e) { |
401 | /* Delete from free list, release slot */ | 404 | /* Delete from free list, release slot */ |
402 | list_del(&blk->list); | 405 | list_del(&blk->list); |
403 | release_slot(info, blk); | 406 | release_slot(info, blk); |
404 | return (void *)s; | 407 | return s; |
405 | } | 408 | } |
406 | 409 | ||
407 | /* blk still in free list, with updated start and/or size */ | 410 | /* blk still in free list, with updated start and/or size */ |
408 | if (bs == s || be == e) { | 411 | if (bs == s || be == e) { |
409 | if (bs == s) | 412 | if (bs == s) |
410 | blk->start = (int8_t *)blk->start + size; | 413 | blk->start += size; |
411 | blk->size -= size; | 414 | blk->size -= size; |
412 | 415 | ||
413 | } else { | 416 | } else { |
@@ -416,25 +419,29 @@ void *rh_detach_region(rh_info_t * info, void *start, int size) | |||
416 | 419 | ||
417 | /* the back free fragment */ | 420 | /* the back free fragment */ |
418 | newblk = get_slot(info); | 421 | newblk = get_slot(info); |
419 | newblk->start = (void *)e; | 422 | newblk->start = e; |
420 | newblk->size = be - e; | 423 | newblk->size = be - e; |
421 | 424 | ||
422 | list_add(&newblk->list, &blk->list); | 425 | list_add(&newblk->list, &blk->list); |
423 | } | 426 | } |
424 | 427 | ||
425 | return (void *)s; | 428 | return s; |
426 | } | 429 | } |
427 | 430 | ||
428 | void *rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owner) | 431 | /* Allocate a block of memory at the specified alignment. The value returned |
432 | * is an offset into the buffer initialized by rh_init(), or a negative number | ||
433 | * if there is an error. | ||
434 | */ | ||
435 | unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owner) | ||
429 | { | 436 | { |
430 | struct list_head *l; | 437 | struct list_head *l; |
431 | rh_block_t *blk; | 438 | rh_block_t *blk; |
432 | rh_block_t *newblk; | 439 | rh_block_t *newblk; |
433 | void *start; | 440 | unsigned long start; |
434 | 441 | ||
435 | /* Validate size, (must be power of two) */ | 442 | /* Validate size, and alignment must be power of two */ |
436 | if (size <= 0 || (alignment & (alignment - 1)) != 0) | 443 | if (size <= 0 || (alignment & (alignment - 1)) != 0) |
437 | return ERR_PTR(-EINVAL); | 444 | return (unsigned long) -EINVAL; |
438 | 445 | ||
439 | /* given alignment larger that default rheap alignment */ | 446 | /* given alignment larger that default rheap alignment */ |
440 | if (alignment > info->alignment) | 447 | if (alignment > info->alignment) |
@@ -444,7 +451,7 @@ void *rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owne | |||
444 | size = (size + (info->alignment - 1)) & ~(info->alignment - 1); | 451 | size = (size + (info->alignment - 1)) & ~(info->alignment - 1); |
445 | 452 | ||
446 | if (assure_empty(info, 1) < 0) | 453 | if (assure_empty(info, 1) < 0) |
447 | return ERR_PTR(-ENOMEM); | 454 | return (unsigned long) -ENOMEM; |
448 | 455 | ||
449 | blk = NULL; | 456 | blk = NULL; |
450 | list_for_each(l, &info->free_list) { | 457 | list_for_each(l, &info->free_list) { |
@@ -455,7 +462,7 @@ void *rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owne | |||
455 | } | 462 | } |
456 | 463 | ||
457 | if (blk == NULL) | 464 | if (blk == NULL) |
458 | return ERR_PTR(-ENOMEM); | 465 | return (unsigned long) -ENOMEM; |
459 | 466 | ||
460 | /* Just fits */ | 467 | /* Just fits */ |
461 | if (blk->size == size) { | 468 | if (blk->size == size) { |
@@ -475,7 +482,7 @@ void *rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owne | |||
475 | newblk->owner = owner; | 482 | newblk->owner = owner; |
476 | 483 | ||
477 | /* blk still in free list, with updated start, size */ | 484 | /* blk still in free list, with updated start, size */ |
478 | blk->start = (int8_t *)blk->start + size; | 485 | blk->start += size; |
479 | blk->size -= size; | 486 | blk->size -= size; |
480 | 487 | ||
481 | start = newblk->start; | 488 | start = newblk->start; |
@@ -486,19 +493,25 @@ void *rh_alloc_align(rh_info_t * info, int size, int alignment, const char *owne | |||
486 | /* this is no problem with the deallocator since */ | 493 | /* this is no problem with the deallocator since */ |
487 | /* we scan for pointers that lie in the blocks */ | 494 | /* we scan for pointers that lie in the blocks */ |
488 | if (alignment > info->alignment) | 495 | if (alignment > info->alignment) |
489 | start = (void *)(((unsigned long)start + alignment - 1) & | 496 | start = (start + alignment - 1) & ~(alignment - 1); |
490 | ~(alignment - 1)); | ||
491 | 497 | ||
492 | return start; | 498 | return start; |
493 | } | 499 | } |
494 | 500 | ||
495 | void *rh_alloc(rh_info_t * info, int size, const char *owner) | 501 | /* Allocate a block of memory at the default alignment. The value returned is |
502 | * an offset into the buffer initialized by rh_init(), or a negative number if | ||
503 | * there is an error. | ||
504 | */ | ||
505 | unsigned long rh_alloc(rh_info_t * info, int size, const char *owner) | ||
496 | { | 506 | { |
497 | return rh_alloc_align(info, size, info->alignment, owner); | 507 | return rh_alloc_align(info, size, info->alignment, owner); |
498 | } | 508 | } |
499 | 509 | ||
500 | /* allocate at precisely the given address */ | 510 | /* Allocate a block of memory at the given offset, rounded up to the default |
501 | void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner) | 511 | * alignment. The value returned is an offset into the buffer initialized by |
512 | * rh_init(), or a negative number if there is an error. | ||
513 | */ | ||
514 | unsigned long rh_alloc_fixed(rh_info_t * info, unsigned long start, int size, const char *owner) | ||
502 | { | 515 | { |
503 | struct list_head *l; | 516 | struct list_head *l; |
504 | rh_block_t *blk, *newblk1, *newblk2; | 517 | rh_block_t *blk, *newblk1, *newblk2; |
@@ -506,10 +519,10 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner) | |||
506 | 519 | ||
507 | /* Validate size */ | 520 | /* Validate size */ |
508 | if (size <= 0) | 521 | if (size <= 0) |
509 | return ERR_PTR(-EINVAL); | 522 | return (unsigned long) -EINVAL; |
510 | 523 | ||
511 | /* The region must be aligned */ | 524 | /* The region must be aligned */ |
512 | s = (unsigned long)start; | 525 | s = start; |
513 | e = s + size; | 526 | e = s + size; |
514 | m = info->alignment - 1; | 527 | m = info->alignment - 1; |
515 | 528 | ||
@@ -520,20 +533,20 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner) | |||
520 | e = e & ~m; | 533 | e = e & ~m; |
521 | 534 | ||
522 | if (assure_empty(info, 2) < 0) | 535 | if (assure_empty(info, 2) < 0) |
523 | return ERR_PTR(-ENOMEM); | 536 | return (unsigned long) -ENOMEM; |
524 | 537 | ||
525 | blk = NULL; | 538 | blk = NULL; |
526 | list_for_each(l, &info->free_list) { | 539 | list_for_each(l, &info->free_list) { |
527 | blk = list_entry(l, rh_block_t, list); | 540 | blk = list_entry(l, rh_block_t, list); |
528 | /* The range must lie entirely inside one free block */ | 541 | /* The range must lie entirely inside one free block */ |
529 | bs = (unsigned long)blk->start; | 542 | bs = blk->start; |
530 | be = (unsigned long)blk->start + blk->size; | 543 | be = blk->start + blk->size; |
531 | if (s >= bs && e <= be) | 544 | if (s >= bs && e <= be) |
532 | break; | 545 | break; |
533 | } | 546 | } |
534 | 547 | ||
535 | if (blk == NULL) | 548 | if (blk == NULL) |
536 | return ERR_PTR(-ENOMEM); | 549 | return (unsigned long) -ENOMEM; |
537 | 550 | ||
538 | /* Perfect fit */ | 551 | /* Perfect fit */ |
539 | if (bs == s && be == e) { | 552 | if (bs == s && be == e) { |
@@ -551,7 +564,7 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner) | |||
551 | /* blk still in free list, with updated start and/or size */ | 564 | /* blk still in free list, with updated start and/or size */ |
552 | if (bs == s || be == e) { | 565 | if (bs == s || be == e) { |
553 | if (bs == s) | 566 | if (bs == s) |
554 | blk->start = (int8_t *)blk->start + size; | 567 | blk->start += size; |
555 | blk->size -= size; | 568 | blk->size -= size; |
556 | 569 | ||
557 | } else { | 570 | } else { |
@@ -560,14 +573,14 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner) | |||
560 | 573 | ||
561 | /* The back free fragment */ | 574 | /* The back free fragment */ |
562 | newblk2 = get_slot(info); | 575 | newblk2 = get_slot(info); |
563 | newblk2->start = (void *)e; | 576 | newblk2->start = e; |
564 | newblk2->size = be - e; | 577 | newblk2->size = be - e; |
565 | 578 | ||
566 | list_add(&newblk2->list, &blk->list); | 579 | list_add(&newblk2->list, &blk->list); |
567 | } | 580 | } |
568 | 581 | ||
569 | newblk1 = get_slot(info); | 582 | newblk1 = get_slot(info); |
570 | newblk1->start = (void *)s; | 583 | newblk1->start = s; |
571 | newblk1->size = e - s; | 584 | newblk1->size = e - s; |
572 | newblk1->owner = owner; | 585 | newblk1->owner = owner; |
573 | 586 | ||
@@ -577,7 +590,11 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner) | |||
577 | return start; | 590 | return start; |
578 | } | 591 | } |
579 | 592 | ||
580 | int rh_free(rh_info_t * info, void *start) | 593 | /* Deallocate the memory previously allocated by one of the rh_alloc functions. |
594 | * The return value is the size of the deallocated block, or a negative number | ||
595 | * if there is an error. | ||
596 | */ | ||
597 | int rh_free(rh_info_t * info, unsigned long start) | ||
581 | { | 598 | { |
582 | rh_block_t *blk, *blk2; | 599 | rh_block_t *blk, *blk2; |
583 | struct list_head *l; | 600 | struct list_head *l; |
@@ -642,7 +659,7 @@ int rh_get_stats(rh_info_t * info, int what, int max_stats, rh_stats_t * stats) | |||
642 | return nr; | 659 | return nr; |
643 | } | 660 | } |
644 | 661 | ||
645 | int rh_set_owner(rh_info_t * info, void *start, const char *owner) | 662 | int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner) |
646 | { | 663 | { |
647 | rh_block_t *blk, *blk2; | 664 | rh_block_t *blk, *blk2; |
648 | struct list_head *l; | 665 | struct list_head *l; |
@@ -684,8 +701,8 @@ void rh_dump(rh_info_t * info) | |||
684 | nr = maxnr; | 701 | nr = maxnr; |
685 | for (i = 0; i < nr; i++) | 702 | for (i = 0; i < nr; i++) |
686 | printk(KERN_INFO | 703 | printk(KERN_INFO |
687 | " 0x%p-0x%p (%u)\n", | 704 | " 0x%lx-0x%lx (%u)\n", |
688 | st[i].start, (int8_t *) st[i].start + st[i].size, | 705 | st[i].start, st[i].start + st[i].size, |
689 | st[i].size); | 706 | st[i].size); |
690 | printk(KERN_INFO "\n"); | 707 | printk(KERN_INFO "\n"); |
691 | 708 | ||
@@ -695,8 +712,8 @@ void rh_dump(rh_info_t * info) | |||
695 | nr = maxnr; | 712 | nr = maxnr; |
696 | for (i = 0; i < nr; i++) | 713 | for (i = 0; i < nr; i++) |
697 | printk(KERN_INFO | 714 | printk(KERN_INFO |
698 | " 0x%p-0x%p (%u) %s\n", | 715 | " 0x%lx-0x%lx (%u) %s\n", |
699 | st[i].start, (int8_t *) st[i].start + st[i].size, | 716 | st[i].start, st[i].start + st[i].size, |
700 | st[i].size, st[i].owner != NULL ? st[i].owner : ""); | 717 | st[i].size, st[i].owner != NULL ? st[i].owner : ""); |
701 | printk(KERN_INFO "\n"); | 718 | printk(KERN_INFO "\n"); |
702 | } | 719 | } |
@@ -704,6 +721,6 @@ void rh_dump(rh_info_t * info) | |||
704 | void rh_dump_blk(rh_info_t * info, rh_block_t * blk) | 721 | void rh_dump_blk(rh_info_t * info, rh_block_t * blk) |
705 | { | 722 | { |
706 | printk(KERN_INFO | 723 | printk(KERN_INFO |
707 | "blk @0x%p: 0x%p-0x%p (%u)\n", | 724 | "blk @0x%p: 0x%lx-0x%lx (%u)\n", |
708 | blk, blk->start, (int8_t *) blk->start + blk->size, blk->size); | 725 | blk, blk->start, blk->start + blk->size, blk->size); |
709 | } | 726 | } |
diff --git a/arch/powerpc/sysdev/commproc.c b/arch/powerpc/sysdev/commproc.c index 9b4fafd9a840..4f67b89ba1d0 100644 --- a/arch/powerpc/sysdev/commproc.c +++ b/arch/powerpc/sysdev/commproc.c | |||
@@ -330,7 +330,7 @@ void m8xx_cpm_dpinit(void) | |||
330 | * with the processor and the microcode patches applied / activated. | 330 | * with the processor and the microcode patches applied / activated. |
331 | * But the following should be at least safe. | 331 | * But the following should be at least safe. |
332 | */ | 332 | */ |
333 | rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE); | 333 | rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE); |
334 | } | 334 | } |
335 | 335 | ||
336 | /* | 336 | /* |
@@ -338,9 +338,9 @@ void m8xx_cpm_dpinit(void) | |||
338 | * This function returns an offset into the DPRAM area. | 338 | * This function returns an offset into the DPRAM area. |
339 | * Use cpm_dpram_addr() to get the virtual address of the area. | 339 | * Use cpm_dpram_addr() to get the virtual address of the area. |
340 | */ | 340 | */ |
341 | uint cpm_dpalloc(uint size, uint align) | 341 | unsigned long cpm_dpalloc(uint size, uint align) |
342 | { | 342 | { |
343 | void *start; | 343 | unsigned long start; |
344 | unsigned long flags; | 344 | unsigned long flags; |
345 | 345 | ||
346 | spin_lock_irqsave(&cpm_dpmem_lock, flags); | 346 | spin_lock_irqsave(&cpm_dpmem_lock, flags); |
@@ -352,30 +352,30 @@ uint cpm_dpalloc(uint size, uint align) | |||
352 | } | 352 | } |
353 | EXPORT_SYMBOL(cpm_dpalloc); | 353 | EXPORT_SYMBOL(cpm_dpalloc); |
354 | 354 | ||
355 | int cpm_dpfree(uint offset) | 355 | int cpm_dpfree(unsigned long offset) |
356 | { | 356 | { |
357 | int ret; | 357 | int ret; |
358 | unsigned long flags; | 358 | unsigned long flags; |
359 | 359 | ||
360 | spin_lock_irqsave(&cpm_dpmem_lock, flags); | 360 | spin_lock_irqsave(&cpm_dpmem_lock, flags); |
361 | ret = rh_free(&cpm_dpmem_info, (void *)offset); | 361 | ret = rh_free(&cpm_dpmem_info, offset); |
362 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); | 362 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); |
363 | 363 | ||
364 | return ret; | 364 | return ret; |
365 | } | 365 | } |
366 | EXPORT_SYMBOL(cpm_dpfree); | 366 | EXPORT_SYMBOL(cpm_dpfree); |
367 | 367 | ||
368 | uint cpm_dpalloc_fixed(uint offset, uint size, uint align) | 368 | unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align) |
369 | { | 369 | { |
370 | void *start; | 370 | unsigned long start; |
371 | unsigned long flags; | 371 | unsigned long flags; |
372 | 372 | ||
373 | spin_lock_irqsave(&cpm_dpmem_lock, flags); | 373 | spin_lock_irqsave(&cpm_dpmem_lock, flags); |
374 | cpm_dpmem_info.alignment = align; | 374 | cpm_dpmem_info.alignment = align; |
375 | start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc"); | 375 | start = rh_alloc_fixed(&cpm_dpmem_info, offset, size, "commproc"); |
376 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); | 376 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); |
377 | 377 | ||
378 | return (uint)start; | 378 | return start; |
379 | } | 379 | } |
380 | EXPORT_SYMBOL(cpm_dpalloc_fixed); | 380 | EXPORT_SYMBOL(cpm_dpalloc_fixed); |
381 | 381 | ||
@@ -385,7 +385,7 @@ void cpm_dpdump(void) | |||
385 | } | 385 | } |
386 | EXPORT_SYMBOL(cpm_dpdump); | 386 | EXPORT_SYMBOL(cpm_dpdump); |
387 | 387 | ||
388 | void *cpm_dpram_addr(uint offset) | 388 | void *cpm_dpram_addr(unsigned long offset) |
389 | { | 389 | { |
390 | return (void *)(dpram_vbase + offset); | 390 | return (void *)(dpram_vbase + offset); |
391 | } | 391 | } |
diff --git a/arch/powerpc/sysdev/cpm2_common.c b/arch/powerpc/sysdev/cpm2_common.c index ec265995d5d8..924412974795 100644 --- a/arch/powerpc/sysdev/cpm2_common.c +++ b/arch/powerpc/sysdev/cpm2_common.c | |||
@@ -248,15 +248,14 @@ static void cpm2_dpinit(void) | |||
248 | * varies with the processor and the microcode patches activated. | 248 | * varies with the processor and the microcode patches activated. |
249 | * But the following should be at least safe. | 249 | * But the following should be at least safe. |
250 | */ | 250 | */ |
251 | rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE, | 251 | rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE); |
252 | CPM_DATAONLY_SIZE); | ||
253 | } | 252 | } |
254 | 253 | ||
255 | /* This function returns an index into the DPRAM area. | 254 | /* This function returns an index into the DPRAM area. |
256 | */ | 255 | */ |
257 | uint cpm_dpalloc(uint size, uint align) | 256 | unsigned long cpm_dpalloc(uint size, uint align) |
258 | { | 257 | { |
259 | void *start; | 258 | unsigned long start; |
260 | unsigned long flags; | 259 | unsigned long flags; |
261 | 260 | ||
262 | spin_lock_irqsave(&cpm_dpmem_lock, flags); | 261 | spin_lock_irqsave(&cpm_dpmem_lock, flags); |
@@ -268,13 +267,13 @@ uint cpm_dpalloc(uint size, uint align) | |||
268 | } | 267 | } |
269 | EXPORT_SYMBOL(cpm_dpalloc); | 268 | EXPORT_SYMBOL(cpm_dpalloc); |
270 | 269 | ||
271 | int cpm_dpfree(uint offset) | 270 | int cpm_dpfree(unsigned long offset) |
272 | { | 271 | { |
273 | int ret; | 272 | int ret; |
274 | unsigned long flags; | 273 | unsigned long flags; |
275 | 274 | ||
276 | spin_lock_irqsave(&cpm_dpmem_lock, flags); | 275 | spin_lock_irqsave(&cpm_dpmem_lock, flags); |
277 | ret = rh_free(&cpm_dpmem_info, (void *)offset); | 276 | ret = rh_free(&cpm_dpmem_info, offset); |
278 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); | 277 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); |
279 | 278 | ||
280 | return ret; | 279 | return ret; |
@@ -282,17 +281,17 @@ int cpm_dpfree(uint offset) | |||
282 | EXPORT_SYMBOL(cpm_dpfree); | 281 | EXPORT_SYMBOL(cpm_dpfree); |
283 | 282 | ||
284 | /* not sure if this is ever needed */ | 283 | /* not sure if this is ever needed */ |
285 | uint cpm_dpalloc_fixed(uint offset, uint size, uint align) | 284 | unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align) |
286 | { | 285 | { |
287 | void *start; | 286 | unsigned long start; |
288 | unsigned long flags; | 287 | unsigned long flags; |
289 | 288 | ||
290 | spin_lock_irqsave(&cpm_dpmem_lock, flags); | 289 | spin_lock_irqsave(&cpm_dpmem_lock, flags); |
291 | cpm_dpmem_info.alignment = align; | 290 | cpm_dpmem_info.alignment = align; |
292 | start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc"); | 291 | start = rh_alloc_fixed(&cpm_dpmem_info, offset, size, "commproc"); |
293 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); | 292 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); |
294 | 293 | ||
295 | return (uint)start; | 294 | return start; |
296 | } | 295 | } |
297 | EXPORT_SYMBOL(cpm_dpalloc_fixed); | 296 | EXPORT_SYMBOL(cpm_dpalloc_fixed); |
298 | 297 | ||
@@ -302,7 +301,7 @@ void cpm_dpdump(void) | |||
302 | } | 301 | } |
303 | EXPORT_SYMBOL(cpm_dpdump); | 302 | EXPORT_SYMBOL(cpm_dpdump); |
304 | 303 | ||
305 | void *cpm_dpram_addr(uint offset) | 304 | void *cpm_dpram_addr(unsigned long offset) |
306 | { | 305 | { |
307 | return (void *)(im_dprambase + offset); | 306 | return (void *)(im_dprambase + offset); |
308 | } | 307 | } |
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c index 7f4c07543961..90f87408b5d5 100644 --- a/arch/powerpc/sysdev/qe_lib/qe.c +++ b/arch/powerpc/sysdev/qe_lib/qe.c | |||
@@ -244,7 +244,7 @@ EXPORT_SYMBOL(qe_put_snum); | |||
244 | static int qe_sdma_init(void) | 244 | static int qe_sdma_init(void) |
245 | { | 245 | { |
246 | struct sdma *sdma = &qe_immr->sdma; | 246 | struct sdma *sdma = &qe_immr->sdma; |
247 | u32 sdma_buf_offset; | 247 | unsigned long sdma_buf_offset; |
248 | 248 | ||
249 | if (!sdma) | 249 | if (!sdma) |
250 | return -ENODEV; | 250 | return -ENODEV; |
@@ -252,10 +252,10 @@ static int qe_sdma_init(void) | |||
252 | /* allocate 2 internal temporary buffers (512 bytes size each) for | 252 | /* allocate 2 internal temporary buffers (512 bytes size each) for |
253 | * the SDMA */ | 253 | * the SDMA */ |
254 | sdma_buf_offset = qe_muram_alloc(512 * 2, 4096); | 254 | sdma_buf_offset = qe_muram_alloc(512 * 2, 4096); |
255 | if (IS_MURAM_ERR(sdma_buf_offset)) | 255 | if (IS_ERR_VALUE(sdma_buf_offset)) |
256 | return -ENOMEM; | 256 | return -ENOMEM; |
257 | 257 | ||
258 | out_be32(&sdma->sdebcr, sdma_buf_offset & QE_SDEBCR_BA_MASK); | 258 | out_be32(&sdma->sdebcr, (u32) sdma_buf_offset & QE_SDEBCR_BA_MASK); |
259 | out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK | | 259 | out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK | |
260 | (0x1 << QE_SDMR_CEN_SHIFT))); | 260 | (0x1 << QE_SDMR_CEN_SHIFT))); |
261 | 261 | ||
@@ -291,33 +291,32 @@ static void qe_muram_init(void) | |||
291 | if ((np = of_find_node_by_name(NULL, "data-only")) != NULL) { | 291 | if ((np = of_find_node_by_name(NULL, "data-only")) != NULL) { |
292 | address = *of_get_address(np, 0, &size, &flags); | 292 | address = *of_get_address(np, 0, &size, &flags); |
293 | of_node_put(np); | 293 | of_node_put(np); |
294 | rh_attach_region(&qe_muram_info, | 294 | rh_attach_region(&qe_muram_info, address, (int) size); |
295 | (void *)address, (int)size); | ||
296 | } | 295 | } |
297 | } | 296 | } |
298 | 297 | ||
299 | /* This function returns an index into the MURAM area. | 298 | /* This function returns an index into the MURAM area. |
300 | */ | 299 | */ |
301 | u32 qe_muram_alloc(u32 size, u32 align) | 300 | unsigned long qe_muram_alloc(int size, int align) |
302 | { | 301 | { |
303 | void *start; | 302 | unsigned long start; |
304 | unsigned long flags; | 303 | unsigned long flags; |
305 | 304 | ||
306 | spin_lock_irqsave(&qe_muram_lock, flags); | 305 | spin_lock_irqsave(&qe_muram_lock, flags); |
307 | start = rh_alloc_align(&qe_muram_info, size, align, "QE"); | 306 | start = rh_alloc_align(&qe_muram_info, size, align, "QE"); |
308 | spin_unlock_irqrestore(&qe_muram_lock, flags); | 307 | spin_unlock_irqrestore(&qe_muram_lock, flags); |
309 | 308 | ||
310 | return (u32) start; | 309 | return start; |
311 | } | 310 | } |
312 | EXPORT_SYMBOL(qe_muram_alloc); | 311 | EXPORT_SYMBOL(qe_muram_alloc); |
313 | 312 | ||
314 | int qe_muram_free(u32 offset) | 313 | int qe_muram_free(unsigned long offset) |
315 | { | 314 | { |
316 | int ret; | 315 | int ret; |
317 | unsigned long flags; | 316 | unsigned long flags; |
318 | 317 | ||
319 | spin_lock_irqsave(&qe_muram_lock, flags); | 318 | spin_lock_irqsave(&qe_muram_lock, flags); |
320 | ret = rh_free(&qe_muram_info, (void *)offset); | 319 | ret = rh_free(&qe_muram_info, offset); |
321 | spin_unlock_irqrestore(&qe_muram_lock, flags); | 320 | spin_unlock_irqrestore(&qe_muram_lock, flags); |
322 | 321 | ||
323 | return ret; | 322 | return ret; |
@@ -325,16 +324,16 @@ int qe_muram_free(u32 offset) | |||
325 | EXPORT_SYMBOL(qe_muram_free); | 324 | EXPORT_SYMBOL(qe_muram_free); |
326 | 325 | ||
327 | /* not sure if this is ever needed */ | 326 | /* not sure if this is ever needed */ |
328 | u32 qe_muram_alloc_fixed(u32 offset, u32 size) | 327 | unsigned long qe_muram_alloc_fixed(unsigned long offset, int size) |
329 | { | 328 | { |
330 | void *start; | 329 | unsigned long start; |
331 | unsigned long flags; | 330 | unsigned long flags; |
332 | 331 | ||
333 | spin_lock_irqsave(&qe_muram_lock, flags); | 332 | spin_lock_irqsave(&qe_muram_lock, flags); |
334 | start = rh_alloc_fixed(&qe_muram_info, (void *)offset, size, "commproc"); | 333 | start = rh_alloc_fixed(&qe_muram_info, offset, size, "commproc"); |
335 | spin_unlock_irqrestore(&qe_muram_lock, flags); | 334 | spin_unlock_irqrestore(&qe_muram_lock, flags); |
336 | 335 | ||
337 | return (u32) start; | 336 | return start; |
338 | } | 337 | } |
339 | EXPORT_SYMBOL(qe_muram_alloc_fixed); | 338 | EXPORT_SYMBOL(qe_muram_alloc_fixed); |
340 | 339 | ||
@@ -344,7 +343,7 @@ void qe_muram_dump(void) | |||
344 | } | 343 | } |
345 | EXPORT_SYMBOL(qe_muram_dump); | 344 | EXPORT_SYMBOL(qe_muram_dump); |
346 | 345 | ||
347 | void *qe_muram_addr(u32 offset) | 346 | void *qe_muram_addr(unsigned long offset) |
348 | { | 347 | { |
349 | return (void *)&qe_immr->muram[offset]; | 348 | return (void *)&qe_immr->muram[offset]; |
350 | } | 349 | } |
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_fast.c b/arch/powerpc/sysdev/qe_lib/ucc_fast.c index 66137bf2dfb0..9143236853fc 100644 --- a/arch/powerpc/sysdev/qe_lib/ucc_fast.c +++ b/arch/powerpc/sysdev/qe_lib/ucc_fast.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/stddef.h> | 19 | #include <linux/stddef.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/err.h> | ||
21 | 22 | ||
22 | #include <asm/io.h> | 23 | #include <asm/io.h> |
23 | #include <asm/immap_qe.h> | 24 | #include <asm/immap_qe.h> |
@@ -268,7 +269,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc | |||
268 | /* Allocate memory for Tx Virtual Fifo */ | 269 | /* Allocate memory for Tx Virtual Fifo */ |
269 | uccf->ucc_fast_tx_virtual_fifo_base_offset = | 270 | uccf->ucc_fast_tx_virtual_fifo_base_offset = |
270 | qe_muram_alloc(uf_info->utfs, UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT); | 271 | qe_muram_alloc(uf_info->utfs, UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT); |
271 | if (IS_MURAM_ERR(uccf->ucc_fast_tx_virtual_fifo_base_offset)) { | 272 | if (IS_ERR_VALUE(uccf->ucc_fast_tx_virtual_fifo_base_offset)) { |
272 | printk(KERN_ERR "%s: cannot allocate MURAM for TX FIFO", __FUNCTION__); | 273 | printk(KERN_ERR "%s: cannot allocate MURAM for TX FIFO", __FUNCTION__); |
273 | uccf->ucc_fast_tx_virtual_fifo_base_offset = 0; | 274 | uccf->ucc_fast_tx_virtual_fifo_base_offset = 0; |
274 | ucc_fast_free(uccf); | 275 | ucc_fast_free(uccf); |
@@ -280,7 +281,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc | |||
280 | qe_muram_alloc(uf_info->urfs + | 281 | qe_muram_alloc(uf_info->urfs + |
281 | UCC_FAST_RECEIVE_VIRTUAL_FIFO_SIZE_FUDGE_FACTOR, | 282 | UCC_FAST_RECEIVE_VIRTUAL_FIFO_SIZE_FUDGE_FACTOR, |
282 | UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT); | 283 | UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT); |
283 | if (IS_MURAM_ERR(uccf->ucc_fast_rx_virtual_fifo_base_offset)) { | 284 | if (IS_ERR_VALUE(uccf->ucc_fast_rx_virtual_fifo_base_offset)) { |
284 | printk(KERN_ERR "%s: cannot allocate MURAM for RX FIFO", __FUNCTION__); | 285 | printk(KERN_ERR "%s: cannot allocate MURAM for RX FIFO", __FUNCTION__); |
285 | uccf->ucc_fast_rx_virtual_fifo_base_offset = 0; | 286 | uccf->ucc_fast_rx_virtual_fifo_base_offset = 0; |
286 | ucc_fast_free(uccf); | 287 | ucc_fast_free(uccf); |
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_slow.c b/arch/powerpc/sysdev/qe_lib/ucc_slow.c index b930d686a4d1..1f65c26ce63f 100644 --- a/arch/powerpc/sysdev/qe_lib/ucc_slow.c +++ b/arch/powerpc/sysdev/qe_lib/ucc_slow.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/stddef.h> | 19 | #include <linux/stddef.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/err.h> | ||
21 | 22 | ||
22 | #include <asm/io.h> | 23 | #include <asm/io.h> |
23 | #include <asm/immap_qe.h> | 24 | #include <asm/immap_qe.h> |
@@ -175,7 +176,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc | |||
175 | /* Get PRAM base */ | 176 | /* Get PRAM base */ |
176 | uccs->us_pram_offset = | 177 | uccs->us_pram_offset = |
177 | qe_muram_alloc(UCC_SLOW_PRAM_SIZE, ALIGNMENT_OF_UCC_SLOW_PRAM); | 178 | qe_muram_alloc(UCC_SLOW_PRAM_SIZE, ALIGNMENT_OF_UCC_SLOW_PRAM); |
178 | if (IS_MURAM_ERR(uccs->us_pram_offset)) { | 179 | if (IS_ERR_VALUE(uccs->us_pram_offset)) { |
179 | printk(KERN_ERR "%s: cannot allocate MURAM for PRAM", __FUNCTION__); | 180 | printk(KERN_ERR "%s: cannot allocate MURAM for PRAM", __FUNCTION__); |
180 | ucc_slow_free(uccs); | 181 | ucc_slow_free(uccs); |
181 | return -ENOMEM; | 182 | return -ENOMEM; |
@@ -210,7 +211,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc | |||
210 | uccs->rx_base_offset = | 211 | uccs->rx_base_offset = |
211 | qe_muram_alloc(us_info->rx_bd_ring_len * sizeof(struct qe_bd), | 212 | qe_muram_alloc(us_info->rx_bd_ring_len * sizeof(struct qe_bd), |
212 | QE_ALIGNMENT_OF_BD); | 213 | QE_ALIGNMENT_OF_BD); |
213 | if (IS_MURAM_ERR(uccs->rx_base_offset)) { | 214 | if (IS_ERR_VALUE(uccs->rx_base_offset)) { |
214 | printk(KERN_ERR "%s: cannot allocate RX BDs", __FUNCTION__); | 215 | printk(KERN_ERR "%s: cannot allocate RX BDs", __FUNCTION__); |
215 | uccs->rx_base_offset = 0; | 216 | uccs->rx_base_offset = 0; |
216 | ucc_slow_free(uccs); | 217 | ucc_slow_free(uccs); |
@@ -220,7 +221,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc | |||
220 | uccs->tx_base_offset = | 221 | uccs->tx_base_offset = |
221 | qe_muram_alloc(us_info->tx_bd_ring_len * sizeof(struct qe_bd), | 222 | qe_muram_alloc(us_info->tx_bd_ring_len * sizeof(struct qe_bd), |
222 | QE_ALIGNMENT_OF_BD); | 223 | QE_ALIGNMENT_OF_BD); |
223 | if (IS_MURAM_ERR(uccs->tx_base_offset)) { | 224 | if (IS_ERR_VALUE(uccs->tx_base_offset)) { |
224 | printk(KERN_ERR "%s: cannot allocate TX BDs", __FUNCTION__); | 225 | printk(KERN_ERR "%s: cannot allocate TX BDs", __FUNCTION__); |
225 | uccs->tx_base_offset = 0; | 226 | uccs->tx_base_offset = 0; |
226 | ucc_slow_free(uccs); | 227 | ucc_slow_free(uccs); |
diff --git a/arch/ppc/8xx_io/commproc.c b/arch/ppc/8xx_io/commproc.c index 7a8722beac12..e2c6210f234b 100644 --- a/arch/ppc/8xx_io/commproc.c +++ b/arch/ppc/8xx_io/commproc.c | |||
@@ -402,7 +402,7 @@ void m8xx_cpm_dpinit(void) | |||
402 | * with the processor and the microcode patches applied / activated. | 402 | * with the processor and the microcode patches applied / activated. |
403 | * But the following should be at least safe. | 403 | * But the following should be at least safe. |
404 | */ | 404 | */ |
405 | rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE); | 405 | rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE); |
406 | } | 406 | } |
407 | 407 | ||
408 | /* | 408 | /* |
@@ -410,9 +410,9 @@ void m8xx_cpm_dpinit(void) | |||
410 | * This function returns an offset into the DPRAM area. | 410 | * This function returns an offset into the DPRAM area. |
411 | * Use cpm_dpram_addr() to get the virtual address of the area. | 411 | * Use cpm_dpram_addr() to get the virtual address of the area. |
412 | */ | 412 | */ |
413 | uint cpm_dpalloc(uint size, uint align) | 413 | unsigned long cpm_dpalloc(uint size, uint align) |
414 | { | 414 | { |
415 | void *start; | 415 | unsigned long start; |
416 | unsigned long flags; | 416 | unsigned long flags; |
417 | 417 | ||
418 | spin_lock_irqsave(&cpm_dpmem_lock, flags); | 418 | spin_lock_irqsave(&cpm_dpmem_lock, flags); |
@@ -420,34 +420,34 @@ uint cpm_dpalloc(uint size, uint align) | |||
420 | start = rh_alloc(&cpm_dpmem_info, size, "commproc"); | 420 | start = rh_alloc(&cpm_dpmem_info, size, "commproc"); |
421 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); | 421 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); |
422 | 422 | ||
423 | return (uint)start; | 423 | return start; |
424 | } | 424 | } |
425 | EXPORT_SYMBOL(cpm_dpalloc); | 425 | EXPORT_SYMBOL(cpm_dpalloc); |
426 | 426 | ||
427 | int cpm_dpfree(uint offset) | 427 | int cpm_dpfree(unsigned long offset) |
428 | { | 428 | { |
429 | int ret; | 429 | int ret; |
430 | unsigned long flags; | 430 | unsigned long flags; |
431 | 431 | ||
432 | spin_lock_irqsave(&cpm_dpmem_lock, flags); | 432 | spin_lock_irqsave(&cpm_dpmem_lock, flags); |
433 | ret = rh_free(&cpm_dpmem_info, (void *)offset); | 433 | ret = rh_free(&cpm_dpmem_info, offset); |
434 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); | 434 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); |
435 | 435 | ||
436 | return ret; | 436 | return ret; |
437 | } | 437 | } |
438 | EXPORT_SYMBOL(cpm_dpfree); | 438 | EXPORT_SYMBOL(cpm_dpfree); |
439 | 439 | ||
440 | uint cpm_dpalloc_fixed(uint offset, uint size, uint align) | 440 | unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align) |
441 | { | 441 | { |
442 | void *start; | 442 | unsigned long start; |
443 | unsigned long flags; | 443 | unsigned long flags; |
444 | 444 | ||
445 | spin_lock_irqsave(&cpm_dpmem_lock, flags); | 445 | spin_lock_irqsave(&cpm_dpmem_lock, flags); |
446 | cpm_dpmem_info.alignment = align; | 446 | cpm_dpmem_info.alignment = align; |
447 | start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc"); | 447 | start = rh_alloc_fixed(&cpm_dpmem_info, offset, size, "commproc"); |
448 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); | 448 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); |
449 | 449 | ||
450 | return (uint)start; | 450 | return start; |
451 | } | 451 | } |
452 | EXPORT_SYMBOL(cpm_dpalloc_fixed); | 452 | EXPORT_SYMBOL(cpm_dpalloc_fixed); |
453 | 453 | ||
@@ -457,7 +457,7 @@ void cpm_dpdump(void) | |||
457 | } | 457 | } |
458 | EXPORT_SYMBOL(cpm_dpdump); | 458 | EXPORT_SYMBOL(cpm_dpdump); |
459 | 459 | ||
460 | void *cpm_dpram_addr(uint offset) | 460 | void *cpm_dpram_addr(unsigned long offset) |
461 | { | 461 | { |
462 | return ((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem + offset; | 462 | return ((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem + offset; |
463 | } | 463 | } |
diff --git a/arch/ppc/lib/rheap.c b/arch/ppc/lib/rheap.c index d40700795a9c..9dc2f3458ded 100644 --- a/arch/ppc/lib/rheap.c +++ b/arch/ppc/lib/rheap.c | |||
@@ -132,7 +132,7 @@ static rh_block_t *get_slot(rh_info_t * info) | |||
132 | info->empty_slots--; | 132 | info->empty_slots--; |
133 | 133 | ||
134 | /* Initialize */ | 134 | /* Initialize */ |
135 | blk->start = NULL; | 135 | blk->start = 0; |
136 | blk->size = 0; | 136 | blk->size = 0; |
137 | blk->owner = NULL; | 137 | blk->owner = NULL; |
138 | 138 | ||
@@ -157,7 +157,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn) | |||
157 | 157 | ||
158 | /* We assume that they are aligned properly */ | 158 | /* We assume that they are aligned properly */ |
159 | size = blkn->size; | 159 | size = blkn->size; |
160 | s = (unsigned long)blkn->start; | 160 | s = blkn->start; |
161 | e = s + size; | 161 | e = s + size; |
162 | 162 | ||
163 | /* Find the blocks immediately before and after the given one | 163 | /* Find the blocks immediately before and after the given one |
@@ -169,7 +169,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn) | |||
169 | list_for_each(l, &info->free_list) { | 169 | list_for_each(l, &info->free_list) { |
170 | blk = list_entry(l, rh_block_t, list); | 170 | blk = list_entry(l, rh_block_t, list); |
171 | 171 | ||
172 | bs = (unsigned long)blk->start; | 172 | bs = blk->start; |
173 | be = bs + blk->size; | 173 | be = bs + blk->size; |
174 | 174 | ||
175 | if (next == NULL && s >= bs) | 175 | if (next == NULL && s >= bs) |
@@ -187,10 +187,10 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn) | |||
187 | } | 187 | } |
188 | 188 | ||
189 | /* Now check if they are really adjacent */ | 189 | /* Now check if they are really adjacent */ |
190 | if (before != NULL && s != (unsigned long)before->start + before->size) | 190 | if (before && s != (before->start + before->size)) |
191 | before = NULL; | 191 | before = NULL; |
192 | 192 | ||
193 | if (after != NULL && e != (unsigned long)after->start) | 193 | if (after && e != after->start) |
194 | after = NULL; | 194 | after = NULL; |
195 | 195 | ||
196 | /* No coalescing; list insert and return */ | 196 | /* No coalescing; list insert and return */ |
@@ -215,7 +215,7 @@ static void attach_free_block(rh_info_t * info, rh_block_t * blkn) | |||
215 | 215 | ||
216 | /* Grow the after block backwards */ | 216 | /* Grow the after block backwards */ |
217 | if (before == NULL && after != NULL) { | 217 | if (before == NULL && after != NULL) { |
218 | after->start = (int8_t *)after->start - size; | 218 | after->start -= size; |
219 | after->size += size; | 219 | after->size += size; |
220 | return; | 220 | return; |
221 | } | 221 | } |
@@ -320,14 +320,14 @@ void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks, | |||
320 | } | 320 | } |
321 | 321 | ||
322 | /* Attach a free memory region, coalesces regions if adjuscent */ | 322 | /* Attach a free memory region, coalesces regions if adjuscent */ |
323 | int rh_attach_region(rh_info_t * info, void *start, int size) | 323 | int rh_attach_region(rh_info_t * info, unsigned long start, int size) |
324 | { | 324 | { |
325 | rh_block_t *blk; | 325 | rh_block_t *blk; |
326 | unsigned long s, e, m; | 326 | unsigned long s, e, m; |
327 | int r; | 327 | int r; |
328 | 328 | ||
329 | /* The region must be aligned */ | 329 | /* The region must be aligned */ |
330 | s = (unsigned long)start; | 330 | s = start; |
331 | e = s + size; | 331 | e = s + size; |
332 | m = info->alignment - 1; | 332 | m = info->alignment - 1; |
333 | 333 | ||
@@ -337,9 +337,12 @@ int rh_attach_region(rh_info_t * info, void *start, int size) | |||
337 | /* Round end down */ | 337 | /* Round end down */ |
338 | e = e & ~m; | 338 | e = e & ~m; |
339 | 339 | ||
340 | if (IS_ERR_VALUE(e) || (e < s)) | ||
341 | return -ERANGE; | ||
342 | |||
340 | /* Take final values */ | 343 | /* Take final values */ |
341 | start = (void *)s; | 344 | start = s; |
342 | size = (int)(e - s); | 345 | size = e - s; |
343 | 346 | ||
344 | /* Grow the blocks, if needed */ | 347 | /* Grow the blocks, if needed */ |
345 | r = assure_empty(info, 1); | 348 | r = assure_empty(info, 1); |
@@ -357,7 +360,7 @@ int rh_attach_region(rh_info_t * info, void *start, int size) | |||
357 | } | 360 | } |
358 | 361 | ||
359 | /* Detatch given address range, splits free block if needed. */ | 362 | /* Detatch given address range, splits free block if needed. */ |
360 | void *rh_detach_region(rh_info_t * info, void *start, int size) | 363 | unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size) |
361 | { | 364 | { |
362 | struct list_head *l; | 365 | struct list_head *l; |
363 | rh_block_t *blk, *newblk; | 366 | rh_block_t *blk, *newblk; |
@@ -365,10 +368,10 @@ void *rh_detach_region(rh_info_t * info, void *start, int size) | |||
365 | 368 | ||
366 | /* Validate size */ | 369 | /* Validate size */ |
367 | if (size <= 0) | 370 | if (size <= 0) |
368 | return ERR_PTR(-EINVAL); | 371 | return (unsigned long) -EINVAL; |
369 | 372 | ||
370 | /* The region must be aligned */ | 373 | /* The region must be aligned */ |
371 | s = (unsigned long)start; | 374 | s = start; |
372 | e = s + size; | 375 | e = s + size; |
373 | m = info->alignment - 1; | 376 | m = info->alignment - 1; |
374 | 377 | ||
@@ -379,34 +382,34 @@ void *rh_detach_region(rh_info_t * info, void *start, int size) | |||
379 | e = e & ~m; | 382 | e = e & ~m; |
380 | 383 | ||
381 | if (assure_empty(info, 1) < 0) | 384 | if (assure_empty(info, 1) < 0) |
382 | return ERR_PTR(-ENOMEM); | 385 | return (unsigned long) -ENOMEM; |
383 | 386 | ||
384 | blk = NULL; | 387 | blk = NULL; |
385 | list_for_each(l, &info->free_list) { | 388 | list_for_each(l, &info->free_list) { |
386 | blk = list_entry(l, rh_block_t, list); | 389 | blk = list_entry(l, rh_block_t, list); |
387 | /* The range must lie entirely inside one free block */ | 390 | /* The range must lie entirely inside one free block */ |
388 | bs = (unsigned long)blk->start; | 391 | bs = blk->start; |
389 | be = (unsigned long)blk->start + blk->size; | 392 | be = blk->start + blk->size; |
390 | if (s >= bs && e <= be) | 393 | if (s >= bs && e <= be) |
391 | break; | 394 | break; |
392 | blk = NULL; | 395 | blk = NULL; |
393 | } | 396 | } |
394 | 397 | ||
395 | if (blk == NULL) | 398 | if (blk == NULL) |
396 | return ERR_PTR(-ENOMEM); | 399 | return (unsigned long) -ENOMEM; |
397 | 400 | ||
398 | /* Perfect fit */ | 401 | /* Perfect fit */ |
399 | if (bs == s && be == e) { | 402 | if (bs == s && be == e) { |
400 | /* Delete from free list, release slot */ | 403 | /* Delete from free list, release slot */ |
401 | list_del(&blk->list); | 404 | list_del(&blk->list); |
402 | release_slot(info, blk); | 405 | release_slot(info, blk); |
403 | return (void *)s; | 406 | return s; |
404 | } | 407 | } |
405 | 408 | ||
406 | /* blk still in free list, with updated start and/or size */ | 409 | /* blk still in free list, with updated start and/or size */ |
407 | if (bs == s || be == e) { | 410 | if (bs == s || be == e) { |
408 | if (bs == s) | 411 | if (bs == s) |
409 | blk->start = (int8_t *)blk->start + size; | 412 | blk->start += size; |
410 | blk->size -= size; | 413 | blk->size -= size; |
411 | 414 | ||
412 | } else { | 415 | } else { |
@@ -415,31 +418,31 @@ void *rh_detach_region(rh_info_t * info, void *start, int size) | |||
415 | 418 | ||
416 | /* the back free fragment */ | 419 | /* the back free fragment */ |
417 | newblk = get_slot(info); | 420 | newblk = get_slot(info); |
418 | newblk->start = (void *)e; | 421 | newblk->start = e; |
419 | newblk->size = be - e; | 422 | newblk->size = be - e; |
420 | 423 | ||
421 | list_add(&newblk->list, &blk->list); | 424 | list_add(&newblk->list, &blk->list); |
422 | } | 425 | } |
423 | 426 | ||
424 | return (void *)s; | 427 | return s; |
425 | } | 428 | } |
426 | 429 | ||
427 | void *rh_alloc(rh_info_t * info, int size, const char *owner) | 430 | unsigned long rh_alloc(rh_info_t * info, int size, const char *owner) |
428 | { | 431 | { |
429 | struct list_head *l; | 432 | struct list_head *l; |
430 | rh_block_t *blk; | 433 | rh_block_t *blk; |
431 | rh_block_t *newblk; | 434 | rh_block_t *newblk; |
432 | void *start; | 435 | unsigned long start; |
433 | 436 | ||
434 | /* Validate size */ | 437 | /* Validate size */ |
435 | if (size <= 0) | 438 | if (size <= 0) |
436 | return ERR_PTR(-EINVAL); | 439 | return (unsigned long) -EINVAL; |
437 | 440 | ||
438 | /* Align to configured alignment */ | 441 | /* Align to configured alignment */ |
439 | size = (size + (info->alignment - 1)) & ~(info->alignment - 1); | 442 | size = (size + (info->alignment - 1)) & ~(info->alignment - 1); |
440 | 443 | ||
441 | if (assure_empty(info, 1) < 0) | 444 | if (assure_empty(info, 1) < 0) |
442 | return ERR_PTR(-ENOMEM); | 445 | return (unsigned long) -ENOMEM; |
443 | 446 | ||
444 | blk = NULL; | 447 | blk = NULL; |
445 | list_for_each(l, &info->free_list) { | 448 | list_for_each(l, &info->free_list) { |
@@ -450,7 +453,7 @@ void *rh_alloc(rh_info_t * info, int size, const char *owner) | |||
450 | } | 453 | } |
451 | 454 | ||
452 | if (blk == NULL) | 455 | if (blk == NULL) |
453 | return ERR_PTR(-ENOMEM); | 456 | return (unsigned long) -ENOMEM; |
454 | 457 | ||
455 | /* Just fits */ | 458 | /* Just fits */ |
456 | if (blk->size == size) { | 459 | if (blk->size == size) { |
@@ -470,7 +473,7 @@ void *rh_alloc(rh_info_t * info, int size, const char *owner) | |||
470 | newblk->owner = owner; | 473 | newblk->owner = owner; |
471 | 474 | ||
472 | /* blk still in free list, with updated start, size */ | 475 | /* blk still in free list, with updated start, size */ |
473 | blk->start = (int8_t *)blk->start + size; | 476 | blk->start += size; |
474 | blk->size -= size; | 477 | blk->size -= size; |
475 | 478 | ||
476 | start = newblk->start; | 479 | start = newblk->start; |
@@ -481,18 +484,18 @@ void *rh_alloc(rh_info_t * info, int size, const char *owner) | |||
481 | } | 484 | } |
482 | 485 | ||
483 | /* allocate at precisely the given address */ | 486 | /* allocate at precisely the given address */ |
484 | void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner) | 487 | unsigned long rh_alloc_fixed(rh_info_t * info, unsigned long start, int size, const char *owner) |
485 | { | 488 | { |
486 | struct list_head *l; | 489 | struct list_head *l; |
487 | rh_block_t *blk, *newblk1, *newblk2; | 490 | rh_block_t *blk, *newblk1, *newblk2; |
488 | unsigned long s, e, m, bs, be; | 491 | unsigned long s, e, m, bs=0, be=0; |
489 | 492 | ||
490 | /* Validate size */ | 493 | /* Validate size */ |
491 | if (size <= 0) | 494 | if (size <= 0) |
492 | return ERR_PTR(-EINVAL); | 495 | return (unsigned long) -EINVAL; |
493 | 496 | ||
494 | /* The region must be aligned */ | 497 | /* The region must be aligned */ |
495 | s = (unsigned long)start; | 498 | s = start; |
496 | e = s + size; | 499 | e = s + size; |
497 | m = info->alignment - 1; | 500 | m = info->alignment - 1; |
498 | 501 | ||
@@ -503,20 +506,20 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner) | |||
503 | e = e & ~m; | 506 | e = e & ~m; |
504 | 507 | ||
505 | if (assure_empty(info, 2) < 0) | 508 | if (assure_empty(info, 2) < 0) |
506 | return ERR_PTR(-ENOMEM); | 509 | return (unsigned long) -ENOMEM; |
507 | 510 | ||
508 | blk = NULL; | 511 | blk = NULL; |
509 | list_for_each(l, &info->free_list) { | 512 | list_for_each(l, &info->free_list) { |
510 | blk = list_entry(l, rh_block_t, list); | 513 | blk = list_entry(l, rh_block_t, list); |
511 | /* The range must lie entirely inside one free block */ | 514 | /* The range must lie entirely inside one free block */ |
512 | bs = (unsigned long)blk->start; | 515 | bs = blk->start; |
513 | be = (unsigned long)blk->start + blk->size; | 516 | be = blk->start + blk->size; |
514 | if (s >= bs && e <= be) | 517 | if (s >= bs && e <= be) |
515 | break; | 518 | break; |
516 | } | 519 | } |
517 | 520 | ||
518 | if (blk == NULL) | 521 | if (blk == NULL) |
519 | return ERR_PTR(-ENOMEM); | 522 | return (unsigned long) -ENOMEM; |
520 | 523 | ||
521 | /* Perfect fit */ | 524 | /* Perfect fit */ |
522 | if (bs == s && be == e) { | 525 | if (bs == s && be == e) { |
@@ -534,7 +537,7 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner) | |||
534 | /* blk still in free list, with updated start and/or size */ | 537 | /* blk still in free list, with updated start and/or size */ |
535 | if (bs == s || be == e) { | 538 | if (bs == s || be == e) { |
536 | if (bs == s) | 539 | if (bs == s) |
537 | blk->start = (int8_t *)blk->start + size; | 540 | blk->start += size; |
538 | blk->size -= size; | 541 | blk->size -= size; |
539 | 542 | ||
540 | } else { | 543 | } else { |
@@ -543,14 +546,14 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner) | |||
543 | 546 | ||
544 | /* The back free fragment */ | 547 | /* The back free fragment */ |
545 | newblk2 = get_slot(info); | 548 | newblk2 = get_slot(info); |
546 | newblk2->start = (void *)e; | 549 | newblk2->start = e; |
547 | newblk2->size = be - e; | 550 | newblk2->size = be - e; |
548 | 551 | ||
549 | list_add(&newblk2->list, &blk->list); | 552 | list_add(&newblk2->list, &blk->list); |
550 | } | 553 | } |
551 | 554 | ||
552 | newblk1 = get_slot(info); | 555 | newblk1 = get_slot(info); |
553 | newblk1->start = (void *)s; | 556 | newblk1->start = s; |
554 | newblk1->size = e - s; | 557 | newblk1->size = e - s; |
555 | newblk1->owner = owner; | 558 | newblk1->owner = owner; |
556 | 559 | ||
@@ -560,7 +563,7 @@ void *rh_alloc_fixed(rh_info_t * info, void *start, int size, const char *owner) | |||
560 | return start; | 563 | return start; |
561 | } | 564 | } |
562 | 565 | ||
563 | int rh_free(rh_info_t * info, void *start) | 566 | int rh_free(rh_info_t * info, unsigned long start) |
564 | { | 567 | { |
565 | rh_block_t *blk, *blk2; | 568 | rh_block_t *blk, *blk2; |
566 | struct list_head *l; | 569 | struct list_head *l; |
@@ -625,7 +628,7 @@ int rh_get_stats(rh_info_t * info, int what, int max_stats, rh_stats_t * stats) | |||
625 | return nr; | 628 | return nr; |
626 | } | 629 | } |
627 | 630 | ||
628 | int rh_set_owner(rh_info_t * info, void *start, const char *owner) | 631 | int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner) |
629 | { | 632 | { |
630 | rh_block_t *blk, *blk2; | 633 | rh_block_t *blk, *blk2; |
631 | struct list_head *l; | 634 | struct list_head *l; |
@@ -667,8 +670,8 @@ void rh_dump(rh_info_t * info) | |||
667 | nr = maxnr; | 670 | nr = maxnr; |
668 | for (i = 0; i < nr; i++) | 671 | for (i = 0; i < nr; i++) |
669 | printk(KERN_INFO | 672 | printk(KERN_INFO |
670 | " 0x%p-0x%p (%u)\n", | 673 | " 0x%lx-0x%lx (%u)\n", |
671 | st[i].start, (int8_t *) st[i].start + st[i].size, | 674 | st[i].start, st[i].start + st[i].size, |
672 | st[i].size); | 675 | st[i].size); |
673 | printk(KERN_INFO "\n"); | 676 | printk(KERN_INFO "\n"); |
674 | 677 | ||
@@ -678,8 +681,8 @@ void rh_dump(rh_info_t * info) | |||
678 | nr = maxnr; | 681 | nr = maxnr; |
679 | for (i = 0; i < nr; i++) | 682 | for (i = 0; i < nr; i++) |
680 | printk(KERN_INFO | 683 | printk(KERN_INFO |
681 | " 0x%p-0x%p (%u) %s\n", | 684 | " 0x%lx-0x%lx (%u) %s\n", |
682 | st[i].start, (int8_t *) st[i].start + st[i].size, | 685 | st[i].start, st[i].start + st[i].size, |
683 | st[i].size, st[i].owner != NULL ? st[i].owner : ""); | 686 | st[i].size, st[i].owner != NULL ? st[i].owner : ""); |
684 | printk(KERN_INFO "\n"); | 687 | printk(KERN_INFO "\n"); |
685 | } | 688 | } |
@@ -687,6 +690,6 @@ void rh_dump(rh_info_t * info) | |||
687 | void rh_dump_blk(rh_info_t * info, rh_block_t * blk) | 690 | void rh_dump_blk(rh_info_t * info, rh_block_t * blk) |
688 | { | 691 | { |
689 | printk(KERN_INFO | 692 | printk(KERN_INFO |
690 | "blk @0x%p: 0x%p-0x%p (%u)\n", | 693 | "blk @0x%p: 0x%lx-0x%lx (%u)\n", |
691 | blk, blk->start, (int8_t *) blk->start + blk->size, blk->size); | 694 | blk, blk->start, blk->start + blk->size, blk->size); |
692 | } | 695 | } |
diff --git a/arch/ppc/syslib/cpm2_common.c b/arch/ppc/syslib/cpm2_common.c index cbac44b1620c..6cd859d7721f 100644 --- a/arch/ppc/syslib/cpm2_common.c +++ b/arch/ppc/syslib/cpm2_common.c | |||
@@ -136,15 +136,14 @@ static void cpm2_dpinit(void) | |||
136 | * varies with the processor and the microcode patches activated. | 136 | * varies with the processor and the microcode patches activated. |
137 | * But the following should be at least safe. | 137 | * But the following should be at least safe. |
138 | */ | 138 | */ |
139 | rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE, | 139 | rh_attach_region(&cpm_dpmem_info, CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE); |
140 | CPM_DATAONLY_SIZE); | ||
141 | } | 140 | } |
142 | 141 | ||
143 | /* This function returns an index into the DPRAM area. | 142 | /* This function returns an index into the DPRAM area. |
144 | */ | 143 | */ |
145 | uint cpm_dpalloc(uint size, uint align) | 144 | unsigned long cpm_dpalloc(uint size, uint align) |
146 | { | 145 | { |
147 | void *start; | 146 | unsigned long start; |
148 | unsigned long flags; | 147 | unsigned long flags; |
149 | 148 | ||
150 | spin_lock_irqsave(&cpm_dpmem_lock, flags); | 149 | spin_lock_irqsave(&cpm_dpmem_lock, flags); |
@@ -152,17 +151,17 @@ uint cpm_dpalloc(uint size, uint align) | |||
152 | start = rh_alloc(&cpm_dpmem_info, size, "commproc"); | 151 | start = rh_alloc(&cpm_dpmem_info, size, "commproc"); |
153 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); | 152 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); |
154 | 153 | ||
155 | return (uint)start; | 154 | return start; |
156 | } | 155 | } |
157 | EXPORT_SYMBOL(cpm_dpalloc); | 156 | EXPORT_SYMBOL(cpm_dpalloc); |
158 | 157 | ||
159 | int cpm_dpfree(uint offset) | 158 | int cpm_dpfree(unsigned long offset) |
160 | { | 159 | { |
161 | int ret; | 160 | int ret; |
162 | unsigned long flags; | 161 | unsigned long flags; |
163 | 162 | ||
164 | spin_lock_irqsave(&cpm_dpmem_lock, flags); | 163 | spin_lock_irqsave(&cpm_dpmem_lock, flags); |
165 | ret = rh_free(&cpm_dpmem_info, (void *)offset); | 164 | ret = rh_free(&cpm_dpmem_info, offset); |
166 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); | 165 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); |
167 | 166 | ||
168 | return ret; | 167 | return ret; |
@@ -170,17 +169,17 @@ int cpm_dpfree(uint offset) | |||
170 | EXPORT_SYMBOL(cpm_dpfree); | 169 | EXPORT_SYMBOL(cpm_dpfree); |
171 | 170 | ||
172 | /* not sure if this is ever needed */ | 171 | /* not sure if this is ever needed */ |
173 | uint cpm_dpalloc_fixed(uint offset, uint size, uint align) | 172 | unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align) |
174 | { | 173 | { |
175 | void *start; | 174 | unsigned long start; |
176 | unsigned long flags; | 175 | unsigned long flags; |
177 | 176 | ||
178 | spin_lock_irqsave(&cpm_dpmem_lock, flags); | 177 | spin_lock_irqsave(&cpm_dpmem_lock, flags); |
179 | cpm_dpmem_info.alignment = align; | 178 | cpm_dpmem_info.alignment = align; |
180 | start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc"); | 179 | start = rh_alloc_fixed(&cpm_dpmem_info, offset, size, "commproc"); |
181 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); | 180 | spin_unlock_irqrestore(&cpm_dpmem_lock, flags); |
182 | 181 | ||
183 | return (uint)start; | 182 | return start; |
184 | } | 183 | } |
185 | EXPORT_SYMBOL(cpm_dpalloc_fixed); | 184 | EXPORT_SYMBOL(cpm_dpalloc_fixed); |
186 | 185 | ||
@@ -190,7 +189,7 @@ void cpm_dpdump(void) | |||
190 | } | 189 | } |
191 | EXPORT_SYMBOL(cpm_dpdump); | 190 | EXPORT_SYMBOL(cpm_dpdump); |
192 | 191 | ||
193 | void *cpm_dpram_addr(uint offset) | 192 | void *cpm_dpram_addr(unsigned long offset) |
194 | { | 193 | { |
195 | return (void *)&cpm2_immr->im_dprambase[offset]; | 194 | return (void *)&cpm2_immr->im_dprambase[offset]; |
196 | } | 195 | } |
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c index d0f28981b55a..7540966687ec 100644 --- a/drivers/net/fs_enet/mac-scc.c +++ b/drivers/net/fs_enet/mac-scc.c | |||
@@ -167,7 +167,7 @@ static int allocate_bd(struct net_device *dev) | |||
167 | 167 | ||
168 | fep->ring_mem_addr = cpm_dpalloc((fpi->tx_ring + fpi->rx_ring) * | 168 | fep->ring_mem_addr = cpm_dpalloc((fpi->tx_ring + fpi->rx_ring) * |
169 | sizeof(cbd_t), 8); | 169 | sizeof(cbd_t), 8); |
170 | if (IS_DPERR(fep->ring_mem_addr)) | 170 | if (IS_ERR_VALUE(fep->ring_mem_addr)) |
171 | return -ENOMEM; | 171 | return -ENOMEM; |
172 | 172 | ||
173 | fep->ring_base = cpm_dpram_addr(fep->ring_mem_addr); | 173 | fep->ring_base = cpm_dpram_addr(fep->ring_mem_addr); |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index d7aff8189377..0f667652fda9 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
@@ -293,7 +293,7 @@ static int fill_init_enet_entries(struct ucc_geth_private *ugeth, | |||
293 | else { | 293 | else { |
294 | init_enet_offset = | 294 | init_enet_offset = |
295 | qe_muram_alloc(thread_size, thread_alignment); | 295 | qe_muram_alloc(thread_size, thread_alignment); |
296 | if (IS_MURAM_ERR(init_enet_offset)) { | 296 | if (IS_ERR_VALUE(init_enet_offset)) { |
297 | ugeth_err | 297 | ugeth_err |
298 | ("fill_init_enet_entries: Can not allocate DPRAM memory."); | 298 | ("fill_init_enet_entries: Can not allocate DPRAM memory."); |
299 | qe_put_snum((u8) snum); | 299 | qe_put_snum((u8) snum); |
@@ -2594,7 +2594,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2594 | ugeth->tx_bd_ring_offset[j] = | 2594 | ugeth->tx_bd_ring_offset[j] = |
2595 | qe_muram_alloc(length, | 2595 | qe_muram_alloc(length, |
2596 | UCC_GETH_TX_BD_RING_ALIGNMENT); | 2596 | UCC_GETH_TX_BD_RING_ALIGNMENT); |
2597 | if (!IS_MURAM_ERR(ugeth->tx_bd_ring_offset[j])) | 2597 | if (!IS_ERR_VALUE(ugeth->tx_bd_ring_offset[j])) |
2598 | ugeth->p_tx_bd_ring[j] = | 2598 | ugeth->p_tx_bd_ring[j] = |
2599 | (u8 *) qe_muram_addr(ugeth-> | 2599 | (u8 *) qe_muram_addr(ugeth-> |
2600 | tx_bd_ring_offset[j]); | 2600 | tx_bd_ring_offset[j]); |
@@ -2629,7 +2629,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2629 | ugeth->rx_bd_ring_offset[j] = | 2629 | ugeth->rx_bd_ring_offset[j] = |
2630 | qe_muram_alloc(length, | 2630 | qe_muram_alloc(length, |
2631 | UCC_GETH_RX_BD_RING_ALIGNMENT); | 2631 | UCC_GETH_RX_BD_RING_ALIGNMENT); |
2632 | if (!IS_MURAM_ERR(ugeth->rx_bd_ring_offset[j])) | 2632 | if (!IS_ERR_VALUE(ugeth->rx_bd_ring_offset[j])) |
2633 | ugeth->p_rx_bd_ring[j] = | 2633 | ugeth->p_rx_bd_ring[j] = |
2634 | (u8 *) qe_muram_addr(ugeth-> | 2634 | (u8 *) qe_muram_addr(ugeth-> |
2635 | rx_bd_ring_offset[j]); | 2635 | rx_bd_ring_offset[j]); |
@@ -2713,7 +2713,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2713 | ugeth->tx_glbl_pram_offset = | 2713 | ugeth->tx_glbl_pram_offset = |
2714 | qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram), | 2714 | qe_muram_alloc(sizeof(struct ucc_geth_tx_global_pram), |
2715 | UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT); | 2715 | UCC_GETH_TX_GLOBAL_PRAM_ALIGNMENT); |
2716 | if (IS_MURAM_ERR(ugeth->tx_glbl_pram_offset)) { | 2716 | if (IS_ERR_VALUE(ugeth->tx_glbl_pram_offset)) { |
2717 | ugeth_err | 2717 | ugeth_err |
2718 | ("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.", | 2718 | ("%s: Can not allocate DPRAM memory for p_tx_glbl_pram.", |
2719 | __FUNCTION__); | 2719 | __FUNCTION__); |
@@ -2735,7 +2735,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2735 | sizeof(struct ucc_geth_thread_data_tx) + | 2735 | sizeof(struct ucc_geth_thread_data_tx) + |
2736 | 32 * (numThreadsTxNumerical == 1), | 2736 | 32 * (numThreadsTxNumerical == 1), |
2737 | UCC_GETH_THREAD_DATA_ALIGNMENT); | 2737 | UCC_GETH_THREAD_DATA_ALIGNMENT); |
2738 | if (IS_MURAM_ERR(ugeth->thread_dat_tx_offset)) { | 2738 | if (IS_ERR_VALUE(ugeth->thread_dat_tx_offset)) { |
2739 | ugeth_err | 2739 | ugeth_err |
2740 | ("%s: Can not allocate DPRAM memory for p_thread_data_tx.", | 2740 | ("%s: Can not allocate DPRAM memory for p_thread_data_tx.", |
2741 | __FUNCTION__); | 2741 | __FUNCTION__); |
@@ -2763,7 +2763,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2763 | qe_muram_alloc(ug_info->numQueuesTx * | 2763 | qe_muram_alloc(ug_info->numQueuesTx * |
2764 | sizeof(struct ucc_geth_send_queue_qd), | 2764 | sizeof(struct ucc_geth_send_queue_qd), |
2765 | UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT); | 2765 | UCC_GETH_SEND_QUEUE_QUEUE_DESCRIPTOR_ALIGNMENT); |
2766 | if (IS_MURAM_ERR(ugeth->send_q_mem_reg_offset)) { | 2766 | if (IS_ERR_VALUE(ugeth->send_q_mem_reg_offset)) { |
2767 | ugeth_err | 2767 | ugeth_err |
2768 | ("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.", | 2768 | ("%s: Can not allocate DPRAM memory for p_send_q_mem_reg.", |
2769 | __FUNCTION__); | 2769 | __FUNCTION__); |
@@ -2806,7 +2806,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2806 | ugeth->scheduler_offset = | 2806 | ugeth->scheduler_offset = |
2807 | qe_muram_alloc(sizeof(struct ucc_geth_scheduler), | 2807 | qe_muram_alloc(sizeof(struct ucc_geth_scheduler), |
2808 | UCC_GETH_SCHEDULER_ALIGNMENT); | 2808 | UCC_GETH_SCHEDULER_ALIGNMENT); |
2809 | if (IS_MURAM_ERR(ugeth->scheduler_offset)) { | 2809 | if (IS_ERR_VALUE(ugeth->scheduler_offset)) { |
2810 | ugeth_err | 2810 | ugeth_err |
2811 | ("%s: Can not allocate DPRAM memory for p_scheduler.", | 2811 | ("%s: Can not allocate DPRAM memory for p_scheduler.", |
2812 | __FUNCTION__); | 2812 | __FUNCTION__); |
@@ -2854,7 +2854,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2854 | qe_muram_alloc(sizeof | 2854 | qe_muram_alloc(sizeof |
2855 | (struct ucc_geth_tx_firmware_statistics_pram), | 2855 | (struct ucc_geth_tx_firmware_statistics_pram), |
2856 | UCC_GETH_TX_STATISTICS_ALIGNMENT); | 2856 | UCC_GETH_TX_STATISTICS_ALIGNMENT); |
2857 | if (IS_MURAM_ERR(ugeth->tx_fw_statistics_pram_offset)) { | 2857 | if (IS_ERR_VALUE(ugeth->tx_fw_statistics_pram_offset)) { |
2858 | ugeth_err | 2858 | ugeth_err |
2859 | ("%s: Can not allocate DPRAM memory for" | 2859 | ("%s: Can not allocate DPRAM memory for" |
2860 | " p_tx_fw_statistics_pram.", __FUNCTION__); | 2860 | " p_tx_fw_statistics_pram.", __FUNCTION__); |
@@ -2893,7 +2893,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2893 | ugeth->rx_glbl_pram_offset = | 2893 | ugeth->rx_glbl_pram_offset = |
2894 | qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram), | 2894 | qe_muram_alloc(sizeof(struct ucc_geth_rx_global_pram), |
2895 | UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT); | 2895 | UCC_GETH_RX_GLOBAL_PRAM_ALIGNMENT); |
2896 | if (IS_MURAM_ERR(ugeth->rx_glbl_pram_offset)) { | 2896 | if (IS_ERR_VALUE(ugeth->rx_glbl_pram_offset)) { |
2897 | ugeth_err | 2897 | ugeth_err |
2898 | ("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.", | 2898 | ("%s: Can not allocate DPRAM memory for p_rx_glbl_pram.", |
2899 | __FUNCTION__); | 2899 | __FUNCTION__); |
@@ -2914,7 +2914,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2914 | qe_muram_alloc(numThreadsRxNumerical * | 2914 | qe_muram_alloc(numThreadsRxNumerical * |
2915 | sizeof(struct ucc_geth_thread_data_rx), | 2915 | sizeof(struct ucc_geth_thread_data_rx), |
2916 | UCC_GETH_THREAD_DATA_ALIGNMENT); | 2916 | UCC_GETH_THREAD_DATA_ALIGNMENT); |
2917 | if (IS_MURAM_ERR(ugeth->thread_dat_rx_offset)) { | 2917 | if (IS_ERR_VALUE(ugeth->thread_dat_rx_offset)) { |
2918 | ugeth_err | 2918 | ugeth_err |
2919 | ("%s: Can not allocate DPRAM memory for p_thread_data_rx.", | 2919 | ("%s: Can not allocate DPRAM memory for p_thread_data_rx.", |
2920 | __FUNCTION__); | 2920 | __FUNCTION__); |
@@ -2937,7 +2937,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2937 | qe_muram_alloc(sizeof | 2937 | qe_muram_alloc(sizeof |
2938 | (struct ucc_geth_rx_firmware_statistics_pram), | 2938 | (struct ucc_geth_rx_firmware_statistics_pram), |
2939 | UCC_GETH_RX_STATISTICS_ALIGNMENT); | 2939 | UCC_GETH_RX_STATISTICS_ALIGNMENT); |
2940 | if (IS_MURAM_ERR(ugeth->rx_fw_statistics_pram_offset)) { | 2940 | if (IS_ERR_VALUE(ugeth->rx_fw_statistics_pram_offset)) { |
2941 | ugeth_err | 2941 | ugeth_err |
2942 | ("%s: Can not allocate DPRAM memory for" | 2942 | ("%s: Can not allocate DPRAM memory for" |
2943 | " p_rx_fw_statistics_pram.", __FUNCTION__); | 2943 | " p_rx_fw_statistics_pram.", __FUNCTION__); |
@@ -2959,7 +2959,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
2959 | qe_muram_alloc(ug_info->numQueuesRx * | 2959 | qe_muram_alloc(ug_info->numQueuesRx * |
2960 | sizeof(struct ucc_geth_rx_interrupt_coalescing_entry) | 2960 | sizeof(struct ucc_geth_rx_interrupt_coalescing_entry) |
2961 | + 4, UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT); | 2961 | + 4, UCC_GETH_RX_INTERRUPT_COALESCING_ALIGNMENT); |
2962 | if (IS_MURAM_ERR(ugeth->rx_irq_coalescing_tbl_offset)) { | 2962 | if (IS_ERR_VALUE(ugeth->rx_irq_coalescing_tbl_offset)) { |
2963 | ugeth_err | 2963 | ugeth_err |
2964 | ("%s: Can not allocate DPRAM memory for" | 2964 | ("%s: Can not allocate DPRAM memory for" |
2965 | " p_rx_irq_coalescing_tbl.", __FUNCTION__); | 2965 | " p_rx_irq_coalescing_tbl.", __FUNCTION__); |
@@ -3027,7 +3027,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3027 | (sizeof(struct ucc_geth_rx_bd_queues_entry) + | 3027 | (sizeof(struct ucc_geth_rx_bd_queues_entry) + |
3028 | sizeof(struct ucc_geth_rx_prefetched_bds)), | 3028 | sizeof(struct ucc_geth_rx_prefetched_bds)), |
3029 | UCC_GETH_RX_BD_QUEUES_ALIGNMENT); | 3029 | UCC_GETH_RX_BD_QUEUES_ALIGNMENT); |
3030 | if (IS_MURAM_ERR(ugeth->rx_bd_qs_tbl_offset)) { | 3030 | if (IS_ERR_VALUE(ugeth->rx_bd_qs_tbl_offset)) { |
3031 | ugeth_err | 3031 | ugeth_err |
3032 | ("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.", | 3032 | ("%s: Can not allocate DPRAM memory for p_rx_bd_qs_tbl.", |
3033 | __FUNCTION__); | 3033 | __FUNCTION__); |
@@ -3116,7 +3116,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3116 | ugeth->exf_glbl_param_offset = | 3116 | ugeth->exf_glbl_param_offset = |
3117 | qe_muram_alloc(sizeof(struct ucc_geth_exf_global_pram), | 3117 | qe_muram_alloc(sizeof(struct ucc_geth_exf_global_pram), |
3118 | UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT); | 3118 | UCC_GETH_RX_EXTENDED_FILTERING_GLOBAL_PARAMETERS_ALIGNMENT); |
3119 | if (IS_MURAM_ERR(ugeth->exf_glbl_param_offset)) { | 3119 | if (IS_ERR_VALUE(ugeth->exf_glbl_param_offset)) { |
3120 | ugeth_err | 3120 | ugeth_err |
3121 | ("%s: Can not allocate DPRAM memory for" | 3121 | ("%s: Can not allocate DPRAM memory for" |
3122 | " p_exf_glbl_param.", __FUNCTION__); | 3122 | " p_exf_glbl_param.", __FUNCTION__); |
@@ -3258,7 +3258,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth) | |||
3258 | 3258 | ||
3259 | /* Allocate InitEnet command parameter structure */ | 3259 | /* Allocate InitEnet command parameter structure */ |
3260 | init_enet_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_init_pram), 4); | 3260 | init_enet_pram_offset = qe_muram_alloc(sizeof(struct ucc_geth_init_pram), 4); |
3261 | if (IS_MURAM_ERR(init_enet_pram_offset)) { | 3261 | if (IS_ERR_VALUE(init_enet_pram_offset)) { |
3262 | ugeth_err | 3262 | ugeth_err |
3263 | ("%s: Can not allocate DPRAM memory for p_init_enet_pram.", | 3263 | ("%s: Can not allocate DPRAM memory for p_init_enet_pram.", |
3264 | __FUNCTION__); | 3264 | __FUNCTION__); |
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c index 925fb607d8c4..bb7afe985c63 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c | |||
@@ -125,7 +125,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
125 | { | 125 | { |
126 | int dpmemsz, memsz; | 126 | int dpmemsz, memsz; |
127 | u8 *dp_mem; | 127 | u8 *dp_mem; |
128 | uint dp_offset; | 128 | unsigned long dp_offset; |
129 | u8 *mem_addr; | 129 | u8 *mem_addr; |
130 | dma_addr_t dma_addr = 0; | 130 | dma_addr_t dma_addr = 0; |
131 | 131 | ||
@@ -133,7 +133,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
133 | 133 | ||
134 | dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos); | 134 | dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos); |
135 | dp_offset = cpm_dpalloc(dpmemsz, 8); | 135 | dp_offset = cpm_dpalloc(dpmemsz, 8); |
136 | if (IS_DPERR(dp_offset)) { | 136 | if (IS_ERR_VALUE(dp_offset)) { |
137 | printk(KERN_ERR | 137 | printk(KERN_ERR |
138 | "cpm_uart_cpm1.c: could not allocate buffer descriptors\n"); | 138 | "cpm_uart_cpm1.c: could not allocate buffer descriptors\n"); |
139 | return -ENOMEM; | 139 | return -ENOMEM; |
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c index fa455996ad8f..1eeea368071a 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c | |||
@@ -222,7 +222,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
222 | { | 222 | { |
223 | int dpmemsz, memsz; | 223 | int dpmemsz, memsz; |
224 | u8 *dp_mem; | 224 | u8 *dp_mem; |
225 | uint dp_offset; | 225 | unsigned long dp_offset; |
226 | u8 *mem_addr; | 226 | u8 *mem_addr; |
227 | dma_addr_t dma_addr = 0; | 227 | dma_addr_t dma_addr = 0; |
228 | 228 | ||
@@ -230,7 +230,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) | |||
230 | 230 | ||
231 | dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos); | 231 | dpmemsz = sizeof(cbd_t) * (pinfo->rx_nrfifos + pinfo->tx_nrfifos); |
232 | dp_offset = cpm_dpalloc(dpmemsz, 8); | 232 | dp_offset = cpm_dpalloc(dpmemsz, 8); |
233 | if (IS_DPERR(dp_offset)) { | 233 | if (IS_ERR_VALUE(dp_offset)) { |
234 | printk(KERN_ERR | 234 | printk(KERN_ERR |
235 | "cpm_uart_cpm.c: could not allocate buffer descriptors\n"); | 235 | "cpm_uart_cpm.c: could not allocate buffer descriptors\n"); |
236 | return -ENOMEM; | 236 | return -ENOMEM; |
diff --git a/include/asm-powerpc/qe.h b/include/asm-powerpc/qe.h index a62168ec535f..9d304b1f1608 100644 --- a/include/asm-powerpc/qe.h +++ b/include/asm-powerpc/qe.h | |||
@@ -38,11 +38,11 @@ int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input); | |||
38 | void qe_setbrg(u32 brg, u32 rate); | 38 | void qe_setbrg(u32 brg, u32 rate); |
39 | int qe_get_snum(void); | 39 | int qe_get_snum(void); |
40 | void qe_put_snum(u8 snum); | 40 | void qe_put_snum(u8 snum); |
41 | u32 qe_muram_alloc(u32 size, u32 align); | 41 | unsigned long qe_muram_alloc(int size, int align); |
42 | int qe_muram_free(u32 offset); | 42 | int qe_muram_free(unsigned long offset); |
43 | u32 qe_muram_alloc_fixed(u32 offset, u32 size); | 43 | unsigned long qe_muram_alloc_fixed(unsigned long offset, int size); |
44 | void qe_muram_dump(void); | 44 | void qe_muram_dump(void); |
45 | void *qe_muram_addr(u32 offset); | 45 | void *qe_muram_addr(unsigned long offset); |
46 | 46 | ||
47 | /* Buffer descriptors */ | 47 | /* Buffer descriptors */ |
48 | struct qe_bd { | 48 | struct qe_bd { |
@@ -448,10 +448,5 @@ struct ucc_slow_pram { | |||
448 | #define UCC_FAST_FUNCTION_CODE_DTB_LCL 0x02 | 448 | #define UCC_FAST_FUNCTION_CODE_DTB_LCL 0x02 |
449 | #define UCC_FAST_FUNCTION_CODE_BDB_LCL 0x01 | 449 | #define UCC_FAST_FUNCTION_CODE_BDB_LCL 0x01 |
450 | 450 | ||
451 | static inline long IS_MURAM_ERR(const u32 offset) | ||
452 | { | ||
453 | return offset > (u32) - 1000L; | ||
454 | } | ||
455 | |||
456 | #endif /* __KERNEL__ */ | 451 | #endif /* __KERNEL__ */ |
457 | #endif /* _ASM_POWERPC_QE_H */ | 452 | #endif /* _ASM_POWERPC_QE_H */ |
diff --git a/include/asm-ppc/commproc.h b/include/asm-ppc/commproc.h index 4f99df1bafd7..397248705e0e 100644 --- a/include/asm-ppc/commproc.h +++ b/include/asm-ppc/commproc.h | |||
@@ -63,20 +63,15 @@ | |||
63 | #define CPM_DATAONLY_SIZE ((uint)0x0700) | 63 | #define CPM_DATAONLY_SIZE ((uint)0x0700) |
64 | #define CPM_DP_NOSPACE ((uint)0x7fffffff) | 64 | #define CPM_DP_NOSPACE ((uint)0x7fffffff) |
65 | 65 | ||
66 | static inline long IS_DPERR(const uint offset) | ||
67 | { | ||
68 | return (uint)offset > (uint)-1000L; | ||
69 | } | ||
70 | |||
71 | /* Export the base address of the communication processor registers | 66 | /* Export the base address of the communication processor registers |
72 | * and dual port ram. | 67 | * and dual port ram. |
73 | */ | 68 | */ |
74 | extern cpm8xx_t *cpmp; /* Pointer to comm processor */ | 69 | extern cpm8xx_t *cpmp; /* Pointer to comm processor */ |
75 | extern uint cpm_dpalloc(uint size, uint align); | 70 | extern unsigned long cpm_dpalloc(uint size, uint align); |
76 | extern int cpm_dpfree(uint offset); | 71 | extern int cpm_dpfree(unsigned long offset); |
77 | extern uint cpm_dpalloc_fixed(uint offset, uint size, uint align); | 72 | extern unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align); |
78 | extern void cpm_dpdump(void); | 73 | extern void cpm_dpdump(void); |
79 | extern void *cpm_dpram_addr(uint offset); | 74 | extern void *cpm_dpram_addr(unsigned long offset); |
80 | extern uint cpm_dpram_phys(u8* addr); | 75 | extern uint cpm_dpram_phys(u8* addr); |
81 | extern void cpm_setbrg(uint brg, uint rate); | 76 | extern void cpm_setbrg(uint brg, uint rate); |
82 | 77 | ||
diff --git a/include/asm-ppc/cpm2.h b/include/asm-ppc/cpm2.h index 220cc2debe08..12a2860f9a9c 100644 --- a/include/asm-ppc/cpm2.h +++ b/include/asm-ppc/cpm2.h | |||
@@ -104,21 +104,16 @@ | |||
104 | */ | 104 | */ |
105 | #define NUM_CPM_HOST_PAGES 2 | 105 | #define NUM_CPM_HOST_PAGES 2 |
106 | 106 | ||
107 | static inline long IS_DPERR(const uint offset) | ||
108 | { | ||
109 | return (uint)offset > (uint)-1000L; | ||
110 | } | ||
111 | |||
112 | /* Export the base address of the communication processor registers | 107 | /* Export the base address of the communication processor registers |
113 | * and dual port ram. | 108 | * and dual port ram. |
114 | */ | 109 | */ |
115 | extern cpm_cpm2_t *cpmp; /* Pointer to comm processor */ | 110 | extern cpm_cpm2_t *cpmp; /* Pointer to comm processor */ |
116 | 111 | ||
117 | extern uint cpm_dpalloc(uint size, uint align); | 112 | extern unsigned long cpm_dpalloc(uint size, uint align); |
118 | extern int cpm_dpfree(uint offset); | 113 | extern int cpm_dpfree(unsigned long offset); |
119 | extern uint cpm_dpalloc_fixed(uint offset, uint size, uint align); | 114 | extern unsigned long cpm_dpalloc_fixed(unsigned long offset, uint size, uint align); |
120 | extern void cpm_dpdump(void); | 115 | extern void cpm_dpdump(void); |
121 | extern void *cpm_dpram_addr(uint offset); | 116 | extern void *cpm_dpram_addr(unsigned long offset); |
122 | extern void cpm_setbrg(uint brg, uint rate); | 117 | extern void cpm_setbrg(uint brg, uint rate); |
123 | extern void cpm2_fastbrg(uint brg, uint rate, int div16); | 118 | extern void cpm2_fastbrg(uint brg, uint rate, int div16); |
124 | extern void cpm2_reset(void); | 119 | extern void cpm2_reset(void); |
diff --git a/include/asm-ppc/rheap.h b/include/asm-ppc/rheap.h index 39a10d862244..172381769cfc 100644 --- a/include/asm-ppc/rheap.h +++ b/include/asm-ppc/rheap.h | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | typedef struct _rh_block { | 19 | typedef struct _rh_block { |
20 | struct list_head list; | 20 | struct list_head list; |
21 | void *start; | 21 | unsigned long start; |
22 | int size; | 22 | int size; |
23 | const char *owner; | 23 | const char *owner; |
24 | } rh_block_t; | 24 | } rh_block_t; |
@@ -37,8 +37,8 @@ typedef struct _rh_info { | |||
37 | #define RHIF_STATIC_INFO 0x1 | 37 | #define RHIF_STATIC_INFO 0x1 |
38 | #define RHIF_STATIC_BLOCK 0x2 | 38 | #define RHIF_STATIC_BLOCK 0x2 |
39 | 39 | ||
40 | typedef struct rh_stats_t { | 40 | typedef struct _rh_stats { |
41 | void *start; | 41 | unsigned long start; |
42 | int size; | 42 | int size; |
43 | const char *owner; | 43 | const char *owner; |
44 | } rh_stats_t; | 44 | } rh_stats_t; |
@@ -57,24 +57,24 @@ extern void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks, | |||
57 | rh_block_t * block); | 57 | rh_block_t * block); |
58 | 58 | ||
59 | /* Attach a free region to manage */ | 59 | /* Attach a free region to manage */ |
60 | extern int rh_attach_region(rh_info_t * info, void *start, int size); | 60 | extern int rh_attach_region(rh_info_t * info, unsigned long start, int size); |
61 | 61 | ||
62 | /* Detach a free region */ | 62 | /* Detach a free region */ |
63 | extern void *rh_detach_region(rh_info_t * info, void *start, int size); | 63 | extern unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size); |
64 | 64 | ||
65 | /* Allocate the given size from the remote heap (with alignment) */ | 65 | /* Allocate the given size from the remote heap (with alignment) */ |
66 | extern void *rh_alloc_align(rh_info_t * info, int size, int alignment, | 66 | extern unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment, |
67 | const char *owner); | 67 | const char *owner); |
68 | 68 | ||
69 | /* Allocate the given size from the remote heap */ | 69 | /* Allocate the given size from the remote heap */ |
70 | extern void *rh_alloc(rh_info_t * info, int size, const char *owner); | 70 | extern unsigned long rh_alloc(rh_info_t * info, int size, const char *owner); |
71 | 71 | ||
72 | /* Allocate the given size from the given address */ | 72 | /* Allocate the given size from the given address */ |
73 | extern void *rh_alloc_fixed(rh_info_t * info, void *start, int size, | 73 | extern unsigned long rh_alloc_fixed(rh_info_t * info, unsigned long start, int size, |
74 | const char *owner); | 74 | const char *owner); |
75 | 75 | ||
76 | /* Free the allocated area */ | 76 | /* Free the allocated area */ |
77 | extern int rh_free(rh_info_t * info, void *start); | 77 | extern int rh_free(rh_info_t * info, unsigned long start); |
78 | 78 | ||
79 | /* Get stats for debugging purposes */ | 79 | /* Get stats for debugging purposes */ |
80 | extern int rh_get_stats(rh_info_t * info, int what, int max_stats, | 80 | extern int rh_get_stats(rh_info_t * info, int what, int max_stats, |
@@ -84,6 +84,6 @@ extern int rh_get_stats(rh_info_t * info, int what, int max_stats, | |||
84 | extern void rh_dump(rh_info_t * info); | 84 | extern void rh_dump(rh_info_t * info); |
85 | 85 | ||
86 | /* Set owner of taken block */ | 86 | /* Set owner of taken block */ |
87 | extern int rh_set_owner(rh_info_t * info, void *start, const char *owner); | 87 | extern int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner); |
88 | 88 | ||
89 | #endif /* __ASM_PPC_RHEAP_H__ */ | 89 | #endif /* __ASM_PPC_RHEAP_H__ */ |