~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/arm/plat-omap/include/syslink/sharedregion.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  sharedregion.h
3
 
 *
4
 
 *  The SharedRegion module is designed to be used in a
5
 
 *  multi-processor environment where there are memory regions
6
 
 *  that are shared and accessed across different processors
7
 
 *
8
 
 *  Copyright (C) 2008-2010 Texas Instruments, Inc.
9
 
 *
10
 
 *  This package is free software; you can redistribute it and/or modify
11
 
 *  it under the terms of the GNU General Public License version 2 as
12
 
 *  published by the Free Software Foundation.
13
 
 *
14
 
 *  THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15
 
 *  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16
 
 *  WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
17
 
 *  PURPOSE.
18
 
 */
19
 
 
20
 
#ifndef _SHAREDREGION_H_
21
 
#define _SHAREDREGION_H_
22
 
 
23
 
#include <linux/types.h>
24
 
#include <heapmemmp.h>
25
 
 
26
 
/*
27
 
 *  SHAREDREGION_MODULEID
28
 
 *  Module ID for Shared region manager
29
 
 */
30
 
#define SHAREDREGION_MODULEID           (0x5D8A)
31
 
 
32
 
/*
33
 
 *  Name of the reserved nameserver used for application
34
 
 */
35
 
#define SHAREDREGION_NAMESERVER         "SHAREDREGION"
36
 
 
37
 
/*
38
 
 *  Name of the reserved nameserver used for application
39
 
 */
40
 
#define SHAREDREGION_INVALIDREGIONID    ((u16)(~0))
41
 
 
42
 
/*!
43
 
 *  @def        SharedRegion_DEFAULTOWNERID
44
 
 *  @brief      Default owner processor id
45
 
 */
46
 
#define SHAREDREGION_DEFAULTOWNERID     ((u16)(~0))
47
 
 
48
 
/*
49
 
 *  Name of the reserved nameserver used for application
50
 
 */
51
 
#define SHAREDREGION_INVALIDSRPTR       ((u32 *)(~0))
52
 
 
53
 
 
54
 
struct sharedregion_entry {
55
 
        /* The base address of the region */
56
 
        void *base;
57
 
        /* The length of the region */
58
 
        uint len;
59
 
        /* The MultiProc id of the owner of the region */
60
 
        u16 owner_proc_id;
61
 
        /* Whether the region is valid */
62
 
        bool is_valid;
63
 
        /* Whether to perform cache operations for the region */
64
 
        bool cache_enable;
65
 
        /* The cache line size of the region */
66
 
        uint cache_line_size;
67
 
        /* Whether a heap is created for the region */
68
 
        bool create_heap;
69
 
        /* The name of the region */
70
 
        char *name;
71
 
};
72
 
 
73
 
/*
74
 
 * Module configuration structure
75
 
 */
76
 
struct sharedregion_config {
77
 
        uint cache_line_size;
78
 
        /*
79
 
        *  Worst-case cache line size
80
 
        *
81
 
        *  This is the default system cache line size for all modules.
82
 
        *  When a module puts structures in shared memory, this value is
83
 
        *  used to make sure items are aligned on a cache line boundary.
84
 
        *  If no cacheLineSize is specified for a region, it will use this
85
 
        *  value.
86
 
        */
87
 
 
88
 
        u16 num_entries;
89
 
        /*
90
 
        *  The number of shared region table entries.
91
 
        *
92
 
        *  This value is used for calculating the number of bits for the offset.
93
 
        *  Note: This value must be the same across all processors in the
94
 
        *        system. Increasing this parameter will increase the footprint
95
 
        *        and the time for translating a pointer to a SRPtr.
96
 
        */
97
 
 
98
 
        bool translate;
99
 
        /*
100
 
        *  This configuration parameter should be set to 'true'
101
 
        *  if and only if all shared memory regions are the same
102
 
        *  for all processors. If 'true', it results in a fast
103
 
        *  getPtr and getSRPtr.
104
 
        */
105
 
};
106
 
 
107
 
/*
108
 
 *  Information stored on a per region basis
109
 
 */
110
 
struct sharedregion_region {
111
 
        struct sharedregion_entry entry;
112
 
        uint reserved_size;
113
 
        struct heapmemmp_object *heap;
114
 
};
115
 
 
116
 
 
117
 
/*
118
 
 *  Function to get the configuration
119
 
 */
120
 
