Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2009, Google Inc. |
| 3 | * All rights reserved. |
| 4 | * |
Aparna Mallavarapu | 2269a2f | 2013-01-07 19:44:48 +0530 | [diff] [blame] | 5 | * Copyright (c) 2009-2013, 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> |
| 35 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 36 | struct smem_proc_comm { |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 37 | unsigned command; |
| 38 | unsigned status; |
| 39 | unsigned data1; |
| 40 | unsigned data2; |
| 41 | }; |
| 42 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 43 | struct smem_heap_info { |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 44 | unsigned initialized; |
| 45 | unsigned free_offset; |
| 46 | unsigned heap_remaining; |
| 47 | unsigned reserved; |
| 48 | }; |
| 49 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 50 | struct smem_alloc_info { |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 51 | unsigned allocated; |
| 52 | unsigned offset; |
| 53 | unsigned size; |
| 54 | unsigned reserved; |
| 55 | }; |
| 56 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 57 | struct smem_board_info_v2 { |
| 58 | unsigned format; |
| 59 | unsigned msm_id; |
| 60 | unsigned msm_version; |
| 61 | char build_id[32]; |
| 62 | unsigned raw_msm_id; |
| 63 | unsigned raw_msm_version; |
Srilakshmi Punuru | cfb5a46 | 2011-02-08 11:55:24 -0800 | [diff] [blame] | 64 | }; |
| 65 | |
Deepa Dinamani | a4ebcff | 2012-06-11 11:59:30 -0700 | [diff] [blame] | 66 | typedef enum |
| 67 | { |
| 68 | PMIC_IS_PM6610, |
| 69 | PMIC_IS_PM6620, |
| 70 | PMIC_IS_PM6640, |
| 71 | PMIC_IS_PM6650, |
| 72 | PMIC_IS_PM7500, |
| 73 | PMIC_IS_PANORAMIX, |
| 74 | PMIC_IS_PM6652, |
| 75 | PMIC_IS_PM6653, |
| 76 | PMIC_IS_PM6658, |
| 77 | PMIC_IS_EPIC, |
| 78 | PMIC_IS_HAN, |
| 79 | PMIC_IS_KIP, |
| 80 | PMIC_IS_WOOKIE, |
| 81 | PMIC_IS_PM8058, |
| 82 | PMIC_IS_PM8028, |
| 83 | PMIC_IS_PM8901, |
| 84 | PMIC_IS_PM8027 , |
| 85 | PMIC_IS_ISL_9519, |
| 86 | PMIC_IS_PM8921, |
| 87 | PMIC_IS_PM8018, |
| 88 | PMIC_IS_PM8015, |
| 89 | PMIC_IS_PM8014, |
| 90 | PMIC_IS_PM8821, |
| 91 | PMIC_IS_PM8038, |
Deepa Dinamani | b8b1643 | 2012-08-24 15:48:45 -0700 | [diff] [blame] | 92 | PMIC_IS_PM8922, |
| 93 | PMIC_IS_PM8917, |
| 94 | PMIC_IS_INVALID = 0xffffffff, |
Deepa Dinamani | a4ebcff | 2012-06-11 11:59:30 -0700 | [diff] [blame] | 95 | } pm_model_type; |
| 96 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 97 | struct smem_board_info_v3 { |
| 98 | unsigned format; |
| 99 | unsigned msm_id; |
| 100 | unsigned msm_version; |
| 101 | char build_id[32]; |
| 102 | unsigned raw_msm_id; |
| 103 | unsigned raw_msm_version; |
| 104 | unsigned hw_platform; |
Chandan Uddaraju | 885e4db | 2009-12-03 22:45:26 -0800 | [diff] [blame] | 105 | }; |
| 106 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 107 | struct smem_board_info_v4 { |
| 108 | struct smem_board_info_v3 board_info_v3; |
| 109 | unsigned platform_version; |
| 110 | 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] | 111 | }; |
| 112 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 113 | struct smem_board_info_v5 { |
| 114 | struct smem_board_info_v3 board_info_v3; |
| 115 | unsigned platform_version; |
| 116 | unsigned fused_chip; |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 117 | }; |
| 118 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 119 | struct smem_board_info_v6 { |
| 120 | struct smem_board_info_v3 board_info_v3; |
| 121 | unsigned platform_version; |
| 122 | unsigned fused_chip; |
| 123 | unsigned platform_subtype; |
| 124 | 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] | 125 | }; |
| 126 | |
Deepa Dinamani | a4ebcff | 2012-06-11 11:59:30 -0700 | [diff] [blame] | 127 | struct smem_board_info_v7 { |
| 128 | struct smem_board_info_v3 board_info_v3; |
| 129 | unsigned platform_version; |
| 130 | unsigned fused_chip; |
| 131 | unsigned platform_subtype; |
| 132 | unsigned pmic_type; |
| 133 | unsigned pmic_version; |
| 134 | unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory. |
| 135 | }; |
| 136 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 137 | typedef struct { |
| 138 | unsigned key_len; |
| 139 | unsigned iv_len; |
| 140 | unsigned char key[32]; |
| 141 | unsigned char iv[32]; |
| 142 | } boot_symmetric_key_info; |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 143 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 144 | typedef struct { |
| 145 | unsigned int update_status; |
| 146 | unsigned int bl_error_code; |
| 147 | } boot_ssd_status; |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 148 | |
| 149 | #if PLATFORM_MSM7X30 |
| 150 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 151 | typedef struct { |
| 152 | boot_symmetric_key_info key_info; |
| 153 | uint32_t boot_flags; |
| 154 | uint32_t boot_key_press[5]; |
| 155 | uint32_t time_tick; |
| 156 | boot_ssd_status status; |
| 157 | uint8_t buff_align[4]; |
| 158 | } boot_info_for_apps; |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 159 | |
| 160 | #elif PLATFORM_MSM7K |
| 161 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 162 | typedef struct { |
| 163 | uint32_t apps_img_start_addr; |
| 164 | uint32_t boot_flags; |
| 165 | boot_ssd_status status; |
| 166 | } boot_info_for_apps; |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 167 | |
| 168 | #elif PLATFORM_MSM7X27A |
| 169 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 170 | typedef struct { |
| 171 | uint32_t apps_img_start_addr; |
| 172 | uint32_t boot_flags; |
| 173 | boot_ssd_status status; |
| 174 | boot_symmetric_key_info key_info; |
| 175 | uint16_t boot_key_press[10]; |
| 176 | uint32_t timetick; |
| 177 | uint8_t PAD[28]; |
| 178 | } boot_info_for_apps; |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 179 | |
| 180 | #else |
| 181 | |
| 182 | /* Dummy structure to keep it for other targets */ |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 183 | typedef struct { |
| 184 | uint32_t boot_flags; |
| 185 | boot_ssd_status status; |
| 186 | } boot_info_for_apps; |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 187 | |
| 188 | #endif |
| 189 | |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 190 | /* chip information */ |
| 191 | enum { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 192 | UNKNOWN = 0, |
| 193 | MDM9200 = 57, |
| 194 | MDM9600 = 58, |
| 195 | MSM8260 = 70, |
| 196 | MSM8660 = 71, |
| 197 | APQ8060 = 86, |
| 198 | MSM8960 = 87, |
| 199 | MSM7225A = 88, |
| 200 | MSM7625A = 89, |
| 201 | MSM7227A = 90, |
| 202 | MSM7627A = 91, |
| 203 | ESM7227A = 92, |
| 204 | ESM7225A = 96, |
| 205 | ESM7627A = 97, |
| 206 | MSM7225AA = 98, |
| 207 | MSM7625AA = 99, |
| 208 | ESM7225AA = 100, |
| 209 | MSM7227AA = 101, |
| 210 | MSM7627AA = 102, |
| 211 | ESM7227AA = 103, |
| 212 | APQ8064 = 109, |
| 213 | MSM8930 = 116, |
| 214 | MSM8630 = 117, |
| 215 | MSM8230 = 118, |
| 216 | APQ8030 = 119, |
| 217 | MSM8627 = 120, |
| 218 | MSM8227 = 121, |
| 219 | MSM8660A = 122, |
| 220 | MSM8260A = 123, |
| 221 | APQ8060A = 124, |
David Ng | dc2d1a5 | 2013-02-12 18:11:56 -0800 | [diff] [blame] | 222 | MSM8974 = 126, |
Channagoud Kadabi | 3acfb74 | 2011-11-15 18:19:32 +0530 | [diff] [blame] | 223 | MSM8225 = 127, |
Ajay Dudani | 7d16254 | 2012-02-16 19:51:14 -0800 | [diff] [blame] | 224 | MSM8625 = 129, |
| 225 | MPQ8064 = 130, |
Channagoud Kadabi | bd14e2f | 2012-05-03 22:54:50 +0530 | [diff] [blame] | 226 | MSM7225AB = 131, |
| 227 | MSM7625AB = 132, |
| 228 | ESM7225AB = 133, |
Neeti Desai | 465491e | 2012-07-31 12:53:35 -0700 | [diff] [blame] | 229 | MDM9625 = 134, |
Channagoud Kadabi | 647f085 | 2012-06-08 11:51:45 +0530 | [diff] [blame] | 230 | MSM7125A = 135, |
| 231 | MSM7127A = 136, |
Aparna Mallavarapu | 5187941 | 2012-08-27 12:55:50 +0530 | [diff] [blame] | 232 | MSM8125A = 137, |
Neeti Desai | 6e01525 | 2012-08-13 13:22:37 -0700 | [diff] [blame] | 233 | MSM8960AB = 138, |
| 234 | APQ8060AB = 139, |
| 235 | MSM8260AB = 140, |
| 236 | MSM8660AB = 141, |
Neeti Desai | 5ccd864 | 2012-07-17 12:43:43 -0700 | [diff] [blame] | 237 | MSM8930AA = 142, |
| 238 | MSM8630AA = 143, |
| 239 | MSM8230AA = 144, |
Amol Jadi | 117ef3a | 2012-09-20 13:32:55 -0700 | [diff] [blame] | 240 | MDM9225 = 149, |
| 241 | MDM9225M = 150, |
| 242 | MDM9625M = 152, |
| 243 | APQ8064AB = 153, /* aka V2 PRIME */ |
Amol Jadi | 6d91374 | 2012-10-16 12:12:23 -0700 | [diff] [blame] | 244 | MSM8930AB = 154, |
| 245 | MSM8630AB = 155, |
| 246 | MSM8230AB = 156, |
| 247 | APQ8030AB = 157, |
Channagoud Kadabi | 512295f | 2012-10-23 10:00:42 +0530 | [diff] [blame] | 248 | APQ8030AA = 160, |
Aparna Mallavarapu | e07cfff | 2012-10-31 12:07:59 +0530 | [diff] [blame] | 249 | MSM8125 = 167, |
Aparna Mallavarapu | 2269a2f | 2013-01-07 19:44:48 +0530 | [diff] [blame] | 250 | APQ8064AA = 172, /* aka V2 SLOW_PRIME */ |
David Ng | dc2d1a5 | 2013-02-12 18:11:56 -0800 | [diff] [blame] | 251 | MSM8130 = 179, |
| 252 | MSM8130AA = 180, |
| 253 | MSM8130AB = 181, |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 254 | }; |
| 255 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 256 | enum platform { |
| 257 | HW_PLATFORM_UNKNOWN = 0, |
| 258 | HW_PLATFORM_SURF = 1, |
| 259 | HW_PLATFORM_FFA = 2, |
| 260 | HW_PLATFORM_FLUID = 3, |
| 261 | HW_PLATFORM_SVLTE = 4, |
| 262 | HW_PLATFORM_QT = 6, |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 263 | HW_PLATFORM_MTP_MDM = 7, |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 264 | HW_PLATFORM_MTP = 8, |
| 265 | HW_PLATFORM_LIQUID = 9, |
| 266 | HW_PLATFORM_DRAGON = 10, |
Ajay Dudani | 7d16254 | 2012-02-16 19:51:14 -0800 | [diff] [blame] | 267 | HW_PLATFORM_HRD = 13, |
| 268 | HW_PLATFORM_DTV = 14, |
V S Ramanjaneya Kumar T | c633fe1 | 2013-01-08 14:55:54 -0500 | [diff] [blame] | 269 | HW_PLATFORM_RUMI = 15, |
| 270 | HW_PLATFORM_VIRTIO = 16, |
| 271 | HW_PLATFORM_BTS = 19, |
Aparna Mallavarapu | 6145c43 | 2013-02-05 19:27:30 +0530 | [diff] [blame] | 272 | HW_PLATFORM_DMA = 22, |
Neeti Desai | 465491e | 2012-07-31 12:53:35 -0700 | [diff] [blame] | 273 | HW_PLATFORM_32BITS = 0x7FFFFFFF, |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 274 | }; |
| 275 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 276 | enum platform_subtype { |
| 277 | HW_PLATFORM_SUBTYPE_UNKNOWN = 0, |
| 278 | HW_PLATFORM_SUBTYPE_MDM = 1, |
| 279 | HW_PLATFORM_SUBTYPE_CSFB = 1, |
| 280 | HW_PLATFORM_SUBTYPE_SVLTE1 = 2, |
| 281 | HW_PLATFORM_SUBTYPE_SVLTE2A = 3, |
Amol Jadi | 5c61a95 | 2012-05-04 17:05:35 -0700 | [diff] [blame] | 282 | HW_PLATFORM_SUBTYPE_SGLTE = 6, |
Channagoud Kadabi | 141f298 | 2012-10-31 11:23:02 +0530 | [diff] [blame] | 283 | HW_PLATFORM_SUBTYPE_DSDA = 7, |
Amol Jadi | 9f04e7e | 2013-01-22 12:08:35 -0800 | [diff] [blame] | 284 | HW_PLATFORM_SUBTYPE_DSDA2 = 8, |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 285 | HW_PLATFORM_SUBTYPE_32BITS = 0x7FFFFFFF |
Ajay Dudani | 6cff85e | 2011-02-04 16:02:16 -0800 | [diff] [blame] | 286 | }; |
| 287 | |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 288 | typedef enum { |
| 289 | SMEM_SPINLOCK_ARRAY = 7, |
| 290 | |
| 291 | SMEM_AARM_PARTITION_TABLE = 9, |
| 292 | |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 293 | SMEM_APPS_BOOT_MODE = 106, |
Chandan Uddaraju | de85d3f | 2010-01-05 16:32:33 -0800 | [diff] [blame] | 294 | |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 295 | SMEM_BOARD_INFO_LOCATION = 137, |
Chandan Uddaraju | 885e4db | 2009-12-03 22:45:26 -0800 | [diff] [blame] | 296 | |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 297 | SMEM_USABLE_RAM_PARTITION_TABLE = 402, |
| 298 | |
David Ng | f773dde | 2010-07-26 19:55:08 -0700 | [diff] [blame] | 299 | SMEM_POWER_ON_STATUS_INFO = 403, |
| 300 | |
Channagoud Kadabi | e1ecef5 | 2012-02-04 15:54:34 +0530 | [diff] [blame] | 301 | SMEM_RLOCK_AREA = 404, |
| 302 | |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 303 | SMEM_BOOT_INFO_FOR_APPS = 418, |
| 304 | |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 305 | SMEM_FIRST_VALID_TYPE = SMEM_SPINLOCK_ARRAY, |
Subbaraman Narayanamurthy | 0e445b0 | 2011-06-19 21:34:46 -0700 | [diff] [blame] | 306 | SMEM_LAST_VALID_TYPE = SMEM_BOOT_INFO_FOR_APPS, |
Neeti Desai | 800e84f | 2012-04-09 15:14:08 -0700 | [diff] [blame] | 307 | |
| 308 | SMEM_MAX_SIZE = SMEM_BOOT_INFO_FOR_APPS + 1, |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 309 | } smem_mem_type_t; |
| 310 | |
| 311 | /* Note: buf MUST be 4byte aligned, and max_len MUST be a multiple of 4. */ |
| 312 | unsigned smem_read_alloc_entry(smem_mem_type_t type, void *buf, int max_len); |
| 313 | |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 314 | /* SMEM RAM Partition */ |
| 315 | enum { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 316 | DEFAULT_ATTRB = ~0x0, |
| 317 | READ_ONLY = 0x0, |
| 318 | READWRITE, |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 319 | }; |
| 320 | |
| 321 | enum { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 322 | DEFAULT_CATEGORY = ~0x0, |
| 323 | SMI = 0x0, |
| 324 | EBI1, |
| 325 | EBI2, |
| 326 | QDSP6, |
| 327 | IRAM, |
| 328 | IMEM, |
| 329 | EBI0_CS0, |
| 330 | EBI0_CS1, |
| 331 | EBI1_CS0, |
| 332 | EBI1_CS1, |
| 333 | SDRAM = 0xE, |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 334 | }; |
| 335 | |
| 336 | enum { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 337 | DEFAULT_DOMAIN = 0x0, |
| 338 | APPS_DOMAIN, |
| 339 | MODEM_DOMAIN, |
| 340 | SHARED_DOMAIN, |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 341 | }; |
| 342 | |
Ajay Dudani | dfef90b | 2010-09-22 10:21:05 -0700 | [diff] [blame] | 343 | enum { |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 344 | SYS_MEMORY = 1, /* system memory */ |
| 345 | BOOT_REGION_MEMORY1, /* boot loader memory 1 */ |
| 346 | BOOT_REGION_MEMORY2, /* boot loader memory 2,reserved */ |
| 347 | APPSBL_MEMORY, /* apps boot loader memory */ |
| 348 | APPS_MEMORY, /* apps usage memory */ |
Ajay Dudani | dfef90b | 2010-09-22 10:21:05 -0700 | [diff] [blame] | 349 | }; |
| 350 | |
Neeti Desai | d5b5055 | 2012-03-23 12:39:01 -0700 | [diff] [blame] | 351 | struct smem { |
| 352 | struct smem_proc_comm proc_comm[4]; |
| 353 | unsigned version_info[32]; |
| 354 | struct smem_heap_info heap_info; |
Neeti Desai | 800e84f | 2012-04-09 15:14:08 -0700 | [diff] [blame] | 355 | struct smem_alloc_info alloc_info[SMEM_MAX_SIZE]; |
Neeti Desai | d5b5055 | 2012-03-23 12:39:01 -0700 | [diff] [blame] | 356 | }; |
| 357 | |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 358 | struct smem_ram_ptn { |
| 359 | char name[16]; |
| 360 | unsigned start; |
| 361 | unsigned size; |
| 362 | |
| 363 | /* RAM Partition attribute: READ_ONLY, READWRITE etc. */ |
| 364 | unsigned attr; |
| 365 | |
| 366 | /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */ |
| 367 | unsigned category; |
| 368 | |
| 369 | /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */ |
| 370 | unsigned domain; |
| 371 | |
Ajay Dudani | dfef90b | 2010-09-22 10:21:05 -0700 | [diff] [blame] | 372 | /* RAM Partition type: system, bootloader, appsboot, apps etc. */ |
| 373 | unsigned type; |
| 374 | |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 375 | /* reserved for future expansion without changing version number */ |
Ajay Dudani | dfef90b | 2010-09-22 10:21:05 -0700 | [diff] [blame] | 376 | unsigned reserved2, reserved3, reserved4, reserved5; |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 377 | } __attribute__ ((__packed__)); |
| 378 | |
| 379 | struct smem_ram_ptable { |
| 380 | #define _SMEM_RAM_PTABLE_MAGIC_1 0x9DA5E0A8 |
| 381 | #define _SMEM_RAM_PTABLE_MAGIC_2 0xAF9EC4E2 |
| 382 | unsigned magic[2]; |
| 383 | unsigned version; |
| 384 | unsigned reserved1; |
| 385 | unsigned len; |
| 386 | struct smem_ram_ptn parts[32]; |
| 387 | unsigned buf; |
| 388 | } __attribute__ ((__packed__)); |
| 389 | |
David Ng | f773dde | 2010-07-26 19:55:08 -0700 | [diff] [blame] | 390 | /* Power on reason/status info */ |
Shashank Mittal | 6df1607 | 2011-07-14 18:44:01 -0700 | [diff] [blame] | 391 | #define PWR_ON_EVENT_RTC_ALARM 0x2 |
Ajay Dudani | ba82233 | 2011-11-25 13:37:31 -0800 | [diff] [blame] | 392 | #define PWR_ON_EVENT_USB_CHG 0x20 |
| 393 | #define PWR_ON_EVENT_WALL_CHG 0x40 |
Greg Grisco | d2471ef | 2011-07-14 13:00:42 -0700 | [diff] [blame] | 394 | |
Amol Jadi | 6133e8d | 2012-10-07 22:15:02 -0700 | [diff] [blame] | 395 | #define SMEM_PTABLE_MAX_PARTS_V3 16 |
| 396 | #define SMEM_PTABLE_MAX_PARTS_V4 32 |
| 397 | #define SMEM_PTABLE_MAX_PARTS SMEM_PTABLE_MAX_PARTS_V4 |
| 398 | |
| 399 | #define SMEM_PTABLE_HDR_LEN (4*sizeof(unsigned)) |
| 400 | |
| 401 | struct smem_ptn { |
| 402 | char name[16]; |
| 403 | unsigned start; |
| 404 | unsigned size; |
| 405 | unsigned attr; |
| 406 | } __attribute__ ((__packed__)); |
| 407 | |
| 408 | |
| 409 | struct smem_ptable { |
| 410 | #define _SMEM_PTABLE_MAGIC_1 0x55ee73aa |
| 411 | #define _SMEM_PTABLE_MAGIC_2 0xe35ebddb |
| 412 | unsigned magic[2]; |
| 413 | unsigned version; |
| 414 | unsigned len; |
| 415 | struct smem_ptn parts[SMEM_PTABLE_MAX_PARTS]; |
| 416 | } __attribute__ ((__packed__)); |
| 417 | |
| 418 | 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] | 419 | int smem_ram_ptable_init(struct smem_ram_ptable *smem_ram_ptable); |
| 420 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 421 | #endif /* __PLATFORM_MSM_SHARED_SMEM_H */ |