Commit 8aa22f83 authored by Arun Gopalakrishnan's avatar Arun Gopalakrishnan Committed by Hari Kanigeri

ARM OMAP4 Syslink IPC ListMP, ListMP SharedMem Changes

This patch can be used to synk with the syslink drop 2.0.0.6
for above modules
The major changes are
   1. The atomic function usage came in the above modules
   2. Some logical changes came in some of the fuinctions
     in above modules (create/delete, open/close etc.)
   3. Some of the data structure were changed
Signed-off-by: default avatarArun M G <arunmg@ti.com>
parent 7157e75f
......@@ -128,6 +128,12 @@ enum listmp_type {
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.
*/
};
/*!
......@@ -142,14 +148,21 @@ struct listmp_elem {
* @brief 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 *lock_handle;
/*!< 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 */
struct mutex *lock_handle;
/*!< Lock used for critical region management of the list */
int resourceId;
/*!<
* 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 */
};
......@@ -188,9 +201,16 @@ struct listmp_object {
/* Type of list */
};
/* TBD: To be replaced by Function */
#define listmp_shared_memreq listmp_sharedmemory_shared_memreq
#define listmp_params_init listmp_sharedmemory_params_init
/*
* 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
......
......@@ -75,62 +75,77 @@
#define LISTMPSHAREDMEMORY_E_MEMORY \
LISTMPSHAREDMEMORY_MAKE_FAILURE(2)
/*!
* @def LISTMPSHAREDMEMORY_E_BUSY
* @brief the name is already registered or not.
*/
#define LISTMPSHAREDMEMORY_E_BUSY \
LISTMPSHAREDMEMORY_MAKE_FAILURE(3)
/*!
* @def LISTMPSHAREDMEMORY_E_FAIL
* @brief Generic failure.
*/
#define LISTMPSHAREDMEMORY_E_FAIL \
LISTMPSHAREDMEMORY_MAKE_FAILURE(4)
/*!
* @def LISTMPSHAREDMEMORY_E_NOTFOUND
* @brief name not found in the nameserver.
*/
#define LISTMPSHAREDMEMORY_E_NOTFOUND \
LISTMPSHAREDMEMORY_MAKE_FAILURE(5)
LISTMPSHAREDMEMORY_MAKE_FAILURE(3)
/*!
* @def LISTMPSHAREDMEMORY_E_INVALIDSTATE
* @brief Module is not initialized.
*/
#define LISTMPSHAREDMEMORY_E_INVALIDSTATE \
LISTMPSHAREDMEMORY_MAKE_FAILURE(6)
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(7)
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(8)
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_OSFAILURE
* @brief Failure in OS call.
* @def LISTMPSHAREDMEMORY_E_NOTCREATED
* @brief Instance is not created yet
*/
#define LISTMPSHAREDMEMORY_E_OSFAILURE \
#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.
......
......@@ -167,6 +167,8 @@ struct listmp_sharedmemory_cmd_args {
void *listmp_handle;
struct listmp_params *params;
u32 name_len;
u32 shared_addr_srptr;
void *knl_lock_handle;
} create;
struct {
......@@ -177,6 +179,8 @@ struct listmp_sharedmemory_cmd_args {
void *listmp_handle;
struct listmp_params *params;
u32 name_len;
u32 shared_addr_srptr;
void *knl_lock_handle;
} open;
struct {
......
......@@ -77,6 +77,35 @@ static struct GT_Mask listmp_debugmask = { NULL, NULL }; /* GT trace variable */
EXPORT_SYMBOL(listmp_debugmask);
#endif
/*
* ======== listmp_params_init ========
* Purpose:
* Function initializes listmp parameters
*/
void listmp_params_init(void *listmp_handle,
struct listmp_params *params)
{
BUG_ON(params == NULL);
listmp_sharedmemory_params_init(listmp_handle, params);
}
/*
* ======== listmp_shared_memreq ========
* Purpose:
* Function to get shared memory requirement for the module
*/
int listmp_shared_memreq(struct listmp_params *params)
{
int shared_memreq = 0;
if (WARN_ON(params == NULL))
goto exit;
shared_memreq = listmp_sharedmemory_shared_memreq(params);
exit:
return shared_memreq;
}
/*
* ======== listmp_create ========
* Purpose:
......@@ -455,3 +484,4 @@ exit:
gt_1trace(listmp_debugmask, GT_LEAVE, "listmp_prev", prevElem);
return prevElem;
}
......@@ -115,6 +115,14 @@ static inline int listmp_sharedmemory_ioctl_params_init(
unsigned long size;
listmp_sharedmemory_params params;
size = copy_from_user(&params,
cargs->args.params_init.params,
sizeof(listmp_sharedmemory_params));
if (size) {
retval = -EFAULT;
goto exit;
}
listmp_sharedmemory_params_init(
cargs->args.params_init.listmp_handle, &params);
size = copy_to_user(cargs->args.params_init.params, &params,
......@@ -124,8 +132,8 @@ static inline int listmp_sharedmemory_ioctl_params_init(
goto exit;
}
cargs->api_status = status;
exit:
cargs->api_status = status;
return retval;
}
......@@ -166,9 +174,12 @@ static inline int listmp_sharedmemory_ioctl_create(
}
params.shared_addr = sharedregion_get_ptr(
(u32 *)cargs->args.create.params->shared_addr);
(u32 *)cargs->args.create.shared_addr_srptr);
if (unlikely(params.shared_addr == NULL))
goto free_name;
/* Update lock_handle in params. */
params.lock_handle = cargs->args.create.knl_lock_handle;
cargs->args.create.listmp_handle = listmp_sharedmemory_create(&params);
size = copy_to_user(cargs->args.create.params, &params,
......@@ -241,10 +252,12 @@ static inline int listmp_sharedmemory_ioctl_open(
}
params.shared_addr = sharedregion_get_ptr(
(u32 *)cargs->args.open.params->shared_addr);
(u32 *)cargs->args.open.shared_addr_srptr);
if (unlikely(params.shared_addr == NULL))
goto free_name;
/* Update lock_handle in params. */
params.lock_handle = cargs->args.open.knl_lock_handle;
status = listmp_sharedmemory_open(&listmp_handle, &params);
if (status)
goto free_name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment