Commit 3894f04a authored by Arun Gopalakrishnan's avatar Arun Gopalakrishnan Committed by Hari Kanigeri

Syslink IPC GatePeterson aligned with Syslink drop 2_00_00_06

This patch can be used to sync with the syslink drop 2.0.0.6
for gatepeterson

The major changes are
  1. The atomic function usage came in the above modules
  2. Some logical changes came in some of the functions (create/delete,
     open/close)
Signed-off-by: default avatarArun M G <arunmg@ti.com>
parent 11d99bea
...@@ -21,17 +21,24 @@ ...@@ -21,17 +21,24 @@
#include <linux/types.h> #include <linux/types.h>
/*
* GATEPETERSON_MODULEID
* Unique module ID
*/
#define GATEPETERSON_MODULEID (0xF415)
/* /*
* A set of context protection levels that each correspond to * A set of context protection levels that each correspond to
* single processor gates used for local protection * single processor gates used for local protection
*/ */
enum gatepeterson_protect { enum gatepeterson_protect {
GATEPETERSON_PROTECT_DEFAULT, GATEPETERSON_PROTECT_DEFAULT = 0,
GATEPETERSON_PROTECT_INTERRUPT, GATEPETERSON_PROTECT_NONE = 1,
GATEPETERSON_PROTECT_TASKLET, GATEPETERSON_PROTECT_INTERRUPT = 2,
GATEPETERSON_PROTECT_THREAD, GATEPETERSON_PROTECT_TASKLET = 3,
GATEPETERSON_PROTECT_PROCESS, GATEPETERSON_PROTECT_THREAD = 4,
GATEPETERSON_PROTECT_NONE GATEPETERSON_PROTECT_PROCESS = 5,
GATEPETERSON_PROTECT_END_VALUE = 6
}; };
/* /*
...@@ -39,11 +46,22 @@ enum gatepeterson_protect { ...@@ -39,11 +46,22 @@ enum gatepeterson_protect {
* module * module
*/ */
struct gatepeterson_config { struct gatepeterson_config {
u32 max_name_len; /* GP name len */
enum gatepeterson_protect default_protection; enum gatepeterson_protect default_protection;
bool use_nameserver; /* Need a nameserver or not */ /*!< Default module-wide local context protection level. The level of
u32 max_runtime_entries; /* No of dynamic gps */ * protection specified here determines which local gate is created per
void *name_table_gate; /* for nameserver */ * GatePeterson instance for local protection during create. The instance
* configuration parameter may be usedto override this module setting per
* instance. The configuration used here should reflect both the context
* in which enter and leave are to be called,as well as the maximum level
* of protection needed locally.
*/
u32 max_name_len; /* GP name len */
bool use_nameserver;
/*!< Whether to have this module use the NameServer or not. If the
* NameServer is not needed, set this configuration parameter to false.
* This informs GatePeterson not to pull in the NameServer module.
* In this case, all names passed into create and open are ignored.
*/
}; };
/* /*
...@@ -52,16 +70,40 @@ struct gatepeterson_config { ...@@ -52,16 +70,40 @@ struct gatepeterson_config {
*/ */
struct gatepeterson_params { struct gatepeterson_params {
void *shared_addr; void *shared_addr;
/* Address of the shared memory. The creator must supply a cache-aligned
* address in shared memory that will be used to store shared state
* information.
*/
u32 shared_addr_size; u32 shared_addr_size;
/* Size of the shared memory region. Can use gatepeterson_shared_memreq
* call to determine the required size.
*/
char *name; char *name;
u16 opener_proc_id; /* If using nameserver, name of this instance. The name (if not NULL) must
* be unique among all gatepeterson instances in the entire system.
*/
enum gatepeterson_protect local_protection; enum gatepeterson_protect local_protection;
/* Local gate protection level. The default value, (Protect_DEFAULT)
* results in inheritance from module-level defaultProtection. This
* instance setting should be set to an alternative only if a different
* local protection level is needed for the instance.
*/
bool use_nameserver;
/* Whether to have this module use the nameserver or not. If the
* nameserver is not needed, set this configuration parameter to
* false.This informs gatepeterson not to pull in the nameaerver
* module. In this case, all names passed into create and open are
* ignored.
*/
}; };
/* /*
* Function to initialize the parameter structure * Function to initialize the parameter structure
*/ */
int gatepeterson_get_config(struct gatepeterson_config *config); void gatepeterson_get_config(struct gatepeterson_config *config);
/* /*
* Function to initialize GP module * Function to initialize GP module
...@@ -76,7 +118,8 @@ int gatepeterson_destroy(void); ...@@ -76,7 +118,8 @@ int gatepeterson_destroy(void);
/* /*
* Function to initialize the parameter structure * Function to initialize the parameter structure
*/ */
int gatepeterson_params_init(struct gatepeterson_params *params); void gatepeterson_params_init(void *handle,
struct gatepeterson_params *params);
/* /*
* Function to create an instance of GatePeterson * Function to create an instance of GatePeterson
...@@ -92,7 +135,7 @@ int gatepeterson_delete(void **gphandle); ...@@ -92,7 +135,7 @@ int gatepeterson_delete(void **gphandle);
* Function to open a previously created instance * Function to open a previously created instance
*/ */
int gatepeterson_open(void **gphandle, int gatepeterson_open(void **gphandle,
const struct gatepeterson_params *params); struct gatepeterson_params *params);
/* /*
* Function to close a previously opened instance * Function to close a previously opened instance
......
...@@ -123,6 +123,7 @@ enum CMD_GATEPETERSON { ...@@ -123,6 +123,7 @@ enum CMD_GATEPETERSON {
*/ */
union gatepeterson_arg { union gatepeterson_arg {
struct { struct {
void *handle;
struct gatepeterson_params *params; struct gatepeterson_params *params;
} params_init; } params_init;
...@@ -138,6 +139,7 @@ union gatepeterson_arg { ...@@ -138,6 +139,7 @@ union gatepeterson_arg {
void *handle; void *handle;
struct gatepeterson_params *params; struct gatepeterson_params *params;
u32 name_len; u32 name_len;
u32 shared_addr_srptr;
} create; } create;
struct { struct {
...@@ -148,6 +150,7 @@ union gatepeterson_arg { ...@@ -148,6 +150,7 @@ union gatepeterson_arg {
void *handle; void *handle;
struct gatepeterson_params *params; struct gatepeterson_params *params;
u32 name_len; u32 name_len;
u32 shared_addr_srptr;
} open; } open;
struct { struct {
......
...@@ -36,12 +36,13 @@ static int gatepeterson_ioctl_get_config(struct gatepeterson_cmd_args *cargs) ...@@ -36,12 +36,13 @@ static int gatepeterson_ioctl_get_config(struct gatepeterson_cmd_args *cargs)
s32 status = 0; s32 status = 0;
s32 size; s32 size;
cargs->api_status = gatepeterson_get_config(&config); gatepeterson_get_config(&config);
size = copy_to_user(cargs->args.get_config.config, &config, size = copy_to_user(cargs->args.get_config.config, &config,
sizeof(struct gatepeterson_config)); sizeof(struct gatepeterson_config));
if (size) if (size)
status = -EFAULT; status = -EFAULT;
cargs->api_status = 0;
return status; return status;
} }
...@@ -92,12 +93,14 @@ static int gatepeterson_ioctl_params_init(struct gatepeterson_cmd_args *cargs) ...@@ -92,12 +93,14 @@ static int gatepeterson_ioctl_params_init(struct gatepeterson_cmd_args *cargs)
s32 status = 0; s32 status = 0;
s32 size; s32 size;
cargs->api_status = gatepeterson_params_init(&params); gatepeterson_params_init(cargs->args.params_init.handle,
&params);
size = copy_to_user(cargs->args.params_init.params, &params, size = copy_to_user(cargs->args.params_init.params, &params,
sizeof(struct gatepeterson_params)); sizeof(struct gatepeterson_params));
if (size) if (size)
status = -EFAULT; status = -EFAULT;
cargs->api_status = 0;
return status; return status;
} }
...@@ -139,7 +142,8 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs) ...@@ -139,7 +142,8 @@ static int gatepeterson_ioctl_create(struct gatepeterson_cmd_args *cargs)
} }
params.shared_addr = sharedregion_get_ptr((u32 *)params.shared_addr); params.shared_addr = sharedregion_get_ptr(
(u32 *)cargs->args.create.shared_addr_srptr);
handle = gatepeterson_create(&params); handle = gatepeterson_create(&params);
/* Here we are not validating the return from the module. /* Here we are not validating the return from the module.
Even it is nul, we pass it to user and user has to pass Even it is nul, we pass it to user and user has to pass
...@@ -205,7 +209,8 @@ static int gatepeterson_ioctl_open(struct gatepeterson_cmd_args *cargs) ...@@ -205,7 +209,8 @@ static int gatepeterson_ioctl_open(struct gatepeterson_cmd_args *cargs)
} }
} }
params.shared_addr = sharedregion_get_ptr((u32 *)params.shared_addr); params.shared_addr = sharedregion_get_ptr(
(u32 *)cargs->args.create.shared_addr_srptr);
cargs->api_status = gatepeterson_open(&handle, &params); cargs->api_status = gatepeterson_open(&handle, &params);
cargs->args.open.handle = handle; cargs->args.open.handle = handle;
......
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