Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2009, Google Inc. |
| 3 | * All rights reserved. |
| 4 | * |
Channagoud Kadabi | bd50bea | 2015-03-19 15:17:04 -0700 | [diff] [blame] | 5 | * Copyright (c) 2009-2012,2015 The Linux Foundation. All rights reserved. |
Shashank Mittal | 8e49dec | 2010-03-01 15:19:04 -0800 | [diff] [blame] | 6 | * |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions |
| 9 | * are met: |
| 10 | * * Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * * Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 14 | * the documentation and/or other materials provided with the |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 15 | * distribution. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 20 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 21 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 24 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 25 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 27 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 28 | * SUCH DAMAGE. |
| 29 | */ |
| 30 | |
| 31 | #include <debug.h> |
| 32 | #include <reg.h> |
| 33 | #include <string.h> |
| 34 | #include <sys/types.h> |
| 35 | #include <platform/iomap.h> |
Shashank Mittal | 8e49dec | 2010-03-01 15:19:04 -0800 | [diff] [blame] | 36 | #include <lib/ptable.h> |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 37 | |
Aparna Mallavarapu | 1f62fdd | 2015-03-08 12:50:57 +0530 | [diff] [blame] | 38 | #include "board.h" |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 39 | #include "smem.h" |
| 40 | |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 41 | |
| 42 | /* partition table from SMEM */ |
| 43 | static struct smem_ptable smem_ptable; |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 44 | static unsigned smem_apps_flash_start = 0xFFFFFFFF; |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 45 | |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 46 | static ram_partition_table ptable; |
| 47 | |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 48 | static void dump_smem_ptable(void) |
| 49 | { |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 50 | unsigned i; |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 51 | |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 52 | for (i = 0; i < smem_ptable.len; i++) { |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 53 | struct smem_ptn *p = &smem_ptable.parts[i]; |
| 54 | if (p->name[0] == '\0') |
| 55 | continue; |
| 56 | dprintf(SPEW, "%d: %s offs=0x%08x size=0x%08x attr: 0x%08x\n", |
| 57 | i, p->name, p->start, p->size, p->attr); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | void smem_ptable_init(void) |
| 62 | { |
| 63 | unsigned i; |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 64 | unsigned ret; |
vijay kumar | 4f4405f | 2014-08-08 11:49:53 +0530 | [diff] [blame] | 65 | unsigned len = 0; |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 66 | |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 67 | /* Read only the header portion of ptable */ |
| 68 | ret = smem_read_alloc_entry_offset(SMEM_AARM_PARTITION_TABLE, |
| 69 | &smem_ptable, |
| 70 | SMEM_PTABLE_HDR_LEN, |
| 71 | 0); |
| 72 | if (ret) |
| 73 | { |
| 74 | dprintf(CRITICAL, "Failed to read ptable hdr (%d)", ret); |
| 75 | ASSERT(0); |
| 76 | } |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 77 | |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 78 | /* Verify ptable magic */ |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 79 | if (smem_ptable.magic[0] != _SMEM_PTABLE_MAGIC_1 || |
| 80 | smem_ptable.magic[1] != _SMEM_PTABLE_MAGIC_2) |
| 81 | return; |
| 82 | |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 83 | /* Ensure that # of partitions is less than the max we have allocated. */ |
| 84 | ASSERT(smem_ptable.len <= SMEM_PTABLE_MAX_PARTS); |
| 85 | |
| 86 | /* Find out length of partition data based on table version. */ |
| 87 | if (smem_ptable.version <= 3) |
| 88 | { |
| 89 | len = SMEM_PTABLE_HDR_LEN + SMEM_PTABLE_MAX_PARTS_V3*sizeof(struct smem_ptn); |
| 90 | } |
| 91 | else if (smem_ptable.version == 4) |
| 92 | { |
| 93 | len = SMEM_PTABLE_HDR_LEN + SMEM_PTABLE_MAX_PARTS_V4*sizeof(struct smem_ptn); |
| 94 | } |
| 95 | else |
| 96 | { |
| 97 | dprintf(CRITICAL, "Unknown ptable version (%d)", smem_ptable.version); |
| 98 | ASSERT(0); |
| 99 | } |
| 100 | |
| 101 | ret = smem_read_alloc_entry(SMEM_AARM_PARTITION_TABLE, |
| 102 | &smem_ptable, |
| 103 | len); |
| 104 | if (ret) |
| 105 | { |
| 106 | dprintf(CRITICAL, "Failed to read ptable (%d)", ret); |
| 107 | ASSERT(0); |
| 108 | } |
| 109 | |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 110 | dump_smem_ptable(); |
| 111 | dprintf(INFO, "smem ptable found: ver: %d len: %d\n", |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 112 | smem_ptable.version, smem_ptable.len); |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 113 | |
| 114 | for (i = 0; i < smem_ptable.len; i++) { |
| 115 | if (!strcmp(smem_ptable.parts[i].name, "0:APPS")) |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 116 | break; |
Dima Zavin | 9caac25 | 2009-01-26 12:37:15 -0800 | [diff] [blame] | 117 | } |
| 118 | if (i == smem_ptable.len) |
| 119 | return; |
| 120 | |
| 121 | smem_apps_flash_start = smem_ptable.parts[i].start; |
| 122 | } |
| 123 | |
| 124 | unsigned smem_get_apps_flash_start(void) |
| 125 | { |
| 126 | return smem_apps_flash_start; |
| 127 | } |
Shashank Mittal | 8e49dec | 2010-03-01 15:19:04 -0800 | [diff] [blame] | 128 | |
| 129 | void smem_add_modem_partitions(struct ptable *flash_ptable) |
| 130 | { |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 131 | unsigned i; |
Shashank Mittal | 8e49dec | 2010-03-01 15:19:04 -0800 | [diff] [blame] | 132 | |
| 133 | if (smem_ptable.magic[0] != _SMEM_PTABLE_MAGIC_1 || |
| 134 | smem_ptable.magic[1] != _SMEM_PTABLE_MAGIC_2) |
| 135 | return; |
| 136 | |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 137 | for (i = 0; i < smem_ptable.len; i++) { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 138 | char *token; |
| 139 | char *pname = NULL; |
Sridhar Parasuram | 131ad2e | 2015-06-15 16:22:54 -0700 | [diff] [blame] | 140 | char *sp; |
Shashank Mittal | 8e49dec | 2010-03-01 15:19:04 -0800 | [diff] [blame] | 141 | struct smem_ptn *p = &smem_ptable.parts[i]; |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 142 | if (p->name[0] == '\0') |
| 143 | continue; |
Sridhar Parasuram | 131ad2e | 2015-06-15 16:22:54 -0700 | [diff] [blame] | 144 | token = strtok_r(p->name, ":", &sp); |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 145 | while (token) { |
Shashank Mittal | 8e49dec | 2010-03-01 15:19:04 -0800 | [diff] [blame] | 146 | pname = token; |
Sridhar Parasuram | 131ad2e | 2015-06-15 16:22:54 -0700 | [diff] [blame] | 147 | token = strtok_r(NULL, ":", &sp); |
Shashank Mittal | 8e49dec | 2010-03-01 15:19:04 -0800 | [diff] [blame] | 148 | } |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 149 | if (pname) { |
Shashank Mittal | 8e49dec | 2010-03-01 15:19:04 -0800 | [diff] [blame] | 150 | ptable_add(flash_ptable, pname, p->start, |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 151 | p->size, 0, TYPE_MODEM_PARTITION, |
| 152 | PERM_WRITEABLE); |
Shashank Mittal | 8e49dec | 2010-03-01 15:19:04 -0800 | [diff] [blame] | 153 | } |
| 154 | } |
| 155 | } |
| 156 | |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 157 | static void smem_copy_ram_ptable(void *buf) |
| 158 | { |
Channagoud Kadabi | bd50bea | 2015-03-19 15:17:04 -0700 | [diff] [blame] | 159 | struct smem_ram_ptable *table_v0 = NULL; |
| 160 | struct smem_ram_ptable_v1 *table_v1 = NULL; |
| 161 | struct smem_ram_ptable_v2 *table_v2 = NULL; |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 162 | uint32_t pentry = 0; |
| 163 | |
| 164 | ptable.hdr = *(struct smem_ram_ptable_hdr*)buf; |
| 165 | |
| 166 | /* Perform member to member copy from smem_ram_ptable to wrapper struct ram_ptable */ |
Channagoud Kadabi | bd50bea | 2015-03-19 15:17:04 -0700 | [diff] [blame] | 167 | if(ptable.hdr.version == SMEM_RAM_PTABLE_VERSION_2) |
| 168 | { |
| 169 | table_v2 = (struct smem_ram_ptable_v2*)buf; |
| 170 | |
| 171 | memcpy(&ptable, table_v2, sizeof(ram_partition_table)); |
| 172 | } |
Channagoud Kadabi | 626a1d9 | 2015-03-25 15:20:31 -0700 | [diff] [blame] | 173 | else if(ptable.hdr.version == SMEM_RAM_PTABLE_VERSION_1) |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 174 | { |
| 175 | table_v1 = (struct smem_ram_ptable_v1*)buf; |
| 176 | |
Channagoud Kadabi | bd50bea | 2015-03-19 15:17:04 -0700 | [diff] [blame] | 177 | for(pentry = 0; pentry < ((struct smem_ram_ptable_hdr*)buf)->len; pentry++) |
| 178 | { |
| 179 | ptable.parts[pentry].start = table_v1->parts[pentry].start; |
| 180 | ptable.parts[pentry].size = table_v1->parts[pentry].size; |
| 181 | ptable.parts[pentry].attr = table_v1->parts[pentry].attr; |
| 182 | ptable.parts[pentry].category = table_v1->parts[pentry].category; |
| 183 | ptable.parts[pentry].domain = table_v1->parts[pentry].domain; |
| 184 | ptable.parts[pentry].type = table_v1->parts[pentry].type; |
| 185 | ptable.parts[pentry].num_partitions = table_v1->parts[pentry].num_partitions; |
| 186 | } |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 187 | } |
| 188 | else if(ptable.hdr.version == SMEM_RAM_PTABLE_VERSION_0) |
| 189 | { |
| 190 | table_v0 = (struct smem_ram_ptable*)buf; |
| 191 | |
| 192 | for(pentry = 0; pentry < ((struct smem_ram_ptable_hdr*)buf)->len; pentry++) |
| 193 | { |
| 194 | ptable.parts[pentry].start = table_v0->parts[pentry].start; |
| 195 | ptable.parts[pentry].size = table_v0->parts[pentry].size; |
| 196 | ptable.parts[pentry].attr = table_v0->parts[pentry].attr; |
| 197 | ptable.parts[pentry].category = table_v0->parts[pentry].category; |
| 198 | ptable.parts[pentry].domain = table_v0->parts[pentry].domain; |
| 199 | ptable.parts[pentry].type = table_v0->parts[pentry].type; |
| 200 | ptable.parts[pentry].num_partitions = table_v0->parts[pentry].num_partitions; |
| 201 | } |
| 202 | |
| 203 | } |
| 204 | else |
| 205 | { |
| 206 | dprintf(CRITICAL,"ERROR: Unknown smem ram ptable version: %u", ptable.hdr.version); |
| 207 | ASSERT(0); |
| 208 | } |
| 209 | } |
| 210 | |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 211 | /* RAM Partition table from SMEM */ |
| 212 | int smem_ram_ptable_init(struct smem_ram_ptable *smem_ram_ptable) |
| 213 | { |
| 214 | unsigned i; |
| 215 | |
| 216 | i = smem_read_alloc_entry(SMEM_USABLE_RAM_PARTITION_TABLE, |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 217 | smem_ram_ptable, |
| 218 | sizeof(struct smem_ram_ptable)); |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 219 | if (i != 0) |
| 220 | return 0; |
| 221 | |
| 222 | if (smem_ram_ptable->magic[0] != _SMEM_RAM_PTABLE_MAGIC_1 || |
| 223 | smem_ram_ptable->magic[1] != _SMEM_RAM_PTABLE_MAGIC_2) |
| 224 | return 0; |
| 225 | |
Ajay Dudani | ebb0b5b | 2011-08-02 14:35:55 -0700 | [diff] [blame] | 226 | dprintf(SPEW, "smem ram ptable found: ver: %d len: %d\n", |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 227 | smem_ram_ptable->version, smem_ram_ptable->len); |
| 228 | |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 229 | smem_copy_ram_ptable((void*)smem_ram_ptable); |
| 230 | |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 231 | return 1; |
| 232 | } |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 233 | |
| 234 | /* RAM Partition table from SMEM */ |
Channagoud Kadabi | bd50bea | 2015-03-19 15:17:04 -0700 | [diff] [blame] | 235 | static uint32_t buffer[sizeof(struct smem_ram_ptable_v2)]; |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 236 | int smem_ram_ptable_init_v1() |
| 237 | { |
| 238 | uint32_t i; |
| 239 | uint32_t ret; |
| 240 | uint32_t version; |
vijay kumar | 4f4405f | 2014-08-08 11:49:53 +0530 | [diff] [blame] | 241 | uint32_t smem_ram_ptable_size = 0; |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 242 | struct smem_ram_ptable_hdr *ram_ptable_hdr; |
| 243 | |
| 244 | /* Check smem ram partition table version and decide on length of ram_ptable */ |
| 245 | ret = smem_read_alloc_entry_offset(SMEM_USABLE_RAM_PARTITION_TABLE, |
| 246 | &version, |
| 247 | sizeof(version), |
| 248 | SMEM_RAM_PTABLE_VERSION_OFFSET); |
| 249 | |
| 250 | if(ret) |
| 251 | return 0; |
| 252 | |
Channagoud Kadabi | bd50bea | 2015-03-19 15:17:04 -0700 | [diff] [blame] | 253 | if(version == SMEM_RAM_PTABLE_VERSION_2) |
| 254 | smem_ram_ptable_size = sizeof(struct smem_ram_ptable_v2); |
Channagoud Kadabi | 626a1d9 | 2015-03-25 15:20:31 -0700 | [diff] [blame] | 255 | else if(version == SMEM_RAM_PTABLE_VERSION_1) |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 256 | smem_ram_ptable_size = sizeof(struct smem_ram_ptable_v1); |
| 257 | else if(version == SMEM_RAM_PTABLE_VERSION_0) |
| 258 | smem_ram_ptable_size = sizeof(struct smem_ram_ptable); |
| 259 | else |
| 260 | { |
| 261 | dprintf(CRITICAL,"ERROR: Wrong smem_ram_ptable version: %u", version); |
| 262 | ASSERT(0); |
| 263 | } |
| 264 | |
| 265 | i = smem_read_alloc_entry(SMEM_USABLE_RAM_PARTITION_TABLE, |
| 266 | (void*)buffer, |
| 267 | smem_ram_ptable_size); |
| 268 | if (i != 0) |
| 269 | return 0; |
| 270 | |
| 271 | ram_ptable_hdr = (struct smem_ram_ptable_hdr *)buffer; |
| 272 | |
| 273 | if (ram_ptable_hdr->magic[0] != _SMEM_RAM_PTABLE_MAGIC_1 || |
| 274 | ram_ptable_hdr->magic[1] != _SMEM_RAM_PTABLE_MAGIC_2) |
| 275 | return 0; |
| 276 | |
| 277 | smem_copy_ram_ptable((void*)buffer); |
| 278 | |
| 279 | dprintf(SPEW, "smem ram ptable found: ver: %u len: %u\n", |
| 280 | ram_ptable_hdr->version, ram_ptable_hdr->len); |
| 281 | |
| 282 | return 1; |
| 283 | } |
| 284 | |
| 285 | void smem_get_ram_ptable_entry(ram_partition *ptn, uint32_t entry) |
| 286 | { |
| 287 | memcpy(ptn, &(ptable.parts[entry]), sizeof(ram_partition)); |
| 288 | } |
| 289 | |
| 290 | uint32_t smem_get_ram_ptable_len(void) |
| 291 | { |
| 292 | return ptable.hdr.len; |
| 293 | } |
| 294 | |
| 295 | uint32_t smem_get_ram_ptable_version(void) |
| 296 | { |
| 297 | return ptable.hdr.version; |
| 298 | } |
Aparna Mallavarapu | 1f62fdd | 2015-03-08 12:50:57 +0530 | [diff] [blame] | 299 | |
| 300 | uint32_t get_ddr_start() |
| 301 | { |
| 302 | uint32_t i; |
| 303 | ram_partition ptn_entry; |
| 304 | uint32_t len = 0; |
| 305 | |
| 306 | ASSERT(smem_ram_ptable_init_v1()); |
| 307 | |
| 308 | len = smem_get_ram_ptable_len(); |
| 309 | |
| 310 | /* Determine the Start addr of the DDR RAM */ |
| 311 | for(i = 0; i < len; i++) |
| 312 | { |
| 313 | smem_get_ram_ptable_entry(&ptn_entry, i); |
| 314 | if(ptn_entry.type == SYS_MEMORY) |
| 315 | { |
| 316 | if((ptn_entry.category == SDRAM) || |
| 317 | (ptn_entry.category == IMEM)) |
| 318 | { |
| 319 | /* Check to ensure that start address is 1MB aligned */ |
| 320 | ASSERT((ptn_entry.start & (MB-1)) == 0); |
| 321 | return ptn_entry.start; |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | ASSERT("DDR Start Mem Not found\n"); |
| 326 | return 0; |
| 327 | } |
Channagoud Kadabi | b22da98 | 2015-07-13 15:03:41 -0700 | [diff] [blame] | 328 | |
| 329 | uint64_t smem_get_ddr_size() |
| 330 | { |
| 331 | uint32_t i; |
| 332 | ram_partition ptn_entry; |
| 333 | uint32_t len = 0; |
| 334 | uint64_t size = 0; |
| 335 | |
| 336 | ASSERT(smem_ram_ptable_init_v1()); |
| 337 | |
| 338 | len = smem_get_ram_ptable_len(); |
| 339 | |
| 340 | /* Determine the Start addr of the DDR RAM */ |
| 341 | for(i = 0; i < len; i++) |
| 342 | { |
| 343 | smem_get_ram_ptable_entry(&ptn_entry, i); |
| 344 | if(ptn_entry.type == SYS_MEMORY && ptn_entry.category == SDRAM) |
| 345 | size += ptn_entry.size; |
| 346 | } |
| 347 | |
| 348 | return size; |
| 349 | } |