diff options
author | Hari Kanigeri <h-kanigeri2@ti.com> | 2011-10-25 10:50:16 +0800 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2011-10-25 10:50:16 +0800 |
commit | 8ea0179661e8211ed65698616c495d28fd95cde6 (patch) | |
tree | 7906482782da46f569f64ae14bce49f4b33314b6 | |
parent | ec5073038755f06902e5e6e6a00678d7820ced3b (diff) |
SYSLINK: add syslink headers
Add syslink headers
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Miguel Vadillo <vadillo@ti.com>
Signed-off-by: Juan Gutierrez <jgutierrez@ti.com>
Signed-off-by: Paul Hunt <hunt@ti.com>
Signed-off-by: Hari Kanigeri <h-kanigeri2@ti.com>
Signed-off-by: Subramaniam C.A <subramaniam.ca@ti.com>
Signed-off-by: Arun M G <arunmg@ti.com>
Signed-off-by: Ramesh Gupta G <grgupta@ti.com>
Signed-off-by: Jayan John <x00jayan@ti.com>
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
Signed-off-by: Arun Radhakrishnan <x0051460@ti.com>
Signed-off-by: Subin Gangadharan <subin.kg@ti.com>
55 files changed, 8377 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/include/syslink/GlobalTypes.h b/arch/arm/plat-omap/include/syslink/GlobalTypes.h new file mode 100644 index 00000000000..6cd959cde95 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/GlobalTypes.h @@ -0,0 +1,154 @@ +/* + * GlobalTypes.h + * + * Syslink driver support for OMAP 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 __GLOBALTYPES_H +#define __GLOBALTYPES_H + +#define REG volatile + +/* + * Definition: RET_CODE_BASE + * + * DESCRIPTION: Base value for return code offsets + * + * + */ +#define RET_CODE_BASE 0 + +/* + * TYPE: ReturnCode_t + * + * DESCRIPTION: Return codes to be returned by all library functions + * + * + */ +enum ReturnCode_label { +RET_OK = 0, +RET_FAIL = -1, +RET_BAD_NULL_PARAM = -2, +RET_PARAM_OUT_OF_RANGE = -3, +RET_INVALID_ID = -4, +RET_EMPTY = -5, +RET_FULL = -6, +RET_TIMEOUT = -7, +RET_INVALID_OPERATION = -8, +/* Add new error codes at end of above list */ +RET_NUM_RET_CODES /* this should ALWAYS be LAST entry */ +}; + + + +/* + * MACRO: RD_MEM_32_VOLATILE, WR_MEM_32_VOLATILE + * + * DESCRIPTION: 32 bit register access macros + * + * + */ +#define RD_MEM_32_VOLATILE(addr) \ +((unsigned long)(*((REG unsigned long *)(addr)))) + +#define WR_MEM_32_VOLATILE(addr, data) \ +(*((REG unsigned long *)(addr)) = (unsigned long)(data)) + + + + +#ifdef CHECK_INPUT_PARAMS +/* + * MACRO: CHECK_INPUT_PARAMS + * + * DESCRIPTION: Checks an input code and returns a specified value if code is + * invalid value, also writes spy value if error found. + * + * NOTE: Can be disabled to save HW cycles. + * + * + */ +#define CHECK_INPUT_PARAM(actualValue, invalidValue, \ +returnCodeIfMismatch, spyCodeIfMisMatch) do {\ + if ((invalidValue) == (actualValue)) {\ + RES_Set((spyCodeIfMisMatch));\ + return returnCodeIfMismatch; \ + } \ +} while (0) + +/* + * MACRO: CHECK_INPUT_RANGE + * + * DESCRIPTION: Checks an input value and returns a specified value if not in + * specified range, also writes spy value if error found. + * +* NOTE: Can be disabled to save HW cycles. + * + * + */ +#define CHECK_INPUT_RANGE(actualValue, minValidValue, maxValidValue, \ +returnCodeIfMismatch, spyCodeIfMisMatch) do {\ + if (((actualValue) < (minValidValue)) || \ + ((actualValue) > (maxValidValue))) {\ + RES_Set((spyCodeIfMisMatch));\ + return returnCodeIfMismatch; \ + } \ +} while (0) + +/* + * MACRO: CHECK_INPUT_RANGE_MIN0 + * + * DESCRIPTION: Checks an input value and returns a + * specified value if not in + * specified range, also writes spy value if error found. + * The minimum + * value is 0. + * + * NOTE: Can be disabled to save HW cycles. + * + * + */ +#define CHECK_INPUT_RANGE_MIN0(actualValue, maxValidValue, \ +returnCodeIfMismatch, spyCodeIfMisMatch) do {\ + if ((actualValue) > (maxValidValue)) {\ + RES_Set((spyCodeIfMisMatch));\ + return returnCodeIfMismatch; \ + } \ +} while (0) + +#else + +#define CHECK_INPUT_PARAM(actualValue, invalidValue, returnCodeIfMismatch,\ +spyCodeIfMisMatch) + +#define CHECK_INPUT_PARAM_NO_SPY(actualValue, invalidValue, \ +returnCodeIfMismatch) + +#define CHECK_INPUT_RANGE(actualValue, minValidValue, maxValidValue, \ +returnCodeIfMismatch, spyCodeIfMisMatch) + +#define CHECK_INPUT_RANGE_NO_SPY(actualValue, minValidValue , \ +maxValidValue, returnCodeIfMismatch) + +#define CHECK_INPUT_RANGE_MIN0(actualValue, maxValidValue, \ +returnCodeIfMismatch, spyCodeIfMisMatch) + +#define CHECK_INPUT_RANGE_NO_SPY_MIN0(actualValue, \ +maxValidValue, returnCodeIfMismatch) + +#endif + +#ifdef __cplusplus +} +#endif +#endif /* __GLOBALTYPES_H */ 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 00000000000..282d2c8c10e --- /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/_notify.h b/arch/arm/plat-omap/include/syslink/_notify.h new file mode 100644 index 00000000000..9f9d8891416 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/_notify.h @@ -0,0 +1,83 @@ +/* + * _notify.h + * + * The MessageQ module supports the structured sending and receiving of + * variable length messages. This module can be used for homogeneous or + * heterogeneous multi-processor messaging. + * + * Copyright (C) 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. + */ + +#if !defined(__NOTIFY_H_) +#define __NOTIFY_H_ + + +/* Module headers */ +#include <syslink/notify.h> + + +/* Module ID for notify. */ +#define NOTIFY_MODULEID ((u16) 0x5F84) + +/* Mask to check for event ID. */ +#define NOTIFY_EVENT_MASK ((u16) 0xFFFF) + +#define ISRESERVED(event_id, reserved_event) \ + (((event_id & NOTIFY_EVENT_MASK) >= reserved_event) || \ + ((event_id >> 16) == NOTIFY_SYSTEMKEY)) + +/* This structure defines attributes for initialization of the notify module. */ +struct notify_config { + u32 num_events; + /* Number of events to be supported */ + u32 send_event_poll_count; + /* Poll for specified amount before send_event times out */ + u32 num_lines; + /* Max. number of interrupt lines between a single pair of processors */ + u32 reserved_events; + /* Number of reserved events to be supported */ +}; + +/* This structure defines the configuration structure for initialization + * of the notify object. */ +struct notify_params { + u32 reserved; /* Reserved field */ +}; + + +/* Function to get the default configuration for the notify module. */ +void notify_get_config(struct notify_config *cfg); + +/* Function to setup the notify module */ +int notify_setup(struct notify_config *cfg); + +/* Function to destroy the notify module */ +int notify_destroy(void); + +/* Function to create an instance of notify driver */ +struct notify_object *notify_create(void *driver_handle, u16 remote_proc_id, + u16 line_id, const struct notify_params *params); + +/* Function to delete an instance of notify driver */ +int notify_delete(struct notify_object **handle_ptr); + +/* Function to call device specific the notify module setup */ +int notify_attach(u16 proc_id, void *shared_addr); + +/* Function to destroy the device specific notify module */ +int notify_detach(u16 proc_id); + +/* Function registered as callback with the notify driver */ +void notify_exec(struct notify_object *obj, u32 event_id, u32 payload); + + +#endif /* !defined(__NOTIFY_H_) */ diff --git a/arch/arm/plat-omap/include/syslink/_sysmgr.h b/arch/arm/plat-omap/include/syslink/_sysmgr.h new file mode 100644 index 00000000000..58fbdd37815 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/_sysmgr.h @@ -0,0 +1,50 @@ +/* + * _sysmgr.h + * + * Defines for system manager functions + * + * Copyright (C) 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 __SYSMGR_H_ +#define __SYSMGR_H_ + +/* Structure to retrieve the scalability proc info from the slave */ +struct sysmgr_proc_config { + u32 proc_id; + u32 use_notify; + u32 use_messageq; + u32 use_heapbuf; + u32 use_frameq; + u32 use_ringio; + u32 use_listmp; + u32 use_nameserver; + u32 boot_mode; +}; + +/* Function to set the boot load page address for a slave */ +void sysmgr_set_boot_load_page(u16 proc_id, u32 boot_load_page); + +/* Function to get configuration values for a host object(component/instance) */ +u32 sysmgr_get_object_config(u16 proc_id, void *config, u32 cmd_id, u32 size); + +/* Function to put configuration values for a slave object(component/instance)*/ +u32 sysmgr_put_object_config(u16 proc_id, void *config, u32 cmd_id, u32 size); + +/* Function to wait for scalability handshake value. */ +void sysmgr_wait_for_scalability_info(u16 proc_id); + +/* Function to wait for slave to complete setup */ +void sysmgr_wait_for_slave_setup(u16 proc_id); + + +#endif /* ifndef __SYSMGR_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/atomic_linux.h b/arch/arm/plat-omap/include/syslink/atomic_linux.h new file mode 100644 index 00000000000..da4cb21b1ec --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/atomic_linux.h @@ -0,0 +1,104 @@ +/* +* atomic_linux.h +* +* Atomic operations functions +* +* 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 _ATOMIC_LINUX_H +#define _ATOMIC_LINUX_H + +#include <linux/types.h> +#include <generated/autoconf.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <asm/atomic.h> + +/* + * ======== atomic_cmpmask_and_set ======== + * Purpose: + * This will compare a mask and set if not equal + */ +static inline void atomic_cmpmask_and_set(atomic_t *v, u32 mask, u32 val) +{ + s32 ret; + unsigned long flags; + atomic_t *atm = v; + + raw_local_irq_save(flags); + ret = atm->counter; + if (likely(((ret & mask) != mask))) + atm->counter = val; + raw_local_irq_restore(flags); +} + +/* + * ======== atomic_cmpmask_and_set ======== + * Purpose: + * This will compare a mask and then check current value less than + * provided value. + */ +static inline bool atomic_cmpmask_and_lt(atomic_t *v, u32 mask, u32 val) +{ + bool ret = true; + atomic_t *atm = v; + s32 cur; + unsigned long flags; + + raw_local_irq_save(flags); + cur = atm->counter; + /* Compare mask, if matches then compare val */ + if (likely(((cur & mask) == mask))) { + if (likely(cur >= val)) + ret = false; + } + raw_local_irq_restore(flags); + + /* retval = true if mask matches and current value is less than given + * value */ + /* retval = false either mask doesnot matches or current value is not + * less than given value */ + return ret; +} + + +/* + * ======== atomic_cmpmask_and_set ======== + * Purpose: + * This will compare a mask and then check current value greater than + * provided value. + */ +static inline bool atomic_cmpmask_and_gt(atomic_t *v, u32 mask, u32 val) +{ + bool ret = false; + atomic_t *atm = v; + s32 cur; + unsigned long flags; + + raw_local_irq_save(flags); + cur = atm->counter; + /* Compare mask, if matches then compare val */ + if (likely(((cur & mask) == mask))) { + if (likely(cur > val)) + ret = true; + } + + raw_local_irq_restore(flags); + /* retval = true if mask matches and current value is less than given + * value */ + /* etval =false either mask doesnot matches or current value is not + * greater than given value */ + return ret; +} + +#endif /* if !defined(_ATOMIC_LINUX_H) */ diff --git a/arch/arm/plat-omap/include/syslink/drv_notify.h b/arch/arm/plat-omap/include/syslink/drv_notify.h new file mode 100644 index 00000000000..c8a783eca4f --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/drv_notify.h @@ -0,0 +1,43 @@ +/* + * drv_notify.h + * + * Notify driver support for OMAP 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. + */ + + +#if !defined _DRV_NOTIFY_H_ +#define _DRV_NOTIFY_H_ + + +/* Module includes */ +#include <syslink/notify_driverdefs.h> +#include <syslink/_notify.h> + + +/* read function for of Notify driver.*/ +int notify_drv_read(struct file *filp, char __user *dst, size_t size, + loff_t *offset); + +/* Linux driver function to map memory regions to user space. */ +int notify_drv_mmap(struct file *filp, struct vm_area_struct *vma); + +/* ioctl function for of Linux Notify driver.*/ +int notify_drv_ioctl(struct inode *inode, struct file *filp, u32 cmd, + unsigned long args, bool user); + +void _notify_drv_setup(void); + +void _notify_drv_destroy(void); + + +#endif /* !defined (_DRV_NOTIFY_H_) */ diff --git a/arch/arm/plat-omap/include/syslink/gate.h b/arch/arm/plat-omap/include/syslink/gate.h new file mode 100644 index 00000000000..1041f752f46 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/gate.h @@ -0,0 +1,76 @@ +/* + * gate.h + * + * Critical section support. + * + * 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. + */ +/** ============================================================================ + * Gates are used by clients to protect concurrent access to critical + * data structures. Critical data structures are those that must be + * updated by at most one thread at a time. All code that needs access + * to a critical data structure "enters" a gate (that's associated with the + * data structure) prior to accessing the data, modifies the data structure, + * then "leaves" the gate. + * + * A gate is responsible for ensuring that at most one thread at a time + * can enter and execute "inside" the gate. There are several + * implementations of gates, with different system executation times and + * latency tradoffs. In addition, some gates must not be entered by certain + * thread types; e.g., a gate that is implemented via a "blocking" semaphore + * must not be called by an interrupt service routine (ISR). + * + * A module can be declared "gated" by adding the `@Gated` attribute to the + * module's XDC spec file. A "gated" module is assigned a module-level gate + * at the configuration time, and that gate is then used to protect critical + * sections in the module's target code. A module-level gate is an instance of + * a module implementing `{@link IGateProvider}` interface. However, gated + * modules do not access their module-level gates directly. They use this + * module to access transparently their module-level gate. + * + * Application code that is not a part of any module also has a + * module-level gate, configured through the module `{@link Main}`. + * + * Each gated module can optionally create gates on an adhoc basis at + * runtime using the same gate module that was used to create the module + * level gate. + * + * Gates that work by disabling all preemption while inside a gate can be + * used to protect data structures accessed by ISRs and other + * threads. But, if the time required to update the data structure is not + * a small constant, this type of gate may violate a system's real-time + * requirements. + * + * Gates have two orthogonal attributes: "blocking" and "preemptible". + * In general, gates that are "blocking" can not be use by code that is + * called by ISRs and gates that are not "preemptible" should only be used to + * to protect data manipulated by code that has small constant execution + * time. + * ============================================================================ + */ + + +#ifndef GATE_H_0xAF6F +#define GATE_H_0xAF6F + +#include <igateprovider.h> + +extern struct igateprovider_object *gate_system_handle; + +/* Function to enter a Gate */ +int *gate_enter_system(void); + +/* Function to leave a Gate */ +void gate_leave_system(int *key); + + +#endif /* GATE_H_0xAF6F */ diff --git a/arch/arm/plat-omap/include/syslink/gate_remote.h b/arch/arm/plat-omap/include/syslink/gate_remote.h new file mode 100644 index 00000000000..5ed6b7f155f --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/gate_remote.h @@ -0,0 +1,33 @@ +/* + * gate_remote.h + * + * This includes the functions to handle remote gates + * + * 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 _NAMESERVER_REMOTE_H_ +#define _GATE_REMOTE_H_ + +#include <linux/types.h> + +/* + * This function is used to enter in to a remote gate + */ +int gate_remote_enter(void *ghandle, u32 key); + +/* + * This function is used to leave from a remote gate + */ +int gate_remote_leave(void *ghandle, u32 key); + +#endif /* _GATE_REMOTE_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/gatehwspinlock.h b/arch/arm/plat-omap/include/syslink/gatehwspinlock.h new file mode 100644 index 00000000000..209d12bdd6b --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/gatehwspinlock.h @@ -0,0 +1,161 @@ +/* + * gatehwspinlock.h + * + * Defines for gatehwspinlock. + * + * Copyright(C) 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 GATEHWSPINLOCK_H_ +#define GATEHWSPINLOCK_H_ + +/* Module headers */ +#include <multiproc.h> +#include <gatemp.h> +#include <igatempsupport.h> +#include <sharedregion.h> + +/* Unique module ID. */ +#define GATEHWSPINLOCK_MODULEID (0xF416) + +/* ============================================================================= + * Module Success and Failure codes + * ============================================================================= + */ +/* Argument passed to a function is invalid. */ +#define GATEHWSPINLOCK_E_INVALIDARG -1 + +/* Memory allocation failed. */ +#define GATEHWSPINLOCK_E_MEMORY -2 + +/* the name is already registered or not. */ +#define GATEHWSPINLOCK_E_BUSY -3 + +/* Generic failure. */ +#define GATEHWSPINLOCK_E_FAIL -4 + +/* name not found in the nameserver. */ +#define GATEHWSPINLOCK_E_NOTFOUND -5 + +/* Module is not initialized. */ +#define GATEHWSPINLOCK_E_INVALIDSTATE -6 + +/* Instance is not created on this processor. */ +#define GATEHWSPINLOCK_E_NOTONWER -7 + +/* Remote opener of the instance has not closed the instance. */ +#define GATEHWSPINLOCK_E_REMOTEACTIVE -8 + +/* Indicates that the instance is in use. */ +#define GATEHWSPINLOCK_E_INUSE -9 + +/* Failure in OS call. */ +#define GATEHWSPINLOCK_E_OSFAILURE -10 + +/* Version mismatch error. */ +#define GATEHWSPINLOCK_E_VERSION -11 + +/* Operation successful. */ +#define GATEHWSPINLOCK_S_SUCCESS 0 + +/* The GATEHWSPINLOCK module has already been setup in this process. */ +#define GATEHWSPINLOCK_S_ALREADYSETUP 1 + + +/* ============================================================================= + * Macros + * ============================================================================= + */ + +/* Q_BLOCKING */ +#define GATEHWSEM_Q_BLOCKING (1) + +/* Q_PREEMPTING */ +#define GATEHWSEM_Q_PREEMPTING (2) + + +/* ============================================================================= + * Enums & Structures + * ============================================================================= + */ + +/* Structure defining config parameters for the gatehwspinlock module. */ +struct gatehwspinlock_config { + enum gatemp_local_protect default_protection; + /* Default module-wide local context protection level. The level of + * protection specified here determines which local gate is created + * per gatehwspinlock instance for local protection during create. + * The instance configuration parameter may be used to 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 protection needed locally. + */ + u32 base_addr; + /* Device-specific base address for HW Semaphore subsystem in HOST OS + * address space, this is updated in Ipc module */ + u32 num_locks; + /* Device-specific number of semphores in the HW Semaphore subsystem */ +}; + +/* Structure defining config parameters for the gatehwspinlock instances. */ +struct gatehwspinlock_params { + IGATEMPSUPPORT_SUPERPARAMS; +}; + + +/* Inherit everything from IGateMPSupport */ +IGATEMPSUPPORT_INHERIT(gatehwspinlock); + + +/* ============================================================================= + * APIs + * ============================================================================= + */ +/* Function to get the default configuration for the gatehwspinlock module. */ +void gatehwspinlock_get_config(struct gatehwspinlock_config *config); + +/* Function to setup the gatehwspinlock module. */ +int gatehwspinlock_setup(const struct gatehwspinlock_config *config); + +/* Function to destroy the gatehwspinlock module */ +int gatehwspinlock_destroy(void); + +/* Get the default parameters for the gatehwspinlock instance. */ +void gatehwspinlock_params_init(struct gatehwspinlock_params *params); + +/* Function to create an instance of gatehwspinlock */ +void *gatehwspinlock_create(enum igatempsupport_local_protect local_protect, + const struct gatehwspinlock_params *params); + +/* Function to delete an instance of gatehwspinlock */ +int gatehwspinlock_delete(void **handle_ptr); + +/* Function to enter the gatehwspinlock instance */ +int *gatehwspinlock_enter(void *handle); + +/* Function to leave the gatehwspinlock instance */ +void gatehwspinlock_leave(void *handle, int *key); + +/* Function to return the shared memory requirement for a single instance */ +u32 gatehwspinlock_shared_mem_req(const struct gatehwspinlock_params *params); + +/* Function to return the number of instances configured in the module. */ +u32 gatehwspinlock_get_num_instances(void); + +/* Function to return the number of instances not controlled by GateMP. */ +u32 gatehwspinlock_get_num_reserved(void); + +/* Function to initialize the locks module. */ +void gatehwspinlock_locks_init(void); + +#endif /* ifndef GATEHWSPINLOCK_H_ */ 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 00000000000..d2d2e4714f3 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/gatemp.h @@ -0,0 +1,246 @@ +/* + * 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); + +/* Query the gate */ +bool gatemp_query(int qual); + +/* Get the default remote gate */ +void *gatemp_get_default_remote(void); + +/* Get the local protect gate. */ +enum gatemp_local_protect gatemp_get_local_protect(void *obj); + +/* Get the remote protect gate. */ +enum gatemp_remote_protect gatemp_get_remote_protect(void *obj); + +/* 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 00000000000..ff99aebf2fc --- /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, bool user); + +#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 00000000000..46f83e2c630 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/gatempdefs.h @@ -0,0 +1,128 @@ +/* + * 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> +#include <gatehwspinlock.h> +/* Enable once ported - GateMPSupportNull may not be needed +#include <_GateMPSupportNull.h> +#include <GateMPSupportNull.h> +*/ + +#if 1 /* Enable when SpinLock is available */ +#define gatemp_remote_system_proxy_params_init gatehwspinlock_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 gatehwspinlock_create +#define gatemp_remote_custom1_proxy_create gatepeterson_create +#define gatemp_remote_custom2_proxy_create gatepeterson_create +#define gatemp_remote_system_proxy_delete gatehwspinlock_delete +#define gatemp_remote_custom1_proxy_delete gatepeterson_delete +#define gatemp_remote_custom2_proxy_delete gatepeterson_delete +#define gatemp_remote_system_proxy_params struct gatehwspinlock_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 \ + gatehwspinlock_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_get_num_reserved \ + gatehwspinlock_get_num_reserved +#define gatemp_remote_custom1_proxy_get_num_reserved \ + gatepeterson_get_num_reserved +#define gatemp_remote_custom2_proxy_get_num_reserved \ + gatepeterson_get_num_reserved +#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 gatehwspinlock_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_get_num_reserved \ + gatepeterson_get_num_reserved +#define gatemp_remote_custom1_proxy_get_num_reserved \ + gatepeterson_get_num_reserved +#define gatemp_remote_custom2_proxy_get_num_reserved \ + gatepeterson_get_num_reserved +#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_ */ diff --git a/arch/arm/plat-omap/include/syslink/gatepeterson.h b/arch/arm/plat-omap/include/syslink/gatepeterson.h new file mode 100644 index 00000000000..31e7e7c0ed4 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/gatepeterson.h @@ -0,0 +1,145 @@ +/* + * gatepeterson.h + * + * The Gate Peterson Algorithm for mutual exclusion of shared memory. + * Current implementation works for 2 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 _GATEPETERSON_H_ +#define _GATEPETERSON_H_ + +#include <linux/types.h> + +#include <igatempsupport.h> + +/* + * GATEPETERSON_MODULEID + * Unique module ID + */ +#define GATEPETERSON_MODULEID (0xF415) + +/* + * A set of context protection levels that each correspond to + * single processor gates used for local protection + */ +enum gatepeterson_protect { + GATEPETERSON_PROTECT_DEFAULT = 0, + GATEPETERSON_PROTECT_NONE = 1, + GATEPETERSON_PROTECT_INTERRUPT = 2, + GATEPETERSON_PROTECT_TASKLET = 3, + GATEPETERSON_PROTECT_THREAD = 4, + GATEPETERSON_PROTECT_PROCESS = 5, + GATEPETERSON_PROTECT_END_VALUE = 6 +}; + +/* + * Structure defining config parameters for the Gate Peterson + * module + */ +struct gatepeterson_config { + enum gatepeterson_protect default_protection; + /*!< Default module-wide local context protection level. The level of + * protection specified here determines which local gate is created per + * 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 num_instances; + /*!< Maximum number of instances supported by the GatePeterson module */ + +}; + +/* + * Structure defining config parameters for the Gate Peterson + * instances + */ +struct gatepeterson_params { + IGATEMPSUPPORT_SUPERPARAMS; +}; + +/* + * Function to initialize the parameter structure + */ +void gatepeterson_get_config(struct gatepeterson_config *config); + +/* + * Function to initialize GP module + */ +int gatepeterson_setup(const struct gatepeterson_config *config); + +/* + * Function to destroy the GP module + */ +int gatepeterson_destroy(void); + +/* + * Function to initialize the parameter structure + */ +void gatepeterson_params_init(struct gatepeterson_params *params); + +/* + * Function to create an instance of GatePeterson + */ +void *gatepeterson_create(enum igatempsupport_local_protect local_protect, + const struct gatepeterson_params *params); + +/* + * Function to delete an instance of GatePeterson + */ +int gatepeterson_delete(void **gphandle); + +/* + * Function to open a previously created instance by address + */ +int gatepeterson_open_by_addr(enum igatempsupport_local_protect local_protect, + void *shared_addr, void **gphandle); + +/* + * Function to close a previously opened instance + */ +int gatepeterson_close(void **gphandle); + +/* + * Function to enter the gate peterson + */ +int *gatepeterson_enter(void *gphandle); + +/* + *Function to leave the gate peterson + */ +void gatepeterson_leave(void *gphandle, int *key); + +/* + * Function to return the shared memory requirement + */ +u32 gatepeterson_shared_mem_req(const struct gatepeterson_params *params); + +/* + * Function to return the number of instances configured in the module. + */ +u32 gatepeterson_get_num_instances(void); + +/* + * Function to return the number of instances not controlled by GateMP. + */ +u32 gatepeterson_get_num_reserved(void); + +/* + * Function to initialize the locks module. + */ +void gatepeterson_locks_init(void); + +#endif /* _GATEPETERSON_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/gt.h b/arch/arm/plat-omap/include/syslink/gt.h new file mode 100644 index 00000000000..95e3feb18e7 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/gt.h @@ -0,0 +1,320 @@ + +/* + * gt.h + * + * DSP-BIOS Bridge driver support functions for TI OMAP processors. + * + * Copyright (C) 2008 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. + */ + + +/* + * ======== gt.h ======== + * Purpose: + * There are two definitions that affect which portions of trace + * are acutally compiled into the client: GT_TRACE and GT_ASSERT. If + * GT_TRACE is set to 0 then all trace statements (except for assertions) + * will be compiled out of the client. If GT_ASSERT is set to 0 then + * assertions will be compiled out of the client. GT_ASSERT can not be + * set to 0 unless GT_TRACE is also set to 0 (i.e. GT_TRACE == 1 implies + * GT_ASSERT == 1). + * + *! Revision History + *! ================ + *! 02-Feb-2000 rr: Renamed this file to gtce.h. GT CLASS and trace + *! definitions are WinCE Specific. + *! 03-Jan-1997 ge Replaced "GT_" prefix to GT_Config structure members + *! to eliminate preprocessor confusion with other macros. + */ +#include <linux/types.h> +#ifndef GT_ +#define GT_ + +#ifndef GT_TRACE +#define GT_TRACE 0 /* 0 = "trace compiled out"; 1 = "trace active" */ +#endif + +/* #include <syslink/host_os.h> */ + +typedef s32(*Fxn)(); /* generic function type */ + + +#if !defined(GT_ASSERT) || GT_TRACE +#define GT_ASSERT 1 +#endif + +struct GT_Config { + Fxn PRINTFXN; + Fxn PIDFXN; + Fxn TIDFXN; + Fxn ERRORFXN; +}; + +extern struct GT_Config *GT; + +struct gt_mask { + char *modName; + u8 *flags; +} ; + +/* + * New GT Class defenitions. + * + * The following are the explanations and how it could be used in the code + * + * - GT_ENTER On Entry to Functions + * + * - GT_1CLASS Display level of debugging status- Object/Automatic + * variables + * - GT_2CLASS ---- do ---- + * + * - GT_3CLASS ---- do ---- + It can be used(recommended) for debug + * status in the ISR, IST + * - GT_4CLASS ---- do ---- + * + * - GT_5CLASS Display entry for module init/exit functions + * + * - GT_6CLASS Warn whenever SERVICES function fails + * + * - GT_7CLASS Warn failure of Critical failures + * + */ + +#define GT_ENTER ((u8)0x01) +#define GT_1CLASS ((u8)0x02) +#define GT_2CLASS ((u8)0x04) +#define GT_3CLASS ((u8)0x08) +#define GT_4CLASS ((u8)0x10) +#define GT_5CLASS ((u8)0x20) +#define GT_6CLASS ((u8)0x40) +#define GT_7CLASS ((u8)0x80) +#define GT_LEAVE ((u8)0x02) + +#ifdef _LINT_ + +/* LINTLIBRARY */ + +/* + * ======== GT_assert ======== + */ +/* ARGSUSED */ +void GT_assert(struct gt_mask mask, s32 expr) +{ +} + +/* + * ======== GT_config ======== + */ +/* ARGSUSED */ +void GT_config(struct GT_Config config) +{ +} + +/* + * ======== GT_create ======== + */ +/* ARGSUSED */ +void GT_create(struct gt_mask *mask, char *modName) +{ +} + +/* + * ======== GT_curline ======== + * Purpose: + * Returns the current source code line number. Is useful for performing + * branch testing using trace. For example, + * + * gt_1trace(curTrace, GT_1CLASS, + * "in module XX_mod, executing line %u\n", GT_curline()); + */ +/* ARGSUSED */ +u16 GT_curline(void) +{ + return (u16)NULL; +} + +/* + * ======== GT_exit ======== + */ +/* ARGSUSED */ +void GT_exit(void) +{ +} + +/* + * ======== GT_init ======== + */ +/* ARGSUSED */ +void GT_init(void) +{ +} + +/* + * ======== GT_query ======== + */ +/* ARGSUSED */ +bool GT_query(struct gt_mask mask, u8 class) +{ + return false; +} + +/* + * ======== GT_set ======== + * sets trace mask according to settings + */ + +/* ARGSUSED */ +void GT_set(char *settings) +{ +} + +/* + * ======== GT_setprintf ======== + * sets printf function + */ + +/* ARGSUSED */ +void GT_setprintf(Fxn fxn) +{ +} + +/* ARGSUSED */ +void gt_0trace(struct gt_mask mask, u8 class, char *format) +{ +} + +/* ARGSUSED */ +void gt_1trace(struct gt_mask mask, u8 class, char *format, ...) +{ +} + +/* ARGSUSED */ +void gt_2trace(struct gt_mask mask, u8 class, char *format, ...) +{ +} + +/* ARGSUSED */ +void gt_3trace(struct gt_mask mask, u8 class, char *format, ...) +{ +} + +/* ARGSUSED */ +void gt_4trace(struct gt_mask mask, u8 class, char *format, ...) +{ +} + +/* ARGSUSED */ +void gt_5trace(struct gt_mask mask, u8 class, char *format, ...) +{ +} + +/* ARGSUSED */ +void GT_6trace(struct gt_mask mask, u8 class, char *format, ...) +{ +} + +#else + +#define GT_BOUND 26 /* 26 letters in alphabet */ + +extern void _GT_create(struct gt_mask *mask, char *modName); + +#define GT_exit() + +extern void GT_init(void); +extern void _GT_set(char *str); +extern s32 _GT_trace(struct gt_mask *mask, char *format, ...); + +#if GT_ASSERT == 0 + +#define GT_assert(mask, expr) +#define GT_config(config) +#define GT_configInit(config) +#define GT_seterror(fxn) + +#else + +extern struct GT_Config _GT_params; + +#define GT_assert(mask, expr) \ + (!(expr) ? \ + printk(KERN_ALERT "assertion violation: %s, line %d\n", \ + __FILE__, __LINE__), NULL : NULL) + +#define GT_config(config) (_GT_params = *(config)) +#define GT_configInit(config) (*(config) = _GT_params) +#define GT_seterror(fxn) (_GT_params.ERRORFXN = (Fxn)(fxn)) + +#endif + +#if GT_TRACE == 0 + +#define GT_curline() ((u16)__LINE__) +#define GT_create(mask, modName) +#define GT_exit() +#define GT_init() +#define GT_set(settings) +#define GT_setprintf(fxn) + +#define GT_query(mask, class) false + +#define gt_0trace(mask, class, format) +#define gt_1trace(mask, class, format, arg1) +#define gt_2trace(mask, class, format, arg1, arg2) +#define gt_3trace(mask, class, format, arg1, arg2, arg3) +#define gt_4trace(mask, class, format, arg1, arg2, arg3, arg4) +#define gt_5trace(mask, class, format, arg1, arg2, arg3, arg4, arg5) +#define GT_6trace(mask, class, format, arg1, arg2, arg3, arg4, arg5, arg6) + +#else /* GT_TRACE == 1 */ + +#define GT_create(mask, modName) _GT_create((mask), (modName)) +#define GT_curline() ((u16)__LINE__) +#define GT_set(settings) _GT_set(settings) +#define GT_setprintf(fxn) (_GT_params.PRINTFXN = (Fxn)(fxn)) + +#define GT_query(mask, class) ((*(mask).flags & (class))) + +#define gt_0trace(mask, class, format) \ + ((*(mask).flags & (class)) ? \ + _GT_trace(&(mask), (format)) : 0) + +#define gt_1trace(mask, class, format, arg1) \ + ((*(mask).flags & (class)) ? \ + _GT_trace(&(mask), (format), (arg1)) : 0) + +#define gt_2trace(mask, class, format, arg1, arg2) \ + ((*(mask).flags & (class)) ? \ + _GT_trace(&(mask), (format), (arg1), (arg2)) : 0) + +#define gt_3trace(mask, class, format, arg1, arg2, arg3) \ + ((*(mask).flags & (class)) ? \ + _GT_trace(&(mask), (format), (arg1), (arg2), (arg3)) : 0) + +#define gt_4trace(mask, class, format, arg1, arg2, arg3, arg4) \ + ((*(mask).flags & (class)) ? \ + _GT_trace(&(mask), (format), (arg1), (arg2), (arg3), (arg4)) : 0) + +#define gt_5trace(mask, class, format, arg1, arg2, arg3, arg4, arg5) \ + ((*(mask).flags & (class)) ? \ + _GT_trace(&(mask), (format), (arg1), (arg2), (arg3), (arg4), (arg5)) \ + : 0) + +#define GT_6trace(mask, class, format, arg1, arg2, arg3, arg4, arg5, arg6) \ + ((*(mask).flags & (class)) ? \ + _GT_trace(&(mask), (format), (arg1), (arg2), (arg3), (arg4), (arg5), \ + (arg6)) : 0) + +#endif /* GT_TRACE */ + +#endif /* _LINT_ */ + +#endif /* GTCE_ */ diff --git a/arch/arm/plat-omap/include/syslink/heap.h b/arch/arm/plat-omap/include/syslink/heap.h new file mode 100644 index 00000000000..47949ad1cbb --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/heap.h @@ -0,0 +1,96 @@ +/* + * heap.h + * + * Heap module manages fixed size buffers that can be used + * in a multiprocessor system with shared memory. + * + * 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 _HEAP_H_ +#define _HEAP_H_ + +#include <linux/types.h> + +/* + * Structure defining memory related statistics + */ +struct memory_stats{ + u32 total_size; /* Total memory size */ + u32 total_free_size; /* Total free memory size */ + u32 largest_free_size; /* Largest free memory size */ +}; + +/*! + * ======== extendedstats ======== + * Stats structure for the get_extended_stats API. + * + * max_allocated_blocks: The maximum number of blocks allocated + * from this heap at any single point in time during the lifetime of this + * heap instance. + * + * num_allocated_blocks: The total number of blocks currently + * allocated in this Heap instance. + */ +struct heap_extended_stats { + u32 max_allocated_blocks; + u32 num_allocated_blocks; +}; + +/* + * Structure defining config parameters for the heapbuf module + */ +struct heap_config { + u32 max_name_len; /* Maximum length of name */ + bool track_max_allocs; /* Track the max number of allocated blocks */ +}; + +/* + * Structure for the handle for the heap + */ +struct heap_object { + void* (*alloc) (void *handle, u32 size, u32 align); + int (*free) (void *handle, void *block, u32 size); + void (*get_stats) (void *handle, struct memory_stats *stats); + void (*get_extended_stats) (void *handle, + struct heap_extended_stats *stats); + bool (*is_blocking) (void *handle); + void *obj; +}; + +/* + * Allocate a block + */ +void *sl_heap_alloc(void *handle, u32 size, u32 align); + +/* + * Frees the block to this Heap + */ +int sl_heap_free(void *handle, void *block, u32 size); + +/* + * Get heap statistics + */ +void sl_heap_get_stats(void *handle, struct memory_stats *stats); + +/* + * Get heap extended statistics + */ +void sl_heap_get_extended_stats(void *hphandle, + struct heap_extended_stats *stats); + +/* + * Indicates whether a heap will block on free or alloc + */ +bool sl_heap_is_blocking(void *hphandle); + +#endif /* _HEAP_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/heapbufmp.h b/arch/arm/plat-omap/include/syslink/heapbufmp.h new file mode 100644 index 00000000000..51fd65c0c11 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/heapbufmp.h @@ -0,0 +1,253 @@ +/* + * heapbufmp.h + * + * Heap module manages fixed size buffers that can be used + * in a multiprocessor system with shared memory. + * + * 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 _HEAPBUFMP_H_ +#define _HEAPBUFMP_H_ + +#include <linux/types.h> +#include <heap.h> +#include <listmp.h> + +/*! + * @def LISTMP_MODULEID + * @brief Unique module ID. + */ +#define HEAPBUFMP_MODULEID (0x4cd5) + +/* + * Creation of Heap Buf succesful. +*/ +#define HEAPBUFMP_CREATED (0x05251995) + +/* + * Version. + */ +#define HEAPBUFMP_VERSION (1) + +/* ============================================================================= + * All success and failure codes for the module + * ============================================================================= + */ + +/*! + * @def HEAPBUFMP_S_BUSY + * @brief The resource is still in use + */ +#define HEAPBUFMP_S_BUSY 2 + +/*! + * @def HEAPBUFMP_S_ALREADYSETUP + * @brief The module has been already setup + */ +#define HEAPBUFMP_S_ALREADYSETUP 1 + +/*! + * @def HEAPBUFMP_S_SUCCESS + * @brief Operation is successful. + */ +#define HEAPBUFMP_S_SUCCESS 0 + +/*! + * @def HEAPBUFMP_E_FAIL + * @brief Generic failure. + */ +#define HEAPBUFMP_E_FAIL -1 + +/*! + * @def HEAPBUFMP_E_INVALIDARG + * @brief Argument passed to function is invalid. + */ +#define HEAPBUFMP_E_INVALIDARG -2 + +/*! + * @def HEAPBUFMP_E_MEMORY + * @brief Operation resulted in memory failure. + */ +#define HEAPBUFMP_E_MEMORY -3 + +/*! + * @def HEAPBUFMP_E_ALREADYEXISTS + * @brief The specified entity already exists. + */ +#define HEAPBUFMP_E_ALREADYEXISTS -4 + +/*! + * @def HEAPBUFMP_E_NOTFOUND + * @brief Unable to find the specified entity. + */ +#define HEAPBUFMP_E_NOTFOUND -5 + +/*! + * @def HEAPBUFMP_E_TIMEOUT + * @brief Operation timed out. + */ +#define HEAPBUFMP_E_TIMEOUT -6 + +/*! + * @def HEAPBUFMP_E_INVALIDSTATE + * @brief Module is not initialized. + */ +#define HEAPBUFMP_E_INVALIDSTATE -7 + +/*! + * @def HEAPBUFMP_E_OSFAILURE + * @brief A failure occurred in an OS-specific call */ +#define HEAPBUFMP_E_OSFAILURE -8 + +/*! + * @def HEAPBUFMP_E_RESOURCE + * @brief Specified resource is not available */ +#define HEAPBUFMP_E_RESOURCE -9 + +/*! + * @def HEAPBUFMP_E_RESTART + * @brief Operation was interrupted. Please restart the operation */ +#define HEAPBUFMP_E_RESTART -10 + + +/* ============================================================================= + * Macros + * ============================================================================= + */ + + +/* ============================================================================= + * Structures & Enums + * ============================================================================= + */ + +/* + * Structure defining config parameters for the HeapBuf module. + */ +struct heapbufmp_config { + u32 max_name_len; /* Maximum length of name */ + u32 max_runtime_entries; /* Maximum number of heapbufmp instances */ + /* that can be created */ + bool track_allocs; /* Track the maximum number of allocated */ + /* blocks */ +}; + +/* + * Structure defining parameters for the HeapBuf module + */ +struct heapbufmp_params { + char *name; /* Name of this instance */ + u16 region_id; /* Shared region ID */ + void *shared_addr; /* Physical address of the shared memory */ + u32 block_size; /* Size (in MAUs) of each block */ + u32 num_blocks; /* Number of fixed-size blocks */ + u32 align; /* Alignment (in MAUs, power of 2) of each block */ + bool exact; /* Only allocate on exact match of rquested size */ + void *gate; /* GateMP used for critical region management of */ + /* the shared memory */ +}; + +/* + * Stats structure for the getExtendedStats API. + */ +struct heapbufmp_extended_stats { + u32 max_allocated_blocks; + /* maximum number of blocks allocated from this heap instance */ + u32 num_allocated_blocks; + /* total number of blocks currently allocated from this heap instance*/ +}; + +/* ============================================================================= + * APIs + * ============================================================================= + */ + +/* + * Function to get default configuration for the heapbufmp module + */ +int heapbufmp_get_config(struct heapbufmp_config *cfgparams); + +/* + * Function to setup the heapbufmp module + */ +int heapbufmp_setup(const struct heapbufmp_config *cfg); + +/* + * Function to destroy the heapbufmp module + */ +int heapbufmp_destroy(void); + +/* Initialize this config-params structure with supplier-specified + * defaults before instance creation + */ +void heapbufmp_params_init(struct heapbufmp_params *params); + +/* + * Creates a new instance of heapbufmp module + */ +void *heapbufmp_create(const struct heapbufmp_params *params); + +/* + * Deletes a instance of heapbufmp module + */ +int heapbufmp_delete(void **handle_ptr); + +/* + * Opens a created instance of heapbufmp module by name + */ +int heapbufmp_open(char *name, void **handle_ptr); + +/* + * Opens a created instance of heapbufmp module by address + */ +int heapbufmp_open_by_addr(void *shared_addr, void **handle_ptr); + +/* + * Closes previously opened/created instance of heapbufmp module + */ +int heapbufmp_close(void **handle_ptr); + +/* + * Returns the amount of shared memory required for creation + * of each instance + */ +int heapbufmp_shared_mem_req(const struct heapbufmp_params *params); + +/* + * Allocate a block + */ +void *heapbufmp_alloc(void *hphandle, u32 size, u32 align); + +/* + * Frees the block to this heapbufmp + */ +int heapbufmp_free(void *hphandle, void *block, u32 size); + +/* + * Get memory statistics + */ +void heapbufmp_get_stats(void *hphandle, struct memory_stats *stats); + +/* + * Indicate whether the heap may block during an alloc or free call + */ +bool heapbufmp_isblocking(void *handle); + +/* + * Get extended statistics + */ +void heapbufmp_get_extended_stats(void *hphandle, + struct heapbufmp_extended_stats *stats); + + +#endif /* _HEAPBUFMP_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/heapbufmp_ioctl.h b/arch/arm/plat-omap/include/syslink/heapbufmp_ioctl.h new file mode 100644 index 00000000000..f291a5e3d07 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/heapbufmp_ioctl.h @@ -0,0 +1,232 @@ +/* + * heapbufmp_ioctl.h + * + * Heap module manages fixed size buffers that can be used + * in a multiprocessor system with shared memory. + * + * 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 _HEAPBUFMP_IOCTL_ +#define _HEAPBUFMP_IOCTL_ + +#include <linux/ioctl.h> +#include <linux/types.h> + +#include <ipc_ioctl.h> +#include <heapbufmp.h> + + +enum CMD_HEAPBUF { + HEAPBUFMP_GETCONFIG = HEAPBUFMP_BASE_CMD, + HEAPBUFMP_SETUP, + HEAPBUFMP_DESTROY, + HEAPBUFMP_PARAMS_INIT, + HEAPBUFMP_CREATE, + HEAPBUFMP_DELETE, + HEAPBUFMP_OPEN, + HEAPBUFMP_OPENBYADDR, + HEAPBUFMP_CLOSE, + HEAPBUFMP_ALLOC, + HEAPBUFMP_FREE, + HEAPBUFMP_SHAREDMEMREQ, + HEAPBUFMP_GETSTATS, + HEAPBUFMP_GETEXTENDEDSTATS +}; + +/* + * Command for heapbufmp_get_config + */ +#define CMD_HEAPBUFMP_GETCONFIG _IOWR(IPC_IOC_MAGIC, \ + HEAPBUFMP_GETCONFIG, \ + struct heapbufmp_cmd_args) + +/* + * Command for heapbufmp_setup + */ +#define CMD_HEAPBUFMP_SETUP _IOWR(IPC_IOC_MAGIC, \ + HEAPBUFMP_SETUP, \ + struct heapbufmp_cmd_args) +/* + * Command for heapbufmp_destroy + */ +#define CMD_HEAPBUFMP_DESTROY _IOWR(IPC_IOC_MAGIC, \ + HEAPBUFMP_DESTROY, \ + struct heapbufmp_cmd_args) + +/* + * Command for heapbufmp_prams_init + */ +#define CMD_HEAPBUFMP_PARAMS_INIT _IOWR(IPC_IOC_MAGIC, \ + HEAPBUFMP_PARAMS_INIT, \ + struct heapbufmp_cmd_args) + +/* + * Command for heapbufmp_create + */ +#define CMD_HEAPBUFMP_CREATE _IOWR(IPC_IOC_MAGIC, \ + HEAPBUFMP_CREATE, \ + struct heapbufmp_cmd_args) + +/* + * Command for heapbufmp_delete + */ +#define CMD_HEAPBUFMP_DELETE _IOWR(IPC_IOC_MAGIC, \ + HEAPBUFMP_DELETE, \ + struct heapbufmp_cmd_args) + +/* + * Command for heapbufmp_open + */ +#define CMD_HEAPBUFMP_OPEN _IOWR(IPC_IOC_MAGIC, \ + HEAPBUFMP_OPEN, \ + struct heapbufmp_cmd_args) + +/* + * Command for heapbufmp_open_by_addr + */ +#define CMD_HEAPBUFMP_OPENBYADDR _IOWR(IPC_IOC_MAGIC, \ + HEAPBUFMP_OPENBYADDR, \ + struct heapbufmp_cmd_args) + +/* + * Command for heapbufmp_close + */ +#define CMD_HEAPBUFMP_CLOSE _IOWR(IPC_IOC_MAGIC, \ + HEAPBUFMP_CLOSE, \ + struct heapbufmp_cmd_args) + +/* + * Command for heapbufmp_alloc + */ +#define CMD_HEAPBUFMP_ALLOC _IOWR(IPC_IOC_MAGIC, \ + HEAPBUFMP_ALLOC, \ + struct heapbufmp_cmd_args) + +/* + * Command for heapbufmp_free + */ +#define CMD_HEAPBUFMP_FREE _IOWR(IPC_IOC_MAGIC, \ + HEAPBUFMP_FREE, \ + struct heapbufmp_cmd_args) + +/* + * Command for heapbufmp_shared_mem_req + */ +#define CMD_HEAPBUFMP_SHAREDMEMREQ _IOWR(IPC_IOC_MAGIC, \ + HEAPBUFMP_SHAREDMEMREQ, \ + struct heapbufmp_cmd_args) + +/* + * Command for heapbufmp_get_stats + */ +#define CMD_HEAPBUFMP_GETSTATS _IOWR(IPC_IOC_MAGIC, \ + HEAPBUFMP_GETSTATS, \ + struct heapbufmp_cmd_args) + +/* + * Command for heapbufmp_get_extended_stats + */ +#define CMD_HEAPBUFMP_GETEXTENDEDSTATS _IOWR(IPC_IOC_MAGIC, \ + HEAPBUFMP_GETEXTENDEDSTATS, \ + struct heapbufmp_cmd_args) + + +/* + * Command arguments for heapbuf + */ +union heapbufmp_arg { + struct { + struct heapbufmp_params *params; + } params_init; + + struct { + struct heapbufmp_config *config; + } get_config; + + struct { + struct heapbufmp_config *config; + } setup; + + struct { + void *handle; + struct heapbufmp_params *params; + u32 name_len; + u32 *shared_addr_srptr; + void *knl_gate; + } create; + + struct { + void *handle; + } delete; + + struct { + void *handle; + char *name; + u32 name_len; + } open; + + struct { + void *handle; + u32 *shared_addr_srptr; + } open_by_addr; + + struct { + void *handle; + } close; + + struct { + void *handle; + u32 size; + u32 align; + u32 *block_srptr; + } alloc; + + struct { + void *handle; + u32 *block_srptr; + u32 size; + } free; + + struct { + void *handle; + struct memory_stats *stats; + } get_stats; + + struct { + void *handle; + struct heapbufmp_extended_stats *stats; + } get_extended_stats; + + struct { + void *handle; + struct heapbufmp_params *params; + u32 *shared_addr_srptr; + u32 bytes; + } shared_mem_req; +}; + +/* + * Command arguments for heapbuf + */ +struct heapbufmp_cmd_args{ + union heapbufmp_arg args; + s32 api_status; +}; + +/* + * This ioctl interface for heapbuf module + */ +int heapbufmp_ioctl(struct inode *pinode, struct file *filp, + unsigned int cmd, unsigned long args, bool user); + +#endif /* _HEAPBUFMP_IOCTL_ */ diff --git a/arch/arm/plat-omap/include/syslink/heapmemmp.h b/arch/arm/plat-omap/include/syslink/heapmemmp.h new file mode 100644 index 00000000000..bfce85be4b5 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/heapmemmp.h @@ -0,0 +1,252 @@ +/* + * heapmemmp.h + * + * Heap module manages fixed size buffers that can be used + * in a multiprocessor system with shared memory. + * + * 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 _HEAPMEMMP_H_ +#define _HEAPMEMMP_H_ + +#include <linux/types.h> +#include <heap.h> +#include <listmp.h> + +/*! + * @def LISTMP_MODULEID + * @brief Unique module ID. + */ +#define HEAPMEMMP_MODULEID (0x4cd7) + +/* + * Creation of Heap Buf succesful. +*/ +#define HEAPMEMMP_CREATED (0x07041776) + +/* + * Version. + */ +#define HEAPMEMMP_VERSION (1) + +/* ============================================================================= + * All success and failure codes for the module + * ============================================================================= + */ + +/*! + * @def HEAPMEMMP_S_BUSY + * @brief The resource is still in use + */ +#define HEAPMEMMP_S_BUSY 2 + +/*! + * @def HEAPMEMMP_S_ALREADYSETUP + * @brief The module has been already setup + */ +#define HEAPMEMMP_S_ALREADYSETUP 1 + +/*! + * @def HEAPMEMMP_S_SUCCESS + * @brief Operation is successful. + */ +#define HEAPMEMMP_S_SUCCESS 0 + +/*! + * @def HEAPMEMMP_E_FAIL + * @brief Generic failure. + */ +#define HEAPMEMMP_E_FAIL -1 + +/*! + * @def HEAPMEMMP_E_INVALIDARG + * @brief Argument passed to function is invalid. + */ +#define HEAPMEMMP_E_INVALIDARG -2 + +/*! + * @def HEAPMEMMP_E_MEMORY + * @brief Operation resulted in memory failure. + */ +#define HEAPMEMMP_E_MEMORY -3 + +/*! + * @def HEAPMEMMP_E_ALREADYEXISTS + * @brief The specified entity already exists. + */ +#define HEAPMEMMP_E_ALREADYEXISTS -4 + +/*! + * @def HEAPMEMMP_E_NOTFOUND + * @brief Unable to find the specified entity. + */ +#define HEAPMEMMP_E_NOTFOUND -5 + +/*! + * @def HEAPMEMMP_E_TIMEOUT + * @brief Operation timed out. + */ +#define HEAPMEMMP_E_TIMEOUT -6 + +/*! + * @def HEAPMEMMP_E_INVALIDSTATE + * @brief Module is not initialized. + */ +#define HEAPMEMMP_E_INVALIDSTATE -7 + +/*! + * @def HEAPMEMMP_E_OSFAILURE + * @brief A failure occurred in an OS-specific call */ +#define HEAPMEMMP_E_OSFAILURE -8 + +/*! + * @def HEAPMEMMP_E_RESOURCE + * @brief Specified resource is not available */ +#define HEAPMEMMP_E_RESOURCE -9 + +/*! + * @def HEAPMEMMP_E_RESTART + * @brief Operation was interrupted. Please restart the operation */ +#define HEAPMEMMP_E_RESTART -10 + + +/* ============================================================================= + * Macros + * ============================================================================= + */ + + +/* ============================================================================= + * Structures & Enums + * ============================================================================= + */ + +/* + * Structure defining config parameters for the HeapBuf module. + */ +struct heapmemmp_config { + u32 max_name_len; /* Maximum length of name */ + u32 max_runtime_entries; /* Maximum number of heapmemmp instances */ + /* that can be created */ +}; + +/* + * Structure defining parameters for the HeapBuf module + */ +struct heapmemmp_params { + char *name; /* Name of this instance */ + u16 region_id; /* Shared region ID */ + void *shared_addr; /* Physical address of the shared memory */ + u32 shared_buf_size; /* Size of shared buffer */ + void *gate; /* GateMP used for critical region management of the */ + /* shared memory */ +}; + +/* + * Stats structure for the getExtendedStats API. + */ +struct heapmemmp_extended_stats { + void *buf; + /* Local address of the shared buffer */ + + u32 size; + /* Size of the shared buffer */ +}; + +/* ============================================================================= + * APIs + * ============================================================================= + */ + +/* + * Function to get default configuration for the heapmemmp module + */ +int heapmemmp_get_config(struct heapmemmp_config *cfgparams); + +/* + * Function to setup the heapmemmp module + */ +int heapmemmp_setup(const struct heapmemmp_config *cfg); + +/* + * Function to destroy the heapmemmp module + */ +int heapmemmp_destroy(void); + +/* Initialize this config-params structure with supplier-specified + * defaults before instance creation + */ +void heapmemmp_params_init(struct heapmemmp_params *params); + +/* + * Creates a new instance of heapmemmp module + */ +void *heapmemmp_create(const struct heapmemmp_params *params); + +/* + * Deletes a instance of heapmemmp module + */ +int heapmemmp_delete(void **handle_ptr); + +/* + * Opens a created instance of heapmemmp module by name + */ +int heapmemmp_open(char *name, void **handle_ptr); + +/* + * Opens a created instance of heapmemmp module by address + */ +int heapmemmp_open_by_addr(void *shared_addr, void **handle_ptr); + +/* + * Closes previously opened/created instance of heapmemmp module + */ +int heapmemmp_close(void **handle_ptr); + +/* + * Returns the amount of shared memory required for creation + * of each instance + */ +int heapmemmp_shared_mem_req(const struct heapmemmp_params *params); + +/* + * Allocate a block + */ +void *heapmemmp_alloc(void *hphandle, u32 size, u32 align); + +/* + * Frees the block to this heapmemmp + */ +int heapmemmp_free(void *hphandle, void *block, u32 size); + +/* + * Get memory statistics + */ +void heapmemmp_get_stats(void *hphandle, struct memory_stats *stats); + +/* + * Indicate whether the heap may block during an alloc or free call + */ +bool heapmemmp_isblocking(void *handle); + +/* + * Get extended statistics + */ +void heapmemmp_get_extended_stats(void *hphandle, + struct heapmemmp_extended_stats *stats); +/* + * Restore an instance to it's original created state. + */ +void heapmemmp_restore(void *handle); + +#endif /* _HEAPMEMMP_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/heapmemmp_ioctl.h b/arch/arm/plat-omap/include/syslink/heapmemmp_ioctl.h new file mode 100644 index 00000000000..10020148d21 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/heapmemmp_ioctl.h @@ -0,0 +1,243 @@ +/* + * heapmemmp_ioctl.h + * + * Heap module manages fixed size buffers that can be used + * in a multiprocessor system with shared memory. + * + * 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 _HEAPMEMMP_IOCTL_ +#define _HEAPMEMMP_IOCTL_ + +#include <linux/types.h> + +#include <ipc_ioctl.h> +#include <heapmemmp.h> + + +enum CMD_HEAPMEM { + HEAPMEMMP_GETCONFIG = HEAPMEMMP_BASE_CMD, + HEAPMEMMP_SETUP, + HEAPMEMMP_DESTROY, + HEAPMEMMP_PARAMS_INIT, + HEAPMEMMP_CREATE, + HEAPMEMMP_DELETE, + HEAPMEMMP_OPEN, + HEAPMEMMP_OPENBYADDR, + HEAPMEMMP_CLOSE, + HEAPMEMMP_ALLOC, + HEAPMEMMP_FREE, + HEAPMEMMP_SHAREDMEMREQ, + HEAPMEMMP_GETSTATS, + HEAPMEMMP_GETEXTENDEDSTATS, + HEAPMEMMP_RESTORE +}; + +/* + * Command for heapmemmp_get_config + */ +#define CMD_HEAPMEMMP_GETCONFIG _IOWR(IPC_IOC_MAGIC, \ + HEAPMEMMP_GETCONFIG,\ + struct heapmemmp_cmd_args) + +/* + * Command for heapmemmp_setup + */ +#define CMD_HEAPMEMMP_SETUP _IOWR(IPC_IOC_MAGIC, \ + HEAPMEMMP_SETUP, \ + struct heapmemmp_cmd_args) +/* + * Command for heapmemmp_destroy + */ +#define CMD_HEAPMEMMP_DESTROY _IOWR(IPC_IOC_MAGIC, \ + HEAPMEMMP_DESTROY, \ + struct heapmemmp_cmd_args) + +/* + * Command for heapmemmp_prams_init + */ +#define CMD_HEAPMEMMP_PARAMS_INIT _IOWR(IPC_IOC_MAGIC, \ + HEAPMEMMP_PARAMS_INIT, \ + struct heapmemmp_cmd_args) + +/* + * Command for heapmemmp_create + */ +#define CMD_HEAPMEMMP_CREATE _IOWR(IPC_IOC_MAGIC, \ + HEAPMEMMP_CREATE, \ + struct heapmemmp_cmd_args) + +/* + * Command for heapmemmp_delete + */ +#define CMD_HEAPMEMMP_DELETE _IOWR(IPC_IOC_MAGIC, \ + HEAPMEMMP_DELETE, \ + struct heapmemmp_cmd_args) + +/* + * Command for heapmemmp_open + */ +#define CMD_HEAPMEMMP_OPEN _IOWR(IPC_IOC_MAGIC, \ + HEAPMEMMP_OPEN, \ + struct heapmemmp_cmd_args) + +/* + * Command for heapmemmp_open_by_addr + */ +#define CMD_HEAPMEMMP_OPENBYADDR _IOWR(IPC_IOC_MAGIC, \ + HEAPMEMMP_OPENBYADDR, \ + struct heapmemmp_cmd_args) + +/* + * Command for heapmemmp_close + */ +#define CMD_HEAPMEMMP_CLOSE _IOWR(IPC_IOC_MAGIC, \ + HEAPMEMMP_CLOSE, \ + struct heapmemmp_cmd_args) + +/* + * Command for heapmemmp_alloc + */ +#define CMD_HEAPMEMMP_ALLOC _IOWR(IPC_IOC_MAGIC, \ + HEAPMEMMP_ALLOC, \ + struct heapmemmp_cmd_args) + +/* + * Command for heapmemmp_free + */ +#define CMD_HEAPMEMMP_FREE _IOWR(IPC_IOC_MAGIC, \ + HEAPMEMMP_FREE, \ + struct heapmemmp_cmd_args) + +/* + * Command for heapmemmp_shared_mem_req + */ +#define CMD_HEAPMEMMP_SHAREDMEMREQ _IOWR(IPC_IOC_MAGIC, \ + HEAPMEMMP_SHAREDMEMREQ, \ + struct heapmemmp_cmd_args) + +/* + * Command for heapmemmp_get_stats + */ +#define CMD_HEAPMEMMP_GETSTATS _IOWR(IPC_IOC_MAGIC, \ + HEAPMEMMP_GETSTATS, \ + struct heapmemmp_cmd_args) + +/* + * Command for heapmemmp_get_extended_stats + */ +#define CMD_HEAPMEMMP_GETEXTENDEDSTATS _IOWR(IPC_IOC_MAGIC, \ + HEAPMEMMP_GETEXTENDEDSTATS, \ + struct heapmemmp_cmd_args) + +/* + * Command for heapmemmp_restore + */ +#define CMD_HEAPMEMMP_RESTORE _IOWR(IPC_IOC_MAGIC, \ + HEAPMEMMP_RESTORE, \ + struct heapmemmp_cmd_args) + + +/* + * Command arguments for heapmem + */ +union heapmemmp_arg { + struct { + struct heapmemmp_params *params; + } params_init; + + struct { + struct heapmemmp_config *config; + } get_config; + + struct { + struct heapmemmp_config *config; + } setup; + + struct { + void *handle; + struct heapmemmp_params *params; + u32 name_len; + u32 *shared_addr_srptr; + u32 *shared_buf_srptr; + void *knl_gate; + } create; + + struct { + void *handle; + } delete; + + struct { + void *handle; + char *name; + u32 name_len; + } open; + + struct { + void *handle; + u32 *shared_addr_srptr; + } open_by_addr; + + struct { + void *handle; + } close; + + struct { + void *handle; + u32 size; + u32 align; + u32 *block_srptr; + } alloc; + + struct { + void *handle; + u32 *block_srptr; + u32 size; + } free; + + struct { + void *handle; + struct memory_stats *stats; + } get_stats; + + struct { + void *handle; + } restore; + + struct { + void *handle; + struct heapmemmp_extended_stats *stats; + } get_extended_stats; + + struct { + struct heapmemmp_params *params; + u32 *shared_addr_srptr; + u32 bytes; + } shared_mem_req; +}; + +/* + * Command arguments for heapmem + */ +struct heapmemmp_cmd_args{ + union heapmemmp_arg args; + s32 api_status; +}; + +/* + * This ioctl interface for heapmem module + */ +int heapmemmp_ioctl(struct inode *pinode, struct file *filp, + unsigned int cmd, unsigned long args, bool user); + +#endif /* _HEAPMEMMP_IOCTL_ */ diff --git a/arch/arm/plat-omap/include/syslink/host_os.h b/arch/arm/plat-omap/include/syslink/host_os.h new file mode 100644 index 00000000000..2e2164f314f --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/host_os.h @@ -0,0 +1,72 @@ + +/* + * host_os.h + * + * DSP-BIOS Bridge driver support functions for TI OMAP processors. + * + * Copyright (C) 2008 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. + */ + + +/* + * ======== windows.h ======== + * + *! Revision History + *! ================ + *! 08-Mar-2004 sb Added cacheflush.h to support Dynamic Memory Mapping feature + *! 16-Feb-2004 sb Added headers required for consistent_alloc + */ + +#ifndef _HOST_OS_H_ +#define _HOST_OS_H_ + +#include <generated/autoconf.h> +#include <asm/system.h> +#include <asm/atomic.h> +#include <linux/semaphore.h> +#include <linux/uaccess.h> +#include <asm/irq.h> +#include <linux/io.h> +#include <linux/syscalls.h> +#include <linux/version.h> +#include <linux/kernel.h> +#include <linux/string.h> +#include <linux/stddef.h> +#include <linux/types.h> +#include <linux/interrupt.h> +#include <linux/spinlock.h> +#include <linux/sched.h> +#include <linux/fs.h> +#include <linux/file.h> +#include <linux/slab.h> +#include <linux/delay.h> +#include <linux/ctype.h> +#include <linux/mm.h> +#include <linux/device.h> +#include <linux/vmalloc.h> +#include <linux/ioport.h> +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <linux/pagemap.h> +#include <asm/cacheflush.h> +#include <linux/dma-mapping.h> + +/* ----------------------------------- Macros */ + +#define SEEK_SET 0 /* Seek from beginning of file. */ +#define SEEK_CUR 1 /* Seek from current position. */ +#define SEEK_END 2 /* Seek from end of file. */ + +/* TODO -- Remove, once BP defines them */ +#define INT_MAIL_MPU_IRQ 26 +#define INT_DSP_MMU_IRQ 28 + +#endif diff --git a/arch/arm/plat-omap/include/syslink/igatempsupport.h b/arch/arm/plat-omap/include/syslink/igatempsupport.h new file mode 100644 index 00000000000..b7c42a746a0 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/igatempsupport.h @@ -0,0 +1,76 @@ +/* + * igatempsupport.h + * + * Interface implemented by all multiprocessor gates. + * + * 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 _IGATEMPSUPPORT_H_ +#define _IGATEMPSUPPORT_H_ + + +/* Invalid Igate */ +#define IGATEMPSUPPORT_NULL (void *)0xFFFFFFFF + +/* Gates with this "quality" may cause the calling thread to block; + * i.e., suspend execution until another thread leaves the gate. */ +#define IGATEMPSUPPORT_Q_BLOCKING 1 + +/* Gates with this "quality" allow other threads to preempt the thread + * that has already entered the gate. */ +#define IGATEMPSUPPORT_Q_PREEMPTING 2 + +/* Object embedded in other Gate modules. (Inheritance) */ +#define IGATEMPSUPPORT_SUPERPARAMS \ + u32 resource_id; \ + bool open_flag; \ + u16 region_id; \ + void *shared_addr + +/* All other GateMP modules inherit this. */ +#define IGATEMPSUPPORT_INHERIT(X) \ +enum X##_local_protect { \ + X##_LOCALPROTECT_NONE = 0, \ + X##_LOCALPROTECT_INTERRUPT = 1, \ + X##_LOCALPROTECT_TASKLET = 2, \ + X##_LOCALPROTECT_THREAD = 3, \ + X##_LOCALPROTECT_PROCESS = 4 \ +}; + +/* Paramter initializer. */ +#define IGATEMPSUPPORT_PARAMSINTIALIZER(x) \ + do { \ + (x)->resource_id = 0; \ + (x)->open_flag = true; \ + (x)->region_id = 0; \ + (x)->shared_addr = NULL; \ + } while (0) + +enum igatempsupport_local_protect { + IGATEMPSUPPORT_LOCALPROTECT_NONE = 0, + IGATEMPSUPPORT_LOCALPROTECT_INTERRUPT = 1, + IGATEMPSUPPORT_LOCALPROTECT_TASKLET = 2, + IGATEMPSUPPORT_LOCALPROTECT_THREAD = 3, + IGATEMPSUPPORT_LOCALPROTECT_PROCESS = 4 +}; + +struct igatempsupport_params { + u32 resource_id; + bool open_flag; + u16 region_id; + void *shared_addr; +}; + + +#endif /* ifndef __IGATEMPSUPPORT_H__ */ diff --git a/arch/arm/plat-omap/include/syslink/igateprovider.h b/arch/arm/plat-omap/include/syslink/igateprovider.h new file mode 100644 index 00000000000..c4ac4ab91c9 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/igateprovider.h @@ -0,0 +1,123 @@ +/* + * igateprovider.h + * + * Interface implemented by all gate providers. + * + * 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. + * + */ +/** ============================================================================ + * Gates are used serialize access to data structures that are used by more + * than one thread. + * + * Gates are responsible for ensuring that only one out of multiple threads + * can access a data structure at a time. There + * are important scheduling latency and performance considerations that + * affect the "type" of gate used to protect each data structure. For + * example, the best way to protect a shared counter is to simply disable + * all interrupts before the update and restore the interrupt state after + * the update; disabling all interrupts prevents all thread switching, so + * the update is guaranteed to be "atomic". Although highly efficient, this + * method of creating atomic sections causes serious system latencies when + * the time required to update the data structure can't be bounded. + * + * For example, a memory manager's list of free blocks can grow indefinitely + * long during periods of high fragmentation. Searching such a list with + * interrupts disabled would cause system latencies to also become unbounded. + * In this case, the best solution is to provide a gate that suspends the + * execution of threads that try to enter a gate that has already been + * entered; i.e., the gate "blocks" the thread until the thread + * already in the gate leaves. The time required to enter and leave the + * gate is greater than simply enabling and restoring interrupts, but since + * the time spent within the gate is relatively large, the overhead caused by + * entering and leaving gates will not become a significant percentage of + * overall system time. More importantly, threads that do not need to + * access the shared data structure are completely unaffected by threads + * that do access it. + * ============================================================================ + */ + + +#ifndef _IGATEPROVIDER_H_ +#define _IGATEPROVIDER_H_ + + +/* Invalid Igate */ +#define IGATEPROVIDER_NULL (struct igateprovider_object *)0xFFFFFFFF + +/* Gates with this "quality" may cause the calling thread to block; + * i.e., suspend execution until another thread leaves the gate. */ +#define IGateProvider_Q_BLOCKING 1 + +/* Gates with this "quality" allow other threads to preempt the thread + * that has already entered the gate. */ +#define IGateProvider_Q_PREEMPTING 2 + +/* Object embedded in other Gate modules. (Inheritance) */ +#define IGATEPROVIDER_SUPEROBJECT \ + int *(*enter)(void *); \ + void (*leave)(void *, int *) + +#define IGATEPROVIDER_OBJECTINITIALIZER(x, y) \ + do { \ + ((struct igateprovider_object *)(x))->enter = y##_enter; \ + ((struct igateprovider_object *)(x))->leave = y##_leave; \ + } while (0) + + +/* Structure for generic gate instance */ +struct igateprovider_object { + IGATEPROVIDER_SUPEROBJECT; +}; + + +/* + * Enter this gate + * + * Each gate provider can implement mutual exclusion using different + * algorithms; e.g., disabling all scheduling, disabling the scheduling + * of all threads below a specified "priority level", suspending the + * caller when the gate has been entered by another thread and + * re-enabling it when the the other thread leaves the gate. However, + * in all cases, after this method returns that caller has exclusive + * access to the data protected by this gate. + * + * A thread may reenter a gate without blocking or failing. + */ +static inline int *igateprovider_enter(struct igateprovider_object *handle) +{ + int *key = NULL; + + if (handle != IGATEPROVIDER_NULL) + key = (handle->enter)((void *)handle); + return key; +} + + +/* + * Leave this gate + * + * This method is only called by threads that have previously entered + * this gate via `{@link #enter}`. After this method returns, the + * caller must not access the data structure protected by this gate + * (unless the caller has entered the gate more than once and other + * calls to `leave` remain to balance the number of previous + * calls to `enter`). + */ +static inline void igateprovider_leave(struct igateprovider_object *handle, + int *key) +{ + if (handle != IGATEPROVIDER_NULL) + (handle->leave)((void *)handle, key); +} + +#endif /* ifndef _IGATEPROVIDER_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/iobject.h b/arch/arm/plat-omap/include/syslink/iobject.h new file mode 100644 index 00000000000..4d0c1e6c7e0 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/iobject.h @@ -0,0 +1,176 @@ +/* + * iobject.h + * + * Interface to provide object creation facilities. + * + * 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 _IOBJECT_H_ +#define _IOBJECT_H_ + +/* ObjType */ +enum ipc_obj_type { + IPC_OBJTYPE_CREATESTATIC = 0x1, + IPC_OBJTYPE_CREATESTATIC_REGION = 0x2, + IPC_OBJTYPE_CREATEDYNAMIC = 0x4, + IPC_OBJTYPE_CREATEDYNAMIC_REGION = 0x8, + IPC_OBJTYPE_OPENDYNAMIC = 0x10, + IPC_OBJTYPE_LOCAL = 0x20 +}; + + +/* Object embedded in other module's object */ +#define IOBJECT_SUPEROBJECT \ + void *next; \ + int status; + +/* Generic macro to define a create/delete function for a module */ +#define IOBJECT_CREATE0(MNAME) \ +static struct MNAME##_object *MNAME##_first_object;\ +\ +\ +void *MNAME##_create(const struct MNAME##_params *params)\ +{ \ + int *key;\ + struct MNAME##_object *obj = (struct MNAME##_object *)\ + kmalloc(sizeof(struct MNAME##_object),\ + GFP_KERNEL);\ + if (!obj)\ + return NULL;\ + memset(obj, 0, sizeof(struct MNAME##_object));\ + obj->status = MNAME##_instance_init(obj, params);\ + if (obj->status == 0) { \ + key = gate_enter_system();\ + if (MNAME##_first_object == NULL) { \ + MNAME##_first_object = obj;\ + obj->next = NULL;\ + } else { \ + obj->next = MNAME##_first_object;\ + MNAME##_first_object = obj;\ + } \ + gate_leave_system(key);\ + } else { \ + kfree(obj);\ + obj = NULL;\ + } \ + return obj;\ +} \ +\ +\ +int MNAME##_delete(void **handle)\ +{ \ + int *key;\ + struct MNAME##_object *temp;\ + struct MNAME##_object *obj;\ + \ + if (handle == NULL) \ + return -EINVAL;\ + if (*handle == NULL) \ + return -EINVAL;\ + obj = (struct MNAME##_object *)(*handle);\ + key = gate_enter_system();\ + if (obj == MNAME##_first_object) \ + MNAME##_first_object = obj->next;\ + else { \ + temp = MNAME##_first_object;\ + while (temp) { \ + if (temp->next == obj) { \ + temp->next = obj->next;\ + break;\ + } else { \ + temp = temp->next;\ + } \ + } \ + if (temp == NULL) { \ + gate_leave_system(key);\ + return -EINVAL;\ + } \ + } \ + gate_leave_system(key);\ + MNAME##_instance_finalize(obj, obj->status);\ + kfree(obj);\ + *handle = NULL;\ + return 0;\ +} + +#define IOBJECT_CREATE1(MNAME, ARG) \ +static struct MNAME##_object *MNAME##_first_object;\ +\ +\ +void *MNAME##_create(ARG arg, const struct MNAME##_params *params)\ +{ \ + int *key;\ + struct MNAME##_object *obj = (struct MNAME##_object *) \ + kmalloc(sizeof(struct MNAME##_object),\ + GFP_KERNEL);\ + if (!obj) \ + return NULL;\ + memset(obj, 0, sizeof(struct MNAME##_object));\ + obj->status = MNAME##_instance_init(obj, arg, params);\ + if (obj->status == 0) { \ + key = gate_enter_system();\ + if (MNAME##_first_object == NULL) { \ + MNAME##_first_object = obj;\ + obj->next = NULL;\ + } else { \ + obj->next = MNAME##_first_object;\ + MNAME##_first_object = obj;\ + } \ + gate_leave_system(key);\ + } else { \ + kfree(obj);\ + obj = NULL;\ + } \ + return obj;\ +} \ +\ +\ +int MNAME##_delete(void **handle)\ +{ \ + int *key;\ + struct MNAME##_object *temp;\ + struct MNAME##_object *obj;\ + \ + if (handle == NULL) \ + return -EINVAL;\ + if (*handle == NULL) \ + return -EINVAL;\ + obj = (struct MNAME##_object *)(*handle);\ + key = gate_enter_system();\ + if (obj == MNAME##_first_object) \ + MNAME##_first_object = obj->next;\ + else { \ + temp = MNAME##_first_object;\ + while (temp) { \ + if (temp->next == obj) { \ + temp->next = obj->next;\ + break;\ + } else { \ + temp = temp->next;\ + } \ + } \ + if (temp == NULL) { \ + gate_leave_system(key);\ + return -EINVAL;\ + } \ + } \ + gate_leave_system(key);\ + MNAME##_instance_finalize(obj, obj->status);\ + kfree(obj);\ + *handle = NULL;\ + return 0;\ +} + + +#endif /* ifndef _IOBJECT_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/ipc.h b/arch/arm/plat-omap/include/syslink/ipc.h new file mode 100644 index 00000000000..bead3bf54e7 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/ipc.h @@ -0,0 +1,177 @@ +/* + * sysmgr.h + * + * Defines for System manager. + * + * Copyright(C) 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 _IPC_H_ +#define _IPC_H_ + + +/* Module headers */ +#include <multiproc.h> +#include <gatepeterson.h> +#include <sharedregion.h> +#include <notify.h> +#include <notify_ducatidriver.h> +#include <heap.h> +#include <heapbufmp.h> +#include <heapmemmp.h> + + + +/* Unique module ID. */ +#define IPC_MODULEID (0xF086) + + +/* ============================================================================= + * Module Success and Failure codes + * ============================================================================= + */ +/* The resource is still in use */ +#define IPC_S_BUSY 2 + +/* The module has been already setup */ +#define IPC_S_ALREADYSETUP 1 + +/* Operation is successful. */ +#define IPC_S_SUCCESS 0 + +/* Generic failure. */ +#define IPC_E_FAIL -1 + +/* Argument passed to function is invalid. */ +#define IPC_E_INVALIDARG -2 + +/* Operation resulted in memory failure. */ +#define IPC_E_MEMORY -3 + +/* The specified entity already exists. */ +#define IPC_E_ALREADYEXISTS -4 + +/* Unable to find the specified entity. */ +#define IPC_E_NOTFOUND -5 + +/* Operation timed out. */ +#define IPC_E_TIMEOUT -6 + +/* Module is not initialized. */ +#define IPC_E_INVALIDSTATE -7 + +/* A failure occurred in an OS-specific call */ +#define IPC_E_OSFAILURE -8 + +/* Specified resource is not available */ +#define IPC_E_RESOURCE -9 + +/* Operation was interrupted. Please restart the operation */ +#define IPC_E_RESTART -10 + + +/* ============================================================================= + * Macros + * ============================================================================= + */ +/* IPC_CONTROLCMD_LOADCALLBACK */ +#define IPC_CONTROLCMD_LOADCALLBACK (0xBABE0000) + +/* IPC_CONTROLCMD_STARTCALLBACK */ +#define IPC_CONTROLCMD_STARTCALLBACK (0xBABE0001) + +/* IPC_CONTROLCMD_STOPCALLBACK */ +#define IPC_CONTROLCMD_STOPCALLBACK (0xBABE0002) + + +/* ============================================================================= + * Enums & Structures + * ============================================================================= + */ +/* the different options for processor synchronization */ +enum ipc_proc_sync { + IPC_PROCSYNC_NONE, /* don't do any processor sync */ + IPC_PROCSYNC_PAIR, /* sync pair of processors in ipc_attach */ + IPC_PROCSYNC_ALL /* sync all processors, done in ipc_start */ +}; + +/* ipc configuration structure. */ +struct ipc_config { + enum ipc_proc_sync proc_sync; + /* the different options for processor synchronization */ +}; + +/* ipc configuration structure. */ +struct ipc_params { + bool setup_messageq; + bool setup_notify; + bool setup_ipu_pm; + bool slave; + enum ipc_proc_sync proc_sync; +}; + +/* IPC events. */ +#define IPC_CLOSE 0 + +/* ============================================================================= + * APIs + * ============================================================================= + */ +/* Attach to remote processor */ +int ipc_attach(u16 remote_proc_id); + +/* Detach from the remote processor */ +int ipc_detach(u16 remote_proc_id); + +/* Reads the config entry from the config area. */ +int ipc_read_config(u16 remote_proc_id, u32 tag, void *cfg, u32 size); + +/* Reserves memory, creates default gatemp and heapmemmp */ +int ipc_start(void); + +/* Writes the config entry to the config area. */ +int ipc_write_config(u16 remote_proc_id, u32 tag, void *cfg, u32 size); + +/* Returns default configuration values for ipc. */ +void ipc_get_config(struct ipc_config *cfg_params); + +/* Sets up ipc for this processor. */ +int ipc_setup(const struct ipc_config *cfg_params); + +/* Destroys ipc for this processor. */ +int ipc_destroy(void); + +/* Creates a ipc. */ +int ipc_create(u16 proc_id, struct ipc_params *params); + +/* Function to control a Ipc instance for a slave */ +int ipc_control(u16 proc_id, u32 cmd_id, void *arg); + +/* Function to read configuration information from ipc module */ +int ipc_read_config(u16 remote_proc_id, u32 tag, void *cfg, u32 size); + +/* Function to write configuration information to ipc module */ +int ipc_write_config(u16 remote_proc_id, u32 tag, void *cfg, u32 size); + +/* Clears memory, deletes default gatemp and heapmemmp */ +int ipc_stop(void); + +/* IPC event notifications. */ +int ipc_notify_event(int event, void *data); + +/* Register for IPC events. */ +int ipc_register_notifier(struct notifier_block *nb); + +/* Un-register for IPC events. */ +int ipc_unregister_notifier(struct notifier_block *nb); + +#endif /* ifndef _IPC_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/ipc_ioctl.h b/arch/arm/plat-omap/include/syslink/ipc_ioctl.h new file mode 100644 index 00000000000..07ab472ccf0 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/ipc_ioctl.h @@ -0,0 +1,113 @@ +/* + * ipc_ioctl.h + * + * Base file for all TI OMAP IPC ioctl's. + * Linux-OMAP IPC has allocated base 0xEE with a range of 0x00-0xFF. + * (need to get the real one from open source maintainers) + * + * 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 _IPC_IOCTL_H +#define _IPC_IOCTL_H + +#include <linux/ioctl.h> +#include <linux/types.h> +#include <linux/fs.h> + +#define IPC_IOC_MAGIC 0xE0 +#define IPC_IOC_BASE 2 + +enum ipc_command_count { + MULTIPROC_CMD_NOS = 4, + NAMESERVER_CMD_NOS = 15, + HEAPBUFMP_CMD_NOS = 14, + SHAREDREGION_CMD_NOS = 13, + GATEMP_CMD_NOS = 13, + LISTMP_CMD_NOS = 19, + MESSAGEQ_CMD_NOS = 18, + IPC_CMD_NOS = 5, + SYSMEMMGR_CMD_NOS = 6, + HEAPMEMMP_CMD_NOS = 15, + NOTIFY_CMD_NOS = 18 +}; + +enum ipc_command_ranges { + MULTIPROC_BASE_CMD = IPC_IOC_BASE, + MULTIPROC_END_CMD = (MULTIPROC_BASE_CMD + \ + MULTIPROC_CMD_NOS - 1), + + NAMESERVER_BASE_CMD = 10, + NAMESERVER_END_CMD = (NAMESERVER_BASE_CMD + \ + NAMESERVER_CMD_NOS - 1), + + HEAPBUFMP_BASE_CMD = 30, + HEAPBUFMP_END_CMD = (HEAPBUFMP_BASE_CMD + \ + HEAPBUFMP_CMD_NOS - 1), + + SHAREDREGION_BASE_CMD = 50, + SHAREDREGION_END_CMD = (SHAREDREGION_BASE_CMD + \ + SHAREDREGION_CMD_NOS - 1), + + GATEMP_BASE_CMD = 70, + GATEMP_END_CMD = (GATEMP_BASE_CMD + \ + GATEMP_CMD_NOS - 1), + + LISTMP_BASE_CMD = 90, + LISTMP_END_CMD = (LISTMP_BASE_CMD + \ + LISTMP_CMD_NOS - 1), + + MESSAGEQ_BASE_CMD = 110, + MESSAGEQ_END_CMD = (MESSAGEQ_BASE_CMD + \ + MESSAGEQ_CMD_NOS - 1), + + IPC_BASE_CMD = 130, + IPC_END_CMD = (IPC_BASE_CMD + \ + IPC_CMD_NOS - 1), + + SYSMEMMGR_BASE_CMD = 140, + SYSMEMMGR_END_CMD = (SYSMEMMGR_BASE_CMD + \ + SYSMEMMGR_CMD_NOS - 1), + + HEAPMEMMP_BASE_CMD = 150, + HEAPMEMMP_END_CMD = (HEAPMEMMP_BASE_CMD + \ + HEAPMEMMP_CMD_NOS - 1), + + NOTIFY_BASE_CMD = 170, + NOTIFY_END_CMD = (NOTIFY_BASE_CMD + \ + NOTIFY_CMD_NOS - 1) +}; + +struct resource_info { + struct list_head res; /* Pointer to res entry */ + unsigned int cmd; /* command */ + void *data; /* Some private data */ +}; + +/* Process Context */ +struct ipc_process_context { + /* List of Resources */ + struct list_head resources; + spinlock_t res_lock; + + struct ipc_device *dev; +}; + +void add_pr_res(struct ipc_process_context *pr_ctxt, unsigned int cmd, + void *data); + +void remove_pr_res(struct ipc_process_context *pr_ctxt, + struct resource_info *info); + +int ipc_ioc_router(u32 cmd, ulong arg, struct file *filp, bool user); + +#endif /* _IPC_IOCTL_H */ 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 00000000000..31d2429e851 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/listmp.h @@ -0,0 +1,146 @@ +/* + * listmp.h + * + * The listmp module defines the 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> + +/* Utilities headers */ +#include <linux/list.h> +/*#include <heap.h>*/ + +/* ============================================================================= + * All success and failure codes for the module + * ============================================================================= + */ +/* The resource is still in use */ +#define LISTMP_S_BUSY 2 + +/* The module has already been setup */ +#define LISTMP_S_ALREADYSETUP 1 + +/* Operation is successful. */ +#define LISTMP_SUCCESS 0 + +/* Generic failure. */ +#define LISTMP_E_FAIL -1 + +/* Argument passed to a function is invalid. */ +#define LISTMP_E_INVALIDARG -2 + +/* Memory allocation failed. */ +#define LISTMP_E_MEMORY -3 + +/* The specified entity already exists. */ +#define LISTMP_E_ALREADYEXISTS -4 + +/* Unable to find the specified entity. */ +#define LISTMP_E_NOTFOUND -5 + +/* Operation timed out. */ +#define LISTMP_E_TIMEOUT -6 + +/* Module is not initialized. */ +#define LISTMP_E_INVALIDSTATE -7 + +/* A failure occurred in an OS-specific call */ +#define LISTMP_E_OSFAILURE -8 + +/* Specified resource is not available */ +#define LISTMP_E_RESOURCE -9 + +/* Operation was interrupted. Please restart the operation */ +#define LISTMP_E_RESTART -10 + + +/* ============================================================================= + * Macros and types + * ============================================================================= + */ +#define VOLATILE volatile + +/* Structure defining list element for the ListMP. */ +struct listmp_elem { + VOLATILE struct listmp_elem *next; + VOLATILE struct listmp_elem *prev; +}; + +/* Structure defining config parameters for the ListMP instances. */ +struct listmp_params { + /* 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 */ +}; + + +/* Function initializes listmp parameters */ +void listmp_params_init(struct listmp_params *params); + +/* Function to create an instance of ListMP */ +void *listmp_create(const struct listmp_params *params); + +/* Function to delete an instance of ListMP */ +int listmp_delete(void **listmp_handle_ptr); + +/* Function to open a previously created instance */ +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); + +/* 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 traverse to remove element from list */ +int listmp_remove(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 00000000000..e4fba2409bc --- /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, bool user); + +#endif /* _LISTMP_IOCTL_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/messageq.h b/arch/arm/plat-omap/include/syslink/messageq.h new file mode 100644 index 00000000000..d0d59970a49 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/messageq.h @@ -0,0 +1,440 @@ +/* + * messageq.h + * + * The MessageQ module supports the structured sending and receiving of + * variable length messages. This module can be used for homogeneous or + * heterogeneous multi-processor messaging. + * + * Copyright (C) 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 _MESSAGEQ_H_ +#define _MESSAGEQ_H_ + +/* Standard headers */ +#include <linux/types.h> + +/* Utilities headers */ +#include <linux/list.h> + +/* Syslink headers */ +#include <listmp.h> + +/*! + * @def MESSAGEQ_MODULEID + * @brief Unique module ID. + */ +#define MESSAGEQ_MODULEID (0xded2) + + +/* ============================================================================= + * All success and failure codes for the module + * ============================================================================= + */ + +/*! + * @def MESSAGEQ_S_BUSY + * @brief The resource is still in use + */ +#define MESSAGEQ_S_BUSY 2 + +/*! + * @def MESSAGEQ_S_ALREADYSETUP + * @brief The module has been already setup + */ +#define MESSAGEQ_S_ALREADYSETUP 1 + +/*! + * @def MESSAGEQ_S_SUCCESS + * @brief Operation is successful. + */ +#define MESSAGEQ_S_SUCCESS 0 + +/*! + * @def MESSAGEQ_E_FAIL + * @brief Operation is not successful. + */ +#define MESSAGEQ_E_FAIL -1 + +/*! + * @def MESSAGEQ_E_INVALIDARG + * @brief There is an invalid argument. + */ +#define MESSAGEQ_E_INVALIDARG -2 + +/*! + * @def MESSAGEQ_E_MEMORY + * @brief Operation resulted in memory failure. + */ +#define MESSAGEQ_E_MEMORY -3 + +/*! + * @def MESSAGEQ_E_ALREADYEXISTS + * @brief The specified entity already exists. + */ +#define MESSAGEQ_E_ALREADYEXISTS -4 + +/*! + * @def MESSAGEQ_E_NOTFOUND + * @brief Unable to find the specified entity. + */ +#define MESSAGEQ_E_NOTFOUND -5 + +/*! + * @def MESSAGEQ_E_TIMEOUT + * @brief Operation timed out. + */ +#define MESSAGEQ_E_TIMEOUT -6 + +/*! + * @def MESSAGEQ_E_INVALIDSTATE + * @brief Module is not initialized. + */ +#define MESSAGEQ_E_INVALIDSTATE -7 + +/*! + * @def MESSAGEQ_E_OSFAILURE + * @brief A failure occurred in an OS-specific call + */ +#define MESSAGEQ_E_OSFAILURE -8 + +/*! + * @def MESSAGEQ_E_RESOURCE + * @brief Specified resource is not available + */ +#define MESSAGEQ_E_RESOURCE -9 + +/*! + * @def MESSAGEQ_E_RESTART + * @brief Operation was interrupted. Please restart the operation + */ +#define MESSAGEQ_E_RESTART -10 + +/*! + * @def MESSAGEQ_E_INVALIDMSG + * @brief Operation is successful. + */ +#define MESSAGEQ_E_INVALIDMSG -11 + +/*! + * @def MESSAGEQ_E_NOTOWNER + * @brief Not the owner + */ +#define MESSAGEQ_E_NOTOWNER -12 + +/*! + * @def MESSAGEQ_E_REMOTEACTIVE + * @brief Operation is successful. + */ +#define MESSAGEQ_E_REMOTEACTIVE -13 + +/*! + * @def MESSAGEQ_E_INVALIDHEAPID + * @brief Operation is successful. + */ +#define MESSAGEQ_E_INVALIDHEAPID -14 + +/*! + * @def MESSAGEQ_E_INVALIDPROCID + * @brief Operation is successful. + */ +#define MESSAGEQ_E_INVALIDPROCID -15 + +/*! + * @def MESSAGEQ_E_MAXREACHED + * @brief Operation is successful. + */ +#define MESSAGEQ_E_MAXREACHED -16 + +/*! + * @def MESSAGEQ_E_UNREGISTEREDHEAPID + * @brief Operation is successful. + */ +#define MESSAGEQ_E_UNREGISTEREDHEAPID -17 + +/*! + * @def MESSAGEQ_E_CANNOTFREESTATICMSG + * @brief Operation is successful. + */ +#define MESSAGEQ_E_CANNOTFREESTATICMSG -18 + + +/* ============================================================================= + * Macros and types + * ============================================================================= + */ +/*! + * @brief Mask to extract version setting + */ +#define MESSAGEQ_HEADERVERSION 0x2000u + +/*! Mask to extract Trace setting */ +#define MESSAGEQ_TRACEMASK (uint) 0x1000 + +/*! Shift for Trace setting */ +#define MESSAGEQ_TRACESHIFT (uint) 12 + +/*! + * @brief Mask to extract priority setting + */ +#define MESSAGEQ_PRIORITYMASK 0x3u + +/*! + * Used as the timeout value to specify wait forever + */ +#define MESSAGEQ_FOREVER (~((u32) 0)) + +/*! + * Invalid message id + */ +#define MESSAGEQ_INVALIDMSGID 0xFFFF + +/*! + * Invalid message queue + */ +#define MESSAGEQ_INVALIDMESSAGEQ 0xFFFF + +/*! + * Indicates that if maximum number of message queues are already created, + * should allow growth to create additional Message Queue. + */ +#define MESSAGEQ_ALLOWGROWTH (~((u32) 0)) + +/*! + * Number of types of priority queues for each transport + */ +#define MESSAGEQ_NUM_PRIORITY_QUEUES 2 + + +/* ============================================================================= + * Structures & Enums + * ============================================================================= + */ +/*! + * Message priority + */ +enum messageq_priority { + MESSAGEQ_NORMALPRI = 0, + /*!< Normal priority message */ + MESSAGEQ_HIGHPRI = 1, + /*!< High priority message */ + MESSAGEQ_RESERVEDPRI = 2, + /*!< Reserved value for message priority */ + MESSAGEQ_URGENTPRI = 3 + /*!< Urgent priority message */ +}; + +/*! Structure which defines the first field in every message */ +struct msgheader { + u32 reserved0; + /*!< Reserved field */ + u32 reserved1; + /*!< Reserved field */ + u32 msg_size; + /*!< Size of the message (including header) */ + u16 flags; + /*!< Flags */ + u16 msg_id; + /*!< Maximum length for Message queue names */ + u16 dst_id; + /*!< Maximum length for Message queue names */ + u16 dst_proc; + /*!< Maximum length for Message queue names */ + u16 reply_id; + /*!< Maximum length for Message queue names */ + u16 reply_proc; + /*!< Maximum length for Message queue names */ + u16 src_proc; + /*!< Maximum length for Message queue names */ + u16 heap_id; + /*!< Maximum length for Message queue names */ + u16 seq_num; + /*!< sequence number */ + u32 reserved; + /*!< Reserved field */ +}; + +/*! Structure which defines the first field in every message */ +#define messageq_msg struct msgheader * +/*typedef struct msgheader *messageq_msg;*/ + + +/*! + * @brief Structure defining config parameters for the MessageQ Buf module. + */ +struct messageq_config { + bool trace_flag; + /*!< Trace Flag + * This flag allows the configuration of the default module trace + * settings. + */ + + u16 num_heaps; + /*!< Number of heapIds in the system + * This allows MessageQ to pre-allocate the heaps table. + * The heaps table is used when registering heaps. + * The default is 1 since generally all systems need at least one heap. + * There is no default heap, so unless the system is only using + * staticMsgInit, the application must register a heap. + */ + + u32 max_runtime_entries; + /*! + * Maximum number of MessageQs that can be dynamically created + */ + + u32 max_name_len; + /*!< Maximum length for Message queue names */ +}; + +struct messageq_params { + void *synchronizer; + /*!< Synchronizer instance used to signal IO completion + * + * The synchronizer is used in the #MessageQ_put and #MessageQ_get calls. + * The synchronizer signal is called as part of the #MessageQ_put call. + * The synchronizer waits in the #MessageQ_get if there are no messages + * present. + */ +}; + +/* ============================================================================= + * APIs + * ============================================================================= + */ +/* Functions to get the configuration for messageq setup */ +void messageq_get_config(struct messageq_config *cfg); + +/* Function to setup the MessageQ module. */ +int messageq_setup(const struct messageq_config *cfg); + +/* Function to destroy the MessageQ module. */ +int messageq_destroy(void); + +/* Returns the amount of shared memory used by one transport instance. + * + * The MessageQ module itself does not use any shared memory but the + * underlying transport may use some shared memory. + */ +uint messageq_shared_mem_req(void *shared_addr); + +/* Calls the SetupProxy function to setup the MessageQ transports. */ +int messageq_attach(u16 remote_proc_id, void *shared_addr); + +/* Calls the SetupProxy function to detach the MessageQ transports. */ +int messageq_detach(u16 remote_proc_id); + +/* Initialize this config-params structure with supplier-specified + * defaults before instance creation. + */ +void messageq_params_init(struct messageq_params *params); + +/* Create a message queue */ +void *messageq_create(char *name, const struct messageq_params *params); + +/* Deletes a instance of MessageQ module. */ +int messageq_delete(void **messageq_handleptr); + +/* Open a message queue */ +int messageq_open(char *name, u32 *queue_id); + +/* Close an opened message queue handle */ +int messageq_close(u32 *queue_id); + +/* Allocates a message from the heap */ +messageq_msg messageq_alloc(u16 heapId, u32 size); + +/* Frees a message back to the heap */ +int messageq_free(messageq_msg msg); + +/* Initializes a message not obtained from MessageQ_alloc */ +void messageq_static_msg_init(messageq_msg msg, u32 size); + +/* Place a message onto a message queue */ +int messageq_put(u32 queueId, messageq_msg msg); + +/* Gets a message for a message queue and blocks if the queue is empty */ +int messageq_get(void *messageq_handle, messageq_msg *msg, u32 timeout); + +/* Register a heap with MessageQ */ +int messageq_register_heap(void *heap_handle, u16 heap_id); + +/* Unregister a heap with MessageQ */ +int messageq_unregister_heap(u16 heapId); + +/* Returns the number of messages in a message queue */ +int messageq_count(void *messageq_handle); + +/* Get the proc Id of the message. */ +u16 messageq_get_proc_id(void *messageq_handle); + +/* Get the queue Id of the message. */ +u32 messageq_get_queue_id(void *messageq_handle); + +/* Set the destination queue of the message. */ +void messageq_set_reply_queue(void *messageq_handle, messageq_msg msg); + +/* Set the tracing of a message */ +void messageq_set_msg_trace(messageq_msg msg, bool trace_flag); + +/* + * Functions to set Message properties + */ +/*! + * @brief Returns the MessageQ_Queue handle of the destination + * message queue for the specified message. + */ +u32 messageq_get_dst_queue(messageq_msg msg); + +/*! + * @brief Returns the message ID of the specified message. + */ +u16 messageq_get_msg_id(messageq_msg msg); + +/*! + * @brief Returns the size of the specified message. + */ +u32 messageq_get_msg_size(messageq_msg msg); + +/*! + * @brief Gets the message priority of a message + */ +u32 messageq_get_msg_pri(messageq_msg msg); + +/*! + * @brief Returns the MessageQ_Queue handle of the destination + * message queue for the specified message. + */ +u32 messageq_get_reply_queue(messageq_msg msg); + +/*! + * @brief Sets the message ID in the specified message. + */ +void messageq_set_msg_id(messageq_msg msg, u16 msg_id); +/*! + * @brief Sets the message priority in the specified message. + */ +void messageq_set_msg_pri(messageq_msg msg, u32 priority); + +/* ============================================================================= + * APIs called internally by MessageQ transports + * ============================================================================= + */ +/* Register a transport with MessageQ */ +int messageq_register_transport(void *imessageq_transport_handle, + u16 proc_id, u32 priority); + +/* Unregister a transport with MessageQ */ +void messageq_unregister_transport(u16 proc_id, u32 priority); + + +#endif /* _MESSAGEQ_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/messageq_ioctl.h b/arch/arm/plat-omap/include/syslink/messageq_ioctl.h new file mode 100644 index 00000000000..96d4aa7221e --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/messageq_ioctl.h @@ -0,0 +1,255 @@ +/* + * messageq_ioctl.h + * + * Definitions of messageq 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 _MESSAGEQ_IOCTL_H_ +#define _MESSAGEQ_IOCTL_H_ + +/* Standard headers */ +#include <linux/types.h> + +/* Syslink headers */ +#include <ipc_ioctl.h> +#include <messageq.h> +#include <heap.h> +#include <sharedregion.h> + +/* ============================================================================= + * Macros and types + * ============================================================================= + */ +#define MESSAGEQ_IOC_MAGIC IPC_IOC_MAGIC +enum messageq_drv_cmd { + MESSAGEQ_GETCONFIG = MESSAGEQ_BASE_CMD, + MESSAGEQ_SETUP, + MESSAGEQ_DESTROY, + MESSAGEQ_PARAMS_INIT, + MESSAGEQ_CREATE, + MESSAGEQ_DELETE, + MESSAGEQ_OPEN, + MESSAGEQ_CLOSE, + MESSAGEQ_COUNT, + MESSAGEQ_ALLOC, + MESSAGEQ_FREE, + MESSAGEQ_PUT, + MESSAGEQ_REGISTERHEAP, + MESSAGEQ_UNREGISTERHEAP, + MESSAGEQ_ATTACH, + MESSAGEQ_DETACH, + MESSAGEQ_GET, + MESSAGEQ_SHAREDMEMREQ +}; + +/* ---------------------------------------------------------------------------- + * IOCTL command IDs for messageq + * ---------------------------------------------------------------------------- + */ +/* Base command ID for messageq */ +#define MESSAGEQ_BASE_CMD 0x0 + +/* Command for messageq_get_config */ +#define CMD_MESSAGEQ_GETCONFIG \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_GETCONFIG, \ + struct messageq_cmd_args) + +/* Command for messageq_setup */ +#define CMD_MESSAGEQ_SETUP \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_SETUP, \ + struct messageq_cmd_args) + +/* Command for messageq_destroy */ +#define CMD_MESSAGEQ_DESTROY \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_DESTROY, \ + struct messageq_cmd_args) + +/* Command for messageq_params_init */ +#define CMD_MESSAGEQ_PARAMS_INIT \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_PARAMS_INIT, \ + struct messageq_cmd_args) + +/* Command for messageq_create */ +#define CMD_MESSAGEQ_CREATE \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_CREATE, \ + struct messageq_cmd_args) + +/* Command for messageq_delete */ +#define CMD_MESSAGEQ_DELETE \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_DELETE, \ + struct messageq_cmd_args) + +/* Command for messageq_open */ +#define CMD_MESSAGEQ_OPEN \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_OPEN, \ + struct messageq_cmd_args) + +/* Command for messageq_close */ +#define CMD_MESSAGEQ_CLOSE \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_CLOSE, \ + struct messageq_cmd_args) + +/* Command for messageq_count */ +#define CMD_MESSAGEQ_COUNT \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_COUNT, \ + struct messageq_cmd_args) + +/* Command for messageq_alloc */ +#define CMD_MESSAGEQ_ALLOC \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_ALLOC, \ + struct messageq_cmd_args) + +/* Command for messageq_free */ +#define CMD_MESSAGEQ_FREE \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_FREE, \ + struct messageq_cmd_args) + +/* Command for messageq_put */ +#define CMD_MESSAGEQ_PUT \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_PUT, \ + struct messageq_cmd_args) + +/* Command for messageq_register_heap */ +#define CMD_MESSAGEQ_REGISTERHEAP \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_REGISTERHEAP, \ + struct messageq_cmd_args) + +/* Command for messageq_unregister_heap */ +#define CMD_MESSAGEQ_UNREGISTERHEAP \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_UNREGISTERHEAP, \ + struct messageq_cmd_args) + + +/* Command for messageq_attach */ +#define CMD_MESSAGEQ_ATTACH \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_ATTACH, \ + struct messageq_cmd_args) + +/* Command for messageq_detach */ +#define CMD_MESSAGEQ_DETACH \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_DETACH, \ + struct messageq_cmd_args) + +/* Command for messageq_get */ +#define CMD_MESSAGEQ_GET \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_GET, \ + struct messageq_cmd_args) + +/* Command for messageq_sharedmem_req */ +#define CMD_MESSAGEQ_SHAREDMEMREQ \ + _IOWR(MESSAGEQ_IOC_MAGIC, MESSAGEQ_SHAREDMEMREQ, \ + struct messageq_cmd_args) + +/* Command arguments for messageq */ +struct messageq_cmd_args { + union { + struct { + void *messageq_handle; + struct messageq_params *params; + } params_init; + + struct { + struct messageq_config *config; + } get_config; + + struct { + struct messageq_config *config; + } setup; + + struct { + void *messageq_handle; + char *name; + struct messageq_params *params; + u32 name_len; + u32 queue_id; + } create; + + struct { + void *messageq_handle; + } delete_messageq; + + struct { + char *name; + u32 queue_id; + u32 name_len; + } open; + + struct { + u32 queue_id; + } close; + + struct { + void *messageq_handle; + u32 timeout; + u32 *msg_srptr; + } get; + + struct { + void *messageq_handle; + int count; + } count; + + struct { + u16 heap_id; + u32 size; + u32 *msg_srptr; + } alloc; + + struct { + u32 *msg_srptr; + } free; + + struct { + u32 queue_id; + u32 *msg_srptr; + } put; + + struct { + void *heap_handle; + u16 heap_id; + } register_heap; + + struct { + u16 heap_id; + } unregister_heap; + + struct { + u32 *shared_addr_srptr; + uint mem_req; + } shared_mem_req; + + struct { + u16 remote_proc_id; + u32 *shared_addr_srptr; + } attach; + + struct { + u16 remote_proc_id; + } detach; + } args; + + int api_status; +}; + +/* ---------------------------------------------------------------------------- + * IOCTL functions for messageq module + * ---------------------------------------------------------------------------- + */ +/* + * ioctl interface function for messageq + */ +int messageq_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long args, bool user); + +#endif /* _MESSAGEQ_IOCTL_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/multiproc.h b/arch/arm/plat-omap/include/syslink/multiproc.h new file mode 100644 index 00000000000..4d14e8c193c --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/multiproc.h @@ -0,0 +1,89 @@ +/* +* multiproc.h +* +* Many multi-processor modules have the concept of processor id. multiproc +* centeralizes the processor id management. +* +* 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 _MULTIPROC_H_ +#define _MULTIPROC_H_ + +#include <linux/types.h> + + +#define VOLATILE volatile + +/* + * Unique module ID + */ +#define MULTIPROC_MODULEID (u16)0xB522 + +/* Macro to define invalid processor id */ +#define MULTIPROC_INVALIDID ((u16)0xFFFF) + +/* + * Maximum number of processors in the system + * OMAP4 has 4 processors in single core. + */ +#define MULTIPROC_MAXPROCESSORS 4 + +/* + * Max name length for a processor name + */ +#define MULTIPROC_MAXNAMELENGTH 32 + +/* + * Configuration structure for multiproc module + */ +struct multiproc_config { + s32 num_processors; /* Number of procs for particular system */ + char name_list[MULTIPROC_MAXPROCESSORS][MULTIPROC_MAXNAMELENGTH]; + /* Name List for processors in the system */ + u16 id; /* Local Proc ID. This needs to be set before calling any + other APIs */ +}; + +/* ============================================================================= + * APIs + * ============================================================================= + */ + +/* Function to get the default configuration for the multiproc module. */ +void multiproc_get_config(struct multiproc_config *cfg); + +/* Function to setup the multiproc Module */ +s32 multiproc_setup(struct multiproc_config *cfg); + +/* Function to destroy the multiproc module */ +s32 multiproc_destroy(void); + +/* Function to set local processor Id */ +int multiproc_set_local_id(u16 proc_id); + +/* Function to get processor id from processor name. */ +u16 multiproc_get_id(const char *proc_name); + +/* Function to get name from processor id. */ +char *multiproc_get_name(u16 proc_id); + +/* Function to get number of processors in the system. */ +u16 multiproc_get_num_processors(void); + +/* Return Id of current processor */ +u16 multiproc_self(void); + +/* Determines the offset for any two processors. */ +u32 multiproc_get_slot(u16 remote_proc_id); + +#endif /* _MULTIPROC_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/multiproc_ioctl.h b/arch/arm/plat-omap/include/syslink/multiproc_ioctl.h new file mode 100644 index 00000000000..f641f22d13d --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/multiproc_ioctl.h @@ -0,0 +1,94 @@ +/* +* multiproc_ioctl.h +* +* This provides the ioctl interface for multiproc module +* +* 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 _MULTIPROC_IOCTL_H_ +#define _MULTIPROC_IOCTL_H_ + +#include <linux/ioctl.h> +#include <linux/types.h> + +#include <ipc_ioctl.h> +#include <multiproc.h> + +enum CMD_MULTIPROC { + MULTIPROC_SETUP = MULTIPROC_BASE_CMD, + MULTIPROC_DESTROY, + MULTIPROC_GETCONFIG, + MULTIPROC_SETLOCALID +}; + +/* ---------------------------------------------------------------------------- + * IOCTL command IDs for MultiProc + * ---------------------------------------------------------------------------- + */ + +/* + * Command for multiproc_setup + */ +#define CMD_MULTIPROC_SETUP _IOWR(IPC_IOC_MAGIC, MULTIPROC_SETUP, \ + struct multiproc_cmd_args) + +/* + * Command for multiproc_destroy + */ +#define CMD_MULTIPROC_DESTROY _IOWR(IPC_IOC_MAGIC, MULTIPROC_DESTROY, \ + struct multiproc_cmd_args) + +/* + * Command for multiproc_get_config + */ +#define CMD_MULTIPROC_GETCONFIG _IOWR(IPC_IOC_MAGIC, MULTIPROC_GETCONFIG, \ + struct multiproc_cmd_args) + +/* + * Command for multiproc_set_local_id + */ +#define CMD_MULTIPROC_SETLOCALID _IOWR(IPC_IOC_MAGIC, MULTIPROC_SETLOCALID, \ + struct multiproc_cmd_args) + +/* + * Command arguments for multiproc + */ +union multiproc_arg { + struct { + struct multiproc_config *config; + } get_config; + + struct { + struct multiproc_config *config; + } setup; + + struct { + u16 id; + } set_local_id; +}; + +/* + * Command arguments for multiproc + */ +struct multiproc_cmd_args { + union multiproc_arg args; + s32 api_status; +}; + +/* + * This ioctl interface for multiproc module + */ +int multiproc_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long args, bool user); + +#endif /* _MULTIPROC_IOCTL_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/nameserver.h b/arch/arm/plat-omap/include/syslink/nameserver.h new file mode 100644 index 00000000000..3aeee242bc3 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/nameserver.h @@ -0,0 +1,157 @@ +/* + * nameserver.h + * + * The nameserver module manages local name/value pairs that + * enables an application and other modules to store and retrieve + * values based on a name. + * + * 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 _NAMESERVER_H_ +#define _NAMESERVER_H_ + +#include <linux/types.h> +#include <linux/list.h> + +/* + * NAMESERVER_MODULEID + * Unique module ID + */ +#define NAMESERVER_MODULEID (0xF414) + +struct nameserver_config { + u32 reserved; +}; + +/* + * Instance config-params object. + */ +struct nameserver_params { + u32 max_runtime_entries; + void *table_heap; /* Table is placed into a section on dyn creates */ + bool check_existing; /* Prevents duplicate entry add in to the table */ + u32 max_value_len; /* Length, in MAUs, of the value field */ + u16 max_name_len; /* Length, in MAUs, of name field */ +}; + + +/* + * Function to get the default configuration for the nameserver module + */ +void nameserver_get_config(struct nameserver_config *cfg); + +/* + * Function to setup the nameserver module + */ +int nameserver_setup(void); + +/* + * Function to destroy the nameserver module + */ +int nameserver_destroy(void); + +/* + * Function to construct a name server. + */ +void nameserver_construct(void *object, const char *name, + const struct nameserver_params *params); + +/* + * Function to destruct a name server + */ +void nameserver_destruct(void *object); + +/* + * Function to register a remote driver + */ +int nameserver_register_remote_driver(void *handle, u16 proc_id); + +/* + * Function to unregister a remote driver + */ +int nameserver_unregister_remote_driver(u16 proc_id); + +/* + * Determines if a remote driver is registered for the specified id. + */ +bool nameserver_is_registered(u16 proc_id); + +/* + * Function to initialize the parameter structure + */ +void nameserver_params_init(struct nameserver_params *params); + +/* + * Function to create a name server + */ +void *nameserver_create(const char *name, + const struct nameserver_params *params); + +/* + * Function to delete a name server + */ +int nameserver_delete(void **handle); + +/* + * Function to handle for a name + */ +void *nameserver_get_handle(const char *name); + +/* + * Function to add a variable length value into the local table + */ +void *nameserver_add(void *handle, const char *name, void *buf, u32 len); + +/* + * Function to add a 32 bit value into the local table + */ +void *nameserver_add_uint32(void *handle, const char *name, u32 value); + +/* + * Function to retrieve the value portion of a name/value pair + */ +int nameserver_get(void *handle, const char *name, void *buf, u32 *len, + u16 procId[]); + +/* + * Function to retrieve a 32-bit value of a name/value pair + */ +int nameserver_get_uint32(void *handle, const char *name, void *buf, + u16 procId[]); + +/* + * Function to get the value portion of a name/value pair from local table + */ +int nameserver_get_local(void *handle, const char *name, void *buf, u32 *len); + +/* + * Function to retrieve a 32-bit value from the local name/value table + */ +int nameserver_get_local_uint32(void *handle, const char *name, void *buf); + +/* + * Function to match the name + */ +int nameserver_match(void *handle, const char *name, u32 *value); + +/* + * Function to removes a value/pair + */ +int nameserver_remove(void *handle, const char *name); + +/* + * Function to remove an entry from the table + */ +int nameserver_remove_entry(void *handle, void *entry); + +#endif /* _NAMESERVER_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/nameserver_ioctl.h b/arch/arm/plat-omap/include/syslink/nameserver_ioctl.h new file mode 100644 index 00000000000..5111f46f79a --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/nameserver_ioctl.h @@ -0,0 +1,261 @@ +/* +* nameserver_ioctl.h +* +* This provides the ioctl interface for nameserver module +* +* 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 _NAMESERVER_IOCTL_H_ +#define _NAMESERVER_IOCTL_H_ + +#include <linux/ioctl.h> +#include <linux/types.h> + +#include <ipc_ioctl.h> +#include <nameserver.h> + +enum CMD_NAMESERVER { + NAMESERVER_SETUP = NAMESERVER_BASE_CMD, + NAMESERVER_DESTROY, + NAMESERVER_PARAMS_INIT, + NAMESERVER_CREATE, + NAMESERVER_DELETE, + NAMESERVER_ADD, + NAMESERVER_ADDUINT32, + NAMESERVER_GET, + NAMESERVER_GETLOCAL, + NAMESERVER_MATCH, + NAMESERVER_REMOVE, + NAMESERVER_REMOVEENTRY, + NAMESERVER_GETHANDLE, + NAMESERVER_ISREGISTERED, + NAMESERVER_GETCONFIG +}; + +/* + * IOCTL command IDs for nameserver + * + */ +/* + * Command for nameserver_setup + */ +#define CMD_NAMESERVER_SETUP _IOWR(IPC_IOC_MAGIC, \ + NAMESERVER_SETUP, \ + struct nameserver_cmd_args) + +/* + * Command for nameserver_destroy + */ +#define CMD_NAMESERVER_DESTROY _IOWR(IPC_IOC_MAGIC, \ + NAMESERVER_DESTROY, \ + struct nameserver_cmd_args) + +/* + * Command for nameserver_params_init + */ +#define CMD_NAMESERVER_PARAMS_INIT _IOWR(IPC_IOC_MAGIC, \ + NAMESERVER_PARAMS_INIT, \ + struct nameserver_cmd_args) + +/* + * Command for nameserver_create + */ +#define CMD_NAMESERVER_CREATE _IOWR(IPC_IOC_MAGIC, \ + NAMESERVER_CREATE, \ + struct nameserver_cmd_args) + +/* + * Command for nameserver_delete + */ +#define CMD_NAMESERVER_DELETE _IOWR(IPC_IOC_MAGIC, \ + NAMESERVER_DELETE, \ + struct nameserver_cmd_args) + +/* + * Command for nameserver_add + */ +#define CMD_NAMESERVER_ADD _IOWR(IPC_IOC_MAGIC, \ + NAMESERVER_ADD, \ + struct nameserver_cmd_args) + +/* + * Command for nameserver_addu32 + */ +#define CMD_NAMESERVER_ADDUINT32 _IOWR(IPC_IOC_MAGIC, \ + NAMESERVER_ADDUINT32, \ + struct nameserver_cmd_args) +/* + * Command for nameserver_get + */ +#define CMD_NAMESERVER_GET _IOWR(IPC_IOC_MAGIC, \ + NAMESERVER_GET, \ + struct nameserver_cmd_args) + +/* + * Command for nameserver_get_local + */ +#define CMD_NAMESERVER_GETLOCAL _IOWR(IPC_IOC_MAGIC, \ + NAMESERVER_GETLOCAL, \ + struct nameserver_cmd_args) + +/* + * Command for nameserver_match + */ +#define CMD_NAMESERVER_MATCH _IOWR(IPC_IOC_MAGIC, \ + NAMESERVER_MATCH, \ + struct nameserver_cmd_args) + +/* + * Command for nameserver_remove + */ +#define CMD_NAMESERVER_REMOVE _IOWR(IPC_IOC_MAGIC, \ + NAMESERVER_REMOVE, \ + struct nameserver_cmd_args) + +/* + * Command for nameserver_remove_entry + */ +#define CMD_NAMESERVER_REMOVEENTRY _IOWR(IPC_IOC_MAGIC, \ + NAMESERVER_REMOVEENTRY, \ + struct nameserver_cmd_args) + +/* + * Command for nameserver_get_handle + */ +#define CMD_NAMESERVER_GETHANDLE _IOWR(IPC_IOC_MAGIC, \ + NAMESERVER_GETHANDLE, \ + struct nameserver_cmd_args) + +/* + * Command for NameServer_isRegistered + */ +#define CMD_NAMESERVER_ISREGISTERED _IOWR(IPC_IOC_MAGIC, \ + NAMESERVER_ISREGISTERED, \ + struct nameserver_cmd_args) + +/* + * Command for NameServer_getConfig + */ +#define CMD_NAMESERVER_GETCONFIG _IOWR(IPC_IOC_MAGIC, \ + NAMESERVER_GETCONFIG, \ + struct nameserver_cmd_args) + +/* + * Command arguments for nameserver + */ +union nameserver_arg { + struct { + struct nameserver_config *config; + } get_config; + + struct { + struct nameserver_config *config; + } setup; + + struct { + struct nameserver_params *params; + } params_init; + + struct { + void *handle; + char *name; + u32 name_len; + struct nameserver_params *params; + } create; + + struct { + void *handle; + } delete_instance; + + struct { + void *handle; + char *name; + u32 name_len; + void *buf; + s32 len; + void *entry; + void *node; + } add; + + struct { + void *handle; + char *name; + u32 name_len; + u32 value; + void *entry; + } addu32; + + struct { + void *handle; + char *name; + u32 name_len; + void *value; + u32 len; + u16 *proc_id; + u32 proc_len; + } get; + + struct { + void *handle; + char *name; + u32 name_len; + void *value; + u32 len; + } get_local; + + struct { + void *handle; + char *name; + u32 name_len; + u32 value; + u32 count; + } match; + + struct { + void *handle; + char *name; + u32 name_len; + } remove; + + struct { + void *handle; + void *entry; + } remove_entry; + + struct { + void *handle; + char *name; + u32 name_len; + } get_handle; + + struct { + u16 proc_id; + bool check; + } is_registered; +}; + +/* + * Command arguments for nameserver + */ +struct nameserver_cmd_args { + union nameserver_arg args; + s32 api_status; +}; + +/* + * This ioctl interface for nameserver module + */ +int nameserver_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long args, bool user); + +#endif /* _NAMESERVER_IOCTL_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/nameserver_remote.h b/arch/arm/plat-omap/include/syslink/nameserver_remote.h new file mode 100644 index 00000000000..bc0921b08e0 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/nameserver_remote.h @@ -0,0 +1,39 @@ +/* + * nameserver_remote.h + * + * 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 _NAMESERVER_REMOTE_H_ +#define _NAMESERVER_REMOTE_H_ + +#include <linux/types.h> + +/* + * Structure defining object for the nameserver remote driver + */ +struct nameserver_remote_object { + int (*get)(const struct nameserver_remote_object *obj, + const char *instance_name, const char *name, + void *value, u32 *value_len, void *reserved); + /* Function to get data from remote nameserver */ + void *obj; /* Implementation specific object */ +}; + +/* + * Function get data from remote name server + */ +int nameserver_remote_get(const struct nameserver_remote_object *handle, + const char *instance_name, const char *name, + void *value, u32 *value_len, void *reserved); + +#endif /* _NAMESERVER_REMOTE_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/nameserver_remotenotify.h b/arch/arm/plat-omap/include/syslink/nameserver_remotenotify.h new file mode 100644 index 00000000000..cb9b6218930 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/nameserver_remotenotify.h @@ -0,0 +1,90 @@ +/* + * nameserver_remotenotify.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 _NAMESERVER_REMOTENOTIFY_H_ +#define _NAMESERVER_REMOTENOTIFY_H_ + +#include <linux/types.h> + +/* + * NAMESERVERREMOTENOTIFY_MODULEID + * Unique module ID + */ +#define NAMESERVERREMOTENOTIFY_MODULEID (0x08FD) + +/* + * Module configuration structure + */ +struct nameserver_remotenotify_config { + u32 notify_event_id; + /* Notify event number */ +}; + +/* + * Module configuration structure + */ +struct nameserver_remotenotify_params { + void *shared_addr; /* Address of the shared memory */ + void *gatemp; /* Handle to the gatemp used for protecting the + nameserver_remotenotify instance. Using the default + value of NULL will result in the default gatemp being + used for context protection */ +}; + +/* Function to get the default configuration for the nameserver_remotenotify + * module */ +void nameserver_remotenotify_get_config( + struct nameserver_remotenotify_config *cfg); + +/* Function to setup the nameserver_remotenotify module */ +int nameserver_remotenotify_setup(struct nameserver_remotenotify_config *cfg); + +/* Function to destroy the nameserver_remotenotify module */ +int nameserver_remotenotify_destroy(void); + +/* Function to get the current configuration values */ +void nameserver_remotenotify_params_init( + struct nameserver_remotenotify_params *params); + +/* Function to create the nameserver_remotenotify object */ +void *nameserver_remotenotify_create(u16 remote_proc_id, + const struct nameserver_remotenotify_params *params); + +/* Function to delete the nameserver_remotenotify object */ +int nameserver_remotenotify_delete(void **handle); + +/* Function to get a name/value from remote nameserver */ +int nameserver_remotenotify_get(void *handle, + const char *instance_name, const char *name, + void *value, u32 *value_len, void *reserved); + +/* Get the shared memory requirements for the nameserver_remotenotify */ +uint nameserver_remotenotify_shared_mem_req( + const struct nameserver_remotenotify_params *params); + +/* Create all the NameServerRemoteNotify drivers. */ +int nameserver_remotenotify_start(void *shared_addr); + +/* Attaches to remote processor */ +int nameserver_remotenotify_attach(u16 remote_proc_id, void *shared_addr); + +/* Detaches from remote processor */ +int nameserver_remotenotify_detach(u16 remote_proc_id); + + +#endif /* _NAMESERVER_REMOTENOTIFY_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/notify.h b/arch/arm/plat-omap/include/syslink/notify.h new file mode 100644 index 00000000000..0f9a399e5ce --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/notify.h @@ -0,0 +1,146 @@ +/* + * notify.h + * + * Notify driver support for OMAP 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. + */ + + +#if !defined(_NOTIFY_H_) +#define _NOTIFY_H_ + +/* The resource is still in use */ +#define NOTIFY_S_BUSY 2 + +/* Module already set up */ +#define NOTIFY_S_ALREADYSETUP 1 + +/* Operation is successful. */ +#define NOTIFY_S_SUCCESS 0 + +/* Generic failure */ +#define NOTIFY_E_FAIL -1 + +/* Argument passed to function is invalid.. */ +#define NOTIFY_E_INVALIDARG -2 + +/* Operation resulted in memory failure. */ +#define NOTIFY_E_MEMORY -3 + +/* The specified entity already exists. */ +#define NOTIFY_E_ALREADYEXISTS -4 + +/* Unable to find the specified entity. */ +#define NOTIFY_E_NOTFOUND -5 + +/* Operation timed out. */ +#define NOTIFY_E_TIMEOUT -6 + +/* Module is not initialized. */ +#define NOTIFY_E_INVALIDSTATE -7 + +/* A failure occurred in an OS-specific call */ +#define NOTIFY_E_OSFAILURE -8 + +/* The module has been already setup */ +#define NOTIFY_E_ALREADYSETUP -9 + +/* Specified resource is not available */ +#define NOTIFY_E_RESOURCE -10 + +/* Operation was interrupted. Please restart the operation */ +#define NOTIFY_E_RESTART -11 + +/* The resource is still in use */ +#define NOTIFY_E_BUSY -12 + +/* Driver corresponding to the specified eventId is not registered */ +#define NOTIFY_E_DRIVERNOTREGISTERED -13 + +/* Event not registered */ +#define NOTIFY_E_EVTNOTREGISTERED -14 + +/* Event is disabled */ +#define NOTIFY_E_EVTDISABLED -15 + +/* Remote notification is not initialized */ +#define NOTIFY_E_NOTINITIALIZED -16 + +/* Trying to illegally use a reserved event */ +#define NOTIFY_E_EVTRESERVED -17 + +/* Macro to make a correct module magic number with refCount */ +#define NOTIFY_MAKE_MAGICSTAMP(x) ((NOTIFY_MODULEID << 12u) | (x)) + +#define REG volatile + +/* Maximum number of events supported by the Notify module */ +#define NOTIFY_MAXEVENTS (u16)32 + +/* Maximum number of IPC interrupt lines per processor. */ +#define NOTIFY_MAX_INTLINES 4u + +/* This key must be provided as the upper 16 bits of the eventNo when + * registering for an event, if any reserved event numbers are to be + * used. */ +#define NOTIFY_SYSTEMKEY 0xC1D2 + + +typedef void (*notify_fn_notify_cbck)(u16 proc_id, u16 line_id, u32 event_id, + uint *arg, u32 payload); + +extern struct notify_module_object notify_state; + + +/* Function to disable Notify module */ +u32 notify_disable(u16 procId, u16 line_id); + +/* Function to disable particular event */ +void notify_disable_event(u16 proc_id, u16 line_id, u32 event_id); + +/* Function to enable particular event */ +void notify_enable_event(u16 proc_id, u16 line_id, u32 event_id); + +/* Function to find out whether notification via interrupt line has been + * registered. */ +bool notify_is_registered(u16 proc_id, u16 line_id); + +/* Returns the amount of shared memory used by one Notify instance. */ +uint notify_shared_mem_req(u16 proc_id, void *shared_addr); + +/* Function to register an event */ +int notify_register_event(u16 proc_id, u16 line_id, u32 event_id, + notify_fn_notify_cbck notify_callback_fxn, + void *cbck_arg); + +/* Function to register an event */ +int notify_register_event_single(u16 proc_id, u16 line_id, u32 event_id, + notify_fn_notify_cbck notify_callback_fxn, + void *cbck_arg); + +/* Function to restore Notify module state */ +void notify_restore(u16 proc_id, u16 line_id, u32 key); + +/* Function to send an event to other processor */ +int notify_send_event(u16 proc_id, u16 line_id, u32 event_id, u32 payload, + bool wait_clear); + +/* Function to unregister an event */ +int notify_unregister_event(u16 proc_id, u16 line_id, u32 event_id, + notify_fn_notify_cbck notify_callback_fxn, + void *cbck_arg); + +/* Function to unregister an event */ +int notify_unregister_event_single(u16 proc_id, u16 line_id, u32 event_id); + + +#endif /* !defined(_NOTIFY_H_) */ diff --git a/arch/arm/plat-omap/include/syslink/notify_dispatcher.h b/arch/arm/plat-omap/include/syslink/notify_dispatcher.h new file mode 100644 index 00000000000..efd87315815 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/notify_dispatcher.h @@ -0,0 +1,158 @@ +/* + * notify_dispatcher.h + * + * Notify driver support for OMAP 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 __TMBX_H__ +#define __TMBX_H__ + + +#include <syslink/notifydefs.h> +#include <linux/interrupt.h> + +#include <syslink/notifyerr.h> + +#define MAX_MBOX_MODULES 2 +#define MAX_MBOX_ISRS 32 +#define KErrNone 0 +#define KErrNotSupported 1 +#define KErrNotReady 2 +#define KErrArgument 2 + +typedef void (*isr_call_back)(void *); + +struct mbox_config { + unsigned long int mbox_linear_addr; + unsigned long int mbox_modules; + signed long int interrupt_lines[MAX_MBOX_MODULES]; + signed long int mailboxes[MAX_MBOX_MODULES]; +}; + +struct mbox_isrs { + signed long int isrNo[MAX_MBOX_MODULES]; + /* TODO: Remove this - seems to be unused.*/ + isr_call_back isrs[MAX_MBOX_MODULES][MAX_MBOX_ISRS]; + void *isr_params[MAX_MBOX_MODULES][MAX_MBOX_ISRS]; +}; + +extern const unsigned long *linear_address; + +irqreturn_t notify_mailbx0_user0_isr(int temp, void *anArg, struct pt_regs *p); + +/* + *func ntfy_disp_bind_interrupt + * + * desc Bind an ISR to the HW interrupt line coming into the processor + */ +int ntfy_disp_bind_interrupt(int interrupt_no, + isr_call_back hw_isr, + void *isr_arg); + + +/* + * desc Print the mailbox registers and other useful debug information + * + */ +void ntfy_disp_debug(void); + + +/* + * func ntfy_disp_deinit + * desc Uninitialize the Mailbox Manager module + */ +int ntfy_disp_deinit(void); + + +/* + * desc Return the pointer to the Mailbox Manager's configuration object + */ +struct mbox_config *ntfy_disp_get_config(void); + + +/* + * desc Initialize the Mailbox Manager module + */ +int ntfy_disp_init(void); + + +/* + * desc Disable a particular IRQ bit on a Mailbox IRQ Enable Register + */ +int ntfy_disp_interrupt_disable(unsigned long int mbox_module_no, + int a_irq_bit); + + +/* + * desc Enable a particular IRQ bit on a Mailbox IRQ Enable Register + */ +int ntfy_disp_interrupt_enable(unsigned long int mbox_module_no, + int a_irq_bit); + + +/* + * desc Read a message on a Mailbox FIFO queue + */ +int ntfy_disp_read(unsigned long int mbox_module_no, + int a_mbox_no, + int *messages, + int *num_messages, + short int read_all); + + +/* + * func ntfy_disp_register + * desc Register a ISR callback associated with a particular IRQ bit on a + * Mailbox IRQ Enable Register + */ +int ntfy_disp_register(unsigned long int mbox_module_no, + int a_irq_bit, + isr_call_back isr_cbck_fn, + void *isrCallbackArgs); + + +/* + * func ntfy_disp_send + * desc Send a message on a Mailbox FIFO queue + */ +int ntfy_disp_send(unsigned long int mbox_module_no, + int a_mbox_no, + int message); + + +/* + * func ntfy_disp_unbind_interrupt + * desc Remove the ISR to the HW interrupt line coming into the processor + */ +int ntfy_disp_unbind_interrupt(int interrupt_no); + + +/* + * func ntfy_disp_unregister + * desc Unregister a ISR callback associated with a particular IRQ bit on a + * Mailbox IRQ Enable Register + */ +int ntfy_disp_unregister(unsigned long int mbox_module_no, + int a_irq_bit); + +/* + * func notify_mailbx0_user0_isr + * desc mail ISR + * + */ + +irqreturn_t notify_mailbx0_user0_isr(int temp, void *anArg, struct pt_regs *p); + + +#endif diff --git a/arch/arm/plat-omap/include/syslink/notify_driver.h b/arch/arm/plat-omap/include/syslink/notify_driver.h new file mode 100644 index 00000000000..95c586b7762 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/notify_driver.h @@ -0,0 +1,45 @@ +/* + * notify_driver.h + * + * Notify driver support for OMAP 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. + */ + + +#if !defined _NOTIFY_DRIVER_H_ +#define _NOTIFY_DRIVER_H_ + + +/* Module includes */ +#include <syslink/notify_driverdefs.h> +#include <syslink/_notify.h> + + +/* Function to register notify driver */ +int notify_register_driver(u16 remote_proc_id, + u16 line_id, + struct notify_driver_fxn_table *fxn_table, + struct notify_driver_object **driver_handle); + +/* Function to unregister notify driver */ +int notify_unregister_driver(struct notify_driver_object *drv_handle); + +/* Function to set the driver handle */ +int notify_set_driver_handle(u16 remote_proc_id, u16 line_id, + struct notify_object *handle); + +/* Function to find the driver in the list of drivers */ +struct notify_driver_object *notify_get_driver_handle(u16 remote_proc_id, + u16 line_id); + + +#endif /* !defined (_NOTIFY_DRIVER_H_) */ diff --git a/arch/arm/plat-omap/include/syslink/notify_driverdefs.h b/arch/arm/plat-omap/include/syslink/notify_driverdefs.h new file mode 100644 index 00000000000..56f6b282caf --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/notify_driverdefs.h @@ -0,0 +1,137 @@ +/* + * notify_driverdefs.h + * + * Notify driver support for OMAP 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. + */ + + +#if !defined(_NOTIFY_DRIVERDEFS_H_) +#define _NOTIFY_DRIVERDEFS_H_ + + +/* Module headers */ +#include <syslink/multiproc.h> +#include <syslink/notify.h> +#include <syslink/_notify.h> + + +/* Enumerations to indicate types of Driver initialization status */ +enum notify_driver_init_status { + NOTIFY_DRIVERINITSTATUS_NOTDONE = 0, + /* Driver initialization is not done. */ + NOTIFY_DRIVERINITSTATUS_DONE = 1, + /* Driver initialization is complete. */ + NOTIFY_DRIVERINITSTATUS_INPROGRESS = 2, + /* Driver initialization is in progress. */ + NOTIFY_DRIVERINITSTATUS_ENDVALUE = 3 + /* End delimiter indicating start of invalid values for this enum */ +}; + +struct notify_driver_object; + +/* This structure defines the function table interface for the Notify + * driver. + * This function table interface must be implemented by each Notify + * driver and registered with the Notify module. */ +struct notify_driver_fxn_table { + int (*register_event)(struct notify_driver_object *handle, + u32 event_id); + /* interface function register_event */ + int (*unregister_event)(struct notify_driver_object *handle, + u32 event_id); + /* interface function unregister_event */ + int (*send_event)(struct notify_driver_object *handle, u32 event_id, + u32 payload, bool wait_clear); + /* interface function send_event */ + u32 (*disable)(struct notify_driver_object *handle); + /* interface function disable */ + void (*enable)(struct notify_driver_object *handle); + /* interface function enable */ + void (*disable_event)(struct notify_driver_object *handle, + u32 event_id); + /* interface function disable_event */ + void (*enable_event)(struct notify_driver_object *handle, u32 event_id); + /* interface function enable_event */ +}; + +/* This structure defines the Notify driver object and handle used + * internally to contain all information required for the Notify driver + * This object contains all information for the Notify module to be + * able to identify and interact with the Notify driver. */ +struct notify_driver_object { + enum notify_driver_init_status is_init; + struct notify_driver_fxn_table fxn_table; + struct notify_object *notify_handle; +}; + +#if 0 +/* + *This structure defines information for all processors supported by + *the Notify driver. + *An instance of this object is provided for each processor handled by + *the Notify driver, when registering itself with the Notify module. + * + */ +struct notify_driver_proc_info { + u32 max_events; + u32 reserved_events; + bool event_priority; + u32 payload_size; + u16 proc_id; +}; + +/* + * This structure defines the structure for specifying Notify driver + * attributes to the Notify module. + * This structure provides information about the Notify driver to the + * Notify module. The information is used by the Notify module mainly + * for parameter validation. It may also be used by the Notify module + * to take appropriate action if required, based on the characteristics + * of the Notify driver. + */ +struct notify_driver_attrs { + u32 numProc; + struct notify_driver_proc_info + proc_info[MULTIPROC_MAXPROCESSORS]; +}; + +union notify_drv_procevents{ + struct { + struct notify_shmdrv_attrs attrs; + struct notify_shmdrv_ctrl *ctrl_ptr; + } shm_events; + + struct { + /*Attributes */ + unsigned long int num_events; + unsigned long int send_event_pollcount; + /*Control Paramters */ + unsigned long int send_init_status ; + struct notify_shmdrv_eventreg_mask reg_mask ; + } non_shm_events; +}; + +struct notify_drv_eventlist { + unsigned long int event_handler_count; + struct list_head listeners; +}; + +struct notify_drv_proc_module { + unsigned long int proc_id; + struct notify_drv_eventlist *event_list; + struct notify_shmdrv_eventreg *reg_chart; + union notify_drv_procevents events_obj; +}; +#endif + +#endif /* !defined(_NOTIFY_DRIVERDEFS_H_) */ diff --git a/arch/arm/plat-omap/include/syslink/notify_ducatidriver.h b/arch/arm/plat-omap/include/syslink/notify_ducatidriver.h new file mode 100644 index 00000000000..aa805ffbb3c --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/notify_ducatidriver.h @@ -0,0 +1,141 @@ +/* + * notify_ducatidriver.h + * + * Syslink driver support for OMAP 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 NOTIFY_DUCATIDRIVER_H_ +#define NOTIFY_DUCATIDRIVER_H_ + + + +/* Notify*/ +#include <syslink/notify.h> +#include <syslink/notify_driverdefs.h> + +/* Module ID for NotifyDriverShm. */ +#define NOTIFY_DUCATIDRIVER_MODULEID ((u16) 0xb9d4) + +#define VOLATILE volatile + +extern u32 get_ducati_virt_mem(); +extern void unmap_ducati_virt_mem(u32 shm_virt_addr); + + +/* module configuration structure */ +struct notify_ducatidrv_config { + u32 reserved; +}; + +/* This structure defines the configuration structure for + * initialization of the Notify driver. */ +struct notify_ducatidrv_params { + void *shared_addr; + /* Address in shared memory where this instance will be placed */ + bool cache_enabled; + /* Whether cache operations will be performed */ + u32 cache_line_size; + /* The cache line size of the shared memory */ + u32 remote_proc_id; + /* Processor Id of remote processor required for communication */ + u32 line_id; + /* Line ID for the interrupt */ + u32 local_int_id; + /* Local interrupt ID for interrupt line for incoming interrupts */ + u32 remote_int_id; + /* Remote interrupt ID for interrupt line for outgoing interrupts */ +}; + +/* Defines the structure of event entry within the event chart. + * Each entry contains occured event-specific information. + * Used to flag a remote event and determine if a local event has been + * flagged. This struct is placed in shared memory. */ +struct notify_ducatidrv_event_entry { + VOLATILE u32 flag; + /* Flag indicating whether event is set */ + VOLATILE u32 payload; + /* Payload associated with event */ + VOLATILE u32 reserved; + /* Reserved field */ + /* Padding for cache line alignment */ +}; + +/* Defines the NotifyDriverShm control structure, which contains all + * information for one processor. This structure is shared between the + * two processors. */ +struct notify_ducatidrv_proc_ctrl { + VOLATILE u32 recv_init_status; + /* Initialization status for receiving events */ + VOLATILE u32 send_init_status; + /* Initialization status for sending events */ + VOLATILE u32 event_reg_mask; + /* Event Registered mask */ + VOLATILE u32 event_enable_mask; + /* Event Enabled mask */ +}; + + +/* Function to get the default configuration for the notify_ducati driver + * module. */ +void notify_ducatidrv_get_config(struct notify_ducatidrv_config *cfg); + +/* Function to setup the notify ducati driver with the given configuration*/ +int notify_ducatidrv_setup(struct notify_ducatidrv_config *cfg); + +/* Function to destroy the notify ducati driver */ +int notify_ducatidrv_destroy(void); + +/*Function to initialize the given parameters */ +void notify_ducatidrv_params_init(struct notify_ducatidrv_params *params); + +/* Function to create the ducati driver handle and performs initialization. */ +struct notify_ducatidrv_object *notify_ducatidrv_create( + const struct notify_ducatidrv_params *params); + +/* Function to delete the ducati driver handle and performs de initialization.*/ +int notify_ducatidrv_delete(struct notify_ducatidrv_object **handle); + +/* Get the shared memory requirements for the notify ducati driver. */ +uint notify_ducatidrv_shared_mem_req( + const struct notify_ducatidrv_params *params); + + +/* Register a callback for an event with the Notify driver. */ +int notify_ducatidrv_register_event(struct notify_driver_object *handle, + u32 event_id); + +/* Unregister a callback for an event with the Notify driver. */ +int notify_ducatidrv_unregister_event(struct notify_driver_object *handle, + u32 event_id); + +/* Send a notification event to the registered users for this + notification on the specified processor. */ +int notify_ducatidrv_send_event(struct notify_driver_object *handle, + u32 event_id, u32 payload, bool wait_clear); + +/* Disable all events for this Notify driver. */ +int notify_ducatidrv_disable(struct notify_driver_object *handle); + +/* Restore the Notify driver to the state before the last disable was called. */ +void notify_ducatidrv_enable(struct notify_driver_object *handle); + +/* Disable a specific event for this Notify driver. */ +void notify_ducatidrv_disable_event(struct notify_driver_object *handle, + u32 event_id); + +/* Enable a specific event for this Notify driver. */ +void notify_ducatidrv_enable_event(struct notify_driver_object *handle, + u32 event_id); + + +#endif /* !defined NOTIFY_SHMDRIVER_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/notify_ioctl.h b/arch/arm/plat-omap/include/syslink/notify_ioctl.h new file mode 100644 index 00000000000..9d1dcadd4ba --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/notify_ioctl.h @@ -0,0 +1,278 @@ +/* + * notify_driverdefs.h + * + * Notify driver support for OMAP 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. + */ + + +#if !defined(_NOTIFY_IOCTL_H_) +#define _NOTIFY_IOCTL_H_ + +/* Linux headers */ +#include <linux/ioctl.h> + +/* Utilities headers */ +#include <syslink/host_os.h> + +/* Module headers */ +#include <ipc_ioctl.h> +#include <syslink/notify.h> +#include <syslink/notify_ducatidriver.h> +#include <syslink/notifydefs.h> + + +enum CMD_NOTIFY { + NOTIFY_GETCONFIG = NOTIFY_BASE_CMD, + NOTIFY_SETUP, + NOTIFY_DESTROY, + NOTIFY_REGISTEREVENT, + NOTIFY_UNREGISTEREVENT, + NOTIFY_SENDEVENT, + NOTIFY_DISABLE, + NOTIFY_RESTORE, + NOTIFY_DISABLEEVENT, + NOTIFY_ENABLEEVENT, + NOTIFY_ATTACH, + NOTIFY_DETACH, + NOTIFY_THREADATTACH, + NOTIFY_THREADDETACH, + NOTIFY_ISREGISTERED, + NOTIFY_SHAREDMEMREQ, + NOTIFY_REGISTEREVENTSINGLE, + NOTIFY_UNREGISTEREVENTSINGLE +}; + +/* Command for notify_get_config */ +#define CMD_NOTIFY_GETCONFIG _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_GETCONFIG, \ + struct notify_cmd_args_get_config) + +/* Command for notify_setup */ +#define CMD_NOTIFY_SETUP _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_SETUP, \ + struct notify_cmd_args_setup) + +/* Command for notify_destroy */ +#define CMD_NOTIFY_DESTROY _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_DESTROY, \ + struct notify_cmd_args_destroy) + +/* Command for notify_register_event */ +#define CMD_NOTIFY_REGISTEREVENT _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_REGISTEREVENT, \ + struct notify_cmd_args_register_event) + +/* Command for notify_unregister_event */ +#define CMD_NOTIFY_UNREGISTEREVENT _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_UNREGISTEREVENT, \ + struct notify_cmd_args_unregister_event) + +/* Command for notify_send_event */ +#define CMD_NOTIFY_SENDEVENT _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_SENDEVENT, \ + struct notify_cmd_args_send_event) +/* Command for notify_disable */ +#define CMD_NOTIFY_DISABLE _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_DISABLE, \ + struct notify_cmd_args_disable) + +/* Command for notify_restore */ +#define CMD_NOTIFY_RESTORE _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_RESTORE, \ + struct notify_cmd_args_restore) + +/* Command for notify_disable_event */ +#define CMD_NOTIFY_DISABLEEVENT _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_DISABLEEVENT, \ + struct notify_cmd_args_disable_event) + +/* Command for notify_enable_event */ +#define CMD_NOTIFY_ENABLEEVENT _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_ENABLEEVENT, \ + struct notify_cmd_args_enable_event) + +/* Command for notify_attach */ +#define CMD_NOTIFY_ATTACH _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_ATTACH, \ + struct notify_cmd_args_attach) + +/* Command for notify_detach */ +#define CMD_NOTIFY_DETACH _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_DETACH, \ + struct notify_cmd_args_detach) + +/* Command for notify_thread_attach */ +#define CMD_NOTIFY_THREADATTACH _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_THREADATTACH, \ + struct notify_cmd_args) + +/* Command for notify_thread_detach */ +#define CMD_NOTIFY_THREADDETACH _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_THREADDETACH, \ + struct notify_cmd_args) + +/* Command for notify_is_registered */ +#define CMD_NOTIFY_ISREGISTERED _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_ISREGISTERED, \ + struct notify_cmd_args_is_registered) + +/* Command for notify_shared_mem_req */ +#define CMD_NOTIFY_SHAREDMEMREQ _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_SHAREDMEMREQ, \ + struct notify_cmd_args_shared_mem_req) +/* Command for notify_register_event_single */ +#define CMD_NOTIFY_REGISTEREVENTSINGLE _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_REGISTEREVENTSINGLE, \ + struct notify_cmd_args_register_event) + +/* Command for notify_unregister_event_single */ +#define CMD_NOTIFY_UNREGISTEREVENTSINGLE _IOWR(IPC_IOC_MAGIC, \ + NOTIFY_UNREGISTEREVENTSINGLE, \ + struct notify_cmd_args_unregister_event) + + +/*Structure of Event Packet read from notify kernel-side..*/ +struct notify_drv_event_packet { + struct list_head element; + u32 pid; + u32 proc_id; + u32 event_id; + u16 line_id; + u32 data; + notify_fn_notify_cbck func; + void *param; + bool is_exit; +}; + +/* Common arguments for all ioctl commands */ +struct notify_cmd_args { + int api_status; +}; + +/* Command arguments for notify_get_config */ +struct notify_cmd_args_get_config { + struct notify_cmd_args common_args; + struct notify_config *cfg; +}; + +/* Command arguments for notify_setup */ +struct notify_cmd_args_setup { + struct notify_cmd_args common_args; + struct notify_config *cfg; +}; + +/* Command arguments for notify_destroy */ +struct notify_cmd_args_destroy { + struct notify_cmd_args common_args; +}; + +/* Command arguments for notify_attach */ +struct notify_cmd_args_attach { + struct notify_cmd_args common_args; + u16 proc_id; + void *shared_addr; +}; + +/* Command arguments for notify_detach */ +struct notify_cmd_args_detach { + struct notify_cmd_args common_args; + u16 proc_id; +}; + +/* Command arguments for notify_cmd_args_shared_mem_req */ +struct notify_cmd_args_shared_mem_req { + struct notify_cmd_args common_args; + u16 proc_id; + void *shared_addr; + uint shared_mem_size; +}; + +/* Command arguments for notify_cmd_args_is_registered */ +struct notify_cmd_args_is_registered { + struct notify_cmd_args common_args; + u16 proc_id; + u16 line_id; + bool is_registered; +}; + +/* Command arguments for notify_register_event */ +struct notify_cmd_args_register_event { + struct notify_cmd_args common_args; + u16 proc_id; + u16 line_id; + u32 event_id; + notify_fn_notify_cbck fn_notify_cbck; + uint *cbck_arg; + u32 pid; +}; + +/* Command arguments for notify_unregister_event */ +struct notify_cmd_args_unregister_event { + struct notify_cmd_args common_args; + u16 proc_id; + u16 line_id; + u32 event_id; + notify_fn_notify_cbck fn_notify_cbck; + uint *cbck_arg; + u32 pid; +}; + +/* Command arguments for notify_send_event */ +struct notify_cmd_args_send_event { + struct notify_cmd_args common_args; + u16 proc_id; + u16 line_id; + u32 event_id; + u32 payload; + bool wait_clear; +}; + +/* Command arguments for notify_disable */ +struct notify_cmd_args_disable { + struct notify_cmd_args common_args; + u16 proc_id; + u16 line_id; + u32 flags; +}; + +/* Command arguments for notify_restore */ +struct notify_cmd_args_restore { + struct notify_cmd_args common_args; + u32 key; + u16 proc_id; + u16 line_id; +}; + +/* Command arguments for notify_disable_event */ +struct notify_cmd_args_disable_event { + struct notify_cmd_args common_args; + u16 proc_id; + u16 line_id; + u32 event_id; +}; + +/* Command arguments for notify_enable_event */ +struct notify_cmd_args_enable_event { + struct notify_cmd_args common_args; + u16 proc_id; + u16 line_id; + u32 event_id; +}; + +/* Command arguments for notify_exit */ +struct notify_cmd_args_exit { + struct notify_cmd_args common_args; +}; + + +#endif /* !defined(_NOTIFY_IOCTL_H_) */ diff --git a/arch/arm/plat-omap/include/syslink/notify_setup_proxy.h b/arch/arm/plat-omap/include/syslink/notify_setup_proxy.h new file mode 100644 index 00000000000..383b3150a7d --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/notify_setup_proxy.h @@ -0,0 +1,53 @@ +/* + * notify_setup_proxy.h + * + * Proxy to connect notify setup to device specific implementation + * + * 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. + */ + +#if !defined(_NOTIFYSETUPPROXY_H_0x5f84) +#define _NOTIFYSETUPPROXY_H_0x5f84 + +#if defined(CONFIG_ARCH_OMAP4) +/* Function that will be called in Notify_attach */ +extern int notify_setup_omap4_attach(u16 proc_id, void *shared_addr); +#define notify_setup_proxy_attach(proc_id, shared_addr) \ + notify_setup_omap4_attach(proc_id, shared_addr) + +/* Function that will be called in notify_stop */ +extern int notify_setup_omap4_detach(u16 proc_id); +#define notify_setup_proxy_detach notify_setup_omap4_detach + +/* Shared Memory Required for notify setup */ +extern uint notify_setup_omap4_shared_mem_req(u16 proc_id, void *shared_addr); +#define notify_setup_proxy_shared_mem_req(proc_id, shared_addr) \ + notify_setup_omap4_shared_mem_req(proc_id, shared_addr) + +/* Is interrupt line available? */ +extern bool notify_setup_omap4_int_line_available(u16 remote_proc_id); +#define notify_setup_proxy_int_line_available(remote_proc_id) \ + notify_setup_omap4_int_line_available(remote_proc_id) +#else +/* Function that will be called in Notify_attach */ +#define notify_setup_proxy_attach(proc_id, shared_addr) + +/* Function that will be called in notify_stop */ +#define notify_setup_proxy_detach + +/* Shared Memory Required for notify setup */ +#define notify_setup_proxy_shared_mem_req(proc_id, shared_addr) + +/* Is interrupt line available? */ +#define notify_setup_proxy_int_line_available(remote_proc_id) +#endif /* if defined (SYSLINK_PLATFORM_OMAPL1XX) */ + +#endif /* !defined(_NOTIFYSETUPPROXY_H_0x5f84) */ diff --git a/arch/arm/plat-omap/include/syslink/notifyerr.h b/arch/arm/plat-omap/include/syslink/notifyerr.h new file mode 100644 index 00000000000..0a14c0edc25 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/notifyerr.h @@ -0,0 +1,198 @@ +/* + * notifyerr.h + * + * Notify driver support for OMAP 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. + */ + + +#if !defined NOTIFYERR_H +#define NOTIFYERR_H + + +/* + * name NOTIFY_SUCCEEDED + * + * desc Check if the provided status code indicates a success code. + * + * arg status + * Status code to be checked + * + * ret TRUE + * If status code indicates success + * FALSE + * If status code indicates failure + * + * enter None. + * + * leave None. + * + * see NOTIFY_FAILED + * + */ +#define NOTIFY_SUCCEEDED(status)\ +(((signed long int) (status) >= (NOTIFY_SBASE)) \ +&& ((signed long int) (status) <= (NOTIFY_SLAST))) + + +/* + * @name NOTIFY_FAILED + * + * @desc Check if the provided status code indicates a failure code. + * + * @arg status + * Status code to be checked + * + * @ret TRUE + * If status code indicates failure + * FALSE + * If status code indicates success + * + * @enter None. + * + * @leave None. + * + * @see NOTIFY_FAILED + * + */ +#define NOTIFY_FAILED(status) (!NOTIFY_SUCCEEDED(status)) + + + +/* + * name NOTIFY_SBASE, NOTIFY_SLAST + * + * desc Defines the base and range for the success codes used by the + * Notify module + * + */ +#define NOTIFY_SBASE (signed long int)0x00002000l +#define NOTIFY_SLAST (signed long int)0x000020FFl + +/* + * name NOTIFY_EBASE, NOTIFY_ELAST + * + * desc Defines the base and range for the failure codes used by the + * Notify module + * + */ +#define NOTIFY_EBASE (signed long int)0x80002000l +#define NOTIFY_ELAST (signed long int)0x800020FFl + + +/* + * SUCCESS Codes + * + */ + +/* Generic success code for Notify module */ +#define NOTIFY_SOK (NOTIFY_SBASE + 0x01l) + +/* Indicates that the Notify module (or driver) has already been initialized + * by another client, and this process has now successfully acquired the right + * to use the Notify module. + */ +#define NOTIFY_SALREADYINIT (NOTIFY_SBASE + 0x02l) + +/* Indicates that the Notify module (or driver) is now being finalized, since + * the calling client is the last one finalizing the module, and all open + * handles to it have been closed. + */ +#define NOTIFY_SEXIT (NOTIFY_SBASE + 0x03l) + + +/* + * FAILURE Codes + * + */ + +/* Generic failure code for Notify module */ +#define NOTIFY_EFAIL (NOTIFY_EBASE + 0x01l) + +/* This failure code indicates that an operation has timed out. */ +#define NOTIFY_ETIMEOUT (NOTIFY_EBASE + 0x02l) + +/* This failure code indicates a configuration error */ +#define NOTIFY_ECONFIG (NOTIFY_EBASE + 0x03l) + +/* This failure code indicates that the Notify module has already been + * initialized from the calling client (process). + */ +#define NOTIFY_EALREADYINIT (NOTIFY_EBASE + 0x04l) + +/* This failure code indicates that the specified entity was not found + * The interpretation of this error code depends on the function from which it + * was returned. + */ +#define NOTIFY_ENOTFOUND (NOTIFY_EBASE + 0x05l) + +/* This failure code indicates that the specified feature is not supported + * The interpretation of this error code depends on the function from which it + * was returned. + */ +#define NOTIFY_ENOTSUPPORTED (NOTIFY_EBASE + 0x06l) + +/* This failure code indicates that the specified event number is + * not supported + */ +#define NOTIFY_EINVALIDEVENT (NOTIFY_EBASE + 0x07l) + +/* This failure code indicates that the specified pointer is invalid */ +#define NOTIFY_EPOINTER (NOTIFY_EBASE + 0x08l) + +/* This failure code indicates that a provided parameter was outside its valid + * range. + * The interpretation of this error code depends on the function from which it + * was returned. + */ +#define NOTIFY_ERANGE (NOTIFY_EBASE + 0x09l) + +/* This failure code indicates that the specified handle is invalid */ +#define NOTIFY_EHANDLE (NOTIFY_EBASE + 0x0Al) + +/* This failure code indicates that an invalid argument was specified */ +#define NOTIFY_EINVALIDARG (NOTIFY_EBASE + 0x0Bl) + +/* This failure code indicates a memory related failure */ +#define NOTIFY_EMEMORY (NOTIFY_EBASE + 0x0Cl) + +/* This failure code indicates that the Notify module has not been initialized*/ +#define NOTIFY_EINIT (NOTIFY_EBASE + 0x0Dl) + +/* This failure code indicates that a resource was not available. + * The interpretation of this error code depends on the function from which it + * was returned. + */ +#define NOTIFY_ERESOURCE (NOTIFY_EBASE + 0x0El) + +/* This failure code indicates that there was an attempt to register for a + * reserved event. + */ +#define NOTIFY_ERESERVEDEVENT (NOTIFY_EBASE + 0x0Fl) + +/* This failure code indicates that the specified entity already exists. + * The interpretation of this error code depends on the function from which it + * was returned. + */ +#define NOTIFY_EALREADYEXISTS (NOTIFY_EBASE + 0x10l) + +/* This failure code indicates that the Notify driver has not been fully + * initialized + */ +#define NOTIFY_EDRIVERINIT (NOTIFY_EBASE + 0x11l) + +/* This failure code indicates that the other side is not ready to receive + * notifications. + */ +#define NOTIFY_ENOTREADY (NOTIFY_EBASE + 0x12l) + +#endif /* !defined (NOTIFYERR_H) */ diff --git a/arch/arm/plat-omap/include/syslink/platform.h b/arch/arm/plat-omap/include/syslink/platform.h new file mode 100644 index 00000000000..9dbae5cf152 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/platform.h @@ -0,0 +1,44 @@ +/* + * platform.h + * + * Defines the platform functions to be used by SysMgr module. + * + * Copyright (C) 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 _PLATFORM_H_ +#define _PLATFORM_H_ + +#define PLATFORM_S_SUCCESS 0 +#define PLATFORM_E_FAIL -1 +#define PLATFORM_E_INVALIDARG -2 + +/* ============================================================================= + * APIs + * ============================================================================= + */ +/* Function to setup the platform */ +s32 platform_setup(void); + +/* Function to destroy the platform */ +s32 platform_destroy(void); + +/* Function called when slave is loaded with executable */ +int platform_load_callback(u16 proc_id, void *arg); + +/* Function called when slave is in started state*/ +int platform_start_callback(u16 proc_id, void *arg); + +/* Function called when slave is stopped state */ +int platform_stop_callback(u16 proc_id, void *arg); + +#endif /* ifndef _PLATFORM_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/platform_mem.h b/arch/arm/plat-omap/include/syslink/platform_mem.h new file mode 100644 index 00000000000..60d2c87d0f0 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/platform_mem.h @@ -0,0 +1,136 @@ +/* + * platform_mem.c + * + * Target memory management interface implementation. + * + * This abstracts the Memory management interface in the kernel + * code. Allocation, Freeing-up, copy and address translate are + * supported for the kernel memory management. + * + * 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 _PLATFORM_MEM_H_ +#define _PLATFORM_MEM_H_ + +#include <linux/types.h> + +/* + * MEMORYOS_MODULEID + * Module ID for platform mem module + */ +#define PLATFORM_MEM_MODULEID (u16) 0x97D2 + +/* + * Enumerates the types of caching for memory regions + */ +enum platform_mem_cache_flags { + PLATFORM_MEM_CACHE_FLAGS_DEFAULT = 0x00000000, + /* Default flags - Cached */ + PLATFORM_MEM_CACHE_FLAGS_CACHED = 0x00010000, + /* Cached memory */ + PLATFORM_MEM_CACHE_FLAGS_UNCACHED = 0x00020000, + /* Uncached memory */ + PLATFORM_MEM_CACHE_FLAGS_END_VALUE = 0x00030000 + /* End delimiter indicating start of invalid values for this enum */ +}; + +/* + * Enumerates the types of memory allocation + */ +enum platform_mem_mtype_flags{ + PLATFORM_MEM_MTYPE_FLAGS_DEFAULT = 0x00000000, + /* Default flags - virtually contiguous */ + PLATFORM_MEM_MTYPE_FLAGS_PHYSICAL = 0x00000001, + /* Physically contiguous */ + PLATFORM_MEM_MTYPE_FLAGS_DMA = 0x00000002, + /* Physically contiguous */ + PLATFORM_MEM_MTYPE_FLAGS_END_VALUE = 0x00000003 + /* End delimiter indicating start of invalid values for this enum */ +}; + +/* + * Enumerates the types of translation + */ +enum memory_xlt_flags{ + PLATFORM_MEM_XLT_FLAGS_VIRT2PHYS = 0x00000000, + /* Virtual to physical */ + PLATFORM_MEM_XLT_FLAGS_PHYS2VIRT = 0x00000001, + /* Virtual to physical */ + PLATFORM_MEM_XLT_FLAGS_END_VALUE = 0x00000002 + /* End delimiter indicating start of invalid values for this enum */ +}; + +/* + * Structure containing information required for mapping a + * memory region. + */ +struct platform_mem_map_info { + u32 src; + /* Address to be mapped. */ + u32 size; + /* Size of memory region to be mapped. */ + u32 dst; + /* Mapped address. */ + bool is_cached; + /* Whether the mapping is to a cached area or uncached area. */ + void *drv_handle; + /* Handle to the driver that is implementing the mmap call. Ignored for + Kernel-side version. */ +}; + +/* + * Structure containing information required for unmapping a + * memory region. + */ +struct platform_mem_unmap_info { + u32 addr; + /* Address to be unmapped.*/ + u32 size; + /* Size of memory region to be unmapped.*/ + bool is_cached; + /* Whether the mapping is to a cached area or uncached area. */ +}; + +/* + * Structure containing information required for mapping a + * memory region. + */ +#define memory_map_info struct platform_mem_map_info + +/* + * Structure containing information required for unmapping a + * memory region. + */ +#define memory_unmap_info struct platform_mem_unmap_info + + +/* ============================================================================= + * APIs + * ============================================================================= + */ +/* Initialize the platform mem module. */ +int platform_mem_setup(void); + +/* Finalize the platform mem module. */ +int platform_mem_destroy(void); + +/* Maps a memory area into virtual space. */ +int platform_mem_map(memory_map_info *map_info); + +/* Unmaps a memory area into virtual space. */ +int platform_mem_unmap(memory_unmap_info *unmap_info); + +/* Translate API */ +void *platform_mem_translate(void *srcAddr, enum memory_xlt_flags flags); + +#endif /* ifndef _PLATFORM_MEM_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/procmgr.h b/arch/arm/plat-omap/include/syslink/procmgr.h new file mode 100644 index 00000000000..5e538658a06 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/procmgr.h @@ -0,0 +1,244 @@ +/* + * procmgr.h + * + * Syslink driver support functions for TI OMAP processors. + * + * Copyright (C) 2009-2010 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 SYSLINK_PROC_MGR_H +#define SYSLINK_PROC_MGR_H + +#include <linux/types.h> +#include <syslink/multiproc.h> + + + +#define PROCMGR_MODULEID 0xf2ba + +/* + * Maximum name length for ProcMgr module strings. + */ +#define PROCMGR_MAX_STRLEN 32 + +/* + * Maximum number of memory regions supported by ProcMgr module. + */ +#define PROCMGR_MAX_MEMORY_REGIONS 32 + +/* + * IS_VALID_PROCID + * Checks if the Processor ID is valid + */ +#define IS_VALID_PROCID(id) (id < MULTIPROC_MAXPROCESSORS) + + +/* + * Enumerations to indicate Processor states. + */ +enum proc_mgr_state { + PROC_MGR_STATE_UNKNOWN = 0, + /* Unknown Processor state (e.g. at startup or error). */ + PROC_MGR_STATE_POWERED = 1, + /* Indicates the Processor is powered up. */ + PROC_MGR_STATE_RESET = 2, + /* Indicates the Processor is reset. */ + PROC_MGR_STATE_LOADED = 3, + /* Indicates the Processor is loaded. */ + PROC_MGR_STATE_RUNNNING = 4, + /* Indicates the Processor is running. */ + PROC_MGR_STATE_UNAVAILABLE = 5, + /* Indicates the Processor is unavailable to the physical transport. */ + PROC_MGR_STATE_ENDVALUE = 6 + /* End delimiter indicating start of invalid values for this enum */ +}; + +/* + * Enumerations to indicate different types of slave boot modes. + */ +enum proc_mgr_boot_mode { + PROC_MGR_BOOTMODE_BOOT = 0, + /* ProcMgr is responsible for loading the slave and its reset control */ + PROC_MGR_BOOTMODE_NOLOAD = 1, + /* ProcMgr is not responsible for loading the slave. It is responsible + for reset control of the slave. */ + PROC_MGR_BOOTMODE_NOBOOT = 2, + /* ProcMgr is not responsible for loading or reset control of the slave. + The slave either self-boots, or this is done by some entity outside of + the ProcMgr module. */ + PROC_MGR_BOOTMODE_ENDVALUE = 3 + /* End delimiter indicating start of invalid values for this enum */ +} ; + +/* + * Enumerations to indicate address types used for translation + */ +enum proc_mgr_addr_type{ + PROC_MGR_ADDRTYPE_MASTERKNLVIRT = 0, + /* Kernel Virtual address on master processor */ + PROC_MGR_ADDRTYPE_MASTERUSRVIRT = 1, + /* User Virtual address on master processor */ + PROC_MGR_ADDRTYPE_SLAVEVIRT = 2, + /* Virtual address on slave processor */ + PROC_MGR_ADDRTYPE_ENDVALUE = 3 + /* End delimiter indicating start of invalid values for this enum */ +}; + +/* + * Enumerations to indicate types of address mapping + */ +enum proc_mgr_map_type { + PROC_MGR_MAPTYPE_VIRT = 0, + /* Map/unmap to virtual address space (kernel/user) */ + PROC_MGR_MAPTYPE_SLAVE = 1, + /* Map/unmap to slave address space */ + PROC_MGR_MAPTYPE_ENDVALUE = 2 + /* End delimiter indicating start of invalid values for this enum */ +}; + +/* + * Module configuration structure. + */ +struct proc_mgr_config { + void *gate_handle; +} ; + +/* + * Configuration parameters specific to the slave ProcMgr instance. + */ +struct proc_mgr_params { + void *proc_handle; + /* void * to the Processor object associated with this ProcMgr. */ + void *loader_handle; + /*!< Handle to the Loader object associated with this ProcMgr. */ + void *pwr_handle; + /*!< Handle to the PwrMgr object associated with this ProcMgr. */ +}; + +/* + * Configuration parameters specific to the slave ProcMgr instance. + */ +struct proc_mgr_attach_params { + enum proc_mgr_boot_mode boot_mode; + /* Boot mode for the slave processor. */ +} ; + + +/* + * This structure defines information about memory regions mapped by + * the ProcMgr module. + */ +struct proc_mgr_addr_info { +/* bool is_init; */ + unsigned short is_init; + /* Is this memory region initialized? */ + u32 addr[PROC_MGR_ADDRTYPE_ENDVALUE]; + /* Addresses for each type of address space */ + u32 size; + /* Size of the memory region in bytes */ +}; + +/* + * Characteristics of the slave processor + */ +struct proc_mgr_proc_info { + enum proc_mgr_boot_mode boot_mode; + /* Boot mode of the processor. */ + u16 num_mem_entries; + /* Number of valid memory entries */ + struct proc_mgr_addr_info mem_entries[PROCMGR_MAX_MEMORY_REGIONS]; + /* Configuration of memory regions */ +}; + + +/* + * Function pointer type that is passed to the proc_mgr_registerNotify function +*/ +typedef int (*proc_mgr_callback_fxn)(u16 proc_id, void *handle, + enum proc_mgr_state from_state, enum proc_mgr_state to_state); + +/* Function to get the default configuration for the ProcMgr module. */ +void proc_mgr_get_config(struct proc_mgr_config *cfg); + +/* Function to setup the ProcMgr module. */ +int proc_mgr_setup(struct proc_mgr_config *cfg); + +/* Function to destroy the ProcMgr module. */ +int proc_mgr_destroy(void); + +/* Function to initialize the parameters for the ProcMgr instance. */ +void proc_mgr_params_init(void *handle, struct proc_mgr_params *params); + +/* Function to create a ProcMgr object for a specific slave processor. */ +void *proc_mgr_create(u16 proc_id, const struct proc_mgr_params *params); + +/* Function to delete a ProcMgr object for a specific slave processor. */ +int proc_mgr_delete(void **handle_ptr); + +/* Function to open a handle to an existing ProcMgr object handling the + * proc_id. + */ +int proc_mgr_open(void **handle, u16 proc_id); + +/* Function to close this handle to the ProcMgr instance. */ +int proc_mgr_close(void *handle); + +/* Function to initialize the parameters for the ProcMgr attach function. */ +void proc_mgr_get_attach_params(void *handle, + struct proc_mgr_attach_params *params); + +/* Function to attach the client to the specified slave and also initialize the + * slave(if required). + */ +int proc_mgr_attach(void *handle, struct proc_mgr_attach_params *params); + +/* Function to detach the client from the specified slave and also finalze the + * slave(if required). + */ +int proc_mgr_detach(void *handle); + +/* Function to get the current state of the slave Processor as maintained on + * the master Processor state machine. + */ +enum proc_mgr_state proc_mgr_get_state(void *handle); + +/* Function to read from the slave Processor's memory space. */ +int proc_mgr_read(void *handle, u32 proc_addr, u32 *num_bytes, + void *buffer); + +/* Function to read from the slave Processor's memory space. */ +int proc_mgr_write(void *handle, u32 proc_addr, u32 *num_bytes, void *buffer); + +/* Function that provides a hook for performing device dependent operations on + * the slave Processor. + */ +int proc_mgr_control(void *handle, int cmd, void *arg); + +int proc_mgr_translate_addr(void *handle, void **dst_addr, + enum proc_mgr_addr_type dst_addr_type, void *src_addr, + enum proc_mgr_addr_type src_addr_type); + +/* Function that registers for notification when the slave processor + * transitions to any of the states specified. + */ +int proc_mgr_register_notify(void *handle, proc_mgr_callback_fxn fxn, + void *args, enum proc_mgr_state state[]); + +/* Function that returns information about the characteristics of the slave + * processor. + */ +int proc_mgr_get_proc_info(void *handle, struct proc_mgr_proc_info *proc_info); + +/* Function that returns virtual to physical translations + */ +int proc_mgr_virt_to_phys(void *handle, u32 da, u32 *mapped_entries, + u32 num_of_entries); + +#endif diff --git a/arch/arm/plat-omap/include/syslink/sharedregion.h b/arch/arm/plat-omap/include/syslink/sharedregion.h new file mode 100644 index 00000000000..ca644e7ebcd --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/sharedregion.h @@ -0,0 +1,244 @@ +/* + * sharedregion.h + * + * The SharedRegion module is designed to be used in a + * multi-processor environment where there are memory regions + * that are shared and accessed across different processors + * + * Copyright (C) 2008-2010 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 _SHAREDREGION_H_ +#define _SHAREDREGION_H_ + +#include <linux/types.h> +#include <heapmemmp.h> + +/* + * SHAREDREGION_MODULEID + * Module ID for Shared region manager + */ +#define SHAREDREGION_MODULEID (0x5D8A) + +/* + * Name of the reserved nameserver used for application + */ +#define SHAREDREGION_NAMESERVER "SHAREDREGION" + +/* + * Name of the reserved nameserver used for application + */ +#define SHAREDREGION_INVALIDREGIONID ((u16)(~0)) + +/*! + * @def SharedRegion_DEFAULTOWNERID + * @brief Default owner processor id + */ +#define SHAREDREGION_DEFAULTOWNERID ((u16)(~0)) + +/* + * Name of the reserved nameserver used for application + */ +#define SHAREDREGION_INVALIDSRPTR ((u32 *)(~0)) + + +struct sharedregion_entry { + /* The base address of the region */ + void *base; + /* The length of the region */ + uint len; + /* The MultiProc id of the owner of the region */ + u16 owner_proc_id; + /* Whether the region is valid */ + bool is_valid; + /* Whether to perform cache operations for the region */ + bool cache_enable; + /* The cache line size of the region */ + uint cache_line_size; + /* Whether a heap is created for the region */ + bool create_heap; + /* The name of the region */ + char *name; +}; + +/* + * Module configuration structure + */ +struct sharedregion_config { + uint cache_line_size; + /* + * Worst-case cache line size + * + * This is the default system cache line size for all modules. + * When a module puts structures in shared memory, this value is + * used to make sure items are aligned on a cache line boundary. + * If no cacheLineSize is specified for a region, it will use this + * value. + */ + + u16 num_entries; + /* + * The number of shared region table entries. + * + * This value is used for calculating the number of bits for the offset. + * Note: This value must be the same across all processors in the + * system. Increasing this parameter will increase the footprint + * and the time for translating a pointer to a SRPtr. + */ + + bool translate; + /* + * This configuration parameter should be set to 'true' + * if and only if all shared memory regions are the same + * for all processors. If 'true', it results in a fast + * getPtr and getSRPtr. + */ +}; + +/* + * Information stored on a per region basis + */ +struct sharedregion_region { + struct sharedregion_entry entry; + uint reserved_size; + struct heapmemmp_object *heap; +}; + + +/* + * Function to get the configuration + */ +int sharedregion_get_config(struct sharedregion_config *config); + +/* + * Function to setup the SharedRegion module + */ +int sharedregion_setup(const struct sharedregion_config *config); + +/* + * Function to destroy the SharedRegion module + */ +int sharedregion_destroy(void); + +/* + * Creates a heap by owner of region for each SharedRegion. + * Function is called by ipc_start(). Requires that SharedRegion 0 + * be valid before calling start(). + */ +int sharedregion_start(void); + +/* + * Function to stop Shared Region 0 + */ +int sharedregion_stop(void); + +/* + * Opens a heap, for non-owner processors, for each SharedRegion. + */ +int sharedregion_attach(u16 remote_proc_id); + +/* + * Closes a heap, for non-owner processors, for each SharedRegion. + */ +int sharedregion_detach(u16 remote_proc_id); + +/* + * Reserve shared region memory + */ +void *sharedregion_reserve_memory(u16 id, u32 size); + +/* + * Reserve shared region memory + */ +void sharedregion_unreserve_memory(u16 id, u32 size); + +/* + * Sets the entry at the specified region id(doesn't create heap) + */ +int _sharedregion_set_entry(u16 region_id, struct sharedregion_entry *entry); + +/* + * Function to clear the reserved memory + */ +void sharedregion_clear_reserved_memory(void); + +/* + * Return the region info + */ +void sharedregion_get_region_info(u16 i, struct sharedregion_region *region); + +/* + * Clears the entry at the specified region id + */ +int sharedregion_clear_entry(u16 region_id); + +/* + * Initializes the entry fields + */ +void sharedregion_entry_init(struct sharedregion_entry *entry); + +/* + * Gets the cache line size for the specified region id + */ +uint sharedregion_get_cache_line_size(u16 region_id); + +/* + * Gets the entry information for the specified region id + */ +int sharedregion_get_entry(u16 region_id, struct sharedregion_entry *entry); + +/* + * Gets the heap associated with the specified region id + */ +void *sharedregion_get_heap(u16 region_id); + +/* + * Gets the region id for the specified address + */ +u16 sharedregion_get_id(void *addr); + +/* + * Gets the id of a region, given the name + */ +u16 sharedregion_get_id_by_name(char *name); + +/* + * Gets the number of regions + */ +u16 sharedregion_get_num_regions(void); + +/* + * Returns the address pointer associated with the shared region pointer + */ +void *sharedregion_get_ptr(u32 *srptr); + +/* + * Returns the shared region pointer + */ +u32 *sharedregion_get_srptr(void *addr, u16 index); + +/* + * whether cache enable was specified + */ +bool sharedregion_is_cache_enabled(u16 region_id); + +/* + * Sets the entry at the specified region id + */ +int sharedregion_set_entry(u16 region_id, struct sharedregion_entry *entry); + +/* + * Whether address translation is enabled + */ +bool sharedregion_translate_enabled(void); + +#endif /* _SHAREDREGION_H */ diff --git a/arch/arm/plat-omap/include/syslink/sharedregion_ioctl.h b/arch/arm/plat-omap/include/syslink/sharedregion_ioctl.h new file mode 100644 index 00000000000..adff03f0434 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/sharedregion_ioctl.h @@ -0,0 +1,189 @@ +/* + * sharedregion_ioctl.h + * + * The sharedregion module is designed to be used in a + * multi-processor environment where there are memory regions + * that are shared and accessed across different processors + * + * Copyright (C) 2008-2010 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 _SHAREDREGION_IOCTL_H +#define _SHAREDREGION_IOCTL_H + +#include <linux/ioctl.h> +#include <linux/types.h> + +#include <ipc_ioctl.h> +#include <sharedregion.h> + +enum CMD_SHAREDREGION { + SHAREDREGION_GETCONFIG = SHAREDREGION_BASE_CMD, + SHAREDREGION_SETUP, + SHAREDREGION_DESTROY, + SHAREDREGION_START, + SHAREDREGION_STOP, + SHAREDREGION_ATTACH, + SHAREDREGION_DETACH, + SHAREDREGION_GETHEAP, + SHAREDREGION_CLEARENTRY, + SHAREDREGION_SETENTRY, + SHAREDREGION_RESERVEMEMORY, + SHAREDREGION_CLEARRESERVEDMEMORY, + SHAREDREGION_GETREGIONINFO +}; + +/* + * IOCTL command IDs for sharedregion + * + */ + +/* + * Command for sharedregion_get_config + */ +#define CMD_SHAREDREGION_GETCONFIG _IOWR(IPC_IOC_MAGIC, \ + SHAREDREGION_GETCONFIG, \ + struct sharedregion_cmd_args) +/* + * Command for sharedregion_setup + */ +#define CMD_SHAREDREGION_SETUP _IOWR(IPC_IOC_MAGIC, \ + SHAREDREGION_SETUP, \ + struct sharedregion_cmd_args) +/* + * Command for sharedregion_setup + */ +#define CMD_SHAREDREGION_DESTROY _IOWR(IPC_IOC_MAGIC, \ + SHAREDREGION_DESTROY, \ + struct sharedregion_cmd_args) +/* + * Command for sharedregion_start + */ +#define CMD_SHAREDREGION_START _IOWR(IPC_IOC_MAGIC, \ + SHAREDREGION_START, \ + struct sharedregion_cmd_args) +/* + * Command for sharedregion_stop + */ +#define CMD_SHAREDREGION_STOP _IOWR(IPC_IOC_MAGIC, \ + SHAREDREGION_STOP, \ + struct sharedregion_cmd_args) +/* + * Command for sharedregion_attach + */ +#define CMD_SHAREDREGION_ATTACH _IOWR(IPC_IOC_MAGIC, \ + SHAREDREGION_ATTACH, \ + struct sharedregion_cmd_args) +/* + * Command for sharedregion_detach + */ +#define CMD_SHAREDREGION_DETACH _IOWR(IPC_IOC_MAGIC, \ + SHAREDREGION_DETACH, \ + struct sharedregion_cmd_args) +/* + * Command for sharedregion_get_heap + */ +#define CMD_SHAREDREGION_GETHEAP _IOWR(IPC_IOC_MAGIC, \ + SHAREDREGION_GETHEAP, \ + struct sharedregion_cmd_args) +/* + * Command for sharedregion_clear_entry + */ +#define CMD_SHAREDREGION_CLEARENTRY _IOWR(IPC_IOC_MAGIC, \ + SHAREDREGION_CLEARENTRY, \ + struct sharedregion_cmd_args) +/* + * Command for sharedregion_set_entry + */ +#define CMD_SHAREDREGION_SETENTRY _IOWR(IPC_IOC_MAGIC, \ + SHAREDREGION_SETENTRY, \ + struct sharedregion_cmd_args) +/* + * Command for sharedregion_reserve_memory + */ +#define CMD_SHAREDREGION_RESERVEMEMORY _IOWR(IPC_IOC_MAGIC, \ + SHAREDREGION_RESERVEMEMORY, \ + struct sharedregion_cmd_args) +/* + * Command for sharedregion_clear_reserved_memory + */ +#define CMD_SHAREDREGION_CLEARRESERVEDMEMORY \ + _IOWR(IPC_IOC_MAGIC, \ + SHAREDREGION_CLEARRESERVEDMEMORY, \ + struct sharedregion_cmd_args) +/* + * Command for sharedregion_get_region_info + */ +#define CMD_SHAREDREGION_GETREGIONINFO _IOWR(IPC_IOC_MAGIC, \ + SHAREDREGION_GETREGIONINFO, \ + struct sharedregion_cmd_args) + +/* + * Command arguments for sharedregion + */ +union sharedregion_arg { + struct { + struct sharedregion_config *config; + } get_config; + + struct { + struct sharedregion_region *regions; + struct sharedregion_config *config; + } setup; + + struct { + struct sharedregion_region *regions; + } get_region_info; + + struct { + u16 remote_proc_id; + } attach; + + struct { + u16 remote_proc_id; + } detach; + + struct { + u16 id; + void *heap_handle; + } get_heap; + + struct { + u16 id; + struct sharedregion_entry entry; + } set_entry; + + struct { + u16 id; + } clear_entry; + + struct { + u16 id; + u32 size; + } reserve_memory; +}; + +/* + * Command arguments for sharedregion + */ +struct sharedregion_cmd_args { + union sharedregion_arg args; + s32 api_status; +}; + +/* + * This ioctl interface for sharedregion module + */ +int sharedregion_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long args, bool user); + +#endif /* _SHAREDREGION_IOCTL_H */ diff --git a/arch/arm/plat-omap/include/syslink/sysipc_ioctl.h b/arch/arm/plat-omap/include/syslink/sysipc_ioctl.h new file mode 100644 index 00000000000..d6f4428e716 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/sysipc_ioctl.h @@ -0,0 +1,118 @@ +/* + * sysipc_ioctl.h + * + * Definitions of sysmgr 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 _SYSIPC_IOCTL_H_ +#define _SYSIPC_IOCTL_H_ + +/* Standard headers */ +#include <linux/types.h> + +/* Syslink headers */ +#include <ipc_ioctl.h> +#include <ipc.h> + + +/* ============================================================================= + * Macros and types + * ============================================================================= + */ +/* ---------------------------------------------------------------------------- + * IOCTL command IDs for sysmgr + * ---------------------------------------------------------------------------- + */ +/* IOC Magic Number for sysmgr */ +#define SYSIPC_IOC_MAGIC IPC_IOC_MAGIC + +/* IOCTL command numbers for ipc/sysipc */ +enum sysipc_drv_cmd { + IPC_SETUP = IPC_BASE_CMD, + IPC_DESTROY, + IPC_CONTROL, + IPC_READCONFIG, + IPC_WRITECONFIG + }; + +/* Command for ipc_setup */ +#define CMD_IPC_SETUP \ + _IOWR(SYSIPC_IOC_MAGIC, IPC_SETUP, \ + struct sysipc_cmd_args) + +/* Command for ipc_destroy */ +#define CMD_IPC_DESTROY \ + _IOWR(SYSIPC_IOC_MAGIC, IPC_DESTROY, \ + struct sysipc_cmd_args) + +/* Command for load callback */ +#define CMD_IPC_CONTROL \ + _IOWR(SYSIPC_IOC_MAGIC, IPC_CONTROL, \ + struct sysipc_cmd_args) + +/* Command for ipc_read_config */ +#define CMD_IPC_READCONFIG \ + _IOWR(SYSIPC_IOC_MAGIC, IPC_READCONFIG, \ + struct sysipc_cmd_args) + +/* Command for ipc_write_config */ +#define CMD_IPC_WRITECONFIG \ + _IOWR(SYSIPC_IOC_MAGIC, IPC_WRITECONFIG, \ + struct sysipc_cmd_args) + + +/* ---------------------------------------------------------------------------- + * Command arguments for sysmgr + * ---------------------------------------------------------------------------- + */ +/* Command arguments for sysmgr */ +struct sysipc_cmd_args { + union { + struct { + u16 proc_id; + s32 cmd_id; + void *arg; + } control; + + struct { + u16 remote_proc_id; + u32 tag; + void *cfg; + u32 size; + } read_config; + + struct { + u16 remote_proc_id; + u32 tag; + void *cfg; + u32 size; + } write_config; + + struct { + struct ipc_config *config; + } setup; + } args; + + s32 api_status; +}; + +/* ---------------------------------------------------------------------------- + * IOCTL functions for sysmgr module + * ---------------------------------------------------------------------------- + */ +/* ioctl interface function for sysmgr */ +int sysipc_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long args, bool user); + +#endif /* _SYSIPC_IOCTL_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/sysmemmgr.h b/arch/arm/plat-omap/include/syslink/sysmemmgr.h new file mode 100644 index 00000000000..34c3b418228 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/sysmemmgr.h @@ -0,0 +1,179 @@ +/* + * sysmemmgr.h + * + * Manager for the Slave system memory. Slave system level memory is allocated + * through this module. + * + * Copyright (C) 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 _SYSTEMMEMORYMANAGER_H_ +#define _SYSTEMMEMORYMANAGER_H_ + + +/*! + * @def SYSMEMMGR_MODULEID + * @brief Module identifier for System memory manager. + */ +#define SYSMEMMGR_MODULEID (0xb53d) + +/*! + * @def SYSMEMMGR_STATUSCODEBASE + * @brief Error code base for system memory manager module. + */ +#define SYSMEMMGR_STATUSCODEBASE (SYSMEMMGR_MODULEID << 12u) + +/*! + * @def SYSMEMMGR_MAKE_ERROR + * @brief Macro to make error code. + */ +#define SYSMEMMGR_MAKE_ERROR(x) ((int)(0x80000000 + \ + (SYSMEMMGR_STATUSCODEBASE + \ + (x)))) + +/*! + * @def SYSMEMMGR_MAKE_SUCCESS + * @brief Macro to make success code. + */ +#define SYSMEMMGR_MAKE_SUCCESS(x) (SYSMEMMGR_STATUSCODEBASE + (x)) + +/*! + * @def SYSMEMMGR_E_CREATEALLOCATOR + * @brief Static allocator creation failed. + */ +#define SYSMEMMGR_E_CREATEALLOCATOR SYSMEMMGR_MAKE_ERROR(1) + +/*! + * @def SYSMEMMGR_E_CREATELOCK + * @brief Mutex lock creation failed. + */ +#define SYSMEMMGR_E_CREATELOCK SYSMEMMGR_MAKE_ERROR(2) + +/*! + * @def SYSMEMMGR_E_INVALIDSTATE + * @brief Module is not initialized. + */ +#define SYSMEMMGR_E_INVALIDSTATE SYSMEMMGR_MAKE_ERROR(3) + +/*! + * @def SYSMEMMGR_E_INVALIDARG + * @brief Argument passed to a function is invalid. + */ +#define SYSMEMMGR_E_INVALIDARG SYSMEMMGR_MAKE_ERROR(4) + +/*! + * @def SYSMEMMGR_E_BPAFREE + * @brief Freeing to buddy allocator failed. + */ +#define SYSMEMMGR_E_BPAFREE SYSMEMMGR_MAKE_ERROR(5) + +/*! + * @def SYSMEMMGR_E_MEMORY + * @brief Memory allocation failed. + */ +#define SYSMEMMGR_E_MEMORY SYSMEMMGR_MAKE_ERROR(6) + +/*! + * @def SYSMEMMGR_SUCCESS + * @brief Operation successful. + */ +#define SYSMEMMGR_SUCCESS SYSMEMMGR_MAKE_SUCCESS(0) + +/*! + * @def SYSMEMMGR_S_ALREADYSETUP + * @brief Module already initialized. + */ +#define SYSMEMMGR_S_ALREADYSETUP SYSMEMMGR_MAKE_SUCCESS(1) + +/*! + * @def SYSMEMMGR_S_DRVALREADYOPENED + * @brief Internal OS Driver is already opened. + */ +#define SYSMEMMGR_S_DRVALREADYOPENED SYSMEMMGR_MAKE_SUCCESS(2) + +/*! + * @brief Configuration data structure of system memory manager. + */ +struct sysmemmgr_config { + u32 sizeof_valloc; + /* Total size for virtual memory allocation */ + u32 sizeof_palloc; + /* Total size for physical memory allocation */ + u32 static_phys_base_addr; + /* Physical address of static memory region */ + u32 static_virt_base_addr; + /* Virtual address of static memory region */ + u32 static_mem_size; + /* size of static memory region */ + u32 page_size; + /* Page size */ + u32 event_no; + /* Event number to be used */ +}; + +/*! + * @brief Flag used for allocating memory blocks. + */ +enum sysmemmgr_allocflag { + sysmemmgr_allocflag_uncached = 0u, + /* Flag used for allocating uncacheable block */ + sysmemmgr_allocflag_cached = 1u, + /* Flag used for allocating cacheable block */ + sysmemmgr_allocflag_physical = 2u, + /* Flag used for allocating physically contiguous block */ + sysmemmgr_allocflag_virtual = 3u, + /* Flag used for allocating virtually contiguous block */ + sysmemmgr_allocflag_dma = 4u + /* Flag used for allocating DMAable (physically contiguous) block */ +}; + +/*! + * @brief Flag used for translating address. + */ +enum sysmemmgr_xltflag { + sysmemmgr_xltflag_kvirt2phys = 0x0001u, + /* Flag used for converting Kernel virtual address to physical + * address */ + sysmemmgr_xltflag_kvirt2uvirt = 0x0002u, + /* Flag used for converting Kernel virtual address to user virtual + * address */ + sysmemmgr_xltflag_uvirt2phys = 0x0003u, + /* Flag used for converting user virtual address to physical address */ + sysmemmgr_xltflag_uvirt2kvirt = 0x0004u, + /* Flag used for converting user virtual address to Kernel virtual + * address */ + sysmemmgr_xltflag_phys2kvirt = 0x0005u, + /* Flag used for converting physical address to user virtual address */ + sysmemmgr_xltflag_phys2uvirt = 0x0006u + /* Flag used for converting physical address to Kernel virtual + * address */ +}; + + +/* Function prototypes */ +void sysmemmgr_get_config(struct sysmemmgr_config *config); + +int sysmemmgr_setup(struct sysmemmgr_config *params); + +int sysmemmgr_destroy(void); + +int sysmemmgr_attach(u16 slave_id); + +void *sysmemmgr_alloc(u32 size, enum sysmemmgr_allocflag flag); + +int sysmemmgr_free(void *blk, u32 size, enum sysmemmgr_allocflag flag); + +void *sysmemmgr_translate(void *srcAddr, enum sysmemmgr_xltflag flag); + + +#endif /* _SYSTEMMEMORYMANAGER_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/sysmemmgr_ioctl.h b/arch/arm/plat-omap/include/syslink/sysmemmgr_ioctl.h new file mode 100644 index 00000000000..4b0d9961556 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/sysmemmgr_ioctl.h @@ -0,0 +1,130 @@ +/* + * sysmemmgr_ioctl.h + * + * Definitions of sysmemmgr 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 _SYSMEMMGR_IOCTL_H_ +#define _SYSMEMMGR_IOCTL_H_ + +/* Standard headers */ +#include <linux/types.h> + +/* Syslink headers */ +#include <ipc_ioctl.h> +#include <sysmgr.h> + + +/* ============================================================================= + * Macros and types + * ============================================================================= + */ +/* ---------------------------------------------------------------------------- + * IOCTL command IDs for sysmemmgr + * ---------------------------------------------------------------------------- + */ +/* IOC Magic Number for sysmemmgr */ +#define SYSMEMMGR_IOC_MAGIC IPC_IOC_MAGIC + +/* IOCTL command numbers for sysmemmgr */ +enum sysmemmgr_drv_cmd { + SYSMEMMGR_GETCONFIG = SYSMEMMGR_BASE_CMD, + SYSMEMMGR_SETUP, + SYSMEMMGR_DESTROY, + SYSMEMMGR_ALLOC, + SYSMEMMGR_FREE, + SYSMEMMGR_TRANSLATE +}; + +/* Command for sysmemmgr_getConfig */ +#define CMD_SYSMEMMGR_GETCONFIG \ + _IOWR(SYSMEMMGR_IOC_MAGIC, SYSMEMMGR_GETCONFIG, \ + struct sysmemmgr_cmd_args) + +/* Command for sysmemmgr_setup */ +#define CMD_SYSMEMMGR_SETUP \ + _IOWR(SYSMEMMGR_IOC_MAGIC, SYSMEMMGR_SETUP, \ + struct sysmemmgr_cmd_args) + +/* Command for sysmemmgr_destroy */ +#define CMD_SYSMEMMGR_DESTROY \ + _IOWR(SYSMEMMGR_IOC_MAGIC, SYSMEMMGR_DESTROY, \ + struct sysmemmgr_cmd_args) + +/* Command for sysmemmgr_alloc */ +#define CMD_SYSMEMMGR_ALLOC \ + _IOWR(SYSMEMMGR_IOC_MAGIC, SYSMEMMGR_ALLOC, \ + struct sysmemmgr_cmd_args) + +/* Command for sysmemmgr_free */ +#define CMD_SYSMEMMGR_FREE \ + _IOWR(SYSMEMMGR_IOC_MAGIC, SYSMEMMGR_FREE, \ + struct sysmemmgr_cmd_args) + +/* Command for sysmemmgr_translate */ +#define CMD_SYSMEMMGR_TRANSLATE \ + _IOWR(SYSMEMMGR_IOC_MAGIC, SYSMEMMGR_TRANSLATE, \ + struct sysmemmgr_cmd_args) + + +/* ---------------------------------------------------------------------------- + * Command arguments for sysmemmgr + * ---------------------------------------------------------------------------- + */ +/* Command arguments for sysmemmgr */ +struct sysmemmgr_cmd_args { + union { + struct { + struct sysmemmgr_config *config; + } get_config; + + struct { + struct sysmemmgr_config *config; + } setup; + + struct { + u32 size; + void *buf; + void *phys; + void *kbuf; + enum sysmemmgr_allocflag flags; + } alloc; + + struct { + u32 size; + void *buf; + void *phys; + void *kbuf; + enum sysmemmgr_allocflag flags; + } free; + + struct { + void *buf; + void *ret_ptr; + enum sysmemmgr_xltflag flags; + } translate; + } args; + + s32 api_status; +}; + +/* ---------------------------------------------------------------------------- + * IOCTL functions for sysmemmgr module + * ---------------------------------------------------------------------------- + */ +/* ioctl interface function for sysmemmgr */ +int sysmemmgr_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long args); + +#endif /* SYSMEMMGR_DRVDEFS_H_0xF414 */ diff --git a/arch/arm/plat-omap/include/syslink/sysmgr.h b/arch/arm/plat-omap/include/syslink/sysmgr.h new file mode 100644 index 00000000000..19fab220b2c --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/sysmgr.h @@ -0,0 +1,182 @@ +/* + * sysmgr.h + * + * Defines for System manager. + * + * Copyright (C) 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 _SYSMGR_H_ +#define _SYSMGR_H_ + + +/* Module headers */ +#include <multiproc.h> +#include <gatepeterson.h> +#include <sharedregion.h> +#include <listmp.h> +#include <listmp_sharedmemory.h> +#include <messageq.h> +#include <messageq_transportshm.h> +#include <notify.h> +#include <notify_ducatidriver.h> +#include <nameserver.h> +#include <nameserver_remote.h> +#include <nameserver_remotenotify.h> +#include <procmgr.h> +#include <heap.h> +#include <heapbuf.h> +#include <sysmemmgr.h> + + +/*! + * @def SYSMGR_MODULEID + * @brief Unique module ID. + */ +#define SYSMGR_MODULEID (0xF086) + + +/* ============================================================================= + * Module Success and Failure codes + * ============================================================================= + */ +/*! + * @def SYSMGR_STATUSCODEBASE + * @brief Error code base for System manager. + */ +#define SYSMGR_STATUSCODEBASE (SYSMGR_MODULEID << 12u) + +/*! + * @def SYSMGR_MAKE_FAILURE + * @brief Macro to make error code. + */ +#define SYSMGR_MAKE_FAILURE(x) ((s32)(0x80000000 + \ + (SYSMGR_STATUSCODEBASE + \ + (x)))) + +/*! + * @def SYSMGR_MAKE_SUCCESS + * @brief Macro to make success code. + */ +#define SYSMGR_MAKE_SUCCESS(x) (SYSMGR_STATUSCODEBASE + (x)) + +/*! + * @def SYSMGR_E_INVALIDARG + * @brief Argument passed to a function is invalid. + */ +#define SYSMGR_E_INVALIDARG SYSMGR_MAKE_FAILURE(1) + +/*! + * @def SYSMGR_E_MEMORY + * @brief Memory allocation failed. + */ +#define SYSMGR_E_MEMORY SYSMGR_MAKE_FAILURE(2) + +/*! + * @def SYSMGR_E_FAIL + * @brief General failure. + */ +#define SYSMGR_E_FAIL SYSMGR_MAKE_FAILURE(3) + +/*! + * @def SYSMGR_E_INVALIDSTATE + * @brief Module is in invalid state. + */ +#define SYSMGR_E_INVALIDSTATE SYSMGR_MAKE_FAILURE(4) + +/*! + * @def SYSMGR_E_OSFAILURE + * @brief Failure in OS call. + */ +#define SYSMGR_E_OSFAILURE SYSMGR_MAKE_FAILURE(5) + +/*! + * @def SYSMGR_S_ALREADYSETUP + * @brief Module is already initialized. + */ +#define SYSMGR_S_ALREADYSETUP SYSMGR_MAKE_SUCCESS(1) + +/*! + * @def SYSMGR_CMD_SCALABILITY + * @brief Command ID for scalability info. + */ +#define SYSMGR_CMD_SCALABILITY (0x00000000) + +/*! + * @def SYSMGR_CMD_SHAREDREGION_ENTRY_BASE + * @brief Base of command IDs for entries used by Shared region. + */ +#define SYSMGR_CMD_SHAREDREGION_ENTRY_START (0x00000001) +#define SYSMGR_CMD_SHAREDREGION_ENTRY_END (0x00001000) + + +/* ============================================================================= + * Structures & Enums + * ============================================================================= + */ +/*! + * @brief Structure defining config parameters for overall System. + */ +struct sysmgr_config { + struct sysmemmgr_config sysmemmgr_cfg; + /*!< System memory manager config parameter */ + + struct multiproc_config multiproc_cfg; + /*!< Multiproc config parameter */ + + struct gatepeterson_config gatepeterson_cfg; + /*!< Gatepeterson config parameter */ + + struct sharedregion_config sharedregion_cfg; + /*!< SharedRegion config parameter */ + + struct messageq_config messageq_cfg; + /*!< MessageQ config parameter */ + + struct notify_config notify_cfg; + /*!< Notify config parameter */ + + struct proc_mgr_config proc_mgr_cfg; + /*!< Processor manager config parameter */ + + struct heapbuf_config heapbuf_cfg; + /*!< Heap Buf config parameter */ + + struct listmp_config listmp_sharedmemory_cfg; + /*!< ListMPSharedMemory config parameter */ + + struct messageq_transportshm_config messageq_transportshm_cfg; + /*!< MessageQTransportShm config parameter */ + + struct notify_ducatidrv_config notify_ducatidrv_cfg; + /*!< NotifyDriverShm config parameter */ + + struct nameserver_remotenotify_config nameserver_remotenotify_cfg; + /*!< NameServerRemoteNotify config parameter */ +}; + + +/* ============================================================================= + * APIs + * ============================================================================= + */ +/* Function to initialize the parameter structure */ +void sysmgr_get_config(struct sysmgr_config *config); + +/* Function to initialize sysmgr module */ +s32 sysmgr_setup(const struct sysmgr_config *config); + +/* Function to Finalize sysmgr module */ +s32 sysmgr_destroy(void); + + +#endif /* ifndef SYSMGR_H_0xF086 */ diff --git a/arch/arm/plat-omap/include/syslink/transportshm.h b/arch/arm/plat-omap/include/syslink/transportshm.h new file mode 100644 index 00000000000..02a2b6a80c9 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/transportshm.h @@ -0,0 +1,220 @@ +/* + * transportshm.h + * + * Shared memory based physical transport for + * communication with the remote processor. + * + * This file contains the declarations of types and APIs as part + * of interface of the shared memory transport. + * + * 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 _TRANSPORTSHM_H_ +#define _TRANSPORTSHM_H_ + +/* Standard headers */ +#include <linux/types.h> + +/* Utilities headers */ +#include <linux/list.h> + +/* ============================================================================= + * All success and failure codes for the module + * ============================================================================= + */ +/* Unique module ID. */ +#define TRANSPORTSHM_MODULEID (0x0a7a) + +/* ============================================================================= + * All success and failure codes for the module + * ============================================================================= + */ +/* Error code base for TransportShm. */ +#define TRANSPORTSHM_STATUSCODEBASE (TRANSPORTSHM_MODULEID << 12) + +/* Macro to make error code. */ +#define TRANSPORTSHM_MAKE_FAILURE(x) ((int) (0x80000000 \ + + (TRANSPORTSHM_STATUSCODEBASE \ + + (x)))) + +/* Macro to make success code. */ +#define TRANSPORTSHM_MAKE_SUCCESS(x) (TRANSPORTSHM_STATUSCODEBASE + (x)) + +/* Argument passed to a function is invalid. */ +#define TRANSPORTSHM_E_INVALIDARG TRANSPORTSHM_MAKE_FAILURE(1) + +/* Invalid shared address size */ +#define TRANSPORTSHM_E_INVALIDSIZE TRANSPORTSHM_MAKE_FAILURE(2) + +/* Module is not initialized. */ +#define TRANSPORTSHM_E_INVALIDSTATE TRANSPORTSHM_MAKE_FAILURE(3) + +/* Versions don't match */ +#define TRANSPORTSHM_E_BADVERSION TRANSPORTSHM_MAKE_FAILURE(4) + +/* General Failure */ +#define TRANSPORTSHM_E_FAIL TRANSPORTSHM_MAKE_FAILURE(5) + +/* Memory allocation failed */ +#define TRANSPORTSHM_E_MEMORY TRANSPORTSHM_MAKE_FAILURE(6) + +/* Failure in OS call. */ +#define TRANSPORTSHM_E_OSFAILURE TRANSPORTSHM_MAKE_FAILURE(7) + +/* Invalid handle specified. */ +#define TRANSPORTSHM_E_HANDLE TRANSPORTSHM_MAKE_FAILURE(8) + +/* The specified operation is not supported. */ +#define TRANSPORTSHM_E_NOTSUPPORTED TRANSPORTSHM_MAKE_FAILURE(9) + +/* Operation successful. */ +#define TRANSPORTSHM_SUCCESS TRANSPORTSHM_MAKE_SUCCESS(0) + +/* The MESSAGETRANSPORTSHM module has already been setup in this process. */ +#define TRANSPORTSHM_S_ALREADYSETUP TRANSPORTSHM_MAKE_SUCCESS(1) + + +/* ============================================================================= + * Structures & Enums + * ============================================================================= + */ + +/* + * Structure defining the reason for error function being called + */ +enum transportshm_reason { + TRANSPORTSHM_REASON_FAILEDPUT, + /* Failed to send the message. */ + TRANSPORTSHM_REASON_INTERNALERR, + /* An internal error occurred in the transport */ + TRANSPORTSHM_REASON_PHYSICALERR, + /* An error occurred in the physical link in the transport */ + TRANSPORTSHM_REASON_FAILEDALLOC + /* Failed to allocate a message. */ +}; + +/* + * transport error callback function. + * + * First parameter: Why the error function is being called. + * + * Second parameter: Handle of transport that had the error. NULL denotes + * that it is a system error, not a specific transport. + * + * Third parameter: Pointer to the message. This is only valid for + * #TRANSPORTSHM_REASON_FAILEDPUT. + * + * Fourth parameter: Transport specific information. Refer to individual + * transports for more details. + */ + +/* + * Module configuration structure. + */ +struct transportshm_config { + void (*err_fxn)(enum transportshm_reason reason, + void *handle, + void *msg, + u32 info); + /* Asynchronous error function for the transport module */ +}; + +/* + * Structure defining config parameters for the transport + * instances. + */ +struct transportshm_params { + u32 priority; + /*< Priority of messages supported by this transport */ + void *gate; + /*< Gate used for critical region management of the shared memory */ + void *shared_addr; + /*< Address of the shared memory. The creator must supply the shared + * memory that this will use for maintain shared state information. + */ + u32 notify_event_id; + /*< Notify event number to be used by the transport */ +}; + +/* + * Structure defining Transport status values + */ +enum transportshm_status { + transportshm_status_INIT, + /*< Transport Shm instance has not not completed + * initialization. */ + transportshm_status_UP, + /*< Transport Shm instance is up and functional. */ + transportshm_status_DOWN, + /*< Transport Shm instance is down and not functional. */ + transportshm_status_RESETTING + /*< Transport Shm instance was up at one point and is in + * process of resetting. + */ +}; + + +/* ============================================================================= + * APIs called by applications + * ============================================================================= + */ +/* Function to get the default configuration for the TransportShm + * module. */ +void transportshm_get_config(struct transportshm_config *cfg); + +/* Function to setup the TransportShm module. */ +int transportshm_setup(const struct transportshm_config *cfg); + +/* Function to destroy the TransportShm module. */ +int transportshm_destroy(void); + +/* Get the default parameters for the NotifyShmDriver. */ +void transportshm_params_init(struct transportshm_params *params); + +/* Create an instance of the TransportShm. */ +void *transportshm_create(u16 proc_id, + const struct transportshm_params *params); + +/* Delete an instance of the TransportShm. */ +int transportshm_delete(void **handle_ptr); + +/* Open a created TransportShm instance by address */ +int transportshm_open_by_addr(void *shared_addr, void **handle_ptr); + +/* Close an opened instance */ +int transportshm_close(void **handle_ptr); + +/* Get the shared memory requirements for the TransportShm. */ +u32 transportshm_shared_mem_req(const struct transportshm_params *params); + +/* Set the asynchronous error function for the transport module */ +void transportshm_set_err_fxn(void (*err_fxn)(enum transportshm_reason reason, + void *handle, + void *msg, + u32 info)); + + +/* ============================================================================= + * APIs called internally by TransportShm module. + * ============================================================================= + */ +/* Put msg to remote list */ +int transportshm_put(void *handle, void *msg); + +/* Control Function */ +int transportshm_control(void *handle, u32 cmd, u32 *cmd_arg); + +/* Get current status of the TransportShm */ +enum transportshm_status transportshm_get_status(void *handle); + +#endif /* _TRANSPORTSHM_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/transportshm_setup.h b/arch/arm/plat-omap/include/syslink/transportshm_setup.h new file mode 100644 index 00000000000..99345773dd8 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/transportshm_setup.h @@ -0,0 +1,47 @@ +/* + * transportshm_setup.h + * + * Shared Memory Transport setup layer + * + * This file contains the declarations of types and APIs as part + * of interface of the shared memory transport. + * + * 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 _TRANSPORTSHM_SETUP_H_ +#define _TRANSPORTSHM_SETUP_H_ + +/* Standard headers */ +#include <linux/types.h> + +/* Utilities headers */ +#include <linux/list.h> + +/* ============================================================================= + * APIs called by applications + * ============================================================================= + */ + +/* Function that will be called in messageq_attach */ +int transportshm_setup_attach(u16 remote_proc_id, u32 *shared_addr); + +/* Function that will be called in messageq_detach */ +int transportshm_setup_detach(u16 remote_proc_id); + +/* Function that returns the amount of shared memory required */ +u32 transportshm_setup_shared_mem_req(u32 *shared_addr); + +/* Determines if a transport has been registered to a remote processor */ +bool transportshm_setup_is_registered(u16 remote_proc_id); + +#endif /* _TRANSPORTSHM_SETUP_H_ */ diff --git a/arch/arm/plat-omap/include/syslink/transportshm_setup_proxy.h b/arch/arm/plat-omap/include/syslink/transportshm_setup_proxy.h new file mode 100644 index 00000000000..72eaf400a19 --- /dev/null +++ b/arch/arm/plat-omap/include/syslink/transportshm_setup_proxy.h @@ -0,0 +1,48 @@ +/* + * transportshm_setup_proxy.h + * + * Shared Memory Transport setup layer + * + * This file contains the declarations of types and APIs as part + * of interface of the shared memory transport. + * + * 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 _TRANSPORTSHM_SETUP_PROXY_H_ +#define _TRANSPORTSHM_SETUP_PROXY_H_ + +/* Module headers */ +#include <transportshm_setup.h> + +/* ============================================================================= + * APIs + * ============================================================================= + */ +/* function that will be called in messageq_attach */ +#define messageq_setup_transport_proxy_attach(remote_proc_id, shared_addr) \ + transportshm_setup_attach(remote_proc_id, \ + shared_addr) + +/* function that will be called in messageq_detach */ +#define messageq_setup_transport_proxy_detach(remote_proc_id) \ + transportshm_setup_detach(remote_proc_id) + +/* Shared memory req function */ +#define messageq_setup_transport_proxy_shared_mem_req(shared_addr) \ + transportshm_setup_shared_mem_req(shared_addr) + +/* is_registered function */ +#define messageq_setup_transport_proxy_is_registered(remote_proc_id) \ + transportshm_setup_is_registered(remote_proc_id) + +#endif /* _TRANSPORTSHM_SETUP_PROXY_H_ */ |