summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorSuman Anna <s-anna@ti.com>2010-03-03 13:13:26 -0600
committerHari Kanigeri <h-kanigeri2@ti.com>2010-07-09 17:57:19 -0500
commitb0bf37edae64d1fbf99829efededf1d98c07bc32 (patch)
tree4202d91e0f701fe70586e36802b780cc3ff15250 /arch/arm
parentc56c74cf510a5175c1006ad191b95c7916c990e9 (diff)
SYSLINK: ipc - sharedregion module migrated to SysLink 2.0
SharedRegion module is updated for SysLink-2.0. This version incorporates changes for improved ease of programming for the user. The new SharedRegion module is a drastically different module compared to before. It supports heap creation in-built into the regions provided by the new HeapMemMP module. This is used for automatic gate creation and other shared object creation. The following are the main changes specific to this module: 1. Old API is deprecated. It retains only a couple of old API. 2. A whole set of new API are provided. The list includes sharedregion_attach, sharedregion_detach, sharedtegion_start, sharedregion_stop, sharedregion_reserve_memory, sharedregion_set_entry, sharedregion_clear_entry and sharedregion_clear_reserved_memory among others. The following are the changes in line to the common changes to all SysLink-2.0 IPC modules. 1. A sharedregion_module variable is introduced to mimic the BIOS behavior. Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/plat-omap/include/syslink/sharedregion.h188
-rw-r--r--arch/arm/plat-omap/include/syslink/sharedregion_ioctl.h148
2 files changed, 239 insertions, 97 deletions
diff --git a/arch/arm/plat-omap/include/syslink/sharedregion.h b/arch/arm/plat-omap/include/syslink/sharedregion.h
index 75fe48049b5e..ca644e7ebcdc 100644
--- a/arch/arm/plat-omap/include/syslink/sharedregion.h
+++ b/arch/arm/plat-omap/include/syslink/sharedregion.h
@@ -5,7 +5,7 @@
* multi-processor environment where there are memory regions
* that are shared and accessed across different processors
*
- * Copyright (C) 2008-2009 Texas Instruments, Inc.
+ * Copyright (C) 2008-2010 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -21,40 +21,100 @@
#define _SHAREDREGION_H_
#include <linux/types.h>
+#include <heapmemmp.h>
/*
* SHAREDREGION_MODULEID
* Module ID for Shared region manager
*/
-#define SHAREDREGION_MODULEID (0x5D8A)
+#define SHAREDREGION_MODULEID (0x5D8A)
/*
* Name of the reserved nameserver used for application
*/
-#define SHAREDREGION_NAMESERVER "SHAREDREGION"
+#define SHAREDREGION_NAMESERVER "SHAREDREGION"
/*
* Name of the reserved nameserver used for application
*/
-#define SHAREDREGION_INVALIDSRPTR ((u32 *)0xFFFFFFFF)
+#define SHAREDREGION_INVALIDREGIONID ((u16)(~0))
+/*!
+ * @def SharedRegion_DEFAULTOWNERID
+ * @brief Default owner processor id
+ */
+#define SHAREDREGION_DEFAULTOWNERID ((u16)(~0))
-struct sharedregion_info {
- bool is_valid; /* table entry is valid or not? */
- void *base; /* Ptr to the base address of a table entry */
- u32 len; /* The length of a table entry */
+/*
+ * Name of the reserved nameserver used for application
+ */
+#define SHAREDREGION_INVALIDSRPTR ((u32 *)(~0))
+
+
+struct sharedregion_entry {
+ /* The base address of the region */
+ void *base;
+ /* The length of the region */
+ uint len;
+ /* The MultiProc id of the owner of the region */
+ u16 owner_proc_id;
+ /* Whether the region is valid */
+ bool is_valid;
+ /* Whether to perform cache operations for the region */
+ bool cache_enable;
+ /* The cache line size of the region */
+ uint cache_line_size;
+ /* Whether a heap is created for the region */
+ bool create_heap;
+ /* The name of the region */
+ char *name;
};
/*
* Module configuration structure
*/
struct sharedregion_config {
- void *gate_handle;
- void *heap_handle;
- u32 max_regions;
+ uint cache_line_size;
+ /*
+ * Worst-case cache line size
+ *
+ * This is the default system cache line size for all modules.
+ * When a module puts structures in shared memory, this value is
+ * used to make sure items are aligned on a cache line boundary.
+ * If no cacheLineSize is specified for a region, it will use this
+ * value.
+ */
+
+ u16 num_entries;
+ /*
+ * The number of shared region table entries.
+ *
+ * This value is used for calculating the number of bits for the offset.
+ * Note: This value must be the same across all processors in the
+ * system. Increasing this parameter will increase the footprint
+ * and the time for translating a pointer to a SRPtr.
+ */
+
+ bool translate;
+ /*
+ * This configuration parameter should be set to 'true'
+ * if and only if all shared memory regions are the same
+ * for all processors. If 'true', it results in a fast
+ * getPtr and getSRPtr.
+ */
};
/*
+ * Information stored on a per region basis
+ */
+struct sharedregion_region {
+ struct sharedregion_entry entry;
+ uint reserved_size;
+ struct heapmemmp_object *heap;
+};
+
+
+/*
* Function to get the configuration
*/
int sharedregion_get_config(struct sharedregion_config *config);
@@ -69,20 +129,92 @@ int sharedregion_setup(const struct sharedregion_config *config);
*/
int sharedregion_destroy(void);
-/* Fucntion to Add a memory segment to the lookup table during
- * runtime by base and length
+/*
+ * Creates a heap by owner of region for each SharedRegion.
+ * Function is called by ipc_start(). Requires that SharedRegion 0
+ * be valid before calling start().
*/
-int sharedregion_add(u32 index, void *base, u32 len);
+int sharedregion_start(void);
-/* Removes the memory segment at the specified index from the lookup
- * table at runtime
+/*
+ * Function to stop Shared Region 0
+ */
+int sharedregion_stop(void);
+
+/*
+ * Opens a heap, for non-owner processors, for each SharedRegion.
+ */
+int sharedregion_attach(u16 remote_proc_id);
+
+/*
+ * Closes a heap, for non-owner processors, for each SharedRegion.
+ */
+int sharedregion_detach(u16 remote_proc_id);
+
+/*
+ * Reserve shared region memory
+ */
+void *sharedregion_reserve_memory(u16 id, u32 size);
+
+/*
+ * Reserve shared region memory
+ */
+void sharedregion_unreserve_memory(u16 id, u32 size);
+
+/*
+ * Sets the entry at the specified region id(doesn't create heap)
+ */
+int _sharedregion_set_entry(u16 region_id, struct sharedregion_entry *entry);
+
+/*
+ * Function to clear the reserved memory
*/
-int sharedregion_remove(u32 index);
+void sharedregion_clear_reserved_memory(void);
/*
- * Returns the index for the specified address pointer
+ * Return the region info
*/
-int sharedregion_get_index(void *addr);
+void sharedregion_get_region_info(u16 i, struct sharedregion_region *region);
+
+/*
+ * Clears the entry at the specified region id
+ */
+int sharedregion_clear_entry(u16 region_id);
+
+/*
+ * Initializes the entry fields
+ */
+void sharedregion_entry_init(struct sharedregion_entry *entry);
+
+/*
+ * Gets the cache line size for the specified region id
+ */
+uint sharedregion_get_cache_line_size(u16 region_id);
+
+/*
+ * Gets the entry information for the specified region id
+ */
+int sharedregion_get_entry(u16 region_id, struct sharedregion_entry *entry);
+
+/*
+ * Gets the heap associated with the specified region id
+ */
+void *sharedregion_get_heap(u16 region_id);
+
+/*
+ * Gets the region id for the specified address
+ */
+u16 sharedregion_get_id(void *addr);
+
+/*
+ * Gets the id of a region, given the name
+ */
+u16 sharedregion_get_id_by_name(char *name);
+
+/*
+ * Gets the number of regions
+ */
+u16 sharedregion_get_num_regions(void);
/*
* Returns the address pointer associated with the shared region pointer
@@ -92,19 +224,21 @@ void *sharedregion_get_ptr(u32 *srptr);
/*
* Returns the shared region pointer
*/
-u32 *sharedregion_get_srptr(void *addr, int index);
+u32 *sharedregion_get_srptr(void *addr, u16 index);
/*
- * Gets the table entry information for the specified index and processor id
+ * whether cache enable was specified
*/
-int sharedregion_get_table_info(u32 index, u16 proc_id,
- struct sharedregion_info *info);
+bool sharedregion_is_cache_enabled(u16 region_id);
/*
- * Sets the base address of the entry in the table
+ * Sets the entry at the specified region id
*/
-int sharedregion_set_table_info(u32 index, u16 proc_id,
- struct sharedregion_info *info);
+int sharedregion_set_entry(u16 region_id, struct sharedregion_entry *entry);
-#endif /* _SHAREDREGION_H */
+/*
+ * Whether address translation is enabled
+ */
+bool sharedregion_translate_enabled(void);
+#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
index 0b2857110991..4d45df002046 100644
--- a/arch/arm/plat-omap/include/syslink/sharedregion_ioctl.h
+++ b/arch/arm/plat-omap/include/syslink/sharedregion_ioctl.h
@@ -5,7 +5,7 @@
* multi-processor environment where there are memory regions
* that are shared and accessed across different processors
*
- * Copyright (C) 2008-2009 Texas Instruments, Inc.
+ * Copyright (C) 2008-2010 Texas Instruments, Inc.
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -30,13 +30,16 @@ enum CMD_SHAREDREGION {
SHAREDREGION_GETCONFIG = SHAREDREGION_BASE_CMD,
SHAREDREGION_SETUP,
SHAREDREGION_DESTROY,
- SHAREDREGION_ADD,
- SHAREDREGION_GETPTR,
- SHAREDREGION_GETSRPTR,
- SHAREDREGION_GETTABLEINFO,
- SHAREDREGION_REMOVE,
- SHAREDREGION_SETTABLEINFO,
- SHAREDREGION_GETINDEX,
+ SHAREDREGION_START,
+ SHAREDREGION_STOP,
+ SHAREDREGION_ATTACH,
+ SHAREDREGION_DETACH,
+ SHAREDREGION_GETHEAP,
+ SHAREDREGION_CLEARENTRY,
+ SHAREDREGION_SETENTRY,
+ SHAREDREGION_RESERVEMEMORY,
+ SHAREDREGION_CLEARRESERVEDMEMORY,
+ SHAREDREGION_GETREGIONINFO
};
/*
@@ -47,66 +50,81 @@ enum CMD_SHAREDREGION {
/*
* Command for sharedregion_get_config
*/
-#define CMD_SHAREDREGION_GETCONFIG _IOWR(IPC_IOC_MAGIC, \
- SHAREDREGION_GETCONFIG, \
+#define CMD_SHAREDREGION_GETCONFIG _IOWR(IPC_IOC_MAGIC, \
+ SHAREDREGION_GETCONFIG, \
struct sharedregion_cmd_args)
/*
* Command for sharedregion_setup
*/
-#define CMD_SHAREDREGION_SETUP _IOWR(IPC_IOC_MAGIC, \
- SHAREDREGION_SETUP, \
+#define CMD_SHAREDREGION_SETUP _IOWR(IPC_IOC_MAGIC, \
+ SHAREDREGION_SETUP, \
struct sharedregion_cmd_args)
/*
* Command for sharedregion_setup
*/
-#define CMD_SHAREDREGION_DESTROY _IOWR(IPC_IOC_MAGIC, \
- SHAREDREGION_DESTROY, \
+#define CMD_SHAREDREGION_DESTROY _IOWR(IPC_IOC_MAGIC, \
+ SHAREDREGION_DESTROY, \
struct sharedregion_cmd_args)
/*
- * Command for sharedregion_ADD
+ * Command for sharedregion_start
*/
-#define CMD_SHAREDREGION_ADD _IOWR(IPC_IOC_MAGIC, \
- SHAREDREGION_ADD, \
+#define CMD_SHAREDREGION_START _IOWR(IPC_IOC_MAGIC, \
+ SHAREDREGION_START, \
struct sharedregion_cmd_args)
/*
- * Command for sharedregion_get_ptr
+ * Command for sharedregion_stop
*/
-#define CMD_SHAREDREGION_GETPTR _IOWR(IPC_IOC_MAGIC, \
- SHAREDREGION_GETPTR, \
+#define CMD_SHAREDREGION_STOP _IOWR(IPC_IOC_MAGIC, \
+ SHAREDREGION_STOP, \
struct sharedregion_cmd_args)
-
/*
- * Command for sharedregion_get_srptr
+ * Command for sharedregion_attach
*/
-#define CMD_SHAREDREGION_GETSRPTR _IOWR(IPC_IOC_MAGIC, \
- SHAREDREGION_GETSRPTR, \
+#define CMD_SHAREDREGION_ATTACH _IOWR(IPC_IOC_MAGIC, \
+ SHAREDREGION_ATTACH, \
struct sharedregion_cmd_args)
-
/*
- * Command for sharedregion_get_table_info
+ * Command for sharedregion_detach
*/
-#define CMD_SHAREDREGION_GETTABLEINFO _IOWR(IPC_IOC_MAGIC, \
- SHAREDREGION_GETTABLEINFO, \
+#define CMD_SHAREDREGION_DETACH _IOWR(IPC_IOC_MAGIC, \
+ SHAREDREGION_DETACH, \
struct sharedregion_cmd_args)
-
/*
- * Command for sharedregion_remove
+ * Command for sharedregion_get_heap
*/
-#define CMD_SHAREDREGION_REMOVE _IOWR(IPC_IOC_MAGIC, \
- SHAREDREGION_REMOVE, \
+#define CMD_SHAREDREGION_GETHEAP _IOWR(IPC_IOC_MAGIC, \
+ SHAREDREGION_GETHEAP, \
struct sharedregion_cmd_args)
/*
- * Command for sharedregion_set_table_info
+ * Command for sharedregion_clear_entry
*/
-#define CMD_SHAREDREGION_SETTABLEINFO _IOWR(IPC_IOC_MAGIC, \
- SHAREDREGION_SETTABLEINFO, \
+#define CMD_SHAREDREGION_CLEARENTRY _IOWR(IPC_IOC_MAGIC, \
+ SHAREDREGION_CLEARENTRY, \
+ struct sharedregion_cmd_args)
+/*
+ * Command for sharedregion_set_entry
+ */
+#define CMD_SHAREDREGION_SETENTRY _IOWR(IPC_IOC_MAGIC, \
+ SHAREDREGION_SETENTRY, \
+ struct sharedregion_cmd_args)
+/*
+ * Command for sharedregion_reserve_memory
+ */
+#define CMD_SHAREDREGION_RESERVEMEMORY _IOWR(IPC_IOC_MAGIC, \
+ SHAREDREGION_RESERVEMEMORY, \
+ struct sharedregion_cmd_args)
+/*
+ * Command for sharedregion_clear_reserved_memory
+ */
+#define CMD_SHAREDREGION_CLEARRESERVEDMEMORY \
+ _IOWR(IPC_IOC_MAGIC, \
+ SHAREDREGION_CLEARRESERVEDMEMORY, \
struct sharedregion_cmd_args)
-
/*
- * Command for sharedregion_get_index
+ * Command for sharedregion_get_region_info
*/
-#define CMD_SHAREDREGION_GETINDEX _IOWR(IPC_IOC_MAGIC, \
- SHAREDREGION_GETINDEX, \
+#define CMD_SHAREDREGION_GETREGIONINFO _IOWR(IPC_IOC_MAGIC, \
+ SHAREDREGION_GETREGIONINFO, \
struct sharedregion_cmd_args)
/*
@@ -114,53 +132,45 @@ enum CMD_SHAREDREGION {
*/
union sharedregion_arg {
struct {
- struct sharedregion_config *config;
+ struct sharedregion_config *config;
} get_config;
struct {
- struct sharedregion_config *config;
- struct sharedregion_config *default_cfg;
- struct sharedregion_info *table;
+ struct sharedregion_region *regions;
+ struct sharedregion_config *config;
} setup;
struct {
- u32 index;
- void *base;
- u32 len;
- } add;
+ struct sharedregion_region *regions;
+ } get_region_info;
struct {
- void *addr;
- s32 index;
- } get_index;
+ u16 remote_proc_id;
+ } attach;
struct {
- u32 *srptr;
- void *addr;
- } get_ptr;
+ u16 remote_proc_id;
+ } detach;
struct {
- u32 *srptr;
- void *addr;
- s32 index;
- } get_srptr;
+ u16 id;
+ void *heap_handle;
+ } get_heap;
struct {
- u32 index;
- u16 proc_id;
- struct sharedregion_info *info;
- } get_table_info;
+ u16 id;
+ struct sharedregion_entry entry;
+ } set_entry;
struct {
- u32 index;
- } remove;
+ u16 id;
+ } clear_entry;
struct {
- u32 index;
- u16 proc_id;
- struct sharedregion_info *info;
- } set_table_info;
-} ;
+ u16 id;
+ u32 size;
+ } reserve_memory;
+};
/*
* Command arguments for sharedregion
@@ -177,5 +187,3 @@ int sharedregion_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long args);
#endif /* _SHAREDREGION_IOCTL_H */
-
-