blob: 8d4a93d27c188ad2a04f166bc8647df7535d547c [file] [log] [blame]
Dima Zavina404bce2009-01-26 12:32:22 -08001/*
2 * Copyright (c) 2009, Google Inc.
3 * All rights reserved.
4 *
Channagoud Kadabiff74aff2014-01-08 12:10:29 -08005 * Copyright (c) 2009-2014, 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
Sundarajan Srinivasan79e5f512014-03-28 16:43:06 -070048#define SMEM_TARGET_INFO_IDENTIFIER 0x49494953
49
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -070050enum smem_ram_ptable_version
51{
52 SMEM_RAM_PTABLE_VERSION_0,
53 SMEM_RAM_PTABLE_VERSION_1,
54};
55
Ajay Dudanib01e5062011-12-03 23:23:42 -080056struct smem_proc_comm {
Dima Zavina404bce2009-01-26 12:32:22 -080057 unsigned command;
58 unsigned status;
59 unsigned data1;
60 unsigned data2;
61};
62
Ajay Dudanib01e5062011-12-03 23:23:42 -080063struct smem_heap_info {
Dima Zavina404bce2009-01-26 12:32:22 -080064 unsigned initialized;
65 unsigned free_offset;
66 unsigned heap_remaining;
67 unsigned reserved;
68};
69
Ajay Dudanib01e5062011-12-03 23:23:42 -080070struct smem_alloc_info {
Dima Zavina404bce2009-01-26 12:32:22 -080071 unsigned allocated;
72 unsigned offset;
73 unsigned size;
74 unsigned reserved;
75};
76
Ajay Dudanib01e5062011-12-03 23:23:42 -080077struct smem_board_info_v2 {
78 unsigned format;
79 unsigned msm_id;
80 unsigned msm_version;
81 char build_id[32];
82 unsigned raw_msm_id;
83 unsigned raw_msm_version;
Srilakshmi Punurucfb5a462011-02-08 11:55:24 -080084};
85
Deepa Dinamania4ebcff2012-06-11 11:59:30 -070086typedef enum
87{
88 PMIC_IS_PM6610,
89 PMIC_IS_PM6620,
90 PMIC_IS_PM6640,
91 PMIC_IS_PM6650,
92 PMIC_IS_PM7500,
93 PMIC_IS_PANORAMIX,
94 PMIC_IS_PM6652,
95 PMIC_IS_PM6653,
96 PMIC_IS_PM6658,
97 PMIC_IS_EPIC,
98 PMIC_IS_HAN,
99 PMIC_IS_KIP,
100 PMIC_IS_WOOKIE,
101 PMIC_IS_PM8058,
102 PMIC_IS_PM8028,
103 PMIC_IS_PM8901,
104 PMIC_IS_PM8027 ,
105 PMIC_IS_ISL_9519,
106 PMIC_IS_PM8921,
107 PMIC_IS_PM8018,
108 PMIC_IS_PM8015,
109 PMIC_IS_PM8014,
110 PMIC_IS_PM8821,
111 PMIC_IS_PM8038,
Deepa Dinamanib8b16432012-08-24 15:48:45 -0700112 PMIC_IS_PM8922,
113 PMIC_IS_PM8917,
Channagoud Kadabi4b21e7f2013-02-15 11:55:38 -0800114 PMIC_IS_INVALID = 0x7fffffff,
115} pm_model_type_afly;
116
117typedef enum
118{
119 PMIC_IS_UNKNOWN = 0,
120 PMIC_IS_PM8941 = 1,
121 PMIC_IS_PM8841 = 2,
122 PMIC_IS_PM8019 = 3,
123 PMIC_IS_PM8026 = 4,
124 PMIC_IS_PM8110 = 5,
125} pm_model_type_bfly;
Deepa Dinamania4ebcff2012-06-11 11:59:30 -0700126
Ajay Dudanib01e5062011-12-03 23:23:42 -0800127struct smem_board_info_v3 {
128 unsigned format;
129 unsigned msm_id;
130 unsigned msm_version;
131 char build_id[32];
132 unsigned raw_msm_id;
133 unsigned raw_msm_version;
134 unsigned hw_platform;
Chandan Uddaraju885e4db2009-12-03 22:45:26 -0800135};
136
Ajay Dudanib01e5062011-12-03 23:23:42 -0800137struct smem_board_info_v4 {
138 struct smem_board_info_v3 board_info_v3;
139 unsigned platform_version;
140 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
Chandan Uddaraju1434a602010-03-08 17:13:38 -0800141};
142
Ajay Dudanib01e5062011-12-03 23:23:42 -0800143struct smem_board_info_v5 {
144 struct smem_board_info_v3 board_info_v3;
145 unsigned platform_version;
146 unsigned fused_chip;
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800147};
148
Ajay Dudanib01e5062011-12-03 23:23:42 -0800149struct smem_board_info_v6 {
150 struct smem_board_info_v3 board_info_v3;
151 unsigned platform_version;
152 unsigned fused_chip;
153 unsigned platform_subtype;
154 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
Ajay Dudani6cff85e2011-02-04 16:02:16 -0800155};
156
Deepa Dinamania4ebcff2012-06-11 11:59:30 -0700157struct smem_board_info_v7 {
158 struct smem_board_info_v3 board_info_v3;
159 unsigned platform_version;
160 unsigned fused_chip;
161 unsigned platform_subtype;
162 unsigned pmic_type;
163 unsigned pmic_version;
164 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
165};
166
Channagoud Kadabi4b21e7f2013-02-15 11:55:38 -0800167struct smem_pmic_info {
168 unsigned pmic_type;
169 unsigned pmic_version;
170};
171
172struct smem_board_info_v8 {
173 struct smem_board_info_v3 board_info_v3;
174 unsigned platform_version;
175 unsigned fused_chip;
176 unsigned platform_subtype;
177 struct smem_pmic_info pmic_info[SMEM_V8_SMEM_MAX_PMIC_DEVICES];
178 /*
179 * Need for 8 bytes alignment
180 * while reading from shared memory
181 */
182 unsigned buffer_align;
183};
184
Ajay Dudanib01e5062011-12-03 23:23:42 -0800185typedef struct {
186 unsigned key_len;
187 unsigned iv_len;
188 unsigned char key[32];
189 unsigned char iv[32];
190} boot_symmetric_key_info;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700191
Ajay Dudanib01e5062011-12-03 23:23:42 -0800192typedef struct {
193 unsigned int update_status;
194 unsigned int bl_error_code;
195} boot_ssd_status;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700196
197#if PLATFORM_MSM7X30
198
Ajay Dudanib01e5062011-12-03 23:23:42 -0800199typedef struct {
200 boot_symmetric_key_info key_info;
201 uint32_t boot_flags;
202 uint32_t boot_key_press[5];
203 uint32_t time_tick;
204 boot_ssd_status status;
205 uint8_t buff_align[4];
206} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700207
208#elif PLATFORM_MSM7K
209
Ajay Dudanib01e5062011-12-03 23:23:42 -0800210typedef struct {
211 uint32_t apps_img_start_addr;
212 uint32_t boot_flags;
213 boot_ssd_status status;
214} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700215
216#elif PLATFORM_MSM7X27A
217
Ajay Dudanib01e5062011-12-03 23:23:42 -0800218typedef struct {
219 uint32_t apps_img_start_addr;
220 uint32_t boot_flags;
221 boot_ssd_status status;
222 boot_symmetric_key_info key_info;
223 uint16_t boot_key_press[10];
224 uint32_t timetick;
225 uint8_t PAD[28];
226} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700227
228#else
229
230/* Dummy structure to keep it for other targets */
Ajay Dudanib01e5062011-12-03 23:23:42 -0800231typedef struct {
232 uint32_t boot_flags;
233 boot_ssd_status status;
234} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700235
236#endif
237
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800238/* chip information */
239enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800240 UNKNOWN = 0,
241 MDM9200 = 57,
242 MDM9600 = 58,
243 MSM8260 = 70,
244 MSM8660 = 71,
245 APQ8060 = 86,
246 MSM8960 = 87,
247 MSM7225A = 88,
248 MSM7625A = 89,
249 MSM7227A = 90,
250 MSM7627A = 91,
251 ESM7227A = 92,
252 ESM7225A = 96,
253 ESM7627A = 97,
254 MSM7225AA = 98,
255 MSM7625AA = 99,
256 ESM7225AA = 100,
257 MSM7227AA = 101,
258 MSM7627AA = 102,
259 ESM7227AA = 103,
260 APQ8064 = 109,
261 MSM8930 = 116,
262 MSM8630 = 117,
263 MSM8230 = 118,
264 APQ8030 = 119,
265 MSM8627 = 120,
266 MSM8227 = 121,
267 MSM8660A = 122,
268 MSM8260A = 123,
269 APQ8060A = 124,
David Ngdc2d1a52013-02-12 18:11:56 -0800270 MSM8974 = 126,
Channagoud Kadabi3acfb742011-11-15 18:19:32 +0530271 MSM8225 = 127,
Ajay Dudani7d162542012-02-16 19:51:14 -0800272 MSM8625 = 129,
273 MPQ8064 = 130,
Channagoud Kadabibd14e2f2012-05-03 22:54:50 +0530274 MSM7225AB = 131,
275 MSM7625AB = 132,
276 ESM7225AB = 133,
Neeti Desai465491e2012-07-31 12:53:35 -0700277 MDM9625 = 134,
Channagoud Kadabi647f0852012-06-08 11:51:45 +0530278 MSM7125A = 135,
279 MSM7127A = 136,
Aparna Mallavarapu51879412012-08-27 12:55:50 +0530280 MSM8125A = 137,
Neeti Desai6e015252012-08-13 13:22:37 -0700281 MSM8960AB = 138,
282 APQ8060AB = 139,
283 MSM8260AB = 140,
284 MSM8660AB = 141,
Neeti Desai5ccd8642012-07-17 12:43:43 -0700285 MSM8930AA = 142,
286 MSM8630AA = 143,
287 MSM8230AA = 144,
Deepa Dinamani4069e742013-02-25 14:11:34 -0800288 MSM8626 = 145,
Aparna Mallavarapudd2dc802013-06-28 07:48:30 -0700289 MPQ8092 = 146,
Deepa Dinamanie5c9a472013-03-05 15:48:26 -0800290 MSM8610 = 147,
Amol Jadi117ef3a2012-09-20 13:32:55 -0700291 MDM9225 = 149,
292 MDM9225M = 150,
293 MDM9625M = 152,
294 APQ8064AB = 153, /* aka V2 PRIME */
Amol Jadi6d913742012-10-16 12:12:23 -0700295 MSM8930AB = 154,
296 MSM8630AB = 155,
297 MSM8230AB = 156,
298 APQ8030AB = 157,
Deepa Dinamani4069e742013-02-25 14:11:34 -0800299 MSM8226 = 158,
300 MSM8826 = 159,
Channagoud Kadabi512295f2012-10-23 10:00:42 +0530301 APQ8030AA = 160,
Deepa Dinamanie5c9a472013-03-05 15:48:26 -0800302 MSM8110 = 161,
303 MSM8210 = 162,
304 MSM8810 = 163,
David Ng909601c2013-04-19 20:21:30 -0700305 MSM8212 = 164,
Deepa Dinamanie33d14b2013-04-08 18:27:12 -0700306 MSM8612 = 165,
David Ng909601c2013-04-19 20:21:30 -0700307 MSM8812 = 166,
Aparna Mallavarapue07cfff2012-10-31 12:07:59 +0530308 MSM8125 = 167,
Aparna Mallavarapu5f098222013-03-20 18:31:35 +0530309 MDM9310 = 171,
Aparna Mallavarapu2269a2f2013-01-07 19:44:48 +0530310 APQ8064AA = 172, /* aka V2 SLOW_PRIME */
David Ng24df2e42013-08-21 23:31:50 -0700311 APQ8084 = 178,
David Ngdc2d1a52013-02-12 18:11:56 -0800312 MSM8130 = 179,
313 MSM8130AA = 180,
314 MSM8130AB = 181,
Aparna Mallavarapu751e4a22013-02-19 18:45:44 +0530315 MSM8627AA = 182,
316 MSM8227AA = 183,
Channagoud Kadabi3dc072f2013-02-21 22:29:02 -0800317 APQ8074 = 184,
Deepa Dinamani3449d992013-05-03 12:03:51 -0700318 MSM8274 = 185,
319 MSM8674 = 186,
Smita Solanki6bd7d5f2014-01-03 06:42:36 -0800320 MDM9635 = 187,
V S Ramanjaneya Kumar Tb75d2ae2013-08-02 10:54:56 +0530321 FSM9900 = 188,
V S Ramanjaneya Kumar Ta44a36a2013-12-03 13:53:48 +0530322 FSM9905 = 189,
323 FSM9955 = 190,
324 FSM9950 = 191,
325 FSM9915 = 192,
326 FSM9910 = 193,
Deepa Dinamani732e2052013-06-14 12:32:36 -0700327 MSM8974AC = 194,
Deepa Dinamanid96f9322013-05-21 12:41:54 -0700328 MSM8126 = 198,
329 APQ8026 = 199,
330 MSM8926 = 200,
331 MSM8326 = 205,
Aparna Mallavarapuadbf1592013-10-19 15:07:03 +0530332 MSM8916 = 206,
Channagoud Kadabi88e039a2014-04-14 14:02:12 -0700333 MSM8994 = 207,
Deepa Dinamani732e2052013-06-14 12:32:36 -0700334 APQ8074AA = 208,
335 APQ8074AB = 209,
336 APQ8074AC = 210,
337 MSM8274AA = 211,
338 MSM8274AB = 212,
339 MSM8274AC = 213,
340 MSM8674AA = 214,
341 MSM8674AB = 215,
342 MSM8674AC = 216,
343 MSM8974AA = 217,
344 MSM8974AB = 218,
Maria Yu083d7802013-09-02 18:11:23 +0800345 APQ8028 = 219,
346 MSM8128 = 220,
347 MSM8228 = 221,
348 MSM8528 = 222,
349 MSM8628 = 223,
350 MSM8928 = 224,
Deepa Dinamania3bf8b52013-09-12 11:00:37 -0700351 MSM8510 = 225,
352 MSM8512 = 226,
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800353};
354
Ajay Dudanib01e5062011-12-03 23:23:42 -0800355enum platform {
356 HW_PLATFORM_UNKNOWN = 0,
357 HW_PLATFORM_SURF = 1,
358 HW_PLATFORM_FFA = 2,
359 HW_PLATFORM_FLUID = 3,
360 HW_PLATFORM_SVLTE = 4,
361 HW_PLATFORM_QT = 6,
Amol Jadi6133e8d2012-10-07 22:15:02 -0700362 HW_PLATFORM_MTP_MDM = 7,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800363 HW_PLATFORM_MTP = 8,
364 HW_PLATFORM_LIQUID = 9,
365 HW_PLATFORM_DRAGON = 10,
Aparna Mallavarapu6af40f42013-03-04 16:58:23 +0530366 HW_PLATFORM_QRD = 11,
Ajay Dudani7d162542012-02-16 19:51:14 -0800367 HW_PLATFORM_HRD = 13,
368 HW_PLATFORM_DTV = 14,
V S Ramanjaneya Kumar Tc633fe12013-01-08 14:55:54 -0500369 HW_PLATFORM_RUMI = 15,
370 HW_PLATFORM_VIRTIO = 16,
371 HW_PLATFORM_BTS = 19,
Channagoud Kadabi33527cd2013-09-17 16:20:58 -0700372 HW_PLATFORM_RCM = 21,
Aparna Mallavarapu6145c432013-02-05 19:27:30 +0530373 HW_PLATFORM_DMA = 22,
Channagoud Kadabi33527cd2013-09-17 16:20:58 -0700374 HW_PLATFORM_STP = 23,
Eugene Yasman70f9e2e2013-12-11 10:40:57 +0200375 HW_PLATFORM_SBC = 24,
Neeti Desai465491e2012-07-31 12:53:35 -0700376 HW_PLATFORM_32BITS = 0x7FFFFFFF,
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800377};
378
Ajay Dudanib01e5062011-12-03 23:23:42 -0800379enum platform_subtype {
380 HW_PLATFORM_SUBTYPE_UNKNOWN = 0,
381 HW_PLATFORM_SUBTYPE_MDM = 1,
Channagoud Kadabied4b8dd2014-01-08 12:16:08 -0800382 HW_PLATFORM_SUBTYPE_8974PRO_PM8084 = 1,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800383 HW_PLATFORM_SUBTYPE_CSFB = 1,
384 HW_PLATFORM_SUBTYPE_SVLTE1 = 2,
385 HW_PLATFORM_SUBTYPE_SVLTE2A = 3,
Amol Jadi5c61a952012-05-04 17:05:35 -0700386 HW_PLATFORM_SUBTYPE_SGLTE = 6,
Channagoud Kadabi141f2982012-10-31 11:23:02 +0530387 HW_PLATFORM_SUBTYPE_DSDA = 7,
Amol Jadi9f04e7e2013-01-22 12:08:35 -0800388 HW_PLATFORM_SUBTYPE_DSDA2 = 8,
sundarajan srinivasan73d8df32013-02-28 17:03:27 -0800389 HW_PLATFORM_SUBTYPE_SGLTE2 = 9,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800390 HW_PLATFORM_SUBTYPE_32BITS = 0x7FFFFFFF
Ajay Dudani6cff85e2011-02-04 16:02:16 -0800391};
392
Dima Zavina404bce2009-01-26 12:32:22 -0800393typedef enum {
394 SMEM_SPINLOCK_ARRAY = 7,
395
396 SMEM_AARM_PARTITION_TABLE = 9,
397
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800398 SMEM_APPS_BOOT_MODE = 106,
Chandan Uddarajude85d3f2010-01-05 16:32:33 -0800399
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800400 SMEM_BOARD_INFO_LOCATION = 137,
Chandan Uddaraju885e4db2009-12-03 22:45:26 -0800401
Ajay Dudania1eafc42010-04-21 19:48:11 -0700402 SMEM_USABLE_RAM_PARTITION_TABLE = 402,
403
David Ngf773dde2010-07-26 19:55:08 -0700404 SMEM_POWER_ON_STATUS_INFO = 403,
405
Channagoud Kadabie1ecef52012-02-04 15:54:34 +0530406 SMEM_RLOCK_AREA = 404,
407
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700408 SMEM_BOOT_INFO_FOR_APPS = 418,
409
Dima Zavina404bce2009-01-26 12:32:22 -0800410 SMEM_FIRST_VALID_TYPE = SMEM_SPINLOCK_ARRAY,
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700411 SMEM_LAST_VALID_TYPE = SMEM_BOOT_INFO_FOR_APPS,
Neeti Desai800e84f2012-04-09 15:14:08 -0700412
413 SMEM_MAX_SIZE = SMEM_BOOT_INFO_FOR_APPS + 1,
Dima Zavina404bce2009-01-26 12:32:22 -0800414} smem_mem_type_t;
415
416/* Note: buf MUST be 4byte aligned, and max_len MUST be a multiple of 4. */
417unsigned smem_read_alloc_entry(smem_mem_type_t type, void *buf, int max_len);
418
Ajay Dudania1eafc42010-04-21 19:48:11 -0700419/* SMEM RAM Partition */
420enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800421 DEFAULT_ATTRB = ~0x0,
422 READ_ONLY = 0x0,
423 READWRITE,
Ajay Dudania1eafc42010-04-21 19:48:11 -0700424};
425
426enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800427 DEFAULT_CATEGORY = ~0x0,
428 SMI = 0x0,
429 EBI1,
430 EBI2,
431 QDSP6,
432 IRAM,
433 IMEM,
434 EBI0_CS0,
435 EBI0_CS1,
436 EBI1_CS0,
437 EBI1_CS1,
438 SDRAM = 0xE,
Ajay Dudania1eafc42010-04-21 19:48:11 -0700439};
440
441enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800442 DEFAULT_DOMAIN = 0x0,
443 APPS_DOMAIN,
444 MODEM_DOMAIN,
445 SHARED_DOMAIN,
Ajay Dudania1eafc42010-04-21 19:48:11 -0700446};
447
Ajay Dudanidfef90b2010-09-22 10:21:05 -0700448enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800449 SYS_MEMORY = 1, /* system memory */
450 BOOT_REGION_MEMORY1, /* boot loader memory 1 */
451 BOOT_REGION_MEMORY2, /* boot loader memory 2,reserved */
452 APPSBL_MEMORY, /* apps boot loader memory */
453 APPS_MEMORY, /* apps usage memory */
Ajay Dudanidfef90b2010-09-22 10:21:05 -0700454};
455
Neeti Desaid5b50552012-03-23 12:39:01 -0700456struct smem {
457 struct smem_proc_comm proc_comm[4];
458 unsigned version_info[32];
459 struct smem_heap_info heap_info;
Neeti Desai800e84f2012-04-09 15:14:08 -0700460 struct smem_alloc_info alloc_info[SMEM_MAX_SIZE];
Neeti Desaid5b50552012-03-23 12:39:01 -0700461};
462
Ajay Dudania1eafc42010-04-21 19:48:11 -0700463struct smem_ram_ptn {
464 char name[16];
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700465 uint32_t start;
466 uint32_t size;
467 uint32_t attr; /* RAM Partition attribute: READ_ONLY, READWRITE etc.*/
468 uint32_t category; /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */
469 uint32_t domain; /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */
470 uint32_t type; /* RAM Partition type: system, bootloader, appsboot, apps etc. */
471 uint32_t num_partitions;/* Number of memory partitions */
472 uint32_t reserved3;
473 uint32_t reserved4;
474 uint32_t reserved5;
475} __attribute__ ((__packed__));
Ajay Dudania1eafc42010-04-21 19:48:11 -0700476
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700477struct smem_ram_ptn_v1 {
478 char name[RAM_PART_NAME_LENGTH];
479 uint64_t start;
480 uint64_t size;
481 uint32_t attr; /* RAM Partition attribute: READ_ONLY, READWRITE etc.*/
482 uint32_t category; /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */
483 uint32_t domain; /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */
484 uint32_t type; /* RAM Partition type: system, bootloader, appsboot, apps etc. */
485 uint32_t num_partitions;/* Number of memory partitions */
486 uint32_t reserved3;
487 uint32_t reserved4; /* Reserved for future use */
488 uint32_t reserved5; /* Reserved for future use */
Ajay Dudania1eafc42010-04-21 19:48:11 -0700489} __attribute__ ((__packed__));
490
491struct smem_ram_ptable {
Ajay Dudania1eafc42010-04-21 19:48:11 -0700492 unsigned magic[2];
493 unsigned version;
494 unsigned reserved1;
495 unsigned len;
496 struct smem_ram_ptn parts[32];
497 unsigned buf;
498} __attribute__ ((__packed__));
499
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700500struct smem_ram_ptable_hdr
501{
502 uint32_t magic[2];
503 uint32_t version;
504 uint32_t reserved1;
505 uint32_t len;
506} __attribute__ ((__packed__));
507
508struct smem_ram_ptable_v1 {
509 struct smem_ram_ptable_hdr hdr;
510 uint32_t reserved2; /* Added for 8 bytes alignment of header */
511 struct smem_ram_ptn_v1 parts[RAM_NUM_PART_ENTRIES];
512} __attribute__ ((__packed__));
513
David Ngf773dde2010-07-26 19:55:08 -0700514/* Power on reason/status info */
Shashank Mittal6df16072011-07-14 18:44:01 -0700515#define PWR_ON_EVENT_RTC_ALARM 0x2
Ajay Dudaniba822332011-11-25 13:37:31 -0800516#define PWR_ON_EVENT_USB_CHG 0x20
517#define PWR_ON_EVENT_WALL_CHG 0x40
Greg Griscod2471ef2011-07-14 13:00:42 -0700518
Amol Jadi6133e8d2012-10-07 22:15:02 -0700519#define SMEM_PTABLE_MAX_PARTS_V3 16
520#define SMEM_PTABLE_MAX_PARTS_V4 32
521#define SMEM_PTABLE_MAX_PARTS SMEM_PTABLE_MAX_PARTS_V4
522
523#define SMEM_PTABLE_HDR_LEN (4*sizeof(unsigned))
524
525struct smem_ptn {
526 char name[16];
527 unsigned start;
528 unsigned size;
529 unsigned attr;
530} __attribute__ ((__packed__));
531
532
533struct smem_ptable {
534#define _SMEM_PTABLE_MAGIC_1 0x55ee73aa
535#define _SMEM_PTABLE_MAGIC_2 0xe35ebddb
536 unsigned magic[2];
537 unsigned version;
538 unsigned len;
539 struct smem_ptn parts[SMEM_PTABLE_MAX_PARTS];
540} __attribute__ ((__packed__));
541
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700542typedef struct smem_ram_ptable_v1 ram_partition_table;
543typedef struct smem_ram_ptn_v1 ram_partition;
544
Amol Jadi6133e8d2012-10-07 22:15:02 -0700545unsigned smem_read_alloc_entry_offset(smem_mem_type_t type, void *buf, int len, int offset);
Greg Griscod2471ef2011-07-14 13:00:42 -0700546int smem_ram_ptable_init(struct smem_ram_ptable *smem_ram_ptable);
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700547int smem_ram_ptable_init_v1(); /* Used on platforms that use ram ptable v1 */
548void smem_get_ram_ptable_entry(ram_partition*, uint32_t entry);
549uint32_t smem_get_ram_ptable_version(void);
550uint32_t smem_get_ram_ptable_len(void);
Ajay Dudanib01e5062011-12-03 23:23:42 -0800551#endif /* __PLATFORM_MSM_SHARED_SMEM_H */