blob: a5e97fb6f1f114f55d1aa4b177d28ca1802b9f32 [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 Srinivasan66951e52014-03-28 16:43:06 -070040#define SMEM_TARGET_INFO_IDENTIFIER 0x49494953
41
Ajay Dudanib01e5062011-12-03 23:23:42 -080042struct smem_proc_comm {
Dima Zavina404bce2009-01-26 12:32:22 -080043 unsigned command;
44 unsigned status;
45 unsigned data1;
46 unsigned data2;
47};
48
Ajay Dudanib01e5062011-12-03 23:23:42 -080049struct smem_heap_info {
Dima Zavina404bce2009-01-26 12:32:22 -080050 unsigned initialized;
51 unsigned free_offset;
52 unsigned heap_remaining;
53 unsigned reserved;
54};
55
Ajay Dudanib01e5062011-12-03 23:23:42 -080056struct smem_alloc_info {
Dima Zavina404bce2009-01-26 12:32:22 -080057 unsigned allocated;
58 unsigned offset;
59 unsigned size;
60 unsigned reserved;
61};
62
Ajay Dudanib01e5062011-12-03 23:23:42 -080063struct smem_board_info_v2 {
64 unsigned format;
65 unsigned msm_id;
66 unsigned msm_version;
67 char build_id[32];
68 unsigned raw_msm_id;
69 unsigned raw_msm_version;
Srilakshmi Punurucfb5a462011-02-08 11:55:24 -080070};
71
Deepa Dinamania4ebcff2012-06-11 11:59:30 -070072typedef enum
73{
74 PMIC_IS_PM6610,
75 PMIC_IS_PM6620,
76 PMIC_IS_PM6640,
77 PMIC_IS_PM6650,
78 PMIC_IS_PM7500,
79 PMIC_IS_PANORAMIX,
80 PMIC_IS_PM6652,
81 PMIC_IS_PM6653,
82 PMIC_IS_PM6658,
83 PMIC_IS_EPIC,
84 PMIC_IS_HAN,
85 PMIC_IS_KIP,
86 PMIC_IS_WOOKIE,
87 PMIC_IS_PM8058,
88 PMIC_IS_PM8028,
89 PMIC_IS_PM8901,
90 PMIC_IS_PM8027 ,
91 PMIC_IS_ISL_9519,
92 PMIC_IS_PM8921,
93 PMIC_IS_PM8018,
94 PMIC_IS_PM8015,
95 PMIC_IS_PM8014,
96 PMIC_IS_PM8821,
97 PMIC_IS_PM8038,
Deepa Dinamanib8b16432012-08-24 15:48:45 -070098 PMIC_IS_PM8922,
99 PMIC_IS_PM8917,
Channagoud Kadabi4b21e7f2013-02-15 11:55:38 -0800100 PMIC_IS_INVALID = 0x7fffffff,
101} pm_model_type_afly;
102
103typedef enum
104{
105 PMIC_IS_UNKNOWN = 0,
106 PMIC_IS_PM8941 = 1,
107 PMIC_IS_PM8841 = 2,
108 PMIC_IS_PM8019 = 3,
109 PMIC_IS_PM8026 = 4,
110 PMIC_IS_PM8110 = 5,
111} pm_model_type_bfly;
Deepa Dinamania4ebcff2012-06-11 11:59:30 -0700112
Ajay Dudanib01e5062011-12-03 23:23:42 -0800113struct smem_board_info_v3 {
114 unsigned format;
115 unsigned msm_id;
116 unsigned msm_version;
117 char build_id[32];
118 unsigned raw_msm_id;
119 unsigned raw_msm_version;
120 unsigned hw_platform;
Chandan Uddaraju885e4db2009-12-03 22:45:26 -0800121};
122
Ajay Dudanib01e5062011-12-03 23:23:42 -0800123struct smem_board_info_v4 {
124 struct smem_board_info_v3 board_info_v3;
125 unsigned platform_version;
126 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
Chandan Uddaraju1434a602010-03-08 17:13:38 -0800127};
128
Ajay Dudanib01e5062011-12-03 23:23:42 -0800129struct smem_board_info_v5 {
130 struct smem_board_info_v3 board_info_v3;
131 unsigned platform_version;
132 unsigned fused_chip;
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800133};
134
Ajay Dudanib01e5062011-12-03 23:23:42 -0800135struct smem_board_info_v6 {
136 struct smem_board_info_v3 board_info_v3;
137 unsigned platform_version;
138 unsigned fused_chip;
139 unsigned platform_subtype;
140 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
Ajay Dudani6cff85e2011-02-04 16:02:16 -0800141};
142
Deepa Dinamania4ebcff2012-06-11 11:59:30 -0700143struct smem_board_info_v7 {
144 struct smem_board_info_v3 board_info_v3;
145 unsigned platform_version;
146 unsigned fused_chip;
147 unsigned platform_subtype;
148 unsigned pmic_type;
149 unsigned pmic_version;
150 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
151};
152
Channagoud Kadabi4b21e7f2013-02-15 11:55:38 -0800153struct smem_pmic_info {
154 unsigned pmic_type;
155 unsigned pmic_version;
156};
157
158struct smem_board_info_v8 {
159 struct smem_board_info_v3 board_info_v3;
160 unsigned platform_version;
161 unsigned fused_chip;
162 unsigned platform_subtype;
163 struct smem_pmic_info pmic_info[SMEM_V8_SMEM_MAX_PMIC_DEVICES];
164 /*
165 * Need for 8 bytes alignment
166 * while reading from shared memory
167 */
168 unsigned buffer_align;
169};
170
Ajay Dudanib01e5062011-12-03 23:23:42 -0800171typedef struct {
172 unsigned key_len;
173 unsigned iv_len;
174 unsigned char key[32];
175 unsigned char iv[32];
176} boot_symmetric_key_info;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700177
Ajay Dudanib01e5062011-12-03 23:23:42 -0800178typedef struct {
179 unsigned int update_status;
180 unsigned int bl_error_code;
181} boot_ssd_status;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700182
183#if PLATFORM_MSM7X30
184
Ajay Dudanib01e5062011-12-03 23:23:42 -0800185typedef struct {
186 boot_symmetric_key_info key_info;
187 uint32_t boot_flags;
188 uint32_t boot_key_press[5];
189 uint32_t time_tick;
190 boot_ssd_status status;
191 uint8_t buff_align[4];
192} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700193
194#elif PLATFORM_MSM7K
195
Ajay Dudanib01e5062011-12-03 23:23:42 -0800196typedef struct {
197 uint32_t apps_img_start_addr;
198 uint32_t boot_flags;
199 boot_ssd_status status;
200} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700201
202#elif PLATFORM_MSM7X27A
203
Ajay Dudanib01e5062011-12-03 23:23:42 -0800204typedef struct {
205 uint32_t apps_img_start_addr;
206 uint32_t boot_flags;
207 boot_ssd_status status;
208 boot_symmetric_key_info key_info;
209 uint16_t boot_key_press[10];
210 uint32_t timetick;
211 uint8_t PAD[28];
212} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700213
214#else
215
216/* Dummy structure to keep it for other targets */
Ajay Dudanib01e5062011-12-03 23:23:42 -0800217typedef struct {
218 uint32_t boot_flags;
219 boot_ssd_status status;
220} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700221
222#endif
223
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800224/* chip information */
225enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800226 UNKNOWN = 0,
227 MDM9200 = 57,
228 MDM9600 = 58,
229 MSM8260 = 70,
230 MSM8660 = 71,
231 APQ8060 = 86,
232 MSM8960 = 87,
233 MSM7225A = 88,
234 MSM7625A = 89,
235 MSM7227A = 90,
236 MSM7627A = 91,
237 ESM7227A = 92,
238 ESM7225A = 96,
239 ESM7627A = 97,
240 MSM7225AA = 98,
241 MSM7625AA = 99,
242 ESM7225AA = 100,
243 MSM7227AA = 101,
244 MSM7627AA = 102,
245 ESM7227AA = 103,
246 APQ8064 = 109,
247 MSM8930 = 116,
248 MSM8630 = 117,
249 MSM8230 = 118,
250 APQ8030 = 119,
251 MSM8627 = 120,
252 MSM8227 = 121,
253 MSM8660A = 122,
254 MSM8260A = 123,
255 APQ8060A = 124,
David Ngdc2d1a52013-02-12 18:11:56 -0800256 MSM8974 = 126,
Channagoud Kadabi3acfb742011-11-15 18:19:32 +0530257 MSM8225 = 127,
Ajay Dudani7d162542012-02-16 19:51:14 -0800258 MSM8625 = 129,
259 MPQ8064 = 130,
Channagoud Kadabibd14e2f2012-05-03 22:54:50 +0530260 MSM7225AB = 131,
261 MSM7625AB = 132,
262 ESM7225AB = 133,
Neeti Desai465491e2012-07-31 12:53:35 -0700263 MDM9625 = 134,
Channagoud Kadabi647f0852012-06-08 11:51:45 +0530264 MSM7125A = 135,
265 MSM7127A = 136,
Aparna Mallavarapu51879412012-08-27 12:55:50 +0530266 MSM8125A = 137,
Neeti Desai6e015252012-08-13 13:22:37 -0700267 MSM8960AB = 138,
268 APQ8060AB = 139,
269 MSM8260AB = 140,
270 MSM8660AB = 141,
Neeti Desai5ccd8642012-07-17 12:43:43 -0700271 MSM8930AA = 142,
272 MSM8630AA = 143,
273 MSM8230AA = 144,
Deepa Dinamani4069e742013-02-25 14:11:34 -0800274 MSM8626 = 145,
Aparna Mallavarapudd2dc802013-06-28 07:48:30 -0700275 MPQ8092 = 146,
Deepa Dinamanie5c9a472013-03-05 15:48:26 -0800276 MSM8610 = 147,
Amol Jadi117ef3a2012-09-20 13:32:55 -0700277 MDM9225 = 149,
278 MDM9225M = 150,
279 MDM9625M = 152,
280 APQ8064AB = 153, /* aka V2 PRIME */
Amol Jadi6d913742012-10-16 12:12:23 -0700281 MSM8930AB = 154,
282 MSM8630AB = 155,
283 MSM8230AB = 156,
284 APQ8030AB = 157,
Deepa Dinamani4069e742013-02-25 14:11:34 -0800285 MSM8226 = 158,
286 MSM8826 = 159,
Channagoud Kadabi512295f2012-10-23 10:00:42 +0530287 APQ8030AA = 160,
Deepa Dinamanie5c9a472013-03-05 15:48:26 -0800288 MSM8110 = 161,
289 MSM8210 = 162,
290 MSM8810 = 163,
David Ng909601c2013-04-19 20:21:30 -0700291 MSM8212 = 164,
Deepa Dinamanie33d14b2013-04-08 18:27:12 -0700292 MSM8612 = 165,
David Ng909601c2013-04-19 20:21:30 -0700293 MSM8812 = 166,
Aparna Mallavarapue07cfff2012-10-31 12:07:59 +0530294 MSM8125 = 167,
Aparna Mallavarapu5f098222013-03-20 18:31:35 +0530295 MDM9310 = 171,
Aparna Mallavarapu2269a2f2013-01-07 19:44:48 +0530296 APQ8064AA = 172, /* aka V2 SLOW_PRIME */
David Ng24df2e42013-08-21 23:31:50 -0700297 APQ8084 = 178,
David Ngdc2d1a52013-02-12 18:11:56 -0800298 MSM8130 = 179,
299 MSM8130AA = 180,
300 MSM8130AB = 181,
Aparna Mallavarapu751e4a22013-02-19 18:45:44 +0530301 MSM8627AA = 182,
302 MSM8227AA = 183,
Channagoud Kadabi3dc072f2013-02-21 22:29:02 -0800303 APQ8074 = 184,
Deepa Dinamani3449d992013-05-03 12:03:51 -0700304 MSM8274 = 185,
305 MSM8674 = 186,
V S Ramanjaneya Kumar Tb75d2ae2013-08-02 10:54:56 +0530306 FSM9900 = 188,
Deepa Dinamani732e2052013-06-14 12:32:36 -0700307 MSM8974AC = 194,
Channagoud Kadabic56fd682013-05-16 16:11:00 -0700308 MSMSAMARIUM9 = 195,
309 MSMSAMARIUM2 = 196,
310 MSMSAMARIUM0 = 197,
Deepa Dinamanid96f9322013-05-21 12:41:54 -0700311 MSM8126 = 198,
312 APQ8026 = 199,
313 MSM8926 = 200,
314 MSM8326 = 205,
Deepa Dinamani732e2052013-06-14 12:32:36 -0700315 APQ8074AA = 208,
316 APQ8074AB = 209,
317 APQ8074AC = 210,
318 MSM8274AA = 211,
319 MSM8274AB = 212,
320 MSM8274AC = 213,
321 MSM8674AA = 214,
322 MSM8674AB = 215,
323 MSM8674AC = 216,
324 MSM8974AA = 217,
325 MSM8974AB = 218,
Maria Yu083d7802013-09-02 18:11:23 +0800326 APQ8028 = 219,
327 MSM8128 = 220,
328 MSM8228 = 221,
329 MSM8528 = 222,
330 MSM8628 = 223,
331 MSM8928 = 224,
Deepa Dinamani4c669d42013-09-12 11:00:37 -0700332 MSM8510 = 225,
333 MSM8512 = 226,
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800334};
335
Ajay Dudanib01e5062011-12-03 23:23:42 -0800336enum platform {
337 HW_PLATFORM_UNKNOWN = 0,
338 HW_PLATFORM_SURF = 1,
339 HW_PLATFORM_FFA = 2,
340 HW_PLATFORM_FLUID = 3,
341 HW_PLATFORM_SVLTE = 4,
342 HW_PLATFORM_QT = 6,
Amol Jadi6133e8d2012-10-07 22:15:02 -0700343 HW_PLATFORM_MTP_MDM = 7,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800344 HW_PLATFORM_MTP = 8,
345 HW_PLATFORM_LIQUID = 9,
346 HW_PLATFORM_DRAGON = 10,
Aparna Mallavarapu6af40f42013-03-04 16:58:23 +0530347 HW_PLATFORM_QRD = 11,
Ajay Dudani7d162542012-02-16 19:51:14 -0800348 HW_PLATFORM_HRD = 13,
349 HW_PLATFORM_DTV = 14,
V S Ramanjaneya Kumar Tc633fe12013-01-08 14:55:54 -0500350 HW_PLATFORM_RUMI = 15,
351 HW_PLATFORM_VIRTIO = 16,
352 HW_PLATFORM_BTS = 19,
Aparna Mallavarapu6145c432013-02-05 19:27:30 +0530353 HW_PLATFORM_DMA = 22,
Neeti Desai465491e2012-07-31 12:53:35 -0700354 HW_PLATFORM_32BITS = 0x7FFFFFFF,
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800355};
356
Ajay Dudanib01e5062011-12-03 23:23:42 -0800357enum platform_subtype {
358 HW_PLATFORM_SUBTYPE_UNKNOWN = 0,
359 HW_PLATFORM_SUBTYPE_MDM = 1,
360 HW_PLATFORM_SUBTYPE_CSFB = 1,
361 HW_PLATFORM_SUBTYPE_SVLTE1 = 2,
362 HW_PLATFORM_SUBTYPE_SVLTE2A = 3,
Amol Jadi5c61a952012-05-04 17:05:35 -0700363 HW_PLATFORM_SUBTYPE_SGLTE = 6,
Channagoud Kadabi141f2982012-10-31 11:23:02 +0530364 HW_PLATFORM_SUBTYPE_DSDA = 7,
Amol Jadi9f04e7e2013-01-22 12:08:35 -0800365 HW_PLATFORM_SUBTYPE_DSDA2 = 8,
sundarajan srinivasan73d8df32013-02-28 17:03:27 -0800366 HW_PLATFORM_SUBTYPE_SGLTE2 = 9,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800367 HW_PLATFORM_SUBTYPE_32BITS = 0x7FFFFFFF
Ajay Dudani6cff85e2011-02-04 16:02:16 -0800368};
369
Dima Zavina404bce2009-01-26 12:32:22 -0800370typedef enum {
371 SMEM_SPINLOCK_ARRAY = 7,
372
373 SMEM_AARM_PARTITION_TABLE = 9,
374
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800375 SMEM_APPS_BOOT_MODE = 106,
Chandan Uddarajude85d3f2010-01-05 16:32:33 -0800376
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800377 SMEM_BOARD_INFO_LOCATION = 137,
Chandan Uddaraju885e4db2009-12-03 22:45:26 -0800378
Ajay Dudania1eafc42010-04-21 19:48:11 -0700379 SMEM_USABLE_RAM_PARTITION_TABLE = 402,
380
David Ngf773dde2010-07-26 19:55:08 -0700381 SMEM_POWER_ON_STATUS_INFO = 403,
382
Channagoud Kadabie1ecef52012-02-04 15:54:34 +0530383 SMEM_RLOCK_AREA = 404,
384
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700385 SMEM_BOOT_INFO_FOR_APPS = 418,
386
Dima Zavina404bce2009-01-26 12:32:22 -0800387 SMEM_FIRST_VALID_TYPE = SMEM_SPINLOCK_ARRAY,
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700388 SMEM_LAST_VALID_TYPE = SMEM_BOOT_INFO_FOR_APPS,
Neeti Desai800e84f2012-04-09 15:14:08 -0700389
390 SMEM_MAX_SIZE = SMEM_BOOT_INFO_FOR_APPS + 1,
Dima Zavina404bce2009-01-26 12:32:22 -0800391} smem_mem_type_t;
392
393/* Note: buf MUST be 4byte aligned, and max_len MUST be a multiple of 4. */
394unsigned smem_read_alloc_entry(smem_mem_type_t type, void *buf, int max_len);
395
Ajay Dudania1eafc42010-04-21 19:48:11 -0700396/* SMEM RAM Partition */
397enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800398 DEFAULT_ATTRB = ~0x0,
399 READ_ONLY = 0x0,
400 READWRITE,
Ajay Dudania1eafc42010-04-21 19:48:11 -0700401};
402
403enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800404 DEFAULT_CATEGORY = ~0x0,
405 SMI = 0x0,
406 EBI1,
407 EBI2,
408 QDSP6,
409 IRAM,
410 IMEM,
411 EBI0_CS0,
412 EBI0_CS1,
413 EBI1_CS0,
414 EBI1_CS1,
415 SDRAM = 0xE,
Ajay Dudania1eafc42010-04-21 19:48:11 -0700416};
417
418enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800419 DEFAULT_DOMAIN = 0x0,
420 APPS_DOMAIN,
421 MODEM_DOMAIN,
422 SHARED_DOMAIN,
Ajay Dudania1eafc42010-04-21 19:48:11 -0700423};
424
Ajay Dudanidfef90b2010-09-22 10:21:05 -0700425enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800426 SYS_MEMORY = 1, /* system memory */
427 BOOT_REGION_MEMORY1, /* boot loader memory 1 */
428 BOOT_REGION_MEMORY2, /* boot loader memory 2,reserved */
429 APPSBL_MEMORY, /* apps boot loader memory */
430 APPS_MEMORY, /* apps usage memory */
Ajay Dudanidfef90b2010-09-22 10:21:05 -0700431};
432
Neeti Desaid5b50552012-03-23 12:39:01 -0700433struct smem {
434 struct smem_proc_comm proc_comm[4];
435 unsigned version_info[32];
436 struct smem_heap_info heap_info;
Neeti Desai800e84f2012-04-09 15:14:08 -0700437 struct smem_alloc_info alloc_info[SMEM_MAX_SIZE];
Neeti Desaid5b50552012-03-23 12:39:01 -0700438};
439
Ajay Dudania1eafc42010-04-21 19:48:11 -0700440struct smem_ram_ptn {
441 char name[16];
442 unsigned start;
443 unsigned size;
444
445 /* RAM Partition attribute: READ_ONLY, READWRITE etc. */
446 unsigned attr;
447
448 /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */
449 unsigned category;
450
451 /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */
452 unsigned domain;
453
Ajay Dudanidfef90b2010-09-22 10:21:05 -0700454 /* RAM Partition type: system, bootloader, appsboot, apps etc. */
455 unsigned type;
456
Ajay Dudania1eafc42010-04-21 19:48:11 -0700457 /* reserved for future expansion without changing version number */
Ajay Dudanidfef90b2010-09-22 10:21:05 -0700458 unsigned reserved2, reserved3, reserved4, reserved5;
Ajay Dudania1eafc42010-04-21 19:48:11 -0700459} __attribute__ ((__packed__));
460
461struct smem_ram_ptable {
462#define _SMEM_RAM_PTABLE_MAGIC_1 0x9DA5E0A8
463#define _SMEM_RAM_PTABLE_MAGIC_2 0xAF9EC4E2
464 unsigned magic[2];
465 unsigned version;
466 unsigned reserved1;
467 unsigned len;
468 struct smem_ram_ptn parts[32];
469 unsigned buf;
470} __attribute__ ((__packed__));
471
David Ngf773dde2010-07-26 19:55:08 -0700472/* Power on reason/status info */
Shashank Mittal6df16072011-07-14 18:44:01 -0700473#define PWR_ON_EVENT_RTC_ALARM 0x2
Ajay Dudaniba822332011-11-25 13:37:31 -0800474#define PWR_ON_EVENT_USB_CHG 0x20
475#define PWR_ON_EVENT_WALL_CHG 0x40
Greg Griscod2471ef2011-07-14 13:00:42 -0700476
Amol Jadi6133e8d2012-10-07 22:15:02 -0700477#define SMEM_PTABLE_MAX_PARTS_V3 16
478#define SMEM_PTABLE_MAX_PARTS_V4 32
479#define SMEM_PTABLE_MAX_PARTS SMEM_PTABLE_MAX_PARTS_V4
480
481#define SMEM_PTABLE_HDR_LEN (4*sizeof(unsigned))
482
483struct smem_ptn {
484 char name[16];
485 unsigned start;
486 unsigned size;
487 unsigned attr;
488} __attribute__ ((__packed__));
489
490
491struct smem_ptable {
492#define _SMEM_PTABLE_MAGIC_1 0x55ee73aa
493#define _SMEM_PTABLE_MAGIC_2 0xe35ebddb
494 unsigned magic[2];
495 unsigned version;
496 unsigned len;
497 struct smem_ptn parts[SMEM_PTABLE_MAX_PARTS];
498} __attribute__ ((__packed__));
499
500unsigned smem_read_alloc_entry_offset(smem_mem_type_t type, void *buf, int len, int offset);
Greg Griscod2471ef2011-07-14 13:00:42 -0700501int smem_ram_ptable_init(struct smem_ram_ptable *smem_ram_ptable);
502
Ajay Dudanib01e5062011-12-03 23:23:42 -0800503#endif /* __PLATFORM_MSM_SHARED_SMEM_H */