Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2009, Google Inc. |
| 3 | * All rights reserved. |
| 4 | * |
Umang Agrawal | e640c65 | 2017-12-19 12:04:07 +0530 | [diff] [blame] | 5 | * Copyright (c) 2009-2018, The Linux Foundation. All rights reserved. |
Chandan Uddaraju | 885e4db | 2009-12-03 22:45:26 -0800 | [diff] [blame] | 6 | * |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 7 | * 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 Jadi | 5c61a95 | 2012-05-04 17:05:35 -0700 | [diff] [blame] | 14 | * the documentation and/or other materials provided with the |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 15 | * 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 Jadi | 5c61a95 | 2012-05-04 17:05:35 -0700 | [diff] [blame] | 24 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 25 | * 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 kumar | 4f4405f | 2014-08-08 11:49:53 +0530 | [diff] [blame] | 35 | #include <platform.h> |
Sridhar Parasuram | 701c830 | 2015-06-15 11:03:14 -0700 | [diff] [blame] | 36 | #include <malloc.h> |
| 37 | #include <string.h> |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 38 | |
Channagoud Kadabi | 4b21e7f | 2013-02-15 11:55:38 -0800 | [diff] [blame] | 39 | #define SMEM_V7_SMEM_MAX_PMIC_DEVICES 1 |
| 40 | #define SMEM_V8_SMEM_MAX_PMIC_DEVICES 3 |
Sridhar Parasuram | 701c830 | 2015-06-15 11:03:14 -0700 | [diff] [blame] | 41 | #define SMEM_V11_SMEM_MAX_PMIC_DEVICES 4 // this is the max that device tree currently supports |
| 42 | #define SMEM_MAX_PMIC_DEVICES SMEM_V11_SMEM_MAX_PMIC_DEVICES |
Channagoud Kadabi | 4b21e7f | 2013-02-15 11:55:38 -0800 | [diff] [blame] | 43 | |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 44 | #define SMEM_RAM_PTABLE_VERSION_OFFSET 8 |
| 45 | |
| 46 | #define RAM_PART_NAME_LENGTH 16 |
| 47 | #define RAM_NUM_PART_ENTRIES 32 |
| 48 | |
| 49 | #define _SMEM_RAM_PTABLE_MAGIC_1 0x9DA5E0A8 |
| 50 | #define _SMEM_RAM_PTABLE_MAGIC_2 0xAF9EC4E2 |
| 51 | |
Sundarajan Srinivasan | 79e5f51 | 2014-03-28 16:43:06 -0700 | [diff] [blame] | 52 | #define SMEM_TARGET_INFO_IDENTIFIER 0x49494953 |
| 53 | |
Sundarajan Srinivasan | 28106e3 | 2014-07-24 16:39:58 -0700 | [diff] [blame] | 54 | #define SMEM_NUM_SMD_STREAM_CHANNELS 64 |
| 55 | |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 56 | enum smem_ram_ptable_version |
| 57 | { |
| 58 | SMEM_RAM_PTABLE_VERSION_0, |
| 59 | SMEM_RAM_PTABLE_VERSION_1, |
Channagoud Kadabi | bd50bea | 2015-03-19 15:17:04 -0700 | [diff] [blame] | 60 | SMEM_RAM_PTABLE_VERSION_2, |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 61 | }; |
| 62 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 63 | struct smem_proc_comm { |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 64 | unsigned command; |
| 65 | unsigned status; |
| 66 | unsigned data1; |
| 67 | unsigned data2; |
| 68 | }; |
| 69 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 70 | struct smem_heap_info { |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 71 | unsigned initialized; |
| 72 | unsigned free_offset; |
| 73 | unsigned heap_remaining; |
| 74 | unsigned reserved; |
| 75 | }; |
| 76 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 77 | struct smem_alloc_info { |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 78 | unsigned allocated; |
| 79 | unsigned offset; |
| 80 | unsigned size; |
Sundarajan Srinivasan | 28106e3 | 2014-07-24 16:39:58 -0700 | [diff] [blame] | 81 | unsigned base_ext; |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 82 | }; |
| 83 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 84 | struct smem_board_info_v2 { |
| 85 | unsigned format; |
| 86 | unsigned msm_id; |
| 87 | unsigned msm_version; |
| 88 | char build_id[32]; |
| 89 | unsigned raw_msm_id; |
| 90 | unsigned raw_msm_version; |
Srilakshmi Punuru | cfb5a46 | 2011-02-08 11:55:24 -0800 | [diff] [blame] | 91 | }; |
| 92 | |
Aparna Mallavarapu | 618bb61 | 2014-05-12 17:25:11 +0530 | [diff] [blame] | 93 | struct smem_addr_info |
| 94 | { |
| 95 | uint32_t identifier; /* Shared memory magic number */ |
| 96 | uint32_t size; /* Shared memory Size */ |
| 97 | uint32_t phy_addr; /* Shared memory Addr */ |
| 98 | }; |
| 99 | |
Deepa Dinamani | a4ebcff | 2012-06-11 11:59:30 -0700 | [diff] [blame] | 100 | typedef enum |
| 101 | { |
| 102 | PMIC_IS_PM6610, |
| 103 | PMIC_IS_PM6620, |
| 104 | PMIC_IS_PM6640, |
| 105 | PMIC_IS_PM6650, |
| 106 | PMIC_IS_PM7500, |
| 107 | PMIC_IS_PANORAMIX, |
| 108 | PMIC_IS_PM6652, |
| 109 | PMIC_IS_PM6653, |
| 110 | PMIC_IS_PM6658, |
| 111 | PMIC_IS_EPIC, |
| 112 | PMIC_IS_HAN, |
| 113 | PMIC_IS_KIP, |
| 114 | PMIC_IS_WOOKIE, |
| 115 | PMIC_IS_PM8058, |
| 116 | PMIC_IS_PM8028, |
| 117 | PMIC_IS_PM8901, |
| 118 | PMIC_IS_PM8027 , |
| 119 | PMIC_IS_ISL_9519, |
| 120 | PMIC_IS_PM8921, |
| 121 | PMIC_IS_PM8018, |
| 122 | PMIC_IS_PM8015, |
| 123 | PMIC_IS_PM8014, |
| 124 | PMIC_IS_PM8821, |
| 125 | PMIC_IS_PM8038, |
Deepa Dinamani | b8b1643 | 2012-08-24 15:48:45 -0700 | [diff] [blame] | 126 | PMIC_IS_PM8922, |
| 127 | PMIC_IS_PM8917, |
Channagoud Kadabi | 4b21e7f | 2013-02-15 11:55:38 -0800 | [diff] [blame] | 128 | PMIC_IS_INVALID = 0x7fffffff, |
| 129 | } pm_model_type_afly; |
| 130 | |
| 131 | typedef enum |
| 132 | { |
| 133 | PMIC_IS_UNKNOWN = 0, |
| 134 | PMIC_IS_PM8941 = 1, |
| 135 | PMIC_IS_PM8841 = 2, |
| 136 | PMIC_IS_PM8019 = 3, |
| 137 | PMIC_IS_PM8026 = 4, |
| 138 | PMIC_IS_PM8110 = 5, |
lijuang | 3606df8 | 2015-09-02 21:14:43 +0800 | [diff] [blame] | 139 | PMIC_IS_PM8916 = 11, |
| 140 | PMIC_IS_PM8909 = 13, |
| 141 | PMIC_IS_PMI8950 = 17, |
| 142 | PMIC_IS_PMI8994 = 10, |
| 143 | PMIC_IS_PMI8996 = 19, |
Mayank Grover | 1dde7f4 | 2017-07-03 16:31:42 +0530 | [diff] [blame] | 144 | PMIC_IS_PM660 = 27, |
Umang Agrawal | e640c65 | 2017-12-19 12:04:07 +0530 | [diff] [blame] | 145 | PMIC_IS_PMI632 = 37, |
Channagoud Kadabi | 4b21e7f | 2013-02-15 11:55:38 -0800 | [diff] [blame] | 146 | } pm_model_type_bfly; |
Deepa Dinamani | a4ebcff | 2012-06-11 11:59:30 -0700 | [diff] [blame] | 147 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 148 | struct smem_board_info_v3 { |
| 149 | unsigned format; |
| 150 | unsigned msm_id; |
| 151 | unsigned msm_version; |
| 152 | char build_id[32]; |
| 153 | unsigned raw_msm_id; |
| 154 | unsigned raw_msm_version; |
| 155 | unsigned hw_platform; |
Chandan Uddaraju | 885e4db | 2009-12-03 22:45:26 -0800 | [diff] [blame] | 156 | }; |
| 157 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 158 | struct smem_board_info_v4 { |
| 159 | struct smem_board_info_v3 board_info_v3; |
| 160 | unsigned platform_version; |
| 161 | unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory. |
Chandan Uddaraju | 1434a60 | 2010-03-08 17:13:38 -0800 | [diff] [blame] | 162 | }; |
| 163 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 164 | struct smem_board_info_v5 { |
| 165 | struct smem_board_info_v3 board_info_v3; |
| 166 | unsigned platform_version; |
| 167 | unsigned fused_chip; |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 168 | }; |
| 169 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 170 | struct smem_board_info_v6 { |
| 171 | struct smem_board_info_v3 board_info_v3; |
| 172 | unsigned platform_version; |
| 173 | unsigned fused_chip; |
| 174 | unsigned platform_subtype; |
| 175 | unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory. |
Ajay Dudani | 6cff85e | 2011-02-04 16:02:16 -0800 | [diff] [blame] | 176 | }; |
| 177 | |
Deepa Dinamani | a4ebcff | 2012-06-11 11:59:30 -0700 | [diff] [blame] | 178 | struct smem_board_info_v7 { |
| 179 | struct smem_board_info_v3 board_info_v3; |
| 180 | unsigned platform_version; |
| 181 | unsigned fused_chip; |
| 182 | unsigned platform_subtype; |
| 183 | unsigned pmic_type; |
| 184 | unsigned pmic_version; |
| 185 | unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory. |
| 186 | }; |
| 187 | |
Channagoud Kadabi | 4b21e7f | 2013-02-15 11:55:38 -0800 | [diff] [blame] | 188 | struct smem_pmic_info { |
| 189 | unsigned pmic_type; |
| 190 | unsigned pmic_version; |
| 191 | }; |
| 192 | |
| 193 | struct smem_board_info_v8 { |
| 194 | struct smem_board_info_v3 board_info_v3; |
| 195 | unsigned platform_version; |
| 196 | unsigned fused_chip; |
| 197 | unsigned platform_subtype; |
| 198 | struct smem_pmic_info pmic_info[SMEM_V8_SMEM_MAX_PMIC_DEVICES]; |
Sridhar Parasuram | ece2805 | 2014-11-18 09:03:08 -0800 | [diff] [blame] | 199 | }; |
| 200 | |
| 201 | struct smem_board_info_v9 { |
| 202 | struct smem_board_info_v3 board_info_v3; |
| 203 | unsigned platform_version; |
| 204 | unsigned fused_chip; |
| 205 | unsigned platform_subtype; |
| 206 | struct smem_pmic_info pmic_info[SMEM_V8_SMEM_MAX_PMIC_DEVICES]; |
| 207 | uint32_t foundry_id; /* Used as foundry_id only for v9 */ |
| 208 | }; |
| 209 | |
| 210 | struct smem_board_info_v10 { |
| 211 | struct smem_board_info_v3 board_info_v3; |
| 212 | unsigned platform_version; |
| 213 | unsigned fused_chip; |
| 214 | unsigned platform_subtype; |
| 215 | struct smem_pmic_info pmic_info[SMEM_V8_SMEM_MAX_PMIC_DEVICES]; |
Sridhar Parasuram | c5f035f | 2014-10-22 12:37:36 -0700 | [diff] [blame] | 216 | uint32_t foundry_id; /* Used as foundry_id only for v9 */ |
| 217 | uint32_t chip_serial; /* Used as serial number for v10 */ |
Channagoud Kadabi | 4b21e7f | 2013-02-15 11:55:38 -0800 | [diff] [blame] | 218 | }; |
| 219 | |
Sridhar Parasuram | 701c830 | 2015-06-15 11:03:14 -0700 | [diff] [blame] | 220 | struct smem_board_info_v11 { |
| 221 | struct smem_board_info_v3 board_info_v3; |
| 222 | unsigned platform_version; |
| 223 | unsigned fused_chip; |
| 224 | unsigned platform_subtype; |
| 225 | struct smem_pmic_info pmic_info[SMEM_V8_SMEM_MAX_PMIC_DEVICES]; // Depreciated |
| 226 | uint32_t foundry_id; /* Used as foundry_id only for v9 */ |
| 227 | uint32_t chip_serial; /* Used as serial number for v10 */ |
| 228 | uint32_t num_pmics; /* Number of pmics in array */ |
| 229 | uint32_t pmic_array_offset; /* Offset from base of structure to array of pmic info types */ |
| 230 | }; |
| 231 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 232 | typedef struct { |
| 233 | unsigned key_len; |
| 234 | unsigned iv_len; |
| 235 | unsigned char key[32]; |
| 236 | unsigned char iv[32]; |
| 237 | } boot_symmetric_key_info; |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 238 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 239 | typedef struct { |
| 240 | unsigned int update_status; |
| 241 | unsigned int bl_error_code; |
| 242 | } boot_ssd_status; |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 243 | |
| 244 | #if PLATFORM_MSM7X30 |
| 245 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 246 | typedef struct { |
| 247 | boot_symmetric_key_info key_info; |
| 248 | uint32_t boot_flags; |
| 249 | uint32_t boot_key_press[5]; |
| 250 | uint32_t time_tick; |
| 251 | boot_ssd_status status; |
| 252 | uint8_t buff_align[4]; |
| 253 | } boot_info_for_apps; |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 254 | |
| 255 | #elif PLATFORM_MSM7K |
| 256 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 257 | typedef struct { |
| 258 | uint32_t apps_img_start_addr; |
| 259 | uint32_t boot_flags; |
| 260 | boot_ssd_status status; |
| 261 | } boot_info_for_apps; |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 262 | |
| 263 | #elif PLATFORM_MSM7X27A |
| 264 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 265 | typedef struct { |
| 266 | uint32_t apps_img_start_addr; |
| 267 | uint32_t boot_flags; |
| 268 | boot_ssd_status status; |
| 269 | boot_symmetric_key_info key_info; |
| 270 | uint16_t boot_key_press[10]; |
| 271 | uint32_t timetick; |
| 272 | uint8_t PAD[28]; |
| 273 | } boot_info_for_apps; |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 274 | |
| 275 | #else |
| 276 | |
| 277 | /* Dummy structure to keep it for other targets */ |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 278 | typedef struct { |
| 279 | uint32_t boot_flags; |
| 280 | boot_ssd_status status; |
| 281 | } boot_info_for_apps; |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 282 | |
| 283 | #endif |
| 284 | |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 285 | /* chip information */ |
| 286 | enum { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 287 | UNKNOWN = 0, |
| 288 | MDM9200 = 57, |
| 289 | MDM9600 = 58, |
| 290 | MSM8260 = 70, |
| 291 | MSM8660 = 71, |
| 292 | APQ8060 = 86, |
| 293 | MSM8960 = 87, |
| 294 | MSM7225A = 88, |
| 295 | MSM7625A = 89, |
| 296 | MSM7227A = 90, |
| 297 | MSM7627A = 91, |
| 298 | ESM7227A = 92, |
| 299 | ESM7225A = 96, |
| 300 | ESM7627A = 97, |
| 301 | MSM7225AA = 98, |
| 302 | MSM7625AA = 99, |
| 303 | ESM7225AA = 100, |
| 304 | MSM7227AA = 101, |
| 305 | MSM7627AA = 102, |
| 306 | ESM7227AA = 103, |
| 307 | APQ8064 = 109, |
| 308 | MSM8930 = 116, |
| 309 | MSM8630 = 117, |
| 310 | MSM8230 = 118, |
| 311 | APQ8030 = 119, |
| 312 | MSM8627 = 120, |
| 313 | MSM8227 = 121, |
| 314 | MSM8660A = 122, |
| 315 | MSM8260A = 123, |
| 316 | APQ8060A = 124, |
David Ng | dc2d1a5 | 2013-02-12 18:11:56 -0800 | [diff] [blame] | 317 | MSM8974 = 126, |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 318 | MSM8225 = 127, |
Ajay Dudani | 7d16254 | 2012-02-16 19:51:14 -0800 | [diff] [blame] | 319 | MSM8625 = 129, |
| 320 | MPQ8064 = 130, |
Channagoud Kadabi | bd14e2f | 2012-05-03 22:54:50 +0530 | [diff] [blame] | 321 | MSM7225AB = 131, |
| 322 | MSM7625AB = 132, |
| 323 | ESM7225AB = 133, |
Neeti Desai | 465491e | 2012-07-31 12:53:35 -0700 | [diff] [blame] | 324 | MDM9625 = 134, |
Channagoud Kadabi | 647f085 | 2012-06-08 11:51:45 +0530 | [diff] [blame] | 325 | MSM7125A = 135, |
| 326 | MSM7127A = 136, |
Aparna Mallavarapu | 5187941 | 2012-08-27 12:55:50 +0530 | [diff] [blame] | 327 | MSM8125A = 137, |
Neeti Desai | 6e01525 | 2012-08-13 13:22:37 -0700 | [diff] [blame] | 328 | MSM8960AB = 138, |
| 329 | APQ8060AB = 139, |
| 330 | MSM8260AB = 140, |
| 331 | MSM8660AB = 141, |
Neeti Desai | 5ccd864 | 2012-07-17 12:43:43 -0700 | [diff] [blame] | 332 | MSM8930AA = 142, |
| 333 | MSM8630AA = 143, |
| 334 | MSM8230AA = 144, |
Deepa Dinamani | 4069e74 | 2013-02-25 14:11:34 -0800 | [diff] [blame] | 335 | MSM8626 = 145, |
Deepa Dinamani | e5c9a47 | 2013-03-05 15:48:26 -0800 | [diff] [blame] | 336 | MSM8610 = 147, |
Amol Jadi | 117ef3a | 2012-09-20 13:32:55 -0700 | [diff] [blame] | 337 | MDM9225 = 149, |
| 338 | MDM9225M = 150, |
| 339 | MDM9625M = 152, |
| 340 | APQ8064AB = 153, /* aka V2 PRIME */ |
Amol Jadi | 6d91374 | 2012-10-16 12:12:23 -0700 | [diff] [blame] | 341 | MSM8930AB = 154, |
| 342 | MSM8630AB = 155, |
| 343 | MSM8230AB = 156, |
| 344 | APQ8030AB = 157, |
Deepa Dinamani | 4069e74 | 2013-02-25 14:11:34 -0800 | [diff] [blame] | 345 | MSM8226 = 158, |
| 346 | MSM8826 = 159, |
Channagoud Kadabi | 512295f | 2012-10-23 10:00:42 +0530 | [diff] [blame] | 347 | APQ8030AA = 160, |
Deepa Dinamani | e5c9a47 | 2013-03-05 15:48:26 -0800 | [diff] [blame] | 348 | MSM8110 = 161, |
| 349 | MSM8210 = 162, |
| 350 | MSM8810 = 163, |
David Ng | 909601c | 2013-04-19 20:21:30 -0700 | [diff] [blame] | 351 | MSM8212 = 164, |
Deepa Dinamani | e33d14b | 2013-04-08 18:27:12 -0700 | [diff] [blame] | 352 | MSM8612 = 165, |
David Ng | 909601c | 2013-04-19 20:21:30 -0700 | [diff] [blame] | 353 | MSM8812 = 166, |
Aparna Mallavarapu | e07cfff | 2012-10-31 12:07:59 +0530 | [diff] [blame] | 354 | MSM8125 = 167, |
Aparna Mallavarapu | 5f09822 | 2013-03-20 18:31:35 +0530 | [diff] [blame] | 355 | MDM9310 = 171, |
Aparna Mallavarapu | 2269a2f | 2013-01-07 19:44:48 +0530 | [diff] [blame] | 356 | APQ8064AA = 172, /* aka V2 SLOW_PRIME */ |
David Ng | 24df2e4 | 2013-08-21 23:31:50 -0700 | [diff] [blame] | 357 | APQ8084 = 178, |
David Ng | dc2d1a5 | 2013-02-12 18:11:56 -0800 | [diff] [blame] | 358 | MSM8130 = 179, |
| 359 | MSM8130AA = 180, |
| 360 | MSM8130AB = 181, |
Aparna Mallavarapu | 751e4a2 | 2013-02-19 18:45:44 +0530 | [diff] [blame] | 361 | MSM8627AA = 182, |
| 362 | MSM8227AA = 183, |
Channagoud Kadabi | 3dc072f | 2013-02-21 22:29:02 -0800 | [diff] [blame] | 363 | APQ8074 = 184, |
Deepa Dinamani | 3449d99 | 2013-05-03 12:03:51 -0700 | [diff] [blame] | 364 | MSM8274 = 185, |
| 365 | MSM8674 = 186, |
Smita Solanki | 6bd7d5f | 2014-01-03 06:42:36 -0800 | [diff] [blame] | 366 | MDM9635 = 187, |
V S Ramanjaneya Kumar T | b75d2ae | 2013-08-02 10:54:56 +0530 | [diff] [blame] | 367 | FSM9900 = 188, |
V S Ramanjaneya Kumar T | a44a36a | 2013-12-03 13:53:48 +0530 | [diff] [blame] | 368 | FSM9905 = 189, |
| 369 | FSM9955 = 190, |
| 370 | FSM9950 = 191, |
| 371 | FSM9915 = 192, |
| 372 | FSM9910 = 193, |
Deepa Dinamani | 732e205 | 2013-06-14 12:32:36 -0700 | [diff] [blame] | 373 | MSM8974AC = 194, |
Deepa Dinamani | d96f932 | 2013-05-21 12:41:54 -0700 | [diff] [blame] | 374 | MSM8126 = 198, |
| 375 | APQ8026 = 199, |
| 376 | MSM8926 = 200, |
| 377 | MSM8326 = 205, |
Aparna Mallavarapu | adbf159 | 2013-10-19 15:07:03 +0530 | [diff] [blame] | 378 | MSM8916 = 206, |
Channagoud Kadabi | 88e039a | 2014-04-14 14:02:12 -0700 | [diff] [blame] | 379 | MSM8994 = 207, |
Deepa Dinamani | 732e205 | 2013-06-14 12:32:36 -0700 | [diff] [blame] | 380 | APQ8074AA = 208, |
| 381 | APQ8074AB = 209, |
| 382 | APQ8074AC = 210, |
| 383 | MSM8274AA = 211, |
| 384 | MSM8274AB = 212, |
| 385 | MSM8274AC = 213, |
| 386 | MSM8674AA = 214, |
| 387 | MSM8674AB = 215, |
| 388 | MSM8674AC = 216, |
| 389 | MSM8974AA = 217, |
| 390 | MSM8974AB = 218, |
Maria Yu | 083d780 | 2013-09-02 18:11:23 +0800 | [diff] [blame] | 391 | APQ8028 = 219, |
| 392 | MSM8128 = 220, |
| 393 | MSM8228 = 221, |
| 394 | MSM8528 = 222, |
| 395 | MSM8628 = 223, |
| 396 | MSM8928 = 224, |
Deepa Dinamani | a3bf8b5 | 2013-09-12 11:00:37 -0700 | [diff] [blame] | 397 | MSM8510 = 225, |
| 398 | MSM8512 = 226, |
Unnati Gandhi | 2b8064f | 2014-06-02 12:58:58 +0530 | [diff] [blame] | 399 | MSM8936 = 233, |
anisha agarwal | e29d388 | 2014-11-25 16:02:03 -0800 | [diff] [blame] | 400 | MDM9640 = 234, |
Aparna Mallavarapu | ee7e679 | 2014-02-02 19:07:16 +0530 | [diff] [blame] | 401 | MSM8939 = 239, |
| 402 | APQ8036 = 240, |
| 403 | APQ8039 = 241, |
| 404 | MSM8236 = 242, |
| 405 | MSM8636 = 243, |
Unnati Gandhi | af4bcb3 | 2014-07-07 11:17:39 +0530 | [diff] [blame] | 406 | MSM8909 = 245, |
Channagoud Kadabi | 736bbc0 | 2015-03-30 15:18:05 -0700 | [diff] [blame] | 407 | MSM8996 = 246, |
Aparna Mallavarapu | 407fdf8 | 2014-06-02 21:14:36 +0530 | [diff] [blame] | 408 | APQ8016 = 247, |
| 409 | MSM8216 = 248, |
| 410 | MSM8116 = 249, |
| 411 | MSM8616 = 250, |
Channagoud Kadabi | f0d4ad3 | 2014-08-28 15:48:21 -0700 | [diff] [blame] | 412 | MSM8992 = 251, |
| 413 | APQ8092 = 252, |
Channagoud Kadabi | c6a005b | 2014-07-12 13:02:55 -0700 | [diff] [blame] | 414 | APQ8094 = 253, |
Channagoud Kadabi | 868383e | 2014-07-10 15:06:57 -0400 | [diff] [blame] | 415 | FSM9008 = 254, |
| 416 | FSM9010 = 255, |
| 417 | FSM9016 = 256, |
| 418 | FSM9055 = 257, |
Unnati Gandhi | 2644444 | 2014-08-12 10:52:09 +0530 | [diff] [blame] | 419 | MSM8209 = 258, |
| 420 | MSM8208 = 259, |
| 421 | MDM9209 = 260, |
| 422 | MDM9309 = 261, |
| 423 | MDM9609 = 262, |
Aparna Mallavarapu | 1f8e5e0 | 2014-08-20 12:17:30 +0530 | [diff] [blame] | 424 | MSM8239 = 263, |
Unnati Gandhi | 6028261 | 2014-11-20 13:39:49 +0530 | [diff] [blame] | 425 | APQ8009 = 265, |
Aparna Mallavarapu | 05b9dad | 2015-03-03 20:36:33 +0530 | [diff] [blame] | 426 | MSM8952 = 264, |
| 427 | MSM8956 = 266, |
vijay kumar | 760fcdd | 2015-01-05 12:45:06 +0530 | [diff] [blame] | 428 | MSM8929 = 268, |
| 429 | MSM8629 = 269, |
| 430 | MSM8229 = 270, |
| 431 | APQ8029 = 271, |
Aparna Mallavarapu | de524f3 | 2015-04-28 14:37:14 +0530 | [diff] [blame] | 432 | APQ8056 = 274, |
Unnati Gandhi | dd372a5 | 2015-02-06 16:49:38 +0530 | [diff] [blame] | 433 | MSM8609 = 275, |
Channagoud Kadabi | 1c4d7a2 | 2015-02-11 11:21:36 -0500 | [diff] [blame] | 434 | FSM9916 = 276, |
Aparna Mallavarapu | de524f3 | 2015-04-28 14:37:14 +0530 | [diff] [blame] | 435 | APQ8076 = 277, |
Aparna Mallavarapu | 05b9dad | 2015-03-03 20:36:33 +0530 | [diff] [blame] | 436 | MSM8976 = 278, |
Karthik Jadala | a2f6f9c | 2017-02-20 15:01:47 +0530 | [diff] [blame] | 437 | MDM9650 = 279, |
| 438 | MDM9655 = 283, |
| 439 | MDM9250 = 284, |
| 440 | MDM9255 = 285, |
| 441 | MDM9350 = 286, |
Aparna Mallavarapu | de524f3 | 2015-04-28 14:37:14 +0530 | [diff] [blame] | 442 | APQ8052 = 289, |
vijay kumar | db062a3 | 2015-10-30 12:32:15 +0530 | [diff] [blame] | 443 | MDM9607 = 290, |
| 444 | MDM8207 = 296, |
| 445 | MDM9207 = 297, |
| 446 | MDM9307 = 298, |
| 447 | MDM9628 = 299, |
Channagoud Kadabi | 1a6163c | 2015-05-26 11:09:25 -0700 | [diff] [blame] | 448 | APQ8096 = 291, |
Gaurav Nebhwani | 6c945a4 | 2016-02-16 17:26:51 +0530 | [diff] [blame] | 449 | MSM8953 = 293, |
Parth Dixit | 84e828f | 2015-10-30 00:39:16 +0530 | [diff] [blame] | 450 | MSM8937 = 294, |
| 451 | APQ8037 = 295, |
Parth Dixit | 660369e | 2016-05-12 09:53:15 +0530 | [diff] [blame] | 452 | MSM8940 = 313, |
Channagoud Kadabi | ee2b65e | 2016-01-11 19:10:29 -0800 | [diff] [blame] | 453 | MSM8996L = 302, |
Parth Dixit | 05f3c9f | 2016-03-18 17:14:57 +0530 | [diff] [blame] | 454 | MSM8917 = 303, |
Mayank Grover | 95f7bdb | 2016-10-03 17:54:29 +0530 | [diff] [blame] | 455 | MSM8920 = 320, |
Channagoud Kadabi | ee2b65e | 2016-01-11 19:10:29 -0800 | [diff] [blame] | 456 | APQ8053 = 304, |
| 457 | MSM8996SG = 305, |
Parth Dixit | 05f3c9f | 2016-03-18 17:14:57 +0530 | [diff] [blame] | 458 | APQ8017 = 307, |
| 459 | MSM8217 = 308, |
| 460 | MSM8617 = 309, |
Channagoud Kadabi | ee2b65e | 2016-01-11 19:10:29 -0800 | [diff] [blame] | 461 | MSM8996AU = 310, |
| 462 | APQ8096AU = 311, |
| 463 | APQ8096SG = 312, |
anisha agarwal | 35eb803 | 2017-03-21 13:12:12 -0700 | [diff] [blame] | 464 | SDX201 = 314, |
| 465 | SDX202 = 333, |
Gopal G Goberu | d5dd9d2 | 2015-09-25 14:37:17 +0530 | [diff] [blame] | 466 | MSM8909W = 300, |
Mayank Grover | 4266467 | 2017-03-06 17:57:26 +0530 | [diff] [blame] | 467 | APQ8009W = 301, |
Mayank Grover | a64934b | 2017-04-11 16:29:39 +0530 | [diff] [blame] | 468 | SDM450 = 338, |
Mayank Grover | c60e61f | 2017-12-26 12:45:18 +0530 | [diff] [blame] | 469 | MDM9206 = 322, |
lijuang | e695d42 | 2017-12-12 14:19:23 +0800 | [diff] [blame] | 470 | SDA450 = 351, |
| 471 | SDM632 = 349, |
lijuang | 6c9fa08 | 2018-04-04 19:58:57 +0800 | [diff] [blame] | 472 | SDA632 = 350, |
| 473 | SDM429 = 354, |
lijuang | 46884f4 | 2018-04-23 18:59:47 +0800 | [diff] [blame] | 474 | SDM439 = 353, |
| 475 | SDA429 = 364, |
lijuang | 80ac118 | 2018-09-07 13:39:58 +0800 | [diff] [blame] | 476 | SDA439 = 363, |
| 477 | QM215 = 386 |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 478 | }; |
| 479 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 480 | enum platform { |
| 481 | HW_PLATFORM_UNKNOWN = 0, |
| 482 | HW_PLATFORM_SURF = 1, |
| 483 | HW_PLATFORM_FFA = 2, |
| 484 | HW_PLATFORM_FLUID = 3, |
| 485 | HW_PLATFORM_SVLTE = 4, |
| 486 | HW_PLATFORM_QT = 6, |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 487 | HW_PLATFORM_MTP_MDM = 7, |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 488 | HW_PLATFORM_MTP = 8, |
| 489 | HW_PLATFORM_LIQUID = 9, |
| 490 | HW_PLATFORM_DRAGON = 10, |
Aparna Mallavarapu | 6af40f4 | 2013-03-04 16:58:23 +0530 | [diff] [blame] | 491 | HW_PLATFORM_QRD = 11, |
Zhu Bin | 576c064 | 2016-11-17 18:18:02 +0800 | [diff] [blame] | 492 | HW_PLATFORM_IPC = 12, |
Ajay Dudani | 7d16254 | 2012-02-16 19:51:14 -0800 | [diff] [blame] | 493 | HW_PLATFORM_HRD = 13, |
| 494 | HW_PLATFORM_DTV = 14, |
V S Ramanjaneya Kumar T | c633fe1 | 2013-01-08 14:55:54 -0500 | [diff] [blame] | 495 | HW_PLATFORM_RUMI = 15, |
| 496 | HW_PLATFORM_VIRTIO = 16, |
| 497 | HW_PLATFORM_BTS = 19, |
Channagoud Kadabi | 33527cd | 2013-09-17 16:20:58 -0700 | [diff] [blame] | 498 | HW_PLATFORM_RCM = 21, |
Aparna Mallavarapu | 6145c43 | 2013-02-05 19:27:30 +0530 | [diff] [blame] | 499 | HW_PLATFORM_DMA = 22, |
Channagoud Kadabi | 33527cd | 2013-09-17 16:20:58 -0700 | [diff] [blame] | 500 | HW_PLATFORM_STP = 23, |
Eugene Yasman | 70f9e2e | 2013-12-11 10:40:57 +0200 | [diff] [blame] | 501 | HW_PLATFORM_SBC = 24, |
Siddharth Zaveri | acaacc3 | 2015-12-12 15:10:33 -0500 | [diff] [blame] | 502 | HW_PLATFORM_ADP = 25, |
Mayank Grover | 03b48ed | 2018-05-17 14:48:29 +0530 | [diff] [blame] | 503 | HW_PLATFORM_ATP = 33, |
Neeti Desai | 465491e | 2012-07-31 12:53:35 -0700 | [diff] [blame] | 504 | HW_PLATFORM_32BITS = 0x7FFFFFFF, |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 505 | }; |
| 506 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 507 | enum platform_subtype { |
| 508 | HW_PLATFORM_SUBTYPE_UNKNOWN = 0, |
| 509 | HW_PLATFORM_SUBTYPE_MDM = 1, |
Channagoud Kadabi | ed4b8dd | 2014-01-08 12:16:08 -0800 | [diff] [blame] | 510 | HW_PLATFORM_SUBTYPE_8974PRO_PM8084 = 1, |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 511 | HW_PLATFORM_SUBTYPE_CSFB = 1, |
| 512 | HW_PLATFORM_SUBTYPE_SVLTE1 = 2, |
P.V. Phani Kumar | 88e2d27 | 2016-09-28 18:53:38 +0530 | [diff] [blame] | 513 | HW_PLATFORM_SUBTYPE_IOT = 2, |
Parth Dixit | acec6bf | 2017-02-27 19:06:39 +0530 | [diff] [blame] | 514 | HW_PLATFORM_SUBTYPE_SAP = 2, |
| 515 | HW_PLATFORM_SUBTYPE_SAP_NOPMI = 3, |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 516 | HW_PLATFORM_SUBTYPE_SVLTE2A = 3, |
Raghavendra Ambadas | 1f55958 | 2018-05-04 14:17:41 +0530 | [diff] [blame] | 517 | HW_PLATFORM_SUBTYPE_MTP_WEAR = 5, |
Amol Jadi | 5c61a95 | 2012-05-04 17:05:35 -0700 | [diff] [blame] | 518 | HW_PLATFORM_SUBTYPE_SGLTE = 6, |
Channagoud Kadabi | 141f298 | 2012-10-31 11:23:02 +0530 | [diff] [blame] | 519 | HW_PLATFORM_SUBTYPE_DSDA = 7, |
Amol Jadi | 9f04e7e | 2013-01-22 12:08:35 -0800 | [diff] [blame] | 520 | HW_PLATFORM_SUBTYPE_DSDA2 = 8, |
sundarajan srinivasan | 73d8df3 | 2013-02-28 17:03:27 -0800 | [diff] [blame] | 521 | HW_PLATFORM_SUBTYPE_SGLTE2 = 9, |
Parth Dixit | b47807a | 2016-09-20 15:26:50 +0530 | [diff] [blame] | 522 | HW_PLATFORM_SUBTYPE_SWOC_TP_CIRC = 12, |
Sujev Dias | c1991c0 | 2015-08-03 21:45:36 -0700 | [diff] [blame] | 523 | HW_PLATFORM_SUBTYPE_POLARIS = 64, |
Parth Dixit | fb55650 | 2016-10-18 14:05:40 +0530 | [diff] [blame] | 524 | HW_PLATFORM_SUBTYPE_SWOC_WEAR = 9, |
| 525 | HW_PLATFORM_SUBTYPE_SWOC_NOWGR_CIRC = 13, |
Arun kumar | 7e87a96 | 2018-09-24 16:26:31 +0530 | [diff] [blame] | 526 | HW_PLATFORM_SUBTYPE_8909_PM8916 = 2, |
Mayank Grover | 88ce62a | 2017-03-09 11:45:32 +0530 | [diff] [blame] | 527 | HW_PLATFORM_SUBTYPE_8909_PM660 = 15, |
Mayank Grover | 236a088 | 2017-11-10 14:11:23 +0530 | [diff] [blame] | 528 | HW_PLATFORM_SUBTYPE_8909_COMPAL_ALPHA = 19, |
Baochu Xu | f93991d | 2017-12-05 14:20:20 +0800 | [diff] [blame] | 529 | HW_PLATFORM_SUBTYPE_8909_PM660_V1 = 18, |
Vishnuvardhan Prodduturi | 2c7fd9e | 2018-02-05 17:24:40 +0530 | [diff] [blame] | 530 | HW_PLATFORM_SUBTYPE_INTRINSIC_SOM = 20, |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 531 | HW_PLATFORM_SUBTYPE_32BITS = 0x7FFFFFFF |
Ajay Dudani | 6cff85e | 2011-02-04 16:02:16 -0800 | [diff] [blame] | 532 | }; |
| 533 | |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 534 | typedef enum { |
| 535 | SMEM_SPINLOCK_ARRAY = 7, |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 536 | SMEM_AARM_PARTITION_TABLE = 9, |
Sundarajan Srinivasan | 28106e3 | 2014-07-24 16:39:58 -0700 | [diff] [blame] | 537 | SMEM_CHANNEL_ALLOC_TBL = 13, |
| 538 | SMEM_SMD_BASE_ID = 14, |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 539 | |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 540 | SMEM_APPS_BOOT_MODE = 106, |
Chandan Uddaraju | de85d3f | 2010-01-05 16:32:33 -0800 | [diff] [blame] | 541 | |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 542 | SMEM_BOARD_INFO_LOCATION = 137, |
Chandan Uddaraju | 885e4db | 2009-12-03 22:45:26 -0800 | [diff] [blame] | 543 | |
Sundarajan Srinivasan | 28106e3 | 2014-07-24 16:39:58 -0700 | [diff] [blame] | 544 | SMEM_SMD_FIFO_BASE_ID = 338, |
| 545 | |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 546 | SMEM_USABLE_RAM_PARTITION_TABLE = 402, |
| 547 | |
David Ng | f773dde | 2010-07-26 19:55:08 -0700 | [diff] [blame] | 548 | SMEM_POWER_ON_STATUS_INFO = 403, |
| 549 | |
Channagoud Kadabi | e1ecef5 | 2012-02-04 15:54:34 +0530 | [diff] [blame] | 550 | SMEM_RLOCK_AREA = 404, |
| 551 | |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 552 | SMEM_BOOT_INFO_FOR_APPS = 418, |
| 553 | |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 554 | SMEM_FIRST_VALID_TYPE = SMEM_SPINLOCK_ARRAY, |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 555 | SMEM_LAST_VALID_TYPE = SMEM_BOOT_INFO_FOR_APPS, |
Neeti Desai | 800e84f | 2012-04-09 15:14:08 -0700 | [diff] [blame] | 556 | |
| 557 | SMEM_MAX_SIZE = SMEM_BOOT_INFO_FOR_APPS + 1, |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 558 | } smem_mem_type_t; |
| 559 | |
| 560 | /* Note: buf MUST be 4byte aligned, and max_len MUST be a multiple of 4. */ |
| 561 | unsigned smem_read_alloc_entry(smem_mem_type_t type, void *buf, int max_len); |
| 562 | |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 563 | /* SMEM RAM Partition */ |
| 564 | enum { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 565 | DEFAULT_ATTRB = ~0x0, |
| 566 | READ_ONLY = 0x0, |
| 567 | READWRITE, |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 568 | }; |
| 569 | |
| 570 | enum { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 571 | DEFAULT_CATEGORY = ~0x0, |
| 572 | SMI = 0x0, |
| 573 | EBI1, |
| 574 | EBI2, |
| 575 | QDSP6, |
| 576 | IRAM, |
| 577 | IMEM, |
| 578 | EBI0_CS0, |
| 579 | EBI0_CS1, |
| 580 | EBI1_CS0, |
| 581 | EBI1_CS1, |
| 582 | SDRAM = 0xE, |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 583 | }; |
| 584 | |
| 585 | enum { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 586 | DEFAULT_DOMAIN = 0x0, |
| 587 | APPS_DOMAIN, |
| 588 | MODEM_DOMAIN, |
| 589 | SHARED_DOMAIN, |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 590 | }; |
| 591 | |
Ajay Dudani | dfef90b | 2010-09-22 10:21:05 -0700 | [diff] [blame] | 592 | enum { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 593 | SYS_MEMORY = 1, /* system memory */ |
| 594 | BOOT_REGION_MEMORY1, /* boot loader memory 1 */ |
| 595 | BOOT_REGION_MEMORY2, /* boot loader memory 2,reserved */ |
| 596 | APPSBL_MEMORY, /* apps boot loader memory */ |
| 597 | APPS_MEMORY, /* apps usage memory */ |
Ajay Dudani | dfef90b | 2010-09-22 10:21:05 -0700 | [diff] [blame] | 598 | }; |
| 599 | |
Neeti Desai | d5b5055 | 2012-03-23 12:39:01 -0700 | [diff] [blame] | 600 | struct smem { |
| 601 | struct smem_proc_comm proc_comm[4]; |
| 602 | unsigned version_info[32]; |
| 603 | struct smem_heap_info heap_info; |
Neeti Desai | 800e84f | 2012-04-09 15:14:08 -0700 | [diff] [blame] | 604 | struct smem_alloc_info alloc_info[SMEM_MAX_SIZE]; |
Neeti Desai | d5b5055 | 2012-03-23 12:39:01 -0700 | [diff] [blame] | 605 | }; |
| 606 | |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 607 | struct smem_ram_ptn { |
| 608 | char name[16]; |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 609 | uint32_t start; |
| 610 | uint32_t size; |
| 611 | uint32_t attr; /* RAM Partition attribute: READ_ONLY, READWRITE etc.*/ |
| 612 | uint32_t category; /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */ |
| 613 | uint32_t domain; /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */ |
| 614 | uint32_t type; /* RAM Partition type: system, bootloader, appsboot, apps etc. */ |
| 615 | uint32_t num_partitions;/* Number of memory partitions */ |
| 616 | uint32_t reserved3; |
| 617 | uint32_t reserved4; |
| 618 | uint32_t reserved5; |
| 619 | } __attribute__ ((__packed__)); |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 620 | |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 621 | struct smem_ram_ptn_v1 { |
| 622 | char name[RAM_PART_NAME_LENGTH]; |
| 623 | uint64_t start; |
| 624 | uint64_t size; |
| 625 | uint32_t attr; /* RAM Partition attribute: READ_ONLY, READWRITE etc.*/ |
| 626 | uint32_t category; /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */ |
| 627 | uint32_t domain; /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */ |
| 628 | uint32_t type; /* RAM Partition type: system, bootloader, appsboot, apps etc. */ |
| 629 | uint32_t num_partitions;/* Number of memory partitions */ |
| 630 | uint32_t reserved3; |
| 631 | uint32_t reserved4; /* Reserved for future use */ |
| 632 | uint32_t reserved5; /* Reserved for future use */ |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 633 | } __attribute__ ((__packed__)); |
| 634 | |
Channagoud Kadabi | bd50bea | 2015-03-19 15:17:04 -0700 | [diff] [blame] | 635 | struct smem_ram_ptn_v2 { |
| 636 | char name[RAM_PART_NAME_LENGTH]; |
| 637 | uint64_t start; |
| 638 | uint64_t size; |
| 639 | uint32_t attr; /* RAM Partition attribute: READ_ONLY, READWRITE etc.*/ |
| 640 | uint32_t category; /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */ |
| 641 | uint32_t domain; /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */ |
| 642 | uint32_t type; /* RAM Partition type: system, bootloader, appsboot, apps etc. */ |
| 643 | uint32_t num_partitions;/* Number of memory partitions */ |
| 644 | uint32_t hw_info; /* hw information such as type and frequency */ |
Channagoud Kadabi | 626a1d9 | 2015-03-25 15:20:31 -0700 | [diff] [blame] | 645 | uint64_t reserved; /* Reserved for future use */ |
Channagoud Kadabi | bd50bea | 2015-03-19 15:17:04 -0700 | [diff] [blame] | 646 | uint64_t available_length; /* Available partition length in RAM in bytes */ |
Channagoud Kadabi | bd50bea | 2015-03-19 15:17:04 -0700 | [diff] [blame] | 647 | } __attribute__ ((__packed__)); |
| 648 | |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 649 | struct smem_ram_ptable { |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 650 | unsigned magic[2]; |
| 651 | unsigned version; |
| 652 | unsigned reserved1; |
| 653 | unsigned len; |
| 654 | struct smem_ram_ptn parts[32]; |
| 655 | unsigned buf; |
| 656 | } __attribute__ ((__packed__)); |
| 657 | |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 658 | struct smem_ram_ptable_hdr |
| 659 | { |
| 660 | uint32_t magic[2]; |
| 661 | uint32_t version; |
| 662 | uint32_t reserved1; |
| 663 | uint32_t len; |
| 664 | } __attribute__ ((__packed__)); |
| 665 | |
| 666 | struct smem_ram_ptable_v1 { |
| 667 | struct smem_ram_ptable_hdr hdr; |
| 668 | uint32_t reserved2; /* Added for 8 bytes alignment of header */ |
| 669 | struct smem_ram_ptn_v1 parts[RAM_NUM_PART_ENTRIES]; |
| 670 | } __attribute__ ((__packed__)); |
| 671 | |
Channagoud Kadabi | bd50bea | 2015-03-19 15:17:04 -0700 | [diff] [blame] | 672 | struct smem_ram_ptable_v2 { |
| 673 | struct smem_ram_ptable_hdr hdr; |
| 674 | uint32_t reserved2; /* Added for 8 bytes alignment of header */ |
| 675 | struct smem_ram_ptn_v2 parts[RAM_NUM_PART_ENTRIES]; |
| 676 | } __attribute__ ((__packed__)); |
| 677 | |
David Ng | f773dde | 2010-07-26 19:55:08 -0700 | [diff] [blame] | 678 | /* Power on reason/status info */ |
Shashank Mittal | 6df1607 | 2011-07-14 18:44:01 -0700 | [diff] [blame] | 679 | #define PWR_ON_EVENT_RTC_ALARM 0x2 |
Ajay Dudani | ba82233 | 2011-11-25 13:37:31 -0800 | [diff] [blame] | 680 | #define PWR_ON_EVENT_USB_CHG 0x20 |
| 681 | #define PWR_ON_EVENT_WALL_CHG 0x40 |
Greg Grisco | d2471ef | 2011-07-14 13:00:42 -0700 | [diff] [blame] | 682 | |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 683 | #define SMEM_PTABLE_MAX_PARTS_V3 16 |
| 684 | #define SMEM_PTABLE_MAX_PARTS_V4 32 |
| 685 | #define SMEM_PTABLE_MAX_PARTS SMEM_PTABLE_MAX_PARTS_V4 |
| 686 | |
| 687 | #define SMEM_PTABLE_HDR_LEN (4*sizeof(unsigned)) |
| 688 | |
| 689 | struct smem_ptn { |
| 690 | char name[16]; |
| 691 | unsigned start; |
| 692 | unsigned size; |
| 693 | unsigned attr; |
| 694 | } __attribute__ ((__packed__)); |
| 695 | |
| 696 | |
| 697 | struct smem_ptable { |
| 698 | #define _SMEM_PTABLE_MAGIC_1 0x55ee73aa |
| 699 | #define _SMEM_PTABLE_MAGIC_2 0xe35ebddb |
| 700 | unsigned magic[2]; |
| 701 | unsigned version; |
| 702 | unsigned len; |
| 703 | struct smem_ptn parts[SMEM_PTABLE_MAX_PARTS]; |
| 704 | } __attribute__ ((__packed__)); |
| 705 | |
Channagoud Kadabi | bd50bea | 2015-03-19 15:17:04 -0700 | [diff] [blame] | 706 | typedef struct smem_ram_ptable_v2 ram_partition_table; |
| 707 | typedef struct smem_ram_ptn_v2 ram_partition; |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 708 | |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 709 | unsigned smem_read_alloc_entry_offset(smem_mem_type_t type, void *buf, int len, int offset); |
Greg Grisco | d2471ef | 2011-07-14 13:00:42 -0700 | [diff] [blame] | 710 | int smem_ram_ptable_init(struct smem_ram_ptable *smem_ram_ptable); |
Sundarajan Srinivasan | bd8a571 | 2013-07-09 17:09:09 -0700 | [diff] [blame] | 711 | int smem_ram_ptable_init_v1(); /* Used on platforms that use ram ptable v1 */ |
| 712 | void smem_get_ram_ptable_entry(ram_partition*, uint32_t entry); |
| 713 | uint32_t smem_get_ram_ptable_version(void); |
| 714 | uint32_t smem_get_ram_ptable_len(void); |
Sundarajan Srinivasan | 28106e3 | 2014-07-24 16:39:58 -0700 | [diff] [blame] | 715 | void* smem_get_alloc_entry(smem_mem_type_t type, uint32_t* size); |
Aparna Mallavarapu | 1f62fdd | 2015-03-08 12:50:57 +0530 | [diff] [blame] | 716 | uint32_t get_ddr_start(); |
Channagoud Kadabi | b22da98 | 2015-07-13 15:03:41 -0700 | [diff] [blame] | 717 | uint64_t smem_get_ddr_size(); |
lijuang | d117505 | 2015-08-13 16:41:12 +0800 | [diff] [blame] | 718 | size_t smem_get_hw_platform_name(void *buf, uint32 buf_size); |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 719 | #endif /* __PLATFORM_MSM_SHARED_SMEM_H */ |