blob: 57f22cc1ab7308eb95b65c5eb4811c0c73f57462 [file] [log] [blame]
Jeff Hugo5ba15fe2013-05-06 14:24:24 -06001/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef _ARCH_ARM_MACH_MSM_SMEM_H_
14#define _ARCH_ARM_MACH_MSM_SMEM_H_
15
16#include <linux/types.h>
17
18enum {
19 SMEM_APPS,
20 SMEM_MODEM,
21 SMEM_Q6,
22 SMEM_DSPS,
23 SMEM_WCNSS,
24 SMEM_MODEM_Q6_FW,
25 SMEM_RPM,
26 NUM_SMEM_SUBSYSTEMS,
27};
28
29#define SMEM_NUM_SMD_STREAM_CHANNELS 64
30#define SMEM_NUM_SMD_BLOCK_CHANNELS 64
31
32enum {
33 /* fixed items */
34 SMEM_PROC_COMM = 0,
35 SMEM_HEAP_INFO,
36 SMEM_ALLOCATION_TABLE,
37 SMEM_VERSION_INFO,
38 SMEM_HW_RESET_DETECT,
39 SMEM_AARM_WARM_BOOT,
40 SMEM_DIAG_ERR_MESSAGE,
41 SMEM_SPINLOCK_ARRAY,
42 SMEM_MEMORY_BARRIER_LOCATION,
43 SMEM_FIXED_ITEM_LAST = SMEM_MEMORY_BARRIER_LOCATION,
44
45 /* dynamic items */
46 SMEM_AARM_PARTITION_TABLE,
47 SMEM_AARM_BAD_BLOCK_TABLE,
48 SMEM_RESERVE_BAD_BLOCKS,
49 SMEM_WM_UUID,
50 SMEM_CHANNEL_ALLOC_TBL,
51 SMEM_SMD_BASE_ID,
52 SMEM_SMEM_LOG_IDX = SMEM_SMD_BASE_ID + SMEM_NUM_SMD_STREAM_CHANNELS,
53 SMEM_SMEM_LOG_EVENTS,
54 SMEM_SMEM_STATIC_LOG_IDX,
55 SMEM_SMEM_STATIC_LOG_EVENTS,
56 SMEM_SMEM_SLOW_CLOCK_SYNC,
57 SMEM_SMEM_SLOW_CLOCK_VALUE,
58 SMEM_BIO_LED_BUF,
59 SMEM_SMSM_SHARED_STATE,
60 SMEM_SMSM_INT_INFO,
61 SMEM_SMSM_SLEEP_DELAY,
62 SMEM_SMSM_LIMIT_SLEEP,
63 SMEM_SLEEP_POWER_COLLAPSE_DISABLED,
64 SMEM_KEYPAD_KEYS_PRESSED,
65 SMEM_KEYPAD_STATE_UPDATED,
66 SMEM_KEYPAD_STATE_IDX,
67 SMEM_GPIO_INT,
68 SMEM_MDDI_LCD_IDX,
69 SMEM_MDDI_HOST_DRIVER_STATE,
70 SMEM_MDDI_LCD_DISP_STATE,
71 SMEM_LCD_CUR_PANEL,
72 SMEM_MARM_BOOT_SEGMENT_INFO,
73 SMEM_AARM_BOOT_SEGMENT_INFO,
74 SMEM_SLEEP_STATIC,
75 SMEM_SCORPION_FREQUENCY,
76 SMEM_SMD_PROFILES,
77 SMEM_TSSC_BUSY,
78 SMEM_HS_SUSPEND_FILTER_INFO,
79 SMEM_BATT_INFO,
80 SMEM_APPS_BOOT_MODE,
81 SMEM_VERSION_FIRST,
82 SMEM_VERSION_SMD = SMEM_VERSION_FIRST,
83 SMEM_VERSION_LAST = SMEM_VERSION_FIRST + 24,
84 SMEM_OSS_RRCASN1_BUF1,
85 SMEM_OSS_RRCASN1_BUF2,
86 SMEM_ID_VENDOR0,
87 SMEM_ID_VENDOR1,
88 SMEM_ID_VENDOR2,
89 SMEM_HW_SW_BUILD_ID,
90 SMEM_SMD_BLOCK_PORT_BASE_ID,
91 SMEM_SMD_BLOCK_PORT_PROC0_HEAP = SMEM_SMD_BLOCK_PORT_BASE_ID +
92 SMEM_NUM_SMD_BLOCK_CHANNELS,
93 SMEM_SMD_BLOCK_PORT_PROC1_HEAP = SMEM_SMD_BLOCK_PORT_PROC0_HEAP +
94 SMEM_NUM_SMD_BLOCK_CHANNELS,
95 SMEM_I2C_MUTEX = SMEM_SMD_BLOCK_PORT_PROC1_HEAP +
96 SMEM_NUM_SMD_BLOCK_CHANNELS,
97 SMEM_SCLK_CONVERSION,
98 SMEM_SMD_SMSM_INTR_MUX,
99 SMEM_SMSM_CPU_INTR_MASK,
100 SMEM_APPS_DEM_SLAVE_DATA,
101 SMEM_QDSP6_DEM_SLAVE_DATA,
102 SMEM_CLKREGIM_BSP,
103 SMEM_CLKREGIM_SOURCES,
104 SMEM_SMD_FIFO_BASE_ID,
105 SMEM_USABLE_RAM_PARTITION_TABLE = SMEM_SMD_FIFO_BASE_ID +
106 SMEM_NUM_SMD_STREAM_CHANNELS,
107 SMEM_POWER_ON_STATUS_INFO,
108 SMEM_DAL_AREA,
109 SMEM_SMEM_LOG_POWER_IDX,
110 SMEM_SMEM_LOG_POWER_WRAP,
111 SMEM_SMEM_LOG_POWER_EVENTS,
112 SMEM_ERR_CRASH_LOG,
113 SMEM_ERR_F3_TRACE_LOG,
114 SMEM_SMD_BRIDGE_ALLOC_TABLE,
115 SMEM_SMDLITE_TABLE,
116 SMEM_SD_IMG_UPGRADE_STATUS,
117 SMEM_SEFS_INFO,
118 SMEM_RESET_LOG,
119 SMEM_RESET_LOG_SYMBOLS,
120 SMEM_MODEM_SW_BUILD_ID,
121 SMEM_SMEM_LOG_MPROC_WRAP,
122 SMEM_BOOT_INFO_FOR_APPS,
123 SMEM_SMSM_SIZE_INFO,
124 SMEM_SMD_LOOPBACK_REGISTER,
125 SMEM_SSR_REASON_MSS0,
126 SMEM_SSR_REASON_WCNSS0,
127 SMEM_SSR_REASON_LPASS0,
128 SMEM_SSR_REASON_DSPS0,
129 SMEM_SSR_REASON_VCODEC0,
130 SMEM_SMP2P_APPS_BASE = 427,
131 SMEM_SMP2P_MODEM_BASE = SMEM_SMP2P_APPS_BASE + 8, /* 435 */
132 SMEM_SMP2P_AUDIO_BASE = SMEM_SMP2P_MODEM_BASE + 8, /* 443 */
133 SMEM_SMP2P_WIRLESS_BASE = SMEM_SMP2P_AUDIO_BASE + 8, /* 451 */
134 SMEM_SMP2P_POWER_BASE = SMEM_SMP2P_WIRLESS_BASE + 8, /* 459 */
135 SMEM_FLASH_DEVICE_INFO = SMEM_SMP2P_POWER_BASE + 8, /* 467 */
136 SMEM_BAM_PIPE_MEMORY, /* 468 */
137 SMEM_IMAGE_VERSION_TABLE, /* 469 */
138 SMEM_LC_DEBUGGER, /* 470 */
139 SMEM_NUM_ITEMS,
140};
141
142#ifdef CONFIG_MSM_SMD
143void *smem_alloc(unsigned id, unsigned size);
144void *smem_alloc2(unsigned id, unsigned size_in);
145void *smem_get_entry(unsigned id, unsigned *size);
146void *smem_find(unsigned id, unsigned size);
147/**
148 * smem_virt_to_phys() - Convert SMEM address to physical address.
149 *
150 * @smem_address: Virtual address returned by smem_alloc()/smem_alloc2()
151 * @returns: Physical address (or NULL if there is a failure)
152 *
153 * This function should only be used if an SMEM item needs to be handed
154 * off to a DMA engine.
155 */
156phys_addr_t smem_virt_to_phys(void *smem_address);
157
158#else
159static inline void *smem_alloc(unsigned id, unsigned size)
160{
161 return NULL;
162}
163static inline void *smem_alloc2(unsigned id, unsigned size_in)
164{
165 return NULL;
166}
167static inline void *smem_get_entry(unsigned id, unsigned *size)
168{
169 return NULL;
170}
171static inline void *smem_find(unsigned id, unsigned size)
172{
173 return NULL;
174}
175static inline phys_addr_t smem_virt_to_phys(void *smem_address)
176{
177 return (phys_addr_t) NULL;
178}
179#endif /* CONFIG_MSM_SMD */
180#endif /* _ARCH_ARM_MACH_MSM_SMEM_H_ */