Add RF variant information in system property

Root cause:
New RF variants of LTE B28a and B28b need to distinguish with origin

How to fix:
Add RF variant information in system property

RiskArea: system_property
Change-Id: Ie52c8300880d2ae0fa4f081ba7aefa2fc8b31843
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 018f01a..9a98663 100755
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -250,6 +250,17 @@
 static const char *PCBA_STAGE_F = " androidboot.pcbastage=Reserved";
 //>20200424-michaellin
 
+//<2020/07/02-tedwu, Add RF variants in system properties
+#define RF_VARIANT_PIN_0	 89
+#define RF_VARIANT_PIN_1	141
+
+static const char *rfvar_prefix = " androidboot.rfvariant=";
+static const char *rfvar_0      = "B13";
+static const char *rfvar_1      = "B28B";
+static const char *rfvar_2      = "B28A";
+static const char *rfvar_3      = "03";
+//>2020/07/02-tedwu, Add RF variants in system properties
+
 #if VERIFIED_BOOT
 static const char *verity_mode = " androidboot.veritymode=";
 static const char *verified_state= " androidboot.verifiedbootstate=";
@@ -535,6 +546,20 @@
 }
 //>20200424-michaellin
 
+//<2020/07/02-tedwu, Add RF variant in system properties
+uint32_t get_rf_variant(void)
+{
+	static uint32_t rf_id = 0xFF;
+
+	if (0xFF == rf_id) {
+		rf_id = (gpio_status(RF_VARIANT_PIN_1) << 1) + gpio_status(RF_VARIANT_PIN_0);
+	}
+	dprintf(CRITICAL, "RF Variant ID: %d\n", rf_id);
+
+	return rf_id;
+}
+//>2020/07/02-tedwu, Add RF variant in system properties
+
 unsigned char *update_cmdline(const char * cmdline)
 {
 	int cmdline_len = 0;
@@ -579,6 +604,10 @@
 	uint32_t boot_state = RED;
 #endif
 
+	//<2020/07/02-tedwu, Add RF variant in system properties
+	const char *pRFvar[4] = {rfvar_0, rfvar_1, rfvar_2, rfvar_3};
+	//>2020/07/02-tedwu, Add RF variant in system properties
+
 #if USE_LE_SYSTEMD
 	is_systemd_present=true;
 #endif
@@ -777,6 +806,11 @@
 	}
 	//>20200424-michaellin
 
+	//<2020/07/02-tedwu, Add RF variant in system properties
+	cmdline_len += strlen(rfvar_prefix);
+	cmdline_len += strlen(pRFvar[get_rf_variant()]);
+	//>2020/07/02-tedwu, Add RF variant in system properties
+
 	/* [TracyChui]Add memory_config property 20200615 start */
 	if(smem_get_ddr_size() == MEM_3GB )
 		{
@@ -997,6 +1031,15 @@
 		}
 		//>20200424-michaellin
 
+		//<2020/07/02-tedwu, Add RF variant in system properties
+		src = rfvar_prefix;
+		if (have_cmdline) --dst;
+		while ((*dst++ = *src++));
+		src = pRFvar[get_rf_variant()];
+		if (have_cmdline) --dst;
+        while ((*dst++ = *src++));
+		//>2020/07/02-tedwu, Add RF variant in system properties
+
 		/* [TracyChui]Add memory_config property 20200615 start */
 		if(smem_get_ddr_size() == MEM_3GB )
 		{