diff options
-rw-r--r-- | arch/arm/plat-omap/common.c | 4 | ||||
-rw-r--r-- | arch/arm/plat-omap/fb.c | 30 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/vram.h | 4 | ||||
-rw-r--r-- | drivers/video/omap2/vram.c | 33 | ||||
-rw-r--r-- | include/linux/omapfb.h | 2 |
5 files changed, 39 insertions, 34 deletions
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c index 9f6bbc178a74..ebed82699eb2 100644 --- a/arch/arm/plat-omap/common.c +++ b/arch/arm/plat-omap/common.c | |||
@@ -85,8 +85,8 @@ EXPORT_SYMBOL(omap_get_var_config); | |||
85 | 85 | ||
86 | void __init omap_reserve(void) | 86 | void __init omap_reserve(void) |
87 | { | 87 | { |
88 | omapfb_reserve_sdram(); | 88 | omapfb_reserve_sdram_memblock(); |
89 | omap_vram_reserve_sdram(); | 89 | omap_vram_reserve_sdram_memblock(); |
90 | } | 90 | } |
91 | 91 | ||
92 | /* | 92 | /* |
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c index 97db493904fa..0054b9501a53 100644 --- a/arch/arm/plat-omap/fb.c +++ b/arch/arm/plat-omap/fb.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/bootmem.h> | 29 | #include <linux/memblock.h> |
30 | #include <linux/io.h> | 30 | #include <linux/io.h> |
31 | #include <linux/omapfb.h> | 31 | #include <linux/omapfb.h> |
32 | 32 | ||
@@ -173,25 +173,27 @@ static int check_fbmem_region(int region_idx, struct omapfb_mem_region *rg, | |||
173 | 173 | ||
174 | static int valid_sdram(unsigned long addr, unsigned long size) | 174 | static int valid_sdram(unsigned long addr, unsigned long size) |
175 | { | 175 | { |
176 | struct bootmem_data *bdata = NODE_DATA(0)->bdata; | 176 | struct memblock_property res; |
177 | unsigned long sdram_start, sdram_end; | ||
178 | 177 | ||
179 | sdram_start = bdata->node_min_pfn << PAGE_SHIFT; | 178 | res.base = addr; |
180 | sdram_end = bdata->node_low_pfn << PAGE_SHIFT; | 179 | res.size = size; |
181 | 180 | return !memblock_find(&res) && res.base == addr && res.size == size; | |
182 | return addr >= sdram_start && sdram_end - addr >= size; | ||
183 | } | 181 | } |
184 | 182 | ||
185 | static int reserve_sdram(unsigned long addr, unsigned long size) | 183 | static int reserve_sdram(unsigned long addr, unsigned long size) |
186 | { | 184 | { |
187 | return reserve_bootmem(addr, size, BOOTMEM_EXCLUSIVE); | 185 | if (memblock_is_region_reserved(addr, size)) |
186 | return -EBUSY; | ||
187 | if (memblock_reserve(addr, size)) | ||
188 | return -ENOMEM; | ||
189 | return 0; | ||
188 | } | 190 | } |
189 | 191 | ||
190 | /* | 192 | /* |
191 | * Called from map_io. We need to call to this early enough so that we | 193 | * Called from map_io. We need to call to this early enough so that we |
192 | * can reserve the fixed SDRAM regions before VM could get hold of them. | 194 | * can reserve the fixed SDRAM regions before VM could get hold of them. |
193 | */ | 195 | */ |
194 | void __init omapfb_reserve_sdram(void) | 196 | void __init omapfb_reserve_sdram_memblock(void) |
195 | { | 197 | { |
196 | unsigned long reserved = 0; | 198 | unsigned long reserved = 0; |
197 | int i; | 199 | int i; |
@@ -386,7 +388,10 @@ static inline int omap_init_fb(void) | |||
386 | 388 | ||
387 | arch_initcall(omap_init_fb); | 389 | arch_initcall(omap_init_fb); |
388 | 390 | ||
389 | void omapfb_reserve_sdram(void) {} | 391 | void omapfb_reserve_sdram_memblock(void) |
392 | { | ||
393 | } | ||
394 | |||
390 | unsigned long omapfb_reserve_sram(unsigned long sram_pstart, | 395 | unsigned long omapfb_reserve_sram(unsigned long sram_pstart, |
391 | unsigned long sram_vstart, | 396 | unsigned long sram_vstart, |
392 | unsigned long sram_size, | 397 | unsigned long sram_size, |
@@ -402,7 +407,10 @@ void omapfb_set_platform_data(struct omapfb_platform_data *data) | |||
402 | { | 407 | { |
403 | } | 408 | } |
404 | 409 | ||
405 | void omapfb_reserve_sdram(void) {} | 410 | void omapfb_reserve_sdram_memblock(void) |
411 | { | ||
412 | } | ||
413 | |||
406 | unsigned long omapfb_reserve_sram(unsigned long sram_pstart, | 414 | unsigned long omapfb_reserve_sram(unsigned long sram_pstart, |
407 | unsigned long sram_vstart, | 415 | unsigned long sram_vstart, |
408 | unsigned long sram_size, | 416 | unsigned long sram_size, |
diff --git a/arch/arm/plat-omap/include/plat/vram.h b/arch/arm/plat-omap/include/plat/vram.h index edd4987758a6..0aa4ecd12c7d 100644 --- a/arch/arm/plat-omap/include/plat/vram.h +++ b/arch/arm/plat-omap/include/plat/vram.h | |||
@@ -38,7 +38,7 @@ extern void omap_vram_get_info(unsigned long *vram, unsigned long *free_vram, | |||
38 | extern void omap_vram_set_sdram_vram(u32 size, u32 start); | 38 | extern void omap_vram_set_sdram_vram(u32 size, u32 start); |
39 | extern void omap_vram_set_sram_vram(u32 size, u32 start); | 39 | extern void omap_vram_set_sram_vram(u32 size, u32 start); |
40 | 40 | ||
41 | extern void omap_vram_reserve_sdram(void); | 41 | extern void omap_vram_reserve_sdram_memblock(void); |
42 | extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, | 42 | extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, |
43 | unsigned long sram_vstart, | 43 | unsigned long sram_vstart, |
44 | unsigned long sram_size, | 44 | unsigned long sram_size, |
@@ -48,7 +48,7 @@ extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, | |||
48 | static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { } | 48 | static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { } |
49 | static inline void omap_vram_set_sram_vram(u32 size, u32 start) { } | 49 | static inline void omap_vram_set_sram_vram(u32 size, u32 start) { } |
50 | 50 | ||
51 | static inline void omap_vram_reserve_sdram(void) { } | 51 | static inline void omap_vram_reserve_sdram_memblock(void) { } |
52 | static inline unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, | 52 | static inline unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, |
53 | unsigned long sram_vstart, | 53 | unsigned long sram_vstart, |
54 | unsigned long sram_size, | 54 | unsigned long sram_size, |
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); |
diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h index 9bdd91486b49..7e4cd616bcb5 100644 --- a/include/linux/omapfb.h +++ b/include/linux/omapfb.h | |||
@@ -253,7 +253,7 @@ struct omapfb_platform_data { | |||
253 | /* in arch/arm/plat-omap/fb.c */ | 253 | /* in arch/arm/plat-omap/fb.c */ |
254 | extern void omapfb_set_platform_data(struct omapfb_platform_data *data); | 254 | extern void omapfb_set_platform_data(struct omapfb_platform_data *data); |
255 | extern void omapfb_set_ctrl_platform_data(void *pdata); | 255 | extern void omapfb_set_ctrl_platform_data(void *pdata); |
256 | extern void omapfb_reserve_sdram(void); | 256 | extern void omapfb_reserve_sdram_memblock(void); |
257 | 257 | ||
258 | #endif | 258 | #endif |
259 | 259 | ||