summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorSuman Anna <s-anna@ti.com>2010-03-15 18:16:38 -0500
committerHari Kanigeri <h-kanigeri2@ti.com>2010-07-09 17:57:28 -0500
commit15bbd58209e995c73f787070f3ce41fb0b4a1678 (patch)
tree1a8232363145cdc10ccd11252a2dca0b364b1aef /arch/arm
parent83ed6185e664940f7722b76546315a995895bf80 (diff)
SYSLINK: ipc - listmp updated for SysLink 2.0
listmp module is updated for SysLink-2.0. This version incorporates the changes for improved ease of programming for the user. The following are the main changes specific to this module: 1. The listmp_sharedmemory module and listmp base module have been merged together. The listmp module is essentially deleted and the listmp_ sharedmemory module became the defacto listmp module. All files have been renamed accordingly. 2. listmp_get_gate API is added to return the gatemp object used for the listmp object protection. listmp_open API is split into two API - listmp_open and listmp_open_by_addr. The open function takes in a name, and the open_by_addr function takes in a shared address. Both these API do not take any params structure as done previously. 3. listmp_params_init function does not take any object handle. The return type has also changed. 4. listmp_shared_mem_req return value changed. 5. listmp_config, listmp_attrs and listmp_params structure elements have changed. The attrs structure stores the shared address of the gatemp object and also contains the head of the shared memory linked list. Some other elements have been removed/replaced. 6. listmp_object definition has changed and restructed. It removes some of the additional layers. The new structure can store the shared region id, it's cacheability properties, and the gatemp handle that will be used to protect it. 7. gatepeterson_ function calls have been replaced with the corresponding gatemp_ function calls. 8. WARN_ONs have been added in place of BUG_ONs and unlikely macros are added for compiler branch prediction improvement. 9. cache calls are added, but commented out. The following are the changes in line to the common changes to all SysLink-2.0 IPC modules. 1. A listmp_module variable is introduced to mimic the BIOS behavior. Signed-off-by: Suman Anna <s-anna@ti.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/plat-omap/include/syslink/_listmp.h68
-rw-r--r--arch/arm/plat-omap/include/syslink/listmp.h241
-rw-r--r--arch/arm/plat-omap/include/syslink/listmp_ioctl.h268
-rw-r--r--arch/arm/plat-omap/include/syslink/listmp_sharedmemory.h289
-rw-r--r--arch/arm/plat-omap/include/syslink/listmp_sharedmemory_ioctl.h258
5 files changed, 396 insertions, 728 deletions
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 000000000000..282d2c8c10e9
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/_listmp.h
@@ -0,0 +1,68 @@
+/*
+ * _listmp.h
+ *
+ * Internal definitions for shared memory doubly linked list.
+ *
+ * Copyright (C) 2008-2009 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
+ * published by the Free Software Foundation.
+ *
+ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+#ifndef __LISTMP_H_
+#define __LISTMP_H_
+
+/* Standard headers */
+#include <linux/types.h>
+#include <linux/list.h>
+
+#include <listmp.h>
+#include <sharedregion.h>
+
+/* Unique module ID. */
+#define LISTMP_MODULEID (0xa413)
+
+/* Created tag */
+#define LISTMP_CREATED 0x12181964
+
+
+/* Structure defining shared memory attributes for the ListMP module. */
+struct listmp_attrs {
+ u32 status;
+ u32 *gatemp_addr;
+ struct listmp_elem head;
+};
+
+/* Structure defining config parameters for the ListMP module. */
+struct listmp_config {
+ uint max_runtime_entries;
+ /* Maximum number of ListMP's that can be dynamically created and
+ added to the NameServer. */
+ uint max_name_len; /* Maximum length of name */
+};
+
+
+/* Structure defining processor related information for the ListMP module. */
+struct listmp_proc_attrs {
+ bool creator; /* Creator or opener */
+ u16 proc_id; /* Processor Identifier */
+ u32 open_count; /* How many times it is opened on a processor */
+};
+
+
+/* Function to get the configuration */
+void listmp_get_config(struct listmp_config *cfg_params);
+
+/* Function to setup the listmp module */
+int listmp_setup(const struct listmp_config *config);
+
+/* Function to destroy the listmp module */
+int listmp_destroy(void);
+
+#endif /* __LISTMP_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/listmp.h b/arch/arm/plat-omap/include/syslink/listmp.h
index 536f1804da91..31d2429e851f 100644
--- a/arch/arm/plat-omap/include/syslink/listmp.h
+++ b/arch/arm/plat-omap/include/syslink/listmp.h
@@ -29,239 +29,118 @@
* All success and failure codes for the module
* =============================================================================
*/
-/*!
- * @def LISTMP_MODULEID
- * @brief Unique module ID.
- */
-#define LISTMP_MODULEID (0xa413)
+/* The resource is still in use */
+#define LISTMP_S_BUSY 2
-/*!
- * @def LISTMP_ERRORCODEBASE
- * @brief Error code base for ListMP.
- */
-#define LISTMP_ERRORCODEBASE (LISTMP_MODULEID << 12)
+/* The module has already been setup */
+#define LISTMP_S_ALREADYSETUP 1
-/*!
- * @def LISTMP_MAKE_FAILURE
- * @brief Macro to make error code.
- */
-#define LISTMP_MAKE_FAILURE(x) ((int)(0x80000000 \
- + (LISTMP_ERRORCODEBASE + (x))))
+/* Operation is successful. */
+#define LISTMP_SUCCESS 0
-/*!
- * @def LISTMP_MAKE_SUCCESS
- * @brief Macro to make success code.
- */
-#define LISTMP_MAKE_SUCCESS(x) (LISTMP_ERRORCODEBASE + (x))
+/* Generic failure. */
+#define LISTMP_E_FAIL -1
-/*!
- * @def LISTMP_E_INVALIDARG
- * @brief Argument passed to a function is invalid.
- */
-#define LISTMP_E_INVALIDARG LISTMP_MAKE_FAILURE(1)
+/* Argument passed to a function is invalid. */
+#define LISTMP_E_INVALIDARG -2
-/*!
- * @def LISTMP_E_MEMORY
- * @brief Memory allocation failed.
- */
-#define LISTMP_E_MEMORY LISTMP_MAKE_FAILURE(2)
+/* Memory allocation failed. */
+#define LISTMP_E_MEMORY -3
-/*!
- * @def LISTMP_E_BUSY
- * @brief The name is already registered or not.
- */
-#define LISTMP_E_BUSY LISTMP_MAKE_FAILURE(3)
+/* The specified entity already exists. */
+#define LISTMP_E_ALREADYEXISTS -4
-/*!
- * @def LISTMP_E_FAIL
- * @brief Generic failure.
- */
-#define LISTMP_E_FAIL LISTMP_MAKE_FAILURE(4)
+/* Unable to find the specified entity. */
+#define LISTMP_E_NOTFOUND -5
-/*!
- * @def LISTMP_E_NOTFOUND
- * @brief Name not found in the nameserver.
- */
-#define LISTMP_E_NOTFOUND LISTMP_MAKE_FAILURE(5)
+/* Operation timed out. */
+#define LISTMP_E_TIMEOUT -6
-/*!
- * @def LISTMP_E_INVALIDSTATE
- * @brief Module is not initialized.
- */
-#define LISTMP_E_INVALIDSTATE LISTMP_MAKE_FAILURE(6)
+/* Module is not initialized. */
+#define LISTMP_E_INVALIDSTATE -7
-/*!
- * @def LISTMP_E_OSFAILURE
- * @brief Failure in OS call.
- */
-#define LISTMP_E_OSFAILURE LISTMP_MAKE_FAILURE(7)
+/* A failure occurred in an OS-specific call */
+#define LISTMP_E_OSFAILURE -8
-/*!
- * @def LISTMP_SUCCESS
- * @brief Operation successful.
- */
-#define LISTMP_SUCCESS LISTMP_MAKE_SUCCESS(0)
+/* Specified resource is not available */
+#define LISTMP_E_RESOURCE -9
+
+/* Operation was interrupted. Please restart the operation */
+#define LISTMP_E_RESTART -10
-/*!
- * @def LISTMP_S_ALREADYSETUP
- * @brief The LISTMP module has already been setup in this process.
- */
-#define LISTMP_S_ALREADYSETUP LISTMP_MAKE_SUCCESS(1)
/* =============================================================================
* Macros and types
* =============================================================================
*/
-/*!
- * @brief Enum defining types of list for the ListMP module.
- */
-enum listmp_type {
- listmp_type_SHARED = 0,
- /*!< List in shared memory */
- listmp_type_FAST = 1
- /*!< Hardware Queue */
-};
-
-/*!
- * @brief Structure defining config parameters for the ListMP module.
- */
-struct listmp_config {
- u32 max_name_len;
- /*!< Maximum length of name */
- bool use_name_server;
- /*!< Whether to have this module use the NameServer or not. If the
- * NameServer is not needed, set this configuration parameter to false.
- * This informs ListMPSharedMemory not to pull in the NameServer module
- * In this case, all names passed into create and open are ignored.
- */
-};
+#define VOLATILE volatile
-/*!
- * @brief Structure defining list element for the ListMP.
- */
+/* Structure defining list element for the ListMP. */
struct listmp_elem {
- volatile struct listmp_elem *next;
- volatile struct listmp_elem *prev;
+ VOLATILE struct listmp_elem *next;
+ VOLATILE struct listmp_elem *prev;
};
-/*!
- * @brief Structure defining config parameters for the ListMP instances.
- */
+/* Structure defining config parameters for the ListMP instances. */
struct listmp_params {
- bool cache_flag;
- /*!< Set to 1 by the open() call. No one else should touch this! */
- struct mutex *gate;
- /*!< Lock used for critical region management of the list */
- void *shared_addr;
- /*!< shared memory address */
- u32 shared_addr_size;
- /*!< shared memory size */
- char *name;
- /*!< Name of the object */
- int resource_id;
- /*!<
- * resourceId Specifies the resource id number.
- * Parameter is used only when type is set to Fast List
- */
- enum listmp_type list_type ;
- /*!< Type of list */
+ /* gatemp instance for critical management of shared memory */
+ void *gatemp_handle;
+ void *shared_addr; /* physical address of the shared memory */
+ char *name; /* name of the instance */
+ u16 region_id; /* sharedregion id */
};
-/* =============================================================================
- * Forward declarations
- * =============================================================================
- */
-/*!
- * @brief Structure defining config parameters for the ListMPSharedMemory.
- */
-struct listmp_object {
- bool (*empty)(void *listmp_handle);
- /* Function to check if list is empty */
- void *(*get_head)(void *listmp_handle);
- /* Function to get head element from list */
- void *(*get_tail)(void *listmp_handle);
- /* Function to get tail element from list */
- int (*put_head)(void *listmp_handle, struct listmp_elem *elem);
- /* Function to put head element into list */
- int (*put_tail)(void *listmp_handle, struct listmp_elem *elem);
- /* Function to put tail element into list */
- int (*insert)(void *listmp_handle, struct listmp_elem *elem,
- struct listmp_elem *curElem);
- /* Function to insert element into list */
- int (*remove)(void *listmp_handle, struct listmp_elem *elem);
- /* Function to remove element from list */
- void *(*next)(void *listmp_handle, struct listmp_elem *elem);
- /* Function to traverse to next element in list */
- void *(*prev)(void *listmp_handle, struct listmp_elem *elem);
- /* Function to traverse to prev element in list */
- void *obj;
- /*!< Handle to ListMP */
- enum listmp_type list_type;
- /* Type of list */
-};
+/* Function initializes listmp parameters */
+void listmp_params_init(struct listmp_params *params);
-/*
- * Function initializes listmp parameters
- */
-void listmp_params_init(void *listmp_handle,
- struct listmp_params *params);
-
-/*
- * Function to get shared memory requirement for the module
- */
-int listmp_shared_memreq(struct listmp_params *params);
-
-/* =============================================================================
- * Functions to create instance of a list
- * =============================================================================
- */
/* Function to create an instance of ListMP */
-void *listmp_create(struct listmp_params *params);
+void *listmp_create(const struct listmp_params *params);
/* Function to delete an instance of ListMP */
int listmp_delete(void **listmp_handle_ptr);
-/* =============================================================================
- * Functions to open/close handle to list instance
- * =============================================================================
- */
/* Function to open a previously created instance */
-int listmp_open(void **listmp_handle_ptr, struct listmp_params *params);
+int listmp_open(char *name, void **listmp_handle_ptr);
+
+/* Function to open a previously created instance */
+int listmp_open_by_addr(void *shared_addr, void **listmp_handle_ptr);
/* Function to close a previously opened instance */
-int listmp_close(void *listmp_handle);
+int listmp_close(void **listmp_handle);
-/* =============================================================================
- * Function pointer types for list operations
- * =============================================================================
- */
/* Function to check if list is empty */
bool listmp_empty(void *listmp_handle);
+/* Retrieves the GateMP handle associated with the ListMP instance. */
+void *listmp_get_gate(void *listmp_handle);
+
/* Function to get head element from list */
void *listmp_get_head(void *listmp_handle);
/* Function to get tail element from list */
void *listmp_get_tail(void *listmp_handle);
+/* Function to insert element into list */
+int listmp_insert(void *listmp_handle, struct listmp_elem *new_elem,
+ struct listmp_elem *cur_elem);
+
+/* Function to traverse to next element in list */
+void *listmp_next(void *listmp_handle, struct listmp_elem *elem);
+
+/* Function to traverse to prev element in list */
+void *listmp_prev(void *listmp_handle, struct listmp_elem *elem);
+
/* Function to put head element into list */
int listmp_put_head(void *listmp_handle, struct listmp_elem *elem);
/* Function to put tail element into list */
int listmp_put_tail(void *listmp_handle, struct listmp_elem *elem);
-/* Function to insert element into list */
-int listmp_insert(void *listmp_handle, struct listmp_elem *elem,
- struct listmp_elem *curElem);
-
/* Function to traverse to remove element from list */
int listmp_remove(void *listmp_handle, struct listmp_elem *elem);
-/* Function to traverse to next element in list */
-void *listmp_next(void *listmp_handle, struct listmp_elem *elem);
-
-/* Function to traverse to prev element in list */
-void *listmp_prev(void *listmp_handle, struct listmp_elem *elem);
+/* Function to get shared memory requirement for the module */
+uint listmp_shared_mem_req(const struct listmp_params *params);
#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 000000000000..bb0825efcef3
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/listmp_ioctl.h
@@ -0,0 +1,268 @@
+/*
+ * listmp_ioctl.h
+ *
+ * Definitions of listmp driver types and structures.
+ *
+ * Copyright (C) 2008-2009 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
+ * published by the Free Software Foundation.
+ *
+ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+#ifndef _LISTMP_IOCTL_H_
+#define _LISTMP_IOCTL_H_
+
+/* Standard headers */
+#include <linux/types.h>
+
+/* Syslink headers */
+#include <ipc_ioctl.h>
+#include <listmp.h>
+#include <sharedregion.h>
+
+/* =============================================================================
+ * Macros and types
+ * =============================================================================
+ */
+/* Base command ID for listmp */
+#define LISTMP_IOC_MAGIC IPC_IOC_MAGIC
+enum listmp_drv_cmd {
+ LISTMP_GETCONFIG = LISTMP_BASE_CMD,
+ LISTMP_SETUP,
+ LISTMP_DESTROY,
+ LISTMP_PARAMS_INIT,
+ LISTMP_CREATE,
+ LISTMP_DELETE,
+ LISTMP_OPEN,
+ LISTMP_CLOSE,
+ LISTMP_ISEMPTY,
+ LISTMP_GETHEAD,
+ LISTMP_GETTAIL,
+ LISTMP_PUTHEAD,
+ LISTMP_PUTTAIL,
+ LISTMP_INSERT,
+ LISTMP_REMOVE,
+ LISTMP_NEXT,
+ LISTMP_PREV,
+ LISTMP_SHAREDMEMREQ,
+ LISTMP_OPENBYADDR
+};
+
+/* ----------------------------------------------------------------------------
+ * IOCTL command IDs for listmp
+ * ----------------------------------------------------------------------------
+ */
+/* Command for listmp_get_config */
+#define CMD_LISTMP_GETCONFIG _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_GETCONFIG, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_setup */
+#define CMD_LISTMP_SETUP _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_SETUP, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_destroy */
+#define CMD_LISTMP_DESTROY _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_DESTROY, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_params_init */
+#define CMD_LISTMP_PARAMS_INIT _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_PARAMS_INIT, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_create */
+#define CMD_LISTMP_CREATE _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_CREATE, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_delete */
+#define CMD_LISTMP_DELETE _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_DELETE, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_open */
+#define CMD_LISTMP_OPEN _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_OPEN, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_close */
+#define CMD_LISTMP_CLOSE _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_CLOSE, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_is_empty */
+#define CMD_LISTMP_ISEMPTY _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_ISEMPTY, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_get_head */
+#define CMD_LISTMP_GETHEAD _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_GETHEAD, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_get_tail */
+#define CMD_LISTMP_GETTAIL _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_GETTAIL, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_put_head */
+#define CMD_LISTMP_PUTHEAD _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_PUTHEAD, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_put_tail */
+#define CMD_LISTMP_PUTTAIL _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_PUTTAIL, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_insert */
+#define CMD_LISTMP_INSERT _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_INSERT, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_remove */
+#define CMD_LISTMP_REMOVE _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_REMOVE, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_next */
+#define CMD_LISTMP_NEXT _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_NEXT, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_prev */
+#define CMD_LISTMP_PREV _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_PREV, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_shared_mem_req */
+#define CMD_LISTMP_SHAREDMEMREQ _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_SHAREDMEMREQ, \
+ struct listmp_cmd_args)
+
+/* Command for listmp_open_by_addr */
+#define CMD_LISTMP_OPENBYADDR _IOWR(LISTMP_IOC_MAGIC, \
+ LISTMP_OPENBYADDR, \
+ struct listmp_cmd_args)
+
+/* Command arguments for listmp */
+struct listmp_cmd_args {
+ union {
+ struct {
+ struct listmp_params *params;
+ } params_init;
+
+ struct {
+ struct listmp_config *config;
+ } get_config;
+
+ struct {
+ struct listmp_config *config;
+ } setup;
+
+ struct {
+ void *listmp_handle;
+ struct listmp_params *params;
+ u32 name_len;
+ u32 shared_addr_srptr;
+ void *knl_gate;
+ } create;
+
+ struct {
+ void *listmp_handle;
+ } delete_instance;
+
+ struct {
+ void *listmp_handle;
+ u32 name_len;
+ char *name;
+ } open;
+
+ struct {
+ void *listmp_handle;
+ u32 shared_addr_srptr;
+ } open_by_addr;
+
+
+ struct {
+ void *listmp_handle;
+ } close;
+
+ struct {
+ void *listmp_handle;
+ bool is_empty;
+ } is_empty;
+
+ struct {
+ void *listmp_handle;
+ u32 *elem_srptr;
+ } get_head;
+
+ struct {
+ void *listmp_handle;
+ u32 *elem_srptr;
+ } get_tail;
+
+ struct {
+ void *listmp_handle;
+ u32 *elem_srptr;
+ } put_head;
+
+ struct {
+ void *listmp_handle;
+ u32 *elem_srptr;
+ } put_tail;
+
+ struct {
+ void *listmp_handle;
+ u32 *new_elem_srptr;
+ u32 *cur_elem_srptr;
+ } insert;
+
+ struct {
+ void *listmp_handle;
+ u32 *elem_srptr;
+ } remove;
+
+ struct {
+ void *listmp_handle;
+ u32 *elem_srptr;
+ u32 *next_elem_srptr;
+ } next;
+
+ struct {
+ void *listmp_handle;
+ u32 *elem_srptr;
+ u32 *prev_elem_srptr;
+ } prev;
+
+ struct {
+ struct listmp_params *params;
+ u32 bytes;
+ void *knl_gate;
+ u32 *shared_addr_srptr;
+ u32 name_len;
+ void *listmp_handle;
+ } shared_mem_req;
+ } args;
+
+ int api_status;
+};
+
+/* ----------------------------------------------------------------------------
+ * IOCTL functions for listmp module
+ * ----------------------------------------------------------------------------
+ */
+/* ioctl interface function for listmp */
+int listmp_ioctl(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long args);
+
+#endif /* _LISTMP_IOCTL_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/listmp_sharedmemory.h b/arch/arm/plat-omap/include/syslink/listmp_sharedmemory.h
deleted file mode 100644
index c6fd1629728e..000000000000
--- a/arch/arm/plat-omap/include/syslink/listmp_sharedmemory.h
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * listmp_sharedmemory.c
- *
- * The listmp_sharedmemory is a double linked-list based module designed to be
- * used in a multi-processor environment. It is designed to provide a means
- * of communication between different processors.
- *
- * Copyright (C) 2008-2009 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
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.
- */
-
-#ifndef _LISTMP_SHAREDMEMORY_H_
-#define _LISTMP_SHAREDMEMORY_H_
-
-/* Standard headers */
-#include <linux/types.h>
-
-/* Utilities headers */
-
-/* Other headers */
-#include <listmp.h>
-
-/* =============================================================================
- * All success and failure codes for the module
- * =============================================================================
- */
-/*!
- * @def LISTMPSHAREDMEMORY_MODULEID
- * @brief Unique module ID.
- */
-#define LISTMPSHAREDMEMORY_MODULEID (0xDD3C)
-
-/*!
- * @def LISTMPSHAREDMEMORY_ERRORCODEBASE
- * @brief Error code base for ListMPSharedMemory.
- */
-#define LISTMPSHAREDMEMORY_ERRORCODEBASE \
- (LISTMPSHAREDMEMORY_MODULEID << 12)
-
-/*!
- * @def LISTMPSHAREDMEMORY_MAKE_FAILURE
- * @brief Macro to make error code.
- */
-#define LISTMPSHAREDMEMORY_MAKE_FAILURE(x) \
- ((int) (0x80000000 \
- + (LISTMPSHAREDMEMORY_ERRORCODEBASE \
- + (x))))
-
-/*!
- * @def LISTMPSHAREDMEMORY_MAKE_SUCCESS
- * @brief Macro to make success code.
- */
-#define LISTMPSHAREDMEMORY_MAKE_SUCCESS(x) \
- (LISTMPSHAREDMEMORY_ERRORCODEBASE + (x))
-
-/*!
- * @def LISTMPSHAREDMEMORY_E_INVALIDARG
- * @brief Argument passed to a function is invalid.
- */
-#define LISTMPSHAREDMEMORY_E_INVALIDARG \
- LISTMPSHAREDMEMORY_MAKE_FAILURE(1)
-
-/*!
- * @def LISTMPSHAREDMEMORY_E_MEMORY
- * @brief Memory allocation failed.
- */
-#define LISTMPSHAREDMEMORY_E_MEMORY \
- LISTMPSHAREDMEMORY_MAKE_FAILURE(2)
-
-/*!
- * @def LISTMPSHAREDMEMORY_E_FAIL
- * @brief Generic failure.
- */
-#define LISTMPSHAREDMEMORY_E_FAIL \
- LISTMPSHAREDMEMORY_MAKE_FAILURE(3)
-
-/*!
- * @def LISTMPSHAREDMEMORY_E_INVALIDSTATE
- * @brief Module is not initialized.
- */
-#define LISTMPSHAREDMEMORY_E_INVALIDSTATE \
- LISTMPSHAREDMEMORY_MAKE_FAILURE(4)
-
-/*!
- * @def LISTMPSHAREDMEMORY_E_OSFAILURE
- * @brief Failure in OS call.
- */
-#define LISTMPSHAREDMEMORY_E_OSFAILURE \
- LISTMPSHAREDMEMORY_MAKE_FAILURE(5)
-
-/*!
- * @def LISTMPSHAREDMEMORY_E_NOTONWER
- * @brief Instance is not created on this processor.
- */
-#define LISTMPSHAREDMEMORY_E_NOTOWNER \
- LISTMPSHAREDMEMORY_MAKE_FAILURE(6)
-
-/*!
- * @def LISTMPSHAREDMEMORY_E_REMOTEACTIVE
- * @brief Remote opener of the instance has not closed the instance.
- */
-#define LISTMPSHAREDMEMORY_E_REMOTEACTIVE \
- LISTMPSHAREDMEMORY_MAKE_FAILURE(7)
-
-/*!
- * @def LISTMPSHAREDMEMORY_E_INUSE
- * @brief Indicates that the instance is in use..
- */
-#define LISTMPSHAREDMEMORY_E_INUSE \
- LISTMPSHAREDMEMORY_MAKE_FAILURE(8)
-
-/*!
- * @def LISTMPSHAREDMEMORY_E_NOTFOUND
- * @brief name not found in the nameserver.
- */
-#define LISTMPSHAREDMEMORY_E_NOTFOUND \
- LISTMPSHAREDMEMORY_MAKE_FAILURE(9)
-
-/*!
- * @def LISTMPSHAREDMEMORY_E_NOTCREATED
- * @brief Instance is not created yet
- */
-#define LISTMPSHAREDMEMORY_E_NOTCREATED \
- LISTMPSHAREDMEMORY_MAKE_FAILURE(10)
-
-/*!
- * @def LISTMPSHAREDMEMORY_E_VERSION
- * @brief Version mismatch error.
- */
-#define LISTMPSHAREDMEMORY_E_VERSION \
- LISTMPSHAREDMEMORY_MAKE_FAILURE(11)
-
-/*!
- * @def LISTMPSHAREDMEMORY_E_BUSY
- * @brief the name is already registered or not.
- */
-#define LISTMPSHAREDMEMORY_E_BUSY \
- LISTMPSHAREDMEMORY_MAKE_FAILURE(12)
-
-
-/*!
- * @def LISTMPSHAREDMEMORY_SUCCESS
- * @brief Operation successful.
- */
-#define LISTMPSHAREDMEMORY_SUCCESS \
- LISTMPSHAREDMEMORY_MAKE_SUCCESS(0)
-
-/*!
- * @def LISTMPSHAREDMEMORY_S_ALREADYSETUP
- * @brief The LISTMPSHAREDMEMORY module has already been setup in this
- * process.
- */
-#define LISTMPSHAREDMEMORY_S_ALREADYSETUP \
- LISTMPSHAREDMEMORY_MAKE_SUCCESS(1)
-
-/*!
- * @def listmp_sharedmemory_CREATED
- * @brief Creation of list succesful.
-*/
-#define LISTMP_SHAREDMEMORY_CREATED (0x12181964)
-
-/*!
- * @def LISTMP_SHAREDMEMORY_VERSION
- * @brief Version.
- */
-#define LISTMP_SHAREDMEMORY_VERSION (1)
-
-/* =============================================================================
- * Structure definitions
- * =============================================================================
- */
-/*!
- * @brief Structure defining config parameters for the ListMP instances.
- */
-#define listmp_sharedmemory_params struct listmp_params
-
-
-/*! @brief Forward declaration of structure defining object for the
- * ListMPSharedMemory.
- */
-/*!
- * @brief Object for the ListMPSharedMemory Handle
- */
-#define listmp_sharedmemory_object struct listmp_object
-
-/*!
- * @brief Handle for the ListMPSharedMemory
- */
-#define listmp_sharedmemory_handle void *
-
-/* =============================================================================
- * Functions to create the module
- * =============================================================================
- */
-/* Function to get configuration parameters to setup
- * the ListMPSharedMemory module.
- */
-int listmp_sharedmemory_get_config(struct listmp_config *cfgParams);
-
-/* Function to setup the ListMPSharedMemory module. */
-int listmp_sharedmemory_setup(struct listmp_config *config) ;
-
-/* Function to destroy the ListMPSharedMemory module. */
-int listmp_sharedmemory_destroy(void);
-
-/* =============================================================================
- * Functions to create instance of a list
- * =============================================================================
- */
-/* Function to create an instance of ListMP */
-listmp_sharedmemory_handle listmp_sharedmemory_create
- (listmp_sharedmemory_params *params);
-
-/* Function to delete an instance of ListMP */
-int listmp_sharedmemory_delete(listmp_sharedmemory_handle *listMPHandlePtr);
-
-/* =============================================================================
- * Functions to open/close handle to list instance
- * =============================================================================
- */
-/*
- * Initialize this config-params structure with supplier-specified
- * defaults before instance creation.
- */
-void listmp_sharedmemory_params_init(listmp_sharedmemory_handle handle,
- listmp_sharedmemory_params *params);
-
-/* Function to open a previously created instance */
-int listmp_sharedmemory_open(listmp_sharedmemory_handle *listMpHandlePtr,
- listmp_sharedmemory_params *params);
-
-/* Function to close a previously opened instance */
-int listmp_sharedmemory_close(listmp_sharedmemory_handle listMPHandle);
-
-/* =============================================================================
- * Functions for list operations
- * =============================================================================
- */
-/* Function to check if list is empty */
-bool listmp_sharedmemory_empty(listmp_sharedmemory_handle listMPHandle);
-
-/* Function to get head element from list */
-void *listmp_sharedmemory_get_head(listmp_sharedmemory_handle listMPHandle);
-
-/* Function to get tail element from list */
-void *listmp_sharedmemory_get_tail(listmp_sharedmemory_handle listMPHandle);
-
-/* Function to put head element into list */
-int listmp_sharedmemory_put_head(listmp_sharedmemory_handle listMPHandle,
- struct listmp_elem *elem);
-
-/* Function to put tail element into list */
-int listmp_sharedmemory_put_tail(listmp_sharedmemory_handle listMPHandle,
- struct listmp_elem *elem);
-
-/* Function to insert element into list */
-int listmp_sharedmemory_insert(listmp_sharedmemory_handle listMPHandle,
- struct listmp_elem *elem,
- struct listmp_elem *curElem);
-
-/* Function to traverse to remove element from list */
-int listmp_sharedmemory_remove(listmp_sharedmemory_handle listMPHandle,
- struct listmp_elem *elem);
-
-/* Function to traverse to next element in list */
-void *listmp_sharedmemory_next(listmp_sharedmemory_handle listMPHandle,
- struct listmp_elem *elem);
-
-/* Function to traverse to prev element in list */
-void *listmp_sharedmemory_prev(listmp_sharedmemory_handle listMPHandle,
- struct listmp_elem *elem);
-
-/* =============================================================================
- * Functions for shared memory requirements
- * =============================================================================
- */
-/* Amount of shared memory required for creation of each instance. */
-int listmp_sharedmemory_shared_memreq(
- listmp_sharedmemory_params *params);
-
-#endif /* _LISTMP_SHAREDMEMORY_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/listmp_sharedmemory_ioctl.h b/arch/arm/plat-omap/include/syslink/listmp_sharedmemory_ioctl.h
deleted file mode 100644
index 42fc4d6edd24..000000000000
--- a/arch/arm/plat-omap/include/syslink/listmp_sharedmemory_ioctl.h
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * listmp_sharedmemory_ioctl.h
- *
- * Definitions of listmp_sharedmemory driver types and structures.
- *
- * Copyright (C) 2008-2009 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
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.
- */
-
-#ifndef _LISTMP_SHAREDMEMORY_IOCTL_H_
-#define _LISTMP_SHAREDMEMORY_IOCTL_H_
-
-/* Standard headers */
-#include <linux/types.h>
-
-/* Syslink headers */
-#include <ipc_ioctl.h>
-#include <listmp_sharedmemory.h>
-#include <sharedregion.h>
-
-/* =============================================================================
- * Macros and types
- * =============================================================================
- */
-/* Base command ID for listmp_sharedmemory */
-#define LISTMP_SHAREDMEMORY_IOC_MAGIC IPC_IOC_MAGIC
-enum listmp_sharedmemory_drv_cmd {
- LISTMP_SHAREDMEMORY_GETCONFIG = LISTMP_SHAREDMEMORY_BASE_CMD,
- LISTMP_SHAREDMEMORY_SETUP,
- LISTMP_SHAREDMEMORY_DESTROY,
- LISTMP_SHAREDMEMORY_PARAMS_INIT,
- LISTMP_SHAREDMEMORY_CREATE,
- LISTMP_SHAREDMEMORY_DELETE,
- LISTMP_SHAREDMEMORY_OPEN,
- LISTMP_SHAREDMEMORY_CLOSE,
- LISTMP_SHAREDMEMORY_ISEMPTY,
- LISTMP_SHAREDMEMORY_GETHEAD,
- LISTMP_SHAREDMEMORY_GETTAIL,
- LISTMP_SHAREDMEMORY_PUTHEAD,
- LISTMP_SHAREDMEMORY_PUTTAIL,
- LISTMP_SHAREDMEMORY_INSERT,
- LISTMP_SHAREDMEMORY_REMOVE,
- LISTMP_SHAREDMEMORY_NEXT,
- LISTMP_SHAREDMEMORY_PREV,
- LISTMP_SHAREDMEMORY_SHAREDMEMREQ
-};
-
-/* ----------------------------------------------------------------------------
- * IOCTL command IDs for listmp_sharedmemory
- * ----------------------------------------------------------------------------
- */
-/* Command for listmp_sharedmemory_get_config */
-#define CMD_LISTMP_SHAREDMEMORY_GETCONFIG \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_GETCONFIG, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_setup */
-#define CMD_LISTMP_SHAREDMEMORY_SETUP \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_SETUP, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_destroy */
-#define CMD_LISTMP_SHAREDMEMORY_DESTROY \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_DESTROY, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_params_init */
-#define CMD_LISTMP_SHAREDMEMORY_PARAMS_INIT \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_PARAMS_INIT, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_create */
-#define CMD_LISTMP_SHAREDMEMORY_CREATE \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_CREATE, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_delete */
-#define CMD_LISTMP_SHAREDMEMORY_DELETE \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_DELETE, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_open */
-#define CMD_LISTMP_SHAREDMEMORY_OPEN \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_OPEN, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_close */
-#define CMD_LISTMP_SHAREDMEMORY_CLOSE \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_CLOSE, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_is_empty */
-#define CMD_LISTMP_SHAREDMEMORY_ISEMPTY \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_ISEMPTY, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_get_head */
-#define CMD_LISTMP_SHAREDMEMORY_GETHEAD \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_GETHEAD, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_get_tail */
-#define CMD_LISTMP_SHAREDMEMORY_GETTAIL \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_GETTAIL, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_put_head */
-#define CMD_LISTMP_SHAREDMEMORY_PUTHEAD \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_PUTHEAD, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_put_tail */
-#define CMD_LISTMP_SHAREDMEMORY_PUTTAIL \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_PUTTAIL, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_insert */
-#define CMD_LISTMP_SHAREDMEMORY_INSERT \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_INSERT, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_remove */
-#define CMD_LISTMP_SHAREDMEMORY_REMOVE \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_REMOVE, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_next */
-#define CMD_LISTMP_SHAREDMEMORY_NEXT \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_NEXT, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_prev */
-#define CMD_LISTMP_SHAREDMEMORY_PREV \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_PREV, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command for listmp_sharedmemory_shared_memreq */
-#define CMD_LISTMP_SHAREDMEMORY_SHAREDMEMREQ \
- _IOWR(LISTMP_SHAREDMEMORY_IOC_MAGIC, LISTMP_SHAREDMEMORY_SHAREDMEMREQ, \
- struct listmp_sharedmemory_cmd_args)
-
-/* Command arguments for listmp_sharedmemory */
-struct listmp_sharedmemory_cmd_args {
- union {
- struct {
- void *listmp_handle;
- struct listmp_params *params;
- } params_init;
-
- struct {
- struct listmp_config *config;
- } get_config;
-
- struct {
- struct listmp_config *config;
- } setup;
-
- struct {
- void *listmp_handle;
- struct listmp_params *params;
- u32 name_len;
- u32 shared_addr_srptr;
- void *knl_gate;
- } create;
-
- struct {
- void *listmp_handle;
- } delete_listmp;
-
- struct {
- void *listmp_handle;
- struct listmp_params *params;
- u32 name_len;
- u32 shared_addr_srptr;
- void *knl_gate;
- } open;
-
- struct {
- void *listmp_handle;
- } close;
-
- struct {
- void *listmp_handle;
- bool is_empty;
- } is_empty;
-
- struct {
- void *listmp_handle;
- u32 *elem_srptr ;
- } get_head;
-
- struct {
- void *listmp_handle;
- u32 *elem_srptr ;
- } get_tail;
-
- struct {
- void *listmp_handle;
- u32 *elem_srptr ;
- } put_head;
-
- struct {
- void *listmp_handle;
- u32 *elem_srptr ;
- } put_tail;
-
- struct {
- void *listmp_handle;
- u32 *new_elem_srptr;
- u32 *cur_elem_srptr;
- } insert;
-
- struct {
- void *listmp_handle;
- u32 *elem_srptr ;
- } remove;
-
- struct {
- void *listmp_handle;
- u32 *elem_srptr ;
- u32 *next_elem_srptr ;
- } next;
-
- struct {
- void *listmp_handle;
- u32 *elem_srptr ;
- u32 *prev_elem_srptr ;
- } prev;
-
- struct {
- void *listmp_handle;
- struct listmp_params *params;
- u32 bytes;
- } shared_memreq;
- } args;
-
- int api_status;
-};
-
-/* ----------------------------------------------------------------------------
- * IOCTL functions for listmp_sharedmemory module
- * ----------------------------------------------------------------------------
- */
-/*
- * ioctl interface function for listmp_sharedmemory
- */
-int listmp_sharedmemory_ioctl(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long args);
-
-#endif /* _LISTMP_SHAREDMEMORY_IOCTL_H_ */