blob: b3b6fedbaeafff104f0a9abeb572649a15cfd26b [file] [log] [blame]
Dima Zavina404bce2009-01-26 12:32:22 -08001/*
2 * Copyright (c) 2009, Google Inc.
3 * All rights reserved.
4 *
Aparna Mallavarapud3d2a2e2015-01-19 18:49:32 +05305 * Copyright (c) 2009-2015, 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>
vijay kumar4f4405f2014-08-08 11:49:53 +053035#include <platform.h>
Dima Zavina404bce2009-01-26 12:32:22 -080036
Channagoud Kadabi4b21e7f2013-02-15 11:55:38 -080037#define SMEM_V7_SMEM_MAX_PMIC_DEVICES 1
38#define SMEM_V8_SMEM_MAX_PMIC_DEVICES 3
39#define SMEM_MAX_PMIC_DEVICES SMEM_V8_SMEM_MAX_PMIC_DEVICES
40
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -070041#define SMEM_RAM_PTABLE_VERSION_OFFSET 8
42
43#define RAM_PART_NAME_LENGTH 16
44#define RAM_NUM_PART_ENTRIES 32
45
46#define _SMEM_RAM_PTABLE_MAGIC_1 0x9DA5E0A8
47#define _SMEM_RAM_PTABLE_MAGIC_2 0xAF9EC4E2
48
Sundarajan Srinivasan79e5f512014-03-28 16:43:06 -070049#define SMEM_TARGET_INFO_IDENTIFIER 0x49494953
50
Sundarajan Srinivasan28106e32014-07-24 16:39:58 -070051#define SMEM_NUM_SMD_STREAM_CHANNELS 64
52
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -070053enum smem_ram_ptable_version
54{
55 SMEM_RAM_PTABLE_VERSION_0,
56 SMEM_RAM_PTABLE_VERSION_1,
57};
58
Ajay Dudanib01e5062011-12-03 23:23:42 -080059struct smem_proc_comm {
Dima Zavina404bce2009-01-26 12:32:22 -080060 unsigned command;
61 unsigned status;
62 unsigned data1;
63 unsigned data2;
64};
65
Ajay Dudanib01e5062011-12-03 23:23:42 -080066struct smem_heap_info {
Dima Zavina404bce2009-01-26 12:32:22 -080067 unsigned initialized;
68 unsigned free_offset;
69 unsigned heap_remaining;
70 unsigned reserved;
71};
72
Ajay Dudanib01e5062011-12-03 23:23:42 -080073struct smem_alloc_info {
Dima Zavina404bce2009-01-26 12:32:22 -080074 unsigned allocated;
75 unsigned offset;
76 unsigned size;
Sundarajan Srinivasan28106e32014-07-24 16:39:58 -070077 unsigned base_ext;
Dima Zavina404bce2009-01-26 12:32:22 -080078};
79
Ajay Dudanib01e5062011-12-03 23:23:42 -080080struct smem_board_info_v2 {
81 unsigned format;
82 unsigned msm_id;
83 unsigned msm_version;
84 char build_id[32];
85 unsigned raw_msm_id;
86 unsigned raw_msm_version;
Srilakshmi Punurucfb5a462011-02-08 11:55:24 -080087};
88
Aparna Mallavarapu618bb612014-05-12 17:25:11 +053089struct smem_addr_info
90{
91 uint32_t identifier; /* Shared memory magic number */
92 uint32_t size; /* Shared memory Size */
93 uint32_t phy_addr; /* Shared memory Addr */
94};
95
Deepa Dinamania4ebcff2012-06-11 11:59:30 -070096typedef enum
97{
98 PMIC_IS_PM6610,
99 PMIC_IS_PM6620,
100 PMIC_IS_PM6640,
101 PMIC_IS_PM6650,
102 PMIC_IS_PM7500,
103 PMIC_IS_PANORAMIX,
104 PMIC_IS_PM6652,
105 PMIC_IS_PM6653,
106 PMIC_IS_PM6658,
107 PMIC_IS_EPIC,
108 PMIC_IS_HAN,
109 PMIC_IS_KIP,
110 PMIC_IS_WOOKIE,
111 PMIC_IS_PM8058,
112 PMIC_IS_PM8028,
113 PMIC_IS_PM8901,
114 PMIC_IS_PM8027 ,
115 PMIC_IS_ISL_9519,
116 PMIC_IS_PM8921,
117 PMIC_IS_PM8018,
118 PMIC_IS_PM8015,
119 PMIC_IS_PM8014,
120 PMIC_IS_PM8821,
121 PMIC_IS_PM8038,
Deepa Dinamanib8b16432012-08-24 15:48:45 -0700122 PMIC_IS_PM8922,
123 PMIC_IS_PM8917,
Channagoud Kadabi4b21e7f2013-02-15 11:55:38 -0800124 PMIC_IS_INVALID = 0x7fffffff,
125} pm_model_type_afly;
126
127typedef enum
128{
129 PMIC_IS_UNKNOWN = 0,
130 PMIC_IS_PM8941 = 1,
131 PMIC_IS_PM8841 = 2,
132 PMIC_IS_PM8019 = 3,
133 PMIC_IS_PM8026 = 4,
134 PMIC_IS_PM8110 = 5,
135} pm_model_type_bfly;
Deepa Dinamania4ebcff2012-06-11 11:59:30 -0700136
Ajay Dudanib01e5062011-12-03 23:23:42 -0800137struct smem_board_info_v3 {
138 unsigned format;
139 unsigned msm_id;
140 unsigned msm_version;
141 char build_id[32];
142 unsigned raw_msm_id;
143 unsigned raw_msm_version;
144 unsigned hw_platform;
Chandan Uddaraju885e4db2009-12-03 22:45:26 -0800145};
146
Ajay Dudanib01e5062011-12-03 23:23:42 -0800147struct smem_board_info_v4 {
148 struct smem_board_info_v3 board_info_v3;
149 unsigned platform_version;
150 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
Chandan Uddaraju1434a602010-03-08 17:13:38 -0800151};
152
Ajay Dudanib01e5062011-12-03 23:23:42 -0800153struct smem_board_info_v5 {
154 struct smem_board_info_v3 board_info_v3;
155 unsigned platform_version;
156 unsigned fused_chip;
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800157};
158
Ajay Dudanib01e5062011-12-03 23:23:42 -0800159struct smem_board_info_v6 {
160 struct smem_board_info_v3 board_info_v3;
161 unsigned platform_version;
162 unsigned fused_chip;
163 unsigned platform_subtype;
164 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
Ajay Dudani6cff85e2011-02-04 16:02:16 -0800165};
166
Deepa Dinamania4ebcff2012-06-11 11:59:30 -0700167struct smem_board_info_v7 {
168 struct smem_board_info_v3 board_info_v3;
169 unsigned platform_version;
170 unsigned fused_chip;
171 unsigned platform_subtype;
172 unsigned pmic_type;
173 unsigned pmic_version;
174 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
175};
176
Channagoud Kadabi4b21e7f2013-02-15 11:55:38 -0800177struct smem_pmic_info {
178 unsigned pmic_type;
179 unsigned pmic_version;
180};
181
182struct smem_board_info_v8 {
183 struct smem_board_info_v3 board_info_v3;
184 unsigned platform_version;
185 unsigned fused_chip;
186 unsigned platform_subtype;
187 struct smem_pmic_info pmic_info[SMEM_V8_SMEM_MAX_PMIC_DEVICES];
Sridhar Parasuramece28052014-11-18 09:03:08 -0800188};
189
190struct smem_board_info_v9 {
191 struct smem_board_info_v3 board_info_v3;
192 unsigned platform_version;
193 unsigned fused_chip;
194 unsigned platform_subtype;
195 struct smem_pmic_info pmic_info[SMEM_V8_SMEM_MAX_PMIC_DEVICES];
196 uint32_t foundry_id; /* Used as foundry_id only for v9 */
197};
198
199struct smem_board_info_v10 {
200 struct smem_board_info_v3 board_info_v3;
201 unsigned platform_version;
202 unsigned fused_chip;
203 unsigned platform_subtype;
204 struct smem_pmic_info pmic_info[SMEM_V8_SMEM_MAX_PMIC_DEVICES];
Sridhar Parasuramc5f035f2014-10-22 12:37:36 -0700205 uint32_t foundry_id; /* Used as foundry_id only for v9 */
206 uint32_t chip_serial; /* Used as serial number for v10 */
Channagoud Kadabi4b21e7f2013-02-15 11:55:38 -0800207};
208
Ajay Dudanib01e5062011-12-03 23:23:42 -0800209typedef struct {
210 unsigned key_len;
211 unsigned iv_len;
212 unsigned char key[32];
213 unsigned char iv[32];
214} boot_symmetric_key_info;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700215
Ajay Dudanib01e5062011-12-03 23:23:42 -0800216typedef struct {
217 unsigned int update_status;
218 unsigned int bl_error_code;
219} boot_ssd_status;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700220
221#if PLATFORM_MSM7X30
222
Ajay Dudanib01e5062011-12-03 23:23:42 -0800223typedef struct {
224 boot_symmetric_key_info key_info;
225 uint32_t boot_flags;
226 uint32_t boot_key_press[5];
227 uint32_t time_tick;
228 boot_ssd_status status;
229 uint8_t buff_align[4];
230} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700231
232#elif PLATFORM_MSM7K
233
Ajay Dudanib01e5062011-12-03 23:23:42 -0800234typedef struct {
235 uint32_t apps_img_start_addr;
236 uint32_t boot_flags;
237 boot_ssd_status status;
238} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700239
240#elif PLATFORM_MSM7X27A
241
Ajay Dudanib01e5062011-12-03 23:23:42 -0800242typedef struct {
243 uint32_t apps_img_start_addr;
244 uint32_t boot_flags;
245 boot_ssd_status status;
246 boot_symmetric_key_info key_info;
247 uint16_t boot_key_press[10];
248 uint32_t timetick;
249 uint8_t PAD[28];
250} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700251
252#else
253
254/* Dummy structure to keep it for other targets */
Ajay Dudanib01e5062011-12-03 23:23:42 -0800255typedef struct {
256 uint32_t boot_flags;
257 boot_ssd_status status;
258} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700259
260#endif
261
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800262/* chip information */
263enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800264 UNKNOWN = 0,
265 MDM9200 = 57,
266 MDM9600 = 58,
267 MSM8260 = 70,
268 MSM8660 = 71,
269 APQ8060 = 86,
270 MSM8960 = 87,
271 MSM7225A = 88,
272 MSM7625A = 89,
273 MSM7227A = 90,
274 MSM7627A = 91,
275 ESM7227A = 92,
276 ESM7225A = 96,
277 ESM7627A = 97,
278 MSM7225AA = 98,
279 MSM7625AA = 99,
280 ESM7225AA = 100,
281 MSM7227AA = 101,
282 MSM7627AA = 102,
283 ESM7227AA = 103,
284 APQ8064 = 109,
285 MSM8930 = 116,
286 MSM8630 = 117,
287 MSM8230 = 118,
288 APQ8030 = 119,
289 MSM8627 = 120,
290 MSM8227 = 121,
291 MSM8660A = 122,
292 MSM8260A = 123,
293 APQ8060A = 124,
David Ngdc2d1a52013-02-12 18:11:56 -0800294 MSM8974 = 126,
Channagoud Kadabi3acfb742011-11-15 18:19:32 +0530295 MSM8225 = 127,
Ajay Dudani7d162542012-02-16 19:51:14 -0800296 MSM8625 = 129,
297 MPQ8064 = 130,
Channagoud Kadabibd14e2f2012-05-03 22:54:50 +0530298 MSM7225AB = 131,
299 MSM7625AB = 132,
300 ESM7225AB = 133,
Neeti Desai465491e2012-07-31 12:53:35 -0700301 MDM9625 = 134,
Channagoud Kadabi647f0852012-06-08 11:51:45 +0530302 MSM7125A = 135,
303 MSM7127A = 136,
Aparna Mallavarapu51879412012-08-27 12:55:50 +0530304 MSM8125A = 137,
Neeti Desai6e015252012-08-13 13:22:37 -0700305 MSM8960AB = 138,
306 APQ8060AB = 139,
307 MSM8260AB = 140,
308 MSM8660AB = 141,
Neeti Desai5ccd8642012-07-17 12:43:43 -0700309 MSM8930AA = 142,
310 MSM8630AA = 143,
311 MSM8230AA = 144,
Deepa Dinamani4069e742013-02-25 14:11:34 -0800312 MSM8626 = 145,
Deepa Dinamanie5c9a472013-03-05 15:48:26 -0800313 MSM8610 = 147,
Amol Jadi117ef3a2012-09-20 13:32:55 -0700314 MDM9225 = 149,
315 MDM9225M = 150,
316 MDM9625M = 152,
317 APQ8064AB = 153, /* aka V2 PRIME */
Amol Jadi6d913742012-10-16 12:12:23 -0700318 MSM8930AB = 154,
319 MSM8630AB = 155,
320 MSM8230AB = 156,
321 APQ8030AB = 157,
Deepa Dinamani4069e742013-02-25 14:11:34 -0800322 MSM8226 = 158,
323 MSM8826 = 159,
Channagoud Kadabi512295f2012-10-23 10:00:42 +0530324 APQ8030AA = 160,
Deepa Dinamanie5c9a472013-03-05 15:48:26 -0800325 MSM8110 = 161,
326 MSM8210 = 162,
327 MSM8810 = 163,
David Ng909601c2013-04-19 20:21:30 -0700328 MSM8212 = 164,
Deepa Dinamanie33d14b2013-04-08 18:27:12 -0700329 MSM8612 = 165,
David Ng909601c2013-04-19 20:21:30 -0700330 MSM8812 = 166,
Aparna Mallavarapue07cfff2012-10-31 12:07:59 +0530331 MSM8125 = 167,
Aparna Mallavarapu5f098222013-03-20 18:31:35 +0530332 MDM9310 = 171,
Aparna Mallavarapu2269a2f2013-01-07 19:44:48 +0530333 APQ8064AA = 172, /* aka V2 SLOW_PRIME */
David Ng24df2e42013-08-21 23:31:50 -0700334 APQ8084 = 178,
David Ngdc2d1a52013-02-12 18:11:56 -0800335 MSM8130 = 179,
336 MSM8130AA = 180,
337 MSM8130AB = 181,
Aparna Mallavarapu751e4a22013-02-19 18:45:44 +0530338 MSM8627AA = 182,
339 MSM8227AA = 183,
Channagoud Kadabi3dc072f2013-02-21 22:29:02 -0800340 APQ8074 = 184,
Deepa Dinamani3449d992013-05-03 12:03:51 -0700341 MSM8274 = 185,
342 MSM8674 = 186,
Smita Solanki6bd7d5f2014-01-03 06:42:36 -0800343 MDM9635 = 187,
V S Ramanjaneya Kumar Tb75d2ae2013-08-02 10:54:56 +0530344 FSM9900 = 188,
V S Ramanjaneya Kumar Ta44a36a2013-12-03 13:53:48 +0530345 FSM9905 = 189,
346 FSM9955 = 190,
347 FSM9950 = 191,
348 FSM9915 = 192,
349 FSM9910 = 193,
Deepa Dinamani732e2052013-06-14 12:32:36 -0700350 MSM8974AC = 194,
Deepa Dinamanid96f9322013-05-21 12:41:54 -0700351 MSM8126 = 198,
352 APQ8026 = 199,
353 MSM8926 = 200,
354 MSM8326 = 205,
Aparna Mallavarapuadbf1592013-10-19 15:07:03 +0530355 MSM8916 = 206,
Channagoud Kadabi88e039a2014-04-14 14:02:12 -0700356 MSM8994 = 207,
Deepa Dinamani732e2052013-06-14 12:32:36 -0700357 APQ8074AA = 208,
358 APQ8074AB = 209,
359 APQ8074AC = 210,
360 MSM8274AA = 211,
361 MSM8274AB = 212,
362 MSM8274AC = 213,
363 MSM8674AA = 214,
364 MSM8674AB = 215,
365 MSM8674AC = 216,
366 MSM8974AA = 217,
367 MSM8974AB = 218,
Maria Yu083d7802013-09-02 18:11:23 +0800368 APQ8028 = 219,
369 MSM8128 = 220,
370 MSM8228 = 221,
371 MSM8528 = 222,
372 MSM8628 = 223,
373 MSM8928 = 224,
Deepa Dinamania3bf8b52013-09-12 11:00:37 -0700374 MSM8510 = 225,
375 MSM8512 = 226,
Unnati Gandhi2b8064f2014-06-02 12:58:58 +0530376 MSM8936 = 233,
anisha agarwale29d3882014-11-25 16:02:03 -0800377 MDM9640 = 234,
Aparna Mallavarapuee7e6792014-02-02 19:07:16 +0530378 MSM8939 = 239,
379 APQ8036 = 240,
380 APQ8039 = 241,
381 MSM8236 = 242,
382 MSM8636 = 243,
Unnati Gandhiaf4bcb32014-07-07 11:17:39 +0530383 MSM8909 = 245,
Channagoud Kadabi6dba1c52014-06-27 15:35:09 -0700384 MSMTHULIUM = 246,
Aparna Mallavarapu407fdf82014-06-02 21:14:36 +0530385 APQ8016 = 247,
386 MSM8216 = 248,
387 MSM8116 = 249,
388 MSM8616 = 250,
Channagoud Kadabif0d4ad32014-08-28 15:48:21 -0700389 MSM8992 = 251,
390 APQ8092 = 252,
Channagoud Kadabic6a005b2014-07-12 13:02:55 -0700391 APQ8094 = 253,
Channagoud Kadabi868383e2014-07-10 15:06:57 -0400392 FSM9008 = 254,
393 FSM9010 = 255,
394 FSM9016 = 256,
395 FSM9055 = 257,
Unnati Gandhi26444442014-08-12 10:52:09 +0530396 MSM8209 = 258,
397 MSM8208 = 259,
398 MDM9209 = 260,
399 MDM9309 = 261,
400 MDM9609 = 262,
Aparna Mallavarapu1f8e5e02014-08-20 12:17:30 +0530401 MSM8239 = 263,
Unnati Gandhi60282612014-11-20 13:39:49 +0530402 APQ8009 = 265,
Aparna Mallavarapu05b9dad2015-03-03 20:36:33 +0530403 MSM8952 = 264,
404 MSM8956 = 266,
vijay kumar760fcdd2015-01-05 12:45:06 +0530405 MSM8929 = 268,
406 MSM8629 = 269,
407 MSM8229 = 270,
408 APQ8029 = 271,
Unnati Gandhidd372a52015-02-06 16:49:38 +0530409 MSM8609 = 275,
Channagoud Kadabi1c4d7a22015-02-11 11:21:36 -0500410 FSM9916 = 276,
Aparna Mallavarapu05b9dad2015-03-03 20:36:33 +0530411 MSM8976 = 278,
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800412};
413
Ajay Dudanib01e5062011-12-03 23:23:42 -0800414enum platform {
415 HW_PLATFORM_UNKNOWN = 0,
416 HW_PLATFORM_SURF = 1,
417 HW_PLATFORM_FFA = 2,
418 HW_PLATFORM_FLUID = 3,
419 HW_PLATFORM_SVLTE = 4,
420 HW_PLATFORM_QT = 6,
Amol Jadi6133e8d2012-10-07 22:15:02 -0700421 HW_PLATFORM_MTP_MDM = 7,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800422 HW_PLATFORM_MTP = 8,
423 HW_PLATFORM_LIQUID = 9,
424 HW_PLATFORM_DRAGON = 10,
Aparna Mallavarapu6af40f42013-03-04 16:58:23 +0530425 HW_PLATFORM_QRD = 11,
Ajay Dudani7d162542012-02-16 19:51:14 -0800426 HW_PLATFORM_HRD = 13,
427 HW_PLATFORM_DTV = 14,
V S Ramanjaneya Kumar Tc633fe12013-01-08 14:55:54 -0500428 HW_PLATFORM_RUMI = 15,
429 HW_PLATFORM_VIRTIO = 16,
430 HW_PLATFORM_BTS = 19,
Channagoud Kadabi33527cd2013-09-17 16:20:58 -0700431 HW_PLATFORM_RCM = 21,
Aparna Mallavarapu6145c432013-02-05 19:27:30 +0530432 HW_PLATFORM_DMA = 22,
Channagoud Kadabi33527cd2013-09-17 16:20:58 -0700433 HW_PLATFORM_STP = 23,
Eugene Yasman70f9e2e2013-12-11 10:40:57 +0200434 HW_PLATFORM_SBC = 24,
Neeti Desai465491e2012-07-31 12:53:35 -0700435 HW_PLATFORM_32BITS = 0x7FFFFFFF,
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800436};
437
Ajay Dudanib01e5062011-12-03 23:23:42 -0800438enum platform_subtype {
439 HW_PLATFORM_SUBTYPE_UNKNOWN = 0,
440 HW_PLATFORM_SUBTYPE_MDM = 1,
Channagoud Kadabied4b8dd2014-01-08 12:16:08 -0800441 HW_PLATFORM_SUBTYPE_8974PRO_PM8084 = 1,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800442 HW_PLATFORM_SUBTYPE_CSFB = 1,
443 HW_PLATFORM_SUBTYPE_SVLTE1 = 2,
444 HW_PLATFORM_SUBTYPE_SVLTE2A = 3,
Amol Jadi5c61a952012-05-04 17:05:35 -0700445 HW_PLATFORM_SUBTYPE_SGLTE = 6,
Channagoud Kadabi141f2982012-10-31 11:23:02 +0530446 HW_PLATFORM_SUBTYPE_DSDA = 7,
Amol Jadi9f04e7e2013-01-22 12:08:35 -0800447 HW_PLATFORM_SUBTYPE_DSDA2 = 8,
sundarajan srinivasan73d8df32013-02-28 17:03:27 -0800448 HW_PLATFORM_SUBTYPE_SGLTE2 = 9,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800449 HW_PLATFORM_SUBTYPE_32BITS = 0x7FFFFFFF
Ajay Dudani6cff85e2011-02-04 16:02:16 -0800450};
451
Dima Zavina404bce2009-01-26 12:32:22 -0800452typedef enum {
453 SMEM_SPINLOCK_ARRAY = 7,
Dima Zavina404bce2009-01-26 12:32:22 -0800454 SMEM_AARM_PARTITION_TABLE = 9,
Sundarajan Srinivasan28106e32014-07-24 16:39:58 -0700455 SMEM_CHANNEL_ALLOC_TBL = 13,
456 SMEM_SMD_BASE_ID = 14,
Dima Zavina404bce2009-01-26 12:32:22 -0800457
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800458 SMEM_APPS_BOOT_MODE = 106,
Chandan Uddarajude85d3f2010-01-05 16:32:33 -0800459
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800460 SMEM_BOARD_INFO_LOCATION = 137,
Chandan Uddaraju885e4db2009-12-03 22:45:26 -0800461
Sundarajan Srinivasan28106e32014-07-24 16:39:58 -0700462 SMEM_SMD_FIFO_BASE_ID = 338,
463
Ajay Dudania1eafc42010-04-21 19:48:11 -0700464 SMEM_USABLE_RAM_PARTITION_TABLE = 402,
465
David Ngf773dde2010-07-26 19:55:08 -0700466 SMEM_POWER_ON_STATUS_INFO = 403,
467
Channagoud Kadabie1ecef52012-02-04 15:54:34 +0530468 SMEM_RLOCK_AREA = 404,
469
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700470 SMEM_BOOT_INFO_FOR_APPS = 418,
471
Dima Zavina404bce2009-01-26 12:32:22 -0800472 SMEM_FIRST_VALID_TYPE = SMEM_SPINLOCK_ARRAY,
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700473 SMEM_LAST_VALID_TYPE = SMEM_BOOT_INFO_FOR_APPS,
Neeti Desai800e84f2012-04-09 15:14:08 -0700474
475 SMEM_MAX_SIZE = SMEM_BOOT_INFO_FOR_APPS + 1,
Dima Zavina404bce2009-01-26 12:32:22 -0800476} smem_mem_type_t;
477
478/* Note: buf MUST be 4byte aligned, and max_len MUST be a multiple of 4. */
479unsigned smem_read_alloc_entry(smem_mem_type_t type, void *buf, int max_len);
480
Ajay Dudania1eafc42010-04-21 19:48:11 -0700481/* SMEM RAM Partition */
482enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800483 DEFAULT_ATTRB = ~0x0,
484 READ_ONLY = 0x0,
485 READWRITE,
Ajay Dudania1eafc42010-04-21 19:48:11 -0700486};
487
488enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800489 DEFAULT_CATEGORY = ~0x0,
490 SMI = 0x0,
491 EBI1,
492 EBI2,
493 QDSP6,
494 IRAM,
495 IMEM,
496 EBI0_CS0,
497 EBI0_CS1,
498 EBI1_CS0,
499 EBI1_CS1,
500 SDRAM = 0xE,
Ajay Dudania1eafc42010-04-21 19:48:11 -0700501};
502
503enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800504 DEFAULT_DOMAIN = 0x0,
505 APPS_DOMAIN,
506 MODEM_DOMAIN,
507 SHARED_DOMAIN,
Ajay Dudania1eafc42010-04-21 19:48:11 -0700508};
509
Ajay Dudanidfef90b2010-09-22 10:21:05 -0700510enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800511 SYS_MEMORY = 1, /* system memory */
512 BOOT_REGION_MEMORY1, /* boot loader memory 1 */
513 BOOT_REGION_MEMORY2, /* boot loader memory 2,reserved */
514 APPSBL_MEMORY, /* apps boot loader memory */
515 APPS_MEMORY, /* apps usage memory */
Ajay Dudanidfef90b2010-09-22 10:21:05 -0700516};
517
Neeti Desaid5b50552012-03-23 12:39:01 -0700518struct smem {
519 struct smem_proc_comm proc_comm[4];
520 unsigned version_info[32];
521 struct smem_heap_info heap_info;
Neeti Desai800e84f2012-04-09 15:14:08 -0700522 struct smem_alloc_info alloc_info[SMEM_MAX_SIZE];
Neeti Desaid5b50552012-03-23 12:39:01 -0700523};
524
Ajay Dudania1eafc42010-04-21 19:48:11 -0700525struct smem_ram_ptn {
526 char name[16];
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700527 uint32_t start;
528 uint32_t size;
529 uint32_t attr; /* RAM Partition attribute: READ_ONLY, READWRITE etc.*/
530 uint32_t category; /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */
531 uint32_t domain; /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */
532 uint32_t type; /* RAM Partition type: system, bootloader, appsboot, apps etc. */
533 uint32_t num_partitions;/* Number of memory partitions */
534 uint32_t reserved3;
535 uint32_t reserved4;
536 uint32_t reserved5;
537} __attribute__ ((__packed__));
Ajay Dudania1eafc42010-04-21 19:48:11 -0700538
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700539struct smem_ram_ptn_v1 {
540 char name[RAM_PART_NAME_LENGTH];
541 uint64_t start;
542 uint64_t size;
543 uint32_t attr; /* RAM Partition attribute: READ_ONLY, READWRITE etc.*/
544 uint32_t category; /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */
545 uint32_t domain; /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */
546 uint32_t type; /* RAM Partition type: system, bootloader, appsboot, apps etc. */
547 uint32_t num_partitions;/* Number of memory partitions */
548 uint32_t reserved3;
549 uint32_t reserved4; /* Reserved for future use */
550 uint32_t reserved5; /* Reserved for future use */
Ajay Dudania1eafc42010-04-21 19:48:11 -0700551} __attribute__ ((__packed__));
552
553struct smem_ram_ptable {
Ajay Dudania1eafc42010-04-21 19:48:11 -0700554 unsigned magic[2];
555 unsigned version;
556 unsigned reserved1;
557 unsigned len;
558 struct smem_ram_ptn parts[32];
559 unsigned buf;
560} __attribute__ ((__packed__));
561
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700562struct smem_ram_ptable_hdr
563{
564 uint32_t magic[2];
565 uint32_t version;
566 uint32_t reserved1;
567 uint32_t len;
568} __attribute__ ((__packed__));
569
570struct smem_ram_ptable_v1 {
571 struct smem_ram_ptable_hdr hdr;
572 uint32_t reserved2; /* Added for 8 bytes alignment of header */
573 struct smem_ram_ptn_v1 parts[RAM_NUM_PART_ENTRIES];
574} __attribute__ ((__packed__));
575
David Ngf773dde2010-07-26 19:55:08 -0700576/* Power on reason/status info */
Shashank Mittal6df16072011-07-14 18:44:01 -0700577#define PWR_ON_EVENT_RTC_ALARM 0x2
Ajay Dudaniba822332011-11-25 13:37:31 -0800578#define PWR_ON_EVENT_USB_CHG 0x20
579#define PWR_ON_EVENT_WALL_CHG 0x40
Greg Griscod2471ef2011-07-14 13:00:42 -0700580
Amol Jadi6133e8d2012-10-07 22:15:02 -0700581#define SMEM_PTABLE_MAX_PARTS_V3 16
582#define SMEM_PTABLE_MAX_PARTS_V4 32
583#define SMEM_PTABLE_MAX_PARTS SMEM_PTABLE_MAX_PARTS_V4
584
585#define SMEM_PTABLE_HDR_LEN (4*sizeof(unsigned))
586
587struct smem_ptn {
588 char name[16];
589 unsigned start;
590 unsigned size;
591 unsigned attr;
592} __attribute__ ((__packed__));
593
594
595struct smem_ptable {
596#define _SMEM_PTABLE_MAGIC_1 0x55ee73aa
597#define _SMEM_PTABLE_MAGIC_2 0xe35ebddb
598 unsigned magic[2];
599 unsigned version;
600 unsigned len;
601 struct smem_ptn parts[SMEM_PTABLE_MAX_PARTS];
602} __attribute__ ((__packed__));
603
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700604typedef struct smem_ram_ptable_v1 ram_partition_table;
605typedef struct smem_ram_ptn_v1 ram_partition;
606
Amol Jadi6133e8d2012-10-07 22:15:02 -0700607unsigned smem_read_alloc_entry_offset(smem_mem_type_t type, void *buf, int len, int offset);
Greg Griscod2471ef2011-07-14 13:00:42 -0700608int smem_ram_ptable_init(struct smem_ram_ptable *smem_ram_ptable);
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700609int smem_ram_ptable_init_v1(); /* Used on platforms that use ram ptable v1 */
610void smem_get_ram_ptable_entry(ram_partition*, uint32_t entry);
611uint32_t smem_get_ram_ptable_version(void);
612uint32_t smem_get_ram_ptable_len(void);
Sundarajan Srinivasan28106e32014-07-24 16:39:58 -0700613void* smem_get_alloc_entry(smem_mem_type_t type, uint32_t* size);
Ajay Dudanib01e5062011-12-03 23:23:42 -0800614#endif /* __PLATFORM_MSM_SHARED_SMEM_H */