memoryOperation.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /* arch/arm/mach-msm/smd_private.h
  2. *
  3. * Copyright (C) 2007 Google, Inc.
  4. * Copyright (c) 2007 QUALCOMM Incorporated
  5. *
  6. * This software is licensed under the terms of the GNU General Public
  7. * License version 2, as published by the Free Software Foundation, and
  8. * may be copied, distributed, and modified under those terms.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. */
  16. #ifndef _ARCH_ARM_MACH_MSM_MSM_SMD_PRIVATE_H_
  17. #define _ARCH_ARM_MACH_MSM_MSM_SMD_PRIVATE_H_
  18. #include <linux/platform_device.h>
  19. #include <linux/spinlock.h>
  20. #include <linux/list.h>
  21. #include <linux/io.h>
  22. #include <mach/msm_iomap.h>
  23. struct smem_heap_info {
  24. unsigned initialized;
  25. unsigned free_offset;
  26. unsigned heap_remaining;
  27. unsigned reserved;
  28. };
  29. struct smem_heap_entry {
  30. unsigned allocated;
  31. unsigned offset;
  32. unsigned size;
  33. unsigned reserved;
  34. };
  35. struct smem_proc_comm {
  36. unsigned command;
  37. unsigned status;
  38. unsigned data1;
  39. unsigned data2;
  40. };
  41. #define PC_APPS 0
  42. #define PC_MODEM 1
  43. #define VERSION_SMD 0
  44. #define VERSION_QDSP6 4
  45. #define VERSION_APPS_SBL 6
  46. #define VERSION_MODEM_SBL 7
  47. #define VERSION_APPS 8
  48. #define VERSION_MODEM 9
  49. struct smem_shared {
  50. struct smem_proc_comm proc_comm[4];
  51. unsigned version[32];
  52. struct smem_heap_info heap_info;
  53. struct smem_heap_entry heap_toc[512];
  54. };
  55. #define SMSM_V1_SIZE (sizeof(unsigned) * 8)
  56. #define SMSM_V2_SIZE (sizeof(unsigned) * 4)
  57. #ifdef CONFIG_MSM_SMD_PKG3
  58. struct smsm_interrupt_info {
  59. uint32_t interrupt_mask;
  60. uint32_t pending_interrupts;
  61. uint32_t wakeup_reason;
  62. };
  63. #else
  64. #define DEM_MAX_PORT_NAME_LEN (20)
  65. struct msm_dem_slave_data {
  66. uint32_t sleep_time;
  67. uint32_t interrupt_mask;
  68. uint32_t resources_used;
  69. uint32_t reserved1;
  70. uint32_t wakeup_reason;
  71. uint32_t pending_interrupts;
  72. uint32_t rpc_prog;
  73. uint32_t rpc_proc;
  74. char smd_port_name[DEM_MAX_PORT_NAME_LEN];
  75. uint32_t reserved2;
  76. };
  77. #endif
  78. #define SZ_DIAG_ERR_MSG 0xC8
  79. #define ID_DIAG_ERR_MSG SMEM_DIAG_ERR_MESSAGE
  80. #define ID_SMD_CHANNELS SMEM_SMD_BASE_ID
  81. #define ID_SHARED_STATE SMEM_SMSM_SHARED_STATE
  82. #define ID_CH_ALLOC_TBL SMEM_CHANNEL_ALLOC_TBL
  83. #define SMSM_INIT 0x00000001
  84. #define SMSM_SMDINIT 0x00000008
  85. #define SMSM_RPCINIT 0x00000020
  86. #define SMSM_RESET 0x00000040
  87. #define SMSM_RSA 0x00000080
  88. #define SMSM_RUN 0x00000100
  89. #define SMSM_PWRC 0x00000200
  90. #define SMSM_TIMEWAIT 0x00000400
  91. #define SMSM_TIMEINIT 0x00000800
  92. #define SMSM_PWRC_EARLY_EXIT 0x00001000
  93. #define SMSM_WFPI 0x00002000
  94. #define SMSM_SLEEP 0x00004000
  95. #define SMSM_SLEEPEXIT 0x00008000
  96. #define SMSM_APPS_REBOOT 0x00020000
  97. #define SMSM_SYSTEM_POWER_DOWN 0x00040000
  98. #define SMSM_SYSTEM_REBOOT 0x00080000
  99. #define SMSM_SYSTEM_DOWNLOAD 0x00100000
  100. #define SMSM_PWRC_SUSPEND 0x00200000
  101. #define SMSM_APPS_SHUTDOWN 0x00400000
  102. #define SMSM_SMD_LOOPBACK 0x00800000
  103. #define SMSM_RUN_QUIET 0x01000000
  104. #define SMSM_MODEM_WAIT 0x02000000
  105. #define SMSM_MODEM_BREAK 0x04000000
  106. #define SMSM_MODEM_CONTINUE 0x08000000
  107. #define SMSM_UNKNOWN 0x80000000
  108. #define SMSM_WKUP_REASON_RPC 0x00000001
  109. #define SMSM_WKUP_REASON_INT 0x00000002
  110. #define SMSM_WKUP_REASON_GPIO 0x00000004
  111. #define SMSM_WKUP_REASON_TIMER 0x00000008
  112. #define SMSM_WKUP_REASON_ALARM 0x00000010
  113. #define SMSM_WKUP_REASON_RESET 0x00000020
  114. #ifdef CONFIG_ARCH_MSM7X00A
  115. enum smsm_state_item {
  116. SMSM_STATE_APPS = 1,
  117. SMSM_STATE_MODEM = 3,
  118. SMSM_STATE_COUNT,
  119. };
  120. #else
  121. enum smsm_state_item {
  122. SMSM_STATE_APPS,
  123. SMSM_STATE_MODEM,
  124. SMSM_STATE_HEXAGON,
  125. SMSM_STATE_APPS_DEM,
  126. SMSM_STATE_MODEM_DEM,
  127. SMSM_STATE_QDSP6_DEM,
  128. SMSM_STATE_POWER_MASTER_DEM,
  129. SMSM_STATE_TIME_MASTER_DEM,
  130. SMSM_STATE_COUNT,
  131. };
  132. #endif
  133. void *smem_alloc(unsigned id, unsigned size);
  134. int smsm_change_state(enum smsm_state_item item, uint32_t clear_mask, uint32_t set_mask);
  135. uint32_t smsm_get_state(enum smsm_state_item item);
  136. int smsm_set_sleep_duration(uint32_t delay);
  137. void smsm_print_sleep_info(void);
  138. #define SMEM_NUM_SMD_CHANNELS 64
  139. typedef enum {
  140. /* fixed items */
  141. SMEM_PROC_COMM = 0,
  142. SMEM_HEAP_INFO,
  143. SMEM_ALLOCATION_TABLE,
  144. SMEM_VERSION_INFO,
  145. SMEM_HW_RESET_DETECT,
  146. SMEM_AARM_WARM_BOOT,
  147. SMEM_DIAG_ERR_MESSAGE,
  148. SMEM_SPINLOCK_ARRAY,
  149. SMEM_MEMORY_BARRIER_LOCATION,
  150. /* dynamic items */
  151. SMEM_AARM_PARTITION_TABLE,
  152. SMEM_AARM_BAD_BLOCK_TABLE,
  153. SMEM_RESERVE_BAD_BLOCKS,
  154. SMEM_WM_UUID,
  155. SMEM_CHANNEL_ALLOC_TBL,
  156. SMEM_SMD_BASE_ID,
  157. SMEM_SMEM_LOG_IDX = SMEM_SMD_BASE_ID + SMEM_NUM_SMD_CHANNELS,
  158. SMEM_SMEM_LOG_EVENTS,
  159. SMEM_SMEM_STATIC_LOG_IDX,
  160. SMEM_SMEM_STATIC_LOG_EVENTS,
  161. SMEM_SMEM_SLOW_CLOCK_SYNC,
  162. SMEM_SMEM_SLOW_CLOCK_VALUE,
  163. SMEM_BIO_LED_BUF,
  164. SMEM_SMSM_SHARED_STATE,
  165. SMEM_SMSM_INT_INFO,
  166. SMEM_SMSM_SLEEP_DELAY,