summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorSuman Anna <s-anna@ti.com>2010-03-12 16:04:13 -0600
committerHari Kanigeri <h-kanigeri2@ti.com>2010-07-09 17:57:26 -0500
commit83ed6185e664940f7722b76546315a995895bf80 (patch)
tree0073d064b733e44f7ebe1074d934f2ddab24f550 /arch/arm
parent73483bb889ace60371d4f57fbe710475c87f8d5e (diff)
SYSLINK: ipc - gatemp module created
A new module, gatemp is added. It is created as part of the SysLink-2.0 update. This version incorporates the changes for improved ease of programming for the user. gatehwspinlock module changes are replaced with gatepeterson changes. Signed-off-by: Suman Anna <s-anna@ti.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/plat-omap/include/syslink/gatemp.h237
-rw-r--r--arch/arm/plat-omap/include/syslink/gatemp_ioctl.h177
-rw-r--r--arch/arm/plat-omap/include/syslink/gatempdefs.h116
3 files changed, 530 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/include/syslink/gatemp.h b/arch/arm/plat-omap/include/syslink/gatemp.h
new file mode 100644
index 000000000000..ea0af5b692fa
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/gatemp.h
@@ -0,0 +1,237 @@
+/*
+ * gatemp.h
+ *
+ * gatemp wrapper defines
+ *
+ * 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 _GATEMP_H_
+#define _GATEMP_H_
+
+#include <sharedregion.h>
+
+/* Unique module ID. */
+#define GATEMP_MODULEID (0xAF70)
+
+/* The resource is still in use */
+#define GateMP_S_BUSY 2
+
+/* The module has been already setup */
+#define GateMP_S_ALREADYSETUP 1
+
+/* Operation is successful. */
+#define GateMP_S_SUCCESS 0
+
+/* Generic failure. */
+#define GateMP_E_FAIL -1
+
+/* The specified entity already exists. */
+#define GateMP_E_ALREADYEXISTS -4
+
+/* Unable to find the specified entity. */
+#define GateMP_E_NOTFOUND -5
+
+/* Operation timed out. */
+#define GateMP_E_TIMEOUT -6
+
+/* Module is not initialized. */
+#define GateMP_E_INVALIDSTATE -7
+
+/* A failure occurred in an OS-specific call */
+#define GateMP_E_OSFAILURE -8
+
+/* Specified resource is not available */
+#define GateMP_E_RESOURCE -9
+
+/* Operation was interrupted. Please restart the operation */
+#define GateMP_E_RESTART -10
+
+/* Gate is local gate not remote */
+#define GateMP_E_LOCALGATE -11
+
+
+/*
+ * A set of local context protection levels
+ *
+ * Each member corresponds to a specific local processor gates used for
+ * local protection.
+ *
+ * In linux user mode, the following are the mapping for the constants
+ * - INTERRUPT -> [N/A]
+ * - TASKLET -> [N/A]
+ * - THREAD -> GateMutex
+ * - PROCESS -> GateMutex
+ *
+ * In linux kernel mode, the following are the mapping for the constants
+ * - INTERRUPT -> [Interrupts disabled]
+ * - TASKLET -> GateMutex
+ * - THREAD -> GateMutex
+ * - PROCESS -> GateMutex
+ *
+ * For SYS/BIOS users, the following are the mappings for the constants
+ * - INTERRUPT -> GateHwi: disables interrupts
+ * - TASKLET -> GateSwi: disables Swi's (software interrupts)
+ * - THREAD -> GateMutexPri: based on Semaphores
+ * - PROCESS -> GateMutexPri: based on Semaphores
+ */
+enum gatemp_local_protect {
+ GATEMP_LOCALPROTECT_NONE = 0,
+ /* Use no local protection */
+
+ GATEMP_LOCALPROTECT_INTERRUPT = 1,
+ /* Use the INTERRUPT local protection level */
+
+ GATEMP_LOCALPROTECT_TASKLET = 2,
+ /* Use the TASKLET local protection level */
+
+ GATEMP_LOCALPROTECT_THREAD = 3,
+ /* Use the THREAD local protection level */
+
+ GATEMP_LOCALPROTECT_PROCESS = 4
+ /* Use the PROCESS local protection level */
+};
+
+/*
+ * Type of remote Gate
+ *
+ * Each member corresponds to a specific type of remote gate.
+ * Each enum value corresponds to the following remote protection levels:
+ * - NONE -> No remote protection (the gatemp instance will
+ * exclusively offer local protection configured in
+ * #GateMP_Params::local_protect
+ * - SYSTEM -> Use the SYSTEM remote protection level (default for
+ * remote protection
+ * - CUSTOM1 -> Use the CUSTOM1 remote protection level
+ * - CUSTOM2 -> Use the CUSTOM2 remote protection level
+ */
+enum gatemp_remote_protect {
+ GATEMP_REMOTEPROTECT_NONE = 0,
+ /* No remote protection (the gatemp instance will exclusively
+ * offer local protection configured in #GateMP_Params::local_protect)
+ */
+
+ GATEMP_REMOTEPROTECT_SYSTEM = 1,
+ /* Use the SYSTEM remote protection level (default remote protection) */
+
+ GATEMP_REMOTEPROTECT_CUSTOM1 = 2,
+ /* Use the CUSTOM1 remote protection level */
+
+ GATEMP_REMOTEPROTECT_CUSTOM2 = 3
+ /* Use the CUSTOM2 remote protection level */
+};
+
+/* Structure defining parameters for the gatemp module. */
+struct gatemp_params {
+ char *name;
+ /* Name of this instance.
+ * The name (if not NULL) must be unique among all GateMP
+ * instances in the entire system. When creating a new
+ * heap, it is necessary to supply an instance name.
+ */
+
+ u32 region_id;
+ /* Shared region ID
+ * The index corresponding to the shared region from which shared memory
+ * will be allocated.
+ * If not specified, the default of '0' will be used.
+ */
+
+ void *shared_addr;
+ /* Physical address of the shared memory
+ * This value can be left as 'null' unless it is required to place the
+ * heap at a specific location in shared memory. If sharedAddr is null,
+ * then shared memory for a new instance will be allocated from the
+ * heap belonging to the region identified by #GateMP_Params::region_id.
+ */
+
+ enum gatemp_local_protect local_protect;
+ /* Local protection level.
+ * The default value is #GATEMP_LOCALPROTECT_THREAD */
+
+ enum gatemp_remote_protect remote_protect;
+ /* Remote protection level
+ * The default value is #GATEMP_REMOTEPROTECT_SYSTEM */
+};
+
+/* Structure defining config parameters for the gatemp module. */
+struct gatemp_config {
+ u32 num_resources;
+ /* Maximum number of resources */
+ enum gatemp_local_protect default_protection;
+ u32 max_name_len;
+ u32 max_runtime_entries;
+};
+
+
+/* Close an opened gate */
+int gatemp_close(void **handle_ptr);
+
+/* Create a gatemp instance */
+void *gatemp_create(const struct gatemp_params *params);
+
+/* Delete a created gatemp instance */
+int gatemp_delete(void **handle_ptr);
+
+/* Get the default remote gate */
+void *gatemp_get_default_remote(void);
+
+/* Open a created gatemp by name */
+int gatemp_open(char *name, void **handle_ptr);
+
+/* Open a created gatemp by address */
+int gatemp_open_by_addr(void *shared_addr, void **handle_ptr);
+
+/* Initialize a gatemp parameters struct */
+void gatemp_params_init(struct gatemp_params *params);
+
+/* Amount of shared memory required for creation of each instance */
+uint gatemp_shared_mem_req(const struct gatemp_params *params);
+
+/* Enter the gatemp */
+int *gatemp_enter(void *handle);
+
+/* Leave the gatemp */
+void gatemp_leave(void *handle, int *key);
+
+/* Get the default configuration for the gatemp module. */
+void gatemp_get_config(struct gatemp_config *cfg_params);
+
+/* Setup the gatemp module. */
+s32 gatemp_setup(const struct gatemp_config *cfg);
+
+/* Function to destroy the gatemp module. */
+s32 gatemp_destroy(void);
+
+/* Function to attach gatemp to a remote processor */
+int gatemp_attach(u16 remote_proc_id, void *shared_addr);
+
+/* Function to detach gatemp from a remote processor */
+int gatemp_detach(u16 remote_proc_id, void *shared_addr);
+
+/* Function to start gatemp */
+int gatemp_start(void *shared_addr);
+
+/* Function to start gatemp */
+int gatemp_stop(void);
+
+/* Function to create local gatemp */
+void *gatemp_create_local(enum gatemp_local_protect local_protect);
+
+/* Function to return size required in shared region 0 */
+uint gatemp_get_region0_reserved_size(void);
+
+/* Function to get the shared address of a gatemp object */
+u32 *gatemp_get_shared_addr(void *obj);
+
+
+#endif /* _GATEMP_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/gatemp_ioctl.h b/arch/arm/plat-omap/include/syslink/gatemp_ioctl.h
new file mode 100644
index 000000000000..203f6b1a4961
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/gatemp_ioctl.h
@@ -0,0 +1,177 @@
+/*
+ * gatemp_ioctl.h
+ *
+ * Definitions of gatemp ioctl 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 _GATEMP_IOCTL_H_
+#define _GATEMP_IOCTL_H_
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+#include <ipc_ioctl.h>
+#include <gatemp.h>
+
+/* =============================================================================
+ * Macros and types
+ * =============================================================================
+ */
+#define GATEMP_IOC_MAGIC IPC_IOC_MAGIC
+/* IOCTL command ID definitions for GateMP */
+enum CMD_GATEMP {
+ GATEMP_GETCONFIG = GATEMP_BASE_CMD,
+ GATEMP_SETUP,
+ GATEMP_DESTROY,
+ GATEMP_PARAMS_INIT,
+ GATEMP_CREATE,
+ GATEMP_DELETE,
+ GATEMP_OPEN,
+ GATEMP_CLOSE,
+ GATEMP_ENTER,
+ GATEMP_LEAVE,
+ GATEMP_SHAREDMEMREQ,
+ GATEMP_OPENBYADDR,
+ GATEMP_GETDEFAULTREMOTE
+};
+
+/*
+ * IOCTL command IDs for GateMP
+ */
+/* Command for gatemp_get_config */
+#define CMD_GATEMP_GETCONFIG _IOWR(GATEMP_IOC_MAGIC, \
+ GATEMP_GETCONFIG, \
+ struct gatemp_cmd_args)
+/* Command for gatemp_setup */
+#define CMD_GATEMP_SETUP _IOWR(GATEMP_IOC_MAGIC, \
+ GATEMP_SETUP, \
+ struct gatemp_cmd_args)
+/* Command for gatemp_destroy */
+#define CMD_GATEMP_DESTROY _IOWR(GATEMP_IOC_MAGIC, \
+ GATEMP_DESTROY, \
+ struct gatemp_cmd_args)
+/* Command for gatemp_params_init */
+#define CMD_GATEMP_PARAMS_INIT _IOWR(GATEMP_IOC_MAGIC, \
+ GATEMP_PARAMS_INIT, \
+ struct gatemp_cmd_args)
+/* Command for gatemp_create */
+#define CMD_GATEMP_CREATE _IOWR(GATEMP_IOC_MAGIC, \
+ GATEMP_CREATE, \
+ struct gatemp_cmd_args)
+/* Command for gatemp_delete */
+#define CMD_GATEMP_DELETE _IOWR(GATEMP_IOC_MAGIC, \
+ GATEMP_DELETE, \
+ struct gatemp_cmd_args)
+/* Command for gatemp_open */
+#define CMD_GATEMP_OPEN _IOWR(GATEMP_IOC_MAGIC, \
+ GATEMP_OPEN, \
+ struct gatemp_cmd_args)
+/* Command for gatemp_close */
+#define CMD_GATEMP_CLOSE _IOWR(GATEMP_IOC_MAGIC, \
+ GATEMP_CLOSE, \
+ struct gatemp_cmd_args)
+/* Command for gatemp_enter */
+#define CMD_GATEMP_ENTER _IOWR(GATEMP_IOC_MAGIC, \
+ GATEMP_ENTER, \
+ struct gatemp_cmd_args)
+/* Command for gatemp_leave */
+#define CMD_GATEMP_LEAVE _IOWR(GATEMP_IOC_MAGIC, \
+ GATEMP_LEAVE, \
+ struct gatemp_cmd_args)
+/* Command for gatemp_shared_mem_req */
+#define CMD_GATEMP_SHAREDMEMREQ _IOWR(GATEMP_IOC_MAGIC, \
+ GATEMP_SHAREDMEMREQ, \
+ struct gatemp_cmd_args)
+/* Command for gatemp_open_by_addr */
+#define CMD_GATEMP_OPENBYADDR _IOWR(GATEMP_IOC_MAGIC, \
+ GATEMP_OPENBYADDR, \
+ struct gatemp_cmd_args)
+/* Command for gatemp_get_default_remote */
+#define CMD_GATEMP_GETDEFAULTREMOTE _IOWR(GATEMP_IOC_MAGIC, \
+ GATEMP_GETDEFAULTREMOTE, \
+ struct gatemp_cmd_args)
+
+/* Command arguments for GateMP */
+struct gatemp_cmd_args {
+ union {
+ struct {
+ struct gatemp_params *params;
+ } params_init;
+
+ struct {
+ struct gatemp_config *config;
+ } get_config;
+
+ struct {
+ struct gatemp_config *config;
+ } setup;
+
+ struct {
+ void *handle;
+ struct gatemp_params *params;
+ u32 name_len;
+ u32 *shared_addr_srptr;
+ } create;
+
+ struct {
+ void *handle;
+ } delete_instance;
+
+ struct {
+ void *handle;
+ char *name;
+ u32 name_len;
+ u32 *shared_addr_srptr;
+ } open;
+
+ struct {
+ void *handle;
+ u32 *shared_addr_srptr;
+ } open_by_addr;
+
+ struct {
+ void *handle;
+ } close;
+
+ struct {
+ void *handle;
+ int *flags;
+ } enter;
+
+ struct {
+ void *handle;
+ int *flags;
+ } leave;
+
+ struct {
+ struct gatemp_params *params;
+ u32 ret_val;
+ } shared_mem_req;
+
+ struct {
+ void *handle;
+ } get_default_remote;
+ } args;
+
+ s32 api_status;
+};
+
+
+/*
+ * ioctl interface function for gatemp
+ */
+int gatemp_ioctl(struct inode *inode, struct file *filp,
+ unsigned int cmd, unsigned long args);
+
+#endif /* _GATEMP_IOCTL_H_ */
diff --git a/arch/arm/plat-omap/include/syslink/gatempdefs.h b/arch/arm/plat-omap/include/syslink/gatempdefs.h
new file mode 100644
index 000000000000..81f790f2d5e4
--- /dev/null
+++ b/arch/arm/plat-omap/include/syslink/gatempdefs.h
@@ -0,0 +1,116 @@
+/*
+ * gatemp.h
+ *
+ * Definitions of gatemp support proxies
+ *
+ * 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 _GATEMPDEFS_H_
+#define _GATEMPDEFS_H_
+
+
+/* Utilities headers */
+#include <gatepeterson.h>
+/* Enable once ported - GateMPSupportNull may not be needed
+#include <_GateMPSupportNull.h>
+#include <GateMPSupportNull.h>
+#include <gatehwspinlock.h>
+*/
+
+#if 0 /* Enable when SpinLock is available */
+#define gatemp_remote_system_proxy_params_init gate_hwspinlock_params_init
+#define gatemp_remote_custom1_proxy_params_init gatepeterson_params_init
+#define gatemp_remote_custom2_proxy_params_init gatepeterson_params_init
+#define gatemp_remote_system_proxy_create gate_hwspinlock_create
+#define gatemp_remote_custom1_proxy_create gatepeterson_create
+#define gatemp_remote_custom2_proxy_create gatepeterson_create
+#define gatemp_remote_system_proxy_delete gate_hwspinlock_delete
+#define gatemp_remote_custom1_proxy_delete gatepeterson_delete
+#define gatemp_remote_custom2_proxy_delete gatepeterson_delete
+#define gatemp_remote_system_proxy_params struct gate_hwspinlock_params
+#define gatemp_remote_custom1_proxy_params struct gatepeterson_params
+#define gatemp_remote_custom2_proxy_params struct gatepeterson_params
+#define gatemp_remote_system_proxy_shared_mem_req \
+ gate_hwspinlock_shared_mem_req
+#define gatemp_remote_custom1_proxy_shared_mem_req \
+ gatepeterson_shared_mem_req
+#define gatemp_remote_custom2_proxy_shared_mem_req \
+ gatepeterson_shared_mem_req
+#define gatemp_remote_system_proxy_get_num_instances \
+ gatehwspinlock_get_num_instances
+#define gatemp_remote_custom1_proxy_get_num_instances \
+ gatepeterson_get_num_instances
+#define gatemp_remote_custom2_proxy_get_num_instances \
+ gatepeterson_get_num_instances
+#define gatemp_remote_system_proxy_locks_init gatehwspinlock_locks_init
+#define gatemp_remote_custom1_proxy_locks_init gatepeterson_locks_init
+#define gatemp_remote_custom2_proxy_locks_init gatepeterson_locks_init
+#define gatemp_remote_system_proxy_handle void *
+#define gatemp_remote_custom1_proxy_handle void *
+#define gatemp_remote_custom2_proxy_handle void *
+#define gatemp_remote_system_proxy_open_by_addr gate_hwspinlock_open_by_addr
+#define gatemp_remote_custom1_proxy_open_by_addr \
+ gatepeterson_open_by_addr
+#define gatemp_remote_custom2_proxy_open_by_addr \
+ gatepeterson_open_by_addr
+#define gatemp_remote_system_proxy_enter gatehwspinlock_enter
+#define gatemp_remote_system_proxy_leave gatehwspinlock_leave
+#define gatemp_remote_custom1_proxy_enter gatepeterson_enter
+#define gatemp_remote_custom1_proxy_leave gatepeterson_leave
+#define gatemp_remote_custom2_proxy_enter gatepeterson_enter
+#define gatemp_remote_custom2_proxy_leave gatepeterson_leave
+#else
+#define gatemp_remote_system_proxy_params_init gatepeterson_params_init
+#define gatemp_remote_custom1_proxy_params_init gatepeterson_params_init
+#define gatemp_remote_custom2_proxy_params_init gatepeterson_params_init
+#define gatemp_remote_system_proxy_create gatepeterson_create
+#define gatemp_remote_custom1_proxy_create gatepeterson_create
+#define gatemp_remote_custom2_proxy_create gatepeterson_create
+#define gatemp_remote_system_proxy_delete gatepeterson_delete
+#define gatemp_remote_custom1_proxy_delete gatepeterson_delete
+#define gatemp_remote_custom2_proxy_delete gatepeterson_delete
+#define gatemp_remote_system_proxy_params struct gatepeterson_params
+#define gatemp_remote_custom1_proxy_params struct gatepeterson_params
+#define gatemp_remote_custom2_proxy_params struct gatepeterson_params
+#define gatemp_remote_system_proxy_shared_mem_req \
+ gatepeterson_shared_mem_req
+#define gatemp_remote_custom1_proxy_shared_mem_req \
+ gatepeterson_shared_mem_req
+#define gatemp_remote_custom2_proxy_shared_mem_req \
+ gatepeterson_shared_mem_req
+#define gatemp_remote_system_proxy_get_num_instances \
+ gatepeterson_get_num_instances
+#define gatemp_remote_custom1_proxy_get_num_instances \
+ gatepeterson_get_num_instances
+#define gatemp_remote_custom2_proxy_get_num_instances \
+ gatepeterson_get_num_instances
+#define gatemp_remote_system_proxy_locks_init gatepeterson_locks_init
+#define gatemp_remote_custom1_proxy_locks_init gatepeterson_locks_init
+#define gatemp_remote_custom2_proxy_locks_init gatepeterson_locks_init
+#define gatemp_remote_system_proxy_handle void *
+#define gatemp_remote_custom1_proxy_handle void *
+#define gatemp_remote_custom2_proxy_handle void *
+#define gatemp_remote_system_proxy_open_by_addr gatepeterson_open_by_addr
+#define gatemp_remote_custom1_proxy_open_by_addr \
+ gatepeterson_open_by_addr
+#define gatemp_remote_custom2_proxy_open_by_addr \
+ gatepeterson_open_by_addr
+#define gatemp_remote_system_proxy_enter gatepeterson_enter
+#define gatemp_remote_system_proxy_leave gatepeterson_leave
+#define gatemp_remote_custom1_proxy_enter gatepeterson_enter
+#define gatemp_remote_custom1_proxy_leave gatepeterson_leave
+#define gatemp_remote_custom2_proxy_enter gatepeterson_enter
+#define gatemp_remote_custom2_proxy_leave gatepeterson_leave
+#endif
+
+#endif /* _GATEMPDEFS_H_ */