Show memory information on fastboot screen

Root cause:N/A

How to fix:N/A

Feature:Add ddr Manufacturer ID to smem SMEM_ID_VENDOR2 in sbl1 for show memory         manufacturer info on fastboot screen

RiskArea: Memory
Change-Id: Iabc97c0d40f6f4bd7f104e9346b0e5e329705912
diff --git a/platform/msm_shared/display_menu.c b/platform/msm_shared/display_menu.c
index 17a5a41..e663bdd 100755
--- a/platform/msm_shared/display_menu.c
+++ b/platform/msm_shared/display_menu.c
@@ -42,7 +42,9 @@
 #include <sys/types.h>
 #include <../../../app/aboot/devinfo.h>
 #include <../../../app/aboot/recovery.h>
-
+/*[TracyChui]Show memory information on fastboot screen 20200612 start */
+#include <mmu.h>
+/*[TracyChui]Show memory information on fastboot screen 20200612 end */
 #define TITLE_MSG "<!>\n\n"
 
 //[Arima][8901][JialongJhan] Command mode update screen 20190516 Start
@@ -513,6 +515,45 @@
 	snprintf(msg, sizeof(msg), "SERIAL NUMBER - %s\n", msg_buf);
 	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor, 0);
 
+	/*[TracyChui]Show memory information on fastboot screen 20200612 start */
+	dprintf(CRITICAL,"smem_get_ddr_size=%llu\n", smem_get_ddr_size());
+	if (smem_get_ddr_size() == MEM_3GB) {
+		snprintf(msg, sizeof(msg), "INTERNAL STORAGE SIZE - 32G\n");
+	} else if (smem_get_ddr_size() > MEM_3GB) {
+	    if (smem_get_ddr_size() < MEM_4GB)
+	    	{
+		     snprintf(msg, sizeof(msg), "INTERNAL STORAGE SIZE - 64G\n");
+	    	}
+		else
+			{
+             snprintf(msg, sizeof(msg), "INTERNAL STORAGE SIZE - \n");
+			}
+	} else {
+		snprintf(msg, sizeof(msg), "INTERNAL STORAGE SIZE - UNKNOWN\n");
+	}
+	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor, 0);
+	
+	memset(msg_buf, 0, sizeof(msg_buf));
+	smem_get_ddr_manufacturer_id((unsigned char *) msg_buf);
+	dprintf(CRITICAL,"smem_get_ddr_size=%llu\n", smem_get_ddr_size());
+	if (smem_get_ddr_size() == MEM_3GB) {
+		snprintf(msg, sizeof(msg), "MAIN MEMORY SIZE AND VENDOR - 3G\n");
+	} else if (smem_get_ddr_size() > MEM_3GB) {
+	    if (smem_get_ddr_size() < MEM_4GB)
+	    	{
+		     snprintf(msg, sizeof(msg), "MAIN MEMORY SIZE AND VENDOR - 4G %s\n", msg_buf);
+	    	}
+		else
+			{
+             snprintf(msg, sizeof(msg), "MAIN MEMORY SIZE AND VENDOR - %s\n", msg_buf);
+			}
+	} else {
+		snprintf(msg, sizeof(msg), "MAIN MEMORY SIZE AND VENDOR - %s\n", msg_buf);
+	}
+	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor, 0);
+
+	/*[TracyChui]Show memory information on fastboot screen 20200612 end */
+	
 	snprintf(msg, sizeof(msg), "SECURE BOOT - %s\n",
 		is_secure_boot_enable()? "enabled":"disabled");
 	display_fbcon_menu_message(msg, FBCON_COMMON_MSG, common_factor, 0);
diff --git a/platform/msm_shared/smem.h b/platform/msm_shared/smem.h
old mode 100644
new mode 100755
index f6d58d9..2b75111
--- a/platform/msm_shared/smem.h
+++ b/platform/msm_shared/smem.h
@@ -546,6 +546,10 @@
 
 	SMEM_BOARD_INFO_LOCATION = 137,
 
