aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHari Kanigeri <h-kanigeri2@ti.com>2010-09-09 12:04:00 -0400
committerPaolo Pisati <paolo.pisati@canonical.com>2012-08-17 04:19:07 -0400
commit4481003c2cf1d7d7ccf16b08900289f86007b804 (patch)
tree23ca7dcb6cec44b406bb2f7d46cd0ea8f9319f9a
parent5ec55c4c4a7df97aeb7a01af060c599af7bf1982 (diff)
SYSLINK: add syslink headers
Add syslink headers Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Miguel Vadillo <vadillo@ti.com> Signed-off-by: Juan Gutierrez <jgutierrez@ti.com> Signed-off-by: Paul Hunt <hunt@ti.com> Signed-off-by: Hari Kanigeri <h-kanigeri2@ti.com> Signed-off-by: Subramaniam C.A <subramaniam.ca@ti.com> Signed-off-by: Arun M G <arunmg@ti.com> Signed-off-by: Ramesh Gupta G <grgupta@ti.com> Signed-off-by: Jayan John <x00jayan@ti.com> Signed-off-by: Angela Stegmaier <angelabaker@ti.com> Signed-off-by: Arun Radhakrishnan <x0051460@ti.com> Signed-off-by: Subin Gangadharan <subin.kg@ti.com>
-rw-r--r--arch/arm/plat-omap/include/syslink/GlobalTypes.h154
-rw-r--r--arch/arm/plat-omap/include/syslink/_listmp.h68
-rw-r--r--arch/arm/plat-omap/include/syslink/_notify.h83
-rw-r--r--arch/arm/plat-omap/include/syslink/_sysmgr.h50
-rw-r--r--arch/arm/plat-omap/include/syslink/atomic_linux.h104
-rw-r--r--arch/arm/plat-omap/include/syslink/drv_notify.h43
-rw-r--r--arch/arm/plat-omap/include/syslink/gate.h76
-rw-r--r--arch/arm/plat-omap/include/syslink/gate_remote.h33
-rw-r--r--arch/arm/plat-omap/include/syslink/gatehwspinlock.h161
-rw-r--r--arch/arm/plat-omap/include/syslink/gatemp.h246
-rw-r--r--arch/arm/plat-omap/include/syslink/gatemp_ioctl.h177
-rw-r--r--arch/arm/plat-omap/include/syslink/gatempdefs.h128
-rw-r--r--arch/arm/plat-omap/include/syslink/gatepeterson.h145
-rw-r--r--arch/arm/plat-omap/include/syslink/gt.h320
-rw-r--r--arch/arm/plat-omap/include/syslink/heap.h96
-rw-r--r--arch/arm/plat-omap/include/syslink/heapbufmp.h253
-rw-r--r--arch/arm/plat-omap/include/syslink/heapbufmp_ioctl.h232
-rw-r--r--arch/arm/plat-omap/include/syslink/heapmemmp.h252
-rw-r--r--arch/arm/plat-omap/include/syslink/heapmemmp_ioctl.h243
-rw-r--r--arch/arm/plat-omap/include/syslink/host_os.h72
-rw-r--r--arch/arm/plat-omap/include/syslink/igatempsupport.h76
-rw-r--r--arch/arm/plat-omap/include/syslink/igateprovider.h123
-rw-r--r--arch/arm/plat-omap/include/syslink/iobject.h176
-rw-r--r--arch/arm/plat-omap/include/syslink/ipc.h177
-rw-r--r--arch/arm/plat-omap/include/syslink/ipc_ioctl.h113
-rw-r--r--arch/arm/plat-omap/include/syslink/listmp.h146
-rw-r--r--arch/arm/plat-omap/include/syslink/listmp_ioctl.h268
-rw-r--r--arch/arm/plat-omap/include/syslink/messageq.h440
-rw-r--r--arch/arm/plat-omap/include/syslink/messageq_ioctl.h255
-rw-r--r--arch/arm/plat-omap/include/syslink/multiproc.h89
-rw-r--r--arch/arm/plat-omap/include/syslink/multiproc_ioctl.h94
-rw-r--r--arch/arm/plat-omap/include/syslink/nameserver.h157
-rw-r--r--arch/arm/plat-omap/include/syslink/nameserver_ioctl.h261
-rw-r--r--arch/arm/plat-omap/include/syslink/nameserver_remote.h39
-rw-r--r--arch/arm/plat-omap/include/syslink/nameserver_remotenotify.h90
-rw-r--r--arch/arm/plat-omap/include/syslink/notify.h146
-rw-r--r--arch/arm/plat-omap/include/syslink/notify_dispatcher.h158
-rw-r--r--arch/arm/plat-omap/include/syslink/notify_driver.h45
-rw-r--r--arch/arm/plat-omap/include/syslink/notify_driverdefs.h137
-rw-r--r--arch/arm/plat-omap/include/syslink/notify_ducatidriver.h141
-rw-r--r--arch/arm/plat-omap/include/syslink/notify_ioctl.h278
-rw-r--r--arch/arm/plat-omap/include/syslink/notify_setup_proxy.h53
-rw-r--r--arch/arm/plat-omap/include/syslink/notifyerr.h198
-rw-r--r--arch/arm/plat-omap/include/syslink/platform.h44
-rw-r--r--arch/arm/plat-omap/include/syslink/platform_mem.h136
-rw-r--r--arch/arm/plat-omap/include/syslink/procmgr.h244
-rw-r--r--arch/arm/plat-omap/include/syslink/sharedregion.h244
-rw-r--r--arch/arm/plat-omap/include/syslink/sharedregion_ioctl.h189
-rw-r--r--arch/arm/plat-omap/include/syslink/sysipc_ioctl.h118
-rw-r--r--arch/arm/plat-omap/include/syslink/sysmemmgr.h179
-rw-r--r--arch/arm/plat-omap/include/syslink/sysmemmgr_ioctl.h130
-rw-r--r--arch/arm/plat-omap/include/syslink/sysmgr.h182
-rw-r--r--arch/arm/plat-omap/include/syslink/transportshm.h220
-rw-r--r--arch/arm/plat-omap/include/syslink/transportshm_setup.h47
-rw-r--r--arch/arm/plat-omap/include/syslink/transportshm_setup_proxy.h48
55 files changed, 8377 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/include/syslink/GlobalTypes.h b/arch/arm/plat-omap/include/syslink/GlobalTypes.h
new file mode 100644
index 00000000000..6cd959cde95
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/GlobalTypes.h
@@ -0,0 +1,154 @@
1/*
2 * GlobalTypes.h
3 *
4 * Syslink driver support for OMAP Processors.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15 */
16
17#ifndef __GLOBALTYPES_H
18#define __GLOBALTYPES_H
19
20#define REG volatile
21
22/*
23 * Definition: RET_CODE_BASE
24 *
25 * DESCRIPTION: Base value for return code offsets
26 *
27 *
28 */
29#define RET_CODE_BASE 0
30
31/*
32 * TYPE: ReturnCode_t
33 *
34 * DESCRIPTION: Return codes to be returned by all library functions
35 *
36 *
37 */
38enum ReturnCode_label {
39RET_OK = 0,
40RET_FAIL = -1,
41RET_BAD_NULL_PARAM = -2,
42RET_PARAM_OUT_OF_RANGE = -3,
43RET_INVALID_ID = -4,
44RET_EMPTY = -5,
45RET_FULL = -6,
46RET_TIMEOUT = -7,
47RET_INVALID_OPERATION = -8,
48/* Add new error codes at end of above list */
49RET_NUM_RET_CODES /* this should ALWAYS be LAST entry */
50};
51
52
53
54/*
55 * MACRO: RD_MEM_32_VOLATILE, WR_MEM_32_VOLATILE
56 *
57 * DESCRIPTION: 32 bit register access macros
58 *
59 *
60 */
61#define RD_MEM_32_VOLATILE(addr) \
62((unsigned long)(*((REG unsigned long *)(addr))))
63
64#define WR_MEM_32_VOLATILE(addr, data) \
65(*((REG unsigned long *)(addr)) = (unsigned long)(data))
66
67
68
69
70#ifdef CHECK_INPUT_PARAMS
71/*
72 * MACRO: CHECK_INPUT_PARAMS
73 *
74 * DESCRIPTION: Checks an input code and returns a specified value if code is
75 * invalid value, also writes spy value if error found.
76 *
77 * NOTE: Can be disabled to save HW cycles.
78 *
79 *
80 */
81#define CHECK_INPUT_PARAM(actualValue, invalidValue, \
82returnCodeIfMismatch, spyCodeIfMisMatch) do {\
83 if ((invalidValue) == (actualValue)) {\
84 RES_Set((spyCodeIfMisMatch));\
85 return returnCodeIfMismatch; \
86 } \
87} while (0)
88
89/*
90 * MACRO: CHECK_INPUT_RANGE
91 *
92 * DESCRIPTION: Checks an input value and returns a specified value if not in
93 * specified range, also writes spy value if error found.
94 *
95* NOTE: Can be disabled to save HW cycles.
96 *
97 *
98 */
99#define CHECK_INPUT_RANGE(actualValue, minValidValue, maxValidValue, \
100returnCodeIfMismatch, spyCodeIfMisMatch) do {\
101 if (((actualValue) < (minValidValue)) || \
102 ((actualValue) > (maxValidValue))) {\
103 RES_Set((spyCodeIfMisMatch));\
104 return returnCodeIfMismatch; \
105 } \
106} while (0)
107
108/*
109 * MACRO: CHECK_INPUT_RANGE_MIN0
110 *
111 * DESCRIPTION: Checks an input value and returns a
112 * specified value if not in
113 * specified range, also writes spy value if error found.
114 * The minimum
115 * value is 0.
116 *
117 * NOTE: Can be disabled to save HW cycles.
118 *
119 *
120 */
121#define CHECK_INPUT_RANGE_MIN0(actualValue, maxValidValue, \
122returnCodeIfMismatch, spyCodeIfMisMatch) do {\
123 if ((actualValue) > (maxValidValue)) {\
124 RES_Set((spyCodeIfMisMatch));\
125 return returnCodeIfMismatch; \
126 } \
127} while (0)
128
129#else
130
131#define CHECK_INPUT_PARAM(actualValue, invalidValue, returnCodeIfMismatch,\
132spyCodeIfMisMatch)
133
134#define CHECK_INPUT_PARAM_NO_SPY(actualValue, invalidValue, \
135returnCodeIfMismatch)
136
137#define CHECK_INPUT_RANGE(actualValue, minValidValue, maxValidValue, \
138returnCodeIfMismatch, spyCodeIfMisMatch)
139
140#define CHECK_INPUT_RANGE_NO_SPY(actualValue, minValidValue , \
141maxValidValue, returnCodeIfMismatch)
142
143#define CHECK_INPUT_RANGE_MIN0(actualValue, maxValidValue, \
144returnCodeIfMismatch, spyCodeIfMisMatch)
145
146#define CHECK_INPUT_RANGE_NO_SPY_MIN0(actualValue, \
147maxValidValue, returnCodeIfMismatch)
148
149#endif
150
151#ifdef __cplusplus
152}
153#endif
154#endif /* __GLOBALTYPES_H */
diff --git a/arch/arm/plat-omap/include/syslink/_listmp.h b/arch/arm/plat-omap/include/syslink/_listmp.h
new file mode 100644
index 00000000000..282d2c8c10e
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/_listmp.h
@@ -0,0 +1,68 @@
1/*
2 * _listmp.h
3 *
4 * Internal definitions for shared memory doubly linked list.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18#ifndef __LISTMP_H_
19#define __LISTMP_H_
20
21/* Standard headers */
22#include <linux/types.h>
23#include <linux/list.h>
24
25#include <listmp.h>
26#include <sharedregion.h>
27
28/* Unique module ID. */
29#define LISTMP_MODULEID (0xa413)
30
31/* Created tag */
32#define LISTMP_CREATED 0x12181964
33
34
35/* Structure defining shared memory attributes for the ListMP module. */
36struct listmp_attrs {
37 u32 status;
38 u32 *gatemp_addr;
39 struct listmp_elem head;
40};
41
42/* Structure defining config parameters for the ListMP module. */
43struct listmp_config {
44 uint max_runtime_entries;
45 /* Maximum number of ListMP's that can be dynamically created and
46 added to the NameServer. */
47 uint max_name_len; /* Maximum length of name */
48};
49
50
51/* Structure defining processor related information for the ListMP module. */
52struct listmp_proc_attrs {
53 bool creator; /* Creator or opener */
54 u16 proc_id; /* Processor Identifier */
55 u32 open_count; /* How many times it is opened on a processor */
56};
57
58
59/* Function to get the configuration */
60void listmp_get_config(struct listmp_config *cfg_params);
61
62/* Function to setup the listmp module */
63int listmp_setup(const struct listmp_config *config);
64
65/* Function to destroy the listmp module */
66int listmp_destroy(void);
67
68#endif /* __LISTMP_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/_notify.h b/arch/arm/plat-omap/include/syslink/_notify.h
new file mode 100644
index 00000000000..9f9d8891416
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/_notify.h
@@ -0,0 +1,83 @@
1/*
2 * _notify.h
3 *
4 * The MessageQ module supports the structured sending and receiving of
5 * variable length messages. This module can be used for homogeneous or
6 * heterogeneous multi-processor messaging.
7 *
8 * Copyright (C) 2009 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#if !defined(__NOTIFY_H_)
21#define __NOTIFY_H_
22
23
24/* Module headers */
25#include <syslink/notify.h>
26
27
28/* Module ID for notify. */
29#define NOTIFY_MODULEID ((u16) 0x5F84)
30
31/* Mask to check for event ID. */
32#define NOTIFY_EVENT_MASK ((u16) 0xFFFF)
33
34#define ISRESERVED(event_id, reserved_event) \
35 (((event_id & NOTIFY_EVENT_MASK) >= reserved_event) || \
36 ((event_id >> 16) == NOTIFY_SYSTEMKEY))
37
38/* This structure defines attributes for initialization of the notify module. */
39struct notify_config {
40 u32 num_events;
41 /* Number of events to be supported */
42 u32 send_event_poll_count;
43 /* Poll for specified amount before send_event times out */
44 u32 num_lines;
45 /* Max. number of interrupt lines between a single pair of processors */
46 u32 reserved_events;
47 /* Number of reserved events to be supported */
48};
49
50/* This structure defines the configuration structure for initialization
51 * of the notify object. */
52struct notify_params {
53 u32 reserved; /* Reserved field */
54};
55
56
57/* Function to get the default configuration for the notify module. */
58void notify_get_config(struct notify_config *cfg);
59
60/* Function to setup the notify module */
61int notify_setup(struct notify_config *cfg);
62
63/* Function to destroy the notify module */
64int notify_destroy(void);
65
66/* Function to create an instance of notify driver */
67struct notify_object *notify_create(void *driver_handle, u16 remote_proc_id,
68 u16 line_id, const struct notify_params *params);
69
70/* Function to delete an instance of notify driver */
71int notify_delete(struct notify_object **handle_ptr);
72
73/* Function to call device specific the notify module setup */
74int notify_attach(u16 proc_id, void *shared_addr);
75
76/* Function to destroy the device specific notify module */
77int notify_detach(u16 proc_id);
78
79/* Function registered as callback with the notify driver */
80void notify_exec(struct notify_object *obj, u32 event_id, u32 payload);
81
82
83#endif /* !defined(__NOTIFY_H_) */
diff --git a/arch/arm/plat-omap/include/syslink/_sysmgr.h b/arch/arm/plat-omap/include/syslink/_sysmgr.h
new file mode 100644
index 00000000000..58fbdd37815
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/_sysmgr.h
@@ -0,0 +1,50 @@
1/*
2 * _sysmgr.h
3 *
4 * Defines for system manager functions
5 *
6 * Copyright (C) 2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18#ifndef __SYSMGR_H_
19#define __SYSMGR_H_
20
21/* Structure to retrieve the scalability proc info from the slave */
22struct sysmgr_proc_config {
23 u32 proc_id;
24 u32 use_notify;
25 u32 use_messageq;
26 u32 use_heapbuf;
27 u32 use_frameq;
28 u32 use_ringio;
29 u32 use_listmp;
30 u32 use_nameserver;
31 u32 boot_mode;
32};
33
34/* Function to set the boot load page address for a slave */
35void sysmgr_set_boot_load_page(u16 proc_id, u32 boot_load_page);
36
37/* Function to get configuration values for a host object(component/instance) */
38u32 sysmgr_get_object_config(u16 proc_id, void *config, u32 cmd_id, u32 size);
39
40/* Function to put configuration values for a slave object(component/instance)*/
41u32 sysmgr_put_object_config(u16 proc_id, void *config, u32 cmd_id, u32 size);
42
43/* Function to wait for scalability handshake value. */
44void sysmgr_wait_for_scalability_info(u16 proc_id);
45
46/* Function to wait for slave to complete setup */
47void sysmgr_wait_for_slave_setup(u16 proc_id);
48
49
50#endif /* ifndef __SYSMGR_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/atomic_linux.h b/arch/arm/plat-omap/include/syslink/atomic_linux.h
new file mode 100644
index 00000000000..da4cb21b1ec
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/atomic_linux.h
@@ -0,0 +1,104 @@
1/*
2* atomic_linux.h
3*
4* Atomic operations functions
5*
6* Copyright (C) 2008-2009 Texas Instruments, Inc.
7*
8* This package is free software; you can redistribute it and/or modify
9* it under the terms of the GNU General Public License version 2 as
10* published by the Free Software Foundation.
11*
12* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15* PURPOSE.
16*/
17
18#ifndef _ATOMIC_LINUX_H
19#define _ATOMIC_LINUX_H
20
21#include <linux/types.h>
22#include <generated/autoconf.h>
23#include <linux/kernel.h>
24#include <linux/module.h>
25#include <asm/atomic.h>
26
27/*
28 * ======== atomic_cmpmask_and_set ========
29 * Purpose:
30 * This will compare a mask and set if not equal
31 */
32static inline void atomic_cmpmask_and_set(atomic_t *v, u32 mask, u32 val)
33{
34 s32 ret;
35 unsigned long flags;
36 atomic_t *atm = v;
37
38 raw_local_irq_save(flags);
39 ret = atm->counter;
40 if (likely(((ret & mask) != mask)))
41 atm->counter = val;
42 raw_local_irq_restore(flags);
43}
44
45/*
46 * ======== atomic_cmpmask_and_set ========
47 * Purpose:
48 * This will compare a mask and then check current value less than
49 * provided value.
50 */
51static inline bool atomic_cmpmask_and_lt(atomic_t *v, u32 mask, u32 val)
52{
53 bool ret = true;
54 atomic_t *atm = v;
55 s32 cur;
56 unsigned long flags;
57
58 raw_local_irq_save(flags);
59 cur = atm->counter;
60 /* Compare mask, if matches then compare val */
61 if (likely(((cur & mask) == mask))) {
62 if (likely(cur >= val))
63 ret = false;
64 }
65 raw_local_irq_restore(flags);
66
67 /* retval = true if mask matches and current value is less than given
68 * value */
69 /* retval = false either mask doesnot matches or current value is not
70 * less than given value */
71 return ret;
72}
73
74
75/*
76 * ======== atomic_cmpmask_and_set ========
77 * Purpose:
78 * This will compare a mask and then check current value greater than
79 * provided value.
80 */
81static inline bool atomic_cmpmask_and_gt(atomic_t *v, u32 mask, u32 val)
82{
83 bool ret = false;
84 atomic_t *atm = v;
85 s32 cur;
86 unsigned long flags;
87
88 raw_local_irq_save(flags);
89 cur = atm->counter;
90 /* Compare mask, if matches then compare val */
91 if (likely(((cur & mask) == mask))) {
92 if (likely(cur > val))
93 ret = true;
94 }
95
96 raw_local_irq_restore(flags);
97 /* retval = true if mask matches and current value is less than given
98 * value */
99 /* etval =false either mask doesnot matches or current value is not
100 * greater than given value */
101 return ret;
102}
103
104#endif /* if !defined(_ATOMIC_LINUX_H) */
diff --git a/arch/arm/plat-omap/include/syslink/drv_notify.h b/arch/arm/plat-omap/include/syslink/drv_notify.h
new file mode 100644
index 00000000000..c8a783eca4f
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/drv_notify.h
@@ -0,0 +1,43 @@
1/*
2 * drv_notify.h
3 *
4 * Notify driver support for OMAP Processors.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15 */
16
17
18#if !defined _DRV_NOTIFY_H_
19#define _DRV_NOTIFY_H_
20
21
22/* Module includes */
23#include <syslink/notify_driverdefs.h>
24#include <syslink/_notify.h>
25
26
27/* read function for of Notify driver.*/
28int notify_drv_read(struct file *filp, char __user *dst, size_t size,
29 loff_t *offset);
30
31/* Linux driver function to map memory regions to user space. */
32int notify_drv_mmap(struct file *filp, struct vm_area_struct *vma);
33
34/* ioctl function for of Linux Notify driver.*/
35int notify_drv_ioctl(struct inode *inode, struct file *filp, u32 cmd,
36 unsigned long args, bool user);
37
38void _notify_drv_setup(void);
39
40void _notify_drv_destroy(void);
41
42
43#endif /* !defined (_DRV_NOTIFY_H_) */
diff --git a/arch/arm/plat-omap/include/syslink/gate.h b/arch/arm/plat-omap/include/syslink/gate.h
new file mode 100644
index 00000000000..1041f752f46
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/gate.h
@@ -0,0 +1,76 @@
1/*
2 * gate.h
3 *
4 * Critical section support.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17/** ============================================================================
18 * Gates are used by clients to protect concurrent access to critical
19 * data structures. Critical data structures are those that must be
20 * updated by at most one thread at a time. All code that needs access
21 * to a critical data structure "enters" a gate (that's associated with the
22 * data structure) prior to accessing the data, modifies the data structure,
23 * then "leaves" the gate.
24 *
25 * A gate is responsible for ensuring that at most one thread at a time
26 * can enter and execute "inside" the gate. There are several
27 * implementations of gates, with different system executation times and
28 * latency tradoffs. In addition, some gates must not be entered by certain
29 * thread types; e.g., a gate that is implemented via a "blocking" semaphore
30 * must not be called by an interrupt service routine (ISR).
31 *
32 * A module can be declared "gated" by adding the `@Gated` attribute to the
33 * module's XDC spec file. A "gated" module is assigned a module-level gate
34 * at the configuration time, and that gate is then used to protect critical
35 * sections in the module's target code. A module-level gate is an instance of
36 * a module implementing `{@link IGateProvider}` interface. However, gated
37 * modules do not access their module-level gates directly. They use this
38 * module to access transparently their module-level gate.
39 *
40 * Application code that is not a part of any module also has a
41 * module-level gate, configured through the module `{@link Main}`.
42 *
43 * Each gated module can optionally create gates on an adhoc basis at
44 * runtime using the same gate module that was used to create the module
45 * level gate.
46 *
47 * Gates that work by disabling all preemption while inside a gate can be
48 * used to protect data structures accessed by ISRs and other
49 * threads. But, if the time required to update the data structure is not
50 * a small constant, this type of gate may violate a system's real-time
51 * requirements.
52 *
53 * Gates have two orthogonal attributes: "blocking" and "preemptible".
54 * In general, gates that are "blocking" can not be use by code that is
55 * called by ISRs and gates that are not "preemptible" should only be used to
56 * to protect data manipulated by code that has small constant execution
57 * time.
58 * ============================================================================
59 */
60
61
62#ifndef GATE_H_0xAF6F
63#define GATE_H_0xAF6F
64
65#include <igateprovider.h>
66
67extern struct igateprovider_object *gate_system_handle;
68
69/* Function to enter a Gate */
70int *gate_enter_system(void);
71
72/* Function to leave a Gate */
73void gate_leave_system(int *key);
74
75
76#endif /* GATE_H_0xAF6F */
diff --git a/arch/arm/plat-omap/include/syslink/gate_remote.h b/arch/arm/plat-omap/include/syslink/gate_remote.h
new file mode 100644
index 00000000000..5ed6b7f155f
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/gate_remote.h
@@ -0,0 +1,33 @@
1/*
2 * gate_remote.h
3 *
4 * This includes the functions to handle remote gates
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18#ifndef _NAMESERVER_REMOTE_H_
19#define _GATE_REMOTE_H_
20
21#include <linux/types.h>
22
23/*
24 * This function is used to enter in to a remote gate
25 */
26int gate_remote_enter(void *ghandle, u32 key);
27
28/*
29 * This function is used to leave from a remote gate
30 */
31int gate_remote_leave(void *ghandle, u32 key);
32
33#endif /* _GATE_REMOTE_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/gatehwspinlock.h b/arch/arm/plat-omap/include/syslink/gatehwspinlock.h
new file mode 100644
index 00000000000..209d12bdd6b
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/gatehwspinlock.h
@@ -0,0 +1,161 @@
1/*
2 * gatehwspinlock.h
3 *
4 * Defines for gatehwspinlock.
5 *
6 * Copyright(C) 2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18
19#ifndef GATEHWSPINLOCK_H_
20#define GATEHWSPINLOCK_H_
21
22/* Module headers */
23#include <multiproc.h>
24#include <gatemp.h>
25#include <igatempsupport.h>
26#include <sharedregion.h>
27
28/* Unique module ID. */
29#define GATEHWSPINLOCK_MODULEID (0xF416)
30
31/* =============================================================================
32 * Module Success and Failure codes
33 * =============================================================================
34 */
35/* Argument passed to a function is invalid. */
36#define GATEHWSPINLOCK_E_INVALIDARG -1
37
38/* Memory allocation failed. */
39#define GATEHWSPINLOCK_E_MEMORY -2
40
41/* the name is already registered or not. */
42#define GATEHWSPINLOCK_E_BUSY -3
43
44/* Generic failure. */
45#define GATEHWSPINLOCK_E_FAIL -4
46
47/* name not found in the nameserver. */
48#define GATEHWSPINLOCK_E_NOTFOUND -5
49
50/* Module is not initialized. */
51#define GATEHWSPINLOCK_E_INVALIDSTATE -6
52
53/* Instance is not created on this processor. */
54#define GATEHWSPINLOCK_E_NOTONWER -7
55
56/* Remote opener of the instance has not closed the instance. */
57#define GATEHWSPINLOCK_E_REMOTEACTIVE -8
58
59/* Indicates that the instance is in use. */
60#define GATEHWSPINLOCK_E_INUSE -9
61
62/* Failure in OS call. */
63#define GATEHWSPINLOCK_E_OSFAILURE -10
64
65/* Version mismatch error. */
66#define GATEHWSPINLOCK_E_VERSION -11
67
68/* Operation successful. */
69#define GATEHWSPINLOCK_S_SUCCESS 0
70
71/* The GATEHWSPINLOCK module has already been setup in this process. */
72#define GATEHWSPINLOCK_S_ALREADYSETUP 1
73
74
75/* =============================================================================
76 * Macros
77 * =============================================================================
78 */
79
80/* Q_BLOCKING */
81#define GATEHWSEM_Q_BLOCKING (1)
82
83/* Q_PREEMPTING */
84#define GATEHWSEM_Q_PREEMPTING (2)
85
86
87/* =============================================================================
88 * Enums & Structures
89 * =============================================================================
90 */
91
92/* Structure defining config parameters for the gatehwspinlock module. */
93struct gatehwspinlock_config {
94 enum gatemp_local_protect default_protection;
95 /* Default module-wide local context protection level. The level of
96 * protection specified here determines which local gate is created
97 * per gatehwspinlock instance for local protection during create.
98 * The instance configuration parameter may be used to override this
99 * module setting per instance. The configuration used here should
100 * reflect both the context in which enter and leave are to be called,
101 * as well as the maximum level protection needed locally.
102 */
103 u32 base_addr;
104 /* Device-specific base address for HW Semaphore subsystem in HOST OS
105 * address space, this is updated in Ipc module */
106 u32 num_locks;
107 /* Device-specific number of semphores in the HW Semaphore subsystem */
108};
109
110/* Structure defining config parameters for the gatehwspinlock instances. */
111struct gatehwspinlock_params {
112 IGATEMPSUPPORT_SUPERPARAMS;
113};
114
115
116/* Inherit everything from IGateMPSupport */
117IGATEMPSUPPORT_INHERIT(gatehwspinlock);
118
119
120/* =============================================================================
121 * APIs
122 * =============================================================================
123 */
124/* Function to get the default configuration for the gatehwspinlock module. */
125void gatehwspinlock_get_config(struct gatehwspinlock_config *config);
126
127/* Function to setup the gatehwspinlock module. */
128int gatehwspinlock_setup(const struct gatehwspinlock_config *config);
129
130/* Function to destroy the gatehwspinlock module */
131int gatehwspinlock_destroy(void);
132
133/* Get the default parameters for the gatehwspinlock instance. */
134void gatehwspinlock_params_init(struct gatehwspinlock_params *params);
135
136/* Function to create an instance of gatehwspinlock */
137void *gatehwspinlock_create(enum igatempsupport_local_protect local_protect,
138 const struct gatehwspinlock_params *params);
139
140/* Function to delete an instance of gatehwspinlock */
141int gatehwspinlock_delete(void **handle_ptr);
142
143/* Function to enter the gatehwspinlock instance */
144int *gatehwspinlock_enter(void *handle);
145
146/* Function to leave the gatehwspinlock instance */
147void gatehwspinlock_leave(void *handle, int *key);
148
149/* Function to return the shared memory requirement for a single instance */
150u32 gatehwspinlock_shared_mem_req(const struct gatehwspinlock_params *params);
151
152/* Function to return the number of instances configured in the module. */
153u32 gatehwspinlock_get_num_instances(void);
154
155/* Function to return the number of instances not controlled by GateMP. */
156u32 gatehwspinlock_get_num_reserved(void);
157
158/* Function to initialize the locks module. */
159void gatehwspinlock_locks_init(void);
160
161#endif /* ifndef GATEHWSPINLOCK_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/gatemp.h b/arch/arm/plat-omap/include/syslink/gatemp.h
new file mode 100644
index 00000000000..d2d2e4714f3
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/gatemp.h
@@ -0,0 +1,246 @@
1/*
2 * gatemp.h
3 *
4 * gatemp wrapper defines
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18#ifndef _GATEMP_H_
19#define _GATEMP_H_
20
21#include <sharedregion.h>
22
23/* Unique module ID. */
24#define GATEMP_MODULEID (0xAF70)
25
26/* The resource is still in use */
27#define GateMP_S_BUSY 2
28
29/* The module has been already setup */
30#define GateMP_S_ALREADYSETUP 1
31
32/* Operation is successful. */
33#define GateMP_S_SUCCESS 0
34
35/* Generic failure. */
36#define GateMP_E_FAIL -1
37
38/* The specified entity already exists. */
39#define GateMP_E_ALREADYEXISTS -4
40
41/* Unable to find the specified entity. */
42#define GateMP_E_NOTFOUND -5
43
44/* Operation timed out. */
45#define GateMP_E_TIMEOUT -6
46
47/* Module is not initialized. */
48#define GateMP_E_INVALIDSTATE -7
49
50/* A failure occurred in an OS-specific call */
51#define GateMP_E_OSFAILURE -8
52
53/* Specified resource is not available */
54#define GateMP_E_RESOURCE -9
55
56/* Operation was interrupted. Please restart the operation */
57#define GateMP_E_RESTART -10
58
59/* Gate is local gate not remote */
60#define GateMP_E_LOCALGATE -11
61
62
63/*
64 * A set of local context protection levels
65 *
66 * Each member corresponds to a specific local processor gates used for
67 * local protection.
68 *
69 * In linux user mode, the following are the mapping for the constants
70 * - INTERRUPT -> [N/A]
71 * - TASKLET -> [N/A]
72 * - THREAD -> GateMutex
73 * - PROCESS -> GateMutex
74 *
75 * In linux kernel mode, the following are the mapping for the constants
76 * - INTERRUPT -> [Interrupts disabled]
77 * - TASKLET -> GateMutex
78 * - THREAD -> GateMutex
79 * - PROCESS -> GateMutex
80 *
81 * For SYS/BIOS users, the following are the mappings for the constants
82 * - INTERRUPT -> GateHwi: disables interrupts
83 * - TASKLET -> GateSwi: disables Swi's (software interrupts)
84 * - THREAD -> GateMutexPri: based on Semaphores
85 * - PROCESS -> GateMutexPri: based on Semaphores
86 */
87enum gatemp_local_protect {
88 GATEMP_LOCALPROTECT_NONE = 0,
89 /* Use no local protection */
90
91 GATEMP_LOCALPROTECT_INTERRUPT = 1,
92 /* Use the INTERRUPT local protection level */
93
94 GATEMP_LOCALPROTECT_TASKLET = 2,
95 /* Use the TASKLET local protection level */
96
97 GATEMP_LOCALPROTECT_THREAD = 3,
98 /* Use the THREAD local protection level */
99
100 GATEMP_LOCALPROTECT_PROCESS = 4
101 /* Use the PROCESS local protection level */
102};
103
104/*
105 * Type of remote Gate
106 *
107 * Each member corresponds to a specific type of remote gate.
108 * Each enum value corresponds to the following remote protection levels:
109 * - NONE -> No remote protection (the gatemp instance will
110 * exclusively offer local protection configured in
111 * #GateMP_Params::local_protect
112 * - SYSTEM -> Use the SYSTEM remote protection level (default for
113 * remote protection
114 * - CUSTOM1 -> Use the CUSTOM1 remote protection level
115 * - CUSTOM2 -> Use the CUSTOM2 remote protection level
116 */
117enum gatemp_remote_protect {
118 GATEMP_REMOTEPROTECT_NONE = 0,
119 /* No remote protection (the gatemp instance will exclusively
120 * offer local protection configured in #GateMP_Params::local_protect)
121 */
122
123 GATEMP_REMOTEPROTECT_SYSTEM = 1,
124 /* Use the SYSTEM remote protection level (default remote protection) */
125
126 GATEMP_REMOTEPROTECT_CUSTOM1 = 2,
127 /* Use the CUSTOM1 remote protection level */
128
129 GATEMP_REMOTEPROTECT_CUSTOM2 = 3
130 /* Use the CUSTOM2 remote protection level */
131};
132
133/* Structure defining parameters for the gatemp module. */
134struct gatemp_params {
135 char *name;
136 /* Name of this instance.
137 * The name (if not NULL) must be unique among all GateMP
138 * instances in the entire system. When creating a new
139 * heap, it is necessary to supply an instance name.
140 */
141
142 u32 region_id;
143 /* Shared region ID
144 * The index corresponding to the shared region from which shared memory
145 * will be allocated.
146 * If not specified, the default of '0' will be used.
147 */
148
149 void *shared_addr;
150 /* Physical address of the shared memory
151 * This value can be left as 'null' unless it is required to place the
152 * heap at a specific location in shared memory. If sharedAddr is null,
153 * then shared memory for a new instance will be allocated from the
154 * heap belonging to the region identified by #GateMP_Params::region_id.
155 */
156
157 enum gatemp_local_protect local_protect;
158 /* Local protection level.
159 * The default value is #GATEMP_LOCALPROTECT_THREAD */
160
161 enum gatemp_remote_protect remote_protect;
162 /* Remote protection level
163 * The default value is #GATEMP_REMOTEPROTECT_SYSTEM */
164};
165
166/* Structure defining config parameters for the gatemp module. */
167struct gatemp_config {
168 u32 num_resources;
169 /* Maximum number of resources */
170 enum gatemp_local_protect default_protection;
171 u32 max_name_len;
172 u32 max_runtime_entries;
173};
174
175
176/* Close an opened gate */
177int gatemp_close(void **handle_ptr);
178
179/* Create a gatemp instance */
180void *gatemp_create(const struct gatemp_params *params);
181
182/* Delete a created gatemp instance */
183int gatemp_delete(void **handle_ptr);
184
185/* Query the gate */
186bool gatemp_query(int qual);
187
188/* Get the default remote gate */
189void *gatemp_get_default_remote(void);
190
191/* Get the local protect gate. */
192enum gatemp_local_protect gatemp_get_local_protect(void *obj);
193
194/* Get the remote protect gate. */
195enum gatemp_remote_protect gatemp_get_remote_protect(void *obj);
196
197/* Open a created gatemp by name */
198int gatemp_open(char *name, void **handle_ptr);
199
200/* Open a created gatemp by address */
201int gatemp_open_by_addr(void *shared_addr, void **handle_ptr);
202
203/* Initialize a gatemp parameters struct */
204void gatemp_params_init(struct gatemp_params *params);
205
206/* Amount of shared memory required for creation of each instance */
207uint gatemp_shared_mem_req(const struct gatemp_params *params);
208
209/* Enter the gatemp */
210int *gatemp_enter(void *handle);
211
212/* Leave the gatemp */
213void gatemp_leave(void *handle, int *key);
214
215/* Get the default configuration for the gatemp module. */
216void gatemp_get_config(struct gatemp_config *cfg_params);
217
218/* Setup the gatemp module. */
219s32 gatemp_setup(const struct gatemp_config *cfg);
220
221/* Function to destroy the gatemp module. */
222s32 gatemp_destroy(void);
223
224/* Function to attach gatemp to a remote processor */
225int gatemp_attach(u16 remote_proc_id, void *shared_addr);
226
227/* Function to detach gatemp from a remote processor */
228int gatemp_detach(u16 remote_proc_id, void *shared_addr);
229
230/* Function to start gatemp */
231int gatemp_start(void *shared_addr);
232
233/* Function to start gatemp */
234int gatemp_stop(void);
235
236/* Function to create local gatemp */
237void *gatemp_create_local(enum gatemp_local_protect local_protect);
238
239/* Function to return size required in shared region 0 */
240uint gatemp_get_region0_reserved_size(void);
241
242/* Function to get the shared address of a gatemp object */
243u32 *gatemp_get_shared_addr(void *obj);
244
245
246#endif /* _GATEMP_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/gatemp_ioctl.h b/arch/arm/plat-omap/include/syslink/gatemp_ioctl.h
new file mode 100644
index 00000000000..ff99aebf2fc
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/gatemp_ioctl.h
@@ -0,0 +1,177 @@
1/*
2 * gatemp_ioctl.h
3 *
4 * Definitions of gatemp ioctl types and structures.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18#ifndef _GATEMP_IOCTL_H_
19#define _GATEMP_IOCTL_H_
20
21#include <linux/ioctl.h>
22#include <linux/types.h>
23
24#include <ipc_ioctl.h>
25#include <gatemp.h>
26
27/* =============================================================================
28 * Macros and types
29 * =============================================================================
30 */
31#define GATEMP_IOC_MAGIC IPC_IOC_MAGIC
32/* IOCTL command ID definitions for GateMP */
33enum CMD_GATEMP {
34 GATEMP_GETCONFIG = GATEMP_BASE_CMD,
35 GATEMP_SETUP,
36 GATEMP_DESTROY,
37 GATEMP_PARAMS_INIT,
38 GATEMP_CREATE,
39 GATEMP_DELETE,
40 GATEMP_OPEN,
41 GATEMP_CLOSE,
42 GATEMP_ENTER,
43 GATEMP_LEAVE,
44 GATEMP_SHAREDMEMREQ,
45 GATEMP_OPENBYADDR,
46 GATEMP_GETDEFAULTREMOTE
47};
48
49/*
50 * IOCTL command IDs for GateMP
51 */
52/* Command for gatemp_get_config */
53#define CMD_GATEMP_GETCONFIG _IOWR(GATEMP_IOC_MAGIC, \
54 GATEMP_GETCONFIG, \
55 struct gatemp_cmd_args)
56/* Command for gatemp_setup */
57#define CMD_GATEMP_SETUP _IOWR(GATEMP_IOC_MAGIC, \
58 GATEMP_SETUP, \
59 struct gatemp_cmd_args)
60/* Command for gatemp_destroy */
61#define CMD_GATEMP_DESTROY _IOWR(GATEMP_IOC_MAGIC, \
62 GATEMP_DESTROY, \
63 struct gatemp_cmd_args)
64/* Command for gatemp_params_init */
65#define CMD_GATEMP_PARAMS_INIT _IOWR(GATEMP_IOC_MAGIC, \
66 GATEMP_PARAMS_INIT, \
67 struct gatemp_cmd_args)
68/* Command for gatemp_create */
69#define CMD_GATEMP_CREATE _IOWR(GATEMP_IOC_MAGIC, \
70 GATEMP_CREATE, \
71 struct gatemp_cmd_args)
72/* Command for gatemp_delete */
73#define CMD_GATEMP_DELETE _IOWR(GATEMP_IOC_MAGIC, \
74 GATEMP_DELETE, \
75 struct gatemp_cmd_args)
76/* Command for gatemp_open */
77#define CMD_GATEMP_OPEN _IOWR(GATEMP_IOC_MAGIC, \
78 GATEMP_OPEN, \
79 struct gatemp_cmd_args)
80/* Command for gatemp_close */
81#define CMD_GATEMP_CLOSE _IOWR(GATEMP_IOC_MAGIC, \
82 GATEMP_CLOSE, \
83 struct gatemp_cmd_args)
84/* Command for gatemp_enter */
85#define CMD_GATEMP_ENTER _IOWR(GATEMP_IOC_MAGIC, \
86 GATEMP_ENTER, \
87 struct gatemp_cmd_args)
88/* Command for gatemp_leave */
89#define CMD_GATEMP_LEAVE _IOWR(GATEMP_IOC_MAGIC, \
90 GATEMP_LEAVE, \
91 struct gatemp_cmd_args)
92/* Command for gatemp_shared_mem_req */
93#define CMD_GATEMP_SHAREDMEMREQ _IOWR(GATEMP_IOC_MAGIC, \
94 GATEMP_SHAREDMEMREQ, \
95 struct gatemp_cmd_args)
96/* Command for gatemp_open_by_addr */
97#define CMD_GATEMP_OPENBYADDR _IOWR(GATEMP_IOC_MAGIC, \
98 GATEMP_OPENBYADDR, \
99 struct gatemp_cmd_args)
100/* Command for gatemp_get_default_remote */
101#define CMD_GATEMP_GETDEFAULTREMOTE _IOWR(GATEMP_IOC_MAGIC, \
102 GATEMP_GETDEFAULTREMOTE, \
103 struct gatemp_cmd_args)
104
105/* Command arguments for GateMP */
106struct gatemp_cmd_args {
107 union {
108 struct {
109 struct gatemp_params *params;
110 } params_init;
111
112 struct {
113 struct gatemp_config *config;
114 } get_config;
115
116 struct {
117 struct gatemp_config *config;
118 } setup;
119
120 struct {
121 void *handle;
122 struct gatemp_params *params;
123 u32 name_len;
124 u32 *shared_addr_srptr;
125 } create;
126
127 struct {
128 void *handle;
129 } delete_instance;
130
131 struct {
132 void *handle;
133 char *name;
134 u32 name_len;
135 u32 *shared_addr_srptr;
136 } open;
137
138 struct {
139 void *handle;
140 u32 *shared_addr_srptr;
141 } open_by_addr;
142
143 struct {
144 void *handle;
145 } close;
146
147 struct {
148 void *handle;
149 int *flags;
150 } enter;
151
152 struct {
153 void *handle;
154 int *flags;
155 } leave;
156
157 struct {
158 struct gatemp_params *params;
159 u32 ret_val;
160 } shared_mem_req;
161
162 struct {
163 void *handle;
164 } get_default_remote;
165 } args;
166
167 s32 api_status;
168};
169
170
171/*
172 * ioctl interface function for gatemp
173 */
174int gatemp_ioctl(struct inode *inode, struct file *filp,
175 unsigned int cmd, unsigned long args, bool user);
176
177#endif /* _GATEMP_IOCTL_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/gatempdefs.h b/arch/arm/plat-omap/include/syslink/gatempdefs.h
new file mode 100644
index 00000000000..46f83e2c630
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/gatempdefs.h
@@ -0,0 +1,128 @@
1/*
2 * gatemp.h
3 *
4 * Definitions of gatemp support proxies
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18#ifndef _GATEMPDEFS_H_
19#define _GATEMPDEFS_H_
20
21
22/* Utilities headers */
23#include <gatepeterson.h>
24#include <gatehwspinlock.h>
25/* Enable once ported - GateMPSupportNull may not be needed
26#include <_GateMPSupportNull.h>
27#include <GateMPSupportNull.h>
28*/
29
30#if 1 /* Enable when SpinLock is available */
31#define gatemp_remote_system_proxy_params_init gatehwspinlock_params_init
32#define gatemp_remote_custom1_proxy_params_init gatepeterson_params_init
33#define gatemp_remote_custom2_proxy_params_init gatepeterson_params_init
34#define gatemp_remote_system_proxy_create gatehwspinlock_create
35#define gatemp_remote_custom1_proxy_create gatepeterson_create
36#define gatemp_remote_custom2_proxy_create gatepeterson_create
37#define gatemp_remote_system_proxy_delete gatehwspinlock_delete
38#define gatemp_remote_custom1_proxy_delete gatepeterson_delete
39#define gatemp_remote_custom2_proxy_delete gatepeterson_delete
40#define gatemp_remote_system_proxy_params struct gatehwspinlock_params
41#define gatemp_remote_custom1_proxy_params struct gatepeterson_params
42#define gatemp_remote_custom2_proxy_params struct gatepeterson_params
43#define gatemp_remote_system_proxy_shared_mem_req \
44 gatehwspinlock_shared_mem_req
45#define gatemp_remote_custom1_proxy_shared_mem_req \
46 gatepeterson_shared_mem_req
47#define gatemp_remote_custom2_proxy_shared_mem_req \
48 gatepeterson_shared_mem_req
49#define gatemp_remote_system_proxy_get_num_instances \
50 gatehwspinlock_get_num_instances
51#define gatemp_remote_custom1_proxy_get_num_instances \
52 gatepeterson_get_num_instances
53#define gatemp_remote_custom2_proxy_get_num_instances \
54 gatepeterson_get_num_instances
55#define gatemp_remote_system_proxy_get_num_reserved \
56 gatehwspinlock_get_num_reserved
57#define gatemp_remote_custom1_proxy_get_num_reserved \
58 gatepeterson_get_num_reserved
59#define gatemp_remote_custom2_proxy_get_num_reserved \
60 gatepeterson_get_num_reserved
61#define gatemp_remote_system_proxy_locks_init gatehwspinlock_locks_init
62#define gatemp_remote_custom1_proxy_locks_init gatepeterson_locks_init
63#define gatemp_remote_custom2_proxy_locks_init gatepeterson_locks_init
64#define gatemp_remote_system_proxy_handle void *
65#define gatemp_remote_custom1_proxy_handle void *
66#define gatemp_remote_custom2_proxy_handle void *
67#define gatemp_remote_system_proxy_open_by_addr gatehwspinlock_open_by_addr
68#define gatemp_remote_custom1_proxy_open_by_addr \
69 gatepeterson_open_by_addr
70#define gatemp_remote_custom2_proxy_open_by_addr \
71 gatepeterson_open_by_addr
72#define gatemp_remote_system_proxy_enter gatehwspinlock_enter
73#define gatemp_remote_system_proxy_leave gatehwspinlock_leave
74#define gatemp_remote_custom1_proxy_enter gatepeterson_enter
75#define gatemp_remote_custom1_proxy_leave gatepeterson_leave
76#define gatemp_remote_custom2_proxy_enter gatepeterson_enter
77#define gatemp_remote_custom2_proxy_leave gatepeterson_leave
78#else
79#define gatemp_remote_system_proxy_params_init gatepeterson_params_init
80#define gatemp_remote_custom1_proxy_params_init gatepeterson_params_init
81#define gatemp_remote_custom2_proxy_params_init gatepeterson_params_init
82#define gatemp_remote_system_proxy_create gatepeterson_create
83#define gatemp_remote_custom1_proxy_create gatepeterson_create
84#define gatemp_remote_custom2_proxy_create gatepeterson_create
85#define gatemp_remote_system_proxy_delete gatepeterson_delete
86#define gatemp_remote_custom1_proxy_delete gatepeterson_delete
87#define gatemp_remote_custom2_proxy_delete gatepeterson_delete
88#define gatemp_remote_system_proxy_params struct gatepeterson_params
89#define gatemp_remote_custom1_proxy_params struct gatepeterson_params
90#define gatemp_remote_custom2_proxy_params struct gatepeterson_params
91#define gatemp_remote_system_proxy_shared_mem_req \
92 gatepeterson_shared_mem_req
93#define gatemp_remote_custom1_proxy_shared_mem_req \
94 gatepeterson_shared_mem_req
95#define gatemp_remote_custom2_proxy_shared_mem_req \
96 gatepeterson_shared_mem_req
97#define gatemp_remote_system_proxy_get_num_instances \
98 gatepeterson_get_num_instances
99#define gatemp_remote_custom1_proxy_get_num_instances \
100 gatepeterson_get_num_instances
101#define gatemp_remote_custom2_proxy_get_num_instances \
102 gatepeterson_get_num_instances
103#define gatemp_remote_system_proxy_get_num_reserved \
104 gatepeterson_get_num_reserved
105#define gatemp_remote_custom1_proxy_get_num_reserved \
106 gatepeterson_get_num_reserved
107#define gatemp_remote_custom2_proxy_get_num_reserved \
108 gatepeterson_get_num_reserved
109#define gatemp_remote_system_proxy_locks_init gatepeterson_locks_init
110#define gatemp_remote_custom1_proxy_locks_init gatepeterson_locks_init
111#define gatemp_remote_custom2_proxy_locks_init gatepeterson_locks_init
112#define gatemp_remote_system_proxy_handle void *
113#define gatemp_remote_custom1_proxy_handle void *
114#define gatemp_remote_custom2_proxy_handle void *
115#define gatemp_remote_system_proxy_open_by_addr gatepeterson_open_by_addr
116#define gatemp_remote_custom1_proxy_open_by_addr \
117 gatepeterson_open_by_addr
118#define gatemp_remote_custom2_proxy_open_by_addr \
119 gatepeterson_open_by_addr
120#define gatemp_remote_system_proxy_enter gatepeterson_enter
121#define gatemp_remote_system_proxy_leave gatepeterson_leave
122#define gatemp_remote_custom1_proxy_enter gatepeterson_enter
123#define gatemp_remote_custom1_proxy_leave gatepeterson_leave
124#define gatemp_remote_custom2_proxy_enter gatepeterson_enter
125#define gatemp_remote_custom2_proxy_leave gatepeterson_leave
126#endif
127
128#endif /* _GATEMPDEFS_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/gatepeterson.h b/arch/arm/plat-omap/include/syslink/gatepeterson.h
new file mode 100644
index 00000000000..31e7e7c0ed4
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/gatepeterson.h
@@ -0,0 +1,145 @@
1/*
2 * gatepeterson.h
3 *
4 * The Gate Peterson Algorithm for mutual exclusion of shared memory.
5 * Current implementation works for 2 processors.
6 *
7 * Copyright (C) 2008-2009 Texas Instruments, Inc.
8 *
9 * This package is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE.
17 */
18
19#ifndef _GATEPETERSON_H_
20#define _GATEPETERSON_H_
21
22#include <linux/types.h>
23
24#include <igatempsupport.h>
25
26/*
27 * GATEPETERSON_MODULEID
28 * Unique module ID
29 */
30#define GATEPETERSON_MODULEID (0xF415)
31
32/*
33 * A set of context protection levels that each correspond to
34 * single processor gates used for local protection
35 */
36enum gatepeterson_protect {
37 GATEPETERSON_PROTECT_DEFAULT = 0,
38 GATEPETERSON_PROTECT_NONE = 1,
39 GATEPETERSON_PROTECT_INTERRUPT = 2,
40 GATEPETERSON_PROTECT_TASKLET = 3,
41 GATEPETERSON_PROTECT_THREAD = 4,
42 GATEPETERSON_PROTECT_PROCESS = 5,
43 GATEPETERSON_PROTECT_END_VALUE = 6
44};
45
46/*
47 * Structure defining config parameters for the Gate Peterson
48 * module
49 */
50struct gatepeterson_config {
51 enum gatepeterson_protect default_protection;
52 /*!< Default module-wide local context protection level. The level of
53 * protection specified here determines which local gate is created per
54 * GatePeterson instance for local protection during create. The instance
55 * configuration parameter may be usedto override this module setting per
56 * instance. The configuration used here should reflect both the context
57 * in which enter and leave are to be called,as well as the maximum level
58 * of protection needed locally.
59 */
60 u32 num_instances;
61 /*!< Maximum number of instances supported by the GatePeterson module */
62
63};
64
65/*
66 * Structure defining config parameters for the Gate Peterson
67 * instances
68 */
69struct gatepeterson_params {
70 IGATEMPSUPPORT_SUPERPARAMS;
71};
72
73/*
74 * Function to initialize the parameter structure
75 */
76void gatepeterson_get_config(struct gatepeterson_config *config);
77
78/*
79 * Function to initialize GP module
80 */
81int gatepeterson_setup(const struct gatepeterson_config *config);
82
83/*
84 * Function to destroy the GP module
85 */
86int gatepeterson_destroy(void);
87
88/*
89 * Function to initialize the parameter structure
90 */
91void gatepeterson_params_init(struct gatepeterson_params *params);
92
93/*
94 * Function to create an instance of GatePeterson
95 */
96void *gatepeterson_create(enum igatempsupport_local_protect local_protect,
97 const struct gatepeterson_params *params);
98
99/*
100 * Function to delete an instance of GatePeterson
101 */
102int gatepeterson_delete(void **gphandle);
103
104/*
105 * Function to open a previously created instance by address
106 */
107int gatepeterson_open_by_addr(enum igatempsupport_local_protect local_protect,
108 void *shared_addr, void **gphandle);
109
110/*
111 * Function to close a previously opened instance
112 */
113int gatepeterson_close(void **gphandle);
114
115/*
116 * Function to enter the gate peterson
117 */
118int *gatepeterson_enter(void *gphandle);
119
120/*
121 *Function to leave the gate peterson
122 */
123void gatepeterson_leave(void *gphandle, int *key);
124
125/*
126 * Function to return the shared memory requirement
127 */
128u32 gatepeterson_shared_mem_req(const struct gatepeterson_params *params);
129
130/*
131 * Function to return the number of instances configured in the module.
132 */
133u32 gatepeterson_get_num_instances(void);
134
135/*
136 * Function to return the number of instances not controlled by GateMP.
137 */
138u32 gatepeterson_get_num_reserved(void);
139
140/*
141 * Function to initialize the locks module.
142 */
143void gatepeterson_locks_init(void);
144
145#endif /* _GATEPETERSON_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/gt.h b/arch/arm/plat-omap/include/syslink/gt.h
new file mode 100644
index 00000000000..95e3feb18e7
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/gt.h
@@ -0,0 +1,320 @@
1
2/*
3 * gt.h
4 *
5 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6 *
7 * Copyright (C) 2008 Texas Instruments, Inc.
8 *
9 * This package is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 */
17
18
19/*
20 * ======== gt.h ========
21 * Purpose:
22 * There are two definitions that affect which portions of trace
23 * are acutally compiled into the client: GT_TRACE and GT_ASSERT. If
24 * GT_TRACE is set to 0 then all trace statements (except for assertions)
25 * will be compiled out of the client. If GT_ASSERT is set to 0 then
26 * assertions will be compiled out of the client. GT_ASSERT can not be
27 * set to 0 unless GT_TRACE is also set to 0 (i.e. GT_TRACE == 1 implies
28 * GT_ASSERT == 1).
29 *
30 *! Revision History
31 *! ================
32 *! 02-Feb-2000 rr: Renamed this file to gtce.h. GT CLASS and trace
33 *! definitions are WinCE Specific.
34 *! 03-Jan-1997 ge Replaced "GT_" prefix to GT_Config structure members
35 *! to eliminate preprocessor confusion with other macros.
36 */
37#include <linux/types.h>
38#ifndef GT_
39#define GT_
40
41#ifndef GT_TRACE
42#define GT_TRACE 0 /* 0 = "trace compiled out"; 1 = "trace active" */
43#endif
44
45/* #include <syslink/host_os.h> */
46
47typedef s32(*Fxn)(); /* generic function type */
48
49
50#if !defined(GT_ASSERT) || GT_TRACE
51#define GT_ASSERT 1
52#endif
53
54struct GT_Config {
55 Fxn PRINTFXN;
56 Fxn PIDFXN;
57 Fxn TIDFXN;
58 Fxn ERRORFXN;
59};
60
61extern struct GT_Config *GT;
62
63struct gt_mask {
64 char *modName;
65 u8 *flags;
66} ;
67
68/*
69 * New GT Class defenitions.
70 *
71 * The following are the explanations and how it could be used in the code
72 *
73 * - GT_ENTER On Entry to Functions
74 *
75 * - GT_1CLASS Display level of debugging status- Object/Automatic
76 * variables
77 * - GT_2CLASS ---- do ----
78 *
79 * - GT_3CLASS ---- do ---- + It can be used(recommended) for debug
80 * status in the ISR, IST
81 * - GT_4CLASS ---- do ----
82 *
83 * - GT_5CLASS Display entry for module init/exit functions
84 *
85 * - GT_6CLASS Warn whenever SERVICES function fails
86 *
87 * - GT_7CLASS Warn failure of Critical failures
88 *
89 */
90
91#define GT_ENTER ((u8)0x01)
92#define GT_1CLASS ((u8)0x02)
93#define GT_2CLASS ((u8)0x04)
94#define GT_3CLASS ((u8)0x08)
95#define GT_4CLASS ((u8)0x10)
96#define GT_5CLASS ((u8)0x20)
97#define GT_6CLASS ((u8)0x40)
98#define GT_7CLASS ((u8)0x80)
99#define GT_LEAVE ((u8)0x02)
100
101#ifdef _LINT_
102
103/* LINTLIBRARY */
104
105/*
106 * ======== GT_assert ========
107 */
108/* ARGSUSED */
109void GT_assert(struct gt_mask mask, s32 expr)
110{
111}
112
113/*
114 * ======== GT_config ========
115 */
116/* ARGSUSED */
117void GT_config(struct GT_Config config)
118{
119}
120
121/*
122 * ======== GT_create ========
123 */
124/* ARGSUSED */
125void GT_create(struct gt_mask *mask, char *modName)
126{
127}
128
129/*
130 * ======== GT_curline ========
131 * Purpose:
132 * Returns the current source code line number. Is useful for performing
133 * branch testing using trace. For example,
134 *
135 * gt_1trace(curTrace, GT_1CLASS,
136 * "in module XX_mod, executing line %u\n", GT_curline());
137 */
138/* ARGSUSED */
139u16 GT_curline(void)
140{
141 return (u16)NULL;
142}
143
144/*
145 * ======== GT_exit ========
146 */
147/* ARGSUSED */
148void GT_exit(void)
149{
150}
151
152/*
153 * ======== GT_init ========
154 */
155/* ARGSUSED */
156void GT_init(void)
157{
158}
159
160/*
161 * ======== GT_query ========
162 */
163/* ARGSUSED */
164bool GT_query(struct gt_mask mask, u8 class)
165{
166 return false;
167}
168
169/*
170 * ======== GT_set ========
171 * sets trace mask according to settings
172 */
173
174/* ARGSUSED */
175void GT_set(char *settings)
176{
177}
178
179/*
180 * ======== GT_setprintf ========
181 * sets printf function
182 */
183
184/* ARGSUSED */
185void GT_setprintf(Fxn fxn)
186{
187}
188
189/* ARGSUSED */
190void gt_0trace(struct gt_mask mask, u8 class, char *format)
191{
192}
193
194/* ARGSUSED */
195void gt_1trace(struct gt_mask mask, u8 class, char *format, ...)
196{
197}
198
199/* ARGSUSED */
200void gt_2trace(struct gt_mask mask, u8 class, char *format, ...)
201{
202}
203
204/* ARGSUSED */
205void gt_3trace(struct gt_mask mask, u8 class, char *format, ...)
206{
207}
208
209/* ARGSUSED */
210void gt_4trace(struct gt_mask mask, u8 class, char *format, ...)
211{
212}
213
214/* ARGSUSED */
215void gt_5trace(struct gt_mask mask, u8 class, char *format, ...)
216{
217}
218
219/* ARGSUSED */
220void GT_6trace(struct gt_mask mask, u8 class, char *format, ...)
221{
222}
223
224#else
225
226#define GT_BOUND 26 /* 26 letters in alphabet */
227
228extern void _GT_create(struct gt_mask *mask, char *modName);
229
230#define GT_exit()
231
232extern void GT_init(void);
233extern void _GT_set(char *str);
234extern s32 _GT_trace(struct gt_mask *mask, char *format, ...);
235
236#if GT_ASSERT == 0
237
238#define GT_assert(mask, expr)
239#define GT_config(config)
240#define GT_configInit(config)
241#define GT_seterror(fxn)
242
243#else
244
245extern struct GT_Config _GT_params;
246
247#define GT_assert(mask, expr) \
248 (!(expr) ? \
249 printk(KERN_ALERT "assertion violation: %s, line %d\n", \
250 __FILE__, __LINE__), NULL : NULL)
251
252#define GT_config(config) (_GT_params = *(config))
253#define GT_configInit(config) (*(config) = _GT_params)
254#define GT_seterror(fxn) (_GT_params.ERRORFXN = (Fxn)(fxn))
255
256#endif
257
258#if GT_TRACE == 0
259
260#define GT_curline() ((u16)__LINE__)
261#define GT_create(mask, modName)
262#define GT_exit()
263#define GT_init()
264#define GT_set(settings)
265#define GT_setprintf(fxn)
266
267#define GT_query(mask, class) false
268
269#define gt_0trace(mask, class, format)
270#define gt_1trace(mask, class, format, arg1)
271#define gt_2trace(mask, class, format, arg1, arg2)
272#define gt_3trace(mask, class, format, arg1, arg2, arg3)
273#define gt_4trace(mask, class, format, arg1, arg2, arg3, arg4)
274#define gt_5trace(mask, class, format, arg1, arg2, arg3, arg4, arg5)
275#define GT_6trace(mask, class, format, arg1, arg2, arg3, arg4, arg5, arg6)
276
277#else /* GT_TRACE == 1 */
278
279#define GT_create(mask, modName) _GT_create((mask), (modName))
280#define GT_curline() ((u16)__LINE__)
281#define GT_set(settings) _GT_set(settings)
282#define GT_setprintf(fxn) (_GT_params.PRINTFXN = (Fxn)(fxn))
283
284#define GT_query(mask, class) ((*(mask).flags & (class)))
285
286#define gt_0trace(mask, class, format) \
287 ((*(mask).flags & (class)) ? \
288 _GT_trace(&(mask), (format)) : 0)
289
290#define gt_1trace(mask, class, format, arg1) \
291 ((*(mask).flags & (class)) ? \
292 _GT_trace(&(mask), (format), (arg1)) : 0)
293
294#define gt_2trace(mask, class, format, arg1, arg2) \
295 ((*(mask).flags & (class)) ? \
296 _GT_trace(&(mask), (format), (arg1), (arg2)) : 0)
297
298#define gt_3trace(mask, class, format, arg1, arg2, arg3) \
299 ((*(mask).flags & (class)) ? \
300 _GT_trace(&(mask), (format), (arg1), (arg2), (arg3)) : 0)
301
302#define gt_4trace(mask, class, format, arg1, arg2, arg3, arg4) \
303 ((*(mask).flags & (class)) ? \
304 _GT_trace(&(mask), (format), (arg1), (arg2), (arg3), (arg4)) : 0)
305
306#define gt_5trace(mask, class, format, arg1, arg2, arg3, arg4, arg5) \
307 ((*(mask).flags & (class)) ? \
308 _GT_trace(&(mask), (format), (arg1), (arg2), (arg3), (arg4), (arg5)) \
309 : 0)
310
311#define GT_6trace(mask, class, format, arg1, arg2, arg3, arg4, arg5, arg6) \
312 ((*(mask).flags & (class)) ? \
313 _GT_trace(&(mask), (format), (arg1), (arg2), (arg3), (arg4), (arg5), \
314 (arg6)) : 0)
315
316#endif /* GT_TRACE */
317
318#endif /* _LINT_ */
319
320#endif /* GTCE_ */
diff --git a/arch/arm/plat-omap/include/syslink/heap.h b/arch/arm/plat-omap/include/syslink/heap.h
new file mode 100644
index 00000000000..47949ad1cbb
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/heap.h
@@ -0,0 +1,96 @@
1/*
2 * heap.h
3 *
4 * Heap module manages fixed size buffers that can be used
5 * in a multiprocessor system with shared memory.
6 *
7 * Copyright (C) 2008-2009 Texas Instruments, Inc.
8 *
9 * This package is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE.
17 */
18
19#ifndef _HEAP_H_
20#define _HEAP_H_
21
22#include <linux/types.h>
23
24/*
25 * Structure defining memory related statistics
26 */
27struct memory_stats{
28 u32 total_size; /* Total memory size */
29 u32 total_free_size; /* Total free memory size */
30 u32 largest_free_size; /* Largest free memory size */
31};
32
33/*!
34 * ======== extendedstats ========
35 * Stats structure for the get_extended_stats API.
36 *
37 * max_allocated_blocks: The maximum number of blocks allocated
38 * from this heap at any single point in time during the lifetime of this
39 * heap instance.
40 *
41 * num_allocated_blocks: The total number of blocks currently
42 * allocated in this Heap instance.
43 */
44struct heap_extended_stats {
45 u32 max_allocated_blocks;
46 u32 num_allocated_blocks;
47};
48
49/*
50 * Structure defining config parameters for the heapbuf module
51 */
52struct heap_config {
53 u32 max_name_len; /* Maximum length of name */
54 bool track_max_allocs; /* Track the max number of allocated blocks */
55};
56
57/*
58 * Structure for the handle for the heap
59 */
60struct heap_object {
61 void* (*alloc) (void *handle, u32 size, u32 align);
62 int (*free) (void *handle, void *block, u32 size);
63 void (*get_stats) (void *handle, struct memory_stats *stats);
64 void (*get_extended_stats) (void *handle,
65 struct heap_extended_stats *stats);
66 bool (*is_blocking) (void *handle);
67 void *obj;
68};
69
70/*
71 * Allocate a block
72 */
73void *sl_heap_alloc(void *handle, u32 size, u32 align);
74
75/*
76 * Frees the block to this Heap
77 */
78int sl_heap_free(void *handle, void *block, u32 size);
79
80/*
81 * Get heap statistics
82 */
83void sl_heap_get_stats(void *handle, struct memory_stats *stats);
84
85/*
86 * Get heap extended statistics
87 */
88void sl_heap_get_extended_stats(void *hphandle,
89 struct heap_extended_stats *stats);
90
91/*
92 * Indicates whether a heap will block on free or alloc
93 */
94bool sl_heap_is_blocking(void *hphandle);
95
96#endif /* _HEAP_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/heapbufmp.h b/arch/arm/plat-omap/include/syslink/heapbufmp.h
new file mode 100644
index 00000000000..51fd65c0c11
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/heapbufmp.h
@@ -0,0 +1,253 @@
1/*
2 * heapbufmp.h
3 *
4 * Heap module manages fixed size buffers that can be used
5 * in a multiprocessor system with shared memory.
6 *
7 * Copyright (C) 2008-2009 Texas Instruments, Inc.
8 *
9 * This package is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE.
17 */
18
19#ifndef _HEAPBUFMP_H_
20#define _HEAPBUFMP_H_
21
22#include <linux/types.h>
23#include <heap.h>
24#include <listmp.h>
25
26/*!
27 * @def LISTMP_MODULEID
28 * @brief Unique module ID.
29 */
30#define HEAPBUFMP_MODULEID (0x4cd5)
31
32/*
33 * Creation of Heap Buf succesful.
34*/
35#define HEAPBUFMP_CREATED (0x05251995)
36
37/*
38 * Version.
39 */
40#define HEAPBUFMP_VERSION (1)
41
42/* =============================================================================
43 * All success and failure codes for the module
44 * =============================================================================
45 */
46
47/*!
48 * @def HEAPBUFMP_S_BUSY
49 * @brief The resource is still in use
50 */
51#define HEAPBUFMP_S_BUSY 2
52
53/*!
54 * @def HEAPBUFMP_S_ALREADYSETUP
55 * @brief The module has been already setup
56 */
57#define HEAPBUFMP_S_ALREADYSETUP 1
58
59/*!
60 * @def HEAPBUFMP_S_SUCCESS
61 * @brief Operation is successful.
62 */
63#define HEAPBUFMP_S_SUCCESS 0
64
65/*!
66 * @def HEAPBUFMP_E_FAIL
67 * @brief Generic failure.
68 */
69#define HEAPBUFMP_E_FAIL -1
70
71/*!
72 * @def HEAPBUFMP_E_INVALIDARG
73 * @brief Argument passed to function is invalid.
74 */
75#define HEAPBUFMP_E_INVALIDARG -2
76
77/*!
78 * @def HEAPBUFMP_E_MEMORY
79 * @brief Operation resulted in memory failure.
80 */
81#define HEAPBUFMP_E_MEMORY -3
82
83/*!
84 * @def HEAPBUFMP_E_ALREADYEXISTS
85 * @brief The specified entity already exists.
86 */
87#define HEAPBUFMP_E_ALREADYEXISTS -4
88
89/*!
90 * @def HEAPBUFMP_E_NOTFOUND
91 * @brief Unable to find the specified entity.
92 */
93#define HEAPBUFMP_E_NOTFOUND -5
94
95/*!
96 * @def HEAPBUFMP_E_TIMEOUT
97 * @brief Operation timed out.
98 */
99#define HEAPBUFMP_E_TIMEOUT -6
100
101/*!
102 * @def HEAPBUFMP_E_INVALIDSTATE
103 * @brief Module is not initialized.
104 */
105#define HEAPBUFMP_E_INVALIDSTATE -7
106
107/*!
108 * @def HEAPBUFMP_E_OSFAILURE
109 * @brief A failure occurred in an OS-specific call */
110#define HEAPBUFMP_E_OSFAILURE -8
111
112/*!
113 * @def HEAPBUFMP_E_RESOURCE
114 * @brief Specified resource is not available */
115#define HEAPBUFMP_E_RESOURCE -9
116
117/*!
118 * @def HEAPBUFMP_E_RESTART
119 * @brief Operation was interrupted. Please restart the operation */
120#define HEAPBUFMP_E_RESTART -10
121
122
123/* =============================================================================
124 * Macros
125 * =============================================================================
126 */
127
128
129/* =============================================================================
130 * Structures & Enums
131 * =============================================================================
132 */
133
134/*
135 * Structure defining config parameters for the HeapBuf module.
136 */
137struct heapbufmp_config {
138 u32 max_name_len; /* Maximum length of name */
139 u32 max_runtime_entries; /* Maximum number of heapbufmp instances */
140 /* that can be created */
141 bool track_allocs; /* Track the maximum number of allocated */
142 /* blocks */
143};
144
145/*
146 * Structure defining parameters for the HeapBuf module
147 */
148struct heapbufmp_params {
149 char *name; /* Name of this instance */
150 u16 region_id; /* Shared region ID */
151 void *shared_addr; /* Physical address of the shared memory */
152 u32 block_size; /* Size (in MAUs) of each block */
153 u32 num_blocks; /* Number of fixed-size blocks */
154 u32 align; /* Alignment (in MAUs, power of 2) of each block */
155 bool exact; /* Only allocate on exact match of rquested size */
156 void *gate; /* GateMP used for critical region management of */
157 /* the shared memory */
158};
159
160/*
161 * Stats structure for the getExtendedStats API.
162 */
163struct heapbufmp_extended_stats {
164 u32 max_allocated_blocks;
165 /* maximum number of blocks allocated from this heap instance */
166 u32 num_allocated_blocks;
167 /* total number of blocks currently allocated from this heap instance*/
168};
169
170/* =============================================================================
171 * APIs
172 * =============================================================================
173 */
174
175/*
176 * Function to get default configuration for the heapbufmp module
177 */
178int heapbufmp_get_config(struct heapbufmp_config *cfgparams);
179
180/*
181 * Function to setup the heapbufmp module
182 */
183int heapbufmp_setup(const struct heapbufmp_config *cfg);
184
185/*
186 * Function to destroy the heapbufmp module
187 */
188int heapbufmp_destroy(void);
189
190/* Initialize this config-params structure with supplier-specified
191 * defaults before instance creation
192 */
193void heapbufmp_params_init(struct heapbufmp_params *params);
194
195/*
196 * Creates a new instance of heapbufmp module
197 */
198void *heapbufmp_create(const struct heapbufmp_params *params);
199
200/*
201 * Deletes a instance of heapbufmp module
202 */
203int heapbufmp_delete(void **handle_ptr);
204
205/*
206 * Opens a created instance of heapbufmp module by name
207 */
208int heapbufmp_open(char *name, void **handle_ptr);
209
210/*
211 * Opens a created instance of heapbufmp module by address
212 */
213int heapbufmp_open_by_addr(void *shared_addr, void **handle_ptr);
214
215/*
216 * Closes previously opened/created instance of heapbufmp module
217 */
218int heapbufmp_close(void **handle_ptr);
219
220/*
221 * Returns the amount of shared memory required for creation
222 * of each instance
223 */
224int heapbufmp_shared_mem_req(const struct heapbufmp_params *params);
225
226/*
227 * Allocate a block
228 */
229void *heapbufmp_alloc(void *hphandle, u32 size, u32 align);
230
231/*
232 * Frees the block to this heapbufmp
233 */
234int heapbufmp_free(void *hphandle, void *block, u32 size);
235
236/*
237 * Get memory statistics
238 */
239void heapbufmp_get_stats(void *hphandle, struct memory_stats *stats);
240
241/*
242 * Indicate whether the heap may block during an alloc or free call
243 */
244bool heapbufmp_isblocking(void *handle);
245
246/*
247 * Get extended statistics
248 */
249void heapbufmp_get_extended_stats(void *hphandle,
250 struct heapbufmp_extended_stats *stats);
251
252
253#endif /* _HEAPBUFMP_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/heapbufmp_ioctl.h b/arch/arm/plat-omap/include/syslink/heapbufmp_ioctl.h
new file mode 100644
index 00000000000..f291a5e3d07
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/heapbufmp_ioctl.h
@@ -0,0 +1,232 @@
1/*
2 * heapbufmp_ioctl.h
3 *
4 * Heap module manages fixed size buffers that can be used
5 * in a multiprocessor system with shared memory.
6 *
7 * Copyright (C) 2008-2009 Texas Instruments, Inc.
8 *
9 * This package is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE.
17 */
18
19#ifndef _HEAPBUFMP_IOCTL_
20#define _HEAPBUFMP_IOCTL_
21
22#include <linux/ioctl.h>
23#include <linux/types.h>
24
25#include <ipc_ioctl.h>
26#include <heapbufmp.h>
27
28
29enum CMD_HEAPBUF {
30 HEAPBUFMP_GETCONFIG = HEAPBUFMP_BASE_CMD,
31 HEAPBUFMP_SETUP,
32 HEAPBUFMP_DESTROY,
33 HEAPBUFMP_PARAMS_INIT,
34 HEAPBUFMP_CREATE,
35 HEAPBUFMP_DELETE,
36 HEAPBUFMP_OPEN,
37 HEAPBUFMP_OPENBYADDR,
38 HEAPBUFMP_CLOSE,
39 HEAPBUFMP_ALLOC,
40 HEAPBUFMP_FREE,
41 HEAPBUFMP_SHAREDMEMREQ,
42 HEAPBUFMP_GETSTATS,
43 HEAPBUFMP_GETEXTENDEDSTATS
44};
45
46/*
47 * Command for heapbufmp_get_config
48 */
49#define CMD_HEAPBUFMP_GETCONFIG _IOWR(IPC_IOC_MAGIC, \
50 HEAPBUFMP_GETCONFIG, \
51 struct heapbufmp_cmd_args)
52
53/*
54 * Command for heapbufmp_setup
55 */
56#define CMD_HEAPBUFMP_SETUP _IOWR(IPC_IOC_MAGIC, \
57 HEAPBUFMP_SETUP, \
58 struct heapbufmp_cmd_args)
59/*
60 * Command for heapbufmp_destroy
61 */
62#define CMD_HEAPBUFMP_DESTROY _IOWR(IPC_IOC_MAGIC, \
63 HEAPBUFMP_DESTROY, \
64 struct heapbufmp_cmd_args)
65
66/*
67 * Command for heapbufmp_prams_init
68 */
69#define CMD_HEAPBUFMP_PARAMS_INIT _IOWR(IPC_IOC_MAGIC, \
70 HEAPBUFMP_PARAMS_INIT, \
71 struct heapbufmp_cmd_args)
72
73/*
74 * Command for heapbufmp_create
75 */
76#define CMD_HEAPBUFMP_CREATE _IOWR(IPC_IOC_MAGIC, \
77 HEAPBUFMP_CREATE, \
78 struct heapbufmp_cmd_args)
79
80/*
81 * Command for heapbufmp_delete
82 */
83#define CMD_HEAPBUFMP_DELETE _IOWR(IPC_IOC_MAGIC, \
84 HEAPBUFMP_DELETE, \
85 struct heapbufmp_cmd_args)
86
87/*
88 * Command for heapbufmp_open
89 */
90#define CMD_HEAPBUFMP_OPEN _IOWR(IPC_IOC_MAGIC, \
91 HEAPBUFMP_OPEN, \
92 struct heapbufmp_cmd_args)
93
94/*
95 * Command for heapbufmp_open_by_addr
96 */
97#define CMD_HEAPBUFMP_OPENBYADDR _IOWR(IPC_IOC_MAGIC, \
98 HEAPBUFMP_OPENBYADDR, \
99 struct heapbufmp_cmd_args)
100
101/*
102 * Command for heapbufmp_close
103 */
104#define CMD_HEAPBUFMP_CLOSE _IOWR(IPC_IOC_MAGIC, \
105 HEAPBUFMP_CLOSE, \
106 struct heapbufmp_cmd_args)
107
108/*
109 * Command for heapbufmp_alloc
110 */
111#define CMD_HEAPBUFMP_ALLOC _IOWR(IPC_IOC_MAGIC, \
112 HEAPBUFMP_ALLOC, \
113 struct heapbufmp_cmd_args)
114
115/*
116 * Command for heapbufmp_free
117 */
118#define CMD_HEAPBUFMP_FREE _IOWR(IPC_IOC_MAGIC, \
119 HEAPBUFMP_FREE, \
120 struct heapbufmp_cmd_args)
121
122/*
123 * Command for heapbufmp_shared_mem_req
124 */
125#define CMD_HEAPBUFMP_SHAREDMEMREQ _IOWR(IPC_IOC_MAGIC, \
126 HEAPBUFMP_SHAREDMEMREQ, \
127 struct heapbufmp_cmd_args)
128
129/*
130 * Command for heapbufmp_get_stats
131 */
132#define CMD_HEAPBUFMP_GETSTATS _IOWR(IPC_IOC_MAGIC, \
133 HEAPBUFMP_GETSTATS, \
134 struct heapbufmp_cmd_args)
135
136/*
137 * Command for heapbufmp_get_extended_stats
138 */
139#define CMD_HEAPBUFMP_GETEXTENDEDSTATS _IOWR(IPC_IOC_MAGIC, \
140 HEAPBUFMP_GETEXTENDEDSTATS, \
141 struct heapbufmp_cmd_args)
142
143
144/*
145 * Command arguments for heapbuf
146 */
147union heapbufmp_arg {
148 struct {
149 struct heapbufmp_params *params;
150 } params_init;
151
152 struct {
153 struct heapbufmp_config *config;
154 } get_config;
155
156 struct {
157 struct heapbufmp_config *config;
158 } setup;
159
160 struct {
161 void *handle;
162 struct heapbufmp_params *params;
163 u32 name_len;
164 u32 *shared_addr_srptr;
165 void *knl_gate;
166 } create;
167
168 struct {
169 void *handle;
170 } delete;
171
172 struct {
173 void *handle;
174 char *name;
175 u32 name_len;
176 } open;
177
178 struct {
179 void *handle;
180 u32 *shared_addr_srptr;
181 } open_by_addr;
182
183 struct {
184 void *handle;
185 } close;
186
187 struct {
188 void *handle;
189 u32 size;
190 u32 align;
191 u32 *block_srptr;
192 } alloc;
193
194 struct {
195 void *handle;
196 u32 *block_srptr;
197 u32 size;
198 } free;
199
200 struct {
201 void *handle;
202 struct memory_stats *stats;
203 } get_stats;
204
205 struct {
206 void *handle;
207 struct heapbufmp_extended_stats *stats;
208 } get_extended_stats;
209
210 struct {
211 void *handle;
212 struct heapbufmp_params *params;
213 u32 *shared_addr_srptr;
214 u32 bytes;
215 } shared_mem_req;
216};
217
218/*
219 * Command arguments for heapbuf
220 */
221struct heapbufmp_cmd_args{
222 union heapbufmp_arg args;
223 s32 api_status;
224};
225
226/*
227 * This ioctl interface for heapbuf module
228 */
229int heapbufmp_ioctl(struct inode *pinode, struct file *filp,
230 unsigned int cmd, unsigned long args, bool user);
231
232#endif /* _HEAPBUFMP_IOCTL_ */
diff --git a/arch/arm/plat-omap/include/syslink/heapmemmp.h b/arch/arm/plat-omap/include/syslink/heapmemmp.h
new file mode 100644
index 00000000000..bfce85be4b5
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/heapmemmp.h
@@ -0,0 +1,252 @@
1/*
2 * heapmemmp.h
3 *
4 * Heap module manages fixed size buffers that can be used
5 * in a multiprocessor system with shared memory.
6 *
7 * Copyright (C) 2008-2009 Texas Instruments, Inc.
8 *
9 * This package is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE.
17 */
18
19#ifndef _HEAPMEMMP_H_
20#define _HEAPMEMMP_H_
21
22#include <linux/types.h>
23#include <heap.h>
24#include <listmp.h>
25
26/*!
27 * @def LISTMP_MODULEID
28 * @brief Unique module ID.
29 */
30#define HEAPMEMMP_MODULEID (0x4cd7)
31
32/*
33 * Creation of Heap Buf succesful.
34*/
35#define HEAPMEMMP_CREATED (0x07041776)
36
37/*
38 * Version.
39 */
40#define HEAPMEMMP_VERSION (1)
41
42/* =============================================================================
43 * All success and failure codes for the module
44 * =============================================================================
45 */
46
47/*!
48 * @def HEAPMEMMP_S_BUSY
49 * @brief The resource is still in use
50 */
51#define HEAPMEMMP_S_BUSY 2
52
53/*!
54 * @def HEAPMEMMP_S_ALREADYSETUP
55 * @brief The module has been already setup
56 */
57#define HEAPMEMMP_S_ALREADYSETUP 1
58
59/*!
60 * @def HEAPMEMMP_S_SUCCESS
61 * @brief Operation is successful.
62 */
63#define HEAPMEMMP_S_SUCCESS 0
64
65/*!
66 * @def HEAPMEMMP_E_FAIL
67 * @brief Generic failure.
68 */
69#define HEAPMEMMP_E_FAIL -1
70
71/*!
72 * @def HEAPMEMMP_E_INVALIDARG
73 * @brief Argument passed to function is invalid.
74 */
75#define HEAPMEMMP_E_INVALIDARG -2
76
77/*!
78 * @def HEAPMEMMP_E_MEMORY
79 * @brief Operation resulted in memory failure.
80 */
81#define HEAPMEMMP_E_MEMORY -3
82
83/*!
84 * @def HEAPMEMMP_E_ALREADYEXISTS
85 * @brief The specified entity already exists.
86 */
87#define HEAPMEMMP_E_ALREADYEXISTS -4
88
89/*!
90 * @def HEAPMEMMP_E_NOTFOUND
91 * @brief Unable to find the specified entity.
92 */
93#define HEAPMEMMP_E_NOTFOUND -5
94
95/*!
96 * @def HEAPMEMMP_E_TIMEOUT
97 * @brief Operation timed out.
98 */
99#define HEAPMEMMP_E_TIMEOUT -6
100
101/*!
102 * @def HEAPMEMMP_E_INVALIDSTATE
103 * @brief Module is not initialized.
104 */
105#define HEAPMEMMP_E_INVALIDSTATE -7
106
107/*!
108 * @def HEAPMEMMP_E_OSFAILURE
109 * @brief A failure occurred in an OS-specific call */
110#define HEAPMEMMP_E_OSFAILURE -8
111
112/*!
113 * @def HEAPMEMMP_E_RESOURCE
114 * @brief Specified resource is not available */
115#define HEAPMEMMP_E_RESOURCE -9
116
117/*!
118 * @def HEAPMEMMP_E_RESTART
119 * @brief Operation was interrupted. Please restart the operation */
120#define HEAPMEMMP_E_RESTART -10
121
122
123/* =============================================================================
124 * Macros
125 * =============================================================================
126 */
127
128
129/* =============================================================================
130 * Structures & Enums
131 * =============================================================================
132 */
133
134/*
135 * Structure defining config parameters for the HeapBuf module.
136 */
137struct heapmemmp_config {
138 u32 max_name_len; /* Maximum length of name */
139 u32 max_runtime_entries; /* Maximum number of heapmemmp instances */
140 /* that can be created */
141};
142
143/*
144 * Structure defining parameters for the HeapBuf module
145 */
146struct heapmemmp_params {
147 char *name; /* Name of this instance */
148 u16 region_id; /* Shared region ID */
149 void *shared_addr; /* Physical address of the shared memory */
150 u32 shared_buf_size; /* Size of shared buffer */
151 void *gate; /* GateMP used for critical region management of the */
152 /* shared memory */
153};
154
155/*
156 * Stats structure for the getExtendedStats API.
157 */
158struct heapmemmp_extended_stats {
159 void *buf;
160 /* Local address of the shared buffer */
161
162 u32 size;
163 /* Size of the shared buffer */
164};
165
166/* =============================================================================
167 * APIs
168 * =============================================================================
169 */
170
171/*
172 * Function to get default configuration for the heapmemmp module
173 */
174int heapmemmp_get_config(struct heapmemmp_config *cfgparams);
175
176/*
177 * Function to setup the heapmemmp module
178 */
179int heapmemmp_setup(const struct heapmemmp_config *cfg);
180
181/*
182 * Function to destroy the heapmemmp module
183 */
184int heapmemmp_destroy(void);
185
186/* Initialize this config-params structure with supplier-specified
187 * defaults before instance creation
188 */
189void heapmemmp_params_init(struct heapmemmp_params *params);
190
191/*
192 * Creates a new instance of heapmemmp module
193 */
194void *heapmemmp_create(const struct heapmemmp_params *params);
195
196/*
197 * Deletes a instance of heapmemmp module
198 */
199int heapmemmp_delete(void **handle_ptr);
200
201/*
202 * Opens a created instance of heapmemmp module by name
203 */
204int heapmemmp_open(char *name, void **handle_ptr);
205
206/*
207 * Opens a created instance of heapmemmp module by address
208 */
209int heapmemmp_open_by_addr(void *shared_addr, void **handle_ptr);
210
211/*
212 * Closes previously opened/created instance of heapmemmp module
213 */
214int heapmemmp_close(void **handle_ptr);
215
216/*
217 * Returns the amount of shared memory required for creation
218 * of each instance
219 */
220int heapmemmp_shared_mem_req(const struct heapmemmp_params *params);
221
222/*
223 * Allocate a block
224 */
225void *heapmemmp_alloc(void *hphandle, u32 size, u32 align);
226
227/*
228 * Frees the block to this heapmemmp
229 */
230int heapmemmp_free(void *hphandle, void *block, u32 size);
231
232/*
233 * Get memory statistics
234 */
235void heapmemmp_get_stats(void *hphandle, struct memory_stats *stats);
236
237/*
238 * Indicate whether the heap may block during an alloc or free call
239 */
240bool heapmemmp_isblocking(void *handle);
241
242/*
243 * Get extended statistics
244 */
245void heapmemmp_get_extended_stats(void *hphandle,
246 struct heapmemmp_extended_stats *stats);
247/*
248 * Restore an instance to it's original created state.
249 */
250void heapmemmp_restore(void *handle);
251
252#endif /* _HEAPMEMMP_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/heapmemmp_ioctl.h b/arch/arm/plat-omap/include/syslink/heapmemmp_ioctl.h
new file mode 100644
index 00000000000..10020148d21
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/heapmemmp_ioctl.h
@@ -0,0 +1,243 @@
1/*
2 * heapmemmp_ioctl.h
3 *
4 * Heap module manages fixed size buffers that can be used
5 * in a multiprocessor system with shared memory.
6 *
7 * Copyright (C) 2008-2009 Texas Instruments, Inc.
8 *
9 * This package is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE.
17 */
18
19#ifndef _HEAPMEMMP_IOCTL_
20#define _HEAPMEMMP_IOCTL_
21
22#include <linux/types.h>
23
24#include <ipc_ioctl.h>
25#include <heapmemmp.h>
26
27
28enum CMD_HEAPMEM {
29 HEAPMEMMP_GETCONFIG = HEAPMEMMP_BASE_CMD,
30 HEAPMEMMP_SETUP,
31 HEAPMEMMP_DESTROY,
32 HEAPMEMMP_PARAMS_INIT,
33 HEAPMEMMP_CREATE,
34 HEAPMEMMP_DELETE,
35 HEAPMEMMP_OPEN,
36 HEAPMEMMP_OPENBYADDR,
37 HEAPMEMMP_CLOSE,
38 HEAPMEMMP_ALLOC,
39 HEAPMEMMP_FREE,
40 HEAPMEMMP_SHAREDMEMREQ,
41 HEAPMEMMP_GETSTATS,
42 HEAPMEMMP_GETEXTENDEDSTATS,
43 HEAPMEMMP_RESTORE
44};
45
46/*
47 * Command for heapmemmp_get_config
48 */
49#define CMD_HEAPMEMMP_GETCONFIG _IOWR(IPC_IOC_MAGIC, \
50 HEAPMEMMP_GETCONFIG,\
51 struct heapmemmp_cmd_args)
52
53/*
54 * Command for heapmemmp_setup
55 */
56#define CMD_HEAPMEMMP_SETUP _IOWR(IPC_IOC_MAGIC, \
57 HEAPMEMMP_SETUP, \
58 struct heapmemmp_cmd_args)
59/*
60 * Command for heapmemmp_destroy
61 */
62#define CMD_HEAPMEMMP_DESTROY _IOWR(IPC_IOC_MAGIC, \
63 HEAPMEMMP_DESTROY, \
64 struct heapmemmp_cmd_args)
65
66/*
67 * Command for heapmemmp_prams_init
68 */
69#define CMD_HEAPMEMMP_PARAMS_INIT _IOWR(IPC_IOC_MAGIC, \
70 HEAPMEMMP_PARAMS_INIT, \
71 struct heapmemmp_cmd_args)
72
73/*
74 * Command for heapmemmp_create
75 */
76#define CMD_HEAPMEMMP_CREATE _IOWR(IPC_IOC_MAGIC, \
77 HEAPMEMMP_CREATE, \
78 struct heapmemmp_cmd_args)
79
80/*
81 * Command for heapmemmp_delete
82 */
83#define CMD_HEAPMEMMP_DELETE _IOWR(IPC_IOC_MAGIC, \
84 HEAPMEMMP_DELETE, \
85 struct heapmemmp_cmd_args)
86
87/*
88 * Command for heapmemmp_open
89 */
90#define CMD_HEAPMEMMP_OPEN _IOWR(IPC_IOC_MAGIC, \
91 HEAPMEMMP_OPEN, \
92 struct heapmemmp_cmd_args)
93
94/*
95 * Command for heapmemmp_open_by_addr
96 */
97#define CMD_HEAPMEMMP_OPENBYADDR _IOWR(IPC_IOC_MAGIC, \
98 HEAPMEMMP_OPENBYADDR, \
99 struct heapmemmp_cmd_args)
100
101/*
102 * Command for heapmemmp_close
103 */
104#define CMD_HEAPMEMMP_CLOSE _IOWR(IPC_IOC_MAGIC, \
105 HEAPMEMMP_CLOSE, \
106 struct heapmemmp_cmd_args)
107
108/*
109 * Command for heapmemmp_alloc
110 */
111#define CMD_HEAPMEMMP_ALLOC _IOWR(IPC_IOC_MAGIC, \
112 HEAPMEMMP_ALLOC, \
113 struct heapmemmp_cmd_args)
114
115/*
116 * Command for heapmemmp_free
117 */
118#define CMD_HEAPMEMMP_FREE _IOWR(IPC_IOC_MAGIC, \
119 HEAPMEMMP_FREE, \
120 struct heapmemmp_cmd_args)
121
122/*
123 * Command for heapmemmp_shared_mem_req
124 */
125#define CMD_HEAPMEMMP_SHAREDMEMREQ _IOWR(IPC_IOC_MAGIC, \
126 HEAPMEMMP_SHAREDMEMREQ, \
127 struct heapmemmp_cmd_args)
128
129/*
130 * Command for heapmemmp_get_stats
131 */
132#define CMD_HEAPMEMMP_GETSTATS _IOWR(IPC_IOC_MAGIC, \
133 HEAPMEMMP_GETSTATS, \
134 struct heapmemmp_cmd_args)
135
136/*
137 * Command for heapmemmp_get_extended_stats
138 */
139#define CMD_HEAPMEMMP_GETEXTENDEDSTATS _IOWR(IPC_IOC_MAGIC, \
140 HEAPMEMMP_GETEXTENDEDSTATS, \
141 struct heapmemmp_cmd_args)
142
143/*
144 * Command for heapmemmp_restore
145 */
146#define CMD_HEAPMEMMP_RESTORE _IOWR(IPC_IOC_MAGIC, \
147 HEAPMEMMP_RESTORE, \
148 struct heapmemmp_cmd_args)
149
150
151/*
152 * Command arguments for heapmem
153 */
154union heapmemmp_arg {
155 struct {
156 struct heapmemmp_params *params;
157 } params_init;
158
159 struct {
160 struct heapmemmp_config *config;
161 } get_config;
162
163 struct {
164 struct heapmemmp_config *config;
165 } setup;
166
167 struct {
168 void *handle;
169 struct heapmemmp_params *params;
170 u32 name_len;
171 u32 *shared_addr_srptr;
172 u32 *shared_buf_srptr;
173 void *knl_gate;
174 } create;
175
176 struct {
177 void *handle;
178 } delete;
179
180 struct {
181 void *handle;
182 char *name;
183 u32 name_len;
184 } open;
185
186 struct {
187 void *handle;
188 u32 *shared_addr_srptr;
189 } open_by_addr;
190
191 struct {
192 void *handle;
193 } close;
194
195 struct {
196 void *handle;
197 u32 size;
198 u32 align;
199 u32 *block_srptr;
200 } alloc;
201
202 struct {
203 void *handle;
204 u32 *block_srptr;
205 u32 size;
206 } free;
207
208 struct {
209 void *handle;
210 struct memory_stats *stats;
211 } get_stats;
212
213 struct {
214 void *handle;
215 } restore;
216
217 struct {
218 void *handle;
219 struct heapmemmp_extended_stats *stats;
220 } get_extended_stats;
221
222 struct {
223 struct heapmemmp_params *params;
224 u32 *shared_addr_srptr;
225 u32 bytes;
226 } shared_mem_req;
227};
228
229/*
230 * Command arguments for heapmem
231 */
232struct heapmemmp_cmd_args{
233 union heapmemmp_arg args;
234 s32 api_status;
235};
236
237/*
238 * This ioctl interface for heapmem module
239 */
240int heapmemmp_ioctl(struct inode *pinode, struct file *filp,
241 unsigned int cmd, unsigned long args, bool user);
242
243#endif /* _HEAPMEMMP_IOCTL_ */
diff --git a/arch/arm/plat-omap/include/syslink/host_os.h b/arch/arm/plat-omap/include/syslink/host_os.h
new file mode 100644
index 00000000000..2e2164f314f
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/host_os.h
@@ -0,0 +1,72 @@
1
2/*
3 * host_os.h
4 *
5 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6 *
7 * Copyright (C) 2008 Texas Instruments, Inc.
8 *
9 * This package is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 */
17
18
19/*
20 * ======== windows.h ========
21 *
22 *! Revision History
23 *! ================
24 *! 08-Mar-2004 sb Added cacheflush.h to support Dynamic Memory Mapping feature
25 *! 16-Feb-2004 sb Added headers required for consistent_alloc
26 */
27
28#ifndef _HOST_OS_H_
29#define _HOST_OS_H_
30
31#include <generated/autoconf.h>
32#include <asm/system.h>
33#include <asm/atomic.h>
34#include <linux/semaphore.h>
35#include <linux/uaccess.h>
36#include <asm/irq.h>
37#include <linux/io.h>
38#include <linux/syscalls.h>
39#include <linux/version.h>
40#include <linux/kernel.h>
41#include <linux/string.h>
42#include <linux/stddef.h>
43#include <linux/types.h>
44#include <linux/interrupt.h>
45#include <linux/spinlock.h>
46#include <linux/sched.h>
47#include <linux/fs.h>
48#include <linux/file.h>
49#include <linux/slab.h>
50#include <linux/delay.h>
51#include <linux/ctype.h>
52#include <linux/mm.h>
53#include <linux/device.h>
54#include <linux/vmalloc.h>
55#include <linux/ioport.h>
56#include <linux/platform_device.h>
57#include <linux/clk.h>
58#include <linux/pagemap.h>
59#include <asm/cacheflush.h>
60#include <linux/dma-mapping.h>
61
62/* ----------------------------------- Macros */
63
64#define SEEK_SET 0 /* Seek from beginning of file. */
65#define SEEK_CUR 1 /* Seek from current position. */
66#define SEEK_END 2 /* Seek from end of file. */
67
68/* TODO -- Remove, once BP defines them */
69#define INT_MAIL_MPU_IRQ 26
70#define INT_DSP_MMU_IRQ 28
71
72#endif
diff --git a/arch/arm/plat-omap/include/syslink/igatempsupport.h b/arch/arm/plat-omap/include/syslink/igatempsupport.h
new file mode 100644
index 00000000000..b7c42a746a0
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/igatempsupport.h
@@ -0,0 +1,76 @@
1/*
2 * igatempsupport.h
3 *
4 * Interface implemented by all multiprocessor gates.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 *
17 */
18
19#ifndef _IGATEMPSUPPORT_H_
20#define _IGATEMPSUPPORT_H_
21
22
23/* Invalid Igate */
24#define IGATEMPSUPPORT_NULL (void *)0xFFFFFFFF
25
26/* Gates with this "quality" may cause the calling thread to block;
27 * i.e., suspend execution until another thread leaves the gate. */
28#define IGATEMPSUPPORT_Q_BLOCKING 1
29
30/* Gates with this "quality" allow other threads to preempt the thread
31 * that has already entered the gate. */
32#define IGATEMPSUPPORT_Q_PREEMPTING 2
33
34/* Object embedded in other Gate modules. (Inheritance) */
35#define IGATEMPSUPPORT_SUPERPARAMS \
36 u32 resource_id; \
37 bool open_flag; \
38 u16 region_id; \
39 void *shared_addr
40
41/* All other GateMP modules inherit this. */
42#define IGATEMPSUPPORT_INHERIT(X) \
43enum X##_local_protect { \
44 X##_LOCALPROTECT_NONE = 0, \
45 X##_LOCALPROTECT_INTERRUPT = 1, \
46 X##_LOCALPROTECT_TASKLET = 2, \
47 X##_LOCALPROTECT_THREAD = 3, \
48 X##_LOCALPROTECT_PROCESS = 4 \
49};
50
51/* Paramter initializer. */
52#define IGATEMPSUPPORT_PARAMSINTIALIZER(x) \
53 do { \
54 (x)->resource_id = 0; \
55 (x)->open_flag = true; \
56 (x)->region_id = 0; \
57 (x)->shared_addr = NULL; \
58 } while (0)
59
60enum igatempsupport_local_protect {
61 IGATEMPSUPPORT_LOCALPROTECT_NONE = 0,
62 IGATEMPSUPPORT_LOCALPROTECT_INTERRUPT = 1,
63 IGATEMPSUPPORT_LOCALPROTECT_TASKLET = 2,
64 IGATEMPSUPPORT_LOCALPROTECT_THREAD = 3,
65 IGATEMPSUPPORT_LOCALPROTECT_PROCESS = 4
66};
67
68struct igatempsupport_params {
69 u32 resource_id;
70 bool open_flag;
71 u16 region_id;
72 void *shared_addr;
73};
74
75
76#endif /* ifndef __IGATEMPSUPPORT_H__ */
diff --git a/arch/arm/plat-omap/include/syslink/igateprovider.h b/arch/arm/plat-omap/include/syslink/igateprovider.h
new file mode 100644
index 00000000000..c4ac4ab91c9
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/igateprovider.h
@@ -0,0 +1,123 @@
1/*
2 * igateprovider.h
3 *
4 * Interface implemented by all gate providers.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 *
17 */
18/** ============================================================================
19 * Gates are used serialize access to data structures that are used by more
20 * than one thread.
21 *
22 * Gates are responsible for ensuring that only one out of multiple threads
23 * can access a data structure at a time. There
24 * are important scheduling latency and performance considerations that
25 * affect the "type" of gate used to protect each data structure. For
26 * example, the best way to protect a shared counter is to simply disable
27 * all interrupts before the update and restore the interrupt state after
28 * the update; disabling all interrupts prevents all thread switching, so
29 * the update is guaranteed to be "atomic". Although highly efficient, this
30 * method of creating atomic sections causes serious system latencies when
31 * the time required to update the data structure can't be bounded.
32 *
33 * For example, a memory manager's list of free blocks can grow indefinitely
34 * long during periods of high fragmentation. Searching such a list with
35 * interrupts disabled would cause system latencies to also become unbounded.
36 * In this case, the best solution is to provide a gate that suspends the
37 * execution of threads that try to enter a gate that has already been
38 * entered; i.e., the gate "blocks" the thread until the thread
39 * already in the gate leaves. The time required to enter and leave the
40 * gate is greater than simply enabling and restoring interrupts, but since
41 * the time spent within the gate is relatively large, the overhead caused by
42 * entering and leaving gates will not become a significant percentage of
43 * overall system time. More importantly, threads that do not need to
44 * access the shared data structure are completely unaffected by threads
45 * that do access it.
46 * ============================================================================
47 */
48
49
50#ifndef _IGATEPROVIDER_H_
51#define _IGATEPROVIDER_H_
52
53
54/* Invalid Igate */
55#define IGATEPROVIDER_NULL (struct igateprovider_object *)0xFFFFFFFF
56
57/* Gates with this "quality" may cause the calling thread to block;
58 * i.e., suspend execution until another thread leaves the gate. */
59#define IGateProvider_Q_BLOCKING 1
60
61/* Gates with this "quality" allow other threads to preempt the thread
62 * that has already entered the gate. */
63#define IGateProvider_Q_PREEMPTING 2
64
65/* Object embedded in other Gate modules. (Inheritance) */
66#define IGATEPROVIDER_SUPEROBJECT \
67 int *(*enter)(void *); \
68 void (*leave)(void *, int *)
69
70#define IGATEPROVIDER_OBJECTINITIALIZER(x, y) \
71 do { \
72 ((struct igateprovider_object *)(x))->enter = y##_enter; \
73 ((struct igateprovider_object *)(x))->leave = y##_leave; \
74 } while (0)
75
76
77/* Structure for generic gate instance */
78struct igateprovider_object {
79 IGATEPROVIDER_SUPEROBJECT;
80};
81
82
83/*
84 * Enter this gate
85 *
86 * Each gate provider can implement mutual exclusion using different
87 * algorithms; e.g., disabling all scheduling, disabling the scheduling
88 * of all threads below a specified "priority level", suspending the
89 * caller when the gate has been entered by another thread and
90 * re-enabling it when the the other thread leaves the gate. However,
91 * in all cases, after this method returns that caller has exclusive
92 * access to the data protected by this gate.
93 *
94 * A thread may reenter a gate without blocking or failing.
95 */
96static inline int *igateprovider_enter(struct igateprovider_object *handle)
97{
98 int *key = NULL;
99
100 if (handle != IGATEPROVIDER_NULL)
101 key = (handle->enter)((void *)handle);
102 return key;
103}
104
105
106/*
107 * Leave this gate
108 *
109 * This method is only called by threads that have previously entered
110 * this gate via `{@link #enter}`. After this method returns, the
111 * caller must not access the data structure protected by this gate
112 * (unless the caller has entered the gate more than once and other
113 * calls to `leave` remain to balance the number of previous
114 * calls to `enter`).
115 */
116static inline void igateprovider_leave(struct igateprovider_object *handle,
117 int *key)
118{
119 if (handle != IGATEPROVIDER_NULL)
120 (handle->leave)((void *)handle, key);
121}
122
123#endif /* ifndef _IGATEPROVIDER_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/iobject.h b/arch/arm/plat-omap/include/syslink/iobject.h
new file mode 100644
index 00000000000..4d0c1e6c7e0
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/iobject.h
@@ -0,0 +1,176 @@
1/*
2 * iobject.h
3 *
4 * Interface to provide object creation facilities.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18
19#ifndef _IOBJECT_H_
20#define _IOBJECT_H_
21
22/* ObjType */
23enum ipc_obj_type {
24 IPC_OBJTYPE_CREATESTATIC = 0x1,
25 IPC_OBJTYPE_CREATESTATIC_REGION = 0x2,
26 IPC_OBJTYPE_CREATEDYNAMIC = 0x4,
27 IPC_OBJTYPE_CREATEDYNAMIC_REGION = 0x8,
28 IPC_OBJTYPE_OPENDYNAMIC = 0x10,
29 IPC_OBJTYPE_LOCAL = 0x20
30};
31
32
33/* Object embedded in other module's object */
34#define IOBJECT_SUPEROBJECT \
35 void *next; \
36 int status;
37
38/* Generic macro to define a create/delete function for a module */
39#define IOBJECT_CREATE0(MNAME) \
40static struct MNAME##_object *MNAME##_first_object;\
41\
42\
43void *MNAME##_create(const struct MNAME##_params *params)\
44{ \
45 int *key;\
46 struct MNAME##_object *obj = (struct MNAME##_object *)\
47 kmalloc(sizeof(struct MNAME##_object),\
48 GFP_KERNEL);\
49 if (!obj)\
50 return NULL;\
51 memset(obj, 0, sizeof(struct MNAME##_object));\
52 obj->status = MNAME##_instance_init(obj, params);\
53 if (obj->status == 0) { \
54 key = gate_enter_system();\
55 if (MNAME##_first_object == NULL) { \
56 MNAME##_first_object = obj;\
57 obj->next = NULL;\
58 } else { \
59 obj->next = MNAME##_first_object;\
60 MNAME##_first_object = obj;\
61 } \
62 gate_leave_system(key);\
63 } else { \
64 kfree(obj);\
65 obj = NULL;\
66 } \
67 return obj;\
68} \
69\
70\
71int MNAME##_delete(void **handle)\
72{ \
73 int *key;\
74 struct MNAME##_object *temp;\
75 struct MNAME##_object *obj;\
76 \
77 if (handle == NULL) \
78 return -EINVAL;\
79 if (*handle == NULL) \
80 return -EINVAL;\
81 obj = (struct MNAME##_object *)(*handle);\
82 key = gate_enter_system();\
83 if (obj == MNAME##_first_object) \
84 MNAME##_first_object = obj->next;\
85 else { \
86 temp = MNAME##_first_object;\
87 while (temp) { \
88 if (temp->next == obj) { \
89 temp->next = obj->next;\
90 break;\
91 } else { \
92 temp = temp->next;\
93 } \
94 } \
95 if (temp == NULL) { \
96 gate_leave_system(key);\
97 return -EINVAL;\
98 } \
99 } \
100 gate_leave_system(key);\
101 MNAME##_instance_finalize(obj, obj->status);\
102 kfree(obj);\
103 *handle = NULL;\
104 return 0;\
105}
106
107#define IOBJECT_CREATE1(MNAME, ARG) \
108static struct MNAME##_object *MNAME##_first_object;\
109\
110\
111void *MNAME##_create(ARG arg, const struct MNAME##_params *params)\
112{ \
113 int *key;\
114 struct MNAME##_object *obj = (struct MNAME##_object *) \
115 kmalloc(sizeof(struct MNAME##_object),\
116 GFP_KERNEL);\
117 if (!obj) \
118 return NULL;\
119 memset(obj, 0, sizeof(struct MNAME##_object));\
120 obj->status = MNAME##_instance_init(obj, arg, params);\
121 if (obj->status == 0) { \
122 key = gate_enter_system();\
123 if (MNAME##_first_object == NULL) { \
124 MNAME##_first_object = obj;\
125 obj->next = NULL;\
126 } else { \
127 obj->next = MNAME##_first_object;\
128 MNAME##_first_object = obj;\
129 } \
130 gate_leave_system(key);\
131 } else { \
132 kfree(obj);\
133 obj = NULL;\
134 } \
135 return obj;\
136} \
137\
138\
139int MNAME##_delete(void **handle)\
140{ \
141 int *key;\
142 struct MNAME##_object *temp;\
143 struct MNAME##_object *obj;\
144 \
145 if (handle == NULL) \
146 return -EINVAL;\
147 if (*handle == NULL) \
148 return -EINVAL;\
149 obj = (struct MNAME##_object *)(*handle);\
150 key = gate_enter_system();\
151 if (obj == MNAME##_first_object) \
152 MNAME##_first_object = obj->next;\
153 else { \
154 temp = MNAME##_first_object;\
155 while (temp) { \
156 if (temp->next == obj) { \
157 temp->next = obj->next;\
158 break;\
159 } else { \
160 temp = temp->next;\
161 } \
162 } \
163 if (temp == NULL) { \
164 gate_leave_system(key);\
165 return -EINVAL;\
166 } \
167 } \
168 gate_leave_system(key);\
169 MNAME##_instance_finalize(obj, obj->status);\
170 kfree(obj);\
171 *handle = NULL;\
172 return 0;\
173}
174
175
176#endif /* ifndef _IOBJECT_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/ipc.h b/arch/arm/plat-omap/include/syslink/ipc.h
new file mode 100644
index 00000000000..bead3bf54e7
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/ipc.h
@@ -0,0 +1,177 @@
1/*
2 * sysmgr.h
3 *
4 * Defines for System manager.
5 *
6 * Copyright(C) 2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18#ifndef _IPC_H_
19#define _IPC_H_
20
21
22/* Module headers */
23#include <multiproc.h>
24#include <gatepeterson.h>
25#include <sharedregion.h>
26#include <notify.h>
27#include <notify_ducatidriver.h>
28#include <heap.h>
29#include <heapbufmp.h>
30#include <heapmemmp.h>
31
32
33
34/* Unique module ID. */
35#define IPC_MODULEID (0xF086)
36
37
38/* =============================================================================
39 * Module Success and Failure codes
40 * =============================================================================
41 */
42/* The resource is still in use */
43#define IPC_S_BUSY 2
44
45/* The module has been already setup */
46#define IPC_S_ALREADYSETUP 1
47
48/* Operation is successful. */
49#define IPC_S_SUCCESS 0
50
51/* Generic failure. */
52#define IPC_E_FAIL -1
53
54/* Argument passed to function is invalid. */
55#define IPC_E_INVALIDARG -2
56
57/* Operation resulted in memory failure. */
58#define IPC_E_MEMORY -3
59
60/* The specified entity already exists. */
61#define IPC_E_ALREADYEXISTS -4
62
63/* Unable to find the specified entity. */
64#define IPC_E_NOTFOUND -5
65
66/* Operation timed out. */
67#define IPC_E_TIMEOUT -6
68
69/* Module is not initialized. */
70#define IPC_E_INVALIDSTATE -7
71
72/* A failure occurred in an OS-specific call */
73#define IPC_E_OSFAILURE -8
74
75/* Specified resource is not available */
76#define IPC_E_RESOURCE -9
77
78/* Operation was interrupted. Please restart the operation */
79#define IPC_E_RESTART -10
80
81
82/* =============================================================================
83 * Macros
84 * =============================================================================
85 */
86/* IPC_CONTROLCMD_LOADCALLBACK */
87#define IPC_CONTROLCMD_LOADCALLBACK (0xBABE0000)
88
89/* IPC_CONTROLCMD_STARTCALLBACK */
90#define IPC_CONTROLCMD_STARTCALLBACK (0xBABE0001)
91
92/* IPC_CONTROLCMD_STOPCALLBACK */
93#define IPC_CONTROLCMD_STOPCALLBACK (0xBABE0002)
94
95
96/* =============================================================================
97 * Enums & Structures
98 * =============================================================================
99 */
100/* the different options for processor synchronization */
101enum ipc_proc_sync {
102 IPC_PROCSYNC_NONE, /* don't do any processor sync */
103 IPC_PROCSYNC_PAIR, /* sync pair of processors in ipc_attach */
104 IPC_PROCSYNC_ALL /* sync all processors, done in ipc_start */
105};
106
107/* ipc configuration structure. */
108struct ipc_config {
109 enum ipc_proc_sync proc_sync;
110 /* the different options for processor synchronization */
111};
112
113/* ipc configuration structure. */
114struct ipc_params {
115 bool setup_messageq;
116 bool setup_notify;
117 bool setup_ipu_pm;
118 bool slave;
119 enum ipc_proc_sync proc_sync;
120};
121
122/* IPC events. */
123#define IPC_CLOSE 0
124
125/* =============================================================================
126 * APIs
127 * =============================================================================
128 */
129/* Attach to remote processor */
130int ipc_attach(u16 remote_proc_id);
131
132/* Detach from the remote processor */
133int ipc_detach(u16 remote_proc_id);
134
135/* Reads the config entry from the config area. */
136int ipc_read_config(u16 remote_proc_id, u32 tag, void *cfg, u32 size);
137
138/* Reserves memory, creates default gatemp and heapmemmp */
139int ipc_start(void);
140
141/* Writes the config entry to the config area. */
142int ipc_write_config(u16 remote_proc_id, u32 tag, void *cfg, u32 size);
143
144/* Returns default configuration values for ipc. */
145void ipc_get_config(struct ipc_config *cfg_params);
146
147/* Sets up ipc for this processor. */
148int ipc_setup(const struct ipc_config *cfg_params);
149
150/* Destroys ipc for this processor. */
151int ipc_destroy(void);
152
153/* Creates a ipc. */
154int ipc_create(u16 proc_id, struct ipc_params *params);
155
156/* Function to control a Ipc instance for a slave */
157int ipc_control(u16 proc_id, u32 cmd_id, void *arg);
158
159/* Function to read configuration information from ipc module */
160int ipc_read_config(u16 remote_proc_id, u32 tag, void *cfg, u32 size);
161
162/* Function to write configuration information to ipc module */
163int ipc_write_config(u16 remote_proc_id, u32 tag, void *cfg, u32 size);
164
165/* Clears memory, deletes default gatemp and heapmemmp */
166int ipc_stop(void);
167
168/* IPC event notifications. */
169int ipc_notify_event(int event, void *data);
170
171/* Register for IPC events. */
172int ipc_register_notifier(struct notifier_block *nb);
173
174/* Un-register for IPC events. */
175int ipc_unregister_notifier(struct notifier_block *nb);
176
177#endif /* ifndef _IPC_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/ipc_ioctl.h b/arch/arm/plat-omap/include/syslink/ipc_ioctl.h
new file mode 100644
index 00000000000..07ab472ccf0
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/ipc_ioctl.h
@@ -0,0 +1,113 @@
1/*
2 * ipc_ioctl.h
3 *
4 * Base file for all TI OMAP IPC ioctl's.
5 * Linux-OMAP IPC has allocated base 0xEE with a range of 0x00-0xFF.
6 * (need to get the real one from open source maintainers)
7 *
8 * Copyright (C) 2008-2009 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 _IPC_IOCTL_H
21#define _IPC_IOCTL_H
22
23#include <linux/ioctl.h>
24#include <linux/types.h>
25#include <linux/fs.h>
26
27#define IPC_IOC_MAGIC 0xE0
28#define IPC_IOC_BASE 2
29
30enum ipc_command_count {
31 MULTIPROC_CMD_NOS = 4,
32 NAMESERVER_CMD_NOS = 15,
33 HEAPBUFMP_CMD_NOS = 14,
34 SHAREDREGION_CMD_NOS = 13,
35 GATEMP_CMD_NOS = 13,
36 LISTMP_CMD_NOS = 19,
37 MESSAGEQ_CMD_NOS = 18,
38 IPC_CMD_NOS = 5,
39 SYSMEMMGR_CMD_NOS = 6,
40 HEAPMEMMP_CMD_NOS = 15,
41 NOTIFY_CMD_NOS = 18
42};
43
44enum ipc_command_ranges {
45 MULTIPROC_BASE_CMD = IPC_IOC_BASE,
46 MULTIPROC_END_CMD = (MULTIPROC_BASE_CMD + \
47 MULTIPROC_CMD_NOS - 1),
48
49 NAMESERVER_BASE_CMD = 10,
50 NAMESERVER_END_CMD = (NAMESERVER_BASE_CMD + \
51 NAMESERVER_CMD_NOS - 1),
52
53 HEAPBUFMP_BASE_CMD = 30,
54 HEAPBUFMP_END_CMD = (HEAPBUFMP_BASE_CMD + \
55 HEAPBUFMP_CMD_NOS - 1),
56
57 SHAREDREGION_BASE_CMD = 50,
58 SHAREDREGION_END_CMD = (SHAREDREGION_BASE_CMD + \
59 SHAREDREGION_CMD_NOS - 1),
60
61 GATEMP_BASE_CMD = 70,
62 GATEMP_END_CMD = (GATEMP_BASE_CMD + \
63 GATEMP_CMD_NOS - 1),
64
65 LISTMP_BASE_CMD = 90,
66 LISTMP_END_CMD = (LISTMP_BASE_CMD + \
67 LISTMP_CMD_NOS - 1),
68
69 MESSAGEQ_BASE_CMD = 110,
70 MESSAGEQ_END_CMD = (MESSAGEQ_BASE_CMD + \
71 MESSAGEQ_CMD_NOS - 1),
72
73 IPC_BASE_CMD = 130,
74 IPC_END_CMD = (IPC_BASE_CMD + \
75 IPC_CMD_NOS - 1),
76
77 SYSMEMMGR_BASE_CMD = 140,
78 SYSMEMMGR_END_CMD = (SYSMEMMGR_BASE_CMD + \
79 SYSMEMMGR_CMD_NOS - 1),
80
81 HEAPMEMMP_BASE_CMD = 150,
82 HEAPMEMMP_END_CMD = (HEAPMEMMP_BASE_CMD + \
83 HEAPMEMMP_CMD_NOS - 1),
84
85 NOTIFY_BASE_CMD = 170,
86 NOTIFY_END_CMD = (NOTIFY_BASE_CMD + \
87 NOTIFY_CMD_NOS - 1)
88};
89
90struct resource_info {
91 struct list_head res; /* Pointer to res entry */
92 unsigned int cmd; /* command */
93 void *data; /* Some private data */
94};
95
96/* Process Context */
97struct ipc_process_context {
98 /* List of Resources */
99 struct list_head resources;
100 spinlock_t res_lock;
101
102 struct ipc_device *dev;
103};
104
105void add_pr_res(struct ipc_process_context *pr_ctxt, unsigned int cmd,
106 void *data);
107
108void remove_pr_res(struct ipc_process_context *pr_ctxt,
109 struct resource_info *info);
110
111int ipc_ioc_router(u32 cmd, ulong arg, struct file *filp, bool user);
112
113#endif /* _IPC_IOCTL_H */
diff --git a/arch/arm/plat-omap/include/syslink/listmp.h b/arch/arm/plat-omap/include/syslink/listmp.h
new file mode 100644
index 00000000000..31d2429e851
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/listmp.h
@@ -0,0 +1,146 @@
1/*
2 * listmp.h
3 *
4 * The listmp module defines the shared memory doubly linked list.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18#ifndef _LISTMP_H_
19#define _LISTMP_H_
20
21/* Standard headers */
22#include <linux/types.h>
23
24/* Utilities headers */
25#include <linux/list.h>
26/*#include <heap.h>*/
27
28/* =============================================================================
29 * All success and failure codes for the module
30 * =============================================================================
31 */
32/* The resource is still in use */
33#define LISTMP_S_BUSY 2
34
35/* The module has already been setup */
36#define LISTMP_S_ALREADYSETUP 1
37
38/* Operation is successful. */
39#define LISTMP_SUCCESS 0
40
41/* Generic failure. */
42#define LISTMP_E_FAIL -1
43
44/* Argument passed to a function is invalid. */
45#define LISTMP_E_INVALIDARG -2
46
47/* Memory allocation failed. */
48#define LISTMP_E_MEMORY -3
49
50/* The specified entity already exists. */
51#define LISTMP_E_ALREADYEXISTS -4
52
53/* Unable to find the specified entity. */
54#define LISTMP_E_NOTFOUND -5
55
56/* Operation timed out. */
57#define LISTMP_E_TIMEOUT -6
58
59/* Module is not initialized. */
60#define LISTMP_E_INVALIDSTATE -7
61
62/* A failure occurred in an OS-specific call */
63#define LISTMP_E_OSFAILURE -8
64
65/* Specified resource is not available */
66#define LISTMP_E_RESOURCE -9
67
68/* Operation was interrupted. Please restart the operation */
69#define LISTMP_E_RESTART -10
70
71
72/* =============================================================================
73 * Macros and types
74 * =============================================================================
75 */
76#define VOLATILE volatile
77
78/* Structure defining list element for the ListMP. */
79struct listmp_elem {
80 VOLATILE struct listmp_elem *next;
81 VOLATILE struct listmp_elem *prev;
82};
83
84/* Structure defining config parameters for the ListMP instances. */
85struct listmp_params {
86 /* gatemp instance for critical management of shared memory */
87 void *gatemp_handle;
88 void *shared_addr; /* physical address of the shared memory */
89 char *name; /* name of the instance */
90 u16 region_id; /* sharedregion id */
91};
92
93
94/* Function initializes listmp parameters */
95void listmp_params_init(struct listmp_params *params);
96
97/* Function to create an instance of ListMP */
98void *listmp_create(const struct listmp_params *params);
99
100/* Function to delete an instance of ListMP */
101int listmp_delete(void **listmp_handle_ptr);
102
103/* Function to open a previously created instance */
104int listmp_open(char *name, void **listmp_handle_ptr);
105
106/* Function to open a previously created instance */
107int listmp_open_by_addr(void *shared_addr, void **listmp_handle_ptr);
108
109/* Function to close a previously opened instance */
110int listmp_close(void **listmp_handle);
111
112/* Function to check if list is empty */
113bool listmp_empty(void *listmp_handle);
114
115/* Retrieves the GateMP handle associated with the ListMP instance. */
116void *listmp_get_gate(void *listmp_handle);
117
118/* Function to get head element from list */
119void *listmp_get_head(void *listmp_handle);
120
121/* Function to get tail element from list */
122void *listmp_get_tail(void *listmp_handle);
123
124/* Function to insert element into list */
125int listmp_insert(void *listmp_handle, struct listmp_elem *new_elem,
126 struct listmp_elem *cur_elem);
127
128/* Function to traverse to next element in list */
129void *listmp_next(void *listmp_handle, struct listmp_elem *elem);
130
131/* Function to traverse to prev element in list */
132void *listmp_prev(void *listmp_handle, struct listmp_elem *elem);
133
134/* Function to put head element into list */
135int listmp_put_head(void *listmp_handle, struct listmp_elem *elem);
136
137/* Function to put tail element into list */
138int listmp_put_tail(void *listmp_handle, struct listmp_elem *elem);
139
140/* Function to traverse to remove element from list */
141int listmp_remove(void *listmp_handle, struct listmp_elem *elem);
142
143/* Function to get shared memory requirement for the module */
144uint listmp_shared_mem_req(const struct listmp_params *params);
145
146#endif /* _LISTMP_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/listmp_ioctl.h b/arch/arm/plat-omap/include/syslink/listmp_ioctl.h
new file mode 100644
index 00000000000..e4fba2409bc
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/listmp_ioctl.h
@@ -0,0 +1,268 @@
1/*
2 * listmp_ioctl.h
3 *
4 * Definitions of listmp driver types and structures.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18#ifndef _LISTMP_IOCTL_H_
19#define _LISTMP_IOCTL_H_
20
21/* Standard headers */
22#include <linux/types.h>
23
24/* Syslink headers */
25#include <ipc_ioctl.h>
26#include <listmp.h>
27#include <sharedregion.h>
28
29/* =============================================================================
30 * Macros and types
31 * =============================================================================
32 */
33/* Base command ID for listmp */
34#define LISTMP_IOC_MAGIC IPC_IOC_MAGIC
35enum listmp_drv_cmd {
36 LISTMP_GETCONFIG = LISTMP_BASE_CMD,
37 LISTMP_SETUP,
38 LISTMP_DESTROY,
39 LISTMP_PARAMS_INIT,
40 LISTMP_CREATE,
41 LISTMP_DELETE,
42 LISTMP_OPEN,
43 LISTMP_CLOSE,
44 LISTMP_ISEMPTY,
45 LISTMP_GETHEAD,
46 LISTMP_GETTAIL,
47 LISTMP_PUTHEAD,
48 LISTMP_PUTTAIL,
49 LISTMP_INSERT,
50 LISTMP_REMOVE,
51 LISTMP_NEXT,
52 LISTMP_PREV,
53 LISTMP_SHAREDMEMREQ,
54 LISTMP_OPENBYADDR
55};
56
57/* ----------------------------------------------------------------------------
58 * IOCTL command IDs for listmp
59 * ----------------------------------------------------------------------------
60 */
61/* Command for listmp_get_config */
62#define CMD_LISTMP_GETCONFIG _IOWR(LISTMP_IOC_MAGIC, \
63 LISTMP_GETCONFIG, \
64 struct listmp_cmd_args)
65
66/* Command for listmp_setup */
67#define CMD_LISTMP_SETUP _IOWR(LISTMP_IOC_MAGIC, \
68 LISTMP_SETUP, \
69 struct listmp_cmd_args)
70
71/* Command for listmp_destroy */
72#define CMD_LISTMP_DESTROY _IOWR(LISTMP_IOC_MAGIC, \
73 LISTMP_DESTROY, \
74 struct listmp_cmd_args)
75
76/* Command for listmp_params_init */
77#define CMD_LISTMP_PARAMS_INIT _IOWR(LISTMP_IOC_MAGIC, \
78 LISTMP_PARAMS_INIT, \
79 struct listmp_cmd_args)
80
81/* Command for listmp_create */
82#define CMD_LISTMP_CREATE _IOWR(LISTMP_IOC_MAGIC, \
83 LISTMP_CREATE, \
84 struct listmp_cmd_args)
85
86/* Command for listmp_delete */
87#define CMD_LISTMP_DELETE _IOWR(LISTMP_IOC_MAGIC, \
88 LISTMP_DELETE, \
89 struct listmp_cmd_args)
90
91/* Command for listmp_open */
92#define CMD_LISTMP_OPEN _IOWR(LISTMP_IOC_MAGIC, \
93 LISTMP_OPEN, \
94 struct listmp_cmd_args)
95
96/* Command for listmp_close */
97#define CMD_LISTMP_CLOSE _IOWR(LISTMP_IOC_MAGIC, \
98 LISTMP_CLOSE, \
99 struct listmp_cmd_args)
100
101/* Command for listmp_is_empty */
102#define CMD_LISTMP_ISEMPTY _IOWR(LISTMP_IOC_MAGIC, \
103 LISTMP_ISEMPTY, \
104 struct listmp_cmd_args)
105
106/* Command for listmp_get_head */
107#define CMD_LISTMP_GETHEAD _IOWR(LISTMP_IOC_MAGIC, \
108 LISTMP_GETHEAD, \
109 struct listmp_cmd_args)
110
111/* Command for listmp_get_tail */
112#define CMD_LISTMP_GETTAIL _IOWR(LISTMP_IOC_MAGIC, \
113 LISTMP_GETTAIL, \
114 struct listmp_cmd_args)
115
116/* Command for listmp_put_head */
117#define CMD_LISTMP_PUTHEAD _IOWR(LISTMP_IOC_MAGIC, \
118 LISTMP_PUTHEAD, \
119 struct listmp_cmd_args)
120
121/* Command for listmp_put_tail */
122#define CMD_LISTMP_PUTTAIL _IOWR(LISTMP_IOC_MAGIC, \
123 LISTMP_PUTTAIL, \
124 struct listmp_cmd_args)
125
126/* Command for listmp_insert */
127#define CMD_LISTMP_INSERT _IOWR(LISTMP_IOC_MAGIC, \
128 LISTMP_INSERT, \
129 struct listmp_cmd_args)
130
131/* Command for listmp_remove */
132#define CMD_LISTMP_REMOVE _IOWR(LISTMP_IOC_MAGIC, \
133 LISTMP_REMOVE, \
134 struct listmp_cmd_args)
135
136/* Command for listmp_next */
137#define CMD_LISTMP_NEXT _IOWR(LISTMP_IOC_MAGIC, \
138 LISTMP_NEXT, \
139 struct listmp_cmd_args)
140
141/* Command for listmp_prev */
142#define CMD_LISTMP_PREV _IOWR(LISTMP_IOC_MAGIC, \
143 LISTMP_PREV, \
144 struct listmp_cmd_args)
145
146/* Command for listmp_shared_mem_req */
147#define CMD_LISTMP_SHAREDMEMREQ _IOWR(LISTMP_IOC_MAGIC, \
148 LISTMP_SHAREDMEMREQ, \
149 struct listmp_cmd_args)
150
151/* Command for listmp_open_by_addr */
152#define CMD_LISTMP_OPENBYADDR _IOWR(LISTMP_IOC_MAGIC, \
153 LISTMP_OPENBYADDR, \
154 struct listmp_cmd_args)
155
156/* Command arguments for listmp */
157struct listmp_cmd_args {
158 union {
159 struct {
160 struct listmp_params *params;
161 } params_init;
162
163 struct {
164 struct listmp_config *config;
165 } get_config;
166
167 struct {
168 struct listmp_config *config;
169 } setup;
170
171 struct {
172 void *listmp_handle;
173 struct listmp_params *params;
174 u32 name_len;
175 u32 shared_addr_srptr;
176 void *knl_gate;
177 } create;
178
179 struct {
180 void *listmp_handle;
181 } delete_instance;
182
183 struct {
184 void *listmp_handle;
185 u32 name_len;
186 char *name;
187 } open;
188
189 struct {
190 void *listmp_handle;
191 u32 shared_addr_srptr;
192 } open_by_addr;
193
194
195 struct {
196 void *listmp_handle;
197 } close;
198
199 struct {
200 void *listmp_handle;
201 bool is_empty;
202 } is_empty;
203
204 struct {
205 void *listmp_handle;
206 u32 *elem_srptr;
207 } get_head;
208
209 struct {
210 void *listmp_handle;
211 u32 *elem_srptr;
212 } get_tail;
213
214 struct {
215 void *listmp_handle;
216 u32 *elem_srptr;
217 } put_head;
218
219 struct {
220 void *listmp_handle;
221 u32 *elem_srptr;
222 } put_tail;
223
224 struct {
225 void *listmp_handle;
226 u32 *new_elem_srptr;
227 u32 *cur_elem_srptr;
228 } insert;
229
230 struct {
231 void *listmp_handle;
232 u32 *elem_srptr;
233 } remove;
234
235 struct {
236 void *listmp_handle;
237 u32 *elem_srptr;
238 u32 *next_elem_srptr;
239 } next;
240
241 struct {
242 void *listmp_handle;
243 u32 *elem_srptr;
244 u32 *prev_elem_srptr;
245 } prev;
246
247 struct {
248 struct listmp_params *params;
249 u32 bytes;
250 void *knl_gate;
251 u32 *shared_addr_srptr;
252 u32 name_len;
253 void *listmp_handle;
254 } shared_mem_req;
255 } args;
256
257 int api_status;
258};
259
260/* ----------------------------------------------------------------------------
261 * IOCTL functions for listmp module
262 * ----------------------------------------------------------------------------
263 */
264/* ioctl interface function for listmp */
265int listmp_ioctl(struct inode *inode, struct file *filp,
266 unsigned int cmd, unsigned long args, bool user);
267
268#endif /* _LISTMP_IOCTL_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/messageq.h b/arch/arm/plat-omap/include/syslink/messageq.h
new file mode 100644
index 00000000000..d0d59970a49
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/messageq.h
@@ -0,0 +1,440 @@
1/*
2 * messageq.h
3 *
4 * The MessageQ module supports the structured sending and receiving of
5 * variable length messages. This module can be used for homogeneous or
6 * heterogeneous multi-processor messaging.
7 *
8 * Copyright (C) 2009 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 _MESSAGEQ_H_
21#define _MESSAGEQ_H_
22
23/* Standard headers */
24#include <linux/types.h>
25
26/* Utilities headers */
27#include <linux/list.h>
28
29/* Syslink headers */
30#include <listmp.h>
31
32/*!
33 * @def MESSAGEQ_MODULEID
34 * @brief Unique module ID.
35 */
36#define MESSAGEQ_MODULEID (0xded2)
37
38
39/* =============================================================================
40 * All success and failure codes for the module
41 * =============================================================================
42 */
43
44/*!
45 * @def MESSAGEQ_S_BUSY
46 * @brief The resource is still in use
47 */
48#define MESSAGEQ_S_BUSY 2
49
50/*!
51 * @def MESSAGEQ_S_ALREADYSETUP
52 * @brief The module has been already setup
53 */
54#define MESSAGEQ_S_ALREADYSETUP 1
55
56/*!
57 * @def MESSAGEQ_S_SUCCESS
58 * @brief Operation is successful.
59 */
60#define MESSAGEQ_S_SUCCESS 0
61
62/*!
63 * @def MESSAGEQ_E_FAIL
64 * @brief Operation is not successful.
65 */
66#define MESSAGEQ_E_FAIL -1
67
68/*!
69 * @def MESSAGEQ_E_INVALIDARG
70 * @brief There is an invalid argument.
71 */
72#define MESSAGEQ_E_INVALIDARG -2
73
74/*!
75 * @def MESSAGEQ_E_MEMORY
76 * @brief Operation resulted in memory failure.
77 */
78#define MESSAGEQ_E_MEMORY -3
79
80/*!
81 * @def MESSAGEQ_E_ALREADYEXISTS
82 * @brief The specified entity already exists.
83 */
84#define MESSAGEQ_E_ALREADYEXISTS -4
85
86/*!
87 * @def MESSAGEQ_E_NOTFOUND
88 * @brief Unable to find the specified entity.
89 */
90#define MESSAGEQ_E_NOTFOUND -5
91
92/*!
93 * @def MESSAGEQ_E_TIMEOUT
94 * @brief Operation timed out.
95 */
96#define MESSAGEQ_E_TIMEOUT -6
97
98/*!
99 * @def MESSAGEQ_E_INVALIDSTATE
100 * @brief Module is not initialized.
101 */
102#define MESSAGEQ_E_INVALIDSTATE -7
103
104/*!
105 * @def MESSAGEQ_E_OSFAILURE
106 * @brief A failure occurred in an OS-specific call
107 */
108#define MESSAGEQ_E_OSFAILURE -8
109
110/*!
111 * @def MESSAGEQ_E_RESOURCE
112 * @brief Specified resource is not available
113 */
114#define MESSAGEQ_E_RESOURCE -9
115
116/*!
117 * @def MESSAGEQ_E_RESTART
118 * @brief Operation was interrupted. Please restart the operation
119 */
120#define MESSAGEQ_E_RESTART -10
121
122/*!
123 * @def MESSAGEQ_E_INVALIDMSG
124 * @brief Operation is successful.
125 */
126#define MESSAGEQ_E_INVALIDMSG -11
127
128/*!
129 * @def MESSAGEQ_E_NOTOWNER
130 * @brief Not the owner
131 */
132#define MESSAGEQ_E_NOTOWNER -12
133
134/*!
135 * @def MESSAGEQ_E_REMOTEACTIVE
136 * @brief Operation is successful.
137 */
138#define MESSAGEQ_E_REMOTEACTIVE -13
139
140/*!
141 * @def MESSAGEQ_E_INVALIDHEAPID
142 * @brief Operation is successful.
143 */
144#define MESSAGEQ_E_INVALIDHEAPID -14
145
146/*!
147 * @def MESSAGEQ_E_INVALIDPROCID
148 * @brief Operation is successful.
149 */
150#define MESSAGEQ_E_INVALIDPROCID -15
151
152/*!
153 * @def MESSAGEQ_E_MAXREACHED
154 * @brief Operation is successful.
155 */
156#define MESSAGEQ_E_MAXREACHED -16
157
158/*!
159 * @def MESSAGEQ_E_UNREGISTEREDHEAPID
160 * @brief Operation is successful.
161 */
162#define MESSAGEQ_E_UNREGISTEREDHEAPID -17
163
164/*!
165 * @def MESSAGEQ_E_CANNOTFREESTATICMSG
166 * @brief Operation is successful.
167 */
168#define MESSAGEQ_E_CANNOTFREESTATICMSG -18
169
170
171/* =============================================================================
172 * Macros and types
173 * =============================================================================
174 */
175/*!
176 * @brief Mask to extract version setting
177 */
178#define MESSAGEQ_HEADERVERSION 0x2000u
179
180/*! Mask to extract Trace setting */
181#define MESSAGEQ_TRACEMASK (uint) 0x1000
182
183/*! Shift for Trace setting */
184#define MESSAGEQ_TRACESHIFT (uint) 12
185
186/*!
187 * @brief Mask to extract priority setting
188 */
189#define MESSAGEQ_PRIORITYMASK 0x3u
190
191/*!
192 * Used as the timeout value to specify wait forever
193 */
194#define MESSAGEQ_FOREVER (~((u32) 0))
195
196/*!
197 * Invalid message id
198 */
199#define MESSAGEQ_INVALIDMSGID 0xFFFF
200
201/*!
202 * Invalid message queue
203 */
204#define MESSAGEQ_INVALIDMESSAGEQ 0xFFFF
205
206/*!
207 * Indicates that if maximum number of message queues are already created,
208 * should allow growth to create additional Message Queue.
209 */
210#define MESSAGEQ_ALLOWGROWTH (~((u32) 0))
211
212/*!
213 * Number of types of priority queues for each transport
214 */
215#define MESSAGEQ_NUM_PRIORITY_QUEUES 2
216
217
218/* =============================================================================
219 * Structures & Enums
220 * =============================================================================
221 */
222/*!
223 * Message priority
224 */
225enum messageq_priority {
226 MESSAGEQ_NORMALPRI = 0,
227 /*!< Normal priority message */
228 MESSAGEQ_HIGHPRI = 1,
229 /*!< High priority message */
230 MESSAGEQ_RESERVEDPRI = 2,
231 /*!< Reserved value for message priority */
232 MESSAGEQ_URGENTPRI = 3
233 /*!< Urgent priority message */
234};
235
236/*! Structure which defines the first field in every message */
237struct msgheader {
238 u32 reserved0;
239 /*!< Reserved field */
240 u32 reserved1;
241 /*!< Reserved field */
242 u32 msg_size;
243 /*!< Size of the message (including header) */
244 u16 flags;
245 /*!< Flags */
246 u16 msg_id;
247 /*!< Maximum length for Message queue names */
248 u16 dst_id;
249 /*!< Maximum length for Message queue names */
250 u16 dst_proc;
251 /*!< Maximum length for Message queue names */
252 u16 reply_id;
253 /*!< Maximum length for Message queue names */
254 u16 reply_proc;
255 /*!< Maximum length for Message queue names */
256 u16 src_proc;
257 /*!< Maximum length for Message queue names */
258 u16 heap_id;
259 /*!< Maximum length for Message queue names */
260 u16 seq_num;
261 /*!< sequence number */
262 u32 reserved;
263 /*!< Reserved field */
264};
265
266/*! Structure which defines the first field in every message */
267#define messageq_msg struct msgheader *
268/*typedef struct msgheader *messageq_msg;*/
269
270
271/*!
272 * @brief Structure defining config parameters for the MessageQ Buf module.
273 */
274struct messageq_config {
275 bool trace_flag;
276 /*!< Trace Flag
277 * This flag allows the configuration of the default module trace
278 * settings.
279 */
280
281 u16 num_heaps;
282 /*!< Number of heapIds in the system
283 * This allows MessageQ to pre-allocate the heaps table.
284 * The heaps table is used when registering heaps.
285 * The default is 1 since generally all systems need at least one heap.
286 * There is no default heap, so unless the system is only using
287 * staticMsgInit, the application must register a heap.
288 */
289
290 u32 max_runtime_entries;
291 /*!
292 * Maximum number of MessageQs that can be dynamically created
293 */
294
295 u32 max_name_len;
296 /*!< Maximum length for Message queue names */
297};
298
299struct messageq_params {
300 void *synchronizer;
301 /*!< Synchronizer instance used to signal IO completion
302 *
303 * The synchronizer is used in the #MessageQ_put and #MessageQ_get calls.
304 * The synchronizer signal is called as part of the #MessageQ_put call.
305 * The synchronizer waits in the #MessageQ_get if there are no messages
306 * present.
307 */
308};
309
310/* =============================================================================
311 * APIs
312 * =============================================================================
313 */
314/* Functions to get the configuration for messageq setup */
315void messageq_get_config(struct messageq_config *cfg);
316
317/* Function to setup the MessageQ module. */
318int messageq_setup(const struct messageq_config *cfg);
319
320/* Function to destroy the MessageQ module. */
321int messageq_destroy(void);
322
323/* Returns the amount of shared memory used by one transport instance.
324 *
325 * The MessageQ module itself does not use any shared memory but the
326 * underlying transport may use some shared memory.
327 */
328uint messageq_shared_mem_req(void *shared_addr);
329
330/* Calls the SetupProxy function to setup the MessageQ transports. */
331int messageq_attach(u16 remote_proc_id, void *shared_addr);
332
333/* Calls the SetupProxy function to detach the MessageQ transports. */
334int messageq_detach(u16 remote_proc_id);
335
336/* Initialize this config-params structure with supplier-specified
337 * defaults before instance creation.
338 */
339void messageq_params_init(struct messageq_params *params);
340
341/* Create a message queue */
342void *messageq_create(char *name, const struct messageq_params *params);
343
344/* Deletes a instance of MessageQ module. */
345int messageq_delete(void **messageq_handleptr);
346
347/* Open a message queue */
348int messageq_open(char *name, u32 *queue_id);
349
350/* Close an opened message queue handle */
351int messageq_close(u32 *queue_id);
352
353/* Allocates a message from the heap */
354messageq_msg messageq_alloc(u16 heapId, u32 size);
355
356/* Frees a message back to the heap */
357int messageq_free(messageq_msg msg);
358
359/* Initializes a message not obtained from MessageQ_alloc */
360void messageq_static_msg_init(messageq_msg msg, u32 size);
361
362/* Place a message onto a message queue */
363int messageq_put(u32 queueId, messageq_msg msg);
364
365/* Gets a message for a message queue and blocks if the queue is empty */
366int messageq_get(void *messageq_handle, messageq_msg *msg, u32 timeout);
367
368/* Register a heap with MessageQ */
369int messageq_register_heap(void *heap_handle, u16 heap_id);
370
371/* Unregister a heap with MessageQ */
372int messageq_unregister_heap(u16 heapId);
373
374/* Returns the number of messages in a message queue */
375int messageq_count(void *messageq_handle);
376
377/* Get the proc Id of the message. */
378u16 messageq_get_proc_id(void *messageq_handle);
379
380/* Get the queue Id of the message. */
381u32 messageq_get_queue_id(void *messageq_handle);
382
383/* Set the destination queue of the message. */
384void messageq_set_reply_queue(void *messageq_handle, messageq_msg msg);
385
386/* Set the tracing of a message */
387void messageq_set_msg_trace(messageq_msg msg, bool trace_flag);
388
389/*
390 * Functions to set Message properties
391 */
392/*!
393 * @brief Returns the MessageQ_Queue handle of the destination
394 * message queue for the specified message.
395 */
396u32 messageq_get_dst_queue(messageq_msg msg);
397
398/*!
399 * @brief Returns the message ID of the specified message.
400 */
401u16 messageq_get_msg_id(messageq_msg msg);
402
403/*!
404 * @brief Returns the size of the specified message.
405 */
406u32 messageq_get_msg_size(messageq_msg msg);
407
408/*!
409 * @brief Gets the message priority of a message
410 */
411u32 messageq_get_msg_pri(messageq_msg msg);
412
413/*!
414 * @brief Returns the MessageQ_Queue handle of the destination
415 * message queue for the specified message.
416 */
417u32 messageq_get_reply_queue(messageq_msg msg);
418
419/*!
420 * @brief Sets the message ID in the specified message.
421 */
422void messageq_set_msg_id(messageq_msg msg, u16 msg_id);
423/*!
424 * @brief Sets the message priority in the specified message.
425 */
426void messageq_set_msg_pri(messageq_msg msg, u32 priority);
427
428/* =============================================================================
429 * APIs called internally by MessageQ transports
430 * =============================================================================
431 */
432/* Register a transport with MessageQ */
433int messageq_register_transport(void *imessageq_transport_handle,
434 u16 proc_id, u32 priority);
435
436/* Unregister a transport with MessageQ */
437void messageq_unregister_transport(u16 proc_id, u32 priority);
438
439
440#endif /* _MESSAGEQ_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/messageq_ioctl.h b/arch/arm/plat-omap/include/syslink/messageq_ioctl.h
new file mode 100644
index 00000000000..96d4aa7221e
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/messageq_ioctl.h
@@ -0,0 +1,255 @@
1/*
2 * messageq_ioctl.h
3 *
4 * Definitions of messageq driver types and structures.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18#ifndef _MESSAGEQ_IOCTL_H_
19#define _MESSAGEQ_IOCTL_H_
20
21/* Standard headers */
22#include <linux/types.h>
23
24/* Syslink headers */
25#include <ipc_ioctl.h>
26#include <messageq.h>
27#include <heap.h>
28#include <sharedregion.h>
29
30/* =============================================================================
31 * Macros and types
32 * =============================================================================
33 */
34#define MESSAGEQ_IOC_MAGIC IPC_IOC_MAGIC
35enum messageq_drv_cmd {
36 MESSAGEQ_GETCONFIG = MESSAGEQ_BASE_CMD,
37 MESSAGEQ_SETUP,
38 MESSAGEQ_DESTROY,
39 MESSAGEQ_PARAMS_INIT,
40 MESSAGEQ_CREATE,
41 MESSAGEQ_DELETE,
42 MESSAGEQ_OPEN,
43 MESSAGEQ_CLOSE,
44 MESSAGEQ_COUNT,
45 MESSAGEQ_ALLOC,
46 MESSAGEQ_FREE,
47 MESSAGEQ_PUT,
48 MESSAGEQ_REGISTERHEAP,
49 MESSAGEQ_UNREGISTERHEAP,
50 MESSAGEQ_ATTACH,
51 MESSAGEQ_DETACH,
52 MESSAGEQ_GET,
53 MESSAGEQ_SHAREDMEMREQ
54};
55
56/* ----------------------------------------------------------------------------
57 * IOCTL command IDs for messageq
58 * ----------------------------------------------------------------------------
59 */
60/* Base command ID for messageq */
61#define MESSAGEQ_BASE_CMD 0x0
62
63/* Command for messageq_get_config */
64#define CMD_MESSAGEQ_GETCONFIG \
65 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_GETCONFIG, \
66 struct messageq_cmd_args)
67
68/* Command for messageq_setup */
69#define CMD_MESSAGEQ_SETUP \
70 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_SETUP, \
71 struct messageq_cmd_args)
72
73/* Command for messageq_destroy */
74#define CMD_MESSAGEQ_DESTROY \
75 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_DESTROY, \
76 struct messageq_cmd_args)
77
78/* Command for messageq_params_init */
79#define CMD_MESSAGEQ_PARAMS_INIT \
80 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_PARAMS_INIT, \
81 struct messageq_cmd_args)
82
83/* Command for messageq_create */
84#define CMD_MESSAGEQ_CREATE \
85 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_CREATE, \
86 struct messageq_cmd_args)
87
88/* Command for messageq_delete */
89#define CMD_MESSAGEQ_DELETE \
90 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_DELETE, \
91 struct messageq_cmd_args)
92
93/* Command for messageq_open */
94#define CMD_MESSAGEQ_OPEN \
95 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_OPEN, \
96 struct messageq_cmd_args)
97
98/* Command for messageq_close */
99#define CMD_MESSAGEQ_CLOSE \
100 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_CLOSE, \
101 struct messageq_cmd_args)
102
103/* Command for messageq_count */
104#define CMD_MESSAGEQ_COUNT \
105 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_COUNT, \
106 struct messageq_cmd_args)
107
108/* Command for messageq_alloc */
109#define CMD_MESSAGEQ_ALLOC \
110 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_ALLOC, \
111 struct messageq_cmd_args)
112
113/* Command for messageq_free */
114#define CMD_MESSAGEQ_FREE \
115 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_FREE, \
116 struct messageq_cmd_args)
117
118/* Command for messageq_put */
119#define CMD_MESSAGEQ_PUT \
120 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_PUT, \
121 struct messageq_cmd_args)
122
123/* Command for messageq_register_heap */
124#define CMD_MESSAGEQ_REGISTERHEAP \
125 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_REGISTERHEAP, \
126 struct messageq_cmd_args)
127
128/* Command for messageq_unregister_heap */
129#define CMD_MESSAGEQ_UNREGISTERHEAP \
130 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_UNREGISTERHEAP, \
131 struct messageq_cmd_args)
132
133
134/* Command for messageq_attach */
135#define CMD_MESSAGEQ_ATTACH \
136 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_ATTACH, \
137 struct messageq_cmd_args)
138
139/* Command for messageq_detach */
140#define CMD_MESSAGEQ_DETACH \
141 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_DETACH, \
142 struct messageq_cmd_args)
143
144/* Command for messageq_get */
145#define CMD_MESSAGEQ_GET \
146 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_GET, \
147 struct messageq_cmd_args)
148
149/* Command for messageq_sharedmem_req */
150#define CMD_MESSAGEQ_SHAREDMEMREQ \
151 _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_SHAREDMEMREQ, \
152 struct messageq_cmd_args)
153
154/* Command arguments for messageq */
155struct messageq_cmd_args {
156 union {
157 struct {
158 void *messageq_handle;
159 struct messageq_params *params;
160 } params_init;
161
162 struct {
163 struct messageq_config *config;
164 } get_config;
165
166 struct {
167 struct messageq_config *config;
168 } setup;
169
170 struct {
171 void *messageq_handle;
172 char *name;
173 struct messageq_params *params;
174 u32 name_len;
175 u32 queue_id;
176 } create;
177
178 struct {
179 void *messageq_handle;
180 } delete_messageq;
181
182 struct {
183 char *name;
184 u32 queue_id;
185 u32 name_len;
186 } open;
187
188 struct {
189 u32 queue_id;
190 } close;
191
192 struct {
193 void *messageq_handle;
194 u32 timeout;
195 u32 *msg_srptr;
196 } get;
197
198 struct {
199 void *messageq_handle;
200 int count;
201 } count;
202
203 struct {
204 u16 heap_id;
205 u32 size;
206 u32 *msg_srptr;
207 } alloc;
208
209 struct {
210 u32 *msg_srptr;
211 } free;
212
213 struct {
214 u32 queue_id;
215 u32 *msg_srptr;
216 } put;
217
218 struct {
219 void *heap_handle;
220 u16 heap_id;
221 } register_heap;
222
223 struct {
224 u16 heap_id;
225 } unregister_heap;
226
227 struct {
228 u32 *shared_addr_srptr;
229 uint mem_req;
230 } shared_mem_req;
231
232 struct {
233 u16 remote_proc_id;
234 u32 *shared_addr_srptr;
235 } attach;
236
237 struct {
238 u16 remote_proc_id;
239 } detach;
240 } args;
241
242 int api_status;
243};
244
245/* ----------------------------------------------------------------------------
246 * IOCTL functions for messageq module
247 * ----------------------------------------------------------------------------
248 */
249/*
250 * ioctl interface function for messageq
251 */
252int messageq_ioctl(struct inode *inode, struct file *filp,
253 unsigned int cmd, unsigned long args, bool user);
254
255#endif /* _MESSAGEQ_IOCTL_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/multiproc.h b/arch/arm/plat-omap/include/syslink/multiproc.h
new file mode 100644
index 00000000000..4d14e8c193c
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/multiproc.h
@@ -0,0 +1,89 @@
1/*
2* multiproc.h
3*
4* Many multi-processor modules have the concept of processor id. multiproc
5* centeralizes the processor id management.
6*
7* Copyright (C) 2008-2009 Texas Instruments, Inc.
8*
9* This package is free software; you can redistribute it and/or modify
10* it under the terms of the GNU General Public License version 2 as
11* published by the Free Software Foundation.
12*
13* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
16* PURPOSE.
17*/
18
19#ifndef _MULTIPROC_H_
20#define _MULTIPROC_H_
21
22#include <linux/types.h>
23
24
25#define VOLATILE volatile
26
27/*
28 * Unique module ID
29 */
30#define MULTIPROC_MODULEID (u16)0xB522
31
32/* Macro to define invalid processor id */
33#define MULTIPROC_INVALIDID ((u16)0xFFFF)
34
35/*
36 * Maximum number of processors in the system
37 * OMAP4 has 4 processors in single core.
38 */
39#define MULTIPROC_MAXPROCESSORS 4
40
41/*
42 * Max name length for a processor name
43 */
44#define MULTIPROC_MAXNAMELENGTH 32
45
46/*
47 * Configuration structure for multiproc module
48 */
49struct multiproc_config {
50 s32 num_processors; /* Number of procs for particular system */
51 char name_list[MULTIPROC_MAXPROCESSORS][MULTIPROC_MAXNAMELENGTH];
52 /* Name List for processors in the system */
53 u16 id; /* Local Proc ID. This needs to be set before calling any
54 other APIs */
55};
56
57/* =============================================================================
58 * APIs
59 * =============================================================================
60 */
61
62/* Function to get the default configuration for the multiproc module. */
63void multiproc_get_config(struct multiproc_config *cfg);
64
65/* Function to setup the multiproc Module */
66s32 multiproc_setup(struct multiproc_config *cfg);
67
68/* Function to destroy the multiproc module */
69s32 multiproc_destroy(void);
70
71/* Function to set local processor Id */
72int multiproc_set_local_id(u16 proc_id);
73
74/* Function to get processor id from processor name. */
75u16 multiproc_get_id(const char *proc_name);
76
77/* Function to get name from processor id. */
78char *multiproc_get_name(u16 proc_id);
79
80/* Function to get number of processors in the system. */
81u16 multiproc_get_num_processors(void);
82
83/* Return Id of current processor */
84u16 multiproc_self(void);
85
86/* Determines the offset for any two processors. */
87u32 multiproc_get_slot(u16 remote_proc_id);
88
89#endif /* _MULTIPROC_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/multiproc_ioctl.h b/arch/arm/plat-omap/include/syslink/multiproc_ioctl.h
new file mode 100644
index 00000000000..f641f22d13d
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/multiproc_ioctl.h
@@ -0,0 +1,94 @@
1/*
2* multiproc_ioctl.h
3*
4* This provides the ioctl interface for multiproc module
5*
6* Copyright (C) 2008-2009 Texas Instruments, Inc.
7*
8* This package is free software; you can redistribute it and/or modify
9* it under the terms of the GNU General Public License version 2 as
10* published by the Free Software Foundation.
11*
12* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15* PURPOSE.
16*/
17
18#ifndef _MULTIPROC_IOCTL_H_
19#define _MULTIPROC_IOCTL_H_
20
21#include <linux/ioctl.h>
22#include <linux/types.h>
23
24#include <ipc_ioctl.h>
25#include <multiproc.h>
26
27enum CMD_MULTIPROC {
28 MULTIPROC_SETUP = MULTIPROC_BASE_CMD,
29 MULTIPROC_DESTROY,
30 MULTIPROC_GETCONFIG,
31 MULTIPROC_SETLOCALID
32};
33
34/* ----------------------------------------------------------------------------
35 * IOCTL command IDs for MultiProc
36 * ----------------------------------------------------------------------------
37 */
38
39/*
40 * Command for multiproc_setup
41 */
42#define CMD_MULTIPROC_SETUP _IOWR(IPC_IOC_MAGIC, MULTIPROC_SETUP, \
43 struct multiproc_cmd_args)
44
45/*
46 * Command for multiproc_destroy
47 */
48#define CMD_MULTIPROC_DESTROY _IOWR(IPC_IOC_MAGIC, MULTIPROC_DESTROY, \
49 struct multiproc_cmd_args)
50
51/*
52 * Command for multiproc_get_config
53 */
54#define CMD_MULTIPROC_GETCONFIG _IOWR(IPC_IOC_MAGIC, MULTIPROC_GETCONFIG, \
55 struct multiproc_cmd_args)
56
57/*
58 * Command for multiproc_set_local_id
59 */
60#define CMD_MULTIPROC_SETLOCALID _IOWR(IPC_IOC_MAGIC, MULTIPROC_SETLOCALID, \
61 struct multiproc_cmd_args)
62
63/*
64 * Command arguments for multiproc
65 */
66union multiproc_arg {
67 struct {
68 struct multiproc_config *config;
69 } get_config;
70
71 struct {
72 struct multiproc_config *config;
73 } setup;
74
75 struct {
76 u16 id;
77 } set_local_id;
78};
79
80/*
81 * Command arguments for multiproc
82 */
83struct multiproc_cmd_args {
84 union multiproc_arg args;
85 s32 api_status;
86};
87
88/*
89 * This ioctl interface for multiproc module
90 */
91int multiproc_ioctl(struct inode *inode, struct file *filp,
92 unsigned int cmd, unsigned long args, bool user);
93
94#endif /* _MULTIPROC_IOCTL_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/nameserver.h b/arch/arm/plat-omap/include/syslink/nameserver.h
new file mode 100644
index 00000000000..3aeee242bc3
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/nameserver.h
@@ -0,0 +1,157 @@
1/*
2 * nameserver.h
3 *
4 * The nameserver module manages local name/value pairs that
5 * enables an application and other modules to store and retrieve
6 * values based on a name.
7 *
8 * Copyright (C) 2008-2009 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 _NAMESERVER_H_
21#define _NAMESERVER_H_
22
23#include <linux/types.h>
24#include <linux/list.h>
25
26/*
27 * NAMESERVER_MODULEID
28 * Unique module ID
29 */
30#define NAMESERVER_MODULEID (0xF414)
31
32struct nameserver_config {
33 u32 reserved;
34};
35
36/*
37 * Instance config-params object.
38 */
39struct nameserver_params {
40 u32 max_runtime_entries;
41 void *table_heap; /* Table is placed into a section on dyn creates */
42 bool check_existing; /* Prevents duplicate entry add in to the table */
43 u32 max_value_len; /* Length, in MAUs, of the value field */
44 u16 max_name_len; /* Length, in MAUs, of name field */
45};
46
47
48/*
49 * Function to get the default configuration for the nameserver module
50 */
51void nameserver_get_config(struct nameserver_config *cfg);
52
53/*
54 * Function to setup the nameserver module
55 */
56int nameserver_setup(void);
57
58/*
59 * Function to destroy the nameserver module
60 */
61int nameserver_destroy(void);
62
63/*
64 * Function to construct a name server.
65 */
66void nameserver_construct(void *object, const char *name,
67 const struct nameserver_params *params);
68
69/*
70 * Function to destruct a name server
71 */
72void nameserver_destruct(void *object);
73
74/*
75 * Function to register a remote driver
76 */
77int nameserver_register_remote_driver(void *handle, u16 proc_id);
78
79/*
80 * Function to unregister a remote driver
81 */
82int nameserver_unregister_remote_driver(u16 proc_id);
83
84/*
85 * Determines if a remote driver is registered for the specified id.
86 */
87bool nameserver_is_registered(u16 proc_id);
88
89/*
90 * Function to initialize the parameter structure
91 */
92void nameserver_params_init(struct nameserver_params *params);
93
94/*
95 * Function to create a name server
96 */
97void *nameserver_create(const char *name,
98 const struct nameserver_params *params);
99
100/*
101 * Function to delete a name server
102 */
103int nameserver_delete(void **handle);
104
105/*
106 * Function to handle for a name
107 */
108void *nameserver_get_handle(const char *name);
109
110/*
111 * Function to add a variable length value into the local table
112 */
113void *nameserver_add(void *handle, const char *name, void *buf, u32 len);
114
115/*
116 * Function to add a 32 bit value into the local table
117 */
118void *nameserver_add_uint32(void *handle, const char *name, u32 value);
119
120/*
121 * Function to retrieve the value portion of a name/value pair
122 */
123int nameserver_get(void *handle, const char *name, void *buf, u32 *len,
124 u16 procId[]);
125
126/*
127 * Function to retrieve a 32-bit value of a name/value pair
128 */
129int nameserver_get_uint32(void *handle, const char *name, void *buf,
130 u16 procId[]);
131
132/*
133 * Function to get the value portion of a name/value pair from local table
134 */
135int nameserver_get_local(void *handle, const char *name, void *buf, u32 *len);
136
137/*
138 * Function to retrieve a 32-bit value from the local name/value table
139 */
140int nameserver_get_local_uint32(void *handle, const char *name, void *buf);
141
142/*
143 * Function to match the name
144 */
145int nameserver_match(void *handle, const char *name, u32 *value);
146
147/*
148 * Function to removes a value/pair
149 */
150int nameserver_remove(void *handle, const char *name);
151
152/*
153 * Function to remove an entry from the table
154 */
155int nameserver_remove_entry(void *handle, void *entry);
156
157#endif /* _NAMESERVER_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/nameserver_ioctl.h b/arch/arm/plat-omap/include/syslink/nameserver_ioctl.h
new file mode 100644
index 00000000000..5111f46f79a
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/nameserver_ioctl.h
@@ -0,0 +1,261 @@
1/*
2* nameserver_ioctl.h
3*
4* This provides the ioctl interface for nameserver module
5*
6* Copyright (C) 2008-2009 Texas Instruments, Inc.
7*
8* This package is free software; you can redistribute it and/or modify
9* it under the terms of the GNU General Public License version 2 as
10* published by the Free Software Foundation.
11*
12* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15* PURPOSE.
16*/
17
18#ifndef _NAMESERVER_IOCTL_H_
19#define _NAMESERVER_IOCTL_H_
20
21#include <linux/ioctl.h>
22#include <linux/types.h>
23
24#include <ipc_ioctl.h>
25#include <nameserver.h>
26
27enum CMD_NAMESERVER {
28 NAMESERVER_SETUP = NAMESERVER_BASE_CMD,
29 NAMESERVER_DESTROY,
30 NAMESERVER_PARAMS_INIT,
31 NAMESERVER_CREATE,
32 NAMESERVER_DELETE,
33 NAMESERVER_ADD,
34 NAMESERVER_ADDUINT32,
35 NAMESERVER_GET,
36 NAMESERVER_GETLOCAL,
37 NAMESERVER_MATCH,
38 NAMESERVER_REMOVE,
39 NAMESERVER_REMOVEENTRY,
40 NAMESERVER_GETHANDLE,
41 NAMESERVER_ISREGISTERED,
42 NAMESERVER_GETCONFIG
43};
44
45/*
46 * IOCTL command IDs for nameserver
47 *
48 */
49/*
50 * Command for nameserver_setup
51 */
52#define CMD_NAMESERVER_SETUP _IOWR(IPC_IOC_MAGIC, \
53 NAMESERVER_SETUP, \
54 struct nameserver_cmd_args)
55
56/*
57 * Command for nameserver_destroy
58 */
59#define CMD_NAMESERVER_DESTROY _IOWR(IPC_IOC_MAGIC, \
60 NAMESERVER_DESTROY, \
61 struct nameserver_cmd_args)
62
63/*
64 * Command for nameserver_params_init
65 */
66#define CMD_NAMESERVER_PARAMS_INIT _IOWR(IPC_IOC_MAGIC, \
67 NAMESERVER_PARAMS_INIT, \
68 struct nameserver_cmd_args)
69
70/*
71 * Command for nameserver_create
72 */
73#define CMD_NAMESERVER_CREATE _IOWR(IPC_IOC_MAGIC, \
74 NAMESERVER_CREATE, \
75 struct nameserver_cmd_args)
76
77/*
78 * Command for nameserver_delete
79 */
80#define CMD_NAMESERVER_DELETE _IOWR(IPC_IOC_MAGIC, \
81 NAMESERVER_DELETE, \
82 struct nameserver_cmd_args)
83
84/*
85 * Command for nameserver_add
86 */
87#define CMD_NAMESERVER_ADD _IOWR(IPC_IOC_MAGIC, \
88 NAMESERVER_ADD, \
89 struct nameserver_cmd_args)
90
91/*
92 * Command for nameserver_addu32
93 */
94#define CMD_NAMESERVER_ADDUINT32 _IOWR(IPC_IOC_MAGIC, \
95 NAMESERVER_ADDUINT32, \
96 struct nameserver_cmd_args)
97/*
98 * Command for nameserver_get
99 */
100#define CMD_NAMESERVER_GET _IOWR(IPC_IOC_MAGIC, \
101 NAMESERVER_GET, \
102 struct nameserver_cmd_args)
103
104/*
105 * Command for nameserver_get_local
106 */
107#define CMD_NAMESERVER_GETLOCAL _IOWR(IPC_IOC_MAGIC, \
108 NAMESERVER_GETLOCAL, \
109 struct nameserver_cmd_args)
110
111/*
112 * Command for nameserver_match
113 */
114#define CMD_NAMESERVER_MATCH _IOWR(IPC_IOC_MAGIC, \
115 NAMESERVER_MATCH, \
116 struct nameserver_cmd_args)
117
118/*
119 * Command for nameserver_remove
120 */
121#define CMD_NAMESERVER_REMOVE _IOWR(IPC_IOC_MAGIC, \
122 NAMESERVER_REMOVE, \
123 struct nameserver_cmd_args)
124
125/*
126 * Command for nameserver_remove_entry
127 */
128#define CMD_NAMESERVER_REMOVEENTRY _IOWR(IPC_IOC_MAGIC, \
129 NAMESERVER_REMOVEENTRY, \
130 struct nameserver_cmd_args)
131
132/*
133 * Command for nameserver_get_handle
134 */
135#define CMD_NAMESERVER_GETHANDLE _IOWR(IPC_IOC_MAGIC, \
136 NAMESERVER_GETHANDLE, \
137 struct nameserver_cmd_args)
138
139/*
140 * Command for NameServer_isRegistered
141 */
142#define CMD_NAMESERVER_ISREGISTERED _IOWR(IPC_IOC_MAGIC, \
143 NAMESERVER_ISREGISTERED, \
144 struct nameserver_cmd_args)
145
146/*
147 * Command for NameServer_getConfig
148 */
149#define CMD_NAMESERVER_GETCONFIG _IOWR(IPC_IOC_MAGIC, \
150 NAMESERVER_GETCONFIG, \
151 struct nameserver_cmd_args)
152
153/*
154 * Command arguments for nameserver
155 */
156union nameserver_arg {
157 struct {
158 struct nameserver_config *config;
159 } get_config;
160
161 struct {
162 struct nameserver_config *config;
163 } setup;
164
165 struct {
166 struct nameserver_params *params;
167 } params_init;
168
169 struct {
170 void *handle;
171 char *name;
172 u32 name_len;
173 struct nameserver_params *params;
174 } create;
175
176 struct {
177 void *handle;
178 } delete_instance;
179
180 struct {
181 void *handle;
182 char *name;
183 u32 name_len;
184 void *buf;
185 s32 len;
186 void *entry;
187 void *node;
188 } add;
189
190 struct {
191 void *handle;
192 char *name;
193 u32 name_len;
194 u32 value;
195 void *entry;
196 } addu32;
197
198 struct {
199 void *handle;
200 char *name;
201 u32 name_len;
202 void *value;
203 u32 len;
204 u16 *proc_id;
205 u32 proc_len;
206 } get;
207
208 struct {
209 void *handle;
210 char *name;
211 u32 name_len;
212 void *value;
213 u32 len;
214 } get_local;
215
216 struct {
217 void *handle;
218 char *name;
219 u32 name_len;
220 u32 value;
221 u32 count;
222 } match;
223
224 struct {
225 void *handle;
226 char *name;
227 u32 name_len;
228 } remove;
229
230 struct {
231 void *handle;
232 void *entry;
233 } remove_entry;
234
235 struct {
236 void *handle;
237 char *name;
238 u32 name_len;
239 } get_handle;
240
241 struct {
242 u16 proc_id;
243 bool check;
244 } is_registered;
245};
246
247/*
248 * Command arguments for nameserver
249 */
250struct nameserver_cmd_args {
251 union nameserver_arg args;
252 s32 api_status;
253};
254
255/*
256 * This ioctl interface for nameserver module
257 */
258int nameserver_ioctl(struct inode *inode, struct file *filp,
259 unsigned int cmd, unsigned long args, bool user);
260
261#endif /* _NAMESERVER_IOCTL_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/nameserver_remote.h b/arch/arm/plat-omap/include/syslink/nameserver_remote.h
new file mode 100644
index 00000000000..bc0921b08e0
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/nameserver_remote.h
@@ -0,0 +1,39 @@
1/*
2 * nameserver_remote.h
3 *
4 * Copyright (C) 2008-2009 Texas Instruments, Inc.
5 *
6 * This package is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
11 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
12 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
13 * PURPOSE.
14 */
15
16#ifndef _NAMESERVER_REMOTE_H_
17#define _NAMESERVER_REMOTE_H_
18
19#include <linux/types.h>
20
21/*
22 * Structure defining object for the nameserver remote driver
23 */
24struct nameserver_remote_object {
25 int (*get)(const struct nameserver_remote_object *obj,
26 const char *instance_name, const char *name,
27 void *value, u32 *value_len, void *reserved);
28 /* Function to get data from remote nameserver */
29 void *obj; /* Implementation specific object */
30};
31
32/*
33 * Function get data from remote name server
34 */
35int nameserver_remote_get(const struct nameserver_remote_object *handle,
36 const char *instance_name, const char *name,
37 void *value, u32 *value_len, void *reserved);
38
39#endif /* _NAMESERVER_REMOTE_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/nameserver_remotenotify.h b/arch/arm/plat-omap/include/syslink/nameserver_remotenotify.h
new file mode 100644
index 00000000000..cb9b6218930
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/nameserver_remotenotify.h
@@ -0,0 +1,90 @@
1/*
2 * nameserver_remotenotify.h
3 *
4 * The nameserver_remotenotify module provides functionality to get name
5 * value pair from a remote nameserver.
6 *
7 * Copyright (C) 2008-2009 Texas Instruments, Inc.
8 *
9 * This package is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE.
17 */
18
19#ifndef _NAMESERVER_REMOTENOTIFY_H_
20#define _NAMESERVER_REMOTENOTIFY_H_
21
22#include <linux/types.h>
23
24/*
25 * NAMESERVERREMOTENOTIFY_MODULEID
26 * Unique module ID
27 */
28#define NAMESERVERREMOTENOTIFY_MODULEID (0x08FD)
29
30/*
31 * Module configuration structure
32 */
33struct nameserver_remotenotify_config {
34 u32 notify_event_id;
35 /* Notify event number */
36};
37
38/*
39 * Module configuration structure
40 */
41struct nameserver_remotenotify_params {
42 void *shared_addr; /* Address of the shared memory */
43 void *gatemp; /* Handle to the gatemp used for protecting the
44 nameserver_remotenotify instance. Using the default
45 value of NULL will result in the default gatemp being
46 used for context protection */
47};
48
49/* Function to get the default configuration for the nameserver_remotenotify
50 * module */
51void nameserver_remotenotify_get_config(
52 struct nameserver_remotenotify_config *cfg);
53
54/* Function to setup the nameserver_remotenotify module */
55int nameserver_remotenotify_setup(struct nameserver_remotenotify_config *cfg);
56
57/* Function to destroy the nameserver_remotenotify module */
58int nameserver_remotenotify_destroy(void);
59
60/* Function to get the current configuration values */
61void nameserver_remotenotify_params_init(
62 struct nameserver_remotenotify_params *params);
63
64/* Function to create the nameserver_remotenotify object */
65void *nameserver_remotenotify_create(u16 remote_proc_id,
66 const struct nameserver_remotenotify_params *params);
67
68/* Function to delete the nameserver_remotenotify object */
69int nameserver_remotenotify_delete(void **handle);
70
71/* Function to get a name/value from remote nameserver */
72int nameserver_remotenotify_get(void *handle,
73 const char *instance_name, const char *name,
74 void *value, u32 *value_len, void *reserved);
75
76/* Get the shared memory requirements for the nameserver_remotenotify */
77uint nameserver_remotenotify_shared_mem_req(
78 const struct nameserver_remotenotify_params *params);
79
80/* Create all the NameServerRemoteNotify drivers. */
81int nameserver_remotenotify_start(void *shared_addr);
82
83/* Attaches to remote processor */
84int nameserver_remotenotify_attach(u16 remote_proc_id, void *shared_addr);
85
86/* Detaches from remote processor */
87int nameserver_remotenotify_detach(u16 remote_proc_id);
88
89
90#endif /* _NAMESERVER_REMOTENOTIFY_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/notify.h b/arch/arm/plat-omap/include/syslink/notify.h
new file mode 100644
index 00000000000..0f9a399e5ce
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/notify.h
@@ -0,0 +1,146 @@
1/*
2 * notify.h
3 *
4 * Notify driver support for OMAP Processors.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15 */
16
17
18#if !defined(_NOTIFY_H_)
19#define _NOTIFY_H_
20
21/* The resource is still in use */
22#define NOTIFY_S_BUSY 2
23
24/* Module already set up */
25#define NOTIFY_S_ALREADYSETUP 1
26
27/* Operation is successful. */
28#define NOTIFY_S_SUCCESS 0
29
30/* Generic failure */
31#define NOTIFY_E_FAIL -1
32
33/* Argument passed to function is invalid.. */
34#define NOTIFY_E_INVALIDARG -2
35
36/* Operation resulted in memory failure. */
37#define NOTIFY_E_MEMORY -3
38
39/* The specified entity already exists. */
40#define NOTIFY_E_ALREADYEXISTS -4
41
42/* Unable to find the specified entity. */
43#define NOTIFY_E_NOTFOUND -5
44
45/* Operation timed out. */
46#define NOTIFY_E_TIMEOUT -6
47
48/* Module is not initialized. */
49#define NOTIFY_E_INVALIDSTATE -7
50
51/* A failure occurred in an OS-specific call */
52#define NOTIFY_E_OSFAILURE -8
53
54/* The module has been already setup */
55#define NOTIFY_E_ALREADYSETUP -9
56
57/* Specified resource is not available */
58#define NOTIFY_E_RESOURCE -10
59
60/* Operation was interrupted. Please restart the operation */
61#define NOTIFY_E_RESTART -11
62
63/* The resource is still in use */
64#define NOTIFY_E_BUSY -12
65
66/* Driver corresponding to the specified eventId is not registered */
67#define NOTIFY_E_DRIVERNOTREGISTERED -13
68
69/* Event not registered */
70#define NOTIFY_E_EVTNOTREGISTERED -14
71
72/* Event is disabled */
73#define NOTIFY_E_EVTDISABLED -15
74
75/* Remote notification is not initialized */
76#define NOTIFY_E_NOTINITIALIZED -16
77
78/* Trying to illegally use a reserved event */
79#define NOTIFY_E_EVTRESERVED -17
80
81/* Macro to make a correct module magic number with refCount */
82#define NOTIFY_MAKE_MAGICSTAMP(x) ((NOTIFY_MODULEID << 12u) | (x))
83
84#define REG volatile
85
86/* Maximum number of events supported by the Notify module */
87#define NOTIFY_MAXEVENTS (u16)32
88
89/* Maximum number of IPC interrupt lines per processor. */
90#define NOTIFY_MAX_INTLINES 4u
91
92/* This key must be provided as the upper 16 bits of the eventNo when
93 * registering for an event, if any reserved event numbers are to be
94 * used. */
95#define NOTIFY_SYSTEMKEY 0xC1D2
96
97
98typedef void (*notify_fn_notify_cbck)(u16 proc_id, u16 line_id, u32 event_id,
99 uint *arg, u32 payload);
100
101extern struct notify_module_object notify_state;
102
103
104/* Function to disable Notify module */
105u32 notify_disable(u16 procId, u16 line_id);
106
107/* Function to disable particular event */
108void notify_disable_event(u16 proc_id, u16 line_id, u32 event_id);
109
110/* Function to enable particular event */
111void notify_enable_event(u16 proc_id, u16 line_id, u32 event_id);
112
113/* Function to find out whether notification via interrupt line has been
114 * registered. */
115bool notify_is_registered(u16 proc_id, u16 line_id);
116
117/* Returns the amount of shared memory used by one Notify instance. */
118uint notify_shared_mem_req(u16 proc_id, void *shared_addr);
119
120/* Function to register an event */
121int notify_register_event(u16 proc_id, u16 line_id, u32 event_id,
122 notify_fn_notify_cbck notify_callback_fxn,
123 void *cbck_arg);
124
125/* Function to register an event */
126int notify_register_event_single(u16 proc_id, u16 line_id, u32 event_id,
127 notify_fn_notify_cbck notify_callback_fxn,
128 void *cbck_arg);
129
130/* Function to restore Notify module state */
131void notify_restore(u16 proc_id, u16 line_id, u32 key);
132
133/* Function to send an event to other processor */
134int notify_send_event(u16 proc_id, u16 line_id, u32 event_id, u32 payload,
135 bool wait_clear);
136
137/* Function to unregister an event */
138int notify_unregister_event(u16 proc_id, u16 line_id, u32 event_id,
139 notify_fn_notify_cbck notify_callback_fxn,
140 void *cbck_arg);
141
142/* Function to unregister an event */
143int notify_unregister_event_single(u16 proc_id, u16 line_id, u32 event_id);
144
145
146#endif /* !defined(_NOTIFY_H_) */
diff --git a/arch/arm/plat-omap/include/syslink/notify_dispatcher.h b/arch/arm/plat-omap/include/syslink/notify_dispatcher.h
new file mode 100644
index 00000000000..efd87315815
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/notify_dispatcher.h
@@ -0,0 +1,158 @@
1/*
2 * notify_dispatcher.h
3 *
4 * Notify driver support for OMAP Processors.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15 */
16
17
18#ifndef __TMBX_H__
19#define __TMBX_H__
20
21
22#include <syslink/notifydefs.h>
23#include <linux/interrupt.h>
24
25#include <syslink/notifyerr.h>
26
27#define MAX_MBOX_MODULES 2
28#define MAX_MBOX_ISRS 32
29#define KErrNone 0
30#define KErrNotSupported 1
31#define KErrNotReady 2
32#define KErrArgument 2
33
34typedef void (*isr_call_back)(void *);
35
36struct mbox_config {
37 unsigned long int mbox_linear_addr;
38 unsigned long int mbox_modules;
39 signed long int interrupt_lines[MAX_MBOX_MODULES];
40 signed long int mailboxes[MAX_MBOX_MODULES];
41};
42
43struct mbox_isrs {
44 signed long int isrNo[MAX_MBOX_MODULES];
45 /* TODO: Remove this - seems to be unused.*/
46 isr_call_back isrs[MAX_MBOX_MODULES][MAX_MBOX_ISRS];
47 void *isr_params[MAX_MBOX_MODULES][MAX_MBOX_ISRS];
48};
49
50extern const unsigned long *linear_address;
51
52irqreturn_t notify_mailbx0_user0_isr(int temp, void *anArg, struct pt_regs *p);
53
54/*
55 *func ntfy_disp_bind_interrupt
56 *
57 * desc Bind an ISR to the HW interrupt line coming into the processor
58 */
59int ntfy_disp_bind_interrupt(int interrupt_no,
60 isr_call_back hw_isr,
61 void *isr_arg);
62
63
64/*
65 * desc Print the mailbox registers and other useful debug information
66 *
67 */
68void ntfy_disp_debug(void);
69
70
71/*
72 * func ntfy_disp_deinit
73 * desc Uninitialize the Mailbox Manager module
74 */
75int ntfy_disp_deinit(void);
76
77
78/*
79 * desc Return the pointer to the Mailbox Manager's configuration object
80 */
81struct mbox_config *ntfy_disp_get_config(void);
82
83
84/*
85 * desc Initialize the Mailbox Manager module
86 */
87int ntfy_disp_init(void);
88
89
90/*
91 * desc Disable a particular IRQ bit on a Mailbox IRQ Enable Register
92 */
93int ntfy_disp_interrupt_disable(unsigned long int mbox_module_no,
94 int a_irq_bit);
95
96
97/*
98 * desc Enable a particular IRQ bit on a Mailbox IRQ Enable Register
99 */
100int ntfy_disp_interrupt_enable(unsigned long int mbox_module_no,
101 int a_irq_bit);
102
103
104/*
105 * desc Read a message on a Mailbox FIFO queue
106 */
107int ntfy_disp_read(unsigned long int mbox_module_no,
108 int a_mbox_no,
109 int *messages,
110 int *num_messages,
111 short int read_all);
112
113
114/*
115 * func ntfy_disp_register
116 * desc Register a ISR callback associated with a particular IRQ bit on a
117 * Mailbox IRQ Enable Register
118 */
119int ntfy_disp_register(unsigned long int mbox_module_no,
120 int a_irq_bit,
121 isr_call_back isr_cbck_fn,
122 void *isrCallbackArgs);
123
124
125/*
126 * func ntfy_disp_send
127 * desc Send a message on a Mailbox FIFO queue
128 */
129int ntfy_disp_send(unsigned long int mbox_module_no,
130 int a_mbox_no,
131 int message);
132
133
134/*
135 * func ntfy_disp_unbind_interrupt
136 * desc Remove the ISR to the HW interrupt line coming into the processor
137 */
138int ntfy_disp_unbind_interrupt(int interrupt_no);
139
140
141/*
142 * func ntfy_disp_unregister
143 * desc Unregister a ISR callback associated with a particular IRQ bit on a
144 * Mailbox IRQ Enable Register
145 */
146int ntfy_disp_unregister(unsigned long int mbox_module_no,
147 int a_irq_bit);
148
149/*
150 * func notify_mailbx0_user0_isr
151 * desc mail ISR
152 *
153 */
154
155irqreturn_t notify_mailbx0_user0_isr(int temp, void *anArg, struct pt_regs *p);
156
157
158#endif
diff --git a/arch/arm/plat-omap/include/syslink/notify_driver.h b/arch/arm/plat-omap/include/syslink/notify_driver.h
new file mode 100644
index 00000000000..95c586b7762
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/notify_driver.h
@@ -0,0 +1,45 @@
1/*
2 * notify_driver.h
3 *
4 * Notify driver support for OMAP Processors.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15 */
16
17
18#if !defined _NOTIFY_DRIVER_H_
19#define _NOTIFY_DRIVER_H_
20
21
22/* Module includes */
23#include <syslink/notify_driverdefs.h>
24#include <syslink/_notify.h>
25
26
27/* Function to register notify driver */
28int notify_register_driver(u16 remote_proc_id,
29 u16 line_id,
30 struct notify_driver_fxn_table *fxn_table,
31 struct notify_driver_object **driver_handle);
32
33/* Function to unregister notify driver */
34int notify_unregister_driver(struct notify_driver_object *drv_handle);
35
36/* Function to set the driver handle */
37int notify_set_driver_handle(u16 remote_proc_id, u16 line_id,
38 struct notify_object *handle);
39
40/* Function to find the driver in the list of drivers */
41struct notify_driver_object *notify_get_driver_handle(u16 remote_proc_id,
42 u16 line_id);
43
44
45#endif /* !defined (_NOTIFY_DRIVER_H_) */
diff --git a/arch/arm/plat-omap/include/syslink/notify_driverdefs.h b/arch/arm/plat-omap/include/syslink/notify_driverdefs.h
new file mode 100644
index 00000000000..56f6b282caf
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/notify_driverdefs.h
@@ -0,0 +1,137 @@
1/*
2 * notify_driverdefs.h
3 *
4 * Notify driver support for OMAP Processors.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15 */
16
17
18#if !defined(_NOTIFY_DRIVERDEFS_H_)
19#define _NOTIFY_DRIVERDEFS_H_
20
21
22/* Module headers */
23#include <syslink/multiproc.h>
24#include <syslink/notify.h>
25#include <syslink/_notify.h>
26
27
28/* Enumerations to indicate types of Driver initialization status */
29enum notify_driver_init_status {
30 NOTIFY_DRIVERINITSTATUS_NOTDONE = 0,
31 /* Driver initialization is not done. */
32 NOTIFY_DRIVERINITSTATUS_DONE = 1,
33 /* Driver initialization is complete. */
34 NOTIFY_DRIVERINITSTATUS_INPROGRESS = 2,
35 /* Driver initialization is in progress. */
36 NOTIFY_DRIVERINITSTATUS_ENDVALUE = 3
37 /* End delimiter indicating start of invalid values for this enum */
38};
39
40struct notify_driver_object;
41
42/* This structure defines the function table interface for the Notify
43 * driver.
44 * This function table interface must be implemented by each Notify
45 * driver and registered with the Notify module. */
46struct notify_driver_fxn_table {
47 int (*register_event)(struct notify_driver_object *handle,
48 u32 event_id);
49 /* interface function register_event */
50 int (*unregister_event)(struct notify_driver_object *handle,
51 u32 event_id);
52 /* interface function unregister_event */
53 int (*send_event)(struct notify_driver_object *handle, u32 event_id,
54 u32 payload, bool wait_clear);
55 /* interface function send_event */
56 u32 (*disable)(struct notify_driver_object *handle);
57 /* interface function disable */
58 void (*enable)(struct notify_driver_object *handle);
59 /* interface function enable */
60 void (*disable_event)(struct notify_driver_object *handle,
61 u32 event_id);
62 /* interface function disable_event */
63 void (*enable_event)(struct notify_driver_object *handle, u32 event_id);
64 /* interface function enable_event */
65};
66
67/* This structure defines the Notify driver object and handle used
68 * internally to contain all information required for the Notify driver
69 * This object contains all information for the Notify module to be
70 * able to identify and interact with the Notify driver. */
71struct notify_driver_object {
72 enum notify_driver_init_status is_init;
73 struct notify_driver_fxn_table fxn_table;
74 struct notify_object *notify_handle;
75};
76
77#if 0
78/*
79 *This structure defines information for all processors supported by
80 *the Notify driver.
81 *An instance of this object is provided for each processor handled by
82 *the Notify driver, when registering itself with the Notify module.
83 *
84 */
85struct notify_driver_proc_info {
86 u32 max_events;
87 u32 reserved_events;
88 bool event_priority;
89 u32 payload_size;
90 u16 proc_id;
91};
92
93/*
94 * This structure defines the structure for specifying Notify driver
95 * attributes to the Notify module.
96 * This structure provides information about the Notify driver to the
97 * Notify module. The information is used by the Notify module mainly
98 * for parameter validation. It may also be used by the Notify module
99 * to take appropriate action if required, based on the characteristics
100 * of the Notify driver.
101 */
102struct notify_driver_attrs {
103 u32 numProc;
104 struct notify_driver_proc_info
105 proc_info[MULTIPROC_MAXPROCESSORS];
106};
107
108union notify_drv_procevents{
109 struct {
110 struct notify_shmdrv_attrs attrs;
111 struct notify_shmdrv_ctrl *ctrl_ptr;
112 } shm_events;
113
114 struct {
115 /*Attributes */
116 unsigned long int num_events;
117 unsigned long int send_event_pollcount;
118 /*Control Paramters */
119 unsigned long int send_init_status ;
120 struct notify_shmdrv_eventreg_mask reg_mask ;
121 } non_shm_events;
122};
123
124struct notify_drv_eventlist {
125 unsigned long int event_handler_count;
126 struct list_head listeners;
127};
128
129struct notify_drv_proc_module {
130 unsigned long int proc_id;
131 struct notify_drv_eventlist *event_list;
132 struct notify_shmdrv_eventreg *reg_chart;
133 union notify_drv_procevents events_obj;
134};
135#endif
136
137#endif /* !defined(_NOTIFY_DRIVERDEFS_H_) */
diff --git a/arch/arm/plat-omap/include/syslink/notify_ducatidriver.h b/arch/arm/plat-omap/include/syslink/notify_ducatidriver.h
new file mode 100644
index 00000000000..aa805ffbb3c
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/notify_ducatidriver.h
@@ -0,0 +1,141 @@
1/*
2 * notify_ducatidriver.h
3 *
4 * Syslink driver support for OMAP Processors.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15 */
16
17#ifndef NOTIFY_DUCATIDRIVER_H_
18#define NOTIFY_DUCATIDRIVER_H_
19
20
21
22/* Notify*/
23#include <syslink/notify.h>
24#include <syslink/notify_driverdefs.h>
25
26/* Module ID for NotifyDriverShm. */
27#define NOTIFY_DUCATIDRIVER_MODULEID ((u16) 0xb9d4)
28
29#define VOLATILE volatile
30
31extern u32 get_ducati_virt_mem();
32extern void unmap_ducati_virt_mem(u32 shm_virt_addr);
33
34
35/* module configuration structure */
36struct notify_ducatidrv_config {
37 u32 reserved;
38};
39
40/* This structure defines the configuration structure for
41 * initialization of the Notify driver. */
42struct notify_ducatidrv_params {
43 void *shared_addr;
44 /* Address in shared memory where this instance will be placed */
45 bool cache_enabled;
46 /* Whether cache operations will be performed */
47 u32 cache_line_size;
48 /* The cache line size of the shared memory */
49 u32 remote_proc_id;
50 /* Processor Id of remote processor required for communication */
51 u32 line_id;
52 /* Line ID for the interrupt */
53 u32 local_int_id;
54 /* Local interrupt ID for interrupt line for incoming interrupts */
55 u32 remote_int_id;
56 /* Remote interrupt ID for interrupt line for outgoing interrupts */
57};
58
59/* Defines the structure of event entry within the event chart.
60 * Each entry contains occured event-specific information.
61 * Used to flag a remote event and determine if a local event has been
62 * flagged. This struct is placed in shared memory. */
63struct notify_ducatidrv_event_entry {
64 VOLATILE u32 flag;
65 /* Flag indicating whether event is set */
66 VOLATILE u32 payload;
67 /* Payload associated with event */
68 VOLATILE u32 reserved;
69 /* Reserved field */
70 /* Padding for cache line alignment */
71};
72
73/* Defines the NotifyDriverShm control structure, which contains all
74 * information for one processor. This structure is shared between the
75 * two processors. */
76struct notify_ducatidrv_proc_ctrl {
77 VOLATILE u32 recv_init_status;
78 /* Initialization status for receiving events */
79 VOLATILE u32 send_init_status;
80 /* Initialization status for sending events */
81 VOLATILE u32 event_reg_mask;
82 /* Event Registered mask */
83 VOLATILE u32 event_enable_mask;
84 /* Event Enabled mask */
85};
86
87
88/* Function to get the default configuration for the notify_ducati driver
89 * module. */
90void notify_ducatidrv_get_config(struct notify_ducatidrv_config *cfg);
91
92/* Function to setup the notify ducati driver with the given configuration*/
93int notify_ducatidrv_setup(struct notify_ducatidrv_config *cfg);
94
95/* Function to destroy the notify ducati driver */
96int notify_ducatidrv_destroy(void);
97
98/*Function to initialize the given parameters */
99void notify_ducatidrv_params_init(struct notify_ducatidrv_params *params);
100
101/* Function to create the ducati driver handle and performs initialization. */
102struct notify_ducatidrv_object *notify_ducatidrv_create(
103 const struct notify_ducatidrv_params *params);
104
105/* Function to delete the ducati driver handle and performs de initialization.*/
106int notify_ducatidrv_delete(struct notify_ducatidrv_object **handle);
107
108/* Get the shared memory requirements for the notify ducati driver. */
109uint notify_ducatidrv_shared_mem_req(
110 const struct notify_ducatidrv_params *params);
111
112
113/* Register a callback for an event with the Notify driver. */
114int notify_ducatidrv_register_event(struct notify_driver_object *handle,
115 u32 event_id);
116
117/* Unregister a callback for an event with the Notify driver. */
118int notify_ducatidrv_unregister_event(struct notify_driver_object *handle,
119 u32 event_id);
120
121/* Send a notification event to the registered users for this
122 notification on the specified processor. */
123int notify_ducatidrv_send_event(struct notify_driver_object *handle,
124 u32 event_id, u32 payload, bool wait_clear);
125
126/* Disable all events for this Notify driver. */
127int notify_ducatidrv_disable(struct notify_driver_object *handle);
128
129/* Restore the Notify driver to the state before the last disable was called. */
130void notify_ducatidrv_enable(struct notify_driver_object *handle);
131
132/* Disable a specific event for this Notify driver. */
133void notify_ducatidrv_disable_event(struct notify_driver_object *handle,
134 u32 event_id);
135
136/* Enable a specific event for this Notify driver. */
137void notify_ducatidrv_enable_event(struct notify_driver_object *handle,
138 u32 event_id);
139
140
141#endif /* !defined NOTIFY_SHMDRIVER_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/notify_ioctl.h b/arch/arm/plat-omap/include/syslink/notify_ioctl.h
new file mode 100644
index 00000000000..9d1dcadd4ba
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/notify_ioctl.h
@@ -0,0 +1,278 @@
1/*
2 * notify_driverdefs.h
3 *
4 * Notify driver support for OMAP Processors.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15 */
16
17
18#if !defined(_NOTIFY_IOCTL_H_)
19#define _NOTIFY_IOCTL_H_
20
21/* Linux headers */
22#include <linux/ioctl.h>
23
24/* Utilities headers */
25#include <syslink/host_os.h>
26
27/* Module headers */
28#include <ipc_ioctl.h>
29#include <syslink/notify.h>
30#include <syslink/notify_ducatidriver.h>
31#include <syslink/notifydefs.h>
32
33
34enum CMD_NOTIFY {
35 NOTIFY_GETCONFIG = NOTIFY_BASE_CMD,
36 NOTIFY_SETUP,
37 NOTIFY_DESTROY,
38 NOTIFY_REGISTEREVENT,
39 NOTIFY_UNREGISTEREVENT,
40 NOTIFY_SENDEVENT,
41 NOTIFY_DISABLE,
42 NOTIFY_RESTORE,
43 NOTIFY_DISABLEEVENT,
44 NOTIFY_ENABLEEVENT,
45 NOTIFY_ATTACH,
46 NOTIFY_DETACH,
47 NOTIFY_THREADATTACH,
48 NOTIFY_THREADDETACH,
49 NOTIFY_ISREGISTERED,
50 NOTIFY_SHAREDMEMREQ,
51 NOTIFY_REGISTEREVENTSINGLE,
52 NOTIFY_UNREGISTEREVENTSINGLE
53};
54
55/* Command for notify_get_config */
56#define CMD_NOTIFY_GETCONFIG _IOWR(IPC_IOC_MAGIC, \
57 NOTIFY_GETCONFIG, \
58 struct notify_cmd_args_get_config)
59
60/* Command for notify_setup */
61#define CMD_NOTIFY_SETUP _IOWR(IPC_IOC_MAGIC, \
62 NOTIFY_SETUP, \
63 struct notify_cmd_args_setup)
64
65/* Command for notify_destroy */
66#define CMD_NOTIFY_DESTROY _IOWR(IPC_IOC_MAGIC, \
67 NOTIFY_DESTROY, \
68 struct notify_cmd_args_destroy)
69
70/* Command for notify_register_event */
71#define CMD_NOTIFY_REGISTEREVENT _IOWR(IPC_IOC_MAGIC, \
72 NOTIFY_REGISTEREVENT, \
73 struct notify_cmd_args_register_event)
74
75/* Command for notify_unregister_event */
76#define CMD_NOTIFY_UNREGISTEREVENT _IOWR(IPC_IOC_MAGIC, \
77 NOTIFY_UNREGISTEREVENT, \
78 struct notify_cmd_args_unregister_event)
79
80/* Command for notify_send_event */
81#define CMD_NOTIFY_SENDEVENT _IOWR(IPC_IOC_MAGIC, \
82 NOTIFY_SENDEVENT, \
83 struct notify_cmd_args_send_event)
84/* Command for notify_disable */
85#define CMD_NOTIFY_DISABLE _IOWR(IPC_IOC_MAGIC, \
86 NOTIFY_DISABLE, \
87 struct notify_cmd_args_disable)
88
89/* Command for notify_restore */
90#define CMD_NOTIFY_RESTORE _IOWR(IPC_IOC_MAGIC, \
91 NOTIFY_RESTORE, \
92 struct notify_cmd_args_restore)
93
94/* Command for notify_disable_event */
95#define CMD_NOTIFY_DISABLEEVENT _IOWR(IPC_IOC_MAGIC, \
96 NOTIFY_DISABLEEVENT, \
97 struct notify_cmd_args_disable_event)
98
99/* Command for notify_enable_event */
100#define CMD_NOTIFY_ENABLEEVENT _IOWR(IPC_IOC_MAGIC, \
101 NOTIFY_ENABLEEVENT, \
102 struct notify_cmd_args_enable_event)
103
104/* Command for notify_attach */
105#define CMD_NOTIFY_ATTACH _IOWR(IPC_IOC_MAGIC, \
106 NOTIFY_ATTACH, \
107 struct notify_cmd_args_attach)
108
109/* Command for notify_detach */
110#define CMD_NOTIFY_DETACH _IOWR(IPC_IOC_MAGIC, \
111 NOTIFY_DETACH, \
112 struct notify_cmd_args_detach)
113
114/* Command for notify_thread_attach */
115#define CMD_NOTIFY_THREADATTACH _IOWR(IPC_IOC_MAGIC, \
116 NOTIFY_THREADATTACH, \
117 struct notify_cmd_args)
118
119/* Command for notify_thread_detach */
120#define CMD_NOTIFY_THREADDETACH _IOWR(IPC_IOC_MAGIC, \
121 NOTIFY_THREADDETACH, \
122 struct notify_cmd_args)
123
124/* Command for notify_is_registered */
125#define CMD_NOTIFY_ISREGISTERED _IOWR(IPC_IOC_MAGIC, \
126 NOTIFY_ISREGISTERED, \
127 struct notify_cmd_args_is_registered)
128
129/* Command for notify_shared_mem_req */
130#define CMD_NOTIFY_SHAREDMEMREQ _IOWR(IPC_IOC_MAGIC, \
131 NOTIFY_SHAREDMEMREQ, \
132 struct notify_cmd_args_shared_mem_req)
133/* Command for notify_register_event_single */
134#define CMD_NOTIFY_REGISTEREVENTSINGLE _IOWR(IPC_IOC_MAGIC, \
135 NOTIFY_REGISTEREVENTSINGLE, \
136 struct notify_cmd_args_register_event)
137
138/* Command for notify_unregister_event_single */
139#define CMD_NOTIFY_UNREGISTEREVENTSINGLE _IOWR(IPC_IOC_MAGIC, \
140 NOTIFY_UNREGISTEREVENTSINGLE, \
141 struct notify_cmd_args_unregister_event)
142
143
144/*Structure of Event Packet read from notify kernel-side..*/
145struct notify_drv_event_packet {
146 struct list_head element;
147 u32 pid;
148 u32 proc_id;
149 u32 event_id;
150 u16 line_id;
151 u32 data;
152 notify_fn_notify_cbck func;
153 void *param;
154 bool is_exit;
155};
156
157/* Common arguments for all ioctl commands */
158struct notify_cmd_args {
159 int api_status;
160};
161
162/* Command arguments for notify_get_config */
163struct notify_cmd_args_get_config {
164 struct notify_cmd_args common_args;
165 struct notify_config *cfg;
166};
167
168/* Command arguments for notify_setup */
169struct notify_cmd_args_setup {
170 struct notify_cmd_args common_args;
171 struct notify_config *cfg;
172};
173
174/* Command arguments for notify_destroy */
175struct notify_cmd_args_destroy {
176 struct notify_cmd_args common_args;
177};
178
179/* Command arguments for notify_attach */
180struct notify_cmd_args_attach {
181 struct notify_cmd_args common_args;
182 u16 proc_id;
183 void *shared_addr;
184};
185
186/* Command arguments for notify_detach */
187struct notify_cmd_args_detach {
188 struct notify_cmd_args common_args;
189 u16 proc_id;
190};
191
192/* Command arguments for notify_cmd_args_shared_mem_req */
193struct notify_cmd_args_shared_mem_req {
194 struct notify_cmd_args common_args;
195 u16 proc_id;
196 void *shared_addr;
197 uint shared_mem_size;
198};
199
200/* Command arguments for notify_cmd_args_is_registered */
201struct notify_cmd_args_is_registered {
202 struct notify_cmd_args common_args;
203 u16 proc_id;
204 u16 line_id;
205 bool is_registered;
206};
207
208/* Command arguments for notify_register_event */
209struct notify_cmd_args_register_event {
210 struct notify_cmd_args common_args;
211 u16 proc_id;
212 u16 line_id;
213 u32 event_id;
214 notify_fn_notify_cbck fn_notify_cbck;
215 uint *cbck_arg;
216 u32 pid;
217};
218
219/* Command arguments for notify_unregister_event */
220struct notify_cmd_args_unregister_event {
221 struct notify_cmd_args common_args;
222 u16 proc_id;
223 u16 line_id;
224 u32 event_id;
225 notify_fn_notify_cbck fn_notify_cbck;
226 uint *cbck_arg;
227 u32 pid;
228};
229
230/* Command arguments for notify_send_event */
231struct notify_cmd_args_send_event {
232 struct notify_cmd_args common_args;
233 u16 proc_id;
234 u16 line_id;
235 u32 event_id;
236 u32 payload;
237 bool wait_clear;
238};
239
240/* Command arguments for notify_disable */
241struct notify_cmd_args_disable {
242 struct notify_cmd_args common_args;
243 u16 proc_id;
244 u16 line_id;
245 u32 flags;
246};
247
248/* Command arguments for notify_restore */
249struct notify_cmd_args_restore {
250 struct notify_cmd_args common_args;
251 u32 key;
252 u16 proc_id;
253 u16 line_id;
254};
255
256/* Command arguments for notify_disable_event */
257struct notify_cmd_args_disable_event {
258 struct notify_cmd_args common_args;
259 u16 proc_id;
260 u16 line_id;
261 u32 event_id;
262};
263
264/* Command arguments for notify_enable_event */
265struct notify_cmd_args_enable_event {
266 struct notify_cmd_args common_args;
267 u16 proc_id;
268 u16 line_id;
269 u32 event_id;
270};
271
272/* Command arguments for notify_exit */
273struct notify_cmd_args_exit {
274 struct notify_cmd_args common_args;
275};
276
277
278#endif /* !defined(_NOTIFY_IOCTL_H_) */
diff --git a/arch/arm/plat-omap/include/syslink/notify_setup_proxy.h b/arch/arm/plat-omap/include/syslink/notify_setup_proxy.h
new file mode 100644
index 00000000000..383b3150a7d
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/notify_setup_proxy.h
@@ -0,0 +1,53 @@
1/*
2 * notify_setup_proxy.h
3 *
4 * Proxy to connect notify setup to device specific implementation
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15 */
16
17#if !defined(_NOTIFYSETUPPROXY_H_0x5f84)
18#define _NOTIFYSETUPPROXY_H_0x5f84
19
20#if defined(CONFIG_ARCH_OMAP4)
21/* Function that will be called in Notify_attach */
22extern int notify_setup_omap4_attach(u16 proc_id, void *shared_addr);
23#define notify_setup_proxy_attach(proc_id, shared_addr) \
24 notify_setup_omap4_attach(proc_id, shared_addr)
25
26/* Function that will be called in notify_stop */
27extern int notify_setup_omap4_detach(u16 proc_id);
28#define notify_setup_proxy_detach notify_setup_omap4_detach
29
30/* Shared Memory Required for notify setup */
31extern uint notify_setup_omap4_shared_mem_req(u16 proc_id, void *shared_addr);
32#define notify_setup_proxy_shared_mem_req(proc_id, shared_addr) \
33 notify_setup_omap4_shared_mem_req(proc_id, shared_addr)
34
35/* Is interrupt line available? */
36extern bool notify_setup_omap4_int_line_available(u16 remote_proc_id);
37#define notify_setup_proxy_int_line_available(remote_proc_id) \
38 notify_setup_omap4_int_line_available(remote_proc_id)
39#else
40/* Function that will be called in Notify_attach */
41#define notify_setup_proxy_attach(proc_id, shared_addr)
42
43/* Function that will be called in notify_stop */
44#define notify_setup_proxy_detach
45
46/* Shared Memory Required for notify setup */
47#define notify_setup_proxy_shared_mem_req(proc_id, shared_addr)
48
49/* Is interrupt line available? */
50#define notify_setup_proxy_int_line_available(remote_proc_id)
51#endif /* if defined (SYSLINK_PLATFORM_OMAPL1XX) */
52
53#endif /* !defined(_NOTIFYSETUPPROXY_H_0x5f84) */
diff --git a/arch/arm/plat-omap/include/syslink/notifyerr.h b/arch/arm/plat-omap/include/syslink/notifyerr.h
new file mode 100644
index 00000000000..0a14c0edc25
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/notifyerr.h
@@ -0,0 +1,198 @@
1/*
2 * notifyerr.h
3 *
4 * Notify driver support for OMAP Processors.
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15 */
16
17
18#if !defined NOTIFYERR_H
19#define NOTIFYERR_H
20
21
22/*
23 * name NOTIFY_SUCCEEDED
24 *
25 * desc Check if the provided status code indicates a success code.
26 *
27 * arg status
28 * Status code to be checked
29 *
30 * ret TRUE
31 * If status code indicates success
32 * FALSE
33 * If status code indicates failure
34 *
35 * enter None.
36 *
37 * leave None.
38 *
39 * see NOTIFY_FAILED
40 *
41 */
42#define NOTIFY_SUCCEEDED(status)\
43(((signed long int) (status) >= (NOTIFY_SBASE)) \
44&& ((signed long int) (status) <= (NOTIFY_SLAST)))
45
46
47/*
48 * @name NOTIFY_FAILED
49 *
50 * @desc Check if the provided status code indicates a failure code.
51 *
52 * @arg status
53 * Status code to be checked
54 *
55 * @ret TRUE
56 * If status code indicates failure
57 * FALSE
58 * If status code indicates success
59 *
60 * @enter None.
61 *
62 * @leave None.
63 *
64 * @see NOTIFY_FAILED
65 *
66 */
67#define NOTIFY_FAILED(status) (!NOTIFY_SUCCEEDED(status))
68
69
70
71/*
72 * name NOTIFY_SBASE, NOTIFY_SLAST
73 *
74 * desc Defines the base and range for the success codes used by the
75 * Notify module
76 *
77 */
78#define NOTIFY_SBASE (signed long int)0x00002000l
79#define NOTIFY_SLAST (signed long int)0x000020FFl
80
81/*
82 * name NOTIFY_EBASE, NOTIFY_ELAST
83 *
84 * desc Defines the base and range for the failure codes used by the
85 * Notify module
86 *
87 */
88#define NOTIFY_EBASE (signed long int)0x80002000l
89#define NOTIFY_ELAST (signed long int)0x800020FFl
90
91
92/*
93 * SUCCESS Codes
94 *
95 */
96
97/* Generic success code for Notify module */
98#define NOTIFY_SOK (NOTIFY_SBASE + 0x01l)
99
100/* Indicates that the Notify module (or driver) has already been initialized
101 * by another client, and this process has now successfully acquired the right
102 * to use the Notify module.
103 */
104#define NOTIFY_SALREADYINIT (NOTIFY_SBASE + 0x02l)
105
106/* Indicates that the Notify module (or driver) is now being finalized, since
107 * the calling client is the last one finalizing the module, and all open
108 * handles to it have been closed.
109 */
110#define NOTIFY_SEXIT (NOTIFY_SBASE + 0x03l)
111
112
113/*
114 * FAILURE Codes
115 *
116 */
117
118/* Generic failure code for Notify module */
119#define NOTIFY_EFAIL (NOTIFY_EBASE + 0x01l)
120
121/* This failure code indicates that an operation has timed out. */
122#define NOTIFY_ETIMEOUT (NOTIFY_EBASE + 0x02l)
123
124/* This failure code indicates a configuration error */
125#define NOTIFY_ECONFIG (NOTIFY_EBASE + 0x03l)
126
127/* This failure code indicates that the Notify module has already been
128 * initialized from the calling client (process).
129 */
130#define NOTIFY_EALREADYINIT (NOTIFY_EBASE + 0x04l)
131
132/* This failure code indicates that the specified entity was not found
133 * The interpretation of this error code depends on the function from which it
134 * was returned.
135 */
136#define NOTIFY_ENOTFOUND (NOTIFY_EBASE + 0x05l)
137
138/* This failure code indicates that the specified feature is not supported
139 * The interpretation of this error code depends on the function from which it
140 * was returned.
141 */
142#define NOTIFY_ENOTSUPPORTED (NOTIFY_EBASE + 0x06l)
143
144/* This failure code indicates that the specified event number is
145 * not supported
146 */
147#define NOTIFY_EINVALIDEVENT (NOTIFY_EBASE + 0x07l)
148
149/* This failure code indicates that the specified pointer is invalid */
150#define NOTIFY_EPOINTER (NOTIFY_EBASE + 0x08l)
151
152/* This failure code indicates that a provided parameter was outside its valid
153 * range.
154 * The interpretation of this error code depends on the function from which it
155 * was returned.
156 */
157#define NOTIFY_ERANGE (NOTIFY_EBASE + 0x09l)
158
159/* This failure code indicates that the specified handle is invalid */
160#define NOTIFY_EHANDLE (NOTIFY_EBASE + 0x0Al)
161
162/* This failure code indicates that an invalid argument was specified */
163#define NOTIFY_EINVALIDARG (NOTIFY_EBASE + 0x0Bl)
164
165/* This failure code indicates a memory related failure */
166#define NOTIFY_EMEMORY (NOTIFY_EBASE + 0x0Cl)
167
168/* This failure code indicates that the Notify module has not been initialized*/
169#define NOTIFY_EINIT (NOTIFY_EBASE + 0x0Dl)
170
171/* This failure code indicates that a resource was not available.
172 * The interpretation of this error code depends on the function from which it
173 * was returned.
174 */
175#define NOTIFY_ERESOURCE (NOTIFY_EBASE + 0x0El)
176
177/* This failure code indicates that there was an attempt to register for a
178 * reserved event.
179 */
180#define NOTIFY_ERESERVEDEVENT (NOTIFY_EBASE + 0x0Fl)
181
182/* This failure code indicates that the specified entity already exists.
183 * The interpretation of this error code depends on the function from which it
184 * was returned.
185 */
186#define NOTIFY_EALREADYEXISTS (NOTIFY_EBASE + 0x10l)
187
188/* This failure code indicates that the Notify driver has not been fully
189 * initialized
190 */
191#define NOTIFY_EDRIVERINIT (NOTIFY_EBASE + 0x11l)
192
193/* This failure code indicates that the other side is not ready to receive
194 * notifications.
195 */
196#define NOTIFY_ENOTREADY (NOTIFY_EBASE + 0x12l)
197
198#endif /* !defined (NOTIFYERR_H) */
diff --git a/arch/arm/plat-omap/include/syslink/platform.h b/arch/arm/plat-omap/include/syslink/platform.h
new file mode 100644
index 00000000000..9dbae5cf152
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/platform.h
@@ -0,0 +1,44 @@
1/*
2 * platform.h
3 *
4 * Defines the platform functions to be used by SysMgr module.
5 *
6 * Copyright (C) 2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18#ifndef _PLATFORM_H_
19#define _PLATFORM_H_
20
21#define PLATFORM_S_SUCCESS 0
22#define PLATFORM_E_FAIL -1
23#define PLATFORM_E_INVALIDARG -2
24
25/* =============================================================================
26 * APIs
27 * =============================================================================
28 */
29/* Function to setup the platform */
30s32 platform_setup(void);
31
32/* Function to destroy the platform */
33s32 platform_destroy(void);
34
35/* Function called when slave is loaded with executable */
36int platform_load_callback(u16 proc_id, void *arg);
37
38/* Function called when slave is in started state*/
39int platform_start_callback(u16 proc_id, void *arg);
40
41/* Function called when slave is stopped state */
42int platform_stop_callback(u16 proc_id, void *arg);
43
44#endif /* ifndef _PLATFORM_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/platform_mem.h b/arch/arm/plat-omap/include/syslink/platform_mem.h
new file mode 100644
index 00000000000..60d2c87d0f0
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/platform_mem.h
@@ -0,0 +1,136 @@
1/*
2 * platform_mem.c
3 *
4 * Target memory management interface implementation.
5 *
6 * This abstracts the Memory management interface in the kernel
7 * code. Allocation, Freeing-up, copy and address translate are
8 * supported for the kernel memory management.
9 *
10 * Copyright (C) 2008-2009 Texas Instruments, Inc.
11 *
12 * This package is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 *
16 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE.
20 */
21
22#ifndef _PLATFORM_MEM_H_
23#define _PLATFORM_MEM_H_
24
25#include <linux/types.h>
26
27/*
28 * MEMORYOS_MODULEID
29 * Module ID for platform mem module
30 */
31#define PLATFORM_MEM_MODULEID (u16) 0x97D2
32
33/*
34 * Enumerates the types of caching for memory regions
35 */
36enum platform_mem_cache_flags {
37 PLATFORM_MEM_CACHE_FLAGS_DEFAULT = 0x00000000,
38 /* Default flags - Cached */
39 PLATFORM_MEM_CACHE_FLAGS_CACHED = 0x00010000,
40 /* Cached memory */
41 PLATFORM_MEM_CACHE_FLAGS_UNCACHED = 0x00020000,
42 /* Uncached memory */
43 PLATFORM_MEM_CACHE_FLAGS_END_VALUE = 0x00030000
44 /* End delimiter indicating start of invalid values for this enum */
45};
46
47/*
48 * Enumerates the types of memory allocation
49 */
50enum platform_mem_mtype_flags{
51 PLATFORM_MEM_MTYPE_FLAGS_DEFAULT = 0x00000000,
52 /* Default flags - virtually contiguous */
53 PLATFORM_MEM_MTYPE_FLAGS_PHYSICAL = 0x00000001,
54 /* Physically contiguous */
55 PLATFORM_MEM_MTYPE_FLAGS_DMA = 0x00000002,
56 /* Physically contiguous */
57 PLATFORM_MEM_MTYPE_FLAGS_END_VALUE = 0x00000003
58 /* End delimiter indicating start of invalid values for this enum */
59};
60
61/*
62 * Enumerates the types of translation
63 */
64enum memory_xlt_flags{
65 PLATFORM_MEM_XLT_FLAGS_VIRT2PHYS = 0x00000000,
66 /* Virtual to physical */
67 PLATFORM_MEM_XLT_FLAGS_PHYS2VIRT = 0x00000001,
68 /* Virtual to physical */
69 PLATFORM_MEM_XLT_FLAGS_END_VALUE = 0x00000002
70 /* End delimiter indicating start of invalid values for this enum */
71};
72
73/*
74 * Structure containing information required for mapping a
75 * memory region.
76 */
77struct platform_mem_map_info {
78 u32 src;
79 /* Address to be mapped. */
80 u32 size;
81 /* Size of memory region to be mapped. */
82 u32 dst;
83 /* Mapped address. */
84 bool is_cached;
85 /* Whether the mapping is to a cached area or uncached area. */
86 void *drv_handle;
87 /* Handle to the driver that is implementing the mmap call. Ignored for
88 Kernel-side version. */
89};
90
91/*
92 * Structure containing information required for unmapping a
93 * memory region.
94 */
95struct platform_mem_unmap_info {
96 u32 addr;
97 /* Address to be unmapped.*/
98 u32 size;
99 /* Size of memory region to be unmapped.*/
100 bool is_cached;
101 /* Whether the mapping is to a cached area or uncached area. */
102};
103
104/*
105 * Structure containing information required for mapping a
106 * memory region.
107 */
108#define memory_map_info struct platform_mem_map_info
109
110/*
111 * Structure containing information required for unmapping a
112 * memory region.
113 */
114#define memory_unmap_info struct platform_mem_unmap_info
115
116
117/* =============================================================================
118 * APIs
119 * =============================================================================
120 */
121/* Initialize the platform mem module. */
122int platform_mem_setup(void);
123
124/* Finalize the platform mem module. */
125int platform_mem_destroy(void);
126
127/* Maps a memory area into virtual space. */
128int platform_mem_map(memory_map_info *map_info);
129
130/* Unmaps a memory area into virtual space. */
131int platform_mem_unmap(memory_unmap_info *unmap_info);
132
133/* Translate API */
134void *platform_mem_translate(void *srcAddr, enum memory_xlt_flags flags);
135
136#endif /* ifndef _PLATFORM_MEM_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/procmgr.h b/arch/arm/plat-omap/include/syslink/procmgr.h
new file mode 100644
index 00000000000..5e538658a06
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/procmgr.h
@@ -0,0 +1,244 @@
1/*
2 * procmgr.h
3 *
4 * Syslink driver support functions for TI OMAP processors.
5 *
6 * Copyright (C) 2009-2010 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15 */
16#ifndef SYSLINK_PROC_MGR_H
17#define SYSLINK_PROC_MGR_H
18
19#include <linux/types.h>
20#include <syslink/multiproc.h>
21
22
23
24#define PROCMGR_MODULEID 0xf2ba
25
26/*
27 * Maximum name length for ProcMgr module strings.
28 */
29#define PROCMGR_MAX_STRLEN 32
30
31/*
32 * Maximum number of memory regions supported by ProcMgr module.
33 */
34#define PROCMGR_MAX_MEMORY_REGIONS 32
35
36/*
37 * IS_VALID_PROCID
38 * Checks if the Processor ID is valid
39 */
40#define IS_VALID_PROCID(id) (id < MULTIPROC_MAXPROCESSORS)
41
42
43/*
44 * Enumerations to indicate Processor states.
45 */
46enum proc_mgr_state {
47 PROC_MGR_STATE_UNKNOWN = 0,
48 /* Unknown Processor state (e.g. at startup or error). */
49 PROC_MGR_STATE_POWERED = 1,
50 /* Indicates the Processor is powered up. */
51 PROC_MGR_STATE_RESET = 2,
52 /* Indicates the Processor is reset. */
53 PROC_MGR_STATE_LOADED = 3,
54 /* Indicates the Processor is loaded. */
55 PROC_MGR_STATE_RUNNNING = 4,
56 /* Indicates the Processor is running. */
57 PROC_MGR_STATE_UNAVAILABLE = 5,
58 /* Indicates the Processor is unavailable to the physical transport. */
59 PROC_MGR_STATE_ENDVALUE = 6
60 /* End delimiter indicating start of invalid values for this enum */
61};
62
63/*
64 * Enumerations to indicate different types of slave boot modes.
65 */
66enum proc_mgr_boot_mode {
67 PROC_MGR_BOOTMODE_BOOT = 0,
68 /* ProcMgr is responsible for loading the slave and its reset control */
69 PROC_MGR_BOOTMODE_NOLOAD = 1,
70 /* ProcMgr is not responsible for loading the slave. It is responsible
71 for reset control of the slave. */
72 PROC_MGR_BOOTMODE_NOBOOT = 2,
73 /* ProcMgr is not responsible for loading or reset control of the slave.
74 The slave either self-boots, or this is done by some entity outside of
75 the ProcMgr module. */
76 PROC_MGR_BOOTMODE_ENDVALUE = 3
77 /* End delimiter indicating start of invalid values for this enum */
78} ;
79
80/*
81 * Enumerations to indicate address types used for translation
82 */
83enum proc_mgr_addr_type{
84 PROC_MGR_ADDRTYPE_MASTERKNLVIRT = 0,
85 /* Kernel Virtual address on master processor */
86 PROC_MGR_ADDRTYPE_MASTERUSRVIRT = 1,
87 /* User Virtual address on master processor */
88 PROC_MGR_ADDRTYPE_SLAVEVIRT = 2,
89 /* Virtual address on slave processor */
90 PROC_MGR_ADDRTYPE_ENDVALUE = 3
91 /* End delimiter indicating start of invalid values for this enum */
92};
93
94/*
95 * Enumerations to indicate types of address mapping
96 */
97enum proc_mgr_map_type {
98 PROC_MGR_MAPTYPE_VIRT = 0,
99 /* Map/unmap to virtual address space (kernel/user) */
100 PROC_MGR_MAPTYPE_SLAVE = 1,
101 /* Map/unmap to slave address space */
102 PROC_MGR_MAPTYPE_ENDVALUE = 2
103 /* End delimiter indicating start of invalid values for this enum */
104};
105
106/*
107 * Module configuration structure.
108 */
109struct proc_mgr_config {
110 void *gate_handle;
111} ;
112
113/*
114 * Configuration parameters specific to the slave ProcMgr instance.
115 */
116struct proc_mgr_params {
117 void *proc_handle;
118 /* void * to the Processor object associated with this ProcMgr. */
119 void *loader_handle;
120 /*!< Handle to the Loader object associated with this ProcMgr. */
121 void *pwr_handle;
122 /*!< Handle to the PwrMgr object associated with this ProcMgr. */
123};
124
125/*
126 * Configuration parameters specific to the slave ProcMgr instance.
127 */
128struct proc_mgr_attach_params {
129 enum proc_mgr_boot_mode boot_mode;
130 /* Boot mode for the slave processor. */
131} ;
132
133
134/*
135 * This structure defines information about memory regions mapped by
136 * the ProcMgr module.
137 */
138struct proc_mgr_addr_info {
139/* bool is_init; */
140 unsigned short is_init;
141 /* Is this memory region initialized? */
142 u32 addr[PROC_MGR_ADDRTYPE_ENDVALUE];
143 /* Addresses for each type of address space */
144 u32 size;
145 /* Size of the memory region in bytes */
146};
147
148/*
149 * Characteristics of the slave processor
150 */
151struct proc_mgr_proc_info {
152 enum proc_mgr_boot_mode boot_mode;
153 /* Boot mode of the processor. */
154 u16 num_mem_entries;
155 /* Number of valid memory entries */
156 struct proc_mgr_addr_info mem_entries[PROCMGR_MAX_MEMORY_REGIONS];
157 /* Configuration of memory regions */
158};
159
160
161/*
162 * Function pointer type that is passed to the proc_mgr_registerNotify function
163*/
164typedef int (*proc_mgr_callback_fxn)(u16 proc_id, void *handle,
165 enum proc_mgr_state from_state, enum proc_mgr_state to_state);
166
167/* Function to get the default configuration for the ProcMgr module. */
168void proc_mgr_get_config(struct proc_mgr_config *cfg);
169
170/* Function to setup the ProcMgr module. */
171int proc_mgr_setup(struct proc_mgr_config *cfg);
172
173/* Function to destroy the ProcMgr module. */
174int proc_mgr_destroy(void);
175
176/* Function to initialize the parameters for the ProcMgr instance. */
177void proc_mgr_params_init(void *handle, struct proc_mgr_params *params);
178
179/* Function to create a ProcMgr object for a specific slave processor. */
180void *proc_mgr_create(u16 proc_id, const struct proc_mgr_params *params);
181
182/* Function to delete a ProcMgr object for a specific slave processor. */
183int proc_mgr_delete(void **handle_ptr);
184
185/* Function to open a handle to an existing ProcMgr object handling the
186 * proc_id.
187 */
188int proc_mgr_open(void **handle, u16 proc_id);
189
190/* Function to close this handle to the ProcMgr instance. */
191int proc_mgr_close(void *handle);
192
193/* Function to initialize the parameters for the ProcMgr attach function. */
194void proc_mgr_get_attach_params(void *handle,
195 struct proc_mgr_attach_params *params);
196
197/* Function to attach the client to the specified slave and also initialize the
198 * slave(if required).
199 */
200int proc_mgr_attach(void *handle, struct proc_mgr_attach_params *params);
201
202/* Function to detach the client from the specified slave and also finalze the
203 * slave(if required).
204 */
205int proc_mgr_detach(void *handle);
206
207/* Function to get the current state of the slave Processor as maintained on
208 * the master Processor state machine.
209 */
210enum proc_mgr_state proc_mgr_get_state(void *handle);
211
212/* Function to read from the slave Processor's memory space. */
213int proc_mgr_read(void *handle, u32 proc_addr, u32 *num_bytes,
214 void *buffer);
215
216/* Function to read from the slave Processor's memory space. */
217int proc_mgr_write(void *handle, u32 proc_addr, u32 *num_bytes, void *buffer);
218
219/* Function that provides a hook for performing device dependent operations on
220 * the slave Processor.
221 */
222int proc_mgr_control(void *handle, int cmd, void *arg);
223
224int proc_mgr_translate_addr(void *handle, void **dst_addr,
225 enum proc_mgr_addr_type dst_addr_type, void *src_addr,
226 enum proc_mgr_addr_type src_addr_type);
227
228/* Function that registers for notification when the slave processor
229 * transitions to any of the states specified.
230 */
231int proc_mgr_register_notify(void *handle, proc_mgr_callback_fxn fxn,
232 void *args, enum proc_mgr_state state[]);
233
234/* Function that returns information about the characteristics of the slave
235 * processor.
236 */
237int proc_mgr_get_proc_info(void *handle, struct proc_mgr_proc_info *proc_info);
238
239/* Function that returns virtual to physical translations
240 */
241int proc_mgr_virt_to_phys(void *handle, u32 da, u32 *mapped_entries,
242 u32 num_of_entries);
243
244#endif
diff --git a/arch/arm/plat-omap/include/syslink/sharedregion.h b/arch/arm/plat-omap/include/syslink/sharedregion.h
new file mode 100644
index 00000000000..ca644e7ebcd
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/sharedregion.h
@@ -0,0 +1,244 @@
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
54struct 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 */
76struct 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 */
110struct 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 */
120int sharedregion_get_config(struct sharedregion_config *config);
121
122/*
123 * Function to setup the SharedRegion module
124 */
125int sharedregion_setup(const struct sharedregion_config *config);
126
127/*
128 * Function to destroy the SharedRegion module
129 */
130int 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 */
137int sharedregion_start(void);
138
139/*
140 * Function to stop Shared Region 0
141 */
142int sharedregion_stop(void);
143
144/*
145 * Opens a heap, for non-owner processors, for each SharedRegion.
146 */
147int sharedregion_attach(u16 remote_proc_id);
148
149/*
150 * Closes a heap, for non-owner processors, for each SharedRegion.
151 */
152int sharedregion_detach(u16 remote_proc_id);
153
154/*
155 * Reserve shared region memory
156 */
157void *sharedregion_reserve_memory(u16 id, u32 size);
158
159/*
160 * Reserve shared region memory
161 */
162void sharedregion_unreserve_memory(u16 id, u32 size);
163
164/*
165 * Sets the entry at the specified region id(doesn't create heap)
166 */
167int _sharedregion_set_entry(u16 region_id, struct sharedregion_entry *entry);
168
169/*
170 * Function to clear the reserved memory
171 */
172void sharedregion_clear_reserved_memory(void);
173
174/*
175 * Return the region info
176 */
177void sharedregion_get_region_info(u16 i, struct sharedregion_region *region);
178
179/*
180 * Clears the entry at the specified region id
181 */
182int sharedregion_clear_entry(u16 region_id);
183
184/*
185 * Initializes the entry fields
186 */
187void sharedregion_entry_init(struct sharedregion_entry *entry);
188
189/*
190 * Gets the cache line size for the specified region id
191 */
192uint sharedregion_get_cache_line_size(u16 region_id);
193
194/*
195 * Gets the entry information for the specified region id
196 */
197int sharedregion_get_entry(u16 region_id, struct sharedregion_entry *entry);
198
199/*
200 * Gets the heap associated with the specified region id
201 */
202void *sharedregion_get_heap(u16 region_id);
203
204/*
205 * Gets the region id for the specified address
206 */
207u16 sharedregion_get_id(void *addr);
208
209/*
210 * Gets the id of a region, given the name
211 */
212u16 sharedregion_get_id_by_name(char *name);
213
214/*
215 * Gets the number of regions
216 */
217u16 sharedregion_get_num_regions(void);
218
219/*
220 * Returns the address pointer associated with the shared region pointer
221 */
222void *sharedregion_get_ptr(u32 *srptr);
223
224/*
225 * Returns the shared region pointer
226 */
227u32 *sharedregion_get_srptr(void *addr, u16 index);
228
229/*
230 * whether cache enable was specified
231 */
232bool sharedregion_is_cache_enabled(u16 region_id);
233
234/*
235 * Sets the entry at the specified region id
236 */
237int sharedregion_set_entry(u16 region_id, struct sharedregion_entry *entry);
238
239/*
240 * Whether address translation is enabled
241 */
242bool sharedregion_translate_enabled(void);
243
244#endif /* _SHAREDREGION_H */
diff --git a/arch/arm/plat-omap/include/syslink/sharedregion_ioctl.h b/arch/arm/plat-omap/include/syslink/sharedregion_ioctl.h
new file mode 100644
index 00000000000..adff03f0434
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/sharedregion_ioctl.h
@@ -0,0 +1,189 @@
1/*
2 * sharedregion_ioctl.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_IOCTL_H
21#define _SHAREDREGION_IOCTL_H
22
23#include <linux/ioctl.h>
24#include <linux/types.h>
25
26#include <ipc_ioctl.h>
27#include <sharedregion.h>
28
29enum CMD_SHAREDREGION {
30 SHAREDREGION_GETCONFIG = SHAREDREGION_BASE_CMD,
31 SHAREDREGION_SETUP,
32 SHAREDREGION_DESTROY,
33 SHAREDREGION_START,
34 SHAREDREGION_STOP,
35 SHAREDREGION_ATTACH,
36 SHAREDREGION_DETACH,
37 SHAREDREGION_GETHEAP,
38 SHAREDREGION_CLEARENTRY,
39 SHAREDREGION_SETENTRY,
40 SHAREDREGION_RESERVEMEMORY,
41 SHAREDREGION_CLEARRESERVEDMEMORY,
42 SHAREDREGION_GETREGIONINFO
43};
44
45/*
46 * IOCTL command IDs for sharedregion
47 *
48 */
49
50/*
51 * Command for sharedregion_get_config
52 */
53#define CMD_SHAREDREGION_GETCONFIG _IOWR(IPC_IOC_MAGIC, \
54 SHAREDREGION_GETCONFIG, \
55 struct sharedregion_cmd_args)
56/*
57 * Command for sharedregion_setup
58 */
59#define CMD_SHAREDREGION_SETUP _IOWR(IPC_IOC_MAGIC, \
60 SHAREDREGION_SETUP, \
61 struct sharedregion_cmd_args)
62/*
63 * Command for sharedregion_setup
64 */
65#define CMD_SHAREDREGION_DESTROY _IOWR(IPC_IOC_MAGIC, \
66 SHAREDREGION_DESTROY, \
67 struct sharedregion_cmd_args)
68/*
69 * Command for sharedregion_start
70 */
71#define CMD_SHAREDREGION_START _IOWR(IPC_IOC_MAGIC, \
72 SHAREDREGION_START, \
73 struct sharedregion_cmd_args)
74/*
75 * Command for sharedregion_stop
76 */
77#define CMD_SHAREDREGION_STOP _IOWR(IPC_IOC_MAGIC, \
78 SHAREDREGION_STOP, \
79 struct sharedregion_cmd_args)
80/*
81 * Command for sharedregion_attach
82 */
83#define CMD_SHAREDREGION_ATTACH _IOWR(IPC_IOC_MAGIC, \
84 SHAREDREGION_ATTACH, \
85 struct sharedregion_cmd_args)
86/*
87 * Command for sharedregion_detach
88 */
89#define CMD_SHAREDREGION_DETACH _IOWR(IPC_IOC_MAGIC, \
90 SHAREDREGION_DETACH, \
91 struct sharedregion_cmd_args)
92/*
93 * Command for sharedregion_get_heap
94 */
95#define CMD_SHAREDREGION_GETHEAP _IOWR(IPC_IOC_MAGIC, \
96 SHAREDREGION_GETHEAP, \
97 struct sharedregion_cmd_args)
98/*
99 * Command for sharedregion_clear_entry
100 */
101#define CMD_SHAREDREGION_CLEARENTRY _IOWR(IPC_IOC_MAGIC, \
102 SHAREDREGION_CLEARENTRY, \
103 struct sharedregion_cmd_args)
104/*
105 * Command for sharedregion_set_entry
106 */
107#define CMD_SHAREDREGION_SETENTRY _IOWR(IPC_IOC_MAGIC, \
108 SHAREDREGION_SETENTRY, \
109 struct sharedregion_cmd_args)
110/*
111 * Command for sharedregion_reserve_memory
112 */
113#define CMD_SHAREDREGION_RESERVEMEMORY _IOWR(IPC_IOC_MAGIC, \
114 SHAREDREGION_RESERVEMEMORY, \
115 struct sharedregion_cmd_args)
116/*
117 * Command for sharedregion_clear_reserved_memory
118 */
119#define CMD_SHAREDREGION_CLEARRESERVEDMEMORY \
120 _IOWR(IPC_IOC_MAGIC, \
121 SHAREDREGION_CLEARRESERVEDMEMORY, \
122 struct sharedregion_cmd_args)
123/*
124 * Command for sharedregion_get_region_info
125 */
126#define CMD_SHAREDREGION_GETREGIONINFO _IOWR(IPC_IOC_MAGIC, \
127 SHAREDREGION_GETREGIONINFO, \
128 struct sharedregion_cmd_args)
129
130/*
131 * Command arguments for sharedregion
132 */
133union sharedregion_arg {
134 struct {
135 struct sharedregion_config *config;
136 } get_config;
137
138 struct {
139 struct sharedregion_region *regions;
140 struct sharedregion_config *config;
141 } setup;
142
143 struct {
144 struct sharedregion_region *regions;
145 } get_region_info;
146
147 struct {
148 u16 remote_proc_id;
149 } attach;
150
151 struct {
152 u16 remote_proc_id;
153 } detach;
154
155 struct {
156 u16 id;
157 void *heap_handle;
158 } get_heap;
159
160 struct {
161 u16 id;
162 struct sharedregion_entry entry;
163 } set_entry;
164
165 struct {
166 u16 id;
167 } clear_entry;
168
169 struct {
170 u16 id;
171 u32 size;
172 } reserve_memory;
173};
174
175/*
176 * Command arguments for sharedregion
177 */
178struct sharedregion_cmd_args {
179 union sharedregion_arg args;
180 s32 api_status;
181};
182
183/*
184 * This ioctl interface for sharedregion module
185 */
186int sharedregion_ioctl(struct inode *inode, struct file *filp,
187 unsigned int cmd, unsigned long args, bool user);
188
189#endif /* _SHAREDREGION_IOCTL_H */
diff --git a/arch/arm/plat-omap/include/syslink/sysipc_ioctl.h b/arch/arm/plat-omap/include/syslink/sysipc_ioctl.h
new file mode 100644
index 00000000000..d6f4428e716
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/sysipc_ioctl.h
@@ -0,0 +1,118 @@
1/*
2 * sysipc_ioctl.h
3 *
4 * Definitions of sysmgr driver types and structures..
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18#ifndef _SYSIPC_IOCTL_H_
19#define _SYSIPC_IOCTL_H_
20
21/* Standard headers */
22#include <linux/types.h>
23
24/* Syslink headers */
25#include <ipc_ioctl.h>
26#include <ipc.h>
27
28
29/* =============================================================================
30 * Macros and types
31 * =============================================================================
32 */
33/* ----------------------------------------------------------------------------
34 * IOCTL command IDs for sysmgr
35 * ----------------------------------------------------------------------------
36 */
37/* IOC Magic Number for sysmgr */
38#define SYSIPC_IOC_MAGIC IPC_IOC_MAGIC
39
40/* IOCTL command numbers for ipc/sysipc */
41enum sysipc_drv_cmd {
42 IPC_SETUP = IPC_BASE_CMD,
43 IPC_DESTROY,
44 IPC_CONTROL,
45 IPC_READCONFIG,
46 IPC_WRITECONFIG
47 };
48
49/* Command for ipc_setup */
50#define CMD_IPC_SETUP \
51 _IOWR(SYSIPC_IOC_MAGIC, IPC_SETUP, \
52 struct sysipc_cmd_args)
53
54/* Command for ipc_destroy */
55#define CMD_IPC_DESTROY \
56 _IOWR(SYSIPC_IOC_MAGIC, IPC_DESTROY, \
57 struct sysipc_cmd_args)
58
59/* Command for load callback */
60#define CMD_IPC_CONTROL \
61 _IOWR(SYSIPC_IOC_MAGIC, IPC_CONTROL, \
62 struct sysipc_cmd_args)
63
64/* Command for ipc_read_config */
65#define CMD_IPC_READCONFIG \
66 _IOWR(SYSIPC_IOC_MAGIC, IPC_READCONFIG, \
67 struct sysipc_cmd_args)
68
69/* Command for ipc_write_config */
70#define CMD_IPC_WRITECONFIG \
71 _IOWR(SYSIPC_IOC_MAGIC, IPC_WRITECONFIG, \
72 struct sysipc_cmd_args)
73
74
75/* ----------------------------------------------------------------------------
76 * Command arguments for sysmgr
77 * ----------------------------------------------------------------------------
78 */
79/* Command arguments for sysmgr */
80struct sysipc_cmd_args {
81 union {
82 struct {
83 u16 proc_id;
84 s32 cmd_id;
85 void *arg;
86 } control;
87
88 struct {
89 u16 remote_proc_id;
90 u32 tag;
91 void *cfg;
92 u32 size;
93 } read_config;
94
95 struct {
96 u16 remote_proc_id;
97 u32 tag;
98 void *cfg;
99 u32 size;
100 } write_config;
101
102 struct {
103 struct ipc_config *config;
104 } setup;
105 } args;
106
107 s32 api_status;
108};
109
110/* ----------------------------------------------------------------------------
111 * IOCTL functions for sysmgr module
112 * ----------------------------------------------------------------------------
113 */
114/* ioctl interface function for sysmgr */
115int sysipc_ioctl(struct inode *inode, struct file *filp,
116 unsigned int cmd, unsigned long args, bool user);
117
118#endif /* _SYSIPC_IOCTL_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/sysmemmgr.h b/arch/arm/plat-omap/include/syslink/sysmemmgr.h
new file mode 100644
index 00000000000..34c3b418228
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/sysmemmgr.h
@@ -0,0 +1,179 @@
1/*
2 * sysmemmgr.h
3 *
4 * Manager for the Slave system memory. Slave system level memory is allocated
5 * through this module.
6 *
7 * Copyright (C) 2009 Texas Instruments, Inc.
8 *
9 * This package is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE.
17 */
18
19
20#ifndef _SYSTEMMEMORYMANAGER_H_
21#define _SYSTEMMEMORYMANAGER_H_
22
23
24/*!
25 * @def SYSMEMMGR_MODULEID
26 * @brief Module identifier for System memory manager.
27 */
28#define SYSMEMMGR_MODULEID (0xb53d)
29
30/*!
31 * @def SYSMEMMGR_STATUSCODEBASE
32 * @brief Error code base for system memory manager module.
33 */
34#define SYSMEMMGR_STATUSCODEBASE (SYSMEMMGR_MODULEID << 12u)
35
36/*!
37 * @def SYSMEMMGR_MAKE_ERROR
38 * @brief Macro to make error code.
39 */
40#define SYSMEMMGR_MAKE_ERROR(x) ((int)(0x80000000 + \
41 (SYSMEMMGR_STATUSCODEBASE + \
42 (x))))
43
44/*!
45 * @def SYSMEMMGR_MAKE_SUCCESS
46 * @brief Macro to make success code.
47 */
48#define SYSMEMMGR_MAKE_SUCCESS(x) (SYSMEMMGR_STATUSCODEBASE + (x))
49
50/*!
51 * @def SYSMEMMGR_E_CREATEALLOCATOR
52 * @brief Static allocator creation failed.
53 */
54#define SYSMEMMGR_E_CREATEALLOCATOR SYSMEMMGR_MAKE_ERROR(1)
55
56/*!
57 * @def SYSMEMMGR_E_CREATELOCK
58 * @brief Mutex lock creation failed.
59 */
60#define SYSMEMMGR_E_CREATELOCK SYSMEMMGR_MAKE_ERROR(2)
61
62/*!
63 * @def SYSMEMMGR_E_INVALIDSTATE
64 * @brief Module is not initialized.
65 */
66#define SYSMEMMGR_E_INVALIDSTATE SYSMEMMGR_MAKE_ERROR(3)
67
68/*!
69 * @def SYSMEMMGR_E_INVALIDARG
70 * @brief Argument passed to a function is invalid.
71 */
72#define SYSMEMMGR_E_INVALIDARG SYSMEMMGR_MAKE_ERROR(4)
73
74/*!
75 * @def SYSMEMMGR_E_BPAFREE
76 * @brief Freeing to buddy allocator failed.
77 */
78#define SYSMEMMGR_E_BPAFREE SYSMEMMGR_MAKE_ERROR(5)
79
80/*!
81 * @def SYSMEMMGR_E_MEMORY
82 * @brief Memory allocation failed.
83 */
84#define SYSMEMMGR_E_MEMORY SYSMEMMGR_MAKE_ERROR(6)
85
86/*!
87 * @def SYSMEMMGR_SUCCESS
88 * @brief Operation successful.
89 */
90#define SYSMEMMGR_SUCCESS SYSMEMMGR_MAKE_SUCCESS(0)
91
92/*!
93 * @def SYSMEMMGR_S_ALREADYSETUP
94 * @brief Module already initialized.
95 */
96#define SYSMEMMGR_S_ALREADYSETUP SYSMEMMGR_MAKE_SUCCESS(1)
97
98/*!
99 * @def SYSMEMMGR_S_DRVALREADYOPENED
100 * @brief Internal OS Driver is already opened.
101 */
102#define SYSMEMMGR_S_DRVALREADYOPENED SYSMEMMGR_MAKE_SUCCESS(2)
103
104/*!
105 * @brief Configuration data structure of system memory manager.
106 */
107struct sysmemmgr_config {
108 u32 sizeof_valloc;
109 /* Total size for virtual memory allocation */
110 u32 sizeof_palloc;
111 /* Total size for physical memory allocation */
112 u32 static_phys_base_addr;
113 /* Physical address of static memory region */
114 u32 static_virt_base_addr;
115 /* Virtual address of static memory region */
116 u32 static_mem_size;
117 /* size of static memory region */
118 u32 page_size;
119 /* Page size */
120 u32 event_no;
121 /* Event number to be used */
122};
123
124/*!
125 * @brief Flag used for allocating memory blocks.
126 */
127enum sysmemmgr_allocflag {
128 sysmemmgr_allocflag_uncached = 0u,
129 /* Flag used for allocating uncacheable block */
130 sysmemmgr_allocflag_cached = 1u,
131 /* Flag used for allocating cacheable block */
132 sysmemmgr_allocflag_physical = 2u,
133 /* Flag used for allocating physically contiguous block */
134 sysmemmgr_allocflag_virtual = 3u,
135 /* Flag used for allocating virtually contiguous block */
136 sysmemmgr_allocflag_dma = 4u
137 /* Flag used for allocating DMAable (physically contiguous) block */
138};
139
140/*!
141 * @brief Flag used for translating address.
142 */
143enum sysmemmgr_xltflag {
144 sysmemmgr_xltflag_kvirt2phys = 0x0001u,
145 /* Flag used for converting Kernel virtual address to physical
146 * address */
147 sysmemmgr_xltflag_kvirt2uvirt = 0x0002u,
148 /* Flag used for converting Kernel virtual address to user virtual
149 * address */
150 sysmemmgr_xltflag_uvirt2phys = 0x0003u,
151 /* Flag used for converting user virtual address to physical address */
152 sysmemmgr_xltflag_uvirt2kvirt = 0x0004u,
153 /* Flag used for converting user virtual address to Kernel virtual
154 * address */
155 sysmemmgr_xltflag_phys2kvirt = 0x0005u,
156 /* Flag used for converting physical address to user virtual address */
157 sysmemmgr_xltflag_phys2uvirt = 0x0006u
158 /* Flag used for converting physical address to Kernel virtual
159 * address */
160};
161
162
163/* Function prototypes */
164void sysmemmgr_get_config(struct sysmemmgr_config *config);
165
166int sysmemmgr_setup(struct sysmemmgr_config *params);
167
168int sysmemmgr_destroy(void);
169
170int sysmemmgr_attach(u16 slave_id);
171
172void *sysmemmgr_alloc(u32 size, enum sysmemmgr_allocflag flag);
173
174int sysmemmgr_free(void *blk, u32 size, enum sysmemmgr_allocflag flag);
175
176void *sysmemmgr_translate(void *srcAddr, enum sysmemmgr_xltflag flag);
177
178
179#endif /* _SYSTEMMEMORYMANAGER_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/sysmemmgr_ioctl.h b/arch/arm/plat-omap/include/syslink/sysmemmgr_ioctl.h
new file mode 100644
index 00000000000..4b0d9961556
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/sysmemmgr_ioctl.h
@@ -0,0 +1,130 @@
1/*
2 * sysmemmgr_ioctl.h
3 *
4 * Definitions of sysmemmgr driver types and structures..
5 *
6 * Copyright (C) 2008-2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18#ifndef _SYSMEMMGR_IOCTL_H_
19#define _SYSMEMMGR_IOCTL_H_
20
21/* Standard headers */
22#include <linux/types.h>
23
24/* Syslink headers */
25#include <ipc_ioctl.h>
26#include <sysmgr.h>
27
28
29/* =============================================================================
30 * Macros and types
31 * =============================================================================
32 */
33/* ----------------------------------------------------------------------------
34 * IOCTL command IDs for sysmemmgr
35 * ----------------------------------------------------------------------------
36 */
37/* IOC Magic Number for sysmemmgr */
38#define SYSMEMMGR_IOC_MAGIC IPC_IOC_MAGIC
39
40/* IOCTL command numbers for sysmemmgr */
41enum sysmemmgr_drv_cmd {
42 SYSMEMMGR_GETCONFIG = SYSMEMMGR_BASE_CMD,
43 SYSMEMMGR_SETUP,
44 SYSMEMMGR_DESTROY,
45 SYSMEMMGR_ALLOC,
46 SYSMEMMGR_FREE,
47 SYSMEMMGR_TRANSLATE
48};
49
50/* Command for sysmemmgr_getConfig */
51#define CMD_SYSMEMMGR_GETCONFIG \
52 _IOWR(SYSMEMMGR_IOC_MAGIC, SYSMEMMGR_GETCONFIG, \
53 struct sysmemmgr_cmd_args)
54
55/* Command for sysmemmgr_setup */
56#define CMD_SYSMEMMGR_SETUP \
57 _IOWR(SYSMEMMGR_IOC_MAGIC, SYSMEMMGR_SETUP, \
58 struct sysmemmgr_cmd_args)
59
60/* Command for sysmemmgr_destroy */
61#define CMD_SYSMEMMGR_DESTROY \
62 _IOWR(SYSMEMMGR_IOC_MAGIC, SYSMEMMGR_DESTROY, \
63 struct sysmemmgr_cmd_args)
64
65/* Command for sysmemmgr_alloc */
66#define CMD_SYSMEMMGR_ALLOC \
67 _IOWR(SYSMEMMGR_IOC_MAGIC, SYSMEMMGR_ALLOC, \
68 struct sysmemmgr_cmd_args)
69
70/* Command for sysmemmgr_free */
71#define CMD_SYSMEMMGR_FREE \
72 _IOWR(SYSMEMMGR_IOC_MAGIC, SYSMEMMGR_FREE, \
73 struct sysmemmgr_cmd_args)
74
75/* Command for sysmemmgr_translate */
76#define CMD_SYSMEMMGR_TRANSLATE \
77 _IOWR(SYSMEMMGR_IOC_MAGIC, SYSMEMMGR_TRANSLATE, \
78 struct sysmemmgr_cmd_args)
79
80
81/* ----------------------------------------------------------------------------
82 * Command arguments for sysmemmgr
83 * ----------------------------------------------------------------------------
84 */
85/* Command arguments for sysmemmgr */
86struct sysmemmgr_cmd_args {
87 union {
88 struct {
89 struct sysmemmgr_config *config;
90 } get_config;
91
92 struct {
93 struct sysmemmgr_config *config;
94 } setup;
95
96 struct {
97 u32 size;
98 void *buf;
99 void *phys;
100 void *kbuf;
101 enum sysmemmgr_allocflag flags;
102 } alloc;
103
104 struct {
105 u32 size;
106 void *buf;
107 void *phys;
108 void *kbuf;
109 enum sysmemmgr_allocflag flags;
110 } free;
111
112 struct {
113 void *buf;
114 void *ret_ptr;
115 enum sysmemmgr_xltflag flags;
116 } translate;
117 } args;
118
119 s32 api_status;
120};
121
122/* ----------------------------------------------------------------------------
123 * IOCTL functions for sysmemmgr module
124 * ----------------------------------------------------------------------------
125 */
126/* ioctl interface function for sysmemmgr */
127int sysmemmgr_ioctl(struct inode *inode, struct file *filp,
128 unsigned int cmd, unsigned long args);
129
130#endif /* SYSMEMMGR_DRVDEFS_H_0xF414 */
diff --git a/arch/arm/plat-omap/include/syslink/sysmgr.h b/arch/arm/plat-omap/include/syslink/sysmgr.h
new file mode 100644
index 00000000000..19fab220b2c
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/sysmgr.h
@@ -0,0 +1,182 @@
1/*
2 * sysmgr.h
3 *
4 * Defines for System manager.
5 *
6 * Copyright (C) 2009 Texas Instruments, Inc.
7 *
8 * This package is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
15 * PURPOSE.
16 */
17
18#ifndef _SYSMGR_H_
19#define _SYSMGR_H_
20
21
22/* Module headers */
23#include <multiproc.h>
24#include <gatepeterson.h>
25#include <sharedregion.h>
26#include <listmp.h>
27#include <listmp_sharedmemory.h>
28#include <messageq.h>
29#include <messageq_transportshm.h>
30#include <notify.h>
31#include <notify_ducatidriver.h>
32#include <nameserver.h>
33#include <nameserver_remote.h>
34#include <nameserver_remotenotify.h>
35#include <procmgr.h>
36#include <heap.h>
37#include <heapbuf.h>
38#include <sysmemmgr.h>
39
40
41/*!
42 * @def SYSMGR_MODULEID
43 * @brief Unique module ID.
44 */
45#define SYSMGR_MODULEID (0xF086)
46
47
48/* =============================================================================
49 * Module Success and Failure codes
50 * =============================================================================
51 */
52/*!
53 * @def SYSMGR_STATUSCODEBASE
54 * @brief Error code base for System manager.
55 */
56#define SYSMGR_STATUSCODEBASE (SYSMGR_MODULEID << 12u)
57
58/*!
59 * @def SYSMGR_MAKE_FAILURE
60 * @brief Macro to make error code.
61 */
62#define SYSMGR_MAKE_FAILURE(x) ((s32)(0x80000000 + \
63 (SYSMGR_STATUSCODEBASE + \
64 (x))))
65
66/*!
67 * @def SYSMGR_MAKE_SUCCESS
68 * @brief Macro to make success code.
69 */
70#define SYSMGR_MAKE_SUCCESS(x) (SYSMGR_STATUSCODEBASE + (x))
71
72/*!
73 * @def SYSMGR_E_INVALIDARG
74 * @brief Argument passed to a function is invalid.
75 */
76#define SYSMGR_E_INVALIDARG SYSMGR_MAKE_FAILURE(1)
77
78/*!
79 * @def SYSMGR_E_MEMORY
80 * @brief Memory allocation failed.
81 */
82#define SYSMGR_E_MEMORY SYSMGR_MAKE_FAILURE(2)
83
84/*!
85 * @def SYSMGR_E_FAIL
86 * @brief General failure.
87 */
88#define SYSMGR_E_FAIL SYSMGR_MAKE_FAILURE(3)
89
90/*!
91 * @def SYSMGR_E_INVALIDSTATE
92 * @brief Module is in invalid state.
93 */
94#define SYSMGR_E_INVALIDSTATE SYSMGR_MAKE_FAILURE(4)
95
96/*!
97 * @def SYSMGR_E_OSFAILURE
98 * @brief Failure in OS call.
99 */
100#define SYSMGR_E_OSFAILURE SYSMGR_MAKE_FAILURE(5)
101
102/*!
103 * @def SYSMGR_S_ALREADYSETUP
104 * @brief Module is already initialized.
105 */
106#define SYSMGR_S_ALREADYSETUP SYSMGR_MAKE_SUCCESS(1)
107
108/*!
109 * @def SYSMGR_CMD_SCALABILITY
110 * @brief Command ID for scalability info.
111 */
112#define SYSMGR_CMD_SCALABILITY (0x00000000)
113
114/*!
115 * @def SYSMGR_CMD_SHAREDREGION_ENTRY_BASE
116 * @brief Base of command IDs for entries used by Shared region.
117 */
118#define SYSMGR_CMD_SHAREDREGION_ENTRY_START (0x00000001)
119#define SYSMGR_CMD_SHAREDREGION_ENTRY_END (0x00001000)
120
121
122/* =============================================================================
123 * Structures & Enums
124 * =============================================================================
125 */
126/*!
127 * @brief Structure defining config parameters for overall System.
128 */
129struct sysmgr_config {
130 struct sysmemmgr_config sysmemmgr_cfg;
131 /*!< System memory manager config parameter */
132
133 struct multiproc_config multiproc_cfg;
134 /*!< Multiproc config parameter */
135
136 struct gatepeterson_config gatepeterson_cfg;
137 /*!< Gatepeterson config parameter */
138
139 struct sharedregion_config sharedregion_cfg;
140 /*!< SharedRegion config parameter */
141
142 struct messageq_config messageq_cfg;
143 /*!< MessageQ config parameter */
144
145 struct notify_config notify_cfg;
146 /*!< Notify config parameter */
147
148 struct proc_mgr_config proc_mgr_cfg;
149 /*!< Processor manager config parameter */
150
151 struct heapbuf_config heapbuf_cfg;
152 /*!< Heap Buf config parameter */
153
154 struct listmp_config listmp_sharedmemory_cfg;
155 /*!< ListMPSharedMemory config parameter */
156
157 struct messageq_transportshm_config messageq_transportshm_cfg;
158 /*!< MessageQTransportShm config parameter */
159
160 struct notify_ducatidrv_config notify_ducatidrv_cfg;
161 /*!< NotifyDriverShm config parameter */
162
163 struct nameserver_remotenotify_config nameserver_remotenotify_cfg;
164 /*!< NameServerRemoteNotify config parameter */
165};
166
167
168/* =============================================================================
169 * APIs
170 * =============================================================================
171 */
172/* Function to initialize the parameter structure */
173void sysmgr_get_config(struct sysmgr_config *config);
174
175/* Function to initialize sysmgr module */
176s32 sysmgr_setup(const struct sysmgr_config *config);
177
178/* Function to Finalize sysmgr module */
179s32 sysmgr_destroy(void);
180
181
182#endif /* ifndef SYSMGR_H_0xF086 */
diff --git a/arch/arm/plat-omap/include/syslink/transportshm.h b/arch/arm/plat-omap/include/syslink/transportshm.h
new file mode 100644
index 00000000000..02a2b6a80c9
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/transportshm.h
@@ -0,0 +1,220 @@
1/*
2 * transportshm.h
3 *
4 * Shared memory based physical transport for
5 * communication with the remote processor.
6 *
7 * This file contains the declarations of types and APIs as part
8 * of interface of the shared memory transport.
9 *
10 * Copyright (C) 2008-2009 Texas Instruments, Inc.
11 *
12 * This package is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 *
16 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE.
20 */
21
22#ifndef _TRANSPORTSHM_H_
23#define _TRANSPORTSHM_H_
24
25/* Standard headers */
26#include <linux/types.h>
27
28/* Utilities headers */
29#include <linux/list.h>
30
31/* =============================================================================
32 * All success and failure codes for the module
33 * =============================================================================
34 */
35/* Unique module ID. */
36#define TRANSPORTSHM_MODULEID (0x0a7a)
37
38/* =============================================================================
39 * All success and failure codes for the module
40 * =============================================================================
41 */
42/* Error code base for TransportShm. */
43#define TRANSPORTSHM_STATUSCODEBASE (TRANSPORTSHM_MODULEID << 12)
44
45/* Macro to make error code. */
46#define TRANSPORTSHM_MAKE_FAILURE(x) ((int) (0x80000000 \
47 + (TRANSPORTSHM_STATUSCODEBASE \
48 + (x))))
49
50/* Macro to make success code. */
51#define TRANSPORTSHM_MAKE_SUCCESS(x) (TRANSPORTSHM_STATUSCODEBASE + (x))
52
53/* Argument passed to a function is invalid. */
54#define TRANSPORTSHM_E_INVALIDARG TRANSPORTSHM_MAKE_FAILURE(1)
55
56/* Invalid shared address size */
57#define TRANSPORTSHM_E_INVALIDSIZE TRANSPORTSHM_MAKE_FAILURE(2)
58
59/* Module is not initialized. */
60#define TRANSPORTSHM_E_INVALIDSTATE TRANSPORTSHM_MAKE_FAILURE(3)
61
62/* Versions don't match */
63#define TRANSPORTSHM_E_BADVERSION TRANSPORTSHM_MAKE_FAILURE(4)
64
65/* General Failure */
66#define TRANSPORTSHM_E_FAIL TRANSPORTSHM_MAKE_FAILURE(5)
67
68/* Memory allocation failed */
69#define TRANSPORTSHM_E_MEMORY TRANSPORTSHM_MAKE_FAILURE(6)
70
71/* Failure in OS call. */
72#define TRANSPORTSHM_E_OSFAILURE TRANSPORTSHM_MAKE_FAILURE(7)
73
74/* Invalid handle specified. */
75#define TRANSPORTSHM_E_HANDLE TRANSPORTSHM_MAKE_FAILURE(8)
76
77/* The specified operation is not supported. */
78#define TRANSPORTSHM_E_NOTSUPPORTED TRANSPORTSHM_MAKE_FAILURE(9)
79
80/* Operation successful. */
81#define TRANSPORTSHM_SUCCESS TRANSPORTSHM_MAKE_SUCCESS(0)
82
83/* The MESSAGETRANSPORTSHM module has already been setup in this process. */
84#define TRANSPORTSHM_S_ALREADYSETUP TRANSPORTSHM_MAKE_SUCCESS(1)
85
86
87/* =============================================================================
88 * Structures & Enums
89 * =============================================================================
90 */
91
92/*
93 * Structure defining the reason for error function being called
94 */
95enum transportshm_reason {
96 TRANSPORTSHM_REASON_FAILEDPUT,
97 /* Failed to send the message. */
98 TRANSPORTSHM_REASON_INTERNALERR,
99 /* An internal error occurred in the transport */
100 TRANSPORTSHM_REASON_PHYSICALERR,
101 /* An error occurred in the physical link in the transport */
102 TRANSPORTSHM_REASON_FAILEDALLOC
103 /* Failed to allocate a message. */
104};
105
106/*
107 * transport error callback function.
108 *
109 * First parameter: Why the error function is being called.
110 *
111 * Second parameter: Handle of transport that had the error. NULL denotes
112 * that it is a system error, not a specific transport.
113 *
114 * Third parameter: Pointer to the message. This is only valid for
115 * #TRANSPORTSHM_REASON_FAILEDPUT.
116 *
117 * Fourth parameter: Transport specific information. Refer to individual
118 * transports for more details.
119 */
120
121/*
122 * Module configuration structure.
123 */
124struct transportshm_config {
125 void (*err_fxn)(enum transportshm_reason reason,
126 void *handle,
127 void *msg,
128 u32 info);
129 /* Asynchronous error function for the transport module */
130};
131
132/*
133 * Structure defining config parameters for the transport
134 * instances.
135 */
136struct transportshm_params {
137 u32 priority;
138 /*< Priority of messages supported by this transport */
139 void *gate;
140 /*< Gate used for critical region management of the shared memory */
141 void *shared_addr;
142 /*< Address of the shared memory. The creator must supply the shared
143 * memory that this will use for maintain shared state information.
144 */
145 u32 notify_event_id;
146 /*< Notify event number to be used by the transport */
147};
148
149/*
150 * Structure defining Transport status values
151 */
152enum transportshm_status {
153 transportshm_status_INIT,
154 /*< Transport Shm instance has not not completed
155 * initialization. */
156 transportshm_status_UP,
157 /*< Transport Shm instance is up and functional. */
158 transportshm_status_DOWN,
159 /*< Transport Shm instance is down and not functional. */
160 transportshm_status_RESETTING
161 /*< Transport Shm instance was up at one point and is in
162 * process of resetting.
163 */
164};
165
166
167/* =============================================================================
168 * APIs called by applications
169 * =============================================================================
170 */
171/* Function to get the default configuration for the TransportShm
172 * module. */
173void transportshm_get_config(struct transportshm_config *cfg);
174
175/* Function to setup the TransportShm module. */
176int transportshm_setup(const struct transportshm_config *cfg);
177
178/* Function to destroy the TransportShm module. */
179int transportshm_destroy(void);
180
181/* Get the default parameters for the NotifyShmDriver. */
182void transportshm_params_init(struct transportshm_params *params);
183
184/* Create an instance of the TransportShm. */
185void *transportshm_create(u16 proc_id,
186 const struct transportshm_params *params);
187
188/* Delete an instance of the TransportShm. */
189int transportshm_delete(void **handle_ptr);
190
191/* Open a created TransportShm instance by address */
192int transportshm_open_by_addr(void *shared_addr, void **handle_ptr);
193
194/* Close an opened instance */
195int transportshm_close(void **handle_ptr);
196
197/* Get the shared memory requirements for the TransportShm. */
198u32 transportshm_shared_mem_req(const struct transportshm_params *params);
199
200/* Set the asynchronous error function for the transport module */
201void transportshm_set_err_fxn(void (*err_fxn)(enum transportshm_reason reason,
202 void *handle,
203 void *msg,
204 u32 info));
205
206
207/* =============================================================================
208 * APIs called internally by TransportShm module.
209 * =============================================================================
210 */
211/* Put msg to remote list */
212int transportshm_put(void *handle, void *msg);
213
214/* Control Function */
215int transportshm_control(void *handle, u32 cmd, u32 *cmd_arg);
216
217/* Get current status of the TransportShm */
218enum transportshm_status transportshm_get_status(void *handle);
219
220#endif /* _TRANSPORTSHM_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/transportshm_setup.h b/arch/arm/plat-omap/include/syslink/transportshm_setup.h
new file mode 100644
index 00000000000..99345773dd8
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/transportshm_setup.h
@@ -0,0 +1,47 @@
1/*
2 * transportshm_setup.h
3 *
4 * Shared Memory Transport setup layer
5 *
6 * This file contains the declarations of types and APIs as part
7 * of interface of the shared memory transport.
8 *
9 * Copyright (C) 2008-2009 Texas Instruments, Inc.
10 *
11 * This package is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE.
19 */
20
21#ifndef _TRANSPORTSHM_SETUP_H_
22#define _TRANSPORTSHM_SETUP_H_
23
24/* Standard headers */
25#include <linux/types.h>
26
27/* Utilities headers */
28#include <linux/list.h>
29
30/* =============================================================================
31 * APIs called by applications
32 * =============================================================================
33 */
34
35/* Function that will be called in messageq_attach */
36int transportshm_setup_attach(u16 remote_proc_id, u32 *shared_addr);
37
38/* Function that will be called in messageq_detach */
39int transportshm_setup_detach(u16 remote_proc_id);
40
41/* Function that returns the amount of shared memory required */
42u32 transportshm_setup_shared_mem_req(u32 *shared_addr);
43
44/* Determines if a transport has been registered to a remote processor */
45bool transportshm_setup_is_registered(u16 remote_proc_id);
46
47#endif /* _TRANSPORTSHM_SETUP_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/transportshm_setup_proxy.h b/arch/arm/plat-omap/include/syslink/transportshm_setup_proxy.h
new file mode 100644
index 00000000000..72eaf400a19
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/transportshm_setup_proxy.h
@@ -0,0 +1,48 @@
1/*
2 * transportshm_setup_proxy.h
3 *
4 * Shared Memory Transport setup layer
5 *
6 * This file contains the declarations of types and APIs as part
7 * of interface of the shared memory transport.
8 *
9 * Copyright (C) 2008-2009 Texas Instruments, Inc.
10 *
11 * This package is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE.
19 */
20
21#ifndef _TRANSPORTSHM_SETUP_PROXY_H_
22#define _TRANSPORTSHM_SETUP_PROXY_H_
23
24/* Module headers */
25#include <transportshm_setup.h>
26
27/* =============================================================================
28 * APIs
29 * =============================================================================
30 */
31/* function that will be called in messageq_attach */
32#define messageq_setup_transport_proxy_attach(remote_proc_id, shared_addr) \
33 transportshm_setup_attach(remote_proc_id, \
34 shared_addr)
35
36/* function that will be called in messageq_detach */
37#define messageq_setup_transport_proxy_detach(remote_proc_id) \
38 transportshm_setup_detach(remote_proc_id)
39
40/* Shared memory req function */
41#define messageq_setup_transport_proxy_shared_mem_req(shared_addr) \
42 transportshm_setup_shared_mem_req(shared_addr)
43
44/* is_registered function */
45#define messageq_setup_transport_proxy_is_registered(remote_proc_id) \
46 transportshm_setup_is_registered(remote_proc_id)
47
48#endif /* _TRANSPORTSHM_SETUP_PROXY_H_ */