diff options
-rw-r--r-- | arch/arm/mach-tegra/board.h | 11 | ||||
-rw-r--r-- | arch/arm/mach-tegra/common.c | 84 |
2 files changed, 94 insertions, 1 deletions
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h index db46d4d279ba..16446e13189f 100644 --- a/arch/arm/mach-tegra/board.h +++ b/arch/arm/mach-tegra/board.h @@ -29,10 +29,19 @@ void __init tegra_init_early(void); void __init tegra_map_common_io(void); void __init tegra_init_irq(void); void __init tegra_init_clock(void); -void __init tegra_reserve(void); +void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size, + unsigned long fb2_size); int __init tegra_pcie_init(bool init_port0, bool init_port1); void tegra_init_cache(void); +extern unsigned long tegra_bootloader_fb_start; +extern unsigned long tegra_bootloader_fb_size; +extern unsigned long tegra_fb_start; +extern unsigned long tegra_fb_size; +extern unsigned long tegra_fb2_start; +extern unsigned long tegra_fb2_size; +extern unsigned long tegra_carveout_start; +extern unsigned long tegra_carveout_size; extern unsigned long tegra_lp0_vec_start; extern unsigned long tegra_lp0_vec_size; diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c index 446b189525c7..56dcf600190b 100644 --- a/arch/arm/mach-tegra/common.c +++ b/arch/arm/mach-tegra/common.c @@ -36,6 +36,14 @@ #include "fuse.h" #include "pm.h" +unsigned long tegra_bootloader_fb_start; +unsigned long tegra_bootloader_fb_size; +unsigned long tegra_fb_start; +unsigned long tegra_fb_size; +unsigned long tegra_fb2_start; +unsigned long tegra_fb2_size; +unsigned long tegra_carveout_start; +unsigned long tegra_carveout_size; unsigned long tegra_lp0_vec_start; unsigned long tegra_lp0_vec_size; @@ -129,3 +137,79 @@ void __init tegra_reserve(void) tegra_lp0_vec_start, tegra_lp0_vec_start + tegra_lp0_vec_size - 1); } + +static int __init tegra_bootloader_fb_arg(char *options) +{ + char *p = options; + + tegra_bootloader_fb_size = memparse(p, &p); + if (*p == '@') + tegra_bootloader_fb_start = memparse(p+1, &p); + + pr_info("Found tegra_fbmem: %08lx@%08lx\n", + tegra_bootloader_fb_size, tegra_bootloader_fb_start); + + return 0; +} +early_param("tegra_fbmem", tegra_bootloader_fb_arg); + +void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size, + unsigned long fb2_size) +{ + if (tegra_lp0_vec_size) + if (memblock_reserve(tegra_lp0_vec_start, tegra_lp0_vec_size)) + pr_err("Failed to reserve lp0_vec %08lx@%08lx\n", + tegra_lp0_vec_size, tegra_lp0_vec_start); + + + tegra_carveout_start = memblock_end_of_DRAM() - carveout_size; + if (memblock_remove(tegra_carveout_start, carveout_size)) + pr_err("Failed to remove carveout %08lx@%08lx from memory " + "map\n", + tegra_carveout_start, carveout_size); + else + tegra_carveout_size = carveout_size; + + tegra_fb2_start = memblock_end_of_DRAM() - fb2_size; + if (memblock_remove(tegra_fb2_start, fb2_size)) + pr_err("Failed to remove second framebuffer %08lx@%08lx from " + "memory map\n", + tegra_fb2_start, fb2_size); + else + tegra_fb2_size = fb2_size; + + tegra_fb_start = memblock_end_of_DRAM() - fb_size; + if (memblock_remove(tegra_fb_start, fb_size)) + pr_err("Failed to remove framebuffer %08lx@%08lx from memory " + "map\n", + tegra_fb_start, fb_size); + else + tegra_fb_size = fb_size; + + /* + * TODO: We should copy the bootloader's framebuffer to the framebuffer + * allocated above, and then free this one. + */ + if (tegra_bootloader_fb_size) + if (memblock_reserve(tegra_bootloader_fb_start, + tegra_bootloader_fb_size)) + pr_err("Failed to reserve lp0_vec %08lx@%08lx\n", + tegra_lp0_vec_size, tegra_lp0_vec_start); + + pr_info("Tegra reserved memory:\n" + "LP0: %08lx - %08lx\n" + "Bootloader framebuffer: %08lx - %08lx\n" + "Framebuffer: %08lx - %08lx\n" + "2nd Framebuffer: %08lx - %08lx\n" + "Carveout: %08lx - %08lx\n", + tegra_lp0_vec_start, + tegra_lp0_vec_start + tegra_lp0_vec_size - 1, + tegra_bootloader_fb_start, + tegra_bootloader_fb_start + tegra_bootloader_fb_size - 1, + tegra_fb_start, + tegra_fb_start + tegra_fb_size - 1, + tegra_fb2_start, + tegra_fb2_start + tegra_fb2_size - 1, + tegra_carveout_start, + tegra_carveout_start + tegra_carveout_size - 1); +} |