+	/*[TracyChui]Show memory information on fastboot screen 20200612 start */
+	SMEM_ID_VENDOR2 = 136,
+	/*[TracyChui]Show memory information on fastboot screen 20200612 end */
+	
 	SMEM_SMD_FIFO_BASE_ID = 338,
 
 	SMEM_USABLE_RAM_PARTITION_TABLE = 402,
@@ -720,5 +724,8 @@
 void* smem_get_alloc_entry(smem_mem_type_t type, uint32_t* size);
 uint32_t get_ddr_start();
 uint64_t smem_get_ddr_size();
+/*[TracyChui]Show memory information on fastboot screen 20200612 start */
+void smem_get_ddr_manufacturer_id(unsigned char *buf);
+/*[TracyChui]Show memory information on fastboot screen 20200612 end */
 size_t smem_get_hw_platform_name(void *buf, uint32 buf_size);
 #endif				/* __PLATFORM_MSM_SHARED_SMEM_H */
diff --git a/platform/msm_shared/smem_ptable.c b/platform/msm_shared/smem_ptable.c
old mode 100644
new mode 100755
index 4ed47b7..35b31ba
--- a/platform/msm_shared/smem_ptable.c
+++ b/platform/msm_shared/smem_ptable.c
@@ -347,3 +347,66 @@
 
 	return size;
 }
+
+/*[TracyChui]Show memory information on fastboot screen 20200612 start */
+//BOOT.BF.3.3.2\boot_images\core\api\boot\ddr_common.h
+/** DDR manufacturers. */
+typedef enum
+{
+  RESERVED_0,                        /**< Reserved for future use. */
+  SAMSUNG,                           /**< Samsung. */
+  QIMONDA,                           /**< Qimonda. */
+  ELPIDA,                            /**< Elpida Memory, Inc. */
+  ETRON,                             /**< Etron Technology, Inc. */
+  NANYA,                             /**< Nanya Technology Corporation. */
+  HYNIX,                             /**< Hynix Semiconductor Inc. */
+  MOSEL,                             /**< Mosel Vitelic Corporation. */
+  WINBOND,                           /**< Winbond Electronics Corp. */
+  ESMT,                              /**< Elite Semiconductor Memory Technology Inc. */
+  RESERVED_1,                        /**< Reserved for future use. */
+  SPANSION,                          /**< Spansion Inc. */
+  SST,                               /**< Silicon Storage Technology, Inc. */
+  ZMOS,                              /**< ZMOS Technology, Inc. */
+  INTEL,                             /**< Intel Corporation. */
+  NUMONYX = 254,                     /**< Numonyx, acquired by Micron Technology, Inc. */
+  MICRON = 255,                      /**< Micron Technology, Inc. */
+  DDR_MANUFACTURES_MAX = 0x7FFFFFFF  /**< Forces the enumerator to 32 bits. */
+} DDR_MANUFACTURES;
+
+//uint32_t smem_get_ddr_manufacturer_id()
+void smem_get_ddr_manufacturer_id(unsigned char *buf)
+{
+	uint32_t manufacturer_id = -1;
+	uint32_t manufacturer_id_len = sizeof(manufacturer_id);
+	unsigned ret;
+
+	ret = smem_read_alloc_entry(SMEM_ID_VENDOR2,
+								&manufacturer_id,
+								manufacturer_id_len);
+	if (ret)
+	{
+		dprintf(CRITICAL, "Failed to read SMEM_ID_VENDOR2 (%d)", ret);
+	}
+
+	switch(manufacturer_id)
+	{
+		case SAMSUNG:
+			snprintf((char *)buf, 64, "SAMSUNG");
+			break;
+		case ELPIDA:
+			snprintf((char *)buf, 64, "ELPIDA");
+			break;
+		case HYNIX:
+			snprintf((char *)buf, 64, "HYNIX");
+			break;
+		case MICRON:
+			snprintf((char *)buf, 64, "MICRON");
+			break;
+		default:
+			snprintf((char *)buf, 64, "OTHERS");
+			break;
+	}
+
+	dprintf(CRITICAL,"manufacturer_id=%d, %s\n", manufacturer_id, buf);
+	/*[TracyChui]Show memory information on fastboot screen 20200612 end */
+}