blob: c4f9a77e3ff33a6ac3044fcc4a2aeaa500eb7467 [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_PRIVATE_H_
14#define _ARCH_ARM_MACH_MSM_SMEM_PRIVATE_H_
15
16#include <linux/remote_spinlock.h>
17
18#include <mach/ramdump.h>
19
20#define SMEM_SPINLOCK_SMEM_ALLOC "S:3"
21extern remote_spinlock_t remote_spinlock;
Jeff Hugob9fb9402013-05-15 09:58:54 -060022extern int spinlocks_initialized; /* only modify in init_smem_remote_spinlock */
Jeff Hugo5ba15fe2013-05-06 14:24:24 -060023
24#define SMD_HEAP_SIZE 512
25
26struct smem_heap_info {
27 unsigned initialized;
28 unsigned free_offset;
29 unsigned heap_remaining;
30 unsigned reserved;
31};
32
33struct smem_heap_entry {
34 unsigned allocated;
35 unsigned offset;
36 unsigned size;
37 unsigned reserved; /* bits 1:0 reserved, bits 31:2 aux smem base addr */
38};
39#define BASE_ADDR_MASK 0xfffffffc
40
41struct smem_proc_comm {
42 unsigned command;
43 unsigned status;
44 unsigned data1;
45 unsigned data2;
46};
47
48struct smem_shared {
49 struct smem_proc_comm proc_comm[4];
50 unsigned version[32];
51 struct smem_heap_info heap_info;
52 struct smem_heap_entry heap_toc[SMD_HEAP_SIZE];
53};
54
55struct smem_area {
56 phys_addr_t phys_addr;
57 resource_size_t size;
58 void __iomem *virt_addr;
59};
60
61extern uint32_t num_smem_areas;
62extern struct smem_area *smem_areas;
63
64extern struct ramdump_segment *smem_ramdump_segments;
65
66/* used for unit testing spinlocks */
67remote_spinlock_t *smem_get_remote_spinlock(void);
Jeff Hugob9fb9402013-05-15 09:58:54 -060068
69/*
70 * used to ensure the remote spinlock is only inited once since local
71 * spinlock init code appears non-reentrant
72 */
73int init_smem_remote_spinlock(void);
Jeff Hugo429dc2c2013-05-28 15:06:07 -060074
75bool smem_initialized_check(void);
Jeff Hugo5ba15fe2013-05-06 14:24:24 -060076#endif /* _ARCH_ARM_MACH_MSM_SMEM_PRIVATE_H_ */