int sharedregion_get_config(struct sharedregion_config *config);
121
 
 
122
 
/*
123
 
 *  Function to setup the SharedRegion module
124
 
 */
125
 
int sharedregion_setup(const struct sharedregion_config *config);
126
 
 
127
 
/*
128
 
 *  Function to destroy the SharedRegion module
129
 
 */
130
 
int sharedregion_destroy(void);
131
 
 
132
 
/*
133
 
 *  Creates a heap by owner of region for each SharedRegion.
134
 
 *  Function is called by ipc_start(). Requires that SharedRegion 0
135
 
 *  be valid before calling start().
136
 
 */
137
 
int sharedregion_start(void);
138
 
 
139
 
/*
140
 
 *  Function to stop Shared Region 0
141
 
 */
142
 
int sharedregion_stop(void);
143
 
 
144
 
/*
145
 
 *  Opens a heap, for non-owner processors, for each SharedRegion.
146
 
 */
147
 
int sharedregion_attach(u16 remote_proc_id);
148
 
 
149
 
/*
150
 
 *  Closes a heap, for non-owner processors, for each SharedRegion.
151
 
 */
152
 
int sharedregion_detach(u16 remote_proc_id);
153
 
 
154
 
/*
155
 
 *  Reserve shared region memory
156
 
 */
157
 
void *sharedregion_reserve_memory(u16 id, u32 size);
158
 
 
159
 
/*
160
 
 *  Reserve shared region memory
161
 
 */
162
 
void sharedregion_unreserve_memory(u16 id, u32 size);
163
 
 
164
 
/*
165
 
 *  Sets the entry at the specified region id(doesn't create heap)
166
 
 */
167
 
int _sharedregion_set_entry(u16 region_id, struct sharedregion_entry *entry);
168
 
 
169
 
/*
170
 
 *  Function to clear the reserved memory
171
 
 */
172
 
void sharedregion_clear_reserved_memory(void);
173
 
 
174
 
/*
175
 
 *  Return the region info
176
 
 */
177
 
void sharedregion_get_region_info(u16 i, struct sharedregion_region *region);
178
 
 
179
 
/*
180
 
 *  Clears the entry at the specified region id
181
 
 */
182
 
int sharedregion_clear_entry(u16 region_id);
183
 
 
184
 
/*
185
 
 *  Initializes the entry fields
186
 
 */
187
 
void sharedregion_entry_init(struct sharedregion_entry *entry);
188
 
 
189
 
/*
190
 
 *  Gets the cache line size for the specified region id
191
 
 */
192
 
uint sharedregion_get_cache_line_size(u16 region_id);
193
 
 
194
 
/*
195
 
 *  Gets the entry information for the specified region id
196
 
 */
197
 
int sharedregion_get_entry(u16 region_id, struct sharedregion_entry *entry);
198
 
 
199
 
/*
200
 
 *  Gets the heap associated with the specified region id
201
 
 */
202
 
void *sharedregion_get_heap(u16 region_id);
203
 
 
204
 
/*
205
 
 *  Gets the region id for the specified address
206
 
 */
207
 
u16 sharedregion_get_id(void *addr);
208
 
 
209
 
/*
210
 
 *  Gets the id of a region, given the name
211
 
 */
212
 
u16 sharedregion_get_id_by_name(char *name);
213
 
 
214
 
/*
215
 
 *  Gets the number of regions
216
 
 */
217
 
u16 sharedregion_get_num_regions(void);
218
 
 
219
 
/*
220
 
 *  Returns the address pointer associated with the shared region pointer
221
 
 */
222
 
void *sharedregion_get_ptr(u32 *srptr);
223
 
 
224
 
/*
225
 
 *  Returns the shared region pointer
226
 
 */
227
 
u32 *sharedregion_get_srptr(void *addr, u16 index);
228
 
 
229
 
/*
230
 
 *  whether cache enable was specified
231
 
 */
232
 
bool sharedregion_is_cache_enabled(u16 region_id);
233
 
 
234
 
/*
235
 
 *  Sets the entry at the specified region id
236
 
 */
237
 
int sharedregion_set_entry(u16 region_id, struct sharedregion_entry *entry);
238
 
 
239
 
/*
240
 
 *  Whether address translation is enabled
241
 
 */
242
 
bool sharedregion_translate_enabled(void);
243
 
 
244
 
#endif /* _SHAREDREGION_H */