Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2009, Google Inc. |
| 3 | * All rights reserved. |
| 4 | * |
Chandan Uddaraju | 885e4db | 2009-12-03 22:45:26 -0800 | [diff] [blame] | 5 | * Copyright (c) 2009, Code Aurora Forum. All rights reserved. |
| 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 |
| 14 | * the documentation and/or other materials provided with the |
| 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 |
| 24 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 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 | |
| 36 | struct smem_proc_comm |
| 37 | { |
| 38 | unsigned command; |
| 39 | unsigned status; |
| 40 | unsigned data1; |
| 41 | unsigned data2; |
| 42 | }; |
| 43 | |
| 44 | struct smem_heap_info |
| 45 | { |
| 46 | unsigned initialized; |
| 47 | unsigned free_offset; |
| 48 | unsigned heap_remaining; |
| 49 | unsigned reserved; |
| 50 | }; |
| 51 | |
| 52 | struct smem_alloc_info |
| 53 | { |
| 54 | unsigned allocated; |
| 55 | unsigned offset; |
| 56 | unsigned size; |
| 57 | unsigned reserved; |
| 58 | }; |
| 59 | |
| 60 | struct smem { |
| 61 | struct smem_proc_comm proc_comm[4]; |
| 62 | unsigned version_info[32]; |
| 63 | struct smem_heap_info heap_info; |
| 64 | struct smem_alloc_info alloc_info[128]; |
| 65 | }; |
| 66 | |
Srilakshmi Punuru | cfb5a46 | 2011-02-08 11:55:24 -0800 | [diff] [blame^] | 67 | struct smem_board_info_v2 |
| 68 | { |
| 69 | unsigned format; |
| 70 | unsigned msm_id; |
| 71 | unsigned msm_version; |
| 72 | char build_id[32]; |
| 73 | unsigned raw_msm_id; |
| 74 | unsigned raw_msm_version; |
| 75 | }; |
| 76 | |
Chandan Uddaraju | 1434a60 | 2010-03-08 17:13:38 -0800 | [diff] [blame] | 77 | struct smem_board_info_v3 |
Chandan Uddaraju | 885e4db | 2009-12-03 22:45:26 -0800 | [diff] [blame] | 78 | { |
| 79 | unsigned format; |
| 80 | unsigned msm_id; |
| 81 | unsigned msm_version; |
| 82 | char build_id[32]; |
| 83 | unsigned raw_msm_id; |
| 84 | unsigned raw_msm_version; |
| 85 | unsigned hw_platform; |
| 86 | }; |
| 87 | |
Chandan Uddaraju | 1434a60 | 2010-03-08 17:13:38 -0800 | [diff] [blame] | 88 | struct smem_board_info_v4 |
| 89 | { |
| 90 | struct smem_board_info_v3 board_info_v3; |
| 91 | unsigned platform_version; |
| 92 | unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory. |
| 93 | }; |
| 94 | |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 95 | struct smem_board_info_v5 |
| 96 | { |
| 97 | struct smem_board_info_v3 board_info_v3; |
| 98 | unsigned platform_version; |
| 99 | unsigned fused_chip; |
| 100 | }; |
| 101 | |
| 102 | /* chip information */ |
| 103 | enum { |
| 104 | UNKNOWN = 0, |
| 105 | MDM9200 = 57, |
| 106 | MDM9600 = 58, |
Ajay Dudani | d04110c | 2011-01-17 23:55:07 -0800 | [diff] [blame] | 107 | MSM8260 = 70, |
| 108 | MSM8660 = 71, |
| 109 | APQ8060 = 86, |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 110 | }; |
| 111 | |
| 112 | enum platform |
| 113 | { |
| 114 | HW_PLATFORM_UNKNOWN = 0, |
| 115 | HW_PLATFORM_SURF = 1, |
| 116 | HW_PLATFORM_FFA = 2, |
| 117 | HW_PLATFORM_FLUID = 3, |
| 118 | HW_PLATFORM_SVLTE = 4, |
Ajay Dudani | 8b3262a | 2011-01-17 13:55:30 -0800 | [diff] [blame] | 119 | HW_PLATFORM_QT = 6, |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 120 | HW_PLATFORM_32BITS = 0x7FFFFFFF |
| 121 | }; |
| 122 | |
| 123 | |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 124 | typedef enum { |
| 125 | SMEM_SPINLOCK_ARRAY = 7, |
| 126 | |
| 127 | SMEM_AARM_PARTITION_TABLE = 9, |
| 128 | |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 129 | SMEM_APPS_BOOT_MODE = 106, |
Chandan Uddaraju | de85d3f | 2010-01-05 16:32:33 -0800 | [diff] [blame] | 130 | |
Ajay Dudani | 16ea8fb | 2010-11-23 19:15:38 -0800 | [diff] [blame] | 131 | SMEM_BOARD_INFO_LOCATION = 137, |
Chandan Uddaraju | 885e4db | 2009-12-03 22:45:26 -0800 | [diff] [blame] | 132 | |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 133 | SMEM_USABLE_RAM_PARTITION_TABLE = 402, |
| 134 | |
David Ng | f773dde | 2010-07-26 19:55:08 -0700 | [diff] [blame] | 135 | SMEM_POWER_ON_STATUS_INFO = 403, |
| 136 | |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 137 | SMEM_FIRST_VALID_TYPE = SMEM_SPINLOCK_ARRAY, |
Wentao Xu | 530c2d8 | 2010-11-09 18:30:18 -0500 | [diff] [blame] | 138 | SMEM_LAST_VALID_TYPE = SMEM_POWER_ON_STATUS_INFO, |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 139 | } smem_mem_type_t; |
| 140 | |
| 141 | /* Note: buf MUST be 4byte aligned, and max_len MUST be a multiple of 4. */ |
| 142 | unsigned smem_read_alloc_entry(smem_mem_type_t type, void *buf, int max_len); |
| 143 | |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 144 | /* SMEM RAM Partition */ |
| 145 | enum { |
| 146 | DEFAULT_ATTRB = ~0x0, |
| 147 | READ_ONLY = 0x0, |
| 148 | READWRITE, |
| 149 | }; |
| 150 | |
| 151 | enum { |
| 152 | DEFAULT_CATEGORY = ~0x0, |
| 153 | SMI = 0x0, |
| 154 | EBI1, |
| 155 | EBI2, |
| 156 | QDSP6, |
| 157 | IRAM, |
| 158 | IMEM, |
| 159 | EBI0_CS0, |
| 160 | EBI0_CS1, |
| 161 | EBI1_CS0, |
| 162 | EBI1_CS1, |
| 163 | }; |
| 164 | |
| 165 | enum { |
| 166 | DEFAULT_DOMAIN = 0x0, |
| 167 | APPS_DOMAIN, |
| 168 | MODEM_DOMAIN, |
| 169 | SHARED_DOMAIN, |
| 170 | }; |
| 171 | |
Ajay Dudani | dfef90b | 2010-09-22 10:21:05 -0700 | [diff] [blame] | 172 | enum { |
| 173 | SYS_MEMORY = 1, /* system memory*/ |
| 174 | BOOT_REGION_MEMORY1, /* boot loader memory 1*/ |
| 175 | BOOT_REGION_MEMORY2, /* boot loader memory 2,reserved*/ |
| 176 | APPSBL_MEMORY, /* apps boot loader memory*/ |
| 177 | APPS_MEMORY, /* apps usage memory*/ |
| 178 | }; |
| 179 | |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 180 | struct smem_ram_ptn { |
| 181 | char name[16]; |
| 182 | unsigned start; |
| 183 | unsigned size; |
| 184 | |
| 185 | /* RAM Partition attribute: READ_ONLY, READWRITE etc. */ |
| 186 | unsigned attr; |
| 187 | |
| 188 | /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */ |
| 189 | unsigned category; |
| 190 | |
| 191 | /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */ |
| 192 | unsigned domain; |
| 193 | |
Ajay Dudani | dfef90b | 2010-09-22 10:21:05 -0700 | [diff] [blame] | 194 | /* RAM Partition type: system, bootloader, appsboot, apps etc. */ |
| 195 | unsigned type; |
| 196 | |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 197 | /* reserved for future expansion without changing version number */ |
Ajay Dudani | dfef90b | 2010-09-22 10:21:05 -0700 | [diff] [blame] | 198 | unsigned reserved2, reserved3, reserved4, reserved5; |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 199 | } __attribute__ ((__packed__)); |
| 200 | |
| 201 | struct smem_ram_ptable { |
| 202 | #define _SMEM_RAM_PTABLE_MAGIC_1 0x9DA5E0A8 |
| 203 | #define _SMEM_RAM_PTABLE_MAGIC_2 0xAF9EC4E2 |
| 204 | unsigned magic[2]; |
| 205 | unsigned version; |
| 206 | unsigned reserved1; |
| 207 | unsigned len; |
| 208 | struct smem_ram_ptn parts[32]; |
| 209 | unsigned buf; |
| 210 | } __attribute__ ((__packed__)); |
| 211 | |
David Ng | f773dde | 2010-07-26 19:55:08 -0700 | [diff] [blame] | 212 | /* Power on reason/status info */ |
| 213 | #define PWR_ON_EVENT_USB_CHG 0x20 |
Ajay Dudani | a1eafc4 | 2010-04-21 19:48:11 -0700 | [diff] [blame] | 214 | |
Dima Zavin | a404bce | 2009-01-26 12:32:22 -0800 | [diff] [blame] | 215 | #endif /* __PLATFORM_MSM_SHARED_SMEM_H */ |