blob: 218fc38318fed3c158aa4d62cc082f8c09465057 [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,
Channagoud Kadabibd50bea2015-03-19 15:17:04 -070057 SMEM_RAM_PTABLE_VERSION_2,
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -070058};
59
Ajay Dudanib01e5062011-12-03 23:23:42 -080060struct smem_proc_comm {
Dima Zavina404bce2009-01-26 12:32:22 -080061 unsigned command;
62 unsigned status;
63 unsigned data1;
64 unsigned data2;
65};
66
Ajay Dudanib01e5062011-12-03 23:23:42 -080067struct smem_heap_info {
Dima Zavina404bce2009-01-26 12:32:22 -080068 unsigned initialized;
69 unsigned free_offset;
70 unsigned heap_remaining;
71 unsigned reserved;
72};
73
Ajay Dudanib01e5062011-12-03 23:23:42 -080074struct smem_alloc_info {
Dima Zavina404bce2009-01-26 12:32:22 -080075 unsigned allocated;
76 unsigned offset;
77 unsigned size;
Sundarajan Srinivasan28106e32014-07-24 16:39:58 -070078 unsigned base_ext;
Dima Zavina404bce2009-01-26 12:32:22 -080079};
80
Ajay Dudanib01e5062011-12-03 23:23:42 -080081struct smem_board_info_v2 {
82 unsigned format;
83 unsigned msm_id;
84 unsigned msm_version;
85 char build_id[32];
86 unsigned raw_msm_id;
87 unsigned raw_msm_version;
Srilakshmi Punurucfb5a462011-02-08 11:55:24 -080088};
89
Aparna Mallavarapu618bb612014-05-12 17:25:11 +053090struct smem_addr_info
91{
92 uint32_t identifier; /* Shared memory magic number */
93 uint32_t size; /* Shared memory Size */
94 uint32_t phy_addr; /* Shared memory Addr */
95};
96
Deepa Dinamania4ebcff2012-06-11 11:59:30 -070097typedef enum
98{
99 PMIC_IS_PM6610,
100 PMIC_IS_PM6620,
101 PMIC_IS_PM6640,
102 PMIC_IS_PM6650,
103 PMIC_IS_PM7500,
104 PMIC_IS_PANORAMIX,
105 PMIC_IS_PM6652,
106 PMIC_IS_PM6653,
107 PMIC_IS_PM6658,
108 PMIC_IS_EPIC,
109 PMIC_IS_HAN,
110 PMIC_IS_KIP,
111 PMIC_IS_WOOKIE,
112 PMIC_IS_PM8058,
113 PMIC_IS_PM8028,
114 PMIC_IS_PM8901,
115 PMIC_IS_PM8027 ,
116 PMIC_IS_ISL_9519,
117 PMIC_IS_PM8921,
118 PMIC_IS_PM8018,
119 PMIC_IS_PM8015,
120 PMIC_IS_PM8014,
121 PMIC_IS_PM8821,
122 PMIC_IS_PM8038,
Deepa Dinamanib8b16432012-08-24 15:48:45 -0700123 PMIC_IS_PM8922,
124 PMIC_IS_PM8917,
Channagoud Kadabi4b21e7f2013-02-15 11:55:38 -0800125 PMIC_IS_INVALID = 0x7fffffff,
126} pm_model_type_afly;
127
128typedef enum
129{
130 PMIC_IS_UNKNOWN = 0,
131 PMIC_IS_PM8941 = 1,
132 PMIC_IS_PM8841 = 2,
133 PMIC_IS_PM8019 = 3,
134 PMIC_IS_PM8026 = 4,
135 PMIC_IS_PM8110 = 5,
136} pm_model_type_bfly;
Deepa Dinamania4ebcff2012-06-11 11:59:30 -0700137
Ajay Dudanib01e5062011-12-03 23:23:42 -0800138struct smem_board_info_v3 {
139 unsigned format;
140 unsigned msm_id;
141 unsigned msm_version;
142 char build_id[32];
143 unsigned raw_msm_id;
144 unsigned raw_msm_version;
145 unsigned hw_platform;
Chandan Uddaraju885e4db2009-12-03 22:45:26 -0800146};
147
Ajay Dudanib01e5062011-12-03 23:23:42 -0800148struct smem_board_info_v4 {
149 struct smem_board_info_v3 board_info_v3;
150 unsigned platform_version;
151 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
Chandan Uddaraju1434a602010-03-08 17:13:38 -0800152};
153
Ajay Dudanib01e5062011-12-03 23:23:42 -0800154struct smem_board_info_v5 {
155 struct smem_board_info_v3 board_info_v3;
156 unsigned platform_version;
157 unsigned fused_chip;
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800158};
159
Ajay Dudanib01e5062011-12-03 23:23:42 -0800160struct smem_board_info_v6 {
161 struct smem_board_info_v3 board_info_v3;
162 unsigned platform_version;
163 unsigned fused_chip;
164 unsigned platform_subtype;
165 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
Ajay Dudani6cff85e2011-02-04 16:02:16 -0800166};
167
Deepa Dinamania4ebcff2012-06-11 11:59:30 -0700168struct smem_board_info_v7 {
169 struct smem_board_info_v3 board_info_v3;
170 unsigned platform_version;
171 unsigned fused_chip;
172 unsigned platform_subtype;
173 unsigned pmic_type;
174 unsigned pmic_version;
175 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
176};
177
Channagoud Kadabi4b21e7f2013-02-15 11:55:38 -0800178struct smem_pmic_info {
179 unsigned pmic_type;
180 unsigned pmic_version;
181};
182
183struct smem_board_info_v8 {
184 struct smem_board_info_v3 board_info_v3;
185 unsigned platform_version;
186 unsigned fused_chip;
187 unsigned platform_subtype;
188 struct smem_pmic_info pmic_info[SMEM_V8_SMEM_MAX_PMIC_DEVICES];
Sridhar Parasuramece28052014-11-18 09:03:08 -0800189};
190
191struct smem_board_info_v9 {
192 struct smem_board_info_v3 board_info_v3;
193 unsigned platform_version;
194 unsigned fused_chip;
195 unsigned platform_subtype;
196 struct smem_pmic_info pmic_info[SMEM_V8_SMEM_MAX_PMIC_DEVICES];
197 uint32_t foundry_id; /* Used as foundry_id only for v9 */
198};
199
200struct smem_board_info_v10 {
201 struct smem_board_info_v3 board_info_v3;
202 unsigned platform_version;
203 unsigned fused_chip;
204 unsigned platform_subtype;
205 struct smem_pmic_info pmic_info[SMEM_V8_SMEM_MAX_PMIC_DEVICES];
Sridhar Parasuramc5f035f2014-10-22 12:37:36 -0700206 uint32_t foundry_id; /* Used as foundry_id only for v9 */
207 uint32_t chip_serial; /* Used as serial number for v10 */
Channagoud Kadabi4b21e7f2013-02-15 11:55:38 -0800208};
209
Ajay Dudanib01e5062011-12-03 23:23:42 -0800210typedef struct {
211 unsigned key_len;
212 unsigned iv_len;
213 unsigned char key[32];
214 unsigned char iv[32];
215} boot_symmetric_key_info;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700216
Ajay Dudanib01e5062011-12-03 23:23:42 -0800217typedef struct {
218 unsigned int update_status;
219 unsigned int bl_error_code;
220} boot_ssd_status;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700221
222#if PLATFORM_MSM7X30
223
Ajay Dudanib01e5062011-12-03 23:23:42 -0800224typedef struct {
225 boot_symmetric_key_info key_info;
226 uint32_t boot_flags;
227 uint32_t boot_key_press[5];
228 uint32_t time_tick;
229 boot_ssd_status status;
230 uint8_t buff_align[4];
231} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700232
233#elif PLATFORM_MSM7K
234
Ajay Dudanib01e5062011-12-03 23:23:42 -0800235typedef struct {
236 uint32_t apps_img_start_addr;
237 uint32_t boot_flags;
238 boot_ssd_status status;
239} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700240
241#elif PLATFORM_MSM7X27A
242
Ajay Dudanib01e5062011-12-03 23:23:42 -0800243typedef struct {
244 uint32_t apps_img_start_addr;
245 uint32_t boot_flags;
246 boot_ssd_status status;
247 boot_symmetric_key_info key_info;
248 uint16_t boot_key_press[10];
249 uint32_t timetick;
250 uint8_t PAD[28];
251} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700252
253#else
254
255/* Dummy structure to keep it for other targets */
Ajay Dudanib01e5062011-12-03 23:23:42 -0800256typedef struct {
257 uint32_t boot_flags;
258 boot_ssd_status status;
259} boot_info_for_apps;
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700260
261#endif
262
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800263/* chip information */
264enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800265 UNKNOWN = 0,
266 MDM9200 = 57,
267 MDM9600 = 58,
268 MSM8260 = 70,
269 MSM8660 = 71,
270 APQ8060 = 86,
271 MSM8960 = 87,
272 MSM7225A = 88,
273 MSM7625A = 89,
274 MSM7227A = 90,
275 MSM7627A = 91,
276 ESM7227A = 92,
277 ESM7225A = 96,
278 ESM7627A = 97,
279 MSM7225AA = 98,
280 MSM7625AA = 99,
281 ESM7225AA = 100,
282 MSM7227AA = 101,
283 MSM7627AA = 102,
284 ESM7227AA = 103,
285 APQ8064 = 109,
286 MSM8930 = 116,
287 MSM8630 = 117,
288 MSM8230 = 118,
289 APQ8030 = 119,
290 MSM8627 = 120,
291 MSM8227 = 121,
292 MSM8660A = 122,
293 MSM8260A = 123,
294 APQ8060A = 124,
David Ngdc2d1a52013-02-12 18:11:56 -0800295 MSM8974 = 126,
Channagoud Kadabi3acfb742011-11-15 18:19:32 +0530296 MSM8225 = 127,
Ajay Dudani7d162542012-02-16 19:51:14 -0800297 MSM8625 = 129,
298 MPQ8064 = 130,
Channagoud Kadabibd14e2f2012-05-03 22:54:50 +0530299 MSM7225AB = 131,
300 MSM7625AB = 132,
301 ESM7225AB = 133,
Neeti Desai465491e2012-07-31 12:53:35 -0700302 MDM9625 = 134,
Channagoud Kadabi647f0852012-06-08 11:51:45 +0530303 MSM7125A = 135,
304 MSM7127A = 136,
Aparna Mallavarapu51879412012-08-27 12:55:50 +0530305 MSM8125A = 137,
Neeti Desai6e015252012-08-13 13:22:37 -0700306 MSM8960AB = 138,
307 APQ8060AB = 139,
308 MSM8260AB = 140,
309 MSM8660AB = 141,
Neeti Desai5ccd8642012-07-17 12:43:43 -0700310 MSM8930AA = 142,
311 MSM8630AA = 143,
312 MSM8230AA = 144,
Deepa Dinamani4069e742013-02-25 14:11:34 -0800313 MSM8626 = 145,
Deepa Dinamanie5c9a472013-03-05 15:48:26 -0800314 MSM8610 = 147,
Amol Jadi117ef3a2012-09-20 13:32:55 -0700315 MDM9225 = 149,
316 MDM9225M = 150,
317 MDM9625M = 152,
318 APQ8064AB = 153, /* aka V2 PRIME */
Amol Jadi6d913742012-10-16 12:12:23 -0700319 MSM8930AB = 154,
320 MSM8630AB = 155,
321 MSM8230AB = 156,
322 APQ8030AB = 157,
Deepa Dinamani4069e742013-02-25 14:11:34 -0800323 MSM8226 = 158,
324 MSM8826 = 159,
Channagoud Kadabi512295f2012-10-23 10:00:42 +0530325 APQ8030AA = 160,
Deepa Dinamanie5c9a472013-03-05 15:48:26 -0800326 MSM8110 = 161,
327 MSM8210 = 162,
328 MSM8810 = 163,
David Ng909601c2013-04-19 20:21:30 -0700329 MSM8212 = 164,
Deepa Dinamanie33d14b2013-04-08 18:27:12 -0700330 MSM8612 = 165,
David Ng909601c2013-04-19 20:21:30 -0700331 MSM8812 = 166,
Aparna Mallavarapue07cfff2012-10-31 12:07:59 +0530332 MSM8125 = 167,
Aparna Mallavarapu5f098222013-03-20 18:31:35 +0530333 MDM9310 = 171,
Aparna Mallavarapu2269a2f2013-01-07 19:44:48 +0530334 APQ8064AA = 172, /* aka V2 SLOW_PRIME */
David Ng24df2e42013-08-21 23:31:50 -0700335 APQ8084 = 178,
David Ngdc2d1a52013-02-12 18:11:56 -0800336 MSM8130 = 179,
337 MSM8130AA = 180,
338 MSM8130AB = 181,
Aparna Mallavarapu751e4a22013-02-19 18:45:44 +0530339 MSM8627AA = 182,
340 MSM8227AA = 183,
Channagoud Kadabi3dc072f2013-02-21 22:29:02 -0800341 APQ8074 = 184,
Deepa Dinamani3449d992013-05-03 12:03:51 -0700342 MSM8274 = 185,
343 MSM8674 = 186,
Smita Solanki6bd7d5f2014-01-03 06:42:36 -0800344 MDM9635 = 187,
V S Ramanjaneya Kumar Tb75d2ae2013-08-02 10:54:56 +0530345 FSM9900 = 188,
V S Ramanjaneya Kumar Ta44a36a2013-12-03 13:53:48 +0530346 FSM9905 = 189,
347 FSM9955 = 190,
348 FSM9950 = 191,
349 FSM9915 = 192,
350 FSM9910 = 193,
Deepa Dinamani732e2052013-06-14 12:32:36 -0700351 MSM8974AC = 194,
Deepa Dinamanid96f9322013-05-21 12:41:54 -0700352 MSM8126 = 198,
353 APQ8026 = 199,
354 MSM8926 = 200,
355 MSM8326 = 205,
Aparna Mallavarapuadbf1592013-10-19 15:07:03 +0530356 MSM8916 = 206,
Channagoud Kadabi88e039a2014-04-14 14:02:12 -0700357 MSM8994 = 207,
Deepa Dinamani732e2052013-06-14 12:32:36 -0700358 APQ8074AA = 208,
359 APQ8074AB = 209,
360 APQ8074AC = 210,
361 MSM8274AA = 211,
362 MSM8274AB = 212,
363 MSM8274AC = 213,
364 MSM8674AA = 214,
365 MSM8674AB = 215,
366 MSM8674AC = 216,
367 MSM8974AA = 217,
368 MSM8974AB = 218,
Maria Yu083d7802013-09-02 18:11:23 +0800369 APQ8028 = 219,
370 MSM8128 = 220,
371 MSM8228 = 221,
372 MSM8528 = 222,
373 MSM8628 = 223,
374 MSM8928 = 224,
Deepa Dinamania3bf8b52013-09-12 11:00:37 -0700375 MSM8510 = 225,
376 MSM8512 = 226,
Unnati Gandhi2b8064f2014-06-02 12:58:58 +0530377 MSM8936 = 233,
anisha agarwale29d3882014-11-25 16:02:03 -0800378 MDM9640 = 234,
Aparna Mallavarapuee7e6792014-02-02 19:07:16 +0530379 MSM8939 = 239,
380 APQ8036 = 240,
381 APQ8039 = 241,
382 MSM8236 = 242,
383 MSM8636 = 243,
Unnati Gandhiaf4bcb32014-07-07 11:17:39 +0530384 MSM8909 = 245,
Channagoud Kadabi6dba1c52014-06-27 15:35:09 -0700385 MSMTHULIUM = 246,
Aparna Mallavarapu407fdf82014-06-02 21:14:36 +0530386 APQ8016 = 247,
387 MSM8216 = 248,
388 MSM8116 = 249,
389 MSM8616 = 250,
Channagoud Kadabif0d4ad32014-08-28 15:48:21 -0700390 MSM8992 = 251,
391 APQ8092 = 252,
Channagoud Kadabic6a005b2014-07-12 13:02:55 -0700392 APQ8094 = 253,
Channagoud Kadabi868383e2014-07-10 15:06:57 -0400393 FSM9008 = 254,
394 FSM9010 = 255,
395 FSM9016 = 256,
396 FSM9055 = 257,
Unnati Gandhi26444442014-08-12 10:52:09 +0530397 MSM8209 = 258,
398 MSM8208 = 259,
399 MDM9209 = 260,
400 MDM9309 = 261,
401 MDM9609 = 262,
Aparna Mallavarapu1f8e5e02014-08-20 12:17:30 +0530402 MSM8239 = 263,
Unnati Gandhi60282612014-11-20 13:39:49 +0530403 APQ8009 = 265,
Aparna Mallavarapu05b9dad2015-03-03 20:36:33 +0530404 MSM8952 = 264,
405 MSM8956 = 266,
vijay kumar760fcdd2015-01-05 12:45:06 +0530406 MSM8929 = 268,
407 MSM8629 = 269,
408 MSM8229 = 270,
409 APQ8029 = 271,
Unnati Gandhidd372a52015-02-06 16:49:38 +0530410 MSM8609 = 275,
Channagoud Kadabi1c4d7a22015-02-11 11:21:36 -0500411 FSM9916 = 276,
Aparna Mallavarapu05b9dad2015-03-03 20:36:33 +0530412 MSM8976 = 278,
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800413};
414
Ajay Dudanib01e5062011-12-03 23:23:42 -0800415enum platform {
416 HW_PLATFORM_UNKNOWN = 0,
417 HW_PLATFORM_SURF = 1,
418 HW_PLATFORM_FFA = 2,
419 HW_PLATFORM_FLUID = 3,
420 HW_PLATFORM_SVLTE = 4,
421 HW_PLATFORM_QT = 6,
Amol Jadi6133e8d2012-10-07 22:15:02 -0700422 HW_PLATFORM_MTP_MDM = 7,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800423 HW_PLATFORM_MTP = 8,
424 HW_PLATFORM_LIQUID = 9,
425 HW_PLATFORM_DRAGON = 10,
Aparna Mallavarapu6af40f42013-03-04 16:58:23 +0530426 HW_PLATFORM_QRD = 11,
Ajay Dudani7d162542012-02-16 19:51:14 -0800427 HW_PLATFORM_HRD = 13,
428 HW_PLATFORM_DTV = 14,
V S Ramanjaneya Kumar Tc633fe12013-01-08 14:55:54 -0500429 HW_PLATFORM_RUMI = 15,
430 HW_PLATFORM_VIRTIO = 16,
431 HW_PLATFORM_BTS = 19,
Channagoud Kadabi33527cd2013-09-17 16:20:58 -0700432 HW_PLATFORM_RCM = 21,
Aparna Mallavarapu6145c432013-02-05 19:27:30 +0530433 HW_PLATFORM_DMA = 22,
Channagoud Kadabi33527cd2013-09-17 16:20:58 -0700434 HW_PLATFORM_STP = 23,
Eugene Yasman70f9e2e2013-12-11 10:40:57 +0200435 HW_PLATFORM_SBC = 24,
Neeti Desai465491e2012-07-31 12:53:35 -0700436 HW_PLATFORM_32BITS = 0x7FFFFFFF,
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800437};
438
Ajay Dudanib01e5062011-12-03 23:23:42 -0800439enum platform_subtype {
440 HW_PLATFORM_SUBTYPE_UNKNOWN = 0,
441 HW_PLATFORM_SUBTYPE_MDM = 1,
Channagoud Kadabied4b8dd2014-01-08 12:16:08 -0800442 HW_PLATFORM_SUBTYPE_8974PRO_PM8084 = 1,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800443 HW_PLATFORM_SUBTYPE_CSFB = 1,
444 HW_PLATFORM_SUBTYPE_SVLTE1 = 2,
445 HW_PLATFORM_SUBTYPE_SVLTE2A = 3,
Amol Jadi5c61a952012-05-04 17:05:35 -0700446 HW_PLATFORM_SUBTYPE_SGLTE = 6,
Channagoud Kadabi141f2982012-10-31 11:23:02 +0530447 HW_PLATFORM_SUBTYPE_DSDA = 7,
Amol Jadi9f04e7e2013-01-22 12:08:35 -0800448 HW_PLATFORM_SUBTYPE_DSDA2 = 8,
sundarajan srinivasan73d8df32013-02-28 17:03:27 -0800449 HW_PLATFORM_SUBTYPE_SGLTE2 = 9,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800450 HW_PLATFORM_SUBTYPE_32BITS = 0x7FFFFFFF
Ajay Dudani6cff85e2011-02-04 16:02:16 -0800451};
452
Dima Zavina404bce2009-01-26 12:32:22 -0800453typedef enum {
454 SMEM_SPINLOCK_ARRAY = 7,
Dima Zavina404bce2009-01-26 12:32:22 -0800455 SMEM_AARM_PARTITION_TABLE = 9,
Sundarajan Srinivasan28106e32014-07-24 16:39:58 -0700456 SMEM_CHANNEL_ALLOC_TBL = 13,
457 SMEM_SMD_BASE_ID = 14,
Dima Zavina404bce2009-01-26 12:32:22 -0800458
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800459 SMEM_APPS_BOOT_MODE = 106,
Chandan Uddarajude85d3f2010-01-05 16:32:33 -0800460
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800461 SMEM_BOARD_INFO_LOCATION = 137,
Chandan Uddaraju885e4db2009-12-03 22:45:26 -0800462
Sundarajan Srinivasan28106e32014-07-24 16:39:58 -0700463 SMEM_SMD_FIFO_BASE_ID = 338,
464
Ajay Dudania1eafc42010-04-21 19:48:11 -0700465 SMEM_USABLE_RAM_PARTITION_TABLE = 402,
466
David Ngf773dde2010-07-26 19:55:08 -0700467 SMEM_POWER_ON_STATUS_INFO = 403,
468
Channagoud Kadabie1ecef52012-02-04 15:54:34 +0530469 SMEM_RLOCK_AREA = 404,
470
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700471 SMEM_BOOT_INFO_FOR_APPS = 418,
472
Dima Zavina404bce2009-01-26 12:32:22 -0800473 SMEM_FIRST_VALID_TYPE = SMEM_SPINLOCK_ARRAY,
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700474 SMEM_LAST_VALID_TYPE = SMEM_BOOT_INFO_FOR_APPS,
Neeti Desai800e84f2012-04-09 15:14:08 -0700475
476 SMEM_MAX_SIZE = SMEM_BOOT_INFO_FOR_APPS + 1,
Dima Zavina404bce2009-01-26 12:32:22 -0800477} smem_mem_type_t;
478
479/* Note: buf MUST be 4byte aligned, and max_len MUST be a multiple of 4. */
480unsigned smem_read_alloc_entry(smem_mem_type_t type, void *buf, int max_len);
481
Ajay Dudania1eafc42010-04-21 19:48:11 -0700482/* SMEM RAM Partition */
483enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800484 DEFAULT_ATTRB = ~0x0,
485 READ_ONLY = 0x0,
486 READWRITE,
Ajay Dudania1eafc42010-04-21 19:48:11 -0700487};
488
489enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800490 DEFAULT_CATEGORY = ~0x0,
491 SMI = 0x0,
492 EBI1,
493 EBI2,
494 QDSP6,
495 IRAM,
496 IMEM,
497 EBI0_CS0,
498 EBI0_CS1,
499 EBI1_CS0,
500 EBI1_CS1,
501 SDRAM = 0xE,
Ajay Dudania1eafc42010-04-21 19:48:11 -0700502};
503
504enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800505 DEFAULT_DOMAIN = 0x0,
506 APPS_DOMAIN,
507 MODEM_DOMAIN,
508 SHARED_DOMAIN,
Ajay Dudania1eafc42010-04-21 19:48:11 -0700509};
510
Ajay Dudanidfef90b2010-09-22 10:21:05 -0700511enum {
Ajay Dudanib01e5062011-12-03 23:23:42 -0800512 SYS_MEMORY = 1, /* system memory */
513 BOOT_REGION_MEMORY1, /* boot loader memory 1 */
514 BOOT_REGION_MEMORY2, /* boot loader memory 2,reserved */
515 APPSBL_MEMORY, /* apps boot loader memory */
516 APPS_MEMORY, /* apps usage memory */
Ajay Dudanidfef90b2010-09-22 10:21:05 -0700517};
518
Neeti Desaid5b50552012-03-23 12:39:01 -0700519struct smem {
520 struct smem_proc_comm proc_comm[4];
521 unsigned version_info[32];
522 struct smem_heap_info heap_info;
Neeti Desai800e84f2012-04-09 15:14:08 -0700523 struct smem_alloc_info alloc_info[SMEM_MAX_SIZE];
Neeti Desaid5b50552012-03-23 12:39:01 -0700524};
525
Ajay Dudania1eafc42010-04-21 19:48:11 -0700526struct smem_ram_ptn {
527 char name[16];
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700528 uint32_t start;
529 uint32_t size;
530 uint32_t attr; /* RAM Partition attribute: READ_ONLY, READWRITE etc.*/
531 uint32_t category; /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */
532 uint32_t domain; /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */
533 uint32_t type; /* RAM Partition type: system, bootloader, appsboot, apps etc. */
534 uint32_t num_partitions;/* Number of memory partitions */
535 uint32_t reserved3;
536 uint32_t reserved4;
537 uint32_t reserved5;
538} __attribute__ ((__packed__));
Ajay Dudania1eafc42010-04-21 19:48:11 -0700539
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700540struct smem_ram_ptn_v1 {
541 char name[RAM_PART_NAME_LENGTH];
542 uint64_t start;
543 uint64_t size;
544 uint32_t attr; /* RAM Partition attribute: READ_ONLY, READWRITE etc.*/
545 uint32_t category; /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */
546 uint32_t domain; /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */
547 uint32_t type; /* RAM Partition type: system, bootloader, appsboot, apps etc. */
548 uint32_t num_partitions;/* Number of memory partitions */
549 uint32_t reserved3;
550 uint32_t reserved4; /* Reserved for future use */
551 uint32_t reserved5; /* Reserved for future use */
Ajay Dudania1eafc42010-04-21 19:48:11 -0700552} __attribute__ ((__packed__));
553
Channagoud Kadabibd50bea2015-03-19 15:17:04 -0700554struct smem_ram_ptn_v2 {
555 char name[RAM_PART_NAME_LENGTH];
556 uint64_t start;
557 uint64_t size;
558 uint32_t attr; /* RAM Partition attribute: READ_ONLY, READWRITE etc.*/
559 uint32_t category; /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */
560 uint32_t domain; /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */
561 uint32_t type; /* RAM Partition type: system, bootloader, appsboot, apps etc. */
562 uint32_t num_partitions;/* Number of memory partitions */
563 uint32_t hw_info; /* hw information such as type and frequency */
Channagoud Kadabi626a1d92015-03-25 15:20:31 -0700564 uint64_t reserved; /* Reserved for future use */
Channagoud Kadabibd50bea2015-03-19 15:17:04 -0700565 uint64_t available_length; /* Available partition length in RAM in bytes */
Channagoud Kadabibd50bea2015-03-19 15:17:04 -0700566} __attribute__ ((__packed__));
567
Ajay Dudania1eafc42010-04-21 19:48:11 -0700568struct smem_ram_ptable {
Ajay Dudania1eafc42010-04-21 19:48:11 -0700569 unsigned magic[2];
570 unsigned version;
571 unsigned reserved1;
572 unsigned len;
573 struct smem_ram_ptn parts[32];
574 unsigned buf;
575} __attribute__ ((__packed__));
576
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700577struct smem_ram_ptable_hdr
578{
579 uint32_t magic[2];
580 uint32_t version;
581 uint32_t reserved1;
582 uint32_t len;
583} __attribute__ ((__packed__));
584
585struct smem_ram_ptable_v1 {
586 struct smem_ram_ptable_hdr hdr;
587 uint32_t reserved2; /* Added for 8 bytes alignment of header */
588 struct smem_ram_ptn_v1 parts[RAM_NUM_PART_ENTRIES];
589} __attribute__ ((__packed__));
590
Channagoud Kadabibd50bea2015-03-19 15:17:04 -0700591struct smem_ram_ptable_v2 {
592 struct smem_ram_ptable_hdr hdr;
593 uint32_t reserved2; /* Added for 8 bytes alignment of header */
594 struct smem_ram_ptn_v2 parts[RAM_NUM_PART_ENTRIES];
595} __attribute__ ((__packed__));
596
David Ngf773dde2010-07-26 19:55:08 -0700597/* Power on reason/status info */
Shashank Mittal6df16072011-07-14 18:44:01 -0700598#define PWR_ON_EVENT_RTC_ALARM 0x2
Ajay Dudaniba822332011-11-25 13:37:31 -0800599#define PWR_ON_EVENT_USB_CHG 0x20
600#define PWR_ON_EVENT_WALL_CHG 0x40
Greg Griscod2471ef2011-07-14 13:00:42 -0700601
Amol Jadi6133e8d2012-10-07 22:15:02 -0700602#define SMEM_PTABLE_MAX_PARTS_V3 16
603#define SMEM_PTABLE_MAX_PARTS_V4 32
604#define SMEM_PTABLE_MAX_PARTS SMEM_PTABLE_MAX_PARTS_V4
605
606#define SMEM_PTABLE_HDR_LEN (4*sizeof(unsigned))
607
608struct smem_ptn {
609 char name[16];
610 unsigned start;
611 unsigned size;
612 unsigned attr;
613} __attribute__ ((__packed__));
614
615
616struct smem_ptable {
617#define _SMEM_PTABLE_MAGIC_1 0x55ee73aa
618#define _SMEM_PTABLE_MAGIC_2 0xe35ebddb
619 unsigned magic[2];
620 unsigned version;
621 unsigned len;
622 struct smem_ptn parts[SMEM_PTABLE_MAX_PARTS];
623} __attribute__ ((__packed__));
624
Channagoud Kadabibd50bea2015-03-19 15:17:04 -0700625typedef struct smem_ram_ptable_v2 ram_partition_table;
626typedef struct smem_ram_ptn_v2 ram_partition;
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700627
Amol Jadi6133e8d2012-10-07 22:15:02 -0700628unsigned smem_read_alloc_entry_offset(smem_mem_type_t type, void *buf, int len, int offset);
Greg Griscod2471ef2011-07-14 13:00:42 -0700629int smem_ram_ptable_init(struct smem_ram_ptable *smem_ram_ptable);
Sundarajan Srinivasanbd8a5712013-07-09 17:09:09 -0700630int smem_ram_ptable_init_v1(); /* Used on platforms that use ram ptable v1 */
631void smem_get_ram_ptable_entry(ram_partition*, uint32_t entry);
632uint32_t smem_get_ram_ptable_version(void);
633uint32_t smem_get_ram_ptable_len(void);
Sundarajan Srinivasan28106e32014-07-24 16:39:58 -0700634void* smem_get_alloc_entry(smem_mem_type_t type, uint32_t* size);
Ajay Dudanib01e5062011-12-03 23:23:42 -0800635#endif /* __PLATFORM_MSM_SHARED_SMEM_H */