diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-05-22 18:59:11 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-07-27 03:48:23 -0400 |
commit | 98864ff58dd2b8ef9e72b0d2c70f34e7ff24a2ee (patch) | |
tree | 87f93ed777f090220acb3cc066c85abe4b863d12 /drivers/video | |
parent | 8d717a52d1b0959128be5134dd12608e8e4f2115 (diff) |
ARM: OMAP: Convert OMAPFB and VRAM SDRAM reservation to LMB
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/omap2/vram.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/video/omap2/vram.c b/drivers/video/omap2/vram.c index 3b1237ad85ed..f6fdc2085f3e 100644 --- a/drivers/video/omap2/vram.c +++ b/drivers/video/omap2/vram.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/list.h> | 25 | #include <linux/list.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/seq_file.h> | 27 | #include <linux/seq_file.h> |
28 | #include <linux/bootmem.h> | 28 | #include <linux/memblock.h> |
29 | #include <linux/completion.h> | 29 | #include <linux/completion.h> |
30 | #include <linux/debugfs.h> | 30 | #include <linux/debugfs.h> |
31 | #include <linux/jiffies.h> | 31 | #include <linux/jiffies.h> |
@@ -525,10 +525,8 @@ early_param("vram", omap_vram_early_vram); | |||
525 | * Called from map_io. We need to call to this early enough so that we | 525 | * Called from map_io. We need to call to this early enough so that we |
526 | * can reserve the fixed SDRAM regions before VM could get hold of them. | 526 | * can reserve the fixed SDRAM regions before VM could get hold of them. |
527 | */ | 527 | */ |
528 | void __init omap_vram_reserve_sdram(void) | 528 | void __init omap_vram_reserve_sdram_memblock(void) |
529 | { | 529 | { |
530 | struct bootmem_data *bdata; | ||
531 | unsigned long sdram_start, sdram_size; | ||
532 | u32 paddr; | 530 | u32 paddr; |
533 | u32 size = 0; | 531 | u32 size = 0; |
534 | 532 | ||
@@ -555,29 +553,28 @@ void __init omap_vram_reserve_sdram(void) | |||
555 | 553 | ||
556 | size = PAGE_ALIGN(size); | 554 | size = PAGE_ALIGN(size); |
557 | 555 | ||
558 | bdata = NODE_DATA(0)->bdata; | ||
559 | sdram_start = bdata->node_min_pfn << PAGE_SHIFT; | ||
560 | sdram_size = (bdata->node_low_pfn << PAGE_SHIFT) - sdram_start; | ||
561 | |||
562 | if (paddr) { | 556 | if (paddr) { |
563 | if ((paddr & ~PAGE_MASK) || paddr < sdram_start || | 557 | struct memblock_property res; |
564 | paddr + size > sdram_start + sdram_size) { | 558 | |
559 | res.base = paddr; | ||
560 | res.size = size; | ||
561 | if ((paddr & ~PAGE_MASK) || memblock_find(&res) || | ||
562 | res.base != paddr || res.size != size) { | ||
565 | pr_err("Illegal SDRAM region for VRAM\n"); | 563 | pr_err("Illegal SDRAM region for VRAM\n"); |
566 | return; | 564 | return; |
567 | } | 565 | } |
568 | 566 | ||
569 | if (reserve_bootmem(paddr, size, BOOTMEM_EXCLUSIVE) < 0) { | 567 | if (memblock_is_region_reserved(paddr, size)) { |
570 | pr_err("FB: failed to reserve VRAM\n"); | 568 | pr_err("FB: failed to reserve VRAM - busy\n"); |
571 | return; | 569 | return; |
572 | } | 570 | } |
573 | } else { | 571 | |
574 | if (size > sdram_size) { | 572 | if (memblock_reserve(paddr, size) < 0) { |
575 | pr_err("Illegal SDRAM size for VRAM\n"); | 573 | pr_err("FB: failed to reserve VRAM - no memory\n"); |
576 | return; | 574 | return; |
577 | } | 575 | } |
578 | 576 | } else { | |
579 | paddr = virt_to_phys(alloc_bootmem_pages(size)); | 577 | paddr = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_REAL_LIMIT); |
580 | BUG_ON(paddr & ~PAGE_MASK); | ||
581 | } | 578 | } |
582 | 579 | ||
583 | omap_vram_add_region(paddr, size); | 580 | omap_vram_add_region(paddr, size); |