arm: tegra: display: handle fbmem2 cmdline parameter
Jong Kim [Thu, 13 Dec 2012 00:07:54 +0000 (16:07 -0800)]
Parse and handle fbmem2 cmdline parameter.

bug 1175957

Change-Id: I0933825371bf13782e9f4364a4dba078929ae836
Signed-off-by: Jong Kim <jongk@nvidia.com>
Reviewed-on: http://git-master/r/170662
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jon Mayo <jmayo@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Winnie Hsu <whsu@nvidia.com>

arch/arm/mach-tegra/board.h
arch/arm/mach-tegra/common.c

index b02adb2..6aaba21 100644 (file)
@@ -109,6 +109,8 @@ int arb_lost_recovery(int scl_gpio, int sda_gpio);
 
 extern unsigned long tegra_bootloader_fb_start;
 extern unsigned long tegra_bootloader_fb_size;
+extern unsigned long tegra_bootloader_fb2_start;
+extern unsigned long tegra_bootloader_fb2_size;
 extern unsigned long tegra_fb_start;
 extern unsigned long tegra_fb_size;
 extern unsigned long tegra_fb2_start;
index 4c5838b..0d1407b 100644 (file)
@@ -85,6 +85,8 @@
 
 unsigned long tegra_bootloader_fb_start;
 unsigned long tegra_bootloader_fb_size;
+unsigned long tegra_bootloader_fb2_start;
+unsigned long tegra_bootloader_fb2_size;
 unsigned long tegra_fb_start;
 unsigned long tegra_fb_size;
 unsigned long tegra_fb2_start;
@@ -479,6 +481,21 @@ static int __init tegra_bootloader_fb_arg(char *options)
 }
 early_param("tegra_fbmem", tegra_bootloader_fb_arg);
 
+static int __init tegra_bootloader_fb2_arg(char *options)
+{
+       char *p = options;
+
+       tegra_bootloader_fb2_size = memparse(p, &p);
+       if (*p == '@')
+               tegra_bootloader_fb2_start = memparse(p+1, &p);
+
+       pr_info("Found tegra_fbmem2: %08lx@%08lx\n",
+               tegra_bootloader_fb2_size, tegra_bootloader_fb2_start);
+
+       return 0;
+}
+early_param("tegra_fbmem2", tegra_bootloader_fb2_arg);
+
 static int __init tegra_sku_override(char *id)
 {
        char *p = id;
@@ -938,19 +955,36 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
                }
        }
 
+       if (tegra_bootloader_fb2_size) {
+               tegra_bootloader_fb2_size =
+                               PAGE_ALIGN(tegra_bootloader_fb2_size);
+               if (memblock_reserve(tegra_bootloader_fb2_start,
+                               tegra_bootloader_fb2_size)) {
+                       pr_err("Failed to reserve bootloader frame buffer2 "
+                               "%08lx@%08lx\n", tegra_bootloader_fb2_size,
+                               tegra_bootloader_fb2_start);
+                       tegra_bootloader_fb2_start = 0;
+                       tegra_bootloader_fb2_size = 0;
+               }
+       }
+
        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"
-               "Vpr:                    %08lx - %08lx\n",
+               "LP0:                     %08lx - %08lx\n"
+               "Bootloader framebuffer:  %08lx - %08lx\n"
+               "Bootloader framebuffer2: %08lx - %08lx\n"
+               "Framebuffer:             %08lx - %08lx\n"
+               "2nd Framebuffer:         %08lx - %08lx\n"
+               "Carveout:                %08lx - %08lx\n"
+               "Vpr:                     %08lx - %08lx\n",
                tegra_lp0_vec_start,
                tegra_lp0_vec_size ?
                        tegra_lp0_vec_start + tegra_lp0_vec_size - 1 : 0,
                tegra_bootloader_fb_start,
                tegra_bootloader_fb_size ?
-                       tegra_bootloader_fb_start + tegra_bootloader_fb_size - 1 : 0,
+                tegra_bootloader_fb_start + tegra_bootloader_fb_size - 1 : 0,
+               tegra_bootloader_fb2_start,
+               tegra_bootloader_fb2_size ?
+                tegra_bootloader_fb2_start + tegra_bootloader_fb2_size - 1 : 0,
                tegra_fb_start,
                tegra_fb_size ?
                        tegra_fb_start + tegra_fb_size - 1 : 0,
@@ -1017,6 +1051,10 @@ void __init tegra_release_bootloader_fb(void)
                if (memblock_free(tegra_bootloader_fb_start,
                                                tegra_bootloader_fb_size))
                        pr_err("Failed to free bootloader fb.\n");
+       if (tegra_bootloader_fb2_size)
+               if (memblock_free(tegra_bootloader_fb2_start,
+                                               tegra_bootloader_fb2_size))
+                       pr_err("Failed to free bootloader fb2.\n");
 }
 
 #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND