Commit 5dbb2be5 authored by Arun Gopalakrishnan's avatar Arun Gopalakrishnan Committed by Hari Kanigeri

IPC Added IOCTL I/F for NameServer Remote Notify modules This is to sync with...

IPC Added IOCTL I/F for NameServer Remote Notify modules This is to sync with the latest syslink drop(version 2.0)
Signed-off-by: default avatarArun M G <arunmg@ti.com>
parent 1ac07abd
...@@ -35,7 +35,8 @@ enum ipc_command_count { ...@@ -35,7 +35,8 @@ enum ipc_command_count {
GATEPETERSON_CMD_NOS = 11, GATEPETERSON_CMD_NOS = 11,
LISTMP_SHAREDMEMORY_CMD_NOS = 18, LISTMP_SHAREDMEMORY_CMD_NOS = 18,
MESSAGEQ_CMD_NOS = 17, MESSAGEQ_CMD_NOS = 17,
MESSAGEQ_TRANSPORTSHM_CMD_NOS = 9 MESSAGEQ_TRANSPORTSHM_CMD_NOS = 9,
NAMESERVERREMOTENOTIFY_CMD_NOS = 8
}; };
enum ipc_command_ranges { enum ipc_command_ranges {
...@@ -69,7 +70,11 @@ enum ipc_command_ranges { ...@@ -69,7 +70,11 @@ enum ipc_command_ranges {
MESSAGEQ_TRANSPORTSHM_BASE_CMD = 130, MESSAGEQ_TRANSPORTSHM_BASE_CMD = 130,
MESSAGEQ_TRANSPORTSHM_END_CMD = (MESSAGEQ_TRANSPORTSHM_BASE_CMD + \ MESSAGEQ_TRANSPORTSHM_END_CMD = (MESSAGEQ_TRANSPORTSHM_BASE_CMD + \
MESSAGEQ_TRANSPORTSHM_CMD_NOS - 1) MESSAGEQ_TRANSPORTSHM_CMD_NOS - 1),
NAMESERVERREMOTENOTIFY_BASE_CMD = 160,
NAMESERVERREMOTENOTIFY_END_CMD = (NAMESERVERREMOTENOTIFY_BASE_CMD + \
NAMESERVERREMOTENOTIFY_CMD_NOS - 1)
}; };
int ipc_ioc_router(u32 cmd, ulong arg); int ipc_ioc_router(u32 cmd, ulong arg);
......
/*
* nameserver_remotenotify_ioctl.h
*
* The nameserver_remotenotify module provides functionality to get name
* value pair from a remote nameserver.
*
* 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 _NAMESERVERREMOTENOTIFY_DRVDEFS_H
#define _NAMESERVERREMOTENOTIFY_DRVDEFS_H
#include <linux/ioctl.h>
#include <linux/types.h>
#include <ipc_ioctl.h>
#include <nameserver_remotenotify.h>
enum CMD_NAMESERVERREMOTENOTIFY {
NAMESERVERREMOTENOTIFY_GETCONFIG = NAMESERVERREMOTENOTIFY_BASE_CMD,
NAMESERVERREMOTENOTIFY_SETUP,
NAMESERVERREMOTENOTIFY_DESTROY,
NAMESERVERREMOTENOTIFY_PARAMS_INIT,
NAMESERVERREMOTENOTIFY_CREATE,
NAMESERVERREMOTENOTIFY_DELETE,
NAMESERVERREMOTENOTIFY_GET,
NAMESERVERREMOTENOTIFY_SHAREDMEMREQ
};
/*
* IOCTL command IDs for nameserver_remotenotify
*
*/
/*
* Command for nameserver_remotenotify_get_config
*/
#define CMD_NAMESERVERREMOTENOTIFY_GETCONFIG _IOWR(IPC_IOC_MAGIC, \
NAMESERVERREMOTENOTIFY_GETCONFIG, \
struct nameserver_remotenotify_cmd_args)
/*
* Command for nameserver_remotenotify_setup
*/
#define CMD_NAMESERVERREMOTENOTIFY_SETUP _IOWR(IPC_IOC_MAGIC, \
NAMESERVERREMOTENOTIFY_SETUP, \
struct nameserver_remotenotify_cmd_args)
/*
* Command for nameserver_remotenotify_setup
*/
#define CMD_NAMESERVERREMOTENOTIFY_DESTROY _IOWR(IPC_IOC_MAGIC, \
NAMESERVERREMOTENOTIFY_DESTROY, \
struct nameserver_remotenotify_cmd_args)
/*
* Command for nameserver_remotenotify_destroy
*/
#define CMD_NAMESERVERREMOTENOTIFY_PARAMS_INIT _IOWR(IPC_IOC_MAGIC, \
NAMESERVERREMOTENOTIFY_PARAMS_INIT, \
struct nameserver_remotenotify_cmd_args)
/*
* Command for nameserver_remotenotify_create
*/
#define CMD_NAMESERVERREMOTENOTIFY_CREATE _IOWR(IPC_IOC_MAGIC, \
NAMESERVERREMOTENOTIFY_CREATE, \
struct nameserver_remotenotify_cmd_args)
/*
* Command for nameserver_remotenotify_delete
*/
#define CMD_NAMESERVERREMOTENOTIFY_DELETE _IOWR(IPC_IOC_MAGIC, \
NAMESERVERREMOTENOTIFY_DELETE, \
struct nameserver_remotenotify_cmd_args)
/*
* Command for nameserver_remotenotify_get
*/
#define CMD_NAMESERVERREMOTENOTIFY_GET _IOWR(IPC_IOC_MAGIC, \
NAMESERVERREMOTENOTIFY_GET, \
struct nameserver_remotenotify_cmd_args)
/*
* Command for nameserver_remotenotify_shared_memreq
*/
#define CMD_NAMESERVERREMOTENOTIFY_SHAREDMEMREQ _IOWR(IPC_IOC_MAGIC, \
NAMESERVERREMOTENOTIFY_SHAREDMEMREQ, \
struct nameserver_remotenotify_cmd_args)
/*
* Command arguments for nameserver_remotenotify
*/
union nameserver_remotenotify_arg {
struct {
struct nameserver_remotenotify_config *config;
} get_config;
struct {
struct nameserver_remotenotify_config *config;
} setup;
struct {
void *handle;
struct nameserver_remotenotify_params *params;
} params_init;
struct {
void *handle;
u16 proc_id;
struct nameserver_remotenotify_params *params;
} create;
struct {
void *handle;
} delete_instance;
struct {
void *handle;
char *instance_name;
u32 instance_name_len;
char *name;
u32 name_len;
u8 *value;
s32 value_len;
void *reserved;
s32 len;
} get;
struct {
void *handle;
struct nameserver_remotenotify_params *params;
u32 shared_mem_size;
} shared_memreq;
};
/*
* Command arguments for nameserver_remotenotify
*/
struct nameserver_remotenotify_cmd_args {
union nameserver_remotenotify_arg args;
s32 api_status;
};
/*
* This ioctl interface for nameserver_remotenotify module
*/
int nameserver_remotenotify_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long args);
#endif /* _NAMESERVERREMOTENOTIFY_DRVDEFS_H */
...@@ -4,7 +4,7 @@ gatepeterson.o gatepeterson_ioctl.o sharedregion.o sharedregion_ioctl.o \ ...@@ -4,7 +4,7 @@ gatepeterson.o gatepeterson_ioctl.o sharedregion.o sharedregion_ioctl.o \
nameserver_remote.o nameserver_remotenotify.o listmp_sharedmemory.o \ nameserver_remote.o nameserver_remotenotify.o listmp_sharedmemory.o \
listmp.o listmp_sharedmemory_ioctl.o messageq.o messageq_ioctl.o \ listmp.o listmp_sharedmemory_ioctl.o messageq.o messageq_ioctl.o \
messageq_transportshm.o messageq_transportshm_ioctl.o OsalSemaphore.o \ messageq_transportshm.o messageq_transportshm_ioctl.o OsalSemaphore.o \
ipc_ioctl.o ipc_drv.o nameserver_remotenotify_ioctl.o ipc_ioctl.o ipc_drv.o
obj-$(CONFIG_MPU_SYSLINK_IPC) += omap_ipc.o obj-$(CONFIG_MPU_SYSLINK_IPC) += omap_ipc.o
omap_ipc-objs = $(libservices) $(libomap_ipc) omap_ipc-objs = $(libservices) $(libomap_ipc)
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <ipc_ioctl.h> #include <ipc_ioctl.h>
#include <nameserver.h> #include <nameserver.h>
#define IPC_NAME "TIOMAP_IPC" #define IPC_NAME "omap_ipc"
#define IPC_MAJOR 0 #define IPC_MAJOR 0
#define IPC_MINOR 0 #define IPC_MINOR 0
#define IPC_DEVICES 1 #define IPC_DEVICES 1
...@@ -48,7 +48,7 @@ s32 ipc_minor = IPC_MINOR; ...@@ -48,7 +48,7 @@ s32 ipc_minor = IPC_MINOR;
char *ipc_name = IPC_NAME; char *ipc_name = IPC_NAME;
module_param(ipc_name, charp, 0); module_param(ipc_name, charp, 0);
MODULE_PARM_DESC(ipc_name, "Device name, default = TIOMAP_IPC"); MODULE_PARM_DESC(ipc_name, "Device name, default = omap_ipc");
module_param(ipc_major, int, 0); /* Driver's major number */ module_param(ipc_major, int, 0); /* Driver's major number */
MODULE_PARM_DESC(ipc_major, "Major device number, default = 0 (auto)"); MODULE_PARM_DESC(ipc_major, "Major device number, default = 0 (auto)");
...@@ -196,9 +196,9 @@ static int __init ipc_init(void) ...@@ -196,9 +196,9 @@ static int __init ipc_init(void)
retval = PTR_ERR(ipc_class); retval = PTR_ERR(ipc_class);
goto unreg_exit; goto unreg_exit;
} }
device_create(ipc_class, NULL, MKDEV(ipc_major, ipc_minor), NULL,
"TI_IPC");
device_create(ipc_class, NULL, MKDEV(ipc_major, ipc_minor), NULL,
ipc_name);
cdev_init(&ipc_device->cdev, &ipc_fops); cdev_init(&ipc_device->cdev, &ipc_fops);
ipc_device->cdev.owner = THIS_MODULE; ipc_device->cdev.owner = THIS_MODULE;
retval = cdev_add(&ipc_device->cdev, dev, IPC_DEVICES); retval = cdev_add(&ipc_device->cdev, dev, IPC_DEVICES);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <listmp_sharedmemory_ioctl.h> #include <listmp_sharedmemory_ioctl.h>
#include <messageq_ioctl.h> #include <messageq_ioctl.h>
#include <messageq_transportshm_ioctl.h> #include <messageq_transportshm_ioctl.h>
#include <nameserver_remotenotify_ioctl.h>
/* /*
* ======== ipc_ioctl_router ======== * ======== ipc_ioctl_router ========
...@@ -40,8 +41,9 @@ int ipc_ioc_router(u32 cmd, ulong arg) ...@@ -40,8 +41,9 @@ int ipc_ioc_router(u32 cmd, ulong arg)
s32 retval = 0; s32 retval = 0;
u32 ioc_nr = _IOC_NR(cmd); u32 ioc_nr = _IOC_NR(cmd);
gt_3trace(ipcrouter_mask, GT_ENTER, "ipc_ioc_router" printk(KERN_ERR "ipc_ioc_router \n"
"cmd: %x, ioc_nr: %x, \n arg: %x\n", cmd, ioc_nr, arg); "cmd: %x, ioc_nr: %x(%d), arg: %x\n", cmd, ioc_nr, ioc_nr,
(unsigned int) arg);
if (ioc_nr >= MULTIPROC_BASE_CMD && ioc_nr <= MULTIPROC_END_CMD) if (ioc_nr >= MULTIPROC_BASE_CMD && ioc_nr <= MULTIPROC_END_CMD)
retval = multiproc_ioctl(NULL, NULL, cmd, arg); retval = multiproc_ioctl(NULL, NULL, cmd, arg);
...@@ -65,6 +67,9 @@ int ipc_ioc_router(u32 cmd, ulong arg) ...@@ -65,6 +67,9 @@ int ipc_ioc_router(u32 cmd, ulong arg)
else if (ioc_nr >= MESSAGEQ_TRANSPORTSHM_BASE_CMD && else if (ioc_nr >= MESSAGEQ_TRANSPORTSHM_BASE_CMD &&
ioc_nr <= MESSAGEQ_TRANSPORTSHM_END_CMD) ioc_nr <= MESSAGEQ_TRANSPORTSHM_END_CMD)
retval = messageq_transportshm_ioctl(NULL, NULL, cmd, arg); retval = messageq_transportshm_ioctl(NULL, NULL, cmd, arg);
else if (ioc_nr >= NAMESERVERREMOTENOTIFY_BASE_CMD &&
ioc_nr <= NAMESERVERREMOTENOTIFY_END_CMD)
retval = nameserver_remotenotify_ioctl(NULL, NULL, cmd, arg);
else else
retval = -ENOTTY; retval = -ENOTTY;
......
/*
* nameserver_remotenotify_ioctl.h
*
* The nameserver_remotenotify module provides functionality to get name
* value pair from a remote nameserver.
*
* 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.
*/
#include <linux/uaccess.h>
#include <linux/types.h>
#include <linux/bug.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/types.h>
#include <linux/bug.h>
#include <linux/fs.h>
#include <sharedregion.h>
#include <nameserver_remotenotify_ioctl.h>
/*
* ======== nameserver_remotenotify_ioctl_get ======
* Purpose:
* This ioctl interface to nameserver_remotenotify_get function
*/
static int nameserver_remotenotify_ioctl_get(
struct nameserver_remotenotify_cmd_args *cargs)
{
s32 retval = 0;
ulong size;
char *instance_name = NULL;
char *name = NULL;
u8 *value = NULL;
if (cargs->args.get.instance_name_len) {
instance_name = kmalloc(cargs->args.get.instance_name_len + 1,
GFP_KERNEL);
if (instance_name == NULL) {
retval = ENOMEM;
goto exit;
}
instance_name[cargs->args.get.instance_name_len] = '\0';
size = copy_from_user(instance_name,
cargs->args.get.instance_name,
cargs->args.get.instance_name_len);
if (size) {
retval = -ENOMEM;
goto exit;
}
}
if (cargs->args.get.name_len) {
name = kmalloc(cargs->args.get.name_len + 1,
GFP_KERNEL);
if (name == NULL) {
retval = ENOMEM;
goto exit;
}
instance_name[cargs->args.get.instance_name_len] = '\0';
size = copy_from_user(name, cargs->args.get.name,
cargs->args.get.name_len);
if (size) {
retval = -ENOMEM;
goto exit;
}
}
/* Allocate memory for the value */
if (cargs->args.get.value_len >= 0) {
value = kmalloc(cargs->args.get.value_len, GFP_KERNEL);
size = copy_from_user(value, cargs->args.get.value,
cargs->args.get.value_len);
if (size) {
retval = -ENOMEM;
goto exit;
}
}
cargs->args.get.len = nameserver_remotenotify_get(
cargs->args.get.handle,
instance_name,
name,
value,
cargs->args.get.value_len,
cargs->args.get.reserved);
exit:
kfree(value);
kfree(name);
kfree(instance_name);
return retval;
}
/*
* ======== nameserver_remotenotify_ioctl_shared_memreq ======
* Purpose:
* This ioctl interface to nameserver_remotenotify_shared_memreq function
*/
static int nameserver_remotenotify_ioctl_shared_memreq(
struct nameserver_remotenotify_cmd_args *cargs)
{
struct nameserver_remotenotify_params params;
s32 retval = 0;
ulong size;
/* params may be NULL. */
if (cargs->args.shared_memreq.params != NULL) {
size = copy_from_user(&params,
cargs->args.shared_memreq.params,
sizeof(struct nameserver_remotenotify_params));
if (size) {
retval = -EFAULT;
goto exit;
}
}
cargs->args.shared_memreq.shared_mem_size =
nameserver_remotenotify_shared_memreq(&params);
exit:
return retval;
}
/*
* ======== nameserver_remotenotify_ioctl_params_init ========
* Purpose:
* This ioctl interface to nameserver_remotenotify_params_init function
*/
static int nameserver_remotenotify_ioctl_params_init(
struct nameserver_remotenotify_cmd_args *cargs)
{
struct nameserver_remotenotify_params params;
s32 retval = 0;
ulong size;
nameserver_remotenotify_params_init(cargs->args.params_init.handle,
&params);
size = copy_to_user(cargs->args.params_init.params, &params,
sizeof(struct nameserver_remotenotify_params));
if (size)
retval = -EFAULT;
return retval;
}
/*
* ======== nameserver_remotenotify_ioctl_create========
* Purpose:
* This ioctl interface to nameserver_remotenotify_create function
*/
static int nameserver_remotenotify_ioctl_create(
struct nameserver_remotenotify_cmd_args *cargs)
{
struct nameserver_remotenotify_params params;
s32 retval = 0;
ulong size;
size = copy_from_user(&params, cargs->args.create.params,
sizeof(struct nameserver_remotenotify_params));
if (size) {
retval = -EFAULT;
goto exit;
}
params.shared_addr = sharedregion_get_ptr((u32 *)
cargs->args.create.params->shared_addr);
cargs->args.create.handle = nameserver_remotenotify_create(
cargs->args.create.proc_id,
&params);
exit:
return retval;
}
/*
* ======== nameserver_remotenotify_ioctl_delete ========
* Purpose:
* This ioctl interface to nameserver_remotenotify_delete function
*/
static int nameserver_remotenotify_ioctl_delete(
struct nameserver_remotenotify_cmd_args *cargs)
{
s32 retval = 0;
retval = nameserver_remotenotify_delete(
&cargs->args.delete_instance.handle);
return retval;
}
/*
* ======== nameserver_remotenotify_ioctl_get_config ========
* Purpose:
* This ioctl interface to nameserver_remotenotify_get_config function
*/
static int nameserver_remotenotify_ioctl_get_config(
struct nameserver_remotenotify_cmd_args *cargs)
{
s32 retval = 0;
ulong size;
struct nameserver_remotenotify_config config;
nameserver_remotenotify_get_config(&config);
size = copy_to_user(cargs->args.get_config.config, &config,
sizeof(struct nameserver_remotenotify_config));
if (size)
retval = -EFAULT;
return retval;
}
/*
* ======== nameserver_remotenotify_ioctl_setup ========
* Purpose:
* This ioctl interface to nameserver_remotenotify_setup function
*/
static int nameserver_remotenotify_ioctl_setup(
struct nameserver_remotenotify_cmd_args *cargs)
{
struct nameserver_remotenotify_config config;
s32 retval = 0;
ulong size;
size = copy_from_user(&config, cargs->args.setup.config,
sizeof(struct nameserver_remotenotify_config));
if (size) {
retval = -EFAULT;
goto exit;
}
retval = nameserver_remotenotify_setup(&config);
exit:
return retval;
}
/*
* ======== nameserver_remotenotify_ioctl_destroy ========
* Purpose:
* This ioctl interface to nameserver_remotenotify_destroy function
*/
static int nameserver_remotenotify_ioctl_destroy()
{
s32 retval = 0;
retval = nameserver_remotenotify_destroy();
return retval;
}
/*
* ======== nameserver_remotenotify_ioctl ========
* Purpose:
* This ioctl interface for nameserver_remotenotify module
*/
int nameserver_remotenotify_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long args)
{
s32 os_status = 0;
s32 size = 0;
struct nameserver_remotenotify_cmd_args __user *uarg =
(struct nameserver_remotenotify_cmd_args __user *)args;
struct nameserver_remotenotify_cmd_args cargs;
if (_IOC_DIR(cmd) & _IOC_READ)
os_status = !access_ok(VERIFY_WRITE, uarg, _IOC_SIZE(cmd));
else if (_IOC_DIR(cmd) & _IOC_WRITE)
os_status = !access_ok(VERIFY_READ, uarg, _IOC_SIZE(cmd));
if (os_status) {
os_status = -EFAULT;
goto exit;
}
/* Copy the full args from user-side */
size = copy_from_user(&cargs, uarg,
sizeof(struct nameserver_remotenotify_cmd_args));
if (size) {
os_status = -EFAULT;
goto exit;
}
switch (cmd) {
case CMD_NAMESERVERREMOTENOTIFY_GET:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_GET\n");
os_status = nameserver_remotenotify_ioctl_get(&cargs);
break;
case CMD_NAMESERVERREMOTENOTIFY_SHAREDMEMREQ:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_SHAREDMEMREQ\n");
os_status = nameserver_remotenotify_ioctl_shared_memreq(&cargs);
break;
case CMD_NAMESERVERREMOTENOTIFY_PARAMS_INIT:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_PARAMS_INIT\n");
os_status = nameserver_remotenotify_ioctl_params_init(&cargs);
break;
case CMD_NAMESERVERREMOTENOTIFY_CREATE:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_CREATE\n");
os_status = nameserver_remotenotify_ioctl_create(&cargs);
break;
case CMD_NAMESERVERREMOTENOTIFY_DELETE:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_DELETE\n");
os_status = nameserver_remotenotify_ioctl_delete(&cargs);
break;
case CMD_NAMESERVERREMOTENOTIFY_GETCONFIG:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_GETCONFIG\n");
os_status = nameserver_remotenotify_ioctl_get_config(&cargs);
break;
case CMD_NAMESERVERREMOTENOTIFY_SETUP:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_SETUP\n");
os_status = nameserver_remotenotify_ioctl_setup(&cargs);
break;
case CMD_NAMESERVERREMOTENOTIFY_DESTROY:
printk(KERN_ERR "CMD_NAMESERVERREMOTENOTIFY_DESTROY\n");
os_status = nameserver_remotenotify_ioctl_destroy();
break;
default:
WARN_ON(cmd);
os_status = -ENOTTY;
break;
}
/* Copy the full args to the user-side. */
size = copy_to_user(uarg, &cargs,
sizeof(struct nameserver_remotenotify_cmd_args));
if (size) {
os_status = -EFAULT;
goto exit;
}
printk(KERN_ERR "\n");
exit:
return os_status;
}
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