blob: 71da3450e9aab98d8790ffe722147906ee0d0c5c [file] [log] [blame]
Dima Zavina404bce2009-01-26 12:32:22 -08001/*
2 * Copyright (c) 2009, Google Inc.
3 * All rights reserved.
4 *
Chandan Uddaraju885e4db2009-12-03 22:45:26 -08005 * Copyright (c) 2009, Code Aurora Forum. All rights reserved.
6 *
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
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
36struct smem_proc_comm
37{
38 unsigned command;
39 unsigned status;
40 unsigned data1;
41 unsigned data2;
42};
43
44struct smem_heap_info
45{
46 unsigned initialized;
47 unsigned free_offset;
48 unsigned heap_remaining;
49 unsigned reserved;
50};
51
52struct smem_alloc_info
53{
54 unsigned allocated;
55 unsigned offset;
56 unsigned size;
57 unsigned reserved;
58};
59
60struct 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 Punurucfb5a462011-02-08 11:55:24 -080067struct 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 Uddaraju1434a602010-03-08 17:13:38 -080077struct smem_board_info_v3
Chandan Uddaraju885e4db2009-12-03 22:45:26 -080078{
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 Uddaraju1434a602010-03-08 17:13:38 -080088struct 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 Dudani16ea8fb2010-11-23 19:15:38 -080095struct smem_board_info_v5
96{
97 struct smem_board_info_v3 board_info_v3;
98 unsigned platform_version;
99 unsigned fused_chip;
100};
101
Ajay Dudani6cff85e2011-02-04 16:02:16 -0800102struct smem_board_info_v6
103{
104 struct smem_board_info_v3 board_info_v3;
105 unsigned platform_version;
106 unsigned fused_chip;
107 unsigned platform_subtype;
108 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
109};
110
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800111/* chip information */
112enum {
113 UNKNOWN = 0,
114 MDM9200 = 57,
115 MDM9600 = 58,
Ajay Dudanid04110c2011-01-17 23:55:07 -0800116 MSM8260 = 70,
117 MSM8660 = 71,
118 APQ8060 = 86,
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800119};
120
121enum platform
122{
123 HW_PLATFORM_UNKNOWN = 0,
124 HW_PLATFORM_SURF = 1,
125 HW_PLATFORM_FFA = 2,
126 HW_PLATFORM_FLUID = 3,
127 HW_PLATFORM_SVLTE = 4,
Ajay Dudani8b3262a2011-01-17 13:55:30 -0800128 HW_PLATFORM_QT = 6,
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800129 HW_PLATFORM_32BITS = 0x7FFFFFFF
130};
131
Ajay Dudani6cff85e2011-02-04 16:02:16 -0800132enum platform_subtype
133{
134 HW_PLATFORM_SUBTYPE_UNKNOWN = 0,
135 HW_PLATFORM_SUBTYPE_CSFB = 1,
136 HW_PLATFORM_SUBTYPE_SVLTE1 = 2,
137 HW_PLATFORM_SUBTYPE_SVLTE2A = 3,
138 HW_PLATFORM_SUBTYPE_32BITS = 0x7FFFFFFF
139};
140
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800141
Dima Zavina404bce2009-01-26 12:32:22 -0800142typedef enum {
143 SMEM_SPINLOCK_ARRAY = 7,
144
145 SMEM_AARM_PARTITION_TABLE = 9,
146
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800147 SMEM_APPS_BOOT_MODE = 106,
Chandan Uddarajude85d3f2010-01-05 16:32:33 -0800148
Ajay Dudani16ea8fb2010-11-23 19:15:38 -0800149 SMEM_BOARD_INFO_LOCATION = 137,
Chandan Uddaraju885e4db2009-12-03 22:45:26 -0800150
Ajay Dudania1eafc42010-04-21 19:48:11 -0700151 SMEM_USABLE_RAM_PARTITION_TABLE = 402,
152
David Ngf773dde2010-07-26 19:55:08 -0700153 SMEM_POWER_ON_STATUS_INFO = 403,
154
Dima Zavina404bce2009-01-26 12:32:22 -0800155 SMEM_FIRST_VALID_TYPE = SMEM_SPINLOCK_ARRAY,
Wentao Xu530c2d82010-11-09 18:30:18 -0500156 SMEM_LAST_VALID_TYPE = SMEM_POWER_ON_STATUS_INFO,
Dima Zavina404bce2009-01-26 12:32:22 -0800157} smem_mem_type_t;
158
159/* Note: buf MUST be 4byte aligned, and max_len MUST be a multiple of 4. */
160unsigned smem_read_alloc_entry(smem_mem_type_t type, void *buf, int max_len);
161
Ajay Dudania1eafc42010-04-21 19:48:11 -0700162/* SMEM RAM Partition */
163enum {
164 DEFAULT_ATTRB = ~0x0,
165 READ_ONLY = 0x0,
166 READWRITE,
167};
168
169enum {
170 DEFAULT_CATEGORY = ~0x0,
171 SMI = 0x0,
172 EBI1,
173 EBI2,
174 QDSP6,
175 IRAM,
176 IMEM,
177 EBI0_CS0,
178 EBI0_CS1,
179 EBI1_CS0,
180 EBI1_CS1,
181};
182
183enum {
184 DEFAULT_DOMAIN = 0x0,
185 APPS_DOMAIN,
186 MODEM_DOMAIN,
187 SHARED_DOMAIN,
188};
189
Ajay Dudanidfef90b2010-09-22 10:21:05 -0700190enum {
191 SYS_MEMORY = 1, /* system memory*/
192 BOOT_REGION_MEMORY1, /* boot loader memory 1*/
193 BOOT_REGION_MEMORY2, /* boot loader memory 2,reserved*/
194 APPSBL_MEMORY, /* apps boot loader memory*/
195 APPS_MEMORY, /* apps usage memory*/
196};
197
Ajay Dudania1eafc42010-04-21 19:48:11 -0700198struct smem_ram_ptn {
199 char name[16];
200 unsigned start;
201 unsigned size;
202
203 /* RAM Partition attribute: READ_ONLY, READWRITE etc. */
204 unsigned attr;
205
206 /* RAM Partition category: EBI0, EBI1, IRAM, IMEM */
207 unsigned category;
208
209 /* RAM Partition domain: APPS, MODEM, APPS & MODEM (SHARED) etc. */
210 unsigned domain;
211
Ajay Dudanidfef90b2010-09-22 10:21:05 -0700212 /* RAM Partition type: system, bootloader, appsboot, apps etc. */
213 unsigned type;
214
Ajay Dudania1eafc42010-04-21 19:48:11 -0700215 /* reserved for future expansion without changing version number */
Ajay Dudanidfef90b2010-09-22 10:21:05 -0700216 unsigned reserved2, reserved3, reserved4, reserved5;
Ajay Dudania1eafc42010-04-21 19:48:11 -0700217} __attribute__ ((__packed__));
218
219struct smem_ram_ptable {
220#define _SMEM_RAM_PTABLE_MAGIC_1 0x9DA5E0A8
221#define _SMEM_RAM_PTABLE_MAGIC_2 0xAF9EC4E2
222 unsigned magic[2];
223 unsigned version;
224 unsigned reserved1;
225 unsigned len;
226 struct smem_ram_ptn parts[32];
227 unsigned buf;
228} __attribute__ ((__packed__));
229
David Ngf773dde2010-07-26 19:55:08 -0700230/* Power on reason/status info */
231#define PWR_ON_EVENT_USB_CHG 0x20
Ajay Dudania1eafc42010-04-21 19:48:11 -0700232
Dima Zavina404bce2009-01-26 12:32:22 -0800233#endif /* __PLATFORM_MSM_SHARED_SMEM_H */