fastboot: Increasing the max allowed download size

Creating a function which will return target specific max allowed flash size.

Change-Id: I7ff7d895af1cfea773e628c1a7a6b564043a3517
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 82b6dd8..e574fb4 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -92,6 +92,7 @@
 unsigned board_machtype(void);
 unsigned check_reboot_mode(void);
 void *target_get_scratch_address(void);
+unsigned target_get_max_flash_size(void);
 int target_is_emmc_boot(void);
 void reboot_device(unsigned);
 void target_battery_charging_enable(unsigned enable, unsigned disconnect);
@@ -691,6 +692,7 @@
 	unsigned reboot_mode = 0;
 	unsigned disp_init = 0;
 	unsigned usb_init = 0;
+	unsigned sz = 0;
 
 	/* Setup page size information for nand/emmc reads */
 	if (target_is_emmc_boot())
@@ -777,8 +779,8 @@
 	fastboot_register("reboot-bootloader", cmd_reboot_bootloader);
 	fastboot_publish("product", TARGET(BOARD));
 	fastboot_publish("kernel", "lk");
-
-	fastboot_init(target_get_scratch_address(), 120 * 1024 * 1024);
+	sz = target_get_max_flash_size();
+	fastboot_init(target_get_scratch_address(), sz);
 	udc_start();
 	target_battery_charging_enable(1, 0);
 }
diff --git a/include/target.h b/include/target.h
index ace8834..c140d9d 100644
--- a/include/target.h
+++ b/include/target.h
@@ -32,6 +32,9 @@
 /* get memory address for fastboot image loading */
 void *target_get_scratch_address(void);
 
+/* get the max allowed flash size */
+unsigned target_get_max_flash_size(void);
+
 /* if target is using eMMC bootup */
 int target_is_emmc_boot(void);
 
diff --git a/target/init.c b/target/init.c
index 0fa8b8d..a771544 100644
--- a/target/init.c
+++ b/target/init.c
@@ -45,6 +45,11 @@
     return (void *)(SCRATCH_ADDR);
 }
 
+__WEAK unsigned target_get_max_flash_size(void)
+{
+    return (120 * 1024 * 1024);
+}
+
 __WEAK int target_is_emmc_boot(void)
 {
 #if _EMMC_BOOT
diff --git a/target/msm8660_surf/atags.c b/target/msm8660_surf/atags.c
index 69d88c3..dc112f4 100644
--- a/target/msm8660_surf/atags.c
+++ b/target/msm8660_surf/atags.c
@@ -85,3 +85,8 @@
 {
     return ((void *)SCRATCH_ADDR);
 }
+
+unsigned target_get_max_flash_size(void)
+{
+    return (140 * 1024 * 1024);
+}