blob: 085fa9ecd26a976dc6985937130c640854d0f064 [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
Chandan Uddaraju1434a602010-03-08 17:13:38 -080067struct smem_board_info_v3
Chandan Uddaraju885e4db2009-12-03 22:45:26 -080068{
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 unsigned hw_platform;
76};
77
Chandan Uddaraju1434a602010-03-08 17:13:38 -080078struct smem_board_info_v4
79{
80 struct smem_board_info_v3 board_info_v3;
81 unsigned platform_version;
82 unsigned buffer_align; //Need for 8 bytes alignment while reading from shared memory.
83};
84
Dima Zavina404bce2009-01-26 12:32:22 -080085typedef enum {
86 SMEM_SPINLOCK_ARRAY = 7,
87
88 SMEM_AARM_PARTITION_TABLE = 9,
89
Chandan Uddarajude85d3f2010-01-05 16:32:33 -080090 SMEM_APPS_BOOT_MODE = 106,
91
Chandan Uddaraju885e4db2009-12-03 22:45:26 -080092 SMEM_BOARD_INFO_LOCATION = 137,
93
Dima Zavina404bce2009-01-26 12:32:22 -080094 SMEM_FIRST_VALID_TYPE = SMEM_SPINLOCK_ARRAY,
Chandan Uddaraju885e4db2009-12-03 22:45:26 -080095 SMEM_LAST_VALID_TYPE = SMEM_BOARD_INFO_LOCATION,
Dima Zavina404bce2009-01-26 12:32:22 -080096} smem_mem_type_t;
97
98/* Note: buf MUST be 4byte aligned, and max_len MUST be a multiple of 4. */
99unsigned smem_read_alloc_entry(smem_mem_type_t type, void *buf, int max_len);
100
101#endif /* __PLATFORM_MSM_SHARED_SMEM_H */