[msm7630] Add support to detect physical memory usable by apps proc

Modem bootloader places information about physical memory regions
that are usable by apps in shared memory.  This information is available
in shared memory before apps processor is brought out of reset.

Add support to read this "ram partition table" and check for physical
memory chunks that are set as read/write for apps processor, exclude the
apps bootloader area and give the rest to Linux kernel using atags.

As a result, if modem physical memory requirement reduces, then apps
bootloader does not have to change.  Apps can pick up the extra memory
made available by detecting this from ram partition table.

Change-Id: I6abd85cd57710ceda89d4f125e3dffc59e7078b7
diff --git a/platform/msm_shared/smem.h b/platform/msm_shared/smem.h
index 085fa9e..73e465e 100644
--- a/platform/msm_shared/smem.h
+++ b/platform/msm_shared/smem.h
@@ -91,11 +91,72 @@
 
         SMEM_BOARD_INFO_LOCATION = 137,
 
+	SMEM_USABLE_RAM_PARTITION_TABLE = 402,
+
 	SMEM_FIRST_VALID_TYPE = SMEM_SPINLOCK_ARRAY,
-	SMEM_LAST_VALID_TYPE = SMEM_BOARD_INFO_LOCATION,
+	SMEM_LAST_VALID_TYPE = SMEM_USABLE_RAM_PARTITION_TABLE,
 } smem_mem_type_t;
 
 /* Note: buf MUST be 4byte aligned, and max_len MUST be a multiple of 4. */
 unsigned smem_read_alloc_entry(smem_mem_type_t type, void *buf, int max_len);
 
+/* SMEM RAM Partition */
+enum {
+    DEFAULT_ATTRB = ~0x0,
+    READ_ONLY = 0x0,
+    READWRITE,
+};
+
+enum {
+    DEFAULT_CATEGORY = ~0x0,
+    SMI = 0x0,
+    EBI1,
+    EBI2,
+    QDSP6,
+    IRAM,
+    IMEM,
+    EBI0_CS0,
+    EBI0_CS1,
+    EBI1_CS0,
+    EBI1_CS1,
+};
+
+enum {
+    DEFAULT_DOMAIN = 0x0,
+    APPS_DOMAIN,
+    MODEM_DOMAIN,
+    SHARED_DOMAIN,
+};
+
+struct smem_ram_ptn {
+	char name[16];
+	unsigned start;
+	unsigned size;
+
+	/* RAM Partition attribute: READ_ONLY, READWRITE etc.  */
+	unsigned attr;
+
+	/* RAM Partition category: EBI0, EBI1, IRAM, IMEM */
+	unsigned category;
+
+	/* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */
+	unsigned domain;
+
+	/* reserved for future expansion without changing version number */
+	unsigned reserved1, reserved2, reserved3, reserved4, reserved5;
+} __attribute__ ((__packed__));
+
+struct smem_ram_ptable {
+#define _SMEM_RAM_PTABLE_MAGIC_1 0x9DA5E0A8
+#define _SMEM_RAM_PTABLE_MAGIC_2 0xAF9EC4E2
+	unsigned magic[2];
+	unsigned version;
+	unsigned reserved1;
+	unsigned len;
+	struct smem_ram_ptn parts[32];
+	unsigned buf;
+} __attribute__ ((__packed__));
+
+
+
 #endif /* __PLATFORM_MSM_SHARED_SMEM_H */