blob: 7146ea18a4a9239e6a266a048cd862a1e9755544 [file] [log] [blame]
Dima Zavina404bce2009-01-26 12:32:22 -08001/*
2 * Copyright (c) 2009, Google Inc.
3 * All rights reserved.
4 *
Aparna Mallavarapu2269a2f2013-01-07 19:44:48 +05305 * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
Chandan Uddaraju885e4db2009-12-03 22:45:26 -08006 *
Dima Zavina404bce2009-01-26 12:32:22 -08007 * 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 Jadi5c61a952012-05-04 17:05:35 -070014 * the documentation and/or other materials provided with the
Dima Zavina404bce2009-01-26 12:32:22 -080015 * 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 Jadi5c61a952012-05-04 17:05:35 -070024 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
Dima Zavina404bce2009-01-26 12:32:22 -080025 * 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#ifndef __PLATFORM_MSM_SHARED_SMEM_H
32#define __PLATFORM_MSM_SHARED_SMEM_H
33
34#include <sys/types.h>
35
Channagoud Kadabi4b21e7f2013-02-15 11:55:38 -080036#define SMEM_V7_SMEM_MAX_PMIC_DEVICES 1
37#define SMEM_V8_SMEM_MAX_PMIC_DEVICES 3
38#define SMEM_MAX_PMIC_DEVICES SMEM_V8_SMEM_MAX_PMIC_DEVICES
39
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -070040#define SMEM_RAM_PTABLE_VERSION_OFFSET 8
41
42#define RAM_PART_NAME_LENGTH 16
43#define RAM_NUM_PART_ENTRIES 32
44
45#define _SMEM_RAM_PTABLE_MAGIC_1 0x9DA5E0A8
46#define _SMEM_RAM_PTABLE_MAGIC_2 0xAF9EC4E2
47
48enum smem_ram_ptable_version
49{
50 SMEM_RAM_PTABLE_VERSION_0,
51 SMEM_RAM_PTABLE_VERSION_1,
52};
53
Ajay Dudanib01e5062011-12-03 23:23:42 -080054struct smem_proc_comm {
Dima Zavina404bce2009-01-26 12:32:22 -080055 unsigned command;
56 unsigned status;
57 unsigned data1;
58 unsigned data2;
59};
60
Ajay Dudanib01e5062011-12-03 23:23:42 -080061struct smem_heap_info {
Dima Zavina404bce2009-01-26 12:32:22 -080062 unsigned initialized;
63 unsigned free_offset;
64 unsigned heap_remaining;
65 unsigned reserved;
66};
67
Ajay Dudanib01e5062011-12-03 23:23:42 -080068struct smem_alloc_info {
Dima Zavina404bce2009-01-26 12:32:22 -080069 unsigned allocated;
70 unsigned offset;
71 unsigned size;
72 unsigned reserved;
73};
74
Ajay Dudanib01e5062011-12-03 23:23:42 -080075struct smem_board_info_v2 {
76 unsigned format;
77 unsigned msm_id;
78 unsigned msm_version;
79 char build_id[32];
80 unsigned raw_msm_id;
81 unsigned raw_msm_version;
Srilakshmi Punurucfb5a462011-02-08 11:55:24 -080082};
83
Deepa Dinamania4ebcff2012-06-11 11:59:30 -070084typedef enum
85{
86 PMIC_IS_PM6610,
87 PMIC_IS_PM6620,
88 PMIC_IS_PM6640,
89 PMIC_IS_PM6650,
90 PMIC_IS_PM7500,
91 PMIC_IS_PANORAMIX,
92 PMIC_IS_PM6652,
93 PMIC_IS_PM6653,
94 PMIC_IS_PM6658,
95 PMIC_IS_EPIC,
96 PMIC_IS_HAN,
97 PMIC_IS_KIP,
98 PMIC_IS_WOOKIE,
99 PMIC_IS_PM8058,
100 PMIC_IS_PM8028,
101 PMIC_IS_PM8901,
102 PMIC_IS_PM8027 ,
103 PMIC_IS_ISL_9519,
104 PMIC_IS_PM8921,
105 PMIC_IS_PM8018,
106 PMIC_IS_PM8015,
107 PMIC_IS_PM8014,
108 PMIC_IS_PM8821,
109 PMIC_IS_PM8038,
Deepa Dinamanib8b16432012-08-24 15:48:45 -0700110 PMIC_IS_PM8922,
111 PMIC_IS_PM8917,
Channagoud Kadabi4b21e7f2013-02-15 11:55:38 -0800112 PMIC_IS_INVALID = 0x7fffffff,
113} pm_model_type_afly;
114
115typedef enum
116{
117 PMIC_IS_UNKNOWN = 0,
118 PMIC_IS_PM8941 = 1,
119 PMIC_IS_PM8841 = 2,
120 PMIC_IS_PM8019 = 3,
121 PMIC_IS_PM8026 = 4,
122 PMIC_IS_PM8110 = 5,
123} pm_model_type_bfly;
Deepa Dinamania4ebcff2012-06-11 11:59:30 -0700124
Ajay Dudanib01e5062011-12-03 23:23:42 -0800125struct smem_board_info_v3 {
126 unsigned format;
127 unsigned msm_id;
128 unsigned msm_version;
129 char build_id[32];
130 unsigned raw_msm_id;
131 unsigned raw_msm_version;
132 unsigned hw_platform;
Chandan Uddaraju885e4db2009-12-03 22:45:26 -0800133};
134
Ajay Dudanib01e5062011-12-03 23:23:42 -0800135struct smem_board_info_v4 {
136 struct smem_board_info_v3 board_info_v3;
137 unsigned platform_version;
138 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
Chandan Uddaraju1434a602010-03-08 17:13:38 -0800139};
140
Ajay Dudanib01e5062011-12-03 23:23:42 -0800141struct smem_board_info_v5 {
142 struct smem_board_info_v3 board_info_v3;
143 unsigned platform_version;
144 unsigned fused_chip;
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800145};
146
Ajay Dudanib01e5062011-12-03 23:23:42 -0800147struct smem_board_info_v6 {
148 struct smem_board_info_v3 board_info_v3;
149 unsigned platform_version;
150 unsigned fused_chip;
151 unsigned platform_subtype;
152 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
Ajay Dudani6cff85e2011-02-04 16:02:16 -0800153};
154
Deepa Dinamania4ebcff2012-06-11 11:59:30 -0700155struct smem_board_info_v7 {
156 struct smem_board_info_v3 board_info_v3;
157 unsigned platform_version;
158 unsigned fused_chip;
159 unsigned platform_subtype;
160 unsigned pmic_type;
161 unsigned pmic_version;
162 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
163};
164
Channagoud Kadabi4b21e7f2013-02-15 11:55:38 -0800165struct smem_pmic_info {
166 unsigned pmic_type;
167 unsigned pmic_version;
168};
169
170struct smem_board_info_v8 {
171 struct smem_board_info_v3 board_info_v3;
172 unsigned platform_version;
173 unsigned fused_chip;
174 unsigned platform_subtype;
175 struct smem_pmic_info pmic_info[SMEM_V8_SMEM_MAX_PMIC_DEVICES];
176 /*
177 * Need for 8 bytes alignment
178 * while reading from shared memory
179 */
180 unsigned buffer_align;
181};
182
Ajay Dudanib01e5062011-12-03 23:23:42 -0800183typedef struct {
184 unsigned key_len;
185 unsigned iv_len;
186 unsigned char key[32];
187 unsigned char iv[32];
188} boot_symmetric_key_info;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700189
Ajay Dudanib01e5062011-12-03 23:23:42 -0800190typedef struct {
191 unsigned int update_status;
192 unsigned int bl_error_code;
193} boot_ssd_status;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700194
195#if PLATFORM_MSM7X30
196
Ajay Dudanib01e5062011-12-03 23:23:42 -0800197typedef struct {
198 boot_symmetric_key_info key_info;
199 uint32_t boot_flags;
200 uint32_t boot_key_press[5];
201 uint32_t time_tick;
202 boot_ssd_status status;
203 uint8_t buff_align[4];
204} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700205
206#elif PLATFORM_MSM7K
207
Ajay Dudanib01e5062011-12-03 23:23:42 -0800208typedef struct {
209 uint32_t apps_img_start_addr;
210 uint32_t boot_flags;
211 boot_ssd_status status;
212} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700213
214#elif PLATFORM_MSM7X27A
215
Ajay Dudanib01e5062011-12-03 23:23:42 -0800216typedef struct {
217 uint32_t apps_img_start_addr;
218 uint32_t boot_flags;
219 boot_ssd_status status;
220 boot_symmetric_key_info key_info;
221 uint16_t boot_key_press[10];
222 uint32_t timetick;
223 uint8_t PAD[28];
224} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700225
226#else
227
228/* Dummy structure to keep it for other targets */
Ajay Dudanib01e5062011-12-03 23:23:42 -0800229typedef struct {
230 uint32_t boot_flags;
231 boot_ssd_status status;
232} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700233
234#endif
235
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800236/* chip information */
237enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800238 UNKNOWN = 0,
239 MDM9200 = 57,
240 MDM9600 = 58,
241 MSM8260 = 70,
242 MSM8660 = 71,
243 APQ8060 = 86,
244 MSM8960 = 87,
245 MSM7225A = 88,
246 MSM7625A = 89,
247 MSM7227A = 90,
248 MSM7627A = 91,
249 ESM7227A = 92,
250 ESM7225A = 96,
251 ESM7627A = 97,
252 MSM7225AA = 98,
253 MSM7625AA = 99,
254 ESM7225AA = 100,
255 MSM7227AA = 101,
256 MSM7627AA = 102,
257 ESM7227AA = 103,
258 APQ8064 = 109,
259 MSM8930 = 116,
260 MSM8630 = 117,
261 MSM8230 = 118,
262 APQ8030 = 119,
263 MSM8627 = 120,
264 MSM8227 = 121,
265 MSM8660A = 122,
266 MSM8260A = 123,
267 APQ8060A = 124,
David Ngdc2d1a52013-02-12 18:11:56 -0800268 MSM8974 = 126,
Channagoud Kadabi3acfb742011-11-15 18:19:32 +0530269 MSM8225 = 127,
Ajay Dudani7d162542012-02-16 19:51:14 -0800270 MSM8625 = 129,
271 MPQ8064 = 130,
Channagoud Kadabibd14e2f2012-05-03 22:54:50 +0530272 MSM7225AB = 131,
273 MSM7625AB = 132,
274 ESM7225AB = 133,
Neeti Desai465491e2012-07-31 12:53:35 -0700275 MDM9625 = 134,
Channagoud Kadabi647f0852012-06-08 11:51:45 +0530276 MSM7125A = 135,
277 MSM7127A = 136,
Aparna Mallavarapu51879412012-08-27 12:55:50 +0530278 MSM8125A = 137,
Neeti Desai6e015252012-08-13 13:22:37 -0700279 MSM8960AB = 138,
280 APQ8060AB = 139,
281 MSM8260AB = 140,
282 MSM8660AB = 141,
Neeti Desai5ccd8642012-07-17 12:43:43 -0700283 MSM8930AA = 142,
284 MSM8630AA = 143,
285 MSM8230AA = 144,
Deepa Dinamani4069e742013-02-25 14:11:34 -0800286 MSM8626 = 145,
Aparna Mallavarapudd2dc802013-06-28 07:48:30 -0700287 MPQ8092 = 146,
Deepa Dinamanie5c9a472013-03-05 15:48:26 -0800288 MSM8610 = 147,
Amol Jadi117ef3a2012-09-20 13:32:55 -0700289 MDM9225 = 149,
290 MDM9225M = 150,
291 MDM9625M = 152,
292 APQ8064AB = 153, /* aka V2 PRIME */
Amol Jadi6d913742012-10-16 12:12:23 -0700293 MSM8930AB = 154,
294 MSM8630AB = 155,
295 MSM8230AB = 156,
296 APQ8030AB = 157,
Deepa Dinamani4069e742013-02-25 14:11:34 -0800297 MSM8226 = 158,
298 MSM8826 = 159,
Channagoud Kadabi512295f2012-10-23 10:00:42 +0530299 APQ8030AA = 160,
Deepa Dinamanie5c9a472013-03-05 15:48:26 -0800300 MSM8110 = 161,
301 MSM8210 = 162,
302 MSM8810 = 163,
David Ng909601c2013-04-19 20:21:30 -0700303 MSM8212 = 164,
Deepa Dinamanie33d14b2013-04-08 18:27:12 -0700304 MSM8612 = 165,
David Ng909601c2013-04-19 20:21:30 -0700305 MSM8812 = 166,
Aparna Mallavarapue07cfff2012-10-31 12:07:59 +0530306 MSM8125 = 167,
Aparna Mallavarapu5f098222013-03-20 18:31:35 +0530307 MDM9310 = 171,
Aparna Mallavarapu2269a2f2013-01-07 19:44:48 +0530308 APQ8064AA = 172, /* aka V2 SLOW_PRIME */
David Ng24df2e42013-08-21 23:31:50 -0700309 APQ8084 = 178,
David Ngdc2d1a52013-02-12 18:11:56 -0800310 MSM8130 = 179,
311 MSM8130AA = 180,
312 MSM8130AB = 181,
Aparna Mallavarapu751e4a22013-02-19 18:45:44 +0530313 MSM8627AA = 182,
314 MSM8227AA = 183,
Channagoud Kadabi3dc072f2013-02-21 22:29:02 -0800315 APQ8074 = 184,
Deepa Dinamani3449d992013-05-03 12:03:51 -0700316 MSM8274 = 185,
317 MSM8674 = 186,
Smita Solanki6bd7d5f2014-01-03 06:42:36 -0800318 MDM9635 = 187,
V S Ramanjaneya Kumar Tb75d2ae2013-08-02 10:54:56 +0530319 FSM9900 = 188,
V S Ramanjaneya Kumar Ta44a36a2013-12-03 13:53:48 +0530320 FSM9905 = 189,
321 FSM9955 = 190,
322 FSM9950 = 191,
323 FSM9915 = 192,
324 FSM9910 = 193,
Deepa Dinamani732e2052013-06-14 12:32:36 -0700325 MSM8974AC = 194,
Channagoud Kadabi924610c2013-09-26 10:37:32 -0700326 MSM8962 = 195,
327 MSM8262 = 196,
328 APQ8062 = 197,
Deepa Dinamanid96f9322013-05-21 12:41:54 -0700329 MSM8126 = 198,
330 APQ8026 = 199,
331 MSM8926 = 200,
332 MSM8326 = 205,
Deepa Dinamani732e2052013-06-14 12:32:36 -0700333 APQ8074AA = 208,
334 APQ8074AB = 209,
335 APQ8074AC = 210,
336 MSM8274AA = 211,
337 MSM8274AB = 212,
338 MSM8274AC = 213,
339 MSM8674AA = 214,
340 MSM8674AB = 215,
341 MSM8674AC = 216,
342 MSM8974AA = 217,
343 MSM8974AB = 218,
Maria Yu083d7802013-09-02 18:11:23 +0800344 APQ8028 = 219,
345 MSM8128 = 220,
346 MSM8228 = 221,
347 MSM8528 = 222,
348 MSM8628 = 223,
349 MSM8928 = 224,
Deepa Dinamania3bf8b52013-09-12 11:00:37 -0700350 MSM8510 = 225,
351 MSM8512 = 226,
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800352};
353
Ajay Dudanib01e5062011-12-03 23:23:42 -0800354enum platform {
355 HW_PLATFORM_UNKNOWN = 0,
356 HW_PLATFORM_SURF = 1,
357 HW_PLATFORM_FFA = 2,
358 HW_PLATFORM_FLUID = 3,
359 HW_PLATFORM_SVLTE = 4,
360 HW_PLATFORM_QT = 6,
Amol Jadi6133e8d2012-10-07 22:15:02 -0700361 HW_PLATFORM_MTP_MDM = 7,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800362 HW_PLATFORM_MTP = 8,
363 HW_PLATFORM_LIQUID = 9,
364 HW_PLATFORM_DRAGON = 10,
Aparna Mallavarapu6af40f42013-03-04 16:58:23 +0530365 HW_PLATFORM_QRD = 11,
Ajay Dudani7d162542012-02-16 19:51:14 -0800366 HW_PLATFORM_HRD = 13,
367 HW_PLATFORM_DTV = 14,
V S Ramanjaneya Kumar Tc633fe12013-01-08 14:55:54 -0500368 HW_PLATFORM_RUMI = 15,
369 HW_PLATFORM_VIRTIO = 16,
370 HW_PLATFORM_BTS = 19,
Channagoud Kadabi33527cd2013-09-17 16:20:58 -0700371 HW_PLATFORM_RCM = 21,
Aparna Mallavarapu6145c432013-02-05 19:27:30 +0530372 HW_PLATFORM_DMA = 22,
Channagoud Kadabi33527cd2013-09-17 16:20:58 -0700373 HW_PLATFORM_STP = 23,
Eugene Yasman70f9e2e2013-12-11 10:40:57 +0200374 HW_PLATFORM_SBC = 24,
Neeti Desai465491e2012-07-31 12:53:35 -0700375 HW_PLATFORM_32BITS = 0x7FFFFFFF,
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800376};
377
Ajay Dudanib01e5062011-12-03 23:23:42 -0800378enum platform_subtype {
379 HW_PLATFORM_SUBTYPE_UNKNOWN = 0,
380 HW_PLATFORM_SUBTYPE_MDM = 1,
381 HW_PLATFORM_SUBTYPE_CSFB = 1,
382 HW_PLATFORM_SUBTYPE_SVLTE1 = 2,
383 HW_PLATFORM_SUBTYPE_SVLTE2A = 3,
Amol Jadi5c61a952012-05-04 17:05:35 -0700384 HW_PLATFORM_SUBTYPE_SGLTE = 6,
Channagoud Kadabi141f2982012-10-31 11:23:02 +0530385 HW_PLATFORM_SUBTYPE_DSDA = 7,
Amol Jadi9f04e7e2013-01-22 12:08:35 -0800386 HW_PLATFORM_SUBTYPE_DSDA2 = 8,
sundarajan srinivasan73d8df32013-02-28 17:03:27 -0800387 HW_PLATFORM_SUBTYPE_SGLTE2 = 9,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800388 HW_PLATFORM_SUBTYPE_32BITS = 0x7FFFFFFF
Ajay Dudani6cff85e2011-02-04 16:02:16 -0800389};
390
Dima Zavina404bce2009-01-26 12:32:22 -0800391typedef enum {
392 SMEM_SPINLOCK_ARRAY = 7,
393
394 SMEM_AARM_PARTITION_TABLE = 9,
395
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800396 SMEM_APPS_BOOT_MODE = 106,
Chandan Uddarajude85d3f2010-01-05 16:32:33 -0800397
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800398 SMEM_BOARD_INFO_LOCATION = 137,
Chandan Uddaraju885e4db2009-12-03 22:45:26 -0800399
Ajay Dudania1eafc42010-04-21 19:48:11 -0700400 SMEM_USABLE_RAM_PARTITION_TABLE = 402,
401
David Ngf773dde2010-07-26 19:55:08 -0700402 SMEM_POWER_ON_STATUS_INFO = 403,
403
Channagoud Kadabie1ecef52012-02-04 15:54:34 +0530404 SMEM_RLOCK_AREA = 404,
405
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700406 SMEM_BOOT_INFO_FOR_APPS = 418,
407
Dima Zavina404bce2009-01-26 12:32:22 -0800408 SMEM_FIRST_VALID_TYPE = SMEM_SPINLOCK_ARRAY,
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700409 SMEM_LAST_VALID_TYPE = SMEM_BOOT_INFO_FOR_APPS,
Neeti Desai800e84f2012-04-09 15:14:08 -0700410
411 SMEM_MAX_SIZE = SMEM_BOOT_INFO_FOR_APPS + 1,
Dima Zavina404bce2009-01-26 12:32:22 -0800412} smem_mem_type_t;
413
414/* Note: buf MUST be 4byte aligned, and max_len MUST be a multiple of 4. */
415unsigned smem_read_alloc_entry(smem_mem_type_t type, void *buf, int max_len);
416
Ajay Dudania1eafc42010-04-21 19:48:11 -0700417/* SMEM RAM Partition */
418enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800419 DEFAULT_ATTRB = ~0x0,
420 READ_ONLY = 0x0,
421 READWRITE,
Ajay Dudania1eafc42010-04-21 19:48:11 -0700422};
423
424enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800425 DEFAULT_CATEGORY = ~0x0,
426 SMI = 0x0,
427 EBI1,
428 EBI2,
429 QDSP6,
430 IRAM,
431 IMEM,
432 EBI0_CS0,
433 EBI0_CS1,
434 EBI1_CS0,
435 EBI1_CS1,
436 SDRAM = 0xE,
Ajay Dudania1eafc42010-04-21 19:48:11 -0700437};
438
439enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800440 DEFAULT_DOMAIN = 0x0,
441 APPS_DOMAIN,
442 MODEM_DOMAIN,
443 SHARED_DOMAIN,
Ajay Dudania1eafc42010-04-21 19:48:11 -0700444};
445
Ajay Dudanidfef90b2010-09-22 10:21:05 -0700446enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800447 SYS_MEMORY = 1, /* system memory */
448 BOOT_REGION_MEMORY1, /* boot loader memory 1 */
449 BOOT_REGION_MEMORY2, /* boot loader memory 2,reserved */
450 APPSBL_MEMORY, /* apps boot loader memory */
451 APPS_MEMORY, /* apps usage memory */
Ajay Dudanidfef90b2010-09-22 10:21:05 -0700452};
453
Neeti Desaid5b50552012-03-23 12:39:01 -0700454struct smem {
455 struct smem_proc_comm proc_comm[4];
456 unsigned version_info[32];
457 struct smem_heap_info heap_info;
Neeti Desai800e84f2012-04-09 15:14:08 -0700458 struct smem_alloc_info alloc_info[SMEM_MAX_SIZE];
Neeti Desaid5b50552012-03-23 12:39:01 -0700459};
460
Ajay Dudania1eafc42010-04-21 19:48:11 -0700461struct smem_ram_ptn {
462 char name[16];
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700463 uint32_t start;
464 uint32_t size;
465 uint32_t attr; /* RAM Partition attribute: READ_ONLY, READWRITE etc.*/
466 uint32_t category; /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */
467 uint32_t domain; /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */
468 uint32_t type; /* RAM Partition type: system, bootloader, appsboot, apps etc. */
469 uint32_t num_partitions;/* Number of memory partitions */
470 uint32_t reserved3;
471 uint32_t reserved4;
472 uint32_t reserved5;
473} __attribute__ ((__packed__));
Ajay Dudania1eafc42010-04-21 19:48:11 -0700474
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700475struct smem_ram_ptn_v1 {
476 char name[RAM_PART_NAME_LENGTH];
477 uint64_t start;
478 uint64_t size;
479 uint32_t attr; /* RAM Partition attribute: READ_ONLY, READWRITE etc.*/
480 uint32_t category; /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */
481 uint32_t domain; /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */
482 uint32_t type; /* RAM Partition type: system, bootloader, appsboot, apps etc. */
483 uint32_t num_partitions;/* Number of memory partitions */
484 uint32_t reserved3;
485 uint32_t reserved4; /* Reserved for future use */
486 uint32_t reserved5; /* Reserved for future use */
Ajay Dudania1eafc42010-04-21 19:48:11 -0700487} __attribute__ ((__packed__));
488
489struct smem_ram_ptable {
Ajay Dudania1eafc42010-04-21 19:48:11 -0700490 unsigned magic[2];
491 unsigned version;
492 unsigned reserved1;
493 unsigned len;
494 struct smem_ram_ptn parts[32];
495 unsigned buf;
496} __attribute__ ((__packed__));
497
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700498struct smem_ram_ptable_hdr
499{
500 uint32_t magic[2];
501 uint32_t version;
502 uint32_t reserved1;
503 uint32_t len;
504} __attribute__ ((__packed__));
505
506struct smem_ram_ptable_v1 {
507 struct smem_ram_ptable_hdr hdr;
508 uint32_t reserved2; /* Added for 8 bytes alignment of header */
509 struct smem_ram_ptn_v1 parts[RAM_NUM_PART_ENTRIES];
510} __attribute__ ((__packed__));
511
David Ngf773dde2010-07-26 19:55:08 -0700512/* Power on reason/status info */
Shashank Mittal6df16072011-07-14 18:44:01 -0700513#define PWR_ON_EVENT_RTC_ALARM 0x2
Ajay Dudaniba822332011-11-25 13:37:31 -0800514#define PWR_ON_EVENT_USB_CHG 0x20
515#define PWR_ON_EVENT_WALL_CHG 0x40
Greg Griscod2471ef2011-07-14 13:00:42 -0700516
Amol Jadi6133e8d2012-10-07 22:15:02 -0700517#define SMEM_PTABLE_MAX_PARTS_V3 16
518#define SMEM_PTABLE_MAX_PARTS_V4 32
519#define SMEM_PTABLE_MAX_PARTS SMEM_PTABLE_MAX_PARTS_V4
520
521#define SMEM_PTABLE_HDR_LEN (4*sizeof(unsigned))
522
523struct smem_ptn {
524 char name[16];
525 unsigned start;
526 unsigned size;
527 unsigned attr;
528} __attribute__ ((__packed__));
529
530
531struct smem_ptable {
532#define _SMEM_PTABLE_MAGIC_1 0x55ee73aa
533#define _SMEM_PTABLE_MAGIC_2 0xe35ebddb
534 unsigned magic[2];
535 unsigned version;
536 unsigned len;
537 struct smem_ptn parts[SMEM_PTABLE_MAX_PARTS];
538} __attribute__ ((__packed__));
539
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700540typedef struct smem_ram_ptable_v1 ram_partition_table;
541typedef struct smem_ram_ptn_v1 ram_partition;
542
Amol Jadi6133e8d2012-10-07 22:15:02 -0700543unsigned smem_read_alloc_entry_offset(smem_mem_type_t type, void *buf, int len, int offset);
Greg Griscod2471ef2011-07-14 13:00:42 -0700544int smem_ram_ptable_init(struct smem_ram_ptable *smem_ram_ptable);
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700545int smem_ram_ptable_init_v1(); /* Used on platforms that use ram ptable v1 */
546void smem_get_ram_ptable_entry(ram_partition*, uint32_t entry);
547uint32_t smem_get_ram_ptable_version(void);
548uint32_t smem_get_ram_ptable_len(void);
Ajay Dudanib01e5062011-12-03 23:23:42 -0800549#endif /* __PLATFORM_MSM_SHARED_SMEM_